const t=!1,e=!0,i=new Float32Array(1),n=new Int32Array(i.buffer);class s{endianness=e;position=0;get length(){throw new Error("Deprecated, use 'capacity' instead")}set length(t){throw new Error("Deprecated, use 'capacity' instead")}capacity=1024;data=new ArrayBuffer(1024);dataView=new DataView(this.data);__data_uint8=new Uint8Array(this.data);__growFactor=1.1;get raw_bytes(){return this.__data_uint8}fromArrayBuffer(t){this.data=t,this.dataView=new DataView(t),this.__data_uint8=new Uint8Array(t),this.capacity=t.byteLength,this.position=0}trim(){return this.setCapacity(this.position),this}skip(t){this.position+=t}setCapacity(t){if(t<this.position)throw new Error(`Attempting to set capacity(=${t}) below current position(=${this.position})`);if(this.capacity===t)return;const e=this.__data_uint8,i=new Uint8Array(t);this.position>0&&function(t,e,i,n,s){let a,r;const o=function(t,e,i){const n=0|i;return 3&n?1&n?1:2:4}(0,0,s);4===o?(a=new Uint32Array(t,0,s>>>2),r=new Uint32Array(i,0,s>>>2)):2===o?(a=new Uint16Array(t,0,s>>>1),r=new Uint16Array(i,0,s>>>1)):(a=new Uint8Array(t,0,s),r=new Uint8Array(i,0,s)),r.set(a)}(e.buffer,0,i.buffer,0,Math.min(e.buffer.byteLength,i.buffer.byteLength,this.position)),this.data=i.buffer,this.__data_uint8=i,this.dataView=new DataView(this.data),this.capacity=t}ensureCapacity(t){const e=this.capacity;if(e>=t)return;const i=(n=Math.ceil(Math.max(t,e*this.__growFactor,e+1024)))+(4-n%4)%4;var n;this.setCapacity(i)}readFloat16(){return function(t){let e=0;const i=(31744&t)>>10,n=1023&t;let s=1;return t>>15&&(s=-1),e=0!==i?31===i?0!==n?NaN:Infinity*s:s*Math.pow(2,i-15)*(1+n/1024):s*(n/1024*6103515625e-14),e}(this.readUint16())}readFloat32(){const t=this.dataView.getFloat32(this.position,this.endianness);return this.position+=4,t}readFloat64(){const t=this.dataView.getFloat64(this.position,this.endianness);return this.position+=8,t}readInt8(){const t=this.dataView.getInt8(this.position);return this.position+=1,t}readInt16(){const t=this.dataView.getInt16(this.position,this.endianness);return this.position+=2,t}readInt16LE(){const t=this.dataView.getInt16(this.position,e);return this.position+=2,t}readInt16BE(){const e=this.dataView.getInt16(this.position,t);return this.position+=2,e}readInt32(){const t=this.dataView.getInt32(this.position,this.endianness);return this.position+=4,t}readInt32LE(){const t=this.dataView.getInt32(this.position,e);return this.position+=4,t}readInt32BE(){const e=this.dataView.getInt32(this.position,t);return this.position+=4,e}readInt64(){const t=this.dataView.getBigInt64(this.position,this.endianness);return this.position+=8,t}readUint8(){const t=this.dataView.getUint8(this.position);return this.position+=1,t}readUint16(){const t=this.dataView.getUint16(this.position,this.endianness);return this.position+=2,t}readUint16LE(){const t=this.dataView.getUint16(this.position,e);return this.position+=2,t}readUint16BE(){const e=this.dataView.getUint16(this.position,t);return this.position+=2,e}readUint24(){return this.endianness===t?this.readUint24BE():this.readUint24LE()}readUint24LE(){const t=this.dataView.getUint8(this.position),e=this.dataView.getUint8(this.position+1),i=this.dataView.getUint8(this.position+2);return this.position+=3,t|e<<8|i<<16}readUint24BE(){const t=this.dataView.getUint8(this.position),e=this.dataView.getUint8(this.position+1),i=this.dataView.getUint8(this.position+2);return this.position+=3,i|e<<8|t<<16}readUint32(){const t=this.dataView.getUint32(this.position,this.endianness);return this.position+=4,t}readUint32LE(){const t=this.dataView.getUint32(this.position,e);return this.position+=4,t}readUint32BE(){const e=this.dataView.getUint32(this.position,t);return this.position+=4,e}readUint64(){const t=this.dataView.getBigUint64(this.position,this.endianness);return this.position+=8,t}readUint8Array(t,e,i){for(let n=0;n<i;n++)t[n+e]=this.readUint8()}readUint16Array(t,e,i){for(let n=0;n<i;n++)t[n+e]=this.readUint16()}readUint32Array(t,e,i){for(let n=0;n<i;n++)t[n+e]=this.readUint32()}readInt8Array(t,e,i){for(let n=0;n<i;n++)t[n+e]=this.readInt8()}readInt16Array(t,e,i){for(let n=0;n<i;n++)t[n+e]=this.readInt16()}readInt32Array(t,e,i){for(let n=0;n<i;n++)t[n+e]=this.readInt32()}readFloat32Array(t,e,i){for(let n=0;n<i;n++)t[n+e]=this.readFloat32()}readFloat64Array(t,e,i){for(let n=0;n<i;n++)t[n+e]=this.readFloat64()}writeFloat32Array(t,e,i){for(let n=0;n<i;n++)this.writeFloat32(t[n+e])}writeFloat16Array(t,e,i){for(let n=0;n<i;n++)this.writeFloat16(t[n+e])}readFloat16Array(t,e,i){for(let n=0;n<i;n++)t[n+e]=this.readFloat16()}writeFloat16(t){const e=function(t){let e=t;Number.isFinite(e)&&(e>65504||e<-65504)&&(e=e>0?65504:-65504),i[0]=e;const s=n[0];let a=s>>16&32768,r=s>>12&2047;const o=s>>23&255;return o<103?a:o>142?(a|=31744,255===o&&8388607&s&&(a|=512),a):o<113?(r|=2048,a|=(r>>114-o)+(r>>113-o&1),a):(a|=o-112<<10|r>>1,a+=1&r,a)}(t);this.writeUint16(e)}writeFloat32(t){const e=this.position+4;this.ensureCapacity(e),this.dataView.setFloat32(this.position,t,this.endianness),this.position=e}writeFloat64(t){const e=this.position+8;this.ensureCapacity(e),this.dataView.setFloat64(this.position,t,this.endianness),this.position=e}writeInt8(t){const e=this.position+1;this.ensureCapacity(e),this.dataView.setInt8(this.position,t),this.position=e}writeInt16(t){const e=this.position+2;this.ensureCapacity(e),this.dataView.setInt16(this.position,t,this.endianness),this.position=e}writeInt16BE(e){const i=this.position+2;this.ensureCapacity(i),this.dataView.setInt16(this.position,e,t),this.position=i}writeInt16LE(t){const i=this.position+2;this.ensureCapacity(i),this.dataView.setInt16(this.position,t,e),this.position=i}writeInt32(t){const e=this.position+4;this.ensureCapacity(e),this.dataView.setInt32(this.position,t,this.endianness),this.position=e}writeInt32BE(e){const i=this.position+4;this.ensureCapacity(i),this.dataView.setInt32(this.position,e,t),this.position=i}writeInt32LE(t){const i=this.position+4;this.ensureCapacity(i),this.dataView.setInt32(this.position,t,e),this.position=i}writeInt64(t){const e=this.position+8;this.ensureCapacity(e),this.dataView.setBigInt64(this.position,t,this.endianness),this.position=e}writeInt8Array(t,e,i){this.ensureCapacity(this.position+i);for(let n=0;n<i;n++)this.writeInt8(t[e+n])}writeInt16Array(t,e,i){this.ensureCapacity(this.position+2*i);for(let n=0;n<i;n++)this.writeInt16(t[e+n])}writeInt32Array(t,e,i){this.ensureCapacity(this.position+4*i);for(let n=0;n<i;n++)this.writeInt32(t[e+n])}writeUint8(t){const e=this.position+1;this.ensureCapacity(e),this.dataView.setUint8(this.position,t),this.position=e}writeUint8Array(t,e,i){for(let n=0;n<i;n++)this.writeUint8(t[e+n])}writeUint16(t){const e=this.position+2;this.ensureCapacity(e),this.dataView.setUint16(this.position,t,this.endianness),this.position=e}writeUint16BE(e){const i=this.position+2;this.ensureCapacity(i),this.dataView.setUint16(this.position,e,t),this.position=i}writeUint16LE(t){const i=this.position+2;this.ensureCapacity(i),this.dataView.setUint16(this.position,t,e),this.position=i}writeUint16Array(t,e,i){for(let n=0;n<i;n++)this.writeUint16(t[e+n])}writeUint24(e){this.endianness===t?this.writeUint24BE(e):this.writeUint24LE(e)}writeUint24BE(t){const e=this.position+3;this.ensureCapacity(e);const i=255&t,n=t>>8&255,s=t>>16&255;this.dataView.setUint8(this.position,s),this.dataView.setUint8(this.position+1,n),this.dataView.setUint8(this.position+2,i),this.position=e}writeUint24LE(t){const e=this.position+3;this.ensureCapacity(e);const i=255&t,n=t>>8&255,s=t>>16&255;this.dataView.setUint8(this.position,i),this.dataView.setUint8(this.position+1,n),this.dataView.setUint8(this.position+2,s),this.position=e}writeUintVar(t){let e=!0,i=t;for(;e||0!==i;){e=!1;let t=127&i;i>>=7,i>0&&(t|=128),this.writeUint8(t)}}readUintVar(){let t=!0,e=0,i=0;for(;t;){let n=this.readUint8();t=!!(128&n),e|=(127&n)<<i,i+=7}return e}writeUint32(t){const e=this.position+4;this.ensureCapacity(e),this.dataView.setUint32(this.position,t,this.endianness),this.position=e}writeUint32BE(e){const i=this.position+4;this.ensureCapacity(i),this.dataView.setUint32(this.position,e,t),this.position=i}writeUint32LE(t){const i=this.position+4;this.ensureCapacity(i),this.dataView.setUint32(this.position,t,e),this.position=i}writeUint64(t){const e=this.position+8;this.ensureCapacity(e),this.dataView.setBigUint64(this.position,t,this.endianness),this.position=e}writeUint32Array(t,e,i){this.ensureCapacity(this.position+4*i);for(let n=0;n<i;n++)this.writeUint32(t[e+n])}writeBytes(t,e,i){const n=e+i,s=this.position,a=s+i;if(this.ensureCapacity(a),0===e&&t.length===i)this.__data_uint8.set(t,s);else if("function"==typeof t.subarray)this.__data_uint8.set(t.subarray(e,n),s);else for(let n=0;n<i;n++)this.__data_uint8[s+n]=t[e+n];this.position=a}readBytes(t,e,i){const n=this.position,s=n+i,a=this.__data_uint8;i<128?function(t,e,i,n,s){let a,r,o;for(o=0;o<s;o++)a=e+o,r=n+o,i[r]=t[a]}(a,n,t,e,i):t.set(a.subarray(n,s),e),this.position=s}writeUTF8String(t){if(null===t)return void this.writeUint32(4294967295);if(void 0===t)return void this.writeUint32(4294967294);let e=0;const i=t.length;if(i>=4294967294)throw new Error("String is too long");this.writeUint32(i);let n=this.position;const s=Math.max(32,i+(i>>1)+7);this.ensureCapacity(s+n);let a=this.__data_uint8,r=this.capacity;for(;e<i;){let s=t.charCodeAt(e++);if(s>=55296&&s<=56319){if(e<i){const i=t.charCodeAt(e);56320==(64512&i)&&(++e,s=((1023&s)<<10)+(1023&i)+65536)}s>=55296&&s<=56319&&(s=65533)}if(n+4>r&&(this.position=n,this.ensureCapacity(n+4),r=this.capacity,a=this.__data_uint8),4294967168&s){if(4294965248&s)if(4294901760&s){if(4292870144&s)continue;a[n++]=s>>18&7|240,a[n++]=s>>12&63|128,a[n++]=s>>6&63|128}else a[n++]=s>>12&15|224,a[n++]=s>>6&63|128;else a[n++]=s>>6&31|192;a[n++]=63&s|128}else a[n++]=s}this.position=n}readUTF8String(){const t=this.readUint32();if(4294967295===t)return null;if(4294967294===t)return;const e=this.__data_uint8;let i="",n=this.position,s=0;for(;n<this.capacity&&s<t;){const t=e[n++];let a;if(0===t)break;128&t?192==(224&t)?a=(31&t)<<6|63&e[n++]:224==(240&t)?a=(31&t)<<12|(63&e[n++])<<6|63&e[n++]:240==(248&t)&&(a=(7&t)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++],a>65535&&(a-=65536,i+=String.fromCharCode(a>>>10&1023|55296),s++,a=56320|1023&a)):a=t,s++,i+=String.fromCharCode(a)}return this.position=n,i}writeASCIIString(t){const e=t.length,i=this.position,n=i+e;this.ensureCapacity(n);for(let n=0;n<e;n++){const e=t.charCodeAt(n);if(e>127)throw new Error(`Character ${String.fromCharCode(e)} can't be represented by a US-ASCII byte.`);this.__data_uint8[i+n]=e}this.position=n}readASCIICharacters(t,e=!1){let i="";for(let n=0;n<t;n++){const t=this.readUint8();if(e&&0===t)break;i+=String.fromCharCode(t)}return i}toString(){return`BinaryBuffer[position=${this.position}, capacity=${this.capacity}, endianness=${this.endianness}]`}toHexString(){const t=this.__data_uint8,e=Math.min(t.length,this.position);let i="";for(let n=0;n<e;n++)i+=t[n].toString(16).padStart(2,"0").toUpperCase();return i}static fromEndianness(t){const e=new s;return e.endianness=t,e}static fromArrayBuffer(t){const e=new s;return e.fromArrayBuffer(t),e}static copyUTF8String(t,e){const i=t.readUTF8String();return e.writeUTF8String(i),i}static copyUintVar(t,e){const i=t.readUintVar();return e.writeUintVar(i),i}static copyUint8(t,e){const i=t.readUint8();return e.writeUint8(i),i}static copyUint16(t,e){const i=t.readUint16();return e.writeUint16(i),i}static copyUint32(t,e){const i=t.readUint32();return e.writeUint32(i),i}static copyFloat32(t,e){const i=t.readFloat32();return e.writeFloat32(i),i}static copyFloat64(t,e){const i=t.readFloat64();return e.writeFloat64(i),i}static copyBytes(t,e,i){const n=new Uint8Array(i);return t.readBytes(n,0,i),e.writeBytes(n,0,i),n}}s.prototype.isBinaryBuffer=!0;let a=e,r=!1;function o(t){let e=t.length;for(;--e>=0;)t[e]=0}const h=new Uint8Array([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]),l=new Uint8Array([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]),d=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),c=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_=new Array(576);o(_);const f=new Array(60);o(f);const u=new Array(512);o(u);const p=new Array(256);o(p);const w=new Array(29);o(w);const g=new Array(30);function b(t,e,i,n,s){this.static_tree=t,this.extra_bits=e,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=t&&t.length}let m,y,k;function v(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}o(g);const U=t=>t<256?u[t]:u[256+(t>>>7)],A=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},x=(t,e,i)=>{t.bi_valid>16-i?(t.bi_buf|=e<<t.bi_valid&65535,A(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=i)},E=(t,e,i)=>{x(t,i[2*e],i[2*e+1])},I=(t,e)=>{let i=0;do{i|=1&t,t>>>=1,i<<=1}while(--e>0);return i>>>1},z=(t,e,i)=>{const n=new Array(16);let s,a,r=0;for(s=1;s<=15;s++)n[s]=r=r+i[s-1]<<1;for(a=0;a<=e;a++){let e=t[2*a+1];0!==e&&(t[2*a]=I(n[e]++,e))}},S=t=>{let e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0},C=t=>{t.bi_valid>8?A(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},R=(t,e,i,n)=>{const s=2*e,a=2*i;return t[s]<t[a]||t[s]===t[a]&&n[e]<=n[i]},B=(t,e,i)=>{const n=t.heap[i];let s=i<<1;for(;s<=t.heap_len&&(s<t.heap_len&&R(e,t.heap[s+1],t.heap[s],t.depth)&&s++,!R(e,n,t.heap[s],t.depth));)t.heap[i]=t.heap[s],i=s,s<<=1;t.heap[i]=n},F=(t,e,i)=>{let n,s,a,r,o=0;if(0!==t.last_lit)do{n=t.pending_buf[t.d_buf+2*o]<<8|t.pending_buf[t.d_buf+2*o+1],s=t.pending_buf[t.l_buf+o],o++,0===n?E(t,s,e):(a=p[s],E(t,a+256+1,e),r=h[a],0!==r&&(s-=w[a],x(t,s,r)),n--,a=U(n),E(t,a,i),r=l[a],0!==r&&(n-=g[a],x(t,n,r)))}while(o<t.last_lit);E(t,256,e)},D=(t,e)=>{const i=e.dyn_tree,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,a=e.stat_desc.elems;let r,o,h,l=-1;for(t.heap_len=0,t.heap_max=573,r=0;r<a;r++)0!==i[2*r]?(t.heap[++t.heap_len]=l=r,t.depth[r]=0):i[2*r+1]=0;for(;t.heap_len<2;)h=t.heap[++t.heap_len]=l<2?++l:0,i[2*h]=1,t.depth[h]=0,t.opt_len--,s&&(t.static_len-=n[2*h+1]);for(e.max_code=l,r=t.heap_len>>1;r>=1;r--)B(t,i,r);h=a;do{r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],B(t,i,1),o=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=o,i[2*h]=i[2*r]+i[2*o],t.depth[h]=(t.depth[r]>=t.depth[o]?t.depth[r]:t.depth[o])+1,i[2*r+1]=i[2*o+1]=h,t.heap[1]=h++,B(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const i=e.dyn_tree,n=e.max_code,s=e.stat_desc.static_tree,a=e.stat_desc.has_stree,r=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,h=e.stat_desc.max_length;let l,d,c,_,f,u,p=0;for(_=0;_<=15;_++)t.bl_count[_]=0;for(i[2*t.heap[t.heap_max]+1]=0,l=t.heap_max+1;l<573;l++)d=t.heap[l],_=i[2*i[2*d+1]+1]+1,_>h&&(_=h,p++),i[2*d+1]=_,d>n||(t.bl_count[_]++,f=0,d>=o&&(f=r[d-o]),u=i[2*d],t.opt_len+=u*(_+f),a&&(t.static_len+=u*(s[2*d+1]+f)));if(0!==p){do{for(_=h-1;0===t.bl_count[_];)_--;t.bl_count[_]--,t.bl_count[_+1]+=2,t.bl_count[h]--,p-=2}while(p>0);for(_=h;0!==_;_--)for(d=t.bl_count[_];0!==d;)c=t.heap[--l],c>n||(i[2*c+1]!==_&&(t.opt_len+=(_-i[2*c+1])*i[2*c],i[2*c+1]=_),d--)}})(t,e),z(i,l,t.bl_count)},T=(t,e,i)=>{let n,s,a=-1,r=e[1],o=0,h=7,l=4;for(0===r&&(h=138,l=3),e[2*(i+1)+1]=65535,n=0;n<=i;n++)s=r,r=e[2*(n+1)+1],++o<h&&s===r||(o<l?t.bl_tree[2*s]+=o:0!==s?(s!==a&&t.bl_tree[2*s]++,t.bl_tree[32]++):o<=10?t.bl_tree[34]++:t.bl_tree[36]++,o=0,a=s,0===r?(h=138,l=3):s===r?(h=6,l=3):(h=7,l=4))},Z=(t,e,i)=>{let n,s,a=-1,r=e[1],o=0,h=7,l=4;for(0===r&&(h=138,l=3),n=0;n<=i;n++)if(s=r,r=e[2*(n+1)+1],!(++o<h&&s===r)){if(o<l)do{E(t,s,t.bl_tree)}while(0!==--o);else 0!==s?(s!==a&&(E(t,s,t.bl_tree),o--),E(t,16,t.bl_tree),x(t,o-3,2)):o<=10?(E(t,17,t.bl_tree),x(t,o-3,3)):(E(t,18,t.bl_tree),x(t,o-11,7));o=0,a=s,0===r?(h=138,l=3):s===r?(h=6,l=3):(h=7,l=4)}};let L=!1;const N=(t,e,i,n)=>{x(t,0+(n?1:0),3),((t,e,i)=>{C(t),A(t,i),A(t,~i),t.pending_buf.set(t.window.subarray(e,e+i),t.pending),t.pending+=i})(t,e,i)};var M={_tr_init:t=>{L||((()=>{let t,e,i,n,s;const a=new Array(16);for(i=0,n=0;n<28;n++)for(w[n]=i,t=0;t<1<<h[n];t++)p[i++]=n;for(p[i-1]=n,s=0,n=0;n<16;n++)for(g[n]=s,t=0;t<1<<l[n];t++)u[s++]=n;for(s>>=7;n<30;n++)for(g[n]=s<<7,t=0;t<1<<l[n]-7;t++)u[256+s++]=n;for(e=0;e<=15;e++)a[e]=0;for(t=0;t<=143;)_[2*t+1]=8,t++,a[8]++;for(;t<=255;)_[2*t+1]=9,t++,a[9]++;for(;t<=279;)_[2*t+1]=7,t++,a[7]++;for(;t<=287;)_[2*t+1]=8,t++,a[8]++;for(z(_,287,a),t=0;t<30;t++)f[2*t+1]=5,f[2*t]=I(t,5);m=new b(_,h,257,286,15),y=new b(f,l,0,30,15),k=new b(new Array(0),d,0,19,7)})(),L=!0),t.l_desc=new v(t.dyn_ltree,m),t.d_desc=new v(t.dyn_dtree,y),t.bl_desc=new v(t.bl_tree,k),t.bi_buf=0,t.bi_valid=0,S(t)},_tr_stored_block:N,_tr_flush_block:(t,e,i,n)=>{let s,a,r=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),D(t,t.l_desc),D(t,t.d_desc),r=(t=>{let e;for(T(t,t.dyn_ltree,t.l_desc.max_code),T(t,t.dyn_dtree,t.d_desc.max_code),D(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*c[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),s=t.opt_len+3+7>>>3,a=t.static_len+3+7>>>3,a<=s&&(s=a)):s=a=i+5,i+4<=s&&-1!==e?N(t,e,i,n):4===t.strategy||a===s?(x(t,2+(n?1:0),3),F(t,_,f)):(x(t,4+(n?1:0),3),((t,e,i,n)=>{let s;for(x(t,e-257,5),x(t,i-1,5),x(t,n-4,4),s=0;s<n;s++)x(t,t.bl_tree[2*c[s]+1],3);Z(t,t.dyn_ltree,e-1),Z(t,t.dyn_dtree,i-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,r+1),F(t,t.dyn_ltree,t.dyn_dtree)),S(t),n&&C(t)},_tr_tally:(t,e,i)=>(t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&i,t.last_lit++,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(p[i]+256+1)]++,t.dyn_dtree[2*U(e)]++),t.last_lit===t.lit_bufsize-1),_tr_align:t=>{x(t,2,3),E(t,256,_),(t=>{16===t.bi_valid?(A(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)}},V=(t,e,i,n)=>{let s=65535&t,a=t>>>16&65535,r=0;for(;0!==i;){r=i>2e3?2e3:i,i-=r;do{s=s+e[n++]|0,a=a+s|0}while(--r);s%=65521,a%=65521}return s|a<<16};const O=new Uint32Array((()=>{let t,e=[];for(var i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e})());var H=(t,e,i,n)=>{const s=O,a=n+i;t^=-1;for(let i=n;i<a;i++)t=t>>>8^s[255&(t^e[i])];return-1^t},P={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"},$={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_MEM_ERROR:-4,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};const{_tr_init:j,_tr_stored_block:Y,_tr_flush_block:K,_tr_tally:G,_tr_align:X}=M,{Z_NO_FLUSH:W,Z_PARTIAL_FLUSH:q,Z_FULL_FLUSH:J,Z_FINISH:Q,Z_BLOCK:tt,Z_OK:et,Z_STREAM_END:it,Z_STREAM_ERROR:nt,Z_DATA_ERROR:st,Z_BUF_ERROR:at,Z_DEFAULT_COMPRESSION:rt,Z_FILTERED:ot,Z_HUFFMAN_ONLY:ht,Z_RLE:lt,Z_FIXED:dt,Z_DEFAULT_STRATEGY:ct,Z_UNKNOWN:_t,Z_DEFLATED:ft}=$,ut=258,pt=262,wt=103,gt=113,bt=666,mt=(t,e)=>(t.msg=P[e],e),yt=t=>(t<<1)-(t>4?9:0),kt=t=>{let e=t.length;for(;--e>=0;)t[e]=0};let vt=(t,e,i)=>(e<<t.hash_shift^i)&t.hash_mask;const Ut=t=>{const e=t.state;let i=e.pending;i>t.avail_out&&(i=t.avail_out),0!==i&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+i),t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))},At=(t,e)=>{K(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Ut(t.strm)},xt=(t,e)=>{t.pending_buf[t.pending++]=e},Et=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},It=(t,e,i,n)=>{let s=t.avail_in;return s>n&&(s=n),0===s?0:(t.avail_in-=s,e.set(t.input.subarray(t.next_in,t.next_in+s),i),1===t.state.wrap?t.adler=V(t.adler,e,s,i):2===t.state.wrap&&(t.adler=H(t.adler,e,s,i)),t.next_in+=s,t.total_in+=s,s)},zt=(t,e)=>{let i,n,s=t.max_chain_length,a=t.strstart,r=t.prev_length,o=t.nice_match;const h=t.strstart>t.w_size-pt?t.strstart-(t.w_size-pt):0,l=t.window,d=t.w_mask,c=t.prev,_=t.strstart+ut;let f=l[a+r-1],u=l[a+r];t.prev_length>=t.good_match&&(s>>=2),o>t.lookahead&&(o=t.lookahead);do{if(i=e,l[i+r]===u&&l[i+r-1]===f&&l[i]===l[a]&&l[++i]===l[a+1]){a+=2,i++;do{}while(l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&a<_);if(n=ut-(_-a),a=_-ut,n>r){if(t.match_start=e,r=n,n>=o)break;f=l[a+r-1],u=l[a+r]}}}while((e=c[e&d])>h&&0!==--s);return r<=t.lookahead?r:t.lookahead},St=t=>{const e=t.w_size;let i,n,s,a,r;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-pt)){t.window.set(t.window.subarray(e,e+e),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,n=t.hash_size,i=n;do{s=t.head[--i],t.head[i]=s>=e?s-e:0}while(--n);n=e,i=n;do{s=t.prev[--i],t.prev[i]=s>=e?s-e:0}while(--n);a+=e}if(0===t.strm.avail_in)break;if(n=It(t.strm,t.window,t.strstart+t.lookahead,a),t.lookahead+=n,t.lookahead+t.insert>=3)for(r=t.strstart-t.insert,t.ins_h=t.window[r],t.ins_h=vt(t,t.ins_h,t.window[r+1]);t.insert&&(t.ins_h=vt(t,t.ins_h,t.window[r+3-1]),t.prev[r&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=r,r++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<pt&&0!==t.strm.avail_in)},Ct=(t,e)=>{let i,n;for(;;){if(t.lookahead<pt){if(St(t),t.lookahead<pt&&e===W)return 1;if(0===t.lookahead)break}if(i=0,t.lookahead>=3&&(t.ins_h=vt(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==i&&t.strstart-i<=t.w_size-pt&&(t.match_length=zt(t,i)),t.match_length>=3)if(n=G(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=vt(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!==--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=vt(t,t.ins_h,t.window[t.strstart+1]);else n=G(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(At(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===Q?(At(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(At(t,!1),0===t.strm.avail_out)?1:2},Rt=(t,e)=>{let i,n,s;for(;;){if(t.lookahead<pt){if(St(t),t.lookahead<pt&&e===W)return 1;if(0===t.lookahead)break}if(i=0,t.lookahead>=3&&(t.ins_h=vt(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==i&&t.prev_length<t.max_lazy_match&&t.strstart-i<=t.w_size-pt&&(t.match_length=zt(t,i),t.match_length<=5&&(t.strategy===ot||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-3,n=G(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=s&&(t.ins_h=vt(t,t.ins_h,t.window[t.strstart+3-1]),i=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!==--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(At(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(n=G(t,0,t.window[t.strstart-1]),n&&At(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=G(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===Q?(At(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(At(t,!1),0===t.strm.avail_out)?1:2};function Bt(t,e,i,n,s){this.good_length=t,this.max_lazy=e,this.nice_length=i,this.max_chain=n,this.func=s}const Ft=[new Bt(0,0,0,0,(t,e)=>{let i=65535;for(i>t.pending_buf_size-5&&(i=t.pending_buf_size-5);;){if(t.lookahead<=1){if(St(t),0===t.lookahead&&e===W)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;const n=t.block_start+i;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,At(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-pt&&(At(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===Q?(At(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(At(t,!1),t.strm.avail_out),1)}),new Bt(4,4,8,4,Ct),new Bt(4,5,16,8,Ct),new Bt(4,6,32,32,Ct),new Bt(4,4,16,16,Rt),new Bt(8,16,32,32,Rt),new Bt(8,16,128,128,Rt),new Bt(8,32,128,256,Rt),new Bt(32,128,258,1024,Rt),new Bt(32,258,258,4096,Rt)];function Dt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ft,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 Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),kt(this.dyn_ltree),kt(this.dyn_dtree),kt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),kt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),kt(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}const Tt=t=>{const e=(t=>{if(!t||!t.state)return mt(t,nt);t.total_in=t.total_out=0,t.data_type=_t;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:gt,t.adler=2===e.wrap?0:1,e.last_flush=W,j(e),et})(t);var i;return e===et&&((i=t.state).window_size=2*i.w_size,kt(i.head),i.max_lazy_match=Ft[i.level].max_lazy,i.good_match=Ft[i.level].good_length,i.nice_match=Ft[i.level].nice_length,i.max_chain_length=Ft[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),e};var Zt=(t,e,i,n,s,a)=>{if(!t)return nt;let r=1;if(e===rt&&(e=6),n<0?(r=0,n=-n):n>15&&(r=2,n-=16),s<1||s>9||i!==ft||n<8||n>15||e<0||e>9||a<0||a>dt)return mt(t,nt);8===n&&(n=9);const o=new Dt;return t.state=o,o.strm=t,o.wrap=r,o.gzhead=null,o.w_bits=n,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=s+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<s+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.d_buf=1*o.lit_bufsize,o.l_buf=3*o.lit_bufsize,o.level=e,o.strategy=a,o.method=i,Tt(t)},Lt=(t,e)=>{let i,n;if(!t||!t.state||e>tt||e<0)return t?mt(t,nt):nt;const s=t.state;if(!t.output||!t.input&&0!==t.avail_in||s.status===bt&&e!==Q)return mt(t,0===t.avail_out?at:nt);s.strm=t;const a=s.last_flush;if(s.last_flush=e,42===s.status)if(2===s.wrap)t.adler=0,xt(s,31),xt(s,139),xt(s,8),s.gzhead?(xt(s,(s.gzhead.text?1:0)+(s.gzhead.hcrc?2:0)+(s.gzhead.extra?4:0)+(s.gzhead.name?8:0)+(s.gzhead.comment?16:0)),xt(s,255&s.gzhead.time),xt(s,s.gzhead.time>>8&255),xt(s,s.gzhead.time>>16&255),xt(s,s.gzhead.time>>24&255),xt(s,9===s.level?2:s.strategy>=ht||s.level<2?4:0),xt(s,255&s.gzhead.os),s.gzhead.extra&&s.gzhead.extra.length&&(xt(s,255&s.gzhead.extra.length),xt(s,s.gzhead.extra.length>>8&255)),s.gzhead.hcrc&&(t.adler=H(t.adler,s.pending_buf,s.pending,0)),s.gzindex=0,s.status=69):(xt(s,0),xt(s,0),xt(s,0),xt(s,0),xt(s,0),xt(s,9===s.level?2:s.strategy>=ht||s.level<2?4:0),xt(s,3),s.status=gt);else{let e=ft+(s.w_bits-8<<4)<<8,i=-1;i=s.strategy>=ht||s.level<2?0:s.level<6?1:6===s.level?2:3,e|=i<<6,0!==s.strstart&&(e|=32),e+=31-e%31,s.status=gt,Et(s,e),0!==s.strstart&&(Et(s,t.adler>>>16),Et(s,65535&t.adler)),t.adler=1}if(69===s.status)if(s.gzhead.extra){for(i=s.pending;s.gzindex<(65535&s.gzhead.extra.length)&&(s.pending!==s.pending_buf_size||(s.gzhead.hcrc&&s.pending>i&&(t.adler=H(t.adler,s.pending_buf,s.pending-i,i)),Ut(t),i=s.pending,s.pending!==s.pending_buf_size));)xt(s,255&s.gzhead.extra[s.gzindex]),s.gzindex++;s.gzhead.hcrc&&s.pending>i&&(t.adler=H(t.adler,s.pending_buf,s.pending-i,i)),s.gzindex===s.gzhead.extra.length&&(s.gzindex=0,s.status=73)}else s.status=73;if(73===s.status)if(s.gzhead.name){i=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>i&&(t.adler=H(t.adler,s.pending_buf,s.pending-i,i)),Ut(t),i=s.pending,s.pending===s.pending_buf_size)){n=1;break}n=s.gzindex<s.gzhead.name.length?255&s.gzhead.name.charCodeAt(s.gzindex++):0,xt(s,n)}while(0!==n);s.gzhead.hcrc&&s.pending>i&&(t.adler=H(t.adler,s.pending_buf,s.pending-i,i)),0===n&&(s.gzindex=0,s.status=91)}else s.status=91;if(91===s.status)if(s.gzhead.comment){i=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>i&&(t.adler=H(t.adler,s.pending_buf,s.pending-i,i)),Ut(t),i=s.pending,s.pending===s.pending_buf_size)){n=1;break}n=s.gzindex<s.gzhead.comment.length?255&s.gzhead.comment.charCodeAt(s.gzindex++):0,xt(s,n)}while(0!==n);s.gzhead.hcrc&&s.pending>i&&(t.adler=H(t.adler,s.pending_buf,s.pending-i,i)),0===n&&(s.status=wt)}else s.status=wt;if(s.status===wt&&(s.gzhead.hcrc?(s.pending+2>s.pending_buf_size&&Ut(t),s.pending+2<=s.pending_buf_size&&(xt(s,255&t.adler),xt(s,t.adler>>8&255),t.adler=0,s.status=gt)):s.status=gt),0!==s.pending){if(Ut(t),0===t.avail_out)return s.last_flush=-1,et}else if(0===t.avail_in&&yt(e)<=yt(a)&&e!==Q)return mt(t,at);if(s.status===bt&&0!==t.avail_in)return mt(t,at);if(0!==t.avail_in||0!==s.lookahead||e!==W&&s.status!==bt){let i=s.strategy===ht?((t,e)=>{let i;for(;;){if(0===t.lookahead&&(St(t),0===t.lookahead)){if(e===W)return 1;break}if(t.match_length=0,i=G(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(At(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===Q?(At(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(At(t,!1),0===t.strm.avail_out)?1:2})(s,e):s.strategy===lt?((t,e)=>{let i,n,s,a;const r=t.window;for(;;){if(t.lookahead<=ut){if(St(t),t.lookahead<=ut&&e===W)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(s=t.strstart-1,n=r[s],n===r[++s]&&n===r[++s]&&n===r[++s])){a=t.strstart+ut;do{}while(n===r[++s]&&n===r[++s]&&n===r[++s]&&n===r[++s]&&n===r[++s]&&n===r[++s]&&n===r[++s]&&n===r[++s]&&s<a);t.match_length=ut-(a-s),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=G(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=G(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(At(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===Q?(At(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(At(t,!1),0===t.strm.avail_out)?1:2})(s,e):Ft[s.level].func(s,e);if(3!==i&&4!==i||(s.status=bt),1===i||3===i)return 0===t.avail_out&&(s.last_flush=-1),et;if(2===i&&(e===q?X(s):e!==tt&&(Y(s,0,0,!1),e===J&&(kt(s.head),0===s.lookahead&&(s.strstart=0,s.block_start=0,s.insert=0))),Ut(t),0===t.avail_out))return s.last_flush=-1,et}return e!==Q?et:s.wrap<=0?it:(2===s.wrap?(xt(s,255&t.adler),xt(s,t.adler>>8&255),xt(s,t.adler>>16&255),xt(s,t.adler>>24&255),xt(s,255&t.total_in),xt(s,t.total_in>>8&255),xt(s,t.total_in>>16&255),xt(s,t.total_in>>24&255)):(Et(s,t.adler>>>16),Et(s,65535&t.adler)),Ut(t),s.wrap>0&&(s.wrap=-s.wrap),0!==s.pending?et:it)},Nt=t=>{if(!t||!t.state)return nt;const e=t.state.status;return 42!==e&&69!==e&&73!==e&&91!==e&&e!==wt&&e!==gt&&e!==bt?mt(t,nt):(t.state=null,e===gt?mt(t,st):et)};const Mt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var Vt=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const i=e.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const e in i)Mt(i,e)&&(t[e]=i[e])}}return t},Ot=t=>{let e=0;for(let i=0,n=t.length;i<n;i++)e+=t[i].length;const i=new Uint8Array(e);for(let e=0,n=0,s=t.length;e<s;e++){let s=t[e];i.set(s,n),n+=s.length}return i};let Ht=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){Ht=!1}const Pt=new Uint8Array(256);for(let t=0;t<256;t++)Pt[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Pt[254]=Pt[254]=1;var $t=t=>{let e,i,n,s,a,r=t.length,o=0;for(s=0;s<r;s++)i=t.charCodeAt(s),55296==(64512&i)&&s+1<r&&(n=t.charCodeAt(s+1),56320==(64512&n)&&(i=65536+(i-55296<<10)+(n-56320),s++)),o+=i<128?1:i<2048?2:i<65536?3:4;for(e=new Uint8Array(o),a=0,s=0;a<o;s++)i=t.charCodeAt(s),55296==(64512&i)&&s+1<r&&(n=t.charCodeAt(s+1),56320==(64512&n)&&(i=65536+(i-55296<<10)+(n-56320),s++)),i<128?e[a++]=i:i<2048?(e[a++]=192|i>>>6,e[a++]=128|63&i):i<65536?(e[a++]=224|i>>>12,e[a++]=128|i>>>6&63,e[a++]=128|63&i):(e[a++]=240|i>>>18,e[a++]=128|i>>>12&63,e[a++]=128|i>>>6&63,e[a++]=128|63&i);return e},jt=(t,e)=>{let i,n;const s=e||t.length,a=new Array(2*s);for(n=0,i=0;i<s;){let e=t[i++];if(e<128){a[n++]=e;continue}let r=Pt[e];if(r>4)a[n++]=65533,i+=r-1;else{for(e&=2===r?31:3===r?15:7;r>1&&i<s;)e=e<<6|63&t[i++],r--;r>1?a[n++]=65533:e<65536?a[n++]=e:(e-=65536,a[n++]=55296|e>>10&1023,a[n++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&Ht)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let i="";for(let n=0;n<e;n++)i+=String.fromCharCode(t[n]);return i})(a,n)},Yt=(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let i=e-1;for(;i>=0&&128==(192&t[i]);)i--;return i<0||0===i?e:i+Pt[t[i]]>e?i:e},Kt=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};const Gt=Object.prototype.toString,{Z_NO_FLUSH:Xt,Z_SYNC_FLUSH:Wt,Z_FULL_FLUSH:qt,Z_FINISH:Jt,Z_OK:Qt,Z_STREAM_END:te,Z_DEFAULT_COMPRESSION:ee,Z_DEFAULT_STRATEGY:ie,Z_DEFLATED:ne}=$;function se(t){this.options=Vt({level:ee,method:ne,chunkSize:16384,windowBits:15,memLevel:8,strategy:ie},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Kt,this.strm.avail_out=0;let i=Zt(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(i!==Qt)throw new Error(P[i]);if(e.header&&(n=this.strm,s=e.header,n&&n.state&&(2!==n.state.wrap||(n.state.gzhead=s))),e.dictionary){let t;if(t="string"==typeof e.dictionary?$t(e.dictionary):"[object ArrayBuffer]"===Gt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,i=((t,e)=>{let i=e.length;if(!t||!t.state)return nt;const n=t.state,s=n.wrap;if(2===s||1===s&&42!==n.status||n.lookahead)return nt;if(1===s&&(t.adler=V(t.adler,e,i,0)),n.wrap=0,i>=n.w_size){0===s&&(kt(n.head),n.strstart=0,n.block_start=0,n.insert=0);let t=new Uint8Array(n.w_size);t.set(e.subarray(i-n.w_size,i),0),e=t,i=n.w_size}const a=t.avail_in,r=t.next_in,o=t.input;for(t.avail_in=i,t.next_in=0,t.input=e,St(n);n.lookahead>=3;){let t=n.strstart,e=n.lookahead-2;do{n.ins_h=vt(n,n.ins_h,n.window[t+3-1]),n.prev[t&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=t,t++}while(--e);n.strstart=t,n.lookahead=2,St(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=r,t.input=o,t.avail_in=a,n.wrap=s,et})(this.strm,t),i!==Qt)throw new Error(P[i]);this._dict_set=!0}var n,s}function ae(t,e){const i=new se(e);if(i.push(t,!0),i.err)throw i.msg||P[i.err];return i.result}se.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize;let s,a;if(this.ended)return!1;for(a=e===~~e?e:!0===e?Jt:Xt,"string"==typeof t?i.input=$t(t):"[object ArrayBuffer]"===Gt.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),(a===Wt||a===qt)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(s=Lt(i,a),s===te)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),s=Nt(this.strm),this.onEnd(s),this.ended=!0,s===Qt;if(0!==i.avail_out){if(a>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},se.prototype.onData=function(t){this.chunks.push(t)},se.prototype.onEnd=function(t){t===Qt&&(this.result=Ot(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var re={Deflate:se,deflate:ae,deflateRaw:function(t,e){return(e=e||{}).raw=!0,ae(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,ae(t,e)},constants:$},oe=function(t,e){let i,n,s,a,r,o,h,l,d,c,_,f,u,p,w,g,b,m,y,k,v,U,A,x;const E=t.state;i=t.next_in,A=t.input,n=i+(t.avail_in-5),s=t.next_out,x=t.output,a=s-(e-t.avail_out),r=s+(t.avail_out-257),o=E.dmax,h=E.wsize,l=E.whave,d=E.wnext,c=E.window,_=E.hold,f=E.bits,u=E.lencode,p=E.distcode,w=(1<<E.lenbits)-1,g=(1<<E.distbits)-1;t:do{f<15&&(_+=A[i++]<<f,f+=8,_+=A[i++]<<f,f+=8),b=u[_&w];e:for(;;){if(m=b>>>24,_>>>=m,f-=m,m=b>>>16&255,0===m)x[s++]=65535&b;else{if(!(16&m)){if(64&m){if(32&m){E.mode=12;break t}t.msg="invalid literal/length code",E.mode=30;break t}b=u[(65535&b)+(_&(1<<m)-1)];continue e}for(y=65535&b,m&=15,m&&(f<m&&(_+=A[i++]<<f,f+=8),y+=_&(1<<m)-1,_>>>=m,f-=m),f<15&&(_+=A[i++]<<f,f+=8,_+=A[i++]<<f,f+=8),b=p[_&g];;){if(m=b>>>24,_>>>=m,f-=m,m=b>>>16&255,16&m){if(k=65535&b,m&=15,f<m&&(_+=A[i++]<<f,f+=8,f<m&&(_+=A[i++]<<f,f+=8)),k+=_&(1<<m)-1,k>o){t.msg="invalid distance too far back",E.mode=30;break t}if(_>>>=m,f-=m,m=s-a,k>m){if(m=k-m,m>l&&E.sane){t.msg="invalid distance too far back",E.mode=30;break t}if(v=0,U=c,0===d){if(v+=h-m,m<y){y-=m;do{x[s++]=c[v++]}while(--m);v=s-k,U=x}}else if(d<m){if(v+=h+d-m,m-=d,m<y){y-=m;do{x[s++]=c[v++]}while(--m);if(v=0,d<y){m=d,y-=m;do{x[s++]=c[v++]}while(--m);v=s-k,U=x}}}else if(v+=d-m,m<y){y-=m;do{x[s++]=c[v++]}while(--m);v=s-k,U=x}for(;y>2;)x[s++]=U[v++],x[s++]=U[v++],x[s++]=U[v++],y-=3;y&&(x[s++]=U[v++],y>1&&(x[s++]=U[v++]))}else{v=s-k;do{x[s++]=x[v++],x[s++]=x[v++],x[s++]=x[v++],y-=3}while(y>2);y&&(x[s++]=x[v++],y>1&&(x[s++]=x[v++]))}break}if(64&m){t.msg="invalid distance code",E.mode=30;break t}b=p[(65535&b)+(_&(1<<m)-1)]}}break}}while(i<n&&s<r);y=f>>3,i-=y,f-=y<<3,_&=(1<<f)-1,t.next_in=i,t.next_out=s,t.avail_in=i<n?n-i+5:5-(i-n),t.avail_out=s<r?r-s+257:257-(s-r),E.hold=_,E.bits=f};const he=new Uint16Array([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]),le=new Uint8Array([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]),de=new Uint16Array([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]),ce=new Uint8Array([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]);var _e=(t,e,i,n,s,a,r,o)=>{const h=o.bits;let l,d,c,_,f,u,p=0,w=0,g=0,b=0,m=0,y=0,k=0,v=0,U=0,A=0,x=null,E=0;const I=new Uint16Array(16),z=new Uint16Array(16);let S,C,R,B=null,F=0;for(p=0;p<=15;p++)I[p]=0;for(w=0;w<n;w++)I[e[i+w]]++;for(m=h,b=15;b>=1&&0===I[b];b--);if(m>b&&(m=b),0===b)return s[a++]=20971520,s[a++]=20971520,o.bits=1,0;for(g=1;g<b&&0===I[g];g++);for(m<g&&(m=g),v=1,p=1;p<=15;p++)if(v<<=1,v-=I[p],v<0)return-1;if(v>0&&(0===t||1!==b))return-1;for(z[1]=0,p=1;p<15;p++)z[p+1]=z[p]+I[p];for(w=0;w<n;w++)0!==e[i+w]&&(r[z[e[i+w]]++]=w);if(0===t?(x=B=r,u=19):1===t?(x=he,E-=257,B=le,F-=257,u=256):(x=de,B=ce,u=-1),A=0,w=0,p=g,f=a,y=m,k=0,c=-1,U=1<<m,_=U-1,1===t&&U>852||2===t&&U>592)return 1;for(;;){S=p-k,r[w]<u?(C=0,R=r[w]):r[w]>u?(C=B[F+r[w]],R=x[E+r[w]]):(C=96,R=0),l=1<<p-k,d=1<<y,g=d;do{d-=l,s[f+(A>>k)+d]=S<<24|C<<16|R}while(0!==d);for(l=1<<p-1;A&l;)l>>=1;if(0!==l?(A&=l-1,A+=l):A=0,w++,0===--I[p]){if(p===b)break;p=e[i+r[w]]}if(p>m&&(A&_)!==c){for(0===k&&(k=m),f+=g,y=p-k,v=1<<y;y+k<b&&(v-=I[y+k],!(v<=0));)y++,v<<=1;if(U+=1<<y,1===t&&U>852||2===t&&U>592)return 1;c=A&_,s[c]=m<<24|y<<16|f-a}}return 0!==A&&(s[f+A]=p-k<<24|64<<16),o.bits=m,0};const{Z_FINISH:fe,Z_BLOCK:ue,Z_TREES:pe,Z_OK:we,Z_STREAM_END:ge,Z_NEED_DICT:be,Z_STREAM_ERROR:me,Z_DATA_ERROR:ye,Z_MEM_ERROR:ke,Z_BUF_ERROR:ve,Z_DEFLATED:Ue}=$,Ae=12,xe=30,Ee=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function Ie(){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 Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const ze=t=>{if(!t||!t.state)return me;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,(t=>{if(!t||!t.state)return me;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,we})(t)};let Se,Ce,Re=!0;const Be=t=>{if(Re){Se=new Int32Array(512),Ce=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(_e(1,t.lens,0,288,Se,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;_e(2,t.lens,0,32,Ce,0,t.work,{bits:5}),Re=!1}t.lencode=Se,t.lenbits=9,t.distcode=Ce,t.distbits=5},Fe=(t,e,i,n)=>{let s;const a=t.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),n>=a.wsize?(a.window.set(e.subarray(i-a.wsize,i),0),a.wnext=0,a.whave=a.wsize):(s=a.wsize-a.wnext,s>n&&(s=n),a.window.set(e.subarray(i-n,i-n+s),a.wnext),(n-=s)?(a.window.set(e.subarray(i-n,i),0),a.wnext=n,a.whave=a.wsize):(a.wnext+=s,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=s))),0};var De=ze,Te=(t,e)=>{if(!t)return me;const i=new Ie;t.state=i,i.window=null;const n=((t,e)=>{let i;if(!t||!t.state)return me;const n=t.state;return e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?me:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=i,n.wbits=e,ze(t))})(t,e);return n!==we&&(t.state=null),n},Ze=(t,e)=>{let i,n,s,a,r,o,h,l,d,c,_,f,u,p,w,g,b,m,y,k,v,U,A=0;const x=new Uint8Array(4);let E,I;const z=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return me;i=t.state,i.mode===Ae&&(i.mode=13),r=t.next_out,s=t.output,h=t.avail_out,a=t.next_in,n=t.input,o=t.avail_in,l=i.hold,d=i.bits,c=o,_=h,U=we;t:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;d<16;){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}if(2&i.wrap&&35615===l){i.check=0,x[0]=255&l,x[1]=l>>>8&255,i.check=H(i.check,x,2,0),l=0,d=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&l)<<8)+(l>>8))%31){t.msg="incorrect header check",i.mode=xe;break}if((15&l)!==Ue){t.msg="unknown compression method",i.mode=xe;break}if(l>>>=4,d-=4,v=8+(15&l),0===i.wbits)i.wbits=v;else if(v>i.wbits){t.msg="invalid window size",i.mode=xe;break}i.dmax=1<<i.wbits,t.adler=i.check=1,i.mode=512&l?10:Ae,l=0,d=0;break;case 2:for(;d<16;){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}if(i.flags=l,(255&i.flags)!==Ue){t.msg="unknown compression method",i.mode=xe;break}if(57344&i.flags){t.msg="unknown header flags set",i.mode=xe;break}i.head&&(i.head.text=l>>8&1),512&i.flags&&(x[0]=255&l,x[1]=l>>>8&255,i.check=H(i.check,x,2,0)),l=0,d=0,i.mode=3;case 3:for(;d<32;){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}i.head&&(i.head.time=l),512&i.flags&&(x[0]=255&l,x[1]=l>>>8&255,x[2]=l>>>16&255,x[3]=l>>>24&255,i.check=H(i.check,x,4,0)),l=0,d=0,i.mode=4;case 4:for(;d<16;){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}i.head&&(i.head.xflags=255&l,i.head.os=l>>8),512&i.flags&&(x[0]=255&l,x[1]=l>>>8&255,i.check=H(i.check,x,2,0)),l=0,d=0,i.mode=5;case 5:if(1024&i.flags){for(;d<16;){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}i.length=l,i.head&&(i.head.extra_len=l),512&i.flags&&(x[0]=255&l,x[1]=l>>>8&255,i.check=H(i.check,x,2,0)),l=0,d=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(f=i.length,f>o&&(f=o),f&&(i.head&&(v=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(n.subarray(a,a+f),v)),512&i.flags&&(i.check=H(i.check,n,f,a)),o-=f,a+=f,i.length-=f),i.length))break t;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===o)break t;f=0;do{v=n[a+f++],i.head&&v&&i.length<65536&&(i.head.name+=String.fromCharCode(v))}while(v&&f<o);if(512&i.flags&&(i.check=H(i.check,n,f,a)),o-=f,a+=f,v)break t}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===o)break t;f=0;do{v=n[a+f++],i.head&&v&&i.length<65536&&(i.head.comment+=String.fromCharCode(v))}while(v&&f<o);if(512&i.flags&&(i.check=H(i.check,n,f,a)),o-=f,a+=f,v)break t}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;d<16;){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}if(l!==(65535&i.check)){t.msg="header crc mismatch",i.mode=xe;break}l=0,d=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=Ae;break;case 10:for(;d<32;){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}t.adler=i.check=Ee(l),l=0,d=0,i.mode=11;case 11:if(0===i.havedict)return t.next_out=r,t.avail_out=h,t.next_in=a,t.avail_in=o,i.hold=l,i.bits=d,be;t.adler=i.check=1,i.mode=Ae;case Ae:if(e===ue||e===pe)break t;case 13:if(i.last){l>>>=7&d,d-=7&d,i.mode=27;break}for(;d<3;){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}switch(i.last=1&l,l>>>=1,d-=1,3&l){case 0:i.mode=14;break;case 1:if(Be(i),i.mode=20,e===pe){l>>>=2,d-=2;break t}break;case 2:i.mode=17;break;case 3:t.msg="invalid block type",i.mode=xe}l>>>=2,d-=2;break;case 14:for(l>>>=7&d,d-=7&d;d<32;){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}if((65535&l)!=(l>>>16^65535)){t.msg="invalid stored block lengths",i.mode=xe;break}if(i.length=65535&l,l=0,d=0,i.mode=15,e===pe)break t;case 15:i.mode=16;case 16:if(f=i.length,f){if(f>o&&(f=o),f>h&&(f=h),0===f)break t;s.set(n.subarray(a,a+f),r),o-=f,a+=f,h-=f,r+=f,i.length-=f;break}i.mode=Ae;break;case 17:for(;d<14;){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}if(i.nlen=257+(31&l),l>>>=5,d-=5,i.ndist=1+(31&l),l>>>=5,d-=5,i.ncode=4+(15&l),l>>>=4,d-=4,i.nlen>286||i.ndist>30){t.msg="too many length or distance symbols",i.mode=xe;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;d<3;){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}i.lens[z[i.have++]]=7&l,l>>>=3,d-=3}for(;i.have<19;)i.lens[z[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,E={bits:i.lenbits},U=_e(0,i.lens,0,19,i.lencode,0,i.work,E),i.lenbits=E.bits,U){t.msg="invalid code lengths set",i.mode=xe;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;A=i.lencode[l&(1<<i.lenbits)-1],w=A>>>24,g=A>>>16&255,b=65535&A,!(w<=d);){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}if(b<16)l>>>=w,d-=w,i.lens[i.have++]=b;else{if(16===b){for(I=w+2;d<I;){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}if(l>>>=w,d-=w,0===i.have){t.msg="invalid bit length repeat",i.mode=xe;break}v=i.lens[i.have-1],f=3+(3&l),l>>>=2,d-=2}else if(17===b){for(I=w+3;d<I;){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}l>>>=w,d-=w,v=0,f=3+(7&l),l>>>=3,d-=3}else{for(I=w+7;d<I;){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}l>>>=w,d-=w,v=0,f=11+(127&l),l>>>=7,d-=7}if(i.have+f>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=xe;break}for(;f--;)i.lens[i.have++]=v}}if(i.mode===xe)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=xe;break}if(i.lenbits=9,E={bits:i.lenbits},U=_e(1,i.lens,0,i.nlen,i.lencode,0,i.work,E),i.lenbits=E.bits,U){t.msg="invalid literal/lengths set",i.mode=xe;break}if(i.distbits=6,i.distcode=i.distdyn,E={bits:i.distbits},U=_e(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,E),i.distbits=E.bits,U){t.msg="invalid distances set",i.mode=xe;break}if(i.mode=20,e===pe)break t;case 20:i.mode=21;case 21:if(o>=6&&h>=258){t.next_out=r,t.avail_out=h,t.next_in=a,t.avail_in=o,i.hold=l,i.bits=d,oe(t,_),r=t.next_out,s=t.output,h=t.avail_out,a=t.next_in,n=t.input,o=t.avail_in,l=i.hold,d=i.bits,i.mode===Ae&&(i.back=-1);break}for(i.back=0;A=i.lencode[l&(1<<i.lenbits)-1],w=A>>>24,g=A>>>16&255,b=65535&A,!(w<=d);){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}if(g&&!(240&g)){for(m=w,y=g,k=b;A=i.lencode[k+((l&(1<<m+y)-1)>>m)],w=A>>>24,g=A>>>16&255,b=65535&A,!(m+w<=d);){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}l>>>=m,d-=m,i.back+=m}if(l>>>=w,d-=w,i.back+=w,i.length=b,0===g){i.mode=26;break}if(32&g){i.back=-1,i.mode=Ae;break}if(64&g){t.msg="invalid literal/length code",i.mode=xe;break}i.extra=15&g,i.mode=22;case 22:if(i.extra){for(I=i.extra;d<I;){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}i.length+=l&(1<<i.extra)-1,l>>>=i.extra,d-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;A=i.distcode[l&(1<<i.distbits)-1],w=A>>>24,g=A>>>16&255,b=65535&A,!(w<=d);){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}if(!(240&g)){for(m=w,y=g,k=b;A=i.distcode[k+((l&(1<<m+y)-1)>>m)],w=A>>>24,g=A>>>16&255,b=65535&A,!(m+w<=d);){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}l>>>=m,d-=m,i.back+=m}if(l>>>=w,d-=w,i.back+=w,64&g){t.msg="invalid distance code",i.mode=xe;break}i.offset=b,i.extra=15&g,i.mode=24;case 24:if(i.extra){for(I=i.extra;d<I;){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}i.offset+=l&(1<<i.extra)-1,l>>>=i.extra,d-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=xe;break}i.mode=25;case 25:if(0===h)break t;if(f=_-h,i.offset>f){if(f=i.offset-f,f>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=xe;break}f>i.wnext?(f-=i.wnext,u=i.wsize-f):u=i.wnext-f,f>i.length&&(f=i.length),p=i.window}else p=s,u=r-i.offset,f=i.length;f>h&&(f=h),h-=f,i.length-=f;do{s[r++]=p[u++]}while(--f);0===i.length&&(i.mode=21);break;case 26:if(0===h)break t;s[r++]=i.length,h--,i.mode=21;break;case 27:if(i.wrap){for(;d<32;){if(0===o)break t;o--,l|=n[a++]<<d,d+=8}if(_-=h,t.total_out+=_,i.total+=_,_&&(t.adler=i.check=i.flags?H(i.check,s,_,r-_):V(i.check,s,_,r-_)),_=h,(i.flags?l:Ee(l))!==i.check){t.msg="incorrect data check",i.mode=xe;break}l=0,d=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;d<32;){if(0===o)break t;o--,l+=n[a++]<<d,d+=8}if(l!==(4294967295&i.total)){t.msg="incorrect length check",i.mode=xe;break}l=0,d=0}i.mode=29;case 29:U=ge;break t;case xe:U=ye;break t;case 31:return ke;default:return me}return t.next_out=r,t.avail_out=h,t.next_in=a,t.avail_in=o,i.hold=l,i.bits=d,(i.wsize||_!==t.avail_out&&i.mode<xe&&(i.mode<27||e!==fe))&&Fe(t,t.output,t.next_out,_-t.avail_out),c-=t.avail_in,_-=t.avail_out,t.total_in+=c,t.total_out+=_,i.total+=_,i.wrap&&_&&(t.adler=i.check=i.flags?H(i.check,s,_,t.next_out-_):V(i.check,s,_,t.next_out-_)),t.data_type=i.bits+(i.last?64:0)+(i.mode===Ae?128:0)+(20===i.mode||15===i.mode?256:0),(0===c&&0===_||e===fe)&&U===we&&(U=ve),U},Le=t=>{if(!t||!t.state)return me;let e=t.state;return e.window&&(e.window=null),t.state=null,we},Ne=(t,e)=>{const i=e.length;let n,s,a;return t&&t.state?(n=t.state,0!==n.wrap&&11!==n.mode?me:11===n.mode&&(s=1,s=V(s,e,i,0),s!==n.check)?ye:(a=Fe(t,e,i,i),a?(n.mode=31,ke):(n.havedict=1,we))):me},Me=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};const Ve=Object.prototype.toString,{Z_NO_FLUSH:Oe,Z_FINISH:He,Z_OK:Pe,Z_STREAM_END:$e,Z_NEED_DICT:je,Z_STREAM_ERROR:Ye,Z_DATA_ERROR:Ke,Z_MEM_ERROR:Ge}=$;function Xe(t){this.options=Vt({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(15&e.windowBits||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Kt,this.strm.avail_out=0;let i=Te(this.strm,e.windowBits);if(i!==Pe)throw new Error(P[i]);if(this.header=new Me,((t,e)=>{if(!t||!t.state)return me;const i=t.state;2&i.wrap&&(i.head=e,e.done=!1)})(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=$t(e.dictionary):"[object ArrayBuffer]"===Ve.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(i=Ne(this.strm,e.dictionary),i!==Pe)))throw new Error(P[i])}function We(t,e){const i=new Xe(e);if(i.push(t),i.err)throw i.msg||P[i.err];return i.result}Xe.prototype.push=function(t,e){const i=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let a,r,o;if(this.ended)return!1;for(r=e===~~e?e:!0===e?He:Oe,"[object ArrayBuffer]"===Ve.call(t)?i.input=new Uint8Array(t):i.input=t,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(n),i.next_out=0,i.avail_out=n),a=Ze(i,r),a===je&&s&&(a=Ne(i,s),a===Pe?a=Ze(i,r):a===Ke&&(a=je));i.avail_in>0&&a===$e&&i.state.wrap>0&&0!==t[i.next_in];)De(i),a=Ze(i,r);switch(a){case Ye:case Ke:case je:case Ge:return this.onEnd(a),this.ended=!0,!1}if(o=i.avail_out,i.next_out&&(0===i.avail_out||a===$e))if("string"===this.options.to){let t=Yt(i.output,i.next_out),e=i.next_out-t,s=jt(i.output,t);i.next_out=e,i.avail_out=n-e,e&&i.output.set(i.output.subarray(t,t+e),0),this.onData(s)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out));if(a!==Pe||0!==o){if(a===$e)return a=Le(this.strm),this.onEnd(a),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},Xe.prototype.onData=function(t){this.chunks.push(t)},Xe.prototype.onEnd=function(t){t===Pe&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Ot(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var qe={Inflate:Xe,inflate:We,inflateRaw:function(t,e){return(e=e||{}).raw=!0,We(t,e)},ungzip:We,constants:$};const{Deflate:Je,deflate:Qe,deflateRaw:ti,gzip:ei}=re,{Inflate:ii,inflate:ni,inflateRaw:si,ungzip:ai}=qe;var ri={Deflate:Je,deflate:Qe,deflateRaw:ti,gzip:ei,Inflate:ii,inflate:ni,inflateRaw:si,ungzip:ai,constants:$};function oi(t,e=!1){const i=t.length,n=new ri.Inflate;for(let e=0;e<i;e++)n.push(t[e]);if(0===n.err){if(void 0===n.result)throw new Error("truncated zlib stream: no end marker in the chunks supplied");return n.result}if(!e)throw new Error(`failed to inflate zlib stream: ${n.msg||n.err}`);try{return ri.inflateRaw(function(t){const e=t.length;if(1===e)return t[0];let i=0;for(let n=0;n<e;n++)i+=t[n].length;const n=new Uint8Array(i);let s=0;for(let i=0;i<e;i++)n.set(t[i],s),s+=t[i].length;return n}(t).subarray(2))}catch(t){throw new Error(`failed to inflate zlib stream: ${n.msg||n.err}`)}}const hi=new Uint32Array(256);for(let t=0;t<256;t++){let e=t;for(let t=0;t<8;t++)1&e?e=3988292384^e>>>1:e>>>=1;hi[t]=e}const li=Object.freeze([function(t,e,i,n,s,a,r){for(let n=0;n<r;n++)i[s+n]=t[e+n]},function(t,e,i,n,s,a,r){let o=0;for(;o<n;o++)i[s+o]=t[o+e];for(;o<r;o++){const a=s+o;i[a]=t[o+e]+i[a-n]&255}},function(t,e,i,n,s,a,r){let o,h,l=0;if(a<0)for(;l<r;l++)i[s+l]=t[l+e];else for(;l<r;l++)o=t[l+e],h=i[a+l],i[s+l]=o+h&255},function(t,e,i,n,s,a,r){let o,h,l,d=0;if(a<0){for(;d<n;d++)i[s+d]=t[d+e];for(;d<r;d++){const a=s+d;i[a]=t[d+e]+(i[a-n]>>1)&255}}else{for(;d<n;d++)i[s+d]=t[d+e]+(i[a+d]>>1)&255;for(;d<r;d++)o=t[d+e],h=i[s+d-n],l=i[a+d],i[s+d]=o+(h+l>>1)&255}},function(t,e,i,n,s,a,r){let o,h,l,d,c,_,f,u,p,w=0;if(a<0){for(;w<n;w++)i[s+w]=t[w+e];for(;w<r;w++)i[s+w]=t[w+e]+i[s+w-n]&255}else{for(;w<n;w++)i[s+w]=t[w+e]+i[a+w]&255;for(;w<r;w++)o=t[w+e],d=i[a+w-n],l=i[a+w],h=i[s+w-n],c=h+l-d,_=Math.abs(c-h),f=Math.abs(c-l),u=Math.abs(c-d),p=_<=f&&_<=u?h:f<=u?l:d,i[s+w]=o+p&255}}]);function di(t,e,i,n,s,a,r,o){const h=li[t];if(void 0===h)throw new Error(`unknown filtered scanline type '${t}'`);h(e,i,n,s,a,r,o)}function ci(t,e,i,n,s,a){if(1!==i&&2!==i&&4!==i)throw new Error(`only bit depths below 8 are packed, got ${i}`);const r=(1<<i)-1;for(let o=0;o<n;o++){const n=o*i,h=t[e+(n>>3)],l=8-i-(7&n);s[a+o]=h>>>l&r}}class _i{width=0;height=0;bitDepth=0;colorType=0;compressionMethod=0;filterMethod=0;interlaceMethod=0;colors=0;alpha=!1;palette=null;pixels=null;transparency_lookup=null;text={};getWidth(){return this.width}setWidth(t){this.width=t}getHeight(){return this.height}setHeight(t){this.height=t}getBitDepth(){return this.bitDepth}setBitDepth(t){if(-1===[1,2,4,8,16].indexOf(t))throw new Error("invalid bith depth "+t);this.bitDepth=t}getColorType(){return this.colorType}setColorType(t){let e=0,i=!1;switch(t){case 0:case 3:e=1;break;case 2:e=3;break;case 4:e=2,i=!0;break;case 6:e=4,i=!0;break;default:throw new Error("invalid color type")}this.colors=e,this.alpha=i,this.colorType=t}setCompressionMethod(t){if(0!==t)throw new Error("invalid compression method "+t);this.compressionMethod=t}setFilterMethod(t){if(0!==t)throw new Error("invalid filter method "+t);this.filterMethod=t}getInterlaceMethod(){return this.interlaceMethod}setInterlaceMethod(t){if(0!==t&&1!==t)throw new Error("invalid interlace method "+t);this.interlaceMethod=t}setPalette(t){if(t.length%3!=0)throw new Error("incorrect PLTE chunk length");if(t.length>3*Math.pow(2,this.bitDepth))throw new Error("palette has more colors than 2^bitdepth");this.palette=t}getUint8Data_case3(){const t=this.width*this.height;let e;const i=this.transparency_lookup;e=null!==i?4:3;const n=new Uint8Array(t*e),s=this.pixels,a=this.palette,r=this.colors*Math.ceil(this.bitDepth/8);for(let i=0;i<t;i++){const t=i*e,o=3*s[i*r];n[t]=a[o],n[t+1]=a[o+1],n[t+2]=a[o+2]}if(null!==i){const e=i.length;for(let a=0;a<t;a++){const t=s[a*r];n[4*a+3]=t>=e?255:i[t]}}return{data:n,itemSize:e}}getUint8Data(){let t,e=0;switch(this.colorType){case 0:t=this.pixels,e=1;break;case 2:t=this.pixels,e=3;break;case 3:const i=this.getUint8Data_case3();t=i.data,e=i.itemSize;break;case 4:t=this.pixels,e=2;break;case 6:t=this.pixels,e=4;break;default:throw new Error("Unsupported color type")}return{data:t,itemSize:e}}}const fi=[137,80,78,71,13,10,26,10];function ui(t,e){return t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function pi(t,e){return t[e]}function wi(e){this.png=new _i,this.dataChunks=[],this.buffer=new s,this.buffer.endianness=t,this.buffer.fromArrayBuffer(e),this.crc_enabled=!1}wi.prototype.readBytes=function(t){const e=this.buffer,i=new Uint8Array(e.data,e.position,t);return e.skip(t),i},wi.prototype.decodeHeader=function(){const t=this.buffer,e=new Uint8Array(fi.length);if(t.readBytes(e,0,e.length),!function(t,e){const i=t.length;if(i!==e.length)return!1;for(let n=0;n<i;n++)if(t[n]!==e[n])return!1;return!0}(e,fi))throw new Error("invalid PNGReader file (bad signature)")},wi.prototype.decodeChunk=function(){const t=this.buffer,e=t.readUint32();if(e<0)throw new Error("Bad chunk length "+(4294967295&e));const i=t.position,n=t.readASCIICharacters(4),a=this.readBytes(e);switch(t.readUint32(),this.crc_enabled&&function(t,e=0,i=t.length){!function(t,e,i,n){let s=4294967295;const a=i+n;for(let t=i;t<a;t++){const i=e[t];s=hi[255&(s^i)]^s>>>8}}(0,t,e,i)}(t.raw_bytes,i,e+4),n){case"IHDR":this.decodeIHDR(a);break;case"PLTE":this.decodePLTE(a);break;case"IDAT":this.decodeIDAT(a);break;case"tRNS":this.decodeTRNS(a);break;case"IEND":this.decodeIEND(a);break;case"sRGB":this.decodesRGB(a);break;case"tIME":this.decodetIME(a);break;case"zTXt":!function(t){const e=t.byteLength,i=t.buffer,n=t.byteOffset,a=s.fromArrayBuffer(i);a.position=n,a.readASCIICharacters(79,!0);const r=a.readUint8();let o;if(0!==r)throw new Error(`Unsupported compression method '${r}'`);{const t=a.position-n,s=oi([new Uint8Array(i,a.position,e-t)]);a.fromArrayBuffer(s.buffer),o=a.readASCIICharacters(s.byteLength)}}(a);break;case"iTXt":!function(t){const e=t.byteLength,i=t.buffer,n=t.byteOffset,a=n+e,r=s.fromArrayBuffer(i);r.position=n,r.readASCIICharacters(79,!0);const o=r.readUint8(),h=r.readUint8(),l=(r.readASCIICharacters(Number.MAX_SAFE_INTEGER,!0),r.readASCIICharacters(Number.MAX_SAFE_INTEGER,!0),a-r.position);let d;if(0===o)d=r.readASCIICharacters(l);else{if(1!==o)throw new Error(`Invalid compression flag value '${o}'`);{if(0!==h)throw new Error("only compression_method 0 is supported");const t=oi([new Uint8Array(r.data,r.position,l)]);r.fromArrayBuffer(t.buffer),d=r.readASCIICharacters(t.byteLength)}}}(a)}return n},wi.prototype.decodesRGB=function(t){pi(t,0)},wi.prototype.decodetIME=function(t){pi(t,0),pi(t,1),pi(t,2),pi(t,3),pi(t,4),pi(t,5),pi(t,6)},wi.prototype.decodetEXt=function(t){const e=s.fromArrayBuffer(t.buffer),i=e.readASCIICharacters(Number.POSITIVE_INFINITY,!0),n=e.readASCIICharacters(i.length-1,!1);this.png.text[i]=n},wi.prototype.decodeiEXt=function(t){const e=s.fromArrayBuffer(t.buffer),i=e.readASCIICharacters(Number.POSITIVE_INFINITY,!0);if(e.readUint8(),e.readUint8(),e.readASCIICharacters(Number.POSITIVE_INFINITY,!0),e.readUTF8String(),0!==e.readUint8())throw new Error("Expected Null Separator after Translated keyword");const n=e.readUTF8String();this.png.text[i]=n},wi.prototype.decodeIHDR=function(t){const e=this.png;e.setWidth(ui(t,0)),e.setHeight(ui(t,4)),e.setBitDepth(pi(t,8)),e.setColorType(pi(t,9)),e.setCompressionMethod(pi(t,10)),e.setFilterMethod(pi(t,11)),e.setInterlaceMethod(pi(t,12))},wi.prototype.decodePLTE=function(t){this.png.setPalette(t)},wi.prototype.decodeIDAT=function(t){this.dataChunks.push(t)},wi.prototype.decodeTRNS=function(t){this.png.transparency_lookup=t},wi.prototype.decodeIEND=function(){},wi.prototype.decodePixels=function(){const i=this.png,n=oi(this.dataChunks,!0);if(0===i.getInterlaceMethod()?this.png.pixels=this.interlaceNone(n):this.png.pixels=this.interlaceAdam7(n),16===i.bitDepth&&function(){if(r)return a;const i=new ArrayBuffer(2),n=new Uint8Array(i),s=new Uint16Array(i);return n[0]=19,a=19==(255&s[0])?e:t,r=!0,a}()===e){const t=this.png.pixels;for(let e=0;e<t.length;e+=2){const i=t[e];t[e]=t[e+1],t[e+1]=i}}},wi.prototype.interlaceNone=function(t){const e=this.png,i=e.bitDepth,n=e.colors,s=e.width,a=e.height,r=Math.max(1,Math.ceil(n*i/8)),o=Math.ceil(n*i*s/8);if(i<8)return function(t,e,i,n,s,a){const r=new Uint8Array(i*a),o=new Uint8Array(2*s),h=Math.floor(t.length/(s+1)),l=a<h?a:h;let d=0,c=-1;for(let a=0;a<l;a++){const h=(1&a)*s;di(t[d++],t,d,o,n,h,c,s),d+=s,ci(o,h,e,i,r,a*i),c=h}return r}(t,i,n*s,r,o,a);const h=new Uint8Array(o*a);let l=0;const d=t.length;for(let e=0;e<d;e+=o+1){const i=e+1;di(t[e],t,i,h,r,l,l-o,o),l+=o}return h},wi.prototype.interlaceAdam7=function(t){const e=this.png,i=e.bitDepth,n=e.colors,s=e.width,a=e.height,r=i<8,o=Math.max(1,Math.ceil(n*i/8)),h=n*(16===i?2:1),l=new Uint8Array(h*s*a),d=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}];let c=0;const _=new Uint8Array(2*Math.ceil(n*i*s/8)),f=r?new Uint8Array(n*s):null;for(let e=0;e<7;e++){const u=d[e],p=Math.ceil((s-u.x)/u.xStep),w=Math.ceil((a-u.y)/u.yStep);if(p<=0||w<=0)continue;const g=n*p,b=Math.ceil(g*i/8);let m=-1;for(let e=0;e<w;e++){const n=e%2*b;di(t[c++],t,c,_,o,n,m,b),c+=b,m=n;let d=_,w=n;r&&(ci(_,n,i,g,f,0),d=f,w=0);for(let t=0;t<p;t++){const i=u.x+t*u.xStep,n=u.y+e*u.yStep;if(!(i>=s||n>=a))for(let e=0;e<h;e++)l[(n*s+i)*h+e]=d[w+t*h+e]}}}return l},wi.prototype.unFilter=function(t,e,i,n,s,a,r,o){di(t,e,i,n,s,a,r,o)},wi.prototype.parse=function(){for(this.decodeHeader();"IEND"!==this.decodeChunk(););return this.decodePixels(),this.png},self.Lib={decode:async function(t,e="png"){if(!(t instanceof ArrayBuffer))throw new Error(".data argument must be an ArrayBuffer, instead was something else");if("png"===e.toLowerCase())return await async function(t){return new Promise((e,i)=>{const n=new wi(t).parse(),s=n.getUint8Data(),a=n.getWidth(),r=n.getHeight();e({data:s.data.buffer,width:a,height:r,itemSize:s.itemSize,bitDepth:n.getBitDepth()})})}(t);throw new Error("Unsupported type")}};
function t(t,e){const a=t.length;if(a!==e.length)return!1;for(let i=0;i<a;i++)if(t[i]!==e[i])return!1;return!0}function e(t){let e=t-1;return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}function a(t,e,a,i,n){let s,r,o;for(o=0;o<n;o++)s=e+o,r=i+o,a[r]=t[s]}function i(t,e,a,i,n){for(let s=0;s<n;s++){const n=e+s,r=i+s,o=a[r];a[r]=t[n],t[n]=o}}const n=new Uint32Array(781250);function s(t,e){return t<e?e:t}function r(t,e){return t<e?t:e}function o(t,e,a,i,n,o){const c=a[i+0],h=a[i+1],d=a[i+2],_=a[i+3],l=a[i+4],f=a[i+5],u=n[o+0],b=n[o+1],g=n[o+2],m=n[o+3],y=n[o+4],p=n[o+5],w=r(c,u),v=r(h,b),x=r(d,g),A=s(_,m),k=s(l,y),z=s(f,p);t[e+0]=w,t[e+1]=v,t[e+2]=x,t[e+3]=A,t[e+4]=k,t[e+5]=z}function c(t,e,a,i,n,s,r,o){t[e]=a,t[e+1]=i,t[e+2]=n,t[e+3]=s,t[e+4]=r,t[e+5]=o}function h(t,e,a,i,n,s){const r=i-t,o=s-a;return(n-e)*(r+o)+o*r}function d(t){let e=t;return e=50331903&(e|e<<16),e=50393103&(e|e<<8),e=51130563&(e|e<<4),e=153391689&(e|e<<2),e}function _(t,e,a,i){const n=i[0],s=i[1],r=i[2],o=i[3]-n,c=i[4]-s,h=i[5]-r;return function(t,e,a){const i=1023*t,n=1023*e,s=1023*a;return function(t,e,a){return d(t)|d(e)<<1|d(a)<<2}(Math.round(i),Math.round(n),Math.round(s))}((t-n)*(0!==o?1/o:0),(e-s)*(0!==c?1/c:0),(a-r)*(0!==h?1/h:0))}function l(t,e,a){const i=t[a],n=t[a+1],s=t[a+2];c(t,e,i,n,s,i,n,s)}function f(t,e,a){const i=t[e],n=t[e+1],s=t[e+2];return _(.5*(i+t[e+3]),.5*(n+t[e+4]),.5*(s+t[e+5]),a)}n.pointer=0;const u=n;class b{__data_buffer;__data_float32;__data_uint32;__node_count_binary=0;__node_count_leaf=0;constructor(){this.data=new ArrayBuffer(320)}estimateByteSize(){return this.data.byteLength+248}getTotalBoxCount(){return this.__node_count_binary+this.__node_count_leaf}get binary_node_count(){return this.__node_count_binary}get leaf_node_count(){return this.__node_count_leaf}getLeafBlockAddress(){return 6*this.__node_count_binary}get float32(){return this.__data_float32}get uint32(){return this.__data_uint32}set data(t){this.__data_buffer=t,this.__data_float32=new Float32Array(this.__data_buffer),this.__data_uint32=new Uint32Array(this.__data_buffer)}get data(){return this.__data_buffer}getNodeAddress(t){const e=this.__node_count_binary,a=t-e;return a<0?6*t:6*e+7*a}initialize_structure(){const t=4*(6*this.__node_count_binary+7*this.__node_count_leaf);this.__data_buffer.byteLength<t&&(this.data=new ArrayBuffer(t))}setLeafCount(t){this.__node_count_leaf=t;const a=e(t);this.__node_count_binary=t<=1?a:a-1}getLeafAddress(t){return 7*t+6*this.__node_count_binary}setLeafData(t,e,a,i,n,s,r,o){const h=this.getLeafAddress(t);c(this.__data_float32,h,a,i,n,s,r,o),this.__data_uint32[h+6]=e}readBounds(t,e,i){a(this.__data_float32,t,e,i,6)}readLeafPayload(t){const e=this.getLeafBlockAddress()+7*t+6;return this.__data_uint32[e]}compute_total_surface_area(){let t=0;const e=new Float32Array(6);for(let a=0;a<this.getTotalBoxCount();a++){let i;i=a<this.__node_count_binary?6*a:7*(a-this.__node_count_binary)+this.getLeafBlockAddress(),this.readBounds(i,e,0),t+=h(e[0],e[1],e[2],e[3],e[4],e[5])}return t}sort_morton(t){const e=6*this.__node_count_binary;if(this.__node_count_leaf<2)return;const a=u.pointer;let i,n,s=a;u[s++]=0,u[s++]=this.__node_count_leaf-1;const r=this.__data_float32;for(;s>a;){s-=2;const a=u[s+1],o=u[s];i=o,n=a;const c=f(r,7*(o+a>>1)+e,t);for(;i<=n;){for(;f(r,7*i+e,t)<c;)i++;for(;f(r,7*n+e,t)>c;)n--;i<=n&&(i!==n&&this.__swap_leaves(i,n),i++,n--)}o<n&&(u[s++]=o,u[s++]=n),i<a&&(u[s++]=i,u[s++]=a)}}__swap_leaves(t,e){const a=this.getLeafBlockAddress(),n=7*t+a,s=7*e+a;i(this.__data_float32,n,this.__data_float32,s,7)}build(){const t=this.__node_count_binary,e=6*t;let i,n,s,r,c=Math.floor(Math.log(t)/Math.log(2));s=Math.pow(2,c),n=6*(s-1);const h=this.__node_count_leaf,d=this.__data_float32;for(i=0;i<s;i++){const t=i<<1,s=t+1,r=e+7*t;s<h?o(d,n,d,r,d,e+7*s):t<h?a(d,r,d,n,6):l(this.__data_float32,n,n-6),n+=6}for(c--;c>=0;c--)for(s=1<<c,r=s-1,i=0;i<s;i++){const t=6*(1+(r<<1));o(d,6*r,d,t,d,t+6),r++}}}function g(t,e,a){const i=t|e|a;return 3&i?1&i?1:2:4}function m(t,e,a,i,n){let s,r;const o=g(e,i,n);4===o?(s=new Uint32Array(t,e,n>>>2),r=new Uint32Array(a,i,n>>>2)):2===o?(s=new Uint16Array(t,e,n>>>1),r=new Uint16Array(a,i,n>>>1)):(s=new Uint8Array(t,e,n),r=new Uint8Array(a,i,n)),r.set(s)}function y(t){return t+(4-t%4)%4}const p={BigEndian:!1,LittleEndian:!0},w=new Float32Array(1),v=new Int32Array(w.buffer);class x{endianness=p.LittleEndian;position=0;get length(){throw new Error("Deprecated, use 'capacity' instead")}set length(t){throw new Error("Deprecated, use 'capacity' instead")}capacity=1024;data=new ArrayBuffer(1024);dataView=new DataView(this.data);__data_uint8=new Uint8Array(this.data);__growFactor=1.1;get raw_bytes(){return this.__data_uint8}fromArrayBuffer(t){this.data=t,this.dataView=new DataView(t),this.__data_uint8=new Uint8Array(t),this.capacity=t.byteLength,this.position=0}trim(){return this.setCapacity(this.position),this}skip(t){this.position+=t}setCapacity(t){if(t<this.position)throw new Error(`Attempting to set capacity(=${t}) below current position(=${this.position})`);if(this.capacity===t)return;const e=this.__data_uint8,a=new Uint8Array(t);this.position>0&&m(e.buffer,0,a.buffer,0,Math.min(e.buffer.byteLength,a.buffer.byteLength,this.position)),this.data=a.buffer,this.__data_uint8=a,this.dataView=new DataView(this.data),this.capacity=t}ensureCapacity(t){const e=this.capacity;if(e>=t)return;const a=y(Math.ceil(Math.max(t,e*this.__growFactor,e+1024)));this.setCapacity(a)}readFloat16(){return function(t){let e=0;const a=(31744&t)>>10,i=1023&t;let n=1;return t>>15&&(n=-1),e=0!==a?31===a?0!==i?NaN:Infinity*n:n*Math.pow(2,a-15)*(1+i/1024):n*(i/1024*6103515625e-14),e}(this.readUint16())}readFloat32(){const t=this.dataView.getFloat32(this.position,this.endianness);return this.position+=4,t}readFloat64(){const t=this.dataView.getFloat64(this.position,this.endianness);return this.position+=8,t}readInt8(){const t=this.dataView.getInt8(this.position);return this.position+=1,t}readInt16(){const t=this.dataView.getInt16(this.position,this.endianness);return this.position+=2,t}readInt16LE(){const t=this.dataView.getInt16(this.position,p.LittleEndian);return this.position+=2,t}readInt16BE(){const t=this.dataView.getInt16(this.position,p.BigEndian);return this.position+=2,t}readInt32(){const t=this.dataView.getInt32(this.position,this.endianness);return this.position+=4,t}readInt32LE(){const t=this.dataView.getInt32(this.position,p.LittleEndian);return this.position+=4,t}readInt32BE(){const t=this.dataView.getInt32(this.position,p.BigEndian);return this.position+=4,t}readInt64(){const t=this.dataView.getBigInt64(this.position,this.endianness);return this.position+=8,t}readUint8(){const t=this.dataView.getUint8(this.position);return this.position+=1,t}readUint16(){const t=this.dataView.getUint16(this.position,this.endianness);return this.position+=2,t}readUint16LE(){const t=this.dataView.getUint16(this.position,p.LittleEndian);return this.position+=2,t}readUint16BE(){const t=this.dataView.getUint16(this.position,p.BigEndian);return this.position+=2,t}readUint24(){return this.endianness===p.BigEndian?this.readUint24BE():this.readUint24LE()}readUint24LE(){const t=this.dataView.getUint8(this.position),e=this.dataView.getUint8(this.position+1),a=this.dataView.getUint8(this.position+2);return this.position+=3,t|e<<8|a<<16}readUint24BE(){const t=this.dataView.getUint8(this.position),e=this.dataView.getUint8(this.position+1),a=this.dataView.getUint8(this.position+2);return this.position+=3,a|e<<8|t<<16}readUint32(){const t=this.dataView.getUint32(this.position,this.endianness);return this.position+=4,t}readUint32LE(){const t=this.dataView.getUint32(this.position,p.LittleEndian);return this.position+=4,t}readUint32BE(){const t=this.dataView.getUint32(this.position,p.BigEndian);return this.position+=4,t}readUint64(){const t=this.dataView.getBigUint64(this.position,this.endianness);return this.position+=8,t}readUint8Array(t,e,a){for(let i=0;i<a;i++)t[i+e]=this.readUint8()}readUint16Array(t,e,a){for(let i=0;i<a;i++)t[i+e]=this.readUint16()}readUint32Array(t,e,a){for(let i=0;i<a;i++)t[i+e]=this.readUint32()}readInt8Array(t,e,a){for(let i=0;i<a;i++)t[i+e]=this.readInt8()}readInt16Array(t,e,a){for(let i=0;i<a;i++)t[i+e]=this.readInt16()}readInt32Array(t,e,a){for(let i=0;i<a;i++)t[i+e]=this.readInt32()}readFloat32Array(t,e,a){for(let i=0;i<a;i++)t[i+e]=this.readFloat32()}readFloat64Array(t,e,a){for(let i=0;i<a;i++)t[i+e]=this.readFloat64()}writeFloat32Array(t,e,a){for(let i=0;i<a;i++)this.writeFloat32(t[i+e])}writeFloat16Array(t,e,a){for(let i=0;i<a;i++)this.writeFloat16(t[i+e])}readFloat16Array(t,e,a){for(let i=0;i<a;i++)t[i+e]=this.readFloat16()}writeFloat16(t){const e=function(t){let e=t;Number.isFinite(e)&&(e>65504||e<-65504)&&(e=e>0?65504:-65504),w[0]=e;const a=v[0];let i=a>>16&32768,n=a>>12&2047;const s=a>>23&255;return s<103?i:s>142?(i|=31744,255===s&&8388607&a&&(i|=512),i):s<113?(n|=2048,i|=(n>>114-s)+(n>>113-s&1),i):(i|=s-112<<10|n>>1,i+=1&n,i)}(t);this.writeUint16(e)}writeFloat32(t){const e=this.position+4;this.ensureCapacity(e),this.dataView.setFloat32(this.position,t,this.endianness),this.position=e}writeFloat64(t){const e=this.position+8;this.ensureCapacity(e),this.dataView.setFloat64(this.position,t,this.endianness),this.position=e}writeInt8(t){const e=this.position+1;this.ensureCapacity(e),this.dataView.setInt8(this.position,t),this.position=e}writeInt16(t){const e=this.position+2;this.ensureCapacity(e),this.dataView.setInt16(this.position,t,this.endianness),this.position=e}writeInt16BE(t){const e=this.position+2;this.ensureCapacity(e),this.dataView.setInt16(this.position,t,p.BigEndian),this.position=e}writeInt16LE(t){const e=this.position+2;this.ensureCapacity(e),this.dataView.setInt16(this.position,t,p.LittleEndian),this.position=e}writeInt32(t){const e=this.position+4;this.ensureCapacity(e),this.dataView.setInt32(this.position,t,this.endianness),this.position=e}writeInt32BE(t){const e=this.position+4;this.ensureCapacity(e),this.dataView.setInt32(this.position,t,p.BigEndian),this.position=e}writeInt32LE(t){const e=this.position+4;this.ensureCapacity(e),this.dataView.setInt32(this.position,t,p.LittleEndian),this.position=e}writeInt64(t){const e=this.position+8;this.ensureCapacity(e),this.dataView.setBigInt64(this.position,t,this.endianness),this.position=e}writeInt8Array(t,e,a){this.ensureCapacity(this.position+a);for(let i=0;i<a;i++)this.writeInt8(t[e+i])}writeInt16Array(t,e,a){this.ensureCapacity(this.position+2*a);for(let i=0;i<a;i++)this.writeInt16(t[e+i])}writeInt32Array(t,e,a){this.ensureCapacity(this.position+4*a);for(let i=0;i<a;i++)this.writeInt32(t[e+i])}writeUint8(t){const e=this.position+1;this.ensureCapacity(e),this.dataView.setUint8(this.position,t),this.position=e}writeUint8Array(t,e,a){for(let i=0;i<a;i++)this.writeUint8(t[e+i])}writeUint16(t){const e=this.position+2;this.ensureCapacity(e),this.dataView.setUint16(this.position,t,this.endianness),this.position=e}writeUint16BE(t){const e=this.position+2;this.ensureCapacity(e),this.dataView.setUint16(this.position,t,p.BigEndian),this.position=e}writeUint16LE(t){const e=this.position+2;this.ensureCapacity(e),this.dataView.setUint16(this.position,t,p.LittleEndian),this.position=e}writeUint16Array(t,e,a){for(let i=0;i<a;i++)this.writeUint16(t[e+i])}writeUint24(t){this.endianness===p.BigEndian?this.writeUint24BE(t):this.writeUint24LE(t)}writeUint24BE(t){const e=this.position+3;this.ensureCapacity(e);const a=255&t,i=t>>8&255,n=t>>16&255;this.dataView.setUint8(this.position,n),this.dataView.setUint8(this.position+1,i),this.dataView.setUint8(this.position+2,a),this.position=e}writeUint24LE(t){const e=this.position+3;this.ensureCapacity(e);const a=255&t,i=t>>8&255,n=t>>16&255;this.dataView.setUint8(this.position,a),this.dataView.setUint8(this.position+1,i),this.dataView.setUint8(this.position+2,n),this.position=e}writeUintVar(t){let e=!0,a=t;for(;e||0!==a;){e=!1;let t=127&a;a>>=7,a>0&&(t|=128),this.writeUint8(t)}}readUintVar(){let t=!0,e=0,a=0;for(;t;){let i=this.readUint8();t=!!(128&i),e|=(127&i)<<a,a+=7}return e}writeUint32(t){const e=this.position+4;this.ensureCapacity(e),this.dataView.setUint32(this.position,t,this.endianness),this.position=e}writeUint32BE(t){const e=this.position+4;this.ensureCapacity(e),this.dataView.setUint32(this.position,t,p.BigEndian),this.position=e}writeUint32LE(t){const e=this.position+4;this.ensureCapacity(e),this.dataView.setUint32(this.position,t,p.LittleEndian),this.position=e}writeUint64(t){const e=this.position+8;this.ensureCapacity(e),this.dataView.setBigUint64(this.position,t,this.endianness),this.position=e}writeUint32Array(t,e,a){this.ensureCapacity(this.position+4*a);for(let i=0;i<a;i++)this.writeUint32(t[e+i])}writeBytes(t,e,a){const i=e+a,n=this.position,s=n+a;if(this.ensureCapacity(s),0===e&&t.length===a)this.__data_uint8.set(t,n);else if("function"==typeof t.subarray)this.__data_uint8.set(t.subarray(e,i),n);else for(let i=0;i<a;i++)this.__data_uint8[n+i]=t[e+i];this.position=s}readBytes(t,e,i){const n=this.position,s=n+i,r=this.__data_uint8;i<128?a(r,n,t,e,i):t.set(r.subarray(n,s),e),this.position=s}writeUTF8String(t){if(null===t)return void this.writeUint32(4294967295);if(void 0===t)return void this.writeUint32(4294967294);let e=0;const a=t.length;if(a>=4294967294)throw new Error("String is too long");this.writeUint32(a);let i=this.position;const n=Math.max(32,a+(a>>1)+7);this.ensureCapacity(n+i);let s=this.__data_uint8,r=this.capacity;for(;e<a;){let n=t.charCodeAt(e++);if(n>=55296&&n<=56319){if(e<a){const a=t.charCodeAt(e);56320==(64512&a)&&(++e,n=((1023&n)<<10)+(1023&a)+65536)}n>=55296&&n<=56319&&(n=65533)}if(i+4>r&&(this.position=i,this.ensureCapacity(i+4),r=this.capacity,s=this.__data_uint8),4294967168&n){if(4294965248&n)if(4294901760&n){if(4292870144&n)continue;s[i++]=n>>18&7|240,s[i++]=n>>12&63|128,s[i++]=n>>6&63|128}else s[i++]=n>>12&15|224,s[i++]=n>>6&63|128;else s[i++]=n>>6&31|192;s[i++]=63&n|128}else s[i++]=n}this.position=i}readUTF8String(){const t=this.readUint32();if(4294967295===t)return null;if(4294967294===t)return;const e=this.__data_uint8;let a="",i=this.position,n=0;for(;i<this.capacity&&n<t;){const t=e[i++];let s;if(0===t)break;128&t?192==(224&t)?s=(31&t)<<6|63&e[i++]:224==(240&t)?s=(31&t)<<12|(63&e[i++])<<6|63&e[i++]:240==(248&t)&&(s=(7&t)<<18|(63&e[i++])<<12|(63&e[i++])<<6|63&e[i++],s>65535&&(s-=65536,a+=String.fromCharCode(s>>>10&1023|55296),n++,s=56320|1023&s)):s=t,n++,a+=String.fromCharCode(s)}return this.position=i,a}writeASCIIString(t){const e=t.length,a=this.position,i=a+e;this.ensureCapacity(i);for(let i=0;i<e;i++){const e=t.charCodeAt(i);if(e>127)throw new Error(`Character ${String.fromCharCode(e)} can't be represented by a US-ASCII byte.`);this.__data_uint8[a+i]=e}this.position=i}readASCIICharacters(t,e=!1){let a="";for(let i=0;i<t;i++){const t=this.readUint8();if(e&&0===t)break;a+=String.fromCharCode(t)}return a}toString(){return`BinaryBuffer[position=${this.position}, capacity=${this.capacity}, endianness=${this.endianness}]`}toHexString(){const t=this.__data_uint8,e=Math.min(t.length,this.position);let a="";for(let i=0;i<e;i++)a+=t[i].toString(16).padStart(2,"0").toUpperCase();return a}static fromEndianness(t){const e=new x;return e.endianness=t,e}static fromArrayBuffer(t){const e=new x;return e.fromArrayBuffer(t),e}static copyUTF8String(t,e){const a=t.readUTF8String();return e.writeUTF8String(a),a}static copyUintVar(t,e){const a=t.readUintVar();return e.writeUintVar(a),a}static copyUint8(t,e){const a=t.readUint8();return e.writeUint8(a),a}static copyUint16(t,e){const a=t.readUint16();return e.writeUint16(a),a}static copyUint32(t,e){const a=t.readUint32();return e.writeUint32(a),a}static copyFloat32(t,e){const a=t.readFloat32();return e.writeFloat32(a),a}static copyFloat64(t,e){const a=t.readFloat64();return e.writeFloat64(a),a}static copyBytes(t,e,a){const i=new Uint8Array(a);return t.readBytes(i,0,a),e.writeBytes(i,0,a),i}}x.prototype.isBinaryBuffer=!0;let A=p.LittleEndian,k=!1;function z(){if(k)return A;const t=new ArrayBuffer(2),e=new Uint8Array(t),a=new Uint16Array(t);return e[0]=19,A=19==(255&a[0])?p.LittleEndian:p.BigEndian,k=!0,A}const j={Uint8:"uint8",Uint16:"uint16",Uint32:"uint32",Uint64:"uint64",Int8:"int8",Int16:"int16",Int32:"int32",Int64:"int64",Float16:"float16",Float32:"float32",Float64:"float64"};function U(...t){return function(t,e,a){let i=a;for(let e=0;e<a;e+=1)i=(i<<5)-i+(t[e]>>>0);return i>>>0}(t,0,t.length)}function E(t,e,a){const i=e|a;return 3&i?1&i?function(t,e,a){let i=a,n=0;const s=3&a;for(;n<0+s;n++)i=(i<<5)-i+t[n];for(;n<a;n+=4)i=(i<<5)-i+(t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24);return i}(new Uint8Array(t,e,a),0,a):function(t,e,a){let i=a,n=0;for(1&a&&(i=(i<<5)-i+t[n++]);n<a;n+=2)i=(i<<5)-i+(t[n]<<16|t[n+1]);return i}(new Uint16Array(t,e,a>>>1),0,a>>>1):function(t,e,a){let i=a;for(let e=0;e<a;++e)i=(i<<5)-i+t[e];return i}(new Uint32Array(t,e,a>>>2),0,a>>>2)}function F(e,a,i,n,s){if(e===i&&a===n)return!0;const r=g(a,n,s);let o,c;return 4===r?(o=new Uint32Array(e,a,s>>>2),c=new Uint32Array(i,n,s>>>2)):2===r?(o=new Uint16Array(e,a,s>>>1),c=new Uint16Array(i,n,s>>>1)):(o=new Uint8Array(e,a,s),c=new Uint8Array(i,n,s)),t(o,c)}function I(t,e=!1){return e&&crossOriginIsolated?new SharedArrayBuffer(t):new ArrayBuffer(t)}class C{next=null;flags=0;generation=-1;constructor(t,e){this.handle=t,this.context=e}setFlag(t){this.flags|=t}clearFlag(t){this.flags&=~t}writeFlag(t,e){e?this.setFlag(t):this.clearFlag(t)}getFlag(t){return(this.flags&t)===t}}C.prototype.isSignalHandler=!0;class B{handlers=new Map;flags=0;generation=0;get silent(){return this.getFlag(1)}set silent(t){this.writeFlag(1,t)}setFlag(t){this.flags|=t}clearFlag(t){this.flags&=~t}writeFlag(t,e){e?this.setFlag(t):this.clearFlag(t)}getFlag(t){return(this.flags&t)===t}contains(t,e){const a=this.handlers.get(t);if(void 0===a)return!1;const i=function(t,e,a){let i=t;for(;;){if(i.handle===e&&i.context===a)return i;if(i=i.next,null===i)return null}}(a,t,e);return null!==i}mute(){this.setFlag(1)}unmute(){this.clearFlag(1)}hasHandlers(){return this.handlers.size>0}addOne(t,e){const a=new C(t,e);a.setFlag(1),this.#t(a)}add(t,e){const a=new C(t,e);this.#t(a)}#t(t){t.generation=this.generation;const e=t.handle,a=this.handlers.get(e);void 0===a||(t.next=a),this.handlers.set(e,t)}remove(t,e){const a=this.handlers.get(t);if(void 0===a)return!1;if(a.handle===t&&a.context===e)return null===a.next?this.handlers.delete(t):this.handlers.set(t,a.next),!0;let i=a,n=a.next;for(;null!==n;){if(n.handle===t&&n.context===e)return i.next=n.next,!0;i=n,n=n.next}return!1}removeAll(){this.handlers.clear()}#e(t){const e=this.handlers.get(t.handle);if(void 0===e)return!1;if(e===t)return null===e.next?this.handlers.delete(t.handle):this.handlers.set(t.handle,e.next),!0;let a=e,i=e.next;for(;null!==i;){const e=i.next;if(i===t)return a.next=e,!0;a=i,i=e}return!1}promise(){return new Promise((t,e)=>{this.addOne((...e)=>{t(e)})})}dispatch(...t){if(1&this.flags)return;this.generation++;const e=this.handlers;for(const a of e.values()){let e=a;do{const a=e.next;if(e.generation<this.generation){e.getFlag(1)&&this.#e(e);const a=e.handle;try{a.apply(e.context,t)}catch(t){}}e=a}while(null!==e)}}send0(){if(1&this.flags)return;this.generation++;const t=this.handlers;for(const e of t.values()){let t=e;do{const e=t.next;if(t.generation<this.generation){t.getFlag(1)&&this.#e(t);const e=t.handle;try{e.call(t.context)}catch(t){}}t=e}while(null!==t)}}send1(t){if(1&this.flags)return;this.generation++;const e=this.handlers;for(const a of e.values()){let e=a;do{const a=e.next;if(e.generation<this.generation){e.getFlag(1)&&this.#e(e);const a=e.handle;try{a.call(e.context,t)}catch(t){}}e=a}while(null!==e)}}send2(t,e){if(1&this.flags)return;this.generation++;const a=this.handlers;for(const i of a.values()){let a=i;do{const i=a.next;if(a.generation<this.generation){a.getFlag(1)&&this.#e(a);const i=a.handle;try{i.call(a.context,t,e)}catch(t){}}a=i}while(null!==a)}}send3(t,e,a){if(1&this.flags)return;this.generation++;const i=this.handlers;for(const n of i.values()){let i=n;do{const n=i.next;if(i.generation<this.generation){i.getFlag(1)&&this.#e(i);const n=i.handle;try{n.call(i.context,t,e,a)}catch(t){}}i=n}while(null!==i)}}send4(t,e,a,i){if(1&this.flags)return;this.generation++;const n=this.handlers;for(const s of n.values()){let n=s;do{const s=n.next;if(n.generation<this.generation){n.getFlag(1)&&this.#e(n);const s=n.handle;try{s.call(n.context,t,e,a,i)}catch(t){}}n=s}while(null!==n)}}send5(t,e,a,i,n){if(1&this.flags)return;this.generation++;const s=this.handlers;for(const r of s.values()){let s=r;do{const r=s.next;if(s.generation<this.generation){s.getFlag(1)&&this.#e(s);const r=s.handle;try{r.call(s.context,t,e,a,i,n)}catch(n){}}s=r}while(null!==s)}}send6(t,e,a,i,n,s){if(1&this.flags)return;this.generation++;const r=this.handlers;for(const o of r.values()){let r=o;do{const o=r.next;if(r.generation<this.generation){r.getFlag(1)&&this.#e(r);const o=r.handle;try{o.call(r.context,t,e,a,i,n,s)}catch(n){}}r=o}while(null!==r)}}send8(t,e,a,i,n,s,r,o){if(1&this.flags)return;this.generation++;const c=this.handlers;for(const h of c.values()){let c=h;do{const h=c.next;if(c.generation<this.generation){c.getFlag(1)&&this.#e(c);const h=c.handle;try{h.call(c.context,t,e,a,i,n,s,r,o)}catch(n){}}c=h}while(null!==c)}}merge(t){const e=new B;function a(){e.dispatch(...arguments)}return this.add(a),t.add(a),e}}B.prototype.isSignal=!0;var M=B;class S{length=0;constructor(t,e=!1){this.spec=t,this.data=I(8*t.bytesPerRecord,e),this.capacity=8,this.dataView=new DataView(this.data),this.on={added:new M}}set array_buffer(t){this.data=t,this.dataView=new DataView(t),this.capacity=Math.floor(t.byteLength/this.spec.bytesPerRecord),this.length=0}hash(){const t=this.data.byteLength,e=this.dataView;let a=t;const i=t>>2,n=s(Math.floor(i/31),1),r=Math.floor(i/n);for(let t=0;t<r;t++){const i=t*n<<2;a=(a<<5)-a+e.getUint32(i)}return a}setCapacity(t){if(this.capacity===t)return;const e=this.data,a=this.spec.bytesPerRecord,i=t*a;try{const t=this.data.constructor;this.data=new t(i)}catch(t){throw new Error("failed to create a new array buffer of size: "+i)}if(this.data.byteLength!==i)throw new Error("Generated array was truncated unexpectedly from "+i+" to "+this.data.byteLength);const n=new Uint8Array(this.data),s=new Uint8Array(e),r=this.length*a;try{n.set(s.subarray(0,r),0)}catch(t){throw t instanceof RangeError?new Error("Failed to copy contents of original due to to size violation. OldSize: "+r+", NewSize: "+this.data.byteLength):t}this.capacity=t,this.dataView=new DataView(this.data,0)}trim(){this.setCapacity(this.length)}resize(t){if(this.capacity<t){const e=Math.max(Math.ceil(1.5*t),t+32);this.setCapacity(e)}else.5*this.capacity>t&&this.setCapacity(t)}writeCellValue(t,e,a){const i=this.spec,n=t*i.bytesPerRecord;(0,i.cellWriters[e])(this.dataView,n,a)}readCellValue(t,e){const a=this.spec,i=t*a.bytesPerRecord;return(0,a.cellReaders[e])(this.dataView,i)}removeRows(t,e){const a=this.data,i=new Uint8Array(a),n=this.spec.bytesPerRecord,s=t*n,r=s+e*n,o=this.length*n;i.copyWithin(s,r,o),this.length-=e,this.resize(this.length)}insertRows(t,e){const a=this.length+e;this.resize(a);const i=this.data,n=this.spec.bytesPerRecord,s=(t+e)*n,r=a*n,o=t*n;new Uint8Array(i).copyWithin(s,o,r),this.length=a}createEmptyRow(){const t=this.length+1;this.resize(t);const e=this.length;return this.length=t,e}addRow(t){const e=this.createEmptyRow();return this.spec.writeRowMethod(this.dataView,this.spec.bytesPerRecord*e,t),this.on.added.send2(e,t),e}addRows(t,e){throw new Error("deprecated, use .addRow and .writeRow instead")}copyRow(t,e){if(t===e)return;const a=this.spec.bytesPerRecord,i=t*a,n=e*a,s=this.dataView;for(let t=0;t<a;t++){const e=s.getUint8(i+t);s.setUint8(n+t,e)}}readRow(t,e=[]){const a=this.spec;return a.readRowMethod(this.dataView,a.bytesPerRecord*t,e),e}writeRow(t,e){const a=this.spec;a.writeRowMethod(this.dataView,a.bytesPerRecord*t,e)}clearRow(t){const e=this.spec.bytesPerRecord,a=t*e,i=this.dataView;for(let t=0;t<e;t++)i.setUint8(a+t,0)}reverse_rows(){const t=this.spec.bytesPerRecord,e=new Uint8Array(t),i=this.data,n=new Uint8Array(i),s=this.length;if(s<=1)return;const r=s-1,o=r>>>1;for(let i=0;i<=o;i++){const s=i*t;a(n,s,e,0,t);const o=(r-i)*t;n.copyWithin(s,o,o+t),n.set(e,o)}}clear(){this.length=0,this.setCapacity(0)}toRowArray(){const t=[];for(let e=0;e<this.length;e++){const a=this.readRow(e);t.push(a)}return t}printToConsole(){this.toRowArray()}copy(t){if(!this.spec.equals(t.spec))throw new Error("Different table specs");const e=t.length;this.length=e,this.resize(e);const a=t.spec.bytesPerRecord*e;m(t.data,0,this.data,0,a)}equals(t){if(t===this)return!0;if(null==t)return!1;if(!this.spec.equals(t.spec))return!1;const e=this.length;if(e!==t.length)return!1;const a=e*this.spec.bytesPerRecord,i=this.dataView,n=t.dataView;for(let t=0;t<a;t++)if(i.getUint8(t)!==n.getUint8(t))return!1;return!0}}const N={[j.Uint8]:"getUint8",[j.Uint16]:"getUint16",[j.Uint32]:"getUint32",[j.Uint64]:"getBigUint64",[j.Int8]:"getInt8",[j.Int16]:"getInt16",[j.Int32]:"getInt32",[j.Int64]:"getBigInt64",[j.Float16]:"getFloat16",[j.Float32]:"getFloat32",[j.Float64]:"getFloat64"},V={[j.Uint8]:"setUint8",[j.Uint16]:"setUint16",[j.Uint32]:"setUint32",[j.Uint64]:"setBigUint64",[j.Int8]:"setInt8",[j.Int16]:"setInt16",[j.Int32]:"setInt32",[j.Int64]:"setBigInt64",[j.Float16]:"setFloat16",[j.Float32]:"setFloat32",[j.Float64]:"setFloat64"},R={[j.Uint8]:1,[j.Uint16]:2,[j.Uint32]:4,[j.Uint64]:8,[j.Int8]:1,[j.Int16]:2,[j.Int32]:4,[j.Int64]:8,[j.Float16]:2,[j.Float32]:4,[j.Float64]:8};function P(t,e){return t.equals(e)}function D(t){return t.hash()}function T(t){if(t<=256)return Uint8Array;if(t<=65536)return Uint16Array;if(t<=4294967295)return Uint32Array;throw new Error(`Unsupported size ${t}`)}function L(t,e){return(t<<2)+t+1&e}class q{constructor(t,e,a){this.key=t,this.value=e,this.hash=a}}q.prototype.isHashMapEntry=!0;const O=4294967295,X=new Uint32Array(0);class K{__bins=X;__entries=new Array(0);__entries_bound=0;__entries_start=0;__size=0;__bin_count=0;__entries_allocated_count=0;__bin_count_power_of_two=0;__entries_count_power_of_two=0;__bin_count_mask=0;__load_factor=.75;__version=0;constructor({keyHashFunction:t=D,keyEqualityFunction:a=P,capacity:i=16,loadFactor:n=.75}={}){this.keyHashFunction=t,this.keyEqualityFunction=a,this.__load_factor=n,this.#a(e(i))}get size(){return this.__size}getCurrentLoad(){return this.__size/this.__bin_count}#a(t){if(t<this.__size)throw new Error(`count must be at least equal to must of records in the map (=${this.__size}), instead was ${t}`);this.__entries_count_power_of_two=function(t){let e=t,a=0;return 65535&e||(e>>=16,a+=16),255&e||(e>>=8,a+=8),15&e||(e>>=4,a+=4),3&e||(e>>=2,a+=2),1&e||(e>>=1,a+=1),0===e&&(a+=1),a}(t),this.__bin_count_power_of_two=this.__entries_count_power_of_two+1,this.__bin_count=2**this.__bin_count_power_of_two,this.__bin_count_mask=this.__bin_count-1;const e=this.__entries_allocated_count;this.__entries_allocated_count=2**this.__entries_count_power_of_two;const i=T(this.__entries_allocated_count+2);this.__bins=new i(this.__bin_count);const n=new Array(this.__entries_allocated_count),s=this.__entries;this.__entries=n,a(s,0,n,0,r(e,this.__entries_allocated_count)),this.__size>0&&this.rebuild()}compute_bin_index(t){return(t>>>16^t)>>>0&this.__bin_count_mask}#i(t){const e=this.keyHashFunction(t);return e===O?0:e}#n(t,e,a){return t.hash===e&&(t.key===a||this.keyEqualityFunction(t.key,a))}#s(t,e,a){const i=this.__entries_bound;this.__entries_bound++;const n=this.__entries[i];return void 0!==n?(n.hash=a,n.key=t,n.value=e):this.__entries[i]=new q(t,e,a),i}#r(t){t.key=null,t.value=null,t.hash=O}#o(){this.__entries_bound===this.__entries_allocated_count&&(this.__size>=this.__entries_allocated_count*this.__load_factor?this.#c():this.rebuild())}set(t,e){this.#o();const a=this.#i(t);let i=this.compute_bin_index(a),n=-1;for(;;){const s=this.__bins[i];if(s>1){const i=this.__entries[s-2];if(this.#n(i,a,t))return void(i.value=e)}else{if(0===s){-1!==n&&(i=n);const s=this.#s(t,e,a)+2;this.__bins[i]=s;break}-1===n&&(n=i)}i=L(i,this.__bin_count_mask)}this.__size++}get(t){const e=this.#i(t);let a=this.compute_bin_index(e);for(;;){const i=this.__bins[a];if(i>1){const a=this.__entries[i-2];if(this.#n(a,e,t))return a.value}else if(0===i)return;a=L(a,this.__bin_count_mask)}}getOrCompute(t,e,a){const i=this.get(t);if(void 0!==i)return i;const n=e.call(a,t);return this.set(t,n),n}getOrSet(t,e){const a=this.get(t);return void 0!==a?a:(this.set(t,e),e)}#h(t){if(this.__entries_start!==t)return;let e=t+1,a=this.__entries_bound;const i=this.__entries;for(;e<a&&i[e].hash===O;)e++;this.__entries_start=e}delete(t){const e=this.#i(t);let a=this.compute_bin_index(e);const i=this.__bins,n=this.__entries;for(;;){const s=i[a];if(s>1){const r=s-2,o=n[r];if(this.#n(o,e,t))return this.#r(o),i[a]=1,this.__size--,this.#h(r),!0}else if(0===s)return!1;a=L(a,this.__bin_count_mask)}}verifyHashes(t,e){let a=!0;const i=this.__bin_count;for(let n=0;n<i;n++){const i=this.__bins[n];if(i<=1)continue;const s=this.__entries[i-2],r=this.#i(s.key);s.hash!==r&&(t.call(e,`Hash stored on the entry(=${s.hash}) is different from the computed key hash(=${r}).`,s.key,s.value),a=!1)}return a}#c(){this.#a(2*this.__entries_allocated_count)}rebuild(){const t=this.__entries_bound,e=this.__entries,a=this.__bins;a.fill(0);let i=0;for(let n=this.__entries_start;n<t;n++){const t=e[n].hash;if(t===O)continue;const s=i;if(i++,s!==n){const t=e[s];e[s]=e[n],e[n]=t}let r=this.compute_bin_index(t);for(;;){if(0===a[r]){a[r]=s+2;break}r=L(r,this.__bin_count_mask)}}this.__entries_start=0,this.__entries_bound=this.__size,this.__version++}#d(){let t=0;for(let e=this.__entries_start;e<this.__entries_bound;e++)this.__entries[e].hash!==O&&t++;return t}forEach(t,e){const a=this.__bin_count,i=this.__entries,n=this.__bins;this.__version;for(let s=0;s<a;s++){const a=n[s];if(a<=1)continue;const r=i[a-2];t.call(e,r.value,r.key,this)}}has(t){return void 0!==this.get(t)}clear(){const t=this.__bins,e=this.__bin_count;for(let a=0;a<e;a++){const e=t[a];if(0!==e){if(1!==e){const t=e-2;this.#r(this.__entries[t])}t[a]=0}}this.__size=0,this.__entries_start=0,this.__entries_bound=0}*[Symbol.iterator](){const t=this.__bin_count,e=this.__bins,a=this.__entries;this.__version;for(let i=0;i<t;i++){const t=e[i];if(t<=1)continue;const n=a[t-2];yield[n.key,n.value]}}*entries(){for(const t of this)yield t}*values(){for(const[t,e]of this)yield e}*keys(){for(const[t,e]of this)yield t}}function W(){return 1}function J(){return 0}class Q{key=null;value=null;weight=0;next=null;previous=null;unlink(){const t=this.next,e=this.previous;null!==e&&(e.next=t),null!==t&&(t.previous=e),this.next=null,this.previous=null}toString(){return`CacheElement{ hasNext:${null!==this.next}, hasPrevious:${null!==this.previous}, weight:${this.weight}, key:${this.key}, value:${this.value} }`}}class G{#_=Number.POSITIVE_INFINITY;#l=0;__first=null;__last=null;constructor({maxWeight:t=Number.POSITIVE_INFINITY,keyWeigher:e=J,valueWeigher:a=W,keyHashFunction:i=D,keyEqualityFunction:n=P,capacity:s}={}){this.#_=t,this.keyWeigher=e,this.valueWeigher=a,this.data=new K({keyHashFunction:i,keyEqualityFunction:n,capacity:s}),this.onEvicted=new M,this.onRemoved=new M,this.onSet=new M}__promote(t){t!==this.__first&&(t===this.__last&&(this.__last=t.previous),t.unlink(),null!==this.__first&&(t.next=this.__first,this.__first.previous=t),this.__first=t)}size(){return this.data.size}setMaxWeight(t){throw new Error("setMaxWeight is deprecated, use .maxWeight property instead")}get weight(){return this.#l}set maxWeight(t){if("number"!=typeof t||t<0)throw new Error(`Weight must be a non-negative number, instead was '${t}'`);const e=this.#_;this.#_=t,e>t&&this.evictUntilWeight(this.#_)}get maxWeight(){return this.#_}recomputeWeight(){let t=0;for(let[e,a]of this.data){const i=this.computeElementWeight(e,a.value);a.weight=i,t+=i}this.#l=t,this.evictUntilWeight(this.#_)}updateElementWeight(t){const e=this.data.get(t);if(void 0===e)return!1;const a=e.weight,i=this.computeElementWeight(t,e.value);if(i===a)return!0;e.weight=i;const n=i-a;return this.#l+=n,this.#l>this.#_&&i<=this.#_&&this.evictUntilWeight(this.#_),!0}computeElementWeight(t,e){return this.keyWeigher(t)+this.valueWeigher(e)}findEvictionVictim(){return this.__last}evictOne(){const t=this.findEvictionVictim();return null!==t&&(this.remove(t.key),this.onEvicted.send2(t.key,t.value),!0)}evictUntilWeight(t){const e=Math.max(t,0);for(;this.#l>e;)this.evictOne()}put(t,e){let a=this.data.get(t);if(void 0===a){const i=this.computeElementWeight(t,e),n=this.#_-i;if(n<0)return;a=new Q,a.key=t,a.value=e,a.next=this.__first,null!==this.__first&&(this.__first.previous=a),this.__first=a,null===this.__last&&(this.__last=a),a.weight=i,this.evictUntilWeight(n),this.data.set(t,a),this.#l+=i}else{if(e===a.value);else{this.#l-=a.weight;const i=this.computeElementWeight(t,e);this.#l+=i,a.weight=i,a.value=e}this.__promote(a),this.#l>this.#_&&a.weight<=this.#_&&this.evictUntilWeight(this.#_)}this.onSet.send2(t,e)}contains(t){return this.data.has(t)}get(t){const e=this.data.get(t);return void 0===e?null:(this.__promote(e),e.value)}getOrCompute(t,e,a){const i=this.get(t);if(null!==i)return i;const n=e.call(a,t);return this.set(t,n),n}__removeElement(t){t.value,t===this.__first&&(this.__first=t.next),t===this.__last&&(this.__last=t.previous),t.unlink();const e=t.key;this.data.delete(e),this.#l-=t.weight}remove(t){const e=this.data.get(t);return void 0!==e&&(this.__removeElement(e),this.onRemoved.send2(t,e.value),!0)}silentRemove(t){const e=this.data.get(t);return void 0!==e&&(this.__removeElement(e),!0)}clear(){const t=[];!function(t,e){for(let a=e.next();!a.done;a=e.next())t.push(a.value)}(t,this.data.keys());const e=t.length;for(let a=0;a<e;a++){const e=t[a];this.remove(e)}}drop(){this.data.clear(),this.__first=null,this.__last=null,this.#l=0}validate(t,e){return this.data.verifyHashes((a,i,n)=>{t.call(e,a,i,n.value)})}}function Y(t,e,a){const i=t.length;let n=i;for(let s=0;s<i;s++){const i=t[s];n=(n<<5)-n+e.call(a,i),n|=0}return n}function H(t,e,a){if(null===t)return 0;if(void 0===t)return 1;let i=e??0,n=a??t.length-i,s=n;const r=i+n;for(let e=i;e<r;e++)s=(s<<5)-s+t.charCodeAt(e);return s>>>0}function $(t){const e=t.length;let a=0;for(let i=0;i<e;i++){let e=t.charCodeAt(i);for(;e>255;)a++,e>>=8;a++}return a}G.prototype.set=G.prototype.put,G.prototype.delete=G.prototype.remove,G.prototype.has=G.prototype.contains;class Z{constructor({name:t,body:e,args:a=[]}){this.name=t,this.args=a,this.body=e,this.__hash=.1}updateHash(){this.__hash=U(H(this.name),H(this.body),Y(this.args,H))}computeByteSize(){let t=$(this.body);void 0!==this.name&&(t+=$(this.name));const e=this.args.length;for(let a=0;a<e;a++)t+=$(this.args[a]);return t}equals(e){return this.name===e.name&&this.body===e.body&&t(this.args,e.args)}hash(){return.1===this.__hash&&this.updateHash(),this.__hash}}class tt{cache=new G({maxWeight:10383360,keyWeigher:t=>t.computeByteSize(),keyHashFunction:D,keyEqualityFunction:P});compile({code:t,args:e=[],name:a}){const i=new Z({body:t,args:e,name:a}),n=this.cache.get(i);if(null===n){const n=new Function(e.join(","),t);return void 0!==a&&Object.defineProperty(n,"name",{value:a}),this.cache.put(i,n),n}return n}}function et(t,e){for(let a in t)if(t[a]===e)return a}function at(t,e,a=p.BigEndian){const i=V[t],n=a===p.BigEndian?"false":"true";return tt.INSTANCE.compile({args:["dataView, byteOffset, value"],code:`dataView.${i}(byteOffset+${e}, value, ${n});`})}function it(t,e,a=p.BigEndian){const i=N[t],n=a===p.BigEndian?"false":"true";return tt.INSTANCE.compile({args:["dataView, byteOffset"],code:`return dataView.${i}(byteOffset+${e}, ${n});`})}tt.INSTANCE=new tt;class nt{constructor(t,e=p.LittleEndian){const a=t.length;this.types=t,this.endianType=e,this.columnOffsets=new Uint32Array(a);let i=0;for(let e=0;e<a;e++){const a=t[e];this.columnOffsets[e]=i,i+=R[a]}this.bytesPerRecord=i,this.readRowMethod=function(t,e=p.BigEndian){let a=0;const i=[],n=t.length;for(let s=0;s<n;s++){const n=t[s],r=N[n],o=e===p.BigEndian?"false":"true";i.push(`result[${s}] = dataView.${r}(${a} + byteOffset, ${o});`),a+=R[n]}return tt.INSTANCE.compile({args:["dataView, byteOffset, result"],code:i.join("\n")})}(t,e),this.writeRowMethod=function(t,e=p.BigEndian){let a=0;const i=[],n=t.length;for(let s=0;s<n;s++){const n=t[s],r=V[n],o=e===p.BigEndian?"false":"true";i.push(`dataView.${r}(${a} + byteOffset, record[${s}], ${o});`),a+=R[n]}return tt.INSTANCE.compile({args:["dataView, byteOffset, record"],code:i.join("\n")})}(t,e),this.cellReaders=new Array(a),this.cellWriters=new Array(a);for(let i=0;i<a;i++)this.cellReaders[i]=it(t[i],this.columnOffsets[i],e),this.cellWriters[i]=at(t[i],this.columnOffsets[i],e)}getColumnCount(){return this.types.length}hash(){let t=this.endianType===p.BigEndian?1:0;return t+=Y(this.types,H),t}equals(e){return this.endianType===e.endianType&&t(this.types,e.types)}toString(){return`TableSpec{types=[${this.types.join(", ")}], endian=${et(p,this.endianType)}}`}static get(t,e=p.LittleEndian){const a=t.join(".")+":"+e,i=st.get(a);if(null!==i)return i;const n=Object.freeze(new nt(t,e));return st.put(a,n),n}}nt.prototype.isRowFirstTableSpec=!0;const st=new G({keyHashFunction:H});function rt(t,e,a){let i=Infinity,n=Infinity,o=Infinity,h=-Infinity,d=-Infinity,_=-Infinity;for(let t=0;t<a;t+=3){const a=e[t],c=e[t+1],l=e[t+2];i=r(a,i),n=r(c,n),o=r(l,o),h=s(a,h),d=s(c,d),_=s(l,_)}c(t,0,i,n,o,h,d,_)}function ot(t,e){return Math.ceil(t/e)*e}class ct{get tag(){return""}get align(){return 0}get size(){return 0}get aligned_size(){return ot(this.size,this.align)}get runtime_sized(){return!1}get requires_declaration(){return!1}toString(){return this.wgsl_declaration}get declaration_chunk(){throw new Error("Not Implemented")}get wgsl_ref(){return this.wgsl_declaration}get wgsl_declaration(){return this.tag}equals(t){return!1}hash(){return 0}}ct.prototype.isWebGPUType=!0;class ht extends ct{#f=0;#u=0;#b="";get tag(){return this.#b}get size(){return this.#f}get align(){return this.#u}from(t,e,a){this.#b=t,this.#f=a,this.#u=e}static from(t,e,a){const i=new ht;return i.from(t,e,a),Object.freeze(i)}get wgsl_declaration(){return this.tag}hash(){return H(this.tag)}equals(t){return this===t||t instanceof ht&&this.tag===t.tag&&this.#f===t.size&&this.#u===t.align}}ht.prototype.isPrimitive=!0;class dt extends ht{static from(t,e,a){const i=new dt;return i.from(t,e,a),Object.freeze(i)}}dt.prototype.isAtomic=!0;const _t=ht.from("bool",4,4),lt=ht.from("i32",4,4),ft=ht.from("u32",4,4),ut=ht.from("f32",4,4),bt=ht.from("f16",2,2),gt=ht.from("vec2<i32>",8,8),mt=ht.from("vec2<u32>",8,8),yt=ht.from("vec2<f32>",8,8),pt=ht.from("vec3<i32>",16,12),wt=ht.from("vec3<u32>",16,12),vt=ht.from("vec3<f32>",16,12),xt=ht.from("vec4<i32>",16,16),At=ht.from("vec4<u32>",16,16),kt=ht.from("vec4<f32>",16,16),zt=ht.from("mat2x2<f32>",8,16),jt=ht.from("mat3x2<f32>",8,24),Ut=ht.from("mat4x2<f32>",8,32),Et=ht.from("mat2x3<f32>",16,32),Ft=ht.from("mat3x3<f32>",16,48),It=ht.from("mat4x3<f32>",16,64),Ct=ht.from("mat2x4<f32>",16,32),Bt=ht.from("mat3x4<f32>",16,48),Mt=ht.from("mat4x4<f32>",16,64),St=ht.from("vec2<f16>",4,4),Nt=ht.from("vec3<f16>",8,6),Vt=ht.from("vec4<f16>",8,8),Rt=ht.from("mat2x2<f16>",4,8),Pt=ht.from("mat3x2<f16>",4,12),Dt=ht.from("mat4x2<f16>",4,16),Tt=ht.from("mat2x3<f16>",8,16),Lt=ht.from("mat3x3<f16>",8,24),qt=ht.from("mat4x3<f16>",8,32),Ot=ht.from("mat2x4<f16>",8,16),Xt=ht.from("mat3x4<f16>",8,24),Kt=ht.from("mat4x4<f16>",8,32),Wt=dt.from("atomic<u32>",4,4),Jt=dt.from("atomic<i32>",4,4),Qt={i32:lt,u32:ft,f32:ut,f16:bt,"atomic<u32>":Wt,"atomic<i32>":Jt,"vec2<i32>":gt,"vec2<u32>":mt,"vec2<f32>":yt,"vec2<f16>":St,"vec3<i32>":pt,"vec3<u32>":wt,"vec3<f32>":vt,"vec3<f16>":Nt,"vec4<i32>":xt,"vec4<u32>":At,"vec4<f32>":kt,"vec4<f16>":Vt,"mat2x2<f32>":zt,"mat2x2<f16>":Rt,"mat3x2<f32>":jt,"mat3x2<f16>":Pt,"mat4x2<f32>":Ut,"mat4x2<f16>":Dt,"mat2x3<f32>":Et,"mat2x3<f16>":Tt,"mat3x3<f32>":Ft,"mat3x3<f16>":Lt,"mat4x3<f32>":It,"mat4x3<f16>":qt,"mat2x4<f32>":Ct,"mat2x4<f16>":Ot,"mat3x4<f32>":Bt,"mat3x4<f16>":Xt,"mat4x4<f32>":Mt,"mat4x4<f16>":Kt,vec2i:gt,vec3i:pt,vec4i:xt,vec2u:mt,vec3u:wt,vec4u:At,vec2f:yt,vec3f:vt,vec4f:kt,mat2x2f:zt,mat3x2f:jt,mat4x2f:Ut,mat2x3f:Et,mat3x3f:Ft,mat4x3f:It,mat2x4f:Ct,mat3x4f:Bt,mat4x4f:Mt,vec2h:St,vec3h:Nt,vec4h:Vt,mat2x2h:Rt,mat3x2h:Pt,mat4x2h:Dt,mat2x3h:Tt,mat3x3h:Lt,mat4x3h:qt,mat2x4h:Ot,mat3x4h:Xt,mat4x4h:Kt};function Gt(t,e){return-1===t.indexOf(e)&&(t.push(e),!0)}function Yt(t,e){const a=t.length;if(a!==e.length)return!1;let i=0;for(;i<a;i++){const a=t[i],n=e[i];if(a!==n){if(null==a||null==n)return!1;if("object"!=typeof a||"function"!=typeof a.equals)return!1;if(!a.equals(n))return!1}}return!0}class Ht{get isCodeChunk(){return!0}static empty=Object.freeze(Ht.from(""));#g="";get text(){return this.#g}#m=[];#y=[];addExtension(t){return Gt(this.#y,t)}#p=[];addLanguageExtension(t){return Gt(this.#p,t)}addDependency(t){if(this.#m.includes(t))return!1;if(t.findDependencyRecursive(this))throw new Error(`Circular dependency detected: ${this} -> ${t}`);return this.#w(t),!0}#w(t){this.#m.push(t)}static from(t,e=[]){const a=new Ht;a.#g=t;const i=e.length;for(let t=0;t<i;t++){const i=e[t];a.addDependency(i)}return a}allDirectDependenciesIncludedInSet(t){const e=this.#m,a=e.length;for(let i=0;i<a;i++){const a=e[i];if(!t.has(a))return!1}return!0}findDependencyRecursive(t){const e=this.#m,a=e.length;for(let i=0;i<a;i++){const a=e[i];if(a.equals(t)||a.findDependencyRecursive(t))return!0}return!1}collectDependencies(){const t=new Set,e=this.#m.slice();let a=e.length;for(;a>0;){a--;const i=e[a];if(t.has(i))continue;t.add(i);const n=i.#m,s=n.length;for(let t=0;t<s;t++)e[a++]=n[t]}return Array.from(t)}coalesceDependencies(){const t=new Set,e=this.collectDependencies(),a=[];let i=e.length;for(;i>0;){const n=i;for(let n=i-1;n>=0;n--){const s=e[n];s.allDirectDependenciesIncludedInSet(t)&&(a.push(s),t.add(s),e.splice(n,1),i--)}if(n===i)throw new Error(`${i} dependencies could not be satisfied`)}return a}compile(){const t=this.coalesceDependencies();t.push(this);const e={},a={},i=[],n=t.length;for(let s=0;s<n;s++){const n=t[s];i.push(n.#g);const r=n.#y;for(let t=0;t<r.length;t++)e[r[t]]=!0;const o=n.#p;for(let t=0;t<o.length;t++)a[o[t]]=!0}const s=Object.keys(e).sort(),r=Object.keys(a).sort();return{text:i.join("\n"),extensions:s,language_extensions:r}}toString(){return this.#g}hash(){return H(this.#g)^this.#m.length}copy(t){this.#g=t.#g,this.#m=t.#m.slice(),this.#y=t.#y.slice(),this.#p=t.#p.slice()}clone(){const t=new Ht;return t.copy(this),t}equals(t){return this===t||this.#g===t.#g&&Yt(this.#m,t.#m)}}class $t extends ct{count=-1;type=null;get align(){return this.type.align}get size(){const t=this.type;return this.count*ot(t.size,t.align)}equals(t){return this===t||t instanceof $t&&this.type.equals(t.type)&&this.count===t.count}hash(){return U(this.type.hash(),this.count)}get runtime_sized(){return this.count<0}static from(t,e=-1){const a=new $t;return a.type=t,a.count=e,a}get requires_declaration(){return this.type.requires_declaration}#v;get declaration_chunk(){return void 0===this.#v&&(this.type.requires_declaration?this.#v=this.type.declaration_chunk:this.#v=Ht.empty),this.#v}get wgsl_ref(){const t=this.type;return this.runtime_sized?`array< ${t.wgsl_ref} >`:`array< ${t.wgsl_ref}, ${this.count} >`}get wgsl_declaration(){const t=this.type.wgsl_ref;return this.runtime_sized?`array< ${t} >`:`array< ${t}, ${this.count} >`}}$t.prototype.isArray=!0,$t.f32=Object.freeze($t.from(ut)),$t.u32=Object.freeze($t.from(ft)),$t.vec4u=Object.freeze($t.from(At)),$t.vec4f=Object.freeze($t.from(kt));class Zt{constructor(t,e){this.text=t,this.indentation=e}toString(){return`Line{ indentation=${this.indentation}, text="${this.text}" }`}}class te{#x=[];#A=0;get indentation(){return this.#A}indentSpaces=4;get count(){return this.#x.length}containsSubstring(t){const e=this.#x,a=e.length;for(let i=0;i<a;i++)if(-1!==e[i].text.indexOf(t))return!0;return!1}indent(){return this.#A++,this}dedent(){return this.#A=Math.max(0,this.#A-1),this}add(t){const e=new Zt(t,this.#A);return this.#x.push(e),this}extend(t){const e=this.#x,a=e.length-1;if(a<0)throw new Error("No lines to append to");e[a].text+=t}addLines(t){const e=t.#x,a=e.length;for(let t=0;t<a;t++){const a=e[t],i=new Zt(a.text,a.indentation+this.#A);this.#x.push(i)}}clear(){this.#x=[],this.#A=0}build(){const t=[],e=this.#x,a=e.length,i=function(t,e){if(e<=0)return"";let a=" ";for(let t=1;t<e;t++)a+=" ";return a}(0,this.indentSpaces);for(let n=0;n<a;n++){const a=e[n];let s="";const r=a.indentation;for(let t=0;t<r;t++)s+=i;t.push(s+a.text)}return t.join("\n")}static fromText(t,e="\n"){const a=new te,i=t.split(e),n=i.length;for(let t=0;t<n;t++){const e=i[t];a.add(e)}return a}toString(){return this.build()}}var ee=te;const ae=/array\s*<\s*(?<type>[^,]+)\s*(?:,\s*(?<count>[0-9]+))?\s*>/;function ie(t){const e=t.match(ae);if(null!==e){const t=e.groups,a=t.type;let i;i=void 0===t.count?-1:parseInt(t.count);const n=ie(a);return $t.from(n,i)}const a=Qt[t];if(void 0===a)throw new Error(`Unsupported type '${t}'`);return a}function ne(t,e,a){let i=t;return i<e&&(i=e),i<a&&(i=a),i}const se=new Uint8Array([0,1,28,2,29,14,24,3,30,22,20,15,25,17,4,8,31,27,13,23,21,19,16,7,26,12,18,6,11,5,10,9]);function re(t){return se[125613361*(t&-t)>>>27]}function oe(t){let e=t>>>0;return e-=e>>>1&1431655765,e=(858993459&e)+(e>>>2&858993459),e=e+(e>>>4)&252645135,Math.imul(e,16843009)>>>24}class ce{__length=0;constructor(t=64){var e;this.__capacity=(e=t)+(32-e%32)%32,this.__data_uint32=new Uint32Array(this.__capacity>>5),this.__shrinkFactor=.5}preventShrink(){this.setShrinkFactor(0)}setShrinkFactor(t){this.__shrinkFactor=t}setCapacity(t){if(this.__length>t)throw new Error(`Current length(=${this.__length}) is greater than requested size(=${t})`);this.__resize(t)}size(){return this.__length}capacity(){return this.__capacity}__resize(t){const e=Math.ceil(t/32),a=this.__data_uint32,i=new Uint32Array(e);a.length<e?i.set(a):i.set(a.subarray(0,e)),this.__data_uint32=i,this.__capacity=32*e}__updateLength(){const t=this.previousSetBit(this.__length)+1;t<this.__length&&this.__setLength(t)}__setLength(t){this.__length=t;const e=this.__capacity;if(t>e){const a=Math.ceil(ne(t,e+128,1.3*e));this.__resize(a)}else t<e-128&&t<e*this.__shrinkFactor&&this.__resize(t)}previousSetBit(t){const e=r(t,this.__length-1);let a=e>>5,i=31&e;const n=this.__data_uint32;let s=n[a];for(;i>=0;i--)if(s&1<<i)return 32*a+i;for(a--;a>=0;a--)for(s=n[a],i=31;i>=0;i--)if(s&1<<i)return 32*a+i;return-1}nextSetBit(t){const e=this.__length;if(t>=e)return-1;const a=this.__data_uint32;let i,n,s=t>>5,r=31&t;if(0!==r){const t=~((1<<r)-1),e=a[s]&t;if(0!==e)return r=re(e),(s<<5)+r;s++}const o=e+31>>5;for(;s<o;s++)if(i=a[s],0!==i)return r=re(i),n=(s<<5)+r,n;return-1}nextClearBit(t){let e,a=t>>5,i=31&t;const n=this.__data_uint32;if(0!==i){e=n[a];const t=(e|(1<<i)-1)>>>0;if(4294967295!==t)return i=re(~t),i+32*a;a++}const s=this.__length,r=s+31>>5;for(;a<r;a++)if(e=n[a],4294967295!==e)return i=re(~e),i+32*a;return Math.max(s,t)}set(t,e){const a=t>>5,i=1<<(31&t);if(e){const e=t+1;e>this.__length&&this.__setLength(e),this.__data_uint32[a]|=i}else t<this.__length&&(this.__data_uint32[a]&=~i,this.__updateLength())}clear(t){this.set(t,!1)}setRange(t,e){for(let a=t;a<=e;a++)this.set(a,!0)}clearRange(t,e){for(let a=t;a<e;a++)this.set(a,!1)}get(t){if(t>=this.__length)return!1;const e=t>>5,a=31&t;return!!(this.__data_uint32[e]&1<<a)}getAndSet(t){const e=this.get(t);return e||this.set(t,!0),e}getAndClear(t){const e=this.get(t);return e&&this.set(t,!1),e}shift_right(t,e,a){for(let i=a;i>=e;i--){const e=this.get(i);this.set(i+t,e)}}shift_left(t,e,a){for(let i=e;i<=a;i++){const e=this.get(i);this.set(i-t,e)}}shift(t,e,a){t>0?this.shift_right(t,e,a):this.shift_right(-t,e,a)}reset(){const t=this.__length;t<=0||(t<=32?this.__data_uint32[0]=0:this.__data_uint32.fill(0,0,Math.ceil(t/32)),this.__length=0)}cardinality(){const t=this.__length;if(0===t)return 0;const e=this.__data_uint32;let a=0;const i=t>>5;for(let t=0;t<i;t++)a+=oe(e[t]);const n=31&t;if(n>0){const t=(1<<n)-1;a+=oe(e[i]&t)}return a}copy(t){const e=t.__length,a=e>>5,i=this.__length;i!==e&&(i<e?this.__resize(e):this.__data_uint32.fill(0,a),this.__length=e);for(let e=0;e<a;e++)this.__data_uint32[e]=t.__data_uint32[e];const n=a<<5,s=e-n;for(let e=0;e<s;e++){const a=n+e;this.set(a,t.get(a))}}static fixedSize(t){const e=new ce(t);return e.preventShrink(),e}}const he=16;function de(t,e,a,i){let n=ot(i,e);for(;;){n=ot(t.nextClearBit(n),e);const i=n+a;let s=-1;for(let e=n;e<i;e++)if(t.get(e)){s=e;break}if(-1===s)return n;n=ot(s+1,e)}}class _e{name="";parameters=[];getParameterInteger(t){const e=this.parameters;return parseInt(e[t])}static from(t,...e){const a=new _e;return a.name=t,a.parameters=e,a}equals(e){return this.name===e.name&&t(this.parameters,e.parameters)}hash(){return H(this.name)^this.parameters.length}generate(){let t=`@${this.name}`;const e=this.parameters,a=e.length;if(a>0){t+="(";for(let i=0;i<a;i++)t+=e[i],i!==a-1&&(t+=", ");t+=")"}return t}}class le{attributes=[];setAttribute(t,...e){const a=_e.from(t,...e);this.attributes.push(a)}getAttribute(t){const e=this.attributes,a=e.length;for(let i=0;i<a;i++){const a=e[i];if(a.name===t)return a}}get size(){const t=this.getAttribute("size");let e=this.type.size;return void 0!==t&&(e=t.getParameterInteger(0)),e}get align(){const t=this.getAttribute("align");let e=this.type.align;return void 0!==t&&(e=t.getParameterInteger(0)),e}offset=0;type;name;static from(t,e,...a){const i=new le;return i.name=t,i.type=e,i.attributes=a,i}equals(t){return this.name===t.name&&this.offset===t.offset&&this.type.equals(t.type)&&Yt(this.attributes,t.attributes)}copy(t){return this.name=t.name,this.offset=t.offset,this.type=t.type,this.attributes=t.attributes.slice(),this}clone(){const t=new le;return t.copy(this),t}hash(){return U(H(this.name),this.offset,this.type.hash())}generate(){let t="";const e=this.attributes,a=e.length;for(let i=0;i<a;i++)t+=e[i].generate()+" ";return`${t}${this.name} : ${this.type.wgsl_ref}`}}le.prototype.isWGSLStructField=!0;let fe=0;function ue(){return"Struct_"+fe++}class be extends ct{#b="";get tag(){return this.#b}set tag(t){this.#b=t}fields=[];#k=!1;#f=0;#u=0;get size(){return this.#f}get align(){return this.#u}copy(t){return this.#b=t.#b,this.#f=t.#f,this.#u=t.#u,this.fields=t.fields.map(t=>t.clone()),this}clone(){const t=new be;return t.copy(this),t.#b=ue(),t}make(t){const e=new ee;e.add(`${this.wgsl_ref}(`),e.indent();const a=this.fields,i=a.length;for(let n=0;n<i;n++){const i=a[n].name,s=t[i];if(void 0===s)throw new Error(`Missing field '${i}'`);e.add(`${s},`)}return e.dedent(),e.add(")"),e.build()}pack(){if(this.fields.length<=1)return this;const t=[],e=[];for(const a of this.fields)a.type.runtime_sized?e.push(a):t.push(a);const a=function(t){const e=t.length,a=new Uint32Array(e);for(let t=0;t<e;t++)a[t]=t;a.sort((e,a)=>{const i=(he-t[e].size%he)%he,n=(he-t[a].size%he)%he;return i!==n?i-n:e-a});let i=0;for(let a=0;a<e;a++){const e=t[a];i+=ot(e.size,e.align)}const n=ce.fixedSize(i);let s=0;const r=new Uint32Array(e);for(let i=0;i<e;i++){const e=a[i],o=t[e],c=de(n,o.align,o.size,s);r[e]=c,n.setRange(c,c+o.size-1),c===s&&(s=n.nextClearBit(s+o.size))}const o=new Uint32Array(e);for(let t=0;t<e;t++)o[t]=t;o.sort((t,e)=>r[t]-r[e]);const c=new Array(e);for(let a=0;a<e;a++)c[a]=t[o[a]];return c}(t);return this.fields=a.concat(e),this.#k&&(this.#f,this.#z(),this.#f),this}equals(t){return t===this||t instanceof be&&this.#b===t.#b&&Yt(this.fields,t.fields)}hash(){return U(H(this.name),this.#f,this.#u,this.fields.length)}get requires_declaration(){return!0}get runtime_sized(){const t=this.fields;for(let e=0;e<t.length;e++)if(t[e].type.runtime_sized)return!0;return!1}static from(t,e=ue()){const a=new be;a.#b=e;for(const e in t){const i=t[e];let n;if("string"==typeof i)n=ie(i);else{if(!0!==i.isWebGPUType)throw new Error(`Unsupported type declarator '${i}'`);n=i}a.#j(le.from(e,n))}return a.#z(),a}static fromFields(...t){const e=new be;e.#b=ue();for(const a of t)e.#j(a);return e.#z(),e}has(t){return this.fields.some(e=>e.name===t)}get(t){const e=this.fields.find(e=>e.name===t);if(void 0===e)throw new Error(`Field '${t}' not found`);return e}#j(t){this.fields.push(t)}#z(){const t=this.fields,e=t.length;let a=1,i=0;for(let n=0;n<e;n++){const e=t[n],s=ot(i,e.align);a<e.align&&(a=e.align),e.offset=s,i=e.offset+e.size}this.#u=a,this.#f=ot(i,a),this.#v=void 0,this.#k=!0}get wgsl_ref(){return this.#b}get wgsl_declaration(){const t=new ee;t.add(`struct ${this.#b}{`),t.indent();for(let e=0;e<this.fields.length;e++){const a=this.fields[e];t.add(`${a.generate()},`)}return t.dedent(),t.add("}"),t.build()}#v;get declaration_chunk(){if(void 0===this.#v){const t=Ht.from(this.wgsl_declaration),e=this.fields,a=e.length;for(let i=0;i<a;i++){const a=e[i].type;a.requires_declaration&&t.addDependency(a.declaration_chunk)}this.#v=t}return this.#v}}function ge(t,e){const a=new Float32Array(e);return t.readFloat32Array(a,0,e),a}function me(t,e){const a=new Uint32Array(e);return t.readInt32Array(a,0,e),a}function ye(t,e){const a=new Uint32Array(e);return t.readUint32Array(a,0,e),a}function pe(t,e){if(t.position=ot(t.position,e.align),e instanceof $t)return function(t,e){let a=e.count;const i=[],n=e.type,s=n.aligned_size,r=t.position;if(e.runtime_sized){const e=t.capacity-t.position;a=Math.floor(e/s)}for(let e=0;e<a;e++)t.position=r+e*s,i[e]=pe(t,n);return t.position=r+a*s,i}(t,e);if(e instanceof be)return function(t,e){const a=e.fields,i=t.position,n={};for(let e=0;e<a.length;e++){const s=a[e];t.position=i+s.offset,n[s.name]=pe(t,s.type)}return n}(t,e);switch(e){case _t:return 0!==t.readUint32();case ft:case Wt:return t.readUint32();case lt:case Jt:return t.readInt32();case ut:return t.readFloat32();case mt:return ye(t,2);case wt:return ye(t,3);case At:return ye(t,4);case gt:return me(t,2);case pt:return me(t,3);case xt:return me(t,4);case yt:return ge(t,2);case vt:return ge(t,3);case kt:return ge(t,4);case Mt:return ge(t,16);default:throw new Error(`Unsupported type ${e}`)}}function we(t,e,a){if(a instanceof $t)return function(t,e,a){const i=a.count,n=a.type.aligned_size,s=e.position;for(let r=0;r<i;r++)e.position=s+r*n,we(t[r],e,a.type);e.position=s+i*n}(t,e,a);if(a instanceof be)return function(t,e,a){const i=a.fields,n=e.position,s=i.length;for(let a=0;a<s;a++){const s=i[a];e.position=n+s.offset;const r=t[s.name];void 0!==r&&we(r,e,s.type)}}(t,e,a);switch(a){case _t:return e.writeUint32(t?1:0);case ft:case Wt:return e.writeUint32(t);case lt:case Jt:return e.writeInt32(t);case ut:return e.writeFloat32(t);case gt:return e.writeInt32Array(t,0,2);case pt:return e.writeInt32Array(t,0,3);case xt:return e.writeInt32Array(t,0,4);case mt:return e.writeUint32Array(t,0,2);case wt:return e.writeUint32Array(t,0,3);case At:return e.writeUint32Array(t,0,4);case yt:return e.writeFloat32Array(t,0,2);case vt:return e.writeFloat32Array(t,0,3);case kt:return e.writeFloat32Array(t,0,4);case Mt:return e.writeFloat32Array(t,0,16);case Ft:return e.writeFloat32Array(t,0,9);case jt:case Et:return e.writeFloat32Array(t,0,6);default:throw new Error(`Unsupported type ${a}`)}}be.prototype.isStruct=!0,(new x).endianness=z();const ve=65535;function xe(t){return t>=0?1:-1}function Ae(t,e,a,i,n){const s=1/(Math.abs(a)+Math.abs(i)+Math.abs(n));let r=a*s,o=n*s;if(i<0){const t=Math.abs(r);r=(1-Math.abs(o))*xe(r),o=(1-t)*xe(o)}t[e]=r,t[e+1]=o}function ke(t,e,a,i){const n=new Float32Array(2);for(let s=0;s<a;s++){const a=3*s,r=i[a],o=i[a+1];Ae(n,0,r,i[a+2],o);const c=.5*n[0]+.5,h=.5*n[1]+.5,d=65535&Math.floor(c*ve)|(65535&Math.floor(h*ve))<<16;t[e+s]=d>>>0}}function ze(t,e,a,i){const n=new Float32Array(2);for(let s=0;s<a;s++){const a=4*s,r=i[a],o=i[a+1],c=i[a+2],h=i[a+3];Ae(n,0,r,c,o);const d=.5*n[0]+.5,_=.5*n[1]+.5,l=(32767&Math.floor(32767*d))<<1|(65535&Math.floor(_*ve))<<16|(h>=0?1:0);t[e+s]=l>>>0}}const je="index",Ue="position",Ee="normal",Fe="tangent",Ie="uv0",Ce="uv1",Be="color",Me="joints",Se="weights";var Ne=function(){var t,e=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};function a(t){if(!t)throw new Error("Assertion failed")}function i(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function n(e,a,n,s,r,o,c,h,d,_){var l=t.exports.sbrk,f=l(16*t.exports.meshopt_buildMeshletsBound(a.length,o,c)),u=l(4*a.length),b=l(a.length),g=l(a.byteLength),m=l(n.byteLength),y=new Uint8Array(t.exports.memory.buffer);y.set(i(a),g),y.set(i(n),m);for(var p=e(f,u,b,g,a.length,m,s,r,o,c,h,d,_),w=(y=new Uint8Array(t.exports.memory.buffer)).subarray(f,f+16*p),v=new Uint32Array(w.buffer,w.byteOffset,w.byteLength/4).slice(),x=0;x<p;++x){var A=v[4*x+0],k=v[4*x+1],z=(s=v[4*x+2],v[4*x+3]);t.exports.meshopt_optimizeMeshlet(u+4*A,b+k,z,s)}var j=v[4*(p-1)+0],U=v[4*(p-1)+1],E=j+v[4*(p-1)+2],F=U+3*v[4*(p-1)+3],I={meshlets:v,vertices:new Uint32Array(y.buffer,u,E).slice(),triangles:new Uint8Array(y.buffer,b,3*F).slice(),meshletCount:p};return l(f-l(0)),I}function s(e){var a=new Float32Array(t.exports.memory.buffer,e,12);return{centerX:a[0],centerY:a[1],centerZ:a[2],radius:a[3],coneApexX:a[4],coneApexY:a[5],coneApexZ:a[6],coneAxisX:a[7],coneAxisY:a[8],coneAxisZ:a[9],coneCutoff:a[10]}}return{ready:WebAssembly.instantiate(function(){for(var t=new Uint8Array(18682),a=0;a<18682;++a){var i="b9H79Tebbbe95x9Geueu9Geub9Gbb9Giuuueu9Gmuuuuuuuuuuu9999eu9Gvuuuuueu9Gruuuuuuub9Gxuuuuuuuuuuuueu9Gxuuuuuuuuuuu99eu9GPuuuuuuuuuuuuu99b9Gouuuuuub9GluuuubiXCdilvorwDoqooqkbiibeilve9Weiiviebeoweuecj:Pdkr;Zeqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9I919P29K9nW79O2Wt79c9V919U9KbeY9TW79O9V9Wt9F9I919P29K9nW79O2Wt7S2W94bd39TW79O9V9Wt9F9I919P29K9nW79O2Wt79t9W9Ht9P9H2bo39TW79O9V9Wt9F9J9V9T9W91tWJ2917tWV9c9V919U9K7bD39TW79O9V9Wt9F9J9V9T9W91tW9nW79O2Wt9c9V919U9K7bkE9TW79O9V9Wt9F9J9V9T9W91tW9t9W9OWVW9c9V919U9K7bxL9TW79O9V9Wt9F9V9Wt9P9T9P96W9nW79O2Wtbml79IV9RbPDwebcekdHOq:m:ceCdbkIbabaec9:fgefcufae9Ugeabci9Uadfcufad9Ugbaeab0Ek;x8JDPue99eux99due99euo99iu8Jjjjjbc:WD9Rgm8KjjjjbdndnalmbcbhPxekamc:Cwfcbc;Kbz:qjjjb8Adndnalcb9imbaoal9nmbamcuaocdtaocFFFFi0Egscbyd;01jjbHjjjjbbgzBd:CwamceBd;8wamascbyd;01jjbHjjjjbbgHBd:GwamcdBd;8wamcualcdtalcFFFFi0Ecbyd;01jjbHjjjjbbgOBd:KwamciBd;8waihsalhAinazasydbcdtfcbBdbasclfhsaAcufgAmbkaihsalhAinazasydbcdtfgCaCydbcefBdbasclfhsaAcufgAmbkaihsalhCcbhXindnazasydbcdtgQfgAydbcb9imbaHaQfaXBdbaAaAydbgQcjjjj94VBdbaQaXfhXkasclfhsaCcufgCmbkalci9UhLdnalci6mbcbhsaihAinaAcwfydbhCaAclfydbhXaHaAydbcdtfgQaQydbgQcefBdbaOaQcdtfasBdbaHaXcdtfgXaXydbgXcefBdbaOaXcdtfasBdbaHaCcdtfgCaCydbgCcefBdbaOaCcdtfasBdbaAcxfhAaLascefgs9hmbkkaihsalhAindnazasydbcdtgCfgXydbgQcu9kmbaXaQcFFFFrGgQBdbaHaCfgCaCydbaQ9RBdbkasclfhsaAcufgAmbxdkkamcuaocdtgsaocFFFFi0EgAcbyd;01jjbHjjjjbbgzBd:CwamceBd;8wamaAcbyd;01jjbHjjjjbbgHBd:GwamcdBd;8wamcualcdtalcFFFFi0Ecbyd;01jjbHjjjjbbgOBd:KwamciBd;8wazcbasz:qjjjbhXalci9UhLaihsalhAinaXasydbcdtfgCaCydbcefBdbasclfhsaAcufgAmbkdnaoTmbcbhsaHhAaXhCaohQinaAasBdbaAclfhAaCydbasfhsaCclfhCaQcufgQmbkkdnalci6mbcbhsaihAinaAcwfydbhCaAclfydbhQaHaAydbcdtfgKaKydbgKcefBdbaOaKcdtfasBdbaHaQcdtfgQaQydbgQcefBdbaOaQcdtfasBdbaHaCcdtfgCaCydbgCcefBdbaOaCcdtfasBdbaAcxfhAaLascefgs9hmbkkaoTmbcbhsaohAinaHasfgCaCydbaXasfydb9RBdbasclfhsaAcufgAmbkkamaLcbyd;01jjbHjjjjbbgsBd:OwamclBd;8wascbaLz:qjjjbhYamcuaLcK2alcjjjjd0Ecbyd;01jjbHjjjjbbg8ABd:SwamcvBd;8wJbbbbhEdnalci6g3mbarcd4hKaihAa8AhsaLhrJbbbbh5inavaAclfydbaK2cdtfgCIdlh8EavaAydbaK2cdtfgXIdlhEavaAcwfydbaK2cdtfgQIdlh8FaCIdwhaaXIdwhhaQIdwhgasaCIdbg8JaXIdbg8KMaQIdbg8LMJbbnn:vUdbasclfaXIdlaCIdlMaQIdlMJbbnn:vUdbaQIdwh8MaCIdwh8NaXIdwhyascxfa8EaE:tg8Eagah:tggNa8FaE:tg8Faaah:tgaN:tgEJbbbbJbbjZa8Ja8K:tg8Ja8FNa8La8K:tg8Ka8EN:tghahNaEaENaaa8KNaga8JN:tgEaENMM:rg8K:va8KJbbbb9BEg8ENUdbasczfaEa8ENUdbascCfaha8ENUdbascwfa8Maya8NMMJbbnn:vUdba5a8KMh5aAcxfhAascKfhsarcufgrmbka5aL:Z:vJbbbZNhEkamcuaLcdtalcFFFF970Ecbyd;01jjbHjjjjbbgCBd:WwamcoBd;8waq:Zhhdna3mbcbhsaChAinaAasBdbaAclfhAaLascefgs9hmbkkaEahNhhamcuaLcltalcFFFFd0Ecbyd;01jjbHjjjjbbg8PBd:0wamcrBd;8wcba8Pa8AaCaLz:djjjb8AJFFuuh8MJFFuuh8NJFFuuhydnalci6mbJFFuuhya8AhsaLhAJFFuuh8NJFFuuh8MinascwfIdbgEa8Ma8MaE9EEh8MasclfIdbgEa8Na8NaE9EEh8NasIdbgEayayaE9EEhyascKfhsaAcufgAmbkkah:rhEamaocetgscuaocu9kEcbyd;01jjbHjjjjbbgCBd:4wdndnaoal9nmbaihsalhAinaCasydbcetfcFFi87ebasclfhsaAcufgAmbxdkkaCcFeasz:qjjjb8AkaEJbbbZNh8JcuhIdnalci6mbcbhAJFFuuhEa8AhscuhIinascwfIdba8M:tghahNasIdbay:tghahNasclfIdba8N:tghahNMM:rghaEaIcuSahaE9DVgXEhEaAaIaXEhIascKfhsaLaAcefgA9hmbkkamczfcbcjwz:qjjjb8Aamcwf9cb83ibam9cb83iba8JaxNh8RJbbjZak:th8Lcbh8SJbbbbhRJbbbbh8UJbbbbh8VJbbbbh8WJbbbbh8XJbbbbh8Ycbh8ZcbhPinJbbbbhEdna8STmbJbbjZa8S:Z:vhEkJbbbbhhdna8Ya8YNa8Wa8WNa8Xa8XNMMg8KJbbbb9BmbJbbjZa8K:r:vhhka8VaENh8Ka8UaENh8EaRaENh5aIhLdndndndndna8SaPVTmbamydwg80Tmea8YahNh8Fa8XahNhaa8WahNhgaeamydbcdtfh81cbh3JFFuuhEcvhQcuhLindnaza81a3cdtfydbcdtgsfydbgvTmbaOaHasfydbcdtfhAindndnaCaiaAydbgKcx2fgsclfydbgrcetf8Vebcs4aCasydbgXcetf8Vebcs4faCascwfydbglcetf8Vebcs4fgombcbhsxekcehsazaXcdtfydbgXceSmbcehsazarcdtfydbgrceSmbcehsazalcdtfydbglceSmbdnarcdSaXcdSfalcdSfcd6mbaocefhsxekaocdfhskdnasaQ9kmba8AaKcK2fgXIdwa8K:tghahNaXIdba5:tghahNaXIdla8E:tghahNMM:ra8J:va8LNJbbjZMJ9VO:d86JbbjZaXIdCa8FNaXIdxagNaaaXIdzNMMakN:tghahJ9VO:d869DENghaEasaQ6ahaE9DVgXEhEaKaLaXEhLasaQaXEhQkaAclfhAavcufgvmbkka3cefg3a809hmbkkaLcu9hmekama8KUd:ODama8EUd:KDama5Ud:GDamcuBd:qDamcFFF;7rBdjDa8Pcba8AaYamc:GDfamc:qDfamcjDfz:ejjjbamyd:qDhLdndnaxJbbbb9ETmba8SaD6mbaLcuSmeceh3amIdjDa8R9EmixdkaLcu9hmekdna8STmbabaPcltfgzam8Pib83dbazcwfamcwf8Pib83dbaPcefhPkc3hzinazc98Smvamc:Cwfazfydbcbyd;41jjbH:bjjjbbazc98fhzxbkkcbh3a8Saq9pmbamydwaCaiaLcx2fgsydbcetf8Vebcs4aCascwfydbcetf8Vebcs4faCasclfydbcetf8Vebcs4ffaw9nmekcbhscbhAdna8ZTmbcbhAamczfhXinamczfaAcdtfaXydbgQBdbaXclfhXaAaYaQfRbbTfhAa8Zcufg8ZmbkkamydwhlamydbhXam9cu83i:GDam9cu83i:ODam9cu83i:qDam9cu83i:yDaAc;8eaAclfc:bd6Eh8ZinamcjDfasfcFFF;7rBdbasclfgscz9hmbka8Zcdth80dnalTmbaeaXcdtfhocbhrindnazaoarcdtfydbcdtgsfydbgvTmbaOaHasfydbcdtfhAcuhQcuhsinazaiaAydbgKcx2fgXclfydbcdtfydbazaXydbcdtfydbfazaXcwfydbcdtfydbfgXasaXas6gXEhsaKaQaXEhQaAclfhAavcufgvmbkaQcuSmba8AaQcK2fgAIdwa8M:tgEaENaAIdbay:tgEaENaAIdla8N:tgEaENMM:rhEcbhAindndnasamc:qDfaAfgvydbgX6mbasaX9hmeaEamcjDfaAfIdb9FTmekavasBdbamc:GDfaAfaQBdbamcjDfaAfaEUdbxdkaAclfgAcz9hmbkkarcefgral9hmbkkamczfa80fhQcbhscbhAindnamc:GDfasfydbgXcuSmbaQaAcdtfaXBdbaAcefhAkasclfgscz9hmbkaAa8Zfg8ZTmbJFFuuhhcuhKamczfhsa8ZhvcuhQina8AasydbgXcK2fgAIdwa8M:tgEaENaAIdbay:tgEaENaAIdla8N:tgEaENMM:rhEdndnazaiaXcx2fgAclfydbcdtfydbazaAydbcdtfydbfazaAcwfydbcdtfydbfgAaQ6mbaAaQ9hmeaEah9DTmekaEhhaAhQaXhKkasclfhsavcufgvmbkaKcuSmbaKhLkdnamaiaLcx2fgrydbarclfydbarcwfydbaCabaeadaPawaqa3z:fjjjbTmbaPcefhPJbbbbhRJbbbbh8UJbbbbh8VJbbbbh8WJbbbbh8XJbbbbh8YkcbhXinaOaHaraXcdtfydbcdtgAfydbcdtfgKhsazaAfgvydbgQhAdnaQTmbdninasydbaLSmeasclfhsaAcufgATmdxbkkasaKaQcdtfc98fydbBdbavavydbcufBdbkaXcefgXci9hmbka8AaLcK2fgsIdbhEasIdlhhasIdwh8KasIdxh8EasIdzh5asIdCh8FaYaLfce86bba8Ya8FMh8Ya8Xa5Mh8Xa8Wa8EMh8Wa8Va8KMh8Va8UahMh8UaRaEMhRamydxh8Sxbkkamc:WDf8KjjjjbaPk;Vvivuv99lu8Jjjjjbca9Rgv8Kjjjjbdndnalcw0mbaiydbhoaeabcitfgralcdtciVBdlaraoBdbdnalcd6mbaiclfhoalcufhwarcxfhrinaoydbhDarcuBdbarc98faDBdbarcwfhraoclfhoawcufgwmbkkalabfhrxekcbhDavczfcwfcbBdbav9cb83izavcwfcbBdbav9cb83ibJbbjZhqJbbjZhkinadaiaDcdtfydbcK2fhwcbhrinavczfarfgoawarfIdbgxaoIdbgm:tgPakNamMgmUdbavarfgoaPaxam:tNaoIdbMUdbarclfgrcx9hmbkJbbjZaqJbbjZMgq:vhkaDcefgDal9hmbkcbhoadcbcecdavIdlgxavIdwgm9GEgravIdbgPam9GEaraPax9GEgscdtgrfhzavczfarfIdbhxaihralhwinaiaocdtfgDydbhHaDarydbgOBdbaraHBdbarclfhraoazaOcK2fIdbax9Dfhoawcufgwmbkaeabcitfhrdndnaocv6mbaoalc98f6mekaraiydbBdbaralcdtciVBdlaiclfhoalcufhwarcxfhrinaoydbhDarcuBdbarc98faDBdbarcwfhraoclfhoawcufgwmbkalabfhrxekaraxUdbararydlc98GasVBdlabcefaeadaiaoz:djjjbhwararydlciGawabcu7fcdtVBdlawaeadaiaocdtfalao9Rz:djjjbhrkavcaf8Kjjjjbark;yddvue99dninabaecitfgrydlgwcl6mednawciGgDci9hmbabaecitfhbcbhecehqindnaiabydbgDfRbbmbcbhqadaDcK2fgkIdwalIdw:tgxaxNakIdbalIdb:tgxaxNakIdlalIdl:tgxaxNMM:rgxaoIdb9DTmbaoaxUdbavaDBdbarydlhwkabcwfhbaecefgeawcd46mbkaqceGTmdarawciGBdlskdnabcbawcd4gwalaDcdtfIdbarIdb:tgxJbbbb9FEgkaw7aecefgwfgecitfydlabakawfgwcitfydlVci0mbaraDBdlkabawadaialavaoz:ejjjbax:laoIdb9Fmbkkkjlevudnabydwgxaladcetfgm8Vebcs4alaecetfgP8Vebgscs4falaicetfgz8Vebcs4ffaD0abydxaq9pVakVgDce9hmbavawcltfgxab8Pdb83dbaxcwfabcwfgx8Pdb83dbabydbhqdnaxydbgkTmbaoaqcdtfhxakhsinalaxydbcetfcFFi87ebaxclfhxascufgsmbkkabaqakfBdbabydxhxab9cb83dwababydlaxci2fBdlaP8Vebhscbhxkdnascztcz91cu9kmbabaxcefBdwaPax87ebaoabydbcdtfaxcdtfaeBdbkdnam8Uebcu9kmbababydwgxcefBdwamax87ebaoabydbcdtfaxcdtfadBdbkdnaz8Uebcu9kmbababydwgxcefBdwazax87ebaoabydbcdtfaxcdtfaiBdbkarabydlfabydxci2faPRbb86bbarabydlfabydxci2fcefamRbb86bbarabydlfabydxci2fcdfazRbb86bbababydxcefBdxaDk:zPrHue99eue99eue99eu8Jjjjjbc;W;Gb9Rgx8KjjjjbdndnalmbcbhmxekcbhPaxc:m;Gbfcbc;Kbz:qjjjb8Aaxcualci9UgscltascjjjjiGEcbyd;01jjbHjjjjbbgzBd:m9GaxceBd;S9GaxcuascK2gHcKfalcpFFFe0Ecbyd;01jjbHjjjjbbgOBd:q9GaxcdBd;S9Gdnalci6gAmbarcd4hCascdthXaOhQazhLinavaiaPcx2fgrydbaC2cdtfhKavarcwfydbaC2cdtfhYavarclfydbaC2cdtfh8AcbhraLhEinaQarfgmaKarfg3Idbg5a8Aarfg8EIdbg8Fa5a8F9DEg5UdbamaYarfgaIdbg8Fa5a8Fa59DEg8FUdbamcxfgma3Idbg5a8EIdbgha5ah9EEg5UdbamaaIdbgha5aha59EEg5UdbaEa8Fa5MJbbbZNUdbaEaXfhEarclfgrcx9hmbkaQcKfhQaLclfhLaPcefgPas9hmbkkaOaHfgr9cb83dbarczf9cb83dbarcwf9cb83dbaxcuascx2gralc:bjjjl0Ecbyd;01jjbHjjjjbbgCBdN9GaxciBd;S9GascdthgazarfhvaChHazhLcbhPinaxcbcj;Gbz:qjjjbhEaPas2cdthadnaAmbaLhrash3inaEarydbgmc8F91cjjjj94Vam7gmcQ4cx2fg8Ea8EydwcefBdwaEamcd4cFrGcx2fg8Ea8EydbcefBdbaEamcx4cFrGcx2fgmamydlcefBdlarclfhra3cufg3mbkkazaafh8AaCaafhXcbhmcbh3cbh8EcbhainaEamfgrydbhQara3BdbarcwfgKydbhYaKaaBdbarclfgrydbhKara8EBdbaQa3fh3aYaafhaaKa8Efh8Eamcxfgmcj;Gb9hmbkdnaAmbcbhravhminamarBdbamclfhmasarcefgr9hmbkaAmbavhrashminaEa8Aarydbg3cdtfydbg8Ec8F91a8E7cd4cFrGcx2fg8Ea8Eydbg8EcefBdbaXa8Ecdtfa3BdbarclfhramcufgmmbkaHhrashminaEa8Aarydbg3cdtfydbg8Ec8F91a8E7cx4cFrGcx2fg8Ea8Eydlg8EcefBdlava8Ecdtfa3BdbarclfhramcufgmmbkavhrashminaEa8Aarydbg3cdtfydbg8Ec8F91cjjjj94Va8E7cQ4cx2fg8Ea8Eydwg8EcefBdwaXa8Ecdtfa3BdbarclfhramcufgmmbkkaHagfhHaLagfhLaPcefgPci9hmbkaEaocetgrcuaocu9kEcbyd;01jjbHjjjjbbgKBd:y9GaEclBd;S9Gdndnaoal9nmbaihralhminaKarydbcetfcFFi87ebarclfhramcufgmmbxdkkaKcFearz:qjjjb8AkcbhmaEascbyd;01jjbHjjjjbbg8ABd:C9GaOaCaCascdtfaCascitfa8AascbazaKaiawaDaqakz:hjjjbcbh8Ednalci6gambcbh8Ea8Ahrash3ina8EarRbbfh8Earcefhra3cufg3mbkkaEcwf9cb83ibaE9cb83ibalawc9:fgrfcufar9UhrasaDfcufaD9Uh3dnaambara3ara30EhYcbhra8Ehacbhmincbh3dnarTmba8AarfRbbceSh3kamaEaiaCydbcx2fgQydbaQclfydbaQcwfydbaKabaeadamawaqa3a3ce7a8EaY9nVaaamfaY6VGz:fjjjbfhmaCclfhCaaa8AarfRbb9Rhaasarcefgr9hmbkaEydxTmbabamcltfgraE8Pib83dbarcwfaEcwf8Pib83dbamcefhmkczhrinarc98SmeaEc:m;Gbfarfydbcbyd;41jjbH:bjjjbbarc98fhrxbkkaxc;W;Gbf8Kjjjjbamk;LXDXue99lue99iul9:eur99lu8Jjjjjbc;qb9RgP8Kjjjjbdndnaoc8Y9imbalaeavawaDaqaxz1jjjbxekaxhsaxhzdnavax0gHmbdnavTmbcbhOaehzavhAinawaDazydbcx2fgCcwfydbcetfgX8VebhQawaCclfydbcetfgL8VebhKawaCydbcetfgC8VebhYaXce87ebaLce87ebaCce87ebaOaKcs4aYcs4faQcs4ffhOazclfhzaAcufgAmbkaehzavhAinawaDazydbcx2fgCcwfydbcetfcFFi87ebawaCclfydbcetfcFFi87ebawaCydbcetfcFFi87ebazclfhzaAcufgAmbkcehzaqhsaOaq0mekalce86bbalcefcbavcufz:qjjjb8AxekaPaiBdxaPadBdwaPaeBdlavakaqci9UgCakaCak6EaHEgK9Rh8AaxaK9RhEaKcufh3aKceth5aKcdtgCc98fh8EavcitgOaC9Rarfc98fh8FascufhaavcufhharaOfhgJbbjZas:Y:vh8JaravcdtgYfc94fh8KcbazceakaxSEg8Lcdtg8M9Rh8NJFFuuhycuh8PcbhIcbh8RinaPclfa8RcdtfydbhQaPc8WfcKfcb8Pd:y1jjbg8S83ibaPc8Wfczfcb8Pd:q1jjbgR83ibaPc8Wfcwfcb8Pd11jjbg8U83ibaPcb8Pdj1jjbg8V83i8WaPczfcKfa8S83ibaPczfczfaR83ibaPczfcwfa8U83ibaPa8V83izaQaYfh8WcbhXinabaQaXcdtgLfydbcK2fhAcbhzinaPc8WfazfgCaAazfgOIdbg8XaCIdbg8Ya8Xa8Y9DEUdbaCczfgCaOcxfIdbg8XaCIdbg8Ya8Xa8Y9EEUdbazclfgzcx9hmbkaPIdnaPId8W:tg8ZaPId9iaPIdU:tg80Nh81aba8WaXcu7cdtfydbcK2fhAcbhzaPId80hBaPId9eh83inaPczfazfgCaAazfgOIdbg8XaCIdbg8Ya8Xa8Y9DEUdbaCczfgCaOcxfIdbg8XaCIdbg8Ya8Xa8Y9EEUdbazclfgzcx9hmbkaraLfgza83aB:tg8Xa80Na8Za8XNa81MMUdbazaYfaPId8KaPIdC:tg8XaPIdyaPIdK:tg8YNaPIdaaPIdz:tg8Za8XNa8Za8YNMMUdbaXcefgXav9hmbkcbhUdnaHmbcbhAaQhzaghCavhXinawaDazydbcx2fgOcwfydbcetfgL8Vebh8WawaOclfydbcetfg858VebhUawaOydbcetfgO8Vebh86aLce87eba85ce87ebaOce87ebaCaAaUcs4a86cs4fa8Wcs4ffgABdbazclfhzaCclfhCaXcufgXmbkavhCinawaDaQydbcx2fgzcwfydbcetfcFFi87ebawazclfydbcetfcFFi87ebawazydbcetfcFFi87ebaQclfhQaCcufgCmbkaghUkdndndndndndndndndndna5av0mba5ax0meavaK6mda3a8A9pmDcehLa8AhXaUTmlxrka3ah9pmwa5ax9nmdxlkdnavavaK9UgzaK29RazaE20mba3a8A9pmwaUTh87ceh85a8AhLxvka3ah6mixrka3ah9pmokcbhLahhXaUmikJFFuuh8XcbhQa3hzindnazcefgCaK6mbaLavaC9RgOaK6GmbarazcdtfIdbg8YaC:YNa8Kavaz9RcdtfIdbg8ZaO:YNMg80a8X9Embdndna8JaOaaf:YNg81:lJbbb9p9DTmba81:OhAxekcjjjj94hAka8ZasaA2aO9R:YNh8Zdndna8Jazasf:YNg81:lJbbb9p9DTmba81:OhOxekcjjjj94hOkamasaO2aC9R:Ya8YNa8ZMNa80Mg8Ya8Xa8Ya8X9DgOEh8XaCaQaOEhQkaza8LfgzaX6mbxlkkaUTh87cbh85ahhLkJFFuuh8XcbhQa8AhCa8FhAa8EhOaKhzindnazazaK9UgXaK29RaXaE20mbdna85TmbaCaCaK9UgXaK29RaXaE20mekaraOfIdbg8Yaz:YNaAIdbg8ZaC:YNMg80a8X9EmbazhXaCh8Wdna87mbaUaOfydbgXh8Wkdndna8Ja8Waaf:YNg81:lJbbb9p9DTmba81:Oh86xekcjjjj94h86ka8Zasa862a8W9R:YNh8Zdndna8JaXaaf:YNg81:lJbbb9p9DTmba81:Oh8Wxekcjjjj94h8Wkamasa8W2aX9R:Ya8YNa8ZMNa80Mg8Ya8Xa8Ya8X9DgXEh8XazaQaXEhQkaCa8L9RhCaAa8NfhAaOa8MfhOaza8LfgzcufaL6mbxdkkJFFuuh8XcbhQa8AhCa8FhAa8EhOaKhzindnazaK6mbaLaCaK6GmbaraOfIdbg8Yaz:YNaAIdbg8ZaC:YNMg80a8X9Embdndna8JaUaOfydbg8Waaf:YNg81:lJbbb9p9DTmba81:Oh85xekcjjjj94h85kamasa852a8W9R:Yg81a8YNa8Za81NMNa80Mg8Ya8Xa8Ya8X9Dg8WEh8XazaQa8WEhQkaCa8L9RhCaAa8NfhAaOa8MfhOaza8LfgzcufaX6mbkkaQTmba8Xay9DTmba8XhyaQhIa8Rh8Pka8Rcefg8Rci9hmbkdna8Pcb9ombalaeavawaDaqaxz1jjjbxekaravcdtg8WfhLdnaITmbaPclfa8PcdtfydbhzaIhCinaLazydbfcb86bbazclfhzaCcufgCmbkkdnavaI9nmbaPclfa8PcdtfydbaIcdtfhzavaI9RhCinaLazydbfce86bbazclfhzaCcufgCmbkkcbhYindnaYa8PSmbcbhzaraPclfaYcdtfydbgKa8Wz:pjjjbhCavhXaIhOinaKaOazaLaCydbgQfRbbgAEcdtfaQBdbaCclfhCaOaAfhOazaA9RcefhzaXcufgXmbkkaYcefgYci9hmbkabaeadaialaIaocefgCarawaDaqakaxamz:hjjjbabaeaIcdtgzfadazfaiazfalaIfavaI9RaCarawaDaqakaxamz:hjjjbkaPc;qbf8Kjjjjbk1iePudnadTmbavci9UgrcufhwcbhDindndndnadaD9RaoaDaofad0EgqTmbcbhkaeaDcdtfgxhmaqhPinaialamydbcx2fgscwfydbcetfgz8VebhHaiasclfydbcetfgO8VebhAaiasydbcetfgs8VebhCazce87ebaOce87ebasce87ebakaAcs4aCcs4faHcs4ffhkamclfhmaPcufgPmbkaqhsinaialaxydbcx2fgmcwfydbcetfcFFi87ebaiamclfydbcetfcFFi87ebaiamydbcetfcFFi87ebaxclfhxascufgsmbkakav0mekabaDfgxce86bbaxcefcbaqcufz:qjjjb8AxekabaDfgxce86bbaxcefcbawz:qjjjb8AarhqkaqaDfgDad6mbkkk;Nkovud99euv99eul998Jjjjjbc:W;ae9Rgo8KjjjjbdndnadTmbavcd4hrcbhwcbhDindnaiaeclfydbar2cdtfgvIdbaiaeydbar2cdtfgqIdbgk:tgxaiaecwfydbar2cdtfgmIdlaqIdlgP:tgsNamIdbak:tgzavIdlaP:tgPN:tgkakNaPamIdwaqIdwgH:tgONasavIdwaH:tgHN:tgPaPNaHazNaOaxN:tgxaxNMM:rgsJbbbb9Bmbaoc:W:qefawcx2fgAakas:vUdwaAaxas:vUdlaAaPas:vUdbaoc8Wfawc8K2fgAaq8Pdb83dbaAav8Pdb83dxaAam8Pdb83dKaAcwfaqcwfydbBdbaAcCfavcwfydbBdbaAcafamcwfydbBdbawcefhwkaecxfheaDcifgDad6mbkab9cb83dbabcyf9cb83dbabcaf9cb83dbabcKf9cb83dbabczf9cb83dbabcwf9cb83dbawTmeaocbBd8Sao9cb83iKao9cb83izaoczfaoc8Wfawci2cxaoc8Sfcbcrz:kjjjbaoIdKhCaoIdChXaoIdzhQao9cb83iwao9cb83ibaoaoc:W:qefawcxaoc8Sfcbciz:kjjjbJbbjZhkaoIdwgPJbbbbJbbjZaPaPNaoIdbgPaPNaoIdlgsasNMM:rgx:vaxJbbbb9BEgzNhxasazNhsaPazNhzaoc:W:qefheawhvinaecwfIdbaxNaeIdbazNasaeclfIdbNMMgPakaPak9DEhkaecxfheavcufgvmbkabaCUdwabaXUdlabaQUdbabaoId3UdxdndnakJ;n;m;m899FmbJbbbbhPaoc:W:qefheaoc8WfhvinaCavcwfIdb:taecwfIdbgHNaQavIdb:taeIdbgONaXavclfIdb:taeclfIdbgLNMMaxaHNazaONasaLNMM:vgHaPaHaP9EEhPavc8KfhvaecxfheawcufgwmbkabaxUd8KabasUdaabazUd3abaCaxaPN:tUdKabaXasaPN:tUdCabaQazaPN:tUdzabJbbjZakakN:t:rgkUdydndnaxJbbj:;axJbbj:;9GEgPJbbjZaPJbbjZ9FEJbb;:9cNJbbbZJbbb:;axJbbbb9GEMgP:lJbbb9p9DTmbaP:Ohexekcjjjj94hekabae86b8UdndnasJbbj:;asJbbj:;9GEgPJbbjZaPJbbjZ9FEJbb;:9cNJbbbZJbbb:;asJbbbb9GEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkabav86bRdndnazJbbj:;azJbbj:;9GEgPJbbjZaPJbbjZ9FEJbb;:9cNJbbbZJbbb:;azJbbbb9GEMgP:lJbbb9p9DTmbaP:Ohqxekcjjjj94hqkabaq86b8SdndnaecKtcK91:YJbb;:9c:vax:t:lavcKtcK91:YJbb;:9c:vas:t:laqcKtcK91:YJbb;:9c:vaz:t:lakMMMJbb;:9cNJbbjZMgk:lJbbb9p9DTmbak:Ohexekcjjjj94hekaecFbaecFb9iEhexekabcjjj;8iBdycFbhekabae86b8Vxekab9cb83dbabcyf9cb83dbabcaf9cb83dbabcKf9cb83dbabczf9cb83dbabcwf9cb83dbkaoc:W;aef8Kjjjjbk;Iwwvul99iud99eue99eul998Jjjjjbcje9Rgr8Kjjjjbavcd4hwaicd4hDdndnaoTmbarc;abfcbaocdtgvz:qjjjb8Aarc;Gbfcbavz:qjjjb8AarhvarcafhiaohqinavcFFF97BdbaicFFF;7rBdbaiclfhiavclfhvaqcufgqmbkdnadTmbcbhkinaeakaD2cdtfgvIdwhxavIdlhmavIdbhPalakaw2cdtfIdbhsarc;abfhzarhiarc;GbfhHarcafhqc:G1jjbhvaohOinasavcwfIdbaxNavIdbaPNavclfIdbamNMMgAMhCakhXdnaAas:tgAaqIdbgQ9DgLmbaHydbhXkaHaXBdbakhXdnaCaiIdbgK9EmbazydbhXaKhCkazaXBdbaiaCUdbaqaAaQaLEUdbavcxfhvaqclfhqaHclfhHaiclfhiazclfhzaOcufgOmbkakcefgkad9hmbkkadThkJbbbbhCcbhXarc;abfhvarc;Gbfhicbhqinalavydbgzaw2cdtfIdbalaiydbgHaw2cdtfIdbaeazaD2cdtfgzIdwaeaHaD2cdtfgHIdw:tgsasNazIdbaHIdb:tgsasNazIdlaHIdl:tgsasNMM:rMMgsaCasaC9EgzEhCaqaXazEhXaiclfhiavclfhvaoaqcefgq9hmbkaCJbbbZNhKxekadThkcbhXJbbbbhKkJbbbbhCdnaearc;abfaXcdtgifydbgqaD2cdtfgvIdwaearc;GbfaifydbgzaD2cdtfgiIdwgm:tgsasNavIdbaiIdbgY:tgAaANavIdlaiIdlgP:tgQaQNMM:rgxJbbbb9ETmbaxalaqaw2cdtfIdbMalazaw2cdtfIdb:taxaxM:vhCkasaCNamMhmaQaCNaPMhPaAaCNaYMhYdnakmbaDcdthvawcdthiindnalIdbg8AaecwfIdbam:tgCaCNaeIdbaY:tgsasNaeclfIdbaP:tgAaANMM:rgQMgEaK9ETmbJbbbbhxdnaQJbbbb9ETmbaEaK:taQaQM:vhxkaxaCNamMhmaxaANaPMhPaxasNaYMhYa8AaKaQMMJbbbZNhKkaeavfhealaifhladcufgdmbkkabaKUdxabamUdwabaPUdlabaYUdbarcjef8Kjjjjbkjeeiu8Jjjjjbcj8W9Rgr8Kjjjjbaici2hwdnaiTmbawceawce0EhDarhiinaiaeadRbbcdtfydbBdbadcefhdaiclfhiaDcufgDmbkkabarawaladaoz:jjjjbarcj8Wf8Kjjjjbk:Reeeu8Jjjjjbca9Rgo8Kjjjjbab9cb83dbabcyf9cb83dbabcaf9cb83dbabcKf9cb83dbabczf9cb83dbabcwf9cb83dbdnadTmbaocbBd3ao9cb83iwao9cb83ibaoaeadaialaoc3falEavcbalEcrz:kjjjbabao8Pib83dbabao8Piw83dwkaocaf8Kjjjjbk:3lequ8JjjjjbcjP9Rgl8Kjjjjbcbhvalcjxfcbaiz:qjjjb8AdndnadTmbcjehoaehrincuhwarhDcuhqavhkdninawakaoalcjxfaDcefRbbfRbb9RcFeGci6aoalcjxfaDRbbfRbb9RcFeGci6faoalcjxfaDcdfRbbfRbb9RcFeGci6fgxaq9mgmEhwdnammbaxce0mdkaxaqaxaq9kEhqaDcifhDadakcefgk9hmbkkaeawci2fgDcdfRbbhqaDcefRbbhxaDRbbhkaeavci2fgDcifaDawav9Rci2z:tjjjb8Aakalcjxffaocefgo86bbaxalcjxffao86bbaDcdfaq86bbaDcefax86bbaDak86bbaqalcjxffao86bbarcifhravcefgvad9hmbkalcFeaicetz:qjjjbhoadci2gDceaDce0EhqcbhxindnaoaeRbbgkcetfgw8UebgDcu9kmbawax87ebaocjlfaxcdtfabakcdtfydbBdbaxhDaxcefhxkaeaD86bbaecefheaqcufgqmbkaxcdthDxekcbhDkabalcjlfaDz:pjjjb8AalcjPf8Kjjjjbk9teiucbcbyd;81jjbgeabcifc98GfgbBd;81jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;teeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiaeydlBdlaiaeydwBdwaiaeydxBdxaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk:3eedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdxaialBdwaialBdlaialBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabk9teiucbcbyd;81jjbgeabcrfc94GfgbBd;81jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik9:eiuZbhedndncbyd;81jjbgdaecztgi9nmbcuheadai9RcFFifcz4nbcuSmekadhekcbabae9Rcifc98Gcbyd;81jjbfgdBd;81jjbdnadZbcztge9nmbadae9RcFFifcz4nb8Akk:;Deludndndnadch9pmbabaeSmdaeabadfgi9Rcbadcet9R0mekabaead;8qbbxekaeab7ciGhldndndnabae9pmbdnalTmbadhvabhixikdnabciGmbadhvabhixdkadTmiabaeRbb86bbadcufhvdnabcefgiciGmbaecefhexdkavTmiabaeRbe86beadc9:fhvdnabcdfgiciGmbaecdfhexdkavTmiabaeRbd86bdadc99fhvdnabcifgiciGmbaecifhexdkavTmiabaeRbi86biabclfhiaeclfheadc98fhvxekdnalmbdnaiciGTmbadTmlabadcufgifglaeaifRbb86bbdnalciGmbaihdxekaiTmlabadc9:fgifglaeaifRbb86bbdnalciGmbaihdxekaiTmlabadc99fgifglaeaifRbb86bbdnalciGmbaihdxekaiTmlabadc98fgdfaeadfRbb86bbkadcl6mbdnadc98fgocd4cefciGgiTmbaec98fhlabc98fhvinavadfaladfydbBdbadc98fhdaicufgimbkkaocx6mbaec9Wfhvabc9WfhoinaoadfgicxfavadfglcxfydbBdbaicwfalcwfydbBdbaiclfalclfydbBdbaialydbBdbadc9Wfgdci0mbkkadTmdadhidnadciGglTmbaecufhvabcufhoadhiinaoaifavaifRbb86bbaicufhialcufglmbkkadcl6mdaec98fhlabc98fhvinavaifgecifalaifgdcifRbb86bbaecdfadcdfRbb86bbaecefadcefRbb86bbaeadRbb86bbaic98fgimbxikkavcl6mbdnavc98fglcd4cefcrGgdTmbavadcdt9RhvinaiaeydbBdbaeclfheaiclfhiadcufgdmbkkalc36mbinaiaeydbBdbaiaeydlBdlaiaeydwBdwaiaeydxBdxaiaeydzBdzaiaeydCBdCaiaeydKBdKaiaeyd3Bd3aecafheaicafhiavc9Gfgvci0mbkkavTmbdndnavcrGgdmbavhlxekavc94GhlinaiaeRbb86bbaicefhiaecefheadcufgdmbkkavcw6mbinaiaeRbb86bbaiaeRbe86beaiaeRbd86bdaiaeRbi86biaiaeRbl86blaiaeRbv86bvaiaeRbo86boaiaeRbr86braicwfhiaecwfhealc94fglmbkkabkk:nedbcjwktFFuuFFuuFFuubbbbFFuFFFuFFFuFbbbbbbjZbbbbbbbbbbbbbbjZbbbbbbbbbbbbbbjZ86;nAZ86;nAZ86;nAZ86;nA:;86;nAZ86;nAZ86;nAZ86;nA:;86;nAZ86;nAZ86;nAZ86;nA:;bc;0wkxebbbdbbbjNbb".charCodeAt(a);t[a]=i>96?i-97:i>64?i-39:i+4}var n=0;for(a=0;a<18682;++a)t[n++]=t[a]<60?e[t[a]]:64*(t[a]-60)+t[++a];return t.buffer.slice(0,n)}(),{}).then(function(e){(t=e.instance).exports.__wasm_call_ctors()}),supported:!0,buildMeshlets:function(e,i,s,r,o,c){a(e.length%3==0),a(i instanceof Float32Array),a(i.length%s==0),a(s>=3),a(r>0&&r<=256),a(o>=1&&o<=512),c=c||0;var h=4==e.BYTES_PER_ELEMENT?e:new Uint32Array(e);return n(t.exports.meshopt_buildMeshletsFlex,h,i,i.length/s,4*s,r,o,o,c,0)},buildMeshletsFlex:function(e,i,s,r,o,c,h,d){a(e.length%3==0),a(i instanceof Float32Array),a(i.length%s==0),a(s>=3),a(r>0&&r<=256),a(o>=1&&c<=512),a(o<=c),h=h||0,d=d||0;var _=4==e.BYTES_PER_ELEMENT?e:new Uint32Array(e);return n(t.exports.meshopt_buildMeshletsFlex,_,i,i.length/s,4*s,r,o,c,h,d)},buildMeshletsSpatial:function(e,i,s,r,o,c,h){a(e.length%3==0),a(i instanceof Float32Array),a(i.length%s==0),a(s>=3),a(r>0&&r<=256),a(o>=1&&c<=512),a(o<=c),h=h||0;var d=4==e.BYTES_PER_ELEMENT?e:new Uint32Array(e);return n(t.exports.meshopt_buildMeshletsSpatial,d,i,i.length/s,4*s,r,o,c,h)},extractMeshlet:function(t,e){return a(e>=0&&e<t.meshletCount),function(t,e){var a=t.meshlets[4*e+0],i=t.meshlets[4*e+1],n=t.meshlets[4*e+2],s=t.meshlets[4*e+3];return{vertices:t.vertices.subarray(a,a+n),triangles:t.triangles.subarray(i,i+3*s)}}(t,e)},computeClusterBounds:function(e,n,r){return a(e.length%3==0),a(e.length/3<=512),a(n instanceof Float32Array),a(n.length%r==0),a(r>=3),function(e,a,n,r){var o=t.exports.sbrk,c=o(48),h=o(e.byteLength),d=o(a.byteLength),_=new Uint8Array(t.exports.memory.buffer);_.set(i(e),h),_.set(i(a),d),t.exports.meshopt_computeClusterBounds(c,h,e.length,d,n,r);var l=s(c);return o(c-o(0)),l}(4==e.BYTES_PER_ELEMENT?e:new Uint32Array(e),n,n.length/r,4*r)},computeMeshletBounds:function(e,n,r){return a(0!=e.meshletCount),a(n instanceof Float32Array),a(n.length%r==0),a(r>=3),function(e,a,n,r){var o=t.exports.sbrk,c=[],h=o(a.byteLength),d=o(e.vertices.byteLength),_=o(e.triangles.byteLength),l=o(48),f=new Uint8Array(t.exports.memory.buffer);f.set(i(a),h),f.set(i(e.vertices),d),f.set(i(e.triangles),_);for(var u=0;u<e.meshletCount;++u){var b=e.meshlets[4*u+0],g=e.meshlets[4*u+0+1],m=e.meshlets[4*u+0+3];t.exports.meshopt_computeMeshletBounds(l,d+4*b,_+g,m,h,n,r),c.push(s(l))}return o(h-o(0)),c}(e,n,n.length/r,4*r)},computeSphereBounds:function(e,n,r,o){return a(e instanceof Float32Array),a(e.length%n==0),a(n>=3),a(!r||r instanceof Float32Array),a(!r||r.length%o==0),a(!r||o>=1),a(!r||e.length/n==r.length/o),o=o||0,function(e,a,n,r,o){var c=t.exports.sbrk,h=c(48),d=c(e.byteLength),_=r?c(r.byteLength):0,l=new Uint8Array(t.exports.memory.buffer);l.set(i(e),d),r&&l.set(i(r),_),t.exports.meshopt_computeSphereBounds(h,d,a,n,_,r?o:0);var f=s(h);return c(h-c(0)),f}(e,e.length/n,4*n,r,4*o)}}}();const Ve=128;function Re(t,e,a,i){const n=e,s=t,r=new Uint8Array(Ve);let o=128;for(let t=0;t<a;++t){let e=-1,i=-1;for(let s=t;s<a;++s){const t=n[3*s+0],a=n[3*s+1],c=n[3*s+2],h=(o-r[t]<3?1:0)+(o-r[a]<3?1:0)+(o-r[c]<3?1:0);if(h>i&&(e=s,i=h,i>=2))break}const s=n[3*e+0],c=n[3*e+1],h=n[3*e+2],d=3*t,_=d+3*(e-t);n.set(n.subarray(d,_),d+3),n[3*t+0]=s,n[3*t+1]=c,n[3*t+2]=h,o++,r[s]=o,r[c]=o,r[h]=o}const c=new Uint32Array(Ve),h=new Int16Array(Ve);for(let t=0;t<i;t++)h[t]=-1;let d=0;for(let t=0;t<3*a;++t){const e=n[t];h[e]<0&&(h[e]=d,c[d]=s[e],d++),n[t]=h[e]}if(d>i)throw new Error(`Vertex offset ${d} exceeds vertex count ${i}`);for(let t=0;t<d;t++)s[t]=c[t]}const Pe={[Ue]:3,[Ee]:1,[Fe]:1,[Be]:1,[Ie]:2,[Ce]:1,[Me]:2,[Se]:1},De=Object.freeze([Ue,Ee,Fe,Be,Ie,Ce,Me,Se]),Te={[Ee]:1,[Fe]:2,[Be]:4,[Ie]:8,[Ce]:16,[Me]:32,[Se]:64},Le=be.from({bounds_box:$t.from(ut,6),address:ft,primitive_count:ft,vertex_count:ft,flags:ft}).pack();function qe(t,e,a,i){const n=a*i,s=new Uint32Array(t,4*e,n);for(let t=i;t<n;t+=i)for(let e=0;e<i;e++)if(s[t+e]!==s[e])return!1;return!0}function Oe(t){return ot(3*t,4)>>>2}function Xe(t){const e=Math.round(255*t);return e<0?0:e>255?255:e}function Ke(t,e,a){return t<e?e:t>a?a:t}function We(t,e,a,i){const n=a.data,s=a.spec.itemSize;for(let a=0;a<i;a++){const i=e.readUint32();for(let e=0;e<s;e++)t[a*s+e]=n[i*s+e]}}function Je(t,e,a,i,n){const s=e.data;switch(i){case Ue:for(let e=0;e<n;e++){const e=t.readUint32();for(let t=0;t<3;t++){const i=s[3*e+t];a.writeFloat32(i)}}break;case Ee:{const i=new Float32Array(3*n);We(i,t,e,n);const s=new Uint32Array(n);ke(s,0,n,i),a.writeUint32Array(s,0,n)}break;case Fe:{const i=new Float32Array(4*n);We(i,t,e,n);const s=new Uint32Array(n);ze(s,0,n,i),a.writeUint32Array(s,0,n)}break;case Be:{const i=new Float32Array(3*n);We(i,t,e,n);const s=new Uint32Array(n);!function(t,e,a,i){for(let e=0;e<a;e++){let a=3*e,n=Xe(i[a]),s=Xe(i[a+1]),r=Xe(i[a+2]);t[0+e]=n|s<<8|r<<16}}(s,0,n,i),a.writeUint32Array(s,0,n)}break;case Ce:{const i=new Float32Array(2*n);We(i,t,e,n);const s=new Uint32Array(n);!function(t,e,a,i){for(let e=0;e<a;e++){let a=2*e,n=Math.round(65535*Ke(i[a],0,1)),s=Math.round(65535*Ke(i[a+1],0,1));t[0+e]=65535&n|(65535&s)<<16}}(s,0,n,i),a.writeUint32Array(s,0,n)}break;case Ie:{const i=new Float32Array(2*n);We(i,t,e,n),a.writeFloat32Array(i,0,2*n)}break;case Me:{const i=new Uint16Array(4*n);We(i,t,e,n);for(let t=0;t<n;t++){const e=4*t,n=65535&i[e+0],s=65535&i[e+1],r=65535&i[e+2],o=65535&i[e+3];a.writeUint32(n|s<<16),a.writeUint32(r|o<<16)}}break;case Se:{const i=new Float32Array(4*n);We(i,t,e,n);for(let t=0;t<n;t++){const e=4*t;let n=Math.max(0,Math.min(255,Math.round(255*i[e+0]))),s=Math.max(0,Math.min(255,Math.round(255*i[e+1]))),r=Math.max(0,Math.min(255,Math.round(255*i[e+2]))),o=Math.max(0,Math.min(255,Math.round(255*i[e+3])));const c=255-(n+s+r+o);if(0!==c){let t=0,e=n;s>e&&(e=s,t=1),r>e&&(e=r,t=2),o>e&&(e=o,t=3);const a=Math.max(0,Math.min(255,e+c));0===t?n=a:1===t?s=a:2===t?r=a:o=a}a.writeUint32(255&n|(255&s)<<8|(255&r)<<16|(255&o)<<24)}}break;default:throw new Error(`Unrecognized attribute attribute '${i}'`)}}const Qe={};function Ge(t,e,a){const i=Te[t];return(void 0!==i&&0!==(e&i)?1:a)*Pe[t]}function Ye(t,e,a){const i=Qe[t];if("number"!=typeof i)throw new Error(`Unrecognized ordered attribute '${t}'`);let n=0;for(let t=0;t<i;t++)n+=Ge(De[t],e,a);return n}De.forEach((t,e)=>{Qe[t]=e}),Object.freeze(Qe);const He={[Be]:4294967295,[Ie]:[0,0],[Ce]:0,[Ee]:0,[Fe]:0,[Me]:[0,0],[Se]:0};{const t=new Uint32Array(1);ke(t,0,1,[0,0,1]),He[Ee]=t[0]}{const t=new Uint32Array(1);ze(t,0,1,[0,0,1,1]),He[Fe]=t[0]}const $e={};globalThis.meshlet_debug=$e;const Ze=new ArrayBuffer(0);class ta{#U=Ze;#E=new DataView(Ze);get data_buffer(){return this.#U}set data_buffer(t){this.#U=t,this.#E=new DataView(this.#U)}#F=Ze;#I=new DataView(Ze);get metadata_buffer(){return this.#F}set metadata_buffer(t){this.#F=t,this.#I=new DataView(this.#F)}#C=0;get count(){return this.#C}set count(t){this.#C=t}hash(){const t=this.#F;return U(this.#C,E(t,0,t.byteLength))}equals(t){return this.#C===t.#C&&F(this.#F,0,t.#F,0,t.#F.byteLength)&&F(this.#U,0,t.#U,0,t.#U.byteLength)}compress(){const t=z(),e=x.fromArrayBuffer(this.#F);e.endianness=t;const a=this.#U,i=x.fromArrayBuffer(a);i.endianness=t;const n=x.fromEndianness(t);for(let t=0;t<this.#C;t++){e.position=Le.size*t;const s=pe(e,Le),r=n.position,o=Oe(s.primitive_count);i.position=s.address<<2,x.copyBytes(i,n,4*o);const c=i.position>>>2,h=s.vertex_count,d=s.flags;let _=d;for(const t of De){const e=Te[t],s=void 0!==e,r=c+Ye(t,d,h);i.position=r<<2;const o=Pe[t];if(s&&0===(d&e)&&qe(a,r,h,o))_|=e,x.copyBytes(i,n,4*o);else{const t=0!==(d&e)?1:h;x.copyBytes(i,n,t*o*4)}}s.flags=_,s.address=r>>>2,e.position=Le.size*t,we(s,e,Le)}n.trim();const s=n.data;return this.#U=s,a.byteLength-s.byteLength}optimize(){}read_header(t){const e=x.fromArrayBuffer(this.#F);return e.endianness=z(),e.position=Le.size*t,pe(e,Le)}read_meshlet(t){const e=this.read_header(t),a=3*e.primitive_count,i=new Uint32Array(a),n=x.fromArrayBuffer(this.#U);n.endianness=z();const s=e.address<<2;n.position=s,n.readUint8Array(i,0,a);const r=new Float32Array(3*e.vertex_count),o=4*Oe(e.primitive_count);return n.position=s+o+4*Ye(Ue,e.flags,e.vertex_count),n.readFloat32Array(r,0,3*e.vertex_count),{header:e,attribute_index:i,attribute_position:r}}#B(t){const e=new S(nt.get([j.Uint32,j.Uint32,j.Uint32,j.Uint32])),a=z(),i=new x;i.endianness=a,t.ensureIndex(),function(t,e,a,i,n,s,r=64,o=64){const c=Ne.buildMeshlets(a,s,3,r,o,0);t.setCapacity(t.length+c.meshletCount);for(let a=0;a<c.meshletCount;a++){const i=c.meshlets[4*a],n=c.meshlets[4*a+1],s=c.meshlets[4*a+2],r=c.meshlets[4*a+3],o=e.position>>>2,h=o+s;t.writeRow(a,[o,h,s,r]),t.length++,Re(c.vertices.subarray(i,i+s),c.triangles.subarray(n,n+3*r),r,s),e.writeUint32Array(c.vertices,i,s),e.writeUint32Array(c.triangles,n,3*r)}}(e,i,t.index.data,t.getIndexCount(),t.getVertexCount(),t.getAttribute(Ue).data,Ve,128);const n=e.length,s=x.fromEndianness(a),r=x.fromEndianness(a);t.ensureNormals(),t.ensureTangents();const o=t.bounding_box;for(let a=0;a<n;a++){const[n,c,h,d]=e.readRow(a),_={bounds_box:o,address:r.position>>>2,vertex_count:h,primitive_count:d,flags:0};i.position=4*c;const l=3*d;{let t=0,e=0;for(let a=0;a<l;a++)t|=i.readUint32()<<8*e,e++,e>=4&&(r.writeUint32(t),t=0,e=0);e>0&&r.writeUint32(t)}const f=Oe(d);r.position=4*(_.address+f);const u=r.position;for(const e of De){const a=Ye(e,_.flags,h);if(r.position=u+4*a,void 0===t.getAttribute(e)){const t=He[e];if(void 0===t)throw new Error(`No default for attribute '${e}'`);switch(_.flags|=Te[e],e){case Ee:case Fe:case Be:r.writeUint32(t);break;case Ie:r.writeFloat32Array(t,0,t.length);break;case Ce:r.writeUint32(t);break;case Me:r.writeUint32Array(t,0,t.length);break;case Se:r.writeUint32(t);break;default:throw new Error(`Unsupported attribute default ${e}`)}continue}i.position=4*n;const s=r.position;Je(i,t.getAttribute(e),r,e,h);const o=r.position-s;$e[e]=($e[e]||0)+o}we(_,s,Le)}this.#C=n,s.trim(),this.metadata_buffer=s.data,r.trim(),this.data_buffer=r.data,this.build_bounds()}build_bounds(){const t=x.fromArrayBuffer(this.#F);t.endianness=z();const e=new Float32Array(384),a=x.fromArrayBuffer(this.#U);a.endianness=z();for(let i=0;i<this.#C;i++){t.position=i*Le.size;const n=pe(t,Le),s=n.vertex_count,r=ot(3*n.primitive_count,4),o=Ye(Ue,n.flags,s);a.position=r+4*(n.address+o),a.readFloat32Array(e,0,3*s),rt(n.bounds_box,e,3*s),t.position=i*Le.size,we(n,t,Le)}}build(t){this.#B(t),this.optimize()}}ta.prototype.isMeshletBatch=!0;let ea=0;class aa{id=ea++;name="";bounding_box=new Float32Array(6);bounding_sphere=new Float32Array(4);primitive_count=0;getIndexCount(){return 3*this.primitive_count}meshlets=new ta;bvh=new ArrayBuffer;hash(){return this.meshlets.hash()}equals(t){return this.meshlets.equals(t.meshlets)}}aa.prototype.isMeshletGeometry=!0;class ia{klass=null;version=0;initialize(...t){}finalize(){}serialize(t,e){}deserialize(t,e){}}ia.prototype.isBinaryClassSerializationAdapter=!0;const na=4294967295;function sa(t,e,a,i,n,s){const r=i-t,o=s-a;return 2*((n-e)*(r+o)+o*r)}const ra=na,oa=10,ca=Math.floor(107374182.375);class ha{__data_buffer=new ArrayBuffer(5120);get data_buffer(){return this.__data_buffer}set data_buffer(t){this.__data_buffer=t,this.__data_float32=new Float32Array(this.__data_buffer),this.__data_uint32=new Uint32Array(this.__data_buffer),this.__capacity=Math.floor(t.byteLength/40)}__data_float32=new Float32Array(this.__data_buffer);get data_float32(){return this.__data_float32}__data_uint32=new Uint32Array(this.__data_buffer);__capacity=128;__size=0;__free=[];__free_pointer=0;__root=ra;get root(){return this.__root}set root(t){this.__root=t}get size(){return this.__size}get node_capacity(){return this.__capacity}set node_capacity(t){if(this.__size>t)throw new Error(`Can't shrink capacity to ${t}, because it's below occupancy(${this.__size}).`);this.__set_capacity(t)}__grow_capacity(){if(this.__capacity>=ca)throw new Error("Can not grow capacity, already at maximum platform limit");let t=Math.ceil(s(1.2*this.__capacity,this.__capacity+64));t>ca&&(t=ca),this.__set_capacity(t)}__set_capacity(t){if(this.__capacity===t)return;const e=this.__data_uint32,a=new ArrayBuffer(40*t);this.__data_buffer=a,this.__data_float32=new Float32Array(a),this.__data_uint32=new Uint32Array(a),this.__size>0&&m(e.buffer,e.byteOffset,a,0,Math.min(40*this.__size,a.byteLength)),this.__capacity=t}trim(){this.__capacity>this.__size&&this.__set_capacity(this.__size)}allocate_linear(t){this.node_capacity=t,this.__size=t}allocate_node(){let t;const e=this.__free_pointer;if(e>0){const a=e-1;t=this.__free[a],this.__free_pointer=a}else t=this.__size,t>=this.__capacity&&this.__grow_capacity(),this.__size++;const a=oa*t,i=this.__data_float32;i[a]=Number.POSITIVE_INFINITY,i[a+1]=Number.POSITIVE_INFINITY,i[a+2]=Number.POSITIVE_INFINITY,i[a+3]=Number.NEGATIVE_INFINITY,i[a+4]=Number.NEGATIVE_INFINITY,i[a+5]=Number.NEGATIVE_INFINITY;const n=this.__data_uint32;return n[a+6]=ra,n[a+7]=ra,n[a+8]=ra,n[a+9]=0,t}release_node(t){this.__free[this.__free_pointer++]=t}node_is_leaf(t){return this.__data_uint32[oa*t+7]===ra}node_get_user_data(t){return this.__data_uint32[oa*t+8]}node_set_user_data(t,e){this.__data_uint32[oa*t+8]=e}node_get_child1(t){return this.__data_uint32[oa*t+7]}node_set_child1(t,e){this.__data_uint32[oa*t+7]=e}node_get_child2(t){return this.__data_uint32[oa*t+8]}node_set_child2(t,e){this.__data_uint32[oa*t+8]=e}node_get_parent(t){return this.__data_uint32[oa*t+6]}node_set_parent(t,e){this.__data_uint32[oa*t+6]=e}node_get_height(t){return this.__data_uint32[oa*t+9]}node_set_height(t,e){this.__data_uint32[oa*t+9]=e}node_get_aabb(t,e){const a=oa*t,i=this.__data_float32;e[0]=i[a],e[1]=i[a+1],e[2]=i[a+2],e[3]=i[a+3],e[4]=i[a+4],e[5]=i[a+5]}node_set_aabb(t,e){const a=oa*t,i=this.__data_float32;i[a]=e[0],i[a+1]=e[1],i[a+2]=e[2],i[a+3]=e[3],i[a+4]=e[4],i[a+5]=e[5]}node_move_aabb(t,e){this.node_set_aabb(t,e);const a=this.__data_uint32[oa*t+6];a!==ra&&this.bubble_up_refit(a)}node_set_aabb_primitive(t,e,a,i,n,s,r){const o=oa*t,c=this.__data_float32;c[o]=e,c[o+1]=a,c[o+2]=i,c[o+3]=n,c[o+4]=s,c[o+5]=r}node_get_surface_area(t){const e=oa*t,a=this.__data_float32;return sa(a[e],a[e+1],a[e+2],a[e+3],a[e+4],a[e+5])}node_get_combined_surface_area(t,e){const a=oa*t,i=oa*e,n=this.__data_float32;return sa(r(n[a],n[i]),r(n[a+1],n[i+1]),r(n[a+2],n[i+2]),s(n[a+3],n[i+3]),s(n[a+4],n[i+4]),s(n[a+5],n[i+5]))}node_set_combined_aabb(t,e,a){const i=oa*e,n=oa*a,s=oa*t,r=this.__data_float32;o(r,s,r,i,r,n)}insert_leaf(t){let e=this.__data_uint32;if(this.__root===ra)return this.__root=t,void(e[t*oa+6]=ra);let a=this.__root;for(;!1===this.node_is_leaf(a);){const i=a*oa,n=e[i+7],s=e[i+8],r=this.node_get_surface_area(a),o=this.node_get_combined_surface_area(a,t),c=2*o,h=2*(o-r);let d,_;if(this.node_is_leaf(n))d=this.node_get_combined_surface_area(t,n)+h;else{const e=this.node_get_surface_area(n);d=this.node_get_combined_surface_area(t,n)-e+h}if(this.node_is_leaf(s))_=this.node_get_combined_surface_area(t,s)+h;else{const e=this.node_get_surface_area(s);_=this.node_get_combined_surface_area(t,s)-e+h}if(c<d&&c<_)break;a=d<_?n:s}const i=a,n=e[i*oa+6],s=this.allocate_node();e=this.__data_uint32,e[s*oa+6]=n,this.node_set_combined_aabb(s,t,i),e[s*oa+9]=e[i*oa+9]+1,n!==ra?e[n*oa+7]===i?e[n*oa+7]=s:e[n*oa+8]=s:this.__root=s,e[s*oa+7]=i,e[s*oa+8]=t,e[i*oa+6]=s,e[t*oa+6]=s,this.bubble_up_update(s)}bubble_up_refit(t){let e=t;const a=this.__data_uint32;do{const t=e*oa,i=a[t+7],n=a[t+8];this.node_set_combined_aabb(e,i,n),e=a[t+6]}while(e!==ra)}bubble_up_update(t){let e=t;const a=this.__data_uint32;for(;e!==ra;){e=this.balance_rotate(e);const t=e*oa,i=a[t+7],n=a[t+8];a[t+9]=1+s(a[i*oa+9],a[n*oa+9]),this.node_set_combined_aabb(e,i,n),e=a[t+6]}}remove_leaf(t){if(t===this.__root)return void(this.__root=ra);const e=this.__data_uint32,a=e[t*oa+6],i=e[a*oa+6];let n;const s=e[a*oa+7];n=s===t?e[a*oa+8]:s,i!==ra?(e[i*oa+7]===a?e[i*oa+7]=n:e[i*oa+8]=n,e[n*oa+6]=i,this.release_node(a),this.bubble_up_update(i)):(this.__root=n,e[n*oa+6]=ra,this.release_node(a))}balance_height(t){const e=this.__data_uint32;if(this.node_is_leaf(t)||e[t*oa+9]<2)return t;const a=e[t*oa+7],i=e[t*oa+8],n=e[i*oa+9]-e[a*oa+9];if(n>1){const n=e[i*oa+7],r=e[i*oa+8];e[i*oa+7]=t;const o=e[t*oa+6];return e[i*oa+6]=o,e[t*oa+6]=i,o!==ra?e[o*oa+7]===t?e[o*oa+7]=i:e[o*oa+8]=i:this.__root=i,e[n*oa+9]>e[r*oa+9]?(e[i*oa+8]=n,e[t*oa+8]=r,e[r*oa+6]=t,this.node_set_combined_aabb(t,a,r),this.node_set_combined_aabb(i,t,n),e[t*oa+9]=1+s(e[a*oa+9],e[r*oa+9]),e[i*oa+9]=1+s(e[t*oa+9],e[n*oa+9])):(e[i*oa+8]=r,e[t*oa+8]=n,e[n*oa+6]=t,this.node_set_combined_aabb(t,a,n),this.node_set_combined_aabb(i,t,r),e[t*oa+9]=1+s(e[a*oa+9],e[n*oa+9]),e[i*oa+9]=1+s(e[t*oa+9],e[r*oa+9])),i}if(n<-1){const n=e[a*oa+7],r=e[a*oa+8];e[a*oa+7]=t;const o=e[t*oa+6];return e[a*oa+6]=o,e[t*oa+6]=a,o!==ra?e[o*oa+7]===t?e[o*oa+7]=a:e[o*oa+8]=a:this.__root=a,e[n*oa+9]>e[r*oa+9]?(e[a*oa+8]=n,e[t*oa+7]=r,e[r*oa+6]=t,this.node_set_combined_aabb(t,i,r),this.node_set_combined_aabb(a,t,n),e[t*oa+9]=1+s(e[i*oa+9],e[r*oa+9]),e[a*oa+9]=1+s(e[t*oa+9],e[n*oa+9])):(e[a*oa+8]=r,e[t*oa+7]=n,e[n*oa+6]=t,this.node_set_combined_aabb(t,i,n),this.node_set_combined_aabb(a,t,r),e[t*oa+9]=1+s(e[i*oa+9],e[n*oa+9]),e[a*oa+9]=1+s(e[t*oa+9],e[r*oa+9])),a}return t}balance_rotate(t){const e=this.__data_uint32,a=t*oa;if(this.node_is_leaf(t)||e[a+9]<2)return t;const i=e[a+7],n=e[a+8],r=this.node_is_leaf(i),o=this.node_is_leaf(n);let c=0,h=0,d=ra,_=ra,l=ra,f=ra;if(!r){const t=this.node_get_surface_area(i);d=e[i*oa+7],_=e[i*oa+8];const a=t-this.node_get_combined_surface_area(n,_);a>c&&(c=a,h=1);const s=t-this.node_get_combined_surface_area(d,n);s>c&&(c=s,h=2)}if(!o){const t=this.node_get_surface_area(n);l=e[n*oa+7],f=e[n*oa+8];const a=t-this.node_get_combined_surface_area(i,f);a>c&&(c=a,h=3);const s=t-this.node_get_combined_surface_area(l,i);s>c&&(c=s,h=4)}if(0===h)return t;switch(h){case 1:e[a+8]=d,e[i*oa+7]=n,e[d*oa+6]=t,e[n*oa+6]=i,this.node_set_combined_aabb(i,n,_),e[i*oa+9]=1+s(e[n*oa+9],e[_*oa+9]);break;case 2:e[a+8]=_,e[i*oa+8]=n,e[_*oa+6]=t,e[n*oa+6]=i,this.node_set_combined_aabb(i,d,n),e[i*oa+9]=1+s(e[d*oa+9],e[n*oa+9]);break;case 3:e[a+7]=l,e[n*oa+7]=i,e[l*oa+6]=t,e[i*oa+6]=n,this.node_set_combined_aabb(n,i,f),e[n*oa+9]=1+s(e[i*oa+9],e[f*oa+9]);break;case 4:e[a+7]=f,e[n*oa+8]=i,e[f*oa+6]=t,e[i*oa+6]=n,this.node_set_combined_aabb(n,l,i),e[n*oa+9]=1+s(e[l*oa+9],e[i*oa+9])}return e[a+9]=1+s(e[e[a+7]*oa+9],e[e[a+8]*oa+9]),t}node_assign_children(t,e,a){this.node_set_combined_aabb(t,e,a),this.node_assign_children_only(t,e,a)}node_assign_children_only(t,e,a){this.node_set_parent(e,t),this.node_set_parent(a,t),this.node_set_child1(t,e),this.node_set_child2(t,a),this.node_set_height(t,1+Math.max(this.node_get_height(e),this.node_get_height(a)))}release_all(){this.__root=ra,this.__size=0,this.__free_pointer=0}traverse(t,e){let a=0;const i=[],n=this.__root;n!==ra&&(i[a++]=n);const s=this.__data_uint32;for(;a>0;){a--;const n=i[a];t.call(e,n,this);const r=n*oa,o=s[r+7],c=s[r+8];o!==ra&&(i[a++]=c,i[a++]=o)}}collect_nodes_all(t,e){let a=e;return this.traverse(e=>{t[a++]=e}),a-e}__move_node_links(t,e){const a=this.__data_uint32,i=t*oa,n=a[i+7],s=a[i+8];n!==ra&&(a[n*oa+6]=e,a[s*oa+6]=e);const r=a[i+6];r!==ra&&(a[r*oa+7]===t?a[r*oa+7]=e:a[r*oa+8]=e)}swap_nodes(t,e){const i=this.__data_uint32,n=t*oa,s=e*oa;return i[n+6]!==e&&i[s+6]!==t&&(this.__move_node_links(t,e),this.__move_node_links(e,t),a(i,n,this.__free,this.__free_pointer,oa),a(i,s,i,n,oa),a(this.__free,this.__free_pointer,i,s,oa),this.__root===t?this.__root=e:this.__root===e&&(this.__root=t),!0)}}ha.prototype.isBVH=!0;const da=new ArrayBuffer(9280),_a=new Float32Array(da,0,1536),la=new Float32Array(da,6144,256),fa=new Float32Array(da,7168,256),ua=new Uint32Array(da,8192,256),ba=new Uint32Array(da,9216,16);function ga(t,e,a){if(1===oe(a))return e[re(a)];let i=ua[a],n=a&~i;const s=t.allocate_node(),r=ga(t,e,i),o=ga(t,e,n);return t.node_assign_children(s,r,o),s}function ma(t,e,a){if(e===ra)return;if(t.node_is_leaf(e))return;const i=t.node_get_child1(e),n=t.node_get_child2(e);let s=0;if(i!==ra&&(ba[s++]=i),n!==ra&&(ba[s++]=n),0!==s){for(;s<a;){let e=-1,a=0;for(let i=0;i<s;i++){const n=ba[i];if(t.node_is_leaf(n))continue;const s=t.node_get_surface_area(n);s>a&&(a=s,e=i)}if(-1===e)break;const i=ba[e],n=t.node_get_child1(i),r=t.node_get_child2(i);ba[e]=n,ba[s++]=r,t.release_node(i)}s<=2||function(t,e,a,i){const n=t.data_float32,s=(1<<i)-1;for(let t=1;t<=s;t++){let e,i,s,r,o,c;const h=!(t&t-1);if(h){const h=a[re(t)]*oa;e=n[h],i=n[h+1],s=n[h+2],r=n[h+3],o=n[h+4],c=n[h+5]}else{const a=t&-t,n=6*a,h=6*(t^a);e=Math.min(_a[n],_a[h]),i=Math.min(_a[n+1],_a[h+1]),s=Math.min(_a[n+2],_a[h+2]),r=Math.max(_a[n+3],_a[h+3]),o=Math.max(_a[n+4],_a[h+4]),c=Math.max(_a[n+5],_a[h+5])}const d=6*t;_a[d]=e,_a[d+1]=i,_a[d+2]=s,_a[d+3]=r,_a[d+4]=o,_a[d+5]=c;const _=r-e,l=o-i,f=c-s,u=2*(_*l+l*f+f*_);la[t]=u,h&&(fa[t]=1*u)}for(let t=2;t<=i;t++)for(let e=1;e<=s;e++){if(oe(e)!==t)continue;let a=Infinity,i=0;const n=e-1&e;let s=-n&e;do{const t=fa[s]+fa[e^s];t<a&&(a=t,i=s),s=s-n&e}while(0!==s);const r=1.2*la[e]+a;fa[e]=r,ua[e]=i}!function(t,e,a,i){let n=ua[i],s=i&~n;t.node_assign_children(e,ga(t,a,n),ga(t,a,s))}(t,e,a,(1<<i)-1)}(t,e,ba,s)}}function ya(t,e=t.root,a=7){if(e===ra)return;if(t.node_is_leaf(e))return;let i=e,n=0,s=t.node_get_child1(i);if(s===ra&&(s=t.node_get_child2(i)),s===ra)return;const r=Math.ceil(Math.log2(a));for(;;){if(2===n){const e=t.node_get_child1(s),i=t.node_get_child2(s);t.node_set_height(s,1+Math.max(t.node_get_height(e),t.node_get_height(i))),t.node_get_height(s)>=r&&ma(t,s,a)}if(t.node_is_leaf(s)){const e=i;n=t.node_get_child1(e)===s?1:2,i=s,s=e}else if(2===n){i=s;const a=t.node_get_parent(s);if(n=t.node_get_child1(a)===s?1:2,s===e)break;s=a}else if(1===n){const e=t.node_get_child2(s);i=s,e===ra?(n=2,s=t.node_get_parent(s)):(n=0,s=e)}else if(0===n){const e=t.node_get_child1(s),a=t.node_get_child2(s);if(e!==ra)n=0,i=s,s=e;else if(a!==ra)n=0,i=s,s=a;else{const e=t.node_get_child1(i);t.release_node(s),e===s?(t.node_set_child1(i,ra),i=ra,n=1):(t.node_set_child2(i,ra),i=ra,n=2),s=i}}}ma(t,e,a)}function pa(t,e,a){let i=t;return i>e&&(i=e),i>a&&(i=a),i}function wa(t,e,a,i,n,s){const r=3*i,o=3*n,c=3*s,h=a[r],d=a[r+1],_=a[r+2],l=a[o],f=a[o+1],u=a[o+2],b=a[c],g=a[c+1],m=a[c+2];t[e]=pa(h,l,b),t[e+1]=pa(d,f,g),t[e+2]=pa(_,u,m),t[e+3]=ne(h,l,b),t[e+4]=ne(d,f,g),t[e+5]=ne(_,u,m)}function va(t,e,i){const n=new ha;!function({bvh:t,meshlets:e,bounding_box:a,primitive_count:i,optimization:n=1}){const r=e.count,o=i,c=o+s(0,o-1);if(t.release_all(),0===o)return void(t.root=ra);t.allocate_linear(c);const h=new Uint32Array(r),d=s(0,r-1);{const i=c-d,n=new Uint32Array(i);let s=0;const o=new Uint32Array(128);for(let t=0;t<i;t++){const e=c-1-t;n[t]=e}const l=new Uint32Array(r);for(let t=0;t<r;t++){const i=e.read_header(t).bounds_box,n=.5*(i[0]+i[3]),s=.5*(i[1]+i[4]),r=.5*(i[2]+i[5]);l[t]=_(n,s,r,a)}const f=new Uint32Array(r);for(let t=0;t<r;t++)f[t]=t;f.sort((t,e)=>l[t]-l[e]);const u=new Float32Array(6);for(let a=0;a<r;a++){const i=f[a],r=e.read_meshlet(i),c=r.header,d=r.attribute_index,_=r.attribute_position,l=c.primitive_count;for(let e=0;e<l;e++){const a=3*e;wa(u,0,_,d[a+0],d[a+1],d[a+2]);const r=(16777215&i)<<8|255&e,c=n[s++];t.node_set_aabb(c,u),t.node_set_user_data(c,r),t.node_set_child1(c,ra),o[e]=c}let b=l;for(;b>1;){let e=0,a=0;for(;a+1<b;){const i=o[a++],r=o[a++],c=n[s++];t.node_assign_children(c,r,i),o[e++]=c}for(;a<b;)o[e++]=o[a++];b=e}h[a]=o[0]}}{let e=r,a=0;const i=d,n=new Uint32Array(i);for(let t=0;t<i;t++){const e=i-1-t;n[t]=e}for(;e>1;){let i=0,s=0;for(;s+1<e;){const e=h[s++],r=h[s++],o=n[a++];t.node_assign_children(o,r,e),h[i++]=o}for(;s<e;)h[i++]=h[s++];e=i}const s=h[0];t.node_set_parent(s,ra),t.root=s}for(let e=0;e<n;e++)ya(t);t.trim()}({bvh:n,meshlets:t,bounding_box:i,primitive_count:e});const r=new ArrayBuffer(32*n.node_capacity);return function(t,e,i,n,s){const r=new Uint32Array(i,0),o=new Uint32Array(t,0);for(let t=0;t<s;t++){const e=10*t,i=8*t;a(r,e,o,i,6),o[i+6]=r[e+7],o[i+7]=r[e+8]}}(r,0,n.data_buffer,0,n.node_capacity),r}const xa=new class extends ia{version=0;klass=aa;serialize_bvh=!0;serialize(t,e){t.writeUint32(e.primitive_count),t.writeFloat32Array(e.bounding_box,0,6),t.writeFloat32Array(e.bounding_sphere,0,4),t.writeUTF8String(e.name);const a=e.meshlets;t.writeUint32(a.count),t.writeUint32(a.metadata_buffer.byteLength),t.writeBytes(new Uint8Array(a.metadata_buffer),0,a.metadata_buffer.byteLength),t.writeUint32(a.data_buffer.byteLength),t.writeBytes(new Uint8Array(a.data_buffer),0,a.data_buffer.byteLength),this.serialize_bvh?(t.writeUint32(e.bvh.byteLength),t.writeBytes(new Uint8Array(e.bvh),0,e.bvh.byteLength)):t.writeUint32(0)}deserialize(t,e){e.primitive_count=t.readUint32(),t.readFloat32Array(e.bounding_box,0,6),t.readFloat32Array(e.bounding_sphere,0,4),e.name=t.readUTF8String(),e.meshlets.count=t.readUint32();const a=t.readUint32(),i=new Uint8Array(a);t.readBytes(i,0,a),e.meshlets.metadata_buffer=i.buffer;const n=t.readUint32(),s=new Uint8Array(n);t.readBytes(s,0,n),e.meshlets.data_buffer=s.buffer;const r=t.readUint32();if(0===r&&e.primitive_count>0)e.bvh=va(e.meshlets,e.primitive_count,e.bounding_box);else{const a=new Uint8Array(r);t.readBytes(a,0,r),e.bvh=a.buffer}}};function Aa(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function ka(t,e,a,i,n,s,r,o){const c=3*o;let h,d,_;void 0!==r?(h=r[c],d=r[c+1],_=r[c+2]):(h=c,d=c+1,_=c+2);const l=h*n+i,f=d*n+i,u=_*n+i;let b=a[l],g=a[l+1],m=a[l+2],y=a[f],p=a[f+1],w=a[f+2],v=a[u],x=a[u+1],A=a[u+2];s&&(b=Aa(b,a),g=Aa(g,a),m=Aa(m,a),y=Aa(y,a),p=Aa(p,a),w=Aa(w,a),v=Aa(v,a),x=Aa(x,a),A=Aa(A,a)),t[e]=b,t[e+1]=g,t[e+2]=m,t[e+3]=y,t[e+4]=p,t[e+5]=w,t[e+6]=v,t[e+7]=x,t[e+8]=A}function za(t,e,a,i,n,s){const r=t.getLeafAddress(e);wa(t.__data_float32,r,a,i,n,s),t.__data_uint32[r+6]=e}const ja=new Float64Array(9),Ua=[j.Uint64,j.Int64];function Ea(t){return 1===t?"":", true"}function Fa(t,e){return 0===t?"p":"p + "+t*e}function Ia(t,e){return 0===e?t:t+" + "+e}function Ca(t){return 1===t?"component":"component * "+t}class Ba{type=j.Float32;offset=0;components=0;stride=0;data_view=null;read=null;write=null;read_component=null;write_component=null;#M=null;#S=null;#N=null;#V=null;constructor(t,e,a){if(-1!==Ua.indexOf(t))throw new Error("type '"+t+"' is not supported by BinaryDataLayer: its DataView accessors are BigInt-valued, and no result contract for that exists yet");this.type=t,this.offset=e,this.components=a}get byte_size(){return R[this.type]*this.components}bind(t,e){e===this.stride&&null!==this.#M||(this.stride=e,this.#M=function(t,e,a,i){const n=N[t],s=R[t],r=Ea(s),o=["const p = id * "+i+" + "+e+";"];for(let t=0;t<a;t++)o.push("result["+Ia("result_offset",t)+"] = data_view."+n+"("+Fa(t,s)+r+");");return tt.INSTANCE.compile({args:["data_view"],code:"return function (result, result_offset, id) {\n"+o.join("\n")+"\n};"})}(this.type,this.offset,this.components,e),this.#S=function(t,e,a,i){const n=V[t],s=R[t],r=Ea(s),o=["const p = id * "+i+" + "+e+";"];for(let t=0;t<a;t++)o.push("data_view."+n+"("+Fa(t,s)+", value["+Ia("value_offset",t)+"]"+r+");");return tt.INSTANCE.compile({args:["data_view"],code:"return function (id, value, value_offset) {\n"+o.join("\n")+"\n};"})}(this.type,this.offset,this.components,e),this.#N=function(t,e,a){const i=N[t],n=R[t],s="id * "+a+" + "+e+" + "+Ca(n);return tt.INSTANCE.compile({args:["data_view"],code:"return function (id, component) {\nreturn data_view."+i+"("+s+Ea(n)+");\n};"})}(this.type,this.offset,e),this.#V=function(t,e,a){const i=V[t],n=R[t],s="id * "+a+" + "+e+" + "+Ca(n);return tt.INSTANCE.compile({args:["data_view"],code:"return function (id, component, value) {\ndata_view."+i+"("+s+", value"+Ea(n)+");\n};"})}(this.type,this.offset,e)),this.data_view=t,this.read=this.#M(t),this.write=this.#S(t),this.read_component=this.#N(t),this.write_component=this.#V(t)}}Ba.prototype.isBinaryDataLayer=!0;class Ma{#R;#P=[];#D=0;#T=0;#L=new ArrayBuffer(0);#q=new Uint8Array(this.#L);#E=new DataView(this.#L);constructor(t){this.#R=t}get record_size(){return this.#D}get layers(){return this.#P}get capacity(){return this.#T}get byteSize(){return this.#T*this.#D}get data_view(){return this.#E}add_layer(t,e){const a=this.#D,i=new Ba(t,this.#D,e);return this.#P.push(i),this.#D+=i.byte_size,this.#O(this.#T,a),i}ensure_capacity(t){t<=this.#T||this.#O(t,this.#D)}sync_capacity(){this.ensure_capacity(this.#R.capacity)}trim(){const t=this.#R.size;t>=this.#T||this.#O(t,this.#D)}swap(t,e){if(t===e)return;const a=this.#D;i(this.#q,t*a,this.#q,e*a,a)}copy_record(t,e,a){const i=this.#D,n=a*i;this.#q.set(e.#q.subarray(n,n+i),t*i)}copy(t){if(this!==t){this.#P=[],this.#D=0,this.#T=0,this.#L=new ArrayBuffer(0),this.#q=new Uint8Array(this.#L),this.#E=new DataView(this.#L);for(const e of t.layers)this.add_layer(e.type,e.components);this.ensure_capacity(t.capacity),this.#q.set(t.#q.subarray(0,t.capacity*t.record_size))}}#O(t,e){const a=this.#D,i=this.#q,n=this.#T;this.#L=new ArrayBuffer(t*a),this.#q=new Uint8Array(this.#L),this.#E=new DataView(this.#L),this.#T=t;const s=Math.min(t,n);if(s>0&&e>0)if(e===a)this.#q.set(i.subarray(0,s*a));else for(let t=0;t<s;t++)this.#q.set(i.subarray(t*e,t*e+e),t*a);for(const t of this.#P)t.bind(this.#E,a)}}Ma.prototype.isBinaryDataBlock=!0;class Sa{__free=[];__free_pointer=0;__size=0;constructor(t,e=128,a=!1){this.__item_size=t,this.__data_buffer=I(y(e*t),a),this.__data_uint8=new Uint8Array(this.__data_buffer),this.__data_uint32=new Uint32Array(this.__data_buffer),this.__data_float32=new Float32Array(this.__data_buffer),this.data_view=new DataView(this.__data_buffer),this.__capacity=e,this.__occupancy=new ce(this.__capacity),this.__occupancy.preventShrink()}fromArrayBuffer(t,e=0){const a=Math.floor(t.byteLength/this.__item_size);this.__data_buffer=t,this.__data_uint8=new Uint8Array(t),this.__data_uint32=new Uint32Array(t),this.__data_float32=new Float32Array(t),this.data_view=new DataView(t),this.__capacity=a,this.__free_pointer=0,this.__size=e,this.__occupancy=new ce(a),this.__occupancy.preventShrink(),e>0&&this.__occupancy.setRange(0,e-1)}get arrayBuffer(){return this.__data_buffer}get item_size(){return this.__item_size}get size(){return this.__size}count(){return this.__size-this.__free_pointer}get byteSize(){return this.__capacity*this.__item_size}get capacity(){return this.__capacity}get data_uint32(){return this.__data_uint32}get data_float32(){return this.__data_float32}trim(){this.__set_capacity(this.__size)}element_address(t){return this.__item_size*t}element_word(t){return Math.floor(this.element_address(t)/4)}is_allocated(t){return!(t>=this.__size)&&this.__occupancy.get(t)}__set_capacity(t){if(this.__capacity===t)return;const e=this.__data_uint8,i=y(t*this.__item_size),n=new(0,this.__data_buffer.constructor)(i);this.__data_buffer=n,this.__data_uint8=new Uint8Array(n),this.__data_uint32=new Uint32Array(this.__data_buffer),this.__data_float32=new Float32Array(this.__data_buffer),this.data_view=new DataView(n),function(t,e){const i=e.length;i>=t.length?e.set(t,0):t.constructor===e.constructor?m(t.buffer,t.byteOffset,e.buffer,e.byteOffset,Math.min(t.byteLength,e.byteLength)):a(t,0,e,0,i)}(e,this.__data_uint8),this.__capacity=t}__grow_capacity(t){const e=Math.ceil(ne(t,1.2*this.__capacity,this.__capacity+32));this.__set_capacity(e)}ensure_capacity(t){this.__capacity<t&&this.__grow_capacity(t)}allocate(){if(this.__free_pointer>0){this.__free_pointer--;const t=this.__free[this.__free_pointer];return this.__occupancy.set(t,!0),t}let t=this.__size;return this.__size++,this.__size>=this.__capacity&&this.__grow_capacity(this.__size),this.__occupancy.set(t,!0),t}allocate_continuous(t){const e=this.__size;return this.__size+=t,this.__size>=this.__capacity&&this.__grow_capacity(this.__size),t>0&&this.__occupancy.setRange(e,e+t-1),e}swap(t,e){if(t===e)return;const a=this.__item_size;i(this.__data_uint8,t*a,this.__data_uint8,e*a,a)}release(t){t===this.__size-1?(this.__size--,this.__occupancy.set(t,!1)):t>=this.__size||(this.__free[this.__free_pointer++]=t,this.__occupancy.set(t,!1))}clear_free_set(){this.__free_pointer=0,this.__size>0&&this.__occupancy.setRange(0,this.__size-1)}truncate(t){this.__size=t,this.__free_pointer=0,this.__occupancy.reset(),t>0&&this.__occupancy.setRange(0,t-1)}clear(){this.__size=0,this.__free_pointer=0,this.__occupancy.reset()}copy(t){this.__size=t.size,this.__item_size=t.item_size;const e=t.size*this.item_size,a=this.__data_buffer,i=t.__data_buffer;a.byteLength<e?this.fromArrayBuffer(i.slice(0),this.__size):m(i,0,a,0,e),this.__free_pointer=t.__free_pointer,this.__free=t.__free.slice(),this.__rebuild_occupancy_from_free()}__rebuild_occupancy_from_free(){this.__occupancy=new ce(Math.max(this.__capacity,this.__size)),this.__occupancy.preventShrink(),this.__size>0&&this.__occupancy.setRange(0,this.__size-1);const t=this.__free,e=this.__free_pointer;for(let a=0;a<e;a++)this.__occupancy.set(t[a],!1)}*[Symbol.iterator](){for(let t=0;t<this.__size;t++)!1!==this.is_allocated(t)&&(yield t)}}Sa.prototype.isBinaryElementPool=!0;const Na=4294967295;function Va(t,e,a){if(null===a)return null;const i=null===t?new Ma(e):t;return i.copy(a),i.sync_capacity(),i}class Ra{__vertex_pool=new Sa(28);__edge_pool=new Sa(28);__loop_pool=new Sa(28);__face_pool=new Sa(16);__vertex_data_block=null;__edge_data_block=null;__loop_data_block=null;__face_data_block=null;get byteSize(){let t=this.__loop_pool.byteSize+this.__vertex_pool.byteSize+this.__edge_pool.byteSize+this.__face_pool.byteSize;return null!==this.__vertex_data_block&&(t+=this.__vertex_data_block.byteSize),null!==this.__edge_data_block&&(t+=this.__edge_data_block.byteSize),null!==this.__loop_data_block&&(t+=this.__loop_data_block.byteSize),null!==this.__face_data_block&&(t+=this.__face_data_block.byteSize),t}trim(){this.__loop_pool.trim(),this.__vertex_pool.trim(),this.__edge_pool.trim(),this.__face_pool.trim(),null!==this.__vertex_data_block&&this.__vertex_data_block.trim(),null!==this.__edge_data_block&&this.__edge_data_block.trim(),null!==this.__loop_data_block&&this.__loop_data_block.trim(),null!==this.__face_data_block&&this.__face_data_block.trim()}get vertices(){return this.__vertex_pool}get edges(){return this.__edge_pool}get loops(){return this.__loop_pool}get faces(){return this.__face_pool}get vertex_data(){return this.__vertex_data_block}get edge_data(){return this.__edge_data_block}get loop_data(){return this.__loop_data_block}get face_data(){return this.__face_data_block}vertex_data_add_layer(t,e){null===this.__vertex_data_block&&(this.__vertex_data_block=new Ma(this.__vertex_pool));const a=this.__vertex_data_block.add_layer(t,e);return this.__vertex_data_block.sync_capacity(),a}edge_data_add_layer(t,e){null===this.__edge_data_block&&(this.__edge_data_block=new Ma(this.__edge_pool));const a=this.__edge_data_block.add_layer(t,e);return this.__edge_data_block.sync_capacity(),a}loop_data_add_layer(t,e){null===this.__loop_data_block&&(this.__loop_data_block=new Ma(this.__loop_pool));const a=this.__loop_data_block.add_layer(t,e);return this.__loop_data_block.sync_capacity(),a}face_data_add_layer(t,e){null===this.__face_data_block&&(this.__face_data_block=new Ma(this.__face_pool));const a=this.__face_data_block.add_layer(t,e);return this.__face_data_block.sync_capacity(),a}delete_vertex_data(){return null!==this.__vertex_data_block&&(this.__vertex_data_block=null,!0)}delete_edge_data(){return null!==this.__edge_data_block&&(this.__edge_data_block=null,!0)}delete_loop_data(){return null!==this.__loop_data_block&&(this.__loop_data_block=null,!0)}delete_face_data(){return null!==this.__face_data_block&&(this.__face_data_block=null,!0)}clear(){this.__vertex_pool.clear(),this.__edge_pool.clear(),this.__loop_pool.clear(),this.__face_pool.clear()}vertex_read_coordinate(t,e,a){const i=this.__vertex_pool,n=i.element_address(a)>>2;t[e]=i.data_float32[n],t[e+1]=i.data_float32[n+1],t[e+2]=i.data_float32[n+2]}vertex_write_coordinate(t,e,a){const i=this.__vertex_pool,n=i.element_address(t)>>2;i.data_float32[n]=e[a],i.data_float32[n+1]=e[a+1],i.data_float32[n+2]=e[a+2]}vertex_read_normal(t,e,a){const i=this.__vertex_pool,n=i.element_address(a)+12>>2;t[e]=i.data_float32[n],t[e+1]=i.data_float32[n+1],t[e+2]=i.data_float32[n+2]}vertex_write_normal(t,e,a){const i=this.__vertex_pool,n=i.element_address(t)+12>>2;i.data_float32[n]=e[a],i.data_float32[n+1]=e[a+1],i.data_float32[n+2]=e[a+2]}vertex_read_edge(t){const e=this.__vertex_pool,a=e.element_address(t);return e.data_view.getUint32(a+24)}vertex_write_edge(t,e){const a=this.__vertex_pool,i=a.element_address(t);a.data_view.setUint32(i+24,e)}edge_read_vertex1(t){const e=this.__edge_pool,a=e.element_address(t);return e.data_view.getUint32(a)}edge_write_vertex1(t,e){const a=this.__edge_pool,i=a.element_address(t);a.data_view.setUint32(i,e)}edge_read_vertex2(t){const e=this.__edge_pool,a=e.element_address(t);return e.data_view.getUint32(a+4)}edge_write_vertex2(t,e){const a=this.__edge_pool,i=a.element_address(t);a.data_view.setUint32(i+4,e)}edge_read_loop(t){const e=this.__edge_pool,a=e.element_address(t);return e.data_view.getUint32(a+8)}edge_write_loop(t,e){const a=this.__edge_pool,i=a.element_address(t);a.data_view.setUint32(i+8,e)}edge_read_v1_disk_next(t){const e=this.__edge_pool,a=e.element_address(t);return e.data_view.getUint32(a+12)}edge_write_v1_disk_next(t,e){const a=this.__edge_pool,i=a.element_address(t);a.data_view.setUint32(i+12,e)}edge_read_v1_disk_prev(t){const e=this.__edge_pool,a=e.element_address(t);return e.data_view.getUint32(a+16)}edge_write_v1_disk_prev(t,e){const a=this.__edge_pool,i=a.element_address(t);a.data_view.setUint32(i+16,e)}edge_read_v2_disk_next(t){const e=this.__edge_pool,a=e.element_address(t);return e.data_view.getUint32(a+20)}edge_write_v2_disk_next(t,e){const a=this.__edge_pool,i=a.element_address(t);a.data_view.setUint32(i+20,e)}edge_read_v2_disk_prev(t){const e=this.__edge_pool,a=e.element_address(t);return e.data_view.getUint32(a+24)}edge_write_v2_disk_prev(t,e){const a=this.__edge_pool,i=a.element_address(t);a.data_view.setUint32(i+24,e)}vertex_create(){const t=this.__vertex_pool.allocate();return this.__vertex_data_block?.sync_capacity(),t}vertices_create_continuous(t){const e=this.__vertex_pool.allocate_continuous(t);return this.__vertex_data_block?.sync_capacity(),e}vertex_destroy(t){this.__vertex_pool.release(t)}edge_create(){const t=this.__edge_pool.allocate();return this.__edge_data_block?.sync_capacity(),t}edge_destroy(t){this.__edge_pool.release(t)}face_create(){const t=this.__face_pool.allocate();return this.__face_data_block?.sync_capacity(),t}faces_create_continuous(t){const e=this.__face_pool.allocate_continuous(t);return this.__face_data_block?.sync_capacity(),e}face_destroy(t){this.__face_pool.release(t)}loop_create(){const t=this.__loop_pool.allocate();return this.__loop_data_block?.sync_capacity(),this.loop_initialize(t),t}loop_destroy(t){this.__loop_pool.release(t)}loop_initialize(t){this.loop_write_radial_next(t,t),this.loop_write_radial_prev(t,t),this.loop_write_next(t,t),this.loop_write_prev(t,t)}loop_read_vertex(t){const e=this.__loop_pool,a=e.element_address(t);return e.data_view.getUint32(a)}loop_write_vertex(t,e){const a=this.__loop_pool,i=a.element_address(t);a.data_view.setUint32(i,e)}loop_read_edge(t){const e=this.__loop_pool,a=e.element_address(t);return e.data_view.getUint32(a+4)}loop_write_edge(t,e){const a=this.__loop_pool,i=a.element_address(t);a.data_view.setUint32(i+4,e)}loop_read_face(t){const e=this.__loop_pool,a=e.element_address(t);return e.data_view.getUint32(a+8)}loop_write_face(t,e){const a=this.__loop_pool,i=a.element_address(t);a.data_view.setUint32(i+8,e)}loop_read_radial_next(t){const e=this.__loop_pool,a=e.element_address(t);return e.data_view.getUint32(a+12)}loop_write_radial_next(t,e){const a=this.__loop_pool,i=a.element_address(t);a.data_view.setUint32(i+12,e)}loop_read_radial_prev(t){const e=this.__loop_pool,a=e.element_address(t);return e.data_view.getUint32(a+16)}loop_write_radial_prev(t,e){const a=this.__loop_pool,i=a.element_address(t);a.data_view.setUint32(i+16,e)}loop_read_next(t){const e=this.__loop_pool,a=e.element_address(t);return e.data_view.getUint32(a+20)}loop_write_next(t,e){const a=this.__loop_pool,i=a.element_address(t);a.data_view.setUint32(i+20,e)}loop_read_prev(t){const e=this.__loop_pool,a=e.element_address(t);return e.data_view.getUint32(a+24)}loop_write_prev(t,e){const a=this.__loop_pool,i=a.element_address(t);a.data_view.setUint32(i+24,e)}face_read_loop(t){const e=this.__face_pool,a=e.element_address(t);return e.data_view.getUint32(a)}face_write_loop(t,e){const a=this.__face_pool,i=a.element_address(t);a.data_view.setUint32(i,e)}face_read_normal(t,e,a){const i=this.__face_pool,n=i.element_address(a)+4>>2;t[e]=i.data_float32[n],t[e+1]=i.data_float32[n+1],t[e+2]=i.data_float32[n+2]}face_write_normal(t,e,a){const i=this.__face_pool,n=i.element_address(t)+4>>2;i.data_float32[n]=e[a],i.data_float32[n+1]=e[a+1],i.data_float32[n+2]=e[a+2]}copy(t){this!==t&&(this.__vertex_pool.copy(t.vertices),this.__edge_pool.copy(t.edges),this.__loop_pool.copy(t.loops),this.__face_pool.copy(t.faces),this.__vertex_data_block=Va(this.__vertex_data_block,this.__vertex_pool,t.vertex_data),this.__edge_data_block=Va(this.__edge_data_block,this.__edge_pool,t.edge_data),this.__loop_data_block=Va(this.__loop_data_block,this.__loop_pool,t.loop_data),this.__face_data_block=Va(this.__face_data_block,this.__face_pool,t.face_data))}clone(){const t=new Ra;return t.copy(this),t}}function Pa(t,e,a){t.loop_write_edge(e,a);const i=t.edge_read_loop(a);if(i===Na)t.edge_write_loop(a,e),t.loop_write_radial_next(e,e),t.loop_write_radial_prev(e,e);else{const a=t.loop_read_radial_prev(i);t.loop_write_radial_next(a,e),t.loop_write_radial_prev(e,a),t.loop_write_radial_next(e,i),t.loop_write_radial_prev(i,e)}}function Da(t,e,a,i){let n;return t.edge_read_vertex1(e)===i?(n=t.edge_read_v1_disk_next(e),t.edge_write_v1_disk_next(e,a)):(n=t.edge_read_v2_disk_next(e),t.edge_write_v2_disk_next(e,a)),n}function Ta(t,e,a,i){let n;return t.edge_read_vertex1(e)===i?(n=t.edge_read_v1_disk_prev(e),t.edge_write_v1_disk_prev(e,a)):(n=t.edge_read_v2_disk_prev(e),t.edge_write_v2_disk_prev(e,a)),n}function La(t,e,a,i){const n=Da(t,e,a,i);Da(t,a,n,i),Ta(t,n,a,i),Ta(t,a,e,i)}function qa(t,e,a){const i=function(t,e,a){const i=t.vertex_read_edge(e);if(i===Na)return Na;let n=i;do{const i=t.edge_read_vertex1(n),s=t.edge_read_vertex2(n);if(i===a||s===a)return n;if(i===e)n=t.edge_read_v1_disk_next(n);else{if(s!==e)throw new Error("Invalid edge, not connected to first vertex");n=t.edge_read_v2_disk_next(n)}}while(n!==i);return Na}(t,e,a);return i!==Na?i:function(t,e,a){const i=t.edge_create();t.edge_write_vertex1(i,e),t.edge_write_vertex2(i,a),t.edge_write_loop(i,Na);const n=t.vertex_read_edge(e);if(n!==Na?La(t,n,i,e):(t.vertex_write_edge(e,i),t.edge_write_v1_disk_next(i,i),t.edge_write_v1_disk_prev(i,i)),e===a)return i;const s=t.vertex_read_edge(a);return s!==Na?La(t,s,i,a):(t.vertex_write_edge(a,i),t.edge_write_v2_disk_next(i,i),t.edge_write_v2_disk_prev(i,i)),i}(t,e,a)}function Oa(t,e,a,i){t.clear();const n=a.length/3;t.vertices_create_continuous(n);for(let e=0;e<n;e++){const n=3*e,s=e;t.vertex_write_coordinate(s,a,n),void 0!==i&&t.vertex_write_normal(s,i,n),t.vertex_write_edge(s,Na)}const s=e.length/3;t.faces_create_continuous(s),t.loops.ensure_capacity(3*s),t.edges.ensure_capacity(1.6*s);for(let a=0;a<s;a++){const i=3*a,n=e[i],s=e[i+1],r=e[i+2],o=a,c=qa(t,n,s),h=qa(t,s,r),d=qa(t,r,n),_=t.loop_create(),l=t.loop_create(),f=t.loop_create();t.loop_write_vertex(_,n),t.loop_write_face(_,o),t.loop_write_vertex(l,s),t.loop_write_face(l,o),t.loop_write_vertex(f,r),t.loop_write_face(f,o),Pa(t,_,c),Pa(t,l,h),Pa(t,f,d),t.loop_write_next(_,l),t.loop_write_prev(_,f),t.loop_write_next(l,f),t.loop_write_prev(l,_),t.loop_write_next(f,_),t.loop_write_prev(f,l),t.face_write_loop(o,_)}}function Xa(t,e){const a=t.edge_read_loop(e);return a!==Na&&t.loop_read_radial_next(a)===a}function Ka(t,e,a){const i=t.edge_read_vertex1(e),n=t.edge_read_vertex2(e);return i===a?n:i}Ra.prototype.isBinaryTopology=!0;const Wa=[],Ja=[],Qa="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let t=0,e=64;t<e;++t)Wa[t]=Qa[t],Ja[Qa.charCodeAt(t)]=t;function Ga(t){return Wa[t>>18&63]+Wa[t>>12&63]+Wa[t>>6&63]+Wa[63&t]}function Ya(t,e,a){const i=[];for(let n=e;n<a;n+=3){const e=(t[n]<<16&16711680)+(t[n+1]<<8&65280)+(255&t[n+2]);i.push(Ga(e))}return i.join("")}Ja["-".charCodeAt(0)]=62,Ja["_".charCodeAt(0)]=63;const Ha=16383;class $a{static encode(t){return function(t){const e=t.length,a=e%3,i=[],n=e-a;for(let e=0;e<n;e+=Ha){const a=Ya(t,e,e+Ha>n?n:e+Ha);i.push(a)}if(1===a){const a=t[e-1];i.push(Wa[a>>2]+Wa[a<<4&63]+"==")}else if(2===a){const a=(t[e-2]<<8)+t[e-1];i.push(Wa[a>>10]+Wa[a>>4&63]+Wa[a<<2&63]+"=")}return i.join("")}(new Uint8Array(t))}static decode(t){return function(t){let e;const a=function(t){const e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");let a=t.indexOf("=");return-1===a&&(a=e),[a,a===e?0:4-a%4]}(t),i=a[0],n=a[1],s=new Uint8Array(function(t,e){return 3*(t+e)/4-e}(i,n));let r=0;const o=n>0?i-4:i;let c=0;for(;c<o;c+=4){const a=t.charCodeAt(c),i=t.charCodeAt(c+1),n=t.charCodeAt(c+2),o=t.charCodeAt(c+3);e=Ja[a]<<18|Ja[i]<<12|Ja[n]<<6|Ja[o],s[r++]=e>>16&255,s[r++]=e>>8&255,s[r++]=255&e}if(2===n){const a=t.charCodeAt(c),i=t.charCodeAt(c+1);e=Ja[a]<<2|Ja[i]>>4,s[r++]=255&e}if(1===n){const a=t.charCodeAt(c),i=t.charCodeAt(c+1),n=t.charCodeAt(c+2);e=Ja[a]<<10|Ja[i]<<4|Ja[n]>>2,s[r++]=e>>8&255,s[r++]=255&e}return s}(t).buffer}}const Za={[j.Uint8]:Uint8Array,[j.Uint16]:Uint16Array,[j.Uint32]:Uint32Array,[j.Uint64]:BigUint64Array,[j.Int8]:Int8Array,[j.Int16]:Int16Array,[j.Int32]:Int32Array,[j.Int64]:BigInt64Array,[j.Float16]:Float16Array,[j.Float32]:Float32Array,[j.Float64]:Float64Array};function ti(t){const e=Object.getPrototypeOf(t).constructor;switch(e){case Uint8Array:case Uint8ClampedArray:return j.Uint8;case Uint16Array:return j.Uint16;case Uint32Array:return j.Uint32;case Int8Array:return j.Int8;case Int16Array:return j.Int16;case Int32Array:return j.Int32;case Float16Array:return j.Float16;case Float32Array:return j.Float32;case Array:case Float64Array:return j.Float64;default:throw new Error(`unsupported constructor type ${e.name}`)}}function ei(e,a){if(e===a)return!0;const i=e.length;if(i!==a.length)return!1;const n=e.constructor;if(n!==a.constructor)return!1;if(0===i)return!0;if(i<128)return t(e,a);const s=e.byteLength;if(s!==a.byteLength)return!1;const r=e.buffer,o=a.buffer,c=e.byteOffset,h=a.byteOffset;if(r===o&&c===h)return!0;let d=e,_=a;const l=n.BYTES_PER_ELEMENT,f=g(c,h,s),u="undefined"!=typeof Float16Array&&n===Float16Array||n===Float32Array||n===Float64Array;return!u&&l<4&&4===f?(d=new Uint32Array(r,c,s>>>2),_=new Uint32Array(o,h,s>>>2)):!u&&l<2&&2===f&&(d=new Uint16Array(r,c,s>>>1),_=new Uint16Array(o,h,s>>>1)),t(d,_)}function ai(t,e,a){return(e-t)*a+t}function ii(t,e,a,i,n){return.5*(i-e+(2*e-5*a+4*i-n+(3*(a-i)+n-e)*t)*t)*t+a}function ni(t){const e=0|t;return na-((t-e)*na>>>0)^e}class si{version=0;constructor(t=[],e=1,a=0,i=0){if(!Number.isInteger(e)||e<0)throw new Error(`itemSize must be a non-negative integer, instead was ${e}`);if(!Number.isInteger(a)||a<0)throw new Error(`width must be a non-negative integer, instead was ${a}`);if(!Number.isInteger(i)||a<0)throw new Error(`height must be a non-negative integer, instead was ${i}`);if(void 0===t)throw new Error("data was undefined");if(t.length<a*i*e)throw new Error(`Buffer underflow, data.length(=${t.length}) is too small. Expected at least ${a*i*e}`);this.width=a,this.height=i,this.itemSize=e,this.data=t}sampleCatmullRomUV(t,e,a){const i=this.itemSize;for(let n=0;n<i;n++)a[n]=this.sampleChannelCatmullRomUV(t,e,n)}sampleChannelCatmullRomUV(t,e,a){const i=t*this.width-.5,n=e*this.height-.5;return this.sampleChannelCatmullRom(i,n,a)}sampleChannelCatmullRom(t,e,a){const i=Math.floor(t),n=Math.floor(e),s=t-i,r=e-n,o=s*(s*(1-.5*s)-.5),c=r*(r*(1-.5*r)-.5),h=s*(.5+s*(2-1.5*s)),d=r*(.5+r*(2-1.5*r)),_=s*s*(.5*s-.5),l=r*r*(.5*r-.5),f=1+s*s*(1.5*s-2.5)+h,u=1+r*r*(1.5*r-2.5)+d,b=i-1,g=n-1,m=i+2,y=n+2,p=i+h/f,w=n+d/u;let v=0;return v+=this.sampleChannelBilinear(b,g,a)*o*c,v+=this.sampleChannelBilinear(p,g,a)*f*c,v+=this.sampleChannelBilinear(m,g,a)*_*c,v+=this.sampleChannelBilinear(b,w,a)*o*u,v+=this.sampleChannelBilinear(p,w,a)*f*u,v+=this.sampleChannelBilinear(m,w,a)*_*u,v+=this.sampleChannelBilinear(b,y,a)*o*l,v+=this.sampleChannelBilinear(p,y,a)*f*l,v+=this.sampleChannelBilinear(m,y,a)*_*l,v}sampleBicubicUV(t,e,a){const i=this.itemSize;for(let n=0;n<i;n++)a[n]=this.sampleChannelBicubicUV(t,e,n)}sampleBicubic(t,e,a,i){const n=this.itemSize;for(let s=0;s<n;s++)a[s+i]=this.sampleChannelBicubic(t,e,s)}sampleChannelBicubicUV(t,e,a){const i=t*this.width,n=e*this.height;return this.sampleChannelBicubic(i-.5,n-.5,a)}sampleChannelBicubic(t,e,a){const i=this.itemSize,n=this.width,o=this.height,c=this.data,h=n*i,d=n-1,_=o-1,l=Ke(t,0,d),f=Ke(e,0,_),u=0|l,b=0|f,g=l-u,m=f-b,y=s(0,u-1),p=s(0,b-1),w=r(d,u+1),v=r(_,b+1),x=r(d,w+1),A=p*h+a,k=b*h+a,z=v*h+a,j=r(_,v+1)*h+a,U=y*i,E=u*i,F=w*i,I=x*i,C=c[A+U],B=c[A+E],M=c[A+F],S=c[A+I],N=c[k+U],V=c[k+E],R=c[k+F],P=c[k+I],D=c[z+U],T=c[z+E],L=c[z+F],q=c[z+I],O=c[j+U],X=c[j+E],K=c[j+F],W=c[j+I],J=ii(g,C,B,M,S),Q=ii(g,N,V,R,P),G=ii(g,D,T,L,q),Y=ii(g,O,X,K,W);return ii(m,J,Q,G,Y)}sampleBilinearUV(t,e,a,i=0){const n=this.itemSize;for(let s=0;s<n;s++)a[s+i]=this.sampleChannelBilinearUV(t,e,s)}sampleBilinear(t,e,a,i=0){const n=this.itemSize;for(let s=0;s<n;s++)a[s+i]=this.sampleChannelBilinear(t,e,s)}sampleChannelBilinearUV(t,e,a){const i=t*this.width-.5,n=e*this.height-.5;return this.sampleChannelBilinear(i,n,a)}sampleChannelBilinear(t,e,a){const i=this.itemSize,n=this.width,s=n*i,r=this.height-1,o=Ke(t,0,n-1),c=Ke(e,0,r),h=o>>>0,d=c>>>0,_=d*s,l=h*i+a,f=_+l;let u,b;u=o===h?h:h+1,b=c===d?d:d+1;const g=this.data,m=g[f];if(h===u&&d===b)return m;const y=o-h,p=c-d,w=u*i+a,v=b*s,x=v+l,A=v+w,k=g[_+w],z=g[x],j=g[A],U=ai(m,k,y),E=ai(z,j,y);return ai(U,E,p)}sampleNearestUV(t,e,a){const i=this.width,n=this.height,s=Math.round(t*i-.5),r=Math.round(e*n-.5);this.read(Ke(s,0,i-1),Ke(r,0,n-1),a)}readChannel(t,e,a){const i=(e*this.width+t)*this.itemSize+a;return this.data[i]}read(t,e,a){const i=this.width,n=this.itemSize,s=(e*i+t)*n;for(let t=0;t<n;t++)a[t]=this.data[s+t]}write(t,e,a){const i=this.width,n=this.itemSize,s=(e*i+t)*n;for(let t=0;t<n;t++)this.data[s+t]=a[t];this.version++}point2index(t,e){return t+e*this.width}index2point(t,e){const a=this.width,i=t%a,n=t/a|0;e.set(i,n)}copy(t,e,a,i,n,s,r){const o=Math.min(s,t.width-e,this.width-i),c=Math.min(r,t.height-a,this.height-n),h=this.itemSize,d=t.itemSize,_=Math.min(h,d),l=h*this.width,f=d*t.width,u=t.data,b=this.data;let g,m,y;for(m=0;m<c;m++){const t=(m+n)*l,s=(m+a)*f;for(g=0;g<o;g++){const a=t+(g+i)*h,n=s+(g+e)*d;for(y=0;y<_;y++)b[a+y]=u[n+y]}}this.version++}zeroFill(t,e,a,i){const n=Ke(t,0,this.width),s=Ke(e,0,this.height),r=Ke(t+a,0,this.width),o=Ke(e+i,0,this.height),c=this.data,h=this.itemSize,d=h*this.width,_=n*h,l=r*h;let f;for(f=s;f<o;f++){const t=f*d;c.fill(0,t+_,t+l)}this.version++}channelFill(t,e){const a=this.itemSize,i=this.data,n=i.length;for(let s=t;s<n;s+=a)i[s]=e;this.version++}fill(t,e,a,i,n){const s=this.width,r=this.height,o=Ke(t,0,s),c=Ke(e,0,r),h=Ke(t+a,0,s),d=Ke(e+i,0,r),_=this.data,l=this.itemSize,f=l*s;let u,b,g;for(u=c;u<d;u++){const t=u*f;for(b=o;b<h;b++){const e=t+b*l;for(g=0;g<l;g++)_[e+g]=n[g]}}this.version++}writeChannel(t,e,a,i){const n=(e*this.width+t)*this.itemSize+a;this.data[n]=i,this.version++}traverseCircle(t,e,a,i){let n,s;const r=0|t,o=0|e,c=a*a,h=Math.ceil(a);for(s=-h;s<=h;s++){const t=s*s;for(n=-h;n<=h;n++)n*n+t<=c&&i(r+n,o+s,this)}}resize(t,e,a=!0){const i=this.width,n=this.height;if(i===t&&n===e)return;const s=this.itemSize,o=t*e*s,c=this.data,h=new(function(t){if(t instanceof Int8Array)return Int8Array;if(t instanceof Int16Array)return Int16Array;if(t instanceof Int32Array)return Int32Array;if(t instanceof Uint8Array)return Uint8Array;if(t instanceof Uint8ClampedArray)return Uint8ClampedArray;if(t instanceof Uint16Array)return Uint16Array;if(t instanceof Uint32Array)return Uint32Array;if(t instanceof Float16Array)return Float16Array;if(t instanceof Float32Array)return Float32Array;if(t instanceof Float64Array)return Float64Array;if(Array.isArray(t))return Array;throw new TypeError("Unsupported array type")}(c))(o);if(a)if(t===i)h.set(c.subarray(0,Math.min(c.length,o)));else{const a=r(e,n),o=r(t,i);for(let e=0;e<a;e++)for(let a=0;a<o;a++){const n=(e*t+a)*s,r=(e*i+a)*s;for(let t=0;t<s;t++)h[n+t]=c[r+t]}}this.width=t,this.height=e,this.data=h,this.version++}computeByteSize(){let t;const e=this.data;return t=Array.isArray(e)?8*e.length:e.byteLength,t+280}equals(t){return null!=t&&(this===t||this.width===t.width&&this.height===t.height&&this.itemSize===t.itemSize&&ei(this.data,t.data))}hash(){const t=this.itemSize,e=this.width,a=this.height,i=this.data;let n=((65535&e)<<16|65535&a)^t;const s=e*a*t;if(function(t){if("object"!=typeof t)return!1;if(null===t)return!1;const e=t.constructor;return e===Uint8Array||e===Uint8ClampedArray||e===Uint16Array||e===Uint32Array||e===Int8Array||e===Int16Array||e===Int32Array||e===Float16Array||e===Float32Array||e===Float64Array||e===BigUint64Array||e===BigInt64Array}(i))n^=E(i.buffer,i.byteOffset,i.byteLength);else for(let t=0;t<s;++t)n=(n<<5)-n+ni(i[t]);return n}clone(){let t;return t=Array.isArray(this.data)?this.data.slice():new(0,this.data.constructor)(this.data),new si(t,this.itemSize,this.width,this.height)}toJSON(){const t=$a.encode(this.data.buffer);return{height:this.height,width:this.width,itemSize:this.itemSize,type:ti(this.data),data:t}}fromJSON({height:t,width:e,itemSize:a,type:i,data:n}){const s=function(t){const e=Za[t];if(void 0===e)throw new Error(`Unsupported data type '${t}'`);return e}(i);if("string"==typeof n){const t=$a.decode(n);this.data=new s(t)}else{if(!Array.isArray(n))throw new Error("Unsupported data format");this.data=new s(n)}this.height=t,this.width=e,this.itemSize=a}static uint8clamped(t,e,a){const i=new Uint8ClampedArray(e*a*t);return new si(i,t,e,a)}static uint8(t,e,a){const i=new Uint8Array(e*a*t);return new si(i,t,e,a)}static uint16(t,e,a){const i=new Uint16Array(e*a*t);return new si(i,t,e,a)}static uint32(t,e,a){const i=new Uint32Array(e*a*t);return new si(i,t,e,a)}static int8(t,e,a){const i=new Int8Array(e*a*t);return new si(i,t,e,a)}static int16(t,e,a){const i=new Int16Array(e*a*t);return new si(i,t,e,a)}static int32(t,e,a){const i=new Int32Array(e*a*t);return new si(i,t,e,a)}static float16(t,e,a){const i=new Float16Array(e*a*t);return new si(i,t,e,a)}static float32(t,e,a){const i=new Float32Array(e*a*t);return new si(i,t,e,a)}static float64(t,e,a){const i=new Float64Array(e*a*t);return new si(i,t,e,a)}}function ri(t,e,a,i){const n=a[i],s=a[i+1],r=a[i+2];t[e]+=n,t[e+1]+=s,t[e+2]+=r}function oi(t,e,a){return t*t+e*e+a*a}function ci(t,e,a,i,n,s){const r=3*a,o=3*i,c=3*n;!function(t,e,a,i,n,s,r,o,c,h,d){const _=c-s,l=h-r,f=d-o,u=a-s,b=i-r,g=n-o,m=l*g-f*b,y=f*u-_*g,p=_*b-l*u,w=oi(m,y,p);if(0===w)return t[e]=0,t[e+1]=1,void(t[e+2]=0);const v=1/Math.sqrt(w),x=m*v,A=y*v,k=p*v;t[e]=x,t[e+1]=A,t[e+2]=k}(t,e,s[r],s[r+1],s[r+2],s[o],s[o+1],s[o+2],s[c],s[c+1],s[c+2])}function hi(t,e,a,i){const n=a[i],s=a[i+1],r=a[i+2],o=oi(n,s,r),c=0!==o?1/Math.sqrt(o):1;t[e]=n*c,t[e+1]=s*c,t[e+2]=r*c}si.prototype.isSampler2D=!0,si.typeName="Sampler2D";const di=new Float64Array(3);function _i(t,e,a){const i=a.length;for(let n=0;n<i;n+=3){const i=a[n],s=a[n+1],r=a[n+2];ci(di,0,i,s,r,t),ri(e,3*i,di,0),ri(e,3*s,di,0),ri(e,3*r,di,0)}!function(t,e=0,a=t.length-e){const i=e+a;for(let a=e;a<i;a+=3)hi(t,a,t,a)}(e)}var li={build:function(t,e,a,i,n,s){const r=a.x*s,o=a.y*s,c=r-1,h=o-1;let d=0,_=0;const l=r*o,f=new Float32Array(3*l),u=new Float32Array(3*l),b=new Float32Array(2*l);let g,m;const y=a.y/n.y/h,p=a.x/n.x/c,w=e.y/n.y,v=e.x/n.x,x=n.x*i.x,A=n.y*i.y;let k,z,j;for(g=0;g<o;g++){const e=g*y+w;for(j=e*A,m=0;m<r;m++){const a=m*p+v;k=a*x,z=t.sampleChannelBicubicUV(a,e,0),f[d]=k,f[d+1]=z,f[d+2]=j,b[_]=a,b[_+1]=e,d+=3,_+=2}}d=0;const U=new(T(f.length/3))(c*h*6);for(g=0;g<h;g++)for(m=0;m<c;m++){const t=m+r*g,e=m+r*(g+1),a=m+1+r*(g+1),i=m+1+r*g;U[d]=t,U[d+1]=e,U[d+2]=i,U[d+3]=e,U[d+4]=a,U[d+5]=i,d+=6}return _i(f,u,U),{indices:U,vertices:f,normals:u,uvs:b}}};class fi{name="";type=j.Float32;itemSize=1;normalized=!1;static from(t,e,a=!1,i=""){const n=new fi;return n.fromJSON({name:i,type:t,itemSize:e,normalized:a}),n}static fromJSON(t){const e=new fi;return e.fromJSON(t),e}fromJSON({name:t="",type:e,itemSize:a,normalized:i=!1}){this.name=t,this.type=e,this.itemSize=a,this.normalized=i}toJSON(){return{name:this.name,type:this.type,itemSize:this.itemSize,normalized:this.normalized}}toString(){let t="";return""!==this.name&&(t+=`${this.name}:`),t+=`${this.itemSize}x${et(j,this.type)??this.type}`,this.normalized&&(t+="-norm"),t}hash(){return H(this.name)}equals(t){return this.type===t.type&&this.itemSize===t.itemSize&&this.normalized===t.normalized&&this.name===t.name}copy(t){this.type=t.type,this.name=t.name,this.itemSize=t.itemSize,this.normalized=t.normalized}clone(){const t=new fi;return t.copy(this),t}getByteSize(){return this.itemSize*R[this.type]}static byName(t,e){return t.name.localeCompare(e.name)}}fi.prototype.isAttributeSpec=!0;class ui{spec=new fi;data;count=0;#X=0;get version(){return this.#X}set needsUpdate(t){t&&this.#X++}get name(){return this.spec.name}get itemSize(){return this.spec.itemSize}equals(t){return this.spec.equals(t.spec)&&this.count===t.count&&ei(this.data,t.data)}hash(){return U(this.spec.hash(),this.count,function(t,e,a,i=31){const n=r(a,1024);return function(t,e,a,i,n){let s=a;for(let e=0;e<a;e+=i)s=(s<<5)-s+n.call(void 0,t[e]);return s>>>0}(t,0,n,Math.max(1,Math.ceil(n/i)),ni)}(this.data,0,this.data.length))}copy(t){this.spec.copy(t.spec),this.count=t.count;const e=t.data.constructor;this.data=new e(t.data)}clone(){const t=new ui;return t.copy(this),t}static from(t,e=1,a=""){const i=ti(t),n=new ui;return n.spec.type=i,n.spec.name=a,n.spec.itemSize=e,n.count=t.length/e,n.data=t,n}get memory_usage_bytes(){let t=0;return void 0!==this.data&&null!==this.data&&(t=this.data.byteLength),t}}function bi(t){return t*t}function gi(t,e,a){let i=0;for(let n=0;n<a;n++)i+=t[n]*e[n];return i}ui.prototype.isAttribute=!0;class mi{constructor(t,e){const a=Za[e];if(void 0===a)throw new Error(`Unsupported type '${e}'`);this.size=t,this.type=e,this.data=new a(t*t)}get n(){return this.size}get length(){return this.size*this.size}get val(){return this.data}fill(t){this.data.fill(t)}subtract(t){this.subtractMatrices(this,t)}subtractMatrices(t,e){const a=this.size,i=a*a,n=t.data,s=e.data,r=this.data;for(let t=0;t<i;t++)r[t]=n[t]-s[t]}negate(){const t=this.data,e=t.length;for(let a=0;a<e;a++)t[a]=-t[a]}clear(){this.data.fill(0)}eye(){const t=this.size;for(let e=0;e<t;e++)this.data[e*(t+1)]=1}copy(t){this.data.set(t.data)}clone(){const t=new mi(this.size,this.type);return t.copy(this),t}transpose(){const t=this.size;for(let e=0;e<t;e++)for(let a=e+1;a<t;a++){const t=this.getCellValue(a,e),i=this.getCellValue(e,a);this.setCellValue(a,e,i),this.setCellValue(e,a,t)}}fromArray(t){this.data.set(t)}toArray(t=new Array(this.length),e=0){return a(this.data,0,t,e,this.length),t}setCellValue(t,e,a){this.data[this.size*e+t]=a}getCellValue(t,e){return this.data[this.size*e+t]}readDiagonal(t){const e=this.size,a=this.data;for(let i=0;i<e;i++)t[i]=a[i*(e+1)]}}function yi(t,e,a,i,n){let s=0;for(let r=0;r<n;r++)s+=t[e+r]*a[i+r];return s}function pi(t,e,a,i,n,s){for(let r=0;r<s;++r)t[e+r]+=a*i[n+r]}function wi(t,e,a){if(0===e)a[0]=1,a[1]=0;else if(Math.abs(e)>Math.abs(t)){const i=t/e,n=1/Math.sqrt(1+i*i);a[0]=n*i,a[1]=n}else{const i=e/t,n=1/Math.sqrt(1+i*i);a[0]=n,a[1]=n*i}}function vi(t,e,a,i,n,s){for(let r=0;r<s;++r){const s=t[e+r],o=t[a+r];t[e+r]=i*s+n*o,t[a+r]=i*o-n*s}}class xi{constructor(t,e,a){this.S=e,this.membership=ce.fixedSize(e.size()),this.dim=t,this.members=new Int32Array(t+1),this.Q=new mi(t,j.Float64),this.Q.eye(),this.R=new mi(t,j.Float64),this.u=new Float64Array(t),this.w=new Float64Array(t),this.r=0,this.cs=new Float64Array(2),this.membership.set(a,!0),this.members[this.r]=a}dimension(){return this.dim}size(){return this.r+1}isMember(t){return this.membership.get(t)}anyMember(){return this.members[this.r]}globalIndex(t){return this.members[t]}ind(t,e){return t*this.dim+e}origin(){return this.members[this.r]}appendColumn(){const t=this.dim,e=this.u,a=this.Q.data,i=this.R.data,n=this.cs,s=this.r*t;for(let n=0;n<t;++n)i[s+n]=yi(a,n*t,e,0,t);for(let e=t-1;e>this.r;--e){wi(i[s+e-1],i[s+e],n);const r=n[0],o=n[1];i[s+e-1]=r*i[s+e-1]+o*i[s+e],vi(a,(e-1)*t,e*t,r,o,t)}}add(t){let e=this.origin();const a=this.dim,i=this.u,n=this.S;for(let s=0;s<a;++s)i[s]=n.coord(t,s)-n.coord(e,s);this.appendColumn(),this.membership.set(t,!0),this.members[this.r+1]=this.members[this.r],this.members[this.r]=t,++this.r}shortestVectorToSpan(t,e){const a=this.origin(),i=this.dim,n=this.S;for(let s=0;s<i;++s)e[s]=n.coord(a,s)-t[s];const s=this.Q.data,r=this.r;for(let t=0;t<r;++t){const a=t*i;pi(e,0,-yi(e,0,s,a,i),s,a,i)}return yi(e,0,e,0,i)}representationError(){const t=this.size(),e=new Float64Array(t),a=this.dim,i=new Float64Array(a);let n=0;for(let s=0;s<t;++s){for(let t=0;t<a;++t)i[t]=this.S.coord(this.globalIndex(s),t);this.findAffineCoefficients(i,e);let r=Math.abs(e[s]-1);r>n&&(n=r);for(let t=0;t<s;++t)r=Math.abs(e[t]),r>n&&(n=r);for(let a=s+1;a<t;++a)r=Math.abs(e[a]),r>n&&(n=r)}return n}findAffineCoefficients(t,e){let a=this.origin();const i=this.dim,n=this.u;for(let e=0;e<i;++e)n[e]=t[e]-this.S.coord(a,e);const s=this.w,r=this.Q.data;for(let t=0;t<i;++t)s[t]=yi(r,t*i,n,0,i);let o=1;const c=this.R.data,h=this.r;for(let t=h-1;t>=0;--t){const a=t*i;for(let a=t+1;a<h;++a)s[t]-=e[a]*c[a*i+t];const n=s[t]/c[a+t];e[t]=n,o-=n}e[h]=o}hessenberg_clear(t){let e=t;const a=this.R.data,i=this.Q.data,n=this.dim,s=this.cs,r=this.r;for(;e<r;++e){const t=e*n;wi(a[t+e],a[t+e+1],s);const o=s[0],c=s[1];a[t+e]=o*a[t+e]+c*a[t+e+1];for(let t=e+1;t<r;++t){const i=t*n,s=a[i+e],r=a[i+e+1];a[i+e]=o*s+c*r,a[i+e+1]=o*r-c*s}vi(i,t,t+n,o,c,n)}}special_rank_1_update(){const t=this.dim,e=this.w,a=this.u,i=this.Q.data,n=this.R.data,s=this.cs,r=this.r;for(let n=0;n<t;++n)e[n]=yi(i,n*t,a,0,t);for(let a=t-1;a>0;--a){wi(e[a-1],e[a],s);const o=s[0],c=s[1];e[a-1]=o*e[a-1]+c*e[a];const h=(a-1)*t;n[h+a]=-c*n[h+a-1],n[h+a-1]*=o;for(let e=a;e<r;++e){const i=e*t,s=n[i+a-1],r=n[i+a];n[i+a-1]=o*s+c*r,n[i+a]=o*r-c*s}vi(i,h,h+t,o,c,t)}const o=e[0];for(let e=0;e<r;++e)n[e*t]+=o;this.hessenberg_clear(0)}remove(t){if(this.membership.clear(this.globalIndex(t)),t===this.r){let t=this.origin(),e=this.globalIndex(this.r-1);const a=this.dim,i=this.S,n=this.u;for(let s=0;s<a;++s)n[s]=i.coord(t,s)-i.coord(e,s);--this.r,this.special_rank_1_update()}else{const e=this.R.data,a=this.dim,i=this.members,n=t*a,s=(t+1)*a,r=this.r*a;e.copyWithin(n,s,r);for(let e=t+1;e<this.r;++e)i[e-1]=i[e];i[this.r-1]=i[this.r],--this.r,this.hessenberg_clear(t)}}}class Ai{iteration=0;distToAff=0;distToAffSquare=0;__squaredRadius=0;__radius=0;stopper=0;constructor(t){this.S=t,this.__size=this.S.size();const e=this.S.dimension();this.dim=e;const a=new ArrayBuffer(8*(4*e+1));this.__center=new Float64Array(a,0,e),this.centerToAff=new Float64Array(a,8*e,e),this.centerToPoint=new Float64Array(a,16*e,e),this.lambdas=new Float64Array(a,24*e,e+1),this.__support=this.initBall(),this.compute()}isEmpty(){return 0===this.__size}radius(){return this.__radius}center(){return this.__center}get support(){return this.__support}size(){return this.__size}initBall(){let t,e;const a=this.dim,i=this.__center,n=this.S;for(t=0;t<a;++t)i[t]=n.coord(0,t);this.__squaredRadius=0;let s=0;const r=n.size();for(e=1;e<r;++e){let r=0;for(t=0;t<a;++t)r+=bi(n.coord(e,t)-i[t]);r>=this.__squaredRadius&&(this.__squaredRadius=r,s=e)}return this.__radius=Math.sqrt(this.__squaredRadius),new xi(this.dim,n,s)}computeDistToAff(){this.distToAffSquare=this.__support.shortestVectorToSpan(this.__center,this.centerToAff),this.distToAff=Math.sqrt(this.distToAffSquare)}updateRadius(){const t=this.__support.anyMember();this.__squaredRadius=0;const e=this.dim,a=this.__center,i=this.S;for(let n=0;n<e;++n)this.__squaredRadius+=bi(i.coord(t,n)-a[n]);this.__radius=Math.sqrt(this.__squaredRadius)}compute(){const t=this.__center,e=this.__support,a=this.dim,i=this.centerToAff;for(this.iteration=0;this.iteration<1e4;this.iteration++){for(this.computeDistToAff();this.distToAff<=1e-14*this.__radius||e.size()===a+1;){if(!this.successfulDrop())return;this.computeDistToAff()}const n=this.findStopFraction();if(this.stopper>=0){for(let e=0;e<a;++e)t[e]+=n*i[e];this.updateRadius(),e.add(this.stopper)}else{for(let e=0;e<a;++e)t[e]+=i[e];if(this.updateRadius(),!this.successfulDrop())return}}}successfulDrop(){const t=this.lambdas,e=this.__support;e.findAffineCoefficients(this.__center,t);let a=0,i=1;const n=e.size();for(let e=0;e<n;++e){const n=t[e];n<i&&(i=n,a=e)}return i<=0&&(e.remove(a),!0)}findStopFraction(){let t,e,a=1;this.stopper=-1;const i=this.dim,n=this.__center,s=this.S,r=this.__support,o=this.centerToPoint,c=this.centerToAff,h=this.distToAffSquare,d=this.__squaredRadius,_=this.__size,l=1e-14*this.__radius*this.distToAff;for(e=0;e<_;++e){if(r.isMember(e))continue;for(t=0;t<i;++t)o[t]=s.coord(e,t)-n[t];const _=gi(c,o,i);if(h-_<l)continue;const f=(d-gi(o,o,i))/2/(h-_);f>0&&f<a&&(a=f,this.stopper=e)}return a}toString(){let t="Miniball [";if(this.isEmpty())t+="isEmpty=true";else{t+="center=(";for(let e=0;e<this.dim;++e)t+=this.__center[e],e<this.dim-1&&(t+=", ");t+=`), radius=${this.__radius}, squaredRadius=${this.__squaredRadius}`}return t+="]",t}}class ki{constructor(t,e,a){this.__data=a,this.__size=t,this.__dimensions=e}size(){return this.__size}dimension(){return this.__dimensions}coord(t,e){return this.__data[t*this.__dimensions+e]}}function zi(t,e,a){return Math.sqrt(t*t+e*e+a*a)}const ji=new Float64Array(3);function Ui(t,e,a,i,n,s,r,o,c){return(e*s-a*n)*r+(a*i-t*s)*o+(t*n-e*i)*c<0?-1:1}function Ei(t,e,a,i,n){let s,r,o,c,h,d;if(a<0){const i=1/(1-a),n=t*e*i;s=1-t*t*i,r=-n,o=t,c=n,h=e*e*i-1,d=-e}else{const i=1/(1+a),n=-t*e*i;s=1-t*t*i,r=n,o=-t,c=n,h=1-e*e*i,d=-e}const _=Ui(t,e,a,s,r,o,c,h,d),l=4*i;n[l]=s,n[l+1]=r,n[l+2]=o,n[l+3]=_}const Fi=function(t,e,a,i,n){t[e]+=a,t[e+1]+=i,t[e+2]+=n};function Ii(t,e,a,i,n,s){return t*i+e*n+a*s}let Ci=0;class Bi{#K=Ci++;get id(){return this.#K}name="";attributes=[];index=null;bounding_box=new Float32Array(6);bounding_sphere=new Float32Array(4);flags=1;#X=0;get version(){return this.#X}set needsUpdate(t){t&&this.#X++}setFlag(t){this.flags|=t}clearFlag(t){this.flags&=~t}writeFlag(t,e){e?this.setFlag(t):this.clearFlag(t)}getFlag(t){return(this.flags&t)===t}equals(t){return this===t||this.name===t.name&&((e=this.index)===(a=t.index)||void 0!==e&&void 0!==a&&null!==e&&null!==a&&typeof e==typeof a&&e.equals(a))&&Yt(this.attributes,t.attributes);var e,a}hash(){return U(H(this.name),void 0===(t=this.index)?0:t.hash(),Y(this.attributes,D));var t}getAttribute(t){const e=this.attributes,a=e.length;for(let i=0;i<a;i++){const a=e[i];if(a.spec.name===t)return a}}hasAttribute(t){return void 0!==this.getAttribute(t)}setAttribute(t){this.hasAttribute(t.spec.name)&&this.removeAttribute(t.spec.name),this.addAttribute(t)}addAttribute(t){this.attributes.push(t)}removeAttribute(t){const e=this.attributes,a=e.length;for(let i=0;i<a;i++){const a=e[i];if(a.spec.name===t)return e.splice(i,1),a}}getVertexCount(){const t=this.attributes;return 0===t.length?0:t[0].count}getIndexCount(){const t=this.index;return null!=t?t.count:this.getVertexCount()}getPrimitiveCount(){return this.getIndexCount()/3}ensureIndex(){null===this.index&&this.buildIndex()}buildIndex(){const t=this.getVertexCount(),e=new Uint32Array(t);for(let a=0;a<t;a++)e[a]=a;this.index=ui.from(e,1,je)}ensureBounds(){this.getFlag(1)&&this.computeBoundingShapes()}computeBoundingSphereFromBox(){const t=this.bounding_box,e=t[0],a=t[3],i=t[1],n=t[4],s=t[2],r=t[5];this.bounding_sphere[0]=.5*(e+a),this.bounding_sphere[1]=.5*(i+n),this.bounding_sphere[2]=.5*(s+r),this.bounding_sphere[3]=.5*function(t,e,a,i,n,s){return zi(i-t,n-e,s-a)}(e,i,s,a,n,r)}computeBoundingSphere(){const t=this.getAttribute(Ue),e=new ki(t.count,3,t.data),a=new Ai(e),i=a.center();this.bounding_sphere[0]=i[0],this.bounding_sphere[1]=i[1],this.bounding_sphere[2]=i[2],this.bounding_sphere[3]=a.radius()}computeBoundingShapes(){this.computeBoundingBox(),this.computeBoundingSphereFromBox(),this.clearFlag(1)}computeBoundingBox(){const t=this.getAttribute(Ue);rt(this.bounding_box,t.data,t.count*t.spec.itemSize),this.clearFlag(1)}ensureNormals(){void 0===this.getAttribute(Ee)&&this.computeNormals()}computeNormals(){const t=this.getVertexCount(),e=this.getAttribute(Ue);let i=this.getAttribute(Ee);void 0===i?(i=ui.from(new Float32Array(3*t),3,Ee),this.addAttribute(i)):i.data.fill(0,0,3*t);const n=this.index;null===n?function(t,e,i){for(let n=0;n<i;n+=3){const i=n,s=n+1,r=n+2;ci(ji,0,i,s,r,t),a(ji,0,e,3*i,3),a(ji,0,e,3*s,3),a(ji,0,e,3*r,3)}}(e.data,i.data,t):_i(e.data,i.data,n.data)}#W(){if(!this.hasAttribute(Fe)){const t=this.getVertexCount();this.addAttribute(ui.from(new Float32Array(4*t),4,Fe))}return this.getAttribute(Fe)}#J(){const t=this.index,e=this.getAttribute(Ue),a=this.getAttribute(Ee),i=this.getAttribute(Ie);if(null===t||void 0===e||void 0===a||void 0===i)throw new Error(" .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=e.data,s=i.data,r=a.data,o=this.#W().data,c=e.count;!function(t,e,a,i,n,s,r){const o=new Float32Array(3*a),c=new Float32Array(3*a);for(let a=0;a<t;a+=3){const t=e[a],s=e[a+1],r=e[a+2],h=t<<1,d=i[h],_=i[h+1],l=s<<1,f=r<<1,u=i[l]-d,b=i[l+1]-_,g=i[f]-d,m=i[f+1]-_,y=u*m-g*b;if(0===y)continue;const p=1/y,w=h+t,v=n[w],x=n[w+1],A=n[w+2],k=l+s,z=f+r,j=n[k]-v,U=n[k+1]-x,E=n[k+2]-A,F=n[z]-v,I=n[z+1]-x,C=n[z+2]-A,B=(j*m-F*b)*p,M=(U*m-I*b)*p,S=(E*m-C*b)*p,N=(F*u-j*g)*p,V=(I*u-U*g)*p,R=(C*u-E*g)*p;Fi(o,w,B,M,S),Fi(o,k,B,M,S),Fi(o,z,B,M,S),Fi(c,w,N,V,R),Fi(c,k,N,V,R),Fi(c,z,N,V,R)}for(let t=0;t<a;t++){const e=3*t,a=s[e],i=s[e+1],n=s[e+2],h=o[e],d=o[e+1],_=o[e+2];if(0===h&&0===d&&0===_){Ei(a,i,n,t,r);continue}const l=c[e],f=c[e+1],u=c[e+2],b=Ii(a,i,n,h,d,_);let g=h-a*b,m=d-i*b,y=_-n*b;const p=1/zi(g,m,y);g*=p,m*=p,y*=p;const w=Ui(a,i,n,g,m,y,l,f,u),v=t<<2;r[v]=g,r[v+1]=m,r[v+2]=y,r[v+3]=w}}(t.count,t.data,c,s,n,r,o)}#Q(){const t=this.getAttribute(Ee),e=this.#W().data,a=t.data,i=this.getVertexCount();for(let t=0;t<i;t++){const i=3*t;Ei(a[i],a[i+1],a[i+2],t,e)}}ensureTangents(){void 0===this.getAttribute(Fe)&&this.computeTangents()}computeTangents(){this.ensureNormals(),this.hasAttribute(Ie)&&this.hasAttribute(Ue)&&this.hasAttribute(Ee)?this.#J():this.#Q()}copy(t){this.name=t.name,null!==t.index?this.index=t.index.clone():this.index=null,this.attributes=t.attributes.map(t=>t.clone()),this.flags=t.flags,this.bounding_sphere.set(t.bounding_sphere),this.bounding_box.set(t.bounding_box)}clone(){const t=new Bi;return t.copy(this),t}update(){this.ensureBounds()}get memory_usage_bytes(){let t=0;null!==this.index&&(t+=this.index.memory_usage_bytes);for(const e of this.attributes)t+=e.memory_usage_bytes;return t}}Bi.prototype.isGeometry=!0,self.Lib={build_bvh(t,e){const a=new b;return function(t,e,a){!function(t,e,a,i,n,s,r){t.setLeafCount(e),t.initialize_structure();for(let i=0;i<e;i++)ka(ja,0,a,0,3,!1,r,i),za(t,i,ja,0,1,2);t.build()}(t,a.length/3,e,0,0,0,a)}(a,t,e),a},Sampler2D:si,BufferedGeometryArraysBuilder:li,tensionOptimizeUV:function(t,e,a,i=3){const n=new Ra;null==a?function(t,e){const a=e.length/9,i=new Uint32Array(3*a);for(let t=0;t<i.length;t++)i[t]=t;Oa(t,i,e,void 0)}(n,t):Oa(n,a,t);const s=t.length/3;for(let a=0;a<i;a++)t:for(let a=0;a<s;a++){const i=n.vertex_read_edge(a);if(i===Na)continue;const s=3*a,r=t[s],o=t[s+1],c=t[s+2];let h=0,d=0,_=0,l=i;do{if(Xa(n,l))continue t;const i=Ka(n,l,a),s=3*i,f=r-t[s],u=o-t[s+1],b=c-t[s+2],g=f*f+u*u+b*b;if(0!==g){const t=1/g,a=2*i;h+=e[a]*t,d+=e[a+1]*t,_+=t}l=n.edge_read_vertex1(l)===a?n.edge_read_v1_disk_next(l):n.edge_read_v2_disk_next(l)}while(l!==i);if(0===_)continue;const f=h/_,u=d/_,b=2*a;e[b]=f,e[b+1]=u}},sampler2d_channel_compute_min:function(t,e=0){const a=t.itemSize,i=t.data,n=i.length;if(0===n)return;let s=i[e],r=e;for(let t=e+a;t<n;t+=a){const e=i[t];s>e&&(s=e,r=t)}const o=t.width,c=r/a|0;return{index:r,value:s,x:c%o,y:c/o|0}},sampler2d_channel_compute_max:function(t,e=0){const a=t.itemSize,i=t.data,n=i.length;if(0===n)return;let s=i[e],r=e;for(let t=e+a;t<n;t+=a){const e=i[t];s<e&&(s=e,r=t)}const o=t.width,c=r/a|0;return{index:r,value:s,x:c%o,y:c/o|0}},tile_geometry_to_meshlets:function(t,e=""){const a=new Bi;return a.name=e,a.addAttribute(ui.from(t.vertices,3,Ue)),a.addAttribute(ui.from(t.normals,3,Ee)),a.addAttribute(ui.from(t.uvs,2,Ie)),a.index=ui.from(t.indices,1,je),function(t,e=new aa){return t.ensureBounds(),t.computeBoundingSphereFromBox(),e.name=t.name,e.primitive_count=t.getPrimitiveCount(),e.bounding_box.set(t.bounding_box),e.bounding_sphere.set(t.bounding_sphere),e.meshlets.build(t),e.meshlets.compress(),e.bvh=va(e.meshlets,e.primitive_count,t.bounding_box),e}(a)},meshlet_geometry_to_bytes:function(t){const e=new x;return xa.serialize(e,t),e.trim(),e.data}};