@thatopen/components 2.2.9 → 2.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,13 +1,13 @@
1
- "use strict";var lo=Object.defineProperty;var ho=(c,s,t)=>s in c?lo(c,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[s]=t;var T=(c,s,t)=>(ho(c,typeof s!="symbol"?s+"":s,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("three"),Ir=require("@thatopen/fragments"),uo=require("web-ifc");function mn(c){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(s,t,e.get?e:{enumerable:!0,get:()=>c[t]})}}return s.default=c,Object.freeze(s)}const x=mn(S),Ie=mn(Ir),Z=mn(uo),gr=0,fo=1,po=2,Nn=2,bi=1.25,bn=1,js=6*4+4+4,Ai=65535,Eo=Math.pow(2,-24),Pi=Symbol("SKIP_GENERATION");function mo(c){return c.index?c.index.count:c.attributes.position.count}function Ze(c){return mo(c)/3}function Io(c,s=ArrayBuffer){return c>65535?new Uint32Array(new s(4*c)):new Uint16Array(new s(2*c))}function go(c,s){if(!c.index){const t=c.attributes.position.count,e=s.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=Io(t,e);c.setIndex(new S.BufferAttribute(i,1));for(let n=0;n<t;n++)i[n]=n}}function Cr(c){const s=Ze(c),t=c.drawRange,e=t.start/3,i=(t.start+t.count)/3,n=Math.max(0,e),r=Math.min(s,i)-n;return[{offset:Math.floor(n),count:Math.floor(r)}]}function Tr(c){if(!c.groups||!c.groups.length)return Cr(c);const s=[],t=new Set,e=c.drawRange,i=e.start/3,n=(e.start+e.count)/3;for(const o of c.groups){const a=o.start/3,l=(o.start+o.count)/3;t.add(Math.max(i,a)),t.add(Math.min(n,l))}const r=Array.from(t.values()).sort((o,a)=>o-a);for(let o=0;o<r.length-1;o++){const a=r[o],l=r[o+1];s.push({offset:Math.floor(a),count:Math.floor(l-a)})}return s}function Co(c){if(c.groups.length===0)return!1;const s=Ze(c),t=Tr(c).sort((n,r)=>n.offset-r.offset),e=t[t.length-1];e.count=Math.min(s-e.offset,e.count);let i=0;return t.forEach(({count:n})=>i+=n),s!==i}function yt(c,s,t){return t.min.x=s[c],t.min.y=s[c+1],t.min.z=s[c+2],t.max.x=s[c+3],t.max.y=s[c+4],t.max.z=s[c+5],t}function To(c){c[0]=c[1]=c[2]=1/0,c[3]=c[4]=c[5]=-1/0}function Pn(c){let s=-1,t=-1/0;for(let e=0;e<3;e++){const i=c[e+3]-c[e];i>t&&(t=i,s=e)}return s}function Ln(c,s){s.set(c)}function Mn(c,s,t){let e,i;for(let n=0;n<3;n++){const r=n+3;e=c[n],i=s[n],t[n]=e<i?e:i,e=c[r],i=s[r],t[r]=e>i?e:i}}function ys(c,s,t){for(let e=0;e<3;e++){const i=s[c+2*e],n=s[c+2*e+1],r=i-n,o=i+n;r<t[e]&&(t[e]=r),o>t[e+3]&&(t[e+3]=o)}}function qe(c){const s=c[3]-c[0],t=c[4]-c[1],e=c[5]-c[2];return 2*(s*t+t*e+e*s)}function Li(c,s,t,e,i=null){let n=1/0,r=1/0,o=1/0,a=-1/0,l=-1/0,h=-1/0,d=1/0,u=1/0,f=1/0,E=-1/0,p=-1/0,I=-1/0;const m=i!==null;for(let C=s*6,R=(s+t)*6;C<R;C+=6){const g=c[C+0],y=c[C+1],w=g-y,O=g+y;w<n&&(n=w),O>a&&(a=O),m&&g<d&&(d=g),m&&g>E&&(E=g);const M=c[C+2],b=c[C+3],v=M-b,k=M+b;v<r&&(r=v),k>l&&(l=k),m&&M<u&&(u=M),m&&M>p&&(p=M);const F=c[C+4],L=c[C+5],_=F-L,D=F+L;_<o&&(o=_),D>h&&(h=D),m&&F<f&&(f=F),m&&F>I&&(I=F)}e[0]=n,e[1]=r,e[2]=o,e[3]=a,e[4]=l,e[5]=h,m&&(i[0]=d,i[1]=u,i[2]=f,i[3]=E,i[4]=p,i[5]=I)}function _o(c,s,t,e){let i=1/0,n=1/0,r=1/0,o=-1/0,a=-1/0,l=-1/0;for(let h=s*6,d=(s+t)*6;h<d;h+=6){const u=c[h+0];u<i&&(i=u),u>o&&(o=u);const f=c[h+2];f<n&&(n=f),f>a&&(a=f);const E=c[h+4];E<r&&(r=E),E>l&&(l=E)}e[0]=i,e[1]=n,e[2]=r,e[3]=o,e[4]=a,e[5]=l}function Ao(c,s){To(s);const t=c.attributes.position,e=c.index?c.index.array:null,i=Ze(c),n=new Float32Array(i*6),r=t.normalized,o=t.array,a=t.offset||0;let l=3;t.isInterleavedBufferAttribute&&(l=t.data.stride);const h=["getX","getY","getZ"];for(let d=0;d<i;d++){const u=d*3,f=d*6;let E=u+0,p=u+1,I=u+2;e&&(E=e[E],p=e[p],I=e[I]),r||(E=E*l+a,p=p*l+a,I=I*l+a);for(let m=0;m<3;m++){let C,R,g;r?(C=t[h[m]](E),R=t[h[m]](p),g=t[h[m]](I)):(C=o[E+m],R=o[p+m],g=o[I+m]);let y=C;R<y&&(y=R),g<y&&(y=g);let w=C;R>w&&(w=R),g>w&&(w=g);const O=(w-y)/2,M=m*2;n[f+M+0]=y+O,n[f+M+1]=O+(Math.abs(y)+O)*Eo,y<s[m]&&(s[m]=y),w>s[m+3]&&(s[m+3]=w)}}return n}const ae=32,Ro=(c,s)=>c.candidate-s.candidate,de=new Array(ae).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),Fs=new Float32Array(6);function yo(c,s,t,e,i,n){let r=-1,o=0;if(n===gr)r=Pn(s),r!==-1&&(o=(s[r]+s[r+3])/2);else if(n===fo)r=Pn(c),r!==-1&&(o=Fo(t,e,i,r));else if(n===po){const a=qe(c);let l=bi*i;const h=e*6,d=(e+i)*6;for(let u=0;u<3;u++){const f=s[u],I=(s[u+3]-f)/ae;if(i<ae/4){const m=[...de];m.length=i;let C=0;for(let g=h;g<d;g+=6,C++){const y=m[C];y.candidate=t[g+2*u],y.count=0;const{bounds:w,leftCacheBounds:O,rightCacheBounds:M}=y;for(let b=0;b<3;b++)M[b]=1/0,M[b+3]=-1/0,O[b]=1/0,O[b+3]=-1/0,w[b]=1/0,w[b+3]=-1/0;ys(g,t,w)}m.sort(Ro);let R=i;for(let g=0;g<R;g++){const y=m[g];for(;g+1<R&&m[g+1].candidate===y.candidate;)m.splice(g+1,1),R--}for(let g=h;g<d;g+=6){const y=t[g+2*u];for(let w=0;w<R;w++){const O=m[w];y>=O.candidate?ys(g,t,O.rightCacheBounds):(ys(g,t,O.leftCacheBounds),O.count++)}}for(let g=0;g<R;g++){const y=m[g],w=y.count,O=i-y.count,M=y.leftCacheBounds,b=y.rightCacheBounds;let v=0;w!==0&&(v=qe(M)/a);let k=0;O!==0&&(k=qe(b)/a);const F=bn+bi*(v*w+k*O);F<l&&(r=u,l=F,o=y.candidate)}}else{for(let R=0;R<ae;R++){const g=de[R];g.count=0,g.candidate=f+I+R*I;const y=g.bounds;for(let w=0;w<3;w++)y[w]=1/0,y[w+3]=-1/0}for(let R=h;R<d;R+=6){let w=~~((t[R+2*u]-f)/I);w>=ae&&(w=ae-1);const O=de[w];O.count++,ys(R,t,O.bounds)}const m=de[ae-1];Ln(m.bounds,m.rightCacheBounds);for(let R=ae-2;R>=0;R--){const g=de[R],y=de[R+1];Mn(g.bounds,y.rightCacheBounds,g.rightCacheBounds)}let C=0;for(let R=0;R<ae-1;R++){const g=de[R],y=g.count,w=g.bounds,M=de[R+1].rightCacheBounds;y!==0&&(C===0?Ln(w,Fs):Mn(w,Fs,Fs)),C+=y;let b=0,v=0;C!==0&&(b=qe(Fs)/a);const k=i-C;k!==0&&(v=qe(M)/a);const F=bn+bi*(b*C+v*k);F<l&&(r=u,l=F,o=g.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${n} used.`);return{axis:r,pos:o}}function Fo(c,s,t,e){let i=0;for(let n=s,r=s+t;n<r;n++)i+=c[n*6+e*2];return i/t}class ws{constructor(){}}function wo(c,s,t,e,i,n){let r=e,o=e+i-1;const a=n.pos,l=n.axis*2;for(;;){for(;r<=o&&t[r*6+l]<a;)r++;for(;r<=o&&t[o*6+l]>=a;)o--;if(r<o){for(let h=0;h<3;h++){let d=s[r*3+h];s[r*3+h]=s[o*3+h],s[o*3+h]=d}for(let h=0;h<6;h++){let d=t[r*6+h];t[r*6+h]=t[o*6+h],t[o*6+h]=d}r++,o--}else return r}}function So(c,s,t,e,i,n){let r=e,o=e+i-1;const a=n.pos,l=n.axis*2;for(;;){for(;r<=o&&t[r*6+l]<a;)r++;for(;r<=o&&t[o*6+l]>=a;)o--;if(r<o){let h=c[r];c[r]=c[o],c[o]=h;for(let d=0;d<6;d++){let u=t[r*6+d];t[r*6+d]=t[o*6+d],t[o*6+d]=u}r++,o--}else return r}}function Oo(c,s){const t=(c.index?c.index.count:c.attributes.position.count)/3,e=t>2**16,i=e?4:2,n=s?new SharedArrayBuffer(t*i):new ArrayBuffer(t*i),r=e?new Uint32Array(n):new Uint16Array(n);for(let o=0,a=r.length;o<a;o++)r[o]=o;return r}function No(c,s){const t=c.geometry,e=t.index?t.index.array:null,i=s.maxDepth,n=s.verbose,r=s.maxLeafTris,o=s.strategy,a=s.onProgress,l=Ze(t),h=c._indirectBuffer;let d=!1;const u=new Float32Array(6),f=new Float32Array(6),E=Ao(t,u),p=s.indirect?So:wo,I=[],m=s.indirect?Cr(t):Tr(t);if(m.length===1){const g=m[0],y=new ws;y.boundingData=u,_o(E,g.offset,g.count,f),R(y,g.offset,g.count,f),I.push(y)}else for(let g of m){const y=new ws;y.boundingData=new Float32Array(6),Li(E,g.offset,g.count,y.boundingData,f),R(y,g.offset,g.count,f),I.push(y)}return I;function C(g){a&&a(g/l)}function R(g,y,w,O=null,M=0){if(!d&&M>=i&&(d=!0,n&&(console.warn(`MeshBVH: Max depth of ${i} reached when generating BVH. Consider increasing maxDepth.`),console.warn(t))),w<=r||M>=i)return C(y+w),g.offset=y,g.count=w,g;const b=yo(g.boundingData,O,E,y,w,o);if(b.axis===-1)return C(y+w),g.offset=y,g.count=w,g;const v=p(h,e,E,y,w,b);if(v===y||v===y+w)C(y+w),g.offset=y,g.count=w;else{g.splitAxis=b.axis;const k=new ws,F=y,L=v-y;g.left=k,k.boundingData=new Float32Array(6),Li(E,F,L,k.boundingData,f),R(k,F,L,f,M+1);const _=new ws,D=v,q=w-L;g.right=_,_.boundingData=new Float32Array(6),Li(E,D,q,_.boundingData,f),R(_,D,q,f,M+1)}return g}}function bo(c,s){const t=c.geometry;s.indirect&&(c._indirectBuffer=Oo(t,s.useSharedArrayBuffer),Co(t)&&!s.verbose&&console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),c._indirectBuffer||go(t,s);const e=No(c,s);let i,n,r;const o=[],a=s.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let d=0;d<e.length;d++){const u=e[d];let f=l(u);const E=new a(js*f);i=new Float32Array(E),n=new Uint32Array(E),r=new Uint16Array(E),h(0,u),o.push(E)}c._roots=o;return;function l(d){return d.count?1:1+l(d.left)+l(d.right)}function h(d,u){const f=d/4,E=d/2,p=!!u.count,I=u.boundingData;for(let m=0;m<6;m++)i[f+m]=I[m];if(p){const m=u.offset,C=u.count;return n[f+6]=m,r[E+14]=C,r[E+15]=Ai,d+js}else{const m=u.left,C=u.right,R=u.splitAxis;let g;if(g=h(d+js,m),g/4>Math.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return n[f+6]=g/4,g=h(g,C),n[f+7]=R,g}}}class ce{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(s,t){let e=1/0,i=-1/0;for(let n=0,r=s.length;n<r;n++){const a=s[n][t];e=a<e?a:e,i=a>i?a:i}this.min=e,this.max=i}setFromPoints(s,t){let e=1/0,i=-1/0;for(let n=0,r=t.length;n<r;n++){const o=t[n],a=s.dot(o);e=a<e?a:e,i=a>i?a:i}this.min=e,this.max=i}isSeparated(s){return this.min>s.max||s.min>this.max}}ce.prototype.setFromBox=function(){const c=new S.Vector3;return function(t,e){const i=e.min,n=e.max;let r=1/0,o=-1/0;for(let a=0;a<=1;a++)for(let l=0;l<=1;l++)for(let h=0;h<=1;h++){c.x=i.x*a+n.x*(1-a),c.y=i.y*l+n.y*(1-l),c.z=i.z*h+n.z*(1-h);const d=t.dot(c);r=Math.min(d,r),o=Math.max(d,o)}this.min=r,this.max=o}}();const Po=function(){const c=new S.Vector3,s=new S.Vector3,t=new S.Vector3;return function(i,n,r){const o=i.start,a=c,l=n.start,h=s;t.subVectors(o,l),c.subVectors(i.end,i.start),s.subVectors(n.end,n.start);const d=t.dot(h),u=h.dot(a),f=h.dot(h),E=t.dot(a),I=a.dot(a)*f-u*u;let m,C;I!==0?m=(d*u-E*f)/I:m=0,C=(d+m*u)/f,r.x=m,r.y=C}}(),In=function(){const c=new S.Vector2,s=new S.Vector3,t=new S.Vector3;return function(i,n,r,o){Po(i,n,c);let a=c.x,l=c.y;if(a>=0&&a<=1&&l>=0&&l<=1){i.at(a,r),n.at(l,o);return}else if(a>=0&&a<=1){l<0?n.at(0,o):n.at(1,o),i.closestPointToPoint(o,!0,r);return}else if(l>=0&&l<=1){a<0?i.at(0,r):i.at(1,r),n.closestPointToPoint(r,!0,o);return}else{let h;a<0?h=i.start:h=i.end;let d;l<0?d=n.start:d=n.end;const u=s,f=t;if(i.closestPointToPoint(d,!0,s),n.closestPointToPoint(h,!0,t),u.distanceToSquared(d)<=f.distanceToSquared(h)){r.copy(u),o.copy(d);return}else{r.copy(h),o.copy(f);return}}}}(),Lo=function(){const c=new S.Vector3,s=new S.Vector3,t=new S.Plane,e=new S.Line3;return function(n,r){const{radius:o,center:a}=n,{a:l,b:h,c:d}=r;if(e.start=l,e.end=h,e.closestPointToPoint(a,!0,c).distanceTo(a)<=o||(e.start=l,e.end=d,e.closestPointToPoint(a,!0,c).distanceTo(a)<=o)||(e.start=h,e.end=d,e.closestPointToPoint(a,!0,c).distanceTo(a)<=o))return!0;const p=r.getPlane(t);if(Math.abs(p.distanceToPoint(a))<=o){const m=p.projectPoint(a,s);if(r.containsPoint(m))return!0}return!1}}(),Mo=1e-15;function Mi(c){return Math.abs(c)<Mo}class Kt extends S.Triangle{constructor(...s){super(...s),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new S.Vector3),this.satBounds=new Array(4).fill().map(()=>new ce),this.points=[this.a,this.b,this.c],this.sphere=new S.Sphere,this.plane=new S.Plane,this.needsUpdate=!0}intersectsSphere(s){return Lo(s,this)}update(){const s=this.a,t=this.b,e=this.c,i=this.points,n=this.satAxes,r=this.satBounds,o=n[0],a=r[0];this.getNormal(o),a.setFromPoints(o,i);const l=n[1],h=r[1];l.subVectors(s,t),h.setFromPoints(l,i);const d=n[2],u=r[2];d.subVectors(t,e),u.setFromPoints(d,i);const f=n[3],E=r[3];f.subVectors(e,s),E.setFromPoints(f,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(o,s),this.needsUpdate=!1}}Kt.prototype.closestPointToSegment=function(){const c=new S.Vector3,s=new S.Vector3,t=new S.Line3;return function(i,n=null,r=null){const{start:o,end:a}=i,l=this.points;let h,d=1/0;for(let u=0;u<3;u++){const f=(u+1)%3;t.start.copy(l[u]),t.end.copy(l[f]),In(t,i,c,s),h=c.distanceToSquared(s),h<d&&(d=h,n&&n.copy(c),r&&r.copy(s))}return this.closestPointToPoint(o,c),h=o.distanceToSquared(c),h<d&&(d=h,n&&n.copy(c),r&&r.copy(o)),this.closestPointToPoint(a,c),h=a.distanceToSquared(c),h<d&&(d=h,n&&n.copy(c),r&&r.copy(a)),Math.sqrt(d)}}();Kt.prototype.intersectsTriangle=function(){const c=new Kt,s=new Array(3),t=new Array(3),e=new ce,i=new ce,n=new S.Vector3,r=new S.Vector3,o=new S.Vector3,a=new S.Vector3,l=new S.Vector3,h=new S.Line3,d=new S.Line3,u=new S.Line3,f=new S.Vector3;function E(p,I,m){const C=p.points;let R=0,g=-1;for(let y=0;y<3;y++){const{start:w,end:O}=h;w.copy(C[y]),O.copy(C[(y+1)%3]),h.delta(r);const M=Mi(I.distanceToPoint(w));if(Mi(I.normal.dot(r))&&M){m.copy(h),R=2;break}const b=I.intersectLine(h,f);if(!b&&M&&f.copy(w),(b||M)&&!Mi(f.distanceTo(O))){if(R<=1)(R===1?m.start:m.end).copy(f),M&&(g=R);else if(R>=2){(g===1?m.start:m.end).copy(f),R=2;break}if(R++,R===2&&g===-1)break}}return R}return function(I,m=null,C=!1){this.needsUpdate&&this.update(),I.isExtendedTriangle?I.needsUpdate&&I.update():(c.copy(I),c.update(),I=c);const R=this.plane,g=I.plane;if(Math.abs(R.normal.dot(g.normal))>1-1e-10){const y=this.satBounds,w=this.satAxes;t[0]=I.a,t[1]=I.b,t[2]=I.c;for(let b=0;b<4;b++){const v=y[b],k=w[b];if(e.setFromPoints(k,t),v.isSeparated(e))return!1}const O=I.satBounds,M=I.satAxes;s[0]=this.a,s[1]=this.b,s[2]=this.c;for(let b=0;b<4;b++){const v=O[b],k=M[b];if(e.setFromPoints(k,s),v.isSeparated(e))return!1}for(let b=0;b<4;b++){const v=w[b];for(let k=0;k<4;k++){const F=M[k];if(n.crossVectors(v,F),e.setFromPoints(n,s),i.setFromPoints(n,t),e.isSeparated(i))return!1}}return m&&(C||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),m.start.set(0,0,0),m.end.set(0,0,0)),!0}else{const y=E(this,g,d);if(y===1&&I.containsPoint(d.end))return m&&(m.start.copy(d.end),m.end.copy(d.end)),!0;if(y!==2)return!1;const w=E(I,R,u);if(w===1&&this.containsPoint(u.end))return m&&(m.start.copy(u.end),m.end.copy(u.end)),!0;if(w!==2)return!1;if(d.delta(o),u.delta(a),o.dot(a)<0){let L=u.start;u.start=u.end,u.end=L}const O=d.start.dot(o),M=d.end.dot(o),b=u.start.dot(o),v=u.end.dot(o),k=M<b,F=O<v;return O!==v&&b!==M&&k===F?!1:(m&&(l.subVectors(d.start,u.start),l.dot(o)>0?m.start.copy(d.start):m.start.copy(u.start),l.subVectors(d.end,u.end),l.dot(o)<0?m.end.copy(d.end):m.end.copy(u.end)),!0)}}}();Kt.prototype.distanceToPoint=function(){const c=new S.Vector3;return function(t){return this.closestPointToPoint(t,c),t.distanceTo(c)}}();Kt.prototype.distanceToTriangle=function(){const c=new S.Vector3,s=new S.Vector3,t=["a","b","c"],e=new S.Line3,i=new S.Line3;return function(r,o=null,a=null){const l=o||a?e:null;if(this.intersectsTriangle(r,l))return(o||a)&&(o&&l.getCenter(o),a&&l.getCenter(a)),0;let h=1/0;for(let d=0;d<3;d++){let u;const f=t[d],E=r[f];this.closestPointToPoint(E,c),u=E.distanceToSquared(c),u<h&&(h=u,o&&o.copy(c),a&&a.copy(E));const p=this[f];r.closestPointToPoint(p,c),u=p.distanceToSquared(c),u<h&&(h=u,o&&o.copy(p),a&&a.copy(c))}for(let d=0;d<3;d++){const u=t[d],f=t[(d+1)%3];e.set(this[u],this[f]);for(let E=0;E<3;E++){const p=t[E],I=t[(E+1)%3];i.set(r[p],r[I]),In(e,i,c,s);const m=c.distanceToSquared(s);m<h&&(h=m,o&&o.copy(c),a&&a.copy(s))}}return Math.sqrt(h)}}();class Dt{constructor(s,t,e){this.isOrientedBox=!0,this.min=new S.Vector3,this.max=new S.Vector3,this.matrix=new S.Matrix4,this.invMatrix=new S.Matrix4,this.points=new Array(8).fill().map(()=>new S.Vector3),this.satAxes=new Array(3).fill().map(()=>new S.Vector3),this.satBounds=new Array(3).fill().map(()=>new ce),this.alignedSatBounds=new Array(3).fill().map(()=>new ce),this.needsUpdate=!1,s&&this.min.copy(s),t&&this.max.copy(t),e&&this.matrix.copy(e)}set(s,t,e){this.min.copy(s),this.max.copy(t),this.matrix.copy(e),this.needsUpdate=!0}copy(s){this.min.copy(s.min),this.max.copy(s.max),this.matrix.copy(s.matrix),this.needsUpdate=!0}}Dt.prototype.update=function(){return function(){const s=this.matrix,t=this.min,e=this.max,i=this.points;for(let l=0;l<=1;l++)for(let h=0;h<=1;h++)for(let d=0;d<=1;d++){const u=1*l|2*h|4*d,f=i[u];f.x=l?e.x:t.x,f.y=h?e.y:t.y,f.z=d?e.z:t.z,f.applyMatrix4(s)}const n=this.satBounds,r=this.satAxes,o=i[0];for(let l=0;l<3;l++){const h=r[l],d=n[l],u=1<<l,f=i[u];h.subVectors(o,f),d.setFromPoints(h,i)}const a=this.alignedSatBounds;a[0].setFromPointsField(i,"x"),a[1].setFromPointsField(i,"y"),a[2].setFromPointsField(i,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}}();Dt.prototype.intersectsBox=function(){const c=new ce;return function(t){this.needsUpdate&&this.update();const e=t.min,i=t.max,n=this.satBounds,r=this.satAxes,o=this.alignedSatBounds;if(c.min=e.x,c.max=i.x,o[0].isSeparated(c)||(c.min=e.y,c.max=i.y,o[1].isSeparated(c))||(c.min=e.z,c.max=i.z,o[2].isSeparated(c)))return!1;for(let a=0;a<3;a++){const l=r[a],h=n[a];if(c.setFromBox(l,t),h.isSeparated(c))return!1}return!0}}();Dt.prototype.intersectsTriangle=function(){const c=new Kt,s=new Array(3),t=new ce,e=new ce,i=new S.Vector3;return function(r){this.needsUpdate&&this.update(),r.isExtendedTriangle?r.needsUpdate&&r.update():(c.copy(r),c.update(),r=c);const o=this.satBounds,a=this.satAxes;s[0]=r.a,s[1]=r.b,s[2]=r.c;for(let u=0;u<3;u++){const f=o[u],E=a[u];if(t.setFromPoints(E,s),f.isSeparated(t))return!1}const l=r.satBounds,h=r.satAxes,d=this.points;for(let u=0;u<3;u++){const f=l[u],E=h[u];if(t.setFromPoints(E,d),f.isSeparated(t))return!1}for(let u=0;u<3;u++){const f=a[u];for(let E=0;E<4;E++){const p=h[E];if(i.crossVectors(f,p),t.setFromPoints(i,s),e.setFromPoints(i,d),t.isSeparated(e))return!1}}return!0}}();Dt.prototype.closestPointToPoint=function(){return function(s,t){return this.needsUpdate&&this.update(),t.copy(s).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),t}}();Dt.prototype.distanceToPoint=function(){const c=new S.Vector3;return function(t){return this.closestPointToPoint(t,c),t.distanceTo(c)}}();Dt.prototype.distanceToBox=function(){const c=["x","y","z"],s=new Array(12).fill().map(()=>new S.Line3),t=new Array(12).fill().map(()=>new S.Line3),e=new S.Vector3,i=new S.Vector3;return function(r,o=0,a=null,l=null){if(this.needsUpdate&&this.update(),this.intersectsBox(r))return(a||l)&&(r.getCenter(i),this.closestPointToPoint(i,e),r.closestPointToPoint(e,i),a&&a.copy(e),l&&l.copy(i)),0;const h=o*o,d=r.min,u=r.max,f=this.points;let E=1/0;for(let I=0;I<8;I++){const m=f[I];i.copy(m).clamp(d,u);const C=m.distanceToSquared(i);if(C<E&&(E=C,a&&a.copy(m),l&&l.copy(i),C<h))return Math.sqrt(C)}let p=0;for(let I=0;I<3;I++)for(let m=0;m<=1;m++)for(let C=0;C<=1;C++){const R=(I+1)%3,g=(I+2)%3,y=m<<R|C<<g,w=1<<I|m<<R|C<<g,O=f[y],M=f[w];s[p].set(O,M);const v=c[I],k=c[R],F=c[g],L=t[p],_=L.start,D=L.end;_[v]=d[v],_[k]=m?d[k]:u[k],_[F]=C?d[F]:u[k],D[v]=u[v],D[k]=m?d[k]:u[k],D[F]=C?d[F]:u[k],p++}for(let I=0;I<=1;I++)for(let m=0;m<=1;m++)for(let C=0;C<=1;C++){i.x=I?u.x:d.x,i.y=m?u.y:d.y,i.z=C?u.z:d.z,this.closestPointToPoint(i,e);const R=i.distanceToSquared(e);if(R<E&&(E=R,a&&a.copy(e),l&&l.copy(i),R<h))return Math.sqrt(R)}for(let I=0;I<12;I++){const m=s[I];for(let C=0;C<12;C++){const R=t[C];In(m,R,e,i);const g=e.distanceToSquared(i);if(g<E&&(E=g,a&&a.copy(e),l&&l.copy(i),g<h))return Math.sqrt(g)}}return Math.sqrt(E)}}();class gn{constructor(s){this._getNewPrimitive=s,this._primitives=[]}getPrimitive(){const s=this._primitives;return s.length===0?this._getNewPrimitive():s.pop()}releasePrimitive(s){this._primitives.push(s)}}class xo extends gn{constructor(){super(()=>new Kt)}}const Yt=new xo;function Bt(c,s){return s[c+15]===65535}function zt(c,s){return s[c+6]}function Ht(c,s){return s[c+14]}function Wt(c){return c+8}function Xt(c,s){return s[c+6]}function _r(c,s){return s[c+7]}class vo{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const s=[];let t=null;this.setBuffer=e=>{t&&s.push(t),t=e,this.float32Array=new Float32Array(e),this.uint16Array=new Uint16Array(e),this.uint32Array=new Uint32Array(e)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,s.length!==0&&this.setBuffer(s.pop())}}}const _t=new vo;let me,He;const be=[],Ss=new gn(()=>new S.Box3);function Do(c,s,t,e,i,n){me=Ss.getPrimitive(),He=Ss.getPrimitive(),be.push(me,He),_t.setBuffer(c._roots[s]);const r=qi(0,c.geometry,t,e,i,n);_t.clearBuffer(),Ss.releasePrimitive(me),Ss.releasePrimitive(He),be.pop(),be.pop();const o=be.length;return o>0&&(He=be[o-1],me=be[o-2]),r}function qi(c,s,t,e,i=null,n=0,r=0){const{float32Array:o,uint16Array:a,uint32Array:l}=_t;let h=c*2;if(Bt(h,a)){const u=zt(c,l),f=Ht(h,a);return yt(c,o,me),e(u,f,!1,r,n+c,me)}else{let v=function(F){const{uint16Array:L,uint32Array:_}=_t;let D=F*2;for(;!Bt(D,L);)F=Wt(F),D=F*2;return zt(F,_)},k=function(F){const{uint16Array:L,uint32Array:_}=_t;let D=F*2;for(;!Bt(D,L);)F=Xt(F,_),D=F*2;return zt(F,_)+Ht(D,L)};const u=Wt(c),f=Xt(c,l);let E=u,p=f,I,m,C,R;if(i&&(C=me,R=He,yt(E,o,C),yt(p,o,R),I=i(C),m=i(R),m<I)){E=f,p=u;const F=I;I=m,m=F,C=R}C||(C=me,yt(E,o,C));const g=Bt(E*2,a),y=t(C,g,I,r+1,n+E);let w;if(y===Nn){const F=v(E),_=k(E)-F;w=e(F,_,!0,r+1,n+E,C)}else w=y&&qi(E,s,t,e,i,n,r+1);if(w)return!0;R=He,yt(p,o,R);const O=Bt(p*2,a),M=t(R,O,m,r+1,n+p);let b;if(M===Nn){const F=v(p),_=k(p)-F;b=e(F,_,!0,r+1,n+p,R)}else b=M&&qi(p,s,t,e,i,n,r+1);return!!b}}const Ke=new S.Vector3,xi=new S.Vector3;function Uo(c,s,t={},e=0,i=1/0){const n=e*e,r=i*i;let o=1/0,a=null;if(c.shapecast({boundsTraverseOrder:h=>(Ke.copy(s).clamp(h.min,h.max),Ke.distanceToSquared(s)),intersectsBounds:(h,d,u)=>u<o&&u<r,intersectsTriangle:(h,d)=>{h.closestPointToPoint(s,Ke);const u=s.distanceToSquared(Ke);return u<o&&(xi.copy(Ke),o=u,a=d),u<n}}),o===1/0)return null;const l=Math.sqrt(o);return t.point?t.point.copy(xi):t.point=xi.clone(),t.distance=l,t.faceIndex=a,t}const Pe=new S.Vector3,Le=new S.Vector3,Me=new S.Vector3,Os=new S.Vector2,Ns=new S.Vector2,bs=new S.Vector2,xn=new S.Vector3,vn=new S.Vector3,Dn=new S.Vector3,Ps=new S.Vector3;function Bo(c,s,t,e,i,n){let r;return n===S.BackSide?r=c.intersectTriangle(e,t,s,!0,i):r=c.intersectTriangle(s,t,e,n!==S.DoubleSide,i),r===null?null:{distance:c.origin.distanceTo(i),point:i.clone()}}function zo(c,s,t,e,i,n,r,o,a){Pe.fromBufferAttribute(s,n),Le.fromBufferAttribute(s,r),Me.fromBufferAttribute(s,o);const l=Bo(c,Pe,Le,Me,Ps,a);if(l){e&&(Os.fromBufferAttribute(e,n),Ns.fromBufferAttribute(e,r),bs.fromBufferAttribute(e,o),l.uv=S.Triangle.getInterpolation(Ps,Pe,Le,Me,Os,Ns,bs,new S.Vector2)),i&&(Os.fromBufferAttribute(i,n),Ns.fromBufferAttribute(i,r),bs.fromBufferAttribute(i,o),l.uv1=S.Triangle.getInterpolation(Ps,Pe,Le,Me,Os,Ns,bs,new S.Vector2)),t&&(xn.fromBufferAttribute(t,n),vn.fromBufferAttribute(t,r),Dn.fromBufferAttribute(t,o),l.normal=S.Triangle.getInterpolation(Ps,Pe,Le,Me,xn,vn,Dn,new S.Vector3),l.normal.dot(c.direction)>0&&l.normal.multiplyScalar(-1));const h={a:n,b:r,c:o,normal:new S.Vector3,materialIndex:0};S.Triangle.getNormal(Pe,Le,Me,h.normal),l.face=h,l.faceIndex=n}return l}function Ri(c,s,t,e,i){const n=e*3;let r=n+0,o=n+1,a=n+2;const l=c.index;c.index&&(r=l.getX(r),o=l.getX(o),a=l.getX(a));const{position:h,normal:d,uv:u,uv1:f}=c.attributes,E=zo(t,h,d,u,f,r,o,a,s);return E?(E.faceIndex=e,i&&i.push(E),E):null}function bt(c,s,t,e){const i=c.a,n=c.b,r=c.c;let o=s,a=s+1,l=s+2;t&&(o=t.getX(o),a=t.getX(a),l=t.getX(l)),i.x=e.getX(o),i.y=e.getY(o),i.z=e.getZ(o),n.x=e.getX(a),n.y=e.getY(a),n.z=e.getZ(a),r.x=e.getX(l),r.y=e.getY(l),r.z=e.getZ(l)}function Vo(c,s,t,e,i,n){const{geometry:r,_indirectBuffer:o}=c;for(let a=e,l=e+i;a<l;a++)Ri(r,s,t,a,n)}function ko(c,s,t,e,i){const{geometry:n,_indirectBuffer:r}=c;let o=1/0,a=null;for(let l=e,h=e+i;l<h;l++){let d;d=Ri(n,s,t,l),d&&d.distance<o&&(a=d,o=d.distance)}return a}function Go(c,s,t,e,i,n,r){const{geometry:o}=t,{index:a}=o,l=o.attributes.position;for(let h=c,d=s+c;h<d;h++){let u;if(u=h,bt(r,u*3,a,l),r.needsUpdate=!0,e(r,u,i,n))return!0}return!1}function Yo(c,s=null){s&&Array.isArray(s)&&(s=new Set(s));const t=c.geometry,e=t.index?t.index.array:null,i=t.attributes.position;let n,r,o,a,l=0;const h=c._roots;for(let u=0,f=h.length;u<f;u++)n=h[u],r=new Uint32Array(n),o=new Uint16Array(n),a=new Float32Array(n),d(0,l),l+=n.byteLength;function d(u,f,E=!1){const p=u*2;if(o[p+15]===Ai){const m=r[u+6],C=o[p+14];let R=1/0,g=1/0,y=1/0,w=-1/0,O=-1/0,M=-1/0;for(let b=3*m,v=3*(m+C);b<v;b++){let k=e[b];const F=i.getX(k),L=i.getY(k),_=i.getZ(k);F<R&&(R=F),F>w&&(w=F),L<g&&(g=L),L>O&&(O=L),_<y&&(y=_),_>M&&(M=_)}return a[u+0]!==R||a[u+1]!==g||a[u+2]!==y||a[u+3]!==w||a[u+4]!==O||a[u+5]!==M?(a[u+0]=R,a[u+1]=g,a[u+2]=y,a[u+3]=w,a[u+4]=O,a[u+5]=M,!0):!1}else{const m=u+8,C=r[u+6],R=m+f,g=C+f;let y=E,w=!1,O=!1;s?y||(w=s.has(R),O=s.has(g),y=!w&&!O):(w=!0,O=!0);const M=y||w,b=y||O;let v=!1;M&&(v=d(m,f,y));let k=!1;b&&(k=d(C,f,y));const F=v||k;if(F)for(let L=0;L<3;L++){const _=m+L,D=C+L,q=a[_],G=a[_+3],et=a[D],W=a[D+3];a[u+L]=q<et?q:et,a[u+L+3]=G>W?G:W}return F}}}const Un=new S.Box3;function ge(c,s,t,e){return yt(c,s,Un),t.intersectBox(Un,e)}function Ho(c,s,t,e,i,n){const{geometry:r,_indirectBuffer:o}=c;for(let a=e,l=e+i;a<l;a++){let h=o?o[a]:a;Ri(r,s,t,h,n)}}function Wo(c,s,t,e,i){const{geometry:n,_indirectBuffer:r}=c;let o=1/0,a=null;for(let l=e,h=e+i;l<h;l++){let d;d=Ri(n,s,t,r?r[l]:l),d&&d.distance<o&&(a=d,o=d.distance)}return a}function Xo(c,s,t,e,i,n,r){const{geometry:o}=t,{index:a}=o,l=o.attributes.position;for(let h=c,d=s+c;h<d;h++){let u;if(u=t.resolveTriangleIndex(h),bt(r,u*3,a,l),r.needsUpdate=!0,e(r,u,i,n))return!0}return!1}const Bn=new S.Vector3;function Zo(c,s,t,e,i){_t.setBuffer(c._roots[s]),Ki(0,c,t,e,i),_t.clearBuffer()}function Ki(c,s,t,e,i){const{float32Array:n,uint16Array:r,uint32Array:o}=_t,a=c*2;if(Bt(a,r)){const h=zt(c,o),d=Ht(a,r);Vo(s,t,e,h,d,i)}else{const h=Wt(c);ge(h,n,e,Bn)&&Ki(h,s,t,e,i);const d=Xt(c,o);ge(d,n,e,Bn)&&Ki(d,s,t,e,i)}}const zn=new S.Vector3,$o=["x","y","z"];function jo(c,s,t,e){_t.setBuffer(c._roots[s]);const i=Ji(0,c,t,e);return _t.clearBuffer(),i}function Ji(c,s,t,e){const{float32Array:i,uint16Array:n,uint32Array:r}=_t;let o=c*2;if(Bt(o,n)){const l=zt(c,r),h=Ht(o,n);return ko(s,t,e,l,h)}else{const l=_r(c,r),h=$o[l],u=e.direction[h]>=0;let f,E;u?(f=Wt(c),E=Xt(c,r)):(f=Xt(c,r),E=Wt(c));const I=ge(f,i,e,zn)?Ji(f,s,t,e):null;if(I){const R=I.point[h];if(u?R<=i[E+l]:R>=i[E+l+3])return I}const C=ge(E,i,e,zn)?Ji(E,s,t,e):null;return I&&C?I.distance<=C.distance?I:C:I||C||null}}const Ls=new S.Box3,xe=new Kt,ve=new Kt,Je=new S.Matrix4,Vn=new Dt,Ms=new Dt;function Qo(c,s,t,e){_t.setBuffer(c._roots[s]);const i=tn(0,c,t,e);return _t.clearBuffer(),i}function tn(c,s,t,e,i=null){const{float32Array:n,uint16Array:r,uint32Array:o}=_t;let a=c*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),Vn.set(t.boundingBox.min,t.boundingBox.max,e),i=Vn),Bt(a,r)){const h=s.geometry,d=h.index,u=h.attributes.position,f=t.index,E=t.attributes.position,p=zt(c,o),I=Ht(a,r);if(Je.copy(e).invert(),t.boundsTree)return yt(c,n,Ms),Ms.matrix.copy(Je),Ms.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:C=>Ms.intersectsBox(C),intersectsTriangle:C=>{C.a.applyMatrix4(e),C.b.applyMatrix4(e),C.c.applyMatrix4(e),C.needsUpdate=!0;for(let R=p*3,g=(I+p)*3;R<g;R+=3)if(bt(ve,R,d,u),ve.needsUpdate=!0,C.intersectsTriangle(ve))return!0;return!1}});for(let m=p*3,C=(I+p)*3;m<C;m+=3){bt(xe,m,d,u),xe.a.applyMatrix4(Je),xe.b.applyMatrix4(Je),xe.c.applyMatrix4(Je),xe.needsUpdate=!0;for(let R=0,g=f.count;R<g;R+=3)if(bt(ve,R,f,E),ve.needsUpdate=!0,xe.intersectsTriangle(ve))return!0}}else{const h=c+8,d=o[c+6];return yt(h,n,Ls),!!(i.intersectsBox(Ls)&&tn(h,s,t,e,i)||(yt(d,n,Ls),i.intersectsBox(Ls)&&tn(d,s,t,e,i)))}}const xs=new S.Matrix4,vi=new Dt,ts=new Dt,qo=new S.Vector3,Ko=new S.Vector3,Jo=new S.Vector3,ta=new S.Vector3;function ea(c,s,t,e={},i={},n=0,r=1/0){s.boundingBox||s.computeBoundingBox(),vi.set(s.boundingBox.min,s.boundingBox.max,t),vi.needsUpdate=!0;const o=c.geometry,a=o.attributes.position,l=o.index,h=s.attributes.position,d=s.index,u=Yt.getPrimitive(),f=Yt.getPrimitive();let E=qo,p=Ko,I=null,m=null;i&&(I=Jo,m=ta);let C=1/0,R=null,g=null;return xs.copy(t).invert(),ts.matrix.copy(xs),c.shapecast({boundsTraverseOrder:y=>vi.distanceToBox(y),intersectsBounds:(y,w,O)=>O<C&&O<r?(w&&(ts.min.copy(y.min),ts.max.copy(y.max),ts.needsUpdate=!0),!0):!1,intersectsRange:(y,w)=>{if(s.boundsTree)return s.boundsTree.shapecast({boundsTraverseOrder:M=>ts.distanceToBox(M),intersectsBounds:(M,b,v)=>v<C&&v<r,intersectsRange:(M,b)=>{for(let v=M,k=M+b;v<k;v++){bt(f,3*v,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let F=y,L=y+w;F<L;F++){bt(u,3*F,l,a),u.needsUpdate=!0;const _=u.distanceToTriangle(f,E,I);if(_<C&&(p.copy(E),m&&m.copy(I),C=_,R=F,g=v),_<n)return!0}}}});{const O=Ze(s);for(let M=0,b=O;M<b;M++){bt(f,3*M,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let v=y,k=y+w;v<k;v++){bt(u,3*v,l,a),u.needsUpdate=!0;const F=u.distanceToTriangle(f,E,I);if(F<C&&(p.copy(E),m&&m.copy(I),C=F,R=v,g=M),F<n)return!0}}}}}),Yt.releasePrimitive(u),Yt.releasePrimitive(f),C===1/0?null:(e.point?e.point.copy(p):e.point=p.clone(),e.distance=C,e.faceIndex=R,i&&(i.point?i.point.copy(m):i.point=m.clone(),i.point.applyMatrix4(xs),p.applyMatrix4(xs),i.distance=p.sub(i.point).length(),i.faceIndex=g),e)}function sa(c,s=null){s&&Array.isArray(s)&&(s=new Set(s));const t=c.geometry,e=t.index?t.index.array:null,i=t.attributes.position;let n,r,o,a,l=0;const h=c._roots;for(let u=0,f=h.length;u<f;u++)n=h[u],r=new Uint32Array(n),o=new Uint16Array(n),a=new Float32Array(n),d(0,l),l+=n.byteLength;function d(u,f,E=!1){const p=u*2;if(o[p+15]===Ai){const m=r[u+6],C=o[p+14];let R=1/0,g=1/0,y=1/0,w=-1/0,O=-1/0,M=-1/0;for(let b=m,v=m+C;b<v;b++){const k=3*c.resolveTriangleIndex(b);for(let F=0;F<3;F++){let L=k+F;L=e?e[L]:L;const _=i.getX(L),D=i.getY(L),q=i.getZ(L);_<R&&(R=_),_>w&&(w=_),D<g&&(g=D),D>O&&(O=D),q<y&&(y=q),q>M&&(M=q)}}return a[u+0]!==R||a[u+1]!==g||a[u+2]!==y||a[u+3]!==w||a[u+4]!==O||a[u+5]!==M?(a[u+0]=R,a[u+1]=g,a[u+2]=y,a[u+3]=w,a[u+4]=O,a[u+5]=M,!0):!1}else{const m=u+8,C=r[u+6],R=m+f,g=C+f;let y=E,w=!1,O=!1;s?y||(w=s.has(R),O=s.has(g),y=!w&&!O):(w=!0,O=!0);const M=y||w,b=y||O;let v=!1;M&&(v=d(m,f,y));let k=!1;b&&(k=d(C,f,y));const F=v||k;if(F)for(let L=0;L<3;L++){const _=m+L,D=C+L,q=a[_],G=a[_+3],et=a[D],W=a[D+3];a[u+L]=q<et?q:et,a[u+L+3]=G>W?G:W}return F}}}const kn=new S.Vector3;function ia(c,s,t,e,i){_t.setBuffer(c._roots[s]),en(0,c,t,e,i),_t.clearBuffer()}function en(c,s,t,e,i){const{float32Array:n,uint16Array:r,uint32Array:o}=_t,a=c*2;if(Bt(a,r)){const h=zt(c,o),d=Ht(a,r);Ho(s,t,e,h,d,i)}else{const h=Wt(c);ge(h,n,e,kn)&&en(h,s,t,e,i);const d=Xt(c,o);ge(d,n,e,kn)&&en(d,s,t,e,i)}}const Gn=new S.Vector3,na=["x","y","z"];function ra(c,s,t,e){_t.setBuffer(c._roots[s]);const i=sn(0,c,t,e);return _t.clearBuffer(),i}function sn(c,s,t,e){const{float32Array:i,uint16Array:n,uint32Array:r}=_t;let o=c*2;if(Bt(o,n)){const l=zt(c,r),h=Ht(o,n);return Wo(s,t,e,l,h)}else{const l=_r(c,r),h=na[l],u=e.direction[h]>=0;let f,E;u?(f=Wt(c),E=Xt(c,r)):(f=Xt(c,r),E=Wt(c));const I=ge(f,i,e,Gn)?sn(f,s,t,e):null;if(I){const R=I.point[h];if(u?R<=i[E+l]:R>=i[E+l+3])return I}const C=ge(E,i,e,Gn)?sn(E,s,t,e):null;return I&&C?I.distance<=C.distance?I:C:I||C||null}}const vs=new S.Box3,De=new Kt,Ue=new Kt,es=new S.Matrix4,Yn=new Dt,Ds=new Dt;function oa(c,s,t,e){_t.setBuffer(c._roots[s]);const i=nn(0,c,t,e);return _t.clearBuffer(),i}function nn(c,s,t,e,i=null){const{float32Array:n,uint16Array:r,uint32Array:o}=_t;let a=c*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),Yn.set(t.boundingBox.min,t.boundingBox.max,e),i=Yn),Bt(a,r)){const h=s.geometry,d=h.index,u=h.attributes.position,f=t.index,E=t.attributes.position,p=zt(c,o),I=Ht(a,r);if(es.copy(e).invert(),t.boundsTree)return yt(c,n,Ds),Ds.matrix.copy(es),Ds.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:C=>Ds.intersectsBox(C),intersectsTriangle:C=>{C.a.applyMatrix4(e),C.b.applyMatrix4(e),C.c.applyMatrix4(e),C.needsUpdate=!0;for(let R=p,g=I+p;R<g;R++)if(bt(Ue,3*s.resolveTriangleIndex(R),d,u),Ue.needsUpdate=!0,C.intersectsTriangle(Ue))return!0;return!1}});for(let m=p,C=I+p;m<C;m++){const R=s.resolveTriangleIndex(m);bt(De,3*R,d,u),De.a.applyMatrix4(es),De.b.applyMatrix4(es),De.c.applyMatrix4(es),De.needsUpdate=!0;for(let g=0,y=f.count;g<y;g+=3)if(bt(Ue,g,f,E),Ue.needsUpdate=!0,De.intersectsTriangle(Ue))return!0}}else{const h=c+8,d=o[c+6];return yt(h,n,vs),!!(i.intersectsBox(vs)&&nn(h,s,t,e,i)||(yt(d,n,vs),i.intersectsBox(vs)&&nn(d,s,t,e,i)))}}const Us=new S.Matrix4,Di=new Dt,ss=new Dt,aa=new S.Vector3,ca=new S.Vector3,la=new S.Vector3,ha=new S.Vector3;function da(c,s,t,e={},i={},n=0,r=1/0){s.boundingBox||s.computeBoundingBox(),Di.set(s.boundingBox.min,s.boundingBox.max,t),Di.needsUpdate=!0;const o=c.geometry,a=o.attributes.position,l=o.index,h=s.attributes.position,d=s.index,u=Yt.getPrimitive(),f=Yt.getPrimitive();let E=aa,p=ca,I=null,m=null;i&&(I=la,m=ha);let C=1/0,R=null,g=null;return Us.copy(t).invert(),ss.matrix.copy(Us),c.shapecast({boundsTraverseOrder:y=>Di.distanceToBox(y),intersectsBounds:(y,w,O)=>O<C&&O<r?(w&&(ss.min.copy(y.min),ss.max.copy(y.max),ss.needsUpdate=!0),!0):!1,intersectsRange:(y,w)=>{if(s.boundsTree){const O=s.boundsTree;return O.shapecast({boundsTraverseOrder:M=>ss.distanceToBox(M),intersectsBounds:(M,b,v)=>v<C&&v<r,intersectsRange:(M,b)=>{for(let v=M,k=M+b;v<k;v++){const F=O.resolveTriangleIndex(v);bt(f,3*F,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let L=y,_=y+w;L<_;L++){const D=c.resolveTriangleIndex(L);bt(u,3*D,l,a),u.needsUpdate=!0;const q=u.distanceToTriangle(f,E,I);if(q<C&&(p.copy(E),m&&m.copy(I),C=q,R=L,g=v),q<n)return!0}}}})}else{const O=Ze(s);for(let M=0,b=O;M<b;M++){bt(f,3*M,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let v=y,k=y+w;v<k;v++){const F=c.resolveTriangleIndex(v);bt(u,3*F,l,a),u.needsUpdate=!0;const L=u.distanceToTriangle(f,E,I);if(L<C&&(p.copy(E),m&&m.copy(I),C=L,R=v,g=M),L<n)return!0}}}}}),Yt.releasePrimitive(u),Yt.releasePrimitive(f),C===1/0?null:(e.point?e.point.copy(p):e.point=p.clone(),e.distance=C,e.faceIndex=R,i&&(i.point?i.point.copy(m):i.point=m.clone(),i.point.applyMatrix4(Us),p.applyMatrix4(Us),i.distance=p.sub(i.point).length(),i.faceIndex=g),e)}function ua(){return typeof SharedArrayBuffer<"u"}const ps=new _t.constructor,Ks=new _t.constructor,pe=new gn(()=>new S.Box3),Be=new S.Box3,ze=new S.Box3,Ui=new S.Box3,Bi=new S.Box3;let zi=!1;function fa(c,s,t,e){if(zi)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");zi=!0;const i=c._roots,n=s._roots;let r,o=0,a=0;const l=new S.Matrix4().copy(t).invert();for(let h=0,d=i.length;h<d;h++){ps.setBuffer(i[h]),a=0;const u=pe.getPrimitive();yt(0,ps.float32Array,u),u.applyMatrix4(l);for(let f=0,E=n.length;f<E&&(Ks.setBuffer(n[h]),r=$t(0,0,t,l,e,o,a,0,0,u),Ks.clearBuffer(),a+=n[f].length,!r);f++);if(pe.releasePrimitive(u),ps.clearBuffer(),o+=i[h].length,r)break}return zi=!1,r}function $t(c,s,t,e,i,n=0,r=0,o=0,a=0,l=null,h=!1){let d,u;h?(d=Ks,u=ps):(d=ps,u=Ks);const f=d.float32Array,E=d.uint32Array,p=d.uint16Array,I=u.float32Array,m=u.uint32Array,C=u.uint16Array,R=c*2,g=s*2,y=Bt(R,p),w=Bt(g,C);let O=!1;if(w&&y)h?O=i(zt(s,m),Ht(s*2,C),zt(c,E),Ht(c*2,p),a,r+s,o,n+c):O=i(zt(c,E),Ht(c*2,p),zt(s,m),Ht(s*2,C),o,n+c,a,r+s);else if(w){const M=pe.getPrimitive();yt(s,I,M),M.applyMatrix4(t);const b=Wt(c),v=Xt(c,E);yt(b,f,Be),yt(v,f,ze);const k=M.intersectsBox(Be),F=M.intersectsBox(ze);O=k&&$t(s,b,e,t,i,r,n,a,o+1,M,!h)||F&&$t(s,v,e,t,i,r,n,a,o+1,M,!h),pe.releasePrimitive(M)}else{const M=Wt(s),b=Xt(s,m);yt(M,I,Ui),yt(b,I,Bi);const v=l.intersectsBox(Ui),k=l.intersectsBox(Bi);if(v&&k)O=$t(c,M,t,e,i,n,r,o,a+1,l,h)||$t(c,b,t,e,i,n,r,o,a+1,l,h);else if(v)if(y)O=$t(c,M,t,e,i,n,r,o,a+1,l,h);else{const F=pe.getPrimitive();F.copy(Ui).applyMatrix4(t);const L=Wt(c),_=Xt(c,E);yt(L,f,Be),yt(_,f,ze);const D=F.intersectsBox(Be),q=F.intersectsBox(ze);O=D&&$t(M,L,e,t,i,r,n,a,o+1,F,!h)||q&&$t(M,_,e,t,i,r,n,a,o+1,F,!h),pe.releasePrimitive(F)}else if(k)if(y)O=$t(c,b,t,e,i,n,r,o,a+1,l,h);else{const F=pe.getPrimitive();F.copy(Bi).applyMatrix4(t);const L=Wt(c),_=Xt(c,E);yt(L,f,Be),yt(_,f,ze);const D=F.intersectsBox(Be),q=F.intersectsBox(ze);O=D&&$t(b,L,e,t,i,r,n,a,o+1,F,!h)||q&&$t(b,_,e,t,i,r,n,a,o+1,F,!h),pe.releasePrimitive(F)}}return O}const Bs=new Dt,Hn=new S.Box3;class Cn{static serialize(s,t={}){t={cloneBuffers:!0,...t};const e=s.geometry,i=s._roots,n=s._indirectBuffer,r=e.getIndex();let o;return t.cloneBuffers?o={roots:i.map(a=>a.slice()),index:r.array.slice(),indirectBuffer:n?n.slice():null}:o={roots:i,index:r.array,indirectBuffer:n},o}static deserialize(s,t,e={}){e={setIndex:!0,indirect:!!s.indirectBuffer,...e};const{index:i,roots:n,indirectBuffer:r}=s,o=new Cn(t,{...e,[Pi]:!0});if(o._roots=n,o._indirectBuffer=r||null,e.setIndex){const a=t.getIndex();if(a===null){const l=new S.BufferAttribute(s.index,1,!1);t.setIndex(l)}else a.array!==i&&(a.array.set(i),a.needsUpdate=!0)}return o}get indirect(){return!!this._indirectBuffer}constructor(s,t={}){if(s.isBufferGeometry){if(s.index&&s.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:gr,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[Pi]:!1},t),t.useSharedArrayBuffer&&!ua())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=s,this._roots=null,this._indirectBuffer=null,t[Pi]||(bo(this,t),!s.boundingBox&&t.setBoundingBox&&(s.boundingBox=this.getBoundingBox(new S.Box3)));const{_indirectBuffer:e}=this;this.resolveTriangleIndex=t.indirect?i=>e[i]:i=>i}refit(s=null){return(this.indirect?sa:Yo)(this,s)}traverse(s,t=0){const e=this._roots[t],i=new Uint32Array(e),n=new Uint16Array(e);r(0);function r(o,a=0){const l=o*2,h=n[l+15]===Ai;if(h){const d=i[o+6],u=n[l+14];s(a,h,new Float32Array(e,o*4,6),d,u)}else{const d=o+js/4,u=i[o+6],f=i[o+7];s(a,h,new Float32Array(e,o*4,6),f)||(r(d,a+1),r(u,a+1))}}}raycast(s,t=S.FrontSide){const e=this._roots,i=this.geometry,n=[],r=t.isMaterial,o=Array.isArray(t),a=i.groups,l=r?t.side:t,h=this.indirect?ia:Zo;for(let d=0,u=e.length;d<u;d++){const f=o?t[a[d].materialIndex].side:l,E=n.length;if(h(this,d,f,s,n),o){const p=a[d].materialIndex;for(let I=E,m=n.length;I<m;I++)n[I].face.materialIndex=p}}return n}raycastFirst(s,t=S.FrontSide){const e=this._roots,i=this.geometry,n=t.isMaterial,r=Array.isArray(t);let o=null;const a=i.groups,l=n?t.side:t,h=this.indirect?ra:jo;for(let d=0,u=e.length;d<u;d++){const f=r?t[a[d].materialIndex].side:l,E=h(this,d,f,s);E!=null&&(o==null||E.distance<o.distance)&&(o=E,r&&(E.face.materialIndex=a[d].materialIndex))}return o}intersectsGeometry(s,t){let e=!1;const i=this._roots,n=this.indirect?oa:Qo;for(let r=0,o=i.length;r<o&&(e=n(this,r,s,t),!e);r++);return e}shapecast(s){const t=Yt.getPrimitive(),e=this.indirect?Xo:Go;let{boundsTraverseOrder:i,intersectsBounds:n,intersectsRange:r,intersectsTriangle:o}=s;if(r&&o){const d=r;r=(u,f,E,p,I)=>d(u,f,E,p,I)?!0:e(u,f,this,o,E,p,t)}else r||(o?r=(d,u,f,E)=>e(d,u,this,o,f,E,t):r=(d,u,f)=>f);let a=!1,l=0;const h=this._roots;for(let d=0,u=h.length;d<u;d++){const f=h[d];if(a=Do(this,d,n,r,i,l),a)break;l+=f.byteLength}return Yt.releasePrimitive(t),a}bvhcast(s,t,e){let{intersectsRanges:i,intersectsTriangles:n}=e;const r=Yt.getPrimitive(),o=this.geometry.index,a=this.geometry.attributes.position,l=this.indirect?E=>{const p=this.resolveTriangleIndex(E);bt(r,p*3,o,a)}:E=>{bt(r,E*3,o,a)},h=Yt.getPrimitive(),d=s.geometry.index,u=s.geometry.attributes.position,f=s.indirect?E=>{const p=s.resolveTriangleIndex(E);bt(h,p*3,d,u)}:E=>{bt(h,E*3,d,u)};if(n){const E=(p,I,m,C,R,g,y,w)=>{for(let O=m,M=m+C;O<M;O++){f(O),h.a.applyMatrix4(t),h.b.applyMatrix4(t),h.c.applyMatrix4(t),h.needsUpdate=!0;for(let b=p,v=p+I;b<v;b++)if(l(b),r.needsUpdate=!0,n(r,h,b,O,R,g,y,w))return!0}return!1};if(i){const p=i;i=function(I,m,C,R,g,y,w,O){return p(I,m,C,R,g,y,w,O)?!0:E(I,m,C,R,g,y,w,O)}}else i=E}return fa(this,s,t,i)}intersectsBox(s,t){return Bs.set(s.min,s.max,t),Bs.needsUpdate=!0,this.shapecast({intersectsBounds:e=>Bs.intersectsBox(e),intersectsTriangle:e=>Bs.intersectsTriangle(e)})}intersectsSphere(s){return this.shapecast({intersectsBounds:t=>s.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(s)})}closestPointToGeometry(s,t,e={},i={},n=0,r=1/0){return(this.indirect?da:ea)(this,s,t,e,i,n,r)}closestPointToPoint(s,t={},e=0,i=1/0){return Uo(this,s,t,e,i)}getBoundingBox(s){return s.makeEmpty(),this._roots.forEach(e=>{yt(0,new Float32Array(e),Hn),s.union(Hn)}),s}}function Wn(c,s,t){return c===null||(c.point.applyMatrix4(s.matrixWorld),c.distance=c.point.distanceTo(t.ray.origin),c.object=s,c.distance<t.near||c.distance>t.far)?null:c}const Vi=new S.Ray,Xn=new S.Matrix4,pa=S.Mesh.prototype.raycast;function Ea(c,s){if(this.geometry.boundsTree){if(this.material===void 0)return;Xn.copy(this.matrixWorld).invert(),Vi.copy(c.ray).applyMatrix4(Xn);const t=this.geometry.boundsTree;if(c.firstHitOnly===!0){const e=Wn(t.raycastFirst(Vi,this.material),this,c);e&&s.push(e)}else{const e=t.raycast(Vi,this.material);for(let i=0,n=e.length;i<n;i++){const r=Wn(e[i],this,c);r&&s.push(r)}}}else pa.call(this,c,s)}function ma(c){return this.boundsTree=new Cn(this,c),this.boundsTree}function Ia(){this.boundsTree=null}class Q{constructor(){T(this,"trigger",s=>{const t=this.handlers.slice(0);for(const e of t)e(s)});T(this,"handlers",[])}add(s){this.handlers.push(s)}remove(s){this.handlers=this.handlers.filter(t=>t!==s)}reset(){this.handlers.length=0}}class Es{constructor(){T(this,"trigger",async s=>{const t=this.handlers.slice(0);for(const e of t)await e(s)});T(this,"handlers",[])}add(s){this.handlers.push(s)}remove(s){this.handlers=this.handlers.filter(t=>t!==s)}reset(){this.handlers.length=0}}class yi{constructor(s){T(this,"isDisposeable",()=>"dispose"in this&&"onDisposed"in this);T(this,"isResizeable",()=>"resize"in this&&"getSize"in this);T(this,"isUpdateable",()=>"onAfterUpdate"in this&&"onBeforeUpdate"in this&&"update"in this);T(this,"isHideable",()=>"visible"in this);T(this,"isConfigurable",()=>"setup"in this&&"config"in this&&"onSetup"in this);this.components=s}}class Ft extends yi{}class Fi extends yi{constructor(t){super(t);T(this,"worlds",new Map);T(this,"onWorldChanged",new Q);T(this,"currentWorld",null);this.onWorldChanged.add(({world:e,action:i})=>{i==="removed"&&this.worlds.delete(e.uuid)})}}class Ar extends Fi{constructor(){super(...arguments);T(this,"hasCameraControls",()=>"controls"in this)}}class Rr extends Fi{constructor(){super(...arguments);T(this,"onAfterUpdate",new Q);T(this,"onBeforeUpdate",new Q);T(this,"onDisposed",new Q);T(this,"onResize",new Q);T(this,"onClippingPlanesUpdated",new Q);T(this,"clippingPlanes",[])}updateClippingPlanes(){this.onClippingPlanesUpdated.trigger()}setPlane(t,e,i){e.isLocal=i;const n=this.clippingPlanes.indexOf(e);t&&n===-1?this.clippingPlanes.push(e):!t&&n>-1&&this.clippingPlanes.splice(n,1),this.three.clippingPlanes=this.clippingPlanes.filter(r=>!r.isLocal)}}const ms=class ms extends Ft{constructor(t){super(t);T(this,"_disposedComponents",new Set);T(this,"enabled",!0);t.add(ms.uuid,this)}get(){return this._disposedComponents}destroy(t,e=!0,i=!0){t.removeFromParent();const n=t;n.dispose&&n.dispose(),this.disposeGeometryAndMaterials(t,e),i&&n.children&&n.children.length&&this.disposeChildren(n),t.children.length=0}disposeGeometry(t){t.boundsTree&&t.disposeBoundsTree&&t.disposeBoundsTree(),t.dispose()}disposeGeometryAndMaterials(t,e){const i=t;i.geometry&&this.disposeGeometry(i.geometry),e&&i.material&&ms.disposeMaterial(i),i.material=[],i.geometry=null}disposeChildren(t){for(const e of t.children)this.destroy(e)}static disposeMaterial(t){if(t.material)if(Array.isArray(t.material))for(const e of t.material)e.dispose();else t.material.dispose()}};T(ms,"uuid","76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");let le=ms;class yr extends Fi{constructor(t){super(t);T(this,"onDisposed",new Q);T(this,"directionalLights",new Map);T(this,"ambientLights",new Map)}dispose(){const t=this.components.get(le);for(const e of this.three.children){const i=e;i.geometry&&t.destroy(i)}for(const[,e]of this.directionalLights)e.removeFromParent(),e.target.removeFromParent(),e.dispose();for(const[,e]of this.ambientLights)e.removeFromParent(),e.dispose();this.three.children=[],this.onDisposed.trigger(),this.onDisposed.reset()}}class Se extends Set{constructor(t){super(t);T(this,"onItemAdded",new Q);T(this,"onItemDeleted",new Q);T(this,"onCleared",new Q);T(this,"guard",()=>!0)}clear(){super.clear(),this.onCleared.trigger()}add(...t){for(const e of t)this.has(e)||!this.guard(e)||(super.add(e),this.onItemAdded||(this.onItemAdded=new Q),this.onItemAdded.trigger(e));return this}delete(t){const e=super.delete(t);return e&&this.onItemDeleted.trigger(),e}dispose(){this.clear(),this.onItemAdded.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}class he extends Map{constructor(t){super(t);T(this,"onItemSet",new Q);T(this,"onItemUpdated",new Q);T(this,"onItemDeleted",new Q);T(this,"onCleared",new Q);T(this,"guard",()=>!0)}clear(){super.clear(),this.onCleared.trigger()}set(t,e){const i=this.has(t);if(!(this.guard??(()=>!0))(t,e))return this;const o=super.set(t,e);return i?(this.onItemUpdated||(this.onItemUpdated=new Q),this.onItemUpdated.trigger({key:t,value:e})):(this.onItemSet||(this.onItemSet=new Q),this.onItemSet.trigger({key:t,value:e})),o}delete(t){const e=super.delete(t);return e&&this.onItemDeleted.trigger(t),e}dispose(){this.clear(),this.onItemSet.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}const Qs=0,ga=1,Ca=new S.Vector3,Zn=new S.Line3,ki=new S.Plane,$n=new S.Vector3,zs=new S.Triangle;class Ta{constructor(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new jn,this.unassigned=new jn,this.vertices=[]}setFromPoints(s){if(s.length>=4){this.makeEmpty();for(let t=0,e=s.length;t<e;t++)this.vertices.push(new _a(s[t]));this.compute()}return this}setFromObject(s){const t=[];return s.updateMatrixWorld(!0),s.traverse(function(e){const i=e.geometry;if(i!==void 0){const n=i.attributes.position;if(n!==void 0)for(let r=0,o=n.count;r<o;r++){const a=new S.Vector3;a.fromBufferAttribute(n,r).applyMatrix4(e.matrixWorld),t.push(a)}}}),this.setFromPoints(t)}containsPoint(s){const t=this.faces;for(let e=0,i=t.length;e<i;e++)if(t[e].distanceToPoint(s)>this.tolerance)return!1;return!0}intersectRay(s,t){const e=this.faces;let i=-1/0,n=1/0;for(let r=0,o=e.length;r<o;r++){const a=e[r],l=a.distanceToPoint(s.origin),h=a.normal.dot(s.direction);if(l>0&&h>=0)return null;const d=h!==0?-l/h:0;if(!(d<=0)&&(h>0?n=Math.min(d,n):i=Math.max(d,i),i>n))return null}return i!==-1/0?s.at(i,t):s.at(n,t),t}intersectsRay(s){return this.intersectRay(s,Ca)!==null}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(s,t){return s.face=t,t.outside===null?this.assigned.append(s):this.assigned.insertBefore(t.outside,s),t.outside=s,this}removeVertexFromFace(s,t){return s===t.outside&&(s.next!==null&&s.next.face===t?t.outside=s.next:t.outside=null),this.assigned.remove(s),this}removeAllVerticesFromFace(s){if(s.outside!==null){const t=s.outside;let e=s.outside;for(;e.next!==null&&e.next.face===s;)e=e.next;return this.assigned.removeSubList(t,e),t.prev=e.next=null,s.outside=null,t}}deleteFaceVertices(s,t){const e=this.removeAllVerticesFromFace(s);if(e!==void 0)if(t===void 0)this.unassigned.appendChain(e);else{let i=e;do{const n=i.next;t.distanceToPoint(i.point)>this.tolerance?this.addVertexToFace(i,t):this.unassigned.append(i),i=n}while(i!==null)}return this}resolveUnassignedPoints(s){if(this.unassigned.isEmpty()===!1){let t=this.unassigned.first();do{const e=t.next;let i=this.tolerance,n=null;for(let r=0;r<s.length;r++){const o=s[r];if(o.mark===Qs){const a=o.distanceToPoint(t.point);if(a>i&&(i=a,n=o),i>1e3*this.tolerance)break}}n!==null&&this.addVertexToFace(t,n),t=e}while(t!==null)}return this}computeExtremes(){const s=new S.Vector3,t=new S.Vector3,e=[],i=[];for(let n=0;n<3;n++)e[n]=i[n]=this.vertices[0];s.copy(this.vertices[0].point),t.copy(this.vertices[0].point);for(let n=0,r=this.vertices.length;n<r;n++){const o=this.vertices[n],a=o.point;for(let l=0;l<3;l++)a.getComponent(l)<s.getComponent(l)&&(s.setComponent(l,a.getComponent(l)),e[l]=o);for(let l=0;l<3;l++)a.getComponent(l)>t.getComponent(l)&&(t.setComponent(l,a.getComponent(l)),i[l]=o)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(s.x),Math.abs(t.x))+Math.max(Math.abs(s.y),Math.abs(t.y))+Math.max(Math.abs(s.z),Math.abs(t.z))),{min:e,max:i}}computeInitialHull(){const s=this.vertices,t=this.computeExtremes(),e=t.min,i=t.max;let n=0,r=0;for(let u=0;u<3;u++){const f=i[u].point.getComponent(u)-e[u].point.getComponent(u);f>n&&(n=f,r=u)}const o=e[r],a=i[r];let l,h;n=0,Zn.set(o.point,a.point);for(let u=0,f=this.vertices.length;u<f;u++){const E=s[u];if(E!==o&&E!==a){Zn.closestPointToPoint(E.point,!0,$n);const p=$n.distanceToSquared(E.point);p>n&&(n=p,l=E)}}n=-1,ki.setFromCoplanarPoints(o.point,a.point,l.point);for(let u=0,f=this.vertices.length;u<f;u++){const E=s[u];if(E!==o&&E!==a&&E!==l){const p=Math.abs(ki.distanceToPoint(E.point));p>n&&(n=p,h=E)}}const d=[];if(ki.distanceToPoint(h.point)<0){d.push(Qt.create(o,a,l),Qt.create(h,a,o),Qt.create(h,l,a),Qt.create(h,o,l));for(let u=0;u<3;u++){const f=(u+1)%3;d[u+1].getEdge(2).setTwin(d[0].getEdge(f)),d[u+1].getEdge(1).setTwin(d[f+1].getEdge(0))}}else{d.push(Qt.create(o,l,a),Qt.create(h,o,a),Qt.create(h,a,l),Qt.create(h,l,o));for(let u=0;u<3;u++){const f=(u+1)%3;d[u+1].getEdge(2).setTwin(d[0].getEdge((3-u)%3)),d[u+1].getEdge(0).setTwin(d[f+1].getEdge(1))}}for(let u=0;u<4;u++)this.faces.push(d[u]);for(let u=0,f=s.length;u<f;u++){const E=s[u];if(E!==o&&E!==a&&E!==l&&E!==h){n=this.tolerance;let p=null;for(let I=0;I<4;I++){const m=this.faces[I].distanceToPoint(E.point);m>n&&(n=m,p=this.faces[I])}p!==null&&this.addVertexToFace(E,p)}}return this}reindexFaces(){const s=[];for(let t=0;t<this.faces.length;t++){const e=this.faces[t];e.mark===Qs&&s.push(e)}return this.faces=s,this}nextVertexToAdd(){if(this.assigned.isEmpty()===!1){let s,t=0;const e=this.assigned.first().face;let i=e.outside;do{const n=e.distanceToPoint(i.point);n>t&&(t=n,s=i),i=i.next}while(i!==null&&i.face===e);return s}}computeHorizon(s,t,e,i){this.deleteFaceVertices(e),e.mark=ga;let n;t===null?n=t=e.getEdge(0):n=t.next;do{const r=n.twin,o=r.face;o.mark===Qs&&(o.distanceToPoint(s)>this.tolerance?this.computeHorizon(s,r,o,i):i.push(n)),n=n.next}while(n!==t);return this}addAdjoiningFace(s,t){const e=Qt.create(s,t.tail(),t.head());return this.faces.push(e),e.getEdge(-1).setTwin(t.twin),e.getEdge(0)}addNewFaces(s,t){this.newFaces=[];let e=null,i=null;for(let n=0;n<t.length;n++){const r=t[n],o=this.addAdjoiningFace(s,r);e===null?e=o:o.next.setTwin(i),this.newFaces.push(o.face),i=o}return e.next.setTwin(i),this}addVertexToHull(s){const t=[];return this.unassigned.clear(),this.removeVertexFromFace(s,s.face),this.computeHorizon(s.point,null,s.face,t),this.addNewFaces(s,t),this.resolveUnassignedPoints(this.newFaces),this}cleanup(){return this.assigned.clear(),this.unassigned.clear(),this.newFaces=[],this}compute(){let s;for(this.computeInitialHull();(s=this.nextVertexToAdd())!==void 0;)this.addVertexToHull(s);return this.reindexFaces(),this.cleanup(),this}}class Qt{constructor(){this.normal=new S.Vector3,this.midpoint=new S.Vector3,this.area=0,this.constant=0,this.outside=null,this.mark=Qs,this.edge=null}static create(s,t,e){const i=new Qt,n=new Gi(s,i),r=new Gi(t,i),o=new Gi(e,i);return n.next=o.prev=r,r.next=n.prev=o,o.next=r.prev=n,i.edge=n,i.compute()}getEdge(s){let t=this.edge;for(;s>0;)t=t.next,s--;for(;s<0;)t=t.prev,s++;return t}compute(){const s=this.edge.tail(),t=this.edge.head(),e=this.edge.next.head();return zs.set(s.point,t.point,e.point),zs.getNormal(this.normal),zs.getMidpoint(this.midpoint),this.area=zs.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(s){return this.normal.dot(s)-this.constant}}class Gi{constructor(s,t){this.vertex=s,this.prev=null,this.next=null,this.twin=null,this.face=t}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){const s=this.head(),t=this.tail();return t!==null?t.point.distanceTo(s.point):-1}lengthSquared(){const s=this.head(),t=this.tail();return t!==null?t.point.distanceToSquared(s.point):-1}setTwin(s){return this.twin=s,s.twin=this,this}}class _a{constructor(s){this.point=s,this.prev=null,this.next=null,this.face=null}}class jn{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(s,t){return t.prev=s.prev,t.next=s,t.prev===null?this.head=t:t.prev.next=t,s.prev=t,this}insertAfter(s,t){return t.prev=s,t.next=s.next,t.next===null?this.tail=t:t.next.prev=t,s.next=t,this}append(s){return this.head===null?this.head=s:this.tail.next=s,s.prev=this.tail,s.next=null,this.tail=s,this}appendChain(s){for(this.head===null?this.head=s:this.tail.next=s,s.prev=this.tail;s.next!==null;)s=s.next;return this.tail=s,this}remove(s){return s.prev===null?this.head=s.next:s.prev.next=s.next,s.next===null?this.tail=s.prev:s.next.prev=s.prev,this}removeSubList(s,t){return s.prev===null?this.head=t.next:s.prev.next=t.next,t.next===null?this.tail=s.prev:t.next.prev=s.prev,this}isEmpty(){return this.head===null}}const rn=[2,2,1],on=[1,0,0];function ie(c,s){return c*3+s}function Aa(c){const s=c.elements;let t=0;for(let e=0;e<9;e++)t+=s[e]*s[e];return Math.sqrt(t)}function Ra(c){const s=c.elements;let t=0;for(let e=0;e<3;e++){const i=s[ie(rn[e],on[e])];t+=2*i*i}return Math.sqrt(t)}function ya(c,s){let t=0,e=1;const i=c.elements;for(let l=0;l<3;l++){const h=Math.abs(i[ie(rn[l],on[l])]);h>t&&(t=h,e=l)}let n=1,r=0;const o=on[e],a=rn[e];if(Math.abs(i[ie(a,o)])>Number.EPSILON){const l=i[ie(a,a)],h=i[ie(o,o)],d=i[ie(a,o)],u=(l-h)/2/d;let f;u<0?f=-1/(-u+Math.sqrt(1+u*u)):f=1/(u+Math.sqrt(1+u*u)),n=1/Math.sqrt(1+f*f),r=f*n}return s.identity(),s.elements[ie(o,o)]=n,s.elements[ie(a,a)]=n,s.elements[ie(a,o)]=r,s.elements[ie(o,a)]=-r,s}function Fa(c,s){let t=0,e=0;const i=10;s.unitary.identity(),s.diagonal.copy(c);const n=s.unitary,r=s.diagonal,o=new x.Matrix3,a=new x.Matrix3,l=Number.EPSILON*Aa(r);for(;e<i&&Ra(r)>l;)ya(r,o),a.copy(o).transpose(),r.multiply(o),r.premultiply(a),n.multiply(o),++t>2&&(e++,t=0);return s}function Fr(c){const s=[];for(let ot=0;ot<c.length-2;ot+=3){const ut=c[ot],dt=c[ot+1],mt=c[ot+2];s.push(new x.Vector3(ut,dt,mt))}const t=new Ta;t.setFromPoints(s);const e={unitary:new x.Matrix3,diagonal:new x.Matrix3},i=t.faces,n=[],r=[];for(let ot=0,ut=i.length;ot<ut;ot++){const dt=i[ot];let mt=dt.edge;n.length=0;do n.push(mt),mt=mt.next;while(mt!==dt.edge);const Vt=n.length-2;for(let Lt=1,A=Vt;Lt<=A;Lt++){const X=n[0].vertex,Y=n[Lt+0].vertex,P=n[Lt+1].vertex;r.push(X.point.x,X.point.y,X.point.z),r.push(Y.point.x,Y.point.y,Y.point.z),r.push(P.point.x,P.point.y,P.point.z)}}const o=new x.Vector3,a=new x.Vector3,l=new x.Vector3,h=new x.Vector3,d=new x.Vector3,u=new x.Vector3,f=new x.Vector3,E=new x.Vector3;let p=0,I=0,m=0,C=0,R=0,g=0,y=0;for(let ot=0,ut=r.length;ot<ut;ot+=9){o.fromArray(r,ot),a.fromArray(r,ot+3),l.fromArray(r,ot+6),f.set(0,0,0),f.add(o).add(a).add(l).divideScalar(3),h.subVectors(a,o),d.subVectors(l,o);const dt=u.crossVectors(h,d).length()/2;E.add(u.copy(f).multiplyScalar(dt)),p+=dt,I+=(9*f.x*f.x+o.x*o.x+a.x*a.x+l.x*l.x)*(dt/12),m+=(9*f.x*f.y+o.x*o.y+a.x*a.y+l.x*l.y)*(dt/12),C+=(9*f.x*f.z+o.x*o.z+a.x*a.z+l.x*l.z)*(dt/12),R+=(9*f.y*f.y+o.y*o.y+a.y*a.y+l.y*l.y)*(dt/12),g+=(9*f.y*f.z+o.y*o.z+a.y*a.z+l.y*l.z)*(dt/12),y+=(9*f.z*f.z+o.z*o.z+a.z*a.z+l.z*l.z)*(dt/12)}E.divideScalar(p),I/=p,m/=p,C/=p,R/=p,g/=p,y/=p,I-=E.x*E.x,m-=E.x*E.y,C-=E.x*E.z,R-=E.y*E.y,g-=E.y*E.z,y-=E.z*E.z;const w=new x.Matrix3;w.elements[0]=I,w.elements[1]=m,w.elements[2]=C,w.elements[3]=m,w.elements[4]=R,w.elements[5]=g,w.elements[6]=C,w.elements[7]=g,w.elements[8]=y,Fa(w,e);const O=e.unitary,M=new x.Vector3,b=new x.Vector3,v=new x.Vector3;O.extractBasis(M,b,v);let k=-1/0,F=-1/0,L=-1/0,_=1/0,D=1/0,q=1/0;for(let ot=0,ut=s.length;ot<ut;ot++){const dt=s[ot];k=Math.max(M.dot(dt),k),F=Math.max(b.dot(dt),F),L=Math.max(v.dot(dt),L),_=Math.min(M.dot(dt),_),D=Math.min(b.dot(dt),D),q=Math.min(v.dot(dt),q)}M.multiplyScalar(.5*(_+k)),b.multiplyScalar(.5*(D+F)),v.multiplyScalar(.5*(q+L));const G=new x.Vector3,et=new x.Vector3,W=new x.Matrix3;G.add(M).add(b).add(v),et.x=k-_,et.y=F-D,et.z=L-q,et.multiplyScalar(.5),W.copy(O);const{x:nt,y:V,z:B}=et,rt=new x.Matrix4;rt.makeScale(nt*2,V*2,B*2);const st=new x.Matrix4;st.makeTranslation(-nt,-V,-B);const tt=new x.Matrix4;tt.makeTranslation(G.x,G.y,G.z);const At=new x.Matrix4;At.setFromMatrix3(W);const wt=new x.Matrix4;return wt.multiply(tt),wt.multiply(At),wt.multiply(st),wt.multiply(rt),{center:G,halfSizes:et,rotation:W,transformation:wt}}function wr(c,s,t){const e=[c[0]-s[0],c[1]-s[1],c[2]-s[2]];return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]>0}class an{static isTransparent(s){return s.transparent&&s.opacity<1}}const Ot=class Ot{static create(){const s=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return`${Ot._lut[s&255]+Ot._lut[s>>8&255]+Ot._lut[s>>16&255]+Ot._lut[s>>24&255]}-${Ot._lut[t&255]}${Ot._lut[t>>8&255]}-${Ot._lut[t>>16&15|64]}${Ot._lut[t>>24&255]}-${Ot._lut[e&63|128]}${Ot._lut[e>>8&255]}-${Ot._lut[e>>16&255]}${Ot._lut[e>>24&255]}${Ot._lut[i&255]}${Ot._lut[i>>8&255]}${Ot._lut[i>>16&255]}${Ot._lut[i>>24&255]}`.toLowerCase()}static validate(s){if(!Ot._pattern.test(s))throw new Error(`${s} is not a valid UUID v4.
1
+ "use strict";var lo=Object.defineProperty;var ho=(c,s,t)=>s in c?lo(c,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[s]=t;var _=(c,s,t)=>(ho(c,typeof s!="symbol"?s+"":s,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("three"),Ir=require("@thatopen/fragments"),uo=require("web-ifc");function mn(c){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const e=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(s,t,e.get?e:{enumerable:!0,get:()=>c[t]})}}return s.default=c,Object.freeze(s)}const x=mn(S),Ie=mn(Ir),Z=mn(uo),gr=0,fo=1,po=2,Nn=2,bi=1.25,bn=1,Qs=6*4+4+4,Ai=65535,Eo=Math.pow(2,-24),Pi=Symbol("SKIP_GENERATION");function mo(c){return c.index?c.index.count:c.attributes.position.count}function Ze(c){return mo(c)/3}function Io(c,s=ArrayBuffer){return c>65535?new Uint32Array(new s(4*c)):new Uint16Array(new s(2*c))}function go(c,s){if(!c.index){const t=c.attributes.position.count,e=s.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=Io(t,e);c.setIndex(new S.BufferAttribute(i,1));for(let n=0;n<t;n++)i[n]=n}}function Cr(c){const s=Ze(c),t=c.drawRange,e=t.start/3,i=(t.start+t.count)/3,n=Math.max(0,e),r=Math.min(s,i)-n;return[{offset:Math.floor(n),count:Math.floor(r)}]}function Tr(c){if(!c.groups||!c.groups.length)return Cr(c);const s=[],t=new Set,e=c.drawRange,i=e.start/3,n=(e.start+e.count)/3;for(const o of c.groups){const a=o.start/3,l=(o.start+o.count)/3;t.add(Math.max(i,a)),t.add(Math.min(n,l))}const r=Array.from(t.values()).sort((o,a)=>o-a);for(let o=0;o<r.length-1;o++){const a=r[o],l=r[o+1];s.push({offset:Math.floor(a),count:Math.floor(l-a)})}return s}function Co(c){if(c.groups.length===0)return!1;const s=Ze(c),t=Tr(c).sort((n,r)=>n.offset-r.offset),e=t[t.length-1];e.count=Math.min(s-e.offset,e.count);let i=0;return t.forEach(({count:n})=>i+=n),s!==i}function yt(c,s,t){return t.min.x=s[c],t.min.y=s[c+1],t.min.z=s[c+2],t.max.x=s[c+3],t.max.y=s[c+4],t.max.z=s[c+5],t}function To(c){c[0]=c[1]=c[2]=1/0,c[3]=c[4]=c[5]=-1/0}function Pn(c){let s=-1,t=-1/0;for(let e=0;e<3;e++){const i=c[e+3]-c[e];i>t&&(t=i,s=e)}return s}function Ln(c,s){s.set(c)}function Mn(c,s,t){let e,i;for(let n=0;n<3;n++){const r=n+3;e=c[n],i=s[n],t[n]=e<i?e:i,e=c[r],i=s[r],t[r]=e>i?e:i}}function Fs(c,s,t){for(let e=0;e<3;e++){const i=s[c+2*e],n=s[c+2*e+1],r=i-n,o=i+n;r<t[e]&&(t[e]=r),o>t[e+3]&&(t[e+3]=o)}}function qe(c){const s=c[3]-c[0],t=c[4]-c[1],e=c[5]-c[2];return 2*(s*t+t*e+e*s)}function Li(c,s,t,e,i=null){let n=1/0,r=1/0,o=1/0,a=-1/0,l=-1/0,h=-1/0,d=1/0,u=1/0,f=1/0,E=-1/0,p=-1/0,I=-1/0;const m=i!==null;for(let C=s*6,R=(s+t)*6;C<R;C+=6){const g=c[C+0],y=c[C+1],w=g-y,O=g+y;w<n&&(n=w),O>a&&(a=O),m&&g<d&&(d=g),m&&g>E&&(E=g);const M=c[C+2],b=c[C+3],v=M-b,k=M+b;v<r&&(r=v),k>l&&(l=k),m&&M<u&&(u=M),m&&M>p&&(p=M);const F=c[C+4],L=c[C+5],T=F-L,D=F+L;T<o&&(o=T),D>h&&(h=D),m&&F<f&&(f=F),m&&F>I&&(I=F)}e[0]=n,e[1]=r,e[2]=o,e[3]=a,e[4]=l,e[5]=h,m&&(i[0]=d,i[1]=u,i[2]=f,i[3]=E,i[4]=p,i[5]=I)}function _o(c,s,t,e){let i=1/0,n=1/0,r=1/0,o=-1/0,a=-1/0,l=-1/0;for(let h=s*6,d=(s+t)*6;h<d;h+=6){const u=c[h+0];u<i&&(i=u),u>o&&(o=u);const f=c[h+2];f<n&&(n=f),f>a&&(a=f);const E=c[h+4];E<r&&(r=E),E>l&&(l=E)}e[0]=i,e[1]=n,e[2]=r,e[3]=o,e[4]=a,e[5]=l}function Ao(c,s){To(s);const t=c.attributes.position,e=c.index?c.index.array:null,i=Ze(c),n=new Float32Array(i*6),r=t.normalized,o=t.array,a=t.offset||0;let l=3;t.isInterleavedBufferAttribute&&(l=t.data.stride);const h=["getX","getY","getZ"];for(let d=0;d<i;d++){const u=d*3,f=d*6;let E=u+0,p=u+1,I=u+2;e&&(E=e[E],p=e[p],I=e[I]),r||(E=E*l+a,p=p*l+a,I=I*l+a);for(let m=0;m<3;m++){let C,R,g;r?(C=t[h[m]](E),R=t[h[m]](p),g=t[h[m]](I)):(C=o[E+m],R=o[p+m],g=o[I+m]);let y=C;R<y&&(y=R),g<y&&(y=g);let w=C;R>w&&(w=R),g>w&&(w=g);const O=(w-y)/2,M=m*2;n[f+M+0]=y+O,n[f+M+1]=O+(Math.abs(y)+O)*Eo,y<s[m]&&(s[m]=y),w>s[m+3]&&(s[m+3]=w)}}return n}const ce=32,Ro=(c,s)=>c.candidate-s.candidate,de=new Array(ce).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),ws=new Float32Array(6);function yo(c,s,t,e,i,n){let r=-1,o=0;if(n===gr)r=Pn(s),r!==-1&&(o=(s[r]+s[r+3])/2);else if(n===fo)r=Pn(c),r!==-1&&(o=Fo(t,e,i,r));else if(n===po){const a=qe(c);let l=bi*i;const h=e*6,d=(e+i)*6;for(let u=0;u<3;u++){const f=s[u],I=(s[u+3]-f)/ce;if(i<ce/4){const m=[...de];m.length=i;let C=0;for(let g=h;g<d;g+=6,C++){const y=m[C];y.candidate=t[g+2*u],y.count=0;const{bounds:w,leftCacheBounds:O,rightCacheBounds:M}=y;for(let b=0;b<3;b++)M[b]=1/0,M[b+3]=-1/0,O[b]=1/0,O[b+3]=-1/0,w[b]=1/0,w[b+3]=-1/0;Fs(g,t,w)}m.sort(Ro);let R=i;for(let g=0;g<R;g++){const y=m[g];for(;g+1<R&&m[g+1].candidate===y.candidate;)m.splice(g+1,1),R--}for(let g=h;g<d;g+=6){const y=t[g+2*u];for(let w=0;w<R;w++){const O=m[w];y>=O.candidate?Fs(g,t,O.rightCacheBounds):(Fs(g,t,O.leftCacheBounds),O.count++)}}for(let g=0;g<R;g++){const y=m[g],w=y.count,O=i-y.count,M=y.leftCacheBounds,b=y.rightCacheBounds;let v=0;w!==0&&(v=qe(M)/a);let k=0;O!==0&&(k=qe(b)/a);const F=bn+bi*(v*w+k*O);F<l&&(r=u,l=F,o=y.candidate)}}else{for(let R=0;R<ce;R++){const g=de[R];g.count=0,g.candidate=f+I+R*I;const y=g.bounds;for(let w=0;w<3;w++)y[w]=1/0,y[w+3]=-1/0}for(let R=h;R<d;R+=6){let w=~~((t[R+2*u]-f)/I);w>=ce&&(w=ce-1);const O=de[w];O.count++,Fs(R,t,O.bounds)}const m=de[ce-1];Ln(m.bounds,m.rightCacheBounds);for(let R=ce-2;R>=0;R--){const g=de[R],y=de[R+1];Mn(g.bounds,y.rightCacheBounds,g.rightCacheBounds)}let C=0;for(let R=0;R<ce-1;R++){const g=de[R],y=g.count,w=g.bounds,M=de[R+1].rightCacheBounds;y!==0&&(C===0?Ln(w,ws):Mn(w,ws,ws)),C+=y;let b=0,v=0;C!==0&&(b=qe(ws)/a);const k=i-C;k!==0&&(v=qe(M)/a);const F=bn+bi*(b*C+v*k);F<l&&(r=u,l=F,o=g.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${n} used.`);return{axis:r,pos:o}}function Fo(c,s,t,e){let i=0;for(let n=s,r=s+t;n<r;n++)i+=c[n*6+e*2];return i/t}class Ss{constructor(){}}function wo(c,s,t,e,i,n){let r=e,o=e+i-1;const a=n.pos,l=n.axis*2;for(;;){for(;r<=o&&t[r*6+l]<a;)r++;for(;r<=o&&t[o*6+l]>=a;)o--;if(r<o){for(let h=0;h<3;h++){let d=s[r*3+h];s[r*3+h]=s[o*3+h],s[o*3+h]=d}for(let h=0;h<6;h++){let d=t[r*6+h];t[r*6+h]=t[o*6+h],t[o*6+h]=d}r++,o--}else return r}}function So(c,s,t,e,i,n){let r=e,o=e+i-1;const a=n.pos,l=n.axis*2;for(;;){for(;r<=o&&t[r*6+l]<a;)r++;for(;r<=o&&t[o*6+l]>=a;)o--;if(r<o){let h=c[r];c[r]=c[o],c[o]=h;for(let d=0;d<6;d++){let u=t[r*6+d];t[r*6+d]=t[o*6+d],t[o*6+d]=u}r++,o--}else return r}}function Oo(c,s){const t=(c.index?c.index.count:c.attributes.position.count)/3,e=t>2**16,i=e?4:2,n=s?new SharedArrayBuffer(t*i):new ArrayBuffer(t*i),r=e?new Uint32Array(n):new Uint16Array(n);for(let o=0,a=r.length;o<a;o++)r[o]=o;return r}function No(c,s){const t=c.geometry,e=t.index?t.index.array:null,i=s.maxDepth,n=s.verbose,r=s.maxLeafTris,o=s.strategy,a=s.onProgress,l=Ze(t),h=c._indirectBuffer;let d=!1;const u=new Float32Array(6),f=new Float32Array(6),E=Ao(t,u),p=s.indirect?So:wo,I=[],m=s.indirect?Cr(t):Tr(t);if(m.length===1){const g=m[0],y=new Ss;y.boundingData=u,_o(E,g.offset,g.count,f),R(y,g.offset,g.count,f),I.push(y)}else for(let g of m){const y=new Ss;y.boundingData=new Float32Array(6),Li(E,g.offset,g.count,y.boundingData,f),R(y,g.offset,g.count,f),I.push(y)}return I;function C(g){a&&a(g/l)}function R(g,y,w,O=null,M=0){if(!d&&M>=i&&(d=!0,n&&(console.warn(`MeshBVH: Max depth of ${i} reached when generating BVH. Consider increasing maxDepth.`),console.warn(t))),w<=r||M>=i)return C(y+w),g.offset=y,g.count=w,g;const b=yo(g.boundingData,O,E,y,w,o);if(b.axis===-1)return C(y+w),g.offset=y,g.count=w,g;const v=p(h,e,E,y,w,b);if(v===y||v===y+w)C(y+w),g.offset=y,g.count=w;else{g.splitAxis=b.axis;const k=new Ss,F=y,L=v-y;g.left=k,k.boundingData=new Float32Array(6),Li(E,F,L,k.boundingData,f),R(k,F,L,f,M+1);const T=new Ss,D=v,q=w-L;g.right=T,T.boundingData=new Float32Array(6),Li(E,D,q,T.boundingData,f),R(T,D,q,f,M+1)}return g}}function bo(c,s){const t=c.geometry;s.indirect&&(c._indirectBuffer=Oo(t,s.useSharedArrayBuffer),Co(t)&&!s.verbose&&console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),c._indirectBuffer||go(t,s);const e=No(c,s);let i,n,r;const o=[],a=s.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let d=0;d<e.length;d++){const u=e[d];let f=l(u);const E=new a(Qs*f);i=new Float32Array(E),n=new Uint32Array(E),r=new Uint16Array(E),h(0,u),o.push(E)}c._roots=o;return;function l(d){return d.count?1:1+l(d.left)+l(d.right)}function h(d,u){const f=d/4,E=d/2,p=!!u.count,I=u.boundingData;for(let m=0;m<6;m++)i[f+m]=I[m];if(p){const m=u.offset,C=u.count;return n[f+6]=m,r[E+14]=C,r[E+15]=Ai,d+Qs}else{const m=u.left,C=u.right,R=u.splitAxis;let g;if(g=h(d+Qs,m),g/4>Math.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return n[f+6]=g/4,g=h(g,C),n[f+7]=R,g}}}class le{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(s,t){let e=1/0,i=-1/0;for(let n=0,r=s.length;n<r;n++){const a=s[n][t];e=a<e?a:e,i=a>i?a:i}this.min=e,this.max=i}setFromPoints(s,t){let e=1/0,i=-1/0;for(let n=0,r=t.length;n<r;n++){const o=t[n],a=s.dot(o);e=a<e?a:e,i=a>i?a:i}this.min=e,this.max=i}isSeparated(s){return this.min>s.max||s.min>this.max}}le.prototype.setFromBox=function(){const c=new S.Vector3;return function(t,e){const i=e.min,n=e.max;let r=1/0,o=-1/0;for(let a=0;a<=1;a++)for(let l=0;l<=1;l++)for(let h=0;h<=1;h++){c.x=i.x*a+n.x*(1-a),c.y=i.y*l+n.y*(1-l),c.z=i.z*h+n.z*(1-h);const d=t.dot(c);r=Math.min(d,r),o=Math.max(d,o)}this.min=r,this.max=o}}();const Po=function(){const c=new S.Vector3,s=new S.Vector3,t=new S.Vector3;return function(i,n,r){const o=i.start,a=c,l=n.start,h=s;t.subVectors(o,l),c.subVectors(i.end,i.start),s.subVectors(n.end,n.start);const d=t.dot(h),u=h.dot(a),f=h.dot(h),E=t.dot(a),I=a.dot(a)*f-u*u;let m,C;I!==0?m=(d*u-E*f)/I:m=0,C=(d+m*u)/f,r.x=m,r.y=C}}(),In=function(){const c=new S.Vector2,s=new S.Vector3,t=new S.Vector3;return function(i,n,r,o){Po(i,n,c);let a=c.x,l=c.y;if(a>=0&&a<=1&&l>=0&&l<=1){i.at(a,r),n.at(l,o);return}else if(a>=0&&a<=1){l<0?n.at(0,o):n.at(1,o),i.closestPointToPoint(o,!0,r);return}else if(l>=0&&l<=1){a<0?i.at(0,r):i.at(1,r),n.closestPointToPoint(r,!0,o);return}else{let h;a<0?h=i.start:h=i.end;let d;l<0?d=n.start:d=n.end;const u=s,f=t;if(i.closestPointToPoint(d,!0,s),n.closestPointToPoint(h,!0,t),u.distanceToSquared(d)<=f.distanceToSquared(h)){r.copy(u),o.copy(d);return}else{r.copy(h),o.copy(f);return}}}}(),Lo=function(){const c=new S.Vector3,s=new S.Vector3,t=new S.Plane,e=new S.Line3;return function(n,r){const{radius:o,center:a}=n,{a:l,b:h,c:d}=r;if(e.start=l,e.end=h,e.closestPointToPoint(a,!0,c).distanceTo(a)<=o||(e.start=l,e.end=d,e.closestPointToPoint(a,!0,c).distanceTo(a)<=o)||(e.start=h,e.end=d,e.closestPointToPoint(a,!0,c).distanceTo(a)<=o))return!0;const p=r.getPlane(t);if(Math.abs(p.distanceToPoint(a))<=o){const m=p.projectPoint(a,s);if(r.containsPoint(m))return!0}return!1}}(),Mo=1e-15;function Mi(c){return Math.abs(c)<Mo}class Kt extends S.Triangle{constructor(...s){super(...s),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new S.Vector3),this.satBounds=new Array(4).fill().map(()=>new le),this.points=[this.a,this.b,this.c],this.sphere=new S.Sphere,this.plane=new S.Plane,this.needsUpdate=!0}intersectsSphere(s){return Lo(s,this)}update(){const s=this.a,t=this.b,e=this.c,i=this.points,n=this.satAxes,r=this.satBounds,o=n[0],a=r[0];this.getNormal(o),a.setFromPoints(o,i);const l=n[1],h=r[1];l.subVectors(s,t),h.setFromPoints(l,i);const d=n[2],u=r[2];d.subVectors(t,e),u.setFromPoints(d,i);const f=n[3],E=r[3];f.subVectors(e,s),E.setFromPoints(f,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(o,s),this.needsUpdate=!1}}Kt.prototype.closestPointToSegment=function(){const c=new S.Vector3,s=new S.Vector3,t=new S.Line3;return function(i,n=null,r=null){const{start:o,end:a}=i,l=this.points;let h,d=1/0;for(let u=0;u<3;u++){const f=(u+1)%3;t.start.copy(l[u]),t.end.copy(l[f]),In(t,i,c,s),h=c.distanceToSquared(s),h<d&&(d=h,n&&n.copy(c),r&&r.copy(s))}return this.closestPointToPoint(o,c),h=o.distanceToSquared(c),h<d&&(d=h,n&&n.copy(c),r&&r.copy(o)),this.closestPointToPoint(a,c),h=a.distanceToSquared(c),h<d&&(d=h,n&&n.copy(c),r&&r.copy(a)),Math.sqrt(d)}}();Kt.prototype.intersectsTriangle=function(){const c=new Kt,s=new Array(3),t=new Array(3),e=new le,i=new le,n=new S.Vector3,r=new S.Vector3,o=new S.Vector3,a=new S.Vector3,l=new S.Vector3,h=new S.Line3,d=new S.Line3,u=new S.Line3,f=new S.Vector3;function E(p,I,m){const C=p.points;let R=0,g=-1;for(let y=0;y<3;y++){const{start:w,end:O}=h;w.copy(C[y]),O.copy(C[(y+1)%3]),h.delta(r);const M=Mi(I.distanceToPoint(w));if(Mi(I.normal.dot(r))&&M){m.copy(h),R=2;break}const b=I.intersectLine(h,f);if(!b&&M&&f.copy(w),(b||M)&&!Mi(f.distanceTo(O))){if(R<=1)(R===1?m.start:m.end).copy(f),M&&(g=R);else if(R>=2){(g===1?m.start:m.end).copy(f),R=2;break}if(R++,R===2&&g===-1)break}}return R}return function(I,m=null,C=!1){this.needsUpdate&&this.update(),I.isExtendedTriangle?I.needsUpdate&&I.update():(c.copy(I),c.update(),I=c);const R=this.plane,g=I.plane;if(Math.abs(R.normal.dot(g.normal))>1-1e-10){const y=this.satBounds,w=this.satAxes;t[0]=I.a,t[1]=I.b,t[2]=I.c;for(let b=0;b<4;b++){const v=y[b],k=w[b];if(e.setFromPoints(k,t),v.isSeparated(e))return!1}const O=I.satBounds,M=I.satAxes;s[0]=this.a,s[1]=this.b,s[2]=this.c;for(let b=0;b<4;b++){const v=O[b],k=M[b];if(e.setFromPoints(k,s),v.isSeparated(e))return!1}for(let b=0;b<4;b++){const v=w[b];for(let k=0;k<4;k++){const F=M[k];if(n.crossVectors(v,F),e.setFromPoints(n,s),i.setFromPoints(n,t),e.isSeparated(i))return!1}}return m&&(C||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),m.start.set(0,0,0),m.end.set(0,0,0)),!0}else{const y=E(this,g,d);if(y===1&&I.containsPoint(d.end))return m&&(m.start.copy(d.end),m.end.copy(d.end)),!0;if(y!==2)return!1;const w=E(I,R,u);if(w===1&&this.containsPoint(u.end))return m&&(m.start.copy(u.end),m.end.copy(u.end)),!0;if(w!==2)return!1;if(d.delta(o),u.delta(a),o.dot(a)<0){let L=u.start;u.start=u.end,u.end=L}const O=d.start.dot(o),M=d.end.dot(o),b=u.start.dot(o),v=u.end.dot(o),k=M<b,F=O<v;return O!==v&&b!==M&&k===F?!1:(m&&(l.subVectors(d.start,u.start),l.dot(o)>0?m.start.copy(d.start):m.start.copy(u.start),l.subVectors(d.end,u.end),l.dot(o)<0?m.end.copy(d.end):m.end.copy(u.end)),!0)}}}();Kt.prototype.distanceToPoint=function(){const c=new S.Vector3;return function(t){return this.closestPointToPoint(t,c),t.distanceTo(c)}}();Kt.prototype.distanceToTriangle=function(){const c=new S.Vector3,s=new S.Vector3,t=["a","b","c"],e=new S.Line3,i=new S.Line3;return function(r,o=null,a=null){const l=o||a?e:null;if(this.intersectsTriangle(r,l))return(o||a)&&(o&&l.getCenter(o),a&&l.getCenter(a)),0;let h=1/0;for(let d=0;d<3;d++){let u;const f=t[d],E=r[f];this.closestPointToPoint(E,c),u=E.distanceToSquared(c),u<h&&(h=u,o&&o.copy(c),a&&a.copy(E));const p=this[f];r.closestPointToPoint(p,c),u=p.distanceToSquared(c),u<h&&(h=u,o&&o.copy(p),a&&a.copy(c))}for(let d=0;d<3;d++){const u=t[d],f=t[(d+1)%3];e.set(this[u],this[f]);for(let E=0;E<3;E++){const p=t[E],I=t[(E+1)%3];i.set(r[p],r[I]),In(e,i,c,s);const m=c.distanceToSquared(s);m<h&&(h=m,o&&o.copy(c),a&&a.copy(s))}}return Math.sqrt(h)}}();class Dt{constructor(s,t,e){this.isOrientedBox=!0,this.min=new S.Vector3,this.max=new S.Vector3,this.matrix=new S.Matrix4,this.invMatrix=new S.Matrix4,this.points=new Array(8).fill().map(()=>new S.Vector3),this.satAxes=new Array(3).fill().map(()=>new S.Vector3),this.satBounds=new Array(3).fill().map(()=>new le),this.alignedSatBounds=new Array(3).fill().map(()=>new le),this.needsUpdate=!1,s&&this.min.copy(s),t&&this.max.copy(t),e&&this.matrix.copy(e)}set(s,t,e){this.min.copy(s),this.max.copy(t),this.matrix.copy(e),this.needsUpdate=!0}copy(s){this.min.copy(s.min),this.max.copy(s.max),this.matrix.copy(s.matrix),this.needsUpdate=!0}}Dt.prototype.update=function(){return function(){const s=this.matrix,t=this.min,e=this.max,i=this.points;for(let l=0;l<=1;l++)for(let h=0;h<=1;h++)for(let d=0;d<=1;d++){const u=1*l|2*h|4*d,f=i[u];f.x=l?e.x:t.x,f.y=h?e.y:t.y,f.z=d?e.z:t.z,f.applyMatrix4(s)}const n=this.satBounds,r=this.satAxes,o=i[0];for(let l=0;l<3;l++){const h=r[l],d=n[l],u=1<<l,f=i[u];h.subVectors(o,f),d.setFromPoints(h,i)}const a=this.alignedSatBounds;a[0].setFromPointsField(i,"x"),a[1].setFromPointsField(i,"y"),a[2].setFromPointsField(i,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}}();Dt.prototype.intersectsBox=function(){const c=new le;return function(t){this.needsUpdate&&this.update();const e=t.min,i=t.max,n=this.satBounds,r=this.satAxes,o=this.alignedSatBounds;if(c.min=e.x,c.max=i.x,o[0].isSeparated(c)||(c.min=e.y,c.max=i.y,o[1].isSeparated(c))||(c.min=e.z,c.max=i.z,o[2].isSeparated(c)))return!1;for(let a=0;a<3;a++){const l=r[a],h=n[a];if(c.setFromBox(l,t),h.isSeparated(c))return!1}return!0}}();Dt.prototype.intersectsTriangle=function(){const c=new Kt,s=new Array(3),t=new le,e=new le,i=new S.Vector3;return function(r){this.needsUpdate&&this.update(),r.isExtendedTriangle?r.needsUpdate&&r.update():(c.copy(r),c.update(),r=c);const o=this.satBounds,a=this.satAxes;s[0]=r.a,s[1]=r.b,s[2]=r.c;for(let u=0;u<3;u++){const f=o[u],E=a[u];if(t.setFromPoints(E,s),f.isSeparated(t))return!1}const l=r.satBounds,h=r.satAxes,d=this.points;for(let u=0;u<3;u++){const f=l[u],E=h[u];if(t.setFromPoints(E,d),f.isSeparated(t))return!1}for(let u=0;u<3;u++){const f=a[u];for(let E=0;E<4;E++){const p=h[E];if(i.crossVectors(f,p),t.setFromPoints(i,s),e.setFromPoints(i,d),t.isSeparated(e))return!1}}return!0}}();Dt.prototype.closestPointToPoint=function(){return function(s,t){return this.needsUpdate&&this.update(),t.copy(s).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),t}}();Dt.prototype.distanceToPoint=function(){const c=new S.Vector3;return function(t){return this.closestPointToPoint(t,c),t.distanceTo(c)}}();Dt.prototype.distanceToBox=function(){const c=["x","y","z"],s=new Array(12).fill().map(()=>new S.Line3),t=new Array(12).fill().map(()=>new S.Line3),e=new S.Vector3,i=new S.Vector3;return function(r,o=0,a=null,l=null){if(this.needsUpdate&&this.update(),this.intersectsBox(r))return(a||l)&&(r.getCenter(i),this.closestPointToPoint(i,e),r.closestPointToPoint(e,i),a&&a.copy(e),l&&l.copy(i)),0;const h=o*o,d=r.min,u=r.max,f=this.points;let E=1/0;for(let I=0;I<8;I++){const m=f[I];i.copy(m).clamp(d,u);const C=m.distanceToSquared(i);if(C<E&&(E=C,a&&a.copy(m),l&&l.copy(i),C<h))return Math.sqrt(C)}let p=0;for(let I=0;I<3;I++)for(let m=0;m<=1;m++)for(let C=0;C<=1;C++){const R=(I+1)%3,g=(I+2)%3,y=m<<R|C<<g,w=1<<I|m<<R|C<<g,O=f[y],M=f[w];s[p].set(O,M);const v=c[I],k=c[R],F=c[g],L=t[p],T=L.start,D=L.end;T[v]=d[v],T[k]=m?d[k]:u[k],T[F]=C?d[F]:u[k],D[v]=u[v],D[k]=m?d[k]:u[k],D[F]=C?d[F]:u[k],p++}for(let I=0;I<=1;I++)for(let m=0;m<=1;m++)for(let C=0;C<=1;C++){i.x=I?u.x:d.x,i.y=m?u.y:d.y,i.z=C?u.z:d.z,this.closestPointToPoint(i,e);const R=i.distanceToSquared(e);if(R<E&&(E=R,a&&a.copy(e),l&&l.copy(i),R<h))return Math.sqrt(R)}for(let I=0;I<12;I++){const m=s[I];for(let C=0;C<12;C++){const R=t[C];In(m,R,e,i);const g=e.distanceToSquared(i);if(g<E&&(E=g,a&&a.copy(e),l&&l.copy(i),g<h))return Math.sqrt(g)}}return Math.sqrt(E)}}();class gn{constructor(s){this._getNewPrimitive=s,this._primitives=[]}getPrimitive(){const s=this._primitives;return s.length===0?this._getNewPrimitive():s.pop()}releasePrimitive(s){this._primitives.push(s)}}class xo extends gn{constructor(){super(()=>new Kt)}}const Yt=new xo;function Bt(c,s){return s[c+15]===65535}function zt(c,s){return s[c+6]}function Ht(c,s){return s[c+14]}function Wt(c){return c+8}function Xt(c,s){return s[c+6]}function _r(c,s){return s[c+7]}class vo{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const s=[];let t=null;this.setBuffer=e=>{t&&s.push(t),t=e,this.float32Array=new Float32Array(e),this.uint16Array=new Uint16Array(e),this.uint32Array=new Uint32Array(e)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,s.length!==0&&this.setBuffer(s.pop())}}}const _t=new vo;let me,He;const be=[],Os=new gn(()=>new S.Box3);function Do(c,s,t,e,i,n){me=Os.getPrimitive(),He=Os.getPrimitive(),be.push(me,He),_t.setBuffer(c._roots[s]);const r=qi(0,c.geometry,t,e,i,n);_t.clearBuffer(),Os.releasePrimitive(me),Os.releasePrimitive(He),be.pop(),be.pop();const o=be.length;return o>0&&(He=be[o-1],me=be[o-2]),r}function qi(c,s,t,e,i=null,n=0,r=0){const{float32Array:o,uint16Array:a,uint32Array:l}=_t;let h=c*2;if(Bt(h,a)){const u=zt(c,l),f=Ht(h,a);return yt(c,o,me),e(u,f,!1,r,n+c,me)}else{let v=function(F){const{uint16Array:L,uint32Array:T}=_t;let D=F*2;for(;!Bt(D,L);)F=Wt(F),D=F*2;return zt(F,T)},k=function(F){const{uint16Array:L,uint32Array:T}=_t;let D=F*2;for(;!Bt(D,L);)F=Xt(F,T),D=F*2;return zt(F,T)+Ht(D,L)};const u=Wt(c),f=Xt(c,l);let E=u,p=f,I,m,C,R;if(i&&(C=me,R=He,yt(E,o,C),yt(p,o,R),I=i(C),m=i(R),m<I)){E=f,p=u;const F=I;I=m,m=F,C=R}C||(C=me,yt(E,o,C));const g=Bt(E*2,a),y=t(C,g,I,r+1,n+E);let w;if(y===Nn){const F=v(E),T=k(E)-F;w=e(F,T,!0,r+1,n+E,C)}else w=y&&qi(E,s,t,e,i,n,r+1);if(w)return!0;R=He,yt(p,o,R);const O=Bt(p*2,a),M=t(R,O,m,r+1,n+p);let b;if(M===Nn){const F=v(p),T=k(p)-F;b=e(F,T,!0,r+1,n+p,R)}else b=M&&qi(p,s,t,e,i,n,r+1);return!!b}}const Ke=new S.Vector3,xi=new S.Vector3;function Uo(c,s,t={},e=0,i=1/0){const n=e*e,r=i*i;let o=1/0,a=null;if(c.shapecast({boundsTraverseOrder:h=>(Ke.copy(s).clamp(h.min,h.max),Ke.distanceToSquared(s)),intersectsBounds:(h,d,u)=>u<o&&u<r,intersectsTriangle:(h,d)=>{h.closestPointToPoint(s,Ke);const u=s.distanceToSquared(Ke);return u<o&&(xi.copy(Ke),o=u,a=d),u<n}}),o===1/0)return null;const l=Math.sqrt(o);return t.point?t.point.copy(xi):t.point=xi.clone(),t.distance=l,t.faceIndex=a,t}const Pe=new S.Vector3,Le=new S.Vector3,Me=new S.Vector3,Ns=new S.Vector2,bs=new S.Vector2,Ps=new S.Vector2,xn=new S.Vector3,vn=new S.Vector3,Dn=new S.Vector3,Ls=new S.Vector3;function Bo(c,s,t,e,i,n){let r;return n===S.BackSide?r=c.intersectTriangle(e,t,s,!0,i):r=c.intersectTriangle(s,t,e,n!==S.DoubleSide,i),r===null?null:{distance:c.origin.distanceTo(i),point:i.clone()}}function zo(c,s,t,e,i,n,r,o,a){Pe.fromBufferAttribute(s,n),Le.fromBufferAttribute(s,r),Me.fromBufferAttribute(s,o);const l=Bo(c,Pe,Le,Me,Ls,a);if(l){e&&(Ns.fromBufferAttribute(e,n),bs.fromBufferAttribute(e,r),Ps.fromBufferAttribute(e,o),l.uv=S.Triangle.getInterpolation(Ls,Pe,Le,Me,Ns,bs,Ps,new S.Vector2)),i&&(Ns.fromBufferAttribute(i,n),bs.fromBufferAttribute(i,r),Ps.fromBufferAttribute(i,o),l.uv1=S.Triangle.getInterpolation(Ls,Pe,Le,Me,Ns,bs,Ps,new S.Vector2)),t&&(xn.fromBufferAttribute(t,n),vn.fromBufferAttribute(t,r),Dn.fromBufferAttribute(t,o),l.normal=S.Triangle.getInterpolation(Ls,Pe,Le,Me,xn,vn,Dn,new S.Vector3),l.normal.dot(c.direction)>0&&l.normal.multiplyScalar(-1));const h={a:n,b:r,c:o,normal:new S.Vector3,materialIndex:0};S.Triangle.getNormal(Pe,Le,Me,h.normal),l.face=h,l.faceIndex=n}return l}function Ri(c,s,t,e,i){const n=e*3;let r=n+0,o=n+1,a=n+2;const l=c.index;c.index&&(r=l.getX(r),o=l.getX(o),a=l.getX(a));const{position:h,normal:d,uv:u,uv1:f}=c.attributes,E=zo(t,h,d,u,f,r,o,a,s);return E?(E.faceIndex=e,i&&i.push(E),E):null}function bt(c,s,t,e){const i=c.a,n=c.b,r=c.c;let o=s,a=s+1,l=s+2;t&&(o=t.getX(o),a=t.getX(a),l=t.getX(l)),i.x=e.getX(o),i.y=e.getY(o),i.z=e.getZ(o),n.x=e.getX(a),n.y=e.getY(a),n.z=e.getZ(a),r.x=e.getX(l),r.y=e.getY(l),r.z=e.getZ(l)}function Vo(c,s,t,e,i,n){const{geometry:r,_indirectBuffer:o}=c;for(let a=e,l=e+i;a<l;a++)Ri(r,s,t,a,n)}function ko(c,s,t,e,i){const{geometry:n,_indirectBuffer:r}=c;let o=1/0,a=null;for(let l=e,h=e+i;l<h;l++){let d;d=Ri(n,s,t,l),d&&d.distance<o&&(a=d,o=d.distance)}return a}function Go(c,s,t,e,i,n,r){const{geometry:o}=t,{index:a}=o,l=o.attributes.position;for(let h=c,d=s+c;h<d;h++){let u;if(u=h,bt(r,u*3,a,l),r.needsUpdate=!0,e(r,u,i,n))return!0}return!1}function Yo(c,s=null){s&&Array.isArray(s)&&(s=new Set(s));const t=c.geometry,e=t.index?t.index.array:null,i=t.attributes.position;let n,r,o,a,l=0;const h=c._roots;for(let u=0,f=h.length;u<f;u++)n=h[u],r=new Uint32Array(n),o=new Uint16Array(n),a=new Float32Array(n),d(0,l),l+=n.byteLength;function d(u,f,E=!1){const p=u*2;if(o[p+15]===Ai){const m=r[u+6],C=o[p+14];let R=1/0,g=1/0,y=1/0,w=-1/0,O=-1/0,M=-1/0;for(let b=3*m,v=3*(m+C);b<v;b++){let k=e[b];const F=i.getX(k),L=i.getY(k),T=i.getZ(k);F<R&&(R=F),F>w&&(w=F),L<g&&(g=L),L>O&&(O=L),T<y&&(y=T),T>M&&(M=T)}return a[u+0]!==R||a[u+1]!==g||a[u+2]!==y||a[u+3]!==w||a[u+4]!==O||a[u+5]!==M?(a[u+0]=R,a[u+1]=g,a[u+2]=y,a[u+3]=w,a[u+4]=O,a[u+5]=M,!0):!1}else{const m=u+8,C=r[u+6],R=m+f,g=C+f;let y=E,w=!1,O=!1;s?y||(w=s.has(R),O=s.has(g),y=!w&&!O):(w=!0,O=!0);const M=y||w,b=y||O;let v=!1;M&&(v=d(m,f,y));let k=!1;b&&(k=d(C,f,y));const F=v||k;if(F)for(let L=0;L<3;L++){const T=m+L,D=C+L,q=a[T],G=a[T+3],et=a[D],W=a[D+3];a[u+L]=q<et?q:et,a[u+L+3]=G>W?G:W}return F}}}const Un=new S.Box3;function ge(c,s,t,e){return yt(c,s,Un),t.intersectBox(Un,e)}function Ho(c,s,t,e,i,n){const{geometry:r,_indirectBuffer:o}=c;for(let a=e,l=e+i;a<l;a++){let h=o?o[a]:a;Ri(r,s,t,h,n)}}function Wo(c,s,t,e,i){const{geometry:n,_indirectBuffer:r}=c;let o=1/0,a=null;for(let l=e,h=e+i;l<h;l++){let d;d=Ri(n,s,t,r?r[l]:l),d&&d.distance<o&&(a=d,o=d.distance)}return a}function Xo(c,s,t,e,i,n,r){const{geometry:o}=t,{index:a}=o,l=o.attributes.position;for(let h=c,d=s+c;h<d;h++){let u;if(u=t.resolveTriangleIndex(h),bt(r,u*3,a,l),r.needsUpdate=!0,e(r,u,i,n))return!0}return!1}const Bn=new S.Vector3;function Zo(c,s,t,e,i){_t.setBuffer(c._roots[s]),Ki(0,c,t,e,i),_t.clearBuffer()}function Ki(c,s,t,e,i){const{float32Array:n,uint16Array:r,uint32Array:o}=_t,a=c*2;if(Bt(a,r)){const h=zt(c,o),d=Ht(a,r);Vo(s,t,e,h,d,i)}else{const h=Wt(c);ge(h,n,e,Bn)&&Ki(h,s,t,e,i);const d=Xt(c,o);ge(d,n,e,Bn)&&Ki(d,s,t,e,i)}}const zn=new S.Vector3,$o=["x","y","z"];function jo(c,s,t,e){_t.setBuffer(c._roots[s]);const i=Ji(0,c,t,e);return _t.clearBuffer(),i}function Ji(c,s,t,e){const{float32Array:i,uint16Array:n,uint32Array:r}=_t;let o=c*2;if(Bt(o,n)){const l=zt(c,r),h=Ht(o,n);return ko(s,t,e,l,h)}else{const l=_r(c,r),h=$o[l],u=e.direction[h]>=0;let f,E;u?(f=Wt(c),E=Xt(c,r)):(f=Xt(c,r),E=Wt(c));const I=ge(f,i,e,zn)?Ji(f,s,t,e):null;if(I){const R=I.point[h];if(u?R<=i[E+l]:R>=i[E+l+3])return I}const C=ge(E,i,e,zn)?Ji(E,s,t,e):null;return I&&C?I.distance<=C.distance?I:C:I||C||null}}const Ms=new S.Box3,xe=new Kt,ve=new Kt,Je=new S.Matrix4,Vn=new Dt,xs=new Dt;function Qo(c,s,t,e){_t.setBuffer(c._roots[s]);const i=tn(0,c,t,e);return _t.clearBuffer(),i}function tn(c,s,t,e,i=null){const{float32Array:n,uint16Array:r,uint32Array:o}=_t;let a=c*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),Vn.set(t.boundingBox.min,t.boundingBox.max,e),i=Vn),Bt(a,r)){const h=s.geometry,d=h.index,u=h.attributes.position,f=t.index,E=t.attributes.position,p=zt(c,o),I=Ht(a,r);if(Je.copy(e).invert(),t.boundsTree)return yt(c,n,xs),xs.matrix.copy(Je),xs.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:C=>xs.intersectsBox(C),intersectsTriangle:C=>{C.a.applyMatrix4(e),C.b.applyMatrix4(e),C.c.applyMatrix4(e),C.needsUpdate=!0;for(let R=p*3,g=(I+p)*3;R<g;R+=3)if(bt(ve,R,d,u),ve.needsUpdate=!0,C.intersectsTriangle(ve))return!0;return!1}});for(let m=p*3,C=(I+p)*3;m<C;m+=3){bt(xe,m,d,u),xe.a.applyMatrix4(Je),xe.b.applyMatrix4(Je),xe.c.applyMatrix4(Je),xe.needsUpdate=!0;for(let R=0,g=f.count;R<g;R+=3)if(bt(ve,R,f,E),ve.needsUpdate=!0,xe.intersectsTriangle(ve))return!0}}else{const h=c+8,d=o[c+6];return yt(h,n,Ms),!!(i.intersectsBox(Ms)&&tn(h,s,t,e,i)||(yt(d,n,Ms),i.intersectsBox(Ms)&&tn(d,s,t,e,i)))}}const vs=new S.Matrix4,vi=new Dt,ts=new Dt,qo=new S.Vector3,Ko=new S.Vector3,Jo=new S.Vector3,ta=new S.Vector3;function ea(c,s,t,e={},i={},n=0,r=1/0){s.boundingBox||s.computeBoundingBox(),vi.set(s.boundingBox.min,s.boundingBox.max,t),vi.needsUpdate=!0;const o=c.geometry,a=o.attributes.position,l=o.index,h=s.attributes.position,d=s.index,u=Yt.getPrimitive(),f=Yt.getPrimitive();let E=qo,p=Ko,I=null,m=null;i&&(I=Jo,m=ta);let C=1/0,R=null,g=null;return vs.copy(t).invert(),ts.matrix.copy(vs),c.shapecast({boundsTraverseOrder:y=>vi.distanceToBox(y),intersectsBounds:(y,w,O)=>O<C&&O<r?(w&&(ts.min.copy(y.min),ts.max.copy(y.max),ts.needsUpdate=!0),!0):!1,intersectsRange:(y,w)=>{if(s.boundsTree)return s.boundsTree.shapecast({boundsTraverseOrder:M=>ts.distanceToBox(M),intersectsBounds:(M,b,v)=>v<C&&v<r,intersectsRange:(M,b)=>{for(let v=M,k=M+b;v<k;v++){bt(f,3*v,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let F=y,L=y+w;F<L;F++){bt(u,3*F,l,a),u.needsUpdate=!0;const T=u.distanceToTriangle(f,E,I);if(T<C&&(p.copy(E),m&&m.copy(I),C=T,R=F,g=v),T<n)return!0}}}});{const O=Ze(s);for(let M=0,b=O;M<b;M++){bt(f,3*M,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let v=y,k=y+w;v<k;v++){bt(u,3*v,l,a),u.needsUpdate=!0;const F=u.distanceToTriangle(f,E,I);if(F<C&&(p.copy(E),m&&m.copy(I),C=F,R=v,g=M),F<n)return!0}}}}}),Yt.releasePrimitive(u),Yt.releasePrimitive(f),C===1/0?null:(e.point?e.point.copy(p):e.point=p.clone(),e.distance=C,e.faceIndex=R,i&&(i.point?i.point.copy(m):i.point=m.clone(),i.point.applyMatrix4(vs),p.applyMatrix4(vs),i.distance=p.sub(i.point).length(),i.faceIndex=g),e)}function sa(c,s=null){s&&Array.isArray(s)&&(s=new Set(s));const t=c.geometry,e=t.index?t.index.array:null,i=t.attributes.position;let n,r,o,a,l=0;const h=c._roots;for(let u=0,f=h.length;u<f;u++)n=h[u],r=new Uint32Array(n),o=new Uint16Array(n),a=new Float32Array(n),d(0,l),l+=n.byteLength;function d(u,f,E=!1){const p=u*2;if(o[p+15]===Ai){const m=r[u+6],C=o[p+14];let R=1/0,g=1/0,y=1/0,w=-1/0,O=-1/0,M=-1/0;for(let b=m,v=m+C;b<v;b++){const k=3*c.resolveTriangleIndex(b);for(let F=0;F<3;F++){let L=k+F;L=e?e[L]:L;const T=i.getX(L),D=i.getY(L),q=i.getZ(L);T<R&&(R=T),T>w&&(w=T),D<g&&(g=D),D>O&&(O=D),q<y&&(y=q),q>M&&(M=q)}}return a[u+0]!==R||a[u+1]!==g||a[u+2]!==y||a[u+3]!==w||a[u+4]!==O||a[u+5]!==M?(a[u+0]=R,a[u+1]=g,a[u+2]=y,a[u+3]=w,a[u+4]=O,a[u+5]=M,!0):!1}else{const m=u+8,C=r[u+6],R=m+f,g=C+f;let y=E,w=!1,O=!1;s?y||(w=s.has(R),O=s.has(g),y=!w&&!O):(w=!0,O=!0);const M=y||w,b=y||O;let v=!1;M&&(v=d(m,f,y));let k=!1;b&&(k=d(C,f,y));const F=v||k;if(F)for(let L=0;L<3;L++){const T=m+L,D=C+L,q=a[T],G=a[T+3],et=a[D],W=a[D+3];a[u+L]=q<et?q:et,a[u+L+3]=G>W?G:W}return F}}}const kn=new S.Vector3;function ia(c,s,t,e,i){_t.setBuffer(c._roots[s]),en(0,c,t,e,i),_t.clearBuffer()}function en(c,s,t,e,i){const{float32Array:n,uint16Array:r,uint32Array:o}=_t,a=c*2;if(Bt(a,r)){const h=zt(c,o),d=Ht(a,r);Ho(s,t,e,h,d,i)}else{const h=Wt(c);ge(h,n,e,kn)&&en(h,s,t,e,i);const d=Xt(c,o);ge(d,n,e,kn)&&en(d,s,t,e,i)}}const Gn=new S.Vector3,na=["x","y","z"];function ra(c,s,t,e){_t.setBuffer(c._roots[s]);const i=sn(0,c,t,e);return _t.clearBuffer(),i}function sn(c,s,t,e){const{float32Array:i,uint16Array:n,uint32Array:r}=_t;let o=c*2;if(Bt(o,n)){const l=zt(c,r),h=Ht(o,n);return Wo(s,t,e,l,h)}else{const l=_r(c,r),h=na[l],u=e.direction[h]>=0;let f,E;u?(f=Wt(c),E=Xt(c,r)):(f=Xt(c,r),E=Wt(c));const I=ge(f,i,e,Gn)?sn(f,s,t,e):null;if(I){const R=I.point[h];if(u?R<=i[E+l]:R>=i[E+l+3])return I}const C=ge(E,i,e,Gn)?sn(E,s,t,e):null;return I&&C?I.distance<=C.distance?I:C:I||C||null}}const Ds=new S.Box3,De=new Kt,Ue=new Kt,es=new S.Matrix4,Yn=new Dt,Us=new Dt;function oa(c,s,t,e){_t.setBuffer(c._roots[s]);const i=nn(0,c,t,e);return _t.clearBuffer(),i}function nn(c,s,t,e,i=null){const{float32Array:n,uint16Array:r,uint32Array:o}=_t;let a=c*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),Yn.set(t.boundingBox.min,t.boundingBox.max,e),i=Yn),Bt(a,r)){const h=s.geometry,d=h.index,u=h.attributes.position,f=t.index,E=t.attributes.position,p=zt(c,o),I=Ht(a,r);if(es.copy(e).invert(),t.boundsTree)return yt(c,n,Us),Us.matrix.copy(es),Us.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:C=>Us.intersectsBox(C),intersectsTriangle:C=>{C.a.applyMatrix4(e),C.b.applyMatrix4(e),C.c.applyMatrix4(e),C.needsUpdate=!0;for(let R=p,g=I+p;R<g;R++)if(bt(Ue,3*s.resolveTriangleIndex(R),d,u),Ue.needsUpdate=!0,C.intersectsTriangle(Ue))return!0;return!1}});for(let m=p,C=I+p;m<C;m++){const R=s.resolveTriangleIndex(m);bt(De,3*R,d,u),De.a.applyMatrix4(es),De.b.applyMatrix4(es),De.c.applyMatrix4(es),De.needsUpdate=!0;for(let g=0,y=f.count;g<y;g+=3)if(bt(Ue,g,f,E),Ue.needsUpdate=!0,De.intersectsTriangle(Ue))return!0}}else{const h=c+8,d=o[c+6];return yt(h,n,Ds),!!(i.intersectsBox(Ds)&&nn(h,s,t,e,i)||(yt(d,n,Ds),i.intersectsBox(Ds)&&nn(d,s,t,e,i)))}}const Bs=new S.Matrix4,Di=new Dt,ss=new Dt,aa=new S.Vector3,ca=new S.Vector3,la=new S.Vector3,ha=new S.Vector3;function da(c,s,t,e={},i={},n=0,r=1/0){s.boundingBox||s.computeBoundingBox(),Di.set(s.boundingBox.min,s.boundingBox.max,t),Di.needsUpdate=!0;const o=c.geometry,a=o.attributes.position,l=o.index,h=s.attributes.position,d=s.index,u=Yt.getPrimitive(),f=Yt.getPrimitive();let E=aa,p=ca,I=null,m=null;i&&(I=la,m=ha);let C=1/0,R=null,g=null;return Bs.copy(t).invert(),ss.matrix.copy(Bs),c.shapecast({boundsTraverseOrder:y=>Di.distanceToBox(y),intersectsBounds:(y,w,O)=>O<C&&O<r?(w&&(ss.min.copy(y.min),ss.max.copy(y.max),ss.needsUpdate=!0),!0):!1,intersectsRange:(y,w)=>{if(s.boundsTree){const O=s.boundsTree;return O.shapecast({boundsTraverseOrder:M=>ss.distanceToBox(M),intersectsBounds:(M,b,v)=>v<C&&v<r,intersectsRange:(M,b)=>{for(let v=M,k=M+b;v<k;v++){const F=O.resolveTriangleIndex(v);bt(f,3*F,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let L=y,T=y+w;L<T;L++){const D=c.resolveTriangleIndex(L);bt(u,3*D,l,a),u.needsUpdate=!0;const q=u.distanceToTriangle(f,E,I);if(q<C&&(p.copy(E),m&&m.copy(I),C=q,R=L,g=v),q<n)return!0}}}})}else{const O=Ze(s);for(let M=0,b=O;M<b;M++){bt(f,3*M,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let v=y,k=y+w;v<k;v++){const F=c.resolveTriangleIndex(v);bt(u,3*F,l,a),u.needsUpdate=!0;const L=u.distanceToTriangle(f,E,I);if(L<C&&(p.copy(E),m&&m.copy(I),C=L,R=v,g=M),L<n)return!0}}}}}),Yt.releasePrimitive(u),Yt.releasePrimitive(f),C===1/0?null:(e.point?e.point.copy(p):e.point=p.clone(),e.distance=C,e.faceIndex=R,i&&(i.point?i.point.copy(m):i.point=m.clone(),i.point.applyMatrix4(Bs),p.applyMatrix4(Bs),i.distance=p.sub(i.point).length(),i.faceIndex=g),e)}function ua(){return typeof SharedArrayBuffer<"u"}const ps=new _t.constructor,Js=new _t.constructor,pe=new gn(()=>new S.Box3),Be=new S.Box3,ze=new S.Box3,Ui=new S.Box3,Bi=new S.Box3;let zi=!1;function fa(c,s,t,e){if(zi)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");zi=!0;const i=c._roots,n=s._roots;let r,o=0,a=0;const l=new S.Matrix4().copy(t).invert();for(let h=0,d=i.length;h<d;h++){ps.setBuffer(i[h]),a=0;const u=pe.getPrimitive();yt(0,ps.float32Array,u),u.applyMatrix4(l);for(let f=0,E=n.length;f<E&&(Js.setBuffer(n[h]),r=$t(0,0,t,l,e,o,a,0,0,u),Js.clearBuffer(),a+=n[f].length,!r);f++);if(pe.releasePrimitive(u),ps.clearBuffer(),o+=i[h].length,r)break}return zi=!1,r}function $t(c,s,t,e,i,n=0,r=0,o=0,a=0,l=null,h=!1){let d,u;h?(d=Js,u=ps):(d=ps,u=Js);const f=d.float32Array,E=d.uint32Array,p=d.uint16Array,I=u.float32Array,m=u.uint32Array,C=u.uint16Array,R=c*2,g=s*2,y=Bt(R,p),w=Bt(g,C);let O=!1;if(w&&y)h?O=i(zt(s,m),Ht(s*2,C),zt(c,E),Ht(c*2,p),a,r+s,o,n+c):O=i(zt(c,E),Ht(c*2,p),zt(s,m),Ht(s*2,C),o,n+c,a,r+s);else if(w){const M=pe.getPrimitive();yt(s,I,M),M.applyMatrix4(t);const b=Wt(c),v=Xt(c,E);yt(b,f,Be),yt(v,f,ze);const k=M.intersectsBox(Be),F=M.intersectsBox(ze);O=k&&$t(s,b,e,t,i,r,n,a,o+1,M,!h)||F&&$t(s,v,e,t,i,r,n,a,o+1,M,!h),pe.releasePrimitive(M)}else{const M=Wt(s),b=Xt(s,m);yt(M,I,Ui),yt(b,I,Bi);const v=l.intersectsBox(Ui),k=l.intersectsBox(Bi);if(v&&k)O=$t(c,M,t,e,i,n,r,o,a+1,l,h)||$t(c,b,t,e,i,n,r,o,a+1,l,h);else if(v)if(y)O=$t(c,M,t,e,i,n,r,o,a+1,l,h);else{const F=pe.getPrimitive();F.copy(Ui).applyMatrix4(t);const L=Wt(c),T=Xt(c,E);yt(L,f,Be),yt(T,f,ze);const D=F.intersectsBox(Be),q=F.intersectsBox(ze);O=D&&$t(M,L,e,t,i,r,n,a,o+1,F,!h)||q&&$t(M,T,e,t,i,r,n,a,o+1,F,!h),pe.releasePrimitive(F)}else if(k)if(y)O=$t(c,b,t,e,i,n,r,o,a+1,l,h);else{const F=pe.getPrimitive();F.copy(Bi).applyMatrix4(t);const L=Wt(c),T=Xt(c,E);yt(L,f,Be),yt(T,f,ze);const D=F.intersectsBox(Be),q=F.intersectsBox(ze);O=D&&$t(b,L,e,t,i,r,n,a,o+1,F,!h)||q&&$t(b,T,e,t,i,r,n,a,o+1,F,!h),pe.releasePrimitive(F)}}return O}const zs=new Dt,Hn=new S.Box3;class Cn{static serialize(s,t={}){t={cloneBuffers:!0,...t};const e=s.geometry,i=s._roots,n=s._indirectBuffer,r=e.getIndex();let o;return t.cloneBuffers?o={roots:i.map(a=>a.slice()),index:r.array.slice(),indirectBuffer:n?n.slice():null}:o={roots:i,index:r.array,indirectBuffer:n},o}static deserialize(s,t,e={}){e={setIndex:!0,indirect:!!s.indirectBuffer,...e};const{index:i,roots:n,indirectBuffer:r}=s,o=new Cn(t,{...e,[Pi]:!0});if(o._roots=n,o._indirectBuffer=r||null,e.setIndex){const a=t.getIndex();if(a===null){const l=new S.BufferAttribute(s.index,1,!1);t.setIndex(l)}else a.array!==i&&(a.array.set(i),a.needsUpdate=!0)}return o}get indirect(){return!!this._indirectBuffer}constructor(s,t={}){if(s.isBufferGeometry){if(s.index&&s.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:gr,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[Pi]:!1},t),t.useSharedArrayBuffer&&!ua())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=s,this._roots=null,this._indirectBuffer=null,t[Pi]||(bo(this,t),!s.boundingBox&&t.setBoundingBox&&(s.boundingBox=this.getBoundingBox(new S.Box3)));const{_indirectBuffer:e}=this;this.resolveTriangleIndex=t.indirect?i=>e[i]:i=>i}refit(s=null){return(this.indirect?sa:Yo)(this,s)}traverse(s,t=0){const e=this._roots[t],i=new Uint32Array(e),n=new Uint16Array(e);r(0);function r(o,a=0){const l=o*2,h=n[l+15]===Ai;if(h){const d=i[o+6],u=n[l+14];s(a,h,new Float32Array(e,o*4,6),d,u)}else{const d=o+Qs/4,u=i[o+6],f=i[o+7];s(a,h,new Float32Array(e,o*4,6),f)||(r(d,a+1),r(u,a+1))}}}raycast(s,t=S.FrontSide){const e=this._roots,i=this.geometry,n=[],r=t.isMaterial,o=Array.isArray(t),a=i.groups,l=r?t.side:t,h=this.indirect?ia:Zo;for(let d=0,u=e.length;d<u;d++){const f=o?t[a[d].materialIndex].side:l,E=n.length;if(h(this,d,f,s,n),o){const p=a[d].materialIndex;for(let I=E,m=n.length;I<m;I++)n[I].face.materialIndex=p}}return n}raycastFirst(s,t=S.FrontSide){const e=this._roots,i=this.geometry,n=t.isMaterial,r=Array.isArray(t);let o=null;const a=i.groups,l=n?t.side:t,h=this.indirect?ra:jo;for(let d=0,u=e.length;d<u;d++){const f=r?t[a[d].materialIndex].side:l,E=h(this,d,f,s);E!=null&&(o==null||E.distance<o.distance)&&(o=E,r&&(E.face.materialIndex=a[d].materialIndex))}return o}intersectsGeometry(s,t){let e=!1;const i=this._roots,n=this.indirect?oa:Qo;for(let r=0,o=i.length;r<o&&(e=n(this,r,s,t),!e);r++);return e}shapecast(s){const t=Yt.getPrimitive(),e=this.indirect?Xo:Go;let{boundsTraverseOrder:i,intersectsBounds:n,intersectsRange:r,intersectsTriangle:o}=s;if(r&&o){const d=r;r=(u,f,E,p,I)=>d(u,f,E,p,I)?!0:e(u,f,this,o,E,p,t)}else r||(o?r=(d,u,f,E)=>e(d,u,this,o,f,E,t):r=(d,u,f)=>f);let a=!1,l=0;const h=this._roots;for(let d=0,u=h.length;d<u;d++){const f=h[d];if(a=Do(this,d,n,r,i,l),a)break;l+=f.byteLength}return Yt.releasePrimitive(t),a}bvhcast(s,t,e){let{intersectsRanges:i,intersectsTriangles:n}=e;const r=Yt.getPrimitive(),o=this.geometry.index,a=this.geometry.attributes.position,l=this.indirect?E=>{const p=this.resolveTriangleIndex(E);bt(r,p*3,o,a)}:E=>{bt(r,E*3,o,a)},h=Yt.getPrimitive(),d=s.geometry.index,u=s.geometry.attributes.position,f=s.indirect?E=>{const p=s.resolveTriangleIndex(E);bt(h,p*3,d,u)}:E=>{bt(h,E*3,d,u)};if(n){const E=(p,I,m,C,R,g,y,w)=>{for(let O=m,M=m+C;O<M;O++){f(O),h.a.applyMatrix4(t),h.b.applyMatrix4(t),h.c.applyMatrix4(t),h.needsUpdate=!0;for(let b=p,v=p+I;b<v;b++)if(l(b),r.needsUpdate=!0,n(r,h,b,O,R,g,y,w))return!0}return!1};if(i){const p=i;i=function(I,m,C,R,g,y,w,O){return p(I,m,C,R,g,y,w,O)?!0:E(I,m,C,R,g,y,w,O)}}else i=E}return fa(this,s,t,i)}intersectsBox(s,t){return zs.set(s.min,s.max,t),zs.needsUpdate=!0,this.shapecast({intersectsBounds:e=>zs.intersectsBox(e),intersectsTriangle:e=>zs.intersectsTriangle(e)})}intersectsSphere(s){return this.shapecast({intersectsBounds:t=>s.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(s)})}closestPointToGeometry(s,t,e={},i={},n=0,r=1/0){return(this.indirect?da:ea)(this,s,t,e,i,n,r)}closestPointToPoint(s,t={},e=0,i=1/0){return Uo(this,s,t,e,i)}getBoundingBox(s){return s.makeEmpty(),this._roots.forEach(e=>{yt(0,new Float32Array(e),Hn),s.union(Hn)}),s}}function Wn(c,s,t){return c===null||(c.point.applyMatrix4(s.matrixWorld),c.distance=c.point.distanceTo(t.ray.origin),c.object=s,c.distance<t.near||c.distance>t.far)?null:c}const Vi=new S.Ray,Xn=new S.Matrix4,pa=S.Mesh.prototype.raycast;function Ea(c,s){if(this.geometry.boundsTree){if(this.material===void 0)return;Xn.copy(this.matrixWorld).invert(),Vi.copy(c.ray).applyMatrix4(Xn);const t=this.geometry.boundsTree;if(c.firstHitOnly===!0){const e=Wn(t.raycastFirst(Vi,this.material),this,c);e&&s.push(e)}else{const e=t.raycast(Vi,this.material);for(let i=0,n=e.length;i<n;i++){const r=Wn(e[i],this,c);r&&s.push(r)}}}else pa.call(this,c,s)}function ma(c){return this.boundsTree=new Cn(this,c),this.boundsTree}function Ia(){this.boundsTree=null}class Q{constructor(){_(this,"trigger",s=>{const t=this.handlers.slice(0);for(const e of t)e(s)});_(this,"handlers",[])}add(s){this.handlers.push(s)}remove(s){this.handlers=this.handlers.filter(t=>t!==s)}reset(){this.handlers.length=0}}class Es{constructor(){_(this,"trigger",async s=>{const t=this.handlers.slice(0);for(const e of t)await e(s)});_(this,"handlers",[])}add(s){this.handlers.push(s)}remove(s){this.handlers=this.handlers.filter(t=>t!==s)}reset(){this.handlers.length=0}}class yi{constructor(s){_(this,"isDisposeable",()=>"dispose"in this&&"onDisposed"in this);_(this,"isResizeable",()=>"resize"in this&&"getSize"in this);_(this,"isUpdateable",()=>"onAfterUpdate"in this&&"onBeforeUpdate"in this&&"update"in this);_(this,"isHideable",()=>"visible"in this);_(this,"isConfigurable",()=>"setup"in this&&"config"in this&&"onSetup"in this);this.components=s}}class Ft extends yi{}class Fi extends yi{constructor(t){super(t);_(this,"worlds",new Map);_(this,"onWorldChanged",new Q);_(this,"currentWorld",null);this.onWorldChanged.add(({world:e,action:i})=>{i==="removed"&&this.worlds.delete(e.uuid)})}}class Ar extends Fi{constructor(){super(...arguments);_(this,"hasCameraControls",()=>"controls"in this)}}class Rr extends Fi{constructor(){super(...arguments);_(this,"onAfterUpdate",new Q);_(this,"onBeforeUpdate",new Q);_(this,"onDisposed",new Q);_(this,"onResize",new Q);_(this,"onClippingPlanesUpdated",new Q);_(this,"clippingPlanes",[])}updateClippingPlanes(){this.onClippingPlanesUpdated.trigger()}setPlane(t,e,i){e.isLocal=i;const n=this.clippingPlanes.indexOf(e);t&&n===-1?this.clippingPlanes.push(e):!t&&n>-1&&this.clippingPlanes.splice(n,1),this.three.clippingPlanes=this.clippingPlanes.filter(r=>!r.isLocal)}}const ms=class ms extends Ft{constructor(t){super(t);_(this,"_disposedComponents",new Set);_(this,"enabled",!0);t.add(ms.uuid,this)}get(){return this._disposedComponents}destroy(t,e=!0,i=!0){t.removeFromParent();const n=t;n.dispose&&n.dispose(),this.disposeGeometryAndMaterials(t,e),i&&n.children&&n.children.length&&this.disposeChildren(n),t.children.length=0}disposeGeometry(t){t.boundsTree&&t.disposeBoundsTree&&t.disposeBoundsTree(),t.dispose()}disposeGeometryAndMaterials(t,e){const i=t;i.geometry&&this.disposeGeometry(i.geometry),e&&i.material&&ms.disposeMaterial(i),i.material=[],i.geometry=null}disposeChildren(t){for(const e of t.children)this.destroy(e)}static disposeMaterial(t){if(t.material)if(Array.isArray(t.material))for(const e of t.material)e.dispose();else t.material.dispose()}};_(ms,"uuid","76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");let he=ms;class yr extends Fi{constructor(t){super(t);_(this,"onDisposed",new Q);_(this,"directionalLights",new Map);_(this,"ambientLights",new Map)}dispose(){const t=this.components.get(he);for(const e of this.three.children){const i=e;i.geometry&&t.destroy(i)}for(const[,e]of this.directionalLights)e.removeFromParent(),e.target.removeFromParent(),e.dispose();for(const[,e]of this.ambientLights)e.removeFromParent(),e.dispose();this.three.children=[],this.onDisposed.trigger(),this.onDisposed.reset()}}class Se extends Set{constructor(t){super(t);_(this,"onItemAdded",new Q);_(this,"onItemDeleted",new Q);_(this,"onCleared",new Q);_(this,"guard",()=>!0)}clear(){super.clear(),this.onCleared.trigger()}add(...t){for(const e of t)this.has(e)||!this.guard(e)||(super.add(e),this.onItemAdded||(this.onItemAdded=new Q),this.onItemAdded.trigger(e));return this}delete(t){const e=super.delete(t);return e&&this.onItemDeleted.trigger(),e}dispose(){this.clear(),this.onItemAdded.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}class re extends Map{constructor(t){super(t);_(this,"onItemSet",new Q);_(this,"onItemUpdated",new Q);_(this,"onItemDeleted",new Q);_(this,"onCleared",new Q);_(this,"guard",()=>!0)}clear(){super.clear(),this.onCleared.trigger()}set(t,e){const i=this.has(t);if(!(this.guard??(()=>!0))(t,e))return this;const o=super.set(t,e);return i?(this.onItemUpdated||(this.onItemUpdated=new Q),this.onItemUpdated.trigger({key:t,value:e})):(this.onItemSet||(this.onItemSet=new Q),this.onItemSet.trigger({key:t,value:e})),o}delete(t){const e=super.delete(t);return e&&this.onItemDeleted.trigger(t),e}dispose(){this.clear(),this.onItemSet.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}const qs=0,ga=1,Ca=new S.Vector3,Zn=new S.Line3,ki=new S.Plane,$n=new S.Vector3,Vs=new S.Triangle;class Ta{constructor(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new jn,this.unassigned=new jn,this.vertices=[]}setFromPoints(s){if(s.length>=4){this.makeEmpty();for(let t=0,e=s.length;t<e;t++)this.vertices.push(new _a(s[t]));this.compute()}return this}setFromObject(s){const t=[];return s.updateMatrixWorld(!0),s.traverse(function(e){const i=e.geometry;if(i!==void 0){const n=i.attributes.position;if(n!==void 0)for(let r=0,o=n.count;r<o;r++){const a=new S.Vector3;a.fromBufferAttribute(n,r).applyMatrix4(e.matrixWorld),t.push(a)}}}),this.setFromPoints(t)}containsPoint(s){const t=this.faces;for(let e=0,i=t.length;e<i;e++)if(t[e].distanceToPoint(s)>this.tolerance)return!1;return!0}intersectRay(s,t){const e=this.faces;let i=-1/0,n=1/0;for(let r=0,o=e.length;r<o;r++){const a=e[r],l=a.distanceToPoint(s.origin),h=a.normal.dot(s.direction);if(l>0&&h>=0)return null;const d=h!==0?-l/h:0;if(!(d<=0)&&(h>0?n=Math.min(d,n):i=Math.max(d,i),i>n))return null}return i!==-1/0?s.at(i,t):s.at(n,t),t}intersectsRay(s){return this.intersectRay(s,Ca)!==null}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(s,t){return s.face=t,t.outside===null?this.assigned.append(s):this.assigned.insertBefore(t.outside,s),t.outside=s,this}removeVertexFromFace(s,t){return s===t.outside&&(s.next!==null&&s.next.face===t?t.outside=s.next:t.outside=null),this.assigned.remove(s),this}removeAllVerticesFromFace(s){if(s.outside!==null){const t=s.outside;let e=s.outside;for(;e.next!==null&&e.next.face===s;)e=e.next;return this.assigned.removeSubList(t,e),t.prev=e.next=null,s.outside=null,t}}deleteFaceVertices(s,t){const e=this.removeAllVerticesFromFace(s);if(e!==void 0)if(t===void 0)this.unassigned.appendChain(e);else{let i=e;do{const n=i.next;t.distanceToPoint(i.point)>this.tolerance?this.addVertexToFace(i,t):this.unassigned.append(i),i=n}while(i!==null)}return this}resolveUnassignedPoints(s){if(this.unassigned.isEmpty()===!1){let t=this.unassigned.first();do{const e=t.next;let i=this.tolerance,n=null;for(let r=0;r<s.length;r++){const o=s[r];if(o.mark===qs){const a=o.distanceToPoint(t.point);if(a>i&&(i=a,n=o),i>1e3*this.tolerance)break}}n!==null&&this.addVertexToFace(t,n),t=e}while(t!==null)}return this}computeExtremes(){const s=new S.Vector3,t=new S.Vector3,e=[],i=[];for(let n=0;n<3;n++)e[n]=i[n]=this.vertices[0];s.copy(this.vertices[0].point),t.copy(this.vertices[0].point);for(let n=0,r=this.vertices.length;n<r;n++){const o=this.vertices[n],a=o.point;for(let l=0;l<3;l++)a.getComponent(l)<s.getComponent(l)&&(s.setComponent(l,a.getComponent(l)),e[l]=o);for(let l=0;l<3;l++)a.getComponent(l)>t.getComponent(l)&&(t.setComponent(l,a.getComponent(l)),i[l]=o)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(s.x),Math.abs(t.x))+Math.max(Math.abs(s.y),Math.abs(t.y))+Math.max(Math.abs(s.z),Math.abs(t.z))),{min:e,max:i}}computeInitialHull(){const s=this.vertices,t=this.computeExtremes(),e=t.min,i=t.max;let n=0,r=0;for(let u=0;u<3;u++){const f=i[u].point.getComponent(u)-e[u].point.getComponent(u);f>n&&(n=f,r=u)}const o=e[r],a=i[r];let l,h;n=0,Zn.set(o.point,a.point);for(let u=0,f=this.vertices.length;u<f;u++){const E=s[u];if(E!==o&&E!==a){Zn.closestPointToPoint(E.point,!0,$n);const p=$n.distanceToSquared(E.point);p>n&&(n=p,l=E)}}n=-1,ki.setFromCoplanarPoints(o.point,a.point,l.point);for(let u=0,f=this.vertices.length;u<f;u++){const E=s[u];if(E!==o&&E!==a&&E!==l){const p=Math.abs(ki.distanceToPoint(E.point));p>n&&(n=p,h=E)}}const d=[];if(ki.distanceToPoint(h.point)<0){d.push(Qt.create(o,a,l),Qt.create(h,a,o),Qt.create(h,l,a),Qt.create(h,o,l));for(let u=0;u<3;u++){const f=(u+1)%3;d[u+1].getEdge(2).setTwin(d[0].getEdge(f)),d[u+1].getEdge(1).setTwin(d[f+1].getEdge(0))}}else{d.push(Qt.create(o,l,a),Qt.create(h,o,a),Qt.create(h,a,l),Qt.create(h,l,o));for(let u=0;u<3;u++){const f=(u+1)%3;d[u+1].getEdge(2).setTwin(d[0].getEdge((3-u)%3)),d[u+1].getEdge(0).setTwin(d[f+1].getEdge(1))}}for(let u=0;u<4;u++)this.faces.push(d[u]);for(let u=0,f=s.length;u<f;u++){const E=s[u];if(E!==o&&E!==a&&E!==l&&E!==h){n=this.tolerance;let p=null;for(let I=0;I<4;I++){const m=this.faces[I].distanceToPoint(E.point);m>n&&(n=m,p=this.faces[I])}p!==null&&this.addVertexToFace(E,p)}}return this}reindexFaces(){const s=[];for(let t=0;t<this.faces.length;t++){const e=this.faces[t];e.mark===qs&&s.push(e)}return this.faces=s,this}nextVertexToAdd(){if(this.assigned.isEmpty()===!1){let s,t=0;const e=this.assigned.first().face;let i=e.outside;do{const n=e.distanceToPoint(i.point);n>t&&(t=n,s=i),i=i.next}while(i!==null&&i.face===e);return s}}computeHorizon(s,t,e,i){this.deleteFaceVertices(e),e.mark=ga;let n;t===null?n=t=e.getEdge(0):n=t.next;do{const r=n.twin,o=r.face;o.mark===qs&&(o.distanceToPoint(s)>this.tolerance?this.computeHorizon(s,r,o,i):i.push(n)),n=n.next}while(n!==t);return this}addAdjoiningFace(s,t){const e=Qt.create(s,t.tail(),t.head());return this.faces.push(e),e.getEdge(-1).setTwin(t.twin),e.getEdge(0)}addNewFaces(s,t){this.newFaces=[];let e=null,i=null;for(let n=0;n<t.length;n++){const r=t[n],o=this.addAdjoiningFace(s,r);e===null?e=o:o.next.setTwin(i),this.newFaces.push(o.face),i=o}return e.next.setTwin(i),this}addVertexToHull(s){const t=[];return this.unassigned.clear(),this.removeVertexFromFace(s,s.face),this.computeHorizon(s.point,null,s.face,t),this.addNewFaces(s,t),this.resolveUnassignedPoints(this.newFaces),this}cleanup(){return this.assigned.clear(),this.unassigned.clear(),this.newFaces=[],this}compute(){let s;for(this.computeInitialHull();(s=this.nextVertexToAdd())!==void 0;)this.addVertexToHull(s);return this.reindexFaces(),this.cleanup(),this}}class Qt{constructor(){this.normal=new S.Vector3,this.midpoint=new S.Vector3,this.area=0,this.constant=0,this.outside=null,this.mark=qs,this.edge=null}static create(s,t,e){const i=new Qt,n=new Gi(s,i),r=new Gi(t,i),o=new Gi(e,i);return n.next=o.prev=r,r.next=n.prev=o,o.next=r.prev=n,i.edge=n,i.compute()}getEdge(s){let t=this.edge;for(;s>0;)t=t.next,s--;for(;s<0;)t=t.prev,s++;return t}compute(){const s=this.edge.tail(),t=this.edge.head(),e=this.edge.next.head();return Vs.set(s.point,t.point,e.point),Vs.getNormal(this.normal),Vs.getMidpoint(this.midpoint),this.area=Vs.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(s){return this.normal.dot(s)-this.constant}}class Gi{constructor(s,t){this.vertex=s,this.prev=null,this.next=null,this.twin=null,this.face=t}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){const s=this.head(),t=this.tail();return t!==null?t.point.distanceTo(s.point):-1}lengthSquared(){const s=this.head(),t=this.tail();return t!==null?t.point.distanceToSquared(s.point):-1}setTwin(s){return this.twin=s,s.twin=this,this}}class _a{constructor(s){this.point=s,this.prev=null,this.next=null,this.face=null}}class jn{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(s,t){return t.prev=s.prev,t.next=s,t.prev===null?this.head=t:t.prev.next=t,s.prev=t,this}insertAfter(s,t){return t.prev=s,t.next=s.next,t.next===null?this.tail=t:t.next.prev=t,s.next=t,this}append(s){return this.head===null?this.head=s:this.tail.next=s,s.prev=this.tail,s.next=null,this.tail=s,this}appendChain(s){for(this.head===null?this.head=s:this.tail.next=s,s.prev=this.tail;s.next!==null;)s=s.next;return this.tail=s,this}remove(s){return s.prev===null?this.head=s.next:s.prev.next=s.next,s.next===null?this.tail=s.prev:s.next.prev=s.prev,this}removeSubList(s,t){return s.prev===null?this.head=t.next:s.prev.next=t.next,t.next===null?this.tail=s.prev:t.next.prev=s.prev,this}isEmpty(){return this.head===null}}const rn=[2,2,1],on=[1,0,0];function ie(c,s){return c*3+s}function Aa(c){const s=c.elements;let t=0;for(let e=0;e<9;e++)t+=s[e]*s[e];return Math.sqrt(t)}function Ra(c){const s=c.elements;let t=0;for(let e=0;e<3;e++){const i=s[ie(rn[e],on[e])];t+=2*i*i}return Math.sqrt(t)}function ya(c,s){let t=0,e=1;const i=c.elements;for(let l=0;l<3;l++){const h=Math.abs(i[ie(rn[l],on[l])]);h>t&&(t=h,e=l)}let n=1,r=0;const o=on[e],a=rn[e];if(Math.abs(i[ie(a,o)])>Number.EPSILON){const l=i[ie(a,a)],h=i[ie(o,o)],d=i[ie(a,o)],u=(l-h)/2/d;let f;u<0?f=-1/(-u+Math.sqrt(1+u*u)):f=1/(u+Math.sqrt(1+u*u)),n=1/Math.sqrt(1+f*f),r=f*n}return s.identity(),s.elements[ie(o,o)]=n,s.elements[ie(a,a)]=n,s.elements[ie(a,o)]=r,s.elements[ie(o,a)]=-r,s}function Fa(c,s){let t=0,e=0;const i=10;s.unitary.identity(),s.diagonal.copy(c);const n=s.unitary,r=s.diagonal,o=new x.Matrix3,a=new x.Matrix3,l=Number.EPSILON*Aa(r);for(;e<i&&Ra(r)>l;)ya(r,o),a.copy(o).transpose(),r.multiply(o),r.premultiply(a),n.multiply(o),++t>2&&(e++,t=0);return s}function Fr(c){const s=[];for(let ot=0;ot<c.length-2;ot+=3){const ut=c[ot],dt=c[ot+1],mt=c[ot+2];s.push(new x.Vector3(ut,dt,mt))}const t=new Ta;t.setFromPoints(s);const e={unitary:new x.Matrix3,diagonal:new x.Matrix3},i=t.faces,n=[],r=[];for(let ot=0,ut=i.length;ot<ut;ot++){const dt=i[ot];let mt=dt.edge;n.length=0;do n.push(mt),mt=mt.next;while(mt!==dt.edge);const Vt=n.length-2;for(let Lt=1,A=Vt;Lt<=A;Lt++){const X=n[0].vertex,Y=n[Lt+0].vertex,P=n[Lt+1].vertex;r.push(X.point.x,X.point.y,X.point.z),r.push(Y.point.x,Y.point.y,Y.point.z),r.push(P.point.x,P.point.y,P.point.z)}}const o=new x.Vector3,a=new x.Vector3,l=new x.Vector3,h=new x.Vector3,d=new x.Vector3,u=new x.Vector3,f=new x.Vector3,E=new x.Vector3;let p=0,I=0,m=0,C=0,R=0,g=0,y=0;for(let ot=0,ut=r.length;ot<ut;ot+=9){o.fromArray(r,ot),a.fromArray(r,ot+3),l.fromArray(r,ot+6),f.set(0,0,0),f.add(o).add(a).add(l).divideScalar(3),h.subVectors(a,o),d.subVectors(l,o);const dt=u.crossVectors(h,d).length()/2;E.add(u.copy(f).multiplyScalar(dt)),p+=dt,I+=(9*f.x*f.x+o.x*o.x+a.x*a.x+l.x*l.x)*(dt/12),m+=(9*f.x*f.y+o.x*o.y+a.x*a.y+l.x*l.y)*(dt/12),C+=(9*f.x*f.z+o.x*o.z+a.x*a.z+l.x*l.z)*(dt/12),R+=(9*f.y*f.y+o.y*o.y+a.y*a.y+l.y*l.y)*(dt/12),g+=(9*f.y*f.z+o.y*o.z+a.y*a.z+l.y*l.z)*(dt/12),y+=(9*f.z*f.z+o.z*o.z+a.z*a.z+l.z*l.z)*(dt/12)}E.divideScalar(p),I/=p,m/=p,C/=p,R/=p,g/=p,y/=p,I-=E.x*E.x,m-=E.x*E.y,C-=E.x*E.z,R-=E.y*E.y,g-=E.y*E.z,y-=E.z*E.z;const w=new x.Matrix3;w.elements[0]=I,w.elements[1]=m,w.elements[2]=C,w.elements[3]=m,w.elements[4]=R,w.elements[5]=g,w.elements[6]=C,w.elements[7]=g,w.elements[8]=y,Fa(w,e);const O=e.unitary,M=new x.Vector3,b=new x.Vector3,v=new x.Vector3;O.extractBasis(M,b,v);let k=-1/0,F=-1/0,L=-1/0,T=1/0,D=1/0,q=1/0;for(let ot=0,ut=s.length;ot<ut;ot++){const dt=s[ot];k=Math.max(M.dot(dt),k),F=Math.max(b.dot(dt),F),L=Math.max(v.dot(dt),L),T=Math.min(M.dot(dt),T),D=Math.min(b.dot(dt),D),q=Math.min(v.dot(dt),q)}M.multiplyScalar(.5*(T+k)),b.multiplyScalar(.5*(D+F)),v.multiplyScalar(.5*(q+L));const G=new x.Vector3,et=new x.Vector3,W=new x.Matrix3;G.add(M).add(b).add(v),et.x=k-T,et.y=F-D,et.z=L-q,et.multiplyScalar(.5),W.copy(O);const{x:nt,y:V,z:B}=et,rt=new x.Matrix4;rt.makeScale(nt*2,V*2,B*2);const st=new x.Matrix4;st.makeTranslation(-nt,-V,-B);const tt=new x.Matrix4;tt.makeTranslation(G.x,G.y,G.z);const At=new x.Matrix4;At.setFromMatrix3(W);const wt=new x.Matrix4;return wt.multiply(tt),wt.multiply(At),wt.multiply(st),wt.multiply(rt),{center:G,halfSizes:et,rotation:W,transformation:wt}}function wr(c,s,t){const e=[c[0]-s[0],c[1]-s[1],c[2]-s[2]];return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]>0}class an{static isTransparent(s){return s.transparent&&s.opacity<1}}const Ot=class Ot{static create(){const s=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return`${Ot._lut[s&255]+Ot._lut[s>>8&255]+Ot._lut[s>>16&255]+Ot._lut[s>>24&255]}-${Ot._lut[t&255]}${Ot._lut[t>>8&255]}-${Ot._lut[t>>16&15|64]}${Ot._lut[t>>24&255]}-${Ot._lut[e&63|128]}${Ot._lut[e>>8&255]}-${Ot._lut[e>>16&255]}${Ot._lut[e>>24&255]}${Ot._lut[i&255]}${Ot._lut[i>>8&255]}${Ot._lut[i>>16&255]}${Ot._lut[i>>24&255]}`.toLowerCase()}static validate(s){if(!Ot._pattern.test(s))throw new Error(`${s} is not a valid UUID v4.
2
2
 
3
3
  - If you're the tool creator, you can take one from https://www.uuidgenerator.net/.
4
4
 
5
- - If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`)}};T(Ot,"_pattern",/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/),T(Ot,"_lut",["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"]);let re=Ot;class wa extends Ft{constructor(t,e){super(t);T(this,"onDisposed",new Q);T(this,"onVertexFound",new Q);T(this,"onVertexLost",new Q);T(this,"onEnabled",new Q);T(this,"components");T(this,"workingPlane",null);T(this,"_pickedPoint",null);T(this,"_config");T(this,"_enabled",!1);this.components=t,this.config={snapDistance:.25,showOnlyVertex:!1,...e},this.enabled=!1}set enabled(t){this._enabled=t,t||(this._pickedPoint=null),this.onEnabled.trigger(t)}get enabled(){return this._enabled}set config(t){this._config={...this._config,...t}}get config(){return this._config}dispose(){this.onVertexFound.reset(),this.onVertexLost.reset(),this.components=null,this.onDisposed.trigger(),this.onDisposed.reset()}get(t){if(!this.enabled)return this._pickedPoint;const n=this.components.get(Ne).get(t).castRay();if(!n)return this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint;const r=this.getClosestVertex(n);return r?(this.workingPlane?Math.abs(this.workingPlane.distanceToPoint(r))<.001:!0)?((this._pickedPoint===null||!this._pickedPoint.equals(r))&&(this._pickedPoint=r.clone(),this.onVertexFound.trigger(this._pickedPoint)),this._pickedPoint):(this._pickedPoint=null,this._pickedPoint):(this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint)}getClosestVertex(t){let e=new x.Vector3,i=!1,n=Number.MAX_SAFE_INTEGER;const r=this.getVertices(t);if(r===null)return null;for(const o of r){if(!o)continue;const a=t.point.distanceTo(o);a>n||a>this._config.snapDistance||(i=!0,e=o,n=t.point.distanceTo(o))}return i?e:this.config.showOnlyVertex?null:t.point}getVertices(t){const e=t.object;if(!t.face||!e)return null;const i=e.geometry,n=new x.Matrix4,{instanceId:r}=t,o=r!==void 0,a=e instanceof x.InstancedMesh;return a&&o&&e.getMatrixAt(r,n),[this.getVertex(t.face.a,i),this.getVertex(t.face.b,i),this.getVertex(t.face.c,i)].map(l=>(l&&(a&&o&&l.applyMatrix4(n),l.applyMatrix4(e.matrixWorld)),l))}getVertex(t,e){if(t===void 0)return null;const i=e.attributes.position;return new x.Vector3(i.getX(t),i.getY(t),i.getZ(t))}}const li=class li{constructor(){T(this,"onDisposed",new Q);T(this,"list",new Map);T(this,"enabled",!1);T(this,"_clock");T(this,"update",()=>{if(!this.enabled)return;const s=this._clock.getDelta();for(const[t,e]of this.list)e.enabled&&e.isUpdateable()&&e.update(s);requestAnimationFrame(this.update)});this._clock=new x.Clock,li.setupBVH()}add(s,t){if(this.list.has(s))throw new Error("You're trying to add a component that already exists in the components instance. Use Components.get() instead.");re.validate(s),this.list.set(s,t)}get(s){const t=s.uuid;if(!this.list.has(t)){const e=new s(this);return this.list.has(t)||this.add(t,e),e}return this.list.get(t)}init(){this.enabled=!0,this._clock.start(),this.update()}dispose(){this.enabled=!1;for(const[s,t]of this.list)t.enabled=!1,t.isDisposeable()&&t.dispose();this._clock.stop(),this.onDisposed.trigger(),this.onDisposed.reset()}static setupBVH(){x.BufferGeometry.prototype.computeBoundsTree=ma,x.BufferGeometry.prototype.disposeBoundsTree=Ia,x.Mesh.prototype.raycast=Ea}};T(li,"release","2.2.9");let Js=li;class Sr extends yi{constructor(){super(...arguments);T(this,"meshes",new Set);T(this,"onAfterUpdate",new Q);T(this,"onBeforeUpdate",new Q);T(this,"onDisposed",new Q);T(this,"isDisposing",!1);T(this,"enabled",!0);T(this,"uuid",re.create());T(this,"name");T(this,"_scene");T(this,"_camera");T(this,"_renderer",null)}get scene(){if(!this._scene)throw new Error("No scene initialized!");return this._scene}set scene(t){this._scene=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get camera(){if(!this._camera)throw new Error("No camera initialized!");return this._camera}set camera(t){this._camera=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get renderer(){return this._renderer}set renderer(t){this._renderer=t,t&&(t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"}))}update(t){this.enabled&&(!this._scene||!this._camera||(this.scene.currentWorld=this,this.camera.currentWorld=this,this.renderer&&(this.renderer.currentWorld=this),this.onBeforeUpdate.trigger(),this.scene.isUpdateable()&&this.scene.update(t),this.camera.isUpdateable()&&this.camera.update(t),this.renderer&&this.renderer.update(t),this.onAfterUpdate.trigger()))}dispose(t=!0){if(this.enabled=!1,this.isDisposing=!0,this.scene.onWorldChanged.trigger({world:this,action:"removed"}),this.camera.onWorldChanged.trigger({world:this,action:"removed"}),this.renderer&&this.renderer.onWorldChanged.trigger({world:this,action:"removed"}),t){const e=this.components.get(le);this.scene.dispose(),this.camera.isDisposeable()&&this.camera.dispose(),this.renderer&&this.renderer.dispose();for(const i of this.meshes)e.destroy(i);this.meshes.clear()}this._scene=null,this._camera=null,this._renderer=null,this.onDisposed.trigger()}}class Or extends yr{constructor(t){super(t);T(this,"isSetup",!1);T(this,"three");T(this,"onSetup",new Q);T(this,"config",{directionalLight:{color:new x.Color("white"),intensity:1.5,position:new x.Vector3(5,10,3)},ambientLight:{color:new x.Color("white"),intensity:1}});this.three=new x.Scene,this.three.background=new x.Color(2107698)}setup(t){this.config={...this.config,...t};const e=new x.DirectionalLight(this.config.directionalLight.color,this.config.directionalLight.intensity);e.position.copy(this.config.directionalLight.position);const i=new x.AmbientLight(this.config.ambientLight.color,this.config.ambientLight.intensity);this.three.add(e,i),this.directionalLights.set(e.uuid,e),this.ambientLights.set(i.uuid,i),this.isSetup=!0,this.onSetup.trigger(this)}}class Sa extends Rr{constructor(t,e,i){super(t);T(this,"enabled",!0);T(this,"container");T(this,"three");T(this,"_canvas");T(this,"_parameters");T(this,"_resizeObserver",null);T(this,"onContainerUpdated",new Q);T(this,"_resizing",!1);T(this,"resize",t=>{if(this._resizing)return;this._resizing=!0,this.onContainerUpdated.trigger();const e=t?t.x:this.container.clientWidth,i=t?t.y:this.container.clientHeight;this.three.setSize(e,i),this.onResize.trigger(new x.Vector2(e,i)),this._resizing=!1});T(this,"resizeEvent",()=>{this.resize()});T(this,"onContextLost",t=>{t.preventDefault(),this.enabled=!1});T(this,"onContextBack",()=>{this.three.setRenderTarget(null),this.three.dispose(),this.three=new x.WebGLRenderer({canvas:this._canvas,antialias:!0,alpha:!0,...this._parameters}),this.enabled=!0});this.container=e,this._parameters=i,this.three=new x.WebGLRenderer({antialias:!0,alpha:!0,...i}),this.three.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.setupRenderer(),this.setupEvents(!0),this.resize(),this._canvas=this.three.domElement;const n=this.three.getContext(),{canvas:r}=n;r.addEventListener("webglcontextlost",this.onContextLost,!1),r.addEventListener("webglcontextrestored",this.onContextBack,!1)}update(){if(!this.enabled||!this.currentWorld)return;this.onBeforeUpdate.trigger(this);const t=this.currentWorld.scene.three,e=this.currentWorld.camera.three;this.three.render(t,e),this.onAfterUpdate.trigger(this)}dispose(){this.enabled=!1,this.setupEvents(!1),this.three.domElement.remove(),this.three.forceContextLoss(),this.three.dispose(),this.onResize.reset(),this.onAfterUpdate.reset(),this.onBeforeUpdate.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}getSize(){return new x.Vector2(this.three.domElement.clientWidth,this.three.domElement.clientHeight)}setupEvents(t){const e=this.three.domElement.parentElement;if(!e)throw new Error("This renderer needs to have an HTML container!");this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),window.removeEventListener("resize",this.resizeEvent),t&&(this._resizeObserver=new ResizeObserver(this.resizeEvent),this._resizeObserver.observe(e),window.addEventListener("resize",this.resizeEvent))}setupRenderer(){this.three.localClippingEnabled=!0,this.container&&this.container.appendChild(this.three.domElement),this.onContainerUpdated.trigger()}}/*!
5
+ - If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`)}};_(Ot,"_pattern",/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/),_(Ot,"_lut",["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"]);let oe=Ot;class wa extends Ft{constructor(t,e){super(t);_(this,"onDisposed",new Q);_(this,"onVertexFound",new Q);_(this,"onVertexLost",new Q);_(this,"onEnabled",new Q);_(this,"components");_(this,"workingPlane",null);_(this,"_pickedPoint",null);_(this,"_config");_(this,"_enabled",!1);this.components=t,this.config={snapDistance:.25,showOnlyVertex:!1,...e},this.enabled=!1}set enabled(t){this._enabled=t,t||(this._pickedPoint=null),this.onEnabled.trigger(t)}get enabled(){return this._enabled}set config(t){this._config={...this._config,...t}}get config(){return this._config}dispose(){this.onVertexFound.reset(),this.onVertexLost.reset(),this.components=null,this.onDisposed.trigger(),this.onDisposed.reset()}get(t){if(!this.enabled)return this._pickedPoint;const n=this.components.get(Ne).get(t).castRay();if(!n)return this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint;const r=this.getClosestVertex(n);return r?(this.workingPlane?Math.abs(this.workingPlane.distanceToPoint(r))<.001:!0)?((this._pickedPoint===null||!this._pickedPoint.equals(r))&&(this._pickedPoint=r.clone(),this.onVertexFound.trigger(this._pickedPoint)),this._pickedPoint):(this._pickedPoint=null,this._pickedPoint):(this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint)}getClosestVertex(t){let e=new x.Vector3,i=!1,n=Number.MAX_SAFE_INTEGER;const r=this.getVertices(t);if(r===null)return null;for(const o of r){if(!o)continue;const a=t.point.distanceTo(o);a>n||a>this._config.snapDistance||(i=!0,e=o,n=t.point.distanceTo(o))}return i?e:this.config.showOnlyVertex?null:t.point}getVertices(t){const e=t.object;if(!t.face||!e)return null;const i=e.geometry,n=new x.Matrix4,{instanceId:r}=t,o=r!==void 0,a=e instanceof x.InstancedMesh;return a&&o&&e.getMatrixAt(r,n),[this.getVertex(t.face.a,i),this.getVertex(t.face.b,i),this.getVertex(t.face.c,i)].map(l=>(l&&(a&&o&&l.applyMatrix4(n),l.applyMatrix4(e.matrixWorld)),l))}getVertex(t,e){if(t===void 0)return null;const i=e.attributes.position;return new x.Vector3(i.getX(t),i.getY(t),i.getZ(t))}}const li=class li{constructor(){_(this,"onDisposed",new Q);_(this,"list",new Map);_(this,"enabled",!1);_(this,"_clock");_(this,"update",()=>{if(!this.enabled)return;const s=this._clock.getDelta();for(const[t,e]of this.list)e.enabled&&e.isUpdateable()&&e.update(s);requestAnimationFrame(this.update)});this._clock=new x.Clock,li.setupBVH()}add(s,t){if(this.list.has(s))throw new Error("You're trying to add a component that already exists in the components instance. Use Components.get() instead.");oe.validate(s),this.list.set(s,t)}get(s){const t=s.uuid;if(!this.list.has(t)){const e=new s(this);return this.list.has(t)||this.add(t,e),e}return this.list.get(t)}init(){this.enabled=!0,this._clock.start(),this.update()}dispose(){this.enabled=!1;for(const[s,t]of this.list)t.enabled=!1,t.isDisposeable()&&t.dispose();this._clock.stop(),this.onDisposed.trigger(),this.onDisposed.reset()}static setupBVH(){x.BufferGeometry.prototype.computeBoundsTree=ma,x.BufferGeometry.prototype.disposeBoundsTree=Ia,x.Mesh.prototype.raycast=Ea}};_(li,"release","2.2.11");let ti=li;class Sr extends yi{constructor(){super(...arguments);_(this,"meshes",new Set);_(this,"onAfterUpdate",new Q);_(this,"onBeforeUpdate",new Q);_(this,"onDisposed",new Q);_(this,"isDisposing",!1);_(this,"enabled",!0);_(this,"uuid",oe.create());_(this,"name");_(this,"_scene");_(this,"_camera");_(this,"_renderer",null)}get scene(){if(!this._scene)throw new Error("No scene initialized!");return this._scene}set scene(t){this._scene=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get camera(){if(!this._camera)throw new Error("No camera initialized!");return this._camera}set camera(t){this._camera=t,t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"})}get renderer(){return this._renderer}set renderer(t){this._renderer=t,t&&(t.worlds.set(this.uuid,this),t.currentWorld=this,t.onWorldChanged.trigger({world:this,action:"added"}))}update(t){this.enabled&&(!this._scene||!this._camera||(this.scene.currentWorld=this,this.camera.currentWorld=this,this.renderer&&(this.renderer.currentWorld=this),this.onBeforeUpdate.trigger(),this.scene.isUpdateable()&&this.scene.update(t),this.camera.isUpdateable()&&this.camera.update(t),this.renderer&&this.renderer.update(t),this.onAfterUpdate.trigger()))}dispose(t=!0){if(this.enabled=!1,this.isDisposing=!0,this.scene.onWorldChanged.trigger({world:this,action:"removed"}),this.camera.onWorldChanged.trigger({world:this,action:"removed"}),this.renderer&&this.renderer.onWorldChanged.trigger({world:this,action:"removed"}),t){const i=this.components.get(he);this.scene.dispose(),this.camera.isDisposeable()&&this.camera.dispose(),this.renderer&&this.renderer.dispose();for(const n of this.meshes)i.destroy(n);this.meshes.clear()}this._scene=null,this._camera=null,this._renderer=null,this.components.get(_s).list.delete(this.uuid),this.onDisposed.trigger(),this.onDisposed.reset()}}class Or extends yr{constructor(t){super(t);_(this,"isSetup",!1);_(this,"three");_(this,"onSetup",new Q);_(this,"config",{directionalLight:{color:new x.Color("white"),intensity:1.5,position:new x.Vector3(5,10,3)},ambientLight:{color:new x.Color("white"),intensity:1}});this.three=new x.Scene,this.three.background=new x.Color(2107698)}setup(t){this.config={...this.config,...t};const e=new x.DirectionalLight(this.config.directionalLight.color,this.config.directionalLight.intensity);e.position.copy(this.config.directionalLight.position);const i=new x.AmbientLight(this.config.ambientLight.color,this.config.ambientLight.intensity);this.three.add(e,i),this.directionalLights.set(e.uuid,e),this.ambientLights.set(i.uuid,i),this.isSetup=!0,this.onSetup.trigger(this)}}class Sa extends Rr{constructor(t,e,i){super(t);_(this,"enabled",!0);_(this,"container");_(this,"three");_(this,"_canvas");_(this,"_parameters");_(this,"_resizeObserver",null);_(this,"onContainerUpdated",new Q);_(this,"_resizing",!1);_(this,"resize",t=>{if(this._resizing)return;this._resizing=!0,this.onContainerUpdated.trigger();const e=t?t.x:this.container.clientWidth,i=t?t.y:this.container.clientHeight;this.three.setSize(e,i),this.onResize.trigger(new x.Vector2(e,i)),this._resizing=!1});_(this,"resizeEvent",()=>{this.resize()});_(this,"onContextLost",t=>{t.preventDefault(),this.enabled=!1});_(this,"onContextBack",()=>{this.three.setRenderTarget(null),this.three.dispose(),this.three=new x.WebGLRenderer({canvas:this._canvas,antialias:!0,alpha:!0,...this._parameters}),this.enabled=!0});this.container=e,this._parameters=i,this.three=new x.WebGLRenderer({antialias:!0,alpha:!0,...i}),this.three.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.setupRenderer(),this.setupEvents(!0),this.resize(),this._canvas=this.three.domElement;const n=this.three.getContext(),{canvas:r}=n;r.addEventListener("webglcontextlost",this.onContextLost,!1),r.addEventListener("webglcontextrestored",this.onContextBack,!1)}update(){if(!this.enabled||!this.currentWorld)return;this.onBeforeUpdate.trigger(this);const t=this.currentWorld.scene.three,e=this.currentWorld.camera.three;this.three.render(t,e),this.onAfterUpdate.trigger(this)}dispose(){this.enabled=!1,this.setupEvents(!1),this.three.domElement.remove(),this.three.forceContextLoss(),this.three.dispose(),this.onResize.reset(),this.onAfterUpdate.reset(),this.onBeforeUpdate.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}getSize(){return new x.Vector2(this.three.domElement.clientWidth,this.three.domElement.clientHeight)}setupEvents(t){const e=this.three.domElement.parentElement;if(!e)throw new Error("This renderer needs to have an HTML container!");this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),window.removeEventListener("resize",this.resizeEvent),t&&(this._resizeObserver=new ResizeObserver(this.resizeEvent),this._resizeObserver.observe(e),window.addEventListener("resize",this.resizeEvent))}setupRenderer(){this.three.localClippingEnabled=!0,this.container&&this.container.appendChild(this.three.domElement),this.onContainerUpdated.trigger()}}/*!
6
6
  * camera-controls
7
7
  * https://github.com/yomotsu/camera-controls
8
8
  * (c) 2017 @yomotsu
9
9
  * Released under the MIT License.
10
- */const lt={LEFT:1,RIGHT:2,MIDDLE:4},H=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),Ve={NONE:0,IN:1,OUT:-1};function _e(c){return c.isPerspectiveCamera}function fe(c){return c.isOrthographicCamera}const ke=Math.PI*2,Qn=Math.PI/2,Nr=1e-5,is=Math.PI/180;function jt(c,s,t){return Math.max(s,Math.min(t,c))}function Tt(c,s=Nr){return Math.abs(c)<s}function Et(c,s,t=Nr){return Tt(c-s,t)}function qn(c,s){return Math.round(c/s)*s}function ns(c){return isFinite(c)?c:c<0?-Number.MAX_VALUE:Number.MAX_VALUE}function rs(c){return Math.abs(c)<Number.MAX_VALUE?c:c*(1/0)}function Vs(c,s,t,e,i=1/0,n){e=Math.max(1e-4,e);const r=2/e,o=r*n,a=1/(1+o+.48*o*o+.235*o*o*o);let l=c-s;const h=s,d=i*e;l=jt(l,-d,d),s=c-l;const u=(t.value+r*l)*n;t.value=(t.value-r*u)*a;let f=s+(l+u)*a;return h-c>0==f>h&&(f=h,t.value=(f-h)/n),f}function Kn(c,s,t,e,i=1/0,n,r){e=Math.max(1e-4,e);const o=2/e,a=o*n,l=1/(1+a+.48*a*a+.235*a*a*a);let h=s.x,d=s.y,u=s.z,f=c.x-h,E=c.y-d,p=c.z-u;const I=h,m=d,C=u,R=i*e,g=R*R,y=f*f+E*E+p*p;if(y>g){const D=Math.sqrt(y);f=f/D*R,E=E/D*R,p=p/D*R}h=c.x-f,d=c.y-E,u=c.z-p;const w=(t.x+o*f)*n,O=(t.y+o*E)*n,M=(t.z+o*p)*n;t.x=(t.x-o*w)*l,t.y=(t.y-o*O)*l,t.z=(t.z-o*M)*l,r.x=h+(f+w)*l,r.y=d+(E+O)*l,r.z=u+(p+M)*l;const b=I-c.x,v=m-c.y,k=C-c.z,F=r.x-I,L=r.y-m,_=r.z-C;return b*F+v*L+k*_>0&&(r.x=I,r.y=m,r.z=C,t.x=(r.x-I)/n,t.y=(r.y-m)/n,t.z=(r.z-C)/n),r}function Yi(c,s){s.set(0,0),c.forEach(t=>{s.x+=t.clientX,s.y+=t.clientY}),s.x/=c.length,s.y/=c.length}function Hi(c,s){return fe(c)?(console.warn(`${s} is not supported in OrthographicCamera`),!0):!1}class Oa{constructor(){this._listeners={}}addEventListener(s,t){const e=this._listeners;e[s]===void 0&&(e[s]=[]),e[s].indexOf(t)===-1&&e[s].push(t)}hasEventListener(s,t){const e=this._listeners;return e[s]!==void 0&&e[s].indexOf(t)!==-1}removeEventListener(s,t){const i=this._listeners[s];if(i!==void 0){const n=i.indexOf(t);n!==-1&&i.splice(n,1)}}removeAllEventListeners(s){if(!s){this._listeners={};return}Array.isArray(this._listeners[s])&&(this._listeners[s].length=0)}dispatchEvent(s){const e=this._listeners[s.type];if(e!==void 0){s.target=this;const i=e.slice(0);for(let n=0,r=i.length;n<r;n++)i[n].call(this,s)}}}const Na="2.7.3",ks=1/8,br=typeof window<"u",ba=br&&/Mac/.test(navigator.platform),Pa=!(br&&"PointerEvent"in window);let ct,Jn,Gs,Wi,Ut,ht,pt,Ge,os,te,ee,Ae,tr,er,Gt,as,Ye,sr,Xi,ir,Zi,$i,Ys;class xt extends Oa{static install(s){ct=s.THREE,Jn=Object.freeze(new ct.Vector3(0,0,0)),Gs=Object.freeze(new ct.Vector3(0,1,0)),Wi=Object.freeze(new ct.Vector3(0,0,1)),Ut=new ct.Vector2,ht=new ct.Vector3,pt=new ct.Vector3,Ge=new ct.Vector3,os=new ct.Vector3,te=new ct.Vector3,ee=new ct.Vector3,Ae=new ct.Vector3,tr=new ct.Vector3,er=new ct.Vector3,Gt=new ct.Spherical,as=new ct.Spherical,Ye=new ct.Box3,sr=new ct.Box3,Xi=new ct.Sphere,ir=new ct.Quaternion,Zi=new ct.Quaternion,$i=new ct.Matrix4,Ys=new ct.Raycaster}static get ACTION(){return H}constructor(s,t){super(),this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minDistance=Number.EPSILON,this.maxDistance=1/0,this.infinityDolly=!1,this.minZoom=.01,this.maxZoom=1/0,this.smoothTime=.25,this.draggingSmoothTime=.125,this.maxSpeed=1/0,this.azimuthRotateSpeed=1,this.polarRotateSpeed=1,this.dollySpeed=1,this.dollyDragInverted=!1,this.truckSpeed=2,this.dollyToCursor=!1,this.dragToOffset=!1,this.verticalDragToForward=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=H.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=Ve.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new ct.Vector3,this._focalOffsetVelocity=new ct.Vector3,this._zoomVelocity={value:0},this._truckInternal=(g,y,w)=>{let O,M;if(_e(this._camera)){const b=ht.copy(this._camera.position).sub(this._target),v=this._camera.getEffectiveFOV()*is,k=b.length()*Math.tan(v*.5);O=this.truckSpeed*g*k/this._elementRect.height,M=this.truckSpeed*y*k/this._elementRect.height}else if(fe(this._camera)){const b=this._camera;O=g*(b.right-b.left)/b.zoom/this._elementRect.width,M=y*(b.top-b.bottom)/b.zoom/this._elementRect.height}else return;this.verticalDragToForward?(w?this.setFocalOffset(this._focalOffsetEnd.x+O,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(O,0,!0),this.forward(-M,!0)):w?this.setFocalOffset(this._focalOffsetEnd.x+O,this._focalOffsetEnd.y+M,this._focalOffsetEnd.z,!0):this.truck(O,M,!0)},this._rotateInternal=(g,y)=>{const w=ke*this.azimuthRotateSpeed*g/this._elementRect.height,O=ke*this.polarRotateSpeed*y/this._elementRect.height;this.rotate(w,O,!0)},this._dollyInternal=(g,y,w)=>{const O=Math.pow(.95,-g*this.dollySpeed),M=this._sphericalEnd.radius,b=this._sphericalEnd.radius*O,v=jt(b,this.minDistance,this.maxDistance),k=v-b;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(b,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(k,!0),this._dollyToNoClamp(v,!0)):this._dollyToNoClamp(v,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?b:v)-M,this._dollyControlCoord.set(y,w)),this._lastDollyDirection=Math.sign(-g)},this._zoomInternal=(g,y,w)=>{const O=Math.pow(.95,g*this.dollySpeed),M=this._zoom,b=this._zoom*O;this.zoomTo(b,!0),this.dollyToCursor&&(this._changedZoom+=b-M,this._dollyControlCoord.set(y,w))},typeof ct>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=s,this._yAxisUpSpace=new ct.Quaternion().setFromUnitVectors(this._camera.up,Gs),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=H.NONE,this._target=new ct.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new ct.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new ct.Spherical().setFromVector3(ht.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new ct.Vector3,new ct.Vector3,new ct.Vector3,new ct.Vector3],this._updateNearPlaneCorners(),this._boundary=new ct.Box3(new ct.Vector3(-1/0,-1/0,-1/0),new ct.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new ct.Vector2,this.mouseButtons={left:H.ROTATE,middle:H.DOLLY,right:H.TRUCK,wheel:_e(this._camera)?H.DOLLY:fe(this._camera)?H.ZOOM:H.NONE},this.touches={one:H.TOUCH_ROTATE,two:_e(this._camera)?H.TOUCH_DOLLY_TRUCK:fe(this._camera)?H.TOUCH_ZOOM_TRUCK:H.NONE,three:H.TOUCH_TRUCK};const e=new ct.Vector2,i=new ct.Vector2,n=new ct.Vector2,r=g=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const O=this._domElement.getBoundingClientRect(),M=g.clientX/O.width,b=g.clientY/O.height;if(M<this._interactiveArea.left||M>this._interactiveArea.right||b<this._interactiveArea.top||b>this._interactiveArea.bottom)return}const y=g.pointerType!=="mouse"?null:(g.buttons&lt.LEFT)===lt.LEFT?lt.LEFT:(g.buttons&lt.MIDDLE)===lt.MIDDLE?lt.MIDDLE:(g.buttons&lt.RIGHT)===lt.RIGHT?lt.RIGHT:null;if(y!==null){const O=this._findPointerByMouseButton(y);O&&this._disposePointer(O)}if((g.buttons&lt.LEFT)===lt.LEFT&&this._lockedPointer)return;const w={pointerId:g.pointerId,clientX:g.clientX,clientY:g.clientY,deltaX:0,deltaY:0,mouseButton:y};this._activePointers.push(w),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",h),this._isDragging=!0,p(g)},o=g=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const O=this._domElement.getBoundingClientRect(),M=g.clientX/O.width,b=g.clientY/O.height;if(M<this._interactiveArea.left||M>this._interactiveArea.right||b<this._interactiveArea.top||b>this._interactiveArea.bottom)return}const y=(g.buttons&lt.LEFT)===lt.LEFT?lt.LEFT:(g.buttons&lt.MIDDLE)===lt.MIDDLE?lt.MIDDLE:(g.buttons&lt.RIGHT)===lt.RIGHT?lt.RIGHT:null;if(y!==null){const O=this._findPointerByMouseButton(y);O&&this._disposePointer(O)}const w={pointerId:1,clientX:g.clientX,clientY:g.clientY,deltaX:0,deltaY:0,mouseButton:(g.buttons&lt.LEFT)===lt.LEFT?lt.LEFT:(g.buttons&lt.MIDDLE)===lt.LEFT?lt.MIDDLE:(g.buttons&lt.RIGHT)===lt.LEFT?lt.RIGHT:null};this._activePointers.push(w),this._domElement.ownerDocument.removeEventListener("mousemove",l),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.addEventListener("mousemove",l),this._domElement.ownerDocument.addEventListener("mouseup",d),this._isDragging=!0,p(g)},a=g=>{g.cancelable&&g.preventDefault();const y=g.pointerId,w=this._lockedPointer||this._findPointerById(y);if(w){if(w.clientX=g.clientX,w.clientY=g.clientY,w.deltaX=g.movementX,w.deltaY=g.movementY,this._state=0,g.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(g.buttons&lt.LEFT)===lt.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(g.buttons&lt.MIDDLE)===lt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(g.buttons&lt.RIGHT)===lt.RIGHT&&(this._state=this._state|this.mouseButtons.right);I()}},l=g=>{const y=this._lockedPointer||this._findPointerById(1);y&&(y.clientX=g.clientX,y.clientY=g.clientY,y.deltaX=g.movementX,y.deltaY=g.movementY,this._state=0,(this._lockedPointer||(g.buttons&lt.LEFT)===lt.LEFT)&&(this._state=this._state|this.mouseButtons.left),(g.buttons&lt.MIDDLE)===lt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(g.buttons&lt.RIGHT)===lt.RIGHT&&(this._state=this._state|this.mouseButtons.right),I())},h=g=>{const y=this._findPointerById(g.pointerId);if(!(y&&y===this._lockedPointer)){if(y&&this._disposePointer(y),g.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=H.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=H.NONE;m()}},d=()=>{const g=this._findPointerById(1);g&&g===this._lockedPointer||(g&&this._disposePointer(g),this._state=H.NONE,m())};let u=-1;const f=g=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===H.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const b=this._domElement.getBoundingClientRect(),v=g.clientX/b.width,k=g.clientY/b.height;if(v<this._interactiveArea.left||v>this._interactiveArea.right||k<this._interactiveArea.top||k>this._interactiveArea.bottom)return}if(g.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===H.ROTATE||this.mouseButtons.wheel===H.TRUCK){const b=performance.now();u-b<1e3&&this._getClientRect(this._elementRect),u=b}const y=ba?-1:-3,w=g.deltaMode===1?g.deltaY/y:g.deltaY/(y*10),O=this.dollyToCursor?(g.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,M=this.dollyToCursor?(g.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case H.ROTATE:{this._rotateInternal(g.deltaX,g.deltaY),this._isUserControllingRotate=!0;break}case H.TRUCK:{this._truckInternal(g.deltaX,g.deltaY,!1),this._isUserControllingTruck=!0;break}case H.OFFSET:{this._truckInternal(g.deltaX,g.deltaY,!0),this._isUserControllingOffset=!0;break}case H.DOLLY:{this._dollyInternal(-w,O,M),this._isUserControllingDolly=!0;break}case H.ZOOM:{this._zoomInternal(-w,O,M),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},E=g=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===xt.ACTION.NONE){const y=g instanceof PointerEvent?g.pointerId:(g instanceof MouseEvent,0),w=this._findPointerById(y);w&&this._disposePointer(w),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mousemove",l),this._domElement.ownerDocument.removeEventListener("mouseup",d);return}g.preventDefault()}},p=g=>{if(!this._enabled)return;if(Yi(this._activePointers,Ut),this._getClientRect(this._elementRect),e.copy(Ut),i.copy(Ut),this._activePointers.length>=2){const w=Ut.x-this._activePointers[1].clientX,O=Ut.y-this._activePointers[1].clientY,M=Math.sqrt(w*w+O*O);n.set(0,M);const b=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,v=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;i.set(b,v)}if(this._state=0,!g)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in g&&g.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(g.buttons&lt.LEFT)===lt.LEFT&&(this._state=this._state|this.mouseButtons.left),(g.buttons&lt.MIDDLE)===lt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(g.buttons&lt.RIGHT)===lt.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&H.ROTATE)===H.ROTATE||(this._state&H.TOUCH_ROTATE)===H.TOUCH_ROTATE||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_ZOOM_ROTATE)===H.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&H.TRUCK)===H.TRUCK||(this._state&H.TOUCH_TRUCK)===H.TOUCH_TRUCK||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&H.DOLLY)===H.DOLLY||(this._state&H.TOUCH_DOLLY)===H.TOUCH_DOLLY||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&H.ZOOM)===H.ZOOM||(this._state&H.TOUCH_ZOOM)===H.TOUCH_ZOOM||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET||(this._state&H.TOUCH_ZOOM_ROTATE)===H.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&H.OFFSET)===H.OFFSET||(this._state&H.TOUCH_OFFSET)===H.TOUCH_OFFSET||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},I=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,Yi(this._activePointers,Ut);const y=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,w=y?-y.deltaX:i.x-Ut.x,O=y?-y.deltaY:i.y-Ut.y;if(i.copy(Ut),((this._state&H.ROTATE)===H.ROTATE||(this._state&H.TOUCH_ROTATE)===H.TOUCH_ROTATE||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_ZOOM_ROTATE)===H.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(w,O),this._isUserControllingRotate=!0),(this._state&H.DOLLY)===H.DOLLY||(this._state&H.ZOOM)===H.ZOOM){const M=this.dollyToCursor?(e.x-this._elementRect.x)/this._elementRect.width*2-1:0,b=this.dollyToCursor?(e.y-this._elementRect.y)/this._elementRect.height*-2+1:0,v=this.dollyDragInverted?-1:1;(this._state&H.DOLLY)===H.DOLLY?(this._dollyInternal(v*O*ks,M,b),this._isUserControllingDolly=!0):(this._zoomInternal(v*O*ks,M,b),this._isUserControllingZoom=!0)}if((this._state&H.TOUCH_DOLLY)===H.TOUCH_DOLLY||(this._state&H.TOUCH_ZOOM)===H.TOUCH_ZOOM||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_ZOOM_ROTATE)===H.TOUCH_ZOOM_ROTATE){const M=Ut.x-this._activePointers[1].clientX,b=Ut.y-this._activePointers[1].clientY,v=Math.sqrt(M*M+b*b),k=n.y-v;n.set(0,v);const F=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,L=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&H.TOUCH_DOLLY)===H.TOUCH_DOLLY||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET?(this._dollyInternal(k*ks,F,L),this._isUserControllingDolly=!0):(this._zoomInternal(k*ks,F,L),this._isUserControllingZoom=!0)}((this._state&H.TRUCK)===H.TRUCK||(this._state&H.TOUCH_TRUCK)===H.TOUCH_TRUCK||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(w,O,!1),this._isUserControllingTruck=!0),((this._state&H.OFFSET)===H.OFFSET||(this._state&H.TOUCH_OFFSET)===H.TOUCH_OFFSET||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(w,O,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},m=()=>{Yi(this._activePointers,Ut),i.copy(Ut),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",l),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mouseup",d),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",C),this._domElement.ownerDocument.addEventListener("pointerlockerror",R),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",h),p())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",C),this._domElement.ownerDocument.removeEventListener("pointerlockerror",R))};const C=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},R=()=>{this.unlockPointer()};this._addAllEventListeners=g=>{this._domElement=g,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",r),Pa&&this._domElement.addEventListener("mousedown",o),this._domElement.addEventListener("pointercancel",h),this._domElement.addEventListener("wheel",f,{passive:!1}),this._domElement.addEventListener("contextmenu",E)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",r),this._domElement.removeEventListener("mousedown",o),this._domElement.removeEventListener("pointercancel",h),this._domElement.removeEventListener("wheel",f,{passive:!1}),this._domElement.removeEventListener("contextmenu",E),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",l),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.removeEventListener("pointerlockchange",C),this._domElement.ownerDocument.removeEventListener("pointerlockerror",R))},this.cancel=()=>{this._state!==H.NONE&&(this._state=H.NONE,this._activePointers.length=0,m())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(s){this._camera=s,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(s){this._enabled=s,this._domElement&&(s?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(s){this._spherical.radius===s&&this._sphericalEnd.radius===s||(this._spherical.radius=s,this._sphericalEnd.radius=s,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(s){this._spherical.theta===s&&this._sphericalEnd.theta===s||(this._spherical.theta=s,this._sphericalEnd.theta=s,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(s){this._spherical.phi===s&&this._sphericalEnd.phi===s||(this._spherical.phi=s,this._sphericalEnd.phi=s,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(s){this._boundaryEnclosesCamera=s,this._needsUpdate=!0}set interactiveArea(s){this._interactiveArea.width=jt(s.width,0,1),this._interactiveArea.height=jt(s.height,0,1),this._interactiveArea.x=jt(s.x,0,1-this._interactiveArea.width),this._interactiveArea.y=jt(s.y,0,1-this._interactiveArea.height)}addEventListener(s,t){super.addEventListener(s,t)}removeEventListener(s,t){super.removeEventListener(s,t)}rotate(s,t,e=!1){return this.rotateTo(this._sphericalEnd.theta+s,this._sphericalEnd.phi+t,e)}rotateAzimuthTo(s,t=!1){return this.rotateTo(s,this._sphericalEnd.phi,t)}rotatePolarTo(s,t=!1){return this.rotateTo(this._sphericalEnd.theta,s,t)}rotateTo(s,t,e=!1){this._isUserControllingRotate=!1;const i=jt(s,this.minAzimuthAngle,this.maxAzimuthAngle),n=jt(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=n,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,e||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const r=!e||Et(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Et(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(r)}dolly(s,t=!1){return this.dollyTo(this._sphericalEnd.radius-s,t)}dollyTo(s,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Ve.NONE,this._changedDolly=0,this._dollyToNoClamp(jt(s,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(s,t=!1){const e=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const r=this._collisionTest(),o=Et(r,this._spherical.radius);if(!(e>s)&&o)return Promise.resolve();this._sphericalEnd.radius=Math.min(s,r)}else this._sphericalEnd.radius=s;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const n=!t||Et(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(n)}dollyInFixed(s,t=!1){this._targetEnd.add(this._getCameraDirection(os).multiplyScalar(s)),t||this._target.copy(this._targetEnd);const e=!t||Et(this._target.x,this._targetEnd.x,this.restThreshold)&&Et(this._target.y,this._targetEnd.y,this.restThreshold)&&Et(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(e)}zoom(s,t=!1){return this.zoomTo(this._zoomEnd+s,t)}zoomTo(s,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=jt(s,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const e=!t||Et(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(e)}pan(s,t,e=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(s,t,e)}truck(s,t,e=!1){this._camera.updateMatrix(),te.setFromMatrixColumn(this._camera.matrix,0),ee.setFromMatrixColumn(this._camera.matrix,1),te.multiplyScalar(s),ee.multiplyScalar(-t);const i=ht.copy(te).add(ee),n=pt.copy(this._targetEnd).add(i);return this.moveTo(n.x,n.y,n.z,e)}forward(s,t=!1){ht.setFromMatrixColumn(this._camera.matrix,0),ht.crossVectors(this._camera.up,ht),ht.multiplyScalar(s);const e=pt.copy(this._targetEnd).add(ht);return this.moveTo(e.x,e.y,e.z,t)}elevate(s,t=!1){return ht.copy(this._camera.up).multiplyScalar(s),this.moveTo(this._targetEnd.x+ht.x,this._targetEnd.y+ht.y,this._targetEnd.z+ht.z,t)}moveTo(s,t,e,i=!1){this._isUserControllingTruck=!1;const n=ht.set(s,t,e).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,n,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);const r=!i||Et(this._target.x,this._targetEnd.x,this.restThreshold)&&Et(this._target.y,this._targetEnd.y,this.restThreshold)&&Et(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}lookInDirectionOf(s,t,e,i=!1){const o=ht.set(s,t,e).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(o.x,o.y,o.z,i)}fitToBox(s,t,{cover:e=!1,paddingLeft:i=0,paddingRight:n=0,paddingBottom:r=0,paddingTop:o=0}={}){const a=[],l=s.isBox3?Ye.copy(s):Ye.setFromObject(s);l.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const h=qn(this._sphericalEnd.theta,Qn),d=qn(this._sphericalEnd.phi,Qn);a.push(this.rotateTo(h,d,t));const u=ht.setFromSpherical(this._sphericalEnd).normalize(),f=ir.setFromUnitVectors(u,Wi),E=Et(Math.abs(u.y),1);E&&f.multiply(Zi.setFromAxisAngle(Gs,h)),f.multiply(this._yAxisUpSpaceInverse);const p=sr.makeEmpty();pt.copy(l.min).applyQuaternion(f),p.expandByPoint(pt),pt.copy(l.min).setX(l.max.x).applyQuaternion(f),p.expandByPoint(pt),pt.copy(l.min).setY(l.max.y).applyQuaternion(f),p.expandByPoint(pt),pt.copy(l.max).setZ(l.min.z).applyQuaternion(f),p.expandByPoint(pt),pt.copy(l.min).setZ(l.max.z).applyQuaternion(f),p.expandByPoint(pt),pt.copy(l.max).setY(l.min.y).applyQuaternion(f),p.expandByPoint(pt),pt.copy(l.max).setX(l.min.x).applyQuaternion(f),p.expandByPoint(pt),pt.copy(l.max).applyQuaternion(f),p.expandByPoint(pt),p.min.x-=i,p.min.y-=r,p.max.x+=n,p.max.y+=o,f.setFromUnitVectors(Wi,u),E&&f.premultiply(Zi.invert()),f.premultiply(this._yAxisUpSpace);const I=p.getSize(ht),m=p.getCenter(pt).applyQuaternion(f);if(_e(this._camera)){const C=this.getDistanceToFitBox(I.x,I.y,I.z,e);a.push(this.moveTo(m.x,m.y,m.z,t)),a.push(this.dollyTo(C,t)),a.push(this.setFocalOffset(0,0,0,t))}else if(fe(this._camera)){const C=this._camera,R=C.right-C.left,g=C.top-C.bottom,y=e?Math.max(R/I.x,g/I.y):Math.min(R/I.x,g/I.y);a.push(this.moveTo(m.x,m.y,m.z,t)),a.push(this.zoomTo(y,t)),a.push(this.setFocalOffset(0,0,0,t))}return Promise.all(a)}fitToSphere(s,t){const e=[],n=s instanceof ct.Sphere?Xi.copy(s):xt.createBoundingSphere(s,Xi);if(e.push(this.moveTo(n.center.x,n.center.y,n.center.z,t)),_e(this._camera)){const r=this.getDistanceToFitSphere(n.radius);e.push(this.dollyTo(r,t))}else if(fe(this._camera)){const r=this._camera.right-this._camera.left,o=this._camera.top-this._camera.bottom,a=2*n.radius,l=Math.min(r/a,o/a);e.push(this.zoomTo(l,t))}return e.push(this.setFocalOffset(0,0,0,t)),Promise.all(e)}setLookAt(s,t,e,i,n,r,o=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Ve.NONE,this._changedDolly=0;const a=pt.set(i,n,r),l=ht.set(s,t,e);this._targetEnd.copy(a),this._sphericalEnd.setFromVector3(l.sub(a).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,o||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const h=!o||Et(this._target.x,this._targetEnd.x,this.restThreshold)&&Et(this._target.y,this._targetEnd.y,this.restThreshold)&&Et(this._target.z,this._targetEnd.z,this.restThreshold)&&Et(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Et(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Et(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(h)}lerpLookAt(s,t,e,i,n,r,o,a,l,h,d,u,f,E=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Ve.NONE,this._changedDolly=0;const p=ht.set(i,n,r),I=pt.set(s,t,e);Gt.setFromVector3(I.sub(p).applyQuaternion(this._yAxisUpSpace));const m=Ge.set(h,d,u),C=pt.set(o,a,l);as.setFromVector3(C.sub(m).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(p.lerp(m,f));const R=as.theta-Gt.theta,g=as.phi-Gt.phi,y=as.radius-Gt.radius;this._sphericalEnd.set(Gt.radius+y*f,Gt.phi+g*f,Gt.theta+R*f),this.normalizeRotations(),this._needsUpdate=!0,E||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const w=!E||Et(this._target.x,this._targetEnd.x,this.restThreshold)&&Et(this._target.y,this._targetEnd.y,this.restThreshold)&&Et(this._target.z,this._targetEnd.z,this.restThreshold)&&Et(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Et(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Et(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(w)}setPosition(s,t,e,i=!1){return this.setLookAt(s,t,e,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}setTarget(s,t,e,i=!1){const n=this.getPosition(ht),r=this.setLookAt(n.x,n.y,n.z,s,t,e,i);return this._sphericalEnd.phi=jt(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),r}setFocalOffset(s,t,e,i=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(s,t,e),this._needsUpdate=!0,i||this._focalOffset.copy(this._focalOffsetEnd);const n=!i||Et(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&Et(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&Et(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}setOrbitPoint(s,t,e){this._camera.updateMatrixWorld(),te.setFromMatrixColumn(this._camera.matrixWorldInverse,0),ee.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Ae.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const i=ht.set(s,t,e),n=i.distanceTo(this._camera.position),r=i.sub(this._camera.position);te.multiplyScalar(r.x),ee.multiplyScalar(r.y),Ae.multiplyScalar(r.z),ht.copy(te).add(ee).add(Ae),ht.z=ht.z+n,this.dollyTo(n,!1),this.setFocalOffset(-ht.x,ht.y,-ht.z,!1),this.moveTo(s,t,e,!1)}setBoundary(s){if(!s){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(s),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(s,t,e,i){if(s===null){this._viewport=null;return}this._viewport=this._viewport||new ct.Vector4,typeof s=="number"?this._viewport.set(s,t,e,i):this._viewport.copy(s)}getDistanceToFitBox(s,t,e,i=!1){if(Hi(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const n=s/t,r=this._camera.getEffectiveFOV()*is,o=this._camera.aspect;return((i?n>o:n<o)?t:s/o)*.5/Math.tan(r*.5)+e*.5}getDistanceToFitSphere(s){if(Hi(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*is,e=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,i=1<this._camera.aspect?t:e;return s/Math.sin(i*.5)}getTarget(s,t=!0){return(s&&s.isVector3?s:new ct.Vector3).copy(t?this._targetEnd:this._target)}getPosition(s,t=!0){return(s&&s.isVector3?s:new ct.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(s,t=!0){return(s&&s instanceof ct.Spherical?s:new ct.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(s,t=!0){return(s&&s.isVector3?s:new ct.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%ke,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=ke),this._spherical.theta+=ke*Math.round((this._sphericalEnd.theta-this._spherical.theta)/ke)}reset(s=!1){if(!Et(this._camera.up.x,this._cameraUp0.x)||!Et(this._camera.up.y,this._cameraUp0.y)||!Et(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const e=this.getPosition(ht);this.updateCameraUp(),this.setPosition(e.x,e.y,e.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,s),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,s),this.zoomTo(this._zoom0,s)];return Promise.all(t)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,Gs),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const s=ht.subVectors(this._target,this._camera.position).normalize(),t=pt.crossVectors(s,this._camera.up);this._camera.up.crossVectors(t,s).normalize(),this._camera.updateMatrixWorld();const e=this.getPosition(ht);this.updateCameraUp(),this.setPosition(e.x,e.y,e.z)}update(s){const t=this._sphericalEnd.theta-this._spherical.theta,e=this._sphericalEnd.phi-this._spherical.phi,i=this._sphericalEnd.radius-this._spherical.radius,n=tr.subVectors(this._targetEnd,this._target),r=er.subVectors(this._focalOffsetEnd,this._focalOffset),o=this._zoomEnd-this._zoom;if(Tt(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Vs(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,d,1/0,s),this._needsUpdate=!0}if(Tt(e))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Vs(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,d,1/0,s),this._needsUpdate=!0}if(Tt(i))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const d=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Vs(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,d,this.maxSpeed,s),this._needsUpdate=!0}if(Tt(n.x)&&Tt(n.y)&&Tt(n.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const d=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;Kn(this._target,this._targetEnd,this._targetVelocity,d,this.maxSpeed,s,this._target),this._needsUpdate=!0}if(Tt(r.x)&&Tt(r.y)&&Tt(r.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const d=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;Kn(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,d,this.maxSpeed,s,this._focalOffset),this._needsUpdate=!0}if(Tt(o))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const d=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Vs(this._zoom,this._zoomEnd,this._zoomVelocity,d,1/0,s)}if(this.dollyToCursor){if(_e(this._camera)&&this._changedDolly!==0){const d=this._spherical.radius-this._lastDistance,u=this._camera,f=this._getCameraDirection(os),E=ht.copy(f).cross(u.up).normalize();E.lengthSq()===0&&(E.x=1);const p=pt.crossVectors(E,f),I=this._sphericalEnd.radius*Math.tan(u.getEffectiveFOV()*is*.5),C=(this._sphericalEnd.radius-d-this._sphericalEnd.radius)/this._sphericalEnd.radius,R=Ge.copy(this._targetEnd).add(E.multiplyScalar(this._dollyControlCoord.x*I*u.aspect)).add(p.multiplyScalar(this._dollyControlCoord.y*I)),g=ht.copy(this._targetEnd).lerp(R,C),y=this._lastDollyDirection===Ve.IN&&this._spherical.radius<=this.minDistance,w=this._lastDollyDirection===Ve.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(y||w)){this._sphericalEnd.radius-=d,this._spherical.radius-=d;const M=pt.copy(f).multiplyScalar(-d);g.add(M)}this._boundary.clampPoint(g,g);const O=pt.subVectors(g,this._targetEnd);this._targetEnd.copy(g),this._target.add(O),this._changedDolly-=d,Tt(this._changedDolly)&&(this._changedDolly=0)}else if(fe(this._camera)&&this._changedZoom!==0){const d=this._zoom-this._lastZoom,u=this._camera,f=ht.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(u.near+u.far)/(u.near-u.far)).unproject(u),E=pt.set(0,0,-1).applyQuaternion(u.quaternion),p=Ge.copy(f).add(E.multiplyScalar(-f.dot(u.up))),m=-(this._zoom-d-this._zoom)/this._zoom,C=this._getCameraDirection(os),R=this._targetEnd.dot(C),g=ht.copy(this._targetEnd).lerp(p,m),y=g.dot(C),w=C.multiplyScalar(y-R);g.sub(w),this._boundary.clampPoint(g,g);const O=pt.subVectors(g,this._targetEnd);this._targetEnd.copy(g),this._target.add(O),this._changedZoom-=d,Tt(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const a=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,a),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!Tt(this._focalOffset.x)||!Tt(this._focalOffset.y)||!Tt(this._focalOffset.z))&&(this._camera.updateMatrixWorld(),te.setFromMatrixColumn(this._camera.matrix,0),ee.setFromMatrixColumn(this._camera.matrix,1),Ae.setFromMatrixColumn(this._camera.matrix,2),te.multiplyScalar(this._focalOffset.x),ee.multiplyScalar(-this._focalOffset.y),Ae.multiplyScalar(this._focalOffset.z),ht.copy(te).add(ee).add(Ae),this._camera.position.add(ht)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),ht.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const h=this._needsUpdate;return h&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):h?(this.dispatchEvent({type:"update"}),Tt(t,this.restThreshold)&&Tt(e,this.restThreshold)&&Tt(i,this.restThreshold)&&Tt(n.x,this.restThreshold)&&Tt(n.y,this.restThreshold)&&Tt(n.z,this.restThreshold)&&Tt(r.x,this.restThreshold)&&Tt(r.y,this.restThreshold)&&Tt(r.z,this.restThreshold)&&Tt(o,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!h&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=h,this._needsUpdate=!1,h}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:ns(this.maxDistance),minZoom:this.minZoom,maxZoom:ns(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:ns(this.maxPolarAngle),minAzimuthAngle:ns(this.minAzimuthAngle),maxAzimuthAngle:ns(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,verticalDragToForward:this.verticalDragToForward,target:this._targetEnd.toArray(),position:ht.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(s,t=!1){const e=JSON.parse(s);this.enabled=e.enabled,this.minDistance=e.minDistance,this.maxDistance=rs(e.maxDistance),this.minZoom=e.minZoom,this.maxZoom=rs(e.maxZoom),this.minPolarAngle=e.minPolarAngle,this.maxPolarAngle=rs(e.maxPolarAngle),this.minAzimuthAngle=rs(e.minAzimuthAngle),this.maxAzimuthAngle=rs(e.maxAzimuthAngle),this.smoothTime=e.smoothTime,this.draggingSmoothTime=e.draggingSmoothTime,this.dollySpeed=e.dollySpeed,this.truckSpeed=e.truckSpeed,this.dollyToCursor=e.dollyToCursor,this.verticalDragToForward=e.verticalDragToForward,this._target0.fromArray(e.target0),this._position0.fromArray(e.position0),this._zoom0=e.zoom0,this._focalOffset0.fromArray(e.focalOffset0),this.moveTo(e.target[0],e.target[1],e.target[2],t),Gt.setFromVector3(ht.fromArray(e.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(Gt.theta,Gt.phi,t),this.dollyTo(Gt.radius,t),this.zoomTo(e.zoom,t),this.setFocalOffset(e.focalOffset[0],e.focalOffset[1],e.focalOffset[2],t),this._needsUpdate=!0}connect(s){if(this._domElement){console.warn("camera-controls is already connected.");return}s.setAttribute("data-camera-controls-version",Na),this._addAllEventListeners(s),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(s){return s.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(s){return this._getTargetDirection(s).negate()}_findPointerById(s){return this._activePointers.find(t=>t.pointerId===s)}_findPointerByMouseButton(s){return this._activePointers.find(t=>t.mouseButton===s)}_disposePointer(s){this._activePointers.splice(this._activePointers.indexOf(s),1)}_encloseToBoundary(s,t,e){const i=t.lengthSq();if(i===0)return s;const n=pt.copy(t).add(s),o=this._boundary.clampPoint(n,Ge).sub(n),a=o.lengthSq();if(a===0)return s.add(t);if(a===i)return s;if(e===0)return s.add(t).add(o);{const l=1+e*a/t.dot(o);return s.add(pt.copy(t).multiplyScalar(l)).add(o.multiplyScalar(1-e))}}_updateNearPlaneCorners(){if(_e(this._camera)){const s=this._camera,t=s.near,e=s.getEffectiveFOV()*is,i=Math.tan(e*.5)*t,n=i*s.aspect;this._nearPlaneCorners[0].set(-n,-i,0),this._nearPlaneCorners[1].set(n,-i,0),this._nearPlaneCorners[2].set(n,i,0),this._nearPlaneCorners[3].set(-n,i,0)}else if(fe(this._camera)){const s=this._camera,t=1/s.zoom,e=s.left*t,i=s.right*t,n=s.top*t,r=s.bottom*t;this._nearPlaneCorners[0].set(e,n,0),this._nearPlaneCorners[1].set(i,n,0),this._nearPlaneCorners[2].set(i,r,0),this._nearPlaneCorners[3].set(e,r,0)}}_collisionTest(){let s=1/0;if(!(this.colliderMeshes.length>=1)||Hi(this._camera,"_collisionTest"))return s;const e=this._getTargetDirection(os);$i.lookAt(Jn,e,this._camera.up);for(let i=0;i<4;i++){const n=pt.copy(this._nearPlaneCorners[i]);n.applyMatrix4($i);const r=Ge.addVectors(this._target,n);Ys.set(r,e),Ys.far=this._spherical.radius+1;const o=Ys.intersectObjects(this.colliderMeshes);o.length!==0&&o[0].distance<s&&(s=o[0].distance)}return s}_getClientRect(s){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return s.x=t.left,s.y=t.top,this._viewport?(s.x+=this._viewport.x,s.y+=t.height-this._viewport.w-this._viewport.y,s.width=this._viewport.z,s.height=this._viewport.w):(s.width=t.width,s.height=t.height),s}_createOnRestPromise(s){return s?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const e=()=>{this.removeEventListener("rest",e),t()};this.addEventListener("rest",e)}))}_addAllEventListeners(s){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(s){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(s){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(s,t=new ct.Sphere){const e=t,i=e.center;Ye.makeEmpty(),s.traverseVisible(r=>{r.isMesh&&Ye.expandByObject(r)}),Ye.getCenter(i);let n=0;return s.traverseVisible(r=>{if(!r.isMesh)return;const o=r,a=o.geometry.clone();a.applyMatrix4(o.matrixWorld);const h=a.attributes.position;for(let d=0,u=h.count;d<u;d++)ht.fromBufferAttribute(h,d),n=Math.max(n,i.distanceToSquared(ht))}),e.radius=Math.sqrt(n),e}}class We extends Ar{constructor(t){super(t);T(this,"onBeforeUpdate",new Q);T(this,"onAfterUpdate",new Q);T(this,"onAspectUpdated",new Q);T(this,"onDisposed",new Q);T(this,"three");T(this,"_allControls",new Map);T(this,"updateAspect",()=>{var t;if(!(!this.currentWorld||!this.currentWorld.renderer)){if(this.three instanceof x.OrthographicCamera){this.onAspectUpdated.trigger();return}if((t=this.currentWorld.renderer)!=null&&t.isResizeable()){const e=this.currentWorld.renderer.getSize();this.three.aspect=e.width/e.height,this.three.updateProjectionMatrix(),this.onAspectUpdated.trigger()}}});this.three=this.setupCamera(),this.setupEvents(!0),this.onWorldChanged.add(({action:e,world:i})=>{if(e==="added"){const n=this.newCameraControls();this._allControls.set(i.uuid,n)}if(e==="removed"){const n=this._allControls.get(i.uuid);n&&(n.dispose(),this._allControls.delete(i.uuid))}})}get controls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");const t=this._allControls.get(this.currentWorld.uuid);if(!t)throw new Error("Controls not found!");return t}get enabled(){return this.currentWorld===null?!1:this.controls.enabled}set enabled(t){this.currentWorld!==null&&(this.controls.enabled=t)}dispose(){this.setupEvents(!1),this.onAspectUpdated.reset(),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.three.removeFromParent(),this.onDisposed.trigger(),this.onDisposed.reset();for(const[t,e]of this._allControls)e.dispose()}update(t){this.enabled&&(this.onBeforeUpdate.trigger(this),this.controls.update(t),this.onAfterUpdate.trigger(this))}setupCamera(){const t=window.innerWidth/window.innerHeight,e=new x.PerspectiveCamera(60,t,1,1e3);return e.position.set(50,50,50),e.lookAt(new x.Vector3(0,0,0)),e}newCameraControls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");if(!this.currentWorld.renderer)throw new Error("This camera needs a renderer to work!");xt.install({THREE:We.getSubsetOfThree()});const{domElement:t}=this.currentWorld.renderer.three,e=new xt(this.three,t);return e.smoothTime=.2,e.dollyToCursor=!0,e.infinityDolly=!0,e.minDistance=6,e}setupEvents(t){t?window.addEventListener("resize",this.updateAspect):window.removeEventListener("resize",this.updateAspect)}static getSubsetOfThree(){return{MOUSE:x.MOUSE,Vector2:x.Vector2,Vector3:x.Vector3,Vector4:x.Vector4,Quaternion:x.Quaternion,Matrix4:x.Matrix4,Spherical:x.Spherical,Box3:x.Box3,Sphere:x.Sphere,Raycaster:x.Raycaster,MathUtils:x.MathUtils}}}const hi=class hi extends Ft{constructor(t){super(t);T(this,"onAfterUpdate",new Q);T(this,"onBeforeUpdate",new Q);T(this,"onDisposed",new Q);T(this,"onWorldCreated",new Q);T(this,"onWorldDeleted",new Q);T(this,"list",new Map);T(this,"enabled",!0);t.add(hi.uuid,this)}create(){const t=new Sr(this.components),e=t.uuid;if(this.list.has(e))throw new Error("There is already a world with this name!");return this.list.set(e,t),this.onWorldCreated.trigger(t),t}delete(t){if(!this.list.has(t.uuid))throw new Error("The provided world is not found in the list!");const e=t.uuid;this.list.delete(t.uuid),t.dispose(),this.onWorldDeleted.trigger(e)}dispose(){this.enabled=!1;for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger()}update(t){if(this.enabled)for(const[e,i]of this.list)i.update(t)}};T(hi,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let ti=hi;function La(c,s,t,e){return new Promise((i,n)=>{function r(){const o=c.clientWaitSync(s,t,0);if(o===c.WAIT_FAILED){n();return}if(o===c.TIMEOUT_EXPIRED){setTimeout(r,e);return}i()}r()})}async function Ma(c,s,t,e,i,n,r){const o=c.fenceSync(c.SYNC_GPU_COMMANDS_COMPLETE,0);c.flush(),await La(c,o,0,10),c.deleteSync(o),c.bindBuffer(s,t),c.getBufferSubData(s,e,i,n,r),c.bindBuffer(s,null)}async function Tn(c,s,t,e,i,n,r,o){const a=c.createBuffer();return c.bindBuffer(c.PIXEL_PACK_BUFFER,a),c.bufferData(c.PIXEL_PACK_BUFFER,o.byteLength,c.STREAM_READ),c.readPixels(s,t,e,i,n,r,0),c.bindBuffer(c.PIXEL_PACK_BUFFER,null),await Ma(c,c.PIXEL_PACK_BUFFER,a,0,o),c.deleteBuffer(a),o}class Pr{constructor(s,t,e){T(this,"onDisposed",new Q);T(this,"onViewUpdated",new Es);T(this,"enabled",!0);T(this,"needsUpdate",!1);T(this,"renderDebugFrame",!1);T(this,"components");T(this,"world");T(this,"renderer");T(this,"autoUpdate",!0);T(this,"updateInterval",1e3);T(this,"worker");T(this,"scene",new x.Scene);T(this,"_width",512);T(this,"_height",512);T(this,"_availableColor",1);T(this,"renderTarget");T(this,"bufferSize");T(this,"_buffer");T(this,"_isWorkerBusy",!1);T(this,"updateVisibility",async s=>{if(!this.enabled||!this.needsUpdate&&!s||this._isWorkerBusy)return;this._isWorkerBusy=!0;const t=this.world.camera.three;t.updateMatrix(),this.renderer.setSize(this._width,this._height),this.renderer.setRenderTarget(this.renderTarget),this.renderer.render(this.scene,t);const e=this.renderer.getContext();try{await Tn(e,0,0,this._width,this._height,e.RGBA,e.UNSIGNED_BYTE,this._buffer)}catch{this.needsUpdate=!1,this._isWorkerBusy=!1,this.renderer.setRenderTarget(null);return}this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,t),this.worker.postMessage({buffer:this._buffer}),this.needsUpdate=!1});if(!t.renderer)throw new Error("The given world must have a renderer!");this.components=s,this.applySettings(e),this.world=t,this.renderer=new x.WebGLRenderer,this.renderTarget=new x.WebGLRenderTarget(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.renderer.clippingPlanes=t.renderer.clippingPlanes;const i=`
10
+ */const lt={LEFT:1,RIGHT:2,MIDDLE:4},H=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),Ve={NONE:0,IN:1,OUT:-1};function _e(c){return c.isPerspectiveCamera}function fe(c){return c.isOrthographicCamera}const ke=Math.PI*2,Qn=Math.PI/2,Nr=1e-5,is=Math.PI/180;function jt(c,s,t){return Math.max(s,Math.min(t,c))}function Tt(c,s=Nr){return Math.abs(c)<s}function Et(c,s,t=Nr){return Tt(c-s,t)}function qn(c,s){return Math.round(c/s)*s}function ns(c){return isFinite(c)?c:c<0?-Number.MAX_VALUE:Number.MAX_VALUE}function rs(c){return Math.abs(c)<Number.MAX_VALUE?c:c*(1/0)}function ks(c,s,t,e,i=1/0,n){e=Math.max(1e-4,e);const r=2/e,o=r*n,a=1/(1+o+.48*o*o+.235*o*o*o);let l=c-s;const h=s,d=i*e;l=jt(l,-d,d),s=c-l;const u=(t.value+r*l)*n;t.value=(t.value-r*u)*a;let f=s+(l+u)*a;return h-c>0==f>h&&(f=h,t.value=(f-h)/n),f}function Kn(c,s,t,e,i=1/0,n,r){e=Math.max(1e-4,e);const o=2/e,a=o*n,l=1/(1+a+.48*a*a+.235*a*a*a);let h=s.x,d=s.y,u=s.z,f=c.x-h,E=c.y-d,p=c.z-u;const I=h,m=d,C=u,R=i*e,g=R*R,y=f*f+E*E+p*p;if(y>g){const D=Math.sqrt(y);f=f/D*R,E=E/D*R,p=p/D*R}h=c.x-f,d=c.y-E,u=c.z-p;const w=(t.x+o*f)*n,O=(t.y+o*E)*n,M=(t.z+o*p)*n;t.x=(t.x-o*w)*l,t.y=(t.y-o*O)*l,t.z=(t.z-o*M)*l,r.x=h+(f+w)*l,r.y=d+(E+O)*l,r.z=u+(p+M)*l;const b=I-c.x,v=m-c.y,k=C-c.z,F=r.x-I,L=r.y-m,T=r.z-C;return b*F+v*L+k*T>0&&(r.x=I,r.y=m,r.z=C,t.x=(r.x-I)/n,t.y=(r.y-m)/n,t.z=(r.z-C)/n),r}function Yi(c,s){s.set(0,0),c.forEach(t=>{s.x+=t.clientX,s.y+=t.clientY}),s.x/=c.length,s.y/=c.length}function Hi(c,s){return fe(c)?(console.warn(`${s} is not supported in OrthographicCamera`),!0):!1}class Oa{constructor(){this._listeners={}}addEventListener(s,t){const e=this._listeners;e[s]===void 0&&(e[s]=[]),e[s].indexOf(t)===-1&&e[s].push(t)}hasEventListener(s,t){const e=this._listeners;return e[s]!==void 0&&e[s].indexOf(t)!==-1}removeEventListener(s,t){const i=this._listeners[s];if(i!==void 0){const n=i.indexOf(t);n!==-1&&i.splice(n,1)}}removeAllEventListeners(s){if(!s){this._listeners={};return}Array.isArray(this._listeners[s])&&(this._listeners[s].length=0)}dispatchEvent(s){const e=this._listeners[s.type];if(e!==void 0){s.target=this;const i=e.slice(0);for(let n=0,r=i.length;n<r;n++)i[n].call(this,s)}}}const Na="2.7.3",Gs=1/8,br=typeof window<"u",ba=br&&/Mac/.test(navigator.platform),Pa=!(br&&"PointerEvent"in window);let ct,Jn,Ys,Wi,Ut,ht,pt,Ge,os,te,ee,Ae,tr,er,Gt,as,Ye,sr,Xi,ir,Zi,$i,Hs;class xt extends Oa{static install(s){ct=s.THREE,Jn=Object.freeze(new ct.Vector3(0,0,0)),Ys=Object.freeze(new ct.Vector3(0,1,0)),Wi=Object.freeze(new ct.Vector3(0,0,1)),Ut=new ct.Vector2,ht=new ct.Vector3,pt=new ct.Vector3,Ge=new ct.Vector3,os=new ct.Vector3,te=new ct.Vector3,ee=new ct.Vector3,Ae=new ct.Vector3,tr=new ct.Vector3,er=new ct.Vector3,Gt=new ct.Spherical,as=new ct.Spherical,Ye=new ct.Box3,sr=new ct.Box3,Xi=new ct.Sphere,ir=new ct.Quaternion,Zi=new ct.Quaternion,$i=new ct.Matrix4,Hs=new ct.Raycaster}static get ACTION(){return H}constructor(s,t){super(),this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minDistance=Number.EPSILON,this.maxDistance=1/0,this.infinityDolly=!1,this.minZoom=.01,this.maxZoom=1/0,this.smoothTime=.25,this.draggingSmoothTime=.125,this.maxSpeed=1/0,this.azimuthRotateSpeed=1,this.polarRotateSpeed=1,this.dollySpeed=1,this.dollyDragInverted=!1,this.truckSpeed=2,this.dollyToCursor=!1,this.dragToOffset=!1,this.verticalDragToForward=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=H.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=Ve.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new ct.Vector3,this._focalOffsetVelocity=new ct.Vector3,this._zoomVelocity={value:0},this._truckInternal=(g,y,w)=>{let O,M;if(_e(this._camera)){const b=ht.copy(this._camera.position).sub(this._target),v=this._camera.getEffectiveFOV()*is,k=b.length()*Math.tan(v*.5);O=this.truckSpeed*g*k/this._elementRect.height,M=this.truckSpeed*y*k/this._elementRect.height}else if(fe(this._camera)){const b=this._camera;O=g*(b.right-b.left)/b.zoom/this._elementRect.width,M=y*(b.top-b.bottom)/b.zoom/this._elementRect.height}else return;this.verticalDragToForward?(w?this.setFocalOffset(this._focalOffsetEnd.x+O,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(O,0,!0),this.forward(-M,!0)):w?this.setFocalOffset(this._focalOffsetEnd.x+O,this._focalOffsetEnd.y+M,this._focalOffsetEnd.z,!0):this.truck(O,M,!0)},this._rotateInternal=(g,y)=>{const w=ke*this.azimuthRotateSpeed*g/this._elementRect.height,O=ke*this.polarRotateSpeed*y/this._elementRect.height;this.rotate(w,O,!0)},this._dollyInternal=(g,y,w)=>{const O=Math.pow(.95,-g*this.dollySpeed),M=this._sphericalEnd.radius,b=this._sphericalEnd.radius*O,v=jt(b,this.minDistance,this.maxDistance),k=v-b;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(b,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(k,!0),this._dollyToNoClamp(v,!0)):this._dollyToNoClamp(v,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?b:v)-M,this._dollyControlCoord.set(y,w)),this._lastDollyDirection=Math.sign(-g)},this._zoomInternal=(g,y,w)=>{const O=Math.pow(.95,g*this.dollySpeed),M=this._zoom,b=this._zoom*O;this.zoomTo(b,!0),this.dollyToCursor&&(this._changedZoom+=b-M,this._dollyControlCoord.set(y,w))},typeof ct>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=s,this._yAxisUpSpace=new ct.Quaternion().setFromUnitVectors(this._camera.up,Ys),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=H.NONE,this._target=new ct.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new ct.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new ct.Spherical().setFromVector3(ht.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new ct.Vector3,new ct.Vector3,new ct.Vector3,new ct.Vector3],this._updateNearPlaneCorners(),this._boundary=new ct.Box3(new ct.Vector3(-1/0,-1/0,-1/0),new ct.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new ct.Vector2,this.mouseButtons={left:H.ROTATE,middle:H.DOLLY,right:H.TRUCK,wheel:_e(this._camera)?H.DOLLY:fe(this._camera)?H.ZOOM:H.NONE},this.touches={one:H.TOUCH_ROTATE,two:_e(this._camera)?H.TOUCH_DOLLY_TRUCK:fe(this._camera)?H.TOUCH_ZOOM_TRUCK:H.NONE,three:H.TOUCH_TRUCK};const e=new ct.Vector2,i=new ct.Vector2,n=new ct.Vector2,r=g=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const O=this._domElement.getBoundingClientRect(),M=g.clientX/O.width,b=g.clientY/O.height;if(M<this._interactiveArea.left||M>this._interactiveArea.right||b<this._interactiveArea.top||b>this._interactiveArea.bottom)return}const y=g.pointerType!=="mouse"?null:(g.buttons&lt.LEFT)===lt.LEFT?lt.LEFT:(g.buttons&lt.MIDDLE)===lt.MIDDLE?lt.MIDDLE:(g.buttons&lt.RIGHT)===lt.RIGHT?lt.RIGHT:null;if(y!==null){const O=this._findPointerByMouseButton(y);O&&this._disposePointer(O)}if((g.buttons&lt.LEFT)===lt.LEFT&&this._lockedPointer)return;const w={pointerId:g.pointerId,clientX:g.clientX,clientY:g.clientY,deltaX:0,deltaY:0,mouseButton:y};this._activePointers.push(w),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",h),this._isDragging=!0,p(g)},o=g=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const O=this._domElement.getBoundingClientRect(),M=g.clientX/O.width,b=g.clientY/O.height;if(M<this._interactiveArea.left||M>this._interactiveArea.right||b<this._interactiveArea.top||b>this._interactiveArea.bottom)return}const y=(g.buttons&lt.LEFT)===lt.LEFT?lt.LEFT:(g.buttons&lt.MIDDLE)===lt.MIDDLE?lt.MIDDLE:(g.buttons&lt.RIGHT)===lt.RIGHT?lt.RIGHT:null;if(y!==null){const O=this._findPointerByMouseButton(y);O&&this._disposePointer(O)}const w={pointerId:1,clientX:g.clientX,clientY:g.clientY,deltaX:0,deltaY:0,mouseButton:(g.buttons&lt.LEFT)===lt.LEFT?lt.LEFT:(g.buttons&lt.MIDDLE)===lt.LEFT?lt.MIDDLE:(g.buttons&lt.RIGHT)===lt.LEFT?lt.RIGHT:null};this._activePointers.push(w),this._domElement.ownerDocument.removeEventListener("mousemove",l),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.addEventListener("mousemove",l),this._domElement.ownerDocument.addEventListener("mouseup",d),this._isDragging=!0,p(g)},a=g=>{g.cancelable&&g.preventDefault();const y=g.pointerId,w=this._lockedPointer||this._findPointerById(y);if(w){if(w.clientX=g.clientX,w.clientY=g.clientY,w.deltaX=g.movementX,w.deltaY=g.movementY,this._state=0,g.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(g.buttons&lt.LEFT)===lt.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(g.buttons&lt.MIDDLE)===lt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(g.buttons&lt.RIGHT)===lt.RIGHT&&(this._state=this._state|this.mouseButtons.right);I()}},l=g=>{const y=this._lockedPointer||this._findPointerById(1);y&&(y.clientX=g.clientX,y.clientY=g.clientY,y.deltaX=g.movementX,y.deltaY=g.movementY,this._state=0,(this._lockedPointer||(g.buttons&lt.LEFT)===lt.LEFT)&&(this._state=this._state|this.mouseButtons.left),(g.buttons&lt.MIDDLE)===lt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(g.buttons&lt.RIGHT)===lt.RIGHT&&(this._state=this._state|this.mouseButtons.right),I())},h=g=>{const y=this._findPointerById(g.pointerId);if(!(y&&y===this._lockedPointer)){if(y&&this._disposePointer(y),g.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=H.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=H.NONE;m()}},d=()=>{const g=this._findPointerById(1);g&&g===this._lockedPointer||(g&&this._disposePointer(g),this._state=H.NONE,m())};let u=-1;const f=g=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===H.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const b=this._domElement.getBoundingClientRect(),v=g.clientX/b.width,k=g.clientY/b.height;if(v<this._interactiveArea.left||v>this._interactiveArea.right||k<this._interactiveArea.top||k>this._interactiveArea.bottom)return}if(g.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===H.ROTATE||this.mouseButtons.wheel===H.TRUCK){const b=performance.now();u-b<1e3&&this._getClientRect(this._elementRect),u=b}const y=ba?-1:-3,w=g.deltaMode===1?g.deltaY/y:g.deltaY/(y*10),O=this.dollyToCursor?(g.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,M=this.dollyToCursor?(g.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case H.ROTATE:{this._rotateInternal(g.deltaX,g.deltaY),this._isUserControllingRotate=!0;break}case H.TRUCK:{this._truckInternal(g.deltaX,g.deltaY,!1),this._isUserControllingTruck=!0;break}case H.OFFSET:{this._truckInternal(g.deltaX,g.deltaY,!0),this._isUserControllingOffset=!0;break}case H.DOLLY:{this._dollyInternal(-w,O,M),this._isUserControllingDolly=!0;break}case H.ZOOM:{this._zoomInternal(-w,O,M),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},E=g=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===xt.ACTION.NONE){const y=g instanceof PointerEvent?g.pointerId:(g instanceof MouseEvent,0),w=this._findPointerById(y);w&&this._disposePointer(w),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mousemove",l),this._domElement.ownerDocument.removeEventListener("mouseup",d);return}g.preventDefault()}},p=g=>{if(!this._enabled)return;if(Yi(this._activePointers,Ut),this._getClientRect(this._elementRect),e.copy(Ut),i.copy(Ut),this._activePointers.length>=2){const w=Ut.x-this._activePointers[1].clientX,O=Ut.y-this._activePointers[1].clientY,M=Math.sqrt(w*w+O*O);n.set(0,M);const b=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,v=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;i.set(b,v)}if(this._state=0,!g)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in g&&g.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(g.buttons&lt.LEFT)===lt.LEFT&&(this._state=this._state|this.mouseButtons.left),(g.buttons&lt.MIDDLE)===lt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(g.buttons&lt.RIGHT)===lt.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&H.ROTATE)===H.ROTATE||(this._state&H.TOUCH_ROTATE)===H.TOUCH_ROTATE||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_ZOOM_ROTATE)===H.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&H.TRUCK)===H.TRUCK||(this._state&H.TOUCH_TRUCK)===H.TOUCH_TRUCK||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&H.DOLLY)===H.DOLLY||(this._state&H.TOUCH_DOLLY)===H.TOUCH_DOLLY||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&H.ZOOM)===H.ZOOM||(this._state&H.TOUCH_ZOOM)===H.TOUCH_ZOOM||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET||(this._state&H.TOUCH_ZOOM_ROTATE)===H.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&H.OFFSET)===H.OFFSET||(this._state&H.TOUCH_OFFSET)===H.TOUCH_OFFSET||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},I=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,Yi(this._activePointers,Ut);const y=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,w=y?-y.deltaX:i.x-Ut.x,O=y?-y.deltaY:i.y-Ut.y;if(i.copy(Ut),((this._state&H.ROTATE)===H.ROTATE||(this._state&H.TOUCH_ROTATE)===H.TOUCH_ROTATE||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_ZOOM_ROTATE)===H.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(w,O),this._isUserControllingRotate=!0),(this._state&H.DOLLY)===H.DOLLY||(this._state&H.ZOOM)===H.ZOOM){const M=this.dollyToCursor?(e.x-this._elementRect.x)/this._elementRect.width*2-1:0,b=this.dollyToCursor?(e.y-this._elementRect.y)/this._elementRect.height*-2+1:0,v=this.dollyDragInverted?-1:1;(this._state&H.DOLLY)===H.DOLLY?(this._dollyInternal(v*O*Gs,M,b),this._isUserControllingDolly=!0):(this._zoomInternal(v*O*Gs,M,b),this._isUserControllingZoom=!0)}if((this._state&H.TOUCH_DOLLY)===H.TOUCH_DOLLY||(this._state&H.TOUCH_ZOOM)===H.TOUCH_ZOOM||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_ZOOM_ROTATE)===H.TOUCH_ZOOM_ROTATE){const M=Ut.x-this._activePointers[1].clientX,b=Ut.y-this._activePointers[1].clientY,v=Math.sqrt(M*M+b*b),k=n.y-v;n.set(0,v);const F=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,L=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&H.TOUCH_DOLLY)===H.TOUCH_DOLLY||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET?(this._dollyInternal(k*Gs,F,L),this._isUserControllingDolly=!0):(this._zoomInternal(k*Gs,F,L),this._isUserControllingZoom=!0)}((this._state&H.TRUCK)===H.TRUCK||(this._state&H.TOUCH_TRUCK)===H.TOUCH_TRUCK||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(w,O,!1),this._isUserControllingTruck=!0),((this._state&H.OFFSET)===H.OFFSET||(this._state&H.TOUCH_OFFSET)===H.TOUCH_OFFSET||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(w,O,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},m=()=>{Yi(this._activePointers,Ut),i.copy(Ut),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",l),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mouseup",d),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",C),this._domElement.ownerDocument.addEventListener("pointerlockerror",R),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",h),p())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",C),this._domElement.ownerDocument.removeEventListener("pointerlockerror",R))};const C=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},R=()=>{this.unlockPointer()};this._addAllEventListeners=g=>{this._domElement=g,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",r),Pa&&this._domElement.addEventListener("mousedown",o),this._domElement.addEventListener("pointercancel",h),this._domElement.addEventListener("wheel",f,{passive:!1}),this._domElement.addEventListener("contextmenu",E)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",r),this._domElement.removeEventListener("mousedown",o),this._domElement.removeEventListener("pointercancel",h),this._domElement.removeEventListener("wheel",f,{passive:!1}),this._domElement.removeEventListener("contextmenu",E),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",l),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.removeEventListener("pointerlockchange",C),this._domElement.ownerDocument.removeEventListener("pointerlockerror",R))},this.cancel=()=>{this._state!==H.NONE&&(this._state=H.NONE,this._activePointers.length=0,m())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(s){this._camera=s,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(s){this._enabled=s,this._domElement&&(s?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(s){this._spherical.radius===s&&this._sphericalEnd.radius===s||(this._spherical.radius=s,this._sphericalEnd.radius=s,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(s){this._spherical.theta===s&&this._sphericalEnd.theta===s||(this._spherical.theta=s,this._sphericalEnd.theta=s,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(s){this._spherical.phi===s&&this._sphericalEnd.phi===s||(this._spherical.phi=s,this._sphericalEnd.phi=s,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(s){this._boundaryEnclosesCamera=s,this._needsUpdate=!0}set interactiveArea(s){this._interactiveArea.width=jt(s.width,0,1),this._interactiveArea.height=jt(s.height,0,1),this._interactiveArea.x=jt(s.x,0,1-this._interactiveArea.width),this._interactiveArea.y=jt(s.y,0,1-this._interactiveArea.height)}addEventListener(s,t){super.addEventListener(s,t)}removeEventListener(s,t){super.removeEventListener(s,t)}rotate(s,t,e=!1){return this.rotateTo(this._sphericalEnd.theta+s,this._sphericalEnd.phi+t,e)}rotateAzimuthTo(s,t=!1){return this.rotateTo(s,this._sphericalEnd.phi,t)}rotatePolarTo(s,t=!1){return this.rotateTo(this._sphericalEnd.theta,s,t)}rotateTo(s,t,e=!1){this._isUserControllingRotate=!1;const i=jt(s,this.minAzimuthAngle,this.maxAzimuthAngle),n=jt(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=n,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,e||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const r=!e||Et(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Et(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(r)}dolly(s,t=!1){return this.dollyTo(this._sphericalEnd.radius-s,t)}dollyTo(s,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Ve.NONE,this._changedDolly=0,this._dollyToNoClamp(jt(s,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(s,t=!1){const e=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const r=this._collisionTest(),o=Et(r,this._spherical.radius);if(!(e>s)&&o)return Promise.resolve();this._sphericalEnd.radius=Math.min(s,r)}else this._sphericalEnd.radius=s;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const n=!t||Et(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(n)}dollyInFixed(s,t=!1){this._targetEnd.add(this._getCameraDirection(os).multiplyScalar(s)),t||this._target.copy(this._targetEnd);const e=!t||Et(this._target.x,this._targetEnd.x,this.restThreshold)&&Et(this._target.y,this._targetEnd.y,this.restThreshold)&&Et(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(e)}zoom(s,t=!1){return this.zoomTo(this._zoomEnd+s,t)}zoomTo(s,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=jt(s,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const e=!t||Et(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(e)}pan(s,t,e=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(s,t,e)}truck(s,t,e=!1){this._camera.updateMatrix(),te.setFromMatrixColumn(this._camera.matrix,0),ee.setFromMatrixColumn(this._camera.matrix,1),te.multiplyScalar(s),ee.multiplyScalar(-t);const i=ht.copy(te).add(ee),n=pt.copy(this._targetEnd).add(i);return this.moveTo(n.x,n.y,n.z,e)}forward(s,t=!1){ht.setFromMatrixColumn(this._camera.matrix,0),ht.crossVectors(this._camera.up,ht),ht.multiplyScalar(s);const e=pt.copy(this._targetEnd).add(ht);return this.moveTo(e.x,e.y,e.z,t)}elevate(s,t=!1){return ht.copy(this._camera.up).multiplyScalar(s),this.moveTo(this._targetEnd.x+ht.x,this._targetEnd.y+ht.y,this._targetEnd.z+ht.z,t)}moveTo(s,t,e,i=!1){this._isUserControllingTruck=!1;const n=ht.set(s,t,e).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,n,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);const r=!i||Et(this._target.x,this._targetEnd.x,this.restThreshold)&&Et(this._target.y,this._targetEnd.y,this.restThreshold)&&Et(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}lookInDirectionOf(s,t,e,i=!1){const o=ht.set(s,t,e).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(o.x,o.y,o.z,i)}fitToBox(s,t,{cover:e=!1,paddingLeft:i=0,paddingRight:n=0,paddingBottom:r=0,paddingTop:o=0}={}){const a=[],l=s.isBox3?Ye.copy(s):Ye.setFromObject(s);l.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const h=qn(this._sphericalEnd.theta,Qn),d=qn(this._sphericalEnd.phi,Qn);a.push(this.rotateTo(h,d,t));const u=ht.setFromSpherical(this._sphericalEnd).normalize(),f=ir.setFromUnitVectors(u,Wi),E=Et(Math.abs(u.y),1);E&&f.multiply(Zi.setFromAxisAngle(Ys,h)),f.multiply(this._yAxisUpSpaceInverse);const p=sr.makeEmpty();pt.copy(l.min).applyQuaternion(f),p.expandByPoint(pt),pt.copy(l.min).setX(l.max.x).applyQuaternion(f),p.expandByPoint(pt),pt.copy(l.min).setY(l.max.y).applyQuaternion(f),p.expandByPoint(pt),pt.copy(l.max).setZ(l.min.z).applyQuaternion(f),p.expandByPoint(pt),pt.copy(l.min).setZ(l.max.z).applyQuaternion(f),p.expandByPoint(pt),pt.copy(l.max).setY(l.min.y).applyQuaternion(f),p.expandByPoint(pt),pt.copy(l.max).setX(l.min.x).applyQuaternion(f),p.expandByPoint(pt),pt.copy(l.max).applyQuaternion(f),p.expandByPoint(pt),p.min.x-=i,p.min.y-=r,p.max.x+=n,p.max.y+=o,f.setFromUnitVectors(Wi,u),E&&f.premultiply(Zi.invert()),f.premultiply(this._yAxisUpSpace);const I=p.getSize(ht),m=p.getCenter(pt).applyQuaternion(f);if(_e(this._camera)){const C=this.getDistanceToFitBox(I.x,I.y,I.z,e);a.push(this.moveTo(m.x,m.y,m.z,t)),a.push(this.dollyTo(C,t)),a.push(this.setFocalOffset(0,0,0,t))}else if(fe(this._camera)){const C=this._camera,R=C.right-C.left,g=C.top-C.bottom,y=e?Math.max(R/I.x,g/I.y):Math.min(R/I.x,g/I.y);a.push(this.moveTo(m.x,m.y,m.z,t)),a.push(this.zoomTo(y,t)),a.push(this.setFocalOffset(0,0,0,t))}return Promise.all(a)}fitToSphere(s,t){const e=[],n=s instanceof ct.Sphere?Xi.copy(s):xt.createBoundingSphere(s,Xi);if(e.push(this.moveTo(n.center.x,n.center.y,n.center.z,t)),_e(this._camera)){const r=this.getDistanceToFitSphere(n.radius);e.push(this.dollyTo(r,t))}else if(fe(this._camera)){const r=this._camera.right-this._camera.left,o=this._camera.top-this._camera.bottom,a=2*n.radius,l=Math.min(r/a,o/a);e.push(this.zoomTo(l,t))}return e.push(this.setFocalOffset(0,0,0,t)),Promise.all(e)}setLookAt(s,t,e,i,n,r,o=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Ve.NONE,this._changedDolly=0;const a=pt.set(i,n,r),l=ht.set(s,t,e);this._targetEnd.copy(a),this._sphericalEnd.setFromVector3(l.sub(a).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,o||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const h=!o||Et(this._target.x,this._targetEnd.x,this.restThreshold)&&Et(this._target.y,this._targetEnd.y,this.restThreshold)&&Et(this._target.z,this._targetEnd.z,this.restThreshold)&&Et(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Et(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Et(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(h)}lerpLookAt(s,t,e,i,n,r,o,a,l,h,d,u,f,E=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Ve.NONE,this._changedDolly=0;const p=ht.set(i,n,r),I=pt.set(s,t,e);Gt.setFromVector3(I.sub(p).applyQuaternion(this._yAxisUpSpace));const m=Ge.set(h,d,u),C=pt.set(o,a,l);as.setFromVector3(C.sub(m).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(p.lerp(m,f));const R=as.theta-Gt.theta,g=as.phi-Gt.phi,y=as.radius-Gt.radius;this._sphericalEnd.set(Gt.radius+y*f,Gt.phi+g*f,Gt.theta+R*f),this.normalizeRotations(),this._needsUpdate=!0,E||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const w=!E||Et(this._target.x,this._targetEnd.x,this.restThreshold)&&Et(this._target.y,this._targetEnd.y,this.restThreshold)&&Et(this._target.z,this._targetEnd.z,this.restThreshold)&&Et(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Et(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Et(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(w)}setPosition(s,t,e,i=!1){return this.setLookAt(s,t,e,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}setTarget(s,t,e,i=!1){const n=this.getPosition(ht),r=this.setLookAt(n.x,n.y,n.z,s,t,e,i);return this._sphericalEnd.phi=jt(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),r}setFocalOffset(s,t,e,i=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(s,t,e),this._needsUpdate=!0,i||this._focalOffset.copy(this._focalOffsetEnd);const n=!i||Et(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&Et(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&Et(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}setOrbitPoint(s,t,e){this._camera.updateMatrixWorld(),te.setFromMatrixColumn(this._camera.matrixWorldInverse,0),ee.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Ae.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const i=ht.set(s,t,e),n=i.distanceTo(this._camera.position),r=i.sub(this._camera.position);te.multiplyScalar(r.x),ee.multiplyScalar(r.y),Ae.multiplyScalar(r.z),ht.copy(te).add(ee).add(Ae),ht.z=ht.z+n,this.dollyTo(n,!1),this.setFocalOffset(-ht.x,ht.y,-ht.z,!1),this.moveTo(s,t,e,!1)}setBoundary(s){if(!s){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(s),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(s,t,e,i){if(s===null){this._viewport=null;return}this._viewport=this._viewport||new ct.Vector4,typeof s=="number"?this._viewport.set(s,t,e,i):this._viewport.copy(s)}getDistanceToFitBox(s,t,e,i=!1){if(Hi(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const n=s/t,r=this._camera.getEffectiveFOV()*is,o=this._camera.aspect;return((i?n>o:n<o)?t:s/o)*.5/Math.tan(r*.5)+e*.5}getDistanceToFitSphere(s){if(Hi(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*is,e=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,i=1<this._camera.aspect?t:e;return s/Math.sin(i*.5)}getTarget(s,t=!0){return(s&&s.isVector3?s:new ct.Vector3).copy(t?this._targetEnd:this._target)}getPosition(s,t=!0){return(s&&s.isVector3?s:new ct.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(s,t=!0){return(s&&s instanceof ct.Spherical?s:new ct.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(s,t=!0){return(s&&s.isVector3?s:new ct.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%ke,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=ke),this._spherical.theta+=ke*Math.round((this._sphericalEnd.theta-this._spherical.theta)/ke)}reset(s=!1){if(!Et(this._camera.up.x,this._cameraUp0.x)||!Et(this._camera.up.y,this._cameraUp0.y)||!Et(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const e=this.getPosition(ht);this.updateCameraUp(),this.setPosition(e.x,e.y,e.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,s),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,s),this.zoomTo(this._zoom0,s)];return Promise.all(t)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,Ys),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const s=ht.subVectors(this._target,this._camera.position).normalize(),t=pt.crossVectors(s,this._camera.up);this._camera.up.crossVectors(t,s).normalize(),this._camera.updateMatrixWorld();const e=this.getPosition(ht);this.updateCameraUp(),this.setPosition(e.x,e.y,e.z)}update(s){const t=this._sphericalEnd.theta-this._spherical.theta,e=this._sphericalEnd.phi-this._spherical.phi,i=this._sphericalEnd.radius-this._spherical.radius,n=tr.subVectors(this._targetEnd,this._target),r=er.subVectors(this._focalOffsetEnd,this._focalOffset),o=this._zoomEnd-this._zoom;if(Tt(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=ks(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,d,1/0,s),this._needsUpdate=!0}if(Tt(e))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=ks(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,d,1/0,s),this._needsUpdate=!0}if(Tt(i))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const d=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=ks(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,d,this.maxSpeed,s),this._needsUpdate=!0}if(Tt(n.x)&&Tt(n.y)&&Tt(n.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const d=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;Kn(this._target,this._targetEnd,this._targetVelocity,d,this.maxSpeed,s,this._target),this._needsUpdate=!0}if(Tt(r.x)&&Tt(r.y)&&Tt(r.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const d=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;Kn(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,d,this.maxSpeed,s,this._focalOffset),this._needsUpdate=!0}if(Tt(o))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const d=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=ks(this._zoom,this._zoomEnd,this._zoomVelocity,d,1/0,s)}if(this.dollyToCursor){if(_e(this._camera)&&this._changedDolly!==0){const d=this._spherical.radius-this._lastDistance,u=this._camera,f=this._getCameraDirection(os),E=ht.copy(f).cross(u.up).normalize();E.lengthSq()===0&&(E.x=1);const p=pt.crossVectors(E,f),I=this._sphericalEnd.radius*Math.tan(u.getEffectiveFOV()*is*.5),C=(this._sphericalEnd.radius-d-this._sphericalEnd.radius)/this._sphericalEnd.radius,R=Ge.copy(this._targetEnd).add(E.multiplyScalar(this._dollyControlCoord.x*I*u.aspect)).add(p.multiplyScalar(this._dollyControlCoord.y*I)),g=ht.copy(this._targetEnd).lerp(R,C),y=this._lastDollyDirection===Ve.IN&&this._spherical.radius<=this.minDistance,w=this._lastDollyDirection===Ve.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(y||w)){this._sphericalEnd.radius-=d,this._spherical.radius-=d;const M=pt.copy(f).multiplyScalar(-d);g.add(M)}this._boundary.clampPoint(g,g);const O=pt.subVectors(g,this._targetEnd);this._targetEnd.copy(g),this._target.add(O),this._changedDolly-=d,Tt(this._changedDolly)&&(this._changedDolly=0)}else if(fe(this._camera)&&this._changedZoom!==0){const d=this._zoom-this._lastZoom,u=this._camera,f=ht.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(u.near+u.far)/(u.near-u.far)).unproject(u),E=pt.set(0,0,-1).applyQuaternion(u.quaternion),p=Ge.copy(f).add(E.multiplyScalar(-f.dot(u.up))),m=-(this._zoom-d-this._zoom)/this._zoom,C=this._getCameraDirection(os),R=this._targetEnd.dot(C),g=ht.copy(this._targetEnd).lerp(p,m),y=g.dot(C),w=C.multiplyScalar(y-R);g.sub(w),this._boundary.clampPoint(g,g);const O=pt.subVectors(g,this._targetEnd);this._targetEnd.copy(g),this._target.add(O),this._changedZoom-=d,Tt(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const a=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,a),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!Tt(this._focalOffset.x)||!Tt(this._focalOffset.y)||!Tt(this._focalOffset.z))&&(this._camera.updateMatrixWorld(),te.setFromMatrixColumn(this._camera.matrix,0),ee.setFromMatrixColumn(this._camera.matrix,1),Ae.setFromMatrixColumn(this._camera.matrix,2),te.multiplyScalar(this._focalOffset.x),ee.multiplyScalar(-this._focalOffset.y),Ae.multiplyScalar(this._focalOffset.z),ht.copy(te).add(ee).add(Ae),this._camera.position.add(ht)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),ht.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const h=this._needsUpdate;return h&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):h?(this.dispatchEvent({type:"update"}),Tt(t,this.restThreshold)&&Tt(e,this.restThreshold)&&Tt(i,this.restThreshold)&&Tt(n.x,this.restThreshold)&&Tt(n.y,this.restThreshold)&&Tt(n.z,this.restThreshold)&&Tt(r.x,this.restThreshold)&&Tt(r.y,this.restThreshold)&&Tt(r.z,this.restThreshold)&&Tt(o,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!h&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=h,this._needsUpdate=!1,h}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:ns(this.maxDistance),minZoom:this.minZoom,maxZoom:ns(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:ns(this.maxPolarAngle),minAzimuthAngle:ns(this.minAzimuthAngle),maxAzimuthAngle:ns(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,verticalDragToForward:this.verticalDragToForward,target:this._targetEnd.toArray(),position:ht.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(s,t=!1){const e=JSON.parse(s);this.enabled=e.enabled,this.minDistance=e.minDistance,this.maxDistance=rs(e.maxDistance),this.minZoom=e.minZoom,this.maxZoom=rs(e.maxZoom),this.minPolarAngle=e.minPolarAngle,this.maxPolarAngle=rs(e.maxPolarAngle),this.minAzimuthAngle=rs(e.minAzimuthAngle),this.maxAzimuthAngle=rs(e.maxAzimuthAngle),this.smoothTime=e.smoothTime,this.draggingSmoothTime=e.draggingSmoothTime,this.dollySpeed=e.dollySpeed,this.truckSpeed=e.truckSpeed,this.dollyToCursor=e.dollyToCursor,this.verticalDragToForward=e.verticalDragToForward,this._target0.fromArray(e.target0),this._position0.fromArray(e.position0),this._zoom0=e.zoom0,this._focalOffset0.fromArray(e.focalOffset0),this.moveTo(e.target[0],e.target[1],e.target[2],t),Gt.setFromVector3(ht.fromArray(e.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(Gt.theta,Gt.phi,t),this.dollyTo(Gt.radius,t),this.zoomTo(e.zoom,t),this.setFocalOffset(e.focalOffset[0],e.focalOffset[1],e.focalOffset[2],t),this._needsUpdate=!0}connect(s){if(this._domElement){console.warn("camera-controls is already connected.");return}s.setAttribute("data-camera-controls-version",Na),this._addAllEventListeners(s),this._getClientRect(this._elementRect)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(s){return s.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(s){return this._getTargetDirection(s).negate()}_findPointerById(s){return this._activePointers.find(t=>t.pointerId===s)}_findPointerByMouseButton(s){return this._activePointers.find(t=>t.mouseButton===s)}_disposePointer(s){this._activePointers.splice(this._activePointers.indexOf(s),1)}_encloseToBoundary(s,t,e){const i=t.lengthSq();if(i===0)return s;const n=pt.copy(t).add(s),o=this._boundary.clampPoint(n,Ge).sub(n),a=o.lengthSq();if(a===0)return s.add(t);if(a===i)return s;if(e===0)return s.add(t).add(o);{const l=1+e*a/t.dot(o);return s.add(pt.copy(t).multiplyScalar(l)).add(o.multiplyScalar(1-e))}}_updateNearPlaneCorners(){if(_e(this._camera)){const s=this._camera,t=s.near,e=s.getEffectiveFOV()*is,i=Math.tan(e*.5)*t,n=i*s.aspect;this._nearPlaneCorners[0].set(-n,-i,0),this._nearPlaneCorners[1].set(n,-i,0),this._nearPlaneCorners[2].set(n,i,0),this._nearPlaneCorners[3].set(-n,i,0)}else if(fe(this._camera)){const s=this._camera,t=1/s.zoom,e=s.left*t,i=s.right*t,n=s.top*t,r=s.bottom*t;this._nearPlaneCorners[0].set(e,n,0),this._nearPlaneCorners[1].set(i,n,0),this._nearPlaneCorners[2].set(i,r,0),this._nearPlaneCorners[3].set(e,r,0)}}_collisionTest(){let s=1/0;if(!(this.colliderMeshes.length>=1)||Hi(this._camera,"_collisionTest"))return s;const e=this._getTargetDirection(os);$i.lookAt(Jn,e,this._camera.up);for(let i=0;i<4;i++){const n=pt.copy(this._nearPlaneCorners[i]);n.applyMatrix4($i);const r=Ge.addVectors(this._target,n);Hs.set(r,e),Hs.far=this._spherical.radius+1;const o=Hs.intersectObjects(this.colliderMeshes);o.length!==0&&o[0].distance<s&&(s=o[0].distance)}return s}_getClientRect(s){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return s.x=t.left,s.y=t.top,this._viewport?(s.x+=this._viewport.x,s.y+=t.height-this._viewport.w-this._viewport.y,s.width=this._viewport.z,s.height=this._viewport.w):(s.width=t.width,s.height=t.height),s}_createOnRestPromise(s){return s?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const e=()=>{this.removeEventListener("rest",e),t()};this.addEventListener("rest",e)}))}_addAllEventListeners(s){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(s){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(s){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(s,t=new ct.Sphere){const e=t,i=e.center;Ye.makeEmpty(),s.traverseVisible(r=>{r.isMesh&&Ye.expandByObject(r)}),Ye.getCenter(i);let n=0;return s.traverseVisible(r=>{if(!r.isMesh)return;const o=r,a=o.geometry.clone();a.applyMatrix4(o.matrixWorld);const h=a.attributes.position;for(let d=0,u=h.count;d<u;d++)ht.fromBufferAttribute(h,d),n=Math.max(n,i.distanceToSquared(ht))}),e.radius=Math.sqrt(n),e}}class We extends Ar{constructor(t){super(t);_(this,"onBeforeUpdate",new Q);_(this,"onAfterUpdate",new Q);_(this,"onAspectUpdated",new Q);_(this,"onDisposed",new Q);_(this,"three");_(this,"_allControls",new Map);_(this,"updateAspect",()=>{var t;if(!(!this.currentWorld||!this.currentWorld.renderer)){if(this.three instanceof x.OrthographicCamera){this.onAspectUpdated.trigger();return}if((t=this.currentWorld.renderer)!=null&&t.isResizeable()){const e=this.currentWorld.renderer.getSize();this.three.aspect=e.width/e.height,this.three.updateProjectionMatrix(),this.onAspectUpdated.trigger()}}});this.three=this.setupCamera(),this.setupEvents(!0),this.onWorldChanged.add(({action:e,world:i})=>{if(e==="added"){const n=this.newCameraControls();this._allControls.set(i.uuid,n)}if(e==="removed"){const n=this._allControls.get(i.uuid);n&&(n.dispose(),this._allControls.delete(i.uuid))}})}get controls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");const t=this._allControls.get(this.currentWorld.uuid);if(!t)throw new Error("Controls not found!");return t}get enabled(){return this.currentWorld===null?!1:this.controls.enabled}set enabled(t){this.currentWorld!==null&&(this.controls.enabled=t)}dispose(){this.setupEvents(!1),this.onAspectUpdated.reset(),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.three.removeFromParent(),this.onDisposed.trigger(),this.onDisposed.reset();for(const[t,e]of this._allControls)e.dispose()}update(t){this.enabled&&(this.onBeforeUpdate.trigger(this),this.controls.update(t),this.onAfterUpdate.trigger(this))}setupCamera(){const t=window.innerWidth/window.innerHeight,e=new x.PerspectiveCamera(60,t,1,1e3);return e.position.set(50,50,50),e.lookAt(new x.Vector3(0,0,0)),e}newCameraControls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");if(!this.currentWorld.renderer)throw new Error("This camera needs a renderer to work!");xt.install({THREE:We.getSubsetOfThree()});const{domElement:t}=this.currentWorld.renderer.three,e=new xt(this.three,t);return e.smoothTime=.2,e.dollyToCursor=!0,e.infinityDolly=!0,e.minDistance=6,e}setupEvents(t){t?window.addEventListener("resize",this.updateAspect):window.removeEventListener("resize",this.updateAspect)}static getSubsetOfThree(){return{MOUSE:x.MOUSE,Vector2:x.Vector2,Vector3:x.Vector3,Vector4:x.Vector4,Quaternion:x.Quaternion,Matrix4:x.Matrix4,Spherical:x.Spherical,Box3:x.Box3,Sphere:x.Sphere,Raycaster:x.Raycaster,MathUtils:x.MathUtils}}}const hi=class hi extends Ft{constructor(t){super(t);_(this,"onAfterUpdate",new Q);_(this,"onBeforeUpdate",new Q);_(this,"onDisposed",new Q);_(this,"list",new re);_(this,"enabled",!0);t.add(hi.uuid,this)}create(){const t=new Sr(this.components),e=t.uuid;if(this.list.has(e))throw new Error("There is already a world with this name!");return this.list.set(e,t),t}delete(t){if(!this.list.has(t.uuid))throw new Error("The provided world is not found in the list!");this.list.delete(t.uuid),t.dispose()}dispose(){this.enabled=!1;for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger()}update(t){if(this.enabled)for(const[e,i]of this.list)i.update(t)}};_(hi,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let _s=hi;function La(c,s,t,e){return new Promise((i,n)=>{function r(){const o=c.clientWaitSync(s,t,0);if(o===c.WAIT_FAILED){n();return}if(o===c.TIMEOUT_EXPIRED){setTimeout(r,e);return}i()}r()})}async function Ma(c,s,t,e,i,n,r){const o=c.fenceSync(c.SYNC_GPU_COMMANDS_COMPLETE,0);c.flush(),await La(c,o,0,10),c.deleteSync(o),c.bindBuffer(s,t),c.getBufferSubData(s,e,i,n,r),c.bindBuffer(s,null)}async function Tn(c,s,t,e,i,n,r,o){const a=c.createBuffer();return c.bindBuffer(c.PIXEL_PACK_BUFFER,a),c.bufferData(c.PIXEL_PACK_BUFFER,o.byteLength,c.STREAM_READ),c.readPixels(s,t,e,i,n,r,0),c.bindBuffer(c.PIXEL_PACK_BUFFER,null),await Ma(c,c.PIXEL_PACK_BUFFER,a,0,o),c.deleteBuffer(a),o}class Pr{constructor(s,t,e){_(this,"onDisposed",new Q);_(this,"onViewUpdated",new Es);_(this,"enabled",!0);_(this,"needsUpdate",!1);_(this,"renderDebugFrame",!1);_(this,"components");_(this,"world");_(this,"renderer");_(this,"autoUpdate",!0);_(this,"updateInterval",1e3);_(this,"worker");_(this,"scene",new x.Scene);_(this,"_width",512);_(this,"_height",512);_(this,"_availableColor",1);_(this,"renderTarget");_(this,"bufferSize");_(this,"_buffer");_(this,"_isWorkerBusy",!1);_(this,"updateVisibility",async s=>{if(!this.enabled||!this.needsUpdate&&!s||this._isWorkerBusy)return;this._isWorkerBusy=!0;const t=this.world.camera.three;t.updateMatrix(),this.renderer.setSize(this._width,this._height),this.renderer.setRenderTarget(this.renderTarget),this.renderer.render(this.scene,t);const e=this.renderer.getContext();try{await Tn(e,0,0,this._width,this._height,e.RGBA,e.UNSIGNED_BYTE,this._buffer)}catch{this.needsUpdate=!1,this._isWorkerBusy=!1,this.renderer.setRenderTarget(null);return}this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,t),this.worker.postMessage({buffer:this._buffer}),this.needsUpdate=!1});if(!t.renderer)throw new Error("The given world must have a renderer!");this.components=s,this.applySettings(e),this.world=t,this.renderer=new x.WebGLRenderer,this.renderTarget=new x.WebGLRenderTarget(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.renderer.clippingPlanes=t.renderer.clippingPlanes;const i=`
11
11
  addEventListener("message", (event) => {
12
12
  const { buffer } = event.data;
13
13
  const colors = new Map();
@@ -24,7 +24,7 @@
24
24
  }
25
25
  postMessage({ colors });
26
26
  });
27
- `,n=new Blob([i],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n))}dispose(){this.enabled=!1;for(const s of this.scene.children)s.removeFromParent();this.onViewUpdated.reset(),this.worker.terminate(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.renderTarget.dispose(),this._buffer=null,this.onDisposed.reset()}getAvailableColor(){let s=BigInt(this._availableColor.toString());const t=[];do t.unshift(Number(s%256n)),s/=256n;while(s);for(;t.length!==3;)t.unshift(0);const[e,i,n]=t,r=`${e}-${i}-${n}`;return{r:e,g:i,b:n,code:r}}increaseColor(){if(this._availableColor===256*256*256){console.warn("Color can't be increased over 256 x 256 x 256!");return}this._availableColor++}decreaseColor(){if(this._availableColor===1){console.warn("Color can't be decreased under 0!");return}this._availableColor--}applySettings(s){s&&(s.updateInterval!==void 0&&(this.updateInterval=s.updateInterval),s.height!==void 0&&(this._height=s.height),s.width!==void 0&&(this._width=s.width),s.autoUpdate!==void 0&&(this.autoUpdate=s.autoUpdate))}}class Lr extends Pr{constructor(t,e,i){super(t,e,i);T(this,"onViewUpdated",new Q);T(this,"threshold",100);T(this,"colorMeshes",new Map);T(this,"isProcessing",!1);T(this,"_interval",null);T(this,"_colorCodeMeshMap",new Map);T(this,"_meshIDColorCodeMap",new Map);T(this,"_currentVisibleMeshes",new Set);T(this,"_recentlyHiddenMeshes",new Set);T(this,"_intervalID",null);T(this,"_transparentMat",new x.MeshBasicMaterial({transparent:!0,opacity:0}));T(this,"handleWorkerMessage",async t=>{if(this.isProcessing)return;const e=t.data.colors;this._recentlyHiddenMeshes=new Set(this._currentVisibleMeshes),this._currentVisibleMeshes.clear();for(const[i,n]of e){if(n<this.threshold)continue;const r=this._colorCodeMeshMap.get(i);r&&(this._currentVisibleMeshes.add(r),this._recentlyHiddenMeshes.delete(r))}this.onViewUpdated.trigger({seen:this._currentVisibleMeshes,unseen:this._recentlyHiddenMeshes}),this._isWorkerBusy=!1});this.worker.addEventListener("message",this.handleWorkerMessage),this.autoUpdate&&(this._interval=window.setInterval(async()=>{this.isProcessing||await this.updateVisibility()},this.updateInterval)),this.onViewUpdated.add(({seen:n,unseen:r})=>{for(const o of n)o.visible=!0;for(const o of r)o.visible=!1})}dispose(){super.dispose(),this._intervalID!==null&&(window.clearInterval(this._intervalID),this._intervalID=null),this._interval!==null&&(window.clearInterval(this._interval),this._intervalID=null),this._currentVisibleMeshes.clear(),this._recentlyHiddenMeshes.clear(),this._meshIDColorCodeMap.clear(),this._transparentMat.dispose(),this._colorCodeMeshMap.clear();const t=this.components.get(le);for(const e in this.colorMeshes){const i=this.colorMeshes.get(e);i&&t.destroy(i,!0)}this.colorMeshes.clear()}add(t){if(!this.enabled)return;if(this.isProcessing){console.log("Culler processing not finished yet.");return}this.isProcessing=!0;const e=t instanceof x.InstancedMesh,{geometry:i,material:n}=t,{colorMaterial:r,code:o}=this.getAvailableMaterial();let a;if(Array.isArray(n)){let d=!0;const u=[];for(const f of n)an.isTransparent(f)?u.push(this._transparentMat):(d=!1,u.push(r));if(d){r.dispose(),this.isProcessing=!1;return}a=u}else if(an.isTransparent(n)){r.dispose(),this.isProcessing=!1;return}else a=r;this._colorCodeMeshMap.set(o,t),this._meshIDColorCodeMap.set(t.uuid,o);const l=e?t.count:1,h=new x.InstancedMesh(i,a,l);e?h.instanceMatrix=t.instanceMatrix:h.setMatrixAt(0,new x.Matrix4),t.visible=!1,t.updateWorldMatrix(!0,!1),h.applyMatrix4(t.matrixWorld),h.updateMatrix(),this.scene.add(h),this.colorMeshes.set(t.uuid,h),this.increaseColor(),this.isProcessing=!1}remove(t){if(this.isProcessing){console.log("Culler processing not finished yet.");return}this.isProcessing=!0;const e=this.components.get(le);this._currentVisibleMeshes.delete(t),this._recentlyHiddenMeshes.delete(t);const i=this.colorMeshes.get(t.uuid),n=this._meshIDColorCodeMap.get(t.uuid);if(!i||!n){this.isProcessing=!1;return}this._colorCodeMeshMap.delete(n),this._meshIDColorCodeMap.delete(t.uuid),this.colorMeshes.delete(t.uuid),i.geometry=void 0,i.material=[],e.destroy(i,!0),this._recentlyHiddenMeshes.delete(t),this._currentVisibleMeshes.delete(t),this.isProcessing=!1}updateInstanced(t){for(const e of t){const i=this.colorMeshes.get(e.uuid);i&&(i.count=e.count)}}getAvailableMaterial(){const{r:t,g:e,b:i,code:n}=this.getAvailableColor(),r=x.ColorManagement.enabled;x.ColorManagement.enabled=!1;const o=new x.Color(`rgb(${t}, ${e}, ${i})`);if(!this.world.renderer)throw new Error("Renderer not found in the world!");const a=this.world.renderer.clippingPlanes,l=new x.MeshBasicMaterial({color:o,clippingPlanes:a,side:x.DoubleSide});return x.ColorManagement.enabled=r,{colorMaterial:l,code:n}}}const Is=class Is extends Ft{constructor(t){super(t);T(this,"onDisposed",new Q);T(this,"_enabled",!0);T(this,"list",new Map);t.add(Is.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const[e,i]of this.list)i.enabled=t}create(t,e){if(this.list.has(t.uuid))return this.list.get(t.uuid);const i=new Lr(this.components,t,e);return this.list.set(t.uuid,i),i}delete(t){const e=this.list.get(t.uuid);e&&e.dispose(),this.list.delete(t.uuid)}dispose(){this.enabled=!1,this.onDisposed.trigger(Is.uuid),this.onDisposed.reset();for(const[t,e]of this.list)e.dispose();this.list.clear()}updateInstanced(t){for(const[,e]of this.list)e.updateInstanced(t)}};T(Is,"uuid","69f2a50d-c266-44fc-b1bd-fa4d34be89e6");let ei=Is;class xa{constructor(s,t){T(this,"onDisposed",new Q);T(this,"onDistanceComputed",new Q);T(this,"excludedObjects",new Set);T(this,"enabled",!0);T(this,"renderDebugFrame",!1);T(this,"components");T(this,"scene",new x.Scene);T(this,"camera",new x.OrthographicCamera(-1,1,1,-1,0,1));T(this,"depthMaterial");T(this,"world");T(this,"renderer");T(this,"worker");T(this,"_width",512);T(this,"_height",512);T(this,"_postQuad");T(this,"tempRT");T(this,"resultRT");T(this,"bufferSize");T(this,"_buffer");T(this,"_isWorkerBusy",!1);T(this,"compute",async()=>{if(!this.enabled||this.world.isDisposing||this._isWorkerBusy)return;this._isWorkerBusy=!0,this.world.camera.three.updateMatrix(),this.renderer.setSize(this._width,this._height),this.renderer.setRenderTarget(this.tempRT);const s="visibilityBeforeDistanceCheck";for(const e of this.excludedObjects)e.userData[s]=e.visible,e.visible=!1;this.renderer.render(this.world.scene.three,this.world.camera.three);for(const e of this.excludedObjects)e.userData[s]!==void 0&&(e.visible=e.userData[s]);this.depthMaterial.uniforms.tDiffuse.value=this.tempRT.texture,this.depthMaterial.uniforms.tDepth.value=this.tempRT.depthTexture,this.renderer.setRenderTarget(this.resultRT),this.renderer.render(this.scene,this.camera);const t=this.renderer.getContext();try{await Tn(t,0,0,this._width,this._height,t.RGBA,t.UNSIGNED_BYTE,this._buffer)}catch{this.renderer.setRenderTarget(null),this._isWorkerBusy=!1;return}this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,this.camera),this.worker.postMessage({buffer:this._buffer})});T(this,"handleWorkerMessage",s=>{if(!this.enabled||this.world.isDisposing)return;const t=s.data.colors;let e=Number.MAX_VALUE;for(const a of t)a!==0&&a<e&&(e=a);const i=this.world.camera.three||x.OrthographicCamera,r=(e/255-1)*-1*(i.far-i.near),o=Math.min(r,i.far);this.onDistanceComputed.trigger(o),this._isWorkerBusy=!1});if(!t.renderer)throw new Error("The given world must have a renderer!");this.components=s,this.world=t;const e=t.camera.three;this.renderer=new x.WebGLRenderer,this.tempRT=new x.WebGLRenderTarget(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.tempRT.texture.minFilter=x.NearestFilter,this.tempRT.texture.magFilter=x.NearestFilter,this.tempRT.stencilBuffer=!1,this.tempRT.samples=0,this.tempRT.depthTexture=new x.DepthTexture(this._width,this._height),this.tempRT.depthTexture.format=x.DepthFormat,this.tempRT.depthTexture.type=x.UnsignedShortType,this.resultRT=new x.WebGLRenderTarget(this._width,this._height),this.depthMaterial=new x.ShaderMaterial({vertexShader:`
27
+ `,n=new Blob([i],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n))}dispose(){this.enabled=!1;for(const s of this.scene.children)s.removeFromParent();this.onViewUpdated.reset(),this.worker.terminate(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.renderTarget.dispose(),this._buffer=null,this.onDisposed.reset()}getAvailableColor(){let s=BigInt(this._availableColor.toString());const t=[];do t.unshift(Number(s%256n)),s/=256n;while(s);for(;t.length!==3;)t.unshift(0);const[e,i,n]=t,r=`${e}-${i}-${n}`;return{r:e,g:i,b:n,code:r}}increaseColor(){if(this._availableColor===256*256*256){console.warn("Color can't be increased over 256 x 256 x 256!");return}this._availableColor++}decreaseColor(){if(this._availableColor===1){console.warn("Color can't be decreased under 0!");return}this._availableColor--}applySettings(s){s&&(s.updateInterval!==void 0&&(this.updateInterval=s.updateInterval),s.height!==void 0&&(this._height=s.height),s.width!==void 0&&(this._width=s.width),s.autoUpdate!==void 0&&(this.autoUpdate=s.autoUpdate))}}class Lr extends Pr{constructor(t,e,i){super(t,e,i);_(this,"onViewUpdated",new Q);_(this,"threshold",100);_(this,"colorMeshes",new Map);_(this,"isProcessing",!1);_(this,"_interval",null);_(this,"_colorCodeMeshMap",new Map);_(this,"_meshIDColorCodeMap",new Map);_(this,"_currentVisibleMeshes",new Set);_(this,"_recentlyHiddenMeshes",new Set);_(this,"_intervalID",null);_(this,"_transparentMat",new x.MeshBasicMaterial({transparent:!0,opacity:0}));_(this,"handleWorkerMessage",async t=>{if(this.isProcessing)return;const e=t.data.colors;this._recentlyHiddenMeshes=new Set(this._currentVisibleMeshes),this._currentVisibleMeshes.clear();for(const[i,n]of e){if(n<this.threshold)continue;const r=this._colorCodeMeshMap.get(i);r&&(this._currentVisibleMeshes.add(r),this._recentlyHiddenMeshes.delete(r))}this.onViewUpdated.trigger({seen:this._currentVisibleMeshes,unseen:this._recentlyHiddenMeshes}),this._isWorkerBusy=!1});this.worker.addEventListener("message",this.handleWorkerMessage),this.autoUpdate&&(this._interval=window.setInterval(async()=>{this.isProcessing||await this.updateVisibility()},this.updateInterval)),this.onViewUpdated.add(({seen:n,unseen:r})=>{for(const o of n)o.visible=!0;for(const o of r)o.visible=!1})}dispose(){super.dispose(),this._intervalID!==null&&(window.clearInterval(this._intervalID),this._intervalID=null),this._interval!==null&&(window.clearInterval(this._interval),this._intervalID=null),this._currentVisibleMeshes.clear(),this._recentlyHiddenMeshes.clear(),this._meshIDColorCodeMap.clear(),this._transparentMat.dispose(),this._colorCodeMeshMap.clear();const t=this.components.get(he);for(const e in this.colorMeshes){const i=this.colorMeshes.get(e);i&&t.destroy(i,!0)}this.colorMeshes.clear()}add(t){if(!this.enabled)return;if(this.isProcessing){console.log("Culler processing not finished yet.");return}this.isProcessing=!0;const e=t instanceof x.InstancedMesh,{geometry:i,material:n}=t,{colorMaterial:r,code:o}=this.getAvailableMaterial();let a;if(Array.isArray(n)){let d=!0;const u=[];for(const f of n)an.isTransparent(f)?u.push(this._transparentMat):(d=!1,u.push(r));if(d){r.dispose(),this.isProcessing=!1;return}a=u}else if(an.isTransparent(n)){r.dispose(),this.isProcessing=!1;return}else a=r;this._colorCodeMeshMap.set(o,t),this._meshIDColorCodeMap.set(t.uuid,o);const l=e?t.count:1,h=new x.InstancedMesh(i,a,l);e?h.instanceMatrix=t.instanceMatrix:h.setMatrixAt(0,new x.Matrix4),t.visible=!1,t.updateWorldMatrix(!0,!1),h.applyMatrix4(t.matrixWorld),h.updateMatrix(),this.scene.add(h),this.colorMeshes.set(t.uuid,h),this.increaseColor(),this.isProcessing=!1}remove(t){if(this.isProcessing){console.log("Culler processing not finished yet.");return}this.isProcessing=!0;const e=this.components.get(he);this._currentVisibleMeshes.delete(t),this._recentlyHiddenMeshes.delete(t);const i=this.colorMeshes.get(t.uuid),n=this._meshIDColorCodeMap.get(t.uuid);if(!i||!n){this.isProcessing=!1;return}this._colorCodeMeshMap.delete(n),this._meshIDColorCodeMap.delete(t.uuid),this.colorMeshes.delete(t.uuid),i.geometry=void 0,i.material=[],e.destroy(i,!0),this._recentlyHiddenMeshes.delete(t),this._currentVisibleMeshes.delete(t),this.isProcessing=!1}updateInstanced(t){for(const e of t){const i=this.colorMeshes.get(e.uuid);i&&(i.count=e.count)}}getAvailableMaterial(){const{r:t,g:e,b:i,code:n}=this.getAvailableColor(),r=x.ColorManagement.enabled;x.ColorManagement.enabled=!1;const o=new x.Color(`rgb(${t}, ${e}, ${i})`);if(!this.world.renderer)throw new Error("Renderer not found in the world!");const a=this.world.renderer.clippingPlanes,l=new x.MeshBasicMaterial({color:o,clippingPlanes:a,side:x.DoubleSide});return x.ColorManagement.enabled=r,{colorMaterial:l,code:n}}}const Is=class Is extends Ft{constructor(t){super(t);_(this,"onDisposed",new Q);_(this,"_enabled",!0);_(this,"list",new Map);t.add(Is.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const[e,i]of this.list)i.enabled=t}create(t,e){if(this.list.has(t.uuid))return this.list.get(t.uuid);const i=new Lr(this.components,t,e);return this.list.set(t.uuid,i),i}delete(t){const e=this.list.get(t.uuid);e&&e.dispose(),this.list.delete(t.uuid)}dispose(){this.enabled=!1,this.onDisposed.trigger(Is.uuid),this.onDisposed.reset();for(const[t,e]of this.list)e.dispose();this.list.clear()}updateInstanced(t){for(const[,e]of this.list)e.updateInstanced(t)}};_(Is,"uuid","69f2a50d-c266-44fc-b1bd-fa4d34be89e6");let ei=Is;class xa{constructor(s,t){_(this,"onDisposed",new Q);_(this,"onDistanceComputed",new Q);_(this,"excludedObjects",new Set);_(this,"enabled",!0);_(this,"renderDebugFrame",!1);_(this,"components");_(this,"scene",new x.Scene);_(this,"camera",new x.OrthographicCamera(-1,1,1,-1,0,1));_(this,"depthMaterial");_(this,"world");_(this,"renderer");_(this,"worker");_(this,"_width",512);_(this,"_height",512);_(this,"_postQuad");_(this,"tempRT");_(this,"resultRT");_(this,"bufferSize");_(this,"_buffer");_(this,"_isWorkerBusy",!1);_(this,"compute",async()=>{if(!this.enabled||this.world.isDisposing||this._isWorkerBusy)return;this._isWorkerBusy=!0,this.world.camera.three.updateMatrix(),this.renderer.setSize(this._width,this._height),this.renderer.setRenderTarget(this.tempRT);const s="visibilityBeforeDistanceCheck";for(const e of this.excludedObjects)e.userData[s]=e.visible,e.visible=!1;this.renderer.render(this.world.scene.three,this.world.camera.three);for(const e of this.excludedObjects)e.userData[s]!==void 0&&(e.visible=e.userData[s]);this.depthMaterial.uniforms.tDiffuse.value=this.tempRT.texture,this.depthMaterial.uniforms.tDepth.value=this.tempRT.depthTexture,this.renderer.setRenderTarget(this.resultRT),this.renderer.render(this.scene,this.camera);const t=this.renderer.getContext();try{await Tn(t,0,0,this._width,this._height,t.RGBA,t.UNSIGNED_BYTE,this._buffer)}catch{this.renderer.setRenderTarget(null),this._isWorkerBusy=!1;return}this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,this.camera),this.worker.postMessage({buffer:this._buffer})});_(this,"handleWorkerMessage",s=>{if(!this.enabled||this.world.isDisposing)return;const t=s.data.colors;let e=Number.MAX_VALUE;for(const a of t)a!==0&&a<e&&(e=a);const i=this.world.camera.three||x.OrthographicCamera,r=(e/255-1)*-1*(i.far-i.near),o=Math.min(r,i.far);this.onDistanceComputed.trigger(o),this._isWorkerBusy=!1});if(!t.renderer)throw new Error("The given world must have a renderer!");this.components=s,this.world=t;const e=t.camera.three;this.renderer=new x.WebGLRenderer,this.tempRT=new x.WebGLRenderTarget(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.tempRT.texture.minFilter=x.NearestFilter,this.tempRT.texture.magFilter=x.NearestFilter,this.tempRT.stencilBuffer=!1,this.tempRT.samples=0,this.tempRT.depthTexture=new x.DepthTexture(this._width,this._height),this.tempRT.depthTexture.format=x.DepthFormat,this.tempRT.depthTexture.type=x.UnsignedShortType,this.resultRT=new x.WebGLRenderTarget(this._width,this._height),this.depthMaterial=new x.ShaderMaterial({vertexShader:`
28
28
  varying vec2 vUv;
29
29
 
30
30
  void main() {
@@ -64,7 +64,7 @@ void main() {
64
64
  }
65
65
  postMessage({ colors });
66
66
  });
67
- `,r=new Blob([n],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(r)),this.worker.addEventListener("message",this.handleWorkerMessage)}dispose(){this.enabled=!1,this.onDistanceComputed.reset(),this.worker.terminate(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.tempRT.dispose(),this.resultRT.dispose();const s=[...this.scene.children];this.excludedObjects.clear();for(const t of s)t.removeFromParent();this._postQuad.geometry.dispose(),this._postQuad.removeFromParent(),this._buffer=null,this.onDisposed.reset()}}class va extends Or{constructor(){super(...arguments);T(this,"_distanceRenderer");T(this,"autoBias",!0);T(this,"config",{directionalLight:{color:new x.Color("white"),intensity:1.5,position:new x.Vector3(5,10,3)},ambientLight:{color:new x.Color("white"),intensity:1},shadows:{cascade:1,resolution:512}});T(this,"_lightsWithShadow",new Map);T(this,"_isComputingShadows",!1);T(this,"_shadowsEnabled",!0);T(this,"_bias",0);T(this,"recomputeShadows",t=>{if(!this._shadowsEnabled)return;if(this.autoBias&&(this.bias=t/-1e5),t*=1.5,!this.currentWorld)throw new Error("A world needs to be assigned to the scene before computing shadows!");if(!this._lightsWithShadow.size)throw new Error("No shadows found!");const i=this.currentWorld.camera.three;if(!(i instanceof x.PerspectiveCamera)&&!(i instanceof x.OrthographicCamera))throw new Error("Invalid camera type!");const n=new x.Vector3;i.getWorldDirection(n);let r=t;const o=new x.Vector3;o.copy(this.config.directionalLight.position),o.normalize();for(const[a,l]of this._lightsWithShadow){const h=this.directionalLights.get(l);if(!h)throw new Error("Light not found.");const d=new x.Vector3;d.copy(n);const u=a===this._lightsWithShadow.size-1,f=u?r/2:r*2/3;d.multiplyScalar(f),d.add(i.position);const E=r-f,p=new x.Vector3;p.copy(o),p.multiplyScalar(E),h.target.position.copy(d),h.position.copy(d),h.position.add(p),h.shadow.camera.right=E,h.shadow.camera.left=-E,h.shadow.camera.top=E,h.shadow.camera.bottom=-E,h.shadow.camera.far=E*2,h.shadow.camera.updateProjectionMatrix(),h.shadow.camera.updateMatrix(),u||(r/=3)}this._isComputingShadows=!1})}get bias(){return this._bias}set bias(t){this._bias=t;for(const[,e]of this._lightsWithShadow){const i=this.directionalLights.get(e);i&&(i.shadow.bias=t)}}get shadowsEnabled(){return this._shadowsEnabled}set shadowsEnabled(t){this._shadowsEnabled=t;for(const[,e]of this.directionalLights)e.castShadow=t}get distanceRenderer(){if(!this._distanceRenderer)throw new Error("You must set up this component before accessing the distance renderer!");return this._distanceRenderer}setup(t){if(super.setup(t),this.config={...this.config,...t},this.config.shadows.cascade<=0)throw new Error("Config.shadows.cascade must be a natural number greater than 0!");if(this.config.shadows.cascade>1)throw new Error("Multiple shadows not supported yet!");if(!this.currentWorld)throw new Error("A world needs to be assigned to the scene before setting it up!");for(const[,e]of this.directionalLights)e.target.removeFromParent(),e.removeFromParent(),e.dispose();this.directionalLights.clear(),this._distanceRenderer||(this._distanceRenderer=new xa(this.components,this.currentWorld),this._distanceRenderer.onDistanceComputed.add(this.recomputeShadows)),this._lightsWithShadow.clear();for(let e=0;e<this.config.shadows.cascade;e++){const i=new x.DirectionalLight;i.intensity=this.config.directionalLight.intensity,i.color=this.config.directionalLight.color,i.position.copy(this.config.directionalLight.position),i.shadow.mapSize.width=this.config.shadows.resolution,i.shadow.mapSize.height=this.config.shadows.resolution,this.three.add(i,i.target),this.directionalLights.set(i.uuid,i),this._lightsWithShadow.set(e,i.uuid),i.castShadow=!0,i.shadow.bias=this._bias}}dispose(){super.dispose(),this._distanceRenderer&&this._distanceRenderer.dispose(),this._lightsWithShadow.clear()}async updateShadows(){this._isComputingShadows||!this._shadowsEnabled||(this._isComputingShadows=!0,await this.distanceRenderer.compute())}}class Mr{constructor(s){T(this,"_event");T(this,"_position",new x.Vector2);T(this,"onDisposed",new Q);T(this,"updateMouseInfo",s=>{this._event=s});this.dom=s,this.setupEvents(!0)}get position(){if(this._event){const s=this.dom.getBoundingClientRect();this._position.x=this.getPositionX(s,this._event),this._position.y=this.getPositionY(s,this._event)}return this._position}dispose(){this.setupEvents(!1),this.onDisposed.trigger(),this.onDisposed.reset()}getPositionY(s,t){return-((t.clientY-s.top)/(s.bottom-s.top))*2+1}getPositionX(s,t){return(t.clientX-s.left)/(s.right-s.left)*2-1}setupEvents(s){s?this.dom.addEventListener("pointermove",this.updateMouseInfo):this.dom.removeEventListener("pointermove",this.updateMouseInfo)}}class xr{constructor(s,t){T(this,"enabled",!0);T(this,"components");T(this,"onDisposed",new Q);T(this,"mouse");T(this,"three",new x.Raycaster);T(this,"world");const e=t.renderer;if(!e)throw new Error("A renderer is needed for the raycaster to work!");this.world=t,this.mouse=new Mr(e.three.domElement),this.components=s}dispose(){this.mouse.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}castRay(s=Array.from(this.world.meshes)){if(!this.world)throw new Error("A world is needed to cast rays!");const t=this.world.camera.three;return this.three.setFromCamera(this.mouse.position,t),this.intersect(s)}castRayFromVector(s,t,e=Array.from(this.world.meshes)){return this.three.set(s,t),this.intersect(e)}intersect(s=Array.from(this.world.meshes)){const t=this.three.intersectObjects(s),e=this.filterClippingPlanes(t);return e.length>0?e[0]:null}filterClippingPlanes(s){if(!this.world.renderer)throw new Error("Renderer not found!");const t=this.world.renderer.three;if(!t.clippingPlanes)return s;const e=t.clippingPlanes;return s.length<=0||!e||(e==null?void 0:e.length)<=0?s:s.filter(i=>e.every(n=>n.distanceToPoint(i.point)>0))}}const di=class di extends Ft{constructor(t){super(t);T(this,"enabled",!0);T(this,"list",new Map);T(this,"onDisposed",new Q);t.add(di.uuid,this)}get(t){if(this.list.has(t.uuid))return this.list.get(t.uuid);const e=new xr(this.components,t);return this.list.set(t.uuid,e),t.onDisposed.add(()=>{this.delete(t)}),e}delete(t){const e=this.list.get(t.uuid);e&&e.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger()}};T(di,"uuid","d5d8bdf0-db25-4952-b951-b643af207ace");let Ne=di;class vr{constructor(s,t,e){T(this,"onDisposed",new Q);T(this,"world");T(this,"components");T(this,"three");T(this,"_fade",3);T(this,"updateZoom",()=>{this.world.camera instanceof We&&(this.material.uniforms.uZoom.value=this.world.camera.three.zoom)});this.world=t;const{color:i,size1:n,size2:r,distance:o}=e;this.components=s;const a=new x.PlaneGeometry(2,2,1,1),l=new x.ShaderMaterial({side:x.DoubleSide,uniforms:{uSize1:{value:n},uSize2:{value:r},uColor:{value:i},uDistance:{value:o},uFade:{value:this._fade},uZoom:{value:1}},transparent:!0,vertexShader:`
67
+ `,r=new Blob([n],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(r)),this.worker.addEventListener("message",this.handleWorkerMessage)}dispose(){this.enabled=!1,this.onDistanceComputed.reset(),this.worker.terminate(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.tempRT.dispose(),this.resultRT.dispose();const s=[...this.scene.children];this.excludedObjects.clear();for(const t of s)t.removeFromParent();this._postQuad.geometry.dispose(),this._postQuad.removeFromParent(),this._buffer=null,this.onDisposed.reset()}}class va extends Or{constructor(){super(...arguments);_(this,"_distanceRenderer");_(this,"autoBias",!0);_(this,"config",{directionalLight:{color:new x.Color("white"),intensity:1.5,position:new x.Vector3(5,10,3)},ambientLight:{color:new x.Color("white"),intensity:1},shadows:{cascade:1,resolution:512}});_(this,"_lightsWithShadow",new Map);_(this,"_isComputingShadows",!1);_(this,"_shadowsEnabled",!0);_(this,"_bias",0);_(this,"recomputeShadows",t=>{if(!this._shadowsEnabled)return;if(this.autoBias&&(this.bias=t/-1e5),t*=1.5,!this.currentWorld)throw new Error("A world needs to be assigned to the scene before computing shadows!");if(!this._lightsWithShadow.size)throw new Error("No shadows found!");const i=this.currentWorld.camera.three;if(!(i instanceof x.PerspectiveCamera)&&!(i instanceof x.OrthographicCamera))throw new Error("Invalid camera type!");const n=new x.Vector3;i.getWorldDirection(n);let r=t;const o=new x.Vector3;o.copy(this.config.directionalLight.position),o.normalize();for(const[a,l]of this._lightsWithShadow){const h=this.directionalLights.get(l);if(!h)throw new Error("Light not found.");const d=new x.Vector3;d.copy(n);const u=a===this._lightsWithShadow.size-1,f=u?r/2:r*2/3;d.multiplyScalar(f),d.add(i.position);const E=r-f,p=new x.Vector3;p.copy(o),p.multiplyScalar(E),h.target.position.copy(d),h.position.copy(d),h.position.add(p),h.shadow.camera.right=E,h.shadow.camera.left=-E,h.shadow.camera.top=E,h.shadow.camera.bottom=-E,h.shadow.camera.far=E*2,h.shadow.camera.updateProjectionMatrix(),h.shadow.camera.updateMatrix(),u||(r/=3)}this._isComputingShadows=!1})}get bias(){return this._bias}set bias(t){this._bias=t;for(const[,e]of this._lightsWithShadow){const i=this.directionalLights.get(e);i&&(i.shadow.bias=t)}}get shadowsEnabled(){return this._shadowsEnabled}set shadowsEnabled(t){this._shadowsEnabled=t;for(const[,e]of this.directionalLights)e.castShadow=t}get distanceRenderer(){if(!this._distanceRenderer)throw new Error("You must set up this component before accessing the distance renderer!");return this._distanceRenderer}setup(t){if(super.setup(t),this.config={...this.config,...t},this.config.shadows.cascade<=0)throw new Error("Config.shadows.cascade must be a natural number greater than 0!");if(this.config.shadows.cascade>1)throw new Error("Multiple shadows not supported yet!");if(!this.currentWorld)throw new Error("A world needs to be assigned to the scene before setting it up!");for(const[,e]of this.directionalLights)e.target.removeFromParent(),e.removeFromParent(),e.dispose();this.directionalLights.clear(),this._distanceRenderer||(this._distanceRenderer=new xa(this.components,this.currentWorld),this._distanceRenderer.onDistanceComputed.add(this.recomputeShadows)),this._lightsWithShadow.clear();for(let e=0;e<this.config.shadows.cascade;e++){const i=new x.DirectionalLight;i.intensity=this.config.directionalLight.intensity,i.color=this.config.directionalLight.color,i.position.copy(this.config.directionalLight.position),i.shadow.mapSize.width=this.config.shadows.resolution,i.shadow.mapSize.height=this.config.shadows.resolution,this.three.add(i,i.target),this.directionalLights.set(i.uuid,i),this._lightsWithShadow.set(e,i.uuid),i.castShadow=!0,i.shadow.bias=this._bias}}dispose(){super.dispose(),this._distanceRenderer&&this._distanceRenderer.dispose(),this._lightsWithShadow.clear()}async updateShadows(){this._isComputingShadows||!this._shadowsEnabled||(this._isComputingShadows=!0,await this.distanceRenderer.compute())}}class Mr{constructor(s){_(this,"_event");_(this,"_position",new x.Vector2);_(this,"onDisposed",new Q);_(this,"updateMouseInfo",s=>{this._event=s});this.dom=s,this.setupEvents(!0)}get position(){if(this._event){const s=this.dom.getBoundingClientRect();this._position.x=this.getPositionX(s,this._event),this._position.y=this.getPositionY(s,this._event)}return this._position}dispose(){this.setupEvents(!1),this.onDisposed.trigger(),this.onDisposed.reset()}getPositionY(s,t){return-((t.clientY-s.top)/(s.bottom-s.top))*2+1}getPositionX(s,t){return(t.clientX-s.left)/(s.right-s.left)*2-1}setupEvents(s){s?this.dom.addEventListener("pointermove",this.updateMouseInfo):this.dom.removeEventListener("pointermove",this.updateMouseInfo)}}class xr{constructor(s,t){_(this,"enabled",!0);_(this,"components");_(this,"onDisposed",new Q);_(this,"mouse");_(this,"three",new x.Raycaster);_(this,"world");const e=t.renderer;if(!e)throw new Error("A renderer is needed for the raycaster to work!");this.world=t,this.mouse=new Mr(e.three.domElement),this.components=s}dispose(){this.mouse.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}castRay(s=Array.from(this.world.meshes)){if(!this.world)throw new Error("A world is needed to cast rays!");const t=this.world.camera.three;return this.three.setFromCamera(this.mouse.position,t),this.intersect(s)}castRayFromVector(s,t,e=Array.from(this.world.meshes)){return this.three.set(s,t),this.intersect(e)}intersect(s=Array.from(this.world.meshes)){const t=this.three.intersectObjects(s),e=this.filterClippingPlanes(t);return e.length>0?e[0]:null}filterClippingPlanes(s){if(!this.world.renderer)throw new Error("Renderer not found!");const t=this.world.renderer.three;if(!t.clippingPlanes)return s;const e=t.clippingPlanes;return s.length<=0||!e||(e==null?void 0:e.length)<=0?s:s.filter(i=>e.every(n=>n.distanceToPoint(i.point)>0))}}const di=class di extends Ft{constructor(t){super(t);_(this,"enabled",!0);_(this,"list",new Map);_(this,"onDisposed",new Q);t.add(di.uuid,this)}get(t){if(this.list.has(t.uuid))return this.list.get(t.uuid);const e=new xr(this.components,t);return this.list.set(t.uuid,e),t.onDisposed.add(()=>{this.delete(t)}),e}delete(t){const e=this.list.get(t.uuid);e&&e.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger()}};_(di,"uuid","d5d8bdf0-db25-4952-b951-b643af207ace");let Ne=di;class vr{constructor(s,t,e){_(this,"onDisposed",new Q);_(this,"world");_(this,"components");_(this,"three");_(this,"_fade",3);_(this,"updateZoom",()=>{this.world.camera instanceof We&&(this.material.uniforms.uZoom.value=this.world.camera.three.zoom)});this.world=t;const{color:i,size1:n,size2:r,distance:o}=e;this.components=s;const a=new x.PlaneGeometry(2,2,1,1),l=new x.ShaderMaterial({side:x.DoubleSide,uniforms:{uSize1:{value:n},uSize2:{value:r},uColor:{value:i},uDistance:{value:o},uFade:{value:this._fade},uZoom:{value:1}},transparent:!0,vertexShader:`
68
68
 
69
69
  varying vec3 worldPosition;
70
70
 
@@ -125,7 +125,7 @@ void main() {
125
125
 
126
126
  }
127
127
 
128
- `,extensions:{derivatives:!0}});this.three=new x.Mesh(a,l),this.three.frustumCulled=!1,t.scene.three.add(this.three),this.setupEvents(!0)}get visible(){return this.three.visible}set visible(s){s?this.world.scene.three.add(this.three):this.three.removeFromParent()}get material(){return this.three.material}get fade(){return this._fade===3}set fade(s){this._fade=s?3:0,this.material.uniforms.uFade.value=this._fade}dispose(){this.setupEvents(!1),this.components.get(le).destroy(this.three),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(s){if(this.world.isDisposing||!(this.world.camera instanceof We))return;const t=this.world.camera.controls;s?t.addEventListener("update",this.updateZoom):t.removeEventListener("update",this.updateZoom)}}const ui=class ui extends Ft{constructor(t){super(t);T(this,"list",new Map);T(this,"config",{color:new x.Color(12303291),size1:1,size2:10,distance:500});T(this,"onDisposed",new Q);T(this,"enabled",!0);t.add(ui.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a grid!");const e=new vr(this.components,t,this.config);return this.list.set(t.uuid,e),t.onDisposed.add(()=>{this.delete(t)}),e}delete(t){const e=this.list.get(t.uuid);e&&e.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}};T(ui,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");let cn=ui;const Re=new S.Raycaster,Mt=new S.Vector3,ue=new S.Vector3,Rt=new S.Quaternion,nr={X:new S.Vector3(1,0,0),Y:new S.Vector3(0,1,0),Z:new S.Vector3(0,0,1)},ji={type:"change"},rr={type:"mouseDown"},or={type:"mouseUp",mode:null},ar={type:"objectChange"};class Da extends S.Object3D{constructor(s,t){super(),t===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,this.domElement.style.touchAction="none";const e=new Ga;this._gizmo=e,this.add(e);const i=new Ya;this._plane=i,this.add(i);const n=this;function r(C,R){let g=R;Object.defineProperty(n,C,{get:function(){return g!==void 0?g:R},set:function(y){g!==y&&(g=y,i[C]=y,e[C]=y,n.dispatchEvent({type:C+"-changed",value:y}),n.dispatchEvent(ji))}}),n[C]=R,i[C]=R,e[C]=R}r("camera",s),r("object",void 0),r("enabled",!0),r("axis",null),r("mode","translate"),r("translationSnap",null),r("rotationSnap",null),r("scaleSnap",null),r("space","world"),r("size",1),r("dragging",!1),r("showX",!0),r("showY",!0),r("showZ",!0);const o=new S.Vector3,a=new S.Vector3,l=new S.Quaternion,h=new S.Quaternion,d=new S.Vector3,u=new S.Quaternion,f=new S.Vector3,E=new S.Vector3,p=new S.Vector3,I=0,m=new S.Vector3;r("worldPosition",o),r("worldPositionStart",a),r("worldQuaternion",l),r("worldQuaternionStart",h),r("cameraPosition",d),r("cameraQuaternion",u),r("pointStart",f),r("pointEnd",E),r("rotationAxis",p),r("rotationAngle",I),r("eye",m),this._offset=new S.Vector3,this._startNorm=new S.Vector3,this._endNorm=new S.Vector3,this._cameraScale=new S.Vector3,this._parentPosition=new S.Vector3,this._parentQuaternion=new S.Quaternion,this._parentQuaternionInv=new S.Quaternion,this._parentScale=new S.Vector3,this._worldScaleStart=new S.Vector3,this._worldQuaternionInv=new S.Quaternion,this._worldScale=new S.Vector3,this._positionStart=new S.Vector3,this._quaternionStart=new S.Quaternion,this._scaleStart=new S.Vector3,this._getPointer=Ua.bind(this),this._onPointerDown=za.bind(this),this._onPointerHover=Ba.bind(this),this._onPointerMove=Va.bind(this),this._onPointerUp=ka.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(s){if(this.object===void 0||this.dragging===!0)return;Re.setFromCamera(s,this.camera);const t=Qi(this._gizmo.picker[this.mode],Re);t?this.axis=t.object.name:this.axis=null}pointerDown(s){if(!(this.object===void 0||this.dragging===!0||s.button!==0)&&this.axis!==null){Re.setFromCamera(s,this.camera);const t=Qi(this._plane,Re,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,rr.mode=this.mode,this.dispatchEvent(rr)}}pointerMove(s){const t=this.axis,e=this.mode,i=this.object;let n=this.space;if(e==="scale"?n="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(n="world"),i===void 0||t===null||this.dragging===!1||s.button!==-1)return;Re.setFromCamera(s,this.camera);const r=Qi(this._plane,Re,!0);if(r){if(this.pointEnd.copy(r.point).sub(this.worldPositionStart),e==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),n==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),n==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),i.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(n==="local"&&(i.position.applyQuaternion(Rt.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(this._quaternionStart)),n==="world"&&(i.parent&&i.position.add(Mt.setFromMatrixPosition(i.parent.matrixWorld)),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(Mt.setFromMatrixPosition(i.parent.matrixWorld))));else if(e==="scale"){if(t.search("XYZ")!==-1){let o=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(o*=-1),ue.set(o,o,o)}else Mt.copy(this.pointStart),ue.copy(this.pointEnd),Mt.applyQuaternion(this._worldQuaternionInv),ue.applyQuaternion(this._worldQuaternionInv),ue.divide(Mt),t.search("X")===-1&&(ue.x=1),t.search("Y")===-1&&(ue.y=1),t.search("Z")===-1&&(ue.z=1);i.scale.copy(this._scaleStart).multiply(ue),this.scaleSnap&&(t.search("X")!==-1&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(e==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const o=20/this.worldPosition.distanceTo(Mt.setFromMatrixPosition(this.camera.matrixWorld));let a=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Mt.copy(this.rotationAxis).cross(this.eye))*o):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(nr[t]),Mt.copy(nr[t]),n==="local"&&Mt.applyQuaternion(this.worldQuaternion),Mt.cross(this.eye),Mt.length()===0?a=!0:this.rotationAngle=this._offset.dot(Mt.normalize())*o),(t==="E"||a)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),n==="local"&&t!=="E"&&t!=="XYZE"?(i.quaternion.copy(this._quaternionStart),i.quaternion.multiply(Rt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),i.quaternion.copy(Rt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),i.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(ji),this.dispatchEvent(ar)}}pointerUp(s){s.button===0&&(this.dragging&&this.axis!==null&&(or.mode=this.mode,this.dispatchEvent(or)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(s){s.geometry&&s.geometry.dispose(),s.material&&s.material.dispose()})}attach(s){return this.object=s,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(ji),this.dispatchEvent(ar),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Re}getMode(){return this.mode}setMode(s){this.mode=s}setTranslationSnap(s){this.translationSnap=s}setRotationSnap(s){this.rotationSnap=s}setScaleSnap(s){this.scaleSnap=s}setSize(s){this.size=s}setSpace(s){this.space=s}}function Ua(c){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:c.button};{const s=this.domElement.getBoundingClientRect();return{x:(c.clientX-s.left)/s.width*2-1,y:-(c.clientY-s.top)/s.height*2+1,button:c.button}}}function Ba(c){if(this.enabled)switch(c.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(c));break}}function za(c){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(c.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(c)),this.pointerDown(this._getPointer(c)))}function Va(c){this.enabled&&this.pointerMove(this._getPointer(c))}function ka(c){this.enabled&&(this.domElement.releasePointerCapture(c.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(c)))}function Qi(c,s,t){const e=s.intersectObject(c,!0);for(let i=0;i<e.length;i++)if(e[i].object.visible||t)return e[i];return!1}const Hs=new S.Euler,It=new S.Vector3(0,1,0),cr=new S.Vector3(0,0,0),lr=new S.Matrix4,Ws=new S.Quaternion,qs=new S.Quaternion,se=new S.Vector3,hr=new S.Matrix4,us=new S.Vector3(1,0,0),ye=new S.Vector3(0,1,0),fs=new S.Vector3(0,0,1),Xs=new S.Vector3,cs=new S.Vector3,ls=new S.Vector3;class Ga extends S.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const s=new S.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new S.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=s.clone();e.opacity=.15;const i=t.clone();i.opacity=.5;const n=s.clone();n.color.setHex(16711680);const r=s.clone();r.color.setHex(65280);const o=s.clone();o.color.setHex(255);const a=s.clone();a.color.setHex(16711680),a.opacity=.5;const l=s.clone();l.color.setHex(65280),l.opacity=.5;const h=s.clone();h.color.setHex(255),h.opacity=.5;const d=s.clone();d.opacity=.25;const u=s.clone();u.color.setHex(16776960),u.opacity=.25,s.clone().color.setHex(16776960);const E=s.clone();E.color.setHex(7895160);const p=new S.CylinderGeometry(0,.04,.1,12);p.translate(0,.05,0);const I=new S.BoxGeometry(.08,.08,.08);I.translate(0,.04,0);const m=new S.BufferGeometry;m.setAttribute("position",new S.Float32BufferAttribute([0,0,0,1,0,0],3));const C=new S.CylinderGeometry(.0075,.0075,.5,3);C.translate(0,.25,0);function R(D,q){const G=new S.TorusGeometry(D,.0075,3,64,q*Math.PI*2);return G.rotateY(Math.PI/2),G.rotateX(Math.PI/2),G}function g(){const D=new S.BufferGeometry;return D.setAttribute("position",new S.Float32BufferAttribute([0,0,0,1,1,1],3)),D}const y={X:[[new S.Mesh(p,n),[.5,0,0],[0,0,-Math.PI/2]],[new S.Mesh(p,n),[-.5,0,0],[0,0,Math.PI/2]],[new S.Mesh(C,n),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new S.Mesh(p,r),[0,.5,0]],[new S.Mesh(p,r),[0,-.5,0],[Math.PI,0,0]],[new S.Mesh(C,r)]],Z:[[new S.Mesh(p,o),[0,0,.5],[Math.PI/2,0,0]],[new S.Mesh(p,o),[0,0,-.5],[-Math.PI/2,0,0]],[new S.Mesh(C,o),null,[Math.PI/2,0,0]]],XYZ:[[new S.Mesh(new S.OctahedronGeometry(.1,0),d.clone()),[0,0,0]]],XY:[[new S.Mesh(new S.BoxGeometry(.15,.15,.01),h.clone()),[.15,.15,0]]],YZ:[[new S.Mesh(new S.BoxGeometry(.15,.15,.01),a.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new S.Mesh(new S.BoxGeometry(.15,.15,.01),l.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},w={X:[[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[.3,0,0],[0,0,-Math.PI/2]],[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[0,.3,0]],[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[0,-.3,0],[0,0,Math.PI]]],Z:[[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[0,0,.3],[Math.PI/2,0,0]],[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new S.Mesh(new S.OctahedronGeometry(.2,0),e)]],XY:[[new S.Mesh(new S.BoxGeometry(.2,.2,.01),e),[.15,.15,0]]],YZ:[[new S.Mesh(new S.BoxGeometry(.2,.2,.01),e),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new S.Mesh(new S.BoxGeometry(.2,.2,.01),e),[.15,0,.15],[-Math.PI/2,0,0]]]},O={START:[[new S.Mesh(new S.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],END:[[new S.Mesh(new S.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],DELTA:[[new S.Line(g(),i),null,null,null,"helper"]],X:[[new S.Line(m,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new S.Line(m,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new S.Line(m,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},M={XYZE:[[new S.Mesh(R(.5,1),E),null,[0,Math.PI/2,0]]],X:[[new S.Mesh(R(.5,.5),n)]],Y:[[new S.Mesh(R(.5,.5),r),null,[0,0,-Math.PI/2]]],Z:[[new S.Mesh(R(.5,.5),o),null,[0,Math.PI/2,0]]],E:[[new S.Mesh(R(.75,1),u),null,[0,Math.PI/2,0]]]},b={AXIS:[[new S.Line(m,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},v={XYZE:[[new S.Mesh(new S.SphereGeometry(.25,10,8),e)]],X:[[new S.Mesh(new S.TorusGeometry(.5,.1,4,24),e),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new S.Mesh(new S.TorusGeometry(.5,.1,4,24),e),[0,0,0],[Math.PI/2,0,0]]],Z:[[new S.Mesh(new S.TorusGeometry(.5,.1,4,24),e),[0,0,0],[0,0,-Math.PI/2]]],E:[[new S.Mesh(new S.TorusGeometry(.75,.1,2,24),e)]]},k={X:[[new S.Mesh(I,n),[.5,0,0],[0,0,-Math.PI/2]],[new S.Mesh(C,n),[0,0,0],[0,0,-Math.PI/2]],[new S.Mesh(I,n),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new S.Mesh(I,r),[0,.5,0]],[new S.Mesh(C,r)],[new S.Mesh(I,r),[0,-.5,0],[0,0,Math.PI]]],Z:[[new S.Mesh(I,o),[0,0,.5],[Math.PI/2,0,0]],[new S.Mesh(C,o),[0,0,0],[Math.PI/2,0,0]],[new S.Mesh(I,o),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new S.Mesh(new S.BoxGeometry(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new S.Mesh(new S.BoxGeometry(.15,.15,.01),a),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new S.Mesh(new S.BoxGeometry(.15,.15,.01),l),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new S.Mesh(new S.BoxGeometry(.1,.1,.1),d.clone())]]},F={X:[[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[.3,0,0],[0,0,-Math.PI/2]],[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[0,.3,0]],[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[0,-.3,0],[0,0,Math.PI]]],Z:[[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[0,0,.3],[Math.PI/2,0,0]],[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new S.Mesh(new S.BoxGeometry(.2,.2,.01),e),[.15,.15,0]]],YZ:[[new S.Mesh(new S.BoxGeometry(.2,.2,.01),e),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new S.Mesh(new S.BoxGeometry(.2,.2,.01),e),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new S.Mesh(new S.BoxGeometry(.2,.2,.2),e),[0,0,0]]]},L={X:[[new S.Line(m,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new S.Line(m,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new S.Line(m,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function _(D){const q=new S.Object3D;for(const G in D)for(let et=D[G].length;et--;){const W=D[G][et][0].clone(),nt=D[G][et][1],V=D[G][et][2],B=D[G][et][3],rt=D[G][et][4];W.name=G,W.tag=rt,nt&&W.position.set(nt[0],nt[1],nt[2]),V&&W.rotation.set(V[0],V[1],V[2]),B&&W.scale.set(B[0],B[1],B[2]),W.updateMatrix();const st=W.geometry.clone();st.applyMatrix4(W.matrix),W.geometry=st,W.renderOrder=1/0,W.position.set(0,0,0),W.rotation.set(0,0,0),W.scale.set(1,1,1),q.add(W)}return q}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=_(y)),this.add(this.gizmo.rotate=_(M)),this.add(this.gizmo.scale=_(k)),this.add(this.picker.translate=_(w)),this.add(this.picker.rotate=_(v)),this.add(this.picker.scale=_(F)),this.add(this.helper.translate=_(O)),this.add(this.helper.rotate=_(b)),this.add(this.helper.scale=_(L)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(s){const e=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:qs;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let i=[];i=i.concat(this.picker[this.mode].children),i=i.concat(this.gizmo[this.mode].children),i=i.concat(this.helper[this.mode].children);for(let n=0;n<i.length;n++){const r=i[n];r.visible=!0,r.rotation.set(0,0,0),r.position.copy(this.worldPosition);let o;if(this.camera.isOrthographicCamera?o=(this.camera.top-this.camera.bottom)/this.camera.zoom:o=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),r.scale.set(1,1,1).multiplyScalar(o*this.size/4),r.tag==="helper"){r.visible=!1,r.name==="AXIS"?(r.visible=!!this.axis,this.axis==="X"&&(Rt.setFromEuler(Hs.set(0,0,0)),r.quaternion.copy(e).multiply(Rt),Math.abs(It.copy(us).applyQuaternion(e).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="Y"&&(Rt.setFromEuler(Hs.set(0,0,Math.PI/2)),r.quaternion.copy(e).multiply(Rt),Math.abs(It.copy(ye).applyQuaternion(e).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="Z"&&(Rt.setFromEuler(Hs.set(0,Math.PI/2,0)),r.quaternion.copy(e).multiply(Rt),Math.abs(It.copy(fs).applyQuaternion(e).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="XYZE"&&(Rt.setFromEuler(Hs.set(0,Math.PI/2,0)),It.copy(this.rotationAxis),r.quaternion.setFromRotationMatrix(lr.lookAt(cr,It,ye)),r.quaternion.multiply(Rt),r.visible=this.dragging),this.axis==="E"&&(r.visible=!1)):r.name==="START"?(r.position.copy(this.worldPositionStart),r.visible=this.dragging):r.name==="END"?(r.position.copy(this.worldPosition),r.visible=this.dragging):r.name==="DELTA"?(r.position.copy(this.worldPositionStart),r.quaternion.copy(this.worldQuaternionStart),Mt.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Mt.applyQuaternion(this.worldQuaternionStart.clone().invert()),r.scale.copy(Mt),r.visible=this.dragging):(r.quaternion.copy(e),this.dragging?r.position.copy(this.worldPositionStart):r.position.copy(this.worldPosition),this.axis&&(r.visible=this.axis.search(r.name)!==-1));continue}r.quaternion.copy(e),this.mode==="translate"||this.mode==="scale"?(r.name==="X"&&Math.abs(It.copy(us).applyQuaternion(e).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Y"&&Math.abs(It.copy(ye).applyQuaternion(e).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Z"&&Math.abs(It.copy(fs).applyQuaternion(e).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XY"&&Math.abs(It.copy(fs).applyQuaternion(e).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="YZ"&&Math.abs(It.copy(us).applyQuaternion(e).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XZ"&&Math.abs(It.copy(ye).applyQuaternion(e).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1)):this.mode==="rotate"&&(Ws.copy(e),It.copy(this.eye).applyQuaternion(Rt.copy(e).invert()),r.name.search("E")!==-1&&r.quaternion.setFromRotationMatrix(lr.lookAt(this.eye,cr,ye)),r.name==="X"&&(Rt.setFromAxisAngle(us,Math.atan2(-It.y,It.z)),Rt.multiplyQuaternions(Ws,Rt),r.quaternion.copy(Rt)),r.name==="Y"&&(Rt.setFromAxisAngle(ye,Math.atan2(It.x,It.z)),Rt.multiplyQuaternions(Ws,Rt),r.quaternion.copy(Rt)),r.name==="Z"&&(Rt.setFromAxisAngle(fs,Math.atan2(It.y,It.x)),Rt.multiplyQuaternions(Ws,Rt),r.quaternion.copy(Rt))),r.visible=r.visible&&(r.name.indexOf("X")===-1||this.showX),r.visible=r.visible&&(r.name.indexOf("Y")===-1||this.showY),r.visible=r.visible&&(r.name.indexOf("Z")===-1||this.showZ),r.visible=r.visible&&(r.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),r.material._color=r.material._color||r.material.color.clone(),r.material._opacity=r.material._opacity||r.material.opacity,r.material.color.copy(r.material._color),r.material.opacity=r.material._opacity,this.enabled&&this.axis&&(r.name===this.axis||this.axis.split("").some(function(a){return r.name===a}))&&(r.material.color.setHex(16776960),r.material.opacity=1)}super.updateMatrixWorld(s)}}class Ya extends S.Mesh{constructor(){super(new S.PlaneGeometry(1e5,1e5,2,2),new S.MeshBasicMaterial({visible:!1,wireframe:!0,side:S.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(s){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),Xs.copy(us).applyQuaternion(t==="local"?this.worldQuaternion:qs),cs.copy(ye).applyQuaternion(t==="local"?this.worldQuaternion:qs),ls.copy(fs).applyQuaternion(t==="local"?this.worldQuaternion:qs),It.copy(cs),this.mode){case"translate":case"scale":switch(this.axis){case"X":It.copy(this.eye).cross(Xs),se.copy(Xs).cross(It);break;case"Y":It.copy(this.eye).cross(cs),se.copy(cs).cross(It);break;case"Z":It.copy(this.eye).cross(ls),se.copy(ls).cross(It);break;case"XY":se.copy(ls);break;case"YZ":se.copy(Xs);break;case"XZ":It.copy(ls),se.copy(cs);break;case"XYZ":case"E":se.set(0,0,0);break}break;case"rotate":default:se.set(0,0,0)}se.length()===0?this.quaternion.copy(this.cameraQuaternion):(hr.lookAt(Mt.set(0,0,0),se,It),this.quaternion.setFromRotationMatrix(hr)),super.updateMatrixWorld(s)}}class wi{constructor(s,t,e,i,n,r=5,o=!0){T(this,"onDraggingStarted",new Q);T(this,"onDraggingEnded",new Q);T(this,"onDisposed",new Q);T(this,"normal");T(this,"origin");T(this,"three",new x.Plane);T(this,"components");T(this,"world");T(this,"type","default");T(this,"_helper");T(this,"_visible",!0);T(this,"_enabled",!0);T(this,"_controlsActive",!1);T(this,"_arrowBoundBox",new x.Mesh);T(this,"_planeMesh");T(this,"_controls");T(this,"_hiddenMaterial",new x.MeshBasicMaterial({visible:!1}));T(this,"update",()=>{this._enabled&&this.three.setFromNormalAndCoplanarPoint(this.normal,this._helper.position)});T(this,"changeDrag",s=>{this._visible=!s.value,this.preventCameraMovement(),this.notifyDraggingChanged(s)});if(this.components=s,this.world=t,!t.renderer)throw new Error("The given world must have a renderer!");this.normal=i,this.origin=e,t.renderer.setPlane(!0,this.three),this._planeMesh=wi.newPlaneMesh(r,n),this._helper=this.newHelper(),this._controls=this.newTransformControls(),this.three.setFromNormalAndCoplanarPoint(i,e),o&&this.toggleControls(!0)}get enabled(){return this._enabled}set enabled(s){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");this._enabled=s,this.world.renderer.setPlane(s,this.three)}get visible(){return this._visible}set visible(s){this._visible=s,this._controls.visible=s,this._helper.visible=s,this.toggleControls(s)}get meshes(){return[this._planeMesh,this._arrowBoundBox]}get planeMaterial(){return this._planeMesh.material}set planeMaterial(s){this._planeMesh.material=s}get size(){return this._planeMesh.scale.x}set size(s){this._planeMesh.scale.set(s,s,s)}get helper(){return this._helper}setFromNormalAndCoplanarPoint(s,t){this.reset(),this.normal.equals(s)||(this.normal.copy(s),this._helper.lookAt(s)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix(),this.update()}dispose(){this._enabled=!1,this.onDraggingStarted.reset(),this.onDraggingEnded.reset(),this._helper.removeFromParent(),this.world.renderer&&this.world.renderer.setPlane(!1,this.three),this._arrowBoundBox.removeFromParent(),this._arrowBoundBox.geometry.dispose(),this._planeMesh.geometry.dispose(),this._controls.removeFromParent(),this._controls.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}reset(){const s=new x.Vector3(1,0,0),t=new x.Vector3;this.normal.equals(s)||(this.normal.copy(s),this._helper.lookAt(s)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix()}toggleControls(s){if(s){if(this._controlsActive)return;this._controls.addEventListener("change",this.update),this._controls.addEventListener("dragging-changed",this.changeDrag)}else this._controls.removeEventListener("change",this.update),this._controls.removeEventListener("dragging-changed",this.changeDrag);this._controlsActive=s}newTransformControls(){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");const s=this.world.camera.three,t=this.world.renderer.three.domElement,e=new Da(s,t);return this.initializeControls(e),this.world.scene.three.add(e),e}initializeControls(s){s.attach(this._helper),s.showX=!1,s.showY=!1,s.setSpace("local"),this.createArrowBoundingBox(),s.children[0].children[0].add(this._arrowBoundBox)}createArrowBoundingBox(){this._arrowBoundBox.geometry=new x.CylinderGeometry(.18,.18,1.2),this._arrowBoundBox.material=this._hiddenMaterial,this._arrowBoundBox.rotateX(Math.PI/2),this._arrowBoundBox.updateMatrix(),this._arrowBoundBox.geometry.applyMatrix4(this._arrowBoundBox.matrix)}notifyDraggingChanged(s){s.value?this.onDraggingStarted.trigger():this.onDraggingEnded.trigger()}preventCameraMovement(){this.world.camera.enabled=this._visible}newHelper(){const s=new x.Object3D;return s.lookAt(this.normal),s.position.copy(this.origin),this._planeMesh.position.z+=.01,s.add(this._planeMesh),this.world.scene.three.add(s),s}static newPlaneMesh(s,t){const e=new x.PlaneGeometry(1),i=new x.Mesh(e,t);return i.scale.set(s,s,s),i}}const gs=class gs extends Ft{constructor(t){super(t);T(this,"onBeforeDrag",new Q);T(this,"onAfterDrag",new Q);T(this,"onBeforeCreate",new Q);T(this,"onBeforeCancel",new Q);T(this,"onAfterCancel",new Q);T(this,"onBeforeDelete",new Q);T(this,"onAfterCreate",new Q);T(this,"onAfterDelete",new Q);T(this,"onDisposed",new Q);T(this,"orthogonalY",!1);T(this,"toleranceOrthogonalY",.7);T(this,"Type",wi);T(this,"list",[]);T(this,"_material",new x.MeshBasicMaterial({color:12255487,side:x.DoubleSide,transparent:!0,opacity:.2}));T(this,"_size",5);T(this,"_enabled",!1);T(this,"_visible",!0);T(this,"_onStartDragging",()=>{this.onBeforeDrag.trigger()});T(this,"_onEndDragging",()=>{this.onAfterDrag.trigger()});this.components.add(gs.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const e of this.list)e.enabled=t;this.updateMaterialsAndPlanes()}get visible(){return this._visible}set visible(t){this._visible=t;for(const e of this.list)e.visible=t}get material(){return this._material}set material(t){this._material=t;for(const e of this.list)e.planeMaterial=t}get size(){return this._size}set size(t){this._size=t;for(const e of this.list)e.size=t}dispose(){this._enabled=!1;for(const t of this.list)t.dispose();this.list.length=0,this._material.dispose(),this.onBeforeCreate.reset(),this.onBeforeCancel.reset(),this.onBeforeDelete.reset(),this.onBeforeDrag.reset(),this.onAfterCreate.reset(),this.onAfterCancel.reset(),this.onAfterDelete.reset(),this.onAfterDrag.reset(),this.onDisposed.trigger(gs.uuid),this.onDisposed.reset()}create(t){const n=this.components.get(Ne).get(t).castRay();return n?this.createPlaneFromIntersection(t,n):null}createFromNormalAndCoplanarPoint(t,e,i){const n=this.newPlane(t,i,e);return this.updateMaterialsAndPlanes(),n}delete(t,e){e||(e=this.pickPlane(t)),e&&this.deletePlane(e)}deleteAll(t){const e=[...this.list];for(const i of e)if(!t||t.has(i.type)){this.delete(i.world,i);const n=this.list.indexOf(i);n!==-1&&this.list.splice(n,1)}}deletePlane(t){const e=this.list.indexOf(t);if(e!==-1){if(this.list.splice(e,1),!t.world.renderer)throw new Error("Renderer not found for this plane's world!");t.world.renderer.setPlane(!1,t.three),t.dispose(),this.updateMaterialsAndPlanes(),this.onAfterDelete.trigger(t)}}pickPlane(t){const i=this.components.get(Ne).get(t),n=this.getAllPlaneMeshes(),r=i.castRay(n);if(r){const o=r.object;return this.list.find(a=>a.meshes.includes(o))}}getAllPlaneMeshes(){const t=[];for(const e of this.list)t.push(...e.meshes);return t}createPlaneFromIntersection(t,e){var a;if(!t.renderer)throw new Error("The given world must have a renderer!");const i=e.point.distanceTo(new x.Vector3(0,0,0)),n=(a=e.face)==null?void 0:a.normal;if(!i||!n)return null;const r=this.getWorldNormal(e,n),o=this.newPlane(t,e.point,r.negate());return o.visible=this._visible,o.size=this._size,t.renderer.setPlane(!0,o.three),this.updateMaterialsAndPlanes(),o}getWorldNormal(t,e){const i=t.object;let n=t.object.matrixWorld.clone();if(i instanceof x.InstancedMesh&&t.instanceId!==void 0){const l=new x.Matrix4;i.getMatrixAt(t.instanceId,l),n=l.multiply(n)}const o=new x.Matrix3().getNormalMatrix(n),a=e.clone().applyMatrix3(o).normalize();return this.normalizePlaneDirectionY(a),a}normalizePlaneDirectionY(t){this.orthogonalY&&(t.y>this.toleranceOrthogonalY&&(t.x=0,t.y=1,t.z=0),t.y<-this.toleranceOrthogonalY&&(t.x=0,t.y=-1,t.z=0))}newPlane(t,e,i){const n=new this.Type(this.components,t,e,i,this._material);return n.onDraggingStarted.add(this._onStartDragging),n.onDraggingEnded.add(this._onEndDragging),this.list.push(n),this.onAfterCreate.trigger(n),n}updateMaterialsAndPlanes(){const t=this.components.get(ti);for(const[e,i]of t.list){if(!i.renderer)continue;i.renderer.updateClippingPlanes();const{clippingPlanes:n}=i.renderer;for(const r of i.meshes)if(r.material)if(Array.isArray(r.material))for(const o of r.material)o.clippingPlanes=n;else r.material.clippingPlanes=n}}};T(gs,"uuid","66290bc5-18c4-4cd1-9379-2e17a0617611");let si=gs;class Dr{constructor(s){T(this,"enabled",!1);T(this,"id","FirstPerson");this.camera=s}set(s){if(this.enabled=s,s){if(this.camera.projection.current!=="Perspective"){this.camera.set("Orbit");return}this.setupFirstPersonCamera()}}setupFirstPersonCamera(){const s=this.camera.controls,t=new x.Vector3;s.distance--,s.getPosition(t),s.minDistance=1,s.maxDistance=1,s.distance=1,s.moveTo(t.x,t.y,t.z),s.truckSpeed=50,s.mouseButtons.wheel=xt.ACTION.DOLLY,s.touches.two=xt.ACTION.TOUCH_ZOOM_TRUCK}}class Ur{constructor(s){T(this,"enabled",!0);T(this,"id","Orbit");this.camera=s,this.activateOrbitControls()}set(s){this.enabled=s,s&&this.activateOrbitControls()}activateOrbitControls(){const s=this.camera.controls;s.minDistance=1,s.maxDistance=300;const t=new x.Vector3;s.getPosition(t);const e=t.length();s.distance=e,s.truckSpeed=2;const{rotation:i}=this.camera.three,n=new x.Vector3(0,0,-1).applyEuler(i),r=t.addScaledVector(n,e);s.moveTo(r.x,r.y,r.z)}}class Br{constructor(s){T(this,"enabled",!1);T(this,"id","Plan");T(this,"mouseAction1");T(this,"mouseAction2");T(this,"mouseInitialized",!1);T(this,"defaultAzimuthSpeed");T(this,"defaultPolarSpeed");this.camera=s,this.defaultAzimuthSpeed=s.controls.azimuthRotateSpeed,this.defaultPolarSpeed=s.controls.polarRotateSpeed}set(s){this.enabled=s;const t=this.camera.controls;t.azimuthRotateSpeed=s?0:this.defaultAzimuthSpeed,t.polarRotateSpeed=s?0:this.defaultPolarSpeed,this.mouseInitialized||(this.mouseAction1=t.touches.one,this.mouseAction2=t.touches.two,this.mouseInitialized=!0),s?(t.mouseButtons.left=xt.ACTION.TRUCK,t.touches.one=xt.ACTION.TOUCH_TRUCK,t.touches.two=xt.ACTION.TOUCH_ZOOM):(t.mouseButtons.left=xt.ACTION.ROTATE,t.touches.one=this.mouseAction1,t.touches.two=this.mouseAction2)}}class zr{constructor(s){T(this,"onChanged",new Q);T(this,"current","Perspective");T(this,"camera");T(this,"matchOrthoDistanceEnabled",!1);T(this,"_component");T(this,"_previousDistance",-1);this._component=s,this.camera=s.three}async set(s){this.current!==s&&(s==="Orthographic"?this.setOrthoCamera():await this.setPerspectiveCamera(),this.onChanged.trigger(this.camera))}async toggle(){const t=this.current==="Perspective"?"Orthographic":"Perspective";await this.set(t)}setOrthoCamera(){if(this._component.mode===null||this._component.mode.id==="FirstPerson")return;this._previousDistance=this._component.controls.distance,this._component.controls.distance=200;const s=this.getPerspectiveDims();if(!s)return;const{width:t,height:e}=s;this.setupOrthoCamera(e,t),this.camera=this._component.threeOrtho,this.current="Orthographic"}getPerspectiveDims(){const s=this._component.currentWorld;if(!s||!s.renderer)return null;const t=new x.Vector3;this._component.threePersp.getWorldDirection(t);const e=new x.Vector3;this._component.controls.getTarget(e);const n=e.clone().sub(this._component.threePersp.position).dot(t),r=s.renderer.getSize(),o=r.x/r.y,a=this._component.threePersp,l=n*2*Math.atan(a.fov*(Math.PI/180)/2);return{width:l*o,height:l}}setupOrthoCamera(s,t){this._component.controls.mouseButtons.wheel=xt.ACTION.ZOOM,this._component.controls.mouseButtons.middle=xt.ACTION.ZOOM;const e=this._component.threePersp,i=this._component.threeOrtho;i.zoom=1,i.left=t/-2,i.right=t/2,i.top=s/2,i.bottom=s/-2,i.updateProjectionMatrix(),i.position.copy(e.position),i.quaternion.copy(e.quaternion),this._component.controls.camera=i}getDistance(){const s=this._component.threePersp,t=this._component.threeOrtho;return(t.top-t.bottom)/t.zoom/(2*Math.atan(s.fov*(Math.PI/180)/2))}async setPerspectiveCamera(){this._component.controls.mouseButtons.wheel=xt.ACTION.DOLLY,this._component.controls.mouseButtons.middle=xt.ACTION.DOLLY;const s=this._component.threePersp,t=this._component.threeOrtho;s.position.copy(t.position),s.quaternion.copy(t.quaternion),this._component.controls.mouseButtons.wheel=xt.ACTION.DOLLY,this.matchOrthoDistanceEnabled?this._component.controls.distance=this.getDistance():this._component.controls.distance=this._previousDistance,await this._component.controls.zoomTo(1),s.updateProjectionMatrix(),this._component.controls.camera=s,this.camera=s,this.current="Perspective"}}class Vr extends We{constructor(t){super(t);T(this,"projection");T(this,"threeOrtho");T(this,"threePersp");T(this,"_userInputButtons",{});T(this,"_frustumSize",50);T(this,"_navigationModes",new Map);T(this,"_mode",null);T(this,"previousSize",null);this.threePersp=this.three,this.threeOrtho=this.newOrthoCamera(),this.projection=new zr(this),this.onAspectUpdated.add(()=>{this.setOrthoPerspCameraAspect()}),this.projection.onChanged.add(e=>{this.three=e,this.updateAspect()}),this.onWorldChanged.add(({action:e})=>{e==="added"&&(this._navigationModes.clear(),this._navigationModes.set("Orbit",new Ur(this)),this._navigationModes.set("FirstPerson",new Dr(this)),this._navigationModes.set("Plan",new Br(this)),this._mode=this._navigationModes.get("Orbit"),this.mode.set(!0,{preventTargetAdjustment:!0}),this.currentWorld&&this.currentWorld.renderer&&(this.previousSize=this.currentWorld.renderer.getSize().clone()))})}get mode(){if(!this._mode)throw new Error("Mode not found, camera not initialized");return this._mode}dispose(){super.dispose(),this.threeOrtho.removeFromParent()}set(t){if(this.mode!==null&&this.mode.id!==t){if(this.mode.set(!1),!this._navigationModes.has(t))throw new Error("The specified mode does not exist!");this._mode=this._navigationModes.get(t),this.mode.set(!0)}}async fit(t,e=1.5){if(!this.enabled)return;const i=Number.MAX_VALUE,n=Number.MIN_VALUE,r=new x.Vector3(i,i,i),o=new x.Vector3(n,n,n);for(const f of t){const E=new x.Box3().setFromObject(f);E.min.x<r.x&&(r.x=E.min.x),E.min.y<r.y&&(r.y=E.min.y),E.min.z<r.z&&(r.z=E.min.z),E.max.x>o.x&&(o.x=E.max.x),E.max.y>o.y&&(o.y=E.max.y),E.max.z>o.z&&(o.z=E.max.z)}const a=new x.Box3(r,o),l=new x.Vector3;a.getSize(l);const h=new x.Vector3;a.getCenter(h);const d=Math.max(l.x,l.y,l.z)*e,u=new x.Sphere(h,d);await this.controls.fitToSphere(u,!0)}setUserInput(t){t?this.enableUserInput():this.disableUserInput()}disableUserInput(){this._userInputButtons.left=this.controls.mouseButtons.left,this._userInputButtons.right=this.controls.mouseButtons.right,this._userInputButtons.middle=this.controls.mouseButtons.middle,this._userInputButtons.wheel=this.controls.mouseButtons.wheel,this.controls.mouseButtons.left=0,this.controls.mouseButtons.right=0,this.controls.mouseButtons.middle=0,this.controls.mouseButtons.wheel=0}enableUserInput(){Object.keys(this._userInputButtons).length!==0&&(this.controls.mouseButtons.left=this._userInputButtons.left,this.controls.mouseButtons.right=this._userInputButtons.right,this.controls.mouseButtons.middle=this._userInputButtons.middle,this.controls.mouseButtons.wheel=this._userInputButtons.wheel)}newOrthoCamera(){const t=window.innerWidth/window.innerHeight;return new x.OrthographicCamera(this._frustumSize*t/-2,this._frustumSize*t/2,this._frustumSize/2,this._frustumSize/-2,.1,1e3)}setOrthoPerspCameraAspect(){if(!this.currentWorld||!this.currentWorld.renderer||!this.previousSize)return;const t=this.currentWorld.renderer.getSize(),e=this.threeOrtho.top,i=this.threeOrtho.right,n=t.y/this.previousSize.y,r=t.x/this.previousSize.x,o=e*n,a=i*r;this.threeOrtho.left=-a,this.threeOrtho.right=a,this.threeOrtho.top=o,this.threeOrtho.bottom=-o,this.threeOrtho.updateProjectionMatrix(),this.previousSize.copy(t)}}const ln=new Map([[Z.IFCRELAGGREGATES,{forRelated:"Decomposes",forRelating:"IsDecomposedBy"}],[Z.IFCRELASSOCIATESMATERIAL,{forRelated:"HasAssociations",forRelating:"AssociatedTo"}],[Z.IFCRELASSOCIATESCLASSIFICATION,{forRelated:"HasAssociations",forRelating:"ClassificationForObjects"}],[Z.IFCRELASSIGNSTOGROUP,{forRelated:"HasAssignments",forRelating:"IsGroupedBy"}],[Z.IFCRELDEFINESBYPROPERTIES,{forRelated:"IsDefinedBy",forRelating:"DefinesOcurrence"}],[Z.IFCRELDEFINESBYTYPE,{forRelated:"IsTypedBy",forRelating:"Types"}],[Z.IFCRELDEFINESBYTEMPLATE,{forRelated:"IsDefinedBy",forRelating:"Defines"}],[Z.IFCRELCONTAINEDINSPATIALSTRUCTURE,{forRelated:"ContainedInStructure",forRelating:"ContainsElements"}],[Z.IFCRELFLOWCONTROLELEMENTS,{forRelated:"AssignedToFlowElement",forRelating:"HasControlElements"}],[Z.IFCRELCONNECTSELEMENTS,{forRelated:"ConnectedFrom",forRelating:"ConnectedTo"}],[Z.IFCRELASSIGNSTOPRODUCT,{forRelated:"HasAssignments",forRelating:"ReferencedBy"}],[Z.IFCRELDECLARES,{forRelated:"HasContext",forRelating:"Declares"}],[Z.IFCRELASSIGNSTOCONTROL,{forRelated:"HasAssignments",forRelating:"Controls"}],[Z.IFCRELNESTS,{forRelated:"Nests",forRelating:"IsNestedBy"}],[Z.IFCRELASSOCIATESDOCUMENT,{forRelated:"HasAssociations",forRelating:"DocumentRefForObjects"}]]),kr={103090709:"IFCPROJECT",4097777520:"IFCSITE",4031249490:"IFCBUILDING",3124254112:"IFCBUILDINGSTOREY",3856911033:"IFCSPACE",1674181508:"IFCANNOTATION",25142252:"IFCCONTROLLER",32344328:"IFCBOILER",76236018:"IFCLAMP",90941305:"IFCPUMP",177149247:"IFCAIRTERMINALBOX",182646315:"IFCFLOWINSTRUMENT",263784265:"IFCFURNISHINGELEMENT",264262732:"IFCELECTRICGENERATOR",277319702:"IFCAUDIOVISUALAPPLIANCE",310824031:"IFCPIPEFITTING",331165859:"IFCSTAIR",342316401:"IFCDUCTFITTING",377706215:"IFCMECHANICALFASTENER",395920057:"IFCDOOR",402227799:"IFCELECTRICMOTOR",413509423:"IFCSYSTEMFURNITUREELEMENT",484807127:"IFCEVAPORATOR",486154966:"IFCWINDOWSTANDARDCASE",629592764:"IFCLIGHTFIXTURE",630975310:"IFCUNITARYCONTROLELEMENT",635142910:"IFCCABLECARRIERFITTING",639361253:"IFCCOIL",647756555:"IFCFASTENER",707683696:"IFCFLOWSTORAGEDEVICE",738039164:"IFCPROTECTIVEDEVICE",753842376:"IFCBEAM",812556717:"IFCTANK",819412036:"IFCFILTER",843113511:"IFCCOLUMN",862014818:"IFCELECTRICDISTRIBUTIONBOARD",900683007:"IFCFOOTING",905975707:"IFCCOLUMNSTANDARDCASE",926996030:"IFCVOIDINGFEATURE",979691226:"IFCREINFORCINGBAR",987401354:"IFCFLOWSEGMENT",1003880860:"IFCELECTRICTIMECONTROL",1051757585:"IFCCABLEFITTING",1052013943:"IFCDISTRIBUTIONCHAMBERELEMENT",1062813311:"IFCDISTRIBUTIONCONTROLELEMENT",1073191201:"IFCMEMBER",1095909175:"IFCBUILDINGELEMENTPROXY",1156407060:"IFCPLATESTANDARDCASE",1162798199:"IFCSWITCHINGDEVICE",1329646415:"IFCSHADINGDEVICE",1335981549:"IFCDISCRETEACCESSORY",1360408905:"IFCDUCTSILENCER",1404847402:"IFCSTACKTERMINAL",1426591983:"IFCFIRESUPPRESSIONTERMINAL",1437502449:"IFCMEDICALDEVICE",1509553395:"IFCFURNITURE",1529196076:"IFCSLAB",1620046519:"IFCTRANSPORTELEMENT",1634111441:"IFCAIRTERMINAL",1658829314:"IFCENERGYCONVERSIONDEVICE",1677625105:"IFCCIVILELEMENT",1687234759:"IFCPILE",1904799276:"IFCELECTRICAPPLIANCE",1911478936:"IFCMEMBERSTANDARDCASE",1945004755:"IFCDISTRIBUTIONELEMENT",1973544240:"IFCCOVERING",1999602285:"IFCSPACEHEATER",2016517767:"IFCROOF",2056796094:"IFCAIRTOAIRHEATRECOVERY",2058353004:"IFCFLOWCONTROLLER",2068733104:"IFCHUMIDIFIER",2176052936:"IFCJUNCTIONBOX",2188021234:"IFCFLOWMETER",2223149337:"IFCFLOWTERMINAL",2262370178:"IFCRAILING",2272882330:"IFCCONDENSER",2295281155:"IFCPROTECTIVEDEVICETRIPPINGUNIT",2320036040:"IFCREINFORCINGMESH",2347447852:"IFCTENDONANCHOR",2391383451:"IFCVIBRATIONISOLATOR",2391406946:"IFCWALL",2474470126:"IFCMOTORCONNECTION",2769231204:"IFCVIRTUALELEMENT",2814081492:"IFCENGINE",2906023776:"IFCBEAMSTANDARDCASE",2938176219:"IFCBURNER",2979338954:"IFCBUILDINGELEMENTPART",3024970846:"IFCRAMP",3026737570:"IFCTUBEBUNDLE",3027962421:"IFCSLABSTANDARDCASE",3040386961:"IFCDISTRIBUTIONFLOWELEMENT",3053780830:"IFCSANITARYTERMINAL",3079942009:"IFCOPENINGSTANDARDCASE",3087945054:"IFCALARM",3101698114:"IFCSURFACEFEATURE",3127900445:"IFCSLABELEMENTEDCASE",3132237377:"IFCFLOWMOVINGDEVICE",3171933400:"IFCPLATE",3221913625:"IFCCOMMUNICATIONSAPPLIANCE",3242481149:"IFCDOORSTANDARDCASE",3283111854:"IFCRAMPFLIGHT",3296154744:"IFCCHIMNEY",3304561284:"IFCWINDOW",3310460725:"IFCELECTRICFLOWSTORAGEDEVICE",3319311131:"IFCHEATEXCHANGER",3415622556:"IFCFAN",3420628829:"IFCSOLARDEVICE",3493046030:"IFCGEOGRAPHICELEMENT",3495092785:"IFCCURTAINWALL",3508470533:"IFCFLOWTREATMENTDEVICE",3512223829:"IFCWALLSTANDARDCASE",3518393246:"IFCDUCTSEGMENT",3571504051:"IFCCOMPRESSOR",3588315303:"IFCOPENINGELEMENT",3612865200:"IFCPIPESEGMENT",3640358203:"IFCCOOLINGTOWER",3651124850:"IFCPROJECTIONELEMENT",3694346114:"IFCOUTLET",3747195512:"IFCEVAPORATIVECOOLER",3758799889:"IFCCABLECARRIERSEGMENT",3824725483:"IFCTENDON",3825984169:"IFCTRANSFORMER",3902619387:"IFCCHILLER",4074379575:"IFCDAMPER",4086658281:"IFCSENSOR",4123344466:"IFCELEMENTASSEMBLY",4136498852:"IFCCOOLEDBEAM",4156078855:"IFCWALLELEMENTEDCASE",4175244083:"IFCINTERCEPTOR",4207607924:"IFCVALVE",4217484030:"IFCCABLESEGMENT",4237592921:"IFCWASTETERMINAL",4252922144:"IFCSTAIRFLIGHT",4278956645:"IFCFLOWFITTING",4288193352:"IFCACTUATOR",4292641817:"IFCUNITARYEQUIPMENT",3009204131:"IFCGRID"};class Ha{getAll(s,t){const e={},i=Object.keys(kr).map(n=>parseInt(n,10));for(let n=0;n<i.length;n++){const r=i[n],o=s.GetLineIDsWithType(t,r),a=o.size();for(let l=0;l<a;l++)e[o.get(l)]=r}return e}}const _n={950732822:"IFCURIREFERENCE",4075327185:"IFCTIME",1209108979:"IFCTEMPERATURERATEOFCHANGEMEASURE",3457685358:"IFCSOUNDPRESSURELEVELMEASURE",4157543285:"IFCSOUNDPOWERLEVELMEASURE",2798247006:"IFCPROPERTYSETDEFINITIONSET",1790229001:"IFCPOSITIVEINTEGER",525895558:"IFCNONNEGATIVELENGTHMEASURE",1774176899:"IFCLINEINDEX",1275358634:"IFCLANGUAGEID",2541165894:"IFCDURATION",3701338814:"IFCDAYINWEEKNUMBER",2195413836:"IFCDATETIME",937566702:"IFCDATE",1683019596:"IFCCARDINALPOINTREFERENCE",2314439260:"IFCBINARY",1500781891:"IFCAREADENSITYMEASURE",3683503648:"IFCARCINDEX",4065007721:"IFCYEARNUMBER",1718600412:"IFCWARPINGMOMENTMEASURE",51269191:"IFCWARPINGCONSTANTMEASURE",2593997549:"IFCVOLUMETRICFLOWRATEMEASURE",3458127941:"IFCVOLUMEMEASURE",3345633955:"IFCVAPORPERMEABILITYMEASURE",1278329552:"IFCTORQUEMEASURE",2591213694:"IFCTIMESTAMP",2726807636:"IFCTIMEMEASURE",743184107:"IFCTHERMODYNAMICTEMPERATUREMEASURE",2016195849:"IFCTHERMALTRANSMITTANCEMEASURE",857959152:"IFCTHERMALRESISTANCEMEASURE",2281867870:"IFCTHERMALEXPANSIONCOEFFICIENTMEASURE",2645777649:"IFCTHERMALCONDUCTIVITYMEASURE",232962298:"IFCTHERMALADMITTANCEMEASURE",296282323:"IFCTEXTTRANSFORMATION",603696268:"IFCTEXTFONTNAME",3490877962:"IFCTEXTDECORATION",1460886941:"IFCTEXTALIGNMENT",2801250643:"IFCTEXT",58845555:"IFCTEMPERATUREGRADIENTMEASURE",361837227:"IFCSPECULARROUGHNESS",2757832317:"IFCSPECULAREXPONENT",3477203348:"IFCSPECIFICHEATCAPACITYMEASURE",993287707:"IFCSOUNDPRESSUREMEASURE",846465480:"IFCSOUNDPOWERMEASURE",3471399674:"IFCSOLIDANGLEMEASURE",408310005:"IFCSHEARMODULUSMEASURE",2190458107:"IFCSECTIONALAREAINTEGRALMEASURE",3467162246:"IFCSECTIONMODULUSMEASURE",2766185779:"IFCSECONDINMINUTE",3211557302:"IFCROTATIONALSTIFFNESSMEASURE",1755127002:"IFCROTATIONALMASSMEASURE",2133746277:"IFCROTATIONALFREQUENCYMEASURE",200335297:"IFCREAL",96294661:"IFCRATIOMEASURE",3972513137:"IFCRADIOACTIVITYMEASURE",3665567075:"IFCPRESSUREMEASURE",2169031380:"IFCPRESENTABLETEXT",1364037233:"IFCPOWERMEASURE",1245737093:"IFCPOSITIVERATIOMEASURE",3054510233:"IFCPOSITIVEPLANEANGLEMEASURE",2815919920:"IFCPOSITIVELENGTHMEASURE",4042175685:"IFCPLANEANGLEMEASURE",2642773653:"IFCPLANARFORCEMEASURE",2260317790:"IFCPARAMETERVALUE",929793134:"IFCPHMEASURE",2395907400:"IFCNUMERICMEASURE",2095195183:"IFCNORMALISEDRATIOMEASURE",765770214:"IFCMONTHINYEARNUMBER",2615040989:"IFCMONETARYMEASURE",3114022597:"IFCMOMENTOFINERTIAMEASURE",1648970520:"IFCMOLECULARWEIGHTMEASURE",3177669450:"IFCMOISTUREDIFFUSIVITYMEASURE",1753493141:"IFCMODULUSOFSUBGRADEREACTIONMEASURE",1052454078:"IFCMODULUSOFROTATIONALSUBGRADEREACTIONMEASURE",2173214787:"IFCMODULUSOFLINEARSUBGRADEREACTIONMEASURE",3341486342:"IFCMODULUSOFELASTICITYMEASURE",102610177:"IFCMINUTEINHOUR",3531705166:"IFCMASSPERLENGTHMEASURE",3124614049:"IFCMASSMEASURE",4017473158:"IFCMASSFLOWRATEMEASURE",1477762836:"IFCMASSDENSITYMEASURE",2486716878:"IFCMAGNETICFLUXMEASURE",286949696:"IFCMAGNETICFLUXDENSITYMEASURE",151039812:"IFCLUMINOUSINTENSITYMEASURE",2755797622:"IFCLUMINOUSINTENSITYDISTRIBUTIONMEASURE",2095003142:"IFCLUMINOUSFLUXMEASURE",503418787:"IFCLOGICAL",3086160713:"IFCLINEARVELOCITYMEASURE",1307019551:"IFCLINEARSTIFFNESSMEASURE",2128979029:"IFCLINEARMOMENTMEASURE",191860431:"IFCLINEARFORCEMEASURE",1243674935:"IFCLENGTHMEASURE",3258342251:"IFCLABEL",2054016361:"IFCKINEMATICVISCOSITYMEASURE",3192672207:"IFCISOTHERMALMOISTURECAPACITYMEASURE",3686016028:"IFCIONCONCENTRATIONMEASURE",3809634241:"IFCINTEGERCOUNTRATEMEASURE",1939436016:"IFCINTEGER",2679005408:"IFCINDUCTANCEMEASURE",3358199106:"IFCILLUMINANCEMEASURE",983778844:"IFCIDENTIFIER",2589826445:"IFCHOURINDAY",1158859006:"IFCHEATINGVALUEMEASURE",3113092358:"IFCHEATFLUXDENSITYMEASURE",3064340077:"IFCGLOBALLYUNIQUEID",3044325142:"IFCFREQUENCYMEASURE",1361398929:"IFCFORCEMEASURE",2590844177:"IFCFONTWEIGHT",2715512545:"IFCFONTVARIANT",1102727119:"IFCFONTSTYLE",2078135608:"IFCENERGYMEASURE",2506197118:"IFCELECTRICVOLTAGEMEASURE",2951915441:"IFCELECTRICRESISTANCEMEASURE",3790457270:"IFCELECTRICCURRENTMEASURE",2093906313:"IFCELECTRICCONDUCTANCEMEASURE",3818826038:"IFCELECTRICCHARGEMEASURE",1827137117:"IFCELECTRICCAPACITANCEMEASURE",69416015:"IFCDYNAMICVISCOSITYMEASURE",524656162:"IFCDOSEEQUIVALENTMEASURE",4134073009:"IFCDIMENSIONCOUNT",1514641115:"IFCDESCRIPTIVEMEASURE",300323983:"IFCDAYLIGHTSAVINGHOUR",86635668:"IFCDAYINMONTHNUMBER",94842927:"IFCCURVATUREMEASURE",1778710042:"IFCCOUNTMEASURE",3238673880:"IFCCONTEXTDEPENDENTMEASURE",3812528620:"IFCCOMPOUNDPLANEANGLEMEASURE",2991860651:"IFCCOMPLEXNUMBER",1867003952:"IFCBOXALIGNMENT",2735952531:"IFCBOOLEAN",2650437152:"IFCAREAMEASURE",632304761:"IFCANGULARVELOCITYMEASURE",360377573:"IFCAMOUNTOFSUBSTANCEMEASURE",4182062534:"IFCACCELERATIONMEASURE",3699917729:"IFCABSORBEDDOSEMEASURE",1971632696:"IFCGEOSLICE",2680139844:"IFCGEOMODEL",24726584:"IFCELECTRICFLOWTREATMENTDEVICE",3693000487:"IFCDISTRIBUTIONBOARD",3460952963:"IFCCONVEYORSEGMENT",3999819293:"IFCCAISSONFOUNDATION",3314249567:"IFCBOREHOLE",4196446775:"IFCBEARING",325726236:"IFCALIGNMENT",3425753595:"IFCTRACKELEMENT",991950508:"IFCSIGNAL",3798194928:"IFCREINFORCEDSOIL",3290496277:"IFCRAIL",1383356374:"IFCPAVEMENT",2182337498:"IFCNAVIGATIONELEMENT",234836483:"IFCMOORINGDEVICE",2078563270:"IFCMOBILETELECOMMUNICATIONSAPPLIANCE",1638804497:"IFCLIQUIDTERMINAL",1154579445:"IFCLINEARPOSITIONINGELEMENT",2696325953:"IFCKERB",2713699986:"IFCGEOTECHNICALASSEMBLY",2142170206:"IFCELECTRICFLOWTREATMENTDEVICETYPE",3376911765:"IFCEARTHWORKSFILL",1077100507:"IFCEARTHWORKSELEMENT",3071239417:"IFCEARTHWORKSCUT",479945903:"IFCDISTRIBUTIONBOARDTYPE",3426335179:"IFCDEEPFOUNDATION",1502416096:"IFCCOURSE",2940368186:"IFCCONVEYORSEGMENTTYPE",3203706013:"IFCCAISSONFOUNDATIONTYPE",3862327254:"IFCBUILTSYSTEM",1876633798:"IFCBUILTELEMENT",963979645:"IFCBRIDGEPART",644574406:"IFCBRIDGE",3649138523:"IFCBEARINGTYPE",1662888072:"IFCALIGNMENTVERTICAL",317615605:"IFCALIGNMENTSEGMENT",1545765605:"IFCALIGNMENTHORIZONTAL",4266260250:"IFCALIGNMENTCANT",3956297820:"IFCVIBRATIONDAMPERTYPE",1530820697:"IFCVIBRATIONDAMPER",840318589:"IFCVEHICLE",1953115116:"IFCTRANSPORTATIONDEVICE",618700268:"IFCTRACKELEMENTTYPE",2281632017:"IFCTENDONCONDUITTYPE",3663046924:"IFCTENDONCONDUIT",42703149:"IFCSINESPIRAL",1894708472:"IFCSIGNALTYPE",3599934289:"IFCSIGNTYPE",33720170:"IFCSIGN",1027922057:"IFCSEVENTHORDERPOLYNOMIALSPIRAL",544395925:"IFCSEGMENTEDREFERENCECURVE",3649235739:"IFCSECONDORDERPOLYNOMIALSPIRAL",550521510:"IFCROADPART",146592293:"IFCROAD",3818125796:"IFCRELADHERESTOELEMENT",4021432810:"IFCREFERENT",1891881377:"IFCRAILWAYPART",3992365140:"IFCRAILWAY",1763565496:"IFCRAILTYPE",1946335990:"IFCPOSITIONINGELEMENT",514975943:"IFCPAVEMENTTYPE",506776471:"IFCNAVIGATIONELEMENTTYPE",710110818:"IFCMOORINGDEVICETYPE",1950438474:"IFCMOBILETELECOMMUNICATIONSAPPLIANCETYPE",976884017:"IFCMARINEPART",525669439:"IFCMARINEFACILITY",1770583370:"IFCLIQUIDTERMINALTYPE",2176059722:"IFCLINEARELEMENT",679976338:"IFCKERBTYPE",3948183225:"IFCIMPACTPROTECTIONDEVICETYPE",2568555532:"IFCIMPACTPROTECTIONDEVICE",2898700619:"IFCGRADIENTCURVE",1594536857:"IFCGEOTECHNICALSTRATUM",4230923436:"IFCGEOTECHNICALELEMENT",4228831410:"IFCFACILITYPARTCOMMON",1310830890:"IFCFACILITYPART",24185140:"IFCFACILITY",4234616927:"IFCDIRECTRIXDERIVEDREFERENCESWEPTAREASOLID",1306400036:"IFCDEEPFOUNDATIONTYPE",4189326743:"IFCCOURSETYPE",2000195564:"IFCCOSINESPIRAL",3497074424:"IFCCLOTHOID",1626504194:"IFCBUILTELEMENTTYPE",3651464721:"IFCVEHICLETYPE",1229763772:"IFCTRIANGULATEDIRREGULARNETWORK",3665877780:"IFCTRANSPORTATIONDEVICETYPE",782932809:"IFCTHIRDORDERPOLYNOMIALSPIRAL",2735484536:"IFCSPIRAL",1356537516:"IFCSECTIONEDSURFACE",1290935644:"IFCSECTIONEDSOLIDHORIZONTAL",1862484736:"IFCSECTIONEDSOLID",1441486842:"IFCRELPOSITIONS",1033248425:"IFCRELASSOCIATESPROFILEDEF",3381221214:"IFCPOLYNOMIALCURVE",2485787929:"IFCOFFSETCURVEBYDISTANCES",590820931:"IFCOFFSETCURVE",3465909080:"IFCINDEXEDPOLYGONALTEXTUREMAP",593015953:"IFCDIRECTRIXCURVESWEPTAREASOLID",4212018352:"IFCCURVESEGMENT",3425423356:"IFCAXIS2PLACEMENTLINEAR",823603102:"IFCSEGMENT",2165702409:"IFCPOINTBYDISTANCEEXPRESSION",182550632:"IFCOPENCROSSPROFILEDEF",388784114:"IFCLINEARPLACEMENT",536804194:"IFCALIGNMENTHORIZONTALSEGMENT",3752311538:"IFCALIGNMENTCANTSEGMENT",1010789467:"IFCTEXTURECOORDINATEINDICESWITHVOIDS",222769930:"IFCTEXTURECOORDINATEINDICES",2691318326:"IFCQUANTITYNUMBER",3633395639:"IFCALIGNMENTVERTICALSEGMENT",2879124712:"IFCALIGNMENTPARAMETERSEGMENT",25142252:"IFCCONTROLLER",3087945054:"IFCALARM",4288193352:"IFCACTUATOR",630975310:"IFCUNITARYCONTROLELEMENT",4086658281:"IFCSENSOR",2295281155:"IFCPROTECTIVEDEVICETRIPPINGUNIT",182646315:"IFCFLOWINSTRUMENT",1426591983:"IFCFIRESUPPRESSIONTERMINAL",819412036:"IFCFILTER",3415622556:"IFCFAN",1003880860:"IFCELECTRICTIMECONTROL",402227799:"IFCELECTRICMOTOR",264262732:"IFCELECTRICGENERATOR",3310460725:"IFCELECTRICFLOWSTORAGEDEVICE",862014818:"IFCELECTRICDISTRIBUTIONBOARD",1904799276:"IFCELECTRICAPPLIANCE",1360408905:"IFCDUCTSILENCER",3518393246:"IFCDUCTSEGMENT",342316401:"IFCDUCTFITTING",562808652:"IFCDISTRIBUTIONCIRCUIT",4074379575:"IFCDAMPER",3640358203:"IFCCOOLINGTOWER",4136498852:"IFCCOOLEDBEAM",2272882330:"IFCCONDENSER",3571504051:"IFCCOMPRESSOR",3221913625:"IFCCOMMUNICATIONSAPPLIANCE",639361253:"IFCCOIL",3902619387:"IFCCHILLER",4217484030:"IFCCABLESEGMENT",1051757585:"IFCCABLEFITTING",3758799889:"IFCCABLECARRIERSEGMENT",635142910:"IFCCABLECARRIERFITTING",2938176219:"IFCBURNER",32344328:"IFCBOILER",2906023776:"IFCBEAMSTANDARDCASE",277319702:"IFCAUDIOVISUALAPPLIANCE",2056796094:"IFCAIRTOAIRHEATRECOVERY",177149247:"IFCAIRTERMINALBOX",1634111441:"IFCAIRTERMINAL",486154966:"IFCWINDOWSTANDARDCASE",4237592921:"IFCWASTETERMINAL",4156078855:"IFCWALLELEMENTEDCASE",4207607924:"IFCVALVE",4292641817:"IFCUNITARYEQUIPMENT",3179687236:"IFCUNITARYCONTROLELEMENTTYPE",3026737570:"IFCTUBEBUNDLE",3825984169:"IFCTRANSFORMER",812556717:"IFCTANK",1162798199:"IFCSWITCHINGDEVICE",385403989:"IFCSTRUCTURALLOADCASE",1404847402:"IFCSTACKTERMINAL",1999602285:"IFCSPACEHEATER",3420628829:"IFCSOLARDEVICE",3027962421:"IFCSLABSTANDARDCASE",3127900445:"IFCSLABELEMENTEDCASE",1329646415:"IFCSHADINGDEVICE",3053780830:"IFCSANITARYTERMINAL",2572171363:"IFCREINFORCINGBARTYPE",1232101972:"IFCRATIONALBSPLINECURVEWITHKNOTS",90941305:"IFCPUMP",655969474:"IFCPROTECTIVEDEVICETRIPPINGUNITTYPE",738039164:"IFCPROTECTIVEDEVICE",1156407060:"IFCPLATESTANDARDCASE",3612865200:"IFCPIPESEGMENT",310824031:"IFCPIPEFITTING",3694346114:"IFCOUTLET",144952367:"IFCOUTERBOUNDARYCURVE",2474470126:"IFCMOTORCONNECTION",1911478936:"IFCMEMBERSTANDARDCASE",1437502449:"IFCMEDICALDEVICE",629592764:"IFCLIGHTFIXTURE",76236018:"IFCLAMP",2176052936:"IFCJUNCTIONBOX",4175244083:"IFCINTERCEPTOR",2068733104:"IFCHUMIDIFIER",3319311131:"IFCHEATEXCHANGER",2188021234:"IFCFLOWMETER",1209101575:"IFCEXTERNALSPATIALELEMENT",484807127:"IFCEVAPORATOR",3747195512:"IFCEVAPORATIVECOOLER",2814081492:"IFCENGINE",2417008758:"IFCELECTRICDISTRIBUTIONBOARDTYPE",3242481149:"IFCDOORSTANDARDCASE",3205830791:"IFCDISTRIBUTIONSYSTEM",400855858:"IFCCOMMUNICATIONSAPPLIANCETYPE",905975707:"IFCCOLUMNSTANDARDCASE",1677625105:"IFCCIVILELEMENT",3296154744:"IFCCHIMNEY",2674252688:"IFCCABLEFITTINGTYPE",2188180465:"IFCBURNERTYPE",1177604601:"IFCBUILDINGSYSTEM",39481116:"IFCBUILDINGELEMENTPARTTYPE",1136057603:"IFCBOUNDARYCURVE",2461110595:"IFCBSPLINECURVEWITHKNOTS",1532957894:"IFCAUDIOVISUALAPPLIANCETYPE",4088093105:"IFCWORKCALENDAR",4009809668:"IFCWINDOWTYPE",926996030:"IFCVOIDINGFEATURE",2391383451:"IFCVIBRATIONISOLATOR",2415094496:"IFCTENDONTYPE",3081323446:"IFCTENDONANCHORTYPE",413509423:"IFCSYSTEMFURNITUREELEMENT",3101698114:"IFCSURFACEFEATURE",3657597509:"IFCSTRUCTURALSURFACEACTION",2757150158:"IFCSTRUCTURALCURVEREACTION",1004757350:"IFCSTRUCTURALCURVEACTION",338393293:"IFCSTAIRTYPE",1072016465:"IFCSOLARDEVICETYPE",4074543187:"IFCSHADINGDEVICETYPE",2157484638:"IFCSEAMCURVE",2781568857:"IFCROOFTYPE",2310774935:"IFCREINFORCINGMESHTYPE",964333572:"IFCREINFORCINGELEMENTTYPE",683857671:"IFCRATIONALBSPLINESURFACEWITHKNOTS",1469900589:"IFCRAMPTYPE",2839578677:"IFCPOLYGONALFACESET",1158309216:"IFCPILETYPE",3079942009:"IFCOPENINGSTANDARDCASE",1114901282:"IFCMEDICALDEVICETYPE",3113134337:"IFCINTERSECTIONCURVE",3946677679:"IFCINTERCEPTORTYPE",2571569899:"IFCINDEXEDPOLYCURVE",3493046030:"IFCGEOGRAPHICELEMENT",1509553395:"IFCFURNITURE",1893162501:"IFCFOOTINGTYPE",2853485674:"IFCEXTERNALSPATIALSTRUCTUREELEMENT",4148101412:"IFCEVENT",132023988:"IFCENGINETYPE",2397081782:"IFCELEMENTASSEMBLYTYPE",2323601079:"IFCDOORTYPE",1213902940:"IFCCYLINDRICALSURFACE",1525564444:"IFCCONSTRUCTIONPRODUCTRESOURCETYPE",4105962743:"IFCCONSTRUCTIONMATERIALRESOURCETYPE",2185764099:"IFCCONSTRUCTIONEQUIPMENTRESOURCETYPE",15328376:"IFCCOMPOSITECURVEONSURFACE",3875453745:"IFCCOMPLEXPROPERTYTEMPLATE",3893394355:"IFCCIVILELEMENTTYPE",2197970202:"IFCCHIMNEYTYPE",167062518:"IFCBSPLINESURFACEWITHKNOTS",2887950389:"IFCBSPLINESURFACE",2603310189:"IFCADVANCEDBREPWITHVOIDS",1635779807:"IFCADVANCEDBREP",2916149573:"IFCTRIANGULATEDFACESET",1935646853:"IFCTOROIDALSURFACE",2387106220:"IFCTESSELLATEDFACESET",3206491090:"IFCTASKTYPE",699246055:"IFCSURFACECURVE",4095615324:"IFCSUBCONTRACTRESOURCETYPE",603775116:"IFCSTRUCTURALSURFACEREACTION",4015995234:"IFCSPHERICALSURFACE",2481509218:"IFCSPATIALZONETYPE",463610769:"IFCSPATIALZONE",710998568:"IFCSPATIALELEMENTTYPE",1412071761:"IFCSPATIALELEMENT",3663146110:"IFCSIMPLEPROPERTYTEMPLATE",3243963512:"IFCREVOLVEDAREASOLIDTAPERED",816062949:"IFCREPARAMETRISEDCOMPOSITECURVESEGMENT",1521410863:"IFCRELSPACEBOUNDARY2NDLEVEL",3523091289:"IFCRELSPACEBOUNDARY1STLEVEL",427948657:"IFCRELINTERFERESELEMENTS",307848117:"IFCRELDEFINESBYTEMPLATE",1462361463:"IFCRELDEFINESBYOBJECT",2565941209:"IFCRELDECLARES",1027710054:"IFCRELASSIGNSTOGROUPBYFACTOR",3521284610:"IFCPROPERTYTEMPLATE",492091185:"IFCPROPERTYSETTEMPLATE",653396225:"IFCPROJECTLIBRARY",569719735:"IFCPROCEDURETYPE",3967405729:"IFCPREDEFINEDPROPERTYSET",1682466193:"IFCPCURVE",428585644:"IFCLABORRESOURCETYPE",2294589976:"IFCINDEXEDPOLYGONALFACEWITHVOIDS",178912537:"IFCINDEXEDPOLYGONALFACE",4095422895:"IFCGEOGRAPHICELEMENTTYPE",2652556860:"IFCFIXEDREFERENCESWEPTAREASOLID",2804161546:"IFCEXTRUDEDAREASOLIDTAPERED",4024345920:"IFCEVENTTYPE",2629017746:"IFCCURVEBOUNDEDSURFACE",1815067380:"IFCCREWRESOURCETYPE",3419103109:"IFCCONTEXT",2574617495:"IFCCONSTRUCTIONRESOURCETYPE",2059837836:"IFCCARTESIANPOINTLIST3D",1675464909:"IFCCARTESIANPOINTLIST2D",574549367:"IFCCARTESIANPOINTLIST",3406155212:"IFCADVANCEDFACE",3698973494:"IFCTYPERESOURCE",3736923433:"IFCTYPEPROCESS",901063453:"IFCTESSELLATEDITEM",1096409881:"IFCSWEPTDISKSOLIDPOLYGONAL",1042787934:"IFCRESOURCETIME",1608871552:"IFCRESOURCECONSTRAINTRELATIONSHIP",2943643501:"IFCRESOURCEAPPROVALRELATIONSHIP",2090586900:"IFCQUANTITYSET",1482703590:"IFCPROPERTYTEMPLATEDEFINITION",3778827333:"IFCPREDEFINEDPROPERTIES",2998442950:"IFCMIRROREDPROFILEDEF",853536259:"IFCMATERIALRELATIONSHIP",3404854881:"IFCMATERIALPROFILESETUSAGETAPERING",3079605661:"IFCMATERIALPROFILESETUSAGE",2852063980:"IFCMATERIALCONSTITUENTSET",3708119e3:"IFCMATERIALCONSTITUENT",1585845231:"IFCLAGTIME",2133299955:"IFCINDEXEDTRIANGLETEXTUREMAP",1437953363:"IFCINDEXEDTEXTUREMAP",3570813810:"IFCINDEXEDCOLOURMAP",1437805879:"IFCEXTERNALREFERENCERELATIONSHIP",297599258:"IFCEXTENDEDPROPERTIES",211053100:"IFCEVENTTIME",2713554722:"IFCCONVERSIONBASEDUNITWITHOFFSET",3285139300:"IFCCOLOURRGBLIST",1236880293:"IFCWORKTIME",1199560280:"IFCTIMEPERIOD",3611470254:"IFCTEXTUREVERTEXLIST",2771591690:"IFCTASKTIMERECURRING",1549132990:"IFCTASKTIME",2043862942:"IFCTABLECOLUMN",2934153892:"IFCSURFACEREINFORCEMENTAREA",609421318:"IFCSTRUCTURALLOADORRESULT",3478079324:"IFCSTRUCTURALLOADCONFIGURATION",1054537805:"IFCSCHEDULINGTIME",2439245199:"IFCRESOURCELEVELRELATIONSHIP",2433181523:"IFCREFERENCE",3915482550:"IFCRECURRENCEPATTERN",986844984:"IFCPROPERTYABSTRACTION",3843373140:"IFCPROJECTEDCRS",677532197:"IFCPRESENTATIONITEM",1507914824:"IFCMATERIALUSAGEDEFINITION",552965576:"IFCMATERIALPROFILEWITHOFFSETS",164193824:"IFCMATERIALPROFILESET",2235152071:"IFCMATERIALPROFILE",1847252529:"IFCMATERIALLAYERWITHOFFSETS",760658860:"IFCMATERIALDEFINITION",3057273783:"IFCMAPCONVERSION",4294318154:"IFCEXTERNALINFORMATION",1466758467:"IFCCOORDINATEREFERENCESYSTEM",1785450214:"IFCCOORDINATEOPERATION",775493141:"IFCCONNECTIONVOLUMEGEOMETRY",979691226:"IFCREINFORCINGBAR",3700593921:"IFCELECTRICDISTRIBUTIONPOINT",1062813311:"IFCDISTRIBUTIONCONTROLELEMENT",1052013943:"IFCDISTRIBUTIONCHAMBERELEMENT",578613899:"IFCCONTROLLERTYPE",2454782716:"IFCCHAMFEREDGEFEATURE",753842376:"IFCBEAM",3001207471:"IFCALARMTYPE",2874132201:"IFCACTUATORTYPE",3304561284:"IFCWINDOW",3512223829:"IFCWALLSTANDARDCASE",2391406946:"IFCWALL",3313531582:"IFCVIBRATIONISOLATORTYPE",2347447852:"IFCTENDONANCHOR",3824725483:"IFCTENDON",2515109513:"IFCSTRUCTURALANALYSISMODEL",4252922144:"IFCSTAIRFLIGHT",331165859:"IFCSTAIR",1529196076:"IFCSLAB",1783015770:"IFCSENSORTYPE",1376911519:"IFCROUNDEDEDGEFEATURE",2016517767:"IFCROOF",2320036040:"IFCREINFORCINGMESH",3027567501:"IFCREINFORCINGELEMENT",3055160366:"IFCRATIONALBEZIERCURVE",3283111854:"IFCRAMPFLIGHT",3024970846:"IFCRAMP",2262370178:"IFCRAILING",3171933400:"IFCPLATE",1687234759:"IFCPILE",1073191201:"IFCMEMBER",900683007:"IFCFOOTING",3508470533:"IFCFLOWTREATMENTDEVICE",2223149337:"IFCFLOWTERMINAL",707683696:"IFCFLOWSTORAGEDEVICE",987401354:"IFCFLOWSEGMENT",3132237377:"IFCFLOWMOVINGDEVICE",4037862832:"IFCFLOWINSTRUMENTTYPE",4278956645:"IFCFLOWFITTING",2058353004:"IFCFLOWCONTROLLER",4222183408:"IFCFIRESUPPRESSIONTERMINALTYPE",1810631287:"IFCFILTERTYPE",346874300:"IFCFANTYPE",1658829314:"IFCENERGYCONVERSIONDEVICE",857184966:"IFCELECTRICALELEMENT",1634875225:"IFCELECTRICALCIRCUIT",712377611:"IFCELECTRICTIMECONTROLTYPE",1217240411:"IFCELECTRICMOTORTYPE",1365060375:"IFCELECTRICHEATERTYPE",1534661035:"IFCELECTRICGENERATORTYPE",3277789161:"IFCELECTRICFLOWSTORAGEDEVICETYPE",663422040:"IFCELECTRICAPPLIANCETYPE",855621170:"IFCEDGEFEATURE",2030761528:"IFCDUCTSILENCERTYPE",3760055223:"IFCDUCTSEGMENTTYPE",869906466:"IFCDUCTFITTINGTYPE",395920057:"IFCDOOR",3041715199:"IFCDISTRIBUTIONPORT",3040386961:"IFCDISTRIBUTIONFLOWELEMENT",1945004755:"IFCDISTRIBUTIONELEMENT",2063403501:"IFCDISTRIBUTIONCONTROLELEMENTTYPE",1599208980:"IFCDISTRIBUTIONCHAMBERELEMENTTYPE",2635815018:"IFCDISCRETEACCESSORYTYPE",1335981549:"IFCDISCRETEACCESSORY",4147604152:"IFCDIAMETERDIMENSION",3961806047:"IFCDAMPERTYPE",3495092785:"IFCCURTAINWALL",1973544240:"IFCCOVERING",2954562838:"IFCCOOLINGTOWERTYPE",335055490:"IFCCOOLEDBEAMTYPE",488727124:"IFCCONSTRUCTIONPRODUCTRESOURCE",1060000209:"IFCCONSTRUCTIONMATERIALRESOURCE",3898045240:"IFCCONSTRUCTIONEQUIPMENTRESOURCE",1163958913:"IFCCONDITIONCRITERION",2188551683:"IFCCONDITION",2816379211:"IFCCONDENSERTYPE",3850581409:"IFCCOMPRESSORTYPE",843113511:"IFCCOLUMN",2301859152:"IFCCOILTYPE",2611217952:"IFCCIRCLE",2951183804:"IFCCHILLERTYPE",1285652485:"IFCCABLESEGMENTTYPE",3293546465:"IFCCABLECARRIERSEGMENTTYPE",395041908:"IFCCABLECARRIERFITTINGTYPE",1909888760:"IFCBUILDINGELEMENTPROXYTYPE",1095909175:"IFCBUILDINGELEMENTPROXY",2979338954:"IFCBUILDINGELEMENTPART",52481810:"IFCBUILDINGELEMENTCOMPONENT",3299480353:"IFCBUILDINGELEMENT",231477066:"IFCBOILERTYPE",1916977116:"IFCBEZIERCURVE",819618141:"IFCBEAMTYPE",1967976161:"IFCBSPLINECURVE",3460190687:"IFCASSET",2470393545:"IFCANGULARDIMENSION",1871374353:"IFCAIRTOAIRHEATRECOVERYTYPE",3352864051:"IFCAIRTERMINALTYPE",1411407467:"IFCAIRTERMINALBOXTYPE",3821786052:"IFCACTIONREQUEST",1213861670:"IFC2DCOMPOSITECURVE",1033361043:"IFCZONE",3342526732:"IFCWORKSCHEDULE",4218914973:"IFCWORKPLAN",1028945134:"IFCWORKCONTROL",1133259667:"IFCWASTETERMINALTYPE",1898987631:"IFCWALLTYPE",2769231204:"IFCVIRTUALELEMENT",728799441:"IFCVALVETYPE",1911125066:"IFCUNITARYEQUIPMENTTYPE",1600972822:"IFCTUBEBUNDLETYPE",3593883385:"IFCTRIMMEDCURVE",1620046519:"IFCTRANSPORTELEMENT",1692211062:"IFCTRANSFORMERTYPE",1637806684:"IFCTIMESERIESSCHEDULE",5716631:"IFCTANKTYPE",2254336722:"IFCSYSTEM",2315554128:"IFCSWITCHINGDEVICETYPE",148013059:"IFCSUBCONTRACTRESOURCE",1975003073:"IFCSTRUCTURALSURFACECONNECTION",2986769608:"IFCSTRUCTURALRESULTGROUP",1235345126:"IFCSTRUCTURALPOINTREACTION",734778138:"IFCSTRUCTURALPOINTCONNECTION",2082059205:"IFCSTRUCTURALPOINTACTION",3987759626:"IFCSTRUCTURALPLANARACTIONVARYING",1621171031:"IFCSTRUCTURALPLANARACTION",1252848954:"IFCSTRUCTURALLOADGROUP",1721250024:"IFCSTRUCTURALLINEARACTIONVARYING",1807405624:"IFCSTRUCTURALLINEARACTION",2445595289:"IFCSTRUCTURALCURVEMEMBERVARYING",214636428:"IFCSTRUCTURALCURVEMEMBER",4243806635:"IFCSTRUCTURALCURVECONNECTION",1179482911:"IFCSTRUCTURALCONNECTION",682877961:"IFCSTRUCTURALACTION",1039846685:"IFCSTAIRFLIGHTTYPE",3112655638:"IFCSTACKTERMINALTYPE",3812236995:"IFCSPACETYPE",652456506:"IFCSPACEPROGRAM",1305183839:"IFCSPACEHEATERTYPE",3856911033:"IFCSPACE",2533589738:"IFCSLABTYPE",4097777520:"IFCSITE",4105383287:"IFCSERVICELIFE",3517283431:"IFCSCHEDULETIMECONTROL",1768891740:"IFCSANITARYTERMINALTYPE",2863920197:"IFCRELASSIGNSTASKS",160246688:"IFCRELAGGREGATES",2324767716:"IFCRAMPFLIGHTTYPE",2893384427:"IFCRAILINGTYPE",3248260540:"IFCRADIUSDIMENSION",2250791053:"IFCPUMPTYPE",1842657554:"IFCPROTECTIVEDEVICETYPE",3651124850:"IFCPROJECTIONELEMENT",3642467123:"IFCPROJECTORDERRECORD",2904328755:"IFCPROJECTORDER",2744685151:"IFCPROCEDURE",3740093272:"IFCPORT",3724593414:"IFCPOLYLINE",4017108033:"IFCPLATETYPE",4231323485:"IFCPIPESEGMENTTYPE",804291784:"IFCPIPEFITTINGTYPE",3327091369:"IFCPERMIT",2382730787:"IFCPERFORMANCEHISTORY",2837617999:"IFCOUTLETTYPE",3425660407:"IFCORDERACTION",3588315303:"IFCOPENINGELEMENT",4143007308:"IFCOCCUPANT",1916936684:"IFCMOVE",977012517:"IFCMOTORCONNECTIONTYPE",3181161470:"IFCMEMBERTYPE",2108223431:"IFCMECHANICALFASTENERTYPE",377706215:"IFCMECHANICALFASTENER",2506943328:"IFCLINEARDIMENSION",1161773419:"IFCLIGHTFIXTURETYPE",1051575348:"IFCLAMPTYPE",3827777499:"IFCLABORRESOURCE",4288270099:"IFCJUNCTIONBOXTYPE",2391368822:"IFCINVENTORY",1806887404:"IFCHUMIDIFIERTYPE",1251058090:"IFCHEATEXCHANGERTYPE",2706460486:"IFCGROUP",3009204131:"IFCGRID",200128114:"IFCGASTERMINALTYPE",814719939:"IFCFURNITURESTANDARD",263784265:"IFCFURNISHINGELEMENT",3009222698:"IFCFLOWTREATMENTDEVICETYPE",2297155007:"IFCFLOWTERMINALTYPE",1339347760:"IFCFLOWSTORAGEDEVICETYPE",1834744321:"IFCFLOWSEGMENTTYPE",1482959167:"IFCFLOWMOVINGDEVICETYPE",3815607619:"IFCFLOWMETERTYPE",3198132628:"IFCFLOWFITTINGTYPE",3907093117:"IFCFLOWCONTROLLERTYPE",1287392070:"IFCFEATUREELEMENTSUBTRACTION",2143335405:"IFCFEATUREELEMENTADDITION",2827207264:"IFCFEATUREELEMENT",2489546625:"IFCFASTENERTYPE",647756555:"IFCFASTENER",3737207727:"IFCFACETEDBREPWITHVOIDS",807026263:"IFCFACETEDBREP",3390157468:"IFCEVAPORATORTYPE",3174744832:"IFCEVAPORATIVECOOLERTYPE",3272907226:"IFCEQUIPMENTSTANDARD",1962604670:"IFCEQUIPMENTELEMENT",2107101300:"IFCENERGYCONVERSIONDEVICETYPE",1704287377:"IFCELLIPSE",2590856083:"IFCELEMENTCOMPONENTTYPE",1623761950:"IFCELEMENTCOMPONENT",4123344466:"IFCELEMENTASSEMBLY",1758889154:"IFCELEMENT",360485395:"IFCELECTRICALBASEPROPERTIES",3849074793:"IFCDISTRIBUTIONFLOWELEMENTTYPE",3256556792:"IFCDISTRIBUTIONELEMENTTYPE",681481545:"IFCDIMENSIONCURVEDIRECTEDCALLOUT",1457835157:"IFCCURTAINWALLTYPE",3295246426:"IFCCREWRESOURCE",1916426348:"IFCCOVERINGTYPE",1419761937:"IFCCOSTSCHEDULE",3895139033:"IFCCOSTITEM",3293443760:"IFCCONTROL",2559216714:"IFCCONSTRUCTIONRESOURCE",2510884976:"IFCCONIC",3732776249:"IFCCOMPOSITECURVE",300633059:"IFCCOLUMNTYPE",2937912522:"IFCCIRCLEHOLLOWPROFILEDEF",3124254112:"IFCBUILDINGSTOREY",1950629157:"IFCBUILDINGELEMENTTYPE",4031249490:"IFCBUILDING",1260505505:"IFCBOUNDEDCURVE",3649129432:"IFCBOOLEANCLIPPINGRESULT",1334484129:"IFCBLOCK",3207858831:"IFCASYMMETRICISHAPEPROFILEDEF",1674181508:"IFCANNOTATION",2296667514:"IFCACTOR",2097647324:"IFCTRANSPORTELEMENTTYPE",3473067441:"IFCTASK",1580310250:"IFCSYSTEMFURNITUREELEMENTTYPE",4124788165:"IFCSURFACEOFREVOLUTION",2809605785:"IFCSURFACEOFLINEAREXTRUSION",2028607225:"IFCSURFACECURVESWEPTAREASOLID",4070609034:"IFCSTRUCTUREDDIMENSIONCALLOUT",2218152070:"IFCSTRUCTURALSURFACEMEMBERVARYING",3979015343:"IFCSTRUCTURALSURFACEMEMBER",3689010777:"IFCSTRUCTURALREACTION",530289379:"IFCSTRUCTURALMEMBER",3136571912:"IFCSTRUCTURALITEM",3544373492:"IFCSTRUCTURALACTIVITY",451544542:"IFCSPHERE",3893378262:"IFCSPATIALSTRUCTUREELEMENTTYPE",2706606064:"IFCSPATIALSTRUCTUREELEMENT",3626867408:"IFCRIGHTCIRCULARCYLINDER",4158566097:"IFCRIGHTCIRCULARCONE",1856042241:"IFCREVOLVEDAREASOLID",2914609552:"IFCRESOURCE",1401173127:"IFCRELVOIDSELEMENT",3451746338:"IFCRELSPACEBOUNDARY",366585022:"IFCRELSERVICESBUILDINGS",4122056220:"IFCRELSEQUENCE",1058617721:"IFCRELSCHEDULESCOSTITEMS",1245217292:"IFCRELREFERENCEDINSPATIALSTRUCTURE",750771296:"IFCRELPROJECTSELEMENT",202636808:"IFCRELOVERRIDESPROPERTIES",2051452291:"IFCRELOCCUPIESSPACES",3268803585:"IFCRELNESTS",4189434867:"IFCRELINTERACTIONREQUIREMENTS",279856033:"IFCRELFLOWCONTROLELEMENTS",3940055652:"IFCRELFILLSELEMENT",781010003:"IFCRELDEFINESBYTYPE",4186316022:"IFCRELDEFINESBYPROPERTIES",693640335:"IFCRELDEFINES",2551354335:"IFCRELDECOMPOSES",2802773753:"IFCRELCOVERSSPACES",886880790:"IFCRELCOVERSBLDGELEMENTS",3242617779:"IFCRELCONTAINEDINSPATIALSTRUCTURE",3678494232:"IFCRELCONNECTSWITHREALIZINGELEMENTS",504942748:"IFCRELCONNECTSWITHECCENTRICITY",1638771189:"IFCRELCONNECTSSTRUCTURALMEMBER",3912681535:"IFCRELCONNECTSSTRUCTURALELEMENT",2127690289:"IFCRELCONNECTSSTRUCTURALACTIVITY",3190031847:"IFCRELCONNECTSPORTS",4201705270:"IFCRELCONNECTSPORTTOELEMENT",3945020480:"IFCRELCONNECTSPATHELEMENTS",1204542856:"IFCRELCONNECTSELEMENTS",826625072:"IFCRELCONNECTS",2851387026:"IFCRELASSOCIATESPROFILEPROPERTIES",2655215786:"IFCRELASSOCIATESMATERIAL",3840914261:"IFCRELASSOCIATESLIBRARY",982818633:"IFCRELASSOCIATESDOCUMENT",2728634034:"IFCRELASSOCIATESCONSTRAINT",919958153:"IFCRELASSOCIATESCLASSIFICATION",4095574036:"IFCRELASSOCIATESAPPROVAL",1327628568:"IFCRELASSOCIATESAPPLIEDVALUE",1865459582:"IFCRELASSOCIATES",205026976:"IFCRELASSIGNSTORESOURCE",3372526763:"IFCRELASSIGNSTOPROJECTORDER",2857406711:"IFCRELASSIGNSTOPRODUCT",4278684876:"IFCRELASSIGNSTOPROCESS",1307041759:"IFCRELASSIGNSTOGROUP",2495723537:"IFCRELASSIGNSTOCONTROL",1683148259:"IFCRELASSIGNSTOACTOR",3939117080:"IFCRELASSIGNS",3454111270:"IFCRECTANGULARTRIMMEDSURFACE",2798486643:"IFCRECTANGULARPYRAMID",2770003689:"IFCRECTANGLEHOLLOWPROFILEDEF",3219374653:"IFCPROXY",1451395588:"IFCPROPERTYSET",4194566429:"IFCPROJECTIONCURVE",103090709:"IFCPROJECT",4208778838:"IFCPRODUCT",2945172077:"IFCPROCESS",220341763:"IFCPLANE",603570806:"IFCPLANARBOX",3566463478:"IFCPERMEABLECOVERINGPROPERTIES",3505215534:"IFCOFFSETCURVE3D",3388369263:"IFCOFFSETCURVE2D",3888040117:"IFCOBJECT",1425443689:"IFCMANIFOLDSOLIDBREP",1281925730:"IFCLINE",572779678:"IFCLSHAPEPROFILEDEF",1484403080:"IFCISHAPEPROFILEDEF",987898635:"IFCGEOMETRICCURVESET",1268542332:"IFCFURNITURETYPE",4238390223:"IFCFURNISHINGELEMENTTYPE",3455213021:"IFCFLUIDFLOWPROPERTIES",315944413:"IFCFILLAREASTYLETILES",4203026998:"IFCFILLAREASTYLETILESYMBOLWITHSTYLE",374418227:"IFCFILLAREASTYLEHATCHING",2047409740:"IFCFACEBASEDSURFACEMODEL",477187591:"IFCEXTRUDEDAREASOLID",80994333:"IFCENERGYPROPERTIES",2835456948:"IFCELLIPSEPROFILEDEF",2777663545:"IFCELEMENTARYSURFACE",339256511:"IFCELEMENTTYPE",1883228015:"IFCELEMENTQUANTITY",1472233963:"IFCEDGELOOP",4006246654:"IFCDRAUGHTINGPREDEFINEDCURVEFONT",445594917:"IFCDRAUGHTINGPREDEFINEDCOLOUR",3073041342:"IFCDRAUGHTINGCALLOUT",526551008:"IFCDOORSTYLE",1714330368:"IFCDOORPANELPROPERTIES",2963535650:"IFCDOORLININGPROPERTIES",32440307:"IFCDIRECTION",4054601972:"IFCDIMENSIONCURVETERMINATOR",606661476:"IFCDIMENSIONCURVE",693772133:"IFCDEFINEDSYMBOL",2827736869:"IFCCURVEBOUNDEDPLANE",2601014836:"IFCCURVE",2147822146:"IFCCSGSOLID",2506170314:"IFCCSGPRIMITIVE3D",194851669:"IFCCRANERAILFSHAPEPROFILEDEF",4133800736:"IFCCRANERAILASHAPEPROFILEDEF",2485617015:"IFCCOMPOSITECURVESEGMENT",2205249479:"IFCCLOSEDSHELL",1383045692:"IFCCIRCLEPROFILEDEF",1416205885:"IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM",3331915920:"IFCCARTESIANTRANSFORMATIONOPERATOR3D",3486308946:"IFCCARTESIANTRANSFORMATIONOPERATOR2DNONUNIFORM",3749851601:"IFCCARTESIANTRANSFORMATIONOPERATOR2D",59481748:"IFCCARTESIANTRANSFORMATIONOPERATOR",1123145078:"IFCCARTESIANPOINT",2898889636:"IFCCSHAPEPROFILEDEF",2713105998:"IFCBOXEDHALFSPACE",2581212453:"IFCBOUNDINGBOX",4182860854:"IFCBOUNDEDSURFACE",2736907675:"IFCBOOLEANRESULT",2740243338:"IFCAXIS2PLACEMENT3D",3125803723:"IFCAXIS2PLACEMENT2D",4261334040:"IFCAXIS1PLACEMENT",1302238472:"IFCANNOTATIONSURFACE",2265737646:"IFCANNOTATIONFILLAREAOCCURRENCE",669184980:"IFCANNOTATIONFILLAREA",3288037868:"IFCANNOTATIONCURVEOCCURRENCE",2543172580:"IFCZSHAPEPROFILEDEF",1299126871:"IFCWINDOWSTYLE",512836454:"IFCWINDOWPANELPROPERTIES",336235671:"IFCWINDOWLININGPROPERTIES",2759199220:"IFCVERTEXLOOP",1417489154:"IFCVECTOR",427810014:"IFCUSHAPEPROFILEDEF",2347495698:"IFCTYPEPRODUCT",1628702193:"IFCTYPEOBJECT",1345879162:"IFCTWODIRECTIONREPEATFACTOR",2715220739:"IFCTRAPEZIUMPROFILEDEF",3124975700:"IFCTEXTLITERALWITHEXTENT",4282788508:"IFCTEXTLITERAL",3028897424:"IFCTERMINATORSYMBOL",3071757647:"IFCTSHAPEPROFILEDEF",230924584:"IFCSWEPTSURFACE",1260650574:"IFCSWEPTDISKSOLID",2247615214:"IFCSWEPTAREASOLID",1878645084:"IFCSURFACESTYLERENDERING",2513912981:"IFCSURFACE",2233826070:"IFCSUBEDGE",3653947884:"IFCSTRUCTURALSTEELPROFILEPROPERTIES",3843319758:"IFCSTRUCTURALPROFILEPROPERTIES",1190533807:"IFCSTRUCTURALLOADSINGLEFORCEWARPING",1597423693:"IFCSTRUCTURALLOADSINGLEFORCE",1973038258:"IFCSTRUCTURALLOADSINGLEDISPLACEMENTDISTORTION",2473145415:"IFCSTRUCTURALLOADSINGLEDISPLACEMENT",2668620305:"IFCSTRUCTURALLOADPLANARFORCE",1595516126:"IFCSTRUCTURALLOADLINEARFORCE",390701378:"IFCSPACETHERMALLOADPROPERTIES",1202362311:"IFCSOUNDVALUE",2485662743:"IFCSOUNDPROPERTIES",723233188:"IFCSOLIDMODEL",2609359061:"IFCSLIPPAGECONNECTIONCONDITION",4124623270:"IFCSHELLBASEDSURFACEMODEL",2411513650:"IFCSERVICELIFEFACTOR",1509187699:"IFCSECTIONEDSPINE",2778083089:"IFCROUNDEDRECTANGLEPROFILEDEF",478536968:"IFCRELATIONSHIP",3765753017:"IFCREINFORCEMENTDEFINITIONPROPERTIES",3413951693:"IFCREGULARTIMESERIES",3615266464:"IFCRECTANGLEPROFILEDEF",110355661:"IFCPROPERTYTABLEVALUE",3650150729:"IFCPROPERTYSINGLEVALUE",3357820518:"IFCPROPERTYSETDEFINITION",941946838:"IFCPROPERTYREFERENCEVALUE",2752243245:"IFCPROPERTYLISTVALUE",4166981789:"IFCPROPERTYENUMERATEDVALUE",1680319473:"IFCPROPERTYDEFINITION",871118103:"IFCPROPERTYBOUNDEDVALUE",673634403:"IFCPRODUCTDEFINITIONSHAPE",179317114:"IFCPREDEFINEDPOINTMARKERSYMBOL",433424934:"IFCPREDEFINEDDIMENSIONSYMBOL",2559016684:"IFCPREDEFINEDCURVEFONT",759155922:"IFCPREDEFINEDCOLOUR",2775532180:"IFCPOLYGONALBOUNDEDHALFSPACE",2924175390:"IFCPOLYLOOP",1423911732:"IFCPOINTONSURFACE",4022376103:"IFCPOINTONCURVE",2067069095:"IFCPOINT",1663979128:"IFCPLANAREXTENT",2004835150:"IFCPLACEMENT",597895409:"IFCPIXELTEXTURE",3021840470:"IFCPHYSICALCOMPLEXQUANTITY",2519244187:"IFCPATH",2529465313:"IFCPARAMETERIZEDPROFILEDEF",1029017970:"IFCORIENTEDEDGE",2665983363:"IFCOPENSHELL",2833995503:"IFCONEDIRECTIONREPEATFACTOR",219451334:"IFCOBJECTDEFINITION",1430189142:"IFCMECHANICALCONCRETEMATERIALPROPERTIES",2022407955:"IFCMATERIALDEFINITIONREPRESENTATION",2347385850:"IFCMAPPEDITEM",1008929658:"IFCLOOP",2624227202:"IFCLOCALPLACEMENT",3422422726:"IFCLIGHTSOURCESPOT",1520743889:"IFCLIGHTSOURCEPOSITIONAL",4266656042:"IFCLIGHTSOURCEGONIOMETRIC",2604431987:"IFCLIGHTSOURCEDIRECTIONAL",125510826:"IFCLIGHTSOURCEAMBIENT",1402838566:"IFCLIGHTSOURCE",3741457305:"IFCIRREGULARTIMESERIES",3905492369:"IFCIMAGETEXTURE",2445078500:"IFCHYGROSCOPICMATERIALPROPERTIES",812098782:"IFCHALFSPACESOLID",178086475:"IFCGRIDPLACEMENT",3590301190:"IFCGEOMETRICSET",4142052618:"IFCGEOMETRICREPRESENTATIONSUBCONTEXT",2453401579:"IFCGEOMETRICREPRESENTATIONITEM",3448662350:"IFCGEOMETRICREPRESENTATIONCONTEXT",1446786286:"IFCGENERALPROFILEPROPERTIES",803998398:"IFCGENERALMATERIALPROPERTIES",3857492461:"IFCFUELPROPERTIES",738692330:"IFCFILLAREASTYLE",4219587988:"IFCFAILURECONNECTIONCONDITION",3008276851:"IFCFACESURFACE",803316827:"IFCFACEOUTERBOUND",1809719519:"IFCFACEBOUND",2556980723:"IFCFACE",1860660968:"IFCEXTENDEDMATERIALPROPERTIES",476780140:"IFCEDGECURVE",3900360178:"IFCEDGE",4170525392:"IFCDRAUGHTINGPREDEFINEDTEXTFONT",3732053477:"IFCDOCUMENTREFERENCE",1694125774:"IFCDIMENSIONPAIR",2273265877:"IFCDIMENSIONCALLOUTRELATIONSHIP",3632507154:"IFCDERIVEDPROFILEDEF",3800577675:"IFCCURVESTYLE",2889183280:"IFCCONVERSIONBASEDUNIT",3050246964:"IFCCONTEXTDEPENDENTUNIT",45288368:"IFCCONNECTIONPOINTECCENTRICITY",1981873012:"IFCCONNECTIONCURVEGEOMETRY",370225590:"IFCCONNECTEDFACESET",1485152156:"IFCCOMPOSITEPROFILEDEF",2542286263:"IFCCOMPLEXPROPERTY",776857604:"IFCCOLOURRGB",647927063:"IFCCLASSIFICATIONREFERENCE",3150382593:"IFCCENTERLINEPROFILEDEF",616511568:"IFCBLOBTEXTURE",2705031697:"IFCARBITRARYPROFILEDEFWITHVOIDS",1310608509:"IFCARBITRARYOPENPROFILEDEF",3798115385:"IFCARBITRARYCLOSEDPROFILEDEF",2297822566:"IFCANNOTATIONTEXTOCCURRENCE",3612888222:"IFCANNOTATIONSYMBOLOCCURRENCE",962685235:"IFCANNOTATIONSURFACEOCCURRENCE",2442683028:"IFCANNOTATIONOCCURRENCE",1065908215:"IFCWATERPROPERTIES",891718957:"IFCVIRTUALGRIDINTERSECTION",1907098498:"IFCVERTEXPOINT",3304826586:"IFCVERTEXBASEDTEXTUREMAP",2799835756:"IFCVERTEX",180925521:"IFCUNITASSIGNMENT",1735638870:"IFCTOPOLOGYREPRESENTATION",1377556343:"IFCTOPOLOGICALREPRESENTATIONITEM",581633288:"IFCTIMESERIESVALUE",1718945513:"IFCTIMESERIESREFERENCERELATIONSHIP",3101149627:"IFCTIMESERIES",3317419933:"IFCTHERMALMATERIALPROPERTIES",1210645708:"IFCTEXTUREVERTEX",2552916305:"IFCTEXTUREMAP",1742049831:"IFCTEXTURECOORDINATEGENERATOR",280115917:"IFCTEXTURECOORDINATE",1484833681:"IFCTEXTSTYLEWITHBOXCHARACTERISTICS",1640371178:"IFCTEXTSTYLETEXTMODEL",2636378356:"IFCTEXTSTYLEFORDEFINEDFONT",1983826977:"IFCTEXTSTYLEFONTMODEL",1447204868:"IFCTEXTSTYLE",912023232:"IFCTELECOMADDRESS",531007025:"IFCTABLEROW",985171141:"IFCTABLE",1290481447:"IFCSYMBOLSTYLE",626085974:"IFCSURFACETEXTURE",1351298697:"IFCSURFACESTYLEWITHTEXTURES",846575682:"IFCSURFACESTYLESHADING",1607154358:"IFCSURFACESTYLEREFRACTION",3303107099:"IFCSURFACESTYLELIGHTING",1300840506:"IFCSURFACESTYLE",3049322572:"IFCSTYLEDREPRESENTATION",3958052878:"IFCSTYLEDITEM",2830218821:"IFCSTYLEMODEL",3408363356:"IFCSTRUCTURALLOADTEMPERATURE",2525727697:"IFCSTRUCTURALLOADSTATIC",2162789131:"IFCSTRUCTURALLOAD",2273995522:"IFCSTRUCTURALCONNECTIONCONDITION",3692461612:"IFCSIMPLEPROPERTY",4240577450:"IFCSHAPEREPRESENTATION",3982875396:"IFCSHAPEMODEL",867548509:"IFCSHAPEASPECT",4165799628:"IFCSECTIONREINFORCEMENTPROPERTIES",2042790032:"IFCSECTIONPROPERTIES",448429030:"IFCSIUNIT",2341007311:"IFCROOT",3679540991:"IFCRIBPLATEPROFILEPROPERTIES",1660063152:"IFCREPRESENTATIONMAP",3008791417:"IFCREPRESENTATIONITEM",3377609919:"IFCREPRESENTATIONCONTEXT",1076942058:"IFCREPRESENTATION",1222501353:"IFCRELAXATION",1580146022:"IFCREINFORCEMENTBARPROPERTIES",2692823254:"IFCREFERENCESVALUEDOCUMENT",825690147:"IFCQUANTITYWEIGHT",2405470396:"IFCQUANTITYVOLUME",3252649465:"IFCQUANTITYTIME",931644368:"IFCQUANTITYLENGTH",2093928680:"IFCQUANTITYCOUNT",2044713172:"IFCQUANTITYAREA",3710013099:"IFCPROPERTYENUMERATION",148025276:"IFCPROPERTYDEPENDENCYRELATIONSHIP",3896028662:"IFCPROPERTYCONSTRAINTRELATIONSHIP",2598011224:"IFCPROPERTY",2802850158:"IFCPROFILEPROPERTIES",3958567839:"IFCPROFILEDEF",2267347899:"IFCPRODUCTSOFCOMBUSTIONPROPERTIES",2095639259:"IFCPRODUCTREPRESENTATION",2417041796:"IFCPRESENTATIONSTYLEASSIGNMENT",3119450353:"IFCPRESENTATIONSTYLE",1304840413:"IFCPRESENTATIONLAYERWITHSTYLE",2022622350:"IFCPRESENTATIONLAYERASSIGNMENT",1775413392:"IFCPREDEFINEDTEXTFONT",3213052703:"IFCPREDEFINEDTERMINATORSYMBOL",990879717:"IFCPREDEFINEDSYMBOL",3727388367:"IFCPREDEFINEDITEM",3355820592:"IFCPOSTALADDRESS",2226359599:"IFCPHYSICALSIMPLEQUANTITY",2483315170:"IFCPHYSICALQUANTITY",101040310:"IFCPERSONANDORGANIZATION",2077209135:"IFCPERSON",1207048766:"IFCOWNERHISTORY",1411181986:"IFCORGANIZATIONRELATIONSHIP",4251960020:"IFCORGANIZATION",1227763645:"IFCOPTICALMATERIALPROPERTIES",2251480897:"IFCOBJECTIVE",3701648758:"IFCOBJECTPLACEMENT",1918398963:"IFCNAMEDUNIT",2706619895:"IFCMONETARYUNIT",3368373690:"IFCMETRIC",677618848:"IFCMECHANICALSTEELMATERIALPROPERTIES",4256014907:"IFCMECHANICALMATERIALPROPERTIES",2597039031:"IFCMEASUREWITHUNIT",3265635763:"IFCMATERIALPROPERTIES",2199411900:"IFCMATERIALLIST",1303795690:"IFCMATERIALLAYERSETUSAGE",3303938423:"IFCMATERIALLAYERSET",248100487:"IFCMATERIALLAYER",1847130766:"IFCMATERIALCLASSIFICATIONRELATIONSHIP",1838606355:"IFCMATERIAL",30780891:"IFCLOCALTIME",1566485204:"IFCLIGHTINTENSITYDISTRIBUTION",4162380809:"IFCLIGHTDISTRIBUTIONDATA",3452421091:"IFCLIBRARYREFERENCE",2655187982:"IFCLIBRARYINFORMATION",3020489413:"IFCIRREGULARTIMESERIESVALUE",852622518:"IFCGRIDAXIS",3548104201:"IFCEXTERNALLYDEFINEDTEXTFONT",3207319532:"IFCEXTERNALLYDEFINEDSYMBOL",1040185647:"IFCEXTERNALLYDEFINEDSURFACESTYLE",2242383968:"IFCEXTERNALLYDEFINEDHATCHSTYLE",3200245327:"IFCEXTERNALREFERENCE",1648886627:"IFCENVIRONMENTALIMPACTVALUE",3796139169:"IFCDRAUGHTINGCALLOUTRELATIONSHIP",770865208:"IFCDOCUMENTINFORMATIONRELATIONSHIP",1154170062:"IFCDOCUMENTINFORMATION",1376555844:"IFCDOCUMENTELECTRONICFORMAT",2949456006:"IFCDIMENSIONALEXPONENTS",1045800335:"IFCDERIVEDUNITELEMENT",1765591967:"IFCDERIVEDUNIT",1072939445:"IFCDATEANDTIME",3510044353:"IFCCURVESTYLEFONTPATTERN",2367409068:"IFCCURVESTYLEFONTANDSCALING",1105321065:"IFCCURVESTYLEFONT",539742890:"IFCCURRENCYRELATIONSHIP",602808272:"IFCCOSTVALUE",1065062679:"IFCCOORDINATEDUNIVERSALTIMEOFFSET",347226245:"IFCCONSTRAINTRELATIONSHIP",613356794:"IFCCONSTRAINTCLASSIFICATIONRELATIONSHIP",1658513725:"IFCCONSTRAINTAGGREGATIONRELATIONSHIP",1959218052:"IFCCONSTRAINT",2732653382:"IFCCONNECTIONSURFACEGEOMETRY",4257277454:"IFCCONNECTIONPORTGEOMETRY",2614616156:"IFCCONNECTIONPOINTGEOMETRY",2859738748:"IFCCONNECTIONGEOMETRY",3264961684:"IFCCOLOURSPECIFICATION",3639012971:"IFCCLASSIFICATIONNOTATIONFACET",938368621:"IFCCLASSIFICATIONNOTATION",1098599126:"IFCCLASSIFICATIONITEMRELATIONSHIP",1767535486:"IFCCLASSIFICATIONITEM",747523909:"IFCCLASSIFICATION",622194075:"IFCCALENDARDATE",2069777674:"IFCBOUNDARYNODECONDITIONWARPING",1387855156:"IFCBOUNDARYNODECONDITION",3367102660:"IFCBOUNDARYFACECONDITION",1560379544:"IFCBOUNDARYEDGECONDITION",4037036970:"IFCBOUNDARYCONDITION",3869604511:"IFCAPPROVALRELATIONSHIP",390851274:"IFCAPPROVALPROPERTYRELATIONSHIP",2080292479:"IFCAPPROVALACTORRELATIONSHIP",130549933:"IFCAPPROVAL",1110488051:"IFCAPPLIEDVALUERELATIONSHIP",411424972:"IFCAPPLIEDVALUE",639542469:"IFCAPPLICATION",618182010:"IFCADDRESS",3630933823:"IFCACTORROLE",599546466:"FILE_DESCRIPTION",1390159747:"FILE_NAME",1109904537:"FILE_SCHEMA"};class Oe{static async getUnits(s){var r,o,a;const{IFCUNITASSIGNMENT:t}=Z,e=await s.getAllPropertiesOfType(t);if(!e)return 1;const i=Object.keys(e),n=e[parseInt(i[0],10)];for(const l of n.Units){if(l.value===void 0||l.value===null)continue;const h=await s.getProperties(l.value);if(!h||!h.UnitType||!h.UnitType.value||h.UnitType.value!=="LENGTHUNIT")continue;let u=1,f=1;return h.Name.value==="METRE"&&(f=1),h.Name.value==="FOOT"&&(f=.3048),((r=h.Prefix)==null?void 0:r.value)==="MILLI"?u=.001:((o=h.Prefix)==null?void 0:o.value)==="CENTI"?u=.01:((a=h.Prefix)==null?void 0:a.value)==="DECI"&&(u=.1),f*u}return 1}static async findItemByGuid(s,t){var i;const e=s.getAllPropertiesIDs();for(const n of e){const r=await s.getProperties(n);if(r&&((i=r.GlobalId)==null?void 0:i.value)===t)return r}return null}static async getRelationMap(s,t,e){var a;const n=e??(async()=>{}),r={},o=s.getAllPropertiesIDs();for(const l of o){const h=await s.getProperties(l);if(!h)continue;const d=h.type===t,u=Object.keys(h).find(m=>m.startsWith("Relating")),f=Object.keys(h).find(m=>m.startsWith("Related"));if(!(d&&u&&f))continue;const E=await s.getProperties((a=h[u])==null?void 0:a.value),p=h[f];if(!E||!p||!(p&&Array.isArray(p)))continue;const I=p.map(m=>m.value);await n(E.expressID,I),r[E.expressID]=I}return r}static async getQsetQuantities(s,t,e){const n=e??(()=>{}),r=await s.getProperties(t);return!r||r.type!==Z.IFCELEMENTQUANTITY?null:(r.Quantities??[{}]).map(l=>(l.value&&n(l.value),l.value)).filter(l=>l!==null)}static async getPsetProps(s,t,e){const n=e??(()=>{}),r=await s.getProperties(t);return!r||r.type!==Z.IFCPROPERTYSET?null:(r.HasProperties??[{}]).map(l=>(l.value&&n(l.value),l.value)).filter(l=>l!==null)}static async getPsetRel(s,t){var o;if(!await s.getProperties(t))return null;const i=await s.getAllPropertiesOfType(Z.IFCRELDEFINESBYPROPERTIES);if(!i)return null;const n=Object.values(i);let r=null;for(const a of n)((o=a.RelatingPropertyDefinition)==null?void 0:o.value)===t&&(r=a.expressID);return r}static async getQsetRel(s,t){return Oe.getPsetRel(s,t)}static async getEntityName(s,t){var r;const e=await s.getProperties(t);if(!e)return{key:null,name:null};const i=Object.keys(e).find(o=>o.endsWith("Name"))??null,n=i?(r=e[i])==null?void 0:r.value:null;return{key:i,name:n}}static async getQuantityValue(s,t){const e=await s.getProperties(t);if(!e)return{key:null,value:null};const i=Object.keys(e).find(r=>r.endsWith("Value"))??null;let n;return i===null||e[i]===void 0||e[i]===null?n=null:n=e[i].value,{key:i,value:n}}static isRel(s){return _n[s].startsWith("IFCREL")}static async attributeExists(s,t,e){const i=await s.getProperties(t);return i?Object.keys(i).includes(e):!1}static async groupEntitiesByType(s,t){var i;const e=new Map;for(const n of t){const r=await s.getProperties(n);if(!r)continue;const o=r.type;e.get(o)||e.set(o,new Set),(i=e.get(o))==null||i.add(n)}return e}}class Wa{constructor(){T(this,"factor",1);T(this,"complement",1)}apply(s){const e=this.getScaleMatrix().multiply(s);s.copy(e)}setUp(s){var n,r,o;this.factor=1;const t=this.getLengthUnits(s);if(!t)return;const e=t==null,i=t.Name===void 0||t.Name===null;e||i||(t.Name.value==="FOOT"&&(this.factor=.3048),((n=t.Prefix)==null?void 0:n.value)==="MILLI"?this.complement=.001:((r=t.Prefix)==null?void 0:r.value)==="CENTI"?this.complement=.01:((o=t.Prefix)==null?void 0:o.value)==="DECI"&&(this.complement=.01))}getLengthUnits(s){try{const e=s.GetLineIDsWithType(0,Z.IFCUNITASSIGNMENT).get(0),i=s.GetLine(0,e);for(const n of i.Units){if(!n||n.value===null||n.value===void 0)continue;const r=s.GetLine(0,n.value);if(r.UnitType&&r.UnitType.value==="LENGTHUNIT")return r}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const s=this.factor;return new x.Matrix4().fromArray([s,0,0,0,0,s,0,0,0,0,s,0,0,0,0,1])}}class Gr{constructor(){T(this,"itemsByFloor",{});T(this,"_units",new Wa)}setUp(s){this._units.setUp(s),this.cleanUp();try{const t=s.GetLineIDsWithType(0,Z.IFCRELCONTAINEDINSPATIALSTRUCTURE),e=new Set,i=s.GetLineIDsWithType(0,Z.IFCSPACE);for(let l=0;l<i.size();l++)e.add(i.get(l));const n=s.GetLineIDsWithType(0,Z.IFCRELAGGREGATES),r=n.size();for(let l=0;l<r;l++){const h=n.get(l),d=s.GetLine(0,h);if(!d||!d.RelatingObject||!d.RelatedObjects)continue;const u=d.RelatingObject.value,f=d.RelatedObjects;for(const E of f){const p=E.value;e.has(p)&&(this.itemsByFloor[p]=u)}}const o={},a=t.size();for(let l=0;l<a;l++){const h=t.get(l),d=s.GetLine(0,h);if(!d||!d.RelatingStructure||!d.RelatedElements)continue;const u=d.RelatingStructure.value,f=d.RelatedElements;if(e.has(u))for(const E of f){o[u]||(o[u]=[]);const p=E.value;o[u].push(p)}else for(const E of f){const p=E.value;this.itemsByFloor[p]=u}}for(const l in o){const h=this.itemsByFloor[l];if(h!==void 0){const d=o[l];for(const u of d)this.itemsByFloor[u]=h}}for(let l=0;l<r;l++){const h=n.get(l),d=s.GetLine(0,h);if(!d||!d.RelatingObject||!d.RelatedObjects)continue;const u=d.RelatingObject.value,f=d.RelatedObjects;for(const E of f){const p=E.value,I=this.itemsByFloor[u];I!==void 0&&(this.itemsByFloor[p]=I)}}}catch{console.log("Could not get floors.")}}cleanUp(){this.itemsByFloor={}}}class Si{constructor(){T(this,"includeProperties",!0);T(this,"optionalCategories",[Z.IFCSPACE]);T(this,"coordinate",!0);T(this,"wasm",{path:"",absolute:!1,logLevel:Z.LogLevel.LOG_LEVEL_OFF});T(this,"excludedCategories",new Set);T(this,"includedCategories",new Set);T(this,"saveLocations",!1);T(this,"webIfc",{COORDINATE_TO_ORIGIN:!0});T(this,"autoSetWasm",!0);T(this,"customLocateFileHandler",null)}}class Yr{constructor(){T(this,"defLineMat",new x.LineBasicMaterial({color:16777215}))}read(s){const t=s.GetAllAlignments(0),e=s.GetAllCrossSections2D(0),i=s.GetAllCrossSections3D(0),n={IfcAlignment:t,IfcCrossSection2D:e,IfcCrossSection3D:i};return this.get(n)}get(s){if(s.IfcAlignment){const t=new Map;for(const e of s.IfcAlignment){const i=new Ie.Alignment;i.absolute=this.getCurves(e.curve3D,i),i.horizontal=this.getCurves(e.horizontal,i),i.vertical=this.getCurves(e.vertical,i),t.set(t.size,i)}return{alignments:t,coordinationMatrix:new x.Matrix4}}}getCurves(s,t){const e=[];let i=0;for(const n of s){const r={};if(n.data)for(const u of n.data){const[f,E]=u.split(": "),p=parseFloat(E);r[f]=p||E}const{points:o}=n,a=new Float32Array(o.length*3);for(let u=0;u<o.length;u++){const{x:f,y:E,z:p}=o[u];a[u*3]=f,a[u*3+1]=E,a[u*3+2]=p||0}const l=new x.BufferAttribute(a,3),h=new x.EdgesGeometry;h.setAttribute("position",l);const d=new Ie.CurveMesh(i,r,t,h,this.defLineMat);e.push(d.curve),i++}return e}}class Hr{getNameInfo(s){var d;const t={},{arguments:e}=s.GetHeaderLine(0,Z.FILE_NAME)||{};if(!e)return t;const[i,n,r,o,a,l,h]=e;if(i!=null&&i.value&&(t.name=i.value),n!=null&&n.value&&(t.creationDate=new Date(n.value)),r){t.author={};const[u,f]=r;u!=null&&u.value&&(t.author.name=u.value),f!=null&&f.value&&(t.author.email=f.value)}return(d=o[0])!=null&&d.value&&(t.organization=o[0].value),a!=null&&a.value&&(t.preprocessorVersion=a==null?void 0:a.value),l!=null&&l.value&&(t.originatingSystem=l==null?void 0:l.value),h!=null&&h.value&&(t.authorization=h==null?void 0:h.value),t}getDescriptionInfo(s){var r;const t={},{arguments:e}=s.GetHeaderLine(0,Z.FILE_DESCRIPTION)||{};if(!e)return t;const[i,n]=e;if((r=i[0])!=null&&r.value){const o=i[0].value.match(/\[([^\]]+)\]/);o&&o[1]&&(t.viewDefinition=o[1])}return n!=null&&n.value&&(t.implementationLevel=n.value),t}}class Wr{static get(s,t){const e=[Z.IFCPROJECT,Z.IFCSITE,Z.IFCBUILDING,Z.IFCBUILDINGSTOREY,Z.IFCSPACE,Z.IFCROAD,Z.IFCFACILITY,Z.IFCFACILITYPART,Z.IFCBRIDGE],i=s.data;for(const n of e){const r=t.GetLineIDsWithType(0,n),o=r.size();for(let a=0;a<o;a++){const l=r.get(a);i.has(l)||i.set(l,[[],[0,n]])}}}}const An=new Set([1123145078,574549367,1675464909,2059837836,3798115385,32440307,3125803723,3207858831,2740243338,2624227202,4240577450,3615266464,3724593414,220341763,477187591,1878645084,1300840506,3303107099,1607154358,1878645084,846575682,1351298697,2417041796,3049322572,3331915920,1416205885,776857604,3285139300,3958052878,2827736869,2732653382,673634403,3448662350,4142052618,2924175390,803316827,2556980723,1809719519,2205249479,807026263,3737207727,1660063152,2347385850,2705031697,3732776249,2485617015,2611217952,1704287377,2937912522,2770003689,1281925730,1484403080,3448662350,4142052618,3800577675,4006246654,3590301190,1383045692,2775532180,2047409740,370225590,3593883385,2665983363,4124623270,812098782,3649129432,987898635,1105321065,3510044353,1635779807,2603310189,3406155212,1310608509,4261334040,2736907675,3649129432,1136057603,1260505505,4182860854,2713105998,2898889636,59481748,3749851601,3486308946,3150382593,1062206242,3264961684,15328376,1485152156,370225590,1981873012,2859738748,45288368,2614616156,2732653382,775493141,2147822146,2601014836,2629017746,1186437898,2367409068,1213902940,3632507154,3900360178,476780140,1472233963,2804161546,3008276851,738692330,374418227,315944413,3905492369,3570813810,2571569899,178912537,2294589976,1437953363,2133299955,572779678,3092502836,388784114,2624227202,1425443689,3057273783,2347385850,1682466193,2519244187,2839578677,3958567839,2513912981,2830218821,427810014]),fi=class fi extends Ft{constructor(t){super(t);T(this,"enabled",!0);t.add(fi.uuid,this)}async export(t,e,i=!1,n=!0){const r={},o=new Set(t.GetIfcEntityList(e)),a=new Set([Z.IFCPROJECT,Z.IFCSITE,Z.IFCBUILDING,Z.IFCBUILDINGSTOREY,Z.IFCSPACE]);for(const l of a)o.add(l);for(const l of o){if(An.has(l))continue;const h=a.has(l)&&n,d=t.GetLineIDsWithType(e,l);for(const u of d){const f=t.GetLine(0,u,h,i);r[f.expressID]=f}}return r}};T(fi,"uuid","b32c4332-cd67-436e-ba7f-196646c7a635");let ii=fi;const Cs=class Cs extends Ft{constructor(t){super(t);T(this,"onDisposed",new Q);T(this,"onIfcStartedLoading",new Q);T(this,"onSetup",new Q);T(this,"settings",new Si);T(this,"webIfc",new Z.IfcAPI);T(this,"enabled",!0);T(this,"_material",new x.MeshLambertMaterial);T(this,"_spatialTree",new Gr);T(this,"_metaData",new Hr);T(this,"_fragmentInstances",new Map);T(this,"_civil",new Yr);T(this,"_visitedFragments",new Map);T(this,"_materialT",new x.MeshLambertMaterial({transparent:!0,opacity:.5}));this.components.add(Cs.uuid,this),this.settings.excludedCategories.add(Z.IFCOPENINGELEMENT)}dispose(){this.webIfc=null,this.onDisposed.trigger(Cs.uuid),this.onDisposed.reset()}async setup(t){this.settings={...this.settings,...t},this.settings.autoSetWasm&&await this.autoSetWasm(),this.onSetup.trigger()}async load(t,e=!0){const i=performance.now();this.onIfcStartedLoading.trigger(),await this.readIfcFile(t);const n=await this.getAllGeometries(),o=await this.components.get(ii).export(this.webIfc,0);n.setLocalProperties(o);const a=this.components.get(gt);a.groups.set(n.uuid,n);for(const l of n.items)a.list.set(l.id,l),l.mesh.uuid=l.id,l.group=n;a.onFragmentsLoaded.trigger(n),e&&a.coordinate([n]);for(const[l]of n.data){const h=o[l];if(!h||!h.GlobalId)continue;const d=h.GlobalId.value||h.GlobalId;n.globalToExpressIDs.set(d,l)}return Wr.get(n,this.webIfc),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-i} ms!`),n}async readIfcFile(t){const{path:e,absolute:i,logLevel:n}=this.settings.wasm;return this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(this.settings.customLocateFileHandler||void 0),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(t,this.settings.webIfc)}cleanUp(){try{this.webIfc.Dispose()}catch{console.log("Web-ifc wasn't disposed.")}this.webIfc=null,this.webIfc=new Z.IfcAPI,this._visitedFragments.clear(),this._fragmentInstances.clear()}async getAllGeometries(){this._spatialTree.setUp(this.webIfc);const t=this.webIfc.GetIfcEntityList(0),e=new Ie.FragmentsGroup;e.ifcMetadata={name:"",description:"",...this._metaData.getNameInfo(this.webIfc),...this._metaData.getDescriptionInfo(this.webIfc),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};const i=[];for(const r of t){if(!this.webIfc.IsIfcElement(r)&&r!==Z.IFCSPACE)continue;const o=this.settings.includedCategories;if(o.size>0&&!o.has(r))continue;if(this.settings.excludedCategories.has(r))continue;const a=this.webIfc.GetLineIDsWithType(0,r),l=a.size();for(let h=0;h<l;h++){const d=a.get(h);i.push(d);const u=this._spatialTree.itemsByFloor[d]||0;e.data.set(d,[[],[u,r]])}}this._spatialTree.cleanUp(),this.webIfc.StreamMeshes(0,i,r=>{this.getMesh(r,e)});for(const r of this._visitedFragments){const{index:o,fragment:a}=r[1];e.keyFragments.set(o,a.id)}for(const r of e.items){const o=this._fragmentInstances.get(r.id);if(!o)throw new Error("Fragment not found!");const a=[];for(const[l,h]of o)a.push(h);r.add(a)}const n=this.webIfc.GetCoordinationMatrix(0);return e.coordinationMatrix.fromArray(n),e.civilData=this._civil.read(this.webIfc),e}getMesh(t,e){const i=t.geometries.size(),n=t.expressID;for(let r=0;r<i;r++){const o=t.geometries.get(r),{x:a,y:l,z:h,w:d}=o.color,u=d!==1,{geometryExpressID:f}=o,E=`${f}-${u}`;if(!this._visitedFragments.has(E)){const y=this.getGeometry(this.webIfc,f),w=u?this._materialT:this._material,O=new Ie.Fragment(y,w,1);e.add(O.mesh),e.items.push(O);const M=this._visitedFragments.size;this._visitedFragments.set(E,{index:M,fragment:O})}const p=new x.Color().setRGB(a,l,h,"srgb"),I=new x.Matrix4;I.fromArray(o.flatTransformation);const m=this._visitedFragments.get(E);if(m===void 0)throw new Error("Error getting geometry data for streaming!");const C=e.data.get(n);if(!C)throw new Error("Data not found!");C[0].push(m.index);const{fragment:R}=m;this._fragmentInstances.has(R.id)||this._fragmentInstances.set(R.id,new Map);const g=this._fragmentInstances.get(R.id);if(!g)throw new Error("Instances not found!");if(g.has(n)){const y=g.get(n);if(!y)throw new Error("Instance not found!");y.transforms.push(I),y.colors&&y.colors.push(p)}else g.set(n,{id:n,transforms:[I],colors:[p]})}}getGeometry(t,e){const i=t.GetGeometry(0,e),n=t.GetIndexArray(i.GetIndexData(),i.GetIndexDataSize()),r=t.GetVertexArray(i.GetVertexData(),i.GetVertexDataSize()),o=new Float32Array(r.length/2),a=new Float32Array(r.length/2);for(let u=0;u<r.length;u+=6)o[u/2]=r[u],o[u/2+1]=r[u+1],o[u/2+2]=r[u+2],a[u/2]=r[u+3],a[u/2+1]=r[u+4],a[u/2+2]=r[u+5];const l=new x.BufferGeometry,h=new x.BufferAttribute(o,3),d=new x.BufferAttribute(a,3);return l.setAttribute("position",h),l.setAttribute("normal",d),l.setIndex(Array.from(n)),i.delete(),l}async autoSetWasm(){const t=await fetch(`https://unpkg.com/@thatopen/components@${Js.release}/package.json`);if(!t.ok){console.warn("Couldn't get openbim-components package.json. Set wasm settings manually.");return}const e=await t.json();if(!("web-ifc"in e.peerDependencies))console.warn("Couldn't get web-ifc from peer dependencies in openbim-components. Set wasm settings manually.");else{const i=e.peerDependencies["web-ifc"];this.settings.wasm.path=`https://unpkg.com/web-ifc@${i}/`,this.settings.wasm.absolute=!0}}};T(Cs,"uuid","a659add7-1418-4771-a0d6-7d4d438e4624");let ni=Cs;const Xr={IfcRelAssignsToControl:{related:5,relating:7},IfcRelAssignsToGroup:{related:5,relating:7},IfcRelAssignsToProduct:{related:5,relating:7},IfcRelAssociatesClassification:{related:5,relating:6},IfcRelAssociatesMaterial:{related:5,relating:6},IfcRelAssociatesDocument:{related:5,relating:6},IfcRelContainedInSpatialStructure:{related:5,relating:6},IfcRelFlowControlElements:{related:5,relating:6},IfcRelConnectsElements:{related:7,relating:6},IfcRelDeclares:{related:6,relating:5},IfcRelAggregates:{related:6,relating:5},IfcRelNests:{related:6,relating:5},IfcRelDefinesByProperties:{related:5,relating:6},IfcRelDefinesByType:{related:5,relating:6},IfcRelDefinesByTemplate:{related:5,relating:6}},Zr={[Z.IFCRELASSIGNSTOCONTROL]:"IfcRelAssignsToControl",[Z.IFCRELASSIGNSTOGROUP]:"IfcRelAssignsToGroup",[Z.IFCRELASSIGNSTOPRODUCT]:"IfcRelAssignsToProduct",[Z.IFCRELASSOCIATESCLASSIFICATION]:"IfcRelAssociatesClassification",[Z.IFCRELASSOCIATESMATERIAL]:"IfcRelAssociatesMaterial",[Z.IFCRELASSOCIATESDOCUMENT]:"IfcRelAssociatesDocument",[Z.IFCRELCONTAINEDINSPATIALSTRUCTURE]:"IfcRelContainedInSpatialStructure",[Z.IFCRELCONNECTSELEMENTS]:"IfcRelConnectsElements",[Z.IFCRELFLOWCONTROLELEMENTS]:"IfcRelFlowControlElements",[Z.IFCRELDECLARES]:"IfcRelDeclares",[Z.IFCRELAGGREGATES]:"IfcRelAggregates",[Z.IFCRELNESTS]:"IfcRelNests",[Z.IFCRELDEFINESBYPROPERTIES]:"IfcRelDefinesByProperties",[Z.IFCRELDEFINESBYTYPE]:"IfcRelDefinesByType",[Z.IFCRELDEFINESBYTEMPLATE]:"IfcRelDefinesByTemplate"},Ee=class Ee extends Ft{constructor(t){super(t);T(this,"onDisposed",new Q);T(this,"onRequestFile",new Q);T(this,"ifcToExport",null);T(this,"onElementToPset",new Q);T(this,"onPropToPset",new Q);T(this,"onPsetRemoved",new Q);T(this,"onDataChanged",new Q);T(this,"wasm",{path:"/",absolute:!1});T(this,"enabled",!0);T(this,"attributeListeners",{});T(this,"selectedModel");T(this,"changeMap",{});this.components.add(Ee.uuid,this)}dispose(){this.selectedModel=void 0,this.attributeListeners={},this.changeMap={},this.onElementToPset.reset(),this.onPropToPset.reset(),this.onPsetRemoved.reset(),this.onDataChanged.reset(),this.onDisposed.trigger(Ee.uuid),this.onDisposed.reset()}static getIFCSchema(t){const e=t.ifcMetadata.schema;if(!e)throw new Error("IFC Schema not found");return e.startsWith("IFC2X3")?"IFC2X3":e.startsWith("IFC4")&&e.replace("IFC4","")===""?"IFC4":e.startsWith("IFC4X3")?"IFC4X3":e}async setData(t,...e){for(const i of e){const{expressID:n}=i;(!n||n===-1)&&(i.expressID=this.getNewExpressID(t)),await t.setProperties(i.expressID,i),this.registerChange(t,i.expressID)}}async newPset(t,e,i){const n=Ee.getIFCSchema(t),{ownerHistoryHandle:r}=await this.getOwnerHistory(t),o=this.newGUID(t),a=new Z[n].IfcLabel(e),l=i?new Z[n].IfcText(i):null,h=new Z[n].IfcPropertySet(o,r,a,l,[]);h.expressID=this.getNewExpressID(t);const d=this.newGUID(t),u=new Z[n].IfcRelDefinesByProperties(d,r,null,null,[],new Z.Handle(h.expressID));return u.expressID=this.getNewExpressID(t),await this.setData(t,h,u),{pset:h,rel:u}}async removePset(t,...e){for(const i of e){const n=await t.getProperties(i);if((n==null?void 0:n.type)!==Z.IFCPROPERTYSET)continue;const r=await Oe.getPsetRel(t,i);if(r&&(await t.setProperties(r,null),this.registerChange(t,r)),n){for(const o of n.HasProperties)await t.setProperties(o.value,null);await t.setProperties(i,null),this.onPsetRemoved.trigger({model:t,psetID:i}),this.registerChange(t,i)}}}newSingleStringProperty(t,e,i,n){return this.newSingleProperty(t,e,i,n)}newSingleNumericProperty(t,e,i,n){return this.newSingleProperty(t,e,i,n)}newSingleBooleanProperty(t,e,i,n){return this.newSingleProperty(t,e,i,n)}async removePsetProp(t,e,i){const n=await t.getProperties(e),r=await t.getProperties(i);!n||!r||n.type===Z.IFCPROPERTYSET&&r&&(n.HasProperties=n.HasProperties.filter(o=>o.value!==i),await t.setProperties(i,null),this.registerChange(t,e,i))}addElementToPset(t,e,...i){this.components.get(Ce).addEntitiesRelation(t,e,{type:Z.IFCRELDEFINESBYPROPERTIES,inv:"IsDefinedBy"},...i)}async addPropToPset(t,e,...i){const n=await t.getProperties(e);if(n){for(const r of i){if(n.HasProperties.includes(r))continue;const o=new Z.Handle(r);n.HasProperties.push(o),this.onPropToPset.trigger({model:t,psetID:e,propID:r})}this.registerChange(t,e)}}async createIfcRel(t,e,i,n){const r=Zr[e];if(!r)throw new Error(`IfcPropertiesManager: ${r} is unsoported.`);const o=t.ifcMetadata.schema,a=Xr[r],l=Z[o][r];if(!(a&&l))throw new Error(`IfcPropertiesManager: ${r} is unsoported.`);const h=[new Z[o].IfcGloballyUniqueId(re.create())],{related:d,relating:u}=a,E=[...new Set(n)].map(m=>new Z.Handle(m)),p=(m,C)=>{for(let R=m;R<C-1;R++)h.push(null)};d<u?(p(1,d),h.push(E),p(d,u),h.push(new Z.Handle(i))):(p(1,u),p(u,d),h.push(new Z.Handle(i)),h.push(E));const I=new l(...h);return await this.setData(t,I),I}async saveToIfc(t,e){const i=this.components.get(ni),n=i.webIfc,r=await i.readIfcFile(e);await this.components.get(Ce).applyRelationChanges();const a=this.changeMap[t.uuid]??[];for(const h of a){const d=await t.getProperties(h);d?n.WriteLine(r,d):n.DeleteLine(r,h)}const l=n.SaveModel(r);return i.webIfc.CloseModel(r),i.cleanUp(),l}async getEntityRef(t,e){const i=await t.getAllPropertiesOfType(e);if(!i)return null;const n=[];for(const r in i){const o=new Z.Handle(Number(r));n.push(o)}return n}async setAttributeListener(t,e,i){this.attributeListeners[t.uuid]||(this.attributeListeners[t.uuid]={});const n=this.attributeListeners[t.uuid][e]?this.attributeListeners[t.uuid][e][i]:null;if(n)return n;const r=await t.getProperties(e);if(!r)throw new Error(`Entity with expressID ${e} doesn't exists.`);const o=r[i];if(Array.isArray(o)||!o)throw new Error(`Attribute ${i} is array or null, and it can't have a listener.`);const a=o.value;if(a===void 0||a==null)throw new Error(`Attribute ${i} has a badly defined handle.`);const l=new Q;return Object.defineProperty(r[i],"value",{get(){return this._value},async set(h){this._value=h,l.trigger(h)}}),r[i].value=a,this.attributeListeners[t.uuid][e]||(this.attributeListeners[t.uuid][e]={}),this.attributeListeners[t.uuid][e][i]=l,l}getNewExpressID(t){return t.ifcMetadata.maxExpressID++,t.ifcMetadata.maxExpressID}newGUID(t){const e=Ee.getIFCSchema(t);return new Z[e].IfcGloballyUniqueId(re.create())}async getOwnerHistory(t){const e=await t.getAllPropertiesOfType(Z.IFCOWNERHISTORY);if(!e)throw new Error("No OwnerHistory was found.");const i=Object.keys(e).map(o=>parseInt(o,10)),n=e[i[0]],r=new Z.Handle(n.expressID);return{ownerHistory:n,ownerHistoryHandle:r}}registerChange(t,...e){this.changeMap[t.uuid]||(this.changeMap[t.uuid]=new Set);for(const i of e)this.changeMap[t.uuid].add(i),this.onDataChanged.trigger({model:t,expressID:i})}async newSingleProperty(t,e,i,n){const r=Ee.getIFCSchema(t),o=new Z[r].IfcIdentifier(i),a=new Z[r][e](n),l=new Z[r].IfcPropertySingleValue(o,null,a,null);return l.expressID=this.getNewExpressID(t),await this.setData(t,l),l}};T(Ee,"uuid","58c2d9f0-183c-48d6-a402-dfcf5b9a34df");let ri=Ee;const Ts=class Ts extends Ft{constructor(t){super(t);T(this,"onDisposed",new Q);T(this,"onRelationsIndexed",new Q);T(this,"relationMaps",{});T(this,"enabled",!0);T(this,"_relToAttributesMap",ln);T(this,"_inverseAttributes",["IsDecomposedBy","Decomposes","AssociatedTo","HasAssociations","ClassificationForObjects","IsGroupedBy","HasAssignments","IsDefinedBy","DefinesOcurrence","IsTypedBy","Types","Defines","ContainedInStructure","ContainsElements","HasControlElements","AssignedToFlowElement","ConnectedTo","ConnectedFrom","ReferencedBy","Declares","HasContext","Controls","IsNestedBy","Nests","DocumentRefForObjects"]);T(this,"_ifcRels",[Z.IFCRELAGGREGATES,Z.IFCRELASSOCIATESMATERIAL,Z.IFCRELASSOCIATESCLASSIFICATION,Z.IFCRELASSIGNSTOGROUP,Z.IFCRELDEFINESBYPROPERTIES,Z.IFCRELDEFINESBYTYPE,Z.IFCRELDEFINESBYTEMPLATE,Z.IFCRELCONTAINEDINSPATIALSTRUCTURE,Z.IFCRELFLOWCONTROLELEMENTS,Z.IFCRELCONNECTSELEMENTS,Z.IFCRELASSIGNSTOPRODUCT,Z.IFCRELDECLARES,Z.IFCRELASSIGNSTOCONTROL,Z.IFCRELNESTS,Z.IFCRELASSOCIATESDOCUMENT]);T(this,"onFragmentsDisposed",t=>{delete this.relationMaps[t.groupID]});T(this,"_changeMap",{});T(this,"onEntitiesRelated",new Q);this.components.add(Ts.uuid,this),t.get(gt).onFragmentsDisposed.add(this.onFragmentsDisposed)}indexRelations(t,e,i,n){const r=Object.keys(e).find(d=>d.startsWith("Relating")),o=Object.keys(e).find(d=>d.startsWith("Related"));if(!(r&&o))return;const a=e[r].value,l=e[o].map(d=>d.value),h=this.getAttributeIndex(n);if(h!==null){let d=t.get(a);d||(d=new Map,t.set(a,d));let u=d.get(h);u||(u=[],d.set(h,u)),u.push(...l)}for(const d of l){const u=this.getAttributeIndex(i);if(u===null)continue;let f=t.get(d);f||(f=new Map,t.set(d,f));let E=f.get(u);E||(E=[],f.set(u,E)),E.push(a)}}getAttributeIndex(t){const e=this._inverseAttributes.indexOf(t);return e===-1?null:e}setRelationMap(t,e){this.relationMaps[t.uuid]=e,this.onRelationsIndexed.trigger({modelID:t.uuid,relationsMap:e})}async process(t){if(!t.hasProperties)throw new Error("FragmentsGroup properties not found");let e=this.relationMaps[t.uuid];if(e)return e;e=new Map;for(const i of this._ifcRels){const n=await t.getAllPropertiesOfType(i);if(!n)continue;const r=this._relToAttributesMap.get(i);if(!r)continue;const{forRelated:o,forRelating:a}=r;for(const l in n){const h=n[l];this.indexRelations(e,h,o,a)}}return this.setRelationMap(t,e),e}async processFromWebIfc(t,e){const i=new Map;for(const n of this._ifcRels){const r=this._relToAttributesMap.get(n);if(!r)continue;const{forRelated:o,forRelating:a}=r,l=t.GetLineIDsWithType(e,n);for(let h=0;h<l.size();h++){const d=await t.properties.getItemProperties(e,l.get(h));this.indexRelations(i,d,o,a)}}return this.onRelationsIndexed.trigger({modelID:e.toString(),relationsMap:i}),i}getEntityRelations(t,e,i){const n=this.relationMaps[t.uuid];if(!n)throw new Error(`IfcRelationsIndexer: model ${t.uuid} has no relations indexed.`);const r=n.get(e),o=this.getAttributeIndex(i);if(r===void 0||o===null)return null;const a=r.get(o);return a||null}serializeRelations(t){const e={};for(const[i,n]of t.entries()){e[i]||(e[i]={});for(const[r,o]of n.entries())e[i][r]=o}return JSON.stringify(e)}serializeModelRelations(t){const e=this.relationMaps[t.uuid];return e?this.serializeRelations(e):null}serializeAllRelations(){const t={};for(const e in this.relationMaps){const i=this.relationMaps[e],n={};for(const[r,o]of i.entries()){n[r]||(n[r]={});for(const[a,l]of o.entries())n[r][a]=l}t[e]=n}return JSON.stringify(t)}getRelationsMapFromJSON(t){const e=JSON.parse(t),i=new Map;for(const n in e){const r=e[n],o=new Map;for(const a in r)o.set(Number(a),r[a]);i.set(Number(n),o)}return i}dispose(){this.relationMaps={},this.components.get(gt).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(Ts.uuid),this.onDisposed.reset()}getEntitiesWithRelation(t,e,i){const n=this.relationMaps[t.uuid];if(!n)throw new Error("IfcRelationsIndexer: the model relations are not indexed!");const r=new Set;for(const[o,a]of n){const l=this.getAttributeIndex(e);if(l===null)throw new Error("IfcRelationsIndexer: invalid inverse attribute name");const h=a.get(l);h&&h.includes(i)&&r.add(o)}return r}addEntityRelations(t,e,i,...n){const r=this.getEntityRelations(t,e,i);if(r)r.push(...n);else{const o=this.getAttributeIndex(i);if(!o)throw new Error(`IfcRelationsIndexer: ${i} is not a valid relation name.`);const a=this.relationMaps[t.uuid].get(e);a==null||a.set(o,n)}}async applyRelationChanges(){const t=this.components.get(gt),e=this.components.get(ri);for(const i in this._changeMap){const n=t.groups.get(i);if(!n)continue;const r=this._changeMap[i];for(const[o,a]of r)for(const[l,h]of a){const{related:d,relID:u}=h;if(u){const f=await n.getProperties(u);if(!f)continue;const E=Object.keys(f),p=E.find(m=>m.startsWith("Related")),I=E.find(m=>m.startsWith("Relating"));if(!(p&&I))continue;f[p]=[...d].map(m=>new Z.Handle(m)),f[I]=new Z.Handle(l),await e.setData(n,f)}else{const f=await e.createIfcRel(n,o,l,[...d]);if(!f)continue;h.relID=f.expressID}}}}addEntitiesRelation(t,e,i,...n){const{type:r,inv:o}=i,a=this.relationMaps[t.uuid];if(!a||!this._ifcRels.includes(r))return;const l=ln.get(r);if(!l)return;const{forRelated:h,forRelating:d}=l;if(!(h===o||d===o))return;let u=this._changeMap[t.uuid];u||(u=new he,this._changeMap[t.uuid]=u);const f=d===o?[e]:n,E=h===o?[e]:n;let p=u.get(r);p||(p=new he,p.onItemSet.add(()=>this.onEntitiesRelated.trigger({invAttribute:o,relType:r,relatingIDs:f,relatedIDs:E})),p.onItemUpdated.add(()=>this.onEntitiesRelated.trigger({invAttribute:o,relType:r,relatingIDs:f,relatedIDs:E})),u.set(r,p));for(const I of f){let m=p.get(I);m||(m={related:new Se},p.set(I,m)),m.related.add(...E)}for(const I of f){let m=a.get(I);m||(m=new Map,a.set(I,m));const C=this.getAttributeIndex(d);if(C!==null){let R=m.get(C);R||(R=[],m.set(C,R)),R.push(...E)}}for(const I of E){let m=a.get(I);m||(m=new Map,a.set(I,m));const C=this.getAttributeIndex(h);if(C===null)continue;let R=m.get(C);R||(R=[],m.set(C,R)),R.push(...f)}}getEntityChildren(t,e,i=new Set){if(i.add(e),this.relationMaps[t.uuid]===void 0)throw new Error("The provided model has no indices. You have to generate them first.");const r=this.getEntityRelations(t,e,"IsDecomposedBy");if(r)for(const a of r)this.getEntityChildren(t,a,i);const o=this.getEntityRelations(t,e,"ContainsElements");if(o)for(const a of o)this.getEntityChildren(t,a,i);return i}};T(Ts,"uuid","23a889ab-83b3-44a4-8bee-ead83438370b");let Ce=Ts;const pi=class pi extends Ft{constructor(t){super(t);T(this,"onDisposed",new Q);T(this,"onFragmentsLoaded",new Q);T(this,"onFragmentsDisposed",new Q);T(this,"list",new he);T(this,"groups",new he);T(this,"baseCoordinationModel","");T(this,"baseCoordinationMatrix",new x.Matrix4);T(this,"enabled",!0);T(this,"_loader",new Ir.Serializer);this.components.add(pi.uuid,this)}get meshes(){const t=[];for(const[e,i]of this.list)t.push(i.mesh);return t}dispose(){for(const[t,e]of this.groups)e.dispose(!0);this.baseCoordinationModel="",this.groups.clear(),this.list.clear(),this.onFragmentsLoaded.reset(),this.onFragmentsDisposed.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}disposeGroup(t){const{uuid:e}=t,i=[];for(const n of t.items)i.push(n.id),this.list.delete(n.id);t.dispose(!0),this.groups.delete(t.uuid),this.groups.size===0&&(this.baseCoordinationModel="",this.baseCoordinationMatrix=new x.Matrix4),this.onFragmentsDisposed.trigger({groupID:e,fragmentIDs:i})}load(t,e){const n={...{coordinate:!0},...e},{coordinate:r,name:o,properties:a,relationsMap:l}=n,h=this._loader.import(t);e&&(h.isStreamed=e.isStreamed||!1),o&&(h.name=o);for(const d of h.items)d.group=h,this.list.set(d.id,d);return r&&this.coordinate([h]),this.groups.set(h.uuid,h),a&&h.setLocalProperties(a),l&&this.components.get(Ce).setRelationMap(h,l),this.onFragmentsLoaded.trigger(h),h}export(t){return this._loader.export(t)}getModelIdMap(t){const e={};for(const i in t){const n=this.list.get(i);if(!(n&&n.group))continue;const r=n.group;r.uuid in e||(e[r.uuid]=new Set);const o=t[i];for(const a of o)e[r.uuid].add(a)}return e}modelIdToFragmentIdMap(t){let e={};for(const i in t){const n=this.groups.get(i);if(!n)continue;const r=t[i],o=n.getFragmentMap(r);e={...e,...o}}return e}guidToFragmentIdMap(t){const e={};for(const[n,r]of this.groups){n in e||(e[n]=new Set);for(const o of t){const a=r.globalToExpressIDs.get(o);a&&e[n].add(a)}}return this.modelIdToFragmentIdMap(e)}coordinate(t=Array.from(this.groups.values())){if(this.baseCoordinationModel.length===0){const i=t.pop();if(!i)return;this.baseCoordinationModel=i.uuid,this.baseCoordinationMatrix=i.coordinationMatrix.clone()}if(t.length)for(const i of t)i.coordinationMatrix.equals(this.baseCoordinationMatrix)||(i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),i.updateMatrix(),this.applyBaseCoordinateSystem(i,i.coordinationMatrix))}applyBaseCoordinateSystem(t,e){e&&t.applyMatrix4(e.clone().invert()),t.applyMatrix4(this.baseCoordinationMatrix)}clone(t,e){const i=t.cloneGroup(e);this.groups.set(i.uuid,i);for(const n of i.items)this.list.set(n.id,n);return i}};T(pi,"uuid","fef46874-46a3-461b-8c44-2922ab77c806");let gt=pi;var Zs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xa(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}function $s(c){throw new Error('Could not dynamically require "'+c+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var $r={exports:{}};/*!
128
+ `,extensions:{derivatives:!0}});this.three=new x.Mesh(a,l),this.three.frustumCulled=!1,t.scene.three.add(this.three),this.setupEvents(!0)}get visible(){return this.three.visible}set visible(s){s?this.world.scene.three.add(this.three):this.three.removeFromParent()}get material(){return this.three.material}get fade(){return this._fade===3}set fade(s){this._fade=s?3:0,this.material.uniforms.uFade.value=this._fade}dispose(){this.setupEvents(!1),this.components.get(he).destroy(this.three),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(s){if(this.world.isDisposing||!(this.world.camera instanceof We))return;const t=this.world.camera.controls;s?t.addEventListener("update",this.updateZoom):t.removeEventListener("update",this.updateZoom)}}const ui=class ui extends Ft{constructor(t){super(t);_(this,"list",new Map);_(this,"config",{color:new x.Color(12303291),size1:1,size2:10,distance:500});_(this,"onDisposed",new Q);_(this,"enabled",!0);t.add(ui.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a grid!");const e=new vr(this.components,t,this.config);return this.list.set(t.uuid,e),t.onDisposed.add(()=>{this.delete(t)}),e}delete(t){const e=this.list.get(t.uuid);e&&e.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}};_(ui,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");let cn=ui;const Re=new S.Raycaster,Mt=new S.Vector3,ue=new S.Vector3,Rt=new S.Quaternion,nr={X:new S.Vector3(1,0,0),Y:new S.Vector3(0,1,0),Z:new S.Vector3(0,0,1)},ji={type:"change"},rr={type:"mouseDown"},or={type:"mouseUp",mode:null},ar={type:"objectChange"};class Da extends S.Object3D{constructor(s,t){super(),t===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,this.domElement.style.touchAction="none";const e=new Ga;this._gizmo=e,this.add(e);const i=new Ya;this._plane=i,this.add(i);const n=this;function r(C,R){let g=R;Object.defineProperty(n,C,{get:function(){return g!==void 0?g:R},set:function(y){g!==y&&(g=y,i[C]=y,e[C]=y,n.dispatchEvent({type:C+"-changed",value:y}),n.dispatchEvent(ji))}}),n[C]=R,i[C]=R,e[C]=R}r("camera",s),r("object",void 0),r("enabled",!0),r("axis",null),r("mode","translate"),r("translationSnap",null),r("rotationSnap",null),r("scaleSnap",null),r("space","world"),r("size",1),r("dragging",!1),r("showX",!0),r("showY",!0),r("showZ",!0);const o=new S.Vector3,a=new S.Vector3,l=new S.Quaternion,h=new S.Quaternion,d=new S.Vector3,u=new S.Quaternion,f=new S.Vector3,E=new S.Vector3,p=new S.Vector3,I=0,m=new S.Vector3;r("worldPosition",o),r("worldPositionStart",a),r("worldQuaternion",l),r("worldQuaternionStart",h),r("cameraPosition",d),r("cameraQuaternion",u),r("pointStart",f),r("pointEnd",E),r("rotationAxis",p),r("rotationAngle",I),r("eye",m),this._offset=new S.Vector3,this._startNorm=new S.Vector3,this._endNorm=new S.Vector3,this._cameraScale=new S.Vector3,this._parentPosition=new S.Vector3,this._parentQuaternion=new S.Quaternion,this._parentQuaternionInv=new S.Quaternion,this._parentScale=new S.Vector3,this._worldScaleStart=new S.Vector3,this._worldQuaternionInv=new S.Quaternion,this._worldScale=new S.Vector3,this._positionStart=new S.Vector3,this._quaternionStart=new S.Quaternion,this._scaleStart=new S.Vector3,this._getPointer=Ua.bind(this),this._onPointerDown=za.bind(this),this._onPointerHover=Ba.bind(this),this._onPointerMove=Va.bind(this),this._onPointerUp=ka.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(s){if(this.object===void 0||this.dragging===!0)return;Re.setFromCamera(s,this.camera);const t=Qi(this._gizmo.picker[this.mode],Re);t?this.axis=t.object.name:this.axis=null}pointerDown(s){if(!(this.object===void 0||this.dragging===!0||s.button!==0)&&this.axis!==null){Re.setFromCamera(s,this.camera);const t=Qi(this._plane,Re,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,rr.mode=this.mode,this.dispatchEvent(rr)}}pointerMove(s){const t=this.axis,e=this.mode,i=this.object;let n=this.space;if(e==="scale"?n="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(n="world"),i===void 0||t===null||this.dragging===!1||s.button!==-1)return;Re.setFromCamera(s,this.camera);const r=Qi(this._plane,Re,!0);if(r){if(this.pointEnd.copy(r.point).sub(this.worldPositionStart),e==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),n==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),n==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),i.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(n==="local"&&(i.position.applyQuaternion(Rt.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(this._quaternionStart)),n==="world"&&(i.parent&&i.position.add(Mt.setFromMatrixPosition(i.parent.matrixWorld)),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(Mt.setFromMatrixPosition(i.parent.matrixWorld))));else if(e==="scale"){if(t.search("XYZ")!==-1){let o=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(o*=-1),ue.set(o,o,o)}else Mt.copy(this.pointStart),ue.copy(this.pointEnd),Mt.applyQuaternion(this._worldQuaternionInv),ue.applyQuaternion(this._worldQuaternionInv),ue.divide(Mt),t.search("X")===-1&&(ue.x=1),t.search("Y")===-1&&(ue.y=1),t.search("Z")===-1&&(ue.z=1);i.scale.copy(this._scaleStart).multiply(ue),this.scaleSnap&&(t.search("X")!==-1&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(e==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const o=20/this.worldPosition.distanceTo(Mt.setFromMatrixPosition(this.camera.matrixWorld));let a=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Mt.copy(this.rotationAxis).cross(this.eye))*o):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(nr[t]),Mt.copy(nr[t]),n==="local"&&Mt.applyQuaternion(this.worldQuaternion),Mt.cross(this.eye),Mt.length()===0?a=!0:this.rotationAngle=this._offset.dot(Mt.normalize())*o),(t==="E"||a)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),n==="local"&&t!=="E"&&t!=="XYZE"?(i.quaternion.copy(this._quaternionStart),i.quaternion.multiply(Rt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),i.quaternion.copy(Rt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),i.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(ji),this.dispatchEvent(ar)}}pointerUp(s){s.button===0&&(this.dragging&&this.axis!==null&&(or.mode=this.mode,this.dispatchEvent(or)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(s){s.geometry&&s.geometry.dispose(),s.material&&s.material.dispose()})}attach(s){return this.object=s,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(ji),this.dispatchEvent(ar),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Re}getMode(){return this.mode}setMode(s){this.mode=s}setTranslationSnap(s){this.translationSnap=s}setRotationSnap(s){this.rotationSnap=s}setScaleSnap(s){this.scaleSnap=s}setSize(s){this.size=s}setSpace(s){this.space=s}}function Ua(c){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:c.button};{const s=this.domElement.getBoundingClientRect();return{x:(c.clientX-s.left)/s.width*2-1,y:-(c.clientY-s.top)/s.height*2+1,button:c.button}}}function Ba(c){if(this.enabled)switch(c.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(c));break}}function za(c){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(c.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(c)),this.pointerDown(this._getPointer(c)))}function Va(c){this.enabled&&this.pointerMove(this._getPointer(c))}function ka(c){this.enabled&&(this.domElement.releasePointerCapture(c.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(c)))}function Qi(c,s,t){const e=s.intersectObject(c,!0);for(let i=0;i<e.length;i++)if(e[i].object.visible||t)return e[i];return!1}const Ws=new S.Euler,It=new S.Vector3(0,1,0),cr=new S.Vector3(0,0,0),lr=new S.Matrix4,Xs=new S.Quaternion,Ks=new S.Quaternion,se=new S.Vector3,hr=new S.Matrix4,us=new S.Vector3(1,0,0),ye=new S.Vector3(0,1,0),fs=new S.Vector3(0,0,1),Zs=new S.Vector3,cs=new S.Vector3,ls=new S.Vector3;class Ga extends S.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const s=new S.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new S.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=s.clone();e.opacity=.15;const i=t.clone();i.opacity=.5;const n=s.clone();n.color.setHex(16711680);const r=s.clone();r.color.setHex(65280);const o=s.clone();o.color.setHex(255);const a=s.clone();a.color.setHex(16711680),a.opacity=.5;const l=s.clone();l.color.setHex(65280),l.opacity=.5;const h=s.clone();h.color.setHex(255),h.opacity=.5;const d=s.clone();d.opacity=.25;const u=s.clone();u.color.setHex(16776960),u.opacity=.25,s.clone().color.setHex(16776960);const E=s.clone();E.color.setHex(7895160);const p=new S.CylinderGeometry(0,.04,.1,12);p.translate(0,.05,0);const I=new S.BoxGeometry(.08,.08,.08);I.translate(0,.04,0);const m=new S.BufferGeometry;m.setAttribute("position",new S.Float32BufferAttribute([0,0,0,1,0,0],3));const C=new S.CylinderGeometry(.0075,.0075,.5,3);C.translate(0,.25,0);function R(D,q){const G=new S.TorusGeometry(D,.0075,3,64,q*Math.PI*2);return G.rotateY(Math.PI/2),G.rotateX(Math.PI/2),G}function g(){const D=new S.BufferGeometry;return D.setAttribute("position",new S.Float32BufferAttribute([0,0,0,1,1,1],3)),D}const y={X:[[new S.Mesh(p,n),[.5,0,0],[0,0,-Math.PI/2]],[new S.Mesh(p,n),[-.5,0,0],[0,0,Math.PI/2]],[new S.Mesh(C,n),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new S.Mesh(p,r),[0,.5,0]],[new S.Mesh(p,r),[0,-.5,0],[Math.PI,0,0]],[new S.Mesh(C,r)]],Z:[[new S.Mesh(p,o),[0,0,.5],[Math.PI/2,0,0]],[new S.Mesh(p,o),[0,0,-.5],[-Math.PI/2,0,0]],[new S.Mesh(C,o),null,[Math.PI/2,0,0]]],XYZ:[[new S.Mesh(new S.OctahedronGeometry(.1,0),d.clone()),[0,0,0]]],XY:[[new S.Mesh(new S.BoxGeometry(.15,.15,.01),h.clone()),[.15,.15,0]]],YZ:[[new S.Mesh(new S.BoxGeometry(.15,.15,.01),a.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new S.Mesh(new S.BoxGeometry(.15,.15,.01),l.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},w={X:[[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[.3,0,0],[0,0,-Math.PI/2]],[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[0,.3,0]],[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[0,-.3,0],[0,0,Math.PI]]],Z:[[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[0,0,.3],[Math.PI/2,0,0]],[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new S.Mesh(new S.OctahedronGeometry(.2,0),e)]],XY:[[new S.Mesh(new S.BoxGeometry(.2,.2,.01),e),[.15,.15,0]]],YZ:[[new S.Mesh(new S.BoxGeometry(.2,.2,.01),e),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new S.Mesh(new S.BoxGeometry(.2,.2,.01),e),[.15,0,.15],[-Math.PI/2,0,0]]]},O={START:[[new S.Mesh(new S.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],END:[[new S.Mesh(new S.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],DELTA:[[new S.Line(g(),i),null,null,null,"helper"]],X:[[new S.Line(m,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new S.Line(m,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new S.Line(m,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},M={XYZE:[[new S.Mesh(R(.5,1),E),null,[0,Math.PI/2,0]]],X:[[new S.Mesh(R(.5,.5),n)]],Y:[[new S.Mesh(R(.5,.5),r),null,[0,0,-Math.PI/2]]],Z:[[new S.Mesh(R(.5,.5),o),null,[0,Math.PI/2,0]]],E:[[new S.Mesh(R(.75,1),u),null,[0,Math.PI/2,0]]]},b={AXIS:[[new S.Line(m,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},v={XYZE:[[new S.Mesh(new S.SphereGeometry(.25,10,8),e)]],X:[[new S.Mesh(new S.TorusGeometry(.5,.1,4,24),e),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new S.Mesh(new S.TorusGeometry(.5,.1,4,24),e),[0,0,0],[Math.PI/2,0,0]]],Z:[[new S.Mesh(new S.TorusGeometry(.5,.1,4,24),e),[0,0,0],[0,0,-Math.PI/2]]],E:[[new S.Mesh(new S.TorusGeometry(.75,.1,2,24),e)]]},k={X:[[new S.Mesh(I,n),[.5,0,0],[0,0,-Math.PI/2]],[new S.Mesh(C,n),[0,0,0],[0,0,-Math.PI/2]],[new S.Mesh(I,n),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new S.Mesh(I,r),[0,.5,0]],[new S.Mesh(C,r)],[new S.Mesh(I,r),[0,-.5,0],[0,0,Math.PI]]],Z:[[new S.Mesh(I,o),[0,0,.5],[Math.PI/2,0,0]],[new S.Mesh(C,o),[0,0,0],[Math.PI/2,0,0]],[new S.Mesh(I,o),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new S.Mesh(new S.BoxGeometry(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new S.Mesh(new S.BoxGeometry(.15,.15,.01),a),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new S.Mesh(new S.BoxGeometry(.15,.15,.01),l),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new S.Mesh(new S.BoxGeometry(.1,.1,.1),d.clone())]]},F={X:[[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[.3,0,0],[0,0,-Math.PI/2]],[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[0,.3,0]],[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[0,-.3,0],[0,0,Math.PI]]],Z:[[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[0,0,.3],[Math.PI/2,0,0]],[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),e),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new S.Mesh(new S.BoxGeometry(.2,.2,.01),e),[.15,.15,0]]],YZ:[[new S.Mesh(new S.BoxGeometry(.2,.2,.01),e),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new S.Mesh(new S.BoxGeometry(.2,.2,.01),e),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new S.Mesh(new S.BoxGeometry(.2,.2,.2),e),[0,0,0]]]},L={X:[[new S.Line(m,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new S.Line(m,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new S.Line(m,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function T(D){const q=new S.Object3D;for(const G in D)for(let et=D[G].length;et--;){const W=D[G][et][0].clone(),nt=D[G][et][1],V=D[G][et][2],B=D[G][et][3],rt=D[G][et][4];W.name=G,W.tag=rt,nt&&W.position.set(nt[0],nt[1],nt[2]),V&&W.rotation.set(V[0],V[1],V[2]),B&&W.scale.set(B[0],B[1],B[2]),W.updateMatrix();const st=W.geometry.clone();st.applyMatrix4(W.matrix),W.geometry=st,W.renderOrder=1/0,W.position.set(0,0,0),W.rotation.set(0,0,0),W.scale.set(1,1,1),q.add(W)}return q}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=T(y)),this.add(this.gizmo.rotate=T(M)),this.add(this.gizmo.scale=T(k)),this.add(this.picker.translate=T(w)),this.add(this.picker.rotate=T(v)),this.add(this.picker.scale=T(F)),this.add(this.helper.translate=T(O)),this.add(this.helper.rotate=T(b)),this.add(this.helper.scale=T(L)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(s){const e=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:Ks;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let i=[];i=i.concat(this.picker[this.mode].children),i=i.concat(this.gizmo[this.mode].children),i=i.concat(this.helper[this.mode].children);for(let n=0;n<i.length;n++){const r=i[n];r.visible=!0,r.rotation.set(0,0,0),r.position.copy(this.worldPosition);let o;if(this.camera.isOrthographicCamera?o=(this.camera.top-this.camera.bottom)/this.camera.zoom:o=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),r.scale.set(1,1,1).multiplyScalar(o*this.size/4),r.tag==="helper"){r.visible=!1,r.name==="AXIS"?(r.visible=!!this.axis,this.axis==="X"&&(Rt.setFromEuler(Ws.set(0,0,0)),r.quaternion.copy(e).multiply(Rt),Math.abs(It.copy(us).applyQuaternion(e).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="Y"&&(Rt.setFromEuler(Ws.set(0,0,Math.PI/2)),r.quaternion.copy(e).multiply(Rt),Math.abs(It.copy(ye).applyQuaternion(e).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="Z"&&(Rt.setFromEuler(Ws.set(0,Math.PI/2,0)),r.quaternion.copy(e).multiply(Rt),Math.abs(It.copy(fs).applyQuaternion(e).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="XYZE"&&(Rt.setFromEuler(Ws.set(0,Math.PI/2,0)),It.copy(this.rotationAxis),r.quaternion.setFromRotationMatrix(lr.lookAt(cr,It,ye)),r.quaternion.multiply(Rt),r.visible=this.dragging),this.axis==="E"&&(r.visible=!1)):r.name==="START"?(r.position.copy(this.worldPositionStart),r.visible=this.dragging):r.name==="END"?(r.position.copy(this.worldPosition),r.visible=this.dragging):r.name==="DELTA"?(r.position.copy(this.worldPositionStart),r.quaternion.copy(this.worldQuaternionStart),Mt.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Mt.applyQuaternion(this.worldQuaternionStart.clone().invert()),r.scale.copy(Mt),r.visible=this.dragging):(r.quaternion.copy(e),this.dragging?r.position.copy(this.worldPositionStart):r.position.copy(this.worldPosition),this.axis&&(r.visible=this.axis.search(r.name)!==-1));continue}r.quaternion.copy(e),this.mode==="translate"||this.mode==="scale"?(r.name==="X"&&Math.abs(It.copy(us).applyQuaternion(e).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Y"&&Math.abs(It.copy(ye).applyQuaternion(e).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="Z"&&Math.abs(It.copy(fs).applyQuaternion(e).dot(this.eye))>.99&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XY"&&Math.abs(It.copy(fs).applyQuaternion(e).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="YZ"&&Math.abs(It.copy(us).applyQuaternion(e).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name==="XZ"&&Math.abs(It.copy(ye).applyQuaternion(e).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1)):this.mode==="rotate"&&(Xs.copy(e),It.copy(this.eye).applyQuaternion(Rt.copy(e).invert()),r.name.search("E")!==-1&&r.quaternion.setFromRotationMatrix(lr.lookAt(this.eye,cr,ye)),r.name==="X"&&(Rt.setFromAxisAngle(us,Math.atan2(-It.y,It.z)),Rt.multiplyQuaternions(Xs,Rt),r.quaternion.copy(Rt)),r.name==="Y"&&(Rt.setFromAxisAngle(ye,Math.atan2(It.x,It.z)),Rt.multiplyQuaternions(Xs,Rt),r.quaternion.copy(Rt)),r.name==="Z"&&(Rt.setFromAxisAngle(fs,Math.atan2(It.y,It.x)),Rt.multiplyQuaternions(Xs,Rt),r.quaternion.copy(Rt))),r.visible=r.visible&&(r.name.indexOf("X")===-1||this.showX),r.visible=r.visible&&(r.name.indexOf("Y")===-1||this.showY),r.visible=r.visible&&(r.name.indexOf("Z")===-1||this.showZ),r.visible=r.visible&&(r.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),r.material._color=r.material._color||r.material.color.clone(),r.material._opacity=r.material._opacity||r.material.opacity,r.material.color.copy(r.material._color),r.material.opacity=r.material._opacity,this.enabled&&this.axis&&(r.name===this.axis||this.axis.split("").some(function(a){return r.name===a}))&&(r.material.color.setHex(16776960),r.material.opacity=1)}super.updateMatrixWorld(s)}}class Ya extends S.Mesh{constructor(){super(new S.PlaneGeometry(1e5,1e5,2,2),new S.MeshBasicMaterial({visible:!1,wireframe:!0,side:S.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(s){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),Zs.copy(us).applyQuaternion(t==="local"?this.worldQuaternion:Ks),cs.copy(ye).applyQuaternion(t==="local"?this.worldQuaternion:Ks),ls.copy(fs).applyQuaternion(t==="local"?this.worldQuaternion:Ks),It.copy(cs),this.mode){case"translate":case"scale":switch(this.axis){case"X":It.copy(this.eye).cross(Zs),se.copy(Zs).cross(It);break;case"Y":It.copy(this.eye).cross(cs),se.copy(cs).cross(It);break;case"Z":It.copy(this.eye).cross(ls),se.copy(ls).cross(It);break;case"XY":se.copy(ls);break;case"YZ":se.copy(Zs);break;case"XZ":It.copy(ls),se.copy(cs);break;case"XYZ":case"E":se.set(0,0,0);break}break;case"rotate":default:se.set(0,0,0)}se.length()===0?this.quaternion.copy(this.cameraQuaternion):(hr.lookAt(Mt.set(0,0,0),se,It),this.quaternion.setFromRotationMatrix(hr)),super.updateMatrixWorld(s)}}class wi{constructor(s,t,e,i,n,r=5,o=!0){_(this,"onDraggingStarted",new Q);_(this,"onDraggingEnded",new Q);_(this,"onDisposed",new Q);_(this,"normal");_(this,"origin");_(this,"three",new x.Plane);_(this,"components");_(this,"world");_(this,"type","default");_(this,"_helper");_(this,"_visible",!0);_(this,"_enabled",!0);_(this,"_controlsActive",!1);_(this,"_arrowBoundBox",new x.Mesh);_(this,"_planeMesh");_(this,"_controls");_(this,"_hiddenMaterial",new x.MeshBasicMaterial({visible:!1}));_(this,"update",()=>{this._enabled&&this.three.setFromNormalAndCoplanarPoint(this.normal,this._helper.position)});_(this,"changeDrag",s=>{this._visible=!s.value,this.preventCameraMovement(),this.notifyDraggingChanged(s)});if(this.components=s,this.world=t,!t.renderer)throw new Error("The given world must have a renderer!");this.normal=i,this.origin=e,t.renderer.setPlane(!0,this.three),this._planeMesh=wi.newPlaneMesh(r,n),this._helper=this.newHelper(),this._controls=this.newTransformControls(),this.three.setFromNormalAndCoplanarPoint(i,e),o&&this.toggleControls(!0)}get enabled(){return this._enabled}set enabled(s){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");this._enabled=s,this.world.renderer.setPlane(s,this.three)}get visible(){return this._visible}set visible(s){this._visible=s,this._controls.visible=s,this._helper.visible=s,this.toggleControls(s)}get meshes(){return[this._planeMesh,this._arrowBoundBox]}get planeMaterial(){return this._planeMesh.material}set planeMaterial(s){this._planeMesh.material=s}get size(){return this._planeMesh.scale.x}set size(s){this._planeMesh.scale.set(s,s,s)}get helper(){return this._helper}setFromNormalAndCoplanarPoint(s,t){this.reset(),this.normal.equals(s)||(this.normal.copy(s),this._helper.lookAt(s)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix(),this.update()}dispose(){this._enabled=!1,this.onDraggingStarted.reset(),this.onDraggingEnded.reset(),this._helper.removeFromParent(),this.world.renderer&&this.world.renderer.setPlane(!1,this.three),this._arrowBoundBox.removeFromParent(),this._arrowBoundBox.geometry.dispose(),this._planeMesh.geometry.dispose(),this._controls.removeFromParent(),this._controls.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}reset(){const s=new x.Vector3(1,0,0),t=new x.Vector3;this.normal.equals(s)||(this.normal.copy(s),this._helper.lookAt(s)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix()}toggleControls(s){if(s){if(this._controlsActive)return;this._controls.addEventListener("change",this.update),this._controls.addEventListener("dragging-changed",this.changeDrag)}else this._controls.removeEventListener("change",this.update),this._controls.removeEventListener("dragging-changed",this.changeDrag);this._controlsActive=s}newTransformControls(){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");const s=this.world.camera.three,t=this.world.renderer.three.domElement,e=new Da(s,t);return this.initializeControls(e),this.world.scene.three.add(e),e}initializeControls(s){s.attach(this._helper),s.showX=!1,s.showY=!1,s.setSpace("local"),this.createArrowBoundingBox(),s.children[0].children[0].add(this._arrowBoundBox)}createArrowBoundingBox(){this._arrowBoundBox.geometry=new x.CylinderGeometry(.18,.18,1.2),this._arrowBoundBox.material=this._hiddenMaterial,this._arrowBoundBox.rotateX(Math.PI/2),this._arrowBoundBox.updateMatrix(),this._arrowBoundBox.geometry.applyMatrix4(this._arrowBoundBox.matrix)}notifyDraggingChanged(s){s.value?this.onDraggingStarted.trigger():this.onDraggingEnded.trigger()}preventCameraMovement(){this.world.camera.enabled=this._visible}newHelper(){const s=new x.Object3D;return s.lookAt(this.normal),s.position.copy(this.origin),this._planeMesh.position.z+=.01,s.add(this._planeMesh),this.world.scene.three.add(s),s}static newPlaneMesh(s,t){const e=new x.PlaneGeometry(1),i=new x.Mesh(e,t);return i.scale.set(s,s,s),i}}const gs=class gs extends Ft{constructor(t){super(t);_(this,"onBeforeDrag",new Q);_(this,"onAfterDrag",new Q);_(this,"onBeforeCreate",new Q);_(this,"onBeforeCancel",new Q);_(this,"onAfterCancel",new Q);_(this,"onBeforeDelete",new Q);_(this,"onAfterCreate",new Q);_(this,"onAfterDelete",new Q);_(this,"onDisposed",new Q);_(this,"orthogonalY",!1);_(this,"toleranceOrthogonalY",.7);_(this,"Type",wi);_(this,"list",[]);_(this,"_material",new x.MeshBasicMaterial({color:12255487,side:x.DoubleSide,transparent:!0,opacity:.2}));_(this,"_size",5);_(this,"_enabled",!1);_(this,"_visible",!0);_(this,"_onStartDragging",()=>{this.onBeforeDrag.trigger()});_(this,"_onEndDragging",()=>{this.onAfterDrag.trigger()});this.components.add(gs.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const e of this.list)e.enabled=t;this.updateMaterialsAndPlanes()}get visible(){return this._visible}set visible(t){this._visible=t;for(const e of this.list)e.visible=t}get material(){return this._material}set material(t){this._material=t;for(const e of this.list)e.planeMaterial=t}get size(){return this._size}set size(t){this._size=t;for(const e of this.list)e.size=t}dispose(){this._enabled=!1;for(const t of this.list)t.dispose();this.list.length=0,this._material.dispose(),this.onBeforeCreate.reset(),this.onBeforeCancel.reset(),this.onBeforeDelete.reset(),this.onBeforeDrag.reset(),this.onAfterCreate.reset(),this.onAfterCancel.reset(),this.onAfterDelete.reset(),this.onAfterDrag.reset(),this.onDisposed.trigger(gs.uuid),this.onDisposed.reset()}create(t){const n=this.components.get(Ne).get(t).castRay();return n?this.createPlaneFromIntersection(t,n):null}createFromNormalAndCoplanarPoint(t,e,i){const n=this.newPlane(t,i,e);return this.updateMaterialsAndPlanes(),n}delete(t,e){e||(e=this.pickPlane(t)),e&&this.deletePlane(e)}deleteAll(t){const e=[...this.list];for(const i of e)if(!t||t.has(i.type)){this.delete(i.world,i);const n=this.list.indexOf(i);n!==-1&&this.list.splice(n,1)}}deletePlane(t){const e=this.list.indexOf(t);if(e!==-1){if(this.list.splice(e,1),!t.world.renderer)throw new Error("Renderer not found for this plane's world!");t.world.renderer.setPlane(!1,t.three),t.dispose(),this.updateMaterialsAndPlanes(),this.onAfterDelete.trigger(t)}}pickPlane(t){const i=this.components.get(Ne).get(t),n=this.getAllPlaneMeshes(),r=i.castRay(n);if(r){const o=r.object;return this.list.find(a=>a.meshes.includes(o))}}getAllPlaneMeshes(){const t=[];for(const e of this.list)t.push(...e.meshes);return t}createPlaneFromIntersection(t,e){var a;if(!t.renderer)throw new Error("The given world must have a renderer!");const i=e.point.distanceTo(new x.Vector3(0,0,0)),n=(a=e.face)==null?void 0:a.normal;if(!i||!n)return null;const r=this.getWorldNormal(e,n),o=this.newPlane(t,e.point,r.negate());return o.visible=this._visible,o.size=this._size,t.renderer.setPlane(!0,o.three),this.updateMaterialsAndPlanes(),o}getWorldNormal(t,e){const i=t.object;let n=t.object.matrixWorld.clone();if(i instanceof x.InstancedMesh&&t.instanceId!==void 0){const l=new x.Matrix4;i.getMatrixAt(t.instanceId,l),n=l.multiply(n)}const o=new x.Matrix3().getNormalMatrix(n),a=e.clone().applyMatrix3(o).normalize();return this.normalizePlaneDirectionY(a),a}normalizePlaneDirectionY(t){this.orthogonalY&&(t.y>this.toleranceOrthogonalY&&(t.x=0,t.y=1,t.z=0),t.y<-this.toleranceOrthogonalY&&(t.x=0,t.y=-1,t.z=0))}newPlane(t,e,i){const n=new this.Type(this.components,t,e,i,this._material);return n.onDraggingStarted.add(this._onStartDragging),n.onDraggingEnded.add(this._onEndDragging),this.list.push(n),this.onAfterCreate.trigger(n),n}updateMaterialsAndPlanes(){const t=this.components.get(_s);for(const[e,i]of t.list){if(!i.renderer)continue;i.renderer.updateClippingPlanes();const{clippingPlanes:n}=i.renderer;for(const r of i.meshes)if(r.material)if(Array.isArray(r.material))for(const o of r.material)o.clippingPlanes=n;else r.material.clippingPlanes=n}}};_(gs,"uuid","66290bc5-18c4-4cd1-9379-2e17a0617611");let si=gs;class Dr{constructor(s){_(this,"enabled",!1);_(this,"id","FirstPerson");this.camera=s}set(s){if(this.enabled=s,s){if(this.camera.projection.current!=="Perspective"){this.camera.set("Orbit");return}this.setupFirstPersonCamera()}}setupFirstPersonCamera(){const s=this.camera.controls,t=new x.Vector3;s.distance--,s.getPosition(t),s.minDistance=1,s.maxDistance=1,s.distance=1,s.moveTo(t.x,t.y,t.z),s.truckSpeed=50,s.mouseButtons.wheel=xt.ACTION.DOLLY,s.touches.two=xt.ACTION.TOUCH_ZOOM_TRUCK}}class Ur{constructor(s){_(this,"enabled",!0);_(this,"id","Orbit");this.camera=s,this.activateOrbitControls()}set(s){this.enabled=s,s&&this.activateOrbitControls()}activateOrbitControls(){const s=this.camera.controls;s.minDistance=1,s.maxDistance=300;const t=new x.Vector3;s.getPosition(t);const e=t.length();s.distance=e,s.truckSpeed=2;const{rotation:i}=this.camera.three,n=new x.Vector3(0,0,-1).applyEuler(i),r=t.addScaledVector(n,e);s.moveTo(r.x,r.y,r.z)}}class Br{constructor(s){_(this,"enabled",!1);_(this,"id","Plan");_(this,"mouseAction1");_(this,"mouseAction2");_(this,"mouseInitialized",!1);_(this,"defaultAzimuthSpeed");_(this,"defaultPolarSpeed");this.camera=s,this.defaultAzimuthSpeed=s.controls.azimuthRotateSpeed,this.defaultPolarSpeed=s.controls.polarRotateSpeed}set(s){this.enabled=s;const t=this.camera.controls;t.azimuthRotateSpeed=s?0:this.defaultAzimuthSpeed,t.polarRotateSpeed=s?0:this.defaultPolarSpeed,this.mouseInitialized||(this.mouseAction1=t.touches.one,this.mouseAction2=t.touches.two,this.mouseInitialized=!0),s?(t.mouseButtons.left=xt.ACTION.TRUCK,t.touches.one=xt.ACTION.TOUCH_TRUCK,t.touches.two=xt.ACTION.TOUCH_ZOOM):(t.mouseButtons.left=xt.ACTION.ROTATE,t.touches.one=this.mouseAction1,t.touches.two=this.mouseAction2)}}class zr{constructor(s){_(this,"onChanged",new Q);_(this,"current","Perspective");_(this,"camera");_(this,"matchOrthoDistanceEnabled",!1);_(this,"_component");_(this,"_previousDistance",-1);this._component=s,this.camera=s.three}async set(s){this.current!==s&&(s==="Orthographic"?this.setOrthoCamera():await this.setPerspectiveCamera(),this.onChanged.trigger(this.camera))}async toggle(){const t=this.current==="Perspective"?"Orthographic":"Perspective";await this.set(t)}setOrthoCamera(){if(this._component.mode===null||this._component.mode.id==="FirstPerson")return;this._previousDistance=this._component.controls.distance,this._component.controls.distance=200;const s=this.getPerspectiveDims();if(!s)return;const{width:t,height:e}=s;this.setupOrthoCamera(e,t),this.camera=this._component.threeOrtho,this.current="Orthographic"}getPerspectiveDims(){const s=this._component.currentWorld;if(!s||!s.renderer)return null;const t=new x.Vector3;this._component.threePersp.getWorldDirection(t);const e=new x.Vector3;this._component.controls.getTarget(e);const n=e.clone().sub(this._component.threePersp.position).dot(t),r=s.renderer.getSize(),o=r.x/r.y,a=this._component.threePersp,l=n*2*Math.atan(a.fov*(Math.PI/180)/2);return{width:l*o,height:l}}setupOrthoCamera(s,t){this._component.controls.mouseButtons.wheel=xt.ACTION.ZOOM,this._component.controls.mouseButtons.middle=xt.ACTION.ZOOM;const e=this._component.threePersp,i=this._component.threeOrtho;i.zoom=1,i.left=t/-2,i.right=t/2,i.top=s/2,i.bottom=s/-2,i.updateProjectionMatrix(),i.position.copy(e.position),i.quaternion.copy(e.quaternion),this._component.controls.camera=i}getDistance(){const s=this._component.threePersp,t=this._component.threeOrtho;return(t.top-t.bottom)/t.zoom/(2*Math.atan(s.fov*(Math.PI/180)/2))}async setPerspectiveCamera(){this._component.controls.mouseButtons.wheel=xt.ACTION.DOLLY,this._component.controls.mouseButtons.middle=xt.ACTION.DOLLY;const s=this._component.threePersp,t=this._component.threeOrtho;s.position.copy(t.position),s.quaternion.copy(t.quaternion),this._component.controls.mouseButtons.wheel=xt.ACTION.DOLLY,this.matchOrthoDistanceEnabled?this._component.controls.distance=this.getDistance():this._component.controls.distance=this._previousDistance,await this._component.controls.zoomTo(1),s.updateProjectionMatrix(),this._component.controls.camera=s,this.camera=s,this.current="Perspective"}}class Vr extends We{constructor(t){super(t);_(this,"projection");_(this,"threeOrtho");_(this,"threePersp");_(this,"_userInputButtons",{});_(this,"_frustumSize",50);_(this,"_navigationModes",new Map);_(this,"_mode",null);_(this,"previousSize",null);this.threePersp=this.three,this.threeOrtho=this.newOrthoCamera(),this.projection=new zr(this),this.onAspectUpdated.add(()=>{this.setOrthoPerspCameraAspect()}),this.projection.onChanged.add(e=>{this.three=e,this.updateAspect()}),this.onWorldChanged.add(({action:e})=>{e==="added"&&(this._navigationModes.clear(),this._navigationModes.set("Orbit",new Ur(this)),this._navigationModes.set("FirstPerson",new Dr(this)),this._navigationModes.set("Plan",new Br(this)),this._mode=this._navigationModes.get("Orbit"),this.mode.set(!0,{preventTargetAdjustment:!0}),this.currentWorld&&this.currentWorld.renderer&&(this.previousSize=this.currentWorld.renderer.getSize().clone()))})}get mode(){if(!this._mode)throw new Error("Mode not found, camera not initialized");return this._mode}dispose(){super.dispose(),this.threeOrtho.removeFromParent()}set(t){if(this.mode!==null&&this.mode.id!==t){if(this.mode.set(!1),!this._navigationModes.has(t))throw new Error("The specified mode does not exist!");this._mode=this._navigationModes.get(t),this.mode.set(!0)}}async fit(t,e=1.5){if(!this.enabled)return;const i=Number.MAX_VALUE,n=Number.MIN_VALUE,r=new x.Vector3(i,i,i),o=new x.Vector3(n,n,n);for(const f of t){const E=new x.Box3().setFromObject(f);E.min.x<r.x&&(r.x=E.min.x),E.min.y<r.y&&(r.y=E.min.y),E.min.z<r.z&&(r.z=E.min.z),E.max.x>o.x&&(o.x=E.max.x),E.max.y>o.y&&(o.y=E.max.y),E.max.z>o.z&&(o.z=E.max.z)}const a=new x.Box3(r,o),l=new x.Vector3;a.getSize(l);const h=new x.Vector3;a.getCenter(h);const d=Math.max(l.x,l.y,l.z)*e,u=new x.Sphere(h,d);await this.controls.fitToSphere(u,!0)}setUserInput(t){t?this.enableUserInput():this.disableUserInput()}disableUserInput(){this._userInputButtons.left=this.controls.mouseButtons.left,this._userInputButtons.right=this.controls.mouseButtons.right,this._userInputButtons.middle=this.controls.mouseButtons.middle,this._userInputButtons.wheel=this.controls.mouseButtons.wheel,this.controls.mouseButtons.left=0,this.controls.mouseButtons.right=0,this.controls.mouseButtons.middle=0,this.controls.mouseButtons.wheel=0}enableUserInput(){Object.keys(this._userInputButtons).length!==0&&(this.controls.mouseButtons.left=this._userInputButtons.left,this.controls.mouseButtons.right=this._userInputButtons.right,this.controls.mouseButtons.middle=this._userInputButtons.middle,this.controls.mouseButtons.wheel=this._userInputButtons.wheel)}newOrthoCamera(){const t=window.innerWidth/window.innerHeight;return new x.OrthographicCamera(this._frustumSize*t/-2,this._frustumSize*t/2,this._frustumSize/2,this._frustumSize/-2,.1,1e3)}setOrthoPerspCameraAspect(){if(!this.currentWorld||!this.currentWorld.renderer||!this.previousSize)return;const t=this.currentWorld.renderer.getSize(),e=this.threeOrtho.top,i=this.threeOrtho.right,n=t.y/this.previousSize.y,r=t.x/this.previousSize.x,o=e*n,a=i*r;this.threeOrtho.left=-a,this.threeOrtho.right=a,this.threeOrtho.top=o,this.threeOrtho.bottom=-o,this.threeOrtho.updateProjectionMatrix(),this.previousSize.copy(t)}}const ln=new Map([[Z.IFCRELAGGREGATES,{forRelated:"Decomposes",forRelating:"IsDecomposedBy"}],[Z.IFCRELASSOCIATESMATERIAL,{forRelated:"HasAssociations",forRelating:"AssociatedTo"}],[Z.IFCRELASSOCIATESCLASSIFICATION,{forRelated:"HasAssociations",forRelating:"ClassificationForObjects"}],[Z.IFCRELASSIGNSTOGROUP,{forRelated:"HasAssignments",forRelating:"IsGroupedBy"}],[Z.IFCRELDEFINESBYPROPERTIES,{forRelated:"IsDefinedBy",forRelating:"DefinesOcurrence"}],[Z.IFCRELDEFINESBYTYPE,{forRelated:"IsTypedBy",forRelating:"Types"}],[Z.IFCRELDEFINESBYTEMPLATE,{forRelated:"IsDefinedBy",forRelating:"Defines"}],[Z.IFCRELCONTAINEDINSPATIALSTRUCTURE,{forRelated:"ContainedInStructure",forRelating:"ContainsElements"}],[Z.IFCRELFLOWCONTROLELEMENTS,{forRelated:"AssignedToFlowElement",forRelating:"HasControlElements"}],[Z.IFCRELCONNECTSELEMENTS,{forRelated:"ConnectedFrom",forRelating:"ConnectedTo"}],[Z.IFCRELASSIGNSTOPRODUCT,{forRelated:"HasAssignments",forRelating:"ReferencedBy"}],[Z.IFCRELDECLARES,{forRelated:"HasContext",forRelating:"Declares"}],[Z.IFCRELASSIGNSTOCONTROL,{forRelated:"HasAssignments",forRelating:"Controls"}],[Z.IFCRELNESTS,{forRelated:"Nests",forRelating:"IsNestedBy"}],[Z.IFCRELASSOCIATESDOCUMENT,{forRelated:"HasAssociations",forRelating:"DocumentRefForObjects"}]]),kr={103090709:"IFCPROJECT",4097777520:"IFCSITE",4031249490:"IFCBUILDING",3124254112:"IFCBUILDINGSTOREY",3856911033:"IFCSPACE",1674181508:"IFCANNOTATION",25142252:"IFCCONTROLLER",32344328:"IFCBOILER",76236018:"IFCLAMP",90941305:"IFCPUMP",177149247:"IFCAIRTERMINALBOX",182646315:"IFCFLOWINSTRUMENT",263784265:"IFCFURNISHINGELEMENT",264262732:"IFCELECTRICGENERATOR",277319702:"IFCAUDIOVISUALAPPLIANCE",310824031:"IFCPIPEFITTING",331165859:"IFCSTAIR",342316401:"IFCDUCTFITTING",377706215:"IFCMECHANICALFASTENER",395920057:"IFCDOOR",402227799:"IFCELECTRICMOTOR",413509423:"IFCSYSTEMFURNITUREELEMENT",484807127:"IFCEVAPORATOR",486154966:"IFCWINDOWSTANDARDCASE",629592764:"IFCLIGHTFIXTURE",630975310:"IFCUNITARYCONTROLELEMENT",635142910:"IFCCABLECARRIERFITTING",639361253:"IFCCOIL",647756555:"IFCFASTENER",707683696:"IFCFLOWSTORAGEDEVICE",738039164:"IFCPROTECTIVEDEVICE",753842376:"IFCBEAM",812556717:"IFCTANK",819412036:"IFCFILTER",843113511:"IFCCOLUMN",862014818:"IFCELECTRICDISTRIBUTIONBOARD",900683007:"IFCFOOTING",905975707:"IFCCOLUMNSTANDARDCASE",926996030:"IFCVOIDINGFEATURE",979691226:"IFCREINFORCINGBAR",987401354:"IFCFLOWSEGMENT",1003880860:"IFCELECTRICTIMECONTROL",1051757585:"IFCCABLEFITTING",1052013943:"IFCDISTRIBUTIONCHAMBERELEMENT",1062813311:"IFCDISTRIBUTIONCONTROLELEMENT",1073191201:"IFCMEMBER",1095909175:"IFCBUILDINGELEMENTPROXY",1156407060:"IFCPLATESTANDARDCASE",1162798199:"IFCSWITCHINGDEVICE",1329646415:"IFCSHADINGDEVICE",1335981549:"IFCDISCRETEACCESSORY",1360408905:"IFCDUCTSILENCER",1404847402:"IFCSTACKTERMINAL",1426591983:"IFCFIRESUPPRESSIONTERMINAL",1437502449:"IFCMEDICALDEVICE",1509553395:"IFCFURNITURE",1529196076:"IFCSLAB",1620046519:"IFCTRANSPORTELEMENT",1634111441:"IFCAIRTERMINAL",1658829314:"IFCENERGYCONVERSIONDEVICE",1677625105:"IFCCIVILELEMENT",1687234759:"IFCPILE",1904799276:"IFCELECTRICAPPLIANCE",1911478936:"IFCMEMBERSTANDARDCASE",1945004755:"IFCDISTRIBUTIONELEMENT",1973544240:"IFCCOVERING",1999602285:"IFCSPACEHEATER",2016517767:"IFCROOF",2056796094:"IFCAIRTOAIRHEATRECOVERY",2058353004:"IFCFLOWCONTROLLER",2068733104:"IFCHUMIDIFIER",2176052936:"IFCJUNCTIONBOX",2188021234:"IFCFLOWMETER",2223149337:"IFCFLOWTERMINAL",2262370178:"IFCRAILING",2272882330:"IFCCONDENSER",2295281155:"IFCPROTECTIVEDEVICETRIPPINGUNIT",2320036040:"IFCREINFORCINGMESH",2347447852:"IFCTENDONANCHOR",2391383451:"IFCVIBRATIONISOLATOR",2391406946:"IFCWALL",2474470126:"IFCMOTORCONNECTION",2769231204:"IFCVIRTUALELEMENT",2814081492:"IFCENGINE",2906023776:"IFCBEAMSTANDARDCASE",2938176219:"IFCBURNER",2979338954:"IFCBUILDINGELEMENTPART",3024970846:"IFCRAMP",3026737570:"IFCTUBEBUNDLE",3027962421:"IFCSLABSTANDARDCASE",3040386961:"IFCDISTRIBUTIONFLOWELEMENT",3053780830:"IFCSANITARYTERMINAL",3079942009:"IFCOPENINGSTANDARDCASE",3087945054:"IFCALARM",3101698114:"IFCSURFACEFEATURE",3127900445:"IFCSLABELEMENTEDCASE",3132237377:"IFCFLOWMOVINGDEVICE",3171933400:"IFCPLATE",3221913625:"IFCCOMMUNICATIONSAPPLIANCE",3242481149:"IFCDOORSTANDARDCASE",3283111854:"IFCRAMPFLIGHT",3296154744:"IFCCHIMNEY",3304561284:"IFCWINDOW",3310460725:"IFCELECTRICFLOWSTORAGEDEVICE",3319311131:"IFCHEATEXCHANGER",3415622556:"IFCFAN",3420628829:"IFCSOLARDEVICE",3493046030:"IFCGEOGRAPHICELEMENT",3495092785:"IFCCURTAINWALL",3508470533:"IFCFLOWTREATMENTDEVICE",3512223829:"IFCWALLSTANDARDCASE",3518393246:"IFCDUCTSEGMENT",3571504051:"IFCCOMPRESSOR",3588315303:"IFCOPENINGELEMENT",3612865200:"IFCPIPESEGMENT",3640358203:"IFCCOOLINGTOWER",3651124850:"IFCPROJECTIONELEMENT",3694346114:"IFCOUTLET",3747195512:"IFCEVAPORATIVECOOLER",3758799889:"IFCCABLECARRIERSEGMENT",3824725483:"IFCTENDON",3825984169:"IFCTRANSFORMER",3902619387:"IFCCHILLER",4074379575:"IFCDAMPER",4086658281:"IFCSENSOR",4123344466:"IFCELEMENTASSEMBLY",4136498852:"IFCCOOLEDBEAM",4156078855:"IFCWALLELEMENTEDCASE",4175244083:"IFCINTERCEPTOR",4207607924:"IFCVALVE",4217484030:"IFCCABLESEGMENT",4237592921:"IFCWASTETERMINAL",4252922144:"IFCSTAIRFLIGHT",4278956645:"IFCFLOWFITTING",4288193352:"IFCACTUATOR",4292641817:"IFCUNITARYEQUIPMENT",3009204131:"IFCGRID"};class Ha{getAll(s,t){const e={},i=Object.keys(kr).map(n=>parseInt(n,10));for(let n=0;n<i.length;n++){const r=i[n],o=s.GetLineIDsWithType(t,r),a=o.size();for(let l=0;l<a;l++)e[o.get(l)]=r}return e}}const _n={950732822:"IFCURIREFERENCE",4075327185:"IFCTIME",1209108979:"IFCTEMPERATURERATEOFCHANGEMEASURE",3457685358:"IFCSOUNDPRESSURELEVELMEASURE",4157543285:"IFCSOUNDPOWERLEVELMEASURE",2798247006:"IFCPROPERTYSETDEFINITIONSET",1790229001:"IFCPOSITIVEINTEGER",525895558:"IFCNONNEGATIVELENGTHMEASURE",1774176899:"IFCLINEINDEX",1275358634:"IFCLANGUAGEID",2541165894:"IFCDURATION",3701338814:"IFCDAYINWEEKNUMBER",2195413836:"IFCDATETIME",937566702:"IFCDATE",1683019596:"IFCCARDINALPOINTREFERENCE",2314439260:"IFCBINARY",1500781891:"IFCAREADENSITYMEASURE",3683503648:"IFCARCINDEX",4065007721:"IFCYEARNUMBER",1718600412:"IFCWARPINGMOMENTMEASURE",51269191:"IFCWARPINGCONSTANTMEASURE",2593997549:"IFCVOLUMETRICFLOWRATEMEASURE",3458127941:"IFCVOLUMEMEASURE",3345633955:"IFCVAPORPERMEABILITYMEASURE",1278329552:"IFCTORQUEMEASURE",2591213694:"IFCTIMESTAMP",2726807636:"IFCTIMEMEASURE",743184107:"IFCTHERMODYNAMICTEMPERATUREMEASURE",2016195849:"IFCTHERMALTRANSMITTANCEMEASURE",857959152:"IFCTHERMALRESISTANCEMEASURE",2281867870:"IFCTHERMALEXPANSIONCOEFFICIENTMEASURE",2645777649:"IFCTHERMALCONDUCTIVITYMEASURE",232962298:"IFCTHERMALADMITTANCEMEASURE",296282323:"IFCTEXTTRANSFORMATION",603696268:"IFCTEXTFONTNAME",3490877962:"IFCTEXTDECORATION",1460886941:"IFCTEXTALIGNMENT",2801250643:"IFCTEXT",58845555:"IFCTEMPERATUREGRADIENTMEASURE",361837227:"IFCSPECULARROUGHNESS",2757832317:"IFCSPECULAREXPONENT",3477203348:"IFCSPECIFICHEATCAPACITYMEASURE",993287707:"IFCSOUNDPRESSUREMEASURE",846465480:"IFCSOUNDPOWERMEASURE",3471399674:"IFCSOLIDANGLEMEASURE",408310005:"IFCSHEARMODULUSMEASURE",2190458107:"IFCSECTIONALAREAINTEGRALMEASURE",3467162246:"IFCSECTIONMODULUSMEASURE",2766185779:"IFCSECONDINMINUTE",3211557302:"IFCROTATIONALSTIFFNESSMEASURE",1755127002:"IFCROTATIONALMASSMEASURE",2133746277:"IFCROTATIONALFREQUENCYMEASURE",200335297:"IFCREAL",96294661:"IFCRATIOMEASURE",3972513137:"IFCRADIOACTIVITYMEASURE",3665567075:"IFCPRESSUREMEASURE",2169031380:"IFCPRESENTABLETEXT",1364037233:"IFCPOWERMEASURE",1245737093:"IFCPOSITIVERATIOMEASURE",3054510233:"IFCPOSITIVEPLANEANGLEMEASURE",2815919920:"IFCPOSITIVELENGTHMEASURE",4042175685:"IFCPLANEANGLEMEASURE",2642773653:"IFCPLANARFORCEMEASURE",2260317790:"IFCPARAMETERVALUE",929793134:"IFCPHMEASURE",2395907400:"IFCNUMERICMEASURE",2095195183:"IFCNORMALISEDRATIOMEASURE",765770214:"IFCMONTHINYEARNUMBER",2615040989:"IFCMONETARYMEASURE",3114022597:"IFCMOMENTOFINERTIAMEASURE",1648970520:"IFCMOLECULARWEIGHTMEASURE",3177669450:"IFCMOISTUREDIFFUSIVITYMEASURE",1753493141:"IFCMODULUSOFSUBGRADEREACTIONMEASURE",1052454078:"IFCMODULUSOFROTATIONALSUBGRADEREACTIONMEASURE",2173214787:"IFCMODULUSOFLINEARSUBGRADEREACTIONMEASURE",3341486342:"IFCMODULUSOFELASTICITYMEASURE",102610177:"IFCMINUTEINHOUR",3531705166:"IFCMASSPERLENGTHMEASURE",3124614049:"IFCMASSMEASURE",4017473158:"IFCMASSFLOWRATEMEASURE",1477762836:"IFCMASSDENSITYMEASURE",2486716878:"IFCMAGNETICFLUXMEASURE",286949696:"IFCMAGNETICFLUXDENSITYMEASURE",151039812:"IFCLUMINOUSINTENSITYMEASURE",2755797622:"IFCLUMINOUSINTENSITYDISTRIBUTIONMEASURE",2095003142:"IFCLUMINOUSFLUXMEASURE",503418787:"IFCLOGICAL",3086160713:"IFCLINEARVELOCITYMEASURE",1307019551:"IFCLINEARSTIFFNESSMEASURE",2128979029:"IFCLINEARMOMENTMEASURE",191860431:"IFCLINEARFORCEMEASURE",1243674935:"IFCLENGTHMEASURE",3258342251:"IFCLABEL",2054016361:"IFCKINEMATICVISCOSITYMEASURE",3192672207:"IFCISOTHERMALMOISTURECAPACITYMEASURE",3686016028:"IFCIONCONCENTRATIONMEASURE",3809634241:"IFCINTEGERCOUNTRATEMEASURE",1939436016:"IFCINTEGER",2679005408:"IFCINDUCTANCEMEASURE",3358199106:"IFCILLUMINANCEMEASURE",983778844:"IFCIDENTIFIER",2589826445:"IFCHOURINDAY",1158859006:"IFCHEATINGVALUEMEASURE",3113092358:"IFCHEATFLUXDENSITYMEASURE",3064340077:"IFCGLOBALLYUNIQUEID",3044325142:"IFCFREQUENCYMEASURE",1361398929:"IFCFORCEMEASURE",2590844177:"IFCFONTWEIGHT",2715512545:"IFCFONTVARIANT",1102727119:"IFCFONTSTYLE",2078135608:"IFCENERGYMEASURE",2506197118:"IFCELECTRICVOLTAGEMEASURE",2951915441:"IFCELECTRICRESISTANCEMEASURE",3790457270:"IFCELECTRICCURRENTMEASURE",2093906313:"IFCELECTRICCONDUCTANCEMEASURE",3818826038:"IFCELECTRICCHARGEMEASURE",1827137117:"IFCELECTRICCAPACITANCEMEASURE",69416015:"IFCDYNAMICVISCOSITYMEASURE",524656162:"IFCDOSEEQUIVALENTMEASURE",4134073009:"IFCDIMENSIONCOUNT",1514641115:"IFCDESCRIPTIVEMEASURE",300323983:"IFCDAYLIGHTSAVINGHOUR",86635668:"IFCDAYINMONTHNUMBER",94842927:"IFCCURVATUREMEASURE",1778710042:"IFCCOUNTMEASURE",3238673880:"IFCCONTEXTDEPENDENTMEASURE",3812528620:"IFCCOMPOUNDPLANEANGLEMEASURE",2991860651:"IFCCOMPLEXNUMBER",1867003952:"IFCBOXALIGNMENT",2735952531:"IFCBOOLEAN",2650437152:"IFCAREAMEASURE",632304761:"IFCANGULARVELOCITYMEASURE",360377573:"IFCAMOUNTOFSUBSTANCEMEASURE",4182062534:"IFCACCELERATIONMEASURE",3699917729:"IFCABSORBEDDOSEMEASURE",1971632696:"IFCGEOSLICE",2680139844:"IFCGEOMODEL",24726584:"IFCELECTRICFLOWTREATMENTDEVICE",3693000487:"IFCDISTRIBUTIONBOARD",3460952963:"IFCCONVEYORSEGMENT",3999819293:"IFCCAISSONFOUNDATION",3314249567:"IFCBOREHOLE",4196446775:"IFCBEARING",325726236:"IFCALIGNMENT",3425753595:"IFCTRACKELEMENT",991950508:"IFCSIGNAL",3798194928:"IFCREINFORCEDSOIL",3290496277:"IFCRAIL",1383356374:"IFCPAVEMENT",2182337498:"IFCNAVIGATIONELEMENT",234836483:"IFCMOORINGDEVICE",2078563270:"IFCMOBILETELECOMMUNICATIONSAPPLIANCE",1638804497:"IFCLIQUIDTERMINAL",1154579445:"IFCLINEARPOSITIONINGELEMENT",2696325953:"IFCKERB",2713699986:"IFCGEOTECHNICALASSEMBLY",2142170206:"IFCELECTRICFLOWTREATMENTDEVICETYPE",3376911765:"IFCEARTHWORKSFILL",1077100507:"IFCEARTHWORKSELEMENT",3071239417:"IFCEARTHWORKSCUT",479945903:"IFCDISTRIBUTIONBOARDTYPE",3426335179:"IFCDEEPFOUNDATION",1502416096:"IFCCOURSE",2940368186:"IFCCONVEYORSEGMENTTYPE",3203706013:"IFCCAISSONFOUNDATIONTYPE",3862327254:"IFCBUILTSYSTEM",1876633798:"IFCBUILTELEMENT",963979645:"IFCBRIDGEPART",644574406:"IFCBRIDGE",3649138523:"IFCBEARINGTYPE",1662888072:"IFCALIGNMENTVERTICAL",317615605:"IFCALIGNMENTSEGMENT",1545765605:"IFCALIGNMENTHORIZONTAL",4266260250:"IFCALIGNMENTCANT",3956297820:"IFCVIBRATIONDAMPERTYPE",1530820697:"IFCVIBRATIONDAMPER",840318589:"IFCVEHICLE",1953115116:"IFCTRANSPORTATIONDEVICE",618700268:"IFCTRACKELEMENTTYPE",2281632017:"IFCTENDONCONDUITTYPE",3663046924:"IFCTENDONCONDUIT",42703149:"IFCSINESPIRAL",1894708472:"IFCSIGNALTYPE",3599934289:"IFCSIGNTYPE",33720170:"IFCSIGN",1027922057:"IFCSEVENTHORDERPOLYNOMIALSPIRAL",544395925:"IFCSEGMENTEDREFERENCECURVE",3649235739:"IFCSECONDORDERPOLYNOMIALSPIRAL",550521510:"IFCROADPART",146592293:"IFCROAD",3818125796:"IFCRELADHERESTOELEMENT",4021432810:"IFCREFERENT",1891881377:"IFCRAILWAYPART",3992365140:"IFCRAILWAY",1763565496:"IFCRAILTYPE",1946335990:"IFCPOSITIONINGELEMENT",514975943:"IFCPAVEMENTTYPE",506776471:"IFCNAVIGATIONELEMENTTYPE",710110818:"IFCMOORINGDEVICETYPE",1950438474:"IFCMOBILETELECOMMUNICATIONSAPPLIANCETYPE",976884017:"IFCMARINEPART",525669439:"IFCMARINEFACILITY",1770583370:"IFCLIQUIDTERMINALTYPE",2176059722:"IFCLINEARELEMENT",679976338:"IFCKERBTYPE",3948183225:"IFCIMPACTPROTECTIONDEVICETYPE",2568555532:"IFCIMPACTPROTECTIONDEVICE",2898700619:"IFCGRADIENTCURVE",1594536857:"IFCGEOTECHNICALSTRATUM",4230923436:"IFCGEOTECHNICALELEMENT",4228831410:"IFCFACILITYPARTCOMMON",1310830890:"IFCFACILITYPART",24185140:"IFCFACILITY",4234616927:"IFCDIRECTRIXDERIVEDREFERENCESWEPTAREASOLID",1306400036:"IFCDEEPFOUNDATIONTYPE",4189326743:"IFCCOURSETYPE",2000195564:"IFCCOSINESPIRAL",3497074424:"IFCCLOTHOID",1626504194:"IFCBUILTELEMENTTYPE",3651464721:"IFCVEHICLETYPE",1229763772:"IFCTRIANGULATEDIRREGULARNETWORK",3665877780:"IFCTRANSPORTATIONDEVICETYPE",782932809:"IFCTHIRDORDERPOLYNOMIALSPIRAL",2735484536:"IFCSPIRAL",1356537516:"IFCSECTIONEDSURFACE",1290935644:"IFCSECTIONEDSOLIDHORIZONTAL",1862484736:"IFCSECTIONEDSOLID",1441486842:"IFCRELPOSITIONS",1033248425:"IFCRELASSOCIATESPROFILEDEF",3381221214:"IFCPOLYNOMIALCURVE",2485787929:"IFCOFFSETCURVEBYDISTANCES",590820931:"IFCOFFSETCURVE",3465909080:"IFCINDEXEDPOLYGONALTEXTUREMAP",593015953:"IFCDIRECTRIXCURVESWEPTAREASOLID",4212018352:"IFCCURVESEGMENT",3425423356:"IFCAXIS2PLACEMENTLINEAR",823603102:"IFCSEGMENT",2165702409:"IFCPOINTBYDISTANCEEXPRESSION",182550632:"IFCOPENCROSSPROFILEDEF",388784114:"IFCLINEARPLACEMENT",536804194:"IFCALIGNMENTHORIZONTALSEGMENT",3752311538:"IFCALIGNMENTCANTSEGMENT",1010789467:"IFCTEXTURECOORDINATEINDICESWITHVOIDS",222769930:"IFCTEXTURECOORDINATEINDICES",2691318326:"IFCQUANTITYNUMBER",3633395639:"IFCALIGNMENTVERTICALSEGMENT",2879124712:"IFCALIGNMENTPARAMETERSEGMENT",25142252:"IFCCONTROLLER",3087945054:"IFCALARM",4288193352:"IFCACTUATOR",630975310:"IFCUNITARYCONTROLELEMENT",4086658281:"IFCSENSOR",2295281155:"IFCPROTECTIVEDEVICETRIPPINGUNIT",182646315:"IFCFLOWINSTRUMENT",1426591983:"IFCFIRESUPPRESSIONTERMINAL",819412036:"IFCFILTER",3415622556:"IFCFAN",1003880860:"IFCELECTRICTIMECONTROL",402227799:"IFCELECTRICMOTOR",264262732:"IFCELECTRICGENERATOR",3310460725:"IFCELECTRICFLOWSTORAGEDEVICE",862014818:"IFCELECTRICDISTRIBUTIONBOARD",1904799276:"IFCELECTRICAPPLIANCE",1360408905:"IFCDUCTSILENCER",3518393246:"IFCDUCTSEGMENT",342316401:"IFCDUCTFITTING",562808652:"IFCDISTRIBUTIONCIRCUIT",4074379575:"IFCDAMPER",3640358203:"IFCCOOLINGTOWER",4136498852:"IFCCOOLEDBEAM",2272882330:"IFCCONDENSER",3571504051:"IFCCOMPRESSOR",3221913625:"IFCCOMMUNICATIONSAPPLIANCE",639361253:"IFCCOIL",3902619387:"IFCCHILLER",4217484030:"IFCCABLESEGMENT",1051757585:"IFCCABLEFITTING",3758799889:"IFCCABLECARRIERSEGMENT",635142910:"IFCCABLECARRIERFITTING",2938176219:"IFCBURNER",32344328:"IFCBOILER",2906023776:"IFCBEAMSTANDARDCASE",277319702:"IFCAUDIOVISUALAPPLIANCE",2056796094:"IFCAIRTOAIRHEATRECOVERY",177149247:"IFCAIRTERMINALBOX",1634111441:"IFCAIRTERMINAL",486154966:"IFCWINDOWSTANDARDCASE",4237592921:"IFCWASTETERMINAL",4156078855:"IFCWALLELEMENTEDCASE",4207607924:"IFCVALVE",4292641817:"IFCUNITARYEQUIPMENT",3179687236:"IFCUNITARYCONTROLELEMENTTYPE",3026737570:"IFCTUBEBUNDLE",3825984169:"IFCTRANSFORMER",812556717:"IFCTANK",1162798199:"IFCSWITCHINGDEVICE",385403989:"IFCSTRUCTURALLOADCASE",1404847402:"IFCSTACKTERMINAL",1999602285:"IFCSPACEHEATER",3420628829:"IFCSOLARDEVICE",3027962421:"IFCSLABSTANDARDCASE",3127900445:"IFCSLABELEMENTEDCASE",1329646415:"IFCSHADINGDEVICE",3053780830:"IFCSANITARYTERMINAL",2572171363:"IFCREINFORCINGBARTYPE",1232101972:"IFCRATIONALBSPLINECURVEWITHKNOTS",90941305:"IFCPUMP",655969474:"IFCPROTECTIVEDEVICETRIPPINGUNITTYPE",738039164:"IFCPROTECTIVEDEVICE",1156407060:"IFCPLATESTANDARDCASE",3612865200:"IFCPIPESEGMENT",310824031:"IFCPIPEFITTING",3694346114:"IFCOUTLET",144952367:"IFCOUTERBOUNDARYCURVE",2474470126:"IFCMOTORCONNECTION",1911478936:"IFCMEMBERSTANDARDCASE",1437502449:"IFCMEDICALDEVICE",629592764:"IFCLIGHTFIXTURE",76236018:"IFCLAMP",2176052936:"IFCJUNCTIONBOX",4175244083:"IFCINTERCEPTOR",2068733104:"IFCHUMIDIFIER",3319311131:"IFCHEATEXCHANGER",2188021234:"IFCFLOWMETER",1209101575:"IFCEXTERNALSPATIALELEMENT",484807127:"IFCEVAPORATOR",3747195512:"IFCEVAPORATIVECOOLER",2814081492:"IFCENGINE",2417008758:"IFCELECTRICDISTRIBUTIONBOARDTYPE",3242481149:"IFCDOORSTANDARDCASE",3205830791:"IFCDISTRIBUTIONSYSTEM",400855858:"IFCCOMMUNICATIONSAPPLIANCETYPE",905975707:"IFCCOLUMNSTANDARDCASE",1677625105:"IFCCIVILELEMENT",3296154744:"IFCCHIMNEY",2674252688:"IFCCABLEFITTINGTYPE",2188180465:"IFCBURNERTYPE",1177604601:"IFCBUILDINGSYSTEM",39481116:"IFCBUILDINGELEMENTPARTTYPE",1136057603:"IFCBOUNDARYCURVE",2461110595:"IFCBSPLINECURVEWITHKNOTS",1532957894:"IFCAUDIOVISUALAPPLIANCETYPE",4088093105:"IFCWORKCALENDAR",4009809668:"IFCWINDOWTYPE",926996030:"IFCVOIDINGFEATURE",2391383451:"IFCVIBRATIONISOLATOR",2415094496:"IFCTENDONTYPE",3081323446:"IFCTENDONANCHORTYPE",413509423:"IFCSYSTEMFURNITUREELEMENT",3101698114:"IFCSURFACEFEATURE",3657597509:"IFCSTRUCTURALSURFACEACTION",2757150158:"IFCSTRUCTURALCURVEREACTION",1004757350:"IFCSTRUCTURALCURVEACTION",338393293:"IFCSTAIRTYPE",1072016465:"IFCSOLARDEVICETYPE",4074543187:"IFCSHADINGDEVICETYPE",2157484638:"IFCSEAMCURVE",2781568857:"IFCROOFTYPE",2310774935:"IFCREINFORCINGMESHTYPE",964333572:"IFCREINFORCINGELEMENTTYPE",683857671:"IFCRATIONALBSPLINESURFACEWITHKNOTS",1469900589:"IFCRAMPTYPE",2839578677:"IFCPOLYGONALFACESET",1158309216:"IFCPILETYPE",3079942009:"IFCOPENINGSTANDARDCASE",1114901282:"IFCMEDICALDEVICETYPE",3113134337:"IFCINTERSECTIONCURVE",3946677679:"IFCINTERCEPTORTYPE",2571569899:"IFCINDEXEDPOLYCURVE",3493046030:"IFCGEOGRAPHICELEMENT",1509553395:"IFCFURNITURE",1893162501:"IFCFOOTINGTYPE",2853485674:"IFCEXTERNALSPATIALSTRUCTUREELEMENT",4148101412:"IFCEVENT",132023988:"IFCENGINETYPE",2397081782:"IFCELEMENTASSEMBLYTYPE",2323601079:"IFCDOORTYPE",1213902940:"IFCCYLINDRICALSURFACE",1525564444:"IFCCONSTRUCTIONPRODUCTRESOURCETYPE",4105962743:"IFCCONSTRUCTIONMATERIALRESOURCETYPE",2185764099:"IFCCONSTRUCTIONEQUIPMENTRESOURCETYPE",15328376:"IFCCOMPOSITECURVEONSURFACE",3875453745:"IFCCOMPLEXPROPERTYTEMPLATE",3893394355:"IFCCIVILELEMENTTYPE",2197970202:"IFCCHIMNEYTYPE",167062518:"IFCBSPLINESURFACEWITHKNOTS",2887950389:"IFCBSPLINESURFACE",2603310189:"IFCADVANCEDBREPWITHVOIDS",1635779807:"IFCADVANCEDBREP",2916149573:"IFCTRIANGULATEDFACESET",1935646853:"IFCTOROIDALSURFACE",2387106220:"IFCTESSELLATEDFACESET",3206491090:"IFCTASKTYPE",699246055:"IFCSURFACECURVE",4095615324:"IFCSUBCONTRACTRESOURCETYPE",603775116:"IFCSTRUCTURALSURFACEREACTION",4015995234:"IFCSPHERICALSURFACE",2481509218:"IFCSPATIALZONETYPE",463610769:"IFCSPATIALZONE",710998568:"IFCSPATIALELEMENTTYPE",1412071761:"IFCSPATIALELEMENT",3663146110:"IFCSIMPLEPROPERTYTEMPLATE",3243963512:"IFCREVOLVEDAREASOLIDTAPERED",816062949:"IFCREPARAMETRISEDCOMPOSITECURVESEGMENT",1521410863:"IFCRELSPACEBOUNDARY2NDLEVEL",3523091289:"IFCRELSPACEBOUNDARY1STLEVEL",427948657:"IFCRELINTERFERESELEMENTS",307848117:"IFCRELDEFINESBYTEMPLATE",1462361463:"IFCRELDEFINESBYOBJECT",2565941209:"IFCRELDECLARES",1027710054:"IFCRELASSIGNSTOGROUPBYFACTOR",3521284610:"IFCPROPERTYTEMPLATE",492091185:"IFCPROPERTYSETTEMPLATE",653396225:"IFCPROJECTLIBRARY",569719735:"IFCPROCEDURETYPE",3967405729:"IFCPREDEFINEDPROPERTYSET",1682466193:"IFCPCURVE",428585644:"IFCLABORRESOURCETYPE",2294589976:"IFCINDEXEDPOLYGONALFACEWITHVOIDS",178912537:"IFCINDEXEDPOLYGONALFACE",4095422895:"IFCGEOGRAPHICELEMENTTYPE",2652556860:"IFCFIXEDREFERENCESWEPTAREASOLID",2804161546:"IFCEXTRUDEDAREASOLIDTAPERED",4024345920:"IFCEVENTTYPE",2629017746:"IFCCURVEBOUNDEDSURFACE",1815067380:"IFCCREWRESOURCETYPE",3419103109:"IFCCONTEXT",2574617495:"IFCCONSTRUCTIONRESOURCETYPE",2059837836:"IFCCARTESIANPOINTLIST3D",1675464909:"IFCCARTESIANPOINTLIST2D",574549367:"IFCCARTESIANPOINTLIST",3406155212:"IFCADVANCEDFACE",3698973494:"IFCTYPERESOURCE",3736923433:"IFCTYPEPROCESS",901063453:"IFCTESSELLATEDITEM",1096409881:"IFCSWEPTDISKSOLIDPOLYGONAL",1042787934:"IFCRESOURCETIME",1608871552:"IFCRESOURCECONSTRAINTRELATIONSHIP",2943643501:"IFCRESOURCEAPPROVALRELATIONSHIP",2090586900:"IFCQUANTITYSET",1482703590:"IFCPROPERTYTEMPLATEDEFINITION",3778827333:"IFCPREDEFINEDPROPERTIES",2998442950:"IFCMIRROREDPROFILEDEF",853536259:"IFCMATERIALRELATIONSHIP",3404854881:"IFCMATERIALPROFILESETUSAGETAPERING",3079605661:"IFCMATERIALPROFILESETUSAGE",2852063980:"IFCMATERIALCONSTITUENTSET",3708119e3:"IFCMATERIALCONSTITUENT",1585845231:"IFCLAGTIME",2133299955:"IFCINDEXEDTRIANGLETEXTUREMAP",1437953363:"IFCINDEXEDTEXTUREMAP",3570813810:"IFCINDEXEDCOLOURMAP",1437805879:"IFCEXTERNALREFERENCERELATIONSHIP",297599258:"IFCEXTENDEDPROPERTIES",211053100:"IFCEVENTTIME",2713554722:"IFCCONVERSIONBASEDUNITWITHOFFSET",3285139300:"IFCCOLOURRGBLIST",1236880293:"IFCWORKTIME",1199560280:"IFCTIMEPERIOD",3611470254:"IFCTEXTUREVERTEXLIST",2771591690:"IFCTASKTIMERECURRING",1549132990:"IFCTASKTIME",2043862942:"IFCTABLECOLUMN",2934153892:"IFCSURFACEREINFORCEMENTAREA",609421318:"IFCSTRUCTURALLOADORRESULT",3478079324:"IFCSTRUCTURALLOADCONFIGURATION",1054537805:"IFCSCHEDULINGTIME",2439245199:"IFCRESOURCELEVELRELATIONSHIP",2433181523:"IFCREFERENCE",3915482550:"IFCRECURRENCEPATTERN",986844984:"IFCPROPERTYABSTRACTION",3843373140:"IFCPROJECTEDCRS",677532197:"IFCPRESENTATIONITEM",1507914824:"IFCMATERIALUSAGEDEFINITION",552965576:"IFCMATERIALPROFILEWITHOFFSETS",164193824:"IFCMATERIALPROFILESET",2235152071:"IFCMATERIALPROFILE",1847252529:"IFCMATERIALLAYERWITHOFFSETS",760658860:"IFCMATERIALDEFINITION",3057273783:"IFCMAPCONVERSION",4294318154:"IFCEXTERNALINFORMATION",1466758467:"IFCCOORDINATEREFERENCESYSTEM",1785450214:"IFCCOORDINATEOPERATION",775493141:"IFCCONNECTIONVOLUMEGEOMETRY",979691226:"IFCREINFORCINGBAR",3700593921:"IFCELECTRICDISTRIBUTIONPOINT",1062813311:"IFCDISTRIBUTIONCONTROLELEMENT",1052013943:"IFCDISTRIBUTIONCHAMBERELEMENT",578613899:"IFCCONTROLLERTYPE",2454782716:"IFCCHAMFEREDGEFEATURE",753842376:"IFCBEAM",3001207471:"IFCALARMTYPE",2874132201:"IFCACTUATORTYPE",3304561284:"IFCWINDOW",3512223829:"IFCWALLSTANDARDCASE",2391406946:"IFCWALL",3313531582:"IFCVIBRATIONISOLATORTYPE",2347447852:"IFCTENDONANCHOR",3824725483:"IFCTENDON",2515109513:"IFCSTRUCTURALANALYSISMODEL",4252922144:"IFCSTAIRFLIGHT",331165859:"IFCSTAIR",1529196076:"IFCSLAB",1783015770:"IFCSENSORTYPE",1376911519:"IFCROUNDEDEDGEFEATURE",2016517767:"IFCROOF",2320036040:"IFCREINFORCINGMESH",3027567501:"IFCREINFORCINGELEMENT",3055160366:"IFCRATIONALBEZIERCURVE",3283111854:"IFCRAMPFLIGHT",3024970846:"IFCRAMP",2262370178:"IFCRAILING",3171933400:"IFCPLATE",1687234759:"IFCPILE",1073191201:"IFCMEMBER",900683007:"IFCFOOTING",3508470533:"IFCFLOWTREATMENTDEVICE",2223149337:"IFCFLOWTERMINAL",707683696:"IFCFLOWSTORAGEDEVICE",987401354:"IFCFLOWSEGMENT",3132237377:"IFCFLOWMOVINGDEVICE",4037862832:"IFCFLOWINSTRUMENTTYPE",4278956645:"IFCFLOWFITTING",2058353004:"IFCFLOWCONTROLLER",4222183408:"IFCFIRESUPPRESSIONTERMINALTYPE",1810631287:"IFCFILTERTYPE",346874300:"IFCFANTYPE",1658829314:"IFCENERGYCONVERSIONDEVICE",857184966:"IFCELECTRICALELEMENT",1634875225:"IFCELECTRICALCIRCUIT",712377611:"IFCELECTRICTIMECONTROLTYPE",1217240411:"IFCELECTRICMOTORTYPE",1365060375:"IFCELECTRICHEATERTYPE",1534661035:"IFCELECTRICGENERATORTYPE",3277789161:"IFCELECTRICFLOWSTORAGEDEVICETYPE",663422040:"IFCELECTRICAPPLIANCETYPE",855621170:"IFCEDGEFEATURE",2030761528:"IFCDUCTSILENCERTYPE",3760055223:"IFCDUCTSEGMENTTYPE",869906466:"IFCDUCTFITTINGTYPE",395920057:"IFCDOOR",3041715199:"IFCDISTRIBUTIONPORT",3040386961:"IFCDISTRIBUTIONFLOWELEMENT",1945004755:"IFCDISTRIBUTIONELEMENT",2063403501:"IFCDISTRIBUTIONCONTROLELEMENTTYPE",1599208980:"IFCDISTRIBUTIONCHAMBERELEMENTTYPE",2635815018:"IFCDISCRETEACCESSORYTYPE",1335981549:"IFCDISCRETEACCESSORY",4147604152:"IFCDIAMETERDIMENSION",3961806047:"IFCDAMPERTYPE",3495092785:"IFCCURTAINWALL",1973544240:"IFCCOVERING",2954562838:"IFCCOOLINGTOWERTYPE",335055490:"IFCCOOLEDBEAMTYPE",488727124:"IFCCONSTRUCTIONPRODUCTRESOURCE",1060000209:"IFCCONSTRUCTIONMATERIALRESOURCE",3898045240:"IFCCONSTRUCTIONEQUIPMENTRESOURCE",1163958913:"IFCCONDITIONCRITERION",2188551683:"IFCCONDITION",2816379211:"IFCCONDENSERTYPE",3850581409:"IFCCOMPRESSORTYPE",843113511:"IFCCOLUMN",2301859152:"IFCCOILTYPE",2611217952:"IFCCIRCLE",2951183804:"IFCCHILLERTYPE",1285652485:"IFCCABLESEGMENTTYPE",3293546465:"IFCCABLECARRIERSEGMENTTYPE",395041908:"IFCCABLECARRIERFITTINGTYPE",1909888760:"IFCBUILDINGELEMENTPROXYTYPE",1095909175:"IFCBUILDINGELEMENTPROXY",2979338954:"IFCBUILDINGELEMENTPART",52481810:"IFCBUILDINGELEMENTCOMPONENT",3299480353:"IFCBUILDINGELEMENT",231477066:"IFCBOILERTYPE",1916977116:"IFCBEZIERCURVE",819618141:"IFCBEAMTYPE",1967976161:"IFCBSPLINECURVE",3460190687:"IFCASSET",2470393545:"IFCANGULARDIMENSION",1871374353:"IFCAIRTOAIRHEATRECOVERYTYPE",3352864051:"IFCAIRTERMINALTYPE",1411407467:"IFCAIRTERMINALBOXTYPE",3821786052:"IFCACTIONREQUEST",1213861670:"IFC2DCOMPOSITECURVE",1033361043:"IFCZONE",3342526732:"IFCWORKSCHEDULE",4218914973:"IFCWORKPLAN",1028945134:"IFCWORKCONTROL",1133259667:"IFCWASTETERMINALTYPE",1898987631:"IFCWALLTYPE",2769231204:"IFCVIRTUALELEMENT",728799441:"IFCVALVETYPE",1911125066:"IFCUNITARYEQUIPMENTTYPE",1600972822:"IFCTUBEBUNDLETYPE",3593883385:"IFCTRIMMEDCURVE",1620046519:"IFCTRANSPORTELEMENT",1692211062:"IFCTRANSFORMERTYPE",1637806684:"IFCTIMESERIESSCHEDULE",5716631:"IFCTANKTYPE",2254336722:"IFCSYSTEM",2315554128:"IFCSWITCHINGDEVICETYPE",148013059:"IFCSUBCONTRACTRESOURCE",1975003073:"IFCSTRUCTURALSURFACECONNECTION",2986769608:"IFCSTRUCTURALRESULTGROUP",1235345126:"IFCSTRUCTURALPOINTREACTION",734778138:"IFCSTRUCTURALPOINTCONNECTION",2082059205:"IFCSTRUCTURALPOINTACTION",3987759626:"IFCSTRUCTURALPLANARACTIONVARYING",1621171031:"IFCSTRUCTURALPLANARACTION",1252848954:"IFCSTRUCTURALLOADGROUP",1721250024:"IFCSTRUCTURALLINEARACTIONVARYING",1807405624:"IFCSTRUCTURALLINEARACTION",2445595289:"IFCSTRUCTURALCURVEMEMBERVARYING",214636428:"IFCSTRUCTURALCURVEMEMBER",4243806635:"IFCSTRUCTURALCURVECONNECTION",1179482911:"IFCSTRUCTURALCONNECTION",682877961:"IFCSTRUCTURALACTION",1039846685:"IFCSTAIRFLIGHTTYPE",3112655638:"IFCSTACKTERMINALTYPE",3812236995:"IFCSPACETYPE",652456506:"IFCSPACEPROGRAM",1305183839:"IFCSPACEHEATERTYPE",3856911033:"IFCSPACE",2533589738:"IFCSLABTYPE",4097777520:"IFCSITE",4105383287:"IFCSERVICELIFE",3517283431:"IFCSCHEDULETIMECONTROL",1768891740:"IFCSANITARYTERMINALTYPE",2863920197:"IFCRELASSIGNSTASKS",160246688:"IFCRELAGGREGATES",2324767716:"IFCRAMPFLIGHTTYPE",2893384427:"IFCRAILINGTYPE",3248260540:"IFCRADIUSDIMENSION",2250791053:"IFCPUMPTYPE",1842657554:"IFCPROTECTIVEDEVICETYPE",3651124850:"IFCPROJECTIONELEMENT",3642467123:"IFCPROJECTORDERRECORD",2904328755:"IFCPROJECTORDER",2744685151:"IFCPROCEDURE",3740093272:"IFCPORT",3724593414:"IFCPOLYLINE",4017108033:"IFCPLATETYPE",4231323485:"IFCPIPESEGMENTTYPE",804291784:"IFCPIPEFITTINGTYPE",3327091369:"IFCPERMIT",2382730787:"IFCPERFORMANCEHISTORY",2837617999:"IFCOUTLETTYPE",3425660407:"IFCORDERACTION",3588315303:"IFCOPENINGELEMENT",4143007308:"IFCOCCUPANT",1916936684:"IFCMOVE",977012517:"IFCMOTORCONNECTIONTYPE",3181161470:"IFCMEMBERTYPE",2108223431:"IFCMECHANICALFASTENERTYPE",377706215:"IFCMECHANICALFASTENER",2506943328:"IFCLINEARDIMENSION",1161773419:"IFCLIGHTFIXTURETYPE",1051575348:"IFCLAMPTYPE",3827777499:"IFCLABORRESOURCE",4288270099:"IFCJUNCTIONBOXTYPE",2391368822:"IFCINVENTORY",1806887404:"IFCHUMIDIFIERTYPE",1251058090:"IFCHEATEXCHANGERTYPE",2706460486:"IFCGROUP",3009204131:"IFCGRID",200128114:"IFCGASTERMINALTYPE",814719939:"IFCFURNITURESTANDARD",263784265:"IFCFURNISHINGELEMENT",3009222698:"IFCFLOWTREATMENTDEVICETYPE",2297155007:"IFCFLOWTERMINALTYPE",1339347760:"IFCFLOWSTORAGEDEVICETYPE",1834744321:"IFCFLOWSEGMENTTYPE",1482959167:"IFCFLOWMOVINGDEVICETYPE",3815607619:"IFCFLOWMETERTYPE",3198132628:"IFCFLOWFITTINGTYPE",3907093117:"IFCFLOWCONTROLLERTYPE",1287392070:"IFCFEATUREELEMENTSUBTRACTION",2143335405:"IFCFEATUREELEMENTADDITION",2827207264:"IFCFEATUREELEMENT",2489546625:"IFCFASTENERTYPE",647756555:"IFCFASTENER",3737207727:"IFCFACETEDBREPWITHVOIDS",807026263:"IFCFACETEDBREP",3390157468:"IFCEVAPORATORTYPE",3174744832:"IFCEVAPORATIVECOOLERTYPE",3272907226:"IFCEQUIPMENTSTANDARD",1962604670:"IFCEQUIPMENTELEMENT",2107101300:"IFCENERGYCONVERSIONDEVICETYPE",1704287377:"IFCELLIPSE",2590856083:"IFCELEMENTCOMPONENTTYPE",1623761950:"IFCELEMENTCOMPONENT",4123344466:"IFCELEMENTASSEMBLY",1758889154:"IFCELEMENT",360485395:"IFCELECTRICALBASEPROPERTIES",3849074793:"IFCDISTRIBUTIONFLOWELEMENTTYPE",3256556792:"IFCDISTRIBUTIONELEMENTTYPE",681481545:"IFCDIMENSIONCURVEDIRECTEDCALLOUT",1457835157:"IFCCURTAINWALLTYPE",3295246426:"IFCCREWRESOURCE",1916426348:"IFCCOVERINGTYPE",1419761937:"IFCCOSTSCHEDULE",3895139033:"IFCCOSTITEM",3293443760:"IFCCONTROL",2559216714:"IFCCONSTRUCTIONRESOURCE",2510884976:"IFCCONIC",3732776249:"IFCCOMPOSITECURVE",300633059:"IFCCOLUMNTYPE",2937912522:"IFCCIRCLEHOLLOWPROFILEDEF",3124254112:"IFCBUILDINGSTOREY",1950629157:"IFCBUILDINGELEMENTTYPE",4031249490:"IFCBUILDING",1260505505:"IFCBOUNDEDCURVE",3649129432:"IFCBOOLEANCLIPPINGRESULT",1334484129:"IFCBLOCK",3207858831:"IFCASYMMETRICISHAPEPROFILEDEF",1674181508:"IFCANNOTATION",2296667514:"IFCACTOR",2097647324:"IFCTRANSPORTELEMENTTYPE",3473067441:"IFCTASK",1580310250:"IFCSYSTEMFURNITUREELEMENTTYPE",4124788165:"IFCSURFACEOFREVOLUTION",2809605785:"IFCSURFACEOFLINEAREXTRUSION",2028607225:"IFCSURFACECURVESWEPTAREASOLID",4070609034:"IFCSTRUCTUREDDIMENSIONCALLOUT",2218152070:"IFCSTRUCTURALSURFACEMEMBERVARYING",3979015343:"IFCSTRUCTURALSURFACEMEMBER",3689010777:"IFCSTRUCTURALREACTION",530289379:"IFCSTRUCTURALMEMBER",3136571912:"IFCSTRUCTURALITEM",3544373492:"IFCSTRUCTURALACTIVITY",451544542:"IFCSPHERE",3893378262:"IFCSPATIALSTRUCTUREELEMENTTYPE",2706606064:"IFCSPATIALSTRUCTUREELEMENT",3626867408:"IFCRIGHTCIRCULARCYLINDER",4158566097:"IFCRIGHTCIRCULARCONE",1856042241:"IFCREVOLVEDAREASOLID",2914609552:"IFCRESOURCE",1401173127:"IFCRELVOIDSELEMENT",3451746338:"IFCRELSPACEBOUNDARY",366585022:"IFCRELSERVICESBUILDINGS",4122056220:"IFCRELSEQUENCE",1058617721:"IFCRELSCHEDULESCOSTITEMS",1245217292:"IFCRELREFERENCEDINSPATIALSTRUCTURE",750771296:"IFCRELPROJECTSELEMENT",202636808:"IFCRELOVERRIDESPROPERTIES",2051452291:"IFCRELOCCUPIESSPACES",3268803585:"IFCRELNESTS",4189434867:"IFCRELINTERACTIONREQUIREMENTS",279856033:"IFCRELFLOWCONTROLELEMENTS",3940055652:"IFCRELFILLSELEMENT",781010003:"IFCRELDEFINESBYTYPE",4186316022:"IFCRELDEFINESBYPROPERTIES",693640335:"IFCRELDEFINES",2551354335:"IFCRELDECOMPOSES",2802773753:"IFCRELCOVERSSPACES",886880790:"IFCRELCOVERSBLDGELEMENTS",3242617779:"IFCRELCONTAINEDINSPATIALSTRUCTURE",3678494232:"IFCRELCONNECTSWITHREALIZINGELEMENTS",504942748:"IFCRELCONNECTSWITHECCENTRICITY",1638771189:"IFCRELCONNECTSSTRUCTURALMEMBER",3912681535:"IFCRELCONNECTSSTRUCTURALELEMENT",2127690289:"IFCRELCONNECTSSTRUCTURALACTIVITY",3190031847:"IFCRELCONNECTSPORTS",4201705270:"IFCRELCONNECTSPORTTOELEMENT",3945020480:"IFCRELCONNECTSPATHELEMENTS",1204542856:"IFCRELCONNECTSELEMENTS",826625072:"IFCRELCONNECTS",2851387026:"IFCRELASSOCIATESPROFILEPROPERTIES",2655215786:"IFCRELASSOCIATESMATERIAL",3840914261:"IFCRELASSOCIATESLIBRARY",982818633:"IFCRELASSOCIATESDOCUMENT",2728634034:"IFCRELASSOCIATESCONSTRAINT",919958153:"IFCRELASSOCIATESCLASSIFICATION",4095574036:"IFCRELASSOCIATESAPPROVAL",1327628568:"IFCRELASSOCIATESAPPLIEDVALUE",1865459582:"IFCRELASSOCIATES",205026976:"IFCRELASSIGNSTORESOURCE",3372526763:"IFCRELASSIGNSTOPROJECTORDER",2857406711:"IFCRELASSIGNSTOPRODUCT",4278684876:"IFCRELASSIGNSTOPROCESS",1307041759:"IFCRELASSIGNSTOGROUP",2495723537:"IFCRELASSIGNSTOCONTROL",1683148259:"IFCRELASSIGNSTOACTOR",3939117080:"IFCRELASSIGNS",3454111270:"IFCRECTANGULARTRIMMEDSURFACE",2798486643:"IFCRECTANGULARPYRAMID",2770003689:"IFCRECTANGLEHOLLOWPROFILEDEF",3219374653:"IFCPROXY",1451395588:"IFCPROPERTYSET",4194566429:"IFCPROJECTIONCURVE",103090709:"IFCPROJECT",4208778838:"IFCPRODUCT",2945172077:"IFCPROCESS",220341763:"IFCPLANE",603570806:"IFCPLANARBOX",3566463478:"IFCPERMEABLECOVERINGPROPERTIES",3505215534:"IFCOFFSETCURVE3D",3388369263:"IFCOFFSETCURVE2D",3888040117:"IFCOBJECT",1425443689:"IFCMANIFOLDSOLIDBREP",1281925730:"IFCLINE",572779678:"IFCLSHAPEPROFILEDEF",1484403080:"IFCISHAPEPROFILEDEF",987898635:"IFCGEOMETRICCURVESET",1268542332:"IFCFURNITURETYPE",4238390223:"IFCFURNISHINGELEMENTTYPE",3455213021:"IFCFLUIDFLOWPROPERTIES",315944413:"IFCFILLAREASTYLETILES",4203026998:"IFCFILLAREASTYLETILESYMBOLWITHSTYLE",374418227:"IFCFILLAREASTYLEHATCHING",2047409740:"IFCFACEBASEDSURFACEMODEL",477187591:"IFCEXTRUDEDAREASOLID",80994333:"IFCENERGYPROPERTIES",2835456948:"IFCELLIPSEPROFILEDEF",2777663545:"IFCELEMENTARYSURFACE",339256511:"IFCELEMENTTYPE",1883228015:"IFCELEMENTQUANTITY",1472233963:"IFCEDGELOOP",4006246654:"IFCDRAUGHTINGPREDEFINEDCURVEFONT",445594917:"IFCDRAUGHTINGPREDEFINEDCOLOUR",3073041342:"IFCDRAUGHTINGCALLOUT",526551008:"IFCDOORSTYLE",1714330368:"IFCDOORPANELPROPERTIES",2963535650:"IFCDOORLININGPROPERTIES",32440307:"IFCDIRECTION",4054601972:"IFCDIMENSIONCURVETERMINATOR",606661476:"IFCDIMENSIONCURVE",693772133:"IFCDEFINEDSYMBOL",2827736869:"IFCCURVEBOUNDEDPLANE",2601014836:"IFCCURVE",2147822146:"IFCCSGSOLID",2506170314:"IFCCSGPRIMITIVE3D",194851669:"IFCCRANERAILFSHAPEPROFILEDEF",4133800736:"IFCCRANERAILASHAPEPROFILEDEF",2485617015:"IFCCOMPOSITECURVESEGMENT",2205249479:"IFCCLOSEDSHELL",1383045692:"IFCCIRCLEPROFILEDEF",1416205885:"IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM",3331915920:"IFCCARTESIANTRANSFORMATIONOPERATOR3D",3486308946:"IFCCARTESIANTRANSFORMATIONOPERATOR2DNONUNIFORM",3749851601:"IFCCARTESIANTRANSFORMATIONOPERATOR2D",59481748:"IFCCARTESIANTRANSFORMATIONOPERATOR",1123145078:"IFCCARTESIANPOINT",2898889636:"IFCCSHAPEPROFILEDEF",2713105998:"IFCBOXEDHALFSPACE",2581212453:"IFCBOUNDINGBOX",4182860854:"IFCBOUNDEDSURFACE",2736907675:"IFCBOOLEANRESULT",2740243338:"IFCAXIS2PLACEMENT3D",3125803723:"IFCAXIS2PLACEMENT2D",4261334040:"IFCAXIS1PLACEMENT",1302238472:"IFCANNOTATIONSURFACE",2265737646:"IFCANNOTATIONFILLAREAOCCURRENCE",669184980:"IFCANNOTATIONFILLAREA",3288037868:"IFCANNOTATIONCURVEOCCURRENCE",2543172580:"IFCZSHAPEPROFILEDEF",1299126871:"IFCWINDOWSTYLE",512836454:"IFCWINDOWPANELPROPERTIES",336235671:"IFCWINDOWLININGPROPERTIES",2759199220:"IFCVERTEXLOOP",1417489154:"IFCVECTOR",427810014:"IFCUSHAPEPROFILEDEF",2347495698:"IFCTYPEPRODUCT",1628702193:"IFCTYPEOBJECT",1345879162:"IFCTWODIRECTIONREPEATFACTOR",2715220739:"IFCTRAPEZIUMPROFILEDEF",3124975700:"IFCTEXTLITERALWITHEXTENT",4282788508:"IFCTEXTLITERAL",3028897424:"IFCTERMINATORSYMBOL",3071757647:"IFCTSHAPEPROFILEDEF",230924584:"IFCSWEPTSURFACE",1260650574:"IFCSWEPTDISKSOLID",2247615214:"IFCSWEPTAREASOLID",1878645084:"IFCSURFACESTYLERENDERING",2513912981:"IFCSURFACE",2233826070:"IFCSUBEDGE",3653947884:"IFCSTRUCTURALSTEELPROFILEPROPERTIES",3843319758:"IFCSTRUCTURALPROFILEPROPERTIES",1190533807:"IFCSTRUCTURALLOADSINGLEFORCEWARPING",1597423693:"IFCSTRUCTURALLOADSINGLEFORCE",1973038258:"IFCSTRUCTURALLOADSINGLEDISPLACEMENTDISTORTION",2473145415:"IFCSTRUCTURALLOADSINGLEDISPLACEMENT",2668620305:"IFCSTRUCTURALLOADPLANARFORCE",1595516126:"IFCSTRUCTURALLOADLINEARFORCE",390701378:"IFCSPACETHERMALLOADPROPERTIES",1202362311:"IFCSOUNDVALUE",2485662743:"IFCSOUNDPROPERTIES",723233188:"IFCSOLIDMODEL",2609359061:"IFCSLIPPAGECONNECTIONCONDITION",4124623270:"IFCSHELLBASEDSURFACEMODEL",2411513650:"IFCSERVICELIFEFACTOR",1509187699:"IFCSECTIONEDSPINE",2778083089:"IFCROUNDEDRECTANGLEPROFILEDEF",478536968:"IFCRELATIONSHIP",3765753017:"IFCREINFORCEMENTDEFINITIONPROPERTIES",3413951693:"IFCREGULARTIMESERIES",3615266464:"IFCRECTANGLEPROFILEDEF",110355661:"IFCPROPERTYTABLEVALUE",3650150729:"IFCPROPERTYSINGLEVALUE",3357820518:"IFCPROPERTYSETDEFINITION",941946838:"IFCPROPERTYREFERENCEVALUE",2752243245:"IFCPROPERTYLISTVALUE",4166981789:"IFCPROPERTYENUMERATEDVALUE",1680319473:"IFCPROPERTYDEFINITION",871118103:"IFCPROPERTYBOUNDEDVALUE",673634403:"IFCPRODUCTDEFINITIONSHAPE",179317114:"IFCPREDEFINEDPOINTMARKERSYMBOL",433424934:"IFCPREDEFINEDDIMENSIONSYMBOL",2559016684:"IFCPREDEFINEDCURVEFONT",759155922:"IFCPREDEFINEDCOLOUR",2775532180:"IFCPOLYGONALBOUNDEDHALFSPACE",2924175390:"IFCPOLYLOOP",1423911732:"IFCPOINTONSURFACE",4022376103:"IFCPOINTONCURVE",2067069095:"IFCPOINT",1663979128:"IFCPLANAREXTENT",2004835150:"IFCPLACEMENT",597895409:"IFCPIXELTEXTURE",3021840470:"IFCPHYSICALCOMPLEXQUANTITY",2519244187:"IFCPATH",2529465313:"IFCPARAMETERIZEDPROFILEDEF",1029017970:"IFCORIENTEDEDGE",2665983363:"IFCOPENSHELL",2833995503:"IFCONEDIRECTIONREPEATFACTOR",219451334:"IFCOBJECTDEFINITION",1430189142:"IFCMECHANICALCONCRETEMATERIALPROPERTIES",2022407955:"IFCMATERIALDEFINITIONREPRESENTATION",2347385850:"IFCMAPPEDITEM",1008929658:"IFCLOOP",2624227202:"IFCLOCALPLACEMENT",3422422726:"IFCLIGHTSOURCESPOT",1520743889:"IFCLIGHTSOURCEPOSITIONAL",4266656042:"IFCLIGHTSOURCEGONIOMETRIC",2604431987:"IFCLIGHTSOURCEDIRECTIONAL",125510826:"IFCLIGHTSOURCEAMBIENT",1402838566:"IFCLIGHTSOURCE",3741457305:"IFCIRREGULARTIMESERIES",3905492369:"IFCIMAGETEXTURE",2445078500:"IFCHYGROSCOPICMATERIALPROPERTIES",812098782:"IFCHALFSPACESOLID",178086475:"IFCGRIDPLACEMENT",3590301190:"IFCGEOMETRICSET",4142052618:"IFCGEOMETRICREPRESENTATIONSUBCONTEXT",2453401579:"IFCGEOMETRICREPRESENTATIONITEM",3448662350:"IFCGEOMETRICREPRESENTATIONCONTEXT",1446786286:"IFCGENERALPROFILEPROPERTIES",803998398:"IFCGENERALMATERIALPROPERTIES",3857492461:"IFCFUELPROPERTIES",738692330:"IFCFILLAREASTYLE",4219587988:"IFCFAILURECONNECTIONCONDITION",3008276851:"IFCFACESURFACE",803316827:"IFCFACEOUTERBOUND",1809719519:"IFCFACEBOUND",2556980723:"IFCFACE",1860660968:"IFCEXTENDEDMATERIALPROPERTIES",476780140:"IFCEDGECURVE",3900360178:"IFCEDGE",4170525392:"IFCDRAUGHTINGPREDEFINEDTEXTFONT",3732053477:"IFCDOCUMENTREFERENCE",1694125774:"IFCDIMENSIONPAIR",2273265877:"IFCDIMENSIONCALLOUTRELATIONSHIP",3632507154:"IFCDERIVEDPROFILEDEF",3800577675:"IFCCURVESTYLE",2889183280:"IFCCONVERSIONBASEDUNIT",3050246964:"IFCCONTEXTDEPENDENTUNIT",45288368:"IFCCONNECTIONPOINTECCENTRICITY",1981873012:"IFCCONNECTIONCURVEGEOMETRY",370225590:"IFCCONNECTEDFACESET",1485152156:"IFCCOMPOSITEPROFILEDEF",2542286263:"IFCCOMPLEXPROPERTY",776857604:"IFCCOLOURRGB",647927063:"IFCCLASSIFICATIONREFERENCE",3150382593:"IFCCENTERLINEPROFILEDEF",616511568:"IFCBLOBTEXTURE",2705031697:"IFCARBITRARYPROFILEDEFWITHVOIDS",1310608509:"IFCARBITRARYOPENPROFILEDEF",3798115385:"IFCARBITRARYCLOSEDPROFILEDEF",2297822566:"IFCANNOTATIONTEXTOCCURRENCE",3612888222:"IFCANNOTATIONSYMBOLOCCURRENCE",962685235:"IFCANNOTATIONSURFACEOCCURRENCE",2442683028:"IFCANNOTATIONOCCURRENCE",1065908215:"IFCWATERPROPERTIES",891718957:"IFCVIRTUALGRIDINTERSECTION",1907098498:"IFCVERTEXPOINT",3304826586:"IFCVERTEXBASEDTEXTUREMAP",2799835756:"IFCVERTEX",180925521:"IFCUNITASSIGNMENT",1735638870:"IFCTOPOLOGYREPRESENTATION",1377556343:"IFCTOPOLOGICALREPRESENTATIONITEM",581633288:"IFCTIMESERIESVALUE",1718945513:"IFCTIMESERIESREFERENCERELATIONSHIP",3101149627:"IFCTIMESERIES",3317419933:"IFCTHERMALMATERIALPROPERTIES",1210645708:"IFCTEXTUREVERTEX",2552916305:"IFCTEXTUREMAP",1742049831:"IFCTEXTURECOORDINATEGENERATOR",280115917:"IFCTEXTURECOORDINATE",1484833681:"IFCTEXTSTYLEWITHBOXCHARACTERISTICS",1640371178:"IFCTEXTSTYLETEXTMODEL",2636378356:"IFCTEXTSTYLEFORDEFINEDFONT",1983826977:"IFCTEXTSTYLEFONTMODEL",1447204868:"IFCTEXTSTYLE",912023232:"IFCTELECOMADDRESS",531007025:"IFCTABLEROW",985171141:"IFCTABLE",1290481447:"IFCSYMBOLSTYLE",626085974:"IFCSURFACETEXTURE",1351298697:"IFCSURFACESTYLEWITHTEXTURES",846575682:"IFCSURFACESTYLESHADING",1607154358:"IFCSURFACESTYLEREFRACTION",3303107099:"IFCSURFACESTYLELIGHTING",1300840506:"IFCSURFACESTYLE",3049322572:"IFCSTYLEDREPRESENTATION",3958052878:"IFCSTYLEDITEM",2830218821:"IFCSTYLEMODEL",3408363356:"IFCSTRUCTURALLOADTEMPERATURE",2525727697:"IFCSTRUCTURALLOADSTATIC",2162789131:"IFCSTRUCTURALLOAD",2273995522:"IFCSTRUCTURALCONNECTIONCONDITION",3692461612:"IFCSIMPLEPROPERTY",4240577450:"IFCSHAPEREPRESENTATION",3982875396:"IFCSHAPEMODEL",867548509:"IFCSHAPEASPECT",4165799628:"IFCSECTIONREINFORCEMENTPROPERTIES",2042790032:"IFCSECTIONPROPERTIES",448429030:"IFCSIUNIT",2341007311:"IFCROOT",3679540991:"IFCRIBPLATEPROFILEPROPERTIES",1660063152:"IFCREPRESENTATIONMAP",3008791417:"IFCREPRESENTATIONITEM",3377609919:"IFCREPRESENTATIONCONTEXT",1076942058:"IFCREPRESENTATION",1222501353:"IFCRELAXATION",1580146022:"IFCREINFORCEMENTBARPROPERTIES",2692823254:"IFCREFERENCESVALUEDOCUMENT",825690147:"IFCQUANTITYWEIGHT",2405470396:"IFCQUANTITYVOLUME",3252649465:"IFCQUANTITYTIME",931644368:"IFCQUANTITYLENGTH",2093928680:"IFCQUANTITYCOUNT",2044713172:"IFCQUANTITYAREA",3710013099:"IFCPROPERTYENUMERATION",148025276:"IFCPROPERTYDEPENDENCYRELATIONSHIP",3896028662:"IFCPROPERTYCONSTRAINTRELATIONSHIP",2598011224:"IFCPROPERTY",2802850158:"IFCPROFILEPROPERTIES",3958567839:"IFCPROFILEDEF",2267347899:"IFCPRODUCTSOFCOMBUSTIONPROPERTIES",2095639259:"IFCPRODUCTREPRESENTATION",2417041796:"IFCPRESENTATIONSTYLEASSIGNMENT",3119450353:"IFCPRESENTATIONSTYLE",1304840413:"IFCPRESENTATIONLAYERWITHSTYLE",2022622350:"IFCPRESENTATIONLAYERASSIGNMENT",1775413392:"IFCPREDEFINEDTEXTFONT",3213052703:"IFCPREDEFINEDTERMINATORSYMBOL",990879717:"IFCPREDEFINEDSYMBOL",3727388367:"IFCPREDEFINEDITEM",3355820592:"IFCPOSTALADDRESS",2226359599:"IFCPHYSICALSIMPLEQUANTITY",2483315170:"IFCPHYSICALQUANTITY",101040310:"IFCPERSONANDORGANIZATION",2077209135:"IFCPERSON",1207048766:"IFCOWNERHISTORY",1411181986:"IFCORGANIZATIONRELATIONSHIP",4251960020:"IFCORGANIZATION",1227763645:"IFCOPTICALMATERIALPROPERTIES",2251480897:"IFCOBJECTIVE",3701648758:"IFCOBJECTPLACEMENT",1918398963:"IFCNAMEDUNIT",2706619895:"IFCMONETARYUNIT",3368373690:"IFCMETRIC",677618848:"IFCMECHANICALSTEELMATERIALPROPERTIES",4256014907:"IFCMECHANICALMATERIALPROPERTIES",2597039031:"IFCMEASUREWITHUNIT",3265635763:"IFCMATERIALPROPERTIES",2199411900:"IFCMATERIALLIST",1303795690:"IFCMATERIALLAYERSETUSAGE",3303938423:"IFCMATERIALLAYERSET",248100487:"IFCMATERIALLAYER",1847130766:"IFCMATERIALCLASSIFICATIONRELATIONSHIP",1838606355:"IFCMATERIAL",30780891:"IFCLOCALTIME",1566485204:"IFCLIGHTINTENSITYDISTRIBUTION",4162380809:"IFCLIGHTDISTRIBUTIONDATA",3452421091:"IFCLIBRARYREFERENCE",2655187982:"IFCLIBRARYINFORMATION",3020489413:"IFCIRREGULARTIMESERIESVALUE",852622518:"IFCGRIDAXIS",3548104201:"IFCEXTERNALLYDEFINEDTEXTFONT",3207319532:"IFCEXTERNALLYDEFINEDSYMBOL",1040185647:"IFCEXTERNALLYDEFINEDSURFACESTYLE",2242383968:"IFCEXTERNALLYDEFINEDHATCHSTYLE",3200245327:"IFCEXTERNALREFERENCE",1648886627:"IFCENVIRONMENTALIMPACTVALUE",3796139169:"IFCDRAUGHTINGCALLOUTRELATIONSHIP",770865208:"IFCDOCUMENTINFORMATIONRELATIONSHIP",1154170062:"IFCDOCUMENTINFORMATION",1376555844:"IFCDOCUMENTELECTRONICFORMAT",2949456006:"IFCDIMENSIONALEXPONENTS",1045800335:"IFCDERIVEDUNITELEMENT",1765591967:"IFCDERIVEDUNIT",1072939445:"IFCDATEANDTIME",3510044353:"IFCCURVESTYLEFONTPATTERN",2367409068:"IFCCURVESTYLEFONTANDSCALING",1105321065:"IFCCURVESTYLEFONT",539742890:"IFCCURRENCYRELATIONSHIP",602808272:"IFCCOSTVALUE",1065062679:"IFCCOORDINATEDUNIVERSALTIMEOFFSET",347226245:"IFCCONSTRAINTRELATIONSHIP",613356794:"IFCCONSTRAINTCLASSIFICATIONRELATIONSHIP",1658513725:"IFCCONSTRAINTAGGREGATIONRELATIONSHIP",1959218052:"IFCCONSTRAINT",2732653382:"IFCCONNECTIONSURFACEGEOMETRY",4257277454:"IFCCONNECTIONPORTGEOMETRY",2614616156:"IFCCONNECTIONPOINTGEOMETRY",2859738748:"IFCCONNECTIONGEOMETRY",3264961684:"IFCCOLOURSPECIFICATION",3639012971:"IFCCLASSIFICATIONNOTATIONFACET",938368621:"IFCCLASSIFICATIONNOTATION",1098599126:"IFCCLASSIFICATIONITEMRELATIONSHIP",1767535486:"IFCCLASSIFICATIONITEM",747523909:"IFCCLASSIFICATION",622194075:"IFCCALENDARDATE",2069777674:"IFCBOUNDARYNODECONDITIONWARPING",1387855156:"IFCBOUNDARYNODECONDITION",3367102660:"IFCBOUNDARYFACECONDITION",1560379544:"IFCBOUNDARYEDGECONDITION",4037036970:"IFCBOUNDARYCONDITION",3869604511:"IFCAPPROVALRELATIONSHIP",390851274:"IFCAPPROVALPROPERTYRELATIONSHIP",2080292479:"IFCAPPROVALACTORRELATIONSHIP",130549933:"IFCAPPROVAL",1110488051:"IFCAPPLIEDVALUERELATIONSHIP",411424972:"IFCAPPLIEDVALUE",639542469:"IFCAPPLICATION",618182010:"IFCADDRESS",3630933823:"IFCACTORROLE",599546466:"FILE_DESCRIPTION",1390159747:"FILE_NAME",1109904537:"FILE_SCHEMA"};class Oe{static async getUnits(s){var r,o,a;const{IFCUNITASSIGNMENT:t}=Z,e=await s.getAllPropertiesOfType(t);if(!e)return 1;const i=Object.keys(e),n=e[parseInt(i[0],10)];for(const l of n.Units){if(l.value===void 0||l.value===null)continue;const h=await s.getProperties(l.value);if(!h||!h.UnitType||!h.UnitType.value||h.UnitType.value!=="LENGTHUNIT")continue;let u=1,f=1;return h.Name.value==="METRE"&&(f=1),h.Name.value==="FOOT"&&(f=.3048),((r=h.Prefix)==null?void 0:r.value)==="MILLI"?u=.001:((o=h.Prefix)==null?void 0:o.value)==="CENTI"?u=.01:((a=h.Prefix)==null?void 0:a.value)==="DECI"&&(u=.1),f*u}return 1}static async findItemByGuid(s,t){var i;const e=s.getAllPropertiesIDs();for(const n of e){const r=await s.getProperties(n);if(r&&((i=r.GlobalId)==null?void 0:i.value)===t)return r}return null}static async getRelationMap(s,t,e){var a;const n=e??(async()=>{}),r={},o=s.getAllPropertiesIDs();for(const l of o){const h=await s.getProperties(l);if(!h)continue;const d=h.type===t,u=Object.keys(h).find(m=>m.startsWith("Relating")),f=Object.keys(h).find(m=>m.startsWith("Related"));if(!(d&&u&&f))continue;const E=await s.getProperties((a=h[u])==null?void 0:a.value),p=h[f];if(!E||!p||!(p&&Array.isArray(p)))continue;const I=p.map(m=>m.value);await n(E.expressID,I),r[E.expressID]=I}return r}static async getQsetQuantities(s,t,e){const n=e??(()=>{}),r=await s.getProperties(t);return!r||r.type!==Z.IFCELEMENTQUANTITY?null:(r.Quantities??[{}]).map(l=>(l.value&&n(l.value),l.value)).filter(l=>l!==null)}static async getPsetProps(s,t,e){const n=e??(()=>{}),r=await s.getProperties(t);return!r||r.type!==Z.IFCPROPERTYSET?null:(r.HasProperties??[{}]).map(l=>(l.value&&n(l.value),l.value)).filter(l=>l!==null)}static async getPsetRel(s,t){var o;if(!await s.getProperties(t))return null;const i=await s.getAllPropertiesOfType(Z.IFCRELDEFINESBYPROPERTIES);if(!i)return null;const n=Object.values(i);let r=null;for(const a of n)((o=a.RelatingPropertyDefinition)==null?void 0:o.value)===t&&(r=a.expressID);return r}static async getQsetRel(s,t){return Oe.getPsetRel(s,t)}static async getEntityName(s,t){var r;const e=await s.getProperties(t);if(!e)return{key:null,name:null};const i=Object.keys(e).find(o=>o.endsWith("Name"))??null,n=i?(r=e[i])==null?void 0:r.value:null;return{key:i,name:n}}static async getQuantityValue(s,t){const e=await s.getProperties(t);if(!e)return{key:null,value:null};const i=Object.keys(e).find(r=>r.endsWith("Value"))??null;let n;return i===null||e[i]===void 0||e[i]===null?n=null:n=e[i].value,{key:i,value:n}}static isRel(s){return _n[s].startsWith("IFCREL")}static async attributeExists(s,t,e){const i=await s.getProperties(t);return i?Object.keys(i).includes(e):!1}static async groupEntitiesByType(s,t){var i;const e=new Map;for(const n of t){const r=await s.getProperties(n);if(!r)continue;const o=r.type;e.get(o)||e.set(o,new Set),(i=e.get(o))==null||i.add(n)}return e}}class Wa{constructor(){_(this,"factor",1);_(this,"complement",1)}apply(s){const e=this.getScaleMatrix().multiply(s);s.copy(e)}setUp(s){var n,r,o;this.factor=1;const t=this.getLengthUnits(s);if(!t)return;const e=t==null,i=t.Name===void 0||t.Name===null;e||i||(t.Name.value==="FOOT"&&(this.factor=.3048),((n=t.Prefix)==null?void 0:n.value)==="MILLI"?this.complement=.001:((r=t.Prefix)==null?void 0:r.value)==="CENTI"?this.complement=.01:((o=t.Prefix)==null?void 0:o.value)==="DECI"&&(this.complement=.01))}getLengthUnits(s){try{const e=s.GetLineIDsWithType(0,Z.IFCUNITASSIGNMENT).get(0),i=s.GetLine(0,e);for(const n of i.Units){if(!n||n.value===null||n.value===void 0)continue;const r=s.GetLine(0,n.value);if(r.UnitType&&r.UnitType.value==="LENGTHUNIT")return r}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const s=this.factor;return new x.Matrix4().fromArray([s,0,0,0,0,s,0,0,0,0,s,0,0,0,0,1])}}class Gr{constructor(){_(this,"itemsByFloor",{});_(this,"_units",new Wa)}setUp(s){this._units.setUp(s),this.cleanUp();try{const t=s.GetLineIDsWithType(0,Z.IFCRELCONTAINEDINSPATIALSTRUCTURE),e=new Set,i=s.GetLineIDsWithType(0,Z.IFCSPACE);for(let l=0;l<i.size();l++)e.add(i.get(l));const n=s.GetLineIDsWithType(0,Z.IFCRELAGGREGATES),r=n.size();for(let l=0;l<r;l++){const h=n.get(l),d=s.GetLine(0,h);if(!d||!d.RelatingObject||!d.RelatedObjects)continue;const u=d.RelatingObject.value,f=d.RelatedObjects;for(const E of f){const p=E.value;e.has(p)&&(this.itemsByFloor[p]=u)}}const o={},a=t.size();for(let l=0;l<a;l++){const h=t.get(l),d=s.GetLine(0,h);if(!d||!d.RelatingStructure||!d.RelatedElements)continue;const u=d.RelatingStructure.value,f=d.RelatedElements;if(e.has(u))for(const E of f){o[u]||(o[u]=[]);const p=E.value;o[u].push(p)}else for(const E of f){const p=E.value;this.itemsByFloor[p]=u}}for(const l in o){const h=this.itemsByFloor[l];if(h!==void 0){const d=o[l];for(const u of d)this.itemsByFloor[u]=h}}for(let l=0;l<r;l++){const h=n.get(l),d=s.GetLine(0,h);if(!d||!d.RelatingObject||!d.RelatedObjects)continue;const u=d.RelatingObject.value,f=d.RelatedObjects;for(const E of f){const p=E.value,I=this.itemsByFloor[u];I!==void 0&&(this.itemsByFloor[p]=I)}}}catch{console.log("Could not get floors.")}}cleanUp(){this.itemsByFloor={}}}class Si{constructor(){_(this,"includeProperties",!0);_(this,"optionalCategories",[Z.IFCSPACE]);_(this,"coordinate",!0);_(this,"wasm",{path:"",absolute:!1,logLevel:Z.LogLevel.LOG_LEVEL_OFF});_(this,"excludedCategories",new Set);_(this,"includedCategories",new Set);_(this,"saveLocations",!1);_(this,"webIfc",{COORDINATE_TO_ORIGIN:!0});_(this,"autoSetWasm",!0);_(this,"customLocateFileHandler",null)}}class Yr{constructor(){_(this,"defLineMat",new x.LineBasicMaterial({color:16777215}))}read(s){const t=s.GetAllAlignments(0),e=s.GetAllCrossSections2D(0),i=s.GetAllCrossSections3D(0),n={IfcAlignment:t,IfcCrossSection2D:e,IfcCrossSection3D:i};return this.get(n)}get(s){if(s.IfcAlignment){const t=new Map;for(const e of s.IfcAlignment){const i=new Ie.Alignment;i.absolute=this.getCurves(e.curve3D,i),i.horizontal=this.getCurves(e.horizontal,i),i.vertical=this.getCurves(e.vertical,i),t.set(t.size,i)}return{alignments:t,coordinationMatrix:new x.Matrix4}}}getCurves(s,t){const e=[];let i=0;for(const n of s){const r={};if(n.data)for(const u of n.data){const[f,E]=u.split(": "),p=parseFloat(E);r[f]=p||E}const{points:o}=n,a=new Float32Array(o.length*3);for(let u=0;u<o.length;u++){const{x:f,y:E,z:p}=o[u];a[u*3]=f,a[u*3+1]=E,a[u*3+2]=p||0}const l=new x.BufferAttribute(a,3),h=new x.EdgesGeometry;h.setAttribute("position",l);const d=new Ie.CurveMesh(i,r,t,h,this.defLineMat);e.push(d.curve),i++}return e}}class Hr{getNameInfo(s){var d;const t={},{arguments:e}=s.GetHeaderLine(0,Z.FILE_NAME)||{};if(!e)return t;const[i,n,r,o,a,l,h]=e;if(i!=null&&i.value&&(t.name=i.value),n!=null&&n.value&&(t.creationDate=new Date(n.value)),r){t.author={};const[u,f]=r;u!=null&&u.value&&(t.author.name=u.value),f!=null&&f.value&&(t.author.email=f.value)}return(d=o[0])!=null&&d.value&&(t.organization=o[0].value),a!=null&&a.value&&(t.preprocessorVersion=a==null?void 0:a.value),l!=null&&l.value&&(t.originatingSystem=l==null?void 0:l.value),h!=null&&h.value&&(t.authorization=h==null?void 0:h.value),t}getDescriptionInfo(s){var r;const t={},{arguments:e}=s.GetHeaderLine(0,Z.FILE_DESCRIPTION)||{};if(!e)return t;const[i,n]=e;if((r=i[0])!=null&&r.value){const o=i[0].value.match(/\[([^\]]+)\]/);o&&o[1]&&(t.viewDefinition=o[1])}return n!=null&&n.value&&(t.implementationLevel=n.value),t}}class Wr{static get(s,t){const e=[Z.IFCPROJECT,Z.IFCSITE,Z.IFCBUILDING,Z.IFCBUILDINGSTOREY,Z.IFCSPACE,Z.IFCROAD,Z.IFCFACILITY,Z.IFCFACILITYPART,Z.IFCBRIDGE],i=s.data;for(const n of e){const r=t.GetLineIDsWithType(0,n),o=r.size();for(let a=0;a<o;a++){const l=r.get(a);i.has(l)||i.set(l,[[],[0,n]])}}}}const An=new Set([1123145078,574549367,1675464909,2059837836,3798115385,32440307,3125803723,3207858831,2740243338,2624227202,4240577450,3615266464,3724593414,220341763,477187591,1878645084,1300840506,3303107099,1607154358,1878645084,846575682,1351298697,2417041796,3049322572,3331915920,1416205885,776857604,3285139300,3958052878,2827736869,2732653382,673634403,3448662350,4142052618,2924175390,803316827,2556980723,1809719519,2205249479,807026263,3737207727,1660063152,2347385850,2705031697,3732776249,2485617015,2611217952,1704287377,2937912522,2770003689,1281925730,1484403080,3448662350,4142052618,3800577675,4006246654,3590301190,1383045692,2775532180,2047409740,370225590,3593883385,2665983363,4124623270,812098782,3649129432,987898635,1105321065,3510044353,1635779807,2603310189,3406155212,1310608509,4261334040,2736907675,3649129432,1136057603,1260505505,4182860854,2713105998,2898889636,59481748,3749851601,3486308946,3150382593,1062206242,3264961684,15328376,1485152156,370225590,1981873012,2859738748,45288368,2614616156,2732653382,775493141,2147822146,2601014836,2629017746,1186437898,2367409068,1213902940,3632507154,3900360178,476780140,1472233963,2804161546,3008276851,738692330,374418227,315944413,3905492369,3570813810,2571569899,178912537,2294589976,1437953363,2133299955,572779678,3092502836,388784114,2624227202,1425443689,3057273783,2347385850,1682466193,2519244187,2839578677,3958567839,2513912981,2830218821,427810014]),fi=class fi extends Ft{constructor(t){super(t);_(this,"enabled",!0);t.add(fi.uuid,this)}async export(t,e,i=!1,n=!0){const r={},o=new Set(t.GetIfcEntityList(e)),a=new Set([Z.IFCPROJECT,Z.IFCSITE,Z.IFCBUILDING,Z.IFCBUILDINGSTOREY,Z.IFCSPACE]);for(const l of a)o.add(l);for(const l of o){if(An.has(l))continue;const h=a.has(l)&&n,d=t.GetLineIDsWithType(e,l);for(const u of d){const f=t.GetLine(0,u,h,i);r[f.expressID]=f}}return r}};_(fi,"uuid","b32c4332-cd67-436e-ba7f-196646c7a635");let ii=fi;const Cs=class Cs extends Ft{constructor(t){super(t);_(this,"onDisposed",new Q);_(this,"onIfcStartedLoading",new Q);_(this,"onSetup",new Q);_(this,"settings",new Si);_(this,"webIfc",new Z.IfcAPI);_(this,"enabled",!0);_(this,"_material",new x.MeshLambertMaterial);_(this,"_spatialTree",new Gr);_(this,"_metaData",new Hr);_(this,"_fragmentInstances",new Map);_(this,"_civil",new Yr);_(this,"_visitedFragments",new Map);_(this,"_materialT",new x.MeshLambertMaterial({transparent:!0,opacity:.5}));this.components.add(Cs.uuid,this),this.settings.excludedCategories.add(Z.IFCOPENINGELEMENT)}dispose(){this.webIfc=null,this.onDisposed.trigger(Cs.uuid),this.onDisposed.reset()}async setup(t){this.settings={...this.settings,...t},this.settings.autoSetWasm&&await this.autoSetWasm(),this.onSetup.trigger()}async load(t,e=!0,i=""){const n=performance.now();this.onIfcStartedLoading.trigger(),await this.readIfcFile(t);const r=await this.getAllGeometries();r.name=i;const a=await this.components.get(ii).export(this.webIfc,0);r.setLocalProperties(a);const l=this.components.get(gt);l.groups.set(r.uuid,r);for(const h of r.items)l.list.set(h.id,h),h.mesh.uuid=h.id,h.group=r;l.onFragmentsLoaded.trigger(r),e&&l.coordinate([r]);for(const[h]of r.data){const d=a[h];if(!d||!d.GlobalId)continue;const u=d.GlobalId.value||d.GlobalId;r.globalToExpressIDs.set(u,h)}return Wr.get(r,this.webIfc),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-n} ms!`),r}async readIfcFile(t){const{path:e,absolute:i,logLevel:n}=this.settings.wasm;return this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(this.settings.customLocateFileHandler||void 0),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(t,this.settings.webIfc)}cleanUp(){try{this.webIfc.Dispose()}catch{console.log("Web-ifc wasn't disposed.")}this.webIfc=null,this.webIfc=new Z.IfcAPI,this._visitedFragments.clear(),this._fragmentInstances.clear()}async getAllGeometries(){this._spatialTree.setUp(this.webIfc);const t=this.webIfc.GetIfcEntityList(0),e=new Ie.FragmentsGroup;e.ifcMetadata={name:"",description:"",...this._metaData.getNameInfo(this.webIfc),...this._metaData.getDescriptionInfo(this.webIfc),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};const i=[];for(const r of t){if(!this.webIfc.IsIfcElement(r)&&r!==Z.IFCSPACE)continue;const o=this.settings.includedCategories;if(o.size>0&&!o.has(r))continue;if(this.settings.excludedCategories.has(r))continue;const a=this.webIfc.GetLineIDsWithType(0,r),l=a.size();for(let h=0;h<l;h++){const d=a.get(h);i.push(d);const u=this._spatialTree.itemsByFloor[d]||0;e.data.set(d,[[],[u,r]])}}this._spatialTree.cleanUp(),this.webIfc.StreamMeshes(0,i,r=>{this.getMesh(r,e)});for(const r of this._visitedFragments){const{index:o,fragment:a}=r[1];e.keyFragments.set(o,a.id)}for(const r of e.items){const o=this._fragmentInstances.get(r.id);if(!o)throw new Error("Fragment not found!");const a=[];for(const[l,h]of o)a.push(h);r.add(a)}const n=this.webIfc.GetCoordinationMatrix(0);return e.coordinationMatrix.fromArray(n),e.civilData=this._civil.read(this.webIfc),e}getMesh(t,e){const i=t.geometries.size(),n=t.expressID;for(let r=0;r<i;r++){const o=t.geometries.get(r),{x:a,y:l,z:h,w:d}=o.color,u=d!==1,{geometryExpressID:f}=o,E=`${f}-${u}`;if(!this._visitedFragments.has(E)){const y=this.getGeometry(this.webIfc,f),w=u?this._materialT:this._material,O=new Ie.Fragment(y,w,1);e.add(O.mesh),e.items.push(O);const M=this._visitedFragments.size;this._visitedFragments.set(E,{index:M,fragment:O})}const p=new x.Color().setRGB(a,l,h,"srgb"),I=new x.Matrix4;I.fromArray(o.flatTransformation);const m=this._visitedFragments.get(E);if(m===void 0)throw new Error("Error getting geometry data for streaming!");const C=e.data.get(n);if(!C)throw new Error("Data not found!");C[0].push(m.index);const{fragment:R}=m;this._fragmentInstances.has(R.id)||this._fragmentInstances.set(R.id,new Map);const g=this._fragmentInstances.get(R.id);if(!g)throw new Error("Instances not found!");if(g.has(n)){const y=g.get(n);if(!y)throw new Error("Instance not found!");y.transforms.push(I),y.colors&&y.colors.push(p)}else g.set(n,{id:n,transforms:[I],colors:[p]})}}getGeometry(t,e){const i=t.GetGeometry(0,e),n=t.GetIndexArray(i.GetIndexData(),i.GetIndexDataSize()),r=t.GetVertexArray(i.GetVertexData(),i.GetVertexDataSize()),o=new Float32Array(r.length/2),a=new Float32Array(r.length/2);for(let u=0;u<r.length;u+=6)o[u/2]=r[u],o[u/2+1]=r[u+1],o[u/2+2]=r[u+2],a[u/2]=r[u+3],a[u/2+1]=r[u+4],a[u/2+2]=r[u+5];const l=new x.BufferGeometry,h=new x.BufferAttribute(o,3),d=new x.BufferAttribute(a,3);return l.setAttribute("position",h),l.setAttribute("normal",d),l.setIndex(Array.from(n)),i.delete(),l}async autoSetWasm(){const t=await fetch(`https://unpkg.com/@thatopen/components@${ti.release}/package.json`);if(!t.ok){console.warn("Couldn't get openbim-components package.json. Set wasm settings manually.");return}const e=await t.json();if(!("web-ifc"in e.peerDependencies))console.warn("Couldn't get web-ifc from peer dependencies in openbim-components. Set wasm settings manually.");else{const i=e.peerDependencies["web-ifc"];this.settings.wasm.path=`https://unpkg.com/web-ifc@${i}/`,this.settings.wasm.absolute=!0}}};_(Cs,"uuid","a659add7-1418-4771-a0d6-7d4d438e4624");let ni=Cs;const Xr={IfcRelAssignsToControl:{related:5,relating:7},IfcRelAssignsToGroup:{related:5,relating:7},IfcRelAssignsToProduct:{related:5,relating:7},IfcRelAssociatesClassification:{related:5,relating:6},IfcRelAssociatesMaterial:{related:5,relating:6},IfcRelAssociatesDocument:{related:5,relating:6},IfcRelContainedInSpatialStructure:{related:5,relating:6},IfcRelFlowControlElements:{related:5,relating:6},IfcRelConnectsElements:{related:7,relating:6},IfcRelDeclares:{related:6,relating:5},IfcRelAggregates:{related:6,relating:5},IfcRelNests:{related:6,relating:5},IfcRelDefinesByProperties:{related:5,relating:6},IfcRelDefinesByType:{related:5,relating:6},IfcRelDefinesByTemplate:{related:5,relating:6}},Zr={[Z.IFCRELASSIGNSTOCONTROL]:"IfcRelAssignsToControl",[Z.IFCRELASSIGNSTOGROUP]:"IfcRelAssignsToGroup",[Z.IFCRELASSIGNSTOPRODUCT]:"IfcRelAssignsToProduct",[Z.IFCRELASSOCIATESCLASSIFICATION]:"IfcRelAssociatesClassification",[Z.IFCRELASSOCIATESMATERIAL]:"IfcRelAssociatesMaterial",[Z.IFCRELASSOCIATESDOCUMENT]:"IfcRelAssociatesDocument",[Z.IFCRELCONTAINEDINSPATIALSTRUCTURE]:"IfcRelContainedInSpatialStructure",[Z.IFCRELCONNECTSELEMENTS]:"IfcRelConnectsElements",[Z.IFCRELFLOWCONTROLELEMENTS]:"IfcRelFlowControlElements",[Z.IFCRELDECLARES]:"IfcRelDeclares",[Z.IFCRELAGGREGATES]:"IfcRelAggregates",[Z.IFCRELNESTS]:"IfcRelNests",[Z.IFCRELDEFINESBYPROPERTIES]:"IfcRelDefinesByProperties",[Z.IFCRELDEFINESBYTYPE]:"IfcRelDefinesByType",[Z.IFCRELDEFINESBYTEMPLATE]:"IfcRelDefinesByTemplate"},Ee=class Ee extends Ft{constructor(t){super(t);_(this,"onDisposed",new Q);_(this,"onRequestFile",new Q);_(this,"ifcToExport",null);_(this,"onElementToPset",new Q);_(this,"onPropToPset",new Q);_(this,"onPsetRemoved",new Q);_(this,"onDataChanged",new Q);_(this,"wasm",{path:"/",absolute:!1});_(this,"enabled",!0);_(this,"attributeListeners",{});_(this,"selectedModel");_(this,"changeMap",{});this.components.add(Ee.uuid,this)}dispose(){this.selectedModel=void 0,this.attributeListeners={},this.changeMap={},this.onElementToPset.reset(),this.onPropToPset.reset(),this.onPsetRemoved.reset(),this.onDataChanged.reset(),this.onDisposed.trigger(Ee.uuid),this.onDisposed.reset()}static getIFCSchema(t){const e=t.ifcMetadata.schema;if(!e)throw new Error("IFC Schema not found");return e.startsWith("IFC2X3")?"IFC2X3":e.startsWith("IFC4")&&e.replace("IFC4","")===""?"IFC4":e.startsWith("IFC4X3")?"IFC4X3":e}async setData(t,...e){for(const i of e){const{expressID:n}=i;(!n||n===-1)&&(i.expressID=this.getNewExpressID(t)),await t.setProperties(i.expressID,i),this.registerChange(t,i.expressID)}}async newPset(t,e,i){const n=Ee.getIFCSchema(t),{ownerHistoryHandle:r}=await this.getOwnerHistory(t),o=this.newGUID(t),a=new Z[n].IfcLabel(e),l=i?new Z[n].IfcText(i):null,h=new Z[n].IfcPropertySet(o,r,a,l,[]);h.expressID=this.getNewExpressID(t);const d=this.newGUID(t),u=new Z[n].IfcRelDefinesByProperties(d,r,null,null,[],new Z.Handle(h.expressID));return u.expressID=this.getNewExpressID(t),await this.setData(t,h,u),{pset:h,rel:u}}async removePset(t,...e){for(const i of e){const n=await t.getProperties(i);if((n==null?void 0:n.type)!==Z.IFCPROPERTYSET)continue;const r=await Oe.getPsetRel(t,i);if(r&&(await t.setProperties(r,null),this.registerChange(t,r)),n){for(const o of n.HasProperties)await t.setProperties(o.value,null);await t.setProperties(i,null),this.onPsetRemoved.trigger({model:t,psetID:i}),this.registerChange(t,i)}}}newSingleStringProperty(t,e,i,n){return this.newSingleProperty(t,e,i,n)}newSingleNumericProperty(t,e,i,n){return this.newSingleProperty(t,e,i,n)}newSingleBooleanProperty(t,e,i,n){return this.newSingleProperty(t,e,i,n)}async removePsetProp(t,e,i){const n=await t.getProperties(e),r=await t.getProperties(i);!n||!r||n.type===Z.IFCPROPERTYSET&&r&&(n.HasProperties=n.HasProperties.filter(o=>o.value!==i),await t.setProperties(i,null),this.registerChange(t,e,i))}addElementToPset(t,e,...i){this.components.get(Ce).addEntitiesRelation(t,e,{type:Z.IFCRELDEFINESBYPROPERTIES,inv:"IsDefinedBy"},...i)}async addPropToPset(t,e,...i){const n=await t.getProperties(e);if(n){for(const r of i){if(n.HasProperties.includes(r))continue;const o=new Z.Handle(r);n.HasProperties.push(o),this.onPropToPset.trigger({model:t,psetID:e,propID:r})}this.registerChange(t,e)}}async createIfcRel(t,e,i,n){const r=Zr[e];if(!r)throw new Error(`IfcPropertiesManager: ${r} is unsoported.`);const o=t.ifcMetadata.schema,a=Xr[r],l=Z[o][r];if(!(a&&l))throw new Error(`IfcPropertiesManager: ${r} is unsoported.`);const h=[new Z[o].IfcGloballyUniqueId(oe.create())],{related:d,relating:u}=a,E=[...new Set(n)].map(m=>new Z.Handle(m)),p=(m,C)=>{for(let R=m;R<C-1;R++)h.push(null)};d<u?(p(1,d),h.push(E),p(d,u),h.push(new Z.Handle(i))):(p(1,u),p(u,d),h.push(new Z.Handle(i)),h.push(E));const I=new l(...h);return await this.setData(t,I),I}async saveToIfc(t,e){const i=this.components.get(ni),n=i.webIfc,r=await i.readIfcFile(e);await this.components.get(Ce).applyRelationChanges();const a=this.changeMap[t.uuid]??[];for(const h of a){const d=await t.getProperties(h);d?n.WriteLine(r,d):n.DeleteLine(r,h)}const l=n.SaveModel(r);return i.webIfc.CloseModel(r),i.cleanUp(),l}async getEntityRef(t,e){const i=await t.getAllPropertiesOfType(e);if(!i)return null;const n=[];for(const r in i){const o=new Z.Handle(Number(r));n.push(o)}return n}async setAttributeListener(t,e,i){this.attributeListeners[t.uuid]||(this.attributeListeners[t.uuid]={});const n=this.attributeListeners[t.uuid][e]?this.attributeListeners[t.uuid][e][i]:null;if(n)return n;const r=await t.getProperties(e);if(!r)throw new Error(`Entity with expressID ${e} doesn't exists.`);const o=r[i];if(Array.isArray(o)||!o)throw new Error(`Attribute ${i} is array or null, and it can't have a listener.`);const a=o.value;if(a===void 0||a==null)throw new Error(`Attribute ${i} has a badly defined handle.`);const l=new Q;return Object.defineProperty(r[i],"value",{get(){return this._value},async set(h){this._value=h,l.trigger(h)}}),r[i].value=a,this.attributeListeners[t.uuid][e]||(this.attributeListeners[t.uuid][e]={}),this.attributeListeners[t.uuid][e][i]=l,l}getNewExpressID(t){return t.ifcMetadata.maxExpressID++,t.ifcMetadata.maxExpressID}newGUID(t){const e=Ee.getIFCSchema(t);return new Z[e].IfcGloballyUniqueId(oe.create())}async getOwnerHistory(t){const e=await t.getAllPropertiesOfType(Z.IFCOWNERHISTORY);if(!e)throw new Error("No OwnerHistory was found.");const i=Object.keys(e).map(o=>parseInt(o,10)),n=e[i[0]],r=new Z.Handle(n.expressID);return{ownerHistory:n,ownerHistoryHandle:r}}registerChange(t,...e){this.changeMap[t.uuid]||(this.changeMap[t.uuid]=new Set);for(const i of e)this.changeMap[t.uuid].add(i),this.onDataChanged.trigger({model:t,expressID:i})}async newSingleProperty(t,e,i,n){const r=Ee.getIFCSchema(t),o=new Z[r].IfcIdentifier(i),a=new Z[r][e](n),l=new Z[r].IfcPropertySingleValue(o,null,a,null);return l.expressID=this.getNewExpressID(t),await this.setData(t,l),l}};_(Ee,"uuid","58c2d9f0-183c-48d6-a402-dfcf5b9a34df");let ri=Ee;const Ts=class Ts extends Ft{constructor(t){super(t);_(this,"onDisposed",new Q);_(this,"onRelationsIndexed",new Q);_(this,"relationMaps",{});_(this,"enabled",!0);_(this,"_relToAttributesMap",ln);_(this,"_inverseAttributes",["IsDecomposedBy","Decomposes","AssociatedTo","HasAssociations","ClassificationForObjects","IsGroupedBy","HasAssignments","IsDefinedBy","DefinesOcurrence","IsTypedBy","Types","Defines","ContainedInStructure","ContainsElements","HasControlElements","AssignedToFlowElement","ConnectedTo","ConnectedFrom","ReferencedBy","Declares","HasContext","Controls","IsNestedBy","Nests","DocumentRefForObjects"]);_(this,"_ifcRels",[Z.IFCRELAGGREGATES,Z.IFCRELASSOCIATESMATERIAL,Z.IFCRELASSOCIATESCLASSIFICATION,Z.IFCRELASSIGNSTOGROUP,Z.IFCRELDEFINESBYPROPERTIES,Z.IFCRELDEFINESBYTYPE,Z.IFCRELDEFINESBYTEMPLATE,Z.IFCRELCONTAINEDINSPATIALSTRUCTURE,Z.IFCRELFLOWCONTROLELEMENTS,Z.IFCRELCONNECTSELEMENTS,Z.IFCRELASSIGNSTOPRODUCT,Z.IFCRELDECLARES,Z.IFCRELASSIGNSTOCONTROL,Z.IFCRELNESTS,Z.IFCRELASSOCIATESDOCUMENT]);_(this,"onFragmentsDisposed",t=>{delete this.relationMaps[t.groupID]});_(this,"_changeMap",{});_(this,"onEntitiesRelated",new Q);this.components.add(Ts.uuid,this),t.get(gt).onFragmentsDisposed.add(this.onFragmentsDisposed)}indexRelations(t,e,i,n){const r=Object.keys(e).find(d=>d.startsWith("Relating")),o=Object.keys(e).find(d=>d.startsWith("Related"));if(!(r&&o))return;const a=e[r].value,l=e[o].map(d=>d.value),h=this.getAttributeIndex(n);if(h!==null){let d=t.get(a);d||(d=new Map,t.set(a,d));let u=d.get(h);u||(u=[],d.set(h,u)),u.push(...l)}for(const d of l){const u=this.getAttributeIndex(i);if(u===null)continue;let f=t.get(d);f||(f=new Map,t.set(d,f));let E=f.get(u);E||(E=[],f.set(u,E)),E.push(a)}}getAttributeIndex(t){const e=this._inverseAttributes.indexOf(t);return e===-1?null:e}setRelationMap(t,e){this.relationMaps[t.uuid]=e,this.onRelationsIndexed.trigger({modelID:t.uuid,relationsMap:e})}async process(t){if(!t.hasProperties)throw new Error("FragmentsGroup properties not found");let e=this.relationMaps[t.uuid];if(e)return e;e=new Map;for(const i of this._ifcRels){const n=await t.getAllPropertiesOfType(i);if(!n)continue;const r=this._relToAttributesMap.get(i);if(!r)continue;const{forRelated:o,forRelating:a}=r;for(const l in n){const h=n[l];this.indexRelations(e,h,o,a)}}return this.setRelationMap(t,e),e}async processFromWebIfc(t,e){const i=new Map;for(const n of this._ifcRels){const r=this._relToAttributesMap.get(n);if(!r)continue;const{forRelated:o,forRelating:a}=r,l=t.GetLineIDsWithType(e,n);for(let h=0;h<l.size();h++){const d=await t.properties.getItemProperties(e,l.get(h));this.indexRelations(i,d,o,a)}}return this.onRelationsIndexed.trigger({modelID:e.toString(),relationsMap:i}),i}getEntityRelations(t,e,i){const n=this.relationMaps[t.uuid];if(!n)throw new Error(`IfcRelationsIndexer: model ${t.uuid} has no relations indexed.`);const r=n.get(e),o=this.getAttributeIndex(i);if(r===void 0||o===null)return null;const a=r.get(o);return a||null}serializeRelations(t){const e={};for(const[i,n]of t.entries()){e[i]||(e[i]={});for(const[r,o]of n.entries())e[i][r]=o}return JSON.stringify(e)}serializeModelRelations(t){const e=this.relationMaps[t.uuid];return e?this.serializeRelations(e):null}serializeAllRelations(){const t={};for(const e in this.relationMaps){const i=this.relationMaps[e],n={};for(const[r,o]of i.entries()){n[r]||(n[r]={});for(const[a,l]of o.entries())n[r][a]=l}t[e]=n}return JSON.stringify(t)}getRelationsMapFromJSON(t){const e=JSON.parse(t),i=new Map;for(const n in e){const r=e[n],o=new Map;for(const a in r)o.set(Number(a),r[a]);i.set(Number(n),o)}return i}dispose(){this.relationMaps={},this.components.get(gt).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(Ts.uuid),this.onDisposed.reset()}getEntitiesWithRelation(t,e,i){const n=this.relationMaps[t.uuid];if(!n)throw new Error("IfcRelationsIndexer: the model relations are not indexed!");const r=new Set;for(const[o,a]of n){const l=this.getAttributeIndex(e);if(l===null)throw new Error("IfcRelationsIndexer: invalid inverse attribute name");const h=a.get(l);h&&h.includes(i)&&r.add(o)}return r}addEntityRelations(t,e,i,...n){const r=this.getEntityRelations(t,e,i);if(r)r.push(...n);else{const o=this.getAttributeIndex(i);if(!o)throw new Error(`IfcRelationsIndexer: ${i} is not a valid relation name.`);const a=this.relationMaps[t.uuid].get(e);a==null||a.set(o,n)}}async applyRelationChanges(){const t=this.components.get(gt),e=this.components.get(ri);for(const i in this._changeMap){const n=t.groups.get(i);if(!n)continue;const r=this._changeMap[i];for(const[o,a]of r)for(const[l,h]of a){const{related:d,relID:u}=h;if(u){const f=await n.getProperties(u);if(!f)continue;const E=Object.keys(f),p=E.find(m=>m.startsWith("Related")),I=E.find(m=>m.startsWith("Relating"));if(!(p&&I))continue;f[p]=[...d].map(m=>new Z.Handle(m)),f[I]=new Z.Handle(l),await e.setData(n,f)}else{const f=await e.createIfcRel(n,o,l,[...d]);if(!f)continue;h.relID=f.expressID}}}}addEntitiesRelation(t,e,i,...n){const{type:r,inv:o}=i,a=this.relationMaps[t.uuid];if(!a||!this._ifcRels.includes(r))return;const l=ln.get(r);if(!l)return;const{forRelated:h,forRelating:d}=l;if(!(h===o||d===o))return;let u=this._changeMap[t.uuid];u||(u=new re,this._changeMap[t.uuid]=u);const f=d===o?[e]:n,E=h===o?[e]:n;let p=u.get(r);p||(p=new re,p.onItemSet.add(()=>this.onEntitiesRelated.trigger({invAttribute:o,relType:r,relatingIDs:f,relatedIDs:E})),p.onItemUpdated.add(()=>this.onEntitiesRelated.trigger({invAttribute:o,relType:r,relatingIDs:f,relatedIDs:E})),u.set(r,p));for(const I of f){let m=p.get(I);m||(m={related:new Se},p.set(I,m)),m.related.add(...E)}for(const I of f){let m=a.get(I);m||(m=new Map,a.set(I,m));const C=this.getAttributeIndex(d);if(C!==null){let R=m.get(C);R||(R=[],m.set(C,R)),R.push(...E)}}for(const I of E){let m=a.get(I);m||(m=new Map,a.set(I,m));const C=this.getAttributeIndex(h);if(C===null)continue;let R=m.get(C);R||(R=[],m.set(C,R)),R.push(...f)}}getEntityChildren(t,e,i=new Set){if(i.add(e),this.relationMaps[t.uuid]===void 0)throw new Error("The provided model has no indices. You have to generate them first.");const r=this.getEntityRelations(t,e,"IsDecomposedBy");if(r)for(const a of r)this.getEntityChildren(t,a,i);const o=this.getEntityRelations(t,e,"ContainsElements");if(o)for(const a of o)this.getEntityChildren(t,a,i);return i}};_(Ts,"uuid","23a889ab-83b3-44a4-8bee-ead83438370b");let Ce=Ts;const pi=class pi extends Ft{constructor(t){super(t);_(this,"onDisposed",new Q);_(this,"onFragmentsLoaded",new Q);_(this,"onFragmentsDisposed",new Q);_(this,"list",new re);_(this,"groups",new re);_(this,"baseCoordinationModel","");_(this,"baseCoordinationMatrix",new x.Matrix4);_(this,"enabled",!0);_(this,"_loader",new Ir.Serializer);this.components.add(pi.uuid,this)}get meshes(){const t=[];for(const[e,i]of this.list)t.push(i.mesh);return t}dispose(){for(const[t,e]of this.groups)e.dispose(!0);this.baseCoordinationModel="",this.groups.clear(),this.list.clear(),this.onFragmentsLoaded.reset(),this.onFragmentsDisposed.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}disposeGroup(t){const{uuid:e}=t,i=[];for(const n of t.items)i.push(n.id),this.list.delete(n.id);t.dispose(!0),this.groups.delete(t.uuid),this.groups.size===0&&(this.baseCoordinationModel="",this.baseCoordinationMatrix=new x.Matrix4),this.onFragmentsDisposed.trigger({groupID:e,fragmentIDs:i})}load(t,e){const n={...{coordinate:!0},...e},{coordinate:r,name:o,properties:a,relationsMap:l}=n,h=this._loader.import(t);e&&(h.isStreamed=e.isStreamed||!1),o&&(h.name=o);for(const d of h.items)d.group=h,this.list.set(d.id,d);return r&&this.coordinate([h]),this.groups.set(h.uuid,h),a&&h.setLocalProperties(a),l&&this.components.get(Ce).setRelationMap(h,l),this.onFragmentsLoaded.trigger(h),h}export(t){return this._loader.export(t)}getModelIdMap(t){const e={};for(const i in t){const n=this.list.get(i);if(!(n&&n.group))continue;const r=n.group;r.uuid in e||(e[r.uuid]=new Set);const o=t[i];for(const a of o)e[r.uuid].add(a)}return e}modelIdToFragmentIdMap(t){let e={};for(const i in t){const n=this.groups.get(i);if(!n)continue;const r=t[i],o=n.getFragmentMap(r);e={...e,...o}}return e}guidToFragmentIdMap(t){const e={};for(const[n,r]of this.groups){n in e||(e[n]=new Set);for(const o of t){const a=r.globalToExpressIDs.get(o);a&&e[n].add(a)}}return this.modelIdToFragmentIdMap(e)}fragmentIdMapToGuids(t){const e=[],i=this.getModelIdMap(t);for(const n in i){const r=this.groups.get(n);if(!r)continue;const o=i[n];for(const a of o)for(const[l,h]of r.globalToExpressIDs.entries())if(h===a){e.push(l);break}}return e}coordinate(t=Array.from(this.groups.values())){if(this.baseCoordinationModel.length===0){const i=t.pop();if(!i)return;this.baseCoordinationModel=i.uuid,this.baseCoordinationMatrix=i.coordinationMatrix.clone()}if(t.length)for(const i of t)i.coordinationMatrix.equals(this.baseCoordinationMatrix)||(i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),i.updateMatrix(),this.applyBaseCoordinateSystem(i,i.coordinationMatrix))}applyBaseCoordinateSystem(t,e){e&&t.applyMatrix4(e.clone().invert()),t.applyMatrix4(this.baseCoordinationMatrix)}clone(t,e){const i=t.cloneGroup(e);this.groups.set(i.uuid,i);for(const n of i.items)this.list.set(n.id,n);return i}};_(pi,"uuid","fef46874-46a3-461b-8c44-2922ab77c806");let gt=pi;var $s=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xa(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}function js(c){throw new Error('Could not dynamically require "'+c+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var $r={exports:{}};/*!
129
129
 
130
130
  JSZip v3.10.1 - A JavaScript class for generating and reading zip files
131
131
  <http://stuartk.com/jszip>
@@ -135,14 +135,14 @@ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/js
135
135
 
136
136
  JSZip uses the library pako released under the MIT license :
137
137
  https://github.com/nodeca/pako/blob/main/LICENSE
138
- */(function(c,s){(function(t){c.exports=t()})(function(){return function t(e,i,n){function r(l,h){if(!i[l]){if(!e[l]){var d=typeof $s=="function"&&$s;if(!h&&d)return d(l,!0);if(o)return o(l,!0);var u=new Error("Cannot find module '"+l+"'");throw u.code="MODULE_NOT_FOUND",u}var f=i[l]={exports:{}};e[l][0].call(f.exports,function(E){var p=e[l][1][E];return r(p||E)},f,f.exports,t,e,i,n)}return i[l].exports}for(var o=typeof $s=="function"&&$s,a=0;a<n.length;a++)r(n[a]);return r}({1:[function(t,e,i){var n=t("./utils"),r=t("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(a){for(var l,h,d,u,f,E,p,I=[],m=0,C=a.length,R=C,g=n.getTypeOf(a)!=="string";m<a.length;)R=C-m,d=g?(l=a[m++],h=m<C?a[m++]:0,m<C?a[m++]:0):(l=a.charCodeAt(m++),h=m<C?a.charCodeAt(m++):0,m<C?a.charCodeAt(m++):0),u=l>>2,f=(3&l)<<4|h>>4,E=1<R?(15&h)<<2|d>>6:64,p=2<R?63&d:64,I.push(o.charAt(u)+o.charAt(f)+o.charAt(E)+o.charAt(p));return I.join("")},i.decode=function(a){var l,h,d,u,f,E,p=0,I=0,m="data:";if(a.substr(0,m.length)===m)throw new Error("Invalid base64 input, it looks like a data url.");var C,R=3*(a=a.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(a.charAt(a.length-1)===o.charAt(64)&&R--,a.charAt(a.length-2)===o.charAt(64)&&R--,R%1!=0)throw new Error("Invalid base64 input, bad content length.");for(C=r.uint8array?new Uint8Array(0|R):new Array(0|R);p<a.length;)l=o.indexOf(a.charAt(p++))<<2|(u=o.indexOf(a.charAt(p++)))>>4,h=(15&u)<<4|(f=o.indexOf(a.charAt(p++)))>>2,d=(3&f)<<6|(E=o.indexOf(a.charAt(p++))),C[I++]=l,f!==64&&(C[I++]=h),E!==64&&(C[I++]=d);return C}},{"./support":30,"./utils":32}],2:[function(t,e,i){var n=t("./external"),r=t("./stream/DataWorker"),o=t("./stream/Crc32Probe"),a=t("./stream/DataLengthProbe");function l(h,d,u,f,E){this.compressedSize=h,this.uncompressedSize=d,this.crc32=u,this.compression=f,this.compressedContent=E}l.prototype={getContentWorker:function(){var h=new r(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),d=this;return h.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),h},getCompressedWorker:function(){return new r(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},l.createWorkerFrom=function(h,d,u){return h.pipe(new o).pipe(new a("uncompressedSize")).pipe(d.compressWorker(u)).pipe(new a("compressedSize")).withStreamInfo("compression",d)},e.exports=l},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,e,i){var n=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,e,i){var n=t("./utils"),r=function(){for(var o,a=[],l=0;l<256;l++){o=l;for(var h=0;h<8;h++)o=1&o?3988292384^o>>>1:o>>>1;a[l]=o}return a}();e.exports=function(o,a){return o!==void 0&&o.length?n.getTypeOf(o)!=="string"?function(l,h,d,u){var f=r,E=u+d;l^=-1;for(var p=u;p<E;p++)l=l>>>8^f[255&(l^h[p])];return-1^l}(0|a,o,o.length,0):function(l,h,d,u){var f=r,E=u+d;l^=-1;for(var p=u;p<E;p++)l=l>>>8^f[255&(l^h.charCodeAt(p))];return-1^l}(0|a,o,o.length,0):0}},{"./utils":32}],5:[function(t,e,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,e,i){var n=null;n=typeof Promise<"u"?Promise:t("lie"),e.exports={Promise:n}},{lie:37}],7:[function(t,e,i){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",r=t("pako"),o=t("./utils"),a=t("./stream/GenericWorker"),l=n?"uint8array":"array";function h(d,u){a.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=u,this.meta={}}i.magic="\b\0",o.inherits(h,a),h.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(l,d.data),!1)},h.prototype.flush=function(){a.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new r[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(u){d.push({data:u,meta:d.meta})}},i.compressWorker=function(d){return new h("Deflate",d)},i.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,e,i){function n(f,E){var p,I="";for(p=0;p<E;p++)I+=String.fromCharCode(255&f),f>>>=8;return I}function r(f,E,p,I,m,C){var R,g,y=f.file,w=f.compression,O=C!==l.utf8encode,M=o.transformTo("string",C(y.name)),b=o.transformTo("string",l.utf8encode(y.name)),v=y.comment,k=o.transformTo("string",C(v)),F=o.transformTo("string",l.utf8encode(v)),L=b.length!==y.name.length,_=F.length!==v.length,D="",q="",G="",et=y.dir,W=y.date,nt={crc32:0,compressedSize:0,uncompressedSize:0};E&&!p||(nt.crc32=f.crc32,nt.compressedSize=f.compressedSize,nt.uncompressedSize=f.uncompressedSize);var V=0;E&&(V|=8),O||!L&&!_||(V|=2048);var B=0,rt=0;et&&(B|=16),m==="UNIX"?(rt=798,B|=function(tt,At){var wt=tt;return tt||(wt=At?16893:33204),(65535&wt)<<16}(y.unixPermissions,et)):(rt=20,B|=function(tt){return 63&(tt||0)}(y.dosPermissions)),R=W.getUTCHours(),R<<=6,R|=W.getUTCMinutes(),R<<=5,R|=W.getUTCSeconds()/2,g=W.getUTCFullYear()-1980,g<<=4,g|=W.getUTCMonth()+1,g<<=5,g|=W.getUTCDate(),L&&(q=n(1,1)+n(h(M),4)+b,D+="up"+n(q.length,2)+q),_&&(G=n(1,1)+n(h(k),4)+F,D+="uc"+n(G.length,2)+G);var st="";return st+=`
139
- \0`,st+=n(V,2),st+=w.magic,st+=n(R,2),st+=n(g,2),st+=n(nt.crc32,4),st+=n(nt.compressedSize,4),st+=n(nt.uncompressedSize,4),st+=n(M.length,2),st+=n(D.length,2),{fileRecord:d.LOCAL_FILE_HEADER+st+M+D,dirRecord:d.CENTRAL_FILE_HEADER+n(rt,2)+st+n(k.length,2)+"\0\0\0\0"+n(B,4)+n(I,4)+M+D+k}}var o=t("../utils"),a=t("../stream/GenericWorker"),l=t("../utf8"),h=t("../crc32"),d=t("../signature");function u(f,E,p,I){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=E,this.zipPlatform=p,this.encodeFileName=I,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(u,a),u.prototype.push=function(f){var E=f.meta.percent||0,p=this.entriesCount,I=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,a.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:p?(E+100*(p-I-1))/p:100}}))},u.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var E=this.streamFiles&&!f.file.dir;if(E){var p=r(f,E,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:p.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(f){this.accumulate=!1;var E=this.streamFiles&&!f.file.dir,p=r(f,E,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),E)this.push({data:function(I){return d.DATA_DESCRIPTOR+n(I.crc32,4)+n(I.compressedSize,4)+n(I.uncompressedSize,4)}(f),meta:{percent:100}});else for(this.push({data:p.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var f=this.bytesWritten,E=0;E<this.dirRecords.length;E++)this.push({data:this.dirRecords[E],meta:{percent:100}});var p=this.bytesWritten-f,I=function(m,C,R,g,y){var w=o.transformTo("string",y(g));return d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+n(m,2)+n(m,2)+n(C,4)+n(R,4)+n(w.length,2)+w}(this.dirRecords.length,p,f,this.zipComment,this.encodeFileName);this.push({data:I,meta:{percent:100}})},u.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},u.prototype.registerPrevious=function(f){this._sources.push(f);var E=this;return f.on("data",function(p){E.processChunk(p)}),f.on("end",function(){E.closedSource(E.previous.streamInfo),E._sources.length?E.prepareNextSource():E.end()}),f.on("error",function(p){E.error(p)}),this},u.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},u.prototype.error=function(f){var E=this._sources;if(!a.prototype.error.call(this,f))return!1;for(var p=0;p<E.length;p++)try{E[p].error(f)}catch{}return!0},u.prototype.lock=function(){a.prototype.lock.call(this);for(var f=this._sources,E=0;E<f.length;E++)f[E].lock()},e.exports=u},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,e,i){var n=t("../compressions"),r=t("./ZipFileWorker");i.generateWorker=function(o,a,l){var h=new r(a.streamFiles,l,a.platform,a.encodeFileName),d=0;try{o.forEach(function(u,f){d++;var E=function(C,R){var g=C||R,y=n[g];if(!y)throw new Error(g+" is not a valid compression method !");return y}(f.options.compression,a.compression),p=f.options.compressionOptions||a.compressionOptions||{},I=f.dir,m=f.date;f._compressWorker(E,p).withStreamInfo("file",{name:u,dir:I,date:m,comment:f.comment||"",unixPermissions:f.unixPermissions,dosPermissions:f.dosPermissions}).pipe(h)}),h.entriesCount=d}catch(u){h.error(u)}return h}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,e,i){function n(){if(!(this instanceof n))return new n;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var r=new n;for(var o in this)typeof this[o]!="function"&&(r[o]=this[o]);return r}}(n.prototype=t("./object")).loadAsync=t("./load"),n.support=t("./support"),n.defaults=t("./defaults"),n.version="3.10.1",n.loadAsync=function(r,o){return new n().loadAsync(r,o)},n.external=t("./external"),e.exports=n},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,e,i){var n=t("./utils"),r=t("./external"),o=t("./utf8"),a=t("./zipEntries"),l=t("./stream/Crc32Probe"),h=t("./nodejsUtils");function d(u){return new r.Promise(function(f,E){var p=u.decompressed.getContentWorker().pipe(new l);p.on("error",function(I){E(I)}).on("end",function(){p.streamInfo.crc32!==u.decompressed.crc32?E(new Error("Corrupted zip : CRC32 mismatch")):f()}).resume()})}e.exports=function(u,f){var E=this;return f=n.extend(f||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),h.isNode&&h.isStream(u)?r.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",u,!0,f.optimizedBinaryString,f.base64).then(function(p){var I=new a(f);return I.load(p),I}).then(function(p){var I=[r.Promise.resolve(p)],m=p.files;if(f.checkCRC32)for(var C=0;C<m.length;C++)I.push(d(m[C]));return r.Promise.all(I)}).then(function(p){for(var I=p.shift(),m=I.files,C=0;C<m.length;C++){var R=m[C],g=R.fileNameStr,y=n.resolve(R.fileNameStr);E.file(y,R.decompressed,{binary:!0,optimizedBinaryString:!0,date:R.date,dir:R.dir,comment:R.fileCommentStr.length?R.fileCommentStr:null,unixPermissions:R.unixPermissions,dosPermissions:R.dosPermissions,createFolders:f.createFolders}),R.dir||(E.file(y).unsafeOriginalName=g)}return I.zipComment.length&&(E.comment=I.zipComment),E})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,e,i){var n=t("../utils"),r=t("../stream/GenericWorker");function o(a,l){r.call(this,"Nodejs stream input adapter for "+a),this._upstreamEnded=!1,this._bindStream(l)}n.inherits(o,r),o.prototype._bindStream=function(a){var l=this;(this._stream=a).pause(),a.on("data",function(h){l.push({data:h,meta:{percent:0}})}).on("error",function(h){l.isPaused?this.generatedError=h:l.error(h)}).on("end",function(){l.isPaused?l._upstreamEnded=!0:l.end()})},o.prototype.pause=function(){return!!r.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},e.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,e,i){var n=t("readable-stream").Readable;function r(o,a,l){n.call(this,a),this._helper=o;var h=this;o.on("data",function(d,u){h.push(d)||h._helper.pause(),l&&l(u)}).on("error",function(d){h.emit("error",d)}).on("end",function(){h.push(null)})}t("../utils").inherits(r,n),r.prototype._read=function(){this._helper.resume()},e.exports=r},{"../utils":32,"readable-stream":16}],14:[function(t,e,i){e.exports={isNode:typeof Buffer<"u",newBufferFrom:function(n,r){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(n,r);if(typeof n=="number")throw new Error('The "data" argument must not be a number');return new Buffer(n,r)},allocBuffer:function(n){if(Buffer.alloc)return Buffer.alloc(n);var r=new Buffer(n);return r.fill(0),r},isBuffer:function(n){return Buffer.isBuffer(n)},isStream:function(n){return n&&typeof n.on=="function"&&typeof n.pause=="function"&&typeof n.resume=="function"}}},{}],15:[function(t,e,i){function n(y,w,O){var M,b=o.getTypeOf(w),v=o.extend(O||{},h);v.date=v.date||new Date,v.compression!==null&&(v.compression=v.compression.toUpperCase()),typeof v.unixPermissions=="string"&&(v.unixPermissions=parseInt(v.unixPermissions,8)),v.unixPermissions&&16384&v.unixPermissions&&(v.dir=!0),v.dosPermissions&&16&v.dosPermissions&&(v.dir=!0),v.dir&&(y=m(y)),v.createFolders&&(M=I(y))&&C.call(this,M,!0);var k=b==="string"&&v.binary===!1&&v.base64===!1;O&&O.binary!==void 0||(v.binary=!k),(w instanceof d&&w.uncompressedSize===0||v.dir||!w||w.length===0)&&(v.base64=!1,v.binary=!0,w="",v.compression="STORE",b="string");var F=null;F=w instanceof d||w instanceof a?w:E.isNode&&E.isStream(w)?new p(y,w):o.prepareContent(y,w,v.binary,v.optimizedBinaryString,v.base64);var L=new u(y,F,v);this.files[y]=L}var r=t("./utf8"),o=t("./utils"),a=t("./stream/GenericWorker"),l=t("./stream/StreamHelper"),h=t("./defaults"),d=t("./compressedObject"),u=t("./zipObject"),f=t("./generate"),E=t("./nodejsUtils"),p=t("./nodejs/NodejsStreamInputAdapter"),I=function(y){y.slice(-1)==="/"&&(y=y.substring(0,y.length-1));var w=y.lastIndexOf("/");return 0<w?y.substring(0,w):""},m=function(y){return y.slice(-1)!=="/"&&(y+="/"),y},C=function(y,w){return w=w!==void 0?w:h.createFolders,y=m(y),this.files[y]||n.call(this,y,null,{dir:!0,createFolders:w}),this.files[y]};function R(y){return Object.prototype.toString.call(y)==="[object RegExp]"}var g={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(y){var w,O,M;for(w in this.files)M=this.files[w],(O=w.slice(this.root.length,w.length))&&w.slice(0,this.root.length)===this.root&&y(O,M)},filter:function(y){var w=[];return this.forEach(function(O,M){y(O,M)&&w.push(M)}),w},file:function(y,w,O){if(arguments.length!==1)return y=this.root+y,n.call(this,y,w,O),this;if(R(y)){var M=y;return this.filter(function(v,k){return!k.dir&&M.test(v)})}var b=this.files[this.root+y];return b&&!b.dir?b:null},folder:function(y){if(!y)return this;if(R(y))return this.filter(function(b,v){return v.dir&&y.test(b)});var w=this.root+y,O=C.call(this,w),M=this.clone();return M.root=O.name,M},remove:function(y){y=this.root+y;var w=this.files[y];if(w||(y.slice(-1)!=="/"&&(y+="/"),w=this.files[y]),w&&!w.dir)delete this.files[y];else for(var O=this.filter(function(b,v){return v.name.slice(0,y.length)===y}),M=0;M<O.length;M++)delete this.files[O[M].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(y){var w,O={};try{if((O=o.extend(y||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:r.utf8encode})).type=O.type.toLowerCase(),O.compression=O.compression.toUpperCase(),O.type==="binarystring"&&(O.type="string"),!O.type)throw new Error("No output type specified.");o.checkSupport(O.type),O.platform!=="darwin"&&O.platform!=="freebsd"&&O.platform!=="linux"&&O.platform!=="sunos"||(O.platform="UNIX"),O.platform==="win32"&&(O.platform="DOS");var M=O.comment||this.comment||"";w=f.generateWorker(this,O,M)}catch(b){(w=new a("error")).error(b)}return new l(w,O.type||"string",O.mimeType)},generateAsync:function(y,w){return this.generateInternalStream(y).accumulate(w)},generateNodeStream:function(y,w){return(y=y||{}).type||(y.type="nodebuffer"),this.generateInternalStream(y).toNodejsStream(w)}};e.exports=g},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,e,i){e.exports=t("stream")},{stream:void 0}],17:[function(t,e,i){var n=t("./DataReader");function r(o){n.call(this,o);for(var a=0;a<this.data.length;a++)o[a]=255&o[a]}t("../utils").inherits(r,n),r.prototype.byteAt=function(o){return this.data[this.zero+o]},r.prototype.lastIndexOfSignature=function(o){for(var a=o.charCodeAt(0),l=o.charCodeAt(1),h=o.charCodeAt(2),d=o.charCodeAt(3),u=this.length-4;0<=u;--u)if(this.data[u]===a&&this.data[u+1]===l&&this.data[u+2]===h&&this.data[u+3]===d)return u-this.zero;return-1},r.prototype.readAndCheckSignature=function(o){var a=o.charCodeAt(0),l=o.charCodeAt(1),h=o.charCodeAt(2),d=o.charCodeAt(3),u=this.readData(4);return a===u[0]&&l===u[1]&&h===u[2]&&d===u[3]},r.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},e.exports=r},{"../utils":32,"./DataReader":18}],18:[function(t,e,i){var n=t("../utils");function r(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}r.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var a,l=0;for(this.checkOffset(o),a=this.index+o-1;a>=this.index;a--)l=(l<<8)+this.byteAt(a);return this.index+=o,l},readString:function(o){return n.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},e.exports=r},{"../utils":32}],19:[function(t,e,i){var n=t("./Uint8ArrayReader");function r(o){n.call(this,o)}t("../utils").inherits(r,n),r.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},e.exports=r},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,e,i){var n=t("./DataReader");function r(o){n.call(this,o)}t("../utils").inherits(r,n),r.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},r.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},r.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},r.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},e.exports=r},{"../utils":32,"./DataReader":18}],21:[function(t,e,i){var n=t("./ArrayReader");function r(o){n.call(this,o)}t("../utils").inherits(r,n),r.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var a=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},e.exports=r},{"../utils":32,"./ArrayReader":17}],22:[function(t,e,i){var n=t("../utils"),r=t("../support"),o=t("./ArrayReader"),a=t("./StringReader"),l=t("./NodeBufferReader"),h=t("./Uint8ArrayReader");e.exports=function(d){var u=n.getTypeOf(d);return n.checkSupport(u),u!=="string"||r.uint8array?u==="nodebuffer"?new l(d):r.uint8array?new h(n.transformTo("uint8array",d)):new o(n.transformTo("array",d)):new a(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,e,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,e,i){var n=t("./GenericWorker"),r=t("../utils");function o(a){n.call(this,"ConvertWorker to "+a),this.destType=a}r.inherits(o,n),o.prototype.processChunk=function(a){this.push({data:r.transformTo(this.destType,a.data),meta:a.meta})},e.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,e,i){var n=t("./GenericWorker"),r=t("../crc32");function o(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,n),o.prototype.processChunk=function(a){this.streamInfo.crc32=r(a.data,this.streamInfo.crc32||0),this.push(a)},e.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,e,i){var n=t("../utils"),r=t("./GenericWorker");function o(a){r.call(this,"DataLengthProbe for "+a),this.propName=a,this.withStreamInfo(a,0)}n.inherits(o,r),o.prototype.processChunk=function(a){if(a){var l=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=l+a.data.length}r.prototype.processChunk.call(this,a)},e.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,e,i){var n=t("../utils"),r=t("./GenericWorker");function o(a){r.call(this,"DataWorker");var l=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,a.then(function(h){l.dataIsReady=!0,l.data=h,l.max=h&&h.length||0,l.type=n.getTypeOf(h),l.isPaused||l._tickAndRepeat()},function(h){l.error(h)})}n.inherits(o,r),o.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var a=null,l=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":a=this.data.substring(this.index,l);break;case"uint8array":a=this.data.subarray(this.index,l);break;case"array":case"nodebuffer":a=this.data.slice(this.index,l)}return this.index=l,this.push({data:a,meta:{percent:this.max?this.index/this.max*100:0}})},e.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,e,i){function n(r){this.name=r||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(r){this.emit("data",r)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(r){this.emit("error",r)}return!0},error:function(r){return!this.isFinished&&(this.isPaused?this.generatedError=r:(this.isFinished=!0,this.emit("error",r),this.previous&&this.previous.error(r),this.cleanUp()),!0)},on:function(r,o){return this._listeners[r].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(r,o){if(this._listeners[r])for(var a=0;a<this._listeners[r].length;a++)this._listeners[r][a].call(this,o)},pipe:function(r){return r.registerPrevious(this)},registerPrevious:function(r){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=r.streamInfo,this.mergeStreamInfo(),this.previous=r;var o=this;return r.on("data",function(a){o.processChunk(a)}),r.on("end",function(){o.end()}),r.on("error",function(a){o.error(a)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var r=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),r=!0),this.previous&&this.previous.resume(),!r},flush:function(){},processChunk:function(r){this.push(r)},withStreamInfo:function(r,o){return this.extraStreamInfo[r]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var r in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,r)&&(this.streamInfo[r]=this.extraStreamInfo[r])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var r="Worker "+this.name;return this.previous?this.previous+" -> "+r:r}},e.exports=n},{}],29:[function(t,e,i){var n=t("../utils"),r=t("./ConvertWorker"),o=t("./GenericWorker"),a=t("../base64"),l=t("../support"),h=t("../external"),d=null;if(l.nodestream)try{d=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function u(E,p){return new h.Promise(function(I,m){var C=[],R=E._internalType,g=E._outputType,y=E._mimeType;E.on("data",function(w,O){C.push(w),p&&p(O)}).on("error",function(w){C=[],m(w)}).on("end",function(){try{var w=function(O,M,b){switch(O){case"blob":return n.newBlob(n.transformTo("arraybuffer",M),b);case"base64":return a.encode(M);default:return n.transformTo(O,M)}}(g,function(O,M){var b,v=0,k=null,F=0;for(b=0;b<M.length;b++)F+=M[b].length;switch(O){case"string":return M.join("");case"array":return Array.prototype.concat.apply([],M);case"uint8array":for(k=new Uint8Array(F),b=0;b<M.length;b++)k.set(M[b],v),v+=M[b].length;return k;case"nodebuffer":return Buffer.concat(M);default:throw new Error("concat : unsupported type '"+O+"'")}}(R,C),y);I(w)}catch(O){m(O)}C=[]}).resume()})}function f(E,p,I){var m=p;switch(p){case"blob":case"arraybuffer":m="uint8array";break;case"base64":m="string"}try{this._internalType=m,this._outputType=p,this._mimeType=I,n.checkSupport(m),this._worker=E.pipe(new r(m)),E.lock()}catch(C){this._worker=new o("error"),this._worker.error(C)}}f.prototype={accumulate:function(E){return u(this,E)},on:function(E,p){var I=this;return E==="data"?this._worker.on(E,function(m){p.call(I,m.data,m.meta)}):this._worker.on(E,function(){n.delay(p,arguments,I)}),this},resume:function(){return n.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(E){if(n.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new d(this,{objectMode:this._outputType!=="nodebuffer"},E)}},e.exports=f},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,e,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",i.nodebuffer=typeof Buffer<"u",i.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")i.blob=!1;else{var n=new ArrayBuffer(0);try{i.blob=new Blob([n],{type:"application/zip"}).size===0}catch{try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);r.append(n),i.blob=r.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!t("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(t,e,i){for(var n=t("./utils"),r=t("./support"),o=t("./nodejsUtils"),a=t("./stream/GenericWorker"),l=new Array(256),h=0;h<256;h++)l[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;l[254]=l[254]=1;function d(){a.call(this,"utf-8 decode"),this.leftOver=null}function u(){a.call(this,"utf-8 encode")}i.utf8encode=function(f){return r.nodebuffer?o.newBufferFrom(f,"utf-8"):function(E){var p,I,m,C,R,g=E.length,y=0;for(C=0;C<g;C++)(64512&(I=E.charCodeAt(C)))==55296&&C+1<g&&(64512&(m=E.charCodeAt(C+1)))==56320&&(I=65536+(I-55296<<10)+(m-56320),C++),y+=I<128?1:I<2048?2:I<65536?3:4;for(p=r.uint8array?new Uint8Array(y):new Array(y),C=R=0;R<y;C++)(64512&(I=E.charCodeAt(C)))==55296&&C+1<g&&(64512&(m=E.charCodeAt(C+1)))==56320&&(I=65536+(I-55296<<10)+(m-56320),C++),I<128?p[R++]=I:(I<2048?p[R++]=192|I>>>6:(I<65536?p[R++]=224|I>>>12:(p[R++]=240|I>>>18,p[R++]=128|I>>>12&63),p[R++]=128|I>>>6&63),p[R++]=128|63&I);return p}(f)},i.utf8decode=function(f){return r.nodebuffer?n.transformTo("nodebuffer",f).toString("utf-8"):function(E){var p,I,m,C,R=E.length,g=new Array(2*R);for(p=I=0;p<R;)if((m=E[p++])<128)g[I++]=m;else if(4<(C=l[m]))g[I++]=65533,p+=C-1;else{for(m&=C===2?31:C===3?15:7;1<C&&p<R;)m=m<<6|63&E[p++],C--;1<C?g[I++]=65533:m<65536?g[I++]=m:(m-=65536,g[I++]=55296|m>>10&1023,g[I++]=56320|1023&m)}return g.length!==I&&(g.subarray?g=g.subarray(0,I):g.length=I),n.applyFromCharCode(g)}(f=n.transformTo(r.uint8array?"uint8array":"array",f))},n.inherits(d,a),d.prototype.processChunk=function(f){var E=n.transformTo(r.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(r.uint8array){var p=E;(E=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),E.set(p,this.leftOver.length)}else E=this.leftOver.concat(E);this.leftOver=null}var I=function(C,R){var g;for((R=R||C.length)>C.length&&(R=C.length),g=R-1;0<=g&&(192&C[g])==128;)g--;return g<0||g===0?R:g+l[C[g]]>R?g:R}(E),m=E;I!==E.length&&(r.uint8array?(m=E.subarray(0,I),this.leftOver=E.subarray(I,E.length)):(m=E.slice(0,I),this.leftOver=E.slice(I,E.length))),this.push({data:i.utf8decode(m),meta:f.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=d,n.inherits(u,a),u.prototype.processChunk=function(f){this.push({data:i.utf8encode(f.data),meta:f.meta})},i.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,e,i){var n=t("./support"),r=t("./base64"),o=t("./nodejsUtils"),a=t("./external");function l(p){return p}function h(p,I){for(var m=0;m<p.length;++m)I[m]=255&p.charCodeAt(m);return I}t("setimmediate"),i.newBlob=function(p,I){i.checkSupport("blob");try{return new Blob([p],{type:I})}catch{try{var m=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return m.append(p),m.getBlob(I)}catch{throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(p,I,m){var C=[],R=0,g=p.length;if(g<=m)return String.fromCharCode.apply(null,p);for(;R<g;)I==="array"||I==="nodebuffer"?C.push(String.fromCharCode.apply(null,p.slice(R,Math.min(R+m,g)))):C.push(String.fromCharCode.apply(null,p.subarray(R,Math.min(R+m,g)))),R+=m;return C.join("")},stringifyByChar:function(p){for(var I="",m=0;m<p.length;m++)I+=String.fromCharCode(p[m]);return I},applyCanBeUsed:{uint8array:function(){try{return n.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return n.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch{return!1}}()}};function u(p){var I=65536,m=i.getTypeOf(p),C=!0;if(m==="uint8array"?C=d.applyCanBeUsed.uint8array:m==="nodebuffer"&&(C=d.applyCanBeUsed.nodebuffer),C)for(;1<I;)try{return d.stringifyByChunk(p,m,I)}catch{I=Math.floor(I/2)}return d.stringifyByChar(p)}function f(p,I){for(var m=0;m<p.length;m++)I[m]=p[m];return I}i.applyFromCharCode=u;var E={};E.string={string:l,array:function(p){return h(p,new Array(p.length))},arraybuffer:function(p){return E.string.uint8array(p).buffer},uint8array:function(p){return h(p,new Uint8Array(p.length))},nodebuffer:function(p){return h(p,o.allocBuffer(p.length))}},E.array={string:u,array:l,arraybuffer:function(p){return new Uint8Array(p).buffer},uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return o.newBufferFrom(p)}},E.arraybuffer={string:function(p){return u(new Uint8Array(p))},array:function(p){return f(new Uint8Array(p),new Array(p.byteLength))},arraybuffer:l,uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return o.newBufferFrom(new Uint8Array(p))}},E.uint8array={string:u,array:function(p){return f(p,new Array(p.length))},arraybuffer:function(p){return p.buffer},uint8array:l,nodebuffer:function(p){return o.newBufferFrom(p)}},E.nodebuffer={string:u,array:function(p){return f(p,new Array(p.length))},arraybuffer:function(p){return E.nodebuffer.uint8array(p).buffer},uint8array:function(p){return f(p,new Uint8Array(p.length))},nodebuffer:l},i.transformTo=function(p,I){if(I=I||"",!p)return I;i.checkSupport(p);var m=i.getTypeOf(I);return E[m][p](I)},i.resolve=function(p){for(var I=p.split("/"),m=[],C=0;C<I.length;C++){var R=I[C];R==="."||R===""&&C!==0&&C!==I.length-1||(R===".."?m.pop():m.push(R))}return m.join("/")},i.getTypeOf=function(p){return typeof p=="string"?"string":Object.prototype.toString.call(p)==="[object Array]"?"array":n.nodebuffer&&o.isBuffer(p)?"nodebuffer":n.uint8array&&p instanceof Uint8Array?"uint8array":n.arraybuffer&&p instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(p){if(!n[p.toLowerCase()])throw new Error(p+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(p){var I,m,C="";for(m=0;m<(p||"").length;m++)C+="\\x"+((I=p.charCodeAt(m))<16?"0":"")+I.toString(16).toUpperCase();return C},i.delay=function(p,I,m){setImmediate(function(){p.apply(m||null,I||[])})},i.inherits=function(p,I){function m(){}m.prototype=I.prototype,p.prototype=new m},i.extend=function(){var p,I,m={};for(p=0;p<arguments.length;p++)for(I in arguments[p])Object.prototype.hasOwnProperty.call(arguments[p],I)&&m[I]===void 0&&(m[I]=arguments[p][I]);return m},i.prepareContent=function(p,I,m,C,R){return a.Promise.resolve(I).then(function(g){return n.blob&&(g instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(g))!==-1)&&typeof FileReader<"u"?new a.Promise(function(y,w){var O=new FileReader;O.onload=function(M){y(M.target.result)},O.onerror=function(M){w(M.target.error)},O.readAsArrayBuffer(g)}):g}).then(function(g){var y=i.getTypeOf(g);return y?(y==="arraybuffer"?g=i.transformTo("uint8array",g):y==="string"&&(R?g=r.decode(g):m&&C!==!0&&(g=function(w){return h(w,n.uint8array?new Uint8Array(w.length):new Array(w.length))}(g))),g):a.Promise.reject(new Error("Can't read the data of '"+p+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,e,i){var n=t("./reader/readerFor"),r=t("./utils"),o=t("./signature"),a=t("./zipEntry"),l=t("./support");function h(d){this.files=[],this.loadOptions=d}h.prototype={checkSignature:function(d){if(!this.reader.readAndCheckSignature(d)){this.reader.index-=4;var u=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+r.pretty(u)+", expected "+r.pretty(d)+")")}},isSignature:function(d,u){var f=this.reader.index;this.reader.setIndex(d);var E=this.reader.readString(4)===u;return this.reader.setIndex(f),E},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var d=this.reader.readData(this.zipCommentLength),u=l.uint8array?"uint8array":"array",f=r.transformTo(u,d);this.zipComment=this.loadOptions.decodeFileName(f)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var d,u,f,E=this.zip64EndOfCentralSize-44;0<E;)d=this.reader.readInt(2),u=this.reader.readInt(4),f=this.reader.readData(u),this.zip64ExtensibleData[d]={id:d,length:u,value:f}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var d,u;for(d=0;d<this.files.length;d++)u=this.files[d],this.reader.setIndex(u.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),u.readLocalPart(this.reader),u.handleUTF8(),u.processAttributes()},readCentralDir:function(){var d;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(d=new a({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(d);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var d=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(d<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(d);var u=d;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===r.MAX_VALUE_16BITS||this.diskWithCentralDirStart===r.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===r.MAX_VALUE_16BITS||this.centralDirRecords===r.MAX_VALUE_16BITS||this.centralDirSize===r.MAX_VALUE_32BITS||this.centralDirOffset===r.MAX_VALUE_32BITS){if(this.zip64=!0,(d=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(d),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var f=this.centralDirOffset+this.centralDirSize;this.zip64&&(f+=20,f+=12+this.zip64EndOfCentralSize);var E=u-f;if(0<E)this.isSignature(u,o.CENTRAL_FILE_HEADER)||(this.reader.zero=E);else if(E<0)throw new Error("Corrupted zip: missing "+Math.abs(E)+" bytes.")},prepareReader:function(d){this.reader=n(d)},load:function(d){this.prepareReader(d),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},e.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,e,i){var n=t("./reader/readerFor"),r=t("./utils"),o=t("./compressedObject"),a=t("./crc32"),l=t("./utf8"),h=t("./compressions"),d=t("./support");function u(f,E){this.options=f,this.loadOptions=E}u.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(f){var E,p;if(f.skip(22),this.fileNameLength=f.readInt(2),p=f.readInt(2),this.fileName=f.readData(this.fileNameLength),f.skip(p),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((E=function(I){for(var m in h)if(Object.prototype.hasOwnProperty.call(h,m)&&h[m].magic===I)return h[m];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+r.pretty(this.compressionMethod)+" unknown (inner file : "+r.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,E,f.readData(this.compressedSize))},readCentralPart:function(f){this.versionMadeBy=f.readInt(2),f.skip(2),this.bitFlag=f.readInt(2),this.compressionMethod=f.readString(2),this.date=f.readDate(),this.crc32=f.readInt(4),this.compressedSize=f.readInt(4),this.uncompressedSize=f.readInt(4);var E=f.readInt(2);if(this.extraFieldsLength=f.readInt(2),this.fileCommentLength=f.readInt(2),this.diskNumberStart=f.readInt(2),this.internalFileAttributes=f.readInt(2),this.externalFileAttributes=f.readInt(4),this.localHeaderOffset=f.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");f.skip(E),this.readExtraFields(f),this.parseZIP64ExtraField(f),this.fileComment=f.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var f=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=n(this.extraFields[1].value);this.uncompressedSize===r.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var E,p,I,m=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4<m;)E=f.readInt(2),p=f.readInt(2),I=f.readData(p),this.extraFields[E]={id:E,length:p,value:I};f.setIndex(m)},handleUTF8:function(){var f=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=l.utf8decode(this.fileName),this.fileCommentStr=l.utf8decode(this.fileComment);else{var E=this.findExtraFieldUnicodePath();if(E!==null)this.fileNameStr=E;else{var p=r.transformTo(f,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(p)}var I=this.findExtraFieldUnicodeComment();if(I!==null)this.fileCommentStr=I;else{var m=r.transformTo(f,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(m)}}},findExtraFieldUnicodePath:function(){var f=this.extraFields[28789];if(f){var E=n(f.value);return E.readInt(1)!==1||a(this.fileName)!==E.readInt(4)?null:l.utf8decode(E.readData(f.length-5))}return null},findExtraFieldUnicodeComment:function(){var f=this.extraFields[25461];if(f){var E=n(f.value);return E.readInt(1)!==1||a(this.fileComment)!==E.readInt(4)?null:l.utf8decode(E.readData(f.length-5))}return null}},e.exports=u},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,e,i){function n(E,p,I){this.name=E,this.dir=I.dir,this.date=I.date,this.comment=I.comment,this.unixPermissions=I.unixPermissions,this.dosPermissions=I.dosPermissions,this._data=p,this._dataBinary=I.binary,this.options={compression:I.compression,compressionOptions:I.compressionOptions}}var r=t("./stream/StreamHelper"),o=t("./stream/DataWorker"),a=t("./utf8"),l=t("./compressedObject"),h=t("./stream/GenericWorker");n.prototype={internalStream:function(E){var p=null,I="string";try{if(!E)throw new Error("No output type specified.");var m=(I=E.toLowerCase())==="string"||I==="text";I!=="binarystring"&&I!=="text"||(I="string"),p=this._decompressWorker();var C=!this._dataBinary;C&&!m&&(p=p.pipe(new a.Utf8EncodeWorker)),!C&&m&&(p=p.pipe(new a.Utf8DecodeWorker))}catch(R){(p=new h("error")).error(R)}return new r(p,I,"")},async:function(E,p){return this.internalStream(E).accumulate(p)},nodeStream:function(E,p){return this.internalStream(E||"nodebuffer").toNodejsStream(p)},_compressWorker:function(E,p){if(this._data instanceof l&&this._data.compression.magic===E.magic)return this._data.getCompressedWorker();var I=this._decompressWorker();return this._dataBinary||(I=I.pipe(new a.Utf8EncodeWorker)),l.createWorkerFrom(I,E,p)},_decompressWorker:function(){return this._data instanceof l?this._data.getContentWorker():this._data instanceof h?this._data:new o(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],u=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<d.length;f++)n.prototype[d[f]]=u;e.exports=n},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,e,i){(function(n){var r,o,a=n.MutationObserver||n.WebKitMutationObserver;if(a){var l=0,h=new a(E),d=n.document.createTextNode("");h.observe(d,{characterData:!0}),r=function(){d.data=l=++l%2}}else if(n.setImmediate||n.MessageChannel===void 0)r="document"in n&&"onreadystatechange"in n.document.createElement("script")?function(){var p=n.document.createElement("script");p.onreadystatechange=function(){E(),p.onreadystatechange=null,p.parentNode.removeChild(p),p=null},n.document.documentElement.appendChild(p)}:function(){setTimeout(E,0)};else{var u=new n.MessageChannel;u.port1.onmessage=E,r=function(){u.port2.postMessage(0)}}var f=[];function E(){var p,I;o=!0;for(var m=f.length;m;){for(I=f,f=[],p=-1;++p<m;)I[p]();m=f.length}o=!1}e.exports=function(p){f.push(p)!==1||o||r()}}).call(this,typeof Zs<"u"?Zs:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,e,i){var n=t("immediate");function r(){}var o={},a=["REJECTED"],l=["FULFILLED"],h=["PENDING"];function d(m){if(typeof m!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,m!==r&&p(this,m)}function u(m,C,R){this.promise=m,typeof C=="function"&&(this.onFulfilled=C,this.callFulfilled=this.otherCallFulfilled),typeof R=="function"&&(this.onRejected=R,this.callRejected=this.otherCallRejected)}function f(m,C,R){n(function(){var g;try{g=C(R)}catch(y){return o.reject(m,y)}g===m?o.reject(m,new TypeError("Cannot resolve promise with itself")):o.resolve(m,g)})}function E(m){var C=m&&m.then;if(m&&(typeof m=="object"||typeof m=="function")&&typeof C=="function")return function(){C.apply(m,arguments)}}function p(m,C){var R=!1;function g(O){R||(R=!0,o.reject(m,O))}function y(O){R||(R=!0,o.resolve(m,O))}var w=I(function(){C(y,g)});w.status==="error"&&g(w.value)}function I(m,C){var R={};try{R.value=m(C),R.status="success"}catch(g){R.status="error",R.value=g}return R}(e.exports=d).prototype.finally=function(m){if(typeof m!="function")return this;var C=this.constructor;return this.then(function(R){return C.resolve(m()).then(function(){return R})},function(R){return C.resolve(m()).then(function(){throw R})})},d.prototype.catch=function(m){return this.then(null,m)},d.prototype.then=function(m,C){if(typeof m!="function"&&this.state===l||typeof C!="function"&&this.state===a)return this;var R=new this.constructor(r);return this.state!==h?f(R,this.state===l?m:C,this.outcome):this.queue.push(new u(R,m,C)),R},u.prototype.callFulfilled=function(m){o.resolve(this.promise,m)},u.prototype.otherCallFulfilled=function(m){f(this.promise,this.onFulfilled,m)},u.prototype.callRejected=function(m){o.reject(this.promise,m)},u.prototype.otherCallRejected=function(m){f(this.promise,this.onRejected,m)},o.resolve=function(m,C){var R=I(E,C);if(R.status==="error")return o.reject(m,R.value);var g=R.value;if(g)p(m,g);else{m.state=l,m.outcome=C;for(var y=-1,w=m.queue.length;++y<w;)m.queue[y].callFulfilled(C)}return m},o.reject=function(m,C){m.state=a,m.outcome=C;for(var R=-1,g=m.queue.length;++R<g;)m.queue[R].callRejected(C);return m},d.resolve=function(m){return m instanceof this?m:o.resolve(new this(r),m)},d.reject=function(m){var C=new this(r);return o.reject(C,m)},d.all=function(m){var C=this;if(Object.prototype.toString.call(m)!=="[object Array]")return this.reject(new TypeError("must be an array"));var R=m.length,g=!1;if(!R)return this.resolve([]);for(var y=new Array(R),w=0,O=-1,M=new this(r);++O<R;)b(m[O],O);return M;function b(v,k){C.resolve(v).then(function(F){y[k]=F,++w!==R||g||(g=!0,o.resolve(M,y))},function(F){g||(g=!0,o.reject(M,F))})}},d.race=function(m){var C=this;if(Object.prototype.toString.call(m)!=="[object Array]")return this.reject(new TypeError("must be an array"));var R=m.length,g=!1;if(!R)return this.resolve([]);for(var y=-1,w=new this(r);++y<R;)O=m[y],C.resolve(O).then(function(M){g||(g=!0,o.resolve(w,M))},function(M){g||(g=!0,o.reject(w,M))});var O;return w}},{immediate:36}],38:[function(t,e,i){var n={};(0,t("./lib/utils/common").assign)(n,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),e.exports=n},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,e,i){var n=t("./zlib/deflate"),r=t("./utils/common"),o=t("./utils/strings"),a=t("./zlib/messages"),l=t("./zlib/zstream"),h=Object.prototype.toString,d=0,u=-1,f=0,E=8;function p(m){if(!(this instanceof p))return new p(m);this.options=r.assign({level:u,method:E,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,to:""},m||{});var C=this.options;C.raw&&0<C.windowBits?C.windowBits=-C.windowBits:C.gzip&&0<C.windowBits&&C.windowBits<16&&(C.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var R=n.deflateInit2(this.strm,C.level,C.method,C.windowBits,C.memLevel,C.strategy);if(R!==d)throw new Error(a[R]);if(C.header&&n.deflateSetHeader(this.strm,C.header),C.dictionary){var g;if(g=typeof C.dictionary=="string"?o.string2buf(C.dictionary):h.call(C.dictionary)==="[object ArrayBuffer]"?new Uint8Array(C.dictionary):C.dictionary,(R=n.deflateSetDictionary(this.strm,g))!==d)throw new Error(a[R]);this._dict_set=!0}}function I(m,C){var R=new p(C);if(R.push(m,!0),R.err)throw R.msg||a[R.err];return R.result}p.prototype.push=function(m,C){var R,g,y=this.strm,w=this.options.chunkSize;if(this.ended)return!1;g=C===~~C?C:C===!0?4:0,typeof m=="string"?y.input=o.string2buf(m):h.call(m)==="[object ArrayBuffer]"?y.input=new Uint8Array(m):y.input=m,y.next_in=0,y.avail_in=y.input.length;do{if(y.avail_out===0&&(y.output=new r.Buf8(w),y.next_out=0,y.avail_out=w),(R=n.deflate(y,g))!==1&&R!==d)return this.onEnd(R),!(this.ended=!0);y.avail_out!==0&&(y.avail_in!==0||g!==4&&g!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(r.shrinkBuf(y.output,y.next_out))):this.onData(r.shrinkBuf(y.output,y.next_out)))}while((0<y.avail_in||y.avail_out===0)&&R!==1);return g===4?(R=n.deflateEnd(this.strm),this.onEnd(R),this.ended=!0,R===d):g!==2||(this.onEnd(d),!(y.avail_out=0))},p.prototype.onData=function(m){this.chunks.push(m)},p.prototype.onEnd=function(m){m===d&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},i.Deflate=p,i.deflate=I,i.deflateRaw=function(m,C){return(C=C||{}).raw=!0,I(m,C)},i.gzip=function(m,C){return(C=C||{}).gzip=!0,I(m,C)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,e,i){var n=t("./zlib/inflate"),r=t("./utils/common"),o=t("./utils/strings"),a=t("./zlib/constants"),l=t("./zlib/messages"),h=t("./zlib/zstream"),d=t("./zlib/gzheader"),u=Object.prototype.toString;function f(p){if(!(this instanceof f))return new f(p);this.options=r.assign({chunkSize:16384,windowBits:0,to:""},p||{});var I=this.options;I.raw&&0<=I.windowBits&&I.windowBits<16&&(I.windowBits=-I.windowBits,I.windowBits===0&&(I.windowBits=-15)),!(0<=I.windowBits&&I.windowBits<16)||p&&p.windowBits||(I.windowBits+=32),15<I.windowBits&&I.windowBits<48&&!(15&I.windowBits)&&(I.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var m=n.inflateInit2(this.strm,I.windowBits);if(m!==a.Z_OK)throw new Error(l[m]);this.header=new d,n.inflateGetHeader(this.strm,this.header)}function E(p,I){var m=new f(I);if(m.push(p,!0),m.err)throw m.msg||l[m.err];return m.result}f.prototype.push=function(p,I){var m,C,R,g,y,w,O=this.strm,M=this.options.chunkSize,b=this.options.dictionary,v=!1;if(this.ended)return!1;C=I===~~I?I:I===!0?a.Z_FINISH:a.Z_NO_FLUSH,typeof p=="string"?O.input=o.binstring2buf(p):u.call(p)==="[object ArrayBuffer]"?O.input=new Uint8Array(p):O.input=p,O.next_in=0,O.avail_in=O.input.length;do{if(O.avail_out===0&&(O.output=new r.Buf8(M),O.next_out=0,O.avail_out=M),(m=n.inflate(O,a.Z_NO_FLUSH))===a.Z_NEED_DICT&&b&&(w=typeof b=="string"?o.string2buf(b):u.call(b)==="[object ArrayBuffer]"?new Uint8Array(b):b,m=n.inflateSetDictionary(this.strm,w)),m===a.Z_BUF_ERROR&&v===!0&&(m=a.Z_OK,v=!1),m!==a.Z_STREAM_END&&m!==a.Z_OK)return this.onEnd(m),!(this.ended=!0);O.next_out&&(O.avail_out!==0&&m!==a.Z_STREAM_END&&(O.avail_in!==0||C!==a.Z_FINISH&&C!==a.Z_SYNC_FLUSH)||(this.options.to==="string"?(R=o.utf8border(O.output,O.next_out),g=O.next_out-R,y=o.buf2string(O.output,R),O.next_out=g,O.avail_out=M-g,g&&r.arraySet(O.output,O.output,R,g,0),this.onData(y)):this.onData(r.shrinkBuf(O.output,O.next_out)))),O.avail_in===0&&O.avail_out===0&&(v=!0)}while((0<O.avail_in||O.avail_out===0)&&m!==a.Z_STREAM_END);return m===a.Z_STREAM_END&&(C=a.Z_FINISH),C===a.Z_FINISH?(m=n.inflateEnd(this.strm),this.onEnd(m),this.ended=!0,m===a.Z_OK):C!==a.Z_SYNC_FLUSH||(this.onEnd(a.Z_OK),!(O.avail_out=0))},f.prototype.onData=function(p){this.chunks.push(p)},f.prototype.onEnd=function(p){p===a.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=p,this.msg=this.strm.msg},i.Inflate=f,i.inflate=E,i.inflateRaw=function(p,I){return(I=I||{}).raw=!0,E(p,I)},i.ungzip=E},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,e,i){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";i.assign=function(a){for(var l=Array.prototype.slice.call(arguments,1);l.length;){var h=l.shift();if(h){if(typeof h!="object")throw new TypeError(h+"must be non-object");for(var d in h)h.hasOwnProperty(d)&&(a[d]=h[d])}}return a},i.shrinkBuf=function(a,l){return a.length===l?a:a.subarray?a.subarray(0,l):(a.length=l,a)};var r={arraySet:function(a,l,h,d,u){if(l.subarray&&a.subarray)a.set(l.subarray(h,h+d),u);else for(var f=0;f<d;f++)a[u+f]=l[h+f]},flattenChunks:function(a){var l,h,d,u,f,E;for(l=d=0,h=a.length;l<h;l++)d+=a[l].length;for(E=new Uint8Array(d),l=u=0,h=a.length;l<h;l++)f=a[l],E.set(f,u),u+=f.length;return E}},o={arraySet:function(a,l,h,d,u){for(var f=0;f<d;f++)a[u+f]=l[h+f]},flattenChunks:function(a){return[].concat.apply([],a)}};i.setTyped=function(a){a?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,r)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,o))},i.setTyped(n)},{}],42:[function(t,e,i){var n=t("./common"),r=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{r=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var a=new n.Buf8(256),l=0;l<256;l++)a[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function h(d,u){if(u<65537&&(d.subarray&&o||!d.subarray&&r))return String.fromCharCode.apply(null,n.shrinkBuf(d,u));for(var f="",E=0;E<u;E++)f+=String.fromCharCode(d[E]);return f}a[254]=a[254]=1,i.string2buf=function(d){var u,f,E,p,I,m=d.length,C=0;for(p=0;p<m;p++)(64512&(f=d.charCodeAt(p)))==55296&&p+1<m&&(64512&(E=d.charCodeAt(p+1)))==56320&&(f=65536+(f-55296<<10)+(E-56320),p++),C+=f<128?1:f<2048?2:f<65536?3:4;for(u=new n.Buf8(C),p=I=0;I<C;p++)(64512&(f=d.charCodeAt(p)))==55296&&p+1<m&&(64512&(E=d.charCodeAt(p+1)))==56320&&(f=65536+(f-55296<<10)+(E-56320),p++),f<128?u[I++]=f:(f<2048?u[I++]=192|f>>>6:(f<65536?u[I++]=224|f>>>12:(u[I++]=240|f>>>18,u[I++]=128|f>>>12&63),u[I++]=128|f>>>6&63),u[I++]=128|63&f);return u},i.buf2binstring=function(d){return h(d,d.length)},i.binstring2buf=function(d){for(var u=new n.Buf8(d.length),f=0,E=u.length;f<E;f++)u[f]=d.charCodeAt(f);return u},i.buf2string=function(d,u){var f,E,p,I,m=u||d.length,C=new Array(2*m);for(f=E=0;f<m;)if((p=d[f++])<128)C[E++]=p;else if(4<(I=a[p]))C[E++]=65533,f+=I-1;else{for(p&=I===2?31:I===3?15:7;1<I&&f<m;)p=p<<6|63&d[f++],I--;1<I?C[E++]=65533:p<65536?C[E++]=p:(p-=65536,C[E++]=55296|p>>10&1023,C[E++]=56320|1023&p)}return h(C,E)},i.utf8border=function(d,u){var f;for((u=u||d.length)>d.length&&(u=d.length),f=u-1;0<=f&&(192&d[f])==128;)f--;return f<0||f===0?u:f+a[d[f]]>u?f:u}},{"./common":41}],43:[function(t,e,i){e.exports=function(n,r,o,a){for(var l=65535&n|0,h=n>>>16&65535|0,d=0;o!==0;){for(o-=d=2e3<o?2e3:o;h=h+(l=l+r[a++]|0)|0,--d;);l%=65521,h%=65521}return l|h<<16|0}},{}],44:[function(t,e,i){e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(t,e,i){var n=function(){for(var r,o=[],a=0;a<256;a++){r=a;for(var l=0;l<8;l++)r=1&r?3988292384^r>>>1:r>>>1;o[a]=r}return o}();e.exports=function(r,o,a,l){var h=n,d=l+a;r^=-1;for(var u=l;u<d;u++)r=r>>>8^h[255&(r^o[u])];return-1^r}},{}],46:[function(t,e,i){var n,r=t("../utils/common"),o=t("./trees"),a=t("./adler32"),l=t("./crc32"),h=t("./messages"),d=0,u=4,f=0,E=-2,p=-1,I=4,m=2,C=8,R=9,g=286,y=30,w=19,O=2*g+1,M=15,b=3,v=258,k=v+b+1,F=42,L=113,_=1,D=2,q=3,G=4;function et(A,X){return A.msg=h[X],X}function W(A){return(A<<1)-(4<A?9:0)}function nt(A){for(var X=A.length;0<=--X;)A[X]=0}function V(A){var X=A.state,Y=X.pending;Y>A.avail_out&&(Y=A.avail_out),Y!==0&&(r.arraySet(A.output,X.pending_buf,X.pending_out,Y,A.next_out),A.next_out+=Y,X.pending_out+=Y,A.total_out+=Y,A.avail_out-=Y,X.pending-=Y,X.pending===0&&(X.pending_out=0))}function B(A,X){o._tr_flush_block(A,0<=A.block_start?A.block_start:-1,A.strstart-A.block_start,X),A.block_start=A.strstart,V(A.strm)}function rt(A,X){A.pending_buf[A.pending++]=X}function st(A,X){A.pending_buf[A.pending++]=X>>>8&255,A.pending_buf[A.pending++]=255&X}function tt(A,X){var Y,P,N=A.max_chain_length,U=A.strstart,$=A.prev_length,j=A.nice_match,z=A.strstart>A.w_size-k?A.strstart-(A.w_size-k):0,K=A.window,it=A.w_mask,J=A.prev,at=A.strstart+v,Ct=K[U+$-1],ft=K[U+$];A.prev_length>=A.good_match&&(N>>=2),j>A.lookahead&&(j=A.lookahead);do if(K[(Y=X)+$]===ft&&K[Y+$-1]===Ct&&K[Y]===K[U]&&K[++Y]===K[U+1]){U+=2,Y++;do;while(K[++U]===K[++Y]&&K[++U]===K[++Y]&&K[++U]===K[++Y]&&K[++U]===K[++Y]&&K[++U]===K[++Y]&&K[++U]===K[++Y]&&K[++U]===K[++Y]&&K[++U]===K[++Y]&&U<at);if(P=v-(at-U),U=at-v,$<P){if(A.match_start=X,j<=($=P))break;Ct=K[U+$-1],ft=K[U+$]}}while((X=J[X&it])>z&&--N!=0);return $<=A.lookahead?$:A.lookahead}function At(A){var X,Y,P,N,U,$,j,z,K,it,J=A.w_size;do{if(N=A.window_size-A.lookahead-A.strstart,A.strstart>=J+(J-k)){for(r.arraySet(A.window,A.window,J,J,0),A.match_start-=J,A.strstart-=J,A.block_start-=J,X=Y=A.hash_size;P=A.head[--X],A.head[X]=J<=P?P-J:0,--Y;);for(X=Y=J;P=A.prev[--X],A.prev[X]=J<=P?P-J:0,--Y;);N+=J}if(A.strm.avail_in===0)break;if($=A.strm,j=A.window,z=A.strstart+A.lookahead,K=N,it=void 0,it=$.avail_in,K<it&&(it=K),Y=it===0?0:($.avail_in-=it,r.arraySet(j,$.input,$.next_in,it,z),$.state.wrap===1?$.adler=a($.adler,j,it,z):$.state.wrap===2&&($.adler=l($.adler,j,it,z)),$.next_in+=it,$.total_in+=it,it),A.lookahead+=Y,A.lookahead+A.insert>=b)for(U=A.strstart-A.insert,A.ins_h=A.window[U],A.ins_h=(A.ins_h<<A.hash_shift^A.window[U+1])&A.hash_mask;A.insert&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[U+b-1])&A.hash_mask,A.prev[U&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=U,U++,A.insert--,!(A.lookahead+A.insert<b)););}while(A.lookahead<k&&A.strm.avail_in!==0)}function wt(A,X){for(var Y,P;;){if(A.lookahead<k){if(At(A),A.lookahead<k&&X===d)return _;if(A.lookahead===0)break}if(Y=0,A.lookahead>=b&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+b-1])&A.hash_mask,Y=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),Y!==0&&A.strstart-Y<=A.w_size-k&&(A.match_length=tt(A,Y)),A.match_length>=b)if(P=o._tr_tally(A,A.strstart-A.match_start,A.match_length-b),A.lookahead-=A.match_length,A.match_length<=A.max_lazy_match&&A.lookahead>=b){for(A.match_length--;A.strstart++,A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+b-1])&A.hash_mask,Y=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart,--A.match_length!=0;);A.strstart++}else A.strstart+=A.match_length,A.match_length=0,A.ins_h=A.window[A.strstart],A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+1])&A.hash_mask;else P=o._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if(P&&(B(A,!1),A.strm.avail_out===0))return _}return A.insert=A.strstart<b-1?A.strstart:b-1,X===u?(B(A,!0),A.strm.avail_out===0?q:G):A.last_lit&&(B(A,!1),A.strm.avail_out===0)?_:D}function ot(A,X){for(var Y,P,N;;){if(A.lookahead<k){if(At(A),A.lookahead<k&&X===d)return _;if(A.lookahead===0)break}if(Y=0,A.lookahead>=b&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+b-1])&A.hash_mask,Y=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),A.prev_length=A.match_length,A.prev_match=A.match_start,A.match_length=b-1,Y!==0&&A.prev_length<A.max_lazy_match&&A.strstart-Y<=A.w_size-k&&(A.match_length=tt(A,Y),A.match_length<=5&&(A.strategy===1||A.match_length===b&&4096<A.strstart-A.match_start)&&(A.match_length=b-1)),A.prev_length>=b&&A.match_length<=A.prev_length){for(N=A.strstart+A.lookahead-b,P=o._tr_tally(A,A.strstart-1-A.prev_match,A.prev_length-b),A.lookahead-=A.prev_length-1,A.prev_length-=2;++A.strstart<=N&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+b-1])&A.hash_mask,Y=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),--A.prev_length!=0;);if(A.match_available=0,A.match_length=b-1,A.strstart++,P&&(B(A,!1),A.strm.avail_out===0))return _}else if(A.match_available){if((P=o._tr_tally(A,0,A.window[A.strstart-1]))&&B(A,!1),A.strstart++,A.lookahead--,A.strm.avail_out===0)return _}else A.match_available=1,A.strstart++,A.lookahead--}return A.match_available&&(P=o._tr_tally(A,0,A.window[A.strstart-1]),A.match_available=0),A.insert=A.strstart<b-1?A.strstart:b-1,X===u?(B(A,!0),A.strm.avail_out===0?q:G):A.last_lit&&(B(A,!1),A.strm.avail_out===0)?_:D}function ut(A,X,Y,P,N){this.good_length=A,this.max_lazy=X,this.nice_length=Y,this.max_chain=P,this.func=N}function dt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=C,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new r.Buf16(2*O),this.dyn_dtree=new r.Buf16(2*(2*y+1)),this.bl_tree=new r.Buf16(2*(2*w+1)),nt(this.dyn_ltree),nt(this.dyn_dtree),nt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new r.Buf16(M+1),this.heap=new r.Buf16(2*g+1),nt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new r.Buf16(2*g+1),nt(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function mt(A){var X;return A&&A.state?(A.total_in=A.total_out=0,A.data_type=m,(X=A.state).pending=0,X.pending_out=0,X.wrap<0&&(X.wrap=-X.wrap),X.status=X.wrap?F:L,A.adler=X.wrap===2?0:1,X.last_flush=d,o._tr_init(X),f):et(A,E)}function Vt(A){var X=mt(A);return X===f&&function(Y){Y.window_size=2*Y.w_size,nt(Y.head),Y.max_lazy_match=n[Y.level].max_lazy,Y.good_match=n[Y.level].good_length,Y.nice_match=n[Y.level].nice_length,Y.max_chain_length=n[Y.level].max_chain,Y.strstart=0,Y.block_start=0,Y.lookahead=0,Y.insert=0,Y.match_length=Y.prev_length=b-1,Y.match_available=0,Y.ins_h=0}(A.state),X}function Lt(A,X,Y,P,N,U){if(!A)return E;var $=1;if(X===p&&(X=6),P<0?($=0,P=-P):15<P&&($=2,P-=16),N<1||R<N||Y!==C||P<8||15<P||X<0||9<X||U<0||I<U)return et(A,E);P===8&&(P=9);var j=new dt;return(A.state=j).strm=A,j.wrap=$,j.gzhead=null,j.w_bits=P,j.w_size=1<<j.w_bits,j.w_mask=j.w_size-1,j.hash_bits=N+7,j.hash_size=1<<j.hash_bits,j.hash_mask=j.hash_size-1,j.hash_shift=~~((j.hash_bits+b-1)/b),j.window=new r.Buf8(2*j.w_size),j.head=new r.Buf16(j.hash_size),j.prev=new r.Buf16(j.w_size),j.lit_bufsize=1<<N+6,j.pending_buf_size=4*j.lit_bufsize,j.pending_buf=new r.Buf8(j.pending_buf_size),j.d_buf=1*j.lit_bufsize,j.l_buf=3*j.lit_bufsize,j.level=X,j.strategy=U,j.method=Y,Vt(A)}n=[new ut(0,0,0,0,function(A,X){var Y=65535;for(Y>A.pending_buf_size-5&&(Y=A.pending_buf_size-5);;){if(A.lookahead<=1){if(At(A),A.lookahead===0&&X===d)return _;if(A.lookahead===0)break}A.strstart+=A.lookahead,A.lookahead=0;var P=A.block_start+Y;if((A.strstart===0||A.strstart>=P)&&(A.lookahead=A.strstart-P,A.strstart=P,B(A,!1),A.strm.avail_out===0)||A.strstart-A.block_start>=A.w_size-k&&(B(A,!1),A.strm.avail_out===0))return _}return A.insert=0,X===u?(B(A,!0),A.strm.avail_out===0?q:G):(A.strstart>A.block_start&&(B(A,!1),A.strm.avail_out),_)}),new ut(4,4,8,4,wt),new ut(4,5,16,8,wt),new ut(4,6,32,32,wt),new ut(4,4,16,16,ot),new ut(8,16,32,32,ot),new ut(8,16,128,128,ot),new ut(8,32,128,256,ot),new ut(32,128,258,1024,ot),new ut(32,258,258,4096,ot)],i.deflateInit=function(A,X){return Lt(A,X,C,15,8,0)},i.deflateInit2=Lt,i.deflateReset=Vt,i.deflateResetKeep=mt,i.deflateSetHeader=function(A,X){return A&&A.state?A.state.wrap!==2?E:(A.state.gzhead=X,f):E},i.deflate=function(A,X){var Y,P,N,U;if(!A||!A.state||5<X||X<0)return A?et(A,E):E;if(P=A.state,!A.output||!A.input&&A.avail_in!==0||P.status===666&&X!==u)return et(A,A.avail_out===0?-5:E);if(P.strm=A,Y=P.last_flush,P.last_flush=X,P.status===F)if(P.wrap===2)A.adler=0,rt(P,31),rt(P,139),rt(P,8),P.gzhead?(rt(P,(P.gzhead.text?1:0)+(P.gzhead.hcrc?2:0)+(P.gzhead.extra?4:0)+(P.gzhead.name?8:0)+(P.gzhead.comment?16:0)),rt(P,255&P.gzhead.time),rt(P,P.gzhead.time>>8&255),rt(P,P.gzhead.time>>16&255),rt(P,P.gzhead.time>>24&255),rt(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),rt(P,255&P.gzhead.os),P.gzhead.extra&&P.gzhead.extra.length&&(rt(P,255&P.gzhead.extra.length),rt(P,P.gzhead.extra.length>>8&255)),P.gzhead.hcrc&&(A.adler=l(A.adler,P.pending_buf,P.pending,0)),P.gzindex=0,P.status=69):(rt(P,0),rt(P,0),rt(P,0),rt(P,0),rt(P,0),rt(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),rt(P,3),P.status=L);else{var $=C+(P.w_bits-8<<4)<<8;$|=(2<=P.strategy||P.level<2?0:P.level<6?1:P.level===6?2:3)<<6,P.strstart!==0&&($|=32),$+=31-$%31,P.status=L,st(P,$),P.strstart!==0&&(st(P,A.adler>>>16),st(P,65535&A.adler)),A.adler=1}if(P.status===69)if(P.gzhead.extra){for(N=P.pending;P.gzindex<(65535&P.gzhead.extra.length)&&(P.pending!==P.pending_buf_size||(P.gzhead.hcrc&&P.pending>N&&(A.adler=l(A.adler,P.pending_buf,P.pending-N,N)),V(A),N=P.pending,P.pending!==P.pending_buf_size));)rt(P,255&P.gzhead.extra[P.gzindex]),P.gzindex++;P.gzhead.hcrc&&P.pending>N&&(A.adler=l(A.adler,P.pending_buf,P.pending-N,N)),P.gzindex===P.gzhead.extra.length&&(P.gzindex=0,P.status=73)}else P.status=73;if(P.status===73)if(P.gzhead.name){N=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>N&&(A.adler=l(A.adler,P.pending_buf,P.pending-N,N)),V(A),N=P.pending,P.pending===P.pending_buf_size)){U=1;break}U=P.gzindex<P.gzhead.name.length?255&P.gzhead.name.charCodeAt(P.gzindex++):0,rt(P,U)}while(U!==0);P.gzhead.hcrc&&P.pending>N&&(A.adler=l(A.adler,P.pending_buf,P.pending-N,N)),U===0&&(P.gzindex=0,P.status=91)}else P.status=91;if(P.status===91)if(P.gzhead.comment){N=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>N&&(A.adler=l(A.adler,P.pending_buf,P.pending-N,N)),V(A),N=P.pending,P.pending===P.pending_buf_size)){U=1;break}U=P.gzindex<P.gzhead.comment.length?255&P.gzhead.comment.charCodeAt(P.gzindex++):0,rt(P,U)}while(U!==0);P.gzhead.hcrc&&P.pending>N&&(A.adler=l(A.adler,P.pending_buf,P.pending-N,N)),U===0&&(P.status=103)}else P.status=103;if(P.status===103&&(P.gzhead.hcrc?(P.pending+2>P.pending_buf_size&&V(A),P.pending+2<=P.pending_buf_size&&(rt(P,255&A.adler),rt(P,A.adler>>8&255),A.adler=0,P.status=L)):P.status=L),P.pending!==0){if(V(A),A.avail_out===0)return P.last_flush=-1,f}else if(A.avail_in===0&&W(X)<=W(Y)&&X!==u)return et(A,-5);if(P.status===666&&A.avail_in!==0)return et(A,-5);if(A.avail_in!==0||P.lookahead!==0||X!==d&&P.status!==666){var j=P.strategy===2?function(z,K){for(var it;;){if(z.lookahead===0&&(At(z),z.lookahead===0)){if(K===d)return _;break}if(z.match_length=0,it=o._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++,it&&(B(z,!1),z.strm.avail_out===0))return _}return z.insert=0,K===u?(B(z,!0),z.strm.avail_out===0?q:G):z.last_lit&&(B(z,!1),z.strm.avail_out===0)?_:D}(P,X):P.strategy===3?function(z,K){for(var it,J,at,Ct,ft=z.window;;){if(z.lookahead<=v){if(At(z),z.lookahead<=v&&K===d)return _;if(z.lookahead===0)break}if(z.match_length=0,z.lookahead>=b&&0<z.strstart&&(J=ft[at=z.strstart-1])===ft[++at]&&J===ft[++at]&&J===ft[++at]){Ct=z.strstart+v;do;while(J===ft[++at]&&J===ft[++at]&&J===ft[++at]&&J===ft[++at]&&J===ft[++at]&&J===ft[++at]&&J===ft[++at]&&J===ft[++at]&&at<Ct);z.match_length=v-(Ct-at),z.match_length>z.lookahead&&(z.match_length=z.lookahead)}if(z.match_length>=b?(it=o._tr_tally(z,1,z.match_length-b),z.lookahead-=z.match_length,z.strstart+=z.match_length,z.match_length=0):(it=o._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++),it&&(B(z,!1),z.strm.avail_out===0))return _}return z.insert=0,K===u?(B(z,!0),z.strm.avail_out===0?q:G):z.last_lit&&(B(z,!1),z.strm.avail_out===0)?_:D}(P,X):n[P.level].func(P,X);if(j!==q&&j!==G||(P.status=666),j===_||j===q)return A.avail_out===0&&(P.last_flush=-1),f;if(j===D&&(X===1?o._tr_align(P):X!==5&&(o._tr_stored_block(P,0,0,!1),X===3&&(nt(P.head),P.lookahead===0&&(P.strstart=0,P.block_start=0,P.insert=0))),V(A),A.avail_out===0))return P.last_flush=-1,f}return X!==u?f:P.wrap<=0?1:(P.wrap===2?(rt(P,255&A.adler),rt(P,A.adler>>8&255),rt(P,A.adler>>16&255),rt(P,A.adler>>24&255),rt(P,255&A.total_in),rt(P,A.total_in>>8&255),rt(P,A.total_in>>16&255),rt(P,A.total_in>>24&255)):(st(P,A.adler>>>16),st(P,65535&A.adler)),V(A),0<P.wrap&&(P.wrap=-P.wrap),P.pending!==0?f:1)},i.deflateEnd=function(A){var X;return A&&A.state?(X=A.state.status)!==F&&X!==69&&X!==73&&X!==91&&X!==103&&X!==L&&X!==666?et(A,E):(A.state=null,X===L?et(A,-3):f):E},i.deflateSetDictionary=function(A,X){var Y,P,N,U,$,j,z,K,it=X.length;if(!A||!A.state||(U=(Y=A.state).wrap)===2||U===1&&Y.status!==F||Y.lookahead)return E;for(U===1&&(A.adler=a(A.adler,X,it,0)),Y.wrap=0,it>=Y.w_size&&(U===0&&(nt(Y.head),Y.strstart=0,Y.block_start=0,Y.insert=0),K=new r.Buf8(Y.w_size),r.arraySet(K,X,it-Y.w_size,Y.w_size,0),X=K,it=Y.w_size),$=A.avail_in,j=A.next_in,z=A.input,A.avail_in=it,A.next_in=0,A.input=X,At(Y);Y.lookahead>=b;){for(P=Y.strstart,N=Y.lookahead-(b-1);Y.ins_h=(Y.ins_h<<Y.hash_shift^Y.window[P+b-1])&Y.hash_mask,Y.prev[P&Y.w_mask]=Y.head[Y.ins_h],Y.head[Y.ins_h]=P,P++,--N;);Y.strstart=P,Y.lookahead=b-1,At(Y)}return Y.strstart+=Y.lookahead,Y.block_start=Y.strstart,Y.insert=Y.lookahead,Y.lookahead=0,Y.match_length=Y.prev_length=b-1,Y.match_available=0,A.next_in=j,A.input=z,A.avail_in=$,Y.wrap=U,f},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,e,i){e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(t,e,i){e.exports=function(n,r){var o,a,l,h,d,u,f,E,p,I,m,C,R,g,y,w,O,M,b,v,k,F,L,_,D;o=n.state,a=n.next_in,_=n.input,l=a+(n.avail_in-5),h=n.next_out,D=n.output,d=h-(r-n.avail_out),u=h+(n.avail_out-257),f=o.dmax,E=o.wsize,p=o.whave,I=o.wnext,m=o.window,C=o.hold,R=o.bits,g=o.lencode,y=o.distcode,w=(1<<o.lenbits)-1,O=(1<<o.distbits)-1;t:do{R<15&&(C+=_[a++]<<R,R+=8,C+=_[a++]<<R,R+=8),M=g[C&w];e:for(;;){if(C>>>=b=M>>>24,R-=b,(b=M>>>16&255)===0)D[h++]=65535&M;else{if(!(16&b)){if(!(64&b)){M=g[(65535&M)+(C&(1<<b)-1)];continue e}if(32&b){o.mode=12;break t}n.msg="invalid literal/length code",o.mode=30;break t}v=65535&M,(b&=15)&&(R<b&&(C+=_[a++]<<R,R+=8),v+=C&(1<<b)-1,C>>>=b,R-=b),R<15&&(C+=_[a++]<<R,R+=8,C+=_[a++]<<R,R+=8),M=y[C&O];s:for(;;){if(C>>>=b=M>>>24,R-=b,!(16&(b=M>>>16&255))){if(!(64&b)){M=y[(65535&M)+(C&(1<<b)-1)];continue s}n.msg="invalid distance code",o.mode=30;break t}if(k=65535&M,R<(b&=15)&&(C+=_[a++]<<R,(R+=8)<b&&(C+=_[a++]<<R,R+=8)),f<(k+=C&(1<<b)-1)){n.msg="invalid distance too far back",o.mode=30;break t}if(C>>>=b,R-=b,(b=h-d)<k){if(p<(b=k-b)&&o.sane){n.msg="invalid distance too far back",o.mode=30;break t}if(L=m,(F=0)===I){if(F+=E-b,b<v){for(v-=b;D[h++]=m[F++],--b;);F=h-k,L=D}}else if(I<b){if(F+=E+I-b,(b-=I)<v){for(v-=b;D[h++]=m[F++],--b;);if(F=0,I<v){for(v-=b=I;D[h++]=m[F++],--b;);F=h-k,L=D}}}else if(F+=I-b,b<v){for(v-=b;D[h++]=m[F++],--b;);F=h-k,L=D}for(;2<v;)D[h++]=L[F++],D[h++]=L[F++],D[h++]=L[F++],v-=3;v&&(D[h++]=L[F++],1<v&&(D[h++]=L[F++]))}else{for(F=h-k;D[h++]=D[F++],D[h++]=D[F++],D[h++]=D[F++],2<(v-=3););v&&(D[h++]=D[F++],1<v&&(D[h++]=D[F++]))}break}}break}}while(a<l&&h<u);a-=v=R>>3,C&=(1<<(R-=v<<3))-1,n.next_in=a,n.next_out=h,n.avail_in=a<l?l-a+5:5-(a-l),n.avail_out=h<u?u-h+257:257-(h-u),o.hold=C,o.bits=R}},{}],49:[function(t,e,i){var n=t("../utils/common"),r=t("./adler32"),o=t("./crc32"),a=t("./inffast"),l=t("./inftrees"),h=1,d=2,u=0,f=-2,E=1,p=852,I=592;function m(F){return(F>>>24&255)+(F>>>8&65280)+((65280&F)<<8)+((255&F)<<24)}function C(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function R(F){var L;return F&&F.state?(L=F.state,F.total_in=F.total_out=L.total=0,F.msg="",L.wrap&&(F.adler=1&L.wrap),L.mode=E,L.last=0,L.havedict=0,L.dmax=32768,L.head=null,L.hold=0,L.bits=0,L.lencode=L.lendyn=new n.Buf32(p),L.distcode=L.distdyn=new n.Buf32(I),L.sane=1,L.back=-1,u):f}function g(F){var L;return F&&F.state?((L=F.state).wsize=0,L.whave=0,L.wnext=0,R(F)):f}function y(F,L){var _,D;return F&&F.state?(D=F.state,L<0?(_=0,L=-L):(_=1+(L>>4),L<48&&(L&=15)),L&&(L<8||15<L)?f:(D.window!==null&&D.wbits!==L&&(D.window=null),D.wrap=_,D.wbits=L,g(F))):f}function w(F,L){var _,D;return F?(D=new C,(F.state=D).window=null,(_=y(F,L))!==u&&(F.state=null),_):f}var O,M,b=!0;function v(F){if(b){var L;for(O=new n.Buf32(512),M=new n.Buf32(32),L=0;L<144;)F.lens[L++]=8;for(;L<256;)F.lens[L++]=9;for(;L<280;)F.lens[L++]=7;for(;L<288;)F.lens[L++]=8;for(l(h,F.lens,0,288,O,0,F.work,{bits:9}),L=0;L<32;)F.lens[L++]=5;l(d,F.lens,0,32,M,0,F.work,{bits:5}),b=!1}F.lencode=O,F.lenbits=9,F.distcode=M,F.distbits=5}function k(F,L,_,D){var q,G=F.state;return G.window===null&&(G.wsize=1<<G.wbits,G.wnext=0,G.whave=0,G.window=new n.Buf8(G.wsize)),D>=G.wsize?(n.arraySet(G.window,L,_-G.wsize,G.wsize,0),G.wnext=0,G.whave=G.wsize):(D<(q=G.wsize-G.wnext)&&(q=D),n.arraySet(G.window,L,_-D,q,G.wnext),(D-=q)?(n.arraySet(G.window,L,_-D,D,0),G.wnext=D,G.whave=G.wsize):(G.wnext+=q,G.wnext===G.wsize&&(G.wnext=0),G.whave<G.wsize&&(G.whave+=q))),0}i.inflateReset=g,i.inflateReset2=y,i.inflateResetKeep=R,i.inflateInit=function(F){return w(F,15)},i.inflateInit2=w,i.inflate=function(F,L){var _,D,q,G,et,W,nt,V,B,rt,st,tt,At,wt,ot,ut,dt,mt,Vt,Lt,A,X,Y,P,N=0,U=new n.Buf8(4),$=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!F||!F.state||!F.output||!F.input&&F.avail_in!==0)return f;(_=F.state).mode===12&&(_.mode=13),et=F.next_out,q=F.output,nt=F.avail_out,G=F.next_in,D=F.input,W=F.avail_in,V=_.hold,B=_.bits,rt=W,st=nt,X=u;t:for(;;)switch(_.mode){case E:if(_.wrap===0){_.mode=13;break}for(;B<16;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if(2&_.wrap&&V===35615){U[_.check=0]=255&V,U[1]=V>>>8&255,_.check=o(_.check,U,2,0),B=V=0,_.mode=2;break}if(_.flags=0,_.head&&(_.head.done=!1),!(1&_.wrap)||(((255&V)<<8)+(V>>8))%31){F.msg="incorrect header check",_.mode=30;break}if((15&V)!=8){F.msg="unknown compression method",_.mode=30;break}if(B-=4,A=8+(15&(V>>>=4)),_.wbits===0)_.wbits=A;else if(A>_.wbits){F.msg="invalid window size",_.mode=30;break}_.dmax=1<<A,F.adler=_.check=1,_.mode=512&V?10:12,B=V=0;break;case 2:for(;B<16;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if(_.flags=V,(255&_.flags)!=8){F.msg="unknown compression method",_.mode=30;break}if(57344&_.flags){F.msg="unknown header flags set",_.mode=30;break}_.head&&(_.head.text=V>>8&1),512&_.flags&&(U[0]=255&V,U[1]=V>>>8&255,_.check=o(_.check,U,2,0)),B=V=0,_.mode=3;case 3:for(;B<32;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}_.head&&(_.head.time=V),512&_.flags&&(U[0]=255&V,U[1]=V>>>8&255,U[2]=V>>>16&255,U[3]=V>>>24&255,_.check=o(_.check,U,4,0)),B=V=0,_.mode=4;case 4:for(;B<16;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}_.head&&(_.head.xflags=255&V,_.head.os=V>>8),512&_.flags&&(U[0]=255&V,U[1]=V>>>8&255,_.check=o(_.check,U,2,0)),B=V=0,_.mode=5;case 5:if(1024&_.flags){for(;B<16;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}_.length=V,_.head&&(_.head.extra_len=V),512&_.flags&&(U[0]=255&V,U[1]=V>>>8&255,_.check=o(_.check,U,2,0)),B=V=0}else _.head&&(_.head.extra=null);_.mode=6;case 6:if(1024&_.flags&&(W<(tt=_.length)&&(tt=W),tt&&(_.head&&(A=_.head.extra_len-_.length,_.head.extra||(_.head.extra=new Array(_.head.extra_len)),n.arraySet(_.head.extra,D,G,tt,A)),512&_.flags&&(_.check=o(_.check,D,tt,G)),W-=tt,G+=tt,_.length-=tt),_.length))break t;_.length=0,_.mode=7;case 7:if(2048&_.flags){if(W===0)break t;for(tt=0;A=D[G+tt++],_.head&&A&&_.length<65536&&(_.head.name+=String.fromCharCode(A)),A&&tt<W;);if(512&_.flags&&(_.check=o(_.check,D,tt,G)),W-=tt,G+=tt,A)break t}else _.head&&(_.head.name=null);_.length=0,_.mode=8;case 8:if(4096&_.flags){if(W===0)break t;for(tt=0;A=D[G+tt++],_.head&&A&&_.length<65536&&(_.head.comment+=String.fromCharCode(A)),A&&tt<W;);if(512&_.flags&&(_.check=o(_.check,D,tt,G)),W-=tt,G+=tt,A)break t}else _.head&&(_.head.comment=null);_.mode=9;case 9:if(512&_.flags){for(;B<16;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if(V!==(65535&_.check)){F.msg="header crc mismatch",_.mode=30;break}B=V=0}_.head&&(_.head.hcrc=_.flags>>9&1,_.head.done=!0),F.adler=_.check=0,_.mode=12;break;case 10:for(;B<32;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}F.adler=_.check=m(V),B=V=0,_.mode=11;case 11:if(_.havedict===0)return F.next_out=et,F.avail_out=nt,F.next_in=G,F.avail_in=W,_.hold=V,_.bits=B,2;F.adler=_.check=1,_.mode=12;case 12:if(L===5||L===6)break t;case 13:if(_.last){V>>>=7&B,B-=7&B,_.mode=27;break}for(;B<3;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}switch(_.last=1&V,B-=1,3&(V>>>=1)){case 0:_.mode=14;break;case 1:if(v(_),_.mode=20,L!==6)break;V>>>=2,B-=2;break t;case 2:_.mode=17;break;case 3:F.msg="invalid block type",_.mode=30}V>>>=2,B-=2;break;case 14:for(V>>>=7&B,B-=7&B;B<32;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if((65535&V)!=(V>>>16^65535)){F.msg="invalid stored block lengths",_.mode=30;break}if(_.length=65535&V,B=V=0,_.mode=15,L===6)break t;case 15:_.mode=16;case 16:if(tt=_.length){if(W<tt&&(tt=W),nt<tt&&(tt=nt),tt===0)break t;n.arraySet(q,D,G,tt,et),W-=tt,G+=tt,nt-=tt,et+=tt,_.length-=tt;break}_.mode=12;break;case 17:for(;B<14;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if(_.nlen=257+(31&V),V>>>=5,B-=5,_.ndist=1+(31&V),V>>>=5,B-=5,_.ncode=4+(15&V),V>>>=4,B-=4,286<_.nlen||30<_.ndist){F.msg="too many length or distance symbols",_.mode=30;break}_.have=0,_.mode=18;case 18:for(;_.have<_.ncode;){for(;B<3;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}_.lens[$[_.have++]]=7&V,V>>>=3,B-=3}for(;_.have<19;)_.lens[$[_.have++]]=0;if(_.lencode=_.lendyn,_.lenbits=7,Y={bits:_.lenbits},X=l(0,_.lens,0,19,_.lencode,0,_.work,Y),_.lenbits=Y.bits,X){F.msg="invalid code lengths set",_.mode=30;break}_.have=0,_.mode=19;case 19:for(;_.have<_.nlen+_.ndist;){for(;ut=(N=_.lencode[V&(1<<_.lenbits)-1])>>>16&255,dt=65535&N,!((ot=N>>>24)<=B);){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if(dt<16)V>>>=ot,B-=ot,_.lens[_.have++]=dt;else{if(dt===16){for(P=ot+2;B<P;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if(V>>>=ot,B-=ot,_.have===0){F.msg="invalid bit length repeat",_.mode=30;break}A=_.lens[_.have-1],tt=3+(3&V),V>>>=2,B-=2}else if(dt===17){for(P=ot+3;B<P;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}B-=ot,A=0,tt=3+(7&(V>>>=ot)),V>>>=3,B-=3}else{for(P=ot+7;B<P;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}B-=ot,A=0,tt=11+(127&(V>>>=ot)),V>>>=7,B-=7}if(_.have+tt>_.nlen+_.ndist){F.msg="invalid bit length repeat",_.mode=30;break}for(;tt--;)_.lens[_.have++]=A}}if(_.mode===30)break;if(_.lens[256]===0){F.msg="invalid code -- missing end-of-block",_.mode=30;break}if(_.lenbits=9,Y={bits:_.lenbits},X=l(h,_.lens,0,_.nlen,_.lencode,0,_.work,Y),_.lenbits=Y.bits,X){F.msg="invalid literal/lengths set",_.mode=30;break}if(_.distbits=6,_.distcode=_.distdyn,Y={bits:_.distbits},X=l(d,_.lens,_.nlen,_.ndist,_.distcode,0,_.work,Y),_.distbits=Y.bits,X){F.msg="invalid distances set",_.mode=30;break}if(_.mode=20,L===6)break t;case 20:_.mode=21;case 21:if(6<=W&&258<=nt){F.next_out=et,F.avail_out=nt,F.next_in=G,F.avail_in=W,_.hold=V,_.bits=B,a(F,st),et=F.next_out,q=F.output,nt=F.avail_out,G=F.next_in,D=F.input,W=F.avail_in,V=_.hold,B=_.bits,_.mode===12&&(_.back=-1);break}for(_.back=0;ut=(N=_.lencode[V&(1<<_.lenbits)-1])>>>16&255,dt=65535&N,!((ot=N>>>24)<=B);){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if(ut&&!(240&ut)){for(mt=ot,Vt=ut,Lt=dt;ut=(N=_.lencode[Lt+((V&(1<<mt+Vt)-1)>>mt)])>>>16&255,dt=65535&N,!(mt+(ot=N>>>24)<=B);){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}V>>>=mt,B-=mt,_.back+=mt}if(V>>>=ot,B-=ot,_.back+=ot,_.length=dt,ut===0){_.mode=26;break}if(32&ut){_.back=-1,_.mode=12;break}if(64&ut){F.msg="invalid literal/length code",_.mode=30;break}_.extra=15&ut,_.mode=22;case 22:if(_.extra){for(P=_.extra;B<P;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}_.length+=V&(1<<_.extra)-1,V>>>=_.extra,B-=_.extra,_.back+=_.extra}_.was=_.length,_.mode=23;case 23:for(;ut=(N=_.distcode[V&(1<<_.distbits)-1])>>>16&255,dt=65535&N,!((ot=N>>>24)<=B);){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if(!(240&ut)){for(mt=ot,Vt=ut,Lt=dt;ut=(N=_.distcode[Lt+((V&(1<<mt+Vt)-1)>>mt)])>>>16&255,dt=65535&N,!(mt+(ot=N>>>24)<=B);){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}V>>>=mt,B-=mt,_.back+=mt}if(V>>>=ot,B-=ot,_.back+=ot,64&ut){F.msg="invalid distance code",_.mode=30;break}_.offset=dt,_.extra=15&ut,_.mode=24;case 24:if(_.extra){for(P=_.extra;B<P;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}_.offset+=V&(1<<_.extra)-1,V>>>=_.extra,B-=_.extra,_.back+=_.extra}if(_.offset>_.dmax){F.msg="invalid distance too far back",_.mode=30;break}_.mode=25;case 25:if(nt===0)break t;if(tt=st-nt,_.offset>tt){if((tt=_.offset-tt)>_.whave&&_.sane){F.msg="invalid distance too far back",_.mode=30;break}At=tt>_.wnext?(tt-=_.wnext,_.wsize-tt):_.wnext-tt,tt>_.length&&(tt=_.length),wt=_.window}else wt=q,At=et-_.offset,tt=_.length;for(nt<tt&&(tt=nt),nt-=tt,_.length-=tt;q[et++]=wt[At++],--tt;);_.length===0&&(_.mode=21);break;case 26:if(nt===0)break t;q[et++]=_.length,nt--,_.mode=21;break;case 27:if(_.wrap){for(;B<32;){if(W===0)break t;W--,V|=D[G++]<<B,B+=8}if(st-=nt,F.total_out+=st,_.total+=st,st&&(F.adler=_.check=_.flags?o(_.check,q,st,et-st):r(_.check,q,st,et-st)),st=nt,(_.flags?V:m(V))!==_.check){F.msg="incorrect data check",_.mode=30;break}B=V=0}_.mode=28;case 28:if(_.wrap&&_.flags){for(;B<32;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if(V!==(4294967295&_.total)){F.msg="incorrect length check",_.mode=30;break}B=V=0}_.mode=29;case 29:X=1;break t;case 30:X=-3;break t;case 31:return-4;case 32:default:return f}return F.next_out=et,F.avail_out=nt,F.next_in=G,F.avail_in=W,_.hold=V,_.bits=B,(_.wsize||st!==F.avail_out&&_.mode<30&&(_.mode<27||L!==4))&&k(F,F.output,F.next_out,st-F.avail_out)?(_.mode=31,-4):(rt-=F.avail_in,st-=F.avail_out,F.total_in+=rt,F.total_out+=st,_.total+=st,_.wrap&&st&&(F.adler=_.check=_.flags?o(_.check,q,st,F.next_out-st):r(_.check,q,st,F.next_out-st)),F.data_type=_.bits+(_.last?64:0)+(_.mode===12?128:0)+(_.mode===20||_.mode===15?256:0),(rt==0&&st===0||L===4)&&X===u&&(X=-5),X)},i.inflateEnd=function(F){if(!F||!F.state)return f;var L=F.state;return L.window&&(L.window=null),F.state=null,u},i.inflateGetHeader=function(F,L){var _;return F&&F.state&&2&(_=F.state).wrap?((_.head=L).done=!1,u):f},i.inflateSetDictionary=function(F,L){var _,D=L.length;return F&&F.state?(_=F.state).wrap!==0&&_.mode!==11?f:_.mode===11&&r(1,L,D,0)!==_.check?-3:k(F,L,D,D)?(_.mode=31,-4):(_.havedict=1,u):f},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,e,i){var n=t("../utils/common"),r=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],l=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(h,d,u,f,E,p,I,m){var C,R,g,y,w,O,M,b,v,k=m.bits,F=0,L=0,_=0,D=0,q=0,G=0,et=0,W=0,nt=0,V=0,B=null,rt=0,st=new n.Buf16(16),tt=new n.Buf16(16),At=null,wt=0;for(F=0;F<=15;F++)st[F]=0;for(L=0;L<f;L++)st[d[u+L]]++;for(q=k,D=15;1<=D&&st[D]===0;D--);if(D<q&&(q=D),D===0)return E[p++]=20971520,E[p++]=20971520,m.bits=1,0;for(_=1;_<D&&st[_]===0;_++);for(q<_&&(q=_),F=W=1;F<=15;F++)if(W<<=1,(W-=st[F])<0)return-1;if(0<W&&(h===0||D!==1))return-1;for(tt[1]=0,F=1;F<15;F++)tt[F+1]=tt[F]+st[F];for(L=0;L<f;L++)d[u+L]!==0&&(I[tt[d[u+L]]++]=L);if(O=h===0?(B=At=I,19):h===1?(B=r,rt-=257,At=o,wt-=257,256):(B=a,At=l,-1),F=_,w=p,et=L=V=0,g=-1,y=(nt=1<<(G=q))-1,h===1&&852<nt||h===2&&592<nt)return 1;for(;;){for(M=F-et,v=I[L]<O?(b=0,I[L]):I[L]>O?(b=At[wt+I[L]],B[rt+I[L]]):(b=96,0),C=1<<F-et,_=R=1<<G;E[w+(V>>et)+(R-=C)]=M<<24|b<<16|v|0,R!==0;);for(C=1<<F-1;V&C;)C>>=1;if(C!==0?(V&=C-1,V+=C):V=0,L++,--st[F]==0){if(F===D)break;F=d[u+I[L]]}if(q<F&&(V&y)!==g){for(et===0&&(et=q),w+=_,W=1<<(G=F-et);G+et<D&&!((W-=st[G+et])<=0);)G++,W<<=1;if(nt+=1<<G,h===1&&852<nt||h===2&&592<nt)return 1;E[g=V&y]=q<<24|G<<16|w-p|0}}return V!==0&&(E[w+V]=F-et<<24|64<<16|0),m.bits=q,0}},{"../utils/common":41}],51:[function(t,e,i){e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(t,e,i){var n=t("../utils/common"),r=0,o=1;function a(N){for(var U=N.length;0<=--U;)N[U]=0}var l=0,h=29,d=256,u=d+1+h,f=30,E=19,p=2*u+1,I=15,m=16,C=7,R=256,g=16,y=17,w=18,O=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],M=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],b=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],v=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],k=new Array(2*(u+2));a(k);var F=new Array(2*f);a(F);var L=new Array(512);a(L);var _=new Array(256);a(_);var D=new Array(h);a(D);var q,G,et,W=new Array(f);function nt(N,U,$,j,z){this.static_tree=N,this.extra_bits=U,this.extra_base=$,this.elems=j,this.max_length=z,this.has_stree=N&&N.length}function V(N,U){this.dyn_tree=N,this.max_code=0,this.stat_desc=U}function B(N){return N<256?L[N]:L[256+(N>>>7)]}function rt(N,U){N.pending_buf[N.pending++]=255&U,N.pending_buf[N.pending++]=U>>>8&255}function st(N,U,$){N.bi_valid>m-$?(N.bi_buf|=U<<N.bi_valid&65535,rt(N,N.bi_buf),N.bi_buf=U>>m-N.bi_valid,N.bi_valid+=$-m):(N.bi_buf|=U<<N.bi_valid&65535,N.bi_valid+=$)}function tt(N,U,$){st(N,$[2*U],$[2*U+1])}function At(N,U){for(var $=0;$|=1&N,N>>>=1,$<<=1,0<--U;);return $>>>1}function wt(N,U,$){var j,z,K=new Array(I+1),it=0;for(j=1;j<=I;j++)K[j]=it=it+$[j-1]<<1;for(z=0;z<=U;z++){var J=N[2*z+1];J!==0&&(N[2*z]=At(K[J]++,J))}}function ot(N){var U;for(U=0;U<u;U++)N.dyn_ltree[2*U]=0;for(U=0;U<f;U++)N.dyn_dtree[2*U]=0;for(U=0;U<E;U++)N.bl_tree[2*U]=0;N.dyn_ltree[2*R]=1,N.opt_len=N.static_len=0,N.last_lit=N.matches=0}function ut(N){8<N.bi_valid?rt(N,N.bi_buf):0<N.bi_valid&&(N.pending_buf[N.pending++]=N.bi_buf),N.bi_buf=0,N.bi_valid=0}function dt(N,U,$,j){var z=2*U,K=2*$;return N[z]<N[K]||N[z]===N[K]&&j[U]<=j[$]}function mt(N,U,$){for(var j=N.heap[$],z=$<<1;z<=N.heap_len&&(z<N.heap_len&&dt(U,N.heap[z+1],N.heap[z],N.depth)&&z++,!dt(U,j,N.heap[z],N.depth));)N.heap[$]=N.heap[z],$=z,z<<=1;N.heap[$]=j}function Vt(N,U,$){var j,z,K,it,J=0;if(N.last_lit!==0)for(;j=N.pending_buf[N.d_buf+2*J]<<8|N.pending_buf[N.d_buf+2*J+1],z=N.pending_buf[N.l_buf+J],J++,j===0?tt(N,z,U):(tt(N,(K=_[z])+d+1,U),(it=O[K])!==0&&st(N,z-=D[K],it),tt(N,K=B(--j),$),(it=M[K])!==0&&st(N,j-=W[K],it)),J<N.last_lit;);tt(N,R,U)}function Lt(N,U){var $,j,z,K=U.dyn_tree,it=U.stat_desc.static_tree,J=U.stat_desc.has_stree,at=U.stat_desc.elems,Ct=-1;for(N.heap_len=0,N.heap_max=p,$=0;$<at;$++)K[2*$]!==0?(N.heap[++N.heap_len]=Ct=$,N.depth[$]=0):K[2*$+1]=0;for(;N.heap_len<2;)K[2*(z=N.heap[++N.heap_len]=Ct<2?++Ct:0)]=1,N.depth[z]=0,N.opt_len--,J&&(N.static_len-=it[2*z+1]);for(U.max_code=Ct,$=N.heap_len>>1;1<=$;$--)mt(N,K,$);for(z=at;$=N.heap[1],N.heap[1]=N.heap[N.heap_len--],mt(N,K,1),j=N.heap[1],N.heap[--N.heap_max]=$,N.heap[--N.heap_max]=j,K[2*z]=K[2*$]+K[2*j],N.depth[z]=(N.depth[$]>=N.depth[j]?N.depth[$]:N.depth[j])+1,K[2*$+1]=K[2*j+1]=z,N.heap[1]=z++,mt(N,K,1),2<=N.heap_len;);N.heap[--N.heap_max]=N.heap[1],function(ft,kt){var $e,Jt,je,St,As,Ni,oe=kt.dyn_tree,Sn=kt.max_code,oo=kt.stat_desc.static_tree,ao=kt.stat_desc.has_stree,co=kt.stat_desc.extra_bits,On=kt.stat_desc.extra_base,Qe=kt.stat_desc.max_length,Rs=0;for(St=0;St<=I;St++)ft.bl_count[St]=0;for(oe[2*ft.heap[ft.heap_max]+1]=0,$e=ft.heap_max+1;$e<p;$e++)Qe<(St=oe[2*oe[2*(Jt=ft.heap[$e])+1]+1]+1)&&(St=Qe,Rs++),oe[2*Jt+1]=St,Sn<Jt||(ft.bl_count[St]++,As=0,On<=Jt&&(As=co[Jt-On]),Ni=oe[2*Jt],ft.opt_len+=Ni*(St+As),ao&&(ft.static_len+=Ni*(oo[2*Jt+1]+As)));if(Rs!==0){do{for(St=Qe-1;ft.bl_count[St]===0;)St--;ft.bl_count[St]--,ft.bl_count[St+1]+=2,ft.bl_count[Qe]--,Rs-=2}while(0<Rs);for(St=Qe;St!==0;St--)for(Jt=ft.bl_count[St];Jt!==0;)Sn<(je=ft.heap[--$e])||(oe[2*je+1]!==St&&(ft.opt_len+=(St-oe[2*je+1])*oe[2*je],oe[2*je+1]=St),Jt--)}}(N,U),wt(K,Ct,N.bl_count)}function A(N,U,$){var j,z,K=-1,it=U[1],J=0,at=7,Ct=4;for(it===0&&(at=138,Ct=3),U[2*($+1)+1]=65535,j=0;j<=$;j++)z=it,it=U[2*(j+1)+1],++J<at&&z===it||(J<Ct?N.bl_tree[2*z]+=J:z!==0?(z!==K&&N.bl_tree[2*z]++,N.bl_tree[2*g]++):J<=10?N.bl_tree[2*y]++:N.bl_tree[2*w]++,K=z,Ct=(J=0)===it?(at=138,3):z===it?(at=6,3):(at=7,4))}function X(N,U,$){var j,z,K=-1,it=U[1],J=0,at=7,Ct=4;for(it===0&&(at=138,Ct=3),j=0;j<=$;j++)if(z=it,it=U[2*(j+1)+1],!(++J<at&&z===it)){if(J<Ct)for(;tt(N,z,N.bl_tree),--J!=0;);else z!==0?(z!==K&&(tt(N,z,N.bl_tree),J--),tt(N,g,N.bl_tree),st(N,J-3,2)):J<=10?(tt(N,y,N.bl_tree),st(N,J-3,3)):(tt(N,w,N.bl_tree),st(N,J-11,7));K=z,Ct=(J=0)===it?(at=138,3):z===it?(at=6,3):(at=7,4)}}a(W);var Y=!1;function P(N,U,$,j){st(N,(l<<1)+(j?1:0),3),function(z,K,it,J){ut(z),rt(z,it),rt(z,~it),n.arraySet(z.pending_buf,z.window,K,it,z.pending),z.pending+=it}(N,U,$)}i._tr_init=function(N){Y||(function(){var U,$,j,z,K,it=new Array(I+1);for(z=j=0;z<h-1;z++)for(D[z]=j,U=0;U<1<<O[z];U++)_[j++]=z;for(_[j-1]=z,z=K=0;z<16;z++)for(W[z]=K,U=0;U<1<<M[z];U++)L[K++]=z;for(K>>=7;z<f;z++)for(W[z]=K<<7,U=0;U<1<<M[z]-7;U++)L[256+K++]=z;for($=0;$<=I;$++)it[$]=0;for(U=0;U<=143;)k[2*U+1]=8,U++,it[8]++;for(;U<=255;)k[2*U+1]=9,U++,it[9]++;for(;U<=279;)k[2*U+1]=7,U++,it[7]++;for(;U<=287;)k[2*U+1]=8,U++,it[8]++;for(wt(k,u+1,it),U=0;U<f;U++)F[2*U+1]=5,F[2*U]=At(U,5);q=new nt(k,O,d+1,u,I),G=new nt(F,M,0,f,I),et=new nt(new Array(0),b,0,E,C)}(),Y=!0),N.l_desc=new V(N.dyn_ltree,q),N.d_desc=new V(N.dyn_dtree,G),N.bl_desc=new V(N.bl_tree,et),N.bi_buf=0,N.bi_valid=0,ot(N)},i._tr_stored_block=P,i._tr_flush_block=function(N,U,$,j){var z,K,it=0;0<N.level?(N.strm.data_type===2&&(N.strm.data_type=function(J){var at,Ct=4093624447;for(at=0;at<=31;at++,Ct>>>=1)if(1&Ct&&J.dyn_ltree[2*at]!==0)return r;if(J.dyn_ltree[18]!==0||J.dyn_ltree[20]!==0||J.dyn_ltree[26]!==0)return o;for(at=32;at<d;at++)if(J.dyn_ltree[2*at]!==0)return o;return r}(N)),Lt(N,N.l_desc),Lt(N,N.d_desc),it=function(J){var at;for(A(J,J.dyn_ltree,J.l_desc.max_code),A(J,J.dyn_dtree,J.d_desc.max_code),Lt(J,J.bl_desc),at=E-1;3<=at&&J.bl_tree[2*v[at]+1]===0;at--);return J.opt_len+=3*(at+1)+5+5+4,at}(N),z=N.opt_len+3+7>>>3,(K=N.static_len+3+7>>>3)<=z&&(z=K)):z=K=$+5,$+4<=z&&U!==-1?P(N,U,$,j):N.strategy===4||K===z?(st(N,2+(j?1:0),3),Vt(N,k,F)):(st(N,4+(j?1:0),3),function(J,at,Ct,ft){var kt;for(st(J,at-257,5),st(J,Ct-1,5),st(J,ft-4,4),kt=0;kt<ft;kt++)st(J,J.bl_tree[2*v[kt]+1],3);X(J,J.dyn_ltree,at-1),X(J,J.dyn_dtree,Ct-1)}(N,N.l_desc.max_code+1,N.d_desc.max_code+1,it+1),Vt(N,N.dyn_ltree,N.dyn_dtree)),ot(N),j&&ut(N)},i._tr_tally=function(N,U,$){return N.pending_buf[N.d_buf+2*N.last_lit]=U>>>8&255,N.pending_buf[N.d_buf+2*N.last_lit+1]=255&U,N.pending_buf[N.l_buf+N.last_lit]=255&$,N.last_lit++,U===0?N.dyn_ltree[2*$]++:(N.matches++,U--,N.dyn_ltree[2*(_[$]+d+1)]++,N.dyn_dtree[2*B(U)]++),N.last_lit===N.lit_bufsize-1},i._tr_align=function(N){st(N,2,3),tt(N,R,k),function(U){U.bi_valid===16?(rt(U,U.bi_buf),U.bi_buf=0,U.bi_valid=0):8<=U.bi_valid&&(U.pending_buf[U.pending++]=255&U.bi_buf,U.bi_buf>>=8,U.bi_valid-=8)}(N)}},{"../utils/common":41}],53:[function(t,e,i){e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,e,i){(function(n){(function(r,o){if(!r.setImmediate){var a,l,h,d,u=1,f={},E=!1,p=r.document,I=Object.getPrototypeOf&&Object.getPrototypeOf(r);I=I&&I.setTimeout?I:r,a={}.toString.call(r.process)==="[object process]"?function(g){process.nextTick(function(){C(g)})}:function(){if(r.postMessage&&!r.importScripts){var g=!0,y=r.onmessage;return r.onmessage=function(){g=!1},r.postMessage("","*"),r.onmessage=y,g}}()?(d="setImmediate$"+Math.random()+"$",r.addEventListener?r.addEventListener("message",R,!1):r.attachEvent("onmessage",R),function(g){r.postMessage(d+g,"*")}):r.MessageChannel?((h=new MessageChannel).port1.onmessage=function(g){C(g.data)},function(g){h.port2.postMessage(g)}):p&&"onreadystatechange"in p.createElement("script")?(l=p.documentElement,function(g){var y=p.createElement("script");y.onreadystatechange=function(){C(g),y.onreadystatechange=null,l.removeChild(y),y=null},l.appendChild(y)}):function(g){setTimeout(C,0,g)},I.setImmediate=function(g){typeof g!="function"&&(g=new Function(""+g));for(var y=new Array(arguments.length-1),w=0;w<y.length;w++)y[w]=arguments[w+1];var O={callback:g,args:y};return f[u]=O,a(u),u++},I.clearImmediate=m}function m(g){delete f[g]}function C(g){if(E)setTimeout(C,0,g);else{var y=f[g];if(y){E=!0;try{(function(w){var O=w.callback,M=w.args;switch(M.length){case 0:O();break;case 1:O(M[0]);break;case 2:O(M[0],M[1]);break;case 3:O(M[0],M[1],M[2]);break;default:O.apply(o,M)}})(y)}finally{m(g),E=!1}}}}function R(g){g.source===r&&typeof g.data=="string"&&g.data.indexOf(d)===0&&C(+g.data.slice(d.length))}})(typeof self>"u"?n===void 0?this:n:self)}).call(this,typeof Zs<"u"?Zs:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})($r);var Za=$r.exports;const dr=Xa(Za);var Rn={},Oi={};(function(c){const s=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",t=s+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",e="["+s+"]["+t+"]*",i=new RegExp("^"+e+"$"),n=function(o,a){const l=[];let h=a.exec(o);for(;h;){const d=[];d.startIndex=a.lastIndex-h[0].length;const u=h.length;for(let f=0;f<u;f++)d.push(h[f]);l.push(d),h=a.exec(o)}return l},r=function(o){const a=i.exec(o);return!(a===null||typeof a>"u")};c.isExist=function(o){return typeof o<"u"},c.isEmptyObject=function(o){return Object.keys(o).length===0},c.merge=function(o,a,l){if(a){const h=Object.keys(a),d=h.length;for(let u=0;u<d;u++)l==="strict"?o[h[u]]=[a[h[u]]]:o[h[u]]=a[h[u]]}},c.getValue=function(o){return c.isExist(o)?o:""},c.isName=r,c.getAllMatches=n,c.nameRegexp=e})(Oi);const yn=Oi,$a={allowBooleanAttributes:!1,unpairedTags:[]};Rn.validate=function(c,s){s=Object.assign({},$a,s);const t=[];let e=!1,i=!1;c[0]==="\uFEFF"&&(c=c.substr(1));for(let n=0;n<c.length;n++)if(c[n]==="<"&&c[n+1]==="?"){if(n+=2,n=fr(c,n),n.err)return n}else if(c[n]==="<"){let r=n;if(n++,c[n]==="!"){n=pr(c,n);continue}else{let o=!1;c[n]==="/"&&(o=!0,n++);let a="";for(;n<c.length&&c[n]!==">"&&c[n]!==" "&&c[n]!==" "&&c[n]!==`
138
+ */(function(c,s){(function(t){c.exports=t()})(function(){return function t(e,i,n){function r(l,h){if(!i[l]){if(!e[l]){var d=typeof js=="function"&&js;if(!h&&d)return d(l,!0);if(o)return o(l,!0);var u=new Error("Cannot find module '"+l+"'");throw u.code="MODULE_NOT_FOUND",u}var f=i[l]={exports:{}};e[l][0].call(f.exports,function(E){var p=e[l][1][E];return r(p||E)},f,f.exports,t,e,i,n)}return i[l].exports}for(var o=typeof js=="function"&&js,a=0;a<n.length;a++)r(n[a]);return r}({1:[function(t,e,i){var n=t("./utils"),r=t("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(a){for(var l,h,d,u,f,E,p,I=[],m=0,C=a.length,R=C,g=n.getTypeOf(a)!=="string";m<a.length;)R=C-m,d=g?(l=a[m++],h=m<C?a[m++]:0,m<C?a[m++]:0):(l=a.charCodeAt(m++),h=m<C?a.charCodeAt(m++):0,m<C?a.charCodeAt(m++):0),u=l>>2,f=(3&l)<<4|h>>4,E=1<R?(15&h)<<2|d>>6:64,p=2<R?63&d:64,I.push(o.charAt(u)+o.charAt(f)+o.charAt(E)+o.charAt(p));return I.join("")},i.decode=function(a){var l,h,d,u,f,E,p=0,I=0,m="data:";if(a.substr(0,m.length)===m)throw new Error("Invalid base64 input, it looks like a data url.");var C,R=3*(a=a.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(a.charAt(a.length-1)===o.charAt(64)&&R--,a.charAt(a.length-2)===o.charAt(64)&&R--,R%1!=0)throw new Error("Invalid base64 input, bad content length.");for(C=r.uint8array?new Uint8Array(0|R):new Array(0|R);p<a.length;)l=o.indexOf(a.charAt(p++))<<2|(u=o.indexOf(a.charAt(p++)))>>4,h=(15&u)<<4|(f=o.indexOf(a.charAt(p++)))>>2,d=(3&f)<<6|(E=o.indexOf(a.charAt(p++))),C[I++]=l,f!==64&&(C[I++]=h),E!==64&&(C[I++]=d);return C}},{"./support":30,"./utils":32}],2:[function(t,e,i){var n=t("./external"),r=t("./stream/DataWorker"),o=t("./stream/Crc32Probe"),a=t("./stream/DataLengthProbe");function l(h,d,u,f,E){this.compressedSize=h,this.uncompressedSize=d,this.crc32=u,this.compression=f,this.compressedContent=E}l.prototype={getContentWorker:function(){var h=new r(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),d=this;return h.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),h},getCompressedWorker:function(){return new r(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},l.createWorkerFrom=function(h,d,u){return h.pipe(new o).pipe(new a("uncompressedSize")).pipe(d.compressWorker(u)).pipe(new a("compressedSize")).withStreamInfo("compression",d)},e.exports=l},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,e,i){var n=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,e,i){var n=t("./utils"),r=function(){for(var o,a=[],l=0;l<256;l++){o=l;for(var h=0;h<8;h++)o=1&o?3988292384^o>>>1:o>>>1;a[l]=o}return a}();e.exports=function(o,a){return o!==void 0&&o.length?n.getTypeOf(o)!=="string"?function(l,h,d,u){var f=r,E=u+d;l^=-1;for(var p=u;p<E;p++)l=l>>>8^f[255&(l^h[p])];return-1^l}(0|a,o,o.length,0):function(l,h,d,u){var f=r,E=u+d;l^=-1;for(var p=u;p<E;p++)l=l>>>8^f[255&(l^h.charCodeAt(p))];return-1^l}(0|a,o,o.length,0):0}},{"./utils":32}],5:[function(t,e,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,e,i){var n=null;n=typeof Promise<"u"?Promise:t("lie"),e.exports={Promise:n}},{lie:37}],7:[function(t,e,i){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",r=t("pako"),o=t("./utils"),a=t("./stream/GenericWorker"),l=n?"uint8array":"array";function h(d,u){a.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=u,this.meta={}}i.magic="\b\0",o.inherits(h,a),h.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(l,d.data),!1)},h.prototype.flush=function(){a.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new r[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(u){d.push({data:u,meta:d.meta})}},i.compressWorker=function(d){return new h("Deflate",d)},i.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,e,i){function n(f,E){var p,I="";for(p=0;p<E;p++)I+=String.fromCharCode(255&f),f>>>=8;return I}function r(f,E,p,I,m,C){var R,g,y=f.file,w=f.compression,O=C!==l.utf8encode,M=o.transformTo("string",C(y.name)),b=o.transformTo("string",l.utf8encode(y.name)),v=y.comment,k=o.transformTo("string",C(v)),F=o.transformTo("string",l.utf8encode(v)),L=b.length!==y.name.length,T=F.length!==v.length,D="",q="",G="",et=y.dir,W=y.date,nt={crc32:0,compressedSize:0,uncompressedSize:0};E&&!p||(nt.crc32=f.crc32,nt.compressedSize=f.compressedSize,nt.uncompressedSize=f.uncompressedSize);var V=0;E&&(V|=8),O||!L&&!T||(V|=2048);var B=0,rt=0;et&&(B|=16),m==="UNIX"?(rt=798,B|=function(tt,At){var wt=tt;return tt||(wt=At?16893:33204),(65535&wt)<<16}(y.unixPermissions,et)):(rt=20,B|=function(tt){return 63&(tt||0)}(y.dosPermissions)),R=W.getUTCHours(),R<<=6,R|=W.getUTCMinutes(),R<<=5,R|=W.getUTCSeconds()/2,g=W.getUTCFullYear()-1980,g<<=4,g|=W.getUTCMonth()+1,g<<=5,g|=W.getUTCDate(),L&&(q=n(1,1)+n(h(M),4)+b,D+="up"+n(q.length,2)+q),T&&(G=n(1,1)+n(h(k),4)+F,D+="uc"+n(G.length,2)+G);var st="";return st+=`
139
+ \0`,st+=n(V,2),st+=w.magic,st+=n(R,2),st+=n(g,2),st+=n(nt.crc32,4),st+=n(nt.compressedSize,4),st+=n(nt.uncompressedSize,4),st+=n(M.length,2),st+=n(D.length,2),{fileRecord:d.LOCAL_FILE_HEADER+st+M+D,dirRecord:d.CENTRAL_FILE_HEADER+n(rt,2)+st+n(k.length,2)+"\0\0\0\0"+n(B,4)+n(I,4)+M+D+k}}var o=t("../utils"),a=t("../stream/GenericWorker"),l=t("../utf8"),h=t("../crc32"),d=t("../signature");function u(f,E,p,I){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=E,this.zipPlatform=p,this.encodeFileName=I,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(u,a),u.prototype.push=function(f){var E=f.meta.percent||0,p=this.entriesCount,I=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,a.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:p?(E+100*(p-I-1))/p:100}}))},u.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var E=this.streamFiles&&!f.file.dir;if(E){var p=r(f,E,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:p.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(f){this.accumulate=!1;var E=this.streamFiles&&!f.file.dir,p=r(f,E,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),E)this.push({data:function(I){return d.DATA_DESCRIPTOR+n(I.crc32,4)+n(I.compressedSize,4)+n(I.uncompressedSize,4)}(f),meta:{percent:100}});else for(this.push({data:p.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var f=this.bytesWritten,E=0;E<this.dirRecords.length;E++)this.push({data:this.dirRecords[E],meta:{percent:100}});var p=this.bytesWritten-f,I=function(m,C,R,g,y){var w=o.transformTo("string",y(g));return d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+n(m,2)+n(m,2)+n(C,4)+n(R,4)+n(w.length,2)+w}(this.dirRecords.length,p,f,this.zipComment,this.encodeFileName);this.push({data:I,meta:{percent:100}})},u.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},u.prototype.registerPrevious=function(f){this._sources.push(f);var E=this;return f.on("data",function(p){E.processChunk(p)}),f.on("end",function(){E.closedSource(E.previous.streamInfo),E._sources.length?E.prepareNextSource():E.end()}),f.on("error",function(p){E.error(p)}),this},u.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},u.prototype.error=function(f){var E=this._sources;if(!a.prototype.error.call(this,f))return!1;for(var p=0;p<E.length;p++)try{E[p].error(f)}catch{}return!0},u.prototype.lock=function(){a.prototype.lock.call(this);for(var f=this._sources,E=0;E<f.length;E++)f[E].lock()},e.exports=u},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,e,i){var n=t("../compressions"),r=t("./ZipFileWorker");i.generateWorker=function(o,a,l){var h=new r(a.streamFiles,l,a.platform,a.encodeFileName),d=0;try{o.forEach(function(u,f){d++;var E=function(C,R){var g=C||R,y=n[g];if(!y)throw new Error(g+" is not a valid compression method !");return y}(f.options.compression,a.compression),p=f.options.compressionOptions||a.compressionOptions||{},I=f.dir,m=f.date;f._compressWorker(E,p).withStreamInfo("file",{name:u,dir:I,date:m,comment:f.comment||"",unixPermissions:f.unixPermissions,dosPermissions:f.dosPermissions}).pipe(h)}),h.entriesCount=d}catch(u){h.error(u)}return h}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,e,i){function n(){if(!(this instanceof n))return new n;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var r=new n;for(var o in this)typeof this[o]!="function"&&(r[o]=this[o]);return r}}(n.prototype=t("./object")).loadAsync=t("./load"),n.support=t("./support"),n.defaults=t("./defaults"),n.version="3.10.1",n.loadAsync=function(r,o){return new n().loadAsync(r,o)},n.external=t("./external"),e.exports=n},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,e,i){var n=t("./utils"),r=t("./external"),o=t("./utf8"),a=t("./zipEntries"),l=t("./stream/Crc32Probe"),h=t("./nodejsUtils");function d(u){return new r.Promise(function(f,E){var p=u.decompressed.getContentWorker().pipe(new l);p.on("error",function(I){E(I)}).on("end",function(){p.streamInfo.crc32!==u.decompressed.crc32?E(new Error("Corrupted zip : CRC32 mismatch")):f()}).resume()})}e.exports=function(u,f){var E=this;return f=n.extend(f||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),h.isNode&&h.isStream(u)?r.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",u,!0,f.optimizedBinaryString,f.base64).then(function(p){var I=new a(f);return I.load(p),I}).then(function(p){var I=[r.Promise.resolve(p)],m=p.files;if(f.checkCRC32)for(var C=0;C<m.length;C++)I.push(d(m[C]));return r.Promise.all(I)}).then(function(p){for(var I=p.shift(),m=I.files,C=0;C<m.length;C++){var R=m[C],g=R.fileNameStr,y=n.resolve(R.fileNameStr);E.file(y,R.decompressed,{binary:!0,optimizedBinaryString:!0,date:R.date,dir:R.dir,comment:R.fileCommentStr.length?R.fileCommentStr:null,unixPermissions:R.unixPermissions,dosPermissions:R.dosPermissions,createFolders:f.createFolders}),R.dir||(E.file(y).unsafeOriginalName=g)}return I.zipComment.length&&(E.comment=I.zipComment),E})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,e,i){var n=t("../utils"),r=t("../stream/GenericWorker");function o(a,l){r.call(this,"Nodejs stream input adapter for "+a),this._upstreamEnded=!1,this._bindStream(l)}n.inherits(o,r),o.prototype._bindStream=function(a){var l=this;(this._stream=a).pause(),a.on("data",function(h){l.push({data:h,meta:{percent:0}})}).on("error",function(h){l.isPaused?this.generatedError=h:l.error(h)}).on("end",function(){l.isPaused?l._upstreamEnded=!0:l.end()})},o.prototype.pause=function(){return!!r.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},e.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,e,i){var n=t("readable-stream").Readable;function r(o,a,l){n.call(this,a),this._helper=o;var h=this;o.on("data",function(d,u){h.push(d)||h._helper.pause(),l&&l(u)}).on("error",function(d){h.emit("error",d)}).on("end",function(){h.push(null)})}t("../utils").inherits(r,n),r.prototype._read=function(){this._helper.resume()},e.exports=r},{"../utils":32,"readable-stream":16}],14:[function(t,e,i){e.exports={isNode:typeof Buffer<"u",newBufferFrom:function(n,r){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(n,r);if(typeof n=="number")throw new Error('The "data" argument must not be a number');return new Buffer(n,r)},allocBuffer:function(n){if(Buffer.alloc)return Buffer.alloc(n);var r=new Buffer(n);return r.fill(0),r},isBuffer:function(n){return Buffer.isBuffer(n)},isStream:function(n){return n&&typeof n.on=="function"&&typeof n.pause=="function"&&typeof n.resume=="function"}}},{}],15:[function(t,e,i){function n(y,w,O){var M,b=o.getTypeOf(w),v=o.extend(O||{},h);v.date=v.date||new Date,v.compression!==null&&(v.compression=v.compression.toUpperCase()),typeof v.unixPermissions=="string"&&(v.unixPermissions=parseInt(v.unixPermissions,8)),v.unixPermissions&&16384&v.unixPermissions&&(v.dir=!0),v.dosPermissions&&16&v.dosPermissions&&(v.dir=!0),v.dir&&(y=m(y)),v.createFolders&&(M=I(y))&&C.call(this,M,!0);var k=b==="string"&&v.binary===!1&&v.base64===!1;O&&O.binary!==void 0||(v.binary=!k),(w instanceof d&&w.uncompressedSize===0||v.dir||!w||w.length===0)&&(v.base64=!1,v.binary=!0,w="",v.compression="STORE",b="string");var F=null;F=w instanceof d||w instanceof a?w:E.isNode&&E.isStream(w)?new p(y,w):o.prepareContent(y,w,v.binary,v.optimizedBinaryString,v.base64);var L=new u(y,F,v);this.files[y]=L}var r=t("./utf8"),o=t("./utils"),a=t("./stream/GenericWorker"),l=t("./stream/StreamHelper"),h=t("./defaults"),d=t("./compressedObject"),u=t("./zipObject"),f=t("./generate"),E=t("./nodejsUtils"),p=t("./nodejs/NodejsStreamInputAdapter"),I=function(y){y.slice(-1)==="/"&&(y=y.substring(0,y.length-1));var w=y.lastIndexOf("/");return 0<w?y.substring(0,w):""},m=function(y){return y.slice(-1)!=="/"&&(y+="/"),y},C=function(y,w){return w=w!==void 0?w:h.createFolders,y=m(y),this.files[y]||n.call(this,y,null,{dir:!0,createFolders:w}),this.files[y]};function R(y){return Object.prototype.toString.call(y)==="[object RegExp]"}var g={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(y){var w,O,M;for(w in this.files)M=this.files[w],(O=w.slice(this.root.length,w.length))&&w.slice(0,this.root.length)===this.root&&y(O,M)},filter:function(y){var w=[];return this.forEach(function(O,M){y(O,M)&&w.push(M)}),w},file:function(y,w,O){if(arguments.length!==1)return y=this.root+y,n.call(this,y,w,O),this;if(R(y)){var M=y;return this.filter(function(v,k){return!k.dir&&M.test(v)})}var b=this.files[this.root+y];return b&&!b.dir?b:null},folder:function(y){if(!y)return this;if(R(y))return this.filter(function(b,v){return v.dir&&y.test(b)});var w=this.root+y,O=C.call(this,w),M=this.clone();return M.root=O.name,M},remove:function(y){y=this.root+y;var w=this.files[y];if(w||(y.slice(-1)!=="/"&&(y+="/"),w=this.files[y]),w&&!w.dir)delete this.files[y];else for(var O=this.filter(function(b,v){return v.name.slice(0,y.length)===y}),M=0;M<O.length;M++)delete this.files[O[M].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(y){var w,O={};try{if((O=o.extend(y||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:r.utf8encode})).type=O.type.toLowerCase(),O.compression=O.compression.toUpperCase(),O.type==="binarystring"&&(O.type="string"),!O.type)throw new Error("No output type specified.");o.checkSupport(O.type),O.platform!=="darwin"&&O.platform!=="freebsd"&&O.platform!=="linux"&&O.platform!=="sunos"||(O.platform="UNIX"),O.platform==="win32"&&(O.platform="DOS");var M=O.comment||this.comment||"";w=f.generateWorker(this,O,M)}catch(b){(w=new a("error")).error(b)}return new l(w,O.type||"string",O.mimeType)},generateAsync:function(y,w){return this.generateInternalStream(y).accumulate(w)},generateNodeStream:function(y,w){return(y=y||{}).type||(y.type="nodebuffer"),this.generateInternalStream(y).toNodejsStream(w)}};e.exports=g},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(t,e,i){e.exports=t("stream")},{stream:void 0}],17:[function(t,e,i){var n=t("./DataReader");function r(o){n.call(this,o);for(var a=0;a<this.data.length;a++)o[a]=255&o[a]}t("../utils").inherits(r,n),r.prototype.byteAt=function(o){return this.data[this.zero+o]},r.prototype.lastIndexOfSignature=function(o){for(var a=o.charCodeAt(0),l=o.charCodeAt(1),h=o.charCodeAt(2),d=o.charCodeAt(3),u=this.length-4;0<=u;--u)if(this.data[u]===a&&this.data[u+1]===l&&this.data[u+2]===h&&this.data[u+3]===d)return u-this.zero;return-1},r.prototype.readAndCheckSignature=function(o){var a=o.charCodeAt(0),l=o.charCodeAt(1),h=o.charCodeAt(2),d=o.charCodeAt(3),u=this.readData(4);return a===u[0]&&l===u[1]&&h===u[2]&&d===u[3]},r.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},e.exports=r},{"../utils":32,"./DataReader":18}],18:[function(t,e,i){var n=t("../utils");function r(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}r.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var a,l=0;for(this.checkOffset(o),a=this.index+o-1;a>=this.index;a--)l=(l<<8)+this.byteAt(a);return this.index+=o,l},readString:function(o){return n.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},e.exports=r},{"../utils":32}],19:[function(t,e,i){var n=t("./Uint8ArrayReader");function r(o){n.call(this,o)}t("../utils").inherits(r,n),r.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},e.exports=r},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,e,i){var n=t("./DataReader");function r(o){n.call(this,o)}t("../utils").inherits(r,n),r.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},r.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},r.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},r.prototype.readData=function(o){this.checkOffset(o);var a=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},e.exports=r},{"../utils":32,"./DataReader":18}],21:[function(t,e,i){var n=t("./ArrayReader");function r(o){n.call(this,o)}t("../utils").inherits(r,n),r.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var a=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,a},e.exports=r},{"../utils":32,"./ArrayReader":17}],22:[function(t,e,i){var n=t("../utils"),r=t("../support"),o=t("./ArrayReader"),a=t("./StringReader"),l=t("./NodeBufferReader"),h=t("./Uint8ArrayReader");e.exports=function(d){var u=n.getTypeOf(d);return n.checkSupport(u),u!=="string"||r.uint8array?u==="nodebuffer"?new l(d):r.uint8array?new h(n.transformTo("uint8array",d)):new o(n.transformTo("array",d)):new a(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,e,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,e,i){var n=t("./GenericWorker"),r=t("../utils");function o(a){n.call(this,"ConvertWorker to "+a),this.destType=a}r.inherits(o,n),o.prototype.processChunk=function(a){this.push({data:r.transformTo(this.destType,a.data),meta:a.meta})},e.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,e,i){var n=t("./GenericWorker"),r=t("../crc32");function o(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,n),o.prototype.processChunk=function(a){this.streamInfo.crc32=r(a.data,this.streamInfo.crc32||0),this.push(a)},e.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,e,i){var n=t("../utils"),r=t("./GenericWorker");function o(a){r.call(this,"DataLengthProbe for "+a),this.propName=a,this.withStreamInfo(a,0)}n.inherits(o,r),o.prototype.processChunk=function(a){if(a){var l=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=l+a.data.length}r.prototype.processChunk.call(this,a)},e.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,e,i){var n=t("../utils"),r=t("./GenericWorker");function o(a){r.call(this,"DataWorker");var l=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,a.then(function(h){l.dataIsReady=!0,l.data=h,l.max=h&&h.length||0,l.type=n.getTypeOf(h),l.isPaused||l._tickAndRepeat()},function(h){l.error(h)})}n.inherits(o,r),o.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var a=null,l=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":a=this.data.substring(this.index,l);break;case"uint8array":a=this.data.subarray(this.index,l);break;case"array":case"nodebuffer":a=this.data.slice(this.index,l)}return this.index=l,this.push({data:a,meta:{percent:this.max?this.index/this.max*100:0}})},e.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,e,i){function n(r){this.name=r||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(r){this.emit("data",r)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(r){this.emit("error",r)}return!0},error:function(r){return!this.isFinished&&(this.isPaused?this.generatedError=r:(this.isFinished=!0,this.emit("error",r),this.previous&&this.previous.error(r),this.cleanUp()),!0)},on:function(r,o){return this._listeners[r].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(r,o){if(this._listeners[r])for(var a=0;a<this._listeners[r].length;a++)this._listeners[r][a].call(this,o)},pipe:function(r){return r.registerPrevious(this)},registerPrevious:function(r){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=r.streamInfo,this.mergeStreamInfo(),this.previous=r;var o=this;return r.on("data",function(a){o.processChunk(a)}),r.on("end",function(){o.end()}),r.on("error",function(a){o.error(a)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var r=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),r=!0),this.previous&&this.previous.resume(),!r},flush:function(){},processChunk:function(r){this.push(r)},withStreamInfo:function(r,o){return this.extraStreamInfo[r]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var r in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,r)&&(this.streamInfo[r]=this.extraStreamInfo[r])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var r="Worker "+this.name;return this.previous?this.previous+" -> "+r:r}},e.exports=n},{}],29:[function(t,e,i){var n=t("../utils"),r=t("./ConvertWorker"),o=t("./GenericWorker"),a=t("../base64"),l=t("../support"),h=t("../external"),d=null;if(l.nodestream)try{d=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function u(E,p){return new h.Promise(function(I,m){var C=[],R=E._internalType,g=E._outputType,y=E._mimeType;E.on("data",function(w,O){C.push(w),p&&p(O)}).on("error",function(w){C=[],m(w)}).on("end",function(){try{var w=function(O,M,b){switch(O){case"blob":return n.newBlob(n.transformTo("arraybuffer",M),b);case"base64":return a.encode(M);default:return n.transformTo(O,M)}}(g,function(O,M){var b,v=0,k=null,F=0;for(b=0;b<M.length;b++)F+=M[b].length;switch(O){case"string":return M.join("");case"array":return Array.prototype.concat.apply([],M);case"uint8array":for(k=new Uint8Array(F),b=0;b<M.length;b++)k.set(M[b],v),v+=M[b].length;return k;case"nodebuffer":return Buffer.concat(M);default:throw new Error("concat : unsupported type '"+O+"'")}}(R,C),y);I(w)}catch(O){m(O)}C=[]}).resume()})}function f(E,p,I){var m=p;switch(p){case"blob":case"arraybuffer":m="uint8array";break;case"base64":m="string"}try{this._internalType=m,this._outputType=p,this._mimeType=I,n.checkSupport(m),this._worker=E.pipe(new r(m)),E.lock()}catch(C){this._worker=new o("error"),this._worker.error(C)}}f.prototype={accumulate:function(E){return u(this,E)},on:function(E,p){var I=this;return E==="data"?this._worker.on(E,function(m){p.call(I,m.data,m.meta)}):this._worker.on(E,function(){n.delay(p,arguments,I)}),this},resume:function(){return n.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(E){if(n.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new d(this,{objectMode:this._outputType!=="nodebuffer"},E)}},e.exports=f},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,e,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",i.nodebuffer=typeof Buffer<"u",i.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")i.blob=!1;else{var n=new ArrayBuffer(0);try{i.blob=new Blob([n],{type:"application/zip"}).size===0}catch{try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);r.append(n),i.blob=r.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!t("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(t,e,i){for(var n=t("./utils"),r=t("./support"),o=t("./nodejsUtils"),a=t("./stream/GenericWorker"),l=new Array(256),h=0;h<256;h++)l[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;l[254]=l[254]=1;function d(){a.call(this,"utf-8 decode"),this.leftOver=null}function u(){a.call(this,"utf-8 encode")}i.utf8encode=function(f){return r.nodebuffer?o.newBufferFrom(f,"utf-8"):function(E){var p,I,m,C,R,g=E.length,y=0;for(C=0;C<g;C++)(64512&(I=E.charCodeAt(C)))==55296&&C+1<g&&(64512&(m=E.charCodeAt(C+1)))==56320&&(I=65536+(I-55296<<10)+(m-56320),C++),y+=I<128?1:I<2048?2:I<65536?3:4;for(p=r.uint8array?new Uint8Array(y):new Array(y),C=R=0;R<y;C++)(64512&(I=E.charCodeAt(C)))==55296&&C+1<g&&(64512&(m=E.charCodeAt(C+1)))==56320&&(I=65536+(I-55296<<10)+(m-56320),C++),I<128?p[R++]=I:(I<2048?p[R++]=192|I>>>6:(I<65536?p[R++]=224|I>>>12:(p[R++]=240|I>>>18,p[R++]=128|I>>>12&63),p[R++]=128|I>>>6&63),p[R++]=128|63&I);return p}(f)},i.utf8decode=function(f){return r.nodebuffer?n.transformTo("nodebuffer",f).toString("utf-8"):function(E){var p,I,m,C,R=E.length,g=new Array(2*R);for(p=I=0;p<R;)if((m=E[p++])<128)g[I++]=m;else if(4<(C=l[m]))g[I++]=65533,p+=C-1;else{for(m&=C===2?31:C===3?15:7;1<C&&p<R;)m=m<<6|63&E[p++],C--;1<C?g[I++]=65533:m<65536?g[I++]=m:(m-=65536,g[I++]=55296|m>>10&1023,g[I++]=56320|1023&m)}return g.length!==I&&(g.subarray?g=g.subarray(0,I):g.length=I),n.applyFromCharCode(g)}(f=n.transformTo(r.uint8array?"uint8array":"array",f))},n.inherits(d,a),d.prototype.processChunk=function(f){var E=n.transformTo(r.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(r.uint8array){var p=E;(E=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),E.set(p,this.leftOver.length)}else E=this.leftOver.concat(E);this.leftOver=null}var I=function(C,R){var g;for((R=R||C.length)>C.length&&(R=C.length),g=R-1;0<=g&&(192&C[g])==128;)g--;return g<0||g===0?R:g+l[C[g]]>R?g:R}(E),m=E;I!==E.length&&(r.uint8array?(m=E.subarray(0,I),this.leftOver=E.subarray(I,E.length)):(m=E.slice(0,I),this.leftOver=E.slice(I,E.length))),this.push({data:i.utf8decode(m),meta:f.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=d,n.inherits(u,a),u.prototype.processChunk=function(f){this.push({data:i.utf8encode(f.data),meta:f.meta})},i.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,e,i){var n=t("./support"),r=t("./base64"),o=t("./nodejsUtils"),a=t("./external");function l(p){return p}function h(p,I){for(var m=0;m<p.length;++m)I[m]=255&p.charCodeAt(m);return I}t("setimmediate"),i.newBlob=function(p,I){i.checkSupport("blob");try{return new Blob([p],{type:I})}catch{try{var m=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return m.append(p),m.getBlob(I)}catch{throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(p,I,m){var C=[],R=0,g=p.length;if(g<=m)return String.fromCharCode.apply(null,p);for(;R<g;)I==="array"||I==="nodebuffer"?C.push(String.fromCharCode.apply(null,p.slice(R,Math.min(R+m,g)))):C.push(String.fromCharCode.apply(null,p.subarray(R,Math.min(R+m,g)))),R+=m;return C.join("")},stringifyByChar:function(p){for(var I="",m=0;m<p.length;m++)I+=String.fromCharCode(p[m]);return I},applyCanBeUsed:{uint8array:function(){try{return n.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return n.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch{return!1}}()}};function u(p){var I=65536,m=i.getTypeOf(p),C=!0;if(m==="uint8array"?C=d.applyCanBeUsed.uint8array:m==="nodebuffer"&&(C=d.applyCanBeUsed.nodebuffer),C)for(;1<I;)try{return d.stringifyByChunk(p,m,I)}catch{I=Math.floor(I/2)}return d.stringifyByChar(p)}function f(p,I){for(var m=0;m<p.length;m++)I[m]=p[m];return I}i.applyFromCharCode=u;var E={};E.string={string:l,array:function(p){return h(p,new Array(p.length))},arraybuffer:function(p){return E.string.uint8array(p).buffer},uint8array:function(p){return h(p,new Uint8Array(p.length))},nodebuffer:function(p){return h(p,o.allocBuffer(p.length))}},E.array={string:u,array:l,arraybuffer:function(p){return new Uint8Array(p).buffer},uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return o.newBufferFrom(p)}},E.arraybuffer={string:function(p){return u(new Uint8Array(p))},array:function(p){return f(new Uint8Array(p),new Array(p.byteLength))},arraybuffer:l,uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return o.newBufferFrom(new Uint8Array(p))}},E.uint8array={string:u,array:function(p){return f(p,new Array(p.length))},arraybuffer:function(p){return p.buffer},uint8array:l,nodebuffer:function(p){return o.newBufferFrom(p)}},E.nodebuffer={string:u,array:function(p){return f(p,new Array(p.length))},arraybuffer:function(p){return E.nodebuffer.uint8array(p).buffer},uint8array:function(p){return f(p,new Uint8Array(p.length))},nodebuffer:l},i.transformTo=function(p,I){if(I=I||"",!p)return I;i.checkSupport(p);var m=i.getTypeOf(I);return E[m][p](I)},i.resolve=function(p){for(var I=p.split("/"),m=[],C=0;C<I.length;C++){var R=I[C];R==="."||R===""&&C!==0&&C!==I.length-1||(R===".."?m.pop():m.push(R))}return m.join("/")},i.getTypeOf=function(p){return typeof p=="string"?"string":Object.prototype.toString.call(p)==="[object Array]"?"array":n.nodebuffer&&o.isBuffer(p)?"nodebuffer":n.uint8array&&p instanceof Uint8Array?"uint8array":n.arraybuffer&&p instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(p){if(!n[p.toLowerCase()])throw new Error(p+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(p){var I,m,C="";for(m=0;m<(p||"").length;m++)C+="\\x"+((I=p.charCodeAt(m))<16?"0":"")+I.toString(16).toUpperCase();return C},i.delay=function(p,I,m){setImmediate(function(){p.apply(m||null,I||[])})},i.inherits=function(p,I){function m(){}m.prototype=I.prototype,p.prototype=new m},i.extend=function(){var p,I,m={};for(p=0;p<arguments.length;p++)for(I in arguments[p])Object.prototype.hasOwnProperty.call(arguments[p],I)&&m[I]===void 0&&(m[I]=arguments[p][I]);return m},i.prepareContent=function(p,I,m,C,R){return a.Promise.resolve(I).then(function(g){return n.blob&&(g instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(g))!==-1)&&typeof FileReader<"u"?new a.Promise(function(y,w){var O=new FileReader;O.onload=function(M){y(M.target.result)},O.onerror=function(M){w(M.target.error)},O.readAsArrayBuffer(g)}):g}).then(function(g){var y=i.getTypeOf(g);return y?(y==="arraybuffer"?g=i.transformTo("uint8array",g):y==="string"&&(R?g=r.decode(g):m&&C!==!0&&(g=function(w){return h(w,n.uint8array?new Uint8Array(w.length):new Array(w.length))}(g))),g):a.Promise.reject(new Error("Can't read the data of '"+p+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,e,i){var n=t("./reader/readerFor"),r=t("./utils"),o=t("./signature"),a=t("./zipEntry"),l=t("./support");function h(d){this.files=[],this.loadOptions=d}h.prototype={checkSignature:function(d){if(!this.reader.readAndCheckSignature(d)){this.reader.index-=4;var u=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+r.pretty(u)+", expected "+r.pretty(d)+")")}},isSignature:function(d,u){var f=this.reader.index;this.reader.setIndex(d);var E=this.reader.readString(4)===u;return this.reader.setIndex(f),E},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var d=this.reader.readData(this.zipCommentLength),u=l.uint8array?"uint8array":"array",f=r.transformTo(u,d);this.zipComment=this.loadOptions.decodeFileName(f)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var d,u,f,E=this.zip64EndOfCentralSize-44;0<E;)d=this.reader.readInt(2),u=this.reader.readInt(4),f=this.reader.readData(u),this.zip64ExtensibleData[d]={id:d,length:u,value:f}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var d,u;for(d=0;d<this.files.length;d++)u=this.files[d],this.reader.setIndex(u.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),u.readLocalPart(this.reader),u.handleUTF8(),u.processAttributes()},readCentralDir:function(){var d;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(d=new a({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(d);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var d=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(d<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(d);var u=d;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===r.MAX_VALUE_16BITS||this.diskWithCentralDirStart===r.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===r.MAX_VALUE_16BITS||this.centralDirRecords===r.MAX_VALUE_16BITS||this.centralDirSize===r.MAX_VALUE_32BITS||this.centralDirOffset===r.MAX_VALUE_32BITS){if(this.zip64=!0,(d=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(d),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var f=this.centralDirOffset+this.centralDirSize;this.zip64&&(f+=20,f+=12+this.zip64EndOfCentralSize);var E=u-f;if(0<E)this.isSignature(u,o.CENTRAL_FILE_HEADER)||(this.reader.zero=E);else if(E<0)throw new Error("Corrupted zip: missing "+Math.abs(E)+" bytes.")},prepareReader:function(d){this.reader=n(d)},load:function(d){this.prepareReader(d),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},e.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,e,i){var n=t("./reader/readerFor"),r=t("./utils"),o=t("./compressedObject"),a=t("./crc32"),l=t("./utf8"),h=t("./compressions"),d=t("./support");function u(f,E){this.options=f,this.loadOptions=E}u.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(f){var E,p;if(f.skip(22),this.fileNameLength=f.readInt(2),p=f.readInt(2),this.fileName=f.readData(this.fileNameLength),f.skip(p),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((E=function(I){for(var m in h)if(Object.prototype.hasOwnProperty.call(h,m)&&h[m].magic===I)return h[m];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+r.pretty(this.compressionMethod)+" unknown (inner file : "+r.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,E,f.readData(this.compressedSize))},readCentralPart:function(f){this.versionMadeBy=f.readInt(2),f.skip(2),this.bitFlag=f.readInt(2),this.compressionMethod=f.readString(2),this.date=f.readDate(),this.crc32=f.readInt(4),this.compressedSize=f.readInt(4),this.uncompressedSize=f.readInt(4);var E=f.readInt(2);if(this.extraFieldsLength=f.readInt(2),this.fileCommentLength=f.readInt(2),this.diskNumberStart=f.readInt(2),this.internalFileAttributes=f.readInt(2),this.externalFileAttributes=f.readInt(4),this.localHeaderOffset=f.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");f.skip(E),this.readExtraFields(f),this.parseZIP64ExtraField(f),this.fileComment=f.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var f=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=n(this.extraFields[1].value);this.uncompressedSize===r.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var E,p,I,m=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4<m;)E=f.readInt(2),p=f.readInt(2),I=f.readData(p),this.extraFields[E]={id:E,length:p,value:I};f.setIndex(m)},handleUTF8:function(){var f=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=l.utf8decode(this.fileName),this.fileCommentStr=l.utf8decode(this.fileComment);else{var E=this.findExtraFieldUnicodePath();if(E!==null)this.fileNameStr=E;else{var p=r.transformTo(f,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(p)}var I=this.findExtraFieldUnicodeComment();if(I!==null)this.fileCommentStr=I;else{var m=r.transformTo(f,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(m)}}},findExtraFieldUnicodePath:function(){var f=this.extraFields[28789];if(f){var E=n(f.value);return E.readInt(1)!==1||a(this.fileName)!==E.readInt(4)?null:l.utf8decode(E.readData(f.length-5))}return null},findExtraFieldUnicodeComment:function(){var f=this.extraFields[25461];if(f){var E=n(f.value);return E.readInt(1)!==1||a(this.fileComment)!==E.readInt(4)?null:l.utf8decode(E.readData(f.length-5))}return null}},e.exports=u},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,e,i){function n(E,p,I){this.name=E,this.dir=I.dir,this.date=I.date,this.comment=I.comment,this.unixPermissions=I.unixPermissions,this.dosPermissions=I.dosPermissions,this._data=p,this._dataBinary=I.binary,this.options={compression:I.compression,compressionOptions:I.compressionOptions}}var r=t("./stream/StreamHelper"),o=t("./stream/DataWorker"),a=t("./utf8"),l=t("./compressedObject"),h=t("./stream/GenericWorker");n.prototype={internalStream:function(E){var p=null,I="string";try{if(!E)throw new Error("No output type specified.");var m=(I=E.toLowerCase())==="string"||I==="text";I!=="binarystring"&&I!=="text"||(I="string"),p=this._decompressWorker();var C=!this._dataBinary;C&&!m&&(p=p.pipe(new a.Utf8EncodeWorker)),!C&&m&&(p=p.pipe(new a.Utf8DecodeWorker))}catch(R){(p=new h("error")).error(R)}return new r(p,I,"")},async:function(E,p){return this.internalStream(E).accumulate(p)},nodeStream:function(E,p){return this.internalStream(E||"nodebuffer").toNodejsStream(p)},_compressWorker:function(E,p){if(this._data instanceof l&&this._data.compression.magic===E.magic)return this._data.getCompressedWorker();var I=this._decompressWorker();return this._dataBinary||(I=I.pipe(new a.Utf8EncodeWorker)),l.createWorkerFrom(I,E,p)},_decompressWorker:function(){return this._data instanceof l?this._data.getContentWorker():this._data instanceof h?this._data:new o(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],u=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<d.length;f++)n.prototype[d[f]]=u;e.exports=n},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,e,i){(function(n){var r,o,a=n.MutationObserver||n.WebKitMutationObserver;if(a){var l=0,h=new a(E),d=n.document.createTextNode("");h.observe(d,{characterData:!0}),r=function(){d.data=l=++l%2}}else if(n.setImmediate||n.MessageChannel===void 0)r="document"in n&&"onreadystatechange"in n.document.createElement("script")?function(){var p=n.document.createElement("script");p.onreadystatechange=function(){E(),p.onreadystatechange=null,p.parentNode.removeChild(p),p=null},n.document.documentElement.appendChild(p)}:function(){setTimeout(E,0)};else{var u=new n.MessageChannel;u.port1.onmessage=E,r=function(){u.port2.postMessage(0)}}var f=[];function E(){var p,I;o=!0;for(var m=f.length;m;){for(I=f,f=[],p=-1;++p<m;)I[p]();m=f.length}o=!1}e.exports=function(p){f.push(p)!==1||o||r()}}).call(this,typeof $s<"u"?$s:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,e,i){var n=t("immediate");function r(){}var o={},a=["REJECTED"],l=["FULFILLED"],h=["PENDING"];function d(m){if(typeof m!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,m!==r&&p(this,m)}function u(m,C,R){this.promise=m,typeof C=="function"&&(this.onFulfilled=C,this.callFulfilled=this.otherCallFulfilled),typeof R=="function"&&(this.onRejected=R,this.callRejected=this.otherCallRejected)}function f(m,C,R){n(function(){var g;try{g=C(R)}catch(y){return o.reject(m,y)}g===m?o.reject(m,new TypeError("Cannot resolve promise with itself")):o.resolve(m,g)})}function E(m){var C=m&&m.then;if(m&&(typeof m=="object"||typeof m=="function")&&typeof C=="function")return function(){C.apply(m,arguments)}}function p(m,C){var R=!1;function g(O){R||(R=!0,o.reject(m,O))}function y(O){R||(R=!0,o.resolve(m,O))}var w=I(function(){C(y,g)});w.status==="error"&&g(w.value)}function I(m,C){var R={};try{R.value=m(C),R.status="success"}catch(g){R.status="error",R.value=g}return R}(e.exports=d).prototype.finally=function(m){if(typeof m!="function")return this;var C=this.constructor;return this.then(function(R){return C.resolve(m()).then(function(){return R})},function(R){return C.resolve(m()).then(function(){throw R})})},d.prototype.catch=function(m){return this.then(null,m)},d.prototype.then=function(m,C){if(typeof m!="function"&&this.state===l||typeof C!="function"&&this.state===a)return this;var R=new this.constructor(r);return this.state!==h?f(R,this.state===l?m:C,this.outcome):this.queue.push(new u(R,m,C)),R},u.prototype.callFulfilled=function(m){o.resolve(this.promise,m)},u.prototype.otherCallFulfilled=function(m){f(this.promise,this.onFulfilled,m)},u.prototype.callRejected=function(m){o.reject(this.promise,m)},u.prototype.otherCallRejected=function(m){f(this.promise,this.onRejected,m)},o.resolve=function(m,C){var R=I(E,C);if(R.status==="error")return o.reject(m,R.value);var g=R.value;if(g)p(m,g);else{m.state=l,m.outcome=C;for(var y=-1,w=m.queue.length;++y<w;)m.queue[y].callFulfilled(C)}return m},o.reject=function(m,C){m.state=a,m.outcome=C;for(var R=-1,g=m.queue.length;++R<g;)m.queue[R].callRejected(C);return m},d.resolve=function(m){return m instanceof this?m:o.resolve(new this(r),m)},d.reject=function(m){var C=new this(r);return o.reject(C,m)},d.all=function(m){var C=this;if(Object.prototype.toString.call(m)!=="[object Array]")return this.reject(new TypeError("must be an array"));var R=m.length,g=!1;if(!R)return this.resolve([]);for(var y=new Array(R),w=0,O=-1,M=new this(r);++O<R;)b(m[O],O);return M;function b(v,k){C.resolve(v).then(function(F){y[k]=F,++w!==R||g||(g=!0,o.resolve(M,y))},function(F){g||(g=!0,o.reject(M,F))})}},d.race=function(m){var C=this;if(Object.prototype.toString.call(m)!=="[object Array]")return this.reject(new TypeError("must be an array"));var R=m.length,g=!1;if(!R)return this.resolve([]);for(var y=-1,w=new this(r);++y<R;)O=m[y],C.resolve(O).then(function(M){g||(g=!0,o.resolve(w,M))},function(M){g||(g=!0,o.reject(w,M))});var O;return w}},{immediate:36}],38:[function(t,e,i){var n={};(0,t("./lib/utils/common").assign)(n,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),e.exports=n},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,e,i){var n=t("./zlib/deflate"),r=t("./utils/common"),o=t("./utils/strings"),a=t("./zlib/messages"),l=t("./zlib/zstream"),h=Object.prototype.toString,d=0,u=-1,f=0,E=8;function p(m){if(!(this instanceof p))return new p(m);this.options=r.assign({level:u,method:E,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,to:""},m||{});var C=this.options;C.raw&&0<C.windowBits?C.windowBits=-C.windowBits:C.gzip&&0<C.windowBits&&C.windowBits<16&&(C.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var R=n.deflateInit2(this.strm,C.level,C.method,C.windowBits,C.memLevel,C.strategy);if(R!==d)throw new Error(a[R]);if(C.header&&n.deflateSetHeader(this.strm,C.header),C.dictionary){var g;if(g=typeof C.dictionary=="string"?o.string2buf(C.dictionary):h.call(C.dictionary)==="[object ArrayBuffer]"?new Uint8Array(C.dictionary):C.dictionary,(R=n.deflateSetDictionary(this.strm,g))!==d)throw new Error(a[R]);this._dict_set=!0}}function I(m,C){var R=new p(C);if(R.push(m,!0),R.err)throw R.msg||a[R.err];return R.result}p.prototype.push=function(m,C){var R,g,y=this.strm,w=this.options.chunkSize;if(this.ended)return!1;g=C===~~C?C:C===!0?4:0,typeof m=="string"?y.input=o.string2buf(m):h.call(m)==="[object ArrayBuffer]"?y.input=new Uint8Array(m):y.input=m,y.next_in=0,y.avail_in=y.input.length;do{if(y.avail_out===0&&(y.output=new r.Buf8(w),y.next_out=0,y.avail_out=w),(R=n.deflate(y,g))!==1&&R!==d)return this.onEnd(R),!(this.ended=!0);y.avail_out!==0&&(y.avail_in!==0||g!==4&&g!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(r.shrinkBuf(y.output,y.next_out))):this.onData(r.shrinkBuf(y.output,y.next_out)))}while((0<y.avail_in||y.avail_out===0)&&R!==1);return g===4?(R=n.deflateEnd(this.strm),this.onEnd(R),this.ended=!0,R===d):g!==2||(this.onEnd(d),!(y.avail_out=0))},p.prototype.onData=function(m){this.chunks.push(m)},p.prototype.onEnd=function(m){m===d&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},i.Deflate=p,i.deflate=I,i.deflateRaw=function(m,C){return(C=C||{}).raw=!0,I(m,C)},i.gzip=function(m,C){return(C=C||{}).gzip=!0,I(m,C)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,e,i){var n=t("./zlib/inflate"),r=t("./utils/common"),o=t("./utils/strings"),a=t("./zlib/constants"),l=t("./zlib/messages"),h=t("./zlib/zstream"),d=t("./zlib/gzheader"),u=Object.prototype.toString;function f(p){if(!(this instanceof f))return new f(p);this.options=r.assign({chunkSize:16384,windowBits:0,to:""},p||{});var I=this.options;I.raw&&0<=I.windowBits&&I.windowBits<16&&(I.windowBits=-I.windowBits,I.windowBits===0&&(I.windowBits=-15)),!(0<=I.windowBits&&I.windowBits<16)||p&&p.windowBits||(I.windowBits+=32),15<I.windowBits&&I.windowBits<48&&!(15&I.windowBits)&&(I.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var m=n.inflateInit2(this.strm,I.windowBits);if(m!==a.Z_OK)throw new Error(l[m]);this.header=new d,n.inflateGetHeader(this.strm,this.header)}function E(p,I){var m=new f(I);if(m.push(p,!0),m.err)throw m.msg||l[m.err];return m.result}f.prototype.push=function(p,I){var m,C,R,g,y,w,O=this.strm,M=this.options.chunkSize,b=this.options.dictionary,v=!1;if(this.ended)return!1;C=I===~~I?I:I===!0?a.Z_FINISH:a.Z_NO_FLUSH,typeof p=="string"?O.input=o.binstring2buf(p):u.call(p)==="[object ArrayBuffer]"?O.input=new Uint8Array(p):O.input=p,O.next_in=0,O.avail_in=O.input.length;do{if(O.avail_out===0&&(O.output=new r.Buf8(M),O.next_out=0,O.avail_out=M),(m=n.inflate(O,a.Z_NO_FLUSH))===a.Z_NEED_DICT&&b&&(w=typeof b=="string"?o.string2buf(b):u.call(b)==="[object ArrayBuffer]"?new Uint8Array(b):b,m=n.inflateSetDictionary(this.strm,w)),m===a.Z_BUF_ERROR&&v===!0&&(m=a.Z_OK,v=!1),m!==a.Z_STREAM_END&&m!==a.Z_OK)return this.onEnd(m),!(this.ended=!0);O.next_out&&(O.avail_out!==0&&m!==a.Z_STREAM_END&&(O.avail_in!==0||C!==a.Z_FINISH&&C!==a.Z_SYNC_FLUSH)||(this.options.to==="string"?(R=o.utf8border(O.output,O.next_out),g=O.next_out-R,y=o.buf2string(O.output,R),O.next_out=g,O.avail_out=M-g,g&&r.arraySet(O.output,O.output,R,g,0),this.onData(y)):this.onData(r.shrinkBuf(O.output,O.next_out)))),O.avail_in===0&&O.avail_out===0&&(v=!0)}while((0<O.avail_in||O.avail_out===0)&&m!==a.Z_STREAM_END);return m===a.Z_STREAM_END&&(C=a.Z_FINISH),C===a.Z_FINISH?(m=n.inflateEnd(this.strm),this.onEnd(m),this.ended=!0,m===a.Z_OK):C!==a.Z_SYNC_FLUSH||(this.onEnd(a.Z_OK),!(O.avail_out=0))},f.prototype.onData=function(p){this.chunks.push(p)},f.prototype.onEnd=function(p){p===a.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=p,this.msg=this.strm.msg},i.Inflate=f,i.inflate=E,i.inflateRaw=function(p,I){return(I=I||{}).raw=!0,E(p,I)},i.ungzip=E},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,e,i){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";i.assign=function(a){for(var l=Array.prototype.slice.call(arguments,1);l.length;){var h=l.shift();if(h){if(typeof h!="object")throw new TypeError(h+"must be non-object");for(var d in h)h.hasOwnProperty(d)&&(a[d]=h[d])}}return a},i.shrinkBuf=function(a,l){return a.length===l?a:a.subarray?a.subarray(0,l):(a.length=l,a)};var r={arraySet:function(a,l,h,d,u){if(l.subarray&&a.subarray)a.set(l.subarray(h,h+d),u);else for(var f=0;f<d;f++)a[u+f]=l[h+f]},flattenChunks:function(a){var l,h,d,u,f,E;for(l=d=0,h=a.length;l<h;l++)d+=a[l].length;for(E=new Uint8Array(d),l=u=0,h=a.length;l<h;l++)f=a[l],E.set(f,u),u+=f.length;return E}},o={arraySet:function(a,l,h,d,u){for(var f=0;f<d;f++)a[u+f]=l[h+f]},flattenChunks:function(a){return[].concat.apply([],a)}};i.setTyped=function(a){a?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,r)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,o))},i.setTyped(n)},{}],42:[function(t,e,i){var n=t("./common"),r=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{r=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var a=new n.Buf8(256),l=0;l<256;l++)a[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function h(d,u){if(u<65537&&(d.subarray&&o||!d.subarray&&r))return String.fromCharCode.apply(null,n.shrinkBuf(d,u));for(var f="",E=0;E<u;E++)f+=String.fromCharCode(d[E]);return f}a[254]=a[254]=1,i.string2buf=function(d){var u,f,E,p,I,m=d.length,C=0;for(p=0;p<m;p++)(64512&(f=d.charCodeAt(p)))==55296&&p+1<m&&(64512&(E=d.charCodeAt(p+1)))==56320&&(f=65536+(f-55296<<10)+(E-56320),p++),C+=f<128?1:f<2048?2:f<65536?3:4;for(u=new n.Buf8(C),p=I=0;I<C;p++)(64512&(f=d.charCodeAt(p)))==55296&&p+1<m&&(64512&(E=d.charCodeAt(p+1)))==56320&&(f=65536+(f-55296<<10)+(E-56320),p++),f<128?u[I++]=f:(f<2048?u[I++]=192|f>>>6:(f<65536?u[I++]=224|f>>>12:(u[I++]=240|f>>>18,u[I++]=128|f>>>12&63),u[I++]=128|f>>>6&63),u[I++]=128|63&f);return u},i.buf2binstring=function(d){return h(d,d.length)},i.binstring2buf=function(d){for(var u=new n.Buf8(d.length),f=0,E=u.length;f<E;f++)u[f]=d.charCodeAt(f);return u},i.buf2string=function(d,u){var f,E,p,I,m=u||d.length,C=new Array(2*m);for(f=E=0;f<m;)if((p=d[f++])<128)C[E++]=p;else if(4<(I=a[p]))C[E++]=65533,f+=I-1;else{for(p&=I===2?31:I===3?15:7;1<I&&f<m;)p=p<<6|63&d[f++],I--;1<I?C[E++]=65533:p<65536?C[E++]=p:(p-=65536,C[E++]=55296|p>>10&1023,C[E++]=56320|1023&p)}return h(C,E)},i.utf8border=function(d,u){var f;for((u=u||d.length)>d.length&&(u=d.length),f=u-1;0<=f&&(192&d[f])==128;)f--;return f<0||f===0?u:f+a[d[f]]>u?f:u}},{"./common":41}],43:[function(t,e,i){e.exports=function(n,r,o,a){for(var l=65535&n|0,h=n>>>16&65535|0,d=0;o!==0;){for(o-=d=2e3<o?2e3:o;h=h+(l=l+r[a++]|0)|0,--d;);l%=65521,h%=65521}return l|h<<16|0}},{}],44:[function(t,e,i){e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(t,e,i){var n=function(){for(var r,o=[],a=0;a<256;a++){r=a;for(var l=0;l<8;l++)r=1&r?3988292384^r>>>1:r>>>1;o[a]=r}return o}();e.exports=function(r,o,a,l){var h=n,d=l+a;r^=-1;for(var u=l;u<d;u++)r=r>>>8^h[255&(r^o[u])];return-1^r}},{}],46:[function(t,e,i){var n,r=t("../utils/common"),o=t("./trees"),a=t("./adler32"),l=t("./crc32"),h=t("./messages"),d=0,u=4,f=0,E=-2,p=-1,I=4,m=2,C=8,R=9,g=286,y=30,w=19,O=2*g+1,M=15,b=3,v=258,k=v+b+1,F=42,L=113,T=1,D=2,q=3,G=4;function et(A,X){return A.msg=h[X],X}function W(A){return(A<<1)-(4<A?9:0)}function nt(A){for(var X=A.length;0<=--X;)A[X]=0}function V(A){var X=A.state,Y=X.pending;Y>A.avail_out&&(Y=A.avail_out),Y!==0&&(r.arraySet(A.output,X.pending_buf,X.pending_out,Y,A.next_out),A.next_out+=Y,X.pending_out+=Y,A.total_out+=Y,A.avail_out-=Y,X.pending-=Y,X.pending===0&&(X.pending_out=0))}function B(A,X){o._tr_flush_block(A,0<=A.block_start?A.block_start:-1,A.strstart-A.block_start,X),A.block_start=A.strstart,V(A.strm)}function rt(A,X){A.pending_buf[A.pending++]=X}function st(A,X){A.pending_buf[A.pending++]=X>>>8&255,A.pending_buf[A.pending++]=255&X}function tt(A,X){var Y,P,N=A.max_chain_length,U=A.strstart,$=A.prev_length,j=A.nice_match,z=A.strstart>A.w_size-k?A.strstart-(A.w_size-k):0,K=A.window,it=A.w_mask,J=A.prev,at=A.strstart+v,Ct=K[U+$-1],ft=K[U+$];A.prev_length>=A.good_match&&(N>>=2),j>A.lookahead&&(j=A.lookahead);do if(K[(Y=X)+$]===ft&&K[Y+$-1]===Ct&&K[Y]===K[U]&&K[++Y]===K[U+1]){U+=2,Y++;do;while(K[++U]===K[++Y]&&K[++U]===K[++Y]&&K[++U]===K[++Y]&&K[++U]===K[++Y]&&K[++U]===K[++Y]&&K[++U]===K[++Y]&&K[++U]===K[++Y]&&K[++U]===K[++Y]&&U<at);if(P=v-(at-U),U=at-v,$<P){if(A.match_start=X,j<=($=P))break;Ct=K[U+$-1],ft=K[U+$]}}while((X=J[X&it])>z&&--N!=0);return $<=A.lookahead?$:A.lookahead}function At(A){var X,Y,P,N,U,$,j,z,K,it,J=A.w_size;do{if(N=A.window_size-A.lookahead-A.strstart,A.strstart>=J+(J-k)){for(r.arraySet(A.window,A.window,J,J,0),A.match_start-=J,A.strstart-=J,A.block_start-=J,X=Y=A.hash_size;P=A.head[--X],A.head[X]=J<=P?P-J:0,--Y;);for(X=Y=J;P=A.prev[--X],A.prev[X]=J<=P?P-J:0,--Y;);N+=J}if(A.strm.avail_in===0)break;if($=A.strm,j=A.window,z=A.strstart+A.lookahead,K=N,it=void 0,it=$.avail_in,K<it&&(it=K),Y=it===0?0:($.avail_in-=it,r.arraySet(j,$.input,$.next_in,it,z),$.state.wrap===1?$.adler=a($.adler,j,it,z):$.state.wrap===2&&($.adler=l($.adler,j,it,z)),$.next_in+=it,$.total_in+=it,it),A.lookahead+=Y,A.lookahead+A.insert>=b)for(U=A.strstart-A.insert,A.ins_h=A.window[U],A.ins_h=(A.ins_h<<A.hash_shift^A.window[U+1])&A.hash_mask;A.insert&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[U+b-1])&A.hash_mask,A.prev[U&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=U,U++,A.insert--,!(A.lookahead+A.insert<b)););}while(A.lookahead<k&&A.strm.avail_in!==0)}function wt(A,X){for(var Y,P;;){if(A.lookahead<k){if(At(A),A.lookahead<k&&X===d)return T;if(A.lookahead===0)break}if(Y=0,A.lookahead>=b&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+b-1])&A.hash_mask,Y=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),Y!==0&&A.strstart-Y<=A.w_size-k&&(A.match_length=tt(A,Y)),A.match_length>=b)if(P=o._tr_tally(A,A.strstart-A.match_start,A.match_length-b),A.lookahead-=A.match_length,A.match_length<=A.max_lazy_match&&A.lookahead>=b){for(A.match_length--;A.strstart++,A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+b-1])&A.hash_mask,Y=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart,--A.match_length!=0;);A.strstart++}else A.strstart+=A.match_length,A.match_length=0,A.ins_h=A.window[A.strstart],A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+1])&A.hash_mask;else P=o._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if(P&&(B(A,!1),A.strm.avail_out===0))return T}return A.insert=A.strstart<b-1?A.strstart:b-1,X===u?(B(A,!0),A.strm.avail_out===0?q:G):A.last_lit&&(B(A,!1),A.strm.avail_out===0)?T:D}function ot(A,X){for(var Y,P,N;;){if(A.lookahead<k){if(At(A),A.lookahead<k&&X===d)return T;if(A.lookahead===0)break}if(Y=0,A.lookahead>=b&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+b-1])&A.hash_mask,Y=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),A.prev_length=A.match_length,A.prev_match=A.match_start,A.match_length=b-1,Y!==0&&A.prev_length<A.max_lazy_match&&A.strstart-Y<=A.w_size-k&&(A.match_length=tt(A,Y),A.match_length<=5&&(A.strategy===1||A.match_length===b&&4096<A.strstart-A.match_start)&&(A.match_length=b-1)),A.prev_length>=b&&A.match_length<=A.prev_length){for(N=A.strstart+A.lookahead-b,P=o._tr_tally(A,A.strstart-1-A.prev_match,A.prev_length-b),A.lookahead-=A.prev_length-1,A.prev_length-=2;++A.strstart<=N&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+b-1])&A.hash_mask,Y=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),--A.prev_length!=0;);if(A.match_available=0,A.match_length=b-1,A.strstart++,P&&(B(A,!1),A.strm.avail_out===0))return T}else if(A.match_available){if((P=o._tr_tally(A,0,A.window[A.strstart-1]))&&B(A,!1),A.strstart++,A.lookahead--,A.strm.avail_out===0)return T}else A.match_available=1,A.strstart++,A.lookahead--}return A.match_available&&(P=o._tr_tally(A,0,A.window[A.strstart-1]),A.match_available=0),A.insert=A.strstart<b-1?A.strstart:b-1,X===u?(B(A,!0),A.strm.avail_out===0?q:G):A.last_lit&&(B(A,!1),A.strm.avail_out===0)?T:D}function ut(A,X,Y,P,N){this.good_length=A,this.max_lazy=X,this.nice_length=Y,this.max_chain=P,this.func=N}function dt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=C,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new r.Buf16(2*O),this.dyn_dtree=new r.Buf16(2*(2*y+1)),this.bl_tree=new r.Buf16(2*(2*w+1)),nt(this.dyn_ltree),nt(this.dyn_dtree),nt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new r.Buf16(M+1),this.heap=new r.Buf16(2*g+1),nt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new r.Buf16(2*g+1),nt(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function mt(A){var X;return A&&A.state?(A.total_in=A.total_out=0,A.data_type=m,(X=A.state).pending=0,X.pending_out=0,X.wrap<0&&(X.wrap=-X.wrap),X.status=X.wrap?F:L,A.adler=X.wrap===2?0:1,X.last_flush=d,o._tr_init(X),f):et(A,E)}function Vt(A){var X=mt(A);return X===f&&function(Y){Y.window_size=2*Y.w_size,nt(Y.head),Y.max_lazy_match=n[Y.level].max_lazy,Y.good_match=n[Y.level].good_length,Y.nice_match=n[Y.level].nice_length,Y.max_chain_length=n[Y.level].max_chain,Y.strstart=0,Y.block_start=0,Y.lookahead=0,Y.insert=0,Y.match_length=Y.prev_length=b-1,Y.match_available=0,Y.ins_h=0}(A.state),X}function Lt(A,X,Y,P,N,U){if(!A)return E;var $=1;if(X===p&&(X=6),P<0?($=0,P=-P):15<P&&($=2,P-=16),N<1||R<N||Y!==C||P<8||15<P||X<0||9<X||U<0||I<U)return et(A,E);P===8&&(P=9);var j=new dt;return(A.state=j).strm=A,j.wrap=$,j.gzhead=null,j.w_bits=P,j.w_size=1<<j.w_bits,j.w_mask=j.w_size-1,j.hash_bits=N+7,j.hash_size=1<<j.hash_bits,j.hash_mask=j.hash_size-1,j.hash_shift=~~((j.hash_bits+b-1)/b),j.window=new r.Buf8(2*j.w_size),j.head=new r.Buf16(j.hash_size),j.prev=new r.Buf16(j.w_size),j.lit_bufsize=1<<N+6,j.pending_buf_size=4*j.lit_bufsize,j.pending_buf=new r.Buf8(j.pending_buf_size),j.d_buf=1*j.lit_bufsize,j.l_buf=3*j.lit_bufsize,j.level=X,j.strategy=U,j.method=Y,Vt(A)}n=[new ut(0,0,0,0,function(A,X){var Y=65535;for(Y>A.pending_buf_size-5&&(Y=A.pending_buf_size-5);;){if(A.lookahead<=1){if(At(A),A.lookahead===0&&X===d)return T;if(A.lookahead===0)break}A.strstart+=A.lookahead,A.lookahead=0;var P=A.block_start+Y;if((A.strstart===0||A.strstart>=P)&&(A.lookahead=A.strstart-P,A.strstart=P,B(A,!1),A.strm.avail_out===0)||A.strstart-A.block_start>=A.w_size-k&&(B(A,!1),A.strm.avail_out===0))return T}return A.insert=0,X===u?(B(A,!0),A.strm.avail_out===0?q:G):(A.strstart>A.block_start&&(B(A,!1),A.strm.avail_out),T)}),new ut(4,4,8,4,wt),new ut(4,5,16,8,wt),new ut(4,6,32,32,wt),new ut(4,4,16,16,ot),new ut(8,16,32,32,ot),new ut(8,16,128,128,ot),new ut(8,32,128,256,ot),new ut(32,128,258,1024,ot),new ut(32,258,258,4096,ot)],i.deflateInit=function(A,X){return Lt(A,X,C,15,8,0)},i.deflateInit2=Lt,i.deflateReset=Vt,i.deflateResetKeep=mt,i.deflateSetHeader=function(A,X){return A&&A.state?A.state.wrap!==2?E:(A.state.gzhead=X,f):E},i.deflate=function(A,X){var Y,P,N,U;if(!A||!A.state||5<X||X<0)return A?et(A,E):E;if(P=A.state,!A.output||!A.input&&A.avail_in!==0||P.status===666&&X!==u)return et(A,A.avail_out===0?-5:E);if(P.strm=A,Y=P.last_flush,P.last_flush=X,P.status===F)if(P.wrap===2)A.adler=0,rt(P,31),rt(P,139),rt(P,8),P.gzhead?(rt(P,(P.gzhead.text?1:0)+(P.gzhead.hcrc?2:0)+(P.gzhead.extra?4:0)+(P.gzhead.name?8:0)+(P.gzhead.comment?16:0)),rt(P,255&P.gzhead.time),rt(P,P.gzhead.time>>8&255),rt(P,P.gzhead.time>>16&255),rt(P,P.gzhead.time>>24&255),rt(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),rt(P,255&P.gzhead.os),P.gzhead.extra&&P.gzhead.extra.length&&(rt(P,255&P.gzhead.extra.length),rt(P,P.gzhead.extra.length>>8&255)),P.gzhead.hcrc&&(A.adler=l(A.adler,P.pending_buf,P.pending,0)),P.gzindex=0,P.status=69):(rt(P,0),rt(P,0),rt(P,0),rt(P,0),rt(P,0),rt(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),rt(P,3),P.status=L);else{var $=C+(P.w_bits-8<<4)<<8;$|=(2<=P.strategy||P.level<2?0:P.level<6?1:P.level===6?2:3)<<6,P.strstart!==0&&($|=32),$+=31-$%31,P.status=L,st(P,$),P.strstart!==0&&(st(P,A.adler>>>16),st(P,65535&A.adler)),A.adler=1}if(P.status===69)if(P.gzhead.extra){for(N=P.pending;P.gzindex<(65535&P.gzhead.extra.length)&&(P.pending!==P.pending_buf_size||(P.gzhead.hcrc&&P.pending>N&&(A.adler=l(A.adler,P.pending_buf,P.pending-N,N)),V(A),N=P.pending,P.pending!==P.pending_buf_size));)rt(P,255&P.gzhead.extra[P.gzindex]),P.gzindex++;P.gzhead.hcrc&&P.pending>N&&(A.adler=l(A.adler,P.pending_buf,P.pending-N,N)),P.gzindex===P.gzhead.extra.length&&(P.gzindex=0,P.status=73)}else P.status=73;if(P.status===73)if(P.gzhead.name){N=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>N&&(A.adler=l(A.adler,P.pending_buf,P.pending-N,N)),V(A),N=P.pending,P.pending===P.pending_buf_size)){U=1;break}U=P.gzindex<P.gzhead.name.length?255&P.gzhead.name.charCodeAt(P.gzindex++):0,rt(P,U)}while(U!==0);P.gzhead.hcrc&&P.pending>N&&(A.adler=l(A.adler,P.pending_buf,P.pending-N,N)),U===0&&(P.gzindex=0,P.status=91)}else P.status=91;if(P.status===91)if(P.gzhead.comment){N=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>N&&(A.adler=l(A.adler,P.pending_buf,P.pending-N,N)),V(A),N=P.pending,P.pending===P.pending_buf_size)){U=1;break}U=P.gzindex<P.gzhead.comment.length?255&P.gzhead.comment.charCodeAt(P.gzindex++):0,rt(P,U)}while(U!==0);P.gzhead.hcrc&&P.pending>N&&(A.adler=l(A.adler,P.pending_buf,P.pending-N,N)),U===0&&(P.status=103)}else P.status=103;if(P.status===103&&(P.gzhead.hcrc?(P.pending+2>P.pending_buf_size&&V(A),P.pending+2<=P.pending_buf_size&&(rt(P,255&A.adler),rt(P,A.adler>>8&255),A.adler=0,P.status=L)):P.status=L),P.pending!==0){if(V(A),A.avail_out===0)return P.last_flush=-1,f}else if(A.avail_in===0&&W(X)<=W(Y)&&X!==u)return et(A,-5);if(P.status===666&&A.avail_in!==0)return et(A,-5);if(A.avail_in!==0||P.lookahead!==0||X!==d&&P.status!==666){var j=P.strategy===2?function(z,K){for(var it;;){if(z.lookahead===0&&(At(z),z.lookahead===0)){if(K===d)return T;break}if(z.match_length=0,it=o._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++,it&&(B(z,!1),z.strm.avail_out===0))return T}return z.insert=0,K===u?(B(z,!0),z.strm.avail_out===0?q:G):z.last_lit&&(B(z,!1),z.strm.avail_out===0)?T:D}(P,X):P.strategy===3?function(z,K){for(var it,J,at,Ct,ft=z.window;;){if(z.lookahead<=v){if(At(z),z.lookahead<=v&&K===d)return T;if(z.lookahead===0)break}if(z.match_length=0,z.lookahead>=b&&0<z.strstart&&(J=ft[at=z.strstart-1])===ft[++at]&&J===ft[++at]&&J===ft[++at]){Ct=z.strstart+v;do;while(J===ft[++at]&&J===ft[++at]&&J===ft[++at]&&J===ft[++at]&&J===ft[++at]&&J===ft[++at]&&J===ft[++at]&&J===ft[++at]&&at<Ct);z.match_length=v-(Ct-at),z.match_length>z.lookahead&&(z.match_length=z.lookahead)}if(z.match_length>=b?(it=o._tr_tally(z,1,z.match_length-b),z.lookahead-=z.match_length,z.strstart+=z.match_length,z.match_length=0):(it=o._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++),it&&(B(z,!1),z.strm.avail_out===0))return T}return z.insert=0,K===u?(B(z,!0),z.strm.avail_out===0?q:G):z.last_lit&&(B(z,!1),z.strm.avail_out===0)?T:D}(P,X):n[P.level].func(P,X);if(j!==q&&j!==G||(P.status=666),j===T||j===q)return A.avail_out===0&&(P.last_flush=-1),f;if(j===D&&(X===1?o._tr_align(P):X!==5&&(o._tr_stored_block(P,0,0,!1),X===3&&(nt(P.head),P.lookahead===0&&(P.strstart=0,P.block_start=0,P.insert=0))),V(A),A.avail_out===0))return P.last_flush=-1,f}return X!==u?f:P.wrap<=0?1:(P.wrap===2?(rt(P,255&A.adler),rt(P,A.adler>>8&255),rt(P,A.adler>>16&255),rt(P,A.adler>>24&255),rt(P,255&A.total_in),rt(P,A.total_in>>8&255),rt(P,A.total_in>>16&255),rt(P,A.total_in>>24&255)):(st(P,A.adler>>>16),st(P,65535&A.adler)),V(A),0<P.wrap&&(P.wrap=-P.wrap),P.pending!==0?f:1)},i.deflateEnd=function(A){var X;return A&&A.state?(X=A.state.status)!==F&&X!==69&&X!==73&&X!==91&&X!==103&&X!==L&&X!==666?et(A,E):(A.state=null,X===L?et(A,-3):f):E},i.deflateSetDictionary=function(A,X){var Y,P,N,U,$,j,z,K,it=X.length;if(!A||!A.state||(U=(Y=A.state).wrap)===2||U===1&&Y.status!==F||Y.lookahead)return E;for(U===1&&(A.adler=a(A.adler,X,it,0)),Y.wrap=0,it>=Y.w_size&&(U===0&&(nt(Y.head),Y.strstart=0,Y.block_start=0,Y.insert=0),K=new r.Buf8(Y.w_size),r.arraySet(K,X,it-Y.w_size,Y.w_size,0),X=K,it=Y.w_size),$=A.avail_in,j=A.next_in,z=A.input,A.avail_in=it,A.next_in=0,A.input=X,At(Y);Y.lookahead>=b;){for(P=Y.strstart,N=Y.lookahead-(b-1);Y.ins_h=(Y.ins_h<<Y.hash_shift^Y.window[P+b-1])&Y.hash_mask,Y.prev[P&Y.w_mask]=Y.head[Y.ins_h],Y.head[Y.ins_h]=P,P++,--N;);Y.strstart=P,Y.lookahead=b-1,At(Y)}return Y.strstart+=Y.lookahead,Y.block_start=Y.strstart,Y.insert=Y.lookahead,Y.lookahead=0,Y.match_length=Y.prev_length=b-1,Y.match_available=0,A.next_in=j,A.input=z,A.avail_in=$,Y.wrap=U,f},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,e,i){e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(t,e,i){e.exports=function(n,r){var o,a,l,h,d,u,f,E,p,I,m,C,R,g,y,w,O,M,b,v,k,F,L,T,D;o=n.state,a=n.next_in,T=n.input,l=a+(n.avail_in-5),h=n.next_out,D=n.output,d=h-(r-n.avail_out),u=h+(n.avail_out-257),f=o.dmax,E=o.wsize,p=o.whave,I=o.wnext,m=o.window,C=o.hold,R=o.bits,g=o.lencode,y=o.distcode,w=(1<<o.lenbits)-1,O=(1<<o.distbits)-1;t:do{R<15&&(C+=T[a++]<<R,R+=8,C+=T[a++]<<R,R+=8),M=g[C&w];e:for(;;){if(C>>>=b=M>>>24,R-=b,(b=M>>>16&255)===0)D[h++]=65535&M;else{if(!(16&b)){if(!(64&b)){M=g[(65535&M)+(C&(1<<b)-1)];continue e}if(32&b){o.mode=12;break t}n.msg="invalid literal/length code",o.mode=30;break t}v=65535&M,(b&=15)&&(R<b&&(C+=T[a++]<<R,R+=8),v+=C&(1<<b)-1,C>>>=b,R-=b),R<15&&(C+=T[a++]<<R,R+=8,C+=T[a++]<<R,R+=8),M=y[C&O];s:for(;;){if(C>>>=b=M>>>24,R-=b,!(16&(b=M>>>16&255))){if(!(64&b)){M=y[(65535&M)+(C&(1<<b)-1)];continue s}n.msg="invalid distance code",o.mode=30;break t}if(k=65535&M,R<(b&=15)&&(C+=T[a++]<<R,(R+=8)<b&&(C+=T[a++]<<R,R+=8)),f<(k+=C&(1<<b)-1)){n.msg="invalid distance too far back",o.mode=30;break t}if(C>>>=b,R-=b,(b=h-d)<k){if(p<(b=k-b)&&o.sane){n.msg="invalid distance too far back",o.mode=30;break t}if(L=m,(F=0)===I){if(F+=E-b,b<v){for(v-=b;D[h++]=m[F++],--b;);F=h-k,L=D}}else if(I<b){if(F+=E+I-b,(b-=I)<v){for(v-=b;D[h++]=m[F++],--b;);if(F=0,I<v){for(v-=b=I;D[h++]=m[F++],--b;);F=h-k,L=D}}}else if(F+=I-b,b<v){for(v-=b;D[h++]=m[F++],--b;);F=h-k,L=D}for(;2<v;)D[h++]=L[F++],D[h++]=L[F++],D[h++]=L[F++],v-=3;v&&(D[h++]=L[F++],1<v&&(D[h++]=L[F++]))}else{for(F=h-k;D[h++]=D[F++],D[h++]=D[F++],D[h++]=D[F++],2<(v-=3););v&&(D[h++]=D[F++],1<v&&(D[h++]=D[F++]))}break}}break}}while(a<l&&h<u);a-=v=R>>3,C&=(1<<(R-=v<<3))-1,n.next_in=a,n.next_out=h,n.avail_in=a<l?l-a+5:5-(a-l),n.avail_out=h<u?u-h+257:257-(h-u),o.hold=C,o.bits=R}},{}],49:[function(t,e,i){var n=t("../utils/common"),r=t("./adler32"),o=t("./crc32"),a=t("./inffast"),l=t("./inftrees"),h=1,d=2,u=0,f=-2,E=1,p=852,I=592;function m(F){return(F>>>24&255)+(F>>>8&65280)+((65280&F)<<8)+((255&F)<<24)}function C(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function R(F){var L;return F&&F.state?(L=F.state,F.total_in=F.total_out=L.total=0,F.msg="",L.wrap&&(F.adler=1&L.wrap),L.mode=E,L.last=0,L.havedict=0,L.dmax=32768,L.head=null,L.hold=0,L.bits=0,L.lencode=L.lendyn=new n.Buf32(p),L.distcode=L.distdyn=new n.Buf32(I),L.sane=1,L.back=-1,u):f}function g(F){var L;return F&&F.state?((L=F.state).wsize=0,L.whave=0,L.wnext=0,R(F)):f}function y(F,L){var T,D;return F&&F.state?(D=F.state,L<0?(T=0,L=-L):(T=1+(L>>4),L<48&&(L&=15)),L&&(L<8||15<L)?f:(D.window!==null&&D.wbits!==L&&(D.window=null),D.wrap=T,D.wbits=L,g(F))):f}function w(F,L){var T,D;return F?(D=new C,(F.state=D).window=null,(T=y(F,L))!==u&&(F.state=null),T):f}var O,M,b=!0;function v(F){if(b){var L;for(O=new n.Buf32(512),M=new n.Buf32(32),L=0;L<144;)F.lens[L++]=8;for(;L<256;)F.lens[L++]=9;for(;L<280;)F.lens[L++]=7;for(;L<288;)F.lens[L++]=8;for(l(h,F.lens,0,288,O,0,F.work,{bits:9}),L=0;L<32;)F.lens[L++]=5;l(d,F.lens,0,32,M,0,F.work,{bits:5}),b=!1}F.lencode=O,F.lenbits=9,F.distcode=M,F.distbits=5}function k(F,L,T,D){var q,G=F.state;return G.window===null&&(G.wsize=1<<G.wbits,G.wnext=0,G.whave=0,G.window=new n.Buf8(G.wsize)),D>=G.wsize?(n.arraySet(G.window,L,T-G.wsize,G.wsize,0),G.wnext=0,G.whave=G.wsize):(D<(q=G.wsize-G.wnext)&&(q=D),n.arraySet(G.window,L,T-D,q,G.wnext),(D-=q)?(n.arraySet(G.window,L,T-D,D,0),G.wnext=D,G.whave=G.wsize):(G.wnext+=q,G.wnext===G.wsize&&(G.wnext=0),G.whave<G.wsize&&(G.whave+=q))),0}i.inflateReset=g,i.inflateReset2=y,i.inflateResetKeep=R,i.inflateInit=function(F){return w(F,15)},i.inflateInit2=w,i.inflate=function(F,L){var T,D,q,G,et,W,nt,V,B,rt,st,tt,At,wt,ot,ut,dt,mt,Vt,Lt,A,X,Y,P,N=0,U=new n.Buf8(4),$=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!F||!F.state||!F.output||!F.input&&F.avail_in!==0)return f;(T=F.state).mode===12&&(T.mode=13),et=F.next_out,q=F.output,nt=F.avail_out,G=F.next_in,D=F.input,W=F.avail_in,V=T.hold,B=T.bits,rt=W,st=nt,X=u;t:for(;;)switch(T.mode){case E:if(T.wrap===0){T.mode=13;break}for(;B<16;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if(2&T.wrap&&V===35615){U[T.check=0]=255&V,U[1]=V>>>8&255,T.check=o(T.check,U,2,0),B=V=0,T.mode=2;break}if(T.flags=0,T.head&&(T.head.done=!1),!(1&T.wrap)||(((255&V)<<8)+(V>>8))%31){F.msg="incorrect header check",T.mode=30;break}if((15&V)!=8){F.msg="unknown compression method",T.mode=30;break}if(B-=4,A=8+(15&(V>>>=4)),T.wbits===0)T.wbits=A;else if(A>T.wbits){F.msg="invalid window size",T.mode=30;break}T.dmax=1<<A,F.adler=T.check=1,T.mode=512&V?10:12,B=V=0;break;case 2:for(;B<16;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if(T.flags=V,(255&T.flags)!=8){F.msg="unknown compression method",T.mode=30;break}if(57344&T.flags){F.msg="unknown header flags set",T.mode=30;break}T.head&&(T.head.text=V>>8&1),512&T.flags&&(U[0]=255&V,U[1]=V>>>8&255,T.check=o(T.check,U,2,0)),B=V=0,T.mode=3;case 3:for(;B<32;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}T.head&&(T.head.time=V),512&T.flags&&(U[0]=255&V,U[1]=V>>>8&255,U[2]=V>>>16&255,U[3]=V>>>24&255,T.check=o(T.check,U,4,0)),B=V=0,T.mode=4;case 4:for(;B<16;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}T.head&&(T.head.xflags=255&V,T.head.os=V>>8),512&T.flags&&(U[0]=255&V,U[1]=V>>>8&255,T.check=o(T.check,U,2,0)),B=V=0,T.mode=5;case 5:if(1024&T.flags){for(;B<16;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}T.length=V,T.head&&(T.head.extra_len=V),512&T.flags&&(U[0]=255&V,U[1]=V>>>8&255,T.check=o(T.check,U,2,0)),B=V=0}else T.head&&(T.head.extra=null);T.mode=6;case 6:if(1024&T.flags&&(W<(tt=T.length)&&(tt=W),tt&&(T.head&&(A=T.head.extra_len-T.length,T.head.extra||(T.head.extra=new Array(T.head.extra_len)),n.arraySet(T.head.extra,D,G,tt,A)),512&T.flags&&(T.check=o(T.check,D,tt,G)),W-=tt,G+=tt,T.length-=tt),T.length))break t;T.length=0,T.mode=7;case 7:if(2048&T.flags){if(W===0)break t;for(tt=0;A=D[G+tt++],T.head&&A&&T.length<65536&&(T.head.name+=String.fromCharCode(A)),A&&tt<W;);if(512&T.flags&&(T.check=o(T.check,D,tt,G)),W-=tt,G+=tt,A)break t}else T.head&&(T.head.name=null);T.length=0,T.mode=8;case 8:if(4096&T.flags){if(W===0)break t;for(tt=0;A=D[G+tt++],T.head&&A&&T.length<65536&&(T.head.comment+=String.fromCharCode(A)),A&&tt<W;);if(512&T.flags&&(T.check=o(T.check,D,tt,G)),W-=tt,G+=tt,A)break t}else T.head&&(T.head.comment=null);T.mode=9;case 9:if(512&T.flags){for(;B<16;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if(V!==(65535&T.check)){F.msg="header crc mismatch",T.mode=30;break}B=V=0}T.head&&(T.head.hcrc=T.flags>>9&1,T.head.done=!0),F.adler=T.check=0,T.mode=12;break;case 10:for(;B<32;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}F.adler=T.check=m(V),B=V=0,T.mode=11;case 11:if(T.havedict===0)return F.next_out=et,F.avail_out=nt,F.next_in=G,F.avail_in=W,T.hold=V,T.bits=B,2;F.adler=T.check=1,T.mode=12;case 12:if(L===5||L===6)break t;case 13:if(T.last){V>>>=7&B,B-=7&B,T.mode=27;break}for(;B<3;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}switch(T.last=1&V,B-=1,3&(V>>>=1)){case 0:T.mode=14;break;case 1:if(v(T),T.mode=20,L!==6)break;V>>>=2,B-=2;break t;case 2:T.mode=17;break;case 3:F.msg="invalid block type",T.mode=30}V>>>=2,B-=2;break;case 14:for(V>>>=7&B,B-=7&B;B<32;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if((65535&V)!=(V>>>16^65535)){F.msg="invalid stored block lengths",T.mode=30;break}if(T.length=65535&V,B=V=0,T.mode=15,L===6)break t;case 15:T.mode=16;case 16:if(tt=T.length){if(W<tt&&(tt=W),nt<tt&&(tt=nt),tt===0)break t;n.arraySet(q,D,G,tt,et),W-=tt,G+=tt,nt-=tt,et+=tt,T.length-=tt;break}T.mode=12;break;case 17:for(;B<14;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if(T.nlen=257+(31&V),V>>>=5,B-=5,T.ndist=1+(31&V),V>>>=5,B-=5,T.ncode=4+(15&V),V>>>=4,B-=4,286<T.nlen||30<T.ndist){F.msg="too many length or distance symbols",T.mode=30;break}T.have=0,T.mode=18;case 18:for(;T.have<T.ncode;){for(;B<3;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}T.lens[$[T.have++]]=7&V,V>>>=3,B-=3}for(;T.have<19;)T.lens[$[T.have++]]=0;if(T.lencode=T.lendyn,T.lenbits=7,Y={bits:T.lenbits},X=l(0,T.lens,0,19,T.lencode,0,T.work,Y),T.lenbits=Y.bits,X){F.msg="invalid code lengths set",T.mode=30;break}T.have=0,T.mode=19;case 19:for(;T.have<T.nlen+T.ndist;){for(;ut=(N=T.lencode[V&(1<<T.lenbits)-1])>>>16&255,dt=65535&N,!((ot=N>>>24)<=B);){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if(dt<16)V>>>=ot,B-=ot,T.lens[T.have++]=dt;else{if(dt===16){for(P=ot+2;B<P;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if(V>>>=ot,B-=ot,T.have===0){F.msg="invalid bit length repeat",T.mode=30;break}A=T.lens[T.have-1],tt=3+(3&V),V>>>=2,B-=2}else if(dt===17){for(P=ot+3;B<P;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}B-=ot,A=0,tt=3+(7&(V>>>=ot)),V>>>=3,B-=3}else{for(P=ot+7;B<P;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}B-=ot,A=0,tt=11+(127&(V>>>=ot)),V>>>=7,B-=7}if(T.have+tt>T.nlen+T.ndist){F.msg="invalid bit length repeat",T.mode=30;break}for(;tt--;)T.lens[T.have++]=A}}if(T.mode===30)break;if(T.lens[256]===0){F.msg="invalid code -- missing end-of-block",T.mode=30;break}if(T.lenbits=9,Y={bits:T.lenbits},X=l(h,T.lens,0,T.nlen,T.lencode,0,T.work,Y),T.lenbits=Y.bits,X){F.msg="invalid literal/lengths set",T.mode=30;break}if(T.distbits=6,T.distcode=T.distdyn,Y={bits:T.distbits},X=l(d,T.lens,T.nlen,T.ndist,T.distcode,0,T.work,Y),T.distbits=Y.bits,X){F.msg="invalid distances set",T.mode=30;break}if(T.mode=20,L===6)break t;case 20:T.mode=21;case 21:if(6<=W&&258<=nt){F.next_out=et,F.avail_out=nt,F.next_in=G,F.avail_in=W,T.hold=V,T.bits=B,a(F,st),et=F.next_out,q=F.output,nt=F.avail_out,G=F.next_in,D=F.input,W=F.avail_in,V=T.hold,B=T.bits,T.mode===12&&(T.back=-1);break}for(T.back=0;ut=(N=T.lencode[V&(1<<T.lenbits)-1])>>>16&255,dt=65535&N,!((ot=N>>>24)<=B);){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if(ut&&!(240&ut)){for(mt=ot,Vt=ut,Lt=dt;ut=(N=T.lencode[Lt+((V&(1<<mt+Vt)-1)>>mt)])>>>16&255,dt=65535&N,!(mt+(ot=N>>>24)<=B);){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}V>>>=mt,B-=mt,T.back+=mt}if(V>>>=ot,B-=ot,T.back+=ot,T.length=dt,ut===0){T.mode=26;break}if(32&ut){T.back=-1,T.mode=12;break}if(64&ut){F.msg="invalid literal/length code",T.mode=30;break}T.extra=15&ut,T.mode=22;case 22:if(T.extra){for(P=T.extra;B<P;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}T.length+=V&(1<<T.extra)-1,V>>>=T.extra,B-=T.extra,T.back+=T.extra}T.was=T.length,T.mode=23;case 23:for(;ut=(N=T.distcode[V&(1<<T.distbits)-1])>>>16&255,dt=65535&N,!((ot=N>>>24)<=B);){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if(!(240&ut)){for(mt=ot,Vt=ut,Lt=dt;ut=(N=T.distcode[Lt+((V&(1<<mt+Vt)-1)>>mt)])>>>16&255,dt=65535&N,!(mt+(ot=N>>>24)<=B);){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}V>>>=mt,B-=mt,T.back+=mt}if(V>>>=ot,B-=ot,T.back+=ot,64&ut){F.msg="invalid distance code",T.mode=30;break}T.offset=dt,T.extra=15&ut,T.mode=24;case 24:if(T.extra){for(P=T.extra;B<P;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}T.offset+=V&(1<<T.extra)-1,V>>>=T.extra,B-=T.extra,T.back+=T.extra}if(T.offset>T.dmax){F.msg="invalid distance too far back",T.mode=30;break}T.mode=25;case 25:if(nt===0)break t;if(tt=st-nt,T.offset>tt){if((tt=T.offset-tt)>T.whave&&T.sane){F.msg="invalid distance too far back",T.mode=30;break}At=tt>T.wnext?(tt-=T.wnext,T.wsize-tt):T.wnext-tt,tt>T.length&&(tt=T.length),wt=T.window}else wt=q,At=et-T.offset,tt=T.length;for(nt<tt&&(tt=nt),nt-=tt,T.length-=tt;q[et++]=wt[At++],--tt;);T.length===0&&(T.mode=21);break;case 26:if(nt===0)break t;q[et++]=T.length,nt--,T.mode=21;break;case 27:if(T.wrap){for(;B<32;){if(W===0)break t;W--,V|=D[G++]<<B,B+=8}if(st-=nt,F.total_out+=st,T.total+=st,st&&(F.adler=T.check=T.flags?o(T.check,q,st,et-st):r(T.check,q,st,et-st)),st=nt,(T.flags?V:m(V))!==T.check){F.msg="incorrect data check",T.mode=30;break}B=V=0}T.mode=28;case 28:if(T.wrap&&T.flags){for(;B<32;){if(W===0)break t;W--,V+=D[G++]<<B,B+=8}if(V!==(4294967295&T.total)){F.msg="incorrect length check",T.mode=30;break}B=V=0}T.mode=29;case 29:X=1;break t;case 30:X=-3;break t;case 31:return-4;case 32:default:return f}return F.next_out=et,F.avail_out=nt,F.next_in=G,F.avail_in=W,T.hold=V,T.bits=B,(T.wsize||st!==F.avail_out&&T.mode<30&&(T.mode<27||L!==4))&&k(F,F.output,F.next_out,st-F.avail_out)?(T.mode=31,-4):(rt-=F.avail_in,st-=F.avail_out,F.total_in+=rt,F.total_out+=st,T.total+=st,T.wrap&&st&&(F.adler=T.check=T.flags?o(T.check,q,st,F.next_out-st):r(T.check,q,st,F.next_out-st)),F.data_type=T.bits+(T.last?64:0)+(T.mode===12?128:0)+(T.mode===20||T.mode===15?256:0),(rt==0&&st===0||L===4)&&X===u&&(X=-5),X)},i.inflateEnd=function(F){if(!F||!F.state)return f;var L=F.state;return L.window&&(L.window=null),F.state=null,u},i.inflateGetHeader=function(F,L){var T;return F&&F.state&&2&(T=F.state).wrap?((T.head=L).done=!1,u):f},i.inflateSetDictionary=function(F,L){var T,D=L.length;return F&&F.state?(T=F.state).wrap!==0&&T.mode!==11?f:T.mode===11&&r(1,L,D,0)!==T.check?-3:k(F,L,D,D)?(T.mode=31,-4):(T.havedict=1,u):f},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,e,i){var n=t("../utils/common"),r=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],l=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(h,d,u,f,E,p,I,m){var C,R,g,y,w,O,M,b,v,k=m.bits,F=0,L=0,T=0,D=0,q=0,G=0,et=0,W=0,nt=0,V=0,B=null,rt=0,st=new n.Buf16(16),tt=new n.Buf16(16),At=null,wt=0;for(F=0;F<=15;F++)st[F]=0;for(L=0;L<f;L++)st[d[u+L]]++;for(q=k,D=15;1<=D&&st[D]===0;D--);if(D<q&&(q=D),D===0)return E[p++]=20971520,E[p++]=20971520,m.bits=1,0;for(T=1;T<D&&st[T]===0;T++);for(q<T&&(q=T),F=W=1;F<=15;F++)if(W<<=1,(W-=st[F])<0)return-1;if(0<W&&(h===0||D!==1))return-1;for(tt[1]=0,F=1;F<15;F++)tt[F+1]=tt[F]+st[F];for(L=0;L<f;L++)d[u+L]!==0&&(I[tt[d[u+L]]++]=L);if(O=h===0?(B=At=I,19):h===1?(B=r,rt-=257,At=o,wt-=257,256):(B=a,At=l,-1),F=T,w=p,et=L=V=0,g=-1,y=(nt=1<<(G=q))-1,h===1&&852<nt||h===2&&592<nt)return 1;for(;;){for(M=F-et,v=I[L]<O?(b=0,I[L]):I[L]>O?(b=At[wt+I[L]],B[rt+I[L]]):(b=96,0),C=1<<F-et,T=R=1<<G;E[w+(V>>et)+(R-=C)]=M<<24|b<<16|v|0,R!==0;);for(C=1<<F-1;V&C;)C>>=1;if(C!==0?(V&=C-1,V+=C):V=0,L++,--st[F]==0){if(F===D)break;F=d[u+I[L]]}if(q<F&&(V&y)!==g){for(et===0&&(et=q),w+=T,W=1<<(G=F-et);G+et<D&&!((W-=st[G+et])<=0);)G++,W<<=1;if(nt+=1<<G,h===1&&852<nt||h===2&&592<nt)return 1;E[g=V&y]=q<<24|G<<16|w-p|0}}return V!==0&&(E[w+V]=F-et<<24|64<<16|0),m.bits=q,0}},{"../utils/common":41}],51:[function(t,e,i){e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(t,e,i){var n=t("../utils/common"),r=0,o=1;function a(N){for(var U=N.length;0<=--U;)N[U]=0}var l=0,h=29,d=256,u=d+1+h,f=30,E=19,p=2*u+1,I=15,m=16,C=7,R=256,g=16,y=17,w=18,O=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],M=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],b=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],v=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],k=new Array(2*(u+2));a(k);var F=new Array(2*f);a(F);var L=new Array(512);a(L);var T=new Array(256);a(T);var D=new Array(h);a(D);var q,G,et,W=new Array(f);function nt(N,U,$,j,z){this.static_tree=N,this.extra_bits=U,this.extra_base=$,this.elems=j,this.max_length=z,this.has_stree=N&&N.length}function V(N,U){this.dyn_tree=N,this.max_code=0,this.stat_desc=U}function B(N){return N<256?L[N]:L[256+(N>>>7)]}function rt(N,U){N.pending_buf[N.pending++]=255&U,N.pending_buf[N.pending++]=U>>>8&255}function st(N,U,$){N.bi_valid>m-$?(N.bi_buf|=U<<N.bi_valid&65535,rt(N,N.bi_buf),N.bi_buf=U>>m-N.bi_valid,N.bi_valid+=$-m):(N.bi_buf|=U<<N.bi_valid&65535,N.bi_valid+=$)}function tt(N,U,$){st(N,$[2*U],$[2*U+1])}function At(N,U){for(var $=0;$|=1&N,N>>>=1,$<<=1,0<--U;);return $>>>1}function wt(N,U,$){var j,z,K=new Array(I+1),it=0;for(j=1;j<=I;j++)K[j]=it=it+$[j-1]<<1;for(z=0;z<=U;z++){var J=N[2*z+1];J!==0&&(N[2*z]=At(K[J]++,J))}}function ot(N){var U;for(U=0;U<u;U++)N.dyn_ltree[2*U]=0;for(U=0;U<f;U++)N.dyn_dtree[2*U]=0;for(U=0;U<E;U++)N.bl_tree[2*U]=0;N.dyn_ltree[2*R]=1,N.opt_len=N.static_len=0,N.last_lit=N.matches=0}function ut(N){8<N.bi_valid?rt(N,N.bi_buf):0<N.bi_valid&&(N.pending_buf[N.pending++]=N.bi_buf),N.bi_buf=0,N.bi_valid=0}function dt(N,U,$,j){var z=2*U,K=2*$;return N[z]<N[K]||N[z]===N[K]&&j[U]<=j[$]}function mt(N,U,$){for(var j=N.heap[$],z=$<<1;z<=N.heap_len&&(z<N.heap_len&&dt(U,N.heap[z+1],N.heap[z],N.depth)&&z++,!dt(U,j,N.heap[z],N.depth));)N.heap[$]=N.heap[z],$=z,z<<=1;N.heap[$]=j}function Vt(N,U,$){var j,z,K,it,J=0;if(N.last_lit!==0)for(;j=N.pending_buf[N.d_buf+2*J]<<8|N.pending_buf[N.d_buf+2*J+1],z=N.pending_buf[N.l_buf+J],J++,j===0?tt(N,z,U):(tt(N,(K=T[z])+d+1,U),(it=O[K])!==0&&st(N,z-=D[K],it),tt(N,K=B(--j),$),(it=M[K])!==0&&st(N,j-=W[K],it)),J<N.last_lit;);tt(N,R,U)}function Lt(N,U){var $,j,z,K=U.dyn_tree,it=U.stat_desc.static_tree,J=U.stat_desc.has_stree,at=U.stat_desc.elems,Ct=-1;for(N.heap_len=0,N.heap_max=p,$=0;$<at;$++)K[2*$]!==0?(N.heap[++N.heap_len]=Ct=$,N.depth[$]=0):K[2*$+1]=0;for(;N.heap_len<2;)K[2*(z=N.heap[++N.heap_len]=Ct<2?++Ct:0)]=1,N.depth[z]=0,N.opt_len--,J&&(N.static_len-=it[2*z+1]);for(U.max_code=Ct,$=N.heap_len>>1;1<=$;$--)mt(N,K,$);for(z=at;$=N.heap[1],N.heap[1]=N.heap[N.heap_len--],mt(N,K,1),j=N.heap[1],N.heap[--N.heap_max]=$,N.heap[--N.heap_max]=j,K[2*z]=K[2*$]+K[2*j],N.depth[z]=(N.depth[$]>=N.depth[j]?N.depth[$]:N.depth[j])+1,K[2*$+1]=K[2*j+1]=z,N.heap[1]=z++,mt(N,K,1),2<=N.heap_len;);N.heap[--N.heap_max]=N.heap[1],function(ft,kt){var $e,Jt,je,St,Rs,Ni,ae=kt.dyn_tree,Sn=kt.max_code,oo=kt.stat_desc.static_tree,ao=kt.stat_desc.has_stree,co=kt.stat_desc.extra_bits,On=kt.stat_desc.extra_base,Qe=kt.stat_desc.max_length,ys=0;for(St=0;St<=I;St++)ft.bl_count[St]=0;for(ae[2*ft.heap[ft.heap_max]+1]=0,$e=ft.heap_max+1;$e<p;$e++)Qe<(St=ae[2*ae[2*(Jt=ft.heap[$e])+1]+1]+1)&&(St=Qe,ys++),ae[2*Jt+1]=St,Sn<Jt||(ft.bl_count[St]++,Rs=0,On<=Jt&&(Rs=co[Jt-On]),Ni=ae[2*Jt],ft.opt_len+=Ni*(St+Rs),ao&&(ft.static_len+=Ni*(oo[2*Jt+1]+Rs)));if(ys!==0){do{for(St=Qe-1;ft.bl_count[St]===0;)St--;ft.bl_count[St]--,ft.bl_count[St+1]+=2,ft.bl_count[Qe]--,ys-=2}while(0<ys);for(St=Qe;St!==0;St--)for(Jt=ft.bl_count[St];Jt!==0;)Sn<(je=ft.heap[--$e])||(ae[2*je+1]!==St&&(ft.opt_len+=(St-ae[2*je+1])*ae[2*je],ae[2*je+1]=St),Jt--)}}(N,U),wt(K,Ct,N.bl_count)}function A(N,U,$){var j,z,K=-1,it=U[1],J=0,at=7,Ct=4;for(it===0&&(at=138,Ct=3),U[2*($+1)+1]=65535,j=0;j<=$;j++)z=it,it=U[2*(j+1)+1],++J<at&&z===it||(J<Ct?N.bl_tree[2*z]+=J:z!==0?(z!==K&&N.bl_tree[2*z]++,N.bl_tree[2*g]++):J<=10?N.bl_tree[2*y]++:N.bl_tree[2*w]++,K=z,Ct=(J=0)===it?(at=138,3):z===it?(at=6,3):(at=7,4))}function X(N,U,$){var j,z,K=-1,it=U[1],J=0,at=7,Ct=4;for(it===0&&(at=138,Ct=3),j=0;j<=$;j++)if(z=it,it=U[2*(j+1)+1],!(++J<at&&z===it)){if(J<Ct)for(;tt(N,z,N.bl_tree),--J!=0;);else z!==0?(z!==K&&(tt(N,z,N.bl_tree),J--),tt(N,g,N.bl_tree),st(N,J-3,2)):J<=10?(tt(N,y,N.bl_tree),st(N,J-3,3)):(tt(N,w,N.bl_tree),st(N,J-11,7));K=z,Ct=(J=0)===it?(at=138,3):z===it?(at=6,3):(at=7,4)}}a(W);var Y=!1;function P(N,U,$,j){st(N,(l<<1)+(j?1:0),3),function(z,K,it,J){ut(z),rt(z,it),rt(z,~it),n.arraySet(z.pending_buf,z.window,K,it,z.pending),z.pending+=it}(N,U,$)}i._tr_init=function(N){Y||(function(){var U,$,j,z,K,it=new Array(I+1);for(z=j=0;z<h-1;z++)for(D[z]=j,U=0;U<1<<O[z];U++)T[j++]=z;for(T[j-1]=z,z=K=0;z<16;z++)for(W[z]=K,U=0;U<1<<M[z];U++)L[K++]=z;for(K>>=7;z<f;z++)for(W[z]=K<<7,U=0;U<1<<M[z]-7;U++)L[256+K++]=z;for($=0;$<=I;$++)it[$]=0;for(U=0;U<=143;)k[2*U+1]=8,U++,it[8]++;for(;U<=255;)k[2*U+1]=9,U++,it[9]++;for(;U<=279;)k[2*U+1]=7,U++,it[7]++;for(;U<=287;)k[2*U+1]=8,U++,it[8]++;for(wt(k,u+1,it),U=0;U<f;U++)F[2*U+1]=5,F[2*U]=At(U,5);q=new nt(k,O,d+1,u,I),G=new nt(F,M,0,f,I),et=new nt(new Array(0),b,0,E,C)}(),Y=!0),N.l_desc=new V(N.dyn_ltree,q),N.d_desc=new V(N.dyn_dtree,G),N.bl_desc=new V(N.bl_tree,et),N.bi_buf=0,N.bi_valid=0,ot(N)},i._tr_stored_block=P,i._tr_flush_block=function(N,U,$,j){var z,K,it=0;0<N.level?(N.strm.data_type===2&&(N.strm.data_type=function(J){var at,Ct=4093624447;for(at=0;at<=31;at++,Ct>>>=1)if(1&Ct&&J.dyn_ltree[2*at]!==0)return r;if(J.dyn_ltree[18]!==0||J.dyn_ltree[20]!==0||J.dyn_ltree[26]!==0)return o;for(at=32;at<d;at++)if(J.dyn_ltree[2*at]!==0)return o;return r}(N)),Lt(N,N.l_desc),Lt(N,N.d_desc),it=function(J){var at;for(A(J,J.dyn_ltree,J.l_desc.max_code),A(J,J.dyn_dtree,J.d_desc.max_code),Lt(J,J.bl_desc),at=E-1;3<=at&&J.bl_tree[2*v[at]+1]===0;at--);return J.opt_len+=3*(at+1)+5+5+4,at}(N),z=N.opt_len+3+7>>>3,(K=N.static_len+3+7>>>3)<=z&&(z=K)):z=K=$+5,$+4<=z&&U!==-1?P(N,U,$,j):N.strategy===4||K===z?(st(N,2+(j?1:0),3),Vt(N,k,F)):(st(N,4+(j?1:0),3),function(J,at,Ct,ft){var kt;for(st(J,at-257,5),st(J,Ct-1,5),st(J,ft-4,4),kt=0;kt<ft;kt++)st(J,J.bl_tree[2*v[kt]+1],3);X(J,J.dyn_ltree,at-1),X(J,J.dyn_dtree,Ct-1)}(N,N.l_desc.max_code+1,N.d_desc.max_code+1,it+1),Vt(N,N.dyn_ltree,N.dyn_dtree)),ot(N),j&&ut(N)},i._tr_tally=function(N,U,$){return N.pending_buf[N.d_buf+2*N.last_lit]=U>>>8&255,N.pending_buf[N.d_buf+2*N.last_lit+1]=255&U,N.pending_buf[N.l_buf+N.last_lit]=255&$,N.last_lit++,U===0?N.dyn_ltree[2*$]++:(N.matches++,U--,N.dyn_ltree[2*(T[$]+d+1)]++,N.dyn_dtree[2*B(U)]++),N.last_lit===N.lit_bufsize-1},i._tr_align=function(N){st(N,2,3),tt(N,R,k),function(U){U.bi_valid===16?(rt(U,U.bi_buf),U.bi_buf=0,U.bi_valid=0):8<=U.bi_valid&&(U.pending_buf[U.pending++]=255&U.bi_buf,U.bi_buf>>=8,U.bi_valid-=8)}(N)}},{"../utils/common":41}],53:[function(t,e,i){e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,e,i){(function(n){(function(r,o){if(!r.setImmediate){var a,l,h,d,u=1,f={},E=!1,p=r.document,I=Object.getPrototypeOf&&Object.getPrototypeOf(r);I=I&&I.setTimeout?I:r,a={}.toString.call(r.process)==="[object process]"?function(g){process.nextTick(function(){C(g)})}:function(){if(r.postMessage&&!r.importScripts){var g=!0,y=r.onmessage;return r.onmessage=function(){g=!1},r.postMessage("","*"),r.onmessage=y,g}}()?(d="setImmediate$"+Math.random()+"$",r.addEventListener?r.addEventListener("message",R,!1):r.attachEvent("onmessage",R),function(g){r.postMessage(d+g,"*")}):r.MessageChannel?((h=new MessageChannel).port1.onmessage=function(g){C(g.data)},function(g){h.port2.postMessage(g)}):p&&"onreadystatechange"in p.createElement("script")?(l=p.documentElement,function(g){var y=p.createElement("script");y.onreadystatechange=function(){C(g),y.onreadystatechange=null,l.removeChild(y),y=null},l.appendChild(y)}):function(g){setTimeout(C,0,g)},I.setImmediate=function(g){typeof g!="function"&&(g=new Function(""+g));for(var y=new Array(arguments.length-1),w=0;w<y.length;w++)y[w]=arguments[w+1];var O={callback:g,args:y};return f[u]=O,a(u),u++},I.clearImmediate=m}function m(g){delete f[g]}function C(g){if(E)setTimeout(C,0,g);else{var y=f[g];if(y){E=!0;try{(function(w){var O=w.callback,M=w.args;switch(M.length){case 0:O();break;case 1:O(M[0]);break;case 2:O(M[0],M[1]);break;case 3:O(M[0],M[1],M[2]);break;default:O.apply(o,M)}})(y)}finally{m(g),E=!1}}}}function R(g){g.source===r&&typeof g.data=="string"&&g.data.indexOf(d)===0&&C(+g.data.slice(d.length))}})(typeof self>"u"?n===void 0?this:n:self)}).call(this,typeof $s<"u"?$s:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})($r);var Za=$r.exports;const dr=Xa(Za);var Rn={},Oi={};(function(c){const s=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",t=s+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",e="["+s+"]["+t+"]*",i=new RegExp("^"+e+"$"),n=function(o,a){const l=[];let h=a.exec(o);for(;h;){const d=[];d.startIndex=a.lastIndex-h[0].length;const u=h.length;for(let f=0;f<u;f++)d.push(h[f]);l.push(d),h=a.exec(o)}return l},r=function(o){const a=i.exec(o);return!(a===null||typeof a>"u")};c.isExist=function(o){return typeof o<"u"},c.isEmptyObject=function(o){return Object.keys(o).length===0},c.merge=function(o,a,l){if(a){const h=Object.keys(a),d=h.length;for(let u=0;u<d;u++)l==="strict"?o[h[u]]=[a[h[u]]]:o[h[u]]=a[h[u]]}},c.getValue=function(o){return c.isExist(o)?o:""},c.isName=r,c.getAllMatches=n,c.nameRegexp=e})(Oi);const yn=Oi,$a={allowBooleanAttributes:!1,unpairedTags:[]};Rn.validate=function(c,s){s=Object.assign({},$a,s);const t=[];let e=!1,i=!1;c[0]==="\uFEFF"&&(c=c.substr(1));for(let n=0;n<c.length;n++)if(c[n]==="<"&&c[n+1]==="?"){if(n+=2,n=fr(c,n),n.err)return n}else if(c[n]==="<"){let r=n;if(n++,c[n]==="!"){n=pr(c,n);continue}else{let o=!1;c[n]==="/"&&(o=!0,n++);let a="";for(;n<c.length&&c[n]!==">"&&c[n]!==" "&&c[n]!==" "&&c[n]!==`
140
140
  `&&c[n]!=="\r";n++)a+=c[n];if(a=a.trim(),a[a.length-1]==="/"&&(a=a.substring(0,a.length-1),n--),!sc(a)){let d;return a.trim().length===0?d="Invalid space after '<'.":d="Tag '"+a+"' is an invalid name.",Nt("InvalidTag",d,vt(c,n))}const l=qa(c,n);if(l===!1)return Nt("InvalidAttr","Attributes for '"+a+"' have open quote.",vt(c,n));let h=l.value;if(n=l.index,h[h.length-1]==="/"){const d=n-h.length;h=h.substring(0,h.length-1);const u=Er(h,s);if(u===!0)e=!0;else return Nt(u.err.code,u.err.msg,vt(c,d+u.err.line))}else if(o)if(l.tagClosed){if(h.trim().length>0)return Nt("InvalidTag","Closing tag '"+a+"' can't have attributes or invalid starting.",vt(c,r));if(t.length===0)return Nt("InvalidTag","Closing tag '"+a+"' has not been opened.",vt(c,r));{const d=t.pop();if(a!==d.tagName){let u=vt(c,d.tagStartPos);return Nt("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+u.line+", col "+u.col+") instead of closing tag '"+a+"'.",vt(c,r))}t.length==0&&(i=!0)}}else return Nt("InvalidTag","Closing tag '"+a+"' doesn't have proper closing.",vt(c,n));else{const d=Er(h,s);if(d!==!0)return Nt(d.err.code,d.err.msg,vt(c,n-h.length+d.err.line));if(i===!0)return Nt("InvalidXml","Multiple possible root nodes found.",vt(c,n));s.unpairedTags.indexOf(a)!==-1||t.push({tagName:a,tagStartPos:r}),e=!0}for(n++;n<c.length;n++)if(c[n]==="<")if(c[n+1]==="!"){n++,n=pr(c,n);continue}else if(c[n+1]==="?"){if(n=fr(c,++n),n.err)return n}else break;else if(c[n]==="&"){const d=tc(c,n);if(d==-1)return Nt("InvalidChar","char '&' is not expected.",vt(c,n));n=d}else if(i===!0&&!ur(c[n]))return Nt("InvalidXml","Extra text at the end",vt(c,n));c[n]==="<"&&n--}}else{if(ur(c[n]))continue;return Nt("InvalidChar","char '"+c[n]+"' is not expected.",vt(c,n))}if(e){if(t.length==1)return Nt("InvalidTag","Unclosed tag '"+t[0].tagName+"'.",vt(c,t[0].tagStartPos));if(t.length>0)return Nt("InvalidXml","Invalid '"+JSON.stringify(t.map(n=>n.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Nt("InvalidXml","Start tag expected.",1);return!0};function ur(c){return c===" "||c===" "||c===`
141
141
  `||c==="\r"}function fr(c,s){const t=s;for(;s<c.length;s++)if(c[s]=="?"||c[s]==" "){const e=c.substr(t,s-t);if(s>5&&e==="xml")return Nt("InvalidXml","XML declaration allowed only at the start of the document.",vt(c,s));if(c[s]=="?"&&c[s+1]==">"){s++;break}else continue}return s}function pr(c,s){if(c.length>s+5&&c[s+1]==="-"&&c[s+2]==="-"){for(s+=3;s<c.length;s++)if(c[s]==="-"&&c[s+1]==="-"&&c[s+2]===">"){s+=2;break}}else if(c.length>s+8&&c[s+1]==="D"&&c[s+2]==="O"&&c[s+3]==="C"&&c[s+4]==="T"&&c[s+5]==="Y"&&c[s+6]==="P"&&c[s+7]==="E"){let t=1;for(s+=8;s<c.length;s++)if(c[s]==="<")t++;else if(c[s]===">"&&(t--,t===0))break}else if(c.length>s+9&&c[s+1]==="["&&c[s+2]==="C"&&c[s+3]==="D"&&c[s+4]==="A"&&c[s+5]==="T"&&c[s+6]==="A"&&c[s+7]==="["){for(s+=8;s<c.length;s++)if(c[s]==="]"&&c[s+1]==="]"&&c[s+2]===">"){s+=2;break}}return s}const ja='"',Qa="'";function qa(c,s){let t="",e="",i=!1;for(;s<c.length;s++){if(c[s]===ja||c[s]===Qa)e===""?e=c[s]:e!==c[s]||(e="");else if(c[s]===">"&&e===""){i=!0;break}t+=c[s]}return e!==""?!1:{value:t,index:s,tagClosed:i}}const Ka=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Er(c,s){const t=yn.getAllMatches(c,Ka),e={};for(let i=0;i<t.length;i++){if(t[i][1].length===0)return Nt("InvalidAttr","Attribute '"+t[i][2]+"' has no space in starting.",hs(t[i]));if(t[i][3]!==void 0&&t[i][4]===void 0)return Nt("InvalidAttr","Attribute '"+t[i][2]+"' is without value.",hs(t[i]));if(t[i][3]===void 0&&!s.allowBooleanAttributes)return Nt("InvalidAttr","boolean attribute '"+t[i][2]+"' is not allowed.",hs(t[i]));const n=t[i][2];if(!ec(n))return Nt("InvalidAttr","Attribute '"+n+"' is an invalid name.",hs(t[i]));if(!e.hasOwnProperty(n))e[n]=1;else return Nt("InvalidAttr","Attribute '"+n+"' is repeated.",hs(t[i]))}return!0}function Ja(c,s){let t=/\d/;for(c[s]==="x"&&(s++,t=/[\da-fA-F]/);s<c.length;s++){if(c[s]===";")return s;if(!c[s].match(t))break}return-1}function tc(c,s){if(s++,c[s]===";")return-1;if(c[s]==="#")return s++,Ja(c,s);let t=0;for(;s<c.length;s++,t++)if(!(c[s].match(/\w/)&&t<20)){if(c[s]===";")break;return-1}return s}function Nt(c,s,t){return{err:{code:c,msg:s,line:t.line||t,col:t.col}}}function ec(c){return yn.isName(c)}function sc(c){return yn.isName(c)}function vt(c,s){const t=c.substring(0,s).split(/\r?\n/);return{line:t.length,col:t[t.length-1].length+1}}function hs(c){return c.startIndex+c[1].length}var Fn={};const jr={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(c,s){return s},attributeValueProcessor:function(c,s){return s},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(c,s,t){return c}},ic=function(c){return Object.assign({},jr,c)};Fn.buildOptions=ic;Fn.defaultOptions=jr;class nc{constructor(s){this.tagname=s,this.child=[],this[":@"]={}}add(s,t){s==="__proto__"&&(s="#__proto__"),this.child.push({[s]:t})}addChild(s){s.tagname==="__proto__"&&(s.tagname="#__proto__"),s[":@"]&&Object.keys(s[":@"]).length>0?this.child.push({[s.tagname]:s.child,":@":s[":@"]}):this.child.push({[s.tagname]:s.child})}}var rc=nc;const oc=Oi;function ac(c,s){const t={};if(c[s+3]==="O"&&c[s+4]==="C"&&c[s+5]==="T"&&c[s+6]==="Y"&&c[s+7]==="P"&&c[s+8]==="E"){s=s+9;let e=1,i=!1,n=!1,r="";for(;s<c.length;s++)if(c[s]==="<"&&!n){if(i&&hc(c,s))s+=7,[entityName,val,s]=cc(c,s+1),val.indexOf("&")===-1&&(t[pc(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(i&&dc(c,s))s+=8;else if(i&&uc(c,s))s+=8;else if(i&&fc(c,s))s+=9;else if(lc)n=!0;else throw new Error("Invalid DOCTYPE");e++,r=""}else if(c[s]===">"){if(n?c[s-1]==="-"&&c[s-2]==="-"&&(n=!1,e--):e--,e===0)break}else c[s]==="["?i=!0:r+=c[s];if(e!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:t,i:s}}function cc(c,s){let t="";for(;s<c.length&&c[s]!=="'"&&c[s]!=='"';s++)t+=c[s];if(t=t.trim(),t.indexOf(" ")!==-1)throw new Error("External entites are not supported");const e=c[s++];let i="";for(;s<c.length&&c[s]!==e;s++)i+=c[s];return[t,i,s]}function lc(c,s){return c[s+1]==="!"&&c[s+2]==="-"&&c[s+3]==="-"}function hc(c,s){return c[s+1]==="!"&&c[s+2]==="E"&&c[s+3]==="N"&&c[s+4]==="T"&&c[s+5]==="I"&&c[s+6]==="T"&&c[s+7]==="Y"}function dc(c,s){return c[s+1]==="!"&&c[s+2]==="E"&&c[s+3]==="L"&&c[s+4]==="E"&&c[s+5]==="M"&&c[s+6]==="E"&&c[s+7]==="N"&&c[s+8]==="T"}function uc(c,s){return c[s+1]==="!"&&c[s+2]==="A"&&c[s+3]==="T"&&c[s+4]==="T"&&c[s+5]==="L"&&c[s+6]==="I"&&c[s+7]==="S"&&c[s+8]==="T"}function fc(c,s){return c[s+1]==="!"&&c[s+2]==="N"&&c[s+3]==="O"&&c[s+4]==="T"&&c[s+5]==="A"&&c[s+6]==="T"&&c[s+7]==="I"&&c[s+8]==="O"&&c[s+9]==="N"}function pc(c){if(oc.isName(c))return c;throw new Error(`Invalid entity name ${c}`)}var Ec=ac;const mc=/^[-+]?0x[a-fA-F0-9]+$/,Ic=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const gc={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Cc(c,s={}){if(s=Object.assign({},gc,s),!c||typeof c!="string")return c;let t=c.trim();if(s.skipLike!==void 0&&s.skipLike.test(t))return c;if(s.hex&&mc.test(t))return Number.parseInt(t,16);{const e=Ic.exec(t);if(e){const i=e[1],n=e[2];let r=Tc(e[3]);const o=e[4]||e[6];if(!s.leadingZeros&&n.length>0&&i&&t[2]!==".")return c;if(!s.leadingZeros&&n.length>0&&!i&&t[1]!==".")return c;{const a=Number(t),l=""+a;return l.search(/[eE]/)!==-1||o?s.eNotation?a:c:t.indexOf(".")!==-1?l==="0"&&r===""||l===r||i&&l==="-"+r?a:c:n?r===l||i+r===l?a:c:t===l||t===i+l?a:c}}else return c}}function Tc(c){return c&&c.indexOf(".")!==-1&&(c=c.replace(/0+$/,""),c==="."?c="0":c[0]==="."?c="0"+c:c[c.length-1]==="."&&(c=c.substr(0,c.length-1))),c}var _c=Cc;const Qr=Oi,ds=rc,Ac=Ec,Rc=_c;let yc=class{constructor(s){this.options=s,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,e)=>String.fromCharCode(Number.parseInt(e,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,e)=>String.fromCharCode(Number.parseInt(e,16))}},this.addExternalEntities=Fc,this.parseXml=bc,this.parseTextData=wc,this.resolveNameSpace=Sc,this.buildAttributesMap=Nc,this.isItStopNode=xc,this.replaceEntitiesValue=Lc,this.readStopNodeData=Dc,this.saveTextToParentTag=Mc,this.addChild=Pc}};function Fc(c){const s=Object.keys(c);for(let t=0;t<s.length;t++){const e=s[t];this.lastEntities[e]={regex:new RegExp("&"+e+";","g"),val:c[e]}}}function wc(c,s,t,e,i,n,r){if(c!==void 0&&(this.options.trimValues&&!e&&(c=c.trim()),c.length>0)){r||(c=this.replaceEntitiesValue(c));const o=this.options.tagValueProcessor(s,c,t,i,n);return o==null?c:typeof o!=typeof c||o!==c?o:this.options.trimValues?dn(c,this.options.parseTagValue,this.options.numberParseOptions):c.trim()===c?dn(c,this.options.parseTagValue,this.options.numberParseOptions):c}}function Sc(c){if(this.options.removeNSPrefix){const s=c.split(":"),t=c.charAt(0)==="/"?"/":"";if(s[0]==="xmlns")return"";s.length===2&&(c=t+s[1])}return c}const Oc=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Nc(c,s,t){if(!this.options.ignoreAttributes&&typeof c=="string"){const e=Qr.getAllMatches(c,Oc),i=e.length,n={};for(let r=0;r<i;r++){const o=this.resolveNameSpace(e[r][1]);let a=e[r][4],l=this.options.attributeNamePrefix+o;if(o.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l==="__proto__"&&(l="#__proto__"),a!==void 0){this.options.trimValues&&(a=a.trim()),a=this.replaceEntitiesValue(a);const h=this.options.attributeValueProcessor(o,a,s);h==null?n[l]=a:typeof h!=typeof a||h!==a?n[l]=h:n[l]=dn(a,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(n[l]=!0)}if(!Object.keys(n).length)return;if(this.options.attributesGroupName){const r={};return r[this.options.attributesGroupName]=n,r}return n}}const bc=function(c){c=c.replace(/\r\n?/g,`
142
142
  `);const s=new ds("!xml");let t=s,e="",i="";for(let n=0;n<c.length;n++)if(c[n]==="<")if(c[n+1]==="/"){const o=we(c,">",n,"Closing Tag is not closed.");let a=c.substring(n+2,o).trim();if(this.options.removeNSPrefix){const d=a.indexOf(":");d!==-1&&(a=a.substr(d+1))}this.options.transformTagName&&(a=this.options.transformTagName(a)),t&&(e=this.saveTextToParentTag(e,t,i));const l=i.substring(i.lastIndexOf(".")+1);if(a&&this.options.unpairedTags.indexOf(a)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${a}>`);let h=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(h=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):h=i.lastIndexOf("."),i=i.substring(0,h),t=this.tagsNodeStack.pop(),e="",n=o}else if(c[n+1]==="?"){let o=hn(c,n,!1,"?>");if(!o)throw new Error("Pi Tag is not closed.");if(e=this.saveTextToParentTag(e,t,i),!(this.options.ignoreDeclaration&&o.tagName==="?xml"||this.options.ignorePiTags)){const a=new ds(o.tagName);a.add(this.options.textNodeName,""),o.tagName!==o.tagExp&&o.attrExpPresent&&(a[":@"]=this.buildAttributesMap(o.tagExp,i,o.tagName)),this.addChild(t,a,i)}n=o.closeIndex+1}else if(c.substr(n+1,3)==="!--"){const o=we(c,"-->",n+4,"Comment is not closed.");if(this.options.commentPropName){const a=c.substring(n+4,o-2);e=this.saveTextToParentTag(e,t,i),t.add(this.options.commentPropName,[{[this.options.textNodeName]:a}])}n=o}else if(c.substr(n+1,2)==="!D"){const o=Ac(c,n);this.docTypeEntities=o.entities,n=o.i}else if(c.substr(n+1,2)==="!["){const o=we(c,"]]>",n,"CDATA is not closed.")-2,a=c.substring(n+9,o);e=this.saveTextToParentTag(e,t,i);let l=this.parseTextData(a,t.tagname,i,!0,!1,!0,!0);l==null&&(l=""),this.options.cdataPropName?t.add(this.options.cdataPropName,[{[this.options.textNodeName]:a}]):t.add(this.options.textNodeName,l),n=o+2}else{let o=hn(c,n,this.options.removeNSPrefix),a=o.tagName;const l=o.rawTagName;let h=o.tagExp,d=o.attrExpPresent,u=o.closeIndex;this.options.transformTagName&&(a=this.options.transformTagName(a)),t&&e&&t.tagname!=="!xml"&&(e=this.saveTextToParentTag(e,t,i,!1));const f=t;if(f&&this.options.unpairedTags.indexOf(f.tagname)!==-1&&(t=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),a!==s.tagname&&(i+=i?"."+a:a),this.isItStopNode(this.options.stopNodes,i,a)){let E="";if(h.length>0&&h.lastIndexOf("/")===h.length-1)a[a.length-1]==="/"?(a=a.substr(0,a.length-1),i=i.substr(0,i.length-1),h=a):h=h.substr(0,h.length-1),n=o.closeIndex;else if(this.options.unpairedTags.indexOf(a)!==-1)n=o.closeIndex;else{const I=this.readStopNodeData(c,l,u+1);if(!I)throw new Error(`Unexpected end of ${l}`);n=I.i,E=I.tagContent}const p=new ds(a);a!==h&&d&&(p[":@"]=this.buildAttributesMap(h,i,a)),E&&(E=this.parseTextData(E,a,i,!0,d,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),p.add(this.options.textNodeName,E),this.addChild(t,p,i)}else{if(h.length>0&&h.lastIndexOf("/")===h.length-1){a[a.length-1]==="/"?(a=a.substr(0,a.length-1),i=i.substr(0,i.length-1),h=a):h=h.substr(0,h.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));const E=new ds(a);a!==h&&d&&(E[":@"]=this.buildAttributesMap(h,i,a)),this.addChild(t,E,i),i=i.substr(0,i.lastIndexOf("."))}else{const E=new ds(a);this.tagsNodeStack.push(t),a!==h&&d&&(E[":@"]=this.buildAttributesMap(h,i,a)),this.addChild(t,E,i),t=E}e="",n=u}}else e+=c[n];return s.child};function Pc(c,s,t){const e=this.options.updateTag(s.tagname,t,s[":@"]);e===!1||(typeof e=="string"&&(s.tagname=e),c.addChild(s))}const Lc=function(c){if(this.options.processEntities){for(let s in this.docTypeEntities){const t=this.docTypeEntities[s];c=c.replace(t.regx,t.val)}for(let s in this.lastEntities){const t=this.lastEntities[s];c=c.replace(t.regex,t.val)}if(this.options.htmlEntities)for(let s in this.htmlEntities){const t=this.htmlEntities[s];c=c.replace(t.regex,t.val)}c=c.replace(this.ampEntity.regex,this.ampEntity.val)}return c};function Mc(c,s,t,e){return c&&(e===void 0&&(e=Object.keys(s.child).length===0),c=this.parseTextData(c,s.tagname,t,!1,s[":@"]?Object.keys(s[":@"]).length!==0:!1,e),c!==void 0&&c!==""&&s.add(this.options.textNodeName,c),c=""),c}function xc(c,s,t){const e="*."+t;for(const i in c){const n=c[i];if(e===n||s===n)return!0}return!1}function vc(c,s,t=">"){let e,i="";for(let n=s;n<c.length;n++){let r=c[n];if(e)r===e&&(e="");else if(r==='"'||r==="'")e=r;else if(r===t[0])if(t[1]){if(c[n+1]===t[1])return{data:i,index:n}}else return{data:i,index:n};else r===" "&&(r=" ");i+=r}}function we(c,s,t,e){const i=c.indexOf(s,t);if(i===-1)throw new Error(e);return i+s.length-1}function hn(c,s,t,e=">"){const i=vc(c,s+1,e);if(!i)return;let n=i.data;const r=i.index,o=n.search(/\s/);let a=n,l=!0;o!==-1&&(a=n.substring(0,o),n=n.substring(o+1).trimStart());const h=a;if(t){const d=a.indexOf(":");d!==-1&&(a=a.substr(d+1),l=a!==i.data.substr(d+1))}return{tagName:a,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}function Dc(c,s,t){const e=t;let i=1;for(;t<c.length;t++)if(c[t]==="<")if(c[t+1]==="/"){const n=we(c,">",t,`${s} is not closed`);if(c.substring(t+2,n).trim()===s&&(i--,i===0))return{tagContent:c.substring(e,t),i:n};t=n}else if(c[t+1]==="?")t=we(c,"?>",t+1,"StopNode is not closed.");else if(c.substr(t+1,3)==="!--")t=we(c,"-->",t+3,"StopNode is not closed.");else if(c.substr(t+1,2)==="![")t=we(c,"]]>",t,"StopNode is not closed.")-2;else{const n=hn(c,t,">");n&&((n&&n.tagName)===s&&n.tagExp[n.tagExp.length-1]!=="/"&&i++,t=n.closeIndex)}}function dn(c,s,t){if(s&&typeof c=="string"){const e=c.trim();return e==="true"?!0:e==="false"?!1:Rc(c,t)}else return Qr.isExist(c)?c:""}var Uc=yc,qr={};function Bc(c,s){return Kr(c,s)}function Kr(c,s,t){let e;const i={};for(let n=0;n<c.length;n++){const r=c[n],o=zc(r);let a="";if(t===void 0?a=o:a=t+"."+o,o===s.textNodeName)e===void 0?e=r[o]:e+=""+r[o];else{if(o===void 0)continue;if(r[o]){let l=Kr(r[o],s,a);const h=kc(l,s);r[":@"]?Vc(l,r[":@"],a,s):Object.keys(l).length===1&&l[s.textNodeName]!==void 0&&!s.alwaysCreateTextNode?l=l[s.textNodeName]:Object.keys(l).length===0&&(s.alwaysCreateTextNode?l[s.textNodeName]="":l=""),i[o]!==void 0&&i.hasOwnProperty(o)?(Array.isArray(i[o])||(i[o]=[i[o]]),i[o].push(l)):s.isArray(o,a,h)?i[o]=[l]:i[o]=l}}}return typeof e=="string"?e.length>0&&(i[s.textNodeName]=e):e!==void 0&&(i[s.textNodeName]=e),i}function zc(c){const s=Object.keys(c);for(let t=0;t<s.length;t++){const e=s[t];if(e!==":@")return e}}function Vc(c,s,t,e){if(s){const i=Object.keys(s),n=i.length;for(let r=0;r<n;r++){const o=i[r];e.isArray(o,t+"."+o,!0,!0)?c[o]=[s[o]]:c[o]=s[o]}}}function kc(c,s){const{textNodeName:t}=s,e=Object.keys(c).length;return!!(e===0||e===1&&(c[t]||typeof c[t]=="boolean"||c[t]===0))}qr.prettify=Bc;const{buildOptions:Gc}=Fn,Yc=Uc,{prettify:Hc}=qr,Wc=Rn;let Xc=class{constructor(s){this.externalEntities={},this.options=Gc(s)}parse(s,t){if(typeof s!="string")if(s.toString)s=s.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(t){t===!0&&(t={});const n=Wc.validate(s,t);if(n!==!0)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const e=new Yc(this.options);e.addExternalEntities(this.externalEntities);const i=e.parseXml(s);return this.options.preserveOrder||i===void 0?i:Hc(i,this.options)}addEntity(s,t){if(t.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(s.indexOf("&")!==-1||s.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(t==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[s]=t}};var Zc=Xc;const $c=`
143
143
  `;function jc(c,s){let t="";return s.format&&s.indentBy.length>0&&(t=$c),Jr(c,s,"",t)}function Jr(c,s,t,e){let i="",n=!1;for(let r=0;r<c.length;r++){const o=c[r],a=Qc(o);if(a===void 0)continue;let l="";if(t.length===0?l=a:l=`${t}.${a}`,a===s.textNodeName){let E=o[a];qc(l,s)||(E=s.tagValueProcessor(a,E),E=to(E,s)),n&&(i+=e),i+=E,n=!1;continue}else if(a===s.cdataPropName){n&&(i+=e),i+=`<![CDATA[${o[a][0][s.textNodeName]}]]>`,n=!1;continue}else if(a===s.commentPropName){i+=e+`<!--${o[a][0][s.textNodeName]}-->`,n=!0;continue}else if(a[0]==="?"){const E=mr(o[":@"],s),p=a==="?xml"?"":e;let I=o[a][0][s.textNodeName];I=I.length!==0?" "+I:"",i+=p+`<${a}${I}${E}?>`,n=!0;continue}let h=e;h!==""&&(h+=s.indentBy);const d=mr(o[":@"],s),u=e+`<${a}${d}`,f=Jr(o[a],s,l,h);s.unpairedTags.indexOf(a)!==-1?s.suppressUnpairedNode?i+=u+">":i+=u+"/>":(!f||f.length===0)&&s.suppressEmptyNode?i+=u+"/>":f&&f.endsWith(">")?i+=u+`>${f}${e}</${a}>`:(i+=u+">",f&&e!==""&&(f.includes("/>")||f.includes("</"))?i+=e+s.indentBy+f+e:i+=f,i+=`</${a}>`),n=!0}return i}function Qc(c){const s=Object.keys(c);for(let t=0;t<s.length;t++){const e=s[t];if(c.hasOwnProperty(e)&&e!==":@")return e}}function mr(c,s){let t="";if(c&&!s.ignoreAttributes)for(let e in c){if(!c.hasOwnProperty(e))continue;let i=s.attributeValueProcessor(e,c[e]);i=to(i,s),i===!0&&s.suppressBooleanAttributes?t+=` ${e.substr(s.attributeNamePrefix.length)}`:t+=` ${e.substr(s.attributeNamePrefix.length)}="${i}"`}return t}function qc(c,s){c=c.substr(0,c.length-s.textNodeName.length-1);let t=c.substr(c.lastIndexOf(".")+1);for(let e in s.stopNodes)if(s.stopNodes[e]===c||s.stopNodes[e]==="*."+t)return!0;return!1}function to(c,s){if(c&&c.length>0&&s.processEntities)for(let t=0;t<s.entities.length;t++){const e=s.entities[t];c=c.replace(e.regex,e.val)}return c}var Kc=jc;const Jc=Kc,tl={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(c,s){return s},attributeValueProcessor:function(c,s){return s},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function Te(c){this.options=Object.assign({},tl,c),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=il),this.processTextOrObjNode=el,this.options.format?(this.indentate=sl,this.tagEndChar=`>
144
144
  `,this.newLine=`
145
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Te.prototype.build=function(c){return this.options.preserveOrder?Jc(c,this.options):(Array.isArray(c)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(c={[this.options.arrayNodeName]:c}),this.j2x(c,0).val)};Te.prototype.j2x=function(c,s){let t="",e="";for(let i in c)if(Object.prototype.hasOwnProperty.call(c,i))if(typeof c[i]>"u")this.isAttribute(i)&&(e+="");else if(c[i]===null)this.isAttribute(i)?e+="":i[0]==="?"?e+=this.indentate(s)+"<"+i+"?"+this.tagEndChar:e+=this.indentate(s)+"<"+i+"/"+this.tagEndChar;else if(c[i]instanceof Date)e+=this.buildTextValNode(c[i],i,"",s);else if(typeof c[i]!="object"){const n=this.isAttribute(i);if(n)t+=this.buildAttrPairStr(n,""+c[i]);else if(i===this.options.textNodeName){let r=this.options.tagValueProcessor(i,""+c[i]);e+=this.replaceEntitiesValue(r)}else e+=this.buildTextValNode(c[i],i,"",s)}else if(Array.isArray(c[i])){const n=c[i].length;let r="",o="";for(let a=0;a<n;a++){const l=c[i][a];if(!(typeof l>"u"))if(l===null)i[0]==="?"?e+=this.indentate(s)+"<"+i+"?"+this.tagEndChar:e+=this.indentate(s)+"<"+i+"/"+this.tagEndChar;else if(typeof l=="object")if(this.options.oneListGroup){const h=this.j2x(l,s+1);r+=h.val,this.options.attributesGroupName&&l.hasOwnProperty(this.options.attributesGroupName)&&(o+=h.attrStr)}else r+=this.processTextOrObjNode(l,i,s);else if(this.options.oneListGroup){let h=this.options.tagValueProcessor(i,l);h=this.replaceEntitiesValue(h),r+=h}else r+=this.buildTextValNode(l,i,"",s)}this.options.oneListGroup&&(r=this.buildObjectNode(r,i,o,s)),e+=r}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){const n=Object.keys(c[i]),r=n.length;for(let o=0;o<r;o++)t+=this.buildAttrPairStr(n[o],""+c[i][n[o]])}else e+=this.processTextOrObjNode(c[i],i,s);return{attrStr:t,val:e}};Te.prototype.buildAttrPairStr=function(c,s){return s=this.options.attributeValueProcessor(c,""+s),s=this.replaceEntitiesValue(s),this.options.suppressBooleanAttributes&&s==="true"?" "+c:" "+c+'="'+s+'"'};function el(c,s,t){const e=this.j2x(c,t+1);return c[this.options.textNodeName]!==void 0&&Object.keys(c).length===1?this.buildTextValNode(c[this.options.textNodeName],s,e.attrStr,t):this.buildObjectNode(e.val,s,e.attrStr,t)}Te.prototype.buildObjectNode=function(c,s,t,e){if(c==="")return s[0]==="?"?this.indentate(e)+"<"+s+t+"?"+this.tagEndChar:this.indentate(e)+"<"+s+t+this.closeTag(s)+this.tagEndChar;{let i="</"+s+this.tagEndChar,n="";return s[0]==="?"&&(n="?",i=""),(t||t==="")&&c.indexOf("<")===-1?this.indentate(e)+"<"+s+t+n+">"+c+i:this.options.commentPropName!==!1&&s===this.options.commentPropName&&n.length===0?this.indentate(e)+`<!--${c}-->`+this.newLine:this.indentate(e)+"<"+s+t+n+this.tagEndChar+c+this.indentate(e)+i}};Te.prototype.closeTag=function(c){let s="";return this.options.unpairedTags.indexOf(c)!==-1?this.options.suppressUnpairedNode||(s="/"):this.options.suppressEmptyNode?s="/":s=`></${c}`,s};Te.prototype.buildTextValNode=function(c,s,t,e){if(this.options.cdataPropName!==!1&&s===this.options.cdataPropName)return this.indentate(e)+`<![CDATA[${c}]]>`+this.newLine;if(this.options.commentPropName!==!1&&s===this.options.commentPropName)return this.indentate(e)+`<!--${c}-->`+this.newLine;if(s[0]==="?")return this.indentate(e)+"<"+s+t+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(s,c);return i=this.replaceEntitiesValue(i),i===""?this.indentate(e)+"<"+s+t+this.closeTag(s)+this.tagEndChar:this.indentate(e)+"<"+s+t+">"+i+"</"+s+this.tagEndChar}};Te.prototype.replaceEntitiesValue=function(c){if(c&&c.length>0&&this.options.processEntities)for(let s=0;s<this.options.entities.length;s++){const t=this.options.entities[s];c=c.replace(t.regex,t.val)}return c};function sl(c){return this.options.indentBy.repeat(c)}function il(c){return c.startsWith(this.options.attributeNamePrefix)&&c!==this.options.textNodeName?c.substr(this.attrPrefixLen):!1}var nl=Te;const rl=Rn,ol=Zc,al=nl;var cl={XMLParser:ol,XMLValidator:rl,XMLBuilder:al};class oi{constructor(s,t){T(this,"date",new Date);T(this,"author");T(this,"guid",re.create());T(this,"viewpoint");T(this,"modifiedAuthor");T(this,"modifiedDate");T(this,"topic");T(this,"_components");T(this,"_comment","");this._components=s,this._comment=t;const e=this._components.get(Pt);this.author=e.config.author}set comment(s){var e;const t=this._components.get(Pt);this._comment=s,this.modifiedDate=new Date,this.modifiedAuthor=t.config.author,(e=this.topic)==null||e.comments.set(this.guid,this)}get comment(){return this._comment}serialize(){let s=null;this.viewpoint&&(s=`<Viewpoint Guid="${this.viewpoint.guid}"/>`);let t=null;this.modifiedDate&&(t=`<ModifiedDate>${this.modifiedDate.toISOString()}</ModifiedDate>`);let e=null;return this.modifiedAuthor&&(e=`<ModifiedAuthor>${this.modifiedAuthor}</ModifiedAuthor>`),`
145
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Te.prototype.build=function(c){return this.options.preserveOrder?Jc(c,this.options):(Array.isArray(c)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(c={[this.options.arrayNodeName]:c}),this.j2x(c,0).val)};Te.prototype.j2x=function(c,s){let t="",e="";for(let i in c)if(Object.prototype.hasOwnProperty.call(c,i))if(typeof c[i]>"u")this.isAttribute(i)&&(e+="");else if(c[i]===null)this.isAttribute(i)?e+="":i[0]==="?"?e+=this.indentate(s)+"<"+i+"?"+this.tagEndChar:e+=this.indentate(s)+"<"+i+"/"+this.tagEndChar;else if(c[i]instanceof Date)e+=this.buildTextValNode(c[i],i,"",s);else if(typeof c[i]!="object"){const n=this.isAttribute(i);if(n)t+=this.buildAttrPairStr(n,""+c[i]);else if(i===this.options.textNodeName){let r=this.options.tagValueProcessor(i,""+c[i]);e+=this.replaceEntitiesValue(r)}else e+=this.buildTextValNode(c[i],i,"",s)}else if(Array.isArray(c[i])){const n=c[i].length;let r="",o="";for(let a=0;a<n;a++){const l=c[i][a];if(!(typeof l>"u"))if(l===null)i[0]==="?"?e+=this.indentate(s)+"<"+i+"?"+this.tagEndChar:e+=this.indentate(s)+"<"+i+"/"+this.tagEndChar;else if(typeof l=="object")if(this.options.oneListGroup){const h=this.j2x(l,s+1);r+=h.val,this.options.attributesGroupName&&l.hasOwnProperty(this.options.attributesGroupName)&&(o+=h.attrStr)}else r+=this.processTextOrObjNode(l,i,s);else if(this.options.oneListGroup){let h=this.options.tagValueProcessor(i,l);h=this.replaceEntitiesValue(h),r+=h}else r+=this.buildTextValNode(l,i,"",s)}this.options.oneListGroup&&(r=this.buildObjectNode(r,i,o,s)),e+=r}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){const n=Object.keys(c[i]),r=n.length;for(let o=0;o<r;o++)t+=this.buildAttrPairStr(n[o],""+c[i][n[o]])}else e+=this.processTextOrObjNode(c[i],i,s);return{attrStr:t,val:e}};Te.prototype.buildAttrPairStr=function(c,s){return s=this.options.attributeValueProcessor(c,""+s),s=this.replaceEntitiesValue(s),this.options.suppressBooleanAttributes&&s==="true"?" "+c:" "+c+'="'+s+'"'};function el(c,s,t){const e=this.j2x(c,t+1);return c[this.options.textNodeName]!==void 0&&Object.keys(c).length===1?this.buildTextValNode(c[this.options.textNodeName],s,e.attrStr,t):this.buildObjectNode(e.val,s,e.attrStr,t)}Te.prototype.buildObjectNode=function(c,s,t,e){if(c==="")return s[0]==="?"?this.indentate(e)+"<"+s+t+"?"+this.tagEndChar:this.indentate(e)+"<"+s+t+this.closeTag(s)+this.tagEndChar;{let i="</"+s+this.tagEndChar,n="";return s[0]==="?"&&(n="?",i=""),(t||t==="")&&c.indexOf("<")===-1?this.indentate(e)+"<"+s+t+n+">"+c+i:this.options.commentPropName!==!1&&s===this.options.commentPropName&&n.length===0?this.indentate(e)+`<!--${c}-->`+this.newLine:this.indentate(e)+"<"+s+t+n+this.tagEndChar+c+this.indentate(e)+i}};Te.prototype.closeTag=function(c){let s="";return this.options.unpairedTags.indexOf(c)!==-1?this.options.suppressUnpairedNode||(s="/"):this.options.suppressEmptyNode?s="/":s=`></${c}`,s};Te.prototype.buildTextValNode=function(c,s,t,e){if(this.options.cdataPropName!==!1&&s===this.options.cdataPropName)return this.indentate(e)+`<![CDATA[${c}]]>`+this.newLine;if(this.options.commentPropName!==!1&&s===this.options.commentPropName)return this.indentate(e)+`<!--${c}-->`+this.newLine;if(s[0]==="?")return this.indentate(e)+"<"+s+t+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(s,c);return i=this.replaceEntitiesValue(i),i===""?this.indentate(e)+"<"+s+t+this.closeTag(s)+this.tagEndChar:this.indentate(e)+"<"+s+t+">"+i+"</"+s+this.tagEndChar}};Te.prototype.replaceEntitiesValue=function(c){if(c&&c.length>0&&this.options.processEntities)for(let s=0;s<this.options.entities.length;s++){const t=this.options.entities[s];c=c.replace(t.regex,t.val)}return c};function sl(c){return this.options.indentBy.repeat(c)}function il(c){return c.startsWith(this.options.attributeNamePrefix)&&c!==this.options.textNodeName?c.substr(this.attrPrefixLen):!1}var nl=Te;const rl=Rn,ol=Zc,al=nl;var cl={XMLParser:ol,XMLValidator:rl,XMLBuilder:al};class oi{constructor(s,t){_(this,"date",new Date);_(this,"author");_(this,"guid",oe.create());_(this,"viewpoint");_(this,"modifiedAuthor");_(this,"modifiedDate");_(this,"topic");_(this,"_components");_(this,"_comment","");this._components=s,this._comment=t;const e=this._components.get(Pt);this.author=e.config.author}set comment(s){var e;const t=this._components.get(Pt);this._comment=s,this.modifiedDate=new Date,this.modifiedAuthor=t.config.author,(e=this.topic)==null||e.comments.set(this.guid,this)}get comment(){return this._comment}serialize(){let s=null;this.viewpoint&&(s=`<Viewpoint Guid="${this.viewpoint.guid}"/>`);let t=null;this.modifiedDate&&(t=`<ModifiedDate>${this.modifiedDate.toISOString()}</ModifiedDate>`);let e=null;return this.modifiedAuthor&&(e=`<ModifiedAuthor>${this.modifiedAuthor}</ModifiedAuthor>`),`
146
146
  <Comment Guid="${this.guid}">
147
147
  <Date>${this.date.toISOString()}</Date>
148
148
  <Author>${this.author}</Author>
@@ -151,7 +151,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
151
151
  ${e??""}
152
152
  ${t??""}
153
153
  </Comment>
154
- `}}const ne=class ne{constructor(s){T(this,"guid",re.create());T(this,"title",ne.default.title);T(this,"creationDate",new Date);T(this,"creationAuthor","");T(this,"viewpoints",new Se);T(this,"relatedTopics",new Se);T(this,"comments",new he);T(this,"customData",{});T(this,"description");T(this,"serverAssignedId");T(this,"dueDate");T(this,"modifiedAuthor");T(this,"modifiedDate");T(this,"index");T(this,"_type",ne.default.type);T(this,"_status",ne.default.status);T(this,"_priority",ne.default.priority);T(this,"_stage",ne.default.priority);T(this,"_assignedTo",ne.default.assignedTo);T(this,"_labels",ne.default.labels);T(this,"_components");this._components=s;const t=s.get(Pt);this.creationAuthor=t.config.author,this.relatedTopics.guard=e=>e!==this.guid}set type(s){const t=this._components.get(Pt),{strict:e,types:i}=t.config;(!e||i.has(s))&&(this._type=s)}get type(){return this._type}set status(s){const t=this._components.get(Pt),{strict:e,statuses:i}=t.config;(!e||i.has(s))&&(this._status=s)}get status(){return this._status}set priority(s){const t=this._components.get(Pt);if(s){const{strict:e,priorities:i}=t.config;if(!(e?i.has(s):!0))return;this._priority=s}else this._priority=s}get priority(){return this._priority}set stage(s){const t=this._components.get(Pt);if(s){const{strict:e,stages:i}=t.config;if(!(e?i.has(s):!0))return;this._stage=s}else this._stage=s}get stage(){return this._stage}set assignedTo(s){const t=this._components.get(Pt);if(s){const{strict:e,users:i}=t.config;if(!(e?i.has(s):!0))return;this._assignedTo=s}else this._assignedTo=s}get assignedTo(){return this._assignedTo}set labels(s){const t=this._components.get(Pt),{strict:e,labels:i}=t.config;if(e){const n=new Set;for(const r of s)(!e||i.has(r))&&n.add(r);this._labels=n}else this._labels=s}get labels(){return this._labels}get _managerVersion(){return this._components.get(Pt).config.version}set(s){const t=s,e=this;for(const n in s){if(n==="guid")continue;const r=t[n];n in this&&(e[n]=r)}return this._components.get(Pt).list.set(this.guid,this),this}createComment(s,t){const e=new oi(this._components,s);return e.viewpoint=t,e.topic=this,this.comments.set(e.guid,e),e}createLabelTags(s=this._managerVersion){let t="Labels";s==="2.1"&&(t="Labels"),s==="3"&&(t="Label");let e=[...this.labels].map(i=>`<${t}>${i}</${t}>`).join(`
154
+ `}}const ne=class ne{constructor(s){_(this,"guid",oe.create());_(this,"title",ne.default.title);_(this,"creationDate",new Date);_(this,"creationAuthor","");_(this,"viewpoints",new Se);_(this,"relatedTopics",new Se);_(this,"comments",new re);_(this,"customData",{});_(this,"description");_(this,"serverAssignedId");_(this,"dueDate");_(this,"modifiedAuthor");_(this,"modifiedDate");_(this,"index");_(this,"_type",ne.default.type);_(this,"_status",ne.default.status);_(this,"_priority",ne.default.priority);_(this,"_stage",ne.default.priority);_(this,"_assignedTo",ne.default.assignedTo);_(this,"_labels",ne.default.labels);_(this,"_components");this._components=s;const t=s.get(Pt);this.creationAuthor=t.config.author,this.relatedTopics.guard=e=>e!==this.guid}set type(s){const t=this._components.get(Pt),{strict:e,types:i}=t.config;(!e||i.has(s))&&(this._type=s)}get type(){return this._type}set status(s){const t=this._components.get(Pt),{strict:e,statuses:i}=t.config;(!e||i.has(s))&&(this._status=s)}get status(){return this._status}set priority(s){const t=this._components.get(Pt);if(s){const{strict:e,priorities:i}=t.config;if(!(e?i.has(s):!0))return;this._priority=s}else this._priority=s}get priority(){return this._priority}set stage(s){const t=this._components.get(Pt);if(s){const{strict:e,stages:i}=t.config;if(!(e?i.has(s):!0))return;this._stage=s}else this._stage=s}get stage(){return this._stage}set assignedTo(s){const t=this._components.get(Pt);if(s){const{strict:e,users:i}=t.config;if(!(e?i.has(s):!0))return;this._assignedTo=s}else this._assignedTo=s}get assignedTo(){return this._assignedTo}set labels(s){const t=this._components.get(Pt),{strict:e,labels:i}=t.config;if(e){const n=new Set;for(const r of s)(!e||i.has(r))&&n.add(r);this._labels=n}else this._labels=s}get labels(){return this._labels}get _managerVersion(){return this._components.get(Pt).config.version}set(s){const t=s,e=this;for(const n in s){if(n==="guid")continue;const r=t[n];n in this&&(e[n]=r)}return this._components.get(Pt).list.set(this.guid,this),this}createComment(s,t){const e=new oi(this._components,s);return e.viewpoint=t,e.topic=this,this.comments.set(e.guid,e),e}createLabelTags(s=this._managerVersion){let t="Labels";s==="2.1"&&(t="Labels"),s==="3"&&(t="Label");let e=[...this.labels].map(i=>`<${t}>${i}</${t}>`).join(`
155
155
  `);for(const i in this.customData){const n=this.customData[i];typeof n=="string"&&(e+=`
156
156
  <${t}>${n}</${t}>`)}return s==="2.1"?e:s==="3"?e.length!==0?`<Labels>
157
157
  ${e}
@@ -192,7 +192,7 @@ ${t}
192
192
  ${s==="2.1"?d:""}
193
193
  ${s==="2.1"?u:""}
194
194
  </Markup>
195
- `}};T(ne,"default",{title:"BCF Topic",type:"Issue",status:"Active",labels:new Set});let _s=ne;const eo=(c,s)=>{if(s.trim()==="")return;const t=Pt.xmlParser.parse(s).Extensions;if(!t)return;const{Priorities:e,TopicStatuses:i,TopicTypes:n,Users:r}=t;if(e&&e.Priority){const o=Array.isArray(e.Priority)?e.Priority:[e.Priority];for(const a of o)c.config.priorities.add(a)}if(i&&i.TopicStatus){const o=Array.isArray(i.TopicStatus)?i.TopicStatus:[i.TopicStatus];for(const a of o)c.config.statuses.add(a)}if(n&&n.TopicType){const o=Array.isArray(n.TopicType)?n.TopicType:[n.TopicType];for(const a of o)c.config.types.add(a)}if(r&&r.User){const o=Array.isArray(r.User)?r.User:[r.User];for(const a of o)c.config.users.add(a)}},Fe=class Fe extends Ft{constructor(){super(...arguments);T(this,"enabled",!1);T(this,"config",{author:"jhon.doe@example.com",version:"2.1",types:new Set(["Clash","Failure","Fault","Inquiry","Issue","Remark","Request"]),statuses:new Set(["Active","In Progress","Done","In Review","Closed"]),priorities:new Set(["On hold","Minor","Normal","Major","Critical"]),labels:new Set,stages:new Set,users:new Set,includeSelectionTag:!1,updateExtensionsOnImport:!0,strict:!1,includeAllExtensionsOnExport:!0,fallbackVersionOnImport:"2.1",ignoreIncompleteTopicsOnImport:!1});T(this,"list",new he);T(this,"onSetup",new Q);T(this,"isSetup",!1);T(this,"onBCFImported",new Q);T(this,"onDisposed",new Q)}setup(t){this.isSetup||(this.config={...this.config,...t},this.isSetup=!0,this.enabled=!0,this.onSetup.trigger())}create(t){const e=new _s(this.components);return t&&(e.guid=t.guid??e.guid,e.set(t)),this.list.set(e.guid,e),e}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get usedTypes(){const t=[...this.list].map(([e,i])=>i.type);return new Set(t)}get usedStatuses(){const t=[...this.list].map(([e,i])=>i.status);return new Set(t)}get usedPriorities(){const t=[...this.list].map(([e,i])=>i.priority).filter(e=>e);return new Set(t)}get usedStages(){const t=[...this.list].map(([e,i])=>i.stage).filter(e=>e);return new Set(t)}get usedUsers(){const t=[];for(const[e,i]of this.list){t.push(i.creationAuthor),i.assignedTo&&t.push(i.assignedTo),i.modifiedAuthor&&t.push(i.modifiedAuthor);for(const[n,r]of i.comments)t.push(r.author),r.modifiedAuthor&&t.push(r.modifiedAuthor)}return new Set(t)}get usedLabels(){const t=[];for(const[e,i]of this.list)t.push(...i.labels);return new Set(t)}updateExtensions(){for(const[t,e]of this.list){for(const i of e.labels)this.config.labels.add(i);this.config.types.add(e.type),e.priority&&this.config.priorities.add(e.priority),e.stage&&this.config.stages.add(e.stage),this.config.statuses.add(e.status),this.config.users.add(e.creationAuthor),e.assignedTo&&this.config.users.add(e.assignedTo),e.modifiedAuthor&&this.config.users.add(e.modifiedAuthor);for(const[i,n]of e.comments)this.config.users.add(n.author),n.modifiedAuthor&&this.config.users.add(n.modifiedAuthor)}}updateViewpointReferences(){const t=this.components.get(Zt);for(const[e,i]of this.list)for(const n of i.viewpoints)t.list.has(n)||i.viewpoints.delete(n)}async export(t=this.list.values()){const e=new dr;e.file("bcf.version",`<?xml version="1.0" encoding="UTF-8"?>
195
+ `}};_(ne,"default",{title:"BCF Topic",type:"Issue",status:"Active",labels:new Set});let As=ne;const eo=(c,s)=>{if(s.trim()==="")return;const t=Pt.xmlParser.parse(s).Extensions;if(!t)return;const{Priorities:e,TopicStatuses:i,TopicTypes:n,Users:r}=t;if(e&&e.Priority){const o=Array.isArray(e.Priority)?e.Priority:[e.Priority];for(const a of o)c.config.priorities.add(a)}if(i&&i.TopicStatus){const o=Array.isArray(i.TopicStatus)?i.TopicStatus:[i.TopicStatus];for(const a of o)c.config.statuses.add(a)}if(n&&n.TopicType){const o=Array.isArray(n.TopicType)?n.TopicType:[n.TopicType];for(const a of o)c.config.types.add(a)}if(r&&r.User){const o=Array.isArray(r.User)?r.User:[r.User];for(const a of o)c.config.users.add(a)}},Fe=class Fe extends Ft{constructor(){super(...arguments);_(this,"enabled",!1);_(this,"config",{author:"jhon.doe@example.com",version:"2.1",types:new Set(["Clash","Failure","Fault","Inquiry","Issue","Remark","Request"]),statuses:new Set(["Active","In Progress","Done","In Review","Closed"]),priorities:new Set(["On hold","Minor","Normal","Major","Critical"]),labels:new Set,stages:new Set,users:new Set,includeSelectionTag:!1,updateExtensionsOnImport:!0,strict:!1,includeAllExtensionsOnExport:!0,fallbackVersionOnImport:"2.1",ignoreIncompleteTopicsOnImport:!1});_(this,"list",new re);_(this,"onSetup",new Q);_(this,"isSetup",!1);_(this,"onBCFImported",new Q);_(this,"onDisposed",new Q)}setup(t){this.isSetup||(this.config={...this.config,...t},this.isSetup=!0,this.enabled=!0,this.onSetup.trigger())}create(t){const e=new As(this.components);return t&&(e.guid=t.guid??e.guid,e.set(t)),this.list.set(e.guid,e),e}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get usedTypes(){const t=[...this.list].map(([e,i])=>i.type);return new Set(t)}get usedStatuses(){const t=[...this.list].map(([e,i])=>i.status);return new Set(t)}get usedPriorities(){const t=[...this.list].map(([e,i])=>i.priority).filter(e=>e);return new Set(t)}get usedStages(){const t=[...this.list].map(([e,i])=>i.stage).filter(e=>e);return new Set(t)}get usedUsers(){const t=[];for(const[e,i]of this.list){t.push(i.creationAuthor),i.assignedTo&&t.push(i.assignedTo),i.modifiedAuthor&&t.push(i.modifiedAuthor);for(const[n,r]of i.comments)t.push(r.author),r.modifiedAuthor&&t.push(r.modifiedAuthor)}return new Set(t)}get usedLabels(){const t=[];for(const[e,i]of this.list)t.push(...i.labels);return new Set(t)}updateExtensions(){for(const[t,e]of this.list){for(const i of e.labels)this.config.labels.add(i);this.config.types.add(e.type),e.priority&&this.config.priorities.add(e.priority),e.stage&&this.config.stages.add(e.stage),this.config.statuses.add(e.status),this.config.users.add(e.creationAuthor),e.assignedTo&&this.config.users.add(e.assignedTo),e.modifiedAuthor&&this.config.users.add(e.modifiedAuthor);for(const[i,n]of e.comments)this.config.users.add(n.author),n.modifiedAuthor&&this.config.users.add(n.modifiedAuthor)}}updateViewpointReferences(){const t=this.components.get(Zt);for(const[e,i]of this.list)for(const n of i.viewpoints)t.list.has(n)||i.viewpoints.delete(n)}async export(t=this.list.values()){const e=new dr;e.file("bcf.version",`<?xml version="1.0" encoding="UTF-8"?>
196
196
  <Version VersionId="${this.config.version}" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/buildingSMART/BCF-XML/release_3_0/Schemas/version.xsd"
197
197
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
198
198
  </Version>`),e.file("bcf.extensions",this.serializeExtensions());const n=await(await fetch("https://thatopen.github.io/engine_components/resources/favicon.ico")).blob(),r=this.components.get(Zt);for(const a of t){const l=e.folder(a.guid);l.file("markup.bcf",a.serialize());for(const h of a.viewpoints){const d=r.list.get(h);d&&(l.file(`${h}.jpeg`,n,{binary:!0}),l.file(`${h}.bcfv`,await d.serialize()))}}return await e.generateAsync({type:"blob"})}serializeExtensions(){const t=[...this.config.types].map(a=>`<TopicType>${a}</TopicType>`).join(`
@@ -223,7 +223,7 @@ ${r}
223
223
  ${o}
224
224
  </Users>`:""}
225
225
  </Extensions>
226
- `}processMarkupComment(t){const{Guid:e,Date:i,Author:n,Comment:r,Viewpoint:o}=t;if(!(e&&i&&n&&(oi||o)))return null;const a=this.components.get(Zt),l=new oi(this.components,r??"");return l.guid=e,l.date=new Date(i),l.author=n,l.viewpoint=o!=null&&o.Guid?a.list.get(o.Guid):void 0,l.modifiedAuthor=t.ModifiedAuthor,l.modifiedDate=t.ModifiedDate?new Date(t.ModifiedDate):void 0,l}getMarkupComments(t,e){var o;let i;if(e==="2.1"&&(i=t.Comment),e==="3"&&(i=(o=t.Topic.Comments)==null?void 0:o.Comment),!i)return[];i=Array.isArray(i)?i:[i];const n=i.map(a=>this.processMarkupComment(a)).filter(a=>a);return Array.isArray(n)?n:[n]}getMarkupLabels(t,e){var r;let i;return e==="2.1"&&(i=t.Topic.Labels),e==="3"&&(i=(r=t.Topic.Labels)==null?void 0:r.Label),i?Array.isArray(i)?i:[i]:[]}getMarkupViewpoints(t,e){var n;let i;return e==="2.1"&&(i=t.Viewpoints),e==="3"&&(i=(n=t.Topic.Viewpoints)==null?void 0:n.ViewPoint),i?(i=Array.isArray(i)?i:[i],i):[]}getMarkupRelatedTopics(t,e){var r;let i;return e==="2.1"&&(i=t.Topic.RelatedTopic),e==="3"&&(i=(r=t.Topic.RelatedTopics)==null?void 0:r.RelatedTopic),i?(Array.isArray(i)?i:[i]).map(o=>o.Guid):[]}async load(t,e){var C;const{fallbackVersionOnImport:i,ignoreIncompleteTopicsOnImport:n,updateExtensionsOnImport:r}=this.config,o=new dr;await o.loadAsync(t);const a=Object.values(o.files);let l=i;const h=a.find(R=>R.name.endsWith(".version"));if(h){const R=await h.async("string"),g=Fe.xmlParser.parse(R).Version.VersionId;l=String(g)}if(!(l&&(l==="2.1"||l==="3")))throw new Error(`BCFTopics: ${l} is not supported.`);const d=a.find(R=>R.name.endsWith(".extensions"));if(r&&d){const R=await d.async("string");eo(this,R)}const u=[],f=this.components.get(Zt),E=a.filter(R=>R.name.endsWith(".bcfv"));for(const R of E){const g=await R.async("string"),y=Fe.xmlParser.parse(g).VisualizationInfo;if(!y){console.warn("Missing VisualizationInfo in Viewpoint");continue}const w={},{Guid:O,ClippingPlanes:M,Components:b,OrthogonalCamera:v,PerspectiveCamera:k}=y;if(O&&(w.guid=O),b){const{Selection:L,Visibility:_}=b;if(L&&L.Component){const q=Array.isArray(L.Component)?L.Component:[L.Component];w.selectionComponents=q.map(G=>G.IfcGuid).filter(G=>G)}if(_&&"DefaultVisibility"in _&&(w.defaultVisibility=_.DefaultVisibility),_&&_.Exceptions&&"Component"in _.Exceptions){const{Component:q}=_.Exceptions,G=Array.isArray(q)?q:[q];w.exceptionComponents=G.map(et=>et.IfcGuid).filter(et=>et)}let D;l==="2.1"&&(D=b.ViewSetupHints),l==="3"&&(D=(C=b.Visibility)==null?void 0:C.ViewSetupHints),D&&("OpeningsVisible"in D&&(w.openingsVisible=D.OpeningsVisible),"SpacesVisible"in D&&(w.spacesVisible=D.SpacesVisible),"SpaceBoundariesVisible"in D&&(w.spaceBoundariesVisible=D.SpaceBoundariesVisible))}if(v||k){const L=y.PerspectiveCamera??y.OrthogonalCamera,{CameraViewPoint:_,CameraDirection:D}=L,q=new x.Vector3(Number(_.X),Number(_.Z),Number(-_.Y)),G=new x.Vector3(Number(D.X),Number(D.Z),Number(-D.Y)),et={position:{x:q.x,y:q.y,z:q.z},direction:{x:G.x,y:G.y,z:G.z},aspectRatio:"AspectRatio"in L?L.AspectRatio:1};"ViewToWorldScale"in L&&(w.camera={...et,viewToWorldScale:L.ViewToWorldScale}),"FieldOfView"in L&&(w.camera={...et,fov:L.FieldOfView})}const F=new wn(this.components,e,{data:w,setCamera:!1});if(b){const{Coloring:L}=b;if(L&&L.Color){const _=Array.isArray(L.Color)?L.Color:[L.Color];for(const D of _){const{Color:q,Component:G}=D,W=(Array.isArray(G)?G:[G]).map(nt=>nt.IfcGuid);F.componentColors.set(q,W)}}}if(u.push(F),M){const L=this.components.get(si),_=Array.isArray(M.ClippingPlane)?M.ClippingPlane:[M.ClippingPlane];for(const D of _){const{Location:q,Direction:G}=D;if(!(q&&G))continue;const et=new x.Vector3(q.X,q.Z,-q.Y),W=new x.Vector3(G.X,-G.Z,G.Y),nt=L.createFromNormalAndCoplanarPoint(e,W,et);nt.visible=!1,nt.enabled=!1,F.clippingPlanes.add(nt)}}}const p={},I=[],m=a.filter(R=>R.name.endsWith(".bcf"));for(const R of m){const g=await R.async("string"),y=Fe.xmlParser.parse(g).Markup,w=y.Topic,{Guid:O,TopicType:M,TopicStatus:b,Title:v,CreationDate:k,CreationAuthor:F}=w;if(n&&!(O&&M&&b&&v&&k&&F))continue;const L=new _s(this.components);L.guid=O??L.guid;const _=this.getMarkupRelatedTopics(y,l);p[L.guid]=new Set(_),L.type=M??L.type,L.status=b??L.status,L.title=v??L.title,L.creationDate=k?new Date(k):L.creationDate,L.creationAuthor=F??L.creationAuthor,L.serverAssignedId=w.ServerAssignedId,L.priority=w.Priority,L.index=w.Index,L.modifiedDate=w.ModifiedDate?new Date(w.ModifiedDate):void 0,L.modifiedAuthor=w.ModifiedAuthor,L.dueDate=w.DueDate?new Date(w.DueDate):void 0,L.assignedTo=w.AssignedTo,L.description=w.Description,L.stage=w.Stage;const D=this.getMarkupLabels(y,l);for(const et of D)L.labels.add(et);const q=this.getMarkupComments(y,l);for(const et of q)L.comments.set(et.guid,et);const G=this.getMarkupViewpoints(y,l);for(const et of G){if(!(et&&et.Guid))continue;const W=f.list.get(et.Guid);W&&L.viewpoints.add(W.guid)}this.list.set(L.guid,L),I.push(L)}for(const R in p){const g=this.list.get(R);if(!g)continue;const y=p[R];for(const w of y)g.relatedTopics.add(w)}return this.onBCFImported.trigger(I),{viewpoints:u,topics:I}}};T(Fe,"uuid","de977976-e4f6-4e4f-a01a-204727839802"),T(Fe,"xmlParser",new cl.XMLParser({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,ignoreDeclaration:!0,ignorePiTags:!0,numberParseOptions:{leadingZeros:!0,hex:!0},parseAttributeValue:!0,preserveOrder:!1,processEntities:!1,removeNSPrefix:!0,trimValues:!0}));let Pt=Fe;const qt=class qt extends Ft{constructor(t){super(t);T(this,"enabled",!0);T(this,"onDisposed",new Q);T(this,"_absoluteMin");T(this,"_absoluteMax");T(this,"_meshes",[]);this.components.add(qt.uuid,this),this._absoluteMin=qt.newBound(!0),this._absoluteMax=qt.newBound(!1)}static getDimensions(t){const{min:e,max:i}=t,n=Math.abs(i.x-e.x),r=Math.abs(i.y-e.y),o=Math.abs(i.z-e.z),a=new x.Vector3;return a.subVectors(i,e).divideScalar(2).add(e),{width:n,height:r,depth:o,center:a}}static newBound(t){const e=t?1:-1;return new x.Vector3(e*Number.MAX_VALUE,e*Number.MAX_VALUE,e*Number.MAX_VALUE)}static getBounds(t,e,i){const n=i||this.newBound(!1),r=e||this.newBound(!0);for(const o of t)o.x<r.x&&(r.x=o.x),o.y<r.y&&(r.y=o.y),o.z<r.z&&(r.z=o.z),o.x>n.x&&(n.x=o.x),o.y>n.y&&(n.y=o.y),o.z>n.z&&(n.z=o.z);return new x.Box3(e,i)}dispose(){const t=this.components.get(le);for(const e of this._meshes)t.destroy(e);this._meshes=[],this.onDisposed.trigger(qt.uuid),this.onDisposed.reset()}get(){const t=this._absoluteMin.clone(),e=this._absoluteMax.clone();return new x.Box3(t,e)}getSphere(){const t=this._absoluteMin.clone(),e=this._absoluteMax.clone(),i=Math.abs((e.x-t.x)/2),n=Math.abs((e.y-t.y)/2),r=Math.abs((e.z-t.z)/2),o=new x.Vector3(t.x+i,t.y+n,t.z+r),a=o.distanceTo(t);return new x.Sphere(o,a)}getMesh(){const t=new x.Box3(this._absoluteMin,this._absoluteMax),e=qt.getDimensions(t),{width:i,height:n,depth:r,center:o}=e,a=new x.BoxGeometry(i,n,r),l=new x.Mesh(a);return this._meshes.push(l),l.position.copy(o),l}reset(){this._absoluteMin=qt.newBound(!0),this._absoluteMax=qt.newBound(!1)}add(t){for(const e of t.items)this.addMesh(e.mesh)}addMesh(t,e){if(!t.geometry.index)return;const i=qt.getFragmentBounds(t);t.updateMatrixWorld();const n=t.matrixWorld,r=new x.Matrix4,o=t instanceof x.InstancedMesh,a=new Set;if(t instanceof Ie.FragmentMesh){e||(e=t.fragment.ids);for(const l of e){const h=t.fragment.getInstancesIDs(l);if(h)for(const d of h)a.add(d)}}else a.add(0);for(const l of a){const h=i.min.clone(),d=i.max.clone();o&&(t.getMatrixAt(l,r),h.applyMatrix4(r),d.applyMatrix4(r)),h.applyMatrix4(n),d.applyMatrix4(n),h.x<this._absoluteMin.x&&(this._absoluteMin.x=h.x),h.y<this._absoluteMin.y&&(this._absoluteMin.y=h.y),h.z<this._absoluteMin.z&&(this._absoluteMin.z=h.z),h.x>this._absoluteMax.x&&(this._absoluteMax.x=h.x),h.y>this._absoluteMax.y&&(this._absoluteMax.y=h.y),h.z>this._absoluteMax.z&&(this._absoluteMax.z=h.z),d.x>this._absoluteMax.x&&(this._absoluteMax.x=d.x),d.y>this._absoluteMax.y&&(this._absoluteMax.y=d.y),d.z>this._absoluteMax.z&&(this._absoluteMax.z=d.z),d.x<this._absoluteMin.x&&(this._absoluteMin.x=d.x),d.y<this._absoluteMin.y&&(this._absoluteMin.y=d.y),d.z<this._absoluteMin.z&&(this._absoluteMin.z=d.z)}}addFragmentIdMap(t){const e=this.components.get(gt);for(const i in t){const n=e.list.get(i);if(!n)continue;const r=t[i];this.addMesh(n.mesh,r)}}static getFragmentBounds(t){const e=t.geometry.attributes.position,i=Number.MAX_VALUE,n=-i,r=new x.Vector3(i,i,i),o=new x.Vector3(n,n,n);if(!t.geometry.index)throw new Error("Geometry must be indexed!");const a=Array.from(t.geometry.index.array);for(let l=0;l<a.length;l++){if(l%3===0&&a[l]===0&&a[l+1]===0&&a[l+2]===0){l+=2;continue}const h=a[l],d=e.getX(h),u=e.getY(h),f=e.getZ(h);d<r.x&&(r.x=d),u<r.y&&(r.y=u),f<r.z&&(r.z=f),d>o.x&&(o.x=d),u>o.y&&(o.y=u),f>o.z&&(o.z=f)}return new x.Box3(r,o)}};T(qt,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let ai=qt;const Ei=class Ei extends Ft{constructor(t){super(t);T(this,"enabled",!0);T(this,"list",{});T(this,"onDisposed",new Q);T(this,"onFragmentsDisposed",t=>{const{groupID:e,fragmentIDs:i}=t;for(const n in this.list){const r=this.list[n],o=Object.keys(r);if(o.includes(e))delete r[e],Object.values(r).length===0&&delete this.list[n];else for(const a of o){const l=r[a];for(const h of i)delete l.map[h];Object.values(l).length===0&&delete r[a]}}});t.add(Ei.uuid,this),t.get(gt).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={},this.components.get(gt).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(t){for(const e in this.list){const i=this.list[e];for(const n in i){const r=i[n];delete r.map[t]}}}find(t){const e=this.components.get(gt);if(!t){const o={};for(const[a,l]of e.list)o[a]=new Set(l.ids);return o}const i=Object.keys(t).length,n={};for(const o in t){const a=t[o];if(!this.list[o]){console.warn(`Classification ${o} does not exist.`);continue}for(const l of a){const h=this.list[o][l];if(h)for(const d in h.map){n[d]||(n[d]=new Map);for(const u of h.map[d]){const f=n[d].get(u);f===void 0?n[d].set(u,1):n[d].set(u,f+1)}}}}const r={};for(const o in n){const a=n[o];for(const[l,h]of a){if(h===void 0)throw new Error("Malformed fragments map!");h===i&&(r[o]||(r[o]=new Set),r[o].add(l))}}return r}byModel(t,e){this.list.models||(this.list.models={});const i=this.list.models;i[t]||(i[t]={map:{},id:null,name:t});const n=i[t];for(const[r,o]of e.data){const a=o[0];for(const l of a){const h=e.keyFragments.get(l);h&&(n.map[h]||(n.map[h]=new Set),n.map[h].add(r))}}}async byPredefinedType(t){var n;this.list.predefinedTypes||(this.list.predefinedTypes={});const e=this.list.predefinedTypes,i=t.getAllPropertiesIDs();for(const r of i){const o=await t.getProperties(r);if(!o)continue;const a=String((n=o.PredefinedType)==null?void 0:n.value).toUpperCase();e[a]||(e[a]={map:{},id:null,name:a});const l=e[a];for(const[h,d]of t.data){const u=d[0];for(const f of u){const E=t.keyFragments.get(f);if(!E)throw new Error("Fragment ID not found!");l.map[E]||(l.map[E]=new Set),l.map[E].add(o.expressID)}}}}byEntity(t){this.list.entities||(this.list.entities={});for(const[e,i]of t.data){const r=i[1][1],o=_n[r];this.saveItem(t,"entities",o,e)}}async byIfcRel(t,e,i){Oe.isRel(e)&&await Oe.getRelationMap(t,e,async(n,r)=>{const{name:o}=await Oe.getEntityName(t,n);for(const a of r)this.saveItem(t,i,o??"NO REL NAME",a)})}async bySpatialStructure(t,e={}){var l,h;const i=this.components.get(Ce),n=i.relationMaps[t.uuid];if(!n)throw new Error(`Classifier: model relations of ${t.name||t.uuid} have to exists to group by spatial structure.`);const r="spatialStructures",a=e.useProperties===void 0||e.useProperties;for(const[d]of n){if(e.isolate){const p=t.data.get(d);if(!p)continue;const I=p[1][1];if(I===void 0||!e.isolate.has(I))continue}const u=i.getEntityRelations(t,d,"Decomposes");if(u)for(const p of u){let I=p.toString();if(a){const m=await t.getProperties(p);if(!m)continue;I=(l=m.Name)==null?void 0:l.value}this.saveItem(t,r,I,d,p)}const f=i.getEntityRelations(t,d,"ContainsElements");if(!f)continue;let E=d.toString();if(a){const p=await t.getProperties(d);if(!p)continue;E=(h=p.Name)==null?void 0:h.value}for(const p of f){this.saveItem(t,r,E,p,d);const I=i.getEntityRelations(t,Number(p),"IsDecomposedBy");if(I)for(const m of I)this.saveItem(t,r,E,m,d)}}}setColor(t,e,i=!1){const n=this.components.get(gt);for(const r in t){const o=n.list.get(r);if(!o)continue;const a=t[r];o.setColor(e,a,i)}}resetColor(t){const e=this.components.get(gt);for(const i in t){const n=e.list.get(i);if(!n)continue;const r=t[i];n.resetColor(r)}}saveItem(t,e,i,n,r=null){this.list[e]||(this.list[e]={});const o=t.data.get(n);if(o)for(const a of o[0]){const l=t.keyFragments.get(a);if(l){const h=this.list[e];h[i]||(h[i]={map:{},id:r,name:i}),h[i].map[l]||(h[i].map[l]=new Set),h[i].map[l].add(n)}}}};T(Ei,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let Xe=Ei;const mi=class mi extends Ft{constructor(t){super(t);T(this,"onDisposed",new Q);T(this,"enabled",!0);T(this,"height",10);T(this,"groupName","spatialStructures");T(this,"list",new Set);t.add(mi.uuid,this)}dispose(){this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}set(t){if(!this.enabled)return;const e=this.components.get(Xe),i=this.components.get(gt),n=t?1:-1;let r=0;const o=e.list[this.groupName],a=new x.Matrix4;for(const l in o){a.elements[13]=r*n*this.height;for(const h in o[l].map){const d=i.list.get(h),u=l+h,f=this.list.has(u);if(!d||t&&f||!t&&!f)continue;t?this.list.add(u):this.list.delete(u);const E=o[l].map[h];d.applyTransform(E,a),d.mesh.computeBoundingSphere(),d.mesh.computeBoundingBox()}r++}}};T(mi,"uuid","d260618b-ce88-4c7d-826c-6debb91de3e2");let un=mi;const Ii=class Ii extends Ft{constructor(t){super(t);T(this,"enabled",!0);this.components.add(Ii.uuid,this)}set(t,e){const i=this.components.get(gt);if(!e){for(const[n,r]of i.list)r&&(r.setVisibility(t),this.updateCulledVisibility(r));return}for(const n in e){const r=e[n],o=i.list.get(n);o&&(o.setVisibility(t,r),this.updateCulledVisibility(o))}}isolate(t){this.set(!1),this.set(!0,t)}updateCulledVisibility(t){const e=this.components.get(ei);for(const[i,n]of e.list){const r=n.colorMeshes.get(t.id);r&&(r.count=t.mesh.count)}}};T(Ii,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");let ci=Ii;class so extends Si{constructor(){super(...arguments);T(this,"minGeometrySize",10);T(this,"minAssetsSize",1e3)}}const gi=class gi extends Ft{constructor(t){super(t);T(this,"onGeometryStreamed",new Q);T(this,"onAssetStreamed",new Q);T(this,"onProgress",new Q);T(this,"onIfcLoaded",new Q);T(this,"onDisposed",new Q);T(this,"settings",new so);T(this,"enabled",!0);T(this,"webIfc",new Z.IfcAPI);T(this,"_spatialTree",new Gr);T(this,"_metaData",new Hr);T(this,"_visitedGeometries",new Map);T(this,"_streamSerializer",new Ie.StreamSerializer);T(this,"_geometries",new Map);T(this,"_geometryCount",0);T(this,"_civil",new Yr);T(this,"_groupSerializer",new Ie.Serializer);T(this,"_assets",[]);T(this,"_meshesWithHoles",new Set);this.components.add(gi.uuid,this),this.settings.excludedCategories.add(Z.IFCOPENINGELEMENT)}dispose(){this.onIfcLoaded.reset(),this.onGeometryStreamed.reset(),this.onAssetStreamed.reset(),this.webIfc=null,this.onDisposed.trigger(),this.onDisposed.reset()}async streamFromBuffer(t){await this.readIfcFile(t),await this.streamAllGeometries(),this.cleanUp()}async streamFromCallBack(t){await this.streamIfcFile(t),await this.streamAllGeometries(),this.cleanUp()}async readIfcFile(t){const{path:e,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:e,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllGeometries(){const{minGeometrySize:t,minAssetsSize:e}=this.settings;this._spatialTree.setUp(this.webIfc);const i=this.webIfc.GetIfcEntityList(0),n=[[]],r=new Ie.FragmentsGroup;r.ifcMetadata={name:"",description:"",...this._metaData.getNameInfo(this.webIfc),...this._metaData.getDescriptionInfo(this.webIfc),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};let o=0,a=0;for(const p of i){if(!this.webIfc.IsIfcElement(p)&&p!==Z.IFCSPACE||this.settings.excludedCategories.has(p))continue;const I=this.webIfc.GetLineIDsWithType(0,p),m=I.size();for(let C=0;C<m;C++){o>t&&(o=0,a++,n.push([]));const R=I.get(C);n[a].push(R);const g=this.webIfc.GetLine(0,R);if(g.GlobalId){const w=(g==null?void 0:g.GlobalId.value)||(g==null?void 0:g.GlobalId);r.globalToExpressIDs.set(w,R)}const y=this._spatialTree.itemsByFloor[R]||0;r.data.set(R,[[],[y,p]]),o++}}this._spatialTree.cleanUp();let l=.01,h=0;for(const p of n){h++,this.webIfc.StreamMeshes(0,p,m=>{this.getMesh(this.webIfc,m,r)}),this._geometryCount>t&&await this.streamGeometries(),this._assets.length>e&&await this.streamAssets();const I=h/n.length;I>l&&(l+=.01,l=Math.max(l,I),this.onProgress.trigger(Math.round(l*100)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:d,transparent:u}=r.geometryIDs;for(const[p,{index:I,uuid:m}]of this._visitedGeometries)r.keyFragments.set(I,m),(p>1?d:u).set(p,I);Wr.get(r,this.webIfc);const f=this.webIfc.GetCoordinationMatrix(0);r.coordinationMatrix.fromArray(f),r.civilData=this._civil.read(this.webIfc);const E=this._groupSerializer.export(r);this.onIfcLoaded.trigger(E),r.dispose(!0)}cleanUp(){try{this.webIfc.Dispose()}catch{}this.webIfc=null,this.webIfc=new Z.IfcAPI,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(t,e,i){const n=e.geometries.size(),r=e.expressID,o={id:r,geometries:[]};for(let a=0;a<n;a++){const l=e.geometries.get(a),h=l.geometryExpressID,d=l.color.w===1?1:-1,u=h*d;if(!this._visitedGeometries.has(u)){this._visitedGeometries.has(h)||this.getGeometry(t,h);const y=this._visitedGeometries.size,w=x.MathUtils.generateUUID();this._visitedGeometries.set(u,{uuid:w,index:y})}const f=this._visitedGeometries.get(u);if(f===void 0)throw new Error("Error getting geometry data for streaming!");const E=i.data.get(r);if(!E)throw new Error("Data not found!");E[0].push(f.index);const{x:p,y:I,z:m,w:C}=l.color,R=[p,I,m,C],g=l.flatTransformation;o.geometries.push({color:R,geometryID:h,transformation:g})}this._assets.push(o)}getGeometry(t,e){const i=t.GetGeometry(0,e),n=t.GetIndexArray(i.GetIndexData(),i.GetIndexDataSize()),r=t.GetVertexArray(i.GetVertexData(),i.GetVertexDataSize()),o=new Float32Array(r.length/2),a=new Float32Array(r.length/2);for(let f=0;f<r.length;f+=6)o[f/2]=r[f],o[f/2+1]=r[f+1],o[f/2+2]=r[f+2],a[f/2]=r[f+3],a[f/2+1]=r[f+4],a[f/2+2]=r[f+5];const l=Fr(o),h=new Float32Array(l.transformation.elements),d=[l.center.x,l.center.y,l.center.z];let u=!1;for(let f=0;f<o.length-2;f+=3){const E=o[f],p=o[f+1],I=o[f+2],m=a[f],C=a[f+1],R=a[f+2];if(wr(d,[E,p,I],[m,C,R])){u=!0;break}}this._geometries.set(e,{position:o,normal:a,index:n,boundingBox:h,hasHoles:u}),i.delete(),this._geometryCount++}async streamAssets(){await this.onAssetStreamed.trigger(this._assets),this._assets=null,this._assets=[]}async streamGeometries(){let t=this._streamSerializer.export(this._geometries),e={};for(const[i,{boundingBox:n,hasHoles:r}]of this._geometries)e[i]={boundingBox:n,hasHoles:r};this.onGeometryStreamed.trigger({data:e,buffer:t}),e=null,t=null,this._geometries.clear(),this._geometryCount=0}};T(gi,"uuid","d9999a00-e1f5-4d3f-8cfe-c56e08609764");let fn=gi;class io extends Si{constructor(){super(...arguments);T(this,"propertiesSize",100)}}class no extends Ft{constructor(){super(...arguments);T(this,"onPropertiesStreamed",new Es);T(this,"onProgress",new Es);T(this,"onIndicesStreamed",new Es);T(this,"onDisposed",new Q);T(this,"enabled",!0);T(this,"settings",new io);T(this,"webIfc",new Z.IfcAPI)}async dispose(){this.onIndicesStreamed.reset(),this.onPropertiesStreamed.reset(),this.webIfc=null,this.onDisposed.reset()}async streamFromBuffer(t){await this.readIfcFile(t),await this.streamAllProperties(),this.cleanUp()}async streamFromCallBack(t){await this.streamIfcFile(t),await this.streamAllProperties(),this.cleanUp()}async readIfcFile(t){const{path:e,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:e,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:t}=this.settings,e=new Set(this.webIfc.GetIfcEntityList(0)),i=new Set([Z.IFCPROJECT,Z.IFCSITE,Z.IFCBUILDING,Z.IFCBUILDINGSTOREY,Z.IFCSPACE]);for(const l of i)e.add(l);let n=.01,r=0;for(const l of e){if(r++,An.has(l))continue;const h=i.has(l),d=this.webIfc.GetLineIDsWithType(0,l),u=d.size();let f=0;for(let p=0;p<u-t;p+=t){const I={};for(let m=0;m<t;m++){f++;const C=d.get(p+m);try{const R=this.webIfc.GetLine(0,C,h);I[R.expressID]=R}catch{console.log(`Could not get property: ${C}`)}}await this.onPropertiesStreamed.trigger({type:l,data:I})}if(f!==u){const p={};for(let I=f;I<u;I++){const m=d.get(I);try{const C=this.webIfc.GetLine(0,m,h);p[C.expressID]=C}catch{console.log(`Could not get property: ${m}`)}}await this.onPropertiesStreamed.trigger({type:l,data:p})}r/e.size>n&&(n=Math.round(n*100)/100,await this.onProgress.trigger(n),n+=.01)}await this.onProgress.trigger(1);const a=await this.components.get(Ce).processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(a)}cleanUp(){this.webIfc.Dispose(),this.webIfc=null,this.webIfc=new Z.IfcAPI}}T(no,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");class wn{constructor(s,t,e){T(this,"title");T(this,"guid",re.create());T(this,"clippingPlanes",new Se);T(this,"camera",{aspectRatio:0,fov:0,direction:{x:0,y:0,z:80},position:{x:0,y:0,z:0}});T(this,"exceptionComponents",new Se);T(this,"selectionComponents",new Se);T(this,"componentColors",new he);T(this,"spacesVisible",!1);T(this,"spaceBoundariesVisible",!1);T(this,"openingsVisible",!1);T(this,"defaultVisibility",!0);T(this,"_components");T(this,"world");const i={setCamera:!0,...e},{data:n,setCamera:r}=i;this._components=s,this.world=t,n&&(this.guid=n.guid??this.guid,this.set(n)),r&&this.updateCamera()}get _selectionModelIdMap(){const s=this._components.get(gt),t={};for(const[e,i]of s.groups){e in t||(t[e]=new Set);for(const n of this.selectionComponents){const r=i.globalToExpressIDs.get(n);r&&t[e].add(r)}}return t}get _exceptionModelIdMap(){const s=this._components.get(gt),t={};for(const[e,i]of s.groups){e in t||(t[e]=new Set);for(const n of this.exceptionComponents){const r=i.globalToExpressIDs.get(n);r&&t[e].add(r)}}return t}get selection(){return this._components.get(gt).modelIdToFragmentIdMap(this._selectionModelIdMap)}get exception(){return this._components.get(gt).modelIdToFragmentIdMap(this._exceptionModelIdMap)}get projection(){return"fov"in this.camera?"Perspective":"Orthographic"}get position(){const s=this._components.get(gt),{position:t}=this.camera,{x:e,y:i,z:n}=t,r=new x.Vector3(e,i,n);return s.applyBaseCoordinateSystem(r,new x.Matrix4),r}get direction(){const{direction:s}=this.camera,{x:t,y:e,z:i}=s;return new x.Vector3(t,e,i)}get _managerVersion(){return this._components.get(Pt).config.version}get topics(){return[...this._components.get(Pt).list.values()].filter(i=>i.viewpoints.has(this.guid))}async addComponentsFromMap(s){var i;const t=this._components.get(gt);for(const n in s){const r=t.list.get(n);if(!(r&&r.group))continue;const o=r.group,a=s[n];for(const l of a){const h=await o.getProperties(l);if(!h)continue;const d=(i=h.GlobalId)==null?void 0:i.value;d&&this.selectionComponents.add(d)}}this._components.get(Zt).list.set(this.guid,this)}set(s){const t=s,e=this;for(const n in s){if(n==="guid")continue;const r=t[n];n in this&&(e[n]=r)}return this._components.get(Zt).list.set(this.guid,this),this}async go(s=!0){const{camera:t}=this.world;if(!t.hasCameraControls())throw new Error("Viewpoint: the world's camera need controls to set the viewpoint.");t instanceof Vr&&t.projection.set(this.projection);const e=this.position,i=this.direction;let n={x:e.x+i.x*80,y:e.y+i.y*80,z:e.z+i.z*80};const r=this.selection;if(Object.keys(r).length===0){const h=this._components.get(Ne).get(this.world).castRayFromVector(e,this.direction);h&&(n=h.point)}else{const a=this._components.get(ai);a.reset(),a.addFragmentIdMap(r),n=a.getSphere().center,a.reset()}const o=this._components.get(ci);o.set(this.defaultVisibility),o.set(!this.defaultVisibility,this.exception),o.set(!0,r),await t.controls.setLookAt(e.x,e.y,e.z,n.x,n.y,n.z,s)}updateCamera(){const{camera:s,renderer:t}=this.world;if(!t)throw new Error("Viewpoint: the world needs to have a renderer!");if(!s.hasCameraControls())throw new Error("Viewpoint: world's camera need camera controls!");const e=new x.Vector3;s.controls.getPosition(e);const i=s.three,n=new x.Vector3(0,0,-1).applyEuler(i.rotation),{width:r,height:o}=t.getSize();let a=r/o;Number.isNaN(a)&&(a=1);const l=this._components.get(gt);e.applyMatrix4(l.baseCoordinationMatrix.clone().invert());const h={aspectRatio:a,position:{x:e.x,y:e.y,z:e.z},direction:{x:n.x,y:n.y,z:n.z}};i instanceof x.PerspectiveCamera?this.camera={...h,fov:i.fov}:i instanceof x.OrthographicCamera&&(this.camera={...h,viewToWorldScale:i.top-i.bottom}),this._components.get(Zt).list.set(this.guid,this)}colorize(){const s=this._components.get(Zt),t=this._components.get(gt),e=this._components.get(Xe);for(const[i,n]of this.componentColors){const r=t.guidToFragmentIdMap(n),o=new x.Color(`#${i}`);e.setColor(r,o,s.config.overwriteColors)}}resetColors(){const s=this._components.get(gt),t=this._components.get(Xe);for(const[e,i]of this.componentColors){const n=s.guidToFragmentIdMap(i);t.resetColor(n)}}async createComponentTags(s){var n,r;const t=this._components.get(gt),e=this._components.get(Pt);let i="";if(e.config.includeSelectionTag){const o=s==="selection"?this._selectionModelIdMap:this._exceptionModelIdMap;for(const a in o){const l=t.groups.get(a);if(!l)continue;const h=o[a];for(const d of h){const u=await l.getProperties(d);if(!u)continue;const f=(n=u.GlobalId)==null?void 0:n.value;if(!f)continue;const E=(r=u.Tag)==null?void 0:r.value;let p=null;E&&(p=`AuthoringToolId="${E}"`),i+=`
226
+ `}processMarkupComment(t){const{Guid:e,Date:i,Author:n,Comment:r,Viewpoint:o}=t;if(!(e&&i&&n&&(oi||o)))return null;const a=this.components.get(Zt),l=new oi(this.components,r??"");return l.guid=e,l.date=new Date(i),l.author=n,l.viewpoint=o!=null&&o.Guid?a.list.get(o.Guid):void 0,l.modifiedAuthor=t.ModifiedAuthor,l.modifiedDate=t.ModifiedDate?new Date(t.ModifiedDate):void 0,l}getMarkupComments(t,e){var o;let i;if(e==="2.1"&&(i=t.Comment),e==="3"&&(i=(o=t.Topic.Comments)==null?void 0:o.Comment),!i)return[];i=Array.isArray(i)?i:[i];const n=i.map(a=>this.processMarkupComment(a)).filter(a=>a);return Array.isArray(n)?n:[n]}getMarkupLabels(t,e){var r;let i;return e==="2.1"&&(i=t.Topic.Labels),e==="3"&&(i=(r=t.Topic.Labels)==null?void 0:r.Label),i?Array.isArray(i)?i:[i]:[]}getMarkupViewpoints(t,e){var n;let i;return e==="2.1"&&(i=t.Viewpoints),e==="3"&&(i=(n=t.Topic.Viewpoints)==null?void 0:n.ViewPoint),i?(i=Array.isArray(i)?i:[i],i):[]}getMarkupRelatedTopics(t,e){var r;let i;return e==="2.1"&&(i=t.Topic.RelatedTopic),e==="3"&&(i=(r=t.Topic.RelatedTopics)==null?void 0:r.RelatedTopic),i?(Array.isArray(i)?i:[i]).map(o=>o.Guid):[]}async load(t,e){var C;const{fallbackVersionOnImport:i,ignoreIncompleteTopicsOnImport:n,updateExtensionsOnImport:r}=this.config,o=new dr;await o.loadAsync(t);const a=Object.values(o.files);let l=i;const h=a.find(R=>R.name.endsWith(".version"));if(h){const R=await h.async("string"),g=Fe.xmlParser.parse(R).Version.VersionId;l=String(g)}if(!(l&&(l==="2.1"||l==="3")))throw new Error(`BCFTopics: ${l} is not supported.`);const d=a.find(R=>R.name.endsWith(".extensions"));if(r&&d){const R=await d.async("string");eo(this,R)}const u=[],f=this.components.get(Zt),E=a.filter(R=>R.name.endsWith(".bcfv"));for(const R of E){const g=await R.async("string"),y=Fe.xmlParser.parse(g).VisualizationInfo;if(!y){console.warn("Missing VisualizationInfo in Viewpoint");continue}const w={},{Guid:O,ClippingPlanes:M,Components:b,OrthogonalCamera:v,PerspectiveCamera:k}=y;if(O&&(w.guid=O),b){const{Selection:L,Visibility:T}=b;if(L&&L.Component){const q=Array.isArray(L.Component)?L.Component:[L.Component];w.selectionComponents=q.map(G=>G.IfcGuid).filter(G=>G)}if(T&&"DefaultVisibility"in T&&(w.defaultVisibility=T.DefaultVisibility),T&&T.Exceptions&&"Component"in T.Exceptions){const{Component:q}=T.Exceptions,G=Array.isArray(q)?q:[q];w.exceptionComponents=G.map(et=>et.IfcGuid).filter(et=>et)}let D;l==="2.1"&&(D=b.ViewSetupHints),l==="3"&&(D=(C=b.Visibility)==null?void 0:C.ViewSetupHints),D&&("OpeningsVisible"in D&&(w.openingsVisible=D.OpeningsVisible),"SpacesVisible"in D&&(w.spacesVisible=D.SpacesVisible),"SpaceBoundariesVisible"in D&&(w.spaceBoundariesVisible=D.SpaceBoundariesVisible))}if(v||k){const L=y.PerspectiveCamera??y.OrthogonalCamera,{CameraViewPoint:T,CameraDirection:D}=L,q=new x.Vector3(Number(T.X),Number(T.Z),Number(-T.Y)),G=new x.Vector3(Number(D.X),Number(D.Z),Number(-D.Y)),et={position:{x:q.x,y:q.y,z:q.z},direction:{x:G.x,y:G.y,z:G.z},aspectRatio:"AspectRatio"in L?L.AspectRatio:1};"ViewToWorldScale"in L&&(w.camera={...et,viewToWorldScale:L.ViewToWorldScale}),"FieldOfView"in L&&(w.camera={...et,fov:L.FieldOfView})}const F=new wn(this.components,e,{data:w,setCamera:!1});if(b){const{Coloring:L}=b;if(L&&L.Color){const T=Array.isArray(L.Color)?L.Color:[L.Color];for(const D of T){const{Color:q,Component:G}=D,W=(Array.isArray(G)?G:[G]).map(nt=>nt.IfcGuid);F.componentColors.set(q,W)}}}if(u.push(F),M){const L=this.components.get(si),T=Array.isArray(M.ClippingPlane)?M.ClippingPlane:[M.ClippingPlane];for(const D of T){const{Location:q,Direction:G}=D;if(!(q&&G))continue;const et=new x.Vector3(q.X,q.Z,-q.Y),W=new x.Vector3(G.X,-G.Z,G.Y),nt=L.createFromNormalAndCoplanarPoint(e,W,et);nt.visible=!1,nt.enabled=!1,F.clippingPlanes.add(nt)}}}const p={},I=[],m=a.filter(R=>R.name.endsWith(".bcf"));for(const R of m){const g=await R.async("string"),y=Fe.xmlParser.parse(g).Markup,w=y.Topic,{Guid:O,TopicType:M,TopicStatus:b,Title:v,CreationDate:k,CreationAuthor:F}=w;if(n&&!(O&&M&&b&&v&&k&&F))continue;const L=new As(this.components);L.guid=O??L.guid;const T=this.getMarkupRelatedTopics(y,l);p[L.guid]=new Set(T),L.type=M??L.type,L.status=b??L.status,L.title=v??L.title,L.creationDate=k?new Date(k):L.creationDate,L.creationAuthor=F??L.creationAuthor,L.serverAssignedId=w.ServerAssignedId,L.priority=w.Priority,L.index=w.Index,L.modifiedDate=w.ModifiedDate?new Date(w.ModifiedDate):void 0,L.modifiedAuthor=w.ModifiedAuthor,L.dueDate=w.DueDate?new Date(w.DueDate):void 0,L.assignedTo=w.AssignedTo,L.description=w.Description,L.stage=w.Stage;const D=this.getMarkupLabels(y,l);for(const et of D)L.labels.add(et);const q=this.getMarkupComments(y,l);for(const et of q)L.comments.set(et.guid,et);const G=this.getMarkupViewpoints(y,l);for(const et of G){if(!(et&&et.Guid))continue;const W=f.list.get(et.Guid);W&&L.viewpoints.add(W.guid)}this.list.set(L.guid,L),I.push(L)}for(const R in p){const g=this.list.get(R);if(!g)continue;const y=p[R];for(const w of y)g.relatedTopics.add(w)}return this.onBCFImported.trigger(I),{viewpoints:u,topics:I}}};_(Fe,"uuid","de977976-e4f6-4e4f-a01a-204727839802"),_(Fe,"xmlParser",new cl.XMLParser({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,ignoreDeclaration:!0,ignorePiTags:!0,numberParseOptions:{leadingZeros:!0,hex:!0},parseAttributeValue:!0,preserveOrder:!1,processEntities:!1,removeNSPrefix:!0,trimValues:!0}));let Pt=Fe;const qt=class qt extends Ft{constructor(t){super(t);_(this,"enabled",!0);_(this,"onDisposed",new Q);_(this,"_absoluteMin");_(this,"_absoluteMax");_(this,"_meshes",[]);this.components.add(qt.uuid,this),this._absoluteMin=qt.newBound(!0),this._absoluteMax=qt.newBound(!1)}static getDimensions(t){const{min:e,max:i}=t,n=Math.abs(i.x-e.x),r=Math.abs(i.y-e.y),o=Math.abs(i.z-e.z),a=new x.Vector3;return a.subVectors(i,e).divideScalar(2).add(e),{width:n,height:r,depth:o,center:a}}static newBound(t){const e=t?1:-1;return new x.Vector3(e*Number.MAX_VALUE,e*Number.MAX_VALUE,e*Number.MAX_VALUE)}static getBounds(t,e,i){const n=i||this.newBound(!1),r=e||this.newBound(!0);for(const o of t)o.x<r.x&&(r.x=o.x),o.y<r.y&&(r.y=o.y),o.z<r.z&&(r.z=o.z),o.x>n.x&&(n.x=o.x),o.y>n.y&&(n.y=o.y),o.z>n.z&&(n.z=o.z);return new x.Box3(e,i)}dispose(){const t=this.components.get(he);for(const e of this._meshes)t.destroy(e);this._meshes=[],this.onDisposed.trigger(qt.uuid),this.onDisposed.reset()}get(){const t=this._absoluteMin.clone(),e=this._absoluteMax.clone();return new x.Box3(t,e)}getSphere(){const t=this._absoluteMin.clone(),e=this._absoluteMax.clone(),i=Math.abs((e.x-t.x)/2),n=Math.abs((e.y-t.y)/2),r=Math.abs((e.z-t.z)/2),o=new x.Vector3(t.x+i,t.y+n,t.z+r),a=o.distanceTo(t);return new x.Sphere(o,a)}getMesh(){const t=new x.Box3(this._absoluteMin,this._absoluteMax),e=qt.getDimensions(t),{width:i,height:n,depth:r,center:o}=e,a=new x.BoxGeometry(i,n,r),l=new x.Mesh(a);return this._meshes.push(l),l.position.copy(o),l}reset(){this._absoluteMin=qt.newBound(!0),this._absoluteMax=qt.newBound(!1)}add(t){for(const e of t.items)this.addMesh(e.mesh)}addMesh(t,e){if(!t.geometry.index)return;const i=qt.getFragmentBounds(t);t.updateMatrixWorld();const n=t.matrixWorld,r=new x.Matrix4,o=t instanceof x.InstancedMesh,a=new Set;if(t instanceof Ie.FragmentMesh){e||(e=t.fragment.ids);for(const l of e){const h=t.fragment.getInstancesIDs(l);if(h)for(const d of h)a.add(d)}}else a.add(0);for(const l of a){const h=i.min.clone(),d=i.max.clone();o&&(t.getMatrixAt(l,r),h.applyMatrix4(r),d.applyMatrix4(r)),h.applyMatrix4(n),d.applyMatrix4(n),h.x<this._absoluteMin.x&&(this._absoluteMin.x=h.x),h.y<this._absoluteMin.y&&(this._absoluteMin.y=h.y),h.z<this._absoluteMin.z&&(this._absoluteMin.z=h.z),h.x>this._absoluteMax.x&&(this._absoluteMax.x=h.x),h.y>this._absoluteMax.y&&(this._absoluteMax.y=h.y),h.z>this._absoluteMax.z&&(this._absoluteMax.z=h.z),d.x>this._absoluteMax.x&&(this._absoluteMax.x=d.x),d.y>this._absoluteMax.y&&(this._absoluteMax.y=d.y),d.z>this._absoluteMax.z&&(this._absoluteMax.z=d.z),d.x<this._absoluteMin.x&&(this._absoluteMin.x=d.x),d.y<this._absoluteMin.y&&(this._absoluteMin.y=d.y),d.z<this._absoluteMin.z&&(this._absoluteMin.z=d.z)}}addFragmentIdMap(t){const e=this.components.get(gt);for(const i in t){const n=e.list.get(i);if(!n)continue;const r=t[i];this.addMesh(n.mesh,r)}}static getFragmentBounds(t){const e=t.geometry.attributes.position,i=Number.MAX_VALUE,n=-i,r=new x.Vector3(i,i,i),o=new x.Vector3(n,n,n);if(!t.geometry.index)throw new Error("Geometry must be indexed!");const a=Array.from(t.geometry.index.array);for(let l=0;l<a.length;l++){if(l%3===0&&a[l]===0&&a[l+1]===0&&a[l+2]===0){l+=2;continue}const h=a[l],d=e.getX(h),u=e.getY(h),f=e.getZ(h);d<r.x&&(r.x=d),u<r.y&&(r.y=u),f<r.z&&(r.z=f),d>o.x&&(o.x=d),u>o.y&&(o.y=u),f>o.z&&(o.z=f)}return new x.Box3(r,o)}};_(qt,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let ai=qt;const Ei=class Ei extends Ft{constructor(t){super(t);_(this,"enabled",!0);_(this,"list",{});_(this,"onDisposed",new Q);_(this,"onFragmentsDisposed",t=>{const{groupID:e,fragmentIDs:i}=t;for(const n in this.list){const r=this.list[n],o=Object.keys(r);if(o.includes(e))delete r[e],Object.values(r).length===0&&delete this.list[n];else for(const a of o){const l=r[a];for(const h of i)delete l.map[h];Object.values(l).length===0&&delete r[a]}}});t.add(Ei.uuid,this),t.get(gt).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={},this.components.get(gt).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(t){for(const e in this.list){const i=this.list[e];for(const n in i){const r=i[n];delete r.map[t]}}}find(t){const e=this.components.get(gt);if(!t){const o={};for(const[a,l]of e.list)o[a]=new Set(l.ids);return o}const i=Object.keys(t).length,n={};for(const o in t){const a=t[o];if(!this.list[o]){console.warn(`Classification ${o} does not exist.`);continue}for(const l of a){const h=this.list[o][l];if(h)for(const d in h.map){n[d]||(n[d]=new Map);for(const u of h.map[d]){const f=n[d].get(u);f===void 0?n[d].set(u,1):n[d].set(u,f+1)}}}}const r={};for(const o in n){const a=n[o];for(const[l,h]of a){if(h===void 0)throw new Error("Malformed fragments map!");h===i&&(r[o]||(r[o]=new Set),r[o].add(l))}}return r}byModel(t,e){this.list.models||(this.list.models={});const i=this.list.models;i[t]||(i[t]={map:{},id:null,name:t});const n=i[t];for(const[r,o]of e.data){const a=o[0];for(const l of a){const h=e.keyFragments.get(l);h&&(n.map[h]||(n.map[h]=new Set),n.map[h].add(r))}}}async byPredefinedType(t){var n;this.list.predefinedTypes||(this.list.predefinedTypes={});const e=this.list.predefinedTypes,i=t.getAllPropertiesIDs();for(const r of i){const o=await t.getProperties(r);if(!o)continue;const a=String((n=o.PredefinedType)==null?void 0:n.value).toUpperCase();e[a]||(e[a]={map:{},id:null,name:a});const l=e[a];for(const[h,d]of t.data){const u=d[0];for(const f of u){const E=t.keyFragments.get(f);if(!E)throw new Error("Fragment ID not found!");l.map[E]||(l.map[E]=new Set),l.map[E].add(o.expressID)}}}}byEntity(t){this.list.entities||(this.list.entities={});for(const[e,i]of t.data){const r=i[1][1],o=_n[r];this.saveItem(t,"entities",o,e)}}async byIfcRel(t,e,i){Oe.isRel(e)&&await Oe.getRelationMap(t,e,async(n,r)=>{const{name:o}=await Oe.getEntityName(t,n);for(const a of r)this.saveItem(t,i,o??"NO REL NAME",a)})}async bySpatialStructure(t,e={}){var l,h;const i=this.components.get(Ce),n=i.relationMaps[t.uuid];if(!n)throw new Error(`Classifier: model relations of ${t.name||t.uuid} have to exists to group by spatial structure.`);const r="spatialStructures",a=e.useProperties===void 0||e.useProperties;for(const[d]of n){if(e.isolate){const p=t.data.get(d);if(!p)continue;const I=p[1][1];if(I===void 0||!e.isolate.has(I))continue}const u=i.getEntityRelations(t,d,"Decomposes");if(u)for(const p of u){let I=p.toString();if(a){const m=await t.getProperties(p);if(!m)continue;I=(l=m.Name)==null?void 0:l.value}this.saveItem(t,r,I,d,p)}const f=i.getEntityRelations(t,d,"ContainsElements");if(!f)continue;let E=d.toString();if(a){const p=await t.getProperties(d);if(!p)continue;E=(h=p.Name)==null?void 0:h.value}for(const p of f){this.saveItem(t,r,E,p,d);const I=i.getEntityRelations(t,Number(p),"IsDecomposedBy");if(I)for(const m of I)this.saveItem(t,r,E,m,d)}}}setColor(t,e,i=!1){const n=this.components.get(gt);for(const r in t){const o=n.list.get(r);if(!o)continue;const a=t[r];o.setColor(e,a,i)}}resetColor(t){const e=this.components.get(gt);for(const i in t){const n=e.list.get(i);if(!n)continue;const r=t[i];n.resetColor(r)}}saveItem(t,e,i,n,r=null){this.list[e]||(this.list[e]={});const o=t.data.get(n);if(o)for(const a of o[0]){const l=t.keyFragments.get(a);if(l){const h=this.list[e];h[i]||(h[i]={map:{},id:r,name:i}),h[i].map[l]||(h[i].map[l]=new Set),h[i].map[l].add(n)}}}};_(Ei,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let Xe=Ei;const mi=class mi extends Ft{constructor(t){super(t);_(this,"onDisposed",new Q);_(this,"enabled",!0);_(this,"height",10);_(this,"groupName","spatialStructures");_(this,"list",new Set);t.add(mi.uuid,this)}dispose(){this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}set(t){if(!this.enabled)return;const e=this.components.get(Xe),i=this.components.get(gt),n=t?1:-1;let r=0;const o=e.list[this.groupName],a=new x.Matrix4;for(const l in o){a.elements[13]=r*n*this.height;for(const h in o[l].map){const d=i.list.get(h),u=l+h,f=this.list.has(u);if(!d||t&&f||!t&&!f)continue;t?this.list.add(u):this.list.delete(u);const E=o[l].map[h];d.applyTransform(E,a),d.mesh.computeBoundingSphere(),d.mesh.computeBoundingBox()}r++}}};_(mi,"uuid","d260618b-ce88-4c7d-826c-6debb91de3e2");let un=mi;const Ii=class Ii extends Ft{constructor(t){super(t);_(this,"enabled",!0);this.components.add(Ii.uuid,this)}set(t,e){const i=this.components.get(gt);if(!e){for(const[n,r]of i.list)r&&(r.setVisibility(t),this.updateCulledVisibility(r));return}for(const n in e){const r=e[n],o=i.list.get(n);o&&(o.setVisibility(t,r),this.updateCulledVisibility(o))}}isolate(t){this.set(!1),this.set(!0,t)}updateCulledVisibility(t){const e=this.components.get(ei);for(const[i,n]of e.list){const r=n.colorMeshes.get(t.id);r&&(r.count=t.mesh.count)}}};_(Ii,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");let ci=Ii;class so extends Si{constructor(){super(...arguments);_(this,"minGeometrySize",10);_(this,"minAssetsSize",1e3)}}const gi=class gi extends Ft{constructor(t){super(t);_(this,"onGeometryStreamed",new Q);_(this,"onAssetStreamed",new Q);_(this,"onProgress",new Q);_(this,"onIfcLoaded",new Q);_(this,"onDisposed",new Q);_(this,"settings",new so);_(this,"enabled",!0);_(this,"webIfc",new Z.IfcAPI);_(this,"_spatialTree",new Gr);_(this,"_metaData",new Hr);_(this,"_visitedGeometries",new Map);_(this,"_streamSerializer",new Ie.StreamSerializer);_(this,"_geometries",new Map);_(this,"_geometryCount",0);_(this,"_civil",new Yr);_(this,"_groupSerializer",new Ie.Serializer);_(this,"_assets",[]);_(this,"_meshesWithHoles",new Set);this.components.add(gi.uuid,this),this.settings.excludedCategories.add(Z.IFCOPENINGELEMENT)}dispose(){this.onIfcLoaded.reset(),this.onGeometryStreamed.reset(),this.onAssetStreamed.reset(),this.webIfc=null,this.onDisposed.trigger(),this.onDisposed.reset()}async streamFromBuffer(t){await this.readIfcFile(t),await this.streamAllGeometries(),this.cleanUp()}async streamFromCallBack(t){await this.streamIfcFile(t),await this.streamAllGeometries(),this.cleanUp()}async readIfcFile(t){const{path:e,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:e,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllGeometries(){const{minGeometrySize:t,minAssetsSize:e}=this.settings;this._spatialTree.setUp(this.webIfc);const i=this.webIfc.GetIfcEntityList(0),n=[[]],r=new Ie.FragmentsGroup;r.ifcMetadata={name:"",description:"",...this._metaData.getNameInfo(this.webIfc),...this._metaData.getDescriptionInfo(this.webIfc),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};let o=0,a=0;for(const p of i){if(!this.webIfc.IsIfcElement(p)&&p!==Z.IFCSPACE||this.settings.excludedCategories.has(p))continue;const I=this.webIfc.GetLineIDsWithType(0,p),m=I.size();for(let C=0;C<m;C++){o>t&&(o=0,a++,n.push([]));const R=I.get(C);n[a].push(R);const g=this.webIfc.GetLine(0,R);if(g.GlobalId){const w=(g==null?void 0:g.GlobalId.value)||(g==null?void 0:g.GlobalId);r.globalToExpressIDs.set(w,R)}const y=this._spatialTree.itemsByFloor[R]||0;r.data.set(R,[[],[y,p]]),o++}}this._spatialTree.cleanUp();let l=.01,h=0;for(const p of n){h++,this.webIfc.StreamMeshes(0,p,m=>{this.getMesh(this.webIfc,m,r)}),this._geometryCount>t&&await this.streamGeometries(),this._assets.length>e&&await this.streamAssets();const I=h/n.length;I>l&&(l+=.01,l=Math.max(l,I),this.onProgress.trigger(Math.round(l*100)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:d,transparent:u}=r.geometryIDs;for(const[p,{index:I,uuid:m}]of this._visitedGeometries)r.keyFragments.set(I,m),(p>1?d:u).set(p,I);Wr.get(r,this.webIfc);const f=this.webIfc.GetCoordinationMatrix(0);r.coordinationMatrix.fromArray(f),r.civilData=this._civil.read(this.webIfc);const E=this._groupSerializer.export(r);this.onIfcLoaded.trigger(E),r.dispose(!0)}cleanUp(){try{this.webIfc.Dispose()}catch{}this.webIfc=null,this.webIfc=new Z.IfcAPI,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(t,e,i){const n=e.geometries.size(),r=e.expressID,o={id:r,geometries:[]};for(let a=0;a<n;a++){const l=e.geometries.get(a),h=l.geometryExpressID,d=l.color.w===1?1:-1,u=h*d;if(!this._visitedGeometries.has(u)){this._visitedGeometries.has(h)||this.getGeometry(t,h);const y=this._visitedGeometries.size,w=x.MathUtils.generateUUID();this._visitedGeometries.set(u,{uuid:w,index:y})}const f=this._visitedGeometries.get(u);if(f===void 0)throw new Error("Error getting geometry data for streaming!");const E=i.data.get(r);if(!E)throw new Error("Data not found!");E[0].push(f.index);const{x:p,y:I,z:m,w:C}=l.color,R=[p,I,m,C],g=l.flatTransformation;o.geometries.push({color:R,geometryID:h,transformation:g})}this._assets.push(o)}getGeometry(t,e){const i=t.GetGeometry(0,e),n=t.GetIndexArray(i.GetIndexData(),i.GetIndexDataSize()),r=t.GetVertexArray(i.GetVertexData(),i.GetVertexDataSize()),o=new Float32Array(r.length/2),a=new Float32Array(r.length/2);for(let f=0;f<r.length;f+=6)o[f/2]=r[f],o[f/2+1]=r[f+1],o[f/2+2]=r[f+2],a[f/2]=r[f+3],a[f/2+1]=r[f+4],a[f/2+2]=r[f+5];const l=Fr(o),h=new Float32Array(l.transformation.elements),d=[l.center.x,l.center.y,l.center.z];let u=!1;for(let f=0;f<o.length-2;f+=3){const E=o[f],p=o[f+1],I=o[f+2],m=a[f],C=a[f+1],R=a[f+2];if(wr(d,[E,p,I],[m,C,R])){u=!0;break}}this._geometries.set(e,{position:o,normal:a,index:n,boundingBox:h,hasHoles:u}),i.delete(),this._geometryCount++}async streamAssets(){await this.onAssetStreamed.trigger(this._assets),this._assets=null,this._assets=[]}async streamGeometries(){let t=this._streamSerializer.export(this._geometries),e={};for(const[i,{boundingBox:n,hasHoles:r}]of this._geometries)e[i]={boundingBox:n,hasHoles:r};this.onGeometryStreamed.trigger({data:e,buffer:t}),e=null,t=null,this._geometries.clear(),this._geometryCount=0}};_(gi,"uuid","d9999a00-e1f5-4d3f-8cfe-c56e08609764");let fn=gi;class io extends Si{constructor(){super(...arguments);_(this,"propertiesSize",100)}}class no extends Ft{constructor(){super(...arguments);_(this,"onPropertiesStreamed",new Es);_(this,"onProgress",new Es);_(this,"onIndicesStreamed",new Es);_(this,"onDisposed",new Q);_(this,"enabled",!0);_(this,"settings",new io);_(this,"webIfc",new Z.IfcAPI)}async dispose(){this.onIndicesStreamed.reset(),this.onPropertiesStreamed.reset(),this.webIfc=null,this.onDisposed.reset()}async streamFromBuffer(t){await this.readIfcFile(t),await this.streamAllProperties(),this.cleanUp()}async streamFromCallBack(t){await this.streamIfcFile(t),await this.streamAllProperties(),this.cleanUp()}async readIfcFile(t){const{path:e,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:e,absolute:i,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(e,i),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:t}=this.settings,e=new Set(this.webIfc.GetIfcEntityList(0)),i=new Set([Z.IFCPROJECT,Z.IFCSITE,Z.IFCBUILDING,Z.IFCBUILDINGSTOREY,Z.IFCSPACE]);for(const l of i)e.add(l);let n=.01,r=0;for(const l of e){if(r++,An.has(l))continue;const h=i.has(l),d=this.webIfc.GetLineIDsWithType(0,l),u=d.size();let f=0;for(let p=0;p<u-t;p+=t){const I={};for(let m=0;m<t;m++){f++;const C=d.get(p+m);try{const R=this.webIfc.GetLine(0,C,h);I[R.expressID]=R}catch{console.log(`Could not get property: ${C}`)}}await this.onPropertiesStreamed.trigger({type:l,data:I})}if(f!==u){const p={};for(let I=f;I<u;I++){const m=d.get(I);try{const C=this.webIfc.GetLine(0,m,h);p[C.expressID]=C}catch{console.log(`Could not get property: ${m}`)}}await this.onPropertiesStreamed.trigger({type:l,data:p})}r/e.size>n&&(n=Math.round(n*100)/100,await this.onProgress.trigger(n),n+=.01)}await this.onProgress.trigger(1);const a=await this.components.get(Ce).processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(a)}cleanUp(){this.webIfc.Dispose(),this.webIfc=null,this.webIfc=new Z.IfcAPI}}_(no,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");class wn{constructor(s,t,e){_(this,"title");_(this,"guid",oe.create());_(this,"clippingPlanes",new Se);_(this,"camera",{aspectRatio:0,fov:0,direction:{x:0,y:0,z:80},position:{x:0,y:0,z:0}});_(this,"exceptionComponents",new Se);_(this,"selectionComponents",new Se);_(this,"componentColors",new re);_(this,"spacesVisible",!1);_(this,"spaceBoundariesVisible",!1);_(this,"openingsVisible",!1);_(this,"defaultVisibility",!0);_(this,"_components");_(this,"world");const i={setCamera:!0,...e},{data:n,setCamera:r}=i;this._components=s,this.world=t,n&&(this.guid=n.guid??this.guid,this.set(n)),r&&this.updateCamera()}get _selectionModelIdMap(){const s=this._components.get(gt),t={};for(const[e,i]of s.groups){e in t||(t[e]=new Set);for(const n of this.selectionComponents){const r=i.globalToExpressIDs.get(n);r&&t[e].add(r)}}return t}get _exceptionModelIdMap(){const s=this._components.get(gt),t={};for(const[e,i]of s.groups){e in t||(t[e]=new Set);for(const n of this.exceptionComponents){const r=i.globalToExpressIDs.get(n);r&&t[e].add(r)}}return t}get selection(){return this._components.get(gt).modelIdToFragmentIdMap(this._selectionModelIdMap)}get exception(){return this._components.get(gt).modelIdToFragmentIdMap(this._exceptionModelIdMap)}get projection(){return"fov"in this.camera?"Perspective":"Orthographic"}get position(){const s=this._components.get(gt),{position:t}=this.camera,{x:e,y:i,z:n}=t,r=new x.Vector3(e,i,n);return s.applyBaseCoordinateSystem(r,new x.Matrix4),r}get direction(){const{direction:s}=this.camera,{x:t,y:e,z:i}=s;return new x.Vector3(t,e,i)}get _managerVersion(){return this._components.get(Pt).config.version}get topics(){return[...this._components.get(Pt).list.values()].filter(i=>i.viewpoints.has(this.guid))}addComponentsFromMap(s){const e=this._components.get(gt).fragmentIdMapToGuids(s);this.selectionComponents.add(...e),this._components.get(Zt).list.set(this.guid,this)}set(s){const t=s,e=this;for(const n in s){if(n==="guid")continue;const r=t[n];if(n==="selectionComponents"){this.selectionComponents.clear(),this.selectionComponents.add(...r);continue}if(n==="exceptionComponents"){this.exceptionComponents.clear(),this.exceptionComponents.add(...r);continue}n in this&&(e[n]=r)}return this._components.get(Zt).list.set(this.guid,this),this}async go(s=!0){const{camera:t}=this.world;if(!t.hasCameraControls())throw new Error("Viewpoint: the world's camera need controls to set the viewpoint.");t instanceof Vr&&t.projection.set(this.projection);const e=this.position,i=this.direction;let n={x:e.x+i.x*80,y:e.y+i.y*80,z:e.z+i.z*80};const r=this.selection;if(Object.keys(r).length===0){const h=this._components.get(Ne).get(this.world).castRayFromVector(e,this.direction);h&&(n=h.point)}else{const a=this._components.get(ai);a.reset(),a.addFragmentIdMap(r),n=a.getSphere().center,a.reset()}const o=this._components.get(ci);o.set(this.defaultVisibility),o.set(!this.defaultVisibility,this.exception),o.set(!0,r),await t.controls.setLookAt(e.x,e.y,e.z,n.x,n.y,n.z,s)}updateCamera(){const{camera:s,renderer:t}=this.world;if(!t)throw new Error("Viewpoint: the world needs to have a renderer!");if(!s.hasCameraControls())throw new Error("Viewpoint: world's camera need camera controls!");const e=new x.Vector3;s.controls.getPosition(e);const i=s.three,n=new x.Vector3(0,0,-1).applyEuler(i.rotation),{width:r,height:o}=t.getSize();let a=r/o;Number.isNaN(a)&&(a=1);const l=this._components.get(gt);e.applyMatrix4(l.baseCoordinationMatrix.clone().invert());const h={aspectRatio:a,position:{x:e.x,y:e.y,z:e.z},direction:{x:n.x,y:n.y,z:n.z}};i instanceof x.PerspectiveCamera?this.camera={...h,fov:i.fov}:i instanceof x.OrthographicCamera&&(this.camera={...h,viewToWorldScale:i.top-i.bottom}),this._components.get(Zt).list.set(this.guid,this)}colorize(){const s=this._components.get(Zt),t=this._components.get(gt),e=this._components.get(Xe);for(const[i,n]of this.componentColors){const r=t.guidToFragmentIdMap(n),o=new x.Color(`#${i}`);e.setColor(r,o,s.config.overwriteColors)}}resetColors(){const s=this._components.get(gt),t=this._components.get(Xe);for(const[e,i]of this.componentColors){const n=s.guidToFragmentIdMap(i);t.resetColor(n)}}async createComponentTags(s){var n,r;const t=this._components.get(gt),e=this._components.get(Pt);let i="";if(e.config.includeSelectionTag){const o=s==="selection"?this._selectionModelIdMap:this._exceptionModelIdMap;for(const a in o){const l=t.groups.get(a);if(!l)continue;const h=o[a];for(const d of h){const u=await l.getProperties(d);if(!u)continue;const f=(n=u.GlobalId)==null?void 0:n.value;if(!f)continue;const E=(r=u.Tag)==null?void 0:r.value;let p=null;E&&(p=`AuthoringToolId="${E}"`),i+=`
227
227
  <Component IfcGuid="${f}" ${p??""} />`}}}else i=[...this.selectionComponents].map(o=>`<Component IfcGuid="${o}" />`).join(`
228
228
  `);return i}async serialize(s=this._managerVersion){const t=this._components.get(gt),e=this.position;e.applyMatrix4(t.baseCoordinationMatrix.clone().invert());const i=this.direction;i.normalize();const n=new x.Matrix4().makeRotationX(Math.PI/2),r=i.clone().applyMatrix4(n);r.normalize();const o=`<CameraViewPoint>
229
229
  <X>${e.x}</X>
@@ -260,4 +260,4 @@ ${o}
260
260
  </Visibility>
261
261
  </Components>
262
262
  ${d}
263
- </VisualizationInfo>`}}const Ci=class Ci extends Ft{constructor(t){super(t);T(this,"enabled",!0);T(this,"list",new he);T(this,"isSetup",!1);T(this,"onSetup",new Q);T(this,"config",{overwriteColors:!1});T(this,"onDisposed",new Q);t.add(Ci.uuid,this)}create(t,e){const i=new wn(this.components,t,{data:e});return e||this.list.set(i.guid,i),i}setup(){}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}};T(Ci,"uuid","ee867824-a796-408d-8aa0-4e5962a83c66");let Zt=Ci;class ro{constructor(s){T(this,"onDisposed",new Q);T(this,"onAfterUpdate",new Q);T(this,"onBeforeUpdate",new Q);T(this,"onResize",new Q);T(this,"frontOffset",0);T(this,"overrideMaterial",new x.MeshDepthMaterial);T(this,"backgroundColor",new x.Color(395274));T(this,"renderer");T(this,"enabled",!0);T(this,"world");T(this,"_lockRotation",!0);T(this,"_camera");T(this,"_plane");T(this,"_size",new x.Vector2(320,160));T(this,"_tempVector1",new x.Vector3);T(this,"_tempVector2",new x.Vector3);T(this,"_tempTarget",new x.Vector3);T(this,"down",new x.Vector3(0,-1,0));T(this,"updatePlanes",()=>{if(!this.world.renderer)throw new Error("The given world must have a renderer!");const s=[],t=this.world.renderer.three;for(const e of t.clippingPlanes)s.push(e);s.push(this._plane),this.renderer.clippingPlanes=s});if(this.world=s,!this.world.renderer)throw new Error("The given world must have a renderer!");this.renderer=new x.WebGLRenderer,this.renderer.setSize(this._size.x,this._size.y);const t=1,e=this._size.x/this._size.y;this._camera=new x.OrthographicCamera(t*e/-2,t*e/2,t/2,t/-2),this.world.renderer.onClippingPlanesUpdated.add(this.updatePlanes),this._camera.position.set(0,200,0),this._camera.zoom=.1,this._camera.rotation.x=-Math.PI/2,this._plane=new x.Plane(this.down,200),this.updatePlanes()}get lockRotation(){return this._lockRotation}set lockRotation(s){this._lockRotation=s,s&&(this._camera.rotation.z=0)}get zoom(){return this._camera.zoom}set zoom(s){this._camera.zoom=s,this._camera.updateProjectionMatrix()}dispose(){this.enabled=!1,this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.onResize.reset(),this.overrideMaterial.dispose(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(){return this._camera}update(){if(!this.enabled)return;this.onBeforeUpdate.trigger();const s=this.world.scene.three,t=this.world.camera;if(!t.hasCameraControls())throw new Error("The given world must use camera controls!");if(!(s instanceof x.Scene))throw new Error("The given world must have a THREE.Scene as a root!");const e=t.controls;if(e.getPosition(this._tempVector1),this._camera.position.x=this._tempVector1.x,this._camera.position.z=this._tempVector1.z,this.frontOffset!==0&&(e.getTarget(this._tempVector2),this._tempVector2.sub(this._tempVector1),this._tempVector2.normalize().multiplyScalar(this.frontOffset),this._camera.position.x+=this._tempVector2.x,this._camera.position.z+=this._tempVector2.z),!this._lockRotation){e.getTarget(this._tempTarget);const n=Math.atan2(this._tempTarget.x-this._tempVector1.x,this._tempTarget.z-this._tempVector1.z);this._camera.rotation.z=n+Math.PI}this._plane.set(this.down,this._tempVector1.y);const i=s.background;s.background=this.backgroundColor,this.renderer.render(s,this._camera),s.background=i,this.onAfterUpdate.trigger()}getSize(){return this._size}resize(s=this._size){this._size.copy(s),this.renderer.setSize(s.x,s.y);const t=s.x/s.y,e=1;this._camera.left=e*t/-2,this._camera.right=e*t/2,this._camera.top=e/2,this._camera.bottom=-e/2,this._camera.updateProjectionMatrix(),this.onResize.trigger(s)}}const Ti=class Ti extends Ft{constructor(t){super(t);T(this,"onAfterUpdate",new Q);T(this,"onBeforeUpdate",new Q);T(this,"onDisposed",new Q);T(this,"enabled",!0);T(this,"list",new Map);this.components.add(Ti.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a minimap!");const e=new ro(t);return this.list.set(t.uuid,e),e}delete(t){const e=this.list.get(t);e&&e.dispose(),this.list.delete(t)}dispose(){for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger()}update(){for(const[t,e]of this.list)e.update()}};T(Ti,"uuid","39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");let pn=Ti;const _i=class _i extends Ft{constructor(t){super(t);T(this,"enabled",!0);t.add(_i.uuid,this)}static distanceFromPointToLine(t,e,i,n=!1){const r=new x.Line3,o=new x.Vector3;return r.set(e,i),r.closestPointToPoint(t,n,o),o.distanceTo(t)}getFace(t,e,i){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const n=new Map,r=t.geometry.index.array,{plane:o}=this.getFaceData(e,i,t),a=[];for(let u=0;u<r.length/3;u++){const{plane:f,edges:E}=this.getFaceData(u,i,t);if(f.equals(o)){a.push({index:u,edges:E});for(const{id:p,points:I,distance:m}of E)n.set(p,{points:I,distance:m})}}let l=0;const h=new Map,d=new Map;for(const{index:u,edges:f}of a){const E=new Map;for(const{id:y}of f)if(h.has(y)){const w=h.get(y);E.set(y,w)}const p=f.map(y=>y.id);if(!E.size){const y=l++;for(const{id:w}of f)h.set(w,y);d.set(y,{edges:new Set(p),indices:new Set([u])});continue}let I=null;const m=new Set,C=new Set(p);for(const[y,w]of E){I===null?I=w:w!==I&&m.add(w),h.delete(y);const{edges:O}=d.get(w);O.delete(y),C.delete(y)}if(I===null)throw new Error("Error computing face!");const R=d.get(I),{indices:g}=R;g.add(u);for(const y of C){h.set(y,I);const{edges:w}=R;w.add(y)}for(const y of m){const w=d.get(y),{edges:O,indices:M}=w,b=d.get(I),{edges:v,indices:k}=b;for(const F of O)v.add(F),h.set(F,I);for(const F of M)k.add(F);d.delete(y)}}for(const[u,{indices:f,edges:E}]of d)if(f.has(e)){const p=[];for(const I of E){const m=n.get(I);p.push(m)}return{edges:p,indices:f}}return null}getVerticesAndNormal(t,e,i){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const n=t.geometry.index.array,r=t.geometry.attributes.position.array,o=t.geometry.attributes.normal.array,a=n[e*3]*3,l=n[e*3+1]*3,h=n[e*3+2]*3,d=new x.Vector3(r[a],r[a+1],r[a+2]),u=new x.Vector3(r[l],r[l+1],r[l+2]),f=new x.Vector3(r[h],r[h+1],r[h+2]),E=new x.Vector3(o[a],o[a+1],o[a+2]),p=new x.Vector3(o[l],o[l+1],o[l+2]),I=new x.Vector3(o[h],o[h+1],o[h+2]),m=(E.x+p.x+I.x)/3,C=(E.y+p.y+I.y)/3,R=(E.z+p.z+I.z)/3,g=new x.Vector3(m,C,R);if(i!==void 0&&t instanceof x.InstancedMesh){const y=new x.Matrix4;t.getMatrixAt(i,y);const w=new x.Matrix4;w.extractRotation(y),g.applyMatrix4(w),d.applyMatrix4(y),u.applyMatrix4(y),f.applyMatrix4(y)}return{p1:d,p2:u,p3:f,faceNormal:g}}round(t){t.x=Math.trunc(t.x*1e3)/1e3,t.y=Math.trunc(t.y*1e3)/1e3,t.z=Math.trunc(t.z*1e3)/1e3}getVolumeFromFragments(t){const e=this.components.get(gt),i=new x.Matrix4,n=[];for(const o in t){const a=e.list.get(o);if(!a)continue;const l=t[o];let h=0;for(const f of l){const E=a.getInstancesIDs(f);E&&(h+=E.size)}const d=new x.InstancedMesh(a.mesh.geometry,void 0,h);let u=0;for(const f of l){const E=a.getInstancesIDs(f);if(E)for(const p of E)a.mesh.getMatrixAt(p,i),d.setMatrixAt(u++,i)}n.push(d)}const r=this.getVolumeFromMeshes(n);for(const o of n)o.geometry=null,o.material=[],o.dispose();return r}getVolumeFromMeshes(t){let e=0;for(const i of t)e+=this.getVolumeOfMesh(i);return e}getFaceData(t,e,i){const n=this.getVerticesAndNormal(i,t,e),{p1:r,p2:o,p3:a,faceNormal:l}=n;this.round(r),this.round(o),this.round(a),this.round(l);const h=[{id:`${r.x}|${r.y}|${r.z}`,value:r},{id:`${o.x}|${o.y}|${o.z}`,value:o},{id:`${a.x}|${a.y}|${a.z}`,value:a}];h.sort((R,g)=>R.id<g.id?-1:R.id>g.id?1:0);const[{id:d,value:u},{id:f,value:E},{id:p,value:I}]=h,m=[{id:`${d}|${f}`,distance:u.distanceTo(E),points:[u,E]},{id:`${f}|${p}`,distance:E.distanceTo(I),points:[E,I]},{id:`${d}|${p}`,distance:u.distanceTo(I),points:[u,I]}],C=new x.Plane;return C.setFromNormalAndCoplanarPoint(l,r),C.constant=Math.round(C.constant*10)/10,{plane:C,edges:m}}getVolumeOfMesh(t){let e=0;const i=new x.Vector3,n=new x.Vector3,r=new x.Vector3,{index:o}=t.geometry,a=t.geometry.attributes.position.array;if(!o)return console.warn("Geometry must be indexed to compute its volume!"),0;const l=[];if(t instanceof x.InstancedMesh)for(let d=0;d<t.count;d++){const u=new x.Matrix4;t.getMatrixAt(d,u),l.push(u)}else l.push(new x.Matrix4().identity());const{matrixWorld:h}=t;for(let d=0;d<o.array.length-2;d+=3)for(const u of l){const f=u.multiply(h),E=o.array[d]*3,p=o.array[d+1]*3,I=o.array[d+2]*3;i.set(a[E],a[E+1],a[E+2]).applyMatrix4(f),n.set(a[p],a[p+1],a[p+2]).applyMatrix4(f),r.set(a[I],a[I+1],a[I+2]).applyMatrix4(f),e+=this.getSignedVolumeOfTriangle(i,n,r)}return Math.abs(e)}getSignedVolumeOfTriangle(t,e,i){const n=i.x*e.y*t.z,r=e.x*i.y*t.z,o=i.x*t.y*e.z,a=t.x*i.y*e.z,l=e.x*t.y*i.z,h=t.x*e.y*i.z;return 1/6*(-n+r+o-a-l+h)}};T(_i,"uuid","267ca032-672f-4cb0-afa9-d24e904f39d6");let En=_i;exports.AsyncEvent=Es;exports.BCFTopics=Pt;exports.Base=yi;exports.BaseCamera=Ar;exports.BaseRenderer=Rr;exports.BaseScene=yr;exports.BaseWorldItem=Fi;exports.BoundingBoxer=ai;exports.Classifier=Xe;exports.Clipper=si;exports.Comment=oi;exports.Component=Ft;exports.Components=Js;exports.CullerRenderer=Pr;exports.Cullers=ei;exports.DataMap=he;exports.DataSet=Se;exports.Disposer=le;exports.Event=Q;exports.Exploder=un;exports.FirstPersonMode=Dr;exports.FragmentsManager=gt;exports.GeometryTypes=An;exports.Grids=cn;exports.Hider=ci;exports.IfcCategories=Ha;exports.IfcCategoryMap=_n;exports.IfcElements=kr;exports.IfcFragmentSettings=Si;exports.IfcGeometryTiler=fn;exports.IfcJsonExporter=ii;exports.IfcLoader=ni;exports.IfcPropertiesManager=ri;exports.IfcPropertiesTiler=no;exports.IfcPropertiesUtils=Oe;exports.IfcRelationsIndexer=Ce;exports.IfcStreamingSettings=so;exports.MaterialsUtils=an;exports.MeasurementUtils=En;exports.MeshCullerRenderer=Lr;exports.MiniMap=ro;exports.MiniMaps=pn;exports.Mouse=Mr;exports.OrbitMode=Ur;exports.OrthoPerspectiveCamera=Vr;exports.PlanMode=Br;exports.ProjectionManager=zr;exports.PropertiesStreamingSettings=io;exports.Raycasters=Ne;exports.ShadowedScene=va;exports.SimpleCamera=We;exports.SimpleGrid=vr;exports.SimplePlane=wi;exports.SimpleRaycaster=xr;exports.SimpleRenderer=Sa;exports.SimpleScene=Or;exports.SimpleWorld=Sr;exports.Topic=_s;exports.UUID=re;exports.VertexPicker=wa;exports.Viewpoint=wn;exports.Viewpoints=Zt;exports.Worlds=ti;exports.extensionsImporter=eo;exports.ifcRelAttrsPosition=Xr;exports.ifcRelClassNames=Zr;exports.isPointInFrontOfPlane=wr;exports.obbFromPoints=Fr;exports.readPixelsAsync=Tn;exports.relToAttributesMap=ln;
263
+ </VisualizationInfo>`}}const Ci=class Ci extends Ft{constructor(t){super(t);_(this,"enabled",!0);_(this,"list",new re);_(this,"isSetup",!1);_(this,"onSetup",new Q);_(this,"config",{overwriteColors:!1});_(this,"onDisposed",new Q);t.add(Ci.uuid,this)}create(t,e){const i=new wn(this.components,t,{data:e});return e||this.list.set(i.guid,i),i}setup(){}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}};_(Ci,"uuid","ee867824-a796-408d-8aa0-4e5962a83c66");let Zt=Ci;class ro{constructor(s){_(this,"onDisposed",new Q);_(this,"onAfterUpdate",new Q);_(this,"onBeforeUpdate",new Q);_(this,"onResize",new Q);_(this,"frontOffset",0);_(this,"overrideMaterial",new x.MeshDepthMaterial);_(this,"backgroundColor",new x.Color(395274));_(this,"renderer");_(this,"enabled",!0);_(this,"world");_(this,"_lockRotation",!0);_(this,"_camera");_(this,"_plane");_(this,"_size",new x.Vector2(320,160));_(this,"_tempVector1",new x.Vector3);_(this,"_tempVector2",new x.Vector3);_(this,"_tempTarget",new x.Vector3);_(this,"down",new x.Vector3(0,-1,0));_(this,"updatePlanes",()=>{if(!this.world.renderer)throw new Error("The given world must have a renderer!");const s=[],t=this.world.renderer.three;for(const e of t.clippingPlanes)s.push(e);s.push(this._plane),this.renderer.clippingPlanes=s});if(this.world=s,!this.world.renderer)throw new Error("The given world must have a renderer!");this.renderer=new x.WebGLRenderer,this.renderer.setSize(this._size.x,this._size.y);const t=1,e=this._size.x/this._size.y;this._camera=new x.OrthographicCamera(t*e/-2,t*e/2,t/2,t/-2),this.world.renderer.onClippingPlanesUpdated.add(this.updatePlanes),this._camera.position.set(0,200,0),this._camera.zoom=.1,this._camera.rotation.x=-Math.PI/2,this._plane=new x.Plane(this.down,200),this.updatePlanes()}get lockRotation(){return this._lockRotation}set lockRotation(s){this._lockRotation=s,s&&(this._camera.rotation.z=0)}get zoom(){return this._camera.zoom}set zoom(s){this._camera.zoom=s,this._camera.updateProjectionMatrix()}dispose(){this.enabled=!1,this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.onResize.reset(),this.overrideMaterial.dispose(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get(){return this._camera}update(){if(!this.enabled)return;this.onBeforeUpdate.trigger();const s=this.world.scene.three,t=this.world.camera;if(!t.hasCameraControls())throw new Error("The given world must use camera controls!");if(!(s instanceof x.Scene))throw new Error("The given world must have a THREE.Scene as a root!");const e=t.controls;if(e.getPosition(this._tempVector1),this._camera.position.x=this._tempVector1.x,this._camera.position.z=this._tempVector1.z,this.frontOffset!==0&&(e.getTarget(this._tempVector2),this._tempVector2.sub(this._tempVector1),this._tempVector2.normalize().multiplyScalar(this.frontOffset),this._camera.position.x+=this._tempVector2.x,this._camera.position.z+=this._tempVector2.z),!this._lockRotation){e.getTarget(this._tempTarget);const n=Math.atan2(this._tempTarget.x-this._tempVector1.x,this._tempTarget.z-this._tempVector1.z);this._camera.rotation.z=n+Math.PI}this._plane.set(this.down,this._tempVector1.y);const i=s.background;s.background=this.backgroundColor,this.renderer.render(s,this._camera),s.background=i,this.onAfterUpdate.trigger()}getSize(){return this._size}resize(s=this._size){this._size.copy(s),this.renderer.setSize(s.x,s.y);const t=s.x/s.y,e=1;this._camera.left=e*t/-2,this._camera.right=e*t/2,this._camera.top=e/2,this._camera.bottom=-e/2,this._camera.updateProjectionMatrix(),this.onResize.trigger(s)}}const Ti=class Ti extends Ft{constructor(t){super(t);_(this,"onAfterUpdate",new Q);_(this,"onBeforeUpdate",new Q);_(this,"onDisposed",new Q);_(this,"enabled",!0);_(this,"list",new Map);this.components.add(Ti.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a minimap!");const e=new ro(t);return this.list.set(t.uuid,e),e}delete(t){const e=this.list.get(t);e&&e.dispose(),this.list.delete(t)}dispose(){for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger()}update(){for(const[t,e]of this.list)e.update()}};_(Ti,"uuid","39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");let pn=Ti;const _i=class _i extends Ft{constructor(t){super(t);_(this,"enabled",!0);t.add(_i.uuid,this)}static distanceFromPointToLine(t,e,i,n=!1){const r=new x.Line3,o=new x.Vector3;return r.set(e,i),r.closestPointToPoint(t,n,o),o.distanceTo(t)}getFace(t,e,i){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const n=new Map,r=t.geometry.index.array,{plane:o}=this.getFaceData(e,i,t),a=[];for(let u=0;u<r.length/3;u++){const{plane:f,edges:E}=this.getFaceData(u,i,t);if(f.equals(o)){a.push({index:u,edges:E});for(const{id:p,points:I,distance:m}of E)n.set(p,{points:I,distance:m})}}let l=0;const h=new Map,d=new Map;for(const{index:u,edges:f}of a){const E=new Map;for(const{id:y}of f)if(h.has(y)){const w=h.get(y);E.set(y,w)}const p=f.map(y=>y.id);if(!E.size){const y=l++;for(const{id:w}of f)h.set(w,y);d.set(y,{edges:new Set(p),indices:new Set([u])});continue}let I=null;const m=new Set,C=new Set(p);for(const[y,w]of E){I===null?I=w:w!==I&&m.add(w),h.delete(y);const{edges:O}=d.get(w);O.delete(y),C.delete(y)}if(I===null)throw new Error("Error computing face!");const R=d.get(I),{indices:g}=R;g.add(u);for(const y of C){h.set(y,I);const{edges:w}=R;w.add(y)}for(const y of m){const w=d.get(y),{edges:O,indices:M}=w,b=d.get(I),{edges:v,indices:k}=b;for(const F of O)v.add(F),h.set(F,I);for(const F of M)k.add(F);d.delete(y)}}for(const[u,{indices:f,edges:E}]of d)if(f.has(e)){const p=[];for(const I of E){const m=n.get(I);p.push(m)}return{edges:p,indices:f}}return null}getVerticesAndNormal(t,e,i){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const n=t.geometry.index.array,r=t.geometry.attributes.position.array,o=t.geometry.attributes.normal.array,a=n[e*3]*3,l=n[e*3+1]*3,h=n[e*3+2]*3,d=new x.Vector3(r[a],r[a+1],r[a+2]),u=new x.Vector3(r[l],r[l+1],r[l+2]),f=new x.Vector3(r[h],r[h+1],r[h+2]),E=new x.Vector3(o[a],o[a+1],o[a+2]),p=new x.Vector3(o[l],o[l+1],o[l+2]),I=new x.Vector3(o[h],o[h+1],o[h+2]),m=(E.x+p.x+I.x)/3,C=(E.y+p.y+I.y)/3,R=(E.z+p.z+I.z)/3,g=new x.Vector3(m,C,R);if(i!==void 0&&t instanceof x.InstancedMesh){const y=new x.Matrix4;t.getMatrixAt(i,y);const w=new x.Matrix4;w.extractRotation(y),g.applyMatrix4(w),d.applyMatrix4(y),u.applyMatrix4(y),f.applyMatrix4(y)}return{p1:d,p2:u,p3:f,faceNormal:g}}round(t){t.x=Math.trunc(t.x*1e3)/1e3,t.y=Math.trunc(t.y*1e3)/1e3,t.z=Math.trunc(t.z*1e3)/1e3}getVolumeFromFragments(t){const e=this.components.get(gt),i=new x.Matrix4,n=[];for(const o in t){const a=e.list.get(o);if(!a)continue;const l=t[o];let h=0;for(const f of l){const E=a.getInstancesIDs(f);E&&(h+=E.size)}const d=new x.InstancedMesh(a.mesh.geometry,void 0,h);let u=0;for(const f of l){const E=a.getInstancesIDs(f);if(E)for(const p of E)a.mesh.getMatrixAt(p,i),d.setMatrixAt(u++,i)}n.push(d)}const r=this.getVolumeFromMeshes(n);for(const o of n)o.geometry=null,o.material=[],o.dispose();return r}getVolumeFromMeshes(t){let e=0;for(const i of t)e+=this.getVolumeOfMesh(i);return e}getFaceData(t,e,i){const n=this.getVerticesAndNormal(i,t,e),{p1:r,p2:o,p3:a,faceNormal:l}=n;this.round(r),this.round(o),this.round(a),this.round(l);const h=[{id:`${r.x}|${r.y}|${r.z}`,value:r},{id:`${o.x}|${o.y}|${o.z}`,value:o},{id:`${a.x}|${a.y}|${a.z}`,value:a}];h.sort((R,g)=>R.id<g.id?-1:R.id>g.id?1:0);const[{id:d,value:u},{id:f,value:E},{id:p,value:I}]=h,m=[{id:`${d}|${f}`,distance:u.distanceTo(E),points:[u,E]},{id:`${f}|${p}`,distance:E.distanceTo(I),points:[E,I]},{id:`${d}|${p}`,distance:u.distanceTo(I),points:[u,I]}],C=new x.Plane;return C.setFromNormalAndCoplanarPoint(l,r),C.constant=Math.round(C.constant*10)/10,{plane:C,edges:m}}getVolumeOfMesh(t){let e=0;const i=new x.Vector3,n=new x.Vector3,r=new x.Vector3,{index:o}=t.geometry,a=t.geometry.attributes.position.array;if(!o)return console.warn("Geometry must be indexed to compute its volume!"),0;const l=[];if(t instanceof x.InstancedMesh)for(let d=0;d<t.count;d++){const u=new x.Matrix4;t.getMatrixAt(d,u),l.push(u)}else l.push(new x.Matrix4().identity());const{matrixWorld:h}=t;for(let d=0;d<o.array.length-2;d+=3)for(const u of l){const f=u.multiply(h),E=o.array[d]*3,p=o.array[d+1]*3,I=o.array[d+2]*3;i.set(a[E],a[E+1],a[E+2]).applyMatrix4(f),n.set(a[p],a[p+1],a[p+2]).applyMatrix4(f),r.set(a[I],a[I+1],a[I+2]).applyMatrix4(f),e+=this.getSignedVolumeOfTriangle(i,n,r)}return Math.abs(e)}getSignedVolumeOfTriangle(t,e,i){const n=i.x*e.y*t.z,r=e.x*i.y*t.z,o=i.x*t.y*e.z,a=t.x*i.y*e.z,l=e.x*t.y*i.z,h=t.x*e.y*i.z;return 1/6*(-n+r+o-a-l+h)}};_(_i,"uuid","267ca032-672f-4cb0-afa9-d24e904f39d6");let En=_i;exports.AsyncEvent=Es;exports.BCFTopics=Pt;exports.Base=yi;exports.BaseCamera=Ar;exports.BaseRenderer=Rr;exports.BaseScene=yr;exports.BaseWorldItem=Fi;exports.BoundingBoxer=ai;exports.Classifier=Xe;exports.Clipper=si;exports.Comment=oi;exports.Component=Ft;exports.Components=ti;exports.CullerRenderer=Pr;exports.Cullers=ei;exports.DataMap=re;exports.DataSet=Se;exports.Disposer=he;exports.Event=Q;exports.Exploder=un;exports.FirstPersonMode=Dr;exports.FragmentsManager=gt;exports.GeometryTypes=An;exports.Grids=cn;exports.Hider=ci;exports.IfcCategories=Ha;exports.IfcCategoryMap=_n;exports.IfcElements=kr;exports.IfcFragmentSettings=Si;exports.IfcGeometryTiler=fn;exports.IfcJsonExporter=ii;exports.IfcLoader=ni;exports.IfcPropertiesManager=ri;exports.IfcPropertiesTiler=no;exports.IfcPropertiesUtils=Oe;exports.IfcRelationsIndexer=Ce;exports.IfcStreamingSettings=so;exports.MaterialsUtils=an;exports.MeasurementUtils=En;exports.MeshCullerRenderer=Lr;exports.MiniMap=ro;exports.MiniMaps=pn;exports.Mouse=Mr;exports.OrbitMode=Ur;exports.OrthoPerspectiveCamera=Vr;exports.PlanMode=Br;exports.ProjectionManager=zr;exports.PropertiesStreamingSettings=io;exports.Raycasters=Ne;exports.ShadowedScene=va;exports.SimpleCamera=We;exports.SimpleGrid=vr;exports.SimplePlane=wi;exports.SimpleRaycaster=xr;exports.SimpleRenderer=Sa;exports.SimpleScene=Or;exports.SimpleWorld=Sr;exports.Topic=As;exports.UUID=oe;exports.VertexPicker=wa;exports.Viewpoint=wn;exports.Viewpoints=Zt;exports.Worlds=_s;exports.extensionsImporter=eo;exports.ifcRelAttrsPosition=Xr;exports.ifcRelClassNames=Zr;exports.isPointInFrontOfPlane=wr;exports.obbFromPoints=Fr;exports.readPixelsAsync=Tn;exports.relToAttributesMap=ln;