@thatopen/components 2.4.1 → 2.4.3

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.
@@ -1,11 +1,11 @@
1
- "use strict";var e=Object.defineProperty,t=(t,i,s)=>(((t,i,s)=>{i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[i]=s})(t,"symbol"!=typeof i?i+"":i,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("three"),s=require("@thatopen/fragments"),n=require("web-ifc");function r(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const i in e)if("default"!==i){const s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>e[i]})}return t.default=e,Object.freeze(t)}const o=r(i),a=r(s),c=r(n),l=1.25,h=65535,u=Math.pow(2,-24),I=Symbol("SKIP_GENERATION");function d(e){return function(e){return e.index?e.index.count:e.attributes.position.count}(e)/3}function E(e,t){if(!e.index){const s=e.attributes.position.count,n=function(e,t=ArrayBuffer){return e>65535?new Uint32Array(new t(4*e)):new Uint16Array(new t(2*e))}(s,t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer);e.setIndex(new i.BufferAttribute(n,1));for(let e=0;e<s;e++)n[e]=e}}function f(e){const t=d(e),i=e.drawRange,s=i.start/3,n=(i.start+i.count)/3,r=Math.max(0,s),o=Math.min(t,n)-r;return[{offset:Math.floor(r),count:Math.floor(o)}]}function p(e){if(!e.groups||!e.groups.length)return f(e);const t=[],i=new Set,s=e.drawRange,n=s.start/3,r=(s.start+s.count)/3;for(const t of e.groups){const e=t.start/3,s=(t.start+t.count)/3;i.add(Math.max(n,e)),i.add(Math.min(r,s))}const o=Array.from(i.values()).sort(((e,t)=>e-t));for(let e=0;e<o.length-1;e++){const i=o[e],s=o[e+1];t.push({offset:Math.floor(i),count:Math.floor(s-i)})}return t}function C(e,t,i){return i.min.x=t[e],i.min.y=t[e+1],i.min.z=t[e+2],i.max.x=t[e+3],i.max.y=t[e+4],i.max.z=t[e+5],i}function T(e){let t=-1,i=-1/0;for(let s=0;s<3;s++){const n=e[s+3]-e[s];n>i&&(i=n,t=s)}return t}function m(e,t){t.set(e)}function R(e,t,i){let s,n;for(let r=0;r<3;r++){const o=r+3;s=e[r],n=t[r],i[r]=s<n?s:n,s=e[o],n=t[o],i[o]=s>n?s:n}}function g(e,t,i){for(let s=0;s<3;s++){const n=t[e+2*s],r=t[e+2*s+1],o=n-r,a=n+r;o<i[s]&&(i[s]=o),a>i[s+3]&&(i[s+3]=a)}}function A(e){const t=e[3]-e[0],i=e[4]-e[1],s=e[5]-e[2];return 2*(t*i+i*s+s*t)}function F(e,t,i,s,n=null){let r=1/0,o=1/0,a=1/0,c=-1/0,l=-1/0,h=-1/0,u=1/0,I=1/0,d=1/0,E=-1/0,f=-1/0,p=-1/0;const C=null!==n;for(let s=6*t,n=6*(t+i);s<n;s+=6){const t=e[s+0],i=e[s+1],n=t-i,T=t+i;n<r&&(r=n),T>c&&(c=T),C&&t<u&&(u=t),C&&t>E&&(E=t);const m=e[s+2],R=e[s+3],g=m-R,A=m+R;g<o&&(o=g),A>l&&(l=A),C&&m<I&&(I=m),C&&m>f&&(f=m);const F=e[s+4],S=e[s+5],O=F-S,N=F+S;O<a&&(a=O),N>h&&(h=N),C&&F<d&&(d=F),C&&F>p&&(p=F)}s[0]=r,s[1]=o,s[2]=a,s[3]=c,s[4]=l,s[5]=h,C&&(n[0]=u,n[1]=I,n[2]=d,n[3]=E,n[4]=f,n[5]=p)}const S=32,O=(e,t)=>e.candidate-t.candidate,N=new Array(S).fill().map((()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0}))),y=new Float32Array(6);class L{constructor(){}}function _(e,t,i,s,n,r){let o=s,a=s+n-1;const c=r.pos,l=2*r.axis;for(;;){for(;o<=a&&i[6*o+l]<c;)o++;for(;o<=a&&i[6*a+l]>=c;)a--;if(!(o<a))return o;for(let e=0;e<3;e++){let i=t[3*o+e];t[3*o+e]=t[3*a+e],t[3*a+e]=i}for(let e=0;e<6;e++){let t=i[6*o+e];i[6*o+e]=i[6*a+e],i[6*a+e]=t}o++,a--}}function P(e,t,i,s,n,r){let o=s,a=s+n-1;const c=r.pos,l=2*r.axis;for(;;){for(;o<=a&&i[6*o+l]<c;)o++;for(;o<=a&&i[6*a+l]>=c;)a--;if(!(o<a))return o;{let t=e[o];e[o]=e[a],e[a]=t;for(let e=0;e<6;e++){let t=i[6*o+e];i[6*o+e]=i[6*a+e],i[6*a+e]=t}o++,a--}}}function w(e,t){const i=e.geometry,s=i.index?i.index.array:null,n=t.maxDepth,r=t.verbose,o=t.maxLeafTris,a=t.strategy,c=t.onProgress,h=d(i),I=e._indirectBuffer;let E=!1;const C=new Float32Array(6),w=new Float32Array(6),M=function(e,t){var i;(i=t)[0]=i[1]=i[2]=1/0,i[3]=i[4]=i[5]=-1/0;const s=e.attributes.position,n=e.index?e.index.array:null,r=d(e),o=new Float32Array(6*r),a=s.normalized,c=s.array,l=s.offset||0;let h=3;s.isInterleavedBufferAttribute&&(h=s.data.stride);const I=["getX","getY","getZ"];for(let e=0;e<r;e++){const i=3*e,r=6*e;let d=i+0,E=i+1,f=i+2;n&&(d=n[d],E=n[E],f=n[f]),a||(d=d*h+l,E=E*h+l,f=f*h+l);for(let e=0;e<3;e++){let i,n,l;a?(i=s[I[e]](d),n=s[I[e]](E),l=s[I[e]](f)):(i=c[d+e],n=c[E+e],l=c[f+e]);let h=i;n<h&&(h=n),l<h&&(h=l);let p=i;n>p&&(p=n),l>p&&(p=l);const C=(p-h)/2,T=2*e;o[r+T+0]=h+C,o[r+T+1]=C+(Math.abs(h)+C)*u,h<t[e]&&(t[e]=h),p>t[e+3]&&(t[e+3]=p)}}return o}(i,C),v=t.indirect?P:_,D=[],b=t.indirect?f(i):p(i);if(1===b.length){const e=b[0],t=new L;t.boundingData=C,function(e,t,i,s){let n=1/0,r=1/0,o=1/0,a=-1/0,c=-1/0,l=-1/0;for(let s=6*t,h=6*(t+i);s<h;s+=6){const t=e[s+0];t<n&&(n=t),t>a&&(a=t);const i=e[s+2];i<r&&(r=i),i>c&&(c=i);const h=e[s+4];h<o&&(o=h),h>l&&(l=h)}s[0]=n,s[1]=r,s[2]=o,s[3]=a,s[4]=c,s[5]=l}(M,e.offset,e.count,w),x(t,e.offset,e.count,w),D.push(t)}else for(let e of b){const t=new L;t.boundingData=new Float32Array(6),F(M,e.offset,e.count,t.boundingData,w),x(t,e.offset,e.count,w),D.push(t)}return D;function U(e){c&&c(e/h)}function x(e,t,c,h=null,u=0){if(!E&&u>=n&&(E=!0,r&&(console.warn(`MeshBVH: Max depth of ${n} reached when generating BVH. Consider increasing maxDepth.`),console.warn(i))),c<=o||u>=n)return U(t+c),e.offset=t,e.count=c,e;const d=function(e,t,i,s,n,r){let o=-1,a=0;if(0===r)o=T(t),-1!==o&&(a=(t[o]+t[o+3])/2);else if(1===r)o=T(e),-1!==o&&(a=function(e,t,i,s){let n=0;for(let r=t,o=t+i;r<o;r++)n+=e[6*r+2*s];return n/i}(i,s,n,o));else if(2===r){const r=A(e);let c=l*n;const h=6*s,u=6*(s+n);for(let e=0;e<3;e++){const s=t[e],I=(t[e+3]-s)/S;if(n<8){const t=[...N];t.length=n;let s=0;for(let n=h;n<u;n+=6,s++){const r=t[s];r.candidate=i[n+2*e],r.count=0;const{bounds:o,leftCacheBounds:a,rightCacheBounds:c}=r;for(let e=0;e<3;e++)c[e]=1/0,c[e+3]=-1/0,a[e]=1/0,a[e+3]=-1/0,o[e]=1/0,o[e+3]=-1/0;g(n,i,o)}t.sort(O);let I=n;for(let e=0;e<I;e++){const i=t[e];for(;e+1<I&&t[e+1].candidate===i.candidate;)t.splice(e+1,1),I--}for(let s=h;s<u;s+=6){const n=i[s+2*e];for(let e=0;e<I;e++){const r=t[e];n>=r.candidate?g(s,i,r.rightCacheBounds):(g(s,i,r.leftCacheBounds),r.count++)}}for(let i=0;i<I;i++){const s=t[i],h=s.count,u=n-s.count,I=s.leftCacheBounds,d=s.rightCacheBounds;let E=0;0!==h&&(E=A(I)/r);let f=0;0!==u&&(f=A(d)/r);const p=1+l*(E*h+f*u);p<c&&(o=e,c=p,a=s.candidate)}}else{for(let e=0;e<S;e++){const t=N[e];t.count=0,t.candidate=s+I+e*I;const i=t.bounds;for(let e=0;e<3;e++)i[e]=1/0,i[e+3]=-1/0}for(let t=h;t<u;t+=6){let n=~~((i[t+2*e]-s)/I);n>=S&&(n=31);const r=N[n];r.count++,g(t,i,r.bounds)}const t=N[31];m(t.bounds,t.rightCacheBounds);for(let e=30;e>=0;e--){const t=N[e],i=N[e+1];R(t.bounds,i.rightCacheBounds,t.rightCacheBounds)}let d=0;for(let t=0;t<31;t++){const i=N[t],s=i.count,h=i.bounds,u=N[t+1].rightCacheBounds;0!==s&&(0===d?m(h,y):R(h,y,y)),d+=s;let I=0,E=0;0!==d&&(I=A(y)/r);const f=n-d;0!==f&&(E=A(u)/r);const p=1+l*(I*d+E*f);p<c&&(o=e,c=p,a=i.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${r} used.`);return{axis:o,pos:a}}(e.boundingData,h,M,t,c,a);if(-1===d.axis)return U(t+c),e.offset=t,e.count=c,e;const f=v(I,s,M,t,c,d);if(f===t||f===t+c)U(t+c),e.offset=t,e.count=c;else{e.splitAxis=d.axis;const i=new L,s=t,n=f-t;e.left=i,i.boundingData=new Float32Array(6),F(M,s,n,i.boundingData,w),x(i,s,n,w,u+1);const r=new L,o=f,a=c-n;e.right=r,r.boundingData=new Float32Array(6),F(M,o,a,r.boundingData,w),x(r,o,a,w,u+1)}return e}}function M(e,t){const i=e.geometry;t.indirect&&(e._indirectBuffer=function(e,t){const i=(e.index?e.index.count:e.attributes.position.count)/3,s=i>65536,n=s?4:2,r=t?new SharedArrayBuffer(i*n):new ArrayBuffer(i*n),o=s?new Uint32Array(r):new Uint16Array(r);for(let e=0,t=o.length;e<t;e++)o[e]=e;return o}(i,t.useSharedArrayBuffer),function(e){if(0===e.groups.length)return!1;const t=d(e),i=p(e).sort(((e,t)=>e.offset-t.offset)),s=i[i.length-1];s.count=Math.min(t-s.offset,s.count);let n=0;return i.forEach((({count:e})=>n+=e)),t!==n}(i)&&!t.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.')),e._indirectBuffer||E(i,t);const s=w(e,t);let n,r,o;const a=[],c=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let e=0;e<s.length;e++){const t=s[e];const i=new c(32*l(t));n=new Float32Array(i),r=new Uint32Array(i),o=new Uint16Array(i),u(0,t),a.push(i)}return void(e._roots=a);function l(e){return e.count?1:1+l(e.left)+l(e.right)}function u(e,t){const i=e/4,s=e/2,a=!!t.count,c=t.boundingData;for(let e=0;e<6;e++)n[i+e]=c[e];if(a){const n=t.offset,a=t.count;return r[i+6]=n,o[s+14]=a,o[s+15]=h,e+32}{const s=t.left,n=t.right,o=t.splitAxis;let a;if(a=u(e+32,s),a/4>Math.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return r[i+6]=a/4,a=u(a,n),r[i+7]=o,a}}}class v{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let i=1/0,s=-1/0;for(let n=0,r=e.length;n<r;n++){const r=e[n][t];i=r<i?r:i,s=r>s?r:s}this.min=i,this.max=s}setFromPoints(e,t){let i=1/0,s=-1/0;for(let n=0,r=t.length;n<r;n++){const r=t[n],o=e.dot(r);i=o<i?o:i,s=o>s?o:s}this.min=i,this.max=s}isSeparated(e){return this.min>e.max||e.min>this.max}}v.prototype.setFromBox=function(){const e=new i.Vector3;return function(t,i){const s=i.min,n=i.max;let r=1/0,o=-1/0;for(let i=0;i<=1;i++)for(let a=0;a<=1;a++)for(let c=0;c<=1;c++){e.x=s.x*i+n.x*(1-i),e.y=s.y*a+n.y*(1-a),e.z=s.z*c+n.z*(1-c);const l=t.dot(e);r=Math.min(l,r),o=Math.max(l,o)}this.min=r,this.max=o}}();const D=function(){const e=new i.Vector3,t=new i.Vector3,s=new i.Vector3;return function(i,n,r){const o=i.start,a=e,c=n.start,l=t;s.subVectors(o,c),e.subVectors(i.end,i.start),t.subVectors(n.end,n.start);const h=s.dot(l),u=l.dot(a),I=l.dot(l),d=s.dot(a),E=a.dot(a)*I-u*u;let f,p;f=0!==E?(h*u-d*I)/E:0,p=(h+f*u)/I,r.x=f,r.y=p}}(),b=function(){const e=new i.Vector2,t=new i.Vector3,s=new i.Vector3;return function(i,n,r,o){D(i,n,e);let a=e.x,c=e.y;if(a>=0&&a<=1&&c>=0&&c<=1)return i.at(a,r),void n.at(c,o);if(a>=0&&a<=1)return c<0?n.at(0,o):n.at(1,o),void i.closestPointToPoint(o,!0,r);if(c>=0&&c<=1)return a<0?i.at(0,r):i.at(1,r),void n.closestPointToPoint(r,!0,o);{let e,l;e=a<0?i.start:i.end,l=c<0?n.start:n.end;const h=t,u=s;return i.closestPointToPoint(l,!0,t),n.closestPointToPoint(e,!0,s),h.distanceToSquared(l)<=u.distanceToSquared(e)?(r.copy(h),void o.copy(l)):(r.copy(e),void o.copy(u))}}}(),U=function(){const e=new i.Vector3,t=new i.Vector3,s=new i.Plane,n=new i.Line3;return function(i,r){const{radius:o,center:a}=i,{a:c,b:l,c:h}=r;n.start=c,n.end=l;if(n.closestPointToPoint(a,!0,e).distanceTo(a)<=o)return!0;n.start=c,n.end=h;if(n.closestPointToPoint(a,!0,e).distanceTo(a)<=o)return!0;n.start=l,n.end=h;if(n.closestPointToPoint(a,!0,e).distanceTo(a)<=o)return!0;const u=r.getPlane(s);if(Math.abs(u.distanceToPoint(a))<=o){const e=u.projectPoint(a,t);if(r.containsPoint(e))return!0}return!1}}();function x(e){return Math.abs(e)<1e-15}class B extends i.Triangle{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map((()=>new i.Vector3)),this.satBounds=new Array(4).fill().map((()=>new v)),this.points=[this.a,this.b,this.c],this.sphere=new i.Sphere,this.plane=new i.Plane,this.needsUpdate=!0}intersectsSphere(e){return U(e,this)}update(){const e=this.a,t=this.b,i=this.c,s=this.points,n=this.satAxes,r=this.satBounds,o=n[0],a=r[0];this.getNormal(o),a.setFromPoints(o,s);const c=n[1],l=r[1];c.subVectors(e,t),l.setFromPoints(c,s);const h=n[2],u=r[2];h.subVectors(t,i),u.setFromPoints(h,s);const I=n[3],d=r[3];I.subVectors(i,e),d.setFromPoints(I,s),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(o,e),this.needsUpdate=!1}}B.prototype.closestPointToSegment=function(){const e=new i.Vector3,t=new i.Vector3,s=new i.Line3;return function(i,n=null,r=null){const{start:o,end:a}=i,c=this.points;let l,h=1/0;for(let o=0;o<3;o++){const a=(o+1)%3;s.start.copy(c[o]),s.end.copy(c[a]),b(s,i,e,t),l=e.distanceToSquared(t),l<h&&(h=l,n&&n.copy(e),r&&r.copy(t))}return this.closestPointToPoint(o,e),l=o.distanceToSquared(e),l<h&&(h=l,n&&n.copy(e),r&&r.copy(o)),this.closestPointToPoint(a,e),l=a.distanceToSquared(e),l<h&&(h=l,n&&n.copy(e),r&&r.copy(a)),Math.sqrt(h)}}(),B.prototype.intersectsTriangle=function(){const e=new B,t=new Array(3),s=new Array(3),n=new v,r=new v,o=new i.Vector3,a=new i.Vector3,c=new i.Vector3,l=new i.Vector3,h=new i.Vector3,u=new i.Line3,I=new i.Line3,d=new i.Line3,E=new i.Vector3;function f(e,t,i){const s=e.points;let n=0,r=-1;for(let e=0;e<3;e++){const{start:o,end:c}=u;o.copy(s[e]),c.copy(s[(e+1)%3]),u.delta(a);const l=x(t.distanceToPoint(o));if(x(t.normal.dot(a))&&l){i.copy(u),n=2;break}const h=t.intersectLine(u,E);if(!h&&l&&E.copy(o),(h||l)&&!x(E.distanceTo(c))){if(n<=1){(1===n?i.start:i.end).copy(E),l&&(r=n)}else if(n>=2){(1===r?i.start:i.end).copy(E),n=2;break}if(n++,2===n&&-1===r)break}}return n}return function(i,a=null,u=!1){this.needsUpdate&&this.update(),i.isExtendedTriangle?i.needsUpdate&&i.update():(e.copy(i),e.update(),i=e);const E=this.plane,p=i.plane;if(Math.abs(E.normal.dot(p.normal))>1-1e-10){const e=this.satBounds,c=this.satAxes;s[0]=i.a,s[1]=i.b,s[2]=i.c;for(let t=0;t<4;t++){const i=e[t],r=c[t];if(n.setFromPoints(r,s),i.isSeparated(n))return!1}const l=i.satBounds,h=i.satAxes;t[0]=this.a,t[1]=this.b,t[2]=this.c;for(let e=0;e<4;e++){const i=l[e],s=h[e];if(n.setFromPoints(s,t),i.isSeparated(n))return!1}for(let e=0;e<4;e++){const i=c[e];for(let e=0;e<4;e++){const a=h[e];if(o.crossVectors(i,a),n.setFromPoints(o,t),r.setFromPoints(o,s),n.isSeparated(r))return!1}}return a&&(u||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),a.start.set(0,0,0),a.end.set(0,0,0)),!0}{const e=f(this,p,I);if(1===e&&i.containsPoint(I.end))return a&&(a.start.copy(I.end),a.end.copy(I.end)),!0;if(2!==e)return!1;const t=f(i,E,d);if(1===t&&this.containsPoint(d.end))return a&&(a.start.copy(d.end),a.end.copy(d.end)),!0;if(2!==t)return!1;if(I.delta(c),d.delta(l),c.dot(l)<0){let e=d.start;d.start=d.end,d.end=e}const s=I.start.dot(c),n=I.end.dot(c),r=d.start.dot(c),o=d.end.dot(c);return(s===o||r===n||n<r!==s<o)&&(a&&(h.subVectors(I.start,d.start),h.dot(c)>0?a.start.copy(I.start):a.start.copy(d.start),h.subVectors(I.end,d.end),h.dot(c)<0?a.end.copy(I.end):a.end.copy(d.end)),!0)}}}(),B.prototype.distanceToPoint=function(){const e=new i.Vector3;return function(t){return this.closestPointToPoint(t,e),t.distanceTo(e)}}(),B.prototype.distanceToTriangle=function(){const e=new i.Vector3,t=new i.Vector3,s=["a","b","c"],n=new i.Line3,r=new i.Line3;return function(i,o=null,a=null){const c=o||a?n:null;if(this.intersectsTriangle(i,c))return(o||a)&&(o&&c.getCenter(o),a&&c.getCenter(a)),0;let l=1/0;for(let t=0;t<3;t++){let n;const r=s[t],c=i[r];this.closestPointToPoint(c,e),n=c.distanceToSquared(e),n<l&&(l=n,o&&o.copy(e),a&&a.copy(c));const h=this[r];i.closestPointToPoint(h,e),n=h.distanceToSquared(e),n<l&&(l=n,o&&o.copy(h),a&&a.copy(e))}for(let c=0;c<3;c++){const h=s[c],u=s[(c+1)%3];n.set(this[h],this[u]);for(let c=0;c<3;c++){const h=s[c],u=s[(c+1)%3];r.set(i[h],i[u]),b(n,r,e,t);const I=e.distanceToSquared(t);I<l&&(l=I,o&&o.copy(e),a&&a.copy(t))}}return Math.sqrt(l)}}();class V{constructor(e,t,s){this.isOrientedBox=!0,this.min=new i.Vector3,this.max=new i.Vector3,this.matrix=new i.Matrix4,this.invMatrix=new i.Matrix4,this.points=new Array(8).fill().map((()=>new i.Vector3)),this.satAxes=new Array(3).fill().map((()=>new i.Vector3)),this.satBounds=new Array(3).fill().map((()=>new v)),this.alignedSatBounds=new Array(3).fill().map((()=>new v)),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),s&&this.matrix.copy(s)}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}}V.prototype.update=function(){return function(){const e=this.matrix,t=this.min,i=this.max,s=this.points;for(let n=0;n<=1;n++)for(let r=0;r<=1;r++)for(let o=0;o<=1;o++){const a=s[1*n|2*r|4*o];a.x=n?i.x:t.x,a.y=r?i.y:t.y,a.z=o?i.z:t.z,a.applyMatrix4(e)}const n=this.satBounds,r=this.satAxes,o=s[0];for(let e=0;e<3;e++){const t=r[e],i=n[e],a=s[1<<e];t.subVectors(o,a),i.setFromPoints(t,s)}const a=this.alignedSatBounds;a[0].setFromPointsField(s,"x"),a[1].setFromPointsField(s,"y"),a[2].setFromPointsField(s,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}}(),V.prototype.intersectsBox=function(){const e=new v;return function(t){this.needsUpdate&&this.update();const i=t.min,s=t.max,n=this.satBounds,r=this.satAxes,o=this.alignedSatBounds;if(e.min=i.x,e.max=s.x,o[0].isSeparated(e))return!1;if(e.min=i.y,e.max=s.y,o[1].isSeparated(e))return!1;if(e.min=i.z,e.max=s.z,o[2].isSeparated(e))return!1;for(let i=0;i<3;i++){const s=r[i],o=n[i];if(e.setFromBox(s,t),o.isSeparated(e))return!1}return!0}}(),V.prototype.intersectsTriangle=function(){const e=new B,t=new Array(3),s=new v,n=new v,r=new i.Vector3;return function(i){this.needsUpdate&&this.update(),i.isExtendedTriangle?i.needsUpdate&&i.update():(e.copy(i),e.update(),i=e);const o=this.satBounds,a=this.satAxes;t[0]=i.a,t[1]=i.b,t[2]=i.c;for(let e=0;e<3;e++){const i=o[e],n=a[e];if(s.setFromPoints(n,t),i.isSeparated(s))return!1}const c=i.satBounds,l=i.satAxes,h=this.points;for(let e=0;e<3;e++){const t=c[e],i=l[e];if(s.setFromPoints(i,h),t.isSeparated(s))return!1}for(let e=0;e<3;e++){const i=a[e];for(let e=0;e<4;e++){const o=l[e];if(r.crossVectors(i,o),s.setFromPoints(r,t),n.setFromPoints(r,h),s.isSeparated(n))return!1}}return!0}}(),V.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}}(),V.prototype.distanceToPoint=function(){const e=new i.Vector3;return function(t){return this.closestPointToPoint(t,e),t.distanceTo(e)}}(),V.prototype.distanceToBox=function(){const e=["x","y","z"],t=new Array(12).fill().map((()=>new i.Line3)),s=new Array(12).fill().map((()=>new i.Line3)),n=new i.Vector3,r=new i.Vector3;return function(i,o=0,a=null,c=null){if(this.needsUpdate&&this.update(),this.intersectsBox(i))return(a||c)&&(i.getCenter(r),this.closestPointToPoint(r,n),i.closestPointToPoint(n,r),a&&a.copy(n),c&&c.copy(r)),0;const l=o*o,h=i.min,u=i.max,I=this.points;let d=1/0;for(let e=0;e<8;e++){const t=I[e];r.copy(t).clamp(h,u);const i=t.distanceToSquared(r);if(i<d&&(d=i,a&&a.copy(t),c&&c.copy(r),i<l))return Math.sqrt(i)}let E=0;for(let i=0;i<3;i++)for(let n=0;n<=1;n++)for(let r=0;r<=1;r++){const o=(i+1)%3,a=(i+2)%3,c=1<<i|n<<o|r<<a,l=I[n<<o|r<<a],d=I[c];t[E].set(l,d);const f=e[i],p=e[o],C=e[a],T=s[E],m=T.start,R=T.end;m[f]=h[f],m[p]=n?h[p]:u[p],m[C]=r?h[C]:u[p],R[f]=u[f],R[p]=n?h[p]:u[p],R[C]=r?h[C]:u[p],E++}for(let e=0;e<=1;e++)for(let t=0;t<=1;t++)for(let i=0;i<=1;i++){r.x=e?u.x:h.x,r.y=t?u.y:h.y,r.z=i?u.z:h.z,this.closestPointToPoint(r,n);const s=r.distanceToSquared(n);if(s<d&&(d=s,a&&a.copy(n),c&&c.copy(r),s<l))return Math.sqrt(s)}for(let e=0;e<12;e++){const i=t[e];for(let e=0;e<12;e++){const t=s[e];b(i,t,n,r);const o=n.distanceToSquared(r);if(o<d&&(d=o,a&&a.copy(n),c&&c.copy(r),o<l))return Math.sqrt(o)}}return Math.sqrt(d)}}();class Y{constructor(e){this._getNewPrimitive=e,this._primitives=[]}getPrimitive(){const e=this._primitives;return 0===e.length?this._getNewPrimitive():e.pop()}releasePrimitive(e){this._primitives.push(e)}}class G extends Y{constructor(){super((()=>new B))}}const z=new G;function k(e,t){return 65535===t[e+15]}function H(e,t){return t[e+6]}function W(e,t){return t[e+14]}function X(e){return e+8}function j(e,t){return t[e+6]}function Z(e,t){return t[e+7]}const $=new class{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,0!==e.length&&this.setBuffer(e.pop())}}};let Q,q;const K=[],J=new Y((()=>new i.Box3));function ee(e,t,i,s,n,r){Q=J.getPrimitive(),q=J.getPrimitive(),K.push(Q,q),$.setBuffer(e._roots[t]);const o=te(0,e.geometry,i,s,n,r);$.clearBuffer(),J.releasePrimitive(Q),J.releasePrimitive(q),K.pop(),K.pop();const a=K.length;return a>0&&(q=K[a-1],Q=K[a-2]),o}function te(e,t,i,s,n=null,r=0,o=0){const{float32Array:a,uint16Array:c,uint32Array:l}=$;let h=2*e;if(k(h,c)){const t=H(e,l),i=W(h,c);return C(e,a,Q),s(t,i,!1,o,r+e,Q)}{let h=function(e){const{uint16Array:t,uint32Array:i}=$;let s=2*e;for(;!k(s,t);)s=2*(e=X(e));return H(e,i)},u=function(e){const{uint16Array:t,uint32Array:i}=$;let s=2*e;for(;!k(s,t);)s=2*(e=j(e,i));return H(e,i)+W(s,t)};const I=X(e),d=j(e,l);let E,f,p,T,m=I,R=d;if(n&&(p=Q,T=q,C(m,a,p),C(R,a,T),E=n(p),f=n(T),f<E)){m=d,R=I;const e=E;E=f,f=e,p=T}p||(p=Q,C(m,a,p));const g=i(p,k(2*m,c),E,o+1,r+m);let A;if(2===g){const e=h(m);A=s(e,u(m)-e,!0,o+1,r+m,p)}else A=g&&te(m,t,i,s,n,r,o+1);if(A)return!0;T=q,C(R,a,T);const F=i(T,k(2*R,c),f,o+1,r+R);let S;if(2===F){const e=h(R);S=s(e,u(R)-e,!0,o+1,r+R,T)}else S=F&&te(R,t,i,s,n,r,o+1);return!!S}}const ie=new i.Vector3,se=new i.Vector3;const ne=new i.Vector3,re=new i.Vector3,oe=new i.Vector3,ae=new i.Vector2,ce=new i.Vector2,le=new i.Vector2,he=new i.Vector3,ue=new i.Vector3,Ie=new i.Vector3,de=new i.Vector3;function Ee(e,t,s,n,r,o,a,c,l){ne.fromBufferAttribute(t,o),re.fromBufferAttribute(t,a),oe.fromBufferAttribute(t,c);const h=function(e,t,s,n,r,o){let a;return a=o===i.BackSide?e.intersectTriangle(n,s,t,!0,r):e.intersectTriangle(t,s,n,o!==i.DoubleSide,r),null===a?null:{distance:e.origin.distanceTo(r),point:r.clone()}}(e,ne,re,oe,de,l);if(h){n&&(ae.fromBufferAttribute(n,o),ce.fromBufferAttribute(n,a),le.fromBufferAttribute(n,c),h.uv=i.Triangle.getInterpolation(de,ne,re,oe,ae,ce,le,new i.Vector2)),r&&(ae.fromBufferAttribute(r,o),ce.fromBufferAttribute(r,a),le.fromBufferAttribute(r,c),h.uv1=i.Triangle.getInterpolation(de,ne,re,oe,ae,ce,le,new i.Vector2)),s&&(he.fromBufferAttribute(s,o),ue.fromBufferAttribute(s,a),Ie.fromBufferAttribute(s,c),h.normal=i.Triangle.getInterpolation(de,ne,re,oe,he,ue,Ie,new i.Vector3),h.normal.dot(e.direction)>0&&h.normal.multiplyScalar(-1));const t={a:o,b:a,c:c,normal:new i.Vector3,materialIndex:0};i.Triangle.getNormal(ne,re,oe,t.normal),h.face=t,h.faceIndex=o}return h}function fe(e,t,i,s,n){const r=3*s;let o=r+0,a=r+1,c=r+2;const l=e.index;e.index&&(o=l.getX(o),a=l.getX(a),c=l.getX(c));const{position:h,normal:u,uv:I,uv1:d}=e.attributes,E=Ee(i,h,u,I,d,o,a,c,t);return E?(E.faceIndex=s,n&&n.push(E),E):null}function pe(e,t,i,s){const n=e.a,r=e.b,o=e.c;let a=t,c=t+1,l=t+2;i&&(a=i.getX(a),c=i.getX(c),l=i.getX(l)),n.x=s.getX(a),n.y=s.getY(a),n.z=s.getZ(a),r.x=s.getX(c),r.y=s.getY(c),r.z=s.getZ(c),o.x=s.getX(l),o.y=s.getY(l),o.z=s.getZ(l)}function Ce(e,t,i,s,n,r,o){const{geometry:a}=i,{index:c}=a,l=a.attributes.position;for(let i=e,a=t+e;i<a;i++){let e;if(e=i,pe(o,3*e,c,l),o.needsUpdate=!0,s(o,e,n,r))return!0}return!1}function Te(e,t=null){t&&Array.isArray(t)&&(t=new Set(t));const i=e.geometry,s=i.index?i.index.array:null,n=i.attributes.position;let r,o,a,c,l=0;const u=e._roots;for(let e=0,t=u.length;e<t;e++)r=u[e],o=new Uint32Array(r),a=new Uint16Array(r),c=new Float32Array(r),I(0,l),l+=r.byteLength;function I(e,i,r=!1){const l=2*e;if(a[l+15]===h){const t=o[e+6];let i=1/0,r=1/0,h=1/0,u=-1/0,I=-1/0,d=-1/0;for(let e=3*t,o=3*(t+a[l+14]);e<o;e++){let t=s[e];const o=n.getX(t),a=n.getY(t),c=n.getZ(t);o<i&&(i=o),o>u&&(u=o),a<r&&(r=a),a>I&&(I=a),c<h&&(h=c),c>d&&(d=c)}return(c[e+0]!==i||c[e+1]!==r||c[e+2]!==h||c[e+3]!==u||c[e+4]!==I||c[e+5]!==d)&&(c[e+0]=i,c[e+1]=r,c[e+2]=h,c[e+3]=u,c[e+4]=I,c[e+5]=d,!0)}{const s=e+8,n=o[e+6],a=s+i,l=n+i;let h=r,u=!1,d=!1;t?h||(u=t.has(a),d=t.has(l),h=!u&&!d):(u=!0,d=!0);const E=h||d;let f=!1;(h||u)&&(f=I(s,i,h));let p=!1;E&&(p=I(n,i,h));const C=f||p;if(C)for(let t=0;t<3;t++){const i=s+t,r=n+t,o=c[i],a=c[i+3],l=c[r],h=c[r+3];c[e+t]=o<l?o:l,c[e+t+3]=a>h?a:h}return C}}}const me=new i.Box3;function Re(e,t,i,s){return C(e,t,me),i.intersectBox(me,s)}function ge(e,t,i,s,n,r,o){const{geometry:a}=i,{index:c}=a,l=a.attributes.position;for(let a=e,h=t+e;a<h;a++){let e;if(e=i.resolveTriangleIndex(a),pe(o,3*e,c,l),o.needsUpdate=!0,s(o,e,n,r))return!0}return!1}const Ae=new i.Vector3;function Fe(e,t,i,s,n){$.setBuffer(e._roots[t]),Se(0,e,i,s,n),$.clearBuffer()}function Se(e,t,i,s,n){const{float32Array:r,uint16Array:o,uint32Array:a}=$,c=2*e;if(k(c,o)){!function(e,t,i,s,n,r){const{geometry:o,_indirectBuffer:a}=e;for(let e=s,a=s+n;e<a;e++)fe(o,t,i,e,r)}(t,i,s,H(e,a),W(c,o),n)}else{const o=X(e);Re(o,r,s,Ae)&&Se(o,t,i,s,n);const c=j(e,a);Re(c,r,s,Ae)&&Se(c,t,i,s,n)}}const Oe=new i.Vector3,Ne=["x","y","z"];function ye(e,t,i,s){$.setBuffer(e._roots[t]);const n=Le(0,e,i,s);return $.clearBuffer(),n}function Le(e,t,i,s){const{float32Array:n,uint16Array:r,uint32Array:o}=$;let a=2*e;if(k(a,r)){return function(e,t,i,s,n){const{geometry:r,_indirectBuffer:o}=e;let a=1/0,c=null;for(let e=s,o=s+n;e<o;e++){let s;s=fe(r,t,i,e),s&&s.distance<a&&(c=s,a=s.distance)}return c}(t,i,s,H(e,o),W(a,r))}{const r=Z(e,o),a=Ne[r],c=s.direction[a]>=0;let l,h;c?(l=X(e),h=j(e,o)):(l=j(e,o),h=X(e));const u=Re(l,n,s,Oe)?Le(l,t,i,s):null;if(u){const e=u.point[a];if(c?e<=n[h+r]:e>=n[h+r+3])return u}const I=Re(h,n,s,Oe)?Le(h,t,i,s):null;return u&&I?u.distance<=I.distance?u:I:u||I||null}}const _e=new i.Box3,Pe=new B,we=new B,Me=new i.Matrix4,ve=new V,De=new V;function be(e,t,i,s){$.setBuffer(e._roots[t]);const n=Ue(0,e,i,s);return $.clearBuffer(),n}function Ue(e,t,i,s,n=null){const{float32Array:r,uint16Array:o,uint32Array:a}=$;let c=2*e;null===n&&(i.boundingBox||i.computeBoundingBox(),ve.set(i.boundingBox.min,i.boundingBox.max,s),n=ve);if(!k(c,o)){const o=e+8,c=a[e+6];C(o,r,_e);if(n.intersectsBox(_e)&&Ue(o,t,i,s,n))return!0;C(c,r,_e);return!!(n.intersectsBox(_e)&&Ue(c,t,i,s,n))}{const n=t.geometry,l=n.index,h=n.attributes.position,u=i.index,I=i.attributes.position,d=H(e,a),E=W(c,o);if(Me.copy(s).invert(),i.boundsTree){C(e,r,De),De.matrix.copy(Me),De.needsUpdate=!0;return i.boundsTree.shapecast({intersectsBounds:e=>De.intersectsBox(e),intersectsTriangle:e=>{e.a.applyMatrix4(s),e.b.applyMatrix4(s),e.c.applyMatrix4(s),e.needsUpdate=!0;for(let t=3*d,i=3*(E+d);t<i;t+=3)if(pe(we,t,l,h),we.needsUpdate=!0,e.intersectsTriangle(we))return!0;return!1}})}for(let e=3*d,t=3*(E+d);e<t;e+=3){pe(Pe,e,l,h),Pe.a.applyMatrix4(Me),Pe.b.applyMatrix4(Me),Pe.c.applyMatrix4(Me),Pe.needsUpdate=!0;for(let e=0,t=u.count;e<t;e+=3)if(pe(we,e,u,I),we.needsUpdate=!0,Pe.intersectsTriangle(we))return!0}}}const xe=new i.Matrix4,Be=new V,Ve=new V,Ye=new i.Vector3,Ge=new i.Vector3,ze=new i.Vector3,ke=new i.Vector3;function He(e,t,i,s={},n={},r=0,o=1/0){t.boundingBox||t.computeBoundingBox(),Be.set(t.boundingBox.min,t.boundingBox.max,i),Be.needsUpdate=!0;const a=e.geometry,c=a.attributes.position,l=a.index,h=t.attributes.position,u=t.index,I=z.getPrimitive(),E=z.getPrimitive();let f=Ye,p=Ge,C=null,T=null;n&&(C=ze,T=ke);let m=1/0,R=null,g=null;return xe.copy(i).invert(),Ve.matrix.copy(xe),e.shapecast({boundsTraverseOrder:e=>Be.distanceToBox(e),intersectsBounds:(e,t,i)=>i<m&&i<o&&(t&&(Ve.min.copy(e.min),Ve.max.copy(e.max),Ve.needsUpdate=!0),!0),intersectsRange:(e,s)=>{if(t.boundsTree){return t.boundsTree.shapecast({boundsTraverseOrder:e=>Ve.distanceToBox(e),intersectsBounds:(e,t,i)=>i<m&&i<o,intersectsRange:(t,n)=>{for(let o=t,a=t+n;o<a;o++){pe(E,3*o,u,h),E.a.applyMatrix4(i),E.b.applyMatrix4(i),E.c.applyMatrix4(i),E.needsUpdate=!0;for(let t=e,i=e+s;t<i;t++){pe(I,3*t,l,c),I.needsUpdate=!0;const e=I.distanceToTriangle(E,f,C);if(e<m&&(p.copy(f),T&&T.copy(C),m=e,R=t,g=o),e<r)return!0}}}})}for(let n=0,o=d(t);n<o;n++){pe(E,3*n,u,h),E.a.applyMatrix4(i),E.b.applyMatrix4(i),E.c.applyMatrix4(i),E.needsUpdate=!0;for(let t=e,i=e+s;t<i;t++){pe(I,3*t,l,c),I.needsUpdate=!0;const e=I.distanceToTriangle(E,f,C);if(e<m&&(p.copy(f),T&&T.copy(C),m=e,R=t,g=n),e<r)return!0}}}}),z.releasePrimitive(I),z.releasePrimitive(E),m===1/0?null:(s.point?s.point.copy(p):s.point=p.clone(),s.distance=m,s.faceIndex=R,n&&(n.point?n.point.copy(T):n.point=T.clone(),n.point.applyMatrix4(xe),p.applyMatrix4(xe),n.distance=p.sub(n.point).length(),n.faceIndex=g),s)}function We(e,t=null){t&&Array.isArray(t)&&(t=new Set(t));const i=e.geometry,s=i.index?i.index.array:null,n=i.attributes.position;let r,o,a,c,l=0;const u=e._roots;for(let e=0,t=u.length;e<t;e++)r=u[e],o=new Uint32Array(r),a=new Uint16Array(r),c=new Float32Array(r),I(0,l),l+=r.byteLength;function I(i,r,l=!1){const u=2*i;if(a[u+15]===h){const t=o[i+6];let r=1/0,l=1/0,h=1/0,I=-1/0,d=-1/0,E=-1/0;for(let i=t,o=t+a[u+14];i<o;i++){const t=3*e.resolveTriangleIndex(i);for(let e=0;e<3;e++){let i=t+e;i=s?s[i]:i;const o=n.getX(i),a=n.getY(i),c=n.getZ(i);o<r&&(r=o),o>I&&(I=o),a<l&&(l=a),a>d&&(d=a),c<h&&(h=c),c>E&&(E=c)}}return(c[i+0]!==r||c[i+1]!==l||c[i+2]!==h||c[i+3]!==I||c[i+4]!==d||c[i+5]!==E)&&(c[i+0]=r,c[i+1]=l,c[i+2]=h,c[i+3]=I,c[i+4]=d,c[i+5]=E,!0)}{const e=i+8,s=o[i+6],n=e+r,a=s+r;let h=l,u=!1,d=!1;t?h||(u=t.has(n),d=t.has(a),h=!u&&!d):(u=!0,d=!0);const E=h||d;let f=!1;(h||u)&&(f=I(e,r,h));let p=!1;E&&(p=I(s,r,h));const C=f||p;if(C)for(let t=0;t<3;t++){const n=e+t,r=s+t,o=c[n],a=c[n+3],l=c[r],h=c[r+3];c[i+t]=o<l?o:l,c[i+t+3]=a>h?a:h}return C}}}const Xe=new i.Vector3;function je(e,t,i,s,n){$.setBuffer(e._roots[t]),Ze(0,e,i,s,n),$.clearBuffer()}function Ze(e,t,i,s,n){const{float32Array:r,uint16Array:o,uint32Array:a}=$,c=2*e;if(k(c,o)){!function(e,t,i,s,n,r){const{geometry:o,_indirectBuffer:a}=e;for(let e=s,c=s+n;e<c;e++)fe(o,t,i,a?a[e]:e,r)}(t,i,s,H(e,a),W(c,o),n)}else{const o=X(e);Re(o,r,s,Xe)&&Ze(o,t,i,s,n);const c=j(e,a);Re(c,r,s,Xe)&&Ze(c,t,i,s,n)}}const $e=new i.Vector3,Qe=["x","y","z"];function qe(e,t,i,s){$.setBuffer(e._roots[t]);const n=Ke(0,e,i,s);return $.clearBuffer(),n}function Ke(e,t,i,s){const{float32Array:n,uint16Array:r,uint32Array:o}=$;let a=2*e;if(k(a,r)){return function(e,t,i,s,n){const{geometry:r,_indirectBuffer:o}=e;let a=1/0,c=null;for(let e=s,l=s+n;e<l;e++){let s;s=fe(r,t,i,o?o[e]:e),s&&s.distance<a&&(c=s,a=s.distance)}return c}(t,i,s,H(e,o),W(a,r))}{const r=Z(e,o),a=Qe[r],c=s.direction[a]>=0;let l,h;c?(l=X(e),h=j(e,o)):(l=j(e,o),h=X(e));const u=Re(l,n,s,$e)?Ke(l,t,i,s):null;if(u){const e=u.point[a];if(c?e<=n[h+r]:e>=n[h+r+3])return u}const I=Re(h,n,s,$e)?Ke(h,t,i,s):null;return u&&I?u.distance<=I.distance?u:I:u||I||null}}const Je=new i.Box3,et=new B,tt=new B,it=new i.Matrix4,st=new V,nt=new V;function rt(e,t,i,s){$.setBuffer(e._roots[t]);const n=ot(0,e,i,s);return $.clearBuffer(),n}function ot(e,t,i,s,n=null){const{float32Array:r,uint16Array:o,uint32Array:a}=$;let c=2*e;null===n&&(i.boundingBox||i.computeBoundingBox(),st.set(i.boundingBox.min,i.boundingBox.max,s),n=st);if(!k(c,o)){const o=e+8,c=a[e+6];C(o,r,Je);if(n.intersectsBox(Je)&&ot(o,t,i,s,n))return!0;C(c,r,Je);return!!(n.intersectsBox(Je)&&ot(c,t,i,s,n))}{const n=t.geometry,l=n.index,h=n.attributes.position,u=i.index,I=i.attributes.position,d=H(e,a),E=W(c,o);if(it.copy(s).invert(),i.boundsTree){C(e,r,nt),nt.matrix.copy(it),nt.needsUpdate=!0;return i.boundsTree.shapecast({intersectsBounds:e=>nt.intersectsBox(e),intersectsTriangle:e=>{e.a.applyMatrix4(s),e.b.applyMatrix4(s),e.c.applyMatrix4(s),e.needsUpdate=!0;for(let i=d,s=E+d;i<s;i++)if(pe(tt,3*t.resolveTriangleIndex(i),l,h),tt.needsUpdate=!0,e.intersectsTriangle(tt))return!0;return!1}})}for(let e=d,i=E+d;e<i;e++){const i=t.resolveTriangleIndex(e);pe(et,3*i,l,h),et.a.applyMatrix4(it),et.b.applyMatrix4(it),et.c.applyMatrix4(it),et.needsUpdate=!0;for(let e=0,t=u.count;e<t;e+=3)if(pe(tt,e,u,I),tt.needsUpdate=!0,et.intersectsTriangle(tt))return!0}}}const at=new i.Matrix4,ct=new V,lt=new V,ht=new i.Vector3,ut=new i.Vector3,It=new i.Vector3,dt=new i.Vector3;function Et(e,t,i,s={},n={},r=0,o=1/0){t.boundingBox||t.computeBoundingBox(),ct.set(t.boundingBox.min,t.boundingBox.max,i),ct.needsUpdate=!0;const a=e.geometry,c=a.attributes.position,l=a.index,h=t.attributes.position,u=t.index,I=z.getPrimitive(),E=z.getPrimitive();let f=ht,p=ut,C=null,T=null;n&&(C=It,T=dt);let m=1/0,R=null,g=null;return at.copy(i).invert(),lt.matrix.copy(at),e.shapecast({boundsTraverseOrder:e=>ct.distanceToBox(e),intersectsBounds:(e,t,i)=>i<m&&i<o&&(t&&(lt.min.copy(e.min),lt.max.copy(e.max),lt.needsUpdate=!0),!0),intersectsRange:(s,n)=>{if(t.boundsTree){const a=t.boundsTree;return a.shapecast({boundsTraverseOrder:e=>lt.distanceToBox(e),intersectsBounds:(e,t,i)=>i<m&&i<o,intersectsRange:(t,o)=>{for(let d=t,A=t+o;d<A;d++){const t=a.resolveTriangleIndex(d);pe(E,3*t,u,h),E.a.applyMatrix4(i),E.b.applyMatrix4(i),E.c.applyMatrix4(i),E.needsUpdate=!0;for(let t=s,i=s+n;t<i;t++){const i=e.resolveTriangleIndex(t);pe(I,3*i,l,c),I.needsUpdate=!0;const s=I.distanceToTriangle(E,f,C);if(s<m&&(p.copy(f),T&&T.copy(C),m=s,R=t,g=d),s<r)return!0}}}})}for(let o=0,a=d(t);o<a;o++){pe(E,3*o,u,h),E.a.applyMatrix4(i),E.b.applyMatrix4(i),E.c.applyMatrix4(i),E.needsUpdate=!0;for(let t=s,i=s+n;t<i;t++){const i=e.resolveTriangleIndex(t);pe(I,3*i,l,c),I.needsUpdate=!0;const s=I.distanceToTriangle(E,f,C);if(s<m&&(p.copy(f),T&&T.copy(C),m=s,R=t,g=o),s<r)return!0}}}}),z.releasePrimitive(I),z.releasePrimitive(E),m===1/0?null:(s.point?s.point.copy(p):s.point=p.clone(),s.distance=m,s.faceIndex=R,n&&(n.point?n.point.copy(T):n.point=T.clone(),n.point.applyMatrix4(at),p.applyMatrix4(at),n.distance=p.sub(n.point).length(),n.faceIndex=g),s)}const ft=new $.constructor,pt=new $.constructor,Ct=new Y((()=>new i.Box3)),Tt=new i.Box3,mt=new i.Box3,Rt=new i.Box3,gt=new i.Box3;let At=!1;function Ft(e,t,i,s,n,r=0,o=0,a=0,c=0,l=null,h=!1){let u,I;h?(u=pt,I=ft):(u=ft,I=pt);const d=u.float32Array,E=u.uint32Array,f=u.uint16Array,p=I.float32Array,T=I.uint32Array,m=I.uint16Array,R=2*t,g=k(2*e,f),A=k(R,m);let F=!1;if(A&&g)F=h?n(H(t,T),W(2*t,m),H(e,E),W(2*e,f),c,o+t,a,r+e):n(H(e,E),W(2*e,f),H(t,T),W(2*t,m),a,r+e,c,o+t);else if(A){const l=Ct.getPrimitive();C(t,p,l),l.applyMatrix4(i);const u=X(e),I=j(e,E);C(u,d,Tt),C(I,d,mt);const f=l.intersectsBox(Tt),T=l.intersectsBox(mt);F=f&&Ft(t,u,s,i,n,o,r,c,a+1,l,!h)||T&&Ft(t,I,s,i,n,o,r,c,a+1,l,!h),Ct.releasePrimitive(l)}else{const u=X(t),I=j(t,T);C(u,p,Rt),C(I,p,gt);const f=l.intersectsBox(Rt),m=l.intersectsBox(gt);if(f&&m)F=Ft(e,u,i,s,n,r,o,a,c+1,l,h)||Ft(e,I,i,s,n,r,o,a,c+1,l,h);else if(f)if(g)F=Ft(e,u,i,s,n,r,o,a,c+1,l,h);else{const t=Ct.getPrimitive();t.copy(Rt).applyMatrix4(i);const l=X(e),I=j(e,E);C(l,d,Tt),C(I,d,mt);const f=t.intersectsBox(Tt),p=t.intersectsBox(mt);F=f&&Ft(u,l,s,i,n,o,r,c,a+1,t,!h)||p&&Ft(u,I,s,i,n,o,r,c,a+1,t,!h),Ct.releasePrimitive(t)}else if(m)if(g)F=Ft(e,I,i,s,n,r,o,a,c+1,l,h);else{const t=Ct.getPrimitive();t.copy(gt).applyMatrix4(i);const l=X(e),u=j(e,E);C(l,d,Tt),C(u,d,mt);const f=t.intersectsBox(Tt),p=t.intersectsBox(mt);F=f&&Ft(I,l,s,i,n,o,r,c,a+1,t,!h)||p&&Ft(I,u,s,i,n,o,r,c,a+1,t,!h),Ct.releasePrimitive(t)}}return F}const St=new V,Ot=new i.Box3;class Nt{static serialize(e,t={}){t={cloneBuffers:!0,...t};const i=e.geometry,s=e._roots,n=e._indirectBuffer,r=i.getIndex();let o;return o=t.cloneBuffers?{roots:s.map((e=>e.slice())),index:r.array.slice(),indirectBuffer:n?n.slice():null}:{roots:s,index:r.array,indirectBuffer:n},o}static deserialize(e,t,s={}){s={setIndex:!0,indirect:Boolean(e.indirectBuffer),...s};const{index:n,roots:r,indirectBuffer:o}=e,a=new Nt(t,{...s,[I]:!0});if(a._roots=r,a._indirectBuffer=o||null,s.setIndex){const s=t.getIndex();if(null===s){const s=new i.BufferAttribute(e.index,1,!1);t.setIndex(s)}else s.array!==n&&(s.array.set(n),s.needsUpdate=!0)}return a}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");if((t=Object.assign({strategy:0,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[I]:!1},t)).useSharedArrayBuffer&&"undefined"==typeof SharedArrayBuffer)throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[I]||(M(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new i.Box3)));const{_indirectBuffer:s}=this;this.resolveTriangleIndex=t.indirect?e=>s[e]:e=>e}refit(e=null){return(this.indirect?We:Te)(this,e)}traverse(e,t=0){const i=this._roots[t],s=new Uint32Array(i),n=new Uint16Array(i);!function t(r,o=0){const a=2*r,c=n[a+15]===h;if(c){const t=s[r+6],l=n[a+14];e(o,c,new Float32Array(i,4*r,6),t,l)}else{const n=r+8,a=s[r+6],l=s[r+7];e(o,c,new Float32Array(i,4*r,6),l)||(t(n,o+1),t(a,o+1))}}(0)}raycast(e,t=i.FrontSide){const s=this._roots,n=this.geometry,r=[],o=t.isMaterial,a=Array.isArray(t),c=n.groups,l=o?t.side:t,h=this.indirect?je:Fe;for(let i=0,n=s.length;i<n;i++){const s=a?t[c[i].materialIndex].side:l,n=r.length;if(h(this,i,s,e,r),a){const e=c[i].materialIndex;for(let t=n,i=r.length;t<i;t++)r[t].face.materialIndex=e}}return r}raycastFirst(e,t=i.FrontSide){const s=this._roots,n=this.geometry,r=t.isMaterial,o=Array.isArray(t);let a=null;const c=n.groups,l=r?t.side:t,h=this.indirect?qe:ye;for(let i=0,n=s.length;i<n;i++){const s=h(this,i,o?t[c[i].materialIndex].side:l,e);null!=s&&(null==a||s.distance<a.distance)&&(a=s,o&&(s.face.materialIndex=c[i].materialIndex))}return a}intersectsGeometry(e,t){let i=!1;const s=this._roots,n=this.indirect?rt:be;for(let r=0,o=s.length;r<o&&(i=n(this,r,e,t),!i);r++);return i}shapecast(e){const t=z.getPrimitive(),i=this.indirect?ge:Ce;let{boundsTraverseOrder:s,intersectsBounds:n,intersectsRange:r,intersectsTriangle:o}=e;if(r&&o){const e=r;r=(s,n,r,a,c)=>!!e(s,n,r,a,c)||i(s,n,this,o,r,a,t)}else r||(r=o?(e,s,n,r)=>i(e,s,this,o,n,r,t):(e,t,i)=>i);let a=!1,c=0;const l=this._roots;for(let e=0,t=l.length;e<t;e++){const t=l[e];if(a=ee(this,e,n,r,s,c),a)break;c+=t.byteLength}return z.releasePrimitive(t),a}bvhcast(e,t,s){let{intersectsRanges:n,intersectsTriangles:r}=s;const o=z.getPrimitive(),a=this.geometry.index,c=this.geometry.attributes.position,l=this.indirect?e=>{const t=this.resolveTriangleIndex(e);pe(o,3*t,a,c)}:e=>{pe(o,3*e,a,c)},h=z.getPrimitive(),u=e.geometry.index,I=e.geometry.attributes.position,d=e.indirect?t=>{const i=e.resolveTriangleIndex(t);pe(h,3*i,u,I)}:e=>{pe(h,3*e,u,I)};if(r){const e=(e,i,s,n,a,c,u,I)=>{for(let E=s,f=s+n;E<f;E++){d(E),h.a.applyMatrix4(t),h.b.applyMatrix4(t),h.c.applyMatrix4(t),h.needsUpdate=!0;for(let t=e,s=e+i;t<s;t++)if(l(t),o.needsUpdate=!0,r(o,h,t,E,a,c,u,I))return!0}return!1};if(n){const t=n;n=function(i,s,n,r,o,a,c,l){return!!t(i,s,n,r,o,a,c,l)||e(i,s,n,r,o,a,c,l)}}else n=e}return function(e,t,s,n){if(At)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");At=!0;const r=e._roots,o=t._roots;let a,c=0,l=0;const h=(new i.Matrix4).copy(s).invert();for(let e=0,t=r.length;e<t;e++){ft.setBuffer(r[e]),l=0;const t=Ct.getPrimitive();C(0,ft.float32Array,t),t.applyMatrix4(h);for(let i=0,r=o.length;i<r&&(pt.setBuffer(o[e]),a=Ft(0,0,s,h,n,c,l,0,0,t),pt.clearBuffer(),l+=o[i].length,!a);i++);if(Ct.releasePrimitive(t),ft.clearBuffer(),c+=r[e].length,a)break}return At=!1,a}(this,e,t,n)}intersectsBox(e,t){return St.set(e.min,e.max,t),St.needsUpdate=!0,this.shapecast({intersectsBounds:e=>St.intersectsBox(e),intersectsTriangle:e=>St.intersectsTriangle(e)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,i={},s={},n=0,r=1/0){return(this.indirect?Et:He)(this,e,t,i,s,n,r)}closestPointToPoint(e,t={},i=0,s=1/0){return function(e,t,i={},s=0,n=1/0){const r=s*s,o=n*n;let a=1/0,c=null;if(e.shapecast({boundsTraverseOrder:e=>(ie.copy(t).clamp(e.min,e.max),ie.distanceToSquared(t)),intersectsBounds:(e,t,i)=>i<a&&i<o,intersectsTriangle:(e,i)=>{e.closestPointToPoint(t,ie);const s=t.distanceToSquared(ie);return s<a&&(se.copy(ie),a=s,c=i),s<r}}),a===1/0)return null;const l=Math.sqrt(a);return i.point?i.point.copy(se):i.point=se.clone(),i.distance=l,i.faceIndex=c,i}(this,e,t,i,s)}getBoundingBox(e){e.makeEmpty();return this._roots.forEach((t=>{C(0,new Float32Array(t),Ot),e.union(Ot)})),e}}function yt(e,t,i){return null===e?null:(e.point.applyMatrix4(t.matrixWorld),e.distance=e.point.distanceTo(i.ray.origin),e.object=t,e.distance<i.near||e.distance>i.far?null:e)}const Lt=new i.Ray,_t=new i.Matrix4,Pt=i.Mesh.prototype.raycast;function wt(e,t){if(this.geometry.boundsTree){if(void 0===this.material)return;_t.copy(this.matrixWorld).invert(),Lt.copy(e.ray).applyMatrix4(_t);const i=this.geometry.boundsTree;if(!0===e.firstHitOnly){const s=yt(i.raycastFirst(Lt,this.material),this,e);s&&t.push(s)}else{const s=i.raycast(Lt,this.material);for(let i=0,n=s.length;i<n;i++){const n=yt(s[i],this,e);n&&t.push(n)}}}else Pt.call(this,e,t)}function Mt(e){return this.boundsTree=new Nt(this,e),this.boundsTree}function vt(){this.boundsTree=null}class Dt{constructor(){t(this,"enabled",!0),t(this,"trigger",(e=>{if(!this.enabled)return;const t=this.handlers.slice(0);for(const i of t)i(e)})),t(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter((t=>t!==e))}reset(){this.handlers.length=0}}class bt{constructor(){t(this,"enabled",!0),t(this,"trigger",(async e=>{if(!this.enabled)return;const t=this.handlers.slice(0);for(const i of t)await i(e)})),t(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter((t=>t!==e))}reset(){this.handlers.length=0}}class Ut{constructor(e){t(this,"isDisposeable",(()=>"dispose"in this&&"onDisposed"in this)),t(this,"isResizeable",(()=>"resize"in this&&"getSize"in this)),t(this,"isUpdateable",(()=>"onAfterUpdate"in this&&"onBeforeUpdate"in this&&"update"in this)),t(this,"isHideable",(()=>"visible"in this)),t(this,"isConfigurable",(()=>"setup"in this&&"config"in this&&"onSetup"in this)),this.components=e}}class xt extends Ut{}class Bt extends Ut{constructor(e){super(e),t(this,"worlds",new Map),t(this,"onWorldChanged",new Dt),t(this,"currentWorld",null),this.onWorldChanged.add((({world:e,action:t})=>{"removed"===t&&this.worlds.delete(e.uuid)}))}}class Vt extends Bt{constructor(){super(...arguments),t(this,"hasCameraControls",(()=>"controls"in this))}}class Yt extends Bt{constructor(){super(...arguments),t(this,"onAfterUpdate",new Dt),t(this,"onBeforeUpdate",new Dt),t(this,"onDisposed",new Dt),t(this,"onResize",new Dt),t(this,"onClippingPlanesUpdated",new Dt),t(this,"clippingPlanes",[])}updateClippingPlanes(){this.onClippingPlanesUpdated.trigger()}setPlane(e,t,i){t.isLocal=i;const s=this.clippingPlanes.indexOf(t);e&&-1===s?this.clippingPlanes.push(t):!e&&s>-1&&this.clippingPlanes.splice(s,1),this.three.clippingPlanes=this.clippingPlanes.filter((e=>!e.isLocal))}}const Gt=class e extends xt{constructor(i){super(i),t(this,"_disposedComponents",new Set),t(this,"enabled",!0),i.add(e.uuid,this)}get(){return this._disposedComponents}destroy(e,t=!0,i=!0){e.removeFromParent();const s=e;s.dispose&&s.dispose(),this.disposeGeometryAndMaterials(e,t),i&&s.children&&s.children.length&&this.disposeChildren(s),e.children.length=0}disposeGeometry(e){e.boundsTree&&e.disposeBoundsTree&&e.disposeBoundsTree(),e.dispose()}disposeGeometryAndMaterials(t,i){const s=t;s.geometry&&this.disposeGeometry(s.geometry),i&&s.material&&e.disposeMaterial(s),s.material=[],s.geometry=null}disposeChildren(e){for(const t of e.children)this.destroy(t)}static disposeMaterial(e){if(e.material)if(Array.isArray(e.material))for(const t of e.material)t.dispose();else e.material.dispose()}};t(Gt,"uuid","76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");let zt=Gt;class kt extends Bt{constructor(e){super(e),t(this,"onDisposed",new Dt),t(this,"directionalLights",new Map),t(this,"ambientLights",new Map)}dispose(){const e=this.components.get(zt);for(const t of this.three.children){const i=t;i.geometry&&e.destroy(i)}this.deleteAllLights(),this.three.children=[],this.onDisposed.trigger(),this.onDisposed.reset()}deleteAllLights(){for(const[,e]of this.directionalLights)e.removeFromParent(),e.target.removeFromParent(),e.dispose();this.directionalLights.clear();for(const[,e]of this.ambientLights)e.removeFromParent(),e.dispose();this.ambientLights.clear()}}class Ht extends Set{constructor(e){super(e),t(this,"onItemAdded",new Dt),t(this,"onItemDeleted",new Dt),t(this,"onCleared",new Dt),t(this,"guard",(()=>!0))}clear(){super.clear(),this.onCleared.trigger()}add(...e){for(const t of e){if(this.has(t))continue;this.guard(t)&&(super.add(t),this.onItemAdded||(this.onItemAdded=new Dt),this.onItemAdded.trigger(t))}return this}delete(e){const t=super.delete(e);return t&&this.onItemDeleted.trigger(),t}dispose(){this.clear(),this.onItemAdded.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}class Wt extends Map{constructor(e){super(e),t(this,"onItemSet",new Dt),t(this,"onItemUpdated",new Dt),t(this,"onItemDeleted",new Dt),t(this,"onCleared",new Dt),t(this,"guard",(()=>!0))}clear(){super.clear(),this.onCleared.trigger()}set(e,t){const i=this.has(e);if(!(this.guard??(()=>!0))(e,t))return this;const s=super.set(e,t);return i?(this.onItemUpdated||(this.onItemUpdated=new Dt),this.onItemUpdated.trigger({key:e,value:t})):(this.onItemSet||(this.onItemSet=new Dt),this.onItemSet.trigger({key:e,value:t})),s}delete(e){const t=super.delete(e);return t&&this.onItemDeleted.trigger(e),t}dispose(){this.clear(),this.onItemSet.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}class Xt{static isEntry(e){return new Set(["Boolean","Color","Text","Number","Select","Vector3","TextSet","None"]).has(e.type)}static copySchema(e,t={}){for(const i in e){const s=e[i];this.isEntry(s)?t[i]=this.copyEntry(s):(t[i]={},this.copySchema(s,t[i]))}return t}static copyEntry(e){if("Boolean"===e.type){const t=e;return{type:t.type,value:t.value}}if("Color"===e.type){const t=e;return{type:t.type,value:t.value.clone()}}if("Text"===e.type){const t=e;return{type:t.type,value:t.value}}if("Number"===e.type){const t=e;return{type:t.type,value:t.value,min:t.min,max:t.max,interpolable:t.interpolable}}if("Select"===e.type){const t=e;return{type:t.type,value:t.value,multiple:t.multiple,options:new Set(t.options)}}if("Vector3"===e.type){const t=e;return{type:t.type,value:t.value.clone()}}if("TextSet"===e.type){const t=e;return{type:t.type,value:new Set(t.value)}}if("None"===e.type){const t=e;return{type:t.type,value:t.value}}throw new Error("Invalid entry!")}}const jt=new i.Vector3,Zt=new i.Line3,$t=new i.Plane,Qt=new i.Vector3,qt=new i.Triangle;class Kt{constructor(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new ii,this.unassigned=new ii,this.vertices=[]}setFromPoints(e){if(e.length>=4){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.vertices.push(new ti(e[t]));this.compute()}return this}setFromObject(e){const t=[];return e.updateMatrixWorld(!0),e.traverse((function(e){const s=e.geometry;if(void 0!==s){const n=s.attributes.position;if(void 0!==n)for(let s=0,r=n.count;s<r;s++){const r=new i.Vector3;r.fromBufferAttribute(n,s).applyMatrix4(e.matrixWorld),t.push(r)}}})),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 t=0,r=i.length;t<r;t++){const r=i[t],o=r.distanceToPoint(e.origin),a=r.normal.dot(e.direction);if(o>0&&a>=0)return null;const c=0!==a?-o/a:0;if(!(c<=0)&&(a>0?n=Math.min(c,n):s=Math.max(c,s),s>n))return null}return s!==-1/0?e.at(s,t):e.at(n,t),t}intersectsRay(e){return null!==this.intersectRay(e,jt)}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(e,t){return e.face=t,null===t.outside?this.assigned.append(e):this.assigned.insertBefore(t.outside,e),t.outside=e,this}removeVertexFromFace(e,t){return e===t.outside&&(null!==e.next&&e.next.face===t?t.outside=e.next:t.outside=null),this.assigned.remove(e),this}removeAllVerticesFromFace(e){if(null!==e.outside){const t=e.outside;let i=e.outside;for(;null!==i.next&&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(void 0!==i)if(void 0===t)this.unassigned.appendChain(i);else{let e=i;do{const i=e.next;t.distanceToPoint(e.point)>this.tolerance?this.addVertexToFace(e,t):this.unassigned.append(e),e=i}while(null!==e)}return this}resolveUnassignedPoints(e){if(!1===this.unassigned.isEmpty()){let t=this.unassigned.first();do{const i=t.next;let s=this.tolerance,n=null;for(let i=0;i<e.length;i++){const r=e[i];if(0===r.mark){const e=r.distanceToPoint(t.point);if(e>s&&(s=e,n=r),s>1e3*this.tolerance)break}}null!==n&&this.addVertexToFace(t,n),t=i}while(null!==t)}return this}computeExtremes(){const e=new i.Vector3,t=new i.Vector3,s=[],n=[];for(let e=0;e<3;e++)s[e]=n[e]=this.vertices[0];e.copy(this.vertices[0].point),t.copy(this.vertices[0].point);for(let i=0,r=this.vertices.length;i<r;i++){const r=this.vertices[i],o=r.point;for(let t=0;t<3;t++)o.getComponent(t)<e.getComponent(t)&&(e.setComponent(t,o.getComponent(t)),s[t]=r);for(let e=0;e<3;e++)o.getComponent(e)>t.getComponent(e)&&(t.setComponent(e,o.getComponent(e)),n[e]=r)}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:s,max:n}}computeInitialHull(){const e=this.vertices,t=this.computeExtremes(),i=t.min,s=t.max;let n=0,r=0;for(let e=0;e<3;e++){const t=s[e].point.getComponent(e)-i[e].point.getComponent(e);t>n&&(n=t,r=e)}const o=i[r],a=s[r];let c,l;n=0,Zt.set(o.point,a.point);for(let t=0,i=this.vertices.length;t<i;t++){const i=e[t];if(i!==o&&i!==a){Zt.closestPointToPoint(i.point,!0,Qt);const e=Qt.distanceToSquared(i.point);e>n&&(n=e,c=i)}}n=-1,$t.setFromCoplanarPoints(o.point,a.point,c.point);for(let t=0,i=this.vertices.length;t<i;t++){const i=e[t];if(i!==o&&i!==a&&i!==c){const e=Math.abs($t.distanceToPoint(i.point));e>n&&(n=e,l=i)}}const h=[];if($t.distanceToPoint(l.point)<0){h.push(Jt.create(o,a,c),Jt.create(l,a,o),Jt.create(l,c,a),Jt.create(l,o,c));for(let e=0;e<3;e++){const t=(e+1)%3;h[e+1].getEdge(2).setTwin(h[0].getEdge(t)),h[e+1].getEdge(1).setTwin(h[t+1].getEdge(0))}}else{h.push(Jt.create(o,c,a),Jt.create(l,o,a),Jt.create(l,a,c),Jt.create(l,c,o));for(let e=0;e<3;e++){const t=(e+1)%3;h[e+1].getEdge(2).setTwin(h[0].getEdge((3-e)%3)),h[e+1].getEdge(0).setTwin(h[t+1].getEdge(1))}}for(let e=0;e<4;e++)this.faces.push(h[e]);for(let t=0,i=e.length;t<i;t++){const i=e[t];if(i!==o&&i!==a&&i!==c&&i!==l){n=this.tolerance;let e=null;for(let t=0;t<4;t++){const s=this.faces[t].distanceToPoint(i.point);s>n&&(n=s,e=this.faces[t])}null!==e&&this.addVertexToFace(i,e)}}return this}reindexFaces(){const e=[];for(let t=0;t<this.faces.length;t++){const i=this.faces[t];0===i.mark&&e.push(i)}return this.faces=e,this}nextVertexToAdd(){if(!1===this.assigned.isEmpty()){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(null!==s&&s.face===i);return e}}computeHorizon(e,t,i,s){let n;this.deleteFaceVertices(i),i.mark=1,n=null===t?t=i.getEdge(0):t.next;do{const t=n.twin,i=t.face;0===i.mark&&(i.distanceToPoint(e)>this.tolerance?this.computeHorizon(e,t,i,s):s.push(n)),n=n.next}while(n!==t);return this}addAdjoiningFace(e,t){const i=Jt.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 r=t[n],o=this.addAdjoiningFace(e,r);null===i?i=o:o.next.setTwin(s),this.newFaces.push(o.face),s=o}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();void 0!==(e=this.nextVertexToAdd());)this.addVertexToHull(e);return this.reindexFaces(),this.cleanup(),this}}class Jt{constructor(){this.normal=new i.Vector3,this.midpoint=new i.Vector3,this.area=0,this.constant=0,this.outside=null,this.mark=0,this.edge=null}static create(e,t,i){const s=new Jt,n=new ei(e,s),r=new ei(t,s),o=new ei(i,s);return n.next=o.prev=r,r.next=n.prev=o,o.next=r.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 qt.set(e.point,t.point,i.point),qt.getNormal(this.normal),qt.getMidpoint(this.midpoint),this.area=qt.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(e){return this.normal.dot(e)-this.constant}}class ei{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 null!==t?t.point.distanceTo(e.point):-1}lengthSquared(){const e=this.head(),t=this.tail();return null!==t?t.point.distanceToSquared(e.point):-1}setTwin(e){return this.twin=e,e.twin=this,this}}class ti{constructor(e){this.point=e,this.prev=null,this.next=null,this.face=null}}class ii{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,null===t.prev?this.head=t:t.prev.next=t,e.prev=t,this}insertAfter(e,t){return t.prev=e,t.next=e.next,null===t.next?this.tail=t:t.next.prev=t,e.next=t,this}append(e){return null===this.head?this.head=e:this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e,this}appendChain(e){for(null===this.head?this.head=e:this.tail.next=e,e.prev=this.tail;null!==e.next;)e=e.next;return this.tail=e,this}remove(e){return null===e.prev?this.head=e.next:e.prev.next=e.next,null===e.next?this.tail=e.prev:e.next.prev=e.prev,this}removeSubList(e,t){return null===e.prev?this.head=t.next:e.prev.next=t.next,null===t.next?this.tail=e.prev:t.next.prev=e.prev,this}isEmpty(){return null===this.head}}const si=[2,2,1],ni=[1,0,0];function ri(e,t){return 3*e+t}function oi(e){const t=e.elements;let i=0;for(let e=0;e<3;e++){const s=t[ri(si[e],ni[e])];i+=2*s*s}return Math.sqrt(i)}function ai(e,t){let i=0,s=1;const n=e.elements;for(let e=0;e<3;e++){const t=Math.abs(n[ri(si[e],ni[e])]);t>i&&(i=t,s=e)}let r=1,o=0;const a=ni[s],c=si[s];if(Math.abs(n[ri(c,a)])>Number.EPSILON){const e=(n[ri(c,c)]-n[ri(a,a)])/2/n[ri(c,a)];let t;t=e<0?-1/(-e+Math.sqrt(1+e*e)):1/(e+Math.sqrt(1+e*e)),r=1/Math.sqrt(1+t*t),o=t*r}return t.identity(),t.elements[ri(a,a)]=r,t.elements[ri(c,c)]=r,t.elements[ri(c,a)]=o,t.elements[ri(a,c)]=-o,t}function ci(e,t){let i=0,s=0;t.unitary.identity(),t.diagonal.copy(e);const n=t.unitary,r=t.diagonal,a=new o.Matrix3,c=new o.Matrix3,l=Number.EPSILON*function(e){const t=e.elements;let i=0;for(let e=0;e<9;e++)i+=t[e]*t[e];return Math.sqrt(i)}(r);for(;s<10&&oi(r)>l;)ai(r,a),c.copy(a).transpose(),r.multiply(a),r.premultiply(c),n.multiply(a),++i>2&&(s++,i=0);return t}function li(e){const t=[];for(let i=0;i<e.length-2;i+=3){const s=e[i],n=e[i+1],r=e[i+2];t.push(new o.Vector3(s,n,r))}const i=new Kt;i.setFromPoints(t);const s={unitary:new o.Matrix3,diagonal:new o.Matrix3},n=i.faces,r=[],a=[];for(let e=0,t=n.length;e<t;e++){const t=n[e];let i=t.edge;r.length=0;do{r.push(i),i=i.next}while(i!==t.edge);for(let e=1,t=r.length-2;e<=t;e++){const t=r[0].vertex,i=r[e+0].vertex,s=r[e+1].vertex;a.push(t.point.x,t.point.y,t.point.z),a.push(i.point.x,i.point.y,i.point.z),a.push(s.point.x,s.point.y,s.point.z)}}const c=new o.Vector3,l=new o.Vector3,h=new o.Vector3,u=new o.Vector3,I=new o.Vector3,d=new o.Vector3,E=new o.Vector3,f=new o.Vector3;let p=0,C=0,T=0,m=0,R=0,g=0,A=0;for(let e=0,t=a.length;e<t;e+=9){c.fromArray(a,e),l.fromArray(a,e+3),h.fromArray(a,e+6),E.set(0,0,0),E.add(c).add(l).add(h).divideScalar(3),u.subVectors(l,c),I.subVectors(h,c);const t=d.crossVectors(u,I).length()/2;f.add(d.copy(E).multiplyScalar(t)),p+=t,C+=(9*E.x*E.x+c.x*c.x+l.x*l.x+h.x*h.x)*(t/12),T+=(9*E.x*E.y+c.x*c.y+l.x*l.y+h.x*h.y)*(t/12),m+=(9*E.x*E.z+c.x*c.z+l.x*l.z+h.x*h.z)*(t/12),R+=(9*E.y*E.y+c.y*c.y+l.y*l.y+h.y*h.y)*(t/12),g+=(9*E.y*E.z+c.y*c.z+l.y*l.z+h.y*h.z)*(t/12),A+=(9*E.z*E.z+c.z*c.z+l.z*l.z+h.z*h.z)*(t/12)}f.divideScalar(p),C/=p,T/=p,m/=p,R/=p,g/=p,A/=p,C-=f.x*f.x,T-=f.x*f.y,m-=f.x*f.z,R-=f.y*f.y,g-=f.y*f.z,A-=f.z*f.z;const F=new o.Matrix3;F.elements[0]=C,F.elements[1]=T,F.elements[2]=m,F.elements[3]=T,F.elements[4]=R,F.elements[5]=g,F.elements[6]=m,F.elements[7]=g,F.elements[8]=A,ci(F,s);const S=s.unitary,O=new o.Vector3,N=new o.Vector3,y=new o.Vector3;S.extractBasis(O,N,y);let L=-1/0,_=-1/0,P=-1/0,w=1/0,M=1/0,v=1/0;for(let e=0,i=t.length;e<i;e++){const i=t[e];L=Math.max(O.dot(i),L),_=Math.max(N.dot(i),_),P=Math.max(y.dot(i),P),w=Math.min(O.dot(i),w),M=Math.min(N.dot(i),M),v=Math.min(y.dot(i),v)}O.multiplyScalar(.5*(w+L)),N.multiplyScalar(.5*(M+_)),y.multiplyScalar(.5*(v+P));const D=new o.Vector3,b=new o.Vector3,U=new o.Matrix3;D.add(O).add(N).add(y),b.x=L-w,b.y=_-M,b.z=P-v,b.multiplyScalar(.5),U.copy(S);const{x:x,y:B,z:V}=b,Y=new o.Matrix4;Y.makeScale(2*x,2*B,2*V);const G=new o.Matrix4;G.makeTranslation(-x,-B,-V);const z=new o.Matrix4;z.makeTranslation(D.x,D.y,D.z);const k=new o.Matrix4;k.setFromMatrix3(U);const H=new o.Matrix4;return H.multiply(z),H.multiply(k),H.multiply(G),H.multiply(Y),{center:D,halfSizes:b,rotation:U,transformation:H}}class hi{static isTransparent(e){return e.transparent&&e.opacity<1}}const ui=class e{static create(){const t=4294967295*Math.random()|0,i=4294967295*Math.random()|0,s=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return`${e._lut[255&t]+e._lut[t>>8&255]+e._lut[t>>16&255]+e._lut[t>>24&255]}-${e._lut[255&i]}${e._lut[i>>8&255]}-${e._lut[i>>16&15|64]}${e._lut[i>>24&255]}-${e._lut[63&s|128]}${e._lut[s>>8&255]}-${e._lut[s>>16&255]}${e._lut[s>>24&255]}${e._lut[255&n]}${e._lut[n>>8&255]}${e._lut[n>>16&255]}${e._lut[n>>24&255]}`.toLowerCase()}static validate(t){if(!e._pattern.test(t))throw new Error(`${t} is not a valid UUID v4.\n\n- If you're the tool creator, you can take one from https://www.uuidgenerator.net/.\n\n- If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`)}};t(ui,"_pattern",/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/),t(ui,"_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 Ii=ui;const di=class e{constructor(){t(this,"onDisposed",new Dt),t(this,"list",new Map),t(this,"enabled",!1),t(this,"_clock"),t(this,"onInit",new Dt),t(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 o.Clock,e.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.");Ii.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(),this.onInit.trigger()}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(){o.BufferGeometry.prototype.computeBoundsTree=Mt,o.BufferGeometry.prototype.disposeBoundsTree=vt,o.Mesh.prototype.raycast=wt}};t(di,"release","2.4.1");let Ei=di;class fi extends Ut{constructor(){super(...arguments),t(this,"meshes",new Set),t(this,"onAfterUpdate",new Dt),t(this,"onBeforeUpdate",new Dt),t(this,"onDisposed",new Dt),t(this,"isDisposing",!1),t(this,"enabled",!0),t(this,"uuid",Ii.create()),t(this,"name"),t(this,"_scene"),t(this,"_camera"),t(this,"_renderer",null)}get scene(){if(!this._scene)throw new Error("No scene initialized!");return this._scene}set scene(e){this._scene=e,e.worlds.set(this.uuid,this),e.currentWorld=this,e.onWorldChanged.trigger({world:this,action:"added"})}get camera(){if(!this._camera)throw new Error("No camera initialized!");return this._camera}set camera(e){this._camera=e,e.worlds.set(this.uuid,this),e.currentWorld=this,e.onWorldChanged.trigger({world:this,action:"added"})}get renderer(){return this._renderer}set renderer(e){this._renderer=e,e&&(e.worlds.set(this.uuid,this),e.currentWorld=this,e.onWorldChanged.trigger({world:this,action:"added"}))}update(e){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(e),this.camera.isUpdateable()&&this.camera.update(e),this.renderer&&this.renderer.update(e),this.onAfterUpdate.trigger())}dispose(e=!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"}),e){const e=this.components.get(zt);this.scene.dispose(),this.camera.isDisposeable()&&this.camera.dispose(),this.renderer&&this.renderer.dispose();for(const t of this.meshes)e.destroy(t);this.meshes.clear()}this._scene=null,this._camera=null,this._renderer=null;this.components.get(As).list.delete(this.uuid),this.onDisposed.trigger(),this.onDisposed.reset()}}class pi{constructor(e,i,s,n){t(this,"_component"),t(this,"name"),t(this,"uuid"),this._component=e,this.name=s,this.uuid=n??Ii.create();i.get(Ti).list.set(this.uuid,this)}get controls(){return Xt.copySchema(this._config)}set(e){for(const t in e)if(t in this){this[t]=e[t].value}}export(e=this._config,t={}){for(const i in e){const s=e[i];if(Xt.isEntry(s))if("Color"===s.type){const{r:e,g:n,b:r}=s.value;t[i]={...s,value:{r:e,g:n,b:r}}}else if("Vector3"===s.type){const{x:e,y:n,z:r}=s.value;t[i]={...s,value:{x:e,y:n,z:r}}}else if("TextSet"===s.type){const e=Array.from(s.value);t[i]={...s,value:e}}else if("Select"===s.type){const e=Array.from(s.options);t[i]={...s,options:e}}else t[i]={...s};else t[i]={},this.export(s,t[i])}return t}import(e,t={},i=!0){for(const i in e){const s=e[i];if(Xt.isEntry(s))if("Color"===s.type){const{r:e,g:n,b:r}=s.value;t[i]={...s,value:new o.Color(e,n,r)}}else if("Vector3"===s.type){const{x:e,y:n,z:r}=s.value;t[i]={...s,value:new o.Vector3(e,n,r)}}else"TextSet"===s.type?t[i]={...s,value:new Set(s.value)}:"Select"===s.type?t[i]={...s,options:new Set(s.options)}:t[i]={...s};else t[i]={},this.import(s,t[i],!1)}i&&this.set(t)}}const Ci=class e extends xt{constructor(i){super(i),t(this,"list",new Wt),t(this,"enabled",!0),i.add(e.uuid,this)}};t(Ci,"uuid","b8c764e0-6b24-4e77-9a32-35fa728ee5b4");let Ti=Ci;class mi{constructor(e,i){t(this,"_list"),t(this,"_scene"),this._list=e,this._scene=i}get color(){return this._list.directionalLight.color.value}set color(e){this._list.directionalLight.color.value=e;for(const[,t]of this._scene.directionalLights)t.color.copy(e)}get intensity(){return this._list.directionalLight.intensity.value}set intensity(e){this._list.directionalLight.intensity.value=e;for(const[,t]of this._scene.directionalLights)t.intensity=e}get position(){return this._list.directionalLight.position.value.clone()}set position(e){this._list.directionalLight.position.value=e;for(const[,t]of this._scene.directionalLights)t.position.copy(e)}}class Ri{constructor(e,i){t(this,"_list"),t(this,"_scene"),this._list=e,this._scene=i}get color(){return this._list.ambientLight.color.value}set color(e){this._list.ambientLight.color.value=e;for(const[,t]of this._scene.ambientLights)t.color.copy(e)}get intensity(){return this._list.ambientLight.intensity.value}set intensity(e){this._list.ambientLight.intensity.value=e;for(const[,t]of this._scene.ambientLights)t.intensity=e}}class gi extends pi{constructor(){super(...arguments),t(this,"_config",{backgroundColor:{value:new o.Color,type:"Color"},ambientLight:{color:{type:"Color",value:new o.Color},intensity:{type:"Number",interpolable:!0,min:0,max:10,value:2}},directionalLight:{color:{type:"Color",value:new o.Color},intensity:{type:"Number",interpolable:!0,min:0,max:10,value:2},position:{type:"Vector3",value:new o.Vector3}}}),t(this,"ambientLight",new Ri(this._config,this._component)),t(this,"directionalLight",new mi(this._config,this._component))}get backgroundColor(){return this._config.backgroundColor.value}set backgroundColor(e){this._config.backgroundColor.value=e,this._component.three.background=e}}class Ai extends kt{constructor(e){super(e),t(this,"onSetup",new Dt),t(this,"isSetup",!1),t(this,"three"),t(this,"config",new gi(this,this.components,"Scene")),t(this,"_defaultConfig",{backgroundColor:new o.Color(2107698),directionalLight:{color:new o.Color("white"),intensity:1.5,position:new o.Vector3(5,10,3)},ambientLight:{color:new o.Color("white"),intensity:1}}),this.three=new o.Scene,this.three.background=new o.Color(2107698)}setup(e){const t={...this._defaultConfig,...e};this.config.backgroundColor=t.backgroundColor;const i=t.ambientLight;this.config.ambientLight.color=i.color,this.config.ambientLight.intensity=i.intensity;const s=t.directionalLight;this.config.directionalLight.color=s.color,this.config.directionalLight.intensity=s.intensity,this.config.directionalLight.position=s.position,this.deleteAllLights();const{color:n,intensity:r}=this.config.directionalLight,a=new o.DirectionalLight(n,r);a.position.copy(s.position);const{color:c,intensity:l}=this.config.directionalLight,h=new o.AmbientLight(c,l);this.three.add(a,h),this.directionalLights.set(a.uuid,a),this.ambientLights.set(h.uuid,h),this.isSetup=!0,this.onSetup.trigger()}dispose(){super.dispose();this.components.get(Ti).list.delete(this.config.uuid)}}
1
+ "use strict";var e=Object.defineProperty,t=(t,i,s)=>(((t,i,s)=>{i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[i]=s})(t,"symbol"!=typeof i?i+"":i,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("three"),s=require("@thatopen/fragments"),n=require("web-ifc");function r(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const i in e)if("default"!==i){const s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>e[i]})}return t.default=e,Object.freeze(t)}const o=r(i),a=r(s),c=r(n),l=1.25,h=65535,u=Math.pow(2,-24),I=Symbol("SKIP_GENERATION");function d(e){return function(e){return e.index?e.index.count:e.attributes.position.count}(e)/3}function E(e,t){if(!e.index){const s=e.attributes.position.count,n=function(e,t=ArrayBuffer){return e>65535?new Uint32Array(new t(4*e)):new Uint16Array(new t(2*e))}(s,t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer);e.setIndex(new i.BufferAttribute(n,1));for(let e=0;e<s;e++)n[e]=e}}function f(e){const t=d(e),i=e.drawRange,s=i.start/3,n=(i.start+i.count)/3,r=Math.max(0,s),o=Math.min(t,n)-r;return[{offset:Math.floor(r),count:Math.floor(o)}]}function p(e){if(!e.groups||!e.groups.length)return f(e);const t=[],i=new Set,s=e.drawRange,n=s.start/3,r=(s.start+s.count)/3;for(const t of e.groups){const e=t.start/3,s=(t.start+t.count)/3;i.add(Math.max(n,e)),i.add(Math.min(r,s))}const o=Array.from(i.values()).sort(((e,t)=>e-t));for(let e=0;e<o.length-1;e++){const i=o[e],s=o[e+1];t.push({offset:Math.floor(i),count:Math.floor(s-i)})}return t}function C(e,t,i){return i.min.x=t[e],i.min.y=t[e+1],i.min.z=t[e+2],i.max.x=t[e+3],i.max.y=t[e+4],i.max.z=t[e+5],i}function T(e){let t=-1,i=-1/0;for(let s=0;s<3;s++){const n=e[s+3]-e[s];n>i&&(i=n,t=s)}return t}function m(e,t){t.set(e)}function R(e,t,i){let s,n;for(let r=0;r<3;r++){const o=r+3;s=e[r],n=t[r],i[r]=s<n?s:n,s=e[o],n=t[o],i[o]=s>n?s:n}}function g(e,t,i){for(let s=0;s<3;s++){const n=t[e+2*s],r=t[e+2*s+1],o=n-r,a=n+r;o<i[s]&&(i[s]=o),a>i[s+3]&&(i[s+3]=a)}}function A(e){const t=e[3]-e[0],i=e[4]-e[1],s=e[5]-e[2];return 2*(t*i+i*s+s*t)}function F(e,t,i,s,n=null){let r=1/0,o=1/0,a=1/0,c=-1/0,l=-1/0,h=-1/0,u=1/0,I=1/0,d=1/0,E=-1/0,f=-1/0,p=-1/0;const C=null!==n;for(let s=6*t,n=6*(t+i);s<n;s+=6){const t=e[s+0],i=e[s+1],n=t-i,T=t+i;n<r&&(r=n),T>c&&(c=T),C&&t<u&&(u=t),C&&t>E&&(E=t);const m=e[s+2],R=e[s+3],g=m-R,A=m+R;g<o&&(o=g),A>l&&(l=A),C&&m<I&&(I=m),C&&m>f&&(f=m);const F=e[s+4],S=e[s+5],O=F-S,N=F+S;O<a&&(a=O),N>h&&(h=N),C&&F<d&&(d=F),C&&F>p&&(p=F)}s[0]=r,s[1]=o,s[2]=a,s[3]=c,s[4]=l,s[5]=h,C&&(n[0]=u,n[1]=I,n[2]=d,n[3]=E,n[4]=f,n[5]=p)}const S=32,O=(e,t)=>e.candidate-t.candidate,N=new Array(S).fill().map((()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0}))),y=new Float32Array(6);class _{constructor(){}}function L(e,t,i,s,n,r){let o=s,a=s+n-1;const c=r.pos,l=2*r.axis;for(;;){for(;o<=a&&i[6*o+l]<c;)o++;for(;o<=a&&i[6*a+l]>=c;)a--;if(!(o<a))return o;for(let e=0;e<3;e++){let i=t[3*o+e];t[3*o+e]=t[3*a+e],t[3*a+e]=i}for(let e=0;e<6;e++){let t=i[6*o+e];i[6*o+e]=i[6*a+e],i[6*a+e]=t}o++,a--}}function P(e,t,i,s,n,r){let o=s,a=s+n-1;const c=r.pos,l=2*r.axis;for(;;){for(;o<=a&&i[6*o+l]<c;)o++;for(;o<=a&&i[6*a+l]>=c;)a--;if(!(o<a))return o;{let t=e[o];e[o]=e[a],e[a]=t;for(let e=0;e<6;e++){let t=i[6*o+e];i[6*o+e]=i[6*a+e],i[6*a+e]=t}o++,a--}}}function w(e,t){const i=e.geometry,s=i.index?i.index.array:null,n=t.maxDepth,r=t.verbose,o=t.maxLeafTris,a=t.strategy,c=t.onProgress,h=d(i),I=e._indirectBuffer;let E=!1;const C=new Float32Array(6),w=new Float32Array(6),M=function(e,t){var i;(i=t)[0]=i[1]=i[2]=1/0,i[3]=i[4]=i[5]=-1/0;const s=e.attributes.position,n=e.index?e.index.array:null,r=d(e),o=new Float32Array(6*r),a=s.normalized,c=s.array,l=s.offset||0;let h=3;s.isInterleavedBufferAttribute&&(h=s.data.stride);const I=["getX","getY","getZ"];for(let e=0;e<r;e++){const i=3*e,r=6*e;let d=i+0,E=i+1,f=i+2;n&&(d=n[d],E=n[E],f=n[f]),a||(d=d*h+l,E=E*h+l,f=f*h+l);for(let e=0;e<3;e++){let i,n,l;a?(i=s[I[e]](d),n=s[I[e]](E),l=s[I[e]](f)):(i=c[d+e],n=c[E+e],l=c[f+e]);let h=i;n<h&&(h=n),l<h&&(h=l);let p=i;n>p&&(p=n),l>p&&(p=l);const C=(p-h)/2,T=2*e;o[r+T+0]=h+C,o[r+T+1]=C+(Math.abs(h)+C)*u,h<t[e]&&(t[e]=h),p>t[e+3]&&(t[e+3]=p)}}return o}(i,C),v=t.indirect?P:L,D=[],x=t.indirect?f(i):p(i);if(1===x.length){const e=x[0],t=new _;t.boundingData=C,function(e,t,i,s){let n=1/0,r=1/0,o=1/0,a=-1/0,c=-1/0,l=-1/0;for(let s=6*t,h=6*(t+i);s<h;s+=6){const t=e[s+0];t<n&&(n=t),t>a&&(a=t);const i=e[s+2];i<r&&(r=i),i>c&&(c=i);const h=e[s+4];h<o&&(o=h),h>l&&(l=h)}s[0]=n,s[1]=r,s[2]=o,s[3]=a,s[4]=c,s[5]=l}(M,e.offset,e.count,w),U(t,e.offset,e.count,w),D.push(t)}else for(let e of x){const t=new _;t.boundingData=new Float32Array(6),F(M,e.offset,e.count,t.boundingData,w),U(t,e.offset,e.count,w),D.push(t)}return D;function b(e){c&&c(e/h)}function U(e,t,c,h=null,u=0){if(!E&&u>=n&&(E=!0,r&&(console.warn(`MeshBVH: Max depth of ${n} reached when generating BVH. Consider increasing maxDepth.`),console.warn(i))),c<=o||u>=n)return b(t+c),e.offset=t,e.count=c,e;const d=function(e,t,i,s,n,r){let o=-1,a=0;if(0===r)o=T(t),-1!==o&&(a=(t[o]+t[o+3])/2);else if(1===r)o=T(e),-1!==o&&(a=function(e,t,i,s){let n=0;for(let r=t,o=t+i;r<o;r++)n+=e[6*r+2*s];return n/i}(i,s,n,o));else if(2===r){const r=A(e);let c=l*n;const h=6*s,u=6*(s+n);for(let e=0;e<3;e++){const s=t[e],I=(t[e+3]-s)/S;if(n<8){const t=[...N];t.length=n;let s=0;for(let n=h;n<u;n+=6,s++){const r=t[s];r.candidate=i[n+2*e],r.count=0;const{bounds:o,leftCacheBounds:a,rightCacheBounds:c}=r;for(let e=0;e<3;e++)c[e]=1/0,c[e+3]=-1/0,a[e]=1/0,a[e+3]=-1/0,o[e]=1/0,o[e+3]=-1/0;g(n,i,o)}t.sort(O);let I=n;for(let e=0;e<I;e++){const i=t[e];for(;e+1<I&&t[e+1].candidate===i.candidate;)t.splice(e+1,1),I--}for(let s=h;s<u;s+=6){const n=i[s+2*e];for(let e=0;e<I;e++){const r=t[e];n>=r.candidate?g(s,i,r.rightCacheBounds):(g(s,i,r.leftCacheBounds),r.count++)}}for(let i=0;i<I;i++){const s=t[i],h=s.count,u=n-s.count,I=s.leftCacheBounds,d=s.rightCacheBounds;let E=0;0!==h&&(E=A(I)/r);let f=0;0!==u&&(f=A(d)/r);const p=1+l*(E*h+f*u);p<c&&(o=e,c=p,a=s.candidate)}}else{for(let e=0;e<S;e++){const t=N[e];t.count=0,t.candidate=s+I+e*I;const i=t.bounds;for(let e=0;e<3;e++)i[e]=1/0,i[e+3]=-1/0}for(let t=h;t<u;t+=6){let n=~~((i[t+2*e]-s)/I);n>=S&&(n=31);const r=N[n];r.count++,g(t,i,r.bounds)}const t=N[31];m(t.bounds,t.rightCacheBounds);for(let e=30;e>=0;e--){const t=N[e],i=N[e+1];R(t.bounds,i.rightCacheBounds,t.rightCacheBounds)}let d=0;for(let t=0;t<31;t++){const i=N[t],s=i.count,h=i.bounds,u=N[t+1].rightCacheBounds;0!==s&&(0===d?m(h,y):R(h,y,y)),d+=s;let I=0,E=0;0!==d&&(I=A(y)/r);const f=n-d;0!==f&&(E=A(u)/r);const p=1+l*(I*d+E*f);p<c&&(o=e,c=p,a=i.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${r} used.`);return{axis:o,pos:a}}(e.boundingData,h,M,t,c,a);if(-1===d.axis)return b(t+c),e.offset=t,e.count=c,e;const f=v(I,s,M,t,c,d);if(f===t||f===t+c)b(t+c),e.offset=t,e.count=c;else{e.splitAxis=d.axis;const i=new _,s=t,n=f-t;e.left=i,i.boundingData=new Float32Array(6),F(M,s,n,i.boundingData,w),U(i,s,n,w,u+1);const r=new _,o=f,a=c-n;e.right=r,r.boundingData=new Float32Array(6),F(M,o,a,r.boundingData,w),U(r,o,a,w,u+1)}return e}}function M(e,t){const i=e.geometry;t.indirect&&(e._indirectBuffer=function(e,t){const i=(e.index?e.index.count:e.attributes.position.count)/3,s=i>65536,n=s?4:2,r=t?new SharedArrayBuffer(i*n):new ArrayBuffer(i*n),o=s?new Uint32Array(r):new Uint16Array(r);for(let e=0,t=o.length;e<t;e++)o[e]=e;return o}(i,t.useSharedArrayBuffer),function(e){if(0===e.groups.length)return!1;const t=d(e),i=p(e).sort(((e,t)=>e.offset-t.offset)),s=i[i.length-1];s.count=Math.min(t-s.offset,s.count);let n=0;return i.forEach((({count:e})=>n+=e)),t!==n}(i)&&!t.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.')),e._indirectBuffer||E(i,t);const s=w(e,t);let n,r,o;const a=[],c=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let e=0;e<s.length;e++){const t=s[e];const i=new c(32*l(t));n=new Float32Array(i),r=new Uint32Array(i),o=new Uint16Array(i),u(0,t),a.push(i)}return void(e._roots=a);function l(e){return e.count?1:1+l(e.left)+l(e.right)}function u(e,t){const i=e/4,s=e/2,a=!!t.count,c=t.boundingData;for(let e=0;e<6;e++)n[i+e]=c[e];if(a){const n=t.offset,a=t.count;return r[i+6]=n,o[s+14]=a,o[s+15]=h,e+32}{const s=t.left,n=t.right,o=t.splitAxis;let a;if(a=u(e+32,s),a/4>Math.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return r[i+6]=a/4,a=u(a,n),r[i+7]=o,a}}}class v{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let i=1/0,s=-1/0;for(let n=0,r=e.length;n<r;n++){const r=e[n][t];i=r<i?r:i,s=r>s?r:s}this.min=i,this.max=s}setFromPoints(e,t){let i=1/0,s=-1/0;for(let n=0,r=t.length;n<r;n++){const r=t[n],o=e.dot(r);i=o<i?o:i,s=o>s?o:s}this.min=i,this.max=s}isSeparated(e){return this.min>e.max||e.min>this.max}}v.prototype.setFromBox=function(){const e=new i.Vector3;return function(t,i){const s=i.min,n=i.max;let r=1/0,o=-1/0;for(let i=0;i<=1;i++)for(let a=0;a<=1;a++)for(let c=0;c<=1;c++){e.x=s.x*i+n.x*(1-i),e.y=s.y*a+n.y*(1-a),e.z=s.z*c+n.z*(1-c);const l=t.dot(e);r=Math.min(l,r),o=Math.max(l,o)}this.min=r,this.max=o}}();const D=function(){const e=new i.Vector3,t=new i.Vector3,s=new i.Vector3;return function(i,n,r){const o=i.start,a=e,c=n.start,l=t;s.subVectors(o,c),e.subVectors(i.end,i.start),t.subVectors(n.end,n.start);const h=s.dot(l),u=l.dot(a),I=l.dot(l),d=s.dot(a),E=a.dot(a)*I-u*u;let f,p;f=0!==E?(h*u-d*I)/E:0,p=(h+f*u)/I,r.x=f,r.y=p}}(),x=function(){const e=new i.Vector2,t=new i.Vector3,s=new i.Vector3;return function(i,n,r,o){D(i,n,e);let a=e.x,c=e.y;if(a>=0&&a<=1&&c>=0&&c<=1)return i.at(a,r),void n.at(c,o);if(a>=0&&a<=1)return c<0?n.at(0,o):n.at(1,o),void i.closestPointToPoint(o,!0,r);if(c>=0&&c<=1)return a<0?i.at(0,r):i.at(1,r),void n.closestPointToPoint(r,!0,o);{let e,l;e=a<0?i.start:i.end,l=c<0?n.start:n.end;const h=t,u=s;return i.closestPointToPoint(l,!0,t),n.closestPointToPoint(e,!0,s),h.distanceToSquared(l)<=u.distanceToSquared(e)?(r.copy(h),void o.copy(l)):(r.copy(e),void o.copy(u))}}}(),b=function(){const e=new i.Vector3,t=new i.Vector3,s=new i.Plane,n=new i.Line3;return function(i,r){const{radius:o,center:a}=i,{a:c,b:l,c:h}=r;n.start=c,n.end=l;if(n.closestPointToPoint(a,!0,e).distanceTo(a)<=o)return!0;n.start=c,n.end=h;if(n.closestPointToPoint(a,!0,e).distanceTo(a)<=o)return!0;n.start=l,n.end=h;if(n.closestPointToPoint(a,!0,e).distanceTo(a)<=o)return!0;const u=r.getPlane(s);if(Math.abs(u.distanceToPoint(a))<=o){const e=u.projectPoint(a,t);if(r.containsPoint(e))return!0}return!1}}();function U(e){return Math.abs(e)<1e-15}class B extends i.Triangle{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map((()=>new i.Vector3)),this.satBounds=new Array(4).fill().map((()=>new v)),this.points=[this.a,this.b,this.c],this.sphere=new i.Sphere,this.plane=new i.Plane,this.needsUpdate=!0}intersectsSphere(e){return b(e,this)}update(){const e=this.a,t=this.b,i=this.c,s=this.points,n=this.satAxes,r=this.satBounds,o=n[0],a=r[0];this.getNormal(o),a.setFromPoints(o,s);const c=n[1],l=r[1];c.subVectors(e,t),l.setFromPoints(c,s);const h=n[2],u=r[2];h.subVectors(t,i),u.setFromPoints(h,s);const I=n[3],d=r[3];I.subVectors(i,e),d.setFromPoints(I,s),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(o,e),this.needsUpdate=!1}}B.prototype.closestPointToSegment=function(){const e=new i.Vector3,t=new i.Vector3,s=new i.Line3;return function(i,n=null,r=null){const{start:o,end:a}=i,c=this.points;let l,h=1/0;for(let o=0;o<3;o++){const a=(o+1)%3;s.start.copy(c[o]),s.end.copy(c[a]),x(s,i,e,t),l=e.distanceToSquared(t),l<h&&(h=l,n&&n.copy(e),r&&r.copy(t))}return this.closestPointToPoint(o,e),l=o.distanceToSquared(e),l<h&&(h=l,n&&n.copy(e),r&&r.copy(o)),this.closestPointToPoint(a,e),l=a.distanceToSquared(e),l<h&&(h=l,n&&n.copy(e),r&&r.copy(a)),Math.sqrt(h)}}(),B.prototype.intersectsTriangle=function(){const e=new B,t=new Array(3),s=new Array(3),n=new v,r=new v,o=new i.Vector3,a=new i.Vector3,c=new i.Vector3,l=new i.Vector3,h=new i.Vector3,u=new i.Line3,I=new i.Line3,d=new i.Line3,E=new i.Vector3;function f(e,t,i){const s=e.points;let n=0,r=-1;for(let e=0;e<3;e++){const{start:o,end:c}=u;o.copy(s[e]),c.copy(s[(e+1)%3]),u.delta(a);const l=U(t.distanceToPoint(o));if(U(t.normal.dot(a))&&l){i.copy(u),n=2;break}const h=t.intersectLine(u,E);if(!h&&l&&E.copy(o),(h||l)&&!U(E.distanceTo(c))){if(n<=1){(1===n?i.start:i.end).copy(E),l&&(r=n)}else if(n>=2){(1===r?i.start:i.end).copy(E),n=2;break}if(n++,2===n&&-1===r)break}}return n}return function(i,a=null,u=!1){this.needsUpdate&&this.update(),i.isExtendedTriangle?i.needsUpdate&&i.update():(e.copy(i),e.update(),i=e);const E=this.plane,p=i.plane;if(Math.abs(E.normal.dot(p.normal))>1-1e-10){const e=this.satBounds,c=this.satAxes;s[0]=i.a,s[1]=i.b,s[2]=i.c;for(let t=0;t<4;t++){const i=e[t],r=c[t];if(n.setFromPoints(r,s),i.isSeparated(n))return!1}const l=i.satBounds,h=i.satAxes;t[0]=this.a,t[1]=this.b,t[2]=this.c;for(let e=0;e<4;e++){const i=l[e],s=h[e];if(n.setFromPoints(s,t),i.isSeparated(n))return!1}for(let e=0;e<4;e++){const i=c[e];for(let e=0;e<4;e++){const a=h[e];if(o.crossVectors(i,a),n.setFromPoints(o,t),r.setFromPoints(o,s),n.isSeparated(r))return!1}}return a&&(u||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),a.start.set(0,0,0),a.end.set(0,0,0)),!0}{const e=f(this,p,I);if(1===e&&i.containsPoint(I.end))return a&&(a.start.copy(I.end),a.end.copy(I.end)),!0;if(2!==e)return!1;const t=f(i,E,d);if(1===t&&this.containsPoint(d.end))return a&&(a.start.copy(d.end),a.end.copy(d.end)),!0;if(2!==t)return!1;if(I.delta(c),d.delta(l),c.dot(l)<0){let e=d.start;d.start=d.end,d.end=e}const s=I.start.dot(c),n=I.end.dot(c),r=d.start.dot(c),o=d.end.dot(c);return(s===o||r===n||n<r!==s<o)&&(a&&(h.subVectors(I.start,d.start),h.dot(c)>0?a.start.copy(I.start):a.start.copy(d.start),h.subVectors(I.end,d.end),h.dot(c)<0?a.end.copy(I.end):a.end.copy(d.end)),!0)}}}(),B.prototype.distanceToPoint=function(){const e=new i.Vector3;return function(t){return this.closestPointToPoint(t,e),t.distanceTo(e)}}(),B.prototype.distanceToTriangle=function(){const e=new i.Vector3,t=new i.Vector3,s=["a","b","c"],n=new i.Line3,r=new i.Line3;return function(i,o=null,a=null){const c=o||a?n:null;if(this.intersectsTriangle(i,c))return(o||a)&&(o&&c.getCenter(o),a&&c.getCenter(a)),0;let l=1/0;for(let t=0;t<3;t++){let n;const r=s[t],c=i[r];this.closestPointToPoint(c,e),n=c.distanceToSquared(e),n<l&&(l=n,o&&o.copy(e),a&&a.copy(c));const h=this[r];i.closestPointToPoint(h,e),n=h.distanceToSquared(e),n<l&&(l=n,o&&o.copy(h),a&&a.copy(e))}for(let c=0;c<3;c++){const h=s[c],u=s[(c+1)%3];n.set(this[h],this[u]);for(let c=0;c<3;c++){const h=s[c],u=s[(c+1)%3];r.set(i[h],i[u]),x(n,r,e,t);const I=e.distanceToSquared(t);I<l&&(l=I,o&&o.copy(e),a&&a.copy(t))}}return Math.sqrt(l)}}();class V{constructor(e,t,s){this.isOrientedBox=!0,this.min=new i.Vector3,this.max=new i.Vector3,this.matrix=new i.Matrix4,this.invMatrix=new i.Matrix4,this.points=new Array(8).fill().map((()=>new i.Vector3)),this.satAxes=new Array(3).fill().map((()=>new i.Vector3)),this.satBounds=new Array(3).fill().map((()=>new v)),this.alignedSatBounds=new Array(3).fill().map((()=>new v)),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),s&&this.matrix.copy(s)}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}}V.prototype.update=function(){return function(){const e=this.matrix,t=this.min,i=this.max,s=this.points;for(let n=0;n<=1;n++)for(let r=0;r<=1;r++)for(let o=0;o<=1;o++){const a=s[1*n|2*r|4*o];a.x=n?i.x:t.x,a.y=r?i.y:t.y,a.z=o?i.z:t.z,a.applyMatrix4(e)}const n=this.satBounds,r=this.satAxes,o=s[0];for(let e=0;e<3;e++){const t=r[e],i=n[e],a=s[1<<e];t.subVectors(o,a),i.setFromPoints(t,s)}const a=this.alignedSatBounds;a[0].setFromPointsField(s,"x"),a[1].setFromPointsField(s,"y"),a[2].setFromPointsField(s,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}}(),V.prototype.intersectsBox=function(){const e=new v;return function(t){this.needsUpdate&&this.update();const i=t.min,s=t.max,n=this.satBounds,r=this.satAxes,o=this.alignedSatBounds;if(e.min=i.x,e.max=s.x,o[0].isSeparated(e))return!1;if(e.min=i.y,e.max=s.y,o[1].isSeparated(e))return!1;if(e.min=i.z,e.max=s.z,o[2].isSeparated(e))return!1;for(let i=0;i<3;i++){const s=r[i],o=n[i];if(e.setFromBox(s,t),o.isSeparated(e))return!1}return!0}}(),V.prototype.intersectsTriangle=function(){const e=new B,t=new Array(3),s=new v,n=new v,r=new i.Vector3;return function(i){this.needsUpdate&&this.update(),i.isExtendedTriangle?i.needsUpdate&&i.update():(e.copy(i),e.update(),i=e);const o=this.satBounds,a=this.satAxes;t[0]=i.a,t[1]=i.b,t[2]=i.c;for(let e=0;e<3;e++){const i=o[e],n=a[e];if(s.setFromPoints(n,t),i.isSeparated(s))return!1}const c=i.satBounds,l=i.satAxes,h=this.points;for(let e=0;e<3;e++){const t=c[e],i=l[e];if(s.setFromPoints(i,h),t.isSeparated(s))return!1}for(let e=0;e<3;e++){const i=a[e];for(let e=0;e<4;e++){const o=l[e];if(r.crossVectors(i,o),s.setFromPoints(r,t),n.setFromPoints(r,h),s.isSeparated(n))return!1}}return!0}}(),V.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}}(),V.prototype.distanceToPoint=function(){const e=new i.Vector3;return function(t){return this.closestPointToPoint(t,e),t.distanceTo(e)}}(),V.prototype.distanceToBox=function(){const e=["x","y","z"],t=new Array(12).fill().map((()=>new i.Line3)),s=new Array(12).fill().map((()=>new i.Line3)),n=new i.Vector3,r=new i.Vector3;return function(i,o=0,a=null,c=null){if(this.needsUpdate&&this.update(),this.intersectsBox(i))return(a||c)&&(i.getCenter(r),this.closestPointToPoint(r,n),i.closestPointToPoint(n,r),a&&a.copy(n),c&&c.copy(r)),0;const l=o*o,h=i.min,u=i.max,I=this.points;let d=1/0;for(let e=0;e<8;e++){const t=I[e];r.copy(t).clamp(h,u);const i=t.distanceToSquared(r);if(i<d&&(d=i,a&&a.copy(t),c&&c.copy(r),i<l))return Math.sqrt(i)}let E=0;for(let i=0;i<3;i++)for(let n=0;n<=1;n++)for(let r=0;r<=1;r++){const o=(i+1)%3,a=(i+2)%3,c=1<<i|n<<o|r<<a,l=I[n<<o|r<<a],d=I[c];t[E].set(l,d);const f=e[i],p=e[o],C=e[a],T=s[E],m=T.start,R=T.end;m[f]=h[f],m[p]=n?h[p]:u[p],m[C]=r?h[C]:u[p],R[f]=u[f],R[p]=n?h[p]:u[p],R[C]=r?h[C]:u[p],E++}for(let e=0;e<=1;e++)for(let t=0;t<=1;t++)for(let i=0;i<=1;i++){r.x=e?u.x:h.x,r.y=t?u.y:h.y,r.z=i?u.z:h.z,this.closestPointToPoint(r,n);const s=r.distanceToSquared(n);if(s<d&&(d=s,a&&a.copy(n),c&&c.copy(r),s<l))return Math.sqrt(s)}for(let e=0;e<12;e++){const i=t[e];for(let e=0;e<12;e++){const t=s[e];x(i,t,n,r);const o=n.distanceToSquared(r);if(o<d&&(d=o,a&&a.copy(n),c&&c.copy(r),o<l))return Math.sqrt(o)}}return Math.sqrt(d)}}();class Y{constructor(e){this._getNewPrimitive=e,this._primitives=[]}getPrimitive(){const e=this._primitives;return 0===e.length?this._getNewPrimitive():e.pop()}releasePrimitive(e){this._primitives.push(e)}}class G extends Y{constructor(){super((()=>new B))}}const z=new G;function k(e,t){return 65535===t[e+15]}function H(e,t){return t[e+6]}function W(e,t){return t[e+14]}function X(e){return e+8}function Z(e,t){return t[e+6]}function j(e,t){return t[e+7]}const $=new class{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,0!==e.length&&this.setBuffer(e.pop())}}};let Q,q;const K=[],J=new Y((()=>new i.Box3));function ee(e,t,i,s,n,r){Q=J.getPrimitive(),q=J.getPrimitive(),K.push(Q,q),$.setBuffer(e._roots[t]);const o=te(0,e.geometry,i,s,n,r);$.clearBuffer(),J.releasePrimitive(Q),J.releasePrimitive(q),K.pop(),K.pop();const a=K.length;return a>0&&(q=K[a-1],Q=K[a-2]),o}function te(e,t,i,s,n=null,r=0,o=0){const{float32Array:a,uint16Array:c,uint32Array:l}=$;let h=2*e;if(k(h,c)){const t=H(e,l),i=W(h,c);return C(e,a,Q),s(t,i,!1,o,r+e,Q)}{let h=function(e){const{uint16Array:t,uint32Array:i}=$;let s=2*e;for(;!k(s,t);)s=2*(e=X(e));return H(e,i)},u=function(e){const{uint16Array:t,uint32Array:i}=$;let s=2*e;for(;!k(s,t);)s=2*(e=Z(e,i));return H(e,i)+W(s,t)};const I=X(e),d=Z(e,l);let E,f,p,T,m=I,R=d;if(n&&(p=Q,T=q,C(m,a,p),C(R,a,T),E=n(p),f=n(T),f<E)){m=d,R=I;const e=E;E=f,f=e,p=T}p||(p=Q,C(m,a,p));const g=i(p,k(2*m,c),E,o+1,r+m);let A;if(2===g){const e=h(m);A=s(e,u(m)-e,!0,o+1,r+m,p)}else A=g&&te(m,t,i,s,n,r,o+1);if(A)return!0;T=q,C(R,a,T);const F=i(T,k(2*R,c),f,o+1,r+R);let S;if(2===F){const e=h(R);S=s(e,u(R)-e,!0,o+1,r+R,T)}else S=F&&te(R,t,i,s,n,r,o+1);return!!S}}const ie=new i.Vector3,se=new i.Vector3;const ne=new i.Vector3,re=new i.Vector3,oe=new i.Vector3,ae=new i.Vector2,ce=new i.Vector2,le=new i.Vector2,he=new i.Vector3,ue=new i.Vector3,Ie=new i.Vector3,de=new i.Vector3;function Ee(e,t,s,n,r,o,a,c,l){ne.fromBufferAttribute(t,o),re.fromBufferAttribute(t,a),oe.fromBufferAttribute(t,c);const h=function(e,t,s,n,r,o){let a;return a=o===i.BackSide?e.intersectTriangle(n,s,t,!0,r):e.intersectTriangle(t,s,n,o!==i.DoubleSide,r),null===a?null:{distance:e.origin.distanceTo(r),point:r.clone()}}(e,ne,re,oe,de,l);if(h){n&&(ae.fromBufferAttribute(n,o),ce.fromBufferAttribute(n,a),le.fromBufferAttribute(n,c),h.uv=i.Triangle.getInterpolation(de,ne,re,oe,ae,ce,le,new i.Vector2)),r&&(ae.fromBufferAttribute(r,o),ce.fromBufferAttribute(r,a),le.fromBufferAttribute(r,c),h.uv1=i.Triangle.getInterpolation(de,ne,re,oe,ae,ce,le,new i.Vector2)),s&&(he.fromBufferAttribute(s,o),ue.fromBufferAttribute(s,a),Ie.fromBufferAttribute(s,c),h.normal=i.Triangle.getInterpolation(de,ne,re,oe,he,ue,Ie,new i.Vector3),h.normal.dot(e.direction)>0&&h.normal.multiplyScalar(-1));const t={a:o,b:a,c:c,normal:new i.Vector3,materialIndex:0};i.Triangle.getNormal(ne,re,oe,t.normal),h.face=t,h.faceIndex=o}return h}function fe(e,t,i,s,n){const r=3*s;let o=r+0,a=r+1,c=r+2;const l=e.index;e.index&&(o=l.getX(o),a=l.getX(a),c=l.getX(c));const{position:h,normal:u,uv:I,uv1:d}=e.attributes,E=Ee(i,h,u,I,d,o,a,c,t);return E?(E.faceIndex=s,n&&n.push(E),E):null}function pe(e,t,i,s){const n=e.a,r=e.b,o=e.c;let a=t,c=t+1,l=t+2;i&&(a=i.getX(a),c=i.getX(c),l=i.getX(l)),n.x=s.getX(a),n.y=s.getY(a),n.z=s.getZ(a),r.x=s.getX(c),r.y=s.getY(c),r.z=s.getZ(c),o.x=s.getX(l),o.y=s.getY(l),o.z=s.getZ(l)}function Ce(e,t,i,s,n,r,o){const{geometry:a}=i,{index:c}=a,l=a.attributes.position;for(let i=e,a=t+e;i<a;i++){let e;if(e=i,pe(o,3*e,c,l),o.needsUpdate=!0,s(o,e,n,r))return!0}return!1}function Te(e,t=null){t&&Array.isArray(t)&&(t=new Set(t));const i=e.geometry,s=i.index?i.index.array:null,n=i.attributes.position;let r,o,a,c,l=0;const u=e._roots;for(let e=0,t=u.length;e<t;e++)r=u[e],o=new Uint32Array(r),a=new Uint16Array(r),c=new Float32Array(r),I(0,l),l+=r.byteLength;function I(e,i,r=!1){const l=2*e;if(a[l+15]===h){const t=o[e+6];let i=1/0,r=1/0,h=1/0,u=-1/0,I=-1/0,d=-1/0;for(let e=3*t,o=3*(t+a[l+14]);e<o;e++){let t=s[e];const o=n.getX(t),a=n.getY(t),c=n.getZ(t);o<i&&(i=o),o>u&&(u=o),a<r&&(r=a),a>I&&(I=a),c<h&&(h=c),c>d&&(d=c)}return(c[e+0]!==i||c[e+1]!==r||c[e+2]!==h||c[e+3]!==u||c[e+4]!==I||c[e+5]!==d)&&(c[e+0]=i,c[e+1]=r,c[e+2]=h,c[e+3]=u,c[e+4]=I,c[e+5]=d,!0)}{const s=e+8,n=o[e+6],a=s+i,l=n+i;let h=r,u=!1,d=!1;t?h||(u=t.has(a),d=t.has(l),h=!u&&!d):(u=!0,d=!0);const E=h||d;let f=!1;(h||u)&&(f=I(s,i,h));let p=!1;E&&(p=I(n,i,h));const C=f||p;if(C)for(let t=0;t<3;t++){const i=s+t,r=n+t,o=c[i],a=c[i+3],l=c[r],h=c[r+3];c[e+t]=o<l?o:l,c[e+t+3]=a>h?a:h}return C}}}const me=new i.Box3;function Re(e,t,i,s){return C(e,t,me),i.intersectBox(me,s)}function ge(e,t,i,s,n,r,o){const{geometry:a}=i,{index:c}=a,l=a.attributes.position;for(let a=e,h=t+e;a<h;a++){let e;if(e=i.resolveTriangleIndex(a),pe(o,3*e,c,l),o.needsUpdate=!0,s(o,e,n,r))return!0}return!1}const Ae=new i.Vector3;function Fe(e,t,i,s,n){$.setBuffer(e._roots[t]),Se(0,e,i,s,n),$.clearBuffer()}function Se(e,t,i,s,n){const{float32Array:r,uint16Array:o,uint32Array:a}=$,c=2*e;if(k(c,o)){!function(e,t,i,s,n,r){const{geometry:o,_indirectBuffer:a}=e;for(let e=s,a=s+n;e<a;e++)fe(o,t,i,e,r)}(t,i,s,H(e,a),W(c,o),n)}else{const o=X(e);Re(o,r,s,Ae)&&Se(o,t,i,s,n);const c=Z(e,a);Re(c,r,s,Ae)&&Se(c,t,i,s,n)}}const Oe=new i.Vector3,Ne=["x","y","z"];function ye(e,t,i,s){$.setBuffer(e._roots[t]);const n=_e(0,e,i,s);return $.clearBuffer(),n}function _e(e,t,i,s){const{float32Array:n,uint16Array:r,uint32Array:o}=$;let a=2*e;if(k(a,r)){return function(e,t,i,s,n){const{geometry:r,_indirectBuffer:o}=e;let a=1/0,c=null;for(let e=s,o=s+n;e<o;e++){let s;s=fe(r,t,i,e),s&&s.distance<a&&(c=s,a=s.distance)}return c}(t,i,s,H(e,o),W(a,r))}{const r=j(e,o),a=Ne[r],c=s.direction[a]>=0;let l,h;c?(l=X(e),h=Z(e,o)):(l=Z(e,o),h=X(e));const u=Re(l,n,s,Oe)?_e(l,t,i,s):null;if(u){const e=u.point[a];if(c?e<=n[h+r]:e>=n[h+r+3])return u}const I=Re(h,n,s,Oe)?_e(h,t,i,s):null;return u&&I?u.distance<=I.distance?u:I:u||I||null}}const Le=new i.Box3,Pe=new B,we=new B,Me=new i.Matrix4,ve=new V,De=new V;function xe(e,t,i,s){$.setBuffer(e._roots[t]);const n=be(0,e,i,s);return $.clearBuffer(),n}function be(e,t,i,s,n=null){const{float32Array:r,uint16Array:o,uint32Array:a}=$;let c=2*e;null===n&&(i.boundingBox||i.computeBoundingBox(),ve.set(i.boundingBox.min,i.boundingBox.max,s),n=ve);if(!k(c,o)){const o=e+8,c=a[e+6];C(o,r,Le);if(n.intersectsBox(Le)&&be(o,t,i,s,n))return!0;C(c,r,Le);return!!(n.intersectsBox(Le)&&be(c,t,i,s,n))}{const n=t.geometry,l=n.index,h=n.attributes.position,u=i.index,I=i.attributes.position,d=H(e,a),E=W(c,o);if(Me.copy(s).invert(),i.boundsTree){C(e,r,De),De.matrix.copy(Me),De.needsUpdate=!0;return i.boundsTree.shapecast({intersectsBounds:e=>De.intersectsBox(e),intersectsTriangle:e=>{e.a.applyMatrix4(s),e.b.applyMatrix4(s),e.c.applyMatrix4(s),e.needsUpdate=!0;for(let t=3*d,i=3*(E+d);t<i;t+=3)if(pe(we,t,l,h),we.needsUpdate=!0,e.intersectsTriangle(we))return!0;return!1}})}for(let e=3*d,t=3*(E+d);e<t;e+=3){pe(Pe,e,l,h),Pe.a.applyMatrix4(Me),Pe.b.applyMatrix4(Me),Pe.c.applyMatrix4(Me),Pe.needsUpdate=!0;for(let e=0,t=u.count;e<t;e+=3)if(pe(we,e,u,I),we.needsUpdate=!0,Pe.intersectsTriangle(we))return!0}}}const Ue=new i.Matrix4,Be=new V,Ve=new V,Ye=new i.Vector3,Ge=new i.Vector3,ze=new i.Vector3,ke=new i.Vector3;function He(e,t,i,s={},n={},r=0,o=1/0){t.boundingBox||t.computeBoundingBox(),Be.set(t.boundingBox.min,t.boundingBox.max,i),Be.needsUpdate=!0;const a=e.geometry,c=a.attributes.position,l=a.index,h=t.attributes.position,u=t.index,I=z.getPrimitive(),E=z.getPrimitive();let f=Ye,p=Ge,C=null,T=null;n&&(C=ze,T=ke);let m=1/0,R=null,g=null;return Ue.copy(i).invert(),Ve.matrix.copy(Ue),e.shapecast({boundsTraverseOrder:e=>Be.distanceToBox(e),intersectsBounds:(e,t,i)=>i<m&&i<o&&(t&&(Ve.min.copy(e.min),Ve.max.copy(e.max),Ve.needsUpdate=!0),!0),intersectsRange:(e,s)=>{if(t.boundsTree){return t.boundsTree.shapecast({boundsTraverseOrder:e=>Ve.distanceToBox(e),intersectsBounds:(e,t,i)=>i<m&&i<o,intersectsRange:(t,n)=>{for(let o=t,a=t+n;o<a;o++){pe(E,3*o,u,h),E.a.applyMatrix4(i),E.b.applyMatrix4(i),E.c.applyMatrix4(i),E.needsUpdate=!0;for(let t=e,i=e+s;t<i;t++){pe(I,3*t,l,c),I.needsUpdate=!0;const e=I.distanceToTriangle(E,f,C);if(e<m&&(p.copy(f),T&&T.copy(C),m=e,R=t,g=o),e<r)return!0}}}})}for(let n=0,o=d(t);n<o;n++){pe(E,3*n,u,h),E.a.applyMatrix4(i),E.b.applyMatrix4(i),E.c.applyMatrix4(i),E.needsUpdate=!0;for(let t=e,i=e+s;t<i;t++){pe(I,3*t,l,c),I.needsUpdate=!0;const e=I.distanceToTriangle(E,f,C);if(e<m&&(p.copy(f),T&&T.copy(C),m=e,R=t,g=n),e<r)return!0}}}}),z.releasePrimitive(I),z.releasePrimitive(E),m===1/0?null:(s.point?s.point.copy(p):s.point=p.clone(),s.distance=m,s.faceIndex=R,n&&(n.point?n.point.copy(T):n.point=T.clone(),n.point.applyMatrix4(Ue),p.applyMatrix4(Ue),n.distance=p.sub(n.point).length(),n.faceIndex=g),s)}function We(e,t=null){t&&Array.isArray(t)&&(t=new Set(t));const i=e.geometry,s=i.index?i.index.array:null,n=i.attributes.position;let r,o,a,c,l=0;const u=e._roots;for(let e=0,t=u.length;e<t;e++)r=u[e],o=new Uint32Array(r),a=new Uint16Array(r),c=new Float32Array(r),I(0,l),l+=r.byteLength;function I(i,r,l=!1){const u=2*i;if(a[u+15]===h){const t=o[i+6];let r=1/0,l=1/0,h=1/0,I=-1/0,d=-1/0,E=-1/0;for(let i=t,o=t+a[u+14];i<o;i++){const t=3*e.resolveTriangleIndex(i);for(let e=0;e<3;e++){let i=t+e;i=s?s[i]:i;const o=n.getX(i),a=n.getY(i),c=n.getZ(i);o<r&&(r=o),o>I&&(I=o),a<l&&(l=a),a>d&&(d=a),c<h&&(h=c),c>E&&(E=c)}}return(c[i+0]!==r||c[i+1]!==l||c[i+2]!==h||c[i+3]!==I||c[i+4]!==d||c[i+5]!==E)&&(c[i+0]=r,c[i+1]=l,c[i+2]=h,c[i+3]=I,c[i+4]=d,c[i+5]=E,!0)}{const e=i+8,s=o[i+6],n=e+r,a=s+r;let h=l,u=!1,d=!1;t?h||(u=t.has(n),d=t.has(a),h=!u&&!d):(u=!0,d=!0);const E=h||d;let f=!1;(h||u)&&(f=I(e,r,h));let p=!1;E&&(p=I(s,r,h));const C=f||p;if(C)for(let t=0;t<3;t++){const n=e+t,r=s+t,o=c[n],a=c[n+3],l=c[r],h=c[r+3];c[i+t]=o<l?o:l,c[i+t+3]=a>h?a:h}return C}}}const Xe=new i.Vector3;function Ze(e,t,i,s,n){$.setBuffer(e._roots[t]),je(0,e,i,s,n),$.clearBuffer()}function je(e,t,i,s,n){const{float32Array:r,uint16Array:o,uint32Array:a}=$,c=2*e;if(k(c,o)){!function(e,t,i,s,n,r){const{geometry:o,_indirectBuffer:a}=e;for(let e=s,c=s+n;e<c;e++)fe(o,t,i,a?a[e]:e,r)}(t,i,s,H(e,a),W(c,o),n)}else{const o=X(e);Re(o,r,s,Xe)&&je(o,t,i,s,n);const c=Z(e,a);Re(c,r,s,Xe)&&je(c,t,i,s,n)}}const $e=new i.Vector3,Qe=["x","y","z"];function qe(e,t,i,s){$.setBuffer(e._roots[t]);const n=Ke(0,e,i,s);return $.clearBuffer(),n}function Ke(e,t,i,s){const{float32Array:n,uint16Array:r,uint32Array:o}=$;let a=2*e;if(k(a,r)){return function(e,t,i,s,n){const{geometry:r,_indirectBuffer:o}=e;let a=1/0,c=null;for(let e=s,l=s+n;e<l;e++){let s;s=fe(r,t,i,o?o[e]:e),s&&s.distance<a&&(c=s,a=s.distance)}return c}(t,i,s,H(e,o),W(a,r))}{const r=j(e,o),a=Qe[r],c=s.direction[a]>=0;let l,h;c?(l=X(e),h=Z(e,o)):(l=Z(e,o),h=X(e));const u=Re(l,n,s,$e)?Ke(l,t,i,s):null;if(u){const e=u.point[a];if(c?e<=n[h+r]:e>=n[h+r+3])return u}const I=Re(h,n,s,$e)?Ke(h,t,i,s):null;return u&&I?u.distance<=I.distance?u:I:u||I||null}}const Je=new i.Box3,et=new B,tt=new B,it=new i.Matrix4,st=new V,nt=new V;function rt(e,t,i,s){$.setBuffer(e._roots[t]);const n=ot(0,e,i,s);return $.clearBuffer(),n}function ot(e,t,i,s,n=null){const{float32Array:r,uint16Array:o,uint32Array:a}=$;let c=2*e;null===n&&(i.boundingBox||i.computeBoundingBox(),st.set(i.boundingBox.min,i.boundingBox.max,s),n=st);if(!k(c,o)){const o=e+8,c=a[e+6];C(o,r,Je);if(n.intersectsBox(Je)&&ot(o,t,i,s,n))return!0;C(c,r,Je);return!!(n.intersectsBox(Je)&&ot(c,t,i,s,n))}{const n=t.geometry,l=n.index,h=n.attributes.position,u=i.index,I=i.attributes.position,d=H(e,a),E=W(c,o);if(it.copy(s).invert(),i.boundsTree){C(e,r,nt),nt.matrix.copy(it),nt.needsUpdate=!0;return i.boundsTree.shapecast({intersectsBounds:e=>nt.intersectsBox(e),intersectsTriangle:e=>{e.a.applyMatrix4(s),e.b.applyMatrix4(s),e.c.applyMatrix4(s),e.needsUpdate=!0;for(let i=d,s=E+d;i<s;i++)if(pe(tt,3*t.resolveTriangleIndex(i),l,h),tt.needsUpdate=!0,e.intersectsTriangle(tt))return!0;return!1}})}for(let e=d,i=E+d;e<i;e++){const i=t.resolveTriangleIndex(e);pe(et,3*i,l,h),et.a.applyMatrix4(it),et.b.applyMatrix4(it),et.c.applyMatrix4(it),et.needsUpdate=!0;for(let e=0,t=u.count;e<t;e+=3)if(pe(tt,e,u,I),tt.needsUpdate=!0,et.intersectsTriangle(tt))return!0}}}const at=new i.Matrix4,ct=new V,lt=new V,ht=new i.Vector3,ut=new i.Vector3,It=new i.Vector3,dt=new i.Vector3;function Et(e,t,i,s={},n={},r=0,o=1/0){t.boundingBox||t.computeBoundingBox(),ct.set(t.boundingBox.min,t.boundingBox.max,i),ct.needsUpdate=!0;const a=e.geometry,c=a.attributes.position,l=a.index,h=t.attributes.position,u=t.index,I=z.getPrimitive(),E=z.getPrimitive();let f=ht,p=ut,C=null,T=null;n&&(C=It,T=dt);let m=1/0,R=null,g=null;return at.copy(i).invert(),lt.matrix.copy(at),e.shapecast({boundsTraverseOrder:e=>ct.distanceToBox(e),intersectsBounds:(e,t,i)=>i<m&&i<o&&(t&&(lt.min.copy(e.min),lt.max.copy(e.max),lt.needsUpdate=!0),!0),intersectsRange:(s,n)=>{if(t.boundsTree){const a=t.boundsTree;return a.shapecast({boundsTraverseOrder:e=>lt.distanceToBox(e),intersectsBounds:(e,t,i)=>i<m&&i<o,intersectsRange:(t,o)=>{for(let d=t,A=t+o;d<A;d++){const t=a.resolveTriangleIndex(d);pe(E,3*t,u,h),E.a.applyMatrix4(i),E.b.applyMatrix4(i),E.c.applyMatrix4(i),E.needsUpdate=!0;for(let t=s,i=s+n;t<i;t++){const i=e.resolveTriangleIndex(t);pe(I,3*i,l,c),I.needsUpdate=!0;const s=I.distanceToTriangle(E,f,C);if(s<m&&(p.copy(f),T&&T.copy(C),m=s,R=t,g=d),s<r)return!0}}}})}for(let o=0,a=d(t);o<a;o++){pe(E,3*o,u,h),E.a.applyMatrix4(i),E.b.applyMatrix4(i),E.c.applyMatrix4(i),E.needsUpdate=!0;for(let t=s,i=s+n;t<i;t++){const i=e.resolveTriangleIndex(t);pe(I,3*i,l,c),I.needsUpdate=!0;const s=I.distanceToTriangle(E,f,C);if(s<m&&(p.copy(f),T&&T.copy(C),m=s,R=t,g=o),s<r)return!0}}}}),z.releasePrimitive(I),z.releasePrimitive(E),m===1/0?null:(s.point?s.point.copy(p):s.point=p.clone(),s.distance=m,s.faceIndex=R,n&&(n.point?n.point.copy(T):n.point=T.clone(),n.point.applyMatrix4(at),p.applyMatrix4(at),n.distance=p.sub(n.point).length(),n.faceIndex=g),s)}const ft=new $.constructor,pt=new $.constructor,Ct=new Y((()=>new i.Box3)),Tt=new i.Box3,mt=new i.Box3,Rt=new i.Box3,gt=new i.Box3;let At=!1;function Ft(e,t,i,s,n,r=0,o=0,a=0,c=0,l=null,h=!1){let u,I;h?(u=pt,I=ft):(u=ft,I=pt);const d=u.float32Array,E=u.uint32Array,f=u.uint16Array,p=I.float32Array,T=I.uint32Array,m=I.uint16Array,R=2*t,g=k(2*e,f),A=k(R,m);let F=!1;if(A&&g)F=h?n(H(t,T),W(2*t,m),H(e,E),W(2*e,f),c,o+t,a,r+e):n(H(e,E),W(2*e,f),H(t,T),W(2*t,m),a,r+e,c,o+t);else if(A){const l=Ct.getPrimitive();C(t,p,l),l.applyMatrix4(i);const u=X(e),I=Z(e,E);C(u,d,Tt),C(I,d,mt);const f=l.intersectsBox(Tt),T=l.intersectsBox(mt);F=f&&Ft(t,u,s,i,n,o,r,c,a+1,l,!h)||T&&Ft(t,I,s,i,n,o,r,c,a+1,l,!h),Ct.releasePrimitive(l)}else{const u=X(t),I=Z(t,T);C(u,p,Rt),C(I,p,gt);const f=l.intersectsBox(Rt),m=l.intersectsBox(gt);if(f&&m)F=Ft(e,u,i,s,n,r,o,a,c+1,l,h)||Ft(e,I,i,s,n,r,o,a,c+1,l,h);else if(f)if(g)F=Ft(e,u,i,s,n,r,o,a,c+1,l,h);else{const t=Ct.getPrimitive();t.copy(Rt).applyMatrix4(i);const l=X(e),I=Z(e,E);C(l,d,Tt),C(I,d,mt);const f=t.intersectsBox(Tt),p=t.intersectsBox(mt);F=f&&Ft(u,l,s,i,n,o,r,c,a+1,t,!h)||p&&Ft(u,I,s,i,n,o,r,c,a+1,t,!h),Ct.releasePrimitive(t)}else if(m)if(g)F=Ft(e,I,i,s,n,r,o,a,c+1,l,h);else{const t=Ct.getPrimitive();t.copy(gt).applyMatrix4(i);const l=X(e),u=Z(e,E);C(l,d,Tt),C(u,d,mt);const f=t.intersectsBox(Tt),p=t.intersectsBox(mt);F=f&&Ft(I,l,s,i,n,o,r,c,a+1,t,!h)||p&&Ft(I,u,s,i,n,o,r,c,a+1,t,!h),Ct.releasePrimitive(t)}}return F}const St=new V,Ot=new i.Box3;class Nt{static serialize(e,t={}){t={cloneBuffers:!0,...t};const i=e.geometry,s=e._roots,n=e._indirectBuffer,r=i.getIndex();let o;return o=t.cloneBuffers?{roots:s.map((e=>e.slice())),index:r.array.slice(),indirectBuffer:n?n.slice():null}:{roots:s,index:r.array,indirectBuffer:n},o}static deserialize(e,t,s={}){s={setIndex:!0,indirect:Boolean(e.indirectBuffer),...s};const{index:n,roots:r,indirectBuffer:o}=e,a=new Nt(t,{...s,[I]:!0});if(a._roots=r,a._indirectBuffer=o||null,s.setIndex){const s=t.getIndex();if(null===s){const s=new i.BufferAttribute(e.index,1,!1);t.setIndex(s)}else s.array!==n&&(s.array.set(n),s.needsUpdate=!0)}return a}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(!e.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");if((t=Object.assign({strategy:0,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,[I]:!1},t)).useSharedArrayBuffer&&"undefined"==typeof SharedArrayBuffer)throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[I]||(M(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new i.Box3)));const{_indirectBuffer:s}=this;this.resolveTriangleIndex=t.indirect?e=>s[e]:e=>e}refit(e=null){return(this.indirect?We:Te)(this,e)}traverse(e,t=0){const i=this._roots[t],s=new Uint32Array(i),n=new Uint16Array(i);!function t(r,o=0){const a=2*r,c=n[a+15]===h;if(c){const t=s[r+6],l=n[a+14];e(o,c,new Float32Array(i,4*r,6),t,l)}else{const n=r+8,a=s[r+6],l=s[r+7];e(o,c,new Float32Array(i,4*r,6),l)||(t(n,o+1),t(a,o+1))}}(0)}raycast(e,t=i.FrontSide){const s=this._roots,n=this.geometry,r=[],o=t.isMaterial,a=Array.isArray(t),c=n.groups,l=o?t.side:t,h=this.indirect?Ze:Fe;for(let i=0,n=s.length;i<n;i++){const s=a?t[c[i].materialIndex].side:l,n=r.length;if(h(this,i,s,e,r),a){const e=c[i].materialIndex;for(let t=n,i=r.length;t<i;t++)r[t].face.materialIndex=e}}return r}raycastFirst(e,t=i.FrontSide){const s=this._roots,n=this.geometry,r=t.isMaterial,o=Array.isArray(t);let a=null;const c=n.groups,l=r?t.side:t,h=this.indirect?qe:ye;for(let i=0,n=s.length;i<n;i++){const s=h(this,i,o?t[c[i].materialIndex].side:l,e);null!=s&&(null==a||s.distance<a.distance)&&(a=s,o&&(s.face.materialIndex=c[i].materialIndex))}return a}intersectsGeometry(e,t){let i=!1;const s=this._roots,n=this.indirect?rt:xe;for(let r=0,o=s.length;r<o&&(i=n(this,r,e,t),!i);r++);return i}shapecast(e){const t=z.getPrimitive(),i=this.indirect?ge:Ce;let{boundsTraverseOrder:s,intersectsBounds:n,intersectsRange:r,intersectsTriangle:o}=e;if(r&&o){const e=r;r=(s,n,r,a,c)=>!!e(s,n,r,a,c)||i(s,n,this,o,r,a,t)}else r||(r=o?(e,s,n,r)=>i(e,s,this,o,n,r,t):(e,t,i)=>i);let a=!1,c=0;const l=this._roots;for(let e=0,t=l.length;e<t;e++){const t=l[e];if(a=ee(this,e,n,r,s,c),a)break;c+=t.byteLength}return z.releasePrimitive(t),a}bvhcast(e,t,s){let{intersectsRanges:n,intersectsTriangles:r}=s;const o=z.getPrimitive(),a=this.geometry.index,c=this.geometry.attributes.position,l=this.indirect?e=>{const t=this.resolveTriangleIndex(e);pe(o,3*t,a,c)}:e=>{pe(o,3*e,a,c)},h=z.getPrimitive(),u=e.geometry.index,I=e.geometry.attributes.position,d=e.indirect?t=>{const i=e.resolveTriangleIndex(t);pe(h,3*i,u,I)}:e=>{pe(h,3*e,u,I)};if(r){const e=(e,i,s,n,a,c,u,I)=>{for(let E=s,f=s+n;E<f;E++){d(E),h.a.applyMatrix4(t),h.b.applyMatrix4(t),h.c.applyMatrix4(t),h.needsUpdate=!0;for(let t=e,s=e+i;t<s;t++)if(l(t),o.needsUpdate=!0,r(o,h,t,E,a,c,u,I))return!0}return!1};if(n){const t=n;n=function(i,s,n,r,o,a,c,l){return!!t(i,s,n,r,o,a,c,l)||e(i,s,n,r,o,a,c,l)}}else n=e}return function(e,t,s,n){if(At)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");At=!0;const r=e._roots,o=t._roots;let a,c=0,l=0;const h=(new i.Matrix4).copy(s).invert();for(let e=0,t=r.length;e<t;e++){ft.setBuffer(r[e]),l=0;const t=Ct.getPrimitive();C(0,ft.float32Array,t),t.applyMatrix4(h);for(let i=0,r=o.length;i<r&&(pt.setBuffer(o[e]),a=Ft(0,0,s,h,n,c,l,0,0,t),pt.clearBuffer(),l+=o[i].length,!a);i++);if(Ct.releasePrimitive(t),ft.clearBuffer(),c+=r[e].length,a)break}return At=!1,a}(this,e,t,n)}intersectsBox(e,t){return St.set(e.min,e.max,t),St.needsUpdate=!0,this.shapecast({intersectsBounds:e=>St.intersectsBox(e),intersectsTriangle:e=>St.intersectsTriangle(e)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,i={},s={},n=0,r=1/0){return(this.indirect?Et:He)(this,e,t,i,s,n,r)}closestPointToPoint(e,t={},i=0,s=1/0){return function(e,t,i={},s=0,n=1/0){const r=s*s,o=n*n;let a=1/0,c=null;if(e.shapecast({boundsTraverseOrder:e=>(ie.copy(t).clamp(e.min,e.max),ie.distanceToSquared(t)),intersectsBounds:(e,t,i)=>i<a&&i<o,intersectsTriangle:(e,i)=>{e.closestPointToPoint(t,ie);const s=t.distanceToSquared(ie);return s<a&&(se.copy(ie),a=s,c=i),s<r}}),a===1/0)return null;const l=Math.sqrt(a);return i.point?i.point.copy(se):i.point=se.clone(),i.distance=l,i.faceIndex=c,i}(this,e,t,i,s)}getBoundingBox(e){e.makeEmpty();return this._roots.forEach((t=>{C(0,new Float32Array(t),Ot),e.union(Ot)})),e}}function yt(e,t,i){return null===e?null:(e.point.applyMatrix4(t.matrixWorld),e.distance=e.point.distanceTo(i.ray.origin),e.object=t,e.distance<i.near||e.distance>i.far?null:e)}const _t=new i.Ray,Lt=new i.Matrix4,Pt=i.Mesh.prototype.raycast;function wt(e,t){if(this.geometry.boundsTree){if(void 0===this.material)return;Lt.copy(this.matrixWorld).invert(),_t.copy(e.ray).applyMatrix4(Lt);const i=this.geometry.boundsTree;if(!0===e.firstHitOnly){const s=yt(i.raycastFirst(_t,this.material),this,e);s&&t.push(s)}else{const s=i.raycast(_t,this.material);for(let i=0,n=s.length;i<n;i++){const n=yt(s[i],this,e);n&&t.push(n)}}}else Pt.call(this,e,t)}function Mt(e){return this.boundsTree=new Nt(this,e),this.boundsTree}function vt(){this.boundsTree=null}class Dt{constructor(){t(this,"enabled",!0),t(this,"trigger",(e=>{if(!this.enabled)return;const t=this.handlers.slice(0);for(const i of t)i(e)})),t(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter((t=>t!==e))}reset(){this.handlers.length=0}}class xt{constructor(){t(this,"enabled",!0),t(this,"trigger",(async e=>{if(!this.enabled)return;const t=this.handlers.slice(0);for(const i of t)await i(e)})),t(this,"handlers",[])}add(e){this.handlers.push(e)}remove(e){this.handlers=this.handlers.filter((t=>t!==e))}reset(){this.handlers.length=0}}class bt{constructor(e){t(this,"isDisposeable",(()=>"dispose"in this&&"onDisposed"in this)),t(this,"isResizeable",(()=>"resize"in this&&"getSize"in this)),t(this,"isUpdateable",(()=>"onAfterUpdate"in this&&"onBeforeUpdate"in this&&"update"in this)),t(this,"isHideable",(()=>"visible"in this)),t(this,"isConfigurable",(()=>"setup"in this&&"config"in this&&"onSetup"in this)),this.components=e}}class Ut extends bt{}class Bt extends bt{constructor(e){super(e),t(this,"worlds",new Map),t(this,"onWorldChanged",new Dt),t(this,"currentWorld",null),this.onWorldChanged.add((({world:e,action:t})=>{"removed"===t&&this.worlds.delete(e.uuid)}))}}class Vt extends Bt{constructor(){super(...arguments),t(this,"hasCameraControls",(()=>"controls"in this))}}class Yt extends Bt{constructor(){super(...arguments),t(this,"onAfterUpdate",new Dt),t(this,"onBeforeUpdate",new Dt),t(this,"onDisposed",new Dt),t(this,"onResize",new Dt),t(this,"onClippingPlanesUpdated",new Dt),t(this,"clippingPlanes",[])}updateClippingPlanes(){this.onClippingPlanesUpdated.trigger()}setPlane(e,t,i){t.isLocal=i;const s=this.clippingPlanes.indexOf(t);e&&-1===s?this.clippingPlanes.push(t):!e&&s>-1&&this.clippingPlanes.splice(s,1),this.three.clippingPlanes=this.clippingPlanes.filter((e=>!e.isLocal))}}const Gt=class e extends Ut{constructor(i){super(i),t(this,"_disposedComponents",new Set),t(this,"enabled",!0),i.add(e.uuid,this)}get(){return this._disposedComponents}destroy(e,t=!0,i=!0){e.removeFromParent();const s=e;s.dispose&&s.dispose(),this.disposeGeometryAndMaterials(e,t),i&&s.children&&s.children.length&&this.disposeChildren(s),e.children.length=0}disposeGeometry(e){e.boundsTree&&e.disposeBoundsTree&&e.disposeBoundsTree(),e.dispose()}disposeGeometryAndMaterials(t,i){const s=t;s.geometry&&this.disposeGeometry(s.geometry),i&&s.material&&e.disposeMaterial(s),s.material=[],s.geometry=null}disposeChildren(e){for(const t of e.children)this.destroy(t)}static disposeMaterial(e){if(e.material)if(Array.isArray(e.material))for(const t of e.material)t.dispose();else e.material.dispose()}};t(Gt,"uuid","76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe");let zt=Gt;class kt extends Bt{constructor(e){super(e),t(this,"onDisposed",new Dt),t(this,"directionalLights",new Map),t(this,"ambientLights",new Map)}dispose(){const e=this.components.get(zt);for(const t of this.three.children){const i=t;i.geometry&&e.destroy(i)}this.deleteAllLights(),this.three.children=[],this.onDisposed.trigger(),this.onDisposed.reset()}deleteAllLights(){for(const[,e]of this.directionalLights)e.removeFromParent(),e.target.removeFromParent(),e.dispose();this.directionalLights.clear();for(const[,e]of this.ambientLights)e.removeFromParent(),e.dispose();this.ambientLights.clear()}}class Ht extends Set{constructor(e){super(e),t(this,"onItemAdded",new Dt),t(this,"onItemDeleted",new Dt),t(this,"onCleared",new Dt),t(this,"guard",(()=>!0))}clear(){super.clear(),this.onCleared.trigger()}add(...e){for(const t of e){if(this.has(t))continue;this.guard(t)&&(super.add(t),this.onItemAdded||(this.onItemAdded=new Dt),this.onItemAdded.trigger(t))}return this}delete(e){const t=super.delete(e);return t&&this.onItemDeleted.trigger(),t}dispose(){this.clear(),this.onItemAdded.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}class Wt extends Map{constructor(e){super(e),t(this,"onItemSet",new Dt),t(this,"onItemUpdated",new Dt),t(this,"onItemDeleted",new Dt),t(this,"onCleared",new Dt),t(this,"guard",(()=>!0))}clear(){super.clear(),this.onCleared.trigger()}set(e,t){const i=this.has(e);if(!(this.guard??(()=>!0))(e,t))return this;const s=super.set(e,t);return i?(this.onItemUpdated||(this.onItemUpdated=new Dt),this.onItemUpdated.trigger({key:e,value:t})):(this.onItemSet||(this.onItemSet=new Dt),this.onItemSet.trigger({key:e,value:t})),s}delete(e){const t=super.delete(e);return t&&this.onItemDeleted.trigger(e),t}dispose(){this.clear(),this.onItemSet.reset(),this.onItemDeleted.reset(),this.onCleared.reset()}}class Xt{static isEntry(e){return new Set(["Boolean","Color","Text","Number","Select","Vector3","TextSet","None"]).has(e.type)}static copySchema(e,t={}){for(const i in e){const s=e[i];this.isEntry(s)?t[i]=this.copyEntry(s):(t[i]={},this.copySchema(s,t[i]))}return t}static copyEntry(e){if("Boolean"===e.type){const t=e;return{type:t.type,value:t.value}}if("Color"===e.type){const t=e;return{type:t.type,value:t.value.clone()}}if("Text"===e.type){const t=e;return{type:t.type,value:t.value}}if("Number"===e.type){const t=e;return{type:t.type,value:t.value,min:t.min,max:t.max,interpolable:t.interpolable}}if("Select"===e.type){const t=e;return{type:t.type,value:t.value,multiple:t.multiple,options:new Set(t.options)}}if("Vector3"===e.type){const t=e;return{type:t.type,value:t.value.clone()}}if("TextSet"===e.type){const t=e;return{type:t.type,value:new Set(t.value)}}if("None"===e.type){const t=e;return{type:t.type,value:t.value}}throw new Error("Invalid entry!")}}const Zt=new i.Vector3,jt=new i.Line3,$t=new i.Plane,Qt=new i.Vector3,qt=new i.Triangle;class Kt{constructor(){this.tolerance=-1,this.faces=[],this.newFaces=[],this.assigned=new ii,this.unassigned=new ii,this.vertices=[]}setFromPoints(e){if(e.length>=4){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.vertices.push(new ti(e[t]));this.compute()}return this}setFromObject(e){const t=[];return e.updateMatrixWorld(!0),e.traverse((function(e){const s=e.geometry;if(void 0!==s){const n=s.attributes.position;if(void 0!==n)for(let s=0,r=n.count;s<r;s++){const r=new i.Vector3;r.fromBufferAttribute(n,s).applyMatrix4(e.matrixWorld),t.push(r)}}})),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 t=0,r=i.length;t<r;t++){const r=i[t],o=r.distanceToPoint(e.origin),a=r.normal.dot(e.direction);if(o>0&&a>=0)return null;const c=0!==a?-o/a:0;if(!(c<=0)&&(a>0?n=Math.min(c,n):s=Math.max(c,s),s>n))return null}return s!==-1/0?e.at(s,t):e.at(n,t),t}intersectsRay(e){return null!==this.intersectRay(e,Zt)}makeEmpty(){return this.faces=[],this.vertices=[],this}addVertexToFace(e,t){return e.face=t,null===t.outside?this.assigned.append(e):this.assigned.insertBefore(t.outside,e),t.outside=e,this}removeVertexFromFace(e,t){return e===t.outside&&(null!==e.next&&e.next.face===t?t.outside=e.next:t.outside=null),this.assigned.remove(e),this}removeAllVerticesFromFace(e){if(null!==e.outside){const t=e.outside;let i=e.outside;for(;null!==i.next&&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(void 0!==i)if(void 0===t)this.unassigned.appendChain(i);else{let e=i;do{const i=e.next;t.distanceToPoint(e.point)>this.tolerance?this.addVertexToFace(e,t):this.unassigned.append(e),e=i}while(null!==e)}return this}resolveUnassignedPoints(e){if(!1===this.unassigned.isEmpty()){let t=this.unassigned.first();do{const i=t.next;let s=this.tolerance,n=null;for(let i=0;i<e.length;i++){const r=e[i];if(0===r.mark){const e=r.distanceToPoint(t.point);if(e>s&&(s=e,n=r),s>1e3*this.tolerance)break}}null!==n&&this.addVertexToFace(t,n),t=i}while(null!==t)}return this}computeExtremes(){const e=new i.Vector3,t=new i.Vector3,s=[],n=[];for(let e=0;e<3;e++)s[e]=n[e]=this.vertices[0];e.copy(this.vertices[0].point),t.copy(this.vertices[0].point);for(let i=0,r=this.vertices.length;i<r;i++){const r=this.vertices[i],o=r.point;for(let t=0;t<3;t++)o.getComponent(t)<e.getComponent(t)&&(e.setComponent(t,o.getComponent(t)),s[t]=r);for(let e=0;e<3;e++)o.getComponent(e)>t.getComponent(e)&&(t.setComponent(e,o.getComponent(e)),n[e]=r)}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:s,max:n}}computeInitialHull(){const e=this.vertices,t=this.computeExtremes(),i=t.min,s=t.max;let n=0,r=0;for(let e=0;e<3;e++){const t=s[e].point.getComponent(e)-i[e].point.getComponent(e);t>n&&(n=t,r=e)}const o=i[r],a=s[r];let c,l;n=0,jt.set(o.point,a.point);for(let t=0,i=this.vertices.length;t<i;t++){const i=e[t];if(i!==o&&i!==a){jt.closestPointToPoint(i.point,!0,Qt);const e=Qt.distanceToSquared(i.point);e>n&&(n=e,c=i)}}n=-1,$t.setFromCoplanarPoints(o.point,a.point,c.point);for(let t=0,i=this.vertices.length;t<i;t++){const i=e[t];if(i!==o&&i!==a&&i!==c){const e=Math.abs($t.distanceToPoint(i.point));e>n&&(n=e,l=i)}}const h=[];if($t.distanceToPoint(l.point)<0){h.push(Jt.create(o,a,c),Jt.create(l,a,o),Jt.create(l,c,a),Jt.create(l,o,c));for(let e=0;e<3;e++){const t=(e+1)%3;h[e+1].getEdge(2).setTwin(h[0].getEdge(t)),h[e+1].getEdge(1).setTwin(h[t+1].getEdge(0))}}else{h.push(Jt.create(o,c,a),Jt.create(l,o,a),Jt.create(l,a,c),Jt.create(l,c,o));for(let e=0;e<3;e++){const t=(e+1)%3;h[e+1].getEdge(2).setTwin(h[0].getEdge((3-e)%3)),h[e+1].getEdge(0).setTwin(h[t+1].getEdge(1))}}for(let e=0;e<4;e++)this.faces.push(h[e]);for(let t=0,i=e.length;t<i;t++){const i=e[t];if(i!==o&&i!==a&&i!==c&&i!==l){n=this.tolerance;let e=null;for(let t=0;t<4;t++){const s=this.faces[t].distanceToPoint(i.point);s>n&&(n=s,e=this.faces[t])}null!==e&&this.addVertexToFace(i,e)}}return this}reindexFaces(){const e=[];for(let t=0;t<this.faces.length;t++){const i=this.faces[t];0===i.mark&&e.push(i)}return this.faces=e,this}nextVertexToAdd(){if(!1===this.assigned.isEmpty()){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(null!==s&&s.face===i);return e}}computeHorizon(e,t,i,s){let n;this.deleteFaceVertices(i),i.mark=1,n=null===t?t=i.getEdge(0):t.next;do{const t=n.twin,i=t.face;0===i.mark&&(i.distanceToPoint(e)>this.tolerance?this.computeHorizon(e,t,i,s):s.push(n)),n=n.next}while(n!==t);return this}addAdjoiningFace(e,t){const i=Jt.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 r=t[n],o=this.addAdjoiningFace(e,r);null===i?i=o:o.next.setTwin(s),this.newFaces.push(o.face),s=o}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();void 0!==(e=this.nextVertexToAdd());)this.addVertexToHull(e);return this.reindexFaces(),this.cleanup(),this}}class Jt{constructor(){this.normal=new i.Vector3,this.midpoint=new i.Vector3,this.area=0,this.constant=0,this.outside=null,this.mark=0,this.edge=null}static create(e,t,i){const s=new Jt,n=new ei(e,s),r=new ei(t,s),o=new ei(i,s);return n.next=o.prev=r,r.next=n.prev=o,o.next=r.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 qt.set(e.point,t.point,i.point),qt.getNormal(this.normal),qt.getMidpoint(this.midpoint),this.area=qt.getArea(),this.constant=this.normal.dot(this.midpoint),this}distanceToPoint(e){return this.normal.dot(e)-this.constant}}class ei{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 null!==t?t.point.distanceTo(e.point):-1}lengthSquared(){const e=this.head(),t=this.tail();return null!==t?t.point.distanceToSquared(e.point):-1}setTwin(e){return this.twin=e,e.twin=this,this}}class ti{constructor(e){this.point=e,this.prev=null,this.next=null,this.face=null}}class ii{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,null===t.prev?this.head=t:t.prev.next=t,e.prev=t,this}insertAfter(e,t){return t.prev=e,t.next=e.next,null===t.next?this.tail=t:t.next.prev=t,e.next=t,this}append(e){return null===this.head?this.head=e:this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e,this}appendChain(e){for(null===this.head?this.head=e:this.tail.next=e,e.prev=this.tail;null!==e.next;)e=e.next;return this.tail=e,this}remove(e){return null===e.prev?this.head=e.next:e.prev.next=e.next,null===e.next?this.tail=e.prev:e.next.prev=e.prev,this}removeSubList(e,t){return null===e.prev?this.head=t.next:e.prev.next=t.next,null===t.next?this.tail=e.prev:t.next.prev=e.prev,this}isEmpty(){return null===this.head}}const si=[2,2,1],ni=[1,0,0];function ri(e,t){return 3*e+t}function oi(e){const t=e.elements;let i=0;for(let e=0;e<3;e++){const s=t[ri(si[e],ni[e])];i+=2*s*s}return Math.sqrt(i)}function ai(e,t){let i=0,s=1;const n=e.elements;for(let e=0;e<3;e++){const t=Math.abs(n[ri(si[e],ni[e])]);t>i&&(i=t,s=e)}let r=1,o=0;const a=ni[s],c=si[s];if(Math.abs(n[ri(c,a)])>Number.EPSILON){const e=(n[ri(c,c)]-n[ri(a,a)])/2/n[ri(c,a)];let t;t=e<0?-1/(-e+Math.sqrt(1+e*e)):1/(e+Math.sqrt(1+e*e)),r=1/Math.sqrt(1+t*t),o=t*r}return t.identity(),t.elements[ri(a,a)]=r,t.elements[ri(c,c)]=r,t.elements[ri(c,a)]=o,t.elements[ri(a,c)]=-o,t}function ci(e,t){let i=0,s=0;t.unitary.identity(),t.diagonal.copy(e);const n=t.unitary,r=t.diagonal,a=new o.Matrix3,c=new o.Matrix3,l=Number.EPSILON*function(e){const t=e.elements;let i=0;for(let e=0;e<9;e++)i+=t[e]*t[e];return Math.sqrt(i)}(r);for(;s<10&&oi(r)>l;)ai(r,a),c.copy(a).transpose(),r.multiply(a),r.premultiply(c),n.multiply(a),++i>2&&(s++,i=0);return t}function li(e){const t=[];for(let i=0;i<e.length-2;i+=3){const s=e[i],n=e[i+1],r=e[i+2];t.push(new o.Vector3(s,n,r))}const i=new Kt;i.setFromPoints(t);const s={unitary:new o.Matrix3,diagonal:new o.Matrix3},n=i.faces,r=[],a=[];for(let e=0,t=n.length;e<t;e++){const t=n[e];let i=t.edge;r.length=0;do{r.push(i),i=i.next}while(i!==t.edge);for(let e=1,t=r.length-2;e<=t;e++){const t=r[0].vertex,i=r[e+0].vertex,s=r[e+1].vertex;a.push(t.point.x,t.point.y,t.point.z),a.push(i.point.x,i.point.y,i.point.z),a.push(s.point.x,s.point.y,s.point.z)}}const c=new o.Vector3,l=new o.Vector3,h=new o.Vector3,u=new o.Vector3,I=new o.Vector3,d=new o.Vector3,E=new o.Vector3,f=new o.Vector3;let p=0,C=0,T=0,m=0,R=0,g=0,A=0;for(let e=0,t=a.length;e<t;e+=9){c.fromArray(a,e),l.fromArray(a,e+3),h.fromArray(a,e+6),E.set(0,0,0),E.add(c).add(l).add(h).divideScalar(3),u.subVectors(l,c),I.subVectors(h,c);const t=d.crossVectors(u,I).length()/2;f.add(d.copy(E).multiplyScalar(t)),p+=t,C+=(9*E.x*E.x+c.x*c.x+l.x*l.x+h.x*h.x)*(t/12),T+=(9*E.x*E.y+c.x*c.y+l.x*l.y+h.x*h.y)*(t/12),m+=(9*E.x*E.z+c.x*c.z+l.x*l.z+h.x*h.z)*(t/12),R+=(9*E.y*E.y+c.y*c.y+l.y*l.y+h.y*h.y)*(t/12),g+=(9*E.y*E.z+c.y*c.z+l.y*l.z+h.y*h.z)*(t/12),A+=(9*E.z*E.z+c.z*c.z+l.z*l.z+h.z*h.z)*(t/12)}f.divideScalar(p),C/=p,T/=p,m/=p,R/=p,g/=p,A/=p,C-=f.x*f.x,T-=f.x*f.y,m-=f.x*f.z,R-=f.y*f.y,g-=f.y*f.z,A-=f.z*f.z;const F=new o.Matrix3;F.elements[0]=C,F.elements[1]=T,F.elements[2]=m,F.elements[3]=T,F.elements[4]=R,F.elements[5]=g,F.elements[6]=m,F.elements[7]=g,F.elements[8]=A,ci(F,s);const S=s.unitary,O=new o.Vector3,N=new o.Vector3,y=new o.Vector3;S.extractBasis(O,N,y);let _=-1/0,L=-1/0,P=-1/0,w=1/0,M=1/0,v=1/0;for(let e=0,i=t.length;e<i;e++){const i=t[e];_=Math.max(O.dot(i),_),L=Math.max(N.dot(i),L),P=Math.max(y.dot(i),P),w=Math.min(O.dot(i),w),M=Math.min(N.dot(i),M),v=Math.min(y.dot(i),v)}O.multiplyScalar(.5*(w+_)),N.multiplyScalar(.5*(M+L)),y.multiplyScalar(.5*(v+P));const D=new o.Vector3,x=new o.Vector3,b=new o.Matrix3;D.add(O).add(N).add(y),x.x=_-w,x.y=L-M,x.z=P-v,x.multiplyScalar(.5),b.copy(S);const{x:U,y:B,z:V}=x,Y=new o.Matrix4;Y.makeScale(2*U,2*B,2*V);const G=new o.Matrix4;G.makeTranslation(-U,-B,-V);const z=new o.Matrix4;z.makeTranslation(D.x,D.y,D.z);const k=new o.Matrix4;k.setFromMatrix3(b);const H=new o.Matrix4;return H.multiply(z),H.multiply(k),H.multiply(G),H.multiply(Y),{center:D,halfSizes:x,rotation:b,transformation:H}}class hi{static isTransparent(e){return e.transparent&&e.opacity<1}}const ui=class e{static create(){const t=4294967295*Math.random()|0,i=4294967295*Math.random()|0,s=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return`${e._lut[255&t]+e._lut[t>>8&255]+e._lut[t>>16&255]+e._lut[t>>24&255]}-${e._lut[255&i]}${e._lut[i>>8&255]}-${e._lut[i>>16&15|64]}${e._lut[i>>24&255]}-${e._lut[63&s|128]}${e._lut[s>>8&255]}-${e._lut[s>>16&255]}${e._lut[s>>24&255]}${e._lut[255&n]}${e._lut[n>>8&255]}${e._lut[n>>16&255]}${e._lut[n>>24&255]}`.toLowerCase()}static validate(t){if(!e._pattern.test(t))throw new Error(`${t} is not a valid UUID v4.\n\n- If you're the tool creator, you can take one from https://www.uuidgenerator.net/.\n\n- If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`)}};t(ui,"_pattern",/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/),t(ui,"_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 Ii=ui;var di="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ei(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fi={exports:{}};function pi(e,t,i){i=i||2;var s,n,r,o,a,c,l,h=t&&t.length,u=h?t[0]*i:e.length,I=Ci(e,0,u,i,!0),d=[];if(!I||I.next===I.prev)return d;if(h&&(I=function(e,t,i,s){var n,r,o,a=[];for(n=0,r=t.length;n<r;n++)(o=Ci(e,t[n]*s,n<r-1?t[n+1]*s:e.length,s,!1))===o.next&&(o.steiner=!0),a.push(_i(o));for(a.sort(Si),n=0;n<a.length;n++)i=Oi(a[n],i);return i}(e,t,I,i)),e.length>80*i){s=r=e[0],n=o=e[1];for(var E=i;E<u;E+=i)(a=e[E])<s&&(s=a),(c=e[E+1])<n&&(n=c),a>r&&(r=a),c>o&&(o=c);l=0!==(l=Math.max(r-s,o-n))?32767/l:0}return mi(I,d,i,s,n,l,0),d}function Ci(e,t,i,s,n){var r,o;if(n===Gi(e,t,i,s)>0)for(r=t;r<i;r+=s)o=Bi(r,e[r],e[r+1],o);else for(r=i-s;r>=t;r-=s)o=Bi(r,e[r],e[r+1],o);return o&&Mi(o,o.next)&&(Vi(o),o=o.next),o}function Ti(e,t){if(!e)return e;t||(t=e);var i,s=e;do{if(i=!1,s.steiner||!Mi(s,s.next)&&0!==wi(s.prev,s,s.next))s=s.next;else{if(Vi(s),(s=t=s.prev)===s.next)break;i=!0}}while(i||s!==t);return t}function mi(e,t,i,s,n,r,o){if(e){!o&&r&&function(e,t,i,s){var n=e;do{0===n.z&&(n.z=yi(n.x,n.y,t,i,s)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){var t,i,s,n,r,o,a,c,l=1;do{for(i=e,e=null,r=null,o=0;i;){for(o++,s=i,a=0,t=0;t<l&&(a++,s=s.nextZ);t++);for(c=l;a>0||c>0&&s;)0!==a&&(0===c||!s||i.z<=s.z)?(n=i,i=i.nextZ,a--):(n=s,s=s.nextZ,c--),r?r.nextZ=n:e=n,n.prevZ=r,r=n;i=s}r.nextZ=null,l*=2}while(o>1)}(n)}(e,s,n,r);for(var a,c,l=e;e.prev!==e.next;)if(a=e.prev,c=e.next,r?gi(e,s,n,r):Ri(e))t.push(a.i/i|0),t.push(e.i/i|0),t.push(c.i/i|0),Vi(e),e=c.next,l=c.next;else if((e=c)===l){o?1===o?mi(e=Ai(Ti(e),t,i),t,i,s,n,r,2):2===o&&Fi(e,t,i,s,n,r):mi(Ti(e),t,i,s,n,r,1);break}}}function Ri(e){var t=e.prev,i=e,s=e.next;if(wi(t,i,s)>=0)return!1;for(var n=t.x,r=i.x,o=s.x,a=t.y,c=i.y,l=s.y,h=n<r?n<o?n:o:r<o?r:o,u=a<c?a<l?a:l:c<l?c:l,I=n>r?n>o?n:o:r>o?r:o,d=a>c?a>l?a:l:c>l?c:l,E=s.next;E!==t;){if(E.x>=h&&E.x<=I&&E.y>=u&&E.y<=d&&Li(n,a,r,c,o,l,E.x,E.y)&&wi(E.prev,E,E.next)>=0)return!1;E=E.next}return!0}function gi(e,t,i,s){var n=e.prev,r=e,o=e.next;if(wi(n,r,o)>=0)return!1;for(var a=n.x,c=r.x,l=o.x,h=n.y,u=r.y,I=o.y,d=a<c?a<l?a:l:c<l?c:l,E=h<u?h<I?h:I:u<I?u:I,f=a>c?a>l?a:l:c>l?c:l,p=h>u?h>I?h:I:u>I?u:I,C=yi(d,E,t,i,s),T=yi(f,p,t,i,s),m=e.prevZ,R=e.nextZ;m&&m.z>=C&&R&&R.z<=T;){if(m.x>=d&&m.x<=f&&m.y>=E&&m.y<=p&&m!==n&&m!==o&&Li(a,h,c,u,l,I,m.x,m.y)&&wi(m.prev,m,m.next)>=0)return!1;if(m=m.prevZ,R.x>=d&&R.x<=f&&R.y>=E&&R.y<=p&&R!==n&&R!==o&&Li(a,h,c,u,l,I,R.x,R.y)&&wi(R.prev,R,R.next)>=0)return!1;R=R.nextZ}for(;m&&m.z>=C;){if(m.x>=d&&m.x<=f&&m.y>=E&&m.y<=p&&m!==n&&m!==o&&Li(a,h,c,u,l,I,m.x,m.y)&&wi(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;R&&R.z<=T;){if(R.x>=d&&R.x<=f&&R.y>=E&&R.y<=p&&R!==n&&R!==o&&Li(a,h,c,u,l,I,R.x,R.y)&&wi(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function Ai(e,t,i){var s=e;do{var n=s.prev,r=s.next.next;!Mi(n,r)&&vi(n,s,s.next,r)&&bi(n,r)&&bi(r,n)&&(t.push(n.i/i|0),t.push(s.i/i|0),t.push(r.i/i|0),Vi(s),Vi(s.next),s=e=r),s=s.next}while(s!==e);return Ti(s)}function Fi(e,t,i,s,n,r){var o=e;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&Pi(o,a)){var c=Ui(o,a);return o=Ti(o,o.next),c=Ti(c,c.next),mi(o,t,i,s,n,r,0),void mi(c,t,i,s,n,r,0)}a=a.next}o=o.next}while(o!==e)}function Si(e,t){return e.x-t.x}function Oi(e,t){var i=function(e,t){var i,s=t,n=e.x,r=e.y,o=-1/0;do{if(r<=s.y&&r>=s.next.y&&s.next.y!==s.y){var a=s.x+(r-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(a<=n&&a>o&&(o=a,i=s.x<s.next.x?s:s.next,a===n))return i}s=s.next}while(s!==t);if(!i)return null;var c,l=i,h=i.x,u=i.y,I=1/0;s=i;do{n>=s.x&&s.x>=h&&n!==s.x&&Li(r<u?n:o,r,h,u,r<u?o:n,r,s.x,s.y)&&(c=Math.abs(r-s.y)/(n-s.x),bi(s,e)&&(c<I||c===I&&(s.x>i.x||s.x===i.x&&Ni(i,s)))&&(i=s,I=c)),s=s.next}while(s!==l);return i}(e,t);if(!i)return t;var s=Ui(i,e);return Ti(s,s.next),Ti(i,i.next)}function Ni(e,t){return wi(e.prev,e,t.prev)<0&&wi(t.next,e,e.next)<0}function yi(e,t,i,s,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function _i(e){var t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next}while(t!==e);return i}function Li(e,t,i,s,n,r,o,a){return(n-o)*(t-a)>=(e-o)*(r-a)&&(e-o)*(s-a)>=(i-o)*(t-a)&&(i-o)*(r-a)>=(n-o)*(s-a)}function Pi(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&vi(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(bi(e,t)&&bi(t,e)&&function(e,t){var i=e,s=!1,n=(e.x+t.x)/2,r=(e.y+t.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&n<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(s=!s),i=i.next}while(i!==e);return s}(e,t)&&(wi(e.prev,e,t.prev)||wi(e,t.prev,t))||Mi(e,t)&&wi(e.prev,e,e.next)>0&&wi(t.prev,t,t.next)>0)}function wi(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function Mi(e,t){return e.x===t.x&&e.y===t.y}function vi(e,t,i,s){var n=xi(wi(e,t,i)),r=xi(wi(e,t,s)),o=xi(wi(i,s,e)),a=xi(wi(i,s,t));return n!==r&&o!==a||(!(0!==n||!Di(e,i,t))||(!(0!==r||!Di(e,s,t))||(!(0!==o||!Di(i,e,s))||!(0!==a||!Di(i,t,s)))))}function Di(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function xi(e){return e>0?1:e<0?-1:0}function bi(e,t){return wi(e.prev,e,e.next)<0?wi(e,t,e.next)>=0&&wi(e,e.prev,t)>=0:wi(e,t,e.prev)<0||wi(e,e.next,t)<0}function Ui(e,t){var i=new Yi(e.i,e.x,e.y),s=new Yi(t.i,t.x,t.y),n=e.next,r=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,s.next=i,i.prev=s,r.next=s,s.prev=r,s}function Bi(e,t,i,s){var n=new Yi(e,t,i);return s?(n.next=s.next,n.prev=s,s.next.prev=n,s.next=n):(n.prev=n,n.next=n),n}function Vi(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Yi(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Gi(e,t,i,s){for(var n=0,r=t,o=i-s;r<i;r+=s)n+=(e[o]-e[r])*(e[r+1]+e[o+1]),o=r;return n}fi.exports=pi,fi.exports.default=pi,pi.deviation=function(e,t,i,s){var n=t&&t.length,r=n?t[0]*i:e.length,o=Math.abs(Gi(e,0,r,i));if(n)for(var a=0,c=t.length;a<c;a++){var l=t[a]*i,h=a<c-1?t[a+1]*i:e.length;o-=Math.abs(Gi(e,l,h,i))}var u=0;for(a=0;a<s.length;a+=3){var I=s[a]*i,d=s[a+1]*i,E=s[a+2]*i;u+=Math.abs((e[I]-e[E])*(e[d+1]-e[I+1])-(e[I]-e[d])*(e[E+1]-e[I+1]))}return 0===o&&0===u?0:Math.abs((u-o)/o)},pi.flatten=function(e){for(var t=e[0][0].length,i={vertices:[],holes:[],dimensions:t},s=0,n=0;n<e.length;n++){for(var r=0;r<e[n].length;r++)for(var o=0;o<t;o++)i.vertices.push(e[n][r][o]);n>0&&(s+=e[n-1].length,i.holes.push(s))}return i};const zi=Ei(fi.exports);class ki extends Ut{constructor(){super(...arguments),t(this,"enabled",!0),t(this,"_inverseMatrix",new o.Matrix4),t(this,"_localPlane",new o.Plane),t(this,"_tempLine",new o.Line3),t(this,"_tempVector",new o.Vector3),t(this,"_plane"),t(this,"_plane2DCoordinateSystem",new o.Matrix4),t(this,"_precission",1e4),t(this,"_planeAxis")}get plane(){if(!this._plane)throw new Error("Plane not set");return this._plane}set plane(e){this._plane=e}createEdges(e){const{meshes:t,posAttr:i}=e;let s=0;i.array.fill(0);const n=[];let r=0;const a=new o.Mesh;for(const e of t)if(e.geometry){if(e.geometry.boundsTree||e.geometry.computeBoundsTree(),!e.geometry.boundsTree)throw new Error("Bounds tree not found for edges generation.");if(e instanceof o.InstancedMesh){if(0===e.count)continue;const t=e;for(let c=0;c<t.count;c++){a.geometry=e.geometry,a.matrix.copy(e.matrix);const l=new o.Matrix4;t.getMatrixAt(c,l),a.applyMatrix4(l),a.applyMatrix4(e.matrixWorld),a.updateMatrix(),a.updateMatrixWorld(),this._inverseMatrix.copy(a.matrixWorld).invert(),this._localPlane.copy(this.plane).applyMatrix4(this._inverseMatrix),s=this.shapecast(a,i,s),s!==r&&(n.push(s),r=s)}}else this._inverseMatrix.copy(e.matrixWorld).invert(),this._localPlane.copy(this.plane).applyMatrix4(this._inverseMatrix),s=this.shapecast(e,i,s),s!==r&&(n.push(s),r=s)}return{indexes:n,index:s}}createFills(e,t){this.updatePlane2DCoordinateSystem();const i=[];let s=0;for(let n=0;n<t.length;n++){const r=t[n],o=[];for(let e=s;e<r;e+=2)o.push(3*e);const a=this.computeFill(o,e);for(const e of a)i.push(e);s=r}return i}computeFill(e,t){const i=new Map,s={},n=new Map;let r=0;const o=new Map,a=new Map,c=new Set,l=this._precission;for(let h=0;h<e.length;h++){const u=e[h];let I=0,d=0,E=0,f=0;const p=t[u],C=t[u+1],T=t[u+2],m=t[u+3],R=t[u+4],g=t[u+5];if(this._tempVector.set(p,C,T),this._tempVector.applyMatrix4(this._plane2DCoordinateSystem),I=Math.trunc(this._tempVector.x*l)/l,d=Math.trunc(this._tempVector.y*l)/l,this._tempVector.set(m,R,g),this._tempVector.applyMatrix4(this._plane2DCoordinateSystem),E=Math.trunc(this._tempVector.x*l)/l,f=Math.trunc(this._tempVector.y*l)/l,I===E&&d===f)continue;const A=`${I}|${d}`,F=`${E}|${f}`;i.has(A)||i.set(A,u/3),i.has(F)||i.set(F,u/3+1);const S=i.get(A),O=i.get(F);s[S]=[I,d],s[O]=[E,f];const N=a.has(S),y=o.has(S),_=a.has(O),L=o.has(O);if(!(N||y||_||L))a.set(S,r),o.set(O,r),c.add(r),n.set(r,[S,O]),r++;else if(N&&L){const e=a.get(S),t=o.get(O);if(e!==t){const i=n.get(t),s=n.get(e);if(!i||!s)continue;n.delete(e),c.delete(e),o.set(s[s.length-1],t),o.delete(i[i.length-1]);for(const e of s)i.push(e)}else c.delete(t);a.delete(S),o.delete(O)}else if(y&&_){const e=a.get(O),t=o.get(S);if(e!==t){const i=n.get(t),s=n.get(e);if(!i||!s)continue;n.delete(e),c.delete(e),o.set(s[s.length-1],t),o.delete(i[i.length-1]);for(const e of s)i.push(e)}else c.delete(t);a.delete(O),o.delete(S)}else if(N&&_){const e=a.get(O),t=a.get(S),i=n.get(t),s=n.get(e);if(!i||!s)continue;n.delete(e),c.delete(e),a.delete(i[0]),a.delete(s[0]),o.delete(s[s.length-1]),a.set(s[s.length-1],t),s.reverse(),i.splice(0,0,...s)}else if(y&&L){const e=o.get(O),t=o.get(S),i=n.get(t),s=n.get(e);if(!i||!s)continue;n.delete(e),c.delete(e),o.delete(i[i.length-1]),o.delete(s[s.length-1]),a.delete(s[0]),o.set(s[0],t),s.reverse(),i.push(...s)}else if(N){const e=a.get(S),t=n.get(e);if(!t)continue;t.unshift(O),a.delete(S),a.set(O,e)}else if(y){const e=o.get(S),t=n.get(e);if(!t)continue;t.push(O),o.delete(S),o.set(O,e)}else if(_){const e=a.get(O),t=n.get(e);if(!t)continue;t.unshift(S),a.delete(O),a.set(S,e)}else if(L){const e=o.get(O),t=n.get(e);if(!t)continue;t.push(S),o.delete(O),o.set(S,e)}}const h=[];for(const[e,t]of n){if(c.has(e))continue;const i=[],n=new Map;let r=0;for(const e of t){const t=s[e];i.push(t[0],t[1]),n.set(r++,e)}const o=zi(i);for(const e of o){const t=n.get(e);if(void 0===t)throw new Error("Map error!");h.push(t)}}return h}updatePlane2DCoordinateSystem(){this._plane2DCoordinateSystem=new o.Matrix4;const e=new o.Vector3(1,0,0),t=new o.Vector3(0,1,0),i=this.plane.normal,s=new o.Vector3;this.plane.coplanarPoint(s),"x"===this._planeAxis?e.crossVectors(t,i):"y"===this._planeAxis?t.crossVectors(i,e):"z"===this._planeAxis||(e.crossVectors(t,i).normalize(),t.crossVectors(i,e)),this._plane2DCoordinateSystem.fromArray([e.x,e.y,e.z,0,t.x,t.y,t.z,0,i.x,i.y,i.z,0,s.x,s.y,s.z,1]),this._plane2DCoordinateSystem.invert()}shapecast(e,t,i){return e.geometry.boundsTree.shapecast({intersectsBounds:e=>this._localPlane.intersectsBox(e),intersectsTriangle:s=>{let n=0;if(this._tempLine.start.copy(s.a),this._tempLine.end.copy(s.b),this._localPlane.intersectLine(this._tempLine,this._tempVector)){const s=this._tempVector.applyMatrix4(e.matrixWorld);t.setXYZ(i,s.x,s.y,s.z),n++,i++}if(this._tempLine.start.copy(s.b),this._tempLine.end.copy(s.c),this._localPlane.intersectLine(this._tempLine,this._tempVector)){const s=this._tempVector.applyMatrix4(e.matrixWorld);t.setXYZ(i,s.x,s.y,s.z),n++,i++}if(this._tempLine.start.copy(s.c),this._tempLine.end.copy(s.a),this._localPlane.intersectLine(this._tempLine,this._tempVector)){const s=this._tempVector.applyMatrix4(e.matrixWorld);t.setXYZ(i,s.x,s.y,s.z),n++,i++}2!==n&&(i-=n)}}),i}}t(ki,"uuid","1a193b87-6376-46c8-9e65-62a1576fdb64");const Hi=class e{constructor(){t(this,"onDisposed",new Dt),t(this,"list",new Map),t(this,"enabled",!1),t(this,"_clock"),t(this,"onInit",new Dt),t(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 o.Clock,e.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.");Ii.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(),this.onInit.trigger()}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(){o.BufferGeometry.prototype.computeBoundsTree=Mt,o.BufferGeometry.prototype.disposeBoundsTree=vt,o.Mesh.prototype.raycast=wt}};t(Hi,"release","2.4.3");let Wi=Hi;class Xi extends bt{constructor(){super(...arguments),t(this,"meshes",new Set),t(this,"onAfterUpdate",new Dt),t(this,"onBeforeUpdate",new Dt),t(this,"onDisposed",new Dt),t(this,"isDisposing",!1),t(this,"enabled",!0),t(this,"uuid",Ii.create()),t(this,"name"),t(this,"_scene"),t(this,"_camera"),t(this,"_renderer",null)}get scene(){if(!this._scene)throw new Error("No scene initialized!");return this._scene}set scene(e){this._scene=e,e.worlds.set(this.uuid,this),e.currentWorld=this,e.onWorldChanged.trigger({world:this,action:"added"})}get camera(){if(!this._camera)throw new Error("No camera initialized!");return this._camera}set camera(e){this._camera=e,e.worlds.set(this.uuid,this),e.currentWorld=this,e.onWorldChanged.trigger({world:this,action:"added"})}get renderer(){return this._renderer}set renderer(e){this._renderer=e,e&&(e.worlds.set(this.uuid,this),e.currentWorld=this,e.onWorldChanged.trigger({world:this,action:"added"}))}update(e){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(e),this.camera.isUpdateable()&&this.camera.update(e),this.renderer&&this.renderer.update(e),this.onAfterUpdate.trigger())}dispose(e=!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"}),e){const e=this.components.get(zt);this.scene.dispose(),this.camera.isDisposeable()&&this.camera.dispose(),this.renderer&&this.renderer.dispose();for(const t of this.meshes)e.destroy(t);this.meshes.clear()}this._scene=null,this._camera=null,this._renderer=null;this.components.get(Js).list.delete(this.uuid),this.onDisposed.trigger(),this.onDisposed.reset()}}class Zi{constructor(e,i,s,n){t(this,"_component"),t(this,"name"),t(this,"uuid"),this._component=e,this.name=s,this.uuid=n??Ii.create();i.get($i).list.set(this.uuid,this)}get controls(){return Xt.copySchema(this._config)}set(e){for(const t in e)if(t in this){this[t]=e[t].value}}export(e=this._config,t={}){for(const i in e){const s=e[i];if(Xt.isEntry(s))if("Color"===s.type){const{r:e,g:n,b:r}=s.value;t[i]={...s,value:{r:e,g:n,b:r}}}else if("Vector3"===s.type){const{x:e,y:n,z:r}=s.value;t[i]={...s,value:{x:e,y:n,z:r}}}else if("TextSet"===s.type){const e=Array.from(s.value);t[i]={...s,value:e}}else if("Select"===s.type){const e=Array.from(s.options);t[i]={...s,options:e}}else t[i]={...s};else t[i]={},this.export(s,t[i])}return t}import(e,t={},i=!0){for(const i in e){const s=e[i];if(Xt.isEntry(s))if("Color"===s.type){const{r:e,g:n,b:r}=s.value;t[i]={...s,value:new o.Color(e,n,r)}}else if("Vector3"===s.type){const{x:e,y:n,z:r}=s.value;t[i]={...s,value:new o.Vector3(e,n,r)}}else"TextSet"===s.type?t[i]={...s,value:new Set(s.value)}:"Select"===s.type?t[i]={...s,options:new Set(s.options)}:t[i]={...s};else t[i]={},this.import(s,t[i],!1)}i&&this.set(t)}}const ji=class e extends Ut{constructor(i){super(i),t(this,"list",new Wt),t(this,"enabled",!0),i.add(e.uuid,this)}};t(ji,"uuid","b8c764e0-6b24-4e77-9a32-35fa728ee5b4");let $i=ji;class Qi{constructor(e,i){t(this,"_list"),t(this,"_scene"),this._list=e,this._scene=i}get color(){return this._list.directionalLight.color.value}set color(e){this._list.directionalLight.color.value=e;for(const[,t]of this._scene.directionalLights)t.color.copy(e)}get intensity(){return this._list.directionalLight.intensity.value}set intensity(e){this._list.directionalLight.intensity.value=e;for(const[,t]of this._scene.directionalLights)t.intensity=e}get position(){return this._list.directionalLight.position.value.clone()}set position(e){this._list.directionalLight.position.value=e;for(const[,t]of this._scene.directionalLights)t.position.copy(e)}}class qi{constructor(e,i){t(this,"_list"),t(this,"_scene"),this._list=e,this._scene=i}get color(){return this._list.ambientLight.color.value}set color(e){this._list.ambientLight.color.value=e;for(const[,t]of this._scene.ambientLights)t.color.copy(e)}get intensity(){return this._list.ambientLight.intensity.value}set intensity(e){this._list.ambientLight.intensity.value=e;for(const[,t]of this._scene.ambientLights)t.intensity=e}}class Ki extends Zi{constructor(){super(...arguments),t(this,"_config",{backgroundColor:{value:new o.Color,type:"Color"},ambientLight:{color:{type:"Color",value:new o.Color},intensity:{type:"Number",interpolable:!0,min:0,max:10,value:2}},directionalLight:{color:{type:"Color",value:new o.Color},intensity:{type:"Number",interpolable:!0,min:0,max:10,value:2},position:{type:"Vector3",value:new o.Vector3}}}),t(this,"ambientLight",new qi(this._config,this._component)),t(this,"directionalLight",new Qi(this._config,this._component))}get backgroundColor(){return this._config.backgroundColor.value}set backgroundColor(e){this._config.backgroundColor.value=e,this._component.three.background=e}}class Ji extends kt{constructor(e){super(e),t(this,"onSetup",new Dt),t(this,"isSetup",!1),t(this,"three"),t(this,"config",new Ki(this,this.components,"Scene")),t(this,"_defaultConfig",{backgroundColor:new o.Color(2107698),directionalLight:{color:new o.Color("white"),intensity:1.5,position:new o.Vector3(5,10,3)},ambientLight:{color:new o.Color("white"),intensity:1}}),this.three=new o.Scene,this.three.background=new o.Color(2107698)}setup(e){const t={...this._defaultConfig,...e};this.config.backgroundColor=t.backgroundColor;const i=t.ambientLight;this.config.ambientLight.color=i.color,this.config.ambientLight.intensity=i.intensity;const s=t.directionalLight;this.config.directionalLight.color=s.color,this.config.directionalLight.intensity=s.intensity,this.config.directionalLight.position=s.position,this.deleteAllLights();const{color:n,intensity:r}=this.config.directionalLight,a=new o.DirectionalLight(n,r);a.position.copy(s.position);const{color:c,intensity:l}=this.config.directionalLight,h=new o.AmbientLight(c,l);this.three.add(a,h),this.directionalLights.set(a.uuid,a),this.ambientLights.set(h.uuid,h),this.isSetup=!0,this.onSetup.trigger()}dispose(){super.dispose();this.components.get($i).list.delete(this.config.uuid)}}
2
2
  /*!
3
3
  * camera-controls
4
4
  * https://github.com/yomotsu/camera-controls
5
5
  * (c) 2017 @yomotsu
6
6
  * Released under the MIT License.
7
7
  */
8
- const Fi=1,Si=2,Oi=4,Ni=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}),yi=0,Li=1,_i=-1;function Pi(e){return e.isPerspectiveCamera}function wi(e){return e.isOrthographicCamera}const Mi=2*Math.PI,vi=Math.PI/2,Di=Math.PI/180;function bi(e,t,i){return Math.max(t,Math.min(i,e))}function Ui(e,t=1e-5){return Math.abs(e)<t}function xi(e,t,i=1e-5){return Ui(e-t,i)}function Bi(e,t){return Math.round(e/t)*t}function Vi(e){return isFinite(e)?e:e<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Yi(e){return Math.abs(e)<Number.MAX_VALUE?e:e*(1/0)}function Gi(e,t,i,s,n=1/0,r){const o=2/(s=Math.max(1e-4,s)),a=o*r,c=1/(1+a+.48*a*a+.235*a*a*a);let l=e-t;const h=t,u=n*s;l=bi(l,-u,u),t=e-l;const I=(i.value+o*l)*r;i.value=(i.value-o*I)*c;let d=t+(l+I)*c;return h-e>0==d>h&&(d=h,i.value=(d-h)/r),d}function zi(e,t,i,s,n=1/0,r,o){const a=2/(s=Math.max(1e-4,s)),c=a*r,l=1/(1+c+.48*c*c+.235*c*c*c);let h=t.x,u=t.y,I=t.z,d=e.x-h,E=e.y-u,f=e.z-I;const p=h,C=u,T=I,m=n*s,R=d*d+E*E+f*f;if(R>m*m){const e=Math.sqrt(R);d=d/e*m,E=E/e*m,f=f/e*m}h=e.x-d,u=e.y-E,I=e.z-f;const g=(i.x+a*d)*r,A=(i.y+a*E)*r,F=(i.z+a*f)*r;i.x=(i.x-a*g)*l,i.y=(i.y-a*A)*l,i.z=(i.z-a*F)*l,o.x=h+(d+g)*l,o.y=u+(E+A)*l,o.z=I+(f+F)*l;const S=p-e.x,O=C-e.y,N=T-e.z;return S*(o.x-p)+O*(o.y-C)+N*(o.z-T)>0&&(o.x=p,o.y=C,o.z=T,i.x=(o.x-p)/r,i.y=(o.y-C)/r,i.z=(o.z-T)/r),o}function ki(e,t){t.set(0,0),e.forEach((e=>{t.x+=e.clientX,t.y+=e.clientY})),t.x/=e.length,t.y/=e.length}function Hi(e,t){return!!wi(e)&&(console.warn(`${t} is not supported in OrthographicCamera`),!0)}class Wi{constructor(){this._listeners={}}addEventListener(e,t){const i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)}removeEventListener(e,t){const i=this._listeners[e];if(void 0!==i){const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}removeAllEventListeners(e){e?Array.isArray(this._listeners[e])&&(this._listeners[e].length=0):this._listeners={}}dispatchEvent(e){const t=this._listeners[e.type];if(void 0!==t){e.target=this;const i=t.slice(0);for(let t=0,s=i.length;t<s;t++)i[t].call(this,e)}}}const Xi=1/8,ji="undefined"!=typeof window,Zi=ji&&/Mac/.test(navigator.platform),$i=!(ji&&"PointerEvent"in window);let Qi,qi,Ki,Ji,es,ts,is,ss,ns,rs,os,as,cs,ls,hs,us,Is,ds,Es,fs,ps,Cs,Ts;class ms extends Wi{static install(e){Qi=e.THREE,qi=Object.freeze(new Qi.Vector3(0,0,0)),Ki=Object.freeze(new Qi.Vector3(0,1,0)),Ji=Object.freeze(new Qi.Vector3(0,0,1)),es=new Qi.Vector2,ts=new Qi.Vector3,is=new Qi.Vector3,ss=new Qi.Vector3,ns=new Qi.Vector3,rs=new Qi.Vector3,os=new Qi.Vector3,as=new Qi.Vector3,cs=new Qi.Vector3,ls=new Qi.Vector3,hs=new Qi.Spherical,us=new Qi.Spherical,Is=new Qi.Box3,ds=new Qi.Box3,Es=new Qi.Sphere,fs=new Qi.Quaternion,ps=new Qi.Quaternion,Cs=new Qi.Matrix4,Ts=new Qi.Raycaster}static get ACTION(){return Ni}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=Ni.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=yi,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new Qi.Vector3,this._focalOffsetVelocity=new Qi.Vector3,this._zoomVelocity={value:0},this._truckInternal=(e,t,i)=>{let s,n;if(Pi(this._camera)){const i=ts.copy(this._camera.position).sub(this._target),r=this._camera.getEffectiveFOV()*Di,o=i.length()*Math.tan(.5*r);s=this.truckSpeed*e*o/this._elementRect.height,n=this.truckSpeed*t*o/this._elementRect.height}else{if(!wi(this._camera))return;{const i=this._camera;s=e*(i.right-i.left)/i.zoom/this._elementRect.width,n=t*(i.top-i.bottom)/i.zoom/this._elementRect.height}}this.verticalDragToForward?(i?this.setFocalOffset(this._focalOffsetEnd.x+s,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(s,0,!0),this.forward(-n,!0)):i?this.setFocalOffset(this._focalOffsetEnd.x+s,this._focalOffsetEnd.y+n,this._focalOffsetEnd.z,!0):this.truck(s,n,!0)},this._rotateInternal=(e,t)=>{const i=Mi*this.azimuthRotateSpeed*e/this._elementRect.height,s=Mi*this.polarRotateSpeed*t/this._elementRect.height;this.rotate(i,s,!0)},this._dollyInternal=(e,t,i)=>{const s=Math.pow(.95,-e*this.dollySpeed),n=this._sphericalEnd.radius,r=this._sphericalEnd.radius*s,o=bi(r,this.minDistance,this.maxDistance),a=o-r;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(r,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(a,!0),this._dollyToNoClamp(o,!0)):this._dollyToNoClamp(o,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?r:o)-n,this._dollyControlCoord.set(t,i)),this._lastDollyDirection=Math.sign(-e)},this._zoomInternal=(e,t,i)=>{const s=Math.pow(.95,e*this.dollySpeed),n=this._zoom,r=this._zoom*s;this.zoomTo(r,!0),this.dollyToCursor&&(this._changedZoom+=r-n,this._dollyControlCoord.set(t,i))},void 0===Qi&&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 Qi.Quaternion).setFromUnitVectors(this._camera.up,Ki),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=Ni.NONE,this._target=new Qi.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new Qi.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=(new Qi.Spherical).setFromVector3(ts.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 Qi.Vector3,new Qi.Vector3,new Qi.Vector3,new Qi.Vector3],this._updateNearPlaneCorners(),this._boundary=new Qi.Box3(new Qi.Vector3(-1/0,-1/0,-1/0),new Qi.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 Qi.Vector2,this.mouseButtons={left:Ni.ROTATE,middle:Ni.DOLLY,right:Ni.TRUCK,wheel:Pi(this._camera)?Ni.DOLLY:wi(this._camera)?Ni.ZOOM:Ni.NONE},this.touches={one:Ni.TOUCH_ROTATE,two:Pi(this._camera)?Ni.TOUCH_DOLLY_TRUCK:wi(this._camera)?Ni.TOUCH_ZOOM_TRUCK:Ni.NONE,three:Ni.TOUCH_TRUCK};const i=new Qi.Vector2,s=new Qi.Vector2,n=new Qi.Vector2,r=e=>{if(!this._enabled||!this._domElement)return;if(0!==this._interactiveArea.left||0!==this._interactiveArea.top||1!==this._interactiveArea.width||1!==this._interactiveArea.height){const t=this._domElement.getBoundingClientRect(),i=e.clientX/t.width,s=e.clientY/t.height;if(i<this._interactiveArea.left||i>this._interactiveArea.right||s<this._interactiveArea.top||s>this._interactiveArea.bottom)return}const t="mouse"!==e.pointerType?null:(e.buttons&Fi)===Fi?Fi:(e.buttons&Oi)===Oi?Oi:(e.buttons&Si)===Si?Si:null;if(null!==t){const e=this._findPointerByMouseButton(t);e&&this._disposePointer(e)}if((e.buttons&Fi)===Fi&&this._lockedPointer)return;const i={pointerId:e.pointerId,clientX:e.clientX,clientY:e.clientY,deltaX:0,deltaY:0,mouseButton:t};this._activePointers.push(i),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),this._isDragging=!0,E(e)},o=e=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(0!==this._interactiveArea.left||0!==this._interactiveArea.top||1!==this._interactiveArea.width||1!==this._interactiveArea.height){const t=this._domElement.getBoundingClientRect(),i=e.clientX/t.width,s=e.clientY/t.height;if(i<this._interactiveArea.left||i>this._interactiveArea.right||s<this._interactiveArea.top||s>this._interactiveArea.bottom)return}const t=(e.buttons&Fi)===Fi?Fi:(e.buttons&Oi)===Oi?Oi:(e.buttons&Si)===Si?Si:null;if(null!==t){const e=this._findPointerByMouseButton(t);e&&this._disposePointer(e)}const i={pointerId:1,clientX:e.clientX,clientY:e.clientY,deltaX:0,deltaY:0,mouseButton:(e.buttons&Fi)===Fi?Fi:(e.buttons&Oi)===Fi?Oi:(e.buttons&Si)===Fi?Si:null};this._activePointers.push(i),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",h),this._domElement.ownerDocument.addEventListener("mousemove",c),this._domElement.ownerDocument.addEventListener("mouseup",h),this._isDragging=!0,E(e)},a=e=>{e.cancelable&&e.preventDefault();const t=e.pointerId,i=this._lockedPointer||this._findPointerById(t);if(i){if(i.clientX=e.clientX,i.clientY=e.clientY,i.deltaX=e.movementX,i.deltaY=e.movementY,this._state=0,"touch"===e.pointerType)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}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(e.buttons&Fi)===Fi)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(e.buttons&Oi)===Oi&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(e.buttons&Si)===Si&&(this._state=this._state|this.mouseButtons.right);f()}},c=e=>{const t=this._lockedPointer||this._findPointerById(1);t&&(t.clientX=e.clientX,t.clientY=e.clientY,t.deltaX=e.movementX,t.deltaY=e.movementY,this._state=0,(this._lockedPointer||(e.buttons&Fi)===Fi)&&(this._state=this._state|this.mouseButtons.left),(e.buttons&Oi)===Oi&&(this._state=this._state|this.mouseButtons.middle),(e.buttons&Si)===Si&&(this._state=this._state|this.mouseButtons.right),f())},l=e=>{const t=this._findPointerById(e.pointerId);if(!t||t!==this._lockedPointer){if(t&&this._disposePointer(t),"touch"===e.pointerType)switch(this._activePointers.length){case 0:this._state=Ni.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}else this._state=Ni.NONE;p()}},h=()=>{const e=this._findPointerById(1);e&&e===this._lockedPointer||(e&&this._disposePointer(e),this._state=Ni.NONE,p())};let u=-1;const I=e=>{if(!this._domElement)return;if(!this._enabled||this.mouseButtons.wheel===Ni.NONE)return;if(0!==this._interactiveArea.left||0!==this._interactiveArea.top||1!==this._interactiveArea.width||1!==this._interactiveArea.height){const t=this._domElement.getBoundingClientRect(),i=e.clientX/t.width,s=e.clientY/t.height;if(i<this._interactiveArea.left||i>this._interactiveArea.right||s<this._interactiveArea.top||s>this._interactiveArea.bottom)return}if(e.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===Ni.ROTATE||this.mouseButtons.wheel===Ni.TRUCK){const e=performance.now();u-e<1e3&&this._getClientRect(this._elementRect),u=e}const t=Zi?-1:-3,i=1===e.deltaMode?e.deltaY/t:e.deltaY/(10*t),s=this.dollyToCursor?(e.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,n=this.dollyToCursor?(e.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case Ni.ROTATE:this._rotateInternal(e.deltaX,e.deltaY),this._isUserControllingRotate=!0;break;case Ni.TRUCK:this._truckInternal(e.deltaX,e.deltaY,!1),this._isUserControllingTruck=!0;break;case Ni.OFFSET:this._truckInternal(e.deltaX,e.deltaY,!0),this._isUserControllingOffset=!0;break;case Ni.DOLLY:this._dollyInternal(-i,s,n),this._isUserControllingDolly=!0;break;case Ni.ZOOM:this._zoomInternal(-i,s,n),this._isUserControllingZoom=!0}this.dispatchEvent({type:"control"})},d=e=>{if(this._domElement&&this._enabled){if(this.mouseButtons.right===ms.ACTION.NONE){const t=e instanceof PointerEvent?e.pointerId:(MouseEvent,0),i=this._findPointerById(t);return i&&this._disposePointer(i),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.removeEventListener("mousemove",c),void this._domElement.ownerDocument.removeEventListener("mouseup",h)}e.preventDefault()}},E=e=>{if(!this._enabled)return;ki(this._activePointers,es),this._getClientRect(this._elementRect),i.copy(es),s.copy(es);if(this._activePointers.length>=2){const e=es.x-this._activePointers[1].clientX,t=es.y-this._activePointers[1].clientY,i=Math.sqrt(e*e+t*t);n.set(0,i);const r=.5*(this._activePointers[0].clientX+this._activePointers[1].clientX),o=.5*(this._activePointers[0].clientY+this._activePointers[1].clientY);s.set(r,o)}if(this._state=0,e)if("pointerType"in e&&"touch"===e.pointerType)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}else this._lockedPointer||(e.buttons&Fi)!==Fi||(this._state=this._state|this.mouseButtons.left),(e.buttons&Oi)===Oi&&(this._state=this._state|this.mouseButtons.middle),(e.buttons&Si)===Si&&(this._state=this._state|this.mouseButtons.right);else this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);(this._state&Ni.ROTATE)!==Ni.ROTATE&&(this._state&Ni.TOUCH_ROTATE)!==Ni.TOUCH_ROTATE&&(this._state&Ni.TOUCH_DOLLY_ROTATE)!==Ni.TOUCH_DOLLY_ROTATE&&(this._state&Ni.TOUCH_ZOOM_ROTATE)!==Ni.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&Ni.TRUCK)!==Ni.TRUCK&&(this._state&Ni.TOUCH_TRUCK)!==Ni.TOUCH_TRUCK&&(this._state&Ni.TOUCH_DOLLY_TRUCK)!==Ni.TOUCH_DOLLY_TRUCK&&(this._state&Ni.TOUCH_ZOOM_TRUCK)!==Ni.TOUCH_ZOOM_TRUCK||(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),(this._state&Ni.DOLLY)!==Ni.DOLLY&&(this._state&Ni.TOUCH_DOLLY)!==Ni.TOUCH_DOLLY&&(this._state&Ni.TOUCH_DOLLY_TRUCK)!==Ni.TOUCH_DOLLY_TRUCK&&(this._state&Ni.TOUCH_DOLLY_OFFSET)!==Ni.TOUCH_DOLLY_OFFSET&&(this._state&Ni.TOUCH_DOLLY_ROTATE)!==Ni.TOUCH_DOLLY_ROTATE||(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),(this._state&Ni.ZOOM)!==Ni.ZOOM&&(this._state&Ni.TOUCH_ZOOM)!==Ni.TOUCH_ZOOM&&(this._state&Ni.TOUCH_ZOOM_TRUCK)!==Ni.TOUCH_ZOOM_TRUCK&&(this._state&Ni.TOUCH_ZOOM_OFFSET)!==Ni.TOUCH_ZOOM_OFFSET&&(this._state&Ni.TOUCH_ZOOM_ROTATE)!==Ni.TOUCH_ZOOM_ROTATE||(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),(this._state&Ni.OFFSET)!==Ni.OFFSET&&(this._state&Ni.TOUCH_OFFSET)!==Ni.TOUCH_OFFSET&&(this._state&Ni.TOUCH_DOLLY_OFFSET)!==Ni.TOUCH_DOLLY_OFFSET&&(this._state&Ni.TOUCH_ZOOM_OFFSET)!==Ni.TOUCH_ZOOM_OFFSET||(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},f=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,ki(this._activePointers,es);const e=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,t=e?-e.deltaX:s.x-es.x,r=e?-e.deltaY:s.y-es.y;if(s.copy(es),(this._state&Ni.ROTATE)!==Ni.ROTATE&&(this._state&Ni.TOUCH_ROTATE)!==Ni.TOUCH_ROTATE&&(this._state&Ni.TOUCH_DOLLY_ROTATE)!==Ni.TOUCH_DOLLY_ROTATE&&(this._state&Ni.TOUCH_ZOOM_ROTATE)!==Ni.TOUCH_ZOOM_ROTATE||(this._rotateInternal(t,r),this._isUserControllingRotate=!0),(this._state&Ni.DOLLY)===Ni.DOLLY||(this._state&Ni.ZOOM)===Ni.ZOOM){const e=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,t=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0,s=this.dollyDragInverted?-1:1;(this._state&Ni.DOLLY)===Ni.DOLLY?(this._dollyInternal(s*r*Xi,e,t),this._isUserControllingDolly=!0):(this._zoomInternal(s*r*Xi,e,t),this._isUserControllingZoom=!0)}if((this._state&Ni.TOUCH_DOLLY)===Ni.TOUCH_DOLLY||(this._state&Ni.TOUCH_ZOOM)===Ni.TOUCH_ZOOM||(this._state&Ni.TOUCH_DOLLY_TRUCK)===Ni.TOUCH_DOLLY_TRUCK||(this._state&Ni.TOUCH_ZOOM_TRUCK)===Ni.TOUCH_ZOOM_TRUCK||(this._state&Ni.TOUCH_DOLLY_OFFSET)===Ni.TOUCH_DOLLY_OFFSET||(this._state&Ni.TOUCH_ZOOM_OFFSET)===Ni.TOUCH_ZOOM_OFFSET||(this._state&Ni.TOUCH_DOLLY_ROTATE)===Ni.TOUCH_DOLLY_ROTATE||(this._state&Ni.TOUCH_ZOOM_ROTATE)===Ni.TOUCH_ZOOM_ROTATE){const e=es.x-this._activePointers[1].clientX,t=es.y-this._activePointers[1].clientY,i=Math.sqrt(e*e+t*t),r=n.y-i;n.set(0,i);const o=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,a=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&Ni.TOUCH_DOLLY)===Ni.TOUCH_DOLLY||(this._state&Ni.TOUCH_DOLLY_ROTATE)===Ni.TOUCH_DOLLY_ROTATE||(this._state&Ni.TOUCH_DOLLY_TRUCK)===Ni.TOUCH_DOLLY_TRUCK||(this._state&Ni.TOUCH_DOLLY_OFFSET)===Ni.TOUCH_DOLLY_OFFSET?(this._dollyInternal(r*Xi,o,a),this._isUserControllingDolly=!0):(this._zoomInternal(r*Xi,o,a),this._isUserControllingZoom=!0)}(this._state&Ni.TRUCK)!==Ni.TRUCK&&(this._state&Ni.TOUCH_TRUCK)!==Ni.TOUCH_TRUCK&&(this._state&Ni.TOUCH_DOLLY_TRUCK)!==Ni.TOUCH_DOLLY_TRUCK&&(this._state&Ni.TOUCH_ZOOM_TRUCK)!==Ni.TOUCH_ZOOM_TRUCK||(this._truckInternal(t,r,!1),this._isUserControllingTruck=!0),(this._state&Ni.OFFSET)!==Ni.OFFSET&&(this._state&Ni.TOUCH_OFFSET)!==Ni.TOUCH_OFFSET&&(this._state&Ni.TOUCH_DOLLY_OFFSET)!==Ni.TOUCH_DOLLY_OFFSET&&(this._state&Ni.TOUCH_ZOOM_OFFSET)!==Ni.TOUCH_ZOOM_OFFSET||(this._truckInternal(t,r,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},p=()=>{ki(this._activePointers,es),s.copy(es),this._dragNeedsUpdate=!1,(0===this._activePointers.length||1===this._activePointers.length&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),0===this._activePointers.length&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.removeEventListener("mouseup",h),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{this._enabled&&this._domElement&&(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",C),this._domElement.ownerDocument.addEventListener("pointerlockerror",T),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),E())},this.unlockPointer=()=>{null!==this._lockedPointer&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",C),this._domElement.ownerDocument.removeEventListener("pointerlockerror",T))};const C=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},T=()=>{this.unlockPointer()};this._addAllEventListeners=e=>{this._domElement=e,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",r),$i&&this._domElement.addEventListener("mousedown",o),this._domElement.addEventListener("pointercancel",l),this._domElement.addEventListener("wheel",I,{passive:!1}),this._domElement.addEventListener("contextmenu",d)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",r),this._domElement.removeEventListener("mousedown",o),this._domElement.removeEventListener("pointercancel",l),this._domElement.removeEventListener("wheel",I,{passive:!1}),this._domElement.removeEventListener("contextmenu",d),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.removeEventListener("mouseup",h),this._domElement.ownerDocument.removeEventListener("pointerlockchange",C),this._domElement.ownerDocument.removeEventListener("pointerlockerror",T))},this.cancel=()=>{this._state!==Ni.NONE&&(this._state=Ni.NONE,this._activePointers.length=0,p())},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=bi(e.width,0,1),this._interactiveArea.height=bi(e.height,0,1),this._interactiveArea.x=bi(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=bi(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=bi(e,this.minAzimuthAngle,this.maxAzimuthAngle),n=bi(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 r=!i||xi(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&xi(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(r)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=yi,this._changedDolly=0,this._dollyToNoClamp(bi(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const i=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const t=this._collisionTest(),s=xi(t,this._spherical.radius);if(!(i>e)&&s)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,t)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const s=!t||xi(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(s)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(ns).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const i=!t||xi(this._target.x,this._targetEnd.x,this.restThreshold)&&xi(this._target.y,this._targetEnd.y,this.restThreshold)&&xi(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=bi(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const i=!t||xi(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(),rs.setFromMatrixColumn(this._camera.matrix,0),os.setFromMatrixColumn(this._camera.matrix,1),rs.multiplyScalar(e),os.multiplyScalar(-t);const s=ts.copy(rs).add(os),n=is.copy(this._targetEnd).add(s);return this.moveTo(n.x,n.y,n.z,i)}forward(e,t=!1){ts.setFromMatrixColumn(this._camera.matrix,0),ts.crossVectors(this._camera.up,ts),ts.multiplyScalar(e);const i=is.copy(this._targetEnd).add(ts);return this.moveTo(i.x,i.y,i.z,t)}elevate(e,t=!1){return ts.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+ts.x,this._targetEnd.y+ts.y,this._targetEnd.z+ts.z,t)}moveTo(e,t,i,s=!1){this._isUserControllingTruck=!1;const n=ts.set(e,t,i).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,n,this.boundaryFriction),this._needsUpdate=!0,s||this._target.copy(this._targetEnd);const r=!s||xi(this._target.x,this._targetEnd.x,this.restThreshold)&&xi(this._target.y,this._targetEnd.y,this.restThreshold)&&xi(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}lookInDirectionOf(e,t,i,s=!1){const n=ts.set(e,t,i).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(n.x,n.y,n.z,s)}fitToBox(e,t,{cover:i=!1,paddingLeft:s=0,paddingRight:n=0,paddingBottom:r=0,paddingTop:o=0}={}){const a=[],c=e.isBox3?Is.copy(e):Is.setFromObject(e);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const l=Bi(this._sphericalEnd.theta,vi),h=Bi(this._sphericalEnd.phi,vi);a.push(this.rotateTo(l,h,t));const u=ts.setFromSpherical(this._sphericalEnd).normalize(),I=fs.setFromUnitVectors(u,Ji),d=xi(Math.abs(u.y),1);d&&I.multiply(ps.setFromAxisAngle(Ki,l)),I.multiply(this._yAxisUpSpaceInverse);const E=ds.makeEmpty();is.copy(c.min).applyQuaternion(I),E.expandByPoint(is),is.copy(c.min).setX(c.max.x).applyQuaternion(I),E.expandByPoint(is),is.copy(c.min).setY(c.max.y).applyQuaternion(I),E.expandByPoint(is),is.copy(c.max).setZ(c.min.z).applyQuaternion(I),E.expandByPoint(is),is.copy(c.min).setZ(c.max.z).applyQuaternion(I),E.expandByPoint(is),is.copy(c.max).setY(c.min.y).applyQuaternion(I),E.expandByPoint(is),is.copy(c.max).setX(c.min.x).applyQuaternion(I),E.expandByPoint(is),is.copy(c.max).applyQuaternion(I),E.expandByPoint(is),E.min.x-=s,E.min.y-=r,E.max.x+=n,E.max.y+=o,I.setFromUnitVectors(Ji,u),d&&I.premultiply(ps.invert()),I.premultiply(this._yAxisUpSpace);const f=E.getSize(ts),p=E.getCenter(is).applyQuaternion(I);if(Pi(this._camera)){const e=this.getDistanceToFitBox(f.x,f.y,f.z,i);a.push(this.moveTo(p.x,p.y,p.z,t)),a.push(this.dollyTo(e,t)),a.push(this.setFocalOffset(0,0,0,t))}else if(wi(this._camera)){const e=this._camera,s=e.right-e.left,n=e.top-e.bottom,r=i?Math.max(s/f.x,n/f.y):Math.min(s/f.x,n/f.y);a.push(this.moveTo(p.x,p.y,p.z,t)),a.push(this.zoomTo(r,t)),a.push(this.setFocalOffset(0,0,0,t))}return Promise.all(a)}fitToSphere(e,t){const i=[],s=e instanceof Qi.Sphere?Es.copy(e):ms.createBoundingSphere(e,Es);if(i.push(this.moveTo(s.center.x,s.center.y,s.center.z,t)),Pi(this._camera)){const e=this.getDistanceToFitSphere(s.radius);i.push(this.dollyTo(e,t))}else if(wi(this._camera)){const e=this._camera.right-this._camera.left,n=this._camera.top-this._camera.bottom,r=2*s.radius,o=Math.min(e/r,n/r);i.push(this.zoomTo(o,t))}return i.push(this.setFocalOffset(0,0,0,t)),Promise.all(i)}setLookAt(e,t,i,s,n,r,o=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=yi,this._changedDolly=0;const a=is.set(s,n,r),c=ts.set(e,t,i);this._targetEnd.copy(a),this._sphericalEnd.setFromVector3(c.sub(a).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,o||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const l=!o||xi(this._target.x,this._targetEnd.x,this.restThreshold)&&xi(this._target.y,this._targetEnd.y,this.restThreshold)&&xi(this._target.z,this._targetEnd.z,this.restThreshold)&&xi(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&xi(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&xi(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(l)}lerpLookAt(e,t,i,s,n,r,o,a,c,l,h,u,I,d=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=yi,this._changedDolly=0;const E=ts.set(s,n,r),f=is.set(e,t,i);hs.setFromVector3(f.sub(E).applyQuaternion(this._yAxisUpSpace));const p=ss.set(l,h,u),C=is.set(o,a,c);us.setFromVector3(C.sub(p).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(E.lerp(p,I));const T=us.theta-hs.theta,m=us.phi-hs.phi,R=us.radius-hs.radius;this._sphericalEnd.set(hs.radius+R*I,hs.phi+m*I,hs.theta+T*I),this.normalizeRotations(),this._needsUpdate=!0,d||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const g=!d||xi(this._target.x,this._targetEnd.x,this.restThreshold)&&xi(this._target.y,this._targetEnd.y,this.restThreshold)&&xi(this._target.z,this._targetEnd.z,this.restThreshold)&&xi(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&xi(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&xi(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(g)}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(ts),r=this.setLookAt(n.x,n.y,n.z,e,t,i,s);return this._sphericalEnd.phi=bi(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),r}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||xi(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&xi(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&xi(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}setOrbitPoint(e,t,i){this._camera.updateMatrixWorld(),rs.setFromMatrixColumn(this._camera.matrixWorldInverse,0),os.setFromMatrixColumn(this._camera.matrixWorldInverse,1),as.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const s=ts.set(e,t,i),n=s.distanceTo(this._camera.position),r=s.sub(this._camera.position);rs.multiplyScalar(r.x),os.multiplyScalar(r.y),as.multiplyScalar(r.z),ts.copy(rs).add(os).add(as),ts.z=ts.z+n,this.dollyTo(n,!1),this.setFocalOffset(-ts.x,ts.y,-ts.z,!1),this.moveTo(e,t,i,!1)}setBoundary(e){if(!e)return this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),void(this._needsUpdate=!0);this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,i,s){null!==e?(this._viewport=this._viewport||new Qi.Vector4,"number"==typeof e?this._viewport.set(e,t,i,s):this._viewport.copy(e)):this._viewport=null}getDistanceToFitBox(e,t,i,s=!1){if(Hi(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const n=e/t,r=this._camera.getEffectiveFOV()*Di,o=this._camera.aspect;return.5*((s?n>o:n<o)?t:e/o)/Math.tan(.5*r)+.5*i}getDistanceToFitSphere(e){if(Hi(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*Di,i=2*Math.atan(Math.tan(.5*t)*this._camera.aspect),s=1<this._camera.aspect?t:i;return e/Math.sin(.5*s)}getTarget(e,t=!0){return(e&&e.isVector3?e:new Qi.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new Qi.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e&&e instanceof Qi.Spherical?e:new Qi.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new Qi.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%Mi,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=Mi),this._spherical.theta+=Mi*Math.round((this._sphericalEnd.theta-this._spherical.theta)/Mi)}reset(e=!1){if(!xi(this._camera.up.x,this._cameraUp0.x)||!xi(this._camera.up.y,this._cameraUp0.y)||!xi(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const e=this.getPosition(ts);this.updateCameraUp(),this.setPosition(e.x,e.y,e.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,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,Ki),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=ts.subVectors(this._target,this._camera.position).normalize(),t=is.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const i=this.getPosition(ts);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=cs.subVectors(this._targetEnd,this._target),r=ls.subVectors(this._focalOffsetEnd,this._focalOffset),o=this._zoomEnd-this._zoom;if(Ui(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const t=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Gi(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,t,1/0,e),this._needsUpdate=!0}if(Ui(i))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const t=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Gi(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,t,1/0,e),this._needsUpdate=!0}if(Ui(s))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const t=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Gi(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,t,this.maxSpeed,e),this._needsUpdate=!0}if(Ui(n.x)&&Ui(n.y)&&Ui(n.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const t=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;zi(this._target,this._targetEnd,this._targetVelocity,t,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(Ui(r.x)&&Ui(r.y)&&Ui(r.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const t=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;zi(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,t,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(Ui(o))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const t=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Gi(this._zoom,this._zoomEnd,this._zoomVelocity,t,1/0,e)}if(this.dollyToCursor)if(Pi(this._camera)&&0!==this._changedDolly){const e=this._spherical.radius-this._lastDistance,t=this._camera,i=this._getCameraDirection(ns),s=ts.copy(i).cross(t.up).normalize();0===s.lengthSq()&&(s.x=1);const n=is.crossVectors(s,i),r=this._sphericalEnd.radius*Math.tan(t.getEffectiveFOV()*Di*.5),o=(this._sphericalEnd.radius-e-this._sphericalEnd.radius)/this._sphericalEnd.radius,a=ss.copy(this._targetEnd).add(s.multiplyScalar(this._dollyControlCoord.x*r*t.aspect)).add(n.multiplyScalar(this._dollyControlCoord.y*r)),c=ts.copy(this._targetEnd).lerp(a,o),l=this._lastDollyDirection===Li&&this._spherical.radius<=this.minDistance,h=this._lastDollyDirection===_i&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(l||h)){this._sphericalEnd.radius-=e,this._spherical.radius-=e;const t=is.copy(i).multiplyScalar(-e);c.add(t)}this._boundary.clampPoint(c,c);const u=is.subVectors(c,this._targetEnd);this._targetEnd.copy(c),this._target.add(u),this._changedDolly-=e,Ui(this._changedDolly)&&(this._changedDolly=0)}else if(wi(this._camera)&&0!==this._changedZoom){const e=this._zoom-this._lastZoom,t=this._camera,i=ts.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(t.near+t.far)/(t.near-t.far)).unproject(t),s=is.set(0,0,-1).applyQuaternion(t.quaternion),n=ss.copy(i).add(s.multiplyScalar(-i.dot(t.up))),r=-(this._zoom-e-this._zoom)/this._zoom,o=this._getCameraDirection(ns),a=this._targetEnd.dot(o),c=ts.copy(this._targetEnd).lerp(n,r),l=c.dot(o),h=o.multiplyScalar(l-a);c.sub(h),this._boundary.clampPoint(c,c);const u=is.subVectors(c,this._targetEnd);this._targetEnd.copy(c),this._target.add(u),this._changedZoom-=e,Ui(this._changedZoom)&&(this._changedZoom=0)}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const a=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,a),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target);(!Ui(this._focalOffset.x)||!Ui(this._focalOffset.y)||!Ui(this._focalOffset.z))&&(this._camera.updateMatrixWorld(),rs.setFromMatrixColumn(this._camera.matrix,0),os.setFromMatrixColumn(this._camera.matrix,1),as.setFromMatrixColumn(this._camera.matrix,2),rs.multiplyScalar(this._focalOffset.x),os.multiplyScalar(-this._focalOffset.y),as.multiplyScalar(this._focalOffset.z),ts.copy(rs).add(os).add(as),this._camera.position.add(ts)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),ts.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const c=this._needsUpdate;return c&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):c?(this.dispatchEvent({type:"update"}),Ui(t,this.restThreshold)&&Ui(i,this.restThreshold)&&Ui(s,this.restThreshold)&&Ui(n.x,this.restThreshold)&&Ui(n.y,this.restThreshold)&&Ui(n.z,this.restThreshold)&&Ui(r.x,this.restThreshold)&&Ui(r.y,this.restThreshold)&&Ui(r.z,this.restThreshold)&&Ui(o,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!c&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=c,this._needsUpdate=!1,c}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:Vi(this.maxDistance),minZoom:this.minZoom,maxZoom:Vi(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:Vi(this.maxPolarAngle),minAzimuthAngle:Vi(this.minAzimuthAngle),maxAzimuthAngle:Vi(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:ts.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=Yi(i.maxDistance),this.minZoom=i.minZoom,this.maxZoom=Yi(i.maxZoom),this.minPolarAngle=i.minPolarAngle,this.maxPolarAngle=Yi(i.maxPolarAngle),this.minAzimuthAngle=Yi(i.minAzimuthAngle),this.maxAzimuthAngle=Yi(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),hs.setFromVector3(ts.fromArray(i.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(hs.theta,hs.phi,t),this.dollyTo(hs.radius,t),this.zoomTo(i.zoom,t),this.setFocalOffset(i.focalOffset[0],i.focalOffset[1],i.focalOffset[2],t),this._needsUpdate=!0}connect(e){this._domElement?console.warn("camera-controls is already connected."):(e.setAttribute("data-camera-controls-version","2.7.3"),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(0===s)return e;const n=is.copy(t).add(e),r=this._boundary.clampPoint(n,ss).sub(n),o=r.lengthSq();if(0===o)return e.add(t);if(o===s)return e;if(0===i)return e.add(t).add(r);{const s=1+i*o/t.dot(r);return e.add(is.copy(t).multiplyScalar(s)).add(r.multiplyScalar(1-i))}}_updateNearPlaneCorners(){if(Pi(this._camera)){const e=this._camera,t=e.near,i=e.getEffectiveFOV()*Di,s=Math.tan(.5*i)*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(wi(this._camera)){const e=this._camera,t=1/e.zoom,i=e.left*t,s=e.right*t,n=e.top*t,r=e.bottom*t;this._nearPlaneCorners[0].set(i,n,0),this._nearPlaneCorners[1].set(s,n,0),this._nearPlaneCorners[2].set(s,r,0),this._nearPlaneCorners[3].set(i,r,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1))return e;if(Hi(this._camera,"_collisionTest"))return e;const t=this._getTargetDirection(ns);Cs.lookAt(qi,t,this._camera.up);for(let i=0;i<4;i++){const s=is.copy(this._nearPlaneCorners[i]);s.applyMatrix4(Cs);const n=ss.addVectors(this._target,s);Ts.set(n,t),Ts.far=this._spherical.radius+1;const r=Ts.intersectObjects(this.colliderMeshes);0!==r.length&&r[0].distance<e&&(e=r[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((e=>{const t=()=>{this.removeEventListener("rest",t),e()};this.addEventListener("rest",t)})))}_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 Qi.Sphere){const i=t,s=i.center;Is.makeEmpty(),e.traverseVisible((e=>{e.isMesh&&Is.expandByObject(e)})),Is.getCenter(s);let n=0;return e.traverseVisible((e=>{if(!e.isMesh)return;const t=e,i=t.geometry.clone();i.applyMatrix4(t.matrixWorld);const r=i.attributes.position;for(let e=0,t=r.count;e<t;e++)ts.fromBufferAttribute(r,e),n=Math.max(n,s.distanceToSquared(ts))})),i.radius=Math.sqrt(n),i}}class Rs extends Vt{constructor(e){super(e),t(this,"onBeforeUpdate",new Dt),t(this,"onAfterUpdate",new Dt),t(this,"onAspectUpdated",new Dt),t(this,"onDisposed",new Dt),t(this,"three"),t(this,"_allControls",new Map),t(this,"updateAspect",(()=>{var e;if(this.currentWorld&&this.currentWorld.renderer)if(this.three instanceof o.OrthographicCamera)this.onAspectUpdated.trigger();else if(null==(e=this.currentWorld.renderer)?void 0:e.isResizeable()){const e=this.currentWorld.renderer.getSize();this.three.aspect=e.width/e.height,this.three.updateProjectionMatrix(),this.onAspectUpdated.trigger()}})),this.three=this.setupCamera(),this.setupEvents(!0),this.onWorldChanged.add((({action:e,world:t})=>{if("added"===e){const e=this.newCameraControls();this._allControls.set(t.uuid,e)}if("removed"===e){const e=this._allControls.get(t.uuid);e&&(e.dispose(),this._allControls.delete(t.uuid))}}))}get controls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");const e=this._allControls.get(this.currentWorld.uuid);if(!e)throw new Error("Controls not found!");return e}get enabled(){return null!==this.currentWorld&&this.controls.enabled}set enabled(e){null!==this.currentWorld&&(this.controls.enabled=e)}dispose(){this.setupEvents(!1),this.onAspectUpdated.reset(),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.three.removeFromParent(),this.onDisposed.trigger(),this.onDisposed.reset();for(const[e,t]of this._allControls)t.dispose()}update(e){this.enabled&&(this.onBeforeUpdate.trigger(this),this.controls.update(e),this.onAfterUpdate.trigger(this))}setupCamera(){const e=window.innerWidth/window.innerHeight,t=new o.PerspectiveCamera(60,e,1,1e3);return t.position.set(50,50,50),t.lookAt(new o.Vector3(0,0,0)),t}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!");ms.install({THREE:Rs.getSubsetOfThree()});const{domElement:e}=this.currentWorld.renderer.three,t=new ms(this.three,e);return t.smoothTime=.2,t.dollyToCursor=!0,t.infinityDolly=!0,t.minDistance=6,t}setupEvents(e){e?window.addEventListener("resize",this.updateAspect):window.removeEventListener("resize",this.updateAspect)}static getSubsetOfThree(){return{MOUSE:o.MOUSE,Vector2:o.Vector2,Vector3:o.Vector3,Vector4:o.Vector4,Quaternion:o.Quaternion,Matrix4:o.Matrix4,Spherical:o.Spherical,Box3:o.Box3,Sphere:o.Sphere,Raycaster:o.Raycaster,MathUtils:o.MathUtils}}}const gs=class e extends xt{constructor(i){super(i),t(this,"onAfterUpdate",new Dt),t(this,"onBeforeUpdate",new Dt),t(this,"onDisposed",new Dt),t(this,"list",new Wt),t(this,"enabled",!0),i.add(e.uuid,this)}create(){const e=new fi(this.components),t=e.uuid;if(this.list.has(t))throw new Error("There is already a world with this name!");return this.list.set(t,e),e}delete(e){if(!this.list.has(e.uuid))throw new Error("The provided world is not found in the list!");this.list.delete(e.uuid),e.dispose()}dispose(){this.enabled=!1;for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}update(e){if(this.enabled)for(const[t,i]of this.list)i.update(e)}};t(gs,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let As=gs;async function Fs(e,t,i,s,n,r,o){const a=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);e.flush(),await function(e,t,i,s){return new Promise(((n,r)=>{!function o(){const a=e.clientWaitSync(t,i,0);a!==e.WAIT_FAILED?a!==e.TIMEOUT_EXPIRED?n():setTimeout(o,s):r()}()}))}(e,a,0,10),e.deleteSync(a),e.bindBuffer(t,i),e.getBufferSubData(t,s,n,r,o),e.bindBuffer(t,null)}async function Ss(e,t,i,s,n,r,o,a){const c=e.createBuffer();return e.bindBuffer(e.PIXEL_PACK_BUFFER,c),e.bufferData(e.PIXEL_PACK_BUFFER,a.byteLength,e.STREAM_READ),e.readPixels(t,i,s,n,r,o,0),e.bindBuffer(e.PIXEL_PACK_BUFFER,null),await Fs(e,e.PIXEL_PACK_BUFFER,c,0,a),e.deleteBuffer(c),a}class Os extends pi{constructor(){super(...arguments),t(this,"_config",{enabled:{value:!0,type:"Boolean"},width:{type:"Number",interpolable:!0,value:512,min:32,max:1024},height:{type:"Number",interpolable:!0,value:512,min:32,max:1024},autoUpdate:{value:!0,type:"Boolean"},renderDebugFrame:{value:!1,type:"Boolean"},updateInterval:{type:"Number",interpolable:!0,value:1,min:0,max:1},threshold:{type:"Number",interpolable:!0,value:100,min:1,max:512}}),t(this,"_interval",null)}get enabled(){return this._config.enabled.value}set enabled(e){this._config.enabled.value=e,this._component.enabled=e}get width(){return this._config.width.value}set width(e){this.setWidthHeight(e,this.height)}get height(){return this._config.height.value}set height(e){this.setWidthHeight(this.width,e)}get autoUpdate(){return this._config.autoUpdate.value}set autoUpdate(e){this.setAutoAndInterval(e,this.updateInterval)}get updateInterval(){return this._config.updateInterval.value}set updateInterval(e){this.setAutoAndInterval(this.autoUpdate,e)}get renderDebugFrame(){return this._config.renderDebugFrame.value}set renderDebugFrame(e){this._config.renderDebugFrame.value=e}get threshold(){return this._config.threshold.value}set threshold(e){this._config.threshold.value=e}setWidthHeight(e,t){if(e<=0||t<=0)throw new Error("The width and height of the culler renderer must be more than 0!");this._config.width.value=e,this._config.height.value=t,this.resetRenderTarget()}setAutoAndInterval(e,t){if(t<=0)throw new Error("The updateInterval of the culler renderer must be more than 0!");this._config.autoUpdate.value=e,this._config.updateInterval.value=t,this.resetInterval(e)}resetRenderTarget(){this._component.renderTarget.dispose(),this._component.renderTarget=new o.WebGLRenderTarget(this.width,this.height),this._component.bufferSize=this.width*this.height*4,this._component.buffer=new Uint8Array(this._component.bufferSize)}resetInterval(e){null!==this._interval&&window.clearInterval(this._interval),e&&(this._interval=window.setInterval((async()=>{this._component.preventUpdate||await this._component.updateVisibility()}),this.updateInterval))}}class Ns{constructor(e,i){if(t(this,"onSetup",new Dt),t(this,"onDisposed",new Dt),t(this,"onViewUpdated",new bt),t(this,"enabled",!0),t(this,"needsUpdate",!1),t(this,"components"),t(this,"renderTarget",new o.WebGLRenderTarget),t(this,"bufferSize",1),t(this,"buffer",new Uint8Array),t(this,"preventUpdate",!1),t(this,"config"),t(this,"isSetup",!1),t(this,"world"),t(this,"renderer"),t(this,"_defaultConfig",{enabled:!0,height:512,width:512,updateInterval:1e3,autoUpdate:!0,renderDebugFrame:!1,threshold:100}),t(this,"worker"),t(this,"scene",new o.Scene),t(this,"_availableColor",1),t(this,"_isWorkerBusy",!1),t(this,"updateVisibility",(async e=>{if(!this.enabled)return;if(!this.needsUpdate&&!e)return;if(this._isWorkerBusy)return;this._isWorkerBusy=!0;const t=this.world.camera.three;t.updateMatrix();const{width:i,height:s}=this.config;this.renderer.setSize(i,s),this.renderer.setRenderTarget(this.renderTarget),this.renderer.render(this.scene,t);const n=this.renderer.getContext();await Ss(n,0,0,i,s,n.RGBA,n.UNSIGNED_BYTE,this.buffer),this.renderer.setRenderTarget(null),this.config.renderDebugFrame&&this.renderer.render(this.scene,t),this.worker.postMessage({buffer:this.buffer}),this.needsUpdate=!1})),!i.renderer)throw new Error("The given world must have a renderer!");this.components=e,this.config=new Os(this,this.components,"Culler renderer"),this.world=i,this.renderer=new o.WebGLRenderer,this.renderer.clippingPlanes=i.renderer.clippingPlanes;const s=new Blob(['\n addEventListener("message", (event) => {\n const { buffer } = event.data;\n const colors = new Map();\n for (let i = 0; i < buffer.length; i += 4) {\n const r = buffer[i];\n const g = buffer[i + 1];\n const b = buffer[i + 2];\n const code = "" + r + "-" + g + "-" + b;\n if(colors.has(code)) {\n colors.set(code, colors.get(code) + 1);\n } else {\n colors.set(code, 1);\n }\n }\n postMessage({ colors });\n });\n '],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(s)),this.setup()}dispose(){this.enabled=!1,this.config.autoUpdate=!1;this.components.get(Ti).list.delete(this.config.uuid);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()}setup(e){const t={...this._defaultConfig,...e},{width:i,height:s}=t;this.config.setWidthHeight(i,s);const{updateInterval:n,autoUpdate:r}=t;this.config.setAutoAndInterval(r,n),this.config.threshold=t.threshold,this.isSetup=!0,this.onSetup.trigger()}getAvailableColor(){let e=BigInt(this._availableColor.toString());const t=[];do{t.unshift(Number(e%256n)),e/=256n}while(e);for(;3!==t.length;)t.unshift(0);const[i,s,n]=t;return{r:i,g:s,b:n,code:`${i}-${s}-${n}`}}increaseColor(){16777216!==this._availableColor?this._availableColor++:console.warn("Color can't be increased over 256 x 256 x 256!")}decreaseColor(){1!==this._availableColor?this._availableColor--:console.warn("Color can't be decreased under 0!")}}class ys extends Ns{constructor(e,i){super(e,i),t(this,"onViewUpdated",new Dt),t(this,"colorMeshes",new Map),t(this,"_colorCodeMeshMap",new Map),t(this,"_meshIDColorCodeMap",new Map),t(this,"_currentVisibleMeshes",new Set),t(this,"_recentlyHiddenMeshes",new Set),t(this,"_transparentMat",new o.MeshBasicMaterial({transparent:!0,opacity:0})),t(this,"handleWorkerMessage",(async e=>{if(this.preventUpdate)return;const t=e.data.colors;this._recentlyHiddenMeshes=new Set(this._currentVisibleMeshes),this._currentVisibleMeshes.clear();for(const[e,i]of t){if(i<this.config.threshold)continue;const t=this._colorCodeMeshMap.get(e);t&&(this._currentVisibleMeshes.add(t),this._recentlyHiddenMeshes.delete(t))}this.onViewUpdated.trigger({seen:this._currentVisibleMeshes,unseen:this._recentlyHiddenMeshes}),this._isWorkerBusy=!1})),this.worker.addEventListener("message",this.handleWorkerMessage),this.onViewUpdated.add((({seen:e,unseen:t})=>{for(const t of e)t.visible=!0;for(const e of t)e.visible=!1}))}get threshold(){return this.config.threshold}set threshold(e){this.config.threshold=e}dispose(){super.dispose(),this._currentVisibleMeshes.clear(),this._recentlyHiddenMeshes.clear(),this._meshIDColorCodeMap.clear(),this._transparentMat.dispose(),this._colorCodeMeshMap.clear();const e=this.components.get(zt);for(const t in this.colorMeshes){const i=this.colorMeshes.get(t);i&&e.destroy(i,!0)}this.colorMeshes.clear()}add(e){if(!this.enabled)return;if(this.preventUpdate)return void console.log("Culler processing not finished yet.");this.preventUpdate=!0;const t=e instanceof o.InstancedMesh,{geometry:i,material:s}=e,{colorMaterial:n,code:r}=this.getAvailableMaterial();let a;if(Array.isArray(s)){let e=!0;const t=[];for(const i of s)hi.isTransparent(i)?t.push(this._transparentMat):(e=!1,t.push(n));if(e)return n.dispose(),void(this.preventUpdate=!1);a=t}else{if(hi.isTransparent(s))return n.dispose(),void(this.preventUpdate=!1);a=n}this._colorCodeMeshMap.set(r,e),this._meshIDColorCodeMap.set(e.uuid,r);const c=t?e.count:1,l=new o.InstancedMesh(i,a,c);t?l.instanceMatrix=e.instanceMatrix:l.setMatrixAt(0,new o.Matrix4),e.visible=!1,e.updateWorldMatrix(!0,!1),l.applyMatrix4(e.matrixWorld),l.updateMatrix(),this.scene.add(l),this.colorMeshes.set(e.uuid,l),this.increaseColor(),this.preventUpdate=!1}remove(e){if(this.preventUpdate)return void console.log("Culler processing not finished yet.");this.preventUpdate=!0;const t=this.components.get(zt);this._currentVisibleMeshes.delete(e),this._recentlyHiddenMeshes.delete(e);const i=this.colorMeshes.get(e.uuid),s=this._meshIDColorCodeMap.get(e.uuid);i&&s?(this._colorCodeMeshMap.delete(s),this._meshIDColorCodeMap.delete(e.uuid),this.colorMeshes.delete(e.uuid),i.geometry=void 0,i.material=[],t.destroy(i,!0),this._recentlyHiddenMeshes.delete(e),this._currentVisibleMeshes.delete(e),this.preventUpdate=!1):this.preventUpdate=!1}updateInstanced(e){for(const t of e){const e=this.colorMeshes.get(t.uuid);e&&(e.count=t.count)}}getAvailableMaterial(){const{r:e,g:t,b:i,code:s}=this.getAvailableColor(),n=o.ColorManagement.enabled;o.ColorManagement.enabled=!1;const r=new o.Color(`rgb(${e}, ${t}, ${i})`);if(!this.world.renderer)throw new Error("Renderer not found in the world!");const a=this.world.renderer.clippingPlanes,c=new o.MeshBasicMaterial({color:r,clippingPlanes:a,side:o.DoubleSide});return o.ColorManagement.enabled=n,{colorMaterial:c,code:s}}}const Ls=class e extends xt{constructor(i){super(i),t(this,"onDisposed",new Dt),t(this,"_enabled",!0),t(this,"list",new Map),i.add(e.uuid,this)}get enabled(){return this._enabled}set enabled(e){this._enabled=e;for(const[t,i]of this.list)i.enabled=e}create(e){if(this.list.has(e.uuid))return this.list.get(e.uuid);const t=new ys(this.components,e);return this.list.set(e.uuid,t),t}delete(e){const t=this.list.get(e.uuid);t&&t.dispose(),this.list.delete(e.uuid)}dispose(){this.enabled=!1,this.onDisposed.trigger(e.uuid),this.onDisposed.reset();for(const[e,t]of this.list)t.dispose();this.list.clear()}updateInstanced(e){for(const[,t]of this.list)t.updateInstanced(e)}};t(Ls,"uuid","69f2a50d-c266-44fc-b1bd-fa4d34be89e6");let _s=Ls;class Ps{constructor(e,i){if(t(this,"onDisposed",new Dt),t(this,"onDistanceComputed",new Dt),t(this,"excludedObjects",new Set),t(this,"enabled",!0),t(this,"renderDebugFrame",!1),t(this,"components"),t(this,"scene",new o.Scene),t(this,"camera",new o.OrthographicCamera(-1,1,1,-1,0,1)),t(this,"depthMaterial"),t(this,"world"),t(this,"renderer"),t(this,"worker"),t(this,"_width",512),t(this,"_height",512),t(this,"_postQuad"),t(this,"tempRT"),t(this,"resultRT"),t(this,"bufferSize"),t(this,"_buffer"),t(this,"_isWorkerBusy",!1),t(this,"compute",(async()=>{if(!this.enabled||this.world.isDisposing)return;if(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 t of this.excludedObjects)t.userData[e]=t.visible,t.visible=!1;this.renderer.render(this.world.scene.three,this.world.camera.three);for(const t of this.excludedObjects)void 0!==t.userData[e]&&(t.visible=t.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();try{await Ss(t,0,0,this._width,this._height,t.RGBA,t.UNSIGNED_BYTE,this._buffer)}catch(e){return this.renderer.setRenderTarget(null),void(this._isWorkerBusy=!1)}this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,this.camera),this.worker.postMessage({buffer:this._buffer})})),t(this,"handleWorkerMessage",(e=>{if(!this.enabled||this.world.isDisposing)return;const t=e.data.colors;let i=Number.MAX_VALUE;for(const e of t)0!==e&&e<i&&(i=e);const s=this.world.camera.three||o.OrthographicCamera,n=-1*(i/255-1)*(s.far-s.near),r=Math.min(n,s.far);this.onDistanceComputed.trigger(r),this._isWorkerBusy=!1})),!i.renderer)throw new Error("The given world must have a renderer!");this.components=e,this.world=i;const s=i.camera.three;this.renderer=new o.WebGLRenderer,this.tempRT=new o.WebGLRenderTarget(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.tempRT.texture.minFilter=o.NearestFilter,this.tempRT.texture.magFilter=o.NearestFilter,this.tempRT.stencilBuffer=!1,this.tempRT.samples=0,this.tempRT.depthTexture=new o.DepthTexture(this._width,this._height),this.tempRT.depthTexture.format=o.DepthFormat,this.tempRT.depthTexture.type=o.UnsignedShortType,this.resultRT=new o.WebGLRenderTarget(this._width,this._height),this.depthMaterial=new o.ShaderMaterial({vertexShader:"\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n ",fragmentShader:"\n#include <packing>\n\nvarying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform sampler2D tDepth;\nuniform float cameraNear;\nuniform float cameraFar;\n\n\nfloat readDepth( sampler2D depthSampler, vec2 coord ) {\n float fragCoordZ = texture2D( depthSampler, coord ).x;\n float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );\n return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );\n}\n\nvoid main() {\n //vec3 diffuse = texture2D( tDiffuse, vUv ).rgb;\n float depth = readDepth( tDepth, vUv );\n\n gl_FragColor.rgb = 1.0 - vec3( depth );\n gl_FragColor.a = 1.0;\n}\n ",uniforms:{cameraNear:{value:s.near},cameraFar:{value:s.far},tDiffuse:{value:null},tDepth:{value:null}}});const n=new o.PlaneGeometry(2,2);this._postQuad=new o.Mesh(n,this.depthMaterial),this.scene.add(this._postQuad),this.renderer.clippingPlanes=i.renderer.clippingPlanes;const r=new Blob(['\n addEventListener("message", (event) => {\n const { buffer } = event.data;\n const colors = new Set();\n for (let i = 0; i < buffer.length; i += 4) {\n const r = buffer[i];\n colors.add(r);\n }\n postMessage({ colors });\n });\n '],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(r)),this.worker.addEventListener("message",this.handleWorkerMessage)}dispose(){this.enabled=!1,this.onDistanceComputed.reset(),this.worker.terminate(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.tempRT.dispose(),this.resultRT.dispose();const 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 ws{constructor(e){t(this,"_event"),t(this,"_position",new o.Vector2),t(this,"onDisposed",new Dt),t(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-(this.getDataObject(t).clientY-e.top)/(e.bottom-e.top)*2+1}getPositionX(e,t){return(this.getDataObject(t).clientX-e.left)/(e.right-e.left)*2-1}getDataObject(e){return e instanceof MouseEvent?e:e.touches[0]}setupEvents(e){e?(this.dom.addEventListener("pointermove",this.updateMouseInfo),this.dom.addEventListener("touchstart",this.updateMouseInfo)):(this.dom.removeEventListener("pointermove",this.updateMouseInfo),this.dom.removeEventListener("touchstart",this.updateMouseInfo))}}class Ms{constructor(e,i){t(this,"enabled",!0),t(this,"components"),t(this,"onDisposed",new Dt),t(this,"mouse"),t(this,"three",new o.Raycaster),t(this,"world");const s=i.renderer;if(!s)throw new Error("A renderer is needed for the raycaster to work!");this.world=i,this.mouse=new ws(s.three.domElement),this.components=e}dispose(){this.mouse.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}castRay(e=Array.from(this.world.meshes),t=this.mouse.position){if(!this.world)throw new Error("A world is needed to cast rays!");const i=this.world.camera.three;return this.three.setFromCamera(t,i),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||(null==i?void 0:i.length)<=0?e:e.filter((e=>i.every((t=>t.distanceToPoint(e.point)>0))))}}const vs=class e extends xt{constructor(i){super(i),t(this,"enabled",!0),t(this,"list",new Map),t(this,"onDisposed",new Dt),i.add(e.uuid,this)}get(e){if(this.list.has(e.uuid))return this.list.get(e.uuid);const t=new Ms(this.components,e);return this.list.set(e.uuid,t),e.onDisposed.add((()=>{this.delete(e)})),t}delete(e){const t=this.list.get(e.uuid);t&&t.dispose(),this.list.delete(e.uuid)}dispose(){for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}};t(vs,"uuid","d5d8bdf0-db25-4952-b951-b643af207ace");let Ds=vs;class bs extends pi{constructor(){super(...arguments),t(this,"_config",{visible:{value:!0,type:"Boolean"},color:{value:new o.Color,type:"Color"},primarySize:{type:"Number",interpolable:!0,value:1,min:0,max:1e3},secondarySize:{type:"Number",interpolable:!0,value:10,min:0,max:1e3},distance:{type:"Number",interpolable:!0,value:500,min:0,max:500}})}get visible(){return this._config.visible.value}set visible(e){this._config.visible.value=e,this._component.visible=e}get color(){return this._config.color.value}set color(e){this._config.color.value=e,this._component.material.uniforms.uColor.value=e,this._component.material.uniformsNeedUpdate=!0}get primarySize(){return this._config.primarySize.value}set primarySize(e){this._config.primarySize.value=e,this._component.material.uniforms.uSize1.value=e,this._component.material.uniformsNeedUpdate=!0}get secondarySize(){return this._config.secondarySize.value}set secondarySize(e){this._config.secondarySize.value=e,this._component.material.uniforms.uSize2.value=e,this._component.material.uniformsNeedUpdate=!0}get distance(){return this._config.distance.value}set distance(e){this._config.distance.value=e,this._component.material.uniforms.uDistance.value=e,this._component.material.uniformsNeedUpdate=!0}}class Us{constructor(e,i){t(this,"onDisposed",new Dt),t(this,"onSetup",new Dt),t(this,"isSetup",!1),t(this,"world"),t(this,"components"),t(this,"config"),t(this,"_defaultConfig",{visible:!0,color:new o.Color(12303291),primarySize:1,secondarySize:10,distance:500}),t(this,"three"),t(this,"_fade",3),t(this,"updateZoom",(()=>{this.world.camera instanceof Rs&&(this.material.uniforms.uZoom.value=this.world.camera.three.zoom)})),this.world=i;const{color:s,primarySize:n,secondarySize:r,distance:a}=this._defaultConfig;this.components=e,this.config=new bs(this,this.components,"Grid");const c=new o.PlaneGeometry(2,2,1,1),l=new o.ShaderMaterial({side:o.DoubleSide,uniforms:{uSize1:{value:n},uSize2:{value:r},uColor:{value:s},uDistance:{value:a},uFade:{value:this._fade},uZoom:{value:1}},transparent:!0,vertexShader:"\n \n varying vec3 worldPosition;\n \n uniform float uDistance;\n \n void main() {\n \n vec3 pos = position.xzy * uDistance;\n pos.xz += cameraPosition.xz;\n \n worldPosition = pos;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\n \n }\n ",fragmentShader:"\n \n varying vec3 worldPosition;\n \n uniform float uZoom;\n uniform float uFade;\n uniform float uSize1;\n uniform float uSize2;\n uniform vec3 uColor;\n uniform float uDistance;\n \n \n \n float getGrid(float size) {\n \n vec2 r = worldPosition.xz / size;\n \n \n vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r);\n float line = min(grid.x, grid.y);\n \n \n return 1.0 - min(line, 1.0);\n }\n \n void main() {\n \n \n float d = 1.0 - min(distance(cameraPosition.xz, worldPosition.xz) / uDistance, 1.0);\n \n float g1 = getGrid(uSize1);\n float g2 = getGrid(uSize2);\n \n // Ortho camera fades the grid away when zooming out\n float minZoom = step(0.2, uZoom);\n float zoomFactor = pow(min(uZoom, 1.), 2.) * minZoom;\n \n gl_FragColor = vec4(uColor.rgb, mix(g2, g1, g1) * pow(d, uFade));\n gl_FragColor.a = mix(0.5 * gl_FragColor.a, gl_FragColor.a, g2) * zoomFactor;\n \n if ( gl_FragColor.a <= 0.0 ) discard;\n \n \n }\n \n ",extensions:{derivatives:!0}});this.three=new o.Mesh(c,l),this.three.frustumCulled=!1,i.scene.three.add(this.three),this.setupEvents(!0)}get visible(){return this.three.visible}set visible(e){if(e){this.world.scene.three.add(this.three)}else this.three.removeFromParent()}get material(){return this.three.material}get fade(){return 3===this._fade}set fade(e){this._fade=e?3:0,this.material.uniforms.uFade.value=this._fade}setup(e){const t={...this._defaultConfig,...e};this.config.visible=!0,this.config.color=t.color,this.config.primarySize=t.primarySize,this.config.secondarySize=t.secondarySize,this.config.distance=t.distance,this.isSetup=!0,this.onSetup.trigger()}dispose(){this.setupEvents(!1);this.components.get(Ti).list.delete(this.config.uuid);this.components.get(zt).destroy(this.three),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(e){if(this.world.isDisposing)return;if(!(this.world.camera instanceof Rs))return;const t=this.world.camera.controls;e?t.addEventListener("update",this.updateZoom):t.removeEventListener("update",this.updateZoom)}}const xs=class e extends xt{constructor(i){super(i),t(this,"list",new Map),t(this,"onDisposed",new Dt),t(this,"enabled",!0),i.add(e.uuid,this)}create(e){if(this.list.has(e.uuid))throw new Error("This world already has a grid!");const t=new Us(this.components,e);return this.list.set(e.uuid,t),e.onDisposed.add((()=>{this.delete(e)})),t}delete(e){const t=this.list.get(e.uuid);t&&t.dispose(),this.list.delete(e.uuid)}dispose(){for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}};t(xs,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");let Bs=xs;const Vs=new i.Raycaster,Ys=new i.Vector3,Gs=new i.Vector3,zs=new i.Quaternion,ks={X:new i.Vector3(1,0,0),Y:new i.Vector3(0,1,0),Z:new i.Vector3(0,0,1)},Hs={type:"change"},Ws={type:"mouseDown"},Xs={type:"mouseUp",mode:null},js={type:"objectChange"};class Zs extends i.Object3D{constructor(e,t){super(),void 0===t&&(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 s=new pn;this._gizmo=s,this.add(s);const n=new Cn;this._plane=n,this.add(n);const r=this;function o(e,t){let i=t;Object.defineProperty(r,e,{get:function(){return void 0!==i?i:t},set:function(t){i!==t&&(i=t,n[e]=t,s[e]=t,r.dispatchEvent({type:e+"-changed",value:t}),r.dispatchEvent(Hs))}}),r[e]=t,n[e]=t,s[e]=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 i.Vector3,c=new i.Vector3,l=new i.Quaternion,h=new i.Quaternion,u=new i.Vector3,I=new i.Quaternion,d=new i.Vector3,E=new i.Vector3,f=new i.Vector3,p=new i.Vector3;o("worldPosition",a),o("worldPositionStart",c),o("worldQuaternion",l),o("worldQuaternionStart",h),o("cameraPosition",u),o("cameraQuaternion",I),o("pointStart",d),o("pointEnd",E),o("rotationAxis",f),o("rotationAngle",0),o("eye",p),this._offset=new i.Vector3,this._startNorm=new i.Vector3,this._endNorm=new i.Vector3,this._cameraScale=new i.Vector3,this._parentPosition=new i.Vector3,this._parentQuaternion=new i.Quaternion,this._parentQuaternionInv=new i.Quaternion,this._parentScale=new i.Vector3,this._worldScaleStart=new i.Vector3,this._worldQuaternionInv=new i.Quaternion,this._worldScale=new i.Vector3,this._positionStart=new i.Vector3,this._quaternionStart=new i.Quaternion,this._scaleStart=new i.Vector3,this._getPointer=$s.bind(this),this._onPointerDown=qs.bind(this),this._onPointerHover=Qs.bind(this),this._onPointerMove=Ks.bind(this),this._onPointerUp=Js.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?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(void 0===this.object||!0===this.dragging)return;Vs.setFromCamera(e,this.camera);const t=en(this._gizmo.picker[this.mode],Vs);this.axis=t?t.object.name:null}pointerDown(e){if(void 0!==this.object&&!0!==this.dragging&&0===e.button&&null!==this.axis){Vs.setFromCamera(e,this.camera);const t=en(this._plane,Vs,!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,Ws.mode=this.mode,this.dispatchEvent(Ws)}}pointerMove(e){const t=this.axis,i=this.mode,s=this.object;let n=this.space;if("scale"===i?n="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(n="world"),void 0===s||null===t||!1===this.dragging||-1!==e.button)return;Vs.setFromCamera(e,this.camera);const r=en(this._plane,Vs,!0);if(r){if(this.pointEnd.copy(r.point).sub(this.worldPositionStart),"translate"===i)this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===n&&"XYZ"!==t&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===t.indexOf("X")&&(this._offset.x=0),-1===t.indexOf("Y")&&(this._offset.y=0),-1===t.indexOf("Z")&&(this._offset.z=0),"local"===n&&"XYZ"!==t?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&&("local"===n&&(s.position.applyQuaternion(zs.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.position.applyQuaternion(this._quaternionStart)),"world"===n&&(s.parent&&s.position.add(Ys.setFromMatrixPosition(s.parent.matrixWorld)),-1!==t.search("X")&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.parent&&s.position.sub(Ys.setFromMatrixPosition(s.parent.matrixWorld))));else if("scale"===i){if(-1!==t.search("XYZ")){let e=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(e*=-1),Gs.set(e,e,e)}else Ys.copy(this.pointStart),Gs.copy(this.pointEnd),Ys.applyQuaternion(this._worldQuaternionInv),Gs.applyQuaternion(this._worldQuaternionInv),Gs.divide(Ys),-1===t.search("X")&&(Gs.x=1),-1===t.search("Y")&&(Gs.y=1),-1===t.search("Z")&&(Gs.z=1);s.scale.copy(this._scaleStart).multiply(Gs),this.scaleSnap&&(-1!==t.search("X")&&(s.scale.x=Math.round(s.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(s.scale.y=Math.round(s.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(s.scale.z=Math.round(s.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if("rotate"===i){this._offset.copy(this.pointEnd).sub(this.pointStart);const e=20/this.worldPosition.distanceTo(Ys.setFromMatrixPosition(this.camera.matrixWorld));let i=!1;"XYZE"===t?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Ys.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(ks[t]),Ys.copy(ks[t]),"local"===n&&Ys.applyQuaternion(this.worldQuaternion),Ys.cross(this.eye),0===Ys.length()?i=!0:this.rotationAngle=this._offset.dot(Ys.normalize())*e),("E"===t||i)&&(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),"local"===n&&"E"!==t&&"XYZE"!==t?(s.quaternion.copy(this._quaternionStart),s.quaternion.multiply(zs.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),s.quaternion.copy(zs.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),s.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(Hs),this.dispatchEvent(js)}}pointerUp(e){0===e.button&&(this.dragging&&null!==this.axis&&(Xs.mode=this.mode,this.dispatchEvent(Xs)),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(Hs),this.dispatchEvent(js),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Vs}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 $s(e){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:e.button};{const t=this.domElement.getBoundingClientRect();return{x:(e.clientX-t.left)/t.width*2-1,y:-(e.clientY-t.top)/t.height*2+1,button:e.button}}}function Qs(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}function qs(e){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(e)),this.pointerDown(this._getPointer(e)))}function Ks(e){this.enabled&&this.pointerMove(this._getPointer(e))}function Js(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}function en(e,t,i){const s=t.intersectObject(e,!0);for(let e=0;e<s.length;e++)if(s[e].object.visible||i)return s[e];return!1}const tn=new i.Euler,sn=new i.Vector3(0,1,0),nn=new i.Vector3(0,0,0),rn=new i.Matrix4,on=new i.Quaternion,an=new i.Quaternion,cn=new i.Vector3,ln=new i.Matrix4,hn=new i.Vector3(1,0,0),un=new i.Vector3(0,1,0),In=new i.Vector3(0,0,1),dn=new i.Vector3,En=new i.Vector3,fn=new i.Vector3;class pn extends i.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new i.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new i.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=e.clone();s.opacity=.15;const n=t.clone();n.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 c=e.clone();c.color.setHex(16711680),c.opacity=.5;const l=e.clone();l.color.setHex(65280),l.opacity=.5;const h=e.clone();h.color.setHex(255),h.opacity=.5;const u=e.clone();u.opacity=.25;const I=e.clone();I.color.setHex(16776960),I.opacity=.25;e.clone().color.setHex(16776960);const d=e.clone();d.color.setHex(7895160);const E=new i.CylinderGeometry(0,.04,.1,12);E.translate(0,.05,0);const f=new i.BoxGeometry(.08,.08,.08);f.translate(0,.04,0);const p=new i.BufferGeometry;p.setAttribute("position",new i.Float32BufferAttribute([0,0,0,1,0,0],3));const C=new i.CylinderGeometry(.0075,.0075,.5,3);function T(e,t){const s=new i.TorusGeometry(e,.0075,3,64,t*Math.PI*2);return s.rotateY(Math.PI/2),s.rotateX(Math.PI/2),s}C.translate(0,.25,0);const m={X:[[new i.Mesh(E,r),[.5,0,0],[0,0,-Math.PI/2]],[new i.Mesh(E,r),[-.5,0,0],[0,0,Math.PI/2]],[new i.Mesh(C,r),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new i.Mesh(E,o),[0,.5,0]],[new i.Mesh(E,o),[0,-.5,0],[Math.PI,0,0]],[new i.Mesh(C,o)]],Z:[[new i.Mesh(E,a),[0,0,.5],[Math.PI/2,0,0]],[new i.Mesh(E,a),[0,0,-.5],[-Math.PI/2,0,0]],[new i.Mesh(C,a),null,[Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.OctahedronGeometry(.1,0),u.clone()),[0,0,0]]],XY:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),h.clone()),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),c.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),l.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},R={X:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.OctahedronGeometry(.2,0),s)]],XY:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]]},g={START:[[new i.Mesh(new i.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],END:[[new i.Mesh(new i.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],DELTA:[[new i.Line(function(){const e=new i.BufferGeometry;return e.setAttribute("position",new i.Float32BufferAttribute([0,0,0,1,1,1],3)),e}(),n),null,null,null,"helper"]],X:[[new i.Line(p,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new i.Line(p,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new i.Line(p,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},A={XYZE:[[new i.Mesh(T(.5,1),d),null,[0,Math.PI/2,0]]],X:[[new i.Mesh(T(.5,.5),r)]],Y:[[new i.Mesh(T(.5,.5),o),null,[0,0,-Math.PI/2]]],Z:[[new i.Mesh(T(.5,.5),a),null,[0,Math.PI/2,0]]],E:[[new i.Mesh(T(.75,1),I),null,[0,Math.PI/2,0]]]},F={AXIS:[[new i.Line(p,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},S={XYZE:[[new i.Mesh(new i.SphereGeometry(.25,10,8),s)]],X:[[new i.Mesh(new i.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new i.Mesh(new i.TorusGeometry(.5,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new i.Mesh(new i.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,0,-Math.PI/2]]],E:[[new i.Mesh(new i.TorusGeometry(.75,.1,2,24),s)]]},O={X:[[new i.Mesh(f,r),[.5,0,0],[0,0,-Math.PI/2]],[new i.Mesh(C,r),[0,0,0],[0,0,-Math.PI/2]],[new i.Mesh(f,r),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new i.Mesh(f,o),[0,.5,0]],[new i.Mesh(C,o)],[new i.Mesh(f,o),[0,-.5,0],[0,0,Math.PI]]],Z:[[new i.Mesh(f,a),[0,0,.5],[Math.PI/2,0,0]],[new i.Mesh(C,a),[0,0,0],[Math.PI/2,0,0]],[new i.Mesh(f,a),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),c),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),l),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.BoxGeometry(.1,.1,.1),u.clone())]]},N={X:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.2),s),[0,0,0]]]},y={X:[[new i.Line(p,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new i.Line(p,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new i.Line(p,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function L(e){const t=new i.Object3D;for(const i in e)for(let s=e[i].length;s--;){const n=e[i][s][0].clone(),r=e[i][s][1],o=e[i][s][2],a=e[i][s][3],c=e[i][s][4];n.name=i,n.tag=c,r&&n.position.set(r[0],r[1],r[2]),o&&n.rotation.set(o[0],o[1],o[2]),a&&n.scale.set(a[0],a[1],a[2]),n.updateMatrix();const l=n.geometry.clone();l.applyMatrix4(n.matrix),n.geometry=l,n.renderOrder=1/0,n.position.set(0,0,0),n.rotation.set(0,0,0),n.scale.set(1,1,1),t.add(n)}return t}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=L(m)),this.add(this.gizmo.rotate=L(A)),this.add(this.gizmo.scale=L(O)),this.add(this.picker.translate=L(R)),this.add(this.picker.rotate=L(S)),this.add(this.picker.scale=L(N)),this.add(this.helper.translate=L(g)),this.add(this.helper.rotate=L(F)),this.add(this.helper.scale=L(y)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const t="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:an;this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode;let i=[];i=i.concat(this.picker[this.mode].children),i=i.concat(this.gizmo[this.mode].children),i=i.concat(this.helper[this.mode].children);for(let e=0;e<i.length;e++){const s=i[e];let n;if(s.visible=!0,s.rotation.set(0,0,0),s.position.copy(this.worldPosition),n=this.camera.isOrthographicCamera?(this.camera.top-this.camera.bottom)/this.camera.zoom:this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),s.scale.set(1,1,1).multiplyScalar(n*this.size/4),"helper"!==s.tag){if(s.quaternion.copy(t),"translate"===this.mode||"scale"===this.mode){const e=.99,i=.2;"X"===s.name&&Math.abs(sn.copy(hn).applyQuaternion(t).dot(this.eye))>e&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"Y"===s.name&&Math.abs(sn.copy(un).applyQuaternion(t).dot(this.eye))>e&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"Z"===s.name&&Math.abs(sn.copy(In).applyQuaternion(t).dot(this.eye))>e&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"XY"===s.name&&Math.abs(sn.copy(In).applyQuaternion(t).dot(this.eye))<i&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"YZ"===s.name&&Math.abs(sn.copy(hn).applyQuaternion(t).dot(this.eye))<i&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"XZ"===s.name&&Math.abs(sn.copy(un).applyQuaternion(t).dot(this.eye))<i&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1)}else"rotate"===this.mode&&(on.copy(t),sn.copy(this.eye).applyQuaternion(zs.copy(t).invert()),-1!==s.name.search("E")&&s.quaternion.setFromRotationMatrix(rn.lookAt(this.eye,nn,un)),"X"===s.name&&(zs.setFromAxisAngle(hn,Math.atan2(-sn.y,sn.z)),zs.multiplyQuaternions(on,zs),s.quaternion.copy(zs)),"Y"===s.name&&(zs.setFromAxisAngle(un,Math.atan2(sn.x,sn.z)),zs.multiplyQuaternions(on,zs),s.quaternion.copy(zs)),"Z"===s.name&&(zs.setFromAxisAngle(In,Math.atan2(sn.y,sn.x)),zs.multiplyQuaternions(on,zs),s.quaternion.copy(zs)));s.visible=s.visible&&(-1===s.name.indexOf("X")||this.showX),s.visible=s.visible&&(-1===s.name.indexOf("Y")||this.showY),s.visible=s.visible&&(-1===s.name.indexOf("Z")||this.showZ),s.visible=s.visible&&(-1===s.name.indexOf("E")||this.showX&&this.showY&&this.showZ),s.material._color=s.material._color||s.material.color.clone(),s.material._opacity=s.material._opacity||s.material.opacity,s.material.color.copy(s.material._color),s.material.opacity=s.material._opacity,this.enabled&&this.axis&&(s.name===this.axis||this.axis.split("").some((function(e){return s.name===e})))&&(s.material.color.setHex(16776960),s.material.opacity=1)}else s.visible=!1,"AXIS"===s.name?(s.visible=!!this.axis,"X"===this.axis&&(zs.setFromEuler(tn.set(0,0,0)),s.quaternion.copy(t).multiply(zs),Math.abs(sn.copy(hn).applyQuaternion(t).dot(this.eye))>.9&&(s.visible=!1)),"Y"===this.axis&&(zs.setFromEuler(tn.set(0,0,Math.PI/2)),s.quaternion.copy(t).multiply(zs),Math.abs(sn.copy(un).applyQuaternion(t).dot(this.eye))>.9&&(s.visible=!1)),"Z"===this.axis&&(zs.setFromEuler(tn.set(0,Math.PI/2,0)),s.quaternion.copy(t).multiply(zs),Math.abs(sn.copy(In).applyQuaternion(t).dot(this.eye))>.9&&(s.visible=!1)),"XYZE"===this.axis&&(zs.setFromEuler(tn.set(0,Math.PI/2,0)),sn.copy(this.rotationAxis),s.quaternion.setFromRotationMatrix(rn.lookAt(nn,sn,un)),s.quaternion.multiply(zs),s.visible=this.dragging),"E"===this.axis&&(s.visible=!1)):"START"===s.name?(s.position.copy(this.worldPositionStart),s.visible=this.dragging):"END"===s.name?(s.position.copy(this.worldPosition),s.visible=this.dragging):"DELTA"===s.name?(s.position.copy(this.worldPositionStart),s.quaternion.copy(this.worldQuaternionStart),Ys.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Ys.applyQuaternion(this.worldQuaternionStart.clone().invert()),s.scale.copy(Ys),s.visible=this.dragging):(s.quaternion.copy(t),this.dragging?s.position.copy(this.worldPositionStart):s.position.copy(this.worldPosition),this.axis&&(s.visible=-1!==this.axis.search(s.name)))}super.updateMatrixWorld(e)}}class Cn extends i.Mesh{constructor(){super(new i.PlaneGeometry(1e5,1e5,2,2),new i.MeshBasicMaterial({visible:!1,wireframe:!0,side:i.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),"scale"===this.mode&&(t="local"),dn.copy(hn).applyQuaternion("local"===t?this.worldQuaternion:an),En.copy(un).applyQuaternion("local"===t?this.worldQuaternion:an),fn.copy(In).applyQuaternion("local"===t?this.worldQuaternion:an),sn.copy(En),this.mode){case"translate":case"scale":switch(this.axis){case"X":sn.copy(this.eye).cross(dn),cn.copy(dn).cross(sn);break;case"Y":sn.copy(this.eye).cross(En),cn.copy(En).cross(sn);break;case"Z":sn.copy(this.eye).cross(fn),cn.copy(fn).cross(sn);break;case"XY":cn.copy(fn);break;case"YZ":cn.copy(dn);break;case"XZ":sn.copy(fn),cn.copy(En);break;case"XYZ":case"E":cn.set(0,0,0)}break;default:cn.set(0,0,0)}0===cn.length()?this.quaternion.copy(this.cameraQuaternion):(ln.lookAt(Ys.set(0,0,0),cn,sn),this.quaternion.setFromRotationMatrix(ln)),super.updateMatrixWorld(e)}}class Tn{constructor(e,i,s,n,r,a=5,c=!0){if(t(this,"onDraggingStarted",new Dt),t(this,"onDraggingEnded",new Dt),t(this,"onDisposed",new Dt),t(this,"normal"),t(this,"origin"),t(this,"three",new o.Plane),t(this,"components"),t(this,"world"),t(this,"type","default"),t(this,"_helper"),t(this,"_visible",!0),t(this,"_enabled",!0),t(this,"_controlsActive",!1),t(this,"_arrowBoundBox",new o.Mesh),t(this,"_planeMesh"),t(this,"_controls"),t(this,"_hiddenMaterial",new o.MeshBasicMaterial({visible:!1})),t(this,"update",(()=>{this._enabled&&this.three.setFromNormalAndCoplanarPoint(this.normal,this._helper.position)})),t(this,"changeDrag",(e=>{this._visible=!e.value,this.preventCameraMovement(),this.notifyDraggingChanged(e)})),this.components=e,this.world=i,!i.renderer)throw new Error("The given world must have a renderer!");this.normal=n,this.origin=s,i.renderer.setPlane(!0,this.three),this._planeMesh=Tn.newPlaneMesh(a,r),this._helper=this.newHelper(),this._controls=this.newTransformControls(),this.three.setFromNormalAndCoplanarPoint(n,s),c&&this.toggleControls(!0)}get enabled(){return this._enabled}set enabled(e){if(!this.world.isDisposing){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 o.Vector3(1,0,0),t=new o.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 Zs(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 o.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 o.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 o.PlaneGeometry(1),s=new o.Mesh(i,t);return s.scale.set(e,e,e),s}}class mn extends pi{constructor(){super(...arguments),t(this,"_config",{enabled:{value:!0,type:"Boolean"},visible:{value:!0,type:"Boolean"},color:{value:new o.Color,type:"Color"},opacity:{type:"Number",interpolable:!0,value:1,min:0,max:1},size:{type:"Number",interpolable:!0,value:2,min:0,max:100}})}get enabled(){return this._config.enabled.value}set enabled(e){this._config.enabled.value=e,this._component.enabled=e}get visible(){return this._config.visible.value}set visible(e){this._config.visible.value=e,this._component.visible=e}get color(){return this._config.color.value}set color(e){this._config.color.value=e,this._component.material.color.copy(e)}get opacity(){return this._config.opacity.value}set opacity(e){this._config.opacity.value=e,this._component.material.opacity=e}get size(){return this._config.size.value}set size(e){this._config.size.value=e,this._component.size=e}}const Rn=class e extends xt{constructor(i){super(i),t(this,"onSetup",new Dt),t(this,"onBeforeDrag",new Dt),t(this,"onAfterDrag",new Dt),t(this,"onBeforeCreate",new Dt),t(this,"onBeforeCancel",new Dt),t(this,"onAfterCancel",new Dt),t(this,"onBeforeDelete",new Dt),t(this,"onAfterCreate",new Dt),t(this,"onAfterDelete",new Dt),t(this,"onDisposed",new Dt),t(this,"isSetup",!1),t(this,"orthogonalY",!1),t(this,"toleranceOrthogonalY",.7),t(this,"Type",Tn),t(this,"list",[]),t(this,"config",new mn(this,this.components,"Clipper",e.uuid)),t(this,"_defaultConfig",{color:new o.Color(12255487),opacity:.2,size:2}),t(this,"_material",new o.MeshBasicMaterial({color:12255487,side:o.DoubleSide,transparent:!0,opacity:.2})),t(this,"_size",5),t(this,"_enabled",!1),t(this,"_visible",!0),t(this,"_onStartDragging",(()=>{this.onBeforeDrag.trigger()})),t(this,"_onEndDragging",(()=>{this.onAfterDrag.trigger()})),this.components.add(e.uuid,this)}get enabled(){return this._enabled}set enabled(e){this._enabled=e;for(const t of this.list)t.enabled=e;this.updateMaterialsAndPlanes()}get visible(){return this._visible}set visible(e){this._visible=e;for(const t of this.list)t.visible=e}get material(){return this._material}set material(e){this._material=e;for(const t of this.list)t.planeMaterial=e}get size(){return this._size}set size(e){this._size=e;for(const t of this.list)t.size=e}dispose(){this._enabled=!1;this.components.get(Ti).list.delete(this.config.uuid);for(const e of this.list)e.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(e.uuid),this.onDisposed.reset()}create(e){const t=this.components.get(Ds).get(e).castRay();return t?this.createPlaneFromIntersection(e,t):null}createFromNormalAndCoplanarPoint(e,t,i){const s=this.newPlane(e,i,t);return this.updateMaterialsAndPlanes(),s}delete(e,t){t||(t=this.pickPlane(e)),t&&this.deletePlane(t)}deleteAll(e){const t=[...this.list];for(const i of t)if(!e||e.has(i.type)){this.delete(i.world,i);const e=this.list.indexOf(i);-1!==e&&this.list.splice(e,1)}}setup(e){const t={...this._defaultConfig,...e};this.config.color=t.color,this.config.opacity=t.opacity,this.config.size=t.size,this.isSetup=!0,this.onSetup.trigger()}deletePlane(e){const t=this.list.indexOf(e);if(-1!==t){if(this.list.splice(t,1),!e.world.renderer)throw new Error("Renderer not found for this plane's world!");e.world.renderer.setPlane(!1,e.three),e.dispose(),this.updateMaterialsAndPlanes(),this.onAfterDelete.trigger(e)}}pickPlane(e){const t=this.components.get(Ds).get(e),i=this.getAllPlaneMeshes(),s=t.castRay(i);if(s){const e=s.object;return this.list.find((t=>t.meshes.includes(e)))}}getAllPlaneMeshes(){const e=[];for(const t of this.list)e.push(...t.meshes);return e}createPlaneFromIntersection(e,t){var i;if(!e.renderer)throw new Error("The given world must have a renderer!");const s=t.point.distanceTo(new o.Vector3(0,0,0)),n=null==(i=t.face)?void 0:i.normal;if(!s||!n)return null;const r=this.getWorldNormal(t,n),a=this.newPlane(e,t.point,r.negate());return a.visible=this._visible,a.size=this._size,e.renderer.setPlane(!0,a.three),this.updateMaterialsAndPlanes(),a}getWorldNormal(e,t){const i=e.object;let s=e.object.matrixWorld.clone();if(i instanceof o.InstancedMesh&&void 0!==e.instanceId){const t=new o.Matrix4;i.getMatrixAt(e.instanceId,t),s=t.multiply(s)}const n=(new o.Matrix3).getNormalMatrix(s),r=t.clone().applyMatrix3(n).normalize();return this.normalizePlaneDirectionY(r),r}normalizePlaneDirectionY(e){this.orthogonalY&&(e.y>this.toleranceOrthogonalY&&(e.x=0,e.y=1,e.z=0),e.y<-this.toleranceOrthogonalY&&(e.x=0,e.y=-1,e.z=0))}newPlane(e,t,i){const s=new this.Type(this.components,e,t,i,this._material);return s.onDraggingStarted.add(this._onStartDragging),s.onDraggingEnded.add(this._onEndDragging),this.list.push(s),this.onAfterCreate.trigger(s),s}updateMaterialsAndPlanes(){const e=this.components.get(As);for(const[t,i]of e.list){if(!i.renderer)continue;i.renderer.updateClippingPlanes();const{clippingPlanes:e}=i.renderer;for(const t of i.meshes)if(t.material)if(Array.isArray(t.material))for(const i of t.material)i.clippingPlanes=e;else t.material.clippingPlanes=e}}};t(Rn,"uuid","66290bc5-18c4-4cd1-9379-2e17a0617611");let gn=Rn;class An{constructor(e){t(this,"enabled",!1),t(this,"id","FirstPerson"),this.camera=e}set(e){if(this.enabled=e,e){if("Perspective"!==this.camera.projection.current)return void this.camera.set("Orbit");this.setupFirstPersonCamera()}}setupFirstPersonCamera(){const e=this.camera.controls,t=new o.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=ms.ACTION.DOLLY,e.touches.two=ms.ACTION.TOUCH_ZOOM_TRUCK}}class Fn{constructor(e){t(this,"enabled",!0),t(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 o.Vector3;e.getPosition(t);const i=t.length();e.distance=i,e.truckSpeed=2;const{rotation:s}=this.camera.three,n=new o.Vector3(0,0,-1).applyEuler(s),r=t.addScaledVector(n,i);e.moveTo(r.x,r.y,r.z)}}class Sn{constructor(e){t(this,"enabled",!1),t(this,"id","Plan"),t(this,"mouseAction1"),t(this,"mouseAction2"),t(this,"mouseInitialized",!1),t(this,"defaultAzimuthSpeed"),t(this,"defaultPolarSpeed"),this.camera=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=ms.ACTION.TRUCK,t.touches.one=ms.ACTION.TOUCH_TRUCK,t.touches.two=ms.ACTION.TOUCH_ZOOM):(t.mouseButtons.left=ms.ACTION.ROTATE,t.touches.one=this.mouseAction1,t.touches.two=this.mouseAction2)}}class On{constructor(e){t(this,"onChanged",new Dt),t(this,"current","Perspective"),t(this,"camera"),t(this,"matchOrthoDistanceEnabled",!1),t(this,"_component"),t(this,"_previousDistance",-1),this._component=e,this.camera=e.three}async set(e){this.current!==e&&("Orthographic"===e?this.setOrthoCamera():await this.setPerspectiveCamera(),this.onChanged.trigger(this.camera))}async toggle(){const e="Perspective"===this.current?"Orthographic":"Perspective";await this.set(e)}setOrthoCamera(){if(null===this._component.mode)return;if("FirstPerson"===this._component.mode.id)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 o.Vector3;this._component.threePersp.getWorldDirection(t);const i=new o.Vector3;this._component.controls.getTarget(i);const s=i.clone().sub(this._component.threePersp.position).dot(t),n=e.renderer.getSize(),r=n.x/n.y,a=this._component.threePersp,c=2*s*Math.atan(a.fov*(Math.PI/180)/2);return{width:c*r,height:c}}setupOrthoCamera(e,t){this._component.controls.mouseButtons.wheel=ms.ACTION.ZOOM,this._component.controls.mouseButtons.middle=ms.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=ms.ACTION.DOLLY,this._component.controls.mouseButtons.middle=ms.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=ms.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 Nn extends Rs{constructor(e){super(e),t(this,"projection"),t(this,"threeOrtho"),t(this,"threePersp"),t(this,"_userInputButtons",{}),t(this,"_frustumSize",50),t(this,"_navigationModes",new Map),t(this,"_mode",null),t(this,"previousSize",null),this.threePersp=this.three,this.threeOrtho=this.newOrthoCamera(),this.projection=new On(this),this.onAspectUpdated.add((()=>{this.setOrthoPerspCameraAspect()})),this.projection.onChanged.add((e=>{this.three=e,this.updateAspect()})),this.onWorldChanged.add((({action:e})=>{"added"===e&&(this._navigationModes.clear(),this._navigationModes.set("Orbit",new Fn(this)),this._navigationModes.set("FirstPerson",new An(this)),this._navigationModes.set("Plan",new Sn(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(e){if(null!==this.mode&&this.mode.id!==e){if(this.mode.set(!1),!this._navigationModes.has(e))throw new Error("The specified mode does not exist!");this._mode=this._navigationModes.get(e),this.mode.set(!0)}}async fit(e,t=1.5){if(!this.enabled)return;const i=Number.MAX_VALUE,s=Number.MIN_VALUE,n=new o.Vector3(i,i,i),r=new o.Vector3(s,s,s);for(const t of e){const e=(new o.Box3).setFromObject(t);e.min.x<n.x&&(n.x=e.min.x),e.min.y<n.y&&(n.y=e.min.y),e.min.z<n.z&&(n.z=e.min.z),e.max.x>r.x&&(r.x=e.max.x),e.max.y>r.y&&(r.y=e.max.y),e.max.z>r.z&&(r.z=e.max.z)}const a=new o.Box3(n,r),c=new o.Vector3;a.getSize(c);const l=new o.Vector3;a.getCenter(l);const h=Math.max(c.x,c.y,c.z)*t,u=new o.Sphere(l,h);await this.controls.fitToSphere(u,!0)}setUserInput(e){e?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(){0!==Object.keys(this._userInputButtons).length&&(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 e=window.innerWidth/window.innerHeight;return new o.OrthographicCamera(this._frustumSize*e/-2,this._frustumSize*e/2,this._frustumSize/2,this._frustumSize/-2,.1,1e3)}setOrthoPerspCameraAspect(){if(!this.currentWorld||!this.currentWorld.renderer)return;if(!this.previousSize)return;const e=this.currentWorld.renderer.getSize(),t=this.threeOrtho.top,i=this.threeOrtho.right,s=t*(e.y/this.previousSize.y),n=i*(e.x/this.previousSize.x);this.threeOrtho.left=-n,this.threeOrtho.right=n,this.threeOrtho.top=s,this.threeOrtho.bottom=-s,this.threeOrtho.updateProjectionMatrix(),this.previousSize.copy(e)}}const yn=new Map([[c.IFCRELAGGREGATES,{forRelated:"Decomposes",forRelating:"IsDecomposedBy"}],[c.IFCRELASSOCIATESMATERIAL,{forRelated:"HasAssociations",forRelating:"AssociatedTo"}],[c.IFCRELASSOCIATESCLASSIFICATION,{forRelated:"HasAssociations",forRelating:"ClassificationForObjects"}],[c.IFCRELASSIGNSTOGROUP,{forRelated:"HasAssignments",forRelating:"IsGroupedBy"}],[c.IFCRELDEFINESBYPROPERTIES,{forRelated:"IsDefinedBy",forRelating:"DefinesOcurrence"}],[c.IFCRELDEFINESBYTYPE,{forRelated:"IsTypedBy",forRelating:"Types"}],[c.IFCRELDEFINESBYTEMPLATE,{forRelated:"IsDefinedBy",forRelating:"Defines"}],[c.IFCRELCONTAINEDINSPATIALSTRUCTURE,{forRelated:"ContainedInStructure",forRelating:"ContainsElements"}],[c.IFCRELFLOWCONTROLELEMENTS,{forRelated:"AssignedToFlowElement",forRelating:"HasControlElements"}],[c.IFCRELCONNECTSELEMENTS,{forRelated:"ConnectedFrom",forRelating:"ConnectedTo"}],[c.IFCRELASSIGNSTOPRODUCT,{forRelated:"HasAssignments",forRelating:"ReferencedBy"}],[c.IFCRELDECLARES,{forRelated:"HasContext",forRelating:"Declares"}],[c.IFCRELASSIGNSTOCONTROL,{forRelated:"HasAssignments",forRelating:"Controls"}],[c.IFCRELNESTS,{forRelated:"Nests",forRelating:"IsNestedBy"}],[c.IFCRELASSOCIATESDOCUMENT,{forRelated:"HasAssociations",forRelating:"DocumentRefForObjects"}]]),Ln={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"};const _n={950732822:"IFCURIREFERENCE",4075327185:"IFCTIME",1209108979:"IFCTEMPERATURERATEOFCHANGEMEASURE",3457685358:"IFCSOUNDPRESSURELEVELMEASURE",4157543285:"IFCSOUNDPOWERLEVELMEASURE",2798247006:"IFCPROPERTYSETDEFINITIONSET",1790229001:"IFCPOSITIVEINTEGER",525895558:"IFCNONNEGATIVELENGTHMEASURE",1774176899:"IFCLINEINDEX",1275358634:"IFCLANGUAGEID",2541165894:"IFCDURATION",3701338814:"IFCDAYINWEEKNUMBER",2195413836:"IFCDATETIME",937566702:"IFCDATE",1683019596:"IFCCARDINALPOINTREFERENCE",2314439260:"IFCBINARY",1500781891:"IFCAREADENSITYMEASURE",3683503648:"IFCARCINDEX",4065007721:"IFCYEARNUMBER",1718600412:"IFCWARPINGMOMENTMEASURE",51269191:"IFCWARPINGCONSTANTMEASURE",2593997549:"IFCVOLUMETRICFLOWRATEMEASURE",3458127941:"IFCVOLUMEMEASURE",3345633955:"IFCVAPORPERMEABILITYMEASURE",1278329552:"IFCTORQUEMEASURE",2591213694:"IFCTIMESTAMP",2726807636:"IFCTIMEMEASURE",743184107:"IFCTHERMODYNAMICTEMPERATUREMEASURE",2016195849:"IFCTHERMALTRANSMITTANCEMEASURE",857959152:"IFCTHERMALRESISTANCEMEASURE",2281867870:"IFCTHERMALEXPANSIONCOEFFICIENTMEASURE",2645777649:"IFCTHERMALCONDUCTIVITYMEASURE",232962298:"IFCTHERMALADMITTANCEMEASURE",296282323:"IFCTEXTTRANSFORMATION",603696268:"IFCTEXTFONTNAME",3490877962:"IFCTEXTDECORATION",1460886941:"IFCTEXTALIGNMENT",2801250643:"IFCTEXT",58845555:"IFCTEMPERATUREGRADIENTMEASURE",361837227:"IFCSPECULARROUGHNESS",2757832317:"IFCSPECULAREXPONENT",3477203348:"IFCSPECIFICHEATCAPACITYMEASURE",993287707:"IFCSOUNDPRESSUREMEASURE",846465480:"IFCSOUNDPOWERMEASURE",3471399674:"IFCSOLIDANGLEMEASURE",408310005:"IFCSHEARMODULUSMEASURE",2190458107:"IFCSECTIONALAREAINTEGRALMEASURE",3467162246:"IFCSECTIONMODULUSMEASURE",2766185779:"IFCSECONDINMINUTE",3211557302:"IFCROTATIONALSTIFFNESSMEASURE",1755127002:"IFCROTATIONALMASSMEASURE",2133746277:"IFCROTATIONALFREQUENCYMEASURE",200335297:"IFCREAL",96294661:"IFCRATIOMEASURE",3972513137:"IFCRADIOACTIVITYMEASURE",3665567075:"IFCPRESSUREMEASURE",2169031380:"IFCPRESENTABLETEXT",1364037233:"IFCPOWERMEASURE",1245737093:"IFCPOSITIVERATIOMEASURE",3054510233:"IFCPOSITIVEPLANEANGLEMEASURE",2815919920:"IFCPOSITIVELENGTHMEASURE",4042175685:"IFCPLANEANGLEMEASURE",2642773653:"IFCPLANARFORCEMEASURE",2260317790:"IFCPARAMETERVALUE",929793134:"IFCPHMEASURE",2395907400:"IFCNUMERICMEASURE",2095195183:"IFCNORMALISEDRATIOMEASURE",765770214:"IFCMONTHINYEARNUMBER",2615040989:"IFCMONETARYMEASURE",3114022597:"IFCMOMENTOFINERTIAMEASURE",1648970520:"IFCMOLECULARWEIGHTMEASURE",3177669450:"IFCMOISTUREDIFFUSIVITYMEASURE",1753493141:"IFCMODULUSOFSUBGRADEREACTIONMEASURE",1052454078:"IFCMODULUSOFROTATIONALSUBGRADEREACTIONMEASURE",2173214787:"IFCMODULUSOFLINEARSUBGRADEREACTIONMEASURE",3341486342:"IFCMODULUSOFELASTICITYMEASURE",102610177:"IFCMINUTEINHOUR",3531705166:"IFCMASSPERLENGTHMEASURE",3124614049:"IFCMASSMEASURE",4017473158:"IFCMASSFLOWRATEMEASURE",1477762836:"IFCMASSDENSITYMEASURE",2486716878:"IFCMAGNETICFLUXMEASURE",286949696:"IFCMAGNETICFLUXDENSITYMEASURE",151039812:"IFCLUMINOUSINTENSITYMEASURE",2755797622:"IFCLUMINOUSINTENSITYDISTRIBUTIONMEASURE",2095003142:"IFCLUMINOUSFLUXMEASURE",503418787:"IFCLOGICAL",3086160713:"IFCLINEARVELOCITYMEASURE",1307019551:"IFCLINEARSTIFFNESSMEASURE",2128979029:"IFCLINEARMOMENTMEASURE",191860431:"IFCLINEARFORCEMEASURE",1243674935:"IFCLENGTHMEASURE",3258342251:"IFCLABEL",2054016361:"IFCKINEMATICVISCOSITYMEASURE",3192672207:"IFCISOTHERMALMOISTURECAPACITYMEASURE",3686016028:"IFCIONCONCENTRATIONMEASURE",3809634241:"IFCINTEGERCOUNTRATEMEASURE",1939436016:"IFCINTEGER",2679005408:"IFCINDUCTANCEMEASURE",3358199106:"IFCILLUMINANCEMEASURE",983778844:"IFCIDENTIFIER",2589826445:"IFCHOURINDAY",1158859006:"IFCHEATINGVALUEMEASURE",3113092358:"IFCHEATFLUXDENSITYMEASURE",3064340077:"IFCGLOBALLYUNIQUEID",3044325142:"IFCFREQUENCYMEASURE",1361398929:"IFCFORCEMEASURE",2590844177:"IFCFONTWEIGHT",2715512545:"IFCFONTVARIANT",1102727119:"IFCFONTSTYLE",2078135608:"IFCENERGYMEASURE",2506197118:"IFCELECTRICVOLTAGEMEASURE",2951915441:"IFCELECTRICRESISTANCEMEASURE",3790457270:"IFCELECTRICCURRENTMEASURE",2093906313:"IFCELECTRICCONDUCTANCEMEASURE",3818826038:"IFCELECTRICCHARGEMEASURE",1827137117:"IFCELECTRICCAPACITANCEMEASURE",69416015:"IFCDYNAMICVISCOSITYMEASURE",524656162:"IFCDOSEEQUIVALENTMEASURE",4134073009:"IFCDIMENSIONCOUNT",1514641115:"IFCDESCRIPTIVEMEASURE",300323983:"IFCDAYLIGHTSAVINGHOUR",86635668:"IFCDAYINMONTHNUMBER",94842927:"IFCCURVATUREMEASURE",1778710042:"IFCCOUNTMEASURE",3238673880:"IFCCONTEXTDEPENDENTMEASURE",3812528620:"IFCCOMPOUNDPLANEANGLEMEASURE",2991860651:"IFCCOMPLEXNUMBER",1867003952:"IFCBOXALIGNMENT",2735952531:"IFCBOOLEAN",2650437152:"IFCAREAMEASURE",632304761:"IFCANGULARVELOCITYMEASURE",360377573:"IFCAMOUNTOFSUBSTANCEMEASURE",4182062534:"IFCACCELERATIONMEASURE",3699917729:"IFCABSORBEDDOSEMEASURE",1971632696:"IFCGEOSLICE",2680139844:"IFCGEOMODEL",24726584:"IFCELECTRICFLOWTREATMENTDEVICE",3693000487:"IFCDISTRIBUTIONBOARD",3460952963:"IFCCONVEYORSEGMENT",3999819293:"IFCCAISSONFOUNDATION",3314249567:"IFCBOREHOLE",4196446775:"IFCBEARING",325726236:"IFCALIGNMENT",3425753595:"IFCTRACKELEMENT",991950508:"IFCSIGNAL",3798194928:"IFCREINFORCEDSOIL",3290496277:"IFCRAIL",1383356374:"IFCPAVEMENT",2182337498:"IFCNAVIGATIONELEMENT",234836483:"IFCMOORINGDEVICE",2078563270:"IFCMOBILETELECOMMUNICATIONSAPPLIANCE",1638804497:"IFCLIQUIDTERMINAL",1154579445:"IFCLINEARPOSITIONINGELEMENT",2696325953:"IFCKERB",2713699986:"IFCGEOTECHNICALASSEMBLY",2142170206:"IFCELECTRICFLOWTREATMENTDEVICETYPE",3376911765:"IFCEARTHWORKSFILL",1077100507:"IFCEARTHWORKSELEMENT",3071239417:"IFCEARTHWORKSCUT",479945903:"IFCDISTRIBUTIONBOARDTYPE",3426335179:"IFCDEEPFOUNDATION",1502416096:"IFCCOURSE",2940368186:"IFCCONVEYORSEGMENTTYPE",3203706013:"IFCCAISSONFOUNDATIONTYPE",3862327254:"IFCBUILTSYSTEM",1876633798:"IFCBUILTELEMENT",963979645:"IFCBRIDGEPART",644574406:"IFCBRIDGE",3649138523:"IFCBEARINGTYPE",1662888072:"IFCALIGNMENTVERTICAL",317615605:"IFCALIGNMENTSEGMENT",1545765605:"IFCALIGNMENTHORIZONTAL",4266260250:"IFCALIGNMENTCANT",3956297820:"IFCVIBRATIONDAMPERTYPE",1530820697:"IFCVIBRATIONDAMPER",840318589:"IFCVEHICLE",1953115116:"IFCTRANSPORTATIONDEVICE",618700268:"IFCTRACKELEMENTTYPE",2281632017:"IFCTENDONCONDUITTYPE",3663046924:"IFCTENDONCONDUIT",42703149:"IFCSINESPIRAL",1894708472:"IFCSIGNALTYPE",3599934289:"IFCSIGNTYPE",33720170:"IFCSIGN",1027922057:"IFCSEVENTHORDERPOLYNOMIALSPIRAL",544395925:"IFCSEGMENTEDREFERENCECURVE",3649235739:"IFCSECONDORDERPOLYNOMIALSPIRAL",550521510:"IFCROADPART",146592293:"IFCROAD",3818125796:"IFCRELADHERESTOELEMENT",4021432810:"IFCREFERENT",1891881377:"IFCRAILWAYPART",3992365140:"IFCRAILWAY",1763565496:"IFCRAILTYPE",1946335990:"IFCPOSITIONINGELEMENT",514975943:"IFCPAVEMENTTYPE",506776471:"IFCNAVIGATIONELEMENTTYPE",710110818:"IFCMOORINGDEVICETYPE",1950438474:"IFCMOBILETELECOMMUNICATIONSAPPLIANCETYPE",976884017:"IFCMARINEPART",525669439:"IFCMARINEFACILITY",1770583370:"IFCLIQUIDTERMINALTYPE",2176059722:"IFCLINEARELEMENT",679976338:"IFCKERBTYPE",3948183225:"IFCIMPACTPROTECTIONDEVICETYPE",2568555532:"IFCIMPACTPROTECTIONDEVICE",2898700619:"IFCGRADIENTCURVE",1594536857:"IFCGEOTECHNICALSTRATUM",4230923436:"IFCGEOTECHNICALELEMENT",4228831410:"IFCFACILITYPARTCOMMON",1310830890:"IFCFACILITYPART",24185140:"IFCFACILITY",4234616927:"IFCDIRECTRIXDERIVEDREFERENCESWEPTAREASOLID",1306400036:"IFCDEEPFOUNDATIONTYPE",4189326743:"IFCCOURSETYPE",2000195564:"IFCCOSINESPIRAL",3497074424:"IFCCLOTHOID",1626504194:"IFCBUILTELEMENTTYPE",3651464721:"IFCVEHICLETYPE",1229763772:"IFCTRIANGULATEDIRREGULARNETWORK",3665877780:"IFCTRANSPORTATIONDEVICETYPE",782932809:"IFCTHIRDORDERPOLYNOMIALSPIRAL",2735484536:"IFCSPIRAL",1356537516:"IFCSECTIONEDSURFACE",1290935644:"IFCSECTIONEDSOLIDHORIZONTAL",1862484736:"IFCSECTIONEDSOLID",1441486842:"IFCRELPOSITIONS",1033248425:"IFCRELASSOCIATESPROFILEDEF",3381221214:"IFCPOLYNOMIALCURVE",2485787929:"IFCOFFSETCURVEBYDISTANCES",590820931:"IFCOFFSETCURVE",3465909080:"IFCINDEXEDPOLYGONALTEXTUREMAP",593015953:"IFCDIRECTRIXCURVESWEPTAREASOLID",4212018352:"IFCCURVESEGMENT",3425423356:"IFCAXIS2PLACEMENTLINEAR",823603102:"IFCSEGMENT",2165702409:"IFCPOINTBYDISTANCEEXPRESSION",182550632:"IFCOPENCROSSPROFILEDEF",388784114:"IFCLINEARPLACEMENT",536804194:"IFCALIGNMENTHORIZONTALSEGMENT",3752311538:"IFCALIGNMENTCANTSEGMENT",1010789467:"IFCTEXTURECOORDINATEINDICESWITHVOIDS",222769930:"IFCTEXTURECOORDINATEINDICES",2691318326:"IFCQUANTITYNUMBER",3633395639:"IFCALIGNMENTVERTICALSEGMENT",2879124712:"IFCALIGNMENTPARAMETERSEGMENT",25142252:"IFCCONTROLLER",3087945054:"IFCALARM",4288193352:"IFCACTUATOR",630975310:"IFCUNITARYCONTROLELEMENT",4086658281:"IFCSENSOR",2295281155:"IFCPROTECTIVEDEVICETRIPPINGUNIT",182646315:"IFCFLOWINSTRUMENT",1426591983:"IFCFIRESUPPRESSIONTERMINAL",819412036:"IFCFILTER",3415622556:"IFCFAN",1003880860:"IFCELECTRICTIMECONTROL",402227799:"IFCELECTRICMOTOR",264262732:"IFCELECTRICGENERATOR",3310460725:"IFCELECTRICFLOWSTORAGEDEVICE",862014818:"IFCELECTRICDISTRIBUTIONBOARD",1904799276:"IFCELECTRICAPPLIANCE",1360408905:"IFCDUCTSILENCER",3518393246:"IFCDUCTSEGMENT",342316401:"IFCDUCTFITTING",562808652:"IFCDISTRIBUTIONCIRCUIT",4074379575:"IFCDAMPER",3640358203:"IFCCOOLINGTOWER",4136498852:"IFCCOOLEDBEAM",2272882330:"IFCCONDENSER",3571504051:"IFCCOMPRESSOR",3221913625:"IFCCOMMUNICATIONSAPPLIANCE",639361253:"IFCCOIL",3902619387:"IFCCHILLER",4217484030:"IFCCABLESEGMENT",1051757585:"IFCCABLEFITTING",3758799889:"IFCCABLECARRIERSEGMENT",635142910:"IFCCABLECARRIERFITTING",2938176219:"IFCBURNER",32344328:"IFCBOILER",2906023776:"IFCBEAMSTANDARDCASE",277319702:"IFCAUDIOVISUALAPPLIANCE",2056796094:"IFCAIRTOAIRHEATRECOVERY",177149247:"IFCAIRTERMINALBOX",1634111441:"IFCAIRTERMINAL",486154966:"IFCWINDOWSTANDARDCASE",4237592921:"IFCWASTETERMINAL",4156078855:"IFCWALLELEMENTEDCASE",4207607924:"IFCVALVE",4292641817:"IFCUNITARYEQUIPMENT",3179687236:"IFCUNITARYCONTROLELEMENTTYPE",3026737570:"IFCTUBEBUNDLE",3825984169:"IFCTRANSFORMER",812556717:"IFCTANK",1162798199:"IFCSWITCHINGDEVICE",385403989:"IFCSTRUCTURALLOADCASE",1404847402:"IFCSTACKTERMINAL",1999602285:"IFCSPACEHEATER",3420628829:"IFCSOLARDEVICE",3027962421:"IFCSLABSTANDARDCASE",3127900445:"IFCSLABELEMENTEDCASE",1329646415:"IFCSHADINGDEVICE",3053780830:"IFCSANITARYTERMINAL",2572171363:"IFCREINFORCINGBARTYPE",1232101972:"IFCRATIONALBSPLINECURVEWITHKNOTS",90941305:"IFCPUMP",655969474:"IFCPROTECTIVEDEVICETRIPPINGUNITTYPE",738039164:"IFCPROTECTIVEDEVICE",1156407060:"IFCPLATESTANDARDCASE",3612865200:"IFCPIPESEGMENT",310824031:"IFCPIPEFITTING",3694346114:"IFCOUTLET",144952367:"IFCOUTERBOUNDARYCURVE",2474470126:"IFCMOTORCONNECTION",1911478936:"IFCMEMBERSTANDARDCASE",1437502449:"IFCMEDICALDEVICE",629592764:"IFCLIGHTFIXTURE",76236018:"IFCLAMP",2176052936:"IFCJUNCTIONBOX",4175244083:"IFCINTERCEPTOR",2068733104:"IFCHUMIDIFIER",3319311131:"IFCHEATEXCHANGER",2188021234:"IFCFLOWMETER",1209101575:"IFCEXTERNALSPATIALELEMENT",484807127:"IFCEVAPORATOR",3747195512:"IFCEVAPORATIVECOOLER",2814081492:"IFCENGINE",2417008758:"IFCELECTRICDISTRIBUTIONBOARDTYPE",3242481149:"IFCDOORSTANDARDCASE",3205830791:"IFCDISTRIBUTIONSYSTEM",400855858:"IFCCOMMUNICATIONSAPPLIANCETYPE",905975707:"IFCCOLUMNSTANDARDCASE",1677625105:"IFCCIVILELEMENT",3296154744:"IFCCHIMNEY",2674252688:"IFCCABLEFITTINGTYPE",2188180465:"IFCBURNERTYPE",1177604601:"IFCBUILDINGSYSTEM",39481116:"IFCBUILDINGELEMENTPARTTYPE",1136057603:"IFCBOUNDARYCURVE",2461110595:"IFCBSPLINECURVEWITHKNOTS",1532957894:"IFCAUDIOVISUALAPPLIANCETYPE",4088093105:"IFCWORKCALENDAR",4009809668:"IFCWINDOWTYPE",926996030:"IFCVOIDINGFEATURE",2391383451:"IFCVIBRATIONISOLATOR",2415094496:"IFCTENDONTYPE",3081323446:"IFCTENDONANCHORTYPE",413509423:"IFCSYSTEMFURNITUREELEMENT",3101698114:"IFCSURFACEFEATURE",3657597509:"IFCSTRUCTURALSURFACEACTION",2757150158:"IFCSTRUCTURALCURVEREACTION",1004757350:"IFCSTRUCTURALCURVEACTION",338393293:"IFCSTAIRTYPE",1072016465:"IFCSOLARDEVICETYPE",4074543187:"IFCSHADINGDEVICETYPE",2157484638:"IFCSEAMCURVE",2781568857:"IFCROOFTYPE",2310774935:"IFCREINFORCINGMESHTYPE",964333572:"IFCREINFORCINGELEMENTTYPE",683857671:"IFCRATIONALBSPLINESURFACEWITHKNOTS",1469900589:"IFCRAMPTYPE",2839578677:"IFCPOLYGONALFACESET",1158309216:"IFCPILETYPE",3079942009:"IFCOPENINGSTANDARDCASE",1114901282:"IFCMEDICALDEVICETYPE",3113134337:"IFCINTERSECTIONCURVE",3946677679:"IFCINTERCEPTORTYPE",2571569899:"IFCINDEXEDPOLYCURVE",3493046030:"IFCGEOGRAPHICELEMENT",1509553395:"IFCFURNITURE",1893162501:"IFCFOOTINGTYPE",2853485674:"IFCEXTERNALSPATIALSTRUCTUREELEMENT",4148101412:"IFCEVENT",132023988:"IFCENGINETYPE",2397081782:"IFCELEMENTASSEMBLYTYPE",2323601079:"IFCDOORTYPE",1213902940:"IFCCYLINDRICALSURFACE",1525564444:"IFCCONSTRUCTIONPRODUCTRESOURCETYPE",4105962743:"IFCCONSTRUCTIONMATERIALRESOURCETYPE",2185764099:"IFCCONSTRUCTIONEQUIPMENTRESOURCETYPE",15328376:"IFCCOMPOSITECURVEONSURFACE",3875453745:"IFCCOMPLEXPROPERTYTEMPLATE",3893394355:"IFCCIVILELEMENTTYPE",2197970202:"IFCCHIMNEYTYPE",167062518:"IFCBSPLINESURFACEWITHKNOTS",2887950389:"IFCBSPLINESURFACE",2603310189:"IFCADVANCEDBREPWITHVOIDS",1635779807:"IFCADVANCEDBREP",2916149573:"IFCTRIANGULATEDFACESET",1935646853:"IFCTOROIDALSURFACE",2387106220:"IFCTESSELLATEDFACESET",3206491090:"IFCTASKTYPE",699246055:"IFCSURFACECURVE",4095615324:"IFCSUBCONTRACTRESOURCETYPE",603775116:"IFCSTRUCTURALSURFACEREACTION",4015995234:"IFCSPHERICALSURFACE",2481509218:"IFCSPATIALZONETYPE",463610769:"IFCSPATIALZONE",710998568:"IFCSPATIALELEMENTTYPE",1412071761:"IFCSPATIALELEMENT",3663146110:"IFCSIMPLEPROPERTYTEMPLATE",3243963512:"IFCREVOLVEDAREASOLIDTAPERED",816062949:"IFCREPARAMETRISEDCOMPOSITECURVESEGMENT",1521410863:"IFCRELSPACEBOUNDARY2NDLEVEL",3523091289:"IFCRELSPACEBOUNDARY1STLEVEL",427948657:"IFCRELINTERFERESELEMENTS",307848117:"IFCRELDEFINESBYTEMPLATE",1462361463:"IFCRELDEFINESBYOBJECT",2565941209:"IFCRELDECLARES",1027710054:"IFCRELASSIGNSTOGROUPBYFACTOR",3521284610:"IFCPROPERTYTEMPLATE",492091185:"IFCPROPERTYSETTEMPLATE",653396225:"IFCPROJECTLIBRARY",569719735:"IFCPROCEDURETYPE",3967405729:"IFCPREDEFINEDPROPERTYSET",1682466193:"IFCPCURVE",428585644:"IFCLABORRESOURCETYPE",2294589976:"IFCINDEXEDPOLYGONALFACEWITHVOIDS",178912537:"IFCINDEXEDPOLYGONALFACE",4095422895:"IFCGEOGRAPHICELEMENTTYPE",2652556860:"IFCFIXEDREFERENCESWEPTAREASOLID",2804161546:"IFCEXTRUDEDAREASOLIDTAPERED",4024345920:"IFCEVENTTYPE",2629017746:"IFCCURVEBOUNDEDSURFACE",1815067380:"IFCCREWRESOURCETYPE",3419103109:"IFCCONTEXT",2574617495:"IFCCONSTRUCTIONRESOURCETYPE",2059837836:"IFCCARTESIANPOINTLIST3D",1675464909:"IFCCARTESIANPOINTLIST2D",574549367:"IFCCARTESIANPOINTLIST",3406155212:"IFCADVANCEDFACE",3698973494:"IFCTYPERESOURCE",3736923433:"IFCTYPEPROCESS",901063453:"IFCTESSELLATEDITEM",1096409881:"IFCSWEPTDISKSOLIDPOLYGONAL",1042787934:"IFCRESOURCETIME",1608871552:"IFCRESOURCECONSTRAINTRELATIONSHIP",2943643501:"IFCRESOURCEAPPROVALRELATIONSHIP",2090586900:"IFCQUANTITYSET",1482703590:"IFCPROPERTYTEMPLATEDEFINITION",3778827333:"IFCPREDEFINEDPROPERTIES",2998442950:"IFCMIRROREDPROFILEDEF",853536259:"IFCMATERIALRELATIONSHIP",3404854881:"IFCMATERIALPROFILESETUSAGETAPERING",3079605661:"IFCMATERIALPROFILESETUSAGE",2852063980:"IFCMATERIALCONSTITUENTSET",3708119e3:"IFCMATERIALCONSTITUENT",1585845231:"IFCLAGTIME",2133299955:"IFCINDEXEDTRIANGLETEXTUREMAP",1437953363:"IFCINDEXEDTEXTUREMAP",3570813810:"IFCINDEXEDCOLOURMAP",1437805879:"IFCEXTERNALREFERENCERELATIONSHIP",297599258:"IFCEXTENDEDPROPERTIES",211053100:"IFCEVENTTIME",2713554722:"IFCCONVERSIONBASEDUNITWITHOFFSET",3285139300:"IFCCOLOURRGBLIST",1236880293:"IFCWORKTIME",1199560280:"IFCTIMEPERIOD",3611470254:"IFCTEXTUREVERTEXLIST",2771591690:"IFCTASKTIMERECURRING",1549132990:"IFCTASKTIME",2043862942:"IFCTABLECOLUMN",2934153892:"IFCSURFACEREINFORCEMENTAREA",609421318:"IFCSTRUCTURALLOADORRESULT",3478079324:"IFCSTRUCTURALLOADCONFIGURATION",1054537805:"IFCSCHEDULINGTIME",2439245199:"IFCRESOURCELEVELRELATIONSHIP",2433181523:"IFCREFERENCE",3915482550:"IFCRECURRENCEPATTERN",986844984:"IFCPROPERTYABSTRACTION",3843373140:"IFCPROJECTEDCRS",677532197:"IFCPRESENTATIONITEM",1507914824:"IFCMATERIALUSAGEDEFINITION",552965576:"IFCMATERIALPROFILEWITHOFFSETS",164193824:"IFCMATERIALPROFILESET",2235152071:"IFCMATERIALPROFILE",1847252529:"IFCMATERIALLAYERWITHOFFSETS",760658860:"IFCMATERIALDEFINITION",3057273783:"IFCMAPCONVERSION",4294318154:"IFCEXTERNALINFORMATION",1466758467:"IFCCOORDINATEREFERENCESYSTEM",1785450214:"IFCCOORDINATEOPERATION",775493141:"IFCCONNECTIONVOLUMEGEOMETRY",979691226:"IFCREINFORCINGBAR",3700593921:"IFCELECTRICDISTRIBUTIONPOINT",1062813311:"IFCDISTRIBUTIONCONTROLELEMENT",1052013943:"IFCDISTRIBUTIONCHAMBERELEMENT",578613899:"IFCCONTROLLERTYPE",2454782716:"IFCCHAMFEREDGEFEATURE",753842376:"IFCBEAM",3001207471:"IFCALARMTYPE",2874132201:"IFCACTUATORTYPE",3304561284:"IFCWINDOW",3512223829:"IFCWALLSTANDARDCASE",2391406946:"IFCWALL",3313531582:"IFCVIBRATIONISOLATORTYPE",2347447852:"IFCTENDONANCHOR",3824725483:"IFCTENDON",2515109513:"IFCSTRUCTURALANALYSISMODEL",4252922144:"IFCSTAIRFLIGHT",331165859:"IFCSTAIR",1529196076:"IFCSLAB",1783015770:"IFCSENSORTYPE",1376911519:"IFCROUNDEDEDGEFEATURE",2016517767:"IFCROOF",2320036040:"IFCREINFORCINGMESH",3027567501:"IFCREINFORCINGELEMENT",3055160366:"IFCRATIONALBEZIERCURVE",3283111854:"IFCRAMPFLIGHT",3024970846:"IFCRAMP",2262370178:"IFCRAILING",3171933400:"IFCPLATE",1687234759:"IFCPILE",1073191201:"IFCMEMBER",900683007:"IFCFOOTING",3508470533:"IFCFLOWTREATMENTDEVICE",2223149337:"IFCFLOWTERMINAL",707683696:"IFCFLOWSTORAGEDEVICE",987401354:"IFCFLOWSEGMENT",3132237377:"IFCFLOWMOVINGDEVICE",4037862832:"IFCFLOWINSTRUMENTTYPE",4278956645:"IFCFLOWFITTING",2058353004:"IFCFLOWCONTROLLER",4222183408:"IFCFIRESUPPRESSIONTERMINALTYPE",1810631287:"IFCFILTERTYPE",346874300:"IFCFANTYPE",1658829314:"IFCENERGYCONVERSIONDEVICE",857184966:"IFCELECTRICALELEMENT",1634875225:"IFCELECTRICALCIRCUIT",712377611:"IFCELECTRICTIMECONTROLTYPE",1217240411:"IFCELECTRICMOTORTYPE",1365060375:"IFCELECTRICHEATERTYPE",1534661035:"IFCELECTRICGENERATORTYPE",3277789161:"IFCELECTRICFLOWSTORAGEDEVICETYPE",663422040:"IFCELECTRICAPPLIANCETYPE",855621170:"IFCEDGEFEATURE",2030761528:"IFCDUCTSILENCERTYPE",3760055223:"IFCDUCTSEGMENTTYPE",869906466:"IFCDUCTFITTINGTYPE",395920057:"IFCDOOR",3041715199:"IFCDISTRIBUTIONPORT",3040386961:"IFCDISTRIBUTIONFLOWELEMENT",1945004755:"IFCDISTRIBUTIONELEMENT",2063403501:"IFCDISTRIBUTIONCONTROLELEMENTTYPE",1599208980:"IFCDISTRIBUTIONCHAMBERELEMENTTYPE",2635815018:"IFCDISCRETEACCESSORYTYPE",1335981549:"IFCDISCRETEACCESSORY",4147604152:"IFCDIAMETERDIMENSION",3961806047:"IFCDAMPERTYPE",3495092785:"IFCCURTAINWALL",1973544240:"IFCCOVERING",2954562838:"IFCCOOLINGTOWERTYPE",335055490:"IFCCOOLEDBEAMTYPE",488727124:"IFCCONSTRUCTIONPRODUCTRESOURCE",1060000209:"IFCCONSTRUCTIONMATERIALRESOURCE",3898045240:"IFCCONSTRUCTIONEQUIPMENTRESOURCE",1163958913:"IFCCONDITIONCRITERION",2188551683:"IFCCONDITION",2816379211:"IFCCONDENSERTYPE",3850581409:"IFCCOMPRESSORTYPE",843113511:"IFCCOLUMN",2301859152:"IFCCOILTYPE",2611217952:"IFCCIRCLE",2951183804:"IFCCHILLERTYPE",1285652485:"IFCCABLESEGMENTTYPE",3293546465:"IFCCABLECARRIERSEGMENTTYPE",395041908:"IFCCABLECARRIERFITTINGTYPE",1909888760:"IFCBUILDINGELEMENTPROXYTYPE",1095909175:"IFCBUILDINGELEMENTPROXY",2979338954:"IFCBUILDINGELEMENTPART",52481810:"IFCBUILDINGELEMENTCOMPONENT",3299480353:"IFCBUILDINGELEMENT",231477066:"IFCBOILERTYPE",1916977116:"IFCBEZIERCURVE",819618141:"IFCBEAMTYPE",1967976161:"IFCBSPLINECURVE",3460190687:"IFCASSET",2470393545:"IFCANGULARDIMENSION",1871374353:"IFCAIRTOAIRHEATRECOVERYTYPE",3352864051:"IFCAIRTERMINALTYPE",1411407467:"IFCAIRTERMINALBOXTYPE",3821786052:"IFCACTIONREQUEST",1213861670:"IFC2DCOMPOSITECURVE",1033361043:"IFCZONE",3342526732:"IFCWORKSCHEDULE",4218914973:"IFCWORKPLAN",1028945134:"IFCWORKCONTROL",1133259667:"IFCWASTETERMINALTYPE",1898987631:"IFCWALLTYPE",2769231204:"IFCVIRTUALELEMENT",728799441:"IFCVALVETYPE",1911125066:"IFCUNITARYEQUIPMENTTYPE",1600972822:"IFCTUBEBUNDLETYPE",3593883385:"IFCTRIMMEDCURVE",1620046519:"IFCTRANSPORTELEMENT",1692211062:"IFCTRANSFORMERTYPE",1637806684:"IFCTIMESERIESSCHEDULE",5716631:"IFCTANKTYPE",2254336722:"IFCSYSTEM",2315554128:"IFCSWITCHINGDEVICETYPE",148013059:"IFCSUBCONTRACTRESOURCE",1975003073:"IFCSTRUCTURALSURFACECONNECTION",2986769608:"IFCSTRUCTURALRESULTGROUP",1235345126:"IFCSTRUCTURALPOINTREACTION",734778138:"IFCSTRUCTURALPOINTCONNECTION",2082059205:"IFCSTRUCTURALPOINTACTION",3987759626:"IFCSTRUCTURALPLANARACTIONVARYING",1621171031:"IFCSTRUCTURALPLANARACTION",1252848954:"IFCSTRUCTURALLOADGROUP",1721250024:"IFCSTRUCTURALLINEARACTIONVARYING",1807405624:"IFCSTRUCTURALLINEARACTION",2445595289:"IFCSTRUCTURALCURVEMEMBERVARYING",214636428:"IFCSTRUCTURALCURVEMEMBER",4243806635:"IFCSTRUCTURALCURVECONNECTION",1179482911:"IFCSTRUCTURALCONNECTION",682877961:"IFCSTRUCTURALACTION",1039846685:"IFCSTAIRFLIGHTTYPE",3112655638:"IFCSTACKTERMINALTYPE",3812236995:"IFCSPACETYPE",652456506:"IFCSPACEPROGRAM",1305183839:"IFCSPACEHEATERTYPE",3856911033:"IFCSPACE",2533589738:"IFCSLABTYPE",4097777520:"IFCSITE",4105383287:"IFCSERVICELIFE",3517283431:"IFCSCHEDULETIMECONTROL",1768891740:"IFCSANITARYTERMINALTYPE",2863920197:"IFCRELASSIGNSTASKS",160246688:"IFCRELAGGREGATES",2324767716:"IFCRAMPFLIGHTTYPE",2893384427:"IFCRAILINGTYPE",3248260540:"IFCRADIUSDIMENSION",2250791053:"IFCPUMPTYPE",1842657554:"IFCPROTECTIVEDEVICETYPE",3651124850:"IFCPROJECTIONELEMENT",3642467123:"IFCPROJECTORDERRECORD",2904328755:"IFCPROJECTORDER",2744685151:"IFCPROCEDURE",3740093272:"IFCPORT",3724593414:"IFCPOLYLINE",4017108033:"IFCPLATETYPE",4231323485:"IFCPIPESEGMENTTYPE",804291784:"IFCPIPEFITTINGTYPE",3327091369:"IFCPERMIT",2382730787:"IFCPERFORMANCEHISTORY",2837617999:"IFCOUTLETTYPE",3425660407:"IFCORDERACTION",3588315303:"IFCOPENINGELEMENT",4143007308:"IFCOCCUPANT",1916936684:"IFCMOVE",977012517:"IFCMOTORCONNECTIONTYPE",3181161470:"IFCMEMBERTYPE",2108223431:"IFCMECHANICALFASTENERTYPE",377706215:"IFCMECHANICALFASTENER",2506943328:"IFCLINEARDIMENSION",1161773419:"IFCLIGHTFIXTURETYPE",1051575348:"IFCLAMPTYPE",3827777499:"IFCLABORRESOURCE",4288270099:"IFCJUNCTIONBOXTYPE",2391368822:"IFCINVENTORY",1806887404:"IFCHUMIDIFIERTYPE",1251058090:"IFCHEATEXCHANGERTYPE",2706460486:"IFCGROUP",3009204131:"IFCGRID",200128114:"IFCGASTERMINALTYPE",814719939:"IFCFURNITURESTANDARD",263784265:"IFCFURNISHINGELEMENT",3009222698:"IFCFLOWTREATMENTDEVICETYPE",2297155007:"IFCFLOWTERMINALTYPE",1339347760:"IFCFLOWSTORAGEDEVICETYPE",1834744321:"IFCFLOWSEGMENTTYPE",1482959167:"IFCFLOWMOVINGDEVICETYPE",3815607619:"IFCFLOWMETERTYPE",3198132628:"IFCFLOWFITTINGTYPE",3907093117:"IFCFLOWCONTROLLERTYPE",1287392070:"IFCFEATUREELEMENTSUBTRACTION",2143335405:"IFCFEATUREELEMENTADDITION",2827207264:"IFCFEATUREELEMENT",2489546625:"IFCFASTENERTYPE",647756555:"IFCFASTENER",3737207727:"IFCFACETEDBREPWITHVOIDS",807026263:"IFCFACETEDBREP",3390157468:"IFCEVAPORATORTYPE",3174744832:"IFCEVAPORATIVECOOLERTYPE",3272907226:"IFCEQUIPMENTSTANDARD",1962604670:"IFCEQUIPMENTELEMENT",2107101300:"IFCENERGYCONVERSIONDEVICETYPE",1704287377:"IFCELLIPSE",2590856083:"IFCELEMENTCOMPONENTTYPE",1623761950:"IFCELEMENTCOMPONENT",4123344466:"IFCELEMENTASSEMBLY",1758889154:"IFCELEMENT",360485395:"IFCELECTRICALBASEPROPERTIES",3849074793:"IFCDISTRIBUTIONFLOWELEMENTTYPE",3256556792:"IFCDISTRIBUTIONELEMENTTYPE",681481545:"IFCDIMENSIONCURVEDIRECTEDCALLOUT",1457835157:"IFCCURTAINWALLTYPE",3295246426:"IFCCREWRESOURCE",1916426348:"IFCCOVERINGTYPE",1419761937:"IFCCOSTSCHEDULE",3895139033:"IFCCOSTITEM",3293443760:"IFCCONTROL",2559216714:"IFCCONSTRUCTIONRESOURCE",2510884976:"IFCCONIC",3732776249:"IFCCOMPOSITECURVE",300633059:"IFCCOLUMNTYPE",2937912522:"IFCCIRCLEHOLLOWPROFILEDEF",3124254112:"IFCBUILDINGSTOREY",1950629157:"IFCBUILDINGELEMENTTYPE",4031249490:"IFCBUILDING",1260505505:"IFCBOUNDEDCURVE",3649129432:"IFCBOOLEANCLIPPINGRESULT",1334484129:"IFCBLOCK",3207858831:"IFCASYMMETRICISHAPEPROFILEDEF",1674181508:"IFCANNOTATION",2296667514:"IFCACTOR",2097647324:"IFCTRANSPORTELEMENTTYPE",3473067441:"IFCTASK",1580310250:"IFCSYSTEMFURNITUREELEMENTTYPE",4124788165:"IFCSURFACEOFREVOLUTION",2809605785:"IFCSURFACEOFLINEAREXTRUSION",2028607225:"IFCSURFACECURVESWEPTAREASOLID",4070609034:"IFCSTRUCTUREDDIMENSIONCALLOUT",2218152070:"IFCSTRUCTURALSURFACEMEMBERVARYING",3979015343:"IFCSTRUCTURALSURFACEMEMBER",3689010777:"IFCSTRUCTURALREACTION",530289379:"IFCSTRUCTURALMEMBER",3136571912:"IFCSTRUCTURALITEM",3544373492:"IFCSTRUCTURALACTIVITY",451544542:"IFCSPHERE",3893378262:"IFCSPATIALSTRUCTUREELEMENTTYPE",2706606064:"IFCSPATIALSTRUCTUREELEMENT",3626867408:"IFCRIGHTCIRCULARCYLINDER",4158566097:"IFCRIGHTCIRCULARCONE",1856042241:"IFCREVOLVEDAREASOLID",2914609552:"IFCRESOURCE",1401173127:"IFCRELVOIDSELEMENT",3451746338:"IFCRELSPACEBOUNDARY",366585022:"IFCRELSERVICESBUILDINGS",4122056220:"IFCRELSEQUENCE",1058617721:"IFCRELSCHEDULESCOSTITEMS",1245217292:"IFCRELREFERENCEDINSPATIALSTRUCTURE",750771296:"IFCRELPROJECTSELEMENT",202636808:"IFCRELOVERRIDESPROPERTIES",2051452291:"IFCRELOCCUPIESSPACES",3268803585:"IFCRELNESTS",4189434867:"IFCRELINTERACTIONREQUIREMENTS",279856033:"IFCRELFLOWCONTROLELEMENTS",3940055652:"IFCRELFILLSELEMENT",781010003:"IFCRELDEFINESBYTYPE",4186316022:"IFCRELDEFINESBYPROPERTIES",693640335:"IFCRELDEFINES",2551354335:"IFCRELDECOMPOSES",2802773753:"IFCRELCOVERSSPACES",886880790:"IFCRELCOVERSBLDGELEMENTS",3242617779:"IFCRELCONTAINEDINSPATIALSTRUCTURE",3678494232:"IFCRELCONNECTSWITHREALIZINGELEMENTS",504942748:"IFCRELCONNECTSWITHECCENTRICITY",1638771189:"IFCRELCONNECTSSTRUCTURALMEMBER",3912681535:"IFCRELCONNECTSSTRUCTURALELEMENT",2127690289:"IFCRELCONNECTSSTRUCTURALACTIVITY",3190031847:"IFCRELCONNECTSPORTS",4201705270:"IFCRELCONNECTSPORTTOELEMENT",3945020480:"IFCRELCONNECTSPATHELEMENTS",1204542856:"IFCRELCONNECTSELEMENTS",826625072:"IFCRELCONNECTS",2851387026:"IFCRELASSOCIATESPROFILEPROPERTIES",2655215786:"IFCRELASSOCIATESMATERIAL",3840914261:"IFCRELASSOCIATESLIBRARY",982818633:"IFCRELASSOCIATESDOCUMENT",2728634034:"IFCRELASSOCIATESCONSTRAINT",919958153:"IFCRELASSOCIATESCLASSIFICATION",4095574036:"IFCRELASSOCIATESAPPROVAL",1327628568:"IFCRELASSOCIATESAPPLIEDVALUE",1865459582:"IFCRELASSOCIATES",205026976:"IFCRELASSIGNSTORESOURCE",3372526763:"IFCRELASSIGNSTOPROJECTORDER",2857406711:"IFCRELASSIGNSTOPRODUCT",4278684876:"IFCRELASSIGNSTOPROCESS",1307041759:"IFCRELASSIGNSTOGROUP",2495723537:"IFCRELASSIGNSTOCONTROL",1683148259:"IFCRELASSIGNSTOACTOR",3939117080:"IFCRELASSIGNS",3454111270:"IFCRECTANGULARTRIMMEDSURFACE",2798486643:"IFCRECTANGULARPYRAMID",2770003689:"IFCRECTANGLEHOLLOWPROFILEDEF",3219374653:"IFCPROXY",1451395588:"IFCPROPERTYSET",4194566429:"IFCPROJECTIONCURVE",103090709:"IFCPROJECT",4208778838:"IFCPRODUCT",2945172077:"IFCPROCESS",220341763:"IFCPLANE",603570806:"IFCPLANARBOX",3566463478:"IFCPERMEABLECOVERINGPROPERTIES",3505215534:"IFCOFFSETCURVE3D",3388369263:"IFCOFFSETCURVE2D",3888040117:"IFCOBJECT",1425443689:"IFCMANIFOLDSOLIDBREP",1281925730:"IFCLINE",572779678:"IFCLSHAPEPROFILEDEF",1484403080:"IFCISHAPEPROFILEDEF",987898635:"IFCGEOMETRICCURVESET",1268542332:"IFCFURNITURETYPE",4238390223:"IFCFURNISHINGELEMENTTYPE",3455213021:"IFCFLUIDFLOWPROPERTIES",315944413:"IFCFILLAREASTYLETILES",4203026998:"IFCFILLAREASTYLETILESYMBOLWITHSTYLE",374418227:"IFCFILLAREASTYLEHATCHING",2047409740:"IFCFACEBASEDSURFACEMODEL",477187591:"IFCEXTRUDEDAREASOLID",80994333:"IFCENERGYPROPERTIES",2835456948:"IFCELLIPSEPROFILEDEF",2777663545:"IFCELEMENTARYSURFACE",339256511:"IFCELEMENTTYPE",1883228015:"IFCELEMENTQUANTITY",1472233963:"IFCEDGELOOP",4006246654:"IFCDRAUGHTINGPREDEFINEDCURVEFONT",445594917:"IFCDRAUGHTINGPREDEFINEDCOLOUR",3073041342:"IFCDRAUGHTINGCALLOUT",526551008:"IFCDOORSTYLE",1714330368:"IFCDOORPANELPROPERTIES",2963535650:"IFCDOORLININGPROPERTIES",32440307:"IFCDIRECTION",4054601972:"IFCDIMENSIONCURVETERMINATOR",606661476:"IFCDIMENSIONCURVE",693772133:"IFCDEFINEDSYMBOL",2827736869:"IFCCURVEBOUNDEDPLANE",2601014836:"IFCCURVE",2147822146:"IFCCSGSOLID",2506170314:"IFCCSGPRIMITIVE3D",194851669:"IFCCRANERAILFSHAPEPROFILEDEF",4133800736:"IFCCRANERAILASHAPEPROFILEDEF",2485617015:"IFCCOMPOSITECURVESEGMENT",2205249479:"IFCCLOSEDSHELL",1383045692:"IFCCIRCLEPROFILEDEF",1416205885:"IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM",3331915920:"IFCCARTESIANTRANSFORMATIONOPERATOR3D",3486308946:"IFCCARTESIANTRANSFORMATIONOPERATOR2DNONUNIFORM",3749851601:"IFCCARTESIANTRANSFORMATIONOPERATOR2D",59481748:"IFCCARTESIANTRANSFORMATIONOPERATOR",1123145078:"IFCCARTESIANPOINT",2898889636:"IFCCSHAPEPROFILEDEF",2713105998:"IFCBOXEDHALFSPACE",2581212453:"IFCBOUNDINGBOX",4182860854:"IFCBOUNDEDSURFACE",2736907675:"IFCBOOLEANRESULT",2740243338:"IFCAXIS2PLACEMENT3D",3125803723:"IFCAXIS2PLACEMENT2D",4261334040:"IFCAXIS1PLACEMENT",1302238472:"IFCANNOTATIONSURFACE",2265737646:"IFCANNOTATIONFILLAREAOCCURRENCE",669184980:"IFCANNOTATIONFILLAREA",3288037868:"IFCANNOTATIONCURVEOCCURRENCE",2543172580:"IFCZSHAPEPROFILEDEF",1299126871:"IFCWINDOWSTYLE",512836454:"IFCWINDOWPANELPROPERTIES",336235671:"IFCWINDOWLININGPROPERTIES",2759199220:"IFCVERTEXLOOP",1417489154:"IFCVECTOR",427810014:"IFCUSHAPEPROFILEDEF",2347495698:"IFCTYPEPRODUCT",1628702193:"IFCTYPEOBJECT",1345879162:"IFCTWODIRECTIONREPEATFACTOR",2715220739:"IFCTRAPEZIUMPROFILEDEF",3124975700:"IFCTEXTLITERALWITHEXTENT",4282788508:"IFCTEXTLITERAL",3028897424:"IFCTERMINATORSYMBOL",3071757647:"IFCTSHAPEPROFILEDEF",230924584:"IFCSWEPTSURFACE",1260650574:"IFCSWEPTDISKSOLID",2247615214:"IFCSWEPTAREASOLID",1878645084:"IFCSURFACESTYLERENDERING",2513912981:"IFCSURFACE",2233826070:"IFCSUBEDGE",3653947884:"IFCSTRUCTURALSTEELPROFILEPROPERTIES",3843319758:"IFCSTRUCTURALPROFILEPROPERTIES",1190533807:"IFCSTRUCTURALLOADSINGLEFORCEWARPING",1597423693:"IFCSTRUCTURALLOADSINGLEFORCE",1973038258:"IFCSTRUCTURALLOADSINGLEDISPLACEMENTDISTORTION",2473145415:"IFCSTRUCTURALLOADSINGLEDISPLACEMENT",2668620305:"IFCSTRUCTURALLOADPLANARFORCE",1595516126:"IFCSTRUCTURALLOADLINEARFORCE",390701378:"IFCSPACETHERMALLOADPROPERTIES",1202362311:"IFCSOUNDVALUE",2485662743:"IFCSOUNDPROPERTIES",723233188:"IFCSOLIDMODEL",2609359061:"IFCSLIPPAGECONNECTIONCONDITION",4124623270:"IFCSHELLBASEDSURFACEMODEL",2411513650:"IFCSERVICELIFEFACTOR",1509187699:"IFCSECTIONEDSPINE",2778083089:"IFCROUNDEDRECTANGLEPROFILEDEF",478536968:"IFCRELATIONSHIP",3765753017:"IFCREINFORCEMENTDEFINITIONPROPERTIES",3413951693:"IFCREGULARTIMESERIES",3615266464:"IFCRECTANGLEPROFILEDEF",110355661:"IFCPROPERTYTABLEVALUE",3650150729:"IFCPROPERTYSINGLEVALUE",3357820518:"IFCPROPERTYSETDEFINITION",941946838:"IFCPROPERTYREFERENCEVALUE",2752243245:"IFCPROPERTYLISTVALUE",4166981789:"IFCPROPERTYENUMERATEDVALUE",1680319473:"IFCPROPERTYDEFINITION",871118103:"IFCPROPERTYBOUNDEDVALUE",673634403:"IFCPRODUCTDEFINITIONSHAPE",179317114:"IFCPREDEFINEDPOINTMARKERSYMBOL",433424934:"IFCPREDEFINEDDIMENSIONSYMBOL",2559016684:"IFCPREDEFINEDCURVEFONT",759155922:"IFCPREDEFINEDCOLOUR",2775532180:"IFCPOLYGONALBOUNDEDHALFSPACE",2924175390:"IFCPOLYLOOP",1423911732:"IFCPOINTONSURFACE",4022376103:"IFCPOINTONCURVE",2067069095:"IFCPOINT",1663979128:"IFCPLANAREXTENT",2004835150:"IFCPLACEMENT",597895409:"IFCPIXELTEXTURE",3021840470:"IFCPHYSICALCOMPLEXQUANTITY",2519244187:"IFCPATH",2529465313:"IFCPARAMETERIZEDPROFILEDEF",1029017970:"IFCORIENTEDEDGE",2665983363:"IFCOPENSHELL",2833995503:"IFCONEDIRECTIONREPEATFACTOR",219451334:"IFCOBJECTDEFINITION",1430189142:"IFCMECHANICALCONCRETEMATERIALPROPERTIES",2022407955:"IFCMATERIALDEFINITIONREPRESENTATION",2347385850:"IFCMAPPEDITEM",1008929658:"IFCLOOP",2624227202:"IFCLOCALPLACEMENT",3422422726:"IFCLIGHTSOURCESPOT",1520743889:"IFCLIGHTSOURCEPOSITIONAL",4266656042:"IFCLIGHTSOURCEGONIOMETRIC",2604431987:"IFCLIGHTSOURCEDIRECTIONAL",125510826:"IFCLIGHTSOURCEAMBIENT",1402838566:"IFCLIGHTSOURCE",3741457305:"IFCIRREGULARTIMESERIES",3905492369:"IFCIMAGETEXTURE",2445078500:"IFCHYGROSCOPICMATERIALPROPERTIES",812098782:"IFCHALFSPACESOLID",178086475:"IFCGRIDPLACEMENT",3590301190:"IFCGEOMETRICSET",4142052618:"IFCGEOMETRICREPRESENTATIONSUBCONTEXT",2453401579:"IFCGEOMETRICREPRESENTATIONITEM",3448662350:"IFCGEOMETRICREPRESENTATIONCONTEXT",1446786286:"IFCGENERALPROFILEPROPERTIES",803998398:"IFCGENERALMATERIALPROPERTIES",3857492461:"IFCFUELPROPERTIES",738692330:"IFCFILLAREASTYLE",4219587988:"IFCFAILURECONNECTIONCONDITION",3008276851:"IFCFACESURFACE",803316827:"IFCFACEOUTERBOUND",1809719519:"IFCFACEBOUND",2556980723:"IFCFACE",1860660968:"IFCEXTENDEDMATERIALPROPERTIES",476780140:"IFCEDGECURVE",3900360178:"IFCEDGE",4170525392:"IFCDRAUGHTINGPREDEFINEDTEXTFONT",3732053477:"IFCDOCUMENTREFERENCE",1694125774:"IFCDIMENSIONPAIR",2273265877:"IFCDIMENSIONCALLOUTRELATIONSHIP",3632507154:"IFCDERIVEDPROFILEDEF",3800577675:"IFCCURVESTYLE",2889183280:"IFCCONVERSIONBASEDUNIT",3050246964:"IFCCONTEXTDEPENDENTUNIT",45288368:"IFCCONNECTIONPOINTECCENTRICITY",1981873012:"IFCCONNECTIONCURVEGEOMETRY",370225590:"IFCCONNECTEDFACESET",1485152156:"IFCCOMPOSITEPROFILEDEF",2542286263:"IFCCOMPLEXPROPERTY",776857604:"IFCCOLOURRGB",647927063:"IFCCLASSIFICATIONREFERENCE",3150382593:"IFCCENTERLINEPROFILEDEF",616511568:"IFCBLOBTEXTURE",2705031697:"IFCARBITRARYPROFILEDEFWITHVOIDS",1310608509:"IFCARBITRARYOPENPROFILEDEF",3798115385:"IFCARBITRARYCLOSEDPROFILEDEF",2297822566:"IFCANNOTATIONTEXTOCCURRENCE",3612888222:"IFCANNOTATIONSYMBOLOCCURRENCE",962685235:"IFCANNOTATIONSURFACEOCCURRENCE",2442683028:"IFCANNOTATIONOCCURRENCE",1065908215:"IFCWATERPROPERTIES",891718957:"IFCVIRTUALGRIDINTERSECTION",1907098498:"IFCVERTEXPOINT",3304826586:"IFCVERTEXBASEDTEXTUREMAP",2799835756:"IFCVERTEX",180925521:"IFCUNITASSIGNMENT",1735638870:"IFCTOPOLOGYREPRESENTATION",1377556343:"IFCTOPOLOGICALREPRESENTATIONITEM",581633288:"IFCTIMESERIESVALUE",1718945513:"IFCTIMESERIESREFERENCERELATIONSHIP",3101149627:"IFCTIMESERIES",3317419933:"IFCTHERMALMATERIALPROPERTIES",1210645708:"IFCTEXTUREVERTEX",2552916305:"IFCTEXTUREMAP",1742049831:"IFCTEXTURECOORDINATEGENERATOR",280115917:"IFCTEXTURECOORDINATE",1484833681:"IFCTEXTSTYLEWITHBOXCHARACTERISTICS",1640371178:"IFCTEXTSTYLETEXTMODEL",2636378356:"IFCTEXTSTYLEFORDEFINEDFONT",1983826977:"IFCTEXTSTYLEFONTMODEL",1447204868:"IFCTEXTSTYLE",912023232:"IFCTELECOMADDRESS",531007025:"IFCTABLEROW",985171141:"IFCTABLE",1290481447:"IFCSYMBOLSTYLE",626085974:"IFCSURFACETEXTURE",1351298697:"IFCSURFACESTYLEWITHTEXTURES",846575682:"IFCSURFACESTYLESHADING",1607154358:"IFCSURFACESTYLEREFRACTION",3303107099:"IFCSURFACESTYLELIGHTING",1300840506:"IFCSURFACESTYLE",3049322572:"IFCSTYLEDREPRESENTATION",3958052878:"IFCSTYLEDITEM",2830218821:"IFCSTYLEMODEL",3408363356:"IFCSTRUCTURALLOADTEMPERATURE",2525727697:"IFCSTRUCTURALLOADSTATIC",2162789131:"IFCSTRUCTURALLOAD",2273995522:"IFCSTRUCTURALCONNECTIONCONDITION",3692461612:"IFCSIMPLEPROPERTY",4240577450:"IFCSHAPEREPRESENTATION",3982875396:"IFCSHAPEMODEL",867548509:"IFCSHAPEASPECT",4165799628:"IFCSECTIONREINFORCEMENTPROPERTIES",2042790032:"IFCSECTIONPROPERTIES",448429030:"IFCSIUNIT",2341007311:"IFCROOT",3679540991:"IFCRIBPLATEPROFILEPROPERTIES",1660063152:"IFCREPRESENTATIONMAP",3008791417:"IFCREPRESENTATIONITEM",3377609919:"IFCREPRESENTATIONCONTEXT",1076942058:"IFCREPRESENTATION",1222501353:"IFCRELAXATION",1580146022:"IFCREINFORCEMENTBARPROPERTIES",2692823254:"IFCREFERENCESVALUEDOCUMENT",825690147:"IFCQUANTITYWEIGHT",2405470396:"IFCQUANTITYVOLUME",3252649465:"IFCQUANTITYTIME",931644368:"IFCQUANTITYLENGTH",2093928680:"IFCQUANTITYCOUNT",2044713172:"IFCQUANTITYAREA",3710013099:"IFCPROPERTYENUMERATION",148025276:"IFCPROPERTYDEPENDENCYRELATIONSHIP",3896028662:"IFCPROPERTYCONSTRAINTRELATIONSHIP",2598011224:"IFCPROPERTY",2802850158:"IFCPROFILEPROPERTIES",3958567839:"IFCPROFILEDEF",2267347899:"IFCPRODUCTSOFCOMBUSTIONPROPERTIES",2095639259:"IFCPRODUCTREPRESENTATION",2417041796:"IFCPRESENTATIONSTYLEASSIGNMENT",3119450353:"IFCPRESENTATIONSTYLE",1304840413:"IFCPRESENTATIONLAYERWITHSTYLE",2022622350:"IFCPRESENTATIONLAYERASSIGNMENT",1775413392:"IFCPREDEFINEDTEXTFONT",3213052703:"IFCPREDEFINEDTERMINATORSYMBOL",990879717:"IFCPREDEFINEDSYMBOL",3727388367:"IFCPREDEFINEDITEM",3355820592:"IFCPOSTALADDRESS",2226359599:"IFCPHYSICALSIMPLEQUANTITY",2483315170:"IFCPHYSICALQUANTITY",101040310:"IFCPERSONANDORGANIZATION",2077209135:"IFCPERSON",1207048766:"IFCOWNERHISTORY",1411181986:"IFCORGANIZATIONRELATIONSHIP",4251960020:"IFCORGANIZATION",1227763645:"IFCOPTICALMATERIALPROPERTIES",2251480897:"IFCOBJECTIVE",3701648758:"IFCOBJECTPLACEMENT",1918398963:"IFCNAMEDUNIT",2706619895:"IFCMONETARYUNIT",3368373690:"IFCMETRIC",677618848:"IFCMECHANICALSTEELMATERIALPROPERTIES",4256014907:"IFCMECHANICALMATERIALPROPERTIES",2597039031:"IFCMEASUREWITHUNIT",3265635763:"IFCMATERIALPROPERTIES",2199411900:"IFCMATERIALLIST",1303795690:"IFCMATERIALLAYERSETUSAGE",3303938423:"IFCMATERIALLAYERSET",248100487:"IFCMATERIALLAYER",1847130766:"IFCMATERIALCLASSIFICATIONRELATIONSHIP",1838606355:"IFCMATERIAL",30780891:"IFCLOCALTIME",1566485204:"IFCLIGHTINTENSITYDISTRIBUTION",4162380809:"IFCLIGHTDISTRIBUTIONDATA",3452421091:"IFCLIBRARYREFERENCE",2655187982:"IFCLIBRARYINFORMATION",3020489413:"IFCIRREGULARTIMESERIESVALUE",852622518:"IFCGRIDAXIS",3548104201:"IFCEXTERNALLYDEFINEDTEXTFONT",3207319532:"IFCEXTERNALLYDEFINEDSYMBOL",1040185647:"IFCEXTERNALLYDEFINEDSURFACESTYLE",2242383968:"IFCEXTERNALLYDEFINEDHATCHSTYLE",3200245327:"IFCEXTERNALREFERENCE",1648886627:"IFCENVIRONMENTALIMPACTVALUE",3796139169:"IFCDRAUGHTINGCALLOUTRELATIONSHIP",770865208:"IFCDOCUMENTINFORMATIONRELATIONSHIP",1154170062:"IFCDOCUMENTINFORMATION",1376555844:"IFCDOCUMENTELECTRONICFORMAT",2949456006:"IFCDIMENSIONALEXPONENTS",1045800335:"IFCDERIVEDUNITELEMENT",1765591967:"IFCDERIVEDUNIT",1072939445:"IFCDATEANDTIME",3510044353:"IFCCURVESTYLEFONTPATTERN",2367409068:"IFCCURVESTYLEFONTANDSCALING",1105321065:"IFCCURVESTYLEFONT",539742890:"IFCCURRENCYRELATIONSHIP",602808272:"IFCCOSTVALUE",1065062679:"IFCCOORDINATEDUNIVERSALTIMEOFFSET",347226245:"IFCCONSTRAINTRELATIONSHIP",613356794:"IFCCONSTRAINTCLASSIFICATIONRELATIONSHIP",1658513725:"IFCCONSTRAINTAGGREGATIONRELATIONSHIP",1959218052:"IFCCONSTRAINT",2732653382:"IFCCONNECTIONSURFACEGEOMETRY",4257277454:"IFCCONNECTIONPORTGEOMETRY",2614616156:"IFCCONNECTIONPOINTGEOMETRY",2859738748:"IFCCONNECTIONGEOMETRY",3264961684:"IFCCOLOURSPECIFICATION",3639012971:"IFCCLASSIFICATIONNOTATIONFACET",938368621:"IFCCLASSIFICATIONNOTATION",1098599126:"IFCCLASSIFICATIONITEMRELATIONSHIP",1767535486:"IFCCLASSIFICATIONITEM",747523909:"IFCCLASSIFICATION",622194075:"IFCCALENDARDATE",2069777674:"IFCBOUNDARYNODECONDITIONWARPING",1387855156:"IFCBOUNDARYNODECONDITION",3367102660:"IFCBOUNDARYFACECONDITION",1560379544:"IFCBOUNDARYEDGECONDITION",4037036970:"IFCBOUNDARYCONDITION",3869604511:"IFCAPPROVALRELATIONSHIP",390851274:"IFCAPPROVALPROPERTYRELATIONSHIP",2080292479:"IFCAPPROVALACTORRELATIONSHIP",130549933:"IFCAPPROVAL",1110488051:"IFCAPPLIEDVALUERELATIONSHIP",411424972:"IFCAPPLIEDVALUE",639542469:"IFCAPPLICATION",618182010:"IFCADDRESS",3630933823:"IFCACTORROLE",599546466:"FILE_DESCRIPTION",1390159747:"FILE_NAME",1109904537:"FILE_SCHEMA"};class Pn{static async getUnits(e){var t,i,s;const{IFCUNITASSIGNMENT:n}=c,r=await e.getAllPropertiesOfType(n);if(!r)return 1;const o=Object.keys(r),a=r[parseInt(o[0],10)];for(const n of a.Units){if(void 0===n.value||null===n.value)continue;const r=await e.getProperties(n.value);if(!r||!r.UnitType||!r.UnitType.value)continue;if("LENGTHUNIT"!==r.UnitType.value)continue;let o=1,a=1;return"METRE"===r.Name.value&&(a=1),"FOOT"===r.Name.value&&(a=.3048),"MILLI"===(null==(t=r.Prefix)?void 0:t.value)?o=.001:"CENTI"===(null==(i=r.Prefix)?void 0:i.value)?o=.01:"DECI"===(null==(s=r.Prefix)?void 0:s.value)&&(o=.1),a*o}return 1}static async findItemByGuid(e,t){var i;const s=e.getAllPropertiesIDs();for(const n of s){const s=await e.getProperties(n);if(s&&(null==(i=s.GlobalId)?void 0:i.value)===t)return s}return null}static async getRelationMap(e,t,i){var s;const n=i??(async()=>{}),r={},o=e.getAllPropertiesIDs();for(const i of o){const o=await e.getProperties(i);if(!o)continue;const a=o.type===t,c=Object.keys(o).find((e=>e.startsWith("Relating"))),l=Object.keys(o).find((e=>e.startsWith("Related")));if(!(a&&c&&l))continue;const h=await e.getProperties(null==(s=o[c])?void 0:s.value),u=o[l];if(!h||!u)continue;if(!u||!Array.isArray(u))continue;const I=u.map((e=>e.value));await n(h.expressID,I),r[h.expressID]=I}return r}static async getQsetQuantities(e,t,i){const s=i??(()=>{}),n=await e.getProperties(t);if(!n||n.type!==c.IFCELEMENTQUANTITY)return null;return(n.Quantities??[{}]).map((e=>(e.value&&s(e.value),e.value))).filter((e=>null!==e))}static async getPsetProps(e,t,i){const s=i??(()=>{}),n=await e.getProperties(t);if(!n||n.type!==c.IFCPROPERTYSET)return null;return(n.HasProperties??[{}]).map((e=>(e.value&&s(e.value),e.value))).filter((e=>null!==e))}static async getPsetRel(e,t){var i;if(!await e.getProperties(t))return null;const s=await e.getAllPropertiesOfType(c.IFCRELDEFINESBYPROPERTIES);if(!s)return null;const n=Object.values(s);let r=null;for(const e of n)(null==(i=e.RelatingPropertyDefinition)?void 0:i.value)===t&&(r=e.expressID);return r}static async getQsetRel(e,t){return Pn.getPsetRel(e,t)}static async getEntityName(e,t){var i;const s=await e.getProperties(t);if(!s)return{key:null,name:null};const n=Object.keys(s).find((e=>e.endsWith("Name")))??null;return{key:n,name:n?null==(i=s[n])?void 0:i.value:null}}static async getQuantityValue(e,t){const i=await e.getProperties(t);if(!i)return{key:null,value:null};const s=Object.keys(i).find((e=>e.endsWith("Value")))??null;let n;return n=null===s||void 0===i[s]||null===i[s]?null:i[s].value,{key:s,value:n}}static isRel(e){return _n[e].startsWith("IFCREL")}static async attributeExists(e,t,i){const s=await e.getProperties(t);return!!s&&Object.keys(s).includes(i)}static async groupEntitiesByType(e,t){var i;const s=new Map;for(const n of t){const t=await e.getProperties(n);if(!t)continue;const r=t.type;s.get(r)||s.set(r,new Set),null==(i=s.get(r))||i.add(n)}return s}}const wn={IFCURIREFERENCE:"IfcUriReference",IFCTIME:"IfcTime",IFCTEMPERATURERATEOFCHANGEMEASURE:"IfcTemperatureRateOfChangeMeasure",IFCSOUNDPRESSURELEVELMEASURE:"IfcSoundPressureLevelMeasure",IFCSOUNDPOWERLEVELMEASURE:"IfcSoundPowerLevelMeasure",IFCPROPERTYSETDEFINITIONSET:"IfcPropertySetDefinitionSet",IFCPOSITIVEINTEGER:"IfcPositiveInteger",IFCNONNEGATIVELENGTHMEASURE:"IfcNonNegativeLengthMeasure",IFCLINEINDEX:"IfcLineIndex",IFCLANGUAGEID:"IfcLanguageId",IFCDURATION:"IfcDuration",IFCDAYINWEEKNUMBER:"IfcDayInWeekNumber",IFCDATETIME:"IfcDateTime",IFCDATE:"IfcDate",IFCCARDINALPOINTREFERENCE:"IfcCardinalPointReference",IFCBINARY:"IfcBinary",IFCAREADENSITYMEASURE:"IfcAreaDensityMeasure",IFCARCINDEX:"IfcArcIndex",IFCYEARNUMBER:"IfcYearNumber",IFCWARPINGMOMENTMEASURE:"IfcWarpingMomentMeasure",IFCWARPINGCONSTANTMEASURE:"IfcWarpingConstantMeasure",IFCVOLUMETRICFLOWRATEMEASURE:"IfcVolumetricFlowRateMeasure",IFCVOLUMEMEASURE:"IfcVolumeMeasure",IFCVAPORPERMEABILITYMEASURE:"IfcVaporPermeabilityMeasure",IFCTORQUEMEASURE:"IfcTorqueMeasure",IFCTIMESTAMP:"IfcTimestamp",IFCTIMEMEASURE:"IfcTimeMeasure",IFCTHERMODYNAMICTEMPERATUREMEASURE:"IfcThermodynamicTemperatureMeasure",IFCTHERMALTRANSMITTANCEMEASURE:"IfcThermalTransmittanceMeasure",IFCTHERMALRESISTANCEMEASURE:"IfcThermalResistanceMeasure",IFCTHERMALEXPANSIONCOEFFICIENTMEASURE:"IfcThermalExpansionCoefficientMeasure",IFCTHERMALCONDUCTIVITYMEASURE:"IfcThermalConductivityMeasure",IFCTHERMALADMITTANCEMEASURE:"IfcThermalAdmittanceMeasure",IFCTEXTTRANSFORMATION:"IfcTextTransformation",IFCTEXTFONTNAME:"IfcTextFontName",IFCTEXTDECORATION:"IfcTextDecoration",IFCTEXTALIGNMENT:"IfcTextAlignment",IFCTEXT:"IfcText",IFCTEMPERATUREGRADIENTMEASURE:"IfcTemperatureGradientMeasure",IFCSPECULARROUGHNESS:"IfcSpecularRoughness",IFCSPECULAREXPONENT:"IfcSpecularExponent",IFCSPECIFICHEATCAPACITYMEASURE:"IfcSpecificHeatCapacityMeasure",IFCSOUNDPRESSUREMEASURE:"IfcSoundPressureMeasure",IFCSOUNDPOWERMEASURE:"IfcSoundPowerMeasure",IFCSOLIDANGLEMEASURE:"IfcSolidAngleMeasure",IFCSHEARMODULUSMEASURE:"IfcShearModulusMeasure",IFCSECTIONALAREAINTEGRALMEASURE:"IfcSectionalAreaIntegralMeasure",IFCSECTIONMODULUSMEASURE:"IfcSectionModulusMeasure",IFCSECONDINMINUTE:"IfcSecondInMinute",IFCROTATIONALSTIFFNESSMEASURE:"IfcRotationalStiffnessMeasure",IFCROTATIONALMASSMEASURE:"IfcRotationalMassMeasure",IFCROTATIONALFREQUENCYMEASURE:"IfcRotationalFrequencyMeasure",IFCREAL:"IfcReal",IFCRATIOMEASURE:"IfcRatioMeasure",IFCRADIOACTIVITYMEASURE:"IfcRadioactivityMeasure",IFCPRESSUREMEASURE:"IfcPressureMeasure",IFCPRESENTABLETEXT:"IfcPresentableText",IFCPOWERMEASURE:"IfcPowerMeasure",IFCPOSITIVERATIOMEASURE:"IfcPositiveRatioMeasure",IFCPOSITIVEPLANEANGLEMEASURE:"IfcPositivePlaneAngleMeasure",IFCPOSITIVELENGTHMEASURE:"IfcPositiveLengthMeasure",IFCPLANEANGLEMEASURE:"IfcPlaneAngleMeasure",IFCPLANARFORCEMEASURE:"IfcPlanarForceMeasure",IFCPARAMETERVALUE:"IfcParameterValue",IFCPHMEASURE:"IfcPhMeasure",IFCNUMERICMEASURE:"IfcNumericMeasure",IFCNORMALISEDRATIOMEASURE:"IfcNormalisedRatioMeasure",IFCMONTHINYEARNUMBER:"IfcMonthInYearNumber",IFCMONETARYMEASURE:"IfcMonetaryMeasure",IFCMOMENTOFINERTIAMEASURE:"IfcMomentOfInertiaMeasure",IFCMOLECULARWEIGHTMEASURE:"IfcMolecularWeightMeasure",IFCMOISTUREDIFFUSIVITYMEASURE:"IfcMoistureDiffusivityMeasure",IFCMODULUSOFSUBGRADEREACTIONMEASURE:"IfcModulusOfSubgradeReactionMeasure",IFCMODULUSOFROTATIONALSUBGRADEREACTIONMEASURE:"IfcModulusOfRotationalSubgradeReactionMeasure",IFCMODULUSOFLINEARSUBGRADEREACTIONMEASURE:"IfcModulusOfLinearSubgradeReactionMeasure",IFCMODULUSOFELASTICITYMEASURE:"IfcModulusOfElasticityMeasure",IFCMINUTEINHOUR:"IfcMinuteInHour",IFCMASSPERLENGTHMEASURE:"IfcMassPerLengthMeasure",IFCMASSMEASURE:"IfcMassMeasure",IFCMASSFLOWRATEMEASURE:"IfcMassFlowRateMeasure",IFCMASSDENSITYMEASURE:"IfcMassDensityMeasure",IFCMAGNETICFLUXMEASURE:"IfcMagneticFluxMeasure",IFCMAGNETICFLUXDENSITYMEASURE:"IfcMagneticFluxDensityMeasure",IFCLUMINOUSINTENSITYMEASURE:"IfcLuminousIntensityMeasure",IFCLUMINOUSINTENSITYDISTRIBUTIONMEASURE:"IfcLuminousIntensityDistributionMeasure",IFCLUMINOUSFLUXMEASURE:"IfcLuminousFluxMeasure",IFCLOGICAL:"IfcLogical",IFCLINEARVELOCITYMEASURE:"IfcLinearVelocityMeasure",IFCLINEARSTIFFNESSMEASURE:"IfcLinearStiffnessMeasure",IFCLINEARMOMENTMEASURE:"IfcLinearMomentMeasure",IFCLINEARFORCEMEASURE:"IfcLinearForceMeasure",IFCLENGTHMEASURE:"IfcLengthMeasure",IFCLABEL:"IfcLabel",IFCKINEMATICVISCOSITYMEASURE:"IfcKinematicViscosityMeasure",IFCISOTHERMALMOISTURECAPACITYMEASURE:"IfcIsothermalMoistureCapacityMeasure",IFCIONCONCENTRATIONMEASURE:"IfcIonConcentrationMeasure",IFCINTEGERCOUNTRATEMEASURE:"IfcIntegerCountRateMeasure",IFCINTEGER:"IfcInteger",IFCINDUCTANCEMEASURE:"IfcInductanceMeasure",IFCILLUMINANCEMEASURE:"IfcIlluminanceMeasure",IFCIDENTIFIER:"IfcIdentifier",IFCHOURINDAY:"IfcHourInDay",IFCHEATINGVALUEMEASURE:"IfcHeatingValueMeasure",IFCHEATFLUXDENSITYMEASURE:"IfcHeatFluxDensityMeasure",IFCGLOBALLYUNIQUEID:"IfcGloballyUniqueId",IFCFREQUENCYMEASURE:"IfcFrequencyMeasure",IFCFORCEMEASURE:"IfcForceMeasure",IFCFONTWEIGHT:"IfcFontWeight",IFCFONTVARIANT:"IfcFontVariant",IFCFONTSTYLE:"IfcFontStyle",IFCENERGYMEASURE:"IfcEnergyMeasure",IFCELECTRICVOLTAGEMEASURE:"IfcElectricVoltageMeasure",IFCELECTRICRESISTANCEMEASURE:"IfcElectricResistanceMeasure",IFCELECTRICCURRENTMEASURE:"IfcElectricCurrentMeasure",IFCELECTRICCONDUCTANCEMEASURE:"IfcElectricConductanceMeasure",IFCELECTRICCHARGEMEASURE:"IfcElectricChargeMeasure",IFCELECTRICCAPACITANCEMEASURE:"IfcElectricCapacitanceMeasure",IFCDYNAMICVISCOSITYMEASURE:"IfcDynamicViscosityMeasure",IFCDOSEEQUIVALENTMEASURE:"IfcDoseEquivalentMeasure",IFCDIMENSIONCOUNT:"IfcDimensionCount",IFCDESCRIPTIVEMEASURE:"IfcDescriptiveMeasure",IFCDAYLIGHTSAVINGHOUR:"IfcDaylightSavingHour",IFCDAYINMONTHNUMBER:"IfcDayInMonthNumber",IFCCURVATUREMEASURE:"IfcCurvatureMeasure",IFCCOUNTMEASURE:"IfcCountMeasure",IFCCONTEXTDEPENDENTMEASURE:"IfcContextDependentMeasure",IFCCOMPOUNDPLANEANGLEMEASURE:"IfcCompoundPlaneAngleMeasure",IFCCOMPLEXNUMBER:"IfcComplexNumber",IFCBOXALIGNMENT:"IfcBoxAlignment",IFCBOOLEAN:"IfcBoolean",IFCAREAMEASURE:"IfcAreaMeasure",IFCANGULARVELOCITYMEASURE:"IfcAngularVelocityMeasure",IFCAMOUNTOFSUBSTANCEMEASURE:"IfcAmountOfSubstanceMeasure",IFCACCELERATIONMEASURE:"IfcAccelerationMeasure",IFCABSORBEDDOSEMEASURE:"IfcAbsorbedDoseMeasure",IFCGEOSLICE:"IfcGeoSlice",IFCGEOMODEL:"IfcGeoModel",IFCELECTRICFLOWTREATMENTDEVICE:"IfcElectricFlowTreatmentDevice",IFCDISTRIBUTIONBOARD:"IfcDistributionBoard",IFCCONVEYORSEGMENT:"IfcConveyorSegment",IFCCAISSONFOUNDATION:"IfcCaissonFoundation",IFCBOREHOLE:"IfcBorehole",IFCBEARING:"IfcBearing",IFCALIGNMENT:"IfcAlignment",IFCTRACKELEMENT:"IfcTrackElement",IFCSIGNAL:"IfcSignal",IFCREINFORCEDSOIL:"IfcReinforcedSoil",IFCRAIL:"IfcRail",IFCPAVEMENT:"IfcPavement",IFCNAVIGATIONELEMENT:"IfcNavigationElement",IFCMOORINGDEVICE:"IfcMooringDevice",IFCMOBILETELECOMMUNICATIONSAPPLIANCE:"IfcMobileTelecommunicationsAppliance",IFCLIQUIDTERMINAL:"IfcLiquidTerminal",IFCLINEARPOSITIONINGELEMENT:"IfcLinearPositioningElement",IFCKERB:"IfcKerb",IFCGEOTECHNICALASSEMBLY:"IfcGeotechnicalAssembly",IFCELECTRICFLOWTREATMENTDEVICETYPE:"IfcElectricFlowTreatmentDeviceType",IFCEARTHWORKSFILL:"IfcEarthworksFill",IFCEARTHWORKSELEMENT:"IfcEarthworksElement",IFCEARTHWORKSCUT:"IfcEarthworksCut",IFCDISTRIBUTIONBOARDTYPE:"IfcDistributionBoardType",IFCDEEPFOUNDATION:"IfcDeepFoundation",IFCCOURSE:"IfcCourse",IFCCONVEYORSEGMENTTYPE:"IfcConveyorSegmentType",IFCCAISSONFOUNDATIONTYPE:"IfcCaissonFoundationType",IFCBUILTSYSTEM:"IfcBuiltSystem",IFCBUILTELEMENT:"IfcBuiltElement",IFCBRIDGEPART:"IfcBridgePart",IFCBRIDGE:"IfcBridge",IFCBEARINGTYPE:"IfcBearingType",IFCALIGNMENTVERTICAL:"IfcAlignmentVertical",IFCALIGNMENTSEGMENT:"IfcAlignmentSegment",IFCALIGNMENTHORIZONTAL:"IfcAlignmentHorizontal",IFCALIGNMENTCANT:"IfcAlignmentCant",IFCVIBRATIONDAMPERTYPE:"IfcVibrationDamperType",IFCVIBRATIONDAMPER:"IfcVibrationDamper",IFCVEHICLE:"IfcVehicle",IFCTRANSPORTATIONDEVICE:"IfcTransportationDevice",IFCTRACKELEMENTTYPE:"IfcTrackElementType",IFCTENDONCONDUITTYPE:"IfcTendonConduitType",IFCTENDONCONDUIT:"IfcTendonConduit",IFCSINESPIRAL:"IfcSineSpiral",IFCSIGNALTYPE:"IfcSignalType",IFCSIGNTYPE:"IfcSignType",IFCSIGN:"IfcSign",IFCSEVENTHORDERPOLYNOMIALSPIRAL:"IfcSeventhOrderPolynomialSpiral",IFCSEGMENTEDREFERENCECURVE:"IfcSegmentedReferenceCurve",IFCSECONDORDERPOLYNOMIALSPIRAL:"IfcSecondOrderPolynomialSpiral",IFCROADPART:"IfcRoadPart",IFCROAD:"IfcRoad",IFCRELADHERESTOELEMENT:"IfcRelAdheresToElement",IFCREFERENT:"IfcReferent",IFCRAILWAYPART:"IfcRailwayPart",IFCRAILWAY:"IfcRailway",IFCRAILTYPE:"IfcRailType",IFCPOSITIONINGELEMENT:"IfcPositioningElement",IFCPAVEMENTTYPE:"IfcPavementType",IFCNAVIGATIONELEMENTTYPE:"IfcNavigationElementType",IFCMOORINGDEVICETYPE:"IfcMooringDeviceType",IFCMOBILETELECOMMUNICATIONSAPPLIANCETYPE:"IfcMobileTelecommunicationsApplianceType",IFCMARINEPART:"IfcMarinePart",IFCMARINEFACILITY:"IfcMarineFacility",IFCLIQUIDTERMINALTYPE:"IfcLiquidTerminalType",IFCLINEARELEMENT:"IfcLinearElement",IFCKERBTYPE:"IfcKerbType",IFCIMPACTPROTECTIONDEVICETYPE:"IfcImpactProtectionDeviceType",IFCIMPACTPROTECTIONDEVICE:"IfcImpactProtectionDevice",IFCGRADIENTCURVE:"IfcGradientCurve",IFCGEOTECHNICALSTRATUM:"IfcGeotechnicalStratum",IFCGEOTECHNICALELEMENT:"IfcGeotechnicalElement",IFCFACILITYPARTCOMMON:"IfcFacilityPartCommon",IFCFACILITYPART:"IfcFacilityPart",IFCFACILITY:"IfcFacility",IFCDIRECTRIXDERIVEDREFERENCESWEPTAREASOLID:"IfcDirectrixDerivedReferenceSweptAreaSolid",IFCDEEPFOUNDATIONTYPE:"IfcDeepFoundationType",IFCCOURSETYPE:"IfcCourseType",IFCCOSINESPIRAL:"IfcCosineSpiral",IFCCLOTHOID:"IfcClothoid",IFCBUILTELEMENTTYPE:"IfcBuiltElementType",IFCVEHICLETYPE:"IfcVehicleType",IFCTRIANGULATEDIRREGULARNETWORK:"IfcTriangulatedIrregularNetwork",IFCTRANSPORTATIONDEVICETYPE:"IfcTransportationDeviceType",IFCTHIRDORDERPOLYNOMIALSPIRAL:"IfcThirdOrderPolynomialSpiral",IFCSPIRAL:"IfcSpiral",IFCSECTIONEDSURFACE:"IfcSectionedSurface",IFCSECTIONEDSOLIDHORIZONTAL:"IfcSectionedSolidHorizontal",IFCSECTIONEDSOLID:"IfcSectionedSolid",IFCRELPOSITIONS:"IfcRelPositions",IFCRELASSOCIATESPROFILEDEF:"IfcRelAssociatesProfileDef",IFCPOLYNOMIALCURVE:"IfcPolynomialCurve",IFCOFFSETCURVEBYDISTANCES:"IfcOffsetCurveByDistances",IFCOFFSETCURVE:"IfcOffsetCurve",IFCINDEXEDPOLYGONALTEXTUREMAP:"IfcIndexedPolygonalTextureMap",IFCDIRECTRIXCURVESWEPTAREASOLID:"IfcDirectrixCurveSweptAreaSolid",IFCCURVESEGMENT:"IfcCurveSegment",IFCAXIS2PLACEMENTLINEAR:"IfcAxis2PlacementLinear",IFCSEGMENT:"IfcSegment",IFCPOINTBYDISTANCEEXPRESSION:"IfcPointByDistanceExpression",IFCOPENCROSSPROFILEDEF:"IfcOpenCrossProfileDef",IFCLINEARPLACEMENT:"IfcLinearPlacement",IFCALIGNMENTHORIZONTALSEGMENT:"IfcAlignmentHorizontalSegment",IFCALIGNMENTCANTSEGMENT:"IfcAlignmentCantSegment",IFCTEXTURECOORDINATEINDICESWITHVOIDS:"IfcTextureCoordinateIndicesWithVoids",IFCTEXTURECOORDINATEINDICES:"IfcTextureCoordinateIndices",IFCQUANTITYNUMBER:"IfcQuantityNumber",IFCALIGNMENTVERTICALSEGMENT:"IfcAlignmentVerticalSegment",IFCALIGNMENTPARAMETERSEGMENT:"IfcAlignmentParameterSegment",IFCCONTROLLER:"IfcController",IFCALARM:"IfcAlarm",IFCACTUATOR:"IfcActuator",IFCUNITARYCONTROLELEMENT:"IfcUnitaryControlElement",IFCSENSOR:"IfcSensor",IFCPROTECTIVEDEVICETRIPPINGUNIT:"IfcProtectiveDeviceTrippingUnit",IFCFLOWINSTRUMENT:"IfcFlowInstrument",IFCFIRESUPPRESSIONTERMINAL:"IfcFireSuppressionTerminal",IFCFILTER:"IfcFilter",IFCFAN:"IfcFan",IFCELECTRICTIMECONTROL:"IfcElectricTimeControl",IFCELECTRICMOTOR:"IfcElectricMotor",IFCELECTRICGENERATOR:"IfcElectricGenerator",IFCELECTRICFLOWSTORAGEDEVICE:"IfcElectricFlowStorageDevice",IFCELECTRICDISTRIBUTIONBOARD:"IfcElectricDistributionBoard",IFCELECTRICAPPLIANCE:"IfcElectricAppliance",IFCDUCTSILENCER:"IfcDuctSilencer",IFCDUCTSEGMENT:"IfcDuctSegment",IFCDUCTFITTING:"IfcDuctFitting",IFCDISTRIBUTIONCIRCUIT:"IfcDistributionCircuit",IFCDAMPER:"IfcDamper",IFCCOOLINGTOWER:"IfcCoolingTower",IFCCOOLEDBEAM:"IfcCooledBeam",IFCCONDENSER:"IfcCondenser",IFCCOMPRESSOR:"IfcCompressor",IFCCOMMUNICATIONSAPPLIANCE:"IfcCommunicationsAppliance",IFCCOIL:"IfcCoil",IFCCHILLER:"IfcChiller",IFCCABLESEGMENT:"IfcCableSegment",IFCCABLEFITTING:"IfcCableFitting",IFCCABLECARRIERSEGMENT:"IfcCableCarrierSegment",IFCCABLECARRIERFITTING:"IfcCableCarrierFitting",IFCBURNER:"IfcBurner",IFCBOILER:"IfcBoiler",IFCBEAMSTANDARDCASE:"IfcBeamStandardCase",IFCAUDIOVISUALAPPLIANCE:"IfcAudioVisualAppliance",IFCAIRTOAIRHEATRECOVERY:"IfcAirToAirHeatRecovery",IFCAIRTERMINALBOX:"IfcAirTerminalBox",IFCAIRTERMINAL:"IfcAirTerminal",IFCWINDOWSTANDARDCASE:"IfcWindowStandardCase",IFCWASTETERMINAL:"IfcWasteTerminal",IFCWALLELEMENTEDCASE:"IfcWallElementedCase",IFCVALVE:"IfcValve",IFCUNITARYEQUIPMENT:"IfcUnitaryEquipment",IFCUNITARYCONTROLELEMENTTYPE:"IfcUnitaryControlElementType",IFCTUBEBUNDLE:"IfcTubeBundle",IFCTRANSFORMER:"IfcTransformer",IFCTANK:"IfcTank",IFCSWITCHINGDEVICE:"IfcSwitchingDevice",IFCSTRUCTURALLOADCASE:"IfcStructuralLoadCase",IFCSTACKTERMINAL:"IfcStackTerminal",IFCSPACEHEATER:"IfcSpaceHeater",IFCSOLARDEVICE:"IfcSolarDevice",IFCSLABSTANDARDCASE:"IfcSlabStandardCase",IFCSLABELEMENTEDCASE:"IfcSlabElementedCase",IFCSHADINGDEVICE:"IfcShadingDevice",IFCSANITARYTERMINAL:"IfcSanitaryTerminal",IFCREINFORCINGBARTYPE:"IfcReinforcingBarType",IFCRATIONALBSPLINECURVEWITHKNOTS:"IfcRationalBSplineCurveWithKnots",IFCPUMP:"IfcPump",IFCPROTECTIVEDEVICETRIPPINGUNITTYPE:"IfcProtectiveDeviceTrippingUnitType",IFCPROTECTIVEDEVICE:"IfcProtectiveDevice",IFCPLATESTANDARDCASE:"IfcPlateStandardCase",IFCPIPESEGMENT:"IfcPipeSegment",IFCPIPEFITTING:"IfcPipeFitting",IFCOUTLET:"IfcOutlet",IFCOUTERBOUNDARYCURVE:"IfcOuterBoundaryCurve",IFCMOTORCONNECTION:"IfcMotorConnection",IFCMEMBERSTANDARDCASE:"IfcMemberStandardCase",IFCMEDICALDEVICE:"IfcMedicalDevice",IFCLIGHTFIXTURE:"IfcLightFixture",IFCLAMP:"IfcLamp",IFCJUNCTIONBOX:"IfcJunctionBox",IFCINTERCEPTOR:"IfcInterceptor",IFCHUMIDIFIER:"IfcHumidifier",IFCHEATEXCHANGER:"IfcHeatExchanger",IFCFLOWMETER:"IfcFlowMeter",IFCEXTERNALSPATIALELEMENT:"IfcExternalSpatialElement",IFCEVAPORATOR:"IfcEvaporator",IFCEVAPORATIVECOOLER:"IfcEvaporativeCooler",IFCENGINE:"IfcEngine",IFCELECTRICDISTRIBUTIONBOARDTYPE:"IfcElectricDistributionBoardType",IFCDOORSTANDARDCASE:"IfcDoorStandardCase",IFCDISTRIBUTIONSYSTEM:"IfcDistributionSystem",IFCCOMMUNICATIONSAPPLIANCETYPE:"IfcCommunicationsApplianceType",IFCCOLUMNSTANDARDCASE:"IfcColumnStandardCase",IFCCIVILELEMENT:"IfcCivilElement",IFCCHIMNEY:"IfcChimney",IFCCABLEFITTINGTYPE:"IfcCableFittingType",IFCBURNERTYPE:"IfcBurnerType",IFCBUILDINGSYSTEM:"IfcBuildingSystem",IFCBUILDINGELEMENTPARTTYPE:"IfcBuildingElementPartType",IFCBOUNDARYCURVE:"IfcBoundaryCurve",IFCBSPLINECURVEWITHKNOTS:"IfcBSplineCurveWithKnots",IFCAUDIOVISUALAPPLIANCETYPE:"IfcAudioVisualApplianceType",IFCWORKCALENDAR:"IfcWorkCalendar",IFCWINDOWTYPE:"IfcWindowType",IFCVOIDINGFEATURE:"IfcVoidingFeature",IFCVIBRATIONISOLATOR:"IfcVibrationIsolator",IFCTENDONTYPE:"IfcTendonType",IFCTENDONANCHORTYPE:"IfcTendonAnchorType",IFCSYSTEMFURNITUREELEMENT:"IfcSystemFurnitureElement",IFCSURFACEFEATURE:"IfcSurfaceFeature",IFCSTRUCTURALSURFACEACTION:"IfcStructuralSurfaceAction",IFCSTRUCTURALCURVEREACTION:"IfcStructuralCurveReaction",IFCSTRUCTURALCURVEACTION:"IfcStructuralCurveAction",IFCSTAIRTYPE:"IfcStairType",IFCSOLARDEVICETYPE:"IfcSolarDeviceType",IFCSHADINGDEVICETYPE:"IfcShadingDeviceType",IFCSEAMCURVE:"IfcSeamCurve",IFCROOFTYPE:"IfcRoofType",IFCREINFORCINGMESHTYPE:"IfcReinforcingMeshType",IFCREINFORCINGELEMENTTYPE:"IfcReinforcingElementType",IFCRATIONALBSPLINESURFACEWITHKNOTS:"IfcRationalBSplineSurfaceWithKnots",IFCRAMPTYPE:"IfcRampType",IFCPOLYGONALFACESET:"IfcPolygonalFaceSet",IFCPILETYPE:"IfcPileType",IFCOPENINGSTANDARDCASE:"IfcOpeningStandardCase",IFCMEDICALDEVICETYPE:"IfcMedicalDeviceType",IFCINTERSECTIONCURVE:"IfcIntersectionCurve",IFCINTERCEPTORTYPE:"IfcInterceptorType",IFCINDEXEDPOLYCURVE:"IfcIndexedPolyCurve",IFCGEOGRAPHICELEMENT:"IfcGeographicElement",IFCFURNITURE:"IfcFurniture",IFCFOOTINGTYPE:"IfcFootingType",IFCEXTERNALSPATIALSTRUCTUREELEMENT:"IfcExternalSpatialStructureElement",IFCEVENT:"IfcEvent",IFCENGINETYPE:"IfcEngineType",IFCELEMENTASSEMBLYTYPE:"IfcElementAssemblyType",IFCDOORTYPE:"IfcDoorType",IFCCYLINDRICALSURFACE:"IfcCylindricalSurface",IFCCONSTRUCTIONPRODUCTRESOURCETYPE:"IfcConstructionProductResourceType",IFCCONSTRUCTIONMATERIALRESOURCETYPE:"IfcConstructionMaterialResourceType",IFCCONSTRUCTIONEQUIPMENTRESOURCETYPE:"IfcConstructionEquipmentResourceType",IFCCOMPOSITECURVEONSURFACE:"IfcCompositeCurveOnSurface",IFCCOMPLEXPROPERTYTEMPLATE:"IfcComplexPropertyTemplate",IFCCIVILELEMENTTYPE:"IfcCivilElementType",IFCCHIMNEYTYPE:"IfcChimneyType",IFCBSPLINESURFACEWITHKNOTS:"IfcBSplineSurfaceWithKnots",IFCBSPLINESURFACE:"IfcBSplineSurface",IFCADVANCEDBREPWITHVOIDS:"IfcAdvancedBrepWithVoids",IFCADVANCEDBREP:"IfcAdvancedBrep",IFCTRIANGULATEDFACESET:"IfcTriangulatedFaceSet",IFCTOROIDALSURFACE:"IfcToroidalSurface",IFCTESSELLATEDFACESET:"IfcTessellatedFaceSet",IFCTASKTYPE:"IfcTaskType",IFCSURFACECURVE:"IfcSurfaceCurve",IFCSUBCONTRACTRESOURCETYPE:"IfcSubContractResourceType",IFCSTRUCTURALSURFACEREACTION:"IfcStructuralSurfaceReaction",IFCSPHERICALSURFACE:"IfcSphericalSurface",IFCSPATIALZONETYPE:"IfcSpatialZoneType",IFCSPATIALZONE:"IfcSpatialZone",IFCSPATIALELEMENTTYPE:"IfcSpatialElementType",IFCSPATIALELEMENT:"IfcSpatialElement",IFCSIMPLEPROPERTYTEMPLATE:"IfcSimplePropertyTemplate",IFCREVOLVEDAREASOLIDTAPERED:"IfcRevolvedAreaSolidTapered",IFCREPARAMETRISEDCOMPOSITECURVESEGMENT:"IfcReparametrisedCompositeCurveSegment",IFCRELSPACEBOUNDARY2NDLEVEL:"IfcRelSpaceBoundary2ndLevel",IFCRELSPACEBOUNDARY1STLEVEL:"IfcRelSpaceBoundary1stLevel",IFCRELINTERFERESELEMENTS:"IfcRelInterferesElements",IFCRELDEFINESBYTEMPLATE:"IfcRelDefinesByTemplate",IFCRELDEFINESBYOBJECT:"IfcRelDefinesByObject",IFCRELDECLARES:"IfcRelDeclares",IFCRELASSIGNSTOGROUPBYFACTOR:"IfcRelAssignsToGroupByFactor",IFCPROPERTYTEMPLATE:"IfcPropertyTemplate",IFCPROPERTYSETTEMPLATE:"IfcPropertySetTemplate",IFCPROJECTLIBRARY:"IfcProjectLibrary",IFCPROCEDURETYPE:"IfcProcedureType",IFCPREDEFINEDPROPERTYSET:"IfcPredefinedPropertySet",IFCPCURVE:"IfcPCurve",IFCLABORRESOURCETYPE:"IfcLaborResourceType",IFCINDEXEDPOLYGONALFACEWITHVOIDS:"IfcIndexedPolygonalFaceWithVoids",IFCINDEXEDPOLYGONALFACE:"IfcIndexedPolygonalFace",IFCGEOGRAPHICELEMENTTYPE:"IfcGeographicElementType",IFCFIXEDREFERENCESWEPTAREASOLID:"IfcFixedReferenceSweptAreaSolid",IFCEXTRUDEDAREASOLIDTAPERED:"IfcExtrudedAreaSolidTapered",IFCEVENTTYPE:"IfcEventType",IFCCURVEBOUNDEDSURFACE:"IfcCurveBoundedSurface",IFCCREWRESOURCETYPE:"IfcCrewResourceType",IFCCONTEXT:"IfcContext",IFCCONSTRUCTIONRESOURCETYPE:"IfcConstructionResourceType",IFCCARTESIANPOINTLIST3D:"IfcCartesianPointList3D",IFCCARTESIANPOINTLIST2D:"IfcCartesianPointList2D",IFCCARTESIANPOINTLIST:"IfcCartesianPointList",IFCADVANCEDFACE:"IfcAdvancedFace",IFCTYPERESOURCE:"IfcTypeResource",IFCTYPEPROCESS:"IfcTypeProcess",IFCTESSELLATEDITEM:"IfcTessellatedItem",IFCSWEPTDISKSOLIDPOLYGONAL:"IfcSweptDiskSolidPolygonal",IFCRESOURCETIME:"IfcResourceTime",IFCRESOURCECONSTRAINTRELATIONSHIP:"IfcResourceConstraintRelationship",IFCRESOURCEAPPROVALRELATIONSHIP:"IfcResourceApprovalRelationship",IFCQUANTITYSET:"IfcQuantitySet",IFCPROPERTYTEMPLATEDEFINITION:"IfcPropertyTemplateDefinition",IFCPREDEFINEDPROPERTIES:"IfcPredefinedProperties",IFCMIRROREDPROFILEDEF:"IfcMirroredProfileDef",IFCMATERIALRELATIONSHIP:"IfcMaterialRelationship",IFCMATERIALPROFILESETUSAGETAPERING:"IfcMaterialProfileSetUsageTapering",IFCMATERIALPROFILESETUSAGE:"IfcMaterialProfileSetUsage",IFCMATERIALCONSTITUENTSET:"IfcMaterialConstituentSet",IFCMATERIALCONSTITUENT:"IfcMaterialConstituent",IFCLAGTIME:"IfcLagTime",IFCINDEXEDTRIANGLETEXTUREMAP:"IfcIndexedTriangleTextureMap",IFCINDEXEDTEXTUREMAP:"IfcIndexedTextureMap",IFCINDEXEDCOLOURMAP:"IfcIndexedColourMap",IFCEXTERNALREFERENCERELATIONSHIP:"IfcExternalReferenceRelationship",IFCEXTENDEDPROPERTIES:"IfcExtendedProperties",IFCEVENTTIME:"IfcEventTime",IFCCONVERSIONBASEDUNITWITHOFFSET:"IfcConversionBasedUnitWithOffset",IFCCOLOURRGBLIST:"IfcColourRgbList",IFCWORKTIME:"IfcWorkTime",IFCTIMEPERIOD:"IfcTimePeriod",IFCTEXTUREVERTEXLIST:"IfcTextureVertexList",IFCTASKTIMERECURRING:"IfcTaskTimeRecurring",IFCTASKTIME:"IfcTaskTime",IFCTABLECOLUMN:"IfcTableColumn",IFCSURFACEREINFORCEMENTAREA:"IfcSurfaceReinforcementArea",IFCSTRUCTURALLOADORRESULT:"IfcStructuralLoadOrResult",IFCSTRUCTURALLOADCONFIGURATION:"IfcStructuralLoadConfiguration",IFCSCHEDULINGTIME:"IfcSchedulingTime",IFCRESOURCELEVELRELATIONSHIP:"IfcResourceLevelRelationship",IFCREFERENCE:"IfcReference",IFCRECURRENCEPATTERN:"IfcRecurrencePattern",IFCPROPERTYABSTRACTION:"IfcPropertyAbstraction",IFCPROJECTEDCRS:"IfcProjectedCrs",IFCPRESENTATIONITEM:"IfcPresentationItem",IFCMATERIALUSAGEDEFINITION:"IfcMaterialUsageDefinition",IFCMATERIALPROFILEWITHOFFSETS:"IfcMaterialProfileWithOffsets",IFCMATERIALPROFILESET:"IfcMaterialProfileSet",IFCMATERIALPROFILE:"IfcMaterialProfile",IFCMATERIALLAYERWITHOFFSETS:"IfcMaterialLayerWithOffsets",IFCMATERIALDEFINITION:"IfcMaterialDefinition",IFCMAPCONVERSION:"IfcMapConversion",IFCEXTERNALINFORMATION:"IfcExternalInformation",IFCCOORDINATEREFERENCESYSTEM:"IfcCoordinateReferenceSystem",IFCCOORDINATEOPERATION:"IfcCoordinateOperation",IFCCONNECTIONVOLUMEGEOMETRY:"IfcConnectionVolumeGeometry",IFCREINFORCINGBAR:"IfcReinforcingBar",IFCELECTRICDISTRIBUTIONPOINT:"IfcElectricDistributionPoint",IFCDISTRIBUTIONCONTROLELEMENT:"IfcDistributionControlElement",IFCDISTRIBUTIONCHAMBERELEMENT:"IfcDistributionChamberElement",IFCCONTROLLERTYPE:"IfcControllerType",IFCCHAMFEREDGEFEATURE:"IfcChamferEdgeFeature",IFCBEAM:"IfcBeam",IFCALARMTYPE:"IfcAlarmType",IFCACTUATORTYPE:"IfcActuatorType",IFCWINDOW:"IfcWindow",IFCWALLSTANDARDCASE:"IfcWallStandardCase",IFCWALL:"IfcWall",IFCVIBRATIONISOLATORTYPE:"IfcVibrationIsolatorType",IFCTENDONANCHOR:"IfcTendonAnchor",IFCTENDON:"IfcTendon",IFCSTRUCTURALANALYSISMODEL:"IfcStructuralAnalysisModel",IFCSTAIRFLIGHT:"IfcStairFlight",IFCSTAIR:"IfcStair",IFCSLAB:"IfcSlab",IFCSENSORTYPE:"IfcSensorType",IFCROUNDEDEDGEFEATURE:"IfcRoundedEdgeFeature",IFCROOF:"IfcRoof",IFCREINFORCINGMESH:"IfcReinforcingMesh",IFCREINFORCINGELEMENT:"IfcReinforcingElement",IFCRATIONALBEZIERCURVE:"IfcRationalBezierCurve",IFCRAMPFLIGHT:"IfcRampFlight",IFCRAMP:"IfcRamp",IFCRAILING:"IfcRailing",IFCPLATE:"IfcPlate",IFCPILE:"IfcPile",IFCMEMBER:"IfcMember",IFCFOOTING:"IfcFooting",IFCFLOWTREATMENTDEVICE:"IfcFlowTreatmentDevice",IFCFLOWTERMINAL:"IfcFlowTerminal",IFCFLOWSTORAGEDEVICE:"IfcFlowStorageDevice",IFCFLOWSEGMENT:"IfcFlowSegment",IFCFLOWMOVINGDEVICE:"IfcFlowMovingDevice",IFCFLOWINSTRUMENTTYPE:"IfcFlowInstrumentType",IFCFLOWFITTING:"IfcFlowFitting",IFCFLOWCONTROLLER:"IfcFlowController",IFCFIRESUPPRESSIONTERMINALTYPE:"IfcFireSuppressionTerminalType",IFCFILTERTYPE:"IfcFilterType",IFCFANTYPE:"IfcFanType",IFCENERGYCONVERSIONDEVICE:"IfcEnergyConversionDevice",IFCELECTRICALELEMENT:"IfcElectricalElement",IFCELECTRICALCIRCUIT:"IfcElectricalCircuit",IFCELECTRICTIMECONTROLTYPE:"IfcElectricTimeControlType",IFCELECTRICMOTORTYPE:"IfcElectricMotorType",IFCELECTRICHEATERTYPE:"IfcElectricHeaterType",IFCELECTRICGENERATORTYPE:"IfcElectricGeneratorType",IFCELECTRICFLOWSTORAGEDEVICETYPE:"IfcElectricFlowStorageDeviceType",IFCELECTRICAPPLIANCETYPE:"IfcElectricApplianceType",IFCEDGEFEATURE:"IfcEdgeFeature",IFCDUCTSILENCERTYPE:"IfcDuctSilencerType",IFCDUCTSEGMENTTYPE:"IfcDuctSegmentType",IFCDUCTFITTINGTYPE:"IfcDuctFittingType",IFCDOOR:"IfcDoor",IFCDISTRIBUTIONPORT:"IfcDistributionPort",IFCDISTRIBUTIONFLOWELEMENT:"IfcDistributionFlowElement",IFCDISTRIBUTIONELEMENT:"IfcDistributionElement",IFCDISTRIBUTIONCONTROLELEMENTTYPE:"IfcDistributionControlElementType",IFCDISTRIBUTIONCHAMBERELEMENTTYPE:"IfcDistributionChamberElementType",IFCDISCRETEACCESSORYTYPE:"IfcDiscreteAccessoryType",IFCDISCRETEACCESSORY:"IfcDiscreteAccessory",IFCDIAMETERDIMENSION:"IfcDiameterDimension",IFCDAMPERTYPE:"IfcDamperType",IFCCURTAINWALL:"IfcCurtainWall",IFCCOVERING:"IfcCovering",IFCCOOLINGTOWERTYPE:"IfcCoolingTowerType",IFCCOOLEDBEAMTYPE:"IfcCooledBeamType",IFCCONSTRUCTIONPRODUCTRESOURCE:"IfcConstructionProductResource",IFCCONSTRUCTIONMATERIALRESOURCE:"IfcConstructionMaterialResource",IFCCONSTRUCTIONEQUIPMENTRESOURCE:"IfcConstructionEquipmentResource",IFCCONDITIONCRITERION:"IfcConditionCriterion",IFCCONDITION:"IfcCondition",IFCCONDENSERTYPE:"IfcCondenserType",IFCCOMPRESSORTYPE:"IfcCompressorType",IFCCOLUMN:"IfcColumn",IFCCOILTYPE:"IfcCoilType",IFCCIRCLE:"IfcCircle",IFCCHILLERTYPE:"IfcChillerType",IFCCABLESEGMENTTYPE:"IfcCableSegmentType",IFCCABLECARRIERSEGMENTTYPE:"IfcCableCarrierSegmentType",IFCCABLECARRIERFITTINGTYPE:"IfcCableCarrierFittingType",IFCBUILDINGELEMENTPROXYTYPE:"IfcBuildingElementProxyType",IFCBUILDINGELEMENTPROXY:"IfcBuildingElementProxy",IFCBUILDINGELEMENTPART:"IfcBuildingElementPart",IFCBUILDINGELEMENTCOMPONENT:"IfcBuildingElementComponent",IFCBUILDINGELEMENT:"IfcBuildingElement",IFCBOILERTYPE:"IfcBoilerType",IFCBEZIERCURVE:"IfcBezierCurve",IFCBEAMTYPE:"IfcBeamType",IFCBSPLINECURVE:"IfcBSplineCurve",IFCASSET:"IfcAsset",IFCANGULARDIMENSION:"IfcAngularDimension",IFCAIRTOAIRHEATRECOVERYTYPE:"IfcAirToAirHeatRecoveryType",IFCAIRTERMINALTYPE:"IfcAirTerminalType",IFCAIRTERMINALBOXTYPE:"IfcAirTerminalBoxType",IFCACTIONREQUEST:"IfcActionRequest",IFC2DCOMPOSITECURVE:"Ifc2DCompositeCurve",IFCZONE:"IfcZone",IFCWORKSCHEDULE:"IfcWorkSchedule",IFCWORKPLAN:"IfcWorkPlan",IFCWORKCONTROL:"IfcWorkControl",IFCWASTETERMINALTYPE:"IfcWasteTerminalType",IFCWALLTYPE:"IfcWallType",IFCVIRTUALELEMENT:"IfcVirtualElement",IFCVALVETYPE:"IfcValveType",IFCUNITARYEQUIPMENTTYPE:"IfcUnitaryEquipmentType",IFCTUBEBUNDLETYPE:"IfcTubeBundleType",IFCTRIMMEDCURVE:"IfcTrimmedCurve",IFCTRANSPORTELEMENT:"IfcTransportElement",IFCTRANSFORMERTYPE:"IfcTransformerType",IFCTIMESERIESSCHEDULE:"IfcTimeSeriesSchedule",IFCTANKTYPE:"IfcTankType",IFCSYSTEM:"IfcSystem",IFCSWITCHINGDEVICETYPE:"IfcSwitchingDeviceType",IFCSUBCONTRACTRESOURCE:"IfcSubContractResource",IFCSTRUCTURALSURFACECONNECTION:"IfcStructuralSurfaceConnection",IFCSTRUCTURALRESULTGROUP:"IfcStructuralResultGroup",IFCSTRUCTURALPOINTREACTION:"IfcStructuralPointReaction",IFCSTRUCTURALPOINTCONNECTION:"IfcStructuralPointConnection",IFCSTRUCTURALPOINTACTION:"IfcStructuralPointAction",IFCSTRUCTURALPLANARACTIONVARYING:"IfcStructuralPlanarActionVarying",IFCSTRUCTURALPLANARACTION:"IfcStructuralPlanarAction",IFCSTRUCTURALLOADGROUP:"IfcStructuralLoadGroup",IFCSTRUCTURALLINEARACTIONVARYING:"IfcStructuralLinearActionVarying",IFCSTRUCTURALLINEARACTION:"IfcStructuralLinearAction",IFCSTRUCTURALCURVEMEMBERVARYING:"IfcStructuralCurveMemberVarying",IFCSTRUCTURALCURVEMEMBER:"IfcStructuralCurveMember",IFCSTRUCTURALCURVECONNECTION:"IfcStructuralCurveConnection",IFCSTRUCTURALCONNECTION:"IfcStructuralConnection",IFCSTRUCTURALACTION:"IfcStructuralAction",IFCSTAIRFLIGHTTYPE:"IfcStairFlightType",IFCSTACKTERMINALTYPE:"IfcStackTerminalType",IFCSPACETYPE:"IfcSpaceType",IFCSPACEPROGRAM:"IfcSpaceProgram",IFCSPACEHEATERTYPE:"IfcSpaceHeaterType",IFCSPACE:"IfcSpace",IFCSLABTYPE:"IfcSlabType",IFCSITE:"IfcSite",IFCSERVICELIFE:"IfcServiceLife",IFCSCHEDULETIMECONTROL:"IfcScheduleTimeControl",IFCSANITARYTERMINALTYPE:"IfcSanitaryTerminalType",IFCRELASSIGNSTASKS:"IfcRelAssignsTasks",IFCRELAGGREGATES:"IfcRelAggregates",IFCRAMPFLIGHTTYPE:"IfcRampFlightType",IFCRAILINGTYPE:"IfcRailingType",IFCRADIUSDIMENSION:"IfcRadiusDimension",IFCPUMPTYPE:"IfcPumpType",IFCPROTECTIVEDEVICETYPE:"IfcProtectiveDeviceType",IFCPROJECTIONELEMENT:"IfcProjectionElement",IFCPROJECTORDERRECORD:"IfcProjectOrderRecord",IFCPROJECTORDER:"IfcProjectOrder",IFCPROCEDURE:"IfcProcedure",IFCPORT:"IfcPort",IFCPOLYLINE:"IfcPolyline",IFCPLATETYPE:"IfcPlateType",IFCPIPESEGMENTTYPE:"IfcPipeSegmentType",IFCPIPEFITTINGTYPE:"IfcPipeFittingType",IFCPERMIT:"IfcPermit",IFCPERFORMANCEHISTORY:"IfcPerformanceHistory",IFCOUTLETTYPE:"IfcOutletType",IFCORDERACTION:"IfcOrderAction",IFCOPENINGELEMENT:"IfcOpeningElement",IFCOCCUPANT:"IfcOccupant",IFCMOVE:"IfcMove",IFCMOTORCONNECTIONTYPE:"IfcMotorConnectionType",IFCMEMBERTYPE:"IfcMemberType",IFCMECHANICALFASTENERTYPE:"IfcMechanicalFastenerType",IFCMECHANICALFASTENER:"IfcMechanicalFastener",IFCLINEARDIMENSION:"IfcLinearDimension",IFCLIGHTFIXTURETYPE:"IfcLightFixtureType",IFCLAMPTYPE:"IfcLampType",IFCLABORRESOURCE:"IfcLaborResource",IFCJUNCTIONBOXTYPE:"IfcJunctionBoxType",IFCINVENTORY:"IfcInventory",IFCHUMIDIFIERTYPE:"IfcHumidifierType",IFCHEATEXCHANGERTYPE:"IfcHeatExchangerType",IFCGROUP:"IfcGroup",IFCGRID:"IfcGrid",IFCGASTERMINALTYPE:"IfcGasTerminalType",IFCFURNITURESTANDARD:"IfcFurnitureStandard",IFCFURNISHINGELEMENT:"IfcFurnishingElement",IFCFLOWTREATMENTDEVICETYPE:"IfcFlowTreatmentDeviceType",IFCFLOWTERMINALTYPE:"IfcFlowTerminalType",IFCFLOWSTORAGEDEVICETYPE:"IfcFlowStorageDeviceType",IFCFLOWSEGMENTTYPE:"IfcFlowSegmentType",IFCFLOWMOVINGDEVICETYPE:"IfcFlowMovingDeviceType",IFCFLOWMETERTYPE:"IfcFlowMeterType",IFCFLOWFITTINGTYPE:"IfcFlowFittingType",IFCFLOWCONTROLLERTYPE:"IfcFlowControllerType",IFCFEATUREELEMENTSUBTRACTION:"IfcFeatureElementSubtraction",IFCFEATUREELEMENTADDITION:"IfcFeatureElementAddition",IFCFEATUREELEMENT:"IfcFeatureElement",IFCFASTENERTYPE:"IfcFastenerType",IFCFASTENER:"IfcFastener",IFCFACETEDBREPWITHVOIDS:"IfcFacetedBrepWithVoids",IFCFACETEDBREP:"IfcFacetedBrep",IFCEVAPORATORTYPE:"IfcEvaporatorType",IFCEVAPORATIVECOOLERTYPE:"IfcEvaporativeCoolerType",IFCEQUIPMENTSTANDARD:"IfcEquipmentStandard",IFCEQUIPMENTELEMENT:"IfcEquipmentElement",IFCENERGYCONVERSIONDEVICETYPE:"IfcEnergyConversionDeviceType",IFCELLIPSE:"IfcEllipse",IFCELEMENTCOMPONENTTYPE:"IfcElementComponentType",IFCELEMENTCOMPONENT:"IfcElementComponent",IFCELEMENTASSEMBLY:"IfcElementAssembly",IFCELEMENT:"IfcElement",IFCELECTRICALBASEPROPERTIES:"IfcElectricalBaseProperties",IFCDISTRIBUTIONFLOWELEMENTTYPE:"IfcDistributionFlowElementType",IFCDISTRIBUTIONELEMENTTYPE:"IfcDistributionElementType",IFCDIMENSIONCURVEDIRECTEDCALLOUT:"IfcDimensionCurveDirectedCallout",IFCCURTAINWALLTYPE:"IfcCurtainWallType",IFCCREWRESOURCE:"IfcCrewResource",IFCCOVERINGTYPE:"IfcCoveringType",IFCCOSTSCHEDULE:"IfcCostSchedule",IFCCOSTITEM:"IfcCostItem",IFCCONTROL:"IfcControl",IFCCONSTRUCTIONRESOURCE:"IfcConstructionResource",IFCCONIC:"IfcConic",IFCCOMPOSITECURVE:"IfcCompositeCurve",IFCCOLUMNTYPE:"IfcColumnType",IFCCIRCLEHOLLOWPROFILEDEF:"IfcCircleHollowProfileDef",IFCBUILDINGSTOREY:"IfcBuildingStorey",IFCBUILDINGELEMENTTYPE:"IfcBuildingElementType",IFCBUILDING:"IfcBuilding",IFCBOUNDEDCURVE:"IfcBoundedCurve",IFCBOOLEANCLIPPINGRESULT:"IfcBooleanClippingResult",IFCBLOCK:"IfcBlock",IFCASYMMETRICISHAPEPROFILEDEF:"IfcAsymmetricIShapeProfileDef",IFCANNOTATION:"IfcAnnotation",IFCACTOR:"IfcActor",IFCTRANSPORTELEMENTTYPE:"IfcTransportElementType",IFCTASK:"IfcTask",IFCSYSTEMFURNITUREELEMENTTYPE:"IfcSystemFurnitureElementType",IFCSURFACEOFREVOLUTION:"IfcSurfaceOfRevolution",IFCSURFACEOFLINEAREXTRUSION:"IfcSurfaceOfLinearExtrusion",IFCSURFACECURVESWEPTAREASOLID:"IfcSurfaceCurveSweptAreaSolid",IFCSTRUCTUREDDIMENSIONCALLOUT:"IfcStructuredDimensionCallout",IFCSTRUCTURALSURFACEMEMBERVARYING:"IfcStructuralSurfaceMemberVarying",IFCSTRUCTURALSURFACEMEMBER:"IfcStructuralSurfaceMember",IFCSTRUCTURALREACTION:"IfcStructuralReaction",IFCSTRUCTURALMEMBER:"IfcStructuralMember",IFCSTRUCTURALITEM:"IfcStructuralItem",IFCSTRUCTURALACTIVITY:"IfcStructuralActivity",IFCSPHERE:"IfcSphere",IFCSPATIALSTRUCTUREELEMENTTYPE:"IfcSpatialStructureElementType",IFCSPATIALSTRUCTUREELEMENT:"IfcSpatialStructureElement",IFCRIGHTCIRCULARCYLINDER:"IfcRightCircularCylinder",IFCRIGHTCIRCULARCONE:"IfcRightCircularCone",IFCREVOLVEDAREASOLID:"IfcRevolvedAreaSolid",IFCRESOURCE:"IfcResource",IFCRELVOIDSELEMENT:"IfcRelVoidsElement",IFCRELSPACEBOUNDARY:"IfcRelSpaceBoundary",IFCRELSERVICESBUILDINGS:"IfcRelServicesBuildings",IFCRELSEQUENCE:"IfcRelSequence",IFCRELSCHEDULESCOSTITEMS:"IfcRelSchedulesCostItems",IFCRELREFERENCEDINSPATIALSTRUCTURE:"IfcRelReferencedInSpatialStructure",IFCRELPROJECTSELEMENT:"IfcRelProjectsElement",IFCRELOVERRIDESPROPERTIES:"IfcRelOverridesProperties",IFCRELOCCUPIESSPACES:"IfcRelOccupiesSpaces",IFCRELNESTS:"IfcRelNests",IFCRELINTERACTIONREQUIREMENTS:"IfcRelInteractionRequirements",IFCRELFLOWCONTROLELEMENTS:"IfcRelFlowControlElements",IFCRELFILLSELEMENT:"IfcRelFillsElement",IFCRELDEFINESBYTYPE:"IfcRelDefinesByType",IFCRELDEFINESBYPROPERTIES:"IfcRelDefinesByProperties",IFCRELDEFINES:"IfcRelDefines",IFCRELDECOMPOSES:"IfcRelDecomposes",IFCRELCOVERSSPACES:"IfcRelCoversSpaces",IFCRELCOVERSBLDGELEMENTS:"IfcRelCoversBldgElements",IFCRELCONTAINEDINSPATIALSTRUCTURE:"IfcRelContainedInSpatialStructure",IFCRELCONNECTSWITHREALIZINGELEMENTS:"IfcRelConnectsWithRealizingElements",IFCRELCONNECTSWITHECCENTRICITY:"IfcRelConnectsWithEccentricity",IFCRELCONNECTSSTRUCTURALMEMBER:"IfcRelConnectsStructuralMember",IFCRELCONNECTSSTRUCTURALELEMENT:"IfcRelConnectsStructuralElement",IFCRELCONNECTSSTRUCTURALACTIVITY:"IfcRelConnectsStructuralActivity",IFCRELCONNECTSPORTS:"IfcRelConnectsPorts",IFCRELCONNECTSPORTTOELEMENT:"IfcRelConnectsPortToElement",IFCRELCONNECTSPATHELEMENTS:"IfcRelConnectsPathElements",IFCRELCONNECTSELEMENTS:"IfcRelConnectsElements",IFCRELCONNECTS:"IfcRelConnects",IFCRELASSOCIATESPROFILEPROPERTIES:"IfcRelAssociatesProfileProperties",IFCRELASSOCIATESMATERIAL:"IfcRelAssociatesMaterial",IFCRELASSOCIATESLIBRARY:"IfcRelAssociatesLibrary",IFCRELASSOCIATESDOCUMENT:"IfcRelAssociatesDocument",IFCRELASSOCIATESCONSTRAINT:"IfcRelAssociatesConstraint",IFCRELASSOCIATESCLASSIFICATION:"IfcRelAssociatesClassification",IFCRELASSOCIATESAPPROVAL:"IfcRelAssociatesApproval",IFCRELASSOCIATESAPPLIEDVALUE:"IfcRelAssociatesAppliedValue",IFCRELASSOCIATES:"IfcRelAssociates",IFCRELASSIGNSTORESOURCE:"IfcRelAssignsToResource",IFCRELASSIGNSTOPROJECTORDER:"IfcRelAssignsToProjectOrder",IFCRELASSIGNSTOPRODUCT:"IfcRelAssignsToProduct",IFCRELASSIGNSTOPROCESS:"IfcRelAssignsToProcess",IFCRELASSIGNSTOGROUP:"IfcRelAssignsToGroup",IFCRELASSIGNSTOCONTROL:"IfcRelAssignsToControl",IFCRELASSIGNSTOACTOR:"IfcRelAssignsToActor",IFCRELASSIGNS:"IfcRelAssigns",IFCRECTANGULARTRIMMEDSURFACE:"IfcRectangularTrimmedSurface",IFCRECTANGULARPYRAMID:"IfcRectangularPyramid",IFCRECTANGLEHOLLOWPROFILEDEF:"IfcRectangleHollowProfileDef",IFCPROXY:"IfcProxy",IFCPROPERTYSET:"IfcPropertySet",IFCPROJECTIONCURVE:"IfcProjectionCurve",IFCPROJECT:"IfcProject",IFCPRODUCT:"IfcProduct",IFCPROCESS:"IfcProcess",IFCPLANE:"IfcPlane",IFCPLANARBOX:"IfcPlanarBox",IFCPERMEABLECOVERINGPROPERTIES:"IfcPermeableCoveringProperties",IFCOFFSETCURVE3D:"IfcOffsetCurve3D",IFCOFFSETCURVE2D:"IfcOffsetCurve2D",IFCOBJECT:"IfcObject",IFCMANIFOLDSOLIDBREP:"IfcManifoldSolidBrep",IFCLINE:"IfcLine",IFCLSHAPEPROFILEDEF:"IfcLShapeProfileDef",IFCISHAPEPROFILEDEF:"IfcIShapeProfileDef",IFCGEOMETRICCURVESET:"IfcGeometricCurveSet",IFCFURNITURETYPE:"IfcFurnitureType",IFCFURNISHINGELEMENTTYPE:"IfcFurnishingElementType",IFCFLUIDFLOWPROPERTIES:"IfcFluidFlowProperties",IFCFILLAREASTYLETILES:"IfcFillAreaStyleTiles",IFCFILLAREASTYLETILESYMBOLWITHSTYLE:"IfcFillAreaStyleTileSymbolWithStyle",IFCFILLAREASTYLEHATCHING:"IfcFillAreaStyleHatching",IFCFACEBASEDSURFACEMODEL:"IfcFaceBasedSurfaceModel",IFCEXTRUDEDAREASOLID:"IfcExtrudedAreaSolid",IFCENERGYPROPERTIES:"IfcEnergyProperties",IFCELLIPSEPROFILEDEF:"IfcEllipseProfileDef",IFCELEMENTARYSURFACE:"IfcElementarySurface",IFCELEMENTTYPE:"IfcElementType",IFCELEMENTQUANTITY:"IfcElementQuantity",IFCEDGELOOP:"IfcEdgeLoop",IFCDRAUGHTINGPREDEFINEDCURVEFONT:"IfcDraughtingPredefinedCurveFont",IFCDRAUGHTINGPREDEFINEDCOLOUR:"IfcDraughtingPredefinedColour",IFCDRAUGHTINGCALLOUT:"IfcDraughtingCallout",IFCDOORSTYLE:"IfcDoorStyle",IFCDOORPANELPROPERTIES:"IfcDoorPanelProperties",IFCDOORLININGPROPERTIES:"IfcDoorLiningProperties",IFCDIRECTION:"IfcDirection",IFCDIMENSIONCURVETERMINATOR:"IfcDimensionCurveTerminator",IFCDIMENSIONCURVE:"IfcDimensionCurve",IFCDEFINEDSYMBOL:"IfcDefinedSymbol",IFCCURVEBOUNDEDPLANE:"IfcCurveBoundedPlane",IFCCURVE:"IfcCurve",IFCCSGSOLID:"IfcCsgSolid",IFCCSGPRIMITIVE3D:"IfcCsgPrimitive3D",IFCCRANERAILFSHAPEPROFILEDEF:"IfcCraneRailFShapeProfileDef",IFCCRANERAILASHAPEPROFILEDEF:"IfcCraneRailAShapeProfileDef",IFCCOMPOSITECURVESEGMENT:"IfcCompositeCurveSegment",IFCCLOSEDSHELL:"IfcClosedShell",IFCCIRCLEPROFILEDEF:"IfcCircleProfileDef",IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM:"IfcCartesianTransformationOperator3DNonUniform",IFCCARTESIANTRANSFORMATIONOPERATOR3D:"IfcCartesianTransformationOperator3D",IFCCARTESIANTRANSFORMATIONOPERATOR2DNONUNIFORM:"IfcCartesianTransformationOperator2DNonUniform",IFCCARTESIANTRANSFORMATIONOPERATOR2D:"IfcCartesianTransformationOperator2D",IFCCARTESIANTRANSFORMATIONOPERATOR:"IfcCartesianTransformationOperator",IFCCARTESIANPOINT:"IfcCartesianPoint",IFCCSHAPEPROFILEDEF:"IfcCShapeProfileDef",IFCBOXEDHALFSPACE:"IfcBoxedHalfSpace",IFCBOUNDINGBOX:"IfcBoundingBox",IFCBOUNDEDSURFACE:"IfcBoundedSurface",IFCBOOLEANRESULT:"IfcBooleanResult",IFCAXIS2PLACEMENT3D:"IfcAxis2Placement3D",IFCAXIS2PLACEMENT2D:"IfcAxis2Placement2D",IFCAXIS1PLACEMENT:"IfcAxis1Placement",IFCANNOTATIONSURFACE:"IfcAnnotationSurface",IFCANNOTATIONFILLAREAOCCURRENCE:"IfcAnnotationFillAreaOccurrence",IFCANNOTATIONFILLAREA:"IfcAnnotationFillArea",IFCANNOTATIONCURVEOCCURRENCE:"IfcAnnotationCurveOccurrence",IFCZSHAPEPROFILEDEF:"IfcZShapeProfileDef",IFCWINDOWSTYLE:"IfcWindowStyle",IFCWINDOWPANELPROPERTIES:"IfcWindowPanelProperties",IFCWINDOWLININGPROPERTIES:"IfcWindowLiningProperties",IFCVERTEXLOOP:"IfcVertexLoop",IFCVECTOR:"IfcVector",IFCUSHAPEPROFILEDEF:"IfcUShapeProfileDef",IFCTYPEPRODUCT:"IfcTypeProduct",IFCTYPEOBJECT:"IfcTypeObject",IFCTWODIRECTIONREPEATFACTOR:"IfcTwoDirectionRepeatFactor",IFCTRAPEZIUMPROFILEDEF:"IfcTrapeziumProfileDef",IFCTEXTLITERALWITHEXTENT:"IfcTextLiteralWithExtent",IFCTEXTLITERAL:"IfcTextLiteral",IFCTERMINATORSYMBOL:"IfcTerminatorSymbol",IFCTSHAPEPROFILEDEF:"IfcTShapeProfileDef",IFCSWEPTSURFACE:"IfcSweptSurface",IFCSWEPTDISKSOLID:"IfcSweptDiskSolid",IFCSWEPTAREASOLID:"IfcSweptAreaSolid",IFCSURFACESTYLERENDERING:"IfcSurfaceStyleRendering",IFCSURFACE:"IfcSurface",IFCSUBEDGE:"IfcSubedge",IFCSTRUCTURALSTEELPROFILEPROPERTIES:"IfcStructuralSteelProfileProperties",IFCSTRUCTURALPROFILEPROPERTIES:"IfcStructuralProfileProperties",IFCSTRUCTURALLOADSINGLEFORCEWARPING:"IfcStructuralLoadSingleForceWarping",IFCSTRUCTURALLOADSINGLEFORCE:"IfcStructuralLoadSingleForce",IFCSTRUCTURALLOADSINGLEDISPLACEMENTDISTORTION:"IfcStructuralLoadSingleDisplacementDistortion",IFCSTRUCTURALLOADSINGLEDISPLACEMENT:"IfcStructuralLoadSingleDisplacement",IFCSTRUCTURALLOADPLANARFORCE:"IfcStructuralLoadPlanarForce",IFCSTRUCTURALLOADLINEARFORCE:"IfcStructuralLoadLinearForce",IFCSPACETHERMALLOADPROPERTIES:"IfcSpaceThermalLoadProperties",IFCSOUNDVALUE:"IfcSoundValue",IFCSOUNDPROPERTIES:"IfcSoundProperties",IFCSOLIDMODEL:"IfcSolidModel",IFCSLIPPAGECONNECTIONCONDITION:"IfcSlippageConnectionCondition",IFCSHELLBASEDSURFACEMODEL:"IfcShellBasedSurfaceModel",IFCSERVICELIFEFACTOR:"IfcServiceLifeFactor",IFCSECTIONEDSPINE:"IfcSectionedSpine",IFCROUNDEDRECTANGLEPROFILEDEF:"IfcRoundedRectangleProfileDef",IFCRELATIONSHIP:"IfcRelationship",IFCREINFORCEMENTDEFINITIONPROPERTIES:"IfcReinforcementDefinitionProperties",IFCREGULARTIMESERIES:"IfcRegularTimeSeries",IFCRECTANGLEPROFILEDEF:"IfcRectangleProfileDef",IFCPROPERTYTABLEVALUE:"IfcPropertyTableValue",IFCPROPERTYSINGLEVALUE:"IfcPropertySingleValue",IFCPROPERTYSETDEFINITION:"IfcPropertySetDefinition",IFCPROPERTYREFERENCEVALUE:"IfcPropertyReferenceValue",IFCPROPERTYLISTVALUE:"IfcPropertyListValue",IFCPROPERTYENUMERATEDVALUE:"IfcPropertyEnumeratedValue",IFCPROPERTYDEFINITION:"IfcPropertyDefinition",IFCPROPERTYBOUNDEDVALUE:"IfcPropertyBoundedValue",IFCPRODUCTDEFINITIONSHAPE:"IfcProductDefinitionShape",IFCPREDEFINEDPOINTMARKERSYMBOL:"IfcPredefinedPointMarkerSymbol",IFCPREDEFINEDDIMENSIONSYMBOL:"IfcPredefinedDimensionSymbol",IFCPREDEFINEDCURVEFONT:"IfcPredefinedCurveFont",IFCPREDEFINEDCOLOUR:"IfcPredefinedColour",IFCPOLYGONALBOUNDEDHALFSPACE:"IfcPolygonalBoundedHalfSpace",IFCPOLYLOOP:"IfcPolyLoop",IFCPOINTONSURFACE:"IfcPointOnSurface",IFCPOINTONCURVE:"IfcPointOnCurve",IFCPOINT:"IfcPoint",IFCPLANAREXTENT:"IfcPlanarExtent",IFCPLACEMENT:"IfcPlacement",IFCPIXELTEXTURE:"IfcPixelTexture",IFCPHYSICALCOMPLEXQUANTITY:"IfcPhysicalComplexQuantity",IFCPATH:"IfcPath",IFCPARAMETERIZEDPROFILEDEF:"IfcParameterizedProfileDef",IFCORIENTEDEDGE:"IfcOrientedEdge",IFCOPENSHELL:"IfcOpenShell",IFCONEDIRECTIONREPEATFACTOR:"IfcOneDirectionRepeatFactor",IFCOBJECTDEFINITION:"IfcObjectDefinition",IFCMECHANICALCONCRETEMATERIALPROPERTIES:"IfcMechanicalConcreteMaterialProperties",IFCMATERIALDEFINITIONREPRESENTATION:"IfcMaterialDefinitionRepresentation",IFCMAPPEDITEM:"IfcMappedItem",IFCLOOP:"IfcLoop",IFCLOCALPLACEMENT:"IfcLocalPlacement",IFCLIGHTSOURCESPOT:"IfcLightSourceSpot",IFCLIGHTSOURCEPOSITIONAL:"IfcLightSourcePositional",IFCLIGHTSOURCEGONIOMETRIC:"IfcLightSourceGoniometric",IFCLIGHTSOURCEDIRECTIONAL:"IfcLightSourceDirectional",IFCLIGHTSOURCEAMBIENT:"IfcLightSourceAmbient",IFCLIGHTSOURCE:"IfcLightSource",IFCIRREGULARTIMESERIES:"IfcIrregularTimeSeries",IFCIMAGETEXTURE:"IfcImageTexture",IFCHYGROSCOPICMATERIALPROPERTIES:"IfcHygroscopicMaterialProperties",IFCHALFSPACESOLID:"IfcHalfSpaceSolid",IFCGRIDPLACEMENT:"IfcGridPlacement",IFCGEOMETRICSET:"IfcGeometricSet",IFCGEOMETRICREPRESENTATIONSUBCONTEXT:"IfcGeometricRepresentationSubContext",IFCGEOMETRICREPRESENTATIONITEM:"IfcGeometricRepresentationItem",IFCGEOMETRICREPRESENTATIONCONTEXT:"IfcGeometricRepresentationContext",IFCGENERALPROFILEPROPERTIES:"IfcGeneralProfileProperties",IFCGENERALMATERIALPROPERTIES:"IfcGeneralMaterialProperties",IFCFUELPROPERTIES:"IfcFuelProperties",IFCFILLAREASTYLE:"IfcFillAreaStyle",IFCFAILURECONNECTIONCONDITION:"IfcFailureConnectionCondition",IFCFACESURFACE:"IfcFaceSurface",IFCFACEOUTERBOUND:"IfcFaceOuterBound",IFCFACEBOUND:"IfcFaceBound",IFCFACE:"IfcFace",IFCEXTENDEDMATERIALPROPERTIES:"IfcExtendedMaterialProperties",IFCEDGECURVE:"IfcEdgeCurve",IFCEDGE:"IfcEdge",IFCDRAUGHTINGPREDEFINEDTEXTFONT:"IfcDraughtingPredefinedTextFont",IFCDOCUMENTREFERENCE:"IfcDocumentReference",IFCDIMENSIONPAIR:"IfcDimensionPair",IFCDIMENSIONCALLOUTRELATIONSHIP:"IfcDimensionCalloutRelationship",IFCDERIVEDPROFILEDEF:"IfcDerivedProfileDef",IFCCURVESTYLE:"IfcCurveStyle",IFCCONVERSIONBASEDUNIT:"IfcConversionBasedUnit",IFCCONTEXTDEPENDENTUNIT:"IfcContextDependentUnit",IFCCONNECTIONPOINTECCENTRICITY:"IfcConnectionPointEccentricity",IFCCONNECTIONCURVEGEOMETRY:"IfcConnectionCurveGeometry",IFCCONNECTEDFACESET:"IfcConnectedFaceSet",IFCCOMPOSITEPROFILEDEF:"IfcCompositeProfileDef",IFCCOMPLEXPROPERTY:"IfcComplexProperty",IFCCOLOURRGB:"IfcColourRgb",IFCCLASSIFICATIONREFERENCE:"IfcClassificationReference",IFCCENTERLINEPROFILEDEF:"IfcCenterLineProfileDef",IFCBLOBTEXTURE:"IfcBlobTexture",IFCARBITRARYPROFILEDEFWITHVOIDS:"IfcArbitraryProfileDefWithVoids",IFCARBITRARYOPENPROFILEDEF:"IfcArbitraryOpenProfileDef",IFCARBITRARYCLOSEDPROFILEDEF:"IfcArbitraryClosedProfileDef",IFCANNOTATIONTEXTOCCURRENCE:"IfcAnnotationTextOccurrence",IFCANNOTATIONSYMBOLOCCURRENCE:"IfcAnnotationSymbolOccurrence",IFCANNOTATIONSURFACEOCCURRENCE:"IfcAnnotationSurfaceOccurrence",IFCANNOTATIONOCCURRENCE:"IfcAnnotationOccurrence",IFCWATERPROPERTIES:"IfcWaterProperties",IFCVIRTUALGRIDINTERSECTION:"IfcVirtualGridIntersection",IFCVERTEXPOINT:"IfcVertexPoint",IFCVERTEXBASEDTEXTUREMAP:"IfcVertexBasedTextureMap",IFCVERTEX:"IfcVertex",IFCUNITASSIGNMENT:"IfcUnitAssignment",IFCTOPOLOGYREPRESENTATION:"IfcTopologyRepresentation",IFCTOPOLOGICALREPRESENTATIONITEM:"IfcTopologicalRepresentationItem",IFCTIMESERIESVALUE:"IfcTimeSeriesValue",IFCTIMESERIESREFERENCERELATIONSHIP:"IfcTimeSeriesReferenceRelationship",IFCTIMESERIES:"IfcTimeSeries",IFCTHERMALMATERIALPROPERTIES:"IfcThermalMaterialProperties",IFCTEXTUREVERTEX:"IfcTextureVertex",IFCTEXTUREMAP:"IfcTextureMap",IFCTEXTURECOORDINATEGENERATOR:"IfcTextureCoordinateGenerator",IFCTEXTURECOORDINATE:"IfcTextureCoordinate",IFCTEXTSTYLEWITHBOXCHARACTERISTICS:"IfcTextStyleWithBoxCharacteristics",IFCTEXTSTYLETEXTMODEL:"IfcTextStyleTextModel",IFCTEXTSTYLEFORDEFINEDFONT:"IfcTextStyleForDefinedFont",IFCTEXTSTYLEFONTMODEL:"IfcTextStyleFontModel",IFCTEXTSTYLE:"IfcTextStyle",IFCTELECOMADDRESS:"IfcTelecomAddress",IFCTABLEROW:"IfcTableRow",IFCTABLE:"IfcTable",IFCSYMBOLSTYLE:"IfcSymbolStyle",IFCSURFACETEXTURE:"IfcSurfaceTexture",IFCSURFACESTYLEWITHTEXTURES:"IfcSurfaceStyleWithTextures",IFCSURFACESTYLESHADING:"IfcSurfaceStyleShading",IFCSURFACESTYLEREFRACTION:"IfcSurfaceStyleRefraction",IFCSURFACESTYLELIGHTING:"IfcSurfaceStyleLighting",IFCSURFACESTYLE:"IfcSurfaceStyle",IFCSTYLEDREPRESENTATION:"IfcStyledRepresentation",IFCSTYLEDITEM:"IfcStyledItem",IFCSTYLEMODEL:"IfcStyleModel",IFCSTRUCTURALLOADTEMPERATURE:"IfcStructuralLoadTemperature",IFCSTRUCTURALLOADSTATIC:"IfcStructuralLoadStatic",IFCSTRUCTURALLOAD:"IfcStructuralLoad",IFCSTRUCTURALCONNECTIONCONDITION:"IfcStructuralConnectionCondition",IFCSIMPLEPROPERTY:"IfcSimpleProperty",IFCSHAPEREPRESENTATION:"IfcShapeRepresentation",IFCSHAPEMODEL:"IfcShapeModel",IFCSHAPEASPECT:"IfcShapeAspect",IFCSECTIONREINFORCEMENTPROPERTIES:"IfcSectionReinforcementProperties",IFCSECTIONPROPERTIES:"IfcSectionProperties",IFCSIUNIT:"IfcSIUnit",IFCROOT:"IfcRoot",IFCRIBPLATEPROFILEPROPERTIES:"IfcRibPlateProfileProperties",IFCREPRESENTATIONMAP:"IfcRepresentationMap",IFCREPRESENTATIONITEM:"IfcRepresentationItem",IFCREPRESENTATIONCONTEXT:"IfcRepresentationContext",IFCREPRESENTATION:"IfcRepresentation",IFCRELAXATION:"IfcRelaxation",IFCREINFORCEMENTBARPROPERTIES:"IfcReinforcementBarProperties",IFCREFERENCESVALUEDOCUMENT:"IfcReferencesValueDocument",IFCQUANTITYWEIGHT:"IfcQuantityWeight",IFCQUANTITYVOLUME:"IfcQuantityVolume",IFCQUANTITYTIME:"IfcQuantityTime",IFCQUANTITYLENGTH:"IfcQuantityLength",IFCQUANTITYCOUNT:"IfcQuantityCount",IFCQUANTITYAREA:"IfcQuantityArea",IFCPROPERTYENUMERATION:"IfcPropertyEnumeration",IFCPROPERTYDEPENDENCYRELATIONSHIP:"IfcPropertyDependencyRelationship",IFCPROPERTYCONSTRAINTRELATIONSHIP:"IfcPropertyConstraintRelationship",IFCPROPERTY:"IfcProperty",IFCPROFILEPROPERTIES:"IfcProfileProperties",IFCPROFILEDEF:"IfcProfileDef",IFCPRODUCTSOFCOMBUSTIONPROPERTIES:"IfcProductsOfCombustionProperties",IFCPRODUCTREPRESENTATION:"IfcProductRepresentation",IFCPRESENTATIONSTYLEASSIGNMENT:"IfcPresentationStyleAssignment",IFCPRESENTATIONSTYLE:"IfcPresentationStyle",IFCPRESENTATIONLAYERWITHSTYLE:"IfcPresentationLayerWithStyle",IFCPRESENTATIONLAYERASSIGNMENT:"IfcPresentationLayerAssignment",IFCPREDEFINEDTEXTFONT:"IfcPredefinedTextFont",IFCPREDEFINEDTERMINATORSYMBOL:"IfcPredefinedTerminatorSymbol",IFCPREDEFINEDSYMBOL:"IfcPredefinedSymbol",IFCPREDEFINEDITEM:"IfcPredefinedItem",IFCPOSTALADDRESS:"IfcPostalAddress",IFCPHYSICALSIMPLEQUANTITY:"IfcPhysicalSimpleQuantity",IFCPHYSICALQUANTITY:"IfcPhysicalQuantity",IFCPERSONANDORGANIZATION:"IfcPersonAndOrganization",IFCPERSON:"IfcPerson",IFCOWNERHISTORY:"IfcOwnerHistory",IFCORGANIZATIONRELATIONSHIP:"IfcOrganizationRelationship",IFCORGANIZATION:"IfcOrganization",IFCOPTICALMATERIALPROPERTIES:"IfcOpticalMaterialProperties",IFCOBJECTIVE:"IfcObjective",IFCOBJECTPLACEMENT:"IfcObjectPlacement",IFCNAMEDUNIT:"IfcNamedUnit",IFCMONETARYUNIT:"IfcMonetaryUnit",IFCMETRIC:"IfcMetric",IFCMECHANICALSTEELMATERIALPROPERTIES:"IfcMechanicalSteelMaterialProperties",IFCMECHANICALMATERIALPROPERTIES:"IfcMechanicalMaterialProperties",IFCMEASUREWITHUNIT:"IfcMeasureWithUnit",IFCMATERIALPROPERTIES:"IfcMaterialProperties",IFCMATERIALLIST:"IfcMaterialList",IFCMATERIALLAYERSETUSAGE:"IfcMaterialLayerSetUsage",IFCMATERIALLAYERSET:"IfcMaterialLayerSet",IFCMATERIALLAYER:"IfcMaterialLayer",IFCMATERIALCLASSIFICATIONRELATIONSHIP:"IfcMaterialClassificationRelationship",IFCMATERIAL:"IfcMaterial",IFCLOCALTIME:"IfcLocalTime",IFCLIGHTINTENSITYDISTRIBUTION:"IfcLightIntensityDistribution",IFCLIGHTDISTRIBUTIONDATA:"IfcLightDistributionData",IFCLIBRARYREFERENCE:"IfcLibraryReference",IFCLIBRARYINFORMATION:"IfcLibraryInformation",IFCIRREGULARTIMESERIESVALUE:"IfcIrregularTimeSeriesValue",IFCGRIDAXIS:"IfcGridAxis",IFCEXTERNALLYDEFINEDTEXTFONT:"IfcExternallyDefinedTextFont",IFCEXTERNALLYDEFINEDSYMBOL:"IfcExternallyDefinedSymbol",IFCEXTERNALLYDEFINEDSURFACESTYLE:"IfcExternallyDefinedSurfaceStyle",IFCEXTERNALLYDEFINEDHATCHSTYLE:"IfcExternallyDefinedHatchStyle",IFCEXTERNALREFERENCE:"IfcExternalReference",IFCENVIRONMENTALIMPACTVALUE:"IfcEnvironmentalImpactValue",IFCDRAUGHTINGCALLOUTRELATIONSHIP:"IfcDraughtingCalloutRelationship",IFCDOCUMENTINFORMATIONRELATIONSHIP:"IfcDocumentInformationRelationship",IFCDOCUMENTINFORMATION:"IfcDocumentInformation",IFCDOCUMENTELECTRONICFORMAT:"IfcDocumentElectronicFormat",IFCDIMENSIONALEXPONENTS:"IfcDimensionalExponents",IFCDERIVEDUNITELEMENT:"IfcDerivedUnitElement",IFCDERIVEDUNIT:"IfcDerivedUnit",IFCDATEANDTIME:"IfcDateAndTime",IFCCURVESTYLEFONTPATTERN:"IfcCurveStyleFontPattern",IFCCURVESTYLEFONTANDSCALING:"IfcCurveStyleFontAndScaling",IFCCURVESTYLEFONT:"IfcCurveStyleFont",IFCCURRENCYRELATIONSHIP:"IfcCurrencyRelationship",IFCCOSTVALUE:"IfcCostValue",IFCCOORDINATEDUNIVERSALTIMEOFFSET:"IfcCoordinatedUniversalTimeOffset",IFCCONSTRAINTRELATIONSHIP:"IfcConstraintRelationship",IFCCONSTRAINTCLASSIFICATIONRELATIONSHIP:"IfcConstraintClassificationRelationship",IFCCONSTRAINTAGGREGATIONRELATIONSHIP:"IfcConstraintAggregationRelationship",IFCCONSTRAINT:"IfcConstraint",IFCCONNECTIONSURFACEGEOMETRY:"IfcConnectionSurfaceGeometry",IFCCONNECTIONPORTGEOMETRY:"IfcConnectionPortGeometry",IFCCONNECTIONPOINTGEOMETRY:"IfcConnectionPointGeometry",IFCCONNECTIONGEOMETRY:"IfcConnectionGeometry",IFCCOLOURSPECIFICATION:"IfcColourSpecification",IFCCLASSIFICATIONNOTATIONFACET:"IfcClassificationNotationFacet",IFCCLASSIFICATIONNOTATION:"IfcClassificationNotation",IFCCLASSIFICATIONITEMRELATIONSHIP:"IfcClassificationItemRelationship",IFCCLASSIFICATIONITEM:"IfcClassificationItem",IFCCLASSIFICATION:"IfcClassification",IFCCALENDARDATE:"IfcCalendarDate",IFCBOUNDARYNODECONDITIONWARPING:"IfcBoundaryNodeConditionWarping",IFCBOUNDARYNODECONDITION:"IfcBoundaryNodeCondition",IFCBOUNDARYFACECONDITION:"IfcBoundaryFaceCondition",IFCBOUNDARYEDGECONDITION:"IfcBoundaryEdgeCondition",IFCBOUNDARYCONDITION:"IfcBoundaryCondition",IFCAPPROVALRELATIONSHIP:"IfcApprovalRelationship",IFCAPPROVALPROPERTYRELATIONSHIP:"IfcApprovalPropertyRelationship",IFCAPPROVALACTORRELATIONSHIP:"IfcApprovalActorRelationship",IFCAPPROVAL:"IfcApproval",IFCAPPLIEDVALUERELATIONSHIP:"IfcAppliedValueRelationship",IFCAPPLIEDVALUE:"IfcAppliedValue",IFCAPPLICATION:"IfcApplication",IFCADDRESS:"IfcAddress",IFCACTORROLE:"IfcActorRole"};class Mn{constructor(){t(this,"factor",1),t(this,"complement",1)}apply(e){const t=this.getScaleMatrix().multiply(e);e.copy(t)}setUp(e){var t,i,s;this.factor=1;const n=this.getLengthUnits(e);if(!n)return;const r=null==n,o=void 0===n.Name||null===n.Name;r||o||("FOOT"===n.Name.value&&(this.factor=.3048),"MILLI"===(null==(t=n.Prefix)?void 0:t.value)?this.complement=.001:("CENTI"===(null==(i=n.Prefix)?void 0:i.value)||"DECI"===(null==(s=n.Prefix)?void 0:s.value))&&(this.complement=.01))}getLengthUnits(e){try{const t=e.GetLineIDsWithType(0,c.IFCUNITASSIGNMENT).get(0),i=e.GetLine(0,t);for(const t of i.Units){if(!t||null===t.value||void 0===t.value)continue;const i=e.GetLine(0,t.value);if(i.UnitType&&"LENGTHUNIT"===i.UnitType.value)return i}return null}catch(e){return console.log("Could not get units"),null}}getScaleMatrix(){const e=this.factor;return(new o.Matrix4).fromArray([e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1])}}class vn{constructor(){t(this,"itemsByFloor",{}),t(this,"_units",new Mn)}setUp(e){this._units.setUp(e),this.cleanUp();try{const t=e.GetLineIDsWithType(0,c.IFCRELCONTAINEDINSPATIALSTRUCTURE),i=new Set,s=e.GetLineIDsWithType(0,c.IFCSPACE);for(let e=0;e<s.size();e++)i.add(s.get(e));const n=e.GetLineIDsWithType(0,c.IFCRELAGGREGATES),r=n.size();for(let t=0;t<r;t++){const s=n.get(t),r=e.GetLine(0,s);if(!r||!r.RelatingObject||!r.RelatedObjects)continue;const o=r.RelatingObject.value,a=r.RelatedObjects;for(const e of a){const t=e.value;i.has(t)&&(this.itemsByFloor[t]=o)}}const o={},a=t.size();for(let s=0;s<a;s++){const n=t.get(s),r=e.GetLine(0,n);if(!r||!r.RelatingStructure||!r.RelatedElements)continue;const a=r.RelatingStructure.value,c=r.RelatedElements;if(i.has(a))for(const e of c){o[a]||(o[a]=[]);const t=e.value;o[a].push(t)}else for(const e of c){const t=e.value;this.itemsByFloor[t]=a}}for(const e in o){const t=this.itemsByFloor[e];if(void 0!==t){const i=o[e];for(const e of i)this.itemsByFloor[e]=t}}for(let t=0;t<r;t++){const i=n.get(t),s=e.GetLine(0,i);if(!s||!s.RelatingObject||!s.RelatedObjects)continue;const r=s.RelatingObject.value,o=s.RelatedObjects;for(const e of o){const t=e.value,i=this.itemsByFloor[r];void 0!==i&&(this.itemsByFloor[t]=i)}}}catch(e){console.log("Could not get floors.")}}cleanUp(){this.itemsByFloor={}}}class Dn{constructor(){t(this,"includeProperties",!0),t(this,"optionalCategories",[c.IFCSPACE]),t(this,"wasm",{path:"",absolute:!1,logLevel:c.LogLevel.LOG_LEVEL_OFF}),t(this,"excludedCategories",new Set),t(this,"includedCategories",new Set),t(this,"saveLocations",!1),t(this,"webIfc",{COORDINATE_TO_ORIGIN:!0}),t(this,"autoSetWasm",!0),t(this,"customLocateFileHandler",null)}}class bn{constructor(){t(this,"defLineMat",new o.LineBasicMaterial({color:16777215}))}read(e){const t={IfcAlignment:e.GetAllAlignments(0),IfcCrossSection2D:e.GetAllCrossSections2D(0),IfcCrossSection3D:e.GetAllCrossSections3D(0)};return this.get(t)}get(e){if(e.IfcAlignment){const t=new Map;for(const i of e.IfcAlignment){const e=new a.Alignment;e.absolute=this.getCurves(i.curve3D,e),e.horizontal=this.getCurves(i.horizontal,e),e.vertical=this.getCurves(i.vertical,e),t.set(t.size,e)}return{alignments:t,coordinationMatrix:new o.Matrix4}}}getCurves(e,t){const i=[];let s=0;for(const n of e){const e={};if(n.data)for(const t of n.data){const[i,s]=t.split(": "),n=parseFloat(s);e[i]=n||s}const{points:r}=n,c=new Float32Array(3*r.length);for(let e=0;e<r.length;e++){const{x:t,y:i,z:s}=r[e];c[3*e]=t,c[3*e+1]=i,c[3*e+2]=s||0}const l=new o.BufferAttribute(c,3),h=new o.EdgesGeometry;h.setAttribute("position",l);const u=new a.CurveMesh(s,e,t,h,this.defLineMat);i.push(u.curve),s++}return i}}class Un{getNameInfo(e){var t;const i={},{arguments:s}=e.GetHeaderLine(0,c.FILE_NAME)||{};if(!s)return i;const[n,r,o,a,l,h,u]=s;if((null==n?void 0:n.value)&&(i.name=n.value),(null==r?void 0:r.value)&&(i.creationDate=new Date(r.value)),o){i.author={};const[e,t]=o;(null==e?void 0:e.value)&&(i.author.name=e.value),(null==t?void 0:t.value)&&(i.author.email=t.value)}return a&&(null==(t=a[0])?void 0:t.value)&&(i.organization=a[0].value),(null==l?void 0:l.value)&&(i.preprocessorVersion=null==l?void 0:l.value),(null==h?void 0:h.value)&&(i.originatingSystem=null==h?void 0:h.value),(null==u?void 0:u.value)&&(i.authorization=null==u?void 0:u.value),i}getDescriptionInfo(e){var t;const i={},{arguments:s}=e.GetHeaderLine(0,c.FILE_DESCRIPTION)||{};if(!s)return i;const[n,r]=s;if(Array.isArray(n)&&(null==(t=n[0])?void 0:t.value)){const e=n[0].value.match(/\[([^\]]+)\]/);e&&e[1]&&(i.viewDefinition=e[1])}return(null==r?void 0:r.value)&&(i.implementationLevel=r.value),i}}class xn{static get(e,t){const i=[c.IFCPROJECT,c.IFCSITE,c.IFCBUILDING,c.IFCBUILDINGSTOREY,c.IFCSPACE,c.IFCROAD,c.IFCFACILITY,c.IFCFACILITYPART,c.IFCBRIDGE],s=e.data;for(const e of i){const i=t.GetLineIDsWithType(0,e),n=i.size();for(let t=0;t<n;t++){const n=i.get(t);s.has(n)||s.set(n,[[],[0,e]])}}}}const Bn=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,2916149573]),Vn=class e extends xt{constructor(i){super(i),t(this,"enabled",!0),i.add(e.uuid,this)}async export(e,t,i=!1,s=!0){const n={},r=new Set(e.GetIfcEntityList(t)),o=new Set([c.IFCPROJECT,c.IFCSITE,c.IFCBUILDING,c.IFCBUILDINGSTOREY,c.IFCSPACE]);for(const e of o)r.add(e);for(const a of r){if(Bn.has(a))continue;const r=o.has(a)&&s,c=e.GetLineIDsWithType(t,a);for(const t of c)try{const s=e.GetLine(0,t,r,i);n[s.expressID]=s}catch(e){console.log(`Could not get property ${t}, with recursive ${r} and indirect ${i}.`)}}return n}};t(Vn,"uuid","b32c4332-cd67-436e-ba7f-196646c7a635");let Yn=Vn;const Gn=class e extends xt{constructor(i){super(i),t(this,"onDisposed",new Dt),t(this,"onIfcStartedLoading",new Dt),t(this,"onSetup",new Dt),t(this,"settings",new Dn),t(this,"webIfc",new c.IfcAPI),t(this,"enabled",!0),t(this,"_material",new o.MeshLambertMaterial),t(this,"_spatialTree",new vn),t(this,"_metaData",new Un),t(this,"_fragmentInstances",new Map),t(this,"_civil",new bn),t(this,"_visitedFragments",new Map),t(this,"_materialT",new o.MeshLambertMaterial({transparent:!0,opacity:.5})),this.components.add(e.uuid,this),this.settings.excludedCategories.add(c.IFCOPENINGELEMENT)}dispose(){this.webIfc=null,this.onDisposed.trigger(e.uuid),this.onDisposed.reset()}async setup(e){this.settings={...this.settings,...e},this.settings.autoSetWasm&&await this.autoSetWasm(),this.onSetup.trigger()}async load(e,t=!0,i=""){const s=performance.now();this.onIfcStartedLoading.trigger(),await this.readIfcFile(e);const n=await this.getAllGeometries();n.name=i;const r=this.components.get(Yn),o=await r.export(this.webIfc,0);n.setLocalProperties(o);const a=this.components.get(Qn);a.groups.set(n.uuid,n);for(const e of n.items)a.list.set(e.id,e),e.mesh.uuid=e.id,e.group=n;a.onFragmentsLoaded.trigger(n),t&&a.coordinate([n]);for(const[e]of n.data){const t=o[e];if(!t||!t.GlobalId)continue;const i=t.GlobalId.value||t.GlobalId;n.globalToExpressIDs.set(i,e)}return xn.get(n,this.webIfc),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-s} ms!`),n}async readIfcFile(e){const{path:t,absolute:i,logLevel:s}=this.settings.wasm;return this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(this.settings.customLocateFileHandler||void 0),s&&this.webIfc.SetLogLevel(s),this.webIfc.OpenModel(e,this.settings.webIfc)}cleanUp(){try{this.webIfc.Dispose()}catch(e){console.log("Web-ifc wasn't disposed.")}this.webIfc=null,this.webIfc=new c.IfcAPI,this._visitedFragments.clear(),this._fragmentInstances.clear()}async getAllGeometries(){this._spatialTree.setUp(this.webIfc);const e=this.webIfc.GetIfcEntityList(0),t=new a.FragmentsGroup;t.ifcMetadata={name:"",description:"",...this._metaData.getNameInfo(this.webIfc),...this._metaData.getDescriptionInfo(this.webIfc),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};const i=[];for(const s of e){if(!this.webIfc.IsIfcElement(s)&&s!==c.IFCSPACE)continue;const e=this.settings.includedCategories;if(e.size>0&&!e.has(s))continue;if(this.settings.excludedCategories.has(s))continue;const n=this.webIfc.GetLineIDsWithType(0,s),r=n.size();for(let e=0;e<r;e++){const r=n.get(e);i.push(r);const o=this._spatialTree.itemsByFloor[r]||0;t.data.set(r,[[],[o,s]])}}this._spatialTree.cleanUp(),this.webIfc.StreamMeshes(0,i,(e=>{this.getMesh(e,t)}));for(const e of this._visitedFragments){const{index:i,fragment:s}=e[1];t.keyFragments.set(i,s.id)}for(const e of t.items){const t=this._fragmentInstances.get(e.id);if(!t)throw new Error("Fragment not found!");const i=[];for(const[e,s]of t)i.push(s);e.add(i)}const s=this.webIfc.GetCoordinationMatrix(0);return t.coordinationMatrix.fromArray(s),t.civilData=this._civil.read(this.webIfc),t}getMesh(e,t){const i=e.geometries.size(),s=e.expressID;for(let n=0;n<i;n++){const i=e.geometries.get(n),{x:r,y:c,z:l,w:h}=i.color,u=1!==h,{geometryExpressID:I}=i,d=`${I}-${u}`;if(!this._visitedFragments.has(d)){const e=this.getGeometry(this.webIfc,I),i=u?this._materialT:this._material,s=new a.Fragment(e,i,1);t.add(s.mesh),t.items.push(s);const n=this._visitedFragments.size;this._visitedFragments.set(d,{index:n,fragment:s})}const E=(new o.Color).setRGB(r,c,l,"srgb"),f=new o.Matrix4;f.fromArray(i.flatTransformation);const p=this._visitedFragments.get(d);if(void 0===p)throw new Error("Error getting geometry data for streaming!");const C=t.data.get(s);if(!C)throw new Error("Data not found!");C[0].push(p.index);const{fragment:T}=p;this._fragmentInstances.has(T.id)||this._fragmentInstances.set(T.id,new Map);const m=this._fragmentInstances.get(T.id);if(!m)throw new Error("Instances not found!");if(m.has(s)){const e=m.get(s);if(!e)throw new Error("Instance not found!");e.transforms.push(f),e.colors&&e.colors.push(E)}else m.set(s,{id:s,transforms:[f],colors:[E]})}}getGeometry(e,t){const i=e.GetGeometry(0,t),s=e.GetIndexArray(i.GetIndexData(),i.GetIndexDataSize()),n=e.GetVertexArray(i.GetVertexData(),i.GetVertexDataSize()),r=new Float32Array(n.length/2),a=new Float32Array(n.length/2);for(let e=0;e<n.length;e+=6)r[e/2]=n[e],r[e/2+1]=n[e+1],r[e/2+2]=n[e+2],a[e/2]=n[e+3],a[e/2+1]=n[e+4],a[e/2+2]=n[e+5];const c=new o.BufferGeometry,l=new o.BufferAttribute(r,3),h=new o.BufferAttribute(a,3);return c.setAttribute("position",l),c.setAttribute("normal",h),c.setIndex(Array.from(s)),i.delete(),c}async autoSetWasm(){const e=await fetch(`https://unpkg.com/@thatopen/components@${Ei.release}/package.json`);if(!e.ok)return void console.warn("Couldn't get openbim-components package.json. Set wasm settings manually.");const t=await e.json();if("web-ifc"in t.peerDependencies){const e=t.peerDependencies["web-ifc"];this.settings.wasm.path=`https://unpkg.com/web-ifc@${e}/`,this.settings.wasm.absolute=!0}else console.warn("Couldn't get web-ifc from peer dependencies in openbim-components. Set wasm settings manually.")}};t(Gn,"uuid","a659add7-1418-4771-a0d6-7d4d438e4624");let zn=Gn;const kn={IfcRelAssignsToControl:{related:5,relating:7},IfcRelAssignsToGroup:{related:5,relating:7},IfcRelAssignsToProduct:{related:5,relating:7},IfcRelAssociatesClassification:{related:5,relating:6},IfcRelAssociatesMaterial:{related:5,relating:6},IfcRelAssociatesDocument:{related:5,relating:6},IfcRelContainedInSpatialStructure:{related:5,relating:6},IfcRelFlowControlElements:{related:5,relating:6},IfcRelConnectsElements:{related:7,relating:6},IfcRelDeclares:{related:6,relating:5},IfcRelAggregates:{related:6,relating:5},IfcRelNests:{related:6,relating:5},IfcRelDefinesByProperties:{related:5,relating:6},IfcRelDefinesByType:{related:5,relating:6},IfcRelDefinesByTemplate:{related:5,relating:6}},Hn={[c.IFCRELASSIGNSTOCONTROL]:"IfcRelAssignsToControl",[c.IFCRELASSIGNSTOGROUP]:"IfcRelAssignsToGroup",[c.IFCRELASSIGNSTOPRODUCT]:"IfcRelAssignsToProduct",[c.IFCRELASSOCIATESCLASSIFICATION]:"IfcRelAssociatesClassification",[c.IFCRELASSOCIATESMATERIAL]:"IfcRelAssociatesMaterial",[c.IFCRELASSOCIATESDOCUMENT]:"IfcRelAssociatesDocument",[c.IFCRELCONTAINEDINSPATIALSTRUCTURE]:"IfcRelContainedInSpatialStructure",[c.IFCRELCONNECTSELEMENTS]:"IfcRelConnectsElements",[c.IFCRELFLOWCONTROLELEMENTS]:"IfcRelFlowControlElements",[c.IFCRELDECLARES]:"IfcRelDeclares",[c.IFCRELAGGREGATES]:"IfcRelAggregates",[c.IFCRELNESTS]:"IfcRelNests",[c.IFCRELDEFINESBYPROPERTIES]:"IfcRelDefinesByProperties",[c.IFCRELDEFINESBYTYPE]:"IfcRelDefinesByType",[c.IFCRELDEFINESBYTEMPLATE]:"IfcRelDefinesByTemplate"},Wn=class e extends xt{constructor(i){super(i),t(this,"onDisposed",new Dt),t(this,"onRequestFile",new Dt),t(this,"ifcToExport",null),t(this,"onElementToPset",new Dt),t(this,"onPropToPset",new Dt),t(this,"onPsetRemoved",new Dt),t(this,"onDataChanged",new Dt),t(this,"wasm",{path:"/",absolute:!1}),t(this,"enabled",!0),t(this,"attributeListeners",{}),t(this,"selectedModel"),t(this,"changeMap",{}),this.components.add(e.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(e.uuid),this.onDisposed.reset()}static getIFCSchema(e){const t=e.ifcMetadata.schema;if(!t)throw new Error("IFC Schema not found");return t.startsWith("IFC2X3")?"IFC2X3":t.startsWith("IFC4")&&""===t.replace("IFC4","")?"IFC4":t.startsWith("IFC4X3")?"IFC4X3":t}async setData(e,...t){for(const i of t){const{expressID:t}=i;t&&-1!==t||(i.expressID=this.getNewExpressID(e)),await e.setProperties(i.expressID,i),this.registerChange(e,i.expressID)}}async newPset(t,i,s){const n=e.getIFCSchema(t),{handle:r}=await this.getOwnerHistory(t),o=this.newGUID(t),a=new c[n].IfcLabel(i),l=s?new c[n].IfcText(s):null,h=new c[n].IfcPropertySet(o,r,a,l,[]);return h.expressID=this.getNewExpressID(t),await this.setData(t,h),{pset:h}}async removePset(e,...t){for(const i of t){const t=await e.getProperties(i);if((null==t?void 0:t.type)!==c.IFCPROPERTYSET)continue;const s=await Pn.getPsetRel(e,i);if(s&&(await e.setProperties(s,null),this.registerChange(e,s)),t){for(const i of t.HasProperties)await e.setProperties(i.value,null);await e.setProperties(i,null),this.onPsetRemoved.trigger({model:e,psetID:i}),this.registerChange(e,i)}}}newSingleStringProperty(e,t,i,s){return this.newSingleProperty(e,t,i,s)}newSingleNumericProperty(e,t,i,s){return this.newSingleProperty(e,t,i,s)}newSingleBooleanProperty(e,t,i,s){return this.newSingleProperty(e,t,i,s)}async removePsetProp(e,t,i){const s=await e.getProperties(t),n=await e.getProperties(i);s&&n&&s.type===c.IFCPROPERTYSET&&n&&(s.HasProperties=s.HasProperties.filter((e=>e.value!==i)),await e.setProperties(i,null),this.registerChange(e,t,i))}addElementToPset(e,t,...i){this.components.get(Zn).addEntitiesRelation(e,t,{type:c.IFCRELDEFINESBYPROPERTIES,inv:"DefinesOcurrence"},...i)}async addPropToPset(e,t,...i){const s=await e.getProperties(t);if(s){for(const n of i){if(s.HasProperties.includes(n))continue;const i=new c.Handle(n);s.HasProperties.push(i),this.onPropToPset.trigger({model:e,psetID:t,propID:n})}this.registerChange(e,t)}}async createIfcRel(t,i,s,n){const r=Hn[i];if(!r)throw new Error(`IfcPropertiesManager: ${r} is unsoported.`);const o=e.getIFCSchema(t),a=kn[r],l=c[o][r];if(!a||!l)throw new Error(`IfcPropertiesManager: ${r} is unsoported.`);const h=[new c[o].IfcGloballyUniqueId(Ii.create())],{related:u,relating:I}=a,d=[...new Set(n)].map((e=>new c.Handle(e))),E=(e,t)=>{for(let i=e;i<t-1;i++)h.push(null)};u<I?(E(1,u),h.push(d),E(u,I),h.push(new c.Handle(s))):(E(1,I),E(I,u),h.push(new c.Handle(s)),h.push(d));const f=new l(...h);return await this.setData(t,f),f}async saveToIfc(e,t){const i=this.components.get(zn),s=i.webIfc,n=await i.readIfcFile(t),r=this.components.get(Zn);await r.applyRelationChanges();const o=this.changeMap[e.uuid]??[];for(const t of o){const i=await e.getProperties(t);if(i)s.WriteLine(n,i);else{s.GetLine(n,t)&&s.DeleteLine(n,t)}}const a=s.SaveModel(n);return i.webIfc.CloseModel(n),i.cleanUp(),a}async getEntityRef(e,t){const i=await e.getAllPropertiesOfType(t);if(!i)return null;const s=[];for(const e in i){const t=new c.Handle(Number(e));s.push(t)}return s}async setAttributeListener(e,t,i){this.attributeListeners[e.uuid]||(this.attributeListeners[e.uuid]={});const s=this.attributeListeners[e.uuid][t]?this.attributeListeners[e.uuid][t][i]:null;if(s)return s;const n=await e.getProperties(t);if(!n)throw new Error(`Entity with expressID ${t} doesn't exists.`);const r=n[i];if(Array.isArray(r)||!r)throw new Error(`Attribute ${i} is array or null, and it can't have a listener.`);const o=r.value;if(void 0===o||null==o)throw new Error(`Attribute ${i} has a badly defined handle.`);const a=new Dt;return Object.defineProperty(n[i],"value",{get(){return this._value},async set(e){this._value=e,a.trigger(e)}}),n[i].value=o,this.attributeListeners[e.uuid][t]||(this.attributeListeners[e.uuid][t]={}),this.attributeListeners[e.uuid][t][i]=a,a}getNewExpressID(e){return e.ifcMetadata.maxExpressID++,e.ifcMetadata.maxExpressID}newGUID(t){const i=e.getIFCSchema(t);return new c[i].IfcGloballyUniqueId(Ii.create())}async getOwnerHistory(e){const t=await e.getAllPropertiesOfType(c.IFCOWNERHISTORY);if(!t)throw new Error("No OwnerHistory was found.");const i=t[Object.keys(t).map((e=>parseInt(e,10)))[0]];return{entity:i,handle:new c.Handle(i.expressID)}}registerChange(e,...t){this.changeMap[e.uuid]||(this.changeMap[e.uuid]=new Set);for(const i of t)this.changeMap[e.uuid].add(i),this.onDataChanged.trigger({model:e,expressID:i})}async newSingleProperty(t,i,s,n){const r=e.getIFCSchema(t),o=new c[r].IfcIdentifier(s),a=new c[r][i](n),l=new c[r].IfcPropertySingleValue(o,null,a,null);return l.expressID=this.getNewExpressID(t),await this.setData(t,l),l}};t(Wn,"uuid","58c2d9f0-183c-48d6-a402-dfcf5b9a34df");let Xn=Wn;const jn=class e extends xt{constructor(i){super(i),t(this,"onDisposed",new Dt),t(this,"onRelationsIndexed",new Dt),t(this,"relationMaps",{}),t(this,"enabled",!0),t(this,"_relToAttributesMap",yn),t(this,"_inverseAttributes",["IsDecomposedBy","Decomposes","AssociatedTo","HasAssociations","ClassificationForObjects","IsGroupedBy","HasAssignments","IsDefinedBy","DefinesOcurrence","IsTypedBy","Types","Defines","ContainedInStructure","ContainsElements","HasControlElements","AssignedToFlowElement","ConnectedTo","ConnectedFrom","ReferencedBy","Declares","HasContext","Controls","IsNestedBy","Nests","DocumentRefForObjects"]),t(this,"_ifcRels",[c.IFCRELAGGREGATES,c.IFCRELASSOCIATESMATERIAL,c.IFCRELASSOCIATESCLASSIFICATION,c.IFCRELASSIGNSTOGROUP,c.IFCRELDEFINESBYPROPERTIES,c.IFCRELDEFINESBYTYPE,c.IFCRELDEFINESBYTEMPLATE,c.IFCRELCONTAINEDINSPATIALSTRUCTURE,c.IFCRELFLOWCONTROLELEMENTS,c.IFCRELCONNECTSELEMENTS,c.IFCRELASSIGNSTOPRODUCT,c.IFCRELDECLARES,c.IFCRELASSIGNSTOCONTROL,c.IFCRELNESTS,c.IFCRELASSOCIATESDOCUMENT]),t(this,"onFragmentsDisposed",(e=>{delete this.relationMaps[e.groupID]})),t(this,"_changeMap",{}),t(this,"onEntitiesRelated",new Dt),this.components.add(e.uuid,this);i.get(Qn).onFragmentsDisposed.add(this.onFragmentsDisposed)}indexRelations(e,t,i,s){const n=Object.keys(t).find((e=>e.startsWith("Relating"))),r=Object.keys(t).find((e=>e.startsWith("Related")));if(!n||!r)return;const o=t[n].value,a=t[r].map((e=>e.value)),c=this.getEntityRelations(e,o,s);for(const e of a)c.push(e);for(const t of a){this.getEntityRelations(e,t,i).push(o)}}getAttributeIndex(e){const t=this._inverseAttributes.indexOf(e);if(-1===t)throw new Error(`IfcRelationsIndexer: ${e} is not a valid IFC Inverse Attribute name or its not supported yet by this component.`);return t}setRelationMap(e,t){this.relationMaps[e.uuid]=t,this.onRelationsIndexed.trigger({modelID:e.uuid,relationsMap:t})}async process(e,t){if(!e.hasProperties)throw new Error("FragmentsGroup properties not found");let i=this.relationMaps[e.uuid];i||(i=new Map,this.relationMaps[e.uuid]=i);const s=e.getLocalProperties();if(!s)return i;const n=(null==t?void 0:t.relationsToProcess)??this._ifcRels;for(const[e,t]of Object.entries(s)){if(!n.includes(t.type))continue;const e=this._relToAttributesMap.get(t.type);if(!e)continue;const{forRelated:s,forRelating:r}=e;this.indexRelations(i,t,s,r)}return this.setRelationMap(e,i),i}async processFromWebIfc(e,t){const i=new Map;for(const s of this._ifcRels){const n=this._relToAttributesMap.get(s);if(!n)continue;const{forRelated:r,forRelating:o}=n,a=e.GetLineIDsWithType(t,s);for(let s=0;s<a.size();s++){const n=await e.properties.getItemProperties(t,a.get(s));this.indexRelations(i,n,r,o)}}return this.onRelationsIndexed.trigger({modelID:t.toString(),relationsMap:i}),i}getEntityRelations(e,t,i){const n=this.getAttributeIndex(i);let r;if(r=e instanceof s.FragmentsGroup?this.relationMaps[e.uuid]:"string"==typeof e?this.relationMaps[e]:e,!r&&(e instanceof s.FragmentsGroup||"string"==typeof e)){r=new Map;const t=e instanceof s.FragmentsGroup?e.uuid:e;this.relationMaps[t]=r}let o=r.get(t);o||(o=new Map,r.set(t,o));let a=o.get(n);return a||(a=[],o.set(n,a)),a}serializeRelations(e){const t={};for(const[i,s]of e.entries()){t[i]||(t[i]={});for(const[e,n]of s.entries())t[i][e]=n}return JSON.stringify(t)}serializeModelRelations(e){const t=this.relationMaps[e.uuid];if(!t)return null;return this.serializeRelations(t)}serializeAllRelations(){const e={};for(const t in this.relationMaps){const i=this.relationMaps[t],s={};for(const[e,t]of i.entries()){s[e]||(s[e]={});for(const[i,n]of t.entries())s[e][i]=n}e[t]=s}return JSON.stringify(e)}getRelationsMapFromJSON(e){const t=JSON.parse(e),i=new Map;for(const e in t){const s=t[e],n=new Map;for(const e in s)n.set(Number(e),s[e]);i.set(Number(e),n)}return i}dispose(){this.relationMaps={};this.components.get(Qn).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(e.uuid),this.onDisposed.reset()}getEntitiesWithRelation(e,t,i){const s=this.relationMaps[e.uuid];if(!s)throw new Error("IfcRelationsIndexer: the model relations are not indexed!");const n=new Set;for(const[e,r]of s){const s=this.getAttributeIndex(t),o=r.get(s);o&&o.includes(i)&&n.add(e)}return n}addEntityRelations(e,t,i,...s){const n=this.getEntityRelations(e,t,i);if(n)n.push(...s);else{const n=this.getAttributeIndex(i),r=this.relationMaps[e.uuid].get(t);null==r||r.set(n,s)}}async applyRelationChanges(){const e=this.components.get(Qn),t=this.components.get(Xn);for(const i in this._changeMap){const s=e.groups.get(i);if(!s)continue;const n=this._changeMap[i];for(const[e,i]of n)for(const[n,r]of i){const{related:i,relID:o}=r;if(o){const e=await s.getProperties(o);if(!e)continue;const r=Object.keys(e),a=r.find((e=>e.startsWith("Related"))),l=r.find((e=>e.startsWith("Relating")));if(!a||!l)continue;e[a]=[...i].map((e=>new c.Handle(e))),e[l]=new c.Handle(n),await t.setData(s,e)}else{const o=await t.createIfcRel(s,e,n,[...i]);if(!o)continue;r.relID=o.expressID}}}}addEntitiesRelation(e,t,i,...s){const{type:n,inv:r}=i;let o=this.relationMaps[e.uuid];if(o||(o=new Map,this.relationMaps[e.uuid]=o),!this._ifcRels.includes(n))return;const a=yn.get(n);if(!a)return;const{forRelated:c,forRelating:l}=a;if(c!==r&&l!==r)return;let h=this._changeMap[e.uuid];h||(h=new Wt,this._changeMap[e.uuid]=h);const u=l===r?[t]:s,I=c===r?[t]:s;let d=h.get(n);d||(d=new Wt,d.onItemSet.add((()=>this.onEntitiesRelated.trigger({invAttribute:r,relType:n,relatingIDs:u,relatedIDs:I}))),d.onItemUpdated.add((()=>this.onEntitiesRelated.trigger({invAttribute:r,relType:n,relatingIDs:u,relatedIDs:I}))),h.set(n,d));for(const e of u){let t=d.get(e);t||(t={related:new Ht},d.set(e,t)),t.related.add(...I)}for(const t of u){this.getEntityRelations(e,t,l).push(...I)}for(const t of I){this.getEntityRelations(e,t,c).push(...u)}}getEntityChildren(e,t,i=new Set){i.add(t);if(void 0===this.relationMaps[e.uuid])throw new Error("The provided model has no indices. You have to generate them first.");const s=this.getEntityRelations(e,t,"IsDecomposedBy");if(s)for(const t of s)this.getEntityChildren(e,t,i);const n=this.getEntityRelations(e,t,"ContainsElements");if(n)for(const t of n)this.getEntityChildren(e,t,i);return i}};t(jn,"uuid","23a889ab-83b3-44a4-8bee-ead83438370b");let Zn=jn;const $n=class e extends xt{constructor(i){super(i),t(this,"onDisposed",new Dt),t(this,"onFragmentsLoaded",new Dt),t(this,"onFragmentsDisposed",new Dt),t(this,"list",new Wt),t(this,"groups",new Wt),t(this,"baseCoordinationModel",""),t(this,"baseCoordinationMatrix",new o.Matrix4),t(this,"enabled",!0),t(this,"_loader",new s.Serializer),this.components.add(e.uuid,this)}get meshes(){const e=[];for(const[t,i]of this.list)e.push(i.mesh);return e}dispose(){for(const[e,t]of this.groups)t.dispose(!0);this.baseCoordinationModel="",this.groups.clear(),this.list.clear(),this.onFragmentsLoaded.reset(),this.onFragmentsDisposed.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}disposeGroup(e){const{uuid:t}=e,i=[];for(const t of e.items)i.push(t.id),this.list.delete(t.id);e.dispose(!0),this.groups.delete(e.uuid),0===this.groups.size&&(this.baseCoordinationModel="",this.baseCoordinationMatrix=new o.Matrix4),this.onFragmentsDisposed.trigger({groupID:t,fragmentIDs:i})}load(e,t){const i={coordinate:!0,...t},{coordinate:s,name:n,properties:r,relationsMap:o}=i,a=this._loader.import(e);t&&(a.isStreamed=t.isStreamed||!1),n&&(a.name=n);for(const e of a.items)e.group=a,this.list.set(e.id,e);if(s&&this.coordinate([a]),this.groups.set(a.uuid,a),r&&a.setLocalProperties(r),o){this.components.get(Zn).setRelationMap(a,o)}return this.onFragmentsLoaded.trigger(a),a}export(e){return this._loader.export(e)}getModelIdMap(e){const t={};for(const i in e){const s=this.list.get(i);if(!s||!s.group)continue;const n=s.group;n.uuid in t||(t[n.uuid]=new Set);const r=e[i];for(const e of r)t[n.uuid].add(e)}return t}modelIdToFragmentIdMap(e){let t={};for(const i in e){const s=this.groups.get(i);if(!s)continue;const n=e[i],r=s.getFragmentMap(n);t={...t,...r}}return t}guidToFragmentIdMap(e){const t={};for(const[i,s]of this.groups){i in t||(t[i]=new Set);for(const n of e){const e=s.globalToExpressIDs.get(n);e&&t[i].add(e)}}return this.modelIdToFragmentIdMap(t)}fragmentIdMapToGuids(e){const t=[],i=this.getModelIdMap(e);for(const e in i){const s=this.groups.get(e);if(!s)continue;const n=i[e];for(const e of n)for(const[i,n]of s.globalToExpressIDs.entries())if(n===e){t.push(i);break}}return t}coordinate(e=Array.from(this.groups.values())){if(0===this.baseCoordinationModel.length){const t=e.pop();if(!t)return;this.baseCoordinationModel=t.uuid,this.baseCoordinationMatrix=t.coordinationMatrix.clone()}if(e.length)for(const t of e)t.coordinationMatrix.equals(this.baseCoordinationMatrix)||(t.position.set(0,0,0),t.rotation.set(0,0,0),t.scale.set(1,1,1),t.updateMatrix(),this.applyBaseCoordinateSystem(t,t.coordinationMatrix))}applyBaseCoordinateSystem(e,t){t&&e.applyMatrix4(t.clone().invert()),e.applyMatrix4(this.baseCoordinationMatrix)}clone(e,t){const i=e.cloneGroup(t);this.groups.set(i.uuid,i);for(const e of i.items)this.list.set(e.id,e);return i}};t($n,"uuid","fef46874-46a3-461b-8c44-2922ab77c806");let Qn=$n;var qn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Kn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Jn(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var er={exports:{}};
8
+ const es=1,ts=2,is=4,ss=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}),ns=0,rs=1,os=-1;function as(e){return e.isPerspectiveCamera}function cs(e){return e.isOrthographicCamera}const ls=2*Math.PI,hs=Math.PI/2,us=Math.PI/180;function Is(e,t,i){return Math.max(t,Math.min(i,e))}function ds(e,t=1e-5){return Math.abs(e)<t}function Es(e,t,i=1e-5){return ds(e-t,i)}function fs(e,t){return Math.round(e/t)*t}function ps(e){return isFinite(e)?e:e<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Cs(e){return Math.abs(e)<Number.MAX_VALUE?e:e*(1/0)}function Ts(e,t,i,s,n=1/0,r){const o=2/(s=Math.max(1e-4,s)),a=o*r,c=1/(1+a+.48*a*a+.235*a*a*a);let l=e-t;const h=t,u=n*s;l=Is(l,-u,u),t=e-l;const I=(i.value+o*l)*r;i.value=(i.value-o*I)*c;let d=t+(l+I)*c;return h-e>0==d>h&&(d=h,i.value=(d-h)/r),d}function ms(e,t,i,s,n=1/0,r,o){const a=2/(s=Math.max(1e-4,s)),c=a*r,l=1/(1+c+.48*c*c+.235*c*c*c);let h=t.x,u=t.y,I=t.z,d=e.x-h,E=e.y-u,f=e.z-I;const p=h,C=u,T=I,m=n*s,R=d*d+E*E+f*f;if(R>m*m){const e=Math.sqrt(R);d=d/e*m,E=E/e*m,f=f/e*m}h=e.x-d,u=e.y-E,I=e.z-f;const g=(i.x+a*d)*r,A=(i.y+a*E)*r,F=(i.z+a*f)*r;i.x=(i.x-a*g)*l,i.y=(i.y-a*A)*l,i.z=(i.z-a*F)*l,o.x=h+(d+g)*l,o.y=u+(E+A)*l,o.z=I+(f+F)*l;const S=p-e.x,O=C-e.y,N=T-e.z;return S*(o.x-p)+O*(o.y-C)+N*(o.z-T)>0&&(o.x=p,o.y=C,o.z=T,i.x=(o.x-p)/r,i.y=(o.y-C)/r,i.z=(o.z-T)/r),o}function Rs(e,t){t.set(0,0),e.forEach((e=>{t.x+=e.clientX,t.y+=e.clientY})),t.x/=e.length,t.y/=e.length}function gs(e,t){return!!cs(e)&&(console.warn(`${t} is not supported in OrthographicCamera`),!0)}class As{constructor(){this._listeners={}}addEventListener(e,t){const i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)}removeEventListener(e,t){const i=this._listeners[e];if(void 0!==i){const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}removeAllEventListeners(e){e?Array.isArray(this._listeners[e])&&(this._listeners[e].length=0):this._listeners={}}dispatchEvent(e){const t=this._listeners[e.type];if(void 0!==t){e.target=this;const i=t.slice(0);for(let t=0,s=i.length;t<s;t++)i[t].call(this,e)}}}const Fs=1/8,Ss="undefined"!=typeof window,Os=Ss&&/Mac/.test(navigator.platform),Ns=!(Ss&&"PointerEvent"in window);let ys,_s,Ls,Ps,ws,Ms,vs,Ds,xs,bs,Us,Bs,Vs,Ys,Gs,zs,ks,Hs,Ws,Xs,Zs,js,$s;class Qs extends As{static install(e){ys=e.THREE,_s=Object.freeze(new ys.Vector3(0,0,0)),Ls=Object.freeze(new ys.Vector3(0,1,0)),Ps=Object.freeze(new ys.Vector3(0,0,1)),ws=new ys.Vector2,Ms=new ys.Vector3,vs=new ys.Vector3,Ds=new ys.Vector3,xs=new ys.Vector3,bs=new ys.Vector3,Us=new ys.Vector3,Bs=new ys.Vector3,Vs=new ys.Vector3,Ys=new ys.Vector3,Gs=new ys.Spherical,zs=new ys.Spherical,ks=new ys.Box3,Hs=new ys.Box3,Ws=new ys.Sphere,Xs=new ys.Quaternion,Zs=new ys.Quaternion,js=new ys.Matrix4,$s=new ys.Raycaster}static get ACTION(){return ss}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=ss.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=ns,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new ys.Vector3,this._focalOffsetVelocity=new ys.Vector3,this._zoomVelocity={value:0},this._truckInternal=(e,t,i)=>{let s,n;if(as(this._camera)){const i=Ms.copy(this._camera.position).sub(this._target),r=this._camera.getEffectiveFOV()*us,o=i.length()*Math.tan(.5*r);s=this.truckSpeed*e*o/this._elementRect.height,n=this.truckSpeed*t*o/this._elementRect.height}else{if(!cs(this._camera))return;{const i=this._camera;s=e*(i.right-i.left)/i.zoom/this._elementRect.width,n=t*(i.top-i.bottom)/i.zoom/this._elementRect.height}}this.verticalDragToForward?(i?this.setFocalOffset(this._focalOffsetEnd.x+s,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(s,0,!0),this.forward(-n,!0)):i?this.setFocalOffset(this._focalOffsetEnd.x+s,this._focalOffsetEnd.y+n,this._focalOffsetEnd.z,!0):this.truck(s,n,!0)},this._rotateInternal=(e,t)=>{const i=ls*this.azimuthRotateSpeed*e/this._elementRect.height,s=ls*this.polarRotateSpeed*t/this._elementRect.height;this.rotate(i,s,!0)},this._dollyInternal=(e,t,i)=>{const s=Math.pow(.95,-e*this.dollySpeed),n=this._sphericalEnd.radius,r=this._sphericalEnd.radius*s,o=Is(r,this.minDistance,this.maxDistance),a=o-r;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(r,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(a,!0),this._dollyToNoClamp(o,!0)):this._dollyToNoClamp(o,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?r:o)-n,this._dollyControlCoord.set(t,i)),this._lastDollyDirection=Math.sign(-e)},this._zoomInternal=(e,t,i)=>{const s=Math.pow(.95,e*this.dollySpeed),n=this._zoom,r=this._zoom*s;this.zoomTo(r,!0),this.dollyToCursor&&(this._changedZoom+=r-n,this._dollyControlCoord.set(t,i))},void 0===ys&&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 ys.Quaternion).setFromUnitVectors(this._camera.up,Ls),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=ss.NONE,this._target=new ys.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new ys.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=(new ys.Spherical).setFromVector3(Ms.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 ys.Vector3,new ys.Vector3,new ys.Vector3,new ys.Vector3],this._updateNearPlaneCorners(),this._boundary=new ys.Box3(new ys.Vector3(-1/0,-1/0,-1/0),new ys.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 ys.Vector2,this.mouseButtons={left:ss.ROTATE,middle:ss.DOLLY,right:ss.TRUCK,wheel:as(this._camera)?ss.DOLLY:cs(this._camera)?ss.ZOOM:ss.NONE},this.touches={one:ss.TOUCH_ROTATE,two:as(this._camera)?ss.TOUCH_DOLLY_TRUCK:cs(this._camera)?ss.TOUCH_ZOOM_TRUCK:ss.NONE,three:ss.TOUCH_TRUCK};const i=new ys.Vector2,s=new ys.Vector2,n=new ys.Vector2,r=e=>{if(!this._enabled||!this._domElement)return;if(0!==this._interactiveArea.left||0!==this._interactiveArea.top||1!==this._interactiveArea.width||1!==this._interactiveArea.height){const t=this._domElement.getBoundingClientRect(),i=e.clientX/t.width,s=e.clientY/t.height;if(i<this._interactiveArea.left||i>this._interactiveArea.right||s<this._interactiveArea.top||s>this._interactiveArea.bottom)return}const t="mouse"!==e.pointerType?null:(e.buttons&es)===es?es:(e.buttons&is)===is?is:(e.buttons&ts)===ts?ts:null;if(null!==t){const e=this._findPointerByMouseButton(t);e&&this._disposePointer(e)}if((e.buttons&es)===es&&this._lockedPointer)return;const i={pointerId:e.pointerId,clientX:e.clientX,clientY:e.clientY,deltaX:0,deltaY:0,mouseButton:t};this._activePointers.push(i),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),this._isDragging=!0,E(e)},o=e=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(0!==this._interactiveArea.left||0!==this._interactiveArea.top||1!==this._interactiveArea.width||1!==this._interactiveArea.height){const t=this._domElement.getBoundingClientRect(),i=e.clientX/t.width,s=e.clientY/t.height;if(i<this._interactiveArea.left||i>this._interactiveArea.right||s<this._interactiveArea.top||s>this._interactiveArea.bottom)return}const t=(e.buttons&es)===es?es:(e.buttons&is)===is?is:(e.buttons&ts)===ts?ts:null;if(null!==t){const e=this._findPointerByMouseButton(t);e&&this._disposePointer(e)}const i={pointerId:1,clientX:e.clientX,clientY:e.clientY,deltaX:0,deltaY:0,mouseButton:(e.buttons&es)===es?es:(e.buttons&is)===es?is:(e.buttons&ts)===es?ts:null};this._activePointers.push(i),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",h),this._domElement.ownerDocument.addEventListener("mousemove",c),this._domElement.ownerDocument.addEventListener("mouseup",h),this._isDragging=!0,E(e)},a=e=>{e.cancelable&&e.preventDefault();const t=e.pointerId,i=this._lockedPointer||this._findPointerById(t);if(i){if(i.clientX=e.clientX,i.clientY=e.clientY,i.deltaX=e.movementX,i.deltaY=e.movementY,this._state=0,"touch"===e.pointerType)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}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(e.buttons&es)===es)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(e.buttons&is)===is&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(e.buttons&ts)===ts&&(this._state=this._state|this.mouseButtons.right);f()}},c=e=>{const t=this._lockedPointer||this._findPointerById(1);t&&(t.clientX=e.clientX,t.clientY=e.clientY,t.deltaX=e.movementX,t.deltaY=e.movementY,this._state=0,(this._lockedPointer||(e.buttons&es)===es)&&(this._state=this._state|this.mouseButtons.left),(e.buttons&is)===is&&(this._state=this._state|this.mouseButtons.middle),(e.buttons&ts)===ts&&(this._state=this._state|this.mouseButtons.right),f())},l=e=>{const t=this._findPointerById(e.pointerId);if(!t||t!==this._lockedPointer){if(t&&this._disposePointer(t),"touch"===e.pointerType)switch(this._activePointers.length){case 0:this._state=ss.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}else this._state=ss.NONE;p()}},h=()=>{const e=this._findPointerById(1);e&&e===this._lockedPointer||(e&&this._disposePointer(e),this._state=ss.NONE,p())};let u=-1;const I=e=>{if(!this._domElement)return;if(!this._enabled||this.mouseButtons.wheel===ss.NONE)return;if(0!==this._interactiveArea.left||0!==this._interactiveArea.top||1!==this._interactiveArea.width||1!==this._interactiveArea.height){const t=this._domElement.getBoundingClientRect(),i=e.clientX/t.width,s=e.clientY/t.height;if(i<this._interactiveArea.left||i>this._interactiveArea.right||s<this._interactiveArea.top||s>this._interactiveArea.bottom)return}if(e.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===ss.ROTATE||this.mouseButtons.wheel===ss.TRUCK){const e=performance.now();u-e<1e3&&this._getClientRect(this._elementRect),u=e}const t=Os?-1:-3,i=1===e.deltaMode?e.deltaY/t:e.deltaY/(10*t),s=this.dollyToCursor?(e.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,n=this.dollyToCursor?(e.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case ss.ROTATE:this._rotateInternal(e.deltaX,e.deltaY),this._isUserControllingRotate=!0;break;case ss.TRUCK:this._truckInternal(e.deltaX,e.deltaY,!1),this._isUserControllingTruck=!0;break;case ss.OFFSET:this._truckInternal(e.deltaX,e.deltaY,!0),this._isUserControllingOffset=!0;break;case ss.DOLLY:this._dollyInternal(-i,s,n),this._isUserControllingDolly=!0;break;case ss.ZOOM:this._zoomInternal(-i,s,n),this._isUserControllingZoom=!0}this.dispatchEvent({type:"control"})},d=e=>{if(this._domElement&&this._enabled){if(this.mouseButtons.right===Qs.ACTION.NONE){const t=e instanceof PointerEvent?e.pointerId:(MouseEvent,0),i=this._findPointerById(t);return i&&this._disposePointer(i),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.removeEventListener("mousemove",c),void this._domElement.ownerDocument.removeEventListener("mouseup",h)}e.preventDefault()}},E=e=>{if(!this._enabled)return;Rs(this._activePointers,ws),this._getClientRect(this._elementRect),i.copy(ws),s.copy(ws);if(this._activePointers.length>=2){const e=ws.x-this._activePointers[1].clientX,t=ws.y-this._activePointers[1].clientY,i=Math.sqrt(e*e+t*t);n.set(0,i);const r=.5*(this._activePointers[0].clientX+this._activePointers[1].clientX),o=.5*(this._activePointers[0].clientY+this._activePointers[1].clientY);s.set(r,o)}if(this._state=0,e)if("pointerType"in e&&"touch"===e.pointerType)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}else this._lockedPointer||(e.buttons&es)!==es||(this._state=this._state|this.mouseButtons.left),(e.buttons&is)===is&&(this._state=this._state|this.mouseButtons.middle),(e.buttons&ts)===ts&&(this._state=this._state|this.mouseButtons.right);else this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);(this._state&ss.ROTATE)!==ss.ROTATE&&(this._state&ss.TOUCH_ROTATE)!==ss.TOUCH_ROTATE&&(this._state&ss.TOUCH_DOLLY_ROTATE)!==ss.TOUCH_DOLLY_ROTATE&&(this._state&ss.TOUCH_ZOOM_ROTATE)!==ss.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&ss.TRUCK)!==ss.TRUCK&&(this._state&ss.TOUCH_TRUCK)!==ss.TOUCH_TRUCK&&(this._state&ss.TOUCH_DOLLY_TRUCK)!==ss.TOUCH_DOLLY_TRUCK&&(this._state&ss.TOUCH_ZOOM_TRUCK)!==ss.TOUCH_ZOOM_TRUCK||(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),(this._state&ss.DOLLY)!==ss.DOLLY&&(this._state&ss.TOUCH_DOLLY)!==ss.TOUCH_DOLLY&&(this._state&ss.TOUCH_DOLLY_TRUCK)!==ss.TOUCH_DOLLY_TRUCK&&(this._state&ss.TOUCH_DOLLY_OFFSET)!==ss.TOUCH_DOLLY_OFFSET&&(this._state&ss.TOUCH_DOLLY_ROTATE)!==ss.TOUCH_DOLLY_ROTATE||(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),(this._state&ss.ZOOM)!==ss.ZOOM&&(this._state&ss.TOUCH_ZOOM)!==ss.TOUCH_ZOOM&&(this._state&ss.TOUCH_ZOOM_TRUCK)!==ss.TOUCH_ZOOM_TRUCK&&(this._state&ss.TOUCH_ZOOM_OFFSET)!==ss.TOUCH_ZOOM_OFFSET&&(this._state&ss.TOUCH_ZOOM_ROTATE)!==ss.TOUCH_ZOOM_ROTATE||(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),(this._state&ss.OFFSET)!==ss.OFFSET&&(this._state&ss.TOUCH_OFFSET)!==ss.TOUCH_OFFSET&&(this._state&ss.TOUCH_DOLLY_OFFSET)!==ss.TOUCH_DOLLY_OFFSET&&(this._state&ss.TOUCH_ZOOM_OFFSET)!==ss.TOUCH_ZOOM_OFFSET||(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},f=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,Rs(this._activePointers,ws);const e=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,t=e?-e.deltaX:s.x-ws.x,r=e?-e.deltaY:s.y-ws.y;if(s.copy(ws),(this._state&ss.ROTATE)!==ss.ROTATE&&(this._state&ss.TOUCH_ROTATE)!==ss.TOUCH_ROTATE&&(this._state&ss.TOUCH_DOLLY_ROTATE)!==ss.TOUCH_DOLLY_ROTATE&&(this._state&ss.TOUCH_ZOOM_ROTATE)!==ss.TOUCH_ZOOM_ROTATE||(this._rotateInternal(t,r),this._isUserControllingRotate=!0),(this._state&ss.DOLLY)===ss.DOLLY||(this._state&ss.ZOOM)===ss.ZOOM){const e=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,t=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0,s=this.dollyDragInverted?-1:1;(this._state&ss.DOLLY)===ss.DOLLY?(this._dollyInternal(s*r*Fs,e,t),this._isUserControllingDolly=!0):(this._zoomInternal(s*r*Fs,e,t),this._isUserControllingZoom=!0)}if((this._state&ss.TOUCH_DOLLY)===ss.TOUCH_DOLLY||(this._state&ss.TOUCH_ZOOM)===ss.TOUCH_ZOOM||(this._state&ss.TOUCH_DOLLY_TRUCK)===ss.TOUCH_DOLLY_TRUCK||(this._state&ss.TOUCH_ZOOM_TRUCK)===ss.TOUCH_ZOOM_TRUCK||(this._state&ss.TOUCH_DOLLY_OFFSET)===ss.TOUCH_DOLLY_OFFSET||(this._state&ss.TOUCH_ZOOM_OFFSET)===ss.TOUCH_ZOOM_OFFSET||(this._state&ss.TOUCH_DOLLY_ROTATE)===ss.TOUCH_DOLLY_ROTATE||(this._state&ss.TOUCH_ZOOM_ROTATE)===ss.TOUCH_ZOOM_ROTATE){const e=ws.x-this._activePointers[1].clientX,t=ws.y-this._activePointers[1].clientY,i=Math.sqrt(e*e+t*t),r=n.y-i;n.set(0,i);const o=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,a=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&ss.TOUCH_DOLLY)===ss.TOUCH_DOLLY||(this._state&ss.TOUCH_DOLLY_ROTATE)===ss.TOUCH_DOLLY_ROTATE||(this._state&ss.TOUCH_DOLLY_TRUCK)===ss.TOUCH_DOLLY_TRUCK||(this._state&ss.TOUCH_DOLLY_OFFSET)===ss.TOUCH_DOLLY_OFFSET?(this._dollyInternal(r*Fs,o,a),this._isUserControllingDolly=!0):(this._zoomInternal(r*Fs,o,a),this._isUserControllingZoom=!0)}(this._state&ss.TRUCK)!==ss.TRUCK&&(this._state&ss.TOUCH_TRUCK)!==ss.TOUCH_TRUCK&&(this._state&ss.TOUCH_DOLLY_TRUCK)!==ss.TOUCH_DOLLY_TRUCK&&(this._state&ss.TOUCH_ZOOM_TRUCK)!==ss.TOUCH_ZOOM_TRUCK||(this._truckInternal(t,r,!1),this._isUserControllingTruck=!0),(this._state&ss.OFFSET)!==ss.OFFSET&&(this._state&ss.TOUCH_OFFSET)!==ss.TOUCH_OFFSET&&(this._state&ss.TOUCH_DOLLY_OFFSET)!==ss.TOUCH_DOLLY_OFFSET&&(this._state&ss.TOUCH_ZOOM_OFFSET)!==ss.TOUCH_ZOOM_OFFSET||(this._truckInternal(t,r,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},p=()=>{Rs(this._activePointers,ws),s.copy(ws),this._dragNeedsUpdate=!1,(0===this._activePointers.length||1===this._activePointers.length&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),0===this._activePointers.length&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.removeEventListener("mouseup",h),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{this._enabled&&this._domElement&&(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",C),this._domElement.ownerDocument.addEventListener("pointerlockerror",T),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),E())},this.unlockPointer=()=>{null!==this._lockedPointer&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",C),this._domElement.ownerDocument.removeEventListener("pointerlockerror",T))};const C=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},T=()=>{this.unlockPointer()};this._addAllEventListeners=e=>{this._domElement=e,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",r),Ns&&this._domElement.addEventListener("mousedown",o),this._domElement.addEventListener("pointercancel",l),this._domElement.addEventListener("wheel",I,{passive:!1}),this._domElement.addEventListener("contextmenu",d)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",r),this._domElement.removeEventListener("mousedown",o),this._domElement.removeEventListener("pointercancel",l),this._domElement.removeEventListener("wheel",I,{passive:!1}),this._domElement.removeEventListener("contextmenu",d),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.removeEventListener("mouseup",h),this._domElement.ownerDocument.removeEventListener("pointerlockchange",C),this._domElement.ownerDocument.removeEventListener("pointerlockerror",T))},this.cancel=()=>{this._state!==ss.NONE&&(this._state=ss.NONE,this._activePointers.length=0,p())},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=Is(e.width,0,1),this._interactiveArea.height=Is(e.height,0,1),this._interactiveArea.x=Is(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=Is(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=Is(e,this.minAzimuthAngle,this.maxAzimuthAngle),n=Is(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 r=!i||Es(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Es(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(r)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=ns,this._changedDolly=0,this._dollyToNoClamp(Is(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const i=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const t=this._collisionTest(),s=Es(t,this._spherical.radius);if(!(i>e)&&s)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,t)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const s=!t||Es(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(s)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(xs).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const i=!t||Es(this._target.x,this._targetEnd.x,this.restThreshold)&&Es(this._target.y,this._targetEnd.y,this.restThreshold)&&Es(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=Is(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const i=!t||Es(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(),bs.setFromMatrixColumn(this._camera.matrix,0),Us.setFromMatrixColumn(this._camera.matrix,1),bs.multiplyScalar(e),Us.multiplyScalar(-t);const s=Ms.copy(bs).add(Us),n=vs.copy(this._targetEnd).add(s);return this.moveTo(n.x,n.y,n.z,i)}forward(e,t=!1){Ms.setFromMatrixColumn(this._camera.matrix,0),Ms.crossVectors(this._camera.up,Ms),Ms.multiplyScalar(e);const i=vs.copy(this._targetEnd).add(Ms);return this.moveTo(i.x,i.y,i.z,t)}elevate(e,t=!1){return Ms.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+Ms.x,this._targetEnd.y+Ms.y,this._targetEnd.z+Ms.z,t)}moveTo(e,t,i,s=!1){this._isUserControllingTruck=!1;const n=Ms.set(e,t,i).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,n,this.boundaryFriction),this._needsUpdate=!0,s||this._target.copy(this._targetEnd);const r=!s||Es(this._target.x,this._targetEnd.x,this.restThreshold)&&Es(this._target.y,this._targetEnd.y,this.restThreshold)&&Es(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}lookInDirectionOf(e,t,i,s=!1){const n=Ms.set(e,t,i).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(n.x,n.y,n.z,s)}fitToBox(e,t,{cover:i=!1,paddingLeft:s=0,paddingRight:n=0,paddingBottom:r=0,paddingTop:o=0}={}){const a=[],c=e.isBox3?ks.copy(e):ks.setFromObject(e);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const l=fs(this._sphericalEnd.theta,hs),h=fs(this._sphericalEnd.phi,hs);a.push(this.rotateTo(l,h,t));const u=Ms.setFromSpherical(this._sphericalEnd).normalize(),I=Xs.setFromUnitVectors(u,Ps),d=Es(Math.abs(u.y),1);d&&I.multiply(Zs.setFromAxisAngle(Ls,l)),I.multiply(this._yAxisUpSpaceInverse);const E=Hs.makeEmpty();vs.copy(c.min).applyQuaternion(I),E.expandByPoint(vs),vs.copy(c.min).setX(c.max.x).applyQuaternion(I),E.expandByPoint(vs),vs.copy(c.min).setY(c.max.y).applyQuaternion(I),E.expandByPoint(vs),vs.copy(c.max).setZ(c.min.z).applyQuaternion(I),E.expandByPoint(vs),vs.copy(c.min).setZ(c.max.z).applyQuaternion(I),E.expandByPoint(vs),vs.copy(c.max).setY(c.min.y).applyQuaternion(I),E.expandByPoint(vs),vs.copy(c.max).setX(c.min.x).applyQuaternion(I),E.expandByPoint(vs),vs.copy(c.max).applyQuaternion(I),E.expandByPoint(vs),E.min.x-=s,E.min.y-=r,E.max.x+=n,E.max.y+=o,I.setFromUnitVectors(Ps,u),d&&I.premultiply(Zs.invert()),I.premultiply(this._yAxisUpSpace);const f=E.getSize(Ms),p=E.getCenter(vs).applyQuaternion(I);if(as(this._camera)){const e=this.getDistanceToFitBox(f.x,f.y,f.z,i);a.push(this.moveTo(p.x,p.y,p.z,t)),a.push(this.dollyTo(e,t)),a.push(this.setFocalOffset(0,0,0,t))}else if(cs(this._camera)){const e=this._camera,s=e.right-e.left,n=e.top-e.bottom,r=i?Math.max(s/f.x,n/f.y):Math.min(s/f.x,n/f.y);a.push(this.moveTo(p.x,p.y,p.z,t)),a.push(this.zoomTo(r,t)),a.push(this.setFocalOffset(0,0,0,t))}return Promise.all(a)}fitToSphere(e,t){const i=[],s=e instanceof ys.Sphere?Ws.copy(e):Qs.createBoundingSphere(e,Ws);if(i.push(this.moveTo(s.center.x,s.center.y,s.center.z,t)),as(this._camera)){const e=this.getDistanceToFitSphere(s.radius);i.push(this.dollyTo(e,t))}else if(cs(this._camera)){const e=this._camera.right-this._camera.left,n=this._camera.top-this._camera.bottom,r=2*s.radius,o=Math.min(e/r,n/r);i.push(this.zoomTo(o,t))}return i.push(this.setFocalOffset(0,0,0,t)),Promise.all(i)}setLookAt(e,t,i,s,n,r,o=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=ns,this._changedDolly=0;const a=vs.set(s,n,r),c=Ms.set(e,t,i);this._targetEnd.copy(a),this._sphericalEnd.setFromVector3(c.sub(a).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,o||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const l=!o||Es(this._target.x,this._targetEnd.x,this.restThreshold)&&Es(this._target.y,this._targetEnd.y,this.restThreshold)&&Es(this._target.z,this._targetEnd.z,this.restThreshold)&&Es(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Es(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Es(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(l)}lerpLookAt(e,t,i,s,n,r,o,a,c,l,h,u,I,d=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=ns,this._changedDolly=0;const E=Ms.set(s,n,r),f=vs.set(e,t,i);Gs.setFromVector3(f.sub(E).applyQuaternion(this._yAxisUpSpace));const p=Ds.set(l,h,u),C=vs.set(o,a,c);zs.setFromVector3(C.sub(p).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(E.lerp(p,I));const T=zs.theta-Gs.theta,m=zs.phi-Gs.phi,R=zs.radius-Gs.radius;this._sphericalEnd.set(Gs.radius+R*I,Gs.phi+m*I,Gs.theta+T*I),this.normalizeRotations(),this._needsUpdate=!0,d||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const g=!d||Es(this._target.x,this._targetEnd.x,this.restThreshold)&&Es(this._target.y,this._targetEnd.y,this.restThreshold)&&Es(this._target.z,this._targetEnd.z,this.restThreshold)&&Es(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Es(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Es(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(g)}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(Ms),r=this.setLookAt(n.x,n.y,n.z,e,t,i,s);return this._sphericalEnd.phi=Is(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),r}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||Es(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&Es(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&Es(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}setOrbitPoint(e,t,i){this._camera.updateMatrixWorld(),bs.setFromMatrixColumn(this._camera.matrixWorldInverse,0),Us.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Bs.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const s=Ms.set(e,t,i),n=s.distanceTo(this._camera.position),r=s.sub(this._camera.position);bs.multiplyScalar(r.x),Us.multiplyScalar(r.y),Bs.multiplyScalar(r.z),Ms.copy(bs).add(Us).add(Bs),Ms.z=Ms.z+n,this.dollyTo(n,!1),this.setFocalOffset(-Ms.x,Ms.y,-Ms.z,!1),this.moveTo(e,t,i,!1)}setBoundary(e){if(!e)return this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),void(this._needsUpdate=!0);this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,i,s){null!==e?(this._viewport=this._viewport||new ys.Vector4,"number"==typeof e?this._viewport.set(e,t,i,s):this._viewport.copy(e)):this._viewport=null}getDistanceToFitBox(e,t,i,s=!1){if(gs(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const n=e/t,r=this._camera.getEffectiveFOV()*us,o=this._camera.aspect;return.5*((s?n>o:n<o)?t:e/o)/Math.tan(.5*r)+.5*i}getDistanceToFitSphere(e){if(gs(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*us,i=2*Math.atan(Math.tan(.5*t)*this._camera.aspect),s=1<this._camera.aspect?t:i;return e/Math.sin(.5*s)}getTarget(e,t=!0){return(e&&e.isVector3?e:new ys.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new ys.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e&&e instanceof ys.Spherical?e:new ys.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new ys.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%ls,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=ls),this._spherical.theta+=ls*Math.round((this._sphericalEnd.theta-this._spherical.theta)/ls)}reset(e=!1){if(!Es(this._camera.up.x,this._cameraUp0.x)||!Es(this._camera.up.y,this._cameraUp0.y)||!Es(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const e=this.getPosition(Ms);this.updateCameraUp(),this.setPosition(e.x,e.y,e.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,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,Ls),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=Ms.subVectors(this._target,this._camera.position).normalize(),t=vs.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const i=this.getPosition(Ms);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=Vs.subVectors(this._targetEnd,this._target),r=Ys.subVectors(this._focalOffsetEnd,this._focalOffset),o=this._zoomEnd-this._zoom;if(ds(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const t=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Ts(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,t,1/0,e),this._needsUpdate=!0}if(ds(i))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const t=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Ts(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,t,1/0,e),this._needsUpdate=!0}if(ds(s))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const t=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Ts(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,t,this.maxSpeed,e),this._needsUpdate=!0}if(ds(n.x)&&ds(n.y)&&ds(n.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const t=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;ms(this._target,this._targetEnd,this._targetVelocity,t,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(ds(r.x)&&ds(r.y)&&ds(r.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const t=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;ms(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,t,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(ds(o))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const t=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Ts(this._zoom,this._zoomEnd,this._zoomVelocity,t,1/0,e)}if(this.dollyToCursor)if(as(this._camera)&&0!==this._changedDolly){const e=this._spherical.radius-this._lastDistance,t=this._camera,i=this._getCameraDirection(xs),s=Ms.copy(i).cross(t.up).normalize();0===s.lengthSq()&&(s.x=1);const n=vs.crossVectors(s,i),r=this._sphericalEnd.radius*Math.tan(t.getEffectiveFOV()*us*.5),o=(this._sphericalEnd.radius-e-this._sphericalEnd.radius)/this._sphericalEnd.radius,a=Ds.copy(this._targetEnd).add(s.multiplyScalar(this._dollyControlCoord.x*r*t.aspect)).add(n.multiplyScalar(this._dollyControlCoord.y*r)),c=Ms.copy(this._targetEnd).lerp(a,o),l=this._lastDollyDirection===rs&&this._spherical.radius<=this.minDistance,h=this._lastDollyDirection===os&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(l||h)){this._sphericalEnd.radius-=e,this._spherical.radius-=e;const t=vs.copy(i).multiplyScalar(-e);c.add(t)}this._boundary.clampPoint(c,c);const u=vs.subVectors(c,this._targetEnd);this._targetEnd.copy(c),this._target.add(u),this._changedDolly-=e,ds(this._changedDolly)&&(this._changedDolly=0)}else if(cs(this._camera)&&0!==this._changedZoom){const e=this._zoom-this._lastZoom,t=this._camera,i=Ms.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(t.near+t.far)/(t.near-t.far)).unproject(t),s=vs.set(0,0,-1).applyQuaternion(t.quaternion),n=Ds.copy(i).add(s.multiplyScalar(-i.dot(t.up))),r=-(this._zoom-e-this._zoom)/this._zoom,o=this._getCameraDirection(xs),a=this._targetEnd.dot(o),c=Ms.copy(this._targetEnd).lerp(n,r),l=c.dot(o),h=o.multiplyScalar(l-a);c.sub(h),this._boundary.clampPoint(c,c);const u=vs.subVectors(c,this._targetEnd);this._targetEnd.copy(c),this._target.add(u),this._changedZoom-=e,ds(this._changedZoom)&&(this._changedZoom=0)}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const a=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,a),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target);(!ds(this._focalOffset.x)||!ds(this._focalOffset.y)||!ds(this._focalOffset.z))&&(this._camera.updateMatrixWorld(),bs.setFromMatrixColumn(this._camera.matrix,0),Us.setFromMatrixColumn(this._camera.matrix,1),Bs.setFromMatrixColumn(this._camera.matrix,2),bs.multiplyScalar(this._focalOffset.x),Us.multiplyScalar(-this._focalOffset.y),Bs.multiplyScalar(this._focalOffset.z),Ms.copy(bs).add(Us).add(Bs),this._camera.position.add(Ms)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),Ms.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const c=this._needsUpdate;return c&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):c?(this.dispatchEvent({type:"update"}),ds(t,this.restThreshold)&&ds(i,this.restThreshold)&&ds(s,this.restThreshold)&&ds(n.x,this.restThreshold)&&ds(n.y,this.restThreshold)&&ds(n.z,this.restThreshold)&&ds(r.x,this.restThreshold)&&ds(r.y,this.restThreshold)&&ds(r.z,this.restThreshold)&&ds(o,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!c&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=c,this._needsUpdate=!1,c}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:ps(this.maxDistance),minZoom:this.minZoom,maxZoom:ps(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:ps(this.maxPolarAngle),minAzimuthAngle:ps(this.minAzimuthAngle),maxAzimuthAngle:ps(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:Ms.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),Gs.setFromVector3(Ms.fromArray(i.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(Gs.theta,Gs.phi,t),this.dollyTo(Gs.radius,t),this.zoomTo(i.zoom,t),this.setFocalOffset(i.focalOffset[0],i.focalOffset[1],i.focalOffset[2],t),this._needsUpdate=!0}connect(e){this._domElement?console.warn("camera-controls is already connected."):(e.setAttribute("data-camera-controls-version","2.7.3"),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(0===s)return e;const n=vs.copy(t).add(e),r=this._boundary.clampPoint(n,Ds).sub(n),o=r.lengthSq();if(0===o)return e.add(t);if(o===s)return e;if(0===i)return e.add(t).add(r);{const s=1+i*o/t.dot(r);return e.add(vs.copy(t).multiplyScalar(s)).add(r.multiplyScalar(1-i))}}_updateNearPlaneCorners(){if(as(this._camera)){const e=this._camera,t=e.near,i=e.getEffectiveFOV()*us,s=Math.tan(.5*i)*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(cs(this._camera)){const e=this._camera,t=1/e.zoom,i=e.left*t,s=e.right*t,n=e.top*t,r=e.bottom*t;this._nearPlaneCorners[0].set(i,n,0),this._nearPlaneCorners[1].set(s,n,0),this._nearPlaneCorners[2].set(s,r,0),this._nearPlaneCorners[3].set(i,r,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1))return e;if(gs(this._camera,"_collisionTest"))return e;const t=this._getTargetDirection(xs);js.lookAt(_s,t,this._camera.up);for(let i=0;i<4;i++){const s=vs.copy(this._nearPlaneCorners[i]);s.applyMatrix4(js);const n=Ds.addVectors(this._target,s);$s.set(n,t),$s.far=this._spherical.radius+1;const r=$s.intersectObjects(this.colliderMeshes);0!==r.length&&r[0].distance<e&&(e=r[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((e=>{const t=()=>{this.removeEventListener("rest",t),e()};this.addEventListener("rest",t)})))}_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 ys.Sphere){const i=t,s=i.center;ks.makeEmpty(),e.traverseVisible((e=>{e.isMesh&&ks.expandByObject(e)})),ks.getCenter(s);let n=0;return e.traverseVisible((e=>{if(!e.isMesh)return;const t=e,i=t.geometry.clone();i.applyMatrix4(t.matrixWorld);const r=i.attributes.position;for(let e=0,t=r.count;e<t;e++)Ms.fromBufferAttribute(r,e),n=Math.max(n,s.distanceToSquared(Ms))})),i.radius=Math.sqrt(n),i}}class qs extends Vt{constructor(e){super(e),t(this,"onBeforeUpdate",new Dt),t(this,"onAfterUpdate",new Dt),t(this,"onAspectUpdated",new Dt),t(this,"onDisposed",new Dt),t(this,"three"),t(this,"_allControls",new Map),t(this,"updateAspect",(()=>{var e;if(this.currentWorld&&this.currentWorld.renderer)if(this.three instanceof o.OrthographicCamera)this.onAspectUpdated.trigger();else if(null==(e=this.currentWorld.renderer)?void 0:e.isResizeable()){const e=this.currentWorld.renderer.getSize();this.three.aspect=e.width/e.height,this.three.updateProjectionMatrix(),this.onAspectUpdated.trigger()}})),this.three=this.setupCamera(),this.setupEvents(!0),this.onWorldChanged.add((({action:e,world:t})=>{if("added"===e){const e=this.newCameraControls();this._allControls.set(t.uuid,e)}if("removed"===e){const e=this._allControls.get(t.uuid);e&&(e.dispose(),this._allControls.delete(t.uuid))}}))}get controls(){if(!this.currentWorld)throw new Error("This camera needs a world to work!");const e=this._allControls.get(this.currentWorld.uuid);if(!e)throw new Error("Controls not found!");return e}get enabled(){return null!==this.currentWorld&&this.controls.enabled}set enabled(e){null!==this.currentWorld&&(this.controls.enabled=e)}dispose(){this.setupEvents(!1),this.onAspectUpdated.reset(),this.onBeforeUpdate.reset(),this.onAfterUpdate.reset(),this.three.removeFromParent(),this.onDisposed.trigger(),this.onDisposed.reset();for(const[e,t]of this._allControls)t.dispose()}update(e){this.enabled&&(this.onBeforeUpdate.trigger(this),this.controls.update(e),this.onAfterUpdate.trigger(this))}setupCamera(){const e=window.innerWidth/window.innerHeight,t=new o.PerspectiveCamera(60,e,1,1e3);return t.position.set(50,50,50),t.lookAt(new o.Vector3(0,0,0)),t}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!");Qs.install({THREE:qs.getSubsetOfThree()});const{domElement:e}=this.currentWorld.renderer.three,t=new Qs(this.three,e);return t.smoothTime=.2,t.dollyToCursor=!0,t.infinityDolly=!0,t.minDistance=6,t}setupEvents(e){e?window.addEventListener("resize",this.updateAspect):window.removeEventListener("resize",this.updateAspect)}static getSubsetOfThree(){return{MOUSE:o.MOUSE,Vector2:o.Vector2,Vector3:o.Vector3,Vector4:o.Vector4,Quaternion:o.Quaternion,Matrix4:o.Matrix4,Spherical:o.Spherical,Box3:o.Box3,Sphere:o.Sphere,Raycaster:o.Raycaster,MathUtils:o.MathUtils}}}const Ks=class e extends Ut{constructor(i){super(i),t(this,"onAfterUpdate",new Dt),t(this,"onBeforeUpdate",new Dt),t(this,"onDisposed",new Dt),t(this,"list",new Wt),t(this,"enabled",!0),i.add(e.uuid,this)}create(){const e=new Xi(this.components),t=e.uuid;if(this.list.has(t))throw new Error("There is already a world with this name!");return this.list.set(t,e),e}delete(e){if(!this.list.has(e.uuid))throw new Error("The provided world is not found in the list!");this.list.delete(e.uuid),e.dispose()}dispose(){this.enabled=!1;for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}update(e){if(this.enabled)for(const[t,i]of this.list)i.update(e)}};t(Ks,"uuid","fdb61dc4-2ec1-4966-b83d-54ea795fad4a");let Js=Ks;async function en(e,t,i,s,n,r,o){const a=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);e.flush(),await function(e,t,i,s){return new Promise(((n,r)=>{!function o(){const a=e.clientWaitSync(t,i,0);a!==e.WAIT_FAILED?a!==e.TIMEOUT_EXPIRED?n():setTimeout(o,s):r()}()}))}(e,a,0,10),e.deleteSync(a),e.bindBuffer(t,i),e.getBufferSubData(t,s,n,r,o),e.bindBuffer(t,null)}async function tn(e,t,i,s,n,r,o,a){const c=e.createBuffer();return e.bindBuffer(e.PIXEL_PACK_BUFFER,c),e.bufferData(e.PIXEL_PACK_BUFFER,a.byteLength,e.STREAM_READ),e.readPixels(t,i,s,n,r,o,0),e.bindBuffer(e.PIXEL_PACK_BUFFER,null),await en(e,e.PIXEL_PACK_BUFFER,c,0,a),e.deleteBuffer(c),a}class sn extends Zi{constructor(){super(...arguments),t(this,"_config",{enabled:{value:!0,type:"Boolean"},width:{type:"Number",interpolable:!0,value:512,min:32,max:1024},height:{type:"Number",interpolable:!0,value:512,min:32,max:1024},autoUpdate:{value:!0,type:"Boolean"},renderDebugFrame:{value:!1,type:"Boolean"},updateInterval:{type:"Number",interpolable:!0,value:1,min:0,max:1},threshold:{type:"Number",interpolable:!0,value:100,min:1,max:512}}),t(this,"_interval",null)}get enabled(){return this._config.enabled.value}set enabled(e){this._config.enabled.value=e,this._component.enabled=e}get width(){return this._config.width.value}set width(e){this.setWidthHeight(e,this.height)}get height(){return this._config.height.value}set height(e){this.setWidthHeight(this.width,e)}get autoUpdate(){return this._config.autoUpdate.value}set autoUpdate(e){this.setAutoAndInterval(e,this.updateInterval)}get updateInterval(){return this._config.updateInterval.value}set updateInterval(e){this.setAutoAndInterval(this.autoUpdate,e)}get renderDebugFrame(){return this._config.renderDebugFrame.value}set renderDebugFrame(e){this._config.renderDebugFrame.value=e}get threshold(){return this._config.threshold.value}set threshold(e){this._config.threshold.value=e}setWidthHeight(e,t){if(e<=0||t<=0)throw new Error("The width and height of the culler renderer must be more than 0!");this._config.width.value=e,this._config.height.value=t,this.resetRenderTarget()}setAutoAndInterval(e,t){if(t<=0)throw new Error("The updateInterval of the culler renderer must be more than 0!");this._config.autoUpdate.value=e,this._config.updateInterval.value=t,this.resetInterval(e)}resetRenderTarget(){this._component.renderTarget.dispose(),this._component.renderTarget=new o.WebGLRenderTarget(this.width,this.height),this._component.bufferSize=this.width*this.height*4,this._component.buffer=new Uint8Array(this._component.bufferSize)}resetInterval(e){null!==this._interval&&window.clearInterval(this._interval),e&&(this._interval=window.setInterval((async()=>{this._component.preventUpdate||await this._component.updateVisibility()}),this.updateInterval))}}class nn{constructor(e,i){if(t(this,"onSetup",new Dt),t(this,"onDisposed",new Dt),t(this,"onViewUpdated",new xt),t(this,"enabled",!0),t(this,"needsUpdate",!1),t(this,"components"),t(this,"renderTarget",new o.WebGLRenderTarget),t(this,"bufferSize",1),t(this,"buffer",new Uint8Array),t(this,"preventUpdate",!1),t(this,"config"),t(this,"isSetup",!1),t(this,"world"),t(this,"renderer"),t(this,"_defaultConfig",{enabled:!0,height:512,width:512,updateInterval:1e3,autoUpdate:!0,renderDebugFrame:!1,threshold:100}),t(this,"worker"),t(this,"scene",new o.Scene),t(this,"_availableColor",1),t(this,"_isWorkerBusy",!1),t(this,"updateVisibility",(async e=>{if(!this.enabled)return;if(!this.needsUpdate&&!e)return;if(this._isWorkerBusy)return;this._isWorkerBusy=!0;const t=this.world.camera.three;t.updateMatrix();const{width:i,height:s}=this.config;this.renderer.setSize(i,s),this.renderer.setRenderTarget(this.renderTarget),this.renderer.render(this.scene,t);const n=this.renderer.getContext();await tn(n,0,0,i,s,n.RGBA,n.UNSIGNED_BYTE,this.buffer),this.renderer.setRenderTarget(null),this.config.renderDebugFrame&&this.renderer.render(this.scene,t),this.worker.postMessage({buffer:this.buffer}),this.needsUpdate=!1})),!i.renderer)throw new Error("The given world must have a renderer!");this.components=e,this.config=new sn(this,this.components,"Culler renderer"),this.world=i,this.renderer=new o.WebGLRenderer,this.renderer.clippingPlanes=i.renderer.clippingPlanes;const s=new Blob(['\n addEventListener("message", (event) => {\n const { buffer } = event.data;\n const colors = new Map();\n for (let i = 0; i < buffer.length; i += 4) {\n const r = buffer[i];\n const g = buffer[i + 1];\n const b = buffer[i + 2];\n const code = "" + r + "-" + g + "-" + b;\n if(colors.has(code)) {\n colors.set(code, colors.get(code) + 1);\n } else {\n colors.set(code, 1);\n }\n }\n postMessage({ colors });\n });\n '],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(s)),this.setup()}dispose(){this.enabled=!1,this.config.autoUpdate=!1;this.components.get($i).list.delete(this.config.uuid);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()}setup(e){const t={...this._defaultConfig,...e},{width:i,height:s}=t;this.config.setWidthHeight(i,s);const{updateInterval:n,autoUpdate:r}=t;this.config.setAutoAndInterval(r,n),this.config.threshold=t.threshold,this.isSetup=!0,this.onSetup.trigger()}getAvailableColor(){let e=BigInt(this._availableColor.toString());const t=[];do{t.unshift(Number(e%256n)),e/=256n}while(e);for(;3!==t.length;)t.unshift(0);const[i,s,n]=t;return{r:i,g:s,b:n,code:`${i}-${s}-${n}`}}increaseColor(){16777216!==this._availableColor?this._availableColor++:console.warn("Color can't be increased over 256 x 256 x 256!")}decreaseColor(){1!==this._availableColor?this._availableColor--:console.warn("Color can't be decreased under 0!")}}class rn extends nn{constructor(e,i){super(e,i),t(this,"onViewUpdated",new Dt),t(this,"colorMeshes",new Map),t(this,"_colorCodeMeshMap",new Map),t(this,"_meshIDColorCodeMap",new Map),t(this,"_currentVisibleMeshes",new Set),t(this,"_recentlyHiddenMeshes",new Set),t(this,"_transparentMat",new o.MeshBasicMaterial({transparent:!0,opacity:0})),t(this,"handleWorkerMessage",(async e=>{if(this.preventUpdate)return;const t=e.data.colors;this._recentlyHiddenMeshes=new Set(this._currentVisibleMeshes),this._currentVisibleMeshes.clear();for(const[e,i]of t){if(i<this.config.threshold)continue;const t=this._colorCodeMeshMap.get(e);t&&(this._currentVisibleMeshes.add(t),this._recentlyHiddenMeshes.delete(t))}this.onViewUpdated.trigger({seen:this._currentVisibleMeshes,unseen:this._recentlyHiddenMeshes}),this._isWorkerBusy=!1})),this.worker.addEventListener("message",this.handleWorkerMessage),this.onViewUpdated.add((({seen:e,unseen:t})=>{for(const t of e)t.visible=!0;for(const e of t)e.visible=!1}))}get threshold(){return this.config.threshold}set threshold(e){this.config.threshold=e}dispose(){super.dispose(),this._currentVisibleMeshes.clear(),this._recentlyHiddenMeshes.clear(),this._meshIDColorCodeMap.clear(),this._transparentMat.dispose(),this._colorCodeMeshMap.clear();const e=this.components.get(zt);for(const t in this.colorMeshes){const i=this.colorMeshes.get(t);i&&e.destroy(i,!0)}this.colorMeshes.clear()}add(e){if(!this.enabled)return;if(this.preventUpdate)return void console.log("Culler processing not finished yet.");this.preventUpdate=!0;const t=e instanceof o.InstancedMesh,{geometry:i,material:s}=e,{colorMaterial:n,code:r}=this.getAvailableMaterial();let a;if(Array.isArray(s)){let e=!0;const t=[];for(const i of s)hi.isTransparent(i)?t.push(this._transparentMat):(e=!1,t.push(n));if(e)return n.dispose(),void(this.preventUpdate=!1);a=t}else{if(hi.isTransparent(s))return n.dispose(),void(this.preventUpdate=!1);a=n}this._colorCodeMeshMap.set(r,e),this._meshIDColorCodeMap.set(e.uuid,r);const c=t?e.count:1,l=new o.InstancedMesh(i,a,c);t?l.instanceMatrix=e.instanceMatrix:l.setMatrixAt(0,new o.Matrix4),e.visible=!1,e.updateWorldMatrix(!0,!1),l.applyMatrix4(e.matrixWorld),l.updateMatrix(),this.scene.add(l),this.colorMeshes.set(e.uuid,l),this.increaseColor(),this.preventUpdate=!1}remove(e){if(this.preventUpdate)return void console.log("Culler processing not finished yet.");this.preventUpdate=!0;const t=this.components.get(zt);this._currentVisibleMeshes.delete(e),this._recentlyHiddenMeshes.delete(e);const i=this.colorMeshes.get(e.uuid),s=this._meshIDColorCodeMap.get(e.uuid);i&&s?(this._colorCodeMeshMap.delete(s),this._meshIDColorCodeMap.delete(e.uuid),this.colorMeshes.delete(e.uuid),i.geometry=void 0,i.material=[],t.destroy(i,!0),this._recentlyHiddenMeshes.delete(e),this._currentVisibleMeshes.delete(e),this.preventUpdate=!1):this.preventUpdate=!1}updateInstanced(e){for(const t of e){const e=this.colorMeshes.get(t.uuid);e&&(e.count=t.count)}}getAvailableMaterial(){const{r:e,g:t,b:i,code:s}=this.getAvailableColor(),n=o.ColorManagement.enabled;o.ColorManagement.enabled=!1;const r=new o.Color(`rgb(${e}, ${t}, ${i})`);if(!this.world.renderer)throw new Error("Renderer not found in the world!");const a=this.world.renderer.clippingPlanes,c=new o.MeshBasicMaterial({color:r,clippingPlanes:a,side:o.DoubleSide});return o.ColorManagement.enabled=n,{colorMaterial:c,code:s}}}const on=class e extends Ut{constructor(i){super(i),t(this,"onDisposed",new Dt),t(this,"_enabled",!0),t(this,"list",new Map),i.add(e.uuid,this)}get enabled(){return this._enabled}set enabled(e){this._enabled=e;for(const[t,i]of this.list)i.enabled=e}create(e){if(this.list.has(e.uuid))return this.list.get(e.uuid);const t=new rn(this.components,e);return this.list.set(e.uuid,t),t}delete(e){const t=this.list.get(e.uuid);t&&t.dispose(),this.list.delete(e.uuid)}dispose(){this.enabled=!1,this.onDisposed.trigger(e.uuid),this.onDisposed.reset();for(const[e,t]of this.list)t.dispose();this.list.clear()}updateInstanced(e){for(const[,t]of this.list)t.updateInstanced(e)}};t(on,"uuid","69f2a50d-c266-44fc-b1bd-fa4d34be89e6");let an=on;class cn{constructor(e,i){if(t(this,"onDisposed",new Dt),t(this,"onDistanceComputed",new Dt),t(this,"excludedObjects",new Set),t(this,"enabled",!0),t(this,"renderDebugFrame",!1),t(this,"components"),t(this,"scene",new o.Scene),t(this,"camera",new o.OrthographicCamera(-1,1,1,-1,0,1)),t(this,"depthMaterial"),t(this,"world"),t(this,"renderer"),t(this,"worker"),t(this,"_width",512),t(this,"_height",512),t(this,"_postQuad"),t(this,"tempRT"),t(this,"resultRT"),t(this,"bufferSize"),t(this,"_buffer"),t(this,"_isWorkerBusy",!1),t(this,"compute",(async()=>{if(!this.enabled||this.world.isDisposing)return;if(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 t of this.excludedObjects)t.userData[e]=t.visible,t.visible=!1;this.renderer.render(this.world.scene.three,this.world.camera.three);for(const t of this.excludedObjects)void 0!==t.userData[e]&&(t.visible=t.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();try{await tn(t,0,0,this._width,this._height,t.RGBA,t.UNSIGNED_BYTE,this._buffer)}catch(e){return this.renderer.setRenderTarget(null),void(this._isWorkerBusy=!1)}this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,this.camera),this.worker.postMessage({buffer:this._buffer})})),t(this,"handleWorkerMessage",(e=>{if(!this.enabled||this.world.isDisposing)return;const t=e.data.colors;let i=Number.MAX_VALUE;for(const e of t)0!==e&&e<i&&(i=e);const s=this.world.camera.three||o.OrthographicCamera,n=-1*(i/255-1)*(s.far-s.near),r=Math.min(n,s.far);this.onDistanceComputed.trigger(r),this._isWorkerBusy=!1})),!i.renderer)throw new Error("The given world must have a renderer!");this.components=e,this.world=i;const s=i.camera.three;this.renderer=new o.WebGLRenderer,this.tempRT=new o.WebGLRenderTarget(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.tempRT.texture.minFilter=o.NearestFilter,this.tempRT.texture.magFilter=o.NearestFilter,this.tempRT.stencilBuffer=!1,this.tempRT.samples=0,this.tempRT.depthTexture=new o.DepthTexture(this._width,this._height),this.tempRT.depthTexture.format=o.DepthFormat,this.tempRT.depthTexture.type=o.UnsignedShortType,this.resultRT=new o.WebGLRenderTarget(this._width,this._height),this.depthMaterial=new o.ShaderMaterial({vertexShader:"\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n ",fragmentShader:"\n#include <packing>\n\nvarying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform sampler2D tDepth;\nuniform float cameraNear;\nuniform float cameraFar;\n\n\nfloat readDepth( sampler2D depthSampler, vec2 coord ) {\n float fragCoordZ = texture2D( depthSampler, coord ).x;\n float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );\n return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );\n}\n\nvoid main() {\n //vec3 diffuse = texture2D( tDiffuse, vUv ).rgb;\n float depth = readDepth( tDepth, vUv );\n\n gl_FragColor.rgb = 1.0 - vec3( depth );\n gl_FragColor.a = 1.0;\n}\n ",uniforms:{cameraNear:{value:s.near},cameraFar:{value:s.far},tDiffuse:{value:null},tDepth:{value:null}}});const n=new o.PlaneGeometry(2,2);this._postQuad=new o.Mesh(n,this.depthMaterial),this.scene.add(this._postQuad),this.renderer.clippingPlanes=i.renderer.clippingPlanes;const r=new Blob(['\n addEventListener("message", (event) => {\n const { buffer } = event.data;\n const colors = new Set();\n for (let i = 0; i < buffer.length; i += 4) {\n const r = buffer[i];\n colors.add(r);\n }\n postMessage({ colors });\n });\n '],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(r)),this.worker.addEventListener("message",this.handleWorkerMessage)}dispose(){this.enabled=!1,this.onDistanceComputed.reset(),this.worker.terminate(),this.renderer.forceContextLoss(),this.renderer.dispose(),this.tempRT.dispose(),this.resultRT.dispose();const 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 ln{constructor(e){t(this,"_event"),t(this,"_position",new o.Vector2),t(this,"onDisposed",new Dt),t(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-(this.getDataObject(t).clientY-e.top)/(e.bottom-e.top)*2+1}getPositionX(e,t){return(this.getDataObject(t).clientX-e.left)/(e.right-e.left)*2-1}getDataObject(e){return e instanceof MouseEvent?e:e.touches[0]}setupEvents(e){e?(this.dom.addEventListener("pointermove",this.updateMouseInfo),this.dom.addEventListener("touchstart",this.updateMouseInfo)):(this.dom.removeEventListener("pointermove",this.updateMouseInfo),this.dom.removeEventListener("touchstart",this.updateMouseInfo))}}class hn{constructor(e,i){t(this,"enabled",!0),t(this,"components"),t(this,"onDisposed",new Dt),t(this,"mouse"),t(this,"three",new o.Raycaster),t(this,"world");const s=i.renderer;if(!s)throw new Error("A renderer is needed for the raycaster to work!");this.world=i,this.mouse=new ln(s.three.domElement),this.components=e}dispose(){this.mouse.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}castRay(e=Array.from(this.world.meshes),t=this.mouse.position){if(!this.world)throw new Error("A world is needed to cast rays!");const i=this.world.camera.three;return this.three.setFromCamera(t,i),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||(null==i?void 0:i.length)<=0?e:e.filter((e=>i.every((t=>t.distanceToPoint(e.point)>0))))}}const un=class e extends Ut{constructor(i){super(i),t(this,"enabled",!0),t(this,"list",new Map),t(this,"onDisposed",new Dt),i.add(e.uuid,this)}get(e){if(this.list.has(e.uuid))return this.list.get(e.uuid);const t=new hn(this.components,e);return this.list.set(e.uuid,t),e.onDisposed.add((()=>{this.delete(e)})),t}delete(e){const t=this.list.get(e.uuid);t&&t.dispose(),this.list.delete(e.uuid)}dispose(){for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}};t(un,"uuid","d5d8bdf0-db25-4952-b951-b643af207ace");let In=un;class dn extends Zi{constructor(){super(...arguments),t(this,"_config",{visible:{value:!0,type:"Boolean"},color:{value:new o.Color,type:"Color"},primarySize:{type:"Number",interpolable:!0,value:1,min:0,max:1e3},secondarySize:{type:"Number",interpolable:!0,value:10,min:0,max:1e3},distance:{type:"Number",interpolable:!0,value:500,min:0,max:500}})}get visible(){return this._config.visible.value}set visible(e){this._config.visible.value=e,this._component.visible=e}get color(){return this._config.color.value}set color(e){this._config.color.value=e,this._component.material.uniforms.uColor.value=e,this._component.material.uniformsNeedUpdate=!0}get primarySize(){return this._config.primarySize.value}set primarySize(e){this._config.primarySize.value=e,this._component.material.uniforms.uSize1.value=e,this._component.material.uniformsNeedUpdate=!0}get secondarySize(){return this._config.secondarySize.value}set secondarySize(e){this._config.secondarySize.value=e,this._component.material.uniforms.uSize2.value=e,this._component.material.uniformsNeedUpdate=!0}get distance(){return this._config.distance.value}set distance(e){this._config.distance.value=e,this._component.material.uniforms.uDistance.value=e,this._component.material.uniformsNeedUpdate=!0}}class En{constructor(e,i){t(this,"onDisposed",new Dt),t(this,"onSetup",new Dt),t(this,"isSetup",!1),t(this,"world"),t(this,"components"),t(this,"config"),t(this,"_defaultConfig",{visible:!0,color:new o.Color(12303291),primarySize:1,secondarySize:10,distance:500}),t(this,"three"),t(this,"_fade",3),t(this,"updateZoom",(()=>{this.world.camera instanceof qs&&(this.material.uniforms.uZoom.value=this.world.camera.three.zoom)})),this.world=i;const{color:s,primarySize:n,secondarySize:r,distance:a}=this._defaultConfig;this.components=e,this.config=new dn(this,this.components,"Grid");const c=new o.PlaneGeometry(2,2,1,1),l=new o.ShaderMaterial({side:o.DoubleSide,uniforms:{uSize1:{value:n},uSize2:{value:r},uColor:{value:s},uDistance:{value:a},uFade:{value:this._fade},uZoom:{value:1}},transparent:!0,vertexShader:"\n \n varying vec3 worldPosition;\n \n uniform float uDistance;\n \n void main() {\n \n vec3 pos = position.xzy * uDistance;\n pos.xz += cameraPosition.xz;\n \n worldPosition = pos;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\n \n }\n ",fragmentShader:"\n \n varying vec3 worldPosition;\n \n uniform float uZoom;\n uniform float uFade;\n uniform float uSize1;\n uniform float uSize2;\n uniform vec3 uColor;\n uniform float uDistance;\n \n \n \n float getGrid(float size) {\n \n vec2 r = worldPosition.xz / size;\n \n \n vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r);\n float line = min(grid.x, grid.y);\n \n \n return 1.0 - min(line, 1.0);\n }\n \n void main() {\n \n \n float d = 1.0 - min(distance(cameraPosition.xz, worldPosition.xz) / uDistance, 1.0);\n \n float g1 = getGrid(uSize1);\n float g2 = getGrid(uSize2);\n \n // Ortho camera fades the grid away when zooming out\n float minZoom = step(0.2, uZoom);\n float zoomFactor = pow(min(uZoom, 1.), 2.) * minZoom;\n \n gl_FragColor = vec4(uColor.rgb, mix(g2, g1, g1) * pow(d, uFade));\n gl_FragColor.a = mix(0.5 * gl_FragColor.a, gl_FragColor.a, g2) * zoomFactor;\n \n if ( gl_FragColor.a <= 0.0 ) discard;\n \n \n }\n \n ",extensions:{derivatives:!0}});this.three=new o.Mesh(c,l),this.three.frustumCulled=!1,i.scene.three.add(this.three),this.setupEvents(!0)}get visible(){return this.three.visible}set visible(e){if(e){this.world.scene.three.add(this.three)}else this.three.removeFromParent()}get material(){return this.three.material}get fade(){return 3===this._fade}set fade(e){this._fade=e?3:0,this.material.uniforms.uFade.value=this._fade}setup(e){const t={...this._defaultConfig,...e};this.config.visible=!0,this.config.color=t.color,this.config.primarySize=t.primarySize,this.config.secondarySize=t.secondarySize,this.config.distance=t.distance,this.isSetup=!0,this.onSetup.trigger()}dispose(){this.setupEvents(!1);this.components.get($i).list.delete(this.config.uuid);this.components.get(zt).destroy(this.three),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(e){if(this.world.isDisposing)return;if(!(this.world.camera instanceof qs))return;const t=this.world.camera.controls;e?t.addEventListener("update",this.updateZoom):t.removeEventListener("update",this.updateZoom)}}const fn=class e extends Ut{constructor(i){super(i),t(this,"list",new Map),t(this,"onDisposed",new Dt),t(this,"enabled",!0),i.add(e.uuid,this)}create(e){if(this.list.has(e.uuid))throw new Error("This world already has a grid!");const t=new En(this.components,e);return this.list.set(e.uuid,t),e.onDisposed.add((()=>{this.delete(e)})),t}delete(e){const t=this.list.get(e.uuid);t&&t.dispose(),this.list.delete(e.uuid)}dispose(){for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}};t(fn,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");let pn=fn;const Cn=new i.Raycaster,Tn=new i.Vector3,mn=new i.Vector3,Rn=new i.Quaternion,gn={X:new i.Vector3(1,0,0),Y:new i.Vector3(0,1,0),Z:new i.Vector3(0,0,1)},An={type:"change"},Fn={type:"mouseDown"},Sn={type:"mouseUp",mode:null},On={type:"objectChange"};class Nn extends i.Object3D{constructor(e,t){super(),void 0===t&&(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 s=new Zn;this._gizmo=s,this.add(s);const n=new jn;this._plane=n,this.add(n);const r=this;function o(e,t){let i=t;Object.defineProperty(r,e,{get:function(){return void 0!==i?i:t},set:function(t){i!==t&&(i=t,n[e]=t,s[e]=t,r.dispatchEvent({type:e+"-changed",value:t}),r.dispatchEvent(An))}}),r[e]=t,n[e]=t,s[e]=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 i.Vector3,c=new i.Vector3,l=new i.Quaternion,h=new i.Quaternion,u=new i.Vector3,I=new i.Quaternion,d=new i.Vector3,E=new i.Vector3,f=new i.Vector3,p=new i.Vector3;o("worldPosition",a),o("worldPositionStart",c),o("worldQuaternion",l),o("worldQuaternionStart",h),o("cameraPosition",u),o("cameraQuaternion",I),o("pointStart",d),o("pointEnd",E),o("rotationAxis",f),o("rotationAngle",0),o("eye",p),this._offset=new i.Vector3,this._startNorm=new i.Vector3,this._endNorm=new i.Vector3,this._cameraScale=new i.Vector3,this._parentPosition=new i.Vector3,this._parentQuaternion=new i.Quaternion,this._parentQuaternionInv=new i.Quaternion,this._parentScale=new i.Vector3,this._worldScaleStart=new i.Vector3,this._worldQuaternionInv=new i.Quaternion,this._worldScale=new i.Vector3,this._positionStart=new i.Vector3,this._quaternionStart=new i.Quaternion,this._scaleStart=new i.Vector3,this._getPointer=yn.bind(this),this._onPointerDown=Ln.bind(this),this._onPointerHover=_n.bind(this),this._onPointerMove=Pn.bind(this),this._onPointerUp=wn.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?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(void 0===this.object||!0===this.dragging)return;Cn.setFromCamera(e,this.camera);const t=Mn(this._gizmo.picker[this.mode],Cn);this.axis=t?t.object.name:null}pointerDown(e){if(void 0!==this.object&&!0!==this.dragging&&0===e.button&&null!==this.axis){Cn.setFromCamera(e,this.camera);const t=Mn(this._plane,Cn,!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,Fn.mode=this.mode,this.dispatchEvent(Fn)}}pointerMove(e){const t=this.axis,i=this.mode,s=this.object;let n=this.space;if("scale"===i?n="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(n="world"),void 0===s||null===t||!1===this.dragging||-1!==e.button)return;Cn.setFromCamera(e,this.camera);const r=Mn(this._plane,Cn,!0);if(r){if(this.pointEnd.copy(r.point).sub(this.worldPositionStart),"translate"===i)this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===n&&"XYZ"!==t&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===t.indexOf("X")&&(this._offset.x=0),-1===t.indexOf("Y")&&(this._offset.y=0),-1===t.indexOf("Z")&&(this._offset.z=0),"local"===n&&"XYZ"!==t?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&&("local"===n&&(s.position.applyQuaternion(Rn.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.position.applyQuaternion(this._quaternionStart)),"world"===n&&(s.parent&&s.position.add(Tn.setFromMatrixPosition(s.parent.matrixWorld)),-1!==t.search("X")&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.parent&&s.position.sub(Tn.setFromMatrixPosition(s.parent.matrixWorld))));else if("scale"===i){if(-1!==t.search("XYZ")){let e=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(e*=-1),mn.set(e,e,e)}else Tn.copy(this.pointStart),mn.copy(this.pointEnd),Tn.applyQuaternion(this._worldQuaternionInv),mn.applyQuaternion(this._worldQuaternionInv),mn.divide(Tn),-1===t.search("X")&&(mn.x=1),-1===t.search("Y")&&(mn.y=1),-1===t.search("Z")&&(mn.z=1);s.scale.copy(this._scaleStart).multiply(mn),this.scaleSnap&&(-1!==t.search("X")&&(s.scale.x=Math.round(s.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(s.scale.y=Math.round(s.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(s.scale.z=Math.round(s.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if("rotate"===i){this._offset.copy(this.pointEnd).sub(this.pointStart);const e=20/this.worldPosition.distanceTo(Tn.setFromMatrixPosition(this.camera.matrixWorld));let i=!1;"XYZE"===t?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Tn.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(gn[t]),Tn.copy(gn[t]),"local"===n&&Tn.applyQuaternion(this.worldQuaternion),Tn.cross(this.eye),0===Tn.length()?i=!0:this.rotationAngle=this._offset.dot(Tn.normalize())*e),("E"===t||i)&&(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),"local"===n&&"E"!==t&&"XYZE"!==t?(s.quaternion.copy(this._quaternionStart),s.quaternion.multiply(Rn.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),s.quaternion.copy(Rn.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),s.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(An),this.dispatchEvent(On)}}pointerUp(e){0===e.button&&(this.dragging&&null!==this.axis&&(Sn.mode=this.mode,this.dispatchEvent(Sn)),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(An),this.dispatchEvent(On),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Cn}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 yn(e){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:e.button};{const t=this.domElement.getBoundingClientRect();return{x:(e.clientX-t.left)/t.width*2-1,y:-(e.clientY-t.top)/t.height*2+1,button:e.button}}}function _n(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}function Ln(e){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(e)),this.pointerDown(this._getPointer(e)))}function Pn(e){this.enabled&&this.pointerMove(this._getPointer(e))}function wn(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}function Mn(e,t,i){const s=t.intersectObject(e,!0);for(let e=0;e<s.length;e++)if(s[e].object.visible||i)return s[e];return!1}const vn=new i.Euler,Dn=new i.Vector3(0,1,0),xn=new i.Vector3(0,0,0),bn=new i.Matrix4,Un=new i.Quaternion,Bn=new i.Quaternion,Vn=new i.Vector3,Yn=new i.Matrix4,Gn=new i.Vector3(1,0,0),zn=new i.Vector3(0,1,0),kn=new i.Vector3(0,0,1),Hn=new i.Vector3,Wn=new i.Vector3,Xn=new i.Vector3;class Zn extends i.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new i.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new i.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=e.clone();s.opacity=.15;const n=t.clone();n.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 c=e.clone();c.color.setHex(16711680),c.opacity=.5;const l=e.clone();l.color.setHex(65280),l.opacity=.5;const h=e.clone();h.color.setHex(255),h.opacity=.5;const u=e.clone();u.opacity=.25;const I=e.clone();I.color.setHex(16776960),I.opacity=.25;e.clone().color.setHex(16776960);const d=e.clone();d.color.setHex(7895160);const E=new i.CylinderGeometry(0,.04,.1,12);E.translate(0,.05,0);const f=new i.BoxGeometry(.08,.08,.08);f.translate(0,.04,0);const p=new i.BufferGeometry;p.setAttribute("position",new i.Float32BufferAttribute([0,0,0,1,0,0],3));const C=new i.CylinderGeometry(.0075,.0075,.5,3);function T(e,t){const s=new i.TorusGeometry(e,.0075,3,64,t*Math.PI*2);return s.rotateY(Math.PI/2),s.rotateX(Math.PI/2),s}C.translate(0,.25,0);const m={X:[[new i.Mesh(E,r),[.5,0,0],[0,0,-Math.PI/2]],[new i.Mesh(E,r),[-.5,0,0],[0,0,Math.PI/2]],[new i.Mesh(C,r),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new i.Mesh(E,o),[0,.5,0]],[new i.Mesh(E,o),[0,-.5,0],[Math.PI,0,0]],[new i.Mesh(C,o)]],Z:[[new i.Mesh(E,a),[0,0,.5],[Math.PI/2,0,0]],[new i.Mesh(E,a),[0,0,-.5],[-Math.PI/2,0,0]],[new i.Mesh(C,a),null,[Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.OctahedronGeometry(.1,0),u.clone()),[0,0,0]]],XY:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),h.clone()),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),c.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),l.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},R={X:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.OctahedronGeometry(.2,0),s)]],XY:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]]},g={START:[[new i.Mesh(new i.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],END:[[new i.Mesh(new i.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],DELTA:[[new i.Line(function(){const e=new i.BufferGeometry;return e.setAttribute("position",new i.Float32BufferAttribute([0,0,0,1,1,1],3)),e}(),n),null,null,null,"helper"]],X:[[new i.Line(p,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new i.Line(p,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new i.Line(p,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},A={XYZE:[[new i.Mesh(T(.5,1),d),null,[0,Math.PI/2,0]]],X:[[new i.Mesh(T(.5,.5),r)]],Y:[[new i.Mesh(T(.5,.5),o),null,[0,0,-Math.PI/2]]],Z:[[new i.Mesh(T(.5,.5),a),null,[0,Math.PI/2,0]]],E:[[new i.Mesh(T(.75,1),I),null,[0,Math.PI/2,0]]]},F={AXIS:[[new i.Line(p,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},S={XYZE:[[new i.Mesh(new i.SphereGeometry(.25,10,8),s)]],X:[[new i.Mesh(new i.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new i.Mesh(new i.TorusGeometry(.5,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new i.Mesh(new i.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,0,-Math.PI/2]]],E:[[new i.Mesh(new i.TorusGeometry(.75,.1,2,24),s)]]},O={X:[[new i.Mesh(f,r),[.5,0,0],[0,0,-Math.PI/2]],[new i.Mesh(C,r),[0,0,0],[0,0,-Math.PI/2]],[new i.Mesh(f,r),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new i.Mesh(f,o),[0,.5,0]],[new i.Mesh(C,o)],[new i.Mesh(f,o),[0,-.5,0],[0,0,Math.PI]]],Z:[[new i.Mesh(f,a),[0,0,.5],[Math.PI/2,0,0]],[new i.Mesh(C,a),[0,0,0],[Math.PI/2,0,0]],[new i.Mesh(f,a),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),c),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.15,.15,.01),l),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.BoxGeometry(.1,.1,.1),u.clone())]]},N={X:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new i.Mesh(new i.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new i.Mesh(new i.BoxGeometry(.2,.2,.2),s),[0,0,0]]]},y={X:[[new i.Line(p,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new i.Line(p,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new i.Line(p,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function _(e){const t=new i.Object3D;for(const i in e)for(let s=e[i].length;s--;){const n=e[i][s][0].clone(),r=e[i][s][1],o=e[i][s][2],a=e[i][s][3],c=e[i][s][4];n.name=i,n.tag=c,r&&n.position.set(r[0],r[1],r[2]),o&&n.rotation.set(o[0],o[1],o[2]),a&&n.scale.set(a[0],a[1],a[2]),n.updateMatrix();const l=n.geometry.clone();l.applyMatrix4(n.matrix),n.geometry=l,n.renderOrder=1/0,n.position.set(0,0,0),n.rotation.set(0,0,0),n.scale.set(1,1,1),t.add(n)}return t}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=_(m)),this.add(this.gizmo.rotate=_(A)),this.add(this.gizmo.scale=_(O)),this.add(this.picker.translate=_(R)),this.add(this.picker.rotate=_(S)),this.add(this.picker.scale=_(N)),this.add(this.helper.translate=_(g)),this.add(this.helper.rotate=_(F)),this.add(this.helper.scale=_(y)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const t="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:Bn;this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode;let i=[];i=i.concat(this.picker[this.mode].children),i=i.concat(this.gizmo[this.mode].children),i=i.concat(this.helper[this.mode].children);for(let e=0;e<i.length;e++){const s=i[e];let n;if(s.visible=!0,s.rotation.set(0,0,0),s.position.copy(this.worldPosition),n=this.camera.isOrthographicCamera?(this.camera.top-this.camera.bottom)/this.camera.zoom:this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),s.scale.set(1,1,1).multiplyScalar(n*this.size/4),"helper"!==s.tag){if(s.quaternion.copy(t),"translate"===this.mode||"scale"===this.mode){const e=.99,i=.2;"X"===s.name&&Math.abs(Dn.copy(Gn).applyQuaternion(t).dot(this.eye))>e&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"Y"===s.name&&Math.abs(Dn.copy(zn).applyQuaternion(t).dot(this.eye))>e&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"Z"===s.name&&Math.abs(Dn.copy(kn).applyQuaternion(t).dot(this.eye))>e&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"XY"===s.name&&Math.abs(Dn.copy(kn).applyQuaternion(t).dot(this.eye))<i&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"YZ"===s.name&&Math.abs(Dn.copy(Gn).applyQuaternion(t).dot(this.eye))<i&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"XZ"===s.name&&Math.abs(Dn.copy(zn).applyQuaternion(t).dot(this.eye))<i&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1)}else"rotate"===this.mode&&(Un.copy(t),Dn.copy(this.eye).applyQuaternion(Rn.copy(t).invert()),-1!==s.name.search("E")&&s.quaternion.setFromRotationMatrix(bn.lookAt(this.eye,xn,zn)),"X"===s.name&&(Rn.setFromAxisAngle(Gn,Math.atan2(-Dn.y,Dn.z)),Rn.multiplyQuaternions(Un,Rn),s.quaternion.copy(Rn)),"Y"===s.name&&(Rn.setFromAxisAngle(zn,Math.atan2(Dn.x,Dn.z)),Rn.multiplyQuaternions(Un,Rn),s.quaternion.copy(Rn)),"Z"===s.name&&(Rn.setFromAxisAngle(kn,Math.atan2(Dn.y,Dn.x)),Rn.multiplyQuaternions(Un,Rn),s.quaternion.copy(Rn)));s.visible=s.visible&&(-1===s.name.indexOf("X")||this.showX),s.visible=s.visible&&(-1===s.name.indexOf("Y")||this.showY),s.visible=s.visible&&(-1===s.name.indexOf("Z")||this.showZ),s.visible=s.visible&&(-1===s.name.indexOf("E")||this.showX&&this.showY&&this.showZ),s.material._color=s.material._color||s.material.color.clone(),s.material._opacity=s.material._opacity||s.material.opacity,s.material.color.copy(s.material._color),s.material.opacity=s.material._opacity,this.enabled&&this.axis&&(s.name===this.axis||this.axis.split("").some((function(e){return s.name===e})))&&(s.material.color.setHex(16776960),s.material.opacity=1)}else s.visible=!1,"AXIS"===s.name?(s.visible=!!this.axis,"X"===this.axis&&(Rn.setFromEuler(vn.set(0,0,0)),s.quaternion.copy(t).multiply(Rn),Math.abs(Dn.copy(Gn).applyQuaternion(t).dot(this.eye))>.9&&(s.visible=!1)),"Y"===this.axis&&(Rn.setFromEuler(vn.set(0,0,Math.PI/2)),s.quaternion.copy(t).multiply(Rn),Math.abs(Dn.copy(zn).applyQuaternion(t).dot(this.eye))>.9&&(s.visible=!1)),"Z"===this.axis&&(Rn.setFromEuler(vn.set(0,Math.PI/2,0)),s.quaternion.copy(t).multiply(Rn),Math.abs(Dn.copy(kn).applyQuaternion(t).dot(this.eye))>.9&&(s.visible=!1)),"XYZE"===this.axis&&(Rn.setFromEuler(vn.set(0,Math.PI/2,0)),Dn.copy(this.rotationAxis),s.quaternion.setFromRotationMatrix(bn.lookAt(xn,Dn,zn)),s.quaternion.multiply(Rn),s.visible=this.dragging),"E"===this.axis&&(s.visible=!1)):"START"===s.name?(s.position.copy(this.worldPositionStart),s.visible=this.dragging):"END"===s.name?(s.position.copy(this.worldPosition),s.visible=this.dragging):"DELTA"===s.name?(s.position.copy(this.worldPositionStart),s.quaternion.copy(this.worldQuaternionStart),Tn.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Tn.applyQuaternion(this.worldQuaternionStart.clone().invert()),s.scale.copy(Tn),s.visible=this.dragging):(s.quaternion.copy(t),this.dragging?s.position.copy(this.worldPositionStart):s.position.copy(this.worldPosition),this.axis&&(s.visible=-1!==this.axis.search(s.name)))}super.updateMatrixWorld(e)}}class jn extends i.Mesh{constructor(){super(new i.PlaneGeometry(1e5,1e5,2,2),new i.MeshBasicMaterial({visible:!1,wireframe:!0,side:i.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),"scale"===this.mode&&(t="local"),Hn.copy(Gn).applyQuaternion("local"===t?this.worldQuaternion:Bn),Wn.copy(zn).applyQuaternion("local"===t?this.worldQuaternion:Bn),Xn.copy(kn).applyQuaternion("local"===t?this.worldQuaternion:Bn),Dn.copy(Wn),this.mode){case"translate":case"scale":switch(this.axis){case"X":Dn.copy(this.eye).cross(Hn),Vn.copy(Hn).cross(Dn);break;case"Y":Dn.copy(this.eye).cross(Wn),Vn.copy(Wn).cross(Dn);break;case"Z":Dn.copy(this.eye).cross(Xn),Vn.copy(Xn).cross(Dn);break;case"XY":Vn.copy(Xn);break;case"YZ":Vn.copy(Hn);break;case"XZ":Dn.copy(Xn),Vn.copy(Wn);break;case"XYZ":case"E":Vn.set(0,0,0)}break;default:Vn.set(0,0,0)}0===Vn.length()?this.quaternion.copy(this.cameraQuaternion):(Yn.lookAt(Tn.set(0,0,0),Vn,Dn),this.quaternion.setFromRotationMatrix(Yn)),super.updateMatrixWorld(e)}}class $n{constructor(e,i,s,n,r,a=5,c=!0){if(t(this,"onDraggingStarted",new Dt),t(this,"onDraggingEnded",new Dt),t(this,"onDisposed",new Dt),t(this,"normal"),t(this,"origin"),t(this,"three",new o.Plane),t(this,"components"),t(this,"world"),t(this,"type","default"),t(this,"_helper"),t(this,"_visible",!0),t(this,"_enabled",!0),t(this,"_controlsActive",!1),t(this,"_arrowBoundBox",new o.Mesh),t(this,"_planeMesh"),t(this,"_controls"),t(this,"_hiddenMaterial",new o.MeshBasicMaterial({visible:!1})),t(this,"update",(()=>{this._enabled&&this.three.setFromNormalAndCoplanarPoint(this.normal,this._helper.position)})),t(this,"changeDrag",(e=>{this._visible=!e.value,this.preventCameraMovement(),this.notifyDraggingChanged(e)})),this.components=e,this.world=i,!i.renderer)throw new Error("The given world must have a renderer!");this.normal=n,this.origin=s,i.renderer.setPlane(!0,this.three),this._planeMesh=$n.newPlaneMesh(a,r),this._helper=this.newHelper(),this._controls=this.newTransformControls(),this.three.setFromNormalAndCoplanarPoint(n,s),c&&this.toggleControls(!0)}get enabled(){return this._enabled}set enabled(e){if(!this.world.isDisposing){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 o.Vector3(1,0,0),t=new o.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 Nn(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 o.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 o.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 o.PlaneGeometry(1),s=new o.Mesh(i,t);return s.scale.set(e,e,e),s}}class Qn extends Zi{constructor(){super(...arguments),t(this,"_config",{enabled:{value:!0,type:"Boolean"},visible:{value:!0,type:"Boolean"},color:{value:new o.Color,type:"Color"},opacity:{type:"Number",interpolable:!0,value:1,min:0,max:1},size:{type:"Number",interpolable:!0,value:2,min:0,max:100}})}get enabled(){return this._config.enabled.value}set enabled(e){this._config.enabled.value=e,this._component.enabled=e}get visible(){return this._config.visible.value}set visible(e){this._config.visible.value=e,this._component.visible=e}get color(){return this._config.color.value}set color(e){this._config.color.value=e,this._component.material.color.copy(e)}get opacity(){return this._config.opacity.value}set opacity(e){this._config.opacity.value=e,this._component.material.opacity=e}get size(){return this._config.size.value}set size(e){this._config.size.value=e,this._component.size=e}}const qn=class e extends Ut{constructor(i){super(i),t(this,"onSetup",new Dt),t(this,"onBeforeDrag",new Dt),t(this,"onAfterDrag",new Dt),t(this,"onBeforeCreate",new Dt),t(this,"onBeforeCancel",new Dt),t(this,"onAfterCancel",new Dt),t(this,"onBeforeDelete",new Dt),t(this,"onAfterCreate",new Dt),t(this,"onAfterDelete",new Dt),t(this,"onDisposed",new Dt),t(this,"isSetup",!1),t(this,"orthogonalY",!1),t(this,"toleranceOrthogonalY",.7),t(this,"Type",$n),t(this,"list",[]),t(this,"config",new Qn(this,this.components,"Clipper",e.uuid)),t(this,"_defaultConfig",{color:new o.Color(12255487),opacity:.2,size:2}),t(this,"_material",new o.MeshBasicMaterial({color:12255487,side:o.DoubleSide,transparent:!0,opacity:.2})),t(this,"_size",5),t(this,"_enabled",!1),t(this,"_visible",!0),t(this,"_onStartDragging",(()=>{this.onBeforeDrag.trigger()})),t(this,"_onEndDragging",(()=>{this.onAfterDrag.trigger()})),this.components.add(e.uuid,this)}get enabled(){return this._enabled}set enabled(e){this._enabled=e;for(const t of this.list)t.enabled=e;this.updateMaterialsAndPlanes()}get visible(){return this._visible}set visible(e){this._visible=e;for(const t of this.list)t.visible=e}get material(){return this._material}set material(e){this._material=e;for(const t of this.list)t.planeMaterial=e}get size(){return this._size}set size(e){this._size=e;for(const t of this.list)t.size=e}dispose(){this._enabled=!1;this.components.get($i).list.delete(this.config.uuid);for(const e of this.list)e.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(e.uuid),this.onDisposed.reset()}create(e){const t=this.components.get(In).get(e).castRay();return t?this.createPlaneFromIntersection(e,t):null}createFromNormalAndCoplanarPoint(e,t,i){const s=this.newPlane(e,i,t);return this.updateMaterialsAndPlanes(),s}delete(e,t){t||(t=this.pickPlane(e)),t&&this.deletePlane(t)}deleteAll(e){const t=[...this.list];for(const i of t)if(!e||e.has(i.type)){this.delete(i.world,i);const e=this.list.indexOf(i);-1!==e&&this.list.splice(e,1)}}setup(e){const t={...this._defaultConfig,...e};this.config.color=t.color,this.config.opacity=t.opacity,this.config.size=t.size,this.isSetup=!0,this.onSetup.trigger()}deletePlane(e){const t=this.list.indexOf(e);if(-1!==t){if(this.list.splice(t,1),!e.world.renderer)throw new Error("Renderer not found for this plane's world!");e.world.renderer.setPlane(!1,e.three),e.dispose(),this.updateMaterialsAndPlanes(),this.onAfterDelete.trigger(e)}}pickPlane(e){const t=this.components.get(In).get(e),i=this.getAllPlaneMeshes(),s=t.castRay(i);if(s){const e=s.object;return this.list.find((t=>t.meshes.includes(e)))}}getAllPlaneMeshes(){const e=[];for(const t of this.list)e.push(...t.meshes);return e}createPlaneFromIntersection(e,t){var i;if(!e.renderer)throw new Error("The given world must have a renderer!");const s=t.point.distanceTo(new o.Vector3(0,0,0)),n=null==(i=t.face)?void 0:i.normal;if(!s||!n)return null;const r=this.getWorldNormal(t,n),a=this.newPlane(e,t.point,r.negate());return a.visible=this._visible,a.size=this._size,e.renderer.setPlane(!0,a.three),this.updateMaterialsAndPlanes(),a}getWorldNormal(e,t){const i=e.object;let s=e.object.matrixWorld.clone();if(i instanceof o.InstancedMesh&&void 0!==e.instanceId){const t=new o.Matrix4;i.getMatrixAt(e.instanceId,t),s=t.multiply(s)}const n=(new o.Matrix3).getNormalMatrix(s),r=t.clone().applyMatrix3(n).normalize();return this.normalizePlaneDirectionY(r),r}normalizePlaneDirectionY(e){this.orthogonalY&&(e.y>this.toleranceOrthogonalY&&(e.x=0,e.y=1,e.z=0),e.y<-this.toleranceOrthogonalY&&(e.x=0,e.y=-1,e.z=0))}newPlane(e,t,i){const s=new this.Type(this.components,e,t,i,this._material);return s.onDraggingStarted.add(this._onStartDragging),s.onDraggingEnded.add(this._onEndDragging),this.list.push(s),this.onAfterCreate.trigger(s),s}updateMaterialsAndPlanes(){const e=this.components.get(Js);for(const[t,i]of e.list){if(!i.renderer)continue;i.renderer.updateClippingPlanes();const{clippingPlanes:e}=i.renderer;for(const t of i.meshes)if(t.material)if(Array.isArray(t.material))for(const i of t.material)i.clippingPlanes=e;else t.material.clippingPlanes=e}}};t(qn,"uuid","66290bc5-18c4-4cd1-9379-2e17a0617611");let Kn=qn;class Jn{constructor(e){t(this,"enabled",!1),t(this,"id","FirstPerson"),this.camera=e}set(e){if(this.enabled=e,e){if("Perspective"!==this.camera.projection.current)return void this.camera.set("Orbit");this.setupFirstPersonCamera()}}setupFirstPersonCamera(){const e=this.camera.controls,t=new o.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=Qs.ACTION.DOLLY,e.touches.two=Qs.ACTION.TOUCH_ZOOM_TRUCK}}class er{constructor(e){t(this,"enabled",!0),t(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 o.Vector3;e.getPosition(t);const i=t.length();e.distance=i,e.truckSpeed=2;const{rotation:s}=this.camera.three,n=new o.Vector3(0,0,-1).applyEuler(s),r=t.addScaledVector(n,i);e.moveTo(r.x,r.y,r.z)}}class tr{constructor(e){t(this,"enabled",!1),t(this,"id","Plan"),t(this,"mouseAction1"),t(this,"mouseAction2"),t(this,"mouseInitialized",!1),t(this,"defaultAzimuthSpeed"),t(this,"defaultPolarSpeed"),this.camera=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=Qs.ACTION.TRUCK,t.touches.one=Qs.ACTION.TOUCH_TRUCK,t.touches.two=Qs.ACTION.TOUCH_ZOOM):(t.mouseButtons.left=Qs.ACTION.ROTATE,t.touches.one=this.mouseAction1,t.touches.two=this.mouseAction2)}}class ir{constructor(e){t(this,"onChanged",new Dt),t(this,"current","Perspective"),t(this,"camera"),t(this,"matchOrthoDistanceEnabled",!1),t(this,"_component"),t(this,"_previousDistance",-1),this._component=e,this.camera=e.three}async set(e){this.current!==e&&("Orthographic"===e?this.setOrthoCamera():await this.setPerspectiveCamera(),this.onChanged.trigger(this.camera))}async toggle(){const e="Perspective"===this.current?"Orthographic":"Perspective";await this.set(e)}setOrthoCamera(){if(null===this._component.mode)return;if("FirstPerson"===this._component.mode.id)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 o.Vector3;this._component.threePersp.getWorldDirection(t);const i=new o.Vector3;this._component.controls.getTarget(i);const s=i.clone().sub(this._component.threePersp.position).dot(t),n=e.renderer.getSize(),r=n.x/n.y,a=this._component.threePersp,c=2*s*Math.atan(a.fov*(Math.PI/180)/2);return{width:c*r,height:c}}setupOrthoCamera(e,t){this._component.controls.mouseButtons.wheel=Qs.ACTION.ZOOM,this._component.controls.mouseButtons.middle=Qs.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=Qs.ACTION.DOLLY,this._component.controls.mouseButtons.middle=Qs.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=Qs.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 sr extends qs{constructor(e){super(e),t(this,"projection"),t(this,"threeOrtho"),t(this,"threePersp"),t(this,"_userInputButtons",{}),t(this,"_frustumSize",50),t(this,"_navigationModes",new Map),t(this,"_mode",null),t(this,"previousSize",null),this.threePersp=this.three,this.threeOrtho=this.newOrthoCamera(),this.projection=new ir(this),this.onAspectUpdated.add((()=>{this.setOrthoPerspCameraAspect()})),this.projection.onChanged.add((e=>{this.three=e,this.updateAspect()})),this.onWorldChanged.add((({action:e})=>{"added"===e&&(this._navigationModes.clear(),this._navigationModes.set("Orbit",new er(this)),this._navigationModes.set("FirstPerson",new Jn(this)),this._navigationModes.set("Plan",new tr(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(e){if(null!==this.mode&&this.mode.id!==e){if(this.mode.set(!1),!this._navigationModes.has(e))throw new Error("The specified mode does not exist!");this._mode=this._navigationModes.get(e),this.mode.set(!0)}}async fit(e,t=1.5){if(!this.enabled)return;const i=Number.MAX_VALUE,s=Number.MIN_VALUE,n=new o.Vector3(i,i,i),r=new o.Vector3(s,s,s);for(const t of e){const e=(new o.Box3).setFromObject(t);e.min.x<n.x&&(n.x=e.min.x),e.min.y<n.y&&(n.y=e.min.y),e.min.z<n.z&&(n.z=e.min.z),e.max.x>r.x&&(r.x=e.max.x),e.max.y>r.y&&(r.y=e.max.y),e.max.z>r.z&&(r.z=e.max.z)}const a=new o.Box3(n,r),c=new o.Vector3;a.getSize(c);const l=new o.Vector3;a.getCenter(l);const h=Math.max(c.x,c.y,c.z)*t,u=new o.Sphere(l,h);await this.controls.fitToSphere(u,!0)}setUserInput(e){e?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(){0!==Object.keys(this._userInputButtons).length&&(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 e=window.innerWidth/window.innerHeight;return new o.OrthographicCamera(this._frustumSize*e/-2,this._frustumSize*e/2,this._frustumSize/2,this._frustumSize/-2,.1,1e3)}setOrthoPerspCameraAspect(){if(!this.currentWorld||!this.currentWorld.renderer)return;if(!this.previousSize)return;const e=this.currentWorld.renderer.getSize(),t=this.threeOrtho.top,i=this.threeOrtho.right,s=t*(e.y/this.previousSize.y),n=i*(e.x/this.previousSize.x);this.threeOrtho.left=-n,this.threeOrtho.right=n,this.threeOrtho.top=s,this.threeOrtho.bottom=-s,this.threeOrtho.updateProjectionMatrix(),this.previousSize.copy(e)}}const nr=new Map([[c.IFCRELAGGREGATES,{forRelated:"Decomposes",forRelating:"IsDecomposedBy"}],[c.IFCRELASSOCIATESMATERIAL,{forRelated:"HasAssociations",forRelating:"AssociatedTo"}],[c.IFCRELASSOCIATESCLASSIFICATION,{forRelated:"HasAssociations",forRelating:"ClassificationForObjects"}],[c.IFCRELASSIGNSTOGROUP,{forRelated:"HasAssignments",forRelating:"IsGroupedBy"}],[c.IFCRELDEFINESBYPROPERTIES,{forRelated:"IsDefinedBy",forRelating:"DefinesOcurrence"}],[c.IFCRELDEFINESBYTYPE,{forRelated:"IsTypedBy",forRelating:"Types"}],[c.IFCRELDEFINESBYTEMPLATE,{forRelated:"IsDefinedBy",forRelating:"Defines"}],[c.IFCRELCONTAINEDINSPATIALSTRUCTURE,{forRelated:"ContainedInStructure",forRelating:"ContainsElements"}],[c.IFCRELFLOWCONTROLELEMENTS,{forRelated:"AssignedToFlowElement",forRelating:"HasControlElements"}],[c.IFCRELCONNECTSELEMENTS,{forRelated:"ConnectedFrom",forRelating:"ConnectedTo"}],[c.IFCRELASSIGNSTOPRODUCT,{forRelated:"HasAssignments",forRelating:"ReferencedBy"}],[c.IFCRELDECLARES,{forRelated:"HasContext",forRelating:"Declares"}],[c.IFCRELASSIGNSTOCONTROL,{forRelated:"HasAssignments",forRelating:"Controls"}],[c.IFCRELNESTS,{forRelated:"Nests",forRelating:"IsNestedBy"}],[c.IFCRELASSOCIATESDOCUMENT,{forRelated:"HasAssociations",forRelating:"DocumentRefForObjects"}]]),rr={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"};const or={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 ar{static async getUnits(e){var t,i,s;const{IFCUNITASSIGNMENT:n}=c,r=await e.getAllPropertiesOfType(n);if(!r)return 1;const o=Object.keys(r),a=r[parseInt(o[0],10)];for(const n of a.Units){if(void 0===n.value||null===n.value)continue;const r=await e.getProperties(n.value);if(!r||!r.UnitType||!r.UnitType.value)continue;if("LENGTHUNIT"!==r.UnitType.value)continue;let o=1,a=1;return"METRE"===r.Name.value&&(a=1),"FOOT"===r.Name.value&&(a=.3048),"MILLI"===(null==(t=r.Prefix)?void 0:t.value)?o=.001:"CENTI"===(null==(i=r.Prefix)?void 0:i.value)?o=.01:"DECI"===(null==(s=r.Prefix)?void 0:s.value)&&(o=.1),a*o}return 1}static async findItemByGuid(e,t){var i;const s=e.getAllPropertiesIDs();for(const n of s){const s=await e.getProperties(n);if(s&&(null==(i=s.GlobalId)?void 0:i.value)===t)return s}return null}static async getRelationMap(e,t,i){var s;const n=i??(async()=>{}),r={},o=e.getAllPropertiesIDs();for(const i of o){const o=await e.getProperties(i);if(!o)continue;const a=o.type===t,c=Object.keys(o).find((e=>e.startsWith("Relating"))),l=Object.keys(o).find((e=>e.startsWith("Related")));if(!(a&&c&&l))continue;const h=await e.getProperties(null==(s=o[c])?void 0:s.value),u=o[l];if(!h||!u)continue;if(!u||!Array.isArray(u))continue;const I=u.map((e=>e.value));await n(h.expressID,I),r[h.expressID]=I}return r}static async getQsetQuantities(e,t,i){const s=i??(()=>{}),n=await e.getProperties(t);if(!n||n.type!==c.IFCELEMENTQUANTITY)return null;return(n.Quantities??[{}]).map((e=>(e.value&&s(e.value),e.value))).filter((e=>null!==e))}static async getPsetProps(e,t,i){const s=i??(()=>{}),n=await e.getProperties(t);if(!n||n.type!==c.IFCPROPERTYSET)return null;return(n.HasProperties??[{}]).map((e=>(e.value&&s(e.value),e.value))).filter((e=>null!==e))}static async getPsetRel(e,t){var i;if(!await e.getProperties(t))return null;const s=await e.getAllPropertiesOfType(c.IFCRELDEFINESBYPROPERTIES);if(!s)return null;const n=Object.values(s);let r=null;for(const e of n)(null==(i=e.RelatingPropertyDefinition)?void 0:i.value)===t&&(r=e.expressID);return r}static async getQsetRel(e,t){return ar.getPsetRel(e,t)}static async getEntityName(e,t){var i;const s=await e.getProperties(t);if(!s)return{key:null,name:null};const n=Object.keys(s).find((e=>e.endsWith("Name")))??null;return{key:n,name:n?null==(i=s[n])?void 0:i.value:null}}static async getQuantityValue(e,t){const i=await e.getProperties(t);if(!i)return{key:null,value:null};const s=Object.keys(i).find((e=>e.endsWith("Value")))??null;let n;return n=null===s||void 0===i[s]||null===i[s]?null:i[s].value,{key:s,value:n}}static isRel(e){return or[e].startsWith("IFCREL")}static async attributeExists(e,t,i){const s=await e.getProperties(t);return!!s&&Object.keys(s).includes(i)}static async groupEntitiesByType(e,t){var i;const s=new Map;for(const n of t){const t=await e.getProperties(n);if(!t)continue;const r=t.type;s.get(r)||s.set(r,new Set),null==(i=s.get(r))||i.add(n)}return s}}const cr={IFCURIREFERENCE:"IfcUriReference",IFCTIME:"IfcTime",IFCTEMPERATURERATEOFCHANGEMEASURE:"IfcTemperatureRateOfChangeMeasure",IFCSOUNDPRESSURELEVELMEASURE:"IfcSoundPressureLevelMeasure",IFCSOUNDPOWERLEVELMEASURE:"IfcSoundPowerLevelMeasure",IFCPROPERTYSETDEFINITIONSET:"IfcPropertySetDefinitionSet",IFCPOSITIVEINTEGER:"IfcPositiveInteger",IFCNONNEGATIVELENGTHMEASURE:"IfcNonNegativeLengthMeasure",IFCLINEINDEX:"IfcLineIndex",IFCLANGUAGEID:"IfcLanguageId",IFCDURATION:"IfcDuration",IFCDAYINWEEKNUMBER:"IfcDayInWeekNumber",IFCDATETIME:"IfcDateTime",IFCDATE:"IfcDate",IFCCARDINALPOINTREFERENCE:"IfcCardinalPointReference",IFCBINARY:"IfcBinary",IFCAREADENSITYMEASURE:"IfcAreaDensityMeasure",IFCARCINDEX:"IfcArcIndex",IFCYEARNUMBER:"IfcYearNumber",IFCWARPINGMOMENTMEASURE:"IfcWarpingMomentMeasure",IFCWARPINGCONSTANTMEASURE:"IfcWarpingConstantMeasure",IFCVOLUMETRICFLOWRATEMEASURE:"IfcVolumetricFlowRateMeasure",IFCVOLUMEMEASURE:"IfcVolumeMeasure",IFCVAPORPERMEABILITYMEASURE:"IfcVaporPermeabilityMeasure",IFCTORQUEMEASURE:"IfcTorqueMeasure",IFCTIMESTAMP:"IfcTimestamp",IFCTIMEMEASURE:"IfcTimeMeasure",IFCTHERMODYNAMICTEMPERATUREMEASURE:"IfcThermodynamicTemperatureMeasure",IFCTHERMALTRANSMITTANCEMEASURE:"IfcThermalTransmittanceMeasure",IFCTHERMALRESISTANCEMEASURE:"IfcThermalResistanceMeasure",IFCTHERMALEXPANSIONCOEFFICIENTMEASURE:"IfcThermalExpansionCoefficientMeasure",IFCTHERMALCONDUCTIVITYMEASURE:"IfcThermalConductivityMeasure",IFCTHERMALADMITTANCEMEASURE:"IfcThermalAdmittanceMeasure",IFCTEXTTRANSFORMATION:"IfcTextTransformation",IFCTEXTFONTNAME:"IfcTextFontName",IFCTEXTDECORATION:"IfcTextDecoration",IFCTEXTALIGNMENT:"IfcTextAlignment",IFCTEXT:"IfcText",IFCTEMPERATUREGRADIENTMEASURE:"IfcTemperatureGradientMeasure",IFCSPECULARROUGHNESS:"IfcSpecularRoughness",IFCSPECULAREXPONENT:"IfcSpecularExponent",IFCSPECIFICHEATCAPACITYMEASURE:"IfcSpecificHeatCapacityMeasure",IFCSOUNDPRESSUREMEASURE:"IfcSoundPressureMeasure",IFCSOUNDPOWERMEASURE:"IfcSoundPowerMeasure",IFCSOLIDANGLEMEASURE:"IfcSolidAngleMeasure",IFCSHEARMODULUSMEASURE:"IfcShearModulusMeasure",IFCSECTIONALAREAINTEGRALMEASURE:"IfcSectionalAreaIntegralMeasure",IFCSECTIONMODULUSMEASURE:"IfcSectionModulusMeasure",IFCSECONDINMINUTE:"IfcSecondInMinute",IFCROTATIONALSTIFFNESSMEASURE:"IfcRotationalStiffnessMeasure",IFCROTATIONALMASSMEASURE:"IfcRotationalMassMeasure",IFCROTATIONALFREQUENCYMEASURE:"IfcRotationalFrequencyMeasure",IFCREAL:"IfcReal",IFCRATIOMEASURE:"IfcRatioMeasure",IFCRADIOACTIVITYMEASURE:"IfcRadioactivityMeasure",IFCPRESSUREMEASURE:"IfcPressureMeasure",IFCPRESENTABLETEXT:"IfcPresentableText",IFCPOWERMEASURE:"IfcPowerMeasure",IFCPOSITIVERATIOMEASURE:"IfcPositiveRatioMeasure",IFCPOSITIVEPLANEANGLEMEASURE:"IfcPositivePlaneAngleMeasure",IFCPOSITIVELENGTHMEASURE:"IfcPositiveLengthMeasure",IFCPLANEANGLEMEASURE:"IfcPlaneAngleMeasure",IFCPLANARFORCEMEASURE:"IfcPlanarForceMeasure",IFCPARAMETERVALUE:"IfcParameterValue",IFCPHMEASURE:"IfcPhMeasure",IFCNUMERICMEASURE:"IfcNumericMeasure",IFCNORMALISEDRATIOMEASURE:"IfcNormalisedRatioMeasure",IFCMONTHINYEARNUMBER:"IfcMonthInYearNumber",IFCMONETARYMEASURE:"IfcMonetaryMeasure",IFCMOMENTOFINERTIAMEASURE:"IfcMomentOfInertiaMeasure",IFCMOLECULARWEIGHTMEASURE:"IfcMolecularWeightMeasure",IFCMOISTUREDIFFUSIVITYMEASURE:"IfcMoistureDiffusivityMeasure",IFCMODULUSOFSUBGRADEREACTIONMEASURE:"IfcModulusOfSubgradeReactionMeasure",IFCMODULUSOFROTATIONALSUBGRADEREACTIONMEASURE:"IfcModulusOfRotationalSubgradeReactionMeasure",IFCMODULUSOFLINEARSUBGRADEREACTIONMEASURE:"IfcModulusOfLinearSubgradeReactionMeasure",IFCMODULUSOFELASTICITYMEASURE:"IfcModulusOfElasticityMeasure",IFCMINUTEINHOUR:"IfcMinuteInHour",IFCMASSPERLENGTHMEASURE:"IfcMassPerLengthMeasure",IFCMASSMEASURE:"IfcMassMeasure",IFCMASSFLOWRATEMEASURE:"IfcMassFlowRateMeasure",IFCMASSDENSITYMEASURE:"IfcMassDensityMeasure",IFCMAGNETICFLUXMEASURE:"IfcMagneticFluxMeasure",IFCMAGNETICFLUXDENSITYMEASURE:"IfcMagneticFluxDensityMeasure",IFCLUMINOUSINTENSITYMEASURE:"IfcLuminousIntensityMeasure",IFCLUMINOUSINTENSITYDISTRIBUTIONMEASURE:"IfcLuminousIntensityDistributionMeasure",IFCLUMINOUSFLUXMEASURE:"IfcLuminousFluxMeasure",IFCLOGICAL:"IfcLogical",IFCLINEARVELOCITYMEASURE:"IfcLinearVelocityMeasure",IFCLINEARSTIFFNESSMEASURE:"IfcLinearStiffnessMeasure",IFCLINEARMOMENTMEASURE:"IfcLinearMomentMeasure",IFCLINEARFORCEMEASURE:"IfcLinearForceMeasure",IFCLENGTHMEASURE:"IfcLengthMeasure",IFCLABEL:"IfcLabel",IFCKINEMATICVISCOSITYMEASURE:"IfcKinematicViscosityMeasure",IFCISOTHERMALMOISTURECAPACITYMEASURE:"IfcIsothermalMoistureCapacityMeasure",IFCIONCONCENTRATIONMEASURE:"IfcIonConcentrationMeasure",IFCINTEGERCOUNTRATEMEASURE:"IfcIntegerCountRateMeasure",IFCINTEGER:"IfcInteger",IFCINDUCTANCEMEASURE:"IfcInductanceMeasure",IFCILLUMINANCEMEASURE:"IfcIlluminanceMeasure",IFCIDENTIFIER:"IfcIdentifier",IFCHOURINDAY:"IfcHourInDay",IFCHEATINGVALUEMEASURE:"IfcHeatingValueMeasure",IFCHEATFLUXDENSITYMEASURE:"IfcHeatFluxDensityMeasure",IFCGLOBALLYUNIQUEID:"IfcGloballyUniqueId",IFCFREQUENCYMEASURE:"IfcFrequencyMeasure",IFCFORCEMEASURE:"IfcForceMeasure",IFCFONTWEIGHT:"IfcFontWeight",IFCFONTVARIANT:"IfcFontVariant",IFCFONTSTYLE:"IfcFontStyle",IFCENERGYMEASURE:"IfcEnergyMeasure",IFCELECTRICVOLTAGEMEASURE:"IfcElectricVoltageMeasure",IFCELECTRICRESISTANCEMEASURE:"IfcElectricResistanceMeasure",IFCELECTRICCURRENTMEASURE:"IfcElectricCurrentMeasure",IFCELECTRICCONDUCTANCEMEASURE:"IfcElectricConductanceMeasure",IFCELECTRICCHARGEMEASURE:"IfcElectricChargeMeasure",IFCELECTRICCAPACITANCEMEASURE:"IfcElectricCapacitanceMeasure",IFCDYNAMICVISCOSITYMEASURE:"IfcDynamicViscosityMeasure",IFCDOSEEQUIVALENTMEASURE:"IfcDoseEquivalentMeasure",IFCDIMENSIONCOUNT:"IfcDimensionCount",IFCDESCRIPTIVEMEASURE:"IfcDescriptiveMeasure",IFCDAYLIGHTSAVINGHOUR:"IfcDaylightSavingHour",IFCDAYINMONTHNUMBER:"IfcDayInMonthNumber",IFCCURVATUREMEASURE:"IfcCurvatureMeasure",IFCCOUNTMEASURE:"IfcCountMeasure",IFCCONTEXTDEPENDENTMEASURE:"IfcContextDependentMeasure",IFCCOMPOUNDPLANEANGLEMEASURE:"IfcCompoundPlaneAngleMeasure",IFCCOMPLEXNUMBER:"IfcComplexNumber",IFCBOXALIGNMENT:"IfcBoxAlignment",IFCBOOLEAN:"IfcBoolean",IFCAREAMEASURE:"IfcAreaMeasure",IFCANGULARVELOCITYMEASURE:"IfcAngularVelocityMeasure",IFCAMOUNTOFSUBSTANCEMEASURE:"IfcAmountOfSubstanceMeasure",IFCACCELERATIONMEASURE:"IfcAccelerationMeasure",IFCABSORBEDDOSEMEASURE:"IfcAbsorbedDoseMeasure",IFCGEOSLICE:"IfcGeoSlice",IFCGEOMODEL:"IfcGeoModel",IFCELECTRICFLOWTREATMENTDEVICE:"IfcElectricFlowTreatmentDevice",IFCDISTRIBUTIONBOARD:"IfcDistributionBoard",IFCCONVEYORSEGMENT:"IfcConveyorSegment",IFCCAISSONFOUNDATION:"IfcCaissonFoundation",IFCBOREHOLE:"IfcBorehole",IFCBEARING:"IfcBearing",IFCALIGNMENT:"IfcAlignment",IFCTRACKELEMENT:"IfcTrackElement",IFCSIGNAL:"IfcSignal",IFCREINFORCEDSOIL:"IfcReinforcedSoil",IFCRAIL:"IfcRail",IFCPAVEMENT:"IfcPavement",IFCNAVIGATIONELEMENT:"IfcNavigationElement",IFCMOORINGDEVICE:"IfcMooringDevice",IFCMOBILETELECOMMUNICATIONSAPPLIANCE:"IfcMobileTelecommunicationsAppliance",IFCLIQUIDTERMINAL:"IfcLiquidTerminal",IFCLINEARPOSITIONINGELEMENT:"IfcLinearPositioningElement",IFCKERB:"IfcKerb",IFCGEOTECHNICALASSEMBLY:"IfcGeotechnicalAssembly",IFCELECTRICFLOWTREATMENTDEVICETYPE:"IfcElectricFlowTreatmentDeviceType",IFCEARTHWORKSFILL:"IfcEarthworksFill",IFCEARTHWORKSELEMENT:"IfcEarthworksElement",IFCEARTHWORKSCUT:"IfcEarthworksCut",IFCDISTRIBUTIONBOARDTYPE:"IfcDistributionBoardType",IFCDEEPFOUNDATION:"IfcDeepFoundation",IFCCOURSE:"IfcCourse",IFCCONVEYORSEGMENTTYPE:"IfcConveyorSegmentType",IFCCAISSONFOUNDATIONTYPE:"IfcCaissonFoundationType",IFCBUILTSYSTEM:"IfcBuiltSystem",IFCBUILTELEMENT:"IfcBuiltElement",IFCBRIDGEPART:"IfcBridgePart",IFCBRIDGE:"IfcBridge",IFCBEARINGTYPE:"IfcBearingType",IFCALIGNMENTVERTICAL:"IfcAlignmentVertical",IFCALIGNMENTSEGMENT:"IfcAlignmentSegment",IFCALIGNMENTHORIZONTAL:"IfcAlignmentHorizontal",IFCALIGNMENTCANT:"IfcAlignmentCant",IFCVIBRATIONDAMPERTYPE:"IfcVibrationDamperType",IFCVIBRATIONDAMPER:"IfcVibrationDamper",IFCVEHICLE:"IfcVehicle",IFCTRANSPORTATIONDEVICE:"IfcTransportationDevice",IFCTRACKELEMENTTYPE:"IfcTrackElementType",IFCTENDONCONDUITTYPE:"IfcTendonConduitType",IFCTENDONCONDUIT:"IfcTendonConduit",IFCSINESPIRAL:"IfcSineSpiral",IFCSIGNALTYPE:"IfcSignalType",IFCSIGNTYPE:"IfcSignType",IFCSIGN:"IfcSign",IFCSEVENTHORDERPOLYNOMIALSPIRAL:"IfcSeventhOrderPolynomialSpiral",IFCSEGMENTEDREFERENCECURVE:"IfcSegmentedReferenceCurve",IFCSECONDORDERPOLYNOMIALSPIRAL:"IfcSecondOrderPolynomialSpiral",IFCROADPART:"IfcRoadPart",IFCROAD:"IfcRoad",IFCRELADHERESTOELEMENT:"IfcRelAdheresToElement",IFCREFERENT:"IfcReferent",IFCRAILWAYPART:"IfcRailwayPart",IFCRAILWAY:"IfcRailway",IFCRAILTYPE:"IfcRailType",IFCPOSITIONINGELEMENT:"IfcPositioningElement",IFCPAVEMENTTYPE:"IfcPavementType",IFCNAVIGATIONELEMENTTYPE:"IfcNavigationElementType",IFCMOORINGDEVICETYPE:"IfcMooringDeviceType",IFCMOBILETELECOMMUNICATIONSAPPLIANCETYPE:"IfcMobileTelecommunicationsApplianceType",IFCMARINEPART:"IfcMarinePart",IFCMARINEFACILITY:"IfcMarineFacility",IFCLIQUIDTERMINALTYPE:"IfcLiquidTerminalType",IFCLINEARELEMENT:"IfcLinearElement",IFCKERBTYPE:"IfcKerbType",IFCIMPACTPROTECTIONDEVICETYPE:"IfcImpactProtectionDeviceType",IFCIMPACTPROTECTIONDEVICE:"IfcImpactProtectionDevice",IFCGRADIENTCURVE:"IfcGradientCurve",IFCGEOTECHNICALSTRATUM:"IfcGeotechnicalStratum",IFCGEOTECHNICALELEMENT:"IfcGeotechnicalElement",IFCFACILITYPARTCOMMON:"IfcFacilityPartCommon",IFCFACILITYPART:"IfcFacilityPart",IFCFACILITY:"IfcFacility",IFCDIRECTRIXDERIVEDREFERENCESWEPTAREASOLID:"IfcDirectrixDerivedReferenceSweptAreaSolid",IFCDEEPFOUNDATIONTYPE:"IfcDeepFoundationType",IFCCOURSETYPE:"IfcCourseType",IFCCOSINESPIRAL:"IfcCosineSpiral",IFCCLOTHOID:"IfcClothoid",IFCBUILTELEMENTTYPE:"IfcBuiltElementType",IFCVEHICLETYPE:"IfcVehicleType",IFCTRIANGULATEDIRREGULARNETWORK:"IfcTriangulatedIrregularNetwork",IFCTRANSPORTATIONDEVICETYPE:"IfcTransportationDeviceType",IFCTHIRDORDERPOLYNOMIALSPIRAL:"IfcThirdOrderPolynomialSpiral",IFCSPIRAL:"IfcSpiral",IFCSECTIONEDSURFACE:"IfcSectionedSurface",IFCSECTIONEDSOLIDHORIZONTAL:"IfcSectionedSolidHorizontal",IFCSECTIONEDSOLID:"IfcSectionedSolid",IFCRELPOSITIONS:"IfcRelPositions",IFCRELASSOCIATESPROFILEDEF:"IfcRelAssociatesProfileDef",IFCPOLYNOMIALCURVE:"IfcPolynomialCurve",IFCOFFSETCURVEBYDISTANCES:"IfcOffsetCurveByDistances",IFCOFFSETCURVE:"IfcOffsetCurve",IFCINDEXEDPOLYGONALTEXTUREMAP:"IfcIndexedPolygonalTextureMap",IFCDIRECTRIXCURVESWEPTAREASOLID:"IfcDirectrixCurveSweptAreaSolid",IFCCURVESEGMENT:"IfcCurveSegment",IFCAXIS2PLACEMENTLINEAR:"IfcAxis2PlacementLinear",IFCSEGMENT:"IfcSegment",IFCPOINTBYDISTANCEEXPRESSION:"IfcPointByDistanceExpression",IFCOPENCROSSPROFILEDEF:"IfcOpenCrossProfileDef",IFCLINEARPLACEMENT:"IfcLinearPlacement",IFCALIGNMENTHORIZONTALSEGMENT:"IfcAlignmentHorizontalSegment",IFCALIGNMENTCANTSEGMENT:"IfcAlignmentCantSegment",IFCTEXTURECOORDINATEINDICESWITHVOIDS:"IfcTextureCoordinateIndicesWithVoids",IFCTEXTURECOORDINATEINDICES:"IfcTextureCoordinateIndices",IFCQUANTITYNUMBER:"IfcQuantityNumber",IFCALIGNMENTVERTICALSEGMENT:"IfcAlignmentVerticalSegment",IFCALIGNMENTPARAMETERSEGMENT:"IfcAlignmentParameterSegment",IFCCONTROLLER:"IfcController",IFCALARM:"IfcAlarm",IFCACTUATOR:"IfcActuator",IFCUNITARYCONTROLELEMENT:"IfcUnitaryControlElement",IFCSENSOR:"IfcSensor",IFCPROTECTIVEDEVICETRIPPINGUNIT:"IfcProtectiveDeviceTrippingUnit",IFCFLOWINSTRUMENT:"IfcFlowInstrument",IFCFIRESUPPRESSIONTERMINAL:"IfcFireSuppressionTerminal",IFCFILTER:"IfcFilter",IFCFAN:"IfcFan",IFCELECTRICTIMECONTROL:"IfcElectricTimeControl",IFCELECTRICMOTOR:"IfcElectricMotor",IFCELECTRICGENERATOR:"IfcElectricGenerator",IFCELECTRICFLOWSTORAGEDEVICE:"IfcElectricFlowStorageDevice",IFCELECTRICDISTRIBUTIONBOARD:"IfcElectricDistributionBoard",IFCELECTRICAPPLIANCE:"IfcElectricAppliance",IFCDUCTSILENCER:"IfcDuctSilencer",IFCDUCTSEGMENT:"IfcDuctSegment",IFCDUCTFITTING:"IfcDuctFitting",IFCDISTRIBUTIONCIRCUIT:"IfcDistributionCircuit",IFCDAMPER:"IfcDamper",IFCCOOLINGTOWER:"IfcCoolingTower",IFCCOOLEDBEAM:"IfcCooledBeam",IFCCONDENSER:"IfcCondenser",IFCCOMPRESSOR:"IfcCompressor",IFCCOMMUNICATIONSAPPLIANCE:"IfcCommunicationsAppliance",IFCCOIL:"IfcCoil",IFCCHILLER:"IfcChiller",IFCCABLESEGMENT:"IfcCableSegment",IFCCABLEFITTING:"IfcCableFitting",IFCCABLECARRIERSEGMENT:"IfcCableCarrierSegment",IFCCABLECARRIERFITTING:"IfcCableCarrierFitting",IFCBURNER:"IfcBurner",IFCBOILER:"IfcBoiler",IFCBEAMSTANDARDCASE:"IfcBeamStandardCase",IFCAUDIOVISUALAPPLIANCE:"IfcAudioVisualAppliance",IFCAIRTOAIRHEATRECOVERY:"IfcAirToAirHeatRecovery",IFCAIRTERMINALBOX:"IfcAirTerminalBox",IFCAIRTERMINAL:"IfcAirTerminal",IFCWINDOWSTANDARDCASE:"IfcWindowStandardCase",IFCWASTETERMINAL:"IfcWasteTerminal",IFCWALLELEMENTEDCASE:"IfcWallElementedCase",IFCVALVE:"IfcValve",IFCUNITARYEQUIPMENT:"IfcUnitaryEquipment",IFCUNITARYCONTROLELEMENTTYPE:"IfcUnitaryControlElementType",IFCTUBEBUNDLE:"IfcTubeBundle",IFCTRANSFORMER:"IfcTransformer",IFCTANK:"IfcTank",IFCSWITCHINGDEVICE:"IfcSwitchingDevice",IFCSTRUCTURALLOADCASE:"IfcStructuralLoadCase",IFCSTACKTERMINAL:"IfcStackTerminal",IFCSPACEHEATER:"IfcSpaceHeater",IFCSOLARDEVICE:"IfcSolarDevice",IFCSLABSTANDARDCASE:"IfcSlabStandardCase",IFCSLABELEMENTEDCASE:"IfcSlabElementedCase",IFCSHADINGDEVICE:"IfcShadingDevice",IFCSANITARYTERMINAL:"IfcSanitaryTerminal",IFCREINFORCINGBARTYPE:"IfcReinforcingBarType",IFCRATIONALBSPLINECURVEWITHKNOTS:"IfcRationalBSplineCurveWithKnots",IFCPUMP:"IfcPump",IFCPROTECTIVEDEVICETRIPPINGUNITTYPE:"IfcProtectiveDeviceTrippingUnitType",IFCPROTECTIVEDEVICE:"IfcProtectiveDevice",IFCPLATESTANDARDCASE:"IfcPlateStandardCase",IFCPIPESEGMENT:"IfcPipeSegment",IFCPIPEFITTING:"IfcPipeFitting",IFCOUTLET:"IfcOutlet",IFCOUTERBOUNDARYCURVE:"IfcOuterBoundaryCurve",IFCMOTORCONNECTION:"IfcMotorConnection",IFCMEMBERSTANDARDCASE:"IfcMemberStandardCase",IFCMEDICALDEVICE:"IfcMedicalDevice",IFCLIGHTFIXTURE:"IfcLightFixture",IFCLAMP:"IfcLamp",IFCJUNCTIONBOX:"IfcJunctionBox",IFCINTERCEPTOR:"IfcInterceptor",IFCHUMIDIFIER:"IfcHumidifier",IFCHEATEXCHANGER:"IfcHeatExchanger",IFCFLOWMETER:"IfcFlowMeter",IFCEXTERNALSPATIALELEMENT:"IfcExternalSpatialElement",IFCEVAPORATOR:"IfcEvaporator",IFCEVAPORATIVECOOLER:"IfcEvaporativeCooler",IFCENGINE:"IfcEngine",IFCELECTRICDISTRIBUTIONBOARDTYPE:"IfcElectricDistributionBoardType",IFCDOORSTANDARDCASE:"IfcDoorStandardCase",IFCDISTRIBUTIONSYSTEM:"IfcDistributionSystem",IFCCOMMUNICATIONSAPPLIANCETYPE:"IfcCommunicationsApplianceType",IFCCOLUMNSTANDARDCASE:"IfcColumnStandardCase",IFCCIVILELEMENT:"IfcCivilElement",IFCCHIMNEY:"IfcChimney",IFCCABLEFITTINGTYPE:"IfcCableFittingType",IFCBURNERTYPE:"IfcBurnerType",IFCBUILDINGSYSTEM:"IfcBuildingSystem",IFCBUILDINGELEMENTPARTTYPE:"IfcBuildingElementPartType",IFCBOUNDARYCURVE:"IfcBoundaryCurve",IFCBSPLINECURVEWITHKNOTS:"IfcBSplineCurveWithKnots",IFCAUDIOVISUALAPPLIANCETYPE:"IfcAudioVisualApplianceType",IFCWORKCALENDAR:"IfcWorkCalendar",IFCWINDOWTYPE:"IfcWindowType",IFCVOIDINGFEATURE:"IfcVoidingFeature",IFCVIBRATIONISOLATOR:"IfcVibrationIsolator",IFCTENDONTYPE:"IfcTendonType",IFCTENDONANCHORTYPE:"IfcTendonAnchorType",IFCSYSTEMFURNITUREELEMENT:"IfcSystemFurnitureElement",IFCSURFACEFEATURE:"IfcSurfaceFeature",IFCSTRUCTURALSURFACEACTION:"IfcStructuralSurfaceAction",IFCSTRUCTURALCURVEREACTION:"IfcStructuralCurveReaction",IFCSTRUCTURALCURVEACTION:"IfcStructuralCurveAction",IFCSTAIRTYPE:"IfcStairType",IFCSOLARDEVICETYPE:"IfcSolarDeviceType",IFCSHADINGDEVICETYPE:"IfcShadingDeviceType",IFCSEAMCURVE:"IfcSeamCurve",IFCROOFTYPE:"IfcRoofType",IFCREINFORCINGMESHTYPE:"IfcReinforcingMeshType",IFCREINFORCINGELEMENTTYPE:"IfcReinforcingElementType",IFCRATIONALBSPLINESURFACEWITHKNOTS:"IfcRationalBSplineSurfaceWithKnots",IFCRAMPTYPE:"IfcRampType",IFCPOLYGONALFACESET:"IfcPolygonalFaceSet",IFCPILETYPE:"IfcPileType",IFCOPENINGSTANDARDCASE:"IfcOpeningStandardCase",IFCMEDICALDEVICETYPE:"IfcMedicalDeviceType",IFCINTERSECTIONCURVE:"IfcIntersectionCurve",IFCINTERCEPTORTYPE:"IfcInterceptorType",IFCINDEXEDPOLYCURVE:"IfcIndexedPolyCurve",IFCGEOGRAPHICELEMENT:"IfcGeographicElement",IFCFURNITURE:"IfcFurniture",IFCFOOTINGTYPE:"IfcFootingType",IFCEXTERNALSPATIALSTRUCTUREELEMENT:"IfcExternalSpatialStructureElement",IFCEVENT:"IfcEvent",IFCENGINETYPE:"IfcEngineType",IFCELEMENTASSEMBLYTYPE:"IfcElementAssemblyType",IFCDOORTYPE:"IfcDoorType",IFCCYLINDRICALSURFACE:"IfcCylindricalSurface",IFCCONSTRUCTIONPRODUCTRESOURCETYPE:"IfcConstructionProductResourceType",IFCCONSTRUCTIONMATERIALRESOURCETYPE:"IfcConstructionMaterialResourceType",IFCCONSTRUCTIONEQUIPMENTRESOURCETYPE:"IfcConstructionEquipmentResourceType",IFCCOMPOSITECURVEONSURFACE:"IfcCompositeCurveOnSurface",IFCCOMPLEXPROPERTYTEMPLATE:"IfcComplexPropertyTemplate",IFCCIVILELEMENTTYPE:"IfcCivilElementType",IFCCHIMNEYTYPE:"IfcChimneyType",IFCBSPLINESURFACEWITHKNOTS:"IfcBSplineSurfaceWithKnots",IFCBSPLINESURFACE:"IfcBSplineSurface",IFCADVANCEDBREPWITHVOIDS:"IfcAdvancedBrepWithVoids",IFCADVANCEDBREP:"IfcAdvancedBrep",IFCTRIANGULATEDFACESET:"IfcTriangulatedFaceSet",IFCTOROIDALSURFACE:"IfcToroidalSurface",IFCTESSELLATEDFACESET:"IfcTessellatedFaceSet",IFCTASKTYPE:"IfcTaskType",IFCSURFACECURVE:"IfcSurfaceCurve",IFCSUBCONTRACTRESOURCETYPE:"IfcSubContractResourceType",IFCSTRUCTURALSURFACEREACTION:"IfcStructuralSurfaceReaction",IFCSPHERICALSURFACE:"IfcSphericalSurface",IFCSPATIALZONETYPE:"IfcSpatialZoneType",IFCSPATIALZONE:"IfcSpatialZone",IFCSPATIALELEMENTTYPE:"IfcSpatialElementType",IFCSPATIALELEMENT:"IfcSpatialElement",IFCSIMPLEPROPERTYTEMPLATE:"IfcSimplePropertyTemplate",IFCREVOLVEDAREASOLIDTAPERED:"IfcRevolvedAreaSolidTapered",IFCREPARAMETRISEDCOMPOSITECURVESEGMENT:"IfcReparametrisedCompositeCurveSegment",IFCRELSPACEBOUNDARY2NDLEVEL:"IfcRelSpaceBoundary2ndLevel",IFCRELSPACEBOUNDARY1STLEVEL:"IfcRelSpaceBoundary1stLevel",IFCRELINTERFERESELEMENTS:"IfcRelInterferesElements",IFCRELDEFINESBYTEMPLATE:"IfcRelDefinesByTemplate",IFCRELDEFINESBYOBJECT:"IfcRelDefinesByObject",IFCRELDECLARES:"IfcRelDeclares",IFCRELASSIGNSTOGROUPBYFACTOR:"IfcRelAssignsToGroupByFactor",IFCPROPERTYTEMPLATE:"IfcPropertyTemplate",IFCPROPERTYSETTEMPLATE:"IfcPropertySetTemplate",IFCPROJECTLIBRARY:"IfcProjectLibrary",IFCPROCEDURETYPE:"IfcProcedureType",IFCPREDEFINEDPROPERTYSET:"IfcPredefinedPropertySet",IFCPCURVE:"IfcPCurve",IFCLABORRESOURCETYPE:"IfcLaborResourceType",IFCINDEXEDPOLYGONALFACEWITHVOIDS:"IfcIndexedPolygonalFaceWithVoids",IFCINDEXEDPOLYGONALFACE:"IfcIndexedPolygonalFace",IFCGEOGRAPHICELEMENTTYPE:"IfcGeographicElementType",IFCFIXEDREFERENCESWEPTAREASOLID:"IfcFixedReferenceSweptAreaSolid",IFCEXTRUDEDAREASOLIDTAPERED:"IfcExtrudedAreaSolidTapered",IFCEVENTTYPE:"IfcEventType",IFCCURVEBOUNDEDSURFACE:"IfcCurveBoundedSurface",IFCCREWRESOURCETYPE:"IfcCrewResourceType",IFCCONTEXT:"IfcContext",IFCCONSTRUCTIONRESOURCETYPE:"IfcConstructionResourceType",IFCCARTESIANPOINTLIST3D:"IfcCartesianPointList3D",IFCCARTESIANPOINTLIST2D:"IfcCartesianPointList2D",IFCCARTESIANPOINTLIST:"IfcCartesianPointList",IFCADVANCEDFACE:"IfcAdvancedFace",IFCTYPERESOURCE:"IfcTypeResource",IFCTYPEPROCESS:"IfcTypeProcess",IFCTESSELLATEDITEM:"IfcTessellatedItem",IFCSWEPTDISKSOLIDPOLYGONAL:"IfcSweptDiskSolidPolygonal",IFCRESOURCETIME:"IfcResourceTime",IFCRESOURCECONSTRAINTRELATIONSHIP:"IfcResourceConstraintRelationship",IFCRESOURCEAPPROVALRELATIONSHIP:"IfcResourceApprovalRelationship",IFCQUANTITYSET:"IfcQuantitySet",IFCPROPERTYTEMPLATEDEFINITION:"IfcPropertyTemplateDefinition",IFCPREDEFINEDPROPERTIES:"IfcPredefinedProperties",IFCMIRROREDPROFILEDEF:"IfcMirroredProfileDef",IFCMATERIALRELATIONSHIP:"IfcMaterialRelationship",IFCMATERIALPROFILESETUSAGETAPERING:"IfcMaterialProfileSetUsageTapering",IFCMATERIALPROFILESETUSAGE:"IfcMaterialProfileSetUsage",IFCMATERIALCONSTITUENTSET:"IfcMaterialConstituentSet",IFCMATERIALCONSTITUENT:"IfcMaterialConstituent",IFCLAGTIME:"IfcLagTime",IFCINDEXEDTRIANGLETEXTUREMAP:"IfcIndexedTriangleTextureMap",IFCINDEXEDTEXTUREMAP:"IfcIndexedTextureMap",IFCINDEXEDCOLOURMAP:"IfcIndexedColourMap",IFCEXTERNALREFERENCERELATIONSHIP:"IfcExternalReferenceRelationship",IFCEXTENDEDPROPERTIES:"IfcExtendedProperties",IFCEVENTTIME:"IfcEventTime",IFCCONVERSIONBASEDUNITWITHOFFSET:"IfcConversionBasedUnitWithOffset",IFCCOLOURRGBLIST:"IfcColourRgbList",IFCWORKTIME:"IfcWorkTime",IFCTIMEPERIOD:"IfcTimePeriod",IFCTEXTUREVERTEXLIST:"IfcTextureVertexList",IFCTASKTIMERECURRING:"IfcTaskTimeRecurring",IFCTASKTIME:"IfcTaskTime",IFCTABLECOLUMN:"IfcTableColumn",IFCSURFACEREINFORCEMENTAREA:"IfcSurfaceReinforcementArea",IFCSTRUCTURALLOADORRESULT:"IfcStructuralLoadOrResult",IFCSTRUCTURALLOADCONFIGURATION:"IfcStructuralLoadConfiguration",IFCSCHEDULINGTIME:"IfcSchedulingTime",IFCRESOURCELEVELRELATIONSHIP:"IfcResourceLevelRelationship",IFCREFERENCE:"IfcReference",IFCRECURRENCEPATTERN:"IfcRecurrencePattern",IFCPROPERTYABSTRACTION:"IfcPropertyAbstraction",IFCPROJECTEDCRS:"IfcProjectedCrs",IFCPRESENTATIONITEM:"IfcPresentationItem",IFCMATERIALUSAGEDEFINITION:"IfcMaterialUsageDefinition",IFCMATERIALPROFILEWITHOFFSETS:"IfcMaterialProfileWithOffsets",IFCMATERIALPROFILESET:"IfcMaterialProfileSet",IFCMATERIALPROFILE:"IfcMaterialProfile",IFCMATERIALLAYERWITHOFFSETS:"IfcMaterialLayerWithOffsets",IFCMATERIALDEFINITION:"IfcMaterialDefinition",IFCMAPCONVERSION:"IfcMapConversion",IFCEXTERNALINFORMATION:"IfcExternalInformation",IFCCOORDINATEREFERENCESYSTEM:"IfcCoordinateReferenceSystem",IFCCOORDINATEOPERATION:"IfcCoordinateOperation",IFCCONNECTIONVOLUMEGEOMETRY:"IfcConnectionVolumeGeometry",IFCREINFORCINGBAR:"IfcReinforcingBar",IFCELECTRICDISTRIBUTIONPOINT:"IfcElectricDistributionPoint",IFCDISTRIBUTIONCONTROLELEMENT:"IfcDistributionControlElement",IFCDISTRIBUTIONCHAMBERELEMENT:"IfcDistributionChamberElement",IFCCONTROLLERTYPE:"IfcControllerType",IFCCHAMFEREDGEFEATURE:"IfcChamferEdgeFeature",IFCBEAM:"IfcBeam",IFCALARMTYPE:"IfcAlarmType",IFCACTUATORTYPE:"IfcActuatorType",IFCWINDOW:"IfcWindow",IFCWALLSTANDARDCASE:"IfcWallStandardCase",IFCWALL:"IfcWall",IFCVIBRATIONISOLATORTYPE:"IfcVibrationIsolatorType",IFCTENDONANCHOR:"IfcTendonAnchor",IFCTENDON:"IfcTendon",IFCSTRUCTURALANALYSISMODEL:"IfcStructuralAnalysisModel",IFCSTAIRFLIGHT:"IfcStairFlight",IFCSTAIR:"IfcStair",IFCSLAB:"IfcSlab",IFCSENSORTYPE:"IfcSensorType",IFCROUNDEDEDGEFEATURE:"IfcRoundedEdgeFeature",IFCROOF:"IfcRoof",IFCREINFORCINGMESH:"IfcReinforcingMesh",IFCREINFORCINGELEMENT:"IfcReinforcingElement",IFCRATIONALBEZIERCURVE:"IfcRationalBezierCurve",IFCRAMPFLIGHT:"IfcRampFlight",IFCRAMP:"IfcRamp",IFCRAILING:"IfcRailing",IFCPLATE:"IfcPlate",IFCPILE:"IfcPile",IFCMEMBER:"IfcMember",IFCFOOTING:"IfcFooting",IFCFLOWTREATMENTDEVICE:"IfcFlowTreatmentDevice",IFCFLOWTERMINAL:"IfcFlowTerminal",IFCFLOWSTORAGEDEVICE:"IfcFlowStorageDevice",IFCFLOWSEGMENT:"IfcFlowSegment",IFCFLOWMOVINGDEVICE:"IfcFlowMovingDevice",IFCFLOWINSTRUMENTTYPE:"IfcFlowInstrumentType",IFCFLOWFITTING:"IfcFlowFitting",IFCFLOWCONTROLLER:"IfcFlowController",IFCFIRESUPPRESSIONTERMINALTYPE:"IfcFireSuppressionTerminalType",IFCFILTERTYPE:"IfcFilterType",IFCFANTYPE:"IfcFanType",IFCENERGYCONVERSIONDEVICE:"IfcEnergyConversionDevice",IFCELECTRICALELEMENT:"IfcElectricalElement",IFCELECTRICALCIRCUIT:"IfcElectricalCircuit",IFCELECTRICTIMECONTROLTYPE:"IfcElectricTimeControlType",IFCELECTRICMOTORTYPE:"IfcElectricMotorType",IFCELECTRICHEATERTYPE:"IfcElectricHeaterType",IFCELECTRICGENERATORTYPE:"IfcElectricGeneratorType",IFCELECTRICFLOWSTORAGEDEVICETYPE:"IfcElectricFlowStorageDeviceType",IFCELECTRICAPPLIANCETYPE:"IfcElectricApplianceType",IFCEDGEFEATURE:"IfcEdgeFeature",IFCDUCTSILENCERTYPE:"IfcDuctSilencerType",IFCDUCTSEGMENTTYPE:"IfcDuctSegmentType",IFCDUCTFITTINGTYPE:"IfcDuctFittingType",IFCDOOR:"IfcDoor",IFCDISTRIBUTIONPORT:"IfcDistributionPort",IFCDISTRIBUTIONFLOWELEMENT:"IfcDistributionFlowElement",IFCDISTRIBUTIONELEMENT:"IfcDistributionElement",IFCDISTRIBUTIONCONTROLELEMENTTYPE:"IfcDistributionControlElementType",IFCDISTRIBUTIONCHAMBERELEMENTTYPE:"IfcDistributionChamberElementType",IFCDISCRETEACCESSORYTYPE:"IfcDiscreteAccessoryType",IFCDISCRETEACCESSORY:"IfcDiscreteAccessory",IFCDIAMETERDIMENSION:"IfcDiameterDimension",IFCDAMPERTYPE:"IfcDamperType",IFCCURTAINWALL:"IfcCurtainWall",IFCCOVERING:"IfcCovering",IFCCOOLINGTOWERTYPE:"IfcCoolingTowerType",IFCCOOLEDBEAMTYPE:"IfcCooledBeamType",IFCCONSTRUCTIONPRODUCTRESOURCE:"IfcConstructionProductResource",IFCCONSTRUCTIONMATERIALRESOURCE:"IfcConstructionMaterialResource",IFCCONSTRUCTIONEQUIPMENTRESOURCE:"IfcConstructionEquipmentResource",IFCCONDITIONCRITERION:"IfcConditionCriterion",IFCCONDITION:"IfcCondition",IFCCONDENSERTYPE:"IfcCondenserType",IFCCOMPRESSORTYPE:"IfcCompressorType",IFCCOLUMN:"IfcColumn",IFCCOILTYPE:"IfcCoilType",IFCCIRCLE:"IfcCircle",IFCCHILLERTYPE:"IfcChillerType",IFCCABLESEGMENTTYPE:"IfcCableSegmentType",IFCCABLECARRIERSEGMENTTYPE:"IfcCableCarrierSegmentType",IFCCABLECARRIERFITTINGTYPE:"IfcCableCarrierFittingType",IFCBUILDINGELEMENTPROXYTYPE:"IfcBuildingElementProxyType",IFCBUILDINGELEMENTPROXY:"IfcBuildingElementProxy",IFCBUILDINGELEMENTPART:"IfcBuildingElementPart",IFCBUILDINGELEMENTCOMPONENT:"IfcBuildingElementComponent",IFCBUILDINGELEMENT:"IfcBuildingElement",IFCBOILERTYPE:"IfcBoilerType",IFCBEZIERCURVE:"IfcBezierCurve",IFCBEAMTYPE:"IfcBeamType",IFCBSPLINECURVE:"IfcBSplineCurve",IFCASSET:"IfcAsset",IFCANGULARDIMENSION:"IfcAngularDimension",IFCAIRTOAIRHEATRECOVERYTYPE:"IfcAirToAirHeatRecoveryType",IFCAIRTERMINALTYPE:"IfcAirTerminalType",IFCAIRTERMINALBOXTYPE:"IfcAirTerminalBoxType",IFCACTIONREQUEST:"IfcActionRequest",IFC2DCOMPOSITECURVE:"Ifc2DCompositeCurve",IFCZONE:"IfcZone",IFCWORKSCHEDULE:"IfcWorkSchedule",IFCWORKPLAN:"IfcWorkPlan",IFCWORKCONTROL:"IfcWorkControl",IFCWASTETERMINALTYPE:"IfcWasteTerminalType",IFCWALLTYPE:"IfcWallType",IFCVIRTUALELEMENT:"IfcVirtualElement",IFCVALVETYPE:"IfcValveType",IFCUNITARYEQUIPMENTTYPE:"IfcUnitaryEquipmentType",IFCTUBEBUNDLETYPE:"IfcTubeBundleType",IFCTRIMMEDCURVE:"IfcTrimmedCurve",IFCTRANSPORTELEMENT:"IfcTransportElement",IFCTRANSFORMERTYPE:"IfcTransformerType",IFCTIMESERIESSCHEDULE:"IfcTimeSeriesSchedule",IFCTANKTYPE:"IfcTankType",IFCSYSTEM:"IfcSystem",IFCSWITCHINGDEVICETYPE:"IfcSwitchingDeviceType",IFCSUBCONTRACTRESOURCE:"IfcSubContractResource",IFCSTRUCTURALSURFACECONNECTION:"IfcStructuralSurfaceConnection",IFCSTRUCTURALRESULTGROUP:"IfcStructuralResultGroup",IFCSTRUCTURALPOINTREACTION:"IfcStructuralPointReaction",IFCSTRUCTURALPOINTCONNECTION:"IfcStructuralPointConnection",IFCSTRUCTURALPOINTACTION:"IfcStructuralPointAction",IFCSTRUCTURALPLANARACTIONVARYING:"IfcStructuralPlanarActionVarying",IFCSTRUCTURALPLANARACTION:"IfcStructuralPlanarAction",IFCSTRUCTURALLOADGROUP:"IfcStructuralLoadGroup",IFCSTRUCTURALLINEARACTIONVARYING:"IfcStructuralLinearActionVarying",IFCSTRUCTURALLINEARACTION:"IfcStructuralLinearAction",IFCSTRUCTURALCURVEMEMBERVARYING:"IfcStructuralCurveMemberVarying",IFCSTRUCTURALCURVEMEMBER:"IfcStructuralCurveMember",IFCSTRUCTURALCURVECONNECTION:"IfcStructuralCurveConnection",IFCSTRUCTURALCONNECTION:"IfcStructuralConnection",IFCSTRUCTURALACTION:"IfcStructuralAction",IFCSTAIRFLIGHTTYPE:"IfcStairFlightType",IFCSTACKTERMINALTYPE:"IfcStackTerminalType",IFCSPACETYPE:"IfcSpaceType",IFCSPACEPROGRAM:"IfcSpaceProgram",IFCSPACEHEATERTYPE:"IfcSpaceHeaterType",IFCSPACE:"IfcSpace",IFCSLABTYPE:"IfcSlabType",IFCSITE:"IfcSite",IFCSERVICELIFE:"IfcServiceLife",IFCSCHEDULETIMECONTROL:"IfcScheduleTimeControl",IFCSANITARYTERMINALTYPE:"IfcSanitaryTerminalType",IFCRELASSIGNSTASKS:"IfcRelAssignsTasks",IFCRELAGGREGATES:"IfcRelAggregates",IFCRAMPFLIGHTTYPE:"IfcRampFlightType",IFCRAILINGTYPE:"IfcRailingType",IFCRADIUSDIMENSION:"IfcRadiusDimension",IFCPUMPTYPE:"IfcPumpType",IFCPROTECTIVEDEVICETYPE:"IfcProtectiveDeviceType",IFCPROJECTIONELEMENT:"IfcProjectionElement",IFCPROJECTORDERRECORD:"IfcProjectOrderRecord",IFCPROJECTORDER:"IfcProjectOrder",IFCPROCEDURE:"IfcProcedure",IFCPORT:"IfcPort",IFCPOLYLINE:"IfcPolyline",IFCPLATETYPE:"IfcPlateType",IFCPIPESEGMENTTYPE:"IfcPipeSegmentType",IFCPIPEFITTINGTYPE:"IfcPipeFittingType",IFCPERMIT:"IfcPermit",IFCPERFORMANCEHISTORY:"IfcPerformanceHistory",IFCOUTLETTYPE:"IfcOutletType",IFCORDERACTION:"IfcOrderAction",IFCOPENINGELEMENT:"IfcOpeningElement",IFCOCCUPANT:"IfcOccupant",IFCMOVE:"IfcMove",IFCMOTORCONNECTIONTYPE:"IfcMotorConnectionType",IFCMEMBERTYPE:"IfcMemberType",IFCMECHANICALFASTENERTYPE:"IfcMechanicalFastenerType",IFCMECHANICALFASTENER:"IfcMechanicalFastener",IFCLINEARDIMENSION:"IfcLinearDimension",IFCLIGHTFIXTURETYPE:"IfcLightFixtureType",IFCLAMPTYPE:"IfcLampType",IFCLABORRESOURCE:"IfcLaborResource",IFCJUNCTIONBOXTYPE:"IfcJunctionBoxType",IFCINVENTORY:"IfcInventory",IFCHUMIDIFIERTYPE:"IfcHumidifierType",IFCHEATEXCHANGERTYPE:"IfcHeatExchangerType",IFCGROUP:"IfcGroup",IFCGRID:"IfcGrid",IFCGASTERMINALTYPE:"IfcGasTerminalType",IFCFURNITURESTANDARD:"IfcFurnitureStandard",IFCFURNISHINGELEMENT:"IfcFurnishingElement",IFCFLOWTREATMENTDEVICETYPE:"IfcFlowTreatmentDeviceType",IFCFLOWTERMINALTYPE:"IfcFlowTerminalType",IFCFLOWSTORAGEDEVICETYPE:"IfcFlowStorageDeviceType",IFCFLOWSEGMENTTYPE:"IfcFlowSegmentType",IFCFLOWMOVINGDEVICETYPE:"IfcFlowMovingDeviceType",IFCFLOWMETERTYPE:"IfcFlowMeterType",IFCFLOWFITTINGTYPE:"IfcFlowFittingType",IFCFLOWCONTROLLERTYPE:"IfcFlowControllerType",IFCFEATUREELEMENTSUBTRACTION:"IfcFeatureElementSubtraction",IFCFEATUREELEMENTADDITION:"IfcFeatureElementAddition",IFCFEATUREELEMENT:"IfcFeatureElement",IFCFASTENERTYPE:"IfcFastenerType",IFCFASTENER:"IfcFastener",IFCFACETEDBREPWITHVOIDS:"IfcFacetedBrepWithVoids",IFCFACETEDBREP:"IfcFacetedBrep",IFCEVAPORATORTYPE:"IfcEvaporatorType",IFCEVAPORATIVECOOLERTYPE:"IfcEvaporativeCoolerType",IFCEQUIPMENTSTANDARD:"IfcEquipmentStandard",IFCEQUIPMENTELEMENT:"IfcEquipmentElement",IFCENERGYCONVERSIONDEVICETYPE:"IfcEnergyConversionDeviceType",IFCELLIPSE:"IfcEllipse",IFCELEMENTCOMPONENTTYPE:"IfcElementComponentType",IFCELEMENTCOMPONENT:"IfcElementComponent",IFCELEMENTASSEMBLY:"IfcElementAssembly",IFCELEMENT:"IfcElement",IFCELECTRICALBASEPROPERTIES:"IfcElectricalBaseProperties",IFCDISTRIBUTIONFLOWELEMENTTYPE:"IfcDistributionFlowElementType",IFCDISTRIBUTIONELEMENTTYPE:"IfcDistributionElementType",IFCDIMENSIONCURVEDIRECTEDCALLOUT:"IfcDimensionCurveDirectedCallout",IFCCURTAINWALLTYPE:"IfcCurtainWallType",IFCCREWRESOURCE:"IfcCrewResource",IFCCOVERINGTYPE:"IfcCoveringType",IFCCOSTSCHEDULE:"IfcCostSchedule",IFCCOSTITEM:"IfcCostItem",IFCCONTROL:"IfcControl",IFCCONSTRUCTIONRESOURCE:"IfcConstructionResource",IFCCONIC:"IfcConic",IFCCOMPOSITECURVE:"IfcCompositeCurve",IFCCOLUMNTYPE:"IfcColumnType",IFCCIRCLEHOLLOWPROFILEDEF:"IfcCircleHollowProfileDef",IFCBUILDINGSTOREY:"IfcBuildingStorey",IFCBUILDINGELEMENTTYPE:"IfcBuildingElementType",IFCBUILDING:"IfcBuilding",IFCBOUNDEDCURVE:"IfcBoundedCurve",IFCBOOLEANCLIPPINGRESULT:"IfcBooleanClippingResult",IFCBLOCK:"IfcBlock",IFCASYMMETRICISHAPEPROFILEDEF:"IfcAsymmetricIShapeProfileDef",IFCANNOTATION:"IfcAnnotation",IFCACTOR:"IfcActor",IFCTRANSPORTELEMENTTYPE:"IfcTransportElementType",IFCTASK:"IfcTask",IFCSYSTEMFURNITUREELEMENTTYPE:"IfcSystemFurnitureElementType",IFCSURFACEOFREVOLUTION:"IfcSurfaceOfRevolution",IFCSURFACEOFLINEAREXTRUSION:"IfcSurfaceOfLinearExtrusion",IFCSURFACECURVESWEPTAREASOLID:"IfcSurfaceCurveSweptAreaSolid",IFCSTRUCTUREDDIMENSIONCALLOUT:"IfcStructuredDimensionCallout",IFCSTRUCTURALSURFACEMEMBERVARYING:"IfcStructuralSurfaceMemberVarying",IFCSTRUCTURALSURFACEMEMBER:"IfcStructuralSurfaceMember",IFCSTRUCTURALREACTION:"IfcStructuralReaction",IFCSTRUCTURALMEMBER:"IfcStructuralMember",IFCSTRUCTURALITEM:"IfcStructuralItem",IFCSTRUCTURALACTIVITY:"IfcStructuralActivity",IFCSPHERE:"IfcSphere",IFCSPATIALSTRUCTUREELEMENTTYPE:"IfcSpatialStructureElementType",IFCSPATIALSTRUCTUREELEMENT:"IfcSpatialStructureElement",IFCRIGHTCIRCULARCYLINDER:"IfcRightCircularCylinder",IFCRIGHTCIRCULARCONE:"IfcRightCircularCone",IFCREVOLVEDAREASOLID:"IfcRevolvedAreaSolid",IFCRESOURCE:"IfcResource",IFCRELVOIDSELEMENT:"IfcRelVoidsElement",IFCRELSPACEBOUNDARY:"IfcRelSpaceBoundary",IFCRELSERVICESBUILDINGS:"IfcRelServicesBuildings",IFCRELSEQUENCE:"IfcRelSequence",IFCRELSCHEDULESCOSTITEMS:"IfcRelSchedulesCostItems",IFCRELREFERENCEDINSPATIALSTRUCTURE:"IfcRelReferencedInSpatialStructure",IFCRELPROJECTSELEMENT:"IfcRelProjectsElement",IFCRELOVERRIDESPROPERTIES:"IfcRelOverridesProperties",IFCRELOCCUPIESSPACES:"IfcRelOccupiesSpaces",IFCRELNESTS:"IfcRelNests",IFCRELINTERACTIONREQUIREMENTS:"IfcRelInteractionRequirements",IFCRELFLOWCONTROLELEMENTS:"IfcRelFlowControlElements",IFCRELFILLSELEMENT:"IfcRelFillsElement",IFCRELDEFINESBYTYPE:"IfcRelDefinesByType",IFCRELDEFINESBYPROPERTIES:"IfcRelDefinesByProperties",IFCRELDEFINES:"IfcRelDefines",IFCRELDECOMPOSES:"IfcRelDecomposes",IFCRELCOVERSSPACES:"IfcRelCoversSpaces",IFCRELCOVERSBLDGELEMENTS:"IfcRelCoversBldgElements",IFCRELCONTAINEDINSPATIALSTRUCTURE:"IfcRelContainedInSpatialStructure",IFCRELCONNECTSWITHREALIZINGELEMENTS:"IfcRelConnectsWithRealizingElements",IFCRELCONNECTSWITHECCENTRICITY:"IfcRelConnectsWithEccentricity",IFCRELCONNECTSSTRUCTURALMEMBER:"IfcRelConnectsStructuralMember",IFCRELCONNECTSSTRUCTURALELEMENT:"IfcRelConnectsStructuralElement",IFCRELCONNECTSSTRUCTURALACTIVITY:"IfcRelConnectsStructuralActivity",IFCRELCONNECTSPORTS:"IfcRelConnectsPorts",IFCRELCONNECTSPORTTOELEMENT:"IfcRelConnectsPortToElement",IFCRELCONNECTSPATHELEMENTS:"IfcRelConnectsPathElements",IFCRELCONNECTSELEMENTS:"IfcRelConnectsElements",IFCRELCONNECTS:"IfcRelConnects",IFCRELASSOCIATESPROFILEPROPERTIES:"IfcRelAssociatesProfileProperties",IFCRELASSOCIATESMATERIAL:"IfcRelAssociatesMaterial",IFCRELASSOCIATESLIBRARY:"IfcRelAssociatesLibrary",IFCRELASSOCIATESDOCUMENT:"IfcRelAssociatesDocument",IFCRELASSOCIATESCONSTRAINT:"IfcRelAssociatesConstraint",IFCRELASSOCIATESCLASSIFICATION:"IfcRelAssociatesClassification",IFCRELASSOCIATESAPPROVAL:"IfcRelAssociatesApproval",IFCRELASSOCIATESAPPLIEDVALUE:"IfcRelAssociatesAppliedValue",IFCRELASSOCIATES:"IfcRelAssociates",IFCRELASSIGNSTORESOURCE:"IfcRelAssignsToResource",IFCRELASSIGNSTOPROJECTORDER:"IfcRelAssignsToProjectOrder",IFCRELASSIGNSTOPRODUCT:"IfcRelAssignsToProduct",IFCRELASSIGNSTOPROCESS:"IfcRelAssignsToProcess",IFCRELASSIGNSTOGROUP:"IfcRelAssignsToGroup",IFCRELASSIGNSTOCONTROL:"IfcRelAssignsToControl",IFCRELASSIGNSTOACTOR:"IfcRelAssignsToActor",IFCRELASSIGNS:"IfcRelAssigns",IFCRECTANGULARTRIMMEDSURFACE:"IfcRectangularTrimmedSurface",IFCRECTANGULARPYRAMID:"IfcRectangularPyramid",IFCRECTANGLEHOLLOWPROFILEDEF:"IfcRectangleHollowProfileDef",IFCPROXY:"IfcProxy",IFCPROPERTYSET:"IfcPropertySet",IFCPROJECTIONCURVE:"IfcProjectionCurve",IFCPROJECT:"IfcProject",IFCPRODUCT:"IfcProduct",IFCPROCESS:"IfcProcess",IFCPLANE:"IfcPlane",IFCPLANARBOX:"IfcPlanarBox",IFCPERMEABLECOVERINGPROPERTIES:"IfcPermeableCoveringProperties",IFCOFFSETCURVE3D:"IfcOffsetCurve3D",IFCOFFSETCURVE2D:"IfcOffsetCurve2D",IFCOBJECT:"IfcObject",IFCMANIFOLDSOLIDBREP:"IfcManifoldSolidBrep",IFCLINE:"IfcLine",IFCLSHAPEPROFILEDEF:"IfcLShapeProfileDef",IFCISHAPEPROFILEDEF:"IfcIShapeProfileDef",IFCGEOMETRICCURVESET:"IfcGeometricCurveSet",IFCFURNITURETYPE:"IfcFurnitureType",IFCFURNISHINGELEMENTTYPE:"IfcFurnishingElementType",IFCFLUIDFLOWPROPERTIES:"IfcFluidFlowProperties",IFCFILLAREASTYLETILES:"IfcFillAreaStyleTiles",IFCFILLAREASTYLETILESYMBOLWITHSTYLE:"IfcFillAreaStyleTileSymbolWithStyle",IFCFILLAREASTYLEHATCHING:"IfcFillAreaStyleHatching",IFCFACEBASEDSURFACEMODEL:"IfcFaceBasedSurfaceModel",IFCEXTRUDEDAREASOLID:"IfcExtrudedAreaSolid",IFCENERGYPROPERTIES:"IfcEnergyProperties",IFCELLIPSEPROFILEDEF:"IfcEllipseProfileDef",IFCELEMENTARYSURFACE:"IfcElementarySurface",IFCELEMENTTYPE:"IfcElementType",IFCELEMENTQUANTITY:"IfcElementQuantity",IFCEDGELOOP:"IfcEdgeLoop",IFCDRAUGHTINGPREDEFINEDCURVEFONT:"IfcDraughtingPredefinedCurveFont",IFCDRAUGHTINGPREDEFINEDCOLOUR:"IfcDraughtingPredefinedColour",IFCDRAUGHTINGCALLOUT:"IfcDraughtingCallout",IFCDOORSTYLE:"IfcDoorStyle",IFCDOORPANELPROPERTIES:"IfcDoorPanelProperties",IFCDOORLININGPROPERTIES:"IfcDoorLiningProperties",IFCDIRECTION:"IfcDirection",IFCDIMENSIONCURVETERMINATOR:"IfcDimensionCurveTerminator",IFCDIMENSIONCURVE:"IfcDimensionCurve",IFCDEFINEDSYMBOL:"IfcDefinedSymbol",IFCCURVEBOUNDEDPLANE:"IfcCurveBoundedPlane",IFCCURVE:"IfcCurve",IFCCSGSOLID:"IfcCsgSolid",IFCCSGPRIMITIVE3D:"IfcCsgPrimitive3D",IFCCRANERAILFSHAPEPROFILEDEF:"IfcCraneRailFShapeProfileDef",IFCCRANERAILASHAPEPROFILEDEF:"IfcCraneRailAShapeProfileDef",IFCCOMPOSITECURVESEGMENT:"IfcCompositeCurveSegment",IFCCLOSEDSHELL:"IfcClosedShell",IFCCIRCLEPROFILEDEF:"IfcCircleProfileDef",IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM:"IfcCartesianTransformationOperator3DNonUniform",IFCCARTESIANTRANSFORMATIONOPERATOR3D:"IfcCartesianTransformationOperator3D",IFCCARTESIANTRANSFORMATIONOPERATOR2DNONUNIFORM:"IfcCartesianTransformationOperator2DNonUniform",IFCCARTESIANTRANSFORMATIONOPERATOR2D:"IfcCartesianTransformationOperator2D",IFCCARTESIANTRANSFORMATIONOPERATOR:"IfcCartesianTransformationOperator",IFCCARTESIANPOINT:"IfcCartesianPoint",IFCCSHAPEPROFILEDEF:"IfcCShapeProfileDef",IFCBOXEDHALFSPACE:"IfcBoxedHalfSpace",IFCBOUNDINGBOX:"IfcBoundingBox",IFCBOUNDEDSURFACE:"IfcBoundedSurface",IFCBOOLEANRESULT:"IfcBooleanResult",IFCAXIS2PLACEMENT3D:"IfcAxis2Placement3D",IFCAXIS2PLACEMENT2D:"IfcAxis2Placement2D",IFCAXIS1PLACEMENT:"IfcAxis1Placement",IFCANNOTATIONSURFACE:"IfcAnnotationSurface",IFCANNOTATIONFILLAREAOCCURRENCE:"IfcAnnotationFillAreaOccurrence",IFCANNOTATIONFILLAREA:"IfcAnnotationFillArea",IFCANNOTATIONCURVEOCCURRENCE:"IfcAnnotationCurveOccurrence",IFCZSHAPEPROFILEDEF:"IfcZShapeProfileDef",IFCWINDOWSTYLE:"IfcWindowStyle",IFCWINDOWPANELPROPERTIES:"IfcWindowPanelProperties",IFCWINDOWLININGPROPERTIES:"IfcWindowLiningProperties",IFCVERTEXLOOP:"IfcVertexLoop",IFCVECTOR:"IfcVector",IFCUSHAPEPROFILEDEF:"IfcUShapeProfileDef",IFCTYPEPRODUCT:"IfcTypeProduct",IFCTYPEOBJECT:"IfcTypeObject",IFCTWODIRECTIONREPEATFACTOR:"IfcTwoDirectionRepeatFactor",IFCTRAPEZIUMPROFILEDEF:"IfcTrapeziumProfileDef",IFCTEXTLITERALWITHEXTENT:"IfcTextLiteralWithExtent",IFCTEXTLITERAL:"IfcTextLiteral",IFCTERMINATORSYMBOL:"IfcTerminatorSymbol",IFCTSHAPEPROFILEDEF:"IfcTShapeProfileDef",IFCSWEPTSURFACE:"IfcSweptSurface",IFCSWEPTDISKSOLID:"IfcSweptDiskSolid",IFCSWEPTAREASOLID:"IfcSweptAreaSolid",IFCSURFACESTYLERENDERING:"IfcSurfaceStyleRendering",IFCSURFACE:"IfcSurface",IFCSUBEDGE:"IfcSubedge",IFCSTRUCTURALSTEELPROFILEPROPERTIES:"IfcStructuralSteelProfileProperties",IFCSTRUCTURALPROFILEPROPERTIES:"IfcStructuralProfileProperties",IFCSTRUCTURALLOADSINGLEFORCEWARPING:"IfcStructuralLoadSingleForceWarping",IFCSTRUCTURALLOADSINGLEFORCE:"IfcStructuralLoadSingleForce",IFCSTRUCTURALLOADSINGLEDISPLACEMENTDISTORTION:"IfcStructuralLoadSingleDisplacementDistortion",IFCSTRUCTURALLOADSINGLEDISPLACEMENT:"IfcStructuralLoadSingleDisplacement",IFCSTRUCTURALLOADPLANARFORCE:"IfcStructuralLoadPlanarForce",IFCSTRUCTURALLOADLINEARFORCE:"IfcStructuralLoadLinearForce",IFCSPACETHERMALLOADPROPERTIES:"IfcSpaceThermalLoadProperties",IFCSOUNDVALUE:"IfcSoundValue",IFCSOUNDPROPERTIES:"IfcSoundProperties",IFCSOLIDMODEL:"IfcSolidModel",IFCSLIPPAGECONNECTIONCONDITION:"IfcSlippageConnectionCondition",IFCSHELLBASEDSURFACEMODEL:"IfcShellBasedSurfaceModel",IFCSERVICELIFEFACTOR:"IfcServiceLifeFactor",IFCSECTIONEDSPINE:"IfcSectionedSpine",IFCROUNDEDRECTANGLEPROFILEDEF:"IfcRoundedRectangleProfileDef",IFCRELATIONSHIP:"IfcRelationship",IFCREINFORCEMENTDEFINITIONPROPERTIES:"IfcReinforcementDefinitionProperties",IFCREGULARTIMESERIES:"IfcRegularTimeSeries",IFCRECTANGLEPROFILEDEF:"IfcRectangleProfileDef",IFCPROPERTYTABLEVALUE:"IfcPropertyTableValue",IFCPROPERTYSINGLEVALUE:"IfcPropertySingleValue",IFCPROPERTYSETDEFINITION:"IfcPropertySetDefinition",IFCPROPERTYREFERENCEVALUE:"IfcPropertyReferenceValue",IFCPROPERTYLISTVALUE:"IfcPropertyListValue",IFCPROPERTYENUMERATEDVALUE:"IfcPropertyEnumeratedValue",IFCPROPERTYDEFINITION:"IfcPropertyDefinition",IFCPROPERTYBOUNDEDVALUE:"IfcPropertyBoundedValue",IFCPRODUCTDEFINITIONSHAPE:"IfcProductDefinitionShape",IFCPREDEFINEDPOINTMARKERSYMBOL:"IfcPredefinedPointMarkerSymbol",IFCPREDEFINEDDIMENSIONSYMBOL:"IfcPredefinedDimensionSymbol",IFCPREDEFINEDCURVEFONT:"IfcPredefinedCurveFont",IFCPREDEFINEDCOLOUR:"IfcPredefinedColour",IFCPOLYGONALBOUNDEDHALFSPACE:"IfcPolygonalBoundedHalfSpace",IFCPOLYLOOP:"IfcPolyLoop",IFCPOINTONSURFACE:"IfcPointOnSurface",IFCPOINTONCURVE:"IfcPointOnCurve",IFCPOINT:"IfcPoint",IFCPLANAREXTENT:"IfcPlanarExtent",IFCPLACEMENT:"IfcPlacement",IFCPIXELTEXTURE:"IfcPixelTexture",IFCPHYSICALCOMPLEXQUANTITY:"IfcPhysicalComplexQuantity",IFCPATH:"IfcPath",IFCPARAMETERIZEDPROFILEDEF:"IfcParameterizedProfileDef",IFCORIENTEDEDGE:"IfcOrientedEdge",IFCOPENSHELL:"IfcOpenShell",IFCONEDIRECTIONREPEATFACTOR:"IfcOneDirectionRepeatFactor",IFCOBJECTDEFINITION:"IfcObjectDefinition",IFCMECHANICALCONCRETEMATERIALPROPERTIES:"IfcMechanicalConcreteMaterialProperties",IFCMATERIALDEFINITIONREPRESENTATION:"IfcMaterialDefinitionRepresentation",IFCMAPPEDITEM:"IfcMappedItem",IFCLOOP:"IfcLoop",IFCLOCALPLACEMENT:"IfcLocalPlacement",IFCLIGHTSOURCESPOT:"IfcLightSourceSpot",IFCLIGHTSOURCEPOSITIONAL:"IfcLightSourcePositional",IFCLIGHTSOURCEGONIOMETRIC:"IfcLightSourceGoniometric",IFCLIGHTSOURCEDIRECTIONAL:"IfcLightSourceDirectional",IFCLIGHTSOURCEAMBIENT:"IfcLightSourceAmbient",IFCLIGHTSOURCE:"IfcLightSource",IFCIRREGULARTIMESERIES:"IfcIrregularTimeSeries",IFCIMAGETEXTURE:"IfcImageTexture",IFCHYGROSCOPICMATERIALPROPERTIES:"IfcHygroscopicMaterialProperties",IFCHALFSPACESOLID:"IfcHalfSpaceSolid",IFCGRIDPLACEMENT:"IfcGridPlacement",IFCGEOMETRICSET:"IfcGeometricSet",IFCGEOMETRICREPRESENTATIONSUBCONTEXT:"IfcGeometricRepresentationSubContext",IFCGEOMETRICREPRESENTATIONITEM:"IfcGeometricRepresentationItem",IFCGEOMETRICREPRESENTATIONCONTEXT:"IfcGeometricRepresentationContext",IFCGENERALPROFILEPROPERTIES:"IfcGeneralProfileProperties",IFCGENERALMATERIALPROPERTIES:"IfcGeneralMaterialProperties",IFCFUELPROPERTIES:"IfcFuelProperties",IFCFILLAREASTYLE:"IfcFillAreaStyle",IFCFAILURECONNECTIONCONDITION:"IfcFailureConnectionCondition",IFCFACESURFACE:"IfcFaceSurface",IFCFACEOUTERBOUND:"IfcFaceOuterBound",IFCFACEBOUND:"IfcFaceBound",IFCFACE:"IfcFace",IFCEXTENDEDMATERIALPROPERTIES:"IfcExtendedMaterialProperties",IFCEDGECURVE:"IfcEdgeCurve",IFCEDGE:"IfcEdge",IFCDRAUGHTINGPREDEFINEDTEXTFONT:"IfcDraughtingPredefinedTextFont",IFCDOCUMENTREFERENCE:"IfcDocumentReference",IFCDIMENSIONPAIR:"IfcDimensionPair",IFCDIMENSIONCALLOUTRELATIONSHIP:"IfcDimensionCalloutRelationship",IFCDERIVEDPROFILEDEF:"IfcDerivedProfileDef",IFCCURVESTYLE:"IfcCurveStyle",IFCCONVERSIONBASEDUNIT:"IfcConversionBasedUnit",IFCCONTEXTDEPENDENTUNIT:"IfcContextDependentUnit",IFCCONNECTIONPOINTECCENTRICITY:"IfcConnectionPointEccentricity",IFCCONNECTIONCURVEGEOMETRY:"IfcConnectionCurveGeometry",IFCCONNECTEDFACESET:"IfcConnectedFaceSet",IFCCOMPOSITEPROFILEDEF:"IfcCompositeProfileDef",IFCCOMPLEXPROPERTY:"IfcComplexProperty",IFCCOLOURRGB:"IfcColourRgb",IFCCLASSIFICATIONREFERENCE:"IfcClassificationReference",IFCCENTERLINEPROFILEDEF:"IfcCenterLineProfileDef",IFCBLOBTEXTURE:"IfcBlobTexture",IFCARBITRARYPROFILEDEFWITHVOIDS:"IfcArbitraryProfileDefWithVoids",IFCARBITRARYOPENPROFILEDEF:"IfcArbitraryOpenProfileDef",IFCARBITRARYCLOSEDPROFILEDEF:"IfcArbitraryClosedProfileDef",IFCANNOTATIONTEXTOCCURRENCE:"IfcAnnotationTextOccurrence",IFCANNOTATIONSYMBOLOCCURRENCE:"IfcAnnotationSymbolOccurrence",IFCANNOTATIONSURFACEOCCURRENCE:"IfcAnnotationSurfaceOccurrence",IFCANNOTATIONOCCURRENCE:"IfcAnnotationOccurrence",IFCWATERPROPERTIES:"IfcWaterProperties",IFCVIRTUALGRIDINTERSECTION:"IfcVirtualGridIntersection",IFCVERTEXPOINT:"IfcVertexPoint",IFCVERTEXBASEDTEXTUREMAP:"IfcVertexBasedTextureMap",IFCVERTEX:"IfcVertex",IFCUNITASSIGNMENT:"IfcUnitAssignment",IFCTOPOLOGYREPRESENTATION:"IfcTopologyRepresentation",IFCTOPOLOGICALREPRESENTATIONITEM:"IfcTopologicalRepresentationItem",IFCTIMESERIESVALUE:"IfcTimeSeriesValue",IFCTIMESERIESREFERENCERELATIONSHIP:"IfcTimeSeriesReferenceRelationship",IFCTIMESERIES:"IfcTimeSeries",IFCTHERMALMATERIALPROPERTIES:"IfcThermalMaterialProperties",IFCTEXTUREVERTEX:"IfcTextureVertex",IFCTEXTUREMAP:"IfcTextureMap",IFCTEXTURECOORDINATEGENERATOR:"IfcTextureCoordinateGenerator",IFCTEXTURECOORDINATE:"IfcTextureCoordinate",IFCTEXTSTYLEWITHBOXCHARACTERISTICS:"IfcTextStyleWithBoxCharacteristics",IFCTEXTSTYLETEXTMODEL:"IfcTextStyleTextModel",IFCTEXTSTYLEFORDEFINEDFONT:"IfcTextStyleForDefinedFont",IFCTEXTSTYLEFONTMODEL:"IfcTextStyleFontModel",IFCTEXTSTYLE:"IfcTextStyle",IFCTELECOMADDRESS:"IfcTelecomAddress",IFCTABLEROW:"IfcTableRow",IFCTABLE:"IfcTable",IFCSYMBOLSTYLE:"IfcSymbolStyle",IFCSURFACETEXTURE:"IfcSurfaceTexture",IFCSURFACESTYLEWITHTEXTURES:"IfcSurfaceStyleWithTextures",IFCSURFACESTYLESHADING:"IfcSurfaceStyleShading",IFCSURFACESTYLEREFRACTION:"IfcSurfaceStyleRefraction",IFCSURFACESTYLELIGHTING:"IfcSurfaceStyleLighting",IFCSURFACESTYLE:"IfcSurfaceStyle",IFCSTYLEDREPRESENTATION:"IfcStyledRepresentation",IFCSTYLEDITEM:"IfcStyledItem",IFCSTYLEMODEL:"IfcStyleModel",IFCSTRUCTURALLOADTEMPERATURE:"IfcStructuralLoadTemperature",IFCSTRUCTURALLOADSTATIC:"IfcStructuralLoadStatic",IFCSTRUCTURALLOAD:"IfcStructuralLoad",IFCSTRUCTURALCONNECTIONCONDITION:"IfcStructuralConnectionCondition",IFCSIMPLEPROPERTY:"IfcSimpleProperty",IFCSHAPEREPRESENTATION:"IfcShapeRepresentation",IFCSHAPEMODEL:"IfcShapeModel",IFCSHAPEASPECT:"IfcShapeAspect",IFCSECTIONREINFORCEMENTPROPERTIES:"IfcSectionReinforcementProperties",IFCSECTIONPROPERTIES:"IfcSectionProperties",IFCSIUNIT:"IfcSIUnit",IFCROOT:"IfcRoot",IFCRIBPLATEPROFILEPROPERTIES:"IfcRibPlateProfileProperties",IFCREPRESENTATIONMAP:"IfcRepresentationMap",IFCREPRESENTATIONITEM:"IfcRepresentationItem",IFCREPRESENTATIONCONTEXT:"IfcRepresentationContext",IFCREPRESENTATION:"IfcRepresentation",IFCRELAXATION:"IfcRelaxation",IFCREINFORCEMENTBARPROPERTIES:"IfcReinforcementBarProperties",IFCREFERENCESVALUEDOCUMENT:"IfcReferencesValueDocument",IFCQUANTITYWEIGHT:"IfcQuantityWeight",IFCQUANTITYVOLUME:"IfcQuantityVolume",IFCQUANTITYTIME:"IfcQuantityTime",IFCQUANTITYLENGTH:"IfcQuantityLength",IFCQUANTITYCOUNT:"IfcQuantityCount",IFCQUANTITYAREA:"IfcQuantityArea",IFCPROPERTYENUMERATION:"IfcPropertyEnumeration",IFCPROPERTYDEPENDENCYRELATIONSHIP:"IfcPropertyDependencyRelationship",IFCPROPERTYCONSTRAINTRELATIONSHIP:"IfcPropertyConstraintRelationship",IFCPROPERTY:"IfcProperty",IFCPROFILEPROPERTIES:"IfcProfileProperties",IFCPROFILEDEF:"IfcProfileDef",IFCPRODUCTSOFCOMBUSTIONPROPERTIES:"IfcProductsOfCombustionProperties",IFCPRODUCTREPRESENTATION:"IfcProductRepresentation",IFCPRESENTATIONSTYLEASSIGNMENT:"IfcPresentationStyleAssignment",IFCPRESENTATIONSTYLE:"IfcPresentationStyle",IFCPRESENTATIONLAYERWITHSTYLE:"IfcPresentationLayerWithStyle",IFCPRESENTATIONLAYERASSIGNMENT:"IfcPresentationLayerAssignment",IFCPREDEFINEDTEXTFONT:"IfcPredefinedTextFont",IFCPREDEFINEDTERMINATORSYMBOL:"IfcPredefinedTerminatorSymbol",IFCPREDEFINEDSYMBOL:"IfcPredefinedSymbol",IFCPREDEFINEDITEM:"IfcPredefinedItem",IFCPOSTALADDRESS:"IfcPostalAddress",IFCPHYSICALSIMPLEQUANTITY:"IfcPhysicalSimpleQuantity",IFCPHYSICALQUANTITY:"IfcPhysicalQuantity",IFCPERSONANDORGANIZATION:"IfcPersonAndOrganization",IFCPERSON:"IfcPerson",IFCOWNERHISTORY:"IfcOwnerHistory",IFCORGANIZATIONRELATIONSHIP:"IfcOrganizationRelationship",IFCORGANIZATION:"IfcOrganization",IFCOPTICALMATERIALPROPERTIES:"IfcOpticalMaterialProperties",IFCOBJECTIVE:"IfcObjective",IFCOBJECTPLACEMENT:"IfcObjectPlacement",IFCNAMEDUNIT:"IfcNamedUnit",IFCMONETARYUNIT:"IfcMonetaryUnit",IFCMETRIC:"IfcMetric",IFCMECHANICALSTEELMATERIALPROPERTIES:"IfcMechanicalSteelMaterialProperties",IFCMECHANICALMATERIALPROPERTIES:"IfcMechanicalMaterialProperties",IFCMEASUREWITHUNIT:"IfcMeasureWithUnit",IFCMATERIALPROPERTIES:"IfcMaterialProperties",IFCMATERIALLIST:"IfcMaterialList",IFCMATERIALLAYERSETUSAGE:"IfcMaterialLayerSetUsage",IFCMATERIALLAYERSET:"IfcMaterialLayerSet",IFCMATERIALLAYER:"IfcMaterialLayer",IFCMATERIALCLASSIFICATIONRELATIONSHIP:"IfcMaterialClassificationRelationship",IFCMATERIAL:"IfcMaterial",IFCLOCALTIME:"IfcLocalTime",IFCLIGHTINTENSITYDISTRIBUTION:"IfcLightIntensityDistribution",IFCLIGHTDISTRIBUTIONDATA:"IfcLightDistributionData",IFCLIBRARYREFERENCE:"IfcLibraryReference",IFCLIBRARYINFORMATION:"IfcLibraryInformation",IFCIRREGULARTIMESERIESVALUE:"IfcIrregularTimeSeriesValue",IFCGRIDAXIS:"IfcGridAxis",IFCEXTERNALLYDEFINEDTEXTFONT:"IfcExternallyDefinedTextFont",IFCEXTERNALLYDEFINEDSYMBOL:"IfcExternallyDefinedSymbol",IFCEXTERNALLYDEFINEDSURFACESTYLE:"IfcExternallyDefinedSurfaceStyle",IFCEXTERNALLYDEFINEDHATCHSTYLE:"IfcExternallyDefinedHatchStyle",IFCEXTERNALREFERENCE:"IfcExternalReference",IFCENVIRONMENTALIMPACTVALUE:"IfcEnvironmentalImpactValue",IFCDRAUGHTINGCALLOUTRELATIONSHIP:"IfcDraughtingCalloutRelationship",IFCDOCUMENTINFORMATIONRELATIONSHIP:"IfcDocumentInformationRelationship",IFCDOCUMENTINFORMATION:"IfcDocumentInformation",IFCDOCUMENTELECTRONICFORMAT:"IfcDocumentElectronicFormat",IFCDIMENSIONALEXPONENTS:"IfcDimensionalExponents",IFCDERIVEDUNITELEMENT:"IfcDerivedUnitElement",IFCDERIVEDUNIT:"IfcDerivedUnit",IFCDATEANDTIME:"IfcDateAndTime",IFCCURVESTYLEFONTPATTERN:"IfcCurveStyleFontPattern",IFCCURVESTYLEFONTANDSCALING:"IfcCurveStyleFontAndScaling",IFCCURVESTYLEFONT:"IfcCurveStyleFont",IFCCURRENCYRELATIONSHIP:"IfcCurrencyRelationship",IFCCOSTVALUE:"IfcCostValue",IFCCOORDINATEDUNIVERSALTIMEOFFSET:"IfcCoordinatedUniversalTimeOffset",IFCCONSTRAINTRELATIONSHIP:"IfcConstraintRelationship",IFCCONSTRAINTCLASSIFICATIONRELATIONSHIP:"IfcConstraintClassificationRelationship",IFCCONSTRAINTAGGREGATIONRELATIONSHIP:"IfcConstraintAggregationRelationship",IFCCONSTRAINT:"IfcConstraint",IFCCONNECTIONSURFACEGEOMETRY:"IfcConnectionSurfaceGeometry",IFCCONNECTIONPORTGEOMETRY:"IfcConnectionPortGeometry",IFCCONNECTIONPOINTGEOMETRY:"IfcConnectionPointGeometry",IFCCONNECTIONGEOMETRY:"IfcConnectionGeometry",IFCCOLOURSPECIFICATION:"IfcColourSpecification",IFCCLASSIFICATIONNOTATIONFACET:"IfcClassificationNotationFacet",IFCCLASSIFICATIONNOTATION:"IfcClassificationNotation",IFCCLASSIFICATIONITEMRELATIONSHIP:"IfcClassificationItemRelationship",IFCCLASSIFICATIONITEM:"IfcClassificationItem",IFCCLASSIFICATION:"IfcClassification",IFCCALENDARDATE:"IfcCalendarDate",IFCBOUNDARYNODECONDITIONWARPING:"IfcBoundaryNodeConditionWarping",IFCBOUNDARYNODECONDITION:"IfcBoundaryNodeCondition",IFCBOUNDARYFACECONDITION:"IfcBoundaryFaceCondition",IFCBOUNDARYEDGECONDITION:"IfcBoundaryEdgeCondition",IFCBOUNDARYCONDITION:"IfcBoundaryCondition",IFCAPPROVALRELATIONSHIP:"IfcApprovalRelationship",IFCAPPROVALPROPERTYRELATIONSHIP:"IfcApprovalPropertyRelationship",IFCAPPROVALACTORRELATIONSHIP:"IfcApprovalActorRelationship",IFCAPPROVAL:"IfcApproval",IFCAPPLIEDVALUERELATIONSHIP:"IfcAppliedValueRelationship",IFCAPPLIEDVALUE:"IfcAppliedValue",IFCAPPLICATION:"IfcApplication",IFCADDRESS:"IfcAddress",IFCACTORROLE:"IfcActorRole"};class lr{constructor(){t(this,"factor",1),t(this,"complement",1)}apply(e){const t=this.getScaleMatrix().multiply(e);e.copy(t)}setUp(e){var t,i,s;this.factor=1;const n=this.getLengthUnits(e);if(!n)return;const r=null==n,o=void 0===n.Name||null===n.Name;r||o||("FOOT"===n.Name.value&&(this.factor=.3048),"MILLI"===(null==(t=n.Prefix)?void 0:t.value)?this.complement=.001:("CENTI"===(null==(i=n.Prefix)?void 0:i.value)||"DECI"===(null==(s=n.Prefix)?void 0:s.value))&&(this.complement=.01))}getLengthUnits(e){try{const t=e.GetLineIDsWithType(0,c.IFCUNITASSIGNMENT).get(0),i=e.GetLine(0,t);for(const t of i.Units){if(!t||null===t.value||void 0===t.value)continue;const i=e.GetLine(0,t.value);if(i.UnitType&&"LENGTHUNIT"===i.UnitType.value)return i}return null}catch(e){return console.log("Could not get units"),null}}getScaleMatrix(){const e=this.factor;return(new o.Matrix4).fromArray([e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1])}}class hr{constructor(){t(this,"itemsByFloor",{}),t(this,"_units",new lr)}setUp(e){this._units.setUp(e),this.cleanUp();try{const t=e.GetLineIDsWithType(0,c.IFCRELCONTAINEDINSPATIALSTRUCTURE),i=new Set,s=e.GetLineIDsWithType(0,c.IFCSPACE);for(let e=0;e<s.size();e++)i.add(s.get(e));const n=e.GetLineIDsWithType(0,c.IFCRELAGGREGATES),r=n.size();for(let t=0;t<r;t++){const s=n.get(t),r=e.GetLine(0,s);if(!r||!r.RelatingObject||!r.RelatedObjects)continue;const o=r.RelatingObject.value,a=r.RelatedObjects;for(const e of a){const t=e.value;i.has(t)&&(this.itemsByFloor[t]=o)}}const o={},a=t.size();for(let s=0;s<a;s++){const n=t.get(s),r=e.GetLine(0,n);if(!r||!r.RelatingStructure||!r.RelatedElements)continue;const a=r.RelatingStructure.value,c=r.RelatedElements;if(i.has(a))for(const e of c){o[a]||(o[a]=[]);const t=e.value;o[a].push(t)}else for(const e of c){const t=e.value;this.itemsByFloor[t]=a}}for(const e in o){const t=this.itemsByFloor[e];if(void 0!==t){const i=o[e];for(const e of i)this.itemsByFloor[e]=t}}for(let t=0;t<r;t++){const i=n.get(t),s=e.GetLine(0,i);if(!s||!s.RelatingObject||!s.RelatedObjects)continue;const r=s.RelatingObject.value,o=s.RelatedObjects;for(const e of o){const t=e.value,i=this.itemsByFloor[r];void 0!==i&&(this.itemsByFloor[t]=i)}}}catch(e){console.log("Could not get floors.")}}cleanUp(){this.itemsByFloor={}}}class ur{constructor(){t(this,"includeProperties",!0),t(this,"optionalCategories",[c.IFCSPACE]),t(this,"wasm",{path:"",absolute:!1,logLevel:c.LogLevel.LOG_LEVEL_OFF}),t(this,"excludedCategories",new Set),t(this,"includedCategories",new Set),t(this,"saveLocations",!1),t(this,"webIfc",{COORDINATE_TO_ORIGIN:!0}),t(this,"autoSetWasm",!0),t(this,"customLocateFileHandler",null)}}class Ir{constructor(){t(this,"defLineMat",new o.LineBasicMaterial({color:16777215}))}read(e){const t={IfcAlignment:e.GetAllAlignments(0),IfcCrossSection2D:e.GetAllCrossSections2D(0),IfcCrossSection3D:e.GetAllCrossSections3D(0)};return this.get(t)}get(e){if(e.IfcAlignment){const t=new Map;for(const i of e.IfcAlignment){const e=new a.Alignment;e.absolute=this.getCurves(i.curve3D,e),e.horizontal=this.getCurves(i.horizontal,e),e.vertical=this.getCurves(i.vertical,e),t.set(t.size,e)}return{alignments:t,coordinationMatrix:new o.Matrix4}}}getCurves(e,t){const i=[];let s=0;for(const n of e){const e={};if(n.data)for(const t of n.data){const[i,s]=t.split(": "),n=parseFloat(s);e[i]=n||s}const{points:r}=n,c=new Float32Array(3*r.length);for(let e=0;e<r.length;e++){const{x:t,y:i,z:s}=r[e];c[3*e]=t,c[3*e+1]=i,c[3*e+2]=s||0}const l=new o.BufferAttribute(c,3),h=new o.EdgesGeometry;h.setAttribute("position",l);const u=new a.CurveMesh(s,e,t,h,this.defLineMat);i.push(u.curve),s++}return i}}class dr{getNameInfo(e){var t;const i={},{arguments:s}=e.GetHeaderLine(0,c.FILE_NAME)||{};if(!s)return i;const[n,r,o,a,l,h,u]=s;if((null==n?void 0:n.value)&&(i.name=n.value),(null==r?void 0:r.value)&&(i.creationDate=new Date(r.value)),o){i.author={};const[e,t]=o;(null==e?void 0:e.value)&&(i.author.name=e.value),(null==t?void 0:t.value)&&(i.author.email=t.value)}return a&&(null==(t=a[0])?void 0:t.value)&&(i.organization=a[0].value),(null==l?void 0:l.value)&&(i.preprocessorVersion=null==l?void 0:l.value),(null==h?void 0:h.value)&&(i.originatingSystem=null==h?void 0:h.value),(null==u?void 0:u.value)&&(i.authorization=null==u?void 0:u.value),i}getDescriptionInfo(e){var t;const i={},{arguments:s}=e.GetHeaderLine(0,c.FILE_DESCRIPTION)||{};if(!s)return i;const[n,r]=s;if(Array.isArray(n)&&(null==(t=n[0])?void 0:t.value)){const e=n[0].value.match(/\[([^\]]+)\]/);e&&e[1]&&(i.viewDefinition=e[1])}return(null==r?void 0:r.value)&&(i.implementationLevel=r.value),i}}class Er{static get(e,t){const i=[c.IFCPROJECT,c.IFCSITE,c.IFCBUILDING,c.IFCBUILDINGSTOREY,c.IFCSPACE,c.IFCROAD,c.IFCFACILITY,c.IFCFACILITYPART,c.IFCBRIDGE],s=e.data;for(const e of i){const i=t.GetLineIDsWithType(0,e),n=i.size();for(let t=0;t<n;t++){const n=i.get(t);s.has(n)||s.set(n,[[],[0,e]])}}}}const fr=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,2916149573]),pr=class e extends Ut{constructor(i){super(i),t(this,"enabled",!0),i.add(e.uuid,this)}async export(e,t,i=!1,s=!0){const n={},r=new Set(e.GetIfcEntityList(t)),o=new Set([c.IFCPROJECT,c.IFCSITE,c.IFCBUILDING,c.IFCBUILDINGSTOREY,c.IFCSPACE]);for(const e of o)r.add(e);for(const a of r){if(fr.has(a))continue;const r=o.has(a)&&s,c=e.GetLineIDsWithType(t,a);for(const t of c)try{const s=e.GetLine(0,t,r,i);n[s.expressID]=s}catch(e){console.log(`Could not get property ${t}, with recursive ${r} and indirect ${i}.`)}}return n}};t(pr,"uuid","b32c4332-cd67-436e-ba7f-196646c7a635");let Cr=pr;const Tr=class e extends Ut{constructor(i){super(i),t(this,"onDisposed",new Dt),t(this,"onIfcStartedLoading",new Dt),t(this,"onSetup",new Dt),t(this,"settings",new ur),t(this,"webIfc",new c.IfcAPI),t(this,"enabled",!0),t(this,"_material",new o.MeshLambertMaterial),t(this,"_spatialTree",new hr),t(this,"_metaData",new dr),t(this,"_fragmentInstances",new Map),t(this,"_civil",new Ir),t(this,"_visitedFragments",new Map),t(this,"_materialT",new o.MeshLambertMaterial({transparent:!0,opacity:.5})),this.components.add(e.uuid,this),this.settings.excludedCategories.add(c.IFCOPENINGELEMENT)}dispose(){this.webIfc=null,this.onDisposed.trigger(e.uuid),this.onDisposed.reset()}async setup(e){this.settings={...this.settings,...e},this.settings.autoSetWasm&&await this.autoSetWasm(),this.onSetup.trigger()}async load(e,t=!0,i=""){const s=performance.now();this.onIfcStartedLoading.trigger(),await this.readIfcFile(e);const n=await this.getAllGeometries();n.name=i;const r=this.components.get(Cr),o=await r.export(this.webIfc,0);n.setLocalProperties(o);const a=this.components.get(yr);a.groups.set(n.uuid,n);for(const e of n.items)a.list.set(e.id,e),e.mesh.uuid=e.id,e.group=n;a.onFragmentsLoaded.trigger(n),t&&a.coordinate([n]);for(const[e]of n.data){const t=o[e];if(!t||!t.GlobalId)continue;const i=t.GlobalId.value||t.GlobalId;n.globalToExpressIDs.set(i,e)}return Er.get(n,this.webIfc),this.cleanUp(),console.log(`Streaming the IFC took ${performance.now()-s} ms!`),n}async readIfcFile(e){const{path:t,absolute:i,logLevel:s}=this.settings.wasm;return this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(this.settings.customLocateFileHandler||void 0),s&&this.webIfc.SetLogLevel(s),this.webIfc.OpenModel(e,this.settings.webIfc)}cleanUp(){try{this.webIfc.Dispose()}catch(e){console.log("Web-ifc wasn't disposed.")}this.webIfc=null,this.webIfc=new c.IfcAPI,this._visitedFragments.clear(),this._fragmentInstances.clear()}async getAllGeometries(){this._spatialTree.setUp(this.webIfc);const e=this.webIfc.GetIfcEntityList(0),t=new a.FragmentsGroup;t.ifcMetadata={name:"",description:"",...this._metaData.getNameInfo(this.webIfc),...this._metaData.getDescriptionInfo(this.webIfc),schema:this.webIfc.GetModelSchema(0)||"IFC2X3",maxExpressID:this.webIfc.GetMaxExpressID(0)};const i=[];for(const s of e){if(!this.webIfc.IsIfcElement(s)&&s!==c.IFCSPACE)continue;const e=this.settings.includedCategories;if(e.size>0&&!e.has(s))continue;if(this.settings.excludedCategories.has(s))continue;const n=this.webIfc.GetLineIDsWithType(0,s),r=n.size();for(let e=0;e<r;e++){const r=n.get(e);i.push(r);const o=this._spatialTree.itemsByFloor[r]||0;t.data.set(r,[[],[o,s]])}}this._spatialTree.cleanUp(),this.webIfc.StreamMeshes(0,i,(e=>{this.getMesh(e,t)}));for(const e of this._visitedFragments){const{index:i,fragment:s}=e[1];t.keyFragments.set(i,s.id)}for(const e of t.items){const t=this._fragmentInstances.get(e.id);if(!t)throw new Error("Fragment not found!");const i=[];for(const[e,s]of t)i.push(s);e.add(i)}const s=this.webIfc.GetCoordinationMatrix(0);return t.coordinationMatrix.fromArray(s),t.civilData=this._civil.read(this.webIfc),t}getMesh(e,t){const i=e.geometries.size(),s=e.expressID;for(let n=0;n<i;n++){const i=e.geometries.get(n),{x:r,y:c,z:l,w:h}=i.color,u=1!==h,{geometryExpressID:I}=i,d=`${I}-${u}`;if(!this._visitedFragments.has(d)){const e=this.getGeometry(this.webIfc,I),i=u?this._materialT:this._material,s=new a.Fragment(e,i,1);t.add(s.mesh),t.items.push(s);const n=this._visitedFragments.size;this._visitedFragments.set(d,{index:n,fragment:s})}const E=(new o.Color).setRGB(r,c,l,"srgb"),f=new o.Matrix4;f.fromArray(i.flatTransformation);const p=this._visitedFragments.get(d);if(void 0===p)throw new Error("Error getting geometry data for streaming!");const C=t.data.get(s);if(!C)throw new Error("Data not found!");C[0].push(p.index);const{fragment:T}=p;this._fragmentInstances.has(T.id)||this._fragmentInstances.set(T.id,new Map);const m=this._fragmentInstances.get(T.id);if(!m)throw new Error("Instances not found!");if(m.has(s)){const e=m.get(s);if(!e)throw new Error("Instance not found!");e.transforms.push(f),e.colors&&e.colors.push(E)}else m.set(s,{id:s,transforms:[f],colors:[E]})}}getGeometry(e,t){const i=e.GetGeometry(0,t),s=e.GetIndexArray(i.GetIndexData(),i.GetIndexDataSize()),n=e.GetVertexArray(i.GetVertexData(),i.GetVertexDataSize()),r=new Float32Array(n.length/2),a=new Float32Array(n.length/2);for(let e=0;e<n.length;e+=6)r[e/2]=n[e],r[e/2+1]=n[e+1],r[e/2+2]=n[e+2],a[e/2]=n[e+3],a[e/2+1]=n[e+4],a[e/2+2]=n[e+5];const c=new o.BufferGeometry,l=new o.BufferAttribute(r,3),h=new o.BufferAttribute(a,3);return c.setAttribute("position",l),c.setAttribute("normal",h),c.setIndex(Array.from(s)),i.delete(),c}async autoSetWasm(){const e=await fetch(`https://unpkg.com/@thatopen/components@${Wi.release}/package.json`);if(!e.ok)return void console.warn("Couldn't get openbim-components package.json. Set wasm settings manually.");const t=await e.json();if("web-ifc"in t.peerDependencies){const e=t.peerDependencies["web-ifc"];this.settings.wasm.path=`https://unpkg.com/web-ifc@${e}/`,this.settings.wasm.absolute=!0}else console.warn("Couldn't get web-ifc from peer dependencies in openbim-components. Set wasm settings manually.")}};t(Tr,"uuid","a659add7-1418-4771-a0d6-7d4d438e4624");let mr=Tr;const Rr={IfcRelAssignsToControl:{related:5,relating:7},IfcRelAssignsToGroup:{related:5,relating:7},IfcRelAssignsToProduct:{related:5,relating:7},IfcRelAssociatesClassification:{related:5,relating:6},IfcRelAssociatesMaterial:{related:5,relating:6},IfcRelAssociatesDocument:{related:5,relating:6},IfcRelContainedInSpatialStructure:{related:5,relating:6},IfcRelFlowControlElements:{related:5,relating:6},IfcRelConnectsElements:{related:7,relating:6},IfcRelDeclares:{related:6,relating:5},IfcRelAggregates:{related:6,relating:5},IfcRelNests:{related:6,relating:5},IfcRelDefinesByProperties:{related:5,relating:6},IfcRelDefinesByType:{related:5,relating:6},IfcRelDefinesByTemplate:{related:5,relating:6}},gr={[c.IFCRELASSIGNSTOCONTROL]:"IfcRelAssignsToControl",[c.IFCRELASSIGNSTOGROUP]:"IfcRelAssignsToGroup",[c.IFCRELASSIGNSTOPRODUCT]:"IfcRelAssignsToProduct",[c.IFCRELASSOCIATESCLASSIFICATION]:"IfcRelAssociatesClassification",[c.IFCRELASSOCIATESMATERIAL]:"IfcRelAssociatesMaterial",[c.IFCRELASSOCIATESDOCUMENT]:"IfcRelAssociatesDocument",[c.IFCRELCONTAINEDINSPATIALSTRUCTURE]:"IfcRelContainedInSpatialStructure",[c.IFCRELCONNECTSELEMENTS]:"IfcRelConnectsElements",[c.IFCRELFLOWCONTROLELEMENTS]:"IfcRelFlowControlElements",[c.IFCRELDECLARES]:"IfcRelDeclares",[c.IFCRELAGGREGATES]:"IfcRelAggregates",[c.IFCRELNESTS]:"IfcRelNests",[c.IFCRELDEFINESBYPROPERTIES]:"IfcRelDefinesByProperties",[c.IFCRELDEFINESBYTYPE]:"IfcRelDefinesByType",[c.IFCRELDEFINESBYTEMPLATE]:"IfcRelDefinesByTemplate"},Ar=class e extends Ut{constructor(i){super(i),t(this,"onDisposed",new Dt),t(this,"onRequestFile",new Dt),t(this,"ifcToExport",null),t(this,"onElementToPset",new Dt),t(this,"onPropToPset",new Dt),t(this,"onPsetRemoved",new Dt),t(this,"onDataChanged",new Dt),t(this,"wasm",{path:"/",absolute:!1}),t(this,"enabled",!0),t(this,"attributeListeners",{}),t(this,"selectedModel"),t(this,"changeMap",{}),this.components.add(e.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(e.uuid),this.onDisposed.reset()}static getIFCSchema(e){const t=e.ifcMetadata.schema;if(!t)throw new Error("IFC Schema not found");return t.startsWith("IFC2X3")?"IFC2X3":t.startsWith("IFC4")&&""===t.replace("IFC4","")?"IFC4":t.startsWith("IFC4X3")?"IFC4X3":t}async setData(e,...t){for(const i of t){const{expressID:t}=i;t&&-1!==t||(i.expressID=this.getNewExpressID(e)),await e.setProperties(i.expressID,i),this.registerChange(e,i.expressID)}}async newPset(t,i,s){const n=e.getIFCSchema(t),{handle:r}=await this.getOwnerHistory(t),o=this.newGUID(t),a=new c[n].IfcLabel(i),l=s?new c[n].IfcText(s):null,h=new c[n].IfcPropertySet(o,r,a,l,[]);return h.expressID=this.getNewExpressID(t),await this.setData(t,h),{pset:h}}async removePset(e,...t){for(const i of t){const t=await e.getProperties(i);if((null==t?void 0:t.type)!==c.IFCPROPERTYSET)continue;const s=await ar.getPsetRel(e,i);if(s&&(await e.setProperties(s,null),this.registerChange(e,s)),t){for(const i of t.HasProperties)await e.setProperties(i.value,null);await e.setProperties(i,null),this.onPsetRemoved.trigger({model:e,psetID:i}),this.registerChange(e,i)}}}newSingleStringProperty(e,t,i,s){return this.newSingleProperty(e,t,i,s)}newSingleNumericProperty(e,t,i,s){return this.newSingleProperty(e,t,i,s)}newSingleBooleanProperty(e,t,i,s){return this.newSingleProperty(e,t,i,s)}async removePsetProp(e,t,i){const s=await e.getProperties(t),n=await e.getProperties(i);s&&n&&s.type===c.IFCPROPERTYSET&&n&&(s.HasProperties=s.HasProperties.filter((e=>e.value!==i)),await e.setProperties(i,null),this.registerChange(e,t,i))}addElementToPset(e,t,...i){this.components.get(Or).addEntitiesRelation(e,t,{type:c.IFCRELDEFINESBYPROPERTIES,inv:"DefinesOcurrence"},...i)}async addPropToPset(e,t,...i){const s=await e.getProperties(t);if(s){for(const n of i){if(s.HasProperties.includes(n))continue;const i=new c.Handle(n);s.HasProperties.push(i),this.onPropToPset.trigger({model:e,psetID:t,propID:n})}this.registerChange(e,t)}}async createIfcRel(t,i,s,n){const r=gr[i];if(!r)throw new Error(`IfcPropertiesManager: ${r} is unsoported.`);const o=e.getIFCSchema(t),a=Rr[r],l=c[o][r];if(!a||!l)throw new Error(`IfcPropertiesManager: ${r} is unsoported.`);const h=[new c[o].IfcGloballyUniqueId(Ii.create())],{related:u,relating:I}=a,d=[...new Set(n)].map((e=>new c.Handle(e))),E=(e,t)=>{for(let i=e;i<t-1;i++)h.push(null)};u<I?(E(1,u),h.push(d),E(u,I),h.push(new c.Handle(s))):(E(1,I),E(I,u),h.push(new c.Handle(s)),h.push(d));const f=new l(...h);return await this.setData(t,f),f}async saveToIfc(e,t){const i=this.components.get(mr),s=i.webIfc,n=await i.readIfcFile(t),r=this.components.get(Or);await r.applyRelationChanges();const o=this.changeMap[e.uuid]??[];for(const t of o){const i=await e.getProperties(t);if(i)s.WriteLine(n,i);else{s.GetLine(n,t)&&s.DeleteLine(n,t)}}const a=s.SaveModel(n);return i.webIfc.CloseModel(n),i.cleanUp(),a}async getEntityRef(e,t){const i=await e.getAllPropertiesOfType(t);if(!i)return null;const s=[];for(const e in i){const t=new c.Handle(Number(e));s.push(t)}return s}async setAttributeListener(e,t,i){this.attributeListeners[e.uuid]||(this.attributeListeners[e.uuid]={});const s=this.attributeListeners[e.uuid][t]?this.attributeListeners[e.uuid][t][i]:null;if(s)return s;const n=await e.getProperties(t);if(!n)throw new Error(`Entity with expressID ${t} doesn't exists.`);const r=n[i];if(Array.isArray(r)||!r)throw new Error(`Attribute ${i} is array or null, and it can't have a listener.`);const o=r.value;if(void 0===o||null==o)throw new Error(`Attribute ${i} has a badly defined handle.`);const a=new Dt;return Object.defineProperty(n[i],"value",{get(){return this._value},async set(e){this._value=e,a.trigger(e)}}),n[i].value=o,this.attributeListeners[e.uuid][t]||(this.attributeListeners[e.uuid][t]={}),this.attributeListeners[e.uuid][t][i]=a,a}getNewExpressID(e){return e.ifcMetadata.maxExpressID++,e.ifcMetadata.maxExpressID}newGUID(t){const i=e.getIFCSchema(t);return new c[i].IfcGloballyUniqueId(Ii.create())}async getOwnerHistory(e){const t=await e.getAllPropertiesOfType(c.IFCOWNERHISTORY);if(!t)throw new Error("No OwnerHistory was found.");const i=t[Object.keys(t).map((e=>parseInt(e,10)))[0]];return{entity:i,handle:new c.Handle(i.expressID)}}registerChange(e,...t){this.changeMap[e.uuid]||(this.changeMap[e.uuid]=new Set);for(const i of t)this.changeMap[e.uuid].add(i),this.onDataChanged.trigger({model:e,expressID:i})}async newSingleProperty(t,i,s,n){const r=e.getIFCSchema(t),o=new c[r].IfcIdentifier(s),a=new c[r][i](n),l=new c[r].IfcPropertySingleValue(o,null,a,null);return l.expressID=this.getNewExpressID(t),await this.setData(t,l),l}};t(Ar,"uuid","58c2d9f0-183c-48d6-a402-dfcf5b9a34df");let Fr=Ar;const Sr=class e extends Ut{constructor(i){super(i),t(this,"onDisposed",new Dt),t(this,"onRelationsIndexed",new Dt),t(this,"relationMaps",{}),t(this,"enabled",!0),t(this,"_relToAttributesMap",nr),t(this,"_inverseAttributes",["IsDecomposedBy","Decomposes","AssociatedTo","HasAssociations","ClassificationForObjects","IsGroupedBy","HasAssignments","IsDefinedBy","DefinesOcurrence","IsTypedBy","Types","Defines","ContainedInStructure","ContainsElements","HasControlElements","AssignedToFlowElement","ConnectedTo","ConnectedFrom","ReferencedBy","Declares","HasContext","Controls","IsNestedBy","Nests","DocumentRefForObjects"]),t(this,"_ifcRels",[c.IFCRELAGGREGATES,c.IFCRELASSOCIATESMATERIAL,c.IFCRELASSOCIATESCLASSIFICATION,c.IFCRELASSIGNSTOGROUP,c.IFCRELDEFINESBYPROPERTIES,c.IFCRELDEFINESBYTYPE,c.IFCRELDEFINESBYTEMPLATE,c.IFCRELCONTAINEDINSPATIALSTRUCTURE,c.IFCRELFLOWCONTROLELEMENTS,c.IFCRELCONNECTSELEMENTS,c.IFCRELASSIGNSTOPRODUCT,c.IFCRELDECLARES,c.IFCRELASSIGNSTOCONTROL,c.IFCRELNESTS,c.IFCRELASSOCIATESDOCUMENT]),t(this,"onFragmentsDisposed",(e=>{delete this.relationMaps[e.groupID]})),t(this,"_changeMap",{}),t(this,"onEntitiesRelated",new Dt),this.components.add(e.uuid,this);i.get(yr).onFragmentsDisposed.add(this.onFragmentsDisposed)}indexRelations(e,t,i,s){const n=Object.keys(t).find((e=>e.startsWith("Relating"))),r=Object.keys(t).find((e=>e.startsWith("Related")));if(!n||!r)return;const o=t[n].value,a=t[r].map((e=>e.value)),c=this.getEntityRelations(e,o,s);for(const e of a)c.push(e);for(const t of a){this.getEntityRelations(e,t,i).push(o)}}getAttributeIndex(e){const t=this._inverseAttributes.indexOf(e);if(-1===t)throw new Error(`IfcRelationsIndexer: ${e} is not a valid IFC Inverse Attribute name or its not supported yet by this component.`);return t}setRelationMap(e,t){this.relationMaps[e.uuid]=t,this.onRelationsIndexed.trigger({modelID:e.uuid,relationsMap:t})}async process(e,t){if(!e.hasProperties)throw new Error("FragmentsGroup properties not found");let i=this.relationMaps[e.uuid];i||(i=new Map,this.relationMaps[e.uuid]=i);const s=e.getLocalProperties();if(!s)return i;const n=(null==t?void 0:t.relationsToProcess)??this._ifcRels;for(const[e,t]of Object.entries(s)){if(!n.includes(t.type))continue;const e=this._relToAttributesMap.get(t.type);if(!e)continue;const{forRelated:s,forRelating:r}=e;this.indexRelations(i,t,s,r)}return this.setRelationMap(e,i),i}async processFromWebIfc(e,t){const i=new Map;for(const s of this._ifcRels){const n=this._relToAttributesMap.get(s);if(!n)continue;const{forRelated:r,forRelating:o}=n,a=e.GetLineIDsWithType(t,s);for(let s=0;s<a.size();s++){const n=await e.properties.getItemProperties(t,a.get(s));this.indexRelations(i,n,r,o)}}return this.onRelationsIndexed.trigger({modelID:t.toString(),relationsMap:i}),i}getEntityRelations(e,t,i){const n=this.getAttributeIndex(i);let r;if(r=e instanceof s.FragmentsGroup?this.relationMaps[e.uuid]:"string"==typeof e?this.relationMaps[e]:e,!r&&(e instanceof s.FragmentsGroup||"string"==typeof e)){r=new Map;const t=e instanceof s.FragmentsGroup?e.uuid:e;this.relationMaps[t]=r}let o=r.get(t);o||(o=new Map,r.set(t,o));let a=o.get(n);return a||(a=[],o.set(n,a)),a}serializeRelations(e){const t={};for(const[i,s]of e.entries()){t[i]||(t[i]={});for(const[e,n]of s.entries())t[i][e]=n}return JSON.stringify(t)}serializeModelRelations(e){const t=this.relationMaps[e.uuid];if(!t)return null;return this.serializeRelations(t)}serializeAllRelations(){const e={};for(const t in this.relationMaps){const i=this.relationMaps[t],s={};for(const[e,t]of i.entries()){s[e]||(s[e]={});for(const[i,n]of t.entries())s[e][i]=n}e[t]=s}return JSON.stringify(e)}getRelationsMapFromJSON(e){const t=JSON.parse(e),i=new Map;for(const e in t){const s=t[e],n=new Map;for(const e in s)n.set(Number(e),s[e]);i.set(Number(e),n)}return i}dispose(){this.relationMaps={};this.components.get(yr).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(e.uuid),this.onDisposed.reset()}getEntitiesWithRelation(e,t,i){const s=this.relationMaps[e.uuid];if(!s)throw new Error("IfcRelationsIndexer: the model relations are not indexed!");const n=new Set;for(const[e,r]of s){const s=this.getAttributeIndex(t),o=r.get(s);o&&o.includes(i)&&n.add(e)}return n}addEntityRelations(e,t,i,...s){const n=this.getEntityRelations(e,t,i);if(n)n.push(...s);else{const n=this.getAttributeIndex(i),r=this.relationMaps[e.uuid].get(t);null==r||r.set(n,s)}}async applyRelationChanges(){const e=this.components.get(yr),t=this.components.get(Fr);for(const i in this._changeMap){const s=e.groups.get(i);if(!s)continue;const n=this._changeMap[i];for(const[e,i]of n)for(const[n,r]of i){const{related:i,relID:o}=r;if(o){const e=await s.getProperties(o);if(!e)continue;const r=Object.keys(e),a=r.find((e=>e.startsWith("Related"))),l=r.find((e=>e.startsWith("Relating")));if(!a||!l)continue;e[a]=[...i].map((e=>new c.Handle(e))),e[l]=new c.Handle(n),await t.setData(s,e)}else{const o=await t.createIfcRel(s,e,n,[...i]);if(!o)continue;r.relID=o.expressID}}}}addEntitiesRelation(e,t,i,...s){const{type:n,inv:r}=i;let o=this.relationMaps[e.uuid];if(o||(o=new Map,this.relationMaps[e.uuid]=o),!this._ifcRels.includes(n))return;const a=nr.get(n);if(!a)return;const{forRelated:c,forRelating:l}=a;if(c!==r&&l!==r)return;let h=this._changeMap[e.uuid];h||(h=new Wt,this._changeMap[e.uuid]=h);const u=l===r?[t]:s,I=c===r?[t]:s;let d=h.get(n);d||(d=new Wt,d.onItemSet.add((()=>this.onEntitiesRelated.trigger({invAttribute:r,relType:n,relatingIDs:u,relatedIDs:I}))),d.onItemUpdated.add((()=>this.onEntitiesRelated.trigger({invAttribute:r,relType:n,relatingIDs:u,relatedIDs:I}))),h.set(n,d));for(const e of u){let t=d.get(e);t||(t={related:new Ht},d.set(e,t)),t.related.add(...I)}for(const t of u){this.getEntityRelations(e,t,l).push(...I)}for(const t of I){this.getEntityRelations(e,t,c).push(...u)}}getEntityChildren(e,t,i=new Set){i.add(t);if(void 0===this.relationMaps[e.uuid])throw new Error("The provided model has no indices. You have to generate them first.");const s=this.getEntityRelations(e,t,"IsDecomposedBy");if(s)for(const t of s)this.getEntityChildren(e,t,i);const n=this.getEntityRelations(e,t,"ContainsElements");if(n)for(const t of n)this.getEntityChildren(e,t,i);return i}};t(Sr,"uuid","23a889ab-83b3-44a4-8bee-ead83438370b");let Or=Sr;const Nr=class e extends Ut{constructor(i){super(i),t(this,"onDisposed",new Dt),t(this,"onFragmentsLoaded",new Dt),t(this,"onFragmentsDisposed",new Dt),t(this,"list",new Wt),t(this,"groups",new Wt),t(this,"baseCoordinationModel",""),t(this,"baseCoordinationMatrix",new o.Matrix4),t(this,"enabled",!0),t(this,"_loader",new s.Serializer),this.components.add(e.uuid,this)}get meshes(){const e=[];for(const[t,i]of this.list)e.push(i.mesh);return e}dispose(){for(const[e,t]of this.groups)t.dispose(!0);this.baseCoordinationModel="",this.groups.clear(),this.list.clear(),this.onFragmentsLoaded.reset(),this.onFragmentsDisposed.reset(),this.onDisposed.trigger(),this.onDisposed.reset()}disposeGroup(e){const{uuid:t}=e,i=[];for(const t of e.items)i.push(t.id),this.list.delete(t.id);e.dispose(!0),this.groups.delete(e.uuid),0===this.groups.size&&(this.baseCoordinationModel="",this.baseCoordinationMatrix=new o.Matrix4),this.onFragmentsDisposed.trigger({groupID:t,fragmentIDs:i})}load(e,t){const i={coordinate:!0,...t},{coordinate:s,name:n,properties:r,relationsMap:o}=i,a=this._loader.import(e);t&&(a.isStreamed=t.isStreamed||!1),n&&(a.name=n);for(const e of a.items)e.group=a,this.list.set(e.id,e);if(s&&this.coordinate([a]),this.groups.set(a.uuid,a),r&&a.setLocalProperties(r),o){this.components.get(Or).setRelationMap(a,o)}return this.onFragmentsLoaded.trigger(a),a}export(e){return this._loader.export(e)}getModelIdMap(e){const t={};for(const i in e){const s=this.list.get(i);if(!s||!s.group)continue;const n=s.group;n.uuid in t||(t[n.uuid]=new Set);const r=e[i];for(const e of r)t[n.uuid].add(e)}return t}modelIdToFragmentIdMap(e){let t={};for(const i in e){const s=this.groups.get(i);if(!s)continue;const n=e[i],r=s.getFragmentMap(n);t={...t,...r}}return t}guidToFragmentIdMap(e){const t={};for(const[i,s]of this.groups){i in t||(t[i]=new Set);for(const n of e){const e=s.globalToExpressIDs.get(n);e&&t[i].add(e)}}return this.modelIdToFragmentIdMap(t)}fragmentIdMapToGuids(e){const t=[],i=this.getModelIdMap(e);for(const e in i){const s=this.groups.get(e);if(!s)continue;const n=i[e];for(const e of n)for(const[i,n]of s.globalToExpressIDs.entries())if(n===e){t.push(i);break}}return t}coordinate(e=Array.from(this.groups.values())){if(0===this.baseCoordinationModel.length){const t=e.pop();if(!t)return;this.baseCoordinationModel=t.uuid,this.baseCoordinationMatrix=t.coordinationMatrix.clone()}if(e.length)for(const t of e)t.coordinationMatrix.equals(this.baseCoordinationMatrix)||(t.position.set(0,0,0),t.rotation.set(0,0,0),t.scale.set(1,1,1),t.updateMatrix(),this.applyBaseCoordinateSystem(t,t.coordinationMatrix))}applyBaseCoordinateSystem(e,t){t&&e.applyMatrix4(t.clone().invert()),e.applyMatrix4(this.baseCoordinationMatrix)}clone(e,t){const i=e.cloneGroup(t);this.groups.set(i.uuid,i);for(const e of i.items)this.list.set(e.id,e);return i}};t(Nr,"uuid","fef46874-46a3-461b-8c44-2922ab77c806");let yr=Nr;function _r(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Lr={exports:{}};
9
9
  /*!
10
10
 
11
11
  JSZip v3.10.1 - A JavaScript class for generating and reading zip files
@@ -16,4 +16,4 @@ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/js
16
16
 
17
17
  JSZip uses the library pako released under the MIT license :
18
18
  https://github.com/nodeca/pako/blob/main/LICENSE
19
- */const tr=Kn(er.exports=function e(t,i,s){function n(o,a){if(!i[o]){if(!t[o]){if(!a&&Jn)return Jn(o);if(r)return r(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=i[o]={exports:{}};t[o][0].call(l.exports,(function(e){return n(t[o][1][e]||e)}),l,l.exports,e,t,i,s)}return i[o].exports}for(var r=Jn,o=0;o<s.length;o++)n(s[o]);return n}({1:[function(e,t,i){var s=e("./utils"),n=e("./support"),r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(e){for(var t,i,n,o,a,c,l,h=[],u=0,I=e.length,d=I,E="string"!==s.getTypeOf(e);u<e.length;)d=I-u,n=E?(t=e[u++],i=u<I?e[u++]:0,u<I?e[u++]:0):(t=e.charCodeAt(u++),i=u<I?e.charCodeAt(u++):0,u<I?e.charCodeAt(u++):0),o=t>>2,a=(3&t)<<4|i>>4,c=1<d?(15&i)<<2|n>>6:64,l=2<d?63&n:64,h.push(r.charAt(o)+r.charAt(a)+r.charAt(c)+r.charAt(l));return h.join("")},i.decode=function(e){var t,i,s,o,a,c,l=0,h=0,u="data:";if(e.substr(0,u.length)===u)throw new Error("Invalid base64 input, it looks like a data url.");var I,d=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===r.charAt(64)&&d--,e.charAt(e.length-2)===r.charAt(64)&&d--,d%1!=0)throw new Error("Invalid base64 input, bad content length.");for(I=n.uint8array?new Uint8Array(0|d):new Array(0|d);l<e.length;)t=r.indexOf(e.charAt(l++))<<2|(o=r.indexOf(e.charAt(l++)))>>4,i=(15&o)<<4|(a=r.indexOf(e.charAt(l++)))>>2,s=(3&a)<<6|(c=r.indexOf(e.charAt(l++))),I[h++]=t,64!==a&&(I[h++]=i),64!==c&&(I[h++]=s);return I}},{"./support":30,"./utils":32}],2:[function(e,t,i){var s=e("./external"),n=e("./stream/DataWorker"),r=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function a(e,t,i,s,n){this.compressedSize=e,this.uncompressedSize=t,this.crc32=i,this.compression=s,this.compressedContent=n}a.prototype={getContentWorker:function(){var e=new n(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new n(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,i){return e.pipe(new r).pipe(new o("uncompressedSize")).pipe(t.compressWorker(i)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,i){var s=e("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,i){var s=e("./utils"),n=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==s.getTypeOf(e)?function(e,t,i,s){var r=n,o=s+i;e^=-1;for(var a=s;a<o;a++)e=e>>>8^r[255&(e^t[a])];return~e}(0|t,e,e.length,0):function(e,t,i,s){var r=n,o=s+i;e^=-1;for(var a=s;a<o;a++)e=e>>>8^r[255&(e^t.charCodeAt(a))];return~e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(e,t,i){var s=null;s="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:s}},{lie:37}],7:[function(e,t,i){var s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=e("pako"),r=e("./utils"),o=e("./stream/GenericWorker"),a=s?"uint8array":"array";function c(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}i.magic="\b\0",r.inherits(c,o),c.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(r.transformTo(a,e.data),!1)},c.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},i.compressWorker=function(e){return new c("Deflate",e)},i.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,i){function s(e,t){var i,s="";for(i=0;i<t;i++)s+=String.fromCharCode(255&e),e>>>=8;return s}function n(e,t,i,n,o,h){var u,I,d=e.file,E=e.compression,f=h!==a.utf8encode,p=r.transformTo("string",h(d.name)),C=r.transformTo("string",a.utf8encode(d.name)),T=d.comment,m=r.transformTo("string",h(T)),R=r.transformTo("string",a.utf8encode(T)),g=C.length!==d.name.length,A=R.length!==T.length,F="",S="",O="",N=d.dir,y=d.date,L={crc32:0,compressedSize:0,uncompressedSize:0};t&&!i||(L.crc32=e.crc32,L.compressedSize=e.compressedSize,L.uncompressedSize=e.uncompressedSize);var _=0;t&&(_|=8),f||!g&&!A||(_|=2048);var P,w,M,v=0,D=0;N&&(v|=16),"UNIX"===o?(D=798,v|=(P=d.unixPermissions,w=N,M=P,P||(M=w?16893:33204),(65535&M)<<16)):(D=20,v|=function(e){return 63&(e||0)}(d.dosPermissions)),u=y.getUTCHours(),u<<=6,u|=y.getUTCMinutes(),u<<=5,u|=y.getUTCSeconds()/2,I=y.getUTCFullYear()-1980,I<<=4,I|=y.getUTCMonth()+1,I<<=5,I|=y.getUTCDate(),g&&(S=s(1,1)+s(c(p),4)+C,F+="up"+s(S.length,2)+S),A&&(O=s(1,1)+s(c(m),4)+R,F+="uc"+s(O.length,2)+O);var b="";return b+="\n\0",b+=s(_,2),b+=E.magic,b+=s(u,2),b+=s(I,2),b+=s(L.crc32,4),b+=s(L.compressedSize,4),b+=s(L.uncompressedSize,4),b+=s(p.length,2),b+=s(F.length,2),{fileRecord:l.LOCAL_FILE_HEADER+b+p+F,dirRecord:l.CENTRAL_FILE_HEADER+s(D,2)+b+s(m.length,2)+"\0\0\0\0"+s(v,4)+s(n,4)+p+F+m}}var r=e("../utils"),o=e("../stream/GenericWorker"),a=e("../utf8"),c=e("../crc32"),l=e("../signature");function h(e,t,i,s){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=i,this.encodeFileName=s,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}r.inherits(h,o),h.prototype.push=function(e){var t=e.meta.percent||0,i=this.entriesCount,s=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(t+100*(i-s-1))/i:100}}))},h.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var i=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(e){this.accumulate=!1;var t,i=this.streamFiles&&!e.file.dir,r=n(e,i,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),i)this.push({data:(t=e,l.DATA_DESCRIPTOR+s(t.crc32,4)+s(t.compressedSize,4)+s(t.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var i,n,o,a,c,h,u=this.bytesWritten-e,I=(i=this.dirRecords.length,n=u,o=e,a=this.zipComment,c=this.encodeFileName,h=r.transformTo("string",c(a)),l.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(i,2)+s(i,2)+s(n,4)+s(o,4)+s(h.length,2)+h);this.push({data:I,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()})),e.on("error",(function(e){t.error(e)})),this},h.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(e){var t=this._sources;if(!o.prototype.error.call(this,e))return!1;for(var i=0;i<t.length;i++)try{t[i].error(e)}catch(e){}return!0},h.prototype.lock=function(){o.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,i){var s=e("../compressions"),n=e("./ZipFileWorker");i.generateWorker=function(e,t,i){var r=new n(t.streamFiles,i,t.platform,t.encodeFileName),o=0;try{e.forEach((function(e,i){o++;var n=function(e,t){var i=e||t,n=s[i];if(!n)throw new Error(i+" is not a valid compression method !");return n}(i.options.compression,t.compression),a=i.options.compressionOptions||t.compressionOptions||{},c=i.dir,l=i.date;i._compressWorker(n,a).withStreamInfo("file",{name:e,dir:c,date:l,comment:i.comment||"",unixPermissions:i.unixPermissions,dosPermissions:i.dosPermissions}).pipe(r)})),r.entriesCount=o}catch(e){r.error(e)}return r}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,i){function s(){if(!(this instanceof s))return new s;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 e=new s;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(s.prototype=e("./object")).loadAsync=e("./load"),s.support=e("./support"),s.defaults=e("./defaults"),s.version="3.10.1",s.loadAsync=function(e,t){return(new s).loadAsync(e,t)},s.external=e("./external"),t.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,i){var s=e("./utils"),n=e("./external"),r=e("./utf8"),o=e("./zipEntries"),a=e("./stream/Crc32Probe"),c=e("./nodejsUtils");function l(e){return new n.Promise((function(t,i){var s=e.decompressed.getContentWorker().pipe(new a);s.on("error",(function(e){i(e)})).on("end",(function(){s.streamInfo.crc32!==e.decompressed.crc32?i(new Error("Corrupted zip : CRC32 mismatch")):t()})).resume()}))}t.exports=function(e,t){var i=this;return t=s.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:r.utf8decode}),c.isNode&&c.isStream(e)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then((function(e){var i=new o(t);return i.load(e),i})).then((function(e){var i=[n.Promise.resolve(e)],s=e.files;if(t.checkCRC32)for(var r=0;r<s.length;r++)i.push(l(s[r]));return n.Promise.all(i)})).then((function(e){for(var n=e.shift(),r=n.files,o=0;o<r.length;o++){var a=r[o],c=a.fileNameStr,l=s.resolve(a.fileNameStr);i.file(l,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:t.createFolders}),a.dir||(i.file(l).unsafeOriginalName=c)}return n.zipComment.length&&(i.comment=n.zipComment),i}))}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,i){var s=e("../utils"),n=e("../stream/GenericWorker");function r(e,t){n.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}s.inherits(r,n),r.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",(function(e){t.push({data:e,meta:{percent:0}})})).on("error",(function(e){t.isPaused?this.generatedError=e:t.error(e)})).on("end",(function(){t.isPaused?t._upstreamEnded=!0:t.end()}))},r.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},r.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=r},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,i){var s=e("readable-stream").Readable;function n(e,t,i){s.call(this,t),this._helper=e;var n=this;e.on("data",(function(e,t){n.push(e)||n._helper.pause(),i&&i(t)})).on("error",(function(e){n.emit("error",e)})).on("end",(function(){n.push(null)}))}e("../utils").inherits(n,s),n.prototype._read=function(){this._helper.resume()},t.exports=n},{"../utils":32,"readable-stream":16}],14:[function(e,t,i){t.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,i){function s(e,t,i){var s,n=r.getTypeOf(t),a=r.extend(i||{},c);a.date=a.date||new Date,null!==a.compression&&(a.compression=a.compression.toUpperCase()),"string"==typeof a.unixPermissions&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&16384&a.unixPermissions&&(a.dir=!0),a.dosPermissions&&16&a.dosPermissions&&(a.dir=!0),a.dir&&(e=f(e)),a.createFolders&&(s=E(e))&&p.call(this,s,!0);var u="string"===n&&!1===a.binary&&!1===a.base64;i&&void 0!==i.binary||(a.binary=!u),(t instanceof l&&0===t.uncompressedSize||a.dir||!t||0===t.length)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",n="string");var C=null;C=t instanceof l||t instanceof o?t:I.isNode&&I.isStream(t)?new d(e,t):r.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var T=new h(e,C,a);this.files[e]=T}var n=e("./utf8"),r=e("./utils"),o=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),c=e("./defaults"),l=e("./compressedObject"),h=e("./zipObject"),u=e("./generate"),I=e("./nodejsUtils"),d=e("./nodejs/NodejsStreamInputAdapter"),E=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},f=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},p=function(e,t){return t=void 0!==t?t:c.createFolders,e=f(e),this.files[e]||s.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function C(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var T={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,i,s;for(t in this.files)s=this.files[t],(i=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(i,s)},filter:function(e){var t=[];return this.forEach((function(i,s){e(i,s)&&t.push(s)})),t},file:function(e,t,i){if(1!==arguments.length)return e=this.root+e,s.call(this,e,t,i),this;if(C(e)){var n=e;return this.filter((function(e,t){return!t.dir&&n.test(e)}))}var r=this.files[this.root+e];return r&&!r.dir?r:null},folder:function(e){if(!e)return this;if(C(e))return this.filter((function(t,i){return i.dir&&e.test(t)}));var t=this.root+e,i=p.call(this,t),s=this.clone();return s.root=i.name,s},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var i=this.filter((function(t,i){return i.name.slice(0,e.length)===e})),s=0;s<i.length;s++)delete this.files[i[s].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,i={};try{if((i=r.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=i.type.toLowerCase(),i.compression=i.compression.toUpperCase(),"binarystring"===i.type&&(i.type="string"),!i.type)throw new Error("No output type specified.");r.checkSupport(i.type),"darwin"!==i.platform&&"freebsd"!==i.platform&&"linux"!==i.platform&&"sunos"!==i.platform||(i.platform="UNIX"),"win32"===i.platform&&(i.platform="DOS");var s=i.comment||this.comment||"";t=u.generateWorker(this,i,s)}catch(e){(t=new o("error")).error(e)}return new a(t,i.type||"string",i.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=T},{"./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(e,t,i){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,i){var s=e("./DataReader");function n(e){s.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(n,s),n.prototype.byteAt=function(e){return this.data[this.zero+e]},n.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),i=e.charCodeAt(1),s=e.charCodeAt(2),n=e.charCodeAt(3),r=this.length-4;0<=r;--r)if(this.data[r]===t&&this.data[r+1]===i&&this.data[r+2]===s&&this.data[r+3]===n)return r-this.zero;return-1},n.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),i=e.charCodeAt(1),s=e.charCodeAt(2),n=e.charCodeAt(3),r=this.readData(4);return t===r[0]&&i===r[1]&&s===r[2]&&n===r[3]},n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,i){var s=e("../utils");function n(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,i=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)i=(i<<8)+this.byteAt(t);return this.index+=e,i},readString:function(e){return s.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,i){var s=e("./Uint8ArrayReader");function n(e){s.call(this,e)}e("../utils").inherits(n,s),n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,i){var s=e("./DataReader");function n(e){s.call(this,e)}e("../utils").inherits(n,s),n.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},n.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},n.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,i){var s=e("./ArrayReader");function n(e){s.call(this,e)}e("../utils").inherits(n,s),n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,i){var s=e("../utils"),n=e("../support"),r=e("./ArrayReader"),o=e("./StringReader"),a=e("./NodeBufferReader"),c=e("./Uint8ArrayReader");t.exports=function(e){var t=s.getTypeOf(e);return s.checkSupport(t),"string"!==t||n.uint8array?"nodebuffer"===t?new a(e):n.uint8array?new c(s.transformTo("uint8array",e)):new r(s.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,i){var s=e("./GenericWorker"),n=e("../utils");function r(e){s.call(this,"ConvertWorker to "+e),this.destType=e}n.inherits(r,s),r.prototype.processChunk=function(e){this.push({data:n.transformTo(this.destType,e.data),meta:e.meta})},t.exports=r},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,i){var s=e("./GenericWorker"),n=e("../crc32");function r(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(r,s),r.prototype.processChunk=function(e){this.streamInfo.crc32=n(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=r},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,i){var s=e("../utils"),n=e("./GenericWorker");function r(e){n.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}s.inherits(r,n),r.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}n.prototype.processChunk.call(this,e)},t.exports=r},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,i){var s=e("../utils"),n=e("./GenericWorker");function r(e){n.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=s.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}s.inherits(r,n),r.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},r.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},r.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},r.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=r},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,i){function s(e){this.name=e||"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}s.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var i=0;i<this._listeners[e].length;i++)this._listeners[e][i].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.end()})),e.on("error",(function(e){t.error(e)})),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 e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},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 e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=s},{}],29:[function(e,t,i){var s=e("../utils"),n=e("./ConvertWorker"),r=e("./GenericWorker"),o=e("../base64"),a=e("../support"),c=e("../external"),l=null;if(a.nodestream)try{l=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function h(e,t){return new c.Promise((function(i,n){var r=[],a=e._internalType,c=e._outputType,l=e._mimeType;e.on("data",(function(e,i){r.push(e),t&&t(i)})).on("error",(function(e){r=[],n(e)})).on("end",(function(){try{var e=function(e,t,i){switch(e){case"blob":return s.newBlob(s.transformTo("arraybuffer",t),i);case"base64":return o.encode(t);default:return s.transformTo(e,t)}}(c,function(e,t){var i,s=0,n=null,r=0;for(i=0;i<t.length;i++)r+=t[i].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(n=new Uint8Array(r),i=0;i<t.length;i++)n.set(t[i],s),s+=t[i].length;return n;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(a,r),l);i(e)}catch(e){n(e)}r=[]})).resume()}))}function u(e,t,i){var o=t;switch(t){case"blob":case"arraybuffer":o="uint8array";break;case"base64":o="string"}try{this._internalType=o,this._outputType=t,this._mimeType=i,s.checkSupport(o),this._worker=e.pipe(new n(o)),e.lock()}catch(e){this._worker=new r("error"),this._worker.error(e)}}u.prototype={accumulate:function(e){return h(this,e)},on:function(e,t){var i=this;return"data"===e?this._worker.on(e,(function(e){t.call(i,e.data,e.meta)})):this._worker.on(e,(function(){s.delay(t,arguments,i)})),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(s.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new l(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=u},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,i.nodebuffer="undefined"!=typeof Buffer,i.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=0===new Blob([s],{type:"application/zip"}).size}catch(e){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(s),i.blob=0===n.getBlob("application/zip").size}catch(e){i.blob=!1}}}try{i.nodestream=!!e("readable-stream").Readable}catch(e){i.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,i){for(var s=e("./utils"),n=e("./support"),r=e("./nodejsUtils"),o=e("./stream/GenericWorker"),a=new Array(256),c=0;c<256;c++)a[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function l(){o.call(this,"utf-8 decode"),this.leftOver=null}function h(){o.call(this,"utf-8 encode")}a[254]=a[254]=1,i.utf8encode=function(e){return n.nodebuffer?r.newBufferFrom(e,"utf-8"):function(e){var t,i,s,r,o,a=e.length,c=0;for(r=0;r<a;r++)55296==(64512&(i=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(s=e.charCodeAt(r+1)))&&(i=65536+(i-55296<<10)+(s-56320),r++),c+=i<128?1:i<2048?2:i<65536?3:4;for(t=n.uint8array?new Uint8Array(c):new Array(c),r=o=0;o<c;r++)55296==(64512&(i=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(s=e.charCodeAt(r+1)))&&(i=65536+(i-55296<<10)+(s-56320),r++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t}(e)},i.utf8decode=function(e){return n.nodebuffer?s.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,i,n,r,o=e.length,c=new Array(2*o);for(t=i=0;t<o;)if((n=e[t++])<128)c[i++]=n;else if(4<(r=a[n]))c[i++]=65533,t+=r-1;else{for(n&=2===r?31:3===r?15:7;1<r&&t<o;)n=n<<6|63&e[t++],r--;1<r?c[i++]=65533:n<65536?c[i++]=n:(n-=65536,c[i++]=55296|n>>10&1023,c[i++]=56320|1023&n)}return c.length!==i&&(c.subarray?c=c.subarray(0,i):c.length=i),s.applyFromCharCode(c)}(e=s.transformTo(n.uint8array?"uint8array":"array",e))},s.inherits(l,o),l.prototype.processChunk=function(e){var t=s.transformTo(n.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var r=t;(t=new Uint8Array(r.length+this.leftOver.length)).set(this.leftOver,0),t.set(r,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+a[e[i]]>t?i:t}(t),c=t;o!==t.length&&(n.uint8array?(c=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(c=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:i.utf8decode(c),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=l,s.inherits(h,o),h.prototype.processChunk=function(e){this.push({data:i.utf8encode(e.data),meta:e.meta})},i.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,i){var s=e("./support"),n=e("./base64"),r=e("./nodejsUtils"),o=e("./external");function a(e){return e}function c(e,t){for(var i=0;i<e.length;++i)t[i]=255&e.charCodeAt(i);return t}e("setimmediate"),i.newBlob=function(e,t){i.checkSupport("blob");try{return new Blob([e],{type:t})}catch(i){try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return s.append(e),s.getBlob(t)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var l={stringifyByChunk:function(e,t,i){var s=[],n=0,r=e.length;if(r<=i)return String.fromCharCode.apply(null,e);for(;n<r;)"array"===t||"nodebuffer"===t?s.push(String.fromCharCode.apply(null,e.slice(n,Math.min(n+i,r)))):s.push(String.fromCharCode.apply(null,e.subarray(n,Math.min(n+i,r)))),n+=i;return s.join("")},stringifyByChar:function(e){for(var t="",i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return t},applyCanBeUsed:{uint8array:function(){try{return s.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return s.nodebuffer&&1===String.fromCharCode.apply(null,r.allocBuffer(1)).length}catch(e){return!1}}()}};function h(e){var t=65536,s=i.getTypeOf(e),n=!0;if("uint8array"===s?n=l.applyCanBeUsed.uint8array:"nodebuffer"===s&&(n=l.applyCanBeUsed.nodebuffer),n)for(;1<t;)try{return l.stringifyByChunk(e,s,t)}catch(e){t=Math.floor(t/2)}return l.stringifyByChar(e)}function u(e,t){for(var i=0;i<e.length;i++)t[i]=e[i];return t}i.applyFromCharCode=h;var I={};I.string={string:a,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return I.string.uint8array(e).buffer},uint8array:function(e){return c(e,new Uint8Array(e.length))},nodebuffer:function(e){return c(e,r.allocBuffer(e.length))}},I.array={string:h,array:a,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return r.newBufferFrom(e)}},I.arraybuffer={string:function(e){return h(new Uint8Array(e))},array:function(e){return u(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:a,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return r.newBufferFrom(new Uint8Array(e))}},I.uint8array={string:h,array:function(e){return u(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:a,nodebuffer:function(e){return r.newBufferFrom(e)}},I.nodebuffer={string:h,array:function(e){return u(e,new Array(e.length))},arraybuffer:function(e){return I.nodebuffer.uint8array(e).buffer},uint8array:function(e){return u(e,new Uint8Array(e.length))},nodebuffer:a},i.transformTo=function(e,t){if(t=t||"",!e)return t;i.checkSupport(e);var s=i.getTypeOf(t);return I[s][e](t)},i.resolve=function(e){for(var t=e.split("/"),i=[],s=0;s<t.length;s++){var n=t[s];"."===n||""===n&&0!==s&&s!==t.length-1||(".."===n?i.pop():i.push(n))}return i.join("/")},i.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":s.nodebuffer&&r.isBuffer(e)?"nodebuffer":s.uint8array&&e instanceof Uint8Array?"uint8array":s.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(e){if(!s[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(e){var t,i,s="";for(i=0;i<(e||"").length;i++)s+="\\x"+((t=e.charCodeAt(i))<16?"0":"")+t.toString(16).toUpperCase();return s},i.delay=function(e,t,i){setImmediate((function(){e.apply(i||null,t||[])}))},i.inherits=function(e,t){function i(){}i.prototype=t.prototype,e.prototype=new i},i.extend=function(){var e,t,i={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===i[t]&&(i[t]=arguments[e][t]);return i},i.prepareContent=function(e,t,r,a,l){return o.Promise.resolve(t).then((function(e){return s.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new o.Promise((function(t,i){var s=new FileReader;s.onload=function(e){t(e.target.result)},s.onerror=function(e){i(e.target.error)},s.readAsArrayBuffer(e)})):e})).then((function(t){var h,u=i.getTypeOf(t);return u?("arraybuffer"===u?t=i.transformTo("uint8array",t):"string"===u&&(l?t=n.decode(t):r&&!0!==a&&(t=c(h=t,s.uint8array?new Uint8Array(h.length):new Array(h.length)))),t):o.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))}))}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,i){var s=e("./reader/readerFor"),n=e("./utils"),r=e("./signature"),o=e("./zipEntry"),a=e("./support");function c(e){this.files=[],this.loadOptions=e}c.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(t)+", expected "+n.pretty(e)+")")}},isSignature:function(e,t){var i=this.reader.index;this.reader.setIndex(e);var s=this.reader.readString(4)===t;return this.reader.setIndex(i),s},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 e=this.reader.readData(this.zipCommentLength),t=a.uint8array?"uint8array":"array",i=n.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(i)},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 e,t,i,s=this.zip64EndOfCentralSize-44;0<s;)e=this.reader.readInt(2),t=this.reader.readInt(4),i=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:i}},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 e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(r.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(r.CENTRAL_FILE_HEADER);)(e=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(r.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,r.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(e);var t=e;if(this.checkSignature(r.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(r.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(r.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,r.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(r.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(r.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var i=this.centralDirOffset+this.centralDirSize;this.zip64&&(i+=20,i+=12+this.zip64EndOfCentralSize);var s=t-i;if(0<s)this.isSignature(t,r.CENTRAL_FILE_HEADER)||(this.reader.zero=s);else if(s<0)throw new Error("Corrupted zip: missing "+Math.abs(s)+" bytes.")},prepareReader:function(e){this.reader=s(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=c},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,i){var s=e("./reader/readerFor"),n=e("./utils"),r=e("./compressedObject"),o=e("./crc32"),a=e("./utf8"),c=e("./compressions"),l=e("./support");function h(e,t){this.options=e,this.loadOptions=t}h.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(e){var t,i;if(e.skip(22),this.fileNameLength=e.readInt(2),i=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(i),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in c)if(Object.prototype.hasOwnProperty.call(c,t)&&c[t].magic===e)return c[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new r(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=s(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,i,s,n=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<n;)t=e.readInt(2),i=e.readInt(2),s=e.readData(i),this.extraFields[t]={id:t,length:i,value:s};e.setIndex(n)},handleUTF8:function(){var e=l.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var i=n.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var s=this.findExtraFieldUnicodeComment();if(null!==s)this.fileCommentStr=s;else{var r=n.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(r)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=s(e.value);return 1!==t.readInt(1)||o(this.fileName)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=s(e.value);return 1!==t.readInt(1)||o(this.fileComment)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null}},t.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,i){function s(e,t,i){this.name=e,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=t,this._dataBinary=i.binary,this.options={compression:i.compression,compressionOptions:i.compressionOptions}}var n=e("./stream/StreamHelper"),r=e("./stream/DataWorker"),o=e("./utf8"),a=e("./compressedObject"),c=e("./stream/GenericWorker");s.prototype={internalStream:function(e){var t=null,i="string";try{if(!e)throw new Error("No output type specified.");var s="string"===(i=e.toLowerCase())||"text"===i;"binarystring"!==i&&"text"!==i||(i="string"),t=this._decompressWorker();var r=!this._dataBinary;r&&!s&&(t=t.pipe(new o.Utf8EncodeWorker)),!r&&s&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(e){(t=new c("error")).error(e)}return new n(t,i,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof a&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new o.Utf8EncodeWorker)),a.createWorkerFrom(i,e,t)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof c?this._data:new r(this._data)}};for(var l=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},u=0;u<l.length;u++)s.prototype[l[u]]=h;t.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,i){(function(e){var i,s,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var r=0,o=new n(h),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),i=function(){a.data=r=++r%2}}else if(e.setImmediate||void 0===e.MessageChannel)i="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){h(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(h,0)};else{var c=new e.MessageChannel;c.port1.onmessage=h,i=function(){c.port2.postMessage(0)}}var l=[];function h(){var e,t;s=!0;for(var i=l.length;i;){for(t=l,l=[],e=-1;++e<i;)t[e]();i=l.length}s=!1}t.exports=function(e){1!==l.push(e)||s||i()}}).call(this,void 0!==qn?qn:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,i){var s=e("immediate");function n(){}var r={},o=["REJECTED"],a=["FULFILLED"],c=["PENDING"];function l(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==n&&d(this,e)}function h(e,t,i){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof i&&(this.onRejected=i,this.callRejected=this.otherCallRejected)}function u(e,t,i){s((function(){var s;try{s=t(i)}catch(t){return r.reject(e,t)}s===e?r.reject(e,new TypeError("Cannot resolve promise with itself")):r.resolve(e,s)}))}function I(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(e,t){var i=!1;function s(t){i||(i=!0,r.reject(e,t))}function n(t){i||(i=!0,r.resolve(e,t))}var o=E((function(){t(n,s)}));"error"===o.status&&s(o.value)}function E(e,t){var i={};try{i.value=e(t),i.status="success"}catch(e){i.status="error",i.value=e}return i}(t.exports=l).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then((function(i){return t.resolve(e()).then((function(){return i}))}),(function(i){return t.resolve(e()).then((function(){throw i}))}))},l.prototype.catch=function(e){return this.then(null,e)},l.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var i=new this.constructor(n);return this.state!==c?u(i,this.state===a?e:t,this.outcome):this.queue.push(new h(i,e,t)),i},h.prototype.callFulfilled=function(e){r.resolve(this.promise,e)},h.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},h.prototype.callRejected=function(e){r.reject(this.promise,e)},h.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},r.resolve=function(e,t){var i=E(I,t);if("error"===i.status)return r.reject(e,i.value);var s=i.value;if(s)d(e,s);else{e.state=a,e.outcome=t;for(var n=-1,o=e.queue.length;++n<o;)e.queue[n].callFulfilled(t)}return e},r.reject=function(e,t){e.state=o,e.outcome=t;for(var i=-1,s=e.queue.length;++i<s;)e.queue[i].callRejected(t);return e},l.resolve=function(e){return e instanceof this?e:r.resolve(new this(n),e)},l.reject=function(e){var t=new this(n);return r.reject(t,e)},l.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,s=!1;if(!i)return this.resolve([]);for(var o=new Array(i),a=0,c=-1,l=new this(n);++c<i;)h(e[c],c);return l;function h(e,n){t.resolve(e).then((function(e){o[n]=e,++a!==i||s||(s=!0,r.resolve(l,o))}),(function(e){s||(s=!0,r.reject(l,e))}))}},l.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,s=!1;if(!i)return this.resolve([]);for(var o,a=-1,c=new this(n);++a<i;)o=e[a],t.resolve(o).then((function(e){s||(s=!0,r.resolve(c,e))}),(function(e){s||(s=!0,r.reject(c,e))}));return c}},{immediate:36}],38:[function(e,t,i){var s={};(0,e("./lib/utils/common").assign)(s,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,i){var s=e("./zlib/deflate"),n=e("./utils/common"),r=e("./utils/strings"),o=e("./zlib/messages"),a=e("./zlib/zstream"),c=Object.prototype.toString,l=0,h=-1,u=0,I=8;function d(e){if(!(this instanceof d))return new d(e);this.options=n.assign({level:h,method:I,chunkSize:16384,windowBits:15,memLevel:8,strategy:u,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var i=s.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==l)throw new Error(o[i]);if(t.header&&s.deflateSetHeader(this.strm,t.header),t.dictionary){var E;if(E="string"==typeof t.dictionary?r.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(i=s.deflateSetDictionary(this.strm,E))!==l)throw new Error(o[i]);this._dict_set=!0}}function E(e,t){var i=new d(t);if(i.push(e,!0),i.err)throw i.msg||o[i.err];return i.result}d.prototype.push=function(e,t){var i,o,a=this.strm,h=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=r.string2buf(e):"[object ArrayBuffer]"===c.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new n.Buf8(h),a.next_out=0,a.avail_out=h),1!==(i=s.deflate(a,o))&&i!==l)return this.onEnd(i),!(this.ended=!0);0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(r.buf2binstring(n.shrinkBuf(a.output,a.next_out))):this.onData(n.shrinkBuf(a.output,a.next_out)))}while((0<a.avail_in||0===a.avail_out)&&1!==i);return 4===o?(i=s.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===l):2!==o||(this.onEnd(l),!(a.avail_out=0))},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===l&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Deflate=d,i.deflate=E,i.deflateRaw=function(e,t){return(t=t||{}).raw=!0,E(e,t)},i.gzip=function(e,t){return(t=t||{}).gzip=!0,E(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,i){var s=e("./zlib/inflate"),n=e("./utils/common"),r=e("./utils/strings"),o=e("./zlib/constants"),a=e("./zlib/messages"),c=e("./zlib/zstream"),l=e("./zlib/gzheader"),h=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var i=s.inflateInit2(this.strm,t.windowBits);if(i!==o.Z_OK)throw new Error(a[i]);this.header=new l,s.inflateGetHeader(this.strm,this.header)}function I(e,t){var i=new u(t);if(i.push(e,!0),i.err)throw i.msg||a[i.err];return i.result}u.prototype.push=function(e,t){var i,a,c,l,u,I,d=this.strm,E=this.options.chunkSize,f=this.options.dictionary,p=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?d.input=r.binstring2buf(e):"[object ArrayBuffer]"===h.call(e)?d.input=new Uint8Array(e):d.input=e,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new n.Buf8(E),d.next_out=0,d.avail_out=E),(i=s.inflate(d,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&f&&(I="string"==typeof f?r.string2buf(f):"[object ArrayBuffer]"===h.call(f)?new Uint8Array(f):f,i=s.inflateSetDictionary(this.strm,I)),i===o.Z_BUF_ERROR&&!0===p&&(i=o.Z_OK,p=!1),i!==o.Z_STREAM_END&&i!==o.Z_OK)return this.onEnd(i),!(this.ended=!0);d.next_out&&(0!==d.avail_out&&i!==o.Z_STREAM_END&&(0!==d.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(c=r.utf8border(d.output,d.next_out),l=d.next_out-c,u=r.buf2string(d.output,c),d.next_out=l,d.avail_out=E-l,l&&n.arraySet(d.output,d.output,c,l,0),this.onData(u)):this.onData(n.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(p=!0)}while((0<d.avail_in||0===d.avail_out)&&i!==o.Z_STREAM_END);return i===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(i=s.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(d.avail_out=0))},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Inflate=u,i.inflate=I,i.inflateRaw=function(e,t){return(t=t||{}).raw=!0,I(e,t)},i.ungzip=I},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,i){var s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;i.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var s in i)i.hasOwnProperty(s)&&(e[s]=i[s])}}return e},i.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,i,s,n){if(t.subarray&&e.subarray)e.set(t.subarray(i,i+s),n);else for(var r=0;r<s;r++)e[n+r]=t[i+r]},flattenChunks:function(e){var t,i,s,n,r,o;for(t=s=0,i=e.length;t<i;t++)s+=e[t].length;for(o=new Uint8Array(s),t=n=0,i=e.length;t<i;t++)r=e[t],o.set(r,n),n+=r.length;return o}},r={arraySet:function(e,t,i,s,n){for(var r=0;r<s;r++)e[n+r]=t[i+r]},flattenChunks:function(e){return[].concat.apply([],e)}};i.setTyped=function(e){e?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,n)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,r))},i.setTyped(s)},{}],42:[function(e,t,i){var s=e("./common"),n=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch(e){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){r=!1}for(var o=new s.Buf8(256),a=0;a<256;a++)o[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function c(e,t){if(t<65537&&(e.subarray&&r||!e.subarray&&n))return String.fromCharCode.apply(null,s.shrinkBuf(e,t));for(var i="",o=0;o<t;o++)i+=String.fromCharCode(e[o]);return i}o[254]=o[254]=1,i.string2buf=function(e){var t,i,n,r,o,a=e.length,c=0;for(r=0;r<a;r++)55296==(64512&(i=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(n=e.charCodeAt(r+1)))&&(i=65536+(i-55296<<10)+(n-56320),r++),c+=i<128?1:i<2048?2:i<65536?3:4;for(t=new s.Buf8(c),r=o=0;o<c;r++)55296==(64512&(i=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(n=e.charCodeAt(r+1)))&&(i=65536+(i-55296<<10)+(n-56320),r++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t},i.buf2binstring=function(e){return c(e,e.length)},i.binstring2buf=function(e){for(var t=new s.Buf8(e.length),i=0,n=t.length;i<n;i++)t[i]=e.charCodeAt(i);return t},i.buf2string=function(e,t){var i,s,n,r,a=t||e.length,l=new Array(2*a);for(i=s=0;i<a;)if((n=e[i++])<128)l[s++]=n;else if(4<(r=o[n]))l[s++]=65533,i+=r-1;else{for(n&=2===r?31:3===r?15:7;1<r&&i<a;)n=n<<6|63&e[i++],r--;1<r?l[s++]=65533:n<65536?l[s++]=n:(n-=65536,l[s++]=55296|n>>10&1023,l[s++]=56320|1023&n)}return c(l,s)},i.utf8border=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+o[e[i]]>t?i:t}},{"./common":41}],43:[function(e,t,i){t.exports=function(e,t,i,s){for(var n=65535&e,r=e>>>16&65535,o=0;0!==i;){for(i-=o=2e3<i?2e3:i;r=r+(n=n+t[s++]|0)|0,--o;);n%=65521,r%=65521}return n|r<<16}},{}],44:[function(e,t,i){t.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(e,t,i){var s=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();t.exports=function(e,t,i,n){var r=s,o=n+i;e^=-1;for(var a=n;a<o;a++)e=e>>>8^r[255&(e^t[a])];return~e}},{}],46:[function(e,t,i){var s,n=e("../utils/common"),r=e("./trees"),o=e("./adler32"),a=e("./crc32"),c=e("./messages"),l=0,h=4,u=0,I=-2,d=-1,E=4,f=2,p=8,C=9,T=286,m=30,R=19,g=2*T+1,A=15,F=3,S=258,O=S+F+1,N=42,y=113,L=1,_=2,P=3,w=4;function M(e,t){return e.msg=c[t],t}function v(e){return(e<<1)-(4<e?9:0)}function D(e){for(var t=e.length;0<=--t;)e[t]=0}function b(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(n.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))}function U(e,t){r._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,b(e.strm)}function x(e,t){e.pending_buf[e.pending++]=t}function B(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function V(e,t){var i,s,n=e.max_chain_length,r=e.strstart,o=e.prev_length,a=e.nice_match,c=e.strstart>e.w_size-O?e.strstart-(e.w_size-O):0,l=e.window,h=e.w_mask,u=e.prev,I=e.strstart+S,d=l[r+o-1],E=l[r+o];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do{if(l[(i=t)+o]===E&&l[i+o-1]===d&&l[i]===l[r]&&l[++i]===l[r+1]){r+=2,i++;do{}while(l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&r<I);if(s=S-(I-r),r=I-S,o<s){if(e.match_start=t,a<=(o=s))break;d=l[r+o-1],E=l[r+o]}}}while((t=u[t&h])>c&&0!=--n);return o<=e.lookahead?o:e.lookahead}function Y(e){var t,i,s,r,c,l,h,u,I,d,E=e.w_size;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=E+(E-O)){for(n.arraySet(e.window,e.window,E,E,0),e.match_start-=E,e.strstart-=E,e.block_start-=E,t=i=e.hash_size;s=e.head[--t],e.head[t]=E<=s?s-E:0,--i;);for(t=i=E;s=e.prev[--t],e.prev[t]=E<=s?s-E:0,--i;);r+=E}if(0===e.strm.avail_in)break;if(l=e.strm,h=e.window,u=e.strstart+e.lookahead,d=void 0,(I=r)<(d=l.avail_in)&&(d=I),i=0===d?0:(l.avail_in-=d,n.arraySet(h,l.input,l.next_in,d,u),1===l.state.wrap?l.adler=o(l.adler,h,d,u):2===l.state.wrap&&(l.adler=a(l.adler,h,d,u)),l.next_in+=d,l.total_in+=d,d),e.lookahead+=i,e.lookahead+e.insert>=F)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+F-1])&e.hash_mask,e.prev[c&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=c,c++,e.insert--,!(e.lookahead+e.insert<F)););}while(e.lookahead<O&&0!==e.strm.avail_in)}function G(e,t){for(var i,s;;){if(e.lookahead<O){if(Y(e),e.lookahead<O&&t===l)return L;if(0===e.lookahead)break}if(i=0,e.lookahead>=F&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-O&&(e.match_length=V(e,i)),e.match_length>=F)if(s=r._tr_tally(e,e.strstart-e.match_start,e.match_length-F),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=F){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else s=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(s&&(U(e,!1),0===e.strm.avail_out))return L}return e.insert=e.strstart<F-1?e.strstart:F-1,t===h?(U(e,!0),0===e.strm.avail_out?P:w):e.last_lit&&(U(e,!1),0===e.strm.avail_out)?L:_}function z(e,t){for(var i,s,n;;){if(e.lookahead<O){if(Y(e),e.lookahead<O&&t===l)return L;if(0===e.lookahead)break}if(i=0,e.lookahead>=F&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=F-1,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-O&&(e.match_length=V(e,i),e.match_length<=5&&(1===e.strategy||e.match_length===F&&4096<e.strstart-e.match_start)&&(e.match_length=F-1)),e.prev_length>=F&&e.match_length<=e.prev_length){for(n=e.strstart+e.lookahead-F,s=r._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-F),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=F-1,e.strstart++,s&&(U(e,!1),0===e.strm.avail_out))return L}else if(e.match_available){if((s=r._tr_tally(e,0,e.window[e.strstart-1]))&&U(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return L}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(s=r._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<F-1?e.strstart:F-1,t===h?(U(e,!0),0===e.strm.avail_out?P:w):e.last_lit&&(U(e,!1),0===e.strm.avail_out)?L:_}function k(e,t,i,s,n){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=s,this.func=n}function H(){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=p,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 n.Buf16(2*g),this.dyn_dtree=new n.Buf16(2*(2*m+1)),this.bl_tree=new n.Buf16(2*(2*R+1)),D(this.dyn_ltree),D(this.dyn_dtree),D(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(A+1),this.heap=new n.Buf16(2*T+1),D(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(2*T+1),D(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 W(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=f,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?N:y,e.adler=2===t.wrap?0:1,t.last_flush=l,r._tr_init(t),u):M(e,I)}function X(e){var t,i=W(e);return i===u&&((t=e.state).window_size=2*t.w_size,D(t.head),t.max_lazy_match=s[t.level].max_lazy,t.good_match=s[t.level].good_length,t.nice_match=s[t.level].nice_length,t.max_chain_length=s[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=F-1,t.match_available=0,t.ins_h=0),i}function j(e,t,i,s,r,o){if(!e)return I;var a=1;if(t===d&&(t=6),s<0?(a=0,s=-s):15<s&&(a=2,s-=16),r<1||C<r||i!==p||s<8||15<s||t<0||9<t||o<0||E<o)return M(e,I);8===s&&(s=9);var c=new H;return(e.state=c).strm=e,c.wrap=a,c.gzhead=null,c.w_bits=s,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.hash_bits=r+7,c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+F-1)/F),c.window=new n.Buf8(2*c.w_size),c.head=new n.Buf16(c.hash_size),c.prev=new n.Buf16(c.w_size),c.lit_bufsize=1<<r+6,c.pending_buf_size=4*c.lit_bufsize,c.pending_buf=new n.Buf8(c.pending_buf_size),c.d_buf=1*c.lit_bufsize,c.l_buf=3*c.lit_bufsize,c.level=t,c.strategy=o,c.method=i,X(e)}s=[new k(0,0,0,0,(function(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Y(e),0===e.lookahead&&t===l)return L;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var s=e.block_start+i;if((0===e.strstart||e.strstart>=s)&&(e.lookahead=e.strstart-s,e.strstart=s,U(e,!1),0===e.strm.avail_out))return L;if(e.strstart-e.block_start>=e.w_size-O&&(U(e,!1),0===e.strm.avail_out))return L}return e.insert=0,t===h?(U(e,!0),0===e.strm.avail_out?P:w):(e.strstart>e.block_start&&(U(e,!1),e.strm.avail_out),L)})),new k(4,4,8,4,G),new k(4,5,16,8,G),new k(4,6,32,32,G),new k(4,4,16,16,z),new k(8,16,32,32,z),new k(8,16,128,128,z),new k(8,32,128,256,z),new k(32,128,258,1024,z),new k(32,258,258,4096,z)],i.deflateInit=function(e,t){return j(e,t,p,15,8,0)},i.deflateInit2=j,i.deflateReset=X,i.deflateResetKeep=W,i.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?I:(e.state.gzhead=t,u):I},i.deflate=function(e,t){var i,n,o,c;if(!e||!e.state||5<t||t<0)return e?M(e,I):I;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&t!==h)return M(e,0===e.avail_out?-5:I);if(n.strm=e,i=n.last_flush,n.last_flush=t,n.status===N)if(2===n.wrap)e.adler=0,x(n,31),x(n,139),x(n,8),n.gzhead?(x(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)),x(n,255&n.gzhead.time),x(n,n.gzhead.time>>8&255),x(n,n.gzhead.time>>16&255),x(n,n.gzhead.time>>24&255),x(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),x(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(x(n,255&n.gzhead.extra.length),x(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=a(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(x(n,0),x(n,0),x(n,0),x(n,0),x(n,0),x(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),x(n,3),n.status=y);else{var d=p+(n.w_bits-8<<4)<<8;d|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(d|=32),d+=31-d%31,n.status=y,B(n,d),0!==n.strstart&&(B(n,e.adler>>>16),B(n,65535&e.adler)),e.adler=1}if(69===n.status)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&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),b(e),o=n.pending,n.pending!==n.pending_buf_size));)x(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.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(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),b(e),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,x(n,c)}while(0!==c);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),b(e),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,x(n,c)}while(0!==c);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&b(e),n.pending+2<=n.pending_buf_size&&(x(n,255&e.adler),x(n,e.adler>>8&255),e.adler=0,n.status=y)):n.status=y),0!==n.pending){if(b(e),0===e.avail_out)return n.last_flush=-1,u}else if(0===e.avail_in&&v(t)<=v(i)&&t!==h)return M(e,-5);if(666===n.status&&0!==e.avail_in)return M(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==l&&666!==n.status){var E=2===n.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(Y(e),0===e.lookahead)){if(t===l)return L;break}if(e.match_length=0,i=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(U(e,!1),0===e.strm.avail_out))return L}return e.insert=0,t===h?(U(e,!0),0===e.strm.avail_out?P:w):e.last_lit&&(U(e,!1),0===e.strm.avail_out)?L:_}(n,t):3===n.strategy?function(e,t){for(var i,s,n,o,a=e.window;;){if(e.lookahead<=S){if(Y(e),e.lookahead<=S&&t===l)return L;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=F&&0<e.strstart&&(s=a[n=e.strstart-1])===a[++n]&&s===a[++n]&&s===a[++n]){o=e.strstart+S;do{}while(s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&n<o);e.match_length=S-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=F?(i=r._tr_tally(e,1,e.match_length-F),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(U(e,!1),0===e.strm.avail_out))return L}return e.insert=0,t===h?(U(e,!0),0===e.strm.avail_out?P:w):e.last_lit&&(U(e,!1),0===e.strm.avail_out)?L:_}(n,t):s[n.level].func(n,t);if(E!==P&&E!==w||(n.status=666),E===L||E===P)return 0===e.avail_out&&(n.last_flush=-1),u;if(E===_&&(1===t?r._tr_align(n):5!==t&&(r._tr_stored_block(n,0,0,!1),3===t&&(D(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),b(e),0===e.avail_out))return n.last_flush=-1,u}return t!==h?u:n.wrap<=0?1:(2===n.wrap?(x(n,255&e.adler),x(n,e.adler>>8&255),x(n,e.adler>>16&255),x(n,e.adler>>24&255),x(n,255&e.total_in),x(n,e.total_in>>8&255),x(n,e.total_in>>16&255),x(n,e.total_in>>24&255)):(B(n,e.adler>>>16),B(n,65535&e.adler)),b(e),0<n.wrap&&(n.wrap=-n.wrap),0!==n.pending?u:1)},i.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==N&&69!==t&&73!==t&&91!==t&&103!==t&&t!==y&&666!==t?M(e,I):(e.state=null,t===y?M(e,-3):u):I},i.deflateSetDictionary=function(e,t){var i,s,r,a,c,l,h,d,E=t.length;if(!e||!e.state)return I;if(2===(a=(i=e.state).wrap)||1===a&&i.status!==N||i.lookahead)return I;for(1===a&&(e.adler=o(e.adler,t,E,0)),i.wrap=0,E>=i.w_size&&(0===a&&(D(i.head),i.strstart=0,i.block_start=0,i.insert=0),d=new n.Buf8(i.w_size),n.arraySet(d,t,E-i.w_size,i.w_size,0),t=d,E=i.w_size),c=e.avail_in,l=e.next_in,h=e.input,e.avail_in=E,e.next_in=0,e.input=t,Y(i);i.lookahead>=F;){for(s=i.strstart,r=i.lookahead-(F-1);i.ins_h=(i.ins_h<<i.hash_shift^i.window[s+F-1])&i.hash_mask,i.prev[s&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=s,s++,--r;);i.strstart=s,i.lookahead=F-1,Y(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=F-1,i.match_available=0,e.next_in=l,e.input=h,e.avail_in=c,i.wrap=a,u},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,i){t.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(e,t,i){t.exports=function(e,t){var i,s,n,r,o,a,c,l,h,u,I,d,E,f,p,C,T,m,R,g,A,F,S,O,N;i=e.state,s=e.next_in,O=e.input,n=s+(e.avail_in-5),r=e.next_out,N=e.output,o=r-(t-e.avail_out),a=r+(e.avail_out-257),c=i.dmax,l=i.wsize,h=i.whave,u=i.wnext,I=i.window,d=i.hold,E=i.bits,f=i.lencode,p=i.distcode,C=(1<<i.lenbits)-1,T=(1<<i.distbits)-1;e:do{E<15&&(d+=O[s++]<<E,E+=8,d+=O[s++]<<E,E+=8),m=f[d&C];t:for(;;){if(d>>>=R=m>>>24,E-=R,0==(R=m>>>16&255))N[r++]=65535&m;else{if(!(16&R)){if(!(64&R)){m=f[(65535&m)+(d&(1<<R)-1)];continue t}if(32&R){i.mode=12;break e}e.msg="invalid literal/length code",i.mode=30;break e}g=65535&m,(R&=15)&&(E<R&&(d+=O[s++]<<E,E+=8),g+=d&(1<<R)-1,d>>>=R,E-=R),E<15&&(d+=O[s++]<<E,E+=8,d+=O[s++]<<E,E+=8),m=p[d&T];i:for(;;){if(d>>>=R=m>>>24,E-=R,!(16&(R=m>>>16&255))){if(!(64&R)){m=p[(65535&m)+(d&(1<<R)-1)];continue i}e.msg="invalid distance code",i.mode=30;break e}if(A=65535&m,E<(R&=15)&&(d+=O[s++]<<E,(E+=8)<R&&(d+=O[s++]<<E,E+=8)),c<(A+=d&(1<<R)-1)){e.msg="invalid distance too far back",i.mode=30;break e}if(d>>>=R,E-=R,(R=r-o)<A){if(h<(R=A-R)&&i.sane){e.msg="invalid distance too far back",i.mode=30;break e}if(S=I,(F=0)===u){if(F+=l-R,R<g){for(g-=R;N[r++]=I[F++],--R;);F=r-A,S=N}}else if(u<R){if(F+=l+u-R,(R-=u)<g){for(g-=R;N[r++]=I[F++],--R;);if(F=0,u<g){for(g-=R=u;N[r++]=I[F++],--R;);F=r-A,S=N}}}else if(F+=u-R,R<g){for(g-=R;N[r++]=I[F++],--R;);F=r-A,S=N}for(;2<g;)N[r++]=S[F++],N[r++]=S[F++],N[r++]=S[F++],g-=3;g&&(N[r++]=S[F++],1<g&&(N[r++]=S[F++]))}else{for(F=r-A;N[r++]=N[F++],N[r++]=N[F++],N[r++]=N[F++],2<(g-=3););g&&(N[r++]=N[F++],1<g&&(N[r++]=N[F++]))}break}}break}}while(s<n&&r<a);s-=g=E>>3,d&=(1<<(E-=g<<3))-1,e.next_in=s,e.next_out=r,e.avail_in=s<n?n-s+5:5-(s-n),e.avail_out=r<a?a-r+257:257-(r-a),i.hold=d,i.bits=E}},{}],49:[function(e,t,i){var s=e("../utils/common"),n=e("./adler32"),r=e("./crc32"),o=e("./inffast"),a=e("./inftrees"),c=1,l=2,h=0,u=-2,I=1,d=852,E=592;function f(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function p(){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 s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function C(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=I,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new s.Buf32(d),t.distcode=t.distdyn=new s.Buf32(E),t.sane=1,t.back=-1,h):u}function T(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,C(e)):u}function m(e,t){var i,s;return e&&e.state?(s=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?u:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=i,s.wbits=t,T(e))):u}function R(e,t){var i,s;return e?(s=new p,(e.state=s).window=null,(i=m(e,t))!==h&&(e.state=null),i):u}var g,A,F=!0;function S(e){if(F){var t;for(g=new s.Buf32(512),A=new s.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(c,e.lens,0,288,g,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(l,e.lens,0,32,A,0,e.work,{bits:5}),F=!1}e.lencode=g,e.lenbits=9,e.distcode=A,e.distbits=5}function O(e,t,i,n){var r,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new s.Buf8(o.wsize)),n>=o.wsize?(s.arraySet(o.window,t,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(n<(r=o.wsize-o.wnext)&&(r=n),s.arraySet(o.window,t,i-n,r,o.wnext),(n-=r)?(s.arraySet(o.window,t,i-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=r))),0}i.inflateReset=T,i.inflateReset2=m,i.inflateResetKeep=C,i.inflateInit=function(e){return R(e,15)},i.inflateInit2=R,i.inflate=function(e,t){var i,d,E,p,C,T,m,R,g,A,F,N,y,L,_,P,w,M,v,D,b,U,x,B,V=0,Y=new s.Buf8(4),G=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return u;12===(i=e.state).mode&&(i.mode=13),C=e.next_out,E=e.output,m=e.avail_out,p=e.next_in,d=e.input,T=e.avail_in,R=i.hold,g=i.bits,A=T,F=m,U=h;e:for(;;)switch(i.mode){case I:if(0===i.wrap){i.mode=13;break}for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(2&i.wrap&&35615===R){Y[i.check=0]=255&R,Y[1]=R>>>8&255,i.check=r(i.check,Y,2,0),g=R=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&R)<<8)+(R>>8))%31){e.msg="incorrect header check",i.mode=30;break}if(8!=(15&R)){e.msg="unknown compression method",i.mode=30;break}if(g-=4,b=8+(15&(R>>>=4)),0===i.wbits)i.wbits=b;else if(b>i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1<<b,e.adler=i.check=1,i.mode=512&R?10:12,g=R=0;break;case 2:for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(i.flags=R,8!=(255&i.flags)){e.msg="unknown compression method",i.mode=30;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=30;break}i.head&&(i.head.text=R>>8&1),512&i.flags&&(Y[0]=255&R,Y[1]=R>>>8&255,i.check=r(i.check,Y,2,0)),g=R=0,i.mode=3;case 3:for(;g<32;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.head&&(i.head.time=R),512&i.flags&&(Y[0]=255&R,Y[1]=R>>>8&255,Y[2]=R>>>16&255,Y[3]=R>>>24&255,i.check=r(i.check,Y,4,0)),g=R=0,i.mode=4;case 4:for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.head&&(i.head.xflags=255&R,i.head.os=R>>8),512&i.flags&&(Y[0]=255&R,Y[1]=R>>>8&255,i.check=r(i.check,Y,2,0)),g=R=0,i.mode=5;case 5:if(1024&i.flags){for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.length=R,i.head&&(i.head.extra_len=R),512&i.flags&&(Y[0]=255&R,Y[1]=R>>>8&255,i.check=r(i.check,Y,2,0)),g=R=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(T<(N=i.length)&&(N=T),N&&(i.head&&(b=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),s.arraySet(i.head.extra,d,p,N,b)),512&i.flags&&(i.check=r(i.check,d,N,p)),T-=N,p+=N,i.length-=N),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===T)break e;for(N=0;b=d[p+N++],i.head&&b&&i.length<65536&&(i.head.name+=String.fromCharCode(b)),b&&N<T;);if(512&i.flags&&(i.check=r(i.check,d,N,p)),T-=N,p+=N,b)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===T)break e;for(N=0;b=d[p+N++],i.head&&b&&i.length<65536&&(i.head.comment+=String.fromCharCode(b)),b&&N<T;);if(512&i.flags&&(i.check=r(i.check,d,N,p)),T-=N,p+=N,b)break e}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(R!==(65535&i.check)){e.msg="header crc mismatch",i.mode=30;break}g=R=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=12;break;case 10:for(;g<32;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}e.adler=i.check=f(R),g=R=0,i.mode=11;case 11:if(0===i.havedict)return e.next_out=C,e.avail_out=m,e.next_in=p,e.avail_in=T,i.hold=R,i.bits=g,2;e.adler=i.check=1,i.mode=12;case 12:if(5===t||6===t)break e;case 13:if(i.last){R>>>=7&g,g-=7&g,i.mode=27;break}for(;g<3;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}switch(i.last=1&R,g-=1,3&(R>>>=1)){case 0:i.mode=14;break;case 1:if(S(i),i.mode=20,6!==t)break;R>>>=2,g-=2;break e;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}R>>>=2,g-=2;break;case 14:for(R>>>=7&g,g-=7&g;g<32;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if((65535&R)!=(R>>>16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&R,g=R=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(N=i.length){if(T<N&&(N=T),m<N&&(N=m),0===N)break e;s.arraySet(E,d,p,N,C),T-=N,p+=N,m-=N,C+=N,i.length-=N;break}i.mode=12;break;case 17:for(;g<14;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(i.nlen=257+(31&R),R>>>=5,g-=5,i.ndist=1+(31&R),R>>>=5,g-=5,i.ncode=4+(15&R),R>>>=4,g-=4,286<i.nlen||30<i.ndist){e.msg="too many length or distance symbols",i.mode=30;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;g<3;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.lens[G[i.have++]]=7&R,R>>>=3,g-=3}for(;i.have<19;)i.lens[G[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,x={bits:i.lenbits},U=a(0,i.lens,0,19,i.lencode,0,i.work,x),i.lenbits=x.bits,U){e.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;P=(V=i.lencode[R&(1<<i.lenbits)-1])>>>16&255,w=65535&V,!((_=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(w<16)R>>>=_,g-=_,i.lens[i.have++]=w;else{if(16===w){for(B=_+2;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(R>>>=_,g-=_,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}b=i.lens[i.have-1],N=3+(3&R),R>>>=2,g-=2}else if(17===w){for(B=_+3;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}g-=_,b=0,N=3+(7&(R>>>=_)),R>>>=3,g-=3}else{for(B=_+7;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}g-=_,b=0,N=11+(127&(R>>>=_)),R>>>=7,g-=7}if(i.have+N>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;N--;)i.lens[i.have++]=b}}if(30===i.mode)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,x={bits:i.lenbits},U=a(c,i.lens,0,i.nlen,i.lencode,0,i.work,x),i.lenbits=x.bits,U){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,x={bits:i.distbits},U=a(l,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,x),i.distbits=x.bits,U){e.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(6<=T&&258<=m){e.next_out=C,e.avail_out=m,e.next_in=p,e.avail_in=T,i.hold=R,i.bits=g,o(e,F),C=e.next_out,E=e.output,m=e.avail_out,p=e.next_in,d=e.input,T=e.avail_in,R=i.hold,g=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;P=(V=i.lencode[R&(1<<i.lenbits)-1])>>>16&255,w=65535&V,!((_=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(P&&!(240&P)){for(M=_,v=P,D=w;P=(V=i.lencode[D+((R&(1<<M+v)-1)>>M)])>>>16&255,w=65535&V,!(M+(_=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}R>>>=M,g-=M,i.back+=M}if(R>>>=_,g-=_,i.back+=_,i.length=w,0===P){i.mode=26;break}if(32&P){i.back=-1,i.mode=12;break}if(64&P){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&P,i.mode=22;case 22:if(i.extra){for(B=i.extra;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.length+=R&(1<<i.extra)-1,R>>>=i.extra,g-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;P=(V=i.distcode[R&(1<<i.distbits)-1])>>>16&255,w=65535&V,!((_=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(!(240&P)){for(M=_,v=P,D=w;P=(V=i.distcode[D+((R&(1<<M+v)-1)>>M)])>>>16&255,w=65535&V,!(M+(_=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}R>>>=M,g-=M,i.back+=M}if(R>>>=_,g-=_,i.back+=_,64&P){e.msg="invalid distance code",i.mode=30;break}i.offset=w,i.extra=15&P,i.mode=24;case 24:if(i.extra){for(B=i.extra;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.offset+=R&(1<<i.extra)-1,R>>>=i.extra,g-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===m)break e;if(N=F-m,i.offset>N){if((N=i.offset-N)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=30;break}y=N>i.wnext?(N-=i.wnext,i.wsize-N):i.wnext-N,N>i.length&&(N=i.length),L=i.window}else L=E,y=C-i.offset,N=i.length;for(m<N&&(N=m),m-=N,i.length-=N;E[C++]=L[y++],--N;);0===i.length&&(i.mode=21);break;case 26:if(0===m)break e;E[C++]=i.length,m--,i.mode=21;break;case 27:if(i.wrap){for(;g<32;){if(0===T)break e;T--,R|=d[p++]<<g,g+=8}if(F-=m,e.total_out+=F,i.total+=F,F&&(e.adler=i.check=i.flags?r(i.check,E,F,C-F):n(i.check,E,F,C-F)),F=m,(i.flags?R:f(R))!==i.check){e.msg="incorrect data check",i.mode=30;break}g=R=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;g<32;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(R!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=30;break}g=R=0}i.mode=29;case 29:U=1;break e;case 30:U=-3;break e;case 31:return-4;default:return u}return e.next_out=C,e.avail_out=m,e.next_in=p,e.avail_in=T,i.hold=R,i.bits=g,(i.wsize||F!==e.avail_out&&i.mode<30&&(i.mode<27||4!==t))&&O(e,e.output,e.next_out,F-e.avail_out)?(i.mode=31,-4):(A-=e.avail_in,F-=e.avail_out,e.total_in+=A,e.total_out+=F,i.total+=F,i.wrap&&F&&(e.adler=i.check=i.flags?r(i.check,E,F,e.next_out-F):n(i.check,E,F,e.next_out-F)),e.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),(0==A&&0===F||4===t)&&U===h&&(U=-5),U)},i.inflateEnd=function(e){if(!e||!e.state)return u;var t=e.state;return t.window&&(t.window=null),e.state=null,h},i.inflateGetHeader=function(e,t){var i;return e&&e.state&&2&(i=e.state).wrap?((i.head=t).done=!1,h):u},i.inflateSetDictionary=function(e,t){var i,s=t.length;return e&&e.state?0!==(i=e.state).wrap&&11!==i.mode?u:11===i.mode&&n(1,t,s,0)!==i.check?-3:O(e,t,s,s)?(i.mode=31,-4):(i.havedict=1,h):u},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,i){var s=e("../utils/common"),n=[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],r=[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],o=[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],a=[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];t.exports=function(e,t,i,c,l,h,u,I){var d,E,f,p,C,T,m,R,g,A=I.bits,F=0,S=0,O=0,N=0,y=0,L=0,_=0,P=0,w=0,M=0,v=null,D=0,b=new s.Buf16(16),U=new s.Buf16(16),x=null,B=0;for(F=0;F<=15;F++)b[F]=0;for(S=0;S<c;S++)b[t[i+S]]++;for(y=A,N=15;1<=N&&0===b[N];N--);if(N<y&&(y=N),0===N)return l[h++]=20971520,l[h++]=20971520,I.bits=1,0;for(O=1;O<N&&0===b[O];O++);for(y<O&&(y=O),F=P=1;F<=15;F++)if(P<<=1,(P-=b[F])<0)return-1;if(0<P&&(0===e||1!==N))return-1;for(U[1]=0,F=1;F<15;F++)U[F+1]=U[F]+b[F];for(S=0;S<c;S++)0!==t[i+S]&&(u[U[t[i+S]]++]=S);if(T=0===e?(v=x=u,19):1===e?(v=n,D-=257,x=r,B-=257,256):(v=o,x=a,-1),F=O,C=h,_=S=M=0,f=-1,p=(w=1<<(L=y))-1,1===e&&852<w||2===e&&592<w)return 1;for(;;){for(m=F-_,g=u[S]<T?(R=0,u[S]):u[S]>T?(R=x[B+u[S]],v[D+u[S]]):(R=96,0),d=1<<F-_,O=E=1<<L;l[C+(M>>_)+(E-=d)]=m<<24|R<<16|g,0!==E;);for(d=1<<F-1;M&d;)d>>=1;if(0!==d?(M&=d-1,M+=d):M=0,S++,0==--b[F]){if(F===N)break;F=t[i+u[S]]}if(y<F&&(M&p)!==f){for(0===_&&(_=y),C+=O,P=1<<(L=F-_);L+_<N&&!((P-=b[L+_])<=0);)L++,P<<=1;if(w+=1<<L,1===e&&852<w||2===e&&592<w)return 1;l[f=M&p]=y<<24|L<<16|C-h}}return 0!==M&&(l[C+M]=F-_<<24|64<<16),I.bits=y,0}},{"../utils/common":41}],51:[function(e,t,i){t.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(e,t,i){var s=e("../utils/common"),n=0,r=1;function o(e){for(var t=e.length;0<=--t;)e[t]=0}var a=0,c=29,l=256,h=l+1+c,u=30,I=19,d=2*h+1,E=15,f=16,p=7,C=256,T=16,m=17,R=18,g=[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],A=[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],S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],O=new Array(2*(h+2));o(O);var N=new Array(2*u);o(N);var y=new Array(512);o(y);var L=new Array(256);o(L);var _=new Array(c);o(_);var P,w,M,v=new Array(u);function D(e,t,i,s,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=s,this.max_length=n,this.has_stree=e&&e.length}function b(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function U(e){return e<256?y[e]:y[256+(e>>>7)]}function x(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function B(e,t,i){e.bi_valid>f-i?(e.bi_buf|=t<<e.bi_valid&65535,x(e,e.bi_buf),e.bi_buf=t>>f-e.bi_valid,e.bi_valid+=i-f):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function V(e,t,i){B(e,i[2*t],i[2*t+1])}function Y(e,t){for(var i=0;i|=1&e,e>>>=1,i<<=1,0<--t;);return i>>>1}function G(e,t,i){var s,n,r=new Array(E+1),o=0;for(s=1;s<=E;s++)r[s]=o=o+i[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=Y(r[a]++,a))}}function z(e){var t;for(t=0;t<h;t++)e.dyn_ltree[2*t]=0;for(t=0;t<u;t++)e.dyn_dtree[2*t]=0;for(t=0;t<I;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*C]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function k(e){8<e.bi_valid?x(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function H(e,t,i,s){var n=2*t,r=2*i;return e[n]<e[r]||e[n]===e[r]&&s[t]<=s[i]}function W(e,t,i){for(var s=e.heap[i],n=i<<1;n<=e.heap_len&&(n<e.heap_len&&H(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!H(t,s,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=s}function X(e,t,i){var s,n,r,o,a=0;if(0!==e.last_lit)for(;s=e.pending_buf[e.d_buf+2*a]<<8|e.pending_buf[e.d_buf+2*a+1],n=e.pending_buf[e.l_buf+a],a++,0===s?V(e,n,t):(V(e,(r=L[n])+l+1,t),0!==(o=g[r])&&B(e,n-=_[r],o),V(e,r=U(--s),i),0!==(o=A[r])&&B(e,s-=v[r],o)),a<e.last_lit;);V(e,C,t)}function j(e,t){var i,s,n,r=t.dyn_tree,o=t.stat_desc.static_tree,a=t.stat_desc.has_stree,c=t.stat_desc.elems,l=-1;for(e.heap_len=0,e.heap_max=d,i=0;i<c;i++)0!==r[2*i]?(e.heap[++e.heap_len]=l=i,e.depth[i]=0):r[2*i+1]=0;for(;e.heap_len<2;)r[2*(n=e.heap[++e.heap_len]=l<2?++l:0)]=1,e.depth[n]=0,e.opt_len--,a&&(e.static_len-=o[2*n+1]);for(t.max_code=l,i=e.heap_len>>1;1<=i;i--)W(e,r,i);for(n=c;i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],W(e,r,1),s=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=s,r[2*n]=r[2*i]+r[2*s],e.depth[n]=(e.depth[i]>=e.depth[s]?e.depth[i]:e.depth[s])+1,r[2*i+1]=r[2*s+1]=n,e.heap[1]=n++,W(e,r,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,s,n,r,o,a,c=t.dyn_tree,l=t.max_code,h=t.stat_desc.static_tree,u=t.stat_desc.has_stree,I=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,p=t.stat_desc.max_length,C=0;for(r=0;r<=E;r++)e.bl_count[r]=0;for(c[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<d;i++)p<(r=c[2*c[2*(s=e.heap[i])+1]+1]+1)&&(r=p,C++),c[2*s+1]=r,l<s||(e.bl_count[r]++,o=0,f<=s&&(o=I[s-f]),a=c[2*s],e.opt_len+=a*(r+o),u&&(e.static_len+=a*(h[2*s+1]+o)));if(0!==C){do{for(r=p-1;0===e.bl_count[r];)r--;e.bl_count[r]--,e.bl_count[r+1]+=2,e.bl_count[p]--,C-=2}while(0<C);for(r=p;0!==r;r--)for(s=e.bl_count[r];0!==s;)l<(n=e.heap[--i])||(c[2*n+1]!==r&&(e.opt_len+=(r-c[2*n+1])*c[2*n],c[2*n+1]=r),s--)}}(e,t),G(r,l,e.bl_count)}function Z(e,t,i){var s,n,r=-1,o=t[1],a=0,c=7,l=4;for(0===o&&(c=138,l=3),t[2*(i+1)+1]=65535,s=0;s<=i;s++)n=o,o=t[2*(s+1)+1],++a<c&&n===o||(a<l?e.bl_tree[2*n]+=a:0!==n?(n!==r&&e.bl_tree[2*n]++,e.bl_tree[2*T]++):a<=10?e.bl_tree[2*m]++:e.bl_tree[2*R]++,r=n,l=(a=0)===o?(c=138,3):n===o?(c=6,3):(c=7,4))}function $(e,t,i){var s,n,r=-1,o=t[1],a=0,c=7,l=4;for(0===o&&(c=138,l=3),s=0;s<=i;s++)if(n=o,o=t[2*(s+1)+1],!(++a<c&&n===o)){if(a<l)for(;V(e,n,e.bl_tree),0!=--a;);else 0!==n?(n!==r&&(V(e,n,e.bl_tree),a--),V(e,T,e.bl_tree),B(e,a-3,2)):a<=10?(V(e,m,e.bl_tree),B(e,a-3,3)):(V(e,R,e.bl_tree),B(e,a-11,7));r=n,l=(a=0)===o?(c=138,3):n===o?(c=6,3):(c=7,4)}}o(v);var Q=!1;function q(e,t,i,n){var r,o,c;B(e,(a<<1)+(n?1:0),3),o=t,c=i,k(r=e),x(r,c),x(r,~c),s.arraySet(r.pending_buf,r.window,o,c,r.pending),r.pending+=c}i._tr_init=function(e){Q||(function(){var e,t,i,s,n,r=new Array(E+1);for(s=i=0;s<c-1;s++)for(_[s]=i,e=0;e<1<<g[s];e++)L[i++]=s;for(L[i-1]=s,s=n=0;s<16;s++)for(v[s]=n,e=0;e<1<<A[s];e++)y[n++]=s;for(n>>=7;s<u;s++)for(v[s]=n<<7,e=0;e<1<<A[s]-7;e++)y[256+n++]=s;for(t=0;t<=E;t++)r[t]=0;for(e=0;e<=143;)O[2*e+1]=8,e++,r[8]++;for(;e<=255;)O[2*e+1]=9,e++,r[9]++;for(;e<=279;)O[2*e+1]=7,e++,r[7]++;for(;e<=287;)O[2*e+1]=8,e++,r[8]++;for(G(O,h+1,r),e=0;e<u;e++)N[2*e+1]=5,N[2*e]=Y(e,5);P=new D(O,g,l+1,h,E),w=new D(N,A,0,u,E),M=new D(new Array(0),F,0,I,p)}(),Q=!0),e.l_desc=new b(e.dyn_ltree,P),e.d_desc=new b(e.dyn_dtree,w),e.bl_desc=new b(e.bl_tree,M),e.bi_buf=0,e.bi_valid=0,z(e)},i._tr_stored_block=q,i._tr_flush_block=function(e,t,i,s){var o,a,c=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return n;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return r;for(t=32;t<l;t++)if(0!==e.dyn_ltree[2*t])return r;return n}(e)),j(e,e.l_desc),j(e,e.d_desc),c=function(e){var t;for(Z(e,e.dyn_ltree,e.l_desc.max_code),Z(e,e.dyn_dtree,e.d_desc.max_code),j(e,e.bl_desc),t=I-1;3<=t&&0===e.bl_tree[2*S[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),o=e.opt_len+3+7>>>3,(a=e.static_len+3+7>>>3)<=o&&(o=a)):o=a=i+5,i+4<=o&&-1!==t?q(e,t,i,s):4===e.strategy||a===o?(B(e,2+(s?1:0),3),X(e,O,N)):(B(e,4+(s?1:0),3),function(e,t,i,s){var n;for(B(e,t-257,5),B(e,i-1,5),B(e,s-4,4),n=0;n<s;n++)B(e,e.bl_tree[2*S[n]+1],3);$(e,e.dyn_ltree,t-1),$(e,e.dyn_dtree,i-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,c+1),X(e,e.dyn_ltree,e.dyn_dtree)),z(e),s&&k(e)},i._tr_tally=function(e,t,i){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(L[i]+l+1)]++,e.dyn_dtree[2*U(t)]++),e.last_lit===e.lit_bufsize-1},i._tr_align=function(e){var t;B(e,2,3),V(e,C,O),16===(t=e).bi_valid?(x(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},{"../utils/common":41}],53:[function(e,t,i){t.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(e,t,i){(function(e){!function(e,t){if(!e.setImmediate){var i,s,n,r,o=1,a={},c=!1,l=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,i="[object process]"==={}.toString.call(e.process)?function(e){process.nextTick((function(){I(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,i=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=i,t}}()?(r="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",d,!1):e.attachEvent("onmessage",d),function(t){e.postMessage(r+t,"*")}):e.MessageChannel?((n=new MessageChannel).port1.onmessage=function(e){I(e.data)},function(e){n.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(s=l.documentElement,function(e){var t=l.createElement("script");t.onreadystatechange=function(){I(e),t.onreadystatechange=null,s.removeChild(t),t=null},s.appendChild(t)}):function(e){setTimeout(I,0,e)},h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),s=0;s<t.length;s++)t[s]=arguments[s+1];var n={callback:e,args:t};return a[o]=n,i(o),o++},h.clearImmediate=u}function u(e){delete a[e]}function I(e){if(c)setTimeout(I,0,e);else{var i=a[e];if(i){c=!0;try{!function(e){var i=e.callback,s=e.args;switch(s.length){case 0:i();break;case 1:i(s[0]);break;case 2:i(s[0],s[1]);break;case 3:i(s[0],s[1],s[2]);break;default:i.apply(t,s)}}(i)}finally{u(e),c=!1}}}}function d(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(r)&&I(+t.data.slice(r.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,void 0!==qn?qn:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10));var ir={},sr={};!function(e){const t=":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",i="["+t+"]["+(t+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040")+"]*",s=new RegExp("^"+i+"$");e.isExist=function(e){return void 0!==e},e.isEmptyObject=function(e){return 0===Object.keys(e).length},e.merge=function(e,t,i){if(t){const s=Object.keys(t),n=s.length;for(let r=0;r<n;r++)e[s[r]]="strict"===i?[t[s[r]]]:t[s[r]]}},e.getValue=function(t){return e.isExist(t)?t:""},e.isName=function(e){const t=s.exec(e);return!(null==t)},e.getAllMatches=function(e,t){const i=[];let s=t.exec(e);for(;s;){const n=[];n.startIndex=t.lastIndex-s[0].length;const r=s.length;for(let e=0;e<r;e++)n.push(s[e]);i.push(n),s=t.exec(e)}return i},e.nameRegexp=i}(sr);const nr=sr,rr={allowBooleanAttributes:!1,unpairedTags:[]};function or(e){return" "===e||"\t"===e||"\n"===e||"\r"===e}function ar(e,t){const i=t;for(;t<e.length;t++)if("?"!=e[t]&&" "!=e[t]);else{const s=e.substr(i,t-i);if(t>5&&"xml"===s)return fr("InvalidXml","XML declaration allowed only at the start of the document.",Cr(e,t));if("?"==e[t]&&">"==e[t+1]){t++;break}}return t}function cr(e,t){if(e.length>t+5&&"-"===e[t+1]&&"-"===e[t+2]){for(t+=3;t<e.length;t++)if("-"===e[t]&&"-"===e[t+1]&&">"===e[t+2]){t+=2;break}}else if(e.length>t+8&&"D"===e[t+1]&&"O"===e[t+2]&&"C"===e[t+3]&&"T"===e[t+4]&&"Y"===e[t+5]&&"P"===e[t+6]&&"E"===e[t+7]){let i=1;for(t+=8;t<e.length;t++)if("<"===e[t])i++;else if(">"===e[t]&&(i--,0===i))break}else if(e.length>t+9&&"["===e[t+1]&&"C"===e[t+2]&&"D"===e[t+3]&&"A"===e[t+4]&&"T"===e[t+5]&&"A"===e[t+6]&&"["===e[t+7])for(t+=8;t<e.length;t++)if("]"===e[t]&&"]"===e[t+1]&&">"===e[t+2]){t+=2;break}return t}ir.validate=function(e,t){t=Object.assign({},rr,t);const i=[];let s=!1,n=!1;"\ufeff"===e[0]&&(e=e.substr(1));for(let o=0;o<e.length;o++)if("<"===e[o]&&"?"===e[o+1]){if(o+=2,o=ar(e,o),o.err)return o}else{if("<"!==e[o]){if(or(e[o]))continue;return fr("InvalidChar","char '"+e[o]+"' is not expected.",Cr(e,o))}{let a=o;if(o++,"!"===e[o]){o=cr(e,o);continue}{let c=!1;"/"===e[o]&&(c=!0,o++);let l="";for(;o<e.length&&">"!==e[o]&&" "!==e[o]&&"\t"!==e[o]&&"\n"!==e[o]&&"\r"!==e[o];o++)l+=e[o];if(l=l.trim(),"/"===l[l.length-1]&&(l=l.substring(0,l.length-1),o--),r=l,!nr.isName(r)){let t;return t=0===l.trim().length?"Invalid space after '<'.":"Tag '"+l+"' is an invalid name.",fr("InvalidTag",t,Cr(e,o))}const h=ur(e,o);if(!1===h)return fr("InvalidAttr","Attributes for '"+l+"' have open quote.",Cr(e,o));let u=h.value;if(o=h.index,"/"===u[u.length-1]){const i=o-u.length;u=u.substring(0,u.length-1);const n=dr(u,t);if(!0!==n)return fr(n.err.code,n.err.msg,Cr(e,i+n.err.line));s=!0}else if(c){if(!h.tagClosed)return fr("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",Cr(e,o));if(u.trim().length>0)return fr("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",Cr(e,a));if(0===i.length)return fr("InvalidTag","Closing tag '"+l+"' has not been opened.",Cr(e,a));{const t=i.pop();if(l!==t.tagName){let i=Cr(e,t.tagStartPos);return fr("InvalidTag","Expected closing tag '"+t.tagName+"' (opened in line "+i.line+", col "+i.col+") instead of closing tag '"+l+"'.",Cr(e,a))}0==i.length&&(n=!0)}}else{const r=dr(u,t);if(!0!==r)return fr(r.err.code,r.err.msg,Cr(e,o-u.length+r.err.line));if(!0===n)return fr("InvalidXml","Multiple possible root nodes found.",Cr(e,o));-1!==t.unpairedTags.indexOf(l)||i.push({tagName:l,tagStartPos:a}),s=!0}for(o++;o<e.length;o++)if("<"===e[o]){if("!"===e[o+1]){o++,o=cr(e,o);continue}if("?"!==e[o+1])break;if(o=ar(e,++o),o.err)return o}else if("&"===e[o]){const t=Er(e,o);if(-1==t)return fr("InvalidChar","char '&' is not expected.",Cr(e,o));o=t}else if(!0===n&&!or(e[o]))return fr("InvalidXml","Extra text at the end",Cr(e,o));"<"===e[o]&&o--}}}var r;return s?1==i.length?fr("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",Cr(e,i[0].tagStartPos)):!(i.length>0)||fr("InvalidXml","Invalid '"+JSON.stringify(i.map((e=>e.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):fr("InvalidXml","Start tag expected.",1)};const lr='"',hr="'";function ur(e,t){let i="",s="",n=!1;for(;t<e.length;t++){if(e[t]===lr||e[t]===hr)""===s?s=e[t]:s!==e[t]||(s="");else if(">"===e[t]&&""===s){n=!0;break}i+=e[t]}return""===s&&{value:i,index:t,tagClosed:n}}const Ir=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function dr(e,t){const i=nr.getAllMatches(e,Ir),s={};for(let e=0;e<i.length;e++){if(0===i[e][1].length)return fr("InvalidAttr","Attribute '"+i[e][2]+"' has no space in starting.",Tr(i[e]));if(void 0!==i[e][3]&&void 0===i[e][4])return fr("InvalidAttr","Attribute '"+i[e][2]+"' is without value.",Tr(i[e]));if(void 0===i[e][3]&&!t.allowBooleanAttributes)return fr("InvalidAttr","boolean attribute '"+i[e][2]+"' is not allowed.",Tr(i[e]));const n=i[e][2];if(!pr(n))return fr("InvalidAttr","Attribute '"+n+"' is an invalid name.",Tr(i[e]));if(s.hasOwnProperty(n))return fr("InvalidAttr","Attribute '"+n+"' is repeated.",Tr(i[e]));s[n]=1}return!0}function Er(e,t){if(";"===e[++t])return-1;if("#"===e[t])return function(e,t){let i=/\d/;for("x"===e[t]&&(t++,i=/[\da-fA-F]/);t<e.length;t++){if(";"===e[t])return t;if(!e[t].match(i))break}return-1}(e,++t);let i=0;for(;t<e.length;t++,i++)if(!(e[t].match(/\w/)&&i<20)){if(";"===e[t])break;return-1}return t}function fr(e,t,i){return{err:{code:e,msg:t,line:i.line||i,col:i.col}}}function pr(e){return nr.isName(e)}function Cr(e,t){const i=e.substring(0,t).split(/\r?\n/);return{line:i.length,col:i[i.length-1].length+1}}function Tr(e){return e.startIndex+e[1].length}var mr={};const Rr={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(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,i){return e}};mr.buildOptions=function(e){return Object.assign({},Rr,e)},mr.defaultOptions=Rr;var gr=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){"__proto__"===e&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){"__proto__"===e.tagname&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}};const Ar=sr;function Fr(e,t){let i="";for(;t<e.length&&"'"!==e[t]&&'"'!==e[t];t++)i+=e[t];if(i=i.trim(),-1!==i.indexOf(" "))throw new Error("External entites are not supported");const s=e[t++];let n="";for(;t<e.length&&e[t]!==s;t++)n+=e[t];return[i,n,t]}function Sr(e,t){return"!"===e[t+1]&&"-"===e[t+2]&&"-"===e[t+3]}function Or(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"N"===e[t+3]&&"T"===e[t+4]&&"I"===e[t+5]&&"T"===e[t+6]&&"Y"===e[t+7]}function Nr(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"L"===e[t+3]&&"E"===e[t+4]&&"M"===e[t+5]&&"E"===e[t+6]&&"N"===e[t+7]&&"T"===e[t+8]}function yr(e,t){return"!"===e[t+1]&&"A"===e[t+2]&&"T"===e[t+3]&&"T"===e[t+4]&&"L"===e[t+5]&&"I"===e[t+6]&&"S"===e[t+7]&&"T"===e[t+8]}function Lr(e,t){return"!"===e[t+1]&&"N"===e[t+2]&&"O"===e[t+3]&&"T"===e[t+4]&&"A"===e[t+5]&&"T"===e[t+6]&&"I"===e[t+7]&&"O"===e[t+8]&&"N"===e[t+9]}function _r(e){if(Ar.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}var Pr=function(e,t){const i={};if("O"!==e[t+3]||"C"!==e[t+4]||"T"!==e[t+5]||"Y"!==e[t+6]||"P"!==e[t+7]||"E"!==e[t+8])throw new Error("Invalid Tag instead of DOCTYPE");{t+=9;let s=1,n=!1,r=!1,o="";for(;t<e.length;t++)if("<"!==e[t]||r)if(">"===e[t]){if(r?"-"===e[t-1]&&"-"===e[t-2]&&(r=!1,s--):s--,0===s)break}else"["===e[t]?n=!0:o+=e[t];else{if(n&&Or(e,t))t+=7,[entityName,val,t]=Fr(e,t+1),-1===val.indexOf("&")&&(i[_r(entityName)]={regx:RegExp(`&${entityName};`,"g"),val:val});else if(n&&Nr(e,t))t+=8;else if(n&&yr(e,t))t+=8;else if(n&&Lr(e,t))t+=9;else{if(!Sr)throw new Error("Invalid DOCTYPE");r=!0}s++,o=""}if(0!==s)throw new Error("Unclosed DOCTYPE")}return{entities:i,i:t}};const wr=/^[-+]?0x[a-fA-F0-9]+$/,Mr=/^([\-\+])?(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 vr={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};const Dr=sr,br=gr,Ur=Pr,xr=function(e,t={}){if(t=Object.assign({},vr,t),!e||"string"!=typeof e)return e;let i=e.trim();if(void 0!==t.skipLike&&t.skipLike.test(i))return e;if(t.hex&&wr.test(i))return Number.parseInt(i,16);{const s=Mr.exec(i);if(s){const n=s[1],r=s[2];let o=function(e){if(e&&-1!==e.indexOf("."))return"."===(e=e.replace(/0+$/,""))?e="0":"."===e[0]?e="0"+e:"."===e[e.length-1]&&(e=e.substr(0,e.length-1)),e;return e}(s[3]);const a=s[4]||s[6];if(!t.leadingZeros&&r.length>0&&n&&"."!==i[2])return e;if(!t.leadingZeros&&r.length>0&&!n&&"."!==i[1])return e;{const s=Number(i),c=""+s;return-1!==c.search(/[eE]/)||a?t.eNotation?s:e:-1!==i.indexOf(".")?"0"===c&&""===o||c===o||n&&c==="-"+o?s:e:r?o===c||n+o===c?s:e:i===c||i===n+c?s:e}}return e}};function Br(e){const t=Object.keys(e);for(let i=0;i<t.length;i++){const s=t[i];this.lastEntities[s]={regex:new RegExp("&"+s+";","g"),val:e[s]}}}function Vr(e,t,i,s,n,r,o){if(void 0!==e&&(this.options.trimValues&&!s&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e));const s=this.options.tagValueProcessor(t,e,i,n,r);if(null==s)return e;if(typeof s!=typeof e||s!==e)return s;if(this.options.trimValues)return qr(e,this.options.parseTagValue,this.options.numberParseOptions);return e.trim()===e?qr(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function Yr(e){if(this.options.removeNSPrefix){const t=e.split(":"),i="/"===e.charAt(0)?"/":"";if("xmlns"===t[0])return"";2===t.length&&(e=i+t[1])}return e}const Gr=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function zr(e,t,i){if(!this.options.ignoreAttributes&&"string"==typeof e){const i=Dr.getAllMatches(e,Gr),s=i.length,n={};for(let e=0;e<s;e++){const s=this.resolveNameSpace(i[e][1]);let r=i[e][4],o=this.options.attributeNamePrefix+s;if(s.length)if(this.options.transformAttributeName&&(o=this.options.transformAttributeName(o)),"__proto__"===o&&(o="#__proto__"),void 0!==r){this.options.trimValues&&(r=r.trim()),r=this.replaceEntitiesValue(r);const e=this.options.attributeValueProcessor(s,r,t);n[o]=null==e?r:typeof e!=typeof r||e!==r?e:qr(r,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(n[o]=!0)}if(!Object.keys(n).length)return;if(this.options.attributesGroupName){const e={};return e[this.options.attributesGroupName]=n,e}return n}}const kr=function(e){e=e.replace(/\r\n?/g,"\n");const t=new br("!xml");let i=t,s="",n="";for(let r=0;r<e.length;r++){if("<"===e[r])if("/"===e[r+1]){const t=Zr(e,">",r,"Closing Tag is not closed.");let o=e.substring(r+2,t).trim();if(this.options.removeNSPrefix){const e=o.indexOf(":");-1!==e&&(o=o.substr(e+1))}this.options.transformTagName&&(o=this.options.transformTagName(o)),i&&(s=this.saveTextToParentTag(s,i,n));const a=n.substring(n.lastIndexOf(".")+1);if(o&&-1!==this.options.unpairedTags.indexOf(o))throw new Error(`Unpaired tag can not be used as closing tag: </${o}>`);let c=0;a&&-1!==this.options.unpairedTags.indexOf(a)?(c=n.lastIndexOf(".",n.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=n.lastIndexOf("."),n=n.substring(0,c),i=this.tagsNodeStack.pop(),s="",r=t}else if("?"===e[r+1]){let t=$r(e,r,!1,"?>");if(!t)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,i,n),this.options.ignoreDeclaration&&"?xml"===t.tagName||this.options.ignorePiTags);else{const e=new br(t.tagName);e.add(this.options.textNodeName,""),t.tagName!==t.tagExp&&t.attrExpPresent&&(e[":@"]=this.buildAttributesMap(t.tagExp,n,t.tagName)),this.addChild(i,e,n)}r=t.closeIndex+1}else if("!--"===e.substr(r+1,3)){const t=Zr(e,"--\x3e",r+4,"Comment is not closed.");if(this.options.commentPropName){const o=e.substring(r+4,t-2);s=this.saveTextToParentTag(s,i,n),i.add(this.options.commentPropName,[{[this.options.textNodeName]:o}])}r=t}else if("!D"===e.substr(r+1,2)){const t=Ur(e,r);this.docTypeEntities=t.entities,r=t.i}else if("!["===e.substr(r+1,2)){const t=Zr(e,"]]>",r,"CDATA is not closed.")-2,o=e.substring(r+9,t);s=this.saveTextToParentTag(s,i,n);let a=this.parseTextData(o,i.tagname,n,!0,!1,!0,!0);null==a&&(a=""),this.options.cdataPropName?i.add(this.options.cdataPropName,[{[this.options.textNodeName]:o}]):i.add(this.options.textNodeName,a),r=t+2}else{let o=$r(e,r,this.options.removeNSPrefix),a=o.tagName;const c=o.rawTagName;let l=o.tagExp,h=o.attrExpPresent,u=o.closeIndex;this.options.transformTagName&&(a=this.options.transformTagName(a)),i&&s&&"!xml"!==i.tagname&&(s=this.saveTextToParentTag(s,i,n,!1));const I=i;if(I&&-1!==this.options.unpairedTags.indexOf(I.tagname)&&(i=this.tagsNodeStack.pop(),n=n.substring(0,n.lastIndexOf("."))),a!==t.tagname&&(n+=n?"."+a:a),this.isItStopNode(this.options.stopNodes,n,a)){let t="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)"/"===a[a.length-1]?(a=a.substr(0,a.length-1),n=n.substr(0,n.length-1),l=a):l=l.substr(0,l.length-1),r=o.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(a))r=o.closeIndex;else{const i=this.readStopNodeData(e,c,u+1);if(!i)throw new Error(`Unexpected end of ${c}`);r=i.i,t=i.tagContent}const s=new br(a);a!==l&&h&&(s[":@"]=this.buildAttributesMap(l,n,a)),t&&(t=this.parseTextData(t,a,n,!0,h,!0,!0)),n=n.substr(0,n.lastIndexOf(".")),s.add(this.options.textNodeName,t),this.addChild(i,s,n)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===a[a.length-1]?(a=a.substr(0,a.length-1),n=n.substr(0,n.length-1),l=a):l=l.substr(0,l.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));const e=new br(a);a!==l&&h&&(e[":@"]=this.buildAttributesMap(l,n,a)),this.addChild(i,e,n),n=n.substr(0,n.lastIndexOf("."))}else{const e=new br(a);this.tagsNodeStack.push(i),a!==l&&h&&(e[":@"]=this.buildAttributesMap(l,n,a)),this.addChild(i,e,n),i=e}s="",r=u}}else s+=e[r]}return t.child};function Hr(e,t,i){const s=this.options.updateTag(t.tagname,i,t[":@"]);!1===s||("string"==typeof s?(t.tagname=s,e.addChild(t)):e.addChild(t))}const Wr=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const i=this.docTypeEntities[t];e=e.replace(i.regx,i.val)}for(let t in this.lastEntities){const i=this.lastEntities[t];e=e.replace(i.regex,i.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const i=this.htmlEntities[t];e=e.replace(i.regex,i.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function Xr(e,t,i,s){return e&&(void 0===s&&(s=0===Object.keys(t.child).length),void 0!==(e=this.parseTextData(e,t.tagname,i,!1,!!t[":@"]&&0!==Object.keys(t[":@"]).length,s))&&""!==e&&t.add(this.options.textNodeName,e),e=""),e}function jr(e,t,i){const s="*."+i;for(const i in e){const n=e[i];if(s===n||t===n)return!0}return!1}function Zr(e,t,i,s){const n=e.indexOf(t,i);if(-1===n)throw new Error(s);return n+t.length-1}function $r(e,t,i,s=">"){const n=function(e,t,i=">"){let s,n="";for(let r=t;r<e.length;r++){let t=e[r];if(s)t===s&&(s="");else if('"'===t||"'"===t)s=t;else if(t===i[0]){if(!i[1])return{data:n,index:r};if(e[r+1]===i[1])return{data:n,index:r}}else"\t"===t&&(t=" ");n+=t}}(e,t+1,s);if(!n)return;let r=n.data;const o=n.index,a=r.search(/\s/);let c=r,l=!0;-1!==a&&(c=r.substring(0,a),r=r.substring(a+1).trimStart());const h=c;if(i){const e=c.indexOf(":");-1!==e&&(c=c.substr(e+1),l=c!==n.data.substr(e+1))}return{tagName:c,tagExp:r,closeIndex:o,attrExpPresent:l,rawTagName:h}}function Qr(e,t,i){const s=i;let n=1;for(;i<e.length;i++)if("<"===e[i])if("/"===e[i+1]){const r=Zr(e,">",i,`${t} is not closed`);if(e.substring(i+2,r).trim()===t&&(n--,0===n))return{tagContent:e.substring(s,i),i:r};i=r}else if("?"===e[i+1]){i=Zr(e,"?>",i+1,"StopNode is not closed.")}else if("!--"===e.substr(i+1,3)){i=Zr(e,"--\x3e",i+3,"StopNode is not closed.")}else if("!["===e.substr(i+1,2)){i=Zr(e,"]]>",i,"StopNode is not closed.")-2}else{const s=$r(e,i,">");if(s){(s&&s.tagName)===t&&"/"!==s.tagExp[s.tagExp.length-1]&&n++,i=s.closeIndex}}}function qr(e,t,i){if(t&&"string"==typeof e){const t=e.trim();return"true"===t||"false"!==t&&xr(e,i)}return Dr.isExist(e)?e:""}var Kr=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:(e,t)=>String.fromCharCode(Number.parseInt(t,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,16))}},this.addExternalEntities=Br,this.parseXml=kr,this.parseTextData=Vr,this.resolveNameSpace=Yr,this.buildAttributesMap=zr,this.isItStopNode=jr,this.replaceEntitiesValue=Wr,this.readStopNodeData=Qr,this.saveTextToParentTag=Xr,this.addChild=Hr}},Jr={};function eo(e,t,i){let s;const n={};for(let r=0;r<e.length;r++){const o=e[r],a=to(o);let c="";if(c=void 0===i?a:i+"."+a,a===t.textNodeName)void 0===s?s=o[a]:s+=""+o[a];else{if(void 0===a)continue;if(o[a]){let e=eo(o[a],t,c);const i=so(e,t);o[":@"]?io(e,o[":@"],c,t):1!==Object.keys(e).length||void 0===e[t.textNodeName]||t.alwaysCreateTextNode?0===Object.keys(e).length&&(t.alwaysCreateTextNode?e[t.textNodeName]="":e=""):e=e[t.textNodeName],void 0!==n[a]&&n.hasOwnProperty(a)?(Array.isArray(n[a])||(n[a]=[n[a]]),n[a].push(e)):t.isArray(a,c,i)?n[a]=[e]:n[a]=e}}}return"string"==typeof s?s.length>0&&(n[t.textNodeName]=s):void 0!==s&&(n[t.textNodeName]=s),n}function to(e){const t=Object.keys(e);for(let e=0;e<t.length;e++){const i=t[e];if(":@"!==i)return i}}function io(e,t,i,s){if(t){const n=Object.keys(t),r=n.length;for(let o=0;o<r;o++){const r=n[o];s.isArray(r,i+"."+r,!0,!0)?e[r]=[t[r]]:e[r]=t[r]}}}function so(e,t){const{textNodeName:i}=t,s=Object.keys(e).length;return 0===s||!(1!==s||!e[i]&&"boolean"!=typeof e[i]&&0!==e[i])}Jr.prettify=function(e,t){return eo(e,t)};const{buildOptions:no}=mr,ro=Kr,{prettify:oo}=Jr,ao=ir;var co=class{constructor(e){this.externalEntities={},this.options=no(e)}parse(e,t){if("string"==typeof e);else{if(!e.toString)throw new Error("XML data is accepted in String or Bytes[] form.");e=e.toString()}if(t){!0===t&&(t={});const i=ao.validate(e,t);if(!0!==i)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const i=new ro(this.options);i.addExternalEntities(this.externalEntities);const s=i.parseXml(e);return this.options.preserveOrder||void 0===s?s:oo(s,this.options)}addEntity(e,t){if(-1!==t.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==e.indexOf("&")||-1!==e.indexOf(";"))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}};function lo(e,t,i,s){let n="",r=!1;for(let o=0;o<e.length;o++){const a=e[o],c=ho(a);if(void 0===c)continue;let l="";if(l=0===i.length?c:`${i}.${c}`,c===t.textNodeName){let e=a[c];Io(l,t)||(e=t.tagValueProcessor(c,e),e=Eo(e,t)),r&&(n+=s),n+=e,r=!1;continue}if(c===t.cdataPropName){r&&(n+=s),n+=`<![CDATA[${a[c][0][t.textNodeName]}]]>`,r=!1;continue}if(c===t.commentPropName){n+=s+`\x3c!--${a[c][0][t.textNodeName]}--\x3e`,r=!0;continue}if("?"===c[0]){const e=uo(a[":@"],t),i="?xml"===c?"":s;let o=a[c][0][t.textNodeName];o=0!==o.length?" "+o:"",n+=i+`<${c}${o}${e}?>`,r=!0;continue}let h=s;""!==h&&(h+=t.indentBy);const u=s+`<${c}${uo(a[":@"],t)}`,I=lo(a[c],t,l,h);-1!==t.unpairedTags.indexOf(c)?t.suppressUnpairedNode?n+=u+">":n+=u+"/>":I&&0!==I.length||!t.suppressEmptyNode?I&&I.endsWith(">")?n+=u+`>${I}${s}</${c}>`:(n+=u+">",I&&""!==s&&(I.includes("/>")||I.includes("</"))?n+=s+t.indentBy+I+s:n+=I,n+=`</${c}>`):n+=u+"/>",r=!0}return n}function ho(e){const t=Object.keys(e);for(let i=0;i<t.length;i++){const s=t[i];if(e.hasOwnProperty(s)&&":@"!==s)return s}}function uo(e,t){let i="";if(e&&!t.ignoreAttributes)for(let s in e){if(!e.hasOwnProperty(s))continue;let n=t.attributeValueProcessor(s,e[s]);n=Eo(n,t),!0===n&&t.suppressBooleanAttributes?i+=` ${s.substr(t.attributeNamePrefix.length)}`:i+=` ${s.substr(t.attributeNamePrefix.length)}="${n}"`}return i}function Io(e,t){let i=(e=e.substr(0,e.length-t.textNodeName.length-1)).substr(e.lastIndexOf(".")+1);for(let s in t.stopNodes)if(t.stopNodes[s]===e||t.stopNodes[s]==="*."+i)return!0;return!1}function Eo(e,t){if(e&&e.length>0&&t.processEntities)for(let i=0;i<t.entities.length;i++){const s=t.entities[i];e=e.replace(s.regex,s.val)}return e}const fo=function(e,t){let i="";return t.format&&t.indentBy.length>0&&(i="\n"),lo(e,t,"",i)},po={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},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 Co(e){this.options=Object.assign({},po,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Ro),this.processTextOrObjNode=To,this.options.format?(this.indentate=mo,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function To(e,t,i){const s=this.j2x(e,i+1);return void 0!==e[this.options.textNodeName]&&1===Object.keys(e).length?this.buildTextValNode(e[this.options.textNodeName],t,s.attrStr,i):this.buildObjectNode(s.val,t,s.attrStr,i)}function mo(e){return this.options.indentBy.repeat(e)}function Ro(e){return!(!e.startsWith(this.options.attributeNamePrefix)||e===this.options.textNodeName)&&e.substr(this.attrPrefixLen)}Co.prototype.build=function(e){return this.options.preserveOrder?fo(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)},Co.prototype.j2x=function(e,t){let i="",s="";for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n))if(void 0===e[n])this.isAttribute(n)&&(s+="");else if(null===e[n])this.isAttribute(n)?s+="":"?"===n[0]?s+=this.indentate(t)+"<"+n+"?"+this.tagEndChar:s+=this.indentate(t)+"<"+n+"/"+this.tagEndChar;else if(e[n]instanceof Date)s+=this.buildTextValNode(e[n],n,"",t);else if("object"!=typeof e[n]){const r=this.isAttribute(n);if(r)i+=this.buildAttrPairStr(r,""+e[n]);else if(n===this.options.textNodeName){let t=this.options.tagValueProcessor(n,""+e[n]);s+=this.replaceEntitiesValue(t)}else s+=this.buildTextValNode(e[n],n,"",t)}else if(Array.isArray(e[n])){const i=e[n].length;let r="",o="";for(let a=0;a<i;a++){const i=e[n][a];if(void 0===i);else if(null===i)"?"===n[0]?s+=this.indentate(t)+"<"+n+"?"+this.tagEndChar:s+=this.indentate(t)+"<"+n+"/"+this.tagEndChar;else if("object"==typeof i)if(this.options.oneListGroup){const e=this.j2x(i,t+1);r+=e.val,this.options.attributesGroupName&&i.hasOwnProperty(this.options.attributesGroupName)&&(o+=e.attrStr)}else r+=this.processTextOrObjNode(i,n,t);else if(this.options.oneListGroup){let e=this.options.tagValueProcessor(n,i);e=this.replaceEntitiesValue(e),r+=e}else r+=this.buildTextValNode(i,n,"",t)}this.options.oneListGroup&&(r=this.buildObjectNode(r,n,o,t)),s+=r}else if(this.options.attributesGroupName&&n===this.options.attributesGroupName){const t=Object.keys(e[n]),s=t.length;for(let r=0;r<s;r++)i+=this.buildAttrPairStr(t[r],""+e[n][t[r]])}else s+=this.processTextOrObjNode(e[n],n,t);return{attrStr:i,val:s}},Co.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&"true"===t?" "+e:" "+e+'="'+t+'"'},Co.prototype.buildObjectNode=function(e,t,i,s){if(""===e)return"?"===t[0]?this.indentate(s)+"<"+t+i+"?"+this.tagEndChar:this.indentate(s)+"<"+t+i+this.closeTag(t)+this.tagEndChar;{let n="</"+t+this.tagEndChar,r="";return"?"===t[0]&&(r="?",n=""),!i&&""!==i||-1!==e.indexOf("<")?!1!==this.options.commentPropName&&t===this.options.commentPropName&&0===r.length?this.indentate(s)+`\x3c!--${e}--\x3e`+this.newLine:this.indentate(s)+"<"+t+i+r+this.tagEndChar+e+this.indentate(s)+n:this.indentate(s)+"<"+t+i+r+">"+e+n}},Co.prototype.closeTag=function(e){let t="";return-1!==this.options.unpairedTags.indexOf(e)?this.options.suppressUnpairedNode||(t="/"):t=this.options.suppressEmptyNode?"/":`></${e}`,t},Co.prototype.buildTextValNode=function(e,t,i,s){if(!1!==this.options.cdataPropName&&t===this.options.cdataPropName)return this.indentate(s)+`<![CDATA[${e}]]>`+this.newLine;if(!1!==this.options.commentPropName&&t===this.options.commentPropName)return this.indentate(s)+`\x3c!--${e}--\x3e`+this.newLine;if("?"===t[0])return this.indentate(s)+"<"+t+i+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(t,e);return n=this.replaceEntitiesValue(n),""===n?this.indentate(s)+"<"+t+i+this.closeTag(t)+this.tagEndChar:this.indentate(s)+"<"+t+i+">"+n+"</"+t+this.tagEndChar}},Co.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const i=this.options.entities[t];e=e.replace(i.regex,i.val)}return e};var go={XMLParser:co,XMLValidator:ir,XMLBuilder:Co};class Ao{constructor(e,i){t(this,"date",new Date),t(this,"author"),t(this,"guid",Ii.create()),t(this,"viewpoint"),t(this,"modifiedAuthor"),t(this,"modifiedDate"),t(this,"topic"),t(this,"_components"),t(this,"_comment",""),this._components=e,this._comment=i;const s=this._components.get(Lo);this.author=s.config.author}set comment(e){var t;const i=this._components.get(Lo);this._comment=e,this.modifiedDate=new Date,this.modifiedAuthor=i.config.author,null==(t=this.topic)||t.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>`),`\n <Comment Guid="${this.guid}">\n <Date>${this.date.toISOString()}</Date>\n <Author>${this.author}</Author>\n <Comment>${this.comment}</Comment>\n ${e??""}\n ${i??""}\n ${t??""}\n </Comment>\n `}}const Fo=class e{constructor(i){t(this,"guid",Ii.create()),t(this,"title",e.default.title),t(this,"creationDate",new Date),t(this,"creationAuthor",""),t(this,"viewpoints",new Ht),t(this,"relatedTopics",new Ht),t(this,"comments",new Wt),t(this,"customData",{}),t(this,"description"),t(this,"serverAssignedId"),t(this,"dueDate"),t(this,"modifiedAuthor"),t(this,"modifiedDate"),t(this,"index"),t(this,"_type",e.default.type),t(this,"_status",e.default.status),t(this,"_priority",e.default.priority),t(this,"_stage",e.default.stage),t(this,"_assignedTo",e.default.assignedTo),t(this,"_labels",e.default.labels??new Set),t(this,"_components"),this._components=i;const s=i.get(Lo);this.creationAuthor=s.config.author,this.relatedTopics.guard=e=>e!==this.guid}set type(e){const t=this._components.get(Lo),{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(Lo),{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(Lo);if(e){const{strict:i,priorities:s}=t.config;if(!(!i||s.has(e)))return;this._priority=e}else this._priority=e}get priority(){return this._priority}set stage(e){const t=this._components.get(Lo);if(e){const{strict:i,stages:s}=t.config;if(!(!i||s.has(e)))return;this._stage=e}else this._stage=e}get stage(){return this._stage}set assignedTo(e){const t=this._components.get(Lo);if(e){const{strict:i,users:s}=t.config;if(!(!i||s.has(e)))return;this._assignedTo=e}else this._assignedTo=e}get assignedTo(){return this._assignedTo}set labels(e){const t=this._components.get(Lo),{strict:i,labels:s}=t.config;if(i){const t=new Set;for(const n of e){(!i||s.has(n))&&t.add(n)}this._labels=t}else this._labels=e}get labels(){return this._labels}get _managerVersion(){return this._components.get(Lo).config.version}set(e){const t=e,i=this;for(const s in e){if("guid"===s)continue;const e=t[s];s in this&&(i[s]=e)}return this._components.get(Lo).list.set(this.guid,this),this}createComment(e,t){const i=new Ao(this._components,e);return i.viewpoint=t,i.topic=this,this.comments.set(i.guid,i),i}createLabelTags(e=this._managerVersion){let t="Labels";"2.1"===e&&(t="Labels"),"3"===e&&(t="Label");let i=[...this.labels].map((e=>`<${t}>${e}</${t}>`)).join("\n");for(const e in this.customData){const s=this.customData[e];"string"==typeof s&&(i+=`\n<${t}>${s}</${t}>`)}return"2.1"===e?i:"3"===e?0!==i.length?`<Labels>\n${i}\n</Labels>`:"<Labels/>":i}createCommentTags(e=this._managerVersion){const t=[...this.comments.values()].map((e=>e.serialize())).join("\n");return"2.1"===e?t:"3"===e?0!==t.length?`<Comments>\n${t}\n</Comments>`:"<Comments/>":t}createViewpointTags(e=this._managerVersion){let t="Viewpoints";"2.1"===e&&(t="Viewpoints"),"3"===e&&(t="ViewPoint");const i=this._components.get(ia),s=[...this.viewpoints].map((e=>i.list.get(e))).filter((e=>e)).map((e=>`<${t} Guid="${e.guid}">\n <Viewpoint>${e.guid}.bcfv</Viewpoint>\n <Snapshot>${e.guid}.jpeg</Snapshot>\n </${t}>\n `)).join("\n");return"2.1"===e?s:"3"===e?0!==s.length?`<Viewpoints>\n${s}\n</Viewpoints>`:"<Viewpoints />":s}createRelatedTopicTags(e=this._managerVersion){const t=[...this.relatedTopics].map((e=>`<RelatedTopic Guid="${e}"></RelatedTopic>\n `)).join("\n");return"2.1"===e?t:"3"===e?0!==t.length?`<RelatedTopics>\n${t}\n</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&&"2.1"===e&&(s=`<Index>${this.index}</Index>`);let n=null;this.modifiedDate&&(n=`<ModifiedDate>${this.modifiedDate.toISOString()}</ModifiedDate>`);let r=null;this.modifiedAuthor&&(r=`<ModifiedAuthor>${this.modifiedAuthor}</ModifiedAuthor>`);let o=null;this.dueDate&&(o=`<DueDate>${this.dueDate.toISOString()}</DueDate>`);let a=null;this.assignedTo&&(a=`<AssignedTo>${this.assignedTo}</AssignedTo>`);let c=null;this.description&&(c=`<Description>${this.description}</Description>`);let l=null;this.stage&&(l=`<Stage>${this.stage}</Stage>`);const h=this.createCommentTags(e),u=this.createViewpointTags(e),I=this.createLabelTags(e),d=this.createRelatedTopicTags(e);return`\n <?xml version="1.0" encoding="UTF-8"?>\n <Markup>\n <Topic Guid="${this.guid}" TopicType="${this.type}" TopicStatus="${this.status}" ${t??""}>\n <Title>${this.title}</Title>\n <CreationDate>${this.creationDate.toISOString()}</CreationDate>\n <CreationAuthor>${this.creationAuthor}</CreationAuthor>\n ${i??""}\n ${s??""}\n ${n??""}\n ${r??""}\n ${o??""}\n ${a??""}\n ${c??""}\n ${l??""}\n ${I}\n ${d}\n ${"3"===e?h:""}\n ${"3"===e?u:""}\n </Topic>\n ${"2.1"===e?h:""}\n ${"2.1"===e?u:""}\n </Markup>\n `}};t(Fo,"default",{title:"BCF Topic",type:"Issue",status:"Active"});let So=Fo;const Oo=(e,t)=>{if(""===t.trim())return;const i=Lo.xmlParser.parse(t).Extensions;if(!i)return;const{Priorities:s,TopicStatuses:n,TopicTypes:r,Users:o}=i;if(s&&s.Priority){const t=Array.isArray(s.Priority)?s.Priority:[s.Priority];for(const i of t)e.config.priorities.add(i)}if(n&&n.TopicStatus){const t=Array.isArray(n.TopicStatus)?n.TopicStatus:[n.TopicStatus];for(const i of t)e.config.statuses.add(i)}if(r&&r.TopicType){const t=Array.isArray(r.TopicType)?r.TopicType:[r.TopicType];for(const i of t)e.config.types.add(i)}if(o&&o.User){const t=Array.isArray(o.User)?o.User:[o.User];for(const i of t)e.config.users.add(i)}};class No extends pi{constructor(){super(...arguments),t(this,"_config",{version:{type:"Select",options:new Set(["2.1","3"]),multiple:!1,value:""},author:{type:"Text",value:""},types:{type:"TextSet",value:new Set},statuses:{type:"TextSet",value:new Set},priorities:{type:"TextSet",value:new Set},labels:{type:"TextSet",value:new Set},stages:{type:"TextSet",value:new Set},users:{type:"TextSet",value:new Set},includeSelectionTag:{type:"Boolean",value:!1},updateExtensionsOnImport:{type:"Boolean",value:!1},strict:{type:"Boolean",value:!1},includeAllExtensionsOnExport:{type:"Boolean",value:!1},fallbackVersionOnImport:{type:"Select",multiple:!1,options:new Set(["2.1","3"]),value:""},ignoreIncompleteTopicsOnImport:{type:"Boolean",value:!1}})}get version(){return this._config.version.value}set version(e){this._config.version.value=e}get author(){return this._config.author.value}set author(e){this._config.author.value=e}get types(){return this._config.types.value}set types(e){this._config.types.value=e}get statuses(){return this._config.statuses.value}set statuses(e){this._config.statuses.value=e}get priorities(){return this._config.priorities.value}set priorities(e){this._config.priorities.value=e}get labels(){return this._config.labels.value}set labels(e){this._config.labels.value=e}get stages(){return this._config.stages.value}set stages(e){this._config.stages.value=e}get users(){return this._config.users.value}set users(e){this._config.users.value=e}get includeSelectionTag(){return this._config.includeSelectionTag.value}set includeSelectionTag(e){this._config.includeSelectionTag.value=e}get updateExtensionsOnImport(){return this._config.updateExtensionsOnImport.value}set updateExtensionsOnImport(e){this._config.updateExtensionsOnImport.value=e}get strict(){return this._config.strict.value}set strict(e){this._config.strict.value=e}get includeAllExtensionsOnExport(){return this._config.includeAllExtensionsOnExport.value}set includeAllExtensionsOnExport(e){this._config.includeAllExtensionsOnExport.value=e}get fallbackVersionOnImport(){return this._config.fallbackVersionOnImport.value}set fallbackVersionOnImport(e){this._config.fallbackVersionOnImport.value=e}get ignoreIncompleteTopicsOnImport(){return this._config.ignoreIncompleteTopicsOnImport.value}set ignoreIncompleteTopicsOnImport(e){this._config.ignoreIncompleteTopicsOnImport.value=e}}const yo=class e extends xt{constructor(){super(...arguments),t(this,"enabled",!1),t(this,"_defaultConfig",{author:"jhon.doe@example.com",version:"2.1",types:new Set(["Clash","Failure","Fault","Inquiry","Issue","Remark","Request"]),statuses:new Set(["Active","In Progress","Done","In Review","Closed"]),priorities:new Set(["On hold","Minor","Normal","Major","Critical"]),labels:new Set,stages:new Set,users:new Set,includeSelectionTag:!1,updateExtensionsOnImport:!0,strict:!1,includeAllExtensionsOnExport:!0,fallbackVersionOnImport:"2.1",ignoreIncompleteTopicsOnImport:!1}),t(this,"config",new No(this,this.components,"BCF Topics",e.uuid)),t(this,"list",new Wt),t(this,"onSetup",new Dt),t(this,"isSetup",!1),t(this,"onBCFImported",new Dt),t(this,"onDisposed",new Dt)}setup(e){if(this.isSetup)return;const t={...this._defaultConfig,...e};this.config.version=t.version,this.config.author=t.author,this.config.types=t.types,this.config.statuses=t.statuses,this.config.priorities=t.priorities,this.config.labels=t.labels,this.config.stages=t.stages,this.config.users=t.users,this.config.includeSelectionTag=t.includeSelectionTag,this.config.updateExtensionsOnImport=t.updateExtensionsOnImport,this.config.strict=t.strict,this.config.includeAllExtensionsOnExport=t.includeAllExtensionsOnExport,this.config.fallbackVersionOnImport=t.fallbackVersionOnImport||"",this.config.ignoreIncompleteTopicsOnImport=t.ignoreIncompleteTopicsOnImport,this.isSetup=!0,this.enabled=!0,this.onSetup.trigger()}create(e){const t=new So(this.components);return e?(t.guid=e.guid??t.guid,t.set(e)):this.list.set(t.guid,t),t}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get usedTypes(){const e=[...this.list].map((([e,t])=>t.type));return new Set(e)}get usedStatuses(){const e=[...this.list].map((([e,t])=>t.status));return new Set(e)}get usedPriorities(){const e=[...this.list].map((([e,t])=>t.priority)).filter((e=>e));return new Set(e)}get usedStages(){const e=[...this.list].map((([e,t])=>t.stage)).filter((e=>e));return new Set(e)}get usedUsers(){const e=[];for(const[t,i]of this.list){e.push(i.creationAuthor),i.assignedTo&&e.push(i.assignedTo),i.modifiedAuthor&&e.push(i.modifiedAuthor);for(const[t,s]of i.comments)e.push(s.author),s.modifiedAuthor&&e.push(s.modifiedAuthor)}return new Set(e)}get usedLabels(){const e=[];for(const[t,i]of this.list)e.push(...i.labels);return new Set(e)}updateExtensions(){for(const[e,t]of this.list){for(const e of t.labels)this.config.labels.add(e);this.config.types.add(t.type),t.priority&&this.config.priorities.add(t.priority),t.stage&&this.config.stages.add(t.stage),this.config.statuses.add(t.status),this.config.users.add(t.creationAuthor),t.assignedTo&&this.config.users.add(t.assignedTo),t.modifiedAuthor&&this.config.users.add(t.modifiedAuthor);for(const[e,i]of t.comments)this.config.users.add(i.author),i.modifiedAuthor&&this.config.users.add(i.modifiedAuthor)}}updateViewpointReferences(){const e=this.components.get(ia);for(const[t,i]of this.list)for(const t of i.viewpoints){e.list.has(t)||i.viewpoints.delete(t)}}async export(e=this.list.values()){const t=new tr;t.file("bcf.version",`<?xml version="1.0" encoding="UTF-8"?>\n <Version VersionId="${this.config.version}" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/buildingSMART/BCF-XML/release_3_0/Schemas/version.xsd"\n xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\n </Version>`),t.file("bcf.extensions",this.serializeExtensions());const i=await fetch("https://thatopen.github.io/engine_components/resources/favicon.ico"),s=await i.arrayBuffer(),n=this.components.get(ia);for(const i of e){const e=t.folder(i.guid);e.file("markup.bcf",i.serialize());for(const t of i.viewpoints){const i=n.list.get(t);i&&(e.file(`${t}.jpeg`,s,{binary:!0}),e.file(`${t}.bcfv`,await i.serialize()))}}return await t.generateAsync({type:"blob"})}serializeExtensions(){const e=[...this.config.types].map((e=>`<TopicType>${e}</TopicType>`)).join("\n"),t=[...this.config.statuses].map((e=>`<TopicStatus>${e}</TopicStatus>`)).join("\n"),i=[...this.config.priorities].map((e=>`<Priority>${e}</Priority>`)).join("\n"),s=[...this.config.labels].map((e=>`<TopicLabel>${e}</TopicLabel>`)).join("\n"),n=[...this.config.stages].map((e=>`<Stage>${e}</Stage>`)).join("\n"),r=[...this.config.users].map((e=>`<User>${e}</User>`)).join("\n");return`\n <?xml version="1.0" encoding="UTF-8"?>\n <Extensions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="your-schema-location.xsd">\n ${0!==e.length?`<TopicTypes>\n${e}\n</TopicTypes>`:""}\n ${0!==t.length?`<TopicStatuses>\n${t}\n</TopicStatuses>`:""}\n ${0!==i.length?`<Priorities>\n${i}\n</Priorities>`:""}\n ${0!==s.length?`<TopicLabels>\n${s}\n</TopicLabels>`:""}\n ${0!==n.length?`<Stages>\n${n}\n</Stages>`:""}\n ${0!==r.length?`<Users>\n${r}\n</Users>`:""}\n </Extensions>\n `}processMarkupComment(e){const{Guid:t,Date:i,Author:s,Comment:n,Viewpoint:r}=e;if(!(t&&i&&s&&(Ao||r)))return null;const o=this.components.get(ia),a=new Ao(this.components,n??"");return a.guid=t,a.date=new Date(i),a.author=s,a.viewpoint=(null==r?void 0:r.Guid)?o.list.get(r.Guid):void 0,a.modifiedAuthor=e.ModifiedAuthor,a.modifiedDate=e.ModifiedDate?new Date(e.ModifiedDate):void 0,a}getMarkupComments(e,t){var i;let s;if("2.1"===t&&(s=e.Comment),"3"===t&&(s=null==(i=e.Topic.Comments)?void 0:i.Comment),!s)return[];s=Array.isArray(s)?s:[s];const n=s.map((e=>this.processMarkupComment(e))).filter((e=>e));return Array.isArray(n)?n:[n]}getMarkupLabels(e,t){var i;let s;if("2.1"===t&&(s=e.Topic.Labels),"3"===t&&(s=null==(i=e.Topic.Labels)?void 0:i.Label),!s)return[];return Array.isArray(s)?s:[s]}getMarkupViewpoints(e,t){var i;let s;return"2.1"===t&&(s=e.Viewpoints),"3"===t&&(s=null==(i=e.Topic.Viewpoints)?void 0:i.ViewPoint),s?(s=Array.isArray(s)?s:[s],s):[]}getMarkupRelatedTopics(e,t){var i;let s;if("2.1"===t&&(s=e.Topic.RelatedTopic),"3"===t&&(s=null==(i=e.Topic.RelatedTopics)?void 0:i.RelatedTopic),!s)return[];return(Array.isArray(s)?s:[s]).map((e=>e.Guid))}async load(t,i){var s;const{fallbackVersionOnImport:n,ignoreIncompleteTopicsOnImport:r,updateExtensionsOnImport:a}=this.config,c=new tr;await c.loadAsync(t);const l=Object.values(c.files);let h=n;const u=l.find((e=>e.name.endsWith(".version")));if(u){const t=await u.async("string"),i=e.xmlParser.parse(t).Version.VersionId;h=String(i)}if(!h||"2.1"!==h&&"3"!==h)throw new Error(`BCFTopics: ${h} is not supported.`);const I=l.find((e=>e.name.endsWith(".extensions")));if(a&&I){const e=await I.async("string");Oo(this,e)}const d=[],E=this.components.get(ia),f=l.filter((e=>e.name.endsWith(".bcfv")));for(const t of f){const n=await t.async("string"),r=e.xmlParser.parse(n).VisualizationInfo;if(!r){console.warn("Missing VisualizationInfo in Viewpoint");continue}const a={},{Guid:c,ClippingPlanes:l,Components:u,OrthogonalCamera:I,PerspectiveCamera:E}=r;if(c&&(a.guid=c),u){const{Selection:e,Visibility:t}=u;if(e&&e.Component){const t=Array.isArray(e.Component)?e.Component:[e.Component];a.selectionComponents=t.map((e=>e.IfcGuid)).filter((e=>e))}if(t&&"DefaultVisibility"in t&&(a.defaultVisibility=t.DefaultVisibility),t&&t.Exceptions&&"Component"in t.Exceptions){const{Component:e}=t.Exceptions,i=Array.isArray(e)?e:[e];a.exceptionComponents=i.map((e=>e.IfcGuid)).filter((e=>e))}let i;"2.1"===h&&(i=u.ViewSetupHints),"3"===h&&(i=null==(s=u.Visibility)?void 0:s.ViewSetupHints),i&&("OpeningsVisible"in i&&(a.openingsVisible=i.OpeningsVisible),"SpacesVisible"in i&&(a.spacesVisible=i.SpacesVisible),"SpaceBoundariesVisible"in i&&(a.spaceBoundariesVisible=i.SpaceBoundariesVisible))}if(I||E){const e=r.PerspectiveCamera??r.OrthogonalCamera,{CameraViewPoint:t,CameraDirection:i}=e,s=new o.Vector3(Number(t.X),Number(t.Z),Number(-t.Y)),n=new o.Vector3(Number(i.X),Number(i.Z),Number(-i.Y)),c={position:{x:s.x,y:s.y,z:s.z},direction:{x:n.x,y:n.y,z:n.z},aspectRatio:"AspectRatio"in e?e.AspectRatio:1};"ViewToWorldScale"in e&&(a.camera={...c,viewToWorldScale:e.ViewToWorldScale}),"FieldOfView"in e&&(a.camera={...c,fov:e.FieldOfView})}const f=new Jo(this.components,i,{data:a,setCamera:!1});if(u){const{Coloring:e}=u;if(e&&e.Color){const t=Array.isArray(e.Color)?e.Color:[e.Color];for(const e of t){const{Color:t,Component:i}=e,s=(Array.isArray(i)?i:[i]).map((e=>e.IfcGuid));f.componentColors.set(t,s)}}}if(d.push(f),l){const e=this.components.get(gn),t=Array.isArray(l.ClippingPlane)?l.ClippingPlane:[l.ClippingPlane];for(const s of t){const{Location:t,Direction:n}=s;if(!t||!n)continue;const r=new o.Vector3(t.X,t.Z,-t.Y),a=new o.Vector3(n.X,-n.Z,n.Y),c=e.createFromNormalAndCoplanarPoint(i,a,r);c.visible=!1,c.enabled=!1,f.clippingPlanes.add(c)}}}const p={},C=[],T=l.filter((e=>e.name.endsWith(".bcf")));for(const t of T){const i=await t.async("string"),s=e.xmlParser.parse(i).Markup,n=s.Topic,{Guid:o,TopicType:a,TopicStatus:c,Title:l,CreationDate:u,CreationAuthor:I}=n;if(r&&!(o&&a&&c&&l&&u&&I))continue;const d=new So(this.components);d.guid=o??d.guid;const f=this.getMarkupRelatedTopics(s,h);p[d.guid]=new Set(f),d.type=a??d.type,d.status=c??d.status,d.title=l??d.title,d.creationDate=u?new Date(u):d.creationDate,d.creationAuthor=I??d.creationAuthor,d.serverAssignedId=n.ServerAssignedId,d.priority=n.Priority,d.index=n.Index,d.modifiedDate=n.ModifiedDate?new Date(n.ModifiedDate):void 0,d.modifiedAuthor=n.ModifiedAuthor,d.dueDate=n.DueDate?new Date(n.DueDate):void 0,d.assignedTo=n.AssignedTo,d.description=n.Description,d.stage=n.Stage;const T=this.getMarkupLabels(s,h);for(const e of T)d.labels.add(e);const m=this.getMarkupComments(s,h);for(const e of m)d.comments.set(e.guid,e);const R=this.getMarkupViewpoints(s,h);for(const e of R){if(!e||!e.Guid)continue;const t=E.list.get(e.Guid);t&&d.viewpoints.add(t.guid)}this.list.set(d.guid,d),C.push(d)}for(const e in p){const t=this.list.get(e);if(!t)continue;const i=p[e];for(const e of i)t.relatedTopics.add(e)}return this.onBCFImported.trigger(C),{viewpoints:d,topics:C}}};t(yo,"uuid","de977976-e4f6-4e4f-a01a-204727839802"),t(yo,"xmlParser",new go.XMLParser({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,ignoreDeclaration:!0,ignorePiTags:!0,numberParseOptions:{leadingZeros:!0,hex:!0},parseAttributeValue:!0,preserveOrder:!1,processEntities:!1,removeNSPrefix:!0,trimValues:!0}));let Lo=yo;const _o=class e extends xt{constructor(i){super(i),t(this,"enabled",!0),t(this,"onDisposed",new Dt),t(this,"_absoluteMin"),t(this,"_absoluteMax"),t(this,"_meshes",[]),this.components.add(e.uuid,this),this._absoluteMin=e.newBound(!0),this._absoluteMax=e.newBound(!1)}static getDimensions(e){const{min:t,max:i}=e,s=Math.abs(i.x-t.x),n=Math.abs(i.y-t.y),r=Math.abs(i.z-t.z),a=new o.Vector3;return a.subVectors(i,t).divideScalar(2).add(t),{width:s,height:n,depth:r,center:a}}static newBound(e){const t=e?1:-1;return new o.Vector3(t*Number.MAX_VALUE,t*Number.MAX_VALUE,t*Number.MAX_VALUE)}static getBounds(e,t,i){const s=i||this.newBound(!1),n=t||this.newBound(!0);for(const t of e)t.x<n.x&&(n.x=t.x),t.y<n.y&&(n.y=t.y),t.z<n.z&&(n.z=t.z),t.x>s.x&&(s.x=t.x),t.y>s.y&&(s.y=t.y),t.z>s.z&&(s.z=t.z);return new o.Box3(t,i)}dispose(){const t=this.components.get(zt);for(const e of this._meshes)t.destroy(e);this._meshes=[],this.onDisposed.trigger(e.uuid),this.onDisposed.reset()}get(){const e=this._absoluteMin.clone(),t=this._absoluteMax.clone();return new o.Box3(e,t)}getSphere(){const e=this._absoluteMin.clone(),t=this._absoluteMax.clone(),i=Math.abs((t.x-e.x)/2),s=Math.abs((t.y-e.y)/2),n=Math.abs((t.z-e.z)/2),r=new o.Vector3(e.x+i,e.y+s,e.z+n),a=r.distanceTo(e);return new o.Sphere(r,a)}getMesh(){const t=new o.Box3(this._absoluteMin,this._absoluteMax),i=e.getDimensions(t),{width:s,height:n,depth:r,center:a}=i,c=new o.BoxGeometry(s,n,r),l=new o.Mesh(c);return this._meshes.push(l),l.position.copy(a),l}reset(){this._absoluteMin=e.newBound(!0),this._absoluteMax=e.newBound(!1)}add(e){for(const t of e.items)this.addMesh(t.mesh)}addMesh(t,i){if(!t.geometry.index)return;const s=e.getFragmentBounds(t);t.updateMatrixWorld();const n=t.matrixWorld,r=new o.Matrix4,c=t instanceof o.InstancedMesh,l=new Set;if(t instanceof a.FragmentMesh){i||(i=t.fragment.ids);for(const e of i){const i=t.fragment.getInstancesIDs(e);if(i)for(const e of i)l.add(e)}}else l.add(0);for(const e of l){const i=s.min.clone(),o=s.max.clone();c&&(t.getMatrixAt(e,r),i.applyMatrix4(r),o.applyMatrix4(r)),i.applyMatrix4(n),o.applyMatrix4(n),i.x<this._absoluteMin.x&&(this._absoluteMin.x=i.x),i.y<this._absoluteMin.y&&(this._absoluteMin.y=i.y),i.z<this._absoluteMin.z&&(this._absoluteMin.z=i.z),i.x>this._absoluteMax.x&&(this._absoluteMax.x=i.x),i.y>this._absoluteMax.y&&(this._absoluteMax.y=i.y),i.z>this._absoluteMax.z&&(this._absoluteMax.z=i.z),o.x>this._absoluteMax.x&&(this._absoluteMax.x=o.x),o.y>this._absoluteMax.y&&(this._absoluteMax.y=o.y),o.z>this._absoluteMax.z&&(this._absoluteMax.z=o.z),o.x<this._absoluteMin.x&&(this._absoluteMin.x=o.x),o.y<this._absoluteMin.y&&(this._absoluteMin.y=o.y),o.z<this._absoluteMin.z&&(this._absoluteMin.z=o.z)}}addFragmentIdMap(e){const t=this.components.get(Qn);for(const i in e){const s=t.list.get(i);if(!s)continue;const n=e[i];this.addMesh(s.mesh,n)}}static getFragmentBounds(e){const t=e.geometry.attributes.position,i=Number.MAX_VALUE,s=-i,n=new o.Vector3(i,i,i),r=new o.Vector3(s,s,s);if(!e.geometry.index)throw new Error("Geometry must be indexed!");const a=Array.from(e.geometry.index.array);for(let e=0;e<a.length;e++){if(e%3==0&&0===a[e]&&0===a[e+1]&&0===a[e+2]){e+=2;continue}const i=a[e],s=t.getX(i),o=t.getY(i),c=t.getZ(i);s<n.x&&(n.x=s),o<n.y&&(n.y=o),c<n.z&&(n.z=c),s>r.x&&(r.x=s),o>r.y&&(r.y=o),c>r.z&&(r.z=c)}return new o.Box3(n,r)}};t(_o,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let Po=_o;const wo=class e extends xt{constructor(i){super(i),t(this,"enabled",!0),i.add(e.uuid,this)}async getIsolatedElements(e,t,i){const s=new Set;function n(i){if(s.has(i))return;const r=e.GetLine(t,i);if(r){s.add(i);for(const e in r){const t=r[e];t&&"Handle"===t.constructor.name&&t.value>0?n(t.value):Array.isArray(t)&&t.forEach((e=>{e&&"Handle"===e.constructor.name&&e.value>0&&n(e.value)}))}}}for(const e of i)n(e);const r=[];for(const e of s)r.push(e);r.sort(((e,t)=>e-t));const o=[];return r.forEach((i=>{const s=e.GetLine(t,i);o.push(s)})),o}async export(e,t,i){i.forEach((i=>{e.WriteLine(t,i)}));return e.SaveModel(t)}async splitIfc(e,t,i){const s=new Uint8Array(t),n=e.OpenModel(s),r=await this.getIsolatedElements(e,n,i),o=e.CreateModel({schema:c.Schemas.IFC2X3});return await this.export(e,o,r)}};t(wo,"uuid","6eb0ba2f-71c0-464e-bcec-2d7c335186b2");let Mo=wo;const vo=class e{constructor(e){t(this,"onProgress",new Dt),t(this,"inclusive",!1),t(this,"rules",[]),t(this,"ids",{}),t(this,"needsUpdate",new Map),t(this,"components"),this.components=e}static import(t,i){const s=e.importers.get(i.type);return s?s(t,i):(console.warn("Invalid query data:.",i),null)}static importRules(e){const t=[];for(const i of e){const e={};for(const t in i){const s=i[t];s.regexp?e[t]=new RegExp(s.value):e[t]=s}t.push(e)}return t}static importIds(e){const t={};for(const i in e.ids)t[i]=new Set(e.ids[i]);return t}clear(e){if(void 0===e)return this.ids={},void this.needsUpdate.clear();delete this.ids[e],this.needsUpdate.delete(e)}addID(e,t){this.ids[e]||(this.ids[e]=new Set),this.ids[e].add(t)}getData(){const e={};for(const t in this.ids)e[t]=Array.from(this.ids[t]);const t=this.exportRules();return{name:this.name,inclusive:this.inclusive,type:"IfcFinderQuery",ids:e,rules:t}}exportRules(){const e=[];for(const t of this.rules){const i={};for(const e in t){const s=t[e];s instanceof RegExp?i[e]={regexp:!0,value:s.source}:i[e]=s}e.push(i)}return e}findInFile(e,t){return new Promise((i=>{const s=new FileReader,n=new TextDecoder("utf-8"),r=1024e4;let o=0;const a=/;/,c=()=>{if(o>=t.size)return void i();const e=Math.min(o+r+1e3,t.size),n=t.slice(o,e);s.readAsArrayBuffer(n)};s.onload=()=>{if(!(s.result instanceof ArrayBuffer))return;const i=new Uint8Array(s.result),l=n.decode(i).split(a);l.shift(),this.findInLines(e,l),this.onProgress.trigger(o/t.size),o+=r,c()},c()}))}getIdFromLine(e){const t=e.slice(e.indexOf("#")+1,e.indexOf("="));return parseInt(t,10)}testRules(e){let t=null,i=null,s=null,n=!1;for(const r of this.rules)if("category"!==r.type){if(null===i&&(i=this.getAttributesFromLine(e),null===i)){if(this.inclusive)continue;n=!1;break}if(null===t&&(t=this.getCategoryFromLine(e),null===t)){if(this.inclusive)continue;n=!1;break}if(null===s&&(s=Object.keys(new c.IFC4[t]),s=s.slice(2),null===s)){if(this.inclusive)continue;n=!1;break}if("property"===r.type){const{name:t,value:o}=r;if(!o.test(e)){if(this.inclusive)continue;n=!1;break}let a=!1;for(let e=0;e<i.length;e++){const n=i[e],r=s[e];if(o.test(n)&&t.test(r)){a=!0;break}}if(a)n=!0;else if(!this.inclusive){n=!1;break}}if("operator"===r.type){const{name:e,value:t,operator:o}=r;let a=!1;for(let n=0;n<i.length;n++){const r=s[n],c=i[n].replace(/IFCLENGTHMEASURE\(|IFCVOLUMEMEASURE\(|\)/g,"");if(e.test(r)){if("="===o&&parseFloat(c)===t){a=!0;break}if("<"===o&&parseFloat(c)<t){a=!0;break}if(">"===o&&parseFloat(c)>t){a=!0;break}if(">="===o&&parseFloat(c)>=t){a=!0;break}if("<="===o&&parseFloat(c)<=t){a=!0;break}}}if(a)n=!0;else if(!this.inclusive){n=!1;break}}}else{if(null===t&&(t=this.getCategoryFromLine(e),null===t)){if(this.inclusive)continue;break}if(!r.value.test(t)){if(this.inclusive)continue;n=!1;break}n=!0}return n}getCategoryFromLine(e){const t=e.indexOf("=")+1,i=e.indexOf("("),s=e.slice(t,i).trim(),n=wn[s];return n||null}getAttributesFromLine(e){const t=e.match(/\((.*)\)/);if(!t||!t[1])return null;return t[1].split(/,(?![^()]*\))/g).map((e=>e.trim()))}};t(vo,"importers",new Map);let Do=vo;class bo{constructor(e){t(this,"list",new Map),t(this,"id",o.MathUtils.generateUUID()),t(this,"mode","intersect"),t(this,"_components"),this._components=e}get queries(){return new Set(this.list.values())}get items(){const e=[];for(const t of this.queries)e.push(t.items);return"combine"===this.mode?a.FragmentUtils.combine(e):a.FragmentUtils.intersect(e)}add(e){if(this.list.has(e.name))throw new Error(`This group already has a query with the name ${e.name}.`);this.list.set(e.name,e)}clear(e){for(const t of this.queries)t.clear(e)}import(e){this.mode=e.mode,this.id=e.id;for(const t in e.queries){const i=Do.import(this._components,e.queries[t]);i&&this.list.set(t,i)}}export(){const e={};for(const[t,i]of this.list)e[t]=i.export();return{mode:this.mode,id:this.id,queries:e}}async update(e,t){for(const i of this.queries){const s=i.needsUpdate.get(e);(void 0===s||s)&&await i.update(e,t)}}}const Uo=class e extends Do{constructor(e,i){super(e),t(this,"name"),this.name=i.name,this.rules=i.rules,this.inclusive=i.inclusive}get items(){const e=this.components.get(Qn),t=[];for(const i in this.ids){const s=this.ids[i],n=e.groups.get(i);if(!n){console.warn(`Model ${i} not found!`);continue}const r=n.getFragmentMap(s);t.push(r)}return a.FragmentUtils.combine(t)}export(){const t=this.getData();return t.type=e.type,t}async update(e,t){this.ids[e]=new Set,await this.findInFile(e,t),this.needsUpdate.set(e,!1)}findInLines(e,t){for(const i of t){if(this.testRules(i)){const t=this.getIdFromLine(i);this.addID(e,t)}}}};t(Uo,"type","IfcBasicQuery");let xo=Uo;Do.importers.set(xo.type,((e,t)=>{const i=new xo(e,{name:t.name,rules:Do.importRules(t.rules),inclusive:t.inclusive});return i.ids=Do.importIds(t),i}));const Bo=class e extends Do{constructor(e,i){super(e),t(this,"name"),t(this,"psets",[]),this.name=i.name,this.rules=i.rules,this.inclusive=i.inclusive}get items(){const e=this.components.get(Zn),t=this.components.get(Qn),i=[];for(const s in this.ids){const n=t.groups.get(s);if(!n){console.log(`Model not found: ${s}.`);continue}const r=this.ids[s];for(const t of r){const r=e.getEntityRelations(s,t,"DefinesOcurrence");if(r){const e=n.getFragmentMap(r);i.push(e)}}}return a.FragmentUtils.combine(i)}export(){const t=this.getData();return t.type=e.type,t}async update(e,t){await this.findInFile(e,t);const i=new Set;for(const t of this.psets){const s=this.getAttributesFromLine(t);if(null===s)continue;const n=s[4].replace("(","[").replace(")","]").replace(/#/g,""),r=JSON.parse(n);for(const s of r){const n=this.ids[e];if(n&&n.has(s)){const e=this.getIdFromLine(t);i.add(e);break}}}this.ids[e]=i,this.psets=[],this.needsUpdate.set(e,!1)}findInLines(e,t){for(const i of t){const t=this.getCategoryFromLine(i);if("IfcPropertySet"===t){this.psets.push(i);continue}if("IfcPropertySingleValue"!==t)continue;if(this.testRules(i)){const t=this.getIdFromLine(i);this.addID(e,t)}}}};t(Bo,"type","IfcPropertyQuery");let Vo=Bo;Do.importers.set(Vo.type,((e,t)=>{const i=new Vo(e,{name:t.name,inclusive:t.inclusive,rules:Do.importRules(t.rules)});return i.ids=Do.importIds(t),i}));const Yo=class e extends xt{constructor(i){super(i),t(this,"enabled",!0),t(this,"list",new Map),i.add(e.uuid,this)}get queries(){const e=new Set;for(const[,t]of this.list)for(const i of t.queries)e.add(i);return e}import(e){for(const t in e){const i=new bo(this.components);i.import(e[t]),this.list.set(t,i)}}export(){const e={};for(const[t,i]of this.list)e[t]=i.export();return e}create(){const e=new bo(this.components);return this.list.set(e.id,e),e}delete(e){this.list.delete(e)}clear(){this.list.clear()}};t(Yo,"uuid","0da7ad77-f734-42ca-942f-a074adfd1e3a");let Go=Yo;const zo=class e extends xt{constructor(i){super(i),t(this,"enabled",!0),t(this,"list",{}),t(this,"onDisposed",new Dt),t(this,"onFragmentsDisposed",(e=>{const{groupID:t,fragmentIDs:i}=e;for(const e in this.list){const s=this.list[e],n=Object.keys(s);if(n.includes(t))delete s[t],0===Object.values(s).length&&delete this.list[e];else for(const e of n){const t=s[e];for(const e of i)delete t.map[e];0===Object.values(t).length&&delete s[e]}}})),i.add(e.uuid,this);i.get(Qn).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={};this.components.get(Qn).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(e){for(const t in this.list){const i=this.list[t];for(const t in i){delete i[t].map[e]}}}find(e){const t=this.components.get(Qn);if(!e){const e={};for(const[i,s]of t.list)e[i]=new Set(s.ids);return e}const i=Object.keys(e).length,s={};for(const t in e){const i=e[t];if(this.list[t])for(const e of i){const i=this.list[t][e];if(i)for(const e in i.map){s[e]||(s[e]=new Map);for(const t of i.map[e]){const i=s[e].get(t);void 0===i?s[e].set(t,1):s[e].set(t,i+1)}}}else console.warn(`Classification ${t} does not exist.`)}const n={};for(const e in s){const t=s[e];for(const[s,r]of t){if(void 0===r)throw new Error("Malformed fragments map!");r===i&&(n[e]||(n[e]=new Set),n[e].add(s))}}return n}byModel(e,t){this.list.models||(this.list.models={});const i=this.list.models;i[e]||(i[e]={map:{},id:null,name:e});const s=i[e];for(const[e,i]of t.data){const n=i[0];for(const i of n){const n=t.keyFragments.get(i);n&&(s.map[n]||(s.map[n]=new Set),s.map[n].add(e))}}}async byPredefinedType(e){var t;this.list.predefinedTypes||(this.list.predefinedTypes={});const i=this.list.predefinedTypes,s=e.getAllPropertiesIDs();for(const n of s){const s=await e.getProperties(n);if(!s)continue;const r=String(null==(t=s.PredefinedType)?void 0:t.value).toUpperCase();i[r]||(i[r]={map:{},id:null,name:r});const o=i[r];for(const[t,i]of e.data){const t=i[0];for(const i of t){const t=e.keyFragments.get(i);if(!t)throw new Error("Fragment ID not found!");o.map[t]||(o.map[t]=new Set);o.map[t].add(s.expressID)}}}}byEntity(e){this.list.entities||(this.list.entities={});for(const[t,i]of e.data){const s=i[1][1],n=_n[s];this.saveItem(e,"entities",n,t)}}async byIfcRel(e,t,i){Pn.isRel(t)&&await Pn.getRelationMap(e,t,(async(t,s)=>{const{name:n}=await Pn.getEntityName(e,t);for(const t of s)this.saveItem(e,i,n??"NO REL NAME",t)}))}async bySpatialStructure(e,t={}){var i,s;const n=this.components.get(Zn),r=n.relationMaps[e.uuid];if(!r)throw new Error(`Classifier: model relations of ${e.name||e.uuid} have to exists to group by spatial structure.`);const o=t.systemName??"spatialStructures",a=void 0===t.useProperties||t.useProperties;for(const[c]of r){if(t.isolate){const i=e.data.get(c);if(!i)continue;const s=i[1][1];if(void 0===s||!t.isolate.has(s))continue}const r=n.getEntityRelations(e,c,"Decomposes");if(r)for(const t of r){let s=t.toString();if(a){const n=await e.getProperties(t);if(!n)continue;s=null==(i=n.Name)?void 0:i.value}this.saveItem(e,o,s,c,t)}const l=n.getEntityRelations(e,c,"ContainsElements");if(!l)continue;let h=c.toString();if(a){const t=await e.getProperties(c);if(!t)continue;h=null==(s=t.Name)?void 0:s.value}for(const t of l){this.saveItem(e,o,h,t,c);const i=n.getEntityRelations(e,Number(t),"IsDecomposedBy");if(i)for(const t of i)this.saveItem(e,o,h,t,c)}}}setColor(e,t,i=!1){const s=this.components.get(Qn);for(const n in e){const r=s.list.get(n);if(!r)continue;const o=e[n];r.setColor(t,o,i)}}resetColor(e){const t=this.components.get(Qn);for(const i in e){const s=t.list.get(i);if(!s)continue;const n=e[i];s.resetColor(n)}}export(){const e={};for(const t in this.list){e[t]={};const i=this.list[t];for(const s in i){const n=i[s];e[t][s]={map:a.FragmentUtils.export(n.map),name:n.name,id:n.id}}}return e}import(e){for(const t in e){this.list[t]||(this.list[t]={});const i=e[t];for(const e in i){const s=i[e];this.list[t][e]={map:a.FragmentUtils.import(s.map),name:s.name,id:s.id}}}}saveItem(e,t,i,s,n=null){this.list[t]||(this.list[t]={});const r=e.data.get(s);if(r)for(const o of r[0]){const r=e.keyFragments.get(o);if(r){const e=this.list[t];e[i]||(e[i]={map:{},id:n,name:i}),e[i].map[r]||(e[i].map[r]=new Set),e[i].map[r].add(s)}}}};t(zo,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let ko=zo;const Ho=class e extends xt{constructor(i){super(i),t(this,"onDisposed",new Dt),t(this,"enabled",!0),t(this,"height",10),t(this,"groupName","spatialStructures"),t(this,"list",new Set),i.add(e.uuid,this)}dispose(){this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}set(e){if(!this.enabled)return;const t=this.components.get(ko),i=this.components.get(Qn),s=e?1:-1;let n=0;const r=t.list[this.groupName],a=new o.Matrix4;for(const t in r){a.elements[13]=n*s*this.height;for(const s in r[t].map){const n=i.list.get(s),o=t+s,c=this.list.has(o);if(!n||e&&c||!e&&!c)continue;e?this.list.add(o):this.list.delete(o);const l=r[t].map[s];n.applyTransform(l,a),n.mesh.computeBoundingSphere(),n.mesh.computeBoundingBox()}n++}}};t(Ho,"uuid","d260618b-ce88-4c7d-826c-6debb91de3e2");let Wo=Ho;const Xo=class e extends xt{constructor(i){super(i),t(this,"enabled",!0),this.components.add(e.uuid,this)}set(e,t){const i=this.components.get(Qn);if(t)for(const s in t){const n=t[s],r=i.list.get(s);r&&(r.setVisibility(e,n),this.updateCulledVisibility(r))}else for(const[t,s]of i.list)s&&(s.setVisibility(e),this.updateCulledVisibility(s))}isolate(e){this.set(!1),this.set(!0,e)}updateCulledVisibility(e){const t=this.components.get(_s);for(const[i,s]of t.list){const t=s.colorMeshes.get(e.id);t&&(t.count=e.mesh.count)}}};t(Xo,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");let jo=Xo;class Zo extends Dn{constructor(){super(...arguments),t(this,"minGeometrySize",10),t(this,"minAssetsSize",1e3),t(this,"maxTriangles",null)}}const $o=class e extends xt{constructor(i){super(i),t(this,"onGeometryStreamed",new bt),t(this,"onAssetStreamed",new bt),t(this,"onProgress",new bt),t(this,"onIfcLoaded",new bt),t(this,"onDisposed",new Dt),t(this,"settings",new Zo),t(this,"enabled",!0),t(this,"webIfc",new c.IfcAPI),t(this,"_nextAvailableID",0),t(this,"_splittedGeometries",new Map),t(this,"_spatialTree",new vn),t(this,"_metaData",new Un),t(this,"_visitedGeometries",new Map),t(this,"_streamSerializer",new a.StreamSerializer),t(this,"_geometries",new Map),t(this,"_geometryCount",0),t(this,"_civil",new bn),t(this,"_groupSerializer",new a.Serializer),t(this,"_assets",[]),t(this,"_meshesWithHoles",new Set),this.components.add(e.uuid,this),this.settings.excludedCategories.add(c.IFCOPENINGELEMENT)}dispose(){this.onIfcLoaded.reset(),this.onGeometryStreamed.reset(),this.onAssetStreamed.reset(),this.webIfc=null,this.onDisposed.trigger(),this.onDisposed.reset()}async streamFromBuffer(e){await this.readIfcFile(e),await this.streamAllGeometries(),this.cleanUp()}async streamFromCallBack(e){await this.streamIfcFile(e),await this.streamAllGeometries(),this.cleanUp()}async readIfcFile(e){const{path:t,absolute:i,logLevel:s}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),s&&this.webIfc.SetLogLevel(s),this.webIfc.OpenModel(e,this.settings.webIfc),this._nextAvailableID=this.webIfc.GetMaxExpressID(0)}async streamIfcFile(e){const{path:t,absolute:i,logLevel:s}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),s&&this.webIfc.SetLogLevel(s),this.webIfc.OpenModelFromCallback(e,this.settings.webIfc),this._nextAvailableID=this.webIfc.GetMaxExpressID(0)}async streamAllGeometries(){console.log("Converting geometries to tiles...");const{minGeometrySize:e,minAssetsSize:t}=this.settings;this._spatialTree.setUp(this.webIfc);const i=this.webIfc.GetIfcEntityList(0),s=[[]],n=new a.FragmentsGroup;n.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 r=0,o=0;for(const t of i){if(!this.webIfc.IsIfcElement(t)&&t!==c.IFCSPACE)continue;if(this.settings.excludedCategories.has(t))continue;const i=this.webIfc.GetLineIDsWithType(0,t),a=i.size();for(let c=0;c<a;c++){r>e&&(r=0,o++,s.push([]));const a=i.get(c);s[o].push(a);const l=this.webIfc.GetLine(0,a);if(l.GlobalId){const e=(null==l?void 0:l.GlobalId.value)||(null==l?void 0:l.GlobalId);n.globalToExpressIDs.set(e,a)}const h=this._spatialTree.itemsByFloor[a]||0;n.data.set(a,[[],[h,t]]),r++}}this._spatialTree.cleanUp();let l=.01,h=0;for(const e of s){h++,this.webIfc.StreamMeshes(0,e,(e=>{this.getMesh(this.webIfc,e,n)})),this._geometryCount>this.settings.minGeometrySize&&await this.streamGeometries(),this._assets.length>t&&await this.streamAssets();const i=h/s.length;i>l&&(l+=.01,l=Math.max(l,i),await this.onProgress.trigger(Math.round(100*l)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:u,transparent:I}=n.geometryIDs;for(const[e,{index:t,uuid:i}]of this._visitedGeometries){n.keyFragments.set(t,i);(e>1?u:I).set(e,t)}xn.get(n,this.webIfc);const d=this.webIfc.GetCoordinationMatrix(0);n.coordinationMatrix.fromArray(d),n.civilData=this._civil.read(this.webIfc);const E=this._groupSerializer.export(n);await this.onIfcLoaded.trigger(E),n.dispose(!0)}cleanUp(){try{this.webIfc.Dispose()}catch(e){}this.webIfc=null,this.webIfc=new c.IfcAPI,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(e,t,i){const s=t.geometries.size(),n=t.expressID,r={id:n,geometries:[]};for(let o=0;o<s;o++){const s=t.geometries.get(o),a=s.geometryExpressID,c=1===s.color.w,l=a*(c?1:-1);this._visitedGeometries.has(l)||this.getGeometry(e,a,c),this.registerGeometryData(i,n,s,r,a,l);const h=this._splittedGeometries.get(a);if(h)for(const e of h)this.registerGeometryData(i,n,s,r,e,e)}this._assets.push(r)}getGeometry(e,t,i){const s=e.GetGeometry(0,t),n=e.GetIndexArray(s.GetIndexData(),s.GetIndexDataSize()),r=e.GetVertexArray(s.GetVertexData(),s.GetVertexDataSize()),a=new Float32Array(r.length/2),c=new Float32Array(r.length/2);for(let e=0;e<r.length;e+=6)a[e/2]=r[e],a[e/2+1]=r[e+1],a[e/2+2]=r[e+2],c[e/2]=r[e+3],c[e/2+1]=r[e+4],c[e/2+2]=r[e+5];const l=i?1:-1;if(0===n.length){const e=new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]);this._geometries.set(t,{position:a,normal:c,index:n,boundingBox:e,hasHoles:!1});const i=this._visitedGeometries.size,r=o.MathUtils.generateUUID(),h=t*l;return this._visitedGeometries.set(h,{uuid:r,index:i}),this._geometryCount++,void s.delete()}const h=3*(this.settings.maxTriangles||n.length/3);let u=!0;for(let e=0;e<n.length;e+=h){const i=n.length-e,s=e+Math.min(i,h),r=[],I=[],d=[];let E=0;for(let t=e;t<s;t++){r.push(E++);const e=n[t];I.push(a[3*e]),I.push(a[3*e+1]),I.push(a[3*e+2]),d.push(c[3*e]),d.push(c[3*e+1]),d.push(c[3*e+2])}const f=new Uint32Array(r),p=new Float32Array(I),C=new Float32Array(d),T=li(p),m=new Float32Array(T.transformation.elements),R=!1,g=u?t:this._nextAvailableID++;if(this._geometries.set(g,{position:p,normal:C,index:f,boundingBox:m,hasHoles:R}),!u){this._splittedGeometries.has(t)||this._splittedGeometries.set(t,new Set);this._splittedGeometries.get(t).add(g)}const A=this._visitedGeometries.size,F=o.MathUtils.generateUUID(),S=g*l;this._visitedGeometries.set(S,{uuid:F,index:A}),this._geometryCount++,u=!1}s.delete()}async streamAssets(){await this.onAssetStreamed.trigger(this._assets),this._assets=null,this._assets=[]}async streamGeometries(){const e=new Map;for(const[t,i]of this._geometries)e.set(t,i),e.size>this.settings.minGeometrySize&&await this.outputGeometries(e);await this.outputGeometries(e),this._geometries.clear(),this._geometryCount=0}async outputGeometries(e){let t=this._streamSerializer.export(e),i={};for(const[t,{boundingBox:s,hasHoles:n}]of e)i[t]={boundingBox:s,hasHoles:n};await this.onGeometryStreamed.trigger({data:i,buffer:t}),i=null,t=null,e.clear()}registerGeometryData(e,t,i,s,n,r){const o=this._visitedGeometries.get(r);if(void 0===o)throw new Error("Error getting geometry data for streaming!");const a=e.data.get(t);if(!a)throw new Error("Data not found!");a[0].push(o.index);const{x:c,y:l,z:h,w:u}=i.color,I=[c,l,h,u],d=i.flatTransformation;s.geometries.push({color:I,geometryID:n,transformation:d})}};t($o,"uuid","d9999a00-e1f5-4d3f-8cfe-c56e08609764");let Qo=$o;class qo extends Dn{constructor(){super(...arguments),t(this,"propertiesSize",100)}}class Ko extends xt{constructor(){super(...arguments),t(this,"onPropertiesStreamed",new bt),t(this,"onProgress",new bt),t(this,"onIndicesStreamed",new bt),t(this,"onDisposed",new Dt),t(this,"enabled",!0),t(this,"settings",new qo),t(this,"webIfc",new c.IfcAPI)}async dispose(){this.onIndicesStreamed.reset(),this.onPropertiesStreamed.reset(),this.webIfc=null,this.onDisposed.reset()}async streamFromBuffer(e){await this.readIfcFile(e),await this.streamAllProperties(),this.cleanUp()}async streamFromCallBack(e){await this.streamIfcFile(e),await this.streamAllProperties(),this.cleanUp()}async readIfcFile(e){const{path:t,absolute:i,logLevel:s}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),s&&this.webIfc.SetLogLevel(s),this.webIfc.OpenModel(e,this.settings.webIfc)}async streamIfcFile(e){const{path:t,absolute:i,logLevel:s}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),s&&this.webIfc.SetLogLevel(s),this.webIfc.OpenModelFromCallback(e,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:e}=this.settings,t=new Set(this.webIfc.GetIfcEntityList(0)),i=new Set([c.IFCPROJECT,c.IFCSITE,c.IFCBUILDING,c.IFCBUILDINGSTOREY,c.IFCSPACE]);for(const e of i)t.add(e);let s=.01,n=0;for(const r of t){if(n++,Bn.has(r))continue;const o=i.has(r),a=this.webIfc.GetLineIDsWithType(0,r),c=a.size();let l=0;for(let t=0;t<c-e;t+=e){const i={};for(let s=0;s<e;s++){l++;const e=a.get(t+s);try{const t=this.webIfc.GetLine(0,e,o);i[t.expressID]=t}catch(t){console.log(`Could not get property: ${e}`)}}await this.onPropertiesStreamed.trigger({type:r,data:i})}if(l!==c){const e={};for(let t=l;t<c;t++){const i=a.get(t);try{const t=this.webIfc.GetLine(0,i,o);e[t.expressID]=t}catch(e){console.log(`Could not get property: ${i}`)}}await this.onPropertiesStreamed.trigger({type:r,data:e})}n/t.size>s&&(s=Math.round(100*s)/100,await this.onProgress.trigger(s),s+=.01)}await this.onProgress.trigger(1);const r=this.components.get(Zn),o=await r.processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(o)}cleanUp(){this.webIfc.Dispose(),this.webIfc=null,this.webIfc=new c.IfcAPI}}t(Ko,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");class Jo{constructor(e,i,s){t(this,"title"),t(this,"guid",Ii.create()),t(this,"clippingPlanes",new Ht),t(this,"camera",{aspectRatio:1,fov:60,direction:{x:0,y:0,z:0},position:{x:0,y:0,z:0}}),t(this,"exceptionComponents",new Ht),t(this,"selectionComponents",new Ht),t(this,"componentColors",new Wt),t(this,"spacesVisible",!1),t(this,"spaceBoundariesVisible",!1),t(this,"openingsVisible",!1),t(this,"defaultVisibility",!0),t(this,"_components"),t(this,"world");const n={setCamera:!0,...s},{data:r,setCamera:o}=n;this._components=e,this.world=i,r&&(this.guid=r.guid??this.guid,this.set(r)),o&&this.updateCamera()}get _selectionModelIdMap(){const e=this._components.get(Qn),t={};for(const[i,s]of e.groups){i in t||(t[i]=new Set);for(const e of this.selectionComponents){const n=s.globalToExpressIDs.get(e);n&&t[i].add(n)}}return t}get _exceptionModelIdMap(){const e=this._components.get(Qn),t={};for(const[i,s]of e.groups){i in t||(t[i]=new Set);for(const e of this.exceptionComponents){const n=s.globalToExpressIDs.get(e);n&&t[i].add(n)}}return t}get selection(){return this._components.get(Qn).modelIdToFragmentIdMap(this._selectionModelIdMap)}get exception(){return this._components.get(Qn).modelIdToFragmentIdMap(this._exceptionModelIdMap)}get projection(){return"fov"in this.camera?"Perspective":"Orthographic"}get position(){const e=this._components.get(Qn),{position:t}=this.camera,{x:i,y:s,z:n}=t,r=new o.Vector3(i,s,n);return e.applyBaseCoordinateSystem(r,new o.Matrix4),r}get direction(){const{direction:e}=this.camera,{x:t,y:i,z:s}=e;return new o.Vector3(t,i,s)}get _managerVersion(){return this._components.get(Lo).config.version}get topics(){return[...this._components.get(Lo).list.values()].filter((e=>e.viewpoints.has(this.guid)))}addComponentsFromMap(e){const t=this._components.get(Qn).fragmentIdMapToGuids(e);this.selectionComponents.add(...t);this._components.get(ia).list.set(this.guid,this)}set(e){const t=e,i=this;for(const s in e){if("guid"===s)continue;const e=t[s];"selectionComponents"!==s?"exceptionComponents"!==s?s in this&&(i[s]=e):(this.exceptionComponents.clear(),this.exceptionComponents.add(...e)):(this.selectionComponents.clear(),this.selectionComponents.add(...e))}return this._components.get(ia).list.set(this.guid,this),this}async go(e,t=!0){const{camera:i}=e??this.world;if(!i.hasCameraControls())throw new Error("Viewpoint: the world's camera need controls to set the viewpoint.");i instanceof Nn&&i.projection.set(this.projection);const s=new o.Vector3(this.camera.position.x,this.camera.position.y,this.camera.position.z),n=new o.Vector3(this.camera.direction.x,this.camera.direction.y,this.camera.direction.z);if(s.equals(new o.Vector3)&&n.equals(new o.Vector3))return;const r=this.position,a=this.direction;let c={x:r.x+80*a.x,y:r.y+80*a.y,z:r.z+80*a.z};const l=this.selection;if(0===Object.keys(l).length){const e=this._components.get(Ds).get(this.world).castRayFromVector(r,this.direction);e&&(c=e.point)}else{const e=this._components.get(Po);e.reset(),e.addFragmentIdMap(l),c=e.getSphere().center,e.reset()}await i.controls.setLookAt(r.x,r.y,r.z,c.x,c.y,c.z,t)}updateCamera(e){const{camera:t,renderer:i}=e??this.world;if(!i)throw new Error("Viewpoint: the world needs to have a renderer!");if(!t.hasCameraControls())throw new Error("Viewpoint: world's camera need camera controls!");const s=new o.Vector3;t.controls.getPosition(s);const n=t.three,r=new o.Vector3(0,0,-1).applyEuler(n.rotation),{width:a,height:c}=i.getSize();let l=a/c;Number.isNaN(l)&&(l=1);const h=this._components.get(Qn);s.applyMatrix4(h.baseCoordinationMatrix.clone().invert());const u={aspectRatio:l,position:{x:s.x,y:s.y,z:s.z},direction:{x:r.x,y:r.y,z:r.z}};n instanceof o.PerspectiveCamera?this.camera={...u,fov:n.fov}:n instanceof o.OrthographicCamera&&(this.camera={...u,viewToWorldScale:n.top-n.bottom});this._components.get(ia).list.set(this.guid,this)}applyVisibility(){const e=this._components.get(jo);e.set(this.defaultVisibility),e.set(!this.defaultVisibility,this.exception),e.set(!0,this.selection)}applyColors(){const e=this._components.get(ia),t=this._components.get(Qn),i=this._components.get(ko);for(const[s,n]of this.componentColors){const r=t.guidToFragmentIdMap(n);i.setColor(r,s,e.config.overwriteColors)}}resetColors(){const e=this._components.get(Qn),t=this._components.get(ko);for(const[i,s]of this.componentColors){const i=e.guidToFragmentIdMap(s);t.resetColor(i)}}async createComponentTags(e){var t,i;const s=this._components.get(Qn);let n="";if(this._components.get(Lo).config.includeSelectionTag){const r="selection"===e?this._selectionModelIdMap:this._exceptionModelIdMap;for(const e in r){const o=s.groups.get(e);if(!o)continue;const a=r[e];for(const e of a){const s=await o.getProperties(e);if(!s)continue;const r=null==(t=s.GlobalId)?void 0:t.value;if(!r)continue;const a=null==(i=s.Tag)?void 0:i.value;let c=null;a&&(c=`AuthoringToolId="${a}"`),n+=`\n<Component IfcGuid="${r}" ${c??""} />`}}}else n=[...this.selectionComponents].map((e=>`<Component IfcGuid="${e}" />`)).join("\n");return n}createColorTags(){let e="";for(const[t,i]of this.componentColors.entries()){e+=`<Color Color="${`#${t.getHexString()}`}">\n${i.map((e=>`\n<Component IfcGuid="${e}" />`)).join("\n")}\n</Color>`}return 0!==e.length?`<Coloring>\n${e}\n</Coloring>`:"<Coloring />"}async serialize(e=this._managerVersion){const t=this._components.get(Qn),i=this.position;i.applyMatrix4(t.baseCoordinationMatrix.clone().invert());const s=this.direction;s.normalize();const n=(new o.Matrix4).makeRotationX(Math.PI/2),r=s.clone().applyMatrix4(n);r.normalize();const a=`<CameraViewPoint>\n <X>${i.x}</X>\n <Y>${-i.z}</Y>\n <Z>${i.y}</Z>\n </CameraViewPoint>`,c=`<CameraDirection>\n <X>${s.x}</X>\n <Y>${-s.z}</Y>\n <Z>${s.y}</Z>\n </CameraDirection>`,l=`<CameraUpVector>\n <X>${r.x}</X>\n <Y>${-r.z}</Y>\n <Z>${r.y}</Z>\n </CameraUpVector>`,h=`<AspectRatio>${this.camera.aspectRatio}</AspectRatio>`;let u="";"viewToWorld"in this.camera?u=`<OrthogonalCamera>\n ${a}\n ${c}\n ${l}\n ${h}\n <ViewToWorldScale>${this.camera.viewToWorld}</ViewToWorldScale>\n </OrthogonalCamera>`:"fov"in this.camera&&(u=`<PerspectiveCamera>\n ${a}\n ${c}\n ${l}\n ${h}\n <FieldOfView>${this.camera.fov}</FieldOfView>\n </PerspectiveCamera>`);const I=`<ViewSetupHints SpacesVisible="${this.spacesVisible??!1}" SpaceBoundariesVisible="${this.spaceBoundariesVisible??!1}" OpeningsVisible="${this.openingsVisible??!1}" />`,d=(await this.createComponentTags("selection")).trim(),E=(await this.createComponentTags("exception")).trim(),f=this.createColorTags();return`<?xml version="1.0" encoding="UTF-8"?>\n <VisualizationInfo Guid="${this.guid}">\n <Components>\n ${"2.1"===e?I:""}\n ${0!==d.length?`<Selection>${d}</Selection>`:""}\n <Visibility DefaultVisibility="${this.defaultVisibility}">\n ${"3"===e?I:""}\n ${0!==E.length?`<Exceptions>${E}</Exceptions>`:""}\n </Visibility>\n ${f}\n </Components>\n ${u}\n </VisualizationInfo>`}}class ea extends pi{constructor(){super(...arguments),t(this,"_config",{overwriteColors:{value:!1,type:"Boolean"}})}get overwriteColors(){return this._config.overwriteColors.value}set overwriteColors(e){this._config.overwriteColors.value=e}}const ta=class e extends xt{constructor(i){super(i),t(this,"enabled",!0),t(this,"list",new Wt),t(this,"isSetup",!1),t(this,"onSetup",new Dt),t(this,"config",new ea(this,this.components,"Viewpoints",e.uuid)),t(this,"onDisposed",new Dt),i.add(e.uuid,this)}create(e,t){const i=new Jo(this.components,e,{data:t});return t||this.list.set(i.guid,i),i}setup(){}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}};t(ta,"uuid","ee867824-a796-408d-8aa0-4e5962a83c66");let ia=ta;class sa extends pi{constructor(){super(...arguments),t(this,"_config",{visible:{value:!0,type:"Boolean"},lockRotation:{value:!0,type:"Boolean"},zoom:{type:"Number",interpolable:!0,value:.05,min:.001,max:5},frontOffset:{type:"Number",interpolable:!0,value:0,min:0,max:100},sizeX:{type:"Number",interpolable:!0,value:320,min:20,max:5e3},sizeY:{type:"Number",interpolable:!0,value:160,min:20,max:5e3},backgroundColor:{value:new o.Color,type:"Color"}})}get visible(){return this._config.visible.value}set visible(e){this._config.visible.value=e;this._component.renderer.domElement.style.display=e?"block":"none"}get lockRotation(){return this._config.lockRotation.value}set lockRotation(e){this._config.lockRotation.value=e,this._component.lockRotation=e}get zoom(){return this._config.zoom.value}set zoom(e){this._config.zoom.value=e,this._component.zoom=e}get frontOffset(){return this._config.frontOffset.value}set frontOffset(e){this._config.frontOffset.value=e,this._component.frontOffset=e}get sizeX(){return this._config.sizeX.value}set sizeX(e){this._config.sizeX.value=e;const{sizeX:t,sizeY:i}=this._config,s=new o.Vector2(t.value,i.value);this._component.resize(s)}get sizeY(){return this._config.sizeY.value}set sizeY(e){this._config.sizeY.value=e;const{sizeX:t,sizeY:i}=this._config,s=new o.Vector2(t.value,i.value);this._component.resize(s)}get backgroundColor(){return this._config.backgroundColor.value}set backgroundColor(e){this._config.backgroundColor.value=e,this._component.backgroundColor=e}}class na{constructor(e,i){if(t(this,"onDisposed",new Dt),t(this,"onAfterUpdate",new Dt),t(this,"onBeforeUpdate",new Dt),t(this,"onResize",new Dt),t(this,"onSetup",new Dt),t(this,"frontOffset",0),t(this,"overrideMaterial",new o.MeshDepthMaterial),t(this,"backgroundColor",new o.Color(395274)),t(this,"renderer"),t(this,"enabled",!0),t(this,"world"),t(this,"config"),t(this,"isSetup",!1),t(this,"_defaultConfig",{visible:!0,lockRotation:!1,zoom:.05,frontOffset:0,sizeX:320,sizeY:160,backgroundColor:new o.Color(395274)}),t(this,"_lockRotation",!0),t(this,"_size",new o.Vector2(320,160)),t(this,"_camera"),t(this,"_plane"),t(this,"_tempVector1",new o.Vector3),t(this,"_tempVector2",new o.Vector3),t(this,"_tempTarget",new o.Vector3),t(this,"down",new o.Vector3(0,-1,0)),t(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})),this.world=e,!this.world.renderer)throw new Error("The given world must have a renderer!");this.renderer=new o.WebGLRenderer,this.renderer.setSize(this._size.x,this._size.y);const s=this._size.x/this._size.y;this._camera=new o.OrthographicCamera(1*s/-2,1*s/2,.5,-.5),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 o.Plane(this.down,200),this.updatePlanes(),this.config=new sa(this,i,"MiniMap")}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 o.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,0!==this.frontOffset&&(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 e=Math.atan2(this._tempTarget.x-this._tempVector1.x,this._tempTarget.z-this._tempVector1.z);this._camera.rotation.z=e+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;this._camera.left=1*t/-2,this._camera.right=1*t/2,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),this.onResize.trigger(e)}setup(e){const t={...this._defaultConfig,...e};this.config.visible=!0,this.config.lockRotation=t.lockRotation,this.config.zoom=t.zoom,this.config.frontOffset=t.frontOffset,this.config.sizeX=t.sizeX,this.config.sizeY=t.sizeY,this.config.backgroundColor=t.backgroundColor,this.isSetup=!0,this.onSetup.trigger()}}const ra=class e extends xt{constructor(i){super(i),t(this,"onAfterUpdate",new Dt),t(this,"onBeforeUpdate",new Dt),t(this,"onDisposed",new Dt),t(this,"onSetup",new Dt),t(this,"enabled",!0),t(this,"list",new Map),this.components.add(e.uuid,this)}create(e){if(this.list.has(e.uuid))throw new Error("This world already has a minimap!");const t=new na(e,this.components);return this.list.set(e.uuid,t),t}delete(e){const t=this.list.get(e);t&&t.dispose(),this.list.delete(e)}dispose(){for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}update(){for(const[e,t]of this.list)t.update()}};t(ra,"uuid","39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");let oa=ra;const aa=class e extends xt{constructor(i){super(i),t(this,"enabled",!0),i.add(e.uuid,this)}static distanceFromPointToLine(e,t,i,s=!1){const n=new o.Line3,r=new o.Vector3;return n.set(t,i),n.closestPointToPoint(e,s,r),r.distanceTo(e)}getFace(e,t,i){if(!e.geometry.index)throw new Error("Geometry must be indexed!");const s=new Map,n=e.geometry.index.array,{plane:r}=this.getFaceData(t,i,e),o=[];for(let t=0;t<n.length/3;t++){const{plane:n,edges:a}=this.getFaceData(t,i,e);if(n.equals(r)){o.push({index:t,edges:a});for(const{id:e,points:t,distance:i}of a)s.set(e,{points:t,distance:i})}}let a=0;const c=new Map,l=new Map;for(const{index:e,edges:t}of o){const i=new Map;for(const{id:e}of t)if(c.has(e)){const t=c.get(e);i.set(e,t)}const s=t.map((e=>e.id));if(!i.size){const i=a++;for(const{id:e}of t)c.set(e,i);l.set(i,{edges:new Set(s),indices:new Set([e])});continue}let n=null;const r=new Set,o=new Set(s);for(const[e,t]of i){null===n?n=t:t!==n&&r.add(t),c.delete(e);const{edges:i}=l.get(t);i.delete(e),o.delete(e)}if(null===n)throw new Error("Error computing face!");const h=l.get(n),{indices:u}=h;u.add(e);for(const e of o){c.set(e,n);const{edges:t}=h;t.add(e)}for(const e of r){const t=l.get(e),{edges:i,indices:s}=t,r=l.get(n),{edges:o,indices:a}=r;for(const e of i)o.add(e),c.set(e,n);for(const e of s)a.add(e);l.delete(e)}}for(const[e,{indices:i,edges:n}]of l)if(i.has(t)){const e=[];for(const t of n){const i=s.get(t);e.push(i)}return{edges:e,indices:i}}return null}getVerticesAndNormal(e,t,i){if(!e.geometry.index)throw new Error("Geometry must be indexed!");const s=e.geometry.index.array,n=e.geometry.attributes.position.array,r=e.geometry.attributes.normal.array,a=3*s[3*t],c=3*s[3*t+1],l=3*s[3*t+2],h=new o.Vector3(n[a],n[a+1],n[a+2]),u=new o.Vector3(n[c],n[c+1],n[c+2]),I=new o.Vector3(n[l],n[l+1],n[l+2]),d=new o.Vector3(r[a],r[a+1],r[a+2]),E=new o.Vector3(r[c],r[c+1],r[c+2]),f=new o.Vector3(r[l],r[l+1],r[l+2]),p=(d.x+E.x+f.x)/3,C=(d.y+E.y+f.y)/3,T=(d.z+E.z+f.z)/3,m=new o.Vector3(p,C,T);if(void 0!==i&&e instanceof o.InstancedMesh){const t=new o.Matrix4;e.getMatrixAt(i,t);const s=new o.Matrix4;s.extractRotation(t),m.applyMatrix4(s),h.applyMatrix4(t),u.applyMatrix4(t),I.applyMatrix4(t)}return{p1:h,p2:u,p3:I,faceNormal:m}}round(e){const t=1e3;e.x=Math.trunc(e.x*t)/t,e.y=Math.trunc(e.y*t)/t,e.z=Math.trunc(e.z*t)/t}getVolumeFromFragments(e){const t=this.components.get(Qn),i=new o.Matrix4,s=[];for(const n in e){const r=t.list.get(n);if(!r)continue;const a=e[n];let c=0;for(const e of a){const t=r.getInstancesIDs(e);t&&(c+=t.size)}const l=new o.InstancedMesh(r.mesh.geometry,void 0,c);let h=0;for(const e of a){const t=r.getInstancesIDs(e);if(t)for(const e of t)r.mesh.getMatrixAt(e,i),l.setMatrixAt(h++,i)}s.push(l)}const n=this.getVolumeFromMeshes(s);for(const e of s)e.geometry=null,e.material=[],e.dispose();return n}getVolumeFromMeshes(e){let t=0;for(const i of e)t+=this.getVolumeOfMesh(i);return t}getFaceData(e,t,i){const s=this.getVerticesAndNormal(i,e,t),{p1:n,p2:r,p3:a,faceNormal:c}=s;this.round(n),this.round(r),this.round(a),this.round(c);const l=[{id:`${n.x}|${n.y}|${n.z}`,value:n},{id:`${r.x}|${r.y}|${r.z}`,value:r},{id:`${a.x}|${a.y}|${a.z}`,value:a}];l.sort(((e,t)=>e.id<t.id?-1:e.id>t.id?1:0));const[{id:h,value:u},{id:I,value:d},{id:E,value:f}]=l,p=[{id:`${h}|${I}`,distance:u.distanceTo(d),points:[u,d]},{id:`${I}|${E}`,distance:d.distanceTo(f),points:[d,f]},{id:`${h}|${E}`,distance:u.distanceTo(f),points:[u,f]}],C=new o.Plane;return C.setFromNormalAndCoplanarPoint(c,n),C.constant=Math.round(10*C.constant)/10,{plane:C,edges:p}}getVolumeOfMesh(e){let t=0;const i=new o.Vector3,s=new o.Vector3,n=new o.Vector3,{index:r}=e.geometry,a=e.geometry.attributes.position.array;if(!r)return console.warn("Geometry must be indexed to compute its volume!"),0;const c=[];if(e instanceof o.InstancedMesh)for(let t=0;t<e.count;t++){const i=new o.Matrix4;e.getMatrixAt(t,i),c.push(i)}else c.push((new o.Matrix4).identity());const{matrixWorld:l}=e;for(let e=0;e<r.array.length-2;e+=3)for(const o of c){const c=o.multiply(l),h=3*r.array[e],u=3*r.array[e+1],I=3*r.array[e+2];i.set(a[h],a[h+1],a[h+2]).applyMatrix4(c),s.set(a[u],a[u+1],a[u+2]).applyMatrix4(c),n.set(a[I],a[I+1],a[I+2]).applyMatrix4(c),t+=this.getSignedVolumeOfTriangle(i,s,n)}return Math.abs(t)}getSignedVolumeOfTriangle(e,t,i){return 1/6*(-(i.x*t.y*e.z)+t.x*i.y*e.z+i.x*e.y*t.z-e.x*i.y*t.z-t.x*e.y*i.z+e.x*t.y*i.z)}};t(aa,"uuid","267ca032-672f-4cb0-afa9-d24e904f39d6");let ca=aa;class la{constructor(e){t(this,"cardinality","required"),t(this,"instructions"),t(this,"evalRequirement",((e,t,i,s)=>{const n={parameter:i,currentValue:e,requiredValue:t.parameter,pass:!1};s&&this.addCheckResult(n,s);let r=!1;if("simple"===t.type&&(r=e===t.parameter),"enumeration"===t.type&&(r=t.parameter.includes(e)),"pattern"===t.type){r=new RegExp(t.parameter).test(String(e))}if("length"===t.type){const{min:i,length:s,max:n}=t.parameter;void 0!==s&&(r=String(e).length===s),void 0!==i&&(r=String(e).length>=i),void 0!==n&&(r=String(e).length<=n)}if("bounds"===t.type&&"number"==typeof e){const{min:i,minInclusive:s,max:n,maxInclusive:o}=t.parameter;let a=!0,c=!0;void 0!==i&&(a=s?e<=i:e<i),void 0!==n&&(c=o?e>=n:e>n),r=a&&c}return"prohibited"===this.cardinality&&(r=!r),"optional"===this.cardinality&&(r=!0),n.pass=r,n.pass})),t(this,"testResult",[]),this.components=e}addCheckResult(e,t){const i=t.findIndex((({parameter:t})=>t===e.parameter));-1!==i?t[i]=e:t.push(e)}saveResult(e,t){const{GlobalId:i}=e;if(!i)return;const{value:s}=i,n={expressID:s,pass:t,checks:[],cardinality:this.cardinality};this.testResult.push(n)}}const ha=(e,t)=>{let i="";if(!t)return i;if("simple"===t.type&&(i=`<ids:simpleValue>${t.parameter}</ids:simpleValue>`),"enumeration"===t.type){i=`<xs:restriction base="xs:string">\n ${t.parameter.map((e=>`<xs:enumeration value="${e}" />`)).join("\r\n")}\n </xs:restriction>`}if("pattern"===t.type){i=`<xs:restriction base="xs:string">\n <xs:pattern value="${t.parameter}" />\n </xs:restriction>`}return`<ids:${e[0].toLowerCase()+e.slice(1)}>\n ${i}\n </ids:${e[0].toLowerCase()+e.slice(1)}>`};class ua extends la{constructor(e,i){super(e),t(this,"facetType","Attribute"),t(this,"name"),t(this,"value"),this.name=i}serialize(e){const t=ha("Name",this.name),i=ha("Value",this.value);let s="";return"requirement"===e&&(s+=`cardinality="${this.cardinality}"`,s+=this.instructions?`instructions="${this.instructions}"`:""),`<ids:attribute ${s}>\n ${t}\n ${i}\n</ids:attribute>`}async getEntities(){return[]}async test(e){var t;this.testResult=[];for(const i in e){const s=Number(i),n=e[s],r=[],o={guid:null==(t=n.GlobalId)?void 0:t.value,expressID:s,pass:!1,checks:r,cardinality:this.cardinality};this.testResult.push(o);const a=Object.keys(n).filter((e=>{const t=this.evalRequirement(e,this.name,"Name"),i=n[e];return t&&null===i?"optional"===this.cardinality||"prohibited"===this.cardinality:(!t||3!==(null==i?void 0:i.type)||2!==i.value)&&((!t||!Array.isArray(i)||0!==i.length)&&((!t||1!==(null==i?void 0:i.type)||""!==i.value.trim())&&t))})),c=a.length>0;if(r.push({parameter:"Name",currentValue:c?a[0]:null,requiredValue:this.name.parameter,pass:"prohibited"===this.cardinality?!c:c}),this.value)if(a[0]){const e=n[a[0]];5===(null==e?void 0:e.type)?r.push({parameter:"Value",currentValue:null,requiredValue:this.value.parameter,pass:"prohibited"===this.cardinality}):this.evalRequirement(e?e.value:null,this.value,"Value",r)}else r.push({parameter:"Value",currentValue:null,requiredValue:this.value.parameter,pass:"prohibited"===this.cardinality});o.pass=r.every((({pass:e})=>e))}const i=[...this.testResult];return this.testResult=[],i}}class Ia extends la{constructor(e,i){super(e),t(this,"facetType","Classification"),t(this,"system"),t(this,"value"),t(this,"uri"),this.system=i}serialize(e){const t=ha("System",this.system),i=ha("Value",this.value);let s="";return"requirement"===e&&(s+=`cardinality="${this.cardinality}"`,s+=this.uri?`uri=${this.uri}`:"",s+=this.instructions?`instructions="${this.instructions}"`:""),`<ids:classification ${s}>\n ${t}\n ${i}\n</ids:classification>`}async getEntities(e,t={}){var i;const s=[],n={...await e.getAllPropertiesOfType(c.IFCCLASSIFICATIONREFERENCE),...await e.getAllPropertiesOfType(c.IFCCLASSIFICATION)},r=[];for(const t in n){const s=Number(t),n=await e.getProperties(s);if(!n)continue;const o=null==(i=n.ReferencedSource)?void 0:i.value;if(!o)continue;const a=await e.getProperties(o);if(!a)continue;if(!this.evalSystem(a))continue;if(!this.evalValue(n))continue;this.evalURI(n)&&r.push(s)}const o=this.components.get(Zn);for(const i of r){const n=o.getEntitiesWithRelation(e,"HasAssociations",i);for(const i of n){if(i in t)continue;const n=await e.getProperties(i);n&&(t[i]=n,s.push(i))}}return s}async test(e,t){var i;this.testResult=[];for(const s in e){const n=Number(s),r=[],o={guid:null==(i=e[n].GlobalId)?void 0:i.value,expressID:n,pass:!1,checks:r,cardinality:this.cardinality};this.testResult.push(o);let a=!0;const l=await this.getSystems(t,n),h=l.map((e=>this.getSystemName(e))).filter((e=>e));for(const e of l){if(!this.evalSystem(e,r))continue;if(a=!1,!this.value||!this.system)break;if(e.type!==c.IFCCLASSIFICATIONREFERENCE)continue;const t=!this.value||this.evalValue(e,r),i=!this.uri||this.evalURI(e,r);if(t&&i)break}a&&this.addCheckResult({parameter:"System",currentValue:h,requiredValue:this.system,pass:"optional"===this.cardinality},r),o.pass=r.every((({pass:e})=>e))}const s=[...this.testResult];return this.testResult=[],s}async processReferencedSource(e,t){var i;const s=null==(i=t.ReferencedSource)?void 0:i.value;if(!s)return null;const n=await e.getProperties(s);return n?(n.type===c.IFCCLASSIFICATIONREFERENCE&&(n.ReferencedSource=await this.processReferencedSource(e,n)),n):null}async getSystems(e,t){var i;const s=[],n=this.components.get(Zn),r=n.getEntityRelations(e,t,"HasAssociations");if(r)for(const t of r){const i=await e.getProperties(t);i&&(i.type===c.IFCCLASSIFICATION&&s.push(i),i.type===c.IFCCLASSIFICATIONREFERENCE&&(i.ReferencedSource=await this.processReferencedSource(e,i),i.ReferencedSource&&s.push(i)))}const o=s.map((e=>{var t,i,s;return e.type===c.IFCCLASSIFICATION?null==(t=e.Name)?void 0:t.value:e.type===c.IFCCLASSIFICATIONREFERENCE?null==(s=null==(i=e.ReferencedSource)?void 0:i.Name)?void 0:s.value:null})).filter((e=>e)),a=n.getEntityRelations(e,t,"IsTypedBy");if(!a||!a[0])return s;const l=a[0],h=n.getEntityRelations(e,l,"HasAssociations");if(h)for(const t of h){const n=await e.getProperties(t);if(n){if(n.type===c.IFCCLASSIFICATION){if(o.includes(null==(i=n.Name)?void 0:i.value))continue;s.push(n)}n.type===c.IFCCLASSIFICATIONREFERENCE&&(n.ReferencedSource=await this.processReferencedSource(e,n),n.ReferencedSource&&s.push(n))}}return s}getSystemName(e){var t,i,s,n;if(e.type===c.IFCCLASSIFICATION)return null==(t=e.Name)?void 0:t.value;if(e.type===c.IFCCLASSIFICATIONREFERENCE){if((null==(i=e.ReferencedSource)?void 0:i.type)===c.IFCCLASSIFICATIONREFERENCE)return this.getSystemName(e.ReferencedSource);if((null==(s=e.ReferencedSource)?void 0:s.type)===c.IFCCLASSIFICATION)return null==(n=e.ReferencedSource.Name)?void 0:n.value}return null}getAllReferenceIdentifications(e){if(e.type!==c.IFCCLASSIFICATIONREFERENCE)return null;const t=[];if(e.Identification&&t.push(e.Identification.value),e.ReferencedSource){const i=this.getAllReferenceIdentifications(e.ReferencedSource);i&&t.push(...i)}return t}evalSystem(e,t){const i=this.getSystemName(e);return this.evalRequirement(i,this.system,"System",t)}evalValue(e,t){if(!this.value)return!0;const i=this.getAllReferenceIdentifications(e);if(!i)return!1;const s=i.find((e=>!!this.value&&this.evalRequirement(e,this.value,"Value")));return t&&this.addCheckResult({parameter:"Value",currentValue:s??null,requiredValue:this.value,pass:!!s},t),!!s}evalURI(e,t){var i;if(!this.uri)return!0;return this.evalRequirement(null==(i=e.Location)?void 0:i.value,{type:"simple",parameter:this.uri},"URI",t)}}class da extends la{constructor(e,i){super(e),t(this,"facetType","Entity"),t(this,"name"),t(this,"predefinedType"),this.name=i}serialize(e){const t=ha("Name",this.name),i=ha("Name",this.predefinedType);let s="";return"requirement"===e&&(s+=`cardinality="${this.cardinality}"`,s+=this.instructions?`instructions="${this.instructions}"`:""),`<ids:entity ${s}>\n ${t}\n ${i}\n</ids:entity>`}async getEntities(e,t={}){const i=Object.entries(_n),s=[];for(const[e]of i){await this.evalName({type:e})&&s.push(Number(e))}let n={};for(const t of s){const i=await e.getAllPropertiesOfType(t);i&&(n={...n,...i})}if(!this.predefinedType){for(const e in n)e in t||(t[e]=n[e]);return Object.keys(n).map(Number)}const r=[];for(const i in n){const s=Number(i);if(s in t)continue;const o=n[s];await this.evalPredefinedType(e,o)&&(t[s]=o,r.push(s))}return r}async test(e,t){var i;this.testResult=[];for(const s in e){const n=Number(s),r=e[n],o=[],a={guid:null==(i=r.GlobalId)?void 0:i.value,expressID:n,pass:!1,checks:o,cardinality:this.cardinality};this.testResult.push(a),await this.evalName(r,o),await this.evalPredefinedType(t,r,o),a.pass=o.every((({pass:e})=>e))}return this.testResult}async evalName(e,t){const i=_n[e.type];return this.evalRequirement(i,this.name,"Name",t)}async evalPredefinedType(e,t,i){var s,n,r,o;if(!this.predefinedType)return null;const a=this.components.get(Zn),c="string"==typeof this.predefinedType.parameter&&"USERDEFINED"===this.predefinedType.parameter;let l=null==(s=t.PredefinedType)?void 0:s.value;if("USERDEFINED"===l&&!c){const e=Object.keys(t).find((e=>/^((?!Predefined).)*Type$/.test(e)));l=e?null==(n=t[e])?void 0:n.value:"USERDEFINED"}if(!l){const i=a.getEntityRelations(e,t.expressID,"IsTypedBy");if(i&&i[0]){const t=await e.getProperties(i[0]);if(t&&(l=null==(r=t.PredefinedType)?void 0:r.value,"USERDEFINED"===l&&!c)){const e=Object.keys(t).find((e=>/^((?!Predefined).)*Type$/.test(e)));l=e?null==(o=t[e])?void 0:o.value:"USERDEFINED"}}}return this.evalRequirement(l,this.predefinedType,"PredefinedType",i)}}class Ea extends la{constructor(e,i,s){super(e),t(this,"facetType","Property"),t(this,"propertySet"),t(this,"baseName"),t(this,"value"),t(this,"dataType"),t(this,"uri"),t(this,"_unsupportedTypes",[c.IFCCOMPLEXPROPERTY,c.IFCPHYSICALCOMPLEXQUANTITY]),this.propertySet=i,this.baseName=s}serialize(e){const t=ha("PropertySet",this.propertySet),i=ha("BaseName",this.baseName),s=ha("Value",this.value),n=this.dataType?`dataType=${this.dataType}`:"";let r="";return"requirement"===e&&(r+=`cardinality="${this.cardinality}"`,r+=this.uri?`uri=${this.uri}`:"",r+=this.instructions?`instructions="${this.instructions}"`:""),`<ids:property ${n} ${r}>\n ${t}\n ${i}\n ${s}\n</ids:property>`}async getEntities(e,t={}){var i,s;let n={};const r=await e.getAllPropertiesOfType(c.IFCPROPERTYSET);n={...n,...r};const o=await e.getAllPropertiesOfType(c.IFCELEMENTQUANTITY);if(n={...n,...o},0===Object.keys(n).length)return[];const a=[];for(const t in n){const n=Number(t),r=await e.getProperties(n);if(!r)continue;if(!((null==(i=r.Name)?void 0:i.value)===this.propertySet.parameter))continue;let o;if(r.type===c.IFCPROPERTYSET&&(o="HasProperties"),r.type===c.IFCELEMENTQUANTITY&&(o="Quantities"),o)for(const t of r[o]){const i=await e.getProperties(t.value);if(!i)continue;if((null==(s=i.Name)?void 0:s.value)===this.baseName.parameter){if(this.value){const e=Object.keys(i).find((e=>e.endsWith("Value")));if(!e)continue;if(!(i[e].value===this.value.parameter))continue}a.push(n)}}}const l=this.components.get(Zn);for(const i of a){const s=l.getEntitiesWithRelation(e,"IsDefinedBy",i);for(const i of s){if(i in t)continue;const s=await e.getProperties(i);s&&(t[i]=s)}}return[]}async test(e,t){var i;this.testResult=[];for(const s in e){const n=Number(s),r=e[n],o=[],a={guid:null==(i=r.GlobalId)?void 0:i.value,expressID:n,pass:!1,checks:o,cardinality:this.cardinality};this.testResult.push(a);const c=(await this.getPsets(t,n)).filter((e=>{var t;return!!this.evalRequirement((null==(t=e.Name)?void 0:t.value)??null,this.propertySet,"PropertySet")&&(o.push({currentValue:e.Name.value,parameter:"PropertySet",pass:!0,requiredValue:this.propertySet.parameter}),!0)}));if(0!==c.length){for(const e of c){const t=this.getItemsAttrName(e.type);if(!t){o.push({currentValue:null,parameter:"BaseName",pass:!1,requiredValue:this.baseName.parameter});continue}const i=e[t].filter((e=>{var t;if(this._unsupportedTypes.includes(e.type))return!1;return!!this.evalRequirement((null==(t=e.Name)?void 0:t.value)??null,this.baseName,"BaseName")&&(o.push({currentValue:e.Name.value,parameter:"BaseName",pass:!0,requiredValue:this.baseName.parameter}),!0)}));if(0!==i.length)for(const e of i)this.evalValue(e,o),this.evalDataType(e,o),this.evalURI();else o.push({currentValue:null,parameter:"BaseName",pass:!1,requiredValue:this.baseName.parameter})}a.pass=o.every((({pass:e})=>e))}else o.push({currentValue:null,parameter:"PropertySet",pass:!1,requiredValue:this.propertySet.parameter})}const s=[...this.testResult];return this.testResult=[],s}getItemsAttrName(e){let t;return e===c.IFCPROPERTYSET&&(t="HasProperties"),e===c.IFCELEMENTQUANTITY&&(t="Quantities"),t}getValueKey(e){return Object.keys(e).find((e=>e.endsWith("Value")||e.endsWith("Values")))}async getPsetProps(e,t,i){const s=structuredClone(t),n=[],r=s[i];if(!r)return n;for(const{value:t}of r){const i=await e.getProperties(t);i&&n.push(i)}return s[i]=n,s}async getTypePsets(e,t){const i=[],s=this.components.get(Zn).getEntityRelations(e,t,"IsTypedBy");if(!s||!s[0])return i;const n=await e.getProperties(s[0]);if(!(n&&"HasPropertySets"in n&&Array.isArray(n.HasPropertySets)))return i;for(const{value:t}of n.HasPropertySets){const s=await e.getProperties(t);if(!(s&&"HasProperties"in s&&Array.isArray(s.HasProperties)))continue;const n=await this.getPsetProps(e,s,"HasProperties");i.push(n)}return i}async getPsets(e,t){const i=await this.getTypePsets(e,t),s=this.components.get(Zn).getEntityRelations(e,t,"IsDefinedBy");if(!s)return i;for(const t of s){const s=await e.getProperties(t);if(!s)continue;const n=this.getItemsAttrName(s.type);if(!n)continue;const r=await this.getPsetProps(e,s,n);i.push(r)}return i}evalValue(e,t){const i=this.getValueKey(e),s=e[i];if(this.value){if(!s)return null==t||t.push({parameter:"Value",currentValue:null,pass:!1,requiredValue:this.value.parameter}),!1;const i=structuredClone(this.value);if("IFCLABEL"===s.name&&"simple"===i.type&&(i.parameter=String(i.parameter)),(e.type===c.IFCPROPERTYLISTVALUE||e.type===c.IFCPROPERTYENUMERATEDVALUE)&&Array.isArray(s)){const e=s.map((e=>e.value)),n=s.find((e=>!!i&&this.evalRequirement(e.value,i,"Value")));return null==t||t.push({currentValue:e,pass:!!n,parameter:"Value",requiredValue:i.parameter}),!!n}return this.evalRequirement(s.value,i,"Value",t)}return!i||(3===s.type&&2===s.value?(null==t||t.push({parameter:"Value",currentValue:null,pass:!1,requiredValue:null}),!1):1!==s.type||""!==s.value.trim()||(null==t||t.push({parameter:"Value",currentValue:"",pass:!1,requiredValue:null}),!1))}evalDataType(e,t){if(!this.dataType)return!0;const i=e[this.getValueKey(e)];if(!i)return null==t||t.push({parameter:"DataType",currentValue:null,pass:!1,requiredValue:this.dataType}),!1;if((e.type===c.IFCPROPERTYLISTVALUE||e.type===c.IFCPROPERTYENUMERATEDVALUE)&&Array.isArray(i)&&i[0]){const e=i[0].name;return this.evalRequirement(e,{type:"simple",parameter:this.dataType},"DataType",t)}return this.evalRequirement(i.name,{type:"simple",parameter:this.dataType},"DataType",t)}evalURI(){return!0}}class fa{constructor(e,i,s){t(this,"name"),t(this,"ifcVersion",new Set),t(this,"identifier",Ii.create()),t(this,"description"),t(this,"instructions"),t(this,"requirementsDescription"),t(this,"applicability",new Ht),t(this,"requirements",new Ht),t(this,"components"),this.components=e,this.name=i;for(const e of s)this.ifcVersion.add(e)}set(e){const t=e,i=this;for(const s in e){if("identifier"===s)continue;const e=t[s];s in this&&(i[s]=e)}return this.components.get(Aa).list.set(this.identifier,this),this}async test(e){let t=[];if(0===this.requirements.size)return t;const i={};for(const t of this.applicability)await t.getEntities(e,i);const s=[...this.requirements][0];return t=await s.test(i,e),t}serialize(){const e=`name="${this.name}"`,t=this.identifier?`identifier="${this.identifier}"`:"",i=this.description?`description="${this.description}"`:"",s=this.instructions?`instructions="${this.instructions}"`:"";return`<ids:specification ifcVersion="${[...this.ifcVersion].join(" ")}" ${e} ${t} ${i} ${s}>\n <ids:applicability minOccurs="1" maxOccurs="unbounded">\n ${[...this.applicability].map((e=>e.serialize("applicability")))}\n </ids:applicability>\n <ids:requirements>\n ${[...this.requirements].map((e=>e.serialize("requirement")))}\n </ids:requirements>\n </ids:specification>`}}const pa=e=>{if(!e)return;const t={};if("simpleValue"in e&&(t.type="simple",t.parameter=e.simpleValue),"restriction"in e){const i=e.restriction;if("pattern"in i&&(t.type="pattern",t.parameter=i.pattern.value),"enumeration"in i){t.type="enumeration";const e=i.enumeration.map((({value:e})=>e));t.parameter=e}}return void 0!==t.parameter?t:void 0},Ca=(e,t)=>{const i=[];for(const s of t){const t=s.name,n=pa(t);if(!n)continue;const r=new da(e,n);s.cardinality&&(r.cardinality=s.cardinality),r.predefinedType=pa(s.predefinedType),r.instructions=s.instructions,i.push(r)}return i},Ta=(e,t)=>{const i=[];for(const s of t){const t=s.name,n=pa(t);if(!n)continue;const r=new ua(e,n);s.cardinality&&(r.cardinality=s.cardinality),r.value=pa(s.value),r.instructions=s.instructions,i.push(r)}return i},ma=(e,t)=>{const i=[];for(const s of t){const t=s.system,n=pa(t);if(!n)continue;const r=new Ia(e,n);s.cardinality&&(r.cardinality=s.cardinality);const o=pa(s.value);"simple"===(null==o?void 0:o.type)&&(o.parameter=String(o.parameter)),"enumeration"===(null==o?void 0:o.type)&&Array.isArray(o.parameter)&&(o.parameter=o.parameter.map(String)),r.value=o,r.uri=s.uri,r.instructions=s.instructions,i.push(r)}return i},Ra=(e,t)=>{const i=[];for(const s of t){const t=s.propertySet,n=s.baseName,r=pa(t),o=pa(n);if(!o||!r)continue;const a=new Ea(e,r,o);s.cardinality&&(a.cardinality=s.cardinality);const c=pa(s.value);"enumeration"===(null==c?void 0:c.type)&&Array.isArray(c.parameter)&&(c.parameter=c.parameter.map(String)),a.value=c,a.dataType=s.dataType,a.uri=s.uri,a.instructions=s.instructions,i.push(a)}return i},ga=class e extends xt{constructor(i){super(i),t(this,"enabled",!0),t(this,"list",new Wt),i.add(e.uuid,this)}getFragmentIdMap(e,t){const i=t.filter((e=>e.pass)).map((e=>e.expressID)),s=e.getFragmentMap(i),n=t.filter((e=>!e.pass)).map((e=>e.expressID));return{pass:s,fail:e.getFragmentMap(n)}}create(e,t,i){const s=new fa(this.components,e,t);return i&&(s.identifier=i),this.list.set(s.identifier,s),s}load(t){const i=[],s=e.xmlParser.parse(t).ids,{specifications:n}=s;if(n&&n.specification){const e=Array.isArray(n.specification)?n.specification:[n.specification];for(const t of e){const{name:e,ifcVersion:s,description:n,instructions:r,identifier:o}=t;if(!e||!s)continue;const a=[],c=[],{applicability:l,requirements:h}=t;if(l){const{maxOccurs:e,...t}=l,i=Array.isArray(t)?t:[t];for(const e of i)for(const t in e){const i=Array.isArray(e[t])?e[t]:[e[t]];if("entity"===t){const e=Ca(this.components,i);a.push(...e)}}}let u;if(h){const{maxOccurs:e,...t}=h;u=h.description;const i=Array.isArray(t)?t:[t];for(const e of i)for(const t in e){const i=Array.isArray(e[t])?e[t]:[e[t]];if("entity"===t){const e=Ca(this.components,i);c.push(...e)}if("attribute"===t){const e=Ta(this.components,i);c.push(...e)}if("classification"===t){const e=ma(this.components,i);c.push(...e)}if("property"===t){const e=Ra(this.components,i);c.push(...e)}}}if(a.length>0&&c.length>0){const t=this.create(e,s.split(/\s+/),o);t.description=n,t.instructions=r,t.requirementsDescription=u,t.applicability.add(...a),t.requirements.add(...c),i.push(t)}}}return i}export(e,t=this.list.values()){const i=t??this.list;return`<ids:ids xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://standards.buildingsmart.org/IDS http://standards.buildingsmart.org/IDS/1.0/ids.xsd" xmlns:ids="http://standards.buildingsmart.org/IDS">\n \x3c!-- Made with That Open Engine ${Ei.release} (https://github.com/thatopen/engine_components) --\x3e\n <ids:info>\n <ids:title>${e.title}</ids:title>\n ${e.copyright?`<ids:copyright>${e.copyright}</ids:copyright>`:""}\n ${e.version?`<ids:version>${e.version}</ids:version>`:""}\n ${e.description?`<ids:description>${e.description}</ids:description>`:""}\n ${e.author?`<ids:author>${e.author}</ids:author>`:""}\n ${e.date?`<ids:date>${e.date.toISOString().split("T")[0]}</ids:date>`:""}\n ${e.purpose?`<ids:purpose>${e.purpose}</ids:purpose>`:""}\n ${e.milestone?`<ids:milestone>${e.milestone}</ids:milestone>`:""}\n </ids:info>\n <ids:specifications>\n ${[...i].map((e=>e.serialize())).join("\n")}\n </ids:specifications>\n</ids:ids>`}};t(ga,"uuid","9f0b9f78-9b2e-481a-b766-2fbfd01f342c"),t(ga,"xmlParser",new go.XMLParser({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,ignoreDeclaration:!0,ignorePiTags:!0,numberParseOptions:{leadingZeros:!0,hex:!0},parseAttributeValue:!0,preserveOrder:!1,processEntities:!1,removeNSPrefix:!0,trimValues:!0}));let Aa=ga;exports.AsyncEvent=bt,exports.BCFTopics=Lo,exports.BCFTopicsConfigManager=No,exports.Base=Ut,exports.BaseCamera=Vt,exports.BaseRenderer=Yt,exports.BaseScene=kt,exports.BaseWorldItem=Bt,exports.BoundingBoxer=Po,exports.Classifier=ko,exports.Clipper=gn,exports.Comment=Ao,exports.Component=xt,exports.ComponentWithUI=class extends xt{},exports.Components=Ei,exports.ConfigManager=Ti,exports.Configurator=pi,exports.ControlsUtils=Xt,exports.CullerRenderer=Ns,exports.Cullers=_s,exports.DataMap=Wt,exports.DataSet=Ht,exports.Disposer=zt,exports.Event=Dt,exports.EventManager=class{constructor(){t(this,"list",new Set)}add(e){for(const t of e)this.list.add(t)}remove(e){for(const t of e)this.list.delete(t)}set(e){for(const t of this.list)t.enabled=e}reset(){for(const e of this.list)e.reset()}},exports.Exploder=Wo,exports.FirstPersonMode=An,exports.FragmentsManager=Qn,exports.GeometryTypes=Bn,exports.Grids=Bs,exports.Hider=jo,exports.IDSAttribute=ua,exports.IDSClassification=Ia,exports.IDSEntity=da,exports.IDSFacet=la,exports.IDSProperty=Ea,exports.IDSSpecification=fa,exports.IDSSpecifications=Aa,exports.IfcBasicQuery=xo,exports.IfcCategories=class{getAll(e,t){const i={},s=Object.keys(Ln).map((e=>parseInt(e,10)));for(let n=0;n<s.length;n++){const r=s[n],o=e.GetLineIDsWithType(t,r),a=o.size();for(let e=0;e<a;e++)i[o.get(e)]=r}return i}},exports.IfcCategoryMap=_n,exports.IfcElements=Ln,exports.IfcFinder=Go,exports.IfcFinderQuery=Do,exports.IfcFragmentSettings=Dn,exports.IfcGeometryTiler=Qo,exports.IfcIsolator=Mo,exports.IfcJsonExporter=Yn,exports.IfcLoader=zn,exports.IfcPropertiesManager=Xn,exports.IfcPropertiesTiler=Ko,exports.IfcPropertiesUtils=Pn,exports.IfcPropertyQuery=Vo,exports.IfcRelationsIndexer=Zn,exports.IfcStreamingSettings=Zo,exports.MaterialsUtils=hi,exports.MeasurementUtils=ca,exports.MeshCullerRenderer=ys,exports.MiniMap=na,exports.MiniMapConfigManager=sa,exports.MiniMaps=oa,exports.Mouse=ws,exports.OrbitMode=Fn,exports.OrthoPerspectiveCamera=Nn,exports.PlanMode=Sn,exports.ProjectionManager=On,exports.PropertiesStreamingSettings=qo,exports.Raycasters=Ds,exports.ShadowedScene=class extends Ai{constructor(){super(...arguments),t(this,"_distanceRenderer"),t(this,"autoBias",!0),t(this,"_defaultShadowConfig",{cascade:1,resolution:512}),t(this,"_lightsWithShadow",new Map),t(this,"_isComputingShadows",!1),t(this,"_shadowsEnabled",!0),t(this,"_bias",0),t(this,"recomputeShadows",(e=>{if(!this._shadowsEnabled)return;this.autoBias&&(this.bias=e/-1e5);if(e*=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 t=this.currentWorld.camera.three;if(!(t instanceof o.PerspectiveCamera||t instanceof o.OrthographicCamera))throw new Error("Invalid camera type!");const i=new o.Vector3;t.getWorldDirection(i);let s=e;const n=new o.Vector3;n.copy(this.config.directionalLight.position),n.normalize();for(const[e,r]of this._lightsWithShadow){const a=this.directionalLights.get(r);if(!a)throw new Error("Light not found.");const c=new o.Vector3;c.copy(i);const l=e===this._lightsWithShadow.size-1,h=l?s/2:2*s/3;c.multiplyScalar(h),c.add(t.position);const u=s-h,I=new o.Vector3;I.copy(n),I.multiplyScalar(u),a.target.position.copy(c),a.position.copy(c),a.position.add(I),a.shadow.camera.right=u,a.shadow.camera.left=-u,a.shadow.camera.top=u,a.shadow.camera.bottom=-u,a.shadow.camera.far=2*u,a.shadow.camera.updateProjectionMatrix(),a.shadow.camera.updateMatrix(),l||(s/=3)}this._isComputingShadows=!1}))}get bias(){return this._bias}set bias(e){this._bias=e;for(const[,t]of this._lightsWithShadow){const i=this.directionalLights.get(t);i&&(i.shadow.bias=e)}}get shadowsEnabled(){return this._shadowsEnabled}set shadowsEnabled(e){this._shadowsEnabled=e;for(const[,t]of this.directionalLights)t.castShadow=e}get distanceRenderer(){if(!this._distanceRenderer)throw new Error("You must set up this component before accessing the distance renderer!");return this._distanceRenderer}setup(e){super.setup(e);const t={...this._defaultConfig,...this._defaultShadowConfig,...e};if(t.cascade<=0)throw new Error("Config.shadows.cascade must be a natural number greater than 0!");if(t.cascade>1)throw new Error("Multiple shadows not supported yet!");if(!this.currentWorld)throw new Error("A world needs to be assigned to the scene before setting it up!");for(const[,e]of this.directionalLights)e.target.removeFromParent(),e.removeFromParent(),e.dispose();this.directionalLights.clear(),this._distanceRenderer||(this._distanceRenderer=new Ps(this.components,this.currentWorld),this._distanceRenderer.onDistanceComputed.add(this.recomputeShadows)),this._lightsWithShadow.clear();for(let e=0;e<t.cascade;e++){const i=new o.DirectionalLight;i.intensity=this.config.directionalLight.intensity,i.color=this.config.directionalLight.color,i.position.copy(this.config.directionalLight.position),i.shadow.mapSize.width=t.resolution,i.shadow.mapSize.height=t.resolution,this.three.add(i,i.target),this.directionalLights.set(i.uuid,i),this._lightsWithShadow.set(e,i.uuid),i.castShadow=!0,i.shadow.bias=this._bias}}dispose(){super.dispose(),this._distanceRenderer&&this._distanceRenderer.dispose(),this._lightsWithShadow.clear()}async updateShadows(){!this._isComputingShadows&&this._shadowsEnabled&&(this._isComputingShadows=!0,await this.distanceRenderer.compute())}},exports.SimpleCamera=Rs,exports.SimpleGrid=Us,exports.SimpleGridConfigManager=bs,exports.SimplePlane=Tn,exports.SimpleRaycaster=Ms,exports.SimpleRenderer=class extends Yt{constructor(e,i,s){super(e),t(this,"enabled",!0),t(this,"container"),t(this,"three"),t(this,"_canvas"),t(this,"_parameters"),t(this,"_resizeObserver",null),t(this,"onContainerUpdated",new Dt),t(this,"_resizing",!1),t(this,"resize",(e=>{if(this._resizing)return;this._resizing=!0,this.onContainerUpdated.trigger();const t=e?e.x:this.container.clientWidth,i=e?e.y:this.container.clientHeight;this.three.setSize(t,i),this.onResize.trigger(new o.Vector2(t,i)),this._resizing=!1})),t(this,"resizeEvent",(()=>{this.resize()})),t(this,"onContextLost",(e=>{e.preventDefault(),this.enabled=!1})),t(this,"onContextBack",(()=>{this.three.setRenderTarget(null),this.three.dispose(),this.three=new o.WebGLRenderer({canvas:this._canvas,antialias:!0,alpha:!0,...this._parameters}),this.enabled=!0})),this.container=i,this._parameters=s,this.three=new o.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:r}=n;r.addEventListener("webglcontextlost",this.onContextLost,!1),r.addEventListener("webglcontextrestored",this.onContextBack,!1)}update(){if(!this.enabled||!this.currentWorld)return;this.onBeforeUpdate.trigger(this);const e=this.currentWorld.scene.three,t=this.currentWorld.camera.three;this.three.render(e,t),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 o.Vector2(this.three.domElement.clientWidth,this.three.domElement.clientHeight)}setupEvents(e){const t=this.three.domElement.parentElement;if(!t)throw new Error("This renderer needs to have an HTML container!");this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),window.removeEventListener("resize",this.resizeEvent),e&&(this._resizeObserver=new ResizeObserver(this.resizeEvent),this._resizeObserver.observe(t),window.addEventListener("resize",this.resizeEvent))}setupRenderer(){this.three.localClippingEnabled=!0,this.container&&this.container.appendChild(this.three.domElement),this.onContainerUpdated.trigger()}},exports.SimpleScene=Ai,exports.SimpleSceneConfigManager=gi,exports.SimpleWorld=fi,exports.Topic=So,exports.UUID=Ii,exports.VertexPicker=class extends xt{constructor(e,i){super(e),t(this,"onDisposed",new Dt),t(this,"onVertexFound",new Dt),t(this,"onVertexLost",new Dt),t(this,"onEnabled",new Dt),t(this,"components"),t(this,"workingPlane",null),t(this,"_pickedPoint",null),t(this,"_config"),t(this,"_enabled",!1),this.components=e,this.config={snapDistance:.25,showOnlyVertex:!1,...i},this.enabled=!1}set enabled(e){this._enabled=e,e||(this._pickedPoint=null),this.onEnabled.trigger(e)}get enabled(){return this._enabled}set config(e){this._config={...this._config,...e}}get config(){return this._config}dispose(){this.onVertexFound.reset(),this.onVertexLost.reset(),this.components=null,this.onDisposed.trigger(),this.onDisposed.reset()}get(e){if(!this.enabled)return this._pickedPoint;const t=this.components.get(Ds).get(e).castRay();if(!t)return null!==this._pickedPoint&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint;const i=this.getClosestVertex(t);if(!i)return null!==this._pickedPoint&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint;return!this.workingPlane||Math.abs(this.workingPlane.distanceToPoint(i))<.001?(null!==this._pickedPoint&&this._pickedPoint.equals(i)||(this._pickedPoint=i.clone(),this.onVertexFound.trigger(this._pickedPoint)),this._pickedPoint):(this._pickedPoint=null,this._pickedPoint)}getClosestVertex(e){let t=new o.Vector3,i=!1,s=Number.MAX_SAFE_INTEGER;const n=this.getVertices(e);if(null===n)return null;for(const r of n){if(!r)continue;const n=e.point.distanceTo(r);n>s||n>this._config.snapDistance||(i=!0,t=r,s=e.point.distanceTo(r))}return i?t:this.config.showOnlyVertex?null:e.point}getVertices(e){const t=e.object;if(!e.face||!t)return null;const i=t.geometry,s=new o.Matrix4,{instanceId:n}=e,r=void 0!==n,a=t instanceof o.InstancedMesh;return a&&r&&t.getMatrixAt(n,s),[this.getVertex(e.face.a,i),this.getVertex(e.face.b,i),this.getVertex(e.face.c,i)].map((e=>(e&&(a&&r&&e.applyMatrix4(s),e.applyMatrix4(t.matrixWorld)),e)))}getVertex(e,t){if(void 0===e)return null;const i=t.attributes.position;return new o.Vector3(i.getX(e),i.getY(e),i.getZ(e))}},exports.Viewpoint=Jo,exports.Viewpoints=ia,exports.Worlds=As,exports.extensionsImporter=Oo,exports.ifcCategoryCase=wn,exports.ifcRelAttrsPosition=kn,exports.ifcRelClassNames=Hn,exports.isPointInFrontOfPlane=function(e,t,i){const s=[e[0]-t[0],e[1]-t[1],e[2]-t[2]];return i[0]*s[0]+i[1]*s[1]+i[2]*s[2]>0},exports.obbFromPoints=li,exports.readPixelsAsync=Ss,exports.relToAttributesMap=yn;
19
+ */const Pr=Ei(Lr.exports=function e(t,i,s){function n(o,a){if(!i[o]){if(!t[o]){if(!a&&_r)return _r(o);if(r)return r(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=i[o]={exports:{}};t[o][0].call(l.exports,(function(e){return n(t[o][1][e]||e)}),l,l.exports,e,t,i,s)}return i[o].exports}for(var r=_r,o=0;o<s.length;o++)n(s[o]);return n}({1:[function(e,t,i){var s=e("./utils"),n=e("./support"),r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i.encode=function(e){for(var t,i,n,o,a,c,l,h=[],u=0,I=e.length,d=I,E="string"!==s.getTypeOf(e);u<e.length;)d=I-u,n=E?(t=e[u++],i=u<I?e[u++]:0,u<I?e[u++]:0):(t=e.charCodeAt(u++),i=u<I?e.charCodeAt(u++):0,u<I?e.charCodeAt(u++):0),o=t>>2,a=(3&t)<<4|i>>4,c=1<d?(15&i)<<2|n>>6:64,l=2<d?63&n:64,h.push(r.charAt(o)+r.charAt(a)+r.charAt(c)+r.charAt(l));return h.join("")},i.decode=function(e){var t,i,s,o,a,c,l=0,h=0,u="data:";if(e.substr(0,u.length)===u)throw new Error("Invalid base64 input, it looks like a data url.");var I,d=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===r.charAt(64)&&d--,e.charAt(e.length-2)===r.charAt(64)&&d--,d%1!=0)throw new Error("Invalid base64 input, bad content length.");for(I=n.uint8array?new Uint8Array(0|d):new Array(0|d);l<e.length;)t=r.indexOf(e.charAt(l++))<<2|(o=r.indexOf(e.charAt(l++)))>>4,i=(15&o)<<4|(a=r.indexOf(e.charAt(l++)))>>2,s=(3&a)<<6|(c=r.indexOf(e.charAt(l++))),I[h++]=t,64!==a&&(I[h++]=i),64!==c&&(I[h++]=s);return I}},{"./support":30,"./utils":32}],2:[function(e,t,i){var s=e("./external"),n=e("./stream/DataWorker"),r=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function a(e,t,i,s,n){this.compressedSize=e,this.uncompressedSize=t,this.crc32=i,this.compression=s,this.compressedContent=n}a.prototype={getContentWorker:function(){var e=new n(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new n(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,i){return e.pipe(new r).pipe(new o("uncompressedSize")).pipe(t.compressWorker(i)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,i){var s=e("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,i){var s=e("./utils"),n=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==s.getTypeOf(e)?function(e,t,i,s){var r=n,o=s+i;e^=-1;for(var a=s;a<o;a++)e=e>>>8^r[255&(e^t[a])];return~e}(0|t,e,e.length,0):function(e,t,i,s){var r=n,o=s+i;e^=-1;for(var a=s;a<o;a++)e=e>>>8^r[255&(e^t.charCodeAt(a))];return~e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(e,t,i){var s=null;s="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:s}},{lie:37}],7:[function(e,t,i){var s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=e("pako"),r=e("./utils"),o=e("./stream/GenericWorker"),a=s?"uint8array":"array";function c(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}i.magic="\b\0",r.inherits(c,o),c.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(r.transformTo(a,e.data),!1)},c.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},i.compressWorker=function(e){return new c("Deflate",e)},i.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,i){function s(e,t){var i,s="";for(i=0;i<t;i++)s+=String.fromCharCode(255&e),e>>>=8;return s}function n(e,t,i,n,o,h){var u,I,d=e.file,E=e.compression,f=h!==a.utf8encode,p=r.transformTo("string",h(d.name)),C=r.transformTo("string",a.utf8encode(d.name)),T=d.comment,m=r.transformTo("string",h(T)),R=r.transformTo("string",a.utf8encode(T)),g=C.length!==d.name.length,A=R.length!==T.length,F="",S="",O="",N=d.dir,y=d.date,_={crc32:0,compressedSize:0,uncompressedSize:0};t&&!i||(_.crc32=e.crc32,_.compressedSize=e.compressedSize,_.uncompressedSize=e.uncompressedSize);var L=0;t&&(L|=8),f||!g&&!A||(L|=2048);var P,w,M,v=0,D=0;N&&(v|=16),"UNIX"===o?(D=798,v|=(P=d.unixPermissions,w=N,M=P,P||(M=w?16893:33204),(65535&M)<<16)):(D=20,v|=function(e){return 63&(e||0)}(d.dosPermissions)),u=y.getUTCHours(),u<<=6,u|=y.getUTCMinutes(),u<<=5,u|=y.getUTCSeconds()/2,I=y.getUTCFullYear()-1980,I<<=4,I|=y.getUTCMonth()+1,I<<=5,I|=y.getUTCDate(),g&&(S=s(1,1)+s(c(p),4)+C,F+="up"+s(S.length,2)+S),A&&(O=s(1,1)+s(c(m),4)+R,F+="uc"+s(O.length,2)+O);var x="";return x+="\n\0",x+=s(L,2),x+=E.magic,x+=s(u,2),x+=s(I,2),x+=s(_.crc32,4),x+=s(_.compressedSize,4),x+=s(_.uncompressedSize,4),x+=s(p.length,2),x+=s(F.length,2),{fileRecord:l.LOCAL_FILE_HEADER+x+p+F,dirRecord:l.CENTRAL_FILE_HEADER+s(D,2)+x+s(m.length,2)+"\0\0\0\0"+s(v,4)+s(n,4)+p+F+m}}var r=e("../utils"),o=e("../stream/GenericWorker"),a=e("../utf8"),c=e("../crc32"),l=e("../signature");function h(e,t,i,s){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=i,this.encodeFileName=s,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}r.inherits(h,o),h.prototype.push=function(e){var t=e.meta.percent||0,i=this.entriesCount,s=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(t+100*(i-s-1))/i:100}}))},h.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var i=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(e){this.accumulate=!1;var t,i=this.streamFiles&&!e.file.dir,r=n(e,i,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),i)this.push({data:(t=e,l.DATA_DESCRIPTOR+s(t.crc32,4)+s(t.compressedSize,4)+s(t.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var i,n,o,a,c,h,u=this.bytesWritten-e,I=(i=this.dirRecords.length,n=u,o=e,a=this.zipComment,c=this.encodeFileName,h=r.transformTo("string",c(a)),l.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(i,2)+s(i,2)+s(n,4)+s(o,4)+s(h.length,2)+h);this.push({data:I,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()})),e.on("error",(function(e){t.error(e)})),this},h.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(e){var t=this._sources;if(!o.prototype.error.call(this,e))return!1;for(var i=0;i<t.length;i++)try{t[i].error(e)}catch(e){}return!0},h.prototype.lock=function(){o.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,i){var s=e("../compressions"),n=e("./ZipFileWorker");i.generateWorker=function(e,t,i){var r=new n(t.streamFiles,i,t.platform,t.encodeFileName),o=0;try{e.forEach((function(e,i){o++;var n=function(e,t){var i=e||t,n=s[i];if(!n)throw new Error(i+" is not a valid compression method !");return n}(i.options.compression,t.compression),a=i.options.compressionOptions||t.compressionOptions||{},c=i.dir,l=i.date;i._compressWorker(n,a).withStreamInfo("file",{name:e,dir:c,date:l,comment:i.comment||"",unixPermissions:i.unixPermissions,dosPermissions:i.dosPermissions}).pipe(r)})),r.entriesCount=o}catch(e){r.error(e)}return r}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,i){function s(){if(!(this instanceof s))return new s;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 e=new s;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(s.prototype=e("./object")).loadAsync=e("./load"),s.support=e("./support"),s.defaults=e("./defaults"),s.version="3.10.1",s.loadAsync=function(e,t){return(new s).loadAsync(e,t)},s.external=e("./external"),t.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,i){var s=e("./utils"),n=e("./external"),r=e("./utf8"),o=e("./zipEntries"),a=e("./stream/Crc32Probe"),c=e("./nodejsUtils");function l(e){return new n.Promise((function(t,i){var s=e.decompressed.getContentWorker().pipe(new a);s.on("error",(function(e){i(e)})).on("end",(function(){s.streamInfo.crc32!==e.decompressed.crc32?i(new Error("Corrupted zip : CRC32 mismatch")):t()})).resume()}))}t.exports=function(e,t){var i=this;return t=s.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:r.utf8decode}),c.isNode&&c.isStream(e)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then((function(e){var i=new o(t);return i.load(e),i})).then((function(e){var i=[n.Promise.resolve(e)],s=e.files;if(t.checkCRC32)for(var r=0;r<s.length;r++)i.push(l(s[r]));return n.Promise.all(i)})).then((function(e){for(var n=e.shift(),r=n.files,o=0;o<r.length;o++){var a=r[o],c=a.fileNameStr,l=s.resolve(a.fileNameStr);i.file(l,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:t.createFolders}),a.dir||(i.file(l).unsafeOriginalName=c)}return n.zipComment.length&&(i.comment=n.zipComment),i}))}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,i){var s=e("../utils"),n=e("../stream/GenericWorker");function r(e,t){n.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}s.inherits(r,n),r.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",(function(e){t.push({data:e,meta:{percent:0}})})).on("error",(function(e){t.isPaused?this.generatedError=e:t.error(e)})).on("end",(function(){t.isPaused?t._upstreamEnded=!0:t.end()}))},r.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},r.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=r},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,i){var s=e("readable-stream").Readable;function n(e,t,i){s.call(this,t),this._helper=e;var n=this;e.on("data",(function(e,t){n.push(e)||n._helper.pause(),i&&i(t)})).on("error",(function(e){n.emit("error",e)})).on("end",(function(){n.push(null)}))}e("../utils").inherits(n,s),n.prototype._read=function(){this._helper.resume()},t.exports=n},{"../utils":32,"readable-stream":16}],14:[function(e,t,i){t.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,i){function s(e,t,i){var s,n=r.getTypeOf(t),a=r.extend(i||{},c);a.date=a.date||new Date,null!==a.compression&&(a.compression=a.compression.toUpperCase()),"string"==typeof a.unixPermissions&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&16384&a.unixPermissions&&(a.dir=!0),a.dosPermissions&&16&a.dosPermissions&&(a.dir=!0),a.dir&&(e=f(e)),a.createFolders&&(s=E(e))&&p.call(this,s,!0);var u="string"===n&&!1===a.binary&&!1===a.base64;i&&void 0!==i.binary||(a.binary=!u),(t instanceof l&&0===t.uncompressedSize||a.dir||!t||0===t.length)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",n="string");var C=null;C=t instanceof l||t instanceof o?t:I.isNode&&I.isStream(t)?new d(e,t):r.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var T=new h(e,C,a);this.files[e]=T}var n=e("./utf8"),r=e("./utils"),o=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),c=e("./defaults"),l=e("./compressedObject"),h=e("./zipObject"),u=e("./generate"),I=e("./nodejsUtils"),d=e("./nodejs/NodejsStreamInputAdapter"),E=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},f=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},p=function(e,t){return t=void 0!==t?t:c.createFolders,e=f(e),this.files[e]||s.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function C(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var T={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,i,s;for(t in this.files)s=this.files[t],(i=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(i,s)},filter:function(e){var t=[];return this.forEach((function(i,s){e(i,s)&&t.push(s)})),t},file:function(e,t,i){if(1!==arguments.length)return e=this.root+e,s.call(this,e,t,i),this;if(C(e)){var n=e;return this.filter((function(e,t){return!t.dir&&n.test(e)}))}var r=this.files[this.root+e];return r&&!r.dir?r:null},folder:function(e){if(!e)return this;if(C(e))return this.filter((function(t,i){return i.dir&&e.test(t)}));var t=this.root+e,i=p.call(this,t),s=this.clone();return s.root=i.name,s},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var i=this.filter((function(t,i){return i.name.slice(0,e.length)===e})),s=0;s<i.length;s++)delete this.files[i[s].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,i={};try{if((i=r.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=i.type.toLowerCase(),i.compression=i.compression.toUpperCase(),"binarystring"===i.type&&(i.type="string"),!i.type)throw new Error("No output type specified.");r.checkSupport(i.type),"darwin"!==i.platform&&"freebsd"!==i.platform&&"linux"!==i.platform&&"sunos"!==i.platform||(i.platform="UNIX"),"win32"===i.platform&&(i.platform="DOS");var s=i.comment||this.comment||"";t=u.generateWorker(this,i,s)}catch(e){(t=new o("error")).error(e)}return new a(t,i.type||"string",i.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=T},{"./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(e,t,i){t.exports=e("stream")},{stream:void 0}],17:[function(e,t,i){var s=e("./DataReader");function n(e){s.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(n,s),n.prototype.byteAt=function(e){return this.data[this.zero+e]},n.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),i=e.charCodeAt(1),s=e.charCodeAt(2),n=e.charCodeAt(3),r=this.length-4;0<=r;--r)if(this.data[r]===t&&this.data[r+1]===i&&this.data[r+2]===s&&this.data[r+3]===n)return r-this.zero;return-1},n.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),i=e.charCodeAt(1),s=e.charCodeAt(2),n=e.charCodeAt(3),r=this.readData(4);return t===r[0]&&i===r[1]&&s===r[2]&&n===r[3]},n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,i){var s=e("../utils");function n(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,i=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)i=(i<<8)+this.byteAt(t);return this.index+=e,i},readString:function(e){return s.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,i){var s=e("./Uint8ArrayReader");function n(e){s.call(this,e)}e("../utils").inherits(n,s),n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,i){var s=e("./DataReader");function n(e){s.call(this,e)}e("../utils").inherits(n,s),n.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},n.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},n.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,i){var s=e("./ArrayReader");function n(e){s.call(this,e)}e("../utils").inherits(n,s),n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,i){var s=e("../utils"),n=e("../support"),r=e("./ArrayReader"),o=e("./StringReader"),a=e("./NodeBufferReader"),c=e("./Uint8ArrayReader");t.exports=function(e){var t=s.getTypeOf(e);return s.checkSupport(t),"string"!==t||n.uint8array?"nodebuffer"===t?new a(e):n.uint8array?new c(s.transformTo("uint8array",e)):new r(s.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,i){var s=e("./GenericWorker"),n=e("../utils");function r(e){s.call(this,"ConvertWorker to "+e),this.destType=e}n.inherits(r,s),r.prototype.processChunk=function(e){this.push({data:n.transformTo(this.destType,e.data),meta:e.meta})},t.exports=r},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,i){var s=e("./GenericWorker"),n=e("../crc32");function r(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(r,s),r.prototype.processChunk=function(e){this.streamInfo.crc32=n(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=r},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,i){var s=e("../utils"),n=e("./GenericWorker");function r(e){n.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}s.inherits(r,n),r.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}n.prototype.processChunk.call(this,e)},t.exports=r},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,i){var s=e("../utils"),n=e("./GenericWorker");function r(e){n.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=s.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}s.inherits(r,n),r.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},r.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},r.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},r.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=r},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,i){function s(e){this.name=e||"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}s.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var i=0;i<this._listeners[e].length;i++)this._listeners[e][i].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.end()})),e.on("error",(function(e){t.error(e)})),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 e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},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 e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=s},{}],29:[function(e,t,i){var s=e("../utils"),n=e("./ConvertWorker"),r=e("./GenericWorker"),o=e("../base64"),a=e("../support"),c=e("../external"),l=null;if(a.nodestream)try{l=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function h(e,t){return new c.Promise((function(i,n){var r=[],a=e._internalType,c=e._outputType,l=e._mimeType;e.on("data",(function(e,i){r.push(e),t&&t(i)})).on("error",(function(e){r=[],n(e)})).on("end",(function(){try{var e=function(e,t,i){switch(e){case"blob":return s.newBlob(s.transformTo("arraybuffer",t),i);case"base64":return o.encode(t);default:return s.transformTo(e,t)}}(c,function(e,t){var i,s=0,n=null,r=0;for(i=0;i<t.length;i++)r+=t[i].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(n=new Uint8Array(r),i=0;i<t.length;i++)n.set(t[i],s),s+=t[i].length;return n;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(a,r),l);i(e)}catch(e){n(e)}r=[]})).resume()}))}function u(e,t,i){var o=t;switch(t){case"blob":case"arraybuffer":o="uint8array";break;case"base64":o="string"}try{this._internalType=o,this._outputType=t,this._mimeType=i,s.checkSupport(o),this._worker=e.pipe(new n(o)),e.lock()}catch(e){this._worker=new r("error"),this._worker.error(e)}}u.prototype={accumulate:function(e){return h(this,e)},on:function(e,t){var i=this;return"data"===e?this._worker.on(e,(function(e){t.call(i,e.data,e.meta)})):this._worker.on(e,(function(){s.delay(t,arguments,i)})),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(s.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new l(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=u},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,i){if(i.base64=!0,i.array=!0,i.string=!0,i.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,i.nodebuffer="undefined"!=typeof Buffer,i.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=0===new Blob([s],{type:"application/zip"}).size}catch(e){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(s),i.blob=0===n.getBlob("application/zip").size}catch(e){i.blob=!1}}}try{i.nodestream=!!e("readable-stream").Readable}catch(e){i.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,i){for(var s=e("./utils"),n=e("./support"),r=e("./nodejsUtils"),o=e("./stream/GenericWorker"),a=new Array(256),c=0;c<256;c++)a[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function l(){o.call(this,"utf-8 decode"),this.leftOver=null}function h(){o.call(this,"utf-8 encode")}a[254]=a[254]=1,i.utf8encode=function(e){return n.nodebuffer?r.newBufferFrom(e,"utf-8"):function(e){var t,i,s,r,o,a=e.length,c=0;for(r=0;r<a;r++)55296==(64512&(i=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(s=e.charCodeAt(r+1)))&&(i=65536+(i-55296<<10)+(s-56320),r++),c+=i<128?1:i<2048?2:i<65536?3:4;for(t=n.uint8array?new Uint8Array(c):new Array(c),r=o=0;o<c;r++)55296==(64512&(i=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(s=e.charCodeAt(r+1)))&&(i=65536+(i-55296<<10)+(s-56320),r++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t}(e)},i.utf8decode=function(e){return n.nodebuffer?s.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,i,n,r,o=e.length,c=new Array(2*o);for(t=i=0;t<o;)if((n=e[t++])<128)c[i++]=n;else if(4<(r=a[n]))c[i++]=65533,t+=r-1;else{for(n&=2===r?31:3===r?15:7;1<r&&t<o;)n=n<<6|63&e[t++],r--;1<r?c[i++]=65533:n<65536?c[i++]=n:(n-=65536,c[i++]=55296|n>>10&1023,c[i++]=56320|1023&n)}return c.length!==i&&(c.subarray?c=c.subarray(0,i):c.length=i),s.applyFromCharCode(c)}(e=s.transformTo(n.uint8array?"uint8array":"array",e))},s.inherits(l,o),l.prototype.processChunk=function(e){var t=s.transformTo(n.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var r=t;(t=new Uint8Array(r.length+this.leftOver.length)).set(this.leftOver,0),t.set(r,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+a[e[i]]>t?i:t}(t),c=t;o!==t.length&&(n.uint8array?(c=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(c=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:i.utf8decode(c),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=l,s.inherits(h,o),h.prototype.processChunk=function(e){this.push({data:i.utf8encode(e.data),meta:e.meta})},i.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,i){var s=e("./support"),n=e("./base64"),r=e("./nodejsUtils"),o=e("./external");function a(e){return e}function c(e,t){for(var i=0;i<e.length;++i)t[i]=255&e.charCodeAt(i);return t}e("setimmediate"),i.newBlob=function(e,t){i.checkSupport("blob");try{return new Blob([e],{type:t})}catch(i){try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return s.append(e),s.getBlob(t)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var l={stringifyByChunk:function(e,t,i){var s=[],n=0,r=e.length;if(r<=i)return String.fromCharCode.apply(null,e);for(;n<r;)"array"===t||"nodebuffer"===t?s.push(String.fromCharCode.apply(null,e.slice(n,Math.min(n+i,r)))):s.push(String.fromCharCode.apply(null,e.subarray(n,Math.min(n+i,r)))),n+=i;return s.join("")},stringifyByChar:function(e){for(var t="",i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return t},applyCanBeUsed:{uint8array:function(){try{return s.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return s.nodebuffer&&1===String.fromCharCode.apply(null,r.allocBuffer(1)).length}catch(e){return!1}}()}};function h(e){var t=65536,s=i.getTypeOf(e),n=!0;if("uint8array"===s?n=l.applyCanBeUsed.uint8array:"nodebuffer"===s&&(n=l.applyCanBeUsed.nodebuffer),n)for(;1<t;)try{return l.stringifyByChunk(e,s,t)}catch(e){t=Math.floor(t/2)}return l.stringifyByChar(e)}function u(e,t){for(var i=0;i<e.length;i++)t[i]=e[i];return t}i.applyFromCharCode=h;var I={};I.string={string:a,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return I.string.uint8array(e).buffer},uint8array:function(e){return c(e,new Uint8Array(e.length))},nodebuffer:function(e){return c(e,r.allocBuffer(e.length))}},I.array={string:h,array:a,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return r.newBufferFrom(e)}},I.arraybuffer={string:function(e){return h(new Uint8Array(e))},array:function(e){return u(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:a,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return r.newBufferFrom(new Uint8Array(e))}},I.uint8array={string:h,array:function(e){return u(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:a,nodebuffer:function(e){return r.newBufferFrom(e)}},I.nodebuffer={string:h,array:function(e){return u(e,new Array(e.length))},arraybuffer:function(e){return I.nodebuffer.uint8array(e).buffer},uint8array:function(e){return u(e,new Uint8Array(e.length))},nodebuffer:a},i.transformTo=function(e,t){if(t=t||"",!e)return t;i.checkSupport(e);var s=i.getTypeOf(t);return I[s][e](t)},i.resolve=function(e){for(var t=e.split("/"),i=[],s=0;s<t.length;s++){var n=t[s];"."===n||""===n&&0!==s&&s!==t.length-1||(".."===n?i.pop():i.push(n))}return i.join("/")},i.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":s.nodebuffer&&r.isBuffer(e)?"nodebuffer":s.uint8array&&e instanceof Uint8Array?"uint8array":s.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},i.checkSupport=function(e){if(!s[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},i.MAX_VALUE_16BITS=65535,i.MAX_VALUE_32BITS=-1,i.pretty=function(e){var t,i,s="";for(i=0;i<(e||"").length;i++)s+="\\x"+((t=e.charCodeAt(i))<16?"0":"")+t.toString(16).toUpperCase();return s},i.delay=function(e,t,i){setImmediate((function(){e.apply(i||null,t||[])}))},i.inherits=function(e,t){function i(){}i.prototype=t.prototype,e.prototype=new i},i.extend=function(){var e,t,i={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===i[t]&&(i[t]=arguments[e][t]);return i},i.prepareContent=function(e,t,r,a,l){return o.Promise.resolve(t).then((function(e){return s.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new o.Promise((function(t,i){var s=new FileReader;s.onload=function(e){t(e.target.result)},s.onerror=function(e){i(e.target.error)},s.readAsArrayBuffer(e)})):e})).then((function(t){var h,u=i.getTypeOf(t);return u?("arraybuffer"===u?t=i.transformTo("uint8array",t):"string"===u&&(l?t=n.decode(t):r&&!0!==a&&(t=c(h=t,s.uint8array?new Uint8Array(h.length):new Array(h.length)))),t):o.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))}))}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,i){var s=e("./reader/readerFor"),n=e("./utils"),r=e("./signature"),o=e("./zipEntry"),a=e("./support");function c(e){this.files=[],this.loadOptions=e}c.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(t)+", expected "+n.pretty(e)+")")}},isSignature:function(e,t){var i=this.reader.index;this.reader.setIndex(e);var s=this.reader.readString(4)===t;return this.reader.setIndex(i),s},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 e=this.reader.readData(this.zipCommentLength),t=a.uint8array?"uint8array":"array",i=n.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(i)},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 e,t,i,s=this.zip64EndOfCentralSize-44;0<s;)e=this.reader.readInt(2),t=this.reader.readInt(4),i=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:i}},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 e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(r.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(r.CENTRAL_FILE_HEADER);)(e=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(r.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,r.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(e);var t=e;if(this.checkSignature(r.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(r.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(r.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,r.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(r.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(r.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var i=this.centralDirOffset+this.centralDirSize;this.zip64&&(i+=20,i+=12+this.zip64EndOfCentralSize);var s=t-i;if(0<s)this.isSignature(t,r.CENTRAL_FILE_HEADER)||(this.reader.zero=s);else if(s<0)throw new Error("Corrupted zip: missing "+Math.abs(s)+" bytes.")},prepareReader:function(e){this.reader=s(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=c},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,i){var s=e("./reader/readerFor"),n=e("./utils"),r=e("./compressedObject"),o=e("./crc32"),a=e("./utf8"),c=e("./compressions"),l=e("./support");function h(e,t){this.options=e,this.loadOptions=t}h.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(e){var t,i;if(e.skip(22),this.fileNameLength=e.readInt(2),i=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(i),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in c)if(Object.prototype.hasOwnProperty.call(c,t)&&c[t].magic===e)return c[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new r(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=s(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,i,s,n=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<n;)t=e.readInt(2),i=e.readInt(2),s=e.readData(i),this.extraFields[t]={id:t,length:i,value:s};e.setIndex(n)},handleUTF8:function(){var e=l.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var i=n.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var s=this.findExtraFieldUnicodeComment();if(null!==s)this.fileCommentStr=s;else{var r=n.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(r)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=s(e.value);return 1!==t.readInt(1)||o(this.fileName)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=s(e.value);return 1!==t.readInt(1)||o(this.fileComment)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null}},t.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,i){function s(e,t,i){this.name=e,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=t,this._dataBinary=i.binary,this.options={compression:i.compression,compressionOptions:i.compressionOptions}}var n=e("./stream/StreamHelper"),r=e("./stream/DataWorker"),o=e("./utf8"),a=e("./compressedObject"),c=e("./stream/GenericWorker");s.prototype={internalStream:function(e){var t=null,i="string";try{if(!e)throw new Error("No output type specified.");var s="string"===(i=e.toLowerCase())||"text"===i;"binarystring"!==i&&"text"!==i||(i="string"),t=this._decompressWorker();var r=!this._dataBinary;r&&!s&&(t=t.pipe(new o.Utf8EncodeWorker)),!r&&s&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(e){(t=new c("error")).error(e)}return new n(t,i,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof a&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new o.Utf8EncodeWorker)),a.createWorkerFrom(i,e,t)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof c?this._data:new r(this._data)}};for(var l=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},u=0;u<l.length;u++)s.prototype[l[u]]=h;t.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,i){(function(e){var i,s,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var r=0,o=new n(h),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),i=function(){a.data=r=++r%2}}else if(e.setImmediate||void 0===e.MessageChannel)i="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){h(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(h,0)};else{var c=new e.MessageChannel;c.port1.onmessage=h,i=function(){c.port2.postMessage(0)}}var l=[];function h(){var e,t;s=!0;for(var i=l.length;i;){for(t=l,l=[],e=-1;++e<i;)t[e]();i=l.length}s=!1}t.exports=function(e){1!==l.push(e)||s||i()}}).call(this,void 0!==di?di:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,i){var s=e("immediate");function n(){}var r={},o=["REJECTED"],a=["FULFILLED"],c=["PENDING"];function l(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==n&&d(this,e)}function h(e,t,i){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof i&&(this.onRejected=i,this.callRejected=this.otherCallRejected)}function u(e,t,i){s((function(){var s;try{s=t(i)}catch(t){return r.reject(e,t)}s===e?r.reject(e,new TypeError("Cannot resolve promise with itself")):r.resolve(e,s)}))}function I(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(e,t){var i=!1;function s(t){i||(i=!0,r.reject(e,t))}function n(t){i||(i=!0,r.resolve(e,t))}var o=E((function(){t(n,s)}));"error"===o.status&&s(o.value)}function E(e,t){var i={};try{i.value=e(t),i.status="success"}catch(e){i.status="error",i.value=e}return i}(t.exports=l).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then((function(i){return t.resolve(e()).then((function(){return i}))}),(function(i){return t.resolve(e()).then((function(){throw i}))}))},l.prototype.catch=function(e){return this.then(null,e)},l.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var i=new this.constructor(n);return this.state!==c?u(i,this.state===a?e:t,this.outcome):this.queue.push(new h(i,e,t)),i},h.prototype.callFulfilled=function(e){r.resolve(this.promise,e)},h.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},h.prototype.callRejected=function(e){r.reject(this.promise,e)},h.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},r.resolve=function(e,t){var i=E(I,t);if("error"===i.status)return r.reject(e,i.value);var s=i.value;if(s)d(e,s);else{e.state=a,e.outcome=t;for(var n=-1,o=e.queue.length;++n<o;)e.queue[n].callFulfilled(t)}return e},r.reject=function(e,t){e.state=o,e.outcome=t;for(var i=-1,s=e.queue.length;++i<s;)e.queue[i].callRejected(t);return e},l.resolve=function(e){return e instanceof this?e:r.resolve(new this(n),e)},l.reject=function(e){var t=new this(n);return r.reject(t,e)},l.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,s=!1;if(!i)return this.resolve([]);for(var o=new Array(i),a=0,c=-1,l=new this(n);++c<i;)h(e[c],c);return l;function h(e,n){t.resolve(e).then((function(e){o[n]=e,++a!==i||s||(s=!0,r.resolve(l,o))}),(function(e){s||(s=!0,r.reject(l,e))}))}},l.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var i=e.length,s=!1;if(!i)return this.resolve([]);for(var o,a=-1,c=new this(n);++a<i;)o=e[a],t.resolve(o).then((function(e){s||(s=!0,r.resolve(c,e))}),(function(e){s||(s=!0,r.reject(c,e))}));return c}},{immediate:36}],38:[function(e,t,i){var s={};(0,e("./lib/utils/common").assign)(s,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,i){var s=e("./zlib/deflate"),n=e("./utils/common"),r=e("./utils/strings"),o=e("./zlib/messages"),a=e("./zlib/zstream"),c=Object.prototype.toString,l=0,h=-1,u=0,I=8;function d(e){if(!(this instanceof d))return new d(e);this.options=n.assign({level:h,method:I,chunkSize:16384,windowBits:15,memLevel:8,strategy:u,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var i=s.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==l)throw new Error(o[i]);if(t.header&&s.deflateSetHeader(this.strm,t.header),t.dictionary){var E;if(E="string"==typeof t.dictionary?r.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(i=s.deflateSetDictionary(this.strm,E))!==l)throw new Error(o[i]);this._dict_set=!0}}function E(e,t){var i=new d(t);if(i.push(e,!0),i.err)throw i.msg||o[i.err];return i.result}d.prototype.push=function(e,t){var i,o,a=this.strm,h=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=r.string2buf(e):"[object ArrayBuffer]"===c.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new n.Buf8(h),a.next_out=0,a.avail_out=h),1!==(i=s.deflate(a,o))&&i!==l)return this.onEnd(i),!(this.ended=!0);0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(r.buf2binstring(n.shrinkBuf(a.output,a.next_out))):this.onData(n.shrinkBuf(a.output,a.next_out)))}while((0<a.avail_in||0===a.avail_out)&&1!==i);return 4===o?(i=s.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===l):2!==o||(this.onEnd(l),!(a.avail_out=0))},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===l&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Deflate=d,i.deflate=E,i.deflateRaw=function(e,t){return(t=t||{}).raw=!0,E(e,t)},i.gzip=function(e,t){return(t=t||{}).gzip=!0,E(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,i){var s=e("./zlib/inflate"),n=e("./utils/common"),r=e("./utils/strings"),o=e("./zlib/constants"),a=e("./zlib/messages"),c=e("./zlib/zstream"),l=e("./zlib/gzheader"),h=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var i=s.inflateInit2(this.strm,t.windowBits);if(i!==o.Z_OK)throw new Error(a[i]);this.header=new l,s.inflateGetHeader(this.strm,this.header)}function I(e,t){var i=new u(t);if(i.push(e,!0),i.err)throw i.msg||a[i.err];return i.result}u.prototype.push=function(e,t){var i,a,c,l,u,I,d=this.strm,E=this.options.chunkSize,f=this.options.dictionary,p=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?d.input=r.binstring2buf(e):"[object ArrayBuffer]"===h.call(e)?d.input=new Uint8Array(e):d.input=e,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new n.Buf8(E),d.next_out=0,d.avail_out=E),(i=s.inflate(d,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&f&&(I="string"==typeof f?r.string2buf(f):"[object ArrayBuffer]"===h.call(f)?new Uint8Array(f):f,i=s.inflateSetDictionary(this.strm,I)),i===o.Z_BUF_ERROR&&!0===p&&(i=o.Z_OK,p=!1),i!==o.Z_STREAM_END&&i!==o.Z_OK)return this.onEnd(i),!(this.ended=!0);d.next_out&&(0!==d.avail_out&&i!==o.Z_STREAM_END&&(0!==d.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(c=r.utf8border(d.output,d.next_out),l=d.next_out-c,u=r.buf2string(d.output,c),d.next_out=l,d.avail_out=E-l,l&&n.arraySet(d.output,d.output,c,l,0),this.onData(u)):this.onData(n.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(p=!0)}while((0<d.avail_in||0===d.avail_out)&&i!==o.Z_STREAM_END);return i===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(i=s.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(d.avail_out=0))},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},i.Inflate=u,i.inflate=I,i.inflateRaw=function(e,t){return(t=t||{}).raw=!0,I(e,t)},i.ungzip=I},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,i){var s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;i.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var s in i)i.hasOwnProperty(s)&&(e[s]=i[s])}}return e},i.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,i,s,n){if(t.subarray&&e.subarray)e.set(t.subarray(i,i+s),n);else for(var r=0;r<s;r++)e[n+r]=t[i+r]},flattenChunks:function(e){var t,i,s,n,r,o;for(t=s=0,i=e.length;t<i;t++)s+=e[t].length;for(o=new Uint8Array(s),t=n=0,i=e.length;t<i;t++)r=e[t],o.set(r,n),n+=r.length;return o}},r={arraySet:function(e,t,i,s,n){for(var r=0;r<s;r++)e[n+r]=t[i+r]},flattenChunks:function(e){return[].concat.apply([],e)}};i.setTyped=function(e){e?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,n)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,r))},i.setTyped(s)},{}],42:[function(e,t,i){var s=e("./common"),n=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch(e){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){r=!1}for(var o=new s.Buf8(256),a=0;a<256;a++)o[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function c(e,t){if(t<65537&&(e.subarray&&r||!e.subarray&&n))return String.fromCharCode.apply(null,s.shrinkBuf(e,t));for(var i="",o=0;o<t;o++)i+=String.fromCharCode(e[o]);return i}o[254]=o[254]=1,i.string2buf=function(e){var t,i,n,r,o,a=e.length,c=0;for(r=0;r<a;r++)55296==(64512&(i=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(n=e.charCodeAt(r+1)))&&(i=65536+(i-55296<<10)+(n-56320),r++),c+=i<128?1:i<2048?2:i<65536?3:4;for(t=new s.Buf8(c),r=o=0;o<c;r++)55296==(64512&(i=e.charCodeAt(r)))&&r+1<a&&56320==(64512&(n=e.charCodeAt(r+1)))&&(i=65536+(i-55296<<10)+(n-56320),r++),i<128?t[o++]=i:(i<2048?t[o++]=192|i>>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t},i.buf2binstring=function(e){return c(e,e.length)},i.binstring2buf=function(e){for(var t=new s.Buf8(e.length),i=0,n=t.length;i<n;i++)t[i]=e.charCodeAt(i);return t},i.buf2string=function(e,t){var i,s,n,r,a=t||e.length,l=new Array(2*a);for(i=s=0;i<a;)if((n=e[i++])<128)l[s++]=n;else if(4<(r=o[n]))l[s++]=65533,i+=r-1;else{for(n&=2===r?31:3===r?15:7;1<r&&i<a;)n=n<<6|63&e[i++],r--;1<r?l[s++]=65533:n<65536?l[s++]=n:(n-=65536,l[s++]=55296|n>>10&1023,l[s++]=56320|1023&n)}return c(l,s)},i.utf8border=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+o[e[i]]>t?i:t}},{"./common":41}],43:[function(e,t,i){t.exports=function(e,t,i,s){for(var n=65535&e,r=e>>>16&65535,o=0;0!==i;){for(i-=o=2e3<i?2e3:i;r=r+(n=n+t[s++]|0)|0,--o;);n%=65521,r%=65521}return n|r<<16}},{}],44:[function(e,t,i){t.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(e,t,i){var s=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var s=0;s<8;s++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();t.exports=function(e,t,i,n){var r=s,o=n+i;e^=-1;for(var a=n;a<o;a++)e=e>>>8^r[255&(e^t[a])];return~e}},{}],46:[function(e,t,i){var s,n=e("../utils/common"),r=e("./trees"),o=e("./adler32"),a=e("./crc32"),c=e("./messages"),l=0,h=4,u=0,I=-2,d=-1,E=4,f=2,p=8,C=9,T=286,m=30,R=19,g=2*T+1,A=15,F=3,S=258,O=S+F+1,N=42,y=113,_=1,L=2,P=3,w=4;function M(e,t){return e.msg=c[t],t}function v(e){return(e<<1)-(4<e?9:0)}function D(e){for(var t=e.length;0<=--t;)e[t]=0}function x(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(n.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))}function b(e,t){r._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,x(e.strm)}function U(e,t){e.pending_buf[e.pending++]=t}function B(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function V(e,t){var i,s,n=e.max_chain_length,r=e.strstart,o=e.prev_length,a=e.nice_match,c=e.strstart>e.w_size-O?e.strstart-(e.w_size-O):0,l=e.window,h=e.w_mask,u=e.prev,I=e.strstart+S,d=l[r+o-1],E=l[r+o];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do{if(l[(i=t)+o]===E&&l[i+o-1]===d&&l[i]===l[r]&&l[++i]===l[r+1]){r+=2,i++;do{}while(l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&r<I);if(s=S-(I-r),r=I-S,o<s){if(e.match_start=t,a<=(o=s))break;d=l[r+o-1],E=l[r+o]}}}while((t=u[t&h])>c&&0!=--n);return o<=e.lookahead?o:e.lookahead}function Y(e){var t,i,s,r,c,l,h,u,I,d,E=e.w_size;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=E+(E-O)){for(n.arraySet(e.window,e.window,E,E,0),e.match_start-=E,e.strstart-=E,e.block_start-=E,t=i=e.hash_size;s=e.head[--t],e.head[t]=E<=s?s-E:0,--i;);for(t=i=E;s=e.prev[--t],e.prev[t]=E<=s?s-E:0,--i;);r+=E}if(0===e.strm.avail_in)break;if(l=e.strm,h=e.window,u=e.strstart+e.lookahead,d=void 0,(I=r)<(d=l.avail_in)&&(d=I),i=0===d?0:(l.avail_in-=d,n.arraySet(h,l.input,l.next_in,d,u),1===l.state.wrap?l.adler=o(l.adler,h,d,u):2===l.state.wrap&&(l.adler=a(l.adler,h,d,u)),l.next_in+=d,l.total_in+=d,d),e.lookahead+=i,e.lookahead+e.insert>=F)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+F-1])&e.hash_mask,e.prev[c&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=c,c++,e.insert--,!(e.lookahead+e.insert<F)););}while(e.lookahead<O&&0!==e.strm.avail_in)}function G(e,t){for(var i,s;;){if(e.lookahead<O){if(Y(e),e.lookahead<O&&t===l)return _;if(0===e.lookahead)break}if(i=0,e.lookahead>=F&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-O&&(e.match_length=V(e,i)),e.match_length>=F)if(s=r._tr_tally(e,e.strstart-e.match_start,e.match_length-F),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=F){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else s=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(s&&(b(e,!1),0===e.strm.avail_out))return _}return e.insert=e.strstart<F-1?e.strstart:F-1,t===h?(b(e,!0),0===e.strm.avail_out?P:w):e.last_lit&&(b(e,!1),0===e.strm.avail_out)?_:L}function z(e,t){for(var i,s,n;;){if(e.lookahead<O){if(Y(e),e.lookahead<O&&t===l)return _;if(0===e.lookahead)break}if(i=0,e.lookahead>=F&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=F-1,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-O&&(e.match_length=V(e,i),e.match_length<=5&&(1===e.strategy||e.match_length===F&&4096<e.strstart-e.match_start)&&(e.match_length=F-1)),e.prev_length>=F&&e.match_length<=e.prev_length){for(n=e.strstart+e.lookahead-F,s=r._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-F),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+F-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=F-1,e.strstart++,s&&(b(e,!1),0===e.strm.avail_out))return _}else if(e.match_available){if((s=r._tr_tally(e,0,e.window[e.strstart-1]))&&b(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return _}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(s=r._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<F-1?e.strstart:F-1,t===h?(b(e,!0),0===e.strm.avail_out?P:w):e.last_lit&&(b(e,!1),0===e.strm.avail_out)?_:L}function k(e,t,i,s,n){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=s,this.func=n}function H(){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=p,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 n.Buf16(2*g),this.dyn_dtree=new n.Buf16(2*(2*m+1)),this.bl_tree=new n.Buf16(2*(2*R+1)),D(this.dyn_ltree),D(this.dyn_dtree),D(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(A+1),this.heap=new n.Buf16(2*T+1),D(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(2*T+1),D(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 W(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=f,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?N:y,e.adler=2===t.wrap?0:1,t.last_flush=l,r._tr_init(t),u):M(e,I)}function X(e){var t,i=W(e);return i===u&&((t=e.state).window_size=2*t.w_size,D(t.head),t.max_lazy_match=s[t.level].max_lazy,t.good_match=s[t.level].good_length,t.nice_match=s[t.level].nice_length,t.max_chain_length=s[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=F-1,t.match_available=0,t.ins_h=0),i}function Z(e,t,i,s,r,o){if(!e)return I;var a=1;if(t===d&&(t=6),s<0?(a=0,s=-s):15<s&&(a=2,s-=16),r<1||C<r||i!==p||s<8||15<s||t<0||9<t||o<0||E<o)return M(e,I);8===s&&(s=9);var c=new H;return(e.state=c).strm=e,c.wrap=a,c.gzhead=null,c.w_bits=s,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.hash_bits=r+7,c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+F-1)/F),c.window=new n.Buf8(2*c.w_size),c.head=new n.Buf16(c.hash_size),c.prev=new n.Buf16(c.w_size),c.lit_bufsize=1<<r+6,c.pending_buf_size=4*c.lit_bufsize,c.pending_buf=new n.Buf8(c.pending_buf_size),c.d_buf=1*c.lit_bufsize,c.l_buf=3*c.lit_bufsize,c.level=t,c.strategy=o,c.method=i,X(e)}s=[new k(0,0,0,0,(function(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Y(e),0===e.lookahead&&t===l)return _;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var s=e.block_start+i;if((0===e.strstart||e.strstart>=s)&&(e.lookahead=e.strstart-s,e.strstart=s,b(e,!1),0===e.strm.avail_out))return _;if(e.strstart-e.block_start>=e.w_size-O&&(b(e,!1),0===e.strm.avail_out))return _}return e.insert=0,t===h?(b(e,!0),0===e.strm.avail_out?P:w):(e.strstart>e.block_start&&(b(e,!1),e.strm.avail_out),_)})),new k(4,4,8,4,G),new k(4,5,16,8,G),new k(4,6,32,32,G),new k(4,4,16,16,z),new k(8,16,32,32,z),new k(8,16,128,128,z),new k(8,32,128,256,z),new k(32,128,258,1024,z),new k(32,258,258,4096,z)],i.deflateInit=function(e,t){return Z(e,t,p,15,8,0)},i.deflateInit2=Z,i.deflateReset=X,i.deflateResetKeep=W,i.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?I:(e.state.gzhead=t,u):I},i.deflate=function(e,t){var i,n,o,c;if(!e||!e.state||5<t||t<0)return e?M(e,I):I;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&t!==h)return M(e,0===e.avail_out?-5:I);if(n.strm=e,i=n.last_flush,n.last_flush=t,n.status===N)if(2===n.wrap)e.adler=0,U(n,31),U(n,139),U(n,8),n.gzhead?(U(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)),U(n,255&n.gzhead.time),U(n,n.gzhead.time>>8&255),U(n,n.gzhead.time>>16&255),U(n,n.gzhead.time>>24&255),U(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),U(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(U(n,255&n.gzhead.extra.length),U(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=a(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(U(n,0),U(n,0),U(n,0),U(n,0),U(n,0),U(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),U(n,3),n.status=y);else{var d=p+(n.w_bits-8<<4)<<8;d|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(d|=32),d+=31-d%31,n.status=y,B(n,d),0!==n.strstart&&(B(n,e.adler>>>16),B(n,65535&e.adler)),e.adler=1}if(69===n.status)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&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),x(e),o=n.pending,n.pending!==n.pending_buf_size));)U(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.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(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),x(e),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,U(n,c)}while(0!==c);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),x(e),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,U(n,c)}while(0!==c);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&x(e),n.pending+2<=n.pending_buf_size&&(U(n,255&e.adler),U(n,e.adler>>8&255),e.adler=0,n.status=y)):n.status=y),0!==n.pending){if(x(e),0===e.avail_out)return n.last_flush=-1,u}else if(0===e.avail_in&&v(t)<=v(i)&&t!==h)return M(e,-5);if(666===n.status&&0!==e.avail_in)return M(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==l&&666!==n.status){var E=2===n.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(Y(e),0===e.lookahead)){if(t===l)return _;break}if(e.match_length=0,i=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(b(e,!1),0===e.strm.avail_out))return _}return e.insert=0,t===h?(b(e,!0),0===e.strm.avail_out?P:w):e.last_lit&&(b(e,!1),0===e.strm.avail_out)?_:L}(n,t):3===n.strategy?function(e,t){for(var i,s,n,o,a=e.window;;){if(e.lookahead<=S){if(Y(e),e.lookahead<=S&&t===l)return _;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=F&&0<e.strstart&&(s=a[n=e.strstart-1])===a[++n]&&s===a[++n]&&s===a[++n]){o=e.strstart+S;do{}while(s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&s===a[++n]&&n<o);e.match_length=S-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=F?(i=r._tr_tally(e,1,e.match_length-F),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(b(e,!1),0===e.strm.avail_out))return _}return e.insert=0,t===h?(b(e,!0),0===e.strm.avail_out?P:w):e.last_lit&&(b(e,!1),0===e.strm.avail_out)?_:L}(n,t):s[n.level].func(n,t);if(E!==P&&E!==w||(n.status=666),E===_||E===P)return 0===e.avail_out&&(n.last_flush=-1),u;if(E===L&&(1===t?r._tr_align(n):5!==t&&(r._tr_stored_block(n,0,0,!1),3===t&&(D(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),x(e),0===e.avail_out))return n.last_flush=-1,u}return t!==h?u:n.wrap<=0?1:(2===n.wrap?(U(n,255&e.adler),U(n,e.adler>>8&255),U(n,e.adler>>16&255),U(n,e.adler>>24&255),U(n,255&e.total_in),U(n,e.total_in>>8&255),U(n,e.total_in>>16&255),U(n,e.total_in>>24&255)):(B(n,e.adler>>>16),B(n,65535&e.adler)),x(e),0<n.wrap&&(n.wrap=-n.wrap),0!==n.pending?u:1)},i.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==N&&69!==t&&73!==t&&91!==t&&103!==t&&t!==y&&666!==t?M(e,I):(e.state=null,t===y?M(e,-3):u):I},i.deflateSetDictionary=function(e,t){var i,s,r,a,c,l,h,d,E=t.length;if(!e||!e.state)return I;if(2===(a=(i=e.state).wrap)||1===a&&i.status!==N||i.lookahead)return I;for(1===a&&(e.adler=o(e.adler,t,E,0)),i.wrap=0,E>=i.w_size&&(0===a&&(D(i.head),i.strstart=0,i.block_start=0,i.insert=0),d=new n.Buf8(i.w_size),n.arraySet(d,t,E-i.w_size,i.w_size,0),t=d,E=i.w_size),c=e.avail_in,l=e.next_in,h=e.input,e.avail_in=E,e.next_in=0,e.input=t,Y(i);i.lookahead>=F;){for(s=i.strstart,r=i.lookahead-(F-1);i.ins_h=(i.ins_h<<i.hash_shift^i.window[s+F-1])&i.hash_mask,i.prev[s&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=s,s++,--r;);i.strstart=s,i.lookahead=F-1,Y(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=F-1,i.match_available=0,e.next_in=l,e.input=h,e.avail_in=c,i.wrap=a,u},i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,i){t.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(e,t,i){t.exports=function(e,t){var i,s,n,r,o,a,c,l,h,u,I,d,E,f,p,C,T,m,R,g,A,F,S,O,N;i=e.state,s=e.next_in,O=e.input,n=s+(e.avail_in-5),r=e.next_out,N=e.output,o=r-(t-e.avail_out),a=r+(e.avail_out-257),c=i.dmax,l=i.wsize,h=i.whave,u=i.wnext,I=i.window,d=i.hold,E=i.bits,f=i.lencode,p=i.distcode,C=(1<<i.lenbits)-1,T=(1<<i.distbits)-1;e:do{E<15&&(d+=O[s++]<<E,E+=8,d+=O[s++]<<E,E+=8),m=f[d&C];t:for(;;){if(d>>>=R=m>>>24,E-=R,0==(R=m>>>16&255))N[r++]=65535&m;else{if(!(16&R)){if(!(64&R)){m=f[(65535&m)+(d&(1<<R)-1)];continue t}if(32&R){i.mode=12;break e}e.msg="invalid literal/length code",i.mode=30;break e}g=65535&m,(R&=15)&&(E<R&&(d+=O[s++]<<E,E+=8),g+=d&(1<<R)-1,d>>>=R,E-=R),E<15&&(d+=O[s++]<<E,E+=8,d+=O[s++]<<E,E+=8),m=p[d&T];i:for(;;){if(d>>>=R=m>>>24,E-=R,!(16&(R=m>>>16&255))){if(!(64&R)){m=p[(65535&m)+(d&(1<<R)-1)];continue i}e.msg="invalid distance code",i.mode=30;break e}if(A=65535&m,E<(R&=15)&&(d+=O[s++]<<E,(E+=8)<R&&(d+=O[s++]<<E,E+=8)),c<(A+=d&(1<<R)-1)){e.msg="invalid distance too far back",i.mode=30;break e}if(d>>>=R,E-=R,(R=r-o)<A){if(h<(R=A-R)&&i.sane){e.msg="invalid distance too far back",i.mode=30;break e}if(S=I,(F=0)===u){if(F+=l-R,R<g){for(g-=R;N[r++]=I[F++],--R;);F=r-A,S=N}}else if(u<R){if(F+=l+u-R,(R-=u)<g){for(g-=R;N[r++]=I[F++],--R;);if(F=0,u<g){for(g-=R=u;N[r++]=I[F++],--R;);F=r-A,S=N}}}else if(F+=u-R,R<g){for(g-=R;N[r++]=I[F++],--R;);F=r-A,S=N}for(;2<g;)N[r++]=S[F++],N[r++]=S[F++],N[r++]=S[F++],g-=3;g&&(N[r++]=S[F++],1<g&&(N[r++]=S[F++]))}else{for(F=r-A;N[r++]=N[F++],N[r++]=N[F++],N[r++]=N[F++],2<(g-=3););g&&(N[r++]=N[F++],1<g&&(N[r++]=N[F++]))}break}}break}}while(s<n&&r<a);s-=g=E>>3,d&=(1<<(E-=g<<3))-1,e.next_in=s,e.next_out=r,e.avail_in=s<n?n-s+5:5-(s-n),e.avail_out=r<a?a-r+257:257-(r-a),i.hold=d,i.bits=E}},{}],49:[function(e,t,i){var s=e("../utils/common"),n=e("./adler32"),r=e("./crc32"),o=e("./inffast"),a=e("./inftrees"),c=1,l=2,h=0,u=-2,I=1,d=852,E=592;function f(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function p(){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 s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function C(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=I,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new s.Buf32(d),t.distcode=t.distdyn=new s.Buf32(E),t.sane=1,t.back=-1,h):u}function T(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,C(e)):u}function m(e,t){var i,s;return e&&e.state?(s=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?u:(null!==s.window&&s.wbits!==t&&(s.window=null),s.wrap=i,s.wbits=t,T(e))):u}function R(e,t){var i,s;return e?(s=new p,(e.state=s).window=null,(i=m(e,t))!==h&&(e.state=null),i):u}var g,A,F=!0;function S(e){if(F){var t;for(g=new s.Buf32(512),A=new s.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(c,e.lens,0,288,g,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(l,e.lens,0,32,A,0,e.work,{bits:5}),F=!1}e.lencode=g,e.lenbits=9,e.distcode=A,e.distbits=5}function O(e,t,i,n){var r,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new s.Buf8(o.wsize)),n>=o.wsize?(s.arraySet(o.window,t,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(n<(r=o.wsize-o.wnext)&&(r=n),s.arraySet(o.window,t,i-n,r,o.wnext),(n-=r)?(s.arraySet(o.window,t,i-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=r))),0}i.inflateReset=T,i.inflateReset2=m,i.inflateResetKeep=C,i.inflateInit=function(e){return R(e,15)},i.inflateInit2=R,i.inflate=function(e,t){var i,d,E,p,C,T,m,R,g,A,F,N,y,_,L,P,w,M,v,D,x,b,U,B,V=0,Y=new s.Buf8(4),G=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return u;12===(i=e.state).mode&&(i.mode=13),C=e.next_out,E=e.output,m=e.avail_out,p=e.next_in,d=e.input,T=e.avail_in,R=i.hold,g=i.bits,A=T,F=m,b=h;e:for(;;)switch(i.mode){case I:if(0===i.wrap){i.mode=13;break}for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(2&i.wrap&&35615===R){Y[i.check=0]=255&R,Y[1]=R>>>8&255,i.check=r(i.check,Y,2,0),g=R=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&R)<<8)+(R>>8))%31){e.msg="incorrect header check",i.mode=30;break}if(8!=(15&R)){e.msg="unknown compression method",i.mode=30;break}if(g-=4,x=8+(15&(R>>>=4)),0===i.wbits)i.wbits=x;else if(x>i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1<<x,e.adler=i.check=1,i.mode=512&R?10:12,g=R=0;break;case 2:for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(i.flags=R,8!=(255&i.flags)){e.msg="unknown compression method",i.mode=30;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=30;break}i.head&&(i.head.text=R>>8&1),512&i.flags&&(Y[0]=255&R,Y[1]=R>>>8&255,i.check=r(i.check,Y,2,0)),g=R=0,i.mode=3;case 3:for(;g<32;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.head&&(i.head.time=R),512&i.flags&&(Y[0]=255&R,Y[1]=R>>>8&255,Y[2]=R>>>16&255,Y[3]=R>>>24&255,i.check=r(i.check,Y,4,0)),g=R=0,i.mode=4;case 4:for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.head&&(i.head.xflags=255&R,i.head.os=R>>8),512&i.flags&&(Y[0]=255&R,Y[1]=R>>>8&255,i.check=r(i.check,Y,2,0)),g=R=0,i.mode=5;case 5:if(1024&i.flags){for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.length=R,i.head&&(i.head.extra_len=R),512&i.flags&&(Y[0]=255&R,Y[1]=R>>>8&255,i.check=r(i.check,Y,2,0)),g=R=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(T<(N=i.length)&&(N=T),N&&(i.head&&(x=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),s.arraySet(i.head.extra,d,p,N,x)),512&i.flags&&(i.check=r(i.check,d,N,p)),T-=N,p+=N,i.length-=N),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===T)break e;for(N=0;x=d[p+N++],i.head&&x&&i.length<65536&&(i.head.name+=String.fromCharCode(x)),x&&N<T;);if(512&i.flags&&(i.check=r(i.check,d,N,p)),T-=N,p+=N,x)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===T)break e;for(N=0;x=d[p+N++],i.head&&x&&i.length<65536&&(i.head.comment+=String.fromCharCode(x)),x&&N<T;);if(512&i.flags&&(i.check=r(i.check,d,N,p)),T-=N,p+=N,x)break e}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;g<16;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(R!==(65535&i.check)){e.msg="header crc mismatch",i.mode=30;break}g=R=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=12;break;case 10:for(;g<32;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}e.adler=i.check=f(R),g=R=0,i.mode=11;case 11:if(0===i.havedict)return e.next_out=C,e.avail_out=m,e.next_in=p,e.avail_in=T,i.hold=R,i.bits=g,2;e.adler=i.check=1,i.mode=12;case 12:if(5===t||6===t)break e;case 13:if(i.last){R>>>=7&g,g-=7&g,i.mode=27;break}for(;g<3;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}switch(i.last=1&R,g-=1,3&(R>>>=1)){case 0:i.mode=14;break;case 1:if(S(i),i.mode=20,6!==t)break;R>>>=2,g-=2;break e;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}R>>>=2,g-=2;break;case 14:for(R>>>=7&g,g-=7&g;g<32;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if((65535&R)!=(R>>>16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&R,g=R=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(N=i.length){if(T<N&&(N=T),m<N&&(N=m),0===N)break e;s.arraySet(E,d,p,N,C),T-=N,p+=N,m-=N,C+=N,i.length-=N;break}i.mode=12;break;case 17:for(;g<14;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(i.nlen=257+(31&R),R>>>=5,g-=5,i.ndist=1+(31&R),R>>>=5,g-=5,i.ncode=4+(15&R),R>>>=4,g-=4,286<i.nlen||30<i.ndist){e.msg="too many length or distance symbols",i.mode=30;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;g<3;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.lens[G[i.have++]]=7&R,R>>>=3,g-=3}for(;i.have<19;)i.lens[G[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,U={bits:i.lenbits},b=a(0,i.lens,0,19,i.lencode,0,i.work,U),i.lenbits=U.bits,b){e.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;P=(V=i.lencode[R&(1<<i.lenbits)-1])>>>16&255,w=65535&V,!((L=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(w<16)R>>>=L,g-=L,i.lens[i.have++]=w;else{if(16===w){for(B=L+2;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(R>>>=L,g-=L,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}x=i.lens[i.have-1],N=3+(3&R),R>>>=2,g-=2}else if(17===w){for(B=L+3;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}g-=L,x=0,N=3+(7&(R>>>=L)),R>>>=3,g-=3}else{for(B=L+7;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}g-=L,x=0,N=11+(127&(R>>>=L)),R>>>=7,g-=7}if(i.have+N>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;N--;)i.lens[i.have++]=x}}if(30===i.mode)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,U={bits:i.lenbits},b=a(c,i.lens,0,i.nlen,i.lencode,0,i.work,U),i.lenbits=U.bits,b){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,U={bits:i.distbits},b=a(l,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,U),i.distbits=U.bits,b){e.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(6<=T&&258<=m){e.next_out=C,e.avail_out=m,e.next_in=p,e.avail_in=T,i.hold=R,i.bits=g,o(e,F),C=e.next_out,E=e.output,m=e.avail_out,p=e.next_in,d=e.input,T=e.avail_in,R=i.hold,g=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;P=(V=i.lencode[R&(1<<i.lenbits)-1])>>>16&255,w=65535&V,!((L=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(P&&!(240&P)){for(M=L,v=P,D=w;P=(V=i.lencode[D+((R&(1<<M+v)-1)>>M)])>>>16&255,w=65535&V,!(M+(L=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}R>>>=M,g-=M,i.back+=M}if(R>>>=L,g-=L,i.back+=L,i.length=w,0===P){i.mode=26;break}if(32&P){i.back=-1,i.mode=12;break}if(64&P){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&P,i.mode=22;case 22:if(i.extra){for(B=i.extra;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.length+=R&(1<<i.extra)-1,R>>>=i.extra,g-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;P=(V=i.distcode[R&(1<<i.distbits)-1])>>>16&255,w=65535&V,!((L=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(!(240&P)){for(M=L,v=P,D=w;P=(V=i.distcode[D+((R&(1<<M+v)-1)>>M)])>>>16&255,w=65535&V,!(M+(L=V>>>24)<=g);){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}R>>>=M,g-=M,i.back+=M}if(R>>>=L,g-=L,i.back+=L,64&P){e.msg="invalid distance code",i.mode=30;break}i.offset=w,i.extra=15&P,i.mode=24;case 24:if(i.extra){for(B=i.extra;g<B;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}i.offset+=R&(1<<i.extra)-1,R>>>=i.extra,g-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===m)break e;if(N=F-m,i.offset>N){if((N=i.offset-N)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=30;break}y=N>i.wnext?(N-=i.wnext,i.wsize-N):i.wnext-N,N>i.length&&(N=i.length),_=i.window}else _=E,y=C-i.offset,N=i.length;for(m<N&&(N=m),m-=N,i.length-=N;E[C++]=_[y++],--N;);0===i.length&&(i.mode=21);break;case 26:if(0===m)break e;E[C++]=i.length,m--,i.mode=21;break;case 27:if(i.wrap){for(;g<32;){if(0===T)break e;T--,R|=d[p++]<<g,g+=8}if(F-=m,e.total_out+=F,i.total+=F,F&&(e.adler=i.check=i.flags?r(i.check,E,F,C-F):n(i.check,E,F,C-F)),F=m,(i.flags?R:f(R))!==i.check){e.msg="incorrect data check",i.mode=30;break}g=R=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;g<32;){if(0===T)break e;T--,R+=d[p++]<<g,g+=8}if(R!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=30;break}g=R=0}i.mode=29;case 29:b=1;break e;case 30:b=-3;break e;case 31:return-4;default:return u}return e.next_out=C,e.avail_out=m,e.next_in=p,e.avail_in=T,i.hold=R,i.bits=g,(i.wsize||F!==e.avail_out&&i.mode<30&&(i.mode<27||4!==t))&&O(e,e.output,e.next_out,F-e.avail_out)?(i.mode=31,-4):(A-=e.avail_in,F-=e.avail_out,e.total_in+=A,e.total_out+=F,i.total+=F,i.wrap&&F&&(e.adler=i.check=i.flags?r(i.check,E,F,e.next_out-F):n(i.check,E,F,e.next_out-F)),e.data_type=i.bits+(i.last?64:0)+(12===i.mode?128:0)+(20===i.mode||15===i.mode?256:0),(0==A&&0===F||4===t)&&b===h&&(b=-5),b)},i.inflateEnd=function(e){if(!e||!e.state)return u;var t=e.state;return t.window&&(t.window=null),e.state=null,h},i.inflateGetHeader=function(e,t){var i;return e&&e.state&&2&(i=e.state).wrap?((i.head=t).done=!1,h):u},i.inflateSetDictionary=function(e,t){var i,s=t.length;return e&&e.state?0!==(i=e.state).wrap&&11!==i.mode?u:11===i.mode&&n(1,t,s,0)!==i.check?-3:O(e,t,s,s)?(i.mode=31,-4):(i.havedict=1,h):u},i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,i){var s=e("../utils/common"),n=[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],r=[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],o=[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],a=[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];t.exports=function(e,t,i,c,l,h,u,I){var d,E,f,p,C,T,m,R,g,A=I.bits,F=0,S=0,O=0,N=0,y=0,_=0,L=0,P=0,w=0,M=0,v=null,D=0,x=new s.Buf16(16),b=new s.Buf16(16),U=null,B=0;for(F=0;F<=15;F++)x[F]=0;for(S=0;S<c;S++)x[t[i+S]]++;for(y=A,N=15;1<=N&&0===x[N];N--);if(N<y&&(y=N),0===N)return l[h++]=20971520,l[h++]=20971520,I.bits=1,0;for(O=1;O<N&&0===x[O];O++);for(y<O&&(y=O),F=P=1;F<=15;F++)if(P<<=1,(P-=x[F])<0)return-1;if(0<P&&(0===e||1!==N))return-1;for(b[1]=0,F=1;F<15;F++)b[F+1]=b[F]+x[F];for(S=0;S<c;S++)0!==t[i+S]&&(u[b[t[i+S]]++]=S);if(T=0===e?(v=U=u,19):1===e?(v=n,D-=257,U=r,B-=257,256):(v=o,U=a,-1),F=O,C=h,L=S=M=0,f=-1,p=(w=1<<(_=y))-1,1===e&&852<w||2===e&&592<w)return 1;for(;;){for(m=F-L,g=u[S]<T?(R=0,u[S]):u[S]>T?(R=U[B+u[S]],v[D+u[S]]):(R=96,0),d=1<<F-L,O=E=1<<_;l[C+(M>>L)+(E-=d)]=m<<24|R<<16|g,0!==E;);for(d=1<<F-1;M&d;)d>>=1;if(0!==d?(M&=d-1,M+=d):M=0,S++,0==--x[F]){if(F===N)break;F=t[i+u[S]]}if(y<F&&(M&p)!==f){for(0===L&&(L=y),C+=O,P=1<<(_=F-L);_+L<N&&!((P-=x[_+L])<=0);)_++,P<<=1;if(w+=1<<_,1===e&&852<w||2===e&&592<w)return 1;l[f=M&p]=y<<24|_<<16|C-h}}return 0!==M&&(l[C+M]=F-L<<24|64<<16),I.bits=y,0}},{"../utils/common":41}],51:[function(e,t,i){t.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(e,t,i){var s=e("../utils/common"),n=0,r=1;function o(e){for(var t=e.length;0<=--t;)e[t]=0}var a=0,c=29,l=256,h=l+1+c,u=30,I=19,d=2*h+1,E=15,f=16,p=7,C=256,T=16,m=17,R=18,g=[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],A=[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],S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],O=new Array(2*(h+2));o(O);var N=new Array(2*u);o(N);var y=new Array(512);o(y);var _=new Array(256);o(_);var L=new Array(c);o(L);var P,w,M,v=new Array(u);function D(e,t,i,s,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=s,this.max_length=n,this.has_stree=e&&e.length}function x(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function b(e){return e<256?y[e]:y[256+(e>>>7)]}function U(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function B(e,t,i){e.bi_valid>f-i?(e.bi_buf|=t<<e.bi_valid&65535,U(e,e.bi_buf),e.bi_buf=t>>f-e.bi_valid,e.bi_valid+=i-f):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function V(e,t,i){B(e,i[2*t],i[2*t+1])}function Y(e,t){for(var i=0;i|=1&e,e>>>=1,i<<=1,0<--t;);return i>>>1}function G(e,t,i){var s,n,r=new Array(E+1),o=0;for(s=1;s<=E;s++)r[s]=o=o+i[s-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=Y(r[a]++,a))}}function z(e){var t;for(t=0;t<h;t++)e.dyn_ltree[2*t]=0;for(t=0;t<u;t++)e.dyn_dtree[2*t]=0;for(t=0;t<I;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*C]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function k(e){8<e.bi_valid?U(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function H(e,t,i,s){var n=2*t,r=2*i;return e[n]<e[r]||e[n]===e[r]&&s[t]<=s[i]}function W(e,t,i){for(var s=e.heap[i],n=i<<1;n<=e.heap_len&&(n<e.heap_len&&H(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!H(t,s,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=s}function X(e,t,i){var s,n,r,o,a=0;if(0!==e.last_lit)for(;s=e.pending_buf[e.d_buf+2*a]<<8|e.pending_buf[e.d_buf+2*a+1],n=e.pending_buf[e.l_buf+a],a++,0===s?V(e,n,t):(V(e,(r=_[n])+l+1,t),0!==(o=g[r])&&B(e,n-=L[r],o),V(e,r=b(--s),i),0!==(o=A[r])&&B(e,s-=v[r],o)),a<e.last_lit;);V(e,C,t)}function Z(e,t){var i,s,n,r=t.dyn_tree,o=t.stat_desc.static_tree,a=t.stat_desc.has_stree,c=t.stat_desc.elems,l=-1;for(e.heap_len=0,e.heap_max=d,i=0;i<c;i++)0!==r[2*i]?(e.heap[++e.heap_len]=l=i,e.depth[i]=0):r[2*i+1]=0;for(;e.heap_len<2;)r[2*(n=e.heap[++e.heap_len]=l<2?++l:0)]=1,e.depth[n]=0,e.opt_len--,a&&(e.static_len-=o[2*n+1]);for(t.max_code=l,i=e.heap_len>>1;1<=i;i--)W(e,r,i);for(n=c;i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],W(e,r,1),s=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=s,r[2*n]=r[2*i]+r[2*s],e.depth[n]=(e.depth[i]>=e.depth[s]?e.depth[i]:e.depth[s])+1,r[2*i+1]=r[2*s+1]=n,e.heap[1]=n++,W(e,r,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,s,n,r,o,a,c=t.dyn_tree,l=t.max_code,h=t.stat_desc.static_tree,u=t.stat_desc.has_stree,I=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,p=t.stat_desc.max_length,C=0;for(r=0;r<=E;r++)e.bl_count[r]=0;for(c[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<d;i++)p<(r=c[2*c[2*(s=e.heap[i])+1]+1]+1)&&(r=p,C++),c[2*s+1]=r,l<s||(e.bl_count[r]++,o=0,f<=s&&(o=I[s-f]),a=c[2*s],e.opt_len+=a*(r+o),u&&(e.static_len+=a*(h[2*s+1]+o)));if(0!==C){do{for(r=p-1;0===e.bl_count[r];)r--;e.bl_count[r]--,e.bl_count[r+1]+=2,e.bl_count[p]--,C-=2}while(0<C);for(r=p;0!==r;r--)for(s=e.bl_count[r];0!==s;)l<(n=e.heap[--i])||(c[2*n+1]!==r&&(e.opt_len+=(r-c[2*n+1])*c[2*n],c[2*n+1]=r),s--)}}(e,t),G(r,l,e.bl_count)}function j(e,t,i){var s,n,r=-1,o=t[1],a=0,c=7,l=4;for(0===o&&(c=138,l=3),t[2*(i+1)+1]=65535,s=0;s<=i;s++)n=o,o=t[2*(s+1)+1],++a<c&&n===o||(a<l?e.bl_tree[2*n]+=a:0!==n?(n!==r&&e.bl_tree[2*n]++,e.bl_tree[2*T]++):a<=10?e.bl_tree[2*m]++:e.bl_tree[2*R]++,r=n,l=(a=0)===o?(c=138,3):n===o?(c=6,3):(c=7,4))}function $(e,t,i){var s,n,r=-1,o=t[1],a=0,c=7,l=4;for(0===o&&(c=138,l=3),s=0;s<=i;s++)if(n=o,o=t[2*(s+1)+1],!(++a<c&&n===o)){if(a<l)for(;V(e,n,e.bl_tree),0!=--a;);else 0!==n?(n!==r&&(V(e,n,e.bl_tree),a--),V(e,T,e.bl_tree),B(e,a-3,2)):a<=10?(V(e,m,e.bl_tree),B(e,a-3,3)):(V(e,R,e.bl_tree),B(e,a-11,7));r=n,l=(a=0)===o?(c=138,3):n===o?(c=6,3):(c=7,4)}}o(v);var Q=!1;function q(e,t,i,n){var r,o,c;B(e,(a<<1)+(n?1:0),3),o=t,c=i,k(r=e),U(r,c),U(r,~c),s.arraySet(r.pending_buf,r.window,o,c,r.pending),r.pending+=c}i._tr_init=function(e){Q||(function(){var e,t,i,s,n,r=new Array(E+1);for(s=i=0;s<c-1;s++)for(L[s]=i,e=0;e<1<<g[s];e++)_[i++]=s;for(_[i-1]=s,s=n=0;s<16;s++)for(v[s]=n,e=0;e<1<<A[s];e++)y[n++]=s;for(n>>=7;s<u;s++)for(v[s]=n<<7,e=0;e<1<<A[s]-7;e++)y[256+n++]=s;for(t=0;t<=E;t++)r[t]=0;for(e=0;e<=143;)O[2*e+1]=8,e++,r[8]++;for(;e<=255;)O[2*e+1]=9,e++,r[9]++;for(;e<=279;)O[2*e+1]=7,e++,r[7]++;for(;e<=287;)O[2*e+1]=8,e++,r[8]++;for(G(O,h+1,r),e=0;e<u;e++)N[2*e+1]=5,N[2*e]=Y(e,5);P=new D(O,g,l+1,h,E),w=new D(N,A,0,u,E),M=new D(new Array(0),F,0,I,p)}(),Q=!0),e.l_desc=new x(e.dyn_ltree,P),e.d_desc=new x(e.dyn_dtree,w),e.bl_desc=new x(e.bl_tree,M),e.bi_buf=0,e.bi_valid=0,z(e)},i._tr_stored_block=q,i._tr_flush_block=function(e,t,i,s){var o,a,c=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return n;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return r;for(t=32;t<l;t++)if(0!==e.dyn_ltree[2*t])return r;return n}(e)),Z(e,e.l_desc),Z(e,e.d_desc),c=function(e){var t;for(j(e,e.dyn_ltree,e.l_desc.max_code),j(e,e.dyn_dtree,e.d_desc.max_code),Z(e,e.bl_desc),t=I-1;3<=t&&0===e.bl_tree[2*S[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),o=e.opt_len+3+7>>>3,(a=e.static_len+3+7>>>3)<=o&&(o=a)):o=a=i+5,i+4<=o&&-1!==t?q(e,t,i,s):4===e.strategy||a===o?(B(e,2+(s?1:0),3),X(e,O,N)):(B(e,4+(s?1:0),3),function(e,t,i,s){var n;for(B(e,t-257,5),B(e,i-1,5),B(e,s-4,4),n=0;n<s;n++)B(e,e.bl_tree[2*S[n]+1],3);$(e,e.dyn_ltree,t-1),$(e,e.dyn_dtree,i-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,c+1),X(e,e.dyn_ltree,e.dyn_dtree)),z(e),s&&k(e)},i._tr_tally=function(e,t,i){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(_[i]+l+1)]++,e.dyn_dtree[2*b(t)]++),e.last_lit===e.lit_bufsize-1},i._tr_align=function(e){var t;B(e,2,3),V(e,C,O),16===(t=e).bi_valid?(U(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},{"../utils/common":41}],53:[function(e,t,i){t.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(e,t,i){(function(e){!function(e,t){if(!e.setImmediate){var i,s,n,r,o=1,a={},c=!1,l=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,i="[object process]"==={}.toString.call(e.process)?function(e){process.nextTick((function(){I(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,i=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=i,t}}()?(r="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",d,!1):e.attachEvent("onmessage",d),function(t){e.postMessage(r+t,"*")}):e.MessageChannel?((n=new MessageChannel).port1.onmessage=function(e){I(e.data)},function(e){n.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(s=l.documentElement,function(e){var t=l.createElement("script");t.onreadystatechange=function(){I(e),t.onreadystatechange=null,s.removeChild(t),t=null},s.appendChild(t)}):function(e){setTimeout(I,0,e)},h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),s=0;s<t.length;s++)t[s]=arguments[s+1];var n={callback:e,args:t};return a[o]=n,i(o),o++},h.clearImmediate=u}function u(e){delete a[e]}function I(e){if(c)setTimeout(I,0,e);else{var i=a[e];if(i){c=!0;try{!function(e){var i=e.callback,s=e.args;switch(s.length){case 0:i();break;case 1:i(s[0]);break;case 2:i(s[0],s[1]);break;case 3:i(s[0],s[1],s[2]);break;default:i.apply(t,s)}}(i)}finally{u(e),c=!1}}}}function d(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(r)&&I(+t.data.slice(r.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,void 0!==di?di:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10));var wr={},Mr={};!function(e){const t=":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",i="["+t+"]["+(t+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040")+"]*",s=new RegExp("^"+i+"$");e.isExist=function(e){return void 0!==e},e.isEmptyObject=function(e){return 0===Object.keys(e).length},e.merge=function(e,t,i){if(t){const s=Object.keys(t),n=s.length;for(let r=0;r<n;r++)e[s[r]]="strict"===i?[t[s[r]]]:t[s[r]]}},e.getValue=function(t){return e.isExist(t)?t:""},e.isName=function(e){const t=s.exec(e);return!(null==t)},e.getAllMatches=function(e,t){const i=[];let s=t.exec(e);for(;s;){const n=[];n.startIndex=t.lastIndex-s[0].length;const r=s.length;for(let e=0;e<r;e++)n.push(s[e]);i.push(n),s=t.exec(e)}return i},e.nameRegexp=i}(Mr);const vr=Mr,Dr={allowBooleanAttributes:!1,unpairedTags:[]};function xr(e){return" "===e||"\t"===e||"\n"===e||"\r"===e}function br(e,t){const i=t;for(;t<e.length;t++)if("?"!=e[t]&&" "!=e[t]);else{const s=e.substr(i,t-i);if(t>5&&"xml"===s)return Hr("InvalidXml","XML declaration allowed only at the start of the document.",Xr(e,t));if("?"==e[t]&&">"==e[t+1]){t++;break}}return t}function Ur(e,t){if(e.length>t+5&&"-"===e[t+1]&&"-"===e[t+2]){for(t+=3;t<e.length;t++)if("-"===e[t]&&"-"===e[t+1]&&">"===e[t+2]){t+=2;break}}else if(e.length>t+8&&"D"===e[t+1]&&"O"===e[t+2]&&"C"===e[t+3]&&"T"===e[t+4]&&"Y"===e[t+5]&&"P"===e[t+6]&&"E"===e[t+7]){let i=1;for(t+=8;t<e.length;t++)if("<"===e[t])i++;else if(">"===e[t]&&(i--,0===i))break}else if(e.length>t+9&&"["===e[t+1]&&"C"===e[t+2]&&"D"===e[t+3]&&"A"===e[t+4]&&"T"===e[t+5]&&"A"===e[t+6]&&"["===e[t+7])for(t+=8;t<e.length;t++)if("]"===e[t]&&"]"===e[t+1]&&">"===e[t+2]){t+=2;break}return t}wr.validate=function(e,t){t=Object.assign({},Dr,t);const i=[];let s=!1,n=!1;"\ufeff"===e[0]&&(e=e.substr(1));for(let o=0;o<e.length;o++)if("<"===e[o]&&"?"===e[o+1]){if(o+=2,o=br(e,o),o.err)return o}else{if("<"!==e[o]){if(xr(e[o]))continue;return Hr("InvalidChar","char '"+e[o]+"' is not expected.",Xr(e,o))}{let a=o;if(o++,"!"===e[o]){o=Ur(e,o);continue}{let c=!1;"/"===e[o]&&(c=!0,o++);let l="";for(;o<e.length&&">"!==e[o]&&" "!==e[o]&&"\t"!==e[o]&&"\n"!==e[o]&&"\r"!==e[o];o++)l+=e[o];if(l=l.trim(),"/"===l[l.length-1]&&(l=l.substring(0,l.length-1),o--),r=l,!vr.isName(r)){let t;return t=0===l.trim().length?"Invalid space after '<'.":"Tag '"+l+"' is an invalid name.",Hr("InvalidTag",t,Xr(e,o))}const h=Yr(e,o);if(!1===h)return Hr("InvalidAttr","Attributes for '"+l+"' have open quote.",Xr(e,o));let u=h.value;if(o=h.index,"/"===u[u.length-1]){const i=o-u.length;u=u.substring(0,u.length-1);const n=zr(u,t);if(!0!==n)return Hr(n.err.code,n.err.msg,Xr(e,i+n.err.line));s=!0}else if(c){if(!h.tagClosed)return Hr("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",Xr(e,o));if(u.trim().length>0)return Hr("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",Xr(e,a));if(0===i.length)return Hr("InvalidTag","Closing tag '"+l+"' has not been opened.",Xr(e,a));{const t=i.pop();if(l!==t.tagName){let i=Xr(e,t.tagStartPos);return Hr("InvalidTag","Expected closing tag '"+t.tagName+"' (opened in line "+i.line+", col "+i.col+") instead of closing tag '"+l+"'.",Xr(e,a))}0==i.length&&(n=!0)}}else{const r=zr(u,t);if(!0!==r)return Hr(r.err.code,r.err.msg,Xr(e,o-u.length+r.err.line));if(!0===n)return Hr("InvalidXml","Multiple possible root nodes found.",Xr(e,o));-1!==t.unpairedTags.indexOf(l)||i.push({tagName:l,tagStartPos:a}),s=!0}for(o++;o<e.length;o++)if("<"===e[o]){if("!"===e[o+1]){o++,o=Ur(e,o);continue}if("?"!==e[o+1])break;if(o=br(e,++o),o.err)return o}else if("&"===e[o]){const t=kr(e,o);if(-1==t)return Hr("InvalidChar","char '&' is not expected.",Xr(e,o));o=t}else if(!0===n&&!xr(e[o]))return Hr("InvalidXml","Extra text at the end",Xr(e,o));"<"===e[o]&&o--}}}var r;return s?1==i.length?Hr("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",Xr(e,i[0].tagStartPos)):!(i.length>0)||Hr("InvalidXml","Invalid '"+JSON.stringify(i.map((e=>e.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):Hr("InvalidXml","Start tag expected.",1)};const Br='"',Vr="'";function Yr(e,t){let i="",s="",n=!1;for(;t<e.length;t++){if(e[t]===Br||e[t]===Vr)""===s?s=e[t]:s!==e[t]||(s="");else if(">"===e[t]&&""===s){n=!0;break}i+=e[t]}return""===s&&{value:i,index:t,tagClosed:n}}const Gr=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function zr(e,t){const i=vr.getAllMatches(e,Gr),s={};for(let e=0;e<i.length;e++){if(0===i[e][1].length)return Hr("InvalidAttr","Attribute '"+i[e][2]+"' has no space in starting.",Zr(i[e]));if(void 0!==i[e][3]&&void 0===i[e][4])return Hr("InvalidAttr","Attribute '"+i[e][2]+"' is without value.",Zr(i[e]));if(void 0===i[e][3]&&!t.allowBooleanAttributes)return Hr("InvalidAttr","boolean attribute '"+i[e][2]+"' is not allowed.",Zr(i[e]));const n=i[e][2];if(!Wr(n))return Hr("InvalidAttr","Attribute '"+n+"' is an invalid name.",Zr(i[e]));if(s.hasOwnProperty(n))return Hr("InvalidAttr","Attribute '"+n+"' is repeated.",Zr(i[e]));s[n]=1}return!0}function kr(e,t){if(";"===e[++t])return-1;if("#"===e[t])return function(e,t){let i=/\d/;for("x"===e[t]&&(t++,i=/[\da-fA-F]/);t<e.length;t++){if(";"===e[t])return t;if(!e[t].match(i))break}return-1}(e,++t);let i=0;for(;t<e.length;t++,i++)if(!(e[t].match(/\w/)&&i<20)){if(";"===e[t])break;return-1}return t}function Hr(e,t,i){return{err:{code:e,msg:t,line:i.line||i,col:i.col}}}function Wr(e){return vr.isName(e)}function Xr(e,t){const i=e.substring(0,t).split(/\r?\n/);return{line:i.length,col:i[i.length-1].length+1}}function Zr(e){return e.startIndex+e[1].length}var jr={};const $r={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(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,i){return e}};jr.buildOptions=function(e){return Object.assign({},$r,e)},jr.defaultOptions=$r;var Qr=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){"__proto__"===e&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){"__proto__"===e.tagname&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}};const qr=Mr;function Kr(e,t){let i="";for(;t<e.length&&"'"!==e[t]&&'"'!==e[t];t++)i+=e[t];if(i=i.trim(),-1!==i.indexOf(" "))throw new Error("External entites are not supported");const s=e[t++];let n="";for(;t<e.length&&e[t]!==s;t++)n+=e[t];return[i,n,t]}function Jr(e,t){return"!"===e[t+1]&&"-"===e[t+2]&&"-"===e[t+3]}function eo(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"N"===e[t+3]&&"T"===e[t+4]&&"I"===e[t+5]&&"T"===e[t+6]&&"Y"===e[t+7]}function to(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"L"===e[t+3]&&"E"===e[t+4]&&"M"===e[t+5]&&"E"===e[t+6]&&"N"===e[t+7]&&"T"===e[t+8]}function io(e,t){return"!"===e[t+1]&&"A"===e[t+2]&&"T"===e[t+3]&&"T"===e[t+4]&&"L"===e[t+5]&&"I"===e[t+6]&&"S"===e[t+7]&&"T"===e[t+8]}function so(e,t){return"!"===e[t+1]&&"N"===e[t+2]&&"O"===e[t+3]&&"T"===e[t+4]&&"A"===e[t+5]&&"T"===e[t+6]&&"I"===e[t+7]&&"O"===e[t+8]&&"N"===e[t+9]}function no(e){if(qr.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}var ro=function(e,t){const i={};if("O"!==e[t+3]||"C"!==e[t+4]||"T"!==e[t+5]||"Y"!==e[t+6]||"P"!==e[t+7]||"E"!==e[t+8])throw new Error("Invalid Tag instead of DOCTYPE");{t+=9;let s=1,n=!1,r=!1,o="";for(;t<e.length;t++)if("<"!==e[t]||r)if(">"===e[t]){if(r?"-"===e[t-1]&&"-"===e[t-2]&&(r=!1,s--):s--,0===s)break}else"["===e[t]?n=!0:o+=e[t];else{if(n&&eo(e,t))t+=7,[entityName,val,t]=Kr(e,t+1),-1===val.indexOf("&")&&(i[no(entityName)]={regx:RegExp(`&${entityName};`,"g"),val:val});else if(n&&to(e,t))t+=8;else if(n&&io(e,t))t+=8;else if(n&&so(e,t))t+=9;else{if(!Jr)throw new Error("Invalid DOCTYPE");r=!0}s++,o=""}if(0!==s)throw new Error("Unclosed DOCTYPE")}return{entities:i,i:t}};const oo=/^[-+]?0x[a-fA-F0-9]+$/,ao=/^([\-\+])?(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 co={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};const lo=Mr,ho=Qr,uo=ro,Io=function(e,t={}){if(t=Object.assign({},co,t),!e||"string"!=typeof e)return e;let i=e.trim();if(void 0!==t.skipLike&&t.skipLike.test(i))return e;if(t.hex&&oo.test(i))return Number.parseInt(i,16);{const s=ao.exec(i);if(s){const n=s[1],r=s[2];let o=function(e){if(e&&-1!==e.indexOf("."))return"."===(e=e.replace(/0+$/,""))?e="0":"."===e[0]?e="0"+e:"."===e[e.length-1]&&(e=e.substr(0,e.length-1)),e;return e}(s[3]);const a=s[4]||s[6];if(!t.leadingZeros&&r.length>0&&n&&"."!==i[2])return e;if(!t.leadingZeros&&r.length>0&&!n&&"."!==i[1])return e;{const s=Number(i),c=""+s;return-1!==c.search(/[eE]/)||a?t.eNotation?s:e:-1!==i.indexOf(".")?"0"===c&&""===o||c===o||n&&c==="-"+o?s:e:r?o===c||n+o===c?s:e:i===c||i===n+c?s:e}}return e}};function Eo(e){const t=Object.keys(e);for(let i=0;i<t.length;i++){const s=t[i];this.lastEntities[s]={regex:new RegExp("&"+s+";","g"),val:e[s]}}}function fo(e,t,i,s,n,r,o){if(void 0!==e&&(this.options.trimValues&&!s&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e));const s=this.options.tagValueProcessor(t,e,i,n,r);if(null==s)return e;if(typeof s!=typeof e||s!==e)return s;if(this.options.trimValues)return yo(e,this.options.parseTagValue,this.options.numberParseOptions);return e.trim()===e?yo(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function po(e){if(this.options.removeNSPrefix){const t=e.split(":"),i="/"===e.charAt(0)?"/":"";if("xmlns"===t[0])return"";2===t.length&&(e=i+t[1])}return e}const Co=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function To(e,t,i){if(!this.options.ignoreAttributes&&"string"==typeof e){const i=lo.getAllMatches(e,Co),s=i.length,n={};for(let e=0;e<s;e++){const s=this.resolveNameSpace(i[e][1]);let r=i[e][4],o=this.options.attributeNamePrefix+s;if(s.length)if(this.options.transformAttributeName&&(o=this.options.transformAttributeName(o)),"__proto__"===o&&(o="#__proto__"),void 0!==r){this.options.trimValues&&(r=r.trim()),r=this.replaceEntitiesValue(r);const e=this.options.attributeValueProcessor(s,r,t);n[o]=null==e?r:typeof e!=typeof r||e!==r?e:yo(r,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(n[o]=!0)}if(!Object.keys(n).length)return;if(this.options.attributesGroupName){const e={};return e[this.options.attributesGroupName]=n,e}return n}}const mo=function(e){e=e.replace(/\r\n?/g,"\n");const t=new ho("!xml");let i=t,s="",n="";for(let r=0;r<e.length;r++){if("<"===e[r])if("/"===e[r+1]){const t=So(e,">",r,"Closing Tag is not closed.");let o=e.substring(r+2,t).trim();if(this.options.removeNSPrefix){const e=o.indexOf(":");-1!==e&&(o=o.substr(e+1))}this.options.transformTagName&&(o=this.options.transformTagName(o)),i&&(s=this.saveTextToParentTag(s,i,n));const a=n.substring(n.lastIndexOf(".")+1);if(o&&-1!==this.options.unpairedTags.indexOf(o))throw new Error(`Unpaired tag can not be used as closing tag: </${o}>`);let c=0;a&&-1!==this.options.unpairedTags.indexOf(a)?(c=n.lastIndexOf(".",n.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=n.lastIndexOf("."),n=n.substring(0,c),i=this.tagsNodeStack.pop(),s="",r=t}else if("?"===e[r+1]){let t=Oo(e,r,!1,"?>");if(!t)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,i,n),this.options.ignoreDeclaration&&"?xml"===t.tagName||this.options.ignorePiTags);else{const e=new ho(t.tagName);e.add(this.options.textNodeName,""),t.tagName!==t.tagExp&&t.attrExpPresent&&(e[":@"]=this.buildAttributesMap(t.tagExp,n,t.tagName)),this.addChild(i,e,n)}r=t.closeIndex+1}else if("!--"===e.substr(r+1,3)){const t=So(e,"--\x3e",r+4,"Comment is not closed.");if(this.options.commentPropName){const o=e.substring(r+4,t-2);s=this.saveTextToParentTag(s,i,n),i.add(this.options.commentPropName,[{[this.options.textNodeName]:o}])}r=t}else if("!D"===e.substr(r+1,2)){const t=uo(e,r);this.docTypeEntities=t.entities,r=t.i}else if("!["===e.substr(r+1,2)){const t=So(e,"]]>",r,"CDATA is not closed.")-2,o=e.substring(r+9,t);s=this.saveTextToParentTag(s,i,n);let a=this.parseTextData(o,i.tagname,n,!0,!1,!0,!0);null==a&&(a=""),this.options.cdataPropName?i.add(this.options.cdataPropName,[{[this.options.textNodeName]:o}]):i.add(this.options.textNodeName,a),r=t+2}else{let o=Oo(e,r,this.options.removeNSPrefix),a=o.tagName;const c=o.rawTagName;let l=o.tagExp,h=o.attrExpPresent,u=o.closeIndex;this.options.transformTagName&&(a=this.options.transformTagName(a)),i&&s&&"!xml"!==i.tagname&&(s=this.saveTextToParentTag(s,i,n,!1));const I=i;if(I&&-1!==this.options.unpairedTags.indexOf(I.tagname)&&(i=this.tagsNodeStack.pop(),n=n.substring(0,n.lastIndexOf("."))),a!==t.tagname&&(n+=n?"."+a:a),this.isItStopNode(this.options.stopNodes,n,a)){let t="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)"/"===a[a.length-1]?(a=a.substr(0,a.length-1),n=n.substr(0,n.length-1),l=a):l=l.substr(0,l.length-1),r=o.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(a))r=o.closeIndex;else{const i=this.readStopNodeData(e,c,u+1);if(!i)throw new Error(`Unexpected end of ${c}`);r=i.i,t=i.tagContent}const s=new ho(a);a!==l&&h&&(s[":@"]=this.buildAttributesMap(l,n,a)),t&&(t=this.parseTextData(t,a,n,!0,h,!0,!0)),n=n.substr(0,n.lastIndexOf(".")),s.add(this.options.textNodeName,t),this.addChild(i,s,n)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===a[a.length-1]?(a=a.substr(0,a.length-1),n=n.substr(0,n.length-1),l=a):l=l.substr(0,l.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));const e=new ho(a);a!==l&&h&&(e[":@"]=this.buildAttributesMap(l,n,a)),this.addChild(i,e,n),n=n.substr(0,n.lastIndexOf("."))}else{const e=new ho(a);this.tagsNodeStack.push(i),a!==l&&h&&(e[":@"]=this.buildAttributesMap(l,n,a)),this.addChild(i,e,n),i=e}s="",r=u}}else s+=e[r]}return t.child};function Ro(e,t,i){const s=this.options.updateTag(t.tagname,i,t[":@"]);!1===s||("string"==typeof s?(t.tagname=s,e.addChild(t)):e.addChild(t))}const go=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const i=this.docTypeEntities[t];e=e.replace(i.regx,i.val)}for(let t in this.lastEntities){const i=this.lastEntities[t];e=e.replace(i.regex,i.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const i=this.htmlEntities[t];e=e.replace(i.regex,i.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function Ao(e,t,i,s){return e&&(void 0===s&&(s=0===Object.keys(t.child).length),void 0!==(e=this.parseTextData(e,t.tagname,i,!1,!!t[":@"]&&0!==Object.keys(t[":@"]).length,s))&&""!==e&&t.add(this.options.textNodeName,e),e=""),e}function Fo(e,t,i){const s="*."+i;for(const i in e){const n=e[i];if(s===n||t===n)return!0}return!1}function So(e,t,i,s){const n=e.indexOf(t,i);if(-1===n)throw new Error(s);return n+t.length-1}function Oo(e,t,i,s=">"){const n=function(e,t,i=">"){let s,n="";for(let r=t;r<e.length;r++){let t=e[r];if(s)t===s&&(s="");else if('"'===t||"'"===t)s=t;else if(t===i[0]){if(!i[1])return{data:n,index:r};if(e[r+1]===i[1])return{data:n,index:r}}else"\t"===t&&(t=" ");n+=t}}(e,t+1,s);if(!n)return;let r=n.data;const o=n.index,a=r.search(/\s/);let c=r,l=!0;-1!==a&&(c=r.substring(0,a),r=r.substring(a+1).trimStart());const h=c;if(i){const e=c.indexOf(":");-1!==e&&(c=c.substr(e+1),l=c!==n.data.substr(e+1))}return{tagName:c,tagExp:r,closeIndex:o,attrExpPresent:l,rawTagName:h}}function No(e,t,i){const s=i;let n=1;for(;i<e.length;i++)if("<"===e[i])if("/"===e[i+1]){const r=So(e,">",i,`${t} is not closed`);if(e.substring(i+2,r).trim()===t&&(n--,0===n))return{tagContent:e.substring(s,i),i:r};i=r}else if("?"===e[i+1]){i=So(e,"?>",i+1,"StopNode is not closed.")}else if("!--"===e.substr(i+1,3)){i=So(e,"--\x3e",i+3,"StopNode is not closed.")}else if("!["===e.substr(i+1,2)){i=So(e,"]]>",i,"StopNode is not closed.")-2}else{const s=Oo(e,i,">");if(s){(s&&s.tagName)===t&&"/"!==s.tagExp[s.tagExp.length-1]&&n++,i=s.closeIndex}}}function yo(e,t,i){if(t&&"string"==typeof e){const t=e.trim();return"true"===t||"false"!==t&&Io(e,i)}return lo.isExist(e)?e:""}var _o=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:(e,t)=>String.fromCharCode(Number.parseInt(t,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,16))}},this.addExternalEntities=Eo,this.parseXml=mo,this.parseTextData=fo,this.resolveNameSpace=po,this.buildAttributesMap=To,this.isItStopNode=Fo,this.replaceEntitiesValue=go,this.readStopNodeData=No,this.saveTextToParentTag=Ao,this.addChild=Ro}},Lo={};function Po(e,t,i){let s;const n={};for(let r=0;r<e.length;r++){const o=e[r],a=wo(o);let c="";if(c=void 0===i?a:i+"."+a,a===t.textNodeName)void 0===s?s=o[a]:s+=""+o[a];else{if(void 0===a)continue;if(o[a]){let e=Po(o[a],t,c);const i=vo(e,t);o[":@"]?Mo(e,o[":@"],c,t):1!==Object.keys(e).length||void 0===e[t.textNodeName]||t.alwaysCreateTextNode?0===Object.keys(e).length&&(t.alwaysCreateTextNode?e[t.textNodeName]="":e=""):e=e[t.textNodeName],void 0!==n[a]&&n.hasOwnProperty(a)?(Array.isArray(n[a])||(n[a]=[n[a]]),n[a].push(e)):t.isArray(a,c,i)?n[a]=[e]:n[a]=e}}}return"string"==typeof s?s.length>0&&(n[t.textNodeName]=s):void 0!==s&&(n[t.textNodeName]=s),n}function wo(e){const t=Object.keys(e);for(let e=0;e<t.length;e++){const i=t[e];if(":@"!==i)return i}}function Mo(e,t,i,s){if(t){const n=Object.keys(t),r=n.length;for(let o=0;o<r;o++){const r=n[o];s.isArray(r,i+"."+r,!0,!0)?e[r]=[t[r]]:e[r]=t[r]}}}function vo(e,t){const{textNodeName:i}=t,s=Object.keys(e).length;return 0===s||!(1!==s||!e[i]&&"boolean"!=typeof e[i]&&0!==e[i])}Lo.prettify=function(e,t){return Po(e,t)};const{buildOptions:Do}=jr,xo=_o,{prettify:bo}=Lo,Uo=wr;var Bo=class{constructor(e){this.externalEntities={},this.options=Do(e)}parse(e,t){if("string"==typeof e);else{if(!e.toString)throw new Error("XML data is accepted in String or Bytes[] form.");e=e.toString()}if(t){!0===t&&(t={});const i=Uo.validate(e,t);if(!0!==i)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const i=new xo(this.options);i.addExternalEntities(this.externalEntities);const s=i.parseXml(e);return this.options.preserveOrder||void 0===s?s:bo(s,this.options)}addEntity(e,t){if(-1!==t.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==e.indexOf("&")||-1!==e.indexOf(";"))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}};function Vo(e,t,i,s){let n="",r=!1;for(let o=0;o<e.length;o++){const a=e[o],c=Yo(a);if(void 0===c)continue;let l="";if(l=0===i.length?c:`${i}.${c}`,c===t.textNodeName){let e=a[c];zo(l,t)||(e=t.tagValueProcessor(c,e),e=ko(e,t)),r&&(n+=s),n+=e,r=!1;continue}if(c===t.cdataPropName){r&&(n+=s),n+=`<![CDATA[${a[c][0][t.textNodeName]}]]>`,r=!1;continue}if(c===t.commentPropName){n+=s+`\x3c!--${a[c][0][t.textNodeName]}--\x3e`,r=!0;continue}if("?"===c[0]){const e=Go(a[":@"],t),i="?xml"===c?"":s;let o=a[c][0][t.textNodeName];o=0!==o.length?" "+o:"",n+=i+`<${c}${o}${e}?>`,r=!0;continue}let h=s;""!==h&&(h+=t.indentBy);const u=s+`<${c}${Go(a[":@"],t)}`,I=Vo(a[c],t,l,h);-1!==t.unpairedTags.indexOf(c)?t.suppressUnpairedNode?n+=u+">":n+=u+"/>":I&&0!==I.length||!t.suppressEmptyNode?I&&I.endsWith(">")?n+=u+`>${I}${s}</${c}>`:(n+=u+">",I&&""!==s&&(I.includes("/>")||I.includes("</"))?n+=s+t.indentBy+I+s:n+=I,n+=`</${c}>`):n+=u+"/>",r=!0}return n}function Yo(e){const t=Object.keys(e);for(let i=0;i<t.length;i++){const s=t[i];if(e.hasOwnProperty(s)&&":@"!==s)return s}}function Go(e,t){let i="";if(e&&!t.ignoreAttributes)for(let s in e){if(!e.hasOwnProperty(s))continue;let n=t.attributeValueProcessor(s,e[s]);n=ko(n,t),!0===n&&t.suppressBooleanAttributes?i+=` ${s.substr(t.attributeNamePrefix.length)}`:i+=` ${s.substr(t.attributeNamePrefix.length)}="${n}"`}return i}function zo(e,t){let i=(e=e.substr(0,e.length-t.textNodeName.length-1)).substr(e.lastIndexOf(".")+1);for(let s in t.stopNodes)if(t.stopNodes[s]===e||t.stopNodes[s]==="*."+i)return!0;return!1}function ko(e,t){if(e&&e.length>0&&t.processEntities)for(let i=0;i<t.entities.length;i++){const s=t.entities[i];e=e.replace(s.regex,s.val)}return e}const Ho=function(e,t){let i="";return t.format&&t.indentBy.length>0&&(i="\n"),Vo(e,t,"",i)},Wo={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},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 Xo(e){this.options=Object.assign({},Wo,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=$o),this.processTextOrObjNode=Zo,this.options.format?(this.indentate=jo,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function Zo(e,t,i){const s=this.j2x(e,i+1);return void 0!==e[this.options.textNodeName]&&1===Object.keys(e).length?this.buildTextValNode(e[this.options.textNodeName],t,s.attrStr,i):this.buildObjectNode(s.val,t,s.attrStr,i)}function jo(e){return this.options.indentBy.repeat(e)}function $o(e){return!(!e.startsWith(this.options.attributeNamePrefix)||e===this.options.textNodeName)&&e.substr(this.attrPrefixLen)}Xo.prototype.build=function(e){return this.options.preserveOrder?Ho(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)},Xo.prototype.j2x=function(e,t){let i="",s="";for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n))if(void 0===e[n])this.isAttribute(n)&&(s+="");else if(null===e[n])this.isAttribute(n)?s+="":"?"===n[0]?s+=this.indentate(t)+"<"+n+"?"+this.tagEndChar:s+=this.indentate(t)+"<"+n+"/"+this.tagEndChar;else if(e[n]instanceof Date)s+=this.buildTextValNode(e[n],n,"",t);else if("object"!=typeof e[n]){const r=this.isAttribute(n);if(r)i+=this.buildAttrPairStr(r,""+e[n]);else if(n===this.options.textNodeName){let t=this.options.tagValueProcessor(n,""+e[n]);s+=this.replaceEntitiesValue(t)}else s+=this.buildTextValNode(e[n],n,"",t)}else if(Array.isArray(e[n])){const i=e[n].length;let r="",o="";for(let a=0;a<i;a++){const i=e[n][a];if(void 0===i);else if(null===i)"?"===n[0]?s+=this.indentate(t)+"<"+n+"?"+this.tagEndChar:s+=this.indentate(t)+"<"+n+"/"+this.tagEndChar;else if("object"==typeof i)if(this.options.oneListGroup){const e=this.j2x(i,t+1);r+=e.val,this.options.attributesGroupName&&i.hasOwnProperty(this.options.attributesGroupName)&&(o+=e.attrStr)}else r+=this.processTextOrObjNode(i,n,t);else if(this.options.oneListGroup){let e=this.options.tagValueProcessor(n,i);e=this.replaceEntitiesValue(e),r+=e}else r+=this.buildTextValNode(i,n,"",t)}this.options.oneListGroup&&(r=this.buildObjectNode(r,n,o,t)),s+=r}else if(this.options.attributesGroupName&&n===this.options.attributesGroupName){const t=Object.keys(e[n]),s=t.length;for(let r=0;r<s;r++)i+=this.buildAttrPairStr(t[r],""+e[n][t[r]])}else s+=this.processTextOrObjNode(e[n],n,t);return{attrStr:i,val:s}},Xo.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&"true"===t?" "+e:" "+e+'="'+t+'"'},Xo.prototype.buildObjectNode=function(e,t,i,s){if(""===e)return"?"===t[0]?this.indentate(s)+"<"+t+i+"?"+this.tagEndChar:this.indentate(s)+"<"+t+i+this.closeTag(t)+this.tagEndChar;{let n="</"+t+this.tagEndChar,r="";return"?"===t[0]&&(r="?",n=""),!i&&""!==i||-1!==e.indexOf("<")?!1!==this.options.commentPropName&&t===this.options.commentPropName&&0===r.length?this.indentate(s)+`\x3c!--${e}--\x3e`+this.newLine:this.indentate(s)+"<"+t+i+r+this.tagEndChar+e+this.indentate(s)+n:this.indentate(s)+"<"+t+i+r+">"+e+n}},Xo.prototype.closeTag=function(e){let t="";return-1!==this.options.unpairedTags.indexOf(e)?this.options.suppressUnpairedNode||(t="/"):t=this.options.suppressEmptyNode?"/":`></${e}`,t},Xo.prototype.buildTextValNode=function(e,t,i,s){if(!1!==this.options.cdataPropName&&t===this.options.cdataPropName)return this.indentate(s)+`<![CDATA[${e}]]>`+this.newLine;if(!1!==this.options.commentPropName&&t===this.options.commentPropName)return this.indentate(s)+`\x3c!--${e}--\x3e`+this.newLine;if("?"===t[0])return this.indentate(s)+"<"+t+i+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(t,e);return n=this.replaceEntitiesValue(n),""===n?this.indentate(s)+"<"+t+i+this.closeTag(t)+this.tagEndChar:this.indentate(s)+"<"+t+i+">"+n+"</"+t+this.tagEndChar}},Xo.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const i=this.options.entities[t];e=e.replace(i.regex,i.val)}return e};var Qo={XMLParser:Bo,XMLValidator:wr,XMLBuilder:Xo};class qo{constructor(e,i){t(this,"date",new Date),t(this,"author"),t(this,"guid",Ii.create()),t(this,"viewpoint"),t(this,"modifiedAuthor"),t(this,"modifiedDate"),t(this,"topic"),t(this,"_components"),t(this,"_comment",""),this._components=e,this._comment=i;const s=this._components.get(sa);this.author=s.config.author}set comment(e){var t;const i=this._components.get(sa);this._comment=e,this.modifiedDate=new Date,this.modifiedAuthor=i.config.author,null==(t=this.topic)||t.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>`),`\n <Comment Guid="${this.guid}">\n <Date>${this.date.toISOString()}</Date>\n <Author>${this.author}</Author>\n <Comment>${this.comment}</Comment>\n ${e??""}\n ${i??""}\n ${t??""}\n </Comment>\n `}}const Ko=class e{constructor(i){t(this,"guid",Ii.create()),t(this,"title",e.default.title),t(this,"creationDate",new Date),t(this,"creationAuthor",""),t(this,"viewpoints",new Ht),t(this,"relatedTopics",new Ht),t(this,"comments",new Wt),t(this,"customData",{}),t(this,"description"),t(this,"serverAssignedId"),t(this,"dueDate"),t(this,"modifiedAuthor"),t(this,"modifiedDate"),t(this,"index"),t(this,"_type",e.default.type),t(this,"_status",e.default.status),t(this,"_priority",e.default.priority),t(this,"_stage",e.default.stage),t(this,"_assignedTo",e.default.assignedTo),t(this,"_labels",e.default.labels??new Set),t(this,"_components"),this._components=i;const s=i.get(sa);this.creationAuthor=s.config.author,this.relatedTopics.guard=e=>e!==this.guid}set type(e){const t=this._components.get(sa),{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(sa),{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(sa);if(e){const{strict:i,priorities:s}=t.config;if(!(!i||s.has(e)))return;this._priority=e}else this._priority=e}get priority(){return this._priority}set stage(e){const t=this._components.get(sa);if(e){const{strict:i,stages:s}=t.config;if(!(!i||s.has(e)))return;this._stage=e}else this._stage=e}get stage(){return this._stage}set assignedTo(e){const t=this._components.get(sa);if(e){const{strict:i,users:s}=t.config;if(!(!i||s.has(e)))return;this._assignedTo=e}else this._assignedTo=e}get assignedTo(){return this._assignedTo}set labels(e){const t=this._components.get(sa),{strict:i,labels:s}=t.config;if(i){const t=new Set;for(const n of e){(!i||s.has(n))&&t.add(n)}this._labels=t}else this._labels=e}get labels(){return this._labels}get _managerVersion(){return this._components.get(sa).config.version}set(e){const t=e,i=this;for(const s in e){if("guid"===s)continue;const e=t[s];s in this&&(i[s]=e)}return this._components.get(sa).list.set(this.guid,this),this}createComment(e,t){const i=new qo(this._components,e);return i.viewpoint=t,i.topic=this,this.comments.set(i.guid,i),i}createLabelTags(e=this._managerVersion){let t="Labels";"2.1"===e&&(t="Labels"),"3"===e&&(t="Label");let i=[...this.labels].map((e=>`<${t}>${e}</${t}>`)).join("\n");for(const e in this.customData){const s=this.customData[e];"string"==typeof s&&(i+=`\n<${t}>${s}</${t}>`)}return"2.1"===e?i:"3"===e?0!==i.length?`<Labels>\n${i}\n</Labels>`:"<Labels/>":i}createCommentTags(e=this._managerVersion){const t=[...this.comments.values()].map((e=>e.serialize())).join("\n");return"2.1"===e?t:"3"===e?0!==t.length?`<Comments>\n${t}\n</Comments>`:"<Comments/>":t}createViewpointTags(e=this._managerVersion){let t="Viewpoints";"2.1"===e&&(t="Viewpoints"),"3"===e&&(t="ViewPoint");const i=this._components.get(wa),s=[...this.viewpoints].map((e=>i.list.get(e))).filter((e=>e)).map((e=>`<${t} Guid="${e.guid}">\n <Viewpoint>${e.guid}.bcfv</Viewpoint>\n <Snapshot>${e.guid}.jpeg</Snapshot>\n </${t}>\n `)).join("\n");return"2.1"===e?s:"3"===e?0!==s.length?`<Viewpoints>\n${s}\n</Viewpoints>`:"<Viewpoints />":s}createRelatedTopicTags(e=this._managerVersion){const t=[...this.relatedTopics].map((e=>`<RelatedTopic Guid="${e}"></RelatedTopic>\n `)).join("\n");return"2.1"===e?t:"3"===e?0!==t.length?`<RelatedTopics>\n${t}\n</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&&"2.1"===e&&(s=`<Index>${this.index}</Index>`);let n=null;this.modifiedDate&&(n=`<ModifiedDate>${this.modifiedDate.toISOString()}</ModifiedDate>`);let r=null;this.modifiedAuthor&&(r=`<ModifiedAuthor>${this.modifiedAuthor}</ModifiedAuthor>`);let o=null;this.dueDate&&(o=`<DueDate>${this.dueDate.toISOString()}</DueDate>`);let a=null;this.assignedTo&&(a=`<AssignedTo>${this.assignedTo}</AssignedTo>`);let c=null;this.description&&(c=`<Description>${this.description}</Description>`);let l=null;this.stage&&(l=`<Stage>${this.stage}</Stage>`);const h=this.createCommentTags(e),u=this.createViewpointTags(e),I=this.createLabelTags(e),d=this.createRelatedTopicTags(e);return`\n <?xml version="1.0" encoding="UTF-8"?>\n <Markup>\n <Topic Guid="${this.guid}" TopicType="${this.type}" TopicStatus="${this.status}" ${t??""}>\n <Title>${this.title}</Title>\n <CreationDate>${this.creationDate.toISOString()}</CreationDate>\n <CreationAuthor>${this.creationAuthor}</CreationAuthor>\n ${i??""}\n ${s??""}\n ${n??""}\n ${r??""}\n ${o??""}\n ${a??""}\n ${c??""}\n ${l??""}\n ${I}\n ${d}\n ${"3"===e?h:""}\n ${"3"===e?u:""}\n </Topic>\n ${"2.1"===e?h:""}\n ${"2.1"===e?u:""}\n </Markup>\n `}};t(Ko,"default",{title:"BCF Topic",type:"Issue",status:"Active"});let Jo=Ko;const ea=(e,t)=>{if(""===t.trim())return;const i=sa.xmlParser.parse(t).Extensions;if(!i)return;const{Priorities:s,TopicStatuses:n,TopicTypes:r,Users:o}=i;if(s&&s.Priority){const t=Array.isArray(s.Priority)?s.Priority:[s.Priority];for(const i of t)e.config.priorities.add(i)}if(n&&n.TopicStatus){const t=Array.isArray(n.TopicStatus)?n.TopicStatus:[n.TopicStatus];for(const i of t)e.config.statuses.add(i)}if(r&&r.TopicType){const t=Array.isArray(r.TopicType)?r.TopicType:[r.TopicType];for(const i of t)e.config.types.add(i)}if(o&&o.User){const t=Array.isArray(o.User)?o.User:[o.User];for(const i of t)e.config.users.add(i)}};class ta extends Zi{constructor(){super(...arguments),t(this,"_config",{version:{type:"Select",options:new Set(["2.1","3"]),multiple:!1,value:""},author:{type:"Text",value:""},types:{type:"TextSet",value:new Set},statuses:{type:"TextSet",value:new Set},priorities:{type:"TextSet",value:new Set},labels:{type:"TextSet",value:new Set},stages:{type:"TextSet",value:new Set},users:{type:"TextSet",value:new Set},includeSelectionTag:{type:"Boolean",value:!1},updateExtensionsOnImport:{type:"Boolean",value:!1},strict:{type:"Boolean",value:!1},includeAllExtensionsOnExport:{type:"Boolean",value:!1},fallbackVersionOnImport:{type:"Select",multiple:!1,options:new Set(["2.1","3"]),value:""},ignoreIncompleteTopicsOnImport:{type:"Boolean",value:!1}})}get version(){return this._config.version.value}set version(e){this._config.version.value=e}get author(){return this._config.author.value}set author(e){this._config.author.value=e}get types(){return this._config.types.value}set types(e){this._config.types.value=e}get statuses(){return this._config.statuses.value}set statuses(e){this._config.statuses.value=e}get priorities(){return this._config.priorities.value}set priorities(e){this._config.priorities.value=e}get labels(){return this._config.labels.value}set labels(e){this._config.labels.value=e}get stages(){return this._config.stages.value}set stages(e){this._config.stages.value=e}get users(){return this._config.users.value}set users(e){this._config.users.value=e}get includeSelectionTag(){return this._config.includeSelectionTag.value}set includeSelectionTag(e){this._config.includeSelectionTag.value=e}get updateExtensionsOnImport(){return this._config.updateExtensionsOnImport.value}set updateExtensionsOnImport(e){this._config.updateExtensionsOnImport.value=e}get strict(){return this._config.strict.value}set strict(e){this._config.strict.value=e}get includeAllExtensionsOnExport(){return this._config.includeAllExtensionsOnExport.value}set includeAllExtensionsOnExport(e){this._config.includeAllExtensionsOnExport.value=e}get fallbackVersionOnImport(){return this._config.fallbackVersionOnImport.value}set fallbackVersionOnImport(e){this._config.fallbackVersionOnImport.value=e}get ignoreIncompleteTopicsOnImport(){return this._config.ignoreIncompleteTopicsOnImport.value}set ignoreIncompleteTopicsOnImport(e){this._config.ignoreIncompleteTopicsOnImport.value=e}}const ia=class e extends Ut{constructor(){super(...arguments),t(this,"enabled",!1),t(this,"_defaultConfig",{author:"jhon.doe@example.com",version:"2.1",types:new Set(["Clash","Failure","Fault","Inquiry","Issue","Remark","Request"]),statuses:new Set(["Active","In Progress","Done","In Review","Closed"]),priorities:new Set(["On hold","Minor","Normal","Major","Critical"]),labels:new Set,stages:new Set,users:new Set,includeSelectionTag:!1,updateExtensionsOnImport:!0,strict:!1,includeAllExtensionsOnExport:!0,fallbackVersionOnImport:"2.1",ignoreIncompleteTopicsOnImport:!1}),t(this,"config",new ta(this,this.components,"BCF Topics",e.uuid)),t(this,"list",new Wt),t(this,"onSetup",new Dt),t(this,"isSetup",!1),t(this,"onBCFImported",new Dt),t(this,"onDisposed",new Dt)}setup(e){if(this.isSetup)return;const t={...this._defaultConfig,...e};this.config.version=t.version,this.config.author=t.author,this.config.types=t.types,this.config.statuses=t.statuses,this.config.priorities=t.priorities,this.config.labels=t.labels,this.config.stages=t.stages,this.config.users=t.users,this.config.includeSelectionTag=t.includeSelectionTag,this.config.updateExtensionsOnImport=t.updateExtensionsOnImport,this.config.strict=t.strict,this.config.includeAllExtensionsOnExport=t.includeAllExtensionsOnExport,this.config.fallbackVersionOnImport=t.fallbackVersionOnImport||"",this.config.ignoreIncompleteTopicsOnImport=t.ignoreIncompleteTopicsOnImport,this.isSetup=!0,this.enabled=!0,this.onSetup.trigger()}create(e){const t=new Jo(this.components);return e?(t.guid=e.guid??t.guid,t.set(e)):this.list.set(t.guid,t),t}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}get usedTypes(){const e=[...this.list].map((([e,t])=>t.type));return new Set(e)}get usedStatuses(){const e=[...this.list].map((([e,t])=>t.status));return new Set(e)}get usedPriorities(){const e=[...this.list].map((([e,t])=>t.priority)).filter((e=>e));return new Set(e)}get usedStages(){const e=[...this.list].map((([e,t])=>t.stage)).filter((e=>e));return new Set(e)}get usedUsers(){const e=[];for(const[t,i]of this.list){e.push(i.creationAuthor),i.assignedTo&&e.push(i.assignedTo),i.modifiedAuthor&&e.push(i.modifiedAuthor);for(const[t,s]of i.comments)e.push(s.author),s.modifiedAuthor&&e.push(s.modifiedAuthor)}return new Set(e)}get usedLabels(){const e=[];for(const[t,i]of this.list)e.push(...i.labels);return new Set(e)}updateExtensions(){for(const[e,t]of this.list){for(const e of t.labels)this.config.labels.add(e);this.config.types.add(t.type),t.priority&&this.config.priorities.add(t.priority),t.stage&&this.config.stages.add(t.stage),this.config.statuses.add(t.status),this.config.users.add(t.creationAuthor),t.assignedTo&&this.config.users.add(t.assignedTo),t.modifiedAuthor&&this.config.users.add(t.modifiedAuthor);for(const[e,i]of t.comments)this.config.users.add(i.author),i.modifiedAuthor&&this.config.users.add(i.modifiedAuthor)}}updateViewpointReferences(){const e=this.components.get(wa);for(const[t,i]of this.list)for(const t of i.viewpoints){e.list.has(t)||i.viewpoints.delete(t)}}async export(e=this.list.values()){const t=new Pr;t.file("bcf.version",`<?xml version="1.0" encoding="UTF-8"?>\n <Version VersionId="${this.config.version}" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/buildingSMART/BCF-XML/release_3_0/Schemas/version.xsd"\n xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\n </Version>`),t.file("bcf.extensions",this.serializeExtensions());const i=await fetch("https://thatopen.github.io/engine_components/resources/favicon.ico"),s=await i.arrayBuffer(),n=this.components.get(wa);for(const i of e){const e=t.folder(i.guid);e.file("markup.bcf",i.serialize());for(const t of i.viewpoints){const i=n.list.get(t);i&&(e.file(`${t}.jpeg`,s,{binary:!0}),e.file(`${t}.bcfv`,await i.serialize()))}}return await t.generateAsync({type:"blob"})}serializeExtensions(){const e=[...this.config.types].map((e=>`<TopicType>${e}</TopicType>`)).join("\n"),t=[...this.config.statuses].map((e=>`<TopicStatus>${e}</TopicStatus>`)).join("\n"),i=[...this.config.priorities].map((e=>`<Priority>${e}</Priority>`)).join("\n"),s=[...this.config.labels].map((e=>`<TopicLabel>${e}</TopicLabel>`)).join("\n"),n=[...this.config.stages].map((e=>`<Stage>${e}</Stage>`)).join("\n"),r=[...this.config.users].map((e=>`<User>${e}</User>`)).join("\n");return`\n <?xml version="1.0" encoding="UTF-8"?>\n <Extensions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="your-schema-location.xsd">\n ${0!==e.length?`<TopicTypes>\n${e}\n</TopicTypes>`:""}\n ${0!==t.length?`<TopicStatuses>\n${t}\n</TopicStatuses>`:""}\n ${0!==i.length?`<Priorities>\n${i}\n</Priorities>`:""}\n ${0!==s.length?`<TopicLabels>\n${s}\n</TopicLabels>`:""}\n ${0!==n.length?`<Stages>\n${n}\n</Stages>`:""}\n ${0!==r.length?`<Users>\n${r}\n</Users>`:""}\n </Extensions>\n `}processMarkupComment(e){const{Guid:t,Date:i,Author:s,Comment:n,Viewpoint:r}=e;if(!(t&&i&&s&&(qo||r)))return null;const o=this.components.get(wa),a=new qo(this.components,n??"");return a.guid=t,a.date=new Date(i),a.author=s,a.viewpoint=(null==r?void 0:r.Guid)?o.list.get(r.Guid):void 0,a.modifiedAuthor=e.ModifiedAuthor,a.modifiedDate=e.ModifiedDate?new Date(e.ModifiedDate):void 0,a}getMarkupComments(e,t){var i;let s;if("2.1"===t&&(s=e.Comment),"3"===t&&(s=null==(i=e.Topic.Comments)?void 0:i.Comment),!s)return[];s=Array.isArray(s)?s:[s];const n=s.map((e=>this.processMarkupComment(e))).filter((e=>e));return Array.isArray(n)?n:[n]}getMarkupLabels(e,t){var i;let s;if("2.1"===t&&(s=e.Topic.Labels),"3"===t&&(s=null==(i=e.Topic.Labels)?void 0:i.Label),!s)return[];return Array.isArray(s)?s:[s]}getMarkupViewpoints(e,t){var i;let s;return"2.1"===t&&(s=e.Viewpoints),"3"===t&&(s=null==(i=e.Topic.Viewpoints)?void 0:i.ViewPoint),s?(s=Array.isArray(s)?s:[s],s):[]}getMarkupRelatedTopics(e,t){var i;let s;if("2.1"===t&&(s=e.Topic.RelatedTopic),"3"===t&&(s=null==(i=e.Topic.RelatedTopics)?void 0:i.RelatedTopic),!s)return[];return(Array.isArray(s)?s:[s]).map((e=>e.Guid))}async load(t,i){var s;const{fallbackVersionOnImport:n,ignoreIncompleteTopicsOnImport:r,updateExtensionsOnImport:a}=this.config,c=new Pr;await c.loadAsync(t);const l=Object.values(c.files);let h=n;const u=l.find((e=>e.name.endsWith(".version")));if(u){const t=await u.async("string"),i=e.xmlParser.parse(t).Version.VersionId;h=String(i)}if(!h||"2.1"!==h&&"3"!==h)throw new Error(`BCFTopics: ${h} is not supported.`);const I=l.find((e=>e.name.endsWith(".extensions")));if(a&&I){const e=await I.async("string");ea(this,e)}const d=[],E=this.components.get(wa),f=l.filter((e=>e.name.endsWith(".bcfv")));for(const t of f){const n=await t.async("string"),r=e.xmlParser.parse(n).VisualizationInfo;if(!r){console.warn("Missing VisualizationInfo in Viewpoint");continue}const a={},{Guid:c,ClippingPlanes:l,Components:u,OrthogonalCamera:I,PerspectiveCamera:E}=r;if(c&&(a.guid=c),u){const{Selection:e,Visibility:t}=u;if(e&&e.Component){const t=Array.isArray(e.Component)?e.Component:[e.Component];a.selectionComponents=t.map((e=>e.IfcGuid)).filter((e=>e))}if(t&&"DefaultVisibility"in t&&(a.defaultVisibility=t.DefaultVisibility),t&&t.Exceptions&&"Component"in t.Exceptions){const{Component:e}=t.Exceptions,i=Array.isArray(e)?e:[e];a.exceptionComponents=i.map((e=>e.IfcGuid)).filter((e=>e))}let i;"2.1"===h&&(i=u.ViewSetupHints),"3"===h&&(i=null==(s=u.Visibility)?void 0:s.ViewSetupHints),i&&("OpeningsVisible"in i&&(a.openingsVisible=i.OpeningsVisible),"SpacesVisible"in i&&(a.spacesVisible=i.SpacesVisible),"SpaceBoundariesVisible"in i&&(a.spaceBoundariesVisible=i.SpaceBoundariesVisible))}if(I||E){const e=r.PerspectiveCamera??r.OrthogonalCamera,{CameraViewPoint:t,CameraDirection:i}=e,s=new o.Vector3(Number(t.X),Number(t.Z),Number(-t.Y)),n=new o.Vector3(Number(i.X),Number(i.Z),Number(-i.Y)),c={position:{x:s.x,y:s.y,z:s.z},direction:{x:n.x,y:n.y,z:n.z},aspectRatio:"AspectRatio"in e?e.AspectRatio:1};"ViewToWorldScale"in e&&(a.camera={...c,viewToWorldScale:e.ViewToWorldScale}),"FieldOfView"in e&&(a.camera={...c,fov:e.FieldOfView})}const f=new _a(this.components,i,{data:a,setCamera:!1});if(u){const{Coloring:e}=u;if(e&&e.Color){const t=Array.isArray(e.Color)?e.Color:[e.Color];for(const e of t){const{Color:t,Component:i}=e,s=(Array.isArray(i)?i:[i]).map((e=>e.IfcGuid));f.componentColors.set(t,s)}}}if(d.push(f),l){const e=this.components.get(Kn),t=Array.isArray(l.ClippingPlane)?l.ClippingPlane:[l.ClippingPlane];for(const s of t){const{Location:t,Direction:n}=s;if(!t||!n)continue;const r=new o.Vector3(t.X,t.Z,-t.Y),a=new o.Vector3(n.X,-n.Z,n.Y),c=e.createFromNormalAndCoplanarPoint(i,a,r);c.visible=!1,c.enabled=!1,f.clippingPlanes.add(c)}}}const p={},C=[],T=l.filter((e=>e.name.endsWith(".bcf")));for(const t of T){const i=await t.async("string"),s=e.xmlParser.parse(i).Markup,n=s.Topic,{Guid:o,TopicType:a,TopicStatus:c,Title:l,CreationDate:u,CreationAuthor:I}=n;if(r&&!(o&&a&&c&&l&&u&&I))continue;const d=new Jo(this.components);d.guid=o??d.guid;const f=this.getMarkupRelatedTopics(s,h);p[d.guid]=new Set(f),d.type=a??d.type,d.status=c??d.status,d.title=l??d.title,d.creationDate=u?new Date(u):d.creationDate,d.creationAuthor=I??d.creationAuthor,d.serverAssignedId=n.ServerAssignedId,d.priority=n.Priority,d.index=n.Index,d.modifiedDate=n.ModifiedDate?new Date(n.ModifiedDate):void 0,d.modifiedAuthor=n.ModifiedAuthor,d.dueDate=n.DueDate?new Date(n.DueDate):void 0,d.assignedTo=n.AssignedTo,d.description=n.Description,d.stage=n.Stage;const T=this.getMarkupLabels(s,h);for(const e of T)d.labels.add(e);const m=this.getMarkupComments(s,h);for(const e of m)d.comments.set(e.guid,e);const R=this.getMarkupViewpoints(s,h);for(const e of R){if(!e||!e.Guid)continue;const t=E.list.get(e.Guid);t&&d.viewpoints.add(t.guid)}this.list.set(d.guid,d),C.push(d)}for(const e in p){const t=this.list.get(e);if(!t)continue;const i=p[e];for(const e of i)t.relatedTopics.add(e)}return this.onBCFImported.trigger(C),{viewpoints:d,topics:C}}};t(ia,"uuid","de977976-e4f6-4e4f-a01a-204727839802"),t(ia,"xmlParser",new Qo.XMLParser({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,ignoreDeclaration:!0,ignorePiTags:!0,numberParseOptions:{leadingZeros:!0,hex:!0},parseAttributeValue:!0,preserveOrder:!1,processEntities:!1,removeNSPrefix:!0,trimValues:!0}));let sa=ia;const na=class e extends Ut{constructor(i){super(i),t(this,"enabled",!0),t(this,"onDisposed",new Dt),t(this,"_absoluteMin"),t(this,"_absoluteMax"),t(this,"_meshes",[]),this.components.add(e.uuid,this),this._absoluteMin=e.newBound(!0),this._absoluteMax=e.newBound(!1)}static getDimensions(e){const{min:t,max:i}=e,s=Math.abs(i.x-t.x),n=Math.abs(i.y-t.y),r=Math.abs(i.z-t.z),a=new o.Vector3;return a.subVectors(i,t).divideScalar(2).add(t),{width:s,height:n,depth:r,center:a}}static newBound(e){const t=e?1:-1;return new o.Vector3(t*Number.MAX_VALUE,t*Number.MAX_VALUE,t*Number.MAX_VALUE)}static getBounds(e,t,i){const s=i||this.newBound(!1),n=t||this.newBound(!0);for(const t of e)t.x<n.x&&(n.x=t.x),t.y<n.y&&(n.y=t.y),t.z<n.z&&(n.z=t.z),t.x>s.x&&(s.x=t.x),t.y>s.y&&(s.y=t.y),t.z>s.z&&(s.z=t.z);return new o.Box3(t,i)}dispose(){const t=this.components.get(zt);for(const e of this._meshes)t.destroy(e);this._meshes=[],this.onDisposed.trigger(e.uuid),this.onDisposed.reset()}get(){const e=this._absoluteMin.clone(),t=this._absoluteMax.clone();return new o.Box3(e,t)}getSphere(){const e=this._absoluteMin.clone(),t=this._absoluteMax.clone(),i=Math.abs((t.x-e.x)/2),s=Math.abs((t.y-e.y)/2),n=Math.abs((t.z-e.z)/2),r=new o.Vector3(e.x+i,e.y+s,e.z+n),a=r.distanceTo(e);return new o.Sphere(r,a)}getMesh(){const t=new o.Box3(this._absoluteMin,this._absoluteMax),i=e.getDimensions(t),{width:s,height:n,depth:r,center:a}=i,c=new o.BoxGeometry(s,n,r),l=new o.Mesh(c);return this._meshes.push(l),l.position.copy(a),l}reset(){this._absoluteMin=e.newBound(!0),this._absoluteMax=e.newBound(!1)}add(e){for(const t of e.items)this.addMesh(t.mesh)}addMesh(t,i){if(!t.geometry.index)return;const s=e.getFragmentBounds(t);t.updateMatrixWorld();const n=t.matrixWorld,r=new o.Matrix4,c=t instanceof o.InstancedMesh,l=new Set;if(t instanceof a.FragmentMesh){i||(i=t.fragment.ids);for(const e of i){const i=t.fragment.getInstancesIDs(e);if(i)for(const e of i)l.add(e)}}else l.add(0);for(const e of l){const i=s.min.clone(),o=s.max.clone();c&&(t.getMatrixAt(e,r),i.applyMatrix4(r),o.applyMatrix4(r)),i.applyMatrix4(n),o.applyMatrix4(n),i.x<this._absoluteMin.x&&(this._absoluteMin.x=i.x),i.y<this._absoluteMin.y&&(this._absoluteMin.y=i.y),i.z<this._absoluteMin.z&&(this._absoluteMin.z=i.z),i.x>this._absoluteMax.x&&(this._absoluteMax.x=i.x),i.y>this._absoluteMax.y&&(this._absoluteMax.y=i.y),i.z>this._absoluteMax.z&&(this._absoluteMax.z=i.z),o.x>this._absoluteMax.x&&(this._absoluteMax.x=o.x),o.y>this._absoluteMax.y&&(this._absoluteMax.y=o.y),o.z>this._absoluteMax.z&&(this._absoluteMax.z=o.z),o.x<this._absoluteMin.x&&(this._absoluteMin.x=o.x),o.y<this._absoluteMin.y&&(this._absoluteMin.y=o.y),o.z<this._absoluteMin.z&&(this._absoluteMin.z=o.z)}}addFragmentIdMap(e){const t=this.components.get(yr);for(const i in e){const s=t.list.get(i);if(!s)continue;const n=e[i];this.addMesh(s.mesh,n)}}static getFragmentBounds(e){const t=e.geometry.attributes.position,i=Number.MAX_VALUE,s=-i,n=new o.Vector3(i,i,i),r=new o.Vector3(s,s,s);if(!e.geometry.index)throw new Error("Geometry must be indexed!");const a=Array.from(e.geometry.index.array);for(let e=0;e<a.length;e++){if(e%3==0&&0===a[e]&&0===a[e+1]&&0===a[e+2]){e+=2;continue}const i=a[e],s=t.getX(i),o=t.getY(i),c=t.getZ(i);s<n.x&&(n.x=s),o<n.y&&(n.y=o),c<n.z&&(n.z=c),s>r.x&&(r.x=s),o>r.y&&(r.y=o),c>r.z&&(r.z=c)}return new o.Box3(n,r)}};t(na,"uuid","d1444724-dba6-4cdd-a0c7-68ee1450d166");let ra=na;const oa=class e extends Ut{constructor(i){super(i),t(this,"enabled",!0),i.add(e.uuid,this)}async getIsolatedElements(e,t,i){const s=new Set;function n(i){if(s.has(i))return;const r=e.GetLine(t,i);if(r){s.add(i);for(const e in r){const t=r[e];t&&"Handle"===t.constructor.name&&t.value>0?n(t.value):Array.isArray(t)&&t.forEach((e=>{e&&"Handle"===e.constructor.name&&e.value>0&&n(e.value)}))}}}for(const e of i)n(e);const r=[];for(const e of s)r.push(e);r.sort(((e,t)=>e-t));const o=[];return r.forEach((i=>{const s=e.GetLine(t,i);o.push(s)})),o}async export(e,t,i){i.forEach((i=>{e.WriteLine(t,i)}));return e.SaveModel(t)}async splitIfc(e,t,i){const s=new Uint8Array(t),n=e.OpenModel(s),r=await this.getIsolatedElements(e,n,i),o=e.CreateModel({schema:c.Schemas.IFC2X3});return await this.export(e,o,r)}};t(oa,"uuid","6eb0ba2f-71c0-464e-bcec-2d7c335186b2");let aa=oa;const ca=class e{constructor(e){t(this,"onProgress",new Dt),t(this,"inclusive",!1),t(this,"rules",[]),t(this,"ids",{}),t(this,"needsUpdate",new Map),t(this,"components"),this.components=e}static import(t,i){const s=e.importers.get(i.type);return s?s(t,i):(console.warn("Invalid query data:.",i),null)}static importRules(e){const t=[];for(const i of e){const e={};for(const t in i){const s=i[t];s.regexp?e[t]=new RegExp(s.value):e[t]=s}t.push(e)}return t}static importIds(e){const t={};for(const i in e.ids)t[i]=new Set(e.ids[i]);return t}clear(e){if(void 0===e)return this.ids={},void this.needsUpdate.clear();delete this.ids[e],this.needsUpdate.delete(e)}addID(e,t){this.ids[e]||(this.ids[e]=new Set),this.ids[e].add(t)}getData(){const e={};for(const t in this.ids)e[t]=Array.from(this.ids[t]);const t=this.exportRules();return{name:this.name,inclusive:this.inclusive,type:"IfcFinderQuery",ids:e,rules:t}}exportRules(){const e=[];for(const t of this.rules){const i={};for(const e in t){const s=t[e];s instanceof RegExp?i[e]={regexp:!0,value:s.source}:i[e]=s}e.push(i)}return e}findInFile(e,t){return new Promise((i=>{const s=new FileReader,n=new TextDecoder("utf-8"),r=1024e4;let o=0;const a=/;/,c=()=>{if(o>=t.size)return void i();const e=Math.min(o+r+1e3,t.size),n=t.slice(o,e);s.readAsArrayBuffer(n)};s.onload=()=>{if(!(s.result instanceof ArrayBuffer))return;const i=new Uint8Array(s.result),l=n.decode(i).split(a);l.shift(),this.findInLines(e,l),this.onProgress.trigger(o/t.size),o+=r,c()},c()}))}getIdFromLine(e){const t=e.slice(e.indexOf("#")+1,e.indexOf("="));return parseInt(t,10)}testRules(e){let t=null,i=null,s=null,n=!1;for(const r of this.rules)if("category"!==r.type){if(null===i&&(i=this.getAttributesFromLine(e),null===i)){if(this.inclusive)continue;n=!1;break}if(null===t&&(t=this.getCategoryFromLine(e),null===t)){if(this.inclusive)continue;n=!1;break}if(null===s&&(s=Object.keys(new c.IFC4[t]),s=s.slice(2),null===s)){if(this.inclusive)continue;n=!1;break}if("property"===r.type){const{name:t,value:o}=r;if(!o.test(e)){if(this.inclusive)continue;n=!1;break}let a=!1;for(let e=0;e<i.length;e++){const n=i[e],r=s[e];if(o.test(n)&&t.test(r)){a=!0;break}}if(a)n=!0;else if(!this.inclusive){n=!1;break}}if("operator"===r.type){const{name:e,value:t,operator:o}=r;let a=!1;for(let n=0;n<i.length;n++){const r=s[n],c=i[n].replace(/IFCLENGTHMEASURE\(|IFCVOLUMEMEASURE\(|\)/g,"");if(e.test(r)){if("="===o&&parseFloat(c)===t){a=!0;break}if("<"===o&&parseFloat(c)<t){a=!0;break}if(">"===o&&parseFloat(c)>t){a=!0;break}if(">="===o&&parseFloat(c)>=t){a=!0;break}if("<="===o&&parseFloat(c)<=t){a=!0;break}}}if(a)n=!0;else if(!this.inclusive){n=!1;break}}}else{if(null===t&&(t=this.getCategoryFromLine(e),null===t)){if(this.inclusive)continue;break}if(!r.value.test(t)){if(this.inclusive)continue;n=!1;break}n=!0}return n}getCategoryFromLine(e){const t=e.indexOf("=")+1,i=e.indexOf("("),s=e.slice(t,i).trim(),n=cr[s];return n||null}getAttributesFromLine(e){const t=e.match(/\((.*)\)/);if(!t||!t[1])return null;return t[1].split(/,(?![^()]*\))/g).map((e=>e.trim()))}};t(ca,"importers",new Map);let la=ca;class ha{constructor(e){t(this,"list",new Map),t(this,"id",o.MathUtils.generateUUID()),t(this,"mode","intersect"),t(this,"_components"),this._components=e}get queries(){return new Set(this.list.values())}get items(){const e=[];for(const t of this.queries)e.push(t.items);return"combine"===this.mode?a.FragmentUtils.combine(e):a.FragmentUtils.intersect(e)}add(e){if(this.list.has(e.name))throw new Error(`This group already has a query with the name ${e.name}.`);this.list.set(e.name,e)}clear(e){for(const t of this.queries)t.clear(e)}import(e){this.mode=e.mode,this.id=e.id;for(const t in e.queries){const i=la.import(this._components,e.queries[t]);i&&this.list.set(t,i)}}export(){const e={};for(const[t,i]of this.list)e[t]=i.export();return{mode:this.mode,id:this.id,queries:e}}async update(e,t){for(const i of this.queries){const s=i.needsUpdate.get(e);(void 0===s||s)&&await i.update(e,t)}}}const ua=class e extends la{constructor(e,i){super(e),t(this,"name"),this.name=i.name,this.rules=i.rules,this.inclusive=i.inclusive}get items(){const e=this.components.get(yr),t=[];for(const i in this.ids){const s=this.ids[i],n=e.groups.get(i);if(!n){console.warn(`Model ${i} not found!`);continue}const r=n.getFragmentMap(s);t.push(r)}return a.FragmentUtils.combine(t)}export(){const t=this.getData();return t.type=e.type,t}async update(e,t){this.ids[e]=new Set,await this.findInFile(e,t),this.needsUpdate.set(e,!1)}findInLines(e,t){for(const i of t){if(this.testRules(i)){const t=this.getIdFromLine(i);this.addID(e,t)}}}};t(ua,"type","IfcBasicQuery");let Ia=ua;la.importers.set(Ia.type,((e,t)=>{const i=new Ia(e,{name:t.name,rules:la.importRules(t.rules),inclusive:t.inclusive});return i.ids=la.importIds(t),i}));const da=class e extends la{constructor(e,i){super(e),t(this,"name"),t(this,"psets",[]),this.name=i.name,this.rules=i.rules,this.inclusive=i.inclusive}get items(){const e=this.components.get(Or),t=this.components.get(yr),i=[];for(const s in this.ids){const n=t.groups.get(s);if(!n){console.log(`Model not found: ${s}.`);continue}const r=this.ids[s];for(const t of r){const r=e.getEntityRelations(s,t,"DefinesOcurrence");if(r){const e=n.getFragmentMap(r);i.push(e)}}}return a.FragmentUtils.combine(i)}export(){const t=this.getData();return t.type=e.type,t}async update(e,t){await this.findInFile(e,t);const i=new Set;for(const t of this.psets){const s=this.getAttributesFromLine(t);if(null===s)continue;const n=s[4].replace("(","[").replace(")","]").replace(/#/g,""),r=JSON.parse(n);for(const s of r){const n=this.ids[e];if(n&&n.has(s)){const e=this.getIdFromLine(t);i.add(e);break}}}this.ids[e]=i,this.psets=[],this.needsUpdate.set(e,!1)}findInLines(e,t){for(const i of t){const t=this.getCategoryFromLine(i);if("IfcPropertySet"===t){this.psets.push(i);continue}if("IfcPropertySingleValue"!==t)continue;if(this.testRules(i)){const t=this.getIdFromLine(i);this.addID(e,t)}}}};t(da,"type","IfcPropertyQuery");let Ea=da;la.importers.set(Ea.type,((e,t)=>{const i=new Ea(e,{name:t.name,inclusive:t.inclusive,rules:la.importRules(t.rules)});return i.ids=la.importIds(t),i}));const fa=class e extends Ut{constructor(i){super(i),t(this,"enabled",!0),t(this,"list",new Map),i.add(e.uuid,this)}get queries(){const e=new Set;for(const[,t]of this.list)for(const i of t.queries)e.add(i);return e}import(e){for(const t in e){const i=new ha(this.components);i.import(e[t]),this.list.set(t,i)}}export(){const e={};for(const[t,i]of this.list)e[t]=i.export();return e}create(){const e=new ha(this.components);return this.list.set(e.id,e),e}delete(e){this.list.delete(e)}clear(){this.list.clear()}};t(fa,"uuid","0da7ad77-f734-42ca-942f-a074adfd1e3a");let pa=fa;const Ca=class e extends Ut{constructor(i){super(i),t(this,"enabled",!0),t(this,"list",{}),t(this,"onDisposed",new Dt),t(this,"onFragmentsDisposed",(e=>{const{groupID:t,fragmentIDs:i}=e;for(const e in this.list){const s=this.list[e],n=Object.keys(s);if(n.includes(t))delete s[t],0===Object.values(s).length&&delete this.list[e];else for(const e of n){const t=s[e];for(const e of i)delete t.map[e];0===Object.values(t).length&&delete s[e]}}})),i.add(e.uuid,this);i.get(yr).onFragmentsDisposed.add(this.onFragmentsDisposed)}dispose(){this.list={};this.components.get(yr).onFragmentsDisposed.remove(this.onFragmentsDisposed),this.onDisposed.trigger(),this.onDisposed.reset()}remove(e){for(const t in this.list){const i=this.list[t];for(const t in i){delete i[t].map[e]}}}find(e){const t=this.components.get(yr);if(!e){const e={};for(const[i,s]of t.list)e[i]=new Set(s.ids);return e}const i=Object.keys(e).length,s={};for(const t in e){const i=e[t];if(this.list[t])for(const e of i){const i=this.list[t][e];if(i)for(const e in i.map){s[e]||(s[e]=new Map);for(const t of i.map[e]){const i=s[e].get(t);void 0===i?s[e].set(t,1):s[e].set(t,i+1)}}}else console.warn(`Classification ${t} does not exist.`)}const n={};for(const e in s){const t=s[e];for(const[s,r]of t){if(void 0===r)throw new Error("Malformed fragments map!");r===i&&(n[e]||(n[e]=new Set),n[e].add(s))}}return n}byModel(e,t){this.list.models||(this.list.models={});const i=this.list.models;i[e]||(i[e]={map:{},id:null,name:e});const s=i[e];for(const[e,i]of t.data){const n=i[0];for(const i of n){const n=t.keyFragments.get(i);n&&(s.map[n]||(s.map[n]=new Set),s.map[n].add(e))}}}async byPredefinedType(e){var t;this.list.predefinedTypes||(this.list.predefinedTypes={});const i=this.list.predefinedTypes,s=e.getAllPropertiesIDs();for(const n of s){const s=await e.getProperties(n);if(!s)continue;const r=String(null==(t=s.PredefinedType)?void 0:t.value).toUpperCase();i[r]||(i[r]={map:{},id:null,name:r});const o=i[r];for(const[t,i]of e.data){const t=i[0];for(const i of t){const t=e.keyFragments.get(i);if(!t)throw new Error("Fragment ID not found!");o.map[t]||(o.map[t]=new Set);o.map[t].add(s.expressID)}}}}byEntity(e){this.list.entities||(this.list.entities={});for(const[t,i]of e.data){const s=i[1][1],n=or[s];this.saveItem(e,"entities",n,t)}}async byIfcRel(e,t,i){ar.isRel(t)&&await ar.getRelationMap(e,t,(async(t,s)=>{const{name:n}=await ar.getEntityName(e,t);for(const t of s)this.saveItem(e,i,n??"NO REL NAME",t)}))}async bySpatialStructure(e,t={}){var i,s;const n=this.components.get(Or),r=n.relationMaps[e.uuid];if(!r)throw new Error(`Classifier: model relations of ${e.name||e.uuid} have to exists to group by spatial structure.`);const o=t.systemName??"spatialStructures",a=void 0===t.useProperties||t.useProperties;for(const[c]of r){if(t.isolate){const i=e.data.get(c);if(!i)continue;const s=i[1][1];if(void 0===s||!t.isolate.has(s))continue}const r=n.getEntityRelations(e,c,"Decomposes");if(r)for(const t of r){let s=t.toString();if(a){const n=await e.getProperties(t);if(!n)continue;s=null==(i=n.Name)?void 0:i.value}this.saveItem(e,o,s,c,t)}const l=n.getEntityRelations(e,c,"ContainsElements");if(!l)continue;let h=c.toString();if(a){const t=await e.getProperties(c);if(!t)continue;h=null==(s=t.Name)?void 0:s.value}for(const t of l){this.saveItem(e,o,h,t,c);const i=n.getEntityRelations(e,Number(t),"IsDecomposedBy");if(i)for(const t of i)this.saveItem(e,o,h,t,c)}}}setColor(e,t,i=!1){const s=this.components.get(yr);for(const n in e){const r=s.list.get(n);if(!r)continue;const o=e[n];r.setColor(t,o,i)}}resetColor(e){const t=this.components.get(yr);for(const i in e){const s=t.list.get(i);if(!s)continue;const n=e[i];s.resetColor(n)}}export(){const e={};for(const t in this.list){e[t]={};const i=this.list[t];for(const s in i){const n=i[s];e[t][s]={map:a.FragmentUtils.export(n.map),name:n.name,id:n.id}}}return e}import(e){for(const t in e){this.list[t]||(this.list[t]={});const i=e[t];for(const e in i){const s=i[e];this.list[t][e]={map:a.FragmentUtils.import(s.map),name:s.name,id:s.id}}}}saveItem(e,t,i,s,n=null){this.list[t]||(this.list[t]={});const r=e.data.get(s);if(r)for(const o of r[0]){const r=e.keyFragments.get(o);if(r){const e=this.list[t];e[i]||(e[i]={map:{},id:n,name:i}),e[i].map[r]||(e[i].map[r]=new Set),e[i].map[r].add(s)}}}};t(Ca,"uuid","e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7");let Ta=Ca;const ma=class e extends Ut{constructor(i){super(i),t(this,"onDisposed",new Dt),t(this,"enabled",!0),t(this,"height",10),t(this,"groupName","spatialStructures"),t(this,"list",new Set),i.add(e.uuid,this)}dispose(){this.list.clear(),this.onDisposed.trigger(),this.onDisposed.reset()}set(e){if(!this.enabled)return;const t=this.components.get(Ta),i=this.components.get(yr),s=e?1:-1;let n=0;const r=t.list[this.groupName],a=new o.Matrix4;for(const t in r){a.elements[13]=n*s*this.height;for(const s in r[t].map){const n=i.list.get(s),o=t+s,c=this.list.has(o);if(!n||e&&c||!e&&!c)continue;e?this.list.add(o):this.list.delete(o);const l=r[t].map[s];n.applyTransform(l,a),n.mesh.computeBoundingSphere(),n.mesh.computeBoundingBox()}n++}}};t(ma,"uuid","d260618b-ce88-4c7d-826c-6debb91de3e2");let Ra=ma;const ga=class e extends Ut{constructor(i){super(i),t(this,"enabled",!0),this.components.add(e.uuid,this)}set(e,t){const i=this.components.get(yr);if(t)for(const s in t){const n=t[s],r=i.list.get(s);r&&(r.setVisibility(e,n),this.updateCulledVisibility(r))}else for(const[t,s]of i.list)s&&(s.setVisibility(e),this.updateCulledVisibility(s))}isolate(e){this.set(!1),this.set(!0,e)}updateCulledVisibility(e){const t=this.components.get(an);for(const[i,s]of t.list){const t=s.colorMeshes.get(e.id);t&&(t.count=e.mesh.count)}}};t(ga,"uuid","dd9ccf2d-8a21-4821-b7f6-2949add16a29");let Aa=ga;class Fa extends ur{constructor(){super(...arguments),t(this,"minGeometrySize",10),t(this,"minAssetsSize",1e3),t(this,"maxTriangles",null)}}const Sa=class e extends Ut{constructor(i){super(i),t(this,"onGeometryStreamed",new xt),t(this,"onAssetStreamed",new xt),t(this,"onProgress",new xt),t(this,"onIfcLoaded",new xt),t(this,"onDisposed",new Dt),t(this,"settings",new Fa),t(this,"enabled",!0),t(this,"webIfc",new c.IfcAPI),t(this,"_nextAvailableID",0),t(this,"_splittedGeometries",new Map),t(this,"_spatialTree",new hr),t(this,"_metaData",new dr),t(this,"_visitedGeometries",new Map),t(this,"_streamSerializer",new a.StreamSerializer),t(this,"_geometries",new Map),t(this,"_geometryCount",0),t(this,"_civil",new Ir),t(this,"_groupSerializer",new a.Serializer),t(this,"_assets",[]),t(this,"_meshesWithHoles",new Set),this.components.add(e.uuid,this),this.settings.excludedCategories.add(c.IFCOPENINGELEMENT)}dispose(){this.onIfcLoaded.reset(),this.onGeometryStreamed.reset(),this.onAssetStreamed.reset(),this.webIfc=null,this.onDisposed.trigger(),this.onDisposed.reset()}async streamFromBuffer(e){await this.readIfcFile(e),await this.streamAllGeometries(),this.cleanUp()}async streamFromCallBack(e){await this.streamIfcFile(e),await this.streamAllGeometries(),this.cleanUp()}async readIfcFile(e){const{path:t,absolute:i,logLevel:s}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),s&&this.webIfc.SetLogLevel(s),this.webIfc.OpenModel(e,this.settings.webIfc),this._nextAvailableID=this.webIfc.GetMaxExpressID(0)}async streamIfcFile(e){const{path:t,absolute:i,logLevel:s}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),s&&this.webIfc.SetLogLevel(s),this.webIfc.OpenModelFromCallback(e,this.settings.webIfc),this._nextAvailableID=this.webIfc.GetMaxExpressID(0)}async streamAllGeometries(){console.log("Converting geometries to tiles...");const{minGeometrySize:e,minAssetsSize:t}=this.settings;this._spatialTree.setUp(this.webIfc);const i=this.webIfc.GetIfcEntityList(0),s=[[]],n=new a.FragmentsGroup;n.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 r=0,o=0;for(const t of i){if(!this.webIfc.IsIfcElement(t)&&t!==c.IFCSPACE)continue;if(this.settings.excludedCategories.has(t))continue;const i=this.webIfc.GetLineIDsWithType(0,t),a=i.size();for(let c=0;c<a;c++){r>e&&(r=0,o++,s.push([]));const a=i.get(c);s[o].push(a);const l=this.webIfc.GetLine(0,a);if(l.GlobalId){const e=(null==l?void 0:l.GlobalId.value)||(null==l?void 0:l.GlobalId);n.globalToExpressIDs.set(e,a)}const h=this._spatialTree.itemsByFloor[a]||0;n.data.set(a,[[],[h,t]]),r++}}this._spatialTree.cleanUp();let l=.01,h=0;for(const e of s){h++,this.webIfc.StreamMeshes(0,e,(e=>{this.getMesh(this.webIfc,e,n)})),this._geometryCount>this.settings.minGeometrySize&&await this.streamGeometries(),this._assets.length>t&&await this.streamAssets();const i=h/s.length;i>l&&(l+=.01,l=Math.max(l,i),await this.onProgress.trigger(Math.round(100*l)/100))}this._geometryCount&&await this.streamGeometries(),this._assets.length&&await this.streamAssets();const{opaque:u,transparent:I}=n.geometryIDs;for(const[e,{index:t,uuid:i}]of this._visitedGeometries){n.keyFragments.set(t,i);(e>1?u:I).set(e,t)}Er.get(n,this.webIfc);const d=this.webIfc.GetCoordinationMatrix(0);n.coordinationMatrix.fromArray(d),n.civilData=this._civil.read(this.webIfc);const E=this._groupSerializer.export(n);await this.onIfcLoaded.trigger(E),n.dispose(!0)}cleanUp(){try{this.webIfc.Dispose()}catch(e){}this.webIfc=null,this.webIfc=new c.IfcAPI,this._visitedGeometries.clear(),this._geometries.clear(),this._assets=[],this._meshesWithHoles.clear()}getMesh(e,t,i){const s=t.geometries.size(),n=t.expressID,r={id:n,geometries:[]};for(let o=0;o<s;o++){const s=t.geometries.get(o),a=s.geometryExpressID,c=1===s.color.w,l=a*(c?1:-1);this._visitedGeometries.has(l)||this.getGeometry(e,a,c),this.registerGeometryData(i,n,s,r,a,l);const h=this._splittedGeometries.get(a);if(h)for(const e of h)this.registerGeometryData(i,n,s,r,e,e)}this._assets.push(r)}getGeometry(e,t,i){const s=e.GetGeometry(0,t),n=e.GetIndexArray(s.GetIndexData(),s.GetIndexDataSize()),r=e.GetVertexArray(s.GetVertexData(),s.GetVertexDataSize()),a=new Float32Array(r.length/2),c=new Float32Array(r.length/2);for(let e=0;e<r.length;e+=6)a[e/2]=r[e],a[e/2+1]=r[e+1],a[e/2+2]=r[e+2],c[e/2]=r[e+3],c[e/2+1]=r[e+4],c[e/2+2]=r[e+5];const l=i?1:-1;if(0===n.length){const e=new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]);this._geometries.set(t,{position:a,normal:c,index:n,boundingBox:e,hasHoles:!1});const i=this._visitedGeometries.size,r=o.MathUtils.generateUUID(),h=t*l;return this._visitedGeometries.set(h,{uuid:r,index:i}),this._geometryCount++,void s.delete()}const h=3*(this.settings.maxTriangles||n.length/3);let u=!0;for(let e=0;e<n.length;e+=h){const i=n.length-e,s=e+Math.min(i,h),r=[],I=[],d=[];let E=0;for(let t=e;t<s;t++){r.push(E++);const e=n[t];I.push(a[3*e]),I.push(a[3*e+1]),I.push(a[3*e+2]),d.push(c[3*e]),d.push(c[3*e+1]),d.push(c[3*e+2])}const f=new Uint32Array(r),p=new Float32Array(I),C=new Float32Array(d),T=li(p),m=new Float32Array(T.transformation.elements),R=!1,g=u?t:this._nextAvailableID++;if(this._geometries.set(g,{position:p,normal:C,index:f,boundingBox:m,hasHoles:R}),!u){this._splittedGeometries.has(t)||this._splittedGeometries.set(t,new Set);this._splittedGeometries.get(t).add(g)}const A=this._visitedGeometries.size,F=o.MathUtils.generateUUID(),S=g*l;this._visitedGeometries.set(S,{uuid:F,index:A}),this._geometryCount++,u=!1}s.delete()}async streamAssets(){await this.onAssetStreamed.trigger(this._assets),this._assets=null,this._assets=[]}async streamGeometries(){const e=new Map;for(const[t,i]of this._geometries)e.set(t,i),e.size>this.settings.minGeometrySize&&await this.outputGeometries(e);await this.outputGeometries(e),this._geometries.clear(),this._geometryCount=0}async outputGeometries(e){let t=this._streamSerializer.export(e),i={};for(const[t,{boundingBox:s,hasHoles:n}]of e)i[t]={boundingBox:s,hasHoles:n};await this.onGeometryStreamed.trigger({data:i,buffer:t}),i=null,t=null,e.clear()}registerGeometryData(e,t,i,s,n,r){const o=this._visitedGeometries.get(r);if(void 0===o)throw new Error("Error getting geometry data for streaming!");const a=e.data.get(t);if(!a)throw new Error("Data not found!");a[0].push(o.index);const{x:c,y:l,z:h,w:u}=i.color,I=[c,l,h,u],d=i.flatTransformation;s.geometries.push({color:I,geometryID:n,transformation:d})}};t(Sa,"uuid","d9999a00-e1f5-4d3f-8cfe-c56e08609764");let Oa=Sa;class Na extends ur{constructor(){super(...arguments),t(this,"propertiesSize",100)}}class ya extends Ut{constructor(){super(...arguments),t(this,"onPropertiesStreamed",new xt),t(this,"onProgress",new xt),t(this,"onIndicesStreamed",new xt),t(this,"onDisposed",new Dt),t(this,"enabled",!0),t(this,"settings",new Na),t(this,"webIfc",new c.IfcAPI)}async dispose(){this.onIndicesStreamed.reset(),this.onPropertiesStreamed.reset(),this.webIfc=null,this.onDisposed.reset()}async streamFromBuffer(e){await this.readIfcFile(e),await this.streamAllProperties(),this.cleanUp()}async streamFromCallBack(e){await this.streamIfcFile(e),await this.streamAllProperties(),this.cleanUp()}async readIfcFile(e){const{path:t,absolute:i,logLevel:s}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),s&&this.webIfc.SetLogLevel(s),this.webIfc.OpenModel(e,this.settings.webIfc)}async streamIfcFile(e){const{path:t,absolute:i,logLevel:s}=this.settings.wasm;this.webIfc.SetWasmPath(t,i),await this.webIfc.Init(),s&&this.webIfc.SetLogLevel(s),this.webIfc.OpenModelFromCallback(e,this.settings.webIfc)}async streamAllProperties(){const{propertiesSize:e}=this.settings,t=new Set(this.webIfc.GetIfcEntityList(0)),i=new Set([c.IFCPROJECT,c.IFCSITE,c.IFCBUILDING,c.IFCBUILDINGSTOREY,c.IFCSPACE]);for(const e of i)t.add(e);let s=.01,n=0;for(const r of t){if(n++,fr.has(r))continue;const o=i.has(r),a=this.webIfc.GetLineIDsWithType(0,r),c=a.size();let l=0;for(let t=0;t<c-e;t+=e){const i={};for(let s=0;s<e;s++){l++;const e=a.get(t+s);try{const t=this.webIfc.GetLine(0,e,o);i[t.expressID]=t}catch(t){console.log(`Could not get property: ${e}`)}}await this.onPropertiesStreamed.trigger({type:r,data:i})}if(l!==c){const e={};for(let t=l;t<c;t++){const i=a.get(t);try{const t=this.webIfc.GetLine(0,i,o);e[t.expressID]=t}catch(e){console.log(`Could not get property: ${i}`)}}await this.onPropertiesStreamed.trigger({type:r,data:e})}n/t.size>s&&(s=Math.round(100*s)/100,await this.onProgress.trigger(s),s+=.01)}await this.onProgress.trigger(1);const r=this.components.get(Or),o=await r.processFromWebIfc(this.webIfc,0);await this.onIndicesStreamed.trigger(o)}cleanUp(){this.webIfc.Dispose(),this.webIfc=null,this.webIfc=new c.IfcAPI}}t(ya,"uuid","88d2c89c-ce32-47d7-8cb6-d51e4b311a0b");class _a{constructor(e,i,s){t(this,"title"),t(this,"guid",Ii.create()),t(this,"clippingPlanes",new Ht),t(this,"camera",{aspectRatio:1,fov:60,direction:{x:0,y:0,z:0},position:{x:0,y:0,z:0}}),t(this,"exceptionComponents",new Ht),t(this,"selectionComponents",new Ht),t(this,"componentColors",new Wt),t(this,"spacesVisible",!1),t(this,"spaceBoundariesVisible",!1),t(this,"openingsVisible",!1),t(this,"defaultVisibility",!0),t(this,"_components"),t(this,"world");const n={setCamera:!0,...s},{data:r,setCamera:o}=n;this._components=e,this.world=i,r&&(this.guid=r.guid??this.guid,this.set(r)),o&&this.updateCamera()}get _selectionModelIdMap(){const e=this._components.get(yr),t={};for(const[i,s]of e.groups){i in t||(t[i]=new Set);for(const e of this.selectionComponents){const n=s.globalToExpressIDs.get(e);n&&t[i].add(n)}}return t}get _exceptionModelIdMap(){const e=this._components.get(yr),t={};for(const[i,s]of e.groups){i in t||(t[i]=new Set);for(const e of this.exceptionComponents){const n=s.globalToExpressIDs.get(e);n&&t[i].add(n)}}return t}get selection(){return this._components.get(yr).modelIdToFragmentIdMap(this._selectionModelIdMap)}get exception(){return this._components.get(yr).modelIdToFragmentIdMap(this._exceptionModelIdMap)}get projection(){return"fov"in this.camera?"Perspective":"Orthographic"}get position(){const e=this._components.get(yr),{position:t}=this.camera,{x:i,y:s,z:n}=t,r=new o.Vector3(i,s,n);return e.applyBaseCoordinateSystem(r,new o.Matrix4),r}get direction(){const{direction:e}=this.camera,{x:t,y:i,z:s}=e;return new o.Vector3(t,i,s)}get _managerVersion(){return this._components.get(sa).config.version}get topics(){return[...this._components.get(sa).list.values()].filter((e=>e.viewpoints.has(this.guid)))}addComponentsFromMap(e){const t=this._components.get(yr).fragmentIdMapToGuids(e);this.selectionComponents.add(...t);this._components.get(wa).list.set(this.guid,this)}set(e){const t=e,i=this;for(const s in e){if("guid"===s)continue;const e=t[s];"selectionComponents"!==s?"exceptionComponents"!==s?s in this&&(i[s]=e):(this.exceptionComponents.clear(),this.exceptionComponents.add(...e)):(this.selectionComponents.clear(),this.selectionComponents.add(...e))}return this._components.get(wa).list.set(this.guid,this),this}async go(e,t=!0){const{camera:i}=e??this.world;if(!i.hasCameraControls())throw new Error("Viewpoint: the world's camera need controls to set the viewpoint.");i instanceof sr&&i.projection.set(this.projection);const s=new o.Vector3(this.camera.position.x,this.camera.position.y,this.camera.position.z),n=new o.Vector3(this.camera.direction.x,this.camera.direction.y,this.camera.direction.z);if(s.equals(new o.Vector3)&&n.equals(new o.Vector3))return;const r=this.position,a=this.direction;let c={x:r.x+80*a.x,y:r.y+80*a.y,z:r.z+80*a.z};const l=this.selection;if(0===Object.keys(l).length){const e=this._components.get(In).get(this.world).castRayFromVector(r,this.direction);e&&(c=e.point)}else{const e=this._components.get(ra);e.reset(),e.addFragmentIdMap(l),c=e.getSphere().center,e.reset()}await i.controls.setLookAt(r.x,r.y,r.z,c.x,c.y,c.z,t)}updateCamera(e){const{camera:t,renderer:i}=e??this.world;if(!i)throw new Error("Viewpoint: the world needs to have a renderer!");if(!t.hasCameraControls())throw new Error("Viewpoint: world's camera need camera controls!");const s=new o.Vector3;t.controls.getPosition(s);const n=t.three,r=new o.Vector3(0,0,-1).applyEuler(n.rotation),{width:a,height:c}=i.getSize();let l=a/c;Number.isNaN(l)&&(l=1);const h=this._components.get(yr);s.applyMatrix4(h.baseCoordinationMatrix.clone().invert());const u={aspectRatio:l,position:{x:s.x,y:s.y,z:s.z},direction:{x:r.x,y:r.y,z:r.z}};n instanceof o.PerspectiveCamera?this.camera={...u,fov:n.fov}:n instanceof o.OrthographicCamera&&(this.camera={...u,viewToWorldScale:n.top-n.bottom});this._components.get(wa).list.set(this.guid,this)}applyVisibility(){const e=this._components.get(Aa);e.set(this.defaultVisibility),e.set(!this.defaultVisibility,this.exception),e.set(!0,this.selection)}applyColors(){const e=this._components.get(wa),t=this._components.get(yr),i=this._components.get(Ta);for(const[s,n]of this.componentColors){const r=t.guidToFragmentIdMap(n);i.setColor(r,s,e.config.overwriteColors)}}resetColors(){const e=this._components.get(yr),t=this._components.get(Ta);for(const[i,s]of this.componentColors){const i=e.guidToFragmentIdMap(s);t.resetColor(i)}}async createComponentTags(e){var t,i;const s=this._components.get(yr);let n="";if(this._components.get(sa).config.includeSelectionTag){const r="selection"===e?this._selectionModelIdMap:this._exceptionModelIdMap;for(const e in r){const o=s.groups.get(e);if(!o)continue;const a=r[e];for(const e of a){const s=await o.getProperties(e);if(!s)continue;const r=null==(t=s.GlobalId)?void 0:t.value;if(!r)continue;const a=null==(i=s.Tag)?void 0:i.value;let c=null;a&&(c=`AuthoringToolId="${a}"`),n+=`\n<Component IfcGuid="${r}" ${c??""} />`}}}else n=[...this.selectionComponents].map((e=>`<Component IfcGuid="${e}" />`)).join("\n");return n}createColorTags(){let e="";for(const[t,i]of this.componentColors.entries()){e+=`<Color Color="${`#${t.getHexString()}`}">\n${i.map((e=>`\n<Component IfcGuid="${e}" />`)).join("\n")}\n</Color>`}return 0!==e.length?`<Coloring>\n${e}\n</Coloring>`:"<Coloring />"}async serialize(e=this._managerVersion){const t=this._components.get(yr),i=this.position;i.applyMatrix4(t.baseCoordinationMatrix.clone().invert());const s=this.direction;s.normalize();const n=(new o.Matrix4).makeRotationX(Math.PI/2),r=s.clone().applyMatrix4(n);r.normalize();const a=`<CameraViewPoint>\n <X>${i.x}</X>\n <Y>${-i.z}</Y>\n <Z>${i.y}</Z>\n </CameraViewPoint>`,c=`<CameraDirection>\n <X>${s.x}</X>\n <Y>${-s.z}</Y>\n <Z>${s.y}</Z>\n </CameraDirection>`,l=`<CameraUpVector>\n <X>${r.x}</X>\n <Y>${-r.z}</Y>\n <Z>${r.y}</Z>\n </CameraUpVector>`,h=`<AspectRatio>${this.camera.aspectRatio}</AspectRatio>`;let u="";"viewToWorld"in this.camera?u=`<OrthogonalCamera>\n ${a}\n ${c}\n ${l}\n ${h}\n <ViewToWorldScale>${this.camera.viewToWorld}</ViewToWorldScale>\n </OrthogonalCamera>`:"fov"in this.camera&&(u=`<PerspectiveCamera>\n ${a}\n ${c}\n ${l}\n ${h}\n <FieldOfView>${this.camera.fov}</FieldOfView>\n </PerspectiveCamera>`);const I=`<ViewSetupHints SpacesVisible="${this.spacesVisible??!1}" SpaceBoundariesVisible="${this.spaceBoundariesVisible??!1}" OpeningsVisible="${this.openingsVisible??!1}" />`,d=(await this.createComponentTags("selection")).trim(),E=(await this.createComponentTags("exception")).trim(),f=this.createColorTags();return`<?xml version="1.0" encoding="UTF-8"?>\n <VisualizationInfo Guid="${this.guid}">\n <Components>\n ${"2.1"===e?I:""}\n ${0!==d.length?`<Selection>${d}</Selection>`:""}\n <Visibility DefaultVisibility="${this.defaultVisibility}">\n ${"3"===e?I:""}\n ${0!==E.length?`<Exceptions>${E}</Exceptions>`:""}\n </Visibility>\n ${f}\n </Components>\n ${u}\n </VisualizationInfo>`}}class La extends Zi{constructor(){super(...arguments),t(this,"_config",{overwriteColors:{value:!1,type:"Boolean"}})}get overwriteColors(){return this._config.overwriteColors.value}set overwriteColors(e){this._config.overwriteColors.value=e}}const Pa=class e extends Ut{constructor(i){super(i),t(this,"enabled",!0),t(this,"list",new Wt),t(this,"isSetup",!1),t(this,"onSetup",new Dt),t(this,"config",new La(this,this.components,"Viewpoints",e.uuid)),t(this,"onDisposed",new Dt),i.add(e.uuid,this)}create(e,t){const i=new _a(this.components,e,{data:t});return t||this.list.set(i.guid,i),i}setup(){}dispose(){this.list.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}};t(Pa,"uuid","ee867824-a796-408d-8aa0-4e5962a83c66");let wa=Pa;class Ma extends Zi{constructor(){super(...arguments),t(this,"_config",{visible:{value:!0,type:"Boolean"},lockRotation:{value:!0,type:"Boolean"},zoom:{type:"Number",interpolable:!0,value:.05,min:.001,max:5},frontOffset:{type:"Number",interpolable:!0,value:0,min:0,max:100},sizeX:{type:"Number",interpolable:!0,value:320,min:20,max:5e3},sizeY:{type:"Number",interpolable:!0,value:160,min:20,max:5e3},backgroundColor:{value:new o.Color,type:"Color"}})}get visible(){return this._config.visible.value}set visible(e){this._config.visible.value=e;this._component.renderer.domElement.style.display=e?"block":"none"}get lockRotation(){return this._config.lockRotation.value}set lockRotation(e){this._config.lockRotation.value=e,this._component.lockRotation=e}get zoom(){return this._config.zoom.value}set zoom(e){this._config.zoom.value=e,this._component.zoom=e}get frontOffset(){return this._config.frontOffset.value}set frontOffset(e){this._config.frontOffset.value=e,this._component.frontOffset=e}get sizeX(){return this._config.sizeX.value}set sizeX(e){this._config.sizeX.value=e;const{sizeX:t,sizeY:i}=this._config,s=new o.Vector2(t.value,i.value);this._component.resize(s)}get sizeY(){return this._config.sizeY.value}set sizeY(e){this._config.sizeY.value=e;const{sizeX:t,sizeY:i}=this._config,s=new o.Vector2(t.value,i.value);this._component.resize(s)}get backgroundColor(){return this._config.backgroundColor.value}set backgroundColor(e){this._config.backgroundColor.value=e,this._component.backgroundColor=e}}class va{constructor(e,i){if(t(this,"onDisposed",new Dt),t(this,"onAfterUpdate",new Dt),t(this,"onBeforeUpdate",new Dt),t(this,"onResize",new Dt),t(this,"onSetup",new Dt),t(this,"frontOffset",0),t(this,"overrideMaterial",new o.MeshDepthMaterial),t(this,"backgroundColor",new o.Color(395274)),t(this,"renderer"),t(this,"enabled",!0),t(this,"world"),t(this,"config"),t(this,"isSetup",!1),t(this,"_defaultConfig",{visible:!0,lockRotation:!1,zoom:.05,frontOffset:0,sizeX:320,sizeY:160,backgroundColor:new o.Color(395274)}),t(this,"_lockRotation",!0),t(this,"_size",new o.Vector2(320,160)),t(this,"_camera"),t(this,"_plane"),t(this,"_tempVector1",new o.Vector3),t(this,"_tempVector2",new o.Vector3),t(this,"_tempTarget",new o.Vector3),t(this,"down",new o.Vector3(0,-1,0)),t(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})),this.world=e,!this.world.renderer)throw new Error("The given world must have a renderer!");this.renderer=new o.WebGLRenderer,this.renderer.setSize(this._size.x,this._size.y);const s=this._size.x/this._size.y;this._camera=new o.OrthographicCamera(1*s/-2,1*s/2,.5,-.5),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 o.Plane(this.down,200),this.updatePlanes(),this.config=new Ma(this,i,"MiniMap")}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 o.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,0!==this.frontOffset&&(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 e=Math.atan2(this._tempTarget.x-this._tempVector1.x,this._tempTarget.z-this._tempVector1.z);this._camera.rotation.z=e+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;this._camera.left=1*t/-2,this._camera.right=1*t/2,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),this.onResize.trigger(e)}setup(e){const t={...this._defaultConfig,...e};this.config.visible=!0,this.config.lockRotation=t.lockRotation,this.config.zoom=t.zoom,this.config.frontOffset=t.frontOffset,this.config.sizeX=t.sizeX,this.config.sizeY=t.sizeY,this.config.backgroundColor=t.backgroundColor,this.isSetup=!0,this.onSetup.trigger()}}const Da=class e extends Ut{constructor(i){super(i),t(this,"onAfterUpdate",new Dt),t(this,"onBeforeUpdate",new Dt),t(this,"onDisposed",new Dt),t(this,"onSetup",new Dt),t(this,"enabled",!0),t(this,"list",new Map),this.components.add(e.uuid,this)}create(e){if(this.list.has(e.uuid))throw new Error("This world already has a minimap!");const t=new va(e,this.components);return this.list.set(e.uuid,t),t}delete(e){const t=this.list.get(e);t&&t.dispose(),this.list.delete(e)}dispose(){for(const[e,t]of this.list)t.dispose();this.list.clear(),this.onDisposed.trigger()}update(){for(const[e,t]of this.list)t.update()}};t(Da,"uuid","39ad6aad-84c8-4adf-a1e0-7f25313a9e7f");let xa=Da;const ba=class e extends Ut{constructor(i){super(i),t(this,"enabled",!0),i.add(e.uuid,this)}static distanceFromPointToLine(e,t,i,s=!1){const n=new o.Line3,r=new o.Vector3;return n.set(t,i),n.closestPointToPoint(e,s,r),r.distanceTo(e)}getFace(e,t,i){if(!e.geometry.index)throw new Error("Geometry must be indexed!");const s=new Map,n=e.geometry.index.array,{plane:r}=this.getFaceData(t,i,e),o=[];for(let t=0;t<n.length/3;t++){const{plane:n,edges:a}=this.getFaceData(t,i,e);if(n.equals(r)){o.push({index:t,edges:a});for(const{id:e,points:t,distance:i}of a)s.set(e,{points:t,distance:i})}}let a=0;const c=new Map,l=new Map;for(const{index:e,edges:t}of o){const i=new Map;for(const{id:e}of t)if(c.has(e)){const t=c.get(e);i.set(e,t)}const s=t.map((e=>e.id));if(!i.size){const i=a++;for(const{id:e}of t)c.set(e,i);l.set(i,{edges:new Set(s),indices:new Set([e])});continue}let n=null;const r=new Set,o=new Set(s);for(const[e,t]of i){null===n?n=t:t!==n&&r.add(t),c.delete(e);const{edges:i}=l.get(t);i.delete(e),o.delete(e)}if(null===n)throw new Error("Error computing face!");const h=l.get(n),{indices:u}=h;u.add(e);for(const e of o){c.set(e,n);const{edges:t}=h;t.add(e)}for(const e of r){const t=l.get(e),{edges:i,indices:s}=t,r=l.get(n),{edges:o,indices:a}=r;for(const e of i)o.add(e),c.set(e,n);for(const e of s)a.add(e);l.delete(e)}}for(const[e,{indices:i,edges:n}]of l)if(i.has(t)){const e=[];for(const t of n){const i=s.get(t);e.push(i)}return{edges:e,indices:i}}return null}getVerticesAndNormal(e,t,i){if(!e.geometry.index)throw new Error("Geometry must be indexed!");const s=e.geometry.index.array,n=e.geometry.attributes.position.array,r=e.geometry.attributes.normal.array,a=3*s[3*t],c=3*s[3*t+1],l=3*s[3*t+2],h=new o.Vector3(n[a],n[a+1],n[a+2]),u=new o.Vector3(n[c],n[c+1],n[c+2]),I=new o.Vector3(n[l],n[l+1],n[l+2]),d=new o.Vector3(r[a],r[a+1],r[a+2]),E=new o.Vector3(r[c],r[c+1],r[c+2]),f=new o.Vector3(r[l],r[l+1],r[l+2]),p=(d.x+E.x+f.x)/3,C=(d.y+E.y+f.y)/3,T=(d.z+E.z+f.z)/3,m=new o.Vector3(p,C,T);if(void 0!==i&&e instanceof o.InstancedMesh){const t=new o.Matrix4;e.getMatrixAt(i,t);const s=new o.Matrix4;s.extractRotation(t),m.applyMatrix4(s),h.applyMatrix4(t),u.applyMatrix4(t),I.applyMatrix4(t)}return{p1:h,p2:u,p3:I,faceNormal:m}}round(e){const t=1e3;e.x=Math.trunc(e.x*t)/t,e.y=Math.trunc(e.y*t)/t,e.z=Math.trunc(e.z*t)/t}getVolumeFromFragments(e){const t=this.components.get(yr),i=new o.Matrix4,s=[];for(const n in e){const r=t.list.get(n);if(!r)continue;const a=e[n];let c=0;for(const e of a){const t=r.getInstancesIDs(e);t&&(c+=t.size)}const l=new o.InstancedMesh(r.mesh.geometry,void 0,c);let h=0;for(const e of a){const t=r.getInstancesIDs(e);if(t)for(const e of t)r.mesh.getMatrixAt(e,i),l.setMatrixAt(h++,i)}s.push(l)}const n=this.getVolumeFromMeshes(s);for(const e of s)e.geometry=null,e.material=[],e.dispose();return n}getVolumeFromMeshes(e){let t=0;for(const i of e)t+=this.getVolumeOfMesh(i);return t}getFaceData(e,t,i){const s=this.getVerticesAndNormal(i,e,t),{p1:n,p2:r,p3:a,faceNormal:c}=s;this.round(n),this.round(r),this.round(a),this.round(c);const l=[{id:`${n.x}|${n.y}|${n.z}`,value:n},{id:`${r.x}|${r.y}|${r.z}`,value:r},{id:`${a.x}|${a.y}|${a.z}`,value:a}];l.sort(((e,t)=>e.id<t.id?-1:e.id>t.id?1:0));const[{id:h,value:u},{id:I,value:d},{id:E,value:f}]=l,p=[{id:`${h}|${I}`,distance:u.distanceTo(d),points:[u,d]},{id:`${I}|${E}`,distance:d.distanceTo(f),points:[d,f]},{id:`${h}|${E}`,distance:u.distanceTo(f),points:[u,f]}],C=new o.Plane;return C.setFromNormalAndCoplanarPoint(c,n),C.constant=Math.round(10*C.constant)/10,{plane:C,edges:p}}getVolumeOfMesh(e){let t=0;const i=new o.Vector3,s=new o.Vector3,n=new o.Vector3,{index:r}=e.geometry,a=e.geometry.attributes.position.array;if(!r)return console.warn("Geometry must be indexed to compute its volume!"),0;const c=[];if(e instanceof o.InstancedMesh)for(let t=0;t<e.count;t++){const i=new o.Matrix4;e.getMatrixAt(t,i),c.push(i)}else c.push((new o.Matrix4).identity());const{matrixWorld:l}=e;for(let e=0;e<r.array.length-2;e+=3)for(const o of c){const c=o.multiply(l),h=3*r.array[e],u=3*r.array[e+1],I=3*r.array[e+2];i.set(a[h],a[h+1],a[h+2]).applyMatrix4(c),s.set(a[u],a[u+1],a[u+2]).applyMatrix4(c),n.set(a[I],a[I+1],a[I+2]).applyMatrix4(c),t+=this.getSignedVolumeOfTriangle(i,s,n)}return Math.abs(t)}getSignedVolumeOfTriangle(e,t,i){return 1/6*(-(i.x*t.y*e.z)+t.x*i.y*e.z+i.x*e.y*t.z-e.x*i.y*t.z-t.x*e.y*i.z+e.x*t.y*i.z)}};t(ba,"uuid","267ca032-672f-4cb0-afa9-d24e904f39d6");let Ua=ba;class Ba{constructor(e){t(this,"cardinality","required"),t(this,"instructions"),t(this,"evalRequirement",((e,t,i,s)=>{const n={parameter:i,currentValue:e,requiredValue:t.parameter,pass:!1};s&&this.addCheckResult(n,s);let r=!1;if("simple"===t.type&&(r=e===t.parameter),"enumeration"===t.type&&(r=t.parameter.includes(e)),"pattern"===t.type){r=new RegExp(t.parameter).test(String(e))}if("length"===t.type){const{min:i,length:s,max:n}=t.parameter;void 0!==s&&(r=String(e).length===s),void 0!==i&&(r=String(e).length>=i),void 0!==n&&(r=String(e).length<=n)}if("bounds"===t.type&&"number"==typeof e){const{min:i,minInclusive:s,max:n,maxInclusive:o}=t.parameter;let a=!0,c=!0;void 0!==i&&(a=s?e<=i:e<i),void 0!==n&&(c=o?e>=n:e>n),r=a&&c}return"prohibited"===this.cardinality&&(r=!r),"optional"===this.cardinality&&(r=!0),n.pass=r,n.pass})),t(this,"testResult",[]),this.components=e}addCheckResult(e,t){const i=t.findIndex((({parameter:t})=>t===e.parameter));-1!==i?t[i]=e:t.push(e)}saveResult(e,t){const{GlobalId:i}=e;if(!i)return;const{value:s}=i,n={expressID:s,pass:t,checks:[],cardinality:this.cardinality};this.testResult.push(n)}}const Va=(e,t)=>{let i="";if(!t)return i;if("simple"===t.type&&(i=`<ids:simpleValue>${t.parameter}</ids:simpleValue>`),"enumeration"===t.type){i=`<xs:restriction base="xs:string">\n ${t.parameter.map((e=>`<xs:enumeration value="${e}" />`)).join("\r\n")}\n </xs:restriction>`}if("pattern"===t.type){i=`<xs:restriction base="xs:string">\n <xs:pattern value="${t.parameter}" />\n </xs:restriction>`}return`<ids:${e[0].toLowerCase()+e.slice(1)}>\n ${i}\n </ids:${e[0].toLowerCase()+e.slice(1)}>`};class Ya extends Ba{constructor(e,i){super(e),t(this,"facetType","Attribute"),t(this,"name"),t(this,"value"),this.name=i}serialize(e){const t=Va("Name",this.name),i=Va("Value",this.value);let s="";return"requirement"===e&&(s+=`cardinality="${this.cardinality}"`,s+=this.instructions?`instructions="${this.instructions}"`:""),`<ids:attribute ${s}>\n ${t}\n ${i}\n</ids:attribute>`}async getEntities(){return[]}async test(e){var t;this.testResult=[];for(const i in e){const s=Number(i),n=e[s],r=[],o={guid:null==(t=n.GlobalId)?void 0:t.value,expressID:s,pass:!1,checks:r,cardinality:this.cardinality};this.testResult.push(o);const a=Object.keys(n).filter((e=>{const t=this.evalRequirement(e,this.name,"Name"),i=n[e];return t&&null===i?"optional"===this.cardinality||"prohibited"===this.cardinality:(!t||3!==(null==i?void 0:i.type)||2!==i.value)&&((!t||!Array.isArray(i)||0!==i.length)&&((!t||1!==(null==i?void 0:i.type)||""!==i.value.trim())&&t))})),c=a.length>0;if(r.push({parameter:"Name",currentValue:c?a[0]:null,requiredValue:this.name.parameter,pass:"prohibited"===this.cardinality?!c:c}),this.value)if(a[0]){const e=n[a[0]];5===(null==e?void 0:e.type)?r.push({parameter:"Value",currentValue:null,requiredValue:this.value.parameter,pass:"prohibited"===this.cardinality}):this.evalRequirement(e?e.value:null,this.value,"Value",r)}else r.push({parameter:"Value",currentValue:null,requiredValue:this.value.parameter,pass:"prohibited"===this.cardinality});o.pass=r.every((({pass:e})=>e))}const i=[...this.testResult];return this.testResult=[],i}}class Ga extends Ba{constructor(e,i){super(e),t(this,"facetType","Classification"),t(this,"system"),t(this,"value"),t(this,"uri"),this.system=i}serialize(e){const t=Va("System",this.system),i=Va("Value",this.value);let s="";return"requirement"===e&&(s+=`cardinality="${this.cardinality}"`,s+=this.uri?`uri=${this.uri}`:"",s+=this.instructions?`instructions="${this.instructions}"`:""),`<ids:classification ${s}>\n ${t}\n ${i}\n</ids:classification>`}async getEntities(e,t={}){var i;const s=[],n={...await e.getAllPropertiesOfType(c.IFCCLASSIFICATIONREFERENCE),...await e.getAllPropertiesOfType(c.IFCCLASSIFICATION)},r=[];for(const t in n){const s=Number(t),n=await e.getProperties(s);if(!n)continue;const o=null==(i=n.ReferencedSource)?void 0:i.value;if(!o)continue;const a=await e.getProperties(o);if(!a)continue;if(!this.evalSystem(a))continue;if(!this.evalValue(n))continue;this.evalURI(n)&&r.push(s)}const o=this.components.get(Or);for(const i of r){const n=o.getEntitiesWithRelation(e,"HasAssociations",i);for(const i of n){if(i in t)continue;const n=await e.getProperties(i);n&&(t[i]=n,s.push(i))}}return s}async test(e,t){var i;this.testResult=[];for(const s in e){const n=Number(s),r=[],o={guid:null==(i=e[n].GlobalId)?void 0:i.value,expressID:n,pass:!1,checks:r,cardinality:this.cardinality};this.testResult.push(o);let a=!0;const l=await this.getSystems(t,n),h=l.map((e=>this.getSystemName(e))).filter((e=>e));for(const e of l){if(!this.evalSystem(e,r))continue;if(a=!1,!this.value||!this.system)break;if(e.type!==c.IFCCLASSIFICATIONREFERENCE)continue;const t=!this.value||this.evalValue(e,r),i=!this.uri||this.evalURI(e,r);if(t&&i)break}a&&this.addCheckResult({parameter:"System",currentValue:h,requiredValue:this.system,pass:"optional"===this.cardinality},r),o.pass=r.every((({pass:e})=>e))}const s=[...this.testResult];return this.testResult=[],s}async processReferencedSource(e,t){var i;const s=null==(i=t.ReferencedSource)?void 0:i.value;if(!s)return null;const n=await e.getProperties(s);return n?(n.type===c.IFCCLASSIFICATIONREFERENCE&&(n.ReferencedSource=await this.processReferencedSource(e,n)),n):null}async getSystems(e,t){var i;const s=[],n=this.components.get(Or),r=n.getEntityRelations(e,t,"HasAssociations");if(r)for(const t of r){const i=await e.getProperties(t);i&&(i.type===c.IFCCLASSIFICATION&&s.push(i),i.type===c.IFCCLASSIFICATIONREFERENCE&&(i.ReferencedSource=await this.processReferencedSource(e,i),i.ReferencedSource&&s.push(i)))}const o=s.map((e=>{var t,i,s;return e.type===c.IFCCLASSIFICATION?null==(t=e.Name)?void 0:t.value:e.type===c.IFCCLASSIFICATIONREFERENCE?null==(s=null==(i=e.ReferencedSource)?void 0:i.Name)?void 0:s.value:null})).filter((e=>e)),a=n.getEntityRelations(e,t,"IsTypedBy");if(!a||!a[0])return s;const l=a[0],h=n.getEntityRelations(e,l,"HasAssociations");if(h)for(const t of h){const n=await e.getProperties(t);if(n){if(n.type===c.IFCCLASSIFICATION){if(o.includes(null==(i=n.Name)?void 0:i.value))continue;s.push(n)}n.type===c.IFCCLASSIFICATIONREFERENCE&&(n.ReferencedSource=await this.processReferencedSource(e,n),n.ReferencedSource&&s.push(n))}}return s}getSystemName(e){var t,i,s,n;if(e.type===c.IFCCLASSIFICATION)return null==(t=e.Name)?void 0:t.value;if(e.type===c.IFCCLASSIFICATIONREFERENCE){if((null==(i=e.ReferencedSource)?void 0:i.type)===c.IFCCLASSIFICATIONREFERENCE)return this.getSystemName(e.ReferencedSource);if((null==(s=e.ReferencedSource)?void 0:s.type)===c.IFCCLASSIFICATION)return null==(n=e.ReferencedSource.Name)?void 0:n.value}return null}getAllReferenceIdentifications(e){if(e.type!==c.IFCCLASSIFICATIONREFERENCE)return null;const t=[];if(e.Identification&&t.push(e.Identification.value),e.ReferencedSource){const i=this.getAllReferenceIdentifications(e.ReferencedSource);i&&t.push(...i)}return t}evalSystem(e,t){const i=this.getSystemName(e);return this.evalRequirement(i,this.system,"System",t)}evalValue(e,t){if(!this.value)return!0;const i=this.getAllReferenceIdentifications(e);if(!i)return!1;const s=i.find((e=>!!this.value&&this.evalRequirement(e,this.value,"Value")));return t&&this.addCheckResult({parameter:"Value",currentValue:s??null,requiredValue:this.value,pass:!!s},t),!!s}evalURI(e,t){var i;if(!this.uri)return!0;return this.evalRequirement(null==(i=e.Location)?void 0:i.value,{type:"simple",parameter:this.uri},"URI",t)}}class za extends Ba{constructor(e,i){super(e),t(this,"facetType","Entity"),t(this,"name"),t(this,"predefinedType"),this.name=i}serialize(e){const t=Va("Name",this.name),i=Va("Name",this.predefinedType);let s="";return"requirement"===e&&(s+=`cardinality="${this.cardinality}"`,s+=this.instructions?`instructions="${this.instructions}"`:""),`<ids:entity ${s}>\n ${t}\n ${i}\n</ids:entity>`}async getEntities(e,t={}){const i=Object.entries(or),s=[];for(const[e]of i){await this.evalName({type:e})&&s.push(Number(e))}let n={};for(const t of s){const i=await e.getAllPropertiesOfType(t);i&&(n={...n,...i})}if(!this.predefinedType){for(const e in n)e in t||(t[e]=n[e]);return Object.keys(n).map(Number)}const r=[];for(const i in n){const s=Number(i);if(s in t)continue;const o=n[s];await this.evalPredefinedType(e,o)&&(t[s]=o,r.push(s))}return r}async test(e,t){var i;this.testResult=[];for(const s in e){const n=Number(s),r=e[n],o=[],a={guid:null==(i=r.GlobalId)?void 0:i.value,expressID:n,pass:!1,checks:o,cardinality:this.cardinality};this.testResult.push(a),await this.evalName(r,o),await this.evalPredefinedType(t,r,o),a.pass=o.every((({pass:e})=>e))}return this.testResult}async evalName(e,t){const i=or[e.type];return this.evalRequirement(i,this.name,"Name",t)}async evalPredefinedType(e,t,i){var s,n,r,o;if(!this.predefinedType)return null;const a=this.components.get(Or),c="string"==typeof this.predefinedType.parameter&&"USERDEFINED"===this.predefinedType.parameter;let l=null==(s=t.PredefinedType)?void 0:s.value;if("USERDEFINED"===l&&!c){const e=Object.keys(t).find((e=>/^((?!Predefined).)*Type$/.test(e)));l=e?null==(n=t[e])?void 0:n.value:"USERDEFINED"}if(!l){const i=a.getEntityRelations(e,t.expressID,"IsTypedBy");if(i&&i[0]){const t=await e.getProperties(i[0]);if(t&&(l=null==(r=t.PredefinedType)?void 0:r.value,"USERDEFINED"===l&&!c)){const e=Object.keys(t).find((e=>/^((?!Predefined).)*Type$/.test(e)));l=e?null==(o=t[e])?void 0:o.value:"USERDEFINED"}}}return this.evalRequirement(l,this.predefinedType,"PredefinedType",i)}}class ka extends Ba{constructor(e,i,s){super(e),t(this,"facetType","Property"),t(this,"propertySet"),t(this,"baseName"),t(this,"value"),t(this,"dataType"),t(this,"uri"),t(this,"_unsupportedTypes",[c.IFCCOMPLEXPROPERTY,c.IFCPHYSICALCOMPLEXQUANTITY]),this.propertySet=i,this.baseName=s}serialize(e){const t=Va("PropertySet",this.propertySet),i=Va("BaseName",this.baseName),s=Va("Value",this.value),n=this.dataType?`dataType=${this.dataType}`:"";let r="";return"requirement"===e&&(r+=`cardinality="${this.cardinality}"`,r+=this.uri?`uri=${this.uri}`:"",r+=this.instructions?`instructions="${this.instructions}"`:""),`<ids:property ${n} ${r}>\n ${t}\n ${i}\n ${s}\n</ids:property>`}async getEntities(e,t={}){var i,s;let n={};const r=await e.getAllPropertiesOfType(c.IFCPROPERTYSET);n={...n,...r};const o=await e.getAllPropertiesOfType(c.IFCELEMENTQUANTITY);if(n={...n,...o},0===Object.keys(n).length)return[];const a=[];for(const t in n){const n=Number(t),r=await e.getProperties(n);if(!r)continue;if(!((null==(i=r.Name)?void 0:i.value)===this.propertySet.parameter))continue;let o;if(r.type===c.IFCPROPERTYSET&&(o="HasProperties"),r.type===c.IFCELEMENTQUANTITY&&(o="Quantities"),o)for(const t of r[o]){const i=await e.getProperties(t.value);if(!i)continue;if((null==(s=i.Name)?void 0:s.value)===this.baseName.parameter){if(this.value){const e=Object.keys(i).find((e=>e.endsWith("Value")));if(!e)continue;if(!(i[e].value===this.value.parameter))continue}a.push(n)}}}const l=this.components.get(Or);for(const i of a){const s=l.getEntitiesWithRelation(e,"IsDefinedBy",i);for(const i of s){if(i in t)continue;const s=await e.getProperties(i);s&&(t[i]=s)}}return[]}async test(e,t){var i;this.testResult=[];for(const s in e){const n=Number(s),r=e[n],o=[],a={guid:null==(i=r.GlobalId)?void 0:i.value,expressID:n,pass:!1,checks:o,cardinality:this.cardinality};this.testResult.push(a);const c=(await this.getPsets(t,n)).filter((e=>{var t;return!!this.evalRequirement((null==(t=e.Name)?void 0:t.value)??null,this.propertySet,"PropertySet")&&(o.push({currentValue:e.Name.value,parameter:"PropertySet",pass:!0,requiredValue:this.propertySet.parameter}),!0)}));if(0!==c.length){for(const e of c){const t=this.getItemsAttrName(e.type);if(!t){o.push({currentValue:null,parameter:"BaseName",pass:!1,requiredValue:this.baseName.parameter});continue}const i=e[t].filter((e=>{var t;if(this._unsupportedTypes.includes(e.type))return!1;return!!this.evalRequirement((null==(t=e.Name)?void 0:t.value)??null,this.baseName,"BaseName")&&(o.push({currentValue:e.Name.value,parameter:"BaseName",pass:!0,requiredValue:this.baseName.parameter}),!0)}));if(0!==i.length)for(const e of i)this.evalValue(e,o),this.evalDataType(e,o),this.evalURI();else o.push({currentValue:null,parameter:"BaseName",pass:!1,requiredValue:this.baseName.parameter})}a.pass=o.every((({pass:e})=>e))}else o.push({currentValue:null,parameter:"PropertySet",pass:!1,requiredValue:this.propertySet.parameter})}const s=[...this.testResult];return this.testResult=[],s}getItemsAttrName(e){let t;return e===c.IFCPROPERTYSET&&(t="HasProperties"),e===c.IFCELEMENTQUANTITY&&(t="Quantities"),t}getValueKey(e){return Object.keys(e).find((e=>e.endsWith("Value")||e.endsWith("Values")))}async getPsetProps(e,t,i){const s=structuredClone(t),n=[],r=s[i];if(!r)return n;for(const{value:t}of r){const i=await e.getProperties(t);i&&n.push(i)}return s[i]=n,s}async getTypePsets(e,t){const i=[],s=this.components.get(Or).getEntityRelations(e,t,"IsTypedBy");if(!s||!s[0])return i;const n=await e.getProperties(s[0]);if(!(n&&"HasPropertySets"in n&&Array.isArray(n.HasPropertySets)))return i;for(const{value:t}of n.HasPropertySets){const s=await e.getProperties(t);if(!(s&&"HasProperties"in s&&Array.isArray(s.HasProperties)))continue;const n=await this.getPsetProps(e,s,"HasProperties");i.push(n)}return i}async getPsets(e,t){const i=await this.getTypePsets(e,t),s=this.components.get(Or).getEntityRelations(e,t,"IsDefinedBy");if(!s)return i;for(const t of s){const s=await e.getProperties(t);if(!s)continue;const n=this.getItemsAttrName(s.type);if(!n)continue;const r=await this.getPsetProps(e,s,n);i.push(r)}return i}evalValue(e,t){const i=this.getValueKey(e),s=e[i];if(this.value){if(!s)return null==t||t.push({parameter:"Value",currentValue:null,pass:!1,requiredValue:this.value.parameter}),!1;const i=structuredClone(this.value);if("IFCLABEL"===s.name&&"simple"===i.type&&(i.parameter=String(i.parameter)),(e.type===c.IFCPROPERTYLISTVALUE||e.type===c.IFCPROPERTYENUMERATEDVALUE)&&Array.isArray(s)){const e=s.map((e=>e.value)),n=s.find((e=>!!i&&this.evalRequirement(e.value,i,"Value")));return null==t||t.push({currentValue:e,pass:!!n,parameter:"Value",requiredValue:i.parameter}),!!n}return this.evalRequirement(s.value,i,"Value",t)}return!i||(3===s.type&&2===s.value?(null==t||t.push({parameter:"Value",currentValue:null,pass:!1,requiredValue:null}),!1):1!==s.type||""!==s.value.trim()||(null==t||t.push({parameter:"Value",currentValue:"",pass:!1,requiredValue:null}),!1))}evalDataType(e,t){if(!this.dataType)return!0;const i=e[this.getValueKey(e)];if(!i)return null==t||t.push({parameter:"DataType",currentValue:null,pass:!1,requiredValue:this.dataType}),!1;if((e.type===c.IFCPROPERTYLISTVALUE||e.type===c.IFCPROPERTYENUMERATEDVALUE)&&Array.isArray(i)&&i[0]){const e=i[0].name;return this.evalRequirement(e,{type:"simple",parameter:this.dataType},"DataType",t)}return this.evalRequirement(i.name,{type:"simple",parameter:this.dataType},"DataType",t)}evalURI(){return!0}}class Ha{constructor(e,i,s){t(this,"name"),t(this,"ifcVersion",new Set),t(this,"identifier",Ii.create()),t(this,"description"),t(this,"instructions"),t(this,"requirementsDescription"),t(this,"applicability",new Ht),t(this,"requirements",new Ht),t(this,"components"),this.components=e,this.name=i;for(const e of s)this.ifcVersion.add(e)}set(e){const t=e,i=this;for(const s in e){if("identifier"===s)continue;const e=t[s];s in this&&(i[s]=e)}return this.components.get(qa).list.set(this.identifier,this),this}async test(e){let t=[];if(0===this.requirements.size)return t;const i={};for(const t of this.applicability)await t.getEntities(e,i);const s=[...this.requirements][0];return t=await s.test(i,e),t}serialize(){const e=`name="${this.name}"`,t=this.identifier?`identifier="${this.identifier}"`:"",i=this.description?`description="${this.description}"`:"",s=this.instructions?`instructions="${this.instructions}"`:"";return`<ids:specification ifcVersion="${[...this.ifcVersion].join(" ")}" ${e} ${t} ${i} ${s}>\n <ids:applicability minOccurs="1" maxOccurs="unbounded">\n ${[...this.applicability].map((e=>e.serialize("applicability")))}\n </ids:applicability>\n <ids:requirements>\n ${[...this.requirements].map((e=>e.serialize("requirement")))}\n </ids:requirements>\n </ids:specification>`}}const Wa=e=>{if(!e)return;const t={};if("simpleValue"in e&&(t.type="simple",t.parameter=e.simpleValue),"restriction"in e){const i=e.restriction;if("pattern"in i&&(t.type="pattern",t.parameter=i.pattern.value),"enumeration"in i){t.type="enumeration";const e=i.enumeration.map((({value:e})=>e));t.parameter=e}}return void 0!==t.parameter?t:void 0},Xa=(e,t)=>{const i=[];for(const s of t){const t=s.name,n=Wa(t);if(!n)continue;const r=new za(e,n);s.cardinality&&(r.cardinality=s.cardinality),r.predefinedType=Wa(s.predefinedType),r.instructions=s.instructions,i.push(r)}return i},Za=(e,t)=>{const i=[];for(const s of t){const t=s.name,n=Wa(t);if(!n)continue;const r=new Ya(e,n);s.cardinality&&(r.cardinality=s.cardinality),r.value=Wa(s.value),r.instructions=s.instructions,i.push(r)}return i},ja=(e,t)=>{const i=[];for(const s of t){const t=s.system,n=Wa(t);if(!n)continue;const r=new Ga(e,n);s.cardinality&&(r.cardinality=s.cardinality);const o=Wa(s.value);"simple"===(null==o?void 0:o.type)&&(o.parameter=String(o.parameter)),"enumeration"===(null==o?void 0:o.type)&&Array.isArray(o.parameter)&&(o.parameter=o.parameter.map(String)),r.value=o,r.uri=s.uri,r.instructions=s.instructions,i.push(r)}return i},$a=(e,t)=>{const i=[];for(const s of t){const t=s.propertySet,n=s.baseName,r=Wa(t),o=Wa(n);if(!o||!r)continue;const a=new ka(e,r,o);s.cardinality&&(a.cardinality=s.cardinality);const c=Wa(s.value);"enumeration"===(null==c?void 0:c.type)&&Array.isArray(c.parameter)&&(c.parameter=c.parameter.map(String)),a.value=c,a.dataType=s.dataType,a.uri=s.uri,a.instructions=s.instructions,i.push(a)}return i},Qa=class e extends Ut{constructor(i){super(i),t(this,"enabled",!0),t(this,"list",new Wt),i.add(e.uuid,this)}getFragmentIdMap(e,t){const i=t.filter((e=>e.pass)).map((e=>e.expressID)),s=e.getFragmentMap(i),n=t.filter((e=>!e.pass)).map((e=>e.expressID));return{pass:s,fail:e.getFragmentMap(n)}}create(e,t,i){const s=new Ha(this.components,e,t);return i&&(s.identifier=i),this.list.set(s.identifier,s),s}load(t){const i=[],s=e.xmlParser.parse(t).ids,{specifications:n}=s;if(n&&n.specification){const e=Array.isArray(n.specification)?n.specification:[n.specification];for(const t of e){const{name:e,ifcVersion:s,description:n,instructions:r,identifier:o}=t;if(!e||!s)continue;const a=[],c=[],{applicability:l,requirements:h}=t;if(l){const{maxOccurs:e,...t}=l,i=Array.isArray(t)?t:[t];for(const e of i)for(const t in e){const i=Array.isArray(e[t])?e[t]:[e[t]];if("entity"===t){const e=Xa(this.components,i);a.push(...e)}}}let u;if(h){const{maxOccurs:e,...t}=h;u=h.description;const i=Array.isArray(t)?t:[t];for(const e of i)for(const t in e){const i=Array.isArray(e[t])?e[t]:[e[t]];if("entity"===t){const e=Xa(this.components,i);c.push(...e)}if("attribute"===t){const e=Za(this.components,i);c.push(...e)}if("classification"===t){const e=ja(this.components,i);c.push(...e)}if("property"===t){const e=$a(this.components,i);c.push(...e)}}}if(a.length>0&&c.length>0){const t=this.create(e,s.split(/\s+/),o);t.description=n,t.instructions=r,t.requirementsDescription=u,t.applicability.add(...a),t.requirements.add(...c),i.push(t)}}}return i}export(e,t=this.list.values()){const i=t??this.list;return`<ids:ids xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://standards.buildingsmart.org/IDS http://standards.buildingsmart.org/IDS/1.0/ids.xsd" xmlns:ids="http://standards.buildingsmart.org/IDS">\n \x3c!-- Made with That Open Engine ${Wi.release} (https://github.com/thatopen/engine_components) --\x3e\n <ids:info>\n <ids:title>${e.title}</ids:title>\n ${e.copyright?`<ids:copyright>${e.copyright}</ids:copyright>`:""}\n ${e.version?`<ids:version>${e.version}</ids:version>`:""}\n ${e.description?`<ids:description>${e.description}</ids:description>`:""}\n ${e.author?`<ids:author>${e.author}</ids:author>`:""}\n ${e.date?`<ids:date>${e.date.toISOString().split("T")[0]}</ids:date>`:""}\n ${e.purpose?`<ids:purpose>${e.purpose}</ids:purpose>`:""}\n ${e.milestone?`<ids:milestone>${e.milestone}</ids:milestone>`:""}\n </ids:info>\n <ids:specifications>\n ${[...i].map((e=>e.serialize())).join("\n")}\n </ids:specifications>\n</ids:ids>`}};t(Qa,"uuid","9f0b9f78-9b2e-481a-b766-2fbfd01f342c"),t(Qa,"xmlParser",new Qo.XMLParser({allowBooleanAttributes:!0,attributeNamePrefix:"",ignoreAttributes:!1,ignoreDeclaration:!0,ignorePiTags:!0,numberParseOptions:{leadingZeros:!0,hex:!0},parseAttributeValue:!0,preserveOrder:!1,processEntities:!1,removeNSPrefix:!0,trimValues:!0}));let qa=Qa;exports.AsyncEvent=xt,exports.BCFTopics=sa,exports.BCFTopicsConfigManager=ta,exports.Base=bt,exports.BaseCamera=Vt,exports.BaseRenderer=Yt,exports.BaseScene=kt,exports.BaseWorldItem=Bt,exports.BoundingBoxer=ra,exports.Classifier=Ta,exports.Clipper=Kn,exports.Comment=qo,exports.Component=Ut,exports.ComponentWithUI=class extends Ut{},exports.Components=Wi,exports.ConfigManager=$i,exports.Configurator=Zi,exports.ControlsUtils=Xt,exports.CullerRenderer=nn,exports.Cullers=an,exports.DataMap=Wt,exports.DataSet=Ht,exports.Disposer=zt,exports.Event=Dt,exports.EventManager=class{constructor(){t(this,"list",new Set)}add(e){for(const t of e)this.list.add(t)}remove(e){for(const t of e)this.list.delete(t)}set(e){for(const t of this.list)t.enabled=e}reset(){for(const e of this.list)e.reset()}},exports.Exploder=Ra,exports.FirstPersonMode=Jn,exports.FragmentsManager=yr,exports.GeometryTypes=fr,exports.Grids=pn,exports.Hider=Aa,exports.IDSAttribute=Ya,exports.IDSClassification=Ga,exports.IDSEntity=za,exports.IDSFacet=Ba,exports.IDSProperty=ka,exports.IDSSpecification=Ha,exports.IDSSpecifications=qa,exports.IfcBasicQuery=Ia,exports.IfcCategories=class{getAll(e,t){const i={},s=Object.keys(rr).map((e=>parseInt(e,10)));for(let n=0;n<s.length;n++){const r=s[n],o=e.GetLineIDsWithType(t,r),a=o.size();for(let e=0;e<a;e++)i[o.get(e)]=r}return i}},exports.IfcCategoryMap=or,exports.IfcElements=rr,exports.IfcFinder=pa,exports.IfcFinderQuery=la,exports.IfcFragmentSettings=ur,exports.IfcGeometryTiler=Oa,exports.IfcIsolator=aa,exports.IfcJsonExporter=Cr,exports.IfcLoader=mr,exports.IfcPropertiesManager=Fr,exports.IfcPropertiesTiler=ya,exports.IfcPropertiesUtils=ar,exports.IfcPropertyQuery=Ea,exports.IfcRelationsIndexer=Or,exports.IfcStreamingSettings=Fa,exports.MaterialsUtils=hi,exports.MeasurementUtils=Ua,exports.MeshCullerRenderer=rn,exports.MiniMap=va,exports.MiniMapConfigManager=Ma,exports.MiniMaps=xa,exports.Mouse=ln,exports.OrbitMode=er,exports.OrthoPerspectiveCamera=sr,exports.PlanMode=tr,exports.ProjectionManager=ir,exports.PropertiesStreamingSettings=Na,exports.Raycasters=In,exports.SectionGenerator=ki,exports.ShadowedScene=class extends Ji{constructor(){super(...arguments),t(this,"_distanceRenderer"),t(this,"autoBias",!0),t(this,"_defaultShadowConfig",{cascade:1,resolution:512}),t(this,"_lightsWithShadow",new Map),t(this,"_isComputingShadows",!1),t(this,"_shadowsEnabled",!0),t(this,"_bias",0),t(this,"recomputeShadows",(e=>{if(!this._shadowsEnabled)return;this.autoBias&&(this.bias=e/-1e5);if(e*=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 t=this.currentWorld.camera.three;if(!(t instanceof o.PerspectiveCamera||t instanceof o.OrthographicCamera))throw new Error("Invalid camera type!");const i=new o.Vector3;t.getWorldDirection(i);let s=e;const n=new o.Vector3;n.copy(this.config.directionalLight.position),n.normalize();for(const[e,r]of this._lightsWithShadow){const a=this.directionalLights.get(r);if(!a)throw new Error("Light not found.");const c=new o.Vector3;c.copy(i);const l=e===this._lightsWithShadow.size-1,h=l?s/2:2*s/3;c.multiplyScalar(h),c.add(t.position);const u=s-h,I=new o.Vector3;I.copy(n),I.multiplyScalar(u),a.target.position.copy(c),a.position.copy(c),a.position.add(I),a.shadow.camera.right=u,a.shadow.camera.left=-u,a.shadow.camera.top=u,a.shadow.camera.bottom=-u,a.shadow.camera.far=2*u,a.shadow.camera.updateProjectionMatrix(),a.shadow.camera.updateMatrix(),l||(s/=3)}this._isComputingShadows=!1}))}get bias(){return this._bias}set bias(e){this._bias=e;for(const[,t]of this._lightsWithShadow){const i=this.directionalLights.get(t);i&&(i.shadow.bias=e)}}get shadowsEnabled(){return this._shadowsEnabled}set shadowsEnabled(e){this._shadowsEnabled=e;for(const[,t]of this.directionalLights)t.castShadow=e}get distanceRenderer(){if(!this._distanceRenderer)throw new Error("You must set up this component before accessing the distance renderer!");return this._distanceRenderer}setup(e){super.setup(e);const t={...this._defaultConfig,...this._defaultShadowConfig,...e};if(t.cascade<=0)throw new Error("Config.shadows.cascade must be a natural number greater than 0!");if(t.cascade>1)throw new Error("Multiple shadows not supported yet!");if(!this.currentWorld)throw new Error("A world needs to be assigned to the scene before setting it up!");for(const[,e]of this.directionalLights)e.target.removeFromParent(),e.removeFromParent(),e.dispose();this.directionalLights.clear(),this._distanceRenderer||(this._distanceRenderer=new cn(this.components,this.currentWorld),this._distanceRenderer.onDistanceComputed.add(this.recomputeShadows)),this._lightsWithShadow.clear();for(let e=0;e<t.cascade;e++){const i=new o.DirectionalLight;i.intensity=this.config.directionalLight.intensity,i.color=this.config.directionalLight.color,i.position.copy(this.config.directionalLight.position),i.shadow.mapSize.width=t.resolution,i.shadow.mapSize.height=t.resolution,this.three.add(i,i.target),this.directionalLights.set(i.uuid,i),this._lightsWithShadow.set(e,i.uuid),i.castShadow=!0,i.shadow.bias=this._bias}}dispose(){super.dispose(),this._distanceRenderer&&this._distanceRenderer.dispose(),this._lightsWithShadow.clear()}async updateShadows(){!this._isComputingShadows&&this._shadowsEnabled&&(this._isComputingShadows=!0,await this.distanceRenderer.compute())}},exports.SimpleCamera=qs,exports.SimpleGrid=En,exports.SimpleGridConfigManager=dn,exports.SimplePlane=$n,exports.SimpleRaycaster=hn,exports.SimpleRenderer=class extends Yt{constructor(e,i,s){super(e),t(this,"enabled",!0),t(this,"container"),t(this,"three"),t(this,"_canvas"),t(this,"_parameters"),t(this,"_resizeObserver",null),t(this,"onContainerUpdated",new Dt),t(this,"_resizing",!1),t(this,"resize",(e=>{if(this._resizing)return;this._resizing=!0,this.onContainerUpdated.trigger();const t=e?e.x:this.container.clientWidth,i=e?e.y:this.container.clientHeight;this.three.setSize(t,i),this.onResize.trigger(new o.Vector2(t,i)),this._resizing=!1})),t(this,"resizeEvent",(()=>{this.resize()})),t(this,"onContextLost",(e=>{e.preventDefault(),this.enabled=!1})),t(this,"onContextBack",(()=>{this.three.setRenderTarget(null),this.three.dispose(),this.three=new o.WebGLRenderer({canvas:this._canvas,antialias:!0,alpha:!0,...this._parameters}),this.enabled=!0})),this.container=i,this._parameters=s,this.three=new o.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:r}=n;r.addEventListener("webglcontextlost",this.onContextLost,!1),r.addEventListener("webglcontextrestored",this.onContextBack,!1)}update(){if(!this.enabled||!this.currentWorld)return;this.onBeforeUpdate.trigger(this);const e=this.currentWorld.scene.three,t=this.currentWorld.camera.three;this.three.render(e,t),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 o.Vector2(this.three.domElement.clientWidth,this.three.domElement.clientHeight)}setupEvents(e){const t=this.three.domElement.parentElement;if(!t)throw new Error("This renderer needs to have an HTML container!");this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),window.removeEventListener("resize",this.resizeEvent),e&&(this._resizeObserver=new ResizeObserver(this.resizeEvent),this._resizeObserver.observe(t),window.addEventListener("resize",this.resizeEvent))}setupRenderer(){this.three.localClippingEnabled=!0,this.container&&this.container.appendChild(this.three.domElement),this.onContainerUpdated.trigger()}},exports.SimpleScene=Ji,exports.SimpleSceneConfigManager=Ki,exports.SimpleWorld=Xi,exports.Topic=Jo,exports.UUID=Ii,exports.VertexPicker=class extends Ut{constructor(e,i){super(e),t(this,"onDisposed",new Dt),t(this,"onVertexFound",new Dt),t(this,"onVertexLost",new Dt),t(this,"onEnabled",new Dt),t(this,"components"),t(this,"workingPlane",null),t(this,"_pickedPoint",null),t(this,"_config"),t(this,"_enabled",!1),this.components=e,this.config={snapDistance:.25,showOnlyVertex:!1,...i},this.enabled=!1}set enabled(e){this._enabled=e,e||(this._pickedPoint=null),this.onEnabled.trigger(e)}get enabled(){return this._enabled}set config(e){this._config={...this._config,...e}}get config(){return this._config}dispose(){this.onVertexFound.reset(),this.onVertexLost.reset(),this.components=null,this.onDisposed.trigger(),this.onDisposed.reset()}get(e){if(!this.enabled)return this._pickedPoint;const t=this.components.get(In).get(e).castRay();if(!t)return null!==this._pickedPoint&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint;const i=this.getClosestVertex(t);if(!i)return null!==this._pickedPoint&&(this.onVertexLost.trigger(),this._pickedPoint=null),this._pickedPoint;return!this.workingPlane||Math.abs(this.workingPlane.distanceToPoint(i))<.001?(null!==this._pickedPoint&&this._pickedPoint.equals(i)||(this._pickedPoint=i.clone(),this.onVertexFound.trigger(this._pickedPoint)),this._pickedPoint):(this._pickedPoint=null,this._pickedPoint)}getClosestVertex(e){let t=new o.Vector3,i=!1,s=Number.MAX_SAFE_INTEGER;const n=this.getVertices(e);if(null===n)return null;for(const r of n){if(!r)continue;const n=e.point.distanceTo(r);n>s||n>this._config.snapDistance||(i=!0,t=r,s=e.point.distanceTo(r))}return i?t:this.config.showOnlyVertex?null:e.point}getVertices(e){const t=e.object;if(!e.face||!t)return null;const i=t.geometry,s=new o.Matrix4,{instanceId:n}=e,r=void 0!==n,a=t instanceof o.InstancedMesh;return a&&r&&t.getMatrixAt(n,s),[this.getVertex(e.face.a,i),this.getVertex(e.face.b,i),this.getVertex(e.face.c,i)].map((e=>(e&&(a&&r&&e.applyMatrix4(s),e.applyMatrix4(t.matrixWorld)),e)))}getVertex(e,t){if(void 0===e)return null;const i=t.attributes.position;return new o.Vector3(i.getX(e),i.getY(e),i.getZ(e))}},exports.Viewpoint=_a,exports.Viewpoints=wa,exports.Worlds=Js,exports.extensionsImporter=ea,exports.ifcCategoryCase=cr,exports.ifcRelAttrsPosition=Rr,exports.ifcRelClassNames=gr,exports.isPointInFrontOfPlane=function(e,t,i){const s=[e[0]-t[0],e[1]-t[1],e[2]-t[2]];return i[0]*s[0]+i[1]*s[1]+i[2]*s[2]>0},exports.obbFromPoints=li,exports.readPixelsAsync=tn,exports.relToAttributesMap=nr;