@thatopen/components 2.2.0-alpha.0 → 2.2.0-alpha.1

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 Vd=Object.defineProperty;var $d=(n,e,t)=>e in n?Vd(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var y=(n,e,t)=>($d(n,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("three"),Ic=require("@thatopen/fragments"),Hd=require("web-ifc");function ca(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const M=ca(S),$e=ca(Ic),tt=ca(Hd),bc=0,Gd=1,Yd=2,Ua=2,Kr=1.25,ka=1,zn=6*4+4+4,Fr=65535,Wd=Math.pow(2,-24),Jr=Symbol("SKIP_GENERATION");function jd(n){return n.index?n.index.count:n.attributes.position.count}function Zi(n){return jd(n)/3}function Xd(n,e=ArrayBuffer){return n>65535?new Uint32Array(new e(4*n)):new Uint16Array(new e(2*n))}function Zd(n,e){if(!n.index){const t=n.attributes.position.count,i=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,s=Xd(t,i);n.setIndex(new S.BufferAttribute(s,1));for(let r=0;r<t;r++)s[r]=r}}function Cc(n){const e=Zi(n),t=n.drawRange,i=t.start/3,s=(t.start+t.count)/3,r=Math.max(0,i),o=Math.min(e,s)-r;return[{offset:Math.floor(r),count:Math.floor(o)}]}function yc(n){if(!n.groups||!n.groups.length)return Cc(n);const e=[],t=new Set,i=n.drawRange,s=i.start/3,r=(i.start+i.count)/3;for(const a of n.groups){const l=a.start/3,c=(a.start+a.count)/3;t.add(Math.max(s,l)),t.add(Math.min(r,c))}const o=Array.from(t.values()).sort((a,l)=>a-l);for(let a=0;a<o.length-1;a++){const l=o[a],c=o[a+1];e.push({offset:Math.floor(l),count:Math.floor(c-l)})}return e}function qd(n){if(n.groups.length===0)return!1;const e=Zi(n),t=yc(n).sort((r,o)=>r.offset-o.offset),i=t[t.length-1];i.count=Math.min(e-i.offset,i.count);let s=0;return t.forEach(({count:r})=>s+=r),e!==s}function Ft(n,e,t){return t.min.x=e[n],t.min.y=e[n+1],t.min.z=e[n+2],t.max.x=e[n+3],t.max.y=e[n+4],t.max.z=e[n+5],t}function Qd(n){n[0]=n[1]=n[2]=1/0,n[3]=n[4]=n[5]=-1/0}function Ba(n){let e=-1,t=-1/0;for(let i=0;i<3;i++){const s=n[i+3]-n[i];s>t&&(t=s,e=i)}return e}function za(n,e){e.set(n)}function Va(n,e,t){let i,s;for(let r=0;r<3;r++){const o=r+3;i=n[r],s=e[r],t[r]=i<s?i:s,i=n[o],s=e[o],t[o]=i>s?i:s}}function un(n,e,t){for(let i=0;i<3;i++){const s=e[n+2*i],r=e[n+2*i+1],o=s-r,a=s+r;o<t[i]&&(t[i]=o),a>t[i+3]&&(t[i+3]=a)}}function ls(n){const e=n[3]-n[0],t=n[4]-n[1],i=n[5]-n[2];return 2*(e*t+t*i+i*e)}function to(n,e,t,i,s=null){let r=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,h=-1/0,d=1/0,u=1/0,f=1/0,p=-1/0,m=-1/0,E=-1/0;const g=s!==null;for(let b=e*6,v=(e+t)*6;b<v;b+=6){const I=n[b+0],T=n[b+1],A=I-T,R=I+T;A<r&&(r=A),R>l&&(l=R),g&&I<d&&(d=I),g&&I>p&&(p=I);const P=n[b+2],F=n[b+3],x=P-F,D=P+F;x<o&&(o=x),D>c&&(c=D),g&&P<u&&(u=P),g&&P>m&&(m=P);const w=n[b+4],L=n[b+5],C=w-L,U=w+L;C<a&&(a=C),U>h&&(h=U),g&&w<f&&(f=w),g&&w>E&&(E=w)}i[0]=r,i[1]=o,i[2]=a,i[3]=l,i[4]=c,i[5]=h,g&&(s[0]=d,s[1]=u,s[2]=f,s[3]=p,s[4]=m,s[5]=E)}function Kd(n,e,t,i){let s=1/0,r=1/0,o=1/0,a=-1/0,l=-1/0,c=-1/0;for(let h=e*6,d=(e+t)*6;h<d;h+=6){const u=n[h+0];u<s&&(s=u),u>a&&(a=u);const f=n[h+2];f<r&&(r=f),f>l&&(l=f);const p=n[h+4];p<o&&(o=p),p>c&&(c=p)}i[0]=s,i[1]=r,i[2]=o,i[3]=a,i[4]=l,i[5]=c}function Jd(n,e){Qd(e);const t=n.attributes.position,i=n.index?n.index.array:null,s=Zi(n),r=new Float32Array(s*6),o=t.normalized,a=t.array,l=t.offset||0;let c=3;t.isInterleavedBufferAttribute&&(c=t.data.stride);const h=["getX","getY","getZ"];for(let d=0;d<s;d++){const u=d*3,f=d*6;let p=u+0,m=u+1,E=u+2;i&&(p=i[p],m=i[m],E=i[E]),o||(p=p*c+l,m=m*c+l,E=E*c+l);for(let g=0;g<3;g++){let b,v,I;o?(b=t[h[g]](p),v=t[h[g]](m),I=t[h[g]](E)):(b=a[p+g],v=a[m+g],I=a[E+g]);let T=b;v<T&&(T=v),I<T&&(T=I);let A=b;v>A&&(A=v),I>A&&(A=I);const R=(A-T)/2,P=g*2;r[f+P+0]=T+R,r[f+P+1]=R+(Math.abs(T)+R)*Wd,T<e[g]&&(e[g]=T),A>e[g+3]&&(e[g+3]=A)}}return r}const we=32,tu=(n,e)=>n.candidate-e.candidate,Pe=new Array(we).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),fn=new Float32Array(6);function eu(n,e,t,i,s,r){let o=-1,a=0;if(r===bc)o=Ba(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(r===Gd)o=Ba(n),o!==-1&&(a=iu(t,i,s,o));else if(r===Yd){const l=ls(n);let c=Kr*s;const h=i*6,d=(i+s)*6;for(let u=0;u<3;u++){const f=e[u],E=(e[u+3]-f)/we;if(s<we/4){const g=[...Pe];g.length=s;let b=0;for(let I=h;I<d;I+=6,b++){const T=g[b];T.candidate=t[I+2*u],T.count=0;const{bounds:A,leftCacheBounds:R,rightCacheBounds:P}=T;for(let F=0;F<3;F++)P[F]=1/0,P[F+3]=-1/0,R[F]=1/0,R[F+3]=-1/0,A[F]=1/0,A[F+3]=-1/0;un(I,t,A)}g.sort(tu);let v=s;for(let I=0;I<v;I++){const T=g[I];for(;I+1<v&&g[I+1].candidate===T.candidate;)g.splice(I+1,1),v--}for(let I=h;I<d;I+=6){const T=t[I+2*u];for(let A=0;A<v;A++){const R=g[A];T>=R.candidate?un(I,t,R.rightCacheBounds):(un(I,t,R.leftCacheBounds),R.count++)}}for(let I=0;I<v;I++){const T=g[I],A=T.count,R=s-T.count,P=T.leftCacheBounds,F=T.rightCacheBounds;let x=0;A!==0&&(x=ls(P)/l);let D=0;R!==0&&(D=ls(F)/l);const w=ka+Kr*(x*A+D*R);w<c&&(o=u,c=w,a=T.candidate)}}else{for(let v=0;v<we;v++){const I=Pe[v];I.count=0,I.candidate=f+E+v*E;const T=I.bounds;for(let A=0;A<3;A++)T[A]=1/0,T[A+3]=-1/0}for(let v=h;v<d;v+=6){let A=~~((t[v+2*u]-f)/E);A>=we&&(A=we-1);const R=Pe[A];R.count++,un(v,t,R.bounds)}const g=Pe[we-1];za(g.bounds,g.rightCacheBounds);for(let v=we-2;v>=0;v--){const I=Pe[v],T=Pe[v+1];Va(I.bounds,T.rightCacheBounds,I.rightCacheBounds)}let b=0;for(let v=0;v<we-1;v++){const I=Pe[v],T=I.count,A=I.bounds,P=Pe[v+1].rightCacheBounds;T!==0&&(b===0?za(A,fn):Va(A,fn,fn)),b+=T;let F=0,x=0;b!==0&&(F=ls(fn)/l);const D=s-b;D!==0&&(x=ls(P)/l);const w=ka+Kr*(F*b+x*D);w<c&&(o=u,c=w,a=I.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${r} used.`);return{axis:o,pos:a}}function iu(n,e,t,i){let s=0;for(let r=e,o=e+t;r<o;r++)s+=n[r*6+i*2];return s/t}class pn{constructor(){}}function su(n,e,t,i,s,r){let o=i,a=i+s-1;const l=r.pos,c=r.axis*2;for(;;){for(;o<=a&&t[o*6+c]<l;)o++;for(;o<=a&&t[a*6+c]>=l;)a--;if(o<a){for(let h=0;h<3;h++){let d=e[o*3+h];e[o*3+h]=e[a*3+h],e[a*3+h]=d}for(let h=0;h<6;h++){let d=t[o*6+h];t[o*6+h]=t[a*6+h],t[a*6+h]=d}o++,a--}else return o}}function nu(n,e,t,i,s,r){let o=i,a=i+s-1;const l=r.pos,c=r.axis*2;for(;;){for(;o<=a&&t[o*6+c]<l;)o++;for(;o<=a&&t[a*6+c]>=l;)a--;if(o<a){let h=n[o];n[o]=n[a],n[a]=h;for(let d=0;d<6;d++){let u=t[o*6+d];t[o*6+d]=t[a*6+d],t[a*6+d]=u}o++,a--}else return o}}function ru(n,e){const t=(n.index?n.index.count:n.attributes.position.count)/3,i=t>2**16,s=i?4:2,r=e?new SharedArrayBuffer(t*s):new ArrayBuffer(t*s),o=i?new Uint32Array(r):new Uint16Array(r);for(let a=0,l=o.length;a<l;a++)o[a]=a;return o}function ou(n,e){const t=n.geometry,i=t.index?t.index.array:null,s=e.maxDepth,r=e.verbose,o=e.maxLeafTris,a=e.strategy,l=e.onProgress,c=Zi(t),h=n._indirectBuffer;let d=!1;const u=new Float32Array(6),f=new Float32Array(6),p=Jd(t,u),m=e.indirect?nu:su,E=[],g=e.indirect?Cc(t):yc(t);if(g.length===1){const I=g[0],T=new pn;T.boundingData=u,Kd(p,I.offset,I.count,f),v(T,I.offset,I.count,f),E.push(T)}else for(let I of g){const T=new pn;T.boundingData=new Float32Array(6),to(p,I.offset,I.count,T.boundingData,f),v(T,I.offset,I.count,f),E.push(T)}return E;function b(I){l&&l(I/c)}function v(I,T,A,R=null,P=0){if(!d&&P>=s&&(d=!0,r&&(console.warn(`MeshBVH: Max depth of ${s} reached when generating BVH. Consider increasing maxDepth.`),console.warn(t))),A<=o||P>=s)return b(T+A),I.offset=T,I.count=A,I;const F=eu(I.boundingData,R,p,T,A,a);if(F.axis===-1)return b(T+A),I.offset=T,I.count=A,I;const x=m(h,i,p,T,A,F);if(x===T||x===T+A)b(T+A),I.offset=T,I.count=A;else{I.splitAxis=F.axis;const D=new pn,w=T,L=x-T;I.left=D,D.boundingData=new Float32Array(6),to(p,w,L,D.boundingData,f),v(D,w,L,f,P+1);const C=new pn,U=x,Z=A-L;I.right=C,C.boundingData=new Float32Array(6),to(p,U,Z,C.boundingData,f),v(C,U,Z,f,P+1)}return I}}function au(n,e){const t=n.geometry;e.indirect&&(n._indirectBuffer=ru(t,e.useSharedArrayBuffer),qd(t)&&!e.verbose&&console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),n._indirectBuffer||Zd(t,e);const i=ou(n,e);let s,r,o;const a=[],l=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let d=0;d<i.length;d++){const u=i[d];let f=c(u);const p=new l(zn*f);s=new Float32Array(p),r=new Uint32Array(p),o=new Uint16Array(p),h(0,u),a.push(p)}n._roots=a;return;function c(d){return d.count?1:1+c(d.left)+c(d.right)}function h(d,u){const f=d/4,p=d/2,m=!!u.count,E=u.boundingData;for(let g=0;g<6;g++)s[f+g]=E[g];if(m){const g=u.offset,b=u.count;return r[f+6]=g,o[p+14]=b,o[p+15]=Fr,d+zn}else{const g=u.left,b=u.right,v=u.splitAxis;let I;if(I=h(d+zn,g),I/4>Math.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return r[f+6]=I/4,I=h(I,b),r[f+7]=v,I}}}class Re{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let i=1/0,s=-1/0;for(let r=0,o=e.length;r<o;r++){const l=e[r][t];i=l<i?l:i,s=l>s?l:s}this.min=i,this.max=s}setFromPoints(e,t){let i=1/0,s=-1/0;for(let r=0,o=t.length;r<o;r++){const a=t[r],l=e.dot(a);i=l<i?l:i,s=l>s?l:s}this.min=i,this.max=s}isSeparated(e){return this.min>e.max||e.min>this.max}}Re.prototype.setFromBox=function(){const n=new S.Vector3;return function(t,i){const s=i.min,r=i.max;let o=1/0,a=-1/0;for(let l=0;l<=1;l++)for(let c=0;c<=1;c++)for(let h=0;h<=1;h++){n.x=s.x*l+r.x*(1-l),n.y=s.y*c+r.y*(1-c),n.z=s.z*h+r.z*(1-h);const d=t.dot(n);o=Math.min(d,o),a=Math.max(d,a)}this.min=o,this.max=a}}();const lu=function(){const n=new S.Vector3,e=new S.Vector3,t=new S.Vector3;return function(s,r,o){const a=s.start,l=n,c=r.start,h=e;t.subVectors(a,c),n.subVectors(s.end,s.start),e.subVectors(r.end,r.start);const d=t.dot(h),u=h.dot(l),f=h.dot(h),p=t.dot(l),E=l.dot(l)*f-u*u;let g,b;E!==0?g=(d*u-p*f)/E:g=0,b=(d+g*u)/f,o.x=g,o.y=b}}(),ha=function(){const n=new S.Vector2,e=new S.Vector3,t=new S.Vector3;return function(s,r,o,a){lu(s,r,n);let l=n.x,c=n.y;if(l>=0&&l<=1&&c>=0&&c<=1){s.at(l,o),r.at(c,a);return}else if(l>=0&&l<=1){c<0?r.at(0,a):r.at(1,a),s.closestPointToPoint(a,!0,o);return}else if(c>=0&&c<=1){l<0?s.at(0,o):s.at(1,o),r.closestPointToPoint(o,!0,a);return}else{let h;l<0?h=s.start:h=s.end;let d;c<0?d=r.start:d=r.end;const u=e,f=t;if(s.closestPointToPoint(d,!0,e),r.closestPointToPoint(h,!0,t),u.distanceToSquared(d)<=f.distanceToSquared(h)){o.copy(u),a.copy(d);return}else{o.copy(h),a.copy(f);return}}}}(),cu=function(){const n=new S.Vector3,e=new S.Vector3,t=new S.Plane,i=new S.Line3;return function(r,o){const{radius:a,center:l}=r,{a:c,b:h,c:d}=o;if(i.start=c,i.end=h,i.closestPointToPoint(l,!0,n).distanceTo(l)<=a||(i.start=c,i.end=d,i.closestPointToPoint(l,!0,n).distanceTo(l)<=a)||(i.start=h,i.end=d,i.closestPointToPoint(l,!0,n).distanceTo(l)<=a))return!0;const m=o.getPlane(t);if(Math.abs(m.distanceToPoint(l))<=a){const g=m.projectPoint(l,e);if(o.containsPoint(g))return!0}return!1}}(),hu=1e-15;function eo(n){return Math.abs(n)<hu}class ue extends S.Triangle{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new S.Vector3),this.satBounds=new Array(4).fill().map(()=>new Re),this.points=[this.a,this.b,this.c],this.sphere=new S.Sphere,this.plane=new S.Plane,this.needsUpdate=!0}intersectsSphere(e){return cu(e,this)}update(){const e=this.a,t=this.b,i=this.c,s=this.points,r=this.satAxes,o=this.satBounds,a=r[0],l=o[0];this.getNormal(a),l.setFromPoints(a,s);const c=r[1],h=o[1];c.subVectors(e,t),h.setFromPoints(c,s);const d=r[2],u=o[2];d.subVectors(t,i),u.setFromPoints(d,s);const f=r[3],p=o[3];f.subVectors(i,e),p.setFromPoints(f,s),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}ue.prototype.closestPointToSegment=function(){const n=new S.Vector3,e=new S.Vector3,t=new S.Line3;return function(s,r=null,o=null){const{start:a,end:l}=s,c=this.points;let h,d=1/0;for(let u=0;u<3;u++){const f=(u+1)%3;t.start.copy(c[u]),t.end.copy(c[f]),ha(t,s,n,e),h=n.distanceToSquared(e),h<d&&(d=h,r&&r.copy(n),o&&o.copy(e))}return this.closestPointToPoint(a,n),h=a.distanceToSquared(n),h<d&&(d=h,r&&r.copy(n),o&&o.copy(a)),this.closestPointToPoint(l,n),h=l.distanceToSquared(n),h<d&&(d=h,r&&r.copy(n),o&&o.copy(l)),Math.sqrt(d)}}();ue.prototype.intersectsTriangle=function(){const n=new ue,e=new Array(3),t=new Array(3),i=new Re,s=new Re,r=new S.Vector3,o=new S.Vector3,a=new S.Vector3,l=new S.Vector3,c=new S.Vector3,h=new S.Line3,d=new S.Line3,u=new S.Line3,f=new S.Vector3;function p(m,E,g){const b=m.points;let v=0,I=-1;for(let T=0;T<3;T++){const{start:A,end:R}=h;A.copy(b[T]),R.copy(b[(T+1)%3]),h.delta(o);const P=eo(E.distanceToPoint(A));if(eo(E.normal.dot(o))&&P){g.copy(h),v=2;break}const F=E.intersectLine(h,f);if(!F&&P&&f.copy(A),(F||P)&&!eo(f.distanceTo(R))){if(v<=1)(v===1?g.start:g.end).copy(f),P&&(I=v);else if(v>=2){(I===1?g.start:g.end).copy(f),v=2;break}if(v++,v===2&&I===-1)break}}return v}return function(E,g=null,b=!1){this.needsUpdate&&this.update(),E.isExtendedTriangle?E.needsUpdate&&E.update():(n.copy(E),n.update(),E=n);const v=this.plane,I=E.plane;if(Math.abs(v.normal.dot(I.normal))>1-1e-10){const T=this.satBounds,A=this.satAxes;t[0]=E.a,t[1]=E.b,t[2]=E.c;for(let F=0;F<4;F++){const x=T[F],D=A[F];if(i.setFromPoints(D,t),x.isSeparated(i))return!1}const R=E.satBounds,P=E.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let F=0;F<4;F++){const x=R[F],D=P[F];if(i.setFromPoints(D,e),x.isSeparated(i))return!1}for(let F=0;F<4;F++){const x=A[F];for(let D=0;D<4;D++){const w=P[D];if(r.crossVectors(x,w),i.setFromPoints(r,e),s.setFromPoints(r,t),i.isSeparated(s))return!1}}return g&&(b||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),g.start.set(0,0,0),g.end.set(0,0,0)),!0}else{const T=p(this,I,d);if(T===1&&E.containsPoint(d.end))return g&&(g.start.copy(d.end),g.end.copy(d.end)),!0;if(T!==2)return!1;const A=p(E,v,u);if(A===1&&this.containsPoint(u.end))return g&&(g.start.copy(u.end),g.end.copy(u.end)),!0;if(A!==2)return!1;if(d.delta(a),u.delta(l),a.dot(l)<0){let L=u.start;u.start=u.end,u.end=L}const R=d.start.dot(a),P=d.end.dot(a),F=u.start.dot(a),x=u.end.dot(a),D=P<F,w=R<x;return R!==x&&F!==P&&D===w?!1:(g&&(c.subVectors(d.start,u.start),c.dot(a)>0?g.start.copy(d.start):g.start.copy(u.start),c.subVectors(d.end,u.end),c.dot(a)<0?g.end.copy(d.end):g.end.copy(u.end)),!0)}}}();ue.prototype.distanceToPoint=function(){const n=new S.Vector3;return function(t){return this.closestPointToPoint(t,n),t.distanceTo(n)}}();ue.prototype.distanceToTriangle=function(){const n=new S.Vector3,e=new S.Vector3,t=["a","b","c"],i=new S.Line3,s=new S.Line3;return function(o,a=null,l=null){const c=a||l?i:null;if(this.intersectsTriangle(o,c))return(a||l)&&(a&&c.getCenter(a),l&&c.getCenter(l)),0;let h=1/0;for(let d=0;d<3;d++){let u;const f=t[d],p=o[f];this.closestPointToPoint(p,n),u=p.distanceToSquared(n),u<h&&(h=u,a&&a.copy(n),l&&l.copy(p));const m=this[f];o.closestPointToPoint(m,n),u=m.distanceToSquared(n),u<h&&(h=u,a&&a.copy(m),l&&l.copy(n))}for(let d=0;d<3;d++){const u=t[d],f=t[(d+1)%3];i.set(this[u],this[f]);for(let p=0;p<3;p++){const m=t[p],E=t[(p+1)%3];s.set(o[m],o[E]),ha(i,s,n,e);const g=n.distanceToSquared(e);g<h&&(h=g,a&&a.copy(n),l&&l.copy(e))}}return Math.sqrt(h)}}();class Gt{constructor(e,t,i){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 Re),this.alignedSatBounds=new Array(3).fill().map(()=>new Re),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),i&&this.matrix.copy(i)}set(e,t,i){this.min.copy(e),this.max.copy(t),this.matrix.copy(i),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}Gt.prototype.update=function(){return function(){const e=this.matrix,t=this.min,i=this.max,s=this.points;for(let c=0;c<=1;c++)for(let h=0;h<=1;h++)for(let d=0;d<=1;d++){const u=1*c|2*h|4*d,f=s[u];f.x=c?i.x:t.x,f.y=h?i.y:t.y,f.z=d?i.z:t.z,f.applyMatrix4(e)}const r=this.satBounds,o=this.satAxes,a=s[0];for(let c=0;c<3;c++){const h=o[c],d=r[c],u=1<<c,f=s[u];h.subVectors(a,f),d.setFromPoints(h,s)}const l=this.alignedSatBounds;l[0].setFromPointsField(s,"x"),l[1].setFromPointsField(s,"y"),l[2].setFromPointsField(s,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}}();Gt.prototype.intersectsBox=function(){const n=new Re;return function(t){this.needsUpdate&&this.update();const i=t.min,s=t.max,r=this.satBounds,o=this.satAxes,a=this.alignedSatBounds;if(n.min=i.x,n.max=s.x,a[0].isSeparated(n)||(n.min=i.y,n.max=s.y,a[1].isSeparated(n))||(n.min=i.z,n.max=s.z,a[2].isSeparated(n)))return!1;for(let l=0;l<3;l++){const c=o[l],h=r[l];if(n.setFromBox(c,t),h.isSeparated(n))return!1}return!0}}();Gt.prototype.intersectsTriangle=function(){const n=new ue,e=new Array(3),t=new Re,i=new Re,s=new S.Vector3;return function(o){this.needsUpdate&&this.update(),o.isExtendedTriangle?o.needsUpdate&&o.update():(n.copy(o),n.update(),o=n);const a=this.satBounds,l=this.satAxes;e[0]=o.a,e[1]=o.b,e[2]=o.c;for(let u=0;u<3;u++){const f=a[u],p=l[u];if(t.setFromPoints(p,e),f.isSeparated(t))return!1}const c=o.satBounds,h=o.satAxes,d=this.points;for(let u=0;u<3;u++){const f=c[u],p=h[u];if(t.setFromPoints(p,d),f.isSeparated(t))return!1}for(let u=0;u<3;u++){const f=l[u];for(let p=0;p<4;p++){const m=h[p];if(s.crossVectors(f,m),t.setFromPoints(s,e),i.setFromPoints(s,d),t.isSeparated(i))return!1}}return!0}}();Gt.prototype.closestPointToPoint=function(){return function(e,t){return this.needsUpdate&&this.update(),t.copy(e).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),t}}();Gt.prototype.distanceToPoint=function(){const n=new S.Vector3;return function(t){return this.closestPointToPoint(t,n),t.distanceTo(n)}}();Gt.prototype.distanceToBox=function(){const n=["x","y","z"],e=new Array(12).fill().map(()=>new S.Line3),t=new Array(12).fill().map(()=>new S.Line3),i=new S.Vector3,s=new S.Vector3;return function(o,a=0,l=null,c=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(l||c)&&(o.getCenter(s),this.closestPointToPoint(s,i),o.closestPointToPoint(i,s),l&&l.copy(i),c&&c.copy(s)),0;const h=a*a,d=o.min,u=o.max,f=this.points;let p=1/0;for(let E=0;E<8;E++){const g=f[E];s.copy(g).clamp(d,u);const b=g.distanceToSquared(s);if(b<p&&(p=b,l&&l.copy(g),c&&c.copy(s),b<h))return Math.sqrt(b)}let m=0;for(let E=0;E<3;E++)for(let g=0;g<=1;g++)for(let b=0;b<=1;b++){const v=(E+1)%3,I=(E+2)%3,T=g<<v|b<<I,A=1<<E|g<<v|b<<I,R=f[T],P=f[A];e[m].set(R,P);const x=n[E],D=n[v],w=n[I],L=t[m],C=L.start,U=L.end;C[x]=d[x],C[D]=g?d[D]:u[D],C[w]=b?d[w]:u[D],U[x]=u[x],U[D]=g?d[D]:u[D],U[w]=b?d[w]:u[D],m++}for(let E=0;E<=1;E++)for(let g=0;g<=1;g++)for(let b=0;b<=1;b++){s.x=E?u.x:d.x,s.y=g?u.y:d.y,s.z=b?u.z:d.z,this.closestPointToPoint(s,i);const v=s.distanceToSquared(i);if(v<p&&(p=v,l&&l.copy(i),c&&c.copy(s),v<h))return Math.sqrt(v)}for(let E=0;E<12;E++){const g=e[E];for(let b=0;b<12;b++){const v=t[b];ha(g,v,i,s);const I=i.distanceToSquared(s);if(I<p&&(p=I,l&&l.copy(i),c&&c.copy(s),I<h))return Math.sqrt(I)}}return Math.sqrt(p)}}();class da{constructor(e){this._getNewPrimitive=e,this._primitives=[]}getPrimitive(){const e=this._primitives;return e.length===0?this._getNewPrimitive():e.pop()}releasePrimitive(e){this._primitives.push(e)}}class du extends da{constructor(){super(()=>new ue)}}const te=new du;function Wt(n,e){return e[n+15]===65535}function jt(n,e){return e[n+6]}function ee(n,e){return e[n+14]}function ie(n){return n+8}function se(n,e){return e[n+6]}function _c(n,e){return e[n+7]}class uu{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const e=[];let t=null;this.setBuffer=i=>{t&&e.push(t),t=i,this.float32Array=new Float32Array(i),this.uint16Array=new Uint16Array(i),this.uint32Array=new Uint32Array(i)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,e.length!==0&&this.setBuffer(e.pop())}}}const wt=new uu;let Ve,ki;const Ti=[],mn=new da(()=>new S.Box3);function fu(n,e,t,i,s,r){Ve=mn.getPrimitive(),ki=mn.getPrimitive(),Ti.push(Ve,ki),wt.setBuffer(n._roots[e]);const o=xo(0,n.geometry,t,i,s,r);wt.clearBuffer(),mn.releasePrimitive(Ve),mn.releasePrimitive(ki),Ti.pop(),Ti.pop();const a=Ti.length;return a>0&&(ki=Ti[a-1],Ve=Ti[a-2]),o}function xo(n,e,t,i,s=null,r=0,o=0){const{float32Array:a,uint16Array:l,uint32Array:c}=wt;let h=n*2;if(Wt(h,l)){const u=jt(n,c),f=ee(h,l);return Ft(n,a,Ve),i(u,f,!1,o,r+n,Ve)}else{let x=function(w){const{uint16Array:L,uint32Array:C}=wt;let U=w*2;for(;!Wt(U,L);)w=ie(w),U=w*2;return jt(w,C)},D=function(w){const{uint16Array:L,uint32Array:C}=wt;let U=w*2;for(;!Wt(U,L);)w=se(w,C),U=w*2;return jt(w,C)+ee(U,L)};const u=ie(n),f=se(n,c);let p=u,m=f,E,g,b,v;if(s&&(b=Ve,v=ki,Ft(p,a,b),Ft(m,a,v),E=s(b),g=s(v),g<E)){p=f,m=u;const w=E;E=g,g=w,b=v}b||(b=Ve,Ft(p,a,b));const I=Wt(p*2,l),T=t(b,I,E,o+1,r+p);let A;if(T===Ua){const w=x(p),C=D(p)-w;A=i(w,C,!0,o+1,r+p,b)}else A=T&&xo(p,e,t,i,s,r,o+1);if(A)return!0;v=ki,Ft(m,a,v);const R=Wt(m*2,l),P=t(v,R,g,o+1,r+m);let F;if(P===Ua){const w=x(m),C=D(m)-w;F=i(w,C,!0,o+1,r+m,v)}else F=P&&xo(m,e,t,i,s,r,o+1);return!!F}}const cs=new S.Vector3,io=new S.Vector3;function pu(n,e,t={},i=0,s=1/0){const r=i*i,o=s*s;let a=1/0,l=null;if(n.shapecast({boundsTraverseOrder:h=>(cs.copy(e).clamp(h.min,h.max),cs.distanceToSquared(e)),intersectsBounds:(h,d,u)=>u<a&&u<o,intersectsTriangle:(h,d)=>{h.closestPointToPoint(e,cs);const u=e.distanceToSquared(cs);return u<a&&(io.copy(cs),a=u,l=d),u<r}}),a===1/0)return null;const c=Math.sqrt(a);return t.point?t.point.copy(io):t.point=io.clone(),t.distance=c,t.faceIndex=l,t}const vi=new S.Vector3,wi=new S.Vector3,Ai=new S.Vector3,gn=new S.Vector2,En=new S.Vector2,In=new S.Vector2,$a=new S.Vector3,Ha=new S.Vector3,Ga=new S.Vector3,bn=new S.Vector3;function mu(n,e,t,i,s,r){let o;return r===S.BackSide?o=n.intersectTriangle(i,t,e,!0,s):o=n.intersectTriangle(e,t,i,r!==S.DoubleSide,s),o===null?null:{distance:n.origin.distanceTo(s),point:s.clone()}}function gu(n,e,t,i,s,r,o,a,l){vi.fromBufferAttribute(e,r),wi.fromBufferAttribute(e,o),Ai.fromBufferAttribute(e,a);const c=mu(n,vi,wi,Ai,bn,l);if(c){i&&(gn.fromBufferAttribute(i,r),En.fromBufferAttribute(i,o),In.fromBufferAttribute(i,a),c.uv=S.Triangle.getInterpolation(bn,vi,wi,Ai,gn,En,In,new S.Vector2)),s&&(gn.fromBufferAttribute(s,r),En.fromBufferAttribute(s,o),In.fromBufferAttribute(s,a),c.uv1=S.Triangle.getInterpolation(bn,vi,wi,Ai,gn,En,In,new S.Vector2)),t&&($a.fromBufferAttribute(t,r),Ha.fromBufferAttribute(t,o),Ga.fromBufferAttribute(t,a),c.normal=S.Triangle.getInterpolation(bn,vi,wi,Ai,$a,Ha,Ga,new S.Vector3),c.normal.dot(n.direction)>0&&c.normal.multiplyScalar(-1));const h={a:r,b:o,c:a,normal:new S.Vector3,materialIndex:0};S.Triangle.getNormal(vi,wi,Ai,h.normal),c.face=h,c.faceIndex=r}return c}function Or(n,e,t,i,s){const r=i*3;let o=r+0,a=r+1,l=r+2;const c=n.index;n.index&&(o=c.getX(o),a=c.getX(a),l=c.getX(l));const{position:h,normal:d,uv:u,uv1:f}=n.attributes,p=gu(t,h,d,u,f,o,a,l,e);return p?(p.faceIndex=i,s&&s.push(p),p):null}function Ut(n,e,t,i){const s=n.a,r=n.b,o=n.c;let a=e,l=e+1,c=e+2;t&&(a=t.getX(a),l=t.getX(l),c=t.getX(c)),s.x=i.getX(a),s.y=i.getY(a),s.z=i.getZ(a),r.x=i.getX(l),r.y=i.getY(l),r.z=i.getZ(l),o.x=i.getX(c),o.y=i.getY(c),o.z=i.getZ(c)}function Eu(n,e,t,i,s,r){const{geometry:o,_indirectBuffer:a}=n;for(let l=i,c=i+s;l<c;l++)Or(o,e,t,l,r)}function Iu(n,e,t,i,s){const{geometry:r,_indirectBuffer:o}=n;let a=1/0,l=null;for(let c=i,h=i+s;c<h;c++){let d;d=Or(r,e,t,c),d&&d.distance<a&&(l=d,a=d.distance)}return l}function bu(n,e,t,i,s,r,o){const{geometry:a}=t,{index:l}=a,c=a.attributes.position;for(let h=n,d=e+n;h<d;h++){let u;if(u=h,Ut(o,u*3,l,c),o.needsUpdate=!0,i(o,u,s,r))return!0}return!1}function Cu(n,e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=n.geometry,i=t.index?t.index.array:null,s=t.attributes.position;let r,o,a,l,c=0;const h=n._roots;for(let u=0,f=h.length;u<f;u++)r=h[u],o=new Uint32Array(r),a=new Uint16Array(r),l=new Float32Array(r),d(0,c),c+=r.byteLength;function d(u,f,p=!1){const m=u*2;if(a[m+15]===Fr){const g=o[u+6],b=a[m+14];let v=1/0,I=1/0,T=1/0,A=-1/0,R=-1/0,P=-1/0;for(let F=3*g,x=3*(g+b);F<x;F++){let D=i[F];const w=s.getX(D),L=s.getY(D),C=s.getZ(D);w<v&&(v=w),w>A&&(A=w),L<I&&(I=L),L>R&&(R=L),C<T&&(T=C),C>P&&(P=C)}return l[u+0]!==v||l[u+1]!==I||l[u+2]!==T||l[u+3]!==A||l[u+4]!==R||l[u+5]!==P?(l[u+0]=v,l[u+1]=I,l[u+2]=T,l[u+3]=A,l[u+4]=R,l[u+5]=P,!0):!1}else{const g=u+8,b=o[u+6],v=g+f,I=b+f;let T=p,A=!1,R=!1;e?T||(A=e.has(v),R=e.has(I),T=!A&&!R):(A=!0,R=!0);const P=T||A,F=T||R;let x=!1;P&&(x=d(g,f,T));let D=!1;F&&(D=d(b,f,T));const w=x||D;if(w)for(let L=0;L<3;L++){const C=g+L,U=b+L,Z=l[C],H=l[C+3],st=l[U],Y=l[U+3];l[u+L]=Z<st?Z:st,l[u+L+3]=H>Y?H:Y}return w}}}const Ya=new S.Box3;function Ye(n,e,t,i){return Ft(n,e,Ya),t.intersectBox(Ya,i)}function yu(n,e,t,i,s,r){const{geometry:o,_indirectBuffer:a}=n;for(let l=i,c=i+s;l<c;l++){let h=a?a[l]:l;Or(o,e,t,h,r)}}function _u(n,e,t,i,s){const{geometry:r,_indirectBuffer:o}=n;let a=1/0,l=null;for(let c=i,h=i+s;c<h;c++){let d;d=Or(r,e,t,o?o[c]:c),d&&d.distance<a&&(l=d,a=d.distance)}return l}function Tu(n,e,t,i,s,r,o){const{geometry:a}=t,{index:l}=a,c=a.attributes.position;for(let h=n,d=e+n;h<d;h++){let u;if(u=t.resolveTriangleIndex(h),Ut(o,u*3,l,c),o.needsUpdate=!0,i(o,u,s,r))return!0}return!1}const Wa=new S.Vector3;function vu(n,e,t,i,s){wt.setBuffer(n._roots[e]),No(0,n,t,i,s),wt.clearBuffer()}function No(n,e,t,i,s){const{float32Array:r,uint16Array:o,uint32Array:a}=wt,l=n*2;if(Wt(l,o)){const h=jt(n,a),d=ee(l,o);Eu(e,t,i,h,d,s)}else{const h=ie(n);Ye(h,r,i,Wa)&&No(h,e,t,i,s);const d=se(n,a);Ye(d,r,i,Wa)&&No(d,e,t,i,s)}}const ja=new S.Vector3,wu=["x","y","z"];function Au(n,e,t,i){wt.setBuffer(n._roots[e]);const s=Po(0,n,t,i);return wt.clearBuffer(),s}function Po(n,e,t,i){const{float32Array:s,uint16Array:r,uint32Array:o}=wt;let a=n*2;if(Wt(a,r)){const c=jt(n,o),h=ee(a,r);return Iu(e,t,i,c,h)}else{const c=_c(n,o),h=wu[c],u=i.direction[h]>=0;let f,p;u?(f=ie(n),p=se(n,o)):(f=se(n,o),p=ie(n));const E=Ye(f,s,i,ja)?Po(f,e,t,i):null;if(E){const v=E.point[h];if(u?v<=s[p+c]:v>=s[p+c+3])return E}const b=Ye(p,s,i,ja)?Po(p,e,t,i):null;return E&&b?E.distance<=b.distance?E:b:E||b||null}}const Cn=new S.Box3,Ri=new ue,Si=new ue,hs=new S.Matrix4,Xa=new Gt,yn=new Gt;function Ru(n,e,t,i){wt.setBuffer(n._roots[e]);const s=Lo(0,n,t,i);return wt.clearBuffer(),s}function Lo(n,e,t,i,s=null){const{float32Array:r,uint16Array:o,uint32Array:a}=wt;let l=n*2;if(s===null&&(t.boundingBox||t.computeBoundingBox(),Xa.set(t.boundingBox.min,t.boundingBox.max,i),s=Xa),Wt(l,o)){const h=e.geometry,d=h.index,u=h.attributes.position,f=t.index,p=t.attributes.position,m=jt(n,a),E=ee(l,o);if(hs.copy(i).invert(),t.boundsTree)return Ft(n,r,yn),yn.matrix.copy(hs),yn.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:b=>yn.intersectsBox(b),intersectsTriangle:b=>{b.a.applyMatrix4(i),b.b.applyMatrix4(i),b.c.applyMatrix4(i),b.needsUpdate=!0;for(let v=m*3,I=(E+m)*3;v<I;v+=3)if(Ut(Si,v,d,u),Si.needsUpdate=!0,b.intersectsTriangle(Si))return!0;return!1}});for(let g=m*3,b=(E+m)*3;g<b;g+=3){Ut(Ri,g,d,u),Ri.a.applyMatrix4(hs),Ri.b.applyMatrix4(hs),Ri.c.applyMatrix4(hs),Ri.needsUpdate=!0;for(let v=0,I=f.count;v<I;v+=3)if(Ut(Si,v,f,p),Si.needsUpdate=!0,Ri.intersectsTriangle(Si))return!0}}else{const h=n+8,d=a[n+6];return Ft(h,r,Cn),!!(s.intersectsBox(Cn)&&Lo(h,e,t,i,s)||(Ft(d,r,Cn),s.intersectsBox(Cn)&&Lo(d,e,t,i,s)))}}const _n=new S.Matrix4,so=new Gt,ds=new Gt,Su=new S.Vector3,Fu=new S.Vector3,Ou=new S.Vector3,xu=new S.Vector3;function Nu(n,e,t,i={},s={},r=0,o=1/0){e.boundingBox||e.computeBoundingBox(),so.set(e.boundingBox.min,e.boundingBox.max,t),so.needsUpdate=!0;const a=n.geometry,l=a.attributes.position,c=a.index,h=e.attributes.position,d=e.index,u=te.getPrimitive(),f=te.getPrimitive();let p=Su,m=Fu,E=null,g=null;s&&(E=Ou,g=xu);let b=1/0,v=null,I=null;return _n.copy(t).invert(),ds.matrix.copy(_n),n.shapecast({boundsTraverseOrder:T=>so.distanceToBox(T),intersectsBounds:(T,A,R)=>R<b&&R<o?(A&&(ds.min.copy(T.min),ds.max.copy(T.max),ds.needsUpdate=!0),!0):!1,intersectsRange:(T,A)=>{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:P=>ds.distanceToBox(P),intersectsBounds:(P,F,x)=>x<b&&x<o,intersectsRange:(P,F)=>{for(let x=P,D=P+F;x<D;x++){Ut(f,3*x,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let w=T,L=T+A;w<L;w++){Ut(u,3*w,c,l),u.needsUpdate=!0;const C=u.distanceToTriangle(f,p,E);if(C<b&&(m.copy(p),g&&g.copy(E),b=C,v=w,I=x),C<r)return!0}}}});{const R=Zi(e);for(let P=0,F=R;P<F;P++){Ut(f,3*P,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let x=T,D=T+A;x<D;x++){Ut(u,3*x,c,l),u.needsUpdate=!0;const w=u.distanceToTriangle(f,p,E);if(w<b&&(m.copy(p),g&&g.copy(E),b=w,v=x,I=P),w<r)return!0}}}}}),te.releasePrimitive(u),te.releasePrimitive(f),b===1/0?null:(i.point?i.point.copy(m):i.point=m.clone(),i.distance=b,i.faceIndex=v,s&&(s.point?s.point.copy(g):s.point=g.clone(),s.point.applyMatrix4(_n),m.applyMatrix4(_n),s.distance=m.sub(s.point).length(),s.faceIndex=I),i)}function Pu(n,e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=n.geometry,i=t.index?t.index.array:null,s=t.attributes.position;let r,o,a,l,c=0;const h=n._roots;for(let u=0,f=h.length;u<f;u++)r=h[u],o=new Uint32Array(r),a=new Uint16Array(r),l=new Float32Array(r),d(0,c),c+=r.byteLength;function d(u,f,p=!1){const m=u*2;if(a[m+15]===Fr){const g=o[u+6],b=a[m+14];let v=1/0,I=1/0,T=1/0,A=-1/0,R=-1/0,P=-1/0;for(let F=g,x=g+b;F<x;F++){const D=3*n.resolveTriangleIndex(F);for(let w=0;w<3;w++){let L=D+w;L=i?i[L]:L;const C=s.getX(L),U=s.getY(L),Z=s.getZ(L);C<v&&(v=C),C>A&&(A=C),U<I&&(I=U),U>R&&(R=U),Z<T&&(T=Z),Z>P&&(P=Z)}}return l[u+0]!==v||l[u+1]!==I||l[u+2]!==T||l[u+3]!==A||l[u+4]!==R||l[u+5]!==P?(l[u+0]=v,l[u+1]=I,l[u+2]=T,l[u+3]=A,l[u+4]=R,l[u+5]=P,!0):!1}else{const g=u+8,b=o[u+6],v=g+f,I=b+f;let T=p,A=!1,R=!1;e?T||(A=e.has(v),R=e.has(I),T=!A&&!R):(A=!0,R=!0);const P=T||A,F=T||R;let x=!1;P&&(x=d(g,f,T));let D=!1;F&&(D=d(b,f,T));const w=x||D;if(w)for(let L=0;L<3;L++){const C=g+L,U=b+L,Z=l[C],H=l[C+3],st=l[U],Y=l[U+3];l[u+L]=Z<st?Z:st,l[u+L+3]=H>Y?H:Y}return w}}}const Za=new S.Vector3;function Lu(n,e,t,i,s){wt.setBuffer(n._roots[e]),Mo(0,n,t,i,s),wt.clearBuffer()}function Mo(n,e,t,i,s){const{float32Array:r,uint16Array:o,uint32Array:a}=wt,l=n*2;if(Wt(l,o)){const h=jt(n,a),d=ee(l,o);yu(e,t,i,h,d,s)}else{const h=ie(n);Ye(h,r,i,Za)&&Mo(h,e,t,i,s);const d=se(n,a);Ye(d,r,i,Za)&&Mo(d,e,t,i,s)}}const qa=new S.Vector3,Mu=["x","y","z"];function Du(n,e,t,i){wt.setBuffer(n._roots[e]);const s=Do(0,n,t,i);return wt.clearBuffer(),s}function Do(n,e,t,i){const{float32Array:s,uint16Array:r,uint32Array:o}=wt;let a=n*2;if(Wt(a,r)){const c=jt(n,o),h=ee(a,r);return _u(e,t,i,c,h)}else{const c=_c(n,o),h=Mu[c],u=i.direction[h]>=0;let f,p;u?(f=ie(n),p=se(n,o)):(f=se(n,o),p=ie(n));const E=Ye(f,s,i,qa)?Do(f,e,t,i):null;if(E){const v=E.point[h];if(u?v<=s[p+c]:v>=s[p+c+3])return E}const b=Ye(p,s,i,qa)?Do(p,e,t,i):null;return E&&b?E.distance<=b.distance?E:b:E||b||null}}const Tn=new S.Box3,Fi=new ue,Oi=new ue,us=new S.Matrix4,Qa=new Gt,vn=new Gt;function Uu(n,e,t,i){wt.setBuffer(n._roots[e]);const s=Uo(0,n,t,i);return wt.clearBuffer(),s}function Uo(n,e,t,i,s=null){const{float32Array:r,uint16Array:o,uint32Array:a}=wt;let l=n*2;if(s===null&&(t.boundingBox||t.computeBoundingBox(),Qa.set(t.boundingBox.min,t.boundingBox.max,i),s=Qa),Wt(l,o)){const h=e.geometry,d=h.index,u=h.attributes.position,f=t.index,p=t.attributes.position,m=jt(n,a),E=ee(l,o);if(us.copy(i).invert(),t.boundsTree)return Ft(n,r,vn),vn.matrix.copy(us),vn.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:b=>vn.intersectsBox(b),intersectsTriangle:b=>{b.a.applyMatrix4(i),b.b.applyMatrix4(i),b.c.applyMatrix4(i),b.needsUpdate=!0;for(let v=m,I=E+m;v<I;v++)if(Ut(Oi,3*e.resolveTriangleIndex(v),d,u),Oi.needsUpdate=!0,b.intersectsTriangle(Oi))return!0;return!1}});for(let g=m,b=E+m;g<b;g++){const v=e.resolveTriangleIndex(g);Ut(Fi,3*v,d,u),Fi.a.applyMatrix4(us),Fi.b.applyMatrix4(us),Fi.c.applyMatrix4(us),Fi.needsUpdate=!0;for(let I=0,T=f.count;I<T;I+=3)if(Ut(Oi,I,f,p),Oi.needsUpdate=!0,Fi.intersectsTriangle(Oi))return!0}}else{const h=n+8,d=a[n+6];return Ft(h,r,Tn),!!(s.intersectsBox(Tn)&&Uo(h,e,t,i,s)||(Ft(d,r,Tn),s.intersectsBox(Tn)&&Uo(d,e,t,i,s)))}}const wn=new S.Matrix4,no=new Gt,fs=new Gt,ku=new S.Vector3,Bu=new S.Vector3,zu=new S.Vector3,Vu=new S.Vector3;function $u(n,e,t,i={},s={},r=0,o=1/0){e.boundingBox||e.computeBoundingBox(),no.set(e.boundingBox.min,e.boundingBox.max,t),no.needsUpdate=!0;const a=n.geometry,l=a.attributes.position,c=a.index,h=e.attributes.position,d=e.index,u=te.getPrimitive(),f=te.getPrimitive();let p=ku,m=Bu,E=null,g=null;s&&(E=zu,g=Vu);let b=1/0,v=null,I=null;return wn.copy(t).invert(),fs.matrix.copy(wn),n.shapecast({boundsTraverseOrder:T=>no.distanceToBox(T),intersectsBounds:(T,A,R)=>R<b&&R<o?(A&&(fs.min.copy(T.min),fs.max.copy(T.max),fs.needsUpdate=!0),!0):!1,intersectsRange:(T,A)=>{if(e.boundsTree){const R=e.boundsTree;return R.shapecast({boundsTraverseOrder:P=>fs.distanceToBox(P),intersectsBounds:(P,F,x)=>x<b&&x<o,intersectsRange:(P,F)=>{for(let x=P,D=P+F;x<D;x++){const w=R.resolveTriangleIndex(x);Ut(f,3*w,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let L=T,C=T+A;L<C;L++){const U=n.resolveTriangleIndex(L);Ut(u,3*U,c,l),u.needsUpdate=!0;const Z=u.distanceToTriangle(f,p,E);if(Z<b&&(m.copy(p),g&&g.copy(E),b=Z,v=L,I=x),Z<r)return!0}}}})}else{const R=Zi(e);for(let P=0,F=R;P<F;P++){Ut(f,3*P,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let x=T,D=T+A;x<D;x++){const w=n.resolveTriangleIndex(x);Ut(u,3*w,c,l),u.needsUpdate=!0;const L=u.distanceToTriangle(f,p,E);if(L<b&&(m.copy(p),g&&g.copy(E),b=L,v=x,I=P),L<r)return!0}}}}}),te.releasePrimitive(u),te.releasePrimitive(f),b===1/0?null:(i.point?i.point.copy(m):i.point=m.clone(),i.distance=b,i.faceIndex=v,s&&(s.point?s.point.copy(g):s.point=g.clone(),s.point.applyMatrix4(wn),m.applyMatrix4(wn),s.distance=m.sub(s.point).length(),s.faceIndex=I),i)}function Hu(){return typeof SharedArrayBuffer<"u"}const Rs=new wt.constructor,jn=new wt.constructor,Ue=new da(()=>new S.Box3),xi=new S.Box3,Ni=new S.Box3,ro=new S.Box3,oo=new S.Box3;let ao=!1;function Gu(n,e,t,i){if(ao)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");ao=!0;const s=n._roots,r=e._roots;let o,a=0,l=0;const c=new S.Matrix4().copy(t).invert();for(let h=0,d=s.length;h<d;h++){Rs.setBuffer(s[h]),l=0;const u=Ue.getPrimitive();Ft(0,Rs.float32Array,u),u.applyMatrix4(c);for(let f=0,p=r.length;f<p&&(jn.setBuffer(r[h]),o=le(0,0,t,c,i,a,l,0,0,u),jn.clearBuffer(),l+=r[f].length,!o);f++);if(Ue.releasePrimitive(u),Rs.clearBuffer(),a+=s[h].length,o)break}return ao=!1,o}function le(n,e,t,i,s,r=0,o=0,a=0,l=0,c=null,h=!1){let d,u;h?(d=jn,u=Rs):(d=Rs,u=jn);const f=d.float32Array,p=d.uint32Array,m=d.uint16Array,E=u.float32Array,g=u.uint32Array,b=u.uint16Array,v=n*2,I=e*2,T=Wt(v,m),A=Wt(I,b);let R=!1;if(A&&T)h?R=s(jt(e,g),ee(e*2,b),jt(n,p),ee(n*2,m),l,o+e,a,r+n):R=s(jt(n,p),ee(n*2,m),jt(e,g),ee(e*2,b),a,r+n,l,o+e);else if(A){const P=Ue.getPrimitive();Ft(e,E,P),P.applyMatrix4(t);const F=ie(n),x=se(n,p);Ft(F,f,xi),Ft(x,f,Ni);const D=P.intersectsBox(xi),w=P.intersectsBox(Ni);R=D&&le(e,F,i,t,s,o,r,l,a+1,P,!h)||w&&le(e,x,i,t,s,o,r,l,a+1,P,!h),Ue.releasePrimitive(P)}else{const P=ie(e),F=se(e,g);Ft(P,E,ro),Ft(F,E,oo);const x=c.intersectsBox(ro),D=c.intersectsBox(oo);if(x&&D)R=le(n,P,t,i,s,r,o,a,l+1,c,h)||le(n,F,t,i,s,r,o,a,l+1,c,h);else if(x)if(T)R=le(n,P,t,i,s,r,o,a,l+1,c,h);else{const w=Ue.getPrimitive();w.copy(ro).applyMatrix4(t);const L=ie(n),C=se(n,p);Ft(L,f,xi),Ft(C,f,Ni);const U=w.intersectsBox(xi),Z=w.intersectsBox(Ni);R=U&&le(P,L,i,t,s,o,r,l,a+1,w,!h)||Z&&le(P,C,i,t,s,o,r,l,a+1,w,!h),Ue.releasePrimitive(w)}else if(D)if(T)R=le(n,F,t,i,s,r,o,a,l+1,c,h);else{const w=Ue.getPrimitive();w.copy(oo).applyMatrix4(t);const L=ie(n),C=se(n,p);Ft(L,f,xi),Ft(C,f,Ni);const U=w.intersectsBox(xi),Z=w.intersectsBox(Ni);R=U&&le(F,L,i,t,s,o,r,l,a+1,w,!h)||Z&&le(F,C,i,t,s,o,r,l,a+1,w,!h),Ue.releasePrimitive(w)}}return R}const An=new Gt,Ka=new S.Box3;class ua{static serialize(e,t={}){t={cloneBuffers:!0,...t};const i=e.geometry,s=e._roots,r=e._indirectBuffer,o=i.getIndex();let a;return t.cloneBuffers?a={roots:s.map(l=>l.slice()),index:o.array.slice(),indirectBuffer:r?r.slice():null}:a={roots:s,index:o.array,indirectBuffer:r},a}static deserialize(e,t,i={}){i={setIndex:!0,indirect:!!e.indirectBuffer,...i};const{index:s,roots:r,indirectBuffer:o}=e,a=new ua(t,{...i,[Jr]:!0});if(a._roots=r,a._indirectBuffer=o||null,i.setIndex){const l=t.getIndex();if(l===null){const c=new S.BufferAttribute(e.index,1,!1);t.setIndex(c)}else l.array!==s&&(l.array.set(s),l.needsUpdate=!0)}return a}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:bc,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[Jr]:!1},t),t.useSharedArrayBuffer&&!Hu())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[Jr]||(au(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new S.Box3)));const{_indirectBuffer:i}=this;this.resolveTriangleIndex=t.indirect?s=>i[s]:s=>s}refit(e=null){return(this.indirect?Pu:Cu)(this,e)}traverse(e,t=0){const i=this._roots[t],s=new Uint32Array(i),r=new Uint16Array(i);o(0);function o(a,l=0){const c=a*2,h=r[c+15]===Fr;if(h){const d=s[a+6],u=r[c+14];e(l,h,new Float32Array(i,a*4,6),d,u)}else{const d=a+zn/4,u=s[a+6],f=s[a+7];e(l,h,new Float32Array(i,a*4,6),f)||(o(d,l+1),o(u,l+1))}}}raycast(e,t=S.FrontSide){const i=this._roots,s=this.geometry,r=[],o=t.isMaterial,a=Array.isArray(t),l=s.groups,c=o?t.side:t,h=this.indirect?Lu:vu;for(let d=0,u=i.length;d<u;d++){const f=a?t[l[d].materialIndex].side:c,p=r.length;if(h(this,d,f,e,r),a){const m=l[d].materialIndex;for(let E=p,g=r.length;E<g;E++)r[E].face.materialIndex=m}}return r}raycastFirst(e,t=S.FrontSide){const i=this._roots,s=this.geometry,r=t.isMaterial,o=Array.isArray(t);let a=null;const l=s.groups,c=r?t.side:t,h=this.indirect?Du:Au;for(let d=0,u=i.length;d<u;d++){const f=o?t[l[d].materialIndex].side:c,p=h(this,d,f,e);p!=null&&(a==null||p.distance<a.distance)&&(a=p,o&&(p.face.materialIndex=l[d].materialIndex))}return a}intersectsGeometry(e,t){let i=!1;const s=this._roots,r=this.indirect?Uu:Ru;for(let o=0,a=s.length;o<a&&(i=r(this,o,e,t),!i);o++);return i}shapecast(e){const t=te.getPrimitive(),i=this.indirect?Tu:bu;let{boundsTraverseOrder:s,intersectsBounds:r,intersectsRange:o,intersectsTriangle:a}=e;if(o&&a){const d=o;o=(u,f,p,m,E)=>d(u,f,p,m,E)?!0:i(u,f,this,a,p,m,t)}else o||(a?o=(d,u,f,p)=>i(d,u,this,a,f,p,t):o=(d,u,f)=>f);let l=!1,c=0;const h=this._roots;for(let d=0,u=h.length;d<u;d++){const f=h[d];if(l=fu(this,d,r,o,s,c),l)break;c+=f.byteLength}return te.releasePrimitive(t),l}bvhcast(e,t,i){let{intersectsRanges:s,intersectsTriangles:r}=i;const o=te.getPrimitive(),a=this.geometry.index,l=this.geometry.attributes.position,c=this.indirect?p=>{const m=this.resolveTriangleIndex(p);Ut(o,m*3,a,l)}:p=>{Ut(o,p*3,a,l)},h=te.getPrimitive(),d=e.geometry.index,u=e.geometry.attributes.position,f=e.indirect?p=>{const m=e.resolveTriangleIndex(p);Ut(h,m*3,d,u)}:p=>{Ut(h,p*3,d,u)};if(r){const p=(m,E,g,b,v,I,T,A)=>{for(let R=g,P=g+b;R<P;R++){f(R),h.a.applyMatrix4(t),h.b.applyMatrix4(t),h.c.applyMatrix4(t),h.needsUpdate=!0;for(let F=m,x=m+E;F<x;F++)if(c(F),o.needsUpdate=!0,r(o,h,F,R,v,I,T,A))return!0}return!1};if(s){const m=s;s=function(E,g,b,v,I,T,A,R){return m(E,g,b,v,I,T,A,R)?!0:p(E,g,b,v,I,T,A,R)}}else s=p}return Gu(this,e,t,s)}intersectsBox(e,t){return An.set(e.min,e.max,t),An.needsUpdate=!0,this.shapecast({intersectsBounds:i=>An.intersectsBox(i),intersectsTriangle:i=>An.intersectsTriangle(i)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,i={},s={},r=0,o=1/0){return(this.indirect?$u:Nu)(this,e,t,i,s,r,o)}closestPointToPoint(e,t={},i=0,s=1/0){return pu(this,e,t,i,s)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(i=>{Ft(0,new Float32Array(i),Ka),e.union(Ka)}),e}}function Ja(n,e,t){return n===null||(n.point.applyMatrix4(e.matrixWorld),n.distance=n.point.distanceTo(t.ray.origin),n.object=e,n.distance<t.near||n.distance>t.far)?null:n}const lo=new S.Ray,tl=new S.Matrix4,Yu=S.Mesh.prototype.raycast;function Wu(n,e){if(this.geometry.boundsTree){if(this.material===void 0)return;tl.copy(this.matrixWorld).invert(),lo.copy(n.ray).applyMatrix4(tl);const t=this.geometry.boundsTree;if(n.firstHitOnly===!0){const i=Ja(t.raycastFirst(lo,this.material),this,n);i&&e.push(i)}else{const i=t.raycast(lo,this.material);for(let s=0,r=i.length;s<r;s++){const o=Ja(i[s],this,n);o&&e.push(o)}}}else Yu.call(this,n,e)}function ju(n){return this.boundsTree=new ua(this,n),this.boundsTree}function Xu(){this.boundsTree=null}let Q=class{constructor(){y(this,"trigger",e=>{const t=this.handlers.slice(0);for(const i of t)i(e)});y(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter(t=>t!==e)}reset(){this.handlers.length=0}};class Ss{constructor(){y(this,"trigger",async e=>{const t=this.handlers.slice(0);for(const i of t)await i(e)});y(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter(t=>t!==e)}reset(){this.handlers.length=0}}class xr{constructor(e){y(this,"isDisposeable",()=>"dispose"in this&&"onDisposed"in this);y(this,"isResizeable",()=>"resize"in this&&"getSize"in this);y(this,"isUpdateable",()=>"onAfterUpdate"in this&&"onBeforeUpdate"in this&&"update"in this);y(this,"isHideable",()=>"visible"in this);y(this,"isConfigurable",()=>"setup"in this&&"config"in this&&"onSetup"in this);this.components=e}}class Ot extends xr{}class Nr extends xr{constructor(t){super(t);y(this,"worlds",new Map);y(this,"onWorldChanged",new Q);y(this,"currentWorld",null);this.onWorldChanged.add(({world:i,action:s})=>{s==="removed"&&this.worlds.delete(i.uuid)})}}class Tc extends Nr{constructor(){super(...arguments);y(this,"hasCameraControls",()=>"controls"in this)}}class vc extends Nr{constructor(){super(...arguments);y(this,"onAfterUpdate",new Q);y(this,"onBeforeUpdate",new Q);y(this,"onDisposed",new Q);y(this,"onResize",new Q);y(this,"onClippingPlanesUpdated",new Q);y(this,"clippingPlanes",[])}updateClippingPlanes(){this.onClippingPlanesUpdated.trigger()}setPlane(t,i,s){i.isLocal=s;const r=this.clippingPlanes.indexOf(i);t&&r===-1?this.clippingPlanes.push(i):!t&&r>-1&&this.clippingPlanes.splice(r,1),this.three.clippingPlanes=this.clippingPlanes.filter(o=>!o.isLocal)}}const Ls=class Ls extends Ot{constructor(t){super(t);y(this,"_disposedComponents",new Set);y(this,"enabled",!0);t.add(Ls.uuid,this)}get(){return this._disposedComponents}destroy(t,i=!0,s=!0){t.removeFromParent();const r=t;r.dispose&&r.dispose(),this.disposeGeometryAndMaterials(t,i),s&&r.children&&r.children.length&&this.disposeChildren(r),t.children.length=0}disposeGeometry(t){t.boundsTree&&t.disposeBoundsTree&&t.disposeBoundsTree(),t.dispose()}disposeGeometryAndMaterials(t,i){const s=t;s.geometry&&this.disposeGeometry(s.geometry),i&&s.material&&Ls.disposeMaterial(s),s.material=[],s.geometry=null}disposeChildren(t){for(const i of t.children)this.destroy(i)}static disposeMaterial(t){if(t.material)if(Array.isArray(t.material))for(const i of t.material)i.dispose();else t.material.dispose()}};y(Ls,"uuid","76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");let Se=Ls;class wc extends Nr{constructor(t){super(t);y(this,"onDisposed",new Q);y(this,"directionalLights",new Map);y(this,"ambientLights",new Map)}dispose(){const t=this.components.get(Se);for(const i of this.three.children){const s=i;s.geometry&&t.destroy(s)}for(const[,i]of this.directionalLights)i.removeFromParent(),i.target.removeFromParent(),i.dispose();for(const[,i]of this.ambientLights)i.removeFromParent(),i.dispose();this.three.children=[],this.onDisposed.trigger(),this.onDisposed.reset()}}class hi extends Set{constructor(t){super(t);y(this,"onItemAdded",new Q);y(this,"onItemDeleted",new Q);y(this,"onCleared",new Q)}clear(){super.clear(),this.onCleared.trigger()}add(t){if(this.has(t))return this;const s=super.add(t);return this.onItemAdded||(this.onItemAdded=new Q),this.onItemAdded.trigger(t),s}delete(t){const i=super.delete(t);return i&&this.onItemDeleted.trigger(),i}dispose(){this.clear(),this.onItemAdded.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}class Bs extends Map{constructor(t){super(t);y(this,"onItemSet",new Q);y(this,"onItemUpdated",new Q);y(this,"onItemDeleted",new Q);y(this,"onCleared",new Q)}clear(){super.clear(),this.onCleared.trigger()}set(t,i){const s=this.has(t),r=super.set(t,i);return s?(this.onItemUpdated||(this.onItemUpdated=new Q),this.onItemUpdated.trigger({key:t,value:i})):(this.onItemSet||(this.onItemSet=new Q),this.onItemSet.trigger({key:t,value:i})),r}delete(t){const i=super.delete(t);return i&&this.onItemDeleted.trigger(),i}dispose(){this.clear(),this.onItemSet.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}const Vn=0,Zu=1,qu=new S.Vector3,el=new S.Line3,co=new S.Plane,il=new S.Vector3,Rn=new S.Triangle;class Qu{constructor(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new sl,this.unassigned=new sl,this.vertices=[]}setFromPoints(e){if(e.length>=4){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.vertices.push(new Ku(e[t]));this.compute()}return this}setFromObject(e){const t=[];return e.updateMatrixWorld(!0),e.traverse(function(i){const s=i.geometry;if(s!==void 0){const r=s.attributes.position;if(r!==void 0)for(let o=0,a=r.count;o<a;o++){const l=new S.Vector3;l.fromBufferAttribute(r,o).applyMatrix4(i.matrixWorld),t.push(l)}}}),this.setFromPoints(t)}containsPoint(e){const t=this.faces;for(let i=0,s=t.length;i<s;i++)if(t[i].distanceToPoint(e)>this.tolerance)return!1;return!0}intersectRay(e,t){const i=this.faces;let s=-1/0,r=1/0;for(let o=0,a=i.length;o<a;o++){const l=i[o],c=l.distanceToPoint(e.origin),h=l.normal.dot(e.direction);if(c>0&&h>=0)return null;const d=h!==0?-c/h:0;if(!(d<=0)&&(h>0?r=Math.min(d,r):s=Math.max(d,s),s>r))return null}return s!==-1/0?e.at(s,t):e.at(r,t),t}intersectsRay(e){return this.intersectRay(e,qu)!==null}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(e,t){return e.face=t,t.outside===null?this.assigned.append(e):this.assigned.insertBefore(t.outside,e),t.outside=e,this}removeVertexFromFace(e,t){return e===t.outside&&(e.next!==null&&e.next.face===t?t.outside=e.next:t.outside=null),this.assigned.remove(e),this}removeAllVerticesFromFace(e){if(e.outside!==null){const t=e.outside;let i=e.outside;for(;i.next!==null&&i.next.face===e;)i=i.next;return this.assigned.removeSubList(t,i),t.prev=i.next=null,e.outside=null,t}}deleteFaceVertices(e,t){const i=this.removeAllVerticesFromFace(e);if(i!==void 0)if(t===void 0)this.unassigned.appendChain(i);else{let s=i;do{const r=s.next;t.distanceToPoint(s.point)>this.tolerance?this.addVertexToFace(s,t):this.unassigned.append(s),s=r}while(s!==null)}return this}resolveUnassignedPoints(e){if(this.unassigned.isEmpty()===!1){let t=this.unassigned.first();do{const i=t.next;let s=this.tolerance,r=null;for(let o=0;o<e.length;o++){const a=e[o];if(a.mark===Vn){const l=a.distanceToPoint(t.point);if(l>s&&(s=l,r=a),s>1e3*this.tolerance)break}}r!==null&&this.addVertexToFace(t,r),t=i}while(t!==null)}return this}computeExtremes(){const e=new S.Vector3,t=new S.Vector3,i=[],s=[];for(let r=0;r<3;r++)i[r]=s[r]=this.vertices[0];e.copy(this.vertices[0].point),t.copy(this.vertices[0].point);for(let r=0,o=this.vertices.length;r<o;r++){const a=this.vertices[r],l=a.point;for(let c=0;c<3;c++)l.getComponent(c)<e.getComponent(c)&&(e.setComponent(c,l.getComponent(c)),i[c]=a);for(let c=0;c<3;c++)l.getComponent(c)>t.getComponent(c)&&(t.setComponent(c,l.getComponent(c)),s[c]=a)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(e.x),Math.abs(t.x))+Math.max(Math.abs(e.y),Math.abs(t.y))+Math.max(Math.abs(e.z),Math.abs(t.z))),{min:i,max:s}}computeInitialHull(){const e=this.vertices,t=this.computeExtremes(),i=t.min,s=t.max;let r=0,o=0;for(let u=0;u<3;u++){const f=s[u].point.getComponent(u)-i[u].point.getComponent(u);f>r&&(r=f,o=u)}const a=i[o],l=s[o];let c,h;r=0,el.set(a.point,l.point);for(let u=0,f=this.vertices.length;u<f;u++){const p=e[u];if(p!==a&&p!==l){el.closestPointToPoint(p.point,!0,il);const m=il.distanceToSquared(p.point);m>r&&(r=m,c=p)}}r=-1,co.setFromCoplanarPoints(a.point,l.point,c.point);for(let u=0,f=this.vertices.length;u<f;u++){const p=e[u];if(p!==a&&p!==l&&p!==c){const m=Math.abs(co.distanceToPoint(p.point));m>r&&(r=m,h=p)}}const d=[];if(co.distanceToPoint(h.point)<0){d.push(he.create(a,l,c),he.create(h,l,a),he.create(h,c,l),he.create(h,a,c));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(he.create(a,c,l),he.create(h,a,l),he.create(h,l,c),he.create(h,c,a));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=e.length;u<f;u++){const p=e[u];if(p!==a&&p!==l&&p!==c&&p!==h){r=this.tolerance;let m=null;for(let E=0;E<4;E++){const g=this.faces[E].distanceToPoint(p.point);g>r&&(r=g,m=this.faces[E])}m!==null&&this.addVertexToFace(p,m)}}return this}reindexFaces(){const e=[];for(let t=0;t<this.faces.length;t++){const i=this.faces[t];i.mark===Vn&&e.push(i)}return this.faces=e,this}nextVertexToAdd(){if(this.assigned.isEmpty()===!1){let e,t=0;const i=this.assigned.first().face;let s=i.outside;do{const r=i.distanceToPoint(s.point);r>t&&(t=r,e=s),s=s.next}while(s!==null&&s.face===i);return e}}computeHorizon(e,t,i,s){this.deleteFaceVertices(i),i.mark=Zu;let r;t===null?r=t=i.getEdge(0):r=t.next;do{const o=r.twin,a=o.face;a.mark===Vn&&(a.distanceToPoint(e)>this.tolerance?this.computeHorizon(e,o,a,s):s.push(r)),r=r.next}while(r!==t);return this}addAdjoiningFace(e,t){const i=he.create(e,t.tail(),t.head());return this.faces.push(i),i.getEdge(-1).setTwin(t.twin),i.getEdge(0)}addNewFaces(e,t){this.newFaces=[];let i=null,s=null;for(let r=0;r<t.length;r++){const o=t[r],a=this.addAdjoiningFace(e,o);i===null?i=a:a.next.setTwin(s),this.newFaces.push(a.face),s=a}return i.next.setTwin(s),this}addVertexToHull(e){const t=[];return this.unassigned.clear(),this.removeVertexFromFace(e,e.face),this.computeHorizon(e.point,null,e.face,t),this.addNewFaces(e,t),this.resolveUnassignedPoints(this.newFaces),this}cleanup(){return this.assigned.clear(),this.unassigned.clear(),this.newFaces=[],this}compute(){let e;for(this.computeInitialHull();(e=this.nextVertexToAdd())!==void 0;)this.addVertexToHull(e);return this.reindexFaces(),this.cleanup(),this}}class he{constructor(){this.normal=new S.Vector3,this.midpoint=new S.Vector3,this.area=0,this.constant=0,this.outside=null,this.mark=Vn,this.edge=null}static create(e,t,i){const s=new he,r=new ho(e,s),o=new ho(t,s),a=new ho(i,s);return r.next=a.prev=o,o.next=r.prev=a,a.next=o.prev=r,s.edge=r,s.compute()}getEdge(e){let t=this.edge;for(;e>0;)t=t.next,e--;for(;e<0;)t=t.prev,e++;return t}compute(){const e=this.edge.tail(),t=this.edge.head(),i=this.edge.next.head();return Rn.set(e.point,t.point,i.point),Rn.getNormal(this.normal),Rn.getMidpoint(this.midpoint),this.area=Rn.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(e){return this.normal.dot(e)-this.constant}}class ho{constructor(e,t){this.vertex=e,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 e=this.head(),t=this.tail();return t!==null?t.point.distanceTo(e.point):-1}lengthSquared(){const e=this.head(),t=this.tail();return t!==null?t.point.distanceToSquared(e.point):-1}setTwin(e){return this.twin=e,e.twin=this,this}}class Ku{constructor(e){this.point=e,this.prev=null,this.next=null,this.face=null}}class sl{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(e,t){return t.prev=e.prev,t.next=e,t.prev===null?this.head=t:t.prev.next=t,e.prev=t,this}insertAfter(e,t){return t.prev=e,t.next=e.next,t.next===null?this.tail=t:t.next.prev=t,e.next=t,this}append(e){return this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e,this}appendChain(e){for(this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail;e.next!==null;)e=e.next;return this.tail=e,this}remove(e){return e.prev===null?this.head=e.next:e.prev.next=e.next,e.next===null?this.tail=e.prev:e.next.prev=e.prev,this}removeSubList(e,t){return e.prev===null?this.head=t.next:e.prev.next=t.next,t.next===null?this.tail=e.prev:t.next.prev=e.prev,this}isEmpty(){return this.head===null}}const ko=[2,2,1],Bo=[1,0,0];function be(n,e){return n*3+e}function Ju(n){const e=n.elements;let t=0;for(let i=0;i<9;i++)t+=e[i]*e[i];return Math.sqrt(t)}function tf(n){const e=n.elements;let t=0;for(let i=0;i<3;i++){const s=e[be(ko[i],Bo[i])];t+=2*s*s}return Math.sqrt(t)}function ef(n,e){let t=0,i=1;const s=n.elements;for(let c=0;c<3;c++){const h=Math.abs(s[be(ko[c],Bo[c])]);h>t&&(t=h,i=c)}let r=1,o=0;const a=Bo[i],l=ko[i];if(Math.abs(s[be(l,a)])>Number.EPSILON){const c=s[be(l,l)],h=s[be(a,a)],d=s[be(l,a)],u=(c-h)/2/d;let f;u<0?f=-1/(-u+Math.sqrt(1+u*u)):f=1/(u+Math.sqrt(1+u*u)),r=1/Math.sqrt(1+f*f),o=f*r}return e.identity(),e.elements[be(a,a)]=r,e.elements[be(l,l)]=r,e.elements[be(l,a)]=o,e.elements[be(a,l)]=-o,e}function sf(n,e){let t=0,i=0;const s=10;e.unitary.identity(),e.diagonal.copy(n);const r=e.unitary,o=e.diagonal,a=new M.Matrix3,l=new M.Matrix3,c=Number.EPSILON*Ju(o);for(;i<s&&tf(o)>c;)ef(o,a),l.copy(a).transpose(),o.multiply(a),o.premultiply(l),r.multiply(a),++t>2&&(i++,t=0);return e}function Ac(n){const e=[];for(let lt=0;lt<n.length-2;lt+=3){const pt=n[lt],ft=n[lt+1],Ct=n[lt+2];e.push(new M.Vector3(pt,ft,Ct))}const t=new Qu;t.setFromPoints(e);const i={unitary:new M.Matrix3,diagonal:new M.Matrix3},s=t.faces,r=[],o=[];for(let lt=0,pt=s.length;lt<pt;lt++){const ft=s[lt];let Ct=ft.edge;r.length=0;do r.push(Ct),Ct=Ct.next;while(Ct!==ft.edge);const qt=r.length-2;for(let zt=1,_=qt;zt<=_;zt++){const j=r[0].vertex,$=r[zt+0].vertex,N=r[zt+1].vertex;o.push(j.point.x,j.point.y,j.point.z),o.push($.point.x,$.point.y,$.point.z),o.push(N.point.x,N.point.y,N.point.z)}}const a=new M.Vector3,l=new M.Vector3,c=new M.Vector3,h=new M.Vector3,d=new M.Vector3,u=new M.Vector3,f=new M.Vector3,p=new M.Vector3;let m=0,E=0,g=0,b=0,v=0,I=0,T=0;for(let lt=0,pt=o.length;lt<pt;lt+=9){a.fromArray(o,lt),l.fromArray(o,lt+3),c.fromArray(o,lt+6),f.set(0,0,0),f.add(a).add(l).add(c).divideScalar(3),h.subVectors(l,a),d.subVectors(c,a);const ft=u.crossVectors(h,d).length()/2;p.add(u.copy(f).multiplyScalar(ft)),m+=ft,E+=(9*f.x*f.x+a.x*a.x+l.x*l.x+c.x*c.x)*(ft/12),g+=(9*f.x*f.y+a.x*a.y+l.x*l.y+c.x*c.y)*(ft/12),b+=(9*f.x*f.z+a.x*a.z+l.x*l.z+c.x*c.z)*(ft/12),v+=(9*f.y*f.y+a.y*a.y+l.y*l.y+c.y*c.y)*(ft/12),I+=(9*f.y*f.z+a.y*a.z+l.y*l.z+c.y*c.z)*(ft/12),T+=(9*f.z*f.z+a.z*a.z+l.z*l.z+c.z*c.z)*(ft/12)}p.divideScalar(m),E/=m,g/=m,b/=m,v/=m,I/=m,T/=m,E-=p.x*p.x,g-=p.x*p.y,b-=p.x*p.z,v-=p.y*p.y,I-=p.y*p.z,T-=p.z*p.z;const A=new M.Matrix3;A.elements[0]=E,A.elements[1]=g,A.elements[2]=b,A.elements[3]=g,A.elements[4]=v,A.elements[5]=I,A.elements[6]=b,A.elements[7]=I,A.elements[8]=T,sf(A,i);const R=i.unitary,P=new M.Vector3,F=new M.Vector3,x=new M.Vector3;R.extractBasis(P,F,x);let D=-1/0,w=-1/0,L=-1/0,C=1/0,U=1/0,Z=1/0;for(let lt=0,pt=e.length;lt<pt;lt++){const ft=e[lt];D=Math.max(P.dot(ft),D),w=Math.max(F.dot(ft),w),L=Math.max(x.dot(ft),L),C=Math.min(P.dot(ft),C),U=Math.min(F.dot(ft),U),Z=Math.min(x.dot(ft),Z)}P.multiplyScalar(.5*(C+D)),F.multiplyScalar(.5*(U+w)),x.multiplyScalar(.5*(Z+L));const H=new M.Vector3,st=new M.Vector3,Y=new M.Matrix3;H.add(P).add(F).add(x),st.x=D-C,st.y=w-U,st.z=L-Z,st.multiplyScalar(.5),Y.copy(R);const{x:ot,y:V,z:B}=st,at=new M.Matrix4;at.makeScale(ot*2,V*2,B*2);const nt=new M.Matrix4;nt.makeTranslation(-ot,-V,-B);const it=new M.Matrix4;it.makeTranslation(H.x,H.y,H.z);const At=new M.Matrix4;At.setFromMatrix3(Y);const xt=new M.Matrix4;return xt.multiply(it),xt.multiply(At),xt.multiply(nt),xt.multiply(at),{center:H,halfSizes:st,rotation:Y,transformation:xt}}function Rc(n,e,t){const i=[n[0]-e[0],n[1]-e[1],n[2]-e[2]];return t[0]*i[0]+t[1]*i[1]+t[2]*i[2]>0}class zo{static isTransparent(e){return e.transparent&&e.opacity<1}}const Pt=class Pt{static create(){const e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return`${Pt._lut[e&255]+Pt._lut[e>>8&255]+Pt._lut[e>>16&255]+Pt._lut[e>>24&255]}-${Pt._lut[t&255]}${Pt._lut[t>>8&255]}-${Pt._lut[t>>16&15|64]}${Pt._lut[t>>24&255]}-${Pt._lut[i&63|128]}${Pt._lut[i>>8&255]}-${Pt._lut[i>>16&255]}${Pt._lut[i>>24&255]}${Pt._lut[s&255]}${Pt._lut[s>>8&255]}${Pt._lut[s>>16&255]}${Pt._lut[s>>24&255]}`.toLowerCase()}static validate(e){if(!Pt._pattern.test(e))throw new Error(`${e} is not a valid UUID v4.
1
+ "use strict";var Wd=Object.defineProperty;var jd=(r,e,t)=>e in r?Wd(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var y=(r,e,t)=>(jd(r,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("three"),_c=require("@thatopen/fragments"),Xd=require("web-ifc");function da(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const D=da(F),We=da(_c),tt=da(Xd),Tc=0,Zd=1,qd=2,$a=2,to=1.25,Va=1,$n=6*4+4+4,Nr=65535,Qd=Math.pow(2,-24),eo=Symbol("SKIP_GENERATION");function Kd(r){return r.index?r.index.count:r.attributes.position.count}function Ji(r){return Kd(r)/3}function Jd(r,e=ArrayBuffer){return r>65535?new Uint32Array(new e(4*r)):new Uint16Array(new e(2*r))}function tu(r,e){if(!r.index){const t=r.attributes.position.count,i=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,s=Jd(t,i);r.setIndex(new F.BufferAttribute(s,1));for(let n=0;n<t;n++)s[n]=n}}function vc(r){const e=Ji(r),t=r.drawRange,i=t.start/3,s=(t.start+t.count)/3,n=Math.max(0,i),o=Math.min(e,s)-n;return[{offset:Math.floor(n),count:Math.floor(o)}]}function wc(r){if(!r.groups||!r.groups.length)return vc(r);const e=[],t=new Set,i=r.drawRange,s=i.start/3,n=(i.start+i.count)/3;for(const a of r.groups){const l=a.start/3,c=(a.start+a.count)/3;t.add(Math.max(s,l)),t.add(Math.min(n,c))}const o=Array.from(t.values()).sort((a,l)=>a-l);for(let a=0;a<o.length-1;a++){const l=o[a],c=o[a+1];e.push({offset:Math.floor(l),count:Math.floor(c-l)})}return e}function eu(r){if(r.groups.length===0)return!1;const e=Ji(r),t=wc(r).sort((n,o)=>n.offset-o.offset),i=t[t.length-1];i.count=Math.min(e-i.offset,i.count);let s=0;return t.forEach(({count:n})=>s+=n),e!==s}function Ft(r,e,t){return t.min.x=e[r],t.min.y=e[r+1],t.min.z=e[r+2],t.max.x=e[r+3],t.max.y=e[r+4],t.max.z=e[r+5],t}function iu(r){r[0]=r[1]=r[2]=1/0,r[3]=r[4]=r[5]=-1/0}function Ga(r){let e=-1,t=-1/0;for(let i=0;i<3;i++){const s=r[i+3]-r[i];s>t&&(t=s,e=i)}return e}function Ha(r,e){e.set(r)}function Ya(r,e,t){let i,s;for(let n=0;n<3;n++){const o=n+3;i=r[n],s=e[n],t[n]=i<s?i:s,i=r[o],s=e[o],t[o]=i>s?i:s}}function pn(r,e,t){for(let i=0;i<3;i++){const s=e[r+2*i],n=e[r+2*i+1],o=s-n,a=s+n;o<t[i]&&(t[i]=o),a>t[i+3]&&(t[i+3]=a)}}function us(r){const e=r[3]-r[0],t=r[4]-r[1],i=r[5]-r[2];return 2*(e*t+t*i+i*e)}function io(r,e,t,i,s=null){let n=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,h=-1/0,d=1/0,u=1/0,f=1/0,p=-1/0,m=-1/0,E=-1/0;const g=s!==null;for(let I=e*6,T=(e+t)*6;I<T;I+=6){const b=r[I+0],v=r[I+1],A=b-v,S=b+v;A<n&&(n=A),S>l&&(l=S),g&&b<d&&(d=b),g&&b>p&&(p=b);const N=r[I+2],R=r[I+3],P=N-R,M=N+R;P<o&&(o=P),M>c&&(c=M),g&&N<u&&(u=N),g&&N>m&&(m=N);const w=r[I+4],L=r[I+5],C=w-L,U=w+L;C<a&&(a=C),U>h&&(h=U),g&&w<f&&(f=w),g&&w>E&&(E=w)}i[0]=n,i[1]=o,i[2]=a,i[3]=l,i[4]=c,i[5]=h,g&&(s[0]=d,s[1]=u,s[2]=f,s[3]=p,s[4]=m,s[5]=E)}function su(r,e,t,i){let s=1/0,n=1/0,o=1/0,a=-1/0,l=-1/0,c=-1/0;for(let h=e*6,d=(e+t)*6;h<d;h+=6){const u=r[h+0];u<s&&(s=u),u>a&&(a=u);const f=r[h+2];f<n&&(n=f),f>l&&(l=f);const p=r[h+4];p<o&&(o=p),p>c&&(c=p)}i[0]=s,i[1]=n,i[2]=o,i[3]=a,i[4]=l,i[5]=c}function nu(r,e){iu(e);const t=r.attributes.position,i=r.index?r.index.array:null,s=Ji(r),n=new Float32Array(s*6),o=t.normalized,a=t.array,l=t.offset||0;let c=3;t.isInterleavedBufferAttribute&&(c=t.data.stride);const h=["getX","getY","getZ"];for(let d=0;d<s;d++){const u=d*3,f=d*6;let p=u+0,m=u+1,E=u+2;i&&(p=i[p],m=i[m],E=i[E]),o||(p=p*c+l,m=m*c+l,E=E*c+l);for(let g=0;g<3;g++){let I,T,b;o?(I=t[h[g]](p),T=t[h[g]](m),b=t[h[g]](E)):(I=a[p+g],T=a[m+g],b=a[E+g]);let v=I;T<v&&(v=T),b<v&&(v=b);let A=I;T>A&&(A=T),b>A&&(A=b);const S=(A-v)/2,N=g*2;n[f+N+0]=v+S,n[f+N+1]=S+(Math.abs(v)+S)*Qd,v<e[g]&&(e[g]=v),A>e[g+3]&&(e[g+3]=A)}}return n}const Fe=32,ru=(r,e)=>r.candidate-e.candidate,ke=new Array(Fe).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),mn=new Float32Array(6);function ou(r,e,t,i,s,n){let o=-1,a=0;if(n===Tc)o=Ga(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(n===Zd)o=Ga(r),o!==-1&&(a=au(t,i,s,o));else if(n===qd){const l=us(r);let c=to*s;const h=i*6,d=(i+s)*6;for(let u=0;u<3;u++){const f=e[u],E=(e[u+3]-f)/Fe;if(s<Fe/4){const g=[...ke];g.length=s;let I=0;for(let b=h;b<d;b+=6,I++){const v=g[I];v.candidate=t[b+2*u],v.count=0;const{bounds:A,leftCacheBounds:S,rightCacheBounds:N}=v;for(let R=0;R<3;R++)N[R]=1/0,N[R+3]=-1/0,S[R]=1/0,S[R+3]=-1/0,A[R]=1/0,A[R+3]=-1/0;pn(b,t,A)}g.sort(ru);let T=s;for(let b=0;b<T;b++){const v=g[b];for(;b+1<T&&g[b+1].candidate===v.candidate;)g.splice(b+1,1),T--}for(let b=h;b<d;b+=6){const v=t[b+2*u];for(let A=0;A<T;A++){const S=g[A];v>=S.candidate?pn(b,t,S.rightCacheBounds):(pn(b,t,S.leftCacheBounds),S.count++)}}for(let b=0;b<T;b++){const v=g[b],A=v.count,S=s-v.count,N=v.leftCacheBounds,R=v.rightCacheBounds;let P=0;A!==0&&(P=us(N)/l);let M=0;S!==0&&(M=us(R)/l);const w=Va+to*(P*A+M*S);w<c&&(o=u,c=w,a=v.candidate)}}else{for(let T=0;T<Fe;T++){const b=ke[T];b.count=0,b.candidate=f+E+T*E;const v=b.bounds;for(let A=0;A<3;A++)v[A]=1/0,v[A+3]=-1/0}for(let T=h;T<d;T+=6){let A=~~((t[T+2*u]-f)/E);A>=Fe&&(A=Fe-1);const S=ke[A];S.count++,pn(T,t,S.bounds)}const g=ke[Fe-1];Ha(g.bounds,g.rightCacheBounds);for(let T=Fe-2;T>=0;T--){const b=ke[T],v=ke[T+1];Ya(b.bounds,v.rightCacheBounds,b.rightCacheBounds)}let I=0;for(let T=0;T<Fe-1;T++){const b=ke[T],v=b.count,A=b.bounds,N=ke[T+1].rightCacheBounds;v!==0&&(I===0?Ha(A,mn):Ya(A,mn,mn)),I+=v;let R=0,P=0;I!==0&&(R=us(mn)/l);const M=s-I;M!==0&&(P=us(N)/l);const w=Va+to*(R*I+P*M);w<c&&(o=u,c=w,a=b.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${n} used.`);return{axis:o,pos:a}}function au(r,e,t,i){let s=0;for(let n=e,o=e+t;n<o;n++)s+=r[n*6+i*2];return s/t}class gn{constructor(){}}function lu(r,e,t,i,s,n){let o=i,a=i+s-1;const l=n.pos,c=n.axis*2;for(;;){for(;o<=a&&t[o*6+c]<l;)o++;for(;o<=a&&t[a*6+c]>=l;)a--;if(o<a){for(let h=0;h<3;h++){let d=e[o*3+h];e[o*3+h]=e[a*3+h],e[a*3+h]=d}for(let h=0;h<6;h++){let d=t[o*6+h];t[o*6+h]=t[a*6+h],t[a*6+h]=d}o++,a--}else return o}}function cu(r,e,t,i,s,n){let o=i,a=i+s-1;const l=n.pos,c=n.axis*2;for(;;){for(;o<=a&&t[o*6+c]<l;)o++;for(;o<=a&&t[a*6+c]>=l;)a--;if(o<a){let h=r[o];r[o]=r[a],r[a]=h;for(let d=0;d<6;d++){let u=t[o*6+d];t[o*6+d]=t[a*6+d],t[a*6+d]=u}o++,a--}else return o}}function hu(r,e){const t=(r.index?r.index.count:r.attributes.position.count)/3,i=t>2**16,s=i?4:2,n=e?new SharedArrayBuffer(t*s):new ArrayBuffer(t*s),o=i?new Uint32Array(n):new Uint16Array(n);for(let a=0,l=o.length;a<l;a++)o[a]=a;return o}function du(r,e){const t=r.geometry,i=t.index?t.index.array:null,s=e.maxDepth,n=e.verbose,o=e.maxLeafTris,a=e.strategy,l=e.onProgress,c=Ji(t),h=r._indirectBuffer;let d=!1;const u=new Float32Array(6),f=new Float32Array(6),p=nu(t,u),m=e.indirect?cu:lu,E=[],g=e.indirect?vc(t):wc(t);if(g.length===1){const b=g[0],v=new gn;v.boundingData=u,su(p,b.offset,b.count,f),T(v,b.offset,b.count,f),E.push(v)}else for(let b of g){const v=new gn;v.boundingData=new Float32Array(6),io(p,b.offset,b.count,v.boundingData,f),T(v,b.offset,b.count,f),E.push(v)}return E;function I(b){l&&l(b/c)}function T(b,v,A,S=null,N=0){if(!d&&N>=s&&(d=!0,n&&(console.warn(`MeshBVH: Max depth of ${s} reached when generating BVH. Consider increasing maxDepth.`),console.warn(t))),A<=o||N>=s)return I(v+A),b.offset=v,b.count=A,b;const R=ou(b.boundingData,S,p,v,A,a);if(R.axis===-1)return I(v+A),b.offset=v,b.count=A,b;const P=m(h,i,p,v,A,R);if(P===v||P===v+A)I(v+A),b.offset=v,b.count=A;else{b.splitAxis=R.axis;const M=new gn,w=v,L=P-v;b.left=M,M.boundingData=new Float32Array(6),io(p,w,L,M.boundingData,f),T(M,w,L,f,N+1);const C=new gn,U=P,q=A-L;b.right=C,C.boundingData=new Float32Array(6),io(p,U,q,C.boundingData,f),T(C,U,q,f,N+1)}return b}}function uu(r,e){const t=r.geometry;e.indirect&&(r._indirectBuffer=hu(t,e.useSharedArrayBuffer),eu(t)&&!e.verbose&&console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),r._indirectBuffer||tu(t,e);const i=du(r,e);let s,n,o;const a=[],l=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let d=0;d<i.length;d++){const u=i[d];let f=c(u);const p=new l($n*f);s=new Float32Array(p),n=new Uint32Array(p),o=new Uint16Array(p),h(0,u),a.push(p)}r._roots=a;return;function c(d){return d.count?1:1+c(d.left)+c(d.right)}function h(d,u){const f=d/4,p=d/2,m=!!u.count,E=u.boundingData;for(let g=0;g<6;g++)s[f+g]=E[g];if(m){const g=u.offset,I=u.count;return n[f+6]=g,o[p+14]=I,o[p+15]=Nr,d+$n}else{const g=u.left,I=u.right,T=u.splitAxis;let b;if(b=h(d+$n,g),b/4>Math.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return n[f+6]=b/4,b=h(b,I),n[f+7]=T,b}}}class Ne{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let i=1/0,s=-1/0;for(let n=0,o=e.length;n<o;n++){const l=e[n][t];i=l<i?l:i,s=l>s?l:s}this.min=i,this.max=s}setFromPoints(e,t){let i=1/0,s=-1/0;for(let n=0,o=t.length;n<o;n++){const a=t[n],l=e.dot(a);i=l<i?l:i,s=l>s?l:s}this.min=i,this.max=s}isSeparated(e){return this.min>e.max||e.min>this.max}}Ne.prototype.setFromBox=function(){const r=new F.Vector3;return function(t,i){const s=i.min,n=i.max;let o=1/0,a=-1/0;for(let l=0;l<=1;l++)for(let c=0;c<=1;c++)for(let h=0;h<=1;h++){r.x=s.x*l+n.x*(1-l),r.y=s.y*c+n.y*(1-c),r.z=s.z*h+n.z*(1-h);const d=t.dot(r);o=Math.min(d,o),a=Math.max(d,a)}this.min=o,this.max=a}}();const fu=function(){const r=new F.Vector3,e=new F.Vector3,t=new F.Vector3;return function(s,n,o){const a=s.start,l=r,c=n.start,h=e;t.subVectors(a,c),r.subVectors(s.end,s.start),e.subVectors(n.end,n.start);const d=t.dot(h),u=h.dot(l),f=h.dot(h),p=t.dot(l),E=l.dot(l)*f-u*u;let g,I;E!==0?g=(d*u-p*f)/E:g=0,I=(d+g*u)/f,o.x=g,o.y=I}}(),ua=function(){const r=new F.Vector2,e=new F.Vector3,t=new F.Vector3;return function(s,n,o,a){fu(s,n,r);let l=r.x,c=r.y;if(l>=0&&l<=1&&c>=0&&c<=1){s.at(l,o),n.at(c,a);return}else if(l>=0&&l<=1){c<0?n.at(0,a):n.at(1,a),s.closestPointToPoint(a,!0,o);return}else if(c>=0&&c<=1){l<0?s.at(0,o):s.at(1,o),n.closestPointToPoint(o,!0,a);return}else{let h;l<0?h=s.start:h=s.end;let d;c<0?d=n.start:d=n.end;const u=e,f=t;if(s.closestPointToPoint(d,!0,e),n.closestPointToPoint(h,!0,t),u.distanceToSquared(d)<=f.distanceToSquared(h)){o.copy(u),a.copy(d);return}else{o.copy(h),a.copy(f);return}}}}(),pu=function(){const r=new F.Vector3,e=new F.Vector3,t=new F.Plane,i=new F.Line3;return function(n,o){const{radius:a,center:l}=n,{a:c,b:h,c:d}=o;if(i.start=c,i.end=h,i.closestPointToPoint(l,!0,r).distanceTo(l)<=a||(i.start=c,i.end=d,i.closestPointToPoint(l,!0,r).distanceTo(l)<=a)||(i.start=h,i.end=d,i.closestPointToPoint(l,!0,r).distanceTo(l)<=a))return!0;const m=o.getPlane(t);if(Math.abs(m.distanceToPoint(l))<=a){const g=m.projectPoint(l,e);if(o.containsPoint(g))return!0}return!1}}(),mu=1e-15;function so(r){return Math.abs(r)<mu}class pe extends F.Triangle{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new F.Vector3),this.satBounds=new Array(4).fill().map(()=>new Ne),this.points=[this.a,this.b,this.c],this.sphere=new F.Sphere,this.plane=new F.Plane,this.needsUpdate=!0}intersectsSphere(e){return pu(e,this)}update(){const e=this.a,t=this.b,i=this.c,s=this.points,n=this.satAxes,o=this.satBounds,a=n[0],l=o[0];this.getNormal(a),l.setFromPoints(a,s);const c=n[1],h=o[1];c.subVectors(e,t),h.setFromPoints(c,s);const d=n[2],u=o[2];d.subVectors(t,i),u.setFromPoints(d,s);const f=n[3],p=o[3];f.subVectors(i,e),p.setFromPoints(f,s),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}pe.prototype.closestPointToSegment=function(){const r=new F.Vector3,e=new F.Vector3,t=new F.Line3;return function(s,n=null,o=null){const{start:a,end:l}=s,c=this.points;let h,d=1/0;for(let u=0;u<3;u++){const f=(u+1)%3;t.start.copy(c[u]),t.end.copy(c[f]),ua(t,s,r,e),h=r.distanceToSquared(e),h<d&&(d=h,n&&n.copy(r),o&&o.copy(e))}return this.closestPointToPoint(a,r),h=a.distanceToSquared(r),h<d&&(d=h,n&&n.copy(r),o&&o.copy(a)),this.closestPointToPoint(l,r),h=l.distanceToSquared(r),h<d&&(d=h,n&&n.copy(r),o&&o.copy(l)),Math.sqrt(d)}}();pe.prototype.intersectsTriangle=function(){const r=new pe,e=new Array(3),t=new Array(3),i=new Ne,s=new Ne,n=new F.Vector3,o=new F.Vector3,a=new F.Vector3,l=new F.Vector3,c=new F.Vector3,h=new F.Line3,d=new F.Line3,u=new F.Line3,f=new F.Vector3;function p(m,E,g){const I=m.points;let T=0,b=-1;for(let v=0;v<3;v++){const{start:A,end:S}=h;A.copy(I[v]),S.copy(I[(v+1)%3]),h.delta(o);const N=so(E.distanceToPoint(A));if(so(E.normal.dot(o))&&N){g.copy(h),T=2;break}const R=E.intersectLine(h,f);if(!R&&N&&f.copy(A),(R||N)&&!so(f.distanceTo(S))){if(T<=1)(T===1?g.start:g.end).copy(f),N&&(b=T);else if(T>=2){(b===1?g.start:g.end).copy(f),T=2;break}if(T++,T===2&&b===-1)break}}return T}return function(E,g=null,I=!1){this.needsUpdate&&this.update(),E.isExtendedTriangle?E.needsUpdate&&E.update():(r.copy(E),r.update(),E=r);const T=this.plane,b=E.plane;if(Math.abs(T.normal.dot(b.normal))>1-1e-10){const v=this.satBounds,A=this.satAxes;t[0]=E.a,t[1]=E.b,t[2]=E.c;for(let R=0;R<4;R++){const P=v[R],M=A[R];if(i.setFromPoints(M,t),P.isSeparated(i))return!1}const S=E.satBounds,N=E.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let R=0;R<4;R++){const P=S[R],M=N[R];if(i.setFromPoints(M,e),P.isSeparated(i))return!1}for(let R=0;R<4;R++){const P=A[R];for(let M=0;M<4;M++){const w=N[M];if(n.crossVectors(P,w),i.setFromPoints(n,e),s.setFromPoints(n,t),i.isSeparated(s))return!1}}return g&&(I||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),g.start.set(0,0,0),g.end.set(0,0,0)),!0}else{const v=p(this,b,d);if(v===1&&E.containsPoint(d.end))return g&&(g.start.copy(d.end),g.end.copy(d.end)),!0;if(v!==2)return!1;const A=p(E,T,u);if(A===1&&this.containsPoint(u.end))return g&&(g.start.copy(u.end),g.end.copy(u.end)),!0;if(A!==2)return!1;if(d.delta(a),u.delta(l),a.dot(l)<0){let L=u.start;u.start=u.end,u.end=L}const S=d.start.dot(a),N=d.end.dot(a),R=u.start.dot(a),P=u.end.dot(a),M=N<R,w=S<P;return S!==P&&R!==N&&M===w?!1:(g&&(c.subVectors(d.start,u.start),c.dot(a)>0?g.start.copy(d.start):g.start.copy(u.start),c.subVectors(d.end,u.end),c.dot(a)<0?g.end.copy(d.end):g.end.copy(u.end)),!0)}}}();pe.prototype.distanceToPoint=function(){const r=new F.Vector3;return function(t){return this.closestPointToPoint(t,r),t.distanceTo(r)}}();pe.prototype.distanceToTriangle=function(){const r=new F.Vector3,e=new F.Vector3,t=["a","b","c"],i=new F.Line3,s=new F.Line3;return function(o,a=null,l=null){const c=a||l?i:null;if(this.intersectsTriangle(o,c))return(a||l)&&(a&&c.getCenter(a),l&&c.getCenter(l)),0;let h=1/0;for(let d=0;d<3;d++){let u;const f=t[d],p=o[f];this.closestPointToPoint(p,r),u=p.distanceToSquared(r),u<h&&(h=u,a&&a.copy(r),l&&l.copy(p));const m=this[f];o.closestPointToPoint(m,r),u=m.distanceToSquared(r),u<h&&(h=u,a&&a.copy(m),l&&l.copy(r))}for(let d=0;d<3;d++){const u=t[d],f=t[(d+1)%3];i.set(this[u],this[f]);for(let p=0;p<3;p++){const m=t[p],E=t[(p+1)%3];s.set(o[m],o[E]),ua(i,s,r,e);const g=r.distanceToSquared(e);g<h&&(h=g,a&&a.copy(r),l&&l.copy(e))}}return Math.sqrt(h)}}();class Wt{constructor(e,t,i){this.isOrientedBox=!0,this.min=new F.Vector3,this.max=new F.Vector3,this.matrix=new F.Matrix4,this.invMatrix=new F.Matrix4,this.points=new Array(8).fill().map(()=>new F.Vector3),this.satAxes=new Array(3).fill().map(()=>new F.Vector3),this.satBounds=new Array(3).fill().map(()=>new Ne),this.alignedSatBounds=new Array(3).fill().map(()=>new Ne),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),i&&this.matrix.copy(i)}set(e,t,i){this.min.copy(e),this.max.copy(t),this.matrix.copy(i),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}Wt.prototype.update=function(){return function(){const e=this.matrix,t=this.min,i=this.max,s=this.points;for(let c=0;c<=1;c++)for(let h=0;h<=1;h++)for(let d=0;d<=1;d++){const u=1*c|2*h|4*d,f=s[u];f.x=c?i.x:t.x,f.y=h?i.y:t.y,f.z=d?i.z:t.z,f.applyMatrix4(e)}const n=this.satBounds,o=this.satAxes,a=s[0];for(let c=0;c<3;c++){const h=o[c],d=n[c],u=1<<c,f=s[u];h.subVectors(a,f),d.setFromPoints(h,s)}const l=this.alignedSatBounds;l[0].setFromPointsField(s,"x"),l[1].setFromPointsField(s,"y"),l[2].setFromPointsField(s,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}}();Wt.prototype.intersectsBox=function(){const r=new Ne;return function(t){this.needsUpdate&&this.update();const i=t.min,s=t.max,n=this.satBounds,o=this.satAxes,a=this.alignedSatBounds;if(r.min=i.x,r.max=s.x,a[0].isSeparated(r)||(r.min=i.y,r.max=s.y,a[1].isSeparated(r))||(r.min=i.z,r.max=s.z,a[2].isSeparated(r)))return!1;for(let l=0;l<3;l++){const c=o[l],h=n[l];if(r.setFromBox(c,t),h.isSeparated(r))return!1}return!0}}();Wt.prototype.intersectsTriangle=function(){const r=new pe,e=new Array(3),t=new Ne,i=new Ne,s=new F.Vector3;return function(o){this.needsUpdate&&this.update(),o.isExtendedTriangle?o.needsUpdate&&o.update():(r.copy(o),r.update(),o=r);const a=this.satBounds,l=this.satAxes;e[0]=o.a,e[1]=o.b,e[2]=o.c;for(let u=0;u<3;u++){const f=a[u],p=l[u];if(t.setFromPoints(p,e),f.isSeparated(t))return!1}const c=o.satBounds,h=o.satAxes,d=this.points;for(let u=0;u<3;u++){const f=c[u],p=h[u];if(t.setFromPoints(p,d),f.isSeparated(t))return!1}for(let u=0;u<3;u++){const f=l[u];for(let p=0;p<4;p++){const m=h[p];if(s.crossVectors(f,m),t.setFromPoints(s,e),i.setFromPoints(s,d),t.isSeparated(i))return!1}}return!0}}();Wt.prototype.closestPointToPoint=function(){return function(e,t){return this.needsUpdate&&this.update(),t.copy(e).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),t}}();Wt.prototype.distanceToPoint=function(){const r=new F.Vector3;return function(t){return this.closestPointToPoint(t,r),t.distanceTo(r)}}();Wt.prototype.distanceToBox=function(){const r=["x","y","z"],e=new Array(12).fill().map(()=>new F.Line3),t=new Array(12).fill().map(()=>new F.Line3),i=new F.Vector3,s=new F.Vector3;return function(o,a=0,l=null,c=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(l||c)&&(o.getCenter(s),this.closestPointToPoint(s,i),o.closestPointToPoint(i,s),l&&l.copy(i),c&&c.copy(s)),0;const h=a*a,d=o.min,u=o.max,f=this.points;let p=1/0;for(let E=0;E<8;E++){const g=f[E];s.copy(g).clamp(d,u);const I=g.distanceToSquared(s);if(I<p&&(p=I,l&&l.copy(g),c&&c.copy(s),I<h))return Math.sqrt(I)}let m=0;for(let E=0;E<3;E++)for(let g=0;g<=1;g++)for(let I=0;I<=1;I++){const T=(E+1)%3,b=(E+2)%3,v=g<<T|I<<b,A=1<<E|g<<T|I<<b,S=f[v],N=f[A];e[m].set(S,N);const P=r[E],M=r[T],w=r[b],L=t[m],C=L.start,U=L.end;C[P]=d[P],C[M]=g?d[M]:u[M],C[w]=I?d[w]:u[M],U[P]=u[P],U[M]=g?d[M]:u[M],U[w]=I?d[w]:u[M],m++}for(let E=0;E<=1;E++)for(let g=0;g<=1;g++)for(let I=0;I<=1;I++){s.x=E?u.x:d.x,s.y=g?u.y:d.y,s.z=I?u.z:d.z,this.closestPointToPoint(s,i);const T=s.distanceToSquared(i);if(T<p&&(p=T,l&&l.copy(i),c&&c.copy(s),T<h))return Math.sqrt(T)}for(let E=0;E<12;E++){const g=e[E];for(let I=0;I<12;I++){const T=t[I];ua(g,T,i,s);const b=i.distanceToSquared(s);if(b<p&&(p=b,l&&l.copy(i),c&&c.copy(s),b<h))return Math.sqrt(b)}}return Math.sqrt(p)}}();class fa{constructor(e){this._getNewPrimitive=e,this._primitives=[]}getPrimitive(){const e=this._primitives;return e.length===0?this._getNewPrimitive():e.pop()}releasePrimitive(e){this._primitives.push(e)}}class gu extends fa{constructor(){super(()=>new pe)}}const ie=new gu;function Xt(r,e){return e[r+15]===65535}function Zt(r,e){return e[r+6]}function se(r,e){return e[r+14]}function ne(r){return r+8}function re(r,e){return e[r+6]}function Ac(r,e){return e[r+7]}class Eu{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const e=[];let t=null;this.setBuffer=i=>{t&&e.push(t),t=i,this.float32Array=new Float32Array(i),this.uint16Array=new Uint16Array(i),this.uint32Array=new Uint32Array(i)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,e.length!==0&&this.setBuffer(e.pop())}}}const At=new Eu;let Ye,zi;const wi=[],En=new fa(()=>new F.Box3);function bu(r,e,t,i,s,n){Ye=En.getPrimitive(),zi=En.getPrimitive(),wi.push(Ye,zi),At.setBuffer(r._roots[e]);const o=Po(0,r.geometry,t,i,s,n);At.clearBuffer(),En.releasePrimitive(Ye),En.releasePrimitive(zi),wi.pop(),wi.pop();const a=wi.length;return a>0&&(zi=wi[a-1],Ye=wi[a-2]),o}function Po(r,e,t,i,s=null,n=0,o=0){const{float32Array:a,uint16Array:l,uint32Array:c}=At;let h=r*2;if(Xt(h,l)){const u=Zt(r,c),f=se(h,l);return Ft(r,a,Ye),i(u,f,!1,o,n+r,Ye)}else{let P=function(w){const{uint16Array:L,uint32Array:C}=At;let U=w*2;for(;!Xt(U,L);)w=ne(w),U=w*2;return Zt(w,C)},M=function(w){const{uint16Array:L,uint32Array:C}=At;let U=w*2;for(;!Xt(U,L);)w=re(w,C),U=w*2;return Zt(w,C)+se(U,L)};const u=ne(r),f=re(r,c);let p=u,m=f,E,g,I,T;if(s&&(I=Ye,T=zi,Ft(p,a,I),Ft(m,a,T),E=s(I),g=s(T),g<E)){p=f,m=u;const w=E;E=g,g=w,I=T}I||(I=Ye,Ft(p,a,I));const b=Xt(p*2,l),v=t(I,b,E,o+1,n+p);let A;if(v===$a){const w=P(p),C=M(p)-w;A=i(w,C,!0,o+1,n+p,I)}else A=v&&Po(p,e,t,i,s,n,o+1);if(A)return!0;T=zi,Ft(m,a,T);const S=Xt(m*2,l),N=t(T,S,g,o+1,n+m);let R;if(N===$a){const w=P(m),C=M(m)-w;R=i(w,C,!0,o+1,n+m,T)}else R=N&&Po(m,e,t,i,s,n,o+1);return!!R}}const fs=new F.Vector3,no=new F.Vector3;function Iu(r,e,t={},i=0,s=1/0){const n=i*i,o=s*s;let a=1/0,l=null;if(r.shapecast({boundsTraverseOrder:h=>(fs.copy(e).clamp(h.min,h.max),fs.distanceToSquared(e)),intersectsBounds:(h,d,u)=>u<a&&u<o,intersectsTriangle:(h,d)=>{h.closestPointToPoint(e,fs);const u=e.distanceToSquared(fs);return u<a&&(no.copy(fs),a=u,l=d),u<n}}),a===1/0)return null;const c=Math.sqrt(a);return t.point?t.point.copy(no):t.point=no.clone(),t.distance=c,t.faceIndex=l,t}const Ai=new F.Vector3,Ri=new F.Vector3,Si=new F.Vector3,bn=new F.Vector2,In=new F.Vector2,Cn=new F.Vector2,Wa=new F.Vector3,ja=new F.Vector3,Xa=new F.Vector3,yn=new F.Vector3;function Cu(r,e,t,i,s,n){let o;return n===F.BackSide?o=r.intersectTriangle(i,t,e,!0,s):o=r.intersectTriangle(e,t,i,n!==F.DoubleSide,s),o===null?null:{distance:r.origin.distanceTo(s),point:s.clone()}}function yu(r,e,t,i,s,n,o,a,l){Ai.fromBufferAttribute(e,n),Ri.fromBufferAttribute(e,o),Si.fromBufferAttribute(e,a);const c=Cu(r,Ai,Ri,Si,yn,l);if(c){i&&(bn.fromBufferAttribute(i,n),In.fromBufferAttribute(i,o),Cn.fromBufferAttribute(i,a),c.uv=F.Triangle.getInterpolation(yn,Ai,Ri,Si,bn,In,Cn,new F.Vector2)),s&&(bn.fromBufferAttribute(s,n),In.fromBufferAttribute(s,o),Cn.fromBufferAttribute(s,a),c.uv1=F.Triangle.getInterpolation(yn,Ai,Ri,Si,bn,In,Cn,new F.Vector2)),t&&(Wa.fromBufferAttribute(t,n),ja.fromBufferAttribute(t,o),Xa.fromBufferAttribute(t,a),c.normal=F.Triangle.getInterpolation(yn,Ai,Ri,Si,Wa,ja,Xa,new F.Vector3),c.normal.dot(r.direction)>0&&c.normal.multiplyScalar(-1));const h={a:n,b:o,c:a,normal:new F.Vector3,materialIndex:0};F.Triangle.getNormal(Ai,Ri,Si,h.normal),c.face=h,c.faceIndex=n}return c}function Pr(r,e,t,i,s){const n=i*3;let o=n+0,a=n+1,l=n+2;const c=r.index;r.index&&(o=c.getX(o),a=c.getX(a),l=c.getX(l));const{position:h,normal:d,uv:u,uv1:f}=r.attributes,p=yu(t,h,d,u,f,o,a,l,e);return p?(p.faceIndex=i,s&&s.push(p),p):null}function Ut(r,e,t,i){const s=r.a,n=r.b,o=r.c;let a=e,l=e+1,c=e+2;t&&(a=t.getX(a),l=t.getX(l),c=t.getX(c)),s.x=i.getX(a),s.y=i.getY(a),s.z=i.getZ(a),n.x=i.getX(l),n.y=i.getY(l),n.z=i.getZ(l),o.x=i.getX(c),o.y=i.getY(c),o.z=i.getZ(c)}function _u(r,e,t,i,s,n){const{geometry:o,_indirectBuffer:a}=r;for(let l=i,c=i+s;l<c;l++)Pr(o,e,t,l,n)}function Tu(r,e,t,i,s){const{geometry:n,_indirectBuffer:o}=r;let a=1/0,l=null;for(let c=i,h=i+s;c<h;c++){let d;d=Pr(n,e,t,c),d&&d.distance<a&&(l=d,a=d.distance)}return l}function vu(r,e,t,i,s,n,o){const{geometry:a}=t,{index:l}=a,c=a.attributes.position;for(let h=r,d=e+r;h<d;h++){let u;if(u=h,Ut(o,u*3,l,c),o.needsUpdate=!0,i(o,u,s,n))return!0}return!1}function wu(r,e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=r.geometry,i=t.index?t.index.array:null,s=t.attributes.position;let n,o,a,l,c=0;const h=r._roots;for(let u=0,f=h.length;u<f;u++)n=h[u],o=new Uint32Array(n),a=new Uint16Array(n),l=new Float32Array(n),d(0,c),c+=n.byteLength;function d(u,f,p=!1){const m=u*2;if(a[m+15]===Nr){const g=o[u+6],I=a[m+14];let T=1/0,b=1/0,v=1/0,A=-1/0,S=-1/0,N=-1/0;for(let R=3*g,P=3*(g+I);R<P;R++){let M=i[R];const w=s.getX(M),L=s.getY(M),C=s.getZ(M);w<T&&(T=w),w>A&&(A=w),L<b&&(b=L),L>S&&(S=L),C<v&&(v=C),C>N&&(N=C)}return l[u+0]!==T||l[u+1]!==b||l[u+2]!==v||l[u+3]!==A||l[u+4]!==S||l[u+5]!==N?(l[u+0]=T,l[u+1]=b,l[u+2]=v,l[u+3]=A,l[u+4]=S,l[u+5]=N,!0):!1}else{const g=u+8,I=o[u+6],T=g+f,b=I+f;let v=p,A=!1,S=!1;e?v||(A=e.has(T),S=e.has(b),v=!A&&!S):(A=!0,S=!0);const N=v||A,R=v||S;let P=!1;N&&(P=d(g,f,v));let M=!1;R&&(M=d(I,f,v));const w=P||M;if(w)for(let L=0;L<3;L++){const C=g+L,U=I+L,q=l[C],G=l[C+3],st=l[U],Y=l[U+3];l[u+L]=q<st?q:st,l[u+L+3]=G>Y?G:Y}return w}}}const Za=new F.Box3;function Xe(r,e,t,i){return Ft(r,e,Za),t.intersectBox(Za,i)}function Au(r,e,t,i,s,n){const{geometry:o,_indirectBuffer:a}=r;for(let l=i,c=i+s;l<c;l++){let h=a?a[l]:l;Pr(o,e,t,h,n)}}function Ru(r,e,t,i,s){const{geometry:n,_indirectBuffer:o}=r;let a=1/0,l=null;for(let c=i,h=i+s;c<h;c++){let d;d=Pr(n,e,t,o?o[c]:c),d&&d.distance<a&&(l=d,a=d.distance)}return l}function Su(r,e,t,i,s,n,o){const{geometry:a}=t,{index:l}=a,c=a.attributes.position;for(let h=r,d=e+r;h<d;h++){let u;if(u=t.resolveTriangleIndex(h),Ut(o,u*3,l,c),o.needsUpdate=!0,i(o,u,s,n))return!0}return!1}const qa=new F.Vector3;function Fu(r,e,t,i,s){At.setBuffer(r._roots[e]),Lo(0,r,t,i,s),At.clearBuffer()}function Lo(r,e,t,i,s){const{float32Array:n,uint16Array:o,uint32Array:a}=At,l=r*2;if(Xt(l,o)){const h=Zt(r,a),d=se(l,o);_u(e,t,i,h,d,s)}else{const h=ne(r);Xe(h,n,i,qa)&&Lo(h,e,t,i,s);const d=re(r,a);Xe(d,n,i,qa)&&Lo(d,e,t,i,s)}}const Qa=new F.Vector3,Ou=["x","y","z"];function xu(r,e,t,i){At.setBuffer(r._roots[e]);const s=Mo(0,r,t,i);return At.clearBuffer(),s}function Mo(r,e,t,i){const{float32Array:s,uint16Array:n,uint32Array:o}=At;let a=r*2;if(Xt(a,n)){const c=Zt(r,o),h=se(a,n);return Tu(e,t,i,c,h)}else{const c=Ac(r,o),h=Ou[c],u=i.direction[h]>=0;let f,p;u?(f=ne(r),p=re(r,o)):(f=re(r,o),p=ne(r));const E=Xe(f,s,i,Qa)?Mo(f,e,t,i):null;if(E){const T=E.point[h];if(u?T<=s[p+c]:T>=s[p+c+3])return E}const I=Xe(p,s,i,Qa)?Mo(p,e,t,i):null;return E&&I?E.distance<=I.distance?E:I:E||I||null}}const _n=new F.Box3,Fi=new pe,Oi=new pe,ps=new F.Matrix4,Ka=new Wt,Tn=new Wt;function Nu(r,e,t,i){At.setBuffer(r._roots[e]);const s=Do(0,r,t,i);return At.clearBuffer(),s}function Do(r,e,t,i,s=null){const{float32Array:n,uint16Array:o,uint32Array:a}=At;let l=r*2;if(s===null&&(t.boundingBox||t.computeBoundingBox(),Ka.set(t.boundingBox.min,t.boundingBox.max,i),s=Ka),Xt(l,o)){const h=e.geometry,d=h.index,u=h.attributes.position,f=t.index,p=t.attributes.position,m=Zt(r,a),E=se(l,o);if(ps.copy(i).invert(),t.boundsTree)return Ft(r,n,Tn),Tn.matrix.copy(ps),Tn.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:I=>Tn.intersectsBox(I),intersectsTriangle:I=>{I.a.applyMatrix4(i),I.b.applyMatrix4(i),I.c.applyMatrix4(i),I.needsUpdate=!0;for(let T=m*3,b=(E+m)*3;T<b;T+=3)if(Ut(Oi,T,d,u),Oi.needsUpdate=!0,I.intersectsTriangle(Oi))return!0;return!1}});for(let g=m*3,I=(E+m)*3;g<I;g+=3){Ut(Fi,g,d,u),Fi.a.applyMatrix4(ps),Fi.b.applyMatrix4(ps),Fi.c.applyMatrix4(ps),Fi.needsUpdate=!0;for(let T=0,b=f.count;T<b;T+=3)if(Ut(Oi,T,f,p),Oi.needsUpdate=!0,Fi.intersectsTriangle(Oi))return!0}}else{const h=r+8,d=a[r+6];return Ft(h,n,_n),!!(s.intersectsBox(_n)&&Do(h,e,t,i,s)||(Ft(d,n,_n),s.intersectsBox(_n)&&Do(d,e,t,i,s)))}}const vn=new F.Matrix4,ro=new Wt,ms=new Wt,Pu=new F.Vector3,Lu=new F.Vector3,Mu=new F.Vector3,Du=new F.Vector3;function Uu(r,e,t,i={},s={},n=0,o=1/0){e.boundingBox||e.computeBoundingBox(),ro.set(e.boundingBox.min,e.boundingBox.max,t),ro.needsUpdate=!0;const a=r.geometry,l=a.attributes.position,c=a.index,h=e.attributes.position,d=e.index,u=ie.getPrimitive(),f=ie.getPrimitive();let p=Pu,m=Lu,E=null,g=null;s&&(E=Mu,g=Du);let I=1/0,T=null,b=null;return vn.copy(t).invert(),ms.matrix.copy(vn),r.shapecast({boundsTraverseOrder:v=>ro.distanceToBox(v),intersectsBounds:(v,A,S)=>S<I&&S<o?(A&&(ms.min.copy(v.min),ms.max.copy(v.max),ms.needsUpdate=!0),!0):!1,intersectsRange:(v,A)=>{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:N=>ms.distanceToBox(N),intersectsBounds:(N,R,P)=>P<I&&P<o,intersectsRange:(N,R)=>{for(let P=N,M=N+R;P<M;P++){Ut(f,3*P,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let w=v,L=v+A;w<L;w++){Ut(u,3*w,c,l),u.needsUpdate=!0;const C=u.distanceToTriangle(f,p,E);if(C<I&&(m.copy(p),g&&g.copy(E),I=C,T=w,b=P),C<n)return!0}}}});{const S=Ji(e);for(let N=0,R=S;N<R;N++){Ut(f,3*N,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let P=v,M=v+A;P<M;P++){Ut(u,3*P,c,l),u.needsUpdate=!0;const w=u.distanceToTriangle(f,p,E);if(w<I&&(m.copy(p),g&&g.copy(E),I=w,T=P,b=N),w<n)return!0}}}}}),ie.releasePrimitive(u),ie.releasePrimitive(f),I===1/0?null:(i.point?i.point.copy(m):i.point=m.clone(),i.distance=I,i.faceIndex=T,s&&(s.point?s.point.copy(g):s.point=g.clone(),s.point.applyMatrix4(vn),m.applyMatrix4(vn),s.distance=m.sub(s.point).length(),s.faceIndex=b),i)}function ku(r,e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=r.geometry,i=t.index?t.index.array:null,s=t.attributes.position;let n,o,a,l,c=0;const h=r._roots;for(let u=0,f=h.length;u<f;u++)n=h[u],o=new Uint32Array(n),a=new Uint16Array(n),l=new Float32Array(n),d(0,c),c+=n.byteLength;function d(u,f,p=!1){const m=u*2;if(a[m+15]===Nr){const g=o[u+6],I=a[m+14];let T=1/0,b=1/0,v=1/0,A=-1/0,S=-1/0,N=-1/0;for(let R=g,P=g+I;R<P;R++){const M=3*r.resolveTriangleIndex(R);for(let w=0;w<3;w++){let L=M+w;L=i?i[L]:L;const C=s.getX(L),U=s.getY(L),q=s.getZ(L);C<T&&(T=C),C>A&&(A=C),U<b&&(b=U),U>S&&(S=U),q<v&&(v=q),q>N&&(N=q)}}return l[u+0]!==T||l[u+1]!==b||l[u+2]!==v||l[u+3]!==A||l[u+4]!==S||l[u+5]!==N?(l[u+0]=T,l[u+1]=b,l[u+2]=v,l[u+3]=A,l[u+4]=S,l[u+5]=N,!0):!1}else{const g=u+8,I=o[u+6],T=g+f,b=I+f;let v=p,A=!1,S=!1;e?v||(A=e.has(T),S=e.has(b),v=!A&&!S):(A=!0,S=!0);const N=v||A,R=v||S;let P=!1;N&&(P=d(g,f,v));let M=!1;R&&(M=d(I,f,v));const w=P||M;if(w)for(let L=0;L<3;L++){const C=g+L,U=I+L,q=l[C],G=l[C+3],st=l[U],Y=l[U+3];l[u+L]=q<st?q:st,l[u+L+3]=G>Y?G:Y}return w}}}const Ja=new F.Vector3;function Bu(r,e,t,i,s){At.setBuffer(r._roots[e]),Uo(0,r,t,i,s),At.clearBuffer()}function Uo(r,e,t,i,s){const{float32Array:n,uint16Array:o,uint32Array:a}=At,l=r*2;if(Xt(l,o)){const h=Zt(r,a),d=se(l,o);Au(e,t,i,h,d,s)}else{const h=ne(r);Xe(h,n,i,Ja)&&Uo(h,e,t,i,s);const d=re(r,a);Xe(d,n,i,Ja)&&Uo(d,e,t,i,s)}}const tl=new F.Vector3,zu=["x","y","z"];function $u(r,e,t,i){At.setBuffer(r._roots[e]);const s=ko(0,r,t,i);return At.clearBuffer(),s}function ko(r,e,t,i){const{float32Array:s,uint16Array:n,uint32Array:o}=At;let a=r*2;if(Xt(a,n)){const c=Zt(r,o),h=se(a,n);return Ru(e,t,i,c,h)}else{const c=Ac(r,o),h=zu[c],u=i.direction[h]>=0;let f,p;u?(f=ne(r),p=re(r,o)):(f=re(r,o),p=ne(r));const E=Xe(f,s,i,tl)?ko(f,e,t,i):null;if(E){const T=E.point[h];if(u?T<=s[p+c]:T>=s[p+c+3])return E}const I=Xe(p,s,i,tl)?ko(p,e,t,i):null;return E&&I?E.distance<=I.distance?E:I:E||I||null}}const wn=new F.Box3,xi=new pe,Ni=new pe,gs=new F.Matrix4,el=new Wt,An=new Wt;function Vu(r,e,t,i){At.setBuffer(r._roots[e]);const s=Bo(0,r,t,i);return At.clearBuffer(),s}function Bo(r,e,t,i,s=null){const{float32Array:n,uint16Array:o,uint32Array:a}=At;let l=r*2;if(s===null&&(t.boundingBox||t.computeBoundingBox(),el.set(t.boundingBox.min,t.boundingBox.max,i),s=el),Xt(l,o)){const h=e.geometry,d=h.index,u=h.attributes.position,f=t.index,p=t.attributes.position,m=Zt(r,a),E=se(l,o);if(gs.copy(i).invert(),t.boundsTree)return Ft(r,n,An),An.matrix.copy(gs),An.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:I=>An.intersectsBox(I),intersectsTriangle:I=>{I.a.applyMatrix4(i),I.b.applyMatrix4(i),I.c.applyMatrix4(i),I.needsUpdate=!0;for(let T=m,b=E+m;T<b;T++)if(Ut(Ni,3*e.resolveTriangleIndex(T),d,u),Ni.needsUpdate=!0,I.intersectsTriangle(Ni))return!0;return!1}});for(let g=m,I=E+m;g<I;g++){const T=e.resolveTriangleIndex(g);Ut(xi,3*T,d,u),xi.a.applyMatrix4(gs),xi.b.applyMatrix4(gs),xi.c.applyMatrix4(gs),xi.needsUpdate=!0;for(let b=0,v=f.count;b<v;b+=3)if(Ut(Ni,b,f,p),Ni.needsUpdate=!0,xi.intersectsTriangle(Ni))return!0}}else{const h=r+8,d=a[r+6];return Ft(h,n,wn),!!(s.intersectsBox(wn)&&Bo(h,e,t,i,s)||(Ft(d,n,wn),s.intersectsBox(wn)&&Bo(d,e,t,i,s)))}}const Rn=new F.Matrix4,oo=new Wt,Es=new Wt,Gu=new F.Vector3,Hu=new F.Vector3,Yu=new F.Vector3,Wu=new F.Vector3;function ju(r,e,t,i={},s={},n=0,o=1/0){e.boundingBox||e.computeBoundingBox(),oo.set(e.boundingBox.min,e.boundingBox.max,t),oo.needsUpdate=!0;const a=r.geometry,l=a.attributes.position,c=a.index,h=e.attributes.position,d=e.index,u=ie.getPrimitive(),f=ie.getPrimitive();let p=Gu,m=Hu,E=null,g=null;s&&(E=Yu,g=Wu);let I=1/0,T=null,b=null;return Rn.copy(t).invert(),Es.matrix.copy(Rn),r.shapecast({boundsTraverseOrder:v=>oo.distanceToBox(v),intersectsBounds:(v,A,S)=>S<I&&S<o?(A&&(Es.min.copy(v.min),Es.max.copy(v.max),Es.needsUpdate=!0),!0):!1,intersectsRange:(v,A)=>{if(e.boundsTree){const S=e.boundsTree;return S.shapecast({boundsTraverseOrder:N=>Es.distanceToBox(N),intersectsBounds:(N,R,P)=>P<I&&P<o,intersectsRange:(N,R)=>{for(let P=N,M=N+R;P<M;P++){const w=S.resolveTriangleIndex(P);Ut(f,3*w,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let L=v,C=v+A;L<C;L++){const U=r.resolveTriangleIndex(L);Ut(u,3*U,c,l),u.needsUpdate=!0;const q=u.distanceToTriangle(f,p,E);if(q<I&&(m.copy(p),g&&g.copy(E),I=q,T=L,b=P),q<n)return!0}}}})}else{const S=Ji(e);for(let N=0,R=S;N<R;N++){Ut(f,3*N,d,h),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let P=v,M=v+A;P<M;P++){const w=r.resolveTriangleIndex(P);Ut(u,3*w,c,l),u.needsUpdate=!0;const L=u.distanceToTriangle(f,p,E);if(L<I&&(m.copy(p),g&&g.copy(E),I=L,T=P,b=N),L<n)return!0}}}}}),ie.releasePrimitive(u),ie.releasePrimitive(f),I===1/0?null:(i.point?i.point.copy(m):i.point=m.clone(),i.distance=I,i.faceIndex=T,s&&(s.point?s.point.copy(g):s.point=g.clone(),s.point.applyMatrix4(Rn),m.applyMatrix4(Rn),s.distance=m.sub(s.point).length(),s.faceIndex=b),i)}function Xu(){return typeof SharedArrayBuffer<"u"}const xs=new At.constructor,Xn=new At.constructor,$e=new fa(()=>new F.Box3),Pi=new F.Box3,Li=new F.Box3,ao=new F.Box3,lo=new F.Box3;let co=!1;function Zu(r,e,t,i){if(co)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");co=!0;const s=r._roots,n=e._roots;let o,a=0,l=0;const c=new F.Matrix4().copy(t).invert();for(let h=0,d=s.length;h<d;h++){xs.setBuffer(s[h]),l=0;const u=$e.getPrimitive();Ft(0,xs.float32Array,u),u.applyMatrix4(c);for(let f=0,p=n.length;f<p&&(Xn.setBuffer(n[h]),o=he(0,0,t,c,i,a,l,0,0,u),Xn.clearBuffer(),l+=n[f].length,!o);f++);if($e.releasePrimitive(u),xs.clearBuffer(),a+=s[h].length,o)break}return co=!1,o}function he(r,e,t,i,s,n=0,o=0,a=0,l=0,c=null,h=!1){let d,u;h?(d=Xn,u=xs):(d=xs,u=Xn);const f=d.float32Array,p=d.uint32Array,m=d.uint16Array,E=u.float32Array,g=u.uint32Array,I=u.uint16Array,T=r*2,b=e*2,v=Xt(T,m),A=Xt(b,I);let S=!1;if(A&&v)h?S=s(Zt(e,g),se(e*2,I),Zt(r,p),se(r*2,m),l,o+e,a,n+r):S=s(Zt(r,p),se(r*2,m),Zt(e,g),se(e*2,I),a,n+r,l,o+e);else if(A){const N=$e.getPrimitive();Ft(e,E,N),N.applyMatrix4(t);const R=ne(r),P=re(r,p);Ft(R,f,Pi),Ft(P,f,Li);const M=N.intersectsBox(Pi),w=N.intersectsBox(Li);S=M&&he(e,R,i,t,s,o,n,l,a+1,N,!h)||w&&he(e,P,i,t,s,o,n,l,a+1,N,!h),$e.releasePrimitive(N)}else{const N=ne(e),R=re(e,g);Ft(N,E,ao),Ft(R,E,lo);const P=c.intersectsBox(ao),M=c.intersectsBox(lo);if(P&&M)S=he(r,N,t,i,s,n,o,a,l+1,c,h)||he(r,R,t,i,s,n,o,a,l+1,c,h);else if(P)if(v)S=he(r,N,t,i,s,n,o,a,l+1,c,h);else{const w=$e.getPrimitive();w.copy(ao).applyMatrix4(t);const L=ne(r),C=re(r,p);Ft(L,f,Pi),Ft(C,f,Li);const U=w.intersectsBox(Pi),q=w.intersectsBox(Li);S=U&&he(N,L,i,t,s,o,n,l,a+1,w,!h)||q&&he(N,C,i,t,s,o,n,l,a+1,w,!h),$e.releasePrimitive(w)}else if(M)if(v)S=he(r,R,t,i,s,n,o,a,l+1,c,h);else{const w=$e.getPrimitive();w.copy(lo).applyMatrix4(t);const L=ne(r),C=re(r,p);Ft(L,f,Pi),Ft(C,f,Li);const U=w.intersectsBox(Pi),q=w.intersectsBox(Li);S=U&&he(R,L,i,t,s,o,n,l,a+1,w,!h)||q&&he(R,C,i,t,s,o,n,l,a+1,w,!h),$e.releasePrimitive(w)}}return S}const Sn=new Wt,il=new F.Box3;class pa{static serialize(e,t={}){t={cloneBuffers:!0,...t};const i=e.geometry,s=e._roots,n=e._indirectBuffer,o=i.getIndex();let a;return t.cloneBuffers?a={roots:s.map(l=>l.slice()),index:o.array.slice(),indirectBuffer:n?n.slice():null}:a={roots:s,index:o.array,indirectBuffer:n},a}static deserialize(e,t,i={}){i={setIndex:!0,indirect:!!e.indirectBuffer,...i};const{index:s,roots:n,indirectBuffer:o}=e,a=new pa(t,{...i,[eo]:!0});if(a._roots=n,a._indirectBuffer=o||null,i.setIndex){const l=t.getIndex();if(l===null){const c=new F.BufferAttribute(e.index,1,!1);t.setIndex(c)}else l.array!==s&&(l.array.set(s),l.needsUpdate=!0)}return a}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:Tc,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[eo]:!1},t),t.useSharedArrayBuffer&&!Xu())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[eo]||(uu(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new F.Box3)));const{_indirectBuffer:i}=this;this.resolveTriangleIndex=t.indirect?s=>i[s]:s=>s}refit(e=null){return(this.indirect?ku:wu)(this,e)}traverse(e,t=0){const i=this._roots[t],s=new Uint32Array(i),n=new Uint16Array(i);o(0);function o(a,l=0){const c=a*2,h=n[c+15]===Nr;if(h){const d=s[a+6],u=n[c+14];e(l,h,new Float32Array(i,a*4,6),d,u)}else{const d=a+$n/4,u=s[a+6],f=s[a+7];e(l,h,new Float32Array(i,a*4,6),f)||(o(d,l+1),o(u,l+1))}}}raycast(e,t=F.FrontSide){const i=this._roots,s=this.geometry,n=[],o=t.isMaterial,a=Array.isArray(t),l=s.groups,c=o?t.side:t,h=this.indirect?Bu:Fu;for(let d=0,u=i.length;d<u;d++){const f=a?t[l[d].materialIndex].side:c,p=n.length;if(h(this,d,f,e,n),a){const m=l[d].materialIndex;for(let E=p,g=n.length;E<g;E++)n[E].face.materialIndex=m}}return n}raycastFirst(e,t=F.FrontSide){const i=this._roots,s=this.geometry,n=t.isMaterial,o=Array.isArray(t);let a=null;const l=s.groups,c=n?t.side:t,h=this.indirect?$u:xu;for(let d=0,u=i.length;d<u;d++){const f=o?t[l[d].materialIndex].side:c,p=h(this,d,f,e);p!=null&&(a==null||p.distance<a.distance)&&(a=p,o&&(p.face.materialIndex=l[d].materialIndex))}return a}intersectsGeometry(e,t){let i=!1;const s=this._roots,n=this.indirect?Vu:Nu;for(let o=0,a=s.length;o<a&&(i=n(this,o,e,t),!i);o++);return i}shapecast(e){const t=ie.getPrimitive(),i=this.indirect?Su:vu;let{boundsTraverseOrder:s,intersectsBounds:n,intersectsRange:o,intersectsTriangle:a}=e;if(o&&a){const d=o;o=(u,f,p,m,E)=>d(u,f,p,m,E)?!0:i(u,f,this,a,p,m,t)}else o||(a?o=(d,u,f,p)=>i(d,u,this,a,f,p,t):o=(d,u,f)=>f);let l=!1,c=0;const h=this._roots;for(let d=0,u=h.length;d<u;d++){const f=h[d];if(l=bu(this,d,n,o,s,c),l)break;c+=f.byteLength}return ie.releasePrimitive(t),l}bvhcast(e,t,i){let{intersectsRanges:s,intersectsTriangles:n}=i;const o=ie.getPrimitive(),a=this.geometry.index,l=this.geometry.attributes.position,c=this.indirect?p=>{const m=this.resolveTriangleIndex(p);Ut(o,m*3,a,l)}:p=>{Ut(o,p*3,a,l)},h=ie.getPrimitive(),d=e.geometry.index,u=e.geometry.attributes.position,f=e.indirect?p=>{const m=e.resolveTriangleIndex(p);Ut(h,m*3,d,u)}:p=>{Ut(h,p*3,d,u)};if(n){const p=(m,E,g,I,T,b,v,A)=>{for(let S=g,N=g+I;S<N;S++){f(S),h.a.applyMatrix4(t),h.b.applyMatrix4(t),h.c.applyMatrix4(t),h.needsUpdate=!0;for(let R=m,P=m+E;R<P;R++)if(c(R),o.needsUpdate=!0,n(o,h,R,S,T,b,v,A))return!0}return!1};if(s){const m=s;s=function(E,g,I,T,b,v,A,S){return m(E,g,I,T,b,v,A,S)?!0:p(E,g,I,T,b,v,A,S)}}else s=p}return Zu(this,e,t,s)}intersectsBox(e,t){return Sn.set(e.min,e.max,t),Sn.needsUpdate=!0,this.shapecast({intersectsBounds:i=>Sn.intersectsBox(i),intersectsTriangle:i=>Sn.intersectsTriangle(i)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,i={},s={},n=0,o=1/0){return(this.indirect?ju:Uu)(this,e,t,i,s,n,o)}closestPointToPoint(e,t={},i=0,s=1/0){return Iu(this,e,t,i,s)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(i=>{Ft(0,new Float32Array(i),il),e.union(il)}),e}}function sl(r,e,t){return r===null||(r.point.applyMatrix4(e.matrixWorld),r.distance=r.point.distanceTo(t.ray.origin),r.object=e,r.distance<t.near||r.distance>t.far)?null:r}const ho=new F.Ray,nl=new F.Matrix4,qu=F.Mesh.prototype.raycast;function Qu(r,e){if(this.geometry.boundsTree){if(this.material===void 0)return;nl.copy(this.matrixWorld).invert(),ho.copy(r.ray).applyMatrix4(nl);const t=this.geometry.boundsTree;if(r.firstHitOnly===!0){const i=sl(t.raycastFirst(ho,this.material),this,r);i&&e.push(i)}else{const i=t.raycast(ho,this.material);for(let s=0,n=i.length;s<n;s++){const o=sl(i[s],this,r);o&&e.push(o)}}}else qu.call(this,r,e)}function Ku(r){return this.boundsTree=new pa(this,r),this.boundsTree}function Ju(){this.boundsTree=null}let K=class{constructor(){y(this,"trigger",e=>{const t=this.handlers.slice(0);for(const i of t)i(e)});y(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter(t=>t!==e)}reset(){this.handlers.length=0}};class Ns{constructor(){y(this,"trigger",async e=>{const t=this.handlers.slice(0);for(const i of t)await i(e)});y(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter(t=>t!==e)}reset(){this.handlers.length=0}}class Lr{constructor(e){y(this,"isDisposeable",()=>"dispose"in this&&"onDisposed"in this);y(this,"isResizeable",()=>"resize"in this&&"getSize"in this);y(this,"isUpdateable",()=>"onAfterUpdate"in this&&"onBeforeUpdate"in this&&"update"in this);y(this,"isHideable",()=>"visible"in this);y(this,"isConfigurable",()=>"setup"in this&&"config"in this&&"onSetup"in this);this.components=e}}class Ot extends Lr{}class Mr extends Lr{constructor(t){super(t);y(this,"worlds",new Map);y(this,"onWorldChanged",new K);y(this,"currentWorld",null);this.onWorldChanged.add(({world:i,action:s})=>{s==="removed"&&this.worlds.delete(i.uuid)})}}class Rc extends Mr{constructor(){super(...arguments);y(this,"hasCameraControls",()=>"controls"in this)}}class Sc extends Mr{constructor(){super(...arguments);y(this,"onAfterUpdate",new K);y(this,"onBeforeUpdate",new K);y(this,"onDisposed",new K);y(this,"onResize",new K);y(this,"onClippingPlanesUpdated",new K);y(this,"clippingPlanes",[])}updateClippingPlanes(){this.onClippingPlanesUpdated.trigger()}setPlane(t,i,s){i.isLocal=s;const n=this.clippingPlanes.indexOf(i);t&&n===-1?this.clippingPlanes.push(i):!t&&n>-1&&this.clippingPlanes.splice(n,1),this.three.clippingPlanes=this.clippingPlanes.filter(o=>!o.isLocal)}}const ks=class ks extends Ot{constructor(t){super(t);y(this,"_disposedComponents",new Set);y(this,"enabled",!0);t.add(ks.uuid,this)}get(){return this._disposedComponents}destroy(t,i=!0,s=!0){t.removeFromParent();const n=t;n.dispose&&n.dispose(),this.disposeGeometryAndMaterials(t,i),s&&n.children&&n.children.length&&this.disposeChildren(n),t.children.length=0}disposeGeometry(t){t.boundsTree&&t.disposeBoundsTree&&t.disposeBoundsTree(),t.dispose()}disposeGeometryAndMaterials(t,i){const s=t;s.geometry&&this.disposeGeometry(s.geometry),i&&s.material&&ks.disposeMaterial(s),s.material=[],s.geometry=null}disposeChildren(t){for(const i of t.children)this.destroy(i)}static disposeMaterial(t){if(t.material)if(Array.isArray(t.material))for(const i of t.material)i.dispose();else t.material.dispose()}};y(ks,"uuid","76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");let Pe=ks;class Fc extends Mr{constructor(t){super(t);y(this,"onDisposed",new K);y(this,"directionalLights",new Map);y(this,"ambientLights",new Map)}dispose(){const t=this.components.get(Pe);for(const i of this.three.children){const s=i;s.geometry&&t.destroy(s)}for(const[,i]of this.directionalLights)i.removeFromParent(),i.target.removeFromParent(),i.dispose();for(const[,i]of this.ambientLights)i.removeFromParent(),i.dispose();this.three.children=[],this.onDisposed.trigger(),this.onDisposed.reset()}}class $i extends Set{constructor(t){super(t);y(this,"onItemAdded",new K);y(this,"onItemDeleted",new K);y(this,"onCleared",new K);y(this,"guard",()=>!0)}clear(){super.clear(),this.onCleared.trigger()}add(...t){for(const i of t)this.has(i)||!this.guard(i)||(super.add(i),this.onItemAdded||(this.onItemAdded=new K),this.onItemAdded.trigger(i));return this}delete(t){const i=super.delete(t);return i&&this.onItemDeleted.trigger(),i}dispose(){this.clear(),this.onItemAdded.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}class pi extends Map{constructor(t){super(t);y(this,"onItemSet",new K);y(this,"onItemUpdated",new K);y(this,"onItemDeleted",new K);y(this,"onCleared",new K);y(this,"guard",()=>!0)}clear(){super.clear(),this.onCleared.trigger()}set(t,i){const s=this.has(t);if(!this.guard(t,i))return this;const o=super.set(t,i);return s?(this.onItemUpdated||(this.onItemUpdated=new K),this.onItemUpdated.trigger({key:t,value:i})):(this.onItemSet||(this.onItemSet=new K),this.onItemSet.trigger({key:t,value:i})),o}delete(t){const i=super.delete(t);return i&&this.onItemDeleted.trigger(t),i}dispose(){this.clear(),this.onItemSet.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}const Vn=0,tf=1,ef=new F.Vector3,rl=new F.Line3,uo=new F.Plane,ol=new F.Vector3,Fn=new F.Triangle;class sf{constructor(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new al,this.unassigned=new al,this.vertices=[]}setFromPoints(e){if(e.length>=4){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.vertices.push(new nf(e[t]));this.compute()}return this}setFromObject(e){const t=[];return e.updateMatrixWorld(!0),e.traverse(function(i){const s=i.geometry;if(s!==void 0){const n=s.attributes.position;if(n!==void 0)for(let o=0,a=n.count;o<a;o++){const l=new F.Vector3;l.fromBufferAttribute(n,o).applyMatrix4(i.matrixWorld),t.push(l)}}}),this.setFromPoints(t)}containsPoint(e){const t=this.faces;for(let i=0,s=t.length;i<s;i++)if(t[i].distanceToPoint(e)>this.tolerance)return!1;return!0}intersectRay(e,t){const i=this.faces;let s=-1/0,n=1/0;for(let o=0,a=i.length;o<a;o++){const l=i[o],c=l.distanceToPoint(e.origin),h=l.normal.dot(e.direction);if(c>0&&h>=0)return null;const d=h!==0?-c/h:0;if(!(d<=0)&&(h>0?n=Math.min(d,n):s=Math.max(d,s),s>n))return null}return s!==-1/0?e.at(s,t):e.at(n,t),t}intersectsRay(e){return this.intersectRay(e,ef)!==null}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(e,t){return e.face=t,t.outside===null?this.assigned.append(e):this.assigned.insertBefore(t.outside,e),t.outside=e,this}removeVertexFromFace(e,t){return e===t.outside&&(e.next!==null&&e.next.face===t?t.outside=e.next:t.outside=null),this.assigned.remove(e),this}removeAllVerticesFromFace(e){if(e.outside!==null){const t=e.outside;let i=e.outside;for(;i.next!==null&&i.next.face===e;)i=i.next;return this.assigned.removeSubList(t,i),t.prev=i.next=null,e.outside=null,t}}deleteFaceVertices(e,t){const i=this.removeAllVerticesFromFace(e);if(i!==void 0)if(t===void 0)this.unassigned.appendChain(i);else{let s=i;do{const n=s.next;t.distanceToPoint(s.point)>this.tolerance?this.addVertexToFace(s,t):this.unassigned.append(s),s=n}while(s!==null)}return this}resolveUnassignedPoints(e){if(this.unassigned.isEmpty()===!1){let t=this.unassigned.first();do{const i=t.next;let s=this.tolerance,n=null;for(let o=0;o<e.length;o++){const a=e[o];if(a.mark===Vn){const l=a.distanceToPoint(t.point);if(l>s&&(s=l,n=a),s>1e3*this.tolerance)break}}n!==null&&this.addVertexToFace(t,n),t=i}while(t!==null)}return this}computeExtremes(){const e=new F.Vector3,t=new F.Vector3,i=[],s=[];for(let n=0;n<3;n++)i[n]=s[n]=this.vertices[0];e.copy(this.vertices[0].point),t.copy(this.vertices[0].point);for(let n=0,o=this.vertices.length;n<o;n++){const a=this.vertices[n],l=a.point;for(let c=0;c<3;c++)l.getComponent(c)<e.getComponent(c)&&(e.setComponent(c,l.getComponent(c)),i[c]=a);for(let c=0;c<3;c++)l.getComponent(c)>t.getComponent(c)&&(t.setComponent(c,l.getComponent(c)),s[c]=a)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(e.x),Math.abs(t.x))+Math.max(Math.abs(e.y),Math.abs(t.y))+Math.max(Math.abs(e.z),Math.abs(t.z))),{min:i,max:s}}computeInitialHull(){const e=this.vertices,t=this.computeExtremes(),i=t.min,s=t.max;let n=0,o=0;for(let u=0;u<3;u++){const f=s[u].point.getComponent(u)-i[u].point.getComponent(u);f>n&&(n=f,o=u)}const a=i[o],l=s[o];let c,h;n=0,rl.set(a.point,l.point);for(let u=0,f=this.vertices.length;u<f;u++){const p=e[u];if(p!==a&&p!==l){rl.closestPointToPoint(p.point,!0,ol);const m=ol.distanceToSquared(p.point);m>n&&(n=m,c=p)}}n=-1,uo.setFromCoplanarPoints(a.point,l.point,c.point);for(let u=0,f=this.vertices.length;u<f;u++){const p=e[u];if(p!==a&&p!==l&&p!==c){const m=Math.abs(uo.distanceToPoint(p.point));m>n&&(n=m,h=p)}}const d=[];if(uo.distanceToPoint(h.point)<0){d.push(ue.create(a,l,c),ue.create(h,l,a),ue.create(h,c,l),ue.create(h,a,c));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(ue.create(a,c,l),ue.create(h,a,l),ue.create(h,l,c),ue.create(h,c,a));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=e.length;u<f;u++){const p=e[u];if(p!==a&&p!==l&&p!==c&&p!==h){n=this.tolerance;let m=null;for(let E=0;E<4;E++){const g=this.faces[E].distanceToPoint(p.point);g>n&&(n=g,m=this.faces[E])}m!==null&&this.addVertexToFace(p,m)}}return this}reindexFaces(){const e=[];for(let t=0;t<this.faces.length;t++){const i=this.faces[t];i.mark===Vn&&e.push(i)}return this.faces=e,this}nextVertexToAdd(){if(this.assigned.isEmpty()===!1){let e,t=0;const i=this.assigned.first().face;let s=i.outside;do{const n=i.distanceToPoint(s.point);n>t&&(t=n,e=s),s=s.next}while(s!==null&&s.face===i);return e}}computeHorizon(e,t,i,s){this.deleteFaceVertices(i),i.mark=tf;let n;t===null?n=t=i.getEdge(0):n=t.next;do{const o=n.twin,a=o.face;a.mark===Vn&&(a.distanceToPoint(e)>this.tolerance?this.computeHorizon(e,o,a,s):s.push(n)),n=n.next}while(n!==t);return this}addAdjoiningFace(e,t){const i=ue.create(e,t.tail(),t.head());return this.faces.push(i),i.getEdge(-1).setTwin(t.twin),i.getEdge(0)}addNewFaces(e,t){this.newFaces=[];let i=null,s=null;for(let n=0;n<t.length;n++){const o=t[n],a=this.addAdjoiningFace(e,o);i===null?i=a:a.next.setTwin(s),this.newFaces.push(a.face),s=a}return i.next.setTwin(s),this}addVertexToHull(e){const t=[];return this.unassigned.clear(),this.removeVertexFromFace(e,e.face),this.computeHorizon(e.point,null,e.face,t),this.addNewFaces(e,t),this.resolveUnassignedPoints(this.newFaces),this}cleanup(){return this.assigned.clear(),this.unassigned.clear(),this.newFaces=[],this}compute(){let e;for(this.computeInitialHull();(e=this.nextVertexToAdd())!==void 0;)this.addVertexToHull(e);return this.reindexFaces(),this.cleanup(),this}}class ue{constructor(){this.normal=new F.Vector3,this.midpoint=new F.Vector3,this.area=0,this.constant=0,this.outside=null,this.mark=Vn,this.edge=null}static create(e,t,i){const s=new ue,n=new fo(e,s),o=new fo(t,s),a=new fo(i,s);return n.next=a.prev=o,o.next=n.prev=a,a.next=o.prev=n,s.edge=n,s.compute()}getEdge(e){let t=this.edge;for(;e>0;)t=t.next,e--;for(;e<0;)t=t.prev,e++;return t}compute(){const e=this.edge.tail(),t=this.edge.head(),i=this.edge.next.head();return Fn.set(e.point,t.point,i.point),Fn.getNormal(this.normal),Fn.getMidpoint(this.midpoint),this.area=Fn.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(e){return this.normal.dot(e)-this.constant}}class fo{constructor(e,t){this.vertex=e,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 e=this.head(),t=this.tail();return t!==null?t.point.distanceTo(e.point):-1}lengthSquared(){const e=this.head(),t=this.tail();return t!==null?t.point.distanceToSquared(e.point):-1}setTwin(e){return this.twin=e,e.twin=this,this}}class nf{constructor(e){this.point=e,this.prev=null,this.next=null,this.face=null}}class al{constructor(){this.head=null,this.tail=null}first(){return this.head}last(){return this.tail}clear(){return this.head=this.tail=null,this}insertBefore(e,t){return t.prev=e.prev,t.next=e,t.prev===null?this.head=t:t.prev.next=t,e.prev=t,this}insertAfter(e,t){return t.prev=e,t.next=e.next,t.next===null?this.tail=t:t.next.prev=t,e.next=t,this}append(e){return this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e,this}appendChain(e){for(this.head===null?this.head=e:this.tail.next=e,e.prev=this.tail;e.next!==null;)e=e.next;return this.tail=e,this}remove(e){return e.prev===null?this.head=e.next:e.prev.next=e.next,e.next===null?this.tail=e.prev:e.next.prev=e.prev,this}removeSubList(e,t){return e.prev===null?this.head=t.next:e.prev.next=t.next,t.next===null?this.tail=e.prev:t.next.prev=e.prev,this}isEmpty(){return this.head===null}}const zo=[2,2,1],$o=[1,0,0];function ye(r,e){return r*3+e}function rf(r){const e=r.elements;let t=0;for(let i=0;i<9;i++)t+=e[i]*e[i];return Math.sqrt(t)}function of(r){const e=r.elements;let t=0;for(let i=0;i<3;i++){const s=e[ye(zo[i],$o[i])];t+=2*s*s}return Math.sqrt(t)}function af(r,e){let t=0,i=1;const s=r.elements;for(let c=0;c<3;c++){const h=Math.abs(s[ye(zo[c],$o[c])]);h>t&&(t=h,i=c)}let n=1,o=0;const a=$o[i],l=zo[i];if(Math.abs(s[ye(l,a)])>Number.EPSILON){const c=s[ye(l,l)],h=s[ye(a,a)],d=s[ye(l,a)],u=(c-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),o=f*n}return e.identity(),e.elements[ye(a,a)]=n,e.elements[ye(l,l)]=n,e.elements[ye(l,a)]=o,e.elements[ye(a,l)]=-o,e}function lf(r,e){let t=0,i=0;const s=10;e.unitary.identity(),e.diagonal.copy(r);const n=e.unitary,o=e.diagonal,a=new D.Matrix3,l=new D.Matrix3,c=Number.EPSILON*rf(o);for(;i<s&&of(o)>c;)af(o,a),l.copy(a).transpose(),o.multiply(a),o.premultiply(l),n.multiply(a),++t>2&&(i++,t=0);return e}function Oc(r){const e=[];for(let lt=0;lt<r.length-2;lt+=3){const pt=r[lt],ft=r[lt+1],Ct=r[lt+2];e.push(new D.Vector3(pt,ft,Ct))}const t=new sf;t.setFromPoints(e);const i={unitary:new D.Matrix3,diagonal:new D.Matrix3},s=t.faces,n=[],o=[];for(let lt=0,pt=s.length;lt<pt;lt++){const ft=s[lt];let Ct=ft.edge;n.length=0;do n.push(Ct),Ct=Ct.next;while(Ct!==ft.edge);const Kt=n.length-2;for(let $t=1,_=Kt;$t<=_;$t++){const j=n[0].vertex,V=n[$t+0].vertex,x=n[$t+1].vertex;o.push(j.point.x,j.point.y,j.point.z),o.push(V.point.x,V.point.y,V.point.z),o.push(x.point.x,x.point.y,x.point.z)}}const a=new D.Vector3,l=new D.Vector3,c=new D.Vector3,h=new D.Vector3,d=new D.Vector3,u=new D.Vector3,f=new D.Vector3,p=new D.Vector3;let m=0,E=0,g=0,I=0,T=0,b=0,v=0;for(let lt=0,pt=o.length;lt<pt;lt+=9){a.fromArray(o,lt),l.fromArray(o,lt+3),c.fromArray(o,lt+6),f.set(0,0,0),f.add(a).add(l).add(c).divideScalar(3),h.subVectors(l,a),d.subVectors(c,a);const ft=u.crossVectors(h,d).length()/2;p.add(u.copy(f).multiplyScalar(ft)),m+=ft,E+=(9*f.x*f.x+a.x*a.x+l.x*l.x+c.x*c.x)*(ft/12),g+=(9*f.x*f.y+a.x*a.y+l.x*l.y+c.x*c.y)*(ft/12),I+=(9*f.x*f.z+a.x*a.z+l.x*l.z+c.x*c.z)*(ft/12),T+=(9*f.y*f.y+a.y*a.y+l.y*l.y+c.y*c.y)*(ft/12),b+=(9*f.y*f.z+a.y*a.z+l.y*l.z+c.y*c.z)*(ft/12),v+=(9*f.z*f.z+a.z*a.z+l.z*l.z+c.z*c.z)*(ft/12)}p.divideScalar(m),E/=m,g/=m,I/=m,T/=m,b/=m,v/=m,E-=p.x*p.x,g-=p.x*p.y,I-=p.x*p.z,T-=p.y*p.y,b-=p.y*p.z,v-=p.z*p.z;const A=new D.Matrix3;A.elements[0]=E,A.elements[1]=g,A.elements[2]=I,A.elements[3]=g,A.elements[4]=T,A.elements[5]=b,A.elements[6]=I,A.elements[7]=b,A.elements[8]=v,lf(A,i);const S=i.unitary,N=new D.Vector3,R=new D.Vector3,P=new D.Vector3;S.extractBasis(N,R,P);let M=-1/0,w=-1/0,L=-1/0,C=1/0,U=1/0,q=1/0;for(let lt=0,pt=e.length;lt<pt;lt++){const ft=e[lt];M=Math.max(N.dot(ft),M),w=Math.max(R.dot(ft),w),L=Math.max(P.dot(ft),L),C=Math.min(N.dot(ft),C),U=Math.min(R.dot(ft),U),q=Math.min(P.dot(ft),q)}N.multiplyScalar(.5*(C+M)),R.multiplyScalar(.5*(U+w)),P.multiplyScalar(.5*(q+L));const G=new D.Vector3,st=new D.Vector3,Y=new D.Matrix3;G.add(N).add(R).add(P),st.x=M-C,st.y=w-U,st.z=L-q,st.multiplyScalar(.5),Y.copy(S);const{x:ot,y:$,z:B}=st,at=new D.Matrix4;at.makeScale(ot*2,$*2,B*2);const nt=new D.Matrix4;nt.makeTranslation(-ot,-$,-B);const it=new D.Matrix4;it.makeTranslation(G.x,G.y,G.z);const Rt=new D.Matrix4;Rt.setFromMatrix3(Y);const xt=new D.Matrix4;return xt.multiply(it),xt.multiply(Rt),xt.multiply(nt),xt.multiply(at),{center:G,halfSizes:st,rotation:Y,transformation:xt}}function xc(r,e,t){const i=[r[0]-e[0],r[1]-e[1],r[2]-e[2]];return t[0]*i[0]+t[1]*i[1]+t[2]*i[2]>0}class Vo{static isTransparent(e){return e.transparent&&e.opacity<1}}const Pt=class Pt{static create(){const e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return`${Pt._lut[e&255]+Pt._lut[e>>8&255]+Pt._lut[e>>16&255]+Pt._lut[e>>24&255]}-${Pt._lut[t&255]}${Pt._lut[t>>8&255]}-${Pt._lut[t>>16&15|64]}${Pt._lut[t>>24&255]}-${Pt._lut[i&63|128]}${Pt._lut[i>>8&255]}-${Pt._lut[i>>16&255]}${Pt._lut[i>>24&255]}${Pt._lut[s&255]}${Pt._lut[s>>8&255]}${Pt._lut[s>>16&255]}${Pt._lut[s>>24&255]}`.toLowerCase()}static validate(e){if(!Pt._pattern.test(e))throw new Error(`${e} 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.`)}};y(Pt,"_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}$/),y(Pt,"_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 Fe=Pt;class nf extends Ot{constructor(t,i){super(t);y(this,"onDisposed",new Q);y(this,"onVertexFound",new Q);y(this,"onVertexLost",new Q);y(this,"onEnabled",new Q);y(this,"components");y(this,"workingPlane",null);y(this,"_pickedPoint",null);y(this,"_config");y(this,"_enabled",!1);this.components=t,this.config={snapDistance:.25,showOnlyVertex:!1,...i},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 r=this.components.get(fi).get(t).castRay();if(!r)return this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint;const o=this.getClosestVertex(r);return o?(this.workingPlane?Math.abs(this.workingPlane.distanceToPoint(o))<.001:!0)?((this._pickedPoint===null||!this._pickedPoint.equals(o))&&(this._pickedPoint=o.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 i=new M.Vector3,s=!1,r=Number.MAX_SAFE_INTEGER;const o=this.getVertices(t);if(o===null)return null;for(const a of o){if(!a)continue;const l=t.point.distanceTo(a);l>r||l>this._config.snapDistance||(s=!0,i=a,r=t.point.distanceTo(a))}return s?i:this.config.showOnlyVertex?null:t.point}getVertices(t){const i=t.object;if(!t.face||!i)return null;const s=i.geometry,r=new M.Matrix4,{instanceId:o}=t,a=o!==void 0,l=i instanceof M.InstancedMesh;return l&&a&&i.getMatrixAt(o,r),[this.getVertex(t.face.a,s),this.getVertex(t.face.b,s),this.getVertex(t.face.c,s)].map(c=>(c&&(l&&a&&c.applyMatrix4(r),c.applyMatrix4(i.matrixWorld)),c))}getVertex(t,i){if(t===void 0)return null;const s=i.attributes.position;return new M.Vector3(s.getX(t),s.getY(t),s.getZ(t))}}const gr=class gr{constructor(){y(this,"onDisposed",new Q);y(this,"list",new Map);y(this,"enabled",!1);y(this,"_clock");y(this,"update",()=>{if(!this.enabled)return;const e=this._clock.getDelta();for(const[t,i]of this.list)i.enabled&&i.isUpdateable()&&i.update(e);requestAnimationFrame(this.update)});this._clock=new M.Clock,gr.setupBVH()}add(e,t){if(this.list.has(e))throw new Error("You're trying to add a component that already exists in the components instance. Use Components.get() instead.");Fe.validate(e),this.list.set(e,t)}get(e){const t=e.uuid;if(!this.list.has(t)){const i=new e(this);return this.list.has(t)||this.add(t,i),i}return this.list.get(t)}init(){this.enabled=!0,this._clock.start(),this.update()}dispose(){this.enabled=!1;for(const[e,t]of this.list)t.enabled=!1,t.isDisposeable()&&t.dispose();this._clock.stop(),this.onDisposed.trigger(),this.onDisposed.reset()}static setupBVH(){M.BufferGeometry.prototype.computeBoundsTree=ju,M.BufferGeometry.prototype.disposeBoundsTree=Xu,M.Mesh.prototype.raycast=Wu}};y(gr,"release","2.2.0-alpha.0");let Xn=gr;class Sc extends xr{constructor(){super(...arguments);y(this,"meshes",new Set);y(this,"onAfterUpdate",new Q);y(this,"onBeforeUpdate",new Q);y(this,"onDisposed",new Q);y(this,"isDisposing",!1);y(this,"enabled",!0);y(this,"uuid",Fe.create());y(this,"name");y(this,"_scene");y(this,"_camera");y(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(Se);this.scene.dispose(),this.camera.isDisposeable()&&this.camera.dispose(),this.renderer&&this.renderer.dispose();for(const s of this.meshes)i.destroy(s);this.meshes.clear()}this._scene=null,this._camera=null,this._renderer=null,this.onDisposed.trigger()}}class Fc extends wc{constructor(t){super(t);y(this,"isSetup",!1);y(this,"three");y(this,"onSetup",new Q);y(this,"config",{directionalLight:{color:new M.Color("white"),intensity:1.5,position:new M.Vector3(5,10,3)},ambientLight:{color:new M.Color("white"),intensity:1}});this.three=new M.Scene,this.three.background=new M.Color(2107698)}setup(t){this.config={...this.config,...t};const i=new M.DirectionalLight(this.config.directionalLight.color,this.config.directionalLight.intensity);i.position.copy(this.config.directionalLight.position);const s=new M.AmbientLight(this.config.ambientLight.color,this.config.ambientLight.intensity);this.three.add(i,s),this.directionalLights.set(i.uuid,i),this.ambientLights.set(s.uuid,s),this.isSetup=!0,this.onSetup.trigger(this)}}class rf extends vc{constructor(t,i,s){super(t);y(this,"enabled",!0);y(this,"container");y(this,"three");y(this,"_canvas");y(this,"_parameters");y(this,"_resizeObserver",null);y(this,"onContainerUpdated",new Q);y(this,"_resizing",!1);y(this,"resize",t=>{if(this._resizing)return;this._resizing=!0,this.onContainerUpdated.trigger();const i=t?t.x:this.container.clientWidth,s=t?t.y:this.container.clientHeight;this.three.setSize(i,s),this.onResize.trigger(new M.Vector2(i,s)),this._resizing=!1});y(this,"resizeEvent",()=>{this.resize()});y(this,"onContextLost",t=>{t.preventDefault(),this.enabled=!1});y(this,"onContextBack",()=>{this.three.setRenderTarget(null),this.three.dispose(),this.three=new M.WebGLRenderer({canvas:this._canvas,antialias:!0,alpha:!0,...this._parameters}),this.enabled=!0});this.container=i,this._parameters=s,this.three=new M.WebGLRenderer({antialias:!0,alpha:!0,...s}),this.three.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.setupRenderer(),this.setupEvents(!0),this.resize(),this._canvas=this.three.domElement;const r=this.three.getContext(),{canvas:o}=r;o.addEventListener("webglcontextlost",this.onContextLost,!1),o.addEventListener("webglcontextrestored",this.onContextBack,!1)}update(){if(!this.enabled||!this.currentWorld)return;this.onBeforeUpdate.trigger(this);const t=this.currentWorld.scene.three,i=this.currentWorld.camera.three;this.three.render(t,i),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 M.Vector2(this.three.domElement.clientWidth,this.three.domElement.clientHeight)}setupEvents(t){const i=this.three.domElement.parentElement;if(!i)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(i),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.`)}};y(Pt,"_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}$/),y(Pt,"_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 Le=Pt;class cf extends Ot{constructor(t,i){super(t);y(this,"onDisposed",new K);y(this,"onVertexFound",new K);y(this,"onVertexLost",new K);y(this,"onEnabled",new K);y(this,"components");y(this,"workingPlane",null);y(this,"_pickedPoint",null);y(this,"_config");y(this,"_enabled",!1);this.components=t,this.config={snapDistance:.25,showOnlyVertex:!1,...i},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(mi).get(t).castRay();if(!n)return this._pickedPoint!==null&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint;const o=this.getClosestVertex(n);return o?(this.workingPlane?Math.abs(this.workingPlane.distanceToPoint(o))<.001:!0)?((this._pickedPoint===null||!this._pickedPoint.equals(o))&&(this._pickedPoint=o.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 i=new D.Vector3,s=!1,n=Number.MAX_SAFE_INTEGER;const o=this.getVertices(t);if(o===null)return null;for(const a of o){if(!a)continue;const l=t.point.distanceTo(a);l>n||l>this._config.snapDistance||(s=!0,i=a,n=t.point.distanceTo(a))}return s?i:this.config.showOnlyVertex?null:t.point}getVertices(t){const i=t.object;if(!t.face||!i)return null;const s=i.geometry,n=new D.Matrix4,{instanceId:o}=t,a=o!==void 0,l=i instanceof D.InstancedMesh;return l&&a&&i.getMatrixAt(o,n),[this.getVertex(t.face.a,s),this.getVertex(t.face.b,s),this.getVertex(t.face.c,s)].map(c=>(c&&(l&&a&&c.applyMatrix4(n),c.applyMatrix4(i.matrixWorld)),c))}getVertex(t,i){if(t===void 0)return null;const s=i.attributes.position;return new D.Vector3(s.getX(t),s.getY(t),s.getZ(t))}}const Ir=class Ir{constructor(){y(this,"onDisposed",new K);y(this,"list",new Map);y(this,"enabled",!1);y(this,"_clock");y(this,"update",()=>{if(!this.enabled)return;const e=this._clock.getDelta();for(const[t,i]of this.list)i.enabled&&i.isUpdateable()&&i.update(e);requestAnimationFrame(this.update)});this._clock=new D.Clock,Ir.setupBVH()}add(e,t){if(this.list.has(e))throw new Error("You're trying to add a component that already exists in the components instance. Use Components.get() instead.");Le.validate(e),this.list.set(e,t)}get(e){const t=e.uuid;if(!this.list.has(t)){const i=new e(this);return this.list.has(t)||this.add(t,i),i}return this.list.get(t)}init(){this.enabled=!0,this._clock.start(),this.update()}dispose(){this.enabled=!1;for(const[e,t]of this.list)t.enabled=!1,t.isDisposeable()&&t.dispose();this._clock.stop(),this.onDisposed.trigger(),this.onDisposed.reset()}static setupBVH(){D.BufferGeometry.prototype.computeBoundsTree=Ku,D.BufferGeometry.prototype.disposeBoundsTree=Ju,D.Mesh.prototype.raycast=Qu}};y(Ir,"release","2.2.0-alpha.0");let Zn=Ir;class Nc extends Lr{constructor(){super(...arguments);y(this,"meshes",new Set);y(this,"onAfterUpdate",new K);y(this,"onBeforeUpdate",new K);y(this,"onDisposed",new K);y(this,"isDisposing",!1);y(this,"enabled",!0);y(this,"uuid",Le.create());y(this,"name");y(this,"_scene");y(this,"_camera");y(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(Pe);this.scene.dispose(),this.camera.isDisposeable()&&this.camera.dispose(),this.renderer&&this.renderer.dispose();for(const s of this.meshes)i.destroy(s);this.meshes.clear()}this._scene=null,this._camera=null,this._renderer=null,this.onDisposed.trigger()}}class Pc extends Fc{constructor(t){super(t);y(this,"isSetup",!1);y(this,"three");y(this,"onSetup",new K);y(this,"config",{directionalLight:{color:new D.Color("white"),intensity:1.5,position:new D.Vector3(5,10,3)},ambientLight:{color:new D.Color("white"),intensity:1}});this.three=new D.Scene,this.three.background=new D.Color(2107698)}setup(t){this.config={...this.config,...t};const i=new D.DirectionalLight(this.config.directionalLight.color,this.config.directionalLight.intensity);i.position.copy(this.config.directionalLight.position);const s=new D.AmbientLight(this.config.ambientLight.color,this.config.ambientLight.intensity);this.three.add(i,s),this.directionalLights.set(i.uuid,i),this.ambientLights.set(s.uuid,s),this.isSetup=!0,this.onSetup.trigger(this)}}class hf extends Sc{constructor(t,i,s){super(t);y(this,"enabled",!0);y(this,"container");y(this,"three");y(this,"_canvas");y(this,"_parameters");y(this,"_resizeObserver",null);y(this,"onContainerUpdated",new K);y(this,"_resizing",!1);y(this,"resize",t=>{if(this._resizing)return;this._resizing=!0,this.onContainerUpdated.trigger();const i=t?t.x:this.container.clientWidth,s=t?t.y:this.container.clientHeight;this.three.setSize(i,s),this.onResize.trigger(new D.Vector2(i,s)),this._resizing=!1});y(this,"resizeEvent",()=>{this.resize()});y(this,"onContextLost",t=>{t.preventDefault(),this.enabled=!1});y(this,"onContextBack",()=>{this.three.setRenderTarget(null),this.three.dispose(),this.three=new D.WebGLRenderer({canvas:this._canvas,antialias:!0,alpha:!0,...this._parameters}),this.enabled=!0});this.container=i,this._parameters=s,this.three=new D.WebGLRenderer({antialias:!0,alpha:!0,...s}),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:o}=n;o.addEventListener("webglcontextlost",this.onContextLost,!1),o.addEventListener("webglcontextrestored",this.onContextBack,!1)}update(){if(!this.enabled||!this.currentWorld)return;this.onBeforeUpdate.trigger(this);const t=this.currentWorld.scene.three,i=this.currentWorld.camera.three;this.three.render(t,i),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 D.Vector2(this.three.domElement.clientWidth,this.three.domElement.clientHeight)}setupEvents(t){const i=this.three.domElement.parentElement;if(!i)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(i),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 dt={LEFT:1,RIGHT:2,MIDDLE:4},G=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}),Pi={NONE:0,IN:1,OUT:-1};function ti(n){return n.isPerspectiveCamera}function De(n){return n.isOrthographicCamera}const Li=Math.PI*2,nl=Math.PI/2,Oc=1e-5,ps=Math.PI/180;function ce(n,e,t){return Math.max(e,Math.min(t,n))}function vt(n,e=Oc){return Math.abs(n)<e}function It(n,e,t=Oc){return vt(n-e,t)}function rl(n,e){return Math.round(n/e)*e}function ms(n){return isFinite(n)?n:n<0?-Number.MAX_VALUE:Number.MAX_VALUE}function gs(n){return Math.abs(n)<Number.MAX_VALUE?n:n*(1/0)}function Sn(n,e,t,i,s=1/0,r){i=Math.max(1e-4,i);const o=2/i,a=o*r,l=1/(1+a+.48*a*a+.235*a*a*a);let c=n-e;const h=e,d=s*i;c=ce(c,-d,d),e=n-c;const u=(t.value+o*c)*r;t.value=(t.value-o*u)*l;let f=e+(c+u)*l;return h-n>0==f>h&&(f=h,t.value=(f-h)/r),f}function ol(n,e,t,i,s=1/0,r,o){i=Math.max(1e-4,i);const a=2/i,l=a*r,c=1/(1+l+.48*l*l+.235*l*l*l);let h=e.x,d=e.y,u=e.z,f=n.x-h,p=n.y-d,m=n.z-u;const E=h,g=d,b=u,v=s*i,I=v*v,T=f*f+p*p+m*m;if(T>I){const U=Math.sqrt(T);f=f/U*v,p=p/U*v,m=m/U*v}h=n.x-f,d=n.y-p,u=n.z-m;const A=(t.x+a*f)*r,R=(t.y+a*p)*r,P=(t.z+a*m)*r;t.x=(t.x-a*A)*c,t.y=(t.y-a*R)*c,t.z=(t.z-a*P)*c,o.x=h+(f+A)*c,o.y=d+(p+R)*c,o.z=u+(m+P)*c;const F=E-n.x,x=g-n.y,D=b-n.z,w=o.x-E,L=o.y-g,C=o.z-b;return F*w+x*L+D*C>0&&(o.x=E,o.y=g,o.z=b,t.x=(o.x-E)/r,t.y=(o.y-g)/r,t.z=(o.z-b)/r),o}function uo(n,e){e.set(0,0),n.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=n.length,e.y/=n.length}function fo(n,e){return De(n)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class of{constructor(){this._listeners={}}addEventListener(e,t){const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const s=this._listeners[e];if(s!==void 0){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const i=this._listeners[e.type];if(i!==void 0){e.target=this;const s=i.slice(0);for(let r=0,o=s.length;r<o;r++)s[r].call(this,e)}}}const af="2.7.3",Fn=1/8,xc=typeof window<"u",lf=xc&&/Mac/.test(navigator.platform),cf=!(xc&&"PointerEvent"in window);let ht,al,On,po,Yt,ut,gt,Mi,Es,ge,Ee,ei,ll,cl,Kt,Is,Di,hl,mo,dl,go,Eo,xn;class $t extends of{static install(e){ht=e.THREE,al=Object.freeze(new ht.Vector3(0,0,0)),On=Object.freeze(new ht.Vector3(0,1,0)),po=Object.freeze(new ht.Vector3(0,0,1)),Yt=new ht.Vector2,ut=new ht.Vector3,gt=new ht.Vector3,Mi=new ht.Vector3,Es=new ht.Vector3,ge=new ht.Vector3,Ee=new ht.Vector3,ei=new ht.Vector3,ll=new ht.Vector3,cl=new ht.Vector3,Kt=new ht.Spherical,Is=new ht.Spherical,Di=new ht.Box3,hl=new ht.Box3,mo=new ht.Sphere,dl=new ht.Quaternion,go=new ht.Quaternion,Eo=new ht.Matrix4,xn=new ht.Raycaster}static get ACTION(){return G}constructor(e,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=G.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=Pi.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new ht.Vector3,this._focalOffsetVelocity=new ht.Vector3,this._zoomVelocity={value:0},this._truckInternal=(I,T,A)=>{let R,P;if(ti(this._camera)){const F=ut.copy(this._camera.position).sub(this._target),x=this._camera.getEffectiveFOV()*ps,D=F.length()*Math.tan(x*.5);R=this.truckSpeed*I*D/this._elementRect.height,P=this.truckSpeed*T*D/this._elementRect.height}else if(De(this._camera)){const F=this._camera;R=I*(F.right-F.left)/F.zoom/this._elementRect.width,P=T*(F.top-F.bottom)/F.zoom/this._elementRect.height}else return;this.verticalDragToForward?(A?this.setFocalOffset(this._focalOffsetEnd.x+R,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(R,0,!0),this.forward(-P,!0)):A?this.setFocalOffset(this._focalOffsetEnd.x+R,this._focalOffsetEnd.y+P,this._focalOffsetEnd.z,!0):this.truck(R,P,!0)},this._rotateInternal=(I,T)=>{const A=Li*this.azimuthRotateSpeed*I/this._elementRect.height,R=Li*this.polarRotateSpeed*T/this._elementRect.height;this.rotate(A,R,!0)},this._dollyInternal=(I,T,A)=>{const R=Math.pow(.95,-I*this.dollySpeed),P=this._sphericalEnd.radius,F=this._sphericalEnd.radius*R,x=ce(F,this.minDistance,this.maxDistance),D=x-F;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(F,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(D,!0),this._dollyToNoClamp(x,!0)):this._dollyToNoClamp(x,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?F:x)-P,this._dollyControlCoord.set(T,A)),this._lastDollyDirection=Math.sign(-I)},this._zoomInternal=(I,T,A)=>{const R=Math.pow(.95,I*this.dollySpeed),P=this._zoom,F=this._zoom*R;this.zoomTo(F,!0),this.dollyToCursor&&(this._changedZoom+=F-P,this._dollyControlCoord.set(T,A))},typeof ht>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new ht.Quaternion().setFromUnitVectors(this._camera.up,On),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=G.NONE,this._target=new ht.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new ht.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new ht.Spherical().setFromVector3(ut.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 ht.Vector3,new ht.Vector3,new ht.Vector3,new ht.Vector3],this._updateNearPlaneCorners(),this._boundary=new ht.Box3(new ht.Vector3(-1/0,-1/0,-1/0),new ht.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 ht.Vector2,this.mouseButtons={left:G.ROTATE,middle:G.DOLLY,right:G.TRUCK,wheel:ti(this._camera)?G.DOLLY:De(this._camera)?G.ZOOM:G.NONE},this.touches={one:G.TOUCH_ROTATE,two:ti(this._camera)?G.TOUCH_DOLLY_TRUCK:De(this._camera)?G.TOUCH_ZOOM_TRUCK:G.NONE,three:G.TOUCH_TRUCK};const i=new ht.Vector2,s=new ht.Vector2,r=new ht.Vector2,o=I=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const R=this._domElement.getBoundingClientRect(),P=I.clientX/R.width,F=I.clientY/R.height;if(P<this._interactiveArea.left||P>this._interactiveArea.right||F<this._interactiveArea.top||F>this._interactiveArea.bottom)return}const T=I.pointerType!=="mouse"?null:(I.buttons&dt.LEFT)===dt.LEFT?dt.LEFT:(I.buttons&dt.MIDDLE)===dt.MIDDLE?dt.MIDDLE:(I.buttons&dt.RIGHT)===dt.RIGHT?dt.RIGHT:null;if(T!==null){const R=this._findPointerByMouseButton(T);R&&this._disposePointer(R)}if((I.buttons&dt.LEFT)===dt.LEFT&&this._lockedPointer)return;const A={pointerId:I.pointerId,clientX:I.clientX,clientY:I.clientY,deltaX:0,deltaY:0,mouseButton:T};this._activePointers.push(A),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",h),this._isDragging=!0,m(I)},a=I=>{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 R=this._domElement.getBoundingClientRect(),P=I.clientX/R.width,F=I.clientY/R.height;if(P<this._interactiveArea.left||P>this._interactiveArea.right||F<this._interactiveArea.top||F>this._interactiveArea.bottom)return}const T=(I.buttons&dt.LEFT)===dt.LEFT?dt.LEFT:(I.buttons&dt.MIDDLE)===dt.MIDDLE?dt.MIDDLE:(I.buttons&dt.RIGHT)===dt.RIGHT?dt.RIGHT:null;if(T!==null){const R=this._findPointerByMouseButton(T);R&&this._disposePointer(R)}const A={pointerId:1,clientX:I.clientX,clientY:I.clientY,deltaX:0,deltaY:0,mouseButton:(I.buttons&dt.LEFT)===dt.LEFT?dt.LEFT:(I.buttons&dt.MIDDLE)===dt.LEFT?dt.MIDDLE:(I.buttons&dt.RIGHT)===dt.LEFT?dt.RIGHT:null};this._activePointers.push(A),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.addEventListener("mousemove",c),this._domElement.ownerDocument.addEventListener("mouseup",d),this._isDragging=!0,m(I)},l=I=>{I.cancelable&&I.preventDefault();const T=I.pointerId,A=this._lockedPointer||this._findPointerById(T);if(A){if(A.clientX=I.clientX,A.clientY=I.clientY,A.deltaX=I.movementX,A.deltaY=I.movementY,this._state=0,I.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&&(I.buttons&dt.LEFT)===dt.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(I.buttons&dt.MIDDLE)===dt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(I.buttons&dt.RIGHT)===dt.RIGHT&&(this._state=this._state|this.mouseButtons.right);E()}},c=I=>{const T=this._lockedPointer||this._findPointerById(1);T&&(T.clientX=I.clientX,T.clientY=I.clientY,T.deltaX=I.movementX,T.deltaY=I.movementY,this._state=0,(this._lockedPointer||(I.buttons&dt.LEFT)===dt.LEFT)&&(this._state=this._state|this.mouseButtons.left),(I.buttons&dt.MIDDLE)===dt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(I.buttons&dt.RIGHT)===dt.RIGHT&&(this._state=this._state|this.mouseButtons.right),E())},h=I=>{const T=this._findPointerById(I.pointerId);if(!(T&&T===this._lockedPointer)){if(T&&this._disposePointer(T),I.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=G.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=G.NONE;g()}},d=()=>{const I=this._findPointerById(1);I&&I===this._lockedPointer||(I&&this._disposePointer(I),this._state=G.NONE,g())};let u=-1;const f=I=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===G.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const F=this._domElement.getBoundingClientRect(),x=I.clientX/F.width,D=I.clientY/F.height;if(x<this._interactiveArea.left||x>this._interactiveArea.right||D<this._interactiveArea.top||D>this._interactiveArea.bottom)return}if(I.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===G.ROTATE||this.mouseButtons.wheel===G.TRUCK){const F=performance.now();u-F<1e3&&this._getClientRect(this._elementRect),u=F}const T=lf?-1:-3,A=I.deltaMode===1?I.deltaY/T:I.deltaY/(T*10),R=this.dollyToCursor?(I.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,P=this.dollyToCursor?(I.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case G.ROTATE:{this._rotateInternal(I.deltaX,I.deltaY),this._isUserControllingRotate=!0;break}case G.TRUCK:{this._truckInternal(I.deltaX,I.deltaY,!1),this._isUserControllingTruck=!0;break}case G.OFFSET:{this._truckInternal(I.deltaX,I.deltaY,!0),this._isUserControllingOffset=!0;break}case G.DOLLY:{this._dollyInternal(-A,R,P),this._isUserControllingDolly=!0;break}case G.ZOOM:{this._zoomInternal(-A,R,P),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},p=I=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===$t.ACTION.NONE){const T=I instanceof PointerEvent?I.pointerId:(I instanceof MouseEvent,0),A=this._findPointerById(T);A&&this._disposePointer(A),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",d);return}I.preventDefault()}},m=I=>{if(!this._enabled)return;if(uo(this._activePointers,Yt),this._getClientRect(this._elementRect),i.copy(Yt),s.copy(Yt),this._activePointers.length>=2){const A=Yt.x-this._activePointers[1].clientX,R=Yt.y-this._activePointers[1].clientY,P=Math.sqrt(A*A+R*R);r.set(0,P);const F=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,x=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;s.set(F,x)}if(this._state=0,!I)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in I&&I.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&&(I.buttons&dt.LEFT)===dt.LEFT&&(this._state=this._state|this.mouseButtons.left),(I.buttons&dt.MIDDLE)===dt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(I.buttons&dt.RIGHT)===dt.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&G.ROTATE)===G.ROTATE||(this._state&G.TOUCH_ROTATE)===G.TOUCH_ROTATE||(this._state&G.TOUCH_DOLLY_ROTATE)===G.TOUCH_DOLLY_ROTATE||(this._state&G.TOUCH_ZOOM_ROTATE)===G.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&G.TRUCK)===G.TRUCK||(this._state&G.TOUCH_TRUCK)===G.TOUCH_TRUCK||(this._state&G.TOUCH_DOLLY_TRUCK)===G.TOUCH_DOLLY_TRUCK||(this._state&G.TOUCH_ZOOM_TRUCK)===G.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&G.DOLLY)===G.DOLLY||(this._state&G.TOUCH_DOLLY)===G.TOUCH_DOLLY||(this._state&G.TOUCH_DOLLY_TRUCK)===G.TOUCH_DOLLY_TRUCK||(this._state&G.TOUCH_DOLLY_OFFSET)===G.TOUCH_DOLLY_OFFSET||(this._state&G.TOUCH_DOLLY_ROTATE)===G.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&G.ZOOM)===G.ZOOM||(this._state&G.TOUCH_ZOOM)===G.TOUCH_ZOOM||(this._state&G.TOUCH_ZOOM_TRUCK)===G.TOUCH_ZOOM_TRUCK||(this._state&G.TOUCH_ZOOM_OFFSET)===G.TOUCH_ZOOM_OFFSET||(this._state&G.TOUCH_ZOOM_ROTATE)===G.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&G.OFFSET)===G.OFFSET||(this._state&G.TOUCH_OFFSET)===G.TOUCH_OFFSET||(this._state&G.TOUCH_DOLLY_OFFSET)===G.TOUCH_DOLLY_OFFSET||(this._state&G.TOUCH_ZOOM_OFFSET)===G.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},E=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,uo(this._activePointers,Yt);const T=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,A=T?-T.deltaX:s.x-Yt.x,R=T?-T.deltaY:s.y-Yt.y;if(s.copy(Yt),((this._state&G.ROTATE)===G.ROTATE||(this._state&G.TOUCH_ROTATE)===G.TOUCH_ROTATE||(this._state&G.TOUCH_DOLLY_ROTATE)===G.TOUCH_DOLLY_ROTATE||(this._state&G.TOUCH_ZOOM_ROTATE)===G.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(A,R),this._isUserControllingRotate=!0),(this._state&G.DOLLY)===G.DOLLY||(this._state&G.ZOOM)===G.ZOOM){const P=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,F=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0,x=this.dollyDragInverted?-1:1;(this._state&G.DOLLY)===G.DOLLY?(this._dollyInternal(x*R*Fn,P,F),this._isUserControllingDolly=!0):(this._zoomInternal(x*R*Fn,P,F),this._isUserControllingZoom=!0)}if((this._state&G.TOUCH_DOLLY)===G.TOUCH_DOLLY||(this._state&G.TOUCH_ZOOM)===G.TOUCH_ZOOM||(this._state&G.TOUCH_DOLLY_TRUCK)===G.TOUCH_DOLLY_TRUCK||(this._state&G.TOUCH_ZOOM_TRUCK)===G.TOUCH_ZOOM_TRUCK||(this._state&G.TOUCH_DOLLY_OFFSET)===G.TOUCH_DOLLY_OFFSET||(this._state&G.TOUCH_ZOOM_OFFSET)===G.TOUCH_ZOOM_OFFSET||(this._state&G.TOUCH_DOLLY_ROTATE)===G.TOUCH_DOLLY_ROTATE||(this._state&G.TOUCH_ZOOM_ROTATE)===G.TOUCH_ZOOM_ROTATE){const P=Yt.x-this._activePointers[1].clientX,F=Yt.y-this._activePointers[1].clientY,x=Math.sqrt(P*P+F*F),D=r.y-x;r.set(0,x);const w=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,L=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&G.TOUCH_DOLLY)===G.TOUCH_DOLLY||(this._state&G.TOUCH_DOLLY_ROTATE)===G.TOUCH_DOLLY_ROTATE||(this._state&G.TOUCH_DOLLY_TRUCK)===G.TOUCH_DOLLY_TRUCK||(this._state&G.TOUCH_DOLLY_OFFSET)===G.TOUCH_DOLLY_OFFSET?(this._dollyInternal(D*Fn,w,L),this._isUserControllingDolly=!0):(this._zoomInternal(D*Fn,w,L),this._isUserControllingZoom=!0)}((this._state&G.TRUCK)===G.TRUCK||(this._state&G.TOUCH_TRUCK)===G.TOUCH_TRUCK||(this._state&G.TOUCH_DOLLY_TRUCK)===G.TOUCH_DOLLY_TRUCK||(this._state&G.TOUCH_ZOOM_TRUCK)===G.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(A,R,!1),this._isUserControllingTruck=!0),((this._state&G.OFFSET)===G.OFFSET||(this._state&G.TOUCH_OFFSET)===G.TOUCH_OFFSET||(this._state&G.TOUCH_DOLLY_OFFSET)===G.TOUCH_DOLLY_OFFSET||(this._state&G.TOUCH_ZOOM_OFFSET)===G.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(A,R,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},g=()=>{uo(this._activePointers,Yt),s.copy(Yt),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",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),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",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",b),this._domElement.ownerDocument.addEventListener("pointerlockerror",v),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",h),m())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",b),this._domElement.ownerDocument.removeEventListener("pointerlockerror",v))};const b=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},v=()=>{this.unlockPointer()};this._addAllEventListeners=I=>{this._domElement=I,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",o),cf&&this._domElement.addEventListener("mousedown",a),this._domElement.addEventListener("pointercancel",h),this._domElement.addEventListener("wheel",f,{passive:!1}),this._domElement.addEventListener("contextmenu",p)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",o),this._domElement.removeEventListener("mousedown",a),this._domElement.removeEventListener("pointercancel",h),this._domElement.removeEventListener("wheel",f,{passive:!1}),this._domElement.removeEventListener("contextmenu",p),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.removeEventListener("pointerlockchange",b),this._domElement.ownerDocument.removeEventListener("pointerlockerror",v))},this.cancel=()=>{this._state!==G.NONE&&(this._state=G.NONE,this._activePointers.length=0,g())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(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(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=ce(e.width,0,1),this._interactiveArea.height=ce(e.height,0,1),this._interactiveArea.x=ce(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=ce(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,i=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,i)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,i=!1){this._isUserControllingRotate=!1;const s=ce(e,this.minAzimuthAngle,this.maxAzimuthAngle),r=ce(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=s,this._sphericalEnd.phi=r,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,i||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const o=!i||It(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&It(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(o)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Pi.NONE,this._changedDolly=0,this._dollyToNoClamp(ce(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const i=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const o=this._collisionTest(),a=It(o,this._spherical.radius);if(!(i>e)&&a)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,o)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const r=!t||It(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(r)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Es).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const i=!t||It(this._target.x,this._targetEnd.x,this.restThreshold)&&It(this._target.y,this._targetEnd.y,this.restThreshold)&&It(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(i)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=ce(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const i=!t||It(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(i)}pan(e,t,i=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,i)}truck(e,t,i=!1){this._camera.updateMatrix(),ge.setFromMatrixColumn(this._camera.matrix,0),Ee.setFromMatrixColumn(this._camera.matrix,1),ge.multiplyScalar(e),Ee.multiplyScalar(-t);const s=ut.copy(ge).add(Ee),r=gt.copy(this._targetEnd).add(s);return this.moveTo(r.x,r.y,r.z,i)}forward(e,t=!1){ut.setFromMatrixColumn(this._camera.matrix,0),ut.crossVectors(this._camera.up,ut),ut.multiplyScalar(e);const i=gt.copy(this._targetEnd).add(ut);return this.moveTo(i.x,i.y,i.z,t)}elevate(e,t=!1){return ut.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+ut.x,this._targetEnd.y+ut.y,this._targetEnd.z+ut.z,t)}moveTo(e,t,i,s=!1){this._isUserControllingTruck=!1;const r=ut.set(e,t,i).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,r,this.boundaryFriction),this._needsUpdate=!0,s||this._target.copy(this._targetEnd);const o=!s||It(this._target.x,this._targetEnd.x,this.restThreshold)&&It(this._target.y,this._targetEnd.y,this.restThreshold)&&It(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}lookInDirectionOf(e,t,i,s=!1){const a=ut.set(e,t,i).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(a.x,a.y,a.z,s)}fitToBox(e,t,{cover:i=!1,paddingLeft:s=0,paddingRight:r=0,paddingBottom:o=0,paddingTop:a=0}={}){const l=[],c=e.isBox3?Di.copy(e):Di.setFromObject(e);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const h=rl(this._sphericalEnd.theta,nl),d=rl(this._sphericalEnd.phi,nl);l.push(this.rotateTo(h,d,t));const u=ut.setFromSpherical(this._sphericalEnd).normalize(),f=dl.setFromUnitVectors(u,po),p=It(Math.abs(u.y),1);p&&f.multiply(go.setFromAxisAngle(On,h)),f.multiply(this._yAxisUpSpaceInverse);const m=hl.makeEmpty();gt.copy(c.min).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.min).setX(c.max.x).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.min).setY(c.max.y).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.max).setZ(c.min.z).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.min).setZ(c.max.z).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.max).setY(c.min.y).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.max).setX(c.min.x).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.max).applyQuaternion(f),m.expandByPoint(gt),m.min.x-=s,m.min.y-=o,m.max.x+=r,m.max.y+=a,f.setFromUnitVectors(po,u),p&&f.premultiply(go.invert()),f.premultiply(this._yAxisUpSpace);const E=m.getSize(ut),g=m.getCenter(gt).applyQuaternion(f);if(ti(this._camera)){const b=this.getDistanceToFitBox(E.x,E.y,E.z,i);l.push(this.moveTo(g.x,g.y,g.z,t)),l.push(this.dollyTo(b,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(De(this._camera)){const b=this._camera,v=b.right-b.left,I=b.top-b.bottom,T=i?Math.max(v/E.x,I/E.y):Math.min(v/E.x,I/E.y);l.push(this.moveTo(g.x,g.y,g.z,t)),l.push(this.zoomTo(T,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const i=[],r=e instanceof ht.Sphere?mo.copy(e):$t.createBoundingSphere(e,mo);if(i.push(this.moveTo(r.center.x,r.center.y,r.center.z,t)),ti(this._camera)){const o=this.getDistanceToFitSphere(r.radius);i.push(this.dollyTo(o,t))}else if(De(this._camera)){const o=this._camera.right-this._camera.left,a=this._camera.top-this._camera.bottom,l=2*r.radius,c=Math.min(o/l,a/l);i.push(this.zoomTo(c,t))}return i.push(this.setFocalOffset(0,0,0,t)),Promise.all(i)}setLookAt(e,t,i,s,r,o,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Pi.NONE,this._changedDolly=0;const l=gt.set(s,r,o),c=ut.set(e,t,i);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(c.sub(l).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const h=!a||It(this._target.x,this._targetEnd.x,this.restThreshold)&&It(this._target.y,this._targetEnd.y,this.restThreshold)&&It(this._target.z,this._targetEnd.z,this.restThreshold)&&It(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&It(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&It(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(h)}lerpLookAt(e,t,i,s,r,o,a,l,c,h,d,u,f,p=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Pi.NONE,this._changedDolly=0;const m=ut.set(s,r,o),E=gt.set(e,t,i);Kt.setFromVector3(E.sub(m).applyQuaternion(this._yAxisUpSpace));const g=Mi.set(h,d,u),b=gt.set(a,l,c);Is.setFromVector3(b.sub(g).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(m.lerp(g,f));const v=Is.theta-Kt.theta,I=Is.phi-Kt.phi,T=Is.radius-Kt.radius;this._sphericalEnd.set(Kt.radius+T*f,Kt.phi+I*f,Kt.theta+v*f),this.normalizeRotations(),this._needsUpdate=!0,p||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const A=!p||It(this._target.x,this._targetEnd.x,this.restThreshold)&&It(this._target.y,this._targetEnd.y,this.restThreshold)&&It(this._target.z,this._targetEnd.z,this.restThreshold)&&It(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&It(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&It(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(A)}setPosition(e,t,i,s=!1){return this.setLookAt(e,t,i,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,s)}setTarget(e,t,i,s=!1){const r=this.getPosition(ut),o=this.setLookAt(r.x,r.y,r.z,e,t,i,s);return this._sphericalEnd.phi=ce(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),o}setFocalOffset(e,t,i,s=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,i),this._needsUpdate=!0,s||this._focalOffset.copy(this._focalOffsetEnd);const r=!s||It(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&It(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&It(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}setOrbitPoint(e,t,i){this._camera.updateMatrixWorld(),ge.setFromMatrixColumn(this._camera.matrixWorldInverse,0),Ee.setFromMatrixColumn(this._camera.matrixWorldInverse,1),ei.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const s=ut.set(e,t,i),r=s.distanceTo(this._camera.position),o=s.sub(this._camera.position);ge.multiplyScalar(o.x),Ee.multiplyScalar(o.y),ei.multiplyScalar(o.z),ut.copy(ge).add(Ee).add(ei),ut.z=ut.z+r,this.dollyTo(r,!1),this.setFocalOffset(-ut.x,ut.y,-ut.z,!1),this.moveTo(e,t,i,!1)}setBoundary(e){if(!e){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(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,i,s){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new ht.Vector4,typeof e=="number"?this._viewport.set(e,t,i,s):this._viewport.copy(e)}getDistanceToFitBox(e,t,i,s=!1){if(fo(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const r=e/t,o=this._camera.getEffectiveFOV()*ps,a=this._camera.aspect;return((s?r>a:r<a)?t:e/a)*.5/Math.tan(o*.5)+i*.5}getDistanceToFitSphere(e){if(fo(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*ps,i=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,s=1<this._camera.aspect?t:i;return e/Math.sin(s*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new ht.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new ht.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e&&e instanceof ht.Spherical?e:new ht.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new ht.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%Li,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=Li),this._spherical.theta+=Li*Math.round((this._sphericalEnd.theta-this._spherical.theta)/Li)}reset(e=!1){if(!It(this._camera.up.x,this._cameraUp0.x)||!It(this._camera.up.y,this._cameraUp0.y)||!It(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const i=this.getPosition(ut);this.updateCameraUp(),this.setPosition(i.x,i.y,i.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,e),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,e),this.zoomTo(this._zoom0,e)];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,On),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=ut.subVectors(this._target,this._camera.position).normalize(),t=gt.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const i=this.getPosition(ut);this.updateCameraUp(),this.setPosition(i.x,i.y,i.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,i=this._sphericalEnd.phi-this._spherical.phi,s=this._sphericalEnd.radius-this._spherical.radius,r=ll.subVectors(this._targetEnd,this._target),o=cl.subVectors(this._focalOffsetEnd,this._focalOffset),a=this._zoomEnd-this._zoom;if(vt(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Sn(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,d,1/0,e),this._needsUpdate=!0}if(vt(i))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Sn(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,d,1/0,e),this._needsUpdate=!0}if(vt(s))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const d=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Sn(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,d,this.maxSpeed,e),this._needsUpdate=!0}if(vt(r.x)&&vt(r.y)&&vt(r.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const d=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;ol(this._target,this._targetEnd,this._targetVelocity,d,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(vt(o.x)&&vt(o.y)&&vt(o.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const d=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;ol(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,d,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(vt(a))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const d=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Sn(this._zoom,this._zoomEnd,this._zoomVelocity,d,1/0,e)}if(this.dollyToCursor){if(ti(this._camera)&&this._changedDolly!==0){const d=this._spherical.radius-this._lastDistance,u=this._camera,f=this._getCameraDirection(Es),p=ut.copy(f).cross(u.up).normalize();p.lengthSq()===0&&(p.x=1);const m=gt.crossVectors(p,f),E=this._sphericalEnd.radius*Math.tan(u.getEffectiveFOV()*ps*.5),b=(this._sphericalEnd.radius-d-this._sphericalEnd.radius)/this._sphericalEnd.radius,v=Mi.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x*E*u.aspect)).add(m.multiplyScalar(this._dollyControlCoord.y*E)),I=ut.copy(this._targetEnd).lerp(v,b),T=this._lastDollyDirection===Pi.IN&&this._spherical.radius<=this.minDistance,A=this._lastDollyDirection===Pi.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(T||A)){this._sphericalEnd.radius-=d,this._spherical.radius-=d;const P=gt.copy(f).multiplyScalar(-d);I.add(P)}this._boundary.clampPoint(I,I);const R=gt.subVectors(I,this._targetEnd);this._targetEnd.copy(I),this._target.add(R),this._changedDolly-=d,vt(this._changedDolly)&&(this._changedDolly=0)}else if(De(this._camera)&&this._changedZoom!==0){const d=this._zoom-this._lastZoom,u=this._camera,f=ut.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(u.near+u.far)/(u.near-u.far)).unproject(u),p=gt.set(0,0,-1).applyQuaternion(u.quaternion),m=Mi.copy(f).add(p.multiplyScalar(-f.dot(u.up))),g=-(this._zoom-d-this._zoom)/this._zoom,b=this._getCameraDirection(Es),v=this._targetEnd.dot(b),I=ut.copy(this._targetEnd).lerp(m,g),T=I.dot(b),A=b.multiplyScalar(T-v);I.sub(A),this._boundary.clampPoint(I,I);const R=gt.subVectors(I,this._targetEnd);this._targetEnd.copy(I),this._target.add(R),this._changedZoom-=d,vt(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 l=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,l),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!vt(this._focalOffset.x)||!vt(this._focalOffset.y)||!vt(this._focalOffset.z))&&(this._camera.updateMatrixWorld(),ge.setFromMatrixColumn(this._camera.matrix,0),Ee.setFromMatrixColumn(this._camera.matrix,1),ei.setFromMatrixColumn(this._camera.matrix,2),ge.multiplyScalar(this._focalOffset.x),Ee.multiplyScalar(-this._focalOffset.y),ei.multiplyScalar(this._focalOffset.z),ut.copy(ge).add(Ee).add(ei),this._camera.position.add(ut)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),ut.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"}),vt(t,this.restThreshold)&&vt(i,this.restThreshold)&&vt(s,this.restThreshold)&&vt(r.x,this.restThreshold)&&vt(r.y,this.restThreshold)&&vt(r.z,this.restThreshold)&&vt(o.x,this.restThreshold)&&vt(o.y,this.restThreshold)&&vt(o.z,this.restThreshold)&&vt(a,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:ms(this.maxDistance),minZoom:this.minZoom,maxZoom:ms(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:ms(this.maxPolarAngle),minAzimuthAngle:ms(this.minAzimuthAngle),maxAzimuthAngle:ms(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:ut.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(e,t=!1){const i=JSON.parse(e);this.enabled=i.enabled,this.minDistance=i.minDistance,this.maxDistance=gs(i.maxDistance),this.minZoom=i.minZoom,this.maxZoom=gs(i.maxZoom),this.minPolarAngle=i.minPolarAngle,this.maxPolarAngle=gs(i.maxPolarAngle),this.minAzimuthAngle=gs(i.minAzimuthAngle),this.maxAzimuthAngle=gs(i.maxAzimuthAngle),this.smoothTime=i.smoothTime,this.draggingSmoothTime=i.draggingSmoothTime,this.dollySpeed=i.dollySpeed,this.truckSpeed=i.truckSpeed,this.dollyToCursor=i.dollyToCursor,this.verticalDragToForward=i.verticalDragToForward,this._target0.fromArray(i.target0),this._position0.fromArray(i.position0),this._zoom0=i.zoom0,this._focalOffset0.fromArray(i.focalOffset0),this.moveTo(i.target[0],i.target[1],i.target[2],t),Kt.setFromVector3(ut.fromArray(i.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(Kt.theta,Kt.phi,t),this.dollyTo(Kt.radius,t),this.zoomTo(i.zoom,t),this.setFocalOffset(i.focalOffset[0],i.focalOffset[1],i.focalOffset[2],t),this._needsUpdate=!0}connect(e){if(this._domElement){console.warn("camera-controls is already connected.");return}e.setAttribute("data-camera-controls-version",af),this._addAllEventListeners(e),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(e){return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(e){return this._getTargetDirection(e).negate()}_findPointerById(e){return this._activePointers.find(t=>t.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,i){const s=t.lengthSq();if(s===0)return e;const r=gt.copy(t).add(e),a=this._boundary.clampPoint(r,Mi).sub(r),l=a.lengthSq();if(l===0)return e.add(t);if(l===s)return e;if(i===0)return e.add(t).add(a);{const c=1+i*l/t.dot(a);return e.add(gt.copy(t).multiplyScalar(c)).add(a.multiplyScalar(1-i))}}_updateNearPlaneCorners(){if(ti(this._camera)){const e=this._camera,t=e.near,i=e.getEffectiveFOV()*ps,s=Math.tan(i*.5)*t,r=s*e.aspect;this._nearPlaneCorners[0].set(-r,-s,0),this._nearPlaneCorners[1].set(r,-s,0),this._nearPlaneCorners[2].set(r,s,0),this._nearPlaneCorners[3].set(-r,s,0)}else if(De(this._camera)){const e=this._camera,t=1/e.zoom,i=e.left*t,s=e.right*t,r=e.top*t,o=e.bottom*t;this._nearPlaneCorners[0].set(i,r,0),this._nearPlaneCorners[1].set(s,r,0),this._nearPlaneCorners[2].set(s,o,0),this._nearPlaneCorners[3].set(i,o,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||fo(this._camera,"_collisionTest"))return e;const i=this._getTargetDirection(Es);Eo.lookAt(al,i,this._camera.up);for(let s=0;s<4;s++){const r=gt.copy(this._nearPlaneCorners[s]);r.applyMatrix4(Eo);const o=Mi.addVectors(this._target,r);xn.set(o,i),xn.far=this._spherical.radius+1;const a=xn.intersectObjects(this.colliderMeshes);a.length!==0&&a[0].distance<e&&(e=a[0].distance)}return e}_getClientRect(e){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return e.x=t.left,e.y=t.top,this._viewport?(e.x+=this._viewport.x,e.y+=t.height-this._viewport.w-this._viewport.y,e.width=this._viewport.z,e.height=this._viewport.w):(e.width=t.width,e.height=t.height),e}_createOnRestPromise(e){return e?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const i=()=>{this.removeEventListener("rest",i),t()};this.addEventListener("rest",i)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){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(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new ht.Sphere){const i=t,s=i.center;Di.makeEmpty(),e.traverseVisible(o=>{o.isMesh&&Di.expandByObject(o)}),Di.getCenter(s);let r=0;return e.traverseVisible(o=>{if(!o.isMesh)return;const a=o,l=a.geometry.clone();l.applyMatrix4(a.matrixWorld);const h=l.attributes.position;for(let d=0,u=h.count;d<u;d++)ut.fromBufferAttribute(h,d),r=Math.max(r,s.distanceToSquared(ut))}),i.radius=Math.sqrt(r),i}}class Vi extends Tc{constructor(t){super(t);y(this,"onBeforeUpdate",new Q);y(this,"onAfterUpdate",new Q);y(this,"onAspectUpdated",new Q);y(this,"onDisposed",new Q);y(this,"three");y(this,"_allControls",new Map);y(this,"updateAspect",()=>{var t;if(!(!this.currentWorld||!this.currentWorld.renderer)){if(this.three instanceof M.OrthographicCamera){this.onAspectUpdated.trigger();return}if((t=this.currentWorld.renderer)!=null&&t.isResizeable()){const i=this.currentWorld.renderer.getSize();this.three.aspect=i.width/i.height,this.three.updateProjectionMatrix(),this.onAspectUpdated.trigger()}}});this.three=this.setupCamera(),this.setupEvents(!0),this.onWorldChanged.add(({action:i,world:s})=>{if(i==="added"){const r=this.newCameraControls();this._allControls.set(s.uuid,r)}if(i==="removed"){const r=this._allControls.get(s.uuid);r&&(r.dispose(),this._allControls.delete(s.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,i]of this._allControls)i.dispose()}update(t){this.enabled&&(this.onBeforeUpdate.trigger(this),this.controls.update(t),this.onAfterUpdate.trigger(this))}setupCamera(){const t=window.innerWidth/window.innerHeight,i=new M.PerspectiveCamera(60,t,1,1e3);return i.position.set(50,50,50),i.lookAt(new M.Vector3(0,0,0)),i}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!");$t.install({THREE:Vi.getSubsetOfThree()});const{domElement:t}=this.currentWorld.renderer.three,i=new $t(this.three,t);return i.smoothTime=.2,i.dollyToCursor=!0,i.infinityDolly=!0,i.minDistance=6,i}setupEvents(t){t?window.addEventListener("resize",this.updateAspect):window.removeEventListener("resize",this.updateAspect)}static getSubsetOfThree(){return{MOUSE:M.MOUSE,Vector2:M.Vector2,Vector3:M.Vector3,Vector4:M.Vector4,Quaternion:M.Quaternion,Matrix4:M.Matrix4,Spherical:M.Spherical,Box3:M.Box3,Sphere:M.Sphere,Raycaster:M.Raycaster,MathUtils:M.MathUtils}}}const Er=class Er extends Ot{constructor(t){super(t);y(this,"onAfterUpdate",new Q);y(this,"onBeforeUpdate",new Q);y(this,"onDisposed",new Q);y(this,"onWorldCreated",new Q);y(this,"onWorldDeleted",new Q);y(this,"list",new Map);y(this,"enabled",!0);t.add(Er.uuid,this)}create(){const t=new Sc(this.components),i=t.uuid;if(this.list.has(i))throw new Error("There is already a world with this name!");return this.list.set(i,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 i=t.uuid;this.list.delete(t.uuid),t.dispose(),this.onWorldDeleted.trigger(i)}dispose(){this.enabled=!1;for(const[t,i]of this.list)i.dispose();this.list.clear(),this.onDisposed.trigger()}update(t){if(this.enabled)for(const[i,s]of this.list)s.update(t)}};y(Er,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let Zn=Er;function hf(n,e,t,i){return new Promise((s,r)=>{function o(){const a=n.clientWaitSync(e,t,0);if(a===n.WAIT_FAILED){r();return}if(a===n.TIMEOUT_EXPIRED){setTimeout(o,i);return}s()}o()})}async function df(n,e,t,i,s,r,o){const a=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0);n.flush(),await hf(n,a,0,10),n.deleteSync(a),n.bindBuffer(e,t),n.getBufferSubData(e,i,s,r,o),n.bindBuffer(e,null)}async function fa(n,e,t,i,s,r,o,a){const l=n.createBuffer();return n.bindBuffer(n.PIXEL_PACK_BUFFER,l),n.bufferData(n.PIXEL_PACK_BUFFER,a.byteLength,n.STREAM_READ),n.readPixels(e,t,i,s,r,o,0),n.bindBuffer(n.PIXEL_PACK_BUFFER,null),await df(n,n.PIXEL_PACK_BUFFER,l,0,a),n.deleteBuffer(l),a}class Nc{constructor(e,t,i){y(this,"onDisposed",new Q);y(this,"onViewUpdated",new Ss);y(this,"enabled",!0);y(this,"needsUpdate",!1);y(this,"renderDebugFrame",!1);y(this,"components");y(this,"world");y(this,"renderer");y(this,"autoUpdate",!0);y(this,"updateInterval",1e3);y(this,"worker");y(this,"scene",new M.Scene);y(this,"_width",512);y(this,"_height",512);y(this,"_availableColor",1);y(this,"renderTarget");y(this,"bufferSize");y(this,"_buffer");y(this,"_isWorkerBusy",!1);y(this,"updateVisibility",async e=>{if(!this.enabled||!this.needsUpdate&&!e||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 i=this.renderer.getContext();await fa(i,0,0,this._width,this._height,i.RGBA,i.UNSIGNED_BYTE,this._buffer),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=e,this.applySettings(i),this.world=t,this.renderer=new M.WebGLRenderer,this.renderTarget=new M.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 s=`
10
+ */const dt={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}),Mi={NONE:0,IN:1,OUT:-1};function si(r){return r.isPerspectiveCamera}function ze(r){return r.isOrthographicCamera}const Di=Math.PI*2,ll=Math.PI/2,Lc=1e-5,bs=Math.PI/180;function de(r,e,t){return Math.max(e,Math.min(t,r))}function vt(r,e=Lc){return Math.abs(r)<e}function bt(r,e,t=Lc){return vt(r-e,t)}function cl(r,e){return Math.round(r/e)*e}function Is(r){return isFinite(r)?r:r<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Cs(r){return Math.abs(r)<Number.MAX_VALUE?r:r*(1/0)}function On(r,e,t,i,s=1/0,n){i=Math.max(1e-4,i);const o=2/i,a=o*n,l=1/(1+a+.48*a*a+.235*a*a*a);let c=r-e;const h=e,d=s*i;c=de(c,-d,d),e=r-c;const u=(t.value+o*c)*n;t.value=(t.value-o*u)*l;let f=e+(c+u)*l;return h-r>0==f>h&&(f=h,t.value=(f-h)/n),f}function hl(r,e,t,i,s=1/0,n,o){i=Math.max(1e-4,i);const a=2/i,l=a*n,c=1/(1+l+.48*l*l+.235*l*l*l);let h=e.x,d=e.y,u=e.z,f=r.x-h,p=r.y-d,m=r.z-u;const E=h,g=d,I=u,T=s*i,b=T*T,v=f*f+p*p+m*m;if(v>b){const U=Math.sqrt(v);f=f/U*T,p=p/U*T,m=m/U*T}h=r.x-f,d=r.y-p,u=r.z-m;const A=(t.x+a*f)*n,S=(t.y+a*p)*n,N=(t.z+a*m)*n;t.x=(t.x-a*A)*c,t.y=(t.y-a*S)*c,t.z=(t.z-a*N)*c,o.x=h+(f+A)*c,o.y=d+(p+S)*c,o.z=u+(m+N)*c;const R=E-r.x,P=g-r.y,M=I-r.z,w=o.x-E,L=o.y-g,C=o.z-I;return R*w+P*L+M*C>0&&(o.x=E,o.y=g,o.z=I,t.x=(o.x-E)/n,t.y=(o.y-g)/n,t.z=(o.z-I)/n),o}function po(r,e){e.set(0,0),r.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=r.length,e.y/=r.length}function mo(r,e){return ze(r)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class df{constructor(){this._listeners={}}addEventListener(e,t){const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const s=this._listeners[e];if(s!==void 0){const n=s.indexOf(t);n!==-1&&s.splice(n,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const i=this._listeners[e.type];if(i!==void 0){e.target=this;const s=i.slice(0);for(let n=0,o=s.length;n<o;n++)s[n].call(this,e)}}}const uf="2.7.3",xn=1/8,Mc=typeof window<"u",ff=Mc&&/Mac/.test(navigator.platform),pf=!(Mc&&"PointerEvent"in window);let ht,dl,Nn,go,jt,ut,gt,Ui,ys,be,Ie,ni,ul,fl,te,_s,ki,pl,Eo,ml,bo,Io,Pn;class Gt extends df{static install(e){ht=e.THREE,dl=Object.freeze(new ht.Vector3(0,0,0)),Nn=Object.freeze(new ht.Vector3(0,1,0)),go=Object.freeze(new ht.Vector3(0,0,1)),jt=new ht.Vector2,ut=new ht.Vector3,gt=new ht.Vector3,Ui=new ht.Vector3,ys=new ht.Vector3,be=new ht.Vector3,Ie=new ht.Vector3,ni=new ht.Vector3,ul=new ht.Vector3,fl=new ht.Vector3,te=new ht.Spherical,_s=new ht.Spherical,ki=new ht.Box3,pl=new ht.Box3,Eo=new ht.Sphere,ml=new ht.Quaternion,bo=new ht.Quaternion,Io=new ht.Matrix4,Pn=new ht.Raycaster}static get ACTION(){return H}constructor(e,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=Mi.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new ht.Vector3,this._focalOffsetVelocity=new ht.Vector3,this._zoomVelocity={value:0},this._truckInternal=(b,v,A)=>{let S,N;if(si(this._camera)){const R=ut.copy(this._camera.position).sub(this._target),P=this._camera.getEffectiveFOV()*bs,M=R.length()*Math.tan(P*.5);S=this.truckSpeed*b*M/this._elementRect.height,N=this.truckSpeed*v*M/this._elementRect.height}else if(ze(this._camera)){const R=this._camera;S=b*(R.right-R.left)/R.zoom/this._elementRect.width,N=v*(R.top-R.bottom)/R.zoom/this._elementRect.height}else return;this.verticalDragToForward?(A?this.setFocalOffset(this._focalOffsetEnd.x+S,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(S,0,!0),this.forward(-N,!0)):A?this.setFocalOffset(this._focalOffsetEnd.x+S,this._focalOffsetEnd.y+N,this._focalOffsetEnd.z,!0):this.truck(S,N,!0)},this._rotateInternal=(b,v)=>{const A=Di*this.azimuthRotateSpeed*b/this._elementRect.height,S=Di*this.polarRotateSpeed*v/this._elementRect.height;this.rotate(A,S,!0)},this._dollyInternal=(b,v,A)=>{const S=Math.pow(.95,-b*this.dollySpeed),N=this._sphericalEnd.radius,R=this._sphericalEnd.radius*S,P=de(R,this.minDistance,this.maxDistance),M=P-R;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(R,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(M,!0),this._dollyToNoClamp(P,!0)):this._dollyToNoClamp(P,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?R:P)-N,this._dollyControlCoord.set(v,A)),this._lastDollyDirection=Math.sign(-b)},this._zoomInternal=(b,v,A)=>{const S=Math.pow(.95,b*this.dollySpeed),N=this._zoom,R=this._zoom*S;this.zoomTo(R,!0),this.dollyToCursor&&(this._changedZoom+=R-N,this._dollyControlCoord.set(v,A))},typeof ht>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new ht.Quaternion().setFromUnitVectors(this._camera.up,Nn),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=H.NONE,this._target=new ht.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new ht.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new ht.Spherical().setFromVector3(ut.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 ht.Vector3,new ht.Vector3,new ht.Vector3,new ht.Vector3],this._updateNearPlaneCorners(),this._boundary=new ht.Box3(new ht.Vector3(-1/0,-1/0,-1/0),new ht.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 ht.Vector2,this.mouseButtons={left:H.ROTATE,middle:H.DOLLY,right:H.TRUCK,wheel:si(this._camera)?H.DOLLY:ze(this._camera)?H.ZOOM:H.NONE},this.touches={one:H.TOUCH_ROTATE,two:si(this._camera)?H.TOUCH_DOLLY_TRUCK:ze(this._camera)?H.TOUCH_ZOOM_TRUCK:H.NONE,three:H.TOUCH_TRUCK};const i=new ht.Vector2,s=new ht.Vector2,n=new ht.Vector2,o=b=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const S=this._domElement.getBoundingClientRect(),N=b.clientX/S.width,R=b.clientY/S.height;if(N<this._interactiveArea.left||N>this._interactiveArea.right||R<this._interactiveArea.top||R>this._interactiveArea.bottom)return}const v=b.pointerType!=="mouse"?null:(b.buttons&dt.LEFT)===dt.LEFT?dt.LEFT:(b.buttons&dt.MIDDLE)===dt.MIDDLE?dt.MIDDLE:(b.buttons&dt.RIGHT)===dt.RIGHT?dt.RIGHT:null;if(v!==null){const S=this._findPointerByMouseButton(v);S&&this._disposePointer(S)}if((b.buttons&dt.LEFT)===dt.LEFT&&this._lockedPointer)return;const A={pointerId:b.pointerId,clientX:b.clientX,clientY:b.clientY,deltaX:0,deltaY:0,mouseButton:v};this._activePointers.push(A),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",h),this._isDragging=!0,m(b)},a=b=>{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 S=this._domElement.getBoundingClientRect(),N=b.clientX/S.width,R=b.clientY/S.height;if(N<this._interactiveArea.left||N>this._interactiveArea.right||R<this._interactiveArea.top||R>this._interactiveArea.bottom)return}const v=(b.buttons&dt.LEFT)===dt.LEFT?dt.LEFT:(b.buttons&dt.MIDDLE)===dt.MIDDLE?dt.MIDDLE:(b.buttons&dt.RIGHT)===dt.RIGHT?dt.RIGHT:null;if(v!==null){const S=this._findPointerByMouseButton(v);S&&this._disposePointer(S)}const A={pointerId:1,clientX:b.clientX,clientY:b.clientY,deltaX:0,deltaY:0,mouseButton:(b.buttons&dt.LEFT)===dt.LEFT?dt.LEFT:(b.buttons&dt.MIDDLE)===dt.LEFT?dt.MIDDLE:(b.buttons&dt.RIGHT)===dt.LEFT?dt.RIGHT:null};this._activePointers.push(A),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.addEventListener("mousemove",c),this._domElement.ownerDocument.addEventListener("mouseup",d),this._isDragging=!0,m(b)},l=b=>{b.cancelable&&b.preventDefault();const v=b.pointerId,A=this._lockedPointer||this._findPointerById(v);if(A){if(A.clientX=b.clientX,A.clientY=b.clientY,A.deltaX=b.movementX,A.deltaY=b.movementY,this._state=0,b.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&&(b.buttons&dt.LEFT)===dt.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(b.buttons&dt.MIDDLE)===dt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(b.buttons&dt.RIGHT)===dt.RIGHT&&(this._state=this._state|this.mouseButtons.right);E()}},c=b=>{const v=this._lockedPointer||this._findPointerById(1);v&&(v.clientX=b.clientX,v.clientY=b.clientY,v.deltaX=b.movementX,v.deltaY=b.movementY,this._state=0,(this._lockedPointer||(b.buttons&dt.LEFT)===dt.LEFT)&&(this._state=this._state|this.mouseButtons.left),(b.buttons&dt.MIDDLE)===dt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(b.buttons&dt.RIGHT)===dt.RIGHT&&(this._state=this._state|this.mouseButtons.right),E())},h=b=>{const v=this._findPointerById(b.pointerId);if(!(v&&v===this._lockedPointer)){if(v&&this._disposePointer(v),b.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;g()}},d=()=>{const b=this._findPointerById(1);b&&b===this._lockedPointer||(b&&this._disposePointer(b),this._state=H.NONE,g())};let u=-1;const f=b=>{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 R=this._domElement.getBoundingClientRect(),P=b.clientX/R.width,M=b.clientY/R.height;if(P<this._interactiveArea.left||P>this._interactiveArea.right||M<this._interactiveArea.top||M>this._interactiveArea.bottom)return}if(b.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===H.ROTATE||this.mouseButtons.wheel===H.TRUCK){const R=performance.now();u-R<1e3&&this._getClientRect(this._elementRect),u=R}const v=ff?-1:-3,A=b.deltaMode===1?b.deltaY/v:b.deltaY/(v*10),S=this.dollyToCursor?(b.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,N=this.dollyToCursor?(b.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case H.ROTATE:{this._rotateInternal(b.deltaX,b.deltaY),this._isUserControllingRotate=!0;break}case H.TRUCK:{this._truckInternal(b.deltaX,b.deltaY,!1),this._isUserControllingTruck=!0;break}case H.OFFSET:{this._truckInternal(b.deltaX,b.deltaY,!0),this._isUserControllingOffset=!0;break}case H.DOLLY:{this._dollyInternal(-A,S,N),this._isUserControllingDolly=!0;break}case H.ZOOM:{this._zoomInternal(-A,S,N),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},p=b=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===Gt.ACTION.NONE){const v=b instanceof PointerEvent?b.pointerId:(b instanceof MouseEvent,0),A=this._findPointerById(v);A&&this._disposePointer(A),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",d);return}b.preventDefault()}},m=b=>{if(!this._enabled)return;if(po(this._activePointers,jt),this._getClientRect(this._elementRect),i.copy(jt),s.copy(jt),this._activePointers.length>=2){const A=jt.x-this._activePointers[1].clientX,S=jt.y-this._activePointers[1].clientY,N=Math.sqrt(A*A+S*S);n.set(0,N);const R=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,P=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;s.set(R,P)}if(this._state=0,!b)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in b&&b.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&&(b.buttons&dt.LEFT)===dt.LEFT&&(this._state=this._state|this.mouseButtons.left),(b.buttons&dt.MIDDLE)===dt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(b.buttons&dt.RIGHT)===dt.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"})},E=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,po(this._activePointers,jt);const v=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,A=v?-v.deltaX:s.x-jt.x,S=v?-v.deltaY:s.y-jt.y;if(s.copy(jt),((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(A,S),this._isUserControllingRotate=!0),(this._state&H.DOLLY)===H.DOLLY||(this._state&H.ZOOM)===H.ZOOM){const N=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,R=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0,P=this.dollyDragInverted?-1:1;(this._state&H.DOLLY)===H.DOLLY?(this._dollyInternal(P*S*xn,N,R),this._isUserControllingDolly=!0):(this._zoomInternal(P*S*xn,N,R),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 N=jt.x-this._activePointers[1].clientX,R=jt.y-this._activePointers[1].clientY,P=Math.sqrt(N*N+R*R),M=n.y-P;n.set(0,P);const w=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,L=this.dollyToCursor?(s.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(M*xn,w,L),this._isUserControllingDolly=!0):(this._zoomInternal(M*xn,w,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(A,S,!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(A,S,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},g=()=>{po(this._activePointers,jt),s.copy(jt),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",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),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",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",I),this._domElement.ownerDocument.addEventListener("pointerlockerror",T),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",h),m())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",I),this._domElement.ownerDocument.removeEventListener("pointerlockerror",T))};const I=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},T=()=>{this.unlockPointer()};this._addAllEventListeners=b=>{this._domElement=b,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",o),pf&&this._domElement.addEventListener("mousedown",a),this._domElement.addEventListener("pointercancel",h),this._domElement.addEventListener("wheel",f,{passive:!1}),this._domElement.addEventListener("contextmenu",p)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",o),this._domElement.removeEventListener("mousedown",a),this._domElement.removeEventListener("pointercancel",h),this._domElement.removeEventListener("wheel",f,{passive:!1}),this._domElement.removeEventListener("contextmenu",p),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",h),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.removeEventListener("pointerlockchange",I),this._domElement.ownerDocument.removeEventListener("pointerlockerror",T))},this.cancel=()=>{this._state!==H.NONE&&(this._state=H.NONE,this._activePointers.length=0,g())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(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(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=de(e.width,0,1),this._interactiveArea.height=de(e.height,0,1),this._interactiveArea.x=de(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=de(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,i=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,i)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,i=!1){this._isUserControllingRotate=!1;const s=de(e,this.minAzimuthAngle,this.maxAzimuthAngle),n=de(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=s,this._sphericalEnd.phi=n,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,i||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const o=!i||bt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&bt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(o)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Mi.NONE,this._changedDolly=0,this._dollyToNoClamp(de(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const i=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const o=this._collisionTest(),a=bt(o,this._spherical.radius);if(!(i>e)&&a)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,o)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const n=!t||bt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(n)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(ys).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const i=!t||bt(this._target.x,this._targetEnd.x,this.restThreshold)&&bt(this._target.y,this._targetEnd.y,this.restThreshold)&&bt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(i)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=de(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const i=!t||bt(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(i)}pan(e,t,i=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,i)}truck(e,t,i=!1){this._camera.updateMatrix(),be.setFromMatrixColumn(this._camera.matrix,0),Ie.setFromMatrixColumn(this._camera.matrix,1),be.multiplyScalar(e),Ie.multiplyScalar(-t);const s=ut.copy(be).add(Ie),n=gt.copy(this._targetEnd).add(s);return this.moveTo(n.x,n.y,n.z,i)}forward(e,t=!1){ut.setFromMatrixColumn(this._camera.matrix,0),ut.crossVectors(this._camera.up,ut),ut.multiplyScalar(e);const i=gt.copy(this._targetEnd).add(ut);return this.moveTo(i.x,i.y,i.z,t)}elevate(e,t=!1){return ut.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+ut.x,this._targetEnd.y+ut.y,this._targetEnd.z+ut.z,t)}moveTo(e,t,i,s=!1){this._isUserControllingTruck=!1;const n=ut.set(e,t,i).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,n,this.boundaryFriction),this._needsUpdate=!0,s||this._target.copy(this._targetEnd);const o=!s||bt(this._target.x,this._targetEnd.x,this.restThreshold)&&bt(this._target.y,this._targetEnd.y,this.restThreshold)&&bt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}lookInDirectionOf(e,t,i,s=!1){const a=ut.set(e,t,i).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(a.x,a.y,a.z,s)}fitToBox(e,t,{cover:i=!1,paddingLeft:s=0,paddingRight:n=0,paddingBottom:o=0,paddingTop:a=0}={}){const l=[],c=e.isBox3?ki.copy(e):ki.setFromObject(e);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const h=cl(this._sphericalEnd.theta,ll),d=cl(this._sphericalEnd.phi,ll);l.push(this.rotateTo(h,d,t));const u=ut.setFromSpherical(this._sphericalEnd).normalize(),f=ml.setFromUnitVectors(u,go),p=bt(Math.abs(u.y),1);p&&f.multiply(bo.setFromAxisAngle(Nn,h)),f.multiply(this._yAxisUpSpaceInverse);const m=pl.makeEmpty();gt.copy(c.min).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.min).setX(c.max.x).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.min).setY(c.max.y).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.max).setZ(c.min.z).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.min).setZ(c.max.z).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.max).setY(c.min.y).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.max).setX(c.min.x).applyQuaternion(f),m.expandByPoint(gt),gt.copy(c.max).applyQuaternion(f),m.expandByPoint(gt),m.min.x-=s,m.min.y-=o,m.max.x+=n,m.max.y+=a,f.setFromUnitVectors(go,u),p&&f.premultiply(bo.invert()),f.premultiply(this._yAxisUpSpace);const E=m.getSize(ut),g=m.getCenter(gt).applyQuaternion(f);if(si(this._camera)){const I=this.getDistanceToFitBox(E.x,E.y,E.z,i);l.push(this.moveTo(g.x,g.y,g.z,t)),l.push(this.dollyTo(I,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(ze(this._camera)){const I=this._camera,T=I.right-I.left,b=I.top-I.bottom,v=i?Math.max(T/E.x,b/E.y):Math.min(T/E.x,b/E.y);l.push(this.moveTo(g.x,g.y,g.z,t)),l.push(this.zoomTo(v,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const i=[],n=e instanceof ht.Sphere?Eo.copy(e):Gt.createBoundingSphere(e,Eo);if(i.push(this.moveTo(n.center.x,n.center.y,n.center.z,t)),si(this._camera)){const o=this.getDistanceToFitSphere(n.radius);i.push(this.dollyTo(o,t))}else if(ze(this._camera)){const o=this._camera.right-this._camera.left,a=this._camera.top-this._camera.bottom,l=2*n.radius,c=Math.min(o/l,a/l);i.push(this.zoomTo(c,t))}return i.push(this.setFocalOffset(0,0,0,t)),Promise.all(i)}setLookAt(e,t,i,s,n,o,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Mi.NONE,this._changedDolly=0;const l=gt.set(s,n,o),c=ut.set(e,t,i);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(c.sub(l).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const h=!a||bt(this._target.x,this._targetEnd.x,this.restThreshold)&&bt(this._target.y,this._targetEnd.y,this.restThreshold)&&bt(this._target.z,this._targetEnd.z,this.restThreshold)&&bt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&bt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&bt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(h)}lerpLookAt(e,t,i,s,n,o,a,l,c,h,d,u,f,p=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Mi.NONE,this._changedDolly=0;const m=ut.set(s,n,o),E=gt.set(e,t,i);te.setFromVector3(E.sub(m).applyQuaternion(this._yAxisUpSpace));const g=Ui.set(h,d,u),I=gt.set(a,l,c);_s.setFromVector3(I.sub(g).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(m.lerp(g,f));const T=_s.theta-te.theta,b=_s.phi-te.phi,v=_s.radius-te.radius;this._sphericalEnd.set(te.radius+v*f,te.phi+b*f,te.theta+T*f),this.normalizeRotations(),this._needsUpdate=!0,p||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const A=!p||bt(this._target.x,this._targetEnd.x,this.restThreshold)&&bt(this._target.y,this._targetEnd.y,this.restThreshold)&&bt(this._target.z,this._targetEnd.z,this.restThreshold)&&bt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&bt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&bt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(A)}setPosition(e,t,i,s=!1){return this.setLookAt(e,t,i,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,s)}setTarget(e,t,i,s=!1){const n=this.getPosition(ut),o=this.setLookAt(n.x,n.y,n.z,e,t,i,s);return this._sphericalEnd.phi=de(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),o}setFocalOffset(e,t,i,s=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,i),this._needsUpdate=!0,s||this._focalOffset.copy(this._focalOffsetEnd);const n=!s||bt(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&bt(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&bt(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}setOrbitPoint(e,t,i){this._camera.updateMatrixWorld(),be.setFromMatrixColumn(this._camera.matrixWorldInverse,0),Ie.setFromMatrixColumn(this._camera.matrixWorldInverse,1),ni.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const s=ut.set(e,t,i),n=s.distanceTo(this._camera.position),o=s.sub(this._camera.position);be.multiplyScalar(o.x),Ie.multiplyScalar(o.y),ni.multiplyScalar(o.z),ut.copy(be).add(Ie).add(ni),ut.z=ut.z+n,this.dollyTo(n,!1),this.setFocalOffset(-ut.x,ut.y,-ut.z,!1),this.moveTo(e,t,i,!1)}setBoundary(e){if(!e){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(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,i,s){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new ht.Vector4,typeof e=="number"?this._viewport.set(e,t,i,s):this._viewport.copy(e)}getDistanceToFitBox(e,t,i,s=!1){if(mo(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const n=e/t,o=this._camera.getEffectiveFOV()*bs,a=this._camera.aspect;return((s?n>a:n<a)?t:e/a)*.5/Math.tan(o*.5)+i*.5}getDistanceToFitSphere(e){if(mo(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*bs,i=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,s=1<this._camera.aspect?t:i;return e/Math.sin(s*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new ht.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new ht.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e&&e instanceof ht.Spherical?e:new ht.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new ht.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%Di,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=Di),this._spherical.theta+=Di*Math.round((this._sphericalEnd.theta-this._spherical.theta)/Di)}reset(e=!1){if(!bt(this._camera.up.x,this._cameraUp0.x)||!bt(this._camera.up.y,this._cameraUp0.y)||!bt(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const i=this.getPosition(ut);this.updateCameraUp(),this.setPosition(i.x,i.y,i.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,e),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,e),this.zoomTo(this._zoom0,e)];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,Nn),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=ut.subVectors(this._target,this._camera.position).normalize(),t=gt.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const i=this.getPosition(ut);this.updateCameraUp(),this.setPosition(i.x,i.y,i.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,i=this._sphericalEnd.phi-this._spherical.phi,s=this._sphericalEnd.radius-this._spherical.radius,n=ul.subVectors(this._targetEnd,this._target),o=fl.subVectors(this._focalOffsetEnd,this._focalOffset),a=this._zoomEnd-this._zoom;if(vt(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=On(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,d,1/0,e),this._needsUpdate=!0}if(vt(i))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=On(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,d,1/0,e),this._needsUpdate=!0}if(vt(s))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const d=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=On(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,d,this.maxSpeed,e),this._needsUpdate=!0}if(vt(n.x)&&vt(n.y)&&vt(n.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const d=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;hl(this._target,this._targetEnd,this._targetVelocity,d,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(vt(o.x)&&vt(o.y)&&vt(o.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const d=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;hl(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,d,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(vt(a))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const d=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=On(this._zoom,this._zoomEnd,this._zoomVelocity,d,1/0,e)}if(this.dollyToCursor){if(si(this._camera)&&this._changedDolly!==0){const d=this._spherical.radius-this._lastDistance,u=this._camera,f=this._getCameraDirection(ys),p=ut.copy(f).cross(u.up).normalize();p.lengthSq()===0&&(p.x=1);const m=gt.crossVectors(p,f),E=this._sphericalEnd.radius*Math.tan(u.getEffectiveFOV()*bs*.5),I=(this._sphericalEnd.radius-d-this._sphericalEnd.radius)/this._sphericalEnd.radius,T=Ui.copy(this._targetEnd).add(p.multiplyScalar(this._dollyControlCoord.x*E*u.aspect)).add(m.multiplyScalar(this._dollyControlCoord.y*E)),b=ut.copy(this._targetEnd).lerp(T,I),v=this._lastDollyDirection===Mi.IN&&this._spherical.radius<=this.minDistance,A=this._lastDollyDirection===Mi.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(v||A)){this._sphericalEnd.radius-=d,this._spherical.radius-=d;const N=gt.copy(f).multiplyScalar(-d);b.add(N)}this._boundary.clampPoint(b,b);const S=gt.subVectors(b,this._targetEnd);this._targetEnd.copy(b),this._target.add(S),this._changedDolly-=d,vt(this._changedDolly)&&(this._changedDolly=0)}else if(ze(this._camera)&&this._changedZoom!==0){const d=this._zoom-this._lastZoom,u=this._camera,f=ut.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(u.near+u.far)/(u.near-u.far)).unproject(u),p=gt.set(0,0,-1).applyQuaternion(u.quaternion),m=Ui.copy(f).add(p.multiplyScalar(-f.dot(u.up))),g=-(this._zoom-d-this._zoom)/this._zoom,I=this._getCameraDirection(ys),T=this._targetEnd.dot(I),b=ut.copy(this._targetEnd).lerp(m,g),v=b.dot(I),A=I.multiplyScalar(v-T);b.sub(A),this._boundary.clampPoint(b,b);const S=gt.subVectors(b,this._targetEnd);this._targetEnd.copy(b),this._target.add(S),this._changedZoom-=d,vt(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 l=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,l),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!vt(this._focalOffset.x)||!vt(this._focalOffset.y)||!vt(this._focalOffset.z))&&(this._camera.updateMatrixWorld(),be.setFromMatrixColumn(this._camera.matrix,0),Ie.setFromMatrixColumn(this._camera.matrix,1),ni.setFromMatrixColumn(this._camera.matrix,2),be.multiplyScalar(this._focalOffset.x),Ie.multiplyScalar(-this._focalOffset.y),ni.multiplyScalar(this._focalOffset.z),ut.copy(be).add(Ie).add(ni),this._camera.position.add(ut)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),ut.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"}),vt(t,this.restThreshold)&&vt(i,this.restThreshold)&&vt(s,this.restThreshold)&&vt(n.x,this.restThreshold)&&vt(n.y,this.restThreshold)&&vt(n.z,this.restThreshold)&&vt(o.x,this.restThreshold)&&vt(o.y,this.restThreshold)&&vt(o.z,this.restThreshold)&&vt(a,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:Is(this.maxDistance),minZoom:this.minZoom,maxZoom:Is(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:Is(this.maxPolarAngle),minAzimuthAngle:Is(this.minAzimuthAngle),maxAzimuthAngle:Is(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:ut.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(e,t=!1){const i=JSON.parse(e);this.enabled=i.enabled,this.minDistance=i.minDistance,this.maxDistance=Cs(i.maxDistance),this.minZoom=i.minZoom,this.maxZoom=Cs(i.maxZoom),this.minPolarAngle=i.minPolarAngle,this.maxPolarAngle=Cs(i.maxPolarAngle),this.minAzimuthAngle=Cs(i.minAzimuthAngle),this.maxAzimuthAngle=Cs(i.maxAzimuthAngle),this.smoothTime=i.smoothTime,this.draggingSmoothTime=i.draggingSmoothTime,this.dollySpeed=i.dollySpeed,this.truckSpeed=i.truckSpeed,this.dollyToCursor=i.dollyToCursor,this.verticalDragToForward=i.verticalDragToForward,this._target0.fromArray(i.target0),this._position0.fromArray(i.position0),this._zoom0=i.zoom0,this._focalOffset0.fromArray(i.focalOffset0),this.moveTo(i.target[0],i.target[1],i.target[2],t),te.setFromVector3(ut.fromArray(i.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(te.theta,te.phi,t),this.dollyTo(te.radius,t),this.zoomTo(i.zoom,t),this.setFocalOffset(i.focalOffset[0],i.focalOffset[1],i.focalOffset[2],t),this._needsUpdate=!0}connect(e){if(this._domElement){console.warn("camera-controls is already connected.");return}e.setAttribute("data-camera-controls-version",uf),this._addAllEventListeners(e),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(e){return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(e){return this._getTargetDirection(e).negate()}_findPointerById(e){return this._activePointers.find(t=>t.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,i){const s=t.lengthSq();if(s===0)return e;const n=gt.copy(t).add(e),a=this._boundary.clampPoint(n,Ui).sub(n),l=a.lengthSq();if(l===0)return e.add(t);if(l===s)return e;if(i===0)return e.add(t).add(a);{const c=1+i*l/t.dot(a);return e.add(gt.copy(t).multiplyScalar(c)).add(a.multiplyScalar(1-i))}}_updateNearPlaneCorners(){if(si(this._camera)){const e=this._camera,t=e.near,i=e.getEffectiveFOV()*bs,s=Math.tan(i*.5)*t,n=s*e.aspect;this._nearPlaneCorners[0].set(-n,-s,0),this._nearPlaneCorners[1].set(n,-s,0),this._nearPlaneCorners[2].set(n,s,0),this._nearPlaneCorners[3].set(-n,s,0)}else if(ze(this._camera)){const e=this._camera,t=1/e.zoom,i=e.left*t,s=e.right*t,n=e.top*t,o=e.bottom*t;this._nearPlaneCorners[0].set(i,n,0),this._nearPlaneCorners[1].set(s,n,0),this._nearPlaneCorners[2].set(s,o,0),this._nearPlaneCorners[3].set(i,o,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||mo(this._camera,"_collisionTest"))return e;const i=this._getTargetDirection(ys);Io.lookAt(dl,i,this._camera.up);for(let s=0;s<4;s++){const n=gt.copy(this._nearPlaneCorners[s]);n.applyMatrix4(Io);const o=Ui.addVectors(this._target,n);Pn.set(o,i),Pn.far=this._spherical.radius+1;const a=Pn.intersectObjects(this.colliderMeshes);a.length!==0&&a[0].distance<e&&(e=a[0].distance)}return e}_getClientRect(e){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return e.x=t.left,e.y=t.top,this._viewport?(e.x+=this._viewport.x,e.y+=t.height-this._viewport.w-this._viewport.y,e.width=this._viewport.z,e.height=this._viewport.w):(e.width=t.width,e.height=t.height),e}_createOnRestPromise(e){return e?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const i=()=>{this.removeEventListener("rest",i),t()};this.addEventListener("rest",i)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){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(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new ht.Sphere){const i=t,s=i.center;ki.makeEmpty(),e.traverseVisible(o=>{o.isMesh&&ki.expandByObject(o)}),ki.getCenter(s);let n=0;return e.traverseVisible(o=>{if(!o.isMesh)return;const a=o,l=a.geometry.clone();l.applyMatrix4(a.matrixWorld);const h=l.attributes.position;for(let d=0,u=h.count;d<u;d++)ut.fromBufferAttribute(h,d),n=Math.max(n,s.distanceToSquared(ut))}),i.radius=Math.sqrt(n),i}}class Gi extends Rc{constructor(t){super(t);y(this,"onBeforeUpdate",new K);y(this,"onAfterUpdate",new K);y(this,"onAspectUpdated",new K);y(this,"onDisposed",new K);y(this,"three");y(this,"_allControls",new Map);y(this,"updateAspect",()=>{var t;if(!(!this.currentWorld||!this.currentWorld.renderer)){if(this.three instanceof D.OrthographicCamera){this.onAspectUpdated.trigger();return}if((t=this.currentWorld.renderer)!=null&&t.isResizeable()){const i=this.currentWorld.renderer.getSize();this.three.aspect=i.width/i.height,this.three.updateProjectionMatrix(),this.onAspectUpdated.trigger()}}});this.three=this.setupCamera(),this.setupEvents(!0),this.onWorldChanged.add(({action:i,world:s})=>{if(i==="added"){const n=this.newCameraControls();this._allControls.set(s.uuid,n)}if(i==="removed"){const n=this._allControls.get(s.uuid);n&&(n.dispose(),this._allControls.delete(s.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,i]of this._allControls)i.dispose()}update(t){this.enabled&&(this.onBeforeUpdate.trigger(this),this.controls.update(t),this.onAfterUpdate.trigger(this))}setupCamera(){const t=window.innerWidth/window.innerHeight,i=new D.PerspectiveCamera(60,t,1,1e3);return i.position.set(50,50,50),i.lookAt(new D.Vector3(0,0,0)),i}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!");Gt.install({THREE:Gi.getSubsetOfThree()});const{domElement:t}=this.currentWorld.renderer.three,i=new Gt(this.three,t);return i.smoothTime=.2,i.dollyToCursor=!0,i.infinityDolly=!0,i.minDistance=6,i}setupEvents(t){t?window.addEventListener("resize",this.updateAspect):window.removeEventListener("resize",this.updateAspect)}static getSubsetOfThree(){return{MOUSE:D.MOUSE,Vector2:D.Vector2,Vector3:D.Vector3,Vector4:D.Vector4,Quaternion:D.Quaternion,Matrix4:D.Matrix4,Spherical:D.Spherical,Box3:D.Box3,Sphere:D.Sphere,Raycaster:D.Raycaster,MathUtils:D.MathUtils}}}const Cr=class Cr extends Ot{constructor(t){super(t);y(this,"onAfterUpdate",new K);y(this,"onBeforeUpdate",new K);y(this,"onDisposed",new K);y(this,"onWorldCreated",new K);y(this,"onWorldDeleted",new K);y(this,"list",new Map);y(this,"enabled",!0);t.add(Cr.uuid,this)}create(){const t=new Nc(this.components),i=t.uuid;if(this.list.has(i))throw new Error("There is already a world with this name!");return this.list.set(i,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 i=t.uuid;this.list.delete(t.uuid),t.dispose(),this.onWorldDeleted.trigger(i)}dispose(){this.enabled=!1;for(const[t,i]of this.list)i.dispose();this.list.clear(),this.onDisposed.trigger()}update(t){if(this.enabled)for(const[i,s]of this.list)s.update(t)}};y(Cr,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let qn=Cr;function mf(r,e,t,i){return new Promise((s,n)=>{function o(){const a=r.clientWaitSync(e,t,0);if(a===r.WAIT_FAILED){n();return}if(a===r.TIMEOUT_EXPIRED){setTimeout(o,i);return}s()}o()})}async function gf(r,e,t,i,s,n,o){const a=r.fenceSync(r.SYNC_GPU_COMMANDS_COMPLETE,0);r.flush(),await mf(r,a,0,10),r.deleteSync(a),r.bindBuffer(e,t),r.getBufferSubData(e,i,s,n,o),r.bindBuffer(e,null)}async function ma(r,e,t,i,s,n,o,a){const l=r.createBuffer();return r.bindBuffer(r.PIXEL_PACK_BUFFER,l),r.bufferData(r.PIXEL_PACK_BUFFER,a.byteLength,r.STREAM_READ),r.readPixels(e,t,i,s,n,o,0),r.bindBuffer(r.PIXEL_PACK_BUFFER,null),await gf(r,r.PIXEL_PACK_BUFFER,l,0,a),r.deleteBuffer(l),a}class Dc{constructor(e,t,i){y(this,"onDisposed",new K);y(this,"onViewUpdated",new Ns);y(this,"enabled",!0);y(this,"needsUpdate",!1);y(this,"renderDebugFrame",!1);y(this,"components");y(this,"world");y(this,"renderer");y(this,"autoUpdate",!0);y(this,"updateInterval",1e3);y(this,"worker");y(this,"scene",new D.Scene);y(this,"_width",512);y(this,"_height",512);y(this,"_availableColor",1);y(this,"renderTarget");y(this,"bufferSize");y(this,"_buffer");y(this,"_isWorkerBusy",!1);y(this,"updateVisibility",async e=>{if(!this.enabled||!this.needsUpdate&&!e||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 i=this.renderer.getContext();await ma(i,0,0,this._width,this._height,i.RGBA,i.UNSIGNED_BYTE,this._buffer),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=e,this.applySettings(i),this.world=t,this.renderer=new D.WebGLRenderer,this.renderTarget=new D.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 s=`
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
- `,r=new Blob([s],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(r))}dispose(){this.enabled=!1;for(const e of this.scene.children)e.removeFromParent();this.onViewUpdated.reset(),this.worker.terminate(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.renderTarget.dispose(),this._buffer=null,this.onDisposed.reset()}getAvailableColor(){let e=BigInt(this._availableColor.toString());const t=[];do t.unshift(Number(e%256n)),e/=256n;while(e);for(;t.length!==3;)t.unshift(0);const[i,s,r]=t,o=`${i}-${s}-${r}`;return{r:i,g:s,b:r,code:o}}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(e){e&&(e.updateInterval!==void 0&&(this.updateInterval=e.updateInterval),e.height!==void 0&&(this._height=e.height),e.width!==void 0&&(this._width=e.width),e.autoUpdate!==void 0&&(this.autoUpdate=e.autoUpdate))}}class Pc extends Nc{constructor(t,i,s){super(t,i,s);y(this,"onViewUpdated",new Q);y(this,"threshold",100);y(this,"colorMeshes",new Map);y(this,"isProcessing",!1);y(this,"_colorCodeMeshMap",new Map);y(this,"_meshIDColorCodeMap",new Map);y(this,"_currentVisibleMeshes",new Set);y(this,"_recentlyHiddenMeshes",new Set);y(this,"_intervalID",null);y(this,"_transparentMat",new M.MeshBasicMaterial({transparent:!0,opacity:0}));y(this,"handleWorkerMessage",async t=>{if(this.isProcessing)return;const i=t.data.colors;this._recentlyHiddenMeshes=new Set(this._currentVisibleMeshes),this._currentVisibleMeshes.clear();for(const[s,r]of i){if(r<this.threshold)continue;const o=this._colorCodeMeshMap.get(s);o&&(this._currentVisibleMeshes.add(o),this._recentlyHiddenMeshes.delete(o))}this.onViewUpdated.trigger({seen:this._currentVisibleMeshes,unseen:this._recentlyHiddenMeshes}),this._isWorkerBusy=!1});this.worker.addEventListener("message",this.handleWorkerMessage),this.autoUpdate&&window.setInterval(async()=>{this.isProcessing||await this.updateVisibility()},this.updateInterval),this.onViewUpdated.add(({seen:r,unseen:o})=>{for(const a of r)a.visible=!0;for(const a of o)a.visible=!1})}dispose(){super.dispose(),this._intervalID!==null&&(window.clearInterval(this._intervalID),this._intervalID=null),this._currentVisibleMeshes.clear(),this._recentlyHiddenMeshes.clear(),this._meshIDColorCodeMap.clear(),this._transparentMat.dispose(),this._colorCodeMeshMap.clear();const t=this.components.get(Se);for(const i in this.colorMeshes){const s=this.colorMeshes.get(i);s&&t.destroy(s,!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 i=t instanceof M.InstancedMesh,{geometry:s,material:r}=t,{colorMaterial:o,code:a}=this.getAvailableMaterial();let l;if(Array.isArray(r)){let d=!0;const u=[];for(const f of r)zo.isTransparent(f)?u.push(this._transparentMat):(d=!1,u.push(o));if(d){o.dispose(),this.isProcessing=!1;return}l=u}else if(zo.isTransparent(r)){o.dispose(),this.isProcessing=!1;return}else l=o;this._colorCodeMeshMap.set(a,t),this._meshIDColorCodeMap.set(t.uuid,a);const c=i?t.count:1,h=new M.InstancedMesh(s,l,c);i?h.instanceMatrix=t.instanceMatrix:h.setMatrixAt(0,new M.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 i=this.components.get(Se);this._currentVisibleMeshes.delete(t),this._recentlyHiddenMeshes.delete(t);const s=this.colorMeshes.get(t.uuid),r=this._meshIDColorCodeMap.get(t.uuid);if(!s||!r){this.isProcessing=!1;return}this._colorCodeMeshMap.delete(r),this._meshIDColorCodeMap.delete(t.uuid),this.colorMeshes.delete(t.uuid),s.geometry=void 0,s.material=[],i.destroy(s,!0),this._recentlyHiddenMeshes.delete(t),this._currentVisibleMeshes.delete(t),this.isProcessing=!1}updateInstanced(t){for(const i of t){const s=this.colorMeshes.get(i.uuid);s&&(s.count=i.count)}}getAvailableMaterial(){const{r:t,g:i,b:s,code:r}=this.getAvailableColor(),o=M.ColorManagement.enabled;M.ColorManagement.enabled=!1;const a=new M.Color(`rgb(${t}, ${i}, ${s})`);if(!this.world.renderer)throw new Error("Renderer not found in the world!");const l=this.world.renderer.clippingPlanes,c=new M.MeshBasicMaterial({color:a,clippingPlanes:l,side:M.DoubleSide});return M.ColorManagement.enabled=o,{colorMaterial:c,code:r}}}const Ms=class Ms extends Ot{constructor(t){super(t);y(this,"onDisposed",new Q);y(this,"_enabled",!0);y(this,"list",new Map);t.add(Ms.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const[i,s]of this.list)s.enabled=t}create(t,i){if(this.list.has(t.uuid))return this.list.get(t.uuid);const s=new Pc(this.components,t,i);return this.list.set(t.uuid,s),s}delete(t){const i=this.list.get(t.uuid);i&&i.dispose(),this.list.delete(t.uuid)}dispose(){this.enabled=!1,this.onDisposed.trigger(Ms.uuid),this.onDisposed.reset();for(const[t,i]of this.list)i.dispose();this.list.clear()}updateInstanced(t){for(const[,i]of this.list)i.updateInstanced(t)}};y(Ms,"uuid","69f2a50d-c266-44fc-b1bd-fa4d34be89e6");let qn=Ms;class uf{constructor(e,t){y(this,"onDisposed",new Q);y(this,"onDistanceComputed",new Q);y(this,"excludedObjects",new Set);y(this,"enabled",!0);y(this,"renderDebugFrame",!1);y(this,"components");y(this,"scene",new M.Scene);y(this,"camera",new M.OrthographicCamera(-1,1,1,-1,0,1));y(this,"depthMaterial");y(this,"world");y(this,"renderer");y(this,"worker");y(this,"_width",512);y(this,"_height",512);y(this,"_postQuad");y(this,"tempRT");y(this,"resultRT");y(this,"bufferSize");y(this,"_buffer");y(this,"_isWorkerBusy",!1);y(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 e="visibilityBeforeDistanceCheck";for(const i of this.excludedObjects)i.userData[e]=i.visible,i.visible=!1;this.renderer.render(this.world.scene.three,this.world.camera.three);for(const i of this.excludedObjects)i.userData[e]!==void 0&&(i.visible=i.userData[e]);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();await fa(t,0,0,this._width,this._height,t.RGBA,t.UNSIGNED_BYTE,this._buffer),this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,this.camera),this.worker.postMessage({buffer:this._buffer})});y(this,"handleWorkerMessage",e=>{if(!this.enabled||this.world.isDisposing)return;const t=e.data.colors;let i=Number.MAX_VALUE;for(const l of t)l!==0&&l<i&&(i=l);const s=this.world.camera.three||M.OrthographicCamera,o=(i/255-1)*-1*(s.far-s.near),a=Math.min(o,s.far);this.onDistanceComputed.trigger(a),this._isWorkerBusy=!1});if(!t.renderer)throw new Error("The given world must have a renderer!");this.components=e,this.world=t;const i=t.camera.three;this.renderer=new M.WebGLRenderer,this.tempRT=new M.WebGLRenderTarget(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.tempRT.texture.minFilter=M.NearestFilter,this.tempRT.texture.magFilter=M.NearestFilter,this.tempRT.stencilBuffer=!1,this.tempRT.samples=0,this.tempRT.depthTexture=new M.DepthTexture(this._width,this._height),this.tempRT.depthTexture.format=M.DepthFormat,this.tempRT.depthTexture.type=M.UnsignedShortType,this.resultRT=new M.WebGLRenderTarget(this._width,this._height),this.depthMaterial=new M.ShaderMaterial({vertexShader:`
27
+ `,n=new Blob([s],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n))}dispose(){this.enabled=!1;for(const e of this.scene.children)e.removeFromParent();this.onViewUpdated.reset(),this.worker.terminate(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.renderTarget.dispose(),this._buffer=null,this.onDisposed.reset()}getAvailableColor(){let e=BigInt(this._availableColor.toString());const t=[];do t.unshift(Number(e%256n)),e/=256n;while(e);for(;t.length!==3;)t.unshift(0);const[i,s,n]=t,o=`${i}-${s}-${n}`;return{r:i,g:s,b:n,code:o}}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(e){e&&(e.updateInterval!==void 0&&(this.updateInterval=e.updateInterval),e.height!==void 0&&(this._height=e.height),e.width!==void 0&&(this._width=e.width),e.autoUpdate!==void 0&&(this.autoUpdate=e.autoUpdate))}}class Uc extends Dc{constructor(t,i,s){super(t,i,s);y(this,"onViewUpdated",new K);y(this,"threshold",100);y(this,"colorMeshes",new Map);y(this,"isProcessing",!1);y(this,"_colorCodeMeshMap",new Map);y(this,"_meshIDColorCodeMap",new Map);y(this,"_currentVisibleMeshes",new Set);y(this,"_recentlyHiddenMeshes",new Set);y(this,"_intervalID",null);y(this,"_transparentMat",new D.MeshBasicMaterial({transparent:!0,opacity:0}));y(this,"handleWorkerMessage",async t=>{if(this.isProcessing)return;const i=t.data.colors;this._recentlyHiddenMeshes=new Set(this._currentVisibleMeshes),this._currentVisibleMeshes.clear();for(const[s,n]of i){if(n<this.threshold)continue;const o=this._colorCodeMeshMap.get(s);o&&(this._currentVisibleMeshes.add(o),this._recentlyHiddenMeshes.delete(o))}this.onViewUpdated.trigger({seen:this._currentVisibleMeshes,unseen:this._recentlyHiddenMeshes}),this._isWorkerBusy=!1});this.worker.addEventListener("message",this.handleWorkerMessage),this.autoUpdate&&window.setInterval(async()=>{this.isProcessing||await this.updateVisibility()},this.updateInterval),this.onViewUpdated.add(({seen:n,unseen:o})=>{for(const a of n)a.visible=!0;for(const a of o)a.visible=!1})}dispose(){super.dispose(),this._intervalID!==null&&(window.clearInterval(this._intervalID),this._intervalID=null),this._currentVisibleMeshes.clear(),this._recentlyHiddenMeshes.clear(),this._meshIDColorCodeMap.clear(),this._transparentMat.dispose(),this._colorCodeMeshMap.clear();const t=this.components.get(Pe);for(const i in this.colorMeshes){const s=this.colorMeshes.get(i);s&&t.destroy(s,!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 i=t instanceof D.InstancedMesh,{geometry:s,material:n}=t,{colorMaterial:o,code:a}=this.getAvailableMaterial();let l;if(Array.isArray(n)){let d=!0;const u=[];for(const f of n)Vo.isTransparent(f)?u.push(this._transparentMat):(d=!1,u.push(o));if(d){o.dispose(),this.isProcessing=!1;return}l=u}else if(Vo.isTransparent(n)){o.dispose(),this.isProcessing=!1;return}else l=o;this._colorCodeMeshMap.set(a,t),this._meshIDColorCodeMap.set(t.uuid,a);const c=i?t.count:1,h=new D.InstancedMesh(s,l,c);i?h.instanceMatrix=t.instanceMatrix:h.setMatrixAt(0,new D.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 i=this.components.get(Pe);this._currentVisibleMeshes.delete(t),this._recentlyHiddenMeshes.delete(t);const s=this.colorMeshes.get(t.uuid),n=this._meshIDColorCodeMap.get(t.uuid);if(!s||!n){this.isProcessing=!1;return}this._colorCodeMeshMap.delete(n),this._meshIDColorCodeMap.delete(t.uuid),this.colorMeshes.delete(t.uuid),s.geometry=void 0,s.material=[],i.destroy(s,!0),this._recentlyHiddenMeshes.delete(t),this._currentVisibleMeshes.delete(t),this.isProcessing=!1}updateInstanced(t){for(const i of t){const s=this.colorMeshes.get(i.uuid);s&&(s.count=i.count)}}getAvailableMaterial(){const{r:t,g:i,b:s,code:n}=this.getAvailableColor(),o=D.ColorManagement.enabled;D.ColorManagement.enabled=!1;const a=new D.Color(`rgb(${t}, ${i}, ${s})`);if(!this.world.renderer)throw new Error("Renderer not found in the world!");const l=this.world.renderer.clippingPlanes,c=new D.MeshBasicMaterial({color:a,clippingPlanes:l,side:D.DoubleSide});return D.ColorManagement.enabled=o,{colorMaterial:c,code:n}}}const Bs=class Bs extends Ot{constructor(t){super(t);y(this,"onDisposed",new K);y(this,"_enabled",!0);y(this,"list",new Map);t.add(Bs.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const[i,s]of this.list)s.enabled=t}create(t,i){if(this.list.has(t.uuid))return this.list.get(t.uuid);const s=new Uc(this.components,t,i);return this.list.set(t.uuid,s),s}delete(t){const i=this.list.get(t.uuid);i&&i.dispose(),this.list.delete(t.uuid)}dispose(){this.enabled=!1,this.onDisposed.trigger(Bs.uuid),this.onDisposed.reset();for(const[t,i]of this.list)i.dispose();this.list.clear()}updateInstanced(t){for(const[,i]of this.list)i.updateInstanced(t)}};y(Bs,"uuid","69f2a50d-c266-44fc-b1bd-fa4d34be89e6");let Qn=Bs;class Ef{constructor(e,t){y(this,"onDisposed",new K);y(this,"onDistanceComputed",new K);y(this,"excludedObjects",new Set);y(this,"enabled",!0);y(this,"renderDebugFrame",!1);y(this,"components");y(this,"scene",new D.Scene);y(this,"camera",new D.OrthographicCamera(-1,1,1,-1,0,1));y(this,"depthMaterial");y(this,"world");y(this,"renderer");y(this,"worker");y(this,"_width",512);y(this,"_height",512);y(this,"_postQuad");y(this,"tempRT");y(this,"resultRT");y(this,"bufferSize");y(this,"_buffer");y(this,"_isWorkerBusy",!1);y(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 e="visibilityBeforeDistanceCheck";for(const i of this.excludedObjects)i.userData[e]=i.visible,i.visible=!1;this.renderer.render(this.world.scene.three,this.world.camera.three);for(const i of this.excludedObjects)i.userData[e]!==void 0&&(i.visible=i.userData[e]);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();await ma(t,0,0,this._width,this._height,t.RGBA,t.UNSIGNED_BYTE,this._buffer),this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,this.camera),this.worker.postMessage({buffer:this._buffer})});y(this,"handleWorkerMessage",e=>{if(!this.enabled||this.world.isDisposing)return;const t=e.data.colors;let i=Number.MAX_VALUE;for(const l of t)l!==0&&l<i&&(i=l);const s=this.world.camera.three||D.OrthographicCamera,o=(i/255-1)*-1*(s.far-s.near),a=Math.min(o,s.far);this.onDistanceComputed.trigger(a),this._isWorkerBusy=!1});if(!t.renderer)throw new Error("The given world must have a renderer!");this.components=e,this.world=t;const i=t.camera.three;this.renderer=new D.WebGLRenderer,this.tempRT=new D.WebGLRenderTarget(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.tempRT.texture.minFilter=D.NearestFilter,this.tempRT.texture.magFilter=D.NearestFilter,this.tempRT.stencilBuffer=!1,this.tempRT.samples=0,this.tempRT.depthTexture=new D.DepthTexture(this._width,this._height),this.tempRT.depthTexture.format=D.DepthFormat,this.tempRT.depthTexture.type=D.UnsignedShortType,this.resultRT=new D.WebGLRenderTarget(this._width,this._height),this.depthMaterial=new D.ShaderMaterial({vertexShader:`
28
28
  varying vec2 vUv;
29
29
 
30
30
  void main() {
@@ -54,7 +54,7 @@ void main() {
54
54
  gl_FragColor.rgb = 1.0 - vec3( depth );
55
55
  gl_FragColor.a = 1.0;
56
56
  }
57
- `,uniforms:{cameraNear:{value:i.near},cameraFar:{value:i.far},tDiffuse:{value:null},tDepth:{value:null}}});const s=new M.PlaneGeometry(2,2);this._postQuad=new M.Mesh(s,this.depthMaterial),this.scene.add(this._postQuad),this.renderer.clippingPlanes=t.renderer.clippingPlanes;const r=`
57
+ `,uniforms:{cameraNear:{value:i.near},cameraFar:{value:i.far},tDiffuse:{value:null},tDepth:{value:null}}});const s=new D.PlaneGeometry(2,2);this._postQuad=new D.Mesh(s,this.depthMaterial),this.scene.add(this._postQuad),this.renderer.clippingPlanes=t.renderer.clippingPlanes;const n=`
58
58
  addEventListener("message", (event) => {
59
59
  const { buffer } = event.data;
60
60
  const colors = new Set();
@@ -64,7 +64,7 @@ void main() {
64
64
  }
65
65
  postMessage({ colors });
66
66
  });
67
- `,o=new Blob([r],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(o)),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 e=[...this.scene.children];this.excludedObjects.clear();for(const t of e)t.removeFromParent();this._postQuad.geometry.dispose(),this._postQuad.removeFromParent(),this._buffer=null,this.onDisposed.reset()}}class ff extends Fc{constructor(){super(...arguments);y(this,"_distanceRenderer");y(this,"autoBias",!0);y(this,"config",{directionalLight:{color:new M.Color("white"),intensity:1.5,position:new M.Vector3(5,10,3)},ambientLight:{color:new M.Color("white"),intensity:1},shadows:{cascade:1,resolution:512}});y(this,"_lightsWithShadow",new Map);y(this,"_isComputingShadows",!1);y(this,"_shadowsEnabled",!0);y(this,"_bias",0);y(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 s=this.currentWorld.camera.three;if(!(s instanceof M.PerspectiveCamera)&&!(s instanceof M.OrthographicCamera))throw new Error("Invalid camera type!");const r=new M.Vector3;s.getWorldDirection(r);let o=t;const a=new M.Vector3;a.copy(this.config.directionalLight.position),a.normalize();for(const[l,c]of this._lightsWithShadow){const h=this.directionalLights.get(c);if(!h)throw new Error("Light not found.");const d=new M.Vector3;d.copy(r);const u=l===this._lightsWithShadow.size-1,f=u?o/2:o*2/3;d.multiplyScalar(f),d.add(s.position);const p=o-f,m=new M.Vector3;m.copy(a),m.multiplyScalar(p),h.target.position.copy(d),h.position.copy(d),h.position.add(m),h.shadow.camera.right=p,h.shadow.camera.left=-p,h.shadow.camera.top=p,h.shadow.camera.bottom=-p,h.shadow.camera.far=p*2,h.shadow.camera.updateProjectionMatrix(),h.shadow.camera.updateMatrix(),u||(o/=3)}this._isComputingShadows=!1})}get bias(){return this._bias}set bias(t){this._bias=t;for(const[,i]of this._lightsWithShadow){const s=this.directionalLights.get(i);s&&(s.shadow.bias=t)}}get shadowsEnabled(){return this._shadowsEnabled}set shadowsEnabled(t){this._shadowsEnabled=t;for(const[,i]of this.directionalLights)i.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[,i]of this.directionalLights)i.target.removeFromParent(),i.removeFromParent(),i.dispose();this.directionalLights.clear(),this._distanceRenderer||(this._distanceRenderer=new uf(this.components,this.currentWorld),this._distanceRenderer.onDistanceComputed.add(this.recomputeShadows)),this._lightsWithShadow.clear();for(let i=0;i<this.config.shadows.cascade;i++){const s=new M.DirectionalLight;s.intensity=this.config.directionalLight.intensity,s.color=this.config.directionalLight.color,s.position.copy(this.config.directionalLight.position),s.shadow.mapSize.width=this.config.shadows.resolution,s.shadow.mapSize.height=this.config.shadows.resolution,this.three.add(s,s.target),this.directionalLights.set(s.uuid,s),this._lightsWithShadow.set(i,s.uuid),s.castShadow=!0,s.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 Lc{constructor(e){y(this,"_event");y(this,"_position",new M.Vector2);y(this,"onDisposed",new Q);y(this,"updateMouseInfo",e=>{this._event=e});this.dom=e,this.setupEvents(!0)}get position(){if(this._event){const e=this.dom.getBoundingClientRect();this._position.x=this.getPositionX(e,this._event),this._position.y=this.getPositionY(e,this._event)}return this._position}dispose(){this.setupEvents(!1),this.onDisposed.trigger(),this.onDisposed.reset()}getPositionY(e,t){return-((t.clientY-e.top)/(e.bottom-e.top))*2+1}getPositionX(e,t){return(t.clientX-e.left)/(e.right-e.left)*2-1}setupEvents(e){e?this.dom.addEventListener("pointermove",this.updateMouseInfo):this.dom.removeEventListener("pointermove",this.updateMouseInfo)}}class Mc{constructor(e,t){y(this,"enabled",!0);y(this,"components");y(this,"onDisposed",new Q);y(this,"mouse");y(this,"three",new M.Raycaster);y(this,"world");const i=t.renderer;if(!i)throw new Error("A renderer is needed for the raycaster to work!");this.world=t,this.mouse=new Lc(i.three.domElement),this.components=e}dispose(){this.mouse.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}castRay(e=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(e)}castRayFromVector(e,t,i=Array.from(this.world.meshes)){return this.three.set(e,t),this.intersect(i)}intersect(e=Array.from(this.world.meshes)){const t=this.three.intersectObjects(e),i=this.filterClippingPlanes(t);return i.length>0?i[0]:null}filterClippingPlanes(e){if(!this.world.renderer)throw new Error("Renderer not found!");const t=this.world.renderer.three;if(!t.clippingPlanes)return e;const i=t.clippingPlanes;return e.length<=0||!i||(i==null?void 0:i.length)<=0?e:e.filter(s=>i.every(r=>r.distanceToPoint(s.point)>0))}}const Ir=class Ir extends Ot{constructor(t){super(t);y(this,"enabled",!0);y(this,"list",new Map);y(this,"onDisposed",new Q);t.add(Ir.uuid,this)}get(t){if(this.list.has(t.uuid))return this.list.get(t.uuid);const i=new Mc(this.components,t);return this.list.set(t.uuid,i),t.onDisposed.add(()=>{this.delete(t)}),i}delete(t){const i=this.list.get(t.uuid);i&&i.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,i]of this.list)i.dispose();this.list.clear(),this.onDisposed.trigger()}};y(Ir,"uuid","d5d8bdf0-db25-4952-b951-b643af207ace");let fi=Ir;class Dc{constructor(e,t,i){y(this,"onDisposed",new Q);y(this,"world");y(this,"components");y(this,"three");y(this,"_fade",3);y(this,"updateZoom",()=>{this.world.camera instanceof Vi&&(this.material.uniforms.uZoom.value=this.world.camera.three.zoom)});this.world=t;const{color:s,size1:r,size2:o,distance:a}=i;this.components=e;const l=new M.PlaneGeometry(2,2,1,1),c=new M.ShaderMaterial({side:M.DoubleSide,uniforms:{uSize1:{value:r},uSize2:{value:o},uColor:{value:s},uDistance:{value:a},uFade:{value:this._fade},uZoom:{value:1}},transparent:!0,vertexShader:`
67
+ `,o=new Blob([n],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(o)),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 e=[...this.scene.children];this.excludedObjects.clear();for(const t of e)t.removeFromParent();this._postQuad.geometry.dispose(),this._postQuad.removeFromParent(),this._buffer=null,this.onDisposed.reset()}}class bf extends Pc{constructor(){super(...arguments);y(this,"_distanceRenderer");y(this,"autoBias",!0);y(this,"config",{directionalLight:{color:new D.Color("white"),intensity:1.5,position:new D.Vector3(5,10,3)},ambientLight:{color:new D.Color("white"),intensity:1},shadows:{cascade:1,resolution:512}});y(this,"_lightsWithShadow",new Map);y(this,"_isComputingShadows",!1);y(this,"_shadowsEnabled",!0);y(this,"_bias",0);y(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 s=this.currentWorld.camera.three;if(!(s instanceof D.PerspectiveCamera)&&!(s instanceof D.OrthographicCamera))throw new Error("Invalid camera type!");const n=new D.Vector3;s.getWorldDirection(n);let o=t;const a=new D.Vector3;a.copy(this.config.directionalLight.position),a.normalize();for(const[l,c]of this._lightsWithShadow){const h=this.directionalLights.get(c);if(!h)throw new Error("Light not found.");const d=new D.Vector3;d.copy(n);const u=l===this._lightsWithShadow.size-1,f=u?o/2:o*2/3;d.multiplyScalar(f),d.add(s.position);const p=o-f,m=new D.Vector3;m.copy(a),m.multiplyScalar(p),h.target.position.copy(d),h.position.copy(d),h.position.add(m),h.shadow.camera.right=p,h.shadow.camera.left=-p,h.shadow.camera.top=p,h.shadow.camera.bottom=-p,h.shadow.camera.far=p*2,h.shadow.camera.updateProjectionMatrix(),h.shadow.camera.updateMatrix(),u||(o/=3)}this._isComputingShadows=!1})}get bias(){return this._bias}set bias(t){this._bias=t;for(const[,i]of this._lightsWithShadow){const s=this.directionalLights.get(i);s&&(s.shadow.bias=t)}}get shadowsEnabled(){return this._shadowsEnabled}set shadowsEnabled(t){this._shadowsEnabled=t;for(const[,i]of this.directionalLights)i.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[,i]of this.directionalLights)i.target.removeFromParent(),i.removeFromParent(),i.dispose();this.directionalLights.clear(),this._distanceRenderer||(this._distanceRenderer=new Ef(this.components,this.currentWorld),this._distanceRenderer.onDistanceComputed.add(this.recomputeShadows)),this._lightsWithShadow.clear();for(let i=0;i<this.config.shadows.cascade;i++){const s=new D.DirectionalLight;s.intensity=this.config.directionalLight.intensity,s.color=this.config.directionalLight.color,s.position.copy(this.config.directionalLight.position),s.shadow.mapSize.width=this.config.shadows.resolution,s.shadow.mapSize.height=this.config.shadows.resolution,this.three.add(s,s.target),this.directionalLights.set(s.uuid,s),this._lightsWithShadow.set(i,s.uuid),s.castShadow=!0,s.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 kc{constructor(e){y(this,"_event");y(this,"_position",new D.Vector2);y(this,"onDisposed",new K);y(this,"updateMouseInfo",e=>{this._event=e});this.dom=e,this.setupEvents(!0)}get position(){if(this._event){const e=this.dom.getBoundingClientRect();this._position.x=this.getPositionX(e,this._event),this._position.y=this.getPositionY(e,this._event)}return this._position}dispose(){this.setupEvents(!1),this.onDisposed.trigger(),this.onDisposed.reset()}getPositionY(e,t){return-((t.clientY-e.top)/(e.bottom-e.top))*2+1}getPositionX(e,t){return(t.clientX-e.left)/(e.right-e.left)*2-1}setupEvents(e){e?this.dom.addEventListener("pointermove",this.updateMouseInfo):this.dom.removeEventListener("pointermove",this.updateMouseInfo)}}class Bc{constructor(e,t){y(this,"enabled",!0);y(this,"components");y(this,"onDisposed",new K);y(this,"mouse");y(this,"three",new D.Raycaster);y(this,"world");const i=t.renderer;if(!i)throw new Error("A renderer is needed for the raycaster to work!");this.world=t,this.mouse=new kc(i.three.domElement),this.components=e}dispose(){this.mouse.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}castRay(e=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(e)}castRayFromVector(e,t,i=Array.from(this.world.meshes)){return this.three.set(e,t),this.intersect(i)}intersect(e=Array.from(this.world.meshes)){const t=this.three.intersectObjects(e),i=this.filterClippingPlanes(t);return i.length>0?i[0]:null}filterClippingPlanes(e){if(!this.world.renderer)throw new Error("Renderer not found!");const t=this.world.renderer.three;if(!t.clippingPlanes)return e;const i=t.clippingPlanes;return e.length<=0||!i||(i==null?void 0:i.length)<=0?e:e.filter(s=>i.every(n=>n.distanceToPoint(s.point)>0))}}const yr=class yr extends Ot{constructor(t){super(t);y(this,"enabled",!0);y(this,"list",new Map);y(this,"onDisposed",new K);t.add(yr.uuid,this)}get(t){if(this.list.has(t.uuid))return this.list.get(t.uuid);const i=new Bc(this.components,t);return this.list.set(t.uuid,i),t.onDisposed.add(()=>{this.delete(t)}),i}delete(t){const i=this.list.get(t.uuid);i&&i.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,i]of this.list)i.dispose();this.list.clear(),this.onDisposed.trigger()}};y(yr,"uuid","d5d8bdf0-db25-4952-b951-b643af207ace");let mi=yr;class zc{constructor(e,t,i){y(this,"onDisposed",new K);y(this,"world");y(this,"components");y(this,"three");y(this,"_fade",3);y(this,"updateZoom",()=>{this.world.camera instanceof Gi&&(this.material.uniforms.uZoom.value=this.world.camera.three.zoom)});this.world=t;const{color:s,size1:n,size2:o,distance:a}=i;this.components=e;const l=new D.PlaneGeometry(2,2,1,1),c=new D.ShaderMaterial({side:D.DoubleSide,uniforms:{uSize1:{value:n},uSize2:{value:o},uColor:{value:s},uDistance:{value:a},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 M.Mesh(l,c),this.three.frustumCulled=!1,t.scene.three.add(this.three),this.setupEvents(!0)}get visible(){return this.three.visible}set visible(e){e?this.world.scene.three.add(this.three):this.three.removeFromParent()}get material(){return this.three.material}get fade(){return this._fade===3}set fade(e){this._fade=e?3:0,this.material.uniforms.uFade.value=this._fade}dispose(){this.setupEvents(!1),this.components.get(Se).destroy(this.three),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(e){if(this.world.isDisposing||!(this.world.camera instanceof Vi))return;const t=this.world.camera.controls;e?t.addEventListener("update",this.updateZoom):t.removeEventListener("update",this.updateZoom)}}const br=class br extends Ot{constructor(t){super(t);y(this,"list",new Map);y(this,"config",{color:new M.Color(12303291),size1:1,size2:10,distance:500});y(this,"onDisposed",new Q);y(this,"enabled",!0);t.add(br.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a grid!");const i=new Dc(this.components,t,this.config);return this.list.set(t.uuid,i),t.onDisposed.add(()=>{this.delete(t)}),i}delete(t){const i=this.list.get(t.uuid);i&&i.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,i]of this.list)i.dispose();this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}};y(br,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");let Vo=br;const ii=new S.Raycaster,Vt=new S.Vector3,Le=new S.Vector3,Rt=new S.Quaternion,ul={X:new S.Vector3(1,0,0),Y:new S.Vector3(0,1,0),Z:new S.Vector3(0,0,1)},Io={type:"change"},fl={type:"mouseDown"},pl={type:"mouseUp",mode:null},ml={type:"objectChange"};class pf extends S.Object3D{constructor(e,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 i=new Cf;this._gizmo=i,this.add(i);const s=new yf;this._plane=s,this.add(s);const r=this;function o(b,v){let I=v;Object.defineProperty(r,b,{get:function(){return I!==void 0?I:v},set:function(T){I!==T&&(I=T,s[b]=T,i[b]=T,r.dispatchEvent({type:b+"-changed",value:T}),r.dispatchEvent(Io))}}),r[b]=v,s[b]=v,i[b]=v}o("camera",e),o("object",void 0),o("enabled",!0),o("axis",null),o("mode","translate"),o("translationSnap",null),o("rotationSnap",null),o("scaleSnap",null),o("space","world"),o("size",1),o("dragging",!1),o("showX",!0),o("showY",!0),o("showZ",!0);const a=new S.Vector3,l=new S.Vector3,c=new S.Quaternion,h=new S.Quaternion,d=new S.Vector3,u=new S.Quaternion,f=new S.Vector3,p=new S.Vector3,m=new S.Vector3,E=0,g=new S.Vector3;o("worldPosition",a),o("worldPositionStart",l),o("worldQuaternion",c),o("worldQuaternionStart",h),o("cameraPosition",d),o("cameraQuaternion",u),o("pointStart",f),o("pointEnd",p),o("rotationAxis",m),o("rotationAngle",E),o("eye",g),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=mf.bind(this),this._onPointerDown=Ef.bind(this),this._onPointerHover=gf.bind(this),this._onPointerMove=If.bind(this),this._onPointerUp=bf.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(e){if(this.object===void 0||this.dragging===!0)return;ii.setFromCamera(e,this.camera);const t=bo(this._gizmo.picker[this.mode],ii);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e.button!==0)&&this.axis!==null){ii.setFromCamera(e,this.camera);const t=bo(this._plane,ii,!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,fl.mode=this.mode,this.dispatchEvent(fl)}}pointerMove(e){const t=this.axis,i=this.mode,s=this.object;let r=this.space;if(i==="scale"?r="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(r="world"),s===void 0||t===null||this.dragging===!1||e.button!==-1)return;ii.setFromCamera(e,this.camera);const o=bo(this._plane,ii,!0);if(o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),i==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),r==="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),r==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),s.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(r==="local"&&(s.position.applyQuaternion(Rt.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.position.applyQuaternion(this._quaternionStart)),r==="world"&&(s.parent&&s.position.add(Vt.setFromMatrixPosition(s.parent.matrixWorld)),t.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.parent&&s.position.sub(Vt.setFromMatrixPosition(s.parent.matrixWorld))));else if(i==="scale"){if(t.search("XYZ")!==-1){let a=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(a*=-1),Le.set(a,a,a)}else Vt.copy(this.pointStart),Le.copy(this.pointEnd),Vt.applyQuaternion(this._worldQuaternionInv),Le.applyQuaternion(this._worldQuaternionInv),Le.divide(Vt),t.search("X")===-1&&(Le.x=1),t.search("Y")===-1&&(Le.y=1),t.search("Z")===-1&&(Le.z=1);s.scale.copy(this._scaleStart).multiply(Le),this.scaleSnap&&(t.search("X")!==-1&&(s.scale.x=Math.round(s.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(s.scale.y=Math.round(s.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(s.scale.z=Math.round(s.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(i==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const a=20/this.worldPosition.distanceTo(Vt.setFromMatrixPosition(this.camera.matrixWorld));let l=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Vt.copy(this.rotationAxis).cross(this.eye))*a):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(ul[t]),Vt.copy(ul[t]),r==="local"&&Vt.applyQuaternion(this.worldQuaternion),Vt.cross(this.eye),Vt.length()===0?l=!0:this.rotationAngle=this._offset.dot(Vt.normalize())*a),(t==="E"||l)&&(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),r==="local"&&t!=="E"&&t!=="XYZE"?(s.quaternion.copy(this._quaternionStart),s.quaternion.multiply(Rt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),s.quaternion.copy(Rt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),s.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(Io),this.dispatchEvent(ml)}}pointerUp(e){e.button===0&&(this.dragging&&this.axis!==null&&(pl.mode=this.mode,this.dispatchEvent(pl)),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(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,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(Io),this.dispatchEvent(ml),this.pointStart.copy(this.pointEnd))}getRaycaster(){return ii}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function mf(n){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:n.button};{const e=this.domElement.getBoundingClientRect();return{x:(n.clientX-e.left)/e.width*2-1,y:-(n.clientY-e.top)/e.height*2+1,button:n.button}}}function gf(n){if(this.enabled)switch(n.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(n));break}}function Ef(n){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(n.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(n)),this.pointerDown(this._getPointer(n)))}function If(n){this.enabled&&this.pointerMove(this._getPointer(n))}function bf(n){this.enabled&&(this.domElement.releasePointerCapture(n.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(n)))}function bo(n,e,t){const i=e.intersectObject(n,!0);for(let s=0;s<i.length;s++)if(i[s].object.visible||t)return i[s];return!1}const Nn=new S.Euler,_t=new S.Vector3(0,1,0),gl=new S.Vector3(0,0,0),El=new S.Matrix4,Pn=new S.Quaternion,$n=new S.Quaternion,Ie=new S.Vector3,Il=new S.Matrix4,ws=new S.Vector3(1,0,0),oi=new S.Vector3(0,1,0),As=new S.Vector3(0,0,1),Ln=new S.Vector3,bs=new S.Vector3,Cs=new S.Vector3;class Cf extends S.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=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}),i=e.clone();i.opacity=.15;const s=t.clone();s.opacity=.5;const r=e.clone();r.color.setHex(16711680);const o=e.clone();o.color.setHex(65280);const a=e.clone();a.color.setHex(255);const l=e.clone();l.color.setHex(16711680),l.opacity=.5;const c=e.clone();c.color.setHex(65280),c.opacity=.5;const h=e.clone();h.color.setHex(255),h.opacity=.5;const d=e.clone();d.opacity=.25;const u=e.clone();u.color.setHex(16776960),u.opacity=.25,e.clone().color.setHex(16776960);const p=e.clone();p.color.setHex(7895160);const m=new S.CylinderGeometry(0,.04,.1,12);m.translate(0,.05,0);const E=new S.BoxGeometry(.08,.08,.08);E.translate(0,.04,0);const g=new S.BufferGeometry;g.setAttribute("position",new S.Float32BufferAttribute([0,0,0,1,0,0],3));const b=new S.CylinderGeometry(.0075,.0075,.5,3);b.translate(0,.25,0);function v(U,Z){const H=new S.TorusGeometry(U,.0075,3,64,Z*Math.PI*2);return H.rotateY(Math.PI/2),H.rotateX(Math.PI/2),H}function I(){const U=new S.BufferGeometry;return U.setAttribute("position",new S.Float32BufferAttribute([0,0,0,1,1,1],3)),U}const T={X:[[new S.Mesh(m,r),[.5,0,0],[0,0,-Math.PI/2]],[new S.Mesh(m,r),[-.5,0,0],[0,0,Math.PI/2]],[new S.Mesh(b,r),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new S.Mesh(m,o),[0,.5,0]],[new S.Mesh(m,o),[0,-.5,0],[Math.PI,0,0]],[new S.Mesh(b,o)]],Z:[[new S.Mesh(m,a),[0,0,.5],[Math.PI/2,0,0]],[new S.Mesh(m,a),[0,0,-.5],[-Math.PI/2,0,0]],[new S.Mesh(b,a),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),l.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new S.Mesh(new S.BoxGeometry(.15,.15,.01),c.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},A={X:[[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),i),[0,.3,0]],[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new S.Mesh(new S.OctahedronGeometry(.2,0),i)]],XY:[[new S.Mesh(new S.BoxGeometry(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new S.Mesh(new S.BoxGeometry(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new S.Mesh(new S.BoxGeometry(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]]},R={START:[[new S.Mesh(new S.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new S.Mesh(new S.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new S.Line(I(),s),null,null,null,"helper"]],X:[[new S.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new S.Line(g,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new S.Line(g,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},P={XYZE:[[new S.Mesh(v(.5,1),p),null,[0,Math.PI/2,0]]],X:[[new S.Mesh(v(.5,.5),r)]],Y:[[new S.Mesh(v(.5,.5),o),null,[0,0,-Math.PI/2]]],Z:[[new S.Mesh(v(.5,.5),a),null,[0,Math.PI/2,0]]],E:[[new S.Mesh(v(.75,1),u),null,[0,Math.PI/2,0]]]},F={AXIS:[[new S.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},x={XYZE:[[new S.Mesh(new S.SphereGeometry(.25,10,8),i)]],X:[[new S.Mesh(new S.TorusGeometry(.5,.1,4,24),i),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new S.Mesh(new S.TorusGeometry(.5,.1,4,24),i),[0,0,0],[Math.PI/2,0,0]]],Z:[[new S.Mesh(new S.TorusGeometry(.5,.1,4,24),i),[0,0,0],[0,0,-Math.PI/2]]],E:[[new S.Mesh(new S.TorusGeometry(.75,.1,2,24),i)]]},D={X:[[new S.Mesh(E,r),[.5,0,0],[0,0,-Math.PI/2]],[new S.Mesh(b,r),[0,0,0],[0,0,-Math.PI/2]],[new S.Mesh(E,r),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new S.Mesh(E,o),[0,.5,0]],[new S.Mesh(b,o)],[new S.Mesh(E,o),[0,-.5,0],[0,0,Math.PI]]],Z:[[new S.Mesh(E,a),[0,0,.5],[Math.PI/2,0,0]],[new S.Mesh(b,a),[0,0,0],[Math.PI/2,0,0]],[new S.Mesh(E,a),[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),l),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new S.Mesh(new S.BoxGeometry(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new S.Mesh(new S.BoxGeometry(.1,.1,.1),d.clone())]]},w={X:[[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),i),[0,.3,0]],[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new S.Mesh(new S.CylinderGeometry(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new S.Mesh(new S.BoxGeometry(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new S.Mesh(new S.BoxGeometry(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new S.Mesh(new S.BoxGeometry(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new S.Mesh(new S.BoxGeometry(.2,.2,.2),i),[0,0,0]]]},L={X:[[new S.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new S.Line(g,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new S.Line(g,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function C(U){const Z=new S.Object3D;for(const H in U)for(let st=U[H].length;st--;){const Y=U[H][st][0].clone(),ot=U[H][st][1],V=U[H][st][2],B=U[H][st][3],at=U[H][st][4];Y.name=H,Y.tag=at,ot&&Y.position.set(ot[0],ot[1],ot[2]),V&&Y.rotation.set(V[0],V[1],V[2]),B&&Y.scale.set(B[0],B[1],B[2]),Y.updateMatrix();const nt=Y.geometry.clone();nt.applyMatrix4(Y.matrix),Y.geometry=nt,Y.renderOrder=1/0,Y.position.set(0,0,0),Y.rotation.set(0,0,0),Y.scale.set(1,1,1),Z.add(Y)}return Z}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=C(T)),this.add(this.gizmo.rotate=C(P)),this.add(this.gizmo.scale=C(D)),this.add(this.picker.translate=C(A)),this.add(this.picker.rotate=C(x)),this.add(this.picker.scale=C(w)),this.add(this.helper.translate=C(R)),this.add(this.helper.rotate=C(F)),this.add(this.helper.scale=C(L)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const i=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:$n;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 s=[];s=s.concat(this.picker[this.mode].children),s=s.concat(this.gizmo[this.mode].children),s=s.concat(this.helper[this.mode].children);for(let r=0;r<s.length;r++){const o=s[r];o.visible=!0,o.rotation.set(0,0,0),o.position.copy(this.worldPosition);let a;if(this.camera.isOrthographicCamera?a=(this.camera.top-this.camera.bottom)/this.camera.zoom:a=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),o.scale.set(1,1,1).multiplyScalar(a*this.size/4),o.tag==="helper"){o.visible=!1,o.name==="AXIS"?(o.visible=!!this.axis,this.axis==="X"&&(Rt.setFromEuler(Nn.set(0,0,0)),o.quaternion.copy(i).multiply(Rt),Math.abs(_t.copy(ws).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Y"&&(Rt.setFromEuler(Nn.set(0,0,Math.PI/2)),o.quaternion.copy(i).multiply(Rt),Math.abs(_t.copy(oi).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Z"&&(Rt.setFromEuler(Nn.set(0,Math.PI/2,0)),o.quaternion.copy(i).multiply(Rt),Math.abs(_t.copy(As).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="XYZE"&&(Rt.setFromEuler(Nn.set(0,Math.PI/2,0)),_t.copy(this.rotationAxis),o.quaternion.setFromRotationMatrix(El.lookAt(gl,_t,oi)),o.quaternion.multiply(Rt),o.visible=this.dragging),this.axis==="E"&&(o.visible=!1)):o.name==="START"?(o.position.copy(this.worldPositionStart),o.visible=this.dragging):o.name==="END"?(o.position.copy(this.worldPosition),o.visible=this.dragging):o.name==="DELTA"?(o.position.copy(this.worldPositionStart),o.quaternion.copy(this.worldQuaternionStart),Vt.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Vt.applyQuaternion(this.worldQuaternionStart.clone().invert()),o.scale.copy(Vt),o.visible=this.dragging):(o.quaternion.copy(i),this.dragging?o.position.copy(this.worldPositionStart):o.position.copy(this.worldPosition),this.axis&&(o.visible=this.axis.search(o.name)!==-1));continue}o.quaternion.copy(i),this.mode==="translate"||this.mode==="scale"?(o.name==="X"&&Math.abs(_t.copy(ws).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Y"&&Math.abs(_t.copy(oi).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Z"&&Math.abs(_t.copy(As).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XY"&&Math.abs(_t.copy(As).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="YZ"&&Math.abs(_t.copy(ws).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XZ"&&Math.abs(_t.copy(oi).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1)):this.mode==="rotate"&&(Pn.copy(i),_t.copy(this.eye).applyQuaternion(Rt.copy(i).invert()),o.name.search("E")!==-1&&o.quaternion.setFromRotationMatrix(El.lookAt(this.eye,gl,oi)),o.name==="X"&&(Rt.setFromAxisAngle(ws,Math.atan2(-_t.y,_t.z)),Rt.multiplyQuaternions(Pn,Rt),o.quaternion.copy(Rt)),o.name==="Y"&&(Rt.setFromAxisAngle(oi,Math.atan2(_t.x,_t.z)),Rt.multiplyQuaternions(Pn,Rt),o.quaternion.copy(Rt)),o.name==="Z"&&(Rt.setFromAxisAngle(As,Math.atan2(_t.y,_t.x)),Rt.multiplyQuaternions(Pn,Rt),o.quaternion.copy(Rt))),o.visible=o.visible&&(o.name.indexOf("X")===-1||this.showX),o.visible=o.visible&&(o.name.indexOf("Y")===-1||this.showY),o.visible=o.visible&&(o.name.indexOf("Z")===-1||this.showZ),o.visible=o.visible&&(o.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),o.material._color=o.material._color||o.material.color.clone(),o.material._opacity=o.material._opacity||o.material.opacity,o.material.color.copy(o.material._color),o.material.opacity=o.material._opacity,this.enabled&&this.axis&&(o.name===this.axis||this.axis.split("").some(function(l){return o.name===l}))&&(o.material.color.setHex(16776960),o.material.opacity=1)}super.updateMatrixWorld(e)}}class yf 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(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),Ln.copy(ws).applyQuaternion(t==="local"?this.worldQuaternion:$n),bs.copy(oi).applyQuaternion(t==="local"?this.worldQuaternion:$n),Cs.copy(As).applyQuaternion(t==="local"?this.worldQuaternion:$n),_t.copy(bs),this.mode){case"translate":case"scale":switch(this.axis){case"X":_t.copy(this.eye).cross(Ln),Ie.copy(Ln).cross(_t);break;case"Y":_t.copy(this.eye).cross(bs),Ie.copy(bs).cross(_t);break;case"Z":_t.copy(this.eye).cross(Cs),Ie.copy(Cs).cross(_t);break;case"XY":Ie.copy(Cs);break;case"YZ":Ie.copy(Ln);break;case"XZ":_t.copy(Cs),Ie.copy(bs);break;case"XYZ":case"E":Ie.set(0,0,0);break}break;case"rotate":default:Ie.set(0,0,0)}Ie.length()===0?this.quaternion.copy(this.cameraQuaternion):(Il.lookAt(Vt.set(0,0,0),Ie,_t),this.quaternion.setFromRotationMatrix(Il)),super.updateMatrixWorld(e)}}class Pr{constructor(e,t,i,s,r,o=5,a=!0){y(this,"onDraggingStarted",new Q);y(this,"onDraggingEnded",new Q);y(this,"onDisposed",new Q);y(this,"normal");y(this,"origin");y(this,"three",new M.Plane);y(this,"components");y(this,"world");y(this,"type","default");y(this,"_helper");y(this,"_visible",!0);y(this,"_enabled",!0);y(this,"_controlsActive",!1);y(this,"_arrowBoundBox",new M.Mesh);y(this,"_planeMesh");y(this,"_controls");y(this,"_hiddenMaterial",new M.MeshBasicMaterial({visible:!1}));y(this,"update",()=>{this._enabled&&this.three.setFromNormalAndCoplanarPoint(this.normal,this._helper.position)});y(this,"changeDrag",e=>{this._visible=!e.value,this.preventCameraMovement(),this.notifyDraggingChanged(e)});if(this.components=e,this.world=t,!t.renderer)throw new Error("The given world must have a renderer!");this.normal=s,this.origin=i,t.renderer.setPlane(!0,this.three),this._planeMesh=Pr.newPlaneMesh(o,r),this._helper=this.newHelper(),this._controls=this.newTransformControls(),this.three.setFromNormalAndCoplanarPoint(s,i),a&&this.toggleControls(!0)}get enabled(){return this._enabled}set enabled(e){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");this._enabled=e,this.world.renderer.setPlane(e,this.three)}get visible(){return this._visible}set visible(e){this._visible=e,this._controls.visible=e,this._helper.visible=e,this.toggleControls(e)}get meshes(){return[this._planeMesh,this._arrowBoundBox]}get planeMaterial(){return this._planeMesh.material}set planeMaterial(e){this._planeMesh.material=e}get size(){return this._planeMesh.scale.x}set size(e){this._planeMesh.scale.set(e,e,e)}get helper(){return this._helper}setFromNormalAndCoplanarPoint(e,t){this.reset(),this.normal.equals(e)||(this.normal.copy(e),this._helper.lookAt(e)),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 e=new M.Vector3(1,0,0),t=new M.Vector3;this.normal.equals(e)||(this.normal.copy(e),this._helper.lookAt(e)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix()}toggleControls(e){if(e){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=e}newTransformControls(){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");const e=this.world.camera.three,t=this.world.renderer.three.domElement,i=new pf(e,t);return this.initializeControls(i),this.world.scene.three.add(i),i}initializeControls(e){e.attach(this._helper),e.showX=!1,e.showY=!1,e.setSpace("local"),this.createArrowBoundingBox(),e.children[0].children[0].add(this._arrowBoundBox)}createArrowBoundingBox(){this._arrowBoundBox.geometry=new M.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(e){e.value?this.onDraggingStarted.trigger():this.onDraggingEnded.trigger()}preventCameraMovement(){this.world.camera.enabled=this._visible}newHelper(){const e=new M.Object3D;return e.lookAt(this.normal),e.position.copy(this.origin),this._planeMesh.position.z+=.01,e.add(this._planeMesh),this.world.scene.three.add(e),e}static newPlaneMesh(e,t){const i=new M.PlaneGeometry(1),s=new M.Mesh(i,t);return s.scale.set(e,e,e),s}}const Ds=class Ds extends Ot{constructor(t){super(t);y(this,"onBeforeDrag",new Q);y(this,"onAfterDrag",new Q);y(this,"onBeforeCreate",new Q);y(this,"onBeforeCancel",new Q);y(this,"onAfterCancel",new Q);y(this,"onBeforeDelete",new Q);y(this,"onAfterCreate",new Q);y(this,"onAfterDelete",new Q);y(this,"onDisposed",new Q);y(this,"orthogonalY",!1);y(this,"toleranceOrthogonalY",.7);y(this,"Type",Pr);y(this,"list",[]);y(this,"_material",new M.MeshBasicMaterial({color:12255487,side:M.DoubleSide,transparent:!0,opacity:.2}));y(this,"_size",5);y(this,"_enabled",!1);y(this,"_visible",!0);y(this,"_onStartDragging",()=>{this.onBeforeDrag.trigger()});y(this,"_onEndDragging",()=>{this.onAfterDrag.trigger()});this.components.add(Ds.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const i of this.list)i.enabled=t;this.updateMaterialsAndPlanes()}get visible(){return this._visible}set visible(t){this._visible=t;for(const i of this.list)i.visible=t}get material(){return this._material}set material(t){this._material=t;for(const i of this.list)i.planeMaterial=t}get size(){return this._size}set size(t){this._size=t;for(const i of this.list)i.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(Ds.uuid),this.onDisposed.reset()}create(t){const r=this.components.get(fi).get(t).castRay();return r?this.createPlaneFromIntersection(t,r):null}createFromNormalAndCoplanarPoint(t,i,s){const r=this.newPlane(t,s,i);return this.updateMaterialsAndPlanes(),r}delete(t,i){i||(i=this.pickPlane(t)),i&&this.deletePlane(i)}deleteAll(t){const i=[...this.list];for(const s of i)if(!t||t.has(s.type)){this.delete(s.world,s);const r=this.list.indexOf(s);r!==-1&&this.list.splice(r,1)}}deletePlane(t){const i=this.list.indexOf(t);if(i!==-1){if(this.list.splice(i,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 s=this.components.get(fi).get(t),r=this.getAllPlaneMeshes(),o=s.castRay(r);if(o){const a=o.object;return this.list.find(l=>l.meshes.includes(a))}}getAllPlaneMeshes(){const t=[];for(const i of this.list)t.push(...i.meshes);return t}createPlaneFromIntersection(t,i){var l;if(!t.renderer)throw new Error("The given world must have a renderer!");const s=i.point.distanceTo(new M.Vector3(0,0,0)),r=(l=i.face)==null?void 0:l.normal;if(!s||!r)return null;const o=this.getWorldNormal(i,r),a=this.newPlane(t,i.point,o.negate());return a.visible=this._visible,a.size=this._size,t.renderer.setPlane(!0,a.three),this.updateMaterialsAndPlanes(),a}getWorldNormal(t,i){const s=t.object;let r=t.object.matrixWorld.clone();if(s instanceof M.InstancedMesh&&t.instanceId!==void 0){const c=new M.Matrix4;s.getMatrixAt(t.instanceId,c),r=c.multiply(r)}const a=new M.Matrix3().getNormalMatrix(r),l=i.clone().applyMatrix3(a).normalize();return this.normalizePlaneDirectionY(l),l}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,i,s){const r=new this.Type(this.components,t,i,s,this._material);return r.onDraggingStarted.add(this._onStartDragging),r.onDraggingEnded.add(this._onEndDragging),this.list.push(r),this.onAfterCreate.trigger(r),r}updateMaterialsAndPlanes(){const t=this.components.get(Zn);for(const[i,s]of t.list){if(!s.renderer)continue;s.renderer.updateClippingPlanes();const{clippingPlanes:r}=s.renderer;for(const o of s.meshes)if(o.material)if(Array.isArray(o.material))for(const a of o.material)a.clippingPlanes=r;else o.material.clippingPlanes=r}}};y(Ds,"uuid","66290bc5-18c4-4cd1-9379-2e17a0617611");let Qn=Ds;class Uc{constructor(e){y(this,"enabled",!1);y(this,"id","FirstPerson");this.camera=e}set(e){if(this.enabled=e,e){if(this.camera.projection.current!=="Perspective"){this.camera.set("Orbit");return}this.setupFirstPersonCamera()}}setupFirstPersonCamera(){const e=this.camera.controls,t=new M.Vector3;e.distance--,e.getPosition(t),e.minDistance=1,e.maxDistance=1,e.distance=1,e.moveTo(t.x,t.y,t.z),e.truckSpeed=50,e.mouseButtons.wheel=$t.ACTION.DOLLY,e.touches.two=$t.ACTION.TOUCH_ZOOM_TRUCK}}class kc{constructor(e){y(this,"enabled",!0);y(this,"id","Orbit");this.camera=e,this.activateOrbitControls()}set(e){this.enabled=e,e&&this.activateOrbitControls()}activateOrbitControls(){const e=this.camera.controls;e.minDistance=1,e.maxDistance=300;const t=new M.Vector3;e.getPosition(t);const i=t.length();e.distance=i,e.truckSpeed=2;const{rotation:s}=this.camera.three,r=new M.Vector3(0,0,-1).applyEuler(s),o=t.addScaledVector(r,i);e.moveTo(o.x,o.y,o.z)}}class Bc{constructor(e){y(this,"enabled",!1);y(this,"id","Plan");y(this,"mouseAction1");y(this,"mouseAction2");y(this,"mouseInitialized",!1);y(this,"defaultAzimuthSpeed");y(this,"defaultPolarSpeed");this.camera=e,this.defaultAzimuthSpeed=e.controls.azimuthRotateSpeed,this.defaultPolarSpeed=e.controls.polarRotateSpeed}set(e){this.enabled=e;const t=this.camera.controls;t.azimuthRotateSpeed=e?0:this.defaultAzimuthSpeed,t.polarRotateSpeed=e?0:this.defaultPolarSpeed,this.mouseInitialized||(this.mouseAction1=t.touches.one,this.mouseAction2=t.touches.two,this.mouseInitialized=!0),e?(t.mouseButtons.left=$t.ACTION.TRUCK,t.touches.one=$t.ACTION.TOUCH_TRUCK,t.touches.two=$t.ACTION.TOUCH_ZOOM):(t.mouseButtons.left=$t.ACTION.ROTATE,t.touches.one=this.mouseAction1,t.touches.two=this.mouseAction2)}}class zc{constructor(e){y(this,"onChanged",new Q);y(this,"current","Perspective");y(this,"camera");y(this,"matchOrthoDistanceEnabled",!1);y(this,"_component");y(this,"_previousDistance",-1);this._component=e,this.camera=e.three}async set(e){this.current!==e&&(e==="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 e=this.getPerspectiveDims();if(!e)return;const{width:t,height:i}=e;this.setupOrthoCamera(i,t),this.camera=this._component.threeOrtho,this.current="Orthographic"}getPerspectiveDims(){const e=this._component.currentWorld;if(!e||!e.renderer)return null;const t=new M.Vector3;this._component.threePersp.getWorldDirection(t);const i=new M.Vector3;this._component.controls.getTarget(i);const r=i.clone().sub(this._component.threePersp.position).dot(t),o=e.renderer.getSize(),a=o.x/o.y,l=this._component.threePersp,c=r*2*Math.atan(l.fov*(Math.PI/180)/2);return{width:c*a,height:c}}setupOrthoCamera(e,t){this._component.controls.mouseButtons.wheel=$t.ACTION.ZOOM,this._component.controls.mouseButtons.middle=$t.ACTION.ZOOM;const i=this._component.threePersp,s=this._component.threeOrtho;s.zoom=1,s.left=t/-2,s.right=t/2,s.top=e/2,s.bottom=e/-2,s.updateProjectionMatrix(),s.position.copy(i.position),s.quaternion.copy(i.quaternion),this._component.controls.camera=s}getDistance(){const e=this._component.threePersp,t=this._component.threeOrtho;return(t.top-t.bottom)/t.zoom/(2*Math.atan(e.fov*(Math.PI/180)/2))}async setPerspectiveCamera(){this._component.controls.mouseButtons.wheel=$t.ACTION.DOLLY,this._component.controls.mouseButtons.middle=$t.ACTION.DOLLY;const e=this._component.threePersp,t=this._component.threeOrtho;e.position.copy(t.position),e.quaternion.copy(t.quaternion),this._component.controls.mouseButtons.wheel=$t.ACTION.DOLLY,this.matchOrthoDistanceEnabled?this._component.controls.distance=this.getDistance():this._component.controls.distance=this._previousDistance,await this._component.controls.zoomTo(1),e.updateProjectionMatrix(),this._component.controls.camera=e,this.camera=e,this.current="Perspective"}}class Vc extends Vi{constructor(t){super(t);y(this,"projection");y(this,"threeOrtho");y(this,"threePersp");y(this,"_userInputButtons",{});y(this,"_frustumSize",50);y(this,"_navigationModes",new Map);y(this,"_mode",null);y(this,"previousSize",null);this.threePersp=this.three,this.threeOrtho=this.newOrthoCamera(),this.projection=new zc(this),this.onAspectUpdated.add(()=>{this.setOrthoPerspCameraAspect()}),this.projection.onChanged.add(i=>{this.three=i,this.updateAspect()}),this.onWorldChanged.add(({action:i})=>{i==="added"&&(this._navigationModes.clear(),this._navigationModes.set("Orbit",new kc(this)),this._navigationModes.set("FirstPerson",new Uc(this)),this._navigationModes.set("Plan",new Bc(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,i=1.5){if(!this.enabled)return;const s=Number.MAX_VALUE,r=Number.MIN_VALUE,o=new M.Vector3(s,s,s),a=new M.Vector3(r,r,r);for(const f of t){const p=new M.Box3().setFromObject(f);p.min.x<o.x&&(o.x=p.min.x),p.min.y<o.y&&(o.y=p.min.y),p.min.z<o.z&&(o.z=p.min.z),p.max.x>a.x&&(a.x=p.max.x),p.max.y>a.y&&(a.y=p.max.y),p.max.z>a.z&&(a.z=p.max.z)}const l=new M.Box3(o,a),c=new M.Vector3;l.getSize(c);const h=new M.Vector3;l.getCenter(h);const d=Math.max(c.x,c.y,c.z)*i,u=new M.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 M.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(),i=this.threeOrtho.top,s=this.threeOrtho.right,r=t.y/this.previousSize.y,o=t.x/this.previousSize.x,a=i*r,l=s*o;this.threeOrtho.left=-l,this.threeOrtho.right=l,this.threeOrtho.top=a,this.threeOrtho.bottom=-a,this.threeOrtho.updateProjectionMatrix(),this.previousSize.copy(t)}}const _f=new Map([[tt.IFCRELAGGREGATES,{forRelated:"Decomposes",forRelating:"IsDecomposedBy"}],[tt.IFCRELASSOCIATESMATERIAL,{forRelated:"HasAssociations",forRelating:"AssociatedTo"}],[tt.IFCRELASSOCIATESCLASSIFICATION,{forRelated:"HasAssociations",forRelating:"ClassificationForObjects"}],[tt.IFCRELASSIGNSTOGROUP,{forRelated:"HasAssignments",forRelating:"IsGroupedBy"}],[tt.IFCRELDEFINESBYPROPERTIES,{forRelated:"IsDefinedBy",forRelating:"DefinesOcurrence"}],[tt.IFCRELDEFINESBYTYPE,{forRelated:"IsTypedBy",forRelating:"Types"}],[tt.IFCRELDEFINESBYTEMPLATE,{forRelated:"IsDefinedBy",forRelating:"Defines"}],[tt.IFCRELCONTAINEDINSPATIALSTRUCTURE,{forRelated:"ContainedInStructure",forRelating:"ContainsElements"}],[tt.IFCRELFLOWCONTROLELEMENTS,{forRelated:"AssignedToFlowElement",forRelating:"HasControlElements"}],[tt.IFCRELCONNECTSELEMENTS,{forRelated:"ConnectedFrom",forRelating:"ConnectedTo"}],[tt.IFCRELASSIGNSTOPRODUCT,{forRelated:"HasAssignments",forRelating:"ReferencedBy"}],[tt.IFCRELDECLARES,{forRelated:"HasContext",forRelating:"Declares"}],[tt.IFCRELASSIGNSTOCONTROL,{forRelated:"HasAssignments",forRelating:"Controls"}],[tt.IFCRELNESTS,{forRelated:"Nests",forRelating:"IsNestedBy"}]]),Us=class Us extends Ot{constructor(t){super(t);y(this,"onDisposed",new Q);y(this,"onRelationsIndexed",new Q);y(this,"relationMaps",{});y(this,"enabled",!0);y(this,"_relToAttributesMap",_f);y(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"]);y(this,"_ifcRels",[tt.IFCRELAGGREGATES,tt.IFCRELASSOCIATESMATERIAL,tt.IFCRELASSOCIATESCLASSIFICATION,tt.IFCRELASSIGNSTOGROUP,tt.IFCRELDEFINESBYPROPERTIES,tt.IFCRELDEFINESBYTYPE,tt.IFCRELDEFINESBYTEMPLATE,tt.IFCRELCONTAINEDINSPATIALSTRUCTURE,tt.IFCRELFLOWCONTROLELEMENTS,tt.IFCRELCONNECTSELEMENTS,tt.IFCRELASSIGNSTOPRODUCT,tt.IFCRELDECLARES,tt.IFCRELASSIGNSTOCONTROL,tt.IFCRELNESTS]);y(this,"onFragmentsDisposed",t=>{delete this.relationMaps[t.groupID]});this.components.add(Us.uuid,this),t.get(St).onFragmentsDisposed.add(this.onFragmentsDisposed)}indexRelations(t,i,s,r){const o=Object.keys(i).find(u=>u.startsWith("Relating")),a=Object.keys(i).find(u=>u.startsWith("Related"));if(!(o&&a))return;const l=i[o].value,c=i[a].map(u=>u.value),h=t.get(l)??new Map,d=this.getAttributeIndex(r);d!==null&&(h.set(d,c),t.set(l,h));for(const u of c){const f=t.get(u)??new Map,p=this.getAttributeIndex(s);if(!p)continue;const m=f.get(p)??[];m.push(l),f.set(p,m),t.set(u,f)}}getAttributeIndex(t){const i=this._inverseAttributes.indexOf(t);return i===-1?null:i}setRelationMap(t,i){this.relationMaps[t.uuid]=i,this.onRelationsIndexed.trigger({modelID:t.uuid,relationsMap:i})}async process(t){if(!t.hasProperties)throw new Error("FragmentsGroup properties not found");let i=this.relationMaps[t.uuid];if(i)return i;i=new Map;for(const s of this._ifcRels){const r=await t.getAllPropertiesOfType(s);if(!r)continue;const o=this._relToAttributesMap.get(s);if(!o)continue;const{forRelated:a,forRelating:l}=o;for(const c in r){const h=r[c];this.indexRelations(i,h,a,l)}}return this.setRelationMap(t,i),i}async processFromWebIfc(t,i){const s=new Map;for(const r of this._ifcRels){const o=this._relToAttributesMap.get(r);if(!o)continue;const{forRelated:a,forRelating:l}=o,c=t.GetLineIDsWithType(i,r);for(let h=0;h<c.size();h++){const d=await t.properties.getItemProperties(i,c.get(h));this.indexRelations(s,d,a,l)}}return this.onRelationsIndexed.trigger({modelID:i.toString(),relationsMap:s}),s}getEntityRelations(t,i,s){const r=this.relationMaps[t.uuid];if(!r)throw new Error(`IfcRelationsIndexer: model ${t.uuid} has no relations indexed.`);const o=r.get(i),a=this.getAttributeIndex(s);if(o===void 0||a===null)return null;const l=o.get(a);return l||null}serializeRelations(t){const i={};for(const[s,r]of t.entries()){i[s]||(i[s]={});for(const[o,a]of r.entries())i[s][o]=a}return JSON.stringify(i)}serializeModelRelations(t){const i=this.relationMaps[t.uuid];return i?this.serializeRelations(i):null}serializeAllRelations(){const t={};for(const i in this.relationMaps){const s=this.relationMaps[i],r={};for(const[o,a]of s.entries()){r[o]||(r[o]={});for(const[l,c]of a.entries())r[o][l]=c}t[i]=r}return JSON.stringify(t)}getRelationsMapFromJSON(t){const i=JSON.parse(t),s=new Map;for(const r in i){const o=i[r],a=new Map;for(const l in o)a.set(Number(l),o[l]);s.set(Number(r),a)}return s}dispose(){this.relationMaps={},this.components.get(St).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(Us.uuid),this.onDisposed.reset()}getEntitiesWithRelation(t,i,s){const r=this.relationMaps[t.uuid];if(!r)throw new Error("IfcRelationsIndexer: the model relations are not indexed!");const o=new Set;for(const[a,l]of r){const c=this.getAttributeIndex(i);if(c===null)throw new Error("IfcRelationsIndexer: invalid inverse attribute name");const h=l.get(c);h&&h.includes(s)&&o.add(a)}return o}addEntityRelations(t,i,s,...r){const o=this.getEntityRelations(t,i,s);if(o)o.push(...r);else{const a=this.getAttributeIndex(s);if(!a)throw new Error(`IfcRelationsIndexer: ${s} is not a valid relation name.`);const l=this.relationMaps[t.uuid].get(i);l==null||l.set(a,r)}}getEntityChildren(t,i,s=new Set){if(s.add(i),this.relationMaps[t.uuid]===void 0)throw new Error("The provided model has no indices. You have to generate them first.");const o=this.getEntityRelations(t,i,"IsDecomposedBy");if(o)for(const l of o)this.getEntityChildren(t,l,s);const a=this.getEntityRelations(t,i,"ContainsElements");if(a)for(const l of a)this.getEntityChildren(t,l,s);return s}};y(Us,"uuid","23a889ab-83b3-44a4-8bee-ead83438370b");let pi=Us;const Cr=class Cr extends Ot{constructor(t){super(t);y(this,"onDisposed",new Q);y(this,"onFragmentsLoaded",new Q);y(this,"onFragmentsDisposed",new Q);y(this,"list",new Bs);y(this,"groups",new Bs);y(this,"baseCoordinationModel","");y(this,"baseCoordinationMatrix",new M.Matrix4);y(this,"enabled",!0);y(this,"_loader",new Ic.Serializer);this.components.add(Cr.uuid,this)}get meshes(){const t=[];for(const[i,s]of this.list)t.push(s.mesh);return t}dispose(){for(const[t,i]of this.groups)i.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:i}=t,s=[];for(const r of t.items)s.push(r.id),this.list.delete(r.id);t.dispose(!0),this.groups.delete(t.uuid),this.onFragmentsDisposed.trigger({groupID:i,fragmentIDs:s})}load(t,i){const r={...{coordinate:!0},...i},{coordinate:o,name:a,properties:l,relationsMap:c}=r,h=this._loader.import(t);i&&(h.isStreamed=i.isStreamed||!1),a&&(h.name=a);for(const d of h.items)d.group=h,this.list.set(d.id,d);return o&&this.coordinate([h]),this.groups.set(h.uuid,h),l&&h.setLocalProperties(l),c&&this.components.get(pi).setRelationMap(h,c),this.onFragmentsLoaded.trigger(h),h}export(t){return this._loader.export(t)}getModelIdMap(t){const i={};for(const s in t){const r=this.list.get(s);if(!(r&&r.group))continue;const o=r.group;o.uuid in i||(i[o.uuid]=new Set);const a=t[s];for(const l of a)i[o.uuid].add(l)}return i}modelIdToFragmentIdMap(t){let i={};for(const s in t){const r=this.groups.get(s);if(!r)continue;const o=t[s],a=r.getFragmentMap(o);i={...i,...a}}return i}guidToFragmentIdMap(t){const i={};for(const[r,o]of this.groups){r in i||(i[r]=new Set);for(const a of t){const l=o.globalToExpressIDs.get(a);l&&i[r].add(l)}}return this.modelIdToFragmentIdMap(i)}coordinate(t=Array.from(this.groups.values())){if(this.baseCoordinationModel.length===0){const s=t.pop();if(!s)return;this.baseCoordinationModel=s.uuid,this.baseCoordinationMatrix=s.coordinationMatrix.clone()}if(t.length)for(const s of t)s.coordinationMatrix.equals(this.baseCoordinationMatrix)||(s.position.set(0,0,0),s.rotation.set(0,0,0),s.scale.set(1,1,1),s.updateMatrix(),this.applyBaseCoordinateSystem(s,s.coordinationMatrix))}applyBaseCoordinateSystem(t,i){i&&t.applyMatrix4(i.clone().invert()),t.applyMatrix4(this.baseCoordinationMatrix)}clone(t,i){const s=t.cloneGroup(i);this.groups.set(s.uuid,s);for(const r of s.items)this.list.set(r.id,r);return s}};y(Cr,"uuid","fef46874-46a3-461b-8c44-2922ab77c806");let St=Cr;var Mn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Tf(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Dn(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var $c={exports:{}};/*!
128
+ `,extensions:{derivatives:!0}});this.three=new D.Mesh(l,c),this.three.frustumCulled=!1,t.scene.three.add(this.three),this.setupEvents(!0)}get visible(){return this.three.visible}set visible(e){e?this.world.scene.three.add(this.three):this.three.removeFromParent()}get material(){return this.three.material}get fade(){return this._fade===3}set fade(e){this._fade=e?3:0,this.material.uniforms.uFade.value=this._fade}dispose(){this.setupEvents(!1),this.components.get(Pe).destroy(this.three),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(e){if(this.world.isDisposing||!(this.world.camera instanceof Gi))return;const t=this.world.camera.controls;e?t.addEventListener("update",this.updateZoom):t.removeEventListener("update",this.updateZoom)}}const _r=class _r extends Ot{constructor(t){super(t);y(this,"list",new Map);y(this,"config",{color:new D.Color(12303291),size1:1,size2:10,distance:500});y(this,"onDisposed",new K);y(this,"enabled",!0);t.add(_r.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a grid!");const i=new zc(this.components,t,this.config);return this.list.set(t.uuid,i),t.onDisposed.add(()=>{this.delete(t)}),i}delete(t){const i=this.list.get(t.uuid);i&&i.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,i]of this.list)i.dispose();this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}};y(_r,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");let Go=_r;const ri=new F.Raycaster,Vt=new F.Vector3,Be=new F.Vector3,St=new F.Quaternion,gl={X:new F.Vector3(1,0,0),Y:new F.Vector3(0,1,0),Z:new F.Vector3(0,0,1)},Co={type:"change"},El={type:"mouseDown"},bl={type:"mouseUp",mode:null},Il={type:"objectChange"};class If extends F.Object3D{constructor(e,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 i=new wf;this._gizmo=i,this.add(i);const s=new Af;this._plane=s,this.add(s);const n=this;function o(I,T){let b=T;Object.defineProperty(n,I,{get:function(){return b!==void 0?b:T},set:function(v){b!==v&&(b=v,s[I]=v,i[I]=v,n.dispatchEvent({type:I+"-changed",value:v}),n.dispatchEvent(Co))}}),n[I]=T,s[I]=T,i[I]=T}o("camera",e),o("object",void 0),o("enabled",!0),o("axis",null),o("mode","translate"),o("translationSnap",null),o("rotationSnap",null),o("scaleSnap",null),o("space","world"),o("size",1),o("dragging",!1),o("showX",!0),o("showY",!0),o("showZ",!0);const a=new F.Vector3,l=new F.Vector3,c=new F.Quaternion,h=new F.Quaternion,d=new F.Vector3,u=new F.Quaternion,f=new F.Vector3,p=new F.Vector3,m=new F.Vector3,E=0,g=new F.Vector3;o("worldPosition",a),o("worldPositionStart",l),o("worldQuaternion",c),o("worldQuaternionStart",h),o("cameraPosition",d),o("cameraQuaternion",u),o("pointStart",f),o("pointEnd",p),o("rotationAxis",m),o("rotationAngle",E),o("eye",g),this._offset=new F.Vector3,this._startNorm=new F.Vector3,this._endNorm=new F.Vector3,this._cameraScale=new F.Vector3,this._parentPosition=new F.Vector3,this._parentQuaternion=new F.Quaternion,this._parentQuaternionInv=new F.Quaternion,this._parentScale=new F.Vector3,this._worldScaleStart=new F.Vector3,this._worldQuaternionInv=new F.Quaternion,this._worldScale=new F.Vector3,this._positionStart=new F.Vector3,this._quaternionStart=new F.Quaternion,this._scaleStart=new F.Vector3,this._getPointer=Cf.bind(this),this._onPointerDown=_f.bind(this),this._onPointerHover=yf.bind(this),this._onPointerMove=Tf.bind(this),this._onPointerUp=vf.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(e){if(this.object===void 0||this.dragging===!0)return;ri.setFromCamera(e,this.camera);const t=yo(this._gizmo.picker[this.mode],ri);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e.button!==0)&&this.axis!==null){ri.setFromCamera(e,this.camera);const t=yo(this._plane,ri,!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,El.mode=this.mode,this.dispatchEvent(El)}}pointerMove(e){const t=this.axis,i=this.mode,s=this.object;let n=this.space;if(i==="scale"?n="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(n="world"),s===void 0||t===null||this.dragging===!1||e.button!==-1)return;ri.setFromCamera(e,this.camera);const o=yo(this._plane,ri,!0);if(o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),i==="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),s.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(n==="local"&&(s.position.applyQuaternion(St.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.position.applyQuaternion(this._quaternionStart)),n==="world"&&(s.parent&&s.position.add(Vt.setFromMatrixPosition(s.parent.matrixWorld)),t.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.parent&&s.position.sub(Vt.setFromMatrixPosition(s.parent.matrixWorld))));else if(i==="scale"){if(t.search("XYZ")!==-1){let a=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(a*=-1),Be.set(a,a,a)}else Vt.copy(this.pointStart),Be.copy(this.pointEnd),Vt.applyQuaternion(this._worldQuaternionInv),Be.applyQuaternion(this._worldQuaternionInv),Be.divide(Vt),t.search("X")===-1&&(Be.x=1),t.search("Y")===-1&&(Be.y=1),t.search("Z")===-1&&(Be.z=1);s.scale.copy(this._scaleStart).multiply(Be),this.scaleSnap&&(t.search("X")!==-1&&(s.scale.x=Math.round(s.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(s.scale.y=Math.round(s.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(s.scale.z=Math.round(s.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(i==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const a=20/this.worldPosition.distanceTo(Vt.setFromMatrixPosition(this.camera.matrixWorld));let l=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Vt.copy(this.rotationAxis).cross(this.eye))*a):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(gl[t]),Vt.copy(gl[t]),n==="local"&&Vt.applyQuaternion(this.worldQuaternion),Vt.cross(this.eye),Vt.length()===0?l=!0:this.rotationAngle=this._offset.dot(Vt.normalize())*a),(t==="E"||l)&&(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"?(s.quaternion.copy(this._quaternionStart),s.quaternion.multiply(St.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),s.quaternion.copy(St.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),s.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(Co),this.dispatchEvent(Il)}}pointerUp(e){e.button===0&&(this.dragging&&this.axis!==null&&(bl.mode=this.mode,this.dispatchEvent(bl)),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(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,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(Co),this.dispatchEvent(Il),this.pointStart.copy(this.pointEnd))}getRaycaster(){return ri}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function Cf(r){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:r.button};{const e=this.domElement.getBoundingClientRect();return{x:(r.clientX-e.left)/e.width*2-1,y:-(r.clientY-e.top)/e.height*2+1,button:r.button}}}function yf(r){if(this.enabled)switch(r.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(r));break}}function _f(r){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(r.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(r)),this.pointerDown(this._getPointer(r)))}function Tf(r){this.enabled&&this.pointerMove(this._getPointer(r))}function vf(r){this.enabled&&(this.domElement.releasePointerCapture(r.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(r)))}function yo(r,e,t){const i=e.intersectObject(r,!0);for(let s=0;s<i.length;s++)if(i[s].object.visible||t)return i[s];return!1}const Ln=new F.Euler,_t=new F.Vector3(0,1,0),Cl=new F.Vector3(0,0,0),yl=new F.Matrix4,Mn=new F.Quaternion,Gn=new F.Quaternion,Ce=new F.Vector3,_l=new F.Matrix4,Fs=new F.Vector3(1,0,0),ci=new F.Vector3(0,1,0),Os=new F.Vector3(0,0,1),Dn=new F.Vector3,Ts=new F.Vector3,vs=new F.Vector3;class wf extends F.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new F.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new F.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=e.clone();i.opacity=.15;const s=t.clone();s.opacity=.5;const n=e.clone();n.color.setHex(16711680);const o=e.clone();o.color.setHex(65280);const a=e.clone();a.color.setHex(255);const l=e.clone();l.color.setHex(16711680),l.opacity=.5;const c=e.clone();c.color.setHex(65280),c.opacity=.5;const h=e.clone();h.color.setHex(255),h.opacity=.5;const d=e.clone();d.opacity=.25;const u=e.clone();u.color.setHex(16776960),u.opacity=.25,e.clone().color.setHex(16776960);const p=e.clone();p.color.setHex(7895160);const m=new F.CylinderGeometry(0,.04,.1,12);m.translate(0,.05,0);const E=new F.BoxGeometry(.08,.08,.08);E.translate(0,.04,0);const g=new F.BufferGeometry;g.setAttribute("position",new F.Float32BufferAttribute([0,0,0,1,0,0],3));const I=new F.CylinderGeometry(.0075,.0075,.5,3);I.translate(0,.25,0);function T(U,q){const G=new F.TorusGeometry(U,.0075,3,64,q*Math.PI*2);return G.rotateY(Math.PI/2),G.rotateX(Math.PI/2),G}function b(){const U=new F.BufferGeometry;return U.setAttribute("position",new F.Float32BufferAttribute([0,0,0,1,1,1],3)),U}const v={X:[[new F.Mesh(m,n),[.5,0,0],[0,0,-Math.PI/2]],[new F.Mesh(m,n),[-.5,0,0],[0,0,Math.PI/2]],[new F.Mesh(I,n),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new F.Mesh(m,o),[0,.5,0]],[new F.Mesh(m,o),[0,-.5,0],[Math.PI,0,0]],[new F.Mesh(I,o)]],Z:[[new F.Mesh(m,a),[0,0,.5],[Math.PI/2,0,0]],[new F.Mesh(m,a),[0,0,-.5],[-Math.PI/2,0,0]],[new F.Mesh(I,a),null,[Math.PI/2,0,0]]],XYZ:[[new F.Mesh(new F.OctahedronGeometry(.1,0),d.clone()),[0,0,0]]],XY:[[new F.Mesh(new F.BoxGeometry(.15,.15,.01),h.clone()),[.15,.15,0]]],YZ:[[new F.Mesh(new F.BoxGeometry(.15,.15,.01),l.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new F.Mesh(new F.BoxGeometry(.15,.15,.01),c.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},A={X:[[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[0,.3,0]],[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new F.Mesh(new F.OctahedronGeometry(.2,0),i)]],XY:[[new F.Mesh(new F.BoxGeometry(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new F.Mesh(new F.BoxGeometry(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new F.Mesh(new F.BoxGeometry(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]]},S={START:[[new F.Mesh(new F.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new F.Mesh(new F.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new F.Line(b(),s),null,null,null,"helper"]],X:[[new F.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new F.Line(g,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new F.Line(g,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},N={XYZE:[[new F.Mesh(T(.5,1),p),null,[0,Math.PI/2,0]]],X:[[new F.Mesh(T(.5,.5),n)]],Y:[[new F.Mesh(T(.5,.5),o),null,[0,0,-Math.PI/2]]],Z:[[new F.Mesh(T(.5,.5),a),null,[0,Math.PI/2,0]]],E:[[new F.Mesh(T(.75,1),u),null,[0,Math.PI/2,0]]]},R={AXIS:[[new F.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},P={XYZE:[[new F.Mesh(new F.SphereGeometry(.25,10,8),i)]],X:[[new F.Mesh(new F.TorusGeometry(.5,.1,4,24),i),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new F.Mesh(new F.TorusGeometry(.5,.1,4,24),i),[0,0,0],[Math.PI/2,0,0]]],Z:[[new F.Mesh(new F.TorusGeometry(.5,.1,4,24),i),[0,0,0],[0,0,-Math.PI/2]]],E:[[new F.Mesh(new F.TorusGeometry(.75,.1,2,24),i)]]},M={X:[[new F.Mesh(E,n),[.5,0,0],[0,0,-Math.PI/2]],[new F.Mesh(I,n),[0,0,0],[0,0,-Math.PI/2]],[new F.Mesh(E,n),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new F.Mesh(E,o),[0,.5,0]],[new F.Mesh(I,o)],[new F.Mesh(E,o),[0,-.5,0],[0,0,Math.PI]]],Z:[[new F.Mesh(E,a),[0,0,.5],[Math.PI/2,0,0]],[new F.Mesh(I,a),[0,0,0],[Math.PI/2,0,0]],[new F.Mesh(E,a),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new F.Mesh(new F.BoxGeometry(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new F.Mesh(new F.BoxGeometry(.15,.15,.01),l),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new F.Mesh(new F.BoxGeometry(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new F.Mesh(new F.BoxGeometry(.1,.1,.1),d.clone())]]},w={X:[[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[0,.3,0]],[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new F.Mesh(new F.CylinderGeometry(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new F.Mesh(new F.BoxGeometry(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new F.Mesh(new F.BoxGeometry(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new F.Mesh(new F.BoxGeometry(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new F.Mesh(new F.BoxGeometry(.2,.2,.2),i),[0,0,0]]]},L={X:[[new F.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new F.Line(g,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new F.Line(g,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function C(U){const q=new F.Object3D;for(const G in U)for(let st=U[G].length;st--;){const Y=U[G][st][0].clone(),ot=U[G][st][1],$=U[G][st][2],B=U[G][st][3],at=U[G][st][4];Y.name=G,Y.tag=at,ot&&Y.position.set(ot[0],ot[1],ot[2]),$&&Y.rotation.set($[0],$[1],$[2]),B&&Y.scale.set(B[0],B[1],B[2]),Y.updateMatrix();const nt=Y.geometry.clone();nt.applyMatrix4(Y.matrix),Y.geometry=nt,Y.renderOrder=1/0,Y.position.set(0,0,0),Y.rotation.set(0,0,0),Y.scale.set(1,1,1),q.add(Y)}return q}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=C(v)),this.add(this.gizmo.rotate=C(N)),this.add(this.gizmo.scale=C(M)),this.add(this.picker.translate=C(A)),this.add(this.picker.rotate=C(P)),this.add(this.picker.scale=C(w)),this.add(this.helper.translate=C(S)),this.add(this.helper.rotate=C(R)),this.add(this.helper.scale=C(L)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const i=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:Gn;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 s=[];s=s.concat(this.picker[this.mode].children),s=s.concat(this.gizmo[this.mode].children),s=s.concat(this.helper[this.mode].children);for(let n=0;n<s.length;n++){const o=s[n];o.visible=!0,o.rotation.set(0,0,0),o.position.copy(this.worldPosition);let a;if(this.camera.isOrthographicCamera?a=(this.camera.top-this.camera.bottom)/this.camera.zoom:a=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),o.scale.set(1,1,1).multiplyScalar(a*this.size/4),o.tag==="helper"){o.visible=!1,o.name==="AXIS"?(o.visible=!!this.axis,this.axis==="X"&&(St.setFromEuler(Ln.set(0,0,0)),o.quaternion.copy(i).multiply(St),Math.abs(_t.copy(Fs).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Y"&&(St.setFromEuler(Ln.set(0,0,Math.PI/2)),o.quaternion.copy(i).multiply(St),Math.abs(_t.copy(ci).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Z"&&(St.setFromEuler(Ln.set(0,Math.PI/2,0)),o.quaternion.copy(i).multiply(St),Math.abs(_t.copy(Os).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="XYZE"&&(St.setFromEuler(Ln.set(0,Math.PI/2,0)),_t.copy(this.rotationAxis),o.quaternion.setFromRotationMatrix(yl.lookAt(Cl,_t,ci)),o.quaternion.multiply(St),o.visible=this.dragging),this.axis==="E"&&(o.visible=!1)):o.name==="START"?(o.position.copy(this.worldPositionStart),o.visible=this.dragging):o.name==="END"?(o.position.copy(this.worldPosition),o.visible=this.dragging):o.name==="DELTA"?(o.position.copy(this.worldPositionStart),o.quaternion.copy(this.worldQuaternionStart),Vt.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Vt.applyQuaternion(this.worldQuaternionStart.clone().invert()),o.scale.copy(Vt),o.visible=this.dragging):(o.quaternion.copy(i),this.dragging?o.position.copy(this.worldPositionStart):o.position.copy(this.worldPosition),this.axis&&(o.visible=this.axis.search(o.name)!==-1));continue}o.quaternion.copy(i),this.mode==="translate"||this.mode==="scale"?(o.name==="X"&&Math.abs(_t.copy(Fs).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Y"&&Math.abs(_t.copy(ci).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Z"&&Math.abs(_t.copy(Os).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XY"&&Math.abs(_t.copy(Os).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="YZ"&&Math.abs(_t.copy(Fs).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XZ"&&Math.abs(_t.copy(ci).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1)):this.mode==="rotate"&&(Mn.copy(i),_t.copy(this.eye).applyQuaternion(St.copy(i).invert()),o.name.search("E")!==-1&&o.quaternion.setFromRotationMatrix(yl.lookAt(this.eye,Cl,ci)),o.name==="X"&&(St.setFromAxisAngle(Fs,Math.atan2(-_t.y,_t.z)),St.multiplyQuaternions(Mn,St),o.quaternion.copy(St)),o.name==="Y"&&(St.setFromAxisAngle(ci,Math.atan2(_t.x,_t.z)),St.multiplyQuaternions(Mn,St),o.quaternion.copy(St)),o.name==="Z"&&(St.setFromAxisAngle(Os,Math.atan2(_t.y,_t.x)),St.multiplyQuaternions(Mn,St),o.quaternion.copy(St))),o.visible=o.visible&&(o.name.indexOf("X")===-1||this.showX),o.visible=o.visible&&(o.name.indexOf("Y")===-1||this.showY),o.visible=o.visible&&(o.name.indexOf("Z")===-1||this.showZ),o.visible=o.visible&&(o.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),o.material._color=o.material._color||o.material.color.clone(),o.material._opacity=o.material._opacity||o.material.opacity,o.material.color.copy(o.material._color),o.material.opacity=o.material._opacity,this.enabled&&this.axis&&(o.name===this.axis||this.axis.split("").some(function(l){return o.name===l}))&&(o.material.color.setHex(16776960),o.material.opacity=1)}super.updateMatrixWorld(e)}}class Af extends F.Mesh{constructor(){super(new F.PlaneGeometry(1e5,1e5,2,2),new F.MeshBasicMaterial({visible:!1,wireframe:!0,side:F.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),Dn.copy(Fs).applyQuaternion(t==="local"?this.worldQuaternion:Gn),Ts.copy(ci).applyQuaternion(t==="local"?this.worldQuaternion:Gn),vs.copy(Os).applyQuaternion(t==="local"?this.worldQuaternion:Gn),_t.copy(Ts),this.mode){case"translate":case"scale":switch(this.axis){case"X":_t.copy(this.eye).cross(Dn),Ce.copy(Dn).cross(_t);break;case"Y":_t.copy(this.eye).cross(Ts),Ce.copy(Ts).cross(_t);break;case"Z":_t.copy(this.eye).cross(vs),Ce.copy(vs).cross(_t);break;case"XY":Ce.copy(vs);break;case"YZ":Ce.copy(Dn);break;case"XZ":_t.copy(vs),Ce.copy(Ts);break;case"XYZ":case"E":Ce.set(0,0,0);break}break;case"rotate":default:Ce.set(0,0,0)}Ce.length()===0?this.quaternion.copy(this.cameraQuaternion):(_l.lookAt(Vt.set(0,0,0),Ce,_t),this.quaternion.setFromRotationMatrix(_l)),super.updateMatrixWorld(e)}}class Dr{constructor(e,t,i,s,n,o=5,a=!0){y(this,"onDraggingStarted",new K);y(this,"onDraggingEnded",new K);y(this,"onDisposed",new K);y(this,"normal");y(this,"origin");y(this,"three",new D.Plane);y(this,"components");y(this,"world");y(this,"type","default");y(this,"_helper");y(this,"_visible",!0);y(this,"_enabled",!0);y(this,"_controlsActive",!1);y(this,"_arrowBoundBox",new D.Mesh);y(this,"_planeMesh");y(this,"_controls");y(this,"_hiddenMaterial",new D.MeshBasicMaterial({visible:!1}));y(this,"update",()=>{this._enabled&&this.three.setFromNormalAndCoplanarPoint(this.normal,this._helper.position)});y(this,"changeDrag",e=>{this._visible=!e.value,this.preventCameraMovement(),this.notifyDraggingChanged(e)});if(this.components=e,this.world=t,!t.renderer)throw new Error("The given world must have a renderer!");this.normal=s,this.origin=i,t.renderer.setPlane(!0,this.three),this._planeMesh=Dr.newPlaneMesh(o,n),this._helper=this.newHelper(),this._controls=this.newTransformControls(),this.three.setFromNormalAndCoplanarPoint(s,i),a&&this.toggleControls(!0)}get enabled(){return this._enabled}set enabled(e){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");this._enabled=e,this.world.renderer.setPlane(e,this.three)}get visible(){return this._visible}set visible(e){this._visible=e,this._controls.visible=e,this._helper.visible=e,this.toggleControls(e)}get meshes(){return[this._planeMesh,this._arrowBoundBox]}get planeMaterial(){return this._planeMesh.material}set planeMaterial(e){this._planeMesh.material=e}get size(){return this._planeMesh.scale.x}set size(e){this._planeMesh.scale.set(e,e,e)}get helper(){return this._helper}setFromNormalAndCoplanarPoint(e,t){this.reset(),this.normal.equals(e)||(this.normal.copy(e),this._helper.lookAt(e)),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 e=new D.Vector3(1,0,0),t=new D.Vector3;this.normal.equals(e)||(this.normal.copy(e),this._helper.lookAt(e)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix()}toggleControls(e){if(e){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=e}newTransformControls(){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");const e=this.world.camera.three,t=this.world.renderer.three.domElement,i=new If(e,t);return this.initializeControls(i),this.world.scene.three.add(i),i}initializeControls(e){e.attach(this._helper),e.showX=!1,e.showY=!1,e.setSpace("local"),this.createArrowBoundingBox(),e.children[0].children[0].add(this._arrowBoundBox)}createArrowBoundingBox(){this._arrowBoundBox.geometry=new D.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(e){e.value?this.onDraggingStarted.trigger():this.onDraggingEnded.trigger()}preventCameraMovement(){this.world.camera.enabled=this._visible}newHelper(){const e=new D.Object3D;return e.lookAt(this.normal),e.position.copy(this.origin),this._planeMesh.position.z+=.01,e.add(this._planeMesh),this.world.scene.three.add(e),e}static newPlaneMesh(e,t){const i=new D.PlaneGeometry(1),s=new D.Mesh(i,t);return s.scale.set(e,e,e),s}}const zs=class zs extends Ot{constructor(t){super(t);y(this,"onBeforeDrag",new K);y(this,"onAfterDrag",new K);y(this,"onBeforeCreate",new K);y(this,"onBeforeCancel",new K);y(this,"onAfterCancel",new K);y(this,"onBeforeDelete",new K);y(this,"onAfterCreate",new K);y(this,"onAfterDelete",new K);y(this,"onDisposed",new K);y(this,"orthogonalY",!1);y(this,"toleranceOrthogonalY",.7);y(this,"Type",Dr);y(this,"list",[]);y(this,"_material",new D.MeshBasicMaterial({color:12255487,side:D.DoubleSide,transparent:!0,opacity:.2}));y(this,"_size",5);y(this,"_enabled",!1);y(this,"_visible",!0);y(this,"_onStartDragging",()=>{this.onBeforeDrag.trigger()});y(this,"_onEndDragging",()=>{this.onAfterDrag.trigger()});this.components.add(zs.uuid,this)}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const i of this.list)i.enabled=t;this.updateMaterialsAndPlanes()}get visible(){return this._visible}set visible(t){this._visible=t;for(const i of this.list)i.visible=t}get material(){return this._material}set material(t){this._material=t;for(const i of this.list)i.planeMaterial=t}get size(){return this._size}set size(t){this._size=t;for(const i of this.list)i.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(zs.uuid),this.onDisposed.reset()}create(t){const n=this.components.get(mi).get(t).castRay();return n?this.createPlaneFromIntersection(t,n):null}createFromNormalAndCoplanarPoint(t,i,s){const n=this.newPlane(t,s,i);return this.updateMaterialsAndPlanes(),n}delete(t,i){i||(i=this.pickPlane(t)),i&&this.deletePlane(i)}deleteAll(t){const i=[...this.list];for(const s of i)if(!t||t.has(s.type)){this.delete(s.world,s);const n=this.list.indexOf(s);n!==-1&&this.list.splice(n,1)}}deletePlane(t){const i=this.list.indexOf(t);if(i!==-1){if(this.list.splice(i,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 s=this.components.get(mi).get(t),n=this.getAllPlaneMeshes(),o=s.castRay(n);if(o){const a=o.object;return this.list.find(l=>l.meshes.includes(a))}}getAllPlaneMeshes(){const t=[];for(const i of this.list)t.push(...i.meshes);return t}createPlaneFromIntersection(t,i){var l;if(!t.renderer)throw new Error("The given world must have a renderer!");const s=i.point.distanceTo(new D.Vector3(0,0,0)),n=(l=i.face)==null?void 0:l.normal;if(!s||!n)return null;const o=this.getWorldNormal(i,n),a=this.newPlane(t,i.point,o.negate());return a.visible=this._visible,a.size=this._size,t.renderer.setPlane(!0,a.three),this.updateMaterialsAndPlanes(),a}getWorldNormal(t,i){const s=t.object;let n=t.object.matrixWorld.clone();if(s instanceof D.InstancedMesh&&t.instanceId!==void 0){const c=new D.Matrix4;s.getMatrixAt(t.instanceId,c),n=c.multiply(n)}const a=new D.Matrix3().getNormalMatrix(n),l=i.clone().applyMatrix3(a).normalize();return this.normalizePlaneDirectionY(l),l}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,i,s){const n=new this.Type(this.components,t,i,s,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(qn);for(const[i,s]of t.list){if(!s.renderer)continue;s.renderer.updateClippingPlanes();const{clippingPlanes:n}=s.renderer;for(const o of s.meshes)if(o.material)if(Array.isArray(o.material))for(const a of o.material)a.clippingPlanes=n;else o.material.clippingPlanes=n}}};y(zs,"uuid","66290bc5-18c4-4cd1-9379-2e17a0617611");let Kn=zs;class $c{constructor(e){y(this,"enabled",!1);y(this,"id","FirstPerson");this.camera=e}set(e){if(this.enabled=e,e){if(this.camera.projection.current!=="Perspective"){this.camera.set("Orbit");return}this.setupFirstPersonCamera()}}setupFirstPersonCamera(){const e=this.camera.controls,t=new D.Vector3;e.distance--,e.getPosition(t),e.minDistance=1,e.maxDistance=1,e.distance=1,e.moveTo(t.x,t.y,t.z),e.truckSpeed=50,e.mouseButtons.wheel=Gt.ACTION.DOLLY,e.touches.two=Gt.ACTION.TOUCH_ZOOM_TRUCK}}class Vc{constructor(e){y(this,"enabled",!0);y(this,"id","Orbit");this.camera=e,this.activateOrbitControls()}set(e){this.enabled=e,e&&this.activateOrbitControls()}activateOrbitControls(){const e=this.camera.controls;e.minDistance=1,e.maxDistance=300;const t=new D.Vector3;e.getPosition(t);const i=t.length();e.distance=i,e.truckSpeed=2;const{rotation:s}=this.camera.three,n=new D.Vector3(0,0,-1).applyEuler(s),o=t.addScaledVector(n,i);e.moveTo(o.x,o.y,o.z)}}class Gc{constructor(e){y(this,"enabled",!1);y(this,"id","Plan");y(this,"mouseAction1");y(this,"mouseAction2");y(this,"mouseInitialized",!1);y(this,"defaultAzimuthSpeed");y(this,"defaultPolarSpeed");this.camera=e,this.defaultAzimuthSpeed=e.controls.azimuthRotateSpeed,this.defaultPolarSpeed=e.controls.polarRotateSpeed}set(e){this.enabled=e;const t=this.camera.controls;t.azimuthRotateSpeed=e?0:this.defaultAzimuthSpeed,t.polarRotateSpeed=e?0:this.defaultPolarSpeed,this.mouseInitialized||(this.mouseAction1=t.touches.one,this.mouseAction2=t.touches.two,this.mouseInitialized=!0),e?(t.mouseButtons.left=Gt.ACTION.TRUCK,t.touches.one=Gt.ACTION.TOUCH_TRUCK,t.touches.two=Gt.ACTION.TOUCH_ZOOM):(t.mouseButtons.left=Gt.ACTION.ROTATE,t.touches.one=this.mouseAction1,t.touches.two=this.mouseAction2)}}class Hc{constructor(e){y(this,"onChanged",new K);y(this,"current","Perspective");y(this,"camera");y(this,"matchOrthoDistanceEnabled",!1);y(this,"_component");y(this,"_previousDistance",-1);this._component=e,this.camera=e.three}async set(e){this.current!==e&&(e==="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 e=this.getPerspectiveDims();if(!e)return;const{width:t,height:i}=e;this.setupOrthoCamera(i,t),this.camera=this._component.threeOrtho,this.current="Orthographic"}getPerspectiveDims(){const e=this._component.currentWorld;if(!e||!e.renderer)return null;const t=new D.Vector3;this._component.threePersp.getWorldDirection(t);const i=new D.Vector3;this._component.controls.getTarget(i);const n=i.clone().sub(this._component.threePersp.position).dot(t),o=e.renderer.getSize(),a=o.x/o.y,l=this._component.threePersp,c=n*2*Math.atan(l.fov*(Math.PI/180)/2);return{width:c*a,height:c}}setupOrthoCamera(e,t){this._component.controls.mouseButtons.wheel=Gt.ACTION.ZOOM,this._component.controls.mouseButtons.middle=Gt.ACTION.ZOOM;const i=this._component.threePersp,s=this._component.threeOrtho;s.zoom=1,s.left=t/-2,s.right=t/2,s.top=e/2,s.bottom=e/-2,s.updateProjectionMatrix(),s.position.copy(i.position),s.quaternion.copy(i.quaternion),this._component.controls.camera=s}getDistance(){const e=this._component.threePersp,t=this._component.threeOrtho;return(t.top-t.bottom)/t.zoom/(2*Math.atan(e.fov*(Math.PI/180)/2))}async setPerspectiveCamera(){this._component.controls.mouseButtons.wheel=Gt.ACTION.DOLLY,this._component.controls.mouseButtons.middle=Gt.ACTION.DOLLY;const e=this._component.threePersp,t=this._component.threeOrtho;e.position.copy(t.position),e.quaternion.copy(t.quaternion),this._component.controls.mouseButtons.wheel=Gt.ACTION.DOLLY,this.matchOrthoDistanceEnabled?this._component.controls.distance=this.getDistance():this._component.controls.distance=this._previousDistance,await this._component.controls.zoomTo(1),e.updateProjectionMatrix(),this._component.controls.camera=e,this.camera=e,this.current="Perspective"}}class Yc extends Gi{constructor(t){super(t);y(this,"projection");y(this,"threeOrtho");y(this,"threePersp");y(this,"_userInputButtons",{});y(this,"_frustumSize",50);y(this,"_navigationModes",new Map);y(this,"_mode",null);y(this,"previousSize",null);this.threePersp=this.three,this.threeOrtho=this.newOrthoCamera(),this.projection=new Hc(this),this.onAspectUpdated.add(()=>{this.setOrthoPerspCameraAspect()}),this.projection.onChanged.add(i=>{this.three=i,this.updateAspect()}),this.onWorldChanged.add(({action:i})=>{i==="added"&&(this._navigationModes.clear(),this._navigationModes.set("Orbit",new Vc(this)),this._navigationModes.set("FirstPerson",new $c(this)),this._navigationModes.set("Plan",new Gc(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,i=1.5){if(!this.enabled)return;const s=Number.MAX_VALUE,n=Number.MIN_VALUE,o=new D.Vector3(s,s,s),a=new D.Vector3(n,n,n);for(const f of t){const p=new D.Box3().setFromObject(f);p.min.x<o.x&&(o.x=p.min.x),p.min.y<o.y&&(o.y=p.min.y),p.min.z<o.z&&(o.z=p.min.z),p.max.x>a.x&&(a.x=p.max.x),p.max.y>a.y&&(a.y=p.max.y),p.max.z>a.z&&(a.z=p.max.z)}const l=new D.Box3(o,a),c=new D.Vector3;l.getSize(c);const h=new D.Vector3;l.getCenter(h);const d=Math.max(c.x,c.y,c.z)*i,u=new D.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 D.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(),i=this.threeOrtho.top,s=this.threeOrtho.right,n=t.y/this.previousSize.y,o=t.x/this.previousSize.x,a=i*n,l=s*o;this.threeOrtho.left=-l,this.threeOrtho.right=l,this.threeOrtho.top=a,this.threeOrtho.bottom=-a,this.threeOrtho.updateProjectionMatrix(),this.previousSize.copy(t)}}const Rf=new Map([[tt.IFCRELAGGREGATES,{forRelated:"Decomposes",forRelating:"IsDecomposedBy"}],[tt.IFCRELASSOCIATESMATERIAL,{forRelated:"HasAssociations",forRelating:"AssociatedTo"}],[tt.IFCRELASSOCIATESCLASSIFICATION,{forRelated:"HasAssociations",forRelating:"ClassificationForObjects"}],[tt.IFCRELASSIGNSTOGROUP,{forRelated:"HasAssignments",forRelating:"IsGroupedBy"}],[tt.IFCRELDEFINESBYPROPERTIES,{forRelated:"IsDefinedBy",forRelating:"DefinesOcurrence"}],[tt.IFCRELDEFINESBYTYPE,{forRelated:"IsTypedBy",forRelating:"Types"}],[tt.IFCRELDEFINESBYTEMPLATE,{forRelated:"IsDefinedBy",forRelating:"Defines"}],[tt.IFCRELCONTAINEDINSPATIALSTRUCTURE,{forRelated:"ContainedInStructure",forRelating:"ContainsElements"}],[tt.IFCRELFLOWCONTROLELEMENTS,{forRelated:"AssignedToFlowElement",forRelating:"HasControlElements"}],[tt.IFCRELCONNECTSELEMENTS,{forRelated:"ConnectedFrom",forRelating:"ConnectedTo"}],[tt.IFCRELASSIGNSTOPRODUCT,{forRelated:"HasAssignments",forRelating:"ReferencedBy"}],[tt.IFCRELDECLARES,{forRelated:"HasContext",forRelating:"Declares"}],[tt.IFCRELASSIGNSTOCONTROL,{forRelated:"HasAssignments",forRelating:"Controls"}],[tt.IFCRELNESTS,{forRelated:"Nests",forRelating:"IsNestedBy"}]]),$s=class $s extends Ot{constructor(t){super(t);y(this,"onDisposed",new K);y(this,"onRelationsIndexed",new K);y(this,"relationMaps",{});y(this,"enabled",!0);y(this,"_relToAttributesMap",Rf);y(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"]);y(this,"_ifcRels",[tt.IFCRELAGGREGATES,tt.IFCRELASSOCIATESMATERIAL,tt.IFCRELASSOCIATESCLASSIFICATION,tt.IFCRELASSIGNSTOGROUP,tt.IFCRELDEFINESBYPROPERTIES,tt.IFCRELDEFINESBYTYPE,tt.IFCRELDEFINESBYTEMPLATE,tt.IFCRELCONTAINEDINSPATIALSTRUCTURE,tt.IFCRELFLOWCONTROLELEMENTS,tt.IFCRELCONNECTSELEMENTS,tt.IFCRELASSIGNSTOPRODUCT,tt.IFCRELDECLARES,tt.IFCRELASSIGNSTOCONTROL,tt.IFCRELNESTS]);y(this,"onFragmentsDisposed",t=>{delete this.relationMaps[t.groupID]});this.components.add($s.uuid,this),t.get(wt).onFragmentsDisposed.add(this.onFragmentsDisposed)}indexRelations(t,i,s,n){const o=Object.keys(i).find(u=>u.startsWith("Relating")),a=Object.keys(i).find(u=>u.startsWith("Related"));if(!(o&&a))return;const l=i[o].value,c=i[a].map(u=>u.value),h=t.get(l)??new Map,d=this.getAttributeIndex(n);d!==null&&(h.set(d,c),t.set(l,h));for(const u of c){const f=t.get(u)??new Map,p=this.getAttributeIndex(s);if(!p)continue;const m=f.get(p)??[];m.push(l),f.set(p,m),t.set(u,f)}}getAttributeIndex(t){const i=this._inverseAttributes.indexOf(t);return i===-1?null:i}setRelationMap(t,i){this.relationMaps[t.uuid]=i,this.onRelationsIndexed.trigger({modelID:t.uuid,relationsMap:i})}async process(t){if(!t.hasProperties)throw new Error("FragmentsGroup properties not found");let i=this.relationMaps[t.uuid];if(i)return i;i=new Map;for(const s of this._ifcRels){const n=await t.getAllPropertiesOfType(s);if(!n)continue;const o=this._relToAttributesMap.get(s);if(!o)continue;const{forRelated:a,forRelating:l}=o;for(const c in n){const h=n[c];this.indexRelations(i,h,a,l)}}return this.setRelationMap(t,i),i}async processFromWebIfc(t,i){const s=new Map;for(const n of this._ifcRels){const o=this._relToAttributesMap.get(n);if(!o)continue;const{forRelated:a,forRelating:l}=o,c=t.GetLineIDsWithType(i,n);for(let h=0;h<c.size();h++){const d=await t.properties.getItemProperties(i,c.get(h));this.indexRelations(s,d,a,l)}}return this.onRelationsIndexed.trigger({modelID:i.toString(),relationsMap:s}),s}getEntityRelations(t,i,s){const n=this.relationMaps[t.uuid];if(!n)throw new Error(`IfcRelationsIndexer: model ${t.uuid} has no relations indexed.`);const o=n.get(i),a=this.getAttributeIndex(s);if(o===void 0||a===null)return null;const l=o.get(a);return l||null}serializeRelations(t){const i={};for(const[s,n]of t.entries()){i[s]||(i[s]={});for(const[o,a]of n.entries())i[s][o]=a}return JSON.stringify(i)}serializeModelRelations(t){const i=this.relationMaps[t.uuid];return i?this.serializeRelations(i):null}serializeAllRelations(){const t={};for(const i in this.relationMaps){const s=this.relationMaps[i],n={};for(const[o,a]of s.entries()){n[o]||(n[o]={});for(const[l,c]of a.entries())n[o][l]=c}t[i]=n}return JSON.stringify(t)}getRelationsMapFromJSON(t){const i=JSON.parse(t),s=new Map;for(const n in i){const o=i[n],a=new Map;for(const l in o)a.set(Number(l),o[l]);s.set(Number(n),a)}return s}dispose(){this.relationMaps={},this.components.get(wt).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger($s.uuid),this.onDisposed.reset()}getEntitiesWithRelation(t,i,s){const n=this.relationMaps[t.uuid];if(!n)throw new Error("IfcRelationsIndexer: the model relations are not indexed!");const o=new Set;for(const[a,l]of n){const c=this.getAttributeIndex(i);if(c===null)throw new Error("IfcRelationsIndexer: invalid inverse attribute name");const h=l.get(c);h&&h.includes(s)&&o.add(a)}return o}addEntityRelations(t,i,s,...n){const o=this.getEntityRelations(t,i,s);if(o)o.push(...n);else{const a=this.getAttributeIndex(s);if(!a)throw new Error(`IfcRelationsIndexer: ${s} is not a valid relation name.`);const l=this.relationMaps[t.uuid].get(i);l==null||l.set(a,n)}}getEntityChildren(t,i,s=new Set){if(s.add(i),this.relationMaps[t.uuid]===void 0)throw new Error("The provided model has no indices. You have to generate them first.");const o=this.getEntityRelations(t,i,"IsDecomposedBy");if(o)for(const l of o)this.getEntityChildren(t,l,s);const a=this.getEntityRelations(t,i,"ContainsElements");if(a)for(const l of a)this.getEntityChildren(t,l,s);return s}};y($s,"uuid","23a889ab-83b3-44a4-8bee-ead83438370b");let gi=$s;const Tr=class Tr extends Ot{constructor(t){super(t);y(this,"onDisposed",new K);y(this,"onFragmentsLoaded",new K);y(this,"onFragmentsDisposed",new K);y(this,"list",new pi);y(this,"groups",new pi);y(this,"baseCoordinationModel","");y(this,"baseCoordinationMatrix",new D.Matrix4);y(this,"enabled",!0);y(this,"_loader",new _c.Serializer);this.components.add(Tr.uuid,this)}get meshes(){const t=[];for(const[i,s]of this.list)t.push(s.mesh);return t}dispose(){for(const[t,i]of this.groups)i.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:i}=t,s=[];for(const n of t.items)s.push(n.id),this.list.delete(n.id);t.dispose(!0),this.groups.delete(t.uuid),this.onFragmentsDisposed.trigger({groupID:i,fragmentIDs:s})}load(t,i){const n={...{coordinate:!0},...i},{coordinate:o,name:a,properties:l,relationsMap:c}=n,h=this._loader.import(t);i&&(h.isStreamed=i.isStreamed||!1),a&&(h.name=a);for(const d of h.items)d.group=h,this.list.set(d.id,d);return o&&this.coordinate([h]),this.groups.set(h.uuid,h),l&&h.setLocalProperties(l),c&&this.components.get(gi).setRelationMap(h,c),this.onFragmentsLoaded.trigger(h),h}export(t){return this._loader.export(t)}getModelIdMap(t){const i={};for(const s in t){const n=this.list.get(s);if(!(n&&n.group))continue;const o=n.group;o.uuid in i||(i[o.uuid]=new Set);const a=t[s];for(const l of a)i[o.uuid].add(l)}return i}modelIdToFragmentIdMap(t){let i={};for(const s in t){const n=this.groups.get(s);if(!n)continue;const o=t[s],a=n.getFragmentMap(o);i={...i,...a}}return i}guidToFragmentIdMap(t){const i={};for(const[n,o]of this.groups){n in i||(i[n]=new Set);for(const a of t){const l=o.globalToExpressIDs.get(a);l&&i[n].add(l)}}return this.modelIdToFragmentIdMap(i)}coordinate(t=Array.from(this.groups.values())){if(this.baseCoordinationModel.length===0){const s=t.pop();if(!s)return;this.baseCoordinationModel=s.uuid,this.baseCoordinationMatrix=s.coordinationMatrix.clone()}if(t.length)for(const s of t)s.coordinationMatrix.equals(this.baseCoordinationMatrix)||(s.position.set(0,0,0),s.rotation.set(0,0,0),s.scale.set(1,1,1),s.updateMatrix(),this.applyBaseCoordinateSystem(s,s.coordinationMatrix))}applyBaseCoordinateSystem(t,i){i&&t.applyMatrix4(i.clone().invert()),t.applyMatrix4(this.baseCoordinationMatrix)}clone(t,i){const s=t.cloneGroup(i);this.groups.set(s.uuid,s);for(const n of s.items)this.list.set(n.id,n);return s}};y(Tr,"uuid","fef46874-46a3-461b-8c44-2922ab77c806");let wt=Tr;var Un=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sf(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function kn(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Wc={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(n,e){(function(t){n.exports=t()})(function(){return function t(i,s,r){function o(c,h){if(!s[c]){if(!i[c]){var d=typeof Dn=="function"&&Dn;if(!h&&d)return d(c,!0);if(a)return a(c,!0);var u=new Error("Cannot find module '"+c+"'");throw u.code="MODULE_NOT_FOUND",u}var f=s[c]={exports:{}};i[c][0].call(f.exports,function(p){var m=i[c][1][p];return o(m||p)},f,f.exports,t,i,s,r)}return s[c].exports}for(var a=typeof Dn=="function"&&Dn,l=0;l<r.length;l++)o(r[l]);return o}({1:[function(t,i,s){var r=t("./utils"),o=t("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";s.encode=function(l){for(var c,h,d,u,f,p,m,E=[],g=0,b=l.length,v=b,I=r.getTypeOf(l)!=="string";g<l.length;)v=b-g,d=I?(c=l[g++],h=g<b?l[g++]:0,g<b?l[g++]:0):(c=l.charCodeAt(g++),h=g<b?l.charCodeAt(g++):0,g<b?l.charCodeAt(g++):0),u=c>>2,f=(3&c)<<4|h>>4,p=1<v?(15&h)<<2|d>>6:64,m=2<v?63&d:64,E.push(a.charAt(u)+a.charAt(f)+a.charAt(p)+a.charAt(m));return E.join("")},s.decode=function(l){var c,h,d,u,f,p,m=0,E=0,g="data:";if(l.substr(0,g.length)===g)throw new Error("Invalid base64 input, it looks like a data url.");var b,v=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&v--,l.charAt(l.length-2)===a.charAt(64)&&v--,v%1!=0)throw new Error("Invalid base64 input, bad content length.");for(b=o.uint8array?new Uint8Array(0|v):new Array(0|v);m<l.length;)c=a.indexOf(l.charAt(m++))<<2|(u=a.indexOf(l.charAt(m++)))>>4,h=(15&u)<<4|(f=a.indexOf(l.charAt(m++)))>>2,d=(3&f)<<6|(p=a.indexOf(l.charAt(m++))),b[E++]=c,f!==64&&(b[E++]=h),p!==64&&(b[E++]=d);return b}},{"./support":30,"./utils":32}],2:[function(t,i,s){var r=t("./external"),o=t("./stream/DataWorker"),a=t("./stream/Crc32Probe"),l=t("./stream/DataLengthProbe");function c(h,d,u,f,p){this.compressedSize=h,this.uncompressedSize=d,this.crc32=u,this.compression=f,this.compressedContent=p}c.prototype={getContentWorker:function(){var h=new o(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("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 o(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(h,d,u){return h.pipe(new a).pipe(new l("uncompressedSize")).pipe(d.compressWorker(u)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},i.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,i,s){var r=t("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},s.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,i,s){var r=t("./utils"),o=function(){for(var a,l=[],c=0;c<256;c++){a=c;for(var h=0;h<8;h++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l}();i.exports=function(a,l){return a!==void 0&&a.length?r.getTypeOf(a)!=="string"?function(c,h,d,u){var f=o,p=u+d;c^=-1;for(var m=u;m<p;m++)c=c>>>8^f[255&(c^h[m])];return-1^c}(0|l,a,a.length,0):function(c,h,d,u){var f=o,p=u+d;c^=-1;for(var m=u;m<p;m++)c=c>>>8^f[255&(c^h.charCodeAt(m))];return-1^c}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(t,i,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(t,i,s){var r=null;r=typeof Promise<"u"?Promise:t("lie"),i.exports={Promise:r}},{lie:37}],7:[function(t,i,s){var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=t("pako"),a=t("./utils"),l=t("./stream/GenericWorker"),c=r?"uint8array":"array";function h(d,u){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=u,this.meta={}}s.magic="\b\0",a.inherits(h,l),h.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(c,d.data),!1)},h.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(u){d.push({data:u,meta:d.meta})}},s.compressWorker=function(d){return new h("Deflate",d)},s.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,i,s){function r(f,p){var m,E="";for(m=0;m<p;m++)E+=String.fromCharCode(255&f),f>>>=8;return E}function o(f,p,m,E,g,b){var v,I,T=f.file,A=f.compression,R=b!==c.utf8encode,P=a.transformTo("string",b(T.name)),F=a.transformTo("string",c.utf8encode(T.name)),x=T.comment,D=a.transformTo("string",b(x)),w=a.transformTo("string",c.utf8encode(x)),L=F.length!==T.name.length,C=w.length!==x.length,U="",Z="",H="",st=T.dir,Y=T.date,ot={crc32:0,compressedSize:0,uncompressedSize:0};p&&!m||(ot.crc32=f.crc32,ot.compressedSize=f.compressedSize,ot.uncompressedSize=f.uncompressedSize);var V=0;p&&(V|=8),R||!L&&!C||(V|=2048);var B=0,at=0;st&&(B|=16),g==="UNIX"?(at=798,B|=function(it,At){var xt=it;return it||(xt=At?16893:33204),(65535&xt)<<16}(T.unixPermissions,st)):(at=20,B|=function(it){return 63&(it||0)}(T.dosPermissions)),v=Y.getUTCHours(),v<<=6,v|=Y.getUTCMinutes(),v<<=5,v|=Y.getUTCSeconds()/2,I=Y.getUTCFullYear()-1980,I<<=4,I|=Y.getUTCMonth()+1,I<<=5,I|=Y.getUTCDate(),L&&(Z=r(1,1)+r(h(P),4)+F,U+="up"+r(Z.length,2)+Z),C&&(H=r(1,1)+r(h(D),4)+w,U+="uc"+r(H.length,2)+H);var nt="";return nt+=`
139
- \0`,nt+=r(V,2),nt+=A.magic,nt+=r(v,2),nt+=r(I,2),nt+=r(ot.crc32,4),nt+=r(ot.compressedSize,4),nt+=r(ot.uncompressedSize,4),nt+=r(P.length,2),nt+=r(U.length,2),{fileRecord:d.LOCAL_FILE_HEADER+nt+P+U,dirRecord:d.CENTRAL_FILE_HEADER+r(at,2)+nt+r(D.length,2)+"\0\0\0\0"+r(B,4)+r(E,4)+P+U+D}}var a=t("../utils"),l=t("../stream/GenericWorker"),c=t("../utf8"),h=t("../crc32"),d=t("../signature");function u(f,p,m,E){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=m,this.encodeFileName=E,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(u,l),u.prototype.push=function(f){var p=f.meta.percent||0,m=this.entriesCount,E=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,l.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:m?(p+100*(m-E-1))/m:100}}))},u.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var p=this.streamFiles&&!f.file.dir;if(p){var m=o(f,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(f){this.accumulate=!1;var p=this.streamFiles&&!f.file.dir,m=o(f,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),p)this.push({data:function(E){return d.DATA_DESCRIPTOR+r(E.crc32,4)+r(E.compressedSize,4)+r(E.uncompressedSize,4)}(f),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var f=this.bytesWritten,p=0;p<this.dirRecords.length;p++)this.push({data:this.dirRecords[p],meta:{percent:100}});var m=this.bytesWritten-f,E=function(g,b,v,I,T){var A=a.transformTo("string",T(I));return d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(g,2)+r(g,2)+r(b,4)+r(v,4)+r(A.length,2)+A}(this.dirRecords.length,m,f,this.zipComment,this.encodeFileName);this.push({data:E,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 p=this;return f.on("data",function(m){p.processChunk(m)}),f.on("end",function(){p.closedSource(p.previous.streamInfo),p._sources.length?p.prepareNextSource():p.end()}),f.on("error",function(m){p.error(m)}),this},u.prototype.resume=function(){return!!l.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 p=this._sources;if(!l.prototype.error.call(this,f))return!1;for(var m=0;m<p.length;m++)try{p[m].error(f)}catch{}return!0},u.prototype.lock=function(){l.prototype.lock.call(this);for(var f=this._sources,p=0;p<f.length;p++)f[p].lock()},i.exports=u},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,i,s){var r=t("../compressions"),o=t("./ZipFileWorker");s.generateWorker=function(a,l,c){var h=new o(l.streamFiles,c,l.platform,l.encodeFileName),d=0;try{a.forEach(function(u,f){d++;var p=function(b,v){var I=b||v,T=r[I];if(!T)throw new Error(I+" is not a valid compression method !");return T}(f.options.compression,l.compression),m=f.options.compressionOptions||l.compressionOptions||{},E=f.dir,g=f.date;f._compressWorker(p,m).withStreamInfo("file",{name:u,dir:E,date:g,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,i,s){function r(){if(!(this instanceof r))return new r;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 o=new r;for(var a in this)typeof this[a]!="function"&&(o[a]=this[a]);return o}}(r.prototype=t("./object")).loadAsync=t("./load"),r.support=t("./support"),r.defaults=t("./defaults"),r.version="3.10.1",r.loadAsync=function(o,a){return new r().loadAsync(o,a)},r.external=t("./external"),i.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,i,s){var r=t("./utils"),o=t("./external"),a=t("./utf8"),l=t("./zipEntries"),c=t("./stream/Crc32Probe"),h=t("./nodejsUtils");function d(u){return new o.Promise(function(f,p){var m=u.decompressed.getContentWorker().pipe(new c);m.on("error",function(E){p(E)}).on("end",function(){m.streamInfo.crc32!==u.decompressed.crc32?p(new Error("Corrupted zip : CRC32 mismatch")):f()}).resume()})}i.exports=function(u,f){var p=this;return f=r.extend(f||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),h.isNode&&h.isStream(u)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",u,!0,f.optimizedBinaryString,f.base64).then(function(m){var E=new l(f);return E.load(m),E}).then(function(m){var E=[o.Promise.resolve(m)],g=m.files;if(f.checkCRC32)for(var b=0;b<g.length;b++)E.push(d(g[b]));return o.Promise.all(E)}).then(function(m){for(var E=m.shift(),g=E.files,b=0;b<g.length;b++){var v=g[b],I=v.fileNameStr,T=r.resolve(v.fileNameStr);p.file(T,v.decompressed,{binary:!0,optimizedBinaryString:!0,date:v.date,dir:v.dir,comment:v.fileCommentStr.length?v.fileCommentStr:null,unixPermissions:v.unixPermissions,dosPermissions:v.dosPermissions,createFolders:f.createFolders}),v.dir||(p.file(T).unsafeOriginalName=I)}return E.zipComment.length&&(p.comment=E.zipComment),p})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,i,s){var r=t("../utils"),o=t("../stream/GenericWorker");function a(l,c){o.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(c)}r.inherits(a,o),a.prototype._bindStream=function(l){var c=this;(this._stream=l).pause(),l.on("data",function(h){c.push({data:h,meta:{percent:0}})}).on("error",function(h){c.isPaused?this.generatedError=h:c.error(h)}).on("end",function(){c.isPaused?c._upstreamEnded=!0:c.end()})},a.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},i.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,i,s){var r=t("readable-stream").Readable;function o(a,l,c){r.call(this,l),this._helper=a;var h=this;a.on("data",function(d,u){h.push(d)||h._helper.pause(),c&&c(u)}).on("error",function(d){h.emit("error",d)}).on("end",function(){h.push(null)})}t("../utils").inherits(o,r),o.prototype._read=function(){this._helper.resume()},i.exports=o},{"../utils":32,"readable-stream":16}],14:[function(t,i,s){i.exports={isNode:typeof Buffer<"u",newBufferFrom:function(r,o){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(r,o);if(typeof r=="number")throw new Error('The "data" argument must not be a number');return new Buffer(r,o)},allocBuffer:function(r){if(Buffer.alloc)return Buffer.alloc(r);var o=new Buffer(r);return o.fill(0),o},isBuffer:function(r){return Buffer.isBuffer(r)},isStream:function(r){return r&&typeof r.on=="function"&&typeof r.pause=="function"&&typeof r.resume=="function"}}},{}],15:[function(t,i,s){function r(T,A,R){var P,F=a.getTypeOf(A),x=a.extend(R||{},h);x.date=x.date||new Date,x.compression!==null&&(x.compression=x.compression.toUpperCase()),typeof x.unixPermissions=="string"&&(x.unixPermissions=parseInt(x.unixPermissions,8)),x.unixPermissions&&16384&x.unixPermissions&&(x.dir=!0),x.dosPermissions&&16&x.dosPermissions&&(x.dir=!0),x.dir&&(T=g(T)),x.createFolders&&(P=E(T))&&b.call(this,P,!0);var D=F==="string"&&x.binary===!1&&x.base64===!1;R&&R.binary!==void 0||(x.binary=!D),(A instanceof d&&A.uncompressedSize===0||x.dir||!A||A.length===0)&&(x.base64=!1,x.binary=!0,A="",x.compression="STORE",F="string");var w=null;w=A instanceof d||A instanceof l?A:p.isNode&&p.isStream(A)?new m(T,A):a.prepareContent(T,A,x.binary,x.optimizedBinaryString,x.base64);var L=new u(T,w,x);this.files[T]=L}var o=t("./utf8"),a=t("./utils"),l=t("./stream/GenericWorker"),c=t("./stream/StreamHelper"),h=t("./defaults"),d=t("./compressedObject"),u=t("./zipObject"),f=t("./generate"),p=t("./nodejsUtils"),m=t("./nodejs/NodejsStreamInputAdapter"),E=function(T){T.slice(-1)==="/"&&(T=T.substring(0,T.length-1));var A=T.lastIndexOf("/");return 0<A?T.substring(0,A):""},g=function(T){return T.slice(-1)!=="/"&&(T+="/"),T},b=function(T,A){return A=A!==void 0?A:h.createFolders,T=g(T),this.files[T]||r.call(this,T,null,{dir:!0,createFolders:A}),this.files[T]};function v(T){return Object.prototype.toString.call(T)==="[object RegExp]"}var I={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(T){var A,R,P;for(A in this.files)P=this.files[A],(R=A.slice(this.root.length,A.length))&&A.slice(0,this.root.length)===this.root&&T(R,P)},filter:function(T){var A=[];return this.forEach(function(R,P){T(R,P)&&A.push(P)}),A},file:function(T,A,R){if(arguments.length!==1)return T=this.root+T,r.call(this,T,A,R),this;if(v(T)){var P=T;return this.filter(function(x,D){return!D.dir&&P.test(x)})}var F=this.files[this.root+T];return F&&!F.dir?F:null},folder:function(T){if(!T)return this;if(v(T))return this.filter(function(F,x){return x.dir&&T.test(F)});var A=this.root+T,R=b.call(this,A),P=this.clone();return P.root=R.name,P},remove:function(T){T=this.root+T;var A=this.files[T];if(A||(T.slice(-1)!=="/"&&(T+="/"),A=this.files[T]),A&&!A.dir)delete this.files[T];else for(var R=this.filter(function(F,x){return x.name.slice(0,T.length)===T}),P=0;P<R.length;P++)delete this.files[R[P].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(T){var A,R={};try{if((R=a.extend(T||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=R.type.toLowerCase(),R.compression=R.compression.toUpperCase(),R.type==="binarystring"&&(R.type="string"),!R.type)throw new Error("No output type specified.");a.checkSupport(R.type),R.platform!=="darwin"&&R.platform!=="freebsd"&&R.platform!=="linux"&&R.platform!=="sunos"||(R.platform="UNIX"),R.platform==="win32"&&(R.platform="DOS");var P=R.comment||this.comment||"";A=f.generateWorker(this,R,P)}catch(F){(A=new l("error")).error(F)}return new c(A,R.type||"string",R.mimeType)},generateAsync:function(T,A){return this.generateInternalStream(T).accumulate(A)},generateNodeStream:function(T,A){return(T=T||{}).type||(T.type="nodebuffer"),this.generateInternalStream(T).toNodejsStream(A)}};i.exports=I},{"./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,i,s){i.exports=t("stream")},{stream:void 0}],17:[function(t,i,s){var r=t("./DataReader");function o(a){r.call(this,a);for(var l=0;l<this.data.length;l++)a[l]=255&a[l]}t("../utils").inherits(o,r),o.prototype.byteAt=function(a){return this.data[this.zero+a]},o.prototype.lastIndexOfSignature=function(a){for(var l=a.charCodeAt(0),c=a.charCodeAt(1),h=a.charCodeAt(2),d=a.charCodeAt(3),u=this.length-4;0<=u;--u)if(this.data[u]===l&&this.data[u+1]===c&&this.data[u+2]===h&&this.data[u+3]===d)return u-this.zero;return-1},o.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),c=a.charCodeAt(1),h=a.charCodeAt(2),d=a.charCodeAt(3),u=this.readData(4);return l===u[0]&&c===u[1]&&h===u[2]&&d===u[3]},o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},i.exports=o},{"../utils":32,"./DataReader":18}],18:[function(t,i,s){var r=t("../utils");function o(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,c=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=a,c},readString:function(a){return r.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},i.exports=o},{"../utils":32}],19:[function(t,i,s){var r=t("./Uint8ArrayReader");function o(a){r.call(this,a)}t("../utils").inherits(o,r),o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},i.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,i,s){var r=t("./DataReader");function o(a){r.call(this,a)}t("../utils").inherits(o,r),o.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},o.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},o.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},i.exports=o},{"../utils":32,"./DataReader":18}],21:[function(t,i,s){var r=t("./ArrayReader");function o(a){r.call(this,a)}t("../utils").inherits(o,r),o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},i.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(t,i,s){var r=t("../utils"),o=t("../support"),a=t("./ArrayReader"),l=t("./StringReader"),c=t("./NodeBufferReader"),h=t("./Uint8ArrayReader");i.exports=function(d){var u=r.getTypeOf(d);return r.checkSupport(u),u!=="string"||o.uint8array?u==="nodebuffer"?new c(d):o.uint8array?new h(r.transformTo("uint8array",d)):new a(r.transformTo("array",d)):new l(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,i,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,i,s){var r=t("./GenericWorker"),o=t("../utils");function a(l){r.call(this,"ConvertWorker to "+l),this.destType=l}o.inherits(a,r),a.prototype.processChunk=function(l){this.push({data:o.transformTo(this.destType,l.data),meta:l.meta})},i.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(t,i,s){var r=t("./GenericWorker"),o=t("../crc32");function a(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(a,r),a.prototype.processChunk=function(l){this.streamInfo.crc32=o(l.data,this.streamInfo.crc32||0),this.push(l)},i.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,i,s){var r=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}r.inherits(a,o),a.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}o.prototype.processChunk.call(this,l)},i.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(t,i,s){var r=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(h){c.dataIsReady=!0,c.data=h,c.max=h&&h.length||0,c.type=r.getTypeOf(h),c.isPaused||c._tickAndRepeat()},function(h){c.error(h)})}r.inherits(a,o),a.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},i.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(t,i,s){function r(o){this.name=o||"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}r.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,a){return this._listeners[o].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,a){if(this._listeners[o])for(var l=0;l<this._listeners[o].length;l++)this._listeners[o][l].call(this,a)},pipe:function(o){return o.registerPrevious(this)},registerPrevious:function(o){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=o.streamInfo,this.mergeStreamInfo(),this.previous=o;var a=this;return o.on("data",function(l){a.processChunk(l)}),o.on("end",function(){a.end()}),o.on("error",function(l){a.error(l)}),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 o=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),o=!0),this.previous&&this.previous.resume(),!o},flush:function(){},processChunk:function(o){this.push(o)},withStreamInfo:function(o,a){return this.extraStreamInfo[o]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var o in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,o)&&(this.streamInfo[o]=this.extraStreamInfo[o])},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 o="Worker "+this.name;return this.previous?this.previous+" -> "+o:o}},i.exports=r},{}],29:[function(t,i,s){var r=t("../utils"),o=t("./ConvertWorker"),a=t("./GenericWorker"),l=t("../base64"),c=t("../support"),h=t("../external"),d=null;if(c.nodestream)try{d=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function u(p,m){return new h.Promise(function(E,g){var b=[],v=p._internalType,I=p._outputType,T=p._mimeType;p.on("data",function(A,R){b.push(A),m&&m(R)}).on("error",function(A){b=[],g(A)}).on("end",function(){try{var A=function(R,P,F){switch(R){case"blob":return r.newBlob(r.transformTo("arraybuffer",P),F);case"base64":return l.encode(P);default:return r.transformTo(R,P)}}(I,function(R,P){var F,x=0,D=null,w=0;for(F=0;F<P.length;F++)w+=P[F].length;switch(R){case"string":return P.join("");case"array":return Array.prototype.concat.apply([],P);case"uint8array":for(D=new Uint8Array(w),F=0;F<P.length;F++)D.set(P[F],x),x+=P[F].length;return D;case"nodebuffer":return Buffer.concat(P);default:throw new Error("concat : unsupported type '"+R+"'")}}(v,b),T);E(A)}catch(R){g(R)}b=[]}).resume()})}function f(p,m,E){var g=m;switch(m){case"blob":case"arraybuffer":g="uint8array";break;case"base64":g="string"}try{this._internalType=g,this._outputType=m,this._mimeType=E,r.checkSupport(g),this._worker=p.pipe(new o(g)),p.lock()}catch(b){this._worker=new a("error"),this._worker.error(b)}}f.prototype={accumulate:function(p){return u(this,p)},on:function(p,m){var E=this;return p==="data"?this._worker.on(p,function(g){m.call(E,g.data,g.meta)}):this._worker.on(p,function(){r.delay(m,arguments,E)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(p){if(r.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new d(this,{objectMode:this._outputType!=="nodebuffer"},p)}},i.exports=f},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,i,s){if(s.base64=!0,s.array=!0,s.string=!0,s.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",s.nodebuffer=typeof Buffer<"u",s.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")s.blob=!1;else{var r=new ArrayBuffer(0);try{s.blob=new Blob([r],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(r),s.blob=o.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!t("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(t,i,s){for(var r=t("./utils"),o=t("./support"),a=t("./nodejsUtils"),l=t("./stream/GenericWorker"),c=new Array(256),h=0;h<256;h++)c[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;c[254]=c[254]=1;function d(){l.call(this,"utf-8 decode"),this.leftOver=null}function u(){l.call(this,"utf-8 encode")}s.utf8encode=function(f){return o.nodebuffer?a.newBufferFrom(f,"utf-8"):function(p){var m,E,g,b,v,I=p.length,T=0;for(b=0;b<I;b++)(64512&(E=p.charCodeAt(b)))==55296&&b+1<I&&(64512&(g=p.charCodeAt(b+1)))==56320&&(E=65536+(E-55296<<10)+(g-56320),b++),T+=E<128?1:E<2048?2:E<65536?3:4;for(m=o.uint8array?new Uint8Array(T):new Array(T),b=v=0;v<T;b++)(64512&(E=p.charCodeAt(b)))==55296&&b+1<I&&(64512&(g=p.charCodeAt(b+1)))==56320&&(E=65536+(E-55296<<10)+(g-56320),b++),E<128?m[v++]=E:(E<2048?m[v++]=192|E>>>6:(E<65536?m[v++]=224|E>>>12:(m[v++]=240|E>>>18,m[v++]=128|E>>>12&63),m[v++]=128|E>>>6&63),m[v++]=128|63&E);return m}(f)},s.utf8decode=function(f){return o.nodebuffer?r.transformTo("nodebuffer",f).toString("utf-8"):function(p){var m,E,g,b,v=p.length,I=new Array(2*v);for(m=E=0;m<v;)if((g=p[m++])<128)I[E++]=g;else if(4<(b=c[g]))I[E++]=65533,m+=b-1;else{for(g&=b===2?31:b===3?15:7;1<b&&m<v;)g=g<<6|63&p[m++],b--;1<b?I[E++]=65533:g<65536?I[E++]=g:(g-=65536,I[E++]=55296|g>>10&1023,I[E++]=56320|1023&g)}return I.length!==E&&(I.subarray?I=I.subarray(0,E):I.length=E),r.applyFromCharCode(I)}(f=r.transformTo(o.uint8array?"uint8array":"array",f))},r.inherits(d,l),d.prototype.processChunk=function(f){var p=r.transformTo(o.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var m=p;(p=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),p.set(m,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var E=function(b,v){var I;for((v=v||b.length)>b.length&&(v=b.length),I=v-1;0<=I&&(192&b[I])==128;)I--;return I<0||I===0?v:I+c[b[I]]>v?I:v}(p),g=p;E!==p.length&&(o.uint8array?(g=p.subarray(0,E),this.leftOver=p.subarray(E,p.length)):(g=p.slice(0,E),this.leftOver=p.slice(E,p.length))),this.push({data:s.utf8decode(g),meta:f.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=d,r.inherits(u,l),u.prototype.processChunk=function(f){this.push({data:s.utf8encode(f.data),meta:f.meta})},s.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,i,s){var r=t("./support"),o=t("./base64"),a=t("./nodejsUtils"),l=t("./external");function c(m){return m}function h(m,E){for(var g=0;g<m.length;++g)E[g]=255&m.charCodeAt(g);return E}t("setimmediate"),s.newBlob=function(m,E){s.checkSupport("blob");try{return new Blob([m],{type:E})}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return g.append(m),g.getBlob(E)}catch{throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(m,E,g){var b=[],v=0,I=m.length;if(I<=g)return String.fromCharCode.apply(null,m);for(;v<I;)E==="array"||E==="nodebuffer"?b.push(String.fromCharCode.apply(null,m.slice(v,Math.min(v+g,I)))):b.push(String.fromCharCode.apply(null,m.subarray(v,Math.min(v+g,I)))),v+=g;return b.join("")},stringifyByChar:function(m){for(var E="",g=0;g<m.length;g++)E+=String.fromCharCode(m[g]);return E},applyCanBeUsed:{uint8array:function(){try{return r.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}}()}};function u(m){var E=65536,g=s.getTypeOf(m),b=!0;if(g==="uint8array"?b=d.applyCanBeUsed.uint8array:g==="nodebuffer"&&(b=d.applyCanBeUsed.nodebuffer),b)for(;1<E;)try{return d.stringifyByChunk(m,g,E)}catch{E=Math.floor(E/2)}return d.stringifyByChar(m)}function f(m,E){for(var g=0;g<m.length;g++)E[g]=m[g];return E}s.applyFromCharCode=u;var p={};p.string={string:c,array:function(m){return h(m,new Array(m.length))},arraybuffer:function(m){return p.string.uint8array(m).buffer},uint8array:function(m){return h(m,new Uint8Array(m.length))},nodebuffer:function(m){return h(m,a.allocBuffer(m.length))}},p.array={string:u,array:c,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(m)}},p.arraybuffer={string:function(m){return u(new Uint8Array(m))},array:function(m){return f(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:c,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(new Uint8Array(m))}},p.uint8array={string:u,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:c,nodebuffer:function(m){return a.newBufferFrom(m)}},p.nodebuffer={string:u,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return p.nodebuffer.uint8array(m).buffer},uint8array:function(m){return f(m,new Uint8Array(m.length))},nodebuffer:c},s.transformTo=function(m,E){if(E=E||"",!m)return E;s.checkSupport(m);var g=s.getTypeOf(E);return p[g][m](E)},s.resolve=function(m){for(var E=m.split("/"),g=[],b=0;b<E.length;b++){var v=E[b];v==="."||v===""&&b!==0&&b!==E.length-1||(v===".."?g.pop():g.push(v))}return g.join("/")},s.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":r.nodebuffer&&a.isBuffer(m)?"nodebuffer":r.uint8array&&m instanceof Uint8Array?"uint8array":r.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},s.checkSupport=function(m){if(!r[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},s.MAX_VALUE_16BITS=65535,s.MAX_VALUE_32BITS=-1,s.pretty=function(m){var E,g,b="";for(g=0;g<(m||"").length;g++)b+="\\x"+((E=m.charCodeAt(g))<16?"0":"")+E.toString(16).toUpperCase();return b},s.delay=function(m,E,g){setImmediate(function(){m.apply(g||null,E||[])})},s.inherits=function(m,E){function g(){}g.prototype=E.prototype,m.prototype=new g},s.extend=function(){var m,E,g={};for(m=0;m<arguments.length;m++)for(E in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],E)&&g[E]===void 0&&(g[E]=arguments[m][E]);return g},s.prepareContent=function(m,E,g,b,v){return l.Promise.resolve(E).then(function(I){return r.blob&&(I instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(I))!==-1)&&typeof FileReader<"u"?new l.Promise(function(T,A){var R=new FileReader;R.onload=function(P){T(P.target.result)},R.onerror=function(P){A(P.target.error)},R.readAsArrayBuffer(I)}):I}).then(function(I){var T=s.getTypeOf(I);return T?(T==="arraybuffer"?I=s.transformTo("uint8array",I):T==="string"&&(v?I=o.decode(I):g&&b!==!0&&(I=function(A){return h(A,r.uint8array?new Uint8Array(A.length):new Array(A.length))}(I))),I):l.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,i,s){var r=t("./reader/readerFor"),o=t("./utils"),a=t("./signature"),l=t("./zipEntry"),c=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 ("+o.pretty(u)+", expected "+o.pretty(d)+")")}},isSignature:function(d,u){var f=this.reader.index;this.reader.setIndex(d);var p=this.reader.readString(4)===u;return this.reader.setIndex(f),p},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=c.uint8array?"uint8array":"array",f=o.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,p=this.zip64EndOfCentralSize-44;0<p;)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(a.LOCAL_FILE_HEADER),u.readLocalPart(this.reader),u.handleUTF8(),u.processAttributes()},readCentralDir:function(){var d;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(d=new l({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(a.CENTRAL_DIRECTORY_END);if(d<0)throw this.isSignature(0,a.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(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(d=this.reader.lastIndexOfSignature(a.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(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.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(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var f=this.centralDirOffset+this.centralDirSize;this.zip64&&(f+=20,f+=12+this.zip64EndOfCentralSize);var p=u-f;if(0<p)this.isSignature(u,a.CENTRAL_FILE_HEADER)||(this.reader.zero=p);else if(p<0)throw new Error("Corrupted zip: missing "+Math.abs(p)+" bytes.")},prepareReader:function(d){this.reader=r(d)},load:function(d){this.prepareReader(d),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},i.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,i,s){var r=t("./reader/readerFor"),o=t("./utils"),a=t("./compressedObject"),l=t("./crc32"),c=t("./utf8"),h=t("./compressions"),d=t("./support");function u(f,p){this.options=f,this.loadOptions=p}u.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(f){var p,m;if(f.skip(22),this.fileNameLength=f.readInt(2),m=f.readInt(2),this.fileName=f.readData(this.fileNameLength),f.skip(m),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((p=function(E){for(var g in h)if(Object.prototype.hasOwnProperty.call(h,g)&&h[g].magic===E)return h[g];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,p,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 p=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(p),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=r(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var p,m,E,g=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4<g;)p=f.readInt(2),m=f.readInt(2),E=f.readData(m),this.extraFields[p]={id:p,length:m,value:E};f.setIndex(g)},handleUTF8:function(){var f=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=c.utf8decode(this.fileName),this.fileCommentStr=c.utf8decode(this.fileComment);else{var p=this.findExtraFieldUnicodePath();if(p!==null)this.fileNameStr=p;else{var m=o.transformTo(f,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var E=this.findExtraFieldUnicodeComment();if(E!==null)this.fileCommentStr=E;else{var g=o.transformTo(f,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(g)}}},findExtraFieldUnicodePath:function(){var f=this.extraFields[28789];if(f){var p=r(f.value);return p.readInt(1)!==1||l(this.fileName)!==p.readInt(4)?null:c.utf8decode(p.readData(f.length-5))}return null},findExtraFieldUnicodeComment:function(){var f=this.extraFields[25461];if(f){var p=r(f.value);return p.readInt(1)!==1||l(this.fileComment)!==p.readInt(4)?null:c.utf8decode(p.readData(f.length-5))}return null}},i.exports=u},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,i,s){function r(p,m,E){this.name=p,this.dir=E.dir,this.date=E.date,this.comment=E.comment,this.unixPermissions=E.unixPermissions,this.dosPermissions=E.dosPermissions,this._data=m,this._dataBinary=E.binary,this.options={compression:E.compression,compressionOptions:E.compressionOptions}}var o=t("./stream/StreamHelper"),a=t("./stream/DataWorker"),l=t("./utf8"),c=t("./compressedObject"),h=t("./stream/GenericWorker");r.prototype={internalStream:function(p){var m=null,E="string";try{if(!p)throw new Error("No output type specified.");var g=(E=p.toLowerCase())==="string"||E==="text";E!=="binarystring"&&E!=="text"||(E="string"),m=this._decompressWorker();var b=!this._dataBinary;b&&!g&&(m=m.pipe(new l.Utf8EncodeWorker)),!b&&g&&(m=m.pipe(new l.Utf8DecodeWorker))}catch(v){(m=new h("error")).error(v)}return new o(m,E,"")},async:function(p,m){return this.internalStream(p).accumulate(m)},nodeStream:function(p,m){return this.internalStream(p||"nodebuffer").toNodejsStream(m)},_compressWorker:function(p,m){if(this._data instanceof c&&this._data.compression.magic===p.magic)return this._data.getCompressedWorker();var E=this._decompressWorker();return this._dataBinary||(E=E.pipe(new l.Utf8EncodeWorker)),c.createWorkerFrom(E,p,m)},_decompressWorker:function(){return this._data instanceof c?this._data.getContentWorker():this._data instanceof h?this._data:new a(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++)r.prototype[d[f]]=u;i.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,i,s){(function(r){var o,a,l=r.MutationObserver||r.WebKitMutationObserver;if(l){var c=0,h=new l(p),d=r.document.createTextNode("");h.observe(d,{characterData:!0}),o=function(){d.data=c=++c%2}}else if(r.setImmediate||r.MessageChannel===void 0)o="document"in r&&"onreadystatechange"in r.document.createElement("script")?function(){var m=r.document.createElement("script");m.onreadystatechange=function(){p(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},r.document.documentElement.appendChild(m)}:function(){setTimeout(p,0)};else{var u=new r.MessageChannel;u.port1.onmessage=p,o=function(){u.port2.postMessage(0)}}var f=[];function p(){var m,E;a=!0;for(var g=f.length;g;){for(E=f,f=[],m=-1;++m<g;)E[m]();g=f.length}a=!1}i.exports=function(m){f.push(m)!==1||a||o()}}).call(this,typeof Mn<"u"?Mn:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,i,s){var r=t("immediate");function o(){}var a={},l=["REJECTED"],c=["FULFILLED"],h=["PENDING"];function d(g){if(typeof g!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,g!==o&&m(this,g)}function u(g,b,v){this.promise=g,typeof b=="function"&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),typeof v=="function"&&(this.onRejected=v,this.callRejected=this.otherCallRejected)}function f(g,b,v){r(function(){var I;try{I=b(v)}catch(T){return a.reject(g,T)}I===g?a.reject(g,new TypeError("Cannot resolve promise with itself")):a.resolve(g,I)})}function p(g){var b=g&&g.then;if(g&&(typeof g=="object"||typeof g=="function")&&typeof b=="function")return function(){b.apply(g,arguments)}}function m(g,b){var v=!1;function I(R){v||(v=!0,a.reject(g,R))}function T(R){v||(v=!0,a.resolve(g,R))}var A=E(function(){b(T,I)});A.status==="error"&&I(A.value)}function E(g,b){var v={};try{v.value=g(b),v.status="success"}catch(I){v.status="error",v.value=I}return v}(i.exports=d).prototype.finally=function(g){if(typeof g!="function")return this;var b=this.constructor;return this.then(function(v){return b.resolve(g()).then(function(){return v})},function(v){return b.resolve(g()).then(function(){throw v})})},d.prototype.catch=function(g){return this.then(null,g)},d.prototype.then=function(g,b){if(typeof g!="function"&&this.state===c||typeof b!="function"&&this.state===l)return this;var v=new this.constructor(o);return this.state!==h?f(v,this.state===c?g:b,this.outcome):this.queue.push(new u(v,g,b)),v},u.prototype.callFulfilled=function(g){a.resolve(this.promise,g)},u.prototype.otherCallFulfilled=function(g){f(this.promise,this.onFulfilled,g)},u.prototype.callRejected=function(g){a.reject(this.promise,g)},u.prototype.otherCallRejected=function(g){f(this.promise,this.onRejected,g)},a.resolve=function(g,b){var v=E(p,b);if(v.status==="error")return a.reject(g,v.value);var I=v.value;if(I)m(g,I);else{g.state=c,g.outcome=b;for(var T=-1,A=g.queue.length;++T<A;)g.queue[T].callFulfilled(b)}return g},a.reject=function(g,b){g.state=l,g.outcome=b;for(var v=-1,I=g.queue.length;++v<I;)g.queue[v].callRejected(b);return g},d.resolve=function(g){return g instanceof this?g:a.resolve(new this(o),g)},d.reject=function(g){var b=new this(o);return a.reject(b,g)},d.all=function(g){var b=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var v=g.length,I=!1;if(!v)return this.resolve([]);for(var T=new Array(v),A=0,R=-1,P=new this(o);++R<v;)F(g[R],R);return P;function F(x,D){b.resolve(x).then(function(w){T[D]=w,++A!==v||I||(I=!0,a.resolve(P,T))},function(w){I||(I=!0,a.reject(P,w))})}},d.race=function(g){var b=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var v=g.length,I=!1;if(!v)return this.resolve([]);for(var T=-1,A=new this(o);++T<v;)R=g[T],b.resolve(R).then(function(P){I||(I=!0,a.resolve(A,P))},function(P){I||(I=!0,a.reject(A,P))});var R;return A}},{immediate:36}],38:[function(t,i,s){var r={};(0,t("./lib/utils/common").assign)(r,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),i.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,i,s){var r=t("./zlib/deflate"),o=t("./utils/common"),a=t("./utils/strings"),l=t("./zlib/messages"),c=t("./zlib/zstream"),h=Object.prototype.toString,d=0,u=-1,f=0,p=8;function m(g){if(!(this instanceof m))return new m(g);this.options=o.assign({level:u,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,to:""},g||{});var b=this.options;b.raw&&0<b.windowBits?b.windowBits=-b.windowBits:b.gzip&&0<b.windowBits&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var v=r.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(v!==d)throw new Error(l[v]);if(b.header&&r.deflateSetHeader(this.strm,b.header),b.dictionary){var I;if(I=typeof b.dictionary=="string"?a.string2buf(b.dictionary):h.call(b.dictionary)==="[object ArrayBuffer]"?new Uint8Array(b.dictionary):b.dictionary,(v=r.deflateSetDictionary(this.strm,I))!==d)throw new Error(l[v]);this._dict_set=!0}}function E(g,b){var v=new m(b);if(v.push(g,!0),v.err)throw v.msg||l[v.err];return v.result}m.prototype.push=function(g,b){var v,I,T=this.strm,A=this.options.chunkSize;if(this.ended)return!1;I=b===~~b?b:b===!0?4:0,typeof g=="string"?T.input=a.string2buf(g):h.call(g)==="[object ArrayBuffer]"?T.input=new Uint8Array(g):T.input=g,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new o.Buf8(A),T.next_out=0,T.avail_out=A),(v=r.deflate(T,I))!==1&&v!==d)return this.onEnd(v),!(this.ended=!0);T.avail_out!==0&&(T.avail_in!==0||I!==4&&I!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(o.shrinkBuf(T.output,T.next_out))):this.onData(o.shrinkBuf(T.output,T.next_out)))}while((0<T.avail_in||T.avail_out===0)&&v!==1);return I===4?(v=r.deflateEnd(this.strm),this.onEnd(v),this.ended=!0,v===d):I!==2||(this.onEnd(d),!(T.avail_out=0))},m.prototype.onData=function(g){this.chunks.push(g)},m.prototype.onEnd=function(g){g===d&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},s.Deflate=m,s.deflate=E,s.deflateRaw=function(g,b){return(b=b||{}).raw=!0,E(g,b)},s.gzip=function(g,b){return(b=b||{}).gzip=!0,E(g,b)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,i,s){var r=t("./zlib/inflate"),o=t("./utils/common"),a=t("./utils/strings"),l=t("./zlib/constants"),c=t("./zlib/messages"),h=t("./zlib/zstream"),d=t("./zlib/gzheader"),u=Object.prototype.toString;function f(m){if(!(this instanceof f))return new f(m);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},m||{});var E=this.options;E.raw&&0<=E.windowBits&&E.windowBits<16&&(E.windowBits=-E.windowBits,E.windowBits===0&&(E.windowBits=-15)),!(0<=E.windowBits&&E.windowBits<16)||m&&m.windowBits||(E.windowBits+=32),15<E.windowBits&&E.windowBits<48&&!(15&E.windowBits)&&(E.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var g=r.inflateInit2(this.strm,E.windowBits);if(g!==l.Z_OK)throw new Error(c[g]);this.header=new d,r.inflateGetHeader(this.strm,this.header)}function p(m,E){var g=new f(E);if(g.push(m,!0),g.err)throw g.msg||c[g.err];return g.result}f.prototype.push=function(m,E){var g,b,v,I,T,A,R=this.strm,P=this.options.chunkSize,F=this.options.dictionary,x=!1;if(this.ended)return!1;b=E===~~E?E:E===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof m=="string"?R.input=a.binstring2buf(m):u.call(m)==="[object ArrayBuffer]"?R.input=new Uint8Array(m):R.input=m,R.next_in=0,R.avail_in=R.input.length;do{if(R.avail_out===0&&(R.output=new o.Buf8(P),R.next_out=0,R.avail_out=P),(g=r.inflate(R,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&F&&(A=typeof F=="string"?a.string2buf(F):u.call(F)==="[object ArrayBuffer]"?new Uint8Array(F):F,g=r.inflateSetDictionary(this.strm,A)),g===l.Z_BUF_ERROR&&x===!0&&(g=l.Z_OK,x=!1),g!==l.Z_STREAM_END&&g!==l.Z_OK)return this.onEnd(g),!(this.ended=!0);R.next_out&&(R.avail_out!==0&&g!==l.Z_STREAM_END&&(R.avail_in!==0||b!==l.Z_FINISH&&b!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(v=a.utf8border(R.output,R.next_out),I=R.next_out-v,T=a.buf2string(R.output,v),R.next_out=I,R.avail_out=P-I,I&&o.arraySet(R.output,R.output,v,I,0),this.onData(T)):this.onData(o.shrinkBuf(R.output,R.next_out)))),R.avail_in===0&&R.avail_out===0&&(x=!0)}while((0<R.avail_in||R.avail_out===0)&&g!==l.Z_STREAM_END);return g===l.Z_STREAM_END&&(b=l.Z_FINISH),b===l.Z_FINISH?(g=r.inflateEnd(this.strm),this.onEnd(g),this.ended=!0,g===l.Z_OK):b!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(R.avail_out=0))},f.prototype.onData=function(m){this.chunks.push(m)},f.prototype.onEnd=function(m){m===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},s.Inflate=f,s.inflate=p,s.inflateRaw=function(m,E){return(E=E||{}).raw=!0,p(m,E)},s.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,i,s){var r=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";s.assign=function(l){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var h=c.shift();if(h){if(typeof h!="object")throw new TypeError(h+"must be non-object");for(var d in h)h.hasOwnProperty(d)&&(l[d]=h[d])}}return l},s.shrinkBuf=function(l,c){return l.length===c?l:l.subarray?l.subarray(0,c):(l.length=c,l)};var o={arraySet:function(l,c,h,d,u){if(c.subarray&&l.subarray)l.set(c.subarray(h,h+d),u);else for(var f=0;f<d;f++)l[u+f]=c[h+f]},flattenChunks:function(l){var c,h,d,u,f,p;for(c=d=0,h=l.length;c<h;c++)d+=l[c].length;for(p=new Uint8Array(d),c=u=0,h=l.length;c<h;c++)f=l[c],p.set(f,u),u+=f.length;return p}},a={arraySet:function(l,c,h,d,u){for(var f=0;f<d;f++)l[u+f]=c[h+f]},flattenChunks:function(l){return[].concat.apply([],l)}};s.setTyped=function(l){l?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,o)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,a))},s.setTyped(r)},{}],42:[function(t,i,s){var r=t("./common"),o=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new r.Buf8(256),c=0;c<256;c++)l[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function h(d,u){if(u<65537&&(d.subarray&&a||!d.subarray&&o))return String.fromCharCode.apply(null,r.shrinkBuf(d,u));for(var f="",p=0;p<u;p++)f+=String.fromCharCode(d[p]);return f}l[254]=l[254]=1,s.string2buf=function(d){var u,f,p,m,E,g=d.length,b=0;for(m=0;m<g;m++)(64512&(f=d.charCodeAt(m)))==55296&&m+1<g&&(64512&(p=d.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(p-56320),m++),b+=f<128?1:f<2048?2:f<65536?3:4;for(u=new r.Buf8(b),m=E=0;E<b;m++)(64512&(f=d.charCodeAt(m)))==55296&&m+1<g&&(64512&(p=d.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(p-56320),m++),f<128?u[E++]=f:(f<2048?u[E++]=192|f>>>6:(f<65536?u[E++]=224|f>>>12:(u[E++]=240|f>>>18,u[E++]=128|f>>>12&63),u[E++]=128|f>>>6&63),u[E++]=128|63&f);return u},s.buf2binstring=function(d){return h(d,d.length)},s.binstring2buf=function(d){for(var u=new r.Buf8(d.length),f=0,p=u.length;f<p;f++)u[f]=d.charCodeAt(f);return u},s.buf2string=function(d,u){var f,p,m,E,g=u||d.length,b=new Array(2*g);for(f=p=0;f<g;)if((m=d[f++])<128)b[p++]=m;else if(4<(E=l[m]))b[p++]=65533,f+=E-1;else{for(m&=E===2?31:E===3?15:7;1<E&&f<g;)m=m<<6|63&d[f++],E--;1<E?b[p++]=65533:m<65536?b[p++]=m:(m-=65536,b[p++]=55296|m>>10&1023,b[p++]=56320|1023&m)}return h(b,p)},s.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+l[d[f]]>u?f:u}},{"./common":41}],43:[function(t,i,s){i.exports=function(r,o,a,l){for(var c=65535&r|0,h=r>>>16&65535|0,d=0;a!==0;){for(a-=d=2e3<a?2e3:a;h=h+(c=c+o[l++]|0)|0,--d;);c%=65521,h%=65521}return c|h<<16|0}},{}],44:[function(t,i,s){i.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,i,s){var r=function(){for(var o,a=[],l=0;l<256;l++){o=l;for(var c=0;c<8;c++)o=1&o?3988292384^o>>>1:o>>>1;a[l]=o}return a}();i.exports=function(o,a,l,c){var h=r,d=c+l;o^=-1;for(var u=c;u<d;u++)o=o>>>8^h[255&(o^a[u])];return-1^o}},{}],46:[function(t,i,s){var r,o=t("../utils/common"),a=t("./trees"),l=t("./adler32"),c=t("./crc32"),h=t("./messages"),d=0,u=4,f=0,p=-2,m=-1,E=4,g=2,b=8,v=9,I=286,T=30,A=19,R=2*I+1,P=15,F=3,x=258,D=x+F+1,w=42,L=113,C=1,U=2,Z=3,H=4;function st(_,j){return _.msg=h[j],j}function Y(_){return(_<<1)-(4<_?9:0)}function ot(_){for(var j=_.length;0<=--j;)_[j]=0}function V(_){var j=_.state,$=j.pending;$>_.avail_out&&($=_.avail_out),$!==0&&(o.arraySet(_.output,j.pending_buf,j.pending_out,$,_.next_out),_.next_out+=$,j.pending_out+=$,_.total_out+=$,_.avail_out-=$,j.pending-=$,j.pending===0&&(j.pending_out=0))}function B(_,j){a._tr_flush_block(_,0<=_.block_start?_.block_start:-1,_.strstart-_.block_start,j),_.block_start=_.strstart,V(_.strm)}function at(_,j){_.pending_buf[_.pending++]=j}function nt(_,j){_.pending_buf[_.pending++]=j>>>8&255,_.pending_buf[_.pending++]=255&j}function it(_,j){var $,N,O=_.max_chain_length,k=_.strstart,X=_.prev_length,q=_.nice_match,z=_.strstart>_.w_size-D?_.strstart-(_.w_size-D):0,J=_.window,rt=_.w_mask,et=_.prev,ct=_.strstart+x,Tt=J[k+X-1],mt=J[k+X];_.prev_length>=_.good_match&&(O>>=2),q>_.lookahead&&(q=_.lookahead);do if(J[($=j)+X]===mt&&J[$+X-1]===Tt&&J[$]===J[k]&&J[++$]===J[k+1]){k+=2,$++;do;while(J[++k]===J[++$]&&J[++k]===J[++$]&&J[++k]===J[++$]&&J[++k]===J[++$]&&J[++k]===J[++$]&&J[++k]===J[++$]&&J[++k]===J[++$]&&J[++k]===J[++$]&&k<ct);if(N=x-(ct-k),k=ct-x,X<N){if(_.match_start=j,q<=(X=N))break;Tt=J[k+X-1],mt=J[k+X]}}while((j=et[j&rt])>z&&--O!=0);return X<=_.lookahead?X:_.lookahead}function At(_){var j,$,N,O,k,X,q,z,J,rt,et=_.w_size;do{if(O=_.window_size-_.lookahead-_.strstart,_.strstart>=et+(et-D)){for(o.arraySet(_.window,_.window,et,et,0),_.match_start-=et,_.strstart-=et,_.block_start-=et,j=$=_.hash_size;N=_.head[--j],_.head[j]=et<=N?N-et:0,--$;);for(j=$=et;N=_.prev[--j],_.prev[j]=et<=N?N-et:0,--$;);O+=et}if(_.strm.avail_in===0)break;if(X=_.strm,q=_.window,z=_.strstart+_.lookahead,J=O,rt=void 0,rt=X.avail_in,J<rt&&(rt=J),$=rt===0?0:(X.avail_in-=rt,o.arraySet(q,X.input,X.next_in,rt,z),X.state.wrap===1?X.adler=l(X.adler,q,rt,z):X.state.wrap===2&&(X.adler=c(X.adler,q,rt,z)),X.next_in+=rt,X.total_in+=rt,rt),_.lookahead+=$,_.lookahead+_.insert>=F)for(k=_.strstart-_.insert,_.ins_h=_.window[k],_.ins_h=(_.ins_h<<_.hash_shift^_.window[k+1])&_.hash_mask;_.insert&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[k+F-1])&_.hash_mask,_.prev[k&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=k,k++,_.insert--,!(_.lookahead+_.insert<F)););}while(_.lookahead<D&&_.strm.avail_in!==0)}function xt(_,j){for(var $,N;;){if(_.lookahead<D){if(At(_),_.lookahead<D&&j===d)return C;if(_.lookahead===0)break}if($=0,_.lookahead>=F&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+F-1])&_.hash_mask,$=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),$!==0&&_.strstart-$<=_.w_size-D&&(_.match_length=it(_,$)),_.match_length>=F)if(N=a._tr_tally(_,_.strstart-_.match_start,_.match_length-F),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=F){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+F-1])&_.hash_mask,$=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart,--_.match_length!=0;);_.strstart++}else _.strstart+=_.match_length,_.match_length=0,_.ins_h=_.window[_.strstart],_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+1])&_.hash_mask;else N=a._tr_tally(_,0,_.window[_.strstart]),_.lookahead--,_.strstart++;if(N&&(B(_,!1),_.strm.avail_out===0))return C}return _.insert=_.strstart<F-1?_.strstart:F-1,j===u?(B(_,!0),_.strm.avail_out===0?Z:H):_.last_lit&&(B(_,!1),_.strm.avail_out===0)?C:U}function lt(_,j){for(var $,N,O;;){if(_.lookahead<D){if(At(_),_.lookahead<D&&j===d)return C;if(_.lookahead===0)break}if($=0,_.lookahead>=F&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+F-1])&_.hash_mask,$=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),_.prev_length=_.match_length,_.prev_match=_.match_start,_.match_length=F-1,$!==0&&_.prev_length<_.max_lazy_match&&_.strstart-$<=_.w_size-D&&(_.match_length=it(_,$),_.match_length<=5&&(_.strategy===1||_.match_length===F&&4096<_.strstart-_.match_start)&&(_.match_length=F-1)),_.prev_length>=F&&_.match_length<=_.prev_length){for(O=_.strstart+_.lookahead-F,N=a._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-F),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=O&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+F-1])&_.hash_mask,$=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=F-1,_.strstart++,N&&(B(_,!1),_.strm.avail_out===0))return C}else if(_.match_available){if((N=a._tr_tally(_,0,_.window[_.strstart-1]))&&B(_,!1),_.strstart++,_.lookahead--,_.strm.avail_out===0)return C}else _.match_available=1,_.strstart++,_.lookahead--}return _.match_available&&(N=a._tr_tally(_,0,_.window[_.strstart-1]),_.match_available=0),_.insert=_.strstart<F-1?_.strstart:F-1,j===u?(B(_,!0),_.strm.avail_out===0?Z:H):_.last_lit&&(B(_,!1),_.strm.avail_out===0)?C:U}function pt(_,j,$,N,O){this.good_length=_,this.max_lazy=j,this.nice_length=$,this.max_chain=N,this.func=O}function ft(){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=b,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 o.Buf16(2*R),this.dyn_dtree=new o.Buf16(2*(2*T+1)),this.bl_tree=new o.Buf16(2*(2*A+1)),ot(this.dyn_ltree),ot(this.dyn_dtree),ot(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(P+1),this.heap=new o.Buf16(2*I+1),ot(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*I+1),ot(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 Ct(_){var j;return _&&_.state?(_.total_in=_.total_out=0,_.data_type=g,(j=_.state).pending=0,j.pending_out=0,j.wrap<0&&(j.wrap=-j.wrap),j.status=j.wrap?w:L,_.adler=j.wrap===2?0:1,j.last_flush=d,a._tr_init(j),f):st(_,p)}function qt(_){var j=Ct(_);return j===f&&function($){$.window_size=2*$.w_size,ot($.head),$.max_lazy_match=r[$.level].max_lazy,$.good_match=r[$.level].good_length,$.nice_match=r[$.level].nice_length,$.max_chain_length=r[$.level].max_chain,$.strstart=0,$.block_start=0,$.lookahead=0,$.insert=0,$.match_length=$.prev_length=F-1,$.match_available=0,$.ins_h=0}(_.state),j}function zt(_,j,$,N,O,k){if(!_)return p;var X=1;if(j===m&&(j=6),N<0?(X=0,N=-N):15<N&&(X=2,N-=16),O<1||v<O||$!==b||N<8||15<N||j<0||9<j||k<0||E<k)return st(_,p);N===8&&(N=9);var q=new ft;return(_.state=q).strm=_,q.wrap=X,q.gzhead=null,q.w_bits=N,q.w_size=1<<q.w_bits,q.w_mask=q.w_size-1,q.hash_bits=O+7,q.hash_size=1<<q.hash_bits,q.hash_mask=q.hash_size-1,q.hash_shift=~~((q.hash_bits+F-1)/F),q.window=new o.Buf8(2*q.w_size),q.head=new o.Buf16(q.hash_size),q.prev=new o.Buf16(q.w_size),q.lit_bufsize=1<<O+6,q.pending_buf_size=4*q.lit_bufsize,q.pending_buf=new o.Buf8(q.pending_buf_size),q.d_buf=1*q.lit_bufsize,q.l_buf=3*q.lit_bufsize,q.level=j,q.strategy=k,q.method=$,qt(_)}r=[new pt(0,0,0,0,function(_,j){var $=65535;for($>_.pending_buf_size-5&&($=_.pending_buf_size-5);;){if(_.lookahead<=1){if(At(_),_.lookahead===0&&j===d)return C;if(_.lookahead===0)break}_.strstart+=_.lookahead,_.lookahead=0;var N=_.block_start+$;if((_.strstart===0||_.strstart>=N)&&(_.lookahead=_.strstart-N,_.strstart=N,B(_,!1),_.strm.avail_out===0)||_.strstart-_.block_start>=_.w_size-D&&(B(_,!1),_.strm.avail_out===0))return C}return _.insert=0,j===u?(B(_,!0),_.strm.avail_out===0?Z:H):(_.strstart>_.block_start&&(B(_,!1),_.strm.avail_out),C)}),new pt(4,4,8,4,xt),new pt(4,5,16,8,xt),new pt(4,6,32,32,xt),new pt(4,4,16,16,lt),new pt(8,16,32,32,lt),new pt(8,16,128,128,lt),new pt(8,32,128,256,lt),new pt(32,128,258,1024,lt),new pt(32,258,258,4096,lt)],s.deflateInit=function(_,j){return zt(_,j,b,15,8,0)},s.deflateInit2=zt,s.deflateReset=qt,s.deflateResetKeep=Ct,s.deflateSetHeader=function(_,j){return _&&_.state?_.state.wrap!==2?p:(_.state.gzhead=j,f):p},s.deflate=function(_,j){var $,N,O,k;if(!_||!_.state||5<j||j<0)return _?st(_,p):p;if(N=_.state,!_.output||!_.input&&_.avail_in!==0||N.status===666&&j!==u)return st(_,_.avail_out===0?-5:p);if(N.strm=_,$=N.last_flush,N.last_flush=j,N.status===w)if(N.wrap===2)_.adler=0,at(N,31),at(N,139),at(N,8),N.gzhead?(at(N,(N.gzhead.text?1:0)+(N.gzhead.hcrc?2:0)+(N.gzhead.extra?4:0)+(N.gzhead.name?8:0)+(N.gzhead.comment?16:0)),at(N,255&N.gzhead.time),at(N,N.gzhead.time>>8&255),at(N,N.gzhead.time>>16&255),at(N,N.gzhead.time>>24&255),at(N,N.level===9?2:2<=N.strategy||N.level<2?4:0),at(N,255&N.gzhead.os),N.gzhead.extra&&N.gzhead.extra.length&&(at(N,255&N.gzhead.extra.length),at(N,N.gzhead.extra.length>>8&255)),N.gzhead.hcrc&&(_.adler=c(_.adler,N.pending_buf,N.pending,0)),N.gzindex=0,N.status=69):(at(N,0),at(N,0),at(N,0),at(N,0),at(N,0),at(N,N.level===9?2:2<=N.strategy||N.level<2?4:0),at(N,3),N.status=L);else{var X=b+(N.w_bits-8<<4)<<8;X|=(2<=N.strategy||N.level<2?0:N.level<6?1:N.level===6?2:3)<<6,N.strstart!==0&&(X|=32),X+=31-X%31,N.status=L,nt(N,X),N.strstart!==0&&(nt(N,_.adler>>>16),nt(N,65535&_.adler)),_.adler=1}if(N.status===69)if(N.gzhead.extra){for(O=N.pending;N.gzindex<(65535&N.gzhead.extra.length)&&(N.pending!==N.pending_buf_size||(N.gzhead.hcrc&&N.pending>O&&(_.adler=c(_.adler,N.pending_buf,N.pending-O,O)),V(_),O=N.pending,N.pending!==N.pending_buf_size));)at(N,255&N.gzhead.extra[N.gzindex]),N.gzindex++;N.gzhead.hcrc&&N.pending>O&&(_.adler=c(_.adler,N.pending_buf,N.pending-O,O)),N.gzindex===N.gzhead.extra.length&&(N.gzindex=0,N.status=73)}else N.status=73;if(N.status===73)if(N.gzhead.name){O=N.pending;do{if(N.pending===N.pending_buf_size&&(N.gzhead.hcrc&&N.pending>O&&(_.adler=c(_.adler,N.pending_buf,N.pending-O,O)),V(_),O=N.pending,N.pending===N.pending_buf_size)){k=1;break}k=N.gzindex<N.gzhead.name.length?255&N.gzhead.name.charCodeAt(N.gzindex++):0,at(N,k)}while(k!==0);N.gzhead.hcrc&&N.pending>O&&(_.adler=c(_.adler,N.pending_buf,N.pending-O,O)),k===0&&(N.gzindex=0,N.status=91)}else N.status=91;if(N.status===91)if(N.gzhead.comment){O=N.pending;do{if(N.pending===N.pending_buf_size&&(N.gzhead.hcrc&&N.pending>O&&(_.adler=c(_.adler,N.pending_buf,N.pending-O,O)),V(_),O=N.pending,N.pending===N.pending_buf_size)){k=1;break}k=N.gzindex<N.gzhead.comment.length?255&N.gzhead.comment.charCodeAt(N.gzindex++):0,at(N,k)}while(k!==0);N.gzhead.hcrc&&N.pending>O&&(_.adler=c(_.adler,N.pending_buf,N.pending-O,O)),k===0&&(N.status=103)}else N.status=103;if(N.status===103&&(N.gzhead.hcrc?(N.pending+2>N.pending_buf_size&&V(_),N.pending+2<=N.pending_buf_size&&(at(N,255&_.adler),at(N,_.adler>>8&255),_.adler=0,N.status=L)):N.status=L),N.pending!==0){if(V(_),_.avail_out===0)return N.last_flush=-1,f}else if(_.avail_in===0&&Y(j)<=Y($)&&j!==u)return st(_,-5);if(N.status===666&&_.avail_in!==0)return st(_,-5);if(_.avail_in!==0||N.lookahead!==0||j!==d&&N.status!==666){var q=N.strategy===2?function(z,J){for(var rt;;){if(z.lookahead===0&&(At(z),z.lookahead===0)){if(J===d)return C;break}if(z.match_length=0,rt=a._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++,rt&&(B(z,!1),z.strm.avail_out===0))return C}return z.insert=0,J===u?(B(z,!0),z.strm.avail_out===0?Z:H):z.last_lit&&(B(z,!1),z.strm.avail_out===0)?C:U}(N,j):N.strategy===3?function(z,J){for(var rt,et,ct,Tt,mt=z.window;;){if(z.lookahead<=x){if(At(z),z.lookahead<=x&&J===d)return C;if(z.lookahead===0)break}if(z.match_length=0,z.lookahead>=F&&0<z.strstart&&(et=mt[ct=z.strstart-1])===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]){Tt=z.strstart+x;do;while(et===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]&&ct<Tt);z.match_length=x-(Tt-ct),z.match_length>z.lookahead&&(z.match_length=z.lookahead)}if(z.match_length>=F?(rt=a._tr_tally(z,1,z.match_length-F),z.lookahead-=z.match_length,z.strstart+=z.match_length,z.match_length=0):(rt=a._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++),rt&&(B(z,!1),z.strm.avail_out===0))return C}return z.insert=0,J===u?(B(z,!0),z.strm.avail_out===0?Z:H):z.last_lit&&(B(z,!1),z.strm.avail_out===0)?C:U}(N,j):r[N.level].func(N,j);if(q!==Z&&q!==H||(N.status=666),q===C||q===Z)return _.avail_out===0&&(N.last_flush=-1),f;if(q===U&&(j===1?a._tr_align(N):j!==5&&(a._tr_stored_block(N,0,0,!1),j===3&&(ot(N.head),N.lookahead===0&&(N.strstart=0,N.block_start=0,N.insert=0))),V(_),_.avail_out===0))return N.last_flush=-1,f}return j!==u?f:N.wrap<=0?1:(N.wrap===2?(at(N,255&_.adler),at(N,_.adler>>8&255),at(N,_.adler>>16&255),at(N,_.adler>>24&255),at(N,255&_.total_in),at(N,_.total_in>>8&255),at(N,_.total_in>>16&255),at(N,_.total_in>>24&255)):(nt(N,_.adler>>>16),nt(N,65535&_.adler)),V(_),0<N.wrap&&(N.wrap=-N.wrap),N.pending!==0?f:1)},s.deflateEnd=function(_){var j;return _&&_.state?(j=_.state.status)!==w&&j!==69&&j!==73&&j!==91&&j!==103&&j!==L&&j!==666?st(_,p):(_.state=null,j===L?st(_,-3):f):p},s.deflateSetDictionary=function(_,j){var $,N,O,k,X,q,z,J,rt=j.length;if(!_||!_.state||(k=($=_.state).wrap)===2||k===1&&$.status!==w||$.lookahead)return p;for(k===1&&(_.adler=l(_.adler,j,rt,0)),$.wrap=0,rt>=$.w_size&&(k===0&&(ot($.head),$.strstart=0,$.block_start=0,$.insert=0),J=new o.Buf8($.w_size),o.arraySet(J,j,rt-$.w_size,$.w_size,0),j=J,rt=$.w_size),X=_.avail_in,q=_.next_in,z=_.input,_.avail_in=rt,_.next_in=0,_.input=j,At($);$.lookahead>=F;){for(N=$.strstart,O=$.lookahead-(F-1);$.ins_h=($.ins_h<<$.hash_shift^$.window[N+F-1])&$.hash_mask,$.prev[N&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=N,N++,--O;);$.strstart=N,$.lookahead=F-1,At($)}return $.strstart+=$.lookahead,$.block_start=$.strstart,$.insert=$.lookahead,$.lookahead=0,$.match_length=$.prev_length=F-1,$.match_available=0,_.next_in=q,_.input=z,_.avail_in=X,$.wrap=k,f},s.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,i,s){i.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,i,s){i.exports=function(r,o){var a,l,c,h,d,u,f,p,m,E,g,b,v,I,T,A,R,P,F,x,D,w,L,C,U;a=r.state,l=r.next_in,C=r.input,c=l+(r.avail_in-5),h=r.next_out,U=r.output,d=h-(o-r.avail_out),u=h+(r.avail_out-257),f=a.dmax,p=a.wsize,m=a.whave,E=a.wnext,g=a.window,b=a.hold,v=a.bits,I=a.lencode,T=a.distcode,A=(1<<a.lenbits)-1,R=(1<<a.distbits)-1;t:do{v<15&&(b+=C[l++]<<v,v+=8,b+=C[l++]<<v,v+=8),P=I[b&A];e:for(;;){if(b>>>=F=P>>>24,v-=F,(F=P>>>16&255)===0)U[h++]=65535&P;else{if(!(16&F)){if(!(64&F)){P=I[(65535&P)+(b&(1<<F)-1)];continue e}if(32&F){a.mode=12;break t}r.msg="invalid literal/length code",a.mode=30;break t}x=65535&P,(F&=15)&&(v<F&&(b+=C[l++]<<v,v+=8),x+=b&(1<<F)-1,b>>>=F,v-=F),v<15&&(b+=C[l++]<<v,v+=8,b+=C[l++]<<v,v+=8),P=T[b&R];i:for(;;){if(b>>>=F=P>>>24,v-=F,!(16&(F=P>>>16&255))){if(!(64&F)){P=T[(65535&P)+(b&(1<<F)-1)];continue i}r.msg="invalid distance code",a.mode=30;break t}if(D=65535&P,v<(F&=15)&&(b+=C[l++]<<v,(v+=8)<F&&(b+=C[l++]<<v,v+=8)),f<(D+=b&(1<<F)-1)){r.msg="invalid distance too far back",a.mode=30;break t}if(b>>>=F,v-=F,(F=h-d)<D){if(m<(F=D-F)&&a.sane){r.msg="invalid distance too far back",a.mode=30;break t}if(L=g,(w=0)===E){if(w+=p-F,F<x){for(x-=F;U[h++]=g[w++],--F;);w=h-D,L=U}}else if(E<F){if(w+=p+E-F,(F-=E)<x){for(x-=F;U[h++]=g[w++],--F;);if(w=0,E<x){for(x-=F=E;U[h++]=g[w++],--F;);w=h-D,L=U}}}else if(w+=E-F,F<x){for(x-=F;U[h++]=g[w++],--F;);w=h-D,L=U}for(;2<x;)U[h++]=L[w++],U[h++]=L[w++],U[h++]=L[w++],x-=3;x&&(U[h++]=L[w++],1<x&&(U[h++]=L[w++]))}else{for(w=h-D;U[h++]=U[w++],U[h++]=U[w++],U[h++]=U[w++],2<(x-=3););x&&(U[h++]=U[w++],1<x&&(U[h++]=U[w++]))}break}}break}}while(l<c&&h<u);l-=x=v>>3,b&=(1<<(v-=x<<3))-1,r.next_in=l,r.next_out=h,r.avail_in=l<c?c-l+5:5-(l-c),r.avail_out=h<u?u-h+257:257-(h-u),a.hold=b,a.bits=v}},{}],49:[function(t,i,s){var r=t("../utils/common"),o=t("./adler32"),a=t("./crc32"),l=t("./inffast"),c=t("./inftrees"),h=1,d=2,u=0,f=-2,p=1,m=852,E=592;function g(w){return(w>>>24&255)+(w>>>8&65280)+((65280&w)<<8)+((255&w)<<24)}function b(){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 r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function v(w){var L;return w&&w.state?(L=w.state,w.total_in=w.total_out=L.total=0,w.msg="",L.wrap&&(w.adler=1&L.wrap),L.mode=p,L.last=0,L.havedict=0,L.dmax=32768,L.head=null,L.hold=0,L.bits=0,L.lencode=L.lendyn=new r.Buf32(m),L.distcode=L.distdyn=new r.Buf32(E),L.sane=1,L.back=-1,u):f}function I(w){var L;return w&&w.state?((L=w.state).wsize=0,L.whave=0,L.wnext=0,v(w)):f}function T(w,L){var C,U;return w&&w.state?(U=w.state,L<0?(C=0,L=-L):(C=1+(L>>4),L<48&&(L&=15)),L&&(L<8||15<L)?f:(U.window!==null&&U.wbits!==L&&(U.window=null),U.wrap=C,U.wbits=L,I(w))):f}function A(w,L){var C,U;return w?(U=new b,(w.state=U).window=null,(C=T(w,L))!==u&&(w.state=null),C):f}var R,P,F=!0;function x(w){if(F){var L;for(R=new r.Buf32(512),P=new r.Buf32(32),L=0;L<144;)w.lens[L++]=8;for(;L<256;)w.lens[L++]=9;for(;L<280;)w.lens[L++]=7;for(;L<288;)w.lens[L++]=8;for(c(h,w.lens,0,288,R,0,w.work,{bits:9}),L=0;L<32;)w.lens[L++]=5;c(d,w.lens,0,32,P,0,w.work,{bits:5}),F=!1}w.lencode=R,w.lenbits=9,w.distcode=P,w.distbits=5}function D(w,L,C,U){var Z,H=w.state;return H.window===null&&(H.wsize=1<<H.wbits,H.wnext=0,H.whave=0,H.window=new r.Buf8(H.wsize)),U>=H.wsize?(r.arraySet(H.window,L,C-H.wsize,H.wsize,0),H.wnext=0,H.whave=H.wsize):(U<(Z=H.wsize-H.wnext)&&(Z=U),r.arraySet(H.window,L,C-U,Z,H.wnext),(U-=Z)?(r.arraySet(H.window,L,C-U,U,0),H.wnext=U,H.whave=H.wsize):(H.wnext+=Z,H.wnext===H.wsize&&(H.wnext=0),H.whave<H.wsize&&(H.whave+=Z))),0}s.inflateReset=I,s.inflateReset2=T,s.inflateResetKeep=v,s.inflateInit=function(w){return A(w,15)},s.inflateInit2=A,s.inflate=function(w,L){var C,U,Z,H,st,Y,ot,V,B,at,nt,it,At,xt,lt,pt,ft,Ct,qt,zt,_,j,$,N,O=0,k=new r.Buf8(4),X=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!w||!w.state||!w.output||!w.input&&w.avail_in!==0)return f;(C=w.state).mode===12&&(C.mode=13),st=w.next_out,Z=w.output,ot=w.avail_out,H=w.next_in,U=w.input,Y=w.avail_in,V=C.hold,B=C.bits,at=Y,nt=ot,j=u;t:for(;;)switch(C.mode){case p:if(C.wrap===0){C.mode=13;break}for(;B<16;){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}if(2&C.wrap&&V===35615){k[C.check=0]=255&V,k[1]=V>>>8&255,C.check=a(C.check,k,2,0),B=V=0,C.mode=2;break}if(C.flags=0,C.head&&(C.head.done=!1),!(1&C.wrap)||(((255&V)<<8)+(V>>8))%31){w.msg="incorrect header check",C.mode=30;break}if((15&V)!=8){w.msg="unknown compression method",C.mode=30;break}if(B-=4,_=8+(15&(V>>>=4)),C.wbits===0)C.wbits=_;else if(_>C.wbits){w.msg="invalid window size",C.mode=30;break}C.dmax=1<<_,w.adler=C.check=1,C.mode=512&V?10:12,B=V=0;break;case 2:for(;B<16;){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}if(C.flags=V,(255&C.flags)!=8){w.msg="unknown compression method",C.mode=30;break}if(57344&C.flags){w.msg="unknown header flags set",C.mode=30;break}C.head&&(C.head.text=V>>8&1),512&C.flags&&(k[0]=255&V,k[1]=V>>>8&255,C.check=a(C.check,k,2,0)),B=V=0,C.mode=3;case 3:for(;B<32;){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}C.head&&(C.head.time=V),512&C.flags&&(k[0]=255&V,k[1]=V>>>8&255,k[2]=V>>>16&255,k[3]=V>>>24&255,C.check=a(C.check,k,4,0)),B=V=0,C.mode=4;case 4:for(;B<16;){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}C.head&&(C.head.xflags=255&V,C.head.os=V>>8),512&C.flags&&(k[0]=255&V,k[1]=V>>>8&255,C.check=a(C.check,k,2,0)),B=V=0,C.mode=5;case 5:if(1024&C.flags){for(;B<16;){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}C.length=V,C.head&&(C.head.extra_len=V),512&C.flags&&(k[0]=255&V,k[1]=V>>>8&255,C.check=a(C.check,k,2,0)),B=V=0}else C.head&&(C.head.extra=null);C.mode=6;case 6:if(1024&C.flags&&(Y<(it=C.length)&&(it=Y),it&&(C.head&&(_=C.head.extra_len-C.length,C.head.extra||(C.head.extra=new Array(C.head.extra_len)),r.arraySet(C.head.extra,U,H,it,_)),512&C.flags&&(C.check=a(C.check,U,it,H)),Y-=it,H+=it,C.length-=it),C.length))break t;C.length=0,C.mode=7;case 7:if(2048&C.flags){if(Y===0)break t;for(it=0;_=U[H+it++],C.head&&_&&C.length<65536&&(C.head.name+=String.fromCharCode(_)),_&&it<Y;);if(512&C.flags&&(C.check=a(C.check,U,it,H)),Y-=it,H+=it,_)break t}else C.head&&(C.head.name=null);C.length=0,C.mode=8;case 8:if(4096&C.flags){if(Y===0)break t;for(it=0;_=U[H+it++],C.head&&_&&C.length<65536&&(C.head.comment+=String.fromCharCode(_)),_&&it<Y;);if(512&C.flags&&(C.check=a(C.check,U,it,H)),Y-=it,H+=it,_)break t}else C.head&&(C.head.comment=null);C.mode=9;case 9:if(512&C.flags){for(;B<16;){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}if(V!==(65535&C.check)){w.msg="header crc mismatch",C.mode=30;break}B=V=0}C.head&&(C.head.hcrc=C.flags>>9&1,C.head.done=!0),w.adler=C.check=0,C.mode=12;break;case 10:for(;B<32;){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}w.adler=C.check=g(V),B=V=0,C.mode=11;case 11:if(C.havedict===0)return w.next_out=st,w.avail_out=ot,w.next_in=H,w.avail_in=Y,C.hold=V,C.bits=B,2;w.adler=C.check=1,C.mode=12;case 12:if(L===5||L===6)break t;case 13:if(C.last){V>>>=7&B,B-=7&B,C.mode=27;break}for(;B<3;){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}switch(C.last=1&V,B-=1,3&(V>>>=1)){case 0:C.mode=14;break;case 1:if(x(C),C.mode=20,L!==6)break;V>>>=2,B-=2;break t;case 2:C.mode=17;break;case 3:w.msg="invalid block type",C.mode=30}V>>>=2,B-=2;break;case 14:for(V>>>=7&B,B-=7&B;B<32;){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}if((65535&V)!=(V>>>16^65535)){w.msg="invalid stored block lengths",C.mode=30;break}if(C.length=65535&V,B=V=0,C.mode=15,L===6)break t;case 15:C.mode=16;case 16:if(it=C.length){if(Y<it&&(it=Y),ot<it&&(it=ot),it===0)break t;r.arraySet(Z,U,H,it,st),Y-=it,H+=it,ot-=it,st+=it,C.length-=it;break}C.mode=12;break;case 17:for(;B<14;){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}if(C.nlen=257+(31&V),V>>>=5,B-=5,C.ndist=1+(31&V),V>>>=5,B-=5,C.ncode=4+(15&V),V>>>=4,B-=4,286<C.nlen||30<C.ndist){w.msg="too many length or distance symbols",C.mode=30;break}C.have=0,C.mode=18;case 18:for(;C.have<C.ncode;){for(;B<3;){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}C.lens[X[C.have++]]=7&V,V>>>=3,B-=3}for(;C.have<19;)C.lens[X[C.have++]]=0;if(C.lencode=C.lendyn,C.lenbits=7,$={bits:C.lenbits},j=c(0,C.lens,0,19,C.lencode,0,C.work,$),C.lenbits=$.bits,j){w.msg="invalid code lengths set",C.mode=30;break}C.have=0,C.mode=19;case 19:for(;C.have<C.nlen+C.ndist;){for(;pt=(O=C.lencode[V&(1<<C.lenbits)-1])>>>16&255,ft=65535&O,!((lt=O>>>24)<=B);){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}if(ft<16)V>>>=lt,B-=lt,C.lens[C.have++]=ft;else{if(ft===16){for(N=lt+2;B<N;){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}if(V>>>=lt,B-=lt,C.have===0){w.msg="invalid bit length repeat",C.mode=30;break}_=C.lens[C.have-1],it=3+(3&V),V>>>=2,B-=2}else if(ft===17){for(N=lt+3;B<N;){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}B-=lt,_=0,it=3+(7&(V>>>=lt)),V>>>=3,B-=3}else{for(N=lt+7;B<N;){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}B-=lt,_=0,it=11+(127&(V>>>=lt)),V>>>=7,B-=7}if(C.have+it>C.nlen+C.ndist){w.msg="invalid bit length repeat",C.mode=30;break}for(;it--;)C.lens[C.have++]=_}}if(C.mode===30)break;if(C.lens[256]===0){w.msg="invalid code -- missing end-of-block",C.mode=30;break}if(C.lenbits=9,$={bits:C.lenbits},j=c(h,C.lens,0,C.nlen,C.lencode,0,C.work,$),C.lenbits=$.bits,j){w.msg="invalid literal/lengths set",C.mode=30;break}if(C.distbits=6,C.distcode=C.distdyn,$={bits:C.distbits},j=c(d,C.lens,C.nlen,C.ndist,C.distcode,0,C.work,$),C.distbits=$.bits,j){w.msg="invalid distances set",C.mode=30;break}if(C.mode=20,L===6)break t;case 20:C.mode=21;case 21:if(6<=Y&&258<=ot){w.next_out=st,w.avail_out=ot,w.next_in=H,w.avail_in=Y,C.hold=V,C.bits=B,l(w,nt),st=w.next_out,Z=w.output,ot=w.avail_out,H=w.next_in,U=w.input,Y=w.avail_in,V=C.hold,B=C.bits,C.mode===12&&(C.back=-1);break}for(C.back=0;pt=(O=C.lencode[V&(1<<C.lenbits)-1])>>>16&255,ft=65535&O,!((lt=O>>>24)<=B);){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}if(pt&&!(240&pt)){for(Ct=lt,qt=pt,zt=ft;pt=(O=C.lencode[zt+((V&(1<<Ct+qt)-1)>>Ct)])>>>16&255,ft=65535&O,!(Ct+(lt=O>>>24)<=B);){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}V>>>=Ct,B-=Ct,C.back+=Ct}if(V>>>=lt,B-=lt,C.back+=lt,C.length=ft,pt===0){C.mode=26;break}if(32&pt){C.back=-1,C.mode=12;break}if(64&pt){w.msg="invalid literal/length code",C.mode=30;break}C.extra=15&pt,C.mode=22;case 22:if(C.extra){for(N=C.extra;B<N;){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}C.length+=V&(1<<C.extra)-1,V>>>=C.extra,B-=C.extra,C.back+=C.extra}C.was=C.length,C.mode=23;case 23:for(;pt=(O=C.distcode[V&(1<<C.distbits)-1])>>>16&255,ft=65535&O,!((lt=O>>>24)<=B);){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}if(!(240&pt)){for(Ct=lt,qt=pt,zt=ft;pt=(O=C.distcode[zt+((V&(1<<Ct+qt)-1)>>Ct)])>>>16&255,ft=65535&O,!(Ct+(lt=O>>>24)<=B);){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}V>>>=Ct,B-=Ct,C.back+=Ct}if(V>>>=lt,B-=lt,C.back+=lt,64&pt){w.msg="invalid distance code",C.mode=30;break}C.offset=ft,C.extra=15&pt,C.mode=24;case 24:if(C.extra){for(N=C.extra;B<N;){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}C.offset+=V&(1<<C.extra)-1,V>>>=C.extra,B-=C.extra,C.back+=C.extra}if(C.offset>C.dmax){w.msg="invalid distance too far back",C.mode=30;break}C.mode=25;case 25:if(ot===0)break t;if(it=nt-ot,C.offset>it){if((it=C.offset-it)>C.whave&&C.sane){w.msg="invalid distance too far back",C.mode=30;break}At=it>C.wnext?(it-=C.wnext,C.wsize-it):C.wnext-it,it>C.length&&(it=C.length),xt=C.window}else xt=Z,At=st-C.offset,it=C.length;for(ot<it&&(it=ot),ot-=it,C.length-=it;Z[st++]=xt[At++],--it;);C.length===0&&(C.mode=21);break;case 26:if(ot===0)break t;Z[st++]=C.length,ot--,C.mode=21;break;case 27:if(C.wrap){for(;B<32;){if(Y===0)break t;Y--,V|=U[H++]<<B,B+=8}if(nt-=ot,w.total_out+=nt,C.total+=nt,nt&&(w.adler=C.check=C.flags?a(C.check,Z,nt,st-nt):o(C.check,Z,nt,st-nt)),nt=ot,(C.flags?V:g(V))!==C.check){w.msg="incorrect data check",C.mode=30;break}B=V=0}C.mode=28;case 28:if(C.wrap&&C.flags){for(;B<32;){if(Y===0)break t;Y--,V+=U[H++]<<B,B+=8}if(V!==(4294967295&C.total)){w.msg="incorrect length check",C.mode=30;break}B=V=0}C.mode=29;case 29:j=1;break t;case 30:j=-3;break t;case 31:return-4;case 32:default:return f}return w.next_out=st,w.avail_out=ot,w.next_in=H,w.avail_in=Y,C.hold=V,C.bits=B,(C.wsize||nt!==w.avail_out&&C.mode<30&&(C.mode<27||L!==4))&&D(w,w.output,w.next_out,nt-w.avail_out)?(C.mode=31,-4):(at-=w.avail_in,nt-=w.avail_out,w.total_in+=at,w.total_out+=nt,C.total+=nt,C.wrap&&nt&&(w.adler=C.check=C.flags?a(C.check,Z,nt,w.next_out-nt):o(C.check,Z,nt,w.next_out-nt)),w.data_type=C.bits+(C.last?64:0)+(C.mode===12?128:0)+(C.mode===20||C.mode===15?256:0),(at==0&&nt===0||L===4)&&j===u&&(j=-5),j)},s.inflateEnd=function(w){if(!w||!w.state)return f;var L=w.state;return L.window&&(L.window=null),w.state=null,u},s.inflateGetHeader=function(w,L){var C;return w&&w.state&&2&(C=w.state).wrap?((C.head=L).done=!1,u):f},s.inflateSetDictionary=function(w,L){var C,U=L.length;return w&&w.state?(C=w.state).wrap!==0&&C.mode!==11?f:C.mode===11&&o(1,L,U,0)!==C.check?-3:D(w,L,U,U)?(C.mode=31,-4):(C.havedict=1,u):f},s.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,i,s){var r=t("../utils/common"),o=[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],a=[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],l=[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],c=[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];i.exports=function(h,d,u,f,p,m,E,g){var b,v,I,T,A,R,P,F,x,D=g.bits,w=0,L=0,C=0,U=0,Z=0,H=0,st=0,Y=0,ot=0,V=0,B=null,at=0,nt=new r.Buf16(16),it=new r.Buf16(16),At=null,xt=0;for(w=0;w<=15;w++)nt[w]=0;for(L=0;L<f;L++)nt[d[u+L]]++;for(Z=D,U=15;1<=U&&nt[U]===0;U--);if(U<Z&&(Z=U),U===0)return p[m++]=20971520,p[m++]=20971520,g.bits=1,0;for(C=1;C<U&&nt[C]===0;C++);for(Z<C&&(Z=C),w=Y=1;w<=15;w++)if(Y<<=1,(Y-=nt[w])<0)return-1;if(0<Y&&(h===0||U!==1))return-1;for(it[1]=0,w=1;w<15;w++)it[w+1]=it[w]+nt[w];for(L=0;L<f;L++)d[u+L]!==0&&(E[it[d[u+L]]++]=L);if(R=h===0?(B=At=E,19):h===1?(B=o,at-=257,At=a,xt-=257,256):(B=l,At=c,-1),w=C,A=m,st=L=V=0,I=-1,T=(ot=1<<(H=Z))-1,h===1&&852<ot||h===2&&592<ot)return 1;for(;;){for(P=w-st,x=E[L]<R?(F=0,E[L]):E[L]>R?(F=At[xt+E[L]],B[at+E[L]]):(F=96,0),b=1<<w-st,C=v=1<<H;p[A+(V>>st)+(v-=b)]=P<<24|F<<16|x|0,v!==0;);for(b=1<<w-1;V&b;)b>>=1;if(b!==0?(V&=b-1,V+=b):V=0,L++,--nt[w]==0){if(w===U)break;w=d[u+E[L]]}if(Z<w&&(V&T)!==I){for(st===0&&(st=Z),A+=C,Y=1<<(H=w-st);H+st<U&&!((Y-=nt[H+st])<=0);)H++,Y<<=1;if(ot+=1<<H,h===1&&852<ot||h===2&&592<ot)return 1;p[I=V&T]=Z<<24|H<<16|A-m|0}}return V!==0&&(p[A+V]=w-st<<24|64<<16|0),g.bits=Z,0}},{"../utils/common":41}],51:[function(t,i,s){i.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,i,s){var r=t("../utils/common"),o=0,a=1;function l(O){for(var k=O.length;0<=--k;)O[k]=0}var c=0,h=29,d=256,u=d+1+h,f=30,p=19,m=2*u+1,E=15,g=16,b=7,v=256,I=16,T=17,A=18,R=[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],P=[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],F=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],x=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],D=new Array(2*(u+2));l(D);var w=new Array(2*f);l(w);var L=new Array(512);l(L);var C=new Array(256);l(C);var U=new Array(h);l(U);var Z,H,st,Y=new Array(f);function ot(O,k,X,q,z){this.static_tree=O,this.extra_bits=k,this.extra_base=X,this.elems=q,this.max_length=z,this.has_stree=O&&O.length}function V(O,k){this.dyn_tree=O,this.max_code=0,this.stat_desc=k}function B(O){return O<256?L[O]:L[256+(O>>>7)]}function at(O,k){O.pending_buf[O.pending++]=255&k,O.pending_buf[O.pending++]=k>>>8&255}function nt(O,k,X){O.bi_valid>g-X?(O.bi_buf|=k<<O.bi_valid&65535,at(O,O.bi_buf),O.bi_buf=k>>g-O.bi_valid,O.bi_valid+=X-g):(O.bi_buf|=k<<O.bi_valid&65535,O.bi_valid+=X)}function it(O,k,X){nt(O,X[2*k],X[2*k+1])}function At(O,k){for(var X=0;X|=1&O,O>>>=1,X<<=1,0<--k;);return X>>>1}function xt(O,k,X){var q,z,J=new Array(E+1),rt=0;for(q=1;q<=E;q++)J[q]=rt=rt+X[q-1]<<1;for(z=0;z<=k;z++){var et=O[2*z+1];et!==0&&(O[2*z]=At(J[et]++,et))}}function lt(O){var k;for(k=0;k<u;k++)O.dyn_ltree[2*k]=0;for(k=0;k<f;k++)O.dyn_dtree[2*k]=0;for(k=0;k<p;k++)O.bl_tree[2*k]=0;O.dyn_ltree[2*v]=1,O.opt_len=O.static_len=0,O.last_lit=O.matches=0}function pt(O){8<O.bi_valid?at(O,O.bi_buf):0<O.bi_valid&&(O.pending_buf[O.pending++]=O.bi_buf),O.bi_buf=0,O.bi_valid=0}function ft(O,k,X,q){var z=2*k,J=2*X;return O[z]<O[J]||O[z]===O[J]&&q[k]<=q[X]}function Ct(O,k,X){for(var q=O.heap[X],z=X<<1;z<=O.heap_len&&(z<O.heap_len&&ft(k,O.heap[z+1],O.heap[z],O.depth)&&z++,!ft(k,q,O.heap[z],O.depth));)O.heap[X]=O.heap[z],X=z,z<<=1;O.heap[X]=q}function qt(O,k,X){var q,z,J,rt,et=0;if(O.last_lit!==0)for(;q=O.pending_buf[O.d_buf+2*et]<<8|O.pending_buf[O.d_buf+2*et+1],z=O.pending_buf[O.l_buf+et],et++,q===0?it(O,z,k):(it(O,(J=C[z])+d+1,k),(rt=R[J])!==0&&nt(O,z-=U[J],rt),it(O,J=B(--q),X),(rt=P[J])!==0&&nt(O,q-=Y[J],rt)),et<O.last_lit;);it(O,v,k)}function zt(O,k){var X,q,z,J=k.dyn_tree,rt=k.stat_desc.static_tree,et=k.stat_desc.has_stree,ct=k.stat_desc.elems,Tt=-1;for(O.heap_len=0,O.heap_max=m,X=0;X<ct;X++)J[2*X]!==0?(O.heap[++O.heap_len]=Tt=X,O.depth[X]=0):J[2*X+1]=0;for(;O.heap_len<2;)J[2*(z=O.heap[++O.heap_len]=Tt<2?++Tt:0)]=1,O.depth[z]=0,O.opt_len--,et&&(O.static_len-=rt[2*z+1]);for(k.max_code=Tt,X=O.heap_len>>1;1<=X;X--)Ct(O,J,X);for(z=ct;X=O.heap[1],O.heap[1]=O.heap[O.heap_len--],Ct(O,J,1),q=O.heap[1],O.heap[--O.heap_max]=X,O.heap[--O.heap_max]=q,J[2*z]=J[2*X]+J[2*q],O.depth[z]=(O.depth[X]>=O.depth[q]?O.depth[X]:O.depth[q])+1,J[2*X+1]=J[2*q+1]=z,O.heap[1]=z++,Ct(O,J,1),2<=O.heap_len;);O.heap[--O.heap_max]=O.heap[1],function(mt,Qt){var rs,me,os,Nt,hn,Qr,ve=Qt.dyn_tree,Ma=Qt.max_code,kd=Qt.stat_desc.static_tree,Bd=Qt.stat_desc.has_stree,zd=Qt.stat_desc.extra_bits,Da=Qt.stat_desc.extra_base,as=Qt.stat_desc.max_length,dn=0;for(Nt=0;Nt<=E;Nt++)mt.bl_count[Nt]=0;for(ve[2*mt.heap[mt.heap_max]+1]=0,rs=mt.heap_max+1;rs<m;rs++)as<(Nt=ve[2*ve[2*(me=mt.heap[rs])+1]+1]+1)&&(Nt=as,dn++),ve[2*me+1]=Nt,Ma<me||(mt.bl_count[Nt]++,hn=0,Da<=me&&(hn=zd[me-Da]),Qr=ve[2*me],mt.opt_len+=Qr*(Nt+hn),Bd&&(mt.static_len+=Qr*(kd[2*me+1]+hn)));if(dn!==0){do{for(Nt=as-1;mt.bl_count[Nt]===0;)Nt--;mt.bl_count[Nt]--,mt.bl_count[Nt+1]+=2,mt.bl_count[as]--,dn-=2}while(0<dn);for(Nt=as;Nt!==0;Nt--)for(me=mt.bl_count[Nt];me!==0;)Ma<(os=mt.heap[--rs])||(ve[2*os+1]!==Nt&&(mt.opt_len+=(Nt-ve[2*os+1])*ve[2*os],ve[2*os+1]=Nt),me--)}}(O,k),xt(J,Tt,O.bl_count)}function _(O,k,X){var q,z,J=-1,rt=k[1],et=0,ct=7,Tt=4;for(rt===0&&(ct=138,Tt=3),k[2*(X+1)+1]=65535,q=0;q<=X;q++)z=rt,rt=k[2*(q+1)+1],++et<ct&&z===rt||(et<Tt?O.bl_tree[2*z]+=et:z!==0?(z!==J&&O.bl_tree[2*z]++,O.bl_tree[2*I]++):et<=10?O.bl_tree[2*T]++:O.bl_tree[2*A]++,J=z,Tt=(et=0)===rt?(ct=138,3):z===rt?(ct=6,3):(ct=7,4))}function j(O,k,X){var q,z,J=-1,rt=k[1],et=0,ct=7,Tt=4;for(rt===0&&(ct=138,Tt=3),q=0;q<=X;q++)if(z=rt,rt=k[2*(q+1)+1],!(++et<ct&&z===rt)){if(et<Tt)for(;it(O,z,O.bl_tree),--et!=0;);else z!==0?(z!==J&&(it(O,z,O.bl_tree),et--),it(O,I,O.bl_tree),nt(O,et-3,2)):et<=10?(it(O,T,O.bl_tree),nt(O,et-3,3)):(it(O,A,O.bl_tree),nt(O,et-11,7));J=z,Tt=(et=0)===rt?(ct=138,3):z===rt?(ct=6,3):(ct=7,4)}}l(Y);var $=!1;function N(O,k,X,q){nt(O,(c<<1)+(q?1:0),3),function(z,J,rt,et){pt(z),at(z,rt),at(z,~rt),r.arraySet(z.pending_buf,z.window,J,rt,z.pending),z.pending+=rt}(O,k,X)}s._tr_init=function(O){$||(function(){var k,X,q,z,J,rt=new Array(E+1);for(z=q=0;z<h-1;z++)for(U[z]=q,k=0;k<1<<R[z];k++)C[q++]=z;for(C[q-1]=z,z=J=0;z<16;z++)for(Y[z]=J,k=0;k<1<<P[z];k++)L[J++]=z;for(J>>=7;z<f;z++)for(Y[z]=J<<7,k=0;k<1<<P[z]-7;k++)L[256+J++]=z;for(X=0;X<=E;X++)rt[X]=0;for(k=0;k<=143;)D[2*k+1]=8,k++,rt[8]++;for(;k<=255;)D[2*k+1]=9,k++,rt[9]++;for(;k<=279;)D[2*k+1]=7,k++,rt[7]++;for(;k<=287;)D[2*k+1]=8,k++,rt[8]++;for(xt(D,u+1,rt),k=0;k<f;k++)w[2*k+1]=5,w[2*k]=At(k,5);Z=new ot(D,R,d+1,u,E),H=new ot(w,P,0,f,E),st=new ot(new Array(0),F,0,p,b)}(),$=!0),O.l_desc=new V(O.dyn_ltree,Z),O.d_desc=new V(O.dyn_dtree,H),O.bl_desc=new V(O.bl_tree,st),O.bi_buf=0,O.bi_valid=0,lt(O)},s._tr_stored_block=N,s._tr_flush_block=function(O,k,X,q){var z,J,rt=0;0<O.level?(O.strm.data_type===2&&(O.strm.data_type=function(et){var ct,Tt=4093624447;for(ct=0;ct<=31;ct++,Tt>>>=1)if(1&Tt&&et.dyn_ltree[2*ct]!==0)return o;if(et.dyn_ltree[18]!==0||et.dyn_ltree[20]!==0||et.dyn_ltree[26]!==0)return a;for(ct=32;ct<d;ct++)if(et.dyn_ltree[2*ct]!==0)return a;return o}(O)),zt(O,O.l_desc),zt(O,O.d_desc),rt=function(et){var ct;for(_(et,et.dyn_ltree,et.l_desc.max_code),_(et,et.dyn_dtree,et.d_desc.max_code),zt(et,et.bl_desc),ct=p-1;3<=ct&&et.bl_tree[2*x[ct]+1]===0;ct--);return et.opt_len+=3*(ct+1)+5+5+4,ct}(O),z=O.opt_len+3+7>>>3,(J=O.static_len+3+7>>>3)<=z&&(z=J)):z=J=X+5,X+4<=z&&k!==-1?N(O,k,X,q):O.strategy===4||J===z?(nt(O,2+(q?1:0),3),qt(O,D,w)):(nt(O,4+(q?1:0),3),function(et,ct,Tt,mt){var Qt;for(nt(et,ct-257,5),nt(et,Tt-1,5),nt(et,mt-4,4),Qt=0;Qt<mt;Qt++)nt(et,et.bl_tree[2*x[Qt]+1],3);j(et,et.dyn_ltree,ct-1),j(et,et.dyn_dtree,Tt-1)}(O,O.l_desc.max_code+1,O.d_desc.max_code+1,rt+1),qt(O,O.dyn_ltree,O.dyn_dtree)),lt(O),q&&pt(O)},s._tr_tally=function(O,k,X){return O.pending_buf[O.d_buf+2*O.last_lit]=k>>>8&255,O.pending_buf[O.d_buf+2*O.last_lit+1]=255&k,O.pending_buf[O.l_buf+O.last_lit]=255&X,O.last_lit++,k===0?O.dyn_ltree[2*X]++:(O.matches++,k--,O.dyn_ltree[2*(C[X]+d+1)]++,O.dyn_dtree[2*B(k)]++),O.last_lit===O.lit_bufsize-1},s._tr_align=function(O){nt(O,2,3),it(O,v,D),function(k){k.bi_valid===16?(at(k,k.bi_buf),k.bi_buf=0,k.bi_valid=0):8<=k.bi_valid&&(k.pending_buf[k.pending++]=255&k.bi_buf,k.bi_buf>>=8,k.bi_valid-=8)}(O)}},{"../utils/common":41}],53:[function(t,i,s){i.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,i,s){(function(r){(function(o,a){if(!o.setImmediate){var l,c,h,d,u=1,f={},p=!1,m=o.document,E=Object.getPrototypeOf&&Object.getPrototypeOf(o);E=E&&E.setTimeout?E:o,l={}.toString.call(o.process)==="[object process]"?function(I){process.nextTick(function(){b(I)})}:function(){if(o.postMessage&&!o.importScripts){var I=!0,T=o.onmessage;return o.onmessage=function(){I=!1},o.postMessage("","*"),o.onmessage=T,I}}()?(d="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",v,!1):o.attachEvent("onmessage",v),function(I){o.postMessage(d+I,"*")}):o.MessageChannel?((h=new MessageChannel).port1.onmessage=function(I){b(I.data)},function(I){h.port2.postMessage(I)}):m&&"onreadystatechange"in m.createElement("script")?(c=m.documentElement,function(I){var T=m.createElement("script");T.onreadystatechange=function(){b(I),T.onreadystatechange=null,c.removeChild(T),T=null},c.appendChild(T)}):function(I){setTimeout(b,0,I)},E.setImmediate=function(I){typeof I!="function"&&(I=new Function(""+I));for(var T=new Array(arguments.length-1),A=0;A<T.length;A++)T[A]=arguments[A+1];var R={callback:I,args:T};return f[u]=R,l(u),u++},E.clearImmediate=g}function g(I){delete f[I]}function b(I){if(p)setTimeout(b,0,I);else{var T=f[I];if(T){p=!0;try{(function(A){var R=A.callback,P=A.args;switch(P.length){case 0:R();break;case 1:R(P[0]);break;case 2:R(P[0],P[1]);break;case 3:R(P[0],P[1],P[2]);break;default:R.apply(a,P)}})(T)}finally{g(I),p=!1}}}}function v(I){I.source===o&&typeof I.data=="string"&&I.data.indexOf(d)===0&&b(+I.data.slice(d.length))}})(typeof self>"u"?r===void 0?this:r:self)}).call(this,typeof Mn<"u"?Mn:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})($c);var vf=$c.exports;const bl=Tf(vf);var pa={},Lr={};(function(n){const e=":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=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",i="["+e+"]["+t+"]*",s=new RegExp("^"+i+"$"),r=function(a,l){const c=[];let h=l.exec(a);for(;h;){const d=[];d.startIndex=l.lastIndex-h[0].length;const u=h.length;for(let f=0;f<u;f++)d.push(h[f]);c.push(d),h=l.exec(a)}return c},o=function(a){const l=s.exec(a);return!(l===null||typeof l>"u")};n.isExist=function(a){return typeof a<"u"},n.isEmptyObject=function(a){return Object.keys(a).length===0},n.merge=function(a,l,c){if(l){const h=Object.keys(l),d=h.length;for(let u=0;u<d;u++)c==="strict"?a[h[u]]=[l[h[u]]]:a[h[u]]=l[h[u]]}},n.getValue=function(a){return n.isExist(a)?a:""},n.isName=o,n.getAllMatches=r,n.nameRegexp=i})(Lr);const ma=Lr,wf={allowBooleanAttributes:!1,unpairedTags:[]};pa.validate=function(n,e){e=Object.assign({},wf,e);const t=[];let i=!1,s=!1;n[0]==="\uFEFF"&&(n=n.substr(1));for(let r=0;r<n.length;r++)if(n[r]==="<"&&n[r+1]==="?"){if(r+=2,r=yl(n,r),r.err)return r}else if(n[r]==="<"){let o=r;if(r++,n[r]==="!"){r=_l(n,r);continue}else{let a=!1;n[r]==="/"&&(a=!0,r++);let l="";for(;r<n.length&&n[r]!==">"&&n[r]!==" "&&n[r]!==" "&&n[r]!==`
140
- `&&n[r]!=="\r";r++)l+=n[r];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),r--),!Pf(l)){let d;return l.trim().length===0?d="Invalid space after '<'.":d="Tag '"+l+"' is an invalid name.",Lt("InvalidTag",d,Ht(n,r))}const c=Sf(n,r);if(c===!1)return Lt("InvalidAttr","Attributes for '"+l+"' have open quote.",Ht(n,r));let h=c.value;if(r=c.index,h[h.length-1]==="/"){const d=r-h.length;h=h.substring(0,h.length-1);const u=Tl(h,e);if(u===!0)i=!0;else return Lt(u.err.code,u.err.msg,Ht(n,d+u.err.line))}else if(a)if(c.tagClosed){if(h.trim().length>0)return Lt("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",Ht(n,o));if(t.length===0)return Lt("InvalidTag","Closing tag '"+l+"' has not been opened.",Ht(n,o));{const d=t.pop();if(l!==d.tagName){let u=Ht(n,d.tagStartPos);return Lt("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+u.line+", col "+u.col+") instead of closing tag '"+l+"'.",Ht(n,o))}t.length==0&&(s=!0)}}else return Lt("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",Ht(n,r));else{const d=Tl(h,e);if(d!==!0)return Lt(d.err.code,d.err.msg,Ht(n,r-h.length+d.err.line));if(s===!0)return Lt("InvalidXml","Multiple possible root nodes found.",Ht(n,r));e.unpairedTags.indexOf(l)!==-1||t.push({tagName:l,tagStartPos:o}),i=!0}for(r++;r<n.length;r++)if(n[r]==="<")if(n[r+1]==="!"){r++,r=_l(n,r);continue}else if(n[r+1]==="?"){if(r=yl(n,++r),r.err)return r}else break;else if(n[r]==="&"){const d=xf(n,r);if(d==-1)return Lt("InvalidChar","char '&' is not expected.",Ht(n,r));r=d}else if(s===!0&&!Cl(n[r]))return Lt("InvalidXml","Extra text at the end",Ht(n,r));n[r]==="<"&&r--}}else{if(Cl(n[r]))continue;return Lt("InvalidChar","char '"+n[r]+"' is not expected.",Ht(n,r))}if(i){if(t.length==1)return Lt("InvalidTag","Unclosed tag '"+t[0].tagName+"'.",Ht(n,t[0].tagStartPos));if(t.length>0)return Lt("InvalidXml","Invalid '"+JSON.stringify(t.map(r=>r.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Lt("InvalidXml","Start tag expected.",1);return!0};function Cl(n){return n===" "||n===" "||n===`
141
- `||n==="\r"}function yl(n,e){const t=e;for(;e<n.length;e++)if(n[e]=="?"||n[e]==" "){const i=n.substr(t,e-t);if(e>5&&i==="xml")return Lt("InvalidXml","XML declaration allowed only at the start of the document.",Ht(n,e));if(n[e]=="?"&&n[e+1]==">"){e++;break}else continue}return e}function _l(n,e){if(n.length>e+5&&n[e+1]==="-"&&n[e+2]==="-"){for(e+=3;e<n.length;e++)if(n[e]==="-"&&n[e+1]==="-"&&n[e+2]===">"){e+=2;break}}else if(n.length>e+8&&n[e+1]==="D"&&n[e+2]==="O"&&n[e+3]==="C"&&n[e+4]==="T"&&n[e+5]==="Y"&&n[e+6]==="P"&&n[e+7]==="E"){let t=1;for(e+=8;e<n.length;e++)if(n[e]==="<")t++;else if(n[e]===">"&&(t--,t===0))break}else if(n.length>e+9&&n[e+1]==="["&&n[e+2]==="C"&&n[e+3]==="D"&&n[e+4]==="A"&&n[e+5]==="T"&&n[e+6]==="A"&&n[e+7]==="["){for(e+=8;e<n.length;e++)if(n[e]==="]"&&n[e+1]==="]"&&n[e+2]===">"){e+=2;break}}return e}const Af='"',Rf="'";function Sf(n,e){let t="",i="",s=!1;for(;e<n.length;e++){if(n[e]===Af||n[e]===Rf)i===""?i=n[e]:i!==n[e]||(i="");else if(n[e]===">"&&i===""){s=!0;break}t+=n[e]}return i!==""?!1:{value:t,index:e,tagClosed:s}}const Ff=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Tl(n,e){const t=ma.getAllMatches(n,Ff),i={};for(let s=0;s<t.length;s++){if(t[s][1].length===0)return Lt("InvalidAttr","Attribute '"+t[s][2]+"' has no space in starting.",ys(t[s]));if(t[s][3]!==void 0&&t[s][4]===void 0)return Lt("InvalidAttr","Attribute '"+t[s][2]+"' is without value.",ys(t[s]));if(t[s][3]===void 0&&!e.allowBooleanAttributes)return Lt("InvalidAttr","boolean attribute '"+t[s][2]+"' is not allowed.",ys(t[s]));const r=t[s][2];if(!Nf(r))return Lt("InvalidAttr","Attribute '"+r+"' is an invalid name.",ys(t[s]));if(!i.hasOwnProperty(r))i[r]=1;else return Lt("InvalidAttr","Attribute '"+r+"' is repeated.",ys(t[s]))}return!0}function Of(n,e){let t=/\d/;for(n[e]==="x"&&(e++,t=/[\da-fA-F]/);e<n.length;e++){if(n[e]===";")return e;if(!n[e].match(t))break}return-1}function xf(n,e){if(e++,n[e]===";")return-1;if(n[e]==="#")return e++,Of(n,e);let t=0;for(;e<n.length;e++,t++)if(!(n[e].match(/\w/)&&t<20)){if(n[e]===";")break;return-1}return e}function Lt(n,e,t){return{err:{code:n,msg:e,line:t.line||t,col:t.col}}}function Nf(n){return ma.isName(n)}function Pf(n){return ma.isName(n)}function Ht(n,e){const t=n.substring(0,e).split(/\r?\n/);return{line:t.length,col:t[t.length-1].length+1}}function ys(n){return n.startIndex+n[1].length}var ga={};const Hc={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(n,e){return e},attributeValueProcessor:function(n,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(n,e,t){return n}},Lf=function(n){return Object.assign({},Hc,n)};ga.buildOptions=Lf;ga.defaultOptions=Hc;class Mf{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}var Df=Mf;const Uf=Lr;function kf(n,e){const t={};if(n[e+3]==="O"&&n[e+4]==="C"&&n[e+5]==="T"&&n[e+6]==="Y"&&n[e+7]==="P"&&n[e+8]==="E"){e=e+9;let i=1,s=!1,r=!1,o="";for(;e<n.length;e++)if(n[e]==="<"&&!r){if(s&&Vf(n,e))e+=7,[entityName,val,e]=Bf(n,e+1),val.indexOf("&")===-1&&(t[Yf(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(s&&$f(n,e))e+=8;else if(s&&Hf(n,e))e+=8;else if(s&&Gf(n,e))e+=9;else if(zf)r=!0;else throw new Error("Invalid DOCTYPE");i++,o=""}else if(n[e]===">"){if(r?n[e-1]==="-"&&n[e-2]==="-"&&(r=!1,i--):i--,i===0)break}else n[e]==="["?s=!0:o+=n[e];if(i!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:t,i:e}}function Bf(n,e){let t="";for(;e<n.length&&n[e]!=="'"&&n[e]!=='"';e++)t+=n[e];if(t=t.trim(),t.indexOf(" ")!==-1)throw new Error("External entites are not supported");const i=n[e++];let s="";for(;e<n.length&&n[e]!==i;e++)s+=n[e];return[t,s,e]}function zf(n,e){return n[e+1]==="!"&&n[e+2]==="-"&&n[e+3]==="-"}function Vf(n,e){return n[e+1]==="!"&&n[e+2]==="E"&&n[e+3]==="N"&&n[e+4]==="T"&&n[e+5]==="I"&&n[e+6]==="T"&&n[e+7]==="Y"}function $f(n,e){return n[e+1]==="!"&&n[e+2]==="E"&&n[e+3]==="L"&&n[e+4]==="E"&&n[e+5]==="M"&&n[e+6]==="E"&&n[e+7]==="N"&&n[e+8]==="T"}function Hf(n,e){return n[e+1]==="!"&&n[e+2]==="A"&&n[e+3]==="T"&&n[e+4]==="T"&&n[e+5]==="L"&&n[e+6]==="I"&&n[e+7]==="S"&&n[e+8]==="T"}function Gf(n,e){return n[e+1]==="!"&&n[e+2]==="N"&&n[e+3]==="O"&&n[e+4]==="T"&&n[e+5]==="A"&&n[e+6]==="T"&&n[e+7]==="I"&&n[e+8]==="O"&&n[e+9]==="N"}function Yf(n){if(Uf.isName(n))return n;throw new Error(`Invalid entity name ${n}`)}var Wf=kf;const jf=/^[-+]?0x[a-fA-F0-9]+$/,Xf=/^([\-\+])?(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 Zf={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function qf(n,e={}){if(e=Object.assign({},Zf,e),!n||typeof n!="string")return n;let t=n.trim();if(e.skipLike!==void 0&&e.skipLike.test(t))return n;if(e.hex&&jf.test(t))return Number.parseInt(t,16);{const i=Xf.exec(t);if(i){const s=i[1],r=i[2];let o=Qf(i[3]);const a=i[4]||i[6];if(!e.leadingZeros&&r.length>0&&s&&t[2]!==".")return n;if(!e.leadingZeros&&r.length>0&&!s&&t[1]!==".")return n;{const l=Number(t),c=""+l;return c.search(/[eE]/)!==-1||a?e.eNotation?l:n:t.indexOf(".")!==-1?c==="0"&&o===""||c===o||s&&c==="-"+o?l:n:r?o===c||s+o===c?l:n:t===c||t===s+c?l:n}}else return n}}function Qf(n){return n&&n.indexOf(".")!==-1&&(n=n.replace(/0+$/,""),n==="."?n="0":n[0]==="."?n="0"+n:n[n.length-1]==="."&&(n=n.substr(0,n.length-1))),n}var Kf=qf;const Gc=Lr,_s=Df,Jf=Wf,tp=Kf;let ep=class{constructor(e){this.options=e,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,i)=>String.fromCharCode(Number.parseInt(i,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,i)=>String.fromCharCode(Number.parseInt(i,16))}},this.addExternalEntities=ip,this.parseXml=ap,this.parseTextData=sp,this.resolveNameSpace=np,this.buildAttributesMap=op,this.isItStopNode=dp,this.replaceEntitiesValue=cp,this.readStopNodeData=fp,this.saveTextToParentTag=hp,this.addChild=lp}};function ip(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const i=e[t];this.lastEntities[i]={regex:new RegExp("&"+i+";","g"),val:n[i]}}}function sp(n,e,t,i,s,r,o){if(n!==void 0&&(this.options.trimValues&&!i&&(n=n.trim()),n.length>0)){o||(n=this.replaceEntitiesValue(n));const a=this.options.tagValueProcessor(e,n,t,s,r);return a==null?n:typeof a!=typeof n||a!==n?a:this.options.trimValues?Ho(n,this.options.parseTagValue,this.options.numberParseOptions):n.trim()===n?Ho(n,this.options.parseTagValue,this.options.numberParseOptions):n}}function np(n){if(this.options.removeNSPrefix){const e=n.split(":"),t=n.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(n=t+e[1])}return n}const rp=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function op(n,e,t){if(!this.options.ignoreAttributes&&typeof n=="string"){const i=Gc.getAllMatches(n,rp),s=i.length,r={};for(let o=0;o<s;o++){const a=this.resolveNameSpace(i[o][1]);let l=i[o][4],c=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(c=this.options.transformAttributeName(c)),c==="__proto__"&&(c="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l);const h=this.options.attributeValueProcessor(a,l,e);h==null?r[c]=l:typeof h!=typeof l||h!==l?r[c]=h:r[c]=Ho(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(r[c]=!0)}if(!Object.keys(r).length)return;if(this.options.attributesGroupName){const o={};return o[this.options.attributesGroupName]=r,o}return r}}const ap=function(n){n=n.replace(/\r\n?/g,`
142
- `);const e=new _s("!xml");let t=e,i="",s="";for(let r=0;r<n.length;r++)if(n[r]==="<")if(n[r+1]==="/"){const a=ai(n,">",r,"Closing Tag is not closed.");let l=n.substring(r+2,a).trim();if(this.options.removeNSPrefix){const d=l.indexOf(":");d!==-1&&(l=l.substr(d+1))}this.options.transformTagName&&(l=this.options.transformTagName(l)),t&&(i=this.saveTextToParentTag(i,t,s));const c=s.substring(s.lastIndexOf(".")+1);if(l&&this.options.unpairedTags.indexOf(l)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${l}>`);let h=0;c&&this.options.unpairedTags.indexOf(c)!==-1?(h=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):h=s.lastIndexOf("."),s=s.substring(0,h),t=this.tagsNodeStack.pop(),i="",r=a}else if(n[r+1]==="?"){let a=$o(n,r,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,t,s),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){const l=new _s(a.tagName);l.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(l[":@"]=this.buildAttributesMap(a.tagExp,s,a.tagName)),this.addChild(t,l,s)}r=a.closeIndex+1}else if(n.substr(r+1,3)==="!--"){const a=ai(n,"-->",r+4,"Comment is not closed.");if(this.options.commentPropName){const l=n.substring(r+4,a-2);i=this.saveTextToParentTag(i,t,s),t.add(this.options.commentPropName,[{[this.options.textNodeName]:l}])}r=a}else if(n.substr(r+1,2)==="!D"){const a=Jf(n,r);this.docTypeEntities=a.entities,r=a.i}else if(n.substr(r+1,2)==="!["){const a=ai(n,"]]>",r,"CDATA is not closed.")-2,l=n.substring(r+9,a);i=this.saveTextToParentTag(i,t,s);let c=this.parseTextData(l,t.tagname,s,!0,!1,!0,!0);c==null&&(c=""),this.options.cdataPropName?t.add(this.options.cdataPropName,[{[this.options.textNodeName]:l}]):t.add(this.options.textNodeName,c),r=a+2}else{let a=$o(n,r,this.options.removeNSPrefix),l=a.tagName;const c=a.rawTagName;let h=a.tagExp,d=a.attrExpPresent,u=a.closeIndex;this.options.transformTagName&&(l=this.options.transformTagName(l)),t&&i&&t.tagname!=="!xml"&&(i=this.saveTextToParentTag(i,t,s,!1));const f=t;if(f&&this.options.unpairedTags.indexOf(f.tagname)!==-1&&(t=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),l!==e.tagname&&(s+=s?"."+l:l),this.isItStopNode(this.options.stopNodes,s,l)){let p="";if(h.length>0&&h.lastIndexOf("/")===h.length-1)l[l.length-1]==="/"?(l=l.substr(0,l.length-1),s=s.substr(0,s.length-1),h=l):h=h.substr(0,h.length-1),r=a.closeIndex;else if(this.options.unpairedTags.indexOf(l)!==-1)r=a.closeIndex;else{const E=this.readStopNodeData(n,c,u+1);if(!E)throw new Error(`Unexpected end of ${c}`);r=E.i,p=E.tagContent}const m=new _s(l);l!==h&&d&&(m[":@"]=this.buildAttributesMap(h,s,l)),p&&(p=this.parseTextData(p,l,s,!0,d,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),m.add(this.options.textNodeName,p),this.addChild(t,m,s)}else{if(h.length>0&&h.lastIndexOf("/")===h.length-1){l[l.length-1]==="/"?(l=l.substr(0,l.length-1),s=s.substr(0,s.length-1),h=l):h=h.substr(0,h.length-1),this.options.transformTagName&&(l=this.options.transformTagName(l));const p=new _s(l);l!==h&&d&&(p[":@"]=this.buildAttributesMap(h,s,l)),this.addChild(t,p,s),s=s.substr(0,s.lastIndexOf("."))}else{const p=new _s(l);this.tagsNodeStack.push(t),l!==h&&d&&(p[":@"]=this.buildAttributesMap(h,s,l)),this.addChild(t,p,s),t=p}i="",r=u}}else i+=n[r];return e.child};function lp(n,e,t){const i=this.options.updateTag(e.tagname,t,e[":@"]);i===!1||(typeof i=="string"&&(e.tagname=i),n.addChild(e))}const cp=function(n){if(this.options.processEntities){for(let e in this.docTypeEntities){const t=this.docTypeEntities[e];n=n.replace(t.regx,t.val)}for(let e in this.lastEntities){const t=this.lastEntities[e];n=n.replace(t.regex,t.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const t=this.htmlEntities[e];n=n.replace(t.regex,t.val)}n=n.replace(this.ampEntity.regex,this.ampEntity.val)}return n};function hp(n,e,t,i){return n&&(i===void 0&&(i=Object.keys(e.child).length===0),n=this.parseTextData(n,e.tagname,t,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,i),n!==void 0&&n!==""&&e.add(this.options.textNodeName,n),n=""),n}function dp(n,e,t){const i="*."+t;for(const s in n){const r=n[s];if(i===r||e===r)return!0}return!1}function up(n,e,t=">"){let i,s="";for(let r=e;r<n.length;r++){let o=n[r];if(i)o===i&&(i="");else if(o==='"'||o==="'")i=o;else if(o===t[0])if(t[1]){if(n[r+1]===t[1])return{data:s,index:r}}else return{data:s,index:r};else o===" "&&(o=" ");s+=o}}function ai(n,e,t,i){const s=n.indexOf(e,t);if(s===-1)throw new Error(i);return s+e.length-1}function $o(n,e,t,i=">"){const s=up(n,e+1,i);if(!s)return;let r=s.data;const o=s.index,a=r.search(/\s/);let l=r,c=!0;a!==-1&&(l=r.substring(0,a),r=r.substring(a+1).trimStart());const h=l;if(t){const d=l.indexOf(":");d!==-1&&(l=l.substr(d+1),c=l!==s.data.substr(d+1))}return{tagName:l,tagExp:r,closeIndex:o,attrExpPresent:c,rawTagName:h}}function fp(n,e,t){const i=t;let s=1;for(;t<n.length;t++)if(n[t]==="<")if(n[t+1]==="/"){const r=ai(n,">",t,`${e} is not closed`);if(n.substring(t+2,r).trim()===e&&(s--,s===0))return{tagContent:n.substring(i,t),i:r};t=r}else if(n[t+1]==="?")t=ai(n,"?>",t+1,"StopNode is not closed.");else if(n.substr(t+1,3)==="!--")t=ai(n,"-->",t+3,"StopNode is not closed.");else if(n.substr(t+1,2)==="![")t=ai(n,"]]>",t,"StopNode is not closed.")-2;else{const r=$o(n,t,">");r&&((r&&r.tagName)===e&&r.tagExp[r.tagExp.length-1]!=="/"&&s++,t=r.closeIndex)}}function Ho(n,e,t){if(e&&typeof n=="string"){const i=n.trim();return i==="true"?!0:i==="false"?!1:tp(n,t)}else return Gc.isExist(n)?n:""}var pp=ep,Yc={};function mp(n,e){return Wc(n,e)}function Wc(n,e,t){let i;const s={};for(let r=0;r<n.length;r++){const o=n[r],a=gp(o);let l="";if(t===void 0?l=a:l=t+"."+a,a===e.textNodeName)i===void 0?i=o[a]:i+=""+o[a];else{if(a===void 0)continue;if(o[a]){let c=Wc(o[a],e,l);const h=Ip(c,e);o[":@"]?Ep(c,o[":@"],l,e):Object.keys(c).length===1&&c[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?c=c[e.textNodeName]:Object.keys(c).length===0&&(e.alwaysCreateTextNode?c[e.textNodeName]="":c=""),s[a]!==void 0&&s.hasOwnProperty(a)?(Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(c)):e.isArray(a,l,h)?s[a]=[c]:s[a]=c}}}return typeof i=="string"?i.length>0&&(s[e.textNodeName]=i):i!==void 0&&(s[e.textNodeName]=i),s}function gp(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const i=e[t];if(i!==":@")return i}}function Ep(n,e,t,i){if(e){const s=Object.keys(e),r=s.length;for(let o=0;o<r;o++){const a=s[o];i.isArray(a,t+"."+a,!0,!0)?n[a]=[e[a]]:n[a]=e[a]}}}function Ip(n,e){const{textNodeName:t}=e,i=Object.keys(n).length;return!!(i===0||i===1&&(n[t]||typeof n[t]=="boolean"||n[t]===0))}Yc.prettify=mp;const{buildOptions:bp}=ga,Cp=pp,{prettify:yp}=Yc,_p=pa;let Tp=class{constructor(e){this.externalEntities={},this.options=bp(e)}parse(e,t){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(t){t===!0&&(t={});const r=_p.validate(e,t);if(r!==!0)throw Error(`${r.err.msg}:${r.err.line}:${r.err.col}`)}const i=new Cp(this.options);i.addExternalEntities(this.externalEntities);const s=i.parseXml(e);return this.options.preserveOrder||s===void 0?s:yp(s,this.options)}addEntity(e,t){if(t.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.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[e]=t}};var vp=Tp;const wp=`
143
- `;function Ap(n,e){let t="";return e.format&&e.indentBy.length>0&&(t=wp),jc(n,e,"",t)}function jc(n,e,t,i){let s="",r=!1;for(let o=0;o<n.length;o++){const a=n[o],l=Rp(a);if(l===void 0)continue;let c="";if(t.length===0?c=l:c=`${t}.${l}`,l===e.textNodeName){let p=a[l];Sp(c,e)||(p=e.tagValueProcessor(l,p),p=Xc(p,e)),r&&(s+=i),s+=p,r=!1;continue}else if(l===e.cdataPropName){r&&(s+=i),s+=`<![CDATA[${a[l][0][e.textNodeName]}]]>`,r=!1;continue}else if(l===e.commentPropName){s+=i+`<!--${a[l][0][e.textNodeName]}-->`,r=!0;continue}else if(l[0]==="?"){const p=vl(a[":@"],e),m=l==="?xml"?"":i;let E=a[l][0][e.textNodeName];E=E.length!==0?" "+E:"",s+=m+`<${l}${E}${p}?>`,r=!0;continue}let h=i;h!==""&&(h+=e.indentBy);const d=vl(a[":@"],e),u=i+`<${l}${d}`,f=jc(a[l],e,c,h);e.unpairedTags.indexOf(l)!==-1?e.suppressUnpairedNode?s+=u+">":s+=u+"/>":(!f||f.length===0)&&e.suppressEmptyNode?s+=u+"/>":f&&f.endsWith(">")?s+=u+`>${f}${i}</${l}>`:(s+=u+">",f&&i!==""&&(f.includes("/>")||f.includes("</"))?s+=i+e.indentBy+f+i:s+=f,s+=`</${l}>`),r=!0}return s}function Rp(n){const e=Object.keys(n);for(let t=0;t<e.length;t++){const i=e[t];if(n.hasOwnProperty(i)&&i!==":@")return i}}function vl(n,e){let t="";if(n&&!e.ignoreAttributes)for(let i in n){if(!n.hasOwnProperty(i))continue;let s=e.attributeValueProcessor(i,n[i]);s=Xc(s,e),s===!0&&e.suppressBooleanAttributes?t+=` ${i.substr(e.attributeNamePrefix.length)}`:t+=` ${i.substr(e.attributeNamePrefix.length)}="${s}"`}return t}function Sp(n,e){n=n.substr(0,n.length-e.textNodeName.length-1);let t=n.substr(n.lastIndexOf(".")+1);for(let i in e.stopNodes)if(e.stopNodes[i]===n||e.stopNodes[i]==="*."+t)return!0;return!1}function Xc(n,e){if(n&&n.length>0&&e.processEntities)for(let t=0;t<e.entities.length;t++){const i=e.entities[t];n=n.replace(i.regex,i.val)}return n}var Fp=Ap;const Op=Fp,xp={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(n,e){return e},attributeValueProcessor:function(n,e){return e},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 Ze(n){this.options=Object.assign({},xp,n),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Lp),this.processTextOrObjNode=Np,this.options.format?(this.indentate=Pp,this.tagEndChar=`>
138
+ */(function(r,e){(function(t){r.exports=t()})(function(){return function t(i,s,n){function o(c,h){if(!s[c]){if(!i[c]){var d=typeof kn=="function"&&kn;if(!h&&d)return d(c,!0);if(a)return a(c,!0);var u=new Error("Cannot find module '"+c+"'");throw u.code="MODULE_NOT_FOUND",u}var f=s[c]={exports:{}};i[c][0].call(f.exports,function(p){var m=i[c][1][p];return o(m||p)},f,f.exports,t,i,s,n)}return s[c].exports}for(var a=typeof kn=="function"&&kn,l=0;l<n.length;l++)o(n[l]);return o}({1:[function(t,i,s){var n=t("./utils"),o=t("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";s.encode=function(l){for(var c,h,d,u,f,p,m,E=[],g=0,I=l.length,T=I,b=n.getTypeOf(l)!=="string";g<l.length;)T=I-g,d=b?(c=l[g++],h=g<I?l[g++]:0,g<I?l[g++]:0):(c=l.charCodeAt(g++),h=g<I?l.charCodeAt(g++):0,g<I?l.charCodeAt(g++):0),u=c>>2,f=(3&c)<<4|h>>4,p=1<T?(15&h)<<2|d>>6:64,m=2<T?63&d:64,E.push(a.charAt(u)+a.charAt(f)+a.charAt(p)+a.charAt(m));return E.join("")},s.decode=function(l){var c,h,d,u,f,p,m=0,E=0,g="data:";if(l.substr(0,g.length)===g)throw new Error("Invalid base64 input, it looks like a data url.");var I,T=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&T--,l.charAt(l.length-2)===a.charAt(64)&&T--,T%1!=0)throw new Error("Invalid base64 input, bad content length.");for(I=o.uint8array?new Uint8Array(0|T):new Array(0|T);m<l.length;)c=a.indexOf(l.charAt(m++))<<2|(u=a.indexOf(l.charAt(m++)))>>4,h=(15&u)<<4|(f=a.indexOf(l.charAt(m++)))>>2,d=(3&f)<<6|(p=a.indexOf(l.charAt(m++))),I[E++]=c,f!==64&&(I[E++]=h),p!==64&&(I[E++]=d);return I}},{"./support":30,"./utils":32}],2:[function(t,i,s){var n=t("./external"),o=t("./stream/DataWorker"),a=t("./stream/Crc32Probe"),l=t("./stream/DataLengthProbe");function c(h,d,u,f,p){this.compressedSize=h,this.uncompressedSize=d,this.crc32=u,this.compression=f,this.compressedContent=p}c.prototype={getContentWorker:function(){var h=new o(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("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 o(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(h,d,u){return h.pipe(new a).pipe(new l("uncompressedSize")).pipe(d.compressWorker(u)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},i.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,i,s){var n=t("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},s.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,i,s){var n=t("./utils"),o=function(){for(var a,l=[],c=0;c<256;c++){a=c;for(var h=0;h<8;h++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l}();i.exports=function(a,l){return a!==void 0&&a.length?n.getTypeOf(a)!=="string"?function(c,h,d,u){var f=o,p=u+d;c^=-1;for(var m=u;m<p;m++)c=c>>>8^f[255&(c^h[m])];return-1^c}(0|l,a,a.length,0):function(c,h,d,u){var f=o,p=u+d;c^=-1;for(var m=u;m<p;m++)c=c>>>8^f[255&(c^h.charCodeAt(m))];return-1^c}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(t,i,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(t,i,s){var n=null;n=typeof Promise<"u"?Promise:t("lie"),i.exports={Promise:n}},{lie:37}],7:[function(t,i,s){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=t("pako"),a=t("./utils"),l=t("./stream/GenericWorker"),c=n?"uint8array":"array";function h(d,u){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=u,this.meta={}}s.magic="\b\0",a.inherits(h,l),h.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(c,d.data),!1)},h.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(u){d.push({data:u,meta:d.meta})}},s.compressWorker=function(d){return new h("Deflate",d)},s.uncompressWorker=function(){return new h("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,i,s){function n(f,p){var m,E="";for(m=0;m<p;m++)E+=String.fromCharCode(255&f),f>>>=8;return E}function o(f,p,m,E,g,I){var T,b,v=f.file,A=f.compression,S=I!==c.utf8encode,N=a.transformTo("string",I(v.name)),R=a.transformTo("string",c.utf8encode(v.name)),P=v.comment,M=a.transformTo("string",I(P)),w=a.transformTo("string",c.utf8encode(P)),L=R.length!==v.name.length,C=w.length!==P.length,U="",q="",G="",st=v.dir,Y=v.date,ot={crc32:0,compressedSize:0,uncompressedSize:0};p&&!m||(ot.crc32=f.crc32,ot.compressedSize=f.compressedSize,ot.uncompressedSize=f.uncompressedSize);var $=0;p&&($|=8),S||!L&&!C||($|=2048);var B=0,at=0;st&&(B|=16),g==="UNIX"?(at=798,B|=function(it,Rt){var xt=it;return it||(xt=Rt?16893:33204),(65535&xt)<<16}(v.unixPermissions,st)):(at=20,B|=function(it){return 63&(it||0)}(v.dosPermissions)),T=Y.getUTCHours(),T<<=6,T|=Y.getUTCMinutes(),T<<=5,T|=Y.getUTCSeconds()/2,b=Y.getUTCFullYear()-1980,b<<=4,b|=Y.getUTCMonth()+1,b<<=5,b|=Y.getUTCDate(),L&&(q=n(1,1)+n(h(N),4)+R,U+="up"+n(q.length,2)+q),C&&(G=n(1,1)+n(h(M),4)+w,U+="uc"+n(G.length,2)+G);var nt="";return nt+=`
139
+ \0`,nt+=n($,2),nt+=A.magic,nt+=n(T,2),nt+=n(b,2),nt+=n(ot.crc32,4),nt+=n(ot.compressedSize,4),nt+=n(ot.uncompressedSize,4),nt+=n(N.length,2),nt+=n(U.length,2),{fileRecord:d.LOCAL_FILE_HEADER+nt+N+U,dirRecord:d.CENTRAL_FILE_HEADER+n(at,2)+nt+n(M.length,2)+"\0\0\0\0"+n(B,4)+n(E,4)+N+U+M}}var a=t("../utils"),l=t("../stream/GenericWorker"),c=t("../utf8"),h=t("../crc32"),d=t("../signature");function u(f,p,m,E){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=m,this.encodeFileName=E,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(u,l),u.prototype.push=function(f){var p=f.meta.percent||0,m=this.entriesCount,E=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,l.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:m?(p+100*(m-E-1))/m:100}}))},u.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var p=this.streamFiles&&!f.file.dir;if(p){var m=o(f,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(f){this.accumulate=!1;var p=this.streamFiles&&!f.file.dir,m=o(f,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),p)this.push({data:function(E){return d.DATA_DESCRIPTOR+n(E.crc32,4)+n(E.compressedSize,4)+n(E.uncompressedSize,4)}(f),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var f=this.bytesWritten,p=0;p<this.dirRecords.length;p++)this.push({data:this.dirRecords[p],meta:{percent:100}});var m=this.bytesWritten-f,E=function(g,I,T,b,v){var A=a.transformTo("string",v(b));return d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+n(g,2)+n(g,2)+n(I,4)+n(T,4)+n(A.length,2)+A}(this.dirRecords.length,m,f,this.zipComment,this.encodeFileName);this.push({data:E,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 p=this;return f.on("data",function(m){p.processChunk(m)}),f.on("end",function(){p.closedSource(p.previous.streamInfo),p._sources.length?p.prepareNextSource():p.end()}),f.on("error",function(m){p.error(m)}),this},u.prototype.resume=function(){return!!l.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 p=this._sources;if(!l.prototype.error.call(this,f))return!1;for(var m=0;m<p.length;m++)try{p[m].error(f)}catch{}return!0},u.prototype.lock=function(){l.prototype.lock.call(this);for(var f=this._sources,p=0;p<f.length;p++)f[p].lock()},i.exports=u},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,i,s){var n=t("../compressions"),o=t("./ZipFileWorker");s.generateWorker=function(a,l,c){var h=new o(l.streamFiles,c,l.platform,l.encodeFileName),d=0;try{a.forEach(function(u,f){d++;var p=function(I,T){var b=I||T,v=n[b];if(!v)throw new Error(b+" is not a valid compression method !");return v}(f.options.compression,l.compression),m=f.options.compressionOptions||l.compressionOptions||{},E=f.dir,g=f.date;f._compressWorker(p,m).withStreamInfo("file",{name:u,dir:E,date:g,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,i,s){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 o=new n;for(var a in this)typeof this[a]!="function"&&(o[a]=this[a]);return o}}(n.prototype=t("./object")).loadAsync=t("./load"),n.support=t("./support"),n.defaults=t("./defaults"),n.version="3.10.1",n.loadAsync=function(o,a){return new n().loadAsync(o,a)},n.external=t("./external"),i.exports=n},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,i,s){var n=t("./utils"),o=t("./external"),a=t("./utf8"),l=t("./zipEntries"),c=t("./stream/Crc32Probe"),h=t("./nodejsUtils");function d(u){return new o.Promise(function(f,p){var m=u.decompressed.getContentWorker().pipe(new c);m.on("error",function(E){p(E)}).on("end",function(){m.streamInfo.crc32!==u.decompressed.crc32?p(new Error("Corrupted zip : CRC32 mismatch")):f()}).resume()})}i.exports=function(u,f){var p=this;return f=n.extend(f||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),h.isNode&&h.isStream(u)?o.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(m){var E=new l(f);return E.load(m),E}).then(function(m){var E=[o.Promise.resolve(m)],g=m.files;if(f.checkCRC32)for(var I=0;I<g.length;I++)E.push(d(g[I]));return o.Promise.all(E)}).then(function(m){for(var E=m.shift(),g=E.files,I=0;I<g.length;I++){var T=g[I],b=T.fileNameStr,v=n.resolve(T.fileNameStr);p.file(v,T.decompressed,{binary:!0,optimizedBinaryString:!0,date:T.date,dir:T.dir,comment:T.fileCommentStr.length?T.fileCommentStr:null,unixPermissions:T.unixPermissions,dosPermissions:T.dosPermissions,createFolders:f.createFolders}),T.dir||(p.file(v).unsafeOriginalName=b)}return E.zipComment.length&&(p.comment=E.zipComment),p})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,i,s){var n=t("../utils"),o=t("../stream/GenericWorker");function a(l,c){o.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(c)}n.inherits(a,o),a.prototype._bindStream=function(l){var c=this;(this._stream=l).pause(),l.on("data",function(h){c.push({data:h,meta:{percent:0}})}).on("error",function(h){c.isPaused?this.generatedError=h:c.error(h)}).on("end",function(){c.isPaused?c._upstreamEnded=!0:c.end()})},a.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},i.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,i,s){var n=t("readable-stream").Readable;function o(a,l,c){n.call(this,l),this._helper=a;var h=this;a.on("data",function(d,u){h.push(d)||h._helper.pause(),c&&c(u)}).on("error",function(d){h.emit("error",d)}).on("end",function(){h.push(null)})}t("../utils").inherits(o,n),o.prototype._read=function(){this._helper.resume()},i.exports=o},{"../utils":32,"readable-stream":16}],14:[function(t,i,s){i.exports={isNode:typeof Buffer<"u",newBufferFrom:function(n,o){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(n,o);if(typeof n=="number")throw new Error('The "data" argument must not be a number');return new Buffer(n,o)},allocBuffer:function(n){if(Buffer.alloc)return Buffer.alloc(n);var o=new Buffer(n);return o.fill(0),o},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,i,s){function n(v,A,S){var N,R=a.getTypeOf(A),P=a.extend(S||{},h);P.date=P.date||new Date,P.compression!==null&&(P.compression=P.compression.toUpperCase()),typeof P.unixPermissions=="string"&&(P.unixPermissions=parseInt(P.unixPermissions,8)),P.unixPermissions&&16384&P.unixPermissions&&(P.dir=!0),P.dosPermissions&&16&P.dosPermissions&&(P.dir=!0),P.dir&&(v=g(v)),P.createFolders&&(N=E(v))&&I.call(this,N,!0);var M=R==="string"&&P.binary===!1&&P.base64===!1;S&&S.binary!==void 0||(P.binary=!M),(A instanceof d&&A.uncompressedSize===0||P.dir||!A||A.length===0)&&(P.base64=!1,P.binary=!0,A="",P.compression="STORE",R="string");var w=null;w=A instanceof d||A instanceof l?A:p.isNode&&p.isStream(A)?new m(v,A):a.prepareContent(v,A,P.binary,P.optimizedBinaryString,P.base64);var L=new u(v,w,P);this.files[v]=L}var o=t("./utf8"),a=t("./utils"),l=t("./stream/GenericWorker"),c=t("./stream/StreamHelper"),h=t("./defaults"),d=t("./compressedObject"),u=t("./zipObject"),f=t("./generate"),p=t("./nodejsUtils"),m=t("./nodejs/NodejsStreamInputAdapter"),E=function(v){v.slice(-1)==="/"&&(v=v.substring(0,v.length-1));var A=v.lastIndexOf("/");return 0<A?v.substring(0,A):""},g=function(v){return v.slice(-1)!=="/"&&(v+="/"),v},I=function(v,A){return A=A!==void 0?A:h.createFolders,v=g(v),this.files[v]||n.call(this,v,null,{dir:!0,createFolders:A}),this.files[v]};function T(v){return Object.prototype.toString.call(v)==="[object RegExp]"}var b={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(v){var A,S,N;for(A in this.files)N=this.files[A],(S=A.slice(this.root.length,A.length))&&A.slice(0,this.root.length)===this.root&&v(S,N)},filter:function(v){var A=[];return this.forEach(function(S,N){v(S,N)&&A.push(N)}),A},file:function(v,A,S){if(arguments.length!==1)return v=this.root+v,n.call(this,v,A,S),this;if(T(v)){var N=v;return this.filter(function(P,M){return!M.dir&&N.test(P)})}var R=this.files[this.root+v];return R&&!R.dir?R:null},folder:function(v){if(!v)return this;if(T(v))return this.filter(function(R,P){return P.dir&&v.test(R)});var A=this.root+v,S=I.call(this,A),N=this.clone();return N.root=S.name,N},remove:function(v){v=this.root+v;var A=this.files[v];if(A||(v.slice(-1)!=="/"&&(v+="/"),A=this.files[v]),A&&!A.dir)delete this.files[v];else for(var S=this.filter(function(R,P){return P.name.slice(0,v.length)===v}),N=0;N<S.length;N++)delete this.files[S[N].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(v){var A,S={};try{if((S=a.extend(v||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=S.type.toLowerCase(),S.compression=S.compression.toUpperCase(),S.type==="binarystring"&&(S.type="string"),!S.type)throw new Error("No output type specified.");a.checkSupport(S.type),S.platform!=="darwin"&&S.platform!=="freebsd"&&S.platform!=="linux"&&S.platform!=="sunos"||(S.platform="UNIX"),S.platform==="win32"&&(S.platform="DOS");var N=S.comment||this.comment||"";A=f.generateWorker(this,S,N)}catch(R){(A=new l("error")).error(R)}return new c(A,S.type||"string",S.mimeType)},generateAsync:function(v,A){return this.generateInternalStream(v).accumulate(A)},generateNodeStream:function(v,A){return(v=v||{}).type||(v.type="nodebuffer"),this.generateInternalStream(v).toNodejsStream(A)}};i.exports=b},{"./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,i,s){i.exports=t("stream")},{stream:void 0}],17:[function(t,i,s){var n=t("./DataReader");function o(a){n.call(this,a);for(var l=0;l<this.data.length;l++)a[l]=255&a[l]}t("../utils").inherits(o,n),o.prototype.byteAt=function(a){return this.data[this.zero+a]},o.prototype.lastIndexOfSignature=function(a){for(var l=a.charCodeAt(0),c=a.charCodeAt(1),h=a.charCodeAt(2),d=a.charCodeAt(3),u=this.length-4;0<=u;--u)if(this.data[u]===l&&this.data[u+1]===c&&this.data[u+2]===h&&this.data[u+3]===d)return u-this.zero;return-1},o.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),c=a.charCodeAt(1),h=a.charCodeAt(2),d=a.charCodeAt(3),u=this.readData(4);return l===u[0]&&c===u[1]&&h===u[2]&&d===u[3]},o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},i.exports=o},{"../utils":32,"./DataReader":18}],18:[function(t,i,s){var n=t("../utils");function o(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,c=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=a,c},readString:function(a){return n.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},i.exports=o},{"../utils":32}],19:[function(t,i,s){var n=t("./Uint8ArrayReader");function o(a){n.call(this,a)}t("../utils").inherits(o,n),o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},i.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,i,s){var n=t("./DataReader");function o(a){n.call(this,a)}t("../utils").inherits(o,n),o.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},o.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},o.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},i.exports=o},{"../utils":32,"./DataReader":18}],21:[function(t,i,s){var n=t("./ArrayReader");function o(a){n.call(this,a)}t("../utils").inherits(o,n),o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},i.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(t,i,s){var n=t("../utils"),o=t("../support"),a=t("./ArrayReader"),l=t("./StringReader"),c=t("./NodeBufferReader"),h=t("./Uint8ArrayReader");i.exports=function(d){var u=n.getTypeOf(d);return n.checkSupport(u),u!=="string"||o.uint8array?u==="nodebuffer"?new c(d):o.uint8array?new h(n.transformTo("uint8array",d)):new a(n.transformTo("array",d)):new l(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,i,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,i,s){var n=t("./GenericWorker"),o=t("../utils");function a(l){n.call(this,"ConvertWorker to "+l),this.destType=l}o.inherits(a,n),a.prototype.processChunk=function(l){this.push({data:o.transformTo(this.destType,l.data),meta:l.meta})},i.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(t,i,s){var n=t("./GenericWorker"),o=t("../crc32");function a(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(a,n),a.prototype.processChunk=function(l){this.streamInfo.crc32=o(l.data,this.streamInfo.crc32||0),this.push(l)},i.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,i,s){var n=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}n.inherits(a,o),a.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}o.prototype.processChunk.call(this,l)},i.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(t,i,s){var n=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(h){c.dataIsReady=!0,c.data=h,c.max=h&&h.length||0,c.type=n.getTypeOf(h),c.isPaused||c._tickAndRepeat()},function(h){c.error(h)})}n.inherits(a,o),a.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},i.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(t,i,s){function n(o){this.name=o||"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(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,a){return this._listeners[o].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,a){if(this._listeners[o])for(var l=0;l<this._listeners[o].length;l++)this._listeners[o][l].call(this,a)},pipe:function(o){return o.registerPrevious(this)},registerPrevious:function(o){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=o.streamInfo,this.mergeStreamInfo(),this.previous=o;var a=this;return o.on("data",function(l){a.processChunk(l)}),o.on("end",function(){a.end()}),o.on("error",function(l){a.error(l)}),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 o=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),o=!0),this.previous&&this.previous.resume(),!o},flush:function(){},processChunk:function(o){this.push(o)},withStreamInfo:function(o,a){return this.extraStreamInfo[o]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var o in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,o)&&(this.streamInfo[o]=this.extraStreamInfo[o])},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 o="Worker "+this.name;return this.previous?this.previous+" -> "+o:o}},i.exports=n},{}],29:[function(t,i,s){var n=t("../utils"),o=t("./ConvertWorker"),a=t("./GenericWorker"),l=t("../base64"),c=t("../support"),h=t("../external"),d=null;if(c.nodestream)try{d=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function u(p,m){return new h.Promise(function(E,g){var I=[],T=p._internalType,b=p._outputType,v=p._mimeType;p.on("data",function(A,S){I.push(A),m&&m(S)}).on("error",function(A){I=[],g(A)}).on("end",function(){try{var A=function(S,N,R){switch(S){case"blob":return n.newBlob(n.transformTo("arraybuffer",N),R);case"base64":return l.encode(N);default:return n.transformTo(S,N)}}(b,function(S,N){var R,P=0,M=null,w=0;for(R=0;R<N.length;R++)w+=N[R].length;switch(S){case"string":return N.join("");case"array":return Array.prototype.concat.apply([],N);case"uint8array":for(M=new Uint8Array(w),R=0;R<N.length;R++)M.set(N[R],P),P+=N[R].length;return M;case"nodebuffer":return Buffer.concat(N);default:throw new Error("concat : unsupported type '"+S+"'")}}(T,I),v);E(A)}catch(S){g(S)}I=[]}).resume()})}function f(p,m,E){var g=m;switch(m){case"blob":case"arraybuffer":g="uint8array";break;case"base64":g="string"}try{this._internalType=g,this._outputType=m,this._mimeType=E,n.checkSupport(g),this._worker=p.pipe(new o(g)),p.lock()}catch(I){this._worker=new a("error"),this._worker.error(I)}}f.prototype={accumulate:function(p){return u(this,p)},on:function(p,m){var E=this;return p==="data"?this._worker.on(p,function(g){m.call(E,g.data,g.meta)}):this._worker.on(p,function(){n.delay(m,arguments,E)}),this},resume:function(){return n.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(p){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"},p)}},i.exports=f},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,i,s){if(s.base64=!0,s.array=!0,s.string=!0,s.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",s.nodebuffer=typeof Buffer<"u",s.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")s.blob=!1;else{var n=new ArrayBuffer(0);try{s.blob=new Blob([n],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(n),s.blob=o.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!t("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(t,i,s){for(var n=t("./utils"),o=t("./support"),a=t("./nodejsUtils"),l=t("./stream/GenericWorker"),c=new Array(256),h=0;h<256;h++)c[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;c[254]=c[254]=1;function d(){l.call(this,"utf-8 decode"),this.leftOver=null}function u(){l.call(this,"utf-8 encode")}s.utf8encode=function(f){return o.nodebuffer?a.newBufferFrom(f,"utf-8"):function(p){var m,E,g,I,T,b=p.length,v=0;for(I=0;I<b;I++)(64512&(E=p.charCodeAt(I)))==55296&&I+1<b&&(64512&(g=p.charCodeAt(I+1)))==56320&&(E=65536+(E-55296<<10)+(g-56320),I++),v+=E<128?1:E<2048?2:E<65536?3:4;for(m=o.uint8array?new Uint8Array(v):new Array(v),I=T=0;T<v;I++)(64512&(E=p.charCodeAt(I)))==55296&&I+1<b&&(64512&(g=p.charCodeAt(I+1)))==56320&&(E=65536+(E-55296<<10)+(g-56320),I++),E<128?m[T++]=E:(E<2048?m[T++]=192|E>>>6:(E<65536?m[T++]=224|E>>>12:(m[T++]=240|E>>>18,m[T++]=128|E>>>12&63),m[T++]=128|E>>>6&63),m[T++]=128|63&E);return m}(f)},s.utf8decode=function(f){return o.nodebuffer?n.transformTo("nodebuffer",f).toString("utf-8"):function(p){var m,E,g,I,T=p.length,b=new Array(2*T);for(m=E=0;m<T;)if((g=p[m++])<128)b[E++]=g;else if(4<(I=c[g]))b[E++]=65533,m+=I-1;else{for(g&=I===2?31:I===3?15:7;1<I&&m<T;)g=g<<6|63&p[m++],I--;1<I?b[E++]=65533:g<65536?b[E++]=g:(g-=65536,b[E++]=55296|g>>10&1023,b[E++]=56320|1023&g)}return b.length!==E&&(b.subarray?b=b.subarray(0,E):b.length=E),n.applyFromCharCode(b)}(f=n.transformTo(o.uint8array?"uint8array":"array",f))},n.inherits(d,l),d.prototype.processChunk=function(f){var p=n.transformTo(o.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var m=p;(p=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),p.set(m,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var E=function(I,T){var b;for((T=T||I.length)>I.length&&(T=I.length),b=T-1;0<=b&&(192&I[b])==128;)b--;return b<0||b===0?T:b+c[I[b]]>T?b:T}(p),g=p;E!==p.length&&(o.uint8array?(g=p.subarray(0,E),this.leftOver=p.subarray(E,p.length)):(g=p.slice(0,E),this.leftOver=p.slice(E,p.length))),this.push({data:s.utf8decode(g),meta:f.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=d,n.inherits(u,l),u.prototype.processChunk=function(f){this.push({data:s.utf8encode(f.data),meta:f.meta})},s.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,i,s){var n=t("./support"),o=t("./base64"),a=t("./nodejsUtils"),l=t("./external");function c(m){return m}function h(m,E){for(var g=0;g<m.length;++g)E[g]=255&m.charCodeAt(g);return E}t("setimmediate"),s.newBlob=function(m,E){s.checkSupport("blob");try{return new Blob([m],{type:E})}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return g.append(m),g.getBlob(E)}catch{throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(m,E,g){var I=[],T=0,b=m.length;if(b<=g)return String.fromCharCode.apply(null,m);for(;T<b;)E==="array"||E==="nodebuffer"?I.push(String.fromCharCode.apply(null,m.slice(T,Math.min(T+g,b)))):I.push(String.fromCharCode.apply(null,m.subarray(T,Math.min(T+g,b)))),T+=g;return I.join("")},stringifyByChar:function(m){for(var E="",g=0;g<m.length;g++)E+=String.fromCharCode(m[g]);return E},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,a.allocBuffer(1)).length===1}catch{return!1}}()}};function u(m){var E=65536,g=s.getTypeOf(m),I=!0;if(g==="uint8array"?I=d.applyCanBeUsed.uint8array:g==="nodebuffer"&&(I=d.applyCanBeUsed.nodebuffer),I)for(;1<E;)try{return d.stringifyByChunk(m,g,E)}catch{E=Math.floor(E/2)}return d.stringifyByChar(m)}function f(m,E){for(var g=0;g<m.length;g++)E[g]=m[g];return E}s.applyFromCharCode=u;var p={};p.string={string:c,array:function(m){return h(m,new Array(m.length))},arraybuffer:function(m){return p.string.uint8array(m).buffer},uint8array:function(m){return h(m,new Uint8Array(m.length))},nodebuffer:function(m){return h(m,a.allocBuffer(m.length))}},p.array={string:u,array:c,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(m)}},p.arraybuffer={string:function(m){return u(new Uint8Array(m))},array:function(m){return f(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:c,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(new Uint8Array(m))}},p.uint8array={string:u,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:c,nodebuffer:function(m){return a.newBufferFrom(m)}},p.nodebuffer={string:u,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return p.nodebuffer.uint8array(m).buffer},uint8array:function(m){return f(m,new Uint8Array(m.length))},nodebuffer:c},s.transformTo=function(m,E){if(E=E||"",!m)return E;s.checkSupport(m);var g=s.getTypeOf(E);return p[g][m](E)},s.resolve=function(m){for(var E=m.split("/"),g=[],I=0;I<E.length;I++){var T=E[I];T==="."||T===""&&I!==0&&I!==E.length-1||(T===".."?g.pop():g.push(T))}return g.join("/")},s.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":n.nodebuffer&&a.isBuffer(m)?"nodebuffer":n.uint8array&&m instanceof Uint8Array?"uint8array":n.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},s.checkSupport=function(m){if(!n[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},s.MAX_VALUE_16BITS=65535,s.MAX_VALUE_32BITS=-1,s.pretty=function(m){var E,g,I="";for(g=0;g<(m||"").length;g++)I+="\\x"+((E=m.charCodeAt(g))<16?"0":"")+E.toString(16).toUpperCase();return I},s.delay=function(m,E,g){setImmediate(function(){m.apply(g||null,E||[])})},s.inherits=function(m,E){function g(){}g.prototype=E.prototype,m.prototype=new g},s.extend=function(){var m,E,g={};for(m=0;m<arguments.length;m++)for(E in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],E)&&g[E]===void 0&&(g[E]=arguments[m][E]);return g},s.prepareContent=function(m,E,g,I,T){return l.Promise.resolve(E).then(function(b){return n.blob&&(b instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(b))!==-1)&&typeof FileReader<"u"?new l.Promise(function(v,A){var S=new FileReader;S.onload=function(N){v(N.target.result)},S.onerror=function(N){A(N.target.error)},S.readAsArrayBuffer(b)}):b}).then(function(b){var v=s.getTypeOf(b);return v?(v==="arraybuffer"?b=s.transformTo("uint8array",b):v==="string"&&(T?b=o.decode(b):g&&I!==!0&&(b=function(A){return h(A,n.uint8array?new Uint8Array(A.length):new Array(A.length))}(b))),b):l.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,i,s){var n=t("./reader/readerFor"),o=t("./utils"),a=t("./signature"),l=t("./zipEntry"),c=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 ("+o.pretty(u)+", expected "+o.pretty(d)+")")}},isSignature:function(d,u){var f=this.reader.index;this.reader.setIndex(d);var p=this.reader.readString(4)===u;return this.reader.setIndex(f),p},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=c.uint8array?"uint8array":"array",f=o.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,p=this.zip64EndOfCentralSize-44;0<p;)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(a.LOCAL_FILE_HEADER),u.readLocalPart(this.reader),u.handleUTF8(),u.processAttributes()},readCentralDir:function(){var d;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(d=new l({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(a.CENTRAL_DIRECTORY_END);if(d<0)throw this.isSignature(0,a.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(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(d=this.reader.lastIndexOfSignature(a.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(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.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(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var f=this.centralDirOffset+this.centralDirSize;this.zip64&&(f+=20,f+=12+this.zip64EndOfCentralSize);var p=u-f;if(0<p)this.isSignature(u,a.CENTRAL_FILE_HEADER)||(this.reader.zero=p);else if(p<0)throw new Error("Corrupted zip: missing "+Math.abs(p)+" bytes.")},prepareReader:function(d){this.reader=n(d)},load:function(d){this.prepareReader(d),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},i.exports=h},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,i,s){var n=t("./reader/readerFor"),o=t("./utils"),a=t("./compressedObject"),l=t("./crc32"),c=t("./utf8"),h=t("./compressions"),d=t("./support");function u(f,p){this.options=f,this.loadOptions=p}u.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(f){var p,m;if(f.skip(22),this.fileNameLength=f.readInt(2),m=f.readInt(2),this.fileName=f.readData(this.fileNameLength),f.skip(m),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((p=function(E){for(var g in h)if(Object.prototype.hasOwnProperty.call(h,g)&&h[g].magic===E)return h[g];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,p,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 p=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(p),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===o.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var p,m,E,g=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4<g;)p=f.readInt(2),m=f.readInt(2),E=f.readData(m),this.extraFields[p]={id:p,length:m,value:E};f.setIndex(g)},handleUTF8:function(){var f=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=c.utf8decode(this.fileName),this.fileCommentStr=c.utf8decode(this.fileComment);else{var p=this.findExtraFieldUnicodePath();if(p!==null)this.fileNameStr=p;else{var m=o.transformTo(f,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var E=this.findExtraFieldUnicodeComment();if(E!==null)this.fileCommentStr=E;else{var g=o.transformTo(f,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(g)}}},findExtraFieldUnicodePath:function(){var f=this.extraFields[28789];if(f){var p=n(f.value);return p.readInt(1)!==1||l(this.fileName)!==p.readInt(4)?null:c.utf8decode(p.readData(f.length-5))}return null},findExtraFieldUnicodeComment:function(){var f=this.extraFields[25461];if(f){var p=n(f.value);return p.readInt(1)!==1||l(this.fileComment)!==p.readInt(4)?null:c.utf8decode(p.readData(f.length-5))}return null}},i.exports=u},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,i,s){function n(p,m,E){this.name=p,this.dir=E.dir,this.date=E.date,this.comment=E.comment,this.unixPermissions=E.unixPermissions,this.dosPermissions=E.dosPermissions,this._data=m,this._dataBinary=E.binary,this.options={compression:E.compression,compressionOptions:E.compressionOptions}}var o=t("./stream/StreamHelper"),a=t("./stream/DataWorker"),l=t("./utf8"),c=t("./compressedObject"),h=t("./stream/GenericWorker");n.prototype={internalStream:function(p){var m=null,E="string";try{if(!p)throw new Error("No output type specified.");var g=(E=p.toLowerCase())==="string"||E==="text";E!=="binarystring"&&E!=="text"||(E="string"),m=this._decompressWorker();var I=!this._dataBinary;I&&!g&&(m=m.pipe(new l.Utf8EncodeWorker)),!I&&g&&(m=m.pipe(new l.Utf8DecodeWorker))}catch(T){(m=new h("error")).error(T)}return new o(m,E,"")},async:function(p,m){return this.internalStream(p).accumulate(m)},nodeStream:function(p,m){return this.internalStream(p||"nodebuffer").toNodejsStream(m)},_compressWorker:function(p,m){if(this._data instanceof c&&this._data.compression.magic===p.magic)return this._data.getCompressedWorker();var E=this._decompressWorker();return this._dataBinary||(E=E.pipe(new l.Utf8EncodeWorker)),c.createWorkerFrom(E,p,m)},_decompressWorker:function(){return this._data instanceof c?this._data.getContentWorker():this._data instanceof h?this._data:new a(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;i.exports=n},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,i,s){(function(n){var o,a,l=n.MutationObserver||n.WebKitMutationObserver;if(l){var c=0,h=new l(p),d=n.document.createTextNode("");h.observe(d,{characterData:!0}),o=function(){d.data=c=++c%2}}else if(n.setImmediate||n.MessageChannel===void 0)o="document"in n&&"onreadystatechange"in n.document.createElement("script")?function(){var m=n.document.createElement("script");m.onreadystatechange=function(){p(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},n.document.documentElement.appendChild(m)}:function(){setTimeout(p,0)};else{var u=new n.MessageChannel;u.port1.onmessage=p,o=function(){u.port2.postMessage(0)}}var f=[];function p(){var m,E;a=!0;for(var g=f.length;g;){for(E=f,f=[],m=-1;++m<g;)E[m]();g=f.length}a=!1}i.exports=function(m){f.push(m)!==1||a||o()}}).call(this,typeof Un<"u"?Un:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,i,s){var n=t("immediate");function o(){}var a={},l=["REJECTED"],c=["FULFILLED"],h=["PENDING"];function d(g){if(typeof g!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,g!==o&&m(this,g)}function u(g,I,T){this.promise=g,typeof I=="function"&&(this.onFulfilled=I,this.callFulfilled=this.otherCallFulfilled),typeof T=="function"&&(this.onRejected=T,this.callRejected=this.otherCallRejected)}function f(g,I,T){n(function(){var b;try{b=I(T)}catch(v){return a.reject(g,v)}b===g?a.reject(g,new TypeError("Cannot resolve promise with itself")):a.resolve(g,b)})}function p(g){var I=g&&g.then;if(g&&(typeof g=="object"||typeof g=="function")&&typeof I=="function")return function(){I.apply(g,arguments)}}function m(g,I){var T=!1;function b(S){T||(T=!0,a.reject(g,S))}function v(S){T||(T=!0,a.resolve(g,S))}var A=E(function(){I(v,b)});A.status==="error"&&b(A.value)}function E(g,I){var T={};try{T.value=g(I),T.status="success"}catch(b){T.status="error",T.value=b}return T}(i.exports=d).prototype.finally=function(g){if(typeof g!="function")return this;var I=this.constructor;return this.then(function(T){return I.resolve(g()).then(function(){return T})},function(T){return I.resolve(g()).then(function(){throw T})})},d.prototype.catch=function(g){return this.then(null,g)},d.prototype.then=function(g,I){if(typeof g!="function"&&this.state===c||typeof I!="function"&&this.state===l)return this;var T=new this.constructor(o);return this.state!==h?f(T,this.state===c?g:I,this.outcome):this.queue.push(new u(T,g,I)),T},u.prototype.callFulfilled=function(g){a.resolve(this.promise,g)},u.prototype.otherCallFulfilled=function(g){f(this.promise,this.onFulfilled,g)},u.prototype.callRejected=function(g){a.reject(this.promise,g)},u.prototype.otherCallRejected=function(g){f(this.promise,this.onRejected,g)},a.resolve=function(g,I){var T=E(p,I);if(T.status==="error")return a.reject(g,T.value);var b=T.value;if(b)m(g,b);else{g.state=c,g.outcome=I;for(var v=-1,A=g.queue.length;++v<A;)g.queue[v].callFulfilled(I)}return g},a.reject=function(g,I){g.state=l,g.outcome=I;for(var T=-1,b=g.queue.length;++T<b;)g.queue[T].callRejected(I);return g},d.resolve=function(g){return g instanceof this?g:a.resolve(new this(o),g)},d.reject=function(g){var I=new this(o);return a.reject(I,g)},d.all=function(g){var I=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var T=g.length,b=!1;if(!T)return this.resolve([]);for(var v=new Array(T),A=0,S=-1,N=new this(o);++S<T;)R(g[S],S);return N;function R(P,M){I.resolve(P).then(function(w){v[M]=w,++A!==T||b||(b=!0,a.resolve(N,v))},function(w){b||(b=!0,a.reject(N,w))})}},d.race=function(g){var I=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var T=g.length,b=!1;if(!T)return this.resolve([]);for(var v=-1,A=new this(o);++v<T;)S=g[v],I.resolve(S).then(function(N){b||(b=!0,a.resolve(A,N))},function(N){b||(b=!0,a.reject(A,N))});var S;return A}},{immediate:36}],38:[function(t,i,s){var n={};(0,t("./lib/utils/common").assign)(n,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),i.exports=n},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,i,s){var n=t("./zlib/deflate"),o=t("./utils/common"),a=t("./utils/strings"),l=t("./zlib/messages"),c=t("./zlib/zstream"),h=Object.prototype.toString,d=0,u=-1,f=0,p=8;function m(g){if(!(this instanceof m))return new m(g);this.options=o.assign({level:u,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,to:""},g||{});var I=this.options;I.raw&&0<I.windowBits?I.windowBits=-I.windowBits:I.gzip&&0<I.windowBits&&I.windowBits<16&&(I.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var T=n.deflateInit2(this.strm,I.level,I.method,I.windowBits,I.memLevel,I.strategy);if(T!==d)throw new Error(l[T]);if(I.header&&n.deflateSetHeader(this.strm,I.header),I.dictionary){var b;if(b=typeof I.dictionary=="string"?a.string2buf(I.dictionary):h.call(I.dictionary)==="[object ArrayBuffer]"?new Uint8Array(I.dictionary):I.dictionary,(T=n.deflateSetDictionary(this.strm,b))!==d)throw new Error(l[T]);this._dict_set=!0}}function E(g,I){var T=new m(I);if(T.push(g,!0),T.err)throw T.msg||l[T.err];return T.result}m.prototype.push=function(g,I){var T,b,v=this.strm,A=this.options.chunkSize;if(this.ended)return!1;b=I===~~I?I:I===!0?4:0,typeof g=="string"?v.input=a.string2buf(g):h.call(g)==="[object ArrayBuffer]"?v.input=new Uint8Array(g):v.input=g,v.next_in=0,v.avail_in=v.input.length;do{if(v.avail_out===0&&(v.output=new o.Buf8(A),v.next_out=0,v.avail_out=A),(T=n.deflate(v,b))!==1&&T!==d)return this.onEnd(T),!(this.ended=!0);v.avail_out!==0&&(v.avail_in!==0||b!==4&&b!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(o.shrinkBuf(v.output,v.next_out))):this.onData(o.shrinkBuf(v.output,v.next_out)))}while((0<v.avail_in||v.avail_out===0)&&T!==1);return b===4?(T=n.deflateEnd(this.strm),this.onEnd(T),this.ended=!0,T===d):b!==2||(this.onEnd(d),!(v.avail_out=0))},m.prototype.onData=function(g){this.chunks.push(g)},m.prototype.onEnd=function(g){g===d&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},s.Deflate=m,s.deflate=E,s.deflateRaw=function(g,I){return(I=I||{}).raw=!0,E(g,I)},s.gzip=function(g,I){return(I=I||{}).gzip=!0,E(g,I)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,i,s){var n=t("./zlib/inflate"),o=t("./utils/common"),a=t("./utils/strings"),l=t("./zlib/constants"),c=t("./zlib/messages"),h=t("./zlib/zstream"),d=t("./zlib/gzheader"),u=Object.prototype.toString;function f(m){if(!(this instanceof f))return new f(m);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},m||{});var E=this.options;E.raw&&0<=E.windowBits&&E.windowBits<16&&(E.windowBits=-E.windowBits,E.windowBits===0&&(E.windowBits=-15)),!(0<=E.windowBits&&E.windowBits<16)||m&&m.windowBits||(E.windowBits+=32),15<E.windowBits&&E.windowBits<48&&!(15&E.windowBits)&&(E.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var g=n.inflateInit2(this.strm,E.windowBits);if(g!==l.Z_OK)throw new Error(c[g]);this.header=new d,n.inflateGetHeader(this.strm,this.header)}function p(m,E){var g=new f(E);if(g.push(m,!0),g.err)throw g.msg||c[g.err];return g.result}f.prototype.push=function(m,E){var g,I,T,b,v,A,S=this.strm,N=this.options.chunkSize,R=this.options.dictionary,P=!1;if(this.ended)return!1;I=E===~~E?E:E===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof m=="string"?S.input=a.binstring2buf(m):u.call(m)==="[object ArrayBuffer]"?S.input=new Uint8Array(m):S.input=m,S.next_in=0,S.avail_in=S.input.length;do{if(S.avail_out===0&&(S.output=new o.Buf8(N),S.next_out=0,S.avail_out=N),(g=n.inflate(S,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&R&&(A=typeof R=="string"?a.string2buf(R):u.call(R)==="[object ArrayBuffer]"?new Uint8Array(R):R,g=n.inflateSetDictionary(this.strm,A)),g===l.Z_BUF_ERROR&&P===!0&&(g=l.Z_OK,P=!1),g!==l.Z_STREAM_END&&g!==l.Z_OK)return this.onEnd(g),!(this.ended=!0);S.next_out&&(S.avail_out!==0&&g!==l.Z_STREAM_END&&(S.avail_in!==0||I!==l.Z_FINISH&&I!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(T=a.utf8border(S.output,S.next_out),b=S.next_out-T,v=a.buf2string(S.output,T),S.next_out=b,S.avail_out=N-b,b&&o.arraySet(S.output,S.output,T,b,0),this.onData(v)):this.onData(o.shrinkBuf(S.output,S.next_out)))),S.avail_in===0&&S.avail_out===0&&(P=!0)}while((0<S.avail_in||S.avail_out===0)&&g!==l.Z_STREAM_END);return g===l.Z_STREAM_END&&(I=l.Z_FINISH),I===l.Z_FINISH?(g=n.inflateEnd(this.strm),this.onEnd(g),this.ended=!0,g===l.Z_OK):I!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(S.avail_out=0))},f.prototype.onData=function(m){this.chunks.push(m)},f.prototype.onEnd=function(m){m===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},s.Inflate=f,s.inflate=p,s.inflateRaw=function(m,E){return(E=E||{}).raw=!0,p(m,E)},s.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,i,s){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";s.assign=function(l){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var h=c.shift();if(h){if(typeof h!="object")throw new TypeError(h+"must be non-object");for(var d in h)h.hasOwnProperty(d)&&(l[d]=h[d])}}return l},s.shrinkBuf=function(l,c){return l.length===c?l:l.subarray?l.subarray(0,c):(l.length=c,l)};var o={arraySet:function(l,c,h,d,u){if(c.subarray&&l.subarray)l.set(c.subarray(h,h+d),u);else for(var f=0;f<d;f++)l[u+f]=c[h+f]},flattenChunks:function(l){var c,h,d,u,f,p;for(c=d=0,h=l.length;c<h;c++)d+=l[c].length;for(p=new Uint8Array(d),c=u=0,h=l.length;c<h;c++)f=l[c],p.set(f,u),u+=f.length;return p}},a={arraySet:function(l,c,h,d,u){for(var f=0;f<d;f++)l[u+f]=c[h+f]},flattenChunks:function(l){return[].concat.apply([],l)}};s.setTyped=function(l){l?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,o)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,a))},s.setTyped(n)},{}],42:[function(t,i,s){var n=t("./common"),o=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new n.Buf8(256),c=0;c<256;c++)l[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function h(d,u){if(u<65537&&(d.subarray&&a||!d.subarray&&o))return String.fromCharCode.apply(null,n.shrinkBuf(d,u));for(var f="",p=0;p<u;p++)f+=String.fromCharCode(d[p]);return f}l[254]=l[254]=1,s.string2buf=function(d){var u,f,p,m,E,g=d.length,I=0;for(m=0;m<g;m++)(64512&(f=d.charCodeAt(m)))==55296&&m+1<g&&(64512&(p=d.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(p-56320),m++),I+=f<128?1:f<2048?2:f<65536?3:4;for(u=new n.Buf8(I),m=E=0;E<I;m++)(64512&(f=d.charCodeAt(m)))==55296&&m+1<g&&(64512&(p=d.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(p-56320),m++),f<128?u[E++]=f:(f<2048?u[E++]=192|f>>>6:(f<65536?u[E++]=224|f>>>12:(u[E++]=240|f>>>18,u[E++]=128|f>>>12&63),u[E++]=128|f>>>6&63),u[E++]=128|63&f);return u},s.buf2binstring=function(d){return h(d,d.length)},s.binstring2buf=function(d){for(var u=new n.Buf8(d.length),f=0,p=u.length;f<p;f++)u[f]=d.charCodeAt(f);return u},s.buf2string=function(d,u){var f,p,m,E,g=u||d.length,I=new Array(2*g);for(f=p=0;f<g;)if((m=d[f++])<128)I[p++]=m;else if(4<(E=l[m]))I[p++]=65533,f+=E-1;else{for(m&=E===2?31:E===3?15:7;1<E&&f<g;)m=m<<6|63&d[f++],E--;1<E?I[p++]=65533:m<65536?I[p++]=m:(m-=65536,I[p++]=55296|m>>10&1023,I[p++]=56320|1023&m)}return h(I,p)},s.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+l[d[f]]>u?f:u}},{"./common":41}],43:[function(t,i,s){i.exports=function(n,o,a,l){for(var c=65535&n|0,h=n>>>16&65535|0,d=0;a!==0;){for(a-=d=2e3<a?2e3:a;h=h+(c=c+o[l++]|0)|0,--d;);c%=65521,h%=65521}return c|h<<16|0}},{}],44:[function(t,i,s){i.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,i,s){var n=function(){for(var o,a=[],l=0;l<256;l++){o=l;for(var c=0;c<8;c++)o=1&o?3988292384^o>>>1:o>>>1;a[l]=o}return a}();i.exports=function(o,a,l,c){var h=n,d=c+l;o^=-1;for(var u=c;u<d;u++)o=o>>>8^h[255&(o^a[u])];return-1^o}},{}],46:[function(t,i,s){var n,o=t("../utils/common"),a=t("./trees"),l=t("./adler32"),c=t("./crc32"),h=t("./messages"),d=0,u=4,f=0,p=-2,m=-1,E=4,g=2,I=8,T=9,b=286,v=30,A=19,S=2*b+1,N=15,R=3,P=258,M=P+R+1,w=42,L=113,C=1,U=2,q=3,G=4;function st(_,j){return _.msg=h[j],j}function Y(_){return(_<<1)-(4<_?9:0)}function ot(_){for(var j=_.length;0<=--j;)_[j]=0}function $(_){var j=_.state,V=j.pending;V>_.avail_out&&(V=_.avail_out),V!==0&&(o.arraySet(_.output,j.pending_buf,j.pending_out,V,_.next_out),_.next_out+=V,j.pending_out+=V,_.total_out+=V,_.avail_out-=V,j.pending-=V,j.pending===0&&(j.pending_out=0))}function B(_,j){a._tr_flush_block(_,0<=_.block_start?_.block_start:-1,_.strstart-_.block_start,j),_.block_start=_.strstart,$(_.strm)}function at(_,j){_.pending_buf[_.pending++]=j}function nt(_,j){_.pending_buf[_.pending++]=j>>>8&255,_.pending_buf[_.pending++]=255&j}function it(_,j){var V,x,O=_.max_chain_length,k=_.strstart,Z=_.prev_length,Q=_.nice_match,z=_.strstart>_.w_size-M?_.strstart-(_.w_size-M):0,J=_.window,rt=_.w_mask,et=_.prev,ct=_.strstart+P,Tt=J[k+Z-1],mt=J[k+Z];_.prev_length>=_.good_match&&(O>>=2),Q>_.lookahead&&(Q=_.lookahead);do if(J[(V=j)+Z]===mt&&J[V+Z-1]===Tt&&J[V]===J[k]&&J[++V]===J[k+1]){k+=2,V++;do;while(J[++k]===J[++V]&&J[++k]===J[++V]&&J[++k]===J[++V]&&J[++k]===J[++V]&&J[++k]===J[++V]&&J[++k]===J[++V]&&J[++k]===J[++V]&&J[++k]===J[++V]&&k<ct);if(x=P-(ct-k),k=ct-P,Z<x){if(_.match_start=j,Q<=(Z=x))break;Tt=J[k+Z-1],mt=J[k+Z]}}while((j=et[j&rt])>z&&--O!=0);return Z<=_.lookahead?Z:_.lookahead}function Rt(_){var j,V,x,O,k,Z,Q,z,J,rt,et=_.w_size;do{if(O=_.window_size-_.lookahead-_.strstart,_.strstart>=et+(et-M)){for(o.arraySet(_.window,_.window,et,et,0),_.match_start-=et,_.strstart-=et,_.block_start-=et,j=V=_.hash_size;x=_.head[--j],_.head[j]=et<=x?x-et:0,--V;);for(j=V=et;x=_.prev[--j],_.prev[j]=et<=x?x-et:0,--V;);O+=et}if(_.strm.avail_in===0)break;if(Z=_.strm,Q=_.window,z=_.strstart+_.lookahead,J=O,rt=void 0,rt=Z.avail_in,J<rt&&(rt=J),V=rt===0?0:(Z.avail_in-=rt,o.arraySet(Q,Z.input,Z.next_in,rt,z),Z.state.wrap===1?Z.adler=l(Z.adler,Q,rt,z):Z.state.wrap===2&&(Z.adler=c(Z.adler,Q,rt,z)),Z.next_in+=rt,Z.total_in+=rt,rt),_.lookahead+=V,_.lookahead+_.insert>=R)for(k=_.strstart-_.insert,_.ins_h=_.window[k],_.ins_h=(_.ins_h<<_.hash_shift^_.window[k+1])&_.hash_mask;_.insert&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[k+R-1])&_.hash_mask,_.prev[k&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=k,k++,_.insert--,!(_.lookahead+_.insert<R)););}while(_.lookahead<M&&_.strm.avail_in!==0)}function xt(_,j){for(var V,x;;){if(_.lookahead<M){if(Rt(_),_.lookahead<M&&j===d)return C;if(_.lookahead===0)break}if(V=0,_.lookahead>=R&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+R-1])&_.hash_mask,V=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),V!==0&&_.strstart-V<=_.w_size-M&&(_.match_length=it(_,V)),_.match_length>=R)if(x=a._tr_tally(_,_.strstart-_.match_start,_.match_length-R),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=R){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+R-1])&_.hash_mask,V=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart,--_.match_length!=0;);_.strstart++}else _.strstart+=_.match_length,_.match_length=0,_.ins_h=_.window[_.strstart],_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+1])&_.hash_mask;else x=a._tr_tally(_,0,_.window[_.strstart]),_.lookahead--,_.strstart++;if(x&&(B(_,!1),_.strm.avail_out===0))return C}return _.insert=_.strstart<R-1?_.strstart:R-1,j===u?(B(_,!0),_.strm.avail_out===0?q:G):_.last_lit&&(B(_,!1),_.strm.avail_out===0)?C:U}function lt(_,j){for(var V,x,O;;){if(_.lookahead<M){if(Rt(_),_.lookahead<M&&j===d)return C;if(_.lookahead===0)break}if(V=0,_.lookahead>=R&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+R-1])&_.hash_mask,V=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),_.prev_length=_.match_length,_.prev_match=_.match_start,_.match_length=R-1,V!==0&&_.prev_length<_.max_lazy_match&&_.strstart-V<=_.w_size-M&&(_.match_length=it(_,V),_.match_length<=5&&(_.strategy===1||_.match_length===R&&4096<_.strstart-_.match_start)&&(_.match_length=R-1)),_.prev_length>=R&&_.match_length<=_.prev_length){for(O=_.strstart+_.lookahead-R,x=a._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-R),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=O&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+R-1])&_.hash_mask,V=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=R-1,_.strstart++,x&&(B(_,!1),_.strm.avail_out===0))return C}else if(_.match_available){if((x=a._tr_tally(_,0,_.window[_.strstart-1]))&&B(_,!1),_.strstart++,_.lookahead--,_.strm.avail_out===0)return C}else _.match_available=1,_.strstart++,_.lookahead--}return _.match_available&&(x=a._tr_tally(_,0,_.window[_.strstart-1]),_.match_available=0),_.insert=_.strstart<R-1?_.strstart:R-1,j===u?(B(_,!0),_.strm.avail_out===0?q:G):_.last_lit&&(B(_,!1),_.strm.avail_out===0)?C:U}function pt(_,j,V,x,O){this.good_length=_,this.max_lazy=j,this.nice_length=V,this.max_chain=x,this.func=O}function ft(){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=I,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 o.Buf16(2*S),this.dyn_dtree=new o.Buf16(2*(2*v+1)),this.bl_tree=new o.Buf16(2*(2*A+1)),ot(this.dyn_ltree),ot(this.dyn_dtree),ot(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(N+1),this.heap=new o.Buf16(2*b+1),ot(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*b+1),ot(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 Ct(_){var j;return _&&_.state?(_.total_in=_.total_out=0,_.data_type=g,(j=_.state).pending=0,j.pending_out=0,j.wrap<0&&(j.wrap=-j.wrap),j.status=j.wrap?w:L,_.adler=j.wrap===2?0:1,j.last_flush=d,a._tr_init(j),f):st(_,p)}function Kt(_){var j=Ct(_);return j===f&&function(V){V.window_size=2*V.w_size,ot(V.head),V.max_lazy_match=n[V.level].max_lazy,V.good_match=n[V.level].good_length,V.nice_match=n[V.level].nice_length,V.max_chain_length=n[V.level].max_chain,V.strstart=0,V.block_start=0,V.lookahead=0,V.insert=0,V.match_length=V.prev_length=R-1,V.match_available=0,V.ins_h=0}(_.state),j}function $t(_,j,V,x,O,k){if(!_)return p;var Z=1;if(j===m&&(j=6),x<0?(Z=0,x=-x):15<x&&(Z=2,x-=16),O<1||T<O||V!==I||x<8||15<x||j<0||9<j||k<0||E<k)return st(_,p);x===8&&(x=9);var Q=new ft;return(_.state=Q).strm=_,Q.wrap=Z,Q.gzhead=null,Q.w_bits=x,Q.w_size=1<<Q.w_bits,Q.w_mask=Q.w_size-1,Q.hash_bits=O+7,Q.hash_size=1<<Q.hash_bits,Q.hash_mask=Q.hash_size-1,Q.hash_shift=~~((Q.hash_bits+R-1)/R),Q.window=new o.Buf8(2*Q.w_size),Q.head=new o.Buf16(Q.hash_size),Q.prev=new o.Buf16(Q.w_size),Q.lit_bufsize=1<<O+6,Q.pending_buf_size=4*Q.lit_bufsize,Q.pending_buf=new o.Buf8(Q.pending_buf_size),Q.d_buf=1*Q.lit_bufsize,Q.l_buf=3*Q.lit_bufsize,Q.level=j,Q.strategy=k,Q.method=V,Kt(_)}n=[new pt(0,0,0,0,function(_,j){var V=65535;for(V>_.pending_buf_size-5&&(V=_.pending_buf_size-5);;){if(_.lookahead<=1){if(Rt(_),_.lookahead===0&&j===d)return C;if(_.lookahead===0)break}_.strstart+=_.lookahead,_.lookahead=0;var x=_.block_start+V;if((_.strstart===0||_.strstart>=x)&&(_.lookahead=_.strstart-x,_.strstart=x,B(_,!1),_.strm.avail_out===0)||_.strstart-_.block_start>=_.w_size-M&&(B(_,!1),_.strm.avail_out===0))return C}return _.insert=0,j===u?(B(_,!0),_.strm.avail_out===0?q:G):(_.strstart>_.block_start&&(B(_,!1),_.strm.avail_out),C)}),new pt(4,4,8,4,xt),new pt(4,5,16,8,xt),new pt(4,6,32,32,xt),new pt(4,4,16,16,lt),new pt(8,16,32,32,lt),new pt(8,16,128,128,lt),new pt(8,32,128,256,lt),new pt(32,128,258,1024,lt),new pt(32,258,258,4096,lt)],s.deflateInit=function(_,j){return $t(_,j,I,15,8,0)},s.deflateInit2=$t,s.deflateReset=Kt,s.deflateResetKeep=Ct,s.deflateSetHeader=function(_,j){return _&&_.state?_.state.wrap!==2?p:(_.state.gzhead=j,f):p},s.deflate=function(_,j){var V,x,O,k;if(!_||!_.state||5<j||j<0)return _?st(_,p):p;if(x=_.state,!_.output||!_.input&&_.avail_in!==0||x.status===666&&j!==u)return st(_,_.avail_out===0?-5:p);if(x.strm=_,V=x.last_flush,x.last_flush=j,x.status===w)if(x.wrap===2)_.adler=0,at(x,31),at(x,139),at(x,8),x.gzhead?(at(x,(x.gzhead.text?1:0)+(x.gzhead.hcrc?2:0)+(x.gzhead.extra?4:0)+(x.gzhead.name?8:0)+(x.gzhead.comment?16:0)),at(x,255&x.gzhead.time),at(x,x.gzhead.time>>8&255),at(x,x.gzhead.time>>16&255),at(x,x.gzhead.time>>24&255),at(x,x.level===9?2:2<=x.strategy||x.level<2?4:0),at(x,255&x.gzhead.os),x.gzhead.extra&&x.gzhead.extra.length&&(at(x,255&x.gzhead.extra.length),at(x,x.gzhead.extra.length>>8&255)),x.gzhead.hcrc&&(_.adler=c(_.adler,x.pending_buf,x.pending,0)),x.gzindex=0,x.status=69):(at(x,0),at(x,0),at(x,0),at(x,0),at(x,0),at(x,x.level===9?2:2<=x.strategy||x.level<2?4:0),at(x,3),x.status=L);else{var Z=I+(x.w_bits-8<<4)<<8;Z|=(2<=x.strategy||x.level<2?0:x.level<6?1:x.level===6?2:3)<<6,x.strstart!==0&&(Z|=32),Z+=31-Z%31,x.status=L,nt(x,Z),x.strstart!==0&&(nt(x,_.adler>>>16),nt(x,65535&_.adler)),_.adler=1}if(x.status===69)if(x.gzhead.extra){for(O=x.pending;x.gzindex<(65535&x.gzhead.extra.length)&&(x.pending!==x.pending_buf_size||(x.gzhead.hcrc&&x.pending>O&&(_.adler=c(_.adler,x.pending_buf,x.pending-O,O)),$(_),O=x.pending,x.pending!==x.pending_buf_size));)at(x,255&x.gzhead.extra[x.gzindex]),x.gzindex++;x.gzhead.hcrc&&x.pending>O&&(_.adler=c(_.adler,x.pending_buf,x.pending-O,O)),x.gzindex===x.gzhead.extra.length&&(x.gzindex=0,x.status=73)}else x.status=73;if(x.status===73)if(x.gzhead.name){O=x.pending;do{if(x.pending===x.pending_buf_size&&(x.gzhead.hcrc&&x.pending>O&&(_.adler=c(_.adler,x.pending_buf,x.pending-O,O)),$(_),O=x.pending,x.pending===x.pending_buf_size)){k=1;break}k=x.gzindex<x.gzhead.name.length?255&x.gzhead.name.charCodeAt(x.gzindex++):0,at(x,k)}while(k!==0);x.gzhead.hcrc&&x.pending>O&&(_.adler=c(_.adler,x.pending_buf,x.pending-O,O)),k===0&&(x.gzindex=0,x.status=91)}else x.status=91;if(x.status===91)if(x.gzhead.comment){O=x.pending;do{if(x.pending===x.pending_buf_size&&(x.gzhead.hcrc&&x.pending>O&&(_.adler=c(_.adler,x.pending_buf,x.pending-O,O)),$(_),O=x.pending,x.pending===x.pending_buf_size)){k=1;break}k=x.gzindex<x.gzhead.comment.length?255&x.gzhead.comment.charCodeAt(x.gzindex++):0,at(x,k)}while(k!==0);x.gzhead.hcrc&&x.pending>O&&(_.adler=c(_.adler,x.pending_buf,x.pending-O,O)),k===0&&(x.status=103)}else x.status=103;if(x.status===103&&(x.gzhead.hcrc?(x.pending+2>x.pending_buf_size&&$(_),x.pending+2<=x.pending_buf_size&&(at(x,255&_.adler),at(x,_.adler>>8&255),_.adler=0,x.status=L)):x.status=L),x.pending!==0){if($(_),_.avail_out===0)return x.last_flush=-1,f}else if(_.avail_in===0&&Y(j)<=Y(V)&&j!==u)return st(_,-5);if(x.status===666&&_.avail_in!==0)return st(_,-5);if(_.avail_in!==0||x.lookahead!==0||j!==d&&x.status!==666){var Q=x.strategy===2?function(z,J){for(var rt;;){if(z.lookahead===0&&(Rt(z),z.lookahead===0)){if(J===d)return C;break}if(z.match_length=0,rt=a._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++,rt&&(B(z,!1),z.strm.avail_out===0))return C}return z.insert=0,J===u?(B(z,!0),z.strm.avail_out===0?q:G):z.last_lit&&(B(z,!1),z.strm.avail_out===0)?C:U}(x,j):x.strategy===3?function(z,J){for(var rt,et,ct,Tt,mt=z.window;;){if(z.lookahead<=P){if(Rt(z),z.lookahead<=P&&J===d)return C;if(z.lookahead===0)break}if(z.match_length=0,z.lookahead>=R&&0<z.strstart&&(et=mt[ct=z.strstart-1])===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]){Tt=z.strstart+P;do;while(et===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]&&et===mt[++ct]&&ct<Tt);z.match_length=P-(Tt-ct),z.match_length>z.lookahead&&(z.match_length=z.lookahead)}if(z.match_length>=R?(rt=a._tr_tally(z,1,z.match_length-R),z.lookahead-=z.match_length,z.strstart+=z.match_length,z.match_length=0):(rt=a._tr_tally(z,0,z.window[z.strstart]),z.lookahead--,z.strstart++),rt&&(B(z,!1),z.strm.avail_out===0))return C}return z.insert=0,J===u?(B(z,!0),z.strm.avail_out===0?q:G):z.last_lit&&(B(z,!1),z.strm.avail_out===0)?C:U}(x,j):n[x.level].func(x,j);if(Q!==q&&Q!==G||(x.status=666),Q===C||Q===q)return _.avail_out===0&&(x.last_flush=-1),f;if(Q===U&&(j===1?a._tr_align(x):j!==5&&(a._tr_stored_block(x,0,0,!1),j===3&&(ot(x.head),x.lookahead===0&&(x.strstart=0,x.block_start=0,x.insert=0))),$(_),_.avail_out===0))return x.last_flush=-1,f}return j!==u?f:x.wrap<=0?1:(x.wrap===2?(at(x,255&_.adler),at(x,_.adler>>8&255),at(x,_.adler>>16&255),at(x,_.adler>>24&255),at(x,255&_.total_in),at(x,_.total_in>>8&255),at(x,_.total_in>>16&255),at(x,_.total_in>>24&255)):(nt(x,_.adler>>>16),nt(x,65535&_.adler)),$(_),0<x.wrap&&(x.wrap=-x.wrap),x.pending!==0?f:1)},s.deflateEnd=function(_){var j;return _&&_.state?(j=_.state.status)!==w&&j!==69&&j!==73&&j!==91&&j!==103&&j!==L&&j!==666?st(_,p):(_.state=null,j===L?st(_,-3):f):p},s.deflateSetDictionary=function(_,j){var V,x,O,k,Z,Q,z,J,rt=j.length;if(!_||!_.state||(k=(V=_.state).wrap)===2||k===1&&V.status!==w||V.lookahead)return p;for(k===1&&(_.adler=l(_.adler,j,rt,0)),V.wrap=0,rt>=V.w_size&&(k===0&&(ot(V.head),V.strstart=0,V.block_start=0,V.insert=0),J=new o.Buf8(V.w_size),o.arraySet(J,j,rt-V.w_size,V.w_size,0),j=J,rt=V.w_size),Z=_.avail_in,Q=_.next_in,z=_.input,_.avail_in=rt,_.next_in=0,_.input=j,Rt(V);V.lookahead>=R;){for(x=V.strstart,O=V.lookahead-(R-1);V.ins_h=(V.ins_h<<V.hash_shift^V.window[x+R-1])&V.hash_mask,V.prev[x&V.w_mask]=V.head[V.ins_h],V.head[V.ins_h]=x,x++,--O;);V.strstart=x,V.lookahead=R-1,Rt(V)}return V.strstart+=V.lookahead,V.block_start=V.strstart,V.insert=V.lookahead,V.lookahead=0,V.match_length=V.prev_length=R-1,V.match_available=0,_.next_in=Q,_.input=z,_.avail_in=Z,V.wrap=k,f},s.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,i,s){i.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,i,s){i.exports=function(n,o){var a,l,c,h,d,u,f,p,m,E,g,I,T,b,v,A,S,N,R,P,M,w,L,C,U;a=n.state,l=n.next_in,C=n.input,c=l+(n.avail_in-5),h=n.next_out,U=n.output,d=h-(o-n.avail_out),u=h+(n.avail_out-257),f=a.dmax,p=a.wsize,m=a.whave,E=a.wnext,g=a.window,I=a.hold,T=a.bits,b=a.lencode,v=a.distcode,A=(1<<a.lenbits)-1,S=(1<<a.distbits)-1;t:do{T<15&&(I+=C[l++]<<T,T+=8,I+=C[l++]<<T,T+=8),N=b[I&A];e:for(;;){if(I>>>=R=N>>>24,T-=R,(R=N>>>16&255)===0)U[h++]=65535&N;else{if(!(16&R)){if(!(64&R)){N=b[(65535&N)+(I&(1<<R)-1)];continue e}if(32&R){a.mode=12;break t}n.msg="invalid literal/length code",a.mode=30;break t}P=65535&N,(R&=15)&&(T<R&&(I+=C[l++]<<T,T+=8),P+=I&(1<<R)-1,I>>>=R,T-=R),T<15&&(I+=C[l++]<<T,T+=8,I+=C[l++]<<T,T+=8),N=v[I&S];i:for(;;){if(I>>>=R=N>>>24,T-=R,!(16&(R=N>>>16&255))){if(!(64&R)){N=v[(65535&N)+(I&(1<<R)-1)];continue i}n.msg="invalid distance code",a.mode=30;break t}if(M=65535&N,T<(R&=15)&&(I+=C[l++]<<T,(T+=8)<R&&(I+=C[l++]<<T,T+=8)),f<(M+=I&(1<<R)-1)){n.msg="invalid distance too far back",a.mode=30;break t}if(I>>>=R,T-=R,(R=h-d)<M){if(m<(R=M-R)&&a.sane){n.msg="invalid distance too far back",a.mode=30;break t}if(L=g,(w=0)===E){if(w+=p-R,R<P){for(P-=R;U[h++]=g[w++],--R;);w=h-M,L=U}}else if(E<R){if(w+=p+E-R,(R-=E)<P){for(P-=R;U[h++]=g[w++],--R;);if(w=0,E<P){for(P-=R=E;U[h++]=g[w++],--R;);w=h-M,L=U}}}else if(w+=E-R,R<P){for(P-=R;U[h++]=g[w++],--R;);w=h-M,L=U}for(;2<P;)U[h++]=L[w++],U[h++]=L[w++],U[h++]=L[w++],P-=3;P&&(U[h++]=L[w++],1<P&&(U[h++]=L[w++]))}else{for(w=h-M;U[h++]=U[w++],U[h++]=U[w++],U[h++]=U[w++],2<(P-=3););P&&(U[h++]=U[w++],1<P&&(U[h++]=U[w++]))}break}}break}}while(l<c&&h<u);l-=P=T>>3,I&=(1<<(T-=P<<3))-1,n.next_in=l,n.next_out=h,n.avail_in=l<c?c-l+5:5-(l-c),n.avail_out=h<u?u-h+257:257-(h-u),a.hold=I,a.bits=T}},{}],49:[function(t,i,s){var n=t("../utils/common"),o=t("./adler32"),a=t("./crc32"),l=t("./inffast"),c=t("./inftrees"),h=1,d=2,u=0,f=-2,p=1,m=852,E=592;function g(w){return(w>>>24&255)+(w>>>8&65280)+((65280&w)<<8)+((255&w)<<24)}function I(){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 T(w){var L;return w&&w.state?(L=w.state,w.total_in=w.total_out=L.total=0,w.msg="",L.wrap&&(w.adler=1&L.wrap),L.mode=p,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(m),L.distcode=L.distdyn=new n.Buf32(E),L.sane=1,L.back=-1,u):f}function b(w){var L;return w&&w.state?((L=w.state).wsize=0,L.whave=0,L.wnext=0,T(w)):f}function v(w,L){var C,U;return w&&w.state?(U=w.state,L<0?(C=0,L=-L):(C=1+(L>>4),L<48&&(L&=15)),L&&(L<8||15<L)?f:(U.window!==null&&U.wbits!==L&&(U.window=null),U.wrap=C,U.wbits=L,b(w))):f}function A(w,L){var C,U;return w?(U=new I,(w.state=U).window=null,(C=v(w,L))!==u&&(w.state=null),C):f}var S,N,R=!0;function P(w){if(R){var L;for(S=new n.Buf32(512),N=new n.Buf32(32),L=0;L<144;)w.lens[L++]=8;for(;L<256;)w.lens[L++]=9;for(;L<280;)w.lens[L++]=7;for(;L<288;)w.lens[L++]=8;for(c(h,w.lens,0,288,S,0,w.work,{bits:9}),L=0;L<32;)w.lens[L++]=5;c(d,w.lens,0,32,N,0,w.work,{bits:5}),R=!1}w.lencode=S,w.lenbits=9,w.distcode=N,w.distbits=5}function M(w,L,C,U){var q,G=w.state;return G.window===null&&(G.wsize=1<<G.wbits,G.wnext=0,G.whave=0,G.window=new n.Buf8(G.wsize)),U>=G.wsize?(n.arraySet(G.window,L,C-G.wsize,G.wsize,0),G.wnext=0,G.whave=G.wsize):(U<(q=G.wsize-G.wnext)&&(q=U),n.arraySet(G.window,L,C-U,q,G.wnext),(U-=q)?(n.arraySet(G.window,L,C-U,U,0),G.wnext=U,G.whave=G.wsize):(G.wnext+=q,G.wnext===G.wsize&&(G.wnext=0),G.whave<G.wsize&&(G.whave+=q))),0}s.inflateReset=b,s.inflateReset2=v,s.inflateResetKeep=T,s.inflateInit=function(w){return A(w,15)},s.inflateInit2=A,s.inflate=function(w,L){var C,U,q,G,st,Y,ot,$,B,at,nt,it,Rt,xt,lt,pt,ft,Ct,Kt,$t,_,j,V,x,O=0,k=new n.Buf8(4),Z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!w||!w.state||!w.output||!w.input&&w.avail_in!==0)return f;(C=w.state).mode===12&&(C.mode=13),st=w.next_out,q=w.output,ot=w.avail_out,G=w.next_in,U=w.input,Y=w.avail_in,$=C.hold,B=C.bits,at=Y,nt=ot,j=u;t:for(;;)switch(C.mode){case p:if(C.wrap===0){C.mode=13;break}for(;B<16;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if(2&C.wrap&&$===35615){k[C.check=0]=255&$,k[1]=$>>>8&255,C.check=a(C.check,k,2,0),B=$=0,C.mode=2;break}if(C.flags=0,C.head&&(C.head.done=!1),!(1&C.wrap)||(((255&$)<<8)+($>>8))%31){w.msg="incorrect header check",C.mode=30;break}if((15&$)!=8){w.msg="unknown compression method",C.mode=30;break}if(B-=4,_=8+(15&($>>>=4)),C.wbits===0)C.wbits=_;else if(_>C.wbits){w.msg="invalid window size",C.mode=30;break}C.dmax=1<<_,w.adler=C.check=1,C.mode=512&$?10:12,B=$=0;break;case 2:for(;B<16;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if(C.flags=$,(255&C.flags)!=8){w.msg="unknown compression method",C.mode=30;break}if(57344&C.flags){w.msg="unknown header flags set",C.mode=30;break}C.head&&(C.head.text=$>>8&1),512&C.flags&&(k[0]=255&$,k[1]=$>>>8&255,C.check=a(C.check,k,2,0)),B=$=0,C.mode=3;case 3:for(;B<32;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}C.head&&(C.head.time=$),512&C.flags&&(k[0]=255&$,k[1]=$>>>8&255,k[2]=$>>>16&255,k[3]=$>>>24&255,C.check=a(C.check,k,4,0)),B=$=0,C.mode=4;case 4:for(;B<16;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}C.head&&(C.head.xflags=255&$,C.head.os=$>>8),512&C.flags&&(k[0]=255&$,k[1]=$>>>8&255,C.check=a(C.check,k,2,0)),B=$=0,C.mode=5;case 5:if(1024&C.flags){for(;B<16;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}C.length=$,C.head&&(C.head.extra_len=$),512&C.flags&&(k[0]=255&$,k[1]=$>>>8&255,C.check=a(C.check,k,2,0)),B=$=0}else C.head&&(C.head.extra=null);C.mode=6;case 6:if(1024&C.flags&&(Y<(it=C.length)&&(it=Y),it&&(C.head&&(_=C.head.extra_len-C.length,C.head.extra||(C.head.extra=new Array(C.head.extra_len)),n.arraySet(C.head.extra,U,G,it,_)),512&C.flags&&(C.check=a(C.check,U,it,G)),Y-=it,G+=it,C.length-=it),C.length))break t;C.length=0,C.mode=7;case 7:if(2048&C.flags){if(Y===0)break t;for(it=0;_=U[G+it++],C.head&&_&&C.length<65536&&(C.head.name+=String.fromCharCode(_)),_&&it<Y;);if(512&C.flags&&(C.check=a(C.check,U,it,G)),Y-=it,G+=it,_)break t}else C.head&&(C.head.name=null);C.length=0,C.mode=8;case 8:if(4096&C.flags){if(Y===0)break t;for(it=0;_=U[G+it++],C.head&&_&&C.length<65536&&(C.head.comment+=String.fromCharCode(_)),_&&it<Y;);if(512&C.flags&&(C.check=a(C.check,U,it,G)),Y-=it,G+=it,_)break t}else C.head&&(C.head.comment=null);C.mode=9;case 9:if(512&C.flags){for(;B<16;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if($!==(65535&C.check)){w.msg="header crc mismatch",C.mode=30;break}B=$=0}C.head&&(C.head.hcrc=C.flags>>9&1,C.head.done=!0),w.adler=C.check=0,C.mode=12;break;case 10:for(;B<32;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}w.adler=C.check=g($),B=$=0,C.mode=11;case 11:if(C.havedict===0)return w.next_out=st,w.avail_out=ot,w.next_in=G,w.avail_in=Y,C.hold=$,C.bits=B,2;w.adler=C.check=1,C.mode=12;case 12:if(L===5||L===6)break t;case 13:if(C.last){$>>>=7&B,B-=7&B,C.mode=27;break}for(;B<3;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}switch(C.last=1&$,B-=1,3&($>>>=1)){case 0:C.mode=14;break;case 1:if(P(C),C.mode=20,L!==6)break;$>>>=2,B-=2;break t;case 2:C.mode=17;break;case 3:w.msg="invalid block type",C.mode=30}$>>>=2,B-=2;break;case 14:for($>>>=7&B,B-=7&B;B<32;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if((65535&$)!=($>>>16^65535)){w.msg="invalid stored block lengths",C.mode=30;break}if(C.length=65535&$,B=$=0,C.mode=15,L===6)break t;case 15:C.mode=16;case 16:if(it=C.length){if(Y<it&&(it=Y),ot<it&&(it=ot),it===0)break t;n.arraySet(q,U,G,it,st),Y-=it,G+=it,ot-=it,st+=it,C.length-=it;break}C.mode=12;break;case 17:for(;B<14;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if(C.nlen=257+(31&$),$>>>=5,B-=5,C.ndist=1+(31&$),$>>>=5,B-=5,C.ncode=4+(15&$),$>>>=4,B-=4,286<C.nlen||30<C.ndist){w.msg="too many length or distance symbols",C.mode=30;break}C.have=0,C.mode=18;case 18:for(;C.have<C.ncode;){for(;B<3;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}C.lens[Z[C.have++]]=7&$,$>>>=3,B-=3}for(;C.have<19;)C.lens[Z[C.have++]]=0;if(C.lencode=C.lendyn,C.lenbits=7,V={bits:C.lenbits},j=c(0,C.lens,0,19,C.lencode,0,C.work,V),C.lenbits=V.bits,j){w.msg="invalid code lengths set",C.mode=30;break}C.have=0,C.mode=19;case 19:for(;C.have<C.nlen+C.ndist;){for(;pt=(O=C.lencode[$&(1<<C.lenbits)-1])>>>16&255,ft=65535&O,!((lt=O>>>24)<=B);){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if(ft<16)$>>>=lt,B-=lt,C.lens[C.have++]=ft;else{if(ft===16){for(x=lt+2;B<x;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if($>>>=lt,B-=lt,C.have===0){w.msg="invalid bit length repeat",C.mode=30;break}_=C.lens[C.have-1],it=3+(3&$),$>>>=2,B-=2}else if(ft===17){for(x=lt+3;B<x;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}B-=lt,_=0,it=3+(7&($>>>=lt)),$>>>=3,B-=3}else{for(x=lt+7;B<x;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}B-=lt,_=0,it=11+(127&($>>>=lt)),$>>>=7,B-=7}if(C.have+it>C.nlen+C.ndist){w.msg="invalid bit length repeat",C.mode=30;break}for(;it--;)C.lens[C.have++]=_}}if(C.mode===30)break;if(C.lens[256]===0){w.msg="invalid code -- missing end-of-block",C.mode=30;break}if(C.lenbits=9,V={bits:C.lenbits},j=c(h,C.lens,0,C.nlen,C.lencode,0,C.work,V),C.lenbits=V.bits,j){w.msg="invalid literal/lengths set",C.mode=30;break}if(C.distbits=6,C.distcode=C.distdyn,V={bits:C.distbits},j=c(d,C.lens,C.nlen,C.ndist,C.distcode,0,C.work,V),C.distbits=V.bits,j){w.msg="invalid distances set",C.mode=30;break}if(C.mode=20,L===6)break t;case 20:C.mode=21;case 21:if(6<=Y&&258<=ot){w.next_out=st,w.avail_out=ot,w.next_in=G,w.avail_in=Y,C.hold=$,C.bits=B,l(w,nt),st=w.next_out,q=w.output,ot=w.avail_out,G=w.next_in,U=w.input,Y=w.avail_in,$=C.hold,B=C.bits,C.mode===12&&(C.back=-1);break}for(C.back=0;pt=(O=C.lencode[$&(1<<C.lenbits)-1])>>>16&255,ft=65535&O,!((lt=O>>>24)<=B);){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if(pt&&!(240&pt)){for(Ct=lt,Kt=pt,$t=ft;pt=(O=C.lencode[$t+(($&(1<<Ct+Kt)-1)>>Ct)])>>>16&255,ft=65535&O,!(Ct+(lt=O>>>24)<=B);){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}$>>>=Ct,B-=Ct,C.back+=Ct}if($>>>=lt,B-=lt,C.back+=lt,C.length=ft,pt===0){C.mode=26;break}if(32&pt){C.back=-1,C.mode=12;break}if(64&pt){w.msg="invalid literal/length code",C.mode=30;break}C.extra=15&pt,C.mode=22;case 22:if(C.extra){for(x=C.extra;B<x;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}C.length+=$&(1<<C.extra)-1,$>>>=C.extra,B-=C.extra,C.back+=C.extra}C.was=C.length,C.mode=23;case 23:for(;pt=(O=C.distcode[$&(1<<C.distbits)-1])>>>16&255,ft=65535&O,!((lt=O>>>24)<=B);){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if(!(240&pt)){for(Ct=lt,Kt=pt,$t=ft;pt=(O=C.distcode[$t+(($&(1<<Ct+Kt)-1)>>Ct)])>>>16&255,ft=65535&O,!(Ct+(lt=O>>>24)<=B);){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}$>>>=Ct,B-=Ct,C.back+=Ct}if($>>>=lt,B-=lt,C.back+=lt,64&pt){w.msg="invalid distance code",C.mode=30;break}C.offset=ft,C.extra=15&pt,C.mode=24;case 24:if(C.extra){for(x=C.extra;B<x;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}C.offset+=$&(1<<C.extra)-1,$>>>=C.extra,B-=C.extra,C.back+=C.extra}if(C.offset>C.dmax){w.msg="invalid distance too far back",C.mode=30;break}C.mode=25;case 25:if(ot===0)break t;if(it=nt-ot,C.offset>it){if((it=C.offset-it)>C.whave&&C.sane){w.msg="invalid distance too far back",C.mode=30;break}Rt=it>C.wnext?(it-=C.wnext,C.wsize-it):C.wnext-it,it>C.length&&(it=C.length),xt=C.window}else xt=q,Rt=st-C.offset,it=C.length;for(ot<it&&(it=ot),ot-=it,C.length-=it;q[st++]=xt[Rt++],--it;);C.length===0&&(C.mode=21);break;case 26:if(ot===0)break t;q[st++]=C.length,ot--,C.mode=21;break;case 27:if(C.wrap){for(;B<32;){if(Y===0)break t;Y--,$|=U[G++]<<B,B+=8}if(nt-=ot,w.total_out+=nt,C.total+=nt,nt&&(w.adler=C.check=C.flags?a(C.check,q,nt,st-nt):o(C.check,q,nt,st-nt)),nt=ot,(C.flags?$:g($))!==C.check){w.msg="incorrect data check",C.mode=30;break}B=$=0}C.mode=28;case 28:if(C.wrap&&C.flags){for(;B<32;){if(Y===0)break t;Y--,$+=U[G++]<<B,B+=8}if($!==(4294967295&C.total)){w.msg="incorrect length check",C.mode=30;break}B=$=0}C.mode=29;case 29:j=1;break t;case 30:j=-3;break t;case 31:return-4;case 32:default:return f}return w.next_out=st,w.avail_out=ot,w.next_in=G,w.avail_in=Y,C.hold=$,C.bits=B,(C.wsize||nt!==w.avail_out&&C.mode<30&&(C.mode<27||L!==4))&&M(w,w.output,w.next_out,nt-w.avail_out)?(C.mode=31,-4):(at-=w.avail_in,nt-=w.avail_out,w.total_in+=at,w.total_out+=nt,C.total+=nt,C.wrap&&nt&&(w.adler=C.check=C.flags?a(C.check,q,nt,w.next_out-nt):o(C.check,q,nt,w.next_out-nt)),w.data_type=C.bits+(C.last?64:0)+(C.mode===12?128:0)+(C.mode===20||C.mode===15?256:0),(at==0&&nt===0||L===4)&&j===u&&(j=-5),j)},s.inflateEnd=function(w){if(!w||!w.state)return f;var L=w.state;return L.window&&(L.window=null),w.state=null,u},s.inflateGetHeader=function(w,L){var C;return w&&w.state&&2&(C=w.state).wrap?((C.head=L).done=!1,u):f},s.inflateSetDictionary=function(w,L){var C,U=L.length;return w&&w.state?(C=w.state).wrap!==0&&C.mode!==11?f:C.mode===11&&o(1,L,U,0)!==C.check?-3:M(w,L,U,U)?(C.mode=31,-4):(C.havedict=1,u):f},s.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,i,s){var n=t("../utils/common"),o=[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],a=[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],l=[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],c=[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];i.exports=function(h,d,u,f,p,m,E,g){var I,T,b,v,A,S,N,R,P,M=g.bits,w=0,L=0,C=0,U=0,q=0,G=0,st=0,Y=0,ot=0,$=0,B=null,at=0,nt=new n.Buf16(16),it=new n.Buf16(16),Rt=null,xt=0;for(w=0;w<=15;w++)nt[w]=0;for(L=0;L<f;L++)nt[d[u+L]]++;for(q=M,U=15;1<=U&&nt[U]===0;U--);if(U<q&&(q=U),U===0)return p[m++]=20971520,p[m++]=20971520,g.bits=1,0;for(C=1;C<U&&nt[C]===0;C++);for(q<C&&(q=C),w=Y=1;w<=15;w++)if(Y<<=1,(Y-=nt[w])<0)return-1;if(0<Y&&(h===0||U!==1))return-1;for(it[1]=0,w=1;w<15;w++)it[w+1]=it[w]+nt[w];for(L=0;L<f;L++)d[u+L]!==0&&(E[it[d[u+L]]++]=L);if(S=h===0?(B=Rt=E,19):h===1?(B=o,at-=257,Rt=a,xt-=257,256):(B=l,Rt=c,-1),w=C,A=m,st=L=$=0,b=-1,v=(ot=1<<(G=q))-1,h===1&&852<ot||h===2&&592<ot)return 1;for(;;){for(N=w-st,P=E[L]<S?(R=0,E[L]):E[L]>S?(R=Rt[xt+E[L]],B[at+E[L]]):(R=96,0),I=1<<w-st,C=T=1<<G;p[A+($>>st)+(T-=I)]=N<<24|R<<16|P|0,T!==0;);for(I=1<<w-1;$&I;)I>>=1;if(I!==0?($&=I-1,$+=I):$=0,L++,--nt[w]==0){if(w===U)break;w=d[u+E[L]]}if(q<w&&($&v)!==b){for(st===0&&(st=q),A+=C,Y=1<<(G=w-st);G+st<U&&!((Y-=nt[G+st])<=0);)G++,Y<<=1;if(ot+=1<<G,h===1&&852<ot||h===2&&592<ot)return 1;p[b=$&v]=q<<24|G<<16|A-m|0}}return $!==0&&(p[A+$]=w-st<<24|64<<16|0),g.bits=q,0}},{"../utils/common":41}],51:[function(t,i,s){i.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,i,s){var n=t("../utils/common"),o=0,a=1;function l(O){for(var k=O.length;0<=--k;)O[k]=0}var c=0,h=29,d=256,u=d+1+h,f=30,p=19,m=2*u+1,E=15,g=16,I=7,T=256,b=16,v=17,A=18,S=[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],N=[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],R=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],P=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],M=new Array(2*(u+2));l(M);var w=new Array(2*f);l(w);var L=new Array(512);l(L);var C=new Array(256);l(C);var U=new Array(h);l(U);var q,G,st,Y=new Array(f);function ot(O,k,Z,Q,z){this.static_tree=O,this.extra_bits=k,this.extra_base=Z,this.elems=Q,this.max_length=z,this.has_stree=O&&O.length}function $(O,k){this.dyn_tree=O,this.max_code=0,this.stat_desc=k}function B(O){return O<256?L[O]:L[256+(O>>>7)]}function at(O,k){O.pending_buf[O.pending++]=255&k,O.pending_buf[O.pending++]=k>>>8&255}function nt(O,k,Z){O.bi_valid>g-Z?(O.bi_buf|=k<<O.bi_valid&65535,at(O,O.bi_buf),O.bi_buf=k>>g-O.bi_valid,O.bi_valid+=Z-g):(O.bi_buf|=k<<O.bi_valid&65535,O.bi_valid+=Z)}function it(O,k,Z){nt(O,Z[2*k],Z[2*k+1])}function Rt(O,k){for(var Z=0;Z|=1&O,O>>>=1,Z<<=1,0<--k;);return Z>>>1}function xt(O,k,Z){var Q,z,J=new Array(E+1),rt=0;for(Q=1;Q<=E;Q++)J[Q]=rt=rt+Z[Q-1]<<1;for(z=0;z<=k;z++){var et=O[2*z+1];et!==0&&(O[2*z]=Rt(J[et]++,et))}}function lt(O){var k;for(k=0;k<u;k++)O.dyn_ltree[2*k]=0;for(k=0;k<f;k++)O.dyn_dtree[2*k]=0;for(k=0;k<p;k++)O.bl_tree[2*k]=0;O.dyn_ltree[2*T]=1,O.opt_len=O.static_len=0,O.last_lit=O.matches=0}function pt(O){8<O.bi_valid?at(O,O.bi_buf):0<O.bi_valid&&(O.pending_buf[O.pending++]=O.bi_buf),O.bi_buf=0,O.bi_valid=0}function ft(O,k,Z,Q){var z=2*k,J=2*Z;return O[z]<O[J]||O[z]===O[J]&&Q[k]<=Q[Z]}function Ct(O,k,Z){for(var Q=O.heap[Z],z=Z<<1;z<=O.heap_len&&(z<O.heap_len&&ft(k,O.heap[z+1],O.heap[z],O.depth)&&z++,!ft(k,Q,O.heap[z],O.depth));)O.heap[Z]=O.heap[z],Z=z,z<<=1;O.heap[Z]=Q}function Kt(O,k,Z){var Q,z,J,rt,et=0;if(O.last_lit!==0)for(;Q=O.pending_buf[O.d_buf+2*et]<<8|O.pending_buf[O.d_buf+2*et+1],z=O.pending_buf[O.l_buf+et],et++,Q===0?it(O,z,k):(it(O,(J=C[z])+d+1,k),(rt=S[J])!==0&&nt(O,z-=U[J],rt),it(O,J=B(--Q),Z),(rt=N[J])!==0&&nt(O,Q-=Y[J],rt)),et<O.last_lit;);it(O,T,k)}function $t(O,k){var Z,Q,z,J=k.dyn_tree,rt=k.stat_desc.static_tree,et=k.stat_desc.has_stree,ct=k.stat_desc.elems,Tt=-1;for(O.heap_len=0,O.heap_max=m,Z=0;Z<ct;Z++)J[2*Z]!==0?(O.heap[++O.heap_len]=Tt=Z,O.depth[Z]=0):J[2*Z+1]=0;for(;O.heap_len<2;)J[2*(z=O.heap[++O.heap_len]=Tt<2?++Tt:0)]=1,O.depth[z]=0,O.opt_len--,et&&(O.static_len-=rt[2*z+1]);for(k.max_code=Tt,Z=O.heap_len>>1;1<=Z;Z--)Ct(O,J,Z);for(z=ct;Z=O.heap[1],O.heap[1]=O.heap[O.heap_len--],Ct(O,J,1),Q=O.heap[1],O.heap[--O.heap_max]=Z,O.heap[--O.heap_max]=Q,J[2*z]=J[2*Z]+J[2*Q],O.depth[z]=(O.depth[Z]>=O.depth[Q]?O.depth[Z]:O.depth[Q])+1,J[2*Z+1]=J[2*Q+1]=z,O.heap[1]=z++,Ct(O,J,1),2<=O.heap_len;);O.heap[--O.heap_max]=O.heap[1],function(mt,Jt){var cs,Ee,hs,Nt,un,Jr,Se=Jt.dyn_tree,Ba=Jt.max_code,Gd=Jt.stat_desc.static_tree,Hd=Jt.stat_desc.has_stree,Yd=Jt.stat_desc.extra_bits,za=Jt.stat_desc.extra_base,ds=Jt.stat_desc.max_length,fn=0;for(Nt=0;Nt<=E;Nt++)mt.bl_count[Nt]=0;for(Se[2*mt.heap[mt.heap_max]+1]=0,cs=mt.heap_max+1;cs<m;cs++)ds<(Nt=Se[2*Se[2*(Ee=mt.heap[cs])+1]+1]+1)&&(Nt=ds,fn++),Se[2*Ee+1]=Nt,Ba<Ee||(mt.bl_count[Nt]++,un=0,za<=Ee&&(un=Yd[Ee-za]),Jr=Se[2*Ee],mt.opt_len+=Jr*(Nt+un),Hd&&(mt.static_len+=Jr*(Gd[2*Ee+1]+un)));if(fn!==0){do{for(Nt=ds-1;mt.bl_count[Nt]===0;)Nt--;mt.bl_count[Nt]--,mt.bl_count[Nt+1]+=2,mt.bl_count[ds]--,fn-=2}while(0<fn);for(Nt=ds;Nt!==0;Nt--)for(Ee=mt.bl_count[Nt];Ee!==0;)Ba<(hs=mt.heap[--cs])||(Se[2*hs+1]!==Nt&&(mt.opt_len+=(Nt-Se[2*hs+1])*Se[2*hs],Se[2*hs+1]=Nt),Ee--)}}(O,k),xt(J,Tt,O.bl_count)}function _(O,k,Z){var Q,z,J=-1,rt=k[1],et=0,ct=7,Tt=4;for(rt===0&&(ct=138,Tt=3),k[2*(Z+1)+1]=65535,Q=0;Q<=Z;Q++)z=rt,rt=k[2*(Q+1)+1],++et<ct&&z===rt||(et<Tt?O.bl_tree[2*z]+=et:z!==0?(z!==J&&O.bl_tree[2*z]++,O.bl_tree[2*b]++):et<=10?O.bl_tree[2*v]++:O.bl_tree[2*A]++,J=z,Tt=(et=0)===rt?(ct=138,3):z===rt?(ct=6,3):(ct=7,4))}function j(O,k,Z){var Q,z,J=-1,rt=k[1],et=0,ct=7,Tt=4;for(rt===0&&(ct=138,Tt=3),Q=0;Q<=Z;Q++)if(z=rt,rt=k[2*(Q+1)+1],!(++et<ct&&z===rt)){if(et<Tt)for(;it(O,z,O.bl_tree),--et!=0;);else z!==0?(z!==J&&(it(O,z,O.bl_tree),et--),it(O,b,O.bl_tree),nt(O,et-3,2)):et<=10?(it(O,v,O.bl_tree),nt(O,et-3,3)):(it(O,A,O.bl_tree),nt(O,et-11,7));J=z,Tt=(et=0)===rt?(ct=138,3):z===rt?(ct=6,3):(ct=7,4)}}l(Y);var V=!1;function x(O,k,Z,Q){nt(O,(c<<1)+(Q?1:0),3),function(z,J,rt,et){pt(z),at(z,rt),at(z,~rt),n.arraySet(z.pending_buf,z.window,J,rt,z.pending),z.pending+=rt}(O,k,Z)}s._tr_init=function(O){V||(function(){var k,Z,Q,z,J,rt=new Array(E+1);for(z=Q=0;z<h-1;z++)for(U[z]=Q,k=0;k<1<<S[z];k++)C[Q++]=z;for(C[Q-1]=z,z=J=0;z<16;z++)for(Y[z]=J,k=0;k<1<<N[z];k++)L[J++]=z;for(J>>=7;z<f;z++)for(Y[z]=J<<7,k=0;k<1<<N[z]-7;k++)L[256+J++]=z;for(Z=0;Z<=E;Z++)rt[Z]=0;for(k=0;k<=143;)M[2*k+1]=8,k++,rt[8]++;for(;k<=255;)M[2*k+1]=9,k++,rt[9]++;for(;k<=279;)M[2*k+1]=7,k++,rt[7]++;for(;k<=287;)M[2*k+1]=8,k++,rt[8]++;for(xt(M,u+1,rt),k=0;k<f;k++)w[2*k+1]=5,w[2*k]=Rt(k,5);q=new ot(M,S,d+1,u,E),G=new ot(w,N,0,f,E),st=new ot(new Array(0),R,0,p,I)}(),V=!0),O.l_desc=new $(O.dyn_ltree,q),O.d_desc=new $(O.dyn_dtree,G),O.bl_desc=new $(O.bl_tree,st),O.bi_buf=0,O.bi_valid=0,lt(O)},s._tr_stored_block=x,s._tr_flush_block=function(O,k,Z,Q){var z,J,rt=0;0<O.level?(O.strm.data_type===2&&(O.strm.data_type=function(et){var ct,Tt=4093624447;for(ct=0;ct<=31;ct++,Tt>>>=1)if(1&Tt&&et.dyn_ltree[2*ct]!==0)return o;if(et.dyn_ltree[18]!==0||et.dyn_ltree[20]!==0||et.dyn_ltree[26]!==0)return a;for(ct=32;ct<d;ct++)if(et.dyn_ltree[2*ct]!==0)return a;return o}(O)),$t(O,O.l_desc),$t(O,O.d_desc),rt=function(et){var ct;for(_(et,et.dyn_ltree,et.l_desc.max_code),_(et,et.dyn_dtree,et.d_desc.max_code),$t(et,et.bl_desc),ct=p-1;3<=ct&&et.bl_tree[2*P[ct]+1]===0;ct--);return et.opt_len+=3*(ct+1)+5+5+4,ct}(O),z=O.opt_len+3+7>>>3,(J=O.static_len+3+7>>>3)<=z&&(z=J)):z=J=Z+5,Z+4<=z&&k!==-1?x(O,k,Z,Q):O.strategy===4||J===z?(nt(O,2+(Q?1:0),3),Kt(O,M,w)):(nt(O,4+(Q?1:0),3),function(et,ct,Tt,mt){var Jt;for(nt(et,ct-257,5),nt(et,Tt-1,5),nt(et,mt-4,4),Jt=0;Jt<mt;Jt++)nt(et,et.bl_tree[2*P[Jt]+1],3);j(et,et.dyn_ltree,ct-1),j(et,et.dyn_dtree,Tt-1)}(O,O.l_desc.max_code+1,O.d_desc.max_code+1,rt+1),Kt(O,O.dyn_ltree,O.dyn_dtree)),lt(O),Q&&pt(O)},s._tr_tally=function(O,k,Z){return O.pending_buf[O.d_buf+2*O.last_lit]=k>>>8&255,O.pending_buf[O.d_buf+2*O.last_lit+1]=255&k,O.pending_buf[O.l_buf+O.last_lit]=255&Z,O.last_lit++,k===0?O.dyn_ltree[2*Z]++:(O.matches++,k--,O.dyn_ltree[2*(C[Z]+d+1)]++,O.dyn_dtree[2*B(k)]++),O.last_lit===O.lit_bufsize-1},s._tr_align=function(O){nt(O,2,3),it(O,T,M),function(k){k.bi_valid===16?(at(k,k.bi_buf),k.bi_buf=0,k.bi_valid=0):8<=k.bi_valid&&(k.pending_buf[k.pending++]=255&k.bi_buf,k.bi_buf>>=8,k.bi_valid-=8)}(O)}},{"../utils/common":41}],53:[function(t,i,s){i.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,i,s){(function(n){(function(o,a){if(!o.setImmediate){var l,c,h,d,u=1,f={},p=!1,m=o.document,E=Object.getPrototypeOf&&Object.getPrototypeOf(o);E=E&&E.setTimeout?E:o,l={}.toString.call(o.process)==="[object process]"?function(b){process.nextTick(function(){I(b)})}:function(){if(o.postMessage&&!o.importScripts){var b=!0,v=o.onmessage;return o.onmessage=function(){b=!1},o.postMessage("","*"),o.onmessage=v,b}}()?(d="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",T,!1):o.attachEvent("onmessage",T),function(b){o.postMessage(d+b,"*")}):o.MessageChannel?((h=new MessageChannel).port1.onmessage=function(b){I(b.data)},function(b){h.port2.postMessage(b)}):m&&"onreadystatechange"in m.createElement("script")?(c=m.documentElement,function(b){var v=m.createElement("script");v.onreadystatechange=function(){I(b),v.onreadystatechange=null,c.removeChild(v),v=null},c.appendChild(v)}):function(b){setTimeout(I,0,b)},E.setImmediate=function(b){typeof b!="function"&&(b=new Function(""+b));for(var v=new Array(arguments.length-1),A=0;A<v.length;A++)v[A]=arguments[A+1];var S={callback:b,args:v};return f[u]=S,l(u),u++},E.clearImmediate=g}function g(b){delete f[b]}function I(b){if(p)setTimeout(I,0,b);else{var v=f[b];if(v){p=!0;try{(function(A){var S=A.callback,N=A.args;switch(N.length){case 0:S();break;case 1:S(N[0]);break;case 2:S(N[0],N[1]);break;case 3:S(N[0],N[1],N[2]);break;default:S.apply(a,N)}})(v)}finally{g(b),p=!1}}}}function T(b){b.source===o&&typeof b.data=="string"&&b.data.indexOf(d)===0&&I(+b.data.slice(d.length))}})(typeof self>"u"?n===void 0?this:n:self)}).call(this,typeof Un<"u"?Un:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Wc);var Ff=Wc.exports;const Tl=Sf(Ff);var ga={},Ur={};(function(r){const e=":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=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",i="["+e+"]["+t+"]*",s=new RegExp("^"+i+"$"),n=function(a,l){const c=[];let h=l.exec(a);for(;h;){const d=[];d.startIndex=l.lastIndex-h[0].length;const u=h.length;for(let f=0;f<u;f++)d.push(h[f]);c.push(d),h=l.exec(a)}return c},o=function(a){const l=s.exec(a);return!(l===null||typeof l>"u")};r.isExist=function(a){return typeof a<"u"},r.isEmptyObject=function(a){return Object.keys(a).length===0},r.merge=function(a,l,c){if(l){const h=Object.keys(l),d=h.length;for(let u=0;u<d;u++)c==="strict"?a[h[u]]=[l[h[u]]]:a[h[u]]=l[h[u]]}},r.getValue=function(a){return r.isExist(a)?a:""},r.isName=o,r.getAllMatches=n,r.nameRegexp=i})(Ur);const Ea=Ur,Of={allowBooleanAttributes:!1,unpairedTags:[]};ga.validate=function(r,e){e=Object.assign({},Of,e);const t=[];let i=!1,s=!1;r[0]==="\uFEFF"&&(r=r.substr(1));for(let n=0;n<r.length;n++)if(r[n]==="<"&&r[n+1]==="?"){if(n+=2,n=wl(r,n),n.err)return n}else if(r[n]==="<"){let o=n;if(n++,r[n]==="!"){n=Al(r,n);continue}else{let a=!1;r[n]==="/"&&(a=!0,n++);let l="";for(;n<r.length&&r[n]!==">"&&r[n]!==" "&&r[n]!==" "&&r[n]!==`
140
+ `&&r[n]!=="\r";n++)l+=r[n];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),n--),!kf(l)){let d;return l.trim().length===0?d="Invalid space after '<'.":d="Tag '"+l+"' is an invalid name.",Lt("InvalidTag",d,Yt(r,n))}const c=Pf(r,n);if(c===!1)return Lt("InvalidAttr","Attributes for '"+l+"' have open quote.",Yt(r,n));let h=c.value;if(n=c.index,h[h.length-1]==="/"){const d=n-h.length;h=h.substring(0,h.length-1);const u=Rl(h,e);if(u===!0)i=!0;else return Lt(u.err.code,u.err.msg,Yt(r,d+u.err.line))}else if(a)if(c.tagClosed){if(h.trim().length>0)return Lt("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",Yt(r,o));if(t.length===0)return Lt("InvalidTag","Closing tag '"+l+"' has not been opened.",Yt(r,o));{const d=t.pop();if(l!==d.tagName){let u=Yt(r,d.tagStartPos);return Lt("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+u.line+", col "+u.col+") instead of closing tag '"+l+"'.",Yt(r,o))}t.length==0&&(s=!0)}}else return Lt("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",Yt(r,n));else{const d=Rl(h,e);if(d!==!0)return Lt(d.err.code,d.err.msg,Yt(r,n-h.length+d.err.line));if(s===!0)return Lt("InvalidXml","Multiple possible root nodes found.",Yt(r,n));e.unpairedTags.indexOf(l)!==-1||t.push({tagName:l,tagStartPos:o}),i=!0}for(n++;n<r.length;n++)if(r[n]==="<")if(r[n+1]==="!"){n++,n=Al(r,n);continue}else if(r[n+1]==="?"){if(n=wl(r,++n),n.err)return n}else break;else if(r[n]==="&"){const d=Df(r,n);if(d==-1)return Lt("InvalidChar","char '&' is not expected.",Yt(r,n));n=d}else if(s===!0&&!vl(r[n]))return Lt("InvalidXml","Extra text at the end",Yt(r,n));r[n]==="<"&&n--}}else{if(vl(r[n]))continue;return Lt("InvalidChar","char '"+r[n]+"' is not expected.",Yt(r,n))}if(i){if(t.length==1)return Lt("InvalidTag","Unclosed tag '"+t[0].tagName+"'.",Yt(r,t[0].tagStartPos));if(t.length>0)return Lt("InvalidXml","Invalid '"+JSON.stringify(t.map(n=>n.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Lt("InvalidXml","Start tag expected.",1);return!0};function vl(r){return r===" "||r===" "||r===`
141
+ `||r==="\r"}function wl(r,e){const t=e;for(;e<r.length;e++)if(r[e]=="?"||r[e]==" "){const i=r.substr(t,e-t);if(e>5&&i==="xml")return Lt("InvalidXml","XML declaration allowed only at the start of the document.",Yt(r,e));if(r[e]=="?"&&r[e+1]==">"){e++;break}else continue}return e}function Al(r,e){if(r.length>e+5&&r[e+1]==="-"&&r[e+2]==="-"){for(e+=3;e<r.length;e++)if(r[e]==="-"&&r[e+1]==="-"&&r[e+2]===">"){e+=2;break}}else if(r.length>e+8&&r[e+1]==="D"&&r[e+2]==="O"&&r[e+3]==="C"&&r[e+4]==="T"&&r[e+5]==="Y"&&r[e+6]==="P"&&r[e+7]==="E"){let t=1;for(e+=8;e<r.length;e++)if(r[e]==="<")t++;else if(r[e]===">"&&(t--,t===0))break}else if(r.length>e+9&&r[e+1]==="["&&r[e+2]==="C"&&r[e+3]==="D"&&r[e+4]==="A"&&r[e+5]==="T"&&r[e+6]==="A"&&r[e+7]==="["){for(e+=8;e<r.length;e++)if(r[e]==="]"&&r[e+1]==="]"&&r[e+2]===">"){e+=2;break}}return e}const xf='"',Nf="'";function Pf(r,e){let t="",i="",s=!1;for(;e<r.length;e++){if(r[e]===xf||r[e]===Nf)i===""?i=r[e]:i!==r[e]||(i="");else if(r[e]===">"&&i===""){s=!0;break}t+=r[e]}return i!==""?!1:{value:t,index:e,tagClosed:s}}const Lf=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Rl(r,e){const t=Ea.getAllMatches(r,Lf),i={};for(let s=0;s<t.length;s++){if(t[s][1].length===0)return Lt("InvalidAttr","Attribute '"+t[s][2]+"' has no space in starting.",ws(t[s]));if(t[s][3]!==void 0&&t[s][4]===void 0)return Lt("InvalidAttr","Attribute '"+t[s][2]+"' is without value.",ws(t[s]));if(t[s][3]===void 0&&!e.allowBooleanAttributes)return Lt("InvalidAttr","boolean attribute '"+t[s][2]+"' is not allowed.",ws(t[s]));const n=t[s][2];if(!Uf(n))return Lt("InvalidAttr","Attribute '"+n+"' is an invalid name.",ws(t[s]));if(!i.hasOwnProperty(n))i[n]=1;else return Lt("InvalidAttr","Attribute '"+n+"' is repeated.",ws(t[s]))}return!0}function Mf(r,e){let t=/\d/;for(r[e]==="x"&&(e++,t=/[\da-fA-F]/);e<r.length;e++){if(r[e]===";")return e;if(!r[e].match(t))break}return-1}function Df(r,e){if(e++,r[e]===";")return-1;if(r[e]==="#")return e++,Mf(r,e);let t=0;for(;e<r.length;e++,t++)if(!(r[e].match(/\w/)&&t<20)){if(r[e]===";")break;return-1}return e}function Lt(r,e,t){return{err:{code:r,msg:e,line:t.line||t,col:t.col}}}function Uf(r){return Ea.isName(r)}function kf(r){return Ea.isName(r)}function Yt(r,e){const t=r.substring(0,e).split(/\r?\n/);return{line:t.length,col:t[t.length-1].length+1}}function ws(r){return r.startIndex+r[1].length}var ba={};const jc={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(r,e){return e},attributeValueProcessor:function(r,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(r,e,t){return r}},Bf=function(r){return Object.assign({},jc,r)};ba.buildOptions=Bf;ba.defaultOptions=jc;class zf{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}var $f=zf;const Vf=Ur;function Gf(r,e){const t={};if(r[e+3]==="O"&&r[e+4]==="C"&&r[e+5]==="T"&&r[e+6]==="Y"&&r[e+7]==="P"&&r[e+8]==="E"){e=e+9;let i=1,s=!1,n=!1,o="";for(;e<r.length;e++)if(r[e]==="<"&&!n){if(s&&Wf(r,e))e+=7,[entityName,val,e]=Hf(r,e+1),val.indexOf("&")===-1&&(t[qf(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(s&&jf(r,e))e+=8;else if(s&&Xf(r,e))e+=8;else if(s&&Zf(r,e))e+=9;else if(Yf)n=!0;else throw new Error("Invalid DOCTYPE");i++,o=""}else if(r[e]===">"){if(n?r[e-1]==="-"&&r[e-2]==="-"&&(n=!1,i--):i--,i===0)break}else r[e]==="["?s=!0:o+=r[e];if(i!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:t,i:e}}function Hf(r,e){let t="";for(;e<r.length&&r[e]!=="'"&&r[e]!=='"';e++)t+=r[e];if(t=t.trim(),t.indexOf(" ")!==-1)throw new Error("External entites are not supported");const i=r[e++];let s="";for(;e<r.length&&r[e]!==i;e++)s+=r[e];return[t,s,e]}function Yf(r,e){return r[e+1]==="!"&&r[e+2]==="-"&&r[e+3]==="-"}function Wf(r,e){return r[e+1]==="!"&&r[e+2]==="E"&&r[e+3]==="N"&&r[e+4]==="T"&&r[e+5]==="I"&&r[e+6]==="T"&&r[e+7]==="Y"}function jf(r,e){return r[e+1]==="!"&&r[e+2]==="E"&&r[e+3]==="L"&&r[e+4]==="E"&&r[e+5]==="M"&&r[e+6]==="E"&&r[e+7]==="N"&&r[e+8]==="T"}function Xf(r,e){return r[e+1]==="!"&&r[e+2]==="A"&&r[e+3]==="T"&&r[e+4]==="T"&&r[e+5]==="L"&&r[e+6]==="I"&&r[e+7]==="S"&&r[e+8]==="T"}function Zf(r,e){return r[e+1]==="!"&&r[e+2]==="N"&&r[e+3]==="O"&&r[e+4]==="T"&&r[e+5]==="A"&&r[e+6]==="T"&&r[e+7]==="I"&&r[e+8]==="O"&&r[e+9]==="N"}function qf(r){if(Vf.isName(r))return r;throw new Error(`Invalid entity name ${r}`)}var Qf=Gf;const Kf=/^[-+]?0x[a-fA-F0-9]+$/,Jf=/^([\-\+])?(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 tp={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function ep(r,e={}){if(e=Object.assign({},tp,e),!r||typeof r!="string")return r;let t=r.trim();if(e.skipLike!==void 0&&e.skipLike.test(t))return r;if(e.hex&&Kf.test(t))return Number.parseInt(t,16);{const i=Jf.exec(t);if(i){const s=i[1],n=i[2];let o=ip(i[3]);const a=i[4]||i[6];if(!e.leadingZeros&&n.length>0&&s&&t[2]!==".")return r;if(!e.leadingZeros&&n.length>0&&!s&&t[1]!==".")return r;{const l=Number(t),c=""+l;return c.search(/[eE]/)!==-1||a?e.eNotation?l:r:t.indexOf(".")!==-1?c==="0"&&o===""||c===o||s&&c==="-"+o?l:r:n?o===c||s+o===c?l:r:t===c||t===s+c?l:r}}else return r}}function ip(r){return r&&r.indexOf(".")!==-1&&(r=r.replace(/0+$/,""),r==="."?r="0":r[0]==="."?r="0"+r:r[r.length-1]==="."&&(r=r.substr(0,r.length-1))),r}var sp=ep;const Xc=Ur,As=$f,np=Qf,rp=sp;let op=class{constructor(e){this.options=e,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,i)=>String.fromCharCode(Number.parseInt(i,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,i)=>String.fromCharCode(Number.parseInt(i,16))}},this.addExternalEntities=ap,this.parseXml=up,this.parseTextData=lp,this.resolveNameSpace=cp,this.buildAttributesMap=dp,this.isItStopNode=gp,this.replaceEntitiesValue=pp,this.readStopNodeData=bp,this.saveTextToParentTag=mp,this.addChild=fp}};function ap(r){const e=Object.keys(r);for(let t=0;t<e.length;t++){const i=e[t];this.lastEntities[i]={regex:new RegExp("&"+i+";","g"),val:r[i]}}}function lp(r,e,t,i,s,n,o){if(r!==void 0&&(this.options.trimValues&&!i&&(r=r.trim()),r.length>0)){o||(r=this.replaceEntitiesValue(r));const a=this.options.tagValueProcessor(e,r,t,s,n);return a==null?r:typeof a!=typeof r||a!==r?a:this.options.trimValues?Yo(r,this.options.parseTagValue,this.options.numberParseOptions):r.trim()===r?Yo(r,this.options.parseTagValue,this.options.numberParseOptions):r}}function cp(r){if(this.options.removeNSPrefix){const e=r.split(":"),t=r.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(r=t+e[1])}return r}const hp=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function dp(r,e,t){if(!this.options.ignoreAttributes&&typeof r=="string"){const i=Xc.getAllMatches(r,hp),s=i.length,n={};for(let o=0;o<s;o++){const a=this.resolveNameSpace(i[o][1]);let l=i[o][4],c=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(c=this.options.transformAttributeName(c)),c==="__proto__"&&(c="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l);const h=this.options.attributeValueProcessor(a,l,e);h==null?n[c]=l:typeof h!=typeof l||h!==l?n[c]=h:n[c]=Yo(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(n[c]=!0)}if(!Object.keys(n).length)return;if(this.options.attributesGroupName){const o={};return o[this.options.attributesGroupName]=n,o}return n}}const up=function(r){r=r.replace(/\r\n?/g,`
142
+ `);const e=new As("!xml");let t=e,i="",s="";for(let n=0;n<r.length;n++)if(r[n]==="<")if(r[n+1]==="/"){const a=hi(r,">",n,"Closing Tag is not closed.");let l=r.substring(n+2,a).trim();if(this.options.removeNSPrefix){const d=l.indexOf(":");d!==-1&&(l=l.substr(d+1))}this.options.transformTagName&&(l=this.options.transformTagName(l)),t&&(i=this.saveTextToParentTag(i,t,s));const c=s.substring(s.lastIndexOf(".")+1);if(l&&this.options.unpairedTags.indexOf(l)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${l}>`);let h=0;c&&this.options.unpairedTags.indexOf(c)!==-1?(h=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):h=s.lastIndexOf("."),s=s.substring(0,h),t=this.tagsNodeStack.pop(),i="",n=a}else if(r[n+1]==="?"){let a=Ho(r,n,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,t,s),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){const l=new As(a.tagName);l.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(l[":@"]=this.buildAttributesMap(a.tagExp,s,a.tagName)),this.addChild(t,l,s)}n=a.closeIndex+1}else if(r.substr(n+1,3)==="!--"){const a=hi(r,"-->",n+4,"Comment is not closed.");if(this.options.commentPropName){const l=r.substring(n+4,a-2);i=this.saveTextToParentTag(i,t,s),t.add(this.options.commentPropName,[{[this.options.textNodeName]:l}])}n=a}else if(r.substr(n+1,2)==="!D"){const a=np(r,n);this.docTypeEntities=a.entities,n=a.i}else if(r.substr(n+1,2)==="!["){const a=hi(r,"]]>",n,"CDATA is not closed.")-2,l=r.substring(n+9,a);i=this.saveTextToParentTag(i,t,s);let c=this.parseTextData(l,t.tagname,s,!0,!1,!0,!0);c==null&&(c=""),this.options.cdataPropName?t.add(this.options.cdataPropName,[{[this.options.textNodeName]:l}]):t.add(this.options.textNodeName,c),n=a+2}else{let a=Ho(r,n,this.options.removeNSPrefix),l=a.tagName;const c=a.rawTagName;let h=a.tagExp,d=a.attrExpPresent,u=a.closeIndex;this.options.transformTagName&&(l=this.options.transformTagName(l)),t&&i&&t.tagname!=="!xml"&&(i=this.saveTextToParentTag(i,t,s,!1));const f=t;if(f&&this.options.unpairedTags.indexOf(f.tagname)!==-1&&(t=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),l!==e.tagname&&(s+=s?"."+l:l),this.isItStopNode(this.options.stopNodes,s,l)){let p="";if(h.length>0&&h.lastIndexOf("/")===h.length-1)l[l.length-1]==="/"?(l=l.substr(0,l.length-1),s=s.substr(0,s.length-1),h=l):h=h.substr(0,h.length-1),n=a.closeIndex;else if(this.options.unpairedTags.indexOf(l)!==-1)n=a.closeIndex;else{const E=this.readStopNodeData(r,c,u+1);if(!E)throw new Error(`Unexpected end of ${c}`);n=E.i,p=E.tagContent}const m=new As(l);l!==h&&d&&(m[":@"]=this.buildAttributesMap(h,s,l)),p&&(p=this.parseTextData(p,l,s,!0,d,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),m.add(this.options.textNodeName,p),this.addChild(t,m,s)}else{if(h.length>0&&h.lastIndexOf("/")===h.length-1){l[l.length-1]==="/"?(l=l.substr(0,l.length-1),s=s.substr(0,s.length-1),h=l):h=h.substr(0,h.length-1),this.options.transformTagName&&(l=this.options.transformTagName(l));const p=new As(l);l!==h&&d&&(p[":@"]=this.buildAttributesMap(h,s,l)),this.addChild(t,p,s),s=s.substr(0,s.lastIndexOf("."))}else{const p=new As(l);this.tagsNodeStack.push(t),l!==h&&d&&(p[":@"]=this.buildAttributesMap(h,s,l)),this.addChild(t,p,s),t=p}i="",n=u}}else i+=r[n];return e.child};function fp(r,e,t){const i=this.options.updateTag(e.tagname,t,e[":@"]);i===!1||(typeof i=="string"&&(e.tagname=i),r.addChild(e))}const pp=function(r){if(this.options.processEntities){for(let e in this.docTypeEntities){const t=this.docTypeEntities[e];r=r.replace(t.regx,t.val)}for(let e in this.lastEntities){const t=this.lastEntities[e];r=r.replace(t.regex,t.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const t=this.htmlEntities[e];r=r.replace(t.regex,t.val)}r=r.replace(this.ampEntity.regex,this.ampEntity.val)}return r};function mp(r,e,t,i){return r&&(i===void 0&&(i=Object.keys(e.child).length===0),r=this.parseTextData(r,e.tagname,t,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,i),r!==void 0&&r!==""&&e.add(this.options.textNodeName,r),r=""),r}function gp(r,e,t){const i="*."+t;for(const s in r){const n=r[s];if(i===n||e===n)return!0}return!1}function Ep(r,e,t=">"){let i,s="";for(let n=e;n<r.length;n++){let o=r[n];if(i)o===i&&(i="");else if(o==='"'||o==="'")i=o;else if(o===t[0])if(t[1]){if(r[n+1]===t[1])return{data:s,index:n}}else return{data:s,index:n};else o===" "&&(o=" ");s+=o}}function hi(r,e,t,i){const s=r.indexOf(e,t);if(s===-1)throw new Error(i);return s+e.length-1}function Ho(r,e,t,i=">"){const s=Ep(r,e+1,i);if(!s)return;let n=s.data;const o=s.index,a=n.search(/\s/);let l=n,c=!0;a!==-1&&(l=n.substring(0,a),n=n.substring(a+1).trimStart());const h=l;if(t){const d=l.indexOf(":");d!==-1&&(l=l.substr(d+1),c=l!==s.data.substr(d+1))}return{tagName:l,tagExp:n,closeIndex:o,attrExpPresent:c,rawTagName:h}}function bp(r,e,t){const i=t;let s=1;for(;t<r.length;t++)if(r[t]==="<")if(r[t+1]==="/"){const n=hi(r,">",t,`${e} is not closed`);if(r.substring(t+2,n).trim()===e&&(s--,s===0))return{tagContent:r.substring(i,t),i:n};t=n}else if(r[t+1]==="?")t=hi(r,"?>",t+1,"StopNode is not closed.");else if(r.substr(t+1,3)==="!--")t=hi(r,"-->",t+3,"StopNode is not closed.");else if(r.substr(t+1,2)==="![")t=hi(r,"]]>",t,"StopNode is not closed.")-2;else{const n=Ho(r,t,">");n&&((n&&n.tagName)===e&&n.tagExp[n.tagExp.length-1]!=="/"&&s++,t=n.closeIndex)}}function Yo(r,e,t){if(e&&typeof r=="string"){const i=r.trim();return i==="true"?!0:i==="false"?!1:rp(r,t)}else return Xc.isExist(r)?r:""}var Ip=op,Zc={};function Cp(r,e){return qc(r,e)}function qc(r,e,t){let i;const s={};for(let n=0;n<r.length;n++){const o=r[n],a=yp(o);let l="";if(t===void 0?l=a:l=t+"."+a,a===e.textNodeName)i===void 0?i=o[a]:i+=""+o[a];else{if(a===void 0)continue;if(o[a]){let c=qc(o[a],e,l);const h=Tp(c,e);o[":@"]?_p(c,o[":@"],l,e):Object.keys(c).length===1&&c[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?c=c[e.textNodeName]:Object.keys(c).length===0&&(e.alwaysCreateTextNode?c[e.textNodeName]="":c=""),s[a]!==void 0&&s.hasOwnProperty(a)?(Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(c)):e.isArray(a,l,h)?s[a]=[c]:s[a]=c}}}return typeof i=="string"?i.length>0&&(s[e.textNodeName]=i):i!==void 0&&(s[e.textNodeName]=i),s}function yp(r){const e=Object.keys(r);for(let t=0;t<e.length;t++){const i=e[t];if(i!==":@")return i}}function _p(r,e,t,i){if(e){const s=Object.keys(e),n=s.length;for(let o=0;o<n;o++){const a=s[o];i.isArray(a,t+"."+a,!0,!0)?r[a]=[e[a]]:r[a]=e[a]}}}function Tp(r,e){const{textNodeName:t}=e,i=Object.keys(r).length;return!!(i===0||i===1&&(r[t]||typeof r[t]=="boolean"||r[t]===0))}Zc.prettify=Cp;const{buildOptions:vp}=ba,wp=Ip,{prettify:Ap}=Zc,Rp=ga;let Sp=class{constructor(e){this.externalEntities={},this.options=vp(e)}parse(e,t){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(t){t===!0&&(t={});const n=Rp.validate(e,t);if(n!==!0)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const i=new wp(this.options);i.addExternalEntities(this.externalEntities);const s=i.parseXml(e);return this.options.preserveOrder||s===void 0?s:Ap(s,this.options)}addEntity(e,t){if(t.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.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[e]=t}};var Fp=Sp;const Op=`
143
+ `;function xp(r,e){let t="";return e.format&&e.indentBy.length>0&&(t=Op),Qc(r,e,"",t)}function Qc(r,e,t,i){let s="",n=!1;for(let o=0;o<r.length;o++){const a=r[o],l=Np(a);if(l===void 0)continue;let c="";if(t.length===0?c=l:c=`${t}.${l}`,l===e.textNodeName){let p=a[l];Pp(c,e)||(p=e.tagValueProcessor(l,p),p=Kc(p,e)),n&&(s+=i),s+=p,n=!1;continue}else if(l===e.cdataPropName){n&&(s+=i),s+=`<![CDATA[${a[l][0][e.textNodeName]}]]>`,n=!1;continue}else if(l===e.commentPropName){s+=i+`<!--${a[l][0][e.textNodeName]}-->`,n=!0;continue}else if(l[0]==="?"){const p=Sl(a[":@"],e),m=l==="?xml"?"":i;let E=a[l][0][e.textNodeName];E=E.length!==0?" "+E:"",s+=m+`<${l}${E}${p}?>`,n=!0;continue}let h=i;h!==""&&(h+=e.indentBy);const d=Sl(a[":@"],e),u=i+`<${l}${d}`,f=Qc(a[l],e,c,h);e.unpairedTags.indexOf(l)!==-1?e.suppressUnpairedNode?s+=u+">":s+=u+"/>":(!f||f.length===0)&&e.suppressEmptyNode?s+=u+"/>":f&&f.endsWith(">")?s+=u+`>${f}${i}</${l}>`:(s+=u+">",f&&i!==""&&(f.includes("/>")||f.includes("</"))?s+=i+e.indentBy+f+i:s+=f,s+=`</${l}>`),n=!0}return s}function Np(r){const e=Object.keys(r);for(let t=0;t<e.length;t++){const i=e[t];if(r.hasOwnProperty(i)&&i!==":@")return i}}function Sl(r,e){let t="";if(r&&!e.ignoreAttributes)for(let i in r){if(!r.hasOwnProperty(i))continue;let s=e.attributeValueProcessor(i,r[i]);s=Kc(s,e),s===!0&&e.suppressBooleanAttributes?t+=` ${i.substr(e.attributeNamePrefix.length)}`:t+=` ${i.substr(e.attributeNamePrefix.length)}="${s}"`}return t}function Pp(r,e){r=r.substr(0,r.length-e.textNodeName.length-1);let t=r.substr(r.lastIndexOf(".")+1);for(let i in e.stopNodes)if(e.stopNodes[i]===r||e.stopNodes[i]==="*."+t)return!0;return!1}function Kc(r,e){if(r&&r.length>0&&e.processEntities)for(let t=0;t<e.entities.length;t++){const i=e.entities[t];r=r.replace(i.regex,i.val)}return r}var Lp=xp;const Mp=Lp,Dp={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(r,e){return e},attributeValueProcessor:function(r,e){return e},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 Ke(r){this.options=Object.assign({},Dp,r),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Bp),this.processTextOrObjNode=Up,this.options.format?(this.indentate=kp,this.tagEndChar=`>
144
144
  `,this.newLine=`
145
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Ze.prototype.build=function(n){return this.options.preserveOrder?Op(n,this.options):(Array.isArray(n)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(n={[this.options.arrayNodeName]:n}),this.j2x(n,0).val)};Ze.prototype.j2x=function(n,e){let t="",i="";for(let s in n)if(Object.prototype.hasOwnProperty.call(n,s))if(typeof n[s]>"u")this.isAttribute(s)&&(i+="");else if(n[s]===null)this.isAttribute(s)?i+="":s[0]==="?"?i+=this.indentate(e)+"<"+s+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+s+"/"+this.tagEndChar;else if(n[s]instanceof Date)i+=this.buildTextValNode(n[s],s,"",e);else if(typeof n[s]!="object"){const r=this.isAttribute(s);if(r)t+=this.buildAttrPairStr(r,""+n[s]);else if(s===this.options.textNodeName){let o=this.options.tagValueProcessor(s,""+n[s]);i+=this.replaceEntitiesValue(o)}else i+=this.buildTextValNode(n[s],s,"",e)}else if(Array.isArray(n[s])){const r=n[s].length;let o="",a="";for(let l=0;l<r;l++){const c=n[s][l];if(!(typeof c>"u"))if(c===null)s[0]==="?"?i+=this.indentate(e)+"<"+s+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+s+"/"+this.tagEndChar;else if(typeof c=="object")if(this.options.oneListGroup){const h=this.j2x(c,e+1);o+=h.val,this.options.attributesGroupName&&c.hasOwnProperty(this.options.attributesGroupName)&&(a+=h.attrStr)}else o+=this.processTextOrObjNode(c,s,e);else if(this.options.oneListGroup){let h=this.options.tagValueProcessor(s,c);h=this.replaceEntitiesValue(h),o+=h}else o+=this.buildTextValNode(c,s,"",e)}this.options.oneListGroup&&(o=this.buildObjectNode(o,s,a,e)),i+=o}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){const r=Object.keys(n[s]),o=r.length;for(let a=0;a<o;a++)t+=this.buildAttrPairStr(r[a],""+n[s][r[a]])}else i+=this.processTextOrObjNode(n[s],s,e);return{attrStr:t,val:i}};Ze.prototype.buildAttrPairStr=function(n,e){return e=this.options.attributeValueProcessor(n,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+n:" "+n+'="'+e+'"'};function Np(n,e,t){const i=this.j2x(n,t+1);return n[this.options.textNodeName]!==void 0&&Object.keys(n).length===1?this.buildTextValNode(n[this.options.textNodeName],e,i.attrStr,t):this.buildObjectNode(i.val,e,i.attrStr,t)}Ze.prototype.buildObjectNode=function(n,e,t,i){if(n==="")return e[0]==="?"?this.indentate(i)+"<"+e+t+"?"+this.tagEndChar:this.indentate(i)+"<"+e+t+this.closeTag(e)+this.tagEndChar;{let s="</"+e+this.tagEndChar,r="";return e[0]==="?"&&(r="?",s=""),(t||t==="")&&n.indexOf("<")===-1?this.indentate(i)+"<"+e+t+r+">"+n+s:this.options.commentPropName!==!1&&e===this.options.commentPropName&&r.length===0?this.indentate(i)+`<!--${n}-->`+this.newLine:this.indentate(i)+"<"+e+t+r+this.tagEndChar+n+this.indentate(i)+s}};Ze.prototype.closeTag=function(n){let e="";return this.options.unpairedTags.indexOf(n)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${n}`,e};Ze.prototype.buildTextValNode=function(n,e,t,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(i)+`<![CDATA[${n}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(i)+`<!--${n}-->`+this.newLine;if(e[0]==="?")return this.indentate(i)+"<"+e+t+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(e,n);return s=this.replaceEntitiesValue(s),s===""?this.indentate(i)+"<"+e+t+this.closeTag(e)+this.tagEndChar:this.indentate(i)+"<"+e+t+">"+s+"</"+e+this.tagEndChar}};Ze.prototype.replaceEntitiesValue=function(n){if(n&&n.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const t=this.options.entities[e];n=n.replace(t.regex,t.val)}return n};function Pp(n){return this.options.indentBy.repeat(n)}function Lp(n){return n.startsWith(this.options.attributeNamePrefix)&&n!==this.options.textNodeName?n.substr(this.attrPrefixLen):!1}var Mp=Ze;const Dp=pa,Up=vp,kp=Mp;var Bp={XMLParser:Up,XMLValidator:Dp,XMLBuilder:kp};class Kn{constructor(e,t){y(this,"date",new Date);y(this,"author");y(this,"guid",Fe.create());y(this,"viewpoint");y(this,"modifiedAuthor");y(this,"modifiedDate");y(this,"_components");y(this,"_comment","");this._components=e,this._comment=t;const i=this._components.get(Dt);this.author=i.config.author}set comment(e){const t=this._components.get(Dt);this._comment=e,this.modifiedDate=new Date,this.modifiedAuthor=t.config.author}get comment(){return this._comment}serialize(){let e=null;this.viewpoint&&(e=`<Viewpoint Guid="${this.viewpoint.guid}"/>`);let t=null;this.modifiedDate&&(t=`<ModifiedDate>${this.modifiedDate.toISOString()}</ModifiedDate>`);let i=null;return this.modifiedAuthor&&(i=`<ModifiedAuthor>${this.modifiedAuthor}</ModifiedAuthor>`),`
145
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Ke.prototype.build=function(r){return this.options.preserveOrder?Mp(r,this.options):(Array.isArray(r)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(r={[this.options.arrayNodeName]:r}),this.j2x(r,0).val)};Ke.prototype.j2x=function(r,e){let t="",i="";for(let s in r)if(Object.prototype.hasOwnProperty.call(r,s))if(typeof r[s]>"u")this.isAttribute(s)&&(i+="");else if(r[s]===null)this.isAttribute(s)?i+="":s[0]==="?"?i+=this.indentate(e)+"<"+s+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+s+"/"+this.tagEndChar;else if(r[s]instanceof Date)i+=this.buildTextValNode(r[s],s,"",e);else if(typeof r[s]!="object"){const n=this.isAttribute(s);if(n)t+=this.buildAttrPairStr(n,""+r[s]);else if(s===this.options.textNodeName){let o=this.options.tagValueProcessor(s,""+r[s]);i+=this.replaceEntitiesValue(o)}else i+=this.buildTextValNode(r[s],s,"",e)}else if(Array.isArray(r[s])){const n=r[s].length;let o="",a="";for(let l=0;l<n;l++){const c=r[s][l];if(!(typeof c>"u"))if(c===null)s[0]==="?"?i+=this.indentate(e)+"<"+s+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+s+"/"+this.tagEndChar;else if(typeof c=="object")if(this.options.oneListGroup){const h=this.j2x(c,e+1);o+=h.val,this.options.attributesGroupName&&c.hasOwnProperty(this.options.attributesGroupName)&&(a+=h.attrStr)}else o+=this.processTextOrObjNode(c,s,e);else if(this.options.oneListGroup){let h=this.options.tagValueProcessor(s,c);h=this.replaceEntitiesValue(h),o+=h}else o+=this.buildTextValNode(c,s,"",e)}this.options.oneListGroup&&(o=this.buildObjectNode(o,s,a,e)),i+=o}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){const n=Object.keys(r[s]),o=n.length;for(let a=0;a<o;a++)t+=this.buildAttrPairStr(n[a],""+r[s][n[a]])}else i+=this.processTextOrObjNode(r[s],s,e);return{attrStr:t,val:i}};Ke.prototype.buildAttrPairStr=function(r,e){return e=this.options.attributeValueProcessor(r,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+r:" "+r+'="'+e+'"'};function Up(r,e,t){const i=this.j2x(r,t+1);return r[this.options.textNodeName]!==void 0&&Object.keys(r).length===1?this.buildTextValNode(r[this.options.textNodeName],e,i.attrStr,t):this.buildObjectNode(i.val,e,i.attrStr,t)}Ke.prototype.buildObjectNode=function(r,e,t,i){if(r==="")return e[0]==="?"?this.indentate(i)+"<"+e+t+"?"+this.tagEndChar:this.indentate(i)+"<"+e+t+this.closeTag(e)+this.tagEndChar;{let s="</"+e+this.tagEndChar,n="";return e[0]==="?"&&(n="?",s=""),(t||t==="")&&r.indexOf("<")===-1?this.indentate(i)+"<"+e+t+n+">"+r+s:this.options.commentPropName!==!1&&e===this.options.commentPropName&&n.length===0?this.indentate(i)+`<!--${r}-->`+this.newLine:this.indentate(i)+"<"+e+t+n+this.tagEndChar+r+this.indentate(i)+s}};Ke.prototype.closeTag=function(r){let e="";return this.options.unpairedTags.indexOf(r)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${r}`,e};Ke.prototype.buildTextValNode=function(r,e,t,i){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(i)+`<![CDATA[${r}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(i)+`<!--${r}-->`+this.newLine;if(e[0]==="?")return this.indentate(i)+"<"+e+t+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(e,r);return s=this.replaceEntitiesValue(s),s===""?this.indentate(i)+"<"+e+t+this.closeTag(e)+this.tagEndChar:this.indentate(i)+"<"+e+t+">"+s+"</"+e+this.tagEndChar}};Ke.prototype.replaceEntitiesValue=function(r){if(r&&r.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const t=this.options.entities[e];r=r.replace(t.regex,t.val)}return r};function kp(r){return this.options.indentBy.repeat(r)}function Bp(r){return r.startsWith(this.options.attributeNamePrefix)&&r!==this.options.textNodeName?r.substr(this.attrPrefixLen):!1}var zp=Ke;const $p=ga,Vp=Fp,Gp=zp;var Hp={XMLParser:Vp,XMLValidator:$p,XMLBuilder:Gp};class Jn{constructor(e,t){y(this,"date",new Date);y(this,"author");y(this,"guid",Le.create());y(this,"viewpoint");y(this,"modifiedAuthor");y(this,"modifiedDate");y(this,"topic");y(this,"_components");y(this,"_comment","");this._components=e,this._comment=t;const i=this._components.get(Mt);this.author=i.config.author}set comment(e){var i;const t=this._components.get(Mt);this._comment=e,this.modifiedDate=new Date,this.modifiedAuthor=t.config.author,(i=this.topic)==null||i.comments.set(this.guid,this)}get comment(){return this._comment}serialize(){let e=null;this.viewpoint&&(e=`<Viewpoint Guid="${this.viewpoint.guid}"/>`);let t=null;this.modifiedDate&&(t=`<ModifiedDate>${this.modifiedDate.toISOString()}</ModifiedDate>`);let i=null;return this.modifiedAuthor&&(i=`<ModifiedAuthor>${this.modifiedAuthor}</ModifiedAuthor>`),`
146
146
  <Comment Guid="${this.guid}">
147
147
  <Date>${this.date.toISOString()}</Date>
148
148
  <Author>${this.author}</Author>
@@ -151,25 +151,25 @@ https://github.com/nodeca/pako/blob/main/LICENSE
151
151
  ${i??""}
152
152
  ${t??""}
153
153
  </Comment>
154
- `}}const Ce=class Ce{constructor(e){y(this,"guid",Fe.create());y(this,"title",Ce.default.title);y(this,"creationDate",new Date);y(this,"creationAuthor","");y(this,"comments",new hi);y(this,"viewpoints",new hi);y(this,"relatedTopics",new hi);y(this,"customData",{});y(this,"description");y(this,"serverAssignedId");y(this,"dueDate");y(this,"modifiedAuthor");y(this,"modifiedDate");y(this,"index");y(this,"_type",Ce.default.type);y(this,"_status",Ce.default.status);y(this,"_priority",Ce.default.priority);y(this,"_stage",Ce.default.priority);y(this,"_assignedTo",Ce.default.assignedTo);y(this,"_labels",Ce.default.labels);y(this,"_components");this._components=e;const t=e.get(Dt);this.creationAuthor=t.config.author}set type(e){const t=this._components.get(Dt),{strict:i,types:s}=t.config;(!i||s.has(e))&&(this._type=e)}get type(){return this._type}set status(e){const t=this._components.get(Dt),{strict:i,statuses:s}=t.config;(!i||s.has(e))&&(this._status=e)}get status(){return this._status}set priority(e){const t=this._components.get(Dt);if(e){const{strict:i,priorities:s}=t.config;if(!(i?s.has(e):!0))return;this._priority=e}else this._priority=e}get priority(){return this._priority}set stage(e){const t=this._components.get(Dt);if(e){const{strict:i,stages:s}=t.config;if(!(i?s.has(e):!0))return;this._stage=e}else this._stage=e}get stage(){return this._stage}set assignedTo(e){const t=this._components.get(Dt);if(e){const{strict:i,users:s}=t.config;if(!(i?s.has(e):!0))return;this._assignedTo=e}else this._assignedTo=e}get assignedTo(){return this._assignedTo}set labels(e){const t=this._components.get(Dt),{strict:i,labels:s}=t.config;if(i){const r=new Set;for(const o of e)(!i||s.has(o))&&r.add(o);this._labels=r}else this._labels=e}get labels(){return this._labels}get _managerVersion(){return this._components.get(Dt).config.version}set(e){const t=e,i=this;for(const r in e){if(r==="guid")continue;const o=t[r];r in this&&(i[r]=o)}return this._components.get(Dt).list.set(this.guid,this),this}createComment(e,t){const i=new Kn(this._components,e);return i.viewpoint=t,this.comments.add(i),i}createLabelTags(e=this._managerVersion){let t="Labels";e==="2.1"&&(t="Labels"),e==="3"&&(t="Label");let i=[...this.labels].map(s=>`<${t}>${s}</${t}>`).join(`
155
- `);for(const s in this.customData){const r=this.customData[s];typeof r=="string"&&(i+=`
156
- <${t}>${r}</${t}>`)}return e==="2.1"?i:e==="3"?i.length!==0?`<Labels>
154
+ `}}const _e=class _e{constructor(e){y(this,"guid",Le.create());y(this,"title",_e.default.title);y(this,"creationDate",new Date);y(this,"creationAuthor","");y(this,"viewpoints",new $i);y(this,"relatedTopics",new $i);y(this,"comments",new pi);y(this,"customData",{});y(this,"description");y(this,"serverAssignedId");y(this,"dueDate");y(this,"modifiedAuthor");y(this,"modifiedDate");y(this,"index");y(this,"_type",_e.default.type);y(this,"_status",_e.default.status);y(this,"_priority",_e.default.priority);y(this,"_stage",_e.default.priority);y(this,"_assignedTo",_e.default.assignedTo);y(this,"_labels",_e.default.labels);y(this,"_components");this._components=e;const t=e.get(Mt);this.creationAuthor=t.config.author,this.relatedTopics.guard=i=>i!==this.guid}set type(e){const t=this._components.get(Mt),{strict:i,types:s}=t.config;(!i||s.has(e))&&(this._type=e)}get type(){return this._type}set status(e){const t=this._components.get(Mt),{strict:i,statuses:s}=t.config;(!i||s.has(e))&&(this._status=e)}get status(){return this._status}set priority(e){const t=this._components.get(Mt);if(e){const{strict:i,priorities:s}=t.config;if(!(i?s.has(e):!0))return;this._priority=e}else this._priority=e}get priority(){return this._priority}set stage(e){const t=this._components.get(Mt);if(e){const{strict:i,stages:s}=t.config;if(!(i?s.has(e):!0))return;this._stage=e}else this._stage=e}get stage(){return this._stage}set assignedTo(e){const t=this._components.get(Mt);if(e){const{strict:i,users:s}=t.config;if(!(i?s.has(e):!0))return;this._assignedTo=e}else this._assignedTo=e}get assignedTo(){return this._assignedTo}set labels(e){const t=this._components.get(Mt),{strict:i,labels:s}=t.config;if(i){const n=new Set;for(const o of e)(!i||s.has(o))&&n.add(o);this._labels=n}else this._labels=e}get labels(){return this._labels}get _managerVersion(){return this._components.get(Mt).config.version}set(e){const t=e,i=this;for(const n in e){if(n==="guid")continue;const o=t[n];n in this&&(i[n]=o)}return this._components.get(Mt).list.set(this.guid,this),this}createComment(e,t){const i=new Jn(this._components,e);return i.viewpoint=t,i.topic=this,this.comments.set(i.guid,i),i}createLabelTags(e=this._managerVersion){let t="Labels";e==="2.1"&&(t="Labels"),e==="3"&&(t="Label");let i=[...this.labels].map(s=>`<${t}>${s}</${t}>`).join(`
155
+ `);for(const s in this.customData){const n=this.customData[s];typeof n=="string"&&(i+=`
156
+ <${t}>${n}</${t}>`)}return e==="2.1"?i:e==="3"?i.length!==0?`<Labels>
157
157
  ${i}
158
- </Labels>`:"<Labels/>":i}createCommentTags(e=this._managerVersion){const t=[...this.comments].map(i=>i.serialize()).join(`
158
+ </Labels>`:"<Labels/>":i}createCommentTags(e=this._managerVersion){const t=[...this.comments.values()].map(i=>i.serialize()).join(`
159
159
  `);return e==="2.1"?t:e==="3"?t.length!==0?`<Comments>
160
160
  ${t}
161
- </Comments>`:"<Comments/>":t}createViewpointTags(e=this._managerVersion){let t="Viewpoints";e==="2.1"&&(t="Viewpoints"),e==="3"&&(t="ViewPoint");const i=[...this.viewpoints].map(s=>`<${t} Guid="${s.guid}">
162
- <Viewpoint>${s.guid}.bcfv</Viewpoint>
163
- <Snapshot>${s.guid}.jpeg</Snapshot>
161
+ </Comments>`:"<Comments/>":t}createViewpointTags(e=this._managerVersion){let t="Viewpoints";e==="2.1"&&(t="Viewpoints"),e==="3"&&(t="ViewPoint");const i=this._components.get(Ht),n=[...this.viewpoints].map(o=>i.list.get(o)).filter(o=>o).map(o=>`<${t} Guid="${o.guid}">
162
+ <Viewpoint>${o.guid}.bcfv</Viewpoint>
163
+ <Snapshot>${o.guid}.jpeg</Snapshot>
164
164
  </${t}>
165
165
  `).join(`
166
- `);return e==="2.1"?i:e==="3"?i.length!==0?`<Viewpoints>
167
- ${i}
168
- </Viewpoints>`:"<Viewpoints />":i}createRelatedTopicTags(e=this._managerVersion){const t=[...this.relatedTopics].map(i=>`<RelatedTopic Guid="${i.guid}"></RelatedTopic>
166
+ `);return e==="2.1"?n:e==="3"?n.length!==0?`<Viewpoints>
167
+ ${n}
168
+ </Viewpoints>`:"<Viewpoints />":n}createRelatedTopicTags(e=this._managerVersion){const t=[...this.relatedTopics].map(i=>`<RelatedTopic Guid="${i}"></RelatedTopic>
169
169
  `).join(`
170
170
  `);return e==="2.1"?t:e==="3"?t.length!==0?`<RelatedTopics>
171
171
  ${t}
172
- </RelatedTopics>`:"<RelatedTopics />":t}serialize(){const e=this._managerVersion;let t=null;this.serverAssignedId&&(t=`ServerAssignedId="${this.serverAssignedId}"`);let i=null;this.priority&&(i=`<Priority>${this.priority}</Priority>`);let s=null;this.index&&e==="2.1"&&(s=`<Index>${this.index}</Index>`);let r=null;this.modifiedDate&&(r=`<ModifiedDate>${this.modifiedDate.toISOString()}</ModifiedDate>`);let o=null;this.modifiedAuthor&&(o=`<ModifiedAuthor>${this.modifiedAuthor}</ModifiedAuthor>`);let a=null;this.dueDate&&(a=`<DueDate>${this.dueDate.toISOString()}</DueDate>`);let l=null;this.assignedTo&&(l=`<AssignedTo>${this.assignedTo}</AssignedTo>`);let c=null;this.description&&(c=`<Description>${this.description}</Description>`);let h=null;this.stage&&(h=`<Stage>${this.stage}</Stage>`);const d=this.createCommentTags(e),u=this.createViewpointTags(e),f=this.createLabelTags(e),p=this.createRelatedTopicTags(e);return`
172
+ </RelatedTopics>`:"<RelatedTopics />":t}serialize(){const e=this._managerVersion;let t=null;this.serverAssignedId&&(t=`ServerAssignedId="${this.serverAssignedId}"`);let i=null;this.priority&&(i=`<Priority>${this.priority}</Priority>`);let s=null;this.index&&e==="2.1"&&(s=`<Index>${this.index}</Index>`);let n=null;this.modifiedDate&&(n=`<ModifiedDate>${this.modifiedDate.toISOString()}</ModifiedDate>`);let o=null;this.modifiedAuthor&&(o=`<ModifiedAuthor>${this.modifiedAuthor}</ModifiedAuthor>`);let a=null;this.dueDate&&(a=`<DueDate>${this.dueDate.toISOString()}</DueDate>`);let l=null;this.assignedTo&&(l=`<AssignedTo>${this.assignedTo}</AssignedTo>`);let c=null;this.description&&(c=`<Description>${this.description}</Description>`);let h=null;this.stage&&(h=`<Stage>${this.stage}</Stage>`);const d=this.createCommentTags(e),u=this.createViewpointTags(e),f=this.createLabelTags(e),p=this.createRelatedTopicTags(e);return`
173
173
  <?xml version="1.0" encoding="UTF-8"?>
174
174
  <Markup>
175
175
  <Topic Guid="${this.guid}" TopicType="${this.type}" TopicStatus="${this.status}" ${t??""}>
@@ -178,7 +178,7 @@ ${t}
178
178
  <CreationAuthor>${this.creationAuthor}</CreationAuthor>
179
179
  ${i??""}
180
180
  ${s??""}
181
- ${r??""}
181
+ ${n??""}
182
182
  ${o??""}
183
183
  ${a??""}
184
184
  ${l??""}
@@ -192,49 +192,49 @@ ${t}
192
192
  ${e==="2.1"?d:""}
193
193
  ${e==="2.1"?u:""}
194
194
  </Markup>
195
- `}};y(Ce,"default",{title:"BCF Topic",type:"Issue",status:"Active",labels:new Set});let zs=Ce;var zp=Object.defineProperty,Vp=(n,e,t)=>e in n?zp(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,si=(n,e,t)=>(Vp(n,typeof e!="symbol"?e+"":e,t),t);const $i=Math.min,Ae=Math.max,Jn=Math.round,We=n=>({x:n,y:n}),$p={left:"right",right:"left",bottom:"top",top:"bottom"},Hp={start:"end",end:"start"};function wl(n,e,t){return Ae(n,$i(e,t))}function Ks(n,e){return typeof n=="function"?n(e):n}function Oe(n){return n.split("-")[0]}function Mr(n){return n.split("-")[1]}function Zc(n){return n==="x"?"y":"x"}function qc(n){return n==="y"?"height":"width"}function mi(n){return["top","bottom"].includes(Oe(n))?"y":"x"}function Qc(n){return Zc(mi(n))}function Gp(n,e,t){t===void 0&&(t=!1);const i=Mr(n),s=Qc(n),r=qc(s);let o=s==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(o=tr(o)),[o,tr(o)]}function Yp(n){const e=tr(n);return[Go(n),e,Go(e)]}function Go(n){return n.replace(/start|end/g,e=>Hp[e])}function Wp(n,e,t){const i=["left","right"],s=["right","left"],r=["top","bottom"],o=["bottom","top"];switch(n){case"top":case"bottom":return t?e?s:i:e?i:s;case"left":case"right":return e?r:o;default:return[]}}function jp(n,e,t,i){const s=Mr(n);let r=Wp(Oe(n),t==="start",i);return s&&(r=r.map(o=>o+"-"+s),e&&(r=r.concat(r.map(Go)))),r}function tr(n){return n.replace(/left|right|bottom|top/g,e=>$p[e])}function Xp(n){return{top:0,right:0,bottom:0,left:0,...n}}function Kc(n){return typeof n!="number"?Xp(n):{top:n,right:n,bottom:n,left:n}}function Hi(n){const{x:e,y:t,width:i,height:s}=n;return{width:i,height:s,top:t,left:e,right:e+i,bottom:t+s,x:e,y:t}}function Al(n,e,t){let{reference:i,floating:s}=n;const r=mi(e),o=Qc(e),a=qc(o),l=Oe(e),c=r==="y",h=i.x+i.width/2-s.width/2,d=i.y+i.height/2-s.height/2,u=i[a]/2-s[a]/2;let f;switch(l){case"top":f={x:h,y:i.y-s.height};break;case"bottom":f={x:h,y:i.y+i.height};break;case"right":f={x:i.x+i.width,y:d};break;case"left":f={x:i.x-s.width,y:d};break;default:f={x:i.x,y:i.y}}switch(Mr(e)){case"start":f[o]-=u*(t&&c?-1:1);break;case"end":f[o]+=u*(t&&c?-1:1);break}return f}const Zp=async(n,e,t)=>{const{placement:i="bottom",strategy:s="absolute",middleware:r=[],platform:o}=t,a=r.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:n,floating:e,strategy:s}),{x:h,y:d}=Al(c,i,l),u=i,f={},p=0;for(let m=0;m<a.length;m++){const{name:E,fn:g}=a[m],{x:b,y:v,data:I,reset:T}=await g({x:h,y:d,initialPlacement:i,placement:u,strategy:s,middlewareData:f,rects:c,platform:o,elements:{reference:n,floating:e}});h=b??h,d=v??d,f={...f,[E]:{...f[E],...I}},T&&p<=50&&(p++,typeof T=="object"&&(T.placement&&(u=T.placement),T.rects&&(c=T.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:s}):T.rects),{x:h,y:d}=Al(c,u,l)),m=-1)}return{x:h,y:d,placement:u,strategy:s,middlewareData:f}};async function Ea(n,e){var t;e===void 0&&(e={});const{x:i,y:s,platform:r,rects:o,elements:a,strategy:l}=n,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:d="floating",altBoundary:u=!1,padding:f=0}=Ks(e,n),p=Kc(f),m=a[u?d==="floating"?"reference":"floating":d],E=Hi(await r.getClippingRect({element:(t=await(r.isElement==null?void 0:r.isElement(m)))==null||t?m:m.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:c,rootBoundary:h,strategy:l})),g=d==="floating"?{x:i,y:s,width:o.floating.width,height:o.floating.height}:o.reference,b=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),v=await(r.isElement==null?void 0:r.isElement(b))?await(r.getScale==null?void 0:r.getScale(b))||{x:1,y:1}:{x:1,y:1},I=Hi(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:b,strategy:l}):g);return{top:(E.top-I.top+p.top)/v.y,bottom:(I.bottom-E.bottom+p.bottom)/v.y,left:(E.left-I.left+p.left)/v.x,right:(I.right-E.right+p.right)/v.x}}const qp=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,i;const{placement:s,middlewareData:r,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:h=!0,crossAxis:d=!0,fallbackPlacements:u,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...E}=Ks(n,e);if((t=r.arrow)!=null&&t.alignmentOffset)return{};const g=Oe(s),b=mi(a),v=Oe(a)===a,I=await(l.isRTL==null?void 0:l.isRTL(c.floating)),T=u||(v||!m?[tr(a)]:Yp(a)),A=p!=="none";!u&&A&&T.push(...jp(a,m,p,I));const R=[a,...T],P=await Ea(e,E),F=[];let x=((i=r.flip)==null?void 0:i.overflows)||[];if(h&&F.push(P[g]),d){const C=Gp(s,o,I);F.push(P[C[0]],P[C[1]])}if(x=[...x,{placement:s,overflows:F}],!F.every(C=>C<=0)){var D,w;const C=(((D=r.flip)==null?void 0:D.index)||0)+1,U=R[C];if(U)return{data:{index:C,overflows:x},reset:{placement:U}};let Z=(w=x.filter(H=>H.overflows[0]<=0).sort((H,st)=>H.overflows[1]-st.overflows[1])[0])==null?void 0:w.placement;if(!Z)switch(f){case"bestFit":{var L;const H=(L=x.filter(st=>{if(A){const Y=mi(st.placement);return Y===b||Y==="y"}return!0}).map(st=>[st.placement,st.overflows.filter(Y=>Y>0).reduce((Y,ot)=>Y+ot,0)]).sort((st,Y)=>st[1]-Y[1])[0])==null?void 0:L[0];H&&(Z=H);break}case"initialPlacement":Z=a;break}if(s!==Z)return{reset:{placement:Z}}}return{}}}};function Jc(n){const e=$i(...n.map(r=>r.left)),t=$i(...n.map(r=>r.top)),i=Ae(...n.map(r=>r.right)),s=Ae(...n.map(r=>r.bottom));return{x:e,y:t,width:i-e,height:s-t}}function Qp(n){const e=n.slice().sort((s,r)=>s.y-r.y),t=[];let i=null;for(let s=0;s<e.length;s++){const r=e[s];!i||r.y-i.y>i.height/2?t.push([r]):t[t.length-1].push(r),i=r}return t.map(s=>Hi(Jc(s)))}const Kp=function(n){return n===void 0&&(n={}),{name:"inline",options:n,async fn(e){const{placement:t,elements:i,rects:s,platform:r,strategy:o}=e,{padding:a=2,x:l,y:c}=Ks(n,e),h=Array.from(await(r.getClientRects==null?void 0:r.getClientRects(i.reference))||[]),d=Qp(h),u=Hi(Jc(h)),f=Kc(a);function p(){if(d.length===2&&d[0].left>d[1].right&&l!=null&&c!=null)return d.find(E=>l>E.left-f.left&&l<E.right+f.right&&c>E.top-f.top&&c<E.bottom+f.bottom)||u;if(d.length>=2){if(mi(t)==="y"){const x=d[0],D=d[d.length-1],w=Oe(t)==="top",L=x.top,C=D.bottom,U=w?x.left:D.left,Z=w?x.right:D.right,H=Z-U,st=C-L;return{top:L,bottom:C,left:U,right:Z,width:H,height:st,x:U,y:L}}const E=Oe(t)==="left",g=Ae(...d.map(x=>x.right)),b=$i(...d.map(x=>x.left)),v=d.filter(x=>E?x.left===b:x.right===g),I=v[0].top,T=v[v.length-1].bottom,A=b,R=g,P=R-A,F=T-I;return{top:I,bottom:T,left:A,right:R,width:P,height:F,x:A,y:I}}return u}const m=await r.getElementRects({reference:{getBoundingClientRect:p},floating:i.floating,strategy:o});return s.reference.x!==m.reference.x||s.reference.y!==m.reference.y||s.reference.width!==m.reference.width||s.reference.height!==m.reference.height?{reset:{rects:m}}:{}}}};async function Jp(n,e){const{placement:t,platform:i,elements:s}=n,r=await(i.isRTL==null?void 0:i.isRTL(s.floating)),o=Oe(t),a=Mr(t),l=mi(t)==="y",c=["left","top"].includes(o)?-1:1,h=r&&l?-1:1,d=Ks(e,n);let{mainAxis:u,crossAxis:f,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return a&&typeof p=="number"&&(f=a==="end"?p*-1:p),l?{x:f*h,y:u*c}:{x:u*c,y:f*h}}const th=function(n){return{name:"offset",options:n,async fn(e){var t,i;const{x:s,y:r,placement:o,middlewareData:a}=e,l=await Jp(e,n);return o===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:s+l.x,y:r+l.y,data:{...l,placement:o}}}}},tm=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:i,placement:s}=e,{mainAxis:r=!0,crossAxis:o=!1,limiter:a={fn:E=>{let{x:g,y:b}=E;return{x:g,y:b}}},...l}=Ks(n,e),c={x:t,y:i},h=await Ea(e,l),d=mi(Oe(s)),u=Zc(d);let f=c[u],p=c[d];if(r){const E=u==="y"?"top":"left",g=u==="y"?"bottom":"right",b=f+h[E],v=f-h[g];f=wl(b,f,v)}if(o){const E=d==="y"?"top":"left",g=d==="y"?"bottom":"right",b=p+h[E],v=p-h[g];p=wl(b,p,v)}const m=a.fn({...e,[u]:f,[d]:p});return{...m,data:{x:m.x-t,y:m.y-i}}}}};function je(n){return eh(n)?(n.nodeName||"").toLowerCase():"#document"}function Xt(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function qe(n){var e;return(e=(eh(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function eh(n){return n instanceof Node||n instanceof Xt(n).Node}function ye(n){return n instanceof Element||n instanceof Xt(n).Element}function _e(n){return n instanceof HTMLElement||n instanceof Xt(n).HTMLElement}function Rl(n){return typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Xt(n).ShadowRoot}function Js(n){const{overflow:e,overflowX:t,overflowY:i,display:s}=ne(n);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!["inline","contents"].includes(s)}function em(n){return["table","td","th"].includes(je(n))}function im(n){return[":popover-open",":modal"].some(e=>{try{return n.matches(e)}catch{return!1}})}function Ia(n){const e=ba(),t=ye(n)?ne(n):n;return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(t.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(t.contain||"").includes(i))}function sm(n){let e=Gi(n);for(;_e(e)&&!Dr(e);){if(Ia(e))return e;if(im(e))return null;e=Gi(e)}return null}function ba(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Dr(n){return["html","body","#document"].includes(je(n))}function ne(n){return Xt(n).getComputedStyle(n)}function Ur(n){return ye(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Gi(n){if(je(n)==="html")return n;const e=n.assignedSlot||n.parentNode||Rl(n)&&n.host||qe(n);return Rl(e)?e.host:e}function ih(n){const e=Gi(n);return Dr(e)?n.ownerDocument?n.ownerDocument.body:n.body:_e(e)&&Js(e)?e:ih(e)}function Yo(n,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=ih(n),r=s===((i=n.ownerDocument)==null?void 0:i.body),o=Xt(s);if(r){const a=nm(o);return e.concat(o,o.visualViewport||[],Js(s)?s:[],a&&t?Yo(a):[])}return e.concat(s,Yo(s,[],t))}function nm(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function sh(n){const e=ne(n);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const s=_e(n),r=s?n.offsetWidth:t,o=s?n.offsetHeight:i,a=Jn(t)!==r||Jn(i)!==o;return a&&(t=r,i=o),{width:t,height:i,$:a}}function nh(n){return ye(n)?n:n.contextElement}function Bi(n){const e=nh(n);if(!_e(e))return We(1);const t=e.getBoundingClientRect(),{width:i,height:s,$:r}=sh(e);let o=(r?Jn(t.width):t.width)/i,a=(r?Jn(t.height):t.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const rm=We(0);function rh(n){const e=Xt(n);return!ba()||!e.visualViewport?rm:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function om(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Xt(n)?!1:e}function Vs(n,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=n.getBoundingClientRect(),r=nh(n);let o=We(1);e&&(i?ye(i)&&(o=Bi(i)):o=Bi(n));const a=om(r,t,i)?rh(r):We(0);let l=(s.left+a.x)/o.x,c=(s.top+a.y)/o.y,h=s.width/o.x,d=s.height/o.y;if(r){const u=Xt(r),f=i&&ye(i)?Xt(i):i;let p=u,m=p.frameElement;for(;m&&i&&f!==p;){const E=Bi(m),g=m.getBoundingClientRect(),b=ne(m),v=g.left+(m.clientLeft+parseFloat(b.paddingLeft))*E.x,I=g.top+(m.clientTop+parseFloat(b.paddingTop))*E.y;l*=E.x,c*=E.y,h*=E.x,d*=E.y,l+=v,c+=I,p=Xt(m),m=p.frameElement}}return Hi({width:h,height:d,x:l,y:c})}const am=[":popover-open",":modal"];function oh(n){return am.some(e=>{try{return n.matches(e)}catch{return!1}})}function lm(n){let{elements:e,rect:t,offsetParent:i,strategy:s}=n;const r=s==="fixed",o=qe(i),a=e?oh(e.floating):!1;if(i===o||a&&r)return t;let l={scrollLeft:0,scrollTop:0},c=We(1);const h=We(0),d=_e(i);if((d||!d&&!r)&&((je(i)!=="body"||Js(o))&&(l=Ur(i)),_e(i))){const u=Vs(i);c=Bi(i),h.x=u.x+i.clientLeft,h.y=u.y+i.clientTop}return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+h.x,y:t.y*c.y-l.scrollTop*c.y+h.y}}function cm(n){return Array.from(n.getClientRects())}function ah(n){return Vs(qe(n)).left+Ur(n).scrollLeft}function hm(n){const e=qe(n),t=Ur(n),i=n.ownerDocument.body,s=Ae(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),r=Ae(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let o=-t.scrollLeft+ah(n);const a=-t.scrollTop;return ne(i).direction==="rtl"&&(o+=Ae(e.clientWidth,i.clientWidth)-s),{width:s,height:r,x:o,y:a}}function dm(n,e){const t=Xt(n),i=qe(n),s=t.visualViewport;let r=i.clientWidth,o=i.clientHeight,a=0,l=0;if(s){r=s.width,o=s.height;const c=ba();(!c||c&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:r,height:o,x:a,y:l}}function um(n,e){const t=Vs(n,!0,e==="fixed"),i=t.top+n.clientTop,s=t.left+n.clientLeft,r=_e(n)?Bi(n):We(1),o=n.clientWidth*r.x,a=n.clientHeight*r.y,l=s*r.x,c=i*r.y;return{width:o,height:a,x:l,y:c}}function Sl(n,e,t){let i;if(e==="viewport")i=dm(n,t);else if(e==="document")i=hm(qe(n));else if(ye(e))i=um(e,t);else{const s=rh(n);i={...e,x:e.x-s.x,y:e.y-s.y}}return Hi(i)}function lh(n,e){const t=Gi(n);return t===e||!ye(t)||Dr(t)?!1:ne(t).position==="fixed"||lh(t,e)}function fm(n,e){const t=e.get(n);if(t)return t;let i=Yo(n,[],!1).filter(a=>ye(a)&&je(a)!=="body"),s=null;const r=ne(n).position==="fixed";let o=r?Gi(n):n;for(;ye(o)&&!Dr(o);){const a=ne(o),l=Ia(o);!l&&a.position==="fixed"&&(s=null),(r?!l&&!s:!l&&a.position==="static"&&s&&["absolute","fixed"].includes(s.position)||Js(o)&&!l&&lh(n,o))?i=i.filter(c=>c!==o):s=a,o=Gi(o)}return e.set(n,i),i}function pm(n){let{element:e,boundary:t,rootBoundary:i,strategy:s}=n;const r=[...t==="clippingAncestors"?fm(e,this._c):[].concat(t),i],o=r[0],a=r.reduce((l,c)=>{const h=Sl(e,c,s);return l.top=Ae(h.top,l.top),l.right=$i(h.right,l.right),l.bottom=$i(h.bottom,l.bottom),l.left=Ae(h.left,l.left),l},Sl(e,o,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function mm(n){const{width:e,height:t}=sh(n);return{width:e,height:t}}function gm(n,e,t){const i=_e(e),s=qe(e),r=t==="fixed",o=Vs(n,!0,r,e);let a={scrollLeft:0,scrollTop:0};const l=We(0);if(i||!i&&!r)if((je(e)!=="body"||Js(s))&&(a=Ur(e)),i){const d=Vs(e,!0,r,e);l.x=d.x+e.clientLeft,l.y=d.y+e.clientTop}else s&&(l.x=ah(s));const c=o.left+a.scrollLeft-l.x,h=o.top+a.scrollTop-l.y;return{x:c,y:h,width:o.width,height:o.height}}function Fl(n,e){return!_e(n)||ne(n).position==="fixed"?null:e?e(n):n.offsetParent}function ch(n,e){const t=Xt(n);if(!_e(n)||oh(n))return t;let i=Fl(n,e);for(;i&&em(i)&&ne(i).position==="static";)i=Fl(i,e);return i&&(je(i)==="html"||je(i)==="body"&&ne(i).position==="static"&&!Ia(i))?t:i||sm(n)||t}const Em=async function(n){const e=this.getOffsetParent||ch,t=this.getDimensions;return{reference:gm(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,...await t(n.floating)}}};function Im(n){return ne(n).direction==="rtl"}const bm={convertOffsetParentRelativeRectToViewportRelativeRect:lm,getDocumentElement:qe,getClippingRect:pm,getOffsetParent:ch,getElementRects:Em,getClientRects:cm,getDimensions:mm,getScale:Bi,isElement:ye,isRTL:Im},hh=tm,dh=qp,uh=Kp,fh=(n,e,t)=>{const i=new Map,s={platform:bm,...t},r={...s.platform,_c:i};return Zp(n,e,{...s,platform:r})};/**
195
+ `}};y(_e,"default",{title:"BCF Topic",type:"Issue",status:"Active",labels:new Set});let Gs=_e;var Yp=Object.defineProperty,Wp=(r,e,t)=>e in r?Yp(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,oi=(r,e,t)=>(Wp(r,typeof e!="symbol"?e+"":e,t),t);const Hi=Math.min,Oe=Math.max,tr=Math.round,Ze=r=>({x:r,y:r}),jp={left:"right",right:"left",bottom:"top",top:"bottom"},Xp={start:"end",end:"start"};function Fl(r,e,t){return Oe(r,Hi(e,t))}function tn(r,e){return typeof r=="function"?r(e):r}function Me(r){return r.split("-")[0]}function kr(r){return r.split("-")[1]}function Jc(r){return r==="x"?"y":"x"}function th(r){return r==="y"?"height":"width"}function Ei(r){return["top","bottom"].includes(Me(r))?"y":"x"}function eh(r){return Jc(Ei(r))}function Zp(r,e,t){t===void 0&&(t=!1);const i=kr(r),s=eh(r),n=th(s);let o=s==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[n]>e.floating[n]&&(o=er(o)),[o,er(o)]}function qp(r){const e=er(r);return[Wo(r),e,Wo(e)]}function Wo(r){return r.replace(/start|end/g,e=>Xp[e])}function Qp(r,e,t){const i=["left","right"],s=["right","left"],n=["top","bottom"],o=["bottom","top"];switch(r){case"top":case"bottom":return t?e?s:i:e?i:s;case"left":case"right":return e?n:o;default:return[]}}function Kp(r,e,t,i){const s=kr(r);let n=Qp(Me(r),t==="start",i);return s&&(n=n.map(o=>o+"-"+s),e&&(n=n.concat(n.map(Wo)))),n}function er(r){return r.replace(/left|right|bottom|top/g,e=>jp[e])}function Jp(r){return{top:0,right:0,bottom:0,left:0,...r}}function ih(r){return typeof r!="number"?Jp(r):{top:r,right:r,bottom:r,left:r}}function Yi(r){const{x:e,y:t,width:i,height:s}=r;return{width:i,height:s,top:t,left:e,right:e+i,bottom:t+s,x:e,y:t}}function Ol(r,e,t){let{reference:i,floating:s}=r;const n=Ei(e),o=eh(e),a=th(o),l=Me(e),c=n==="y",h=i.x+i.width/2-s.width/2,d=i.y+i.height/2-s.height/2,u=i[a]/2-s[a]/2;let f;switch(l){case"top":f={x:h,y:i.y-s.height};break;case"bottom":f={x:h,y:i.y+i.height};break;case"right":f={x:i.x+i.width,y:d};break;case"left":f={x:i.x-s.width,y:d};break;default:f={x:i.x,y:i.y}}switch(kr(e)){case"start":f[o]-=u*(t&&c?-1:1);break;case"end":f[o]+=u*(t&&c?-1:1);break}return f}const tm=async(r,e,t)=>{const{placement:i="bottom",strategy:s="absolute",middleware:n=[],platform:o}=t,a=n.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:r,floating:e,strategy:s}),{x:h,y:d}=Ol(c,i,l),u=i,f={},p=0;for(let m=0;m<a.length;m++){const{name:E,fn:g}=a[m],{x:I,y:T,data:b,reset:v}=await g({x:h,y:d,initialPlacement:i,placement:u,strategy:s,middlewareData:f,rects:c,platform:o,elements:{reference:r,floating:e}});h=I??h,d=T??d,f={...f,[E]:{...f[E],...b}},v&&p<=50&&(p++,typeof v=="object"&&(v.placement&&(u=v.placement),v.rects&&(c=v.rects===!0?await o.getElementRects({reference:r,floating:e,strategy:s}):v.rects),{x:h,y:d}=Ol(c,u,l)),m=-1)}return{x:h,y:d,placement:u,strategy:s,middlewareData:f}};async function sh(r,e){var t;e===void 0&&(e={});const{x:i,y:s,platform:n,rects:o,elements:a,strategy:l}=r,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:d="floating",altBoundary:u=!1,padding:f=0}=tn(e,r),p=ih(f),m=a[u?d==="floating"?"reference":"floating":d],E=Yi(await n.getClippingRect({element:(t=await(n.isElement==null?void 0:n.isElement(m)))==null||t?m:m.contextElement||await(n.getDocumentElement==null?void 0:n.getDocumentElement(a.floating)),boundary:c,rootBoundary:h,strategy:l})),g=d==="floating"?{x:i,y:s,width:o.floating.width,height:o.floating.height}:o.reference,I=await(n.getOffsetParent==null?void 0:n.getOffsetParent(a.floating)),T=await(n.isElement==null?void 0:n.isElement(I))?await(n.getScale==null?void 0:n.getScale(I))||{x:1,y:1}:{x:1,y:1},b=Yi(n.convertOffsetParentRelativeRectToViewportRelativeRect?await n.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:g,offsetParent:I,strategy:l}):g);return{top:(E.top-b.top+p.top)/T.y,bottom:(b.bottom-E.bottom+p.bottom)/T.y,left:(E.left-b.left+p.left)/T.x,right:(b.right-E.right+p.right)/T.x}}const em=function(r){return r===void 0&&(r={}),{name:"flip",options:r,async fn(e){var t,i;const{placement:s,middlewareData:n,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:h=!0,crossAxis:d=!0,fallbackPlacements:u,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...E}=tn(r,e);if((t=n.arrow)!=null&&t.alignmentOffset)return{};const g=Me(s),I=Ei(a),T=Me(a)===a,b=await(l.isRTL==null?void 0:l.isRTL(c.floating)),v=u||(T||!m?[er(a)]:qp(a)),A=p!=="none";!u&&A&&v.push(...Kp(a,m,p,b));const S=[a,...v],N=await sh(e,E),R=[];let P=((i=n.flip)==null?void 0:i.overflows)||[];if(h&&R.push(N[g]),d){const C=Zp(s,o,b);R.push(N[C[0]],N[C[1]])}if(P=[...P,{placement:s,overflows:R}],!R.every(C=>C<=0)){var M,w;const C=(((M=n.flip)==null?void 0:M.index)||0)+1,U=S[C];if(U)return{data:{index:C,overflows:P},reset:{placement:U}};let q=(w=P.filter(G=>G.overflows[0]<=0).sort((G,st)=>G.overflows[1]-st.overflows[1])[0])==null?void 0:w.placement;if(!q)switch(f){case"bestFit":{var L;const G=(L=P.filter(st=>{if(A){const Y=Ei(st.placement);return Y===I||Y==="y"}return!0}).map(st=>[st.placement,st.overflows.filter(Y=>Y>0).reduce((Y,ot)=>Y+ot,0)]).sort((st,Y)=>st[1]-Y[1])[0])==null?void 0:L[0];G&&(q=G);break}case"initialPlacement":q=a;break}if(s!==q)return{reset:{placement:q}}}return{}}}};function nh(r){const e=Hi(...r.map(n=>n.left)),t=Hi(...r.map(n=>n.top)),i=Oe(...r.map(n=>n.right)),s=Oe(...r.map(n=>n.bottom));return{x:e,y:t,width:i-e,height:s-t}}function im(r){const e=r.slice().sort((s,n)=>s.y-n.y),t=[];let i=null;for(let s=0;s<e.length;s++){const n=e[s];!i||n.y-i.y>i.height/2?t.push([n]):t[t.length-1].push(n),i=n}return t.map(s=>Yi(nh(s)))}const sm=function(r){return r===void 0&&(r={}),{name:"inline",options:r,async fn(e){const{placement:t,elements:i,rects:s,platform:n,strategy:o}=e,{padding:a=2,x:l,y:c}=tn(r,e),h=Array.from(await(n.getClientRects==null?void 0:n.getClientRects(i.reference))||[]),d=im(h),u=Yi(nh(h)),f=ih(a);function p(){if(d.length===2&&d[0].left>d[1].right&&l!=null&&c!=null)return d.find(E=>l>E.left-f.left&&l<E.right+f.right&&c>E.top-f.top&&c<E.bottom+f.bottom)||u;if(d.length>=2){if(Ei(t)==="y"){const P=d[0],M=d[d.length-1],w=Me(t)==="top",L=P.top,C=M.bottom,U=w?P.left:M.left,q=w?P.right:M.right,G=q-U,st=C-L;return{top:L,bottom:C,left:U,right:q,width:G,height:st,x:U,y:L}}const E=Me(t)==="left",g=Oe(...d.map(P=>P.right)),I=Hi(...d.map(P=>P.left)),T=d.filter(P=>E?P.left===I:P.right===g),b=T[0].top,v=T[T.length-1].bottom,A=I,S=g,N=S-A,R=v-b;return{top:b,bottom:v,left:A,right:S,width:N,height:R,x:A,y:b}}return u}const m=await n.getElementRects({reference:{getBoundingClientRect:p},floating:i.floating,strategy:o});return s.reference.x!==m.reference.x||s.reference.y!==m.reference.y||s.reference.width!==m.reference.width||s.reference.height!==m.reference.height?{reset:{rects:m}}:{}}}};async function nm(r,e){const{placement:t,platform:i,elements:s}=r,n=await(i.isRTL==null?void 0:i.isRTL(s.floating)),o=Me(t),a=kr(t),l=Ei(t)==="y",c=["left","top"].includes(o)?-1:1,h=n&&l?-1:1,d=tn(e,r);let{mainAxis:u,crossAxis:f,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return a&&typeof p=="number"&&(f=a==="end"?p*-1:p),l?{x:f*h,y:u*c}:{x:u*c,y:f*h}}const rh=function(r){return{name:"offset",options:r,async fn(e){var t,i;const{x:s,y:n,placement:o,middlewareData:a}=e,l=await nm(e,r);return o===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:s+l.x,y:n+l.y,data:{...l,placement:o}}}}},rm=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(e){const{x:t,y:i,placement:s}=e,{mainAxis:n=!0,crossAxis:o=!1,limiter:a={fn:E=>{let{x:g,y:I}=E;return{x:g,y:I}}},...l}=tn(r,e),c={x:t,y:i},h=await sh(e,l),d=Ei(Me(s)),u=Jc(d);let f=c[u],p=c[d];if(n){const E=u==="y"?"top":"left",g=u==="y"?"bottom":"right",I=f+h[E],T=f-h[g];f=Fl(I,f,T)}if(o){const E=d==="y"?"top":"left",g=d==="y"?"bottom":"right",I=p+h[E],T=p-h[g];p=Fl(I,p,T)}const m=a.fn({...e,[u]:f,[d]:p});return{...m,data:{x:m.x-t,y:m.y-i}}}}};function qe(r){return oh(r)?(r.nodeName||"").toLowerCase():"#document"}function qt(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function Je(r){var e;return(e=(oh(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function oh(r){return r instanceof Node||r instanceof qt(r).Node}function Te(r){return r instanceof Element||r instanceof qt(r).Element}function ve(r){return r instanceof HTMLElement||r instanceof qt(r).HTMLElement}function xl(r){return typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof qt(r).ShadowRoot}function en(r){const{overflow:e,overflowX:t,overflowY:i,display:s}=oe(r);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!["inline","contents"].includes(s)}function om(r){return["table","td","th"].includes(qe(r))}function am(r){return[":popover-open",":modal"].some(e=>{try{return r.matches(e)}catch{return!1}})}function Ia(r){const e=Ca(),t=Te(r)?oe(r):r;return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(t.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(t.contain||"").includes(i))}function lm(r){let e=Wi(r);for(;ve(e)&&!Br(e);){if(Ia(e))return e;if(am(e))return null;e=Wi(e)}return null}function Ca(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Br(r){return["html","body","#document"].includes(qe(r))}function oe(r){return qt(r).getComputedStyle(r)}function zr(r){return Te(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function Wi(r){if(qe(r)==="html")return r;const e=r.assignedSlot||r.parentNode||xl(r)&&r.host||Je(r);return xl(e)?e.host:e}function ah(r){const e=Wi(r);return Br(e)?r.ownerDocument?r.ownerDocument.body:r.body:ve(e)&&en(e)?e:ah(e)}function jo(r,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=ah(r),n=s===((i=r.ownerDocument)==null?void 0:i.body),o=qt(s);if(n){const a=cm(o);return e.concat(o,o.visualViewport||[],en(s)?s:[],a&&t?jo(a):[])}return e.concat(s,jo(s,[],t))}function cm(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function lh(r){const e=oe(r);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const s=ve(r),n=s?r.offsetWidth:t,o=s?r.offsetHeight:i,a=tr(t)!==n||tr(i)!==o;return a&&(t=n,i=o),{width:t,height:i,$:a}}function ch(r){return Te(r)?r:r.contextElement}function Vi(r){const e=ch(r);if(!ve(e))return Ze(1);const t=e.getBoundingClientRect(),{width:i,height:s,$:n}=lh(e);let o=(n?tr(t.width):t.width)/i,a=(n?tr(t.height):t.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const hm=Ze(0);function hh(r){const e=qt(r);return!Ca()||!e.visualViewport?hm:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function dm(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==qt(r)?!1:e}function Hs(r,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=r.getBoundingClientRect(),n=ch(r);let o=Ze(1);e&&(i?Te(i)&&(o=Vi(i)):o=Vi(r));const a=dm(n,t,i)?hh(n):Ze(0);let l=(s.left+a.x)/o.x,c=(s.top+a.y)/o.y,h=s.width/o.x,d=s.height/o.y;if(n){const u=qt(n),f=i&&Te(i)?qt(i):i;let p=u,m=p.frameElement;for(;m&&i&&f!==p;){const E=Vi(m),g=m.getBoundingClientRect(),I=oe(m),T=g.left+(m.clientLeft+parseFloat(I.paddingLeft))*E.x,b=g.top+(m.clientTop+parseFloat(I.paddingTop))*E.y;l*=E.x,c*=E.y,h*=E.x,d*=E.y,l+=T,c+=b,p=qt(m),m=p.frameElement}}return Yi({width:h,height:d,x:l,y:c})}const um=[":popover-open",":modal"];function dh(r){return um.some(e=>{try{return r.matches(e)}catch{return!1}})}function fm(r){let{elements:e,rect:t,offsetParent:i,strategy:s}=r;const n=s==="fixed",o=Je(i),a=e?dh(e.floating):!1;if(i===o||a&&n)return t;let l={scrollLeft:0,scrollTop:0},c=Ze(1);const h=Ze(0),d=ve(i);if((d||!d&&!n)&&((qe(i)!=="body"||en(o))&&(l=zr(i)),ve(i))){const u=Hs(i);c=Vi(i),h.x=u.x+i.clientLeft,h.y=u.y+i.clientTop}return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+h.x,y:t.y*c.y-l.scrollTop*c.y+h.y}}function pm(r){return Array.from(r.getClientRects())}function uh(r){return Hs(Je(r)).left+zr(r).scrollLeft}function mm(r){const e=Je(r),t=zr(r),i=r.ownerDocument.body,s=Oe(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),n=Oe(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let o=-t.scrollLeft+uh(r);const a=-t.scrollTop;return oe(i).direction==="rtl"&&(o+=Oe(e.clientWidth,i.clientWidth)-s),{width:s,height:n,x:o,y:a}}function gm(r,e){const t=qt(r),i=Je(r),s=t.visualViewport;let n=i.clientWidth,o=i.clientHeight,a=0,l=0;if(s){n=s.width,o=s.height;const c=Ca();(!c||c&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:n,height:o,x:a,y:l}}function Em(r,e){const t=Hs(r,!0,e==="fixed"),i=t.top+r.clientTop,s=t.left+r.clientLeft,n=ve(r)?Vi(r):Ze(1),o=r.clientWidth*n.x,a=r.clientHeight*n.y,l=s*n.x,c=i*n.y;return{width:o,height:a,x:l,y:c}}function Nl(r,e,t){let i;if(e==="viewport")i=gm(r,t);else if(e==="document")i=mm(Je(r));else if(Te(e))i=Em(e,t);else{const s=hh(r);i={...e,x:e.x-s.x,y:e.y-s.y}}return Yi(i)}function fh(r,e){const t=Wi(r);return t===e||!Te(t)||Br(t)?!1:oe(t).position==="fixed"||fh(t,e)}function bm(r,e){const t=e.get(r);if(t)return t;let i=jo(r,[],!1).filter(a=>Te(a)&&qe(a)!=="body"),s=null;const n=oe(r).position==="fixed";let o=n?Wi(r):r;for(;Te(o)&&!Br(o);){const a=oe(o),l=Ia(o);!l&&a.position==="fixed"&&(s=null),(n?!l&&!s:!l&&a.position==="static"&&s&&["absolute","fixed"].includes(s.position)||en(o)&&!l&&fh(r,o))?i=i.filter(c=>c!==o):s=a,o=Wi(o)}return e.set(r,i),i}function Im(r){let{element:e,boundary:t,rootBoundary:i,strategy:s}=r;const n=[...t==="clippingAncestors"?bm(e,this._c):[].concat(t),i],o=n[0],a=n.reduce((l,c)=>{const h=Nl(e,c,s);return l.top=Oe(h.top,l.top),l.right=Hi(h.right,l.right),l.bottom=Hi(h.bottom,l.bottom),l.left=Oe(h.left,l.left),l},Nl(e,o,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Cm(r){const{width:e,height:t}=lh(r);return{width:e,height:t}}function ym(r,e,t){const i=ve(e),s=Je(e),n=t==="fixed",o=Hs(r,!0,n,e);let a={scrollLeft:0,scrollTop:0};const l=Ze(0);if(i||!i&&!n)if((qe(e)!=="body"||en(s))&&(a=zr(e)),i){const d=Hs(e,!0,n,e);l.x=d.x+e.clientLeft,l.y=d.y+e.clientTop}else s&&(l.x=uh(s));const c=o.left+a.scrollLeft-l.x,h=o.top+a.scrollTop-l.y;return{x:c,y:h,width:o.width,height:o.height}}function Pl(r,e){return!ve(r)||oe(r).position==="fixed"?null:e?e(r):r.offsetParent}function ph(r,e){const t=qt(r);if(!ve(r)||dh(r))return t;let i=Pl(r,e);for(;i&&om(i)&&oe(i).position==="static";)i=Pl(i,e);return i&&(qe(i)==="html"||qe(i)==="body"&&oe(i).position==="static"&&!Ia(i))?t:i||lm(r)||t}const _m=async function(r){const e=this.getOffsetParent||ph,t=this.getDimensions;return{reference:ym(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,...await t(r.floating)}}};function Tm(r){return oe(r).direction==="rtl"}const vm={convertOffsetParentRelativeRectToViewportRelativeRect:fm,getDocumentElement:Je,getClippingRect:Im,getOffsetParent:ph,getElementRects:_m,getClientRects:pm,getDimensions:Cm,getScale:Vi,isElement:Te,isRTL:Tm},mh=rm,gh=em,Eh=sm,bh=(r,e,t)=>{const i=new Map,s={platform:vm,...t},n={...s.platform,_c:i};return tm(r,e,{...s,platform:n})};/**
196
196
  * @license
197
197
  * Copyright 2019 Google LLC
198
198
  * SPDX-License-Identifier: BSD-3-Clause
199
- */const Hn=globalThis,Ca=Hn.ShadowRoot&&(Hn.ShadyCSS===void 0||Hn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ya=Symbol(),Ol=new WeakMap;let ph=class{constructor(n,e,t){if(this._$cssResult$=!0,t!==ya)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=n,this.t=e}get styleSheet(){let n=this.o;const e=this.t;if(Ca&&n===void 0){const t=e!==void 0&&e.length===1;t&&(n=Ol.get(e)),n===void 0&&((this.o=n=new CSSStyleSheet).replaceSync(this.cssText),t&&Ol.set(e,n))}return n}toString(){return this.cssText}};const Cm=n=>new ph(typeof n=="string"?n:n+"",void 0,ya),yt=(n,...e)=>{const t=n.length===1?n[0]:e.reduce((i,s,r)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+n[r+1],n[0]);return new ph(t,n,ya)},ym=(n,e)=>{if(Ca)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),s=Hn.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=t.cssText,n.appendChild(i)}},xl=Ca?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return Cm(t)})(n):n;/**
199
+ */const Hn=globalThis,ya=Hn.ShadowRoot&&(Hn.ShadyCSS===void 0||Hn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,_a=Symbol(),Ll=new WeakMap;let Ih=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==_a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o;const e=this.t;if(ya&&r===void 0){const t=e!==void 0&&e.length===1;t&&(r=Ll.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Ll.set(e,r))}return r}toString(){return this.cssText}};const wm=r=>new Ih(typeof r=="string"?r:r+"",void 0,_a),yt=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((i,s,n)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+r[n+1],r[0]);return new Ih(t,r,_a)},Am=(r,e)=>{if(ya)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),s=Hn.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=t.cssText,r.appendChild(i)}},Ml=ya?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return wm(t)})(r):r;/**
200
200
  * @license
201
201
  * Copyright 2017 Google LLC
202
202
  * SPDX-License-Identifier: BSD-3-Clause
203
- */const{is:_m,defineProperty:Tm,getOwnPropertyDescriptor:vm,getOwnPropertyNames:wm,getOwnPropertySymbols:Am,getPrototypeOf:Rm}=Object,Yi=globalThis,Nl=Yi.trustedTypes,Sm=Nl?Nl.emptyScript:"",Pl=Yi.reactiveElementPolyfillSupport,Fs=(n,e)=>n,er={toAttribute(n,e){switch(e){case Boolean:n=n?Sm:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},_a=(n,e)=>!_m(n,e),Ll={attribute:!0,type:String,converter:er,reflect:!1,hasChanged:_a};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Yi.litPropertyMetadata??(Yi.litPropertyMetadata=new WeakMap);class Ui extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ll){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(e,i,t);s!==void 0&&Tm(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){const{get:s,set:r}=vm(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get(){return s==null?void 0:s.call(this)},set(o){const a=s==null?void 0:s.call(this);r.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ll}static _$Ei(){if(this.hasOwnProperty(Fs("elementProperties")))return;const e=Rm(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Fs("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Fs("properties"))){const t=this.properties,i=[...wm(t),...Am(t)];for(const s of i)this.createProperty(s,t[s])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,s]of t)this.elementProperties.set(i,s)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const s=this._$Eu(t,i);s!==void 0&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const s of i)t.unshift(xl(s))}else e!==void 0&&t.push(xl(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ym(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EC(e,t){var i;const s=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,s);if(r!==void 0&&s.reflect===!0){const o=(((i=s.converter)==null?void 0:i.toAttribute)!==void 0?s.converter:er).toAttribute(t,s.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,t){var i;const s=this.constructor,r=s._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const o=s.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((i=o.converter)==null?void 0:i.fromAttribute)!==void 0?o.converter:er;this._$Em=r,this[r]=a.fromAttribute(t,o.type),this._$Em=null}}requestUpdate(e,t,i){if(e!==void 0){if(i??(i=this.constructor.getPropertyOptions(e)),!(i.hasChanged??_a)(this[e],t))return;this.P(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,i){this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[r,o]of s)o.wrapped!==!0||this._$AL.has(r)||this[r]===void 0||this.P(r,this[r],o)}let t=!1;const i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),(e=this._$EO)==null||e.forEach(s=>{var r;return(r=s.hostUpdate)==null?void 0:r.call(s)}),this.update(i)):this._$EU()}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(i=>{var s;return(s=i.hostUpdated)==null?void 0:s.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EC(t,this[t]))),this._$EU()}updated(e){}firstUpdated(e){}}Ui.elementStyles=[],Ui.shadowRootOptions={mode:"open"},Ui[Fs("elementProperties")]=new Map,Ui[Fs("finalized")]=new Map,Pl==null||Pl({ReactiveElement:Ui}),(Yi.reactiveElementVersions??(Yi.reactiveElementVersions=[])).push("2.0.4");/**
203
+ */const{is:Rm,defineProperty:Sm,getOwnPropertyDescriptor:Fm,getOwnPropertyNames:Om,getOwnPropertySymbols:xm,getPrototypeOf:Nm}=Object,ji=globalThis,Dl=ji.trustedTypes,Pm=Dl?Dl.emptyScript:"",Ul=ji.reactiveElementPolyfillSupport,Ps=(r,e)=>r,ir={toAttribute(r,e){switch(e){case Boolean:r=r?Pm:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Ta=(r,e)=>!Rm(r,e),kl={attribute:!0,type:String,converter:ir,reflect:!1,hasChanged:Ta};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),ji.litPropertyMetadata??(ji.litPropertyMetadata=new WeakMap);class Bi extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=kl){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(e,i,t);s!==void 0&&Sm(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){const{get:s,set:n}=Fm(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get(){return s==null?void 0:s.call(this)},set(o){const a=s==null?void 0:s.call(this);n.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??kl}static _$Ei(){if(this.hasOwnProperty(Ps("elementProperties")))return;const e=Nm(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ps("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ps("properties"))){const t=this.properties,i=[...Om(t),...xm(t)];for(const s of i)this.createProperty(s,t[s])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,s]of t)this.elementProperties.set(i,s)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const s=this._$Eu(t,i);s!==void 0&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const s of i)t.unshift(Ml(s))}else e!==void 0&&t.push(Ml(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Am(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EC(e,t){var i;const s=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,s);if(n!==void 0&&s.reflect===!0){const o=(((i=s.converter)==null?void 0:i.toAttribute)!==void 0?s.converter:ir).toAttribute(t,s.type);this._$Em=e,o==null?this.removeAttribute(n):this.setAttribute(n,o),this._$Em=null}}_$AK(e,t){var i;const s=this.constructor,n=s._$Eh.get(e);if(n!==void 0&&this._$Em!==n){const o=s.getPropertyOptions(n),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((i=o.converter)==null?void 0:i.fromAttribute)!==void 0?o.converter:ir;this._$Em=n,this[n]=a.fromAttribute(t,o.type),this._$Em=null}}requestUpdate(e,t,i){if(e!==void 0){if(i??(i=this.constructor.getPropertyOptions(e)),!(i.hasChanged??Ta)(this[e],t))return;this.P(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,i){this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[n,o]of s)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.P(n,this[n],o)}let t=!1;const i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),(e=this._$EO)==null||e.forEach(s=>{var n;return(n=s.hostUpdate)==null?void 0:n.call(s)}),this.update(i)):this._$EU()}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(i=>{var s;return(s=i.hostUpdated)==null?void 0:s.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EC(t,this[t]))),this._$EU()}updated(e){}firstUpdated(e){}}Bi.elementStyles=[],Bi.shadowRootOptions={mode:"open"},Bi[Ps("elementProperties")]=new Map,Bi[Ps("finalized")]=new Map,Ul==null||Ul({ReactiveElement:Bi}),(ji.reactiveElementVersions??(ji.reactiveElementVersions=[])).push("2.0.4");/**
204
204
  * @license
205
205
  * Copyright 2017 Google LLC
206
206
  * SPDX-License-Identifier: BSD-3-Clause
207
- */const ir=globalThis,sr=ir.trustedTypes,Ml=sr?sr.createPolicy("lit-html",{createHTML:n=>n}):void 0,mh="$lit$",Be=`lit$${Math.random().toFixed(9).slice(2)}$`,gh="?"+Be,Fm=`<${gh}>`,gi=document,$s=()=>gi.createComment(""),Hs=n=>n===null||typeof n!="object"&&typeof n!="function",Ta=Array.isArray,Om=n=>Ta(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",Co=`[
208
- \f\r]`,Ts=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Dl=/-->/g,Ul=/>/g,ni=RegExp(`>|${Co}(?:([^\\s"'>=/]+)(${Co}*=${Co}*(?:[^
209
- \f\r"'\`<>=]|("|')|))|$)`,"g"),kl=/'/g,Bl=/"/g,Eh=/^(?:script|style|textarea|title)$/i,xm=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),K=xm(1),Ei=Symbol.for("lit-noChange"),Mt=Symbol.for("lit-nothing"),zl=new WeakMap,li=gi.createTreeWalker(gi,129);function Ih(n,e){if(!Ta(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ml!==void 0?Ml.createHTML(e):e}const Nm=(n,e)=>{const t=n.length-1,i=[];let s,r=e===2?"<svg>":e===3?"<math>":"",o=Ts;for(let a=0;a<t;a++){const l=n[a];let c,h,d=-1,u=0;for(;u<l.length&&(o.lastIndex=u,h=o.exec(l),h!==null);)u=o.lastIndex,o===Ts?h[1]==="!--"?o=Dl:h[1]!==void 0?o=Ul:h[2]!==void 0?(Eh.test(h[2])&&(s=RegExp("</"+h[2],"g")),o=ni):h[3]!==void 0&&(o=ni):o===ni?h[0]===">"?(o=s??Ts,d=-1):h[1]===void 0?d=-2:(d=o.lastIndex-h[2].length,c=h[1],o=h[3]===void 0?ni:h[3]==='"'?Bl:kl):o===Bl||o===kl?o=ni:o===Dl||o===Ul?o=Ts:(o=ni,s=void 0);const f=o===ni&&n[a+1].startsWith("/>")?" ":"";r+=o===Ts?l+Fm:d>=0?(i.push(c),l.slice(0,d)+mh+l.slice(d)+Be+f):l+Be+(d===-2?a:f)}return[Ih(n,r+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};class Gs{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let r=0,o=0;const a=e.length-1,l=this.parts,[c,h]=Nm(e,t);if(this.el=Gs.createElement(c,i),li.currentNode=this.el.content,t===2||t===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(s=li.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const d of s.getAttributeNames())if(d.endsWith(mh)){const u=h[o++],f=s.getAttribute(d).split(Be),p=/([.?@])?(.*)/.exec(u);l.push({type:1,index:r,name:p[2],strings:f,ctor:p[1]==="."?Lm:p[1]==="?"?Mm:p[1]==="@"?Dm:kr}),s.removeAttribute(d)}else d.startsWith(Be)&&(l.push({type:6,index:r}),s.removeAttribute(d));if(Eh.test(s.tagName)){const d=s.textContent.split(Be),u=d.length-1;if(u>0){s.textContent=sr?sr.emptyScript:"";for(let f=0;f<u;f++)s.append(d[f],$s()),li.nextNode(),l.push({type:2,index:++r});s.append(d[u],$s())}}}else if(s.nodeType===8)if(s.data===gh)l.push({type:2,index:r});else{let d=-1;for(;(d=s.data.indexOf(Be,d+1))!==-1;)l.push({type:7,index:r}),d+=Be.length-1}r++}}static createElement(e,t){const i=gi.createElement("template");return i.innerHTML=e,i}}function Wi(n,e,t=n,i){var s,r;if(e===Ei)return e;let o=i!==void 0?(s=t.o)==null?void 0:s[i]:t.l;const a=Hs(e)?void 0:e._$litDirective$;return(o==null?void 0:o.constructor)!==a&&((r=o==null?void 0:o._$AO)==null||r.call(o,!1),a===void 0?o=void 0:(o=new a(n),o._$AT(n,t,i)),i!==void 0?(t.o??(t.o=[]))[i]=o:t.l=o),o!==void 0&&(e=Wi(n,o._$AS(n,e.values),o,i)),e}class Pm{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,s=((e==null?void 0:e.creationScope)??gi).importNode(t,!0);li.currentNode=s;let r=li.nextNode(),o=0,a=0,l=i[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new tn(r,r.nextSibling,this,e):l.type===1?c=new l.ctor(r,l.name,l.strings,this,e):l.type===6&&(c=new Um(r,this,e)),this._$AV.push(c),l=i[++a]}o!==(l==null?void 0:l.index)&&(r=li.nextNode(),o++)}return li.currentNode=gi,s}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class tn{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this.v}constructor(e,t,i,s){this.type=2,this._$AH=Mt,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this.v=(s==null?void 0:s.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Wi(this,e,t),Hs(e)?e===Mt||e==null||e===""?(this._$AH!==Mt&&this._$AR(),this._$AH=Mt):e!==this._$AH&&e!==Ei&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Om(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Mt&&Hs(this._$AH)?this._$AA.nextSibling.data=e:this.T(gi.createTextNode(e)),this._$AH=e}$(e){var t;const{values:i,_$litType$:s}=e,r=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=Gs.createElement(Ih(s.h,s.h[0]),this.options)),s);if(((t=this._$AH)==null?void 0:t._$AD)===r)this._$AH.p(i);else{const o=new Pm(r,this),a=o.u(this.options);o.p(i),this.T(a),this._$AH=o}}_$AC(e){let t=zl.get(e.strings);return t===void 0&&zl.set(e.strings,t=new Gs(e)),t}k(e){Ta(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const r of e)s===t.length?t.push(i=new tn(this.O($s()),this.O($s()),this,this.options)):i=t[s],i._$AI(r),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const s=e.nextSibling;e.remove(),e=s}}setConnected(e){var t;this._$AM===void 0&&(this.v=e,(t=this._$AP)==null||t.call(this,e))}}class kr{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,r){this.type=1,this._$AH=Mt,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=r,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Mt}_$AI(e,t=this,i,s){const r=this.strings;let o=!1;if(r===void 0)e=Wi(this,e,t,0),o=!Hs(e)||e!==this._$AH&&e!==Ei,o&&(this._$AH=e);else{const a=e;let l,c;for(e=r[0],l=0;l<r.length-1;l++)c=Wi(this,a[i+l],t,l),c===Ei&&(c=this._$AH[l]),o||(o=!Hs(c)||c!==this._$AH[l]),c===Mt?e=Mt:e!==Mt&&(e+=(c??"")+r[l+1]),this._$AH[l]=c}o&&!s&&this.j(e)}j(e){e===Mt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Lm extends kr{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Mt?void 0:e}}class Mm extends kr{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Mt)}}class Dm extends kr{constructor(e,t,i,s,r){super(e,t,i,s,r),this.type=5}_$AI(e,t=this){if((e=Wi(this,e,t,0)??Mt)===Ei)return;const i=this._$AH,s=e===Mt&&i!==Mt||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,r=e!==Mt&&(i===Mt||s);s&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class Um{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Wi(this,e)}}const Vl=ir.litHtmlPolyfillSupport;Vl==null||Vl(Gs,tn),(ir.litHtmlVersions??(ir.litHtmlVersions=[])).push("3.2.0");const ji=(n,e,t)=>{const i=(t==null?void 0:t.renderBefore)??e;let s=i._$litPart$;if(s===void 0){const r=(t==null?void 0:t.renderBefore)??null;i._$litPart$=s=new tn(e.insertBefore($s(),r),r,void 0,t??{})}return s._$AI(n),s};/**
207
+ */const sr=globalThis,nr=sr.trustedTypes,Bl=nr?nr.createPolicy("lit-html",{createHTML:r=>r}):void 0,Ch="$lit$",Ge=`lit$${Math.random().toFixed(9).slice(2)}$`,yh="?"+Ge,Lm=`<${yh}>`,bi=document,Ys=()=>bi.createComment(""),Ws=r=>r===null||typeof r!="object"&&typeof r!="function",va=Array.isArray,Mm=r=>va(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",_o=`[
208
+ \f\r]`,Rs=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,zl=/-->/g,$l=/>/g,ai=RegExp(`>|${_o}(?:([^\\s"'>=/]+)(${_o}*=${_o}*(?:[^
209
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Vl=/'/g,Gl=/"/g,_h=/^(?:script|style|textarea|title)$/i,Dm=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),X=Dm(1),Ii=Symbol.for("lit-noChange"),Dt=Symbol.for("lit-nothing"),Hl=new WeakMap,di=bi.createTreeWalker(bi,129);function Th(r,e){if(!va(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Bl!==void 0?Bl.createHTML(e):e}const Um=(r,e)=>{const t=r.length-1,i=[];let s,n=e===2?"<svg>":e===3?"<math>":"",o=Rs;for(let a=0;a<t;a++){const l=r[a];let c,h,d=-1,u=0;for(;u<l.length&&(o.lastIndex=u,h=o.exec(l),h!==null);)u=o.lastIndex,o===Rs?h[1]==="!--"?o=zl:h[1]!==void 0?o=$l:h[2]!==void 0?(_h.test(h[2])&&(s=RegExp("</"+h[2],"g")),o=ai):h[3]!==void 0&&(o=ai):o===ai?h[0]===">"?(o=s??Rs,d=-1):h[1]===void 0?d=-2:(d=o.lastIndex-h[2].length,c=h[1],o=h[3]===void 0?ai:h[3]==='"'?Gl:Vl):o===Gl||o===Vl?o=ai:o===zl||o===$l?o=Rs:(o=ai,s=void 0);const f=o===ai&&r[a+1].startsWith("/>")?" ":"";n+=o===Rs?l+Lm:d>=0?(i.push(c),l.slice(0,d)+Ch+l.slice(d)+Ge+f):l+Ge+(d===-2?a:f)}return[Th(r,n+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};class js{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let n=0,o=0;const a=e.length-1,l=this.parts,[c,h]=Um(e,t);if(this.el=js.createElement(c,i),di.currentNode=this.el.content,t===2||t===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(s=di.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const d of s.getAttributeNames())if(d.endsWith(Ch)){const u=h[o++],f=s.getAttribute(d).split(Ge),p=/([.?@])?(.*)/.exec(u);l.push({type:1,index:n,name:p[2],strings:f,ctor:p[1]==="."?Bm:p[1]==="?"?zm:p[1]==="@"?$m:$r}),s.removeAttribute(d)}else d.startsWith(Ge)&&(l.push({type:6,index:n}),s.removeAttribute(d));if(_h.test(s.tagName)){const d=s.textContent.split(Ge),u=d.length-1;if(u>0){s.textContent=nr?nr.emptyScript:"";for(let f=0;f<u;f++)s.append(d[f],Ys()),di.nextNode(),l.push({type:2,index:++n});s.append(d[u],Ys())}}}else if(s.nodeType===8)if(s.data===yh)l.push({type:2,index:n});else{let d=-1;for(;(d=s.data.indexOf(Ge,d+1))!==-1;)l.push({type:7,index:n}),d+=Ge.length-1}n++}}static createElement(e,t){const i=bi.createElement("template");return i.innerHTML=e,i}}function Xi(r,e,t=r,i){var s,n;if(e===Ii)return e;let o=i!==void 0?(s=t.o)==null?void 0:s[i]:t.l;const a=Ws(e)?void 0:e._$litDirective$;return(o==null?void 0:o.constructor)!==a&&((n=o==null?void 0:o._$AO)==null||n.call(o,!1),a===void 0?o=void 0:(o=new a(r),o._$AT(r,t,i)),i!==void 0?(t.o??(t.o=[]))[i]=o:t.l=o),o!==void 0&&(e=Xi(r,o._$AS(r,e.values),o,i)),e}class km{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,s=((e==null?void 0:e.creationScope)??bi).importNode(t,!0);di.currentNode=s;let n=di.nextNode(),o=0,a=0,l=i[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new sn(n,n.nextSibling,this,e):l.type===1?c=new l.ctor(n,l.name,l.strings,this,e):l.type===6&&(c=new Vm(n,this,e)),this._$AV.push(c),l=i[++a]}o!==(l==null?void 0:l.index)&&(n=di.nextNode(),o++)}return di.currentNode=bi,s}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class sn{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this.v}constructor(e,t,i,s){this.type=2,this._$AH=Dt,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this.v=(s==null?void 0:s.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Xi(this,e,t),Ws(e)?e===Dt||e==null||e===""?(this._$AH!==Dt&&this._$AR(),this._$AH=Dt):e!==this._$AH&&e!==Ii&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Mm(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Dt&&Ws(this._$AH)?this._$AA.nextSibling.data=e:this.T(bi.createTextNode(e)),this._$AH=e}$(e){var t;const{values:i,_$litType$:s}=e,n=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=js.createElement(Th(s.h,s.h[0]),this.options)),s);if(((t=this._$AH)==null?void 0:t._$AD)===n)this._$AH.p(i);else{const o=new km(n,this),a=o.u(this.options);o.p(i),this.T(a),this._$AH=o}}_$AC(e){let t=Hl.get(e.strings);return t===void 0&&Hl.set(e.strings,t=new js(e)),t}k(e){va(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const n of e)s===t.length?t.push(i=new sn(this.O(Ys()),this.O(Ys()),this,this.options)):i=t[s],i._$AI(n),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const s=e.nextSibling;e.remove(),e=s}}setConnected(e){var t;this._$AM===void 0&&(this.v=e,(t=this._$AP)==null||t.call(this,e))}}class $r{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,n){this.type=1,this._$AH=Dt,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Dt}_$AI(e,t=this,i,s){const n=this.strings;let o=!1;if(n===void 0)e=Xi(this,e,t,0),o=!Ws(e)||e!==this._$AH&&e!==Ii,o&&(this._$AH=e);else{const a=e;let l,c;for(e=n[0],l=0;l<n.length-1;l++)c=Xi(this,a[i+l],t,l),c===Ii&&(c=this._$AH[l]),o||(o=!Ws(c)||c!==this._$AH[l]),c===Dt?e=Dt:e!==Dt&&(e+=(c??"")+n[l+1]),this._$AH[l]=c}o&&!s&&this.j(e)}j(e){e===Dt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Bm extends $r{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Dt?void 0:e}}class zm extends $r{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Dt)}}class $m extends $r{constructor(e,t,i,s,n){super(e,t,i,s,n),this.type=5}_$AI(e,t=this){if((e=Xi(this,e,t,0)??Dt)===Ii)return;const i=this._$AH,s=e===Dt&&i!==Dt||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==Dt&&(i===Dt||s);s&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class Vm{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Xi(this,e)}}const Yl=sr.litHtmlPolyfillSupport;Yl==null||Yl(js,sn),(sr.litHtmlVersions??(sr.litHtmlVersions=[])).push("3.2.0");const Zi=(r,e,t)=>{const i=(t==null?void 0:t.renderBefore)??e;let s=i._$litPart$;if(s===void 0){const n=(t==null?void 0:t.renderBefore)??null;i._$litPart$=s=new sn(e.insertBefore(Ys(),n),n,void 0,t??{})}return s._$AI(r),s};/**
210
210
  * @license
211
211
  * Copyright 2017 Google LLC
212
212
  * SPDX-License-Identifier: BSD-3-Clause
213
- */let bt=class extends Ui{constructor(){super(...arguments),this.renderOptions={host:this},this.o=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this.o=ji(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this.o)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.o)==null||e.setConnected(!1)}render(){return Ei}};var $l;bt._$litElement$=!0,bt.finalized=!0,($l=globalThis.litElementHydrateSupport)==null||$l.call(globalThis,{LitElement:bt});const Hl=globalThis.litElementPolyfillSupport;Hl==null||Hl({LitElement:bt});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.0");/**
213
+ */let It=class extends Bi{constructor(){super(...arguments),this.renderOptions={host:this},this.o=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this.o=Zi(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this.o)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.o)==null||e.setConnected(!1)}render(){return Ii}};var Wl;It._$litElement$=!0,It.finalized=!0,(Wl=globalThis.litElementHydrateSupport)==null||Wl.call(globalThis,{LitElement:It});const jl=globalThis.litElementPolyfillSupport;jl==null||jl({LitElement:It});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.0");/**
214
214
  * @license
215
215
  * Copyright 2017 Google LLC
216
216
  * SPDX-License-Identifier: BSD-3-Clause
217
- */const km={attribute:!0,type:String,converter:er,reflect:!1,hasChanged:_a},Bm=(n=km,e,t)=>{const{kind:i,metadata:s}=t;let r=globalThis.litPropertyMetadata.get(s);if(r===void 0&&globalThis.litPropertyMetadata.set(s,r=new Map),r.set(t.name,n),i==="accessor"){const{name:o}=t;return{set(a){const l=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,l,n)},init(a){return a!==void 0&&this.P(o,void 0,n),a}}}if(i==="setter"){const{name:o}=t;return function(a){const l=this[o];e.call(this,a),this.requestUpdate(o,l,n)}}throw Error("Unsupported decorator location: "+i)};function W(n){return(e,t)=>typeof t=="object"?Bm(n,e,t):((i,s,r)=>{const o=s.hasOwnProperty(r);return s.constructor.createProperty(r,o?{...i,wrapped:!0}:i),o?Object.getOwnPropertyDescriptor(s,r):void 0})(n,e,t)}/**
217
+ */const Gm={attribute:!0,type:String,converter:ir,reflect:!1,hasChanged:Ta},Hm=(r=Gm,e,t)=>{const{kind:i,metadata:s}=t;let n=globalThis.litPropertyMetadata.get(s);if(n===void 0&&globalThis.litPropertyMetadata.set(s,n=new Map),n.set(t.name,r),i==="accessor"){const{name:o}=t;return{set(a){const l=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,l,r)},init(a){return a!==void 0&&this.P(o,void 0,r),a}}}if(i==="setter"){const{name:o}=t;return function(a){const l=this[o];e.call(this,a),this.requestUpdate(o,l,r)}}throw Error("Unsupported decorator location: "+i)};function W(r){return(e,t)=>typeof t=="object"?Hm(r,e,t):((i,s,n)=>{const o=s.hasOwnProperty(n);return s.constructor.createProperty(n,o?{...i,wrapped:!0}:i),o?Object.getOwnPropertyDescriptor(s,n):void 0})(r,e,t)}/**
218
218
  * @license
219
219
  * Copyright 2017 Google LLC
220
220
  * SPDX-License-Identifier: BSD-3-Clause
221
- */function qi(n){return W({...n,state:!0,attribute:!1})}/**
221
+ */function ts(r){return W({...r,state:!0,attribute:!1})}/**
222
222
  * @license
223
223
  * Copyright 2020 Google LLC
224
224
  * SPDX-License-Identifier: BSD-3-Clause
225
- */const zm=n=>n.strings===void 0;/**
225
+ */const Ym=r=>r.strings===void 0;/**
226
226
  * @license
227
227
  * Copyright 2017 Google LLC
228
228
  * SPDX-License-Identifier: BSD-3-Clause
229
- */const bh={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ch=n=>(...e)=>({_$litDirective$:n,values:e});class yh{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this.t=e,this._$AM=t,this.i=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
229
+ */const vh={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},wh=r=>(...e)=>({_$litDirective$:r,values:e});class Ah{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this.t=e,this._$AM=t,this.i=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
230
230
  * @license
231
231
  * Copyright 2017 Google LLC
232
232
  * SPDX-License-Identifier: BSD-3-Clause
233
- */const Os=(n,e)=>{var t;const i=n._$AN;if(i===void 0)return!1;for(const s of i)(t=s._$AO)==null||t.call(s,e,!1),Os(s,e);return!0},nr=n=>{let e,t;do{if((e=n._$AM)===void 0)break;t=e._$AN,t.delete(n),n=e}while((t==null?void 0:t.size)===0)},_h=n=>{for(let e;e=n._$AM;n=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(n))break;t.add(n),Hm(e)}};function Vm(n){this._$AN!==void 0?(nr(this),this._$AM=n,_h(this)):this._$AM=n}function $m(n,e=!1,t=0){const i=this._$AH,s=this._$AN;if(s!==void 0&&s.size!==0)if(e)if(Array.isArray(i))for(let r=t;r<i.length;r++)Os(i[r],!1),nr(i[r]);else i!=null&&(Os(i,!1),nr(i));else Os(this,n)}const Hm=n=>{n.type==bh.CHILD&&(n._$AP??(n._$AP=$m),n._$AQ??(n._$AQ=Vm))};class Gm extends yh{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,i){super._$AT(e,t,i),_h(this),this.isConnected=e._$AU}_$AO(e,t=!0){var i,s;e!==this.isConnected&&(this.isConnected=e,e?(i=this.reconnected)==null||i.call(this):(s=this.disconnected)==null||s.call(this)),t&&(Os(this,e),nr(this))}setValue(e){if(zm(this.t))this.t._$AI(e,this);else{const t=[...this.t._$AH];t[this.i]=e,this.t._$AI(t,this,0)}}disconnected(){}reconnected(){}}/**
233
+ */const Ls=(r,e)=>{var t;const i=r._$AN;if(i===void 0)return!1;for(const s of i)(t=s._$AO)==null||t.call(s,e,!1),Ls(s,e);return!0},rr=r=>{let e,t;do{if((e=r._$AM)===void 0)break;t=e._$AN,t.delete(r),r=e}while((t==null?void 0:t.size)===0)},Rh=r=>{for(let e;e=r._$AM;r=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(r))break;t.add(r),Xm(e)}};function Wm(r){this._$AN!==void 0?(rr(this),this._$AM=r,Rh(this)):this._$AM=r}function jm(r,e=!1,t=0){const i=this._$AH,s=this._$AN;if(s!==void 0&&s.size!==0)if(e)if(Array.isArray(i))for(let n=t;n<i.length;n++)Ls(i[n],!1),rr(i[n]);else i!=null&&(Ls(i,!1),rr(i));else Ls(this,r)}const Xm=r=>{r.type==vh.CHILD&&(r._$AP??(r._$AP=jm),r._$AQ??(r._$AQ=Wm))};class Zm extends Ah{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,i){super._$AT(e,t,i),Rh(this),this.isConnected=e._$AU}_$AO(e,t=!0){var i,s;e!==this.isConnected&&(this.isConnected=e,e?(i=this.reconnected)==null||i.call(this):(s=this.disconnected)==null||s.call(this)),t&&(Ls(this,e),rr(this))}setValue(e){if(Ym(this.t))this.t._$AI(e,this);else{const t=[...this.t._$AH];t[this.i]=e,this.t._$AI(t,this,0)}}disconnected(){}reconnected(){}}/**
234
234
  * @license
235
235
  * Copyright 2020 Google LLC
236
236
  * SPDX-License-Identifier: BSD-3-Clause
237
- */const zi=()=>new Ym;class Ym{}const yo=new WeakMap,di=Ch(class extends Gm{render(n){return Mt}update(n,[e]){var t;const i=e!==this.Y;return i&&this.Y!==void 0&&this.rt(void 0),(i||this.lt!==this.ct)&&(this.Y=e,this.ht=(t=n.options)==null?void 0:t.host,this.rt(this.ct=n.element)),Mt}rt(n){if(this.isConnected||(n=void 0),typeof this.Y=="function"){const e=this.ht??globalThis;let t=yo.get(e);t===void 0&&(t=new WeakMap,yo.set(e,t)),t.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),t.set(this.Y,n),n!==void 0&&this.Y.call(this.ht,n)}else this.Y.value=n}get lt(){var n,e;return typeof this.Y=="function"?(n=yo.get(this.ht??globalThis))==null?void 0:n.get(this.Y):(e=this.Y)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});/**
237
+ */const qi=()=>new qm;class qm{}const To=new WeakMap,we=wh(class extends Zm{render(r){return Dt}update(r,[e]){var t;const i=e!==this.Y;return i&&this.Y!==void 0&&this.rt(void 0),(i||this.lt!==this.ct)&&(this.Y=e,this.ht=(t=r.options)==null?void 0:t.host,this.rt(this.ct=r.element)),Dt}rt(r){if(this.isConnected||(r=void 0),typeof this.Y=="function"){const e=this.ht??globalThis;let t=To.get(e);t===void 0&&(t=new WeakMap,To.set(e,t)),t.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),t.set(this.Y,r),r!==void 0&&this.Y.call(this.ht,r)}else this.Y.value=r}get lt(){var r,e;return typeof this.Y=="function"?(r=To.get(this.ht??globalThis))==null?void 0:r.get(this.Y):(e=this.Y)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});/**
238
238
  * (c) Iconify
239
239
  *
240
240
  * For the full copyright and license information, please view the license.txt
@@ -244,16 +244,16 @@ ${t}
244
244
  *
245
245
  * @license MIT
246
246
  * @version 2.0.0
247
- */const Th=Object.freeze({left:0,top:0,width:16,height:16}),rr=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),en=Object.freeze({...Th,...rr}),Wo=Object.freeze({...en,body:"",hidden:!1}),Wm=Object.freeze({width:null,height:null}),vh=Object.freeze({...Wm,...rr});function jm(n,e=0){const t=n.replace(/^-?[0-9.]*/,"");function i(s){for(;s<0;)s+=4;return s%4}if(t===""){const s=parseInt(n);return isNaN(s)?0:i(s)}else if(t!==n){let s=0;switch(t){case"%":s=25;break;case"deg":s=90}if(s){let r=parseFloat(n.slice(0,n.length-t.length));return isNaN(r)?0:(r=r/s,r%1===0?i(r):0)}}return e}const Xm=/[\s,]+/;function Zm(n,e){e.split(Xm).forEach(t=>{switch(t.trim()){case"horizontal":n.hFlip=!0;break;case"vertical":n.vFlip=!0;break}})}const wh={...vh,preserveAspectRatio:""};function Gl(n){const e={...wh},t=(i,s)=>n.getAttribute(i)||s;return e.width=t("width",null),e.height=t("height",null),e.rotate=jm(t("rotate","")),Zm(e,t("flip","")),e.preserveAspectRatio=t("preserveAspectRatio",t("preserveaspectratio","")),e}function qm(n,e){for(const t in wh)if(n[t]!==e[t])return!0;return!1}const xs=/^[a-z0-9]+(-[a-z0-9]+)*$/,sn=(n,e,t,i="")=>{const s=n.split(":");if(n.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;i=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const a=s.pop(),l=s.pop(),c={provider:s.length>0?s[0]:i,prefix:l,name:a};return e&&!Gn(c)?null:c}const r=s[0],o=r.split("-");if(o.length>1){const a={provider:i,prefix:o.shift(),name:o.join("-")};return e&&!Gn(a)?null:a}if(t&&i===""){const a={provider:i,prefix:"",name:r};return e&&!Gn(a,t)?null:a}return null},Gn=(n,e)=>n?!!((n.provider===""||n.provider.match(xs))&&(e&&n.prefix===""||n.prefix.match(xs))&&n.name.match(xs)):!1;function Qm(n,e){const t={};!n.hFlip!=!e.hFlip&&(t.hFlip=!0),!n.vFlip!=!e.vFlip&&(t.vFlip=!0);const i=((n.rotate||0)+(e.rotate||0))%4;return i&&(t.rotate=i),t}function Yl(n,e){const t=Qm(n,e);for(const i in Wo)i in rr?i in n&&!(i in t)&&(t[i]=rr[i]):i in e?t[i]=e[i]:i in n&&(t[i]=n[i]);return t}function Km(n,e){const t=n.icons,i=n.aliases||Object.create(null),s=Object.create(null);function r(o){if(t[o])return s[o]=[];if(!(o in s)){s[o]=null;const a=i[o]&&i[o].parent,l=a&&r(a);l&&(s[o]=[a].concat(l))}return s[o]}return Object.keys(t).concat(Object.keys(i)).forEach(r),s}function Jm(n,e,t){const i=n.icons,s=n.aliases||Object.create(null);let r={};function o(a){r=Yl(i[a]||s[a],r)}return o(e),t.forEach(o),Yl(n,r)}function Ah(n,e){const t=[];if(typeof n!="object"||typeof n.icons!="object")return t;n.not_found instanceof Array&&n.not_found.forEach(s=>{e(s,null),t.push(s)});const i=Km(n);for(const s in i){const r=i[s];r&&(e(s,Jm(n,s,r)),t.push(s))}return t}const tg={provider:"",aliases:{},not_found:{},...Th};function _o(n,e){for(const t in e)if(t in n&&typeof n[t]!=typeof e[t])return!1;return!0}function Rh(n){if(typeof n!="object"||n===null)return null;const e=n;if(typeof e.prefix!="string"||!n.icons||typeof n.icons!="object"||!_o(n,tg))return null;const t=e.icons;for(const s in t){const r=t[s];if(!s.match(xs)||typeof r.body!="string"||!_o(r,Wo))return null}const i=e.aliases||Object.create(null);for(const s in i){const r=i[s],o=r.parent;if(!s.match(xs)||typeof o!="string"||!t[o]&&!i[o]||!_o(r,Wo))return null}return e}const or=Object.create(null);function eg(n,e){return{provider:n,prefix:e,icons:Object.create(null),missing:new Set}}function Xe(n,e){const t=or[n]||(or[n]=Object.create(null));return t[e]||(t[e]=eg(n,e))}function va(n,e){return Rh(e)?Ah(e,(t,i)=>{i?n.icons[t]=i:n.missing.add(t)}):[]}function ig(n,e,t){try{if(typeof t.body=="string")return n.icons[e]={...t},!0}catch{}return!1}function sg(n,e){let t=[];return(typeof n=="string"?[n]:Object.keys(or)).forEach(i=>{(typeof i=="string"&&typeof e=="string"?[e]:Object.keys(or[i]||{})).forEach(s=>{const r=Xe(i,s);t=t.concat(Object.keys(r.icons).map(o=>(i!==""?"@"+i+":":"")+s+":"+o))})}),t}let Ys=!1;function Sh(n){return typeof n=="boolean"&&(Ys=n),Ys}function Ws(n){const e=typeof n=="string"?sn(n,!0,Ys):n;if(e){const t=Xe(e.provider,e.prefix),i=e.name;return t.icons[i]||(t.missing.has(i)?null:void 0)}}function Fh(n,e){const t=sn(n,!0,Ys);if(!t)return!1;const i=Xe(t.provider,t.prefix);return ig(i,t.name,e)}function Wl(n,e){if(typeof n!="object")return!1;if(typeof e!="string"&&(e=n.provider||""),Ys&&!e&&!n.prefix){let s=!1;return Rh(n)&&(n.prefix="",Ah(n,(r,o)=>{o&&Fh(r,o)&&(s=!0)})),s}const t=n.prefix;if(!Gn({provider:e,prefix:t,name:"a"}))return!1;const i=Xe(e,t);return!!va(i,n)}function jl(n){return!!Ws(n)}function ng(n){const e=Ws(n);return e?{...en,...e}:null}function rg(n){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);n.sort((s,r)=>s.provider!==r.provider?s.provider.localeCompare(r.provider):s.prefix!==r.prefix?s.prefix.localeCompare(r.prefix):s.name.localeCompare(r.name));let i={provider:"",prefix:"",name:""};return n.forEach(s=>{if(i.name===s.name&&i.prefix===s.prefix&&i.provider===s.provider)return;i=s;const r=s.provider,o=s.prefix,a=s.name,l=t[r]||(t[r]=Object.create(null)),c=l[o]||(l[o]=Xe(r,o));let h;a in c.icons?h=e.loaded:o===""||c.missing.has(a)?h=e.missing:h=e.pending;const d={provider:r,prefix:o,name:a};h.push(d)}),e}function Oh(n,e){n.forEach(t=>{const i=t.loaderCallbacks;i&&(t.loaderCallbacks=i.filter(s=>s.id!==e))})}function og(n){n.pendingCallbacksFlag||(n.pendingCallbacksFlag=!0,setTimeout(()=>{n.pendingCallbacksFlag=!1;const e=n.loaderCallbacks?n.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const i=n.provider,s=n.prefix;e.forEach(r=>{const o=r.icons,a=o.pending.length;o.pending=o.pending.filter(l=>{if(l.prefix!==s)return!0;const c=l.name;if(n.icons[c])o.loaded.push({provider:i,prefix:s,name:c});else if(n.missing.has(c))o.missing.push({provider:i,prefix:s,name:c});else return t=!0,!0;return!1}),o.pending.length!==a&&(t||Oh([n],r.id),r.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),r.abort))})}))}let ag=0;function lg(n,e,t){const i=ag++,s=Oh.bind(null,t,i);if(!e.pending.length)return s;const r={id:i,icons:e,callback:n,abort:s};return t.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(r)}),s}const jo=Object.create(null);function Xl(n,e){jo[n]=e}function Xo(n){return jo[n]||jo[""]}function cg(n,e=!0,t=!1){const i=[];return n.forEach(s=>{const r=typeof s=="string"?sn(s,e,t):s;r&&i.push(r)}),i}var hg={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function dg(n,e,t,i){const s=n.resources.length,r=n.random?Math.floor(Math.random()*s):n.index;let o;if(n.random){let A=n.resources.slice(0);for(o=[];A.length>1;){const R=Math.floor(Math.random()*A.length);o.push(A[R]),A=A.slice(0,R).concat(A.slice(R+1))}o=o.concat(A)}else o=n.resources.slice(r).concat(n.resources.slice(0,r));const a=Date.now();let l="pending",c=0,h,d=null,u=[],f=[];typeof i=="function"&&f.push(i);function p(){d&&(clearTimeout(d),d=null)}function m(){l==="pending"&&(l="aborted"),p(),u.forEach(A=>{A.status==="pending"&&(A.status="aborted")}),u=[]}function E(A,R){R&&(f=[]),typeof A=="function"&&f.push(A)}function g(){return{startTime:a,payload:e,status:l,queriesSent:c,queriesPending:u.length,subscribe:E,abort:m}}function b(){l="failed",f.forEach(A=>{A(void 0,h)})}function v(){u.forEach(A=>{A.status==="pending"&&(A.status="aborted")}),u=[]}function I(A,R,P){const F=R!=="success";switch(u=u.filter(x=>x!==A),l){case"pending":break;case"failed":if(F||!n.dataAfterTimeout)return;break;default:return}if(R==="abort"){h=P,b();return}if(F){h=P,u.length||(o.length?T():b());return}if(p(),v(),!n.random){const x=n.resources.indexOf(A.resource);x!==-1&&x!==n.index&&(n.index=x)}l="completed",f.forEach(x=>{x(P)})}function T(){if(l!=="pending")return;p();const A=o.shift();if(A===void 0){if(u.length){d=setTimeout(()=>{p(),l==="pending"&&(v(),b())},n.timeout);return}b();return}const R={status:"pending",resource:A,callback:(P,F)=>{I(R,P,F)}};u.push(R),c++,d=setTimeout(T,n.rotate),t(A,e,R.callback)}return setTimeout(T),g}function xh(n){const e={...hg,...n};let t=[];function i(){t=t.filter(o=>o().status==="pending")}function s(o,a,l){const c=dg(e,o,a,(h,d)=>{i(),l&&l(h,d)});return t.push(c),c}function r(o){return t.find(a=>o(a))||null}return{query:s,find:r,setIndex:o=>{e.index=o},getIndex:()=>e.index,cleanup:i}}function wa(n){let e;if(typeof n.resources=="string")e=[n.resources];else if(e=n.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:n.path||"/",maxURL:n.maxURL||500,rotate:n.rotate||750,timeout:n.timeout||5e3,random:n.random===!0,index:n.index||0,dataAfterTimeout:n.dataAfterTimeout!==!1}}const Br=Object.create(null),Un=["https://api.simplesvg.com","https://api.unisvg.com"],Zo=[];for(;Un.length>0;)Un.length===1||Math.random()>.5?Zo.push(Un.shift()):Zo.push(Un.pop());Br[""]=wa({resources:["https://api.iconify.design"].concat(Zo)});function Zl(n,e){const t=wa(e);return t===null?!1:(Br[n]=t,!0)}function zr(n){return Br[n]}function ug(){return Object.keys(Br)}function ql(){}const To=Object.create(null);function fg(n){if(!To[n]){const e=zr(n);if(!e)return;const t=xh(e),i={config:e,redundancy:t};To[n]=i}return To[n]}function Nh(n,e,t){let i,s;if(typeof n=="string"){const r=Xo(n);if(!r)return t(void 0,424),ql;s=r.send;const o=fg(n);o&&(i=o.redundancy)}else{const r=wa(n);if(r){i=xh(r);const o=n.resources?n.resources[0]:"",a=Xo(o);a&&(s=a.send)}}return!i||!s?(t(void 0,424),ql):i.query(e,s,t)().abort}const Ql="iconify2",js="iconify",Ph=js+"-count",Kl=js+"-version",Lh=36e5,pg=168,mg=50;function qo(n,e){try{return n.getItem(e)}catch{}}function Aa(n,e,t){try{return n.setItem(e,t),!0}catch{}}function Jl(n,e){try{n.removeItem(e)}catch{}}function Qo(n,e){return Aa(n,Ph,e.toString())}function Ko(n){return parseInt(qo(n,Ph))||0}const ui={local:!0,session:!0},Mh={local:new Set,session:new Set};let Ra=!1;function gg(n){Ra=n}let kn=typeof window>"u"?{}:window;function Dh(n){const e=n+"Storage";try{if(kn&&kn[e]&&typeof kn[e].length=="number")return kn[e]}catch{}ui[n]=!1}function Uh(n,e){const t=Dh(n);if(!t)return;const i=qo(t,Kl);if(i!==Ql){if(i){const a=Ko(t);for(let l=0;l<a;l++)Jl(t,js+l.toString())}Aa(t,Kl,Ql),Qo(t,0);return}const s=Math.floor(Date.now()/Lh)-pg,r=a=>{const l=js+a.toString(),c=qo(t,l);if(typeof c=="string"){try{const h=JSON.parse(c);if(typeof h=="object"&&typeof h.cached=="number"&&h.cached>s&&typeof h.provider=="string"&&typeof h.data=="object"&&typeof h.data.prefix=="string"&&e(h,a))return!0}catch{}Jl(t,l)}};let o=Ko(t);for(let a=o-1;a>=0;a--)r(a)||(a===o-1?(o--,Qo(t,o)):Mh[n].add(a))}function kh(){if(!Ra){gg(!0);for(const n in ui)Uh(n,e=>{const t=e.data,i=e.provider,s=t.prefix,r=Xe(i,s);if(!va(r,t).length)return!1;const o=t.lastModified||-1;return r.lastModifiedCached=r.lastModifiedCached?Math.min(r.lastModifiedCached,o):o,!0})}}function Eg(n,e){const t=n.lastModifiedCached;if(t&&t>=e)return t===e;if(n.lastModifiedCached=e,t)for(const i in ui)Uh(i,s=>{const r=s.data;return s.provider!==n.provider||r.prefix!==n.prefix||r.lastModified===e});return!0}function Ig(n,e){Ra||kh();function t(i){let s;if(!ui[i]||!(s=Dh(i)))return;const r=Mh[i];let o;if(r.size)r.delete(o=Array.from(r).shift());else if(o=Ko(s),o>=mg||!Qo(s,o+1))return;const a={cached:Math.floor(Date.now()/Lh),provider:n.provider,data:e};return Aa(s,js+o.toString(),JSON.stringify(a))}e.lastModified&&!Eg(n,e.lastModified)||Object.keys(e.icons).length&&(e.not_found&&(e=Object.assign({},e),delete e.not_found),t("local")||t("session"))}function tc(){}function bg(n){n.iconsLoaderFlag||(n.iconsLoaderFlag=!0,setTimeout(()=>{n.iconsLoaderFlag=!1,og(n)}))}function Cg(n,e){n.iconsToLoad?n.iconsToLoad=n.iconsToLoad.concat(e).sort():n.iconsToLoad=e,n.iconsQueueFlag||(n.iconsQueueFlag=!0,setTimeout(()=>{n.iconsQueueFlag=!1;const{provider:t,prefix:i}=n,s=n.iconsToLoad;delete n.iconsToLoad;let r;!s||!(r=Xo(t))||r.prepare(t,i,s).forEach(o=>{Nh(t,o,a=>{if(typeof a!="object")o.icons.forEach(l=>{n.missing.add(l)});else try{const l=va(n,a);if(!l.length)return;const c=n.pendingIcons;c&&l.forEach(h=>{c.delete(h)}),Ig(n,a)}catch(l){console.error(l)}bg(n)})})}))}const Sa=(n,e)=>{const t=cg(n,!0,Sh()),i=rg(t);if(!i.pending.length){let l=!0;return e&&setTimeout(()=>{l&&e(i.loaded,i.missing,i.pending,tc)}),()=>{l=!1}}const s=Object.create(null),r=[];let o,a;return i.pending.forEach(l=>{const{provider:c,prefix:h}=l;if(h===a&&c===o)return;o=c,a=h,r.push(Xe(c,h));const d=s[c]||(s[c]=Object.create(null));d[h]||(d[h]=[])}),i.pending.forEach(l=>{const{provider:c,prefix:h,name:d}=l,u=Xe(c,h),f=u.pendingIcons||(u.pendingIcons=new Set);f.has(d)||(f.add(d),s[c][h].push(d))}),r.forEach(l=>{const{provider:c,prefix:h}=l;s[c][h].length&&Cg(l,s[c][h])}),e?lg(e,i,r):tc},yg=n=>new Promise((e,t)=>{const i=typeof n=="string"?sn(n,!0):n;if(!i){t(n);return}Sa([i||n],s=>{if(s.length&&i){const r=Ws(i);if(r){e({...en,...r});return}}t(n)})});function _g(n){try{const e=typeof n=="string"?JSON.parse(n):n;if(typeof e.body=="string")return{...e}}catch{}}function Tg(n,e){const t=typeof n=="string"?sn(n,!0,!0):null;if(!t){const r=_g(n);return{value:n,data:r}}const i=Ws(t);if(i!==void 0||!t.prefix)return{value:n,name:t,data:i};const s=Sa([t],()=>e(n,t,Ws(t)));return{value:n,name:t,loading:s}}function vo(n){return n.hasAttribute("inline")}let Bh=!1;try{Bh=navigator.vendor.indexOf("Apple")===0}catch{}function vg(n,e){switch(e){case"svg":case"bg":case"mask":return e}return e!=="style"&&(Bh||n.indexOf("<a")===-1)?"svg":n.indexOf("currentColor")===-1?"bg":"mask"}const wg=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Ag=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Jo(n,e,t){if(e===1)return n;if(t=t||100,typeof n=="number")return Math.ceil(n*e*t)/t;if(typeof n!="string")return n;const i=n.split(wg);if(i===null||!i.length)return n;const s=[];let r=i.shift(),o=Ag.test(r);for(;;){if(o){const a=parseFloat(r);isNaN(a)?s.push(r):s.push(Math.ceil(a*e*t)/t)}else s.push(r);if(r=i.shift(),r===void 0)return s.join("");o=!o}}function Rg(n,e="defs"){let t="";const i=n.indexOf("<"+e);for(;i>=0;){const s=n.indexOf(">",i),r=n.indexOf("</"+e);if(s===-1||r===-1)break;const o=n.indexOf(">",r);if(o===-1)break;t+=n.slice(s+1,r).trim(),n=n.slice(0,i).trim()+n.slice(o+1)}return{defs:t,content:n}}function Sg(n,e){return n?"<defs>"+n+"</defs>"+e:e}function Fg(n,e,t){const i=Rg(n);return Sg(i.defs,e+i.content+t)}const Og=n=>n==="unset"||n==="undefined"||n==="none";function zh(n,e){const t={...en,...n},i={...vh,...e},s={left:t.left,top:t.top,width:t.width,height:t.height};let r=t.body;[t,i].forEach(m=>{const E=[],g=m.hFlip,b=m.vFlip;let v=m.rotate;g?b?v+=2:(E.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),E.push("scale(-1 1)"),s.top=s.left=0):b&&(E.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),E.push("scale(1 -1)"),s.top=s.left=0);let I;switch(v<0&&(v-=Math.floor(v/4)*4),v=v%4,v){case 1:I=s.height/2+s.top,E.unshift("rotate(90 "+I.toString()+" "+I.toString()+")");break;case 2:E.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:I=s.width/2+s.left,E.unshift("rotate(-90 "+I.toString()+" "+I.toString()+")");break}v%2===1&&(s.left!==s.top&&(I=s.left,s.left=s.top,s.top=I),s.width!==s.height&&(I=s.width,s.width=s.height,s.height=I)),E.length&&(r=Fg(r,'<g transform="'+E.join(" ")+'">',"</g>"))});const o=i.width,a=i.height,l=s.width,c=s.height;let h,d;o===null?(d=a===null?"1em":a==="auto"?c:a,h=Jo(d,l/c)):(h=o==="auto"?l:o,d=a===null?Jo(h,c/l):a==="auto"?c:a);const u={},f=(m,E)=>{Og(E)||(u[m]=E.toString())};f("width",h),f("height",d);const p=[s.left,s.top,l,c];return u.viewBox=p.join(" "),{attributes:u,viewBox:p,body:r}}function Fa(n,e){let t=n.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const i in e)t+=" "+i+'="'+e[i]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+t+">"+n+"</svg>"}function xg(n){return n.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Ng(n){return"data:image/svg+xml,"+xg(n)}function Vh(n){return'url("'+Ng(n)+'")'}const Pg=()=>{let n;try{if(n=fetch,typeof n=="function")return n}catch{}};let ar=Pg();function Lg(n){ar=n}function Mg(){return ar}function Dg(n,e){const t=zr(n);if(!t)return 0;let i;if(!t.maxURL)i=0;else{let s=0;t.resources.forEach(o=>{s=Math.max(s,o.length)});const r=e+".json?icons=";i=t.maxURL-s-t.path.length-r.length}return i}function Ug(n){return n===404}const kg=(n,e,t)=>{const i=[],s=Dg(n,e),r="icons";let o={type:r,provider:n,prefix:e,icons:[]},a=0;return t.forEach((l,c)=>{a+=l.length+1,a>=s&&c>0&&(i.push(o),o={type:r,provider:n,prefix:e,icons:[]},a=l.length),o.icons.push(l)}),i.push(o),i};function Bg(n){if(typeof n=="string"){const e=zr(n);if(e)return e.path}return"/"}const zg=(n,e,t)=>{if(!ar){t("abort",424);return}let i=Bg(e.provider);switch(e.type){case"icons":{const r=e.prefix,o=e.icons.join(","),a=new URLSearchParams({icons:o});i+=r+".json?"+a.toString();break}case"custom":{const r=e.uri;i+=r.slice(0,1)==="/"?r.slice(1):r;break}default:t("abort",400);return}let s=503;ar(n+i).then(r=>{const o=r.status;if(o!==200){setTimeout(()=>{t(Ug(o)?"abort":"next",o)});return}return s=501,r.json()}).then(r=>{if(typeof r!="object"||r===null){setTimeout(()=>{r===404?t("abort",r):t("next",s)});return}setTimeout(()=>{t("success",r)})}).catch(()=>{t("next",s)})},Vg={prepare:kg,send:zg};function ec(n,e){switch(n){case"local":case"session":ui[n]=e;break;case"all":for(const t in ui)ui[t]=e;break}}const wo="data-style";let $h="";function $g(n){$h=n}function ic(n,e){let t=Array.from(n.childNodes).find(i=>i.hasAttribute&&i.hasAttribute(wo));t||(t=document.createElement("style"),t.setAttribute(wo,wo),n.appendChild(t)),t.textContent=":host{display:inline-block;vertical-align:"+(e?"-0.125em":"0")+"}span,svg{display:block}"+$h}function Hh(){Xl("",Vg),Sh(!0);let n;try{n=window}catch{}if(n){if(kh(),n.IconifyPreload!==void 0){const e=n.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(i=>{try{(typeof i!="object"||i===null||i instanceof Array||typeof i.icons!="object"||typeof i.prefix!="string"||!Wl(i))&&console.error(t)}catch{console.error(t)}})}if(n.IconifyProviders!==void 0){const e=n.IconifyProviders;if(typeof e=="object"&&e!==null)for(const t in e){const i="IconifyProviders["+t+"] is invalid.";try{const s=e[t];if(typeof s!="object"||!s||s.resources===void 0)continue;Zl(t,s)||console.error(i)}catch{console.error(i)}}}}return{enableCache:e=>ec(e,!0),disableCache:e=>ec(e,!1),iconLoaded:jl,iconExists:jl,getIcon:ng,listIcons:sg,addIcon:Fh,addCollection:Wl,calculateSize:Jo,buildIcon:zh,iconToHTML:Fa,svgToURL:Vh,loadIcons:Sa,loadIcon:yg,addAPIProvider:Zl,appendCustomStyle:$g,_api:{getAPIConfig:zr,setAPIModule:Xl,sendAPIQuery:Nh,setFetch:Lg,getFetch:Mg,listAPIProviders:ug}}}const ta={"background-color":"currentColor"},Gh={"background-color":"transparent"},sc={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},nc={"-webkit-mask":ta,mask:ta,background:Gh};for(const n in nc){const e=nc[n];for(const t in sc)e[n+"-"+t]=sc[t]}function rc(n){return n?n+(n.match(/^[-0-9.]+$/)?"px":""):"inherit"}function Hg(n,e,t){const i=document.createElement("span");let s=n.body;s.indexOf("<a")!==-1&&(s+="<!-- "+Date.now()+" -->");const r=n.attributes,o=Fa(s,{...r,width:e.width+"",height:e.height+""}),a=Vh(o),l=i.style,c={"--svg":a,width:rc(r.width),height:rc(r.height),...t?ta:Gh};for(const h in c)l.setProperty(h,c[h]);return i}let Ns;function Gg(){try{Ns=window.trustedTypes.createPolicy("iconify",{createHTML:n=>n})}catch{Ns=null}}function Yg(n){return Ns===void 0&&Gg(),Ns?Ns.createHTML(n):n}function Wg(n){const e=document.createElement("span"),t=n.attributes;let i="";t.width||(i="width: inherit;"),t.height||(i+="height: inherit;"),i&&(t.style=i);const s=Fa(n.body,t);return e.innerHTML=Yg(s),e.firstChild}function ea(n){return Array.from(n.childNodes).find(e=>{const t=e.tagName&&e.tagName.toUpperCase();return t==="SPAN"||t==="SVG"})}function oc(n,e){const t=e.icon.data,i=e.customisations,s=zh(t,i);i.preserveAspectRatio&&(s.attributes.preserveAspectRatio=i.preserveAspectRatio);const r=e.renderedMode;let o;switch(r){case"svg":o=Wg(s);break;default:o=Hg(s,{...en,...t},r==="mask")}const a=ea(n);a?o.tagName==="SPAN"&&a.tagName===o.tagName?a.setAttribute("style",o.getAttribute("style")):n.replaceChild(o,a):n.appendChild(o)}function ac(n,e,t){const i=t&&(t.rendered?t:t.lastRender);return{rendered:!1,inline:e,icon:n,lastRender:i}}function jg(n="iconify-icon"){let e,t;try{e=window.customElements,t=window.HTMLElement}catch{return}if(!e||!t)return;const i=e.get(n);if(i)return i;const s=["icon","mode","inline","observe","width","height","rotate","flip"],r=class extends t{constructor(){super(),si(this,"_shadowRoot"),si(this,"_initialised",!1),si(this,"_state"),si(this,"_checkQueued",!1),si(this,"_connected",!1),si(this,"_observer",null),si(this,"_visible",!0);const a=this._shadowRoot=this.attachShadow({mode:"open"}),l=vo(this);ic(a,l),this._state=ac({value:""},l),this._queueCheck()}connectedCallback(){this._connected=!0,this.startObserver()}disconnectedCallback(){this._connected=!1,this.stopObserver()}static get observedAttributes(){return s.slice(0)}attributeChangedCallback(a){switch(a){case"inline":{const l=vo(this),c=this._state;l!==c.inline&&(c.inline=l,ic(this._shadowRoot,l));break}case"observer":{this.observer?this.startObserver():this.stopObserver();break}default:this._queueCheck()}}get icon(){const a=this.getAttribute("icon");if(a&&a.slice(0,1)==="{")try{return JSON.parse(a)}catch{}return a}set icon(a){typeof a=="object"&&(a=JSON.stringify(a)),this.setAttribute("icon",a)}get inline(){return vo(this)}set inline(a){a?this.setAttribute("inline","true"):this.removeAttribute("inline")}get observer(){return this.hasAttribute("observer")}set observer(a){a?this.setAttribute("observer","true"):this.removeAttribute("observer")}restartAnimation(){const a=this._state;if(a.rendered){const l=this._shadowRoot;if(a.renderedMode==="svg")try{l.lastChild.setCurrentTime(0);return}catch{}oc(l,a)}}get status(){const a=this._state;return a.rendered?"rendered":a.icon.data===null?"failed":"loading"}_queueCheck(){this._checkQueued||(this._checkQueued=!0,setTimeout(()=>{this._check()}))}_check(){if(!this._checkQueued)return;this._checkQueued=!1;const a=this._state,l=this.getAttribute("icon");if(l!==a.icon.value){this._iconChanged(l);return}if(!a.rendered||!this._visible)return;const c=this.getAttribute("mode"),h=Gl(this);(a.attrMode!==c||qm(a.customisations,h)||!ea(this._shadowRoot))&&this._renderIcon(a.icon,h,c)}_iconChanged(a){const l=Tg(a,(c,h,d)=>{const u=this._state;if(u.rendered||this.getAttribute("icon")!==c)return;const f={value:c,name:h,data:d};f.data?this._gotIconData(f):u.icon=f});l.data?this._gotIconData(l):this._state=ac(l,this._state.inline,this._state)}_forceRender(){if(!this._visible){const a=ea(this._shadowRoot);a&&this._shadowRoot.removeChild(a);return}this._queueCheck()}_gotIconData(a){this._checkQueued=!1,this._renderIcon(a,Gl(this),this.getAttribute("mode"))}_renderIcon(a,l,c){const h=vg(a.data.body,c),d=this._state.inline;oc(this._shadowRoot,this._state={rendered:!0,icon:a,inline:d,customisations:l,attrMode:c,renderedMode:h})}startObserver(){if(!this._observer)try{this._observer=new IntersectionObserver(a=>{const l=a.some(c=>c.isIntersecting);l!==this._visible&&(this._visible=l,this._forceRender())}),this._observer.observe(this)}catch{if(this._observer){try{this._observer.disconnect()}catch{}this._observer=null}}}stopObserver(){this._observer&&(this._observer.disconnect(),this._observer=null,this._visible=!0,this._connected&&this._forceRender())}};s.forEach(a=>{a in r.prototype||Object.defineProperty(r.prototype,a,{get:function(){return this.getAttribute(a)},set:function(l){l!==null?this.setAttribute(a,l):this.removeAttribute(a)}})});const o=Hh();for(const a in o)r[a]=r.prototype[a]=o[a];return e.define(n,r),r}jg()||Hh();var Xg=Object.defineProperty,Zg=Object.getOwnPropertyDescriptor,fe=(n,e,t,i)=>{for(var s=i>1?void 0:i?Zg(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&Xg(e,t,s),s},Bn;const re=(Bn=class extends bt{constructor(){super(),this.labelHidden=!1,this.active=!1,this.disabled=!1,this.vertical=!1,this.tooltipVisible=!1,this._stateBeforeLoading={disabled:!1,icon:""},this._loading=!1,this._parent=zi(),this._tooltip=zi(),this._contextMenu=zi(),this._mouseLeave=!1,this.onWindowMouseUp=n=>{const{value:e}=this._contextMenu;!this.contains(n.target)&&e&&(e.visible=!1)},this.onClick=n=>{n.stopPropagation(),this.disabled||this.dispatchEvent(new Event("click"))},this.mouseLeave=!0}set loading(n){if(this._loading=n,n)this._stateBeforeLoading={disabled:this.disabled,icon:this.icon},this.disabled=n,this.icon="eos-icons:loading";else{const{disabled:e,icon:t}=this._stateBeforeLoading;this.disabled=e,this.icon=t}}get loading(){return this._loading}set mouseLeave(n){this._mouseLeave=n,n&&(this.tooltipVisible=!1,clearTimeout(this.timeoutID))}get mouseLeave(){return this._mouseLeave}computeTooltipPosition(){const{value:n}=this._parent,{value:e}=this._tooltip;n&&e&&fh(n,e,{placement:"bottom",middleware:[th(10),uh(),dh(),hh({padding:5})]}).then(t=>{const{x:i,y:s}=t;Object.assign(e.style,{left:`${i}px`,top:`${s}px`})})}onMouseEnter(){if(!(this.tooltipTitle||this.tooltipText))return;this.mouseLeave=!1;const n=this.tooltipTime??700;this.timeoutID=setTimeout(()=>{this.mouseLeave||(this.computeTooltipPosition(),this.tooltipVisible=!0)},n)}onChildrenClick(n){n.stopPropagation();const{value:e}=this._contextMenu;e&&(e.visible=!e.visible)}onSlotChange(n){const{value:e}=this._contextMenu,t=n.target.assignedElements();for(const i of t){if(!(i instanceof Bn)){i.remove(),console.warn("Only bim-button is allowed inside bim-button. Child has been removed.");continue}i.addEventListener("click",()=>e==null?void 0:e.updatePosition())}this.requestUpdate()}click(){this.disabled||super.click()}connectedCallback(){super.connectedCallback(),window.addEventListener("mouseup",this.onWindowMouseUp)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("mouseup",this.onWindowMouseUp)}render(){const n=K`
248
- <div ${di(this._tooltip)} class="tooltip">
249
- ${this.tooltipTitle?K`<p style="text-wrap: nowrap;">
247
+ */const Sh=Object.freeze({left:0,top:0,width:16,height:16}),or=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),nn=Object.freeze({...Sh,...or}),Xo=Object.freeze({...nn,body:"",hidden:!1}),Qm=Object.freeze({width:null,height:null}),Fh=Object.freeze({...Qm,...or});function Km(r,e=0){const t=r.replace(/^-?[0-9.]*/,"");function i(s){for(;s<0;)s+=4;return s%4}if(t===""){const s=parseInt(r);return isNaN(s)?0:i(s)}else if(t!==r){let s=0;switch(t){case"%":s=25;break;case"deg":s=90}if(s){let n=parseFloat(r.slice(0,r.length-t.length));return isNaN(n)?0:(n=n/s,n%1===0?i(n):0)}}return e}const Jm=/[\s,]+/;function tg(r,e){e.split(Jm).forEach(t=>{switch(t.trim()){case"horizontal":r.hFlip=!0;break;case"vertical":r.vFlip=!0;break}})}const Oh={...Fh,preserveAspectRatio:""};function Xl(r){const e={...Oh},t=(i,s)=>r.getAttribute(i)||s;return e.width=t("width",null),e.height=t("height",null),e.rotate=Km(t("rotate","")),tg(e,t("flip","")),e.preserveAspectRatio=t("preserveAspectRatio",t("preserveaspectratio","")),e}function eg(r,e){for(const t in Oh)if(r[t]!==e[t])return!0;return!1}const Ms=/^[a-z0-9]+(-[a-z0-9]+)*$/,rn=(r,e,t,i="")=>{const s=r.split(":");if(r.slice(0,1)==="@"){if(s.length<2||s.length>3)return null;i=s.shift().slice(1)}if(s.length>3||!s.length)return null;if(s.length>1){const a=s.pop(),l=s.pop(),c={provider:s.length>0?s[0]:i,prefix:l,name:a};return e&&!Yn(c)?null:c}const n=s[0],o=n.split("-");if(o.length>1){const a={provider:i,prefix:o.shift(),name:o.join("-")};return e&&!Yn(a)?null:a}if(t&&i===""){const a={provider:i,prefix:"",name:n};return e&&!Yn(a,t)?null:a}return null},Yn=(r,e)=>r?!!((r.provider===""||r.provider.match(Ms))&&(e&&r.prefix===""||r.prefix.match(Ms))&&r.name.match(Ms)):!1;function ig(r,e){const t={};!r.hFlip!=!e.hFlip&&(t.hFlip=!0),!r.vFlip!=!e.vFlip&&(t.vFlip=!0);const i=((r.rotate||0)+(e.rotate||0))%4;return i&&(t.rotate=i),t}function Zl(r,e){const t=ig(r,e);for(const i in Xo)i in or?i in r&&!(i in t)&&(t[i]=or[i]):i in e?t[i]=e[i]:i in r&&(t[i]=r[i]);return t}function sg(r,e){const t=r.icons,i=r.aliases||Object.create(null),s=Object.create(null);function n(o){if(t[o])return s[o]=[];if(!(o in s)){s[o]=null;const a=i[o]&&i[o].parent,l=a&&n(a);l&&(s[o]=[a].concat(l))}return s[o]}return Object.keys(t).concat(Object.keys(i)).forEach(n),s}function ng(r,e,t){const i=r.icons,s=r.aliases||Object.create(null);let n={};function o(a){n=Zl(i[a]||s[a],n)}return o(e),t.forEach(o),Zl(r,n)}function xh(r,e){const t=[];if(typeof r!="object"||typeof r.icons!="object")return t;r.not_found instanceof Array&&r.not_found.forEach(s=>{e(s,null),t.push(s)});const i=sg(r);for(const s in i){const n=i[s];n&&(e(s,ng(r,s,n)),t.push(s))}return t}const rg={provider:"",aliases:{},not_found:{},...Sh};function vo(r,e){for(const t in e)if(t in r&&typeof r[t]!=typeof e[t])return!1;return!0}function Nh(r){if(typeof r!="object"||r===null)return null;const e=r;if(typeof e.prefix!="string"||!r.icons||typeof r.icons!="object"||!vo(r,rg))return null;const t=e.icons;for(const s in t){const n=t[s];if(!s.match(Ms)||typeof n.body!="string"||!vo(n,Xo))return null}const i=e.aliases||Object.create(null);for(const s in i){const n=i[s],o=n.parent;if(!s.match(Ms)||typeof o!="string"||!t[o]&&!i[o]||!vo(n,Xo))return null}return e}const ar=Object.create(null);function og(r,e){return{provider:r,prefix:e,icons:Object.create(null),missing:new Set}}function Qe(r,e){const t=ar[r]||(ar[r]=Object.create(null));return t[e]||(t[e]=og(r,e))}function wa(r,e){return Nh(e)?xh(e,(t,i)=>{i?r.icons[t]=i:r.missing.add(t)}):[]}function ag(r,e,t){try{if(typeof t.body=="string")return r.icons[e]={...t},!0}catch{}return!1}function lg(r,e){let t=[];return(typeof r=="string"?[r]:Object.keys(ar)).forEach(i=>{(typeof i=="string"&&typeof e=="string"?[e]:Object.keys(ar[i]||{})).forEach(s=>{const n=Qe(i,s);t=t.concat(Object.keys(n.icons).map(o=>(i!==""?"@"+i+":":"")+s+":"+o))})}),t}let Xs=!1;function Ph(r){return typeof r=="boolean"&&(Xs=r),Xs}function Zs(r){const e=typeof r=="string"?rn(r,!0,Xs):r;if(e){const t=Qe(e.provider,e.prefix),i=e.name;return t.icons[i]||(t.missing.has(i)?null:void 0)}}function Lh(r,e){const t=rn(r,!0,Xs);if(!t)return!1;const i=Qe(t.provider,t.prefix);return ag(i,t.name,e)}function ql(r,e){if(typeof r!="object")return!1;if(typeof e!="string"&&(e=r.provider||""),Xs&&!e&&!r.prefix){let s=!1;return Nh(r)&&(r.prefix="",xh(r,(n,o)=>{o&&Lh(n,o)&&(s=!0)})),s}const t=r.prefix;if(!Yn({provider:e,prefix:t,name:"a"}))return!1;const i=Qe(e,t);return!!wa(i,r)}function Ql(r){return!!Zs(r)}function cg(r){const e=Zs(r);return e?{...nn,...e}:null}function hg(r){const e={loaded:[],missing:[],pending:[]},t=Object.create(null);r.sort((s,n)=>s.provider!==n.provider?s.provider.localeCompare(n.provider):s.prefix!==n.prefix?s.prefix.localeCompare(n.prefix):s.name.localeCompare(n.name));let i={provider:"",prefix:"",name:""};return r.forEach(s=>{if(i.name===s.name&&i.prefix===s.prefix&&i.provider===s.provider)return;i=s;const n=s.provider,o=s.prefix,a=s.name,l=t[n]||(t[n]=Object.create(null)),c=l[o]||(l[o]=Qe(n,o));let h;a in c.icons?h=e.loaded:o===""||c.missing.has(a)?h=e.missing:h=e.pending;const d={provider:n,prefix:o,name:a};h.push(d)}),e}function Mh(r,e){r.forEach(t=>{const i=t.loaderCallbacks;i&&(t.loaderCallbacks=i.filter(s=>s.id!==e))})}function dg(r){r.pendingCallbacksFlag||(r.pendingCallbacksFlag=!0,setTimeout(()=>{r.pendingCallbacksFlag=!1;const e=r.loaderCallbacks?r.loaderCallbacks.slice(0):[];if(!e.length)return;let t=!1;const i=r.provider,s=r.prefix;e.forEach(n=>{const o=n.icons,a=o.pending.length;o.pending=o.pending.filter(l=>{if(l.prefix!==s)return!0;const c=l.name;if(r.icons[c])o.loaded.push({provider:i,prefix:s,name:c});else if(r.missing.has(c))o.missing.push({provider:i,prefix:s,name:c});else return t=!0,!0;return!1}),o.pending.length!==a&&(t||Mh([r],n.id),n.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),n.abort))})}))}let ug=0;function fg(r,e,t){const i=ug++,s=Mh.bind(null,t,i);if(!e.pending.length)return s;const n={id:i,icons:e,callback:r,abort:s};return t.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(n)}),s}const Zo=Object.create(null);function Kl(r,e){Zo[r]=e}function qo(r){return Zo[r]||Zo[""]}function pg(r,e=!0,t=!1){const i=[];return r.forEach(s=>{const n=typeof s=="string"?rn(s,e,t):s;n&&i.push(n)}),i}var mg={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function gg(r,e,t,i){const s=r.resources.length,n=r.random?Math.floor(Math.random()*s):r.index;let o;if(r.random){let A=r.resources.slice(0);for(o=[];A.length>1;){const S=Math.floor(Math.random()*A.length);o.push(A[S]),A=A.slice(0,S).concat(A.slice(S+1))}o=o.concat(A)}else o=r.resources.slice(n).concat(r.resources.slice(0,n));const a=Date.now();let l="pending",c=0,h,d=null,u=[],f=[];typeof i=="function"&&f.push(i);function p(){d&&(clearTimeout(d),d=null)}function m(){l==="pending"&&(l="aborted"),p(),u.forEach(A=>{A.status==="pending"&&(A.status="aborted")}),u=[]}function E(A,S){S&&(f=[]),typeof A=="function"&&f.push(A)}function g(){return{startTime:a,payload:e,status:l,queriesSent:c,queriesPending:u.length,subscribe:E,abort:m}}function I(){l="failed",f.forEach(A=>{A(void 0,h)})}function T(){u.forEach(A=>{A.status==="pending"&&(A.status="aborted")}),u=[]}function b(A,S,N){const R=S!=="success";switch(u=u.filter(P=>P!==A),l){case"pending":break;case"failed":if(R||!r.dataAfterTimeout)return;break;default:return}if(S==="abort"){h=N,I();return}if(R){h=N,u.length||(o.length?v():I());return}if(p(),T(),!r.random){const P=r.resources.indexOf(A.resource);P!==-1&&P!==r.index&&(r.index=P)}l="completed",f.forEach(P=>{P(N)})}function v(){if(l!=="pending")return;p();const A=o.shift();if(A===void 0){if(u.length){d=setTimeout(()=>{p(),l==="pending"&&(T(),I())},r.timeout);return}I();return}const S={status:"pending",resource:A,callback:(N,R)=>{b(S,N,R)}};u.push(S),c++,d=setTimeout(v,r.rotate),t(A,e,S.callback)}return setTimeout(v),g}function Dh(r){const e={...mg,...r};let t=[];function i(){t=t.filter(o=>o().status==="pending")}function s(o,a,l){const c=gg(e,o,a,(h,d)=>{i(),l&&l(h,d)});return t.push(c),c}function n(o){return t.find(a=>o(a))||null}return{query:s,find:n,setIndex:o=>{e.index=o},getIndex:()=>e.index,cleanup:i}}function Aa(r){let e;if(typeof r.resources=="string")e=[r.resources];else if(e=r.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:r.path||"/",maxURL:r.maxURL||500,rotate:r.rotate||750,timeout:r.timeout||5e3,random:r.random===!0,index:r.index||0,dataAfterTimeout:r.dataAfterTimeout!==!1}}const Vr=Object.create(null),Bn=["https://api.simplesvg.com","https://api.unisvg.com"],Qo=[];for(;Bn.length>0;)Bn.length===1||Math.random()>.5?Qo.push(Bn.shift()):Qo.push(Bn.pop());Vr[""]=Aa({resources:["https://api.iconify.design"].concat(Qo)});function Jl(r,e){const t=Aa(e);return t===null?!1:(Vr[r]=t,!0)}function Gr(r){return Vr[r]}function Eg(){return Object.keys(Vr)}function tc(){}const wo=Object.create(null);function bg(r){if(!wo[r]){const e=Gr(r);if(!e)return;const t=Dh(e),i={config:e,redundancy:t};wo[r]=i}return wo[r]}function Uh(r,e,t){let i,s;if(typeof r=="string"){const n=qo(r);if(!n)return t(void 0,424),tc;s=n.send;const o=bg(r);o&&(i=o.redundancy)}else{const n=Aa(r);if(n){i=Dh(n);const o=r.resources?r.resources[0]:"",a=qo(o);a&&(s=a.send)}}return!i||!s?(t(void 0,424),tc):i.query(e,s,t)().abort}const ec="iconify2",qs="iconify",kh=qs+"-count",ic=qs+"-version",Bh=36e5,Ig=168,Cg=50;function Ko(r,e){try{return r.getItem(e)}catch{}}function Ra(r,e,t){try{return r.setItem(e,t),!0}catch{}}function sc(r,e){try{r.removeItem(e)}catch{}}function Jo(r,e){return Ra(r,kh,e.toString())}function ta(r){return parseInt(Ko(r,kh))||0}const fi={local:!0,session:!0},zh={local:new Set,session:new Set};let Sa=!1;function yg(r){Sa=r}let zn=typeof window>"u"?{}:window;function $h(r){const e=r+"Storage";try{if(zn&&zn[e]&&typeof zn[e].length=="number")return zn[e]}catch{}fi[r]=!1}function Vh(r,e){const t=$h(r);if(!t)return;const i=Ko(t,ic);if(i!==ec){if(i){const a=ta(t);for(let l=0;l<a;l++)sc(t,qs+l.toString())}Ra(t,ic,ec),Jo(t,0);return}const s=Math.floor(Date.now()/Bh)-Ig,n=a=>{const l=qs+a.toString(),c=Ko(t,l);if(typeof c=="string"){try{const h=JSON.parse(c);if(typeof h=="object"&&typeof h.cached=="number"&&h.cached>s&&typeof h.provider=="string"&&typeof h.data=="object"&&typeof h.data.prefix=="string"&&e(h,a))return!0}catch{}sc(t,l)}};let o=ta(t);for(let a=o-1;a>=0;a--)n(a)||(a===o-1?(o--,Jo(t,o)):zh[r].add(a))}function Gh(){if(!Sa){yg(!0);for(const r in fi)Vh(r,e=>{const t=e.data,i=e.provider,s=t.prefix,n=Qe(i,s);if(!wa(n,t).length)return!1;const o=t.lastModified||-1;return n.lastModifiedCached=n.lastModifiedCached?Math.min(n.lastModifiedCached,o):o,!0})}}function _g(r,e){const t=r.lastModifiedCached;if(t&&t>=e)return t===e;if(r.lastModifiedCached=e,t)for(const i in fi)Vh(i,s=>{const n=s.data;return s.provider!==r.provider||n.prefix!==r.prefix||n.lastModified===e});return!0}function Tg(r,e){Sa||Gh();function t(i){let s;if(!fi[i]||!(s=$h(i)))return;const n=zh[i];let o;if(n.size)n.delete(o=Array.from(n).shift());else if(o=ta(s),o>=Cg||!Jo(s,o+1))return;const a={cached:Math.floor(Date.now()/Bh),provider:r.provider,data:e};return Ra(s,qs+o.toString(),JSON.stringify(a))}e.lastModified&&!_g(r,e.lastModified)||Object.keys(e.icons).length&&(e.not_found&&(e=Object.assign({},e),delete e.not_found),t("local")||t("session"))}function nc(){}function vg(r){r.iconsLoaderFlag||(r.iconsLoaderFlag=!0,setTimeout(()=>{r.iconsLoaderFlag=!1,dg(r)}))}function wg(r,e){r.iconsToLoad?r.iconsToLoad=r.iconsToLoad.concat(e).sort():r.iconsToLoad=e,r.iconsQueueFlag||(r.iconsQueueFlag=!0,setTimeout(()=>{r.iconsQueueFlag=!1;const{provider:t,prefix:i}=r,s=r.iconsToLoad;delete r.iconsToLoad;let n;!s||!(n=qo(t))||n.prepare(t,i,s).forEach(o=>{Uh(t,o,a=>{if(typeof a!="object")o.icons.forEach(l=>{r.missing.add(l)});else try{const l=wa(r,a);if(!l.length)return;const c=r.pendingIcons;c&&l.forEach(h=>{c.delete(h)}),Tg(r,a)}catch(l){console.error(l)}vg(r)})})}))}const Fa=(r,e)=>{const t=pg(r,!0,Ph()),i=hg(t);if(!i.pending.length){let l=!0;return e&&setTimeout(()=>{l&&e(i.loaded,i.missing,i.pending,nc)}),()=>{l=!1}}const s=Object.create(null),n=[];let o,a;return i.pending.forEach(l=>{const{provider:c,prefix:h}=l;if(h===a&&c===o)return;o=c,a=h,n.push(Qe(c,h));const d=s[c]||(s[c]=Object.create(null));d[h]||(d[h]=[])}),i.pending.forEach(l=>{const{provider:c,prefix:h,name:d}=l,u=Qe(c,h),f=u.pendingIcons||(u.pendingIcons=new Set);f.has(d)||(f.add(d),s[c][h].push(d))}),n.forEach(l=>{const{provider:c,prefix:h}=l;s[c][h].length&&wg(l,s[c][h])}),e?fg(e,i,n):nc},Ag=r=>new Promise((e,t)=>{const i=typeof r=="string"?rn(r,!0):r;if(!i){t(r);return}Fa([i||r],s=>{if(s.length&&i){const n=Zs(i);if(n){e({...nn,...n});return}}t(r)})});function Rg(r){try{const e=typeof r=="string"?JSON.parse(r):r;if(typeof e.body=="string")return{...e}}catch{}}function Sg(r,e){const t=typeof r=="string"?rn(r,!0,!0):null;if(!t){const n=Rg(r);return{value:r,data:n}}const i=Zs(t);if(i!==void 0||!t.prefix)return{value:r,name:t,data:i};const s=Fa([t],()=>e(r,t,Zs(t)));return{value:r,name:t,loading:s}}function Ao(r){return r.hasAttribute("inline")}let Hh=!1;try{Hh=navigator.vendor.indexOf("Apple")===0}catch{}function Fg(r,e){switch(e){case"svg":case"bg":case"mask":return e}return e!=="style"&&(Hh||r.indexOf("<a")===-1)?"svg":r.indexOf("currentColor")===-1?"bg":"mask"}const Og=/(-?[0-9.]*[0-9]+[0-9.]*)/g,xg=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function ea(r,e,t){if(e===1)return r;if(t=t||100,typeof r=="number")return Math.ceil(r*e*t)/t;if(typeof r!="string")return r;const i=r.split(Og);if(i===null||!i.length)return r;const s=[];let n=i.shift(),o=xg.test(n);for(;;){if(o){const a=parseFloat(n);isNaN(a)?s.push(n):s.push(Math.ceil(a*e*t)/t)}else s.push(n);if(n=i.shift(),n===void 0)return s.join("");o=!o}}function Ng(r,e="defs"){let t="";const i=r.indexOf("<"+e);for(;i>=0;){const s=r.indexOf(">",i),n=r.indexOf("</"+e);if(s===-1||n===-1)break;const o=r.indexOf(">",n);if(o===-1)break;t+=r.slice(s+1,n).trim(),r=r.slice(0,i).trim()+r.slice(o+1)}return{defs:t,content:r}}function Pg(r,e){return r?"<defs>"+r+"</defs>"+e:e}function Lg(r,e,t){const i=Ng(r);return Pg(i.defs,e+i.content+t)}const Mg=r=>r==="unset"||r==="undefined"||r==="none";function Yh(r,e){const t={...nn,...r},i={...Fh,...e},s={left:t.left,top:t.top,width:t.width,height:t.height};let n=t.body;[t,i].forEach(m=>{const E=[],g=m.hFlip,I=m.vFlip;let T=m.rotate;g?I?T+=2:(E.push("translate("+(s.width+s.left).toString()+" "+(0-s.top).toString()+")"),E.push("scale(-1 1)"),s.top=s.left=0):I&&(E.push("translate("+(0-s.left).toString()+" "+(s.height+s.top).toString()+")"),E.push("scale(1 -1)"),s.top=s.left=0);let b;switch(T<0&&(T-=Math.floor(T/4)*4),T=T%4,T){case 1:b=s.height/2+s.top,E.unshift("rotate(90 "+b.toString()+" "+b.toString()+")");break;case 2:E.unshift("rotate(180 "+(s.width/2+s.left).toString()+" "+(s.height/2+s.top).toString()+")");break;case 3:b=s.width/2+s.left,E.unshift("rotate(-90 "+b.toString()+" "+b.toString()+")");break}T%2===1&&(s.left!==s.top&&(b=s.left,s.left=s.top,s.top=b),s.width!==s.height&&(b=s.width,s.width=s.height,s.height=b)),E.length&&(n=Lg(n,'<g transform="'+E.join(" ")+'">',"</g>"))});const o=i.width,a=i.height,l=s.width,c=s.height;let h,d;o===null?(d=a===null?"1em":a==="auto"?c:a,h=ea(d,l/c)):(h=o==="auto"?l:o,d=a===null?ea(h,c/l):a==="auto"?c:a);const u={},f=(m,E)=>{Mg(E)||(u[m]=E.toString())};f("width",h),f("height",d);const p=[s.left,s.top,l,c];return u.viewBox=p.join(" "),{attributes:u,viewBox:p,body:n}}function Oa(r,e){let t=r.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const i in e)t+=" "+i+'="'+e[i]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+t+">"+r+"</svg>"}function Dg(r){return r.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Ug(r){return"data:image/svg+xml,"+Dg(r)}function Wh(r){return'url("'+Ug(r)+'")'}const kg=()=>{let r;try{if(r=fetch,typeof r=="function")return r}catch{}};let lr=kg();function Bg(r){lr=r}function zg(){return lr}function $g(r,e){const t=Gr(r);if(!t)return 0;let i;if(!t.maxURL)i=0;else{let s=0;t.resources.forEach(o=>{s=Math.max(s,o.length)});const n=e+".json?icons=";i=t.maxURL-s-t.path.length-n.length}return i}function Vg(r){return r===404}const Gg=(r,e,t)=>{const i=[],s=$g(r,e),n="icons";let o={type:n,provider:r,prefix:e,icons:[]},a=0;return t.forEach((l,c)=>{a+=l.length+1,a>=s&&c>0&&(i.push(o),o={type:n,provider:r,prefix:e,icons:[]},a=l.length),o.icons.push(l)}),i.push(o),i};function Hg(r){if(typeof r=="string"){const e=Gr(r);if(e)return e.path}return"/"}const Yg=(r,e,t)=>{if(!lr){t("abort",424);return}let i=Hg(e.provider);switch(e.type){case"icons":{const n=e.prefix,o=e.icons.join(","),a=new URLSearchParams({icons:o});i+=n+".json?"+a.toString();break}case"custom":{const n=e.uri;i+=n.slice(0,1)==="/"?n.slice(1):n;break}default:t("abort",400);return}let s=503;lr(r+i).then(n=>{const o=n.status;if(o!==200){setTimeout(()=>{t(Vg(o)?"abort":"next",o)});return}return s=501,n.json()}).then(n=>{if(typeof n!="object"||n===null){setTimeout(()=>{n===404?t("abort",n):t("next",s)});return}setTimeout(()=>{t("success",n)})}).catch(()=>{t("next",s)})},Wg={prepare:Gg,send:Yg};function rc(r,e){switch(r){case"local":case"session":fi[r]=e;break;case"all":for(const t in fi)fi[t]=e;break}}const Ro="data-style";let jh="";function jg(r){jh=r}function oc(r,e){let t=Array.from(r.childNodes).find(i=>i.hasAttribute&&i.hasAttribute(Ro));t||(t=document.createElement("style"),t.setAttribute(Ro,Ro),r.appendChild(t)),t.textContent=":host{display:inline-block;vertical-align:"+(e?"-0.125em":"0")+"}span,svg{display:block}"+jh}function Xh(){Kl("",Wg),Ph(!0);let r;try{r=window}catch{}if(r){if(Gh(),r.IconifyPreload!==void 0){const e=r.IconifyPreload,t="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(i=>{try{(typeof i!="object"||i===null||i instanceof Array||typeof i.icons!="object"||typeof i.prefix!="string"||!ql(i))&&console.error(t)}catch{console.error(t)}})}if(r.IconifyProviders!==void 0){const e=r.IconifyProviders;if(typeof e=="object"&&e!==null)for(const t in e){const i="IconifyProviders["+t+"] is invalid.";try{const s=e[t];if(typeof s!="object"||!s||s.resources===void 0)continue;Jl(t,s)||console.error(i)}catch{console.error(i)}}}}return{enableCache:e=>rc(e,!0),disableCache:e=>rc(e,!1),iconLoaded:Ql,iconExists:Ql,getIcon:cg,listIcons:lg,addIcon:Lh,addCollection:ql,calculateSize:ea,buildIcon:Yh,iconToHTML:Oa,svgToURL:Wh,loadIcons:Fa,loadIcon:Ag,addAPIProvider:Jl,appendCustomStyle:jg,_api:{getAPIConfig:Gr,setAPIModule:Kl,sendAPIQuery:Uh,setFetch:Bg,getFetch:zg,listAPIProviders:Eg}}}const ia={"background-color":"currentColor"},Zh={"background-color":"transparent"},ac={image:"var(--svg)",repeat:"no-repeat",size:"100% 100%"},lc={"-webkit-mask":ia,mask:ia,background:Zh};for(const r in lc){const e=lc[r];for(const t in ac)e[r+"-"+t]=ac[t]}function cc(r){return r?r+(r.match(/^[-0-9.]+$/)?"px":""):"inherit"}function Xg(r,e,t){const i=document.createElement("span");let s=r.body;s.indexOf("<a")!==-1&&(s+="<!-- "+Date.now()+" -->");const n=r.attributes,o=Oa(s,{...n,width:e.width+"",height:e.height+""}),a=Wh(o),l=i.style,c={"--svg":a,width:cc(n.width),height:cc(n.height),...t?ia:Zh};for(const h in c)l.setProperty(h,c[h]);return i}let Ds;function Zg(){try{Ds=window.trustedTypes.createPolicy("iconify",{createHTML:r=>r})}catch{Ds=null}}function qg(r){return Ds===void 0&&Zg(),Ds?Ds.createHTML(r):r}function Qg(r){const e=document.createElement("span"),t=r.attributes;let i="";t.width||(i="width: inherit;"),t.height||(i+="height: inherit;"),i&&(t.style=i);const s=Oa(r.body,t);return e.innerHTML=qg(s),e.firstChild}function sa(r){return Array.from(r.childNodes).find(e=>{const t=e.tagName&&e.tagName.toUpperCase();return t==="SPAN"||t==="SVG"})}function hc(r,e){const t=e.icon.data,i=e.customisations,s=Yh(t,i);i.preserveAspectRatio&&(s.attributes.preserveAspectRatio=i.preserveAspectRatio);const n=e.renderedMode;let o;switch(n){case"svg":o=Qg(s);break;default:o=Xg(s,{...nn,...t},n==="mask")}const a=sa(r);a?o.tagName==="SPAN"&&a.tagName===o.tagName?a.setAttribute("style",o.getAttribute("style")):r.replaceChild(o,a):r.appendChild(o)}function dc(r,e,t){const i=t&&(t.rendered?t:t.lastRender);return{rendered:!1,inline:e,icon:r,lastRender:i}}function Kg(r="iconify-icon"){let e,t;try{e=window.customElements,t=window.HTMLElement}catch{return}if(!e||!t)return;const i=e.get(r);if(i)return i;const s=["icon","mode","inline","observe","width","height","rotate","flip"],n=class extends t{constructor(){super(),oi(this,"_shadowRoot"),oi(this,"_initialised",!1),oi(this,"_state"),oi(this,"_checkQueued",!1),oi(this,"_connected",!1),oi(this,"_observer",null),oi(this,"_visible",!0);const a=this._shadowRoot=this.attachShadow({mode:"open"}),l=Ao(this);oc(a,l),this._state=dc({value:""},l),this._queueCheck()}connectedCallback(){this._connected=!0,this.startObserver()}disconnectedCallback(){this._connected=!1,this.stopObserver()}static get observedAttributes(){return s.slice(0)}attributeChangedCallback(a){switch(a){case"inline":{const l=Ao(this),c=this._state;l!==c.inline&&(c.inline=l,oc(this._shadowRoot,l));break}case"observer":{this.observer?this.startObserver():this.stopObserver();break}default:this._queueCheck()}}get icon(){const a=this.getAttribute("icon");if(a&&a.slice(0,1)==="{")try{return JSON.parse(a)}catch{}return a}set icon(a){typeof a=="object"&&(a=JSON.stringify(a)),this.setAttribute("icon",a)}get inline(){return Ao(this)}set inline(a){a?this.setAttribute("inline","true"):this.removeAttribute("inline")}get observer(){return this.hasAttribute("observer")}set observer(a){a?this.setAttribute("observer","true"):this.removeAttribute("observer")}restartAnimation(){const a=this._state;if(a.rendered){const l=this._shadowRoot;if(a.renderedMode==="svg")try{l.lastChild.setCurrentTime(0);return}catch{}hc(l,a)}}get status(){const a=this._state;return a.rendered?"rendered":a.icon.data===null?"failed":"loading"}_queueCheck(){this._checkQueued||(this._checkQueued=!0,setTimeout(()=>{this._check()}))}_check(){if(!this._checkQueued)return;this._checkQueued=!1;const a=this._state,l=this.getAttribute("icon");if(l!==a.icon.value){this._iconChanged(l);return}if(!a.rendered||!this._visible)return;const c=this.getAttribute("mode"),h=Xl(this);(a.attrMode!==c||eg(a.customisations,h)||!sa(this._shadowRoot))&&this._renderIcon(a.icon,h,c)}_iconChanged(a){const l=Sg(a,(c,h,d)=>{const u=this._state;if(u.rendered||this.getAttribute("icon")!==c)return;const f={value:c,name:h,data:d};f.data?this._gotIconData(f):u.icon=f});l.data?this._gotIconData(l):this._state=dc(l,this._state.inline,this._state)}_forceRender(){if(!this._visible){const a=sa(this._shadowRoot);a&&this._shadowRoot.removeChild(a);return}this._queueCheck()}_gotIconData(a){this._checkQueued=!1,this._renderIcon(a,Xl(this),this.getAttribute("mode"))}_renderIcon(a,l,c){const h=Fg(a.data.body,c),d=this._state.inline;hc(this._shadowRoot,this._state={rendered:!0,icon:a,inline:d,customisations:l,attrMode:c,renderedMode:h})}startObserver(){if(!this._observer)try{this._observer=new IntersectionObserver(a=>{const l=a.some(c=>c.isIntersecting);l!==this._visible&&(this._visible=l,this._forceRender())}),this._observer.observe(this)}catch{if(this._observer){try{this._observer.disconnect()}catch{}this._observer=null}}}stopObserver(){this._observer&&(this._observer.disconnect(),this._observer=null,this._visible=!0,this._connected&&this._forceRender())}};s.forEach(a=>{a in n.prototype||Object.defineProperty(n.prototype,a,{get:function(){return this.getAttribute(a)},set:function(l){l!==null?this.setAttribute(a,l):this.removeAttribute(a)}})});const o=Xh();for(const a in o)n[a]=n.prototype[a]=o[a];return e.define(r,n),n}Kg()||Xh();var Jg=Object.defineProperty,t0=Object.getOwnPropertyDescriptor,me=(r,e,t,i)=>{for(var s=i>1?void 0:i?t0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&Jg(e,t,s),s};const qh=class extends It{constructor(){super(),this.labelHidden=!1,this.active=!1,this.disabled=!1,this.vertical=!1,this.tooltipVisible=!1,this._stateBeforeLoading={disabled:!1,icon:""},this._loading=!1,this._parent=qi(),this._tooltip=qi(),this._mouseLeave=!1,this.onClick=e=>{e.stopPropagation(),this.disabled||this.dispatchEvent(new Event("click"))},this.showContextMenu=()=>{const e=this._contextMenu;e&&(e.visible=!0)},this.mouseLeave=!0}set loading(e){if(this._loading=e,e)this._stateBeforeLoading={disabled:this.disabled,icon:this.icon},this.disabled=e,this.icon="eos-icons:loading";else{const{disabled:t,icon:i}=this._stateBeforeLoading;this.disabled=t,this.icon=i}}get loading(){return this._loading}set mouseLeave(e){this._mouseLeave=e,e&&(this.tooltipVisible=!1,clearTimeout(this.timeoutID))}get mouseLeave(){return this._mouseLeave}computeTooltipPosition(){const{value:e}=this._parent,{value:t}=this._tooltip;e&&t&&bh(e,t,{placement:"bottom",middleware:[rh(10),Eh(),gh(),mh({padding:5})]}).then(i=>{const{x:s,y:n}=i;Object.assign(t.style,{left:`${s}px`,top:`${n}px`})})}onMouseEnter(){if(!(this.tooltipTitle||this.tooltipText))return;this.mouseLeave=!1;const e=this.tooltipTime??700;this.timeoutID=setTimeout(()=>{this.mouseLeave||(this.computeTooltipPosition(),this.tooltipVisible=!0)},e)}click(){this.disabled||super.click()}get _contextMenu(){return this.querySelector("bim-context-menu")}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.showContextMenu)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this.showContextMenu)}render(){const e=X`
248
+ <div ${we(this._tooltip)} class="tooltip">
249
+ ${this.tooltipTitle?X`<p style="text-wrap: nowrap;">
250
250
  <strong>${this.tooltipTitle}</strong>
251
251
  </p>`:null}
252
- ${this.tooltipText?K`<p style="width: 9rem;">${this.tooltipText}</p>`:null}
252
+ ${this.tooltipText?X`<p style="width: 9rem;">${this.tooltipText}</p>`:null}
253
253
  </div>
254
- `,e=this.children.length>0;return K`
255
- <div ${di(this._parent)} class="parent" @click=${this.onClick}>
256
- ${this.label||this.icon?K`
254
+ `;return X`
255
+ <div ${we(this._parent)} class="parent" @click=${this.onClick}>
256
+ ${this.label||this.icon?X`
257
257
  <div
258
258
  class="button"
259
259
  @mouseenter=${this.onMouseEnter}
@@ -267,32 +267,10 @@ ${t}
267
267
  >
268
268
  </div>
269
269
  `:null}
270
- ${this.tooltipTitle||this.tooltipText?n:null}
271
- ${e?K`
272
- <div class="children" @click=${this.onChildrenClick}>
273
- <svg
274
- style="flex-shrink: 0; fill: var(--bim-dropdown--c, var(--bim-ui_bg-contrast-100))"
275
- xmlns="http://www.w3.org/2000/svg"
276
- height="1.125rem"
277
- viewBox="0 0 24 24"
278
- width="1.125rem"
279
- fill="#9ca3af"
280
- >
281
- <path d="M0 0h24v24H0V0z" fill="none" />
282
- <path
283
- d="M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"
284
- />
285
- </svg>
286
- </div>
287
- `:null}
288
- <bim-context-menu
289
- ${di(this._contextMenu)}
290
- style="row-gap: var(--bim-ui_size-4xs)"
291
- >
292
- <slot @slotchange=${this.onSlotChange}></slot>
293
- </bim-context-menu>
270
+ ${this.tooltipTitle||this.tooltipText?e:null}
294
271
  </div>
295
- `}},Bn.styles=yt`
272
+ <slot></slot>
273
+ `}};qh.styles=yt`
296
274
  :host {
297
275
  --bim-label--c: var(--bim-ui_bg-contrast-100, white);
298
276
  display: block;
@@ -403,9 +381,9 @@ ${t}
403
381
  :host(:not([tooltip-visible])) .tooltip {
404
382
  display: none;
405
383
  }
406
- `,Bn);fe([W({type:String,reflect:!0})],re.prototype,"label",2);fe([W({type:Boolean,attribute:"label-hidden",reflect:!0})],re.prototype,"labelHidden",2);fe([W({type:Boolean,reflect:!0})],re.prototype,"active",2);fe([W({type:Boolean,reflect:!0,attribute:"disabled"})],re.prototype,"disabled",2);fe([W({type:String,reflect:!0})],re.prototype,"icon",2);fe([W({type:Boolean,reflect:!0})],re.prototype,"vertical",2);fe([W({type:Number,attribute:"tooltip-time",reflect:!0})],re.prototype,"tooltipTime",2);fe([W({type:Boolean,attribute:"tooltip-visible",reflect:!0})],re.prototype,"tooltipVisible",2);fe([W({type:String,attribute:"tooltip-title",reflect:!0})],re.prototype,"tooltipTitle",2);fe([W({type:String,attribute:"tooltip-text",reflect:!0})],re.prototype,"tooltipText",2);fe([W({type:Boolean,reflect:!0})],re.prototype,"loading",1);let qg=re;var Qg=Object.defineProperty,nn=(n,e,t,i)=>{for(var s=void 0,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=o(e,t,s)||s);return s&&Qg(e,t,s),s};const Yh=class extends bt{constructor(){super(...arguments),this.checked=!1,this.inverted=!1,this.onValueChange=new Event("change")}get value(){return this.checked}onChange(e){e.stopPropagation(),this.checked=e.target.checked,this.dispatchEvent(this.onValueChange)}render(){return K`
384
+ `;let ae=qh;me([W({type:String,reflect:!0})],ae.prototype,"label",2);me([W({type:Boolean,attribute:"label-hidden",reflect:!0})],ae.prototype,"labelHidden",2);me([W({type:Boolean,reflect:!0})],ae.prototype,"active",2);me([W({type:Boolean,reflect:!0,attribute:"disabled"})],ae.prototype,"disabled",2);me([W({type:String,reflect:!0})],ae.prototype,"icon",2);me([W({type:Boolean,reflect:!0})],ae.prototype,"vertical",2);me([W({type:Number,attribute:"tooltip-time",reflect:!0})],ae.prototype,"tooltipTime",2);me([W({type:Boolean,attribute:"tooltip-visible",reflect:!0})],ae.prototype,"tooltipVisible",2);me([W({type:String,attribute:"tooltip-title",reflect:!0})],ae.prototype,"tooltipTitle",2);me([W({type:String,attribute:"tooltip-text",reflect:!0})],ae.prototype,"tooltipText",2);me([W({type:Boolean,reflect:!0})],ae.prototype,"loading",1);var e0=Object.defineProperty,on=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&e0(e,t,s),s};const Qh=class extends It{constructor(){super(...arguments),this.checked=!1,this.inverted=!1,this.onValueChange=new Event("change")}get value(){return this.checked}onChange(e){e.stopPropagation(),this.checked=e.target.checked,this.dispatchEvent(this.onValueChange)}render(){return X`
407
385
  <div class="parent">
408
- ${this.label?K`<bim-label .icon="${this.icon}">${this.label}</bim-label> `:null}
386
+ ${this.label?X`<bim-label .icon="${this.icon}">${this.label}</bim-label> `:null}
409
387
  <input
410
388
  type="checkbox"
411
389
  aria-label=${this.label||this.name||"Checkbox Input"}
@@ -413,7 +391,7 @@ ${t}
413
391
  .checked="${this.checked}"
414
392
  />
415
393
  </div>
416
- `}};Yh.styles=yt`
394
+ `}};Qh.styles=yt`
417
395
  :host {
418
396
  display: block;
419
397
  }
@@ -447,7 +425,7 @@ ${t}
447
425
  outline: var(--bim-checkbox--olw, 2px) solid
448
426
  var(--bim-checkbox--olc, var(--bim-ui_accent-base));
449
427
  }
450
- `;let Qi=Yh;nn([W({type:String,reflect:!0})],Qi.prototype,"icon");nn([W({type:String,reflect:!0})],Qi.prototype,"name");nn([W({type:String,reflect:!0})],Qi.prototype,"label");nn([W({type:Boolean,reflect:!0})],Qi.prototype,"checked");nn([W({type:Boolean,reflect:!0})],Qi.prototype,"inverted");var Kg=Object.defineProperty,Ki=(n,e,t,i)=>{for(var s=void 0,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=o(e,t,s)||s);return s&&Kg(e,t,s),s};const Wh=class extends bt{constructor(){super(...arguments),this.vertical=!1,this.color="#bcf124",this._colorInput=zi(),this._textInput=zi(),this.onValueChange=new Event("input"),this.onOpacityInput=e=>{const t=e.target;this.opacity=t.value,this.dispatchEvent(this.onValueChange)}}set value(e){const{color:t,opacity:i}=e;this.color=t,i&&(this.opacity=i)}get value(){const e={color:this.color};return this.opacity&&(e.opacity=this.opacity),e}onColorInput(e){e.stopPropagation();const{value:t}=this._colorInput;t&&(this.color=t.value,this.dispatchEvent(this.onValueChange))}onTextInput(e){e.stopPropagation();const{value:t}=this._textInput;if(!t)return;const{value:i}=t;let s=i.replace(/[^a-fA-F0-9]/g,"");s.startsWith("#")||(s=`#${s}`),t.value=s.slice(0,7),t.value.length===7&&(this.color=t.value,this.dispatchEvent(this.onValueChange))}focus(){const{value:e}=this._colorInput;e&&e.click()}render(){return K`
428
+ `;let es=Qh;on([W({type:String,reflect:!0})],es.prototype,"icon");on([W({type:String,reflect:!0})],es.prototype,"name");on([W({type:String,reflect:!0})],es.prototype,"label");on([W({type:Boolean,reflect:!0})],es.prototype,"checked");on([W({type:Boolean,reflect:!0})],es.prototype,"inverted");var i0=Object.defineProperty,is=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&i0(e,t,s),s};const Kh=class extends It{constructor(){super(...arguments),this.vertical=!1,this.color="#bcf124",this._colorInput=qi(),this._textInput=qi(),this.onValueChange=new Event("input"),this.onOpacityInput=e=>{const t=e.target;this.opacity=t.value,this.dispatchEvent(this.onValueChange)}}set value(e){const{color:t,opacity:i}=e;this.color=t,i&&(this.opacity=i)}get value(){const e={color:this.color};return this.opacity&&(e.opacity=this.opacity),e}onColorInput(e){e.stopPropagation();const{value:t}=this._colorInput;t&&(this.color=t.value,this.dispatchEvent(this.onValueChange))}onTextInput(e){e.stopPropagation();const{value:t}=this._textInput;if(!t)return;const{value:i}=t;let s=i.replace(/[^a-fA-F0-9]/g,"");s.startsWith("#")||(s=`#${s}`),t.value=s.slice(0,7),t.value.length===7&&(this.color=t.value,this.dispatchEvent(this.onValueChange))}focus(){const{value:e}=this._colorInput;e&&e.click()}render(){return X`
451
429
  <div class="parent">
452
430
  <bim-input
453
431
  .label=${this.label}
@@ -459,7 +437,7 @@ ${t}
459
437
  style="display: flex; align-items: center; gap: .375rem; height: 100%; flex: 1; padding: 0 0.5rem;"
460
438
  >
461
439
  <input
462
- ${di(this._colorInput)}
440
+ ${we(this._colorInput)}
463
441
  @input="${this.onColorInput}"
464
442
  type="color"
465
443
  aria-label=${this.label||this.name||"Color Input"}
@@ -471,14 +449,14 @@ ${t}
471
449
  style="background-color: ${this.color}"
472
450
  ></div>
473
451
  <input
474
- ${di(this._textInput)}
452
+ ${we(this._textInput)}
475
453
  @input="${this.onTextInput}"
476
454
  value="${this.color}"
477
455
  type="text"
478
456
  aria-label=${this.label||this.name||"Text Color Input"}
479
457
  />
480
458
  </div>
481
- ${this.opacity!==void 0?K`<bim-number-input
459
+ ${this.opacity!==void 0?X`<bim-number-input
482
460
  @change=${this.onOpacityInput}
483
461
  slider
484
462
  suffix="%"
@@ -489,7 +467,7 @@ ${t}
489
467
  </div>
490
468
  </bim-input>
491
469
  </div>
492
- `}};Wh.styles=yt`
470
+ `}};Kh.styles=yt`
493
471
  :host {
494
472
  --bim-input--bgc: var(--bim-ui_bg-contrast-20);
495
473
  flex: 1;
@@ -549,7 +527,7 @@ ${t}
549
527
  bim-number-input {
550
528
  flex-grow: 0;
551
529
  }
552
- `;let bi=Wh;Ki([W({type:String,reflect:!0})],bi.prototype,"name");Ki([W({type:String,reflect:!0})],bi.prototype,"label");Ki([W({type:String,reflect:!0})],bi.prototype,"icon");Ki([W({type:Boolean,reflect:!0})],bi.prototype,"vertical");Ki([W({type:Number,reflect:!0})],bi.prototype,"opacity");Ki([W({type:String,reflect:!0})],bi.prototype,"color");const Jg=yt`
530
+ `;let yi=Kh;is([W({type:String,reflect:!0})],yi.prototype,"name");is([W({type:String,reflect:!0})],yi.prototype,"label");is([W({type:String,reflect:!0})],yi.prototype,"icon");is([W({type:Boolean,reflect:!0})],yi.prototype,"vertical");is([W({type:Number,reflect:!0})],yi.prototype,"opacity");is([W({type:String,reflect:!0})],yi.prototype,"color");const s0=yt`
553
531
  ::-webkit-scrollbar {
554
532
  width: 0.4rem;
555
533
  height: 0.4rem;
@@ -567,7 +545,7 @@ ${t}
567
545
  ::-webkit-scrollbar-track {
568
546
  background-color: var(--bim-scrollbar--bgc, var(--bim-ui_bg-base));
569
547
  }
570
- `,t0=yt`
548
+ `,n0=yt`
571
549
  :root {
572
550
  /* Grayscale Colors */
573
551
  --bim-ui_gray-0: hsl(210 10% 5%);
@@ -658,9 +636,13 @@ ${t}
658
636
  --bim-ui_bg-contrast-100: var(--bim-ui_gray-0);
659
637
  --bim-ui_accent-base: #6528d7;
660
638
  }
661
- `,Qe={scrollbar:Jg,globalStyles:t0};var e0=Object.defineProperty,i0=Object.getOwnPropertyDescriptor,s0=(n,e,t,i)=>{for(var s=i0(e,t),r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=o(e,t,s)||s);return s&&e0(e,t,s),s};const jh=class extends bt{constructor(){super(...arguments),this._visible=!1,this._middleware={name:"middleware",async fn(e){const{right:t,top:i}=await Ea(e);return e.x-=Math.sign(t)===1?t+5:0,e.y-=Math.sign(i)===1?i+5:0,e}}}get visible(){return this._visible}set visible(e){this._visible=e,e&&this.updatePosition()}async updatePosition(e){const t=e||this.parentNode;if(!t){this.visible=!1,console.warn("No target element found for context-menu.");return}const i=await fh(t,this,{placement:"right",middleware:[th(10),uh(),dh(),hh({padding:5}),this._middleware]}),{x:s,y:r}=i;this.style.left=`${s}px`,this.style.top=`${r}px`}render(){return K` <slot></slot> `}};jh.styles=[Qe.scrollbar,yt`
639
+
640
+ [data-context-dialog]::backdrop {
641
+ background-color: transparent;
642
+ }
643
+ `,ti={scrollbar:s0,globalStyles:n0},Jh=class Et{static set config(e){this._config={...Et._config,...e}}static get config(){return Et._config}static addGlobalStyles(){let e=document.querySelector("style[id='bim-ui']");if(e)return;e=document.createElement("style"),e.id="bim-ui",e.textContent=ti.globalStyles.cssText;const t=document.head.firstChild;t?document.head.insertBefore(e,t):document.head.append(e)}static defineCustomElement(e,t){customElements.get(e)||customElements.define(e,t)}static registerComponents(){Et.init()}static init(){Et.addGlobalStyles(),Et.defineCustomElement("bim-button",ae),Et.defineCustomElement("bim-checkbox",es),Et.defineCustomElement("bim-color-input",yi),Et.defineCustomElement("bim-context-menu",l0),Et.defineCustomElement("bim-dropdown",De),Et.defineCustomElement("bim-grid",Na),Et.defineCustomElement("bim-icon",m0),Et.defineCustomElement("bim-input",an),Et.defineCustomElement("bim-label",ss),Et.defineCustomElement("bim-number-input",Qt),Et.defineCustomElement("bim-option",zt),Et.defineCustomElement("bim-panel",_i),Et.defineCustomElement("bim-panel-section",ns),Et.defineCustomElement("bim-selector",rs),Et.defineCustomElement("bim-table",ce),Et.defineCustomElement("bim-tabs",vi),Et.defineCustomElement("bim-tab",ee),Et.defineCustomElement("bim-table-cell",ud),Et.defineCustomElement("bim-table-children",pd),Et.defineCustomElement("bim-table-group",gd),Et.defineCustomElement("bim-table-row",Ti),Et.defineCustomElement("bim-text-input",Re),Et.defineCustomElement("bim-toolbar",Zr),Et.defineCustomElement("bim-toolbar-group",jr),Et.defineCustomElement("bim-toolbar-section",ls),Et.defineCustomElement("bim-viewport",Rd)}static newRandomId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let t="";for(let i=0;i<10;i++){const s=Math.floor(Math.random()*e.length);t+=e.charAt(s)}return t}};Jh._config={sectionLabelOnVerticalToolbar:!1};let r0=Jh;class Ae extends It{constructor(){super(...arguments),this._lazyLoadObserver=null,this._visibleElements=[],this.ELEMENTS_BEFORE_OBSERVER=20,this.useObserver=!1,this.elements=new Set,this.observe=e=>{if(!this.useObserver)return;for(const i of e)this.elements.add(i);const t=e.slice(this.ELEMENTS_BEFORE_OBSERVER);for(const i of t)i.remove();this.observeLastElement()}}set visibleElements(e){this._visibleElements=this.useObserver?e:[],this.requestUpdate()}get visibleElements(){return this._visibleElements}getLazyObserver(){if(!this.useObserver)return null;if(this._lazyLoadObserver)return this._lazyLoadObserver;const e=new IntersectionObserver(t=>{const i=t[0];if(!i.isIntersecting)return;const s=i.target;e.unobserve(s);const n=this.ELEMENTS_BEFORE_OBSERVER+this.visibleElements.length,o=[...this.elements][n];o&&(this.visibleElements=[...this.visibleElements,o],e.observe(o))},{threshold:.5});return e}observeLastElement(){const e=this.getLazyObserver();if(!e)return;const t=this.ELEMENTS_BEFORE_OBSERVER+this.visibleElements.length-1,i=[...this.elements][t];i&&e.observe(i)}resetVisibleElements(){const e=this.getLazyObserver();if(e){for(const t of this.elements)e.unobserve(t);this.visibleElements=[],this.observeLastElement()}}static create(e,t){const i=document.createDocumentFragment();if(e.length===0)return Zi(e(),i),i.firstElementChild;if(!t)throw new Error("UIComponent: Initial state is required for statefull components.");let s=t;const n=e,o=l=>(s={...s,...l},Zi(n(s),i),s);o(t);const a=()=>s;return[i.firstElementChild,o,a]}}var o0=Object.defineProperty,a0=Object.getOwnPropertyDescriptor,td=(r,e,t,i)=>{for(var s=a0(e,t),n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&o0(e,t,s),s},kt;const xa=(kt=class extends It{constructor(){super(...arguments),this._previousContainer=null,this._visible=!1}get placement(){return this._placement}set placement(r){this._placement=r,this.updatePosition()}static removeMenus(){for(const r of kt.menus)r instanceof kt&&(r.visible=!1);kt.dialog.close(),kt.dialog.remove()}get visible(){return this._visible}set visible(r){var e;this._visible=r,r?(kt.dialog.parentElement||document.body.append(kt.dialog),this._previousContainer=this.parentElement,kt.dialog.style.top=`${window.scrollY||document.documentElement.scrollTop}px`,kt.dialog.append(this),kt.dialog.showModal(),this.updatePosition(),this.dispatchEvent(new Event("visible"))):((e=this._previousContainer)==null||e.append(this),this._previousContainer=null,this.dispatchEvent(new Event("hidden")))}async updatePosition(){if(!(this.visible&&this._previousContainer))return;const r=this.placement??"right",e=await bh(this._previousContainer,this,{placement:r,middleware:[rh(10),Eh(),gh(),mh({padding:5})]}),{x:t,y:i}=e;this.style.left=`${t}px`,this.style.top=`${i}px`}connectedCallback(){super.connectedCallback(),kt.menus.push(this)}render(){return X` <slot></slot> `}},kt.styles=[ti.scrollbar,yt`
662
644
  :host {
663
- --bim-label--fz: var(--bim-ui_size-xs);
645
+ pointer-events: auto;
664
646
  position: absolute;
665
647
  top: 0;
666
648
  left: 0;
@@ -672,23 +654,35 @@ ${t}
672
654
  box-shadow: 1px 2px 8px 2px rgba(0, 0, 0, 0.15);
673
655
  padding: 0.5rem;
674
656
  border-radius: var(--bim-ui_size-4xs);
657
+ display: flex;
675
658
  background-color: var(
676
659
  --bim-context-menu--bgc,
677
660
  var(--bim-ui_bg-contrast-20)
678
661
  );
679
662
  }
680
663
 
681
- :host([visible]) {
682
- display: flex;
683
- }
684
-
685
664
  :host(:not([visible])) {
686
665
  display: none;
687
666
  }
688
- `];let Xh=jh;s0([W({type:Boolean,reflect:!0})],Xh.prototype,"visible");class Vr extends bt{constructor(){super(...arguments),this._lazyLoadObserver=null,this._visibleElements=[],this.ELEMENTS_BEFORE_OBSERVER=20,this.useObserver=!1,this.elements=new Set,this.observe=e=>{if(!this.useObserver)return;for(const i of e)this.elements.add(i);const t=e.slice(this.ELEMENTS_BEFORE_OBSERVER);for(const i of t)i.remove();this.observeLastElement()}}set visibleElements(e){this._visibleElements=this.useObserver?e:[],this.requestUpdate()}get visibleElements(){return this._visibleElements}getLazyObserver(){if(!this.useObserver)return null;if(this._lazyLoadObserver)return this._lazyLoadObserver;const e=new IntersectionObserver(t=>{const i=t[0];if(!i.isIntersecting)return;const s=i.target;e.unobserve(s);const r=this.ELEMENTS_BEFORE_OBSERVER+this.visibleElements.length,o=[...this.elements][r];o&&(this.visibleElements=[...this.visibleElements,o],e.observe(o))},{threshold:.5});return e}observeLastElement(){const e=this.getLazyObserver();if(!e)return;const t=this.ELEMENTS_BEFORE_OBSERVER+this.visibleElements.length-1,i=[...this.elements][t];i&&e.observe(i)}resetVisibleElements(){const e=this.getLazyObserver();if(e){for(const t of this.elements)e.unobserve(t);this.visibleElements=[],this.observeLastElement()}}static create(e,t){const i=document.createDocumentFragment();if(e.length===0)return ji(e(),i),i.firstElementChild;if(!t)throw new Error("UIComponent: Initial state is required for statefull components.");let s=t;const r=e,o=a=>(s={...s,...a},ji(r(s),i),s);return o(t),[i.firstElementChild,o]}}const lr=(n,e={},t=!0)=>{let i={};for(const s of n.children){const r=s,o=r.getAttribute("name")||r.getAttribute("label"),a=e[o];if(o){if("value"in r&&typeof r.value<"u"&&r.value!==null){const l=r.value;if(typeof l=="object"&&!Array.isArray(l)&&Object.keys(l).length===0)continue;i[o]=a?a(r.value):r.value}else if(t){const l=lr(r,e);if(Object.keys(l).length===0)continue;i[o]=a?a(l):l}}else t&&(i={...i,...lr(r,e)})}return i},$r=n=>n==="true"||n==="false"?n==="true":n&&!isNaN(Number(n))&&n.trim()!==""?Number(n):n,n0=[">=","<=","=",">","<","?","/","#"];function lc(n){const e=n0.find(o=>n.split(o).length===2),t=n.split(e).map(o=>o.trim()),[i,s]=t,r=s.startsWith("'")&&s.endsWith("'")?s.replace(/'/g,""):$r(s);return{key:i,condition:e,value:r}}const ia=n=>{try{const e=[],t=n.split(/&(?![^()]*\))/).map(i=>i.trim());for(const i of t){const s=!i.startsWith("(")&&!i.endsWith(")"),r=i.startsWith("(")&&i.endsWith(")");if(s){const o=lc(i);e.push(o)}if(r){const o={operator:"&",queries:i.replace(/^(\()|(\))$/g,"").split("&").map(a=>a.trim()).map((a,l)=>{const c=lc(a);return l>0&&(c.operator="&"),c})};e.push(o)}}return e}catch{return null}},cc=(n,e,t)=>{let i=!1;switch(e){case"=":i=n===t;break;case"?":i=String(n).includes(String(t));break;case"<":(typeof n=="number"||typeof t=="number")&&(i=n<t);break;case"<=":(typeof n=="number"||typeof t=="number")&&(i=n<=t);break;case">":(typeof n=="number"||typeof t=="number")&&(i=n>t);break;case">=":(typeof n=="number"||typeof t=="number")&&(i=n>=t);break;case"/":i=String(n).startsWith(String(t));break}return i};var r0=Object.defineProperty,o0=Object.getOwnPropertyDescriptor,Ke=(n,e,t,i)=>{for(var s=i>1?void 0:i?o0(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&r0(e,t,s),s};const Zh=class extends bt{constructor(){super(...arguments),this.checked=!1,this.checkbox=!1,this.noMark=!1,this.vertical=!1}get value(){return this._value!==void 0?this._value:this.label?$r(this.label):this.label}set value(e){this._value=e}render(){return K`
667
+ `],kt.dialog=Ae.create(()=>X` <dialog
668
+ @click=${r=>{r.target===kt.dialog&&kt.removeMenus()}}
669
+ @cancel=${()=>kt.removeMenus()}
670
+ data-context-dialog
671
+ style="
672
+ width: 0;
673
+ height: 0;
674
+ position: relative;
675
+ padding: 0;
676
+ border: none;
677
+ outline: none;
678
+ margin: none;
679
+ overflow: visible;
680
+ background-color: transparent;
681
+ "
682
+ ></dialog>`),kt.menus=[],kt);td([W({type:String,reflect:!0})],xa.prototype,"placement");td([W({type:Boolean,reflect:!0})],xa.prototype,"visible");let l0=xa;const cr=(r,e={},t=!0)=>{let i={};for(const s of r.children){const n=s,o=n.getAttribute("name")||n.getAttribute("label"),a=e[o];if(o){if("value"in n&&typeof n.value<"u"&&n.value!==null){const l=n.value;if(typeof l=="object"&&!Array.isArray(l)&&Object.keys(l).length===0)continue;i[o]=a?a(n.value):n.value}else if(t){const l=cr(n,e);if(Object.keys(l).length===0)continue;i[o]=a?a(l):l}}else t&&(i={...i,...cr(n,e)})}return i},Hr=r=>r==="true"||r==="false"?r==="true":r&&!isNaN(Number(r))&&r.trim()!==""?Number(r):r,c0=[">=","<=","=",">","<","?","/","#"];function uc(r){const e=c0.find(o=>r.split(o).length===2),t=r.split(e).map(o=>o.trim()),[i,s]=t,n=s.startsWith("'")&&s.endsWith("'")?s.replace(/'/g,""):Hr(s);return{key:i,condition:e,value:n}}const na=r=>{try{const e=[],t=r.split(/&(?![^()]*\))/).map(i=>i.trim());for(const i of t){const s=!i.startsWith("(")&&!i.endsWith(")"),n=i.startsWith("(")&&i.endsWith(")");if(s){const o=uc(i);e.push(o)}if(n){const o={operator:"&",queries:i.replace(/^(\()|(\))$/g,"").split("&").map(a=>a.trim()).map((a,l)=>{const c=uc(a);return l>0&&(c.operator="&"),c})};e.push(o)}}return e}catch{return null}},fc=(r,e,t)=>{let i=!1;switch(e){case"=":i=r===t;break;case"?":i=String(r).includes(String(t));break;case"<":(typeof r=="number"||typeof t=="number")&&(i=r<t);break;case"<=":(typeof r=="number"||typeof t=="number")&&(i=r<=t);break;case">":(typeof r=="number"||typeof t=="number")&&(i=r>t);break;case">=":(typeof r=="number"||typeof t=="number")&&(i=r>=t);break;case"/":i=String(r).startsWith(String(t));break}return i};var h0=Object.defineProperty,d0=Object.getOwnPropertyDescriptor,ei=(r,e,t,i)=>{for(var s=i>1?void 0:i?d0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&h0(e,t,s),s};const ed=class extends It{constructor(){super(...arguments),this.checked=!1,this.checkbox=!1,this.noMark=!1,this.vertical=!1}get value(){return this._value!==void 0?this._value:this.label?Hr(this.label):this.label}set value(e){this._value=e}render(){return X`
689
683
  <div class="parent" .title=${this.label??""}>
690
- ${this.img||this.icon||this.label?K` <div style="display: flex; column-gap: 0.375rem">
691
- ${this.checkbox&&!this.noMark?K`<bim-checkbox
684
+ ${this.img||this.icon||this.label?X` <div style="display: flex; column-gap: 0.375rem">
685
+ ${this.checkbox&&!this.noMark?X`<bim-checkbox
692
686
  style="pointer-events: none"
693
687
  .checked=${this.checked}
694
688
  ></bim-checkbox>`:null}
@@ -699,7 +693,7 @@ ${t}
699
693
  >${this.label}</bim-label
700
694
  >
701
695
  </div>`:null}
702
- ${!this.checkbox&&!this.noMark&&this.checked?K`<svg
696
+ ${!this.checkbox&&!this.noMark&&this.checked?X`<svg
703
697
  xmlns="http://www.w3.org/2000/svg"
704
698
  height="1.125rem"
705
699
  viewBox="0 0 24 24"
@@ -711,7 +705,7 @@ ${t}
711
705
  </svg>`:null}
712
706
  <slot></slot>
713
707
  </div>
714
- `}};Zh.styles=yt`
708
+ `}};ed.styles=yt`
715
709
  :host {
716
710
  --bim-label--c: var(--bim-ui_bg-contrast-100);
717
711
  display: block;
@@ -766,7 +760,7 @@ ${t}
766
760
  bim-label {
767
761
  pointer-events: none;
768
762
  }
769
- `;let Bt=Zh;Ke([W({type:String,reflect:!0})],Bt.prototype,"img",2);Ke([W({type:String,reflect:!0})],Bt.prototype,"label",2);Ke([W({type:String,reflect:!0})],Bt.prototype,"icon",2);Ke([W({type:Boolean,reflect:!0})],Bt.prototype,"checked",2);Ke([W({type:Boolean,reflect:!0})],Bt.prototype,"checkbox",2);Ke([W({type:Boolean,attribute:"no-mark",reflect:!0})],Bt.prototype,"noMark",2);Ke([W({converter:{fromAttribute(n){return n&&$r(n)}}})],Bt.prototype,"value",1);Ke([W({type:Boolean,reflect:!0})],Bt.prototype,"vertical",2);var a0=Object.defineProperty,l0=Object.getOwnPropertyDescriptor,Je=(n,e,t,i)=>{for(var s=i>1?void 0:i?l0(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&a0(e,t,s),s};const qh=class extends Vr{constructor(){super(),this.multiple=!1,this.required=!1,this.vertical=!1,this._visible=!1,this._value=new Set,this.onValueChange=new Event("change"),this.onWindowMouseUp=e=>{this.visible&&(this.contains(e.target)||(this.visible=!1))},this.onOptionClick=e=>{const t=e.target,i=this._value.has(t);if(!this.multiple&&!this.required&&!i)this._value=new Set([t]);else if(!this.multiple&&!this.required&&i)this._value=new Set([]);else if(!this.multiple&&this.required&&!i)this._value=new Set([t]);else if(this.multiple&&!this.required&&!i)this._value=new Set([...this._value,t]);else if(this.multiple&&!this.required&&i){const s=[...this._value].filter(r=>r!==t);this._value=new Set(s)}else if(this.multiple&&this.required&&!i)this._value=new Set([...this._value,t]);else if(this.multiple&&this.required&&i){const s=[...this._value].filter(o=>o!==t),r=new Set(s);r.size!==0&&(this._value=r)}this.updateOptionsState(),this.dispatchEvent(this.onValueChange)},this.useObserver=!0}set visible(e){this._visible=e,e||this.resetVisibleElements()}get visible(){return this._visible}set value(e){if(this.required&&Object.keys(e).length===0)return;const t=new Set;for(const i of e){const s=this.findOption(i);if(s&&(t.add(s),!this.multiple&&Object.keys(e).length===1))break}this._value=t,this.updateOptionsState(),this.dispatchEvent(this.onValueChange)}get value(){return[...this._value].filter(e=>e instanceof Bt&&e.checked).map(e=>e.value)}get _options(){const e=new Set([...this.elements]);for(const t of this.children)t instanceof Bt&&e.add(t);return[...e]}onSlotChange(e){const t=e.target.assignedElements();this.observe(t);const i=new Set;for(const s of this.elements){if(!(s instanceof Bt)){s.remove();continue}s.checked&&i.add(s),s.removeEventListener("click",this.onOptionClick),s.addEventListener("click",this.onOptionClick)}this._value=i}updateOptionsState(){for(const e of this._options)e instanceof Bt&&(e.checked=this._value.has(e))}findOption(e){return this._options.find(t=>t instanceof Bt?t.label===e||t.value===e:!1)}connectedCallback(){super.connectedCallback(),window.addEventListener("mouseup",this.onWindowMouseUp)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("mouseup",this.onWindowMouseUp)}render(){let e,t,i;if(this._value.size===0)e="Select an option...";else if(this._value.size===1){const s=[...this._value][0];e=(s==null?void 0:s.label)||(s==null?void 0:s.value),t=s==null?void 0:s.img,i=s==null?void 0:s.icon}else e=`Multiple (${this._value.size})`;return K`
763
+ `;let zt=ed;ei([W({type:String,reflect:!0})],zt.prototype,"img",2);ei([W({type:String,reflect:!0})],zt.prototype,"label",2);ei([W({type:String,reflect:!0})],zt.prototype,"icon",2);ei([W({type:Boolean,reflect:!0})],zt.prototype,"checked",2);ei([W({type:Boolean,reflect:!0})],zt.prototype,"checkbox",2);ei([W({type:Boolean,attribute:"no-mark",reflect:!0})],zt.prototype,"noMark",2);ei([W({converter:{fromAttribute(r){return r&&Hr(r)}}})],zt.prototype,"value",1);ei([W({type:Boolean,reflect:!0})],zt.prototype,"vertical",2);var u0=Object.defineProperty,f0=Object.getOwnPropertyDescriptor,ii=(r,e,t,i)=>{for(var s=i>1?void 0:i?f0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&u0(e,t,s),s};const id=class extends Ae{constructor(){super(),this.multiple=!1,this.required=!1,this.vertical=!1,this._visible=!1,this._value=new Set,this.onValueChange=new Event("change"),this._contextMenu=qi(),this.onOptionClick=e=>{const t=e.target,i=this._value.has(t);if(!this.multiple&&!this.required&&!i)this._value=new Set([t]);else if(!this.multiple&&!this.required&&i)this._value=new Set([]);else if(!this.multiple&&this.required&&!i)this._value=new Set([t]);else if(this.multiple&&!this.required&&!i)this._value=new Set([...this._value,t]);else if(this.multiple&&!this.required&&i){const s=[...this._value].filter(n=>n!==t);this._value=new Set(s)}else if(this.multiple&&this.required&&!i)this._value=new Set([...this._value,t]);else if(this.multiple&&this.required&&i){const s=[...this._value].filter(o=>o!==t),n=new Set(s);n.size!==0&&(this._value=n)}this.updateOptionsState(),this.dispatchEvent(this.onValueChange)},this.useObserver=!0}set visible(e){if(e){const{value:t}=this._contextMenu;if(!t)return;for(const i of this.elements)t.append(i);this._visible=!0}else{for(const t of this.elements)this.append(t);this._visible=!1,this.resetVisibleElements()}}get visible(){return this._visible}set value(e){if(this.required&&Object.keys(e).length===0)return;const t=new Set;for(const i of e){const s=this.findOption(i);if(s&&(t.add(s),!this.multiple&&Object.keys(e).length===1))break}this._value=t,this.updateOptionsState(),this.dispatchEvent(this.onValueChange)}get value(){return[...this._value].filter(e=>e instanceof zt&&e.checked).map(e=>e.value)}get _options(){const e=new Set([...this.elements]);for(const t of this.children)t instanceof zt&&e.add(t);return[...e]}onSlotChange(e){const t=e.target.assignedElements();this.observe(t);const i=new Set;for(const s of this.elements){if(!(s instanceof zt)){s.remove();continue}s.checked&&i.add(s),s.removeEventListener("click",this.onOptionClick),s.addEventListener("click",this.onOptionClick)}this._value=i}updateOptionsState(){for(const e of this._options)e instanceof zt&&(e.checked=this._value.has(e))}findOption(e){return this._options.find(t=>t instanceof zt?t.label===e||t.value===e:!1)}render(){let e,t,i;if(this._value.size===0)e="Select an option...";else if(this._value.size===1){const s=[...this._value][0];e=(s==null?void 0:s.label)||(s==null?void 0:s.value),t=s==null?void 0:s.img,i=s==null?void 0:s.icon}else e=`Multiple (${this._value.size})`;return X`
770
764
  <bim-input
771
765
  title=${this.label??""}
772
766
  .label=${this.label}
@@ -791,13 +785,16 @@ ${t}
791
785
  <path d="M0 0h24v24H0V0z" fill="none" />
792
786
  <path d="M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z" />
793
787
  </svg>
788
+ <bim-context-menu
789
+ ${we(this._contextMenu)}
790
+ .visible=${this.visible}
791
+ @hidden=${()=>{this.visible&&(this.visible=!1)}}
792
+ >
793
+ <slot @slotchange=${this.onSlotChange}></slot>
794
+ </bim-context-menu>
794
795
  </div>
795
- <bim-context-menu .visible=${this.visible}>
796
- <slot @slotchange=${this.onSlotChange}></slot>
797
- ${this.visibleElements.map(s=>s)}
798
- </bim-context-menu>
799
796
  </bim-input>
800
- `}};qh.styles=[Qe.scrollbar,yt`
797
+ `}};id.styles=[ti.scrollbar,yt`
801
798
  :host {
802
799
  --bim-input--bgc: var(
803
800
  --bim-dropdown--bgc,
@@ -832,8 +829,8 @@ ${t}
832
829
  bim-label {
833
830
  pointer-events: none;
834
831
  }
835
- `];let xe=qh;Je([W({type:String,reflect:!0})],xe.prototype,"name",2);Je([W({type:String,reflect:!0})],xe.prototype,"icon",2);Je([W({type:String,reflect:!0})],xe.prototype,"label",2);Je([W({type:Boolean,reflect:!0})],xe.prototype,"multiple",2);Je([W({type:Boolean,reflect:!0})],xe.prototype,"required",2);Je([W({type:Boolean,reflect:!0})],xe.prototype,"vertical",2);Je([W({type:Boolean,reflect:!0})],xe.prototype,"visible",1);Je([qi()],xe.prototype,"_value",2);var c0=Object.defineProperty,Qh=(n,e,t,i)=>{for(var s=void 0,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=o(e,t,s)||s);return s&&c0(e,t,s),s};const Kh=class extends bt{constructor(){super(...arguments),this.floating=!1,this.layouts={}}getUniqueAreasFromTemplate(e){const t=e.split(`
836
- `).map(i=>i.trim()).map(i=>i.split('"')[1]).filter(i=>i!==void 0).flatMap(i=>i.split(/\s+/));return[...new Set(t)].filter(i=>i!=="")}firstUpdated(){this._onLayoutChange=new Event("layoutchange")}render(){if(this.layout){if(this.layouts[this.layout]){this.innerHTML="";const e=this.layouts[this.layout],t=this.getUniqueAreasFromTemplate(e.template).map(i=>{const s=e.elements[i];return s&&(s.style.gridArea=i),s}).filter(i=>!!i);this.style.gridTemplate=e.template,this._onLayoutChange&&this.dispatchEvent(this._onLayoutChange),this.append(...t)}}else this.innerHTML="",this.style.gridTemplate="",this._onLayoutChange&&this.dispatchEvent(this._onLayoutChange);return K`<slot></slot>`}};Kh.styles=yt`
832
+ `];let De=id;ii([W({type:String,reflect:!0})],De.prototype,"name",2);ii([W({type:String,reflect:!0})],De.prototype,"icon",2);ii([W({type:String,reflect:!0})],De.prototype,"label",2);ii([W({type:Boolean,reflect:!0})],De.prototype,"multiple",2);ii([W({type:Boolean,reflect:!0})],De.prototype,"required",2);ii([W({type:Boolean,reflect:!0})],De.prototype,"vertical",2);ii([W({type:Boolean,reflect:!0})],De.prototype,"visible",1);ii([ts()],De.prototype,"_value",2);var p0=Object.defineProperty,sd=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&p0(e,t,s),s};const nd=class extends It{constructor(){super(...arguments),this.floating=!1,this.layouts={}}getUniqueAreasFromTemplate(e){const t=e.split(`
833
+ `).map(i=>i.trim()).map(i=>i.split('"')[1]).filter(i=>i!==void 0).flatMap(i=>i.split(/\s+/));return[...new Set(t)].filter(i=>i!=="")}firstUpdated(){this._onLayoutChange=new Event("layoutchange")}render(){if(this.layout){if(this.layouts[this.layout]){this.innerHTML="";const e=this.layouts[this.layout],t=this.getUniqueAreasFromTemplate(e.template).map(i=>{const s=e.elements[i];return s&&(s.style.gridArea=i),s}).filter(i=>!!i);this.style.gridTemplate=e.template,this._onLayoutChange&&this.dispatchEvent(this._onLayoutChange),this.append(...t)}}else this.innerHTML="",this.style.gridTemplate="",this._onLayoutChange&&this.dispatchEvent(this._onLayoutChange);return X`<slot></slot>`}};nd.styles=yt`
837
834
  :host {
838
835
  display: grid;
839
836
  height: 100%;
@@ -862,9 +859,9 @@ ${t}
862
859
  background-color: var(--bim-ui_bg-contrast-20);
863
860
  gap: 1px;
864
861
  }
865
- `;let Oa=Kh;Qh([W({type:Boolean,reflect:!0})],Oa.prototype,"floating");Qh([W({type:String,reflect:!0})],Oa.prototype,"layout");const sa=class extends bt{render(){return K`
862
+ `;let Na=nd;sd([W({type:Boolean,reflect:!0})],Na.prototype,"floating");sd([W({type:String,reflect:!0})],Na.prototype,"layout");const ra=class extends It{render(){return X`
866
863
  <iconify-icon .icon=${this.icon} height="none"></iconify-icon>
867
- `}};sa.styles=yt`
864
+ `}};ra.styles=yt`
868
865
  :host {
869
866
  height: var(--bim-icon--fz, var(--bim-ui_size-sm));
870
867
  width: var(--bim-icon--fz, var(--bim-ui_size-sm));
@@ -876,14 +873,14 @@ ${t}
876
873
  color: var(--bim-icon--c);
877
874
  transition: all 0.15s;
878
875
  }
879
- `,sa.properties={icon:{type:String}};let h0=sa;var d0=Object.defineProperty,Hr=(n,e,t,i)=>{for(var s=void 0,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=o(e,t,s)||s);return s&&d0(e,t,s),s};const Jh=class extends bt{constructor(){super(...arguments),this.vertical=!1,this.onValueChange=new Event("change")}get value(){const e={};for(const t of this.children){const i=t;"value"in i?e[i.name||i.label]=i.value:"checked"in i&&(e[i.name||i.label]=i.checked)}return e}set value(e){const t=[...this.children];for(const i in e){const s=t.find(a=>{const l=a;return l.name===i||l.label===i});if(!s)continue;const r=s,o=e[i];typeof o=="boolean"?r.checked=o:r.value=o}}render(){return K`
876
+ `,ra.properties={icon:{type:String}};let m0=ra;var g0=Object.defineProperty,Yr=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&g0(e,t,s),s};const rd=class extends It{constructor(){super(...arguments),this.vertical=!1,this.onValueChange=new Event("change")}get value(){const e={};for(const t of this.children){const i=t;"value"in i?e[i.name||i.label]=i.value:"checked"in i&&(e[i.name||i.label]=i.checked)}return e}set value(e){const t=[...this.children];for(const i in e){const s=t.find(a=>{const l=a;return l.name===i||l.label===i});if(!s)continue;const n=s,o=e[i];typeof o=="boolean"?n.checked=o:n.value=o}}render(){return X`
880
877
  <div class="parent">
881
- ${this.label||this.icon?K`<bim-label .icon=${this.icon}>${this.label}</bim-label>`:null}
878
+ ${this.label||this.icon?X`<bim-label .icon=${this.icon}>${this.label}</bim-label>`:null}
882
879
  <div class="input">
883
880
  <slot></slot>
884
881
  </div>
885
882
  </div>
886
- `}};Jh.styles=yt`
883
+ `}};rd.styles=yt`
887
884
  :host {
888
885
  flex: 1;
889
886
  display: block;
@@ -931,13 +928,13 @@ ${t}
931
928
  :host(:not([vertical])[label]) .input {
932
929
  max-width: fit-content;
933
930
  }
934
- `;let rn=Jh;Hr([W({type:String,reflect:!0})],rn.prototype,"name");Hr([W({type:String,reflect:!0})],rn.prototype,"label");Hr([W({type:String,reflect:!0})],rn.prototype,"icon");Hr([W({type:Boolean,reflect:!0})],rn.prototype,"vertical");var u0=Object.defineProperty,on=(n,e,t,i)=>{for(var s=void 0,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=o(e,t,s)||s);return s&&u0(e,t,s),s};const td=class extends bt{constructor(){super(...arguments),this.labelHidden=!1,this.iconHidden=!1,this.vertical=!1}get value(){return this.textContent?$r(this.textContent):this.textContent}render(){return K`
931
+ `;let an=rd;Yr([W({type:String,reflect:!0})],an.prototype,"name");Yr([W({type:String,reflect:!0})],an.prototype,"label");Yr([W({type:String,reflect:!0})],an.prototype,"icon");Yr([W({type:Boolean,reflect:!0})],an.prototype,"vertical");var E0=Object.defineProperty,ln=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&E0(e,t,s),s};const od=class extends It{constructor(){super(...arguments),this.labelHidden=!1,this.iconHidden=!1,this.vertical=!1}get value(){return this.textContent?Hr(this.textContent):this.textContent}render(){return X`
935
932
  <div class="parent" .title=${this.textContent??""}>
936
- ${this.img?K`<img .src=${this.img} .alt=${this.textContent||""} />`:null}
937
- ${!this.iconHidden&&this.icon?K`<bim-icon .icon=${this.icon}></bim-icon>`:null}
933
+ ${this.img?X`<img .src=${this.img} .alt=${this.textContent||""} />`:null}
934
+ ${!this.iconHidden&&this.icon?X`<bim-icon .icon=${this.icon}></bim-icon>`:null}
938
935
  <p><slot></slot></p>
939
936
  </div>
940
- `}};td.styles=yt`
937
+ `}};od.styles=yt`
941
938
  :host {
942
939
  --bim-icon--c: var(--bim-label--c);
943
940
  color: var(--bim-label--c, var(--bim-ui_bg-contrast-60));
@@ -993,15 +990,15 @@ ${t}
993
990
  calc(var(--bim-label--fz, var(--bim-ui_size-xs)) * 4)
994
991
  );
995
992
  }
996
- `;let Ji=td;on([W({type:String,reflect:!0})],Ji.prototype,"img");on([W({type:Boolean,attribute:"label-hidden",reflect:!0})],Ji.prototype,"labelHidden");on([W({type:String,reflect:!0})],Ji.prototype,"icon");on([W({type:Boolean,attribute:"icon-hidden",reflect:!0})],Ji.prototype,"iconHidden");on([W({type:Boolean,reflect:!0})],Ji.prototype,"vertical");var f0=Object.defineProperty,p0=Object.getOwnPropertyDescriptor,oe=(n,e,t,i)=>{for(var s=i>1?void 0:i?p0(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&f0(e,t,s),s};const ed=class extends bt{constructor(){super(...arguments),this._value=0,this.vertical=!1,this.slider=!1,this._input=zi(),this.onValueChange=new Event("change")}set value(e){this.setValue(e.toString())}get value(){return this._value}onChange(e){e.stopPropagation();const{value:t}=this._input;t&&this.setValue(t.value)}setValue(e){const{value:t}=this._input;let i=e;if(i=i.replace(/[^0-9.-]/g,""),i=i.replace(/(\..*)\./g,"$1"),i.endsWith(".")||(i.lastIndexOf("-")>0&&(i=i[0]+i.substring(1).replace(/-/g,"")),i==="-"||i==="-0"))return;let s=Number(i);Number.isNaN(s)||(s=this.min!==void 0?Math.max(s,this.min):s,s=this.max!==void 0?Math.min(s,this.max):s,this.value!==s&&(this._value=s,t&&(t.value=this.value.toString()),this.requestUpdate(),this.dispatchEvent(this.onValueChange)))}onBlur(){const{value:e}=this._input;e&&Number.isNaN(Number(e.value))&&(e.value=this.value.toString())}onSliderMouseDown(e){document.body.style.cursor="w-resize";const{clientX:t}=e,i=this.value;let s=!1;const r=l=>{var c;s=!0;const{clientX:h}=l,d=this.step??1,u=((c=d.toString().split(".")[1])==null?void 0:c.length)||0,f=1/(this.sensitivity??1),p=(h-t)/f;if(Math.floor(Math.abs(p))!==Math.abs(p))return;const m=i+p*d;this.setValue(m.toFixed(u))},o=()=>{this.slider=!0,this.removeEventListener("blur",o)},a=()=>{document.removeEventListener("mousemove",r),document.body.style.cursor="default",s?s=!1:(this.addEventListener("blur",o),this.slider=!1,requestAnimationFrame(()=>this.focus())),document.removeEventListener("mouseup",a)};document.addEventListener("mousemove",r),document.addEventListener("mouseup",a)}onFocus(e){e.stopPropagation();const t=i=>{i.key==="Escape"&&(this.blur(),window.removeEventListener("keydown",t))};window.addEventListener("keydown",t)}connectedCallback(){super.connectedCallback(),this.min&&this.min>this.value&&(this._value=this.min),this.max&&this.max<this.value&&(this._value=this.max)}focus(){const{value:e}=this._input;e&&e.focus()}render(){const e=K`
997
- ${this.pref||this.icon?K`<bim-label
993
+ `;let ss=od;ln([W({type:String,reflect:!0})],ss.prototype,"img");ln([W({type:Boolean,attribute:"label-hidden",reflect:!0})],ss.prototype,"labelHidden");ln([W({type:String,reflect:!0})],ss.prototype,"icon");ln([W({type:Boolean,attribute:"icon-hidden",reflect:!0})],ss.prototype,"iconHidden");ln([W({type:Boolean,reflect:!0})],ss.prototype,"vertical");var b0=Object.defineProperty,I0=Object.getOwnPropertyDescriptor,le=(r,e,t,i)=>{for(var s=i>1?void 0:i?I0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&b0(e,t,s),s};const ad=class extends It{constructor(){super(...arguments),this._value=0,this.vertical=!1,this.slider=!1,this._input=qi(),this.onValueChange=new Event("change")}set value(e){this.setValue(e.toString())}get value(){return this._value}onChange(e){e.stopPropagation();const{value:t}=this._input;t&&this.setValue(t.value)}setValue(e){const{value:t}=this._input;let i=e;if(i=i.replace(/[^0-9.-]/g,""),i=i.replace(/(\..*)\./g,"$1"),i.endsWith(".")||(i.lastIndexOf("-")>0&&(i=i[0]+i.substring(1).replace(/-/g,"")),i==="-"||i==="-0"))return;let s=Number(i);Number.isNaN(s)||(s=this.min!==void 0?Math.max(s,this.min):s,s=this.max!==void 0?Math.min(s,this.max):s,this.value!==s&&(this._value=s,t&&(t.value=this.value.toString()),this.requestUpdate(),this.dispatchEvent(this.onValueChange)))}onBlur(){const{value:e}=this._input;e&&Number.isNaN(Number(e.value))&&(e.value=this.value.toString())}onSliderMouseDown(e){document.body.style.cursor="w-resize";const{clientX:t}=e,i=this.value;let s=!1;const n=l=>{var c;s=!0;const{clientX:h}=l,d=this.step??1,u=((c=d.toString().split(".")[1])==null?void 0:c.length)||0,f=1/(this.sensitivity??1),p=(h-t)/f;if(Math.floor(Math.abs(p))!==Math.abs(p))return;const m=i+p*d;this.setValue(m.toFixed(u))},o=()=>{this.slider=!0,this.removeEventListener("blur",o)},a=()=>{document.removeEventListener("mousemove",n),document.body.style.cursor="default",s?s=!1:(this.addEventListener("blur",o),this.slider=!1,requestAnimationFrame(()=>this.focus())),document.removeEventListener("mouseup",a)};document.addEventListener("mousemove",n),document.addEventListener("mouseup",a)}onFocus(e){e.stopPropagation();const t=i=>{i.key==="Escape"&&(this.blur(),window.removeEventListener("keydown",t))};window.addEventListener("keydown",t)}connectedCallback(){super.connectedCallback(),this.min&&this.min>this.value&&(this._value=this.min),this.max&&this.max<this.value&&(this._value=this.max)}focus(){const{value:e}=this._input;e&&e.focus()}render(){const e=X`
994
+ ${this.pref||this.icon?X`<bim-label
998
995
  style="pointer-events: auto"
999
996
  @mousedown=${this.onSliderMouseDown}
1000
997
  .icon=${this.icon}
1001
998
  >${this.pref}</bim-label
1002
999
  >`:null}
1003
1000
  <input
1004
- ${di(this._input)}
1001
+ ${we(this._input)}
1005
1002
  type="text"
1006
1003
  aria-label=${this.label||this.name||"Number Input"}
1007
1004
  size="1"
@@ -1011,12 +1008,12 @@ ${t}
1011
1008
  @focus=${this.onFocus}
1012
1009
  .value=${this.value.toString()}
1013
1010
  />
1014
- ${this.suffix?K`<bim-label
1011
+ ${this.suffix?X`<bim-label
1015
1012
  style="pointer-events: auto"
1016
1013
  @mousedown=${this.onSliderMouseDown}
1017
1014
  >${this.suffix}</bim-label
1018
1015
  >`:null}
1019
- `,t=this.min??-1/0,i=this.max??1/0,s=100*(this.value-t)/(i-t),r=K`
1016
+ `,t=this.min??-1/0,i=this.max??1/0,s=100*(this.value-t)/(i-t),n=X`
1020
1017
  <style>
1021
1018
  .slider-indicator {
1022
1019
  width: ${`${s}%`};
@@ -1024,24 +1021,24 @@ ${t}
1024
1021
  </style>
1025
1022
  <div class="slider" @mousedown=${this.onSliderMouseDown}>
1026
1023
  <div class="slider-indicator"></div>
1027
- ${this.pref||this.icon?K`<bim-label
1024
+ ${this.pref||this.icon?X`<bim-label
1028
1025
  style="z-index: 1; margin-right: 0.125rem"
1029
1026
  .icon=${this.icon}
1030
1027
  >${`${this.pref}: `}</bim-label
1031
1028
  >`:null}
1032
1029
  <bim-label style="z-index: 1;">${this.value}</bim-label>
1033
- ${this.suffix?K`<bim-label style="z-index: 1;">${this.suffix}</bim-label>`:null}
1030
+ ${this.suffix?X`<bim-label style="z-index: 1;">${this.suffix}</bim-label>`:null}
1034
1031
  </div>
1035
- `,o=`${this.label||this.name||this.pref?`${this.label||this.name||this.pref}: `:""}${this.value}${this.suffix??""}`;return K`
1032
+ `,o=`${this.label||this.name||this.pref?`${this.label||this.name||this.pref}: `:""}${this.value}${this.suffix??""}`;return X`
1036
1033
  <bim-input
1037
1034
  title=${o}
1038
1035
  .label=${this.label}
1039
1036
  .icon=${this.icon}
1040
1037
  .vertical=${this.vertical}
1041
1038
  >
1042
- ${this.slider?r:e}
1039
+ ${this.slider?n:e}
1043
1040
  </bim-input>
1044
- `}};ed.styles=yt`
1041
+ `}};ad.styles=yt`
1045
1042
  :host {
1046
1043
  --bim-input--bgc: var(
1047
1044
  --bim-number-input--bgc,
@@ -1130,14 +1127,14 @@ ${t}
1130
1127
  bim-label {
1131
1128
  pointer-events: none;
1132
1129
  }
1133
- `;let Zt=ed;oe([W({type:String,reflect:!0})],Zt.prototype,"name",2);oe([W({type:String,reflect:!0})],Zt.prototype,"icon",2);oe([W({type:String,reflect:!0})],Zt.prototype,"label",2);oe([W({type:String,reflect:!0})],Zt.prototype,"pref",2);oe([W({type:Number,reflect:!0})],Zt.prototype,"min",2);oe([W({type:Number,reflect:!0})],Zt.prototype,"value",1);oe([W({type:Number,reflect:!0})],Zt.prototype,"step",2);oe([W({type:Number,reflect:!0})],Zt.prototype,"sensitivity",2);oe([W({type:Number,reflect:!0})],Zt.prototype,"max",2);oe([W({type:String,reflect:!0})],Zt.prototype,"suffix",2);oe([W({type:Boolean,reflect:!0})],Zt.prototype,"vertical",2);oe([W({type:Boolean,reflect:!0})],Zt.prototype,"slider",2);var m0=Object.defineProperty,g0=Object.getOwnPropertyDescriptor,an=(n,e,t,i)=>{for(var s=i>1?void 0:i?g0(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&m0(e,t,s),s};const id=class extends bt{constructor(){super(...arguments),this.onValueChange=new Event("change"),this._hidden=!1,this.headerHidden=!1,this.valueTransform={},this.activationButton=document.createElement("bim-button")}set hidden(e){this._hidden=e,this.activationButton.active=!e,this.dispatchEvent(new Event("hiddenchange"))}get hidden(){return this._hidden}get value(){return lr(this,this.valueTransform)}set value(e){const t=[...this.children];for(const i in e){const s=t.find(o=>{const a=o;return a.name===i||a.label===i});if(!s)continue;const r=s;r.value=e[i]}}connectedCallback(){super.connectedCallback(),this.activationButton.active=!this.hidden,this.activationButton.onclick=()=>this.hidden=!this.hidden}disconnectedCallback(){super.disconnectedCallback(),this.activationButton.remove()}collapseSections(){const e=this.querySelectorAll("bim-panel-section");for(const t of e)t.collapsed=!0}expandSections(){const e=this.querySelectorAll("bim-panel-section");for(const t of e)t.collapsed=!1}render(){return this.activationButton.icon=this.icon,this.activationButton.label=this.label||this.name,this.activationButton.tooltipTitle=this.label||this.name,K`
1130
+ `;let Qt=ad;le([W({type:String,reflect:!0})],Qt.prototype,"name",2);le([W({type:String,reflect:!0})],Qt.prototype,"icon",2);le([W({type:String,reflect:!0})],Qt.prototype,"label",2);le([W({type:String,reflect:!0})],Qt.prototype,"pref",2);le([W({type:Number,reflect:!0})],Qt.prototype,"min",2);le([W({type:Number,reflect:!0})],Qt.prototype,"value",1);le([W({type:Number,reflect:!0})],Qt.prototype,"step",2);le([W({type:Number,reflect:!0})],Qt.prototype,"sensitivity",2);le([W({type:Number,reflect:!0})],Qt.prototype,"max",2);le([W({type:String,reflect:!0})],Qt.prototype,"suffix",2);le([W({type:Boolean,reflect:!0})],Qt.prototype,"vertical",2);le([W({type:Boolean,reflect:!0})],Qt.prototype,"slider",2);var C0=Object.defineProperty,y0=Object.getOwnPropertyDescriptor,cn=(r,e,t,i)=>{for(var s=i>1?void 0:i?y0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&C0(e,t,s),s};const ld=class extends It{constructor(){super(...arguments),this.onValueChange=new Event("change"),this._hidden=!1,this.headerHidden=!1,this.valueTransform={},this.activationButton=document.createElement("bim-button")}set hidden(e){this._hidden=e,this.activationButton.active=!e,this.dispatchEvent(new Event("hiddenchange"))}get hidden(){return this._hidden}get value(){return cr(this,this.valueTransform)}set value(e){const t=[...this.children];for(const i in e){const s=t.find(o=>{const a=o;return a.name===i||a.label===i});if(!s)continue;const n=s;n.value=e[i]}}connectedCallback(){super.connectedCallback(),this.activationButton.active=!this.hidden,this.activationButton.onclick=()=>this.hidden=!this.hidden}disconnectedCallback(){super.disconnectedCallback(),this.activationButton.remove()}collapseSections(){const e=this.querySelectorAll("bim-panel-section");for(const t of e)t.collapsed=!0}expandSections(){const e=this.querySelectorAll("bim-panel-section");for(const t of e)t.collapsed=!1}render(){return this.activationButton.icon=this.icon,this.activationButton.label=this.label||this.name,this.activationButton.tooltipTitle=this.label||this.name,X`
1134
1131
  <div class="parent">
1135
- ${this.label||this.name||this.icon?K`<bim-label .icon=${this.icon}>${this.label}</bim-label>`:null}
1132
+ ${this.label||this.name||this.icon?X`<bim-label .icon=${this.icon}>${this.label}</bim-label>`:null}
1136
1133
  <div class="sections">
1137
1134
  <slot></slot>
1138
1135
  </div>
1139
1136
  </div>
1140
- `}};id.styles=[Qe.scrollbar,yt`
1137
+ `}};ld.styles=[ti.scrollbar,yt`
1141
1138
  :host {
1142
1139
  display: flex;
1143
1140
  border-radius: var(--bim-ui_size-base);
@@ -1179,7 +1176,7 @@ ${t}
1179
1176
  ::slotted(bim-panel-section:not(:last-child)) {
1180
1177
  border-bottom: 1px solid var(--bim-ui_bg-contrast-20);
1181
1178
  }
1182
- `];let Ci=id;an([W({type:String,reflect:!0})],Ci.prototype,"icon",2);an([W({type:String,reflect:!0})],Ci.prototype,"name",2);an([W({type:String,reflect:!0})],Ci.prototype,"label",2);an([W({type:Boolean,reflect:!0})],Ci.prototype,"hidden",1);an([W({type:Boolean,attribute:"header-hidden",reflect:!0})],Ci.prototype,"headerHidden",2);var E0=Object.defineProperty,ln=(n,e,t,i)=>{for(var s=void 0,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=o(e,t,s)||s);return s&&E0(e,t,s),s};const sd=class extends bt{constructor(){super(...arguments),this.onValueChange=new Event("change"),this.valueTransform={}}get value(){const e=this.parentElement;let t;return e instanceof Ci&&(t=e.valueTransform),Object.values(this.valueTransform).length!==0&&(t=this.valueTransform),lr(this,t)}set value(e){const t=[...this.children];for(const i in e){const s=t.find(o=>{const a=o;return a.name===i||a.label===i});if(!s)continue;const r=s;r.value=e[i]}}onHeaderClick(){this.fixed||(this.collapsed=!this.collapsed)}render(){const e=this.label||this.icon||this.name||this.fixed,t=K`<svg
1179
+ `];let _i=ld;cn([W({type:String,reflect:!0})],_i.prototype,"icon",2);cn([W({type:String,reflect:!0})],_i.prototype,"name",2);cn([W({type:String,reflect:!0})],_i.prototype,"label",2);cn([W({type:Boolean,reflect:!0})],_i.prototype,"hidden",1);cn([W({type:Boolean,attribute:"header-hidden",reflect:!0})],_i.prototype,"headerHidden",2);var _0=Object.defineProperty,hn=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&_0(e,t,s),s};const cd=class extends It{constructor(){super(...arguments),this.onValueChange=new Event("change"),this.valueTransform={}}get value(){const e=this.parentElement;let t;return e instanceof _i&&(t=e.valueTransform),Object.values(this.valueTransform).length!==0&&(t=this.valueTransform),cr(this,t)}set value(e){const t=[...this.children];for(const i in e){const s=t.find(o=>{const a=o;return a.name===i||a.label===i});if(!s)continue;const n=s;n.value=e[i]}}onHeaderClick(){this.fixed||(this.collapsed=!this.collapsed)}render(){const e=this.label||this.icon||this.name||this.fixed,t=X`<svg
1183
1180
  xmlns="http://www.w3.org/2000/svg"
1184
1181
  height="1.125rem"
1185
1182
  viewBox="0 0 24 24"
@@ -1187,7 +1184,7 @@ ${t}
1187
1184
  >
1188
1185
  <path d="M0 0h24v24H0V0z" fill="none" />
1189
1186
  <path d="M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z" />
1190
- </svg>`,i=K`<svg
1187
+ </svg>`,i=X`<svg
1191
1188
  xmlns="http://www.w3.org/2000/svg"
1192
1189
  height="1.125rem"
1193
1190
  viewBox="0 0 24 24"
@@ -1195,23 +1192,23 @@ ${t}
1195
1192
  >
1196
1193
  <path d="M0 0h24v24H0z" fill="none" />
1197
1194
  <path d="M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z" />
1198
- </svg>`,s=this.collapsed?t:i,r=K`
1195
+ </svg>`,s=this.collapsed?t:i,n=X`
1199
1196
  <div
1200
1197
  class="header"
1201
1198
  title=${this.label??""}
1202
1199
  @click=${this.onHeaderClick}
1203
1200
  >
1204
- ${this.label||this.icon||this.name?K`<bim-label .icon=${this.icon}>${this.label}</bim-label>`:null}
1201
+ ${this.label||this.icon||this.name?X`<bim-label .icon=${this.icon}>${this.label}</bim-label>`:null}
1205
1202
  ${this.fixed?null:s}
1206
1203
  </div>
1207
- `;return K`
1204
+ `;return X`
1208
1205
  <div class="parent">
1209
- ${e?r:null}
1206
+ ${e?n:null}
1210
1207
  <div class="components">
1211
1208
  <slot></slot>
1212
1209
  </div>
1213
1210
  </div>
1214
- `}};sd.styles=[Qe.scrollbar,yt`
1211
+ `}};cd.styles=[ti.scrollbar,yt`
1215
1212
  :host {
1216
1213
  display: block;
1217
1214
  pointer-events: auto;
@@ -1267,7 +1264,7 @@ ${t}
1267
1264
  bim-label {
1268
1265
  pointer-events: none;
1269
1266
  }
1270
- `];let ts=sd;ln([W({type:String,reflect:!0})],ts.prototype,"icon");ln([W({type:String,reflect:!0})],ts.prototype,"label");ln([W({type:String,reflect:!0})],ts.prototype,"name");ln([W({type:Boolean,reflect:!0})],ts.prototype,"fixed");ln([W({type:Boolean,reflect:!0})],ts.prototype,"collapsed");var I0=Object.defineProperty,cn=(n,e,t,i)=>{for(var s=void 0,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=o(e,t,s)||s);return s&&I0(e,t,s),s};const nd=class extends bt{constructor(){super(...arguments),this.vertical=!1,this.onValueChange=new Event("change"),this._canEmitEvents=!1,this._value=document.createElement("bim-option"),this.onOptionClick=e=>{this._value=e.target,this.dispatchEvent(this.onValueChange);for(const t of this.children)t instanceof Bt&&(t.checked=t===e.target)}}get _options(){return[...this.querySelectorAll("bim-option")]}set value(e){const t=this.findOption(e);if(t){for(const i of this._options)i.checked=i===t;this._value=t,this._canEmitEvents&&this.dispatchEvent(this.onValueChange)}}get value(){return this._value.value}onSlotChange(e){const t=e.target.assignedElements();for(const i of t)i instanceof Bt&&(i.noMark=!0,i.removeEventListener("click",this.onOptionClick),i.addEventListener("click",this.onOptionClick))}findOption(e){return this._options.find(t=>t instanceof Bt?t.label===e||t.value===e:!1)}firstUpdated(){const e=[...this.children].find(t=>t instanceof Bt&&t.checked);e&&(this._value=e)}render(){return K`
1267
+ `];let ns=cd;hn([W({type:String,reflect:!0})],ns.prototype,"icon");hn([W({type:String,reflect:!0})],ns.prototype,"label");hn([W({type:String,reflect:!0})],ns.prototype,"name");hn([W({type:Boolean,reflect:!0})],ns.prototype,"fixed");hn([W({type:Boolean,reflect:!0})],ns.prototype,"collapsed");var T0=Object.defineProperty,dn=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&T0(e,t,s),s};const hd=class extends It{constructor(){super(...arguments),this.vertical=!1,this.onValueChange=new Event("change"),this._canEmitEvents=!1,this._value=document.createElement("bim-option"),this.onOptionClick=e=>{this._value=e.target,this.dispatchEvent(this.onValueChange);for(const t of this.children)t instanceof zt&&(t.checked=t===e.target)}}get _options(){return[...this.querySelectorAll("bim-option")]}set value(e){const t=this.findOption(e);if(t){for(const i of this._options)i.checked=i===t;this._value=t,this._canEmitEvents&&this.dispatchEvent(this.onValueChange)}}get value(){return this._value.value}onSlotChange(e){const t=e.target.assignedElements();for(const i of t)i instanceof zt&&(i.noMark=!0,i.removeEventListener("click",this.onOptionClick),i.addEventListener("click",this.onOptionClick))}findOption(e){return this._options.find(t=>t instanceof zt?t.label===e||t.value===e:!1)}firstUpdated(){const e=[...this.children].find(t=>t instanceof zt&&t.checked);e&&(this._value=e)}render(){return X`
1271
1268
  <bim-input
1272
1269
  .vertical=${this.vertical}
1273
1270
  .label=${this.label}
@@ -1275,7 +1272,7 @@ ${t}
1275
1272
  >
1276
1273
  <slot @slotchange=${this.onSlotChange}></slot>
1277
1274
  </bim-input>
1278
- `}};nd.styles=yt`
1275
+ `}};hd.styles=yt`
1279
1276
  :host {
1280
1277
  --bim-input--bgc: var(--bim-ui_bg-contrast-20);
1281
1278
  --bim-input--g: 0;
@@ -1292,7 +1289,7 @@ ${t}
1292
1289
  --bim-label--c: var(--bim-ui_main-contrast);
1293
1290
  background-color: var(--bim-ui_main-base);
1294
1291
  }
1295
- `;let es=nd;cn([W({type:String,reflect:!0})],es.prototype,"name");cn([W({type:String,reflect:!0})],es.prototype,"icon");cn([W({type:String,reflect:!0})],es.prototype,"label");cn([W({type:Boolean,reflect:!0})],es.prototype,"vertical");cn([qi()],es.prototype,"_value");const b0=()=>K`
1292
+ `;let rs=hd;dn([W({type:String,reflect:!0})],rs.prototype,"name");dn([W({type:String,reflect:!0})],rs.prototype,"icon");dn([W({type:String,reflect:!0})],rs.prototype,"label");dn([W({type:Boolean,reflect:!0})],rs.prototype,"vertical");dn([ts()],rs.prototype,"_value");const v0=()=>X`
1296
1293
  <style>
1297
1294
  div {
1298
1295
  display: flex;
@@ -1371,7 +1368,7 @@ ${t}
1371
1368
  </div>
1372
1369
  </div>
1373
1370
  </div>
1374
- `,C0=()=>K`
1371
+ `,w0=()=>X`
1375
1372
  <style>
1376
1373
  .loader {
1377
1374
  grid-area: Processing;
@@ -1420,16 +1417,16 @@ ${t}
1420
1417
  <div class="loader">
1421
1418
  <div class="loaderBar"></div>
1422
1419
  </div>
1423
- `;var y0=Object.defineProperty,_0=(n,e,t,i)=>{for(var s=void 0,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=o(e,t,s)||s);return s&&y0(e,t,s),s};const rd=class extends bt{constructor(){super(...arguments),this.column="",this.columnIndex=0,this.rowData={}}get data(){return this.column?this.rowData[this.column]:null}render(){return K`
1420
+ `;var A0=Object.defineProperty,R0=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&A0(e,t,s),s};const dd=class extends It{constructor(){super(...arguments),this.column="",this.columnIndex=0,this.rowData={}}get data(){return this.column?this.rowData[this.column]:null}render(){return X`
1424
1421
  <style>
1425
1422
  :host {
1426
1423
  grid-area: ${this.column??"unset"};
1427
1424
  }
1428
1425
  </style>
1429
1426
  <slot></slot>
1430
- `}};rd.styles=yt`
1427
+ `}};dd.styles=yt`
1431
1428
  :host {
1432
- padding: 0.25rem 1rem;
1429
+ padding: 0.375rem;
1433
1430
  display: flex;
1434
1431
  align-items: center;
1435
1432
  justify-content: center;
@@ -1458,10 +1455,10 @@ ${t}
1458
1455
  white-space: normal;
1459
1456
  text-align: center;
1460
1457
  }
1461
- `;let od=rd;_0([W({type:String,reflect:!0})],od.prototype,"column");var T0=Object.defineProperty,v0=(n,e,t,i)=>{for(var s=void 0,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=o(e,t,s)||s);return s&&T0(e,t,s),s};const ad=class extends bt{constructor(){super(...arguments),this._groups=[],this.data=[],this.table=this.closest("bim-table")}toggleGroups(e,t=!1){for(const i of this._groups)i.childrenHidden=typeof e>"u"?!i.childrenHidden:!e,t&&i.toggleChildren(e,t)}render(){return this._groups=[],K`
1458
+ `;let ud=dd;R0([W({type:String,reflect:!0})],ud.prototype,"column");var S0=Object.defineProperty,F0=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&S0(e,t,s),s};const fd=class extends It{constructor(){super(...arguments),this._groups=[],this.data=[],this.table=this.closest("bim-table")}toggleGroups(e,t=!1){for(const i of this._groups)i.childrenHidden=typeof e>"u"?!i.childrenHidden:!e,t&&i.toggleChildren(e,t)}render(){return this._groups=[],X`
1462
1459
  <slot></slot>
1463
1460
  ${this.data.map(e=>{const t=document.createElement("bim-table-group");return this._groups.push(t),t.table=this.table,t.data=e,t})}
1464
- `}};ad.styles=yt`
1461
+ `}};fd.styles=yt`
1465
1462
  :host {
1466
1463
  --bim-button--bgc: transparent;
1467
1464
  position: relative;
@@ -1476,8 +1473,8 @@ ${t}
1476
1473
  top: 0;
1477
1474
  bottom: 1.125rem;
1478
1475
  }
1479
- `;let ld=ad;v0([W({type:Array,attribute:!1})],ld.prototype,"data");var w0=Object.defineProperty,A0=(n,e,t,i)=>{for(var s=void 0,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=o(e,t,s)||s);return s&&w0(e,t,s),s};const cd=class extends bt{constructor(){super(...arguments),this.data={data:{}},this.childrenHidden=!0,this.table=this.closest("bim-table")}connectedCallback(){super.connectedCallback(),this.table&&this.table.expanded?this.childrenHidden=!1:this.childrenHidden=!0}toggleChildren(e,t=!1){this._children&&(this.childrenHidden=typeof e>"u"?!this.childrenHidden:!e,t&&this._children.toggleGroups(e,t))}render(){if(!this.table)throw new Error("TableGroup: parent table wasn't found!");const e=this.table.getGroupIndentation(this.data)??0,t=K`
1480
- ${this.table.noIndentation?null:K`
1476
+ `;let pd=fd;F0([W({type:Array,attribute:!1})],pd.prototype,"data");var O0=Object.defineProperty,x0=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&O0(e,t,s),s};const md=class extends It{constructor(){super(...arguments),this.data={data:{}},this.childrenHidden=!0,this.table=this.closest("bim-table")}connectedCallback(){super.connectedCallback(),this.table&&this.table.expanded?this.childrenHidden=!1:this.childrenHidden=!0}toggleChildren(e,t=!1){this._children&&(this.childrenHidden=typeof e>"u"?!this.childrenHidden:!e,t&&this._children.toggleGroups(e,t))}render(){if(!this.table)throw new Error("TableGroup: parent table wasn't found!");const e=this.table.getGroupIndentation(this.data)??0,t=X`
1477
+ ${this.table.noIndentation?null:X`
1481
1478
  <style>
1482
1479
  .branch-vertical {
1483
1480
  left: ${e+(this.table.selectableRows?1.9375:.5625)}rem;
@@ -1485,9 +1482,9 @@ ${t}
1485
1482
  </style>
1486
1483
  <div class="branch branch-vertical"></div>
1487
1484
  `}
1488
- `,i=document.createDocumentFragment();ji(t,i);let s=null;this.table.noIndentation||(s=document.createElement("div"),s.classList.add("branch","branch-horizontal"),s.style.left=`${e-1+(this.table.selectableRows?2.05:.5625)}rem`);let r=null;if(!this.table.noIndentation){const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("height","9.5"),l.setAttribute("width","7.5"),l.setAttribute("viewBox","0 0 4.6666672 7.3333333");const c=document.createElementNS("http://www.w3.org/2000/svg","path");c.setAttribute("d","m 1.7470835,6.9583848 2.5899999,-2.59 c 0.39,-0.39 0.39,-1.02 0,-1.41 L 1.7470835,0.36838483 c -0.63,-0.62000003 -1.71000005,-0.18 -1.71000005,0.70999997 v 5.17 c 0,0.9 1.08000005,1.34 1.71000005,0.71 z"),l.append(c);const h=document.createElementNS("http://www.w3.org/2000/svg","svg");h.setAttribute("height","6.5"),h.setAttribute("width","9.5"),h.setAttribute("viewBox","0 0 5.9111118 5.0175439");const d=document.createElementNS("http://www.w3.org/2000/svg","path");d.setAttribute("d","M -0.33616196,1.922522 2.253838,4.5125219 c 0.39,0.39 1.02,0.39 1.41,0 L 6.2538379,1.922522 c 0.6200001,-0.63 0.18,-1.71000007 -0.7099999,-1.71000007 H 0.37383804 c -0.89999997,0 -1.33999997,1.08000007 -0.71,1.71000007 z"),h.append(d),r=document.createElement("div"),r.addEventListener("click",u=>{u.stopPropagation(),this.toggleChildren()}),r.classList.add("caret"),r.style.left=`${(this.table.selectableRows?1.5:.125)+e}rem`,this.childrenHidden?r.append(l):r.append(h)}const o=document.createElement("bim-table-row");this.data.children&&!this.childrenHidden&&o.append(i),o.table=this.table,o.data=this.data.data,this.table.dispatchEvent(new CustomEvent("rowcreated",{detail:{row:o}})),r&&this.data.children&&o.append(r),e!==0&&(!this.data.children||this.childrenHidden)&&s&&o.append(s);let a;if(this.data.children){a=document.createElement("bim-table-children"),this._children=a,a.table=this.table,a.data=this.data.children;const l=document.createDocumentFragment();ji(t,l),a.append(l)}return K`
1485
+ `,i=document.createDocumentFragment();Zi(t,i);let s=null;this.table.noIndentation||(s=document.createElement("div"),s.classList.add("branch","branch-horizontal"),s.style.left=`${e-1+(this.table.selectableRows?2.05:.5625)}rem`);let n=null;if(!this.table.noIndentation){const l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("height","9.5"),l.setAttribute("width","7.5"),l.setAttribute("viewBox","0 0 4.6666672 7.3333333");const c=document.createElementNS("http://www.w3.org/2000/svg","path");c.setAttribute("d","m 1.7470835,6.9583848 2.5899999,-2.59 c 0.39,-0.39 0.39,-1.02 0,-1.41 L 1.7470835,0.36838483 c -0.63,-0.62000003 -1.71000005,-0.18 -1.71000005,0.70999997 v 5.17 c 0,0.9 1.08000005,1.34 1.71000005,0.71 z"),l.append(c);const h=document.createElementNS("http://www.w3.org/2000/svg","svg");h.setAttribute("height","6.5"),h.setAttribute("width","9.5"),h.setAttribute("viewBox","0 0 5.9111118 5.0175439");const d=document.createElementNS("http://www.w3.org/2000/svg","path");d.setAttribute("d","M -0.33616196,1.922522 2.253838,4.5125219 c 0.39,0.39 1.02,0.39 1.41,0 L 6.2538379,1.922522 c 0.6200001,-0.63 0.18,-1.71000007 -0.7099999,-1.71000007 H 0.37383804 c -0.89999997,0 -1.33999997,1.08000007 -0.71,1.71000007 z"),h.append(d),n=document.createElement("div"),n.addEventListener("click",u=>{u.stopPropagation(),this.toggleChildren()}),n.classList.add("caret"),n.style.left=`${(this.table.selectableRows?1.5:.125)+e}rem`,this.childrenHidden?n.append(l):n.append(h)}const o=document.createElement("bim-table-row");this.data.children&&!this.childrenHidden&&o.append(i),o.table=this.table,o.data=this.data.data,this.table.dispatchEvent(new CustomEvent("rowcreated",{detail:{row:o}})),n&&this.data.children&&o.append(n),e!==0&&(!this.data.children||this.childrenHidden)&&s&&o.append(s);let a;if(this.data.children){a=document.createElement("bim-table-children"),this._children=a,a.table=this.table,a.data=this.data.children;const l=document.createDocumentFragment();Zi(t,l),a.append(l)}return X`
1489
1486
  <div class="parent">${o} ${this.childrenHidden?null:a}</div>
1490
- `}};cd.styles=yt`
1487
+ `}};md.styles=yt`
1491
1488
  :host {
1492
1489
  position: relative;
1493
1490
  }
@@ -1528,15 +1525,15 @@ ${t}
1528
1525
  .caret svg {
1529
1526
  fill: var(--bim-ui_bg-contrast-60);
1530
1527
  }
1531
- `;let hd=cd;A0([W({type:Boolean,attribute:"children-hidden",reflect:!0})],hd.prototype,"childrenHidden");var R0=Object.defineProperty,is=(n,e,t,i)=>{for(var s=void 0,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=o(e,t,s)||s);return s&&R0(e,t,s),s};const dd=class extends bt{constructor(){super(...arguments),this.selected=!1,this.columns=[],this.hiddenColumns=[],this.data={},this.isHeader=!1,this.table=this.closest("bim-table"),this.onTableColumnsChange=()=>{this.table&&(this.columns=this.table.columns)},this.onTableColumnsHidden=()=>{this.table&&(this.hiddenColumns=this.table.hiddenColumns)},this._observer=new IntersectionObserver(e=>{this._intersecting=e[0].isIntersecting},{rootMargin:"36px"})}get _columnNames(){return this.columns.filter(e=>!this.hiddenColumns.includes(e.name)).map(e=>e.name)}get _columnWidths(){return this.columns.filter(e=>!this.hiddenColumns.includes(e.name)).map(e=>e.width)}get _isSelected(){var e;return(e=this.table)==null?void 0:e.selection.has(this.data)}onSelectionChange(e){if(!this.table)return;const t=e.target;this.selected=t.value,t.value?(this.table.selection.add(this.data),this.table.dispatchEvent(new CustomEvent("rowselected",{detail:{data:this.data}}))):(this.table.selection.delete(this.data),this.table.dispatchEvent(new CustomEvent("rowdeselected",{detail:{data:this.data}})))}connectedCallback(){super.connectedCallback(),this._observer.observe(this),this.table&&(this.columns=this.table.columns,this.hiddenColumns=this.table.hiddenColumns,this.table.addEventListener("columnschange",this.onTableColumnsChange),this.table.addEventListener("columnshidden",this.onTableColumnsHidden),this.toggleAttribute("selected",this._isSelected))}disconnectedCallback(){super.disconnectedCallback(),this._observer.unobserve(this),this.table&&(this.columns=[],this.hiddenColumns=[],this.table.removeEventListener("columnschange",this.onTableColumnsChange),this.table.removeEventListener("columnshidden",this.onTableColumnsHidden),this.toggleAttribute("selected",!1))}compute(){if(!this.table)throw new Error("TableRow: parent table wasn't found!");const e=this.table.getRowIndentation(this.data)??0,t=this.isHeader?this.data:this.table.computeRowDeclaration(this.data)??this.data,i=[];for(const s in t){if(this.hiddenColumns.includes(s))continue;const r=t[s];let o;if(typeof r=="string"||typeof r=="boolean"||typeof r=="number"?(o=document.createElement("bim-label"),o.textContent=String(r)):r instanceof HTMLElement?o=r:(o=document.createDocumentFragment(),ji(r,o)),!o)continue;const a=document.createElement("bim-table-cell");a.append(o),a.column=s,this._columnNames.indexOf(s)===0&&!this.isHeader&&(a.style.marginLeft=`${(this.table.noIndentation?0:e)+.125}rem`);const l=this._columnNames.indexOf(s);a.setAttribute("data-column-index",String(l)),a.toggleAttribute("data-no-indentation",l===0&&this.table.noIndentation),a.toggleAttribute("data-cell-header",this.isHeader),a.rowData=this.data,this.table.dispatchEvent(new CustomEvent("cellcreated",{detail:{cell:a}})),i.push(a)}return this.style.gridTemplateAreas=`"${this.table.selectableRows?"Selection":""} ${this._columnNames.join(" ")}"`,this.style.gridTemplateColumns=`${this.table.selectableRows?"1.6rem":""} ${this._columnWidths.join(" ")}`,K`
1532
- ${!this.isHeader&&this.table.selectableRows?K`<bim-checkbox
1528
+ `;let gd=md;x0([W({type:Boolean,attribute:"children-hidden",reflect:!0})],gd.prototype,"childrenHidden");var N0=Object.defineProperty,os=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&N0(e,t,s),s};const Ed=class extends It{constructor(){super(...arguments),this.selected=!1,this.columns=[],this.hiddenColumns=[],this.data={},this.isHeader=!1,this.table=this.closest("bim-table"),this.onTableColumnsChange=()=>{this.table&&(this.columns=this.table.columns)},this.onTableColumnsHidden=()=>{this.table&&(this.hiddenColumns=this.table.hiddenColumns)},this._observer=new IntersectionObserver(e=>{this._intersecting=e[0].isIntersecting},{rootMargin:"36px"})}get _columnNames(){return this.columns.filter(e=>!this.hiddenColumns.includes(e.name)).map(e=>e.name)}get _columnWidths(){return this.columns.filter(e=>!this.hiddenColumns.includes(e.name)).map(e=>e.width)}get _isSelected(){var e;return(e=this.table)==null?void 0:e.selection.has(this.data)}onSelectionChange(e){if(!this.table)return;const t=e.target;this.selected=t.value,t.value?(this.table.selection.add(this.data),this.table.dispatchEvent(new CustomEvent("rowselected",{detail:{data:this.data}}))):(this.table.selection.delete(this.data),this.table.dispatchEvent(new CustomEvent("rowdeselected",{detail:{data:this.data}})))}connectedCallback(){super.connectedCallback(),this._observer.observe(this),this.table&&(this.columns=this.table.columns,this.hiddenColumns=this.table.hiddenColumns,this.table.addEventListener("columnschange",this.onTableColumnsChange),this.table.addEventListener("columnshidden",this.onTableColumnsHidden),this.toggleAttribute("selected",this._isSelected))}disconnectedCallback(){super.disconnectedCallback(),this._observer.unobserve(this),this.table&&(this.columns=[],this.hiddenColumns=[],this.table.removeEventListener("columnschange",this.onTableColumnsChange),this.table.removeEventListener("columnshidden",this.onTableColumnsHidden),this.toggleAttribute("selected",!1))}compute(){if(!this.table)throw new Error("TableRow: parent table wasn't found!");const e=this.table.getRowIndentation(this.data)??0,t=this.isHeader?this.data:this.table.applyDataTransform(this.data)??this.data,i=[];for(const s in t){if(this.hiddenColumns.includes(s))continue;const n=t[s];let o;if(typeof n=="string"||typeof n=="boolean"||typeof n=="number"?(o=document.createElement("bim-label"),o.textContent=String(n)):n instanceof HTMLElement?o=n:(o=document.createDocumentFragment(),Zi(n,o)),!o)continue;const a=document.createElement("bim-table-cell");a.append(o),a.column=s,this._columnNames.indexOf(s)===0&&!this.isHeader&&(a.style.marginLeft=`${(this.table.noIndentation?0:e)+.75}rem`);const l=this._columnNames.indexOf(s);a.setAttribute("data-column-index",String(l)),a.toggleAttribute("data-no-indentation",l===0&&this.table.noIndentation),a.toggleAttribute("data-cell-header",this.isHeader),a.rowData=this.data,this.table.dispatchEvent(new CustomEvent("cellcreated",{detail:{cell:a}})),i.push(a)}return this.style.gridTemplateAreas=`"${this.table.selectableRows?"Selection":""} ${this._columnNames.join(" ")}"`,this.style.gridTemplateColumns=`${this.table.selectableRows?"1.6rem":""} ${this._columnWidths.join(" ")}`,X`
1529
+ ${!this.isHeader&&this.table.selectableRows?X`<bim-checkbox
1533
1530
  @change=${this.onSelectionChange}
1534
1531
  .checked=${this._isSelected}
1535
1532
  style="align-self: center; justify-self: center"
1536
1533
  ></bim-checkbox>`:null}
1537
1534
  ${i}
1538
1535
  <slot></slot>
1539
- `}render(){return K`${this._intersecting?this.compute():K``}`}};dd.styles=yt`
1536
+ `}render(){return X`${this._intersecting?this.compute():X``}`}};Ed.styles=yt`
1540
1537
  :host {
1541
1538
  position: relative;
1542
1539
  grid-area: Data;
@@ -1557,14 +1554,14 @@ ${t}
1557
1554
  var(--bim-ui_main-base) 10%
1558
1555
  );
1559
1556
  }
1560
- `;let yi=dd;is([W({type:Boolean,reflect:!0})],yi.prototype,"selected");is([W({attribute:!1})],yi.prototype,"columns");is([W({attribute:!1})],yi.prototype,"hiddenColumns");is([W({attribute:!1})],yi.prototype,"data");is([W({type:Boolean,attribute:"is-header",reflect:!0})],yi.prototype,"isHeader");is([qi()],yi.prototype,"_intersecting");var S0=Object.defineProperty,F0=Object.getOwnPropertyDescriptor,pe=(n,e,t,i)=>{for(var s=i>1?void 0:i?F0(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&S0(e,t,s),s};const ud=class extends bt{constructor(){super(...arguments),this._columnsChange=new Event("columnschange"),this._filteredData=[],this.headersHidden=!1,this.minColWidth="4rem",this._columns=[],this._textDelimiters={comma:",",tab:" "},this._queryString=null,this._data=[],this.expanded=!1,this.preserveStructureOnFilter=!1,this.indentationInText=!1,this.dataTransform={},this.selectableRows=!1,this.selection=new Set,this.noIndentation=!1,this.loading=!1,this._errorLoading=!1,this._onColumnsHidden=new Event("columnshidden"),this._hiddenColumns=[],this.loadingErrorElement=null,this._stringFilterFunction=(e,t)=>Object.values(t.data).some(i=>String(i).toLowerCase().includes(e.toLowerCase())),this._queryFilterFunction=(e,t)=>{let i=!1;const s=ia(e)??[];for(const r of s){if("queries"in r){i=!1;break}const{condition:o,value:a}=r;let{key:l}=r;if(l.startsWith("[")&&l.endsWith("]")){const c=l.replace("[","").replace("]","");l=c,i=Object.keys(t.data).filter(h=>h.includes(c)).map(h=>cc(t.data[h],o,a)).some(h=>h)}else i=cc(t.data[l],o,a);if(!i)break}return i}}set columns(e){const t=[];for(const i of e){const s=typeof i=="string"?{name:i,width:`minmax(${this.minColWidth}, 1fr)`}:i;t.push(s)}this._columns=t,this.computeMissingColumns(this.data),this.dispatchEvent(this._columnsChange)}get columns(){return this._columns}get _headerRowData(){const e={};for(const t of this.columns)if(typeof t=="string")e[t]=t;else{const{name:i}=t;e[i]=i}return e}get value(){return this._filteredData}set queryString(e){this.toggleAttribute("data-processing",!0),this._queryString=e&&e.trim()!==""?e.trim():null,this.updateFilteredData(),this.toggleAttribute("data-processing",!1)}get queryString(){return this._queryString}set data(e){this._data=e,this.updateFilteredData(),this.computeMissingColumns(e)&&(this.columns=this._columns)}get data(){return this._data}get dataAsync(){return new Promise(e=>{setTimeout(()=>{e(this.data)})})}set hiddenColumns(e){this._hiddenColumns=e,setTimeout(()=>{this.dispatchEvent(this._onColumnsHidden)})}get hiddenColumns(){return this._hiddenColumns}updateFilteredData(){this.queryString?(ia(this.queryString)?(this.filterFunction=this._queryFilterFunction,this._filteredData=this.filter(this.queryString)):(this.filterFunction=this._stringFilterFunction,this._filteredData=this.filter(this.queryString)),this.preserveStructureOnFilter&&(this._expandedBeforeFilter===void 0&&(this._expandedBeforeFilter=this.expanded),this.expanded=!0)):(this.preserveStructureOnFilter&&this._expandedBeforeFilter!==void 0&&(this.expanded=this._expandedBeforeFilter,this._expandedBeforeFilter=void 0),this._filteredData=this.data)}computeMissingColumns(e){let t=!1;for(const i of e){const{children:s,data:r}=i;for(const o in r)this._columns.map(a=>typeof a=="string"?a:a.name).includes(o)||(this._columns.push({name:o,width:`minmax(${this.minColWidth}, 1fr)`}),t=!0);if(s){const o=this.computeMissingColumns(s);o&&!t&&(t=o)}}return t}generateText(e="comma",t=this.value,i="",s=!0){const r=this._textDelimiters[e];let o="";const a=this.columns.map(l=>l.name);if(s){this.indentationInText&&(o+=`Indentation${r}`);const l=`${a.join(r)}
1561
- `;o+=l}for(const[l,c]of t.entries()){const{data:h,children:d}=c,u=this.indentationInText?`${i}${l+1}${r}`:"",f=a.map(m=>h[m]??""),p=`${u}${f.join(r)}
1562
- `;o+=p,d&&(o+=this.generateText(e,c.children,`${i}${l+1}.`,!1))}return o}get csv(){return this.generateText("comma")}get tsv(){return this.generateText("tab")}computeRowDeclaration(e){const t={};for(const i in e){const s=this.dataTransform[i];s?t[i]=s(e[i],e):t[i]=e[i]}return t}downloadData(e="BIM Table Data",t="json"){let i=null;if(t==="json"&&(i=new File([JSON.stringify(this.value,void 0,2)],`${e}.json`)),t==="csv"&&(i=new File([this.csv],`${e}.csv`)),t==="tsv"&&(i=new File([this.tsv],`${e}.tsv`)),!i)return;const s=document.createElement("a");s.href=URL.createObjectURL(i),s.download=i.name,s.click(),URL.revokeObjectURL(s.href)}getRowIndentation(e,t=this.value,i=0){for(const s of t){if(s.data===e)return i;if(s.children){const r=this.getRowIndentation(e,s.children,i+1);if(r!==null)return r}}return null}getGroupIndentation(e,t=this.value,i=0){for(const s of t){if(s===e)return i;if(s.children){const r=this.getGroupIndentation(e,s.children,i+1);if(r!==null)return r}}return null}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new Event("connected"))}disconnectedCallback(){super.disconnectedCallback(),this.dispatchEvent(new Event("disconnected"))}async loadData(e=!1){if(this._filteredData.length!==0&&!e||!this.loadFunction)return!1;this.loading=!0;try{const t=await this.loadFunction();return this.data=t,this.loading=!1,this._errorLoading=!1,!0}catch(t){return this.loading=!1,this._filteredData.length!==0||(t instanceof Error&&this.loadingErrorElement&&t.message.trim()!==""&&(this.loadingErrorElement.textContent=t.message),this._errorLoading=!0),!1}}filter(e,t=this.filterFunction??this._stringFilterFunction,i=this.data){const s=[];for(const r of i)if(t(e,r)){if(this.preserveStructureOnFilter){const o={data:r.data};if(r.children){const a=this.filter(e,t,r.children);a.length&&(o.children=a)}s.push(o)}else if(s.push({data:r.data}),r.children){const o=this.filter(e,t,r.children);s.push(...o)}}else if(r.children){const o=this.filter(e,t,r.children);this.preserveStructureOnFilter&&o.length?s.push({data:r.data,children:o}):s.push(...o)}return s}get _missingDataElement(){return this.querySelector("[slot='missing-data']")}render(){if(this.loading)return b0();if(this._errorLoading)return K`<slot name="error-loading"></slot>`;if(this._filteredData.length===0&&this._missingDataElement)return K`<slot name="missing-data"></slot>`;const e=document.createElement("bim-table-row");e.table=this,e.isHeader=!0,e.data=this._headerRowData,e.style.gridArea="Header",e.style.position="sticky",e.style.top="0",e.style.zIndex="5";const t=document.createElement("bim-table-children");return t.table=this,t.data=this.value,t.style.gridArea="Body",t.style.backgroundColor="transparent",K`
1557
+ `;let Ti=Ed;os([W({type:Boolean,reflect:!0})],Ti.prototype,"selected");os([W({attribute:!1})],Ti.prototype,"columns");os([W({attribute:!1})],Ti.prototype,"hiddenColumns");os([W({attribute:!1})],Ti.prototype,"data");os([W({type:Boolean,attribute:"is-header",reflect:!0})],Ti.prototype,"isHeader");os([ts()],Ti.prototype,"_intersecting");var P0=Object.defineProperty,L0=Object.getOwnPropertyDescriptor,ge=(r,e,t,i)=>{for(var s=i>1?void 0:i?L0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&P0(e,t,s),s};const bd=class extends It{constructor(){super(...arguments),this._columnsChange=new Event("columnschange"),this._filteredData=[],this.headersHidden=!1,this.minColWidth="4rem",this._columns=[],this._textDelimiters={comma:",",tab:" "},this._queryString=null,this._data=[],this.expanded=!1,this.preserveStructureOnFilter=!1,this.indentationInText=!1,this.dataTransform={},this.selectableRows=!1,this.selection=new Set,this.noIndentation=!1,this.loading=!1,this._errorLoading=!1,this._onColumnsHidden=new Event("columnshidden"),this._hiddenColumns=[],this.loadingErrorElement=null,this._stringFilterFunction=(e,t)=>Object.values(t.data).some(i=>String(i).toLowerCase().includes(e.toLowerCase())),this._queryFilterFunction=(e,t)=>{let i=!1;const s=na(e)??[];for(const n of s){if("queries"in n){i=!1;break}const{condition:o,value:a}=n;let{key:l}=n;if(l.startsWith("[")&&l.endsWith("]")){const c=l.replace("[","").replace("]","");l=c,i=Object.keys(t.data).filter(h=>h.includes(c)).map(h=>fc(t.data[h],o,a)).some(h=>h)}else i=fc(t.data[l],o,a);if(!i)break}return i}}set columns(e){const t=[];for(const i of e){const s=typeof i=="string"?{name:i,width:`minmax(${this.minColWidth}, 1fr)`}:i;t.push(s)}this._columns=t,this.computeMissingColumns(this.data),this.dispatchEvent(this._columnsChange)}get columns(){return this._columns}get _headerRowData(){const e={};for(const t of this.columns)if(typeof t=="string")e[t]=t;else{const{name:i}=t;e[i]=i}return e}get value(){return this._filteredData}set queryString(e){this.toggleAttribute("data-processing",!0),this._queryString=e&&e.trim()!==""?e.trim():null,this.updateFilteredData(),this.toggleAttribute("data-processing",!1)}get queryString(){return this._queryString}set data(e){this._data=e,this.updateFilteredData(),this.computeMissingColumns(e)&&(this.columns=this._columns)}get data(){return this._data}get dataAsync(){return new Promise(e=>{setTimeout(()=>{e(this.data)})})}set hiddenColumns(e){this._hiddenColumns=e,setTimeout(()=>{this.dispatchEvent(this._onColumnsHidden)})}get hiddenColumns(){return this._hiddenColumns}updateFilteredData(){this.queryString?(na(this.queryString)?(this.filterFunction=this._queryFilterFunction,this._filteredData=this.filter(this.queryString)):(this.filterFunction=this._stringFilterFunction,this._filteredData=this.filter(this.queryString)),this.preserveStructureOnFilter&&(this._expandedBeforeFilter===void 0&&(this._expandedBeforeFilter=this.expanded),this.expanded=!0)):(this.preserveStructureOnFilter&&this._expandedBeforeFilter!==void 0&&(this.expanded=this._expandedBeforeFilter,this._expandedBeforeFilter=void 0),this._filteredData=this.data)}computeMissingColumns(e){let t=!1;for(const i of e){const{children:s,data:n}=i;for(const o in n)this._columns.map(a=>typeof a=="string"?a:a.name).includes(o)||(this._columns.push({name:o,width:`minmax(${this.minColWidth}, 1fr)`}),t=!0);if(s){const o=this.computeMissingColumns(s);o&&!t&&(t=o)}}return t}generateText(e="comma",t=this.value,i="",s=!0){const n=this._textDelimiters[e];let o="";const a=this.columns.map(l=>l.name);if(s){this.indentationInText&&(o+=`Indentation${n}`);const l=`${a.join(n)}
1558
+ `;o+=l}for(const[l,c]of t.entries()){const{data:h,children:d}=c,u=this.indentationInText?`${i}${l+1}${n}`:"",f=a.map(m=>h[m]??""),p=`${u}${f.join(n)}
1559
+ `;o+=p,d&&(o+=this.generateText(e,c.children,`${i}${l+1}.`,!1))}return o}get csv(){return this.generateText("comma")}get tsv(){return this.generateText("tab")}applyDataTransform(e){const t={};for(const i of Object.keys(this.dataTransform)){const s=this.columns.find(n=>n.name===i);s&&s.forceDataTransform&&(i in e||(e[i]=""))}for(const i in e){const s=this.dataTransform[i];s?t[i]=s(e[i],e):t[i]=e[i]}return t}downloadData(e="BIM Table Data",t="json"){let i=null;if(t==="json"&&(i=new File([JSON.stringify(this.value,void 0,2)],`${e}.json`)),t==="csv"&&(i=new File([this.csv],`${e}.csv`)),t==="tsv"&&(i=new File([this.tsv],`${e}.tsv`)),!i)return;const s=document.createElement("a");s.href=URL.createObjectURL(i),s.download=i.name,s.click(),URL.revokeObjectURL(s.href)}getRowIndentation(e,t=this.value,i=0){for(const s of t){if(s.data===e)return i;if(s.children){const n=this.getRowIndentation(e,s.children,i+1);if(n!==null)return n}}return null}getGroupIndentation(e,t=this.value,i=0){for(const s of t){if(s===e)return i;if(s.children){const n=this.getGroupIndentation(e,s.children,i+1);if(n!==null)return n}}return null}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new Event("connected"))}disconnectedCallback(){super.disconnectedCallback(),this.dispatchEvent(new Event("disconnected"))}async loadData(e=!1){if(this._filteredData.length!==0&&!e||!this.loadFunction)return!1;this.loading=!0;try{const t=await this.loadFunction();return this.data=t,this.loading=!1,this._errorLoading=!1,!0}catch(t){return this.loading=!1,this._filteredData.length!==0||(t instanceof Error&&this.loadingErrorElement&&t.message.trim()!==""&&(this.loadingErrorElement.textContent=t.message),this._errorLoading=!0),!1}}filter(e,t=this.filterFunction??this._stringFilterFunction,i=this.data){const s=[];for(const n of i)if(t(e,n)){if(this.preserveStructureOnFilter){const o={data:n.data};if(n.children){const a=this.filter(e,t,n.children);a.length&&(o.children=a)}s.push(o)}else if(s.push({data:n.data}),n.children){const o=this.filter(e,t,n.children);s.push(...o)}}else if(n.children){const o=this.filter(e,t,n.children);this.preserveStructureOnFilter&&o.length?s.push({data:n.data,children:o}):s.push(...o)}return s}get _missingDataElement(){return this.querySelector("[slot='missing-data']")}render(){if(this.loading)return v0();if(this._errorLoading)return X`<slot name="error-loading"></slot>`;if(this._filteredData.length===0&&this._missingDataElement)return X`<slot name="missing-data"></slot>`;const e=document.createElement("bim-table-row");e.table=this,e.isHeader=!0,e.data=this._headerRowData,e.style.gridArea="Header",e.style.position="sticky",e.style.top="0",e.style.zIndex="5";const t=document.createElement("bim-table-children");return t.table=this,t.data=this.value,t.style.gridArea="Body",t.style.backgroundColor="transparent",X`
1563
1560
  <div class="parent">
1564
- ${this.headersHidden?null:e} ${C0()}
1561
+ ${this.headersHidden?null:e} ${w0()}
1565
1562
  <div style="overflow-x: hidden; grid-area: Body">${t}</div>
1566
1563
  </div>
1567
- `}};ud.styles=[Qe.scrollbar,yt`
1564
+ `}};bd.styles=[ti.scrollbar,yt`
1568
1565
  :host {
1569
1566
  position: relative;
1570
1567
  overflow: auto;
@@ -1601,7 +1598,7 @@ ${t}
1601
1598
  flex-wrap: wrap;
1602
1599
  margin-bottom: 0.5rem;
1603
1600
  }
1604
- `];let ae=ud;pe([qi()],ae.prototype,"_filteredData",2);pe([W({type:Boolean,attribute:"headers-hidden",reflect:!0})],ae.prototype,"headersHidden",2);pe([W({type:String,attribute:"min-col-width",reflect:!0})],ae.prototype,"minColWidth",2);pe([W({type:Array,attribute:!1})],ae.prototype,"columns",1);pe([W({type:Array,attribute:!1})],ae.prototype,"data",1);pe([W({type:Boolean,reflect:!0})],ae.prototype,"expanded",2);pe([W({type:Boolean,reflect:!0,attribute:"selectable-rows"})],ae.prototype,"selectableRows",2);pe([W({attribute:!1})],ae.prototype,"selection",2);pe([W({type:Boolean,attribute:"no-indentation",reflect:!0})],ae.prototype,"noIndentation",2);pe([W({type:Boolean,reflect:!0})],ae.prototype,"loading",2);pe([qi()],ae.prototype,"_errorLoading",2);var O0=Object.defineProperty,x0=Object.getOwnPropertyDescriptor,Gr=(n,e,t,i)=>{for(var s=i>1?void 0:i?x0(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&O0(e,t,s),s};const fd=class extends bt{constructor(){super(...arguments),this._defaultName="__unnamed__",this.name=this._defaultName,this._hidden=!1}set hidden(e){this._hidden=e,this.dispatchEvent(new Event("hiddenchange"))}get hidden(){return this._hidden}connectedCallback(){super.connectedCallback();const{parentElement:e}=this;if(e&&this.name===this._defaultName){const t=[...e.children].indexOf(this);this.name=`${this._defaultName}${t}`}}render(){return K` <slot></slot> `}};fd.styles=yt`
1601
+ `];let ce=bd;ge([ts()],ce.prototype,"_filteredData",2);ge([W({type:Boolean,attribute:"headers-hidden",reflect:!0})],ce.prototype,"headersHidden",2);ge([W({type:String,attribute:"min-col-width",reflect:!0})],ce.prototype,"minColWidth",2);ge([W({type:Array,attribute:!1})],ce.prototype,"columns",1);ge([W({type:Array,attribute:!1})],ce.prototype,"data",1);ge([W({type:Boolean,reflect:!0})],ce.prototype,"expanded",2);ge([W({type:Boolean,reflect:!0,attribute:"selectable-rows"})],ce.prototype,"selectableRows",2);ge([W({attribute:!1})],ce.prototype,"selection",2);ge([W({type:Boolean,attribute:"no-indentation",reflect:!0})],ce.prototype,"noIndentation",2);ge([W({type:Boolean,reflect:!0})],ce.prototype,"loading",2);ge([ts()],ce.prototype,"_errorLoading",2);var M0=Object.defineProperty,D0=Object.getOwnPropertyDescriptor,Wr=(r,e,t,i)=>{for(var s=i>1?void 0:i?D0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&M0(e,t,s),s};const Id=class extends It{constructor(){super(...arguments),this._defaultName="__unnamed__",this.name=this._defaultName,this._hidden=!1}set hidden(e){this._hidden=e,this.dispatchEvent(new Event("hiddenchange"))}get hidden(){return this._hidden}connectedCallback(){super.connectedCallback();const{parentElement:e}=this;if(e&&this.name===this._defaultName){const t=[...e.children].indexOf(this);this.name=`${this._defaultName}${t}`}}render(){return X` <slot></slot> `}};Id.styles=yt`
1605
1602
  :host {
1606
1603
  display: block;
1607
1604
  height: 100%;
@@ -1610,14 +1607,14 @@ ${t}
1610
1607
  :host([hidden]) {
1611
1608
  display: none;
1612
1609
  }
1613
- `;let Jt=fd;Gr([W({type:String,reflect:!0})],Jt.prototype,"name",2);Gr([W({type:String,reflect:!0})],Jt.prototype,"label",2);Gr([W({type:String,reflect:!0})],Jt.prototype,"icon",2);Gr([W({type:Boolean,reflect:!0})],Jt.prototype,"hidden",1);var N0=Object.defineProperty,P0=Object.getOwnPropertyDescriptor,ss=(n,e,t,i)=>{for(var s=i>1?void 0:i?P0(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&N0(e,t,s),s};const pd=class extends bt{constructor(){super(...arguments),this._switchers=[],this.bottom=!1,this.switchersHidden=!1,this.floating=!1,this.switchersFull=!1,this.onTabHiddenChange=e=>{const t=e.target;t instanceof Jt&&!t.hidden&&(t.removeEventListener("hiddenchange",this.onTabHiddenChange),this.tab=t.name,t.addEventListener("hiddenchange",this.onTabHiddenChange))}}set tab(e){this._tab=e;const t=[...this.children],i=t.find(s=>s instanceof Jt&&s.name===e);for(const s of t){if(!(s instanceof Jt))continue;s.hidden=i!==s;const r=this.getTabSwitcher(s.name);r&&r.toggleAttribute("data-active",!s.hidden)}}get tab(){return this._tab}getTabSwitcher(e){return this._switchers.find(t=>t.getAttribute("data-name")===e)}createSwitchers(){this._switchers=[];for(const e of this.children){if(!(e instanceof Jt))continue;const t=document.createElement("div");t.addEventListener("click",()=>{this.tab===e.name?this.toggleAttribute("tab",!1):this.tab=e.name}),t.setAttribute("data-name",e.name),t.className="switcher";const i=document.createElement("bim-label");i.textContent=e.label??"",i.icon=e.icon,t.append(i),this._switchers.push(t)}}onSlotChange(e){this.createSwitchers();const t=e.target.assignedElements(),i=t.find(s=>s instanceof Jt?this.tab?s.name===this.tab:!s.hidden:!1);i&&i instanceof Jt&&(this.tab=i.name);for(const s of t){if(!(s instanceof Jt)){s.remove();continue}s.removeEventListener("hiddenchange",this.onTabHiddenChange),i!==s&&(s.hidden=!0),s.addEventListener("hiddenchange",this.onTabHiddenChange)}}render(){return K`
1610
+ `;let ee=Id;Wr([W({type:String,reflect:!0})],ee.prototype,"name",2);Wr([W({type:String,reflect:!0})],ee.prototype,"label",2);Wr([W({type:String,reflect:!0})],ee.prototype,"icon",2);Wr([W({type:Boolean,reflect:!0})],ee.prototype,"hidden",1);var U0=Object.defineProperty,k0=Object.getOwnPropertyDescriptor,as=(r,e,t,i)=>{for(var s=i>1?void 0:i?k0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&U0(e,t,s),s};const Cd=class extends It{constructor(){super(...arguments),this._switchers=[],this.bottom=!1,this.switchersHidden=!1,this.floating=!1,this.switchersFull=!1,this.onTabHiddenChange=e=>{const t=e.target;t instanceof ee&&!t.hidden&&(t.removeEventListener("hiddenchange",this.onTabHiddenChange),this.tab=t.name,t.addEventListener("hiddenchange",this.onTabHiddenChange))}}set tab(e){this._tab=e;const t=[...this.children],i=t.find(s=>s instanceof ee&&s.name===e);for(const s of t){if(!(s instanceof ee))continue;s.hidden=i!==s;const n=this.getTabSwitcher(s.name);n&&n.toggleAttribute("data-active",!s.hidden)}}get tab(){return this._tab}getTabSwitcher(e){return this._switchers.find(t=>t.getAttribute("data-name")===e)}createSwitchers(){this._switchers=[];for(const e of this.children){if(!(e instanceof ee))continue;const t=document.createElement("div");t.addEventListener("click",()=>{this.tab===e.name?this.toggleAttribute("tab",!1):this.tab=e.name}),t.setAttribute("data-name",e.name),t.className="switcher";const i=document.createElement("bim-label");i.textContent=e.label??"",i.icon=e.icon,t.append(i),this._switchers.push(t)}}onSlotChange(e){this.createSwitchers();const t=e.target.assignedElements(),i=t.find(s=>s instanceof ee?this.tab?s.name===this.tab:!s.hidden:!1);i&&i instanceof ee&&(this.tab=i.name);for(const s of t){if(!(s instanceof ee)){s.remove();continue}s.removeEventListener("hiddenchange",this.onTabHiddenChange),i!==s&&(s.hidden=!0),s.addEventListener("hiddenchange",this.onTabHiddenChange)}}render(){return X`
1614
1611
  <div class="parent">
1615
1612
  <div class="switchers">${this._switchers}</div>
1616
1613
  <div class="content">
1617
1614
  <slot @slotchange=${this.onSlotChange}></slot>
1618
1615
  </div>
1619
1616
  </div>
1620
- `}};pd.styles=[Qe.scrollbar,yt`
1617
+ `}};Cd.styles=[ti.scrollbar,yt`
1621
1618
  * {
1622
1619
  box-sizing: border-box;
1623
1620
  }
@@ -1728,32 +1725,32 @@ ${t}
1728
1725
  border-radius: var(--bim-ui_size-2xs);
1729
1726
  background-color: var(--bim-ui_bg-base);
1730
1727
  }
1731
- `];let _i=pd;ss([qi()],_i.prototype,"_switchers",2);ss([W({type:Boolean,reflect:!0})],_i.prototype,"bottom",2);ss([W({type:Boolean,attribute:"switchers-hidden",reflect:!0})],_i.prototype,"switchersHidden",2);ss([W({type:Boolean,reflect:!0})],_i.prototype,"floating",2);ss([W({type:String,reflect:!0})],_i.prototype,"tab",1);ss([W({type:Boolean,attribute:"switchers-full",reflect:!0})],_i.prototype,"switchersFull",2);/**
1728
+ `];let vi=Cd;as([ts()],vi.prototype,"_switchers",2);as([W({type:Boolean,reflect:!0})],vi.prototype,"bottom",2);as([W({type:Boolean,attribute:"switchers-hidden",reflect:!0})],vi.prototype,"switchersHidden",2);as([W({type:Boolean,reflect:!0})],vi.prototype,"floating",2);as([W({type:String,reflect:!0})],vi.prototype,"tab",1);as([W({type:Boolean,attribute:"switchers-full",reflect:!0})],vi.prototype,"switchersFull",2);/**
1732
1729
  * @license
1733
1730
  * Copyright 2018 Google LLC
1734
1731
  * SPDX-License-Identifier: BSD-3-Clause
1735
- */const hc=n=>n??Mt;var L0=Object.defineProperty,M0=Object.getOwnPropertyDescriptor,Ne=(n,e,t,i)=>{for(var s=i>1?void 0:i?M0(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&L0(e,t,s),s};const md=class extends bt{constructor(){super(...arguments),this._inputTypes=["date","datetime-local","email","month","password","search","tel","text","time","url","week","area"],this.value="",this.vertical=!1,this._type="text",this.onValueChange=new Event("input")}set type(e){this._inputTypes.includes(e)&&(this._type=e)}get type(){return this._type}get query(){return ia(this.value)}onInputChange(e){e.stopPropagation();const t=e.target;clearTimeout(this._debounceTimeoutID),this._debounceTimeoutID=setTimeout(()=>{this.value=t.value,this.dispatchEvent(this.onValueChange)},this.debounce)}focus(){setTimeout(()=>{var e;const t=(e=this.shadowRoot)==null?void 0:e.querySelector("input");t==null||t.focus()})}render(){return K`
1732
+ */const pc=r=>r??Dt;var B0=Object.defineProperty,z0=Object.getOwnPropertyDescriptor,Ue=(r,e,t,i)=>{for(var s=i>1?void 0:i?z0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&B0(e,t,s),s};const yd=class extends It{constructor(){super(...arguments),this._inputTypes=["date","datetime-local","email","month","password","search","tel","text","time","url","week","area"],this.value="",this.vertical=!1,this._type="text",this.onValueChange=new Event("input")}set type(e){this._inputTypes.includes(e)&&(this._type=e)}get type(){return this._type}get query(){return na(this.value)}onInputChange(e){e.stopPropagation();const t=e.target;clearTimeout(this._debounceTimeoutID),this._debounceTimeoutID=setTimeout(()=>{this.value=t.value,this.dispatchEvent(this.onValueChange)},this.debounce)}focus(){setTimeout(()=>{var e;const t=(e=this.shadowRoot)==null?void 0:e.querySelector("input");t==null||t.focus()})}render(){return X`
1736
1733
  <bim-input
1737
1734
  .name=${this.name}
1738
1735
  .icon=${this.icon}
1739
1736
  .label=${this.label}
1740
1737
  .vertical=${this.vertical}
1741
1738
  >
1742
- ${this.type==="area"?K` <textarea
1739
+ ${this.type==="area"?X` <textarea
1743
1740
  aria-label=${this.label||this.name||"Text Input"}
1744
1741
  .value=${this.value}
1745
1742
  .rows=${this.rows??5}
1746
- placeholder=${hc(this.placeholder)}
1743
+ placeholder=${pc(this.placeholder)}
1747
1744
  @input=${this.onInputChange}
1748
- ></textarea>`:K` <input
1745
+ ></textarea>`:X` <input
1749
1746
  aria-label=${this.label||this.name||"Text Input"}
1750
1747
  .type=${this.type}
1751
1748
  .value=${this.value}
1752
- placeholder=${hc(this.placeholder)}
1749
+ placeholder=${pc(this.placeholder)}
1753
1750
  @input=${this.onInputChange}
1754
1751
  />`}
1755
1752
  </bim-input>
1756
- `}};md.styles=[Qe.scrollbar,yt`
1753
+ `}};yd.styles=[ti.scrollbar,yt`
1757
1754
  :host {
1758
1755
  --bim-input--bgc: var(--bim-ui_bg-contrast-20);
1759
1756
  flex: 1;
@@ -1789,7 +1786,7 @@ ${t}
1789
1786
  /* :host([disabled]) {
1790
1787
  --bim-input--bgc: var(--bim-ui_bg-contrast-20);
1791
1788
  } */
1792
- `];let Te=md;Ne([W({type:String,reflect:!0})],Te.prototype,"icon",2);Ne([W({type:String,reflect:!0})],Te.prototype,"label",2);Ne([W({type:String,reflect:!0})],Te.prototype,"name",2);Ne([W({type:String,reflect:!0})],Te.prototype,"placeholder",2);Ne([W({type:String,reflect:!0})],Te.prototype,"value",2);Ne([W({type:Boolean,reflect:!0})],Te.prototype,"vertical",2);Ne([W({type:Number,reflect:!0})],Te.prototype,"debounce",2);Ne([W({type:Number,reflect:!0})],Te.prototype,"rows",2);Ne([W({type:String,reflect:!0})],Te.prototype,"type",1);var D0=Object.defineProperty,U0=Object.getOwnPropertyDescriptor,gd=(n,e,t,i)=>{for(var s=i>1?void 0:i?U0(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&D0(e,t,s),s};const Ed=class extends bt{constructor(){super(...arguments),this.rows=2,this._vertical=!1}set vertical(e){this._vertical=e,this.updateChildren()}get vertical(){return this._vertical}updateChildren(){const e=this.children;for(const t of e)this.vertical?t.setAttribute("label-hidden",""):t.removeAttribute("label-hidden")}render(){return K`
1789
+ `];let Re=yd;Ue([W({type:String,reflect:!0})],Re.prototype,"icon",2);Ue([W({type:String,reflect:!0})],Re.prototype,"label",2);Ue([W({type:String,reflect:!0})],Re.prototype,"name",2);Ue([W({type:String,reflect:!0})],Re.prototype,"placeholder",2);Ue([W({type:String,reflect:!0})],Re.prototype,"value",2);Ue([W({type:Boolean,reflect:!0})],Re.prototype,"vertical",2);Ue([W({type:Number,reflect:!0})],Re.prototype,"debounce",2);Ue([W({type:Number,reflect:!0})],Re.prototype,"rows",2);Ue([W({type:String,reflect:!0})],Re.prototype,"type",1);var $0=Object.defineProperty,V0=Object.getOwnPropertyDescriptor,_d=(r,e,t,i)=>{for(var s=i>1?void 0:i?V0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&$0(e,t,s),s};const Td=class extends It{constructor(){super(...arguments),this.rows=2,this._vertical=!1}set vertical(e){this._vertical=e,this.updateChildren()}get vertical(){return this._vertical}updateChildren(){const e=this.children;for(const t of e)this.vertical?t.setAttribute("label-hidden",""):t.removeAttribute("label-hidden")}render(){return X`
1793
1790
  <style>
1794
1791
  .parent {
1795
1792
  grid-auto-flow: ${this.vertical?"row":"column"};
@@ -1799,7 +1796,7 @@ ${t}
1799
1796
  <div class="parent">
1800
1797
  <slot @slotchange=${this.updateChildren}></slot>
1801
1798
  </div>
1802
- `}};Ed.styles=yt`
1799
+ `}};Td.styles=yt`
1803
1800
  .parent {
1804
1801
  display: grid;
1805
1802
  gap: 0.25rem;
@@ -1812,14 +1809,14 @@ ${t}
1812
1809
  ::slotted(bim-button) {
1813
1810
  --bim-label--c: var(--bim-ui_bg-contrast-80);
1814
1811
  }
1815
- `;let Yr=Ed;gd([W({type:Number,reflect:!0})],Yr.prototype,"rows",2);gd([W({type:Boolean,reflect:!0})],Yr.prototype,"vertical",1);var k0=Object.defineProperty,B0=Object.getOwnPropertyDescriptor,Wr=(n,e,t,i)=>{for(var s=i>1?void 0:i?B0(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&k0(e,t,s),s};const Id=class extends bt{constructor(){super(...arguments),this._vertical=!1,this._labelHidden=!1}set vertical(e){this._vertical=e,this.updateChildren()}get vertical(){return this._vertical}set labelHidden(e){this._labelHidden=e,this.updateChildren()}get labelHidden(){return this._labelHidden}updateChildren(){const e=this.children;for(const t of e)t instanceof Yr&&(t.vertical=this.vertical),t.toggleAttribute("label-hidden",this.vertical)}render(){return K`
1812
+ `;let jr=Td;_d([W({type:Number,reflect:!0})],jr.prototype,"rows",2);_d([W({type:Boolean,reflect:!0})],jr.prototype,"vertical",1);var G0=Object.defineProperty,H0=Object.getOwnPropertyDescriptor,Xr=(r,e,t,i)=>{for(var s=i>1?void 0:i?H0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&G0(e,t,s),s};const vd=class extends It{constructor(){super(...arguments),this._vertical=!1,this._labelHidden=!1}set vertical(e){this._vertical=e,this.updateChildren()}get vertical(){return this._vertical}set labelHidden(e){this._labelHidden=e,this.updateChildren()}get labelHidden(){return this._labelHidden}updateChildren(){const e=this.children;for(const t of e)t instanceof jr&&(t.vertical=this.vertical),t.toggleAttribute("label-hidden",this.vertical)}render(){return X`
1816
1813
  <div class="parent">
1817
1814
  <div class="children">
1818
1815
  <slot @slotchange=${this.updateChildren}></slot>
1819
1816
  </div>
1820
- ${!this.labelHidden&&(this.label||this.icon)?K`<bim-label .icon=${this.icon}>${this.label}</bim-label>`:null}
1817
+ ${!this.labelHidden&&(this.label||this.icon)?X`<bim-label .icon=${this.icon}>${this.label}</bim-label>`:null}
1821
1818
  </div>
1822
- `}};Id.styles=yt`
1819
+ `}};vd.styles=yt`
1823
1820
  :host {
1824
1821
  --bim-label--fz: var(--bim-ui_size-xs);
1825
1822
  --bim-label--c: var(--bim-ui_bg-contrast-60);
@@ -1863,11 +1860,11 @@ ${t}
1863
1860
  :host([vertical]) .children {
1864
1861
  flex-direction: column;
1865
1862
  }
1866
- `;let ns=Id;Wr([W({type:String,reflect:!0})],ns.prototype,"label",2);Wr([W({type:String,reflect:!0})],ns.prototype,"icon",2);Wr([W({type:Boolean,reflect:!0})],ns.prototype,"vertical",1);Wr([W({type:Boolean,attribute:"label-hidden",reflect:!0})],ns.prototype,"labelHidden",1);const bd=class Et{static set config(e){this._config={...Et._config,...e}}static get config(){return Et._config}static addGlobalStyles(){let e=document.querySelector("style[id='bim-ui']");if(e)return;e=document.createElement("style"),e.id="bim-ui",e.textContent=Qe.globalStyles.cssText;const t=document.head.firstChild;t?document.head.insertBefore(e,t):document.head.append(e)}static defineCustomElement(e,t){customElements.get(e)||customElements.define(e,t)}static registerComponents(){Et.init()}static init(){Et.addGlobalStyles(),Et.defineCustomElement("bim-button",qg),Et.defineCustomElement("bim-checkbox",Qi),Et.defineCustomElement("bim-color-input",bi),Et.defineCustomElement("bim-context-menu",Xh),Et.defineCustomElement("bim-dropdown",xe),Et.defineCustomElement("bim-grid",Oa),Et.defineCustomElement("bim-icon",h0),Et.defineCustomElement("bim-input",rn),Et.defineCustomElement("bim-label",Ji),Et.defineCustomElement("bim-number-input",Zt),Et.defineCustomElement("bim-option",Bt),Et.defineCustomElement("bim-panel",Ci),Et.defineCustomElement("bim-panel-section",ts),Et.defineCustomElement("bim-selector",es),Et.defineCustomElement("bim-table",ae),Et.defineCustomElement("bim-tabs",_i),Et.defineCustomElement("bim-tab",Jt),Et.defineCustomElement("bim-table-cell",od),Et.defineCustomElement("bim-table-children",ld),Et.defineCustomElement("bim-table-group",hd),Et.defineCustomElement("bim-table-row",yi),Et.defineCustomElement("bim-text-input",Te),Et.defineCustomElement("bim-toolbar",jr),Et.defineCustomElement("bim-toolbar-group",Yr),Et.defineCustomElement("bim-toolbar-section",ns),Et.defineCustomElement("bim-viewport",_d)}static newRandomId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let t="";for(let i=0;i<10;i++){const s=Math.floor(Math.random()*e.length);t+=e.charAt(s)}return t}};bd._config={sectionLabelOnVerticalToolbar:!1};let z0=bd;var V0=Object.defineProperty,$0=Object.getOwnPropertyDescriptor,xa=(n,e,t,i)=>{for(var s=i>1?void 0:i?$0(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&V0(e,t,s),s};const Cd=class extends bt{constructor(){super(...arguments),this.labelsHidden=!1,this._vertical=!1,this._hidden=!1}set vertical(e){this._vertical=e,this.updateSections()}get vertical(){return this._vertical}set hidden(e){this._hidden=e,this.dispatchEvent(new Event("hiddenchange"))}get hidden(){return this._hidden}updateSections(){const e=this.children;for(const t of e)t instanceof ns&&(t.labelHidden=this.vertical&&!z0.config.sectionLabelOnVerticalToolbar,t.vertical=this.vertical)}render(){return K`
1863
+ `;let ls=vd;Xr([W({type:String,reflect:!0})],ls.prototype,"label",2);Xr([W({type:String,reflect:!0})],ls.prototype,"icon",2);Xr([W({type:Boolean,reflect:!0})],ls.prototype,"vertical",1);Xr([W({type:Boolean,attribute:"label-hidden",reflect:!0})],ls.prototype,"labelHidden",1);var Y0=Object.defineProperty,W0=Object.getOwnPropertyDescriptor,Pa=(r,e,t,i)=>{for(var s=i>1?void 0:i?W0(e,t):e,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=(i?o(e,t,s):o(s))||s);return i&&s&&Y0(e,t,s),s};const wd=class extends It{constructor(){super(...arguments),this.labelsHidden=!1,this._vertical=!1,this._hidden=!1}set vertical(e){this._vertical=e,this.updateSections()}get vertical(){return this._vertical}set hidden(e){this._hidden=e,this.dispatchEvent(new Event("hiddenchange"))}get hidden(){return this._hidden}updateSections(){const e=this.children;for(const t of e)t instanceof ls&&(t.labelHidden=this.vertical&&!r0.config.sectionLabelOnVerticalToolbar,t.vertical=this.vertical)}render(){return X`
1867
1864
  <div class="parent">
1868
1865
  <slot @slotchange=${this.updateSections}></slot>
1869
1866
  </div>
1870
- `}};Cd.styles=yt`
1867
+ `}};wd.styles=yt`
1871
1868
  :host {
1872
1869
  --bim-button--bgc: transparent;
1873
1870
  background-color: var(--bim-ui_bg-base);
@@ -1904,11 +1901,11 @@ ${t}
1904
1901
  border-bottom: 1px solid var(--bim-ui_bg-contrast-20);
1905
1902
  border-right: none;
1906
1903
  }
1907
- `;let jr=Cd;xa([W({type:String,reflect:!0})],jr.prototype,"icon",2);xa([W({type:Boolean,attribute:"labels-hidden",reflect:!0})],jr.prototype,"labelsHidden",2);xa([W({type:Boolean,reflect:!0})],jr.prototype,"vertical",1);var H0=Object.defineProperty,G0=(n,e,t,i)=>{for(var s=void 0,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=o(e,t,s)||s);return s&&H0(e,t,s),s};const yd=class extends bt{constructor(){super(),this._onResize=new Event("resize"),new ResizeObserver(()=>{setTimeout(()=>{this.dispatchEvent(this._onResize)})}).observe(this)}render(){return K`
1904
+ `;let Zr=wd;Pa([W({type:String,reflect:!0})],Zr.prototype,"icon",2);Pa([W({type:Boolean,attribute:"labels-hidden",reflect:!0})],Zr.prototype,"labelsHidden",2);Pa([W({type:Boolean,reflect:!0})],Zr.prototype,"vertical",1);var j0=Object.defineProperty,X0=(r,e,t,i)=>{for(var s=void 0,n=r.length-1,o;n>=0;n--)(o=r[n])&&(s=o(e,t,s)||s);return s&&j0(e,t,s),s};const Ad=class extends It{constructor(){super(),this._onResize=new Event("resize"),new ResizeObserver(()=>{setTimeout(()=>{this.dispatchEvent(this._onResize)})}).observe(this)}render(){return X`
1908
1905
  <div class="parent">
1909
1906
  <slot></slot>
1910
1907
  </div>
1911
- `}};yd.styles=yt`
1908
+ `}};Ad.styles=yt`
1912
1909
  :host {
1913
1910
  display: grid;
1914
1911
  min-width: 0;
@@ -1920,50 +1917,50 @@ ${t}
1920
1917
  overflow: hidden;
1921
1918
  position: relative;
1922
1919
  }
1923
- `;let _d=yd;G0([W({type:String,reflect:!0})],_d.prototype,"name");/**
1920
+ `;let Rd=Ad;X0([W({type:String,reflect:!0})],Rd.prototype,"name");/**
1924
1921
  * @license
1925
1922
  * Copyright 2018 Google LLC
1926
1923
  * SPDX-License-Identifier: BSD-3-Clause
1927
- */const Td="important",Y0=" !"+Td,He=Ch(class extends yh{constructor(n){var e;if(super(n),n.type!==bh.ATTRIBUTE||n.name!=="style"||((e=n.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(n){return Object.keys(n).reduce((e,t)=>{const i=n[t];return i==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(n,[e]){const{style:t}=n.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?t.removeProperty(i):t[i]=null);for(const i in e){const s=e[i];if(s!=null){this.ft.add(i);const r=typeof s=="string"&&s.endsWith(Y0);i.includes("-")||r?t.setProperty(i,r?s.slice(0,-11):s,r?Td:""):t[i]=s}}return Ei}});/**
1924
+ */const Sd="important",Z0=" !"+Sd,xe=wh(class extends Ah{constructor(r){var e;if(super(r),r.type!==vh.ATTRIBUTE||r.name!=="style"||((e=r.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce((e,t)=>{const i=r[t];return i==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(r,[e]){const{style:t}=r.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?t.removeProperty(i):t[i]=null);for(const i in e){const s=e[i];if(s!=null){this.ft.add(i);const n=typeof s=="string"&&s.endsWith(Z0);i.includes("-")||n?t.setProperty(i,n?s.slice(0,-11):s,n?Sd:""):t[i]=s}}return Ii}});/**
1928
1925
  * @license
1929
1926
  * Copyright 2017 Google LLC
1930
1927
  * SPDX-License-Identifier: BSD-3-Clause
1931
- */const Ps=globalThis,cr=Ps.trustedTypes,dc=cr?cr.createPolicy("lit-html",{createHTML:n=>n}):void 0,vd="$lit$",ze=`lit$${Math.random().toFixed(9).slice(2)}$`,wd="?"+ze,W0=`<${wd}>`,Ii=document,hr=()=>Ii.createComment(""),Xs=n=>n===null||typeof n!="object"&&typeof n!="function",Na=Array.isArray,j0=n=>Na(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",Ao=`[
1932
- \f\r]`,vs=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,uc=/-->/g,fc=/>/g,ri=RegExp(`>|${Ao}(?:([^\\s"'>=/]+)(${Ao}*=${Ao}*(?:[^
1933
- \f\r"'\`<>=]|("|')|))|$)`,"g"),pc=/'/g,mc=/"/g,Ad=/^(?:script|style|textarea|title)$/i,Zs=Symbol.for("lit-noChange"),kt=Symbol.for("lit-nothing"),gc=new WeakMap,ci=Ii.createTreeWalker(Ii,129);function Rd(n,e){if(!Na(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return dc!==void 0?dc.createHTML(e):e}const X0=(n,e)=>{const t=n.length-1,i=[];let s,r=e===2?"<svg>":e===3?"<math>":"",o=vs;for(let a=0;a<t;a++){const l=n[a];let c,h,d=-1,u=0;for(;u<l.length&&(o.lastIndex=u,h=o.exec(l),h!==null);)u=o.lastIndex,o===vs?h[1]==="!--"?o=uc:h[1]!==void 0?o=fc:h[2]!==void 0?(Ad.test(h[2])&&(s=RegExp("</"+h[2],"g")),o=ri):h[3]!==void 0&&(o=ri):o===ri?h[0]===">"?(o=s??vs,d=-1):h[1]===void 0?d=-2:(d=o.lastIndex-h[2].length,c=h[1],o=h[3]===void 0?ri:h[3]==='"'?mc:pc):o===mc||o===pc?o=ri:o===uc||o===fc?o=vs:(o=ri,s=void 0);const f=o===ri&&n[a+1].startsWith("/>")?" ":"";r+=o===vs?l+W0:d>=0?(i.push(c),l.slice(0,d)+vd+l.slice(d)+ze+f):l+ze+(d===-2?a:f)}return[Rd(n,r+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};class qs{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let r=0,o=0;const a=e.length-1,l=this.parts,[c,h]=X0(e,t);if(this.el=qs.createElement(c,i),ci.currentNode=this.el.content,t===2||t===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(s=ci.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const d of s.getAttributeNames())if(d.endsWith(vd)){const u=h[o++],f=s.getAttribute(d).split(ze),p=/([.?@])?(.*)/.exec(u);l.push({type:1,index:r,name:p[2],strings:f,ctor:p[1]==="."?q0:p[1]==="?"?Q0:p[1]==="@"?K0:Zr}),s.removeAttribute(d)}else d.startsWith(ze)&&(l.push({type:6,index:r}),s.removeAttribute(d));if(Ad.test(s.tagName)){const d=s.textContent.split(ze),u=d.length-1;if(u>0){s.textContent=cr?cr.emptyScript:"";for(let f=0;f<u;f++)s.append(d[f],hr()),ci.nextNode(),l.push({type:2,index:++r});s.append(d[u],hr())}}}else if(s.nodeType===8)if(s.data===wd)l.push({type:2,index:r});else{let d=-1;for(;(d=s.data.indexOf(ze,d+1))!==-1;)l.push({type:7,index:r}),d+=ze.length-1}r++}}static createElement(e,t){const i=Ii.createElement("template");return i.innerHTML=e,i}}function Xi(n,e,t=n,i){var o,a;if(e===Zs)return e;let s=i!==void 0?(o=t.o)==null?void 0:o[i]:t.l;const r=Xs(e)?void 0:e._$litDirective$;return(s==null?void 0:s.constructor)!==r&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),r===void 0?s=void 0:(s=new r(n),s._$AT(n,t,i)),i!==void 0?(t.o??(t.o=[]))[i]=s:t.l=s),s!==void 0&&(e=Xi(n,s._$AS(n,e.values),s,i)),e}class Z0{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,s=((e==null?void 0:e.creationScope)??Ii).importNode(t,!0);ci.currentNode=s;let r=ci.nextNode(),o=0,a=0,l=i[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new Xr(r,r.nextSibling,this,e):l.type===1?c=new l.ctor(r,l.name,l.strings,this,e):l.type===6&&(c=new J0(r,this,e)),this._$AV.push(c),l=i[++a]}o!==(l==null?void 0:l.index)&&(r=ci.nextNode(),o++)}return ci.currentNode=Ii,s}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class Xr{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this.v}constructor(e,t,i,s){this.type=2,this._$AH=kt,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this.v=(s==null?void 0:s.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Xi(this,e,t),Xs(e)?e===kt||e==null||e===""?(this._$AH!==kt&&this._$AR(),this._$AH=kt):e!==this._$AH&&e!==Zs&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):j0(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==kt&&Xs(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ii.createTextNode(e)),this._$AH=e}$(e){var r;const{values:t,_$litType$:i}=e,s=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=qs.createElement(Rd(i.h,i.h[0]),this.options)),i);if(((r=this._$AH)==null?void 0:r._$AD)===s)this._$AH.p(t);else{const o=new Z0(s,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=gc.get(e.strings);return t===void 0&&gc.set(e.strings,t=new qs(e)),t}k(e){Na(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const r of e)s===t.length?t.push(i=new Xr(this.O(hr()),this.O(hr()),this,this.options)):i=t[s],i._$AI(r),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const s=e.nextSibling;e.remove(),e=s}}setConnected(e){var t;this._$AM===void 0&&(this.v=e,(t=this._$AP)==null||t.call(this,e))}}class Zr{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,r){this.type=1,this._$AH=kt,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=r,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=kt}_$AI(e,t=this,i,s){const r=this.strings;let o=!1;if(r===void 0)e=Xi(this,e,t,0),o=!Xs(e)||e!==this._$AH&&e!==Zs,o&&(this._$AH=e);else{const a=e;let l,c;for(e=r[0],l=0;l<r.length-1;l++)c=Xi(this,a[i+l],t,l),c===Zs&&(c=this._$AH[l]),o||(o=!Xs(c)||c!==this._$AH[l]),c===kt?e=kt:e!==kt&&(e+=(c??"")+r[l+1]),this._$AH[l]=c}o&&!s&&this.j(e)}j(e){e===kt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class q0 extends Zr{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===kt?void 0:e}}class Q0 extends Zr{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==kt)}}class K0 extends Zr{constructor(e,t,i,s,r){super(e,t,i,s,r),this.type=5}_$AI(e,t=this){if((e=Xi(this,e,t,0)??kt)===Zs)return;const i=this._$AH,s=e===kt&&i!==kt||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,r=e!==kt&&(i===kt||s);s&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class J0{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Xi(this,e)}}const Ro=Ps.litHtmlPolyfillSupport;Ro==null||Ro(qs,Xr),(Ps.litHtmlVersions??(Ps.litHtmlVersions=[])).push("3.2.0");/**
1928
+ */const Us=globalThis,hr=Us.trustedTypes,mc=hr?hr.createPolicy("lit-html",{createHTML:r=>r}):void 0,Fd="$lit$",He=`lit$${Math.random().toFixed(9).slice(2)}$`,Od="?"+He,q0=`<${Od}>`,Ci=document,dr=()=>Ci.createComment(""),Qs=r=>r===null||typeof r!="object"&&typeof r!="function",La=Array.isArray,Q0=r=>La(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",So=`[
1929
+ \f\r]`,Ss=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,gc=/-->/g,Ec=/>/g,li=RegExp(`>|${So}(?:([^\\s"'>=/]+)(${So}*=${So}*(?:[^
1930
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),bc=/'/g,Ic=/"/g,xd=/^(?:script|style|textarea|title)$/i,Ks=Symbol.for("lit-noChange"),Bt=Symbol.for("lit-nothing"),Cc=new WeakMap,ui=Ci.createTreeWalker(Ci,129);function Nd(r,e){if(!La(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return mc!==void 0?mc.createHTML(e):e}const K0=(r,e)=>{const t=r.length-1,i=[];let s,n=e===2?"<svg>":e===3?"<math>":"",o=Ss;for(let a=0;a<t;a++){const l=r[a];let c,h,d=-1,u=0;for(;u<l.length&&(o.lastIndex=u,h=o.exec(l),h!==null);)u=o.lastIndex,o===Ss?h[1]==="!--"?o=gc:h[1]!==void 0?o=Ec:h[2]!==void 0?(xd.test(h[2])&&(s=RegExp("</"+h[2],"g")),o=li):h[3]!==void 0&&(o=li):o===li?h[0]===">"?(o=s??Ss,d=-1):h[1]===void 0?d=-2:(d=o.lastIndex-h[2].length,c=h[1],o=h[3]===void 0?li:h[3]==='"'?Ic:bc):o===Ic||o===bc?o=li:o===gc||o===Ec?o=Ss:(o=li,s=void 0);const f=o===li&&r[a+1].startsWith("/>")?" ":"";n+=o===Ss?l+q0:d>=0?(i.push(c),l.slice(0,d)+Fd+l.slice(d)+He+f):l+He+(d===-2?a:f)}return[Nd(r,n+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};class Js{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let n=0,o=0;const a=e.length-1,l=this.parts,[c,h]=K0(e,t);if(this.el=Js.createElement(c,i),ui.currentNode=this.el.content,t===2||t===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(s=ui.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const d of s.getAttributeNames())if(d.endsWith(Fd)){const u=h[o++],f=s.getAttribute(d).split(He),p=/([.?@])?(.*)/.exec(u);l.push({type:1,index:n,name:p[2],strings:f,ctor:p[1]==="."?tE:p[1]==="?"?eE:p[1]==="@"?iE:Qr}),s.removeAttribute(d)}else d.startsWith(He)&&(l.push({type:6,index:n}),s.removeAttribute(d));if(xd.test(s.tagName)){const d=s.textContent.split(He),u=d.length-1;if(u>0){s.textContent=hr?hr.emptyScript:"";for(let f=0;f<u;f++)s.append(d[f],dr()),ui.nextNode(),l.push({type:2,index:++n});s.append(d[u],dr())}}}else if(s.nodeType===8)if(s.data===Od)l.push({type:2,index:n});else{let d=-1;for(;(d=s.data.indexOf(He,d+1))!==-1;)l.push({type:7,index:n}),d+=He.length-1}n++}}static createElement(e,t){const i=Ci.createElement("template");return i.innerHTML=e,i}}function Qi(r,e,t=r,i){var o,a;if(e===Ks)return e;let s=i!==void 0?(o=t.o)==null?void 0:o[i]:t.l;const n=Qs(e)?void 0:e._$litDirective$;return(s==null?void 0:s.constructor)!==n&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),n===void 0?s=void 0:(s=new n(r),s._$AT(r,t,i)),i!==void 0?(t.o??(t.o=[]))[i]=s:t.l=s),s!==void 0&&(e=Qi(r,s._$AS(r,e.values),s,i)),e}class J0{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,s=((e==null?void 0:e.creationScope)??Ci).importNode(t,!0);ui.currentNode=s;let n=ui.nextNode(),o=0,a=0,l=i[0];for(;l!==void 0;){if(o===l.index){let c;l.type===2?c=new qr(n,n.nextSibling,this,e):l.type===1?c=new l.ctor(n,l.name,l.strings,this,e):l.type===6&&(c=new sE(n,this,e)),this._$AV.push(c),l=i[++a]}o!==(l==null?void 0:l.index)&&(n=ui.nextNode(),o++)}return ui.currentNode=Ci,s}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class qr{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this.v}constructor(e,t,i,s){this.type=2,this._$AH=Bt,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this.v=(s==null?void 0:s.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Qi(this,e,t),Qs(e)?e===Bt||e==null||e===""?(this._$AH!==Bt&&this._$AR(),this._$AH=Bt):e!==this._$AH&&e!==Ks&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Q0(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Bt&&Qs(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ci.createTextNode(e)),this._$AH=e}$(e){var n;const{values:t,_$litType$:i}=e,s=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=Js.createElement(Nd(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)==null?void 0:n._$AD)===s)this._$AH.p(t);else{const o=new J0(s,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Cc.get(e.strings);return t===void 0&&Cc.set(e.strings,t=new Js(e)),t}k(e){La(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const n of e)s===t.length?t.push(i=new qr(this.O(dr()),this.O(dr()),this,this.options)):i=t[s],i._$AI(n),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const s=e.nextSibling;e.remove(),e=s}}setConnected(e){var t;this._$AM===void 0&&(this.v=e,(t=this._$AP)==null||t.call(this,e))}}class Qr{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,n){this.type=1,this._$AH=Bt,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Bt}_$AI(e,t=this,i,s){const n=this.strings;let o=!1;if(n===void 0)e=Qi(this,e,t,0),o=!Qs(e)||e!==this._$AH&&e!==Ks,o&&(this._$AH=e);else{const a=e;let l,c;for(e=n[0],l=0;l<n.length-1;l++)c=Qi(this,a[i+l],t,l),c===Ks&&(c=this._$AH[l]),o||(o=!Qs(c)||c!==this._$AH[l]),c===Bt?e=Bt:e!==Bt&&(e+=(c??"")+n[l+1]),this._$AH[l]=c}o&&!s&&this.j(e)}j(e){e===Bt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class tE extends Qr{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Bt?void 0:e}}class eE extends Qr{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Bt)}}class iE extends Qr{constructor(e,t,i,s,n){super(e,t,i,s,n),this.type=5}_$AI(e,t=this){if((e=Qi(this,e,t,0)??Bt)===Ks)return;const i=this._$AH,s=e===Bt&&i!==Bt||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==Bt&&(i===Bt||s);s&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class sE{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Qi(this,e)}}const Fo=Us.litHtmlPolyfillSupport;Fo==null||Fo(Js,qr),(Us.litHtmlVersions??(Us.litHtmlVersions=[])).push("3.2.0");/**
1934
1931
  * @license
1935
1932
  * Copyright 2020 Google LLC
1936
1933
  * SPDX-License-Identifier: BSD-3-Clause
1937
- */const tE=()=>new eE;class eE{}const iE=n=>{var F;const{components:e,topic:t,onCancel:i,onSubmit:s,styles:r}=n,o=s??(()=>{}),a=e.get(Dt),l=t?t.title:null,c=t?t.status:null,h=t?t.type:null,d=t?t.priority:null,u=t?t.assignedTo:null,f=t?t.labels:null,p=t?t.stage:null,m=t?t.description:null,E=t?(F=t.dueDate)==null?void 0:F.toISOString().split("T")[0]:null,g=new Set([...a.config.statuses]);c&&g.add(c);const b=new Set([...a.config.types]);h&&b.add(h);const v=new Set([...a.config.priorities]);d&&v.add(d);const I=new Set([...a.config.users]);u&&I.add(u);const T=new Set([...a.config.labels]);if(f)for(const x of f)T.add(x);const A=new Set([...a.config.stages]);p&&A.add(p);const R=tE(),P=async()=>{const{value:x}=R;if(!x)return;Object.values(x.valueTransform).length===0&&(x.valueTransform={dueDate:w=>{if(typeof w=="string"&&w.trim()!=="")return new Date(w)},status:w=>{if(Array.isArray(w)&&w.length!==0)return w[0]},type:w=>{if(Array.isArray(w)&&w.length!==0)return w[0]},priority:w=>{if(Array.isArray(w)&&w.length!==0)return w[0]},assignedTo:w=>{if(Array.isArray(w)&&w.length!==0)return w[0]}});const D=x.value;if(t)t.set(D),await o(t);else{const w=a.create(D);await o(w)}};return K`
1934
+ */const nE=()=>new rE;class rE{}const oE=r=>{const{components:e,topic:t,onCancel:i,onSubmit:s,styles:n}=r,o=s??(()=>{}),a=e.get(Mt),l=(t==null?void 0:t.title)??null,c=(t==null?void 0:t.status)??null,h=(t==null?void 0:t.type)??null,d=(t==null?void 0:t.priority)??null,u=(t==null?void 0:t.assignedTo)??null,f=(t==null?void 0:t.labels)??null,p=(t==null?void 0:t.stage)??null,m=(t==null?void 0:t.description)??null,E=t!=null&&t.dueDate?t.dueDate.toISOString().split("T")[0]:null,g=new Set([...a.config.statuses]);c&&g.add(c);const I=new Set([...a.config.types]);h&&I.add(h);const T=new Set([...a.config.priorities]);d&&T.add(d);const b=new Set([...a.config.users]);u&&b.add(u);const v=new Set([...a.config.labels]);if(f)for(const R of f)v.add(R);const A=new Set([...a.config.stages]);p&&A.add(p);const S=nE(),N=async()=>{const{value:R}=S;if(!R)return;Object.values(R.valueTransform).length===0&&(R.valueTransform={dueDate:M=>{if(typeof M=="string"&&M.trim()!=="")return new Date(M)},status:M=>{if(Array.isArray(M)&&M.length!==0)return M[0]},type:M=>{if(Array.isArray(M)&&M.length!==0)return M[0]},priority:M=>{if(Array.isArray(M)&&M.length!==0)return M[0]},assignedTo:M=>{if(Array.isArray(M)&&M.length!==0)return M[0]}});const P=R.value;if(t)t.set(P),await o(t);else{const M=a.create(P);await o(M)}};return X`
1938
1935
  <bim-panel style="border-radius: var(--bim-ui_size-base); outline: 2px solid var(--bim-ui_bg-contrast-20); width: 22rem;">
1939
- <bim-panel-section ${di(R)} fixed label="New Topic" name="topic">
1936
+ <bim-panel-section ${we(S)} fixed label="New Topic" name="topic">
1940
1937
  <div style="display: flex; gap: 0.375rem">
1941
1938
  <bim-text-input vertical label="Title" name="title" .value=${l}></bim-text-input>
1942
- ${t?K`
1939
+ ${t?X`
1943
1940
  <bim-dropdown vertical label="Status" name="status" required>
1944
- ${[...g].map(x=>K`<bim-option label=${x} .checked=${c===x}></bim-option>`)}
1945
- </bim-dropdown>`:K``}
1941
+ ${[...g].map(R=>X`<bim-option label=${R} .checked=${c===R}></bim-option>`)}
1942
+ </bim-dropdown>`:X``}
1946
1943
  </div>
1947
1944
  <div style="display: flex; gap: 0.375rem">
1948
1945
  <bim-dropdown vertical label="Type" name="type" required>
1949
- ${[...b].map(x=>K`<bim-option label=${x} .checked=${h===x}></bim-option>`)}
1946
+ ${[...I].map(R=>X`<bim-option label=${R} .checked=${h===R}></bim-option>`)}
1950
1947
  </bim-dropdown>
1951
1948
  <bim-dropdown vertical label="Priority" name="priority">
1952
- ${[...v].map(x=>K`<bim-option label=${x} .checked=${d===x}></bim-option>`)}
1949
+ ${[...T].map(R=>X`<bim-option label=${R} .checked=${d===R}></bim-option>`)}
1953
1950
  </bim-dropdown>
1954
1951
  </div>
1955
1952
  <div style="display: flex; gap: 0.375rem">
1956
1953
  <bim-dropdown vertical label="Labels" name="labels" multiple>
1957
- ${[...T].map(x=>K`<bim-option label=${x} .checked=${f==null?void 0:f.has(x)}></bim-option>`)}
1954
+ ${[...v].map(R=>X`<bim-option label=${R} .checked=${f==null?void 0:f.has(R)}></bim-option>`)}
1958
1955
  </bim-dropdown>
1959
1956
  <bim-dropdown vertical label="Assignee" name="assignedTo">
1960
- ${[...I].map(x=>{const D=r!=null&&r.users?r.users[x]:null,w=D?D.name:x,L=D==null?void 0:D.picture;return K`<bim-option label=${w} value=${x} .img=${L} .checked=${u===x}></bim-option>`})}
1957
+ ${[...b].map(R=>{const P=n!=null&&n.users?n.users[R]:null,M=P?P.name:R,w=P==null?void 0:P.picture;return X`<bim-option label=${M} value=${R} .img=${w} .checked=${u===R}></bim-option>`})}
1961
1958
  </bim-dropdown>
1962
1959
  </div>
1963
1960
  <div style="display: flex; gap: 0.375rem">
1964
1961
  <bim-text-input vertical type="date" label="Due Date" name="dueDate" .value=${E}></bim-text-input>
1965
1962
  <bim-dropdown vertical label="Stage" name="stage">
1966
- ${[...A].map(x=>K`<bim-option label=${x} .checked=${p===x}></bim-option>`)}
1963
+ ${[...A].map(R=>X`<bim-option label=${R} .checked=${p===R}></bim-option>`)}
1967
1964
  </bim-dropdown>
1968
1965
  </div>
1969
1966
  <bim-text-input vertical label="Description" name="description" type="area" .value=${m??null}></bim-text-input>
@@ -1982,130 +1979,282 @@ ${t}
1982
1979
  }
1983
1980
  </style>
1984
1981
  <bim-button @click=${i} style="flex: 0" id="A7T9K" label="Cancel"></bim-button>
1985
- <bim-button @click=${P} style="flex: 0" id="W3F2J" label=${t?"Update Topic":"Add Topic"} icon=${t?"tabler:refresh":"mi:add"}></bim-button>
1982
+ <bim-button @click=${N} style="flex: 0" id="W3F2J" label=${t?"Update Topic":"Add Topic"} icon=${t?"tabler:refresh":"mi:add"}></bim-button>
1986
1983
  </div>
1987
1984
  </bim-panel-section>
1988
1985
  </bim-panel>
1989
- `},sE=n=>Vr.create(iE,n),Yn={users:{"jhon.doe@example.com":{name:"Jhon Doe"}},priorities:{"On hold":{icon:"flowbite:circle-pause-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#767676"}},Minor:{icon:"mingcute:arrows-down-fill",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#4CAF50"}},Normal:{icon:"fa6-solid:grip-lines",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Major:{icon:"mingcute:arrows-up-fill",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Critical:{icon:"ph:warning",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}}},statuses:{Active:{icon:"prime:circle-fill",style:{backgroundColor:"#2E2E2E"}},"In Progress":{icon:"prime:circle-fill",style:{backgroundColor:"#fa89004d","--bim-label--c":"#FB8C00","--bim-icon--c":"#FB8C00"}},"In Review":{icon:"prime:circle-fill",style:{backgroundColor:"#9c6bff4d","--bim-label--c":"#9D6BFF","--bim-icon--c":"#9D6BFF"}},Done:{icon:"prime:circle-fill",style:{backgroundColor:"#4CAF504D","--bim-label--c":"#4CAF50","--bim-icon--c":"#4CAF50"}},Closed:{icon:"prime:circle-fill",style:{backgroundColor:"#2E2E2E","--bim-label--c":"#727272","--bim-icon--c":"#727272"}}},types:{Clash:{icon:"gg:close-r",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Issue:{icon:"mdi:bug-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Failure:{icon:"mdi:bug-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Inquiry:{icon:"majesticons:comment-line",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Fault:{icon:"ph:warning",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Remark:{icon:"ph:note-blank-bold",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Request:{icon:"mynaui:edit-one",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#9D6BFF"}}}},So={padding:"0.25rem 0.5rem",borderRadius:"999px","--bim-label--c":"white"},Fo=(n,e)=>{const i=((e==null?void 0:e.users)??Yn.users)[n],s=(i==null?void 0:i.name)??n,r=s.trim().split(/\s+/);let o,a;return r[0]&&r[0][0]&&(o=r[0][0].toUpperCase(),r[0][1]&&(a=r[0][1].toUpperCase())),r[1]&&r[1][0]&&(a=r[1][0].toUpperCase()),K`
1986
+ `},aE=r=>Ae.create(oE,r),lE=r=>{var c;const{components:e,topic:t,actions:i}=r,s={selectComponents:!0,colorizeComponent:!0,resetColors:!0,updateCamera:!0,delete:!0,unlink:!!t,...i},n=e.get(Ht),o=((c=r.topic)==null?void 0:c.viewpoints)??n.list.keys(),a=[];for(const h of o){const d=n.list.get(h);d&&a.push(d)}return X`
1987
+ <bim-table ${we(h=>{if(!h)return;const d=h;d.addEventListener("cellcreated",({detail:u})=>{const{cell:f}=u;f.style.padding="0.25rem"}),d.headersHidden=!0,d.hiddenColumns=["Guid"],d.columns=["Title",{name:"Actions",width:"auto"}],d.dataTransform={Actions:(u,f)=>{const{Guid:p}=f;if(!(p&&typeof p=="string"))return p;const m=e.get(Ht),E=m.list.get(p);return E?X`
1988
+ <bim-button icon="ph:eye-fill" @click=${()=>E.go()}></bim-button>
1989
+ ${Object.values(s).includes(!0)?X`
1990
+ <bim-button icon="prime:ellipsis-v">
1991
+ <bim-context-menu>
1992
+ ${s.selectComponents?X`<bim-button label="Select Components" @click=${()=>console.log(E.selection)}></bim-button> `:null}
1993
+ ${s.colorizeComponent?X`<bim-button label="Colorize Components" @click=${()=>E.colorize()}></bim-button> `:null}
1994
+ ${s.resetColors?X`<bim-button label="Reset Colors" @click=${()=>E.resetColors()}></bim-button> `:null}
1995
+ ${s.updateCamera?X`<bim-button label="Update Camera" @click=${()=>E.updateCamera()}></bim-button> `:null}
1996
+ ${s.unlink?X`<bim-button .disabled=${!t} label="Unlink" @click=${()=>t==null?void 0:t.viewpoints.delete(E.guid)}></bim-button> `:null}
1997
+ ${s.delete?X`<bim-button label="Delete" @click=${()=>m.list.delete(E.guid)}></bim-button>`:null}
1998
+ </bim-context-menu>
1999
+ </bim-button>
2000
+ `:null}
2001
+ `:p}},d.data=a.map((u,f)=>({data:{Guid:u.guid,Title:u.title??`Viewpoint ${r.topic?f+1:""}`,Actions:""}}))})}>
2002
+ <bim-label slot="missing-data" icon="ph:warning-fill" style="--bim-icon--c: gold;">No viewpoints to show</bim-label>
2003
+ </bim-table>
2004
+ `},Ma=(r,e=!0)=>{const t=Ae.create(lE,r),{components:i,topic:s}=r;if(e){const[,n]=t,o=i.get(Ht);o.list.onItemUpdated.add(()=>n()),o.list.onItemDeleted.add(()=>n()),o.list.onCleared.add(()=>n()),s?(s.viewpoints.onItemAdded.add(()=>n()),s.viewpoints.onItemDeleted.add(()=>n()),s.viewpoints.onCleared.add(()=>n())):o.list.onItemSet.add(()=>n())}return t},cE={"jhon.doe@example.com":{name:"Jhon Doe",picture:"https://www.profilebakery.com/wp-content/uploads/2023/04/Profile-Image-AI.jpg"}},hE=(r,e)=>{const i=(e??cE)[r],s=(i==null?void 0:i.name)??r,n=s.trim().split(/\s+/);let o,a;return n[0]&&n[0][0]&&(o=n[0][0].toUpperCase(),n[0][1]&&(a=n[0][1].toUpperCase())),n[1]&&n[1][0]&&(a=n[1][0].toUpperCase()),X`
2005
+ <div style="display: flex; gap: 0.25rem; overflow: hidden;">
2006
+ ${!(i!=null&&i.picture)&&(o||a)?X`
2007
+ <bim-label
2008
+ style=${xe({borderRadius:"999px",padding:"0.375rem",backgroundColor:"var(--bim-ui_bg-contrast-20)",aspectRatio:"1",fontSize:"0.7rem"})}>${o}${a}</bim-label>
2009
+ `:null}
2010
+ <bim-label .img=${i==null?void 0:i.picture}>${s}</bim-label>
2011
+ </div>
2012
+ `},dE=r=>{const{topic:e,styles:t,viewpoint:i,actions:s}=r,n={delete:!0,...s};return X`<bim-table @cellcreated=${({detail:a})=>{const{cell:l}=a;l.style.marginLeft="0"}} ${we(a=>{if(!a)return;const l=a;l.headersHidden=!0,l.hiddenColumns=["guid","author"],l.dataTransform={Comment:(h,d)=>{const{guid:u}=d;if(typeof u!="string")return h;const f=e.comments.get(u);if(!f)return h;const p=()=>{e.comments.delete(u)};return X`
2013
+ <div style="display: flex; flex-direction: column; gap: 0.25rem; flex: 1">
2014
+ <div style="display: flex; justify-content: space-between;">
2015
+ <div style="display: flex; gap: 0.375rem;">
2016
+ ${hE(f.author,t)}
2017
+ <bim-label style="color: var(--bim-ui_bg-contrast-40)">@ ${f.date.toDateString()}</bim-label>
2018
+ </div>
2019
+ <div>
2020
+ <style>
2021
+ #TCDBT {
2022
+ background-color: transparent;
2023
+ --bim-label--c: var(--bim-ui_bg-contrast-60)
2024
+ }
2025
+
2026
+ #TCDBT:hover {
2027
+ --bim-label--c: #FF5252;
2028
+ }
2029
+ </style>
2030
+ ${n!=null&&n.delete?X`<bim-button @click=${p} id="TCDBT" icon="majesticons:delete-bin"></bim-button>`:null}
2031
+ </div>
2032
+ </div>
2033
+ <bim-label style="margin-left: 1.7rem; white-space: normal">${f.comment}</bim-label>
2034
+ </div>
2035
+ `}};let c=e.comments.values();i&&(c=[...e.comments.values()].filter(h=>h.viewpoint===i)),l.data=[...c].map(h=>({data:{guid:h.guid,Comment:h.comment,author:(()=>{const d=t;if(!d)return h.author;const u=d[h.author];return(u==null?void 0:u.name)??h.author})()}}))})}><bim-label slot="missing-data" icon="ph:warning-fill" style="--bim-icon--c: gold;">This topic has no comments</bim-label></bim-table>`},uE=(r,e=!0)=>{const t=Ae.create(dE,r);if(e){const{topic:i}=r,[s,n]=t;i.comments.onItemSet.add(()=>n()),i.comments.onItemUpdated.add(()=>n()),i.comments.onItemDeleted.add(()=>n()),i.comments.onCleared.add(()=>n())}return t},Wn={users:{"jhon.doe@example.com":{name:"Jhon Doe"}},priorities:{"On hold":{icon:"flowbite:circle-pause-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#767676"}},Minor:{icon:"mingcute:arrows-down-fill",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#4CAF50"}},Normal:{icon:"fa6-solid:grip-lines",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Major:{icon:"mingcute:arrows-up-fill",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Critical:{icon:"ph:warning",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}}},statuses:{Active:{icon:"prime:circle-fill",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)"}},"In Progress":{icon:"prime:circle-fill",style:{backgroundColor:"#fa89004d","--bim-label--c":"#FB8C00","--bim-icon--c":"#FB8C00"}},"In Review":{icon:"prime:circle-fill",style:{backgroundColor:"#9c6bff4d","--bim-label--c":"#9D6BFF","--bim-icon--c":"#9D6BFF"}},Done:{icon:"prime:circle-fill",style:{backgroundColor:"#4CAF504D","--bim-label--c":"#4CAF50","--bim-icon--c":"#4CAF50"}},Closed:{icon:"prime:circle-fill",style:{backgroundColor:"#414141","--bim-label--c":"#727272","--bim-icon--c":"#727272"}}},types:{Clash:{icon:"gg:close-r",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Issue:{icon:"mdi:bug-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Failure:{icon:"mdi:bug-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Inquiry:{icon:"majesticons:comment-line",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Fault:{icon:"ph:warning",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Remark:{icon:"ph:note-blank-bold",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Request:{icon:"mynaui:edit-one",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#9D6BFF"}}}},Oo={padding:"0.25rem 0.5rem",borderRadius:"999px","--bim-label--c":"var(--bim-ui_bg-contrast-100)"},yc=(r,e)=>{const i=((e==null?void 0:e.users)??Wn.users)[r],s=(i==null?void 0:i.name)??r,n=s.trim().split(/\s+/);let o,a;return n[0]&&n[0][0]&&(o=n[0][0].toUpperCase(),n[0][1]&&(a=n[0][1].toUpperCase())),n[1]&&n[1][0]&&(a=n[1][0].toUpperCase()),X`
1990
2036
  <div style="display: flex; gap: 0.25rem; overflow: hidden;">
1991
- ${!(i!=null&&i.picture)&&(o||a)?K`
2037
+ ${!(i!=null&&i.picture)&&(o||a)?X`
1992
2038
  <bim-label
1993
- style=${He({borderRadius:"999px",padding:"0.375rem",backgroundColor:"var(--bim-ui_bg-contrast-20)",aspectRatio:"1",fontSize:"0.7rem"})}>${o}${a}</bim-label>
2039
+ style=${xe({borderRadius:"999px",padding:"0.375rem",backgroundColor:"var(--bim-ui_bg-contrast-20)",aspectRatio:"1",fontSize:"0.7rem"})}>${o}${a}</bim-label>
1994
2040
  `:null}
1995
2041
  <bim-label .img=${i==null?void 0:i.picture}>${s}</bim-label>
1996
2042
  </div>
1997
- `},nE=n=>{const{topic:e,styles:t,onUpdateInformation:i}=n,s=(t==null?void 0:t.priorities)??Yn.priorities,r=(t==null?void 0:t.statuses)??Yn.statuses,o=(t==null?void 0:t.types)??Yn.types;let a;e!=null&&e.priority&&(a=s[e.priority]);let l;e!=null&&e.type&&(l=o[e.type]);let c;e!=null&&e.type&&(c=r[e.status]);const h=document.createElement("bim-table");return h.headersHidden=!0,h.hiddenColumns=["Author"],h.data=[...(e==null?void 0:e.comments)??[]].map(d=>({data:{Comment:d.comment,Author:d.author}})),K`
2043
+ `},fE=r=>{const{components:e,dataStyles:t,onTopicEnter:i}=r,s=e.get(Mt),n=r.topics??s.list.values();return X`
2044
+ <bim-table @cellcreated=${({detail:a})=>{const{cell:l}=a;l.style.marginLeft="0"}} ${we(a=>{if(!a)return;const l=a;l.hiddenColumns=["Guid"],l.columns=["Title"],l.selectableRows=!0,l.dataTransform={Title:(c,h)=>{const{Guid:d}=h;if(typeof d!="string")return c;const u=s.list.get(d);return u?X`
2045
+ <div style="display: flex; overflow: hidden;">
2046
+ <style>
2047
+ #BBETO {
2048
+ background-color: transparent
2049
+ }
2050
+
2051
+ #BBETO:hover {
2052
+ --bim-label--c: var(--bim-ui_accent-base)
2053
+ }
2054
+ </style>
2055
+ <bim-button @click=${()=>{i&&i(u)}} id="BBETO" icon="iconamoon:enter-duotone"></bim-button>
2056
+ <bim-label>${c}</bim-label>
2057
+ </div>`:c},Priority:c=>{if(typeof c!="string")return c;const d=((t==null?void 0:t.priorities)??Wn.priorities)[c];return X`
2058
+ <bim-label
2059
+ .icon=${d==null?void 0:d.icon}
2060
+ style=${xe({...Oo,...d==null?void 0:d.style})}
2061
+ >${c}
2062
+ </bim-label>
2063
+ `},Status:c=>{if(typeof c!="string")return c;const d=((t==null?void 0:t.statuses)??Wn.statuses)[c];return X`
2064
+ <bim-label
2065
+ .icon=${d==null?void 0:d.icon}
2066
+ style=${xe({...Oo,...d==null?void 0:d.style})}
2067
+ >${c}
2068
+ </bim-label>
2069
+ `},Type:c=>{if(typeof c!="string")return c;const d=((t==null?void 0:t.types)??Wn.types)[c];return X`
2070
+ <bim-label
2071
+ .icon=${d==null?void 0:d.icon}
2072
+ style=${xe({...Oo,...d==null?void 0:d.style})}
2073
+ >${c}
2074
+ </bim-label>
2075
+ `},Author:c=>typeof c!="string"?c:yc(c,t),Assignee:c=>typeof c!="string"?c:yc(c,t)},l.data=[...n].map(c=>{var h;return{data:{Guid:c.guid,Title:c.title,Status:c.status,Description:c.description??"",Author:c.creationAuthor,Assignee:c.assignedTo??"",Date:c.creationDate.toDateString(),DueDate:((h=c.dueDate)==null?void 0:h.toDateString())??"",Type:c.type,Priority:c.priority??""}}})})}>
2076
+ <bim-label slot="missing-data" icon="ph:warning-fill" style="--bim-icon--c: gold;">There are no topics to display</bim-label>
2077
+ </bim-table>`},Pd=(r,e=!0)=>{const t=Ae.create(fE,r);if(e){const{components:i,topics:s}=r,[,n]=t,o=i.get(Mt);if(o.list.onItemUpdated.add(()=>n()),o.list.onItemDeleted.add(()=>n()),s)for(const a of s)a.relatedTopics.onItemAdded.add(()=>n()),a.relatedTopics.onItemDeleted.add(()=>n()),a.relatedTopics.onCleared.add(()=>n());else o.list.onItemSet.add(()=>n())}return t},jn={users:{"jhon.doe@example.com":{name:"Jhon Doe"}},priorities:{"On hold":{icon:"flowbite:circle-pause-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#767676"}},Minor:{icon:"mingcute:arrows-down-fill",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#4CAF50"}},Normal:{icon:"fa6-solid:grip-lines",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Major:{icon:"mingcute:arrows-up-fill",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Critical:{icon:"ph:warning",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}}},statuses:{Active:{icon:"prime:circle-fill",style:{backgroundColor:"#2E2E2E"}},"In Progress":{icon:"prime:circle-fill",style:{backgroundColor:"#fa89004d","--bim-label--c":"#FB8C00","--bim-icon--c":"#FB8C00"}},"In Review":{icon:"prime:circle-fill",style:{backgroundColor:"#9c6bff4d","--bim-label--c":"#9D6BFF","--bim-icon--c":"#9D6BFF"}},Done:{icon:"prime:circle-fill",style:{backgroundColor:"#4CAF504D","--bim-label--c":"#4CAF50","--bim-icon--c":"#4CAF50"}},Closed:{icon:"prime:circle-fill",style:{backgroundColor:"#2E2E2E","--bim-label--c":"#727272","--bim-icon--c":"#727272"}}},types:{Clash:{icon:"gg:close-r",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Issue:{icon:"mdi:bug-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Failure:{icon:"mdi:bug-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Inquiry:{icon:"majesticons:comment-line",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Fault:{icon:"ph:warning",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Remark:{icon:"ph:note-blank-bold",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Request:{icon:"mynaui:edit-one",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#9D6BFF"}}}},xo={padding:"0.25rem 0.5rem",borderRadius:"999px","--bim-label--c":"white"},No=(r,e)=>{const i=((e==null?void 0:e.users)??jn.users)[r],s=(i==null?void 0:i.name)??r,n=s.trim().split(/\s+/);let o,a;return n[0]&&n[0][0]&&(o=n[0][0].toUpperCase(),n[0][1]&&(a=n[0][1].toUpperCase())),n[1]&&n[1][0]&&(a=n[1][0].toUpperCase()),X`
2078
+ <div style="display: flex; gap: 0.25rem; overflow: hidden;">
2079
+ ${!(i!=null&&i.picture)&&(o||a)?X`
2080
+ <bim-label
2081
+ style=${xe({borderRadius:"999px",padding:"0.375rem",backgroundColor:"var(--bim-ui_bg-contrast-20)",aspectRatio:"1",fontSize:"0.7rem"})}>${o}${a}</bim-label>
2082
+ `:null}
2083
+ <bim-label .img=${i==null?void 0:i.picture}>${s}</bim-label>
2084
+ </div>
2085
+ `},[ur,pE]=Ae.create(r=>{const{topic:e}=r,t=document.createElement("bim-text-input");t.type="area";const i=()=>{t.value="",ur.close(),ur.remove()};return X`
2086
+ <dialog>
2087
+ ${e?X`
2088
+ <bim-panel style="border-radius: var(--bim-ui_size-base); outline: 2px solid var(--bim-ui_bg-contrast-20); width: 20rem;">
2089
+ <bim-panel-section label="New Comment" fixed>
2090
+ ${t}
2091
+ <div style="justify-content: right; display: flex; gap: 0.375rem">
2092
+ <style>
2093
+ #PAISD {
2094
+ background-color: transparent;
2095
+ }
2096
+
2097
+ #PAISD:hover {
2098
+ --bim-label--c: #FF5252;
2099
+ }
2100
+
2101
+ #MDOG9:hover {
2102
+ background-color: #329936;
2103
+ }
2104
+ </style>
2105
+ <bim-button @click=${i} style="flex: 0" id="PAISD" label="Cancel"></bim-button>
2106
+ <bim-button @click=${()=>{const n=t.value;!e||n.trim()===""||(e.createComment(n),i())}} style="flex: 0" id="MDOG9" label="Add Comment"} icon="mi:add"}></bim-button>
2107
+ </div>
2108
+ </bim-panel-section>
2109
+ </bim-panel>
2110
+ `:X`<bim-label>No topic refereced</bim-label>`}
2111
+ </dialog>
2112
+ `},{}),[fr,mE]=Ae.create(r=>{const{components:e,topic:t}=r;let i;e&&(i=Ma({components:e,actions:{delete:!1,updateCamera:!1,colorizeComponent:!1,resetColors:!1,selectComponents:!1}})[0],i.selectableRows=!0);const s=()=>{fr.close(),fr.remove(),i==null||i.remove()};return X`
2113
+ <dialog>
2114
+ ${t?X`
2115
+ <bim-panel style="border-radius: var(--bim-ui_size-base); outline: 2px solid var(--bim-ui_bg-contrast-20); width: 20rem;">
2116
+ <bim-panel-section label="Link Viewpoints" fixed>
2117
+ ${i}
2118
+ <div style="justify-content: right; display: flex; gap: 0.375rem">
2119
+ <style>
2120
+ #PAISD {
2121
+ background-color: transparent;
2122
+ }
2123
+
2124
+ #PAISD:hover {
2125
+ --bim-label--c: #FF5252;
2126
+ }
2127
+
2128
+ #MDOG9:hover {
2129
+ background-color: #329936;
2130
+ }
2131
+ </style>
2132
+ <bim-button @click=${s} style="flex: 0" id="PAISD" label="Cancel"></bim-button>
2133
+ <bim-button @click=${()=>{if(!(i&&t))return;const o=i.selection;for(const a of o){const{Guid:l}=a;typeof l=="string"&&t.viewpoints.add(l)}s()}} style="flex: 0" id="MDOG9" label="Link Viewpoints"} icon="mi:add"}></bim-button>
2134
+ </div>
2135
+ </bim-panel-section>
2136
+ </bim-panel>
2137
+ `:X`<bim-label>No topic refereced</bim-label>`}
2138
+ </dialog>
2139
+ `},{}),[pr,gE]=Ae.create(r=>{const{components:e,topic:t}=r;let i;if(e){const a=[...e.get(Mt).list.values()].filter(l=>l!==t);i=Pd({components:e,topics:a})[0],i.selectableRows=!0,i.hiddenColumns=["Guid","Author","Assignee","Date","DueDate"]}const s=()=>{pr.close(),pr.remove(),i==null||i.remove()};return X`
2140
+ <dialog>
2141
+ <bim-panel style="border-radius: var(--bim-ui_size-base); outline: 2px solid var(--bim-ui_bg-contrast-20); width: 50rem;">
2142
+ <bim-panel-section label="Link Viewpoints" fixed>
2143
+ ${i}
2144
+ <div style="justify-content: right; display: flex; gap: 0.375rem">
2145
+ <style>
2146
+ #PAISD {
2147
+ background-color: transparent;
2148
+ }
2149
+
2150
+ #PAISD:hover {
2151
+ --bim-label--c: #FF5252;
2152
+ }
2153
+
2154
+ #MDOG9:hover {
2155
+ background-color: #329936;
2156
+ }
2157
+ </style>
2158
+ <bim-button @click=${s} style="flex: 0" id="PAISD" label="Cancel"></bim-button>
2159
+ <bim-button @click=${()=>{if(!(i&&t))return;const o=i.selection;for(const a of o){const{Guid:l}=a;typeof l=="string"&&t.relatedTopics.add(l)}s()}} style="flex: 0" id="MDOG9" label="Link Topics"} icon="mi:add"}></bim-button>
2160
+ </div>
2161
+ </bim-panel-section>
2162
+ </bim-panel>
2163
+ </dialog>
2164
+ `},{}),EE=r=>{const{components:e,topic:t,styles:i,onUpdateInformation:s,actions:n,world:o}=r,a={update:!0,addComments:!0,linkViewpoints:!0,addViewpoints:!0,linkTopics:!0,...n},l=(i==null?void 0:i.priorities)??jn.priorities,c=(i==null?void 0:i.statuses)??jn.statuses,h=(i==null?void 0:i.types)??jn.types;let d;t!=null&&t.priority&&(d=l[t.priority]);let u;t!=null&&t.type&&(u=h[t.type]);let f;t!=null&&t.type&&(f=c[t.status]);let p,m,E;t&&(p=uE({topic:t,styles:i==null?void 0:i.users})[0],m=Ma({components:e,topic:t})[0]);const g=()=>{if(!(t&&o))return;const A=e.get(Ht).create(o);t.viewpoints.add(A.guid)},I=()=>{pE({topic:t}),document.body.append(ur),ur.showModal()},T=()=>{mE({components:e,topic:t}),document.body.append(fr),fr.showModal()},b=()=>{gE({components:e,topic:t}),document.body.append(pr),pr.showModal()};return X`
1998
2165
  <bim-panel>
1999
- ${e?K`
2000
- <bim-panel-section label="Information" icon="ph:info-bold">
2166
+ ${t?X`
2167
+ <bim-panel-section label="Information" icon="ph:info-bold" collapsed>
2001
2168
  <div>
2002
2169
  <bim-label>Title</bim-label>
2003
- <bim-label style="--bim-label--c: var(--bim-ui_bg-contrast-100)">${e.title}</bim-label>
2170
+ <bim-label style="--bim-label--c: var(--bim-ui_bg-contrast-100)">${t.title}</bim-label>
2004
2171
  </div>
2005
2172
  <div>
2006
2173
  <bim-label>Description</bim-label>
2007
- <bim-label style="--bim-label--c: var(--bim-ui_bg-contrast-100)">${e.description}</bim-label>
2174
+ <bim-label style="--bim-label--c: var(--bim-ui_bg-contrast-100)">${t.description}</bim-label>
2008
2175
  </div>
2009
2176
  <div style="display: flex; gap: 0.375rem">
2010
2177
  <bim-label>Status</bim-label>
2011
- <bim-label .icon=${c==null?void 0:c.icon} style=${He({...So,...c==null?void 0:c.style})}
2012
- >${e.status}
2178
+ <bim-label .icon=${f==null?void 0:f.icon} style=${xe({...xo,...f==null?void 0:f.style})}
2179
+ >${t.status}
2013
2180
  </bim-label>
2014
2181
  </div>
2015
2182
  <div style="display: flex; gap: 0.375rem">
2016
2183
  <bim-label>Type</bim-label>
2017
- <bim-label .icon=${l==null?void 0:l.icon} style=${He({...So,...l==null?void 0:l.style})}
2018
- >${e.type}
2184
+ <bim-label .icon=${u==null?void 0:u.icon} style=${xe({...xo,...u==null?void 0:u.style})}
2185
+ >${t.type}
2019
2186
  </bim-label>
2020
2187
  </div>
2021
- ${e.priority?K`
2188
+ ${t.priority?X`
2022
2189
  <div style="display: flex; gap: 0.375rem">
2023
2190
  <bim-label>Priority</bim-label>
2024
- <bim-label .icon=${a==null?void 0:a.icon} style=${He({...So,...a==null?void 0:a.style})}
2025
- >${e.priority}
2191
+ <bim-label .icon=${d==null?void 0:d.icon} style=${xe({...xo,...d==null?void 0:d.style})}
2192
+ >${t.priority}
2026
2193
  </bim-label>
2027
2194
  </div>`:null}
2028
2195
  <div style="display: flex; gap: 0.375rem">
2029
2196
  <bim-label>Author</bim-label>
2030
- ${Fo(e.creationAuthor,t)}
2197
+ ${No(t.creationAuthor,i)}
2031
2198
  </div>
2032
- ${e.assignedTo?K`
2199
+ ${t.assignedTo?X`
2033
2200
  <div style="display: flex; gap: 0.375rem">
2034
2201
  <bim-label>Assignee</bim-label>
2035
- ${Fo(e.assignedTo,t)}
2202
+ ${No(t.assignedTo,i)}
2036
2203
  </div>`:null}
2037
- ${e.dueDate?K`
2204
+ ${t.dueDate?X`
2038
2205
  <div style="display: flex; gap: 0.375rem">
2039
2206
  <bim-label>Due Date</bim-label>
2040
- <bim-label style="--bim-label--c: var(--bim-ui_bg-contrast-100)">${e.dueDate.toDateString()}</bim-label>
2207
+ <bim-label style="--bim-label--c: var(--bim-ui_bg-contrast-100)">${t.dueDate.toDateString()}</bim-label>
2041
2208
  </div>`:null}
2042
- ${e.modifiedAuthor?K`
2209
+ ${t.modifiedAuthor?X`
2043
2210
  <div style="display: flex; gap: 0.375rem">
2044
2211
  <bim-label>Modified By</bim-label>
2045
- ${Fo(e.modifiedAuthor,t)}
2212
+ ${No(t.modifiedAuthor,i)}
2046
2213
  </div>`:null}
2047
- ${e.modifiedDate?K`
2214
+ ${t.modifiedDate?X`
2048
2215
  <div style="display: flex; gap: 0.375rem">
2049
2216
  <bim-label>Modified Date</bim-label>
2050
- <bim-label style="--bim-label--c: var(--bim-ui_bg-contrast-100)">${e.modifiedDate.toDateString()}</bim-label>
2217
+ <bim-label style="--bim-label--c: var(--bim-ui_bg-contrast-100)">${t.modifiedDate.toDateString()}</bim-label>
2051
2218
  </div>`:null}
2052
- ${e.labels.size!==0?K`
2219
+ ${t.labels.size!==0?X`
2053
2220
  <div style="display: flex; gap: 0.375rem">
2054
2221
  <bim-label>Labels</bim-label>
2055
- <bim-label style="--bim-label--c: var(--bim-ui_bg-contrast-100)">${[...e.labels].join(", ")}</bim-label>
2222
+ <bim-label style="--bim-label--c: var(--bim-ui_bg-contrast-100)">${[...t.labels].join(", ")}</bim-label>
2056
2223
  </div>`:null}
2057
- <bim-button @click=${()=>{i&&i(e)}} label="Update Information" icon="tabler:refresh"></bim-button>
2224
+ ${a.update?X`
2225
+ <bim-button @click=${()=>{s&&s(t)}} label="Update Information" icon="tabler:refresh"></bim-button>
2226
+ `:null}
2058
2227
  </bim-panel-section>
2059
- <bim-panel-section label="Comments" icon="mdi:comments-outline">${h}</bim-panel-section>
2060
- <bim-panel-section label="Viewpoints" icon="tabler:camera"></bim-panel-section>
2061
- `:K`<bim-label>No topic selected!</bim-label>`}
2228
+ <bim-panel-section label="Comments" icon="majesticons:comment-line">
2229
+ ${p}
2230
+ ${a.addComments?X`
2231
+ <bim-button @click=${I} label="Add Comment" icon="majesticons:comment-line"></bim-button>
2232
+ `:null}
2233
+ </bim-panel-section>
2234
+ <bim-panel-section label="Viewpoints" icon="tabler:camera">
2235
+ ${m}
2236
+ ${a.linkViewpoints||a.addViewpoints?X`
2237
+ <div style="display: flex; gap: 0.375rem">
2238
+ ${a.addViewpoints?X`<bim-button @click=${g} .disabled=${!o} label="Add Viewpoint" icon="mi:add"></bim-button> `:null}
2239
+ ${a.linkViewpoints?X`<bim-button @click=${T} label="Link Viewpoint" icon="tabler:camera"></bim-button>`:null}
2240
+ </div>
2241
+ `:null}
2242
+ </bim-panel-section>
2243
+ <!-- <bim-panel-section label="Related Topics" icon="material-symbols:topic-outline">
2244
+ ${E}
2245
+ ${a.linkViewpoints?X`
2246
+ <bim-button @click=${b} label="Link Topic" icon="material-symbols:topic-outline"></bim-button>
2247
+ `:null}
2248
+ </bim-panel-section> -->
2249
+ `:X`<bim-label>No topic selected!</bim-label>`}
2062
2250
  </bim-panel>
2063
- `},rE=(n,e=!0)=>{const t=Vr.create(nE,n);if(e){const{components:i}=n,[s,r]=t;i.get(Dt).list.onItemUpdated.add(({value:a})=>{const{topic:l}=r(),{guid:c}=a;c===(l==null?void 0:l.guid)&&r()})}return t},Wn={users:{"jhon.doe@example.com":{name:"Jhon Doe"}},priorities:{"On hold":{icon:"flowbite:circle-pause-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#767676"}},Minor:{icon:"mingcute:arrows-down-fill",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#4CAF50"}},Normal:{icon:"fa6-solid:grip-lines",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Major:{icon:"mingcute:arrows-up-fill",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Critical:{icon:"ph:warning",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}}},statuses:{Active:{icon:"prime:circle-fill",style:{backgroundColor:"#414141"}},"In Progress":{icon:"prime:circle-fill",style:{backgroundColor:"#fa89004d","--bim-label--c":"#FB8C00","--bim-icon--c":"#FB8C00"}},"In Review":{icon:"prime:circle-fill",style:{backgroundColor:"#9c6bff4d","--bim-label--c":"#9D6BFF","--bim-icon--c":"#9D6BFF"}},Done:{icon:"prime:circle-fill",style:{backgroundColor:"#4CAF504D","--bim-label--c":"#4CAF50","--bim-icon--c":"#4CAF50"}},Closed:{icon:"prime:circle-fill",style:{backgroundColor:"#414141","--bim-label--c":"#727272","--bim-icon--c":"#727272"}}},types:{Clash:{icon:"gg:close-r",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Issue:{icon:"mdi:bug-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Failure:{icon:"mdi:bug-outline",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Inquiry:{icon:"majesticons:comment-line",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Fault:{icon:"ph:warning",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FF5252"}},Remark:{icon:"ph:note-blank-bold",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#FB8C00"}},Request:{icon:"mynaui:edit-one",style:{backgroundColor:"var(--bim-ui_bg-contrast-20)","--bim-icon--c":"#9D6BFF"}}}},Oo={padding:"0.25rem 0.5rem",borderRadius:"999px","--bim-label--c":"white"},Ec=(n,e)=>{const i=((e==null?void 0:e.users)??Wn.users)[n],s=(i==null?void 0:i.name)??n,r=s.trim().split(/\s+/);let o,a;return r[0]&&r[0][0]&&(o=r[0][0].toUpperCase(),r[0][1]&&(a=r[0][1].toUpperCase())),r[1]&&r[1][0]&&(a=r[1][0].toUpperCase()),K`
2064
- <div style="display: flex; gap: 0.25rem; overflow: hidden;">
2065
- ${!(i!=null&&i.picture)&&(o||a)?K`
2066
- <bim-label
2067
- style=${He({borderRadius:"999px",padding:"0.375rem",backgroundColor:"var(--bim-ui_bg-contrast-20)",aspectRatio:"1",fontSize:"0.7rem"})}>${o}${a}</bim-label>
2068
- `:null}
2069
- <bim-label .img=${i==null?void 0:i.picture}>${s}</bim-label>
2070
- </div>
2071
- `};let Me;const oE=n=>{const{components:e,styles:t,onTopicEnter:i}=n,s=e.get(Dt),r=n.topics??s.list.values();return Me||(Me=document.createElement("bim-table"),Me.hiddenColumns=["Guid"],Me.columns=["Title"],Me.selectableRows=!0),Me.dataTransform={Title:(o,a)=>{const{Guid:l}=a;if(typeof l!="string")return o;const c=s.list.get(l);return c?K`
2072
- <div style="display: flex; overflow: hidden;">
2073
- <style>
2074
- #BBETO {
2075
- background-color: transparent
2076
- }
2077
-
2078
- #BBETO:hover {
2079
- --bim-label--c: var(--bim-ui_accent-base)
2080
- }
2081
- </style>
2082
- <bim-button @click=${()=>{i&&i(c)}} id="BBETO" icon="iconamoon:enter-duotone"></bim-button>
2083
- <bim-label>${o}</bim-label>
2084
- </div>`:o},Priority:o=>{if(typeof o!="string")return o;const l=((t==null?void 0:t.priorities)??Wn.priorities)[o];return K`
2085
- <bim-label
2086
- .icon=${l==null?void 0:l.icon}
2087
- style=${He({...Oo,...l==null?void 0:l.style})}
2088
- >${o}
2089
- </bim-label>
2090
- `},Status:o=>{if(typeof o!="string")return o;const l=((t==null?void 0:t.statuses)??Wn.statuses)[o];return K`
2091
- <bim-label
2092
- .icon=${l==null?void 0:l.icon}
2093
- style=${He({...Oo,...l==null?void 0:l.style})}
2094
- >${o}
2095
- </bim-label>
2096
- `},Type:o=>{if(typeof o!="string")return o;const l=((t==null?void 0:t.types)??Wn.types)[o];return K`
2097
- <bim-label
2098
- .icon=${l==null?void 0:l.icon}
2099
- style=${He({...Oo,...l==null?void 0:l.style})}
2100
- >${o}
2101
- </bim-label>
2102
- `},Author:o=>typeof o!="string"?o:Ec(o,t),Assignee:o=>typeof o!="string"?o:Ec(o,t)},Me.data=[...r].map(o=>{var a;return{data:{Guid:o.guid,Title:o.title,Status:o.status,Description:o.description??"",Author:o.creationAuthor,Assignee:o.assignedTo??"",Date:o.creationDate.toDateString(),DueDate:((a=o.dueDate)==null?void 0:a.toDateString())??"",Type:o.type,Priority:o.priority??""}}}),K`${Me}`},aE=(n,e=!0)=>{const t=Vr.create(oE,n);if(e){const{components:i}=n,s=i.get(Dt),[,r]=t;s.list.onItemSet.add(()=>r()),s.list.onItemDeleted.add(()=>r()),s.list.onItemUpdated.add(()=>r())}return t};class Dt extends Ot{constructor(){super(...arguments);y(this,"enabled",!1);y(this,"_xmlParser",new Bp.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}));y(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});y(this,"list",new Bs);y(this,"onSetup",new Q);y(this,"isSetup",!1);y(this,"onBCFImported",new Q);y(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 i=new zs(this.components);return t&&(i.guid=t.guid??i.guid,i.set(t)),this.list.set(i.guid,i),i}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get usedTypes(){const t=[...this.list].map(([i,s])=>s.type);return new Set(t)}get usedStatuses(){const t=[...this.list].map(([i,s])=>s.status);return new Set(t)}get usedPriorities(){const t=[...this.list].map(([i,s])=>s.priority).filter(i=>i);return new Set(t)}get usedStages(){const t=[...this.list].map(([i,s])=>s.stage).filter(i=>i);return new Set(t)}get usedUsers(){const t=[];for(const[i,s]of this.list){t.push(s.creationAuthor),s.assignedTo&&t.push(s.assignedTo),s.modifiedAuthor&&t.push(s.modifiedAuthor);for(const r of s.comments)t.push(r.author),r.modifiedAuthor&&t.push(r.modifiedAuthor)}return new Set(t)}get usedLabels(){const t=[];for(const[i,s]of this.list)t.push(...s.labels);return new Set(t)}updateExtensions(){for(const[t,i]of this.list){for(const s of i.labels)this.config.labels.add(s);this.config.types.add(i.type),i.priority&&this.config.priorities.add(i.priority),i.stage&&this.config.stages.add(i.stage),this.config.statuses.add(i.status),this.config.users.add(i.creationAuthor),i.assignedTo&&this.config.users.add(i.assignedTo),i.modifiedAuthor&&this.config.users.add(i.modifiedAuthor);for(const s of i.comments)this.config.users.add(s.author),s.modifiedAuthor&&this.config.users.add(s.modifiedAuthor)}}async export(t=this.list.values()){const i=new bl;i.file("bcf.version",`<?xml version="1.0" encoding="UTF-8"?>
2251
+ `},bE=(r,e=!0)=>{const t=Ae.create(EE,r);if(e){const{components:i}=r,[s,n]=t;i.get(Mt).list.onItemUpdated.add(({value:a})=>{const{topic:l}=n(),{guid:c}=a;c===(l==null?void 0:l.guid)&&n()})}return t};class Mt extends Ot{constructor(){super(...arguments);y(this,"enabled",!1);y(this,"_xmlParser",new Hp.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}));y(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});y(this,"list",new pi);y(this,"onSetup",new K);y(this,"isSetup",!1);y(this,"onBCFImported",new K);y(this,"onDisposed",new K)}setup(t){this.isSetup||(this.config={...this.config,...t},this.isSetup=!0,this.enabled=!0,this.onSetup.trigger())}create(t){const i=new Gs(this.components);return t&&(i.guid=t.guid??i.guid,i.set(t)),this.list.set(i.guid,i),i}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get usedTypes(){const t=[...this.list].map(([i,s])=>s.type);return new Set(t)}get usedStatuses(){const t=[...this.list].map(([i,s])=>s.status);return new Set(t)}get usedPriorities(){const t=[...this.list].map(([i,s])=>s.priority).filter(i=>i);return new Set(t)}get usedStages(){const t=[...this.list].map(([i,s])=>s.stage).filter(i=>i);return new Set(t)}get usedUsers(){const t=[];for(const[i,s]of this.list){t.push(s.creationAuthor),s.assignedTo&&t.push(s.assignedTo),s.modifiedAuthor&&t.push(s.modifiedAuthor);for(const[n,o]of s.comments)t.push(o.author),o.modifiedAuthor&&t.push(o.modifiedAuthor)}return new Set(t)}get usedLabels(){const t=[];for(const[i,s]of this.list)t.push(...s.labels);return new Set(t)}updateExtensions(){for(const[t,i]of this.list){for(const s of i.labels)this.config.labels.add(s);this.config.types.add(i.type),i.priority&&this.config.priorities.add(i.priority),i.stage&&this.config.stages.add(i.stage),this.config.statuses.add(i.status),this.config.users.add(i.creationAuthor),i.assignedTo&&this.config.users.add(i.assignedTo),i.modifiedAuthor&&this.config.users.add(i.modifiedAuthor);for(const[s,n]of i.comments)this.config.users.add(n.author),n.modifiedAuthor&&this.config.users.add(n.modifiedAuthor)}}updateViewpointReferences(){const t=this.components.get(Ht);for(const[i,s]of this.list)for(const n of s.viewpoints)t.list.has(n)||s.viewpoints.delete(n)}async export(t=this.list.values()){const i=new Tl;i.file("bcf.version",`<?xml version="1.0" encoding="UTF-8"?>
2103
2252
  <Version VersionId="${this.config.version}" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/buildingSMART/BCF-XML/release_3_0/Schemas/version.xsd"
2104
2253
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2105
- </Version>`),i.file("bcf.extensions",this.serializeExtensions());const r=await(await fetch("https://thatopen.github.io/engine_components/resources/favicon.ico")).blob();for(const a of t){const l=i.folder(a.guid);l.file("markup.bcf",a.serialize());for(const c of a.viewpoints)l.file(`${c.guid}.jpeg`,r,{binary:!0}),l.file(`${c.guid}.bcfv`,await c.serialize())}return await i.generateAsync({type:"blob"})}serializeExtensions(){const t=[...this.config.types].map(l=>`<TopicType>${l}</TopicType>`).join(`
2254
+ </Version>`),i.file("bcf.extensions",this.serializeExtensions());const n=await(await fetch("https://thatopen.github.io/engine_components/resources/favicon.ico")).blob(),o=this.components.get(Ht);for(const l of t){const c=i.folder(l.guid);c.file("markup.bcf",l.serialize());for(const h of l.viewpoints){const d=o.list.get(h);d&&(c.file(`${h}.jpeg`,n,{binary:!0}),c.file(`${h}.bcfv`,await d.serialize()))}}return await i.generateAsync({type:"blob"})}serializeExtensions(){const t=[...this.config.types].map(l=>`<TopicType>${l}</TopicType>`).join(`
2106
2255
  `),i=[...this.config.statuses].map(l=>`<TopicStatus>${l}</TopicStatus>`).join(`
2107
2256
  `),s=[...this.config.priorities].map(l=>`<Priority>${l}</Priority>`).join(`
2108
- `),r=[...this.config.labels].map(l=>`<TopicLabel>${l}</TopicLabel>`).join(`
2257
+ `),n=[...this.config.labels].map(l=>`<TopicLabel>${l}</TopicLabel>`).join(`
2109
2258
  `),o=[...this.config.stages].map(l=>`<Stage>${l}</Stage>`).join(`
2110
2259
  `),a=[...this.config.users].map(l=>`<User>${l}</User>`).join(`
2111
2260
  `);return`
@@ -2120,8 +2269,8 @@ ${i}
2120
2269
  ${s.length!==0?`<Priorities>
2121
2270
  ${s}
2122
2271
  </Priorities>`:""}
2123
- ${r.length!==0?`<TopicLabels>
2124
- ${r}
2272
+ ${n.length!==0?`<TopicLabels>
2273
+ ${n}
2125
2274
  </TopicLabels>`:""}
2126
2275
  ${o.length!==0?`<Stages>
2127
2276
  ${o}
@@ -2130,9 +2279,9 @@ ${o}
2130
2279
  ${a}
2131
2280
  </Users>`:""}
2132
2281
  </Extensions>
2133
- `}processMarkupComment(t){const{Guid:i,Date:s,Author:r,Comment:o,Viewpoint:a}=t;if(!(i&&s&&r&&(Kn||a)))return null;const l=this.components.get(Qs),c=new Kn(this.components,o??"");return c.guid=i,c.date=new Date(s),c.author=r,c.viewpoint=a!=null&&a.Guid?l.list.get(a.Guid):void 0,c.modifiedAuthor=t.ModifiedAuthor,c.modifiedDate=t.ModifiedDate?new Date(t.ModifiedDate):void 0,c}getMarkupComments(t,i){var a;let s;if(i==="2.1"&&(s=t.Comment),i==="3"&&(s=(a=t.Topic.Comments)==null?void 0:a.Comment),!s)return[];s=Array.isArray(s)?s:[s];const r=s.map(l=>this.processMarkupComment(l)).filter(l=>l);return Array.isArray(r)?r:[r]}getMarkupLabels(t,i){var o;let s;return i==="2.1"&&(s=t.Topic.Labels),i==="3"&&(s=(o=t.Topic.Labels)==null?void 0:o.Label),s?Array.isArray(s)?s:[s]:[]}getMarkupViewpoints(t,i){var r;let s;return i==="2.1"&&(s=t.Viewpoints),i==="3"&&(s=(r=t.Topic.Viewpoints)==null?void 0:r.ViewPoint),s?(s=Array.isArray(s)?s:[s],s):[]}getMarkupRelatedTopics(t,i){var o;let s;return i==="2.1"&&(s=t.Topic.RelatedTopic),i==="3"&&(s=(o=t.Topic.RelatedTopics)==null?void 0:o.RelatedTopic),s?(Array.isArray(s)?s:[s]).map(a=>a.Guid):[]}async load(t,i){var E;const{fallbackVersionOnImport:s,ignoreIncompleteTopicsOnImport:r}=this.config,o=new bl;await o.loadAsync(i);const a=Object.values(o.files);let l=s;const c=a.find(g=>g.name.endsWith(".version"));if(c){const g=await c.async("string"),b=this._xmlParser.parse(g).Version.VersionId;l=String(b)}if(!(l&&(l==="2.1"||l==="3")))throw new Error(`BCFTopics: ${l} is not supported.`);const h=[],d=this.components.get(Qs),u=a.filter(g=>g.name.endsWith(".bcfv"));for(const g of u){const b=await g.async("string"),v=this._xmlParser.parse(b).VisualizationInfo;if(!v){console.warn("Missing VisualizationInfo in Viewpoint");continue}const I={},{Guid:T,ClippingPlanes:A,Components:R,OrthogonalCamera:P,PerspectiveCamera:F}=v;if(T&&(I.guid=T),R){const{Selection:D,Visibility:w}=R;if(D&&D.Component){const C=Array.isArray(D.Component)?D.Component:[D.Component];I.selectionComponents=C.map(U=>U.IfcGuid).filter(U=>U)}if(w&&"DefaultVisibility"in w&&(I.defaultVisibility=w.DefaultVisibility),w&&w.Exceptions&&"Component"in w.Exceptions){const{Component:C}=w.Exceptions,U=Array.isArray(C)?C:[C];I.exceptionComponents=U.map(Z=>Z.IfcGuid).filter(Z=>Z)}let L;l==="2.1"&&(L=R.ViewSetupHints),l==="3"&&(L=(E=R.Visibility)==null?void 0:E.ViewSetupHints),L&&("OpeningsVisible"in L&&(I.openingsVisible=L.OpeningsVisible),"SpacesVisible"in L&&(I.spacesVisible=L.SpacesVisible),"SpaceBoundariesVisible"in L&&(I.spaceBoundariesVisible=L.SpaceBoundariesVisible))}if(P||F){const D=v.PerspectiveCamera??v.OrthogonalCamera,{CameraViewPoint:w,CameraDirection:L}=D,C=new M.Vector3(Number(w.X),Number(w.Z),Number(-w.Y)),U=new M.Vector3(Number(L.X),Number(L.Z),Number(-L.Y)),Z={position:{x:C.x,y:C.y,z:C.z},direction:{x:U.x,y:U.y,z:U.z},aspectRatio:"AspectRatio"in D?D.AspectRatio:1};"ViewToWorldScale"in D&&(I.camera={...Z,viewToWorldScale:D.ViewToWorldScale}),"FieldOfView"in D&&(I.camera={...Z,fov:D.FieldOfView})}const x=d.create(t,I);if(h.push(x),A){const D=this.components.get(Qn),w=Array.isArray(A.ClippingPlane)?A.ClippingPlane:[A.ClippingPlane];for(const L of w){const{Location:C,Direction:U}=L;if(!(C&&U))continue;const Z=new M.Vector3(C.X,C.Z,-C.Y),H=new M.Vector3(U.X,-U.Z,U.Y),st=D.createFromNormalAndCoplanarPoint(t,H,Z);st.visible=!1,st.enabled=!1,x.clippingPlanes.add(st)}}}const f={},p=[],m=a.filter(g=>g.name.endsWith(".bcf"));for(const g of m){const b=await g.async("string"),v=this._xmlParser.parse(b).Markup,I=v.Topic,{Guid:T,Type:A,Status:R,Title:P,CreationDate:F,CreationAuthor:x}=I;if(r&&!(T&&A&&R&&P&&F&&x))continue;const D=new zs(this.components);D.guid=T??D.guid;const w=this.getMarkupRelatedTopics(v,l);f[D.guid]=new Set(w),D.type=A??D.type,D.status=R??D.status,D.title=P??D.title,D.creationDate=F?new Date(F):D.creationDate,D.creationAuthor=x??D.creationAuthor,D.serverAssignedId=I.ServerAssignedId,D.priority=I.Priority,D.index=I.Index,D.modifiedDate=I.ModifiedDate?new Date(I.ModifiedDate):void 0,D.modifiedAuthor=I.ModifiedAuthor,D.dueDate=I.DueDate?new Date(I.DueDate):void 0,D.assignedTo=I.AssignedTo,D.description=I.Description,D.stage=I.Stage;const L=this.getMarkupLabels(v,l);for(const Z of L)D.labels.add(Z);const C=this.getMarkupComments(v,l);for(const Z of C)D.comments.add(Z);const U=this.getMarkupViewpoints(v,l);for(const Z of U){if(!(Z&&Z.Guid))continue;const H=d.list.get(Z.Guid);H&&(H.name=D.title,D.viewpoints.add(H))}this.list.set(D.guid,D),p.push(D)}for(const g in f){const b=this.list.get(g);if(!b)continue;const v=f[g];for(const I of v){const T=this.list.get(I);T&&b.relatedTopics.add(T)}}return this.onBCFImported.trigger(p),{viewpoints:h,topics:p}}}y(Dt,"uuid","de977976-e4f6-4e4f-a01a-204727839802");const de=class de extends Ot{constructor(t){super(t);y(this,"enabled",!0);y(this,"onDisposed",new Q);y(this,"_absoluteMin");y(this,"_absoluteMax");y(this,"_meshes",[]);this.components.add(de.uuid,this),this._absoluteMin=de.newBound(!0),this._absoluteMax=de.newBound(!1)}static getDimensions(t){const{min:i,max:s}=t,r=Math.abs(s.x-i.x),o=Math.abs(s.y-i.y),a=Math.abs(s.z-i.z),l=new M.Vector3;return l.subVectors(s,i).divideScalar(2).add(i),{width:r,height:o,depth:a,center:l}}static newBound(t){const i=t?1:-1;return new M.Vector3(i*Number.MAX_VALUE,i*Number.MAX_VALUE,i*Number.MAX_VALUE)}static getBounds(t,i,s){const r=s||this.newBound(!1),o=i||this.newBound(!0);for(const a of t)a.x<o.x&&(o.x=a.x),a.y<o.y&&(o.y=a.y),a.z<o.z&&(o.z=a.z),a.x>r.x&&(r.x=a.x),a.y>r.y&&(r.y=a.y),a.z>r.z&&(r.z=a.z);return new M.Box3(i,s)}dispose(){const t=this.components.get(Se);for(const i of this._meshes)t.destroy(i);this._meshes=[],this.onDisposed.trigger(de.uuid),this.onDisposed.reset()}get(){const t=this._absoluteMin.clone(),i=this._absoluteMax.clone();return new M.Box3(t,i)}getSphere(){const t=this._absoluteMin.clone(),i=this._absoluteMax.clone(),s=Math.abs((i.x-t.x)/2),r=Math.abs((i.y-t.y)/2),o=Math.abs((i.z-t.z)/2),a=new M.Vector3(t.x+s,t.y+r,t.z+o),l=a.distanceTo(t);return new M.Sphere(a,l)}getMesh(){const t=new M.Box3(this._absoluteMin,this._absoluteMax),i=de.getDimensions(t),{width:s,height:r,depth:o,center:a}=i,l=new M.BoxGeometry(s,r,o),c=new M.Mesh(l);return this._meshes.push(c),c.position.copy(a),c}reset(){this._absoluteMin=de.newBound(!0),this._absoluteMax=de.newBound(!1)}add(t){for(const i of t.items)this.addMesh(i.mesh)}addMesh(t,i){if(!t.geometry.index)return;const s=de.getFragmentBounds(t);t.updateMatrixWorld();const r=t.matrixWorld,o=new M.Matrix4,a=t instanceof M.InstancedMesh,l=new Set;if(t instanceof $e.FragmentMesh){i||(i=t.fragment.ids);for(const c of i){const h=t.fragment.getInstancesIDs(c);if(h)for(const d of h)l.add(d)}}else l.add(0);for(const c of l){const h=s.min.clone(),d=s.max.clone();a&&(t.getMatrixAt(c,o),h.applyMatrix4(o),d.applyMatrix4(o)),h.applyMatrix4(r),d.applyMatrix4(r),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 i=this.components.get(St);for(const s in t){const r=i.list.get(s);if(!r)continue;const o=t[s];this.addMesh(r.mesh,o)}}static getFragmentBounds(t){const i=t.geometry.attributes.position,s=Number.MAX_VALUE,r=-s,o=new M.Vector3(s,s,s),a=new M.Vector3(r,r,r);if(!t.geometry.index)throw new Error("Geometry must be indexed!");const l=Array.from(t.geometry.index.array);for(let c=0;c<l.length;c++){if(c%3===0&&l[c]===0&&l[c+1]===0&&l[c+2]===0){c+=2;continue}const h=l[c],d=i.getX(h),u=i.getY(h),f=i.getZ(h);d<o.x&&(o.x=d),u<o.y&&(o.y=u),f<o.z&&(o.z=f),d>a.x&&(a.x=d),u>a.y&&(a.y=u),f>a.z&&(a.z=f)}return new M.Box3(o,a)}};y(de,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let dr=de;const Pa=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]),yr=class yr extends Ot{constructor(t){super(t);y(this,"enabled",!0);t.add(yr.uuid,this)}async export(t,i,s=!1,r=!0){const o={},a=new Set(t.GetIfcEntityList(i)),l=new Set([tt.IFCPROJECT,tt.IFCSITE,tt.IFCBUILDING,tt.IFCBUILDINGSTOREY,tt.IFCSPACE]);for(const c of l)a.add(c);for(const c of a){if(Pa.has(c))continue;const h=l.has(c)&&r,d=t.GetLineIDsWithType(i,c);for(const u of d){const f=t.GetLine(0,u,h,s);o[f.expressID]=f}}return o}};y(yr,"uuid","b32c4332-cd67-436e-ba7f-196646c7a635");let ur=yr;const Sd={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 lE{getAll(e,t){const i={},s=Object.keys(Sd).map(r=>parseInt(r,10));for(let r=0;r<s.length;r++){const o=s[r],a=e.GetLineIDsWithType(t,o),l=a.size();for(let c=0;c<l;c++)i[a.get(c)]=o}return i}}const La={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 Ge{static async getUnits(e){var o,a,l;const{IFCUNITASSIGNMENT:t}=tt,i=await e.getAllPropertiesOfType(t);if(!i)return 1;const s=Object.keys(i),r=i[parseInt(s[0],10)];for(const c of r.Units){if(c.value===void 0||c.value===null)continue;const h=await e.getProperties(c.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),((o=h.Prefix)==null?void 0:o.value)==="MILLI"?u=.001:((a=h.Prefix)==null?void 0:a.value)==="CENTI"?u=.01:((l=h.Prefix)==null?void 0:l.value)==="DECI"&&(u=.1),f*u}return 1}static async findItemByGuid(e,t){var s;const i=e.getAllPropertiesIDs();for(const r of i){const o=await e.getProperties(r);if(o&&((s=o.GlobalId)==null?void 0:s.value)===t)return o}return null}static async getRelationMap(e,t,i){var l;const r=i??(async()=>{}),o={},a=e.getAllPropertiesIDs();for(const c of a){const h=await e.getProperties(c);if(!h)continue;const d=h.type===t,u=Object.keys(h).find(g=>g.startsWith("Relating")),f=Object.keys(h).find(g=>g.startsWith("Related"));if(!(d&&u&&f))continue;const p=await e.getProperties((l=h[u])==null?void 0:l.value),m=h[f];if(!p||!m||!(m&&Array.isArray(m)))continue;const E=m.map(g=>g.value);await r(p.expressID,E),o[p.expressID]=E}return o}static async getQsetQuantities(e,t,i){const r=i??(()=>{}),o=await e.getProperties(t);return!o||o.type!==tt.IFCELEMENTQUANTITY?null:(o.Quantities??[{}]).map(c=>(c.value&&r(c.value),c.value)).filter(c=>c!==null)}static async getPsetProps(e,t,i){const r=i??(()=>{}),o=await e.getProperties(t);return!o||o.type!==tt.IFCPROPERTYSET?null:(o.HasProperties??[{}]).map(c=>(c.value&&r(c.value),c.value)).filter(c=>c!==null)}static async getPsetRel(e,t){var a;if(!await e.getProperties(t))return null;const s=await e.getAllPropertiesOfType(tt.IFCRELDEFINESBYPROPERTIES);if(!s)return null;const r=Object.values(s);let o=null;for(const l of r)((a=l.RelatingPropertyDefinition)==null?void 0:a.value)===t&&(o=l.expressID);return o}static async getQsetRel(e,t){return Ge.getPsetRel(e,t)}static async getEntityName(e,t){var o;const i=await e.getProperties(t);if(!i)return{key:null,name:null};const s=Object.keys(i).find(a=>a.endsWith("Name"))??null,r=s?(o=i[s])==null?void 0:o.value:null;return{key:s,name:r}}static async getQuantityValue(e,t){const i=await e.getProperties(t);if(!i)return{key:null,value:null};const s=Object.keys(i).find(o=>o.endsWith("Value"))??null;let r;return s===null||i[s]===void 0||i[s]===null?r=null:r=i[s].value,{key:s,value:r}}static isRel(e){return La[e].startsWith("IFCREL")}static async attributeExists(e,t,i){const s=await e.getProperties(t);return s?Object.keys(s).includes(i):!1}static async groupEntitiesByType(e,t){var s;const i=new Map;for(const r of t){const o=await e.getProperties(r);if(!o)continue;const a=o.type;i.get(a)||i.set(a,new Set),(s=i.get(a))==null||s.add(r)}return i}}class cE{constructor(){y(this,"factor",1);y(this,"complement",1)}apply(e){const i=this.getScaleMatrix().multiply(e);e.copy(i)}setUp(e){var r,o,a;this.factor=1;const t=this.getLengthUnits(e);if(!t)return;const i=t==null,s=t.Name===void 0||t.Name===null;i||s||(t.Name.value==="FOOT"&&(this.factor=.3048),((r=t.Prefix)==null?void 0:r.value)==="MILLI"?this.complement=.001:((o=t.Prefix)==null?void 0:o.value)==="CENTI"?this.complement=.01:((a=t.Prefix)==null?void 0:a.value)==="DECI"&&(this.complement=.01))}getLengthUnits(e){try{const i=e.GetLineIDsWithType(0,tt.IFCUNITASSIGNMENT).get(0),s=e.GetLine(0,i);for(const r of s.Units){if(!r||r.value===null||r.value===void 0)continue;const o=e.GetLine(0,r.value);if(o.UnitType&&o.UnitType.value==="LENGTHUNIT")return o}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const e=this.factor;return new M.Matrix4().fromArray([e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1])}}class Fd{constructor(){y(this,"itemsByFloor",{});y(this,"_units",new cE)}setUp(e){this._units.setUp(e),this.cleanUp();try{const t=e.GetLineIDsWithType(0,tt.IFCRELCONTAINEDINSPATIALSTRUCTURE),i=new Set,s=e.GetLineIDsWithType(0,tt.IFCSPACE);for(let c=0;c<s.size();c++)i.add(s.get(c));const r=e.GetLineIDsWithType(0,tt.IFCRELAGGREGATES),o=r.size();for(let c=0;c<o;c++){const h=r.get(c),d=e.GetLine(0,h);if(!d||!d.RelatingObject||!d.RelatedObjects)continue;const u=d.RelatingObject.value,f=d.RelatedObjects;for(const p of f){const m=p.value;i.has(m)&&(this.itemsByFloor[m]=u)}}const a={},l=t.size();for(let c=0;c<l;c++){const h=t.get(c),d=e.GetLine(0,h);if(!d||!d.RelatingStructure||!d.RelatedElements)continue;const u=d.RelatingStructure.value,f=d.RelatedElements;if(i.has(u))for(const p of f){a[u]||(a[u]=[]);const m=p.value;a[u].push(m)}else for(const p of f){const m=p.value;this.itemsByFloor[m]=u}}for(const c in a){const h=this.itemsByFloor[c];if(h!==void 0){const d=a[c];for(const u of d)this.itemsByFloor[u]=h}}for(let c=0;c<o;c++){const h=r.get(c),d=e.GetLine(0,h);if(!d||!d.RelatingObject||!d.RelatedObjects)continue;const u=d.RelatingObject.value,f=d.RelatedObjects;for(const p of f){const m=p.value,E=this.itemsByFloor[u];E!==void 0&&(this.itemsByFloor[m]=E)}}}catch{console.log("Could not get floors.")}}cleanUp(){this.itemsByFloor={}}}class qr{constructor(){y(this,"includeProperties",!0);y(this,"optionalCategories",[tt.IFCSPACE]);y(this,"coordinate",!0);y(this,"wasm",{path:"",absolute:!1,logLevel:tt.LogLevel.LOG_LEVEL_OFF});y(this,"excludedCategories",new Set);y(this,"includedCategories",new Set);y(this,"saveLocations",!1);y(this,"webIfc",{COORDINATE_TO_ORIGIN:!0});y(this,"autoSetWasm",!0);y(this,"customLocateFileHandler",null)}}class Od{constructor(){y(this,"defLineMat",new M.LineBasicMaterial({color:16777215}))}read(e){const t=e.GetAllAlignments(0),i=e.GetAllCrossSections2D(0),s=e.GetAllCrossSections3D(0),r={IfcAlignment:t,IfcCrossSection2D:i,IfcCrossSection3D:s};return this.get(r)}get(e){if(e.IfcAlignment){const t=new Map;for(const i of e.IfcAlignment){const s=new $e.Alignment;s.absolute=this.getCurves(i.curve3D,s),s.horizontal=this.getCurves(i.horizontal,s),s.vertical=this.getCurves(i.vertical,s),t.set(t.size,s)}return{alignments:t,coordinationMatrix:new M.Matrix4}}}getCurves(e,t){const i=[];let s=0;for(const r of e){const o={};if(r.data)for(const u of r.data){const[f,p]=u.split(": "),m=parseFloat(p);o[f]=m||p}const{points:a}=r,l=new Float32Array(a.length*3);for(let u=0;u<a.length;u++){const{x:f,y:p,z:m}=a[u];l[u*3]=f,l[u*3+1]=p,l[u*3+2]=m||0}const c=new M.BufferAttribute(l,3),h=new M.EdgesGeometry;h.setAttribute("position",c);const d=new $e.CurveMesh(s,o,t,h,this.defLineMat);i.push(d.curve),s++}return i}}class xd{getNameInfo(e){var d;const t={},{arguments:i}=e.GetHeaderLine(0,tt.FILE_NAME)||{};if(!i)return t;const[s,r,o,a,l,c,h]=i;if(s!=null&&s.value&&(t.name=s.value),r!=null&&r.value&&(t.creationDate=new Date(r.value)),o){t.author={};const[u,f]=o;u!=null&&u.value&&(t.author.name=u.value),f!=null&&f.value&&(t.author.email=f.value)}return(d=a[0])!=null&&d.value&&(t.organization=a[0].value),l!=null&&l.value&&(t.preprocessorVersion=l==null?void 0:l.value),c!=null&&c.value&&(t.originatingSystem=c==null?void 0:c.value),h!=null&&h.value&&(t.authorization=h==null?void 0:h.value),t}getDescriptionInfo(e){var o;const t={},{arguments:i}=e.GetHeaderLine(0,tt.FILE_DESCRIPTION)||{};if(!i)return t;const[s,r]=i;if((o=s[0])!=null&&o.value){const a=s[0].value.match(/\[([^\]]+)\]/);a&&a[1]&&(t.viewDefinition=a[1])}return r!=null&&r.value&&(t.implementationLevel=r.value),t}}class Nd{static get(e,t){const i=[tt.IFCPROJECT,tt.IFCSITE,tt.IFCBUILDING,tt.IFCBUILDINGSTOREY,tt.IFCSPACE,tt.IFCROAD,tt.IFCFACILITY,tt.IFCFACILITYPART,tt.IFCBRIDGE],s=e.data;for(const r of i){const o=t.GetLineIDsWithType(0,r),a=o.size();for(let l=0;l<a;l++){const c=o.get(l);s.has(c)||s.set(c,[[],[0,r]])}}}}const ks=class ks extends Ot{constructor(t){super(t);y(this,"onDisposed",new Q);y(this,"onIfcStartedLoading",new Q);y(this,"onSetup",new Q);y(this,"settings",new qr);y(this,"webIfc",new tt.IfcAPI);y(this,"enabled",!0);y(this,"_material",new M.MeshLambertMaterial);y(this,"_spatialTree",new Fd);y(this,"_metaData",new xd);y(this,"_fragmentInstances",new Map);y(this,"_civil",new Od);y(this,"_visitedFragments",new Map);y(this,"_materialT",new M.MeshLambertMaterial({transparent:!0,opacity:.5}));this.components.add(ks.uuid,this),this.settings.excludedCategories.add(tt.IFCOPENINGELEMENT)}dispose(){this.webIfc=null,this.onDisposed.trigger(ks.uuid),this.onDisposed.reset()}async setup(t){this.settings={...this.settings,...t},this.settings.autoSetWasm&&await this.autoSetWasm(),this.onSetup.trigger()}async load(t,i=!0){const s=performance.now();this.onIfcStartedLoading.trigger(),await this.readIfcFile(t);const r=await this.getAllGeometries(),a=await this.components.get(ur).export(this.webIfc,0);r.setLocalProperties(a);const l=this.components.get(St);l.groups.set(r.uuid,r);for(const c of r.items)l.list.set(c.id,c),c.mesh.uuid=c.id,c.group=r;l.onFragmentsLoaded.trigger(r),i&&l.coordinate([r]);for(const[c]of r.data){const h=a[c];if(!h||!h.GlobalId)continue;const d=h.GlobalId.value||h.GlobalId;r.globalToExpressIDs.set(d,c)}return Nd.get(r,this.webIfc),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-s} ms!`),r}async readIfcFile(t){const{path:i,absolute:s,logLevel:r}=this.settings.wasm;return this.webIfc.SetWasmPath(i,s),await this.webIfc.Init(this.settings.customLocateFileHandler||void 0),r&&this.webIfc.SetLogLevel(r),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 tt.IfcAPI,this._visitedFragments.clear(),this._fragmentInstances.clear()}async getAllGeometries(){this._spatialTree.setUp(this.webIfc);const t=this.webIfc.GetIfcEntityList(0),i=new $e.FragmentsGroup;i.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 s=[];for(const o of t){if(!this.webIfc.IsIfcElement(o)&&o!==tt.IFCSPACE)continue;const a=this.settings.includedCategories;if(a.size>0&&!a.has(o))continue;if(this.settings.excludedCategories.has(o))continue;const l=this.webIfc.GetLineIDsWithType(0,o),c=l.size();for(let h=0;h<c;h++){const d=l.get(h);s.push(d);const u=this._spatialTree.itemsByFloor[d]||0;i.data.set(d,[[],[u,o]])}}this._spatialTree.cleanUp(),this.webIfc.StreamMeshes(0,s,o=>{this.getMesh(o,i)});for(const o of this._visitedFragments){const{index:a,fragment:l}=o[1];i.keyFragments.set(a,l.id)}for(const o of i.items){const a=this._fragmentInstances.get(o.id);if(!a)throw new Error("Fragment not found!");const l=[];for(const[c,h]of a)l.push(h);o.add(l)}const r=this.webIfc.GetCoordinationMatrix(0);return i.coordinationMatrix.fromArray(r),i.civilData=this._civil.read(this.webIfc),i}getMesh(t,i){const s=t.geometries.size(),r=t.expressID;for(let o=0;o<s;o++){const a=t.geometries.get(o),{x:l,y:c,z:h,w:d}=a.color,u=d!==1,{geometryExpressID:f}=a,p=`${f}-${u}`;if(!this._visitedFragments.has(p)){const T=this.getGeometry(this.webIfc,f),A=u?this._materialT:this._material,R=new $e.Fragment(T,A,1);i.add(R.mesh),i.items.push(R);const P=this._visitedFragments.size;this._visitedFragments.set(p,{index:P,fragment:R})}const m=new M.Color().setRGB(l,c,h,"srgb"),E=new M.Matrix4;E.fromArray(a.flatTransformation);const g=this._visitedFragments.get(p);if(g===void 0)throw new Error("Error getting geometry data for streaming!");const b=i.data.get(r);if(!b)throw new Error("Data not found!");b[0].push(g.index);const{fragment:v}=g;this._fragmentInstances.has(v.id)||this._fragmentInstances.set(v.id,new Map);const I=this._fragmentInstances.get(v.id);if(!I)throw new Error("Instances not found!");if(I.has(r)){const T=I.get(r);if(!T)throw new Error("Instance not found!");T.transforms.push(E),T.colors&&T.colors.push(m)}else I.set(r,{id:r,transforms:[E],colors:[m]})}}getGeometry(t,i){const s=t.GetGeometry(0,i),r=t.GetIndexArray(s.GetIndexData(),s.GetIndexDataSize()),o=t.GetVertexArray(s.GetVertexData(),s.GetVertexDataSize()),a=new Float32Array(o.length/2),l=new Float32Array(o.length/2);for(let u=0;u<o.length;u+=6)a[u/2]=o[u],a[u/2+1]=o[u+1],a[u/2+2]=o[u+2],l[u/2]=o[u+3],l[u/2+1]=o[u+4],l[u/2+2]=o[u+5];const c=new M.BufferGeometry,h=new M.BufferAttribute(a,3),d=new M.BufferAttribute(l,3);return c.setAttribute("position",h),c.setAttribute("normal",d),c.setIndex(Array.from(r)),s.delete(),c}async autoSetWasm(){const t=await fetch(`https://unpkg.com/@thatopen/components@${Xn.release}/package.json`);if(!t.ok){console.warn("Couldn't get openbim-components package.json. Set wasm settings manually.");return}const i=await t.json();if(!("web-ifc"in i.peerDependencies))console.warn("Couldn't get web-ifc from peer dependencies in openbim-components. Set wasm settings manually.");else{const s=i.peerDependencies["web-ifc"];this.settings.wasm.path=`https://unpkg.com/web-ifc@${s}/`,this.settings.wasm.absolute=!0}}};y(ks,"uuid","a659add7-1418-4771-a0d6-7d4d438e4624");let fr=ks;const ke=class ke extends Ot{constructor(t){super(t);y(this,"onDisposed",new Q);y(this,"onRequestFile",new Q);y(this,"ifcToExport",null);y(this,"onElementToPset",new Q);y(this,"onPropToPset",new Q);y(this,"onPsetRemoved",new Q);y(this,"onDataChanged",new Q);y(this,"wasm",{path:"/",absolute:!1});y(this,"enabled",!0);y(this,"attributeListeners",{});y(this,"selectedModel");y(this,"changeMap",{});this.components.add(ke.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(ke.uuid),this.onDisposed.reset()}static getIFCSchema(t){const i=t.ifcMetadata.schema;if(!i)throw new Error("IFC Schema not found");return i.startsWith("IFC2X3")?"IFC2X3":i.startsWith("IFC4")&&i.replace("IFC4","")===""?"IFC4":i.startsWith("IFC4X3")?"IFC4X3":i}async setData(t,...i){for(const s of i){const r=s.expressID;r&&(await t.setProperties(r,s),this.registerChange(t,r))}}async newPset(t,i,s){const r=ke.getIFCSchema(t),{ownerHistoryHandle:o}=await this.getOwnerHistory(t),a=this.newGUID(t),l=new tt[r].IfcLabel(i),c=s?new tt[r].IfcText(s):null,h=new tt[r].IfcPropertySet(a,o,l,c,[]);h.expressID=this.increaseMaxID(t);const d=this.newGUID(t),u=new tt[r].IfcRelDefinesByProperties(d,o,null,null,[],new tt.Handle(h.expressID));return u.expressID=this.increaseMaxID(t),await this.setData(t,h,u),{pset:h,rel:u}}async removePset(t,...i){for(const s of i){const r=await t.getProperties(s);if((r==null?void 0:r.type)!==tt.IFCPROPERTYSET)continue;const o=await Ge.getPsetRel(t,s);if(o&&(await t.setProperties(o,null),this.registerChange(t,o)),r){for(const a of r.HasProperties)await t.setProperties(a.value,null);await t.setProperties(s,null),this.onPsetRemoved.trigger({model:t,psetID:s}),this.registerChange(t,s)}}}newSingleStringProperty(t,i,s,r){return this.newSingleProperty(t,i,s,r)}newSingleNumericProperty(t,i,s,r){return this.newSingleProperty(t,i,s,r)}newSingleBooleanProperty(t,i,s,r){return this.newSingleProperty(t,i,s,r)}async removePsetProp(t,i,s){const r=await t.getProperties(i),o=await t.getProperties(s);!r||!o||r.type===tt.IFCPROPERTYSET&&o&&(r.HasProperties=r.HasProperties.filter(a=>a.value!==s),await t.setProperties(s,null),this.registerChange(t,i,s))}async addElementToPset(t,i,...s){const r=await Ge.getPsetRel(t,i);if(!r)return;const o=await t.getProperties(r);if(!o)return;for(const l of s){const c=new tt.Handle(l);o.RelatedObjects.push(c),this.onElementToPset.trigger({model:t,psetID:i,elementID:l})}this.registerChange(t,i);const a=this.components.get(pi);for(const l of s)a.addEntityRelations(t,l,"IsDefinedBy",i)}async addPropToPset(t,i,...s){const r=await t.getProperties(i);if(r){for(const o of s){if(r.HasProperties.includes(o))continue;const a=new tt.Handle(o);r.HasProperties.push(a),this.onPropToPset.trigger({model:t,psetID:i,propID:o})}this.registerChange(t,i)}}async saveToIfc(t,i){const s=this.components.get(fr),r=s.webIfc,o=await s.readIfcFile(i),a=this.changeMap[t.uuid]??[];for(const c of a){const h=await t.getProperties(c);if(h)try{r.WriteLine(o,h)}catch{}else try{r.DeleteLine(o,c)}catch{}}const l=r.SaveModel(o);return s.webIfc.CloseModel(o),s.cleanUp(),l}async setAttributeListener(t,i,s){this.attributeListeners[t.uuid]||(this.attributeListeners[t.uuid]={});const r=this.attributeListeners[t.uuid][i]?this.attributeListeners[t.uuid][i][s]:null;if(r)return r;const o=await t.getProperties(i);if(!o)throw new Error(`Entity with expressID ${i} doesn't exists.`);const a=o[s];if(Array.isArray(a)||!a)throw new Error(`Attribute ${s} is array or null, and it can't have a listener.`);const l=a.value;if(l===void 0||l==null)throw new Error(`Attribute ${s} has a badly defined handle.`);const c=new Q;return Object.defineProperty(o[s],"value",{get(){return this._value},async set(h){this._value=h,c.trigger(h)}}),o[s].value=l,this.attributeListeners[t.uuid][i]||(this.attributeListeners[t.uuid][i]={}),this.attributeListeners[t.uuid][i][s]=c,c}increaseMaxID(t){return t.ifcMetadata.maxExpressID++,t.ifcMetadata.maxExpressID}newGUID(t){const i=ke.getIFCSchema(t);return new tt[i].IfcGloballyUniqueId(Fe.create())}async getOwnerHistory(t){const i=await t.getAllPropertiesOfType(tt.IFCOWNERHISTORY);if(!i)throw new Error("No OwnerHistory was found.");const s=Object.keys(i).map(a=>parseInt(a,10)),r=i[s[0]],o=new tt.Handle(r.expressID);return{ownerHistory:r,ownerHistoryHandle:o}}registerChange(t,...i){this.changeMap[t.uuid]||(this.changeMap[t.uuid]=new Set);for(const s of i)this.changeMap[t.uuid].add(s),this.onDataChanged.trigger({model:t,expressID:s})}async newSingleProperty(t,i,s,r){const o=ke.getIFCSchema(t),a=new tt[o].IfcIdentifier(s),l=new tt[o][i](r),c=new tt[o].IfcPropertySingleValue(a,null,l,null);return c.expressID=this.increaseMaxID(t),await this.setData(t,c),c}};y(ke,"uuid","58c2d9f0-183c-48d6-a402-dfcf5b9a34df");let na=ke;const _r=class _r extends Ot{constructor(t){super(t);y(this,"enabled",!0);y(this,"list",{});y(this,"onDisposed",new Q);y(this,"onFragmentsDisposed",t=>{const{groupID:i,fragmentIDs:s}=t;for(const r in this.list){const o=this.list[r],a=Object.keys(o);if(a.includes(i))delete o[i],Object.values(o).length===0&&delete this.list[r];else for(const l of a){const c=o[l];for(const h of s)delete c.map[h];Object.values(c).length===0&&delete o[l]}}});t.add(_r.uuid,this),t.get(St).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={},this.components.get(St).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(t){for(const i in this.list){const s=this.list[i];for(const r in s){const o=s[r];delete o.map[t]}}}find(t){const i=this.components.get(St);if(!t){const a={};for(const[l,c]of i.list)a[l]=new Set(c.ids);return a}const s=Object.keys(t).length,r={};for(const a in t){const l=t[a];if(!this.list[a]){console.warn(`Classification ${a} does not exist.`);continue}for(const c of l){const h=this.list[a][c];if(h)for(const d in h.map){r[d]||(r[d]=new Map);for(const u of h.map[d]){const f=r[d].get(u);f===void 0?r[d].set(u,1):r[d].set(u,f+1)}}}}const o={};for(const a in r){const l=r[a];for(const[c,h]of l){if(h===void 0)throw new Error("Malformed fragments map!");h===s&&(o[a]||(o[a]=new Set),o[a].add(c))}}return o}byModel(t,i){this.list.models||(this.list.models={});const s=this.list.models;s[t]||(s[t]={map:{},id:null,name:t});const r=s[t];for(const[o,a]of i.data){const l=a[0];for(const c of l){const h=i.keyFragments.get(c);h&&(r.map[h]||(r.map[h]=new Set),r.map[h].add(o))}}}async byPredefinedType(t){var r;this.list.predefinedTypes||(this.list.predefinedTypes={});const i=this.list.predefinedTypes,s=t.getAllPropertiesIDs();for(const o of s){const a=await t.getProperties(o);if(!a)continue;const l=String((r=a.PredefinedType)==null?void 0:r.value).toUpperCase();i[l]||(i[l]={map:{},id:null,name:l});const c=i[l];for(const[h,d]of t.data){const u=d[0];for(const f of u){const p=t.keyFragments.get(f);if(!p)throw new Error("Fragment ID not found!");c.map[p]||(c.map[p]=new Set),c.map[p].add(a.expressID)}}}}byEntity(t){this.list.entities||(this.list.entities={});for(const[i,s]of t.data){const o=s[1][1],a=La[o];this.saveItem(t,"entities",a,i)}}async byIfcRel(t,i,s){Ge.isRel(i)&&await Ge.getRelationMap(t,i,async(r,o)=>{const{name:a}=await Ge.getEntityName(t,r);for(const l of o)this.saveItem(t,s,a??"NO REL NAME",l)})}async bySpatialStructure(t,i={}){var c,h;const s=this.components.get(pi),r=s.relationMaps[t.uuid];if(!r)throw new Error(`Classifier: model relations of ${t.name||t.uuid} have to exists to group by spatial structure.`);const o="spatialStructures",l=i.useProperties===void 0||i.useProperties;for(const[d]of r){if(i.isolate){const m=t.data.get(d);if(!m)continue;const E=m[1][1];if(E===void 0||!i.isolate.has(E))continue}const u=s.getEntityRelations(t,d,"Decomposes");if(u)for(const m of u){let E=m.toString();if(l){const g=await t.getProperties(m);if(!g)continue;E=(c=g.Name)==null?void 0:c.value}this.saveItem(t,o,E,d,m)}const f=s.getEntityRelations(t,d,"ContainsElements");if(!f)continue;let p=d.toString();if(l){const m=await t.getProperties(d);if(!m)continue;p=(h=m.Name)==null?void 0:h.value}for(const m of f){this.saveItem(t,o,p,m,d);const E=s.getEntityRelations(t,Number(m),"IsDecomposedBy");if(E)for(const g of E)this.saveItem(t,o,p,g,d)}}}setColor(t,i,s=!1){const r=this.components.get(St);for(const o in t){const a=r.list.get(o);if(!a)continue;const l=t[o];a.setColor(i,l,s)}}resetColor(t){const i=this.components.get(St);for(const s in t){const r=i.list.get(s);if(!r)continue;const o=t[s];r.resetColor(o)}}saveItem(t,i,s,r,o=null){this.list[i]||(this.list[i]={});const a=t.data.get(r);if(a)for(const l of a[0]){const c=t.keyFragments.get(l);if(c){const h=this.list[i];h[s]||(h[s]={map:{},id:o,name:s}),h[s].map[c]||(h[s].map[c]=new Set),h[s].map[c].add(r)}}}};y(_r,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let pr=_r;const Tr=class Tr extends Ot{constructor(t){super(t);y(this,"onDisposed",new Q);y(this,"enabled",!0);y(this,"height",10);y(this,"groupName","spatialStructures");y(this,"list",new Set);t.add(Tr.uuid,this)}dispose(){this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}set(t){if(!this.enabled)return;const i=this.components.get(pr),s=this.components.get(St),r=t?1:-1;let o=0;const a=i.list[this.groupName],l=new M.Matrix4;for(const c in a){l.elements[13]=o*r*this.height;for(const h in a[c].map){const d=s.list.get(h),u=c+h,f=this.list.has(u);if(!d||t&&f||!t&&!f)continue;t?this.list.add(u):this.list.delete(u);const p=a[c].map[h];d.applyTransform(p,l),d.mesh.computeBoundingSphere(),d.mesh.computeBoundingBox()}o++}}};y(Tr,"uuid","d260618b-ce88-4c7d-826c-6debb91de3e2");let ra=Tr;const vr=class vr extends Ot{constructor(t){super(t);y(this,"enabled",!0);this.components.add(vr.uuid,this)}set(t,i){const s=this.components.get(St);if(!i){for(const[r,o]of s.list)o&&(o.setVisibility(t),this.updateCulledVisibility(o));return}for(const r in i){const o=i[r],a=s.list.get(r);a&&(a.setVisibility(t,o),this.updateCulledVisibility(a))}}isolate(t){this.set(!1),this.set(!0,t)}updateCulledVisibility(t){const i=this.components.get(qn);for(const[s,r]of i.list){const o=r.colorMeshes.get(t.id);o&&(o.count=t.mesh.count)}}};y(vr,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");let mr=vr;class Pd extends qr{constructor(){super(...arguments);y(this,"minGeometrySize",10);y(this,"minAssetsSize",1e3)}}const wr=class wr extends Ot{constructor(t){super(t);y(this,"onGeometryStreamed",new Q);y(this,"onAssetStreamed",new Q);y(this,"onProgress",new Q);y(this,"onIfcLoaded",new Q);y(this,"onDisposed",new Q);y(this,"settings",new Pd);y(this,"enabled",!0);y(this,"webIfc",new tt.IfcAPI);y(this,"_spatialTree",new Fd);y(this,"_metaData",new xd);y(this,"_visitedGeometries",new Map);y(this,"_streamSerializer",new $e.StreamSerializer);y(this,"_geometries",new Map);y(this,"_geometryCount",0);y(this,"_civil",new Od);y(this,"_groupSerializer",new $e.Serializer);y(this,"_assets",[]);y(this,"_meshesWithHoles",new Set);this.components.add(wr.uuid,this),this.settings.excludedCategories.add(tt.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:i,absolute:s,logLevel:r}=this.settings.wasm;this.webIfc.SetWasmPath(i,s),await this.webIfc.Init(),r&&this.webIfc.SetLogLevel(r),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:i,absolute:s,logLevel:r}=this.settings.wasm;this.webIfc.SetWasmPath(i,s),await this.webIfc.Init(),r&&this.webIfc.SetLogLevel(r),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllGeometries(){const{minGeometrySize:t,minAssetsSize:i}=this.settings;this._spatialTree.setUp(this.webIfc);const s=this.webIfc.GetIfcEntityList(0),r=[[]],o=new $e.FragmentsGroup;o.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 a=0,l=0;for(const m of s){if(!this.webIfc.IsIfcElement(m)&&m!==tt.IFCSPACE||this.settings.excludedCategories.has(m))continue;const E=this.webIfc.GetLineIDsWithType(0,m),g=E.size();for(let b=0;b<g;b++){a>t&&(a=0,l++,r.push([]));const v=E.get(b);r[l].push(v);const I=this.webIfc.GetLine(0,v);if(I.GlobalId){const A=(I==null?void 0:I.GlobalId.value)||(I==null?void 0:I.GlobalId);o.globalToExpressIDs.set(A,v)}const T=this._spatialTree.itemsByFloor[v]||0;o.data.set(v,[[],[T,m]]),a++}}this._spatialTree.cleanUp();let c=.01,h=0;for(const m of r){h++,this.webIfc.StreamMeshes(0,m,g=>{this.getMesh(this.webIfc,g,o)}),this._geometryCount>t&&await this.streamGeometries(),this._assets.length>i&&await this.streamAssets();const E=h/r.length;E>c&&(c+=.01,c=Math.max(c,E),this.onProgress.trigger(Math.round(c*100)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:d,transparent:u}=o.geometryIDs;for(const[m,{index:E,uuid:g}]of this._visitedGeometries)o.keyFragments.set(E,g),(m>1?d:u).set(m,E);Nd.get(o,this.webIfc);const f=this.webIfc.GetCoordinationMatrix(0);o.coordinationMatrix.fromArray(f),o.civilData=this._civil.read(this.webIfc);const p=this._groupSerializer.export(o);this.onIfcLoaded.trigger(p),o.dispose(!0)}cleanUp(){try{this.webIfc.Dispose()}catch{}this.webIfc=null,this.webIfc=new tt.IfcAPI,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(t,i,s){const r=i.geometries.size(),o=i.expressID,a={id:o,geometries:[]};for(let l=0;l<r;l++){const c=i.geometries.get(l),h=c.geometryExpressID,d=c.color.w===1?1:-1,u=h*d;if(!this._visitedGeometries.has(u)){this._visitedGeometries.has(h)||this.getGeometry(t,h);const T=this._visitedGeometries.size,A=M.MathUtils.generateUUID();this._visitedGeometries.set(u,{uuid:A,index:T})}const f=this._visitedGeometries.get(u);if(f===void 0)throw new Error("Error getting geometry data for streaming!");const p=s.data.get(o);if(!p)throw new Error("Data not found!");p[0].push(f.index);const{x:m,y:E,z:g,w:b}=c.color,v=[m,E,g,b],I=c.flatTransformation;a.geometries.push({color:v,geometryID:h,transformation:I})}this._assets.push(a)}getGeometry(t,i){const s=t.GetGeometry(0,i),r=t.GetIndexArray(s.GetIndexData(),s.GetIndexDataSize()),o=t.GetVertexArray(s.GetVertexData(),s.GetVertexDataSize()),a=new Float32Array(o.length/2),l=new Float32Array(o.length/2);for(let f=0;f<o.length;f+=6)a[f/2]=o[f],a[f/2+1]=o[f+1],a[f/2+2]=o[f+2],l[f/2]=o[f+3],l[f/2+1]=o[f+4],l[f/2+2]=o[f+5];const c=Ac(a),h=new Float32Array(c.transformation.elements),d=[c.center.x,c.center.y,c.center.z];let u=!1;for(let f=0;f<a.length-2;f+=3){const p=a[f],m=a[f+1],E=a[f+2],g=l[f],b=l[f+1],v=l[f+2];if(Rc(d,[p,m,E],[g,b,v])){u=!0;break}}this._geometries.set(i,{position:a,normal:l,index:r,boundingBox:h,hasHoles:u}),s.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),i={};for(const[s,{boundingBox:r,hasHoles:o}]of this._geometries)i[s]={boundingBox:r,hasHoles:o};this.onGeometryStreamed.trigger({data:i,buffer:t}),i=null,t=null,this._geometries.clear(),this._geometryCount=0}};y(wr,"uuid","d9999a00-e1f5-4d3f-8cfe-c56e08609764");let oa=wr;class Ld extends qr{constructor(){super(...arguments);y(this,"propertiesSize",100)}}class Md extends Ot{constructor(){super(...arguments);y(this,"onPropertiesStreamed",new Ss);y(this,"onProgress",new Ss);y(this,"onIndicesStreamed",new Ss);y(this,"onDisposed",new Q);y(this,"enabled",!0);y(this,"settings",new Ld);y(this,"webIfc",new tt.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:i,absolute:s,logLevel:r}=this.settings.wasm;this.webIfc.SetWasmPath(i,s),await this.webIfc.Init(),r&&this.webIfc.SetLogLevel(r),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:i,absolute:s,logLevel:r}=this.settings.wasm;this.webIfc.SetWasmPath(i,s),await this.webIfc.Init(),r&&this.webIfc.SetLogLevel(r),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:t}=this.settings,i=new Set(this.webIfc.GetIfcEntityList(0)),s=new Set([tt.IFCPROJECT,tt.IFCSITE,tt.IFCBUILDING,tt.IFCBUILDINGSTOREY,tt.IFCSPACE]);for(const c of s)i.add(c);let r=.01,o=0;for(const c of i){if(o++,Pa.has(c))continue;const h=s.has(c),d=this.webIfc.GetLineIDsWithType(0,c),u=d.size();let f=0;for(let m=0;m<u-t;m+=t){const E={};for(let g=0;g<t;g++){f++;const b=d.get(m+g);try{const v=this.webIfc.GetLine(0,b,h);E[v.expressID]=v}catch{console.log(`Could not get property: ${b}`)}}await this.onPropertiesStreamed.trigger({type:c,data:E})}if(f!==u){const m={};for(let E=f;E<u;E++){const g=d.get(E);try{const b=this.webIfc.GetLine(0,g,h);m[b.expressID]=b}catch{console.log(`Could not get property: ${g}`)}}await this.onPropertiesStreamed.trigger({type:c,data:m})}o/i.size>r&&(r=Math.round(r*100)/100,await this.onProgress.trigger(r),r+=.01)}await this.onProgress.trigger(1);const l=await this.components.get(pi).processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(l)}cleanUp(){this.webIfc.Dispose(),this.webIfc=null,this.webIfc=new tt.IfcAPI}}y(Md,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");class Dd{constructor(e,t){y(this,"name","Viewpoint");y(this,"guid",Fe.create());y(this,"clippingPlanes",new hi);y(this,"camera",{aspectRatio:0,fov:0,direction:{x:0,y:0,z:80},position:{x:0,y:0,z:0}});y(this,"exceptionComponents",new hi);y(this,"selectionComponents",new hi);y(this,"spacesVisible",!1);y(this,"spaceBoundariesVisible",!1);y(this,"openingsVisible",!1);y(this,"defaultVisibility",!0);y(this,"_components");y(this,"world");this._components=e,this.world=t,this.updateCamera()}get _selectionModelIdMap(){const e=this._components.get(St),t={};for(const[i,s]of e.groups){i in t||(t[i]=new Set);for(const r of this.selectionComponents){const o=s.globalToExpressIDs.get(r);o&&t[i].add(o)}}return t}get _exceptionModelIdMap(){const e=this._components.get(St),t={};for(const[i,s]of e.groups){i in t||(t[i]=new Set);for(const r of this.exceptionComponents){const o=s.globalToExpressIDs.get(r);o&&t[i].add(o)}}return t}get selection(){return this._components.get(St).modelIdToFragmentIdMap(this._selectionModelIdMap)}get exception(){return this._components.get(St).modelIdToFragmentIdMap(this._exceptionModelIdMap)}get projection(){return"fov"in this.camera?"Perspective":"Orthographic"}get position(){const e=this._components.get(St),{position:t}=this.camera,{x:i,y:s,z:r}=t,o=new M.Vector3(i,s,r);return e.applyBaseCoordinateSystem(o,new M.Matrix4),o}get direction(){const{direction:e}=this.camera,{x:t,y:i,z:s}=e;return new M.Vector3(t,i,s)}get _managerVersion(){return this._components.get(Dt).config.version}get topics(){return[...this._components.get(Dt).list.values()].filter(s=>s.viewpoints.has(this))}async addComponentsFromMap(e){var i;const t=this._components.get(St);for(const s in e){const r=t.list.get(s);if(!(r&&r.group))continue;const o=r.group,a=e[s];for(const l of a){const c=await o.getProperties(l);if(!c)continue;const h=(i=c.GlobalId)==null?void 0:i.value;h&&this.selectionComponents.add(h)}}}set(e){const t=e,i=this;for(const s in e){if(s==="guid")continue;const r=t[s];s in this&&(i[s]=r)}}async go(e=!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 Vc&&t.projection.set(this.projection);const i=this.position,s=this.direction;let r={x:i.x+s.x*80,y:i.y+s.y*80,z:i.z+s.z*80};const o=this.selection;if(Object.keys(o).length===0){const h=this._components.get(fi).get(this.world).castRayFromVector(i,this.direction);h&&(r=h.point)}else{const l=this._components.get(dr);l.reset(),l.addFragmentIdMap(o),r=l.getSphere().center,l.reset()}const a=this._components.get(mr);a.set(this.defaultVisibility),a.set(!this.defaultVisibility,this.exception),a.set(!0,o),await t.controls.setLookAt(i.x,i.y,i.z,r.x,r.y,r.z,e)}updateCamera(){const{camera:e,renderer:t}=this.world;if(!t)throw new Error("Viewpoint: the world needs to have a renderer!");if(!e.hasCameraControls())throw new Error("Viewpoint: world's camera need camera controls!");const i=new M.Vector3;e.controls.getPosition(i);const s=e.three,r=new M.Vector3(0,0,-1).applyEuler(s.rotation),{width:o,height:a}=t.getSize();let l=o/a;Number.isNaN(l)&&(l=1);const c=this._components.get(St);i.applyMatrix4(c.baseCoordinationMatrix.clone().invert());const h={aspectRatio:l,position:{x:i.x,y:i.y,z:i.z},direction:{x:r.x,y:r.y,z:r.z}};s instanceof M.PerspectiveCamera?this.camera={...h,fov:s.fov}:s instanceof M.OrthographicCamera&&(this.camera={...h,viewToWorldScale:s.top-s.bottom})}async createComponentTags(e){var r,o;const t=this._components.get(St),i=this._components.get(Dt);let s="";if(i.config.includeSelectionTag){const a=e==="selection"?this._selectionModelIdMap:this._exceptionModelIdMap;for(const l in a){const c=t.groups.get(l);if(!c)continue;const h=a[l];for(const d of h){const u=await c.getProperties(d);if(!u)continue;const f=(r=u.GlobalId)==null?void 0:r.value;if(!f)continue;const p=(o=u.Tag)==null?void 0:o.value;let m=null;p&&(m=`AuthoringToolId="${p}"`),s+=`
2282
+ `}processMarkupComment(t){const{Guid:i,Date:s,Author:n,Comment:o,Viewpoint:a}=t;if(!(i&&s&&n&&(Jn||a)))return null;const l=this.components.get(Ht),c=new Jn(this.components,o??"");return c.guid=i,c.date=new Date(s),c.author=n,c.viewpoint=a!=null&&a.Guid?l.list.get(a.Guid):void 0,c.modifiedAuthor=t.ModifiedAuthor,c.modifiedDate=t.ModifiedDate?new Date(t.ModifiedDate):void 0,c}getMarkupComments(t,i){var a;let s;if(i==="2.1"&&(s=t.Comment),i==="3"&&(s=(a=t.Topic.Comments)==null?void 0:a.Comment),!s)return[];s=Array.isArray(s)?s:[s];const n=s.map(l=>this.processMarkupComment(l)).filter(l=>l);return Array.isArray(n)?n:[n]}getMarkupLabels(t,i){var o;let s;return i==="2.1"&&(s=t.Topic.Labels),i==="3"&&(s=(o=t.Topic.Labels)==null?void 0:o.Label),s?Array.isArray(s)?s:[s]:[]}getMarkupViewpoints(t,i){var n;let s;return i==="2.1"&&(s=t.Viewpoints),i==="3"&&(s=(n=t.Topic.Viewpoints)==null?void 0:n.ViewPoint),s?(s=Array.isArray(s)?s:[s],s):[]}getMarkupRelatedTopics(t,i){var o;let s;return i==="2.1"&&(s=t.Topic.RelatedTopic),i==="3"&&(s=(o=t.Topic.RelatedTopics)==null?void 0:o.RelatedTopic),s?(Array.isArray(s)?s:[s]).map(a=>a.Guid):[]}async load(t,i){var E;const{fallbackVersionOnImport:s,ignoreIncompleteTopicsOnImport:n}=this.config,o=new Tl;await o.loadAsync(i);const a=Object.values(o.files);let l=s;const c=a.find(g=>g.name.endsWith(".version"));if(c){const g=await c.async("string"),I=this._xmlParser.parse(g).Version.VersionId;l=String(I)}if(!(l&&(l==="2.1"||l==="3")))throw new Error(`BCFTopics: ${l} is not supported.`);const h=[],d=this.components.get(Ht),u=a.filter(g=>g.name.endsWith(".bcfv"));for(const g of u){const I=await g.async("string"),T=this._xmlParser.parse(I).VisualizationInfo;if(!T){console.warn("Missing VisualizationInfo in Viewpoint");continue}const b={},{Guid:v,ClippingPlanes:A,Components:S,OrthogonalCamera:N,PerspectiveCamera:R}=T;if(v&&(b.guid=v),S){const{Selection:M,Visibility:w}=S;if(M&&M.Component){const C=Array.isArray(M.Component)?M.Component:[M.Component];b.selectionComponents=C.map(U=>U.IfcGuid).filter(U=>U)}if(w&&"DefaultVisibility"in w&&(b.defaultVisibility=w.DefaultVisibility),w&&w.Exceptions&&"Component"in w.Exceptions){const{Component:C}=w.Exceptions,U=Array.isArray(C)?C:[C];b.exceptionComponents=U.map(q=>q.IfcGuid).filter(q=>q)}let L;l==="2.1"&&(L=S.ViewSetupHints),l==="3"&&(L=(E=S.Visibility)==null?void 0:E.ViewSetupHints),L&&("OpeningsVisible"in L&&(b.openingsVisible=L.OpeningsVisible),"SpacesVisible"in L&&(b.spacesVisible=L.SpacesVisible),"SpaceBoundariesVisible"in L&&(b.spaceBoundariesVisible=L.SpaceBoundariesVisible))}if(N||R){const M=T.PerspectiveCamera??T.OrthogonalCamera,{CameraViewPoint:w,CameraDirection:L}=M,C=new D.Vector3(Number(w.X),Number(w.Z),Number(-w.Y)),U=new D.Vector3(Number(L.X),Number(L.Z),Number(-L.Y)),q={position:{x:C.x,y:C.y,z:C.z},direction:{x:U.x,y:U.y,z:U.z},aspectRatio:"AspectRatio"in M?M.AspectRatio:1};"ViewToWorldScale"in M&&(b.camera={...q,viewToWorldScale:M.ViewToWorldScale}),"FieldOfView"in M&&(b.camera={...q,fov:M.FieldOfView})}const P=new ka(this.components,t,{data:b,setCamera:!1});if(S){const{Coloring:M}=S;if(M&&M.Color){const w=Array.isArray(M.Color)?M.Color:[M.Color];for(const L of w){const{Color:C,Component:U}=L,G=(Array.isArray(U)?U:[U]).map(st=>st.IfcGuid);P.componentColors.set(C,G)}}}if(h.push(P),A){const M=this.components.get(Kn),w=Array.isArray(A.ClippingPlane)?A.ClippingPlane:[A.ClippingPlane];for(const L of w){const{Location:C,Direction:U}=L;if(!(C&&U))continue;const q=new D.Vector3(C.X,C.Z,-C.Y),G=new D.Vector3(U.X,-U.Z,U.Y),st=M.createFromNormalAndCoplanarPoint(t,G,q);st.visible=!1,st.enabled=!1,P.clippingPlanes.add(st)}}}const f={},p=[],m=a.filter(g=>g.name.endsWith(".bcf"));for(const g of m){const I=await g.async("string"),T=this._xmlParser.parse(I).Markup,b=T.Topic,{Guid:v,Type:A,Status:S,Title:N,CreationDate:R,CreationAuthor:P}=b;if(n&&!(v&&A&&S&&N&&R&&P))continue;const M=new Gs(this.components);M.guid=v??M.guid;const w=this.getMarkupRelatedTopics(T,l);f[M.guid]=new Set(w),M.type=A??M.type,M.status=S??M.status,M.title=N??M.title,M.creationDate=R?new Date(R):M.creationDate,M.creationAuthor=P??M.creationAuthor,M.serverAssignedId=b.ServerAssignedId,M.priority=b.Priority,M.index=b.Index,M.modifiedDate=b.ModifiedDate?new Date(b.ModifiedDate):void 0,M.modifiedAuthor=b.ModifiedAuthor,M.dueDate=b.DueDate?new Date(b.DueDate):void 0,M.assignedTo=b.AssignedTo,M.description=b.Description,M.stage=b.Stage;const L=this.getMarkupLabels(T,l);for(const q of L)M.labels.add(q);const C=this.getMarkupComments(T,l);for(const q of C)M.comments.set(q.guid,q);const U=this.getMarkupViewpoints(T,l);for(const q of U){if(!(q&&q.Guid))continue;const G=d.list.get(q.Guid);G&&M.viewpoints.add(G.guid)}this.list.set(M.guid,M),p.push(M)}for(const g in f){const I=this.list.get(g);if(!I)continue;const T=f[g];for(const b of T)I.relatedTopics.add(b)}return this.onBCFImported.trigger(p),{viewpoints:h,topics:p}}}y(Mt,"uuid","de977976-e4f6-4e4f-a01a-204727839802");const fe=class fe extends Ot{constructor(t){super(t);y(this,"enabled",!0);y(this,"onDisposed",new K);y(this,"_absoluteMin");y(this,"_absoluteMax");y(this,"_meshes",[]);this.components.add(fe.uuid,this),this._absoluteMin=fe.newBound(!0),this._absoluteMax=fe.newBound(!1)}static getDimensions(t){const{min:i,max:s}=t,n=Math.abs(s.x-i.x),o=Math.abs(s.y-i.y),a=Math.abs(s.z-i.z),l=new D.Vector3;return l.subVectors(s,i).divideScalar(2).add(i),{width:n,height:o,depth:a,center:l}}static newBound(t){const i=t?1:-1;return new D.Vector3(i*Number.MAX_VALUE,i*Number.MAX_VALUE,i*Number.MAX_VALUE)}static getBounds(t,i,s){const n=s||this.newBound(!1),o=i||this.newBound(!0);for(const a of t)a.x<o.x&&(o.x=a.x),a.y<o.y&&(o.y=a.y),a.z<o.z&&(o.z=a.z),a.x>n.x&&(n.x=a.x),a.y>n.y&&(n.y=a.y),a.z>n.z&&(n.z=a.z);return new D.Box3(i,s)}dispose(){const t=this.components.get(Pe);for(const i of this._meshes)t.destroy(i);this._meshes=[],this.onDisposed.trigger(fe.uuid),this.onDisposed.reset()}get(){const t=this._absoluteMin.clone(),i=this._absoluteMax.clone();return new D.Box3(t,i)}getSphere(){const t=this._absoluteMin.clone(),i=this._absoluteMax.clone(),s=Math.abs((i.x-t.x)/2),n=Math.abs((i.y-t.y)/2),o=Math.abs((i.z-t.z)/2),a=new D.Vector3(t.x+s,t.y+n,t.z+o),l=a.distanceTo(t);return new D.Sphere(a,l)}getMesh(){const t=new D.Box3(this._absoluteMin,this._absoluteMax),i=fe.getDimensions(t),{width:s,height:n,depth:o,center:a}=i,l=new D.BoxGeometry(s,n,o),c=new D.Mesh(l);return this._meshes.push(c),c.position.copy(a),c}reset(){this._absoluteMin=fe.newBound(!0),this._absoluteMax=fe.newBound(!1)}add(t){for(const i of t.items)this.addMesh(i.mesh)}addMesh(t,i){if(!t.geometry.index)return;const s=fe.getFragmentBounds(t);t.updateMatrixWorld();const n=t.matrixWorld,o=new D.Matrix4,a=t instanceof D.InstancedMesh,l=new Set;if(t instanceof We.FragmentMesh){i||(i=t.fragment.ids);for(const c of i){const h=t.fragment.getInstancesIDs(c);if(h)for(const d of h)l.add(d)}}else l.add(0);for(const c of l){const h=s.min.clone(),d=s.max.clone();a&&(t.getMatrixAt(c,o),h.applyMatrix4(o),d.applyMatrix4(o)),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 i=this.components.get(wt);for(const s in t){const n=i.list.get(s);if(!n)continue;const o=t[s];this.addMesh(n.mesh,o)}}static getFragmentBounds(t){const i=t.geometry.attributes.position,s=Number.MAX_VALUE,n=-s,o=new D.Vector3(s,s,s),a=new D.Vector3(n,n,n);if(!t.geometry.index)throw new Error("Geometry must be indexed!");const l=Array.from(t.geometry.index.array);for(let c=0;c<l.length;c++){if(c%3===0&&l[c]===0&&l[c+1]===0&&l[c+2]===0){c+=2;continue}const h=l[c],d=i.getX(h),u=i.getY(h),f=i.getZ(h);d<o.x&&(o.x=d),u<o.y&&(o.y=u),f<o.z&&(o.z=f),d>a.x&&(a.x=d),u>a.y&&(a.y=u),f>a.z&&(a.z=f)}return new D.Box3(o,a)}};y(fe,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let mr=fe;const Da=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]),vr=class vr extends Ot{constructor(t){super(t);y(this,"enabled",!0);t.add(vr.uuid,this)}async export(t,i,s=!1,n=!0){const o={},a=new Set(t.GetIfcEntityList(i)),l=new Set([tt.IFCPROJECT,tt.IFCSITE,tt.IFCBUILDING,tt.IFCBUILDINGSTOREY,tt.IFCSPACE]);for(const c of l)a.add(c);for(const c of a){if(Da.has(c))continue;const h=l.has(c)&&n,d=t.GetLineIDsWithType(i,c);for(const u of d){const f=t.GetLine(0,u,h,s);o[f.expressID]=f}}return o}};y(vr,"uuid","b32c4332-cd67-436e-ba7f-196646c7a635");let gr=vr;const Ld={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 IE{getAll(e,t){const i={},s=Object.keys(Ld).map(n=>parseInt(n,10));for(let n=0;n<s.length;n++){const o=s[n],a=e.GetLineIDsWithType(t,o),l=a.size();for(let c=0;c<l;c++)i[a.get(c)]=o}return i}}const Ua={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 je{static async getUnits(e){var o,a,l;const{IFCUNITASSIGNMENT:t}=tt,i=await e.getAllPropertiesOfType(t);if(!i)return 1;const s=Object.keys(i),n=i[parseInt(s[0],10)];for(const c of n.Units){if(c.value===void 0||c.value===null)continue;const h=await e.getProperties(c.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),((o=h.Prefix)==null?void 0:o.value)==="MILLI"?u=.001:((a=h.Prefix)==null?void 0:a.value)==="CENTI"?u=.01:((l=h.Prefix)==null?void 0:l.value)==="DECI"&&(u=.1),f*u}return 1}static async findItemByGuid(e,t){var s;const i=e.getAllPropertiesIDs();for(const n of i){const o=await e.getProperties(n);if(o&&((s=o.GlobalId)==null?void 0:s.value)===t)return o}return null}static async getRelationMap(e,t,i){var l;const n=i??(async()=>{}),o={},a=e.getAllPropertiesIDs();for(const c of a){const h=await e.getProperties(c);if(!h)continue;const d=h.type===t,u=Object.keys(h).find(g=>g.startsWith("Relating")),f=Object.keys(h).find(g=>g.startsWith("Related"));if(!(d&&u&&f))continue;const p=await e.getProperties((l=h[u])==null?void 0:l.value),m=h[f];if(!p||!m||!(m&&Array.isArray(m)))continue;const E=m.map(g=>g.value);await n(p.expressID,E),o[p.expressID]=E}return o}static async getQsetQuantities(e,t,i){const n=i??(()=>{}),o=await e.getProperties(t);return!o||o.type!==tt.IFCELEMENTQUANTITY?null:(o.Quantities??[{}]).map(c=>(c.value&&n(c.value),c.value)).filter(c=>c!==null)}static async getPsetProps(e,t,i){const n=i??(()=>{}),o=await e.getProperties(t);return!o||o.type!==tt.IFCPROPERTYSET?null:(o.HasProperties??[{}]).map(c=>(c.value&&n(c.value),c.value)).filter(c=>c!==null)}static async getPsetRel(e,t){var a;if(!await e.getProperties(t))return null;const s=await e.getAllPropertiesOfType(tt.IFCRELDEFINESBYPROPERTIES);if(!s)return null;const n=Object.values(s);let o=null;for(const l of n)((a=l.RelatingPropertyDefinition)==null?void 0:a.value)===t&&(o=l.expressID);return o}static async getQsetRel(e,t){return je.getPsetRel(e,t)}static async getEntityName(e,t){var o;const i=await e.getProperties(t);if(!i)return{key:null,name:null};const s=Object.keys(i).find(a=>a.endsWith("Name"))??null,n=s?(o=i[s])==null?void 0:o.value:null;return{key:s,name:n}}static async getQuantityValue(e,t){const i=await e.getProperties(t);if(!i)return{key:null,value:null};const s=Object.keys(i).find(o=>o.endsWith("Value"))??null;let n;return s===null||i[s]===void 0||i[s]===null?n=null:n=i[s].value,{key:s,value:n}}static isRel(e){return Ua[e].startsWith("IFCREL")}static async attributeExists(e,t,i){const s=await e.getProperties(t);return s?Object.keys(s).includes(i):!1}static async groupEntitiesByType(e,t){var s;const i=new Map;for(const n of t){const o=await e.getProperties(n);if(!o)continue;const a=o.type;i.get(a)||i.set(a,new Set),(s=i.get(a))==null||s.add(n)}return i}}class CE{constructor(){y(this,"factor",1);y(this,"complement",1)}apply(e){const i=this.getScaleMatrix().multiply(e);e.copy(i)}setUp(e){var n,o,a;this.factor=1;const t=this.getLengthUnits(e);if(!t)return;const i=t==null,s=t.Name===void 0||t.Name===null;i||s||(t.Name.value==="FOOT"&&(this.factor=.3048),((n=t.Prefix)==null?void 0:n.value)==="MILLI"?this.complement=.001:((o=t.Prefix)==null?void 0:o.value)==="CENTI"?this.complement=.01:((a=t.Prefix)==null?void 0:a.value)==="DECI"&&(this.complement=.01))}getLengthUnits(e){try{const i=e.GetLineIDsWithType(0,tt.IFCUNITASSIGNMENT).get(0),s=e.GetLine(0,i);for(const n of s.Units){if(!n||n.value===null||n.value===void 0)continue;const o=e.GetLine(0,n.value);if(o.UnitType&&o.UnitType.value==="LENGTHUNIT")return o}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const e=this.factor;return new D.Matrix4().fromArray([e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1])}}class Md{constructor(){y(this,"itemsByFloor",{});y(this,"_units",new CE)}setUp(e){this._units.setUp(e),this.cleanUp();try{const t=e.GetLineIDsWithType(0,tt.IFCRELCONTAINEDINSPATIALSTRUCTURE),i=new Set,s=e.GetLineIDsWithType(0,tt.IFCSPACE);for(let c=0;c<s.size();c++)i.add(s.get(c));const n=e.GetLineIDsWithType(0,tt.IFCRELAGGREGATES),o=n.size();for(let c=0;c<o;c++){const h=n.get(c),d=e.GetLine(0,h);if(!d||!d.RelatingObject||!d.RelatedObjects)continue;const u=d.RelatingObject.value,f=d.RelatedObjects;for(const p of f){const m=p.value;i.has(m)&&(this.itemsByFloor[m]=u)}}const a={},l=t.size();for(let c=0;c<l;c++){const h=t.get(c),d=e.GetLine(0,h);if(!d||!d.RelatingStructure||!d.RelatedElements)continue;const u=d.RelatingStructure.value,f=d.RelatedElements;if(i.has(u))for(const p of f){a[u]||(a[u]=[]);const m=p.value;a[u].push(m)}else for(const p of f){const m=p.value;this.itemsByFloor[m]=u}}for(const c in a){const h=this.itemsByFloor[c];if(h!==void 0){const d=a[c];for(const u of d)this.itemsByFloor[u]=h}}for(let c=0;c<o;c++){const h=n.get(c),d=e.GetLine(0,h);if(!d||!d.RelatingObject||!d.RelatedObjects)continue;const u=d.RelatingObject.value,f=d.RelatedObjects;for(const p of f){const m=p.value,E=this.itemsByFloor[u];E!==void 0&&(this.itemsByFloor[m]=E)}}}catch{console.log("Could not get floors.")}}cleanUp(){this.itemsByFloor={}}}class Kr{constructor(){y(this,"includeProperties",!0);y(this,"optionalCategories",[tt.IFCSPACE]);y(this,"coordinate",!0);y(this,"wasm",{path:"",absolute:!1,logLevel:tt.LogLevel.LOG_LEVEL_OFF});y(this,"excludedCategories",new Set);y(this,"includedCategories",new Set);y(this,"saveLocations",!1);y(this,"webIfc",{COORDINATE_TO_ORIGIN:!0});y(this,"autoSetWasm",!0);y(this,"customLocateFileHandler",null)}}class Dd{constructor(){y(this,"defLineMat",new D.LineBasicMaterial({color:16777215}))}read(e){const t=e.GetAllAlignments(0),i=e.GetAllCrossSections2D(0),s=e.GetAllCrossSections3D(0),n={IfcAlignment:t,IfcCrossSection2D:i,IfcCrossSection3D:s};return this.get(n)}get(e){if(e.IfcAlignment){const t=new Map;for(const i of e.IfcAlignment){const s=new We.Alignment;s.absolute=this.getCurves(i.curve3D,s),s.horizontal=this.getCurves(i.horizontal,s),s.vertical=this.getCurves(i.vertical,s),t.set(t.size,s)}return{alignments:t,coordinationMatrix:new D.Matrix4}}}getCurves(e,t){const i=[];let s=0;for(const n of e){const o={};if(n.data)for(const u of n.data){const[f,p]=u.split(": "),m=parseFloat(p);o[f]=m||p}const{points:a}=n,l=new Float32Array(a.length*3);for(let u=0;u<a.length;u++){const{x:f,y:p,z:m}=a[u];l[u*3]=f,l[u*3+1]=p,l[u*3+2]=m||0}const c=new D.BufferAttribute(l,3),h=new D.EdgesGeometry;h.setAttribute("position",c);const d=new We.CurveMesh(s,o,t,h,this.defLineMat);i.push(d.curve),s++}return i}}class Ud{getNameInfo(e){var d;const t={},{arguments:i}=e.GetHeaderLine(0,tt.FILE_NAME)||{};if(!i)return t;const[s,n,o,a,l,c,h]=i;if(s!=null&&s.value&&(t.name=s.value),n!=null&&n.value&&(t.creationDate=new Date(n.value)),o){t.author={};const[u,f]=o;u!=null&&u.value&&(t.author.name=u.value),f!=null&&f.value&&(t.author.email=f.value)}return(d=a[0])!=null&&d.value&&(t.organization=a[0].value),l!=null&&l.value&&(t.preprocessorVersion=l==null?void 0:l.value),c!=null&&c.value&&(t.originatingSystem=c==null?void 0:c.value),h!=null&&h.value&&(t.authorization=h==null?void 0:h.value),t}getDescriptionInfo(e){var o;const t={},{arguments:i}=e.GetHeaderLine(0,tt.FILE_DESCRIPTION)||{};if(!i)return t;const[s,n]=i;if((o=s[0])!=null&&o.value){const a=s[0].value.match(/\[([^\]]+)\]/);a&&a[1]&&(t.viewDefinition=a[1])}return n!=null&&n.value&&(t.implementationLevel=n.value),t}}class kd{static get(e,t){const i=[tt.IFCPROJECT,tt.IFCSITE,tt.IFCBUILDING,tt.IFCBUILDINGSTOREY,tt.IFCSPACE,tt.IFCROAD,tt.IFCFACILITY,tt.IFCFACILITYPART,tt.IFCBRIDGE],s=e.data;for(const n of i){const o=t.GetLineIDsWithType(0,n),a=o.size();for(let l=0;l<a;l++){const c=o.get(l);s.has(c)||s.set(c,[[],[0,n]])}}}}const Vs=class Vs extends Ot{constructor(t){super(t);y(this,"onDisposed",new K);y(this,"onIfcStartedLoading",new K);y(this,"onSetup",new K);y(this,"settings",new Kr);y(this,"webIfc",new tt.IfcAPI);y(this,"enabled",!0);y(this,"_material",new D.MeshLambertMaterial);y(this,"_spatialTree",new Md);y(this,"_metaData",new Ud);y(this,"_fragmentInstances",new Map);y(this,"_civil",new Dd);y(this,"_visitedFragments",new Map);y(this,"_materialT",new D.MeshLambertMaterial({transparent:!0,opacity:.5}));this.components.add(Vs.uuid,this),this.settings.excludedCategories.add(tt.IFCOPENINGELEMENT)}dispose(){this.webIfc=null,this.onDisposed.trigger(Vs.uuid),this.onDisposed.reset()}async setup(t){this.settings={...this.settings,...t},this.settings.autoSetWasm&&await this.autoSetWasm(),this.onSetup.trigger()}async load(t,i=!0){const s=performance.now();this.onIfcStartedLoading.trigger(),await this.readIfcFile(t);const n=await this.getAllGeometries(),a=await this.components.get(gr).export(this.webIfc,0);n.setLocalProperties(a);const l=this.components.get(wt);l.groups.set(n.uuid,n);for(const c of n.items)l.list.set(c.id,c),c.mesh.uuid=c.id,c.group=n;l.onFragmentsLoaded.trigger(n),i&&l.coordinate([n]);for(const[c]of n.data){const h=a[c];if(!h||!h.GlobalId)continue;const d=h.GlobalId.value||h.GlobalId;n.globalToExpressIDs.set(d,c)}return kd.get(n,this.webIfc),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-s} ms!`),n}async readIfcFile(t){const{path:i,absolute:s,logLevel:n}=this.settings.wasm;return this.webIfc.SetWasmPath(i,s),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 tt.IfcAPI,this._visitedFragments.clear(),this._fragmentInstances.clear()}async getAllGeometries(){this._spatialTree.setUp(this.webIfc);const t=this.webIfc.GetIfcEntityList(0),i=new We.FragmentsGroup;i.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 s=[];for(const o of t){if(!this.webIfc.IsIfcElement(o)&&o!==tt.IFCSPACE)continue;const a=this.settings.includedCategories;if(a.size>0&&!a.has(o))continue;if(this.settings.excludedCategories.has(o))continue;const l=this.webIfc.GetLineIDsWithType(0,o),c=l.size();for(let h=0;h<c;h++){const d=l.get(h);s.push(d);const u=this._spatialTree.itemsByFloor[d]||0;i.data.set(d,[[],[u,o]])}}this._spatialTree.cleanUp(),this.webIfc.StreamMeshes(0,s,o=>{this.getMesh(o,i)});for(const o of this._visitedFragments){const{index:a,fragment:l}=o[1];i.keyFragments.set(a,l.id)}for(const o of i.items){const a=this._fragmentInstances.get(o.id);if(!a)throw new Error("Fragment not found!");const l=[];for(const[c,h]of a)l.push(h);o.add(l)}const n=this.webIfc.GetCoordinationMatrix(0);return i.coordinationMatrix.fromArray(n),i.civilData=this._civil.read(this.webIfc),i}getMesh(t,i){const s=t.geometries.size(),n=t.expressID;for(let o=0;o<s;o++){const a=t.geometries.get(o),{x:l,y:c,z:h,w:d}=a.color,u=d!==1,{geometryExpressID:f}=a,p=`${f}-${u}`;if(!this._visitedFragments.has(p)){const v=this.getGeometry(this.webIfc,f),A=u?this._materialT:this._material,S=new We.Fragment(v,A,1);i.add(S.mesh),i.items.push(S);const N=this._visitedFragments.size;this._visitedFragments.set(p,{index:N,fragment:S})}const m=new D.Color().setRGB(l,c,h,"srgb"),E=new D.Matrix4;E.fromArray(a.flatTransformation);const g=this._visitedFragments.get(p);if(g===void 0)throw new Error("Error getting geometry data for streaming!");const I=i.data.get(n);if(!I)throw new Error("Data not found!");I[0].push(g.index);const{fragment:T}=g;this._fragmentInstances.has(T.id)||this._fragmentInstances.set(T.id,new Map);const b=this._fragmentInstances.get(T.id);if(!b)throw new Error("Instances not found!");if(b.has(n)){const v=b.get(n);if(!v)throw new Error("Instance not found!");v.transforms.push(E),v.colors&&v.colors.push(m)}else b.set(n,{id:n,transforms:[E],colors:[m]})}}getGeometry(t,i){const s=t.GetGeometry(0,i),n=t.GetIndexArray(s.GetIndexData(),s.GetIndexDataSize()),o=t.GetVertexArray(s.GetVertexData(),s.GetVertexDataSize()),a=new Float32Array(o.length/2),l=new Float32Array(o.length/2);for(let u=0;u<o.length;u+=6)a[u/2]=o[u],a[u/2+1]=o[u+1],a[u/2+2]=o[u+2],l[u/2]=o[u+3],l[u/2+1]=o[u+4],l[u/2+2]=o[u+5];const c=new D.BufferGeometry,h=new D.BufferAttribute(a,3),d=new D.BufferAttribute(l,3);return c.setAttribute("position",h),c.setAttribute("normal",d),c.setIndex(Array.from(n)),s.delete(),c}async autoSetWasm(){const t=await fetch(`https://unpkg.com/@thatopen/components@${Zn.release}/package.json`);if(!t.ok){console.warn("Couldn't get openbim-components package.json. Set wasm settings manually.");return}const i=await t.json();if(!("web-ifc"in i.peerDependencies))console.warn("Couldn't get web-ifc from peer dependencies in openbim-components. Set wasm settings manually.");else{const s=i.peerDependencies["web-ifc"];this.settings.wasm.path=`https://unpkg.com/web-ifc@${s}/`,this.settings.wasm.absolute=!0}}};y(Vs,"uuid","a659add7-1418-4771-a0d6-7d4d438e4624");let Er=Vs;const Ve=class Ve extends Ot{constructor(t){super(t);y(this,"onDisposed",new K);y(this,"onRequestFile",new K);y(this,"ifcToExport",null);y(this,"onElementToPset",new K);y(this,"onPropToPset",new K);y(this,"onPsetRemoved",new K);y(this,"onDataChanged",new K);y(this,"wasm",{path:"/",absolute:!1});y(this,"enabled",!0);y(this,"attributeListeners",{});y(this,"selectedModel");y(this,"changeMap",{});this.components.add(Ve.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(Ve.uuid),this.onDisposed.reset()}static getIFCSchema(t){const i=t.ifcMetadata.schema;if(!i)throw new Error("IFC Schema not found");return i.startsWith("IFC2X3")?"IFC2X3":i.startsWith("IFC4")&&i.replace("IFC4","")===""?"IFC4":i.startsWith("IFC4X3")?"IFC4X3":i}async setData(t,...i){for(const s of i){const n=s.expressID;n&&(await t.setProperties(n,s),this.registerChange(t,n))}}async newPset(t,i,s){const n=Ve.getIFCSchema(t),{ownerHistoryHandle:o}=await this.getOwnerHistory(t),a=this.newGUID(t),l=new tt[n].IfcLabel(i),c=s?new tt[n].IfcText(s):null,h=new tt[n].IfcPropertySet(a,o,l,c,[]);h.expressID=this.increaseMaxID(t);const d=this.newGUID(t),u=new tt[n].IfcRelDefinesByProperties(d,o,null,null,[],new tt.Handle(h.expressID));return u.expressID=this.increaseMaxID(t),await this.setData(t,h,u),{pset:h,rel:u}}async removePset(t,...i){for(const s of i){const n=await t.getProperties(s);if((n==null?void 0:n.type)!==tt.IFCPROPERTYSET)continue;const o=await je.getPsetRel(t,s);if(o&&(await t.setProperties(o,null),this.registerChange(t,o)),n){for(const a of n.HasProperties)await t.setProperties(a.value,null);await t.setProperties(s,null),this.onPsetRemoved.trigger({model:t,psetID:s}),this.registerChange(t,s)}}}newSingleStringProperty(t,i,s,n){return this.newSingleProperty(t,i,s,n)}newSingleNumericProperty(t,i,s,n){return this.newSingleProperty(t,i,s,n)}newSingleBooleanProperty(t,i,s,n){return this.newSingleProperty(t,i,s,n)}async removePsetProp(t,i,s){const n=await t.getProperties(i),o=await t.getProperties(s);!n||!o||n.type===tt.IFCPROPERTYSET&&o&&(n.HasProperties=n.HasProperties.filter(a=>a.value!==s),await t.setProperties(s,null),this.registerChange(t,i,s))}async addElementToPset(t,i,...s){const n=await je.getPsetRel(t,i);if(!n)return;const o=await t.getProperties(n);if(!o)return;for(const l of s){const c=new tt.Handle(l);o.RelatedObjects.push(c),this.onElementToPset.trigger({model:t,psetID:i,elementID:l})}this.registerChange(t,i);const a=this.components.get(gi);for(const l of s)a.addEntityRelations(t,l,"IsDefinedBy",i)}async addPropToPset(t,i,...s){const n=await t.getProperties(i);if(n){for(const o of s){if(n.HasProperties.includes(o))continue;const a=new tt.Handle(o);n.HasProperties.push(a),this.onPropToPset.trigger({model:t,psetID:i,propID:o})}this.registerChange(t,i)}}async saveToIfc(t,i){const s=this.components.get(Er),n=s.webIfc,o=await s.readIfcFile(i),a=this.changeMap[t.uuid]??[];for(const c of a){const h=await t.getProperties(c);if(h)try{n.WriteLine(o,h)}catch{}else try{n.DeleteLine(o,c)}catch{}}const l=n.SaveModel(o);return s.webIfc.CloseModel(o),s.cleanUp(),l}async setAttributeListener(t,i,s){this.attributeListeners[t.uuid]||(this.attributeListeners[t.uuid]={});const n=this.attributeListeners[t.uuid][i]?this.attributeListeners[t.uuid][i][s]:null;if(n)return n;const o=await t.getProperties(i);if(!o)throw new Error(`Entity with expressID ${i} doesn't exists.`);const a=o[s];if(Array.isArray(a)||!a)throw new Error(`Attribute ${s} is array or null, and it can't have a listener.`);const l=a.value;if(l===void 0||l==null)throw new Error(`Attribute ${s} has a badly defined handle.`);const c=new K;return Object.defineProperty(o[s],"value",{get(){return this._value},async set(h){this._value=h,c.trigger(h)}}),o[s].value=l,this.attributeListeners[t.uuid][i]||(this.attributeListeners[t.uuid][i]={}),this.attributeListeners[t.uuid][i][s]=c,c}increaseMaxID(t){return t.ifcMetadata.maxExpressID++,t.ifcMetadata.maxExpressID}newGUID(t){const i=Ve.getIFCSchema(t);return new tt[i].IfcGloballyUniqueId(Le.create())}async getOwnerHistory(t){const i=await t.getAllPropertiesOfType(tt.IFCOWNERHISTORY);if(!i)throw new Error("No OwnerHistory was found.");const s=Object.keys(i).map(a=>parseInt(a,10)),n=i[s[0]],o=new tt.Handle(n.expressID);return{ownerHistory:n,ownerHistoryHandle:o}}registerChange(t,...i){this.changeMap[t.uuid]||(this.changeMap[t.uuid]=new Set);for(const s of i)this.changeMap[t.uuid].add(s),this.onDataChanged.trigger({model:t,expressID:s})}async newSingleProperty(t,i,s,n){const o=Ve.getIFCSchema(t),a=new tt[o].IfcIdentifier(s),l=new tt[o][i](n),c=new tt[o].IfcPropertySingleValue(a,null,l,null);return c.expressID=this.increaseMaxID(t),await this.setData(t,c),c}};y(Ve,"uuid","58c2d9f0-183c-48d6-a402-dfcf5b9a34df");let oa=Ve;const wr=class wr extends Ot{constructor(t){super(t);y(this,"enabled",!0);y(this,"list",{});y(this,"onDisposed",new K);y(this,"onFragmentsDisposed",t=>{const{groupID:i,fragmentIDs:s}=t;for(const n in this.list){const o=this.list[n],a=Object.keys(o);if(a.includes(i))delete o[i],Object.values(o).length===0&&delete this.list[n];else for(const l of a){const c=o[l];for(const h of s)delete c.map[h];Object.values(c).length===0&&delete o[l]}}});t.add(wr.uuid,this),t.get(wt).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={},this.components.get(wt).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(t){for(const i in this.list){const s=this.list[i];for(const n in s){const o=s[n];delete o.map[t]}}}find(t){const i=this.components.get(wt);if(!t){const a={};for(const[l,c]of i.list)a[l]=new Set(c.ids);return a}const s=Object.keys(t).length,n={};for(const a in t){const l=t[a];if(!this.list[a]){console.warn(`Classification ${a} does not exist.`);continue}for(const c of l){const h=this.list[a][c];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 o={};for(const a in n){const l=n[a];for(const[c,h]of l){if(h===void 0)throw new Error("Malformed fragments map!");h===s&&(o[a]||(o[a]=new Set),o[a].add(c))}}return o}byModel(t,i){this.list.models||(this.list.models={});const s=this.list.models;s[t]||(s[t]={map:{},id:null,name:t});const n=s[t];for(const[o,a]of i.data){const l=a[0];for(const c of l){const h=i.keyFragments.get(c);h&&(n.map[h]||(n.map[h]=new Set),n.map[h].add(o))}}}async byPredefinedType(t){var n;this.list.predefinedTypes||(this.list.predefinedTypes={});const i=this.list.predefinedTypes,s=t.getAllPropertiesIDs();for(const o of s){const a=await t.getProperties(o);if(!a)continue;const l=String((n=a.PredefinedType)==null?void 0:n.value).toUpperCase();i[l]||(i[l]={map:{},id:null,name:l});const c=i[l];for(const[h,d]of t.data){const u=d[0];for(const f of u){const p=t.keyFragments.get(f);if(!p)throw new Error("Fragment ID not found!");c.map[p]||(c.map[p]=new Set),c.map[p].add(a.expressID)}}}}byEntity(t){this.list.entities||(this.list.entities={});for(const[i,s]of t.data){const o=s[1][1],a=Ua[o];this.saveItem(t,"entities",a,i)}}async byIfcRel(t,i,s){je.isRel(i)&&await je.getRelationMap(t,i,async(n,o)=>{const{name:a}=await je.getEntityName(t,n);for(const l of o)this.saveItem(t,s,a??"NO REL NAME",l)})}async bySpatialStructure(t,i={}){var c,h;const s=this.components.get(gi),n=s.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 o="spatialStructures",l=i.useProperties===void 0||i.useProperties;for(const[d]of n){if(i.isolate){const m=t.data.get(d);if(!m)continue;const E=m[1][1];if(E===void 0||!i.isolate.has(E))continue}const u=s.getEntityRelations(t,d,"Decomposes");if(u)for(const m of u){let E=m.toString();if(l){const g=await t.getProperties(m);if(!g)continue;E=(c=g.Name)==null?void 0:c.value}this.saveItem(t,o,E,d,m)}const f=s.getEntityRelations(t,d,"ContainsElements");if(!f)continue;let p=d.toString();if(l){const m=await t.getProperties(d);if(!m)continue;p=(h=m.Name)==null?void 0:h.value}for(const m of f){this.saveItem(t,o,p,m,d);const E=s.getEntityRelations(t,Number(m),"IsDecomposedBy");if(E)for(const g of E)this.saveItem(t,o,p,g,d)}}}setColor(t,i,s=!1){const n=this.components.get(wt);for(const o in t){const a=n.list.get(o);if(!a)continue;const l=t[o];a.setColor(i,l,s)}}resetColor(t){const i=this.components.get(wt);for(const s in t){const n=i.list.get(s);if(!n)continue;const o=t[s];n.resetColor(o)}}saveItem(t,i,s,n,o=null){this.list[i]||(this.list[i]={});const a=t.data.get(n);if(a)for(const l of a[0]){const c=t.keyFragments.get(l);if(c){const h=this.list[i];h[s]||(h[s]={map:{},id:o,name:s}),h[s].map[c]||(h[s].map[c]=new Set),h[s].map[c].add(n)}}}};y(wr,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let Ki=wr;const Ar=class Ar extends Ot{constructor(t){super(t);y(this,"onDisposed",new K);y(this,"enabled",!0);y(this,"height",10);y(this,"groupName","spatialStructures");y(this,"list",new Set);t.add(Ar.uuid,this)}dispose(){this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}set(t){if(!this.enabled)return;const i=this.components.get(Ki),s=this.components.get(wt),n=t?1:-1;let o=0;const a=i.list[this.groupName],l=new D.Matrix4;for(const c in a){l.elements[13]=o*n*this.height;for(const h in a[c].map){const d=s.list.get(h),u=c+h,f=this.list.has(u);if(!d||t&&f||!t&&!f)continue;t?this.list.add(u):this.list.delete(u);const p=a[c].map[h];d.applyTransform(p,l),d.mesh.computeBoundingSphere(),d.mesh.computeBoundingBox()}o++}}};y(Ar,"uuid","d260618b-ce88-4c7d-826c-6debb91de3e2");let aa=Ar;const Rr=class Rr extends Ot{constructor(t){super(t);y(this,"enabled",!0);this.components.add(Rr.uuid,this)}set(t,i){const s=this.components.get(wt);if(!i){for(const[n,o]of s.list)o&&(o.setVisibility(t),this.updateCulledVisibility(o));return}for(const n in i){const o=i[n],a=s.list.get(n);a&&(a.setVisibility(t,o),this.updateCulledVisibility(a))}}isolate(t){this.set(!1),this.set(!0,t)}updateCulledVisibility(t){const i=this.components.get(Qn);for(const[s,n]of i.list){const o=n.colorMeshes.get(t.id);o&&(o.count=t.mesh.count)}}};y(Rr,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");let br=Rr;class Bd extends Kr{constructor(){super(...arguments);y(this,"minGeometrySize",10);y(this,"minAssetsSize",1e3)}}const Sr=class Sr extends Ot{constructor(t){super(t);y(this,"onGeometryStreamed",new K);y(this,"onAssetStreamed",new K);y(this,"onProgress",new K);y(this,"onIfcLoaded",new K);y(this,"onDisposed",new K);y(this,"settings",new Bd);y(this,"enabled",!0);y(this,"webIfc",new tt.IfcAPI);y(this,"_spatialTree",new Md);y(this,"_metaData",new Ud);y(this,"_visitedGeometries",new Map);y(this,"_streamSerializer",new We.StreamSerializer);y(this,"_geometries",new Map);y(this,"_geometryCount",0);y(this,"_civil",new Dd);y(this,"_groupSerializer",new We.Serializer);y(this,"_assets",[]);y(this,"_meshesWithHoles",new Set);this.components.add(Sr.uuid,this),this.settings.excludedCategories.add(tt.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:i,absolute:s,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(i,s),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:i,absolute:s,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(i,s),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllGeometries(){const{minGeometrySize:t,minAssetsSize:i}=this.settings;this._spatialTree.setUp(this.webIfc);const s=this.webIfc.GetIfcEntityList(0),n=[[]],o=new We.FragmentsGroup;o.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 a=0,l=0;for(const m of s){if(!this.webIfc.IsIfcElement(m)&&m!==tt.IFCSPACE||this.settings.excludedCategories.has(m))continue;const E=this.webIfc.GetLineIDsWithType(0,m),g=E.size();for(let I=0;I<g;I++){a>t&&(a=0,l++,n.push([]));const T=E.get(I);n[l].push(T);const b=this.webIfc.GetLine(0,T);if(b.GlobalId){const A=(b==null?void 0:b.GlobalId.value)||(b==null?void 0:b.GlobalId);o.globalToExpressIDs.set(A,T)}const v=this._spatialTree.itemsByFloor[T]||0;o.data.set(T,[[],[v,m]]),a++}}this._spatialTree.cleanUp();let c=.01,h=0;for(const m of n){h++,this.webIfc.StreamMeshes(0,m,g=>{this.getMesh(this.webIfc,g,o)}),this._geometryCount>t&&await this.streamGeometries(),this._assets.length>i&&await this.streamAssets();const E=h/n.length;E>c&&(c+=.01,c=Math.max(c,E),this.onProgress.trigger(Math.round(c*100)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:d,transparent:u}=o.geometryIDs;for(const[m,{index:E,uuid:g}]of this._visitedGeometries)o.keyFragments.set(E,g),(m>1?d:u).set(m,E);kd.get(o,this.webIfc);const f=this.webIfc.GetCoordinationMatrix(0);o.coordinationMatrix.fromArray(f),o.civilData=this._civil.read(this.webIfc);const p=this._groupSerializer.export(o);this.onIfcLoaded.trigger(p),o.dispose(!0)}cleanUp(){try{this.webIfc.Dispose()}catch{}this.webIfc=null,this.webIfc=new tt.IfcAPI,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(t,i,s){const n=i.geometries.size(),o=i.expressID,a={id:o,geometries:[]};for(let l=0;l<n;l++){const c=i.geometries.get(l),h=c.geometryExpressID,d=c.color.w===1?1:-1,u=h*d;if(!this._visitedGeometries.has(u)){this._visitedGeometries.has(h)||this.getGeometry(t,h);const v=this._visitedGeometries.size,A=D.MathUtils.generateUUID();this._visitedGeometries.set(u,{uuid:A,index:v})}const f=this._visitedGeometries.get(u);if(f===void 0)throw new Error("Error getting geometry data for streaming!");const p=s.data.get(o);if(!p)throw new Error("Data not found!");p[0].push(f.index);const{x:m,y:E,z:g,w:I}=c.color,T=[m,E,g,I],b=c.flatTransformation;a.geometries.push({color:T,geometryID:h,transformation:b})}this._assets.push(a)}getGeometry(t,i){const s=t.GetGeometry(0,i),n=t.GetIndexArray(s.GetIndexData(),s.GetIndexDataSize()),o=t.GetVertexArray(s.GetVertexData(),s.GetVertexDataSize()),a=new Float32Array(o.length/2),l=new Float32Array(o.length/2);for(let f=0;f<o.length;f+=6)a[f/2]=o[f],a[f/2+1]=o[f+1],a[f/2+2]=o[f+2],l[f/2]=o[f+3],l[f/2+1]=o[f+4],l[f/2+2]=o[f+5];const c=Oc(a),h=new Float32Array(c.transformation.elements),d=[c.center.x,c.center.y,c.center.z];let u=!1;for(let f=0;f<a.length-2;f+=3){const p=a[f],m=a[f+1],E=a[f+2],g=l[f],I=l[f+1],T=l[f+2];if(xc(d,[p,m,E],[g,I,T])){u=!0;break}}this._geometries.set(i,{position:a,normal:l,index:n,boundingBox:h,hasHoles:u}),s.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),i={};for(const[s,{boundingBox:n,hasHoles:o}]of this._geometries)i[s]={boundingBox:n,hasHoles:o};this.onGeometryStreamed.trigger({data:i,buffer:t}),i=null,t=null,this._geometries.clear(),this._geometryCount=0}};y(Sr,"uuid","d9999a00-e1f5-4d3f-8cfe-c56e08609764");let la=Sr;class zd extends Kr{constructor(){super(...arguments);y(this,"propertiesSize",100)}}class $d extends Ot{constructor(){super(...arguments);y(this,"onPropertiesStreamed",new Ns);y(this,"onProgress",new Ns);y(this,"onIndicesStreamed",new Ns);y(this,"onDisposed",new K);y(this,"enabled",!0);y(this,"settings",new zd);y(this,"webIfc",new tt.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:i,absolute:s,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(i,s),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModel(t,this.settings.webIfc)}async streamIfcFile(t){const{path:i,absolute:s,logLevel:n}=this.settings.wasm;this.webIfc.SetWasmPath(i,s),await this.webIfc.Init(),n&&this.webIfc.SetLogLevel(n),this.webIfc.OpenModelFromCallback(t,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:t}=this.settings,i=new Set(this.webIfc.GetIfcEntityList(0)),s=new Set([tt.IFCPROJECT,tt.IFCSITE,tt.IFCBUILDING,tt.IFCBUILDINGSTOREY,tt.IFCSPACE]);for(const c of s)i.add(c);let n=.01,o=0;for(const c of i){if(o++,Da.has(c))continue;const h=s.has(c),d=this.webIfc.GetLineIDsWithType(0,c),u=d.size();let f=0;for(let m=0;m<u-t;m+=t){const E={};for(let g=0;g<t;g++){f++;const I=d.get(m+g);try{const T=this.webIfc.GetLine(0,I,h);E[T.expressID]=T}catch{console.log(`Could not get property: ${I}`)}}await this.onPropertiesStreamed.trigger({type:c,data:E})}if(f!==u){const m={};for(let E=f;E<u;E++){const g=d.get(E);try{const I=this.webIfc.GetLine(0,g,h);m[I.expressID]=I}catch{console.log(`Could not get property: ${g}`)}}await this.onPropertiesStreamed.trigger({type:c,data:m})}o/i.size>n&&(n=Math.round(n*100)/100,await this.onProgress.trigger(n),n+=.01)}await this.onProgress.trigger(1);const l=await this.components.get(gi).processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(l)}cleanUp(){this.webIfc.Dispose(),this.webIfc=null,this.webIfc=new tt.IfcAPI}}y($d,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");class ka{constructor(e,t,i){y(this,"title");y(this,"guid",Le.create());y(this,"clippingPlanes",new $i);y(this,"camera",{aspectRatio:0,fov:0,direction:{x:0,y:0,z:80},position:{x:0,y:0,z:0}});y(this,"exceptionComponents",new $i);y(this,"selectionComponents",new $i);y(this,"componentColors",new pi);y(this,"spacesVisible",!1);y(this,"spaceBoundariesVisible",!1);y(this,"openingsVisible",!1);y(this,"defaultVisibility",!0);y(this,"_components");y(this,"world");const s={setCamera:!0,...i},{data:n,setCamera:o}=s;this._components=e,this.world=t,n&&(this.guid=n.guid??this.guid,this.set(n)),o&&this.updateCamera()}get _selectionModelIdMap(){const e=this._components.get(wt),t={};for(const[i,s]of e.groups){i in t||(t[i]=new Set);for(const n of this.selectionComponents){const o=s.globalToExpressIDs.get(n);o&&t[i].add(o)}}return t}get _exceptionModelIdMap(){const e=this._components.get(wt),t={};for(const[i,s]of e.groups){i in t||(t[i]=new Set);for(const n of this.exceptionComponents){const o=s.globalToExpressIDs.get(n);o&&t[i].add(o)}}return t}get selection(){return this._components.get(wt).modelIdToFragmentIdMap(this._selectionModelIdMap)}get exception(){return this._components.get(wt).modelIdToFragmentIdMap(this._exceptionModelIdMap)}get projection(){return"fov"in this.camera?"Perspective":"Orthographic"}get position(){const e=this._components.get(wt),{position:t}=this.camera,{x:i,y:s,z:n}=t,o=new D.Vector3(i,s,n);return e.applyBaseCoordinateSystem(o,new D.Matrix4),o}get direction(){const{direction:e}=this.camera,{x:t,y:i,z:s}=e;return new D.Vector3(t,i,s)}get _managerVersion(){return this._components.get(Mt).config.version}get topics(){return[...this._components.get(Mt).list.values()].filter(s=>s.viewpoints.has(this.guid))}async addComponentsFromMap(e){var s;const t=this._components.get(wt);for(const n in e){const o=t.list.get(n);if(!(o&&o.group))continue;const a=o.group,l=e[n];for(const c of l){const h=await a.getProperties(c);if(!h)continue;const d=(s=h.GlobalId)==null?void 0:s.value;d&&this.selectionComponents.add(d)}}this._components.get(Ht).list.set(this.guid,this)}set(e){const t=e,i=this;for(const n in e){if(n==="guid")continue;const o=t[n];n in this&&(i[n]=o)}return this._components.get(Ht).list.set(this.guid,this),this}async go(e=!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 Yc&&t.projection.set(this.projection);const i=this.position,s=this.direction;let n={x:i.x+s.x*80,y:i.y+s.y*80,z:i.z+s.z*80};const o=this.selection;if(Object.keys(o).length===0){const h=this._components.get(mi).get(this.world).castRayFromVector(i,this.direction);h&&(n=h.point)}else{const l=this._components.get(mr);l.reset(),l.addFragmentIdMap(o),n=l.getSphere().center,l.reset()}const a=this._components.get(br);a.set(this.defaultVisibility),a.set(!this.defaultVisibility,this.exception),a.set(!0,o),await t.controls.setLookAt(i.x,i.y,i.z,n.x,n.y,n.z,e)}updateCamera(){const{camera:e,renderer:t}=this.world;if(!t)throw new Error("Viewpoint: the world needs to have a renderer!");if(!e.hasCameraControls())throw new Error("Viewpoint: world's camera need camera controls!");const i=new D.Vector3;e.controls.getPosition(i);const s=e.three,n=new D.Vector3(0,0,-1).applyEuler(s.rotation),{width:o,height:a}=t.getSize();let l=o/a;Number.isNaN(l)&&(l=1);const c=this._components.get(wt);i.applyMatrix4(c.baseCoordinationMatrix.clone().invert());const h={aspectRatio:l,position:{x:i.x,y:i.y,z:i.z},direction:{x:n.x,y:n.y,z:n.z}};s instanceof D.PerspectiveCamera?this.camera={...h,fov:s.fov}:s instanceof D.OrthographicCamera&&(this.camera={...h,viewToWorldScale:s.top-s.bottom}),this._components.get(Ht).list.set(this.guid,this)}colorize(){const e=this._components.get(Ht),t=this._components.get(wt),i=this._components.get(Ki);for(const[s,n]of this.componentColors){const o=t.guidToFragmentIdMap(n),a=new D.Color(`#${s}`);i.setColor(o,a,e.config.overwriteColors)}}resetColors(){const e=this._components.get(wt),t=this._components.get(Ki);for(const[i,s]of this.componentColors){const n=e.guidToFragmentIdMap(s);t.resetColor(n)}}async createComponentTags(e){var n,o;const t=this._components.get(wt),i=this._components.get(Mt);let s="";if(i.config.includeSelectionTag){const a=e==="selection"?this._selectionModelIdMap:this._exceptionModelIdMap;for(const l in a){const c=t.groups.get(l);if(!c)continue;const h=a[l];for(const d of h){const u=await c.getProperties(d);if(!u)continue;const f=(n=u.GlobalId)==null?void 0:n.value;if(!f)continue;const p=(o=u.Tag)==null?void 0:o.value;let m=null;p&&(m=`AuthoringToolId="${p}"`),s+=`
2134
2283
  <Component IfcGuid="${f}" ${m??""} />`}}}else s=[...this.selectionComponents].map(a=>`<Component IfcGuid="${a}" />`).join(`
2135
- `);return s}async serialize(e=this._managerVersion){const t=this._components.get(St),i=this.position;i.applyMatrix4(t.baseCoordinationMatrix.clone().invert());const s=this.direction;s.normalize();const r=new M.Matrix4().makeRotationX(Math.PI/2),o=s.clone().applyMatrix4(r);o.normalize();const a=`<CameraViewPoint>
2284
+ `);return s}async serialize(e=this._managerVersion){const t=this._components.get(wt),i=this.position;i.applyMatrix4(t.baseCoordinationMatrix.clone().invert());const s=this.direction;s.normalize();const n=new D.Matrix4().makeRotationX(Math.PI/2),o=s.clone().applyMatrix4(n);o.normalize();const a=`<CameraViewPoint>
2136
2285
  <X>${i.x}</X>
2137
2286
  <Y>${-i.z}</Y>
2138
2287
  <Z>${i.y}</Z>
@@ -2167,4 +2316,4 @@ ${a}
2167
2316
  </Visibility>
2168
2317
  </Components>
2169
2318
  ${d}
2170
- </VisualizationInfo>`}}const Ar=class Ar extends Ot{constructor(t){super(t);y(this,"enabled",!0);y(this,"list",new Bs);y(this,"onDisposed",new Q);t.add(Ar.uuid,this)}create(t,i){const s=new Dd(this.components,t);return i&&(s.guid=i.guid??s.guid,s.set(i)),this.list.set(s.guid,s),s}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}};y(Ar,"uuid","ee867824-a796-408d-8aa0-4e5962a83c66");let Qs=Ar;class Ud{constructor(e){y(this,"onDisposed",new Q);y(this,"onAfterUpdate",new Q);y(this,"onBeforeUpdate",new Q);y(this,"onResize",new Q);y(this,"frontOffset",0);y(this,"overrideMaterial",new M.MeshDepthMaterial);y(this,"backgroundColor",new M.Color(395274));y(this,"renderer");y(this,"enabled",!0);y(this,"world");y(this,"_lockRotation",!0);y(this,"_camera");y(this,"_plane");y(this,"_size",new M.Vector2(320,160));y(this,"_tempVector1",new M.Vector3);y(this,"_tempVector2",new M.Vector3);y(this,"_tempTarget",new M.Vector3);y(this,"down",new M.Vector3(0,-1,0));y(this,"updatePlanes",()=>{if(!this.world.renderer)throw new Error("The given world must have a renderer!");const e=[],t=this.world.renderer.three;for(const i of t.clippingPlanes)e.push(i);e.push(this._plane),this.renderer.clippingPlanes=e});if(this.world=e,!this.world.renderer)throw new Error("The given world must have a renderer!");this.renderer=new M.WebGLRenderer,this.renderer.setSize(this._size.x,this._size.y);const t=1,i=this._size.x/this._size.y;this._camera=new M.OrthographicCamera(t*i/-2,t*i/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 M.Plane(this.down,200),this.updatePlanes()}get lockRotation(){return this._lockRotation}set lockRotation(e){this._lockRotation=e,e&&(this._camera.rotation.z=0)}get zoom(){return this._camera.zoom}set zoom(e){this._camera.zoom=e,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 e=this.world.scene.three,t=this.world.camera;if(!t.hasCameraControls())throw new Error("The given world must use camera controls!");if(!(e instanceof M.Scene))throw new Error("The given world must have a THREE.Scene as a root!");const i=t.controls;if(i.getPosition(this._tempVector1),this._camera.position.x=this._tempVector1.x,this._camera.position.z=this._tempVector1.z,this.frontOffset!==0&&(i.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){i.getTarget(this._tempTarget);const r=Math.atan2(this._tempTarget.x-this._tempVector1.x,this._tempTarget.z-this._tempVector1.z);this._camera.rotation.z=r+Math.PI}this._plane.set(this.down,this._tempVector1.y);const s=e.background;e.background=this.backgroundColor,this.renderer.render(e,this._camera),e.background=s,this.onAfterUpdate.trigger()}getSize(){return this._size}resize(e=this._size){this._size.copy(e),this.renderer.setSize(e.x,e.y);const t=e.x/e.y,i=1;this._camera.left=i*t/-2,this._camera.right=i*t/2,this._camera.top=i/2,this._camera.bottom=-i/2,this._camera.updateProjectionMatrix(),this.onResize.trigger(e)}}const Rr=class Rr extends Ot{constructor(t){super(t);y(this,"onAfterUpdate",new Q);y(this,"onBeforeUpdate",new Q);y(this,"onDisposed",new Q);y(this,"enabled",!0);y(this,"list",new Map);this.components.add(Rr.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a minimap!");const i=new Ud(t);return this.list.set(t.uuid,i),i}delete(t){const i=this.list.get(t);i&&i.dispose(),this.list.delete(t)}dispose(){for(const[t,i]of this.list)i.dispose();this.list.clear(),this.onDisposed.trigger()}update(){for(const[t,i]of this.list)i.update()}};y(Rr,"uuid","39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");let aa=Rr;const Sr=class Sr extends Ot{constructor(t){super(t);y(this,"enabled",!0);t.add(Sr.uuid,this)}static distanceFromPointToLine(t,i,s,r=!1){const o=new M.Line3,a=new M.Vector3;return o.set(i,s),o.closestPointToPoint(t,r,a),a.distanceTo(t)}getFace(t,i,s){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const r=new Map,o=t.geometry.index.array,{plane:a}=this.getFaceData(i,s,t),l=[];for(let u=0;u<o.length/3;u++){const{plane:f,edges:p}=this.getFaceData(u,s,t);if(f.equals(a)){l.push({index:u,edges:p});for(const{id:m,points:E,distance:g}of p)r.set(m,{points:E,distance:g})}}let c=0;const h=new Map,d=new Map;for(const{index:u,edges:f}of l){const p=new Map;for(const{id:T}of f)if(h.has(T)){const A=h.get(T);p.set(T,A)}const m=f.map(T=>T.id);if(!p.size){const T=c++;for(const{id:A}of f)h.set(A,T);d.set(T,{edges:new Set(m),indices:new Set([u])});continue}let E=null;const g=new Set,b=new Set(m);for(const[T,A]of p){E===null?E=A:A!==E&&g.add(A),h.delete(T);const{edges:R}=d.get(A);R.delete(T),b.delete(T)}if(E===null)throw new Error("Error computing face!");const v=d.get(E),{indices:I}=v;I.add(u);for(const T of b){h.set(T,E);const{edges:A}=v;A.add(T)}for(const T of g){const A=d.get(T),{edges:R,indices:P}=A,F=d.get(E),{edges:x,indices:D}=F;for(const w of R)x.add(w),h.set(w,E);for(const w of P)D.add(w);d.delete(T)}}for(const[u,{indices:f,edges:p}]of d)if(f.has(i)){const m=[];for(const E of p){const g=r.get(E);m.push(g)}return{edges:m,indices:f}}return null}getVerticesAndNormal(t,i,s){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const r=t.geometry.index.array,o=t.geometry.attributes.position.array,a=t.geometry.attributes.normal.array,l=r[i*3]*3,c=r[i*3+1]*3,h=r[i*3+2]*3,d=new M.Vector3(o[l],o[l+1],o[l+2]),u=new M.Vector3(o[c],o[c+1],o[c+2]),f=new M.Vector3(o[h],o[h+1],o[h+2]),p=new M.Vector3(a[l],a[l+1],a[l+2]),m=new M.Vector3(a[c],a[c+1],a[c+2]),E=new M.Vector3(a[h],a[h+1],a[h+2]),g=(p.x+m.x+E.x)/3,b=(p.y+m.y+E.y)/3,v=(p.z+m.z+E.z)/3,I=new M.Vector3(g,b,v);if(s!==void 0&&t instanceof M.InstancedMesh){const T=new M.Matrix4;t.getMatrixAt(s,T);const A=new M.Matrix4;A.extractRotation(T),I.applyMatrix4(A),d.applyMatrix4(T),u.applyMatrix4(T),f.applyMatrix4(T)}return{p1:d,p2:u,p3:f,faceNormal:I}}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 i=this.components.get(St),s=new M.Matrix4,r=[];for(const a in t){const l=i.list.get(a);if(!l)continue;const c=t[a];let h=0;for(const f of c){const p=l.getInstancesIDs(f);p&&(h+=p.size)}const d=new M.InstancedMesh(l.mesh.geometry,void 0,h);let u=0;for(const f of c){const p=l.getInstancesIDs(f);if(p)for(const m of p)l.mesh.getMatrixAt(m,s),d.setMatrixAt(u++,s)}r.push(d)}const o=this.getVolumeFromMeshes(r);for(const a of r)a.geometry=null,a.material=[],a.dispose();return o}getVolumeFromMeshes(t){let i=0;for(const s of t)i+=this.getVolumeOfMesh(s);return i}getFaceData(t,i,s){const r=this.getVerticesAndNormal(s,t,i),{p1:o,p2:a,p3:l,faceNormal:c}=r;this.round(o),this.round(a),this.round(l),this.round(c);const h=[{id:`${o.x}|${o.y}|${o.z}`,value:o},{id:`${a.x}|${a.y}|${a.z}`,value:a},{id:`${l.x}|${l.y}|${l.z}`,value:l}];h.sort((v,I)=>v.id<I.id?-1:v.id>I.id?1:0);const[{id:d,value:u},{id:f,value:p},{id:m,value:E}]=h,g=[{id:`${d}|${f}`,distance:u.distanceTo(p),points:[u,p]},{id:`${f}|${m}`,distance:p.distanceTo(E),points:[p,E]},{id:`${d}|${m}`,distance:u.distanceTo(E),points:[u,E]}],b=new M.Plane;return b.setFromNormalAndCoplanarPoint(c,o),b.constant=Math.round(b.constant*10)/10,{plane:b,edges:g}}getVolumeOfMesh(t){let i=0;const s=new M.Vector3,r=new M.Vector3,o=new M.Vector3,{index:a}=t.geometry,l=t.geometry.attributes.position.array;if(!a)return console.warn("Geometry must be indexed to compute its volume!"),0;const c=[];if(t instanceof M.InstancedMesh)for(let d=0;d<t.count;d++){const u=new M.Matrix4;t.getMatrixAt(d,u),c.push(u)}else c.push(new M.Matrix4().identity());const{matrixWorld:h}=t;for(let d=0;d<a.array.length-2;d+=3)for(const u of c){const f=u.multiply(h),p=a.array[d]*3,m=a.array[d+1]*3,E=a.array[d+2]*3;s.set(l[p],l[p+1],l[p+2]).applyMatrix4(f),r.set(l[m],l[m+1],l[m+2]).applyMatrix4(f),o.set(l[E],l[E+1],l[E+2]).applyMatrix4(f),i+=this.getSignedVolumeOfTriangle(s,r,o)}return Math.abs(i)}getSignedVolumeOfTriangle(t,i,s){const r=s.x*i.y*t.z,o=i.x*s.y*t.z,a=s.x*t.y*i.z,l=t.x*s.y*i.z,c=i.x*t.y*s.z,h=t.x*i.y*s.z;return 1/6*(-r+o+a-l-c+h)}};y(Sr,"uuid","267ca032-672f-4cb0-afa9-d24e904f39d6");let la=Sr;exports.AsyncEvent=Ss;exports.BCFTopics=Dt;exports.Base=xr;exports.BaseCamera=Tc;exports.BaseRenderer=vc;exports.BaseScene=wc;exports.BaseWorldItem=Nr;exports.BoundingBoxer=dr;exports.Classifier=pr;exports.Clipper=Qn;exports.Comment=Kn;exports.Component=Ot;exports.Components=Xn;exports.CullerRenderer=Nc;exports.Cullers=qn;exports.DataMap=Bs;exports.DataSet=hi;exports.Disposer=Se;exports.Event=Q;exports.Exploder=ra;exports.FirstPersonMode=Uc;exports.FragmentsManager=St;exports.GeometryTypes=Pa;exports.Grids=Vo;exports.Hider=mr;exports.IfcCategories=lE;exports.IfcCategoryMap=La;exports.IfcElements=Sd;exports.IfcFragmentSettings=qr;exports.IfcGeometryTiler=oa;exports.IfcJsonExporter=ur;exports.IfcLoader=fr;exports.IfcPropertiesManager=na;exports.IfcPropertiesTiler=Md;exports.IfcPropertiesUtils=Ge;exports.IfcRelationsIndexer=pi;exports.IfcStreamingSettings=Pd;exports.MaterialsUtils=zo;exports.MeasurementUtils=la;exports.MeshCullerRenderer=Pc;exports.MiniMap=Ud;exports.MiniMaps=aa;exports.Mouse=Lc;exports.OrbitMode=kc;exports.OrthoPerspectiveCamera=Vc;exports.PlanMode=Bc;exports.ProjectionManager=zc;exports.PropertiesStreamingSettings=Ld;exports.Raycasters=fi;exports.ShadowedScene=ff;exports.SimpleCamera=Vi;exports.SimpleGrid=Dc;exports.SimplePlane=Pr;exports.SimpleRaycaster=Mc;exports.SimpleRenderer=rf;exports.SimpleScene=Fc;exports.SimpleWorld=Sc;exports.Topic=zs;exports.UUID=Fe;exports.VertexPicker=nf;exports.Viewpoint=Dd;exports.Viewpoints=Qs;exports.Worlds=Zn;exports.bcfTopicsList=aE;exports.isPointInFrontOfPlane=Rc;exports.obbFromPoints=Ac;exports.readPixelsAsync=fa;exports.topicForm=sE;exports.topicPanel=rE;
2319
+ </VisualizationInfo>`}}const Fr=class Fr extends Ot{constructor(t){super(t);y(this,"enabled",!0);y(this,"list",new pi);y(this,"isSetup",!1);y(this,"onSetup",new K);y(this,"config",{overwriteColors:!1});y(this,"onDisposed",new K);t.add(Fr.uuid,this)}create(t,i){const s=new ka(this.components,t,{data:i});return i||this.list.set(s.guid,s),s}setup(){}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}};y(Fr,"uuid","ee867824-a796-408d-8aa0-4e5962a83c66");let Ht=Fr;class Vd{constructor(e){y(this,"onDisposed",new K);y(this,"onAfterUpdate",new K);y(this,"onBeforeUpdate",new K);y(this,"onResize",new K);y(this,"frontOffset",0);y(this,"overrideMaterial",new D.MeshDepthMaterial);y(this,"backgroundColor",new D.Color(395274));y(this,"renderer");y(this,"enabled",!0);y(this,"world");y(this,"_lockRotation",!0);y(this,"_camera");y(this,"_plane");y(this,"_size",new D.Vector2(320,160));y(this,"_tempVector1",new D.Vector3);y(this,"_tempVector2",new D.Vector3);y(this,"_tempTarget",new D.Vector3);y(this,"down",new D.Vector3(0,-1,0));y(this,"updatePlanes",()=>{if(!this.world.renderer)throw new Error("The given world must have a renderer!");const e=[],t=this.world.renderer.three;for(const i of t.clippingPlanes)e.push(i);e.push(this._plane),this.renderer.clippingPlanes=e});if(this.world=e,!this.world.renderer)throw new Error("The given world must have a renderer!");this.renderer=new D.WebGLRenderer,this.renderer.setSize(this._size.x,this._size.y);const t=1,i=this._size.x/this._size.y;this._camera=new D.OrthographicCamera(t*i/-2,t*i/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 D.Plane(this.down,200),this.updatePlanes()}get lockRotation(){return this._lockRotation}set lockRotation(e){this._lockRotation=e,e&&(this._camera.rotation.z=0)}get zoom(){return this._camera.zoom}set zoom(e){this._camera.zoom=e,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 e=this.world.scene.three,t=this.world.camera;if(!t.hasCameraControls())throw new Error("The given world must use camera controls!");if(!(e instanceof D.Scene))throw new Error("The given world must have a THREE.Scene as a root!");const i=t.controls;if(i.getPosition(this._tempVector1),this._camera.position.x=this._tempVector1.x,this._camera.position.z=this._tempVector1.z,this.frontOffset!==0&&(i.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){i.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 s=e.background;e.background=this.backgroundColor,this.renderer.render(e,this._camera),e.background=s,this.onAfterUpdate.trigger()}getSize(){return this._size}resize(e=this._size){this._size.copy(e),this.renderer.setSize(e.x,e.y);const t=e.x/e.y,i=1;this._camera.left=i*t/-2,this._camera.right=i*t/2,this._camera.top=i/2,this._camera.bottom=-i/2,this._camera.updateProjectionMatrix(),this.onResize.trigger(e)}}const Or=class Or extends Ot{constructor(t){super(t);y(this,"onAfterUpdate",new K);y(this,"onBeforeUpdate",new K);y(this,"onDisposed",new K);y(this,"enabled",!0);y(this,"list",new Map);this.components.add(Or.uuid,this)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a minimap!");const i=new Vd(t);return this.list.set(t.uuid,i),i}delete(t){const i=this.list.get(t);i&&i.dispose(),this.list.delete(t)}dispose(){for(const[t,i]of this.list)i.dispose();this.list.clear(),this.onDisposed.trigger()}update(){for(const[t,i]of this.list)i.update()}};y(Or,"uuid","39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");let ca=Or;const xr=class xr extends Ot{constructor(t){super(t);y(this,"enabled",!0);t.add(xr.uuid,this)}static distanceFromPointToLine(t,i,s,n=!1){const o=new D.Line3,a=new D.Vector3;return o.set(i,s),o.closestPointToPoint(t,n,a),a.distanceTo(t)}getFace(t,i,s){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const n=new Map,o=t.geometry.index.array,{plane:a}=this.getFaceData(i,s,t),l=[];for(let u=0;u<o.length/3;u++){const{plane:f,edges:p}=this.getFaceData(u,s,t);if(f.equals(a)){l.push({index:u,edges:p});for(const{id:m,points:E,distance:g}of p)n.set(m,{points:E,distance:g})}}let c=0;const h=new Map,d=new Map;for(const{index:u,edges:f}of l){const p=new Map;for(const{id:v}of f)if(h.has(v)){const A=h.get(v);p.set(v,A)}const m=f.map(v=>v.id);if(!p.size){const v=c++;for(const{id:A}of f)h.set(A,v);d.set(v,{edges:new Set(m),indices:new Set([u])});continue}let E=null;const g=new Set,I=new Set(m);for(const[v,A]of p){E===null?E=A:A!==E&&g.add(A),h.delete(v);const{edges:S}=d.get(A);S.delete(v),I.delete(v)}if(E===null)throw new Error("Error computing face!");const T=d.get(E),{indices:b}=T;b.add(u);for(const v of I){h.set(v,E);const{edges:A}=T;A.add(v)}for(const v of g){const A=d.get(v),{edges:S,indices:N}=A,R=d.get(E),{edges:P,indices:M}=R;for(const w of S)P.add(w),h.set(w,E);for(const w of N)M.add(w);d.delete(v)}}for(const[u,{indices:f,edges:p}]of d)if(f.has(i)){const m=[];for(const E of p){const g=n.get(E);m.push(g)}return{edges:m,indices:f}}return null}getVerticesAndNormal(t,i,s){if(!t.geometry.index)throw new Error("Geometry must be indexed!");const n=t.geometry.index.array,o=t.geometry.attributes.position.array,a=t.geometry.attributes.normal.array,l=n[i*3]*3,c=n[i*3+1]*3,h=n[i*3+2]*3,d=new D.Vector3(o[l],o[l+1],o[l+2]),u=new D.Vector3(o[c],o[c+1],o[c+2]),f=new D.Vector3(o[h],o[h+1],o[h+2]),p=new D.Vector3(a[l],a[l+1],a[l+2]),m=new D.Vector3(a[c],a[c+1],a[c+2]),E=new D.Vector3(a[h],a[h+1],a[h+2]),g=(p.x+m.x+E.x)/3,I=(p.y+m.y+E.y)/3,T=(p.z+m.z+E.z)/3,b=new D.Vector3(g,I,T);if(s!==void 0&&t instanceof D.InstancedMesh){const v=new D.Matrix4;t.getMatrixAt(s,v);const A=new D.Matrix4;A.extractRotation(v),b.applyMatrix4(A),d.applyMatrix4(v),u.applyMatrix4(v),f.applyMatrix4(v)}return{p1:d,p2:u,p3:f,faceNormal:b}}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 i=this.components.get(wt),s=new D.Matrix4,n=[];for(const a in t){const l=i.list.get(a);if(!l)continue;const c=t[a];let h=0;for(const f of c){const p=l.getInstancesIDs(f);p&&(h+=p.size)}const d=new D.InstancedMesh(l.mesh.geometry,void 0,h);let u=0;for(const f of c){const p=l.getInstancesIDs(f);if(p)for(const m of p)l.mesh.getMatrixAt(m,s),d.setMatrixAt(u++,s)}n.push(d)}const o=this.getVolumeFromMeshes(n);for(const a of n)a.geometry=null,a.material=[],a.dispose();return o}getVolumeFromMeshes(t){let i=0;for(const s of t)i+=this.getVolumeOfMesh(s);return i}getFaceData(t,i,s){const n=this.getVerticesAndNormal(s,t,i),{p1:o,p2:a,p3:l,faceNormal:c}=n;this.round(o),this.round(a),this.round(l),this.round(c);const h=[{id:`${o.x}|${o.y}|${o.z}`,value:o},{id:`${a.x}|${a.y}|${a.z}`,value:a},{id:`${l.x}|${l.y}|${l.z}`,value:l}];h.sort((T,b)=>T.id<b.id?-1:T.id>b.id?1:0);const[{id:d,value:u},{id:f,value:p},{id:m,value:E}]=h,g=[{id:`${d}|${f}`,distance:u.distanceTo(p),points:[u,p]},{id:`${f}|${m}`,distance:p.distanceTo(E),points:[p,E]},{id:`${d}|${m}`,distance:u.distanceTo(E),points:[u,E]}],I=new D.Plane;return I.setFromNormalAndCoplanarPoint(c,o),I.constant=Math.round(I.constant*10)/10,{plane:I,edges:g}}getVolumeOfMesh(t){let i=0;const s=new D.Vector3,n=new D.Vector3,o=new D.Vector3,{index:a}=t.geometry,l=t.geometry.attributes.position.array;if(!a)return console.warn("Geometry must be indexed to compute its volume!"),0;const c=[];if(t instanceof D.InstancedMesh)for(let d=0;d<t.count;d++){const u=new D.Matrix4;t.getMatrixAt(d,u),c.push(u)}else c.push(new D.Matrix4().identity());const{matrixWorld:h}=t;for(let d=0;d<a.array.length-2;d+=3)for(const u of c){const f=u.multiply(h),p=a.array[d]*3,m=a.array[d+1]*3,E=a.array[d+2]*3;s.set(l[p],l[p+1],l[p+2]).applyMatrix4(f),n.set(l[m],l[m+1],l[m+2]).applyMatrix4(f),o.set(l[E],l[E+1],l[E+2]).applyMatrix4(f),i+=this.getSignedVolumeOfTriangle(s,n,o)}return Math.abs(i)}getSignedVolumeOfTriangle(t,i,s){const n=s.x*i.y*t.z,o=i.x*s.y*t.z,a=s.x*t.y*i.z,l=t.x*s.y*i.z,c=i.x*t.y*s.z,h=t.x*i.y*s.z;return 1/6*(-n+o+a-l-c+h)}};y(xr,"uuid","267ca032-672f-4cb0-afa9-d24e904f39d6");let ha=xr;exports.AsyncEvent=Ns;exports.BCFTopics=Mt;exports.Base=Lr;exports.BaseCamera=Rc;exports.BaseRenderer=Sc;exports.BaseScene=Fc;exports.BaseWorldItem=Mr;exports.BoundingBoxer=mr;exports.Classifier=Ki;exports.Clipper=Kn;exports.Comment=Jn;exports.Component=Ot;exports.Components=Zn;exports.CullerRenderer=Dc;exports.Cullers=Qn;exports.DataMap=pi;exports.DataSet=$i;exports.Disposer=Pe;exports.Event=K;exports.Exploder=aa;exports.FirstPersonMode=$c;exports.FragmentsManager=wt;exports.GeometryTypes=Da;exports.Grids=Go;exports.Hider=br;exports.IfcCategories=IE;exports.IfcCategoryMap=Ua;exports.IfcElements=Ld;exports.IfcFragmentSettings=Kr;exports.IfcGeometryTiler=la;exports.IfcJsonExporter=gr;exports.IfcLoader=Er;exports.IfcPropertiesManager=oa;exports.IfcPropertiesTiler=$d;exports.IfcPropertiesUtils=je;exports.IfcRelationsIndexer=gi;exports.IfcStreamingSettings=Bd;exports.MaterialsUtils=Vo;exports.MeasurementUtils=ha;exports.MeshCullerRenderer=Uc;exports.MiniMap=Vd;exports.MiniMaps=ca;exports.Mouse=kc;exports.OrbitMode=Vc;exports.OrthoPerspectiveCamera=Yc;exports.PlanMode=Gc;exports.ProjectionManager=Hc;exports.PropertiesStreamingSettings=zd;exports.Raycasters=mi;exports.ShadowedScene=bf;exports.SimpleCamera=Gi;exports.SimpleGrid=zc;exports.SimplePlane=Dr;exports.SimpleRaycaster=Bc;exports.SimpleRenderer=hf;exports.SimpleScene=Pc;exports.SimpleWorld=Nc;exports.Topic=Gs;exports.UUID=Le;exports.VertexPicker=cf;exports.Viewpoint=ka;exports.Viewpoints=Ht;exports.Worlds=qn;exports.bcfTopicsList=Pd;exports.isPointInFrontOfPlane=xc;exports.obbFromPoints=Oc;exports.readPixelsAsync=ma;exports.topicForm=aE;exports.topicPanel=bE;exports.viewpointsList=Ma;