@neurodyn/ar 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ar.chunk.0c14f05b.min.js +2 -0
- package/dist/{ar.chunk.a9783e67.min.js → ar.chunk.5e6f51e4.min.js} +3 -3
- package/dist/ar.chunk.849c4685.min.js +983 -0
- package/dist/{ar.chunk.c648f878.min.js.LICENSE.txt → ar.chunk.849c4685.min.js.LICENSE.txt} +6 -0
- package/dist/{ar.chunk.81e6bca7.min.js → ar.chunk.86f5a723.min.js} +1 -1
- package/dist/{ar.chunk.bf754a7e.min.js → ar.chunk.c6ed8faf.min.js} +3 -3
- package/dist/ar.embed.min.js +1 -1
- package/dist/ar.global.min.js +1 -1
- package/package.json +3 -3
- package/dist/ar.chunk.c648f878.min.js +0 -606
- package/dist/ar.chunk.d610f329.min.js +0 -2
- package/dist/static/assets/basis_transcoder.23b549c9.js +0 -9
- package/dist/static/assets/draco_decoder.08679b61.js +0 -1
- package/dist/static/assets/draco_wasm_wrapper.da788994.js +0 -1
- package/dist/static/assets/draco_wasm_wrapper.efc72384.js +0 -1
- package/dist/static/wasm/1170806b.module.wasm +0 -0
- package/dist/static/wasm/a2169f50.module.wasm +0 -0
- package/dist/static/wasm/a53898c5.module.wasm +0 -0
- /package/dist/{ar.chunk.d610f329.min.js.LICENSE.txt → ar.chunk.0c14f05b.min.js.LICENSE.txt} +0 -0
- /package/dist/{ar.chunk.bf754a7e.min.js.LICENSE.txt → ar.chunk.c6ed8faf.min.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,983 @@
|
|
|
1
|
+
/*! For license information please see ar.chunk.849c4685.min.js.LICENSE.txt */
|
|
2
|
+
(self.webpackChunk_neurodyn_ar=self.webpackChunk_neurodyn_ar||[]).push([["338"],{4904(e){"use strict";var t={single_source_shortest_paths:function(e,i,r){var n,a,s,o,l,h,c,u={},d={};d[i]=0;var p=t.PriorityQueue.make();for(p.push(i,0);!p.empty();)for(s in a=(n=p.pop()).value,o=n.cost,l=e[a]||{})l.hasOwnProperty(s)&&(h=o+l[s],c=d[s],(void 0===d[s]||c>h)&&(d[s]=h,p.push(s,h),u[s]=a));if(void 0!==r&&void 0===d[r])throw Error("Could not find a path from "+i+" to "+r+".");return u},extract_shortest_path_from_predecessor_list:function(e,t){for(var i=[],r=t;r;)i.push(r),e[r],r=e[r];return i.reverse(),i},find_path:function(e,i,r){var n=t.single_source_shortest_paths(e,i,r);return t.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(e){var i,r=t.PriorityQueue,n={};for(i in e=e||{},r)r.hasOwnProperty(i)&&(n[i]=r[i]);return n.queue=[],n.sorter=e.sorter||r.default_sorter,n},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){this.queue.push({value:e,cost:t}),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t},8428(e,t,i){"use strict";i.d(t,{A:()=>r});let r=(0,i(8112).A)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])},3946(e,t,i){let r=i(9972),n=i(9908),a=i(7782),s=i(4783);function o(e,t,i,a,s){let o=[].slice.call(arguments,1),l=o.length,h="function"==typeof o[l-1];if(!h&&!r())throw Error("Callback required as last argument");if(h){if(l<2)throw Error("Too few arguments provided");2===l?(s=i,i=t,t=a=void 0):3===l&&(t.getContext&&void 0===s?(s=a,a=void 0):(s=a,a=i,i=t,t=void 0))}else{if(l<1)throw Error("Too few arguments provided");return 1===l?(i=t,t=a=void 0):2!==l||t.getContext||(a=i,i=t,t=void 0),new Promise(function(r,s){try{let s=n.create(i,a);r(e(s,t,a))}catch(e){s(e)}})}try{let r=n.create(i,a);s(null,e(r,t,a))}catch(e){s(e)}}t.create=n.create,t.toCanvas=o.bind(null,a.render),t.toDataURL=o.bind(null,a.renderToDataURL),t.toString=o.bind(null,function(e,t,i){return s.render(e,i)})},9972(e){e.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},5734(e,t,i){let r=i(4913).getSymbolSize;t.getRowColCoords=function(e){if(1===e)return[];let t=Math.floor(e/7)+2,i=r(e),n=145===i?26:2*Math.ceil((i-13)/(2*t-2)),a=[i-7];for(let e=1;e<t-1;e++)a[e]=a[e-1]-n;return a.push(6),a.reverse()},t.getPositions=function(e){let i=[],r=t.getRowColCoords(e),n=r.length;for(let e=0;e<n;e++)for(let t=0;t<n;t++)(0!==e||0!==t)&&(0!==e||t!==n-1)&&(e!==n-1||0!==t)&&i.push([r[e],r[t]]);return i}},8682(e,t,i){let r=i(989),n=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function a(e){this.mode=r.ALPHANUMERIC,this.data=e}a.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let i=45*n.indexOf(this.data[t]);i+=n.indexOf(this.data[t+1]),e.put(i,11)}this.data.length%2&&e.put(n.indexOf(this.data[t]),6)},e.exports=a},3702(e){function t(){this.buffer=[],this.length=0}t.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let i=0;i<t;i++)this.putBit((e>>>t-i-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},e.exports=t},2165(e){function t(e){if(!e||e<1)throw Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}t.prototype.set=function(e,t,i,r){let n=e*this.size+t;this.data[n]=i,r&&(this.reservedBit[n]=!0)},t.prototype.get=function(e,t){return this.data[e*this.size+t]},t.prototype.xor=function(e,t,i){this.data[e*this.size+t]^=i},t.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},e.exports=t},9481(e,t,i){let r=i(989);function n(e){this.mode=r.BYTE,"string"==typeof e?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}n.getBitsLength=function(e){return 8*e},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(e){for(let t=0,i=this.data.length;t<i;t++)e.put(this.data[t],8)},e.exports=n},6781(e,t,i){let r=i(4752),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],a=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];t.getBlocksCount=function(e,t){switch(t){case r.L:return n[(e-1)*4+0];case r.M:return n[(e-1)*4+1];case r.Q:return n[(e-1)*4+2];case r.H:return n[(e-1)*4+3];default:return}},t.getTotalCodewordsCount=function(e,t){switch(t){case r.L:return a[(e-1)*4+0];case r.M:return a[(e-1)*4+1];case r.Q:return a[(e-1)*4+2];case r.H:return a[(e-1)*4+3];default:return}}},4752(e,t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},t.from=function(e,i){if(t.isValid(e))return e;try{if("string"!=typeof e)throw Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw Error("Unknown EC Level: "+e)}}catch(e){return i}}},9261(e,t,i){let r=i(4913).getSymbolSize;t.getPositions=function(e){let t=r(e);return[[0,0],[t-7,0],[0,t-7]]}},6174(e,t,i){let r=i(4913),n=r.getBCHDigit(1335);t.getEncodedBits=function(e,t){let i=e.bit<<3|t,a=i<<10;for(;r.getBCHDigit(a)-n>=0;)a^=1335<<r.getBCHDigit(a)-n;return(i<<10|a)^21522}},8366(e,t){let i=new Uint8Array(512),r=new Uint8Array(256),n=1;for(let e=0;e<255;e++)i[e]=n,r[n]=e,256&(n<<=1)&&(n^=285);for(let e=255;e<512;e++)i[e]=i[e-255];t.log=function(e){if(e<1)throw Error("log("+e+")");return r[e]},t.exp=function(e){return i[e]},t.mul=function(e,t){return 0===e||0===t?0:i[r[e]+r[t]]}},9712(e,t,i){let r=i(989),n=i(4913);function a(e){this.mode=r.KANJI,this.data=e}a.getBitsLength=function(e){return 13*e},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let i=n.toSJIS(this.data[t]);if(i>=33088&&i<=40956)i-=33088;else if(i>=57408&&i<=60351)i-=49472;else throw Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");i=(i>>>8&255)*192+(255&i),e.put(i,13)}},e.exports=a},7281(e,t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};t.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){let t=e.size,i=0,r=0,n=0,a=null,s=null;for(let o=0;o<t;o++){r=n=0,a=s=null;for(let l=0;l<t;l++){let t=e.get(o,l);t===a?r++:(r>=5&&(i+=3+(r-5)),a=t,r=1),(t=e.get(l,o))===s?n++:(n>=5&&(i+=3+(n-5)),s=t,n=1)}r>=5&&(i+=3+(r-5)),n>=5&&(i+=3+(n-5))}return i},t.getPenaltyN2=function(e){let t=e.size,i=0;for(let r=0;r<t-1;r++)for(let n=0;n<t-1;n++){let t=e.get(r,n)+e.get(r,n+1)+e.get(r+1,n)+e.get(r+1,n+1);(4===t||0===t)&&i++}return 3*i},t.getPenaltyN3=function(e){let t=e.size,i=0,r=0,n=0;for(let a=0;a<t;a++){r=n=0;for(let s=0;s<t;s++)r=r<<1&2047|e.get(a,s),s>=10&&(1488===r||93===r)&&i++,n=n<<1&2047|e.get(s,a),s>=10&&(1488===n||93===n)&&i++}return 40*i},t.getPenaltyN4=function(e){let t=0,i=e.data.length;for(let r=0;r<i;r++)t+=e.data[r];return 10*Math.abs(Math.ceil(100*t/i/5)-10)},t.applyMask=function(e,i){let r=i.size;for(let n=0;n<r;n++)for(let a=0;a<r;a++)i.isReserved(a,n)||i.xor(a,n,function(e,i,r){switch(e){case t.Patterns.PATTERN000:return(i+r)%2==0;case t.Patterns.PATTERN001:return i%2==0;case t.Patterns.PATTERN010:return r%3==0;case t.Patterns.PATTERN011:return(i+r)%3==0;case t.Patterns.PATTERN100:return(Math.floor(i/2)+Math.floor(r/3))%2==0;case t.Patterns.PATTERN101:return i*r%2+i*r%3==0;case t.Patterns.PATTERN110:return(i*r%2+i*r%3)%2==0;case t.Patterns.PATTERN111:return(i*r%3+(i+r)%2)%2==0;default:throw Error("bad maskPattern:"+e)}}(e,a,n))},t.getBestMask=function(e,i){let r=Object.keys(t.Patterns).length,n=0,a=1/0;for(let s=0;s<r;s++){i(s),t.applyMask(s,e);let r=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(s,e),r<a&&(a=r,n=s)}return n}},989(e,t,i){let r=i(3673),n=i(863);t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(e,t){if(!e.ccBits)throw Error("Invalid mode: "+e);if(!r.isValid(t))throw Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]},t.getBestModeForData=function(e){return n.testNumeric(e)?t.NUMERIC:n.testAlphanumeric(e)?t.ALPHANUMERIC:n.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(e){if(e&&e.id)return e.id;throw Error("Invalid mode")},t.isValid=function(e){return e&&e.bit&&e.ccBits},t.from=function(e,i){if(t.isValid(e))return e;try{if("string"!=typeof e)throw Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw Error("Unknown mode: "+e)}}catch(e){return i}}},1412(e,t,i){let r=i(989);function n(e){this.mode=r.NUMERIC,this.data=e.toString()}n.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(e){let t,i;for(t=0;t+3<=this.data.length;t+=3)i=parseInt(this.data.substr(t,3),10),e.put(i,10);let r=this.data.length-t;r>0&&(i=parseInt(this.data.substr(t),10),e.put(i,3*r+1))},e.exports=n},2576(e,t,i){let r=i(8366);t.mul=function(e,t){let i=new Uint8Array(e.length+t.length-1);for(let n=0;n<e.length;n++)for(let a=0;a<t.length;a++)i[n+a]^=r.mul(e[n],t[a]);return i},t.mod=function(e,t){let i=new Uint8Array(e);for(;i.length-t.length>=0;){let e=i[0];for(let n=0;n<t.length;n++)i[n]^=r.mul(t[n],e);let n=0;for(;n<i.length&&0===i[n];)n++;i=i.slice(n)}return i},t.generateECPolynomial=function(e){let i=new Uint8Array([1]);for(let n=0;n<e;n++)i=t.mul(i,new Uint8Array([1,r.exp(n)]));return i}},9908(e,t,i){let r=i(4913),n=i(4752),a=i(3702),s=i(2165),o=i(5734),l=i(9261),h=i(7281),c=i(6781),u=i(3025),d=i(3492),p=i(6174),A=i(989),f=i(8356);function g(e,t,i){let r,n,a=e.size,s=p.getEncodedBits(t,i);for(r=0;r<15;r++)n=(s>>r&1)==1,r<6?e.set(r,8,n,!0):r<8?e.set(r+1,8,n,!0):e.set(a-15+r,8,n,!0),r<8?e.set(8,a-r-1,n,!0):r<9?e.set(8,15-r-1+1,n,!0):e.set(8,15-r-1,n,!0);e.set(a-8,8,1,!0)}t.create=function(e,t){let i,p;if(void 0===e||""===e)throw Error("No input text");let m=n.M;return void 0!==t&&(m=n.from(t.errorCorrectionLevel,n.M),i=d.from(t.version),p=h.from(t.maskPattern),t.toSJISFunc&&r.setToSJISFunction(t.toSJISFunc)),function(e,t,i,n){let p;if(Array.isArray(e))p=f.fromArray(e);else if("string"==typeof e){let r=t;if(!r){let t=f.rawSplit(e);r=d.getBestVersionForData(t,i)}p=f.fromString(e,r||40)}else throw Error("Invalid data");let m=d.getBestVersionForData(p,i);if(!m)throw Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<m)throw Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+m+".\n")}else t=m;let v=function(e,t,i){let n=new a;i.forEach(function(t){n.put(t.mode.bit,4),n.put(t.getLength(),A.getCharCountIndicator(t.mode,e)),t.write(n)});let s=(r.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,t))*8;for(n.getLengthInBits()+4<=s&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(0);let o=(s-n.getLengthInBits())/8;for(let e=0;e<o;e++)n.put(e%2?17:236,8);return function(e,t,i){let n,a,s=r.getSymbolTotalCodewords(t),o=s-c.getTotalCodewordsCount(t,i),l=c.getBlocksCount(t,i),h=s%l,d=l-h,p=Math.floor(s/l),A=Math.floor(o/l),f=A+1,g=p-A,m=new u(g),v=0,b=Array(l),y=Array(l),x=0,_=new Uint8Array(e.buffer);for(let e=0;e<l;e++){let t=e<d?A:f;b[e]=_.slice(v,v+t),y[e]=m.encode(b[e]),v+=t,x=Math.max(x,t)}let E=new Uint8Array(s),S=0;for(n=0;n<x;n++)for(a=0;a<l;a++)n<b[a].length&&(E[S++]=b[a][n]);for(n=0;n<g;n++)for(a=0;a<l;a++)E[S++]=y[a][n];return E}(n,e,t)}(t,i,p),b=new s(r.getSymbolSize(t));!function(e,t){let i=e.size,r=l.getPositions(t);for(let t=0;t<r.length;t++){let n=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(n+t<=-1)&&!(i<=n+t))for(let r=-1;r<=7;r++)a+r<=-1||i<=a+r||(t>=0&&t<=6&&(0===r||6===r)||r>=0&&r<=6&&(0===t||6===t)||t>=2&&t<=4&&r>=2&&r<=4?e.set(n+t,a+r,!0,!0):e.set(n+t,a+r,!1,!0))}}(b,t);let y=b.size;for(let e=8;e<y-8;e++){let t=e%2==0;b.set(e,6,t,!0),b.set(6,e,t,!0)}return!function(e,t){let i=o.getPositions(t);for(let t=0;t<i.length;t++){let r=i[t][0],n=i[t][1];for(let t=-2;t<=2;t++)for(let i=-2;i<=2;i++)-2===t||2===t||-2===i||2===i||0===t&&0===i?e.set(r+t,n+i,!0,!0):e.set(r+t,n+i,!1,!0)}}(b,t),g(b,i,0),t>=7&&function(e,t){let i,r,n,a=e.size,s=d.getEncodedBits(t);for(let t=0;t<18;t++)i=Math.floor(t/3),r=t%3+a-8-3,n=(s>>t&1)==1,e.set(i,r,n,!0),e.set(r,i,n,!0)}(b,t),!function(e,t){let i=e.size,r=-1,n=i-1,a=7,s=0;for(let o=i-1;o>0;o-=2)for(6===o&&o--;;){for(let i=0;i<2;i++)if(!e.isReserved(n,o-i)){let r=!1;s<t.length&&(r=(t[s]>>>a&1)==1),e.set(n,o-i,r),-1==--a&&(s++,a=7)}if((n+=r)<0||i<=n){n-=r,r=-r;break}}}(b,v),isNaN(n)&&(n=h.getBestMask(b,g.bind(null,b,i))),h.applyMask(n,b),g(b,i,n),{modules:b,version:t,errorCorrectionLevel:i,maskPattern:n,segments:p}}(e,i,m,p)}},3025(e,t,i){let r=i(2576);function n(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}n.prototype.initialize=function(e){this.degree=e,this.genPoly=r.generateECPolynomial(this.degree)},n.prototype.encode=function(e){if(!this.genPoly)throw Error("Encoder not initialized");let t=new Uint8Array(e.length+this.degree);t.set(e);let i=r.mod(t,this.genPoly),n=this.degree-i.length;if(n>0){let e=new Uint8Array(this.degree);return e.set(i,n),e}return i},e.exports=n},863(e,t){let i="[0-9]+",r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+",n="(?:(?![A-Z0-9 $%*+\\-./:]|"+(r=r.replace(/u/g,"\\u"))+")(?:.|[\r\n]))+";t.KANJI=RegExp(r,"g"),t.BYTE_KANJI=RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),t.BYTE=RegExp(n,"g"),t.NUMERIC=RegExp(i,"g"),t.ALPHANUMERIC=RegExp("[A-Z $%*+\\-./:]+","g");let a=RegExp("^"+r+"$"),s=RegExp("^"+i+"$"),o=RegExp("^[A-Z0-9 $%*+\\-./:]+$");t.testKanji=function(e){return a.test(e)},t.testNumeric=function(e){return s.test(e)},t.testAlphanumeric=function(e){return o.test(e)}},8356(e,t,i){let r=i(989),n=i(1412),a=i(8682),s=i(9481),o=i(9712),l=i(863),h=i(4913),c=i(4904);function u(e){return unescape(encodeURIComponent(e)).length}function d(e,t,i){let r,n=[];for(;null!==(r=e.exec(i));)n.push({data:r[0],index:r.index,mode:t,length:r[0].length});return n}function p(e){let t,i,n=d(l.NUMERIC,r.NUMERIC,e),a=d(l.ALPHANUMERIC,r.ALPHANUMERIC,e);return h.isKanjiModeEnabled()?(t=d(l.BYTE,r.BYTE,e),i=d(l.KANJI,r.KANJI,e)):(t=d(l.BYTE_KANJI,r.BYTE,e),i=[]),n.concat(a,t,i).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function A(e,t){switch(t){case r.NUMERIC:return n.getBitsLength(e);case r.ALPHANUMERIC:return a.getBitsLength(e);case r.KANJI:return o.getBitsLength(e);case r.BYTE:return s.getBitsLength(e)}}function f(e,t){let i,l=r.getBestModeForData(e);if((i=r.from(t,l))!==r.BYTE&&i.bit<l.bit)throw Error('"'+e+'" cannot be encoded with mode '+r.toString(i)+".\n Suggested mode is: "+r.toString(l));switch(i===r.KANJI&&!h.isKanjiModeEnabled()&&(i=r.BYTE),i){case r.NUMERIC:return new n(e);case r.ALPHANUMERIC:return new a(e);case r.KANJI:return new o(e);case r.BYTE:return new s(e)}}t.fromArray=function(e){return e.reduce(function(e,t){return"string"==typeof t?e.push(f(t,null)):t.data&&e.push(f(t.data,t.mode)),e},[])},t.fromString=function(e,i){let n=function(e,t){let i={},n={start:{}},a=["start"];for(let s=0;s<e.length;s++){let o=e[s],l=[];for(let e=0;e<o.length;e++){let h=o[e],c=""+s+e;l.push(c),i[c]={node:h,lastCount:0},n[c]={};for(let e=0;e<a.length;e++){let s=a[e];i[s]&&i[s].node.mode===h.mode?(n[s][c]=A(i[s].lastCount+h.length,h.mode)-A(i[s].lastCount,h.mode),i[s].lastCount+=h.length):(i[s]&&(i[s].lastCount=h.length),n[s][c]=A(h.length,h.mode)+4+r.getCharCountIndicator(h.mode,t))}}a=l}for(let e=0;e<a.length;e++)n[a[e]].end=0;return{map:n,table:i}}(function(e){let t=[];for(let i=0;i<e.length;i++){let n=e[i];switch(n.mode){case r.NUMERIC:t.push([n,{data:n.data,mode:r.ALPHANUMERIC,length:n.length},{data:n.data,mode:r.BYTE,length:n.length}]);break;case r.ALPHANUMERIC:t.push([n,{data:n.data,mode:r.BYTE,length:n.length}]);break;case r.KANJI:t.push([n,{data:n.data,mode:r.BYTE,length:u(n.data)}]);break;case r.BYTE:t.push([{data:n.data,mode:r.BYTE,length:u(n.data)}])}}return t}(p(e,h.isKanjiModeEnabled())),i),a=c.find_path(n.map,"start","end"),s=[];for(let e=1;e<a.length-1;e++)s.push(n.table[a[e]].node);return t.fromArray(s.reduce(function(e,t){let i=e.length-1>=0?e[e.length-1]:null;return i&&i.mode===t.mode?e[e.length-1].data+=t.data:e.push(t),e},[]))},t.rawSplit=function(e){return t.fromArray(p(e,h.isKanjiModeEnabled()))}},4913(e,t){let i,r=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];t.getSymbolSize=function(e){if(!e)throw Error('"version" cannot be null or undefined');if(e<1||e>40)throw Error('"version" should be in range from 1 to 40');return 4*e+17},t.getSymbolTotalCodewords=function(e){return r[e]},t.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},t.setToSJISFunction=function(e){if("function"!=typeof e)throw Error('"toSJISFunc" is not a valid function.');i=e},t.isKanjiModeEnabled=function(){return void 0!==i},t.toSJIS=function(e){return i(e)}},3673(e,t){t.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}},3492(e,t,i){let r=i(4913),n=i(6781),a=i(4752),s=i(989),o=i(3673),l=r.getBCHDigit(7973);function h(e,t){return s.getCharCountIndicator(e,t)+4}t.from=function(e,t){return o.isValid(e)?parseInt(e,10):t},t.getCapacity=function(e,t,i){if(!o.isValid(e))throw Error("Invalid QR Code version");void 0===i&&(i=s.BYTE);let a=(r.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,t))*8;if(i===s.MIXED)return a;let l=a-h(i,e);switch(i){case s.NUMERIC:return Math.floor(l/10*3);case s.ALPHANUMERIC:return Math.floor(l/11*2);case s.KANJI:return Math.floor(l/13);case s.BYTE:default:return Math.floor(l/8)}},t.getBestVersionForData=function(e,i){let r,n=a.from(i,a.M);if(Array.isArray(e)){if(e.length>1){for(let i=1;i<=40;i++)if(function(e,t){let i=0;return e.forEach(function(e){let r=h(e.mode,t);i+=r+e.getBitsLength()}),i}(e,i)<=t.getCapacity(i,n,s.MIXED))return i;return}if(0===e.length)return 1;r=e[0]}else r=e;return function(e,i,r){for(let n=1;n<=40;n++)if(i<=t.getCapacity(n,r,e))return n}(r.mode,r.getLength(),n)},t.getEncodedBits=function(e){if(!o.isValid(e)||e<7)throw Error("Invalid QR Code version");let t=e<<12;for(;r.getBCHDigit(t)-l>=0;)t^=7973<<r.getBCHDigit(t)-l;return e<<12|t}},7782(e,t,i){let r=i(8658);t.render=function(e,t,i){var n;let a=i,s=t;void 0!==a||t&&t.getContext||(a=t,t=void 0),t||(s=function(){try{return document.createElement("canvas")}catch(e){throw Error("You need to specify a canvas element")}}()),a=r.getOptions(a);let o=r.getImageWidth(e.modules.size,a),l=s.getContext("2d"),h=l.createImageData(o,o);return r.qrToImageData(h.data,e,a),n=s,l.clearRect(0,0,n.width,n.height),n.style||(n.style={}),n.height=o,n.width=o,n.style.height=o+"px",n.style.width=o+"px",l.putImageData(h,0,0),s},t.renderToDataURL=function(e,i,r){let n=r;void 0!==n||i&&i.getContext||(n=i,i=void 0),n||(n={});let a=t.render(e,i,n),s=n.type||"image/png",o=n.rendererOpts||{};return a.toDataURL(s,o.quality)}},4783(e,t,i){let r=i(8658);function n(e,t){let i=e.a/255,r=t+'="'+e.hex+'"';return i<1?r+" "+t+'-opacity="'+i.toFixed(2).slice(1)+'"':r}function a(e,t,i){let r=e+t;return void 0!==i&&(r+=" "+i),r}t.render=function(e,t,i){let s=r.getOptions(t),o=e.modules.size,l=e.modules.data,h=o+2*s.margin,c=s.color.light.a?"<path "+n(s.color.light,"fill")+' d="M0 0h'+h+"v"+h+'H0z"/>':"",u="<path "+n(s.color.dark,"stroke")+' d="'+function(e,t,i){let r="",n=0,s=!1,o=0;for(let l=0;l<e.length;l++){let h=Math.floor(l%t),c=Math.floor(l/t);h||s||(s=!0),e[l]?(o++,l>0&&h>0&&e[l-1]||(r+=s?a("M",h+i,.5+c+i):a("m",n,0),n=0,s=!1),h+1<t&&e[l+1]||(r+=a("h",o),o=0)):n++}return r}(l,o,s.margin)+'"/>',d='<svg xmlns="http://www.w3.org/2000/svg" '+(s.width?'width="'+s.width+'" height="'+s.width+'" ':"")+('viewBox="0 0 '+h+" ")+h+'" shape-rendering="crispEdges">'+c+u+"</svg>\n";return"function"==typeof i&&i(null,d),d}},8658(e,t){function i(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw Error("Invalid hex color: "+e);(3===t.length||4===t.length)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),6===t.length&&t.push("F","F");let i=parseInt(t.join(""),16);return{r:i>>24&255,g:i>>16&255,b:i>>8&255,a:255&i,hex:"#"+t.slice(0,6).join("")}}t.getOptions=function(e){e||(e={}),e.color||(e.color={});let t=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,n=e.scale||4;return{width:r,scale:r?4:n,margin:t,color:{dark:i(e.color.dark||"#000000ff"),light:i(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},t.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},t.getImageWidth=function(e,i){let r=t.getScale(e,i);return Math.floor((e+2*i.margin)*r)},t.qrToImageData=function(e,i,r){let n=i.modules.size,a=i.modules.data,s=t.getScale(n,r),o=Math.floor((n+2*r.margin)*s),l=r.margin*s,h=[r.color.light,r.color.dark];for(let t=0;t<o;t++)for(let i=0;i<o;i++){let c=(t*o+i)*4,u=r.color.light;t>=l&&i>=l&&t<o-l&&i<o-l&&(u=h[+!!a[Math.floor((t-l)/s)*n+Math.floor((i-l)/s)]]),e[c++]=u.r,e[c++]=u.g,e[c++]=u.b,e[c]=u.a}}},5479(){"use strict";let e,t,i,r,n,a,s,o,l,h,c,u,d,p,A,f,g,m,v,b,y,x,_,E,S,C,M,w,I,T,B,R=globalThis,D=R.ShadowRoot&&(void 0===R.ShadyCSS||R.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,L=Symbol(),P=new WeakMap;class U{constructor(e,t,i){if(this._$cssResult$=!0,i!==L)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(D&&void 0===e){let i=void 0!==t&&1===t.length;i&&(e=P.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&P.set(t,e))}return e}toString(){return this.cssText}}let F=D?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t,i="";for(let t of e.cssRules)i+=t.cssText;return new U("string"==typeof(t=i)?t:t+"",void 0,L)})(e):e,{is:N,defineProperty:O,getOwnPropertyDescriptor:k,getOwnPropertyNames:Q,getOwnPropertySymbols:G,getPrototypeOf:H}=Object,z=globalThis,V=z.trustedTypes,W=V?V.emptyScript:"",q=z.reactiveElementPolyfillSupport,j={toAttribute(e,t){switch(t){case Boolean:e=e?W:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},X=(e,t)=>!N(e,t),Y={attribute:!0,type:String,converter:j,reflect:!1,useDefault:!1,hasChanged:X};Symbol.metadata??=Symbol("metadata"),z.litPropertyMetadata??=new WeakMap;class K extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Y){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let i=Symbol(),r=this.getPropertyDescriptor(e,i,t);void 0!==r&&O(this.prototype,e,r)}}static getPropertyDescriptor(e,t,i){let{get:r,set:n}=k(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);n?.call(this,t),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Y}static _$Ei(){if(this.hasOwnProperty("elementProperties"))return;let e=H(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty("finalized"))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty("properties")){let e=this.properties;for(let t of[...Q(e),...G(e)])this.createProperty(t,e[t])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,i]of t)this.elementProperties.set(e,i)}for(let[e,t]of(this._$Eh=new Map,this.elementProperties)){let i=this._$Eu(e,t);void 0!==i&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e))for(let i of new Set(e.flat(1/0).reverse()))t.unshift(F(i));else void 0!==e&&t.push(F(e));return t}static _$Eu(e,t){let i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map;for(let t of this.constructor.elementProperties.keys())this.hasOwnProperty(t)&&(e.set(t,this[t]),delete this[t]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(D)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let i of t){let t=document.createElement("style"),r=R.litNonce;void 0!==r&&t.setAttribute("nonce",r),t.textContent=i.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){let i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(void 0!==r&&!0===i.reflect){let n=(void 0!==i.converter?.toAttribute?i.converter:j).toAttribute(t,i.type);this._$Em=e,null==n?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(e,t){let i=this.constructor,r=i._$Eh.get(e);if(void 0!==r&&this._$Em!==r){let e=i.getPropertyOptions(r),n="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:j;this._$Em=r;let a=n.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,i,r=!1,n){if(void 0!==e){let a=this.constructor;if(!1===r&&(n=this[e]),!(((i??=a.getPropertyOptions(e)).hasChanged??X)(n,t)||i.useDefault&&i.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:r,wrapped:n},a){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==n||void 0!==a)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,i]of e){let{wrapped:e}=i,r=this[t];!0!==e||this._$AL.has(t)||void 0===r||this.C(t,void 0,i,r)}}let e=!1,t=this._$AL;try{(e=this.shouldUpdate(t))?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}}K.elementStyles=[],K.shadowRootOptions={mode:"open"},K.elementProperties=new Map,K.finalized=new Map,q?.({ReactiveElement:K}),(z.reactiveElementVersions??=[]).push("2.1.2");let J={attribute:!0,type:String,converter:j,reflect:!1,hasChanged:X};function $(e){return(t,i)=>{let r;return"object"==typeof i?((e=J,t,i)=>{let{kind:r,metadata:n}=i,a=globalThis.litPropertyMetadata.get(n);if(void 0===a&&globalThis.litPropertyMetadata.set(n,a=new Map),"setter"===r&&((e=Object.create(e)).wrapped=!0),a.set(i.name,e),"accessor"===r){let{name:r}=i;return{set(i){let n=t.get.call(this);t.set.call(this,i),this.requestUpdate(r,n,e,!0,i)},init(t){return void 0!==t&&this.C(r,void 0,e,t),t}}}if("setter"===r){let{name:r}=i;return function(i){let n=this[r];t.call(this,i),this.requestUpdate(r,n,e,!0,i)}}throw Error("Unsupported decorator location: "+r)})(e,t,i):(r=t.hasOwnProperty(i),t.constructor.createProperty(i,e),r?Object.getOwnPropertyDescriptor(t,i):void 0)}}let Z=globalThis,ee=e=>e,et=Z.trustedTypes,ei=et?et.createPolicy("lit-html",{createHTML:e=>e}):void 0,er="$lit$",en=`lit$${Math.random().toFixed(9).slice(2)}$`,ea="?"+en,es=`<${ea}>`,eo=document,el=()=>eo.createComment(""),eh=e=>null===e||"object"!=typeof e&&"function"!=typeof e,ec=Array.isArray,eu="[ \n\f\r]",ed=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ep=/-->/g,eA=/>/g,ef=RegExp(`>|${eu}(?:([^\\s"'>=/]+)(${eu}*=${eu}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),eg=/'/g,em=/"/g,ev=/^(?:script|style|textarea|title)$/i,eb=e=>(t,...i)=>({_$litType$:e,strings:t,values:i}),ey=eb(1),ex=(eb(2),eb(3),Symbol.for("lit-noChange")),e_=Symbol.for("lit-nothing"),eE=new WeakMap,eS=eo.createTreeWalker(eo,129);function eC(e,t){if(!ec(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==ei?ei.createHTML(t):t}class eM{constructor({strings:e,_$litType$:t},i){let r;this.parts=[];let n=0,a=0;const s=e.length-1,o=this.parts,[l,h]=((e,t)=>{let i=e.length-1,r=[],n,a=2===t?"<svg>":3===t?"<math>":"",s=ed;for(let t=0;t<i;t++){let i=e[t],o,l,h=-1,c=0;for(;c<i.length&&(s.lastIndex=c,null!==(l=s.exec(i)));)c=s.lastIndex,s===ed?"!--"===l[1]?s=ep:void 0!==l[1]?s=eA:void 0!==l[2]?(ev.test(l[2])&&(n=RegExp("</"+l[2],"g")),s=ef):void 0!==l[3]&&(s=ef):s===ef?">"===l[0]?(s=n??ed,h=-1):void 0===l[1]?h=-2:(h=s.lastIndex-l[2].length,o=l[1],s=void 0===l[3]?ef:'"'===l[3]?em:eg):s===em||s===eg?s=ef:s===ep||s===eA?s=ed:(s=ef,n=void 0);let u=s===ef&&e[t+1].startsWith("/>")?" ":"";a+=s===ed?i+es:h>=0?(r.push(o),i.slice(0,h)+er+i.slice(h)+en+u):i+en+(-2===h?t:u)}return[eC(e,a+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),r]})(e,t);if(this.el=eM.createElement(l,i),eS.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(r=eS.nextNode())&&o.length<s;){if(1===r.nodeType){if(r.hasAttributes())for(const e of r.getAttributeNames())if(e.endsWith(er)){const t=h[a++],i=r.getAttribute(e).split(en),s=/([.?@])?(.*)/.exec(t);o.push({type:1,index:n,name:s[2],strings:i,ctor:"."===s[1]?eR:"?"===s[1]?eD:"@"===s[1]?eL:eB}),r.removeAttribute(e)}else e.startsWith(en)&&(o.push({type:6,index:n}),r.removeAttribute(e));if(ev.test(r.tagName)){const e=r.textContent.split(en),t=e.length-1;if(t>0){r.textContent=et?et.emptyScript:"";for(let i=0;i<t;i++)r.append(e[i],el()),eS.nextNode(),o.push({type:2,index:++n});r.append(e[t],el())}}}else if(8===r.nodeType)if(r.data===ea)o.push({type:2,index:n});else{let e=-1;for(;-1!==(e=r.data.indexOf(en,e+1));)o.push({type:7,index:n}),e+=en.length-1}n++}}static createElement(e,t){let i=eo.createElement("template");return i.innerHTML=e,i}}function ew(e,t,i=e,r){if(t===ex)return t;let n=void 0!==r?i._$Co?.[r]:i._$Cl,a=eh(t)?void 0:t._$litDirective$;return n?.constructor!==a&&(n?._$AO?.(!1),void 0===a?n=void 0:(n=new a(e))._$AT(e,i,r),void 0!==r?(i._$Co??=[])[r]=n:i._$Cl=n),void 0!==n&&(t=ew(e,n._$AS(e,t.values),n,r)),t}class eI{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:i}=this._$AD,r=(e?.creationScope??eo).importNode(t,!0);eS.currentNode=r;let n=eS.nextNode(),a=0,s=0,o=i[0];for(;void 0!==o;){if(a===o.index){let t;2===o.type?t=new eT(n,n.nextSibling,this,e):1===o.type?t=new o.ctor(n,o.name,o.strings,this,e):6===o.type&&(t=new eP(n,this,e)),this._$AV.push(t),o=i[++s]}a!==o?.index&&(n=eS.nextNode(),a++)}return eS.currentNode=eo,r}p(e){let t=0;for(let i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class eT{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,r){this.type=2,this._$AH=e_,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){let i;eh(e=ew(this,e,t))?e===e_||null==e||""===e?(this._$AH!==e_&&this._$AR(),this._$AH=e_):e!==this._$AH&&e!==ex&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):ec(i=e)||"function"==typeof i?.[Symbol.iterator]?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==e_&&eh(this._$AH)?this._$AA.nextSibling.data=e:this.T(eo.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:i}=e,r="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=eM.createElement(eC(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new eI(r,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=eE.get(e.strings);return void 0===t&&eE.set(e.strings,t=new eM(e)),t}k(e){ec(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,i,r=0;for(let n of e)r===t.length?t.push(i=new eT(this.O(el()),this.O(el()),this,this.options)):i=t[r],i._$AI(n),r++;r<t.length&&(this._$AR(i&&i._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=ee(e).nextSibling;ee(e).remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class eB{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,r,n){this.type=1,this._$AH=e_,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=e_}_$AI(e,t=this,i,r){let n=this.strings,a=!1;if(void 0===n)(a=!eh(e=ew(this,e,t,0))||e!==this._$AH&&e!==ex)&&(this._$AH=e);else{let r,s,o=e;for(e=n[0],r=0;r<n.length-1;r++)(s=ew(this,o[i+r],t,r))===ex&&(s=this._$AH[r]),a||=!eh(s)||s!==this._$AH[r],s===e_?e=e_:e!==e_&&(e+=(s??"")+n[r+1]),this._$AH[r]=s}a&&!r&&this.j(e)}j(e){e===e_?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class eR extends eB{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===e_?void 0:e}}class eD extends eB{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==e_)}}class eL extends eB{constructor(e,t,i,r,n){super(e,t,i,r,n),this.type=5}_$AI(e,t=this){if((e=ew(this,e,t,0)??e_)===ex)return;let i=this._$AH,r=e===e_&&i!==e_||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==e_&&(i===e_||r);r&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class eP{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){ew(this,e)}}let eU=Z.litHtmlPolyfillSupport;eU?.(eM,eT),(Z.litHtmlVersions??=[]).push("3.3.2");let eF=(e,t,i)=>{let r=i?.renderBefore??t,n=r._$litPart$;if(void 0===n){let e=i?.renderBefore??null;r._$litPart$=n=new eT(t.insertBefore(el(),e),e,void 0,i??{})}return n._$AI(e),n},eN=globalThis;class eO extends K{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=eF(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return ex}}eO._$litElement$=!0,eO.finalized=!0,eN.litElementHydrateSupport?.({LitElement:eO});let ek=eN.litElementPolyfillSupport;ek?.({LitElement:eO}),(eN.litElementVersions??=[]).push("4.2.2");let eQ=null!=navigator.xr&&null!=self.XRSession&&null!=navigator.xr.isSessionSupported,eG=eQ&&null!=self.XRSession.prototype.requestHitTestSource,eH=null!=self.ResizeObserver,ez=null!=self.IntersectionObserver;c=navigator.userAgent||navigator.vendor||self.opera,/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(c)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(c.substr(0,4)),/\bCrOS\b/.test(navigator.userAgent);let eV=/android/i.test(navigator.userAgent),eW=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1;/Safari\//.test(navigator.userAgent);let eq=/firefox/i.test(navigator.userAgent),ej=/OculusBrowser/.test(navigator.userAgent);eW&&/CriOS\//.test(navigator.userAgent);let eX=eV&&!eq&&!ej,eY=!!(window.webkit&&window.webkit.messageHandlers),eK=(()=>{if(!eW)return!1;if(eY)return!!/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent);{let e=document.createElement("a");return!!(e.relList&&e.relList.supports&&e.relList.supports("ar"))}})(),eJ=e=>e&&"null"!==e?eZ(e):null,e$=()=>{if(eG)return;let e=[];throw eQ||e.push("WebXR Device API"),eG||e.push("WebXR Hit Test API"),Error(`The following APIs are required for AR, but are missing in this browser: ${e.join(", ")}`)},eZ=e=>new URL(e,window.location.toString()).toString(),e0=(e,t)=>{let i=null;return(...r)=>{null!=i&&self.clearTimeout(i),i=self.setTimeout(()=>{i=null,e(...r)},t)}},e1=(e,t,i)=>Math.max(t,Math.min(i,e)),e2=(u=RegExp("[?&]model-viewer-debug-mode(&|$)"),()=>self.ModelViewerElement&&self.ModelViewerElement.debugMode||self.location&&self.location.search&&self.location.search.match(u));var e3,e4,e5,e8,e9,e6,e7,te,tt,ti,tr,tn,ta,ts,to,tl,th,tc,tu,td,tp,tA,tf,tg,tm,tv,tb,ty,tx,t_,tE,tS,tC,tM,tw,tI,tT,tB,tR,tD,tL,tP=function(e,t,i,r){var n,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(s=(a<3?n(s):a>3?n(t,i,s):n(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let tU=Symbol("currentEnvironmentMap"),tF=Symbol("currentBackground"),tN=Symbol("updateEnvironment"),tO=Symbol("cancelEnvironmentUpdate"),tk=ey`
|
|
4
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#000000">
|
|
5
|
+
<!-- NOTE(cdata): This SVG filter is a stop-gap until we can implement
|
|
6
|
+
support for dynamic re-coloring of UI components -->
|
|
7
|
+
<defs>
|
|
8
|
+
<filter id="drop-shadow" x="-100%" y="-100%" width="300%" height="300%">
|
|
9
|
+
<feGaussianBlur in="SourceAlpha" stdDeviation="1"/>
|
|
10
|
+
<feOffset dx="0" dy="0" result="offsetblur"/>
|
|
11
|
+
<feFlood flood-color="#000000"/>
|
|
12
|
+
<feComposite in2="offsetblur" operator="in"/>
|
|
13
|
+
<feMerge>
|
|
14
|
+
<feMergeNode/>
|
|
15
|
+
<feMergeNode in="SourceGraphic"/>
|
|
16
|
+
</feMerge>
|
|
17
|
+
</filter>
|
|
18
|
+
</defs>
|
|
19
|
+
<path filter="url(#drop-shadow)" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
|
|
20
|
+
<path d="M0 0h24v24H0z" fill="none"/>
|
|
21
|
+
</svg>`,tQ=ey`
|
|
22
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="36">
|
|
23
|
+
<defs>
|
|
24
|
+
<path id="A" d="M.001.232h24.997V36H.001z" />
|
|
25
|
+
</defs>
|
|
26
|
+
<g transform="translate(-11 -4)" fill="none" fill-rule="evenodd">
|
|
27
|
+
<path fill-opacity="0" fill="#fff" d="M0 0h44v44H0z" />
|
|
28
|
+
<g transform="translate(11 3)">
|
|
29
|
+
<path d="M8.733 11.165c.04-1.108.766-2.027 1.743-2.307a2.54 2.54 0 0 1 .628-.089c.16 0 .314.017.463.044 1.088.2 1.9 1.092 1.9 2.16v8.88h1.26c2.943-1.39 5-4.45 5-8.025a9.01 9.01 0 0 0-1.9-5.56l-.43-.5c-.765-.838-1.683-1.522-2.712-2-1.057-.49-2.226-.77-3.46-.77s-2.4.278-3.46.77c-1.03.478-1.947 1.162-2.71 2l-.43.5a9.01 9.01 0 0 0-1.9 5.56 9.04 9.04 0 0 0 .094 1.305c.03.21.088.41.13.617l.136.624c.083.286.196.56.305.832l.124.333a8.78 8.78 0 0 0 .509.953l.065.122a8.69 8.69 0 0 0 3.521 3.191l1.11.537v-9.178z" fill-opacity=".5" fill="#e4e4e4" />
|
|
30
|
+
<path d="M22.94 26.218l-2.76 7.74c-.172.485-.676.8-1.253.8H12.24c-1.606 0-3.092-.68-3.98-1.82-1.592-2.048-3.647-3.822-6.11-5.27-.095-.055-.15-.137-.152-.23-.004-.1.046-.196.193-.297.56-.393 1.234-.6 1.926-.6a3.43 3.43 0 0 1 .691.069l4.922.994V10.972c0-.663.615-1.203 1.37-1.203s1.373.54 1.373 1.203v9.882h2.953c.273 0 .533.073.757.21l6.257 3.874c.027.017.045.042.07.06.41.296.586.77.426 1.22M4.1 16.614c-.024-.04-.042-.083-.065-.122a8.69 8.69 0 0 1-.509-.953c-.048-.107-.08-.223-.124-.333l-.305-.832c-.058-.202-.09-.416-.136-.624l-.13-.617a9.03 9.03 0 0 1-.094-1.305c0-2.107.714-4.04 1.9-5.56l.43-.5c.764-.84 1.682-1.523 2.71-2 1.058-.49 2.226-.77 3.46-.77s2.402.28 3.46.77c1.03.477 1.947 1.16 2.712 2l.428.5a9 9 0 0 1 1.901 5.559c0 3.577-2.056 6.636-5 8.026h-1.26v-8.882c0-1.067-.822-1.96-1.9-2.16-.15-.028-.304-.044-.463-.044-.22 0-.427.037-.628.09-.977.28-1.703 1.198-1.743 2.306v9.178l-1.11-.537C6.18 19.098 4.96 18 4.1 16.614M22.97 24.09l-6.256-3.874c-.102-.063-.218-.098-.33-.144 2.683-1.8 4.354-4.855 4.354-8.243 0-.486-.037-.964-.104-1.43a9.97 9.97 0 0 0-1.57-4.128l-.295-.408-.066-.092a10.05 10.05 0 0 0-.949-1.078c-.342-.334-.708-.643-1.094-.922-1.155-.834-2.492-1.412-3.94-1.65l-.732-.088-.748-.03a9.29 9.29 0 0 0-1.482.119c-1.447.238-2.786.816-3.94 1.65a9.33 9.33 0 0 0-.813.686 9.59 9.59 0 0 0-.845.877l-.385.437-.36.5-.288.468-.418.778-.04.09c-.593 1.28-.93 2.71-.93 4.222 0 3.832 2.182 7.342 5.56 8.938l1.437.68v4.946L5 25.64a4.44 4.44 0 0 0-.888-.086c-.017 0-.034.003-.05.003-.252.004-.503.033-.75.08a5.08 5.08 0 0 0-.237.056c-.193.046-.382.107-.568.18-.075.03-.15.057-.225.1-.25.114-.494.244-.723.405a1.31 1.31 0 0 0-.566 1.122 1.28 1.28 0 0 0 .645 1.051C4 29.925 5.96 31.614 7.473 33.563a5.06 5.06 0 0 0 .434.491c1.086 1.082 2.656 1.713 4.326 1.715h6.697c.748-.001 1.43-.333 1.858-.872.142-.18.256-.38.336-.602l2.757-7.74c.094-.26.13-.53.112-.794s-.088-.52-.203-.76a2.19 2.19 0 0 0-.821-.91" fill-opacity=".6" fill="#000" />
|
|
31
|
+
<path d="M22.444 24.94l-6.257-3.874a1.45 1.45 0 0 0-.757-.211h-2.953v-9.88c0-.663-.616-1.203-1.373-1.203s-1.37.54-1.37 1.203v16.643l-4.922-.994a3.44 3.44 0 0 0-.692-.069 3.35 3.35 0 0 0-1.925.598c-.147.102-.198.198-.194.298.004.094.058.176.153.23 2.462 1.448 4.517 3.22 6.11 5.27.887 1.14 2.373 1.82 3.98 1.82h6.686c.577 0 1.08-.326 1.253-.8l2.76-7.74c.16-.448-.017-.923-.426-1.22-.025-.02-.043-.043-.07-.06z" fill="#fff" />
|
|
32
|
+
<g transform="translate(0 .769)">
|
|
33
|
+
<mask id="B" fill="#fff">
|
|
34
|
+
<use xlink:href="#A" />
|
|
35
|
+
</mask>
|
|
36
|
+
<path d="M23.993 24.992a1.96 1.96 0 0 1-.111.794l-2.758 7.74c-.08.22-.194.423-.336.602-.427.54-1.11.87-1.857.872h-6.698c-1.67-.002-3.24-.633-4.326-1.715-.154-.154-.3-.318-.434-.49C5.96 30.846 4 29.157 1.646 27.773c-.385-.225-.626-.618-.645-1.05a1.31 1.31 0 0 1 .566-1.122 4.56 4.56 0 0 1 .723-.405l.225-.1a4.3 4.3 0 0 1 .568-.18l.237-.056c.248-.046.5-.075.75-.08.018 0 .034-.003.05-.003.303-.001.597.027.89.086l3.722.752V20.68l-1.436-.68c-3.377-1.596-5.56-5.106-5.56-8.938 0-1.51.336-2.94.93-4.222.015-.03.025-.06.04-.09.127-.267.268-.525.418-.778.093-.16.186-.316.288-.468.063-.095.133-.186.2-.277L3.773 5c.118-.155.26-.29.385-.437.266-.3.544-.604.845-.877a9.33 9.33 0 0 1 .813-.686C6.97 2.167 8.31 1.59 9.757 1.35a9.27 9.27 0 0 1 1.481-.119 8.82 8.82 0 0 1 .748.031c.247.02.49.05.733.088 1.448.238 2.786.816 3.94 1.65.387.28.752.588 1.094.922a9.94 9.94 0 0 1 .949 1.078l.066.092c.102.133.203.268.295.408a9.97 9.97 0 0 1 1.571 4.128c.066.467.103.945.103 1.43 0 3.388-1.67 6.453-4.353 8.243.11.046.227.08.33.144l6.256 3.874c.37.23.645.55.82.9.115.24.185.498.203.76m.697-1.195c-.265-.55-.677-1.007-1.194-1.326l-5.323-3.297c2.255-2.037 3.564-4.97 3.564-8.114 0-2.19-.637-4.304-1.84-6.114-.126-.188-.26-.37-.4-.552-.645-.848-1.402-1.6-2.252-2.204C15.472.91 13.393.232 11.238.232A10.21 10.21 0 0 0 5.23 2.19c-.848.614-1.606 1.356-2.253 2.205-.136.18-.272.363-.398.55C1.374 6.756.737 8.87.737 11.06c0 4.218 2.407 8.08 6.133 9.842l.863.41v3.092l-2.525-.51c-.356-.07-.717-.106-1.076-.106a5.45 5.45 0 0 0-3.14.996c-.653.46-1.022 1.202-.99 1.983a2.28 2.28 0 0 0 1.138 1.872c2.24 1.318 4.106 2.923 5.543 4.772 1.26 1.62 3.333 2.59 5.55 2.592h6.698c1.42-.001 2.68-.86 3.134-2.138l2.76-7.74c.272-.757.224-1.584-.134-2.325" fill-opacity=".05" fill="#000" mask="url(#B)" />
|
|
37
|
+
</g>
|
|
38
|
+
</g>
|
|
39
|
+
</g>
|
|
40
|
+
</svg>`,tG=ey`
|
|
41
|
+
<svg version="1.1" id="view_x5F_in_x5F_AR_x5F_icon"
|
|
42
|
+
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px"
|
|
43
|
+
viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
|
|
44
|
+
<rect id="Bounding_Box" x="0" y="0" fill="none" width="24" height="24"/>
|
|
45
|
+
<g id="Art_layer">
|
|
46
|
+
<path d="M3,4c0-0.55,0.45-1,1-1h2V1H4C2.35,1,1,2.35,1,4v2h2V4z"/>
|
|
47
|
+
<path d="M20,3c0.55,0,1,0.45,1,1v2h2V4c0-1.65-1.35-3-3-3h-2v2H20z"/>
|
|
48
|
+
<path d="M4,21c-0.55,0-1-0.45-1-1v-2H1v2c0,1.65,1.35,3,3,3h2v-2H4z"/>
|
|
49
|
+
<path d="M20,21c0.55,0,1-0.45,1-1v-2h2v2c0,1.65-1.35,3-3,3h-2v-2H20z"/>
|
|
50
|
+
<g>
|
|
51
|
+
<path d="M18.25,7.6l-5.5-3.18c-0.46-0.27-1.04-0.27-1.5,0L5.75,7.6C5.29,7.87,5,8.36,5,8.9v6.35c0,0.54,0.29,1.03,0.75,1.3
|
|
52
|
+
l5.5,3.18c0.46,0.27,1.04,0.27,1.5,0l5.5-3.18c0.46-0.27,0.75-0.76,0.75-1.3V8.9C19,8.36,18.71,7.87,18.25,7.6z M7,14.96v-4.62
|
|
53
|
+
l4,2.32v4.61L7,14.96z M12,10.93L8,8.61l4-2.31l4,2.31L12,10.93z M13,17.27v-4.61l4-2.32v4.62L13,17.27z"/>
|
|
54
|
+
</g>
|
|
55
|
+
</g>
|
|
56
|
+
</svg>`,tH=ey`
|
|
57
|
+
<style>
|
|
58
|
+
:host {
|
|
59
|
+
display: block;
|
|
60
|
+
position: relative;
|
|
61
|
+
contain: strict;
|
|
62
|
+
width: 300px;
|
|
63
|
+
height: 150px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.container {
|
|
67
|
+
position: relative;
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.userInput {
|
|
72
|
+
width: 100%;
|
|
73
|
+
height: 100%;
|
|
74
|
+
display: none;
|
|
75
|
+
position: relative;
|
|
76
|
+
outline-offset: -1px;
|
|
77
|
+
outline-width: 1px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
canvas {
|
|
81
|
+
position: absolute;
|
|
82
|
+
display: none;
|
|
83
|
+
pointer-events: none;
|
|
84
|
+
/* NOTE(cdata): Chrome 76 and below apparently have a bug
|
|
85
|
+
* that causes our canvas not to display pixels unless it is
|
|
86
|
+
* on its own render layer
|
|
87
|
+
* @see https://github.com/google/model-viewer/pull/755#issuecomment-536597893
|
|
88
|
+
*/
|
|
89
|
+
transform: translateZ(0);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.show {
|
|
93
|
+
display: block;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* Adapted from HTML5 Boilerplate
|
|
97
|
+
*
|
|
98
|
+
* @see https://github.com/h5bp/html5-boilerplate/blob/ceb4620c78fc82e13534fc44202a3f168754873f/dist/css/main.css#L122-L133 */
|
|
99
|
+
.screen-reader-only {
|
|
100
|
+
border: 0;
|
|
101
|
+
left: 0;
|
|
102
|
+
top: 0;
|
|
103
|
+
clip: rect(0, 0, 0, 0);
|
|
104
|
+
height: 1px;
|
|
105
|
+
margin: -1px;
|
|
106
|
+
overflow: hidden;
|
|
107
|
+
padding: 0;
|
|
108
|
+
position: absolute;
|
|
109
|
+
white-space: nowrap;
|
|
110
|
+
width: 1px;
|
|
111
|
+
pointer-events: none;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.slot {
|
|
115
|
+
position: absolute;
|
|
116
|
+
pointer-events: none;
|
|
117
|
+
top: 0;
|
|
118
|
+
left: 0;
|
|
119
|
+
width: 100%;
|
|
120
|
+
height: 100%;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.slot > * {
|
|
124
|
+
pointer-events: initial;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.annotation-wrapper ::slotted(*) {
|
|
128
|
+
opacity: var(--max-hotspot-opacity, 1);
|
|
129
|
+
transition: opacity 0.3s;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.pointer-tumbling .annotation-wrapper ::slotted(*) {
|
|
133
|
+
pointer-events: none;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.annotation-wrapper ::slotted(*) {
|
|
137
|
+
pointer-events: initial;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.annotation-wrapper.hide ::slotted(*) {
|
|
141
|
+
opacity: var(--min-hotspot-opacity, 0.25);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.slot.poster {
|
|
145
|
+
display: none;
|
|
146
|
+
background-color: inherit;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.slot.poster.show {
|
|
150
|
+
display: inherit;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.slot.poster > * {
|
|
154
|
+
pointer-events: initial;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.slot.poster:not(.show) > * {
|
|
158
|
+
pointer-events: none;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
#default-poster {
|
|
162
|
+
width: 100%;
|
|
163
|
+
height: 100%;
|
|
164
|
+
/* The default poster is a <button> so we need to set display
|
|
165
|
+
* to prevent it from being affected by text-align: */
|
|
166
|
+
display: block;
|
|
167
|
+
position: absolute;
|
|
168
|
+
border: none;
|
|
169
|
+
padding: 0;
|
|
170
|
+
background-size: contain;
|
|
171
|
+
background-repeat: no-repeat;
|
|
172
|
+
background-position: center;
|
|
173
|
+
background-color: #fff0;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
#default-progress-bar {
|
|
177
|
+
display: block;
|
|
178
|
+
position: relative;
|
|
179
|
+
width: 100%;
|
|
180
|
+
height: 100%;
|
|
181
|
+
pointer-events: none;
|
|
182
|
+
overflow: hidden;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
#default-progress-bar > .bar {
|
|
186
|
+
position: absolute;
|
|
187
|
+
top: 0;
|
|
188
|
+
left: 0;
|
|
189
|
+
width: 100%;
|
|
190
|
+
height: var(--progress-bar-height, 5px);
|
|
191
|
+
background-color: var(--progress-bar-color, rgba(0, 0, 0, 0.4));
|
|
192
|
+
transition: transform 0.09s;
|
|
193
|
+
transform-origin: top left;
|
|
194
|
+
transform: scaleX(0);
|
|
195
|
+
overflow: hidden;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
#default-progress-bar > .bar.hide {
|
|
199
|
+
transition: opacity 0.3s 1s;
|
|
200
|
+
opacity: 0;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.centered {
|
|
204
|
+
align-items: center;
|
|
205
|
+
justify-content: center;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.cover {
|
|
209
|
+
position: absolute;
|
|
210
|
+
top: 0;
|
|
211
|
+
left: 0;
|
|
212
|
+
width: 100%;
|
|
213
|
+
height: 100%;
|
|
214
|
+
pointer-events: none;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.slot.interaction-prompt {
|
|
218
|
+
display: var(--interaction-prompt-display, flex);
|
|
219
|
+
overflow: hidden;
|
|
220
|
+
opacity: 0;
|
|
221
|
+
will-change: opacity;
|
|
222
|
+
transition: opacity 0.3s;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.slot.interaction-prompt.visible {
|
|
226
|
+
opacity: 1;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.animated-container {
|
|
230
|
+
will-change: transform, opacity;
|
|
231
|
+
opacity: 0;
|
|
232
|
+
transition: opacity 0.3s;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.slot.interaction-prompt > * {
|
|
236
|
+
pointer-events: none;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.slot.ar-button {
|
|
240
|
+
-moz-user-select: none;
|
|
241
|
+
-webkit-tap-highlight-color: transparent;
|
|
242
|
+
user-select: none;
|
|
243
|
+
|
|
244
|
+
display: var(--ar-button-display, block);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.slot.ar-button:not(.enabled) {
|
|
248
|
+
display: none;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.fab {
|
|
252
|
+
display: flex;
|
|
253
|
+
align-items: center;
|
|
254
|
+
justify-content: center;
|
|
255
|
+
box-sizing: border-box;
|
|
256
|
+
width: 40px;
|
|
257
|
+
height: 40px;
|
|
258
|
+
cursor: pointer;
|
|
259
|
+
background-color: #fff;
|
|
260
|
+
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.15);
|
|
261
|
+
border-radius: 100px;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.fab > * {
|
|
265
|
+
opacity: 0.87;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
#default-ar-button {
|
|
269
|
+
position: absolute;
|
|
270
|
+
bottom: 16px;
|
|
271
|
+
right: 16px;
|
|
272
|
+
transform: scale(var(--ar-button-scale, 1));
|
|
273
|
+
transform-origin: bottom right;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.slot.pan-target {
|
|
277
|
+
display: block;
|
|
278
|
+
position: absolute;
|
|
279
|
+
width: 0;
|
|
280
|
+
height: 0;
|
|
281
|
+
left: 50%;
|
|
282
|
+
top: 50%;
|
|
283
|
+
transform: translate3d(-50%, -50%, 0);
|
|
284
|
+
background-color: transparent;
|
|
285
|
+
opacity: 0;
|
|
286
|
+
transition: opacity 0.3s;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
#default-pan-target {
|
|
290
|
+
width: 6px;
|
|
291
|
+
height: 6px;
|
|
292
|
+
border-radius: 6px;
|
|
293
|
+
border: 1px solid white;
|
|
294
|
+
box-shadow: 0px 0px 2px 1px rgba(0, 0, 0, 0.8);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.slot.default {
|
|
298
|
+
pointer-events: none;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.slot.progress-bar {
|
|
302
|
+
pointer-events: none;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.slot.exit-webxr-ar-button {
|
|
306
|
+
pointer-events: none;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.slot.exit-webxr-ar-button:not(.enabled) {
|
|
310
|
+
display: none;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
#default-exit-webxr-ar-button {
|
|
314
|
+
display: flex;
|
|
315
|
+
align-items: center;
|
|
316
|
+
justify-content: center;
|
|
317
|
+
position: absolute;
|
|
318
|
+
top: env(safe-area-inset-top, 16px);
|
|
319
|
+
right: 16px;
|
|
320
|
+
width: 40px;
|
|
321
|
+
height: 40px;
|
|
322
|
+
box-sizing: border-box;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
#default-exit-webxr-ar-button > svg {
|
|
326
|
+
fill: #fff;
|
|
327
|
+
}
|
|
328
|
+
</style>
|
|
329
|
+
<div class="container">
|
|
330
|
+
<div class="userInput" tabindex="0" role="img"
|
|
331
|
+
aria-label="3D model">
|
|
332
|
+
<div class="slot canvas">
|
|
333
|
+
<slot name="canvas">
|
|
334
|
+
<canvas></canvas>
|
|
335
|
+
</slot>
|
|
336
|
+
</div>
|
|
337
|
+
|
|
338
|
+
</div>
|
|
339
|
+
|
|
340
|
+
<!-- NOTE(cdata): We need to wrap slots because browsers without ShadowDOM
|
|
341
|
+
will have their <slot> elements removed by ShadyCSS -->
|
|
342
|
+
<div class="slot poster">
|
|
343
|
+
<slot name="poster">
|
|
344
|
+
<button type="button" id="default-poster" aria-hidden="true" aria-label="Loading 3D model"></button>
|
|
345
|
+
</slot>
|
|
346
|
+
</div>
|
|
347
|
+
|
|
348
|
+
<div class="slot ar-button">
|
|
349
|
+
<slot name="ar-button">
|
|
350
|
+
<a id="default-ar-button" part="default-ar-button" class="fab"
|
|
351
|
+
tabindex="2"
|
|
352
|
+
role="button"
|
|
353
|
+
href="javascript:void(0);"
|
|
354
|
+
aria-label="View in your space">
|
|
355
|
+
${tG}
|
|
356
|
+
</a>
|
|
357
|
+
</slot>
|
|
358
|
+
</div>
|
|
359
|
+
|
|
360
|
+
<div class="slot pan-target">
|
|
361
|
+
<slot name="pan-target">
|
|
362
|
+
<div id="default-pan-target">
|
|
363
|
+
</div>
|
|
364
|
+
</slot>
|
|
365
|
+
</div>
|
|
366
|
+
|
|
367
|
+
<div class="slot interaction-prompt cover centered">
|
|
368
|
+
<div id="prompt" class="animated-container">
|
|
369
|
+
<slot name="interaction-prompt" aria-hidden="true">
|
|
370
|
+
${tQ}
|
|
371
|
+
</slot>
|
|
372
|
+
</div>
|
|
373
|
+
</div>
|
|
374
|
+
|
|
375
|
+
<div id="finger0" class="animated-container cover">
|
|
376
|
+
<slot name="finger0" aria-hidden="true">
|
|
377
|
+
</slot>
|
|
378
|
+
</div>
|
|
379
|
+
<div id="finger1" class="animated-container cover">
|
|
380
|
+
<slot name="finger1" aria-hidden="true">
|
|
381
|
+
</slot>
|
|
382
|
+
</div>
|
|
383
|
+
|
|
384
|
+
<div class="slot default">
|
|
385
|
+
<slot></slot>
|
|
386
|
+
|
|
387
|
+
<div class="slot progress-bar">
|
|
388
|
+
<slot name="progress-bar">
|
|
389
|
+
<div id="default-progress-bar" aria-hidden="true">
|
|
390
|
+
<div class="bar" part="default-progress-bar"></div>
|
|
391
|
+
</div>
|
|
392
|
+
</slot>
|
|
393
|
+
</div>
|
|
394
|
+
|
|
395
|
+
<div class="slot exit-webxr-ar-button">
|
|
396
|
+
<slot name="exit-webxr-ar-button">
|
|
397
|
+
<a id="default-exit-webxr-ar-button" part="default-exit-webxr-ar-button"
|
|
398
|
+
tabindex="3"
|
|
399
|
+
aria-label="Exit AR"
|
|
400
|
+
aria-hidden="true">
|
|
401
|
+
${tk}
|
|
402
|
+
</a>
|
|
403
|
+
</slot>
|
|
404
|
+
</div>
|
|
405
|
+
</div>
|
|
406
|
+
</div>
|
|
407
|
+
<div class="screen-reader-only" role="region" aria-label="Live announcements">
|
|
408
|
+
<span id="status" role="status"></span>
|
|
409
|
+
</div>`,tz="attached",tV="srgb",tW="srgb-linear",tq="linear",tj="srgb";function tX(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function tY(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;let tK={};function tJ(...e){console.log("THREE."+e.shift(),...e)}function t$(...e){console.warn("THREE."+e.shift(),...e)}function tZ(...e){console.error("THREE."+e.shift(),...e)}function t0(...e){let t=e.join(" ");t in tK||(tK[t]=!0,t$(...e))}class t1{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)}hasEventListener(e,t){let i=this._listeners;return void 0!==i&&void 0!==i[e]&&-1!==i[e].indexOf(t)}removeEventListener(e,t){let i=this._listeners;if(void 0===i)return;let r=i[e];if(void 0!==r){let e=r.indexOf(t);-1!==e&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(void 0===t)return;let i=t[e.type];if(void 0!==i){e.target=this;let t=i.slice(0);for(let i=0,r=t.length;i<r;i++)t[i].call(this,e);e.target=null}}}let t2=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],t3=Math.PI/180,t4=180/Math.PI;function t5(){let e=0xffffffff*Math.random()|0,t=0xffffffff*Math.random()|0,i=0xffffffff*Math.random()|0,r=0xffffffff*Math.random()|0;return(t2[255&e]+t2[e>>8&255]+t2[e>>16&255]+t2[e>>24&255]+"-"+t2[255&t]+t2[t>>8&255]+"-"+t2[t>>16&15|64]+t2[t>>24&255]+"-"+t2[63&i|128]+t2[i>>8&255]+"-"+t2[i>>16&255]+t2[i>>24&255]+t2[255&r]+t2[r>>8&255]+t2[r>>16&255]+t2[r>>24&255]).toLowerCase()}function t8(e,t,i){return Math.max(t,Math.min(i,e))}function t9(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/0xffffffff;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/0x7fffffff,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function t6(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(0xffffffff*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(0x7fffffff*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}class t7{constructor(e=0,t=0){t7.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=t8(this.x,e.x,t.x),this.y=t8(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=t8(this.x,e,t),this.y=t8(this.y,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(t8(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(t8(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),r=Math.sin(t),n=this.x-e.x,a=this.y-e.y;return this.x=n*i-a*r+e.x,this.y=n*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ie{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,n,a,s){let o=i[r+0],l=i[r+1],h=i[r+2],c=i[r+3],u=n[a+0],d=n[a+1],p=n[a+2],A=n[a+3];if(s<=0){e[t+0]=o,e[t+1]=l,e[t+2]=h,e[t+3]=c;return}if(s>=1){e[t+0]=u,e[t+1]=d,e[t+2]=p,e[t+3]=A;return}if(c!==A||o!==u||l!==d||h!==p){let e=o*u+l*d+h*p+c*A;e<0&&(u=-u,d=-d,p=-p,A=-A,e=-e);let t=1-s;if(e<.9995){let i=Math.acos(e),r=Math.sin(i);o=o*(t=Math.sin(t*i)/r)+u*(s=Math.sin(s*i)/r),l=l*t+d*s,h=h*t+p*s,c=c*t+A*s}else{let e=1/Math.sqrt((o=o*t+u*s)*o+(l=l*t+d*s)*l+(h=h*t+p*s)*h+(c=c*t+A*s)*c);o*=e,l*=e,h*=e,c*=e}}e[t]=o,e[t+1]=l,e[t+2]=h,e[t+3]=c}static multiplyQuaternionsFlat(e,t,i,r,n,a){let s=i[r],o=i[r+1],l=i[r+2],h=i[r+3],c=n[a],u=n[a+1],d=n[a+2],p=n[a+3];return e[t]=s*p+h*c+o*d-l*u,e[t+1]=o*p+h*u+l*c-s*d,e[t+2]=l*p+h*d+s*u-o*c,e[t+3]=h*p-s*c-o*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let i=e._x,r=e._y,n=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(i/2),h=s(r/2),c=s(n/2),u=o(i/2),d=o(r/2),p=o(n/2);switch(a){case"XYZ":this._x=u*h*c+l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c-u*d*p;break;case"YXZ":this._x=u*h*c+l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c+u*d*p;break;case"ZXY":this._x=u*h*c-l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c-u*d*p;break;case"ZYX":this._x=u*h*c-l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c+u*d*p;break;case"YZX":this._x=u*h*c+l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c-u*d*p;break;case"XZY":this._x=u*h*c-l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c+u*d*p;break;default:t$("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],r=t[4],n=t[8],a=t[1],s=t[5],o=t[9],l=t[2],h=t[6],c=t[10],u=i+s+c;if(u>0){let e=.5/Math.sqrt(u+1);this._w=.25/e,this._x=(h-o)*e,this._y=(n-l)*e,this._z=(a-r)*e}else if(i>s&&i>c){let e=2*Math.sqrt(1+i-s-c);this._w=(h-o)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(n+l)/e}else if(s>c){let e=2*Math.sqrt(1+s-i-c);this._w=(n-l)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(o+h)/e}else{let e=2*Math.sqrt(1+c-i-s);this._w=(a-r)/e,this._x=(n+l)/e,this._y=(o+h)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x),this._w=i,this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(t8(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(0===i)return this;let r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,r=e._y,n=e._z,a=e._w,s=t._x,o=t._y,l=t._z,h=t._w;return this._x=i*h+a*s+r*l-n*o,this._y=r*h+a*o+n*s-i*l,this._z=n*h+a*l+i*o-r*s,this._w=a*h-i*s-r*o-n*l,this._onChangeCallback(),this}slerp(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let i=e._x,r=e._y,n=e._z,a=e._w,s=this.dot(e);s<0&&(i=-i,r=-r,n=-n,a=-a,s=-s);let o=1-t;if(s<.9995){let e=Math.acos(s),l=Math.sin(e);o=Math.sin(o*e)/l,t=Math.sin(t*e)/l,this._x=this._x*o+i*t,this._y=this._y*o+r*t,this._z=this._z*o+n*t,this._w=this._w*o+a*t,this._onChangeCallback()}else this._x=this._x*o+i*t,this._y=this._y*o+r*t,this._z=this._z*o+n*t,this._w=this._w*o+a*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),n=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),n*Math.sin(t),n*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class it{constructor(e=0,t=0,i=0){it.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return void 0===i&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(ir.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(ir.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6]*r,this.y=n[1]*t+n[4]*i+n[7]*r,this.z=n[2]*t+n[5]*i+n[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,r=this.z,n=e.elements,a=1/(n[3]*t+n[7]*i+n[11]*r+n[15]);return this.x=(n[0]*t+n[4]*i+n[8]*r+n[12])*a,this.y=(n[1]*t+n[5]*i+n[9]*r+n[13])*a,this.z=(n[2]*t+n[6]*i+n[10]*r+n[14])*a,this}applyQuaternion(e){let t=this.x,i=this.y,r=this.z,n=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*r-s*i),h=2*(s*t-n*r),c=2*(n*i-a*t);return this.x=t+o*l+a*c-s*h,this.y=i+o*h+s*l-n*c,this.z=r+o*c+n*h-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[4]*i+n[8]*r,this.y=n[1]*t+n[5]*i+n[9]*r,this.z=n[2]*t+n[6]*i+n[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=t8(this.x,e.x,t.x),this.y=t8(this.y,e.y,t.y),this.z=t8(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=t8(this.x,e,t),this.y=t8(this.y,e,t),this.z=t8(this.z,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(t8(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,r=e.y,n=e.z,a=t.x,s=t.y,o=t.z;return this.x=r*o-n*s,this.y=n*a-i*o,this.z=i*s-r*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return ii.copy(this).projectOnVector(e),this.sub(ii)}reflect(e){return this.sub(ii.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(t8(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=2*Math.random()-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let ii=new it,ir=new ie;class ia{constructor(e,t,i,r,n,a,s,o,l){ia.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,i,r,n,a,s,o,l)}set(e,t,i,r,n,a,s,o,l){let h=this.elements;return h[0]=e,h[1]=r,h[2]=s,h[3]=t,h[4]=n,h[5]=o,h[6]=i,h[7]=a,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,r=t.elements,n=this.elements,a=i[0],s=i[3],o=i[6],l=i[1],h=i[4],c=i[7],u=i[2],d=i[5],p=i[8],A=r[0],f=r[3],g=r[6],m=r[1],v=r[4],b=r[7],y=r[2],x=r[5],_=r[8];return n[0]=a*A+s*m+o*y,n[3]=a*f+s*v+o*x,n[6]=a*g+s*b+o*_,n[1]=l*A+h*m+c*y,n[4]=l*f+h*v+c*x,n[7]=l*g+h*b+c*_,n[2]=u*A+d*m+p*y,n[5]=u*f+d*v+p*x,n[8]=u*g+d*b+p*_,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8];return t*a*h-t*s*l-i*n*h+i*s*o+r*n*l-r*a*o}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8],c=h*a-s*l,u=s*o-h*n,d=l*n-a*o,p=t*c+i*u+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let A=1/p;return e[0]=c*A,e[1]=(r*l-h*i)*A,e[2]=(s*i-r*a)*A,e[3]=u*A,e[4]=(h*t-r*o)*A,e[5]=(r*n-s*t)*A,e[6]=d*A,e[7]=(i*o-l*t)*A,e[8]=(a*t-i*n)*A,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,n,a,s){let o=Math.cos(n),l=Math.sin(n);return this.set(i*o,i*l,-i*(o*a+l*s)+a+e,-r*l,r*o,-r*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(is.makeScale(e,t)),this}rotate(e){return this.premultiply(is.makeRotation(-e)),this}translate(e,t){return this.premultiply(is.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,i=e.elements;for(let e=0;e<9;e++)if(t[e]!==i[e])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}let is=new ia,io=new ia().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),il=new ia().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),ih=(p=[.64,.33,.3,.6,.15,.06],A=[.2126,.7152,.0722],f=[.3127,.329],(d={enabled:!0,workingColorSpace:tW,spaces:{},convert:function(e,t,i){return!1!==this.enabled&&t!==i&&t&&i&&(this.spaces[t].transfer===tj&&(e.r=ic(e.r),e.g=ic(e.g),e.b=ic(e.b)),this.spaces[t].primaries!==this.spaces[i].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===tj&&(e.r=iu(e.r),e.g=iu(e.g),e.b=iu(e.b))),e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return""===e?tq:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,i){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(e,t){return t0("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),d.workingToColorSpace(e,t)},toWorkingColorSpace:function(e,t){return t0("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),d.colorSpaceToWorking(e,t)}}).define({[tW]:{primaries:p,whitePoint:f,transfer:tq,toXYZ:io,fromXYZ:il,luminanceCoefficients:A,workingColorSpaceConfig:{unpackColorSpace:tV},outputColorSpaceConfig:{drawingBufferColorSpace:tV}},[tV]:{primaries:p,whitePoint:f,transfer:tj,toXYZ:io,fromXYZ:il,luminanceCoefficients:A,outputColorSpaceConfig:{drawingBufferColorSpace:tV}}}),d);function ic(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function iu(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class id{static getDataURL(t,i="image/png"){let r;if(/^data:/i.test(t.src)||"u"<typeof HTMLCanvasElement)return t.src;if(t instanceof HTMLCanvasElement)r=t;else{void 0===e&&(e=tY("canvas")),e.width=t.width,e.height=t.height;let i=e.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),r=e}return r.toDataURL(i)}static sRGBToLinear(e){if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap){let t=tY("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let r=i.getImageData(0,0,e.width,e.height),n=r.data;for(let e=0;e<n.length;e++)n[e]=255*ic(n[e]/255);return i.putImageData(r,0,0),t}if(!e.data)return t$("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e;{let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*ic(t[e]/255)):t[e]=ic(t[e]);return{data:t,width:e.width,height:e.height}}}}let ip=0;class iA{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:ip++}),this.uuid=t5(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return"u">typeof HTMLVideoElement&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):"u">typeof VideoFrame&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):null!==t?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){!0===e&&this.version++}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];let i={uuid:this.uuid,url:""},r=this.data;if(null!==r){let e;if(Array.isArray(r)){e=[];for(let t=0,i=r.length;t<i;t++)r[t].isDataTexture?e.push(ig(r[t].image)):e.push(ig(r[t]))}else e=ig(r);i.url=e}return t||(e.images[this.uuid]=i),i}}function ig(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap?id.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(t$("Texture: Unable to serialize Texture."),{})}let im=0,iv=new it;class ib extends t1{constructor(e=ib.DEFAULT_IMAGE,t=ib.DEFAULT_MAPPING,i=1001,r=1001,n=1006,a=1008,s=1023,o=1009,l=ib.DEFAULT_ANISOTROPY,h=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:im++}),this.uuid=t5(),this.name="",this.source=new iA(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=n,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new t7(0,0),this.repeat=new t7(1,1),this.center=new t7(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ia,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!e&&!!e.depth&&e.depth>1,this.pmremVersion=0}get width(){return this.source.getSize(iv).x}get height(){return this.source.getSize(iv).y}get depth(){return this.source.getSize(iv).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let i=e[t];if(void 0===i){t$(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(void 0===r){t$(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[t]=i}}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}ib.DEFAULT_IMAGE=null,ib.DEFAULT_MAPPING=300,ib.DEFAULT_ANISOTROPY=1;class iy{constructor(e=0,t=0,i=0,r=1){iy.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,r=this.z,n=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*n,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*n,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*n,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*n,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,n,a=e.elements,s=a[0],o=a[4],l=a[8],h=a[1],c=a[5],u=a[9],d=a[2],p=a[6],A=a[10];if(.01>Math.abs(o-h)&&.01>Math.abs(l-d)&&.01>Math.abs(u-p)){if(.1>Math.abs(o+h)&&.1>Math.abs(l+d)&&.1>Math.abs(u+p)&&.1>Math.abs(s+c+A-3))return this.set(1,0,0,0),this;t=Math.PI;let e=(s+1)/2,a=(c+1)/2,f=(A+1)/2,g=(o+h)/4,m=(l+d)/4,v=(u+p)/4;return e>a&&e>f?e<.01?(i=0,r=.707106781,n=.707106781):(r=g/(i=Math.sqrt(e)),n=m/i):a>f?a<.01?(i=.707106781,r=0,n=.707106781):(i=g/(r=Math.sqrt(a)),n=v/r):f<.01?(i=.707106781,r=.707106781,n=0):(i=m/(n=Math.sqrt(f)),r=v/n),this.set(i,r,n,t),this}let f=Math.sqrt((p-u)*(p-u)+(l-d)*(l-d)+(h-o)*(h-o));return .001>Math.abs(f)&&(f=1),this.x=(p-u)/f,this.y=(l-d)/f,this.z=(h-o)/f,this.w=Math.acos((s+c+A-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=t8(this.x,e.x,t.x),this.y=t8(this.y,e.y,t.y),this.z=t8(this.z,e.z,t.z),this.w=t8(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=t8(this.x,e,t),this.y=t8(this.y,e,t),this.z=t8(this.z,e,t),this.w=t8(this.w,e,t),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(t8(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class ix extends t1{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new iy(0,0,e,t),this.scissorTest=!1,this.viewport=new iy(0,0,e,t);const r=new ib({width:e,height:t,depth:i.depth});this.textures=[];const n=i.count;for(let e=0;e<n;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){let t={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==e.mapping&&(t.mapping=e.mapping),void 0!==e.wrapS&&(t.wrapS=e.wrapS),void 0!==e.wrapT&&(t.wrapT=e.wrapT),void 0!==e.wrapR&&(t.wrapR=e.wrapR),void 0!==e.magFilter&&(t.magFilter=e.magFilter),void 0!==e.minFilter&&(t.minFilter=e.minFilter),void 0!==e.format&&(t.format=e.format),void 0!==e.type&&(t.type=e.type),void 0!==e.anisotropy&&(t.anisotropy=e.anisotropy),void 0!==e.colorSpace&&(t.colorSpace=e.colorSpace),void 0!==e.flipY&&(t.flipY=e.flipY),void 0!==e.generateMipmaps&&(t.generateMipmaps=e.generateMipmaps),void 0!==e.internalFormat&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==e&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,n=this.textures.length;r<n;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i,!0!==this.textures[r].isData3DTexture&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let i=Object.assign({},e.textures[t].image);this.textures[t].source=new iA(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class i_ extends ix{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class iE extends ib{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class iS extends ib{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class iC{constructor(e=new it(Infinity,Infinity,Infinity),t=new it(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(iw.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(iw.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=iw.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let i=e.geometry;if(void 0!==i){let r=i.getAttribute("position");if(!0===t&&void 0!==r&&!0!==e.isInstancedMesh)for(let t=0,i=r.count;t<i;t++)!0===e.isMesh?e.getVertexPosition(t,iw):iw.fromBufferAttribute(r,t),iw.applyMatrix4(e.matrixWorld),this.expandByPoint(iw);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),iI.copy(e.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),iI.copy(i.boundingBox)),iI.applyMatrix4(e.matrixWorld),this.union(iI)}let r=e.children;for(let e=0,i=r.length;e<i;e++)this.expandByObject(r[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,iw),iw.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(iU),iF.subVectors(this.max,iU),iT.subVectors(e.a,iU),iB.subVectors(e.b,iU),iR.subVectors(e.c,iU),iD.subVectors(iB,iT),iL.subVectors(iR,iB),iP.subVectors(iT,iR);let t=[0,-iD.z,iD.y,0,-iL.z,iL.y,0,-iP.z,iP.y,iD.z,0,-iD.x,iL.z,0,-iL.x,iP.z,0,-iP.x,-iD.y,iD.x,0,-iL.y,iL.x,0,-iP.y,iP.x,0];return!!ik(t,iT,iB,iR,iF)&&!!ik(t=[1,0,0,0,1,0,0,0,1],iT,iB,iR,iF)&&(iN.crossVectors(iD,iL),ik(t=[iN.x,iN.y,iN.z],iT,iB,iR,iF))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,iw).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(iw).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(iM[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),iM[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),iM[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),iM[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),iM[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),iM[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),iM[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),iM[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(iM)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}let iM=[new it,new it,new it,new it,new it,new it,new it,new it],iw=new it,iI=new iC,iT=new it,iB=new it,iR=new it,iD=new it,iL=new it,iP=new it,iU=new it,iF=new it,iN=new it,iO=new it;function ik(e,t,i,r,n){for(let a=0,s=e.length-3;a<=s;a+=3){iO.fromArray(e,a);let s=n.x*Math.abs(iO.x)+n.y*Math.abs(iO.y)+n.z*Math.abs(iO.z),o=t.dot(iO),l=i.dot(iO),h=r.dot(iO);if(Math.max(-Math.max(o,l,h),Math.min(o,l,h))>s)return!1}return!0}let iQ=new iC,iG=new it,iH=new it;class iz{constructor(e=new it,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;void 0!==t?i.copy(t):iQ.setFromPoints(e).getCenter(i);let r=0;for(let t=0,n=e.length;t<n;t++)r=Math.max(r,i.distanceToSquared(e[t]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?e.makeEmpty():(e.set(this.center,this.center),e.expandByScalar(this.radius)),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;iG.subVectors(e,this.center);let t=iG.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),i=(e-this.radius)*.5;this.center.addScaledVector(iG,i/e),this.radius+=i}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(iH.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(iG.copy(e.center).add(iH)),this.expandByPoint(iG.copy(e.center).sub(iH)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let iV=new it,iW=new it,iq=new it,ij=new it,iX=new it,iY=new it,iK=new it;class iJ{constructor(e=new it,t=new it(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,iV)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=iV.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(iV.copy(this.origin).addScaledVector(this.direction,t),iV.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){let n,a,s,o;iW.copy(e).add(t).multiplyScalar(.5),iq.copy(t).sub(e).normalize(),ij.copy(this.origin).sub(iW);let l=.5*e.distanceTo(t),h=-this.direction.dot(iq),c=ij.dot(this.direction),u=-ij.dot(iq),d=ij.lengthSq(),p=Math.abs(1-h*h);if(p>0)if(n=h*u-c,a=h*c-u,o=l*p,n>=0)if(a>=-o)if(a<=o){let e=1/p;n*=e,a*=e,s=n*(n+h*a+2*c)+a*(h*n+a+2*u)+d}else s=-(n=Math.max(0,-(h*(a=l)+c)))*n+a*(a+2*u)+d;else s=-(n=Math.max(0,-(h*(a=-l)+c)))*n+a*(a+2*u)+d;else a<=-o?(a=(n=Math.max(0,-(-h*l+c)))>0?-l:Math.min(Math.max(-l,-u),l),s=-n*n+a*(a+2*u)+d):a<=o?(n=0,s=(a=Math.min(Math.max(-l,-u),l))*(a+2*u)+d):(a=(n=Math.max(0,-(h*l+c)))>0?l:Math.min(Math.max(-l,-u),l),s=-n*n+a*(a+2*u)+d);else a=h>0?-l:l,s=-(n=Math.max(0,-(h*a+c)))*n+a*(a+2*u)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,n),r&&r.copy(iW).addScaledVector(iq,a),s}intersectSphere(e,t){iV.subVectors(e.center,this.origin);let i=iV.dot(this.direction),r=iV.dot(iV)-i*i,n=e.radius*e.radius;if(r>n)return null;let a=Math.sqrt(n-r),s=i-a,o=i+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return null===i?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return!!(0===t||e.normal.dot(this.direction)*t<0)}intersectBox(e,t){let i,r,n,a,s,o,l=1/this.direction.x,h=1/this.direction.y,c=1/this.direction.z,u=this.origin;return(l>=0?(i=(e.min.x-u.x)*l,r=(e.max.x-u.x)*l):(i=(e.max.x-u.x)*l,r=(e.min.x-u.x)*l),h>=0?(n=(e.min.y-u.y)*h,a=(e.max.y-u.y)*h):(n=(e.max.y-u.y)*h,a=(e.min.y-u.y)*h),i>a||n>r||((n>i||isNaN(i))&&(i=n),(a<r||isNaN(r))&&(r=a),c>=0?(s=(e.min.z-u.z)*c,o=(e.max.z-u.z)*c):(s=(e.max.z-u.z)*c,o=(e.min.z-u.z)*c),i>o||s>r||((s>i||i!=i)&&(i=s),(o<r||r!=r)&&(r=o),r<0)))?null:this.at(i>=0?i:r,t)}intersectsBox(e){return null!==this.intersectBox(e,iV)}intersectTriangle(e,t,i,r,n){let a;iX.subVectors(t,e),iY.subVectors(i,e),iK.crossVectors(iX,iY);let s=this.direction.dot(iK);if(s>0){if(r)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}ij.subVectors(this.origin,e);let o=a*this.direction.dot(iY.crossVectors(ij,iY));if(o<0)return null;let l=a*this.direction.dot(iX.cross(ij));if(l<0||o+l>s)return null;let h=-a*ij.dot(iK);return h<0?null:this.at(h/s,n)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class i${constructor(e,t,i,r,n,a,s,o,l,h,c,u,d,p,A,f){i$.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,i,r,n,a,s,o,l,h,c,u,d,p,A,f)}set(e,t,i,r,n,a,s,o,l,h,c,u,d,p,A,f){let g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=r,g[1]=n,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=h,g[10]=c,g[14]=u,g[3]=d,g[7]=p,g[11]=A,g[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new i$().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return 0===this.determinant()?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1)):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2)),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(0===e.determinant())return this.identity();let t=this.elements,i=e.elements,r=1/iZ.setFromMatrixColumn(e,0).length(),n=1/iZ.setFromMatrixColumn(e,1).length(),a=1/iZ.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*n,t[5]=i[5]*n,t[6]=i[6]*n,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,i=e.x,r=e.y,n=e.z,a=Math.cos(i),s=Math.sin(i),o=Math.cos(r),l=Math.sin(r),h=Math.cos(n),c=Math.sin(n);if("XYZ"===e.order){let e=a*h,i=a*c,r=s*h,n=s*c;t[0]=o*h,t[4]=-o*c,t[8]=l,t[1]=i+r*l,t[5]=e-n*l,t[9]=-s*o,t[2]=n-e*l,t[6]=r+i*l,t[10]=a*o}else if("YXZ"===e.order){let e=o*h,i=o*c,r=l*h,n=l*c;t[0]=e+n*s,t[4]=r*s-i,t[8]=a*l,t[1]=a*c,t[5]=a*h,t[9]=-s,t[2]=i*s-r,t[6]=n+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*h,i=o*c,r=l*h,n=l*c;t[0]=e-n*s,t[4]=-a*c,t[8]=r+i*s,t[1]=i+r*s,t[5]=a*h,t[9]=n-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*h,i=a*c,r=s*h,n=s*c;t[0]=o*h,t[4]=r*l-i,t[8]=e*l+n,t[1]=o*c,t[5]=n*l+e,t[9]=i*l-r,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,i=a*l,r=s*o,n=s*l;t[0]=o*h,t[4]=n-e*c,t[8]=r*c+i,t[1]=c,t[5]=a*h,t[9]=-s*h,t[2]=-l*h,t[6]=i*c+r,t[10]=e-n*c}else if("XZY"===e.order){let e=a*o,i=a*l,r=s*o,n=s*l;t[0]=o*h,t[4]=-c,t[8]=l*h,t[1]=e*c+n,t[5]=a*h,t[9]=i*c-r,t[2]=r*c-i,t[6]=s*h,t[10]=n*c+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(i1,e,i2)}lookAt(e,t,i){let r=this.elements;return i5.subVectors(e,t),0===i5.lengthSq()&&(i5.z=1),i5.normalize(),i3.crossVectors(i,i5),0===i3.lengthSq()&&(1===Math.abs(i.z)?i5.x+=1e-4:i5.z+=1e-4,i5.normalize(),i3.crossVectors(i,i5)),i3.normalize(),i4.crossVectors(i5,i3),r[0]=i3.x,r[4]=i4.x,r[8]=i5.x,r[1]=i3.y,r[5]=i4.y,r[9]=i5.y,r[2]=i3.z,r[6]=i4.z,r[10]=i5.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,r=t.elements,n=this.elements,a=i[0],s=i[4],o=i[8],l=i[12],h=i[1],c=i[5],u=i[9],d=i[13],p=i[2],A=i[6],f=i[10],g=i[14],m=i[3],v=i[7],b=i[11],y=i[15],x=r[0],_=r[4],E=r[8],S=r[12],C=r[1],M=r[5],w=r[9],I=r[13],T=r[2],B=r[6],R=r[10],D=r[14],L=r[3],P=r[7],U=r[11],F=r[15];return n[0]=a*x+s*C+o*T+l*L,n[4]=a*_+s*M+o*B+l*P,n[8]=a*E+s*w+o*R+l*U,n[12]=a*S+s*I+o*D+l*F,n[1]=h*x+c*C+u*T+d*L,n[5]=h*_+c*M+u*B+d*P,n[9]=h*E+c*w+u*R+d*U,n[13]=h*S+c*I+u*D+d*F,n[2]=p*x+A*C+f*T+g*L,n[6]=p*_+A*M+f*B+g*P,n[10]=p*E+A*w+f*R+g*U,n[14]=p*S+A*I+f*D+g*F,n[3]=m*x+v*C+b*T+y*L,n[7]=m*_+v*M+b*B+y*P,n[11]=m*E+v*w+b*R+y*U,n[15]=m*S+v*I+b*D+y*F,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],r=e[8],n=e[12],a=e[1],s=e[5],o=e[9],l=e[13],h=e[2],c=e[6],u=e[10],d=e[14],p=e[3],A=e[7],f=e[11],g=e[15],m=o*d-l*u,v=s*d-l*c,b=s*u-o*c,y=a*d-l*h,x=a*u-o*h,_=a*c-s*h;return t*(A*m-f*v+g*b)-i*(p*m-f*y+g*x)+r*(p*v-A*y+g*_)-n*(p*b-A*x+f*_)}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,i){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8],c=e[9],u=e[10],d=e[11],p=e[12],A=e[13],f=e[14],g=e[15],m=c*f*l-A*u*l+A*o*d-s*f*d-c*o*g+s*u*g,v=p*u*l-h*f*l-p*o*d+a*f*d+h*o*g-a*u*g,b=h*A*l-p*c*l+p*s*d-a*A*d-h*s*g+a*c*g,y=p*c*o-h*A*o-p*s*u+a*A*u+h*s*f-a*c*f,x=t*m+i*v+r*b+n*y;if(0===x)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let _=1/x;return e[0]=m*_,e[1]=(A*u*n-c*f*n-A*r*d+i*f*d+c*r*g-i*u*g)*_,e[2]=(s*f*n-A*o*n+A*r*l-i*f*l-s*r*g+i*o*g)*_,e[3]=(c*o*n-s*u*n-c*r*l+i*u*l+s*r*d-i*o*d)*_,e[4]=v*_,e[5]=(h*f*n-p*u*n+p*r*d-t*f*d-h*r*g+t*u*g)*_,e[6]=(p*o*n-a*f*n-p*r*l+t*f*l+a*r*g-t*o*g)*_,e[7]=(a*u*n-h*o*n+h*r*l-t*u*l-a*r*d+t*o*d)*_,e[8]=b*_,e[9]=(p*c*n-h*A*n-p*i*d+t*A*d+h*i*g-t*c*g)*_,e[10]=(a*A*n-p*s*n+p*i*l-t*A*l-a*i*g+t*s*g)*_,e[11]=(h*s*n-a*c*n-h*i*l+t*c*l+a*i*d-t*s*d)*_,e[12]=y*_,e[13]=(h*A*r-p*c*r+p*i*u-t*A*u-h*i*f+t*c*f)*_,e[14]=(p*s*r-a*A*r-p*i*o+t*A*o+a*i*f-t*s*f)*_,e[15]=(a*c*r-h*s*r+h*i*o-t*c*o-a*i*u+t*s*u)*_,this}scale(e){let t=this.elements,i=e.x,r=e.y,n=e.z;return t[0]*=i,t[4]*=r,t[8]*=n,t[1]*=i,t[5]*=r,t[9]*=n,t[2]*=i,t[6]*=r,t[10]*=n,t[3]*=i,t[7]*=r,t[11]*=n,this}getMaxScaleOnAxis(){let e=this.elements;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),r=Math.sin(t),n=1-i,a=e.x,s=e.y,o=e.z,l=n*a,h=n*s;return this.set(l*a+i,l*s-r*o,l*o+r*s,0,l*s+r*o,h*s+i,h*o-r*a,0,l*o-r*s,h*o+r*a,n*o*o+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,n,a){return this.set(1,i,n,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){let r=this.elements,n=t._x,a=t._y,s=t._z,o=t._w,l=n+n,h=a+a,c=s+s,u=n*l,d=n*h,p=n*c,A=a*h,f=a*c,g=s*c,m=o*l,v=o*h,b=o*c,y=i.x,x=i.y,_=i.z;return r[0]=(1-(A+g))*y,r[1]=(d+b)*y,r[2]=(p-v)*y,r[3]=0,r[4]=(d-b)*x,r[5]=(1-(u+g))*x,r[6]=(f+m)*x,r[7]=0,r[8]=(p+v)*_,r[9]=(f-m)*_,r[10]=(1-(u+A))*_,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){let r=this.elements;if(e.x=r[12],e.y=r[13],e.z=r[14],0===this.determinant())return i.set(1,1,1),t.identity(),this;let n=iZ.set(r[0],r[1],r[2]).length(),a=iZ.set(r[4],r[5],r[6]).length(),s=iZ.set(r[8],r[9],r[10]).length();0>this.determinant()&&(n=-n),i0.copy(this);let o=1/n,l=1/a,h=1/s;return i0.elements[0]*=o,i0.elements[1]*=o,i0.elements[2]*=o,i0.elements[4]*=l,i0.elements[5]*=l,i0.elements[6]*=l,i0.elements[8]*=h,i0.elements[9]*=h,i0.elements[10]*=h,t.setFromRotationMatrix(i0),i.x=n,i.y=a,i.z=s,this}makePerspective(e,t,i,r,n,a,s=2e3,o=!1){let l,h,c=this.elements;if(o)l=n/(a-n),h=a*n/(a-n);else if(2e3===s)l=-(a+n)/(a-n),h=-2*a*n/(a-n);else if(2001===s)l=-a/(a-n),h=-a*n/(a-n);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);return c[0]=2*n/(t-e),c[4]=0,c[8]=(t+e)/(t-e),c[12]=0,c[1]=0,c[5]=2*n/(i-r),c[9]=(i+r)/(i-r),c[13]=0,c[2]=0,c[6]=0,c[10]=l,c[14]=h,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,r,n,a,s=2e3,o=!1){let l,h,c=this.elements;if(o)l=1/(a-n),h=a/(a-n);else if(2e3===s)l=-2/(a-n),h=-(a+n)/(a-n);else if(2001===s)l=-1/(a-n),h=-n/(a-n);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return c[0]=2/(t-e),c[4]=0,c[8]=0,c[12]=-(t+e)/(t-e),c[1]=0,c[5]=2/(i-r),c[9]=0,c[13]=-(i+r)/(i-r),c[2]=0,c[6]=0,c[10]=l,c[14]=h,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let e=0;e<16;e++)if(t[e]!==i[e])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}let iZ=new it,i0=new i$,i1=new it(0,0,0),i2=new it(1,1,1),i3=new it,i4=new it,i5=new it,i8=new i$,i9=new ie;class i6{constructor(e=0,t=0,i=0,r=i6.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){let r=e.elements,n=r[0],a=r[4],s=r[8],o=r[1],l=r[5],h=r[9],c=r[2],u=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(t8(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-a,n)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-t8(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,n),this._z=0);break;case"ZXY":this._x=Math.asin(t8(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,n));break;case"ZYX":this._y=Math.asin(-t8(c,-1,1)),.9999999>Math.abs(c)?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,n)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(t8(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-c,n)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-t8(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(u,l),this._y=Math.atan2(s,n)):(this._x=Math.atan2(-h,d),this._y=0);break;default:t$("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===i&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return i8.makeRotationFromQuaternion(e),this.setFromRotationMatrix(i8,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return i9.setFromEuler(this),this.setFromQuaternion(i9,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}i6.DEFAULT_ORDER="XYZ";class i7{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&1<<e)!=0}}let re=0,rt=new it,ri=new ie,rr=new i$,rn=new it,ra=new it,rs=new it,ro=new ie,rl=new it(1,0,0),rh=new it(0,1,0),rc=new it(0,0,1),ru={type:"added"},rd={type:"removed"},rp={type:"childadded",child:null},rA={type:"childremoved",child:null};class rf extends t1{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:re++}),this.uuid=t5(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=rf.DEFAULT_UP.clone();const e=new it,t=new i6,i=new ie,r=new it(1,1,1);t._onChange(function(){i.setFromEuler(t,!1)}),i._onChange(function(){t.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new i$},normalMatrix:{value:new ia}}),this.matrix=new i$,this.matrixWorld=new i$,this.matrixAutoUpdate=rf.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=rf.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new i7,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return ri.setFromAxisAngle(e,t),this.quaternion.multiply(ri),this}rotateOnWorldAxis(e,t){return ri.setFromAxisAngle(e,t),this.quaternion.premultiply(ri),this}rotateX(e){return this.rotateOnAxis(rl,e)}rotateY(e){return this.rotateOnAxis(rh,e)}rotateZ(e){return this.rotateOnAxis(rc,e)}translateOnAxis(e,t){return rt.copy(e).applyQuaternion(this.quaternion),this.position.add(rt.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(rl,e)}translateY(e){return this.translateOnAxis(rh,e)}translateZ(e){return this.translateOnAxis(rc,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(rr.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?rn.copy(e):rn.set(e,t,i);let r=this.parent;this.updateWorldMatrix(!0,!1),ra.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?rr.lookAt(ra,rn,this.up):rr.lookAt(rn,ra,this.up),this.quaternion.setFromRotationMatrix(rr),r&&(rr.extractRotation(r.matrixWorld),ri.setFromRotationMatrix(rr),this.quaternion.premultiply(ri.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?tZ("Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(ru),rp.child=e,this.dispatchEvent(rp),rp.child=null):tZ("Object3D.add: object not an instance of THREE.Object3D.",e),this}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return -1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(rd),rA.child=e,this.dispatchEvent(rA),rA.child=null),this}removeFromParent(){let e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),rr.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),rr.multiply(e.parent.matrixWorld)),e.applyMatrix4(rr),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(ru),rp.child=e,this.dispatchEvent(rp),rp.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){let r=this.children[i].getObjectByProperty(e,t);if(void 0!==r)return r}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);let r=this.children;for(let n=0,a=r.length;n<a;n++)r[n].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ra,e,rs),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ra,ro,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){let t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){let i=this.parent;if(!0===e&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===t){let e=this.children;for(let t=0,i=e.length;t<i;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){let t=void 0===e||"string"==typeof e,i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let r={};function n(t,i){return void 0===t[i.uuid]&&(t[i.uuid]=i.toJSON(e)),i.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),null!==this._colorsTexture&&(r.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(r.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(r.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=n(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let i=t.shapes;if(Array.isArray(i))for(let t=0,r=i.length;t<r;t++){let r=i[t];n(e.shapes,r)}else n(e.shapes,i)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(n(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){let t=[];for(let i=0,r=this.material.length;i<r;i++)t.push(n(e.materials,this.material[i]));r.material=t}else r.material=n(e.materials,this.material);if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){let i=this.animations[t];r.animations.push(n(e.animations,i))}}if(t){let t=a(e.geometries),r=a(e.materials),n=a(e.textures),s=a(e.images),o=a(e.shapes),l=a(e.skeletons),h=a(e.animations),c=a(e.nodes);t.length>0&&(i.geometries=t),r.length>0&&(i.materials=r),n.length>0&&(i.textures=n),s.length>0&&(i.images=s),o.length>0&&(i.shapes=o),l.length>0&&(i.skeletons=l),h.length>0&&(i.animations=h),c.length>0&&(i.nodes=c)}return i.object=r,i;function a(e){let t=[];for(let i in e){let r=e[i];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){let i=e.children[t];this.add(i.clone())}return this}}rf.DEFAULT_UP=new it(0,1,0),rf.DEFAULT_MATRIX_AUTO_UPDATE=!0,rf.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let rg=new it,rm=new it,rv=new it,rb=new it,ry=new it,rx=new it,r_=new it,rE=new it,rS=new it,rC=new it,rM=new iy,rw=new iy,rI=new iy;class rT{constructor(e=new it,t=new it,i=new it){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),rg.subVectors(e,t),r.cross(rg);let n=r.lengthSq();return n>0?r.multiplyScalar(1/Math.sqrt(n)):r.set(0,0,0)}static getBarycoord(e,t,i,r,n){rg.subVectors(r,t),rm.subVectors(i,t),rv.subVectors(e,t);let a=rg.dot(rg),s=rg.dot(rm),o=rg.dot(rv),l=rm.dot(rm),h=rm.dot(rv),c=a*l-s*s;if(0===c)return n.set(0,0,0),null;let u=1/c,d=(l*o-s*h)*u,p=(a*h-s*o)*u;return n.set(1-d-p,p,d)}static containsPoint(e,t,i,r){return null!==this.getBarycoord(e,t,i,r,rb)&&rb.x>=0&&rb.y>=0&&rb.x+rb.y<=1}static getInterpolation(e,t,i,r,n,a,s,o){return null===this.getBarycoord(e,t,i,r,rb)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(n,rb.x),o.addScaledVector(a,rb.y),o.addScaledVector(s,rb.z),o)}static getInterpolatedAttribute(e,t,i,r,n,a){return rM.setScalar(0),rw.setScalar(0),rI.setScalar(0),rM.fromBufferAttribute(e,t),rw.fromBufferAttribute(e,i),rI.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(rM,n.x),a.addScaledVector(rw,n.y),a.addScaledVector(rI,n.z),a}static isFrontFacing(e,t,i,r){return rg.subVectors(i,t),rm.subVectors(e,t),0>rg.cross(rm).dot(r)}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return rg.subVectors(this.c,this.b),rm.subVectors(this.a,this.b),.5*rg.cross(rm).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return rT.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return rT.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,n){return rT.getInterpolation(e,this.a,this.b,this.c,t,i,r,n)}containsPoint(e){return rT.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return rT.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i,r,n=this.a,a=this.b,s=this.c;ry.subVectors(a,n),rx.subVectors(s,n),rE.subVectors(e,n);let o=ry.dot(rE),l=rx.dot(rE);if(o<=0&&l<=0)return t.copy(n);rS.subVectors(e,a);let h=ry.dot(rS),c=rx.dot(rS);if(h>=0&&c<=h)return t.copy(a);let u=o*c-h*l;if(u<=0&&o>=0&&h<=0)return i=o/(o-h),t.copy(n).addScaledVector(ry,i);rC.subVectors(e,s);let d=ry.dot(rC),p=rx.dot(rC);if(p>=0&&d<=p)return t.copy(s);let A=d*l-o*p;if(A<=0&&l>=0&&p<=0)return r=l/(l-p),t.copy(n).addScaledVector(rx,r);let f=h*p-d*c;if(f<=0&&c-h>=0&&d-p>=0)return r_.subVectors(s,a),r=(c-h)/(c-h+(d-p)),t.copy(a).addScaledVector(r_,r);let g=1/(f+A+u);return i=A*g,r=u*g,t.copy(n).addScaledVector(ry,i).addScaledVector(rx,r)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let rB={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},rR={h:0,s:0,l:0},rD={h:0,s:0,l:0};function rL(e,t,i){return(i<0&&(i+=1),i>1&&(i-=1),i<1/6)?e+(t-e)*6*i:i<.5?t:i<2/3?e+(t-e)*6*(2/3-i):e}class rP{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){return void 0===t&&void 0===i?e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e):this.setRGB(e,t,i),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=tV){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,ih.colorSpaceToWorking(this,t),this}setRGB(e,t,i,r=ih.workingColorSpace){return this.r=e,this.g=t,this.b=i,ih.colorSpaceToWorking(this,r),this}setHSL(e,t,i,r=ih.workingColorSpace){if(e=(e%1+1)%1,t=t8(t,0,1),i=t8(i,0,1),0===t)this.r=this.g=this.b=i;else{let r=i<=.5?i*(1+t):i+t-i*t,n=2*i-r;this.r=rL(n,r,e+1/3),this.g=rL(n,r,e),this.b=rL(n,r,e-1/3)}return ih.colorSpaceToWorking(this,r),this}setStyle(e,t=tV){let i;function r(t){void 0!==t&&1>parseFloat(t)&&t$("Color: Alpha component of "+e+" will be ignored.")}if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let n,a=i[1],s=i[2];switch(a){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(n[4]),this.setRGB(Math.min(255,parseInt(n[1],10))/255,Math.min(255,parseInt(n[2],10))/255,Math.min(255,parseInt(n[3],10))/255,t);if(n=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(n[4]),this.setRGB(Math.min(100,parseInt(n[1],10))/100,Math.min(100,parseInt(n[2],10))/100,Math.min(100,parseInt(n[3],10))/100,t);break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(n[4]),this.setHSL(parseFloat(n[1])/360,parseFloat(n[2])/100,parseFloat(n[3])/100,t);break;default:t$("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=i[1],n=r.length;if(3===n)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(6===n)return this.setHex(parseInt(r,16),t);t$("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=tV){let i=rB[e.toLowerCase()];return void 0!==i?this.setHex(i,t):t$("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ic(e.r),this.g=ic(e.g),this.b=ic(e.b),this}copyLinearToSRGB(e){return this.r=iu(e.r),this.g=iu(e.g),this.b=iu(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=tV){return ih.workingToColorSpace(rU.copy(this),e),65536*Math.round(t8(255*rU.r,0,255))+256*Math.round(t8(255*rU.g,0,255))+Math.round(t8(255*rU.b,0,255))}getHexString(e=tV){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ih.workingColorSpace){let i,r;ih.workingToColorSpace(rU.copy(this),t);let n=rU.r,a=rU.g,s=rU.b,o=Math.max(n,a,s),l=Math.min(n,a,s),h=(l+o)/2;if(l===o)i=0,r=0;else{let e=o-l;switch(r=h<=.5?e/(o+l):e/(2-o-l),o){case n:i=(a-s)/e+6*(a<s);break;case a:i=(s-n)/e+2;break;case s:i=(n-a)/e+4}i/=6}return e.h=i,e.s=r,e.l=h,e}getRGB(e,t=ih.workingColorSpace){return ih.workingToColorSpace(rU.copy(this),t),e.r=rU.r,e.g=rU.g,e.b=rU.b,e}getStyle(e=tV){ih.workingToColorSpace(rU.copy(this),e);let t=rU.r,i=rU.g,r=rU.b;return e!==tV?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*i)},${Math.round(255*r)})`}offsetHSL(e,t,i){return this.getHSL(rR),this.setHSL(rR.h+e,rR.s+t,rR.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){var i,r,n,a,s,o,l,h,c;this.getHSL(rR),e.getHSL(rD);let u=(i=rR.h,r=rD.h,(1-(n=t))*i+n*r),d=(a=rR.s,s=rD.s,(1-(o=t))*a+o*s),p=(l=rR.l,h=rD.l,(1-(c=t))*l+c*h);return this.setHSL(u,d,p),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,i=this.g,r=this.b,n=e.elements;return this.r=n[0]*t+n[3]*i+n[6]*r,this.g=n[1]*t+n[4]*i+n[7]*r,this.b=n[2]*t+n[5]*i+n[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}let rU=new rP;rP.NAMES=rB;let rF=0;class rN extends t1{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:rF++}),this.uuid=t5(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new rP(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let i=e[t];if(void 0===i){t$(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(void 0===r){t$(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function r(e){let t=[];for(let i in e){let r=e[i];delete r.metadata,t.push(r)}return t}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),100!==this.blendEquation&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),7680!==this.stencilFail&&(i.stencilFail=this.stencilFail),7680!==this.stencilZFail&&(i.stencilZFail=this.stencilZFail),7680!==this.stencilZPass&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!1===this.allowOverride&&(i.allowOverride=!1),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),t){let t=r(e.textures),n=r(e.images);t.length>0&&(i.textures=t),n.length>0&&(i.images=n)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(null!==t){let e=t.length;i=Array(e);for(let r=0;r!==e;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}class rO extends rN{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new rP(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new i6,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}let rk=function(){let e=new ArrayBuffer(4),t=new Float32Array(e),i=new Uint32Array(e),r=new Uint32Array(512),n=new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(r[e]=0,r[256|e]=32768,n[e]=24,n[256|e]=24):t<-14?(r[e]=1024>>-t-14,r[256|e]=1024>>-t-14|32768,n[e]=-t-1,n[256|e]=-t-1):t<=15?(r[e]=t+15<<10,r[256|e]=t+15<<10|32768,n[e]=13,n[256|e]=13):t<128?(r[e]=31744,r[256|e]=64512,n[e]=24,n[256|e]=24):(r[e]=31744,r[256|e]=64512,n[e]=13,n[256|e]=13)}let a=new Uint32Array(2048),s=new Uint32Array(64),o=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,i=0;for(;(8388608&t)==0;)t<<=1,i-=8388608;t&=-8388609,i+=0x38800000,a[e]=t|i}for(let e=1024;e<2048;++e)a[e]=0x38000000+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=0x47800000,s[32]=0x80000000;for(let e=33;e<63;++e)s[e]=0x80000000+(e-32<<23);s[63]=0xc7800000;for(let e=1;e<64;++e)32!==e&&(o[e]=1024);return{floatView:t,uint32View:i,baseTable:r,shiftTable:n,mantissaTable:a,exponentTable:s,offsetTable:o}}();class rQ{static toHalfFloat(e){var t;let i,r;return Math.abs(t=e)>65504&&t$("DataUtils.toHalfFloat(): Value out of range."),t=t8(t,-65504,65504),rk.floatView[0]=t,r=(i=rk.uint32View[0])>>23&511,rk.baseTable[r]+((8388607&i)>>rk.shiftTable[r])}static fromHalfFloat(e){let t;return t=e>>10,rk.uint32View[0]=rk.mantissaTable[rk.offsetTable[t]+(1023&e)]+rk.exponentTable[t],rk.floatView[0]}}let rG=new it,rH=new t7,rz=0;class rV{constructor(e,t,i=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:rz++}),this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=i,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,n=this.itemSize;r<n;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,i=this.count;t<i;t++)rH.fromBufferAttribute(this,t),rH.applyMatrix3(e),this.setXY(t,rH.x,rH.y);else if(3===this.itemSize)for(let t=0,i=this.count;t<i;t++)rG.fromBufferAttribute(this,t),rG.applyMatrix3(e),this.setXYZ(t,rG.x,rG.y,rG.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)rG.fromBufferAttribute(this,t),rG.applyMatrix4(e),this.setXYZ(t,rG.x,rG.y,rG.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)rG.fromBufferAttribute(this,t),rG.applyNormalMatrix(e),this.setXYZ(t,rG.x,rG.y,rG.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)rG.fromBufferAttribute(this,t),rG.transformDirection(e),this.setXYZ(t,rG.x,rG.y,rG.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=t9(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=t6(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=t9(t,this.array)),t}setX(e,t){return this.normalized&&(t=t6(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=t9(t,this.array)),t}setY(e,t){return this.normalized&&(t=t6(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=t9(t,this.array)),t}setZ(e,t){return this.normalized&&(t=t6(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=t9(t,this.array)),t}setW(e,t){return this.normalized&&(t=t6(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=t6(t,this.array),i=t6(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=t6(t,this.array),i=t6(i,this.array),r=t6(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,n){return e*=this.itemSize,this.normalized&&(t=t6(t,this.array),i=t6(i,this.array),r=t6(r,this.array),n=t6(n,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=n,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),35044!==this.usage&&(e.usage=this.usage),e}}class rW extends rV{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class rq extends rV{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class rj extends rV{constructor(e,t,i){super(new Float32Array(e),t,i)}}let rX=0,rY=new i$,rK=new rf,rJ=new it,r$=new iC,rZ=new iC,r0=new it;class r1 extends t1{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:rX++}),this.uuid=t5(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(tX(e)?rq:rW)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(void 0!==i){let t=new ia().getNormalMatrix(e);i.applyNormalMatrix(t),i.needsUpdate=!0}let r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return rY.makeRotationFromQuaternion(e),this.applyMatrix4(rY),this}rotateX(e){return rY.makeRotationX(e),this.applyMatrix4(rY),this}rotateY(e){return rY.makeRotationY(e),this.applyMatrix4(rY),this}rotateZ(e){return rY.makeRotationZ(e),this.applyMatrix4(rY),this}translate(e,t,i){return rY.makeTranslation(e,t,i),this.applyMatrix4(rY),this}scale(e,t,i){return rY.makeScale(e,t,i),this.applyMatrix4(rY),this}lookAt(e){return rK.lookAt(e),rK.updateMatrix(),this.applyMatrix4(rK.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(rJ).negate(),this.translate(rJ.x,rJ.y,rJ.z),this}setFromPoints(e){let t=this.getAttribute("position");if(void 0===t){let t=[];for(let i=0,r=e.length;i<r;i++){let r=e[i];t.push(r.x,r.y,r.z||0)}this.setAttribute("position",new rj(t,3))}else{let i=Math.min(e.length,t.count);for(let r=0;r<i;r++){let i=e[r];t.setXYZ(r,i.x,i.y,i.z||0)}e.length>t.count&&t$("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new iC);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){tZ("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new it(-1/0,-1/0,-1/0),new it(Infinity,Infinity,Infinity));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){let i=t[e];r$.setFromBufferAttribute(i),this.morphTargetsRelative?(r0.addVectors(this.boundingBox.min,r$.min),this.boundingBox.expandByPoint(r0),r0.addVectors(this.boundingBox.max,r$.max),this.boundingBox.expandByPoint(r0)):(this.boundingBox.expandByPoint(r$.min),this.boundingBox.expandByPoint(r$.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&tZ('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new iz);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){tZ("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new it,1/0);return}if(e){let i=this.boundingSphere.center;if(r$.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){let i=t[e];rZ.setFromBufferAttribute(i),this.morphTargetsRelative?(r0.addVectors(r$.min,rZ.min),r$.expandByPoint(r0),r0.addVectors(r$.max,rZ.max),r$.expandByPoint(r0)):(r$.expandByPoint(rZ.min),r$.expandByPoint(rZ.max))}r$.getCenter(i);let r=0;for(let t=0,n=e.count;t<n;t++)r0.fromBufferAttribute(e,t),r=Math.max(r,i.distanceToSquared(r0));if(t)for(let n=0,a=t.length;n<a;n++){let a=t[n],s=this.morphTargetsRelative;for(let t=0,n=a.count;t<n;t++)r0.fromBufferAttribute(a,t),s&&(rJ.fromBufferAttribute(e,t),r0.add(rJ)),r=Math.max(r,i.distanceToSquared(r0))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&tZ('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void tZ("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");let i=t.position,r=t.normal,n=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new rV(new Float32Array(4*i.count),4));let a=this.getAttribute("tangent"),s=[],o=[];for(let e=0;e<i.count;e++)s[e]=new it,o[e]=new it;let l=new it,h=new it,c=new it,u=new t7,d=new t7,p=new t7,A=new it,f=new it,g=this.groups;0===g.length&&(g=[{start:0,count:e.count}]);for(let t=0,r=g.length;t<r;++t){let r=g[t],a=r.start,m=r.count;for(let t=a,r=a+m;t<r;t+=3)!function(e,t,r){l.fromBufferAttribute(i,e),h.fromBufferAttribute(i,t),c.fromBufferAttribute(i,r),u.fromBufferAttribute(n,e),d.fromBufferAttribute(n,t),p.fromBufferAttribute(n,r),h.sub(l),c.sub(l),d.sub(u),p.sub(u);let a=1/(d.x*p.y-p.x*d.y);isFinite(a)&&(A.copy(h).multiplyScalar(p.y).addScaledVector(c,-d.y).multiplyScalar(a),f.copy(c).multiplyScalar(d.x).addScaledVector(h,-p.x).multiplyScalar(a),s[e].add(A),s[t].add(A),s[r].add(A),o[e].add(f),o[t].add(f),o[r].add(f))}(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let m=new it,v=new it,b=new it,y=new it;function x(e){b.fromBufferAttribute(r,e),y.copy(b);let t=s[e];m.copy(t),m.sub(b.multiplyScalar(b.dot(t))).normalize(),v.crossVectors(y,t);let i=v.dot(o[e]);a.setXYZW(e,m.x,m.y,m.z,i<0?-1:1)}for(let t=0,i=g.length;t<i;++t){let i=g[t],r=i.start,n=i.count;for(let t=r,i=r+n;t<i;t+=3)x(e.getX(t+0)),x(e.getX(t+1)),x(e.getX(t+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(void 0!==t){let i=this.getAttribute("normal");if(void 0===i)i=new rV(new Float32Array(3*t.count),3),this.setAttribute("normal",i);else for(let e=0,t=i.count;e<t;e++)i.setXYZ(e,0,0,0);let r=new it,n=new it,a=new it,s=new it,o=new it,l=new it,h=new it,c=new it;if(e)for(let u=0,d=e.count;u<d;u+=3){let d=e.getX(u+0),p=e.getX(u+1),A=e.getX(u+2);r.fromBufferAttribute(t,d),n.fromBufferAttribute(t,p),a.fromBufferAttribute(t,A),h.subVectors(a,n),c.subVectors(r,n),h.cross(c),s.fromBufferAttribute(i,d),o.fromBufferAttribute(i,p),l.fromBufferAttribute(i,A),s.add(h),o.add(h),l.add(h),i.setXYZ(d,s.x,s.y,s.z),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(A,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)r.fromBufferAttribute(t,e+0),n.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),h.subVectors(a,n),c.subVectors(r,n),h.cross(c),i.setXYZ(e+0,h.x,h.y,h.z),i.setXYZ(e+1,h.x,h.y,h.z),i.setXYZ(e+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)r0.fromBufferAttribute(e,t),r0.normalize(),e.setXYZ(t,r0.x,r0.y,r0.z)}toNonIndexed(){function e(e,t){let i=e.array,r=e.itemSize,n=e.normalized,a=new i.constructor(t.length*r),s=0,o=0;for(let n=0,l=t.length;n<l;n++){s=e.isInterleavedBufferAttribute?t[n]*e.data.stride+e.offset:t[n]*r;for(let e=0;e<r;e++)a[o++]=i[s++]}return new rV(a,r,n)}if(null===this.index)return t$("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new r1,i=this.index.array,r=this.attributes;for(let n in r){let a=e(r[n],i);t.setAttribute(n,a)}let n=this.morphAttributes;for(let r in n){let a=[],s=n[r];for(let t=0,r=s.length;t<r;t++){let r=e(s[t],i);a.push(r)}t.morphAttributes[r]=a}t.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let e=0,i=a.length;e<i;e++){let i=a[e];t.addGroup(i.start,i.count,i.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let t in i){let r=i[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},n=!1;for(let t in this.morphAttributes){let i=this.morphAttributes[t],a=[];for(let t=0,r=i.length;t<r;t++){let r=i[t];a.push(r.toJSON(e.data))}a.length>0&&(r[t]=a,n=!0)}n&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere=s.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;null!==i&&this.setIndex(i.clone());let r=e.attributes;for(let e in r){let i=r[e];this.setAttribute(e,i.clone(t))}let n=e.morphAttributes;for(let e in n){let i=[],r=n[e];for(let e=0,n=r.length;e<n;e++)i.push(r[e].clone(t));this.morphAttributes[e]=i}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());let o=e.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}let r2=new i$,r3=new iJ,r4=new iz,r5=new it,r8=new it,r9=new it,r6=new it,r7=new it,ne=new it,nt=new it,ni=new it;class nr extends rf{constructor(e=new r1,t=new rO){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e<t;e++){let t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let i=this.geometry,r=i.attributes.position,n=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(r,e);let s=this.morphTargetInfluences;if(n&&s){ne.set(0,0,0);for(let i=0,r=n.length;i<r;i++){let r=s[i],o=n[i];0!==r&&(r7.fromBufferAttribute(o,e),a?ne.addScaledVector(r7,r):ne.addScaledVector(r7.sub(t),r))}t.add(ne)}return t}raycast(e,t){let i=this.geometry,r=this.material,n=this.matrixWorld;void 0===r||(null===i.boundingSphere&&i.computeBoundingSphere(),r4.copy(i.boundingSphere),r4.applyMatrix4(n),r3.copy(e.ray).recast(e.near),!1===r4.containsPoint(r3.origin)&&(null===r3.intersectSphere(r4,r5)||r3.origin.distanceToSquared(r5)>(e.far-e.near)**2)||(r2.copy(n).invert(),r3.copy(e.ray).applyMatrix4(r2),(null===i.boundingBox||!1!==r3.intersectsBox(i.boundingBox))&&this._computeIntersections(e,t,r3)))}_computeIntersections(e,t,i){let r,n=this.geometry,a=this.material,s=n.index,o=n.attributes.position,l=n.attributes.uv,h=n.attributes.uv1,c=n.attributes.normal,u=n.groups,d=n.drawRange;if(null!==s)if(Array.isArray(a))for(let n=0,o=u.length;n<o;n++){let o=u[n],p=a[o.materialIndex],A=Math.max(o.start,d.start),f=Math.min(s.count,Math.min(o.start+o.count,d.start+d.count));for(let n=A;n<f;n+=3)(r=nn(this,p,e,i,l,h,c,s.getX(n),s.getX(n+1),s.getX(n+2)))&&(r.faceIndex=Math.floor(n/3),r.face.materialIndex=o.materialIndex,t.push(r))}else{let n=Math.max(0,d.start),o=Math.min(s.count,d.start+d.count);for(let u=n;u<o;u+=3)(r=nn(this,a,e,i,l,h,c,s.getX(u),s.getX(u+1),s.getX(u+2)))&&(r.faceIndex=Math.floor(u/3),t.push(r))}else if(void 0!==o)if(Array.isArray(a))for(let n=0,s=u.length;n<s;n++){let s=u[n],p=a[s.materialIndex],A=Math.max(s.start,d.start),f=Math.min(o.count,Math.min(s.start+s.count,d.start+d.count));for(let n=A;n<f;n+=3)(r=nn(this,p,e,i,l,h,c,n,n+1,n+2))&&(r.faceIndex=Math.floor(n/3),r.face.materialIndex=s.materialIndex,t.push(r))}else{let n=Math.max(0,d.start),s=Math.min(o.count,d.start+d.count);for(let o=n;o<s;o+=3)(r=nn(this,a,e,i,l,h,c,o,o+1,o+2))&&(r.faceIndex=Math.floor(o/3),t.push(r))}}}function nn(e,t,i,r,n,a,s,o,l,h){e.getVertexPosition(o,r8),e.getVertexPosition(l,r9),e.getVertexPosition(h,r6);let c=function(e,t,i,r,n,a,s,o){if(null===(1===t.side?r.intersectTriangle(s,a,n,!0,o):r.intersectTriangle(n,a,s,0===t.side,o)))return null;ni.copy(o),ni.applyMatrix4(e.matrixWorld);let l=i.ray.origin.distanceTo(ni);return l<i.near||l>i.far?null:{distance:l,point:ni.clone(),object:e}}(e,t,i,r,r8,r9,r6,nt);if(c){let e=new it;rT.getBarycoord(nt,r8,r9,r6,e),n&&(c.uv=rT.getInterpolatedAttribute(n,o,l,h,e,new t7)),a&&(c.uv1=rT.getInterpolatedAttribute(a,o,l,h,e,new t7)),s&&(c.normal=rT.getInterpolatedAttribute(s,o,l,h,e,new it),c.normal.dot(r.direction)>0&&c.normal.multiplyScalar(-1));let t={a:o,b:l,c:h,normal:new it,materialIndex:0};rT.getNormal(r8,r9,r6,t.normal),c.face=t,c.barycoord=e}return c}class na extends r1{constructor(e=1,t=1,i=1,r=1,n=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:n,depthSegments:a};const s=this;r=Math.floor(r),n=Math.floor(n);const o=[],l=[],h=[],c=[];let u=0,d=0;function p(e,t,i,r,n,a,p,A,f,g,m){let v=a/f,b=p/g,y=a/2,x=p/2,_=A/2,E=f+1,S=g+1,C=0,M=0,w=new it;for(let a=0;a<S;a++){let s=a*b-x;for(let o=0;o<E;o++){let u=o*v-y;w[e]=u*r,w[t]=s*n,w[i]=_,l.push(w.x,w.y,w.z),w[e]=0,w[t]=0,w[i]=A>0?1:-1,h.push(w.x,w.y,w.z),c.push(o/f),c.push(1-a/g),C+=1}}for(let e=0;e<g;e++)for(let t=0;t<f;t++){let i=u+t+E*e,r=u+t+E*(e+1),n=u+(t+1)+E*(e+1),a=u+(t+1)+E*e;o.push(i,r,a),o.push(r,n,a),M+=6}s.addGroup(d,M,m),d+=M,u+=C}p("z","y","x",-1,-1,i,t,e,a=Math.floor(a),n,0),p("z","y","x",1,-1,i,t,-e,a,n,1),p("x","z","y",1,1,e,i,t,r,a,2),p("x","z","y",1,-1,e,i,-t,r,a,3),p("x","y","z",1,-1,e,t,i,r,n,4),p("x","y","z",-1,-1,e,t,-i,r,n,5),this.setIndex(o),this.setAttribute("position",new rj(l,3)),this.setAttribute("normal",new rj(h,3)),this.setAttribute("uv",new rj(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new na(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function ns(e){let t={};for(let i in e)for(let r in t[i]={},e[i]){let n=e[i][r];n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)?n.isRenderTargetTexture?(t$("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[i][r]=null):t[i][r]=n.clone():Array.isArray(n)?t[i][r]=n.slice():t[i][r]=n}return t}function no(e){let t={};for(let i=0;i<e.length;i++){let r=ns(e[i]);for(let e in r)t[e]=r[e]}return t}function nl(e){let t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:ih.workingColorSpace}class nh extends rN{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ns(e.uniforms),this.uniformsGroups=function(e){let t=[];for(let i=0;i<e.length;i++)t.push(e[i].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);for(let i in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){let r=this.uniforms[i].value;r&&r.isTexture?t.uniforms[i]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[i]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[i]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[i]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[i]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[i]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[i]={type:"m4",value:r.toArray()}:t.uniforms[i]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let i={};for(let e in this.extensions)!0===this.extensions[e]&&(i[e]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class nc extends rf{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new i$,this.projectionMatrix=new i$,this.projectionMatrixInverse=new i$,this.coordinateSystem=2e3,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}let nu=new it,nd=new t7,np=new t7;class nA extends nc{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*t4*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*t3*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*t4*Math.atan(Math.tan(.5*t3*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){nu.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(nu.x,nu.y).multiplyScalar(-e/nu.z),nu.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(nu.x,nu.y).multiplyScalar(-e/nu.z)}getViewSize(e,t){return this.getViewBounds(e,nd,np),t.subVectors(np,nd)}setViewOffset(e,t,i,r,n,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=n,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*t3*this.fov)/this.zoom,i=2*t,r=this.aspect*i,n=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;n+=a.offsetX*r/e,t-=a.offsetY*i/s,r*=a.width/e,i*=a.height/s}let s=this.filmOffset;0!==s&&(n+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(n,n+r,t,t-i,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class nf extends rf{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new nA(-90,1,e,t);r.layers=this.layers,this.add(r);const n=new nA(-90,1,e,t);n.layers=this.layers,this.add(n);const a=new nA(-90,1,e,t);a.layers=this.layers,this.add(a);const s=new nA(-90,1,e,t);s.layers=this.layers,this.add(s);const o=new nA(-90,1,e,t);o.layers=this.layers,this.add(o);const l=new nA(-90,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[i,r,n,a,s,o]=t;for(let e of t)this.remove(e);if(2e3===e)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),n.up.set(0,0,-1),n.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(2001===e)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),n.up.set(0,0,1),n.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[n,a,s,o,l,h]=this.children,c=e.getRenderTarget(),u=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let A=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,n),e.setRenderTarget(i,1,r),e.render(t,a),e.setRenderTarget(i,2,r),e.render(t,s),e.setRenderTarget(i,3,r),e.render(t,o),e.setRenderTarget(i,4,r),e.render(t,l),i.texture.generateMipmaps=A,e.setRenderTarget(i,5,r),e.render(t,h),e.setRenderTarget(c,u,d),e.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class ng extends ib{constructor(e=[],t=301,i,r,n,a,s,o,l,h){super(e,t,i,r,n,a,s,o,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class nm extends i_{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1};this.texture=new ng([i,i,i,i,i,i]),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:`
|
|
410
|
+
|
|
411
|
+
varying vec3 vWorldDirection;
|
|
412
|
+
|
|
413
|
+
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
414
|
+
|
|
415
|
+
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
416
|
+
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
void main() {
|
|
420
|
+
|
|
421
|
+
vWorldDirection = transformDirection( position, modelMatrix );
|
|
422
|
+
|
|
423
|
+
#include <begin_vertex>
|
|
424
|
+
#include <project_vertex>
|
|
425
|
+
|
|
426
|
+
}
|
|
427
|
+
`,fragmentShader:`
|
|
428
|
+
|
|
429
|
+
uniform sampler2D tEquirect;
|
|
430
|
+
|
|
431
|
+
varying vec3 vWorldDirection;
|
|
432
|
+
|
|
433
|
+
#include <common>
|
|
434
|
+
|
|
435
|
+
void main() {
|
|
436
|
+
|
|
437
|
+
vec3 direction = normalize( vWorldDirection );
|
|
438
|
+
|
|
439
|
+
vec2 sampleUV = equirectUv( direction );
|
|
440
|
+
|
|
441
|
+
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
442
|
+
|
|
443
|
+
}
|
|
444
|
+
`},r=new na(5,5,5),n=new nh({name:"CubemapFromEquirect",uniforms:ns(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});n.uniforms.tEquirect.value=t;let a=new nr(r,n),s=t.minFilter;return 1008===t.minFilter&&(t.minFilter=1006),new nf(1,10,this).update(e,a),t.minFilter=s,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,i=!0,r=!0){let n=e.getRenderTarget();for(let n=0;n<6;n++)e.setRenderTarget(this,n),e.clear(t,i,r);e.setRenderTarget(n)}}class nv extends rf{constructor(){super(),this.isGroup=!0,this.type="Group"}}let nb={type:"move"};class ny{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new nv,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new nv,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new it,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new it),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new nv,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new it,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new it),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,i){let r=null,n=null,a=null,s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){for(let r of(a=!0,e.hand.values())){let e=t.getJointPose(r,i),n=this._getHandJoint(l,r);null!==e&&(n.matrix.fromArray(e.transform.matrix),n.matrix.decompose(n.position,n.rotation,n.scale),n.matrixWorldNeedsUpdate=!0,n.jointRadius=e.radius),n.visible=null!==e}let r=l.joints["index-finger-tip"],n=l.joints["thumb-tip"],s=r.position.distanceTo(n.position);l.inputState.pinching&&s>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(n=t.getPose(e.gripSpace,i))&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,n.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(n.linearVelocity)):o.hasLinearVelocity=!1,n.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(n.angularVelocity)):o.hasAngularVelocity=!1);null!==s&&(null===(r=t.getPose(e.targetRaySpace,i))&&null!==n&&(r=n),null!==r&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(nb)))}return null!==s&&(s.visible=null!==r),null!==o&&(o.visible=null!==n),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let i=new nv;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class nx extends rf{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new i6,this.environmentIntensity=1,this.environmentRotation=new i6,this.overrideMaterial=null,"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class n_{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=t5()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,n=this.stride;r<n;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=t5()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=t5()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}let nE=new it;class nS{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)nE.fromBufferAttribute(this,t),nE.applyMatrix4(e),this.setXYZ(t,nE.x,nE.y,nE.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)nE.fromBufferAttribute(this,t),nE.applyNormalMatrix(e),this.setXYZ(t,nE.x,nE.y,nE.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)nE.fromBufferAttribute(this,t),nE.transformDirection(e),this.setXYZ(t,nE.x,nE.y,nE.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=t9(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=t6(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=t6(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=t6(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=t6(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=t6(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=t9(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=t9(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=t9(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=t9(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=t6(t,this.array),i=t6(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=t6(t,this.array),i=t6(i,this.array),r=t6(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=t6(t,this.array),i=t6(i,this.array),r=t6(r,this.array),n=t6(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=n,this}clone(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new nS(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized);{tJ("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let i=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[i+t])}return new rV(new this.array.constructor(e),this.itemSize,this.normalized)}}toJSON(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized};{tJ("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let i=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[i+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}}let nC=new it,nM=new iy,nw=new iy,nI=new it,nT=new i$,nB=new it,nR=new iz,nD=new i$,nL=new iJ;class nP extends nr{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=tz,this.bindMatrix=new i$,this.bindMatrixInverse=new i$,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;null===this.boundingBox&&(this.boundingBox=new iC),this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,nB),this.boundingBox.expandByPoint(nB)}computeBoundingSphere(){let e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new iz),this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,nB),this.boundingSphere.expandByPoint(nB)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){let i=this.material,r=this.matrixWorld;void 0===i||(null===this.boundingSphere&&this.computeBoundingSphere(),nR.copy(this.boundingSphere),nR.applyMatrix4(r),!1===e.ray.intersectsSphere(nR)||(nD.copy(r).invert(),nL.copy(e.ray).applyMatrix4(nD),(null===this.boundingBox||!1!==nL.intersectsBox(this.boundingBox))&&this._computeIntersections(e,t,nL)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new iy,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);let r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===tz?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():t$("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){let i=this.skeleton,r=this.geometry;nM.fromBufferAttribute(r.attributes.skinIndex,e),nw.fromBufferAttribute(r.attributes.skinWeight,e),nC.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){let r=nw.getComponent(e);if(0!==r){let n=nM.getComponent(e);nT.multiplyMatrices(i.bones[n].matrixWorld,i.boneInverses[n]),t.addScaledVector(nI.copy(nC).applyMatrix4(nT),r)}}return t.applyMatrix4(this.bindMatrixInverse)}}class nU extends rf{constructor(){super(),this.isBone=!0,this.type="Bone"}}class nF extends ib{constructor(e=null,t=1,i=1,r,n,a,s,o,l=1003,h=1003,c,u){super(null,a,s,o,l,h,r,n,c,u),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}let nN=new i$,nO=new i$;class nk{constructor(e=[],t=[]){this.uuid=t5(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){t$("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new i$)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let t=new i$;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){let e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let r=0,n=e.length;r<n;r++){let n=e[r]?e[r].matrixWorld:nO;nN.multiplyMatrices(n,t[r]),nN.toArray(i,16*r)}null!==r&&(r.needsUpdate=!0)}clone(){return new nk(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length),t=new Float32Array((e=Math.max(e=4*Math.ceil(e/4),4))*e*4);t.set(this.boneMatrices);let i=new nF(t,e,e,1023,1015);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){let i=this.bones[t];if(i.name===e)return i}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){let r=e.bones[i],n=t[r];void 0===n&&(t$("Skeleton: No bone found with UUID:",r),n=new nU),this.bones.push(n),this.boneInverses.push(new i$().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,i=this.boneInverses;for(let r=0,n=t.length;r<n;r++){let n=t[r];e.bones.push(n.uuid);let a=i[r];e.boneInverses.push(a.toArray())}return e}}class nQ extends rV{constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}let nG=new i$,nH=new i$,nz=[],nV=new iC,nW=new i$,nq=new nr,nj=new iz;class nX extends nr{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new nQ(new Float32Array(16*i),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<i;e++)this.setMatrixAt(e,nW)}computeBoundingBox(){let e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new iC),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,nG),nV.copy(e.boundingBox).applyMatrix4(nG),this.boundingBox.union(nV)}computeBoundingSphere(){let e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new iz),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,nG),nj.copy(e.boundingSphere).applyMatrix4(nG),this.boundingSphere.union(nj)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.morphTexture&&(this.morphTexture=e.morphTexture.clone()),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}getMorphAt(e,t){let i=t.morphTargetInfluences,r=this.morphTexture.source.data.data,n=e*(i.length+1)+1;for(let e=0;e<i.length;e++)i[e]=r[n+e]}raycast(e,t){let i=this.matrixWorld,r=this.count;if((nq.geometry=this.geometry,nq.material=this.material,void 0!==nq.material)&&(null===this.boundingSphere&&this.computeBoundingSphere(),nj.copy(this.boundingSphere),nj.applyMatrix4(i),!1!==e.ray.intersectsSphere(nj)))for(let n=0;n<r;n++){this.getMatrixAt(n,nG),nH.multiplyMatrices(i,nG),nq.matrixWorld=nH,nq.raycast(e,nz);for(let e=0,i=nz.length;e<i;e++){let i=nz[e];i.instanceId=n,i.object=this,t.push(i)}nz.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new nQ(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}setMorphAt(e,t){let i=t.morphTargetInfluences,r=i.length+1;null===this.morphTexture&&(this.morphTexture=new nF(new Float32Array(r*this.count),r,this.count,1028,1015));let n=this.morphTexture.source.data.data,a=0;for(let e=0;e<i.length;e++)a+=i[e];let s=this.geometry.morphTargetsRelative?1:1-a,o=r*e;n[o]=s,n.set(i,o+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null)}}let nY=new it,nK=new it,nJ=new ia;class n${constructor(e=new it(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let r=nY.subVectors(i,t).cross(nK.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let i=e.delta(nY),r=this.normal.dot(i);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;let n=-(e.start.dot(this.normal)+this.constant)/r;return n<0||n>1?null:t.copy(e.start).addScaledVector(i,n)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||nJ.getNormalMatrix(e),r=this.coplanarPoint(nY).applyMatrix4(e),n=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(n),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}let nZ=new iz,n0=new t7(.5,.5),n1=new it;class n2{constructor(e=new n$,t=new n$,i=new n$,r=new n$,n=new n$,a=new n$){this.planes=[e,t,i,r,n,a]}set(e,t,i,r,n,a){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(i),s[3].copy(r),s[4].copy(n),s[5].copy(a),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=2e3,i=!1){let r=this.planes,n=e.elements,a=n[0],s=n[1],o=n[2],l=n[3],h=n[4],c=n[5],u=n[6],d=n[7],p=n[8],A=n[9],f=n[10],g=n[11],m=n[12],v=n[13],b=n[14],y=n[15];if(r[0].setComponents(l-a,d-h,g-p,y-m).normalize(),r[1].setComponents(l+a,d+h,g+p,y+m).normalize(),r[2].setComponents(l+s,d+c,g+A,y+v).normalize(),r[3].setComponents(l-s,d-c,g-A,y-v).normalize(),i)r[4].setComponents(o,u,f,b).normalize(),r[5].setComponents(l-o,d-u,g-f,y-b).normalize();else if(r[4].setComponents(l-o,d-u,g-f,y-b).normalize(),2e3===t)r[5].setComponents(l+o,d+u,g+f,y+b).normalize();else if(2001===t)r[5].setComponents(o,u,f,b).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),nZ.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),nZ.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(nZ)}intersectsSprite(e){return nZ.center.set(0,0,0),nZ.radius=.7071067811865476+n0.distanceTo(e.center),nZ.applyMatrix4(e.matrixWorld),this.intersectsSphere(nZ)}intersectsSphere(e){let t=this.planes,i=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let r=t[i];if(n1.x=r.normal.x>0?e.max.x:e.min.x,n1.y=r.normal.y>0?e.max.y:e.min.y,n1.z=r.normal.z>0?e.max.z:e.min.z,0>r.distanceToPoint(n1))return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(0>t[i].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}}class n3 extends rN{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new rP(0xffffff),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}let n4=new it,n5=new it,n8=new i$,n9=new iJ,n6=new iz,n7=new it,ae=new it;class at extends rf{constructor(e=new r1,t=new n3){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,i=[0];for(let e=1,r=t.count;e<r;e++)n4.fromBufferAttribute(t,e-1),n5.fromBufferAttribute(t,e),i[e]=i[e-1],i[e]+=n4.distanceTo(n5);e.setAttribute("lineDistance",new rj(i,1))}else t$("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let i=this.geometry,r=this.matrixWorld,n=e.params.Line.threshold,a=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),n6.copy(i.boundingSphere),n6.applyMatrix4(r),n6.radius+=n,!1===e.ray.intersectsSphere(n6))return;n8.copy(r).invert(),n9.copy(e.ray).applyMatrix4(n8);let s=n/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=this.isLineSegments?2:1,h=i.index,c=i.attributes.position;if(null!==h){let i=Math.max(0,a.start),r=Math.min(h.count,a.start+a.count);for(let n=i,a=r-1;n<a;n+=l){let i=ai(this,e,n9,o,h.getX(n),h.getX(n+1),n);i&&t.push(i)}if(this.isLineLoop){let n=ai(this,e,n9,o,h.getX(r-1),h.getX(i),r-1);n&&t.push(n)}}else{let i=Math.max(0,a.start),r=Math.min(c.count,a.start+a.count);for(let n=i,a=r-1;n<a;n+=l){let i=ai(this,e,n9,o,n,n+1,n);i&&t.push(i)}if(this.isLineLoop){let n=ai(this,e,n9,o,r-1,i,r-1);n&&t.push(n)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e<t;e++){let t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function ai(e,t,i,r,n,a,s){let o=e.geometry.attributes.position;if(n4.fromBufferAttribute(o,n),n5.fromBufferAttribute(o,a),i.distanceSqToSegment(n4,n5,n7,ae)>r)return;n7.applyMatrix4(e.matrixWorld);let l=t.ray.origin.distanceTo(n7);if(!(l<t.near)&&!(l>t.far))return{distance:l,point:ae.clone().applyMatrix4(e.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:e}}let ar=new it,an=new it;class aa extends at{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,i=[];for(let e=0,r=t.count;e<r;e+=2)ar.fromBufferAttribute(t,e),an.fromBufferAttribute(t,e+1),i[e]=0===e?0:i[e-1],i[e+1]=i[e]+ar.distanceTo(an);e.setAttribute("lineDistance",new rj(i,1))}else t$("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class as extends at{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class ao extends rN{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new rP(0xffffff),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let al=new i$,ah=new iJ,ac=new iz,au=new it;class ad extends rf{constructor(e=new r1,t=new ao){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let i=this.geometry,r=this.matrixWorld,n=e.params.Points.threshold,a=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),ac.copy(i.boundingSphere),ac.applyMatrix4(r),ac.radius+=n,!1===e.ray.intersectsSphere(ac))return;al.copy(r).invert(),ah.copy(e.ray).applyMatrix4(al);let s=n/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=i.index,h=i.attributes.position;if(null!==l){let i=Math.max(0,a.start),n=Math.min(l.count,a.start+a.count);for(let a=i;a<n;a++){let i=l.getX(a);au.fromBufferAttribute(h,i),ap(au,i,o,r,e,t,this)}}else{let i=Math.max(0,a.start),n=Math.min(h.count,a.start+a.count);for(let a=i;a<n;a++)au.fromBufferAttribute(h,a),ap(au,a,o,r,e,t,this)}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e<t;e++){let t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function ap(e,t,i,r,n,a,s){let o=ah.distanceSqToPoint(e);if(o<i){let i=new it;ah.closestPointToPoint(e,i),i.applyMatrix4(r);let l=n.ray.origin.distanceTo(i);if(l<n.near||l>n.far)return;a.push({distance:l,distanceToRay:Math.sqrt(o),point:i,index:t,face:null,faceIndex:null,barycoord:null,object:s})}}class aA extends ib{constructor(e,t,i,r,n=1006,a=1006,s,o,l){super(e,t,i,r,n,a,s,o,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const h=this;"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(function t(){h.needsUpdate=!0,h._requestVideoFrameCallbackId=e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class af extends ib{constructor(e,t,i,r,n,a,s,o,l,h,c,u){super(null,a,s,o,l,h,r,n,c,u),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class ag extends af{constructor(e,t,i,r,n,a){super(e,t,i,n,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=1001,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class am extends af{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,301),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class av extends ib{constructor(e,t,i,r,n,a,s,o,l){super(e,t,i,r,n,a,s,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class ab extends ib{constructor(e,t,i=1014,r,n,a,s=1003,o=1003,l,h=1026,c=1){if(1026!==h&&1027!==h)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:e,height:t,depth:c},r,n,a,s,o,h,i,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new iA(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}class ay extends ab{constructor(e,t=1014,i=301,r,n,a=1003,s=1003,o,l=1026){const h={width:e,height:e,depth:1};super(e,e,t,i,r,n,a,s,o,l),this.image=[h,h,h,h,h,h],this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class ax extends ib{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class a_{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){t$("Curve: .getPoint() not implemented.")}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],i,r=this.getPoint(0),n=0;t.push(0);for(let a=1;a<=e;a++)t.push(n+=(i=this.getPoint(a/e)).distanceTo(r)),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let i,r=this.getLengths(),n=0,a=r.length;i=t||e*r[a-1];let s=0,o=a-1,l;for(;s<=o;)if((l=r[n=Math.floor(s+(o-s)/2)]-i)<0)s=n+1;else if(l>0)o=n-1;else{o=n;break}if(r[n=o]===i)return n/(a-1);let h=r[n],c=r[n+1];return(n+(i-h)/(c-h))/(a-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);let n=this.getPoint(i),a=this.getPoint(r),s=t||(n.isVector2?new t7:new it);return s.copy(a).sub(n).normalize(),s}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t=!1){let i=new it,r=[],n=[],a=[],s=new it,o=new i$;for(let t=0;t<=e;t++){let i=t/e;r[t]=this.getTangentAt(i,new it)}n[0]=new it,a[0]=new it;let l=Number.MAX_VALUE,h=Math.abs(r[0].x),c=Math.abs(r[0].y),u=Math.abs(r[0].z);h<=l&&(l=h,i.set(1,0,0)),c<=l&&(l=c,i.set(0,1,0)),u<=l&&i.set(0,0,1),s.crossVectors(r[0],i).normalize(),n[0].crossVectors(r[0],s),a[0].crossVectors(r[0],n[0]);for(let t=1;t<=e;t++){if(n[t]=n[t-1].clone(),a[t]=a[t-1].clone(),s.crossVectors(r[t-1],r[t]),s.length()>Number.EPSILON){s.normalize();let e=Math.acos(t8(r[t-1].dot(r[t]),-1,1));n[t].applyMatrix4(o.makeRotationAxis(s,e))}a[t].crossVectors(r[t],n[t])}if(!0===t){let t=Math.acos(t8(n[0].dot(n[e]),-1,1));t/=e,r[0].dot(s.crossVectors(n[0],n[e]))>0&&(t=-t);for(let i=1;i<=e;i++)n[i].applyMatrix4(o.makeRotationAxis(r[i],t*i)),a[i].crossVectors(r[i],n[i])}return{tangents:r,normals:n,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class aE extends a_{constructor(e=0,t=0,i=1,r=1,n=0,a=2*Math.PI,s=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=n,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}getPoint(e,t=new t7){let i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,n=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=n?0:i),!0!==this.aClockwise||n||(r===i?r=-i:r-=i);let a=this.aStartAngle+e*r,s=this.aX+this.xRadius*Math.cos(a),o=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),i=s-this.aX,r=o-this.aY;s=i*e-r*t+this.aX,o=i*t+r*e+this.aY}return t.set(s,o)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}function aS(){let e=0,t=0,i=0,r=0;function n(n,a,s,o){e=n,t=s,i=-3*n+3*a-2*s-o,r=2*n-2*a+s+o}return{initCatmullRom:function(e,t,i,r,a){n(t,i,a*(i-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,i,r,a,s,o){let l=(t-e)/a-(i-e)/(a+s)+(i-t)/s,h=(i-t)/s-(r-t)/(s+o)+(r-i)/o;n(t,i,l*=s,h*=s)},calc:function(n){let a=n*n;return e+t*n+i*a+a*n*r}}}let aC=new it,aM=new aS,aw=new aS,aI=new aS;function aT(e,t,i,r,n){let a=(r-t)*.5,s=(n-i)*.5,o=e*e;return e*o*(2*i-2*r+a+s)+(-3*i+3*r-2*a-s)*o+a*e+i}function aB(e,t,i,r){let n;return(n=1-e)*n*t+2*(1-e)*e*i+e*e*r}function aR(e,t,i,r,n){let a,s;return(a=1-e)*a*a*t+3*(s=1-e)*s*e*i+3*(1-e)*e*e*r+e*e*e*n}class aD extends a_{constructor(e=new t7,t=new t7,i=new t7,r=new t7){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new t7){let i=this.v0,r=this.v1,n=this.v2,a=this.v3;return t.set(aR(e,i.x,r.x,n.x,a.x),aR(e,i.y,r.y,n.y,a.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class aL extends a_{constructor(e=new t7,t=new t7){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new t7){return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new t7){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class aP extends a_{constructor(e=new t7,t=new t7,i=new t7){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new t7){let i=this.v0,r=this.v1,n=this.v2;return t.set(aB(e,i.x,r.x,n.x),aB(e,i.y,r.y,n.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class aU extends a_{constructor(e=new it,t=new it,i=new it){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new it){let i=this.v0,r=this.v1,n=this.v2;return t.set(aB(e,i.x,r.x,n.x),aB(e,i.y,r.y,n.y),aB(e,i.z,r.z,n.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class aF extends a_{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new t7){let i=this.points,r=(i.length-1)*e,n=Math.floor(r),a=r-n,s=i[0===n?n:n-1],o=i[n],l=i[n>i.length-2?i.length-1:n+1],h=i[n>i.length-3?i.length-1:n+2];return t.set(aT(a,s.x,o.x,l.x,h.x),aT(a,s.y,o.y,l.y,h.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(new t7().fromArray(i))}return this}}var aN=Object.freeze({__proto__:null,ArcCurve:class extends aE{constructor(e,t,i,r,n,a){super(e,t,i,i,r,n,a),this.isArcCurve=!0,this.type="ArcCurve"}},CatmullRomCurve3:class extends a_{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new it){let i,r,n=this.points,a=n.length,s=(a-!this.closed)*e,o=Math.floor(s),l=s-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/a)+1)*a:0===l&&o===a-1&&(o=a-2,l=1),this.closed||o>0?i=n[(o-1)%a]:(aC.subVectors(n[0],n[1]).add(n[0]),i=aC);let h=n[o%a],c=n[(o+1)%a];if(this.closed||o+2<a?r=n[(o+2)%a]:(aC.subVectors(n[a-1],n[a-2]).add(n[a-1]),r=aC),"centripetal"===this.curveType||"chordal"===this.curveType){let e="chordal"===this.curveType?.5:.25,t=Math.pow(i.distanceToSquared(h),e),n=Math.pow(h.distanceToSquared(c),e),a=Math.pow(c.distanceToSquared(r),e);n<1e-4&&(n=1),t<1e-4&&(t=n),a<1e-4&&(a=n),aM.initNonuniformCatmullRom(i.x,h.x,c.x,r.x,t,n,a),aw.initNonuniformCatmullRom(i.y,h.y,c.y,r.y,t,n,a),aI.initNonuniformCatmullRom(i.z,h.z,c.z,r.z,t,n,a)}else"catmullrom"===this.curveType&&(aM.initCatmullRom(i.x,h.x,c.x,r.x,this.tension),aw.initCatmullRom(i.y,h.y,c.y,r.y,this.tension),aI.initCatmullRom(i.z,h.z,c.z,r.z,this.tension));return t.set(aM.calc(l),aw.calc(l),aI.calc(l)),t}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(new it().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}},CubicBezierCurve:aD,CubicBezierCurve3:class extends a_{constructor(e=new it,t=new it,i=new it,r=new it){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new it){let i=this.v0,r=this.v1,n=this.v2,a=this.v3;return t.set(aR(e,i.x,r.x,n.x,a.x),aR(e,i.y,r.y,n.y,a.y),aR(e,i.z,r.z,n.z,a.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},EllipseCurve:aE,LineCurve:aL,LineCurve3:class extends a_{constructor(e=new it,t=new it){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new it){return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new it){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},QuadraticBezierCurve:aP,QuadraticBezierCurve3:aU,SplineCurve:aF});class aO extends a_{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let i=!0===e.isVector2?"LineCurve":"LineCurve3";this.curves.push(new aN[i](t,e))}return this}getPoint(e,t){let i=e*this.getLength(),r=this.getCurveLengths(),n=0;for(;n<r.length;){if(r[n]>=i){let e=r[n]-i,a=this.curves[n],s=a.getLength(),o=0===s?0:1-e/s;return a.getPointAt(o,t)}n++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let i=0,r=this.curves.length;i<r;i++)e.push(t+=this.curves[i].getLength());return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t,i=[];for(let r=0,n=this.curves;r<n.length;r++){let a=n[r],s=a.isEllipseCurve?2*e:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,o=a.getPoints(s);for(let e=0;e<o.length;e++){let r=o[e];t&&t.equals(r)||(i.push(r),t=r)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){let i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let i=e.curves[t];this.curves.push(new aN[i.type]().fromJSON(i))}return this}}class ak extends aO{constructor(e){super(),this.type="Path",this.currentPoint=new t7,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let i=new aL(this.currentPoint.clone(),new t7(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){let n=new aP(this.currentPoint.clone(),new t7(e,t),new t7(i,r));return this.curves.push(n),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,n,a){let s=new aD(this.currentPoint.clone(),new t7(e,t),new t7(i,r),new t7(n,a));return this.curves.push(s),this.currentPoint.set(n,a),this}splineThru(e){let t=new aF([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,n,a){let s=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(e+s,t+o,i,r,n,a),this}absarc(e,t,i,r,n,a){return this.absellipse(e,t,i,i,r,n,a),this}ellipse(e,t,i,r,n,a,s,o){let l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+l,t+h,i,r,n,a,s,o),this}absellipse(e,t,i,r,n,a,s,o){let l=new aE(e,t,i,r,n,a,s,o);if(this.curves.length>0){let e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);let h=l.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class aQ extends ak{constructor(e){super(e),this.uuid=t5(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){let i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let i=e.holes[t];this.holes.push(new ak().fromJSON(i))}return this}}function aG(e,t,i,r,n){let a;if(n===function(e,t,i,r){let n=0;for(let a=t,s=i-r;a<i;a+=r)n+=(e[s]-e[a])*(e[a+1]+e[s+1]),s=a;return n}(e,t,i,r)>0)for(let n=t;n<i;n+=r)a=a0(n/r|0,e[n],e[n+1],a);else for(let n=i-r;n>=t;n-=r)a=a0(n/r|0,e[n],e[n+1],a);return a&&aX(a,a.next)&&(a1(a),a=a.next),a}function aH(e,t){if(!e)return e;t||(t=e);let i=e,r;do if(r=!1,!i.steiner&&(aX(i,i.next)||0===aj(i.prev,i,i.next))){if(a1(i),(i=t=i.prev)===i.next)break;r=!0}else i=i.next;while(r||i!==t);return t}function az(e,t){let i=e.x-t.x;return 0===i&&0==(i=e.y-t.y)&&(i=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),i}function aV(e,t,i,r,n){return(e=((e=((e=((e=((e=(e-i)*n|0)|e<<8)&0xff00ff)|e<<4)&0xf0f0f0f)|e<<2)&0x33333333)|e<<1)&0x55555555)|(t=((t=((t=((t=((t=(t-r)*n|0)|t<<8)&0xff00ff)|t<<4)&0xf0f0f0f)|t<<2)&0x33333333)|t<<1)&0x55555555)<<1}function aW(e,t,i,r,n,a,s,o){return(n-s)*(t-o)>=(e-s)*(a-o)&&(e-s)*(r-o)>=(i-s)*(t-o)&&(i-s)*(a-o)>=(n-s)*(r-o)}function aq(e,t,i,r,n,a,s,o){return(e!==s||t!==o)&&aW(e,t,i,r,n,a,s,o)}function aj(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function aX(e,t){return e.x===t.x&&e.y===t.y}function aY(e,t,i,r){let n=aJ(aj(e,t,i)),a=aJ(aj(e,t,r)),s=aJ(aj(i,r,e)),o=aJ(aj(i,r,t));return!!(n!==a&&s!==o||0===n&&aK(e,i,t)||0===a&&aK(e,r,t)||0===s&&aK(i,e,r)||0===o&&aK(i,t,r))}function aK(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function aJ(e){return e>0?1:e<0?-1:0}function a$(e,t){return 0>aj(e.prev,e,e.next)?aj(e,t,e.next)>=0&&aj(e,e.prev,t)>=0:0>aj(e,t,e.prev)||0>aj(e,e.next,t)}function aZ(e,t){let i=a2(e.i,e.x,e.y),r=a2(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function a0(e,t,i,r){let n=a2(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function a1(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function a2(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class a3{static triangulate(e,t,i=2){return function(e,t,i=2){let r,n,a,s=t&&t.length,o=s?t[0]*i:e.length,l=aG(e,0,o,i,!0),h=[];if(!l||l.next===l.prev)return h;if(s&&(l=function(e,t,i,r){let n=[];for(let i=0,a=t.length;i<a;i++){let s=t[i]*r,o=i<a-1?t[i+1]*r:e.length,l=aG(e,s,o,r,!1);l===l.next&&(l.steiner=!0),n.push(function(e){let t=e,i=e;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==e);return i}(l))}n.sort(az);for(let e=0;e<n.length;e++)i=function(e,t){let i=function(e,t){let i,r=t,n=e.x,a=e.y,s=-1/0;if(aX(e,r))return r;do{if(aX(e,r.next))return r.next;if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){let e=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(e<=n&&e>s&&(s=e,i=r.x<r.next.x?r:r.next,e===n))return i}r=r.next}while(r!==t);if(!i)return null;let o=i,l=i.x,h=i.y,c=1/0;r=i;do{if(n>=r.x&&r.x>=l&&n!==r.x&&aW(a<h?n:s,a,l,h,a<h?s:n,a,r.x,r.y)){var u,d;let t=Math.abs(a-r.y)/(n-r.x);a$(r,e)&&(t<c||t===c&&(r.x>i.x||r.x===i.x&&(u=i,d=r,0>aj(u.prev,u,d.prev)&&0>aj(d.next,u,u.next))))&&(i=r,c=t)}r=r.next}while(r!==o);return i}(e,t);if(!i)return t;let r=aZ(i,e);return aH(r,r.next),aH(i,i.next)}(n[e],i);return i}(e,t,l,i)),e.length>80*i){r=e[0],n=e[1];let t=r,s=n;for(let a=i;a<o;a+=i){let i=e[a],o=e[a+1];i<r&&(r=i),o<n&&(n=o),i>t&&(t=i),o>s&&(s=o)}a=0!==(a=Math.max(t-r,s-n))?32767/a:0}return function e(t,i,r,n,a,s,o){if(!t)return;!o&&s&&function(e,t,i,r){let n=e;do 0===n.z&&(n.z=aV(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){let t,i=1;do{let r,n=e;e=null;let a=null;for(t=0;n;){t++;let s=n,o=0;for(let e=0;e<i&&(o++,s=s.nextZ);e++);let l=i;for(;o>0||l>0&&s;)0!==o&&(0===l||!s||n.z<=s.z)?(r=n,n=n.nextZ,o--):(r=s,s=s.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=s}a.nextZ=null,i*=2}while(t>1)}(n)}(t,n,a,s);let l=t;for(;t.prev!==t.next;){let h=t.prev,c=t.next;if(s?function(e,t,i,r){let n=e.prev,a=e.next;if(aj(n,e,a)>=0)return!1;let s=n.x,o=e.x,l=a.x,h=n.y,c=e.y,u=a.y,d=Math.min(s,o,l),p=Math.min(h,c,u),A=Math.max(s,o,l),f=Math.max(h,c,u),g=aV(d,p,t,i,r),m=aV(A,f,t,i,r),v=e.prevZ,b=e.nextZ;for(;v&&v.z>=g&&b&&b.z<=m;){if(v.x>=d&&v.x<=A&&v.y>=p&&v.y<=f&&v!==n&&v!==a&&aq(s,h,o,c,l,u,v.x,v.y)&&aj(v.prev,v,v.next)>=0||(v=v.prevZ,b.x>=d&&b.x<=A&&b.y>=p&&b.y<=f&&b!==n&&b!==a&&aq(s,h,o,c,l,u,b.x,b.y)&&aj(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;v&&v.z>=g;){if(v.x>=d&&v.x<=A&&v.y>=p&&v.y<=f&&v!==n&&v!==a&&aq(s,h,o,c,l,u,v.x,v.y)&&aj(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=m;){if(b.x>=d&&b.x<=A&&b.y>=p&&b.y<=f&&b!==n&&b!==a&&aq(s,h,o,c,l,u,b.x,b.y)&&aj(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}(t,n,a,s):function(e){let t=e.prev,i=e.next;if(aj(t,e,i)>=0)return!1;let r=t.x,n=e.x,a=i.x,s=t.y,o=e.y,l=i.y,h=Math.min(r,n,a),c=Math.min(s,o,l),u=Math.max(r,n,a),d=Math.max(s,o,l),p=i.next;for(;p!==t;){if(p.x>=h&&p.x<=u&&p.y>=c&&p.y<=d&&aq(r,s,n,o,a,l,p.x,p.y)&&aj(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}(t)){i.push(h.i,t.i,c.i),a1(t),t=c.next,l=c.next;continue}if((t=c)===l){o?1===o?e(t=function(e,t){let i=e;do{let r=i.prev,n=i.next.next;!aX(r,n)&&aY(r,i,i.next,n)&&a$(r,n)&&a$(n,r)&&(t.push(r.i,i.i,n.i),a1(i),a1(i.next),i=e=n),i=i.next}while(i!==e);return aH(i)}(aH(t),i),i,r,n,a,s,2):2===o&&function(t,i,r,n,a,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){var l,h;if(o.i!==t.i&&(l=o,h=t,l.next.i!==h.i&&l.prev.i!==h.i&&!function(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&aY(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(l,h)&&(a$(l,h)&&a$(h,l)&&function(e,t){let i=e,r=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;do i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==e);return r}(l,h)&&(aj(l.prev,l,h.prev)||aj(l,h.prev,h))||aX(l,h)&&aj(l.prev,l,l.next)>0&&aj(h.prev,h,h.next)>0))){let l=aZ(o,t);o=aH(o,o.next),l=aH(l,l.next),e(o,i,r,n,a,s,0),e(l,i,r,n,a,s,0);return}t=t.next}o=o.next}while(o!==t)}(t,i,r,n,a,s):e(aH(t),i,r,n,a,s,1);break}}}(l,h,i,r,n,a,0),h}(e,t,i)}}class a4{static area(e){let t=e.length,i=0;for(let r=t-1,n=0;n<t;r=n++)i+=e[r].x*e[n].y-e[n].x*e[r].y;return .5*i}static isClockWise(e){return 0>a4.area(e)}static triangulateShape(e,t){let i=[],r=[],n=[];a5(e),a8(i,e);let a=e.length;t.forEach(a5);for(let e=0;e<t.length;e++)r.push(a),a+=t[e].length,a8(i,t[e]);let s=a3.triangulate(i,r);for(let e=0;e<s.length;e+=3)n.push(s.slice(e,e+3));return n}}function a5(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function a8(e,t){for(let i=0;i<t.length;i++)e.push(t[i].x),e.push(t[i].y)}class a9 extends r1{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const n=e/2,a=t/2,s=Math.floor(i),o=Math.floor(r),l=s+1,h=o+1,c=e/s,u=t/o,d=[],p=[],A=[],f=[];for(let e=0;e<h;e++){const t=e*u-a;for(let i=0;i<l;i++){const r=i*c-n;p.push(r,-t,0),A.push(0,0,1),f.push(i/s),f.push(1-e/o)}}for(let e=0;e<o;e++)for(let t=0;t<s;t++){const i=t+l*e,r=t+l*(e+1),n=t+1+l*(e+1),a=t+1+l*e;d.push(i,r,a),d.push(r,n,a)}this.setIndex(d),this.setAttribute("position",new rj(p,3)),this.setAttribute("normal",new rj(A,3)),this.setAttribute("uv",new rj(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new a9(e.width,e.height,e.widthSegments,e.heightSegments)}}class a6 extends r1{constructor(e=new aQ([new t7(0,.5),new t7(-.5,-.5),new t7(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],r=[],n=[],a=[];let s=0,o=0;if(!1===Array.isArray(e))l(e);else for(let t=0;t<e.length;t++)l(e[t]),this.addGroup(s,o,t),s+=o,o=0;function l(e){let s=r.length/3,l=e.extractPoints(t),h=l.shape,c=l.holes;!1===a4.isClockWise(h)&&(h=h.reverse());for(let e=0,t=c.length;e<t;e++){let t=c[e];!0===a4.isClockWise(t)&&(c[e]=t.reverse())}let u=a4.triangulateShape(h,c);for(let e=0,t=c.length;e<t;e++){let t=c[e];h=h.concat(t)}for(let e=0,t=h.length;e<t;e++){let t=h[e];r.push(t.x,t.y,0),n.push(0,0,1),a.push(t.x,t.y)}for(let e=0,t=u.length;e<t;e++){let t=u[e],r=t[0]+s,n=t[1]+s,a=t[2]+s;i.push(r,n,a),o+=3}}this.setIndex(i),this.setAttribute("position",new rj(r,3)),this.setAttribute("normal",new rj(n,3)),this.setAttribute("uv",new rj(a,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return function(e,t){if(t.shapes=[],Array.isArray(e))for(let i=0,r=e.length;i<r;i++){let r=e[i];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}static fromJSON(e,t){let i=[];for(let r=0,n=e.shapes.length;r<n;r++){let n=t[e.shapes[r]];i.push(n)}return new a6(i,e.curveSegments)}}class a7 extends r1{constructor(e=1,t=32,i=16,r=0,n=2*Math.PI,a=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:n,thetaStart:a,thetaLength:s},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const o=Math.min(a+s,Math.PI);let l=0;const h=[],c=new it,u=new it,d=[],p=[],A=[],f=[];for(let d=0;d<=i;d++){const g=[],m=d/i;let v=0;0===d&&0===a?v=.5/t:d===i&&o===Math.PI&&(v=-.5/t);for(let i=0;i<=t;i++){const o=i/t;c.x=-e*Math.cos(r+o*n)*Math.sin(a+m*s),c.y=e*Math.cos(a+m*s),c.z=e*Math.sin(r+o*n)*Math.sin(a+m*s),p.push(c.x,c.y,c.z),u.copy(c).normalize(),A.push(u.x,u.y,u.z),f.push(o+v,1-m),g.push(l++)}h.push(g)}for(let e=0;e<i;e++)for(let r=0;r<t;r++){const t=h[e][r+1],n=h[e][r],s=h[e+1][r],l=h[e+1][r+1];(0!==e||a>0)&&d.push(t,n,l),(e!==i-1||o<Math.PI)&&d.push(n,s,l)}this.setIndex(d),this.setAttribute("position",new rj(p,3)),this.setAttribute("normal",new rj(A,3)),this.setAttribute("uv",new rj(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new a7(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class se extends nh{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class st extends rN{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new rP(0xffffff),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new rP(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new t7(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new i6,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class si extends st{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new t7(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return t8(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new rP(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new rP(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new rP(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class sr extends rN{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class sn extends rN{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function sa(e,t){return e&&e.constructor!==t?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function ss(e,t,i){let r=e.length,n=new e.constructor(r);for(let a=0,s=0;s!==r;++a){let r=i[a]*t;for(let i=0;i!==t;++i)n[s++]=e[r+i]}return n}function so(e,t,i,r){let n=1,a=e[0];for(;void 0!==a&&void 0===a[r];)a=e[n++];if(void 0===a)return;let s=a[r];if(void 0!==s)if(Array.isArray(s))do void 0!==(s=a[r])&&(t.push(a.time),i.push(...s)),a=e[n++];while(void 0!==a);else if(void 0!==s.toArray)do void 0!==(s=a[r])&&(t.push(a.time),s.toArray(i,i.length)),a=e[n++];while(void 0!==a);else do void 0!==(s=a[r])&&(t.push(a.time),i.push(s)),a=e[n++];while(void 0!==a)}class sl{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,r=t[i],n=t[i-1];e:{t:{let a;i:{r:if(!(e<r)){for(let a=i+2;;){if(void 0===r){if(e<n)break r;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(n=r,e<(r=t[++i]))break t}a=t.length;break i}if(!(e>=n)){let s=t[1];e<s&&(i=2,n=s);for(let a=i-2;;){if(void 0===n)return this._cachedIndex=0,this.copySampleValue_(0);if(i===a)break;if(r=n,e>=(n=t[--i-1]))break t}a=i,i=0;break i}break e}for(;i<a;){let r=i+a>>>1;e<t[r]?a=r:i=r+1}if(r=t[i],void 0===(n=t[i-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===r)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,n,r)}return this.interpolate_(i,n,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,n=e*r;for(let e=0;e!==r;++e)t[e]=i[n+e];return t}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}}class sh extends sl{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,i){let r=this.parameterPositions,n=e-2,a=e+1,s=r[n],o=r[a];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:n=e,s=2*t-i;break;case 2402:n=r.length-2,s=t+r[n]-r[n+1];break;default:n=e,s=i}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:a=e,o=2*i-t;break;case 2402:a=1,o=i+r[1]-r[0];break;default:a=e-1,o=t}let l=(i-t)*.5,h=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(o-i),this._offsetPrev=n*h,this._offsetNext=a*h}interpolate_(e,t,i,r){let n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,h=this._offsetPrev,c=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(i-t)/(r-t),A=p*p,f=A*p,g=-u*f+2*u*A-u*p,m=(1+u)*f+(-1.5-2*u)*A+(-.5+u)*p+1,v=(-1-d)*f+(1.5+d)*A+.5*p,b=d*f-d*A;for(let e=0;e!==s;++e)n[e]=g*a[h+e]+m*a[l+e]+v*a[o+e]+b*a[c+e];return n}}class sc extends sl{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,h=(i-t)/(r-t),c=1-h;for(let e=0;e!==s;++e)n[e]=a[l+e]*c+a[o+e]*h;return n}}class su extends sl{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class sd{constructor(e,t,i,r){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=sa(t,this.TimeBufferType),this.values=sa(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t,i=e.constructor;if(i.toJSON!==this.toJSON)t=i.toJSON(e);else{t={name:e.name,times:sa(e.times,Array),values:sa(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t}InterpolantFactoryMethodDiscrete(e){return new su(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new sc(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new sh(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){let t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t);return t$("KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(1!==e){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){let i=this.times,r=i.length,n=0,a=r-1;for(;n!==r&&i[n]<e;)++n;for(;-1!==a&&i[a]>t;)--a;if(++a,0!==n||a!==r){n>=a&&(n=(a=Math.max(a,1))-1);let e=this.getValueSize();this.times=i.slice(n,a),this.values=this.values.slice(n*e,a*e)}return this}validate(){var e;let t=!0,i=this.getValueSize();i-Math.floor(i)!=0&&(tZ("KeyframeTrack: Invalid value size in track.",this),t=!1);let r=this.times,n=this.values,a=r.length;0===a&&(tZ("KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let e=0;e!==a;e++){let i=r[e];if("number"==typeof i&&isNaN(i)){tZ("KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==s&&s>i){tZ("KeyframeTrack: Out of order keys.",this,e,i,s),t=!1;break}s=i}if(void 0!==n&&ArrayBuffer.isView(e=n)&&!(e instanceof DataView))for(let e=0,i=n.length;e!==i;++e){let i=n[e];if(isNaN(i)){tZ("KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){let e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=2302===this.getInterpolation(),n=e.length-1,a=1;for(let s=1;s<n;++s){let n=!1,o=e[s];if(o!==e[s+1]&&(1!==s||o!==e[0]))if(r)n=!0;else{let e=s*i,r=e-i,a=e+i;for(let s=0;s!==i;++s){let i=t[e+s];if(i!==t[r+s]||i!==t[a+s]){n=!0;break}}}if(n){if(s!==a){e[a]=e[s];let r=s*i,n=a*i;for(let e=0;e!==i;++e)t[n+e]=t[r+e]}++a}}if(n>0){e[a]=e[n];for(let e=n*i,r=a*i,s=0;s!==i;++s)t[r+s]=t[e+s];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*i)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),i=new this.constructor(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}sd.prototype.ValueTypeName="",sd.prototype.TimeBufferType=Float32Array,sd.prototype.ValueBufferType=Float32Array,sd.prototype.DefaultInterpolation=2301;class sp extends sd{constructor(e,t,i){super(e,t,i)}}sp.prototype.ValueTypeName="bool",sp.prototype.ValueBufferType=Array,sp.prototype.DefaultInterpolation=2300,sp.prototype.InterpolantFactoryMethodLinear=void 0,sp.prototype.InterpolantFactoryMethodSmooth=void 0;class sA extends sd{constructor(e,t,i,r){super(e,t,i,r)}}sA.prototype.ValueTypeName="color";class sf extends sd{constructor(e,t,i,r){super(e,t,i,r)}}sf.prototype.ValueTypeName="number";class sg extends sl{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(i-t)/(r-t),l=e*s;for(let e=l+s;l!==e;l+=4)ie.slerpFlat(n,0,a,l-s,a,l,o);return n}}class sm extends sd{constructor(e,t,i,r){super(e,t,i,r)}InterpolantFactoryMethodLinear(e){return new sg(this.times,this.values,this.getValueSize(),e)}}sm.prototype.ValueTypeName="quaternion",sm.prototype.InterpolantFactoryMethodSmooth=void 0;class sv extends sd{constructor(e,t,i){super(e,t,i)}}sv.prototype.ValueTypeName="string",sv.prototype.ValueBufferType=Array,sv.prototype.DefaultInterpolation=2300,sv.prototype.InterpolantFactoryMethodLinear=void 0,sv.prototype.InterpolantFactoryMethodSmooth=void 0;class sb extends sd{constructor(e,t,i,r){super(e,t,i,r)}}sb.prototype.ValueTypeName="vector";class sy{constructor(e="",t=-1,i=[],r=2500){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=t5(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){let t=[],i=e.tracks,r=1/(e.fps||1);for(let e=0,n=i.length;e!==n;++e)t.push((function(e){if(void 0===e.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return sf;case"vector":case"vector2":case"vector3":case"vector4":return sb;case"color":return sA;case"quaternion":return sm;case"bool":case"boolean":return sp;case"string":return sv}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){let t=[],i=[];so(e.keys,t,i,"value"),e.times=t,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)})(i[e]).scale(r));let n=new this(e.name,e.duration,t,e.blendMode);return n.uuid=e.uuid,n.userData=JSON.parse(e.userData||"{}"),n}static toJSON(e){let t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let e=0,r=i.length;e!==r;++e)t.push(sd.toJSON(i[e]));return r}static CreateFromMorphTargetSequence(e,t,i,r){let n=t.length,a=[];for(let e=0;e<n;e++){let s=[],o=[];s.push((e+n-1)%n,e,(e+1)%n),o.push(0,1,0);let l=function(e){let t=e.length,i=Array(t);for(let e=0;e!==t;++e)i[e]=e;return i.sort(function(t,i){return e[t]-e[i]}),i}(s);s=ss(s,1,l),o=ss(o,1,l),r||0!==s[0]||(s.push(n),o.push(o[0])),a.push(new sf(".morphTargetInfluences["+t[e].name+"]",s,o).scale(1/i))}return new this(e,-1,a)}static findByName(e,t){let i=e;Array.isArray(e)||(i=e.geometry&&e.geometry.animations||e.animations);for(let e=0;e<i.length;e++)if(i[e].name===t)return i[e];return null}static CreateClipsFromMorphTargetSequences(e,t,i){let r={},n=/^([\w-]*?)([\d]+)$/;for(let t=0,i=e.length;t<i;t++){let i=e[t],a=i.name.match(n);if(a&&a.length>1){let e=a[1],t=r[e];t||(r[e]=t=[]),t.push(i)}}let a=[];for(let e in r)a.push(this.CreateFromMorphTargetSequence(e,r[e],t,i));return a}static parseAnimation(e,t){if(t$("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return tZ("AnimationClip: No animation in JSONLoader data."),null;let i=function(e,t,i,r,n){if(0!==i.length){let a=[],s=[];so(i,a,s,r),0!==a.length&&n.push(new e(t,a,s))}},r=[],n=e.name||"default",a=e.fps||30,s=e.blendMode,o=e.length||-1,l=e.hierarchy||[];for(let e=0;e<l.length;e++){let n=l[e].keys;if(n&&0!==n.length)if(n[0].morphTargets){let e,t={};for(e=0;e<n.length;e++)if(n[e].morphTargets)for(let i=0;i<n[e].morphTargets.length;i++)t[n[e].morphTargets[i]]=-1;for(let i in t){let t=[],a=[];for(let r=0;r!==n[e].morphTargets.length;++r){let r=n[e];t.push(r.time),a.push(+(r.morphTarget===i))}r.push(new sf(".morphTargetInfluence["+i+"]",t,a))}o=t.length*a}else{let a=".bones["+t[e].name+"]";i(sb,a+".position",n,"pos",r),i(sm,a+".quaternion",n,"rot",r),i(sb,a+".scale",n,"scl",r)}}return 0===r.length?null:new this(n,o,r,s)}resetDuration(){let e=this.tracks,t=0;for(let i=0,r=e.length;i!==r;++i){let e=this.tracks[i];t=Math.max(t,e.times[e.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());let t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}let sx={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};class s_{constructor(e,t,i){let r;const n=this;let a=!1,s=0,o=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this._abortController=null,this.itemStart=function(e){o++,!1===a&&void 0!==n.onStart&&n.onStart(e,s,o),a=!0},this.itemEnd=function(e){s++,void 0!==n.onProgress&&n.onProgress(e,s,o),s===o&&(a=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(e){void 0!==n.onError&&n.onError(e)},this.resolveURL=function(e){return r?r(e):e},this.setURLModifier=function(e){return r=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){let t=l.indexOf(e);return -1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,i=l.length;t<i;t+=2){let i=l[t],r=l[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return r}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}let sE=new s_;class sS{constructor(e){this.manager=void 0!==e?e:sE,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let i=this;return new Promise(function(r,n){i.load(e,r,t,n)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}sS.DEFAULT_MATERIAL_NAME="__DEFAULT";let sC={};class sM extends Error{constructor(e,t){super(e),this.response=t}}class sw extends sS{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,i,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let n=sx.get(`file:${e}`);if(void 0!==n)return this.manager.itemStart(e),setTimeout(()=>{t&&t(n),this.manager.itemEnd(e)},0),n;if(void 0!==sC[e])return void sC[e].push({onLoad:t,onProgress:i,onError:r});sC[e]=[],sC[e].push({onLoad:t,onProgress:i,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),s=this.mimeType,o=this.responseType;fetch(a).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&t$("FileLoader: HTTP Status 0 received."),"u"<typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;let i=sC[e],r=t.body.getReader(),n=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),a=n?parseInt(n):0,s=0!==a,o=0;return new Response(new ReadableStream({start(e){!function t(){r.read().then(({done:r,value:n})=>{if(r)e.close();else{let r=new ProgressEvent("progress",{lengthComputable:s,loaded:o+=n.byteLength,total:a});for(let e=0,t=i.length;e<t;e++){let t=i[e];t.onProgress&&t.onProgress(r)}e.enqueue(n),t()}},t=>{e.error(t)})}()}}))}throw new sM(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>new DOMParser().parseFromString(e,s));case"json":return e.json();default:if(""===s)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(s),i=new TextDecoder(t&&t[1]?t[1].toLowerCase():void 0);return e.arrayBuffer().then(e=>i.decode(e))}}}).then(t=>{sx.add(`file:${e}`,t);let i=sC[e];delete sC[e];for(let e=0,r=i.length;e<r;e++){let r=i[e];r.onLoad&&r.onLoad(t)}}).catch(t=>{let i=sC[e];if(void 0===i)throw this.manager.itemError(e),t;delete sC[e];for(let e=0,r=i.length;e<r;e++){let r=i[e];r.onError&&r.onError(t)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let sI=new WeakMap;class sT extends sS{constructor(e){super(e)}load(e,t,i,r){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let n=this,a=sx.get(`image:${e}`);if(void 0!==a){if(!0===a.complete)n.manager.itemStart(e),setTimeout(function(){t&&t(a),n.manager.itemEnd(e)},0);else{let e=sI.get(a);void 0===e&&(e=[],sI.set(a,e)),e.push({onLoad:t,onError:r})}return a}let s=tY("img");function o(){h(),t&&t(this);let i=sI.get(this)||[];for(let e=0;e<i.length;e++){let t=i[e];t.onLoad&&t.onLoad(this)}sI.delete(this),n.manager.itemEnd(e)}function l(t){h(),r&&r(t),sx.remove(`image:${e}`);let i=sI.get(this)||[];for(let e=0;e<i.length;e++){let r=i[e];r.onError&&r.onError(t)}sI.delete(this),n.manager.itemError(e),n.manager.itemEnd(e)}function h(){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1)}return s.addEventListener("load",o,!1),s.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),sx.add(`image:${e}`,s),n.manager.itemStart(e),s.src=e,s}}class sB extends sS{constructor(e){super(e)}load(e,t,i,r){let n=this,a=new nF,s=new sw(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(n.withCredentials),s.load(e,function(e){let i;try{i=n.parse(e)}catch(e){if(void 0===r)return void e(e);r(e)}void 0!==i.image?a.image=i.image:void 0!==i.data&&(a.image.width=i.width,a.image.height=i.height,a.image.data=i.data),a.wrapS=void 0!==i.wrapS?i.wrapS:1001,a.wrapT=void 0!==i.wrapT?i.wrapT:1001,a.magFilter=void 0!==i.magFilter?i.magFilter:1006,a.minFilter=void 0!==i.minFilter?i.minFilter:1006,a.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.colorSpace&&(a.colorSpace=i.colorSpace),void 0!==i.flipY&&(a.flipY=i.flipY),void 0!==i.format&&(a.format=i.format),void 0!==i.type&&(a.type=i.type),void 0!==i.mipmaps&&(a.mipmaps=i.mipmaps,a.minFilter=1008),1===i.mipmapCount&&(a.minFilter=1006),void 0!==i.generateMipmaps&&(a.generateMipmaps=i.generateMipmaps),a.needsUpdate=!0,t&&t(a,i)},i,r),a}}class sR extends sS{constructor(e){super(e)}load(e,t,i,r){let n=new ib,a=new sT(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){n.image=e,n.needsUpdate=!0,void 0!==t&&t(n)},i,r),n}}class sD extends rf{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new rP(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}let sL=new i$,sP=new it,sU=new it;class sF{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new t7(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new i$,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new n2,this._frameExtents=new t7(1,1),this._viewportCount=1,this._viewports=[new iy(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;sP.setFromMatrixPosition(e.matrixWorld),t.position.copy(sP),sU.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(sU),t.updateMatrixWorld(),sL.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(sL,t.coordinateSystem,t.reversedDepth),t.reversedDepth?i.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(sL)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return 1!==this.intensity&&(e.intensity=this.intensity),0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),(512!==this.mapSize.x||512!==this.mapSize.y)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class sN extends sF{constructor(){super(new nA(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,i=2*t4*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,n=e.distance||t.far;(i!==t.fov||r!==t.aspect||n!==t.far)&&(t.fov=i,t.aspect=r,t.far=n,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class sO extends sD{constructor(e,t,i=0,r=Math.PI/3,n=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(rf.DEFAULT_UP),this.updateMatrix(),this.target=new rf,this.distance=i,this.angle=r,this.penumbra=n,this.decay=a,this.map=null,this.shadow=new sN}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class sk extends sF{constructor(){super(new nA(90,1,.5,500)),this.isPointLightShadow=!0}}class sQ extends sD{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new sk}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class sG extends nc{constructor(e=-1,t=1,i=1,r=-1,n=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=n,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,n,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=n,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2,n=i-e,a=i+e,s=r+t,o=r-t;if(null!==this.view&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;n+=e*this.view.offsetX,a=n+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}this.projectionMatrix.makeOrthographic(n,a,s,o,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}class sH extends sF{constructor(){super(new sG(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class sz extends sD{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(rf.DEFAULT_UP),this.updateMatrix(),this.target=new rf,this.shadow=new sH}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class sV{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new it)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let i=e.x,r=e.y,n=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*n),t.addScaledVector(a[3],.488603*i),t.addScaledVector(a[4],i*r*1.092548),t.addScaledVector(a[5],r*n*1.092548),t.addScaledVector(a[6],.315392*(3*n*n-1)),t.addScaledVector(a[7],i*n*1.092548),t.addScaledVector(a[8],.546274*(i*i-r*r)),t}getIrradianceAt(e,t){let i=e.x,r=e.y,n=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*r),t.addScaledVector(a[2],1.023328*n),t.addScaledVector(a[3],1.023328*i),t.addScaledVector(a[4],.858086*i*r),t.addScaledVector(a[5],.858086*r*n),t.addScaledVector(a[6],.743125*n*n-.247708),t.addScaledVector(a[7],.858086*i*n),t.addScaledVector(a[8],.429043*(i*i-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let i=this.coefficients;for(let r=0;r<9;r++)i[r].fromArray(e,t+3*r);return this}toArray(e=[],t=0){let i=this.coefficients;for(let r=0;r<9;r++)i[r].toArray(e,t+3*r);return e}static getBasisAt(e,t){let i=e.x,r=e.y,n=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*n,t[3]=.488603*i,t[4]=1.092548*i*r,t[5]=1.092548*r*n,t[6]=.315392*(3*n*n-1),t[7]=1.092548*i*n,t[8]=.546274*(i*i-r*r)}}class sW extends sD{constructor(e=new sV,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class sq{static extractUrlBase(e){let t=e.lastIndexOf("/");return -1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e))?e:t+e}}let sj=new WeakMap;class sX extends sS{constructor(e){super(e),this.isImageBitmapLoader=!0,"u"<typeof createImageBitmap&&t$("ImageBitmapLoader: createImageBitmap() not supported."),"u"<typeof fetch&&t$("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,i,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let n=this,a=sx.get(`image-bitmap:${e}`);if(void 0!==a)return(n.manager.itemStart(e),a.then)?void a.then(i=>{if(!0!==sj.has(a))return t&&t(i),n.manager.itemEnd(e),i;r&&r(sj.get(a)),n.manager.itemError(e),n.manager.itemEnd(e)}):(setTimeout(function(){t&&t(a),n.manager.itemEnd(e)},0),a);let s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,s.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let o=fetch(e,s).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(n.options,{colorSpaceConversion:"none"}))}).then(function(i){return sx.add(`image-bitmap:${e}`,i),t&&t(i),n.manager.itemEnd(e),i}).catch(function(t){r&&r(t),sj.set(o,t),sx.remove(`image-bitmap:${e}`),n.manager.itemError(e),n.manager.itemEnd(e)});sx.add(`image-bitmap:${e}`,o),n.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class sY extends nA{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class sK{constructor(e,t,i){let r,n,a;switch(this.binding=e,this.valueSize=i,t){case"quaternion":r=this._slerp,n=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":r=this._select,n=this._select,a=this._setAdditiveIdentityOther,this.buffer=Array(5*i);break;default:r=this._lerp,n=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=n,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){let i=this.buffer,r=this.valueSize,n=e*r+r,a=this.cumulativeWeight;if(0===a){for(let e=0;e!==r;++e)i[n+e]=i[e];a=t}else{a+=t;let e=t/a;this._mixBufferRegion(i,n,0,e,r)}this.cumulativeWeight=a}accumulateAdditive(e){let t=this.buffer,i=this.valueSize,r=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,i=this.buffer,r=e*t+t,n=this.cumulativeWeight,a=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,n<1){let e=t*this._origIndex;this._mixBufferRegion(i,r,e,1-n,t)}a>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let e=t,n=t+t;e!==n;++e)if(i[e]!==i[e+t]){s.setValue(i,r);break}}saveOriginalState(){let e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let e=i;e!==r;++e)t[e]=t[r+e%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i<t;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,r,n){if(r>=.5)for(let r=0;r!==n;++r)e[t+r]=e[i+r]}_slerp(e,t,i,r){ie.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,n){let a=this._workIndex*n;ie.multiplyQuaternionsFlat(e,a,e,t,e,i),ie.slerpFlat(e,t,e,t,e,a,r)}_lerp(e,t,i,r,n){let a=1-r;for(let s=0;s!==n;++s){let n=t+s;e[n]=e[n]*a+e[i+s]*r}}_lerpAdditive(e,t,i,r,n){for(let a=0;a!==n;++a){let n=t+a;e[n]=e[n]+e[i+a]*r}}}let sJ="\\[\\]\\.:\\/",s$=RegExp("["+sJ+"]","g"),sZ="[^"+sJ+"]",s0="[^"+sJ.replace("\\.","")+"]",s1=RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",sZ)+/(WCOD+)?/.source.replace("WCOD",s0)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",sZ)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",sZ)+"$"),s2=["material","materials","bones","map"];class s3{constructor(e,t,i){this.path=t,this.parsedPath=i||s3.parseTrackName(t),this.node=s3.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new s3.Composite(e,t,i):new s3(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(s$,"")}static parseTrackName(e){let t=s1.exec(e);if(null===t)throw Error("PropertyBinding: Cannot parse trackName: "+e);let i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){let e=i.nodeName.substring(r+1);-1!==s2.indexOf(e)&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=e)}if(null===i.propertyName||0===i.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let i=e.skeleton.getBoneByName(t);if(void 0!==i)return i}if(e.children){let i=function(e){for(let r=0;r<e.length;r++){let n=e[r];if(n.name===t||n.uuid===t)return n;let a=i(n.children);if(a)return a}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let i=this.resolvedProperty;for(let r=0,n=i.length;r!==n;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let i=this.resolvedProperty;for(let r=0,n=i.length;r!==n;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,n=i.length;r!==n;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,n=i.length;r!==n;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,i=t.objectName,r=t.propertyName,n=t.propertyIndex;if(e||(e=s3.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void t$("PropertyBinding: No target node found for track: "+this.path+".");if(i){let r=t.objectIndex;switch(i){case"materials":if(!e.material)return void tZ("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void tZ("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void tZ("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===r){r=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void tZ("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void tZ("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[i])return void tZ("PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[i]}if(void 0!==r){if(void 0===e[r])return void tZ("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[r]}}let a=e[r];if(void 0===a)return void tZ("PropertyBinding: Trying to update property for track: "+t.nodeName+"."+r+" but it wasn't found.",e);let s=this.Versioning.None;this.targetObject=e,!0===e.isMaterial?s=this.Versioning.NeedsUpdate:!0===e.isObject3D&&(s=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==n){if("morphTargetInfluences"===r){if(!e.geometry)return void tZ("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void tZ("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[n]&&(n=e.morphTargetDictionary[n])}o=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=n}else void 0!==a.fromArray&&void 0!==a.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(o=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}s3.Composite=class{constructor(e,t,i){const r=i||s3.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,r=this._bindings[i];void 0!==r&&r.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,n=i.length;r!==n;++r)i[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},s3.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},s3.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},s3.prototype.GetterByBindingType=[s3.prototype._getValue_direct,s3.prototype._getValue_array,s3.prototype._getValue_arrayElement,s3.prototype._getValue_toArray],s3.prototype.SetterByBindingTypeAndVersioning=[[s3.prototype._setValue_direct,s3.prototype._setValue_direct_setNeedsUpdate,s3.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[s3.prototype._setValue_array,s3.prototype._setValue_array_setNeedsUpdate,s3.prototype._setValue_array_setMatrixWorldNeedsUpdate],[s3.prototype._setValue_arrayElement,s3.prototype._setValue_arrayElement_setNeedsUpdate,s3.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[s3.prototype._setValue_fromArray,s3.prototype._setValue_fromArray_setNeedsUpdate,s3.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class s4{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const n=t.tracks,a=n.length,s=Array(a),o={endingStart:2400,endingEnd:2400};for(let e=0;e!==a;++e){const t=n[e].createInterpolant(null);s[e]=t,t.settings=o}this._interpolantSettings=o,this._interpolants=s,this._propertyBindings=Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i=!1){if(e.fadeOut(t),this.fadeIn(t),!0===i){let i=this._clip.duration,r=e._clip.duration;e.warp(1,r/i,t),this.warp(i/r,1,t)}return this}crossFadeTo(e,t,i=!1){return e.crossFadeFrom(this,t,i)}stopFading(){let e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){let r=this._mixer,n=r.time,a=this.timeScale,s=this._timeScaleInterpolant;null===s&&(s=r._lendControlInterpolant(),this._timeScaleInterpolant=s);let o=s.parameterPositions,l=s.sampleValues;return o[0]=n,o[1]=n+i,l[0]=e/a,l[1]=t/a,this}stopWarping(){let e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,r){if(!this.enabled)return void this._updateWeight(e);let n=this._startTime;if(null!==n){let r=(e-n)*i;r<0||0===i?t=0:(this._startTime=null,t=i*r)}t*=this._updateTimeScale(e);let a=this._updateTime(t),s=this._updateWeight(e);if(s>0){let e=this._interpolants,t=this._propertyBindings;if(2501===this.blendMode)for(let i=0,r=e.length;i!==r;++i)e[i].evaluate(a),t[i].accumulateAdditive(s);else for(let i=0,n=e.length;i!==n;++i)e[i].evaluate(a),t[i].accumulate(r,s)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let i=this._weightInterpolant;if(null!==i){let r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let i=this._timeScaleInterpolant;null!==i&&(t*=i.evaluate(e)[0],e>i.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,i=this.loop,r=this.time+e,n=this._loopCount,a=2202===i;if(0===e)return -1===n?r:a&&(1&n)==1?t-r:r;if(2200===i){-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1));n:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break n}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===n&&(e>=0?(n=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),r>=t||r<0){let i=Math.floor(r/t);r-=t*i,n+=Math.abs(i);let s=this.repetitions-n;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){let t=e<0;this._setEndings(t,!t,a)}else this._setEndings(!1,!1,a);this._loopCount=n,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=r;if(a&&(1&n)==1)return t-r}return r}_setEndings(e,t,i){let r=this._interpolantSettings;i?(r.endingStart=2401,r.endingEnd=2401):(e?r.endingStart=this.zeroSlopeAtStart?2401:2400:r.endingStart=2402,t?r.endingEnd=this.zeroSlopeAtEnd?2401:2400:r.endingEnd=2402)}_scheduleFading(e,t,i){let r=this._mixer,n=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);let s=a.parameterPositions,o=a.sampleValues;return s[0]=n,o[0]=t,s[1]=n+e,o[1]=i,this}}let s5=new Float32Array(1);class s8 extends t1{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){let i=e._localRoot||this._root,r=e._clip.tracks,n=r.length,a=e._propertyBindings,s=e._interpolants,o=i.uuid,l=this._bindingsByRootAndName,h=l[o];void 0===h&&(h={},l[o]=h);for(let e=0;e!==n;++e){let n=r[e],l=n.name,c=h[l];if(void 0!==c)++c.referenceCount,a[e]=c;else{if(void 0!==(c=a[e])){null===c._cacheIndex&&(++c.referenceCount,this._addInactiveBinding(c,o,l));continue}let r=t&&t._propertyBindings[e].binding.parsedPath;c=new sK(s3.create(i,l,r),n.ValueTypeName,n.getValueSize()),++c.referenceCount,this._addInactiveBinding(c,o,l),a[e]=c}s[e].resultBuffer=c.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){let t=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,t)}let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,i){let r=this._actions,n=this._actionsByClip,a=n[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,n[t]=a;else{let t=a.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[i]=e}_removeInactiveAction(e){let t=this._actions,i=t[t.length-1],r=e._cacheIndex;i._cacheIndex=r,t[r]=i,t.pop(),e._cacheIndex=null;let n=e._clip.uuid,a=this._actionsByClip,s=a[n],o=s.knownActions,l=o[o.length-1],h=e._byClipCacheIndex;l._byClipCacheIndex=h,o[h]=l,o.pop(),e._byClipCacheIndex=null;let c=s.actionByRoot,u=(e._localRoot||this._root).uuid;delete c[u],0===o.length&&delete a[n],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==--i.referenceCount&&this._removeInactiveBinding(i)}}_lendAction(e){let t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,n=t[r];e._cacheIndex=r,t[r]=e,n._cacheIndex=i,t[i]=n}_takeBackAction(e){let t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,n=t[r];e._cacheIndex=r,t[r]=e,n._cacheIndex=i,t[i]=n}_addInactiveBinding(e,t,i){let r=this._bindingsByRootAndName,n=this._bindings,a=r[t];void 0===a&&(a={},r[t]=a),a[i]=e,e._cacheIndex=n.length,n.push(e)}_removeInactiveBinding(e){let t=this._bindings,i=e.binding,r=i.rootNode.uuid,n=i.path,a=this._bindingsByRootAndName,s=a[r],o=t[t.length-1],l=e._cacheIndex;o._cacheIndex=l,t[l]=o,t.pop(),delete s[n],0===Object.keys(s).length&&delete a[r]}_lendBinding(e){let t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,n=t[r];e._cacheIndex=r,t[r]=e,n._cacheIndex=i,t[i]=n}_takeBackBinding(e){let t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,n=t[r];e._cacheIndex=r,t[r]=e,n._cacheIndex=i,t[i]=n}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,i=e[t];return void 0===i&&((i=new sc(new Float32Array(2),new Float32Array(2),1,s5)).__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){let t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,n=t[r];e.__cacheIndex=r,t[r]=e,n.__cacheIndex=i,t[i]=n}clipAction(e,t,i){let r=t||this._root,n=r.uuid,a="string"==typeof e?sy.findByName(r,e):e,s=null!==a?a.uuid:e,o=this._actionsByClip[s],l=null;if(void 0===i&&(i=null!==a?a.blendMode:2500),void 0!==o){let e=o.actionByRoot[n];if(void 0!==e&&e.blendMode===i)return e;l=o.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;let h=new s4(this,a,t,i);return this._bindAction(h,l),this._addInactiveAction(h,s,n),h}existingAction(e,t){let i=t||this._root,r=i.uuid,n="string"==typeof e?sy.findByName(i,e):e,a=n?n.uuid:e,s=this._actionsByClip[a];return void 0!==s&&s.actionByRoot[r]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;let t=this._actions,i=this._nActiveActions,r=this.time+=e,n=Math.sign(e),a=this._accuIndex^=1;for(let s=0;s!==i;++s)t[s]._update(r,e,n,a);let s=this._bindings,o=this._nActiveBindings;for(let e=0;e!==o;++e)s[e].apply(a);return this}setTime(e){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,i=e.uuid,r=this._actionsByClip,n=r[i];if(void 0!==n){let e=n.knownActions;for(let i=0,r=e.length;i!==r;++i){let r=e[i];this._deactivateAction(r);let n=r._cacheIndex,a=t[t.length-1];r._cacheIndex=null,r._byClipCacheIndex=null,a._cacheIndex=n,t[n]=a,t.pop(),this._removeInactiveBindingsForAction(r)}delete r[i]}}uncacheRoot(e){let t=e.uuid,i=this._actionsByClip;for(let e in i){let r=i[e].actionByRoot[t];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}let r=this._bindingsByRootAndName[t];if(void 0!==r)for(let e in r){let t=r[e];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(e,t){let i=this.existingAction(e,t);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}let s9=new i$;function s6(e,t){return e.distance-t.distance}function s7(e,t,i,r){let n=!0;if(e.layers.test(t.layers)&&!1===e.raycast(t,i)&&(n=!1),!0===n&&!0===r){let r=e.children;for(let e=0,n=r.length;e<n;e++)s7(r[e],t,i,!0)}}class oe{constructor(e=1,t=0,i=0){this.radius=e,this.phi=t,this.theta=i}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=t8(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(t8(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}function ot(e,t,i,r){let n=function(e){switch(e){case 1009:case 1010:return{byteLength:1,components:1};case 1012:case 1011:case 1016:return{byteLength:2,components:1};case 1017:case 1018:return{byteLength:2,components:4};case 1014:case 1013:case 1015:return{byteLength:4,components:1};case 35902:case 35899:return{byteLength:4,components:3}}throw Error(`Unknown texture type ${e}.`)}(r);switch(i){case 1021:return e*t;case 1028:case 1029:return e*t/n.components*n.byteLength;case 1030:case 1031:return e*t*2/n.components*n.byteLength;case 1022:return e*t*3/n.components*n.byteLength;case 1023:case 1033:return e*t*4/n.components*n.byteLength;case 33776:case 33777:case 36196:case 37492:case 37488:case 37489:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case 33778:case 33779:case 37496:case 37490:case 37491:case 37808:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 35841:case 35843:return Math.max(e,16)*Math.max(t,8)/4;case 35840:case 35842:return Math.max(e,8)*Math.max(t,8)/2;case 37809:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case 37810:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case 37811:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case 37812:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case 37813:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case 37814:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case 37815:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case 37816:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case 37817:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case 37818:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case 37819:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case 37820:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case 37821:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case 36492:case 36494:case 36495:case 36285:case 36286:return Math.ceil(e/4)*Math.ceil(t/4)*16;case 36283:case 36284:return Math.ceil(e/4)*Math.ceil(t/4)*8}throw Error(`Unable to determine texture byte length for ${i} format.`)}"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"182"}})),"u">typeof window&&(window.__THREE__?t$("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="182");var oi=function(){var e,t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),i=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};var r=WebAssembly.validate(t)?a("b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q:6dkr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq:p9sqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk:N8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhlaicefhodnaeTmbadTmbalc;WFbGglcjdalcjd6EhwcbhDinawaeaD9RaDawfae6Egqcsfglc9WGgkci2hxakcethmalcl4cifcd4hPabaDad2fhsakc;ab6hzcbhHincbhOaohAdndninaraA9RaP6meavcj;cbfaOak2fhCaAaPfhocbhidnazmbarao9Rc;Gb6mbcbhlinaCalfhidndndndndnaAalco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaiaopbbbpklbaoczfhokdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaiaopbbbpklzaoczfhokdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaiaopbbbpklaaoczfhokdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaiaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WaoclfaYpQbfaXc:q:yjjbfRbbfhoxdkaiaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WaocwfaYpQbfaXc:q:yjjbfRbbfhoxekaiaopbbbpkl8Waoczfhokalc;abfhialcjefak0meaihlarao9Rc;Fb0mbkkdnaiak9pmbaici4hlinarao9RcK6miaCaifhXdndndndndnaAaico4fRbbalcoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpkbbxikaXaopbblaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkbbaoclfaYpQbfaKc:q:yjjbfRbbfhoxdkaXaopbbwaopbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkbbaocwfaYpQbfaKc:q:yjjbfRbbfhoxekaXaopbbbpkbbaoczfhokalcdfhlaiczfgiak6mbkkaoTmeaohAaOcefgOclSmdxbkkc9:hoxlkdnakTmbavcjdfaHfhiavaHfpbdbhYcbhXinaiavcj;cbfaXfglpblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLalakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEalamfpblbg3cep9Ta3aQp9op9Hp9rg3alaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfglaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaladfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfglaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaladfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfglaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaladfglaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaladfglaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaladfglaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaladfhiaXczfgXak6mbkkaHclfgHad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfgDae6mbkkcbc99arao9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk::seHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgwce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhDaicefgqarfhidnaeTmbcmcsawceSEhkcbhxcbhmcbhPcbhwcbhlindnaiaD9nmbc9:hoxikdndnaqRbbgoc;Ve0mbavc;abfalaocu7gscl4fcsGcitfgzydlhrazydbhzdnaocsGgHak9pmbavawasfcsGcdtfydbaxaHEhoaHThsdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkaxasfhxcdhHavawcdtfaoBdbawasfhwcehsalhOxdkdndnaHcsSmbaHc987aHamffcefhoxekaicefhoai8SbbgHcFeGhsdndnaHcu9mmbaohixekaicvfhiascFbGhscrhHdninao8SbbgOcFbGaHtasVhsaOcu9kmeaocefhoaHcrfgHc8J9hmbxdkkaocefhikasce4cbasceG9R7amfhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhHavawcdtfaoBdbcehsawcefhwalhOaohmxekdnaocpe0mbaxcefgHavawaDaocsGfRbbgocl49RcsGcdtfydbaocz6gzEhravawao9RcsGcdtfydbaHazfgAaocsGgHEhoaHThCdndnadcd9hmbabaPcetfgHax87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHaxBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfaxBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgOaxBdlaOarBdbavawazfgwcsGcdtfaoBdbalcefcsGhOawaCfhwaxhzaAaCfhxxekaxcbaiRbbgOEgzaoc;:eSgHfhraOcsGhCaOcl4hAdndnaOcs0mbarcefhoxekarhoavawaA9RcsGcdtfydbhrkdndnaCmbaocefhxxekaohxavawaO9RcsGcdtfydbhokdndnaHTmbaicefhHxekaicdfhHai8SbegscFeGhzdnascu9kmbaicofhXazcFbGhzcrhidninaH8SbbgscFbGaitazVhzascu9kmeaHcefhHaicrfgic8J9hmbkaXhHxekaHcefhHkazce4cbazceG9R7amfgmhzkdndnaAcsSmbaHhsxekaHcefhsaH8SbbgicFeGhrdnaicu9kmbaHcvfhXarcFbGhrcrhidninas8SbbgHcFbGaitarVhraHcu9kmeascefhsaicrfgic8J9hmbkaXhsxekascefhskarce4cbarceG9R7amfgmhrkdndnaCcsSmbashixekascefhias8SbbgocFeGhHdnaocu9kmbascvfhXaHcFbGhHcrhodninai8SbbgscFbGaotaHVhHascu9kmeaicefhiaocrfgoc8J9hmbkaXhixekaicefhikaHce4cbaHceG9R7amfgmhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfazBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgXazBdlaXarBdbavawaOcz6aAcsSVfgwcsGcdtfaoBdbawaCTaCcsSVfhwalcefcsGhOkaqcefhqavc;abfaOcitfgOarBdlaOaoBdbavc;abfalasfcsGcitfgraoBdlarazBdbawcsGhwalaHfcsGhlaPcifgPae6mbkkcbc99aiaDSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:wPliuo97eue978Jjjjjbca9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalaeSmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskdnalTmbcbhvabhdinadczfgxaxpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;Meawaqawamp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oaoarpmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalaeSmbaiaeciGgvcitgdfcbcaad9R;8kbaiabalcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;Meawaqawamp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oaoarpmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaDakp;Mearp;Keamp9oaqakp;Mearp;Keczp:Rep9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalaeSmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaDakp;Mearp;Keamp9oaqakp;Mearp;Keczp:Rep9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbadczfhdaeclfgeav6mbkkdnavalSmbaialciGgecdtgdVcbc;abad9R;8kbaiabavcdtfgvad;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepklbkavaiad;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz:Dbb"):a("b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q:Odkr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq;w8Wqdbk;esezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9Uc;WFbGgocjdaocjd6EhDaicefhocbhqdnindndndnaeaq9nmbaDaeaq9RaqaDfae6Egkcsfglcl4cifcd4hxalc9WGgmTmecbhPawcjdfhsaohzinaraz9Rax6mvarazaxfgo9RcK6mvczhlcbhHinalgic9WfgOawcj;cbffhldndndndndnazaOco4fRbbaHcoG4ciGPlbedibkal9cb83ibalcwf9cb83ibxikalaoRblaoRbbgOco4gAaAciSgAE86bbawcj;cbfaifglcGfaoclfaAfgARbbaOcl4ciGgCaCciSgCE86bbalcVfaAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc7faAaCfgARbbaOciGgOaOciSgOE86bbalctfaAaOfgARbbaoRbegOco4gCaCciSgCE86bbalc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc93faAaCfgARbbaOciGgOaOciSgOE86bbalc94faAaOfgARbbaoRbdgOco4gCaCciSgCE86bbalc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbalc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbalc97faAaCfgARbbaOciGgOaOciSgOE86bbalc98faAaOfgORbbaoRbigoco4gAaAciSgAE86bbalc99faOaAfgORbbaocl4ciGgAaAciSgAE86bbalc9:faOaAfgORbbaocd4ciGgAaAciSgAE86bbalcufaOaAfglRbbaociGgoaociSgoE86bbalaofhoxdkalaoRbwaoRbbgOcl4gAaAcsSgAE86bbawcj;cbfaifglcGfaocwfaAfgARbbaOcsGgOaOcsSgOE86bbalcVfaAaOfgORbbaoRbegAcl4gCaCcsSgCE86bbalc7faOaCfgORbbaAcsGgAaAcsSgAE86bbalctfaOaAfgORbbaoRbdgAcl4gCaCcsSgCE86bbalc91faOaCfgORbbaAcsGgAaAcsSgAE86bbalc4faOaAfgORbbaoRbigAcl4gCaCcsSgCE86bbalc93faOaCfgORbbaAcsGgAaAcsSgAE86bbalc94faOaAfgORbbaoRblgAcl4gCaCcsSgCE86bbalc95faOaCfgORbbaAcsGgAaAcsSgAE86bbalc96faOaAfgORbbaoRbvgAcl4gCaCcsSgCE86bbalc97faOaCfgORbbaAcsGgAaAcsSgAE86bbalc98faOaAfgORbbaoRbogAcl4gCaCcsSgCE86bbalc99faOaCfgORbbaAcsGgAaAcsSgAE86bbalc9:faOaAfgORbbaoRbrgocl4gAaAcsSgAE86bbalcufaOaAfglRbbaocsGgoaocsSgoE86bbalaofhoxekalao8Pbb83bbalcwfaocwf8Pbb83bbaoczfhokdnaiam9pmbaHcdfhHaiczfhlarao9RcL0mekkaiam6mvaoTmvdnakTmbawaPfRbbhHawcj;cbfhlashiakhOinaialRbbgzce4cbazceG9R7aHfgH86bbaiadfhialcefhlaOcufgOmbkkascefhsaohzaPcefgPad9hmbxikkcbc99arao9Radcaadca0ESEhoxlkaoaxad2fhCdnakmbadhlinaoTmlarao9Rax6mlaoaxfhoalcufglmbkaChoxekcbhmawcjdfhAinarao9Rax6miawamfRbbhHawcj;cbfhlaAhiakhOinaialRbbgzce4cbazceG9R7aHfgH86bbaiadfhialcefhlaOcufgOmbkaAcefhAaoaxfhoamcefgmad9hmbkaChokabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqaombkc9:hoxekc9:hokavcj;ebf8Kjjjjbaok;cseHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgwce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhDaicefgqarfhidnaeTmbcmcsawceSEhkcbhxcbhmcbhPcbhwcbhlindnaiaD9nmbc9:hoxikdndnaqRbbgoc;Ve0mbavc;abfalaocu7gscl4fcsGcitfgzydlhrazydbhzdnaocsGgHak9pmbavawasfcsGcdtfydbaxaHEhoaHThsdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkaxasfhxcdhHavawcdtfaoBdbawasfhwcehsalhOxdkdndnaHcsSmbaHc987aHamffcefhoxekaicefhoai8SbbgHcFeGhsdndnaHcu9mmbaohixekaicvfhiascFbGhscrhHdninao8SbbgOcFbGaHtasVhsaOcu9kmeaocefhoaHcrfgHc8J9hmbxdkkaocefhikasce4cbasceG9R7amfhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhHavawcdtfaoBdbcehsawcefhwalhOaohmxekdnaocpe0mbaxcefgHavawaDaocsGfRbbgocl49RcsGcdtfydbaocz6gzEhravawao9RcsGcdtfydbaHazfgAaocsGgHEhoaHThCdndnadcd9hmbabaPcetfgHax87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHaxBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfaxBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgOaxBdlaOarBdbavawazfgwcsGcdtfaoBdbalcefcsGhOawaCfhwaxhzaAaCfhxxekaxcbaiRbbgOEgzaoc;:eSgHfhraOcsGhCaOcl4hAdndnaOcs0mbarcefhoxekarhoavawaA9RcsGcdtfydbhrkdndnaCmbaocefhxxekaohxavawaO9RcsGcdtfydbhokdndnaHTmbaicefhHxekaicdfhHai8SbegscFeGhzdnascu9kmbaicofhXazcFbGhzcrhidninaH8SbbgscFbGaitazVhzascu9kmeaHcefhHaicrfgic8J9hmbkaXhHxekaHcefhHkazce4cbazceG9R7amfgmhzkdndnaAcsSmbaHhsxekaHcefhsaH8SbbgicFeGhrdnaicu9kmbaHcvfhXarcFbGhrcrhidninas8SbbgHcFbGaitarVhraHcu9kmeascefhsaicrfgic8J9hmbkaXhsxekascefhskarce4cbarceG9R7amfgmhrkdndnaCcsSmbashixekascefhias8SbbgocFeGhHdnaocu9kmbascvfhXaHcFbGhHcrhodninai8SbbgscFbGaotaHVhHascu9kmeaicefhiaocrfgoc8J9hmbkaXhixekaicefhikaHce4cbaHceG9R7amfgmhokdndnadcd9hmbabaPcetfgHaz87ebaHclfao87ebaHcdfar87ebxekabaPcdtfgHazBdbaHcwfaoBdbaHclfarBdbkcdhsavawcdtfazBdbavawcefgwcsGcdtfarBdbcihHavc;abfalcitfgXazBdlaXarBdbavawaOcz6aAcsSVfgwcsGcdtfaoBdbawaCTaCcsSVfhwalcefcsGhOkaqcefhqavc;abfaOcitfgOarBdlaOaoBdbavc;abfalasfcsGcitfgraoBdlarazBdbawcsGhwalaHfcsGhlaPcifgPae6mbkkcbc99aiaDSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;oiliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabaiavcefciGfcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:OhDxekcjjjj94hDkabaiavciGfgkcd7cetfaD87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:OhDxekcjjjj94hDkabaiavcufciGfcetfaD87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohvxekcjjjj94hvkabakcetfav87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklzNbb"),n=WebAssembly.instantiate(r,{}).then(function(t){(e=t.instance).exports.__wasm_call_ctors()});function a(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;++r){var n=e.charCodeAt(r);t[r]=n>96?n-97:n>64?n-39:n+4}for(var a=0,r=0;r<e.length;++r)t[a++]=t[r]<60?i[t[r]]:(t[r]-60)*64+t[++r];return t.buffer.slice(0,a)}function s(e,t,i,r,n,a,s){var o=e.exports.sbrk,l=r+3&-4,h=o(l*n),c=o(a.length),u=new Uint8Array(e.exports.memory.buffer);u.set(a,c);var d=t(h,r,n,c,a.length);if(0==d&&s&&s(h,l,n),i.set(u.subarray(h,h+r*n)),o(h-o(0)),0!=d)throw Error("Malformed buffer data: "+d)}var o={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},l={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},h=[],c=0;function u(e){var t=e.data;if(!t.id)return self.close();self.ready.then(function(e){try{var i=new Uint8Array(t.count*t.size);s(e,e.exports[t.mode],i,t.count,t.size,t.source,e.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:"resolve",value:i},[i.buffer])}catch(e){self.postMessage({id:t.id,count:t.count,action:"reject",value:e})}})}return{ready:n,supported:!0,useWorkers:function(e){for(var t=new Blob(["self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(r)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+u.name+";"+s.toString()+u.toString()],{type:"text/javascript"}),i=URL.createObjectURL(t),n=h.length;n<e;++n)h[n]=function(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){var i=e.data;t.pending-=i.count,t.requests[i.id][i.action](i.value),delete t.requests[i.id]},t}(i);for(var n=e;n<h.length;++n)h[n].object.postMessage({});h.length=e,URL.revokeObjectURL(i)},decodeVertexBuffer:function(t,i,r,n,a){s(e,e.exports.meshopt_decodeVertexBuffer,t,i,r,n,e.exports[o[a]])},decodeIndexBuffer:function(t,i,r,n){s(e,e.exports.meshopt_decodeIndexBuffer,t,i,r,n)},decodeIndexSequence:function(t,i,r,n){s(e,e.exports.meshopt_decodeIndexSequence,t,i,r,n)},decodeGltfBuffer:function(t,i,r,n,a,h){s(e,e.exports[l[a]],t,i,r,n,e.exports[o[h]])},decodeGltfBufferAsync:function(t,i,r,a,u){return h.length>0?function(e,t,i,r,n){for(var a=h[0],s=1;s<h.length;++s)h[s].pending<a.pending&&(a=h[s]);return new Promise(function(s,o){var l=new Uint8Array(i),h=++c;a.pending+=e,a.requests[h]={resolve:s,reject:o},a.object.postMessage({id:h,count:e,size:t,source:l,mode:r,filter:n},[l.buffer])})}(t,i,r,l[a],o[u]):n.then(function(){var n=new Uint8Array(t*i);return s(e,e.exports[l[a]],n,t,i,r,e.exports[o[u]]),n})}}}();let or=new WeakMap;function on(){let e,t;onmessage=function(i){let r=i.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise(function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)});break;case"decode":let n=r.buffer,a=r.taskConfig;t.then(e=>{let t=e.draco,i=new t.Decoder;try{let e=function(e,t,i,r){var n,a,s;let o,l,h,c,u,d,p=r.attributeIDs,A=r.attributeTypes,f=t.GetEncodedGeometryType(i);if(f===e.TRIANGULAR_MESH)u=new e.Mesh,d=t.DecodeArrayToMesh(i,i.byteLength,u);else if(f===e.POINT_CLOUD)u=new e.PointCloud,d=t.DecodeArrayToPointCloud(i,i.byteLength,u);else throw Error("THREE.DRACOLoader: Unexpected geometry type.");if(!d.ok()||0===u.ptr)throw Error("THREE.DRACOLoader: Decoding failed: "+d.error_msg());let g={index:null,attributes:[]};for(let i in p){let n,a,s=self[A[i]];if(r.useUniqueIDs)a=p[i],n=t.GetAttributeByUniqueId(u,a);else{if(-1===(a=t.GetAttributeId(u,e[p[i]])))continue;n=t.GetAttribute(u,a)}let o=function(e,t,i,r,n,a){let s,o=i.num_points(),l=a.num_components(),h=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,n),c=l*n.BYTES_PER_ELEMENT,u=4*Math.ceil(c/4),d=u/n.BYTES_PER_ELEMENT,p=o*c,A=e._malloc(p);t.GetAttributeDataArrayForAllPoints(i,a,h,p,A);let f=new n(e.HEAPF32.buffer,A,p/n.BYTES_PER_ELEMENT);if(c===u)s=f.slice();else{s=new n(o*u/n.BYTES_PER_ELEMENT);let e=0;for(let t=0,i=f.length;t<i;t++){for(let i=0;i<l;i++)s[e+i]=f[t*l+i];e+=d}}return e._free(A),{name:r,count:o,itemSize:l,array:s,stride:d}}(e,t,u,i,s,n);"color"===i&&(o.vertexColorSpace=r.vertexColorSpace),g.attributes.push(o)}return f===e.TRIANGULAR_MESH&&(n=e,a=t,s=u,o=3*s.num_faces(),l=4*o,h=n._malloc(l),a.GetTrianglesUInt32Array(s,l,h),c=new Uint32Array(n.HEAPF32.buffer,h,o).slice(),n._free(h),g.index={array:c,itemSize:1}),e.destroy(u),g}(t,i,new Int8Array(n),a),s=e.attributes.map(e=>e.array.buffer);e.index&&s.push(e.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:e},s)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(i)}})}}}function oa(e,t){if(0===t)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2!==t&&1!==t)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;{let i=e.getIndex();if(null===i){let t=[],r=e.getAttribute("position");if(void 0===r)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),i=e.getIndex()}let r=i.count-2,n=[];if(2===t)for(let e=1;e<=r;e++)n.push(i.getX(0)),n.push(i.getX(e)),n.push(i.getX(e+1));else for(let e=0;e<r;e++)e%2==0?(n.push(i.getX(e)),n.push(i.getX(e+1)),n.push(i.getX(e+2))):(n.push(i.getX(e+2)),n.push(i.getX(e+1)),n.push(i.getX(e)));n.length/3!==r&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let a=e.clone();return a.setIndex(n),a.clearGroups(),a}}class os extends sS{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new od(e)}),this.register(function(e){return new op(e)}),this.register(function(e){return new o_(e)}),this.register(function(e){return new oE(e)}),this.register(function(e){return new oS(e)}),this.register(function(e){return new of(e)}),this.register(function(e){return new og(e)}),this.register(function(e){return new om(e)}),this.register(function(e){return new ov(e)}),this.register(function(e){return new ou(e)}),this.register(function(e){return new ob(e)}),this.register(function(e){return new oA(e)}),this.register(function(e){return new ox(e)}),this.register(function(e){return new oy(e)}),this.register(function(e){return new oh(e)}),this.register(function(e){return new oC(e)}),this.register(function(e){return new oM(e)})}load(e,t,i,r){let n,a=this;if(""!==this.resourcePath)n=this.resourcePath;else if(""!==this.path){let t=sq.extractUrlBase(e);n=sq.resolveURL(t,this.path)}else n=sq.extractUrlBase(e);this.manager.itemStart(e);let s=function(t){r?r(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},o=new sw(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(i){try{a.parse(i,n,function(i){t(i),a.manager.itemEnd(e)},s)}catch(e){s(e)}},i,s)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return -1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return -1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,i,r){let n,a={},s={},o=new TextDecoder;if("string"==typeof e)n=JSON.parse(e);else if(e instanceof ArrayBuffer)if(o.decode(new Uint8Array(e,0,4))===ow){try{a[ol.KHR_BINARY_GLTF]=new oI(e)}catch(e){r&&r(e);return}n=JSON.parse(a[ol.KHR_BINARY_GLTF].content)}else n=JSON.parse(o.decode(e));else n=e;if(void 0===n.asset||n.asset.version[0]<2){r&&r(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let l=new oX(n,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){let t=this.pluginCallbacks[e](l);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),s[t.name]=t,a[t.name]=!0}if(n.extensionsUsed)for(let e=0;e<n.extensionsUsed.length;++e){let t=n.extensionsUsed[e],i=n.extensionsRequired||[];switch(t){case ol.KHR_MATERIALS_UNLIT:a[t]=new oc;break;case ol.KHR_DRACO_MESH_COMPRESSION:a[t]=new oT(n,this.dracoLoader);break;case ol.KHR_TEXTURE_TRANSFORM:a[t]=new oB;break;case ol.KHR_MESH_QUANTIZATION:a[t]=new oR;break;default:i.indexOf(t)>=0&&void 0===s[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(a),l.setPlugins(s),l.parse(i,r)}parseAsync(e,t){let i=this;return new Promise(function(r,n){i.parse(e,t,r,n)})}}function oo(){let e={};return{get:function(t){return e[t]},add:function(t,i){e[t]=i},remove:function(t){delete e[t]},removeAll:function(){e={}}}}let ol={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class oh{constructor(e){this.parser=e,this.name=ol.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i<r;i++){let r=t[i];r.extensions&&r.extensions[this.name]&&void 0!==r.extensions[this.name].light&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t,i=this.parser,r="light:"+e,n=i.cache.get(r);if(n)return n;let a=i.json,s=((a.extensions&&a.extensions[this.name]||{}).lights||[])[e],o=new rP(0xffffff);void 0!==s.color&&o.setRGB(s.color[0],s.color[1],s.color[2],tW);let l=void 0!==s.range?s.range:0;switch(s.type){case"directional":(t=new sz(o)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new sQ(o)).distance=l;break;case"spot":(t=new sO(o)).distance=l,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,t.angle=s.spot.outerConeAngle,t.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return t.position.set(0,0,0),oV(t,s),void 0!==s.intensity&&(t.intensity=s.intensity),t.name=i.createUniqueName(s.name||"light_"+e),n=Promise.resolve(t),i.cache.add(r,n),n}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){let t=this,i=this.parser,r=i.json.nodes[e],n=(r.extensions&&r.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then(function(e){return i._getNodeRef(t.cache,n,e)})}}class oc{constructor(){this.name=ol.KHR_MATERIALS_UNLIT}getMaterialType(){return rO}extendParams(e,t,i){let r=[];e.color=new rP(1,1,1),e.opacity=1;let n=t.pbrMetallicRoughness;if(n){if(Array.isArray(n.baseColorFactor)){let t=n.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],tW),e.opacity=t[3]}void 0!==n.baseColorTexture&&r.push(i.assignTexture(e,"map",n.baseColorTexture,"srgb"))}return Promise.all(r)}}class ou{constructor(e){this.parser=e,this.name=ol.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let r=i.extensions[this.name].emissiveStrength;return void 0!==r&&(t.emissiveIntensity=r),Promise.resolve()}}class od{constructor(e){this.parser=e,this.name=ol.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?si:null}extendMaterialParams(e,t){let i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let n=[],a=r.extensions[this.name];if(void 0!==a.clearcoatFactor&&(t.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&n.push(i.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&n.push(i.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(n.push(i.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){let e=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new t7(e,e)}return Promise.all(n)}}class op{constructor(e){this.parser=e,this.name=ol.KHR_MATERIALS_DISPERSION}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?si:null}extendMaterialParams(e,t){let i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let r=i.extensions[this.name];return t.dispersion=void 0!==r.dispersion?r.dispersion:0,Promise.resolve()}}class oA{constructor(e){this.parser=e,this.name=ol.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?si:null}extendMaterialParams(e,t){let i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let n=[],a=r.extensions[this.name];return void 0!==a.iridescenceFactor&&(t.iridescence=a.iridescenceFactor),void 0!==a.iridescenceTexture&&n.push(i.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),void 0!==a.iridescenceIor&&(t.iridescenceIOR=a.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==a.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),void 0!==a.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),void 0!==a.iridescenceThicknessTexture&&n.push(i.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(n)}}class of{constructor(e){this.parser=e,this.name=ol.KHR_MATERIALS_SHEEN}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?si:null}extendMaterialParams(e,t){let i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let n=[];t.sheenColor=new rP(0,0,0),t.sheenRoughness=0,t.sheen=1;let a=r.extensions[this.name];if(void 0!==a.sheenColorFactor){let e=a.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],tW)}return void 0!==a.sheenRoughnessFactor&&(t.sheenRoughness=a.sheenRoughnessFactor),void 0!==a.sheenColorTexture&&n.push(i.assignTexture(t,"sheenColorMap",a.sheenColorTexture,"srgb")),void 0!==a.sheenRoughnessTexture&&n.push(i.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(n)}}class og{constructor(e){this.parser=e,this.name=ol.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?si:null}extendMaterialParams(e,t){let i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let n=[],a=r.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&n.push(i.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(n)}}class om{constructor(e){this.parser=e,this.name=ol.KHR_MATERIALS_VOLUME}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?si:null}extendMaterialParams(e,t){let i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let n=[],a=r.extensions[this.name];t.thickness=void 0!==a.thicknessFactor?a.thicknessFactor:0,void 0!==a.thicknessTexture&&n.push(i.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;let s=a.attenuationColor||[1,1,1];return t.attenuationColor=new rP().setRGB(s[0],s[1],s[2],tW),Promise.all(n)}}class ov{constructor(e){this.parser=e,this.name=ol.KHR_MATERIALS_IOR}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?si:null}extendMaterialParams(e,t){let i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let r=i.extensions[this.name];return t.ior=void 0!==r.ior?r.ior:1.5,Promise.resolve()}}class ob{constructor(e){this.parser=e,this.name=ol.KHR_MATERIALS_SPECULAR}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?si:null}extendMaterialParams(e,t){let i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let n=[],a=r.extensions[this.name];t.specularIntensity=void 0!==a.specularFactor?a.specularFactor:1,void 0!==a.specularTexture&&n.push(i.assignTexture(t,"specularIntensityMap",a.specularTexture));let s=a.specularColorFactor||[1,1,1];return t.specularColor=new rP().setRGB(s[0],s[1],s[2],tW),void 0!==a.specularColorTexture&&n.push(i.assignTexture(t,"specularColorMap",a.specularColorTexture,"srgb")),Promise.all(n)}}class oy{constructor(e){this.parser=e,this.name=ol.EXT_MATERIALS_BUMP}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?si:null}extendMaterialParams(e,t){let i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let n=[],a=r.extensions[this.name];return t.bumpScale=void 0!==a.bumpFactor?a.bumpFactor:1,void 0!==a.bumpTexture&&n.push(i.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(n)}}class ox{constructor(e){this.parser=e,this.name=ol.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?si:null}extendMaterialParams(e,t){let i=this.parser,r=i.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let n=[],a=r.extensions[this.name];return void 0!==a.anisotropyStrength&&(t.anisotropy=a.anisotropyStrength),void 0!==a.anisotropyRotation&&(t.anisotropyRotation=a.anisotropyRotation),void 0!==a.anisotropyTexture&&n.push(i.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(n)}}class o_{constructor(e){this.parser=e,this.name=ol.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,i=t.json,r=i.textures[e];if(!r.extensions||!r.extensions[this.name])return null;let n=r.extensions[this.name],a=t.options.ktx2Loader;if(!a)if(!(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return t.loadTextureImage(e,n.source,a)}}class oE{constructor(e){this.parser=e,this.name=ol.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,i=this.parser,r=i.json,n=r.textures[e];if(!n.extensions||!n.extensions[t])return null;let a=n.extensions[t],s=r.images[a.source],o=i.textureLoader;if(s.uri){let e=i.options.manager.getHandler(s.uri);null!==e&&(o=e)}return i.loadTextureImage(e,a.source,o)}}class oS{constructor(e){this.parser=e,this.name=ol.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,i=this.parser,r=i.json,n=r.textures[e];if(!n.extensions||!n.extensions[t])return null;let a=n.extensions[t],s=r.images[a.source],o=i.textureLoader;if(s.uri){let e=i.options.manager.getHandler(s.uri);null!==e&&(o=e)}return i.loadTextureImage(e,a.source,o)}}class oC{constructor(e){this.name=ol.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,i=t.bufferViews[e];if(!i.extensions||!i.extensions[this.name])return null;{let e=i.extensions[this.name],r=this.parser.getDependency("buffer",e.buffer),n=this.parser.options.meshoptDecoder;if(!n||!n.supported)if(!(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return r.then(function(t){let i=e.byteOffset||0,r=e.byteLength||0,a=e.count,s=e.byteStride,o=new Uint8Array(t,i,r);return n.decodeGltfBufferAsync?n.decodeGltfBufferAsync(a,s,o,e.mode,e.filter).then(function(e){return e.buffer}):n.ready.then(function(){let t=new ArrayBuffer(a*s);return n.decodeGltfBuffer(new Uint8Array(t),a,s,o,e.mode,e.filter),t})})}}}class oM{constructor(e){this.name=ol.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||void 0===i.mesh)return null;for(let e of t.meshes[i.mesh].primitives)if(e.mode!==oU.TRIANGLES&&e.mode!==oU.TRIANGLE_STRIP&&e.mode!==oU.TRIANGLE_FAN&&void 0!==e.mode)return null;let r=i.extensions[this.name].attributes,n=[],a={};for(let e in r)n.push(this.parser.getDependency("accessor",r[e]).then(t=>(a[e]=t,a[e])));return n.length<1?null:(n.push(this.parser.createNodeMesh(e)),Promise.all(n).then(e=>{let t=e.pop(),i=t.isGroup?t.children:[t],r=e[0].count,n=[];for(let e of i){let t=new i$,i=new it,s=new ie,o=new it(1,1,1),l=new nX(e.geometry,e.material,r);for(let e=0;e<r;e++)a.TRANSLATION&&i.fromBufferAttribute(a.TRANSLATION,e),a.ROTATION&&s.fromBufferAttribute(a.ROTATION,e),a.SCALE&&o.fromBufferAttribute(a.SCALE,e),l.setMatrixAt(e,t.compose(i,s,o));for(let t in a)if("_COLOR_0"===t){let e=a[t];l.instanceColor=new nQ(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,a[t]);rf.prototype.copy.call(l,e),this.parser.assignFinalMaterial(l),n.push(l)}return t.isGroup?(t.clear(),t.add(...n),t):n[0]}))}}let ow="glTF";class oI{constructor(e){this.name=ol.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==ow)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-12,n=new DataView(e,12);let a=0;for(;a<r;){const t=n.getUint32(a,!0);a+=4;const r=n.getUint32(a,!0);if(a+=4,0x4e4f534a===r){const r=new Uint8Array(e,12+a,t);this.content=i.decode(r)}else if(5130562===r){const i=12+a;this.body=e.slice(i,i+t)}a+=t}if(null===this.content)throw Error("THREE.GLTFLoader: JSON content not found.")}}class oT{constructor(e,t){if(!t)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=ol.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let i=this.json,r=this.dracoLoader,n=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,s={},o={},l={};for(let e in a)s[oQ[e]||e.toLowerCase()]=a[e];for(let t in e.attributes){let r=oQ[t]||t.toLowerCase();if(void 0!==a[t]){let n=i.accessors[e.attributes[t]],a=oF[n.componentType];l[r]=a.name,o[r]=!0===n.normalized}}return t.getDependency("bufferView",n).then(function(e){return new Promise(function(t,i){r.decodeDracoFile(e,function(e){for(let t in e.attributes){let i=e.attributes[t],r=o[t];void 0!==r&&(i.normalized=r)}t(e)},s,l,tW,i)})})}}class oB{constructor(){this.name=ol.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(void 0===t.texCoord||t.texCoord===e.channel)&&void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class oR{constructor(){this.name=ol.KHR_MESH_QUANTIZATION}}class oD extends sl{constructor(e,t,i,r){super(e,t,i,r)}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,n=e*r*3+r;for(let e=0;e!==r;e++)t[e]=i[n+e];return t}interpolate_(e,t,i,r){let n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=2*s,l=3*s,h=r-t,c=(i-t)/h,u=c*c,d=u*c,p=e*l,A=p-l,f=-2*d+3*u,g=d-u,m=1-f,v=g-u+c;for(let e=0;e!==s;e++){let t=a[A+e+s],i=a[A+e+o]*h,r=a[p+e+s],l=a[p+e]*h;n[e]=m*t+v*i+f*r+g*l}return n}}let oL=new ie;class oP extends oD{interpolate_(e,t,i,r){let n=super.interpolate_(e,t,i,r);return oL.fromArray(n).normalize().toArray(n),n}}let oU={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},oF={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},oN={9728:1003,9729:1006,9984:1004,9985:1007,9986:1005,9987:1008},oO={33071:1001,33648:1002,10497:1e3},ok={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},oQ={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},oG={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},oH={CUBICSPLINE:void 0,LINEAR:2301,STEP:2300};function oz(e,t,i){for(let r in i.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=i.extensions[r])}function oV(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function oW(e){let t="",i=Object.keys(e).sort();for(let r=0,n=i.length;r<n;r++)t+=i[r]+":"+e[i[r]]+";";return t}function oq(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}let oj=new i$;class oX{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new oo,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,r=-1,n=!1,a=-1;if("u">typeof navigator){const e=navigator.userAgent;i=!0===/^((?!chrome|android).)*safari/i.test(e);const t=e.match(/Version\/(\d+)/);r=i&&t?parseInt(t[1],10):-1,a=(n=e.indexOf("Firefox")>-1)?e.match(/Firefox\/([0-9]+)\./)[1]:-1}"u"<typeof createImageBitmap||i&&r<17||n&&a<98?this.textureLoader=new sR(this.options.manager):this.textureLoader=new sX(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new sw(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let i=this,r=this.json,n=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:i,userData:{}};return oz(n,a,r),oV(a,r),Promise.all(i._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let i=0,r=t.length;i<r;i++){let r=t[i].joints;for(let t=0,i=r.length;t<i;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){let r=e[t];void 0!==r.mesh&&(this._addNodeRef(this.meshCache,r.mesh),void 0!==r.skin&&(i[r.mesh].isSkinnedMesh=!0)),void 0!==r.camera&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,i){if(e.refs[t]<=1)return i;let r=i.clone(),n=(e,t)=>{let i=this.associations.get(e);for(let[r,a]of(null!=i&&this.associations.set(t,i),e.children.entries()))n(a,t.children[r])};return n(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let i=0;i<t.length;i++){let r=e(t[i]);if(r)return r}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let i=[];for(let r=0;r<t.length;r++){let n=e(t[r]);n&&i.push(n)}return i}getDependency(e,t){let i=e+":"+t,r=this.cache.get(i);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":r=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(!(r=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(e,t)})))throw Error("Unknown type: "+e)}this.cache.add(i,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){let i=this;t=Promise.all((this.json[e+("mesh"===e?"es":"s")]||[]).map(function(t,r){return i.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],i=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[ol.KHR_BINARY_GLTF].body);let r=this.options;return new Promise(function(e,n){i.load(sq.resolveURL(t.uri,r.path),e,void 0,function(){n(Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){let i=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+i)})}loadAccessor(e){let t=this,i=this.json,r=this.json.accessors[e];if(void 0===r.bufferView&&void 0===r.sparse){let e=ok[r.type],t=oF[r.componentType],i=!0===r.normalized;return Promise.resolve(new rV(new t(r.count*e),e,i))}let n=[];return void 0!==r.bufferView?n.push(this.getDependency("bufferView",r.bufferView)):n.push(null),void 0!==r.sparse&&(n.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),n.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(n).then(function(e){let n,a=e[0],s=ok[r.type],o=oF[r.componentType],l=o.BYTES_PER_ELEMENT,h=l*s,c=r.byteOffset||0,u=void 0!==r.bufferView?i.bufferViews[r.bufferView].byteStride:void 0,d=!0===r.normalized;if(u&&u!==h){let e=Math.floor(c/u),i="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+e+":"+r.count,h=t.cache.get(i);h||(h=new n_(new o(a,e*u,r.count*u/l),u/l),t.cache.add(i,h)),n=new nS(h,s,c%u/l,d)}else n=new rV(null===a?new o(r.count*s):new o(a,c,r.count*s),s,d);if(void 0!==r.sparse){let t=ok.SCALAR,i=oF[r.sparse.indices.componentType],l=r.sparse.indices.byteOffset||0,h=r.sparse.values.byteOffset||0,c=new i(e[1],l,r.sparse.count*t),u=new o(e[2],h,r.sparse.count*s);null!==a&&(n=new rV(n.array.slice(),n.itemSize,n.normalized)),n.normalized=!1;for(let e=0,t=c.length;e<t;e++){let t=c[e];if(n.setX(t,u[e*s]),s>=2&&n.setY(t,u[e*s+1]),s>=3&&n.setZ(t,u[e*s+2]),s>=4&&n.setW(t,u[e*s+3]),s>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}n.normalized=d}return n})}loadTexture(e){let t=this.json,i=this.options,r=t.textures[e].source,n=t.images[r],a=this.textureLoader;if(n.uri){let e=i.manager.getHandler(n.uri);null!==e&&(a=e)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,i){let r=this,n=this.json,a=n.textures[e],s=n.images[t],o=(s.uri||s.bufferView)+":"+a.sampler;if(this.textureCache[o])return this.textureCache[o];let l=this.loadImageSource(t,i).then(function(t){t.flipY=!1,t.name=a.name||s.name||"",""===t.name&&"string"==typeof s.uri&&!1===s.uri.startsWith("data:image/")&&(t.name=s.uri);let i=(n.samplers||{})[a.sampler]||{};return t.magFilter=oN[i.magFilter]||1006,t.minFilter=oN[i.minFilter]||1008,t.wrapS=oO[i.wrapS]||1e3,t.wrapT=oO[i.wrapT]||1e3,t.generateMipmaps=!t.isCompressedTexture&&1003!==t.minFilter&&1006!==t.minFilter,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[o]=l,l}loadImageSource(e,t){let i=this.json,r=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());let n=i.images[e],a=self.URL||self.webkitURL,s=n.uri||"",o=!1;if(void 0!==n.bufferView)s=this.getDependency("bufferView",n.bufferView).then(function(e){o=!0;let t=new Blob([e],{type:n.mimeType});return s=a.createObjectURL(t)});else if(void 0===n.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let l=Promise.resolve(s).then(function(e){return new Promise(function(i,n){let a=i;!0===t.isImageBitmapLoader&&(a=function(e){let t=new ib(e);t.needsUpdate=!0,i(t)}),t.load(sq.resolveURL(e,r.path),a,void 0,n)})}).then(function(e){var t;return!0===o&&a.revokeObjectURL(s),oV(e,n),e.userData.mimeType=n.mimeType||((t=n.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":t.search(/\.ktx2($|\?)/i)>0||0===t.search(/^data\:image\/ktx2/)?"image/ktx2":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),e});return this.sourceCache[e]=l,l}assignTexture(e,t,i,r){let n=this;return this.getDependency("texture",i.index).then(function(a){if(!a)return null;if(void 0!==i.texCoord&&i.texCoord>0&&((a=a.clone()).channel=i.texCoord),n.extensions[ol.KHR_TEXTURE_TRANSFORM]){let e=void 0!==i.extensions?i.extensions[ol.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=n.associations.get(a);a=n.extensions[ol.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),n.associations.set(a,t)}}return void 0!==r&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,i=e.material,r=void 0===t.attributes.tangent,n=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+i.uuid,t=this.cache.get(e);t||(t=new ao,rN.prototype.copy.call(t,i),t.color.copy(i.color),t.map=i.map,t.sizeAttenuation=!1,this.cache.add(e,t)),i=t}else if(e.isLine){let e="LineBasicMaterial:"+i.uuid,t=this.cache.get(e);t||(t=new n3,rN.prototype.copy.call(t,i),t.color.copy(i.color),t.map=i.map,this.cache.add(e,t)),i=t}if(r||n||a){let e="ClonedMaterial:"+i.uuid+":";r&&(e+="derivative-tangents:"),n&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=i.clone(),n&&(t.vertexColors=!0),a&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(i))),i=t}e.material=i}getMaterialType(){return st}loadMaterial(e){let t,i=this,r=this.json,n=this.extensions,a=r.materials[e],s={},o=a.extensions||{},l=[];if(o[ol.KHR_MATERIALS_UNLIT]){let e=n[ol.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),l.push(e.extendParams(s,a,i))}else{let r=a.pbrMetallicRoughness||{};if(s.color=new rP(1,1,1),s.opacity=1,Array.isArray(r.baseColorFactor)){let e=r.baseColorFactor;s.color.setRGB(e[0],e[1],e[2],tW),s.opacity=e[3]}void 0!==r.baseColorTexture&&l.push(i.assignTexture(s,"map",r.baseColorTexture,"srgb")),s.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,s.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(l.push(i.assignTexture(s,"metalnessMap",r.metallicRoughnessTexture)),l.push(i.assignTexture(s,"roughnessMap",r.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)})))}!0===a.doubleSided&&(s.side=2);let h=a.alphaMode||"OPAQUE";if("BLEND"===h?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,"MASK"===h&&(s.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==rO&&(l.push(i.assignTexture(s,"normalMap",a.normalTexture)),s.normalScale=new t7(1,1),void 0!==a.normalTexture.scale)){let e=a.normalTexture.scale;s.normalScale.set(e,e)}if(void 0!==a.occlusionTexture&&t!==rO&&(l.push(i.assignTexture(s,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(s.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==rO){let e=a.emissiveFactor;s.emissive=new rP().setRGB(e[0],e[1],e[2],tW)}return void 0!==a.emissiveTexture&&t!==rO&&l.push(i.assignTexture(s,"emissiveMap",a.emissiveTexture,"srgb")),Promise.all(l).then(function(){let r=new t(s);return a.name&&(r.name=a.name),oV(r,a),i.associations.set(r,{materials:e}),a.extensions&&oz(n,r,a),r})}createUniqueName(e){let t=s3.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,i=this.extensions,r=this.primitiveCache,n=[];for(let a=0,s=e.length;a<s;a++){let s=e[a],o=function(e){let t,i=e.extensions&&e.extensions[ol.KHR_DRACO_MESH_COMPRESSION];if(t=i?"draco:"+i.bufferView+":"+i.indices+":"+oW(i.attributes):e.indices+":"+oW(e.attributes)+":"+e.mode,void 0!==e.targets)for(let i=0,r=e.targets.length;i<r;i++)t+=":"+oW(e.targets[i]);return t}(s),l=r[o];if(l)n.push(l.promise);else{let e;e=s.extensions&&s.extensions[ol.KHR_DRACO_MESH_COMPRESSION]?function(e){return i[ol.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(i){return oY(i,e,t)})}(s):oY(new r1,s,t),r[o]={primitive:s,promise:e},n.push(e)}}return Promise.all(n)}loadMesh(e){let t=this,i=this.json,r=this.extensions,n=i.meshes[e],a=n.primitives,s=[];for(let e=0,t=a.length;e<t;e++){var o;let t=void 0===a[e].material?(void 0===(o=this.cache).DefaultMaterial&&(o.DefaultMaterial=new st({color:0xffffff,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),o.DefaultMaterial):this.getDependency("material",a[e].material);s.push(t)}return s.push(t.loadGeometries(a)),Promise.all(s).then(function(i){let s=i.slice(0,i.length-1),o=i[i.length-1],l=[];for(let i=0,h=o.length;i<h;i++){let h,c=o[i],u=a[i],d=s[i];if(u.mode===oU.TRIANGLES||u.mode===oU.TRIANGLE_STRIP||u.mode===oU.TRIANGLE_FAN||void 0===u.mode)!0===(h=!0===n.isSkinnedMesh?new nP(c,d):new nr(c,d)).isSkinnedMesh&&h.normalizeSkinWeights(),u.mode===oU.TRIANGLE_STRIP?h.geometry=oa(h.geometry,1):u.mode===oU.TRIANGLE_FAN&&(h.geometry=oa(h.geometry,2));else if(u.mode===oU.LINES)h=new aa(c,d);else if(u.mode===oU.LINE_STRIP)h=new at(c,d);else if(u.mode===oU.LINE_LOOP)h=new as(c,d);else if(u.mode===oU.POINTS)h=new ad(c,d);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+u.mode);Object.keys(h.geometry.morphAttributes).length>0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let i=0,r=t.weights.length;i<r;i++)e.morphTargetInfluences[i]=t.weights[i];if(t.extras&&Array.isArray(t.extras.targetNames)){let i=t.extras.targetNames;if(e.morphTargetInfluences.length===i.length){e.morphTargetDictionary={};for(let t=0,r=i.length;t<r;t++)e.morphTargetDictionary[i[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}(h,n),h.name=t.createUniqueName(n.name||"mesh_"+e),oV(h,n),u.extensions&&oz(r,h,u),t.assignFinalMaterial(h),l.push(h)}for(let i=0,r=l.length;i<r;i++)t.associations.set(l[i],{meshes:e,primitives:i});if(1===l.length)return n.extensions&&oz(r,l[0],n),l[0];let h=new nv;n.extensions&&oz(r,h,n),t.associations.set(h,{meshes:e});for(let e=0,t=l.length;e<t;e++)h.add(l[e]);return h})}loadCamera(e){let t,i=this.json.cameras[e],r=i[i.type];return r?("perspective"===i.type?t=new nA(r.yfov*t4,r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===i.type&&(t=new sG(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),oV(t,i),Promise.resolve(t)):void console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){let t=this.json.skins[e],i=[];for(let e=0,r=t.joints.length;e<r;e++)i.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?i.push(this.getDependency("accessor",t.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(e){let i=e.pop(),r=[],n=[];for(let a=0,s=e.length;a<s;a++){let s=e[a];if(s){r.push(s);let e=new i$;null!==i&&e.fromArray(i.array,16*a),n.push(e)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[a])}return new nk(r,n)})}loadAnimation(e){let t=this.json,i=this,r=t.animations[e],n=r.name?r.name:"animation_"+e,a=[],s=[],o=[],l=[],h=[];for(let e=0,t=r.channels.length;e<t;e++){let t=r.channels[e],i=r.samplers[t.sampler],n=t.target,c=n.node,u=void 0!==r.parameters?r.parameters[i.input]:i.input,d=void 0!==r.parameters?r.parameters[i.output]:i.output;void 0!==n.node&&(a.push(this.getDependency("node",c)),s.push(this.getDependency("accessor",u)),o.push(this.getDependency("accessor",d)),l.push(i),h.push(n))}return Promise.all([Promise.all(a),Promise.all(s),Promise.all(o),Promise.all(l),Promise.all(h)]).then(function(e){let t=e[0],a=e[1],s=e[2],o=e[3],l=e[4],h=[];for(let e=0,r=t.length;e<r;e++){let r=t[e],n=a[e],c=s[e],u=o[e],d=l[e];if(void 0===r)continue;r.updateMatrix&&r.updateMatrix();let p=i._createAnimationTracks(r,n,c,u,d);if(p)for(let e=0;e<p.length;e++)h.push(p[e])}let c=new sy(n,void 0,h);return oV(c,r),c})}createNodeMesh(e){let t=this.json,i=this,r=t.nodes[e];return void 0===r.mesh?null:i.getDependency("mesh",r.mesh).then(function(e){let t=i._getNodeRef(i.meshCache,r.mesh,e);return void 0!==r.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,i=r.weights.length;t<i;t++)e.morphTargetInfluences[t]=r.weights[t]}),t})}loadNode(e){let t=this.json.nodes[e],i=this._loadNodeShallow(e),r=[],n=t.children||[];for(let e=0,t=n.length;e<t;e++)r.push(this.getDependency("node",n[e]));let a=void 0===t.skin?Promise.resolve(null):this.getDependency("skin",t.skin);return Promise.all([i,Promise.all(r),a]).then(function(e){let t=e[0],i=e[1],r=e[2];null!==r&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(r,oj)});for(let e=0,r=i.length;e<r;e++)t.add(i[e]);return t})}_loadNodeShallow(e){let t=this.json,i=this.extensions,r=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];let n=t.nodes[e],a=n.name?r.createUniqueName(n.name):"",s=[],o=r._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return o&&s.push(o),void 0!==n.camera&&s.push(r.getDependency("camera",n.camera).then(function(e){return r._getNodeRef(r.cameraCache,n.camera,e)})),r._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){s.push(e)}),this.nodeCache[e]=Promise.all(s).then(function(t){let s;if((s=!0===n.isBone?new nU:t.length>1?new nv:1===t.length?t[0]:new rf)!==t[0])for(let e=0,i=t.length;e<i;e++)s.add(t[e]);if(n.name&&(s.userData.name=n.name,s.name=a),oV(s,n),n.extensions&&oz(i,s,n),void 0!==n.matrix){let e=new i$;e.fromArray(n.matrix),s.applyMatrix4(e)}else void 0!==n.translation&&s.position.fromArray(n.translation),void 0!==n.rotation&&s.quaternion.fromArray(n.rotation),void 0!==n.scale&&s.scale.fromArray(n.scale);if(r.associations.has(s)){if(void 0!==n.mesh&&r.meshCache.refs[n.mesh]>1){let e=r.associations.get(s);r.associations.set(s,{...e})}}else r.associations.set(s,{});return r.associations.get(s).nodes=e,s}),this.nodeCache[e]}loadScene(e){let t=this.extensions,i=this.json.scenes[e],r=this,n=new nv;i.name&&(n.name=r.createUniqueName(i.name)),oV(n,i),i.extensions&&oz(t,n,i);let a=i.nodes||[],s=[];for(let e=0,t=a.length;e<t;e++)s.push(r.getDependency("node",a[e]));return Promise.all(s).then(function(e){for(let t=0,i=e.length;t<i;t++)n.add(e[t]);return r.associations=(e=>{let t=new Map;for(let[e,i]of r.associations)(e instanceof rN||e instanceof ib)&&t.set(e,i);return e.traverse(e=>{let i=r.associations.get(e);null!=i&&t.set(e,i)}),t})(n),n})}_createAnimationTracks(e,t,i,r,n){let a,s=[],o=e.name?e.name:e.uuid,l=[];switch(oG[n.path]===oG.weights?e.traverse(function(e){e.morphTargetInfluences&&l.push(e.name?e.name:e.uuid)}):l.push(o),oG[n.path]){case oG.weights:a=sf;break;case oG.rotation:a=sm;break;case oG.translation:case oG.scale:a=sb;break;default:a=1===i.itemSize?sf:sb}let h=void 0!==r.interpolation?oH[r.interpolation]:2301,c=this._getArrayFromAccessor(i);for(let e=0,i=l.length;e<i;e++){let i=new a(l[e]+"."+oG[n.path],t.array,c,h);"CUBICSPLINE"===r.interpolation&&this._createCubicSplineTrackInterpolant(i),s.push(i)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let e=oq(t.constructor),i=new Float32Array(t.length);for(let r=0,n=t.length;r<n;r++)i[r]=t[r]*e;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof sm?oP:oD)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function oY(e,t,i){let r=t.attributes,n=[];for(let t in r){let a=oQ[t]||t.toLowerCase();a in e.attributes||n.push(function(t,r){return i.getDependency("accessor",t).then(function(t){e.setAttribute(r,t)})}(r[t],a))}if(void 0!==t.indices&&!e.index){let r=i.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});n.push(r)}return ih.workingColorSpace!==tW&&"COLOR_0"in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ih.workingColorSpace}" not supported.`),oV(e,t),!function(e,t,i){let r=t.attributes,n=new iC;if(void 0===r.POSITION)return;{let e=i.json.accessors[r.POSITION],t=e.min,a=e.max;if(void 0===t||void 0===a)return console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(n.set(new it(t[0],t[1],t[2]),new it(a[0],a[1],a[2])),e.normalized){let t=oq(oF[e.componentType]);n.min.multiplyScalar(t),n.max.multiplyScalar(t)}}let a=t.targets;if(void 0!==a){let e=new it,t=new it;for(let r=0,n=a.length;r<n;r++){let n=a[r];if(void 0!==n.POSITION){let r=i.json.accessors[n.POSITION],a=r.min,s=r.max;if(void 0!==a&&void 0!==s){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(s[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(s[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(s[2]))),r.normalized){let e=oq(oF[r.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(e)}e.boundingBox=n;let s=new iz;n.getCenter(s.center),s.radius=n.min.distanceTo(n.max)/2,e.boundingSphere=s}(e,t,i),Promise.all(n).then(function(){return void 0!==t.targets?function(e,t,i){let r=!1,n=!1,a=!1;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(void 0!==i.POSITION&&(r=!0),void 0!==i.NORMAL&&(n=!0),void 0!==i.COLOR_0&&(a=!0),r&&n&&a)break}if(!r&&!n&&!a)return Promise.resolve(e);let s=[],o=[],l=[];for(let h=0,c=t.length;h<c;h++){let c=t[h];if(r){let t=void 0!==c.POSITION?i.getDependency("accessor",c.POSITION):e.attributes.position;s.push(t)}if(n){let t=void 0!==c.NORMAL?i.getDependency("accessor",c.NORMAL):e.attributes.normal;o.push(t)}if(a){let t=void 0!==c.COLOR_0?i.getDependency("accessor",c.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(s),Promise.all(o),Promise.all(l)]).then(function(t){let i=t[0],s=t[1],o=t[2];return r&&(e.morphAttributes.position=i),n&&(e.morphAttributes.normal=s),a&&(e.morphAttributes.color=o),e.morphTargetsRelative=!0,e})}(e,t.targets,i):e})}class oK{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0,this.workerCreator=null}_initWorker(e){if(!this.workers[e]){let t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return -1}_onMessage(e,t){let i=this.workersResolve[e];if(i&&i(t),this.queue.length){let{resolve:t,msg:i,transfer:r}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(i,r)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(i=>{let r=this._getIdleWorker();-1!==r?(this._initWorker(r),this.workerStatus|=1<<r,this.workersResolve[r]=i,this.workers[r].postMessage(e,t)):this.queue.push({resolve:i,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}class oJ{constructor(e,t,i,r){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,i),this._littleEndian=r,this._offset=0}_nextUint8(){let e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){let e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){let e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){let e=this._dataView.getUint32(this._offset,this._littleEndian)+0x100000000*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){let e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){let t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t=0){let i=this._offset,r=0;for(;this._dataView.getUint8(this._offset)!==t&&r<e;)r++,this._offset++;return r<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+i,r)}}new Uint8Array([0]);let o$=[171,75,84,88,32,50,48,187,13,10,26,10];function oZ(e){return(new TextDecoder).decode(e)}let o0={env:{emscripten_notify_memory_growth:function(e){r=new Uint8Array(i.exports.memory.buffer)}}};class o1{init(){return t||(t="u">typeof fetch?fetch("data:application/wasm;base64,"+o2).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,o0)).then(this._init):WebAssembly.instantiate(Buffer.from(o2,"base64"),o0).then(this._init))}_init(e){i=e.instance,o0.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!i)throw Error("ZSTDDecoder: Await .init() before decoding.");let n=e.byteLength,a=i.exports.malloc(n);r.set(e,a),t=t||Number(i.exports.ZSTD_findDecompressedSize(a,n));let s=i.exports.malloc(t),o=i.exports.ZSTD_decompress(s,t,a,n),l=r.slice(s,s+o);return i.exports.free(a),i.exports.free(s),l}}let o2="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ";({...ih.spaces.srgb,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb",toneMappingMode:"extended"}});let o3=new WeakMap,o4=0;class o5 extends sS{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new oK,this.workerSourceURL="",this.workerConfig=null,"u">typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return console.warn('KTX2Loader: "detectSupportAsync()" has been deprecated. Use "detectSupport()" and "await renderer.init();" when creating the renderer.'),await e.init(),this.detectSupport(e)}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-s3tc"),bptcSupported:e.hasFeature("texture-compression-bc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:(this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:e.extensions.has("WEBGL_compressed_texture_astc")&&e.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},"u">typeof navigator&&navigator.platform.indexOf("Linux")>=0&&navigator.userAgent.indexOf("Firefox")>=0&&this.workerConfig.astcSupported&&this.workerConfig.etc2Supported&&this.workerConfig.bptcSupported&&this.workerConfig.dxtSupported&&(this.workerConfig.astcSupported=!1,this.workerConfig.etc2Supported=!1)),this}init(){if(!this.transcoderPending){let e=new sw(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);let t=e.loadAsync("basis_transcoder.js"),i=new sw(this.manager);i.setPath(this.transcoderPath),i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);let r=i.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,r]).then(([e,t])=>{let i=o5.BasisWorker.toString(),r=["/* constants */","let _EngineFormat = "+JSON.stringify(o5.EngineFormat),"let _EngineType = "+JSON.stringify(o5.EngineType),"let _TranscoderFormat = "+JSON.stringify(o5.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(o5.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r])),this.transcoderBinary=t,this.workerPool.setWorkerCreator(()=>{let e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e})}),o4>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),o4++}return this.transcoderPending}load(e,t,i,r){if(null===this.workerConfig)throw Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");let n=new sw(this.manager);n.setPath(this.path),n.setCrossOrigin(this.crossOrigin),n.setWithCredentials(this.withCredentials),n.setRequestHeader(this.requestHeader),n.setResponseType("arraybuffer"),n.load(e,e=>{this.parse(e,t,r)},i,r)}parse(e,t,i){if(null===this.workerConfig)throw Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(o3.has(e))return o3.get(e).promise.then(t).catch(i);this._createTexture(e).then(e=>t?t(e):null).catch(i)}_createTextureFrom(e,t){let i,{type:r,error:n,data:{faces:a,width:s,height:o,format:l,type:h,dfdFlags:c}}=e;if("error"===r)return Promise.reject(n);if(6===t.faceCount)i=new am(a,l,h);else{let e=a[0].mipmaps;i=t.layerCount>1?new ag(e,s,o,t.layerCount,l,h):new af(e,s,o,l,h)}return i.minFilter=1===a[0].mipmaps.length?1006:1008,i.magFilter=1006,i.generateMipmaps=!1,i.needsUpdate=!0,i.colorSpace=le(t),i.premultiplyAlpha=!!(1&c),i}async _createTexture(e,t={}){let i=function(e){let t=new Uint8Array(e.buffer,e.byteOffset,o$.length);if(t[0]!==o$[0]||t[1]!==o$[1]||t[2]!==o$[2]||t[3]!==o$[3]||t[4]!==o$[4]||t[5]!==o$[5]||t[6]!==o$[6]||t[7]!==o$[7]||t[8]!==o$[8]||t[9]!==o$[9]||t[10]!==o$[10]||t[11]!==o$[11])throw Error("Missing KTX 2.0 identifier.");let i={vkFormat:0,typeSize:1,pixelWidth:0,pixelHeight:0,pixelDepth:0,layerCount:0,faceCount:1,levelCount:0,supercompressionScheme:0,levels:[],dataFormatDescriptor:[{vendorId:0,descriptorType:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],keyValue:{},globalData:null},r=17*Uint32Array.BYTES_PER_ELEMENT,n=new oJ(e,o$.length,r,!0);i.vkFormat=n._nextUint32(),i.typeSize=n._nextUint32(),i.pixelWidth=n._nextUint32(),i.pixelHeight=n._nextUint32(),i.pixelDepth=n._nextUint32(),i.layerCount=n._nextUint32(),i.faceCount=n._nextUint32(),i.levelCount=n._nextUint32(),i.supercompressionScheme=n._nextUint32();let a=n._nextUint32(),s=n._nextUint32(),o=n._nextUint32(),l=n._nextUint32(),h=n._nextUint64(),c=n._nextUint64(),u=3*Math.max(i.levelCount,1)*8,d=new oJ(e,o$.length+r,u,!0);for(let t=0,r=Math.max(i.levelCount,1);t<r;t++)i.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});let p=new oJ(e,a,s,!0);p._skip(4);let A=p._nextUint16(),f=p._nextUint16(),g=p._nextUint16(),m=p._nextUint16(),v={vendorId:A,descriptorType:f,versionNumber:g,colorModel:p._nextUint8(),colorPrimaries:p._nextUint8(),transferFunction:p._nextUint8(),flags:p._nextUint8(),texelBlockDimension:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],bytesPlane:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],samples:[]},b=(m/4-6)/4;for(let e=0;e<b;e++){let t={bitOffset:p._nextUint16(),bitLength:p._nextUint8(),channelType:p._nextUint8(),samplePosition:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=p._nextInt32(),t.sampleUpper=p._nextInt32()):(t.sampleLower=p._nextUint32(),t.sampleUpper=p._nextUint32()),v.samples[e]=t}i.dataFormatDescriptor.length=0,i.dataFormatDescriptor.push(v);let y=new oJ(e,o,l,!0);for(;y._offset<l;){let e=y._nextUint32(),t=y._scan(e),r=oZ(t);if(i.keyValue[r]=y._nextUint8Array(e-t.byteLength-1),r.match(/^ktx/i)){let e=oZ(i.keyValue[r]);i.keyValue[r]=e.substring(0,e.lastIndexOf("\0"))}y._skip(e%4?4-e%4:0)}if(c<=0)return i;let x=new oJ(e,h,c,!0),_=x._nextUint16(),E=x._nextUint16(),S=x._nextUint32(),C=x._nextUint32(),M=x._nextUint32(),w=x._nextUint32(),I=[];for(let e=0,t=Math.max(i.levelCount,1);e<t;e++)I.push({imageFlags:x._nextUint32(),rgbSliceByteOffset:x._nextUint32(),rgbSliceByteLength:x._nextUint32(),alphaSliceByteOffset:x._nextUint32(),alphaSliceByteLength:x._nextUint32()});let T=h+x._offset,B=T+S,R=B+C,D=R+M;return i.globalData={endpointCount:_,selectorCount:E,imageDescs:I,endpointsData:new Uint8Array(e.buffer,e.byteOffset+T,S),selectorsData:new Uint8Array(e.buffer,e.byteOffset+B,C),tablesData:new Uint8Array(e.buffer,e.byteOffset+R,M),extendedData:new Uint8Array(e.buffer,e.byteOffset+D,w)},i}(new Uint8Array(e)),r=1000066e3===i.vkFormat&&167===i.dataFormatDescriptor[0].colorModel;if(!(0===i.vkFormat||r&&!this.workerConfig.astcHDRSupported))return o7(i);let n=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:t},[e])).then(e=>this._createTextureFrom(e.data,i));return o3.set(e,{promise:n}),n}dispose(){this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),o4--}}o5.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2},o5.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25},o5.EngineFormat={RGBAFormat:1023,RGBA_ASTC_4x4_Format:37808,RGB_BPTC_UNSIGNED_Format:36495,RGBA_BPTC_Format:36492,RGBA_ETC2_EAC_Format:37496,RGBA_PVRTC_4BPPV1_Format:35842,RGBA_S3TC_DXT5_Format:33779,RGB_ETC1_Format:36196,RGB_ETC2_Format:37492,RGB_PVRTC_4BPPV1_Format:35840,RGBA_S3TC_DXT1_Format:33777},o5.EngineType={UnsignedByteType:1009,HalfFloatType:1016,FloatType:1015},o5.BasisWorker=function(){let e,t,i,r=_EngineFormat,n=_EngineType,a=_TranscoderFormat,s=_BasisFormat;self.addEventListener("message",function(r){let a=r.data;switch(a.type){case"init":var o;e=a.config,o=a.transcoderBinary,t=new Promise(e=>{BASIS(i={wasmBinary:o,onRuntimeInitialized:e})}).then(()=>{i.initializeBasis(),void 0===i.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")});break;case"transcode":t.then(()=>{try{let{faces:t,buffers:r,width:o,height:c,hasAlpha:u,format:d,type:p,dfdFlags:A}=function(t){let r,a=new i.KTX2File(new Uint8Array(t));function o(){a.close(),a.delete()}if(!a.isValid())throw o(),Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");if(a.isUASTC())r=s.UASTC;else if(a.isETC1S())r=s.ETC1S;else if(a.isHDR())r=s.UASTC_HDR;else throw Error("THREE.KTX2Loader: Unknown Basis encoding");let c=a.getWidth(),u=a.getHeight(),d=a.getLayers()||1,p=a.getLevels(),A=a.getFaces(),f=a.getHasAlpha(),g=a.getDFDFlags(),{transcoderFormat:m,engineFormat:v,engineType:b}=function(t,i,r,n){let a=l[t];for(let s=0;s<a.length;s++){let o=a[s];if(o.if&&!e[o.if]||!o.basisFormat.includes(t)||n&&o.transcoderFormat.length<2||o.needsPowerOfTwo&&!(h(i)&&h(r)))continue;let l=o.transcoderFormat[+!!n],c=o.engineFormat[+!!n];return{transcoderFormat:l,engineFormat:c,engineType:o.engineType[0]}}throw Error("THREE.KTX2Loader: Failed to identify transcoding target.")}(r,c,u,f);if(!c||!u||!p)throw o(),Error("THREE.KTX2Loader: Invalid texture");if(!a.startTranscoding())throw o(),Error("THREE.KTX2Loader: .startTranscoding failed");let y=[],x=[];for(let e=0;e<A;e++){let t=[];for(let i=0;i<p;i++){let r,s,l=[];for(let t=0;t<d;t++){let h=a.getImageLevelInfo(i,t,e);0===e&&0===i&&0===t&&(h.origWidth%4!=0||h.origHeight%4!=0)&&console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),p>1?(r=h.origWidth,s=h.origHeight):(r=h.width,s=h.height);let c=new Uint8Array(a.getImageTranscodedSizeInBytes(i,t,0,m)),u=a.transcodeImage(c,i,t,e,m,0,-1,-1);if(b===n.HalfFloatType&&(c=new Uint16Array(c.buffer,c.byteOffset,c.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!u)throw o(),Error("THREE.KTX2Loader: .transcodeImage failed.");l.push(c)}let h=function(e){if(1===e.length)return e[0];let t=0;for(let i=0;i<e.length;i++)t+=e[i].byteLength;let i=new Uint8Array(t),r=0;for(let t=0;t<e.length;t++){let n=e[t];i.set(n,r),r+=n.byteLength}return i}(l);t.push({data:h,width:r,height:s}),x.push(h.buffer)}y.push({mipmaps:t,width:c,height:u,format:v,type:b})}return o(),{faces:y,buffers:x,width:c,height:u,hasAlpha:f,dfdFlags:g,format:v,type:b}}(a.buffer);self.postMessage({type:"transcode",id:a.id,data:{faces:t,width:o,height:c,hasAlpha:u,format:d,type:p,dfdFlags:A}},r)}catch(e){console.error(e),self.postMessage({type:"error",id:a.id,error:e.message})}})}});let o=[{if:"astcSupported",basisFormat:[s.UASTC],transcoderFormat:[a.ASTC_4x4,a.ASTC_4x4],engineFormat:[r.RGBA_ASTC_4x4_Format,r.RGBA_ASTC_4x4_Format],engineType:[n.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[s.ETC1S,s.UASTC],transcoderFormat:[a.BC7_M5,a.BC7_M5],engineFormat:[r.RGBA_BPTC_Format,r.RGBA_BPTC_Format],engineType:[n.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[s.ETC1S,s.UASTC],transcoderFormat:[a.BC1,a.BC3],engineFormat:[r.RGBA_S3TC_DXT1_Format,r.RGBA_S3TC_DXT5_Format],engineType:[n.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[s.ETC1S,s.UASTC],transcoderFormat:[a.ETC1,a.ETC2],engineFormat:[r.RGB_ETC2_Format,r.RGBA_ETC2_EAC_Format],engineType:[n.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[s.ETC1S,s.UASTC],transcoderFormat:[a.ETC1],engineFormat:[r.RGB_ETC1_Format],engineType:[n.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[s.ETC1S,s.UASTC],transcoderFormat:[a.PVRTC1_4_RGB,a.PVRTC1_4_RGBA],engineFormat:[r.RGB_PVRTC_4BPPV1_Format,r.RGBA_PVRTC_4BPPV1_Format],engineType:[n.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[s.UASTC_HDR],transcoderFormat:[a.BC6H],engineFormat:[r.RGB_BPTC_UNSIGNED_Format],engineType:[n.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[s.ETC1S,s.UASTC],transcoderFormat:[a.RGBA32,a.RGBA32],engineFormat:[r.RGBAFormat,r.RGBAFormat],engineType:[n.UnsignedByteType,n.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[s.UASTC_HDR],transcoderFormat:[a.RGBA_HALF],engineFormat:[r.RGBAFormat],engineType:[n.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],l={[s.ETC1S]:o.filter(e=>e.basisFormat.includes(s.ETC1S)).sort((e,t)=>e.priorityETC1S-t.priorityETC1S),[s.UASTC]:o.filter(e=>e.basisFormat.includes(s.UASTC)).sort((e,t)=>e.priorityUASTC-t.priorityUASTC),[s.UASTC_HDR]:o.filter(e=>e.basisFormat.includes(s.UASTC_HDR)).sort((e,t)=>e.priorityHDR-t.priorityHDR)};function h(e){return e<=2||(e&e-1)==0&&0!==e}};let o8=new Set([1023,1022,1030,1028]),o9={109:1023,103:1030,100:1028,97:1023,83:1030,76:1028,43:1023,37:1023,22:1030,16:1030,15:1028,9:1028,123:1022,122:1022,152:37496,148:37492,153:37488,154:37489,155:37490,156:37491,1000066e3:37808,158:37808,157:37808,0x3b9bcbd4:37812,166:37812,165:37812,134:33777,133:33777,132:33776,131:33776,138:33778,137:33778,140:36284,139:36283,142:36286,141:36285,146:36492,145:36492,0x3b9b9cf5:35842,0x3b9b9cf1:35842,0x3b9b9cf4:35843,1000054e3:35843},o6={109:1015,103:1015,100:1015,97:1016,83:1016,76:1016,43:1009,37:1009,22:1009,16:1009,15:1009,9:1009,123:35902,122:35899,152:1009,148:1009,153:1009,153:1009,155:1009,155:1009,1000066e3:1016,158:1009,157:1009,0x3b9bcbd4:1016,166:1009,165:1009,134:1009,133:1009,132:1009,131:1009,138:1009,137:1009,140:1009,139:1009,142:1009,141:1009,146:1009,145:1009,0x3b9b9cf5:1009,0x3b9b9cf1:1009,0x3b9b9cf4:1009,1000054e3:1009};async function o7(e){let t,i,{vkFormat:r}=e;if(void 0===o9[r])throw Error("THREE.KTX2Loader: Unsupported vkFormat: "+r);void 0===o6[r]&&console.warn('THREE.KTX2Loader: Missing ".type" for vkFormat: '+r),2===e.supercompressionScheme&&(n||(n=new Promise(async e=>{let t=new o1;await t.init(),e(t)})),t=await n);let a=[];for(let i=0;i<e.levels.length;i++){let n,s,o=Math.max(1,e.pixelWidth>>i),l=Math.max(1,e.pixelHeight>>i),h=e.pixelDepth?Math.max(1,e.pixelDepth>>i):0,c=e.levels[i];if(0===e.supercompressionScheme)n=c.levelData;else if(2===e.supercompressionScheme)n=t.decode(c.levelData,c.uncompressedByteLength);else throw Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");s=1015===o6[r]?new Float32Array(n.buffer,n.byteOffset,n.byteLength/Float32Array.BYTES_PER_ELEMENT):1016===o6[r]?new Uint16Array(n.buffer,n.byteOffset,n.byteLength/Uint16Array.BYTES_PER_ELEMENT):35902===o6[r]||35899===o6[r]?new Uint32Array(n.buffer,n.byteOffset,n.byteLength/Uint32Array.BYTES_PER_ELEMENT):n,a.push({data:s,width:o,height:l,depth:h})}let s=0===e.levelCount||a.length>1;if(o8.has(o9[r]))(i=0===e.pixelDepth?new nF(a[0].data,e.pixelWidth,e.pixelHeight):new iS(a[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth)).minFilter=s?1004:1003,i.magFilter=1003,i.generateMipmaps=0===e.levelCount;else{if(e.pixelDepth>0)throw Error("THREE.KTX2Loader: Unsupported pixelDepth.");(i=new af(a,e.pixelWidth,e.pixelHeight)).minFilter=s?1008:1006,i.magFilter=1006}return i.mipmaps=a,i.type=o6[r],i.format=o9[r],i.colorSpace=le(e),i.needsUpdate=!0,Promise.resolve(i)}function le(e){let t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?"srgb":tW:10===t.colorPrimaries?2===t.transferFunction?"display-p3":"display-p3-linear":(0===t.colorPrimaries||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),"")}let lt=Symbol("retainerCount"),li=Symbol("recentlyUsed"),lr=Symbol("evict"),ln=Symbol("evictionThreshold"),la=Symbol("cache");class ls{constructor(e,t=5){this[e8]=new Map,this[e9]=[],this[la]=e,this[ln]=t}set evictionThreshold(e){this[ln]=e,this[lr]()}get evictionThreshold(){return this[ln]}get cache(){return this[la]}retainerCount(e){return this[lt].get(e)||0}reset(){this[lt].clear(),this[li]=[]}retain(e){this[lt].has(e)||this[lt].set(e,0),this[lt].set(e,this[lt].get(e)+1);let t=this[li].indexOf(e);-1!==t&&this[li].splice(t,1),this[li].unshift(e),this[lr]()}release(e){this[lt].has(e)&&this[lt].set(e,Math.max(this[lt].get(e)-1,0)),this[lr]()}[(e8=lt,e9=li,lr)](){if(!(this[li].length<this[ln]))for(let e=this[li].length-1;e>=this[ln];--e){let t=this[li][e];0===this[lt].get(t)&&(this[la].delete(t),this[li].splice(e,1))}}}let lo=e=>{let t=new Map;for(let i of e.mappings)for(let e of i.variants)t.set(e,{material:null,gltfMaterialIndex:i.material});return t};class ll{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){let t=this.parser,i=t.json;if(void 0===i.extensions||void 0===i.extensions[this.name])return null;let r=(e=>{let t=[],i=new Set;for(let r of e){let e=r,n=0;for(;i.has(e);)e=r+"."+ ++n;i.add(e),t.push(e)}return t})((i.extensions[this.name].variants||[]).map(e=>e.name));for(let r of e.scenes)r.traverse(e=>{if(!e.material)return;let r=t.associations.get(e);if(null==r||null==r.meshes||null==r.primitives)return;let n=i.meshes[r.meshes].primitives[r.primitives].extensions;n&&n[this.name]&&(e.userData.variantMaterials=lo(n[this.name]))});return e.userData.variants=r,Promise.resolve()}}ib.DEFAULT_ANISOTROPY=4;let lh=new Map,lc=new Map,lu=new class extends sS{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,r){let n=new sw(this.manager);n.setPath(this.path),n.setResponseType("arraybuffer"),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(e,e=>{this.parse(e,t,r)},i,r)}parse(e,t,i=()=>{}){this.decodeDracoFile(e,t,null,null,"srgb",i).catch(i)}decodeDracoFile(e,t,i,r,n=tW,a=()=>{}){let s={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:n};return this.decodeGeometry(e,s).then(t).catch(a)}decodeGeometry(e,t){let i,r=JSON.stringify(t);if(or.has(e)){let t=or.get(e);if(t.key===r)return t.promise;if(0===e.byteLength)throw Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n=this.workerNextTaskID++,a=e.byteLength,s=this._getWorker(n,a).then(r=>(i=r,new Promise((r,a)=>{i._callbacks[n]={resolve:r,reject:a},i.postMessage({type:"decode",id:n,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return s.catch(()=>!0).then(()=>{i&&n&&this._releaseTask(i,n)}),or.set(e,{key:r,promise:s}),s}_createGeometry(e){let t=new r1;e.index&&t.setIndex(new rV(e.index.array,1));for(let i=0;i<e.attributes.length;i++){let r,{name:n,array:a,itemSize:s,stride:o,vertexColorSpace:l}=e.attributes[i];r=s===o?new rV(a,s):new nS(new n_(a,o),s,0),"color"===n&&(this._assignVertexColorSpace(r,l),r.normalized=a instanceof Float32Array==!1),t.setAttribute(n,r)}return t}_assignVertexColorSpace(e,t){if("srgb"!==t)return;let i=new rP;for(let t=0,r=e.count;t<r;t++)i.fromBufferAttribute(e,t),ih.colorSpaceToWorking(i,"srgb"),e.setXYZ(t,i.r,i.g,i.b)}_loadLibrary(e,t){let i=new sw(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((t,r)=>{i.load(e,t,void 0,r)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{let i=t[0];e||(this.decoderConfig.wasmBinary=t[1]);let r=on.toString(),n=["/* draco decoder */",i,"\n/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([n]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){let i=t.data;switch(i.type){case"decode":e._callbacks[i.id].resolve(i);break;case"error":e._callbacks[i.id].reject(i);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+i.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort(function(e,t){return e._taskLoad>t._taskLoad?-1:1});let i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}},ld=new o5,lp=Symbol("loader"),lA=Symbol("evictionPolicy"),lf=Symbol("GLTFInstance");class lg extends t1{static setDRACODecoderLocation(e){a=e,lu.setDecoderPath(e)}static getDRACODecoderLocation(){return a}static setKTX2TranscoderLocation(e){s=e,ld.setTranscoderPath(e)}static getKTX2TranscoderLocation(){return s}static setMeshoptDecoderLocation(e){o!==e&&(o=e,l=new Promise((t,i)=>{let r=document.createElement("script");document.body.appendChild(r),r.onload=t,r.onerror=i,r.async=!0,r.src=e}).then(()=>oi.ready).then(()=>oi))}static getMeshoptDecoderLocation(){return o}static initializeKTX2Loader(e){ld.detectSupport(e)}static get cache(){return lh}static clearCache(){lh.forEach((e,t)=>{this.delete(t)}),this[lA].reset()}static has(e){return lh.has(e)}static async delete(e){if(!this.has(e))return;let t=lh.get(e);lc.delete(e),lh.delete(e),(await t).dispose()}static hasFinishedLoading(e){return!!lc.get(e)}constructor(e){super(),this[e7]=new os().register(e=>new ll(e)),this[lf]=e,this[lp].setDRACOLoader(lu),this[lp].setKTX2Loader(ld)}get[(e6=lA,e7=lp,lA)](){return this.constructor[lA]}async preload(e,t,i=()=>{}){if(this[lp].setWithCredentials(t.withCredentials),this.dispatchEvent({type:"preload",element:t,src:e}),!lh.has(e)){null!=l&&this[lp].setMeshoptDecoder(await l);let t=((e,t,i=()=>{})=>{let r=e=>{let t=e.loaded/e.total;i(Math.max(0,Math.min(1,isFinite(t)?t:1)))};return new Promise((i,n)=>{t.load(e,i,r,n)})})(e,this[lp],e=>{i(.8*e)}),r=this[lf],n=t.then(e=>r.prepare(e)).then(e=>(i(.9),new r(e))).catch(e=>(console.error(e),new r));lh.set(e,n)}await lh.get(e),lc.set(e,!0),i&&i(1)}async load(e,t,i=()=>{}){await this.preload(e,t,i);let r=await lh.get(e),n=await r.clone();return this[lA].retain(e),n.dispose=()=>{this[lA].release(e)},n}}lg[e6]=new ls(lg);class lm extends rf{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new t7(.5,.5),this.addEventListener("removed",function(){this.traverse(function(e){e.element&&e.element instanceof e.element.ownerDocument.defaultView.Element&&null!==e.element.parentNode&&e.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}let lv=new it,lb=new i$,ly=new i$,lx=new it,l_=new it;class lE{constructor(e={}){let t,i,r,n;const a=this,s={objects:new WeakMap},o=void 0!==e.element?e.element:document.createElement("div");o.style.overflow="hidden",this.domElement=o,this.sortObjects=!0,this.getSize=function(){return{width:t,height:i}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),lb.copy(t.matrixWorldInverse),ly.multiplyMatrices(t.projectionMatrix,lb),function e(t,i,l){if(!1===t.visible)return void function e(t){t.isCSS2DObject&&(t.element.style.display="none");for(let i=0,r=t.children.length;i<r;i++)e(t.children[i])}(t);if(t.isCSS2DObject){var h,c;lv.setFromMatrixPosition(t.matrixWorld),lv.applyMatrix4(ly);let e=lv.z>=-1&&lv.z<=1&&!0===t.layers.test(l.layers),u=t.element;u.style.display=!0===e?"":"none",!0===e&&(t.onBeforeRender(a,i,l),u.style.transform="translate("+-100*t.center.x+"%,"+-100*t.center.y+"%)translate("+(lv.x*r+r)+"px,"+(-lv.y*n+n)+"px)",u.parentNode!==o&&o.appendChild(u),t.onAfterRender(a,i,l));let d={distanceToCameraSquared:(h=l,c=t,lx.setFromMatrixPosition(h.matrixWorld),l_.setFromMatrixPosition(c.matrixWorld),lx.distanceToSquared(l_))};s.objects.set(t,d)}for(let r=0,n=t.children.length;r<n;r++)e(t.children[r],i,l)}(e,e,t),this.sortObjects&&function(e){let t,i=(t=[],e.traverseVisible(function(e){e.isCSS2DObject&&t.push(e)}),t).sort(function(e,t){return e.renderOrder!==t.renderOrder?t.renderOrder-e.renderOrder:s.objects.get(e).distanceToCameraSquared-s.objects.get(t).distanceToCameraSquared}),r=i.length;for(let e=0,t=i.length;e<t;e++)i[e].element.style.zIndex=r-e}(e)},this.setSize=function(e,a){t=e,i=a,r=t/2,n=i/2,o.style.width=e+"px",o.style.height=a+"px"}}}function lS(e,t,i){let r=i,n=new it;return e.updateWorldMatrix(!0,!0),e.traverseVisible(e=>{let{geometry:i}=e;if(void 0!==i){let{position:a}=i.attributes;if(void 0!==a)for(let i=0,s=a.count;i<s;i++)e.isMesh?e.getVertexPosition(i,n):n.fromBufferAttribute(a,i),e.isSkinnedMesh||n.applyMatrix4(e.matrixWorld),r=t(r,n)}}),r}let lC={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class lM{constructor(){this.textureUtils=null,this.pluginCallbacks=[],this.register(function(e){return new lF(e)}),this.register(function(e){return new lN(e)}),this.register(function(e){return new lG(e)}),this.register(function(e){return new lH(e)}),this.register(function(e){return new lz(e)}),this.register(function(e){return new lV(e)}),this.register(function(e){return new lO(e)}),this.register(function(e){return new lk(e)}),this.register(function(e){return new lQ(e)}),this.register(function(e){return new lW(e)}),this.register(function(e){return new lq(e)}),this.register(function(e){return new lj(e)}),this.register(function(e){return new lX(e)}),this.register(function(e){return new lY(e)})}register(e){return -1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return -1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}setTextureUtils(e){return this.textureUtils=e,this}parse(e,t,i,r){let n=new lU,a=[];for(let e=0,t=this.pluginCallbacks.length;e<t;e++)a.push(this.pluginCallbacks[e](n));n.setPlugins(a),n.setTextureUtils(this.textureUtils),n.writeAsync(e,t,r).catch(i)}parseAsync(e,t){let i=this;return new Promise(function(r,n){i.parse(e,r,n,t)})}}let lw="KHR_mesh_quantization",lI={};lI[1003]=9728,lI[1004]=9984,lI[1005]=9986,lI[1006]=9729,lI[1007]=9985,lI[1008]=9987,lI[1001]=33071,lI[1e3]=10497,lI[1002]=33648;let lT={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},lB=new rP;function lR(e,t){return e.length===t.length&&e.every(function(e,i){return e===t[i]})}function lD(e){return 4*Math.ceil(e/4)}function lL(e,t=0){let i=lD(e.byteLength);if(i!==e.byteLength){let r=new Uint8Array(i);if(r.set(new Uint8Array(e)),0!==t)for(let n=e.byteLength;n<i;n++)r[n]=t;return r.buffer}return e}function lP(){return"u"<typeof document&&"u">typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}class lU{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter r182"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map},this.textureUtils=null}setPlugins(e){this.plugins=e}setTextureUtils(e){this.textureUtils=e}async writeAsync(e,t,i={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},i),this.options.animations.length>0&&(this.options.trs=!0),await this.processInputAsync(e),await Promise.all(this.pending);let r=this.buffers,n=this.json;i=this.options;let a=this.extensionsUsed,s=this.extensionsRequired,o=new Blob(r,{type:"application/octet-stream"}),l=Object.keys(a),h=Object.keys(s);if(l.length>0&&(n.extensionsUsed=l),h.length>0&&(n.extensionsRequired=h),n.buffers&&n.buffers.length>0&&(n.buffers[0].byteLength=o.size),!0===i.binary){let e=new FileReader;e.readAsArrayBuffer(o),e.onloadend=function(){var i;let r=lL(e.result),a=new DataView(new ArrayBuffer(8));a.setUint32(0,r.byteLength,!0),a.setUint32(4,5130562,!0);let s=lL((i=JSON.stringify(n),new TextEncoder().encode(i).buffer),32),o=new DataView(new ArrayBuffer(8));o.setUint32(0,s.byteLength,!0),o.setUint32(4,0x4e4f534a,!0);let l=new ArrayBuffer(12),h=new DataView(l);h.setUint32(0,0x46546c67,!0),h.setUint32(4,2,!0);let c=12+o.byteLength+s.byteLength+a.byteLength+r.byteLength;h.setUint32(8,c,!0);let u=new Blob([l,o,s,a,r],{type:"application/octet-stream"}),d=new FileReader;d.readAsArrayBuffer(u),d.onloadend=function(){t(d.result)}}}else if(n.buffers&&n.buffers.length>0){let e=new FileReader;e.readAsDataURL(o),e.onloadend=function(){let i=e.result;n.buffers[0].uri=i,t(n)}}else t(n)}serializeUserData(e,t){if(0===Object.keys(e.userData).length)return;let i=this.options,r=this.extensionsUsed;try{let n=JSON.parse(JSON.stringify(e.userData));if(i.includeCustomExtensions&&n.gltfExtensions){for(let e in void 0===t.extensions&&(t.extensions={}),n.gltfExtensions)t.extensions[e]=n.gltfExtensions[e],r[e]=!0;delete n.gltfExtensions}Object.keys(n).length>0&&(t.extras=n)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}getUID(e,t=!1){if(!1===this.uids.has(e)){let t=new Map;t.set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;let t=new it;for(let i=0,r=e.count;i<r;i++)if(Math.abs(t.fromBufferAttribute(e,i).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){let t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);let i=e.clone(),r=new it;for(let e=0,t=i.count;e<t;e++)r.fromBufferAttribute(i,e),0===r.x&&0===r.y&&0===r.z?r.setX(1):r.normalize(),i.setXYZ(e,r.x,r.y,r.z);return t.attributesNormalized.set(e,i),i}applyTextureTransform(e,t){let i=!1,r={};(0!==t.offset.x||0!==t.offset.y)&&(r.offset=t.offset.toArray(),i=!0),0!==t.rotation&&(r.rotation=t.rotation,i=!0),(1!==t.repeat.x||1!==t.repeat.y)&&(r.scale=t.repeat.toArray(),i=!0),i&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=r,this.extensionsUsed.KHR_texture_transform=!0)}async buildMetalRoughTextureAsync(e,t){if(e===t)return e;function i(e){return"srgb"===e.colorSpace?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}e instanceof af&&(e=await this.decompressTextureAsync(e)),t instanceof af&&(t=await this.decompressTextureAsync(t));let r=e?e.image:null,n=t?t.image:null,a=Math.max(r?r.width:0,n?n.width:0),s=Math.max(r?r.height:0,n?n.height:0),o=lP();o.width=a,o.height=s;let l=o.getContext("2d",{willReadFrequently:!0});l.fillStyle="#00ffff",l.fillRect(0,0,a,s);let h=l.getImageData(0,0,a,s);if(r){l.drawImage(r,0,0,a,s);let t=i(e),n=l.getImageData(0,0,a,s).data;for(let e=2;e<n.length;e+=4)h.data[e]=256*t(n[e]/256)}if(n){l.drawImage(n,0,0,a,s);let e=i(t),r=l.getImageData(0,0,a,s).data;for(let t=1;t<r.length;t+=4)h.data[t]=256*e(r[t]/256)}l.putImageData(h,0,0);let c=(e||t).clone();return c.source=new iA(o),c.colorSpace="",c.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),c}async decompressTextureAsync(e,t=1/0){if(null===this.textureUtils)throw Error("THREE.GLTFExporter: setTextureUtils() must be called to process compressed textures.");return await this.textureUtils.decompress(e,t)}processBuffer(e){let t=this.json,i=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),i.push(e),0}processBufferView(e,t,i,r,n){let a,s=this.json;switch(!s.bufferViews&&(s.bufferViews=[]),t){case 5120:case 5121:a=1;break;case 5122:case 5123:a=2;break;default:a=4}let o=e.itemSize*a;34962===n&&(o=4*Math.ceil(o/4));let l=lD(r*o),h=new DataView(new ArrayBuffer(l)),c=0;for(let n=i;n<i+r;n++){for(let i=0;i<e.itemSize;i++){let r;e.itemSize>4?r=e.array[n*e.itemSize+i]:(0===i?r=e.getX(n):1===i?r=e.getY(n):2===i?r=e.getZ(n):3===i&&(r=e.getW(n)),!0===e.normalized&&(r=t6(r,e.array))),5126===t?h.setFloat32(c,r,!0):5124===t?h.setInt32(c,r,!0):5125===t?h.setUint32(c,r,!0):5122===t?h.setInt16(c,r,!0):5123===t?h.setUint16(c,r,!0):5120===t?h.setInt8(c,r):5121===t&&h.setUint8(c,r),c+=a}c%o!=0&&(c+=o-c%o)}let u={buffer:this.processBuffer(h.buffer),byteOffset:this.byteOffset,byteLength:l};return void 0!==n&&(u.target=n),34962===n&&(u.byteStride=o),this.byteOffset+=l,s.bufferViews.push(u),{id:s.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){let t=this,i=t.json;return i.bufferViews||(i.bufferViews=[]),new Promise(function(r){let n=new FileReader;n.readAsArrayBuffer(e),n.onloadend=function(){let e=lL(n.result),a={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,r(i.bufferViews.push(a)-1)}})}processAccessor(e,t,i,r){let n,a,s=this.json;if(e.array.constructor===Float32Array)n=5126;else if(e.array.constructor===Int32Array)n=5124;else if(e.array.constructor===Uint32Array)n=5125;else if(e.array.constructor===Int16Array)n=5122;else if(e.array.constructor===Uint16Array)n=5123;else if(e.array.constructor===Int8Array)n=5120;else if(e.array.constructor===Uint8Array)n=5121;else throw Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(void 0===i&&(i=0),(void 0===r||r===1/0)&&(r=e.count),0===r)return null;let o=function(e,t,i){let r={min:Array(e.itemSize).fill(1/0),max:Array(e.itemSize).fill(-1/0)};for(let n=t;n<t+i;n++)for(let t=0;t<e.itemSize;t++){let i;e.itemSize>4?i=e.array[n*e.itemSize+t]:(0===t?i=e.getX(n):1===t?i=e.getY(n):2===t?i=e.getZ(n):3===t&&(i=e.getW(n)),!0===e.normalized&&(i=t6(i,e.array))),r.min[t]=Math.min(r.min[t],i),r.max[t]=Math.max(r.max[t],i)}return r}(e,i,r);void 0!==t&&(a=e===t.index?34963:34962);let l=this.processBufferView(e,n,i,r,a),h={bufferView:l.id,byteOffset:l.byteOffset,componentType:n,count:r,max:o.max,min:o.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(h.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(h)-1}processImage(e,t,i,r="image/png"){if(null!==e){let n=this,a=n.cache,s=n.json,o=n.options,l=n.pending;a.images.has(e)||a.images.set(e,{});let h=a.images.get(e),c=r+":flipY/"+i.toString();if(void 0!==h[c])return h[c];s.images||(s.images=[]);let u={mimeType:r},d=lP();d.width=Math.min(e.width,o.maxTextureSize),d.height=Math.min(e.height,o.maxTextureSize);let p=d.getContext("2d",{willReadFrequently:!0});if(!0===i&&(p.translate(0,d.height),p.scale(1,-1)),void 0!==e.data){1023!==t&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>o.maxTextureSize||e.height>o.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);let i=new Uint8ClampedArray(e.height*e.width*4);for(let t=0;t<i.length;t+=4)i[t+0]=e.data[t+0],i[t+1]=e.data[t+1],i[t+2]=e.data[t+2],i[t+3]=e.data[t+3];p.putImageData(new ImageData(i,e.width,e.height),0,0)}else if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof OffscreenCanvas&&e instanceof OffscreenCanvas)p.drawImage(e,0,0,d.width,d.height);else throw Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");!0===o.binary?l.push((function(e,t){if(!("u">typeof OffscreenCanvas&&e instanceof OffscreenCanvas))return new Promise(i=>e.toBlob(i,t));{let i;return"image/jpeg"===t?i=.92:"image/webp"===t&&(i=.8),e.convertToBlob({type:t,quality:i})}})(d,r).then(e=>n.processBufferViewImage(e)).then(e=>{u.bufferView=e})):u.uri=id.getDataURL(d,r);let A=s.images.push(u)-1;return h[c]=A,A}throw Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){let t=this.json;t.samplers||(t.samplers=[]);let i={magFilter:lI[e.magFilter],minFilter:lI[e.minFilter],wrapS:lI[e.wrapS],wrapT:lI[e.wrapT]};return t.samplers.push(i)-1}async processTextureAsync(e){let t=this.options,i=this.cache,r=this.json;if(i.textures.has(e))return i.textures.get(e);r.textures||(r.textures=[]),e instanceof af&&(e=await this.decompressTextureAsync(e,t.maxTextureSize));let n=e.userData.mimeType;"image/webp"===n&&(n="image/png");let a={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,n)};e.name&&(a.name=e.name),await this._invokeAllAsync(async function(t){t.writeTexture&&await t.writeTexture(e,a)});let s=r.textures.push(a)-1;return i.textures.set(e,s),s}async processMaterialAsync(e){let t=this.cache,i=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;i.materials||(i.materials=[]);let r={pbrMetallicRoughness:{}};!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");let n=e.color.toArray().concat([e.opacity]);if(lR(n,[1,1,1,1])||(r.pbrMetallicRoughness.baseColorFactor=n),e.isMeshStandardMaterial?(r.pbrMetallicRoughness.metallicFactor=e.metalness,r.pbrMetallicRoughness.roughnessFactor=e.roughness):(r.pbrMetallicRoughness.metallicFactor=0,r.pbrMetallicRoughness.roughnessFactor=1),e.metalnessMap||e.roughnessMap){let t=await this.buildMetalRoughTextureAsync(e.metalnessMap,e.roughnessMap),i={index:await this.processTextureAsync(t),texCoord:t.channel};this.applyTextureTransform(i,t),r.pbrMetallicRoughness.metallicRoughnessTexture=i}if(e.map){let t={index:await this.processTextureAsync(e.map),texCoord:e.map.channel};this.applyTextureTransform(t,e.map),r.pbrMetallicRoughness.baseColorTexture=t}if(e.emissive){let t=e.emissive;if(Math.max(t.r,t.g,t.b)>0&&(r.emissiveFactor=e.emissive.toArray()),e.emissiveMap){let t={index:await this.processTextureAsync(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(t,e.emissiveMap),r.emissiveTexture=t}}if(e.normalMap){let t={index:await this.processTextureAsync(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&1!==e.normalScale.x&&(t.scale=e.normalScale.x),this.applyTextureTransform(t,e.normalMap),r.normalTexture=t}if(e.aoMap){let t={index:await this.processTextureAsync(e.aoMap),texCoord:e.aoMap.channel};1!==e.aoMapIntensity&&(t.strength=e.aoMapIntensity),this.applyTextureTransform(t,e.aoMap),r.occlusionTexture=t}e.transparent?r.alphaMode="BLEND":e.alphaTest>0&&(r.alphaMode="MASK",r.alphaCutoff=e.alphaTest),2===e.side&&(r.doubleSided=!0),""!==e.name&&(r.name=e.name),this.serializeUserData(e,r),await this._invokeAllAsync(async function(t){t.writeMaterialAsync&&await t.writeMaterialAsync(e,r)});let a=i.materials.push(r)-1;return t.materials.set(e,a),a}async processMeshAsync(e){let t,i=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(let t=0,i=e.material.length;t<i;t++)n.push(e.material[t].uuid);else n.push(e.material.uuid);let a=n.join(":");if(i.meshes.has(a))return i.meshes.get(a);let s=e.geometry;t=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4;let o={},l={},h=[],c=[],u={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},d=s.getAttribute("normal");void 0===d||this.isNormalizedNormalAttribute(d)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),s.setAttribute("normal",this.createNormalizedNormalAttribute(d)));let p=null;for(let e in s.attributes){if("morph"===e.slice(0,5))continue;let t=s.attributes[e];if(e=u[e]||e.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(e)||(e="_"+e),i.attributes.has(this.getUID(t))){l[e]=i.attributes.get(this.getUID(t));continue}p=null;let r=t.array;"JOINTS_0"!==e||r instanceof Uint16Array||r instanceof Uint8Array?(r instanceof Uint32Array||r instanceof Int32Array)&&!e.startsWith("_")&&(console.warn(`GLTFExporter: Attribute "${e}" converted to type FLOAT.`),p=lM.Utils.toFloat32BufferAttribute(t)):(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),p=new rV(new Uint16Array(r),t.itemSize,t.normalized));let n=this.processAccessor(p||t,s);null!==n&&(e.startsWith("_")||this.detectMeshQuantization(e,t),l[e]=n,i.attributes.set(this.getUID(t),n))}if(void 0!==d&&s.setAttribute("normal",d),0===Object.keys(l).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){let t=[],r=[],n={};if(void 0!==e.morphTargetDictionary)for(let t in e.morphTargetDictionary)n[e.morphTargetDictionary[t]]=t;for(let a=0;a<e.morphTargetInfluences.length;++a){let o={},l=!1;for(let e in s.morphAttributes){if("position"!==e&&"normal"!==e){l||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),l=!0);continue}let t=s.morphAttributes[e][a],r=e.toUpperCase(),n=s.attributes[e];if(i.attributes.has(this.getUID(t,!0))){o[r]=i.attributes.get(this.getUID(t,!0));continue}let h=t.clone();if(!s.morphTargetsRelative)for(let e=0,i=t.count;e<i;e++)for(let i=0;i<t.itemSize;i++)0===i&&h.setX(e,t.getX(e)-n.getX(e)),1===i&&h.setY(e,t.getY(e)-n.getY(e)),2===i&&h.setZ(e,t.getZ(e)-n.getZ(e)),3===i&&h.setW(e,t.getW(e)-n.getW(e));o[r]=this.processAccessor(h,s),i.attributes.set(this.getUID(n,!0),o[r])}c.push(o),t.push(e.morphTargetInfluences[a]),void 0!==e.morphTargetDictionary&&r.push(n[a])}o.weights=t,r.length>0&&(o.extras={},o.extras.targetNames=r)}let A=Array.isArray(e.material);if(A&&0===s.groups.length)return null;let f=!1;if(A&&null===s.index){let e=[];for(let t=0,i=s.attributes.position.count;t<i;t++)e[t]=t;s.setIndex(e),f=!0}let g=A?e.material:[e.material],m=A?s.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let e=0,r=m.length;e<r;e++){let r={mode:t,attributes:l};if(this.serializeUserData(s,r),c.length>0&&(r.targets=c),null!==s.index){let t=this.getUID(s.index);(void 0!==m[e].start||void 0!==m[e].count)&&(t+=":"+m[e].start+":"+m[e].count),i.attributes.has(t)?r.indices=i.attributes.get(t):(r.indices=this.processAccessor(s.index,s,m[e].start,m[e].count),i.attributes.set(t,r.indices)),null===r.indices&&delete r.indices}let n=await this.processMaterialAsync(g[m[e].materialIndex]);null!==n&&(r.material=n),h.push(r)}!0===f&&s.setIndex(null),o.primitives=h,r.meshes||(r.meshes=[]),await this._invokeAllAsync(function(t){t.writeMesh&&t.writeMesh(e,o)});let v=r.meshes.push(o)-1;return i.meshes.set(a,v),v}detectMeshQuantization(e,t){let i;if(this.extensionsUsed[lw])return;switch(t.array.constructor){case Int8Array:i="byte";break;case Uint8Array:i="unsigned byte";break;case Int16Array:i="short";break;case Uint16Array:i="unsigned short";break;default:return}t.normalized&&(i+=" normalized");let r=e.split("_",1)[0];lC[r]&&lC[r].includes(i)&&(this.extensionsUsed[lw]=!0,this.extensionsRequired[lw]=!0)}processCamera(e){let t=this.json;t.cameras||(t.cameras=[]);let i=e.isOrthographicCamera,r={type:i?"orthographic":"perspective"};return i?r.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:r.perspective={aspectRatio:e.aspect,yfov:e.fov*t3,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(r.name=e.type),t.cameras.push(r)-1}processAnimation(e,t){let i=this.json,r=this.nodeMap;i.animations||(i.animations=[]);let n=(e=lM.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,a=[],s=[];for(let e=0;e<n.length;++e){let i,o=n[e],l=s3.parseTrackName(o.name),h=s3.findNode(t,l.nodeName),c=lT[l.propertyName];if("bones"===l.objectName&&(h=!0===h.isSkinnedMesh?h.skeleton.getBoneByName(l.objectIndex):void 0),!h||!c){console.warn('THREE.GLTFExporter: Could not export animation track "%s".',o.name);continue}let u=o.values.length/o.times.length;c===lT.morphTargetInfluences&&(u/=h.morphTargetInfluences.length),!0===o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(i="CUBICSPLINE",u/=3):i=2300===o.getInterpolation()?"STEP":"LINEAR",s.push({input:this.processAccessor(new rV(o.times,1)),output:this.processAccessor(new rV(o.values,u)),interpolation:i}),a.push({sampler:s.length-1,target:{node:r.get(h),path:c}})}let o={name:e.name||"clip_"+i.animations.length,samplers:s,channels:a};return this.serializeUserData(e,o),i.animations.push(o),i.animations.length-1}processSkin(e){let t=this.json,i=this.nodeMap,r=t.nodes[i.get(e)],n=e.skeleton;if(void 0===n)return null;let a=e.skeleton.bones[0];if(void 0===a)return null;let s=[],o=new Float32Array(16*n.bones.length),l=new i$;for(let t=0;t<n.bones.length;++t)s.push(i.get(n.bones[t])),l.copy(n.boneInverses[t]),l.multiply(e.bindMatrix).toArray(o,16*t);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new rV(o,16)),joints:s,skeleton:i.get(a)}),r.skin=t.skins.length-1}async processNodeAsync(e){let t=this.json,i=this.options,r=this.nodeMap;t.nodes||(t.nodes=[]);let n={};if(i.trs){let t=e.quaternion.toArray(),i=e.position.toArray(),r=e.scale.toArray();lR(t,[0,0,0,1])||(n.rotation=t),lR(i,[0,0,0])||(n.translation=i),lR(r,[1,1,1])||(n.scale=r)}else e.matrixAutoUpdate&&e.updateMatrix(),!1===lR(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(n.matrix=e.matrix.elements);if(""!==e.name&&(n.name=String(e.name)),this.serializeUserData(e,n),e.isMesh||e.isLine||e.isPoints){let t=await this.processMeshAsync(e);null!==t&&(n.mesh=t)}else e.isCamera&&(n.camera=this.processCamera(e));e.isSkinnedMesh&&this.skins.push(e);let a=t.nodes.push(n)-1;if(r.set(e,a),e.children.length>0){let t=[];for(let r=0,n=e.children.length;r<n;r++){let n=e.children[r];if(n.visible||!1===i.onlyVisible){let e=await this.processNodeAsync(n);null!==e&&t.push(e)}}t.length>0&&(n.children=t)}return await this._invokeAllAsync(function(t){t.writeNode&&t.writeNode(e,n)}),a}async processSceneAsync(e){let t=this.json,i=this.options;t.scenes||(t.scenes=[],t.scene=0);let r={};""!==e.name&&(r.name=e.name),t.scenes.push(r);let n=[];for(let t=0,r=e.children.length;t<r;t++){let r=e.children[t];if(r.visible||!1===i.onlyVisible){let e=await this.processNodeAsync(r);null!==e&&n.push(e)}}n.length>0&&(r.nodes=n),this.serializeUserData(e,r)}async processObjectsAsync(e){let t=new nx;t.name="AuxScene";for(let i=0;i<e.length;i++)t.children.push(e[i]);await this.processSceneAsync(t)}async processInputAsync(e){let t=this.options;e=e instanceof Array?e:[e],await this._invokeAllAsync(function(t){t.beforeParse&&t.beforeParse(e)});let i=[];for(let t=0;t<e.length;t++)e[t]instanceof nx?await this.processSceneAsync(e[t]):i.push(e[t]);i.length>0&&await this.processObjectsAsync(i);for(let e=0;e<this.skins.length;++e)this.processSkin(this.skins[e]);for(let i=0;i<t.animations.length;++i)this.processAnimation(t.animations[i],e[0]);await this._invokeAllAsync(function(t){t.afterParse&&t.afterParse(e)})}async _invokeAllAsync(e){for(let t=0,i=this.plugins.length;t<i;t++)await e(this.plugins[t])}}class lF{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight)return void console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);let i=this.writer,r=i.json,n=i.extensionsUsed,a={};e.name&&(a.name=e.name),a.color=e.color.toArray(),a.intensity=e.intensity,e.isDirectionalLight?a.type="directional":e.isPointLight?(a.type="point",e.distance>0&&(a.range=e.distance)):e.isSpotLight&&(a.type="spot",e.distance>0&&(a.range=e.distance),a.spot={},a.spot.innerConeAngle=(1-e.penumbra)*e.angle,a.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||0!==e.target.position.x||0!==e.target.position.y||-1!==e.target.position.z)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),n[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},n[this.name]=!0);let s=r.extensions[this.name].lights;s.push(a),t.extensions=t.extensions||{},t.extensions[this.name]={light:s.length-1}}}class lN{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}async writeMaterialAsync(e,t){if(!e.isMeshBasicMaterial)return;let i=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},i[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class lO{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.clearcoat)return;let i=this.writer,r=i.extensionsUsed,n={};if(n.clearcoatFactor=e.clearcoat,e.clearcoatMap){let t={index:await i.processTextureAsync(e.clearcoatMap),texCoord:e.clearcoatMap.channel};i.applyTextureTransform(t,e.clearcoatMap),n.clearcoatTexture=t}if(n.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){let t={index:await i.processTextureAsync(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};i.applyTextureTransform(t,e.clearcoatRoughnessMap),n.clearcoatRoughnessTexture=t}if(e.clearcoatNormalMap){let t={index:await i.processTextureAsync(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};1!==e.clearcoatNormalScale.x&&(t.scale=e.clearcoatNormalScale.x),i.applyTextureTransform(t,e.clearcoatNormalMap),n.clearcoatNormalTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0}}class lk{constructor(e){this.writer=e,this.name="KHR_materials_dispersion"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.dispersion)return;let i=this.writer.extensionsUsed,r={};r.dispersion=e.dispersion,t.extensions=t.extensions||{},t.extensions[this.name]=r,i[this.name]=!0}}class lQ{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.iridescence)return;let i=this.writer,r=i.extensionsUsed,n={};if(n.iridescenceFactor=e.iridescence,e.iridescenceMap){let t={index:await i.processTextureAsync(e.iridescenceMap),texCoord:e.iridescenceMap.channel};i.applyTextureTransform(t,e.iridescenceMap),n.iridescenceTexture=t}if(n.iridescenceIor=e.iridescenceIOR,n.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],n.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){let t={index:await i.processTextureAsync(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};i.applyTextureTransform(t,e.iridescenceThicknessMap),n.iridescenceThicknessTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0}}class lG{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;let i=this.writer,r=i.extensionsUsed,n={};if(n.transmissionFactor=e.transmission,e.transmissionMap){let t={index:await i.processTextureAsync(e.transmissionMap),texCoord:e.transmissionMap.channel};i.applyTextureTransform(t,e.transmissionMap),n.transmissionTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0}}class lH{constructor(e){this.writer=e,this.name="KHR_materials_volume"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;let i=this.writer,r=i.extensionsUsed,n={};if(n.thicknessFactor=e.thickness,e.thicknessMap){let t={index:await i.processTextureAsync(e.thicknessMap),texCoord:e.thicknessMap.channel};i.applyTextureTransform(t,e.thicknessMap),n.thicknessTexture=t}e.attenuationDistance!==1/0&&(n.attenuationDistance=e.attenuationDistance),n.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0}}class lz{constructor(e){this.writer=e,this.name="KHR_materials_ior"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||1.5===e.ior)return;let i=this.writer.extensionsUsed,r={};r.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=r,i[this.name]=!0}}class lV{constructor(e){this.writer=e,this.name="KHR_materials_specular"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||1===e.specularIntensity&&e.specularColor.equals(lB)&&!e.specularIntensityMap&&!e.specularColorMap)return;let i=this.writer,r=i.extensionsUsed,n={};if(e.specularIntensityMap){let t={index:await i.processTextureAsync(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};i.applyTextureTransform(t,e.specularIntensityMap),n.specularTexture=t}if(e.specularColorMap){let t={index:await i.processTextureAsync(e.specularColorMap),texCoord:e.specularColorMap.channel};i.applyTextureTransform(t,e.specularColorMap),n.specularColorTexture=t}n.specularFactor=e.specularIntensity,n.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0}}class lW{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0==e.sheen)return;let i=this.writer,r=i.extensionsUsed,n={};if(e.sheenRoughnessMap){let t={index:await i.processTextureAsync(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};i.applyTextureTransform(t,e.sheenRoughnessMap),n.sheenRoughnessTexture=t}if(e.sheenColorMap){let t={index:await i.processTextureAsync(e.sheenColorMap),texCoord:e.sheenColorMap.channel};i.applyTextureTransform(t,e.sheenColorMap),n.sheenColorTexture=t}n.sheenRoughnessFactor=e.sheenRoughness,n.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0}}class lq{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0==e.anisotropy)return;let i=this.writer,r=i.extensionsUsed,n={};if(e.anisotropyMap){let t={index:await i.processTextureAsync(e.anisotropyMap)};i.applyTextureTransform(t,e.anisotropyMap),n.anisotropyTexture=t}n.anisotropyStrength=e.anisotropy,n.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0}}class lj{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}async writeMaterialAsync(e,t){if(!e.isMeshStandardMaterial||1===e.emissiveIntensity)return;let i=this.writer.extensionsUsed,r={};r.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=r,i[this.name]=!0}}class lX{constructor(e){this.writer=e,this.name="EXT_materials_bump"}async writeMaterialAsync(e,t){if(!e.isMeshStandardMaterial||1===e.bumpScale&&!e.bumpMap)return;let i=this.writer,r=i.extensionsUsed,n={};if(e.bumpMap){let t={index:await i.processTextureAsync(e.bumpMap),texCoord:e.bumpMap.channel};i.applyTextureTransform(t,e.bumpMap),n.bumpTexture=t}n.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0}}class lY{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;let i=this.writer,r=new Float32Array(3*e.count),n=new Float32Array(4*e.count),a=new Float32Array(3*e.count),s=new i$,o=new it,l=new ie,h=new it;for(let t=0;t<e.count;t++)e.getMatrixAt(t,s),s.decompose(o,l,h),o.toArray(r,3*t),l.toArray(n,4*t),h.toArray(a,3*t);let c={TRANSLATION:i.processAccessor(new rV(r,3)),ROTATION:i.processAccessor(new rV(n,4)),SCALE:i.processAccessor(new rV(a,3))};e.instanceColor&&(c._COLOR_0=i.processAccessor(e.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:c},i.extensionsUsed[this.name]=!0,i.extensionsRequired[this.name]=!0}}lM.Utils={insertKeyframe:function(e,t){let i,r=e.getValueSize(),n=new e.TimeBufferType(e.times.length+1),a=new e.ValueBufferType(e.values.length+r),s=e.createInterpolant(new e.ValueBufferType(r));if(0===e.times.length){n[0]=t;for(let e=0;e<r;e++)a[e]=0;i=0}else if(t<e.times[0]){if(.001>Math.abs(e.times[0]-t))return 0;n[0]=t,n.set(e.times,1),a.set(s.evaluate(t),0),a.set(e.values,r),i=0}else if(t>e.times[e.times.length-1]){if(.001>Math.abs(e.times[e.times.length-1]-t))return e.times.length-1;n[n.length-1]=t,n.set(e.times,0),a.set(e.values,0),a.set(s.evaluate(t),e.values.length),i=n.length-1}else for(let o=0;o<e.times.length;o++){if(.001>Math.abs(e.times[o]-t))return o;if(e.times[o]<t&&e.times[o+1]>t){n.set(e.times.slice(0,o+1),0),n[o+1]=t,n.set(e.times.slice(o+1),o+2),a.set(e.values.slice(0,(o+1)*r),0),a.set(s.evaluate(t),(o+1)*r),a.set(e.values.slice((o+1)*r),(o+2)*r),i=o+1;break}}return e.times=n,e.values=a,i},mergeMorphTargetTracks:function(e,t){let i=[],r={},n=e.tracks;for(let e=0;e<n.length;++e){let a,s=n[e],o=s3.parseTrackName(s.name),l=s3.findNode(t,o.nodeName);if("morphTargetInfluences"!==o.propertyName||void 0===o.propertyIndex){i.push(s);continue}if(s.createInterpolant!==s.InterpolantFactoryMethodDiscrete&&s.createInterpolant!==s.InterpolantFactoryMethodLinear){if(s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(s=s.clone()).setInterpolation(2301)}let h=l.morphTargetInfluences.length,c=l.morphTargetDictionary[o.propertyIndex];if(void 0===c)throw Error("THREE.GLTFExporter: Morph target name not found: "+o.propertyIndex);if(void 0===r[l.uuid]){let e=new(a=s.clone()).ValueBufferType(h*a.times.length);for(let t=0;t<a.times.length;t++)e[t*h+c]=a.values[t];a.name=(o.nodeName||"")+".morphTargetInfluences",a.values=e,r[l.uuid]=a,i.push(a);continue}let u=s.createInterpolant(new s.ValueBufferType(1));a=r[l.uuid];for(let e=0;e<a.times.length;e++)a.values[e*h+c]=u.evaluate(a.times[e]);for(let e=0;e<s.times.length;e++){let t=this.insertKeyframe(a,s.times[e]);a.values[t*h+c]=s.values[e]}}return e.tracks=i,e},toFloat32BufferAttribute:function(e){let t=new rV(new Float32Array(e.count*e.itemSize),e.itemSize,!1);if(!e.normalized&&!e.isInterleavedBufferAttribute)return t.array.set(e.array),t;for(let i=0,r=e.count;i<r;i++)for(let r=0;r<e.itemSize;r++)t.setComponent(i,r,e.getComponent(i,r));return t}};let lK=e=>void 0!==e.material&&e.userData&&e.userData.variantMaterials&&!!Array.from(e.userData.variantMaterials.values()).filter(e=>lJ(e.material)),lJ=e=>e&&e.isMaterial&&!Array.isArray(e);class l${constructor(e){this.writer=e,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(e){let t=new Set,i=e=>{if(!lK(e))return;let i=e.userData.variantMaterials;for(let[r,n]of e.userData.variantData){let e=i.get(n.index);e&&lJ(e.material)&&t.add(r)}};if(Array.isArray(e))for(let t of e)t.traverse(i);else e.traverse(i);t.forEach(e=>this.variantNames.push(e))}async writeMesh(e,t){if(!lK(e))return;let i=e.userData,r=i.variantMaterials,n=i.variantData,a=new Map,s=new Map;for(let[e,t]of Array.from(n.values()).sort((e,t)=>e.index-t.index).entries())s.set(t.index,e);for(let e of n.values()){let t=r.get(e.index);if(!t||!lJ(t.material))continue;let i=await this.writer.processMaterialAsync(t.material);a.has(i)||a.set(i,{material:i,variants:[]}),a.get(i).variants.push(s.get(e.index))}let o=Array.from(a.values()).map(e=>e.variants.sort((e,t)=>e-t)&&e).sort((e,t)=>e.material-t.material);if(0===o.length)return;let l=lJ(i.originalMaterial)?await this.writer.processMaterialAsync(i.originalMaterial):-1;for(let e of t.primitives)l>=0&&(e.material=l),e.extensions=e.extensions||{},e.extensions[this.name]={mappings:o}}afterParse(){if(0===this.variantNames.length)return;let e=this.writer.json;e.extensions=e.extensions||{};let t=this.variantNames.map(e=>({name:e}));e.extensions[this.name]={variants:t},this.writer.extensionsUsed[this.name]=!0}}function lZ(){let e=null,t=!1,i=null,r=null;function n(t,a){i(t,a),r=e.requestAnimationFrame(n)}return{start:function(){!0===t||null!==i&&(r=e.requestAnimationFrame(n),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){i=e},setContext:function(t){e=t}}}function l0(e){let t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(i){i.isInterleavedBufferAttribute&&(i=i.data);let r=t.get(i);r&&(e.deleteBuffer(r.buffer),t.delete(i))},update:function(i,r){if(i.isInterleavedBufferAttribute&&(i=i.data),i.isGLBufferAttribute){let e=t.get(i);(!e||e.version<i.version)&&t.set(i,{buffer:i.buffer,type:i.type,bytesPerElement:i.elementSize,version:i.version});return}let n=t.get(i);if(void 0===n)t.set(i,function(t,i){let r,n=t.array,a=t.usage,s=n.byteLength,o=e.createBuffer();if(e.bindBuffer(i,o),e.bufferData(i,n,a),t.onUploadCallback(),n instanceof Float32Array)r=e.FLOAT;else if("u">typeof Float16Array&&n instanceof Float16Array)r=e.HALF_FLOAT;else if(n instanceof Uint16Array)r=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(n instanceof Int16Array)r=e.SHORT;else if(n instanceof Uint32Array)r=e.UNSIGNED_INT;else if(n instanceof Int32Array)r=e.INT;else if(n instanceof Int8Array)r=e.BYTE;else if(n instanceof Uint8Array)r=e.UNSIGNED_BYTE;else if(n instanceof Uint8ClampedArray)r=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+n);return{buffer:o,type:r,bytesPerElement:n.BYTES_PER_ELEMENT,version:t.version,size:s}}(i,r));else if(n.version<i.version){if(n.size!==i.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(t,i,r){let n=i.array,a=i.updateRanges;if(e.bindBuffer(r,t),0===a.length)e.bufferSubData(r,0,n);else{a.sort((e,t)=>e.start-t.start);let t=0;for(let e=1;e<a.length;e++){let i=a[t],r=a[e];r.start<=i.start+i.count+1?i.count=Math.max(i.count,r.start+r.count-i.start):a[++t]=r}a.length=t+1;for(let t=0,i=a.length;t<i;t++){let i=a[t];e.bufferSubData(r,i.start*n.BYTES_PER_ELEMENT,n,i.start,i.count)}i.clearUpdateRanges()}i.onUploadCallback()}(n.buffer,i,r),n.version=i.version}}}}let l1={alphahash_fragment:"#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n const float ALPHA_HASH_SCALE = 0.05;\n float hash2D( vec2 value ) {\n return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n }\n float hash3D( vec3 value ) {\n return hash2D( vec2( hash2D( value.xy ), value.z ) );\n }\n float getAlphaHashThreshold( vec3 position ) {\n float maxDeriv = max(\n length( dFdx( position.xyz ) ),\n length( dFdy( position.xyz ) )\n );\n float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n vec2 pixScales = vec2(\n exp2( floor( log2( pixScale ) ) ),\n exp2( ceil( log2( pixScale ) ) )\n );\n vec2 alpha = vec2(\n hash3D( floor( pixScales.x * position.xyz ) ),\n hash3D( floor( pixScales.y * position.xyz ) )\n );\n float lerpFactor = fract( log2( pixScale ) );\n float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n float a = min( lerpFactor, 1.0 - lerpFactor );\n vec3 cases = vec3(\n x * x / ( 2.0 * a * ( 1.0 - a ) ),\n ( x - 0.5 * a ) / ( 1.0 - a ),\n 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n );\n float threshold = ( x < ( 1.0 - a ) )\n ? ( ( x < a ) ? cases.x : cases.y )\n : cases.z;\n return clamp( threshold , 1.0e-6, 1.0 );\n }\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n #ifdef ALPHA_TO_COVERAGE\n diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n if ( diffuseColor.a < alphaTest ) discard;\n #endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n #if ! defined( GL_ANGLE_multi_draw )\n #define gl_DrawID _gl_DrawID\n uniform int _gl_DrawID;\n #endif\n uniform highp sampler2D batchingTexture;\n uniform highp usampler2D batchingIdTexture;\n mat4 getBatchingMatrix( const in float i ) {\n int size = textureSize( batchingTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n float getIndirectIndex( const in int i ) {\n int size = textureSize( batchingIdTexture, 0 ).x;\n int x = i % size;\n int y = i / size;\n return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n }\n#endif\n#ifdef USE_BATCHING_COLOR\n uniform sampler2D batchingColorTexture;\n vec3 getBatchingColor( const in float i ) {\n int size = textureSize( batchingColorTexture, 0 ).x;\n int j = int( i );\n int x = j % size;\n int y = j / size;\n return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n }\n#endif",batching_vertex:"#ifdef USE_BATCHING\n mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vBumpMapUv );\n vec2 dSTdy = dFdy( vBumpMapUv );\n float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n vColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = bm * transformedTangent;\n #endif\n#endif\n#ifdef USE_INSTANCING\n mat3 im = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n transformedNormal = im * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = im * transformedTangent;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n emissiveColor = sRGBTransferEOTF( emissiveColor );\n #endif\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = vec3( 0.04 );\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n vec3 diffuseContribution;\n vec3 specularColor;\n vec3 specularColorBlended;\n float roughness;\n float metalness;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n vec3 iridescenceFresnelDielectric;\n vec3 iridescenceFresnelMetallic;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return v;\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColorBlended;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float rInv = 1.0 / ( roughness + 0.1 );\n float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n float DG = exp( a * dotNV + b );\n return saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n float Ess_V = dfgV.x + dfgV.y;\n float Ess_L = dfgL.x + dfgL.y;\n float Ems_V = 1.0 - Ess_V;\n float Ems_L = 1.0 - Ess_L;\n vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n float compensationFactor = Ems_V * Ems_L;\n vec3 multiScatter = Fms * compensationFactor;\n return singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n \n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n irradiance *= sheenEnergyComp;\n \n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n diffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectDiffuse += diffuse;\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n #endif\n vec3 singleScatteringDielectric = vec3( 0.0 );\n vec3 multiScatteringDielectric = vec3( 0.0 );\n vec3 singleScatteringMetallic = vec3( 0.0 );\n vec3 multiScatteringMetallic = vec3( 0.0 );\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #endif\n vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n vec3 indirectSpecular = radiance * singleScattering;\n indirectSpecular += multiScattering * cosineWeightedIrradiance;\n vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n indirectSpecular *= sheenEnergyComp;\n indirectDiffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectSpecular += indirectSpecular;\n reflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n }\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n if( v <= 0.0 )\n return vec4( 0., 0., 0., 0. );\n if( v >= 1.0 )\n return vec4( 1., 1., 1., 1. );\n float vuf;\n float af = modf( v * PackFactors.a, vuf );\n float bf = modf( vuf * ShiftRight8, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n if( v <= 0.0 )\n return vec3( 0., 0., 0. );\n if( v >= 1.0 )\n return vec3( 1., 1., 1. );\n float vuf;\n float bf = modf( v * PackFactors.b, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n if( v <= 0.0 )\n return vec2( 0., 0. );\n if( v >= 1.0 )\n return vec2( 1., 1. );\n float vuf;\n float gf = modf( v * 256., vuf );\n return vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n return dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #else\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #else\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #elif defined( SHADOWMAP_TYPE_BASIC )\n uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float interleavedGradientNoise( vec2 position ) {\n return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n }\n vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n const float goldenAngle = 2.399963229728653;\n float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n float theta = float( sampleIndex ) * goldenAngle + phi;\n return vec2( cos( theta ), sin( theta ) ) * r;\n }\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float radius = shadowRadius * texelSize.x;\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\n shadow = (\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_VSM )\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n float mean = distribution.x;\n float variance = distribution.y * distribution.y;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float hard_shadow = step( mean, shadowCoord.z );\n #else\n float hard_shadow = step( shadowCoord.z, mean );\n #endif\n if ( hard_shadow == 1.0 ) {\n shadow = 1.0;\n } else {\n variance = max( variance, 0.0000001 );\n float d = shadowCoord.z - mean;\n float p_max = variance / ( variance + d * d );\n p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n shadow = max( hard_shadow, p_max );\n }\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #else\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n float depth = texture2D( shadowMap, shadowCoord.xy ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, shadowCoord.z );\n #else\n shadow = step( shadowCoord.z, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n float texelSize = shadowRadius / shadowMapSize.x;\n vec3 absDir = abs( bd3D );\n vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n tangent = normalize( cross( bd3D, tangent ) );\n vec3 bitangent = cross( bd3D, tangent );\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;\n shadow = (\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_BASIC )\n float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n float depth = textureCube( shadowMap, bd3D ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, dp );\n #else\n shadow = step( dp, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #endif\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n vec3( 1.6605, - 0.1246, - 0.0182 ),\n vec3( - 0.5876, 1.1329, - 0.1006 ),\n vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n vec3( 0.6274, 0.0691, 0.0164 ),\n vec3( 0.3293, 0.9195, 0.0880 ),\n vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n vec3 x2 = x * x;\n vec3 x4 = x2 * x2;\n return + 15.5 * x4 * x2\n - 40.14 * x4 * x\n + 31.96 * x4\n - 6.868 * x2 * x\n + 0.4298 * x2\n + 0.1191 * x\n - 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n const mat3 AgXInsetMatrix = mat3(\n vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n );\n const mat3 AgXOutsetMatrix = mat3(\n vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n );\n const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;\n color *= toneMappingExposure;\n color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n color = AgXInsetMatrix * color;\n color = max( color, 1e-10 ); color = log2( color );\n color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n color = clamp( color, 0.0, 1.0 );\n color = agxDefaultContrastApprox( color );\n color = AgXOutsetMatrix * color;\n color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n color = clamp( color, 0.0, 1.0 );\n return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n const float StartCompression = 0.8 - 0.04;\n const float Desaturation = 0.15;\n color *= toneMappingExposure;\n float x = min( color.r, min( color.g, color.b ) );\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max( color.r, max( color.g, color.b ) );\n if ( peak < StartCompression ) return color;\n float d = 1. - StartCompression;\n float newPeak = 1. - d * d / ( peak + d - StartCompression );\n color *= newPeak / peak;\n float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec4 transmittedLight;\n vec3 transmittance;\n #ifdef USE_DISPERSION\n float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n for ( int i = 0; i < 3; i ++ ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n transmittedLight[ i ] = transmissionSample[ i ];\n transmittedLight.a += transmissionSample.a;\n transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n }\n transmittedLight.a /= 3.0;\n #else\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n #endif\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_BATCHING\n worldPosition = batchingMatrix * worldPosition;\n #endif\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <logdepthbuf_fragment>\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n #else\n float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n #endif\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #elif DEPTH_PACKING == 3202\n gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n #elif DEPTH_PACKING == 3203\n gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n #endif\n}",distance_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}",distance_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vLineDistance = scale * lineDistance;\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n \n outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n #include <logdepthbuf_fragment>\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix[ 3 ];\n vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}"},l2={common:{diffuse:{value:new rP(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new ia},alphaMap:{value:null},alphaMapTransform:{value:new ia},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ia}},envmap:{envMap:{value:null},envMapRotation:{value:new ia},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ia}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ia}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ia},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ia},normalScale:{value:new t7(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ia},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ia}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ia}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ia}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new rP(0xffffff)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new rP(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ia},alphaTest:{value:0},uvTransform:{value:new ia}},sprite:{diffuse:{value:new rP(0xffffff)},opacity:{value:1},center:{value:new t7(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ia},alphaMap:{value:null},alphaMapTransform:{value:new ia},alphaTest:{value:0}}},l3={basic:{uniforms:no([l2.common,l2.specularmap,l2.envmap,l2.aomap,l2.lightmap,l2.fog]),vertexShader:l1.meshbasic_vert,fragmentShader:l1.meshbasic_frag},lambert:{uniforms:no([l2.common,l2.specularmap,l2.envmap,l2.aomap,l2.lightmap,l2.emissivemap,l2.bumpmap,l2.normalmap,l2.displacementmap,l2.fog,l2.lights,{emissive:{value:new rP(0)}}]),vertexShader:l1.meshlambert_vert,fragmentShader:l1.meshlambert_frag},phong:{uniforms:no([l2.common,l2.specularmap,l2.envmap,l2.aomap,l2.lightmap,l2.emissivemap,l2.bumpmap,l2.normalmap,l2.displacementmap,l2.fog,l2.lights,{emissive:{value:new rP(0)},specular:{value:new rP(1118481)},shininess:{value:30}}]),vertexShader:l1.meshphong_vert,fragmentShader:l1.meshphong_frag},standard:{uniforms:no([l2.common,l2.envmap,l2.aomap,l2.lightmap,l2.emissivemap,l2.bumpmap,l2.normalmap,l2.displacementmap,l2.roughnessmap,l2.metalnessmap,l2.fog,l2.lights,{emissive:{value:new rP(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:l1.meshphysical_vert,fragmentShader:l1.meshphysical_frag},toon:{uniforms:no([l2.common,l2.aomap,l2.lightmap,l2.emissivemap,l2.bumpmap,l2.normalmap,l2.displacementmap,l2.gradientmap,l2.fog,l2.lights,{emissive:{value:new rP(0)}}]),vertexShader:l1.meshtoon_vert,fragmentShader:l1.meshtoon_frag},matcap:{uniforms:no([l2.common,l2.bumpmap,l2.normalmap,l2.displacementmap,l2.fog,{matcap:{value:null}}]),vertexShader:l1.meshmatcap_vert,fragmentShader:l1.meshmatcap_frag},points:{uniforms:no([l2.points,l2.fog]),vertexShader:l1.points_vert,fragmentShader:l1.points_frag},dashed:{uniforms:no([l2.common,l2.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:l1.linedashed_vert,fragmentShader:l1.linedashed_frag},depth:{uniforms:no([l2.common,l2.displacementmap]),vertexShader:l1.depth_vert,fragmentShader:l1.depth_frag},normal:{uniforms:no([l2.common,l2.bumpmap,l2.normalmap,l2.displacementmap,{opacity:{value:1}}]),vertexShader:l1.meshnormal_vert,fragmentShader:l1.meshnormal_frag},sprite:{uniforms:no([l2.sprite,l2.fog]),vertexShader:l1.sprite_vert,fragmentShader:l1.sprite_frag},background:{uniforms:{uvTransform:{value:new ia},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:l1.background_vert,fragmentShader:l1.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new ia}},vertexShader:l1.backgroundCube_vert,fragmentShader:l1.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:l1.cube_vert,fragmentShader:l1.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:l1.equirect_vert,fragmentShader:l1.equirect_frag},distance:{uniforms:no([l2.common,l2.displacementmap,{referencePosition:{value:new it},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:l1.distance_vert,fragmentShader:l1.distance_frag},shadow:{uniforms:no([l2.lights,l2.fog,{color:{value:new rP(0)},opacity:{value:1}}]),vertexShader:l1.shadow_vert,fragmentShader:l1.shadow_frag}};l3.physical={uniforms:no([l3.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ia},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ia},clearcoatNormalScale:{value:new t7(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ia},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ia},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ia},sheen:{value:0},sheenColor:{value:new rP(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ia},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ia},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ia},transmissionSamplerSize:{value:new t7},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ia},attenuationDistance:{value:0},attenuationColor:{value:new rP(0)},specularColor:{value:new rP(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ia},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ia},anisotropyVector:{value:new t7},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ia}}]),vertexShader:l1.meshphysical_vert,fragmentShader:l1.meshphysical_frag};let l4={r:0,b:0,g:0},l5=new i6,l8=new i$;function l9(e,t,i,r,n,a,s){let o,l,h=new rP(0),c=+(!0!==a),u=null,d=0,p=null;function A(e){let r=!0===e.isScene?e.background:null;return r&&r.isTexture&&(r=(e.backgroundBlurriness>0?i:t).get(r)),r}function f(t,i){t.getRGB(l4,nl(e)),r.buffers.color.setClear(l4.r,l4.g,l4.b,i,s)}return{getClearColor:function(){return h},setClearColor:function(e,t=1){h.set(e),f(h,c=t)},getClearAlpha:function(){return c},setClearAlpha:function(e){f(h,c=e)},render:function(t){let i=!1,n=A(t);null===n?f(h,c):n&&n.isColor&&(f(n,1),i=!0);let a=e.xr.getEnvironmentBlendMode();"additive"===a?r.buffers.color.setClear(0,0,0,1,s):"alpha-blend"===a&&r.buffers.color.setClear(0,0,0,0,s),(e.autoClear||i)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,i){let r=A(i);r&&(r.isCubeTexture||306===r.mapping)?(void 0===l&&((l=new nr(new na(1,1,1),new nh({name:"BackgroundCubeMaterial",uniforms:ns(l3.backgroundCube.uniforms),vertexShader:l3.backgroundCube.vertexShader,fragmentShader:l3.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l5.copy(i.backgroundRotation),l5.x*=-1,l5.y*=-1,l5.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(l5.y*=-1,l5.z*=-1),l.material.uniforms.envMap.value=r,l.material.uniforms.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=i.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(l8.makeRotationFromEuler(l5)),l.material.toneMapped="srgb"!==ih.getTransfer(r.colorSpace),(u!==r||d!==r.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,u=r,d=r.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null)):r&&r.isTexture&&(void 0===o&&((o=new nr(new a9(2,2),new nh({name:"BackgroundMaterial",uniforms:ns(l3.background.uniforms),vertexShader:l3.background.vertexShader,fragmentShader:l3.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(o)),o.material.uniforms.t2D.value=r,o.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,o.material.toneMapped="srgb"!==ih.getTransfer(r.colorSpace),!0===r.matrixAutoUpdate&&r.updateMatrix(),o.material.uniforms.uvTransform.value.copy(r.matrix),(u!==r||d!==r.version||p!==e.toneMapping)&&(o.material.needsUpdate=!0,u=r,d=r.version,p=e.toneMapping),o.layers.enableAll(),t.unshift(o,o.geometry,o.material,0,0,null))},dispose:function(){void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0),void 0!==o&&(o.geometry.dispose(),o.material.dispose(),o=void 0)}}}function l6(e,t){let i=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},n=h(null),a=n,s=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function h(e){let t=[],r=[],n=[];for(let e=0;e<i;e++)t[e]=0,r[e]=0,n[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:r,attributeDivisors:n,object:e,attributes:{},index:null}}function c(){let e=a.newAttributes;for(let t=0,i=e.length;t<i;t++)e[t]=0}function u(e){d(e,0)}function d(t,i){let r=a.newAttributes,n=a.enabledAttributes,s=a.attributeDivisors;r[t]=1,0===n[t]&&(e.enableVertexAttribArray(t),n[t]=1),s[t]!==i&&(e.vertexAttribDivisor(t,i),s[t]=i)}function p(){let t=a.newAttributes,i=a.enabledAttributes;for(let r=0,n=i.length;r<n;r++)i[r]!==t[r]&&(e.disableVertexAttribArray(r),i[r]=0)}function A(t,i,r,n,a,s,o){!0===o?e.vertexAttribIPointer(t,i,r,a,s):e.vertexAttribPointer(t,i,r,n,a,s)}function f(){g(),s=!0,a!==n&&o((a=n).object)}function g(){n.geometry=null,n.program=null,n.wireframe=!1}return{setup:function(i,n,l,f,g){var m,v;let b,y,x,_,E=!1,S=(m=f,v=l,b=!0===n.wireframe,void 0===(y=r[m.id])&&(y={},r[m.id]=y),void 0===(x=y[v.id])&&(x={},y[v.id]=x),void 0===(_=x[b])&&(_=h(e.createVertexArray()),x[b]=_),_);a!==S&&o((a=S).object),(E=function(e,t,i,r){let n=a.attributes,s=t.attributes,o=0,l=i.getAttributes();for(let t in l)if(l[t].location>=0){let i=n[t],r=s[t];if(void 0===r&&("instanceMatrix"===t&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(r=e.instanceColor)),void 0===i||i.attribute!==r||r&&i.data!==r.data)return!0;o++}return a.attributesNum!==o||a.index!==r}(i,f,l,g))&&function(e,t,i,r){let n={},s=t.attributes,o=0,l=i.getAttributes();for(let t in l)if(l[t].location>=0){let i=s[t];void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor));let r={};r.attribute=i,i&&i.data&&(r.data=i.data),n[t]=r,o++}a.attributes=n,a.attributesNum=o,a.index=r}(i,f,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(E||s)&&(s=!1,function(i,r,n,a){c();let s=a.attributes,o=n.getAttributes(),l=r.defaultAttributeValues;for(let r in o){let n=o[r];if(n.location>=0){let o=s[r];if(void 0===o&&("instanceMatrix"===r&&i.instanceMatrix&&(o=i.instanceMatrix),"instanceColor"===r&&i.instanceColor&&(o=i.instanceColor)),void 0!==o){let r=o.normalized,s=o.itemSize,l=t.get(o);if(void 0===l)continue;let h=l.buffer,c=l.type,p=l.bytesPerElement,f=c===e.INT||c===e.UNSIGNED_INT||1013===o.gpuType;if(o.isInterleavedBufferAttribute){let t=o.data,l=t.stride,g=o.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<n.locationSize;e++)d(n.location+e,t.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<n.locationSize;e++)u(n.location+e);e.bindBuffer(e.ARRAY_BUFFER,h);for(let e=0;e<n.locationSize;e++)A(n.location+e,s/n.locationSize,c,r,l*p,(g+s/n.locationSize*e)*p,f)}else{if(o.isInstancedBufferAttribute){for(let e=0;e<n.locationSize;e++)d(n.location+e,o.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let e=0;e<n.locationSize;e++)u(n.location+e);e.bindBuffer(e.ARRAY_BUFFER,h);for(let e=0;e<n.locationSize;e++)A(n.location+e,s/n.locationSize,c,r,s*p,s/n.locationSize*e*p,f)}}else if(void 0!==l){let t=l[r];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(n.location,t);break;case 3:e.vertexAttrib3fv(n.location,t);break;case 4:e.vertexAttrib4fv(n.location,t);break;default:e.vertexAttrib1fv(n.location,t)}}}}p()}(i,n,l,f),null!==g&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(g).buffer))},reset:f,resetDefaultState:g,dispose:function(){for(let e in f(),r){let t=r[e];for(let e in t){let i=t[e];for(let e in i)l(i[e].object),delete i[e];delete t[e]}delete r[e]}},releaseStatesOfGeometry:function(e){if(void 0===r[e.id])return;let t=r[e.id];for(let e in t){let i=t[e];for(let e in i)l(i[e].object),delete i[e];delete t[e]}delete r[e.id]},releaseStatesOfProgram:function(e){for(let t in r){let i=r[t];if(void 0===i[e.id])continue;let n=i[e.id];for(let e in n)l(n[e].object),delete n[e];delete i[e.id]}},initAttributes:c,enableAttribute:u,disableUnusedAttributes:p}}function l7(e,t,i){let r;function n(t,n,a){0!==a&&(e.drawArraysInstanced(r,t,n,a),i.update(n,r,a))}this.setMode=function(e){r=e},this.render=function(t,n){e.drawArrays(r,t,n),i.update(n,r,1)},this.renderInstances=n,this.renderMultiDraw=function(e,n,a){if(0===a)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,e,0,n,0,a);let s=0;for(let e=0;e<a;e++)s+=n[e];i.update(s,r,1)},this.renderMultiDrawInstances=function(e,a,s,o){if(0===s)return;let l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<e.length;t++)n(e[t],a[t],o[t]);else{l.multiDrawArraysInstancedWEBGL(r,e,0,a,0,o,0,s);let t=0;for(let e=0;e<s;e++)t+=a[e]*o[e];i.update(t,r,1)}}}function he(e,t,i,r){let n;function a(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let s=void 0!==i.precision?i.precision:"highp",o=a(s);return o!==s&&(t$("WebGLRenderer:",s,"not supported, using",o,"instead."),s=o),{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===t.has("EXT_texture_filter_anisotropic")){let i=t.get("EXT_texture_filter_anisotropic");n=e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:a,textureFormatReadable:function(t){return 1023===t||r.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(i){let n=1016===i&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return 1009===i||r.convert(i)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)||1015===i||!!n},precision:s,logarithmicDepthBuffer:!0===i.logarithmicDepthBuffer,reversedDepthBuffer:!0===i.reversedDepthBuffer&&t.has("EXT_clip_control"),maxTextures:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),maxSamples:e.getParameter(e.MAX_SAMPLES),samples:e.getParameter(e.SAMPLES)}}function ht(e){let t=this,i=null,r=0,n=!1,a=!1,s=new n$,o=new ia,l={value:null,needsUpdate:!1};function h(e,i,r,n){let a=null!==e?e.length:0,h=null;if(0!==a){if(h=l.value,!0!==n||null===h){let t=r+4*a,n=i.matrixWorldInverse;o.getNormalMatrix(n),(null===h||h.length<t)&&(h=new Float32Array(t));for(let t=0,i=r;t!==a;++t,i+=4)s.copy(e[t]).applyMatrix4(n,o),s.normal.toArray(h,i),h[i+3]=s.constant}l.value=h,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,h}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let i=0!==e.length||t||0!==r||n;return n=t,r=e.length,i},this.beginShadows=function(){a=!0,h(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){i=h(e,t,0)},this.setState=function(s,o,c){let u=s.clippingPlanes,d=s.clipIntersection,p=s.clipShadows,A=e.get(s);if(n&&null!==u&&0!==u.length&&(!a||p)){let e=a?0:r,t=4*e,n=A.clippingState||null;l.value=n,n=h(u,o,t,c);for(let e=0;e!==t;++e)n[e]=i[e];A.clippingState=n,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=e}else a?h(null):(l.value!==i&&(l.value=i,l.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0)}}function hi(e){let t=new WeakMap;function i(e,t){return 303===t?e.mapping=301:304===t&&(e.mapping=302),e}function r(e){let i=e.target;i.removeEventListener("dispose",r);let n=t.get(i);void 0!==n&&(t.delete(i),n.dispose())}return{get:function(n){if(n&&n.isTexture){let a=n.mapping;if(303===a||304===a)if(t.has(n))return i(t.get(n).texture,n.mapping);else{let a=n.image;if(!a||!(a.height>0))return null;{let s=new nm(a.height);return s.fromEquirectangularTexture(e,n),t.set(n,s),n.addEventListener("dispose",r),i(s.texture,n.mapping)}}}return n},dispose:function(){t=new WeakMap}}}let hr=[.125,.215,.35,.446,.526,.582],hn=new sG,ha=new rP,hs=null,ho=0,hl=0,hh=!1,hc=new it;class hu{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,i=.1,r=100,n={}){let{size:a=256,position:s=hc}=n;hs=this._renderer.getRenderTarget(),ho=this._renderer.getActiveCubeFace(),hl=this._renderer.getActiveMipmapLevel(),hh=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(e,i,r,o,s),t>0&&this._blur(o,0,0,t),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=hf(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=hA(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(hs,ho,hl),this._renderer.xr.enabled=hh,e.scissorTest=!1,hp(e,0,0,e.width,e.height)}_fromTexture(e,t){301===e.mapping||302===e.mapping?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),hs=this._renderer.getRenderTarget(),ho=this._renderer.getActiveCubeFace(),hl=this._renderer.getActiveMipmapLevel(),hh=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:1006,minFilter:1006,generateMipmaps:!1,type:1016,format:1023,colorSpace:tW,depthBuffer:!1},r=hd(e,t,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){var n,a;null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=hd(e,t,i);let{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=function(e){let t=[],i=[],r=[],n=e,a=e-4+1+hr.length;for(let s=0;s<a;s++){let a=Math.pow(2,n);t.push(a);let o=1/a;s>e-4?o=hr[s-e+4-1]:0===s&&(o=0),i.push(o);let l=1/(a-2),h=-l,c=1+l,u=[h,h,c,h,c,c,h,h,c,c,h,c],d=new Float32Array(108),p=new Float32Array(72),A=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,i=e>2?0:-1,r=[t,i,0,t+2/3,i,0,t+2/3,i+1,0,t,i,0,t+2/3,i+1,0,t,i+1,0];d.set(r,18*e),p.set(u,12*e);let n=[e,e,e,e,e,e];A.set(n,6*e)}let f=new r1;f.setAttribute("position",new rV(d,3)),f.setAttribute("uv",new rV(p,2)),f.setAttribute("faceIndex",new rV(A,1)),r.push(new nr(f,null)),n>4&&n--}return{lodMeshes:r,sizeLods:t,sigmas:i}}(r)),this._blurMaterial=(n=r,new nh({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(20)},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new it(0,1,0)}},vertexShader:hg(),fragmentShader:`
|
|
445
|
+
|
|
446
|
+
precision mediump float;
|
|
447
|
+
precision mediump int;
|
|
448
|
+
|
|
449
|
+
varying vec3 vOutputDirection;
|
|
450
|
+
|
|
451
|
+
uniform sampler2D envMap;
|
|
452
|
+
uniform int samples;
|
|
453
|
+
uniform float weights[ n ];
|
|
454
|
+
uniform bool latitudinal;
|
|
455
|
+
uniform float dTheta;
|
|
456
|
+
uniform float mipInt;
|
|
457
|
+
uniform vec3 poleAxis;
|
|
458
|
+
|
|
459
|
+
#define ENVMAP_TYPE_CUBE_UV
|
|
460
|
+
#include <cube_uv_reflection_fragment>
|
|
461
|
+
|
|
462
|
+
vec3 getSample( float theta, vec3 axis ) {
|
|
463
|
+
|
|
464
|
+
float cosTheta = cos( theta );
|
|
465
|
+
// Rodrigues' axis-angle rotation
|
|
466
|
+
vec3 sampleDirection = vOutputDirection * cosTheta
|
|
467
|
+
+ cross( axis, vOutputDirection ) * sin( theta )
|
|
468
|
+
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
|
|
469
|
+
|
|
470
|
+
return bilinearCubeUV( envMap, sampleDirection, mipInt );
|
|
471
|
+
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
void main() {
|
|
475
|
+
|
|
476
|
+
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
|
|
477
|
+
|
|
478
|
+
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
|
|
479
|
+
|
|
480
|
+
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
|
|
481
|
+
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
axis = normalize( axis );
|
|
485
|
+
|
|
486
|
+
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
487
|
+
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
|
|
488
|
+
|
|
489
|
+
for ( int i = 1; i < n; i++ ) {
|
|
490
|
+
|
|
491
|
+
if ( i >= samples ) {
|
|
492
|
+
|
|
493
|
+
break;
|
|
494
|
+
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
float theta = dTheta * float( i );
|
|
498
|
+
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
|
|
499
|
+
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
|
|
500
|
+
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
}
|
|
504
|
+
`,blending:0,depthTest:!1,depthWrite:!1})),this._ggxMaterial=(a=r,new nh({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:256,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${a}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:hg(),fragmentShader:`
|
|
505
|
+
|
|
506
|
+
precision highp float;
|
|
507
|
+
precision highp int;
|
|
508
|
+
|
|
509
|
+
varying vec3 vOutputDirection;
|
|
510
|
+
|
|
511
|
+
uniform sampler2D envMap;
|
|
512
|
+
uniform float roughness;
|
|
513
|
+
uniform float mipInt;
|
|
514
|
+
|
|
515
|
+
#define ENVMAP_TYPE_CUBE_UV
|
|
516
|
+
#include <cube_uv_reflection_fragment>
|
|
517
|
+
|
|
518
|
+
#define PI 3.14159265359
|
|
519
|
+
|
|
520
|
+
// Van der Corput radical inverse
|
|
521
|
+
float radicalInverse_VdC(uint bits) {
|
|
522
|
+
bits = (bits << 16u) | (bits >> 16u);
|
|
523
|
+
bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
|
|
524
|
+
bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
|
|
525
|
+
bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
|
|
526
|
+
bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
|
|
527
|
+
return float(bits) * 2.3283064365386963e-10; // / 0x100000000
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
// Hammersley sequence
|
|
531
|
+
vec2 hammersley(uint i, uint N) {
|
|
532
|
+
return vec2(float(i) / float(N), radicalInverse_VdC(i));
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// GGX VNDF importance sampling (Eric Heitz 2018)
|
|
536
|
+
// "Sampling the GGX Distribution of Visible Normals"
|
|
537
|
+
// https://jcgt.org/published/0007/04/01/
|
|
538
|
+
vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
|
|
539
|
+
float alpha = roughness * roughness;
|
|
540
|
+
|
|
541
|
+
// Section 3.2: Transform view direction to hemisphere configuration
|
|
542
|
+
vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z));
|
|
543
|
+
|
|
544
|
+
// Section 4.1: Orthonormal basis
|
|
545
|
+
float lensq = Vh.x * Vh.x + Vh.y * Vh.y;
|
|
546
|
+
vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0);
|
|
547
|
+
vec3 T2 = cross(Vh, T1);
|
|
548
|
+
|
|
549
|
+
// Section 4.2: Parameterization of projected area
|
|
550
|
+
float r = sqrt(Xi.x);
|
|
551
|
+
float phi = 2.0 * PI * Xi.y;
|
|
552
|
+
float t1 = r * cos(phi);
|
|
553
|
+
float t2 = r * sin(phi);
|
|
554
|
+
float s = 0.5 * (1.0 + Vh.z);
|
|
555
|
+
t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
|
|
556
|
+
|
|
557
|
+
// Section 4.3: Reprojection onto hemisphere
|
|
558
|
+
vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh;
|
|
559
|
+
|
|
560
|
+
// Section 3.4: Transform back to ellipsoid configuration
|
|
561
|
+
return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
void main() {
|
|
565
|
+
vec3 N = normalize(vOutputDirection);
|
|
566
|
+
vec3 V = N; // Assume view direction equals normal for pre-filtering
|
|
567
|
+
|
|
568
|
+
vec3 prefilteredColor = vec3(0.0);
|
|
569
|
+
float totalWeight = 0.0;
|
|
570
|
+
|
|
571
|
+
// For very low roughness, just sample the environment directly
|
|
572
|
+
if (roughness < 0.001) {
|
|
573
|
+
gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
// Tangent space basis for VNDF sampling
|
|
578
|
+
vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
|
|
579
|
+
vec3 tangent = normalize(cross(up, N));
|
|
580
|
+
vec3 bitangent = cross(N, tangent);
|
|
581
|
+
|
|
582
|
+
for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
|
|
583
|
+
vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
|
|
584
|
+
|
|
585
|
+
// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
|
|
586
|
+
vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
|
|
587
|
+
|
|
588
|
+
// Transform H back to world space
|
|
589
|
+
vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
|
|
590
|
+
vec3 L = normalize(2.0 * dot(V, H) * H - V);
|
|
591
|
+
|
|
592
|
+
float NdotL = max(dot(N, L), 0.0);
|
|
593
|
+
|
|
594
|
+
if(NdotL > 0.0) {
|
|
595
|
+
// Sample environment at fixed mip level
|
|
596
|
+
// VNDF importance sampling handles the distribution filtering
|
|
597
|
+
vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
|
|
598
|
+
|
|
599
|
+
// Weight by NdotL for the split-sum approximation
|
|
600
|
+
// VNDF PDF naturally accounts for the visible microfacet distribution
|
|
601
|
+
prefilteredColor += sampleColor * NdotL;
|
|
602
|
+
totalWeight += NdotL;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
if (totalWeight > 0.0) {
|
|
607
|
+
prefilteredColor = prefilteredColor / totalWeight;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
gl_FragColor = vec4(prefilteredColor, 1.0);
|
|
611
|
+
}
|
|
612
|
+
`,blending:0,depthTest:!1,depthWrite:!1}))}return r}_compileMaterial(e){let t=new nr(new r1,e);this._renderer.compile(t,hn)}_sceneToCubeUV(e,t,i,r,n){let a=new nA(90,1,t,i),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],l=this._renderer,h=l.autoClear,c=l.toneMapping;l.getClearColor(ha),l.toneMapping=0,l.autoClear=!1,l.state.buffers.depth.getReversed()&&(l.setRenderTarget(r),l.clearDepth(),l.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new nr(new na,new rO({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1})));let u=this._backgroundBox,d=u.material,p=!1,A=e.background;A?A.isColor&&(d.color.copy(A),e.background=null,p=!0):(d.color.copy(ha),p=!0);for(let t=0;t<6;t++){let i=t%3;0===i?(a.up.set(0,s[t],0),a.position.set(n.x,n.y,n.z),a.lookAt(n.x+o[t],n.y,n.z)):1===i?(a.up.set(0,0,s[t]),a.position.set(n.x,n.y,n.z),a.lookAt(n.x,n.y+o[t],n.z)):(a.up.set(0,s[t],0),a.position.set(n.x,n.y,n.z),a.lookAt(n.x,n.y,n.z+o[t]));let h=this._cubeSize;hp(r,i*h,t>2?h:0,h,h),l.setRenderTarget(r),p&&l.render(u,a),l.render(e,a)}l.toneMapping=c,l.autoClear=h,e.background=A}_textureToCubeUV(e,t){let i=this._renderer,r=301===e.mapping||302===e.mapping;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=hf()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=hA());let n=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=n,n.uniforms.envMap.value=e;let s=this._cubeSize;hp(t,0,0,3*s,2*s),i.setRenderTarget(t),i.render(a,hn)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let t=1;t<r;t++)this._applyGGXFilter(e,t-1,t);t.autoClear=i}_applyGGXFilter(e,t,i){let r=this._renderer,n=this._pingPongRenderTarget,a=this._ggxMaterial,s=this._lodMeshes[i];s.material=a;let o=a.uniforms,l=i/(this._lodMeshes.length-1),h=t/(this._lodMeshes.length-1),c=Math.sqrt(l*l-h*h),{_lodMax:u}=this,d=this._sizeLods[i],p=3*d*(i>u-4?i-u+4:0),A=4*(this._cubeSize-d);o.envMap.value=e.texture,o.roughness.value=c*(0+1.25*l),o.mipInt.value=u-t,hp(n,p,A,3*d,2*d),r.setRenderTarget(n),r.render(s,hn),o.envMap.value=n.texture,o.roughness.value=0,o.mipInt.value=u-i,hp(e,p,A,3*d,2*d),r.setRenderTarget(e),r.render(s,hn)}_blur(e,t,i,r,n){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,r,"latitudinal",n),this._halfBlur(a,e,i,i,r,"longitudinal",n)}_halfBlur(e,t,i,r,n,a,s){let o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&tZ("blur direction must be either latitudinal or longitudinal!");let h=this._lodMeshes[r];h.material=l;let c=l.uniforms,u=this._sizeLods[i]-1,d=isFinite(n)?Math.PI/(2*u):2*Math.PI/39,p=n/d,A=isFinite(n)?1+Math.floor(3*p):20;A>20&&t$(`sigmaRadians, ${n}, is too large and will clip, as it requested ${A} samples when the maximum is set to 20`);let f=[],g=0;for(let e=0;e<20;++e){let t=e/p,i=Math.exp(-t*t/2);f.push(i),0===e?g+=i:e<A&&(g+=2*i)}for(let e=0;e<f.length;e++)f[e]=f[e]/g;c.envMap.value=e.texture,c.samples.value=A,c.weights.value=f,c.latitudinal.value="latitudinal"===a,s&&(c.poleAxis.value=s);let{_lodMax:m}=this;c.dTheta.value=d,c.mipInt.value=m-i;let v=this._sizeLods[r],b=4*(this._cubeSize-v);hp(t,3*v*(r>m-4?r-m+4:0),b,3*v,2*v),o.setRenderTarget(t),o.render(h,hn)}}function hd(e,t,i){let r=new i_(e,t,i);return r.texture.mapping=306,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function hp(e,t,i,r,n){e.viewport.set(t,i,r,n),e.scissor.set(t,i,r,n)}function hA(){return new nh({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:hg(),fragmentShader:`
|
|
613
|
+
|
|
614
|
+
precision mediump float;
|
|
615
|
+
precision mediump int;
|
|
616
|
+
|
|
617
|
+
varying vec3 vOutputDirection;
|
|
618
|
+
|
|
619
|
+
uniform sampler2D envMap;
|
|
620
|
+
|
|
621
|
+
#include <common>
|
|
622
|
+
|
|
623
|
+
void main() {
|
|
624
|
+
|
|
625
|
+
vec3 outputDirection = normalize( vOutputDirection );
|
|
626
|
+
vec2 uv = equirectUv( outputDirection );
|
|
627
|
+
|
|
628
|
+
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|
629
|
+
|
|
630
|
+
}
|
|
631
|
+
`,blending:0,depthTest:!1,depthWrite:!1})}function hf(){return new nh({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:hg(),fragmentShader:`
|
|
632
|
+
|
|
633
|
+
precision mediump float;
|
|
634
|
+
precision mediump int;
|
|
635
|
+
|
|
636
|
+
uniform float flipEnvMap;
|
|
637
|
+
|
|
638
|
+
varying vec3 vOutputDirection;
|
|
639
|
+
|
|
640
|
+
uniform samplerCube envMap;
|
|
641
|
+
|
|
642
|
+
void main() {
|
|
643
|
+
|
|
644
|
+
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
|
645
|
+
|
|
646
|
+
}
|
|
647
|
+
`,blending:0,depthTest:!1,depthWrite:!1})}function hg(){return`
|
|
648
|
+
|
|
649
|
+
precision mediump float;
|
|
650
|
+
precision mediump int;
|
|
651
|
+
|
|
652
|
+
attribute float faceIndex;
|
|
653
|
+
|
|
654
|
+
varying vec3 vOutputDirection;
|
|
655
|
+
|
|
656
|
+
// RH coordinate system; PMREM face-indexing convention
|
|
657
|
+
vec3 getDirection( vec2 uv, float face ) {
|
|
658
|
+
|
|
659
|
+
uv = 2.0 * uv - 1.0;
|
|
660
|
+
|
|
661
|
+
vec3 direction = vec3( uv, 1.0 );
|
|
662
|
+
|
|
663
|
+
if ( face == 0.0 ) {
|
|
664
|
+
|
|
665
|
+
direction = direction.zyx; // ( 1, v, u ) pos x
|
|
666
|
+
|
|
667
|
+
} else if ( face == 1.0 ) {
|
|
668
|
+
|
|
669
|
+
direction = direction.xzy;
|
|
670
|
+
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
|
|
671
|
+
|
|
672
|
+
} else if ( face == 2.0 ) {
|
|
673
|
+
|
|
674
|
+
direction.x *= -1.0; // ( -u, v, 1 ) pos z
|
|
675
|
+
|
|
676
|
+
} else if ( face == 3.0 ) {
|
|
677
|
+
|
|
678
|
+
direction = direction.zyx;
|
|
679
|
+
direction.xz *= -1.0; // ( -1, v, -u ) neg x
|
|
680
|
+
|
|
681
|
+
} else if ( face == 4.0 ) {
|
|
682
|
+
|
|
683
|
+
direction = direction.xzy;
|
|
684
|
+
direction.xy *= -1.0; // ( -u, -1, v ) neg y
|
|
685
|
+
|
|
686
|
+
} else if ( face == 5.0 ) {
|
|
687
|
+
|
|
688
|
+
direction.z *= -1.0; // ( u, v, -1 ) neg z
|
|
689
|
+
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
return direction;
|
|
693
|
+
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
void main() {
|
|
697
|
+
|
|
698
|
+
vOutputDirection = getDirection( uv, faceIndex );
|
|
699
|
+
gl_Position = vec4( position, 1.0 );
|
|
700
|
+
|
|
701
|
+
}
|
|
702
|
+
`}function hm(e){let t=new WeakMap,i=null;function r(e){let i=e.target;i.removeEventListener("dispose",r);let n=t.get(i);void 0!==n&&(t.delete(i),n.dispose())}return{get:function(n){if(n&&n.isTexture){let a=n.mapping,s=303===a||304===a,o=301===a||302===a;if(s||o){let a=t.get(n),l=void 0!==a?a.texture.pmremVersion:0;if(n.isRenderTargetTexture&&n.pmremVersion!==l)return null===i&&(i=new hu(e)),(a=s?i.fromEquirectangular(n,a):i.fromCubemap(n,a)).texture.pmremVersion=n.pmremVersion,t.set(n,a),a.texture;{if(void 0!==a)return a.texture;let l=n.image;return s&&l&&l.height>0||o&&l&&function(e){let t=0;for(let i=0;i<6;i++)void 0!==e[i]&&t++;return 6===t}(l)?(null===i&&(i=new hu(e)),(a=s?i.fromEquirectangular(n):i.fromCubemap(n)).texture.pmremVersion=n.pmremVersion,t.set(n,a),n.addEventListener("dispose",r),a.texture):null}}}return n},dispose:function(){t=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function hv(e){let t={};function i(i){if(void 0!==t[i])return t[i];let r=e.getExtension(i);return t[i]=r,r}return{has:function(e){return null!==i(e)},init:function(){i("EXT_color_buffer_float"),i("WEBGL_clip_cull_distance"),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("WEBGL_multisampled_render_to_texture"),i("WEBGL_render_shared_exponent")},get:function(e){let t=i(e);return null===t&&t0("WebGLRenderer: "+e+" extension not supported."),t}}}function hb(e,t,i,r){let n={},a=new WeakMap;function s(e){let o=e.target;for(let e in null!==o.index&&t.remove(o.index),o.attributes)t.remove(o.attributes[e]);o.removeEventListener("dispose",s),delete n[o.id];let l=a.get(o);l&&(t.remove(l),a.delete(o)),r.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,i.memory.geometries--}function o(e){let i=[],r=e.index,n=e.attributes.position,s=0;if(null!==r){let e=r.array;s=r.version;for(let t=0,r=e.length;t<r;t+=3){let r=e[t+0],n=e[t+1],a=e[t+2];i.push(r,n,n,a,a,r)}}else{if(void 0===n)return;let e=n.array;s=n.version;for(let t=0,r=e.length/3-1;t<r;t+=3){let e=t+0,r=t+1,n=t+2;i.push(e,r,r,n,n,e)}}let o=new(tX(i)?rq:rW)(i,1);o.version=s;let l=a.get(e);l&&t.remove(l),a.set(e,o)}return{get:function(e,t){return!0===n[t.id]||(t.addEventListener("dispose",s),n[t.id]=!0,i.memory.geometries++),t},update:function(i){let r=i.attributes;for(let i in r)t.update(r[i],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){let t=a.get(e);if(t){let i=e.index;null!==i&&t.version<i.version&&o(e)}else o(e);return a.get(e)}}}function hy(e,t,i){let r,n,a;function s(t,s,o){0!==o&&(e.drawElementsInstanced(r,s,n,t*a,o),i.update(s,r,o))}this.setMode=function(e){r=e},this.setIndex=function(e){n=e.type,a=e.bytesPerElement},this.render=function(t,s){e.drawElements(r,s,n,t*a),i.update(s,r,1)},this.renderInstances=s,this.renderMultiDraw=function(e,a,s){if(0===s)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,a,0,n,e,0,s);let o=0;for(let e=0;e<s;e++)o+=a[e];i.update(o,r,1)},this.renderMultiDrawInstances=function(e,o,l,h){if(0===l)return;let c=t.get("WEBGL_multi_draw");if(null===c)for(let t=0;t<e.length;t++)s(e[t]/a,o[t],h[t]);else{c.multiDrawElementsInstancedWEBGL(r,o,0,n,e,0,h,0,l);let t=0;for(let e=0;e<l;e++)t+=o[e]*h[e];i.update(t,r,1)}}}function hx(e){let t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(i,r,n){switch(t.calls++,r){case e.TRIANGLES:t.triangles+=i/3*n;break;case e.LINES:t.lines+=i/2*n;break;case e.LINE_STRIP:t.lines+=n*(i-1);break;case e.LINE_LOOP:t.lines+=n*i;break;case e.POINTS:t.points+=n*i;break;default:tZ("WebGLInfo: Unknown draw mode:",r)}}}}function h_(e,t,i){let r=new WeakMap,n=new iy;return{update:function(a,s,o){let l=a.morphTargetInfluences,h=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,c=void 0!==h?h.length:0,u=r.get(s);if(void 0===u||u.count!==c){void 0!==u&&u.texture.dispose();let e=void 0!==s.morphAttributes.position,i=void 0!==s.morphAttributes.normal,a=void 0!==s.morphAttributes.color,o=s.morphAttributes.position||[],l=s.morphAttributes.normal||[],h=s.morphAttributes.color||[],d=0;!0===e&&(d=1),!0===i&&(d=2),!0===a&&(d=3);let p=s.attributes.position.count*d,A=1;p>t.maxTextureSize&&(A=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let f=new Float32Array(p*A*4*c),g=new iE(f,p,A,c);g.type=1015,g.needsUpdate=!0;let m=4*d;for(let t=0;t<c;t++){let r=o[t],s=l[t],c=h[t],u=p*A*4*t;for(let t=0;t<r.count;t++){let o=t*m;!0===e&&(n.fromBufferAttribute(r,t),f[u+o+0]=n.x,f[u+o+1]=n.y,f[u+o+2]=n.z,f[u+o+3]=0),!0===i&&(n.fromBufferAttribute(s,t),f[u+o+4]=n.x,f[u+o+5]=n.y,f[u+o+6]=n.z,f[u+o+7]=0),!0===a&&(n.fromBufferAttribute(c,t),f[u+o+8]=n.x,f[u+o+9]=n.y,f[u+o+10]=n.z,f[u+o+11]=4===c.itemSize?n.w:1)}}u={count:c,texture:g,size:new t7(p,A)},r.set(s,u),s.addEventListener("dispose",function e(){g.dispose(),r.delete(s),s.removeEventListener("dispose",e)})}if(!0===a.isInstancedMesh&&null!==a.morphTexture)o.getUniforms().setValue(e,"morphTexture",a.morphTexture,i);else{let t=0;for(let e=0;e<l.length;e++)t+=l[e];let i=s.morphTargetsRelative?1:1-t;o.getUniforms().setValue(e,"morphTargetBaseInfluence",i),o.getUniforms().setValue(e,"morphTargetInfluences",l)}o.getUniforms().setValue(e,"morphTargetsTexture",u.texture,i),o.getUniforms().setValue(e,"morphTargetsTextureSize",u.size)}}}function hE(e,t,i,r){let n=new WeakMap;function a(e){let t=e.target;t.removeEventListener("dispose",a),i.remove(t.instanceMatrix),null!==t.instanceColor&&i.remove(t.instanceColor)}return{update:function(s){let o=r.render.frame,l=s.geometry,h=t.get(s,l);if(n.get(h)!==o&&(t.update(h),n.set(h,o)),s.isInstancedMesh&&(!1===s.hasEventListener("dispose",a)&&s.addEventListener("dispose",a),n.get(s)!==o&&(i.update(s.instanceMatrix,e.ARRAY_BUFFER),null!==s.instanceColor&&i.update(s.instanceColor,e.ARRAY_BUFFER),n.set(s,o))),s.isSkinnedMesh){let e=s.skeleton;n.get(e)!==o&&(e.update(),n.set(e,o))}return h},dispose:function(){n=new WeakMap}}}let hS={1:"LINEAR_TONE_MAPPING",2:"REINHARD_TONE_MAPPING",3:"CINEON_TONE_MAPPING",4:"ACES_FILMIC_TONE_MAPPING",6:"AGX_TONE_MAPPING",7:"NEUTRAL_TONE_MAPPING",5:"CUSTOM_TONE_MAPPING"};function hC(e,t,i,r,n){let a,s=new i_(t,i,{type:e,depthBuffer:r,stencilBuffer:n}),o=new i_(t,i,{type:1016,depthBuffer:!1,stencilBuffer:!1}),l=new r1;l.setAttribute("position",new rj([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new rj([0,2,0,0,2,0],2));let h=new se({uniforms:{tDiffuse:{value:null}},vertexShader:`
|
|
703
|
+
precision highp float;
|
|
704
|
+
|
|
705
|
+
uniform mat4 modelViewMatrix;
|
|
706
|
+
uniform mat4 projectionMatrix;
|
|
707
|
+
|
|
708
|
+
attribute vec3 position;
|
|
709
|
+
attribute vec2 uv;
|
|
710
|
+
|
|
711
|
+
varying vec2 vUv;
|
|
712
|
+
|
|
713
|
+
void main() {
|
|
714
|
+
vUv = uv;
|
|
715
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
716
|
+
}`,fragmentShader:`
|
|
717
|
+
precision highp float;
|
|
718
|
+
|
|
719
|
+
uniform sampler2D tDiffuse;
|
|
720
|
+
|
|
721
|
+
varying vec2 vUv;
|
|
722
|
+
|
|
723
|
+
#include <tonemapping_pars_fragment>
|
|
724
|
+
#include <colorspace_pars_fragment>
|
|
725
|
+
|
|
726
|
+
void main() {
|
|
727
|
+
gl_FragColor = texture2D( tDiffuse, vUv );
|
|
728
|
+
|
|
729
|
+
#ifdef LINEAR_TONE_MAPPING
|
|
730
|
+
gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
|
|
731
|
+
#elif defined( REINHARD_TONE_MAPPING )
|
|
732
|
+
gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
|
|
733
|
+
#elif defined( CINEON_TONE_MAPPING )
|
|
734
|
+
gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
|
|
735
|
+
#elif defined( ACES_FILMIC_TONE_MAPPING )
|
|
736
|
+
gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
|
|
737
|
+
#elif defined( AGX_TONE_MAPPING )
|
|
738
|
+
gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
|
|
739
|
+
#elif defined( NEUTRAL_TONE_MAPPING )
|
|
740
|
+
gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
|
|
741
|
+
#elif defined( CUSTOM_TONE_MAPPING )
|
|
742
|
+
gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
|
|
743
|
+
#endif
|
|
744
|
+
|
|
745
|
+
#ifdef SRGB_TRANSFER
|
|
746
|
+
gl_FragColor = sRGBTransferOETF( gl_FragColor );
|
|
747
|
+
#endif
|
|
748
|
+
}`,depthTest:!1,depthWrite:!1}),c=new nr(l,h),u=new sG(-1,1,1,-1,0,1),d=null,p=null,A=!1,f=null,g=[],m=!1;this.setSize=function(e,t){s.setSize(e,t),o.setSize(e,t);for(let i=0;i<g.length;i++){let r=g[i];r.setSize&&r.setSize(e,t)}},this.setEffects=function(e){m=(g=e).length>0&&!0===g[0].isRenderPass;let t=s.width,i=s.height;for(let e=0;e<g.length;e++){let r=g[e];r.setSize&&r.setSize(t,i)}},this.begin=function(e,t){if(A||0===e.toneMapping&&0===g.length)return!1;if(f=t,null!==t){let e=t.width,i=t.height;(s.width!==e||s.height!==i)&&this.setSize(e,i)}return!1===m&&e.setRenderTarget(s),a=e.toneMapping,e.toneMapping=0,!0},this.hasRenderPass=function(){return m},this.end=function(e,t){e.toneMapping=a,A=!0;let i=s,r=o;for(let n=0;n<g.length;n++){let a=g[n];if(!1!==a.enabled&&(a.render(e,r,i,t),!1!==a.needsSwap)){let e=i;i=r,r=e}}if(d!==e.outputColorSpace||p!==e.toneMapping){d=e.outputColorSpace,p=e.toneMapping,h.defines={},"srgb"===ih.getTransfer(d)&&(h.defines.SRGB_TRANSFER="");let t=hS[p];t&&(h.defines[t]=""),h.needsUpdate=!0}h.uniforms.tDiffuse.value=i.texture,e.setRenderTarget(f),e.render(c,u),f=null,A=!1},this.isCompositing=function(){return A},this.dispose=function(){s.dispose(),o.dispose(),l.dispose(),h.dispose()}}let hM=new ib,hw=new ab(1,1),hI=new iE,hT=new iS,hB=new ng,hR=[],hD=[],hL=new Float32Array(16),hP=new Float32Array(9),hU=new Float32Array(4);function hF(e,t,i){let r=e[0];if(r<=0||r>0)return e;let n=t*i,a=hR[n];if(void 0===a&&(a=new Float32Array(n),hR[n]=a),0!==t){r.toArray(a,0);for(let r=1,n=0;r!==t;++r)n+=i,e[r].toArray(a,n)}return a}function hN(e,t){if(e.length!==t.length)return!1;for(let i=0,r=e.length;i<r;i++)if(e[i]!==t[i])return!1;return!0}function hO(e,t){for(let i=0,r=t.length;i<r;i++)e[i]=t[i]}function hk(e,t){let i=hD[t];void 0===i&&(i=new Int32Array(t),hD[t]=i);for(let r=0;r!==t;++r)i[r]=e.allocateTextureUnit();return i}function hQ(e,t){let i=this.cache;i[0]!==t&&(e.uniform1f(this.addr,t),i[0]=t)}function hG(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(hN(i,t))return;e.uniform2fv(this.addr,t),hO(i,t)}}function hH(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else if(void 0!==t.r)(i[0]!==t.r||i[1]!==t.g||i[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),i[0]=t.r,i[1]=t.g,i[2]=t.b);else{if(hN(i,t))return;e.uniform3fv(this.addr,t),hO(i,t)}}function hz(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(hN(i,t))return;e.uniform4fv(this.addr,t),hO(i,t)}}function hV(e,t){let i=this.cache,r=t.elements;if(void 0===r){if(hN(i,t))return;e.uniformMatrix2fv(this.addr,!1,t),hO(i,t)}else{if(hN(i,r))return;hU.set(r),e.uniformMatrix2fv(this.addr,!1,hU),hO(i,r)}}function hW(e,t){let i=this.cache,r=t.elements;if(void 0===r){if(hN(i,t))return;e.uniformMatrix3fv(this.addr,!1,t),hO(i,t)}else{if(hN(i,r))return;hP.set(r),e.uniformMatrix3fv(this.addr,!1,hP),hO(i,r)}}function hq(e,t){let i=this.cache,r=t.elements;if(void 0===r){if(hN(i,t))return;e.uniformMatrix4fv(this.addr,!1,t),hO(i,t)}else{if(hN(i,r))return;hL.set(r),e.uniformMatrix4fv(this.addr,!1,hL),hO(i,r)}}function hj(e,t){let i=this.cache;i[0]!==t&&(e.uniform1i(this.addr,t),i[0]=t)}function hX(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(hN(i,t))return;e.uniform2iv(this.addr,t),hO(i,t)}}function hY(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else{if(hN(i,t))return;e.uniform3iv(this.addr,t),hO(i,t)}}function hK(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(hN(i,t))return;e.uniform4iv(this.addr,t),hO(i,t)}}function hJ(e,t){let i=this.cache;i[0]!==t&&(e.uniform1ui(this.addr,t),i[0]=t)}function h$(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(hN(i,t))return;e.uniform2uiv(this.addr,t),hO(i,t)}}function hZ(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else{if(hN(i,t))return;e.uniform3uiv(this.addr,t),hO(i,t)}}function h0(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(hN(i,t))return;e.uniform4uiv(this.addr,t),hO(i,t)}}function h1(e,t,i){let r,n=this.cache,a=i.allocateTextureUnit();n[0]!==a&&(e.uniform1i(this.addr,a),n[0]=a),this.type===e.SAMPLER_2D_SHADOW?(hw.compareFunction=i.isReversedDepthBuffer()?518:515,r=hw):r=hM,i.setTexture2D(t||r,a)}function h2(e,t,i){let r=this.cache,n=i.allocateTextureUnit();r[0]!==n&&(e.uniform1i(this.addr,n),r[0]=n),i.setTexture3D(t||hT,n)}function h3(e,t,i){let r=this.cache,n=i.allocateTextureUnit();r[0]!==n&&(e.uniform1i(this.addr,n),r[0]=n),i.setTextureCube(t||hB,n)}function h4(e,t,i){let r=this.cache,n=i.allocateTextureUnit();r[0]!==n&&(e.uniform1i(this.addr,n),r[0]=n),i.setTexture2DArray(t||hI,n)}function h5(e,t){e.uniform1fv(this.addr,t)}function h8(e,t){let i=hF(t,this.size,2);e.uniform2fv(this.addr,i)}function h9(e,t){let i=hF(t,this.size,3);e.uniform3fv(this.addr,i)}function h6(e,t){let i=hF(t,this.size,4);e.uniform4fv(this.addr,i)}function h7(e,t){let i=hF(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,i)}function ce(e,t){let i=hF(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,i)}function ct(e,t){let i=hF(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,i)}function ci(e,t){e.uniform1iv(this.addr,t)}function cr(e,t){e.uniform2iv(this.addr,t)}function cn(e,t){e.uniform3iv(this.addr,t)}function ca(e,t){e.uniform4iv(this.addr,t)}function cs(e,t){e.uniform1uiv(this.addr,t)}function co(e,t){e.uniform2uiv(this.addr,t)}function cl(e,t){e.uniform3uiv(this.addr,t)}function ch(e,t){e.uniform4uiv(this.addr,t)}function cc(e,t,i){let r,n=this.cache,a=t.length,s=hk(i,a);hN(n,s)||(e.uniform1iv(this.addr,s),hO(n,s)),r=this.type===e.SAMPLER_2D_SHADOW?hw:hM;for(let e=0;e!==a;++e)i.setTexture2D(t[e]||r,s[e])}function cu(e,t,i){let r=this.cache,n=t.length,a=hk(i,n);hN(r,a)||(e.uniform1iv(this.addr,a),hO(r,a));for(let e=0;e!==n;++e)i.setTexture3D(t[e]||hT,a[e])}function cd(e,t,i){let r=this.cache,n=t.length,a=hk(i,n);hN(r,a)||(e.uniform1iv(this.addr,a),hO(r,a));for(let e=0;e!==n;++e)i.setTextureCube(t[e]||hB,a[e])}function cp(e,t,i){let r=this.cache,n=t.length,a=hk(i,n);hN(r,a)||(e.uniform1iv(this.addr,a),hO(r,a));for(let e=0;e!==n;++e)i.setTexture2DArray(t[e]||hI,a[e])}class cA{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return hQ;case 35664:return hG;case 35665:return hH;case 35666:return hz;case 35674:return hV;case 35675:return hW;case 35676:return hq;case 5124:case 35670:return hj;case 35667:case 35671:return hX;case 35668:case 35672:return hY;case 35669:case 35673:return hK;case 5125:return hJ;case 36294:return h$;case 36295:return hZ;case 36296:return h0;case 35678:case 36198:case 36298:case 36306:case 35682:return h1;case 35679:case 36299:case 36307:return h2;case 35680:case 36300:case 36308:case 36293:return h3;case 36289:case 36303:case 36311:case 36292:return h4}}(t.type)}}class cf{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return h5;case 35664:return h8;case 35665:return h9;case 35666:return h6;case 35674:return h7;case 35675:return ce;case 35676:return ct;case 5124:case 35670:return ci;case 35667:case 35671:return cr;case 35668:case 35672:return cn;case 35669:case 35673:return ca;case 5125:return cs;case 36294:return co;case 36295:return cl;case 36296:return ch;case 35678:case 36198:case 36298:case 36306:case 35682:return cc;case 35679:case 36299:case 36307:return cu;case 35680:case 36300:case 36308:case 36293:return cd;case 36289:case 36303:case 36311:case 36292:return cp}}(t.type)}}class cg{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){let r=this.seq;for(let n=0,a=r.length;n!==a;++n){let a=r[n];a.setValue(e,t[a.id],i)}}}let cm=/(\w+)(\])?(\[|\.)?/g;function cv(e,t){e.seq.push(t),e.map[t.id]=t}class cb{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){const i=e.getActiveUniform(t,r),n=e.getUniformLocation(t,i.name);!function(e,t,i){let r=e.name,n=r.length;for(cm.lastIndex=0;;){let a=cm.exec(r),s=cm.lastIndex,o=a[1],l="]"===a[2],h=a[3];if(l&&(o|=0),void 0===h||"["===h&&s+2===n){cv(i,void 0===h?new cA(o,e,t):new cf(o,e,t));break}{let e=i.map[o];void 0===e&&cv(i,e=new cg(o)),i=e}}}(i,n,this)}const r=[],n=[];for(const t of this.seq)t.type===e.SAMPLER_2D_SHADOW||t.type===e.SAMPLER_CUBE_SHADOW||t.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(t):n.push(t);r.length>0&&(this.seq=r.concat(n))}setValue(e,t,i,r){let n=this.map[t];void 0!==n&&n.setValue(e,i,r)}setOptional(e,t,i){let r=t[i];void 0!==r&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let n=0,a=t.length;n!==a;++n){let a=t[n],s=i[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,r)}}static seqWithValue(e,t){let i=[];for(let r=0,n=e.length;r!==n;++r){let n=e[r];n.id in t&&i.push(n)}return i}}function cy(e,t,i){let r=e.createShader(t);return e.shaderSource(r,i),e.compileShader(r),r}let cx=0,c_=new ia;function cE(e,t,i){let r=e.getShaderParameter(t,e.COMPILE_STATUS),n=(e.getShaderInfoLog(t)||"").trim();if(r&&""===n)return"";let a=/ERROR: 0:(\d+)/.exec(n);if(!a)return n;{let r=parseInt(a[1]);return i.toUpperCase()+"\n\n"+n+"\n\n"+function(e,t){let i=e.split("\n"),r=[],n=Math.max(t-6,0),a=Math.min(t+6,i.length);for(let e=n;e<a;e++){let n=e+1;r.push(`${n===t?">":" "} ${n}: ${i[e]}`)}return r.join("\n")}(e.getShaderSource(t),r)}}let cS={1:"Linear",2:"Reinhard",3:"Cineon",4:"ACESFilmic",6:"AgX",7:"Neutral",5:"Custom"},cC=new it;function cM(e){return""!==e}function cw(e,t){let i=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,i).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function cI(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let cT=/^[ \t]*#include +<([\w\d./]+)>/gm;function cB(e){return e.replace(cT,cD)}let cR=new Map;function cD(e,t){let i=l1[t];if(void 0===i){let e=cR.get(t);if(void 0!==e)i=l1[e],t$('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e);else throw Error("Can not resolve #include <"+t+">")}return cB(i)}let cL=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function cP(e){return e.replace(cL,cU)}function cU(e,t,i,r){let n="";for(let e=parseInt(t);e<parseInt(i);e++)n+=r.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return n}function cF(e){let t=`precision ${e.precision} float;
|
|
749
|
+
precision ${e.precision} int;
|
|
750
|
+
precision ${e.precision} sampler2D;
|
|
751
|
+
precision ${e.precision} samplerCube;
|
|
752
|
+
precision ${e.precision} sampler3D;
|
|
753
|
+
precision ${e.precision} sampler2DArray;
|
|
754
|
+
precision ${e.precision} sampler2DShadow;
|
|
755
|
+
precision ${e.precision} samplerCubeShadow;
|
|
756
|
+
precision ${e.precision} sampler2DArrayShadow;
|
|
757
|
+
precision ${e.precision} isampler2D;
|
|
758
|
+
precision ${e.precision} isampler3D;
|
|
759
|
+
precision ${e.precision} isamplerCube;
|
|
760
|
+
precision ${e.precision} isampler2DArray;
|
|
761
|
+
precision ${e.precision} usampler2D;
|
|
762
|
+
precision ${e.precision} usampler3D;
|
|
763
|
+
precision ${e.precision} usamplerCube;
|
|
764
|
+
precision ${e.precision} usampler2DArray;
|
|
765
|
+
`;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}let cN={1:"SHADOWMAP_TYPE_PCF",3:"SHADOWMAP_TYPE_VSM"},cO={301:"ENVMAP_TYPE_CUBE",302:"ENVMAP_TYPE_CUBE",306:"ENVMAP_TYPE_CUBE_UV"},ck={302:"ENVMAP_MODE_REFRACTION"},cQ={0:"ENVMAP_BLENDING_MULTIPLY",1:"ENVMAP_BLENDING_MIX",2:"ENVMAP_BLENDING_ADD"};function cG(e,t,i,r){var n,a;let s,o,l,h,c=e.getContext(),u=i.defines,d=i.vertexShader,p=i.fragmentShader,A=cN[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC",f=!1===i.envMap?"ENVMAP_TYPE_CUBE":cO[i.envMapMode]||"ENVMAP_TYPE_CUBE",g=!1===i.envMap?"ENVMAP_MODE_REFLECTION":ck[i.envMapMode]||"ENVMAP_MODE_REFLECTION",m=!1===i.envMap?"ENVMAP_BLENDING_NONE":cQ[i.combine]||"ENVMAP_BLENDING_NONE",v=function(e){let t=e.envMapCubeUVHeight;if(null===t)return null;let i=Math.log2(t)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:1/t,maxMip:i}}(i),b=[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(cM).join("\n"),y=function(e){let t=[];for(let i in e){let r=e[i];!1!==r&&t.push("#define "+i+" "+r)}return t.join("\n")}(u),x=c.createProgram(),_=i.glslVersion?"#version "+i.glslVersion+"\n":"";if(i.isRawShaderMaterial)(s=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y].filter(cM).join("\n")).length>0&&(s+="\n"),(o=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y].filter(cM).join("\n")).length>0&&(o+="\n");else{let e,t,r,l,h;s=[cF(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y,i.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",i.batching?"#define USE_BATCHING":"",i.batchingColor?"#define USE_BATCHING_COLOR":"",i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.instancingMorph?"#define USE_INSTANCING_MORPH":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+g:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.displacementMap?"#define USE_DISPLACEMENTMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.mapUv?"#define MAP_UV "+i.mapUv:"",i.alphaMapUv?"#define ALPHAMAP_UV "+i.alphaMapUv:"",i.lightMapUv?"#define LIGHTMAP_UV "+i.lightMapUv:"",i.aoMapUv?"#define AOMAP_UV "+i.aoMapUv:"",i.emissiveMapUv?"#define EMISSIVEMAP_UV "+i.emissiveMapUv:"",i.bumpMapUv?"#define BUMPMAP_UV "+i.bumpMapUv:"",i.normalMapUv?"#define NORMALMAP_UV "+i.normalMapUv:"",i.displacementMapUv?"#define DISPLACEMENTMAP_UV "+i.displacementMapUv:"",i.metalnessMapUv?"#define METALNESSMAP_UV "+i.metalnessMapUv:"",i.roughnessMapUv?"#define ROUGHNESSMAP_UV "+i.roughnessMapUv:"",i.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+i.anisotropyMapUv:"",i.clearcoatMapUv?"#define CLEARCOATMAP_UV "+i.clearcoatMapUv:"",i.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+i.clearcoatNormalMapUv:"",i.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+i.clearcoatRoughnessMapUv:"",i.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+i.iridescenceMapUv:"",i.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+i.iridescenceThicknessMapUv:"",i.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+i.sheenColorMapUv:"",i.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+i.sheenRoughnessMapUv:"",i.specularMapUv?"#define SPECULARMAP_UV "+i.specularMapUv:"",i.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+i.specularColorMapUv:"",i.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+i.specularIntensityMapUv:"",i.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+i.transmissionMapUv:"",i.thicknessMapUv?"#define THICKNESSMAP_UV "+i.thicknessMapUv:"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+A:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",i.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(cM).join("\n"),o=[cF(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+f:"",i.envMap?"#define "+g:"",i.envMap?"#define "+m:"",v?"#define CUBEUV_TEXEL_WIDTH "+v.texelWidth:"",v?"#define CUBEUV_TEXEL_HEIGHT "+v.texelHeight:"",v?"#define CUBEUV_MAX_MIP "+v.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.dispersion?"#define USE_DISPERSION":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor||i.batchingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+A:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",i.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",i.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?l1.tonemapping_pars_fragment:"",0!==i.toneMapping?(n="toneMapping",void 0===(e=cS[a=i.toneMapping])?(t$("WebGLProgram: Unsupported toneMapping:",a),"vec3 "+n+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+n+"( vec3 color ) { return "+e+"ToneMapping( color ); }"):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",l1.colorspace_pars_fragment,(t=function(e){ih._getMatrix(c_,ih.workingColorSpace,e);let t=`mat3( ${c_.elements.map(e=>e.toFixed(4))} )`;switch(ih.getTransfer(e)){case"linear":return[t,"LinearTransferOETF"];case"srgb":return[t,"sRGBTransferOETF"];default:return t$("WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(i.outputColorSpace),`vec4 linearToOutputTexel( vec4 value ) {
|
|
766
|
+
return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );
|
|
767
|
+
}`),(ih.getLuminanceCoefficients(cC),r=cC.x.toFixed(4),l=cC.y.toFixed(4),h=cC.z.toFixed(4),`float luminance( const in vec3 rgb ) {
|
|
768
|
+
const vec3 weights = vec3( ${r}, ${l}, ${h} );
|
|
769
|
+
return dot( weights, rgb );
|
|
770
|
+
}`),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(cM).join("\n")}d=cI(d=cw(d=cB(d),i),i),p=cI(p=cw(p=cB(p),i),i),d=cP(d),p=cP(p),!0!==i.isRawShaderMaterial&&(_="#version 300 es\n",s=[b,"#define attribute in\n#define varying out\n#define texture2D texture"].join("\n")+"\n"+s,o=["#define varying in","300 es"===i.glslVersion?"":"layout(location = 0) out highp vec4 pc_fragColor;","300 es"===i.glslVersion?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+o);let E=_+s+d,S=_+o+p,C=cy(c,c.VERTEX_SHADER,E),M=cy(c,c.FRAGMENT_SHADER,S);function w(t){if(e.debug.checkShaderErrors){let i=c.getProgramInfoLog(x)||"",r=c.getShaderInfoLog(C)||"",n=c.getShaderInfoLog(M)||"",a=i.trim(),l=r.trim(),h=n.trim(),u=!0,d=!0;if(!1===c.getProgramParameter(x,c.LINK_STATUS))if(u=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(c,x,C,M);else{let e=cE(c,C,"vertex"),i=cE(c,M,"fragment");tZ("THREE.WebGLProgram: Shader Error "+c.getError()+" - VALIDATE_STATUS "+c.getProgramParameter(x,c.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+a+"\n"+e+"\n"+i)}else""!==a?t$("WebGLProgram: Program Info Log:",a):(""===l||""===h)&&(d=!1);d&&(t.diagnostics={runnable:u,programLog:a,vertexShader:{log:l,prefix:s},fragmentShader:{log:h,prefix:o}})}c.deleteShader(C),c.deleteShader(M),l=new cb(c,x),h=function(e,t){let i={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let n=0;n<r;n++){let r=e.getActiveAttrib(t,n),a=r.name,s=1;r.type===e.FLOAT_MAT2&&(s=2),r.type===e.FLOAT_MAT3&&(s=3),r.type===e.FLOAT_MAT4&&(s=4),i[a]={type:r.type,location:e.getAttribLocation(t,a),locationSize:s}}return i}(c,x)}c.attachShader(x,C),c.attachShader(x,M),void 0!==i.index0AttributeName?c.bindAttribLocation(x,0,i.index0AttributeName):!0===i.morphTargets&&c.bindAttribLocation(x,0,"position"),c.linkProgram(x),this.getUniforms=function(){return void 0===l&&w(this),l},this.getAttributes=function(){return void 0===h&&w(this),h};let I=!1===i.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===I&&(I=c.getProgramParameter(x,37297)),I},this.destroy=function(){r.releaseStatesOfProgram(this),c.deleteProgram(x),this.program=void 0},this.type=i.shaderType,this.name=i.shaderName,this.id=cx++,this.cacheKey=t,this.usedTimes=1,this.program=x,this.vertexShader=C,this.fragmentShader=M,this}let cH=0;class cz{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),n=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return!1===a.has(r)&&(a.add(r),r.usedTimes++),!1===a.has(n)&&(a.add(n),n.usedTimes++),this}remove(e){for(let t of this.materialCache.get(e))t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,i=t.get(e);return void 0===i&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){let t=this.shaderCache,i=t.get(e);return void 0===i&&(i=new cV(e),t.set(e,i)),i}}class cV{constructor(e){this.id=cH++,this.code=e,this.usedTimes=0}}function cW(e,t,i,r,n,a,s){let o=new i7,l=new cz,h=new Set,c=[],u=new Map,d=n.logarithmicDepthBuffer,p=n.precision,A={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function f(e){return(h.add(e),0===e)?"uv":`uv${e}`}return{getParameters:function(a,o,c,u,g){let m,v,b,y,x=u.fog,_=g.geometry,E=a.isMeshStandardMaterial?u.environment:null,S=(a.isMeshStandardMaterial?i:t).get(a.envMap||E),C=S&&306===S.mapping?S.image.height:null,M=A[a.type];null!==a.precision&&(p=n.getMaxPrecision(a.precision))!==a.precision&&t$("WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead.");let w=_.morphAttributes.position||_.morphAttributes.normal||_.morphAttributes.color,I=void 0!==w?w.length:0,T=0;if(void 0!==_.morphAttributes.position&&(T=1),void 0!==_.morphAttributes.normal&&(T=2),void 0!==_.morphAttributes.color&&(T=3),M){let e=l3[M];m=e.vertexShader,v=e.fragmentShader}else m=a.vertexShader,v=a.fragmentShader,l.update(a),b=l.getVertexShaderID(a),y=l.getFragmentShaderID(a);let B=e.getRenderTarget(),R=e.state.buffers.depth.getReversed(),D=!0===g.isInstancedMesh,L=!0===g.isBatchedMesh,P=!!a.map,U=!!a.matcap,F=!!S,N=!!a.aoMap,O=!!a.lightMap,k=!!a.bumpMap,Q=!!a.normalMap,G=!!a.displacementMap,H=!!a.emissiveMap,z=!!a.metalnessMap,V=!!a.roughnessMap,W=a.anisotropy>0,q=a.clearcoat>0,j=a.dispersion>0,X=a.iridescence>0,Y=a.sheen>0,K=a.transmission>0,J=W&&!!a.anisotropyMap,$=q&&!!a.clearcoatMap,Z=q&&!!a.clearcoatNormalMap,ee=q&&!!a.clearcoatRoughnessMap,et=X&&!!a.iridescenceMap,ei=X&&!!a.iridescenceThicknessMap,er=Y&&!!a.sheenColorMap,en=Y&&!!a.sheenRoughnessMap,ea=!!a.specularMap,es=!!a.specularColorMap,eo=!!a.specularIntensityMap,el=K&&!!a.transmissionMap,eh=K&&!!a.thicknessMap,ec=!!a.gradientMap,eu=!!a.alphaMap,ed=a.alphaTest>0,ep=!!a.alphaHash,eA=!!a.extensions,ef=0;a.toneMapped&&(null===B||!0===B.isXRRenderTarget)&&(ef=e.toneMapping);let eg={shaderID:M,shaderType:a.type,shaderName:a.name,vertexShader:m,fragmentShader:v,defines:a.defines,customVertexShaderID:b,customFragmentShaderID:y,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,batching:L,batchingColor:L&&null!==g._colorsTexture,instancing:D,instancingColor:D&&null!==g.instanceColor,instancingMorph:D&&null!==g.morphTexture,outputColorSpace:null===B?e.outputColorSpace:!0===B.isXRRenderTarget?B.texture.colorSpace:tW,alphaToCoverage:!!a.alphaToCoverage,map:P,matcap:U,envMap:F,envMapMode:F&&S.mapping,envMapCubeUVHeight:C,aoMap:N,lightMap:O,bumpMap:k,normalMap:Q,displacementMap:G,emissiveMap:H,normalMapObjectSpace:Q&&1===a.normalMapType,normalMapTangentSpace:Q&&0===a.normalMapType,metalnessMap:z,roughnessMap:V,anisotropy:W,anisotropyMap:J,clearcoat:q,clearcoatMap:$,clearcoatNormalMap:Z,clearcoatRoughnessMap:ee,dispersion:j,iridescence:X,iridescenceMap:et,iridescenceThicknessMap:ei,sheen:Y,sheenColorMap:er,sheenRoughnessMap:en,specularMap:ea,specularColorMap:es,specularIntensityMap:eo,transmission:K,transmissionMap:el,thicknessMap:eh,gradientMap:ec,opaque:!1===a.transparent&&1===a.blending&&!1===a.alphaToCoverage,alphaMap:eu,alphaTest:ed,alphaHash:ep,combine:a.combine,mapUv:P&&f(a.map.channel),aoMapUv:N&&f(a.aoMap.channel),lightMapUv:O&&f(a.lightMap.channel),bumpMapUv:k&&f(a.bumpMap.channel),normalMapUv:Q&&f(a.normalMap.channel),displacementMapUv:G&&f(a.displacementMap.channel),emissiveMapUv:H&&f(a.emissiveMap.channel),metalnessMapUv:z&&f(a.metalnessMap.channel),roughnessMapUv:V&&f(a.roughnessMap.channel),anisotropyMapUv:J&&f(a.anisotropyMap.channel),clearcoatMapUv:$&&f(a.clearcoatMap.channel),clearcoatNormalMapUv:Z&&f(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ee&&f(a.clearcoatRoughnessMap.channel),iridescenceMapUv:et&&f(a.iridescenceMap.channel),iridescenceThicknessMapUv:ei&&f(a.iridescenceThicknessMap.channel),sheenColorMapUv:er&&f(a.sheenColorMap.channel),sheenRoughnessMapUv:en&&f(a.sheenRoughnessMap.channel),specularMapUv:ea&&f(a.specularMap.channel),specularColorMapUv:es&&f(a.specularColorMap.channel),specularIntensityMapUv:eo&&f(a.specularIntensityMap.channel),transmissionMapUv:el&&f(a.transmissionMap.channel),thicknessMapUv:eh&&f(a.thicknessMap.channel),alphaMapUv:eu&&f(a.alphaMap.channel),vertexTangents:!!_.attributes.tangent&&(Q||W),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!_.attributes.color&&4===_.attributes.color.itemSize,pointsUvs:!0===g.isPoints&&!!_.attributes.uv&&(P||eu),fog:!!x,useFog:!0===a.fog,fogExp2:!!x&&x.isFogExp2,flatShading:!0===a.flatShading&&!1===a.wireframe,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:d,reversedDepthBuffer:R,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==_.morphAttributes.position,morphNormals:void 0!==_.morphAttributes.normal,morphColors:void 0!==_.morphAttributes.color,morphTargetsCount:I,morphTextureStride:T,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:ef,decodeVideoTexture:P&&!0===a.map.isVideoTexture&&"srgb"===ih.getTransfer(a.map.colorSpace),decodeVideoTextureEmissive:H&&!0===a.emissiveMap.isVideoTexture&&"srgb"===ih.getTransfer(a.emissiveMap.colorSpace),premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:eA&&!0===a.extensions.clipCullDistance&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(eA&&!0===a.extensions.multiDraw||L)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return eg.vertexUv1s=h.has(1),eg.vertexUv2s=h.has(2),eg.vertexUv3s=h.has(3),h.clear(),eg},getProgramCacheKey:function(t){var i,r,n,a;let s=[];if(t.shaderID?s.push(t.shaderID):(s.push(t.customVertexShaderID),s.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)s.push(e),s.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(i=s,r=t,i.push(r.precision),i.push(r.outputColorSpace),i.push(r.envMapMode),i.push(r.envMapCubeUVHeight),i.push(r.mapUv),i.push(r.alphaMapUv),i.push(r.lightMapUv),i.push(r.aoMapUv),i.push(r.bumpMapUv),i.push(r.normalMapUv),i.push(r.displacementMapUv),i.push(r.emissiveMapUv),i.push(r.metalnessMapUv),i.push(r.roughnessMapUv),i.push(r.anisotropyMapUv),i.push(r.clearcoatMapUv),i.push(r.clearcoatNormalMapUv),i.push(r.clearcoatRoughnessMapUv),i.push(r.iridescenceMapUv),i.push(r.iridescenceThicknessMapUv),i.push(r.sheenColorMapUv),i.push(r.sheenRoughnessMapUv),i.push(r.specularMapUv),i.push(r.specularColorMapUv),i.push(r.specularIntensityMapUv),i.push(r.transmissionMapUv),i.push(r.thicknessMapUv),i.push(r.combine),i.push(r.fogExp2),i.push(r.sizeAttenuation),i.push(r.morphTargetsCount),i.push(r.morphAttributeCount),i.push(r.numDirLights),i.push(r.numPointLights),i.push(r.numSpotLights),i.push(r.numSpotLightMaps),i.push(r.numHemiLights),i.push(r.numRectAreaLights),i.push(r.numDirLightShadows),i.push(r.numPointLightShadows),i.push(r.numSpotLightShadows),i.push(r.numSpotLightShadowsWithMaps),i.push(r.numLightProbes),i.push(r.shadowMapType),i.push(r.toneMapping),i.push(r.numClippingPlanes),i.push(r.numClipIntersection),i.push(r.depthPacking),n=s,a=t,o.disableAll(),a.instancing&&o.enable(0),a.instancingColor&&o.enable(1),a.instancingMorph&&o.enable(2),a.matcap&&o.enable(3),a.envMap&&o.enable(4),a.normalMapObjectSpace&&o.enable(5),a.normalMapTangentSpace&&o.enable(6),a.clearcoat&&o.enable(7),a.iridescence&&o.enable(8),a.alphaTest&&o.enable(9),a.vertexColors&&o.enable(10),a.vertexAlphas&&o.enable(11),a.vertexUv1s&&o.enable(12),a.vertexUv2s&&o.enable(13),a.vertexUv3s&&o.enable(14),a.vertexTangents&&o.enable(15),a.anisotropy&&o.enable(16),a.alphaHash&&o.enable(17),a.batching&&o.enable(18),a.dispersion&&o.enable(19),a.batchingColor&&o.enable(20),a.gradientMap&&o.enable(21),n.push(o.mask),o.disableAll(),a.fog&&o.enable(0),a.useFog&&o.enable(1),a.flatShading&&o.enable(2),a.logarithmicDepthBuffer&&o.enable(3),a.reversedDepthBuffer&&o.enable(4),a.skinning&&o.enable(5),a.morphTargets&&o.enable(6),a.morphNormals&&o.enable(7),a.morphColors&&o.enable(8),a.premultipliedAlpha&&o.enable(9),a.shadowMapEnabled&&o.enable(10),a.doubleSided&&o.enable(11),a.flipSided&&o.enable(12),a.useDepthPacking&&o.enable(13),a.dithering&&o.enable(14),a.transmission&&o.enable(15),a.sheen&&o.enable(16),a.opaque&&o.enable(17),a.pointsUvs&&o.enable(18),a.decodeVideoTexture&&o.enable(19),a.decodeVideoTextureEmissive&&o.enable(20),a.alphaToCoverage&&o.enable(21),n.push(o.mask),s.push(e.outputColorSpace)),s.push(t.customProgramCacheKey),s.join()},getUniforms:function(e){let t,i=A[e.type];return t=i?ns(l3[i].uniforms):e.uniforms},acquireProgram:function(t,i){let r=u.get(i);return void 0!==r?++r.usedTimes:(r=new cG(e,i,t,a),c.push(r),u.set(i,r)),r},releaseProgram:function(e){if(0==--e.usedTimes){let t=c.indexOf(e);c[t]=c[c.length-1],c.pop(),u.delete(e.cacheKey),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:c,dispose:function(){l.dispose()}}}function cq(){let e=new WeakMap;return{has:function(t){return e.has(t)},get:function(t){let i=e.get(t);return void 0===i&&(i={},e.set(t,i)),i},remove:function(t){e.delete(t)},update:function(t,i,r){e.get(t)[i]=r},dispose:function(){e=new WeakMap}}}function cj(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function cX(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function cY(){let e=[],t=0,i=[],r=[],n=[];function a(i,r,n,a,s,o){let l=e[t];return void 0===l?(l={id:i.id,object:i,geometry:r,material:n,groupOrder:a,renderOrder:i.renderOrder,z:s,group:o},e[t]=l):(l.id=i.id,l.object=i,l.geometry=r,l.material=n,l.groupOrder=a,l.renderOrder=i.renderOrder,l.z=s,l.group=o),t++,l}return{opaque:i,transmissive:r,transparent:n,init:function(){t=0,i.length=0,r.length=0,n.length=0},push:function(e,t,s,o,l,h){let c=a(e,t,s,o,l,h);s.transmission>0?r.push(c):!0===s.transparent?n.push(c):i.push(c)},unshift:function(e,t,s,o,l,h){let c=a(e,t,s,o,l,h);s.transmission>0?r.unshift(c):!0===s.transparent?n.unshift(c):i.unshift(c)},finish:function(){for(let i=t,r=e.length;i<r;i++){let t=e[i];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){i.length>1&&i.sort(e||cj),r.length>1&&r.sort(t||cX),n.length>1&&n.sort(t||cX)}}}function cK(){let e=new WeakMap;return{get:function(t,i){let r,n=e.get(t);return void 0===n?(r=new cY,e.set(t,[r])):i>=n.length?(r=new cY,n.push(r)):r=n[i],r},dispose:function(){e=new WeakMap}}}function cJ(){let e={};return{get:function(t){let i;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":i={direction:new it,color:new rP};break;case"SpotLight":i={position:new it,direction:new it,color:new rP,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new it,color:new rP,distance:0,decay:0};break;case"HemisphereLight":i={direction:new it,skyColor:new rP,groundColor:new rP};break;case"RectAreaLight":i={color:new rP,position:new it,halfWidth:new it,halfHeight:new it}}return e[t.id]=i,i}}}let c$=0;function cZ(e,t){return 2*!!t.castShadow-2*!!e.castShadow+ +!!t.map-!!e.map}function c0(e){let t,i=new cJ,r=(t={},{get:function(e){let i;if(void 0!==t[e.id])return t[e.id];switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new t7};break;case"PointLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new t7,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)n.probe.push(new it);let a=new it,s=new i$,o=new i$;return{setup:function(t){let a=0,s=0,o=0;for(let e=0;e<9;e++)n.probe[e].set(0,0,0);let l=0,h=0,c=0,u=0,d=0,p=0,A=0,f=0,g=0,m=0,v=0;t.sort(cZ);for(let e=0,b=t.length;e<b;e++){let b=t[e],y=b.color,x=b.intensity,_=b.distance,E=null;if(b.shadow&&b.shadow.map&&(E=1030===b.shadow.map.texture.format?b.shadow.map.texture:b.shadow.map.depthTexture||b.shadow.map.texture),b.isAmbientLight)a+=y.r*x,s+=y.g*x,o+=y.b*x;else if(b.isLightProbe){for(let e=0;e<9;e++)n.probe[e].addScaledVector(b.sh.coefficients[e],x);v++}else if(b.isDirectionalLight){let e=i.get(b);if(e.color.copy(b.color).multiplyScalar(b.intensity),b.castShadow){let e=b.shadow,t=r.get(b);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,n.directionalShadow[l]=t,n.directionalShadowMap[l]=E,n.directionalShadowMatrix[l]=b.shadow.matrix,p++}n.directional[l]=e,l++}else if(b.isSpotLight){let e=i.get(b);e.position.setFromMatrixPosition(b.matrixWorld),e.color.copy(y).multiplyScalar(x),e.distance=_,e.coneCos=Math.cos(b.angle),e.penumbraCos=Math.cos(b.angle*(1-b.penumbra)),e.decay=b.decay,n.spot[c]=e;let t=b.shadow;if(b.map&&(n.spotLightMap[g]=b.map,g++,t.updateMatrices(b),b.castShadow&&m++),n.spotLightMatrix[c]=t.matrix,b.castShadow){let e=r.get(b);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,n.spotShadow[c]=e,n.spotShadowMap[c]=E,f++}c++}else if(b.isRectAreaLight){let e=i.get(b);e.color.copy(y).multiplyScalar(x),e.halfWidth.set(.5*b.width,0,0),e.halfHeight.set(0,.5*b.height,0),n.rectArea[u]=e,u++}else if(b.isPointLight){let e=i.get(b);if(e.color.copy(b.color).multiplyScalar(b.intensity),e.distance=b.distance,e.decay=b.decay,b.castShadow){let e=b.shadow,t=r.get(b);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,n.pointShadow[h]=t,n.pointShadowMap[h]=E,n.pointShadowMatrix[h]=b.shadow.matrix,A++}n.point[h]=e,h++}else if(b.isHemisphereLight){let e=i.get(b);e.skyColor.copy(b.color).multiplyScalar(x),e.groundColor.copy(b.groundColor).multiplyScalar(x),n.hemi[d]=e,d++}}u>0&&(!0===e.has("OES_texture_float_linear")?(n.rectAreaLTC1=l2.LTC_FLOAT_1,n.rectAreaLTC2=l2.LTC_FLOAT_2):(n.rectAreaLTC1=l2.LTC_HALF_1,n.rectAreaLTC2=l2.LTC_HALF_2)),n.ambient[0]=a,n.ambient[1]=s,n.ambient[2]=o;let b=n.hash;(b.directionalLength!==l||b.pointLength!==h||b.spotLength!==c||b.rectAreaLength!==u||b.hemiLength!==d||b.numDirectionalShadows!==p||b.numPointShadows!==A||b.numSpotShadows!==f||b.numSpotMaps!==g||b.numLightProbes!==v)&&(n.directional.length=l,n.spot.length=c,n.rectArea.length=u,n.point.length=h,n.hemi.length=d,n.directionalShadow.length=p,n.directionalShadowMap.length=p,n.pointShadow.length=A,n.pointShadowMap.length=A,n.spotShadow.length=f,n.spotShadowMap.length=f,n.directionalShadowMatrix.length=p,n.pointShadowMatrix.length=A,n.spotLightMatrix.length=f+g-m,n.spotLightMap.length=g,n.numSpotLightShadowsWithMaps=m,n.numLightProbes=v,b.directionalLength=l,b.pointLength=h,b.spotLength=c,b.rectAreaLength=u,b.hemiLength=d,b.numDirectionalShadows=p,b.numPointShadows=A,b.numSpotShadows=f,b.numSpotMaps=g,b.numLightProbes=v,n.version=c$++)},setupView:function(e,t){let i=0,r=0,l=0,h=0,c=0,u=t.matrixWorldInverse;for(let t=0,d=e.length;t<d;t++){let d=e[t];if(d.isDirectionalLight){let e=n.directional[i];e.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(a),e.direction.transformDirection(u),i++}else if(d.isSpotLight){let e=n.spot[l];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),e.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(a),e.direction.transformDirection(u),l++}else if(d.isRectAreaLight){let e=n.rectArea[h];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),o.identity(),s.copy(d.matrixWorld),s.premultiply(u),o.extractRotation(s),e.halfWidth.set(.5*d.width,0,0),e.halfHeight.set(0,.5*d.height,0),e.halfWidth.applyMatrix4(o),e.halfHeight.applyMatrix4(o),h++}else if(d.isPointLight){let e=n.point[r];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),r++}else if(d.isHemisphereLight){let e=n.hemi[c];e.direction.setFromMatrixPosition(d.matrixWorld),e.direction.transformDirection(u),c++}}},state:n}}function c1(e){let t=new c0(e),i=[],r=[],n={lightsArray:i,shadowsArray:r,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function(e){n.camera=e,i.length=0,r.length=0},state:n,setupLights:function(){t.setup(i)},setupLightsView:function(e){t.setupView(i,e)},pushLight:function(e){i.push(e)},pushShadow:function(e){r.push(e)}}}function c2(e){let t=new WeakMap;return{get:function(i,r=0){let n,a=t.get(i);return void 0===a?(n=new c1(e),t.set(i,[n])):r>=a.length?(n=new c1(e),a.push(n)):n=a[r],n},dispose:function(){t=new WeakMap}}}let c3=[new it(1,0,0),new it(-1,0,0),new it(0,1,0),new it(0,-1,0),new it(0,0,1),new it(0,0,-1)],c4=[new it(0,-1,0),new it(0,-1,0),new it(0,0,1),new it(0,0,-1),new it(0,-1,0),new it(0,-1,0)],c5=new i$,c8=new it,c9=new it;function c6(e,t,i){let r=new n2,n=new t7,a=new t7,s=new iy,o=new sr,l=new sn,h={},c=i.maxTextureSize,u={0:1,1:0,2:2},d=new nh({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new t7},radius:{value:4}},vertexShader:"void main() {\n gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\n gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;let A=new r1;A.setAttribute("position",new rV(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let f=new nr(A,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let m=this.type;function v(t,i,r,n){let a=null,s=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===r.isPointLight?l:o,e.localClippingEnabled&&!0===i.clipShadows&&Array.isArray(i.clippingPlanes)&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0||i.map&&i.alphaTest>0||!0===i.alphaToCoverage){let e=a.uuid,t=i.uuid,r=h[e];void 0===r&&(r={},h[e]=r);let n=r[t];void 0===n&&(n=a.clone(),r[t]=n,i.addEventListener("dispose",b)),a=n}return a.visible=i.visible,a.wireframe=i.wireframe,3===n?a.side=null!==i.shadowSide?i.shadowSide:i.side:a.side=null!==i.shadowSide?i.shadowSide:u[i.side],a.alphaMap=i.alphaMap,a.alphaTest=!0===i.alphaToCoverage?.5:i.alphaTest,a.map=i.map,a.clipShadows=i.clipShadows,a.clippingPlanes=i.clippingPlanes,a.clipIntersection=i.clipIntersection,a.displacementMap=i.displacementMap,a.displacementScale=i.displacementScale,a.displacementBias=i.displacementBias,a.wireframeLinewidth=i.wireframeLinewidth,a.linewidth=i.linewidth,!0===r.isPointLight&&!0===a.isMeshDistanceMaterial&&(e.properties.get(a).light=r),a}function b(e){for(let t in e.target.removeEventListener("dispose",b),h){let i=h[t],r=e.target.uuid;r in i&&(i[r].dispose(),delete i[r])}}this.render=function(i,o,l){if(!1===g.enabled||!1===g.autoUpdate&&!1===g.needsUpdate||0===i.length)return;2===i.type&&(t$("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),i.type=1);let h=e.getRenderTarget(),u=e.getActiveCubeFace(),A=e.getActiveMipmapLevel(),b=e.state;b.setBlending(0),!0===b.buffers.depth.getReversed()?b.buffers.color.setClear(0,0,0,0):b.buffers.color.setClear(1,1,1,1),b.buffers.depth.setTest(!0),b.setScissorTest(!1);let y=m!==this.type;y&&o.traverse(function(e){e.material&&(Array.isArray(e.material)?e.material.forEach(e=>e.needsUpdate=!0):e.material.needsUpdate=!0)});for(let h=0,u=i.length;h<u;h++){let u=i[h],A=u.shadow;if(void 0===A){t$("WebGLShadowMap:",u,"has no shadow.");continue}if(!1===A.autoUpdate&&!1===A.needsUpdate)continue;n.copy(A.mapSize);let g=A.getFrameExtents();if(n.multiply(g),a.copy(A.mapSize),(n.x>c||n.y>c)&&(n.x>c&&(a.x=Math.floor(c/g.x),n.x=a.x*g.x,A.mapSize.x=a.x),n.y>c&&(a.y=Math.floor(c/g.y),n.y=a.y*g.y,A.mapSize.y=a.y)),null===A.map||!0===y){if(null!==A.map&&(null!==A.map.depthTexture&&(A.map.depthTexture.dispose(),A.map.depthTexture=null),A.map.dispose()),3===this.type){if(u.isPointLight){t$("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}A.map=new i_(n.x,n.y,{format:1030,type:1016,minFilter:1006,magFilter:1006,generateMipmaps:!1}),A.map.texture.name=u.name+".shadowMap",A.map.depthTexture=new ab(n.x,n.y,1015),A.map.depthTexture.name=u.name+".shadowMapDepth",A.map.depthTexture.format=1026,A.map.depthTexture.compareFunction=null,A.map.depthTexture.minFilter=1003,A.map.depthTexture.magFilter=1003}else{u.isPointLight?(A.map=new nm(n.x),A.map.depthTexture=new ay(n.x,1014)):(A.map=new i_(n.x,n.y),A.map.depthTexture=new ab(n.x,n.y,1014)),A.map.depthTexture.name=u.name+".shadowMap",A.map.depthTexture.format=1026;let t=e.state.buffers.depth.getReversed();1===this.type?(A.map.depthTexture.compareFunction=t?518:515,A.map.depthTexture.minFilter=1006,A.map.depthTexture.magFilter=1006):(A.map.depthTexture.compareFunction=null,A.map.depthTexture.minFilter=1003,A.map.depthTexture.magFilter=1003)}A.camera.updateProjectionMatrix()}let m=A.map.isWebGLCubeRenderTarget?6:1;for(let i=0;i<m;i++){if(A.map.isWebGLCubeRenderTarget)e.setRenderTarget(A.map,i),e.clear();else{0===i&&(e.setRenderTarget(A.map),e.clear());let t=A.getViewport(i);s.set(a.x*t.x,a.y*t.y,a.x*t.z,a.y*t.w),b.viewport(s)}if(u.isPointLight){let e=A.camera,t=A.matrix,r=u.distance||e.far;r!==e.far&&(e.far=r,e.updateProjectionMatrix()),c8.setFromMatrixPosition(u.matrixWorld),e.position.copy(c8),c9.copy(e.position),c9.add(c3[i]),e.up.copy(c4[i]),e.lookAt(c9),e.updateMatrixWorld(),t.makeTranslation(-c8.x,-c8.y,-c8.z),c5.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),A._frustum.setFromProjectionMatrix(c5,e.coordinateSystem,e.reversedDepth)}else A.updateMatrices(u);r=A.getFrustum(),function i(n,a,s,o,l){if(!1===n.visible)return;if(n.layers.test(a.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===l)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);let i=t.update(n),r=n.material;if(Array.isArray(r)){let t=i.groups;for(let h=0,c=t.length;h<c;h++){let c=t[h],u=r[c.materialIndex];if(u&&u.visible){let t=v(n,u,o,l);n.onBeforeShadow(e,n,a,s,i,t,c),e.renderBufferDirect(s,null,i,t,n,c),n.onAfterShadow(e,n,a,s,i,t,c)}}}else if(r.visible){let t=v(n,r,o,l);n.onBeforeShadow(e,n,a,s,i,t,null),e.renderBufferDirect(s,null,i,t,n,null),n.onAfterShadow(e,n,a,s,i,t,null)}}let h=n.children;for(let e=0,t=h.length;e<t;e++)i(h[e],a,s,o,l)}(o,l,A.camera,u,this.type)}!0!==A.isPointLightShadow&&3===this.type&&function(i,r){let a=t.update(f);d.defines.VSM_SAMPLES!==i.blurSamples&&(d.defines.VSM_SAMPLES=i.blurSamples,p.defines.VSM_SAMPLES=i.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new i_(n.x,n.y,{format:1030,type:1016})),d.uniforms.shadow_pass.value=i.map.depthTexture,d.uniforms.resolution.value=i.mapSize,d.uniforms.radius.value=i.radius,e.setRenderTarget(i.mapPass),e.clear(),e.renderBufferDirect(r,null,a,d,f,null),p.uniforms.shadow_pass.value=i.mapPass.texture,p.uniforms.resolution.value=i.mapSize,p.uniforms.radius.value=i.radius,e.setRenderTarget(i.map),e.clear(),e.renderBufferDirect(r,null,a,p,f,null)}(A,l),A.needsUpdate=!1}m=this.type,g.needsUpdate=!1,e.setRenderTarget(h,u,A)}}let c7={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3};function ue(e,t){let i=new function(){let t=!1,i=new iy,r=null,n=new iy(0,0,0,0);return{setMask:function(i){r===i||t||(e.colorMask(i,i,i,i),r=i)},setLocked:function(e){t=e},setClear:function(t,r,a,s,o){!0===o&&(t*=s,r*=s,a*=s),i.set(t,r,a,s),!1===n.equals(i)&&(e.clearColor(t,r,a,s),n.copy(i))},reset:function(){t=!1,r=null,n.set(-1,0,0,0)}}},r=new function(){let i=!1,r=!1,n=null,a=null,s=null;return{setReversed:function(e){if(r!==e){let i=t.get("EXT_clip_control");e?i.clipControlEXT(i.LOWER_LEFT_EXT,i.ZERO_TO_ONE_EXT):i.clipControlEXT(i.LOWER_LEFT_EXT,i.NEGATIVE_ONE_TO_ONE_EXT),r=e;let n=s;s=null,this.setClear(n)}},getReversed:function(){return r},setTest:function(t){t?k(e.DEPTH_TEST):Q(e.DEPTH_TEST)},setMask:function(t){n===t||i||(e.depthMask(t),n=t)},setFunc:function(t){if(r&&(t=c7[t]),a!==t){switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:default:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL)}a=t}},setLocked:function(e){i=e},setClear:function(t){s!==t&&(r&&(t=1-t),e.clearDepth(t),s=t)},reset:function(){i=!1,n=null,a=null,s=null,r=!1}}},n=new function(){let t=!1,i=null,r=null,n=null,a=null,s=null,o=null,l=null,h=null;return{setTest:function(i){t||(i?k(e.STENCIL_TEST):Q(e.STENCIL_TEST))},setMask:function(r){i===r||t||(e.stencilMask(r),i=r)},setFunc:function(t,i,s){(r!==t||n!==i||a!==s)&&(e.stencilFunc(t,i,s),r=t,n=i,a=s)},setOp:function(t,i,r){(s!==t||o!==i||l!==r)&&(e.stencilOp(t,i,r),s=t,o=i,l=r)},setLocked:function(e){t=e},setClear:function(t){h!==t&&(e.clearStencil(t),h=t)},reset:function(){t=!1,i=null,r=null,n=null,a=null,s=null,o=null,l=null,h=null}}},a=new WeakMap,s=new WeakMap,o={},l={},h=new WeakMap,c=[],u=null,d=!1,p=null,A=null,f=null,g=null,m=null,v=null,b=null,y=new rP(0,0,0),x=0,_=!1,E=null,S=null,C=null,M=null,w=null,I=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),T=!1,B=e.getParameter(e.VERSION);-1!==B.indexOf("WebGL")?T=parseFloat(/^WebGL (\d)/.exec(B)[1])>=1:-1!==B.indexOf("OpenGL ES")&&(T=parseFloat(/^OpenGL ES (\d)/.exec(B)[1])>=2);let R=null,D={},L=e.getParameter(e.SCISSOR_BOX),P=e.getParameter(e.VIEWPORT),U=new iy().fromArray(L),F=new iy().fromArray(P);function N(t,i,r,n){let a=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let s=0;s<r;s++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(i,0,e.RGBA,1,1,n,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(i+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return s}let O={};function k(t){!0!==o[t]&&(e.enable(t),o[t]=!0)}function Q(t){!1!==o[t]&&(e.disable(t),o[t]=!1)}O[e.TEXTURE_2D]=N(e.TEXTURE_2D,e.TEXTURE_2D,1),O[e.TEXTURE_CUBE_MAP]=N(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),O[e.TEXTURE_2D_ARRAY]=N(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),O[e.TEXTURE_3D]=N(e.TEXTURE_3D,e.TEXTURE_3D,1,1),i.setClear(0,0,0,1),r.setClear(1),n.setClear(0),k(e.DEPTH_TEST),r.setFunc(3),V(!1),W(1),k(e.CULL_FACE),z(0);let G={100:e.FUNC_ADD,101:e.FUNC_SUBTRACT,102:e.FUNC_REVERSE_SUBTRACT};G[103]=e.MIN,G[104]=e.MAX;let H={200:e.ZERO,201:e.ONE,202:e.SRC_COLOR,204:e.SRC_ALPHA,210:e.SRC_ALPHA_SATURATE,208:e.DST_COLOR,206:e.DST_ALPHA,203:e.ONE_MINUS_SRC_COLOR,205:e.ONE_MINUS_SRC_ALPHA,209:e.ONE_MINUS_DST_COLOR,207:e.ONE_MINUS_DST_ALPHA,211:e.CONSTANT_COLOR,212:e.ONE_MINUS_CONSTANT_COLOR,213:e.CONSTANT_ALPHA,214:e.ONE_MINUS_CONSTANT_ALPHA};function z(t,i,r,n,a,s,o,l,h,c){if(0===t){!0===d&&(Q(e.BLEND),d=!1);return}if(!1===d&&(k(e.BLEND),d=!0),5!==t){if(t!==p||c!==_){if((100!==A||100!==m)&&(e.blendEquation(e.FUNC_ADD),A=100,m=100),c)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:tZ("WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case 3:tZ("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case 4:tZ("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:tZ("WebGLState: Invalid blending: ",t)}f=null,g=null,v=null,b=null,y.set(0,0,0),x=0,p=t,_=c}return}a=a||i,s=s||r,o=o||n,(i!==A||a!==m)&&(e.blendEquationSeparate(G[i],G[a]),A=i,m=a),(r!==f||n!==g||s!==v||o!==b)&&(e.blendFuncSeparate(H[r],H[n],H[s],H[o]),f=r,g=n,v=s,b=o),(!1===l.equals(y)||h!==x)&&(e.blendColor(l.r,l.g,l.b,h),y.copy(l),x=h),p=t,_=!1}function V(t){E!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),E=t)}function W(t){0!==t?(k(e.CULL_FACE),t!==S&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):Q(e.CULL_FACE),S=t}function q(t,i,r){t?(k(e.POLYGON_OFFSET_FILL),(M!==i||w!==r)&&(e.polygonOffset(i,r),M=i,w=r)):Q(e.POLYGON_OFFSET_FILL)}return{buffers:{color:i,depth:r,stencil:n},enable:k,disable:Q,bindFramebuffer:function(t,i){return l[t]!==i&&(e.bindFramebuffer(t,i),l[t]=i,t===e.DRAW_FRAMEBUFFER&&(l[e.FRAMEBUFFER]=i),t===e.FRAMEBUFFER&&(l[e.DRAW_FRAMEBUFFER]=i),!0)},drawBuffers:function(t,i){let r=c,n=!1;if(t){void 0===(r=h.get(i))&&(r=[],h.set(i,r));let a=t.textures;if(r.length!==a.length||r[0]!==e.COLOR_ATTACHMENT0){for(let t=0,i=a.length;t<i;t++)r[t]=e.COLOR_ATTACHMENT0+t;r.length=a.length,n=!0}}else r[0]!==e.BACK&&(r[0]=e.BACK,n=!0);n&&e.drawBuffers(r)},useProgram:function(t){return u!==t&&(e.useProgram(t),u=t,!0)},setBlending:z,setMaterial:function(t,a){2===t.side?Q(e.CULL_FACE):k(e.CULL_FACE);let s=1===t.side;a&&(s=!s),V(s),1===t.blending&&!1===t.transparent?z(0):z(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.blendColor,t.blendAlpha,t.premultipliedAlpha),r.setFunc(t.depthFunc),r.setTest(t.depthTest),r.setMask(t.depthWrite),i.setMask(t.colorWrite);let o=t.stencilWrite;n.setTest(o),o&&(n.setMask(t.stencilWriteMask),n.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),n.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),q(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?k(e.SAMPLE_ALPHA_TO_COVERAGE):Q(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:V,setCullFace:W,setLineWidth:function(t){t!==C&&(T&&e.lineWidth(t),C=t)},setPolygonOffset:q,setScissorTest:function(t){t?k(e.SCISSOR_TEST):Q(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+I-1),R!==t&&(e.activeTexture(t),R=t)},bindTexture:function(t,i,r){void 0===r&&(r=null===R?e.TEXTURE0+I-1:R);let n=D[r];void 0===n&&(n={type:void 0,texture:void 0},D[r]=n),(n.type!==t||n.texture!==i)&&(R!==r&&(e.activeTexture(r),R=r),e.bindTexture(t,i||O[t]),n.type=t,n.texture=i)},unbindTexture:function(){let t=D[R];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D(...arguments)}catch(e){tZ("WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D(...arguments)}catch(e){tZ("WebGLState:",e)}},texImage2D:function(){try{e.texImage2D(...arguments)}catch(e){tZ("WebGLState:",e)}},texImage3D:function(){try{e.texImage3D(...arguments)}catch(e){tZ("WebGLState:",e)}},updateUBOMapping:function(t,i){let r=s.get(i);void 0===r&&(r=new WeakMap,s.set(i,r));let n=r.get(t);void 0===n&&(n=e.getUniformBlockIndex(i,t.name),r.set(t,n))},uniformBlockBinding:function(t,i){let r=s.get(i).get(t);a.get(i)!==r&&(e.uniformBlockBinding(i,r,t.__bindingPointIndex),a.set(i,r))},texStorage2D:function(){try{e.texStorage2D(...arguments)}catch(e){tZ("WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D(...arguments)}catch(e){tZ("WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D(...arguments)}catch(e){tZ("WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D(...arguments)}catch(e){tZ("WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D(...arguments)}catch(e){tZ("WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D(...arguments)}catch(e){tZ("WebGLState:",e)}},scissor:function(t){!1===U.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),U.copy(t))},viewport:function(t){!1===F.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),F.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),r.setReversed(!1),e.clearDepth(1),e.stencilMask(0xffffffff),e.stencilFunc(e.ALWAYS,0,0xffffffff),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),o={},R=null,D={},l={},h=new WeakMap,c=[],u=null,d=!1,p=null,A=null,f=null,g=null,m=null,v=null,b=null,y=new rP(0,0,0),x=0,_=!1,E=null,S=null,C=null,M=null,w=null,U.set(0,0,e.canvas.width,e.canvas.height),F.set(0,0,e.canvas.width,e.canvas.height),i.reset(),r.reset(),n.reset()}}}function ut(e,t,i,r,n,a,s){let o,l=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,h="u">typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new t7,u=new WeakMap,d=new WeakMap,p=!1;try{p="u">typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function A(e,t){return p?new OffscreenCanvas(e,t):tY("canvas")}function f(e,t,i){let r=1,n=H(e);if((n.width>i||n.height>i)&&(r=i/Math.max(n.width,n.height)),r<1)if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof VideoFrame&&e instanceof VideoFrame){let i=Math.floor(r*n.width),a=Math.floor(r*n.height);void 0===o&&(o=A(i,a));let s=t?A(i,a):o;return s.width=i,s.height=a,s.getContext("2d").drawImage(e,0,0,i,a),t$("WebGLRenderer: Texture has been resized from ("+n.width+"x"+n.height+") to ("+i+"x"+a+")."),s}else"data"in e&&t$("WebGLRenderer: Image in DataTexture is too big ("+n.width+"x"+n.height+").");return e}function g(e){return e.generateMipmaps}function m(t){e.generateMipmap(t)}function v(i,r,n,a,s=!1){if(null!==i){if(void 0!==e[i])return e[i];t$("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let o=r;if(r===e.RED&&(n===e.FLOAT&&(o=e.R32F),n===e.HALF_FLOAT&&(o=e.R16F),n===e.UNSIGNED_BYTE&&(o=e.R8)),r===e.RED_INTEGER&&(n===e.UNSIGNED_BYTE&&(o=e.R8UI),n===e.UNSIGNED_SHORT&&(o=e.R16UI),n===e.UNSIGNED_INT&&(o=e.R32UI),n===e.BYTE&&(o=e.R8I),n===e.SHORT&&(o=e.R16I),n===e.INT&&(o=e.R32I)),r===e.RG&&(n===e.FLOAT&&(o=e.RG32F),n===e.HALF_FLOAT&&(o=e.RG16F),n===e.UNSIGNED_BYTE&&(o=e.RG8)),r===e.RG_INTEGER&&(n===e.UNSIGNED_BYTE&&(o=e.RG8UI),n===e.UNSIGNED_SHORT&&(o=e.RG16UI),n===e.UNSIGNED_INT&&(o=e.RG32UI),n===e.BYTE&&(o=e.RG8I),n===e.SHORT&&(o=e.RG16I),n===e.INT&&(o=e.RG32I)),r===e.RGB_INTEGER&&(n===e.UNSIGNED_BYTE&&(o=e.RGB8UI),n===e.UNSIGNED_SHORT&&(o=e.RGB16UI),n===e.UNSIGNED_INT&&(o=e.RGB32UI),n===e.BYTE&&(o=e.RGB8I),n===e.SHORT&&(o=e.RGB16I),n===e.INT&&(o=e.RGB32I)),r===e.RGBA_INTEGER&&(n===e.UNSIGNED_BYTE&&(o=e.RGBA8UI),n===e.UNSIGNED_SHORT&&(o=e.RGBA16UI),n===e.UNSIGNED_INT&&(o=e.RGBA32UI),n===e.BYTE&&(o=e.RGBA8I),n===e.SHORT&&(o=e.RGBA16I),n===e.INT&&(o=e.RGBA32I)),r===e.RGB&&(n===e.UNSIGNED_INT_5_9_9_9_REV&&(o=e.RGB9_E5),n===e.UNSIGNED_INT_10F_11F_11F_REV&&(o=e.R11F_G11F_B10F)),r===e.RGBA){let t=s?"linear":ih.getTransfer(a);n===e.FLOAT&&(o=e.RGBA32F),n===e.HALF_FLOAT&&(o=e.RGBA16F),n===e.UNSIGNED_BYTE&&(o="srgb"===t?e.SRGB8_ALPHA8:e.RGBA8),n===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),n===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)}return(o===e.R16F||o===e.R32F||o===e.RG16F||o===e.RG32F||o===e.RGBA16F||o===e.RGBA32F)&&t.get("EXT_color_buffer_float"),o}function b(t,i){let r;return t?null===i||1014===i||1020===i?r=e.DEPTH24_STENCIL8:1015===i?r=e.DEPTH32F_STENCIL8:1012===i&&(r=e.DEPTH24_STENCIL8,t$("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===i||1014===i||1020===i?r=e.DEPTH_COMPONENT24:1015===i?r=e.DEPTH_COMPONENT32F:1012===i&&(r=e.DEPTH_COMPONENT16),r}function y(e,t){return!0===g(e)||e.isFramebufferTexture&&1003!==e.minFilter&&1006!==e.minFilter?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function x(e){let t=e.target;t.removeEventListener("dispose",x),function(e){let t=r.get(e);if(void 0===t.__webglInit)return;let i=e.source,n=d.get(i);if(n){let r=n[t.__cacheKey];r.usedTimes--,0===r.usedTimes&&E(e),0===Object.keys(n).length&&d.delete(i)}r.remove(e)}(t),t.isVideoTexture&&u.delete(t)}function _(t){let i=t.target;i.removeEventListener("dispose",_),function(t){let i=r.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(i.__webglFramebuffer[t]))for(let r=0;r<i.__webglFramebuffer[t].length;r++)e.deleteFramebuffer(i.__webglFramebuffer[t][r]);else e.deleteFramebuffer(i.__webglFramebuffer[t]);i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[t])}else{if(Array.isArray(i.__webglFramebuffer))for(let t=0;t<i.__webglFramebuffer.length;t++)e.deleteFramebuffer(i.__webglFramebuffer[t]);else e.deleteFramebuffer(i.__webglFramebuffer);if(i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&e.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(let t=0;t<i.__webglColorRenderbuffer.length;t++)i.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(i.__webglColorRenderbuffer[t]);i.__webglDepthRenderbuffer&&e.deleteRenderbuffer(i.__webglDepthRenderbuffer)}let n=t.textures;for(let t=0,i=n.length;t<i;t++){let i=r.get(n[t]);i.__webglTexture&&(e.deleteTexture(i.__webglTexture),s.memory.textures--),r.remove(n[t])}r.remove(t)}(i)}function E(t){let i=r.get(t);e.deleteTexture(i.__webglTexture);let n=t.source,a=d.get(n);delete a[i.__cacheKey],s.memory.textures--}let S=0;function C(t,n){var a;let o,l=r.get(t);if(t.isVideoTexture&&(a=t,o=s.render.frame,u.get(a)!==o&&(u.set(a,o),a.update())),!1===t.isRenderTargetTexture&&!0!==t.isExternalTexture&&t.version>0&&l.__version!==t.version){let e=t.image;if(null===e)t$("WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void D(l,t,n);t$("WebGLRenderer: Texture marked for update but image is incomplete")}}else t.isExternalTexture&&(l.__webglTexture=t.sourceTexture?t.sourceTexture:null);i.bindTexture(e.TEXTURE_2D,l.__webglTexture,e.TEXTURE0+n)}let M={1e3:e.REPEAT,1001:e.CLAMP_TO_EDGE,1002:e.MIRRORED_REPEAT},w={1003:e.NEAREST,1004:e.NEAREST_MIPMAP_NEAREST,1005:e.NEAREST_MIPMAP_LINEAR,1006:e.LINEAR,1007:e.LINEAR_MIPMAP_NEAREST,1008:e.LINEAR_MIPMAP_LINEAR},I={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function T(i,a){if((1015===a.type&&!1===t.has("OES_texture_float_linear")&&(1006===a.magFilter||1007===a.magFilter||1005===a.magFilter||1008===a.magFilter||1006===a.minFilter||1007===a.minFilter||1005===a.minFilter||1008===a.minFilter)&&t$("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(i,e.TEXTURE_WRAP_S,M[a.wrapS]),e.texParameteri(i,e.TEXTURE_WRAP_T,M[a.wrapT]),(i===e.TEXTURE_3D||i===e.TEXTURE_2D_ARRAY)&&e.texParameteri(i,e.TEXTURE_WRAP_R,M[a.wrapR]),e.texParameteri(i,e.TEXTURE_MAG_FILTER,w[a.magFilter]),e.texParameteri(i,e.TEXTURE_MIN_FILTER,w[a.minFilter]),a.compareFunction&&(e.texParameteri(i,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(i,e.TEXTURE_COMPARE_FUNC,I[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic"))&&1003!==a.magFilter&&(1005===a.minFilter||1008===a.minFilter)&&(1015!==a.type||!1!==t.has("OES_texture_float_linear"))&&(a.anisotropy>1||r.get(a).__currentAnisotropy)){let s=t.get("EXT_texture_filter_anisotropic");e.texParameterf(i,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,n.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy}}function B(t,i){let r,n=!1;void 0===t.__webglInit&&(t.__webglInit=!0,i.addEventListener("dispose",x));let a=i.source,o=d.get(a);void 0===o&&(o={},d.set(a,o));let l=((r=[]).push(i.wrapS),r.push(i.wrapT),r.push(i.wrapR||0),r.push(i.magFilter),r.push(i.minFilter),r.push(i.anisotropy),r.push(i.internalFormat),r.push(i.format),r.push(i.type),r.push(i.generateMipmaps),r.push(i.premultiplyAlpha),r.push(i.flipY),r.push(i.unpackAlignment),r.push(i.colorSpace),r.join());if(l!==t.__cacheKey){void 0===o[l]&&(o[l]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,n=!0),o[l].usedTimes++;let r=o[t.__cacheKey];void 0!==r&&(o[t.__cacheKey].usedTimes--,0===r.usedTimes&&E(i)),t.__cacheKey=l,t.__webglTexture=o[l].texture}return n}function R(e,t,i){return Math.floor(Math.floor(e/i)/t)}function D(t,s,o){let l=e.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),s.isData3DTexture&&(l=e.TEXTURE_3D);let h=B(t,s),c=s.source;i.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);let u=r.get(c);if(c.version!==u.__version||!0===h){let t;i.activeTexture(e.TEXTURE0+o);let r=ih.getPrimaries(ih.workingColorSpace),d=""===s.colorSpace?null:ih.getPrimaries(s.colorSpace),p=""===s.colorSpace||r===d?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);let A=f(s.image,!1,n.maxTextureSize);A=G(s,A);let x=a.convert(s.format,s.colorSpace),_=a.convert(s.type),E=v(s.internalFormat,x,_,s.colorSpace,s.isVideoTexture);T(l,s);let S=s.mipmaps,C=!0!==s.isVideoTexture,M=void 0===u.__version||!0===h,w=c.dataReady,I=y(s,A);if(s.isDepthTexture)E=b(1027===s.format,s.type),M&&(C?i.texStorage2D(e.TEXTURE_2D,1,E,A.width,A.height):i.texImage2D(e.TEXTURE_2D,0,E,A.width,A.height,0,x,_,null));else if(s.isDataTexture)if(S.length>0){C&&M&&i.texStorage2D(e.TEXTURE_2D,I,E,S[0].width,S[0].height);for(let r=0,n=S.length;r<n;r++)t=S[r],C?w&&i.texSubImage2D(e.TEXTURE_2D,r,0,0,t.width,t.height,x,_,t.data):i.texImage2D(e.TEXTURE_2D,r,E,t.width,t.height,0,x,_,t.data);s.generateMipmaps=!1}else C?(M&&i.texStorage2D(e.TEXTURE_2D,I,E,A.width,A.height),w&&function(t,r,n,a){let s=t.updateRanges;if(0===s.length)i.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,n,a,r.data);else{s.sort((e,t)=>e.start-t.start);let o=0;for(let e=1;e<s.length;e++){let t=s[o],i=s[e],n=t.start+t.count,a=R(i.start,r.width,4),l=R(t.start,r.width,4);i.start<=n+1&&a===l&&R(i.start+i.count-1,r.width,4)===a?t.count=Math.max(t.count,i.start+i.count-t.start):s[++o]=i}s.length=o+1;let l=e.getParameter(e.UNPACK_ROW_LENGTH),h=e.getParameter(e.UNPACK_SKIP_PIXELS),c=e.getParameter(e.UNPACK_SKIP_ROWS);e.pixelStorei(e.UNPACK_ROW_LENGTH,r.width);for(let t=0,o=s.length;t<o;t++){let o=s[t],l=Math.floor(o.start/4),h=Math.ceil(o.count/4),c=l%r.width,u=Math.floor(l/r.width);e.pixelStorei(e.UNPACK_SKIP_PIXELS,c),e.pixelStorei(e.UNPACK_SKIP_ROWS,u),i.texSubImage2D(e.TEXTURE_2D,0,c,u,h,1,n,a,r.data)}t.clearUpdateRanges(),e.pixelStorei(e.UNPACK_ROW_LENGTH,l),e.pixelStorei(e.UNPACK_SKIP_PIXELS,h),e.pixelStorei(e.UNPACK_SKIP_ROWS,c)}}(s,A,x,_)):i.texImage2D(e.TEXTURE_2D,0,E,A.width,A.height,0,x,_,A.data);else if(s.isCompressedTexture)if(s.isCompressedArrayTexture){C&&M&&i.texStorage3D(e.TEXTURE_2D_ARRAY,I,E,S[0].width,S[0].height,A.depth);for(let r=0,n=S.length;r<n;r++)if(t=S[r],1023!==s.format)if(null!==x)if(C){if(w)if(s.layerUpdates.size>0){let n=ot(t.width,t.height,s.format,s.type);for(let a of s.layerUpdates){let s=t.data.subarray(a*n/t.data.BYTES_PER_ELEMENT,(a+1)*n/t.data.BYTES_PER_ELEMENT);i.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,a,t.width,t.height,1,x,s)}s.clearLayerUpdates()}else i.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,t.width,t.height,A.depth,x,t.data)}else i.compressedTexImage3D(e.TEXTURE_2D_ARRAY,r,E,t.width,t.height,A.depth,0,t.data,0,0);else t$("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else C?w&&i.texSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,t.width,t.height,A.depth,x,_,t.data):i.texImage3D(e.TEXTURE_2D_ARRAY,r,E,t.width,t.height,A.depth,0,x,_,t.data)}else{C&&M&&i.texStorage2D(e.TEXTURE_2D,I,E,S[0].width,S[0].height);for(let r=0,n=S.length;r<n;r++)t=S[r],1023!==s.format?null!==x?C?w&&i.compressedTexSubImage2D(e.TEXTURE_2D,r,0,0,t.width,t.height,x,t.data):i.compressedTexImage2D(e.TEXTURE_2D,r,E,t.width,t.height,0,t.data):t$("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):C?w&&i.texSubImage2D(e.TEXTURE_2D,r,0,0,t.width,t.height,x,_,t.data):i.texImage2D(e.TEXTURE_2D,r,E,t.width,t.height,0,x,_,t.data)}else if(s.isDataArrayTexture)if(C){if(M&&i.texStorage3D(e.TEXTURE_2D_ARRAY,I,E,A.width,A.height,A.depth),w)if(s.layerUpdates.size>0){let t=ot(A.width,A.height,s.format,s.type);for(let r of s.layerUpdates){let n=A.data.subarray(r*t/A.data.BYTES_PER_ELEMENT,(r+1)*t/A.data.BYTES_PER_ELEMENT);i.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,A.width,A.height,1,x,_,n)}s.clearLayerUpdates()}else i.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,A.width,A.height,A.depth,x,_,A.data)}else i.texImage3D(e.TEXTURE_2D_ARRAY,0,E,A.width,A.height,A.depth,0,x,_,A.data);else if(s.isData3DTexture)C?(M&&i.texStorage3D(e.TEXTURE_3D,I,E,A.width,A.height,A.depth),w&&i.texSubImage3D(e.TEXTURE_3D,0,0,0,0,A.width,A.height,A.depth,x,_,A.data)):i.texImage3D(e.TEXTURE_3D,0,E,A.width,A.height,A.depth,0,x,_,A.data);else if(s.isFramebufferTexture){if(M)if(C)i.texStorage2D(e.TEXTURE_2D,I,E,A.width,A.height);else{let t=A.width,r=A.height;for(let n=0;n<I;n++)i.texImage2D(e.TEXTURE_2D,n,E,t,r,0,x,_,null),t>>=1,r>>=1}}else if(S.length>0){if(C&&M){let t=H(S[0]);i.texStorage2D(e.TEXTURE_2D,I,E,t.width,t.height)}for(let r=0,n=S.length;r<n;r++)t=S[r],C?w&&i.texSubImage2D(e.TEXTURE_2D,r,0,0,x,_,t):i.texImage2D(e.TEXTURE_2D,r,E,x,_,t);s.generateMipmaps=!1}else if(C){if(M){let t=H(A);i.texStorage2D(e.TEXTURE_2D,I,E,t.width,t.height)}w&&i.texSubImage2D(e.TEXTURE_2D,0,0,0,x,_,A)}else i.texImage2D(e.TEXTURE_2D,0,E,x,_,A);g(s)&&m(l),u.__version=c.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}function L(t,n,s,o,h,c){let u=a.convert(s.format,s.colorSpace),d=a.convert(s.type),p=v(s.internalFormat,u,d,s.colorSpace),A=r.get(n),f=r.get(s);if(f.__renderTarget=n,!A.__hasExternalTextures){let t=Math.max(1,n.width>>c),r=Math.max(1,n.height>>c);h===e.TEXTURE_3D||h===e.TEXTURE_2D_ARRAY?i.texImage3D(h,c,p,t,r,n.depth,0,u,d,null):i.texImage2D(h,c,p,t,r,0,u,d,null)}i.bindFramebuffer(e.FRAMEBUFFER,t),Q(n)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,o,h,f.__webglTexture,0,k(n)):(h===e.TEXTURE_2D||h>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&h<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,o,h,f.__webglTexture,c),i.bindFramebuffer(e.FRAMEBUFFER,null)}function P(t,i,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),i.depthBuffer){let n=i.depthTexture,a=n&&n.isDepthTexture?n.type:null,s=b(i.stencilBuffer,a),o=i.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;Q(i)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,k(i),s,i.width,i.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,k(i),s,i.width,i.height):e.renderbufferStorage(e.RENDERBUFFER,s,i.width,i.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,o,e.RENDERBUFFER,t)}else{let t=i.textures;for(let n=0;n<t.length;n++){let s=t[n],o=a.convert(s.format,s.colorSpace),h=a.convert(s.type),c=v(s.internalFormat,o,h,s.colorSpace);Q(i)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,k(i),c,i.width,i.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,k(i),c,i.width,i.height):e.renderbufferStorage(e.RENDERBUFFER,c,i.width,i.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function U(t,n,s){let o=!0===n.isWebGLCubeRenderTarget;if(i.bindFramebuffer(e.FRAMEBUFFER,t),!(n.depthTexture&&n.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let h=r.get(n.depthTexture);if(h.__renderTarget=n,h.__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),o){if(void 0===h.__webglInit&&(h.__webglInit=!0,n.depthTexture.addEventListener("dispose",x)),void 0===h.__webglTexture){let t;h.__webglTexture=e.createTexture(),i.bindTexture(e.TEXTURE_CUBE_MAP,h.__webglTexture),T(e.TEXTURE_CUBE_MAP,n.depthTexture);let r=a.convert(n.depthTexture.format),s=a.convert(n.depthTexture.type);1026===n.depthTexture.format?t=e.DEPTH_COMPONENT24:1027===n.depthTexture.format&&(t=e.DEPTH24_STENCIL8);for(let i=0;i<6;i++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,t,n.width,n.height,0,r,s,null)}}else C(n.depthTexture,0);let c=h.__webglTexture,u=k(n),d=o?e.TEXTURE_CUBE_MAP_POSITIVE_X+s:e.TEXTURE_2D,p=1027===n.depthTexture.format?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(1026===n.depthTexture.format)Q(n)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,d,c,0,u):e.framebufferTexture2D(e.FRAMEBUFFER,p,d,c,0);else if(1027===n.depthTexture.format)Q(n)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,d,c,0,u):e.framebufferTexture2D(e.FRAMEBUFFER,p,d,c,0);else throw Error("Unknown depthTexture format")}function F(t){let n=r.get(t),a=!0===t.isWebGLCubeRenderTarget;if(n.__boundDepthTexture!==t.depthTexture){let e=t.depthTexture;if(n.__depthDisposeCallback&&n.__depthDisposeCallback(),e){let t=()=>{delete n.__boundDepthTexture,delete n.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),n.__depthDisposeCallback=t}n.__boundDepthTexture=e}if(t.depthTexture&&!n.__autoAllocateDepthBuffer)if(a)for(let e=0;e<6;e++)U(n.__webglFramebuffer[e],t,e);else{let e=t.texture.mipmaps;e&&e.length>0?U(n.__webglFramebuffer[0],t,0):U(n.__webglFramebuffer,t,0)}else if(a){n.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(i.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[r]),void 0===n.__webglDepthbuffer[r])n.__webglDepthbuffer[r]=e.createRenderbuffer(),P(n.__webglDepthbuffer[r],t,!1);else{let i=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=n.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,i,e.RENDERBUFFER,a)}}else{let r=t.texture.mipmaps;if(r&&r.length>0?i.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[0]):i.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer),void 0===n.__webglDepthbuffer)n.__webglDepthbuffer=e.createRenderbuffer(),P(n.__webglDepthbuffer,t,!1);else{let i=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=n.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,i,e.RENDERBUFFER,r)}}i.bindFramebuffer(e.FRAMEBUFFER,null)}let N=[],O=[];function k(e){return Math.min(n.maxSamples,e.samples)}function Q(e){let i=r.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function G(e,t){let i=e.colorSpace,r=e.format,n=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||i!==tW&&""!==i&&("srgb"===ih.getTransfer(i)?(1023!==r||1009!==n)&&t$("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):tZ("WebGLTextures: Unsupported texture color space:",i)),t}function H(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):"u">typeof VideoFrame&&e instanceof VideoFrame?(c.width=e.displayWidth,c.height=e.displayHeight):(c.width=e.width,c.height=e.height),c}this.allocateTextureUnit=function(){let e=S;return e>=n.maxTextures&&t$("WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+n.maxTextures),S+=1,e},this.resetTextureUnits=function(){S=0},this.setTexture2D=C,this.setTexture2DArray=function(t,n){let a=r.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?D(a,t,n):(t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null),i.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+n))},this.setTexture3D=function(t,n){let a=r.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?D(a,t,n):i.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+n)},this.setTextureCube=function(t,s){let o=r.get(t);!0!==t.isCubeDepthTexture&&t.version>0&&o.__version!==t.version?function(t,s,o){if(6!==s.image.length)return;let l=B(t,s),h=s.source;i.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);let c=r.get(h);if(h.version!==c.__version||!0===l){let t;i.activeTexture(e.TEXTURE0+o);let r=ih.getPrimaries(ih.workingColorSpace),u=""===s.colorSpace?null:ih.getPrimaries(s.colorSpace),d=""===s.colorSpace||r===u?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=s.isCompressedTexture||s.image[0].isCompressedTexture,A=s.image[0]&&s.image[0].isDataTexture,b=[];for(let e=0;e<6;e++)p||A?b[e]=A?s.image[e].image:s.image[e]:b[e]=f(s.image[e],!0,n.maxCubemapSize),b[e]=G(s,b[e]);let x=b[0],_=a.convert(s.format,s.colorSpace),E=a.convert(s.type),S=v(s.internalFormat,_,E,s.colorSpace),C=!0!==s.isVideoTexture,M=void 0===c.__version||!0===l,w=h.dataReady,I=y(s,x);if(T(e.TEXTURE_CUBE_MAP,s),p){C&&M&&i.texStorage2D(e.TEXTURE_CUBE_MAP,I,S,x.width,x.height);for(let r=0;r<6;r++){t=b[r].mipmaps;for(let n=0;n<t.length;n++){let a=t[n];1023!==s.format?null!==_?C?w&&i.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n,0,0,a.width,a.height,_,a.data):i.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n,S,a.width,a.height,0,a.data):t$("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):C?w&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n,0,0,a.width,a.height,_,E,a.data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n,S,a.width,a.height,0,_,E,a.data)}}}else{if(t=s.mipmaps,C&&M){t.length>0&&I++;let r=H(b[0]);i.texStorage2D(e.TEXTURE_CUBE_MAP,I,S,r.width,r.height)}for(let r=0;r<6;r++)if(A){C?w&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,0,0,b[r].width,b[r].height,_,E,b[r].data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,S,b[r].width,b[r].height,0,_,E,b[r].data);for(let n=0;n<t.length;n++){let a=t[n].image[r].image;C?w&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n+1,0,0,a.width,a.height,_,E,a.data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n+1,S,a.width,a.height,0,_,E,a.data)}}else{C?w&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,0,0,_,E,b[r]):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,S,_,E,b[r]);for(let n=0;n<t.length;n++){let a=t[n];C?w&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n+1,0,0,_,E,a.image[r]):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,n+1,S,_,E,a.image[r])}}}g(s)&&m(e.TEXTURE_CUBE_MAP),c.__version=h.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}(o,t,s):i.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture,e.TEXTURE0+s)},this.rebindTextures=function(t,i,n){let a=r.get(t);void 0!==i&&L(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==n&&F(t)},this.setupRenderTarget=function(t){let n=t.texture,o=r.get(t),l=r.get(n);t.addEventListener("dispose",_);let h=t.textures,c=!0===t.isWebGLCubeRenderTarget,u=h.length>1;if(!u&&(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=n.version,s.memory.textures++),c){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(n.mipmaps&&n.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let i=0;i<n.mipmaps.length;i++)o.__webglFramebuffer[t][i]=e.createFramebuffer()}else o.__webglFramebuffer[t]=e.createFramebuffer()}else{if(n.mipmaps&&n.mipmaps.length>0){o.__webglFramebuffer=[];for(let t=0;t<n.mipmaps.length;t++)o.__webglFramebuffer[t]=e.createFramebuffer()}else o.__webglFramebuffer=e.createFramebuffer();if(u)for(let t=0,i=h.length;t<i;t++){let i=r.get(h[t]);void 0===i.__webglTexture&&(i.__webglTexture=e.createTexture(),s.memory.textures++)}if(t.samples>0&&!1===Q(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],i.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let i=0;i<h.length;i++){let r=h[i];o.__webglColorRenderbuffer[i]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,o.__webglColorRenderbuffer[i]);let n=a.convert(r.format,r.colorSpace),s=a.convert(r.type),l=v(r.internalFormat,n,s,r.colorSpace,!0===t.isXRRenderTarget),c=k(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,c,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+i,e.RENDERBUFFER,o.__webglColorRenderbuffer[i])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(o.__webglDepthRenderbuffer=e.createRenderbuffer(),P(o.__webglDepthRenderbuffer,t,!0)),i.bindFramebuffer(e.FRAMEBUFFER,null)}}if(c){i.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),T(e.TEXTURE_CUBE_MAP,n);for(let i=0;i<6;i++)if(n.mipmaps&&n.mipmaps.length>0)for(let r=0;r<n.mipmaps.length;r++)L(o.__webglFramebuffer[i][r],t,n,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+i,r);else L(o.__webglFramebuffer[i],t,n,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0);g(n)&&m(e.TEXTURE_CUBE_MAP),i.unbindTexture()}else if(u){for(let n=0,a=h.length;n<a;n++){let a=h[n],s=r.get(a),l=e.TEXTURE_2D;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(l=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),i.bindTexture(l,s.__webglTexture),T(l,a),L(o.__webglFramebuffer,t,a,e.COLOR_ATTACHMENT0+n,l,0),g(a)&&m(l)}i.unbindTexture()}else{let r=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(r=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),i.bindTexture(r,l.__webglTexture),T(r,n),n.mipmaps&&n.mipmaps.length>0)for(let i=0;i<n.mipmaps.length;i++)L(o.__webglFramebuffer[i],t,n,e.COLOR_ATTACHMENT0,r,i);else L(o.__webglFramebuffer,t,n,e.COLOR_ATTACHMENT0,r,0);g(n)&&m(r),i.unbindTexture()}t.depthBuffer&&F(t)},this.updateRenderTargetMipmap=function(t){let n=t.textures;for(let a=0,s=n.length;a<s;a++){let s=n[a];if(g(s)){let n=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D,a=r.get(s).__webglTexture;i.bindTexture(n,a),m(n),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0){if(!1===Q(t)){let n=t.textures,a=t.width,s=t.height,o=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=r.get(t),u=n.length>1;if(u)for(let t=0;t<n.length;t++)i.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),i.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);i.bindFramebuffer(e.READ_FRAMEBUFFER,c.__webglMultisampledFramebuffer);let d=t.texture.mipmaps;d&&d.length>0?i.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer[0]):i.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(let i=0;i<n.length;i++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(o|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(o|=e.STENCIL_BUFFER_BIT)),u){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,c.__webglColorRenderbuffer[i]);let t=r.get(n[i]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,a,s,0,0,a,s,o,e.NEAREST),!0===h&&(N.length=0,O.length=0,N.push(e.COLOR_ATTACHMENT0+i),t.depthBuffer&&!1===t.resolveDepthBuffer&&(N.push(l),O.push(l),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,O)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,N))}if(i.bindFramebuffer(e.READ_FRAMEBUFFER,null),i.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),u)for(let t=0;t<n.length;t++){i.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,c.__webglColorRenderbuffer[t]);let a=r.get(n[t]).__webglTexture;i.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}i.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&h){let i=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[i])}}},this.setupDepthRenderbuffer=F,this.setupFrameBufferTexture=L,this.useMultisampledRTT=Q,this.isReversedDepthBuffer=function(){return i.buffers.depth.getReversed()}}function ui(e,t){return{convert:function(i,r=""){let n,a=ih.getTransfer(r);if(1009===i)return e.UNSIGNED_BYTE;if(1017===i)return e.UNSIGNED_SHORT_4_4_4_4;if(1018===i)return e.UNSIGNED_SHORT_5_5_5_1;if(35902===i)return e.UNSIGNED_INT_5_9_9_9_REV;if(35899===i)return e.UNSIGNED_INT_10F_11F_11F_REV;if(1010===i)return e.BYTE;if(1011===i)return e.SHORT;if(1012===i)return e.UNSIGNED_SHORT;if(1013===i)return e.INT;if(1014===i)return e.UNSIGNED_INT;if(1015===i)return e.FLOAT;if(1016===i)return e.HALF_FLOAT;if(1021===i)return e.ALPHA;if(1022===i)return e.RGB;if(1023===i)return e.RGBA;if(1026===i)return e.DEPTH_COMPONENT;if(1027===i)return e.DEPTH_STENCIL;if(1028===i)return e.RED;if(1029===i)return e.RED_INTEGER;if(1030===i)return e.RG;if(1031===i)return e.RG_INTEGER;if(1033===i)return e.RGBA_INTEGER;if(33776===i||33777===i||33778===i||33779===i)if("srgb"===a){if(null===(n=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(33776===i)return n.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===i)return n.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===i)return n.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===i)return n.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(n=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===i)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===i)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===i)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===i)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===i||35841===i||35842===i||35843===i){if(null===(n=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===i)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===i)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===i)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===i)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===i||37492===i||37496===i||37488===i||37489===i||37490===i||37491===i){if(null===(n=t.get("WEBGL_compressed_texture_etc")))return null;if(36196===i||37492===i)return"srgb"===a?n.COMPRESSED_SRGB8_ETC2:n.COMPRESSED_RGB8_ETC2;if(37496===i)return"srgb"===a?n.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:n.COMPRESSED_RGBA8_ETC2_EAC;if(37488===i)return n.COMPRESSED_R11_EAC;if(37489===i)return n.COMPRESSED_SIGNED_R11_EAC;if(37490===i)return n.COMPRESSED_RG11_EAC;if(37491===i)return n.COMPRESSED_SIGNED_RG11_EAC}if(37808===i||37809===i||37810===i||37811===i||37812===i||37813===i||37814===i||37815===i||37816===i||37817===i||37818===i||37819===i||37820===i||37821===i){if(null===(n=t.get("WEBGL_compressed_texture_astc")))return null;if(37808===i)return"srgb"===a?n.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:n.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===i)return"srgb"===a?n.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:n.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===i)return"srgb"===a?n.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:n.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===i)return"srgb"===a?n.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:n.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===i)return"srgb"===a?n.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:n.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===i)return"srgb"===a?n.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:n.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===i)return"srgb"===a?n.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:n.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===i)return"srgb"===a?n.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:n.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===i)return"srgb"===a?n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:n.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===i)return"srgb"===a?n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:n.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===i)return"srgb"===a?n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:n.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===i)return"srgb"===a?n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:n.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===i)return"srgb"===a?n.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:n.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===i)return"srgb"===a?n.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:n.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===i||36494===i||36495===i){if(null===(n=t.get("EXT_texture_compression_bptc")))return null;if(36492===i)return"srgb"===a?n.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:n.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(36494===i)return n.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(36495===i)return n.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===i||36284===i||36285===i||36286===i){if(null===(n=t.get("EXT_texture_compression_rgtc")))return null;if(36283===i)return n.COMPRESSED_RED_RGTC1_EXT;if(36284===i)return n.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===i)return n.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===i)return n.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return 1020===i?e.UNSIGNED_INT_24_8:void 0!==e[i]?e[i]:null}}}let ur=`
|
|
771
|
+
void main() {
|
|
772
|
+
|
|
773
|
+
gl_Position = vec4( position, 1.0 );
|
|
774
|
+
|
|
775
|
+
}`,un=`
|
|
776
|
+
uniform sampler2DArray depthColor;
|
|
777
|
+
uniform float depthWidth;
|
|
778
|
+
uniform float depthHeight;
|
|
779
|
+
|
|
780
|
+
void main() {
|
|
781
|
+
|
|
782
|
+
vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
|
|
783
|
+
|
|
784
|
+
if ( coord.x >= 1.0 ) {
|
|
785
|
+
|
|
786
|
+
gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
|
|
787
|
+
|
|
788
|
+
} else {
|
|
789
|
+
|
|
790
|
+
gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
|
|
791
|
+
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
}`;class ua{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(null===this.texture){let i=new ax(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(e){if(null!==this.texture&&null===this.mesh){let t=e.cameras[0].viewport,i=new nh({vertexShader:ur,fragmentShader:un,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new nr(new a9(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class us extends t1{constructor(e,t){super();const i=this;let r=null,n=1,a=null,s="local-floor",o=1,l=null,h=null,c=null,u=null,d=null,p=null;const A="u">typeof XRWebGLBinding,f=new ua,g={},m=t.getContextAttributes();let v=null,b=null;const y=[],x=[],_=new t7;let E=null;const S=new nA;S.viewport=new iy;const C=new nA;C.viewport=new iy;const M=[S,C],w=new sY;let I=null,T=null;function B(e){let t=x.indexOf(e.inputSource);if(-1===t)return;let i=y[t];void 0!==i&&(i.update(e.inputSource,e.frame,l||a),i.dispatchEvent({type:e.type,data:e.inputSource}))}function R(){r.removeEventListener("select",B),r.removeEventListener("selectstart",B),r.removeEventListener("selectend",B),r.removeEventListener("squeeze",B),r.removeEventListener("squeezestart",B),r.removeEventListener("squeezeend",B),r.removeEventListener("end",R),r.removeEventListener("inputsourceschange",D);for(let e=0;e<y.length;e++){let t=x[e];null!==t&&(x[e]=null,y[e].disconnect(t))}for(let e in I=null,T=null,f.reset(),g)delete g[e];e.setRenderTarget(v),d=null,u=null,c=null,r=null,b=null,N.stop(),i.isPresenting=!1,e.setPixelRatio(E),e.setSize(_.width,_.height,!1),i.dispatchEvent({type:"sessionend"})}function D(e){for(let t=0;t<e.removed.length;t++){let i=e.removed[t],r=x.indexOf(i);r>=0&&(x[r]=null,y[r].disconnect(i))}for(let t=0;t<e.added.length;t++){let i=e.added[t],r=x.indexOf(i);if(-1===r){for(let e=0;e<y.length;e++)if(e>=x.length){x.push(i),r=e;break}else if(null===x[e]){x[e]=i,r=e;break}if(-1===r)break}let n=y[r];n&&n.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=y[e];return void 0===t&&(t=new ny,y[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=y[e];return void 0===t&&(t=new ny,y[e]=t),t.getGripSpace()},this.getHand=function(e){let t=y[e];return void 0===t&&(t=new ny,y[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){n=e,!0===i.isPresenting&&t$("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===i.isPresenting&&t$("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==u?u:d},this.getBinding=function(){return null===c&&A&&(c=new XRWebGLBinding(r,t)),c},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(h){if(null!==(r=h)){if(v=e.getRenderTarget(),r.addEventListener("select",B),r.addEventListener("selectstart",B),r.addEventListener("selectend",B),r.addEventListener("squeeze",B),r.addEventListener("squeezestart",B),r.addEventListener("squeezeend",B),r.addEventListener("end",R),r.addEventListener("inputsourceschange",D),!0!==m.xrCompatible&&await t.makeXRCompatible(),E=e.getPixelRatio(),e.getSize(_),A&&"createProjectionLayer"in XRWebGLBinding.prototype){let i=null,a=null,s=null;m.depth&&(s=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,i=m.stencil?1027:1026,a=m.stencil?1020:1014);let o={colorFormat:t.RGBA8,depthFormat:s,scaleFactor:n};u=(c=this.getBinding()).createProjectionLayer(o),r.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),b=new i_(u.textureWidth,u.textureHeight,{format:1023,type:1009,depthTexture:new ab(u.textureWidth,u.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:4*!!m.antialias,resolveDepthBuffer:!1===u.ignoreDepthValues,resolveStencilBuffer:!1===u.ignoreDepthValues})}else{let i={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:n};d=new XRWebGLLayer(r,t,i),r.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),b=new i_(d.framebufferWidth,d.framebufferHeight,{format:1023,type:1009,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}b.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await r.requestReferenceSpace(s),N.setContext(r),N.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==r)return r.environmentBlendMode},this.getDepthTexture=function(){return f.getDepthTexture()};const L=new it,P=new it;function U(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var t,i,n;if(null===r)return;let a=e.near,s=e.far;null!==f.texture&&(f.depthNear>0&&(a=f.depthNear),f.depthFar>0&&(s=f.depthFar)),w.near=C.near=S.near=a,w.far=C.far=S.far=s,(I!==w.near||T!==w.far)&&(r.updateRenderState({depthNear:w.near,depthFar:w.far}),I=w.near,T=w.far),w.layers.mask=6|e.layers.mask,S.layers.mask=3&w.layers.mask,C.layers.mask=5&w.layers.mask;let o=e.parent,l=w.cameras;U(w,o);for(let e=0;e<l.length;e++)U(l[e],o);2===l.length?function(e,t,i){L.setFromMatrixPosition(t.matrixWorld),P.setFromMatrixPosition(i.matrixWorld);let r=L.distanceTo(P),n=t.projectionMatrix.elements,a=i.projectionMatrix.elements,s=n[14]/(n[10]-1),o=n[14]/(n[10]+1),l=(n[9]+1)/n[5],h=(n[9]-1)/n[5],c=(n[8]-1)/n[0],u=(a[8]+1)/a[0],d=r/(-c+u),p=-(d*c);if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(p),e.translateZ(d),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),-1===n[10])e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=s+d,i=o+d;e.projectionMatrix.makePerspective(s*c-p,s*u+(r-p),l*o/i*t,h*o/i*t,t,i),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}(w,S,C):w.projectionMatrix.copy(S.projectionMatrix),t=e,i=w,null===(n=o)?t.matrix.copy(i.matrixWorld):(t.matrix.copy(n.matrixWorld),t.matrix.invert(),t.matrix.multiply(i.matrixWorld)),t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(i.projectionMatrix),t.projectionMatrixInverse.copy(i.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*t4*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)},this.getCamera=function(){return w},this.getFoveation=function(){if(null!==u||null!==d)return o},this.setFoveation=function(e){o=e,null!==u&&(u.fixedFoveation=e),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==f.texture},this.getDepthSensingMesh=function(){return f.getMesh(w)},this.getCameraTexture=function(e){return g[e]};let F=null;const N=new lZ;N.setAnimationLoop(function(t,n){if(h=n.getViewerPose(l||a),p=n,null!==h){let t=h.views;null!==d&&(e.setRenderTargetFramebuffer(b,d.framebuffer),e.setRenderTarget(b));let n=!1;t.length!==w.cameras.length&&(w.cameras.length=0,n=!0);for(let i=0;i<t.length;i++){let r=t[i],a=null;if(null!==d)a=d.getViewport(r);else{let t=c.getViewSubImage(u,r);a=t.viewport,0===i&&(e.setRenderTargetTextures(b,t.colorTexture,t.depthStencilTexture),e.setRenderTarget(b))}let s=M[i];void 0===s&&((s=new nA).layers.enable(i),s.viewport=new iy,M[i]=s),s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.quaternion,s.scale),s.projectionMatrix.fromArray(r.projectionMatrix),s.projectionMatrixInverse.copy(s.projectionMatrix).invert(),s.viewport.set(a.x,a.y,a.width,a.height),0===i&&(w.matrix.copy(s.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale)),!0===n&&w.cameras.push(s)}let a=r.enabledFeatures;if(a&&a.includes("depth-sensing")&&"gpu-optimized"==r.depthUsage&&A){let e=(c=i.getBinding()).getDepthInformation(t[0]);e&&e.isValid&&e.texture&&f.init(e,r.renderState)}if(a&&a.includes("camera-access")&&A){e.state.unbindTexture(),c=i.getBinding();for(let e=0;e<t.length;e++){let i=t[e].camera;if(i){let e=g[i];e||(e=new ax,g[i]=e);let t=c.getCameraImage(i);e.sourceTexture=t}}}}for(let e=0;e<y.length;e++){let t=x[e],i=y[e];null!==t&&void 0!==i&&i.update(t,n,l||a)}F&&F(t,n),n.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:n}),p=null}),this.setAnimationLoop=function(e){F=e},this.dispose=function(){}}}let uo=new i6,ul=new i$;function uh(e,t){function i(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function r(e,r){e.opacity.value=r.opacity,r.color&&e.diffuse.value.copy(r.color),r.emissive&&e.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(e.map.value=r.map,i(r.map,e.mapTransform)),r.alphaMap&&(e.alphaMap.value=r.alphaMap,i(r.alphaMap,e.alphaMapTransform)),r.bumpMap&&(e.bumpMap.value=r.bumpMap,i(r.bumpMap,e.bumpMapTransform),e.bumpScale.value=r.bumpScale,1===r.side&&(e.bumpScale.value*=-1)),r.normalMap&&(e.normalMap.value=r.normalMap,i(r.normalMap,e.normalMapTransform),e.normalScale.value.copy(r.normalScale),1===r.side&&e.normalScale.value.negate()),r.displacementMap&&(e.displacementMap.value=r.displacementMap,i(r.displacementMap,e.displacementMapTransform),e.displacementScale.value=r.displacementScale,e.displacementBias.value=r.displacementBias),r.emissiveMap&&(e.emissiveMap.value=r.emissiveMap,i(r.emissiveMap,e.emissiveMapTransform)),r.specularMap&&(e.specularMap.value=r.specularMap,i(r.specularMap,e.specularMapTransform)),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest);let n=t.get(r),a=n.envMap,s=n.envMapRotation;a&&(e.envMap.value=a,uo.copy(s),uo.x*=-1,uo.y*=-1,uo.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(uo.y*=-1,uo.z*=-1),e.envMapRotation.value.setFromMatrix4(ul.makeRotationFromEuler(uo)),e.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,i(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,i(r.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,i){i.color.getRGB(t.fogColor.value,nl(e)),i.isFog?(t.fogNear.value=i.near,t.fogFar.value=i.far):i.isFogExp2&&(t.fogDensity.value=i.density)},refreshMaterialUniforms:function(e,n,a,s,o){var l,h,c,u,d,p,A,f,g,m,v,b,y,x,_,E,S,C,M,w,I,T,B;let R;n.isMeshBasicMaterial||n.isMeshLambertMaterial?r(e,n):n.isMeshToonMaterial?(r(e,n),l=e,(h=n).gradientMap&&(l.gradientMap.value=h.gradientMap)):n.isMeshPhongMaterial?(r(e,n),c=e,u=n,c.specular.value.copy(u.specular),c.shininess.value=Math.max(u.shininess,1e-4)):n.isMeshStandardMaterial?(r(e,n),d=e,p=n,d.metalness.value=p.metalness,p.metalnessMap&&(d.metalnessMap.value=p.metalnessMap,i(p.metalnessMap,d.metalnessMapTransform)),d.roughness.value=p.roughness,p.roughnessMap&&(d.roughnessMap.value=p.roughnessMap,i(p.roughnessMap,d.roughnessMapTransform)),p.envMap&&(d.envMapIntensity.value=p.envMapIntensity),n.isMeshPhysicalMaterial&&(A=e,f=n,g=o,A.ior.value=f.ior,f.sheen>0&&(A.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),A.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(A.sheenColorMap.value=f.sheenColorMap,i(f.sheenColorMap,A.sheenColorMapTransform)),f.sheenRoughnessMap&&(A.sheenRoughnessMap.value=f.sheenRoughnessMap,i(f.sheenRoughnessMap,A.sheenRoughnessMapTransform))),f.clearcoat>0&&(A.clearcoat.value=f.clearcoat,A.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(A.clearcoatMap.value=f.clearcoatMap,i(f.clearcoatMap,A.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(A.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,i(f.clearcoatRoughnessMap,A.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(A.clearcoatNormalMap.value=f.clearcoatNormalMap,i(f.clearcoatNormalMap,A.clearcoatNormalMapTransform),A.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),1===f.side&&A.clearcoatNormalScale.value.negate())),f.dispersion>0&&(A.dispersion.value=f.dispersion),f.iridescence>0&&(A.iridescence.value=f.iridescence,A.iridescenceIOR.value=f.iridescenceIOR,A.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],A.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(A.iridescenceMap.value=f.iridescenceMap,i(f.iridescenceMap,A.iridescenceMapTransform)),f.iridescenceThicknessMap&&(A.iridescenceThicknessMap.value=f.iridescenceThicknessMap,i(f.iridescenceThicknessMap,A.iridescenceThicknessMapTransform))),f.transmission>0&&(A.transmission.value=f.transmission,A.transmissionSamplerMap.value=g.texture,A.transmissionSamplerSize.value.set(g.width,g.height),f.transmissionMap&&(A.transmissionMap.value=f.transmissionMap,i(f.transmissionMap,A.transmissionMapTransform)),A.thickness.value=f.thickness,f.thicknessMap&&(A.thicknessMap.value=f.thicknessMap,i(f.thicknessMap,A.thicknessMapTransform)),A.attenuationDistance.value=f.attenuationDistance,A.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(A.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(A.anisotropyMap.value=f.anisotropyMap,i(f.anisotropyMap,A.anisotropyMapTransform))),A.specularIntensity.value=f.specularIntensity,A.specularColor.value.copy(f.specularColor),f.specularColorMap&&(A.specularColorMap.value=f.specularColorMap,i(f.specularColorMap,A.specularColorMapTransform)),f.specularIntensityMap&&(A.specularIntensityMap.value=f.specularIntensityMap,i(f.specularIntensityMap,A.specularIntensityMapTransform)))):n.isMeshMatcapMaterial?(r(e,n),m=e,(v=n).matcap&&(m.matcap.value=v.matcap)):n.isMeshDepthMaterial?r(e,n):n.isMeshDistanceMaterial?(r(e,n),b=e,y=n,R=t.get(y).light,b.referencePosition.value.setFromMatrixPosition(R.matrixWorld),b.nearDistance.value=R.shadow.camera.near,b.farDistance.value=R.shadow.camera.far):n.isMeshNormalMaterial?r(e,n):n.isLineBasicMaterial?(x=e,_=n,x.diffuse.value.copy(_.color),x.opacity.value=_.opacity,_.map&&(x.map.value=_.map,i(_.map,x.mapTransform)),n.isLineDashedMaterial&&(E=e,S=n,E.dashSize.value=S.dashSize,E.totalSize.value=S.dashSize+S.gapSize,E.scale.value=S.scale)):n.isPointsMaterial?(C=e,M=n,w=a,I=s,C.diffuse.value.copy(M.color),C.opacity.value=M.opacity,C.size.value=M.size*w,C.scale.value=.5*I,M.map&&(C.map.value=M.map,i(M.map,C.uvTransform)),M.alphaMap&&(C.alphaMap.value=M.alphaMap,i(M.alphaMap,C.alphaMapTransform)),M.alphaTest>0&&(C.alphaTest.value=M.alphaTest)):n.isSpriteMaterial?(T=e,B=n,T.diffuse.value.copy(B.color),T.opacity.value=B.opacity,T.rotation.value=B.rotation,B.map&&(T.map.value=B.map,i(B.map,T.mapTransform)),B.alphaMap&&(T.alphaMap.value=B.alphaMap,i(B.alphaMap,T.alphaMapTransform)),B.alphaTest>0&&(T.alphaTest.value=B.alphaTest)):n.isShadowMaterial?(e.color.value.copy(n.color),e.opacity.value=n.opacity):n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)}}}function uc(e,t,i,r){let n={},a={},s=[],o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e){let t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?t$("WebGLRenderer: Texture samplers can not be part of an uniforms group."):t$("WebGLRenderer: Unsupported uniform value type.",e),t}function h(t){let i=t.target;i.removeEventListener("dispose",h);let r=s.indexOf(i.__bindingPointIndex);s.splice(r,1),e.deleteBuffer(n[i.id]),delete n[i.id],delete a[i.id]}return{bind:function(e,t){let i=t.program;r.uniformBlockBinding(e,i)},update:function(i,c){var u;let d,p,A,f,g=n[i.id];void 0===g&&(function(e){let t=e.uniforms,i=0;for(let e=0,r=t.length;e<r;e++){let r=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=r.length;e<t;e++){let t=r[e],n=Array.isArray(t.value)?t.value:[t.value];for(let e=0,r=n.length;e<r;e++){let r=l(n[e]),a=i%16,s=a%r.boundary,o=a+s;i+=s,0!==o&&16-o<r.storage&&(i+=16-o),t.__data=new Float32Array(r.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=i,i+=r.storage}}}let r=i%16;r>0&&(i+=16-r),e.__size=i,e.__cache={}}(i),(u=i).__bindingPointIndex=d=function(){for(let e=0;e<o;e++)if(-1===s.indexOf(e))return s.push(e),e;return tZ("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}(),p=e.createBuffer(),A=u.__size,f=u.usage,e.bindBuffer(e.UNIFORM_BUFFER,p),e.bufferData(e.UNIFORM_BUFFER,A,f),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,d,p),g=p,n[i.id]=g,i.addEventListener("dispose",h));let m=c.program;r.updateUBOMapping(i,m);let v=t.render.frame;a[i.id]!==v&&(function(t){let i=n[t.id],r=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,i);for(let t=0,i=r.length;t<i;t++){let i=Array.isArray(r[t])?r[t]:[r[t]];for(let r=0,n=i.length;r<n;r++){let n=i[r];if(!0===function(e,t,i,r){let n=e.value,a=t+"_"+i;if(void 0===r[a])return"number"==typeof n||"boolean"==typeof n?r[a]=n:r[a]=n.clone(),!0;{let e=r[a];if("number"==typeof n||"boolean"==typeof n){if(e!==n)return r[a]=n,!0}else if(!1===e.equals(n))return e.copy(n),!0}return!1}(n,t,r,a)){let t=n.__offset,i=Array.isArray(n.value)?n.value:[n.value],r=0;for(let a=0;a<i.length;a++){let s=i[a],o=l(s);"number"==typeof s||"boolean"==typeof s?(n.__data[0]=s,e.bufferSubData(e.UNIFORM_BUFFER,t+r,n.__data)):s.isMatrix3?(n.__data[0]=s.elements[0],n.__data[1]=s.elements[1],n.__data[2]=s.elements[2],n.__data[3]=0,n.__data[4]=s.elements[3],n.__data[5]=s.elements[4],n.__data[6]=s.elements[5],n.__data[7]=0,n.__data[8]=s.elements[6],n.__data[9]=s.elements[7],n.__data[10]=s.elements[8],n.__data[11]=0):(s.toArray(n.__data,r),r+=o.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,n.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(i),a[i.id]=v)},dispose:function(){for(let t in n)e.deleteBuffer(n[t]);s=[],n={},a={}}}}let uu=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),ud=null;class up{constructor(e={}){let t,i,r,n,a,s,o,l,h,c,u,d,p,A,f,g,m,v,b,y,x,_,E,S,C;const{canvas:M=function(){let e=tY("canvas");return e.style.display="block",e}(),context:w=null,depth:I=!0,stencil:T=!1,alpha:B=!1,antialias:R=!1,premultipliedAlpha:D=!0,preserveDrawingBuffer:L=!1,powerPreference:P="default",failIfMajorPerformanceCaveat:U=!1,reversedDepthBuffer:F=!1,outputBufferType:N=1009}=e;if(this.isWebGLRenderer=!0,null!==w){if("u">typeof WebGLRenderingContext&&w instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");t=w.getContextAttributes().alpha}else t=B;const O=new Set([1033,1031,1029]),k=new Set([1009,1014,1012,1020,1017,1018]),Q=new Uint32Array(4),G=new Int32Array(4);let H=null,z=null;const V=[],W=[];let q=null;this.domElement=M,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const j=this;let X=!1;this._outputColorSpace="srgb";let Y=0,K=0,J=null,$=-1,Z=null;const ee=new iy,et=new iy;let ei=null;const er=new rP(0);let en=0,ea=M.width,es=M.height,eo=1,el=null,eh=null;const ec=new iy(0,0,ea,es),eu=new iy(0,0,ea,es);let ed=!1;const ep=new n2;let eA=!1,ef=!1;const eg=new i$,em=new it,ev=new iy,eb={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ey=!1;function ex(){return null===J?eo:1}let e_=w;function eE(e,t){return M.getContext(e,t)}try{if("setAttribute"in M&&M.setAttribute("data-engine","three.js r182"),M.addEventListener("webglcontextlost",eM,!1),M.addEventListener("webglcontextrestored",ew,!1),M.addEventListener("webglcontextcreationerror",eI,!1),null===e_){const e="webgl2";if(e_=eE(e,{alpha:!0,depth:I,stencil:T,antialias:R,premultipliedAlpha:D,preserveDrawingBuffer:L,powerPreference:P,failIfMajorPerformanceCaveat:U}),null===e_)if(eE(e))throw Error("Error creating WebGL context with your selected attributes.");else throw Error("Error creating WebGL context.")}}catch(e){throw tZ("WebGLRenderer: "+e.message),e}function eS(){(i=new hv(e_)).init(),E=new ui(e_,i),r=new he(e_,i,e,E),n=new ue(e_,i),r.reversedDepthBuffer&&F&&n.buffers.depth.setReversed(!0),a=new hx(e_),s=new cq,o=new ut(e_,i,n,s,r,E,a),l=new hi(j),h=new hm(j),c=new l0(e_),S=new l6(e_,c),u=new hb(e_,c,a,S),d=new hE(e_,u,c,a),y=new h_(e_,r,o),m=new ht(s),p=new cW(j,l,h,i,r,S,m),A=new uh(j,s),f=new cK,g=new c2(i),b=new l9(j,l,h,n,d,t,D),v=new c6(j,d,r),C=new uc(e_,a,r,n),x=new l7(e_,i,a),_=new hy(e_,i,a),a.programs=p.programs,j.capabilities=r,j.extensions=i,j.properties=s,j.renderLists=f,j.shadowMap=v,j.state=n,j.info=a}eS(),1009!==N&&(q=new hC(N,M.width,M.height,I,T));const eC=new us(j,e_);function eM(e){e.preventDefault(),tJ("WebGLRenderer: Context Lost."),X=!0}function ew(){tJ("WebGLRenderer: Context Restored."),X=!1;let e=a.autoReset,t=v.enabled,i=v.autoUpdate,r=v.needsUpdate,n=v.type;eS(),a.autoReset=e,v.enabled=t,v.autoUpdate=i,v.needsUpdate=r,v.type=n}function eI(e){tZ("WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function eT(e){var t,i;let r,n=e.target;n.removeEventListener("dispose",eT),i=t=n,void 0!==(r=s.get(i).programs)&&(r.forEach(function(e){p.releaseProgram(e)}),i.isShaderMaterial&&p.releaseShaderCache(i)),s.remove(t)}function eB(e,t,i){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,eQ(e,t,i),e.side=0,e.needsUpdate=!0,eQ(e,t,i),e.side=2):eQ(e,t,i)}this.xr=eC,this.getContext=function(){return e_},this.getContextAttributes=function(){return e_.getContextAttributes()},this.forceContextLoss=function(){let e=i.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=i.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return eo},this.setPixelRatio=function(e){void 0!==e&&(eo=e,this.setSize(ea,es,!1))},this.getSize=function(e){return e.set(ea,es)},this.setSize=function(e,t,i=!0){eC.isPresenting?t$("WebGLRenderer: Can't change size while VR device is presenting."):(ea=e,es=t,M.width=Math.floor(e*eo),M.height=Math.floor(t*eo),!0===i&&(M.style.width=e+"px",M.style.height=t+"px"),null!==q&&q.setSize(M.width,M.height),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(ea*eo,es*eo).floor()},this.setDrawingBufferSize=function(e,t,i){ea=e,es=t,eo=i,M.width=Math.floor(e*i),M.height=Math.floor(t*i),this.setViewport(0,0,e,t)},this.setEffects=function(e){if(1009===N)return void console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");if(e){for(let t=0;t<e.length;t++)if(!0===e[t].isOutputPass){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}q.setEffects(e||[])},this.getCurrentViewport=function(e){return e.copy(ee)},this.getViewport=function(e){return e.copy(ec)},this.setViewport=function(e,t,i,r){e.isVector4?ec.set(e.x,e.y,e.z,e.w):ec.set(e,t,i,r),n.viewport(ee.copy(ec).multiplyScalar(eo).round())},this.getScissor=function(e){return e.copy(eu)},this.setScissor=function(e,t,i,r){e.isVector4?eu.set(e.x,e.y,e.z,e.w):eu.set(e,t,i,r),n.scissor(et.copy(eu).multiplyScalar(eo).round())},this.getScissorTest=function(){return ed},this.setScissorTest=function(e){n.setScissorTest(ed=e)},this.setOpaqueSort=function(e){el=e},this.setTransparentSort=function(e){eh=e},this.getClearColor=function(e){return e.copy(b.getClearColor())},this.setClearColor=function(){b.setClearColor(...arguments)},this.getClearAlpha=function(){return b.getClearAlpha()},this.setClearAlpha=function(){b.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,i=!0){let r=0;if(e){let e=!1;if(null!==J){let t=J.texture.format;e=O.has(t)}if(e){let e=J.texture.type,t=k.has(e),i=b.getClearColor(),r=b.getClearAlpha(),n=i.r,a=i.g,s=i.b;t?(Q[0]=n,Q[1]=a,Q[2]=s,Q[3]=r,e_.clearBufferuiv(e_.COLOR,0,Q)):(G[0]=n,G[1]=a,G[2]=s,G[3]=r,e_.clearBufferiv(e_.COLOR,0,G))}else r|=e_.COLOR_BUFFER_BIT}t&&(r|=e_.DEPTH_BUFFER_BIT),i&&(r|=e_.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(0xffffffff)),e_.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){M.removeEventListener("webglcontextlost",eM,!1),M.removeEventListener("webglcontextrestored",ew,!1),M.removeEventListener("webglcontextcreationerror",eI,!1),b.dispose(),f.dispose(),g.dispose(),s.dispose(),l.dispose(),h.dispose(),d.dispose(),S.dispose(),C.dispose(),p.dispose(),eC.dispose(),eC.removeEventListener("sessionstart",eD),eC.removeEventListener("sessionend",eL),eP.stop()},this.renderBufferDirect=function(e,t,a,d,p,f){let g;null===t&&(t=eb);let v=p.isMesh&&0>p.matrixWorld.determinant(),b=function(e,t,i,a,c){var u,d;!0!==t.isScene&&(t=eb),o.resetTextureUnits();let p=t.fog,f=a.isMeshStandardMaterial?t.environment:null,g=null===J?j.outputColorSpace:!0===J.isXRRenderTarget?J.texture.colorSpace:tW,v=(a.isMeshStandardMaterial?h:l).get(a.envMap||f),b=!0===a.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,x=!!i.attributes.tangent&&(!!a.normalMap||a.anisotropy>0),_=!!i.morphAttributes.position,E=!!i.morphAttributes.normal,S=!!i.morphAttributes.color,M=0;a.toneMapped&&(null===J||!0===J.isXRRenderTarget)&&(M=j.toneMapping);let w=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,I=void 0!==w?w.length:0,T=s.get(a),B=z.state.lights;if(!0===eA&&(!0===ef||e!==Z)){let t=e===Z&&a.id===$;m.setState(a,e,t)}let R=!1;a.version===T.__version?T.needsLights&&T.lightsStateVersion!==B.state.version||T.outputColorSpace!==g||c.isBatchedMesh&&!1===T.batching?R=!0:c.isBatchedMesh||!0!==T.batching?c.isBatchedMesh&&!0===T.batchingColor&&null===c.colorTexture||c.isBatchedMesh&&!1===T.batchingColor&&null!==c.colorTexture||c.isInstancedMesh&&!1===T.instancing?R=!0:c.isInstancedMesh||!0!==T.instancing?c.isSkinnedMesh&&!1===T.skinning?R=!0:c.isSkinnedMesh||!0!==T.skinning?c.isInstancedMesh&&!0===T.instancingColor&&null===c.instanceColor||c.isInstancedMesh&&!1===T.instancingColor&&null!==c.instanceColor||c.isInstancedMesh&&!0===T.instancingMorph&&null===c.morphTexture||c.isInstancedMesh&&!1===T.instancingMorph&&null!==c.morphTexture||T.envMap!==v||!0===a.fog&&T.fog!==p||void 0!==T.numClippingPlanes&&(T.numClippingPlanes!==m.numPlanes||T.numIntersection!==m.numIntersection)||T.vertexAlphas!==b||T.vertexTangents!==x||T.morphTargets!==_||T.morphNormals!==E||T.morphColors!==S||T.toneMapping!==M?R=!0:T.morphTargetsCount!==I&&(R=!0):R=!0:R=!0:R=!0:(R=!0,T.__version=a.version);let D=T.currentProgram;!0===R&&(D=eQ(a,t,c));let L=!1,P=!1,U=!1,F=D.getUniforms(),N=T.uniforms;if(n.useProgram(D.program)&&(L=!0,P=!0,U=!0),a.id!==$&&($=a.id,P=!0),L||Z!==e){n.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),F.setValue(e_,"projectionMatrix",e.projectionMatrix),F.setValue(e_,"viewMatrix",e.matrixWorldInverse);let t=F.map.cameraPosition;void 0!==t&&t.setValue(e_,em.setFromMatrixPosition(e.matrixWorld)),r.logarithmicDepthBuffer&&F.setValue(e_,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(a.isMeshPhongMaterial||a.isMeshToonMaterial||a.isMeshLambertMaterial||a.isMeshBasicMaterial||a.isMeshStandardMaterial||a.isShaderMaterial)&&F.setValue(e_,"isOrthographic",!0===e.isOrthographicCamera),Z!==e&&(Z=e,P=!0,U=!0)}if(T.needsLights&&(B.state.directionalShadowMap.length>0&&F.setValue(e_,"directionalShadowMap",B.state.directionalShadowMap,o),B.state.spotShadowMap.length>0&&F.setValue(e_,"spotShadowMap",B.state.spotShadowMap,o),B.state.pointShadowMap.length>0&&F.setValue(e_,"pointShadowMap",B.state.pointShadowMap,o)),c.isSkinnedMesh){F.setOptional(e_,c,"bindMatrix"),F.setOptional(e_,c,"bindMatrixInverse");let e=c.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),F.setValue(e_,"boneTexture",e.boneTexture,o))}c.isBatchedMesh&&(F.setOptional(e_,c,"batchingTexture"),F.setValue(e_,"batchingTexture",c._matricesTexture,o),F.setOptional(e_,c,"batchingIdTexture"),F.setValue(e_,"batchingIdTexture",c._indirectTexture,o),F.setOptional(e_,c,"batchingColorTexture"),null!==c._colorsTexture&&F.setValue(e_,"batchingColorTexture",c._colorsTexture,o));let O=i.morphAttributes;if((void 0!==O.position||void 0!==O.normal||void 0!==O.color)&&y.update(c,i,D),(P||T.receiveShadow!==c.receiveShadow)&&(T.receiveShadow=c.receiveShadow,F.setValue(e_,"receiveShadow",c.receiveShadow)),a.isMeshGouraudMaterial&&null!==a.envMap&&(N.envMap.value=v,N.flipEnvMap.value=v.isCubeTexture&&!1===v.isRenderTargetTexture?-1:1),a.isMeshStandardMaterial&&null===a.envMap&&null!==t.environment&&(N.envMapIntensity.value=t.environmentIntensity),void 0!==N.dfgLUT&&(N.dfgLUT.value=(null===ud&&((ud=new nF(uu,16,16,1030,1016)).name="DFG_LUT",ud.minFilter=1006,ud.magFilter=1006,ud.wrapS=1001,ud.wrapT=1001,ud.generateMipmaps=!1,ud.needsUpdate=!0),ud)),P&&(F.setValue(e_,"toneMappingExposure",j.toneMappingExposure),T.needsLights&&(u=N,d=U,u.ambientLightColor.needsUpdate=d,u.lightProbe.needsUpdate=d,u.directionalLights.needsUpdate=d,u.directionalLightShadows.needsUpdate=d,u.pointLights.needsUpdate=d,u.pointLightShadows.needsUpdate=d,u.spotLights.needsUpdate=d,u.spotLightShadows.needsUpdate=d,u.rectAreaLights.needsUpdate=d,u.hemisphereLights.needsUpdate=d),p&&!0===a.fog&&A.refreshFogUniforms(N,p),A.refreshMaterialUniforms(N,a,eo,es,z.state.transmissionRenderTarget[e.id]),cb.upload(e_,eG(T),N,o)),a.isShaderMaterial&&!0===a.uniformsNeedUpdate&&(cb.upload(e_,eG(T),N,o),a.uniformsNeedUpdate=!1),a.isSpriteMaterial&&F.setValue(e_,"center",c.center),F.setValue(e_,"modelViewMatrix",c.modelViewMatrix),F.setValue(e_,"normalMatrix",c.normalMatrix),F.setValue(e_,"modelMatrix",c.matrixWorld),a.isShaderMaterial||a.isRawShaderMaterial){let e=a.uniformsGroups;for(let t=0,i=e.length;t<i;t++){let i=e[t];C.update(i,D),C.bind(i,D)}}return D}(e,t,a,d,p);n.setMaterial(d,v);let E=a.index,M=1;if(!0===d.wireframe){if(void 0===(E=u.getWireframeAttribute(a)))return;M=2}let w=a.drawRange,I=a.attributes.position,T=w.start*M,B=(w.start+w.count)*M;null!==f&&(T=Math.max(T,f.start*M),B=Math.min(B,(f.start+f.count)*M)),null!==E?(T=Math.max(T,0),B=Math.min(B,E.count)):null!=I&&(T=Math.max(T,0),B=Math.min(B,I.count));let R=B-T;if(R<0||R===1/0)return;S.setup(p,d,b,a,E);let D=x;if(null!==E&&(g=c.get(E),(D=_).setIndex(g)),p.isMesh)!0===d.wireframe?(n.setLineWidth(d.wireframeLinewidth*ex()),D.setMode(e_.LINES)):D.setMode(e_.TRIANGLES);else if(p.isLine){let e=d.linewidth;void 0===e&&(e=1),n.setLineWidth(e*ex()),p.isLineSegments?D.setMode(e_.LINES):p.isLineLoop?D.setMode(e_.LINE_LOOP):D.setMode(e_.LINE_STRIP)}else p.isPoints?D.setMode(e_.POINTS):p.isSprite&&D.setMode(e_.TRIANGLES);if(p.isBatchedMesh)if(null!==p._multiDrawInstances)t0("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),D.renderMultiDrawInstances(p._multiDrawStarts,p._multiDrawCounts,p._multiDrawCount,p._multiDrawInstances);else if(i.get("WEBGL_multi_draw"))D.renderMultiDraw(p._multiDrawStarts,p._multiDrawCounts,p._multiDrawCount);else{let e=p._multiDrawStarts,t=p._multiDrawCounts,i=p._multiDrawCount,r=E?c.get(E).bytesPerElement:1,n=s.get(d).currentProgram.getUniforms();for(let a=0;a<i;a++)n.setValue(e_,"_gl_DrawID",a),D.render(e[a]/r,t[a])}else if(p.isInstancedMesh)D.renderInstances(T,R,p.count);else if(a.isInstancedBufferGeometry){let e=void 0!==a._maxInstanceCount?a._maxInstanceCount:1/0,t=Math.min(a.instanceCount,e);D.renderInstances(T,R,t)}else D.render(T,R)},this.compile=function(e,t,i=null){null===i&&(i=e),(z=g.get(i)).init(t),W.push(z),i.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(z.pushLight(e),e.castShadow&&z.pushShadow(e))}),e!==i&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(z.pushLight(e),e.castShadow&&z.pushShadow(e))}),z.setupLights();let r=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;let t=e.material;if(t)if(Array.isArray(t))for(let n=0;n<t.length;n++){let a=t[n];eB(a,i,e),r.add(a)}else eB(t,i,e),r.add(t)}),z=W.pop(),r},this.compileAsync=function(e,t,r=null){let n=this.compile(e,t,r);return new Promise(t=>{function r(){(n.forEach(function(e){s.get(e).currentProgram.isReady()&&n.delete(e)}),0===n.size)?t(e):setTimeout(r,10)}null!==i.get("KHR_parallel_shader_compile")?r():setTimeout(r,10)})};let eR=null;function eD(){eP.stop()}function eL(){eP.start()}const eP=new lZ;function eU(e,t,i,r){if(!1===e.visible)return;if(e.layers.test(t.layers)){if(e.isGroup)i=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)z.pushLight(e),e.castShadow&&z.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ep.intersectsSprite(e)){r&&ev.setFromMatrixPosition(e.matrixWorld).applyMatrix4(eg);let t=d.update(e),n=e.material;n.visible&&H.push(e,t,n,i,ev.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ep.intersectsObject(e))){let t=d.update(e),n=e.material;if(r&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),ev.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),ev.copy(t.boundingSphere.center)),ev.applyMatrix4(e.matrixWorld).applyMatrix4(eg)),Array.isArray(n)){let r=t.groups;for(let a=0,s=r.length;a<s;a++){let s=r[a],o=n[s.materialIndex];o&&o.visible&&H.push(e,t,o,i,ev.z,s)}}else n.visible&&H.push(e,t,n,i,ev.z,null)}}let n=e.children;for(let e=0,a=n.length;e<a;e++)eU(n[e],t,i,r)}function eF(e,t,i,r){let{opaque:a,transmissive:s,transparent:o}=e;z.setupLightsView(i),!0===eA&&m.setGlobalState(j.clippingPlanes,i),r&&n.viewport(ee.copy(r)),a.length>0&&eO(a,t,i),s.length>0&&eO(s,t,i),o.length>0&&eO(o,t,i),n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),n.setPolygonOffset(!1)}function eN(e,t,n,a){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;if(void 0===z.state.transmissionRenderTarget[a.id]){let e=i.has("EXT_color_buffer_half_float")||i.has("EXT_color_buffer_float");z.state.transmissionRenderTarget[a.id]=new i_(1,1,{generateMipmaps:!0,type:e?1016:1009,minFilter:1008,samples:r.samples,stencilBuffer:T,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ih.workingColorSpace})}let s=z.state.transmissionRenderTarget[a.id],l=a.viewport||ee;s.setSize(l.z*j.transmissionResolutionScale,l.w*j.transmissionResolutionScale);let h=j.getRenderTarget(),c=j.getActiveCubeFace(),u=j.getActiveMipmapLevel();j.setRenderTarget(s),j.getClearColor(er),(en=j.getClearAlpha())<1&&j.setClearColor(0xffffff,.5),j.clear(),ey&&b.render(n);let d=j.toneMapping;j.toneMapping=0;let p=a.viewport;if(void 0!==a.viewport&&(a.viewport=void 0),z.setupLightsView(a),!0===eA&&m.setGlobalState(j.clippingPlanes,a),eO(e,n,a),o.updateMultisampleRenderTarget(s),o.updateRenderTargetMipmap(s),!1===i.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let i=0,r=t.length;i<r;i++){let{object:r,geometry:s,material:o,group:l}=t[i];if(2===o.side&&r.layers.test(a.layers)){let t=o.side;o.side=1,o.needsUpdate=!0,ek(r,n,a,s,o,l),o.side=t,o.needsUpdate=!0,e=!0}}!0===e&&(o.updateMultisampleRenderTarget(s),o.updateRenderTargetMipmap(s))}j.setRenderTarget(h,c,u),j.setClearColor(er,en),void 0!==p&&(a.viewport=p),j.toneMapping=d}function eO(e,t,i){let r=!0===t.isScene?t.overrideMaterial:null;for(let n=0,a=e.length;n<a;n++){let a=e[n],{object:s,geometry:o,group:l}=a,h=a.material;!0===h.allowOverride&&null!==r&&(h=r),s.layers.test(i.layers)&&ek(s,t,i,o,h,l)}}function ek(e,t,i,r,n,a){e.onBeforeRender(j,t,i,r,n,a),e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),n.onBeforeRender(j,t,i,r,e,a),!0===n.transparent&&2===n.side&&!1===n.forceSinglePass?(n.side=1,n.needsUpdate=!0,j.renderBufferDirect(i,t,r,n,e,a),n.side=0,n.needsUpdate=!0,j.renderBufferDirect(i,t,r,n,e,a),n.side=2):j.renderBufferDirect(i,t,r,n,e,a),e.onAfterRender(j,t,i,r,n,a)}function eQ(e,t,i){var r;!0!==t.isScene&&(t=eb);let n=s.get(e),a=z.state.lights,o=z.state.shadowsArray,c=a.state.version,u=p.getParameters(e,a.state,o,t,i),d=p.getProgramCacheKey(u),A=n.programs;n.environment=e.isMeshStandardMaterial?t.environment:null,n.fog=t.fog,n.envMap=(e.isMeshStandardMaterial?h:l).get(e.envMap||n.environment),n.envMapRotation=null!==n.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===A&&(e.addEventListener("dispose",eT),n.programs=A=new Map);let f=A.get(d);if(void 0!==f){if(n.currentProgram===f&&n.lightsStateVersion===c)return eH(e,u),f}else u.uniforms=p.getUniforms(e),e.onBeforeCompile(u,j),f=p.acquireProgram(u,d),A.set(d,f),n.uniforms=u.uniforms;let g=n.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(g.clippingPlanes=m.uniform),eH(e,u),n.needsLights=(r=e).isMeshLambertMaterial||r.isMeshToonMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.isShadowMaterial||r.isShaderMaterial&&!0===r.lights,n.lightsStateVersion=c,n.needsLights&&(g.ambientLightColor.value=a.state.ambient,g.lightProbe.value=a.state.probe,g.directionalLights.value=a.state.directional,g.directionalLightShadows.value=a.state.directionalShadow,g.spotLights.value=a.state.spot,g.spotLightShadows.value=a.state.spotShadow,g.rectAreaLights.value=a.state.rectArea,g.ltc_1.value=a.state.rectAreaLTC1,g.ltc_2.value=a.state.rectAreaLTC2,g.pointLights.value=a.state.point,g.pointLightShadows.value=a.state.pointShadow,g.hemisphereLights.value=a.state.hemi,g.directionalShadowMap.value=a.state.directionalShadowMap,g.directionalShadowMatrix.value=a.state.directionalShadowMatrix,g.spotShadowMap.value=a.state.spotShadowMap,g.spotLightMatrix.value=a.state.spotLightMatrix,g.spotLightMap.value=a.state.spotLightMap,g.pointShadowMap.value=a.state.pointShadowMap,g.pointShadowMatrix.value=a.state.pointShadowMatrix),n.currentProgram=f,n.uniformsList=null,f}function eG(e){if(null===e.uniformsList){let t=e.currentProgram.getUniforms();e.uniformsList=cb.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function eH(e,t){let i=s.get(e);i.outputColorSpace=t.outputColorSpace,i.batching=t.batching,i.batchingColor=t.batchingColor,i.instancing=t.instancing,i.instancingColor=t.instancingColor,i.instancingMorph=t.instancingMorph,i.skinning=t.skinning,i.morphTargets=t.morphTargets,i.morphNormals=t.morphNormals,i.morphColors=t.morphColors,i.morphTargetsCount=t.morphTargetsCount,i.numClippingPlanes=t.numClippingPlanes,i.numIntersection=t.numClipIntersection,i.vertexAlphas=t.vertexAlphas,i.vertexTangents=t.vertexTangents,i.toneMapping=t.toneMapping}eP.setAnimationLoop(function(e){eR&&eR(e)}),"u">typeof self&&eP.setContext(self),this.setAnimationLoop=function(e){eR=e,eC.setAnimationLoop(e),null===e?eP.stop():eP.start()},eC.addEventListener("sessionstart",eD),eC.addEventListener("sessionend",eL),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void tZ("WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===X)return;let i=!0===eC.enabled&&!0===eC.isPresenting,r=null!==q&&(null===J||i)&&q.begin(j,J);if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===eC.enabled&&!0===eC.isPresenting&&(null===q||!1===q.isCompositing())&&(!0===eC.cameraAutoUpdate&&eC.updateCamera(t),t=eC.getCamera()),!0===e.isScene&&e.onBeforeRender(j,e,t,J),(z=g.get(e,W.length)).init(t),W.push(z),eg.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ep.setFromProjectionMatrix(eg,2e3,t.reversedDepth),ef=this.localClippingEnabled,eA=m.init(this.clippingPlanes,ef),(H=f.get(e,V.length)).init(),V.push(H),!0===eC.enabled&&!0===eC.isPresenting){let e=j.xr.getDepthSensingMesh();null!==e&&eU(e,t,-1/0,j.sortObjects)}eU(e,t,0,j.sortObjects),H.finish(),!0===j.sortObjects&&H.sort(el,eh),(ey=!1===eC.enabled||!1===eC.isPresenting||!1===eC.hasDepthSensing())&&b.addToRenderList(H,e),this.info.render.frame++,!0===eA&&m.beginShadows();let n=z.state.shadowsArray;if(v.render(n,e,t),!0===eA&&m.endShadows(),!0===this.info.autoReset&&this.info.reset(),!1===(r&&q.hasRenderPass())){let i=H.opaque,r=H.transmissive;if(z.setupLights(),t.isArrayCamera){let n=t.cameras;if(r.length>0)for(let t=0,a=n.length;t<a;t++)eN(i,r,e,n[t]);ey&&b.render(e);for(let t=0,i=n.length;t<i;t++){let i=n[t];eF(H,e,i,i.viewport)}}else r.length>0&&eN(i,r,e,t),ey&&b.render(e),eF(H,e,t)}null!==J&&0===K&&(o.updateMultisampleRenderTarget(J),o.updateRenderTargetMipmap(J)),r&&q.end(j),!0===e.isScene&&e.onAfterRender(j,e,t),S.resetDefaultState(),$=-1,Z=null,W.pop(),W.length>0?(z=W[W.length-1],!0===eA&&m.setGlobalState(j.clippingPlanes,z.state.camera)):z=null,V.pop(),H=V.length>0?V[V.length-1]:null},this.getActiveCubeFace=function(){return Y},this.getActiveMipmapLevel=function(){return K},this.getRenderTarget=function(){return J},this.setRenderTargetTextures=function(e,t,i){let r=s.get(e);r.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===r.__autoAllocateDepthBuffer&&(r.__useRenderToTexture=!1),s.get(e.texture).__webglTexture=t,s.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:i,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){let i=s.get(e);i.__webglFramebuffer=t,i.__useDefaultFramebuffer=void 0===t};const ez=e_.createFramebuffer();this.setRenderTarget=function(e,t=0,i=0){J=e,Y=t,K=i;let r=null,a=!1,l=!1;if(e){let h=s.get(e);if(void 0!==h.__useDefaultFramebuffer){n.bindFramebuffer(e_.FRAMEBUFFER,h.__webglFramebuffer),ee.copy(e.viewport),et.copy(e.scissor),ei=e.scissorTest,n.viewport(ee),n.scissor(et),n.setScissorTest(ei),$=-1;return}if(void 0===h.__webglFramebuffer)o.setupRenderTarget(e);else if(h.__hasExternalTextures)o.rebindTextures(e,s.get(e.texture).__webglTexture,s.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let t=e.depthTexture;if(h.__boundDepthTexture!==t){if(null!==t&&s.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");o.setupDepthRenderbuffer(e)}}let c=e.texture;(c.isData3DTexture||c.isDataArrayTexture||c.isCompressedArrayTexture)&&(l=!0);let u=s.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(u[t])?u[t][i]:u[t],a=!0):r=e.samples>0&&!1===o.useMultisampledRTT(e)?s.get(e).__webglMultisampledFramebuffer:Array.isArray(u)?u[i]:u,ee.copy(e.viewport),et.copy(e.scissor),ei=e.scissorTest}else ee.copy(ec).multiplyScalar(eo).floor(),et.copy(eu).multiplyScalar(eo).floor(),ei=ed;if(0!==i&&(r=ez),n.bindFramebuffer(e_.FRAMEBUFFER,r)&&n.drawBuffers(e,r),n.viewport(ee),n.scissor(et),n.setScissorTest(ei),a){let r=s.get(e.texture);e_.framebufferTexture2D(e_.FRAMEBUFFER,e_.COLOR_ATTACHMENT0,e_.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,i)}else if(l)for(let r=0;r<e.textures.length;r++){let n=s.get(e.textures[r]);e_.framebufferTextureLayer(e_.FRAMEBUFFER,e_.COLOR_ATTACHMENT0+r,n.__webglTexture,i,t)}else if(null!==e&&0!==i){let t=s.get(e.texture);e_.framebufferTexture2D(e_.FRAMEBUFFER,e_.COLOR_ATTACHMENT0,e_.TEXTURE_2D,t.__webglTexture,i)}$=-1},this.readRenderTargetPixels=function(e,t,i,a,o,l,h,c=0){if(!(e&&e.isWebGLRenderTarget))return void tZ("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let u=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==h&&(u=u[h]),u){n.bindFramebuffer(e_.FRAMEBUFFER,u);try{let n=e.textures[c],s=n.format,h=n.type;if(!r.textureFormatReadable(s))return void tZ("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!r.textureTypeReadable(h))return void tZ("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-a&&i>=0&&i<=e.height-o&&(e.textures.length>1&&e_.readBuffer(e_.COLOR_ATTACHMENT0+c),e_.readPixels(t,i,a,o,E.convert(s),E.convert(h),l))}finally{let e=null!==J?s.get(J).__webglFramebuffer:null;n.bindFramebuffer(e_.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,i,a,o,l,h,c=0){if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let u=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==h&&(u=u[h]),u)if(t>=0&&t<=e.width-a&&i>=0&&i<=e.height-o){var d;n.bindFramebuffer(e_.FRAMEBUFFER,u);let h=e.textures[c],p=h.format,A=h.type;if(!r.textureFormatReadable(p))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!r.textureTypeReadable(A))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let f=e_.createBuffer();e_.bindBuffer(e_.PIXEL_PACK_BUFFER,f),e_.bufferData(e_.PIXEL_PACK_BUFFER,l.byteLength,e_.STREAM_READ),e.textures.length>1&&e_.readBuffer(e_.COLOR_ATTACHMENT0+c),e_.readPixels(t,i,a,o,E.convert(p),E.convert(A),0);let g=null!==J?s.get(J).__webglFramebuffer:null;n.bindFramebuffer(e_.FRAMEBUFFER,g);let m=e_.fenceSync(e_.SYNC_GPU_COMMANDS_COMPLETE,0);return e_.flush(),await (d=e_,new Promise(function(e,t){setTimeout(function i(){switch(d.clientWaitSync(m,d.SYNC_FLUSH_COMMANDS_BIT,0)){case d.WAIT_FAILED:t();break;case d.TIMEOUT_EXPIRED:setTimeout(i,4);break;default:e()}},4)})),e_.bindBuffer(e_.PIXEL_PACK_BUFFER,f),e_.getBufferSubData(e_.PIXEL_PACK_BUFFER,0,l),e_.deleteBuffer(f),e_.deleteSync(m),l}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(e,t=null,i=0){let r=Math.pow(2,-i),a=Math.floor(e.image.width*r),s=Math.floor(e.image.height*r),l=null!==t?t.x:0,h=null!==t?t.y:0;o.setTexture2D(e,0),e_.copyTexSubImage2D(e_.TEXTURE_2D,i,0,0,l,h,a,s),n.unbindTexture()};const eV=e_.createFramebuffer(),eW=e_.createFramebuffer();this.copyTextureToTexture=function(e,t,i=null,r=null,a=0,l=null){let h,c,u,d,p,A,f,g,m,v;null===l&&(0!==a?(t0("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),l=a,a=0):l=0);let b=e.isCompressedTexture?e.mipmaps[l]:e.image;if(null!==i)h=i.max.x-i.min.x,c=i.max.y-i.min.y,u=i.isBox3?i.max.z-i.min.z:1,d=i.min.x,p=i.min.y,A=i.isBox3?i.min.z:0;else{let t=Math.pow(2,-a);h=Math.floor(b.width*t),c=Math.floor(b.height*t),u=e.isDataArrayTexture?b.depth:e.isData3DTexture?Math.floor(b.depth*t):1,d=0,p=0,A=0}null!==r?(f=r.x,g=r.y,m=r.z):(f=0,g=0,m=0);let y=E.convert(t.format),x=E.convert(t.type);t.isData3DTexture?(o.setTexture3D(t,0),v=e_.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(o.setTexture2DArray(t,0),v=e_.TEXTURE_2D_ARRAY):(o.setTexture2D(t,0),v=e_.TEXTURE_2D),e_.pixelStorei(e_.UNPACK_FLIP_Y_WEBGL,t.flipY),e_.pixelStorei(e_.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),e_.pixelStorei(e_.UNPACK_ALIGNMENT,t.unpackAlignment);let _=e_.getParameter(e_.UNPACK_ROW_LENGTH),S=e_.getParameter(e_.UNPACK_IMAGE_HEIGHT),C=e_.getParameter(e_.UNPACK_SKIP_PIXELS),M=e_.getParameter(e_.UNPACK_SKIP_ROWS),w=e_.getParameter(e_.UNPACK_SKIP_IMAGES);e_.pixelStorei(e_.UNPACK_ROW_LENGTH,b.width),e_.pixelStorei(e_.UNPACK_IMAGE_HEIGHT,b.height),e_.pixelStorei(e_.UNPACK_SKIP_PIXELS,d),e_.pixelStorei(e_.UNPACK_SKIP_ROWS,p),e_.pixelStorei(e_.UNPACK_SKIP_IMAGES,A);let I=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let i=s.get(e),r=s.get(t),o=s.get(i.__renderTarget),v=s.get(r.__renderTarget);n.bindFramebuffer(e_.READ_FRAMEBUFFER,o.__webglFramebuffer),n.bindFramebuffer(e_.DRAW_FRAMEBUFFER,v.__webglFramebuffer);for(let i=0;i<u;i++)I&&(e_.framebufferTextureLayer(e_.READ_FRAMEBUFFER,e_.COLOR_ATTACHMENT0,s.get(e).__webglTexture,a,A+i),e_.framebufferTextureLayer(e_.DRAW_FRAMEBUFFER,e_.COLOR_ATTACHMENT0,s.get(t).__webglTexture,l,m+i)),e_.blitFramebuffer(d,p,h,c,f,g,h,c,e_.DEPTH_BUFFER_BIT,e_.NEAREST);n.bindFramebuffer(e_.READ_FRAMEBUFFER,null),n.bindFramebuffer(e_.DRAW_FRAMEBUFFER,null)}else if(0!==a||e.isRenderTargetTexture||s.has(e)){let i=s.get(e),r=s.get(t);n.bindFramebuffer(e_.READ_FRAMEBUFFER,eV),n.bindFramebuffer(e_.DRAW_FRAMEBUFFER,eW);for(let e=0;e<u;e++)I?e_.framebufferTextureLayer(e_.READ_FRAMEBUFFER,e_.COLOR_ATTACHMENT0,i.__webglTexture,a,A+e):e_.framebufferTexture2D(e_.READ_FRAMEBUFFER,e_.COLOR_ATTACHMENT0,e_.TEXTURE_2D,i.__webglTexture,a),T?e_.framebufferTextureLayer(e_.DRAW_FRAMEBUFFER,e_.COLOR_ATTACHMENT0,r.__webglTexture,l,m+e):e_.framebufferTexture2D(e_.DRAW_FRAMEBUFFER,e_.COLOR_ATTACHMENT0,e_.TEXTURE_2D,r.__webglTexture,l),0!==a?e_.blitFramebuffer(d,p,h,c,f,g,h,c,e_.COLOR_BUFFER_BIT,e_.NEAREST):T?e_.copyTexSubImage3D(v,l,f,g,m+e,d,p,h,c):e_.copyTexSubImage2D(v,l,f,g,d,p,h,c);n.bindFramebuffer(e_.READ_FRAMEBUFFER,null),n.bindFramebuffer(e_.DRAW_FRAMEBUFFER,null)}else T?e.isDataTexture||e.isData3DTexture?e_.texSubImage3D(v,l,f,g,m,h,c,u,y,x,b.data):t.isCompressedArrayTexture?e_.compressedTexSubImage3D(v,l,f,g,m,h,c,u,y,b.data):e_.texSubImage3D(v,l,f,g,m,h,c,u,y,x,b):e.isDataTexture?e_.texSubImage2D(e_.TEXTURE_2D,l,f,g,h,c,y,x,b.data):e.isCompressedTexture?e_.compressedTexSubImage2D(e_.TEXTURE_2D,l,f,g,b.width,b.height,y,b.data):e_.texSubImage2D(e_.TEXTURE_2D,l,f,g,h,c,y,x,b);e_.pixelStorei(e_.UNPACK_ROW_LENGTH,_),e_.pixelStorei(e_.UNPACK_IMAGE_HEIGHT,S),e_.pixelStorei(e_.UNPACK_SKIP_PIXELS,C),e_.pixelStorei(e_.UNPACK_SKIP_ROWS,M),e_.pixelStorei(e_.UNPACK_SKIP_IMAGES,w),0===l&&t.generateMipmaps&&e_.generateMipmap(v),n.unbindTexture()},this.initRenderTarget=function(e){void 0===s.get(e).__webglFramebuffer&&o.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?o.setTextureCube(e,0):e.isData3DTexture?o.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?o.setTexture2DArray(e,0):o.setTexture2D(e,0),n.unbindTexture()},this.resetState=function(){Y=0,K=0,J=null,n.reset(),S.reset()},"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return 2e3}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=ih._getDrawingBufferColorSpace(e),t.unpackColorSpace=ih._getUnpackColorSpace()}}class uA{constructor(e,t,i,r,n){this.xrLight=e,this.renderer=t,this.lightProbe=i,this.xrWebGLBinding=null,this.estimationStartCallback=n,this.frameCallback=this.onXRFrame.bind(this);const a=t.xr.getSession();if(r&&"XRWebGLBinding"in window){e.environment=new nm(16).texture;const i=t.getContext();switch(a.preferredReflectionFormat){case"srgba8":i.getExtension("EXT_sRGB");break;case"rgba16f":i.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(a,i),this.lightProbe.addEventListener("reflectionchange",()=>{this.updateReflection()})}a.requestAnimationFrame(this.frameCallback)}updateReflection(){let e=this.renderer.properties.get(this.xrLight.environment);if(e){let t=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);t&&(e.__webglTexture=t,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(e,t){if(!this.xrLight)return;t.session.requestAnimationFrame(this.frameCallback);let i=t.getLightEstimate(this.lightProbe);if(i){this.xrLight.lightProbe.sh.fromArray(i.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;let e=Math.max(1,Math.max(i.primaryLightIntensity.x,Math.max(i.primaryLightIntensity.y,i.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(i.primaryLightIntensity.x/e,i.primaryLightIntensity.y/e,i.primaryLightIntensity.z/e),this.xrLight.directionalLight.intensity=e,this.xrLight.directionalLight.position.copy(i.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class uf extends nv{constructor(e,t=!0){super(),this.lightProbe=new sW,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new sz,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let i=null,r=!1;e.xr.addEventListener("sessionstart",()=>{let n=e.xr.getSession();"requestLightProbe"in n&&n.requestLightProbe({reflectionFormat:n.preferredReflectionFormat}).then(n=>{i=new uA(this,e,n,t,()=>{r=!0,this.dispatchEvent({type:"estimationstart"})})})}),e.xr.addEventListener("sessionend",()=>{i&&(i.dispose(),i=null),r&&this.dispatchEvent({type:"estimationend"})}),this.dispose=()=>{i&&(i.dispose(),i=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}class ug{constructor(e=50){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(e)}setDecayTime(e){this.naturalFrequency=1/Math.max(.001,e)}update(e,t,i,r){let n=2e-4*this.naturalFrequency;if(null==e||0===r||e===t&&0===this.velocity)return t;if(i<0)return e;let a=e-t,s=this.velocity+this.naturalFrequency*a,o=a+i*s,l=Math.exp(-this.naturalFrequency*i),h=(s-this.naturalFrequency*o)*l,c=-this.naturalFrequency*(h+s*l);return Math.abs(h)<n*Math.abs(r)&&c*a>=0?(this.velocity=0,t):(this.velocity=h,t+o*l)}}let um={MIN_TOUCH_AREA:.05,BASE_RADIUS:.15,LINE_WIDTH:.02,SEGMENTS:16,DELTA_PHI:Math.PI/32,COLORS:{EDGE_FALLOFF:new rP(.98,.98,.98),EDGE_CUTOFF:new rP(.8,.8,.8),FILL_FALLOFF:new rP(.4,.4,.4),FILL_CUTOFF:new rP(.4,.4,.4),ACTIVE_EDGE:new rP(1,1,1),ACTIVE_FILL:new rP(.6,.6,.6)},MAX_OPACITY:.75,ACTIVE_OPACITY:.9,FILL_OPACITY_MULTIPLIER:.5,INTERACTIVE_OPACITY_MULTIPLIER:1.2,MIN_DISTANCE:.5,MAX_DISTANCE:10,BASE_SCALE:1,DISTANCE_SCALE_FACTOR:.3,FADE_IN_DURATION:.12,FADE_OUT_DURATION:.12,SIZE_UPDATE_DURATION:.05,COLOR_LERP_FACTOR:.15,SCREEN_SPACE_SCALE:1.2,SIZE_UPDATE_THRESHOLD:.001,GEOMETRY_UPDATE_DEBOUNCE:100},uv=new t7,ub=(e,t,i,r,n)=>{let a=t>0?i>0?0:-Math.PI/2:i>0?Math.PI/2:Math.PI;for(let s=0;s<=um.SEGMENTS;++s)e.push(t+(r-n)*Math.cos(a),i+(r-n)*Math.sin(a),0,t+r*Math.cos(a),i+r*Math.sin(a),0),a+=um.DELTA_PHI};class uy extends nr{constructor(e,t){super(new r1),this.shadowHeight=0,this.isActive=!1,this.isHovered=!1,this.lastGeometryUpdateTime=0,this.needsGeometryUpdate=!1,this.scene=e,this.side=t,this.currentSize=new it,this.goalSize=new it,this.sizeDamper=new ug,this.updateSizeFromScene(),this.edgeMaterial=new rO({color:um.COLORS.EDGE_FALLOFF,transparent:!0,opacity:0,side:2,depthWrite:!1,blending:2}),this.fillMaterial=new rO({color:um.COLORS.FILL_FALLOFF,transparent:!0,opacity:0,side:2,depthWrite:!1,blending:1}),this.material=this.edgeMaterial,this.goalOpacity=0,this.opacityDamper=new ug,this.createHitMeshes(),this.updatePositionFromScene(),e.target.add(this),e.target.add(this.hitBox),this.offsetHeight=0}updateSizeFromScene(){let{size:e}=this.scene;this.goalSize.copy(e);let t=Math.sqrt(e.x*e.x+e.z*e.z),i=Math.max(um.MIN_TOUCH_AREA,.4*t);this.goalSize.x<i&&(this.goalSize.x=i),this.goalSize.z<i&&(this.goalSize.z=i),this.updateGeometry()}updateGeometry(){let e=this.geometry,t=[],i=[],r=this.goalSize.x/2,n=("back"===this.side?this.goalSize.y:this.goalSize.z)/2,a=Math.min(r,n),s=Math.max(.7*um.BASE_RADIUS,.2*a),o=Math.max(.7*um.LINE_WIDTH,.025*a);ub(i,r,n,s,o),ub(i,-r,n,s,o),ub(i,-r,-n,s,o),ub(i,r,-n,s,o);let l=i.length/3;for(let e=0;e<l-2;e+=2)t.push(e,e+1,e+3,e,e+3,e+2);let h=l-2;t.push(h,h+1,1,h,1,0),e.setAttribute("position",new rj(i,3)),e.setIndex(t),e.computeBoundingSphere()}createHitMeshes(){let e=this.goalSize.x/2,t=("back"===this.side?this.goalSize.y:this.goalSize.z)/2,i=Math.min(e,t),r=Math.max(.7*um.BASE_RADIUS,.2*i);this.hitPlane=new nr(new a9(2*(e+r),2*(t+r))),this.hitPlane.visible=!1,this.hitPlane.material.side=2,this.add(this.hitPlane),this.hitBox=new nr(new na(this.goalSize.x+2*r,this.goalSize.y+r,this.goalSize.z+2*r)),this.hitBox.visible=!1,this.hitBox.material.side=2,this.add(this.hitBox)}updatePositionFromScene(){let{boundingBox:e}=this.scene;switch(e.getCenter(this.position),this.rotation.set(0,0,0),this.side){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=e.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=e.min.z,this.position.z=this.shadowHeight}if(this.hitBox){let t=(this.side,(this.goalSize.y+um.BASE_RADIUS)/2);this.hitBox.position.y=t+e.min.y}}updateFromModelChanges(){this.updateSizeFromScene(),this.updatePositionFromScene(),this.updateGeometry(),this.updateHitMeshes(),this.ensureProperOrientation(),this.needsGeometryUpdate=!1,this.lastGeometryUpdateTime=performance.now()}ensureProperOrientation(){"bottom"===this.side?(this.rotation.x=-Math.PI/2,this.rotation.y=0,this.rotation.z=0):"back"===this.side&&(this.rotation.x=0,this.rotation.y=0,this.rotation.z=0)}setScreenSpaceMode(e){e?this.scale.set(um.SCREEN_SPACE_SCALE,um.SCREEN_SPACE_SCALE,um.SCREEN_SPACE_SCALE):this.scale.set(1,1,1)}updateHitMeshes(){if(this.hitPlane&&this.hitBox){let e=this.goalSize.x/2,t=("back"===this.side?this.goalSize.y:this.goalSize.z)/2,i=Math.min(e,t),r=Math.max(.7*um.BASE_RADIUS,.2*i),n=new a9(2*(e+r),2*(t+r));this.hitPlane.geometry.dispose(),this.hitPlane.geometry=n;let a=new na(this.goalSize.x+2*r,this.goalSize.y+r,this.goalSize.z+2*r);this.hitBox.geometry.dispose(),this.hitBox.geometry=a}}setInteractionState(e,t=!1){this.isActive=e,this.isHovered=t,this.updateVisualState()}updateVisualState(){let e,t;this.isActive?(e=um.COLORS.ACTIVE_EDGE,t=um.COLORS.ACTIVE_FILL):this.isHovered?(e=um.COLORS.EDGE_FALLOFF,t=um.COLORS.FILL_FALLOFF):(e=um.COLORS.EDGE_CUTOFF,t=um.COLORS.FILL_CUTOFF),this.edgeMaterial.color.lerp(e,um.COLOR_LERP_FACTOR),this.fillMaterial.color.lerp(t,um.COLOR_LERP_FACTOR)}applyDistanceScaling(e){let t=e.distanceTo(this.position),i=Math.max(um.MIN_DISTANCE,Math.min(um.MAX_DISTANCE,t)),r=um.BASE_SCALE+(i-um.MIN_DISTANCE)*um.DISTANCE_SCALE_FACTOR;this.scale.set(r,r,r)}getHit(e,t,i){uv.set(t,-i),this.hitPlane.visible=!0;let r=e.positionAndNormalFromPoint(uv,this.hitPlane);return this.hitPlane.visible=!1,null==r?null:r.position}getExpandedHit(e,t,i){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();let r=this.getHit(e,t,i);return this.hitPlane.scale.set(1,1,1),r}controllerIntersection(e,t){this.hitBox.visible=!0;let i=e.hitFromController(t,this.hitBox);return this.hitBox.visible=!1,i}set offsetHeight(e){e-=.001,"back"===this.side?this.position.z=this.shadowHeight+e:this.position.y=this.shadowHeight+e}get offsetHeight(){return"back"===this.side?this.position.z-this.shadowHeight:this.position.y-this.shadowHeight}set show(e){this.goalOpacity=e?um.MAX_OPACITY:0}updateOpacity(e){let t=this.material,i=this.opacityDamper.update(t.opacity,this.goalOpacity,e,1);this.edgeMaterial.opacity=i,this.fillMaterial.opacity=i*um.FILL_OPACITY_MULTIPLIER,(this.isActive||this.isHovered)&&(this.edgeMaterial.opacity=i*um.INTERACTIVE_OPACITY_MULTIPLIER),this.visible=i>0}update(e,t){if(this.updateOpacity(e),!this.currentSize.equals(this.goalSize)){let t=new it;t.x=this.sizeDamper.update(this.currentSize.x,this.goalSize.x,e,1),t.y=this.sizeDamper.update(this.currentSize.y,this.goalSize.y,e,1),t.z=this.sizeDamper.update(this.currentSize.z,this.goalSize.z,e,1),t.distanceTo(this.currentSize)>um.SIZE_UPDATE_THRESHOLD&&(this.currentSize.copy(t),this.needsGeometryUpdate=!0)}let i=performance.now();this.needsGeometryUpdate&&i-this.lastGeometryUpdateTime>um.GEOMETRY_UPDATE_DEBOUNCE&&(this.updateGeometry(),this.updateHitMeshes(),this.needsGeometryUpdate=!1,this.lastGeometryUpdateTime=i),t&&this.applyDistanceScaling(t),this.updateVisualState()}getSize(){return this.goalSize.clone()}dispose(){let{geometry:e,material:t}=this.hitPlane;e.dispose(),t.dispose(),this.hitBox.geometry.dispose(),this.hitBox.material.dispose(),this.geometry.dispose(),this.edgeMaterial.dispose(),this.fillMaterial.dispose(),this.hitBox.removeFromParent(),this.removeFromParent()}}let ux=(e,t)=>({type:"number",number:e,unit:t}),u_=(g={},e=>{let t=e;if(t in g)return g[t];let i=[],r=0;for(;e;){if(++r>1e3){e="";break}let t=uE(e),n=t.nodes[0];if(null==n||0===n.terms.length)break;i.push(n),e=t.remainingInput}return g[t]=i}),uE=(m=/^(\-\-|[a-z\u0240-\uffff])/i,v=/^([\*\+\/]|[\-]\s)/i,b=/^[\),]/,e=>{let t=[];for(;e.length&&(e=e.trim(),!b.test(e));)if("("===e[0]){let{nodes:i,remainingInput:r}=uw(e);e=r,t.push({type:"function",name:{type:"ident",value:"calc"},arguments:i})}else if(m.test(e)){let i=uS(e),r=i.nodes[0];if("("===(e=i.remainingInput)[0]){let{nodes:i,remainingInput:n}=uw(e);t.push({type:"function",name:r,arguments:i}),e=n}else t.push(r)}else if(v.test(e))t.push({type:"operator",value:e[0]}),e=e.slice(1);else{let{nodes:i,remainingInput:r}="#"===e[0]?uM(e):uC(e);if(0===i.length)break;t.push(i[0]),e=r}return{nodes:[{type:"expression",terms:t}],remainingInput:e}}),uS=(y=/[^a-z0-9_\-\u0240-\uffff]/i,e=>{let t=e.match(y);return{nodes:[{type:"ident",value:null==t?e:e.substr(0,t.index)}],remainingInput:null==t?"":e.substr(t.index)}}),uC=(x=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,_=/^[a-z%]+/i,E=/^(m|mm|cm|rad|deg|[%])$/,e=>{let t=e.match(x),i=null==t?"0":t[0],r=(e=null==i?e:e.slice(i.length)).match(_),n=null!=r&&""!==r[0]?r[0]:null,a=null==r?e:e.slice(n.length);return null==n||E.test(n)||(n=null),{nodes:[{type:"number",number:parseFloat(i)||0,unit:n}],remainingInput:a}}),uM=(S=/^[a-f0-9]*/i,e=>{let t=(e=e.slice(1).trim()).match(S);return{nodes:null==t?[]:[{type:"hex",value:t[0]}],remainingInput:null==t?e:e.slice(t[0].length)}}),uw=e=>{let t=[];for(e=e.slice(1).trim();e.length;){let i=uE(e);if(t.push(i.nodes[0]),","===(e=i.remainingInput.trim())[0])e=e.slice(1).trim();else if(")"===e[0]){e=e.slice(1);break}}return{nodes:t,remainingInput:e}},uI=Symbol("visitedTypes");class uT{constructor(e){this[uI]=e}walk(e,t){let i=e.slice();for(;i.length;){let e=i.shift();switch(this[uI].indexOf(e.type)>-1&&t(e),e.type){case"expression":i.unshift(...e.terms);break;case"function":i.unshift(e.name,...e.arguments)}}}}let uB=Object.freeze({type:"number",number:0,unit:null}),uR=(e,t=0)=>{let{number:i,unit:r}=e;if(isFinite(i)){if("rad"===e.unit||null==e.unit)return e}else i=t,r="rad";return{type:"number",number:("deg"===r&&null!=i?i:0)*Math.PI/180,unit:"rad"}},uD=(e,t=0)=>{let i,{number:r,unit:n}=e;if(isFinite(r)){if("m"===e.unit)return e}else r=t,n="m";switch(n){default:i=1;break;case"cm":i=.01;break;case"mm":i=.001}return{type:"number",number:i*r,unit:"m"}},uL=(M={rad:C=e=>e,deg:uR,m:C,mm:uD,cm:uD},(e,t=uB)=>{isFinite(e.number)||(e.number=t.number,e.unit=t.unit);let{unit:i}=e;if(null==i)return e;let r=M[i];return null==r?t:r(e)}),uP=Symbol("evaluate"),uU=Symbol("lastValue");class uF{constructor(){this[te]=null}static evaluatableFor(e,t=uB){if(e instanceof uF)return e;if("number"===e.type)return"%"===e.unit?new uk(e,t):e;switch(e.name.value){case"calc":return new uV(e,t);case"env":return new uG(e)}return uB}static evaluate(e){return e instanceof uF?e.evaluate():e}static isConstant(e){return!(e instanceof uF)||e.isConstant}static applyIntrinsics(e,t){let{basis:i,keywords:r}=t,{auto:n}=r;return i.map((t,i)=>{let a=null==n[i]?t:n[i],s=e[i]?e[i]:a;if("ident"===s.type){let e=s.value;e in r&&(s=r[e][i])}return((null==s||"ident"===s.type)&&(s=a),"%"===s.unit)?ux(s.number/100*t.number,t.unit):(s=uL(s,t)).unit!==t.unit?t:s})}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[uU]||(this[uU]=this[uP]()),this[uU]}}te=uU;let uN=Symbol("percentage"),uO=Symbol("basis");class uk extends uF{constructor(e,t){super(),this[uN]=e,this[uO]=t}get isConstant(){return!0}[uP](){return ux(this[uN].number/100*this[uO].number,this[uO].unit)}}let uQ=Symbol("identNode");class uG extends uF{constructor(e){super(),this[tt]=null;const t=e.arguments.length?e.arguments[0].terms[0]:null;null!=t&&"ident"===t.type&&(this[uQ]=t)}get isConstant(){return!1}[(tt=uQ,uP)](){return null!=this[uQ]&&"window-scroll-y"===this[uQ].value?{type:"number",number:window.pageYOffset/(Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)-window.innerHeight)||0,unit:null}:uB}}let uH=/[\*\/]/,uz=Symbol("evaluator");class uV extends uF{constructor(e,t=uB){if(super(),this[ti]=null,1!==e.arguments.length)return;const i=e.arguments[0].terms.slice(),r=[];for(;i.length;){const e=i.shift();if(r.length>0){const i=r[r.length-1];if("operator"===i.type&&uH.test(i.value)){const i=r.pop(),n=r.pop();if(null==n)return;r.push(new uX(i,uF.evaluatableFor(n,t),uF.evaluatableFor(e,t)));continue}}r.push("operator"===e.type?e:uF.evaluatableFor(e,t))}for(;r.length>2;){const[e,i,n]=r.splice(0,3);if("operator"!==i.type)return;r.unshift(new uX(i,uF.evaluatableFor(e,t),uF.evaluatableFor(n,t)))}1===r.length&&(this[uz]=r[0])}get isConstant(){return null==this[uz]||uF.isConstant(this[uz])}[(ti=uz,uP)](){return null!=this[uz]?uF.evaluate(this[uz]):uB}}let uW=Symbol("operator"),uq=Symbol("left"),uj=Symbol("right");class uX extends uF{constructor(e,t,i){super(),this[uW]=e,this[uq]=t,this[uj]=i}get isConstant(){return uF.isConstant(this[uq])&&uF.isConstant(this[uj])}[uP](){let e,t=uL(uF.evaluate(this[uq])),i=uL(uF.evaluate(this[uj])),{number:r,unit:n}=t,{number:a,unit:s}=i;if(null!=s&&null!=n&&s!=n)return uB;switch(this[uW].value){case"+":e=r+a;break;case"-":e=r-a;break;case"/":e=r/a;break;case"*":e=r*a;break;default:return uB}return{type:"number",number:e,unit:n||s}}}let uY=Symbol("evaluatables"),uK=Symbol("intrinsics");class uJ extends uF{constructor(e,t){super(),this[uK]=t;const i=e[0],r=null!=i?i.terms:[];this[uY]=t.basis.map((e,t)=>{let i=r[t];return null==i?{type:"ident",value:"auto"}:"ident"===i.type?i:uF.evaluatableFor(i,e)})}get isConstant(){for(let e of this[uY])if(!uF.isConstant(e))return!1;return!0}[uP](){let e=this[uY].map(e=>uF.evaluate(e));return uF.applyIntrinsics(e,this[uK]).map(e=>e.number)}}let u$=Symbol("instances"),uZ=Symbol("activateListener"),u0=Symbol("deactivateListener"),u1=Symbol("notifyInstances"),u2=Symbol("notify"),u3=Symbol("callback");class u4{static[u1](){for(let e of u4[u$])e[u2]()}static[(tr=u$,uZ)](){window.addEventListener("scroll",this[u1],{passive:!0})}static[u0](){window.removeEventListener("scroll",this[u1])}constructor(e){this[u3]=e}observe(){0===u4[u$].size&&u4[uZ](),u4[u$].add(this)}disconnect(){u4[u$].delete(this),0===u4[u$].size&&u4[u0]()}[u2](){this[u3]()}}u4[tr]=new Set;let u5=Symbol("computeStyleCallback"),u8=Symbol("astWalker"),u9=Symbol("dependencies"),u6=Symbol("onScroll");class u7{constructor(e){this[tn]={},this[ta]=new uT(["function"]),this[ts]=()=>{this[u5]({relatedState:"window-scroll"})},this[u5]=e}observeEffectsFor(e){let t={},i=this[u9];for(let r in this[u8].walk(e,e=>{let{name:r}=e,n=e.arguments[0].terms[0];if("env"===r.value&&null!=n&&"ident"===n.type&&"window-scroll-y"===n.value&&null==t["window-scroll"]){let e="window-scroll"in i?i["window-scroll"]:new u4(this[u6]);e.observe(),delete i["window-scroll"],t["window-scroll"]=e}}),i)i[r].disconnect();this[u9]=t}dispose(){for(let e in this[u9])this[u9][e].disconnect()}}tn=u9,ta=u8,ts=u6;let de=e=>{let t=e.observeEffects||!1,i=e.intrinsics instanceof Function?e.intrinsics:()=>e.intrinsics;return(r,n)=>{let a=r.updated,s=r.connectedCallback,o=r.disconnectedCallback,l=Symbol(`${n}StyleEffector`),h=Symbol(`${n}StyleEvaluator`),c=Symbol(`${n}UpdateEvaluator`),u=Symbol(`${n}EvaluateAndSync`);Object.defineProperties(r,{[l]:{value:null,writable:!0},[h]:{value:null,writable:!0},[c]:{value:function(){let e=u_(this[n]);this[h]=new uJ(e,i(this)),null==this[l]&&t&&(this[l]=new u7(()=>this[u]())),null!=this[l]&&this[l].observeEffectsFor(e)}},[u]:{value:function(){if(null==this[h])return;let t=this[h].evaluate();this[e.updateHandler](t)}},updated:{value:function(e){e.has(n)&&(this[c](),this[u]()),a.call(this,e)}},connectedCallback:{value:function(){s.call(this),this.requestUpdate(n,this[n])}},disconnectedCallback:{value:function(){o.call(this),null!=this[l]&&(this[l].dispose(),this[l]=null)}}})}},dt=e=>e<.5?2*e*e:-1+(4-2*e)*e,di=(e,t,i=dt)=>r=>e+(t-e)*i(r),dr=e=>{let t,i,r=[],n=[],a=e.initialValue;for(let t=0;t<e.keyframes.length;++t){let i=e.keyframes[t],{value:s,frames:o}=i,l=di(a,s,i.ease||dt);r.push(l),n.push(o),a=s}return i=n.map((t=0,e=>t+=e)),e=>{e=e1(e,0,1)*i[i.length-1];let t=i.findIndex(t=>t>=e),n=t<1?0:i[t-1],a=i[t];return r[t]((e-n)/(a-n))}};var dn=function(e,t,i,r){var n,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(s=(a<3?n(s):a>3?n(t,i,s):n(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let da=dr({initialValue:0,keyframes:[{frames:5,value:-1},{frames:1,value:-1},{frames:8,value:1},{frames:1,value:1},{frames:5,value:0},{frames:18,value:0}]}),ds=dr({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),dl="0deg 75deg 105%",dh=["front","right","back","left"],dc=["upper-","","lower-"],du="auto",dd="wiggle",dp=()=>({basis:[uR(ux(30,"deg"))],keywords:{auto:[null]}}),dA=()=>({basis:[uR(ux(12,"deg"))],keywords:{auto:[null]}}),df=(I=uL((w=u_(dl)[0].terms)[0]),T=uL(w[1]),e=>({basis:[I,T,ux(e[fY].idealCameraDistance(),"m")],keywords:{auto:[null,null,ux(105,"%")]}})),dg=e=>{let t=2.2*e[fY].boundingSphere.radius;return{basis:[ux(-1/0,"rad"),ux(0,"rad"),ux(t,"m")],keywords:{auto:[null,null,null]}}},dm=e=>{let t=new uJ([],df(e)).evaluate()[2];return{basis:[ux(1/0,"rad"),ux(Math.PI,"rad"),ux(t,"m")],keywords:{auto:[null,null,null]}}},dv=e=>{let t=e[fY].boundingBox.getCenter(new it);return{basis:[ux(t.x,"m"),ux(t.y,"m"),ux(t.z,"m")],keywords:{auto:[null,null,null]}}},db=Math.PI/2,dy=Math.PI/3,dx=db/2,d_=2*Math.PI,dE=Symbol("controls"),dS=Symbol("panElement"),dC=Symbol("promptElement"),dM=Symbol("promptAnimatedContainer"),dw=Symbol("fingerAnimatedContainers"),dI=Symbol("deferInteractionPrompt"),dT=Symbol("updateAria"),dB=Symbol("a11y"),dR=Symbol("updateA11y"),dD=Symbol("updateCameraForRadius"),dL=Symbol("cancelPrompts"),dP=Symbol("onChange"),dU=Symbol("onPointerChange"),dF=Symbol("waitingToPromptUser"),dN=Symbol("userHasInteracted"),dO=Symbol("promptElementVisibleTime"),dk=Symbol("lastPromptOffset"),dQ=Symbol("cancellationSource"),dG=Symbol("lastSpherical"),dH=Symbol("jumpCamera"),dz=Symbol("initialized"),dV=Symbol("maintainThetaPhi"),dW=Symbol("syncCameraOrbit"),dq=Symbol("syncFieldOfView"),dj=Symbol("syncCameraTarget"),dX=Symbol("syncMinCameraOrbit"),dY=Symbol("syncMaxCameraOrbit"),dK=Symbol("syncMinFieldOfView"),dJ=Symbol("syncMaxFieldOfView"),d$=new t7,dZ=new it,d0=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:0,maximumPolarAngle:Math.PI,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,touchAction:"none"}),d1=Math.PI/8,d2="user-interaction",d3="none",d4="automatic";class d5 extends t1{constructor(e,t,i){super(),this.camera=e,this.element=t,this.scene=i,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=d3,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new ia,this.panPerPixel=0,this.spherical=new oe,this.goalSpherical=new oe,this.thetaDamper=new ug,this.phiDamper=new ug,this.radiusDamper=new ug,this.logFov=Math.log(d0.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new ug,this.touchMode=null,this.pointers=[],this.startTime=0,this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.onContext=e=>{if(this.enablePan)e.preventDefault();else for(let e of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:e.id})))},this.touchModeZoom=(e,t)=>{if(!this._disableZoom){let e=this.twoTouchDistance(this.pointers[0],this.pointers[1]),t=.04*this.zoomSensitivity*(this.lastSeparation-e)*50/this.scene.height;this.lastSeparation=e,this.userAdjustOrbit(0,0,t)}this.panPerPixel>0&&this.movePan(e,t)},this.disableScroll=e=>{e.preventDefault()},this.touchModeRotate=(e,t)=>{let{touchAction:i}=this._options;if(!this.touchDecided&&"none"!==i){this.touchDecided=!0;let r=Math.abs(e),n=Math.abs(t);if(this.changeSource===d2&&("pan-y"===i&&n>r||"pan-x"===i&&r>n)){this.touchMode=null;return}this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(e,t)},this.onPointerDown=e=>{if(this.pointers.length>2)return;let{element:t}=this;0===this.pointers.length&&(t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp),this.touchMode=null,this.touchDecided=!1,this.startPointerPosition.clientX=e.clientX,this.startPointerPosition.clientY=e.clientY,this.startTime=performance.now());try{t.setPointerCapture(e.pointerId)}catch(e){}this.pointers.push({clientX:e.clientX,clientY:e.clientY,id:e.pointerId}),this.isUserPointing=!1,"touch"===e.pointerType?(this.changeSource=e.altKey?d4:d2,this.onTouchChange(e)):(this.changeSource=d2,this.onMouseDown(e)),this.changeSource===d2&&this.dispatchEvent({type:"user-interaction"})},this.onPointerMove=e=>{let t=this.pointers.find(t=>t.id===e.pointerId);if(null==t)return;if("mouse"===e.pointerType&&0===e.buttons)return void this.onPointerUp(e);let i=this.pointers.length,r=(e.clientX-t.clientX)/i,n=(e.clientY-t.clientY)/i;(0!==r||0!==n)&&(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?d4:d2,null!==this.touchMode&&this.touchMode(r,n)):(this.changeSource=d2,this.panPerPixel>0?this.movePan(r,n):this.handleSinglePointerMove(r,n)))},this.onPointerUp=e=>{let{element:t}=this,i=this.pointers.findIndex(t=>t.id===e.pointerId);-1!==i&&this.pointers.splice(i,1),this.panPerPixel>0&&!e.altKey&&this.resetRadius(),0===this.pointers.length?(t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),t.removeEventListener("touchmove",this.disableScroll),this.enablePan&&this.enableTap&&this.recenter(e)):null!==this.touchMode&&this.onTouchChange(e),this.scene.element[dS].style.opacity=0,t.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=e=>{this.changeSource=d2;let t=e.deltaY*(1==e.deltaMode?18:1)*.04*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,t),e.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=e=>{let{changeSource:t}=this;this.changeSource=d2,(e.shiftKey&&this.enablePan?this.panKeyCodeHandler(e):this.orbitZoomKeyCodeHandler(e))?(e.preventDefault(),this.dispatchEvent({type:"user-interaction"})):this.changeSource=t},this._options=Object.assign({},d0),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this._interactionEnabled}enableInteraction(){if(!1===this._interactionEnabled){let{element:e}=this;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointercancel",this.onPointerUp),this._disableZoom||e.addEventListener("wheel",this.onWheel),e.addEventListener("keydown",this.onKeyDown),e.addEventListener("touchmove",()=>{},{passive:!1}),e.addEventListener("contextmenu",this.onContext),this.element.style.cursor="grab",this._interactionEnabled=!0,this.updateTouchActionStyle()}}disableInteraction(){if(!0===this._interactionEnabled){let{element:e}=this;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),e.removeEventListener("pointercancel",this.onPointerUp),e.removeEventListener("wheel",this.onWheel),e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("contextmenu",this.onContext),e.style.cursor="",this.touchMode=null,this._interactionEnabled=!1,this.updateTouchActionStyle()}}get options(){return this._options}set disableZoom(e){this._disableZoom!=e&&(this._disableZoom=e,!0===e?this.element.removeEventListener("wheel",this.onWheel):this.element.addEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}getCameraSpherical(e=new oe){return e.copy(this.spherical)}getFieldOfView(){return this.camera.fov}applyOptions(e){Object.assign(this._options,e),this.setOrbit(),this.setFieldOfView(Math.exp(this.goalLogFov))}updateNearFar(e,t){this.camera.far=0===t?2:t,this.camera.near=Math.max(e,this.camera.far/1e3),this.camera.updateProjectionMatrix()}updateAspect(e){this.camera.aspect=e,this.camera.updateProjectionMatrix()}setOrbit(e=this.goalSpherical.theta,t=this.goalSpherical.phi,i=this.goalSpherical.radius){let{minimumAzimuthalAngle:r,maximumAzimuthalAngle:n,minimumPolarAngle:a,maximumPolarAngle:s,minimumRadius:o,maximumRadius:l}=this._options,{theta:h,phi:c,radius:u}=this.goalSpherical,d=e1(e,r,n);isFinite(r)||isFinite(n)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-d)+d);let p=e1(t,a,s),A=e1(i,o,l);return(d!==h||p!==c||A!==u)&&!!isFinite(d)&&!!isFinite(p)&&!!isFinite(A)&&(this.goalSpherical.theta=d,this.goalSpherical.phi=p,this.goalSpherical.radius=A,this.goalSpherical.makeSafe(),!0)}setRadius(e){this.goalSpherical.radius=e,this.setOrbit()}setFieldOfView(e){let{minimumFieldOfView:t,maximumFieldOfView:i}=this._options;e=e1(e,t,i),this.goalLogFov=Math.log(e)}setDamperDecayTime(e){this.thetaDamper.setDecayTime(e),this.phiDamper.setDecayTime(e),this.radiusDamper.setDecayTime(e),this.fovDamper.setDecayTime(e)}adjustOrbit(e,t,i){let{theta:r,phi:n,radius:a}=this.goalSpherical,{minimumRadius:s,maximumRadius:o,minimumFieldOfView:l,maximumFieldOfView:h}=this._options,c=this.spherical.theta-r,u=Math.PI-.001,d=r-e1(e,-u-c,u-c),p=0===i?0:((i>0?o:s)-a)/(Math.log(i>0?h:l)-this.goalLogFov),A=a+i*(isFinite(p)?p:(o-s)*2);if(this.setOrbit(d,n-t,A),0!==i){let e=this.goalLogFov+i;this.setFieldOfView(Math.exp(e))}}jumpToGoal(){this.update(0,1e4)}update(e,t){if(this.isStationary())return!1;let{maximumPolarAngle:i,maximumRadius:r}=this._options,n=this.spherical.theta-this.goalSpherical.theta;return!(Math.abs(n)>Math.PI)||isFinite(this._options.minimumAzimuthalAngle)||isFinite(this._options.maximumAzimuthalAngle)||(this.spherical.theta-=2*Math.sign(n)*Math.PI),this.spherical.theta=this.thetaDamper.update(this.spherical.theta,this.goalSpherical.theta,t,Math.PI),this.spherical.phi=this.phiDamper.update(this.spherical.phi,this.goalSpherical.phi,t,i),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,r),this.logFov=this.fovDamper.update(this.logFov,this.goalLogFov,t,1),this.moveCamera(),!0}updateTouchActionStyle(){let{style:e}=this.element;if(this._interactionEnabled){let{touchAction:t}=this._options;this._disableZoom&&"none"!==t?e.touchAction="manipulation":e.touchAction=t}else e.touchAction=""}isStationary(){return this.goalSpherical.theta===this.spherical.theta&&this.goalSpherical.phi===this.spherical.phi&&this.goalSpherical.radius===this.spherical.radius&&this.goalLogFov===this.logFov}moveCamera(){this.spherical.makeSafe(),this.camera.position.setFromSpherical(this.spherical),this.camera.setRotationFromEuler(new i6(this.spherical.phi-Math.PI/2,this.spherical.theta,0,"YXZ")),this.camera.fov!==Math.exp(this.logFov)&&(this.camera.fov=Math.exp(this.logFov),this.camera.updateProjectionMatrix())}userAdjustOrbit(e,t,i){this.adjustOrbit(e*this.orbitSensitivity*this.inputSensitivity,t*this.orbitSensitivity*this.inputSensitivity,i*this.inputSensitivity)}wrapAngle(e){let t=(e+Math.PI)/(2*Math.PI);return 2*(t-Math.floor(t))*Math.PI-Math.PI}pixelLengthToSphericalAngle(e){return 2*Math.PI*e/this.scene.height}twoTouchDistance(e,t){let{clientX:i,clientY:r}=e,{clientX:n,clientY:a}=t,s=n-i,o=a-r;return Math.sqrt(s*s+o*o)}handleSinglePointerMove(e,t){let i=this.pixelLengthToSphericalAngle(e),r=this.pixelLengthToSphericalAngle(t);!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(i,r,0)}initializePan(){let{theta:e,phi:t}=this.spherical,i=e-this.scene.yaw;this.panPerPixel=.018*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(i),-Math.cos(t)*Math.sin(i),0,0,Math.sin(t),0,Math.sin(i),-Math.cos(t)*Math.cos(i),0)}movePan(e,t){let{scene:i}=this,r=dZ.set(e,t,0).multiplyScalar(this.inputSensitivity),n=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;r.multiplyScalar(n);let a=i.getTarget();a.add(r.applyMatrix3(this.panProjection)),i.boundingSphere.clampPoint(a,a),i.setTarget(a.x,a.y,a.z)}recenter(e){if(performance.now()>this.startTime+300||Math.abs(e.clientX-this.startPointerPosition.clientX)>2||Math.abs(e.clientY-this.startPointerPosition.clientY)>2)return;let{scene:t}=this,i=t.positionAndNormalFromPoint(t.getNDC(e.clientX,e.clientY));if(null==i){let{cameraTarget:e}=t.element;t.element.cameraTarget="",t.element.cameraTarget=e,this.userAdjustOrbit(0,0,1)}else t.target.worldToLocal(i.position),t.setTarget(i.position.x,i.position.y,i.position.z)}resetRadius(){let{scene:e}=this,t=e.positionAndNormalFromPoint(d$.set(0,0));if(null==t)return;e.target.worldToLocal(t.position);let i=e.getTarget(),{theta:r,phi:n}=this.spherical,a=r-e.yaw,s=dZ.set(Math.sin(n)*Math.sin(a),Math.cos(n),Math.sin(n)*Math.cos(a)),o=s.dot(t.position.sub(i));i.add(s.multiplyScalar(o)),e.setTarget(i.x,i.y,i.z),this.setOrbit(void 0,void 0,this.goalSpherical.radius-o)}onTouchChange(e){if(1===this.pointers.length)this.touchMode=this.touchModeRotate;else{if(this._disableZoom){this.touchMode=null,this.element.removeEventListener("touchmove",this.disableScroll);return}this.touchMode=this.touchDecided&&null===this.touchMode?null:this.touchModeZoom,this.touchDecided=!0,this.element.addEventListener("touchmove",this.disableScroll,{passive:!1}),this.lastSeparation=this.twoTouchDistance(this.pointers[0],this.pointers[1]),this.enablePan&&null!=this.touchMode&&(this.initializePan(),e.altKey||(this.scene.element[dS].style.opacity=1))}}onMouseDown(e){this.panPerPixel=0,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&(this.initializePan(),this.scene.element[dS].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,.04*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-.04*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-d1,0);break;case"ArrowDown":this.userAdjustOrbit(0,d1,0);break;case"ArrowLeft":this.userAdjustOrbit(-d1,0,0);break;case"ArrowRight":this.userAdjustOrbit(d1,0,0);break;default:t=!1}return t}panKeyCodeHandler(e){this.initializePan();let t=!0;switch(e.key){case"ArrowUp":this.movePan(0,-10);break;case"ArrowDown":this.movePan(0,10);break;case"ArrowLeft":this.movePan(-10,0);break;case"ArrowRight":this.movePan(10,0);break;default:t=!1}return t}}let d8=`<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#e8eaed">
|
|
795
|
+
<path d="M6.4,19L5,17.6L10.6,12L5,6.4L6.4,5L12,10.6L17.6,5L19,6.4L13.4,12L19,17.6L17.6,19L12,13.4L6.4,19Z"/>
|
|
796
|
+
</svg>`,d9=`<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#e8eaed">
|
|
797
|
+
<path d="M7,17V9H5V7H9V17H7ZM11,17V15H13V17H11ZM16,17V9H14V7H18V17H16ZM11,13V11H13V13H11Z"/>
|
|
798
|
+
</svg>`,d6=`<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#E1E2E8">
|
|
799
|
+
<defs>
|
|
800
|
+
<clipPath id="clip0">
|
|
801
|
+
<path d="M0,0h24v24h-24z"/>
|
|
802
|
+
</clipPath>
|
|
803
|
+
</defs>
|
|
804
|
+
<g clip-path="url(#clip0)">
|
|
805
|
+
<path d="M12,22C10.75,22 9.575,21.767 8.475,21.3C7.392,20.817 6.442,20.175 5.625,19.375C4.825,18.558 4.183,17.608 3.7,16.525C3.233,15.425 3,14.25 3,13H5C5,14.95 5.675,16.608 7.025,17.975C8.392,19.325 10.05,20 12,20C13.95,20 15.6,19.325 16.95,17.975C18.317,16.608 19,14.95 19,13C19,11.05 18.317,9.4 16.95,8.05C15.6,6.683 13.95,6 12,6H11.85L13.4,7.55L12,9L8,5L12,1L13.4,2.45L11.85,4H12C13.25,4 14.417,4.242 15.5,4.725C16.6,5.192 17.55,5.833 18.35,6.65C19.167,7.45 19.808,8.4 20.275,9.5C20.758,10.583 21,11.75 21,13C21,14.25 20.758,15.425 20.275,16.525C19.808,17.608 19.167,18.558 18.35,19.375C17.55,20.175 16.6,20.817 15.5,21.3C14.417,21.767 13.25,22 12,22Z"/>
|
|
806
|
+
</g>
|
|
807
|
+
</svg>`,d7={width:.16,height:.07,cornerRadius:.03,opacity:1,color:0,minDistance:.5,maxDistance:10,baseScale:1,distanceScaleFactor:.3};class pe extends rf{constructor(){super(),this.isActualSize=!1,this.preRenderIcons(),this.createPanel(),this.createButtons(),this.opacityDamper=new ug,this.goalOpacity=d7.opacity}createPanel(){let e=new a6(this.createPanelShape()),t=new rO({color:d7.color,opacity:d7.opacity,transparent:!0});this.panelMesh=new nr(e,t),this.panelMesh.name="MenuPanel",this.add(this.panelMesh)}createButtons(){this.exitButton=this.createButton("close"),this.exitButton.name="ExitButton",this.exitButton.position.set(.035,0,.01),this.add(this.exitButton),this.toggleButton=this.createButton("view-real-size"),this.toggleButton.name="ToggleButton",this.toggleButton.position.set(-.035,0,.01),this.add(this.toggleButton)}createPanelShape(){let e=new aQ,{width:t,height:i,cornerRadius:r}=d7;return e.moveTo(-t/2+r,-i/2),e.lineTo(t/2-r,-i/2),e.quadraticCurveTo(t/2,-i/2,t/2,-i/2+r),e.lineTo(t/2,i/2-r),e.quadraticCurveTo(t/2,i/2,t/2-r,i/2),e.lineTo(-t/2+r,i/2),e.quadraticCurveTo(-t/2,i/2,-t/2,i/2-r),e.lineTo(-t/2,-i/2+r),e.quadraticCurveTo(-t/2,-i/2,-t/2+r,-i/2),e}preRenderIcons(){[{key:"close",svg:d8},{key:"view-real-size",svg:d9},{key:"replay",svg:d6}].forEach(({key:e,svg:t})=>{pe.iconTextures.has(e)||this.createTextureFromSvg(t,e)})}createTextureFromSvg(e,t){let i=document.createElement("canvas");i.width=128,i.height=128;let r=i.getContext("2d"),n=new Image,a=new Blob([e],{type:"image/svg+xml"}),s=URL.createObjectURL(a);n.onload=()=>{r.drawImage(n,0,0,128,128);let e=new av(i);e.needsUpdate=!0,e.minFilter=1006,pe.iconTextures.set(t,e),URL.revokeObjectURL(s)},n.src=s}createButton(e){let t=new rO({transparent:!0}),i=new nr(new a9(.05,.05),t),r=pe.iconTextures.get(e);if(r)i.material.map=r,i.material.needsUpdate=!0;else{this.createTextureFromSvg("close"===e?d8:"view-real-size"===e?d9:d6,e);let t=()=>{let r=pe.iconTextures.get(e);r?(i.material.map=r,i.material.needsUpdate=!0):setTimeout(t,10)};t()}return i}exitButtonControllerIntersection(e,t){return e.hitFromController(t,this.exitButton)}scaleModeButtonControllerIntersection(e,t){return e.hitFromController(t,this.toggleButton)}handleScaleToggle(e,t,i,r){if(!e)return null;this.isActualSize=!this.isActualSize;let n=this.isActualSize?"replay":"view-real-size";return this.updateScaleModeButtonLabel(n),Math.max(i,Math.min(r,this.isActualSize?1:t))}updateScaleModeButtonLabel(e){let t=pe.iconTextures.get(e);t&&(this.toggleButton.material.map=t,this.toggleButton.material.needsUpdate=!0)}updatePosition(e,t){if(!t)return;let i=new it;t.getWorldPosition(i);let r=t.getSize(),n=Math.max(.5,Math.min(2,Math.min(r.x,r.z)/1)),a=new it().copy(e.position).sub(i);a.y=0,a.normalize();let s=new it().copy(i).add(new it(0,-.2*n,0)).add(a.multiplyScalar(.9*n));this.position.copy(s);let o=e.position.distanceTo(s),l=Math.max(d7.minDistance,Math.min(d7.maxDistance,o)),h=d7.baseScale+(l-d7.minDistance)*d7.distanceScaleFactor;this.scale.set(h,h,h),this.lookAt(e.position)}set show(e){this.goalOpacity=e?d7.opacity:0}updateOpacity(e){let t=this.panelMesh.material.opacity,i=this.opacityDamper.update(t,this.goalOpacity,e,1);this.traverse(e=>{if(e instanceof nr){let t=e.material;t.transparent&&(t.opacity=i)}}),this.visible=i>0}dispose(){var e;this.children.forEach(e=>{e instanceof nr&&(e.geometry&&e.geometry.dispose(),(Array.isArray(e.material)?e.material:[e.material]).forEach(e=>{e&&("map"in e&&e.map instanceof av&&e.map.dispose(),e.dispose())}))}),null==(e=this.parent)||e.remove(this)}}pe.iconTextures=new Map;let pt=new it(0,1,0),pi="not-presenting",pr="session-started",pn="object-placed",pa="tracking",ps=new it,po=new ie,pl=new i$,ph=new it,pc=new nA(45,1,.1,100),pu=new r1().setFromPoints([new it(0,0,0),new it(0,0,-1)]),pd="screen-space",pp="world-space";class pA extends t1{isWorldSpaceReady(){return this.xrMode===pp&&this.worldSpaceInitialPlacementDone}constructor(e){super(),this.renderer=e,this.currentSession=null,this.placeOnWall=!1,this.placementBox=null,this.menuPanel=null,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.initialHitSource=null,this.transientHitTestSource=null,this.inputSource=null,this._presentedScene=null,this.resolveCleanup=null,this.exitWebXRButtonContainer=null,this.overlay=null,this.xrLight=null,this.xrMode=null,this.xrController1=null,this.xrController2=null,this.selectedXRController=null,this.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new it,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.lastDragPosition=new it,this.deltaRotation=new ie,this.scaleLine=new at(pu),this.firstRatio=0,this.lastAngle=0,this.goalPosition=new it,this.goalYaw=0,this.goalScale=1,this.xDamper=new ug,this.yDamper=new ug,this.zDamper=new ug,this.yawDamper=new ug,this.pitchDamper=new ug,this.rollDamper=new ug,this.scaleDamper=new ug,this.wasTwoFingering=!1,this.worldSpaceInitialPlacementDone=!1,this.initialModelScale=1,this.minScale=1,this.maxScale=1,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onControllerSelectStart=e=>{var t,i,r;let n=this.presentedScene,a=e.target,s=this.menuPanel;if(null!=this.menuPanel.exitButtonControllerIntersection(n,a)){null==(t=this.menuPanel)||t.dispose(),this.stopPresenting();return}if(null!=this.menuPanel.scaleModeButtonControllerIntersection(n,a)){let e=this.menuPanel.handleScaleToggle(this.worldSpaceInitialPlacementDone,this.initialModelScale,this.minScale,this.maxScale);null!==e&&(this.goalScale=e);return}s&&(s.show=!1);let o=this.placementBox.controllerIntersection(n,a);if(null!=o){let e=new iC().setFromObject(n.pivot).min.y+.2;if(o.point.y<=e)null!=this.selectedXRController?(this.selectedXRController.userData.line.visible=!1,n.canScale&&this.isWorldSpaceReady()&&(this.isTwoHandInteraction=!0,this.firstRatio=this.controllerSeparation()/n.pivot.scale.x,this.scaleLine.visible=!0)):a.attach(n.pivot),this.selectedXRController=a,n.setShadowIntensity(.01);else if(a==this.xrController1?this.xrController1.userData.isSelected=!0:a==this.xrController2&&(this.xrController2.userData.isSelected=!0),(null==(i=this.xrController1)?void 0:i.userData.isSelected)&&(null==(r=this.xrController2)?void 0:r.userData.isSelected))n.canScale&&this.isWorldSpaceReady()&&(this.isTwoHandInteraction=!0,this.firstRatio=this.controllerSeparation()/n.pivot.scale.x,this.scaleLine.visible=!0);else{let e=a===this.xrController1?this.xrController2:this.xrController1;a.userData.initialX=a.position.x,e.userData.turning=!1,a.userData.turning=!0,a.userData.line.visible=!1}}},this.onControllerSelectEnd=e=>{let t=e.target;if(t.userData.turning=!1,t.userData.line.visible=!0,this.isTwoHandInteraction=!1,this.scaleLine.visible=!1,t==this.xrController1?this.xrController1.userData.isSelected=!1:t==this.xrController2&&(this.xrController2.userData.isSelected=!1),null!=this.selectedXRController&&this.selectedXRController!=t)return;let i=this.presentedScene;i.attach(i.pivot),this.selectedXRController=null,this.goalYaw=Math.atan2(i.pivot.matrix.elements[8],i.pivot.matrix.elements[10]),this.goalPosition.x=i.pivot.position.x,this.goalPosition.z=i.pivot.position.z,this.isWorldSpaceReady()&&(this.goalPosition.y=i.pivot.position.y),this.menuPanel.show=!0},this.onUpdateScene=()=>{null!=this.placementBox&&this.isPresenting&&(this.placementBox.updateFromModelChanges(),this.placementBox.setScreenSpaceMode(this.xrMode===pd)),this.xrMode!==pd&&(this.menuPanel&&(this.menuPanel.dispose(),this.menuPanel=null),this.menuPanel=new pe,this.presentedScene.add(this.menuPanel),this.menuPanel.updatePosition(this.presentedScene.getCamera(),this.placementBox))},this.onSelectStart=e=>{let t=this.transientHitTestSource;if(null==t)return;let i=this.frame.getHitTestResultsForTransientInput(t),r=this.presentedScene,n=this.placementBox;if(1===i.length){this.inputSource=e.inputSource;let{axes:t}=this.inputSource.gamepad,i=n.getHit(this.presentedScene,t[0],t[1]);n.show=!0,null!=i?(this.isTranslating=!0,this.lastDragPosition.copy(i)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*t[0])}else if(2===i.length){n.show=!0,this.isTwoHandInteraction=!0;let{separation:e,angle:t}=this.fingerPolar(i);this.lastAngle=t,0===this.firstRatio&&(this.firstRatio=e/r.pivot.scale.x),r.canScale&&this.setScale(e);return}},this.onSelectEnd=()=>{this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.inputSource=null,this.goalPosition.y+=this.placementBox.offsetHeight*this.presentedScene.scale.x,this.placementBox.show=!1},this.threeRenderer=e.threeRenderer,this.threeRenderer.xr.enabled=!0}async resolveARSession(){e$();let e=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:[],optionalFeatures:["hit-test","dom-overlay","light-estimation"],domOverlay:this.overlay?{root:this.overlay}:void 0});return this.threeRenderer.xr.setReferenceSpaceType("local"),await this.threeRenderer.xr.setSession(e),this.threeRenderer.xr.cameraAutoUpdate=!1,e}get presentedScene(){return this._presentedScene}async supportsPresentation(){try{return e$(),await navigator.xr.isSessionSupported("immersive-ar")}catch(e){return console.warn("Request to present in WebXR denied:"),console.warn(e),console.warn("Falling back to next ar-mode"),!1}}async present(e,t=!1){this.isPresenting&&console.warn("Cannot present while a model is already presenting");let i=new Promise((e,t)=>{requestAnimationFrame(()=>e())});e.setHotspotsVisibility(!1),e.queueRender(),await i,this._presentedScene=e,this.overlay=e.element.shadowRoot.querySelector("div.default"),!0===t&&(this.xrLight=new uf(this.threeRenderer),this.xrLight.addEventListener("estimationstart",()=>{if(!this.isPresenting||null==this.xrLight)return;let e=this.presentedScene;e.add(this.xrLight),e.environment=this.xrLight.environment}));let r=await this.resolveARSession();r.addEventListener("end",()=>{this.postSessionCleanup()},{once:!0});let n=e.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");n.classList.add("enabled"),n.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=n;let a=await r.requestReferenceSpace("viewer");this.xrMode=r.interactionMode,this.tracking=!0,this.frames=0,this.initialized=!1,this.turntableRotation=e.yaw,this.goalYaw=e.yaw,this.goalScale=1,e.setBackground(null),this.oldShadowIntensity=e.shadowIntensity,e.setShadowIntensity(.01),this.oldTarget.copy(e.getTarget()),e.element.addEventListener("load",this.onUpdateScene);let s=20*Math.PI/180,o=!0===this.placeOnWall?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(s),z:-Math.cos(s)});r.requestHitTestSource({space:a,offsetRay:o}).then(e=>{this.initialHitSource=e}),this.xrMode!==pd&&(this.setupXRControllers(),this.xDamper.setDecayTime(150),this.yDamper.setDecayTime(150),this.zDamper.setDecayTime(150),this.yawDamper.setDecayTime(150),this.pitchDamper.setDecayTime(150),this.rollDamper.setDecayTime(150),this.scaleDamper.setDecayTime(150)),this.currentSession=r,this.placementBox=new uy(e,this.placeOnWall?"back":"bottom"),this.placementBox&&this.placementBox.setScreenSpaceMode(this.xrMode===pd),this.placementComplete=!1,this.xrMode!==pd&&(this.menuPanel=new pe,e.add(this.menuPanel),this.menuPanel.updatePosition(e.getCamera(),this.placementBox)),this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:pr})}setupXRControllerLine(e){if(!e.userData.line){let t=new at(pu);t.name="line",t.scale.z=5,e.userData.turning=!1,e.userData.line=t,e.add(t)}}setupController(e){this.setupXRControllerLine(e),e.addEventListener("selectstart",this.onControllerSelectStart),e.addEventListener("selectend",this.onControllerSelectEnd)}setupXRControllers(){this.xrController1=this.threeRenderer.xr.getController(0),this.xrController2=this.threeRenderer.xr.getController(1),this.setupController(this.xrController1),this.setupController(this.xrController2),this.scaleLine.name="scale line",this.scaleLine.visible=!1,this.xrController1.add(this.scaleLine);let e=this.presentedScene;e.add(this.xrController1),e.add(this.xrController2)}hover(e){if(this.xrMode===pd||this.selectedXRController==e)return!1;let t=this.presentedScene,i=this.placementBox.controllerIntersection(t,e);return e.userData.line.scale.z=null==i?5:i.distance,null!=i}controllerSeparation(){return this.xrController1.position.distanceTo(this.xrController2.position)}async stopPresenting(){if(!this.isPresenting)return;let e=new Promise(e=>{this.resolveCleanup=e});try{await this.currentSession.end(),await e}catch(e){console.warn("Error while trying to end WebXR AR session"),console.warn(e),this.postSessionCleanup()}}get isPresenting(){return null!=this.presentedScene}get target(){return this.oldTarget}updateTarget(){let e=this.presentedScene;if(null!=e){let t=e.getTarget();this.oldTarget.copy(t),this.placeOnWall?t.z=e.boundingBox.min.z:t.y=e.boundingBox.min.y,e.setTarget(t.x,t.y,t.z)}}cleanupXRController(e){e.userData.turning=!1,e.userData.line.visible=!0,e.removeEventListener("selectstart",this.onControllerSelectStart),e.removeEventListener("selectend",this.onControllerSelectEnd),e.removeFromParent()}postSessionCleanup(){let e=this.currentSession;null!=e&&(e.removeEventListener("selectstart",this.onSelectStart),e.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);let t=this.presentedScene;if(this._presentedScene=null,null!=t){let{element:e}=t;null!=this.xrLight&&(t.remove(this.xrLight),this.xrLight.dispose(),this.xrLight=null),null!=this.menuPanel&&(this.menuPanel.dispose(),this.menuPanel=null),t.add(t.pivot),t.pivot.quaternion.set(0,0,0,1),t.pivot.position.set(0,0,0),t.pivot.scale.set(1,1,1),t.setShadowOffset(0);let i=this.turntableRotation;null!=i&&(t.yaw=i);let r=this.oldShadowIntensity;null!=r&&t.setShadowIntensity(r),t.setEnvironmentAndSkybox(e[tU],e[tF]);let n=this.oldTarget;t.setTarget(n.x,n.y,n.z),t.xrCamera=null,t.element.removeEventListener("load",this.onUpdateScene),t.orientHotspots(0);let{width:a,height:s}=e.getBoundingClientRect();t.setSize(a,s),requestAnimationFrame(()=>{t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:d3}}))})}this.renderer.height=0;let i=this.exitWebXRButtonContainer;null!=i&&(i.classList.remove("enabled"),i.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);let r=this.transientHitTestSource;null!=r&&(r.cancel(),this.transientHitTestSource=null);let n=this.initialHitSource;null!=n&&(n.cancel(),this.initialHitSource=null),null!=this.placementBox&&(this.placementBox.dispose(),this.placementBox=null),this.xrMode!==pd&&(null!=this.xrController1&&(this.cleanupXRController(this.xrController1),this.xrController1=null),null!=this.xrController2&&(this.cleanupXRController(this.xrController2),this.xrController2=null),this.selectedXRController=null,this.scaleLine.visible=!1),this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.inputSource=null,this.overlay=null,this.worldSpaceInitialPlacementDone=!1,null!=this.resolveCleanup&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:pi})}updateView(e){let t=this.presentedScene,i=this.threeRenderer.xr;i.updateCamera(pc),t.xrCamera=i.getCamera();let{elements:r}=t.getCamera().matrixWorld;if(t.orientHotspots(Math.atan2(r[1],r[5])),this.initialized||(this.placeInitially(),this.initialized=!0),e.requestViewportScale&&e.recommendedViewportScale){let t=e.recommendedViewportScale;e.requestViewportScale(Math.max(t,.25))}let n=i.getBaseLayer();if(null!=n){let t=n instanceof XRWebGLLayer?n.getViewport(e):i.getBinding().getViewSubImage(n,e).viewport;this.threeRenderer.setViewport(t.x,t.y,t.width,t.height)}}placeInitially(){let e=this.presentedScene,{pivot:t,element:i}=e,{position:r}=t,n=e.getCamera(),{width:a,height:s}=this.overlay.getBoundingClientRect();e.setSize(a,s),n.projectionMatrixInverse.copy(n.projectionMatrix).invert();let{theta:o}=i.getCameraOrbit(),l=n.getWorldDirection(ps);if(e.yaw=Math.atan2(-l.x,-l.z)-o,this.goalYaw=e.yaw,this.xrMode!==pp||this.worldSpaceInitialPlacementDone){if(this.xrMode===pd){let t=Math.max(1,2*e.boundingSphere.radius);r.copy(n.position).add(l.multiplyScalar(t)),this.updateTarget();let i=e.getTarget();r.add(i).sub(this.oldTarget),this.goalPosition.copy(r)}}else{let{position:i,scale:a}=this.calculateWorldSpaceOptimalPlacement(e,n);this.goalPosition.copy(i),this.goalScale=a,this.initialModelScale=a,r.copy(i),t.scale.set(a,a,a),this.worldSpaceInitialPlacementDone=!0,this.calculateWorldSpaceScaleLimits(e),this.enableWorldSpaceUserInteraction()}if(e.setHotspotsVisibility(!0),this.xrMode===pd){let{session:e}=this.frame;e.addEventListener("selectstart",this.onSelectStart),e.addEventListener("selectend",this.onSelectEnd),e.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then(e=>{this.transientHitTestSource=e})}}getTouchLocation(){let{axes:e}=this.inputSource.gamepad,t=this.placementBox.getExpandedHit(this.presentedScene,e[0],e[1]);return null!=t&&(ps.copy(t).sub(this.presentedScene.getCamera().position),ps.length()>10)?null:t}getHitPoint(e){let t=this.threeRenderer.xr.getReferenceSpace(),i=e.getPose(t);if(null==i)return null;let r=pl.fromArray(i.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(r.elements[4],r.elements[6])),r.elements[5]>.75!==this.placeOnWall?ph.setFromMatrixPosition(r):null}moveToFloor(e){if(this.xrMode===pp&&!this.worldSpaceInitialPlacementDone){this.placementBox.show=!1,this.dispatchEvent({type:"status",status:pn});return}let t=this.initialHitSource;if(null==t)return;let i=e.getHitTestResults(t);if(0==i.length)return;let r=i[0],n=this.getHitPoint(r);null!=n&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(n):this.goalPosition.y=n.y),t.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:pn}))}fingerPolar(e){let t=e[0].inputSource.gamepad.axes,i=e[1].inputSource.gamepad.axes,r=i[0]-t[0],n=i[1]-t[1],a=Math.atan2(n,r),s=this.lastAngle-a;return s>Math.PI?s-=2*Math.PI:s<-Math.PI&&(s+=2*Math.PI),{separation:Math.sqrt(r*r+n*n),deltaYaw:s,angle:a}}setScale(e){let t=e/this.firstRatio;t=.2>Math.abs(t-1)?1:t,this.isWorldSpaceReady()&&(t=Math.max(this.minScale,Math.min(this.maxScale,t))),this.goalScale=t}processInput(e){let t=this.transientHitTestSource;if(null==t)return;let i=e.getHitTestResultsForTransientInput(t),r=this.presentedScene,n=r.pivot.scale.x;if(2===i.length){if(!this.wasTwoFingering){let{separation:e,angle:t}=this.fingerPolar(i);this.firstRatio=e/n,this.lastAngle=t,this.wasTwoFingering=!0,this.isTwoHandInteraction=!0;return}let{separation:e,deltaYaw:t,angle:a}=this.fingerPolar(i);this.goalYaw+=t,this.lastAngle=a,r.canScale&&this.setScale(e),this.isTwoHandInteraction=!0;return}if(this.wasTwoFingering&&(this.wasTwoFingering=!1,this.isTwoHandInteraction=!1,this.firstRatio=0),this.isTranslating||this.isTwoHandInteraction||this.isRotating)if(this.isRotating){let e=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=e-this.lastAngle,this.lastAngle=e}else this.isTranslating&&i.forEach(e=>{if(e.inputSource!==this.inputSource)return;let t=null;if(e.results.length>0&&(t=this.getHitPoint(e.results[0])),null==t&&(t=this.getTouchLocation()),null!=t){if(this.goalPosition.sub(this.lastDragPosition),this.isWorldSpaceReady())console.log("[processInput] Setting goalPosition.y to hit.y:",t.y),this.goalPosition.add(t);else if(!1===this.placeOnWall){let e=t.y-this.lastDragPosition.y;if(e<0){this.placementBox.offsetHeight=e/n,this.presentedScene.setShadowOffset(e);let i=ps.copy(r.getCamera().position),a=-e/(i.y-t.y);i.multiplyScalar(a),t.multiplyScalar(1-a).add(i)}this.goalPosition.add(t)}else this.goalPosition.add(t);this.lastDragPosition.copy(t)}})}applyXRControllerRotation(e,t){if(!e.userData.turning)return;let i=(e.position.x-e.userData.initialX)*.3;this.deltaRotation.setFromAxisAngle(pt,i),t.quaternion.multiplyQuaternions(this.deltaRotation,t.quaternion)}handleScalingInXR(e,t){if(this.xrMode===pp&&!this.worldSpaceInitialPlacementDone)return;if(this.xrController1&&this.xrController2&&this.isTwoHandInteraction){let e=this.controllerSeparation();this.setScale(e),this.scaleLine.scale.z=-e,this.scaleLine.lookAt(this.xrController2.position)}let i=e.pivot.scale.x;if(this.goalScale!==i){let r=this.scaleDamper.update(i,this.goalScale,t,1);e.pivot.scale.set(r,r,r)}}updatePivotPosition(e,t){let{pivot:i}=e,r=this.placementBox,n=e.boundingSphere.radius,a=this.goalPosition,s=i.position,o=d3;if(!a.equals(s)){o=d2;let{x:i,y:l,z:h}=s;if(i=this.xDamper.update(i,a.x,t,n),l=this.yDamper.update(l,a.y,t,n),h=this.zDamper.update(h,a.z,t,n),s.set(i,l,h),this.xrMode===pd&&!this.isTranslating){let t=a.y-l;this.placementComplete&&!1===this.placeOnWall?(r.offsetHeight=t/e.pivot.scale.x,e.setShadowOffset(t)):0===t&&(this.placementComplete=!0,r.show=!1,e.setShadowIntensity(.8))}this.xrMode!==pd&&a.equals(s)&&e.setShadowIntensity(.8),this.isWorldSpaceReady()&&e.setShadowIntensity(.8)}if(this.xrMode===pp&&!this.worldSpaceInitialPlacementDone&&this.goalScale!==i.scale.x){let e=this.scaleDamper.update(i.scale.x,this.goalScale,t,1);i.scale.set(e,e,e)}return e.updateTarget(t),o}updateYaw(e,t){po.setFromAxisAngle(ps.set(0,1,0),this.goalYaw);let i=e.pivot.quaternion.angleTo(po),r=i-this.yawDamper.update(i,0,t,Math.PI);e.pivot.quaternion.rotateTowards(po,r)}updateMenuPanel(e,t,i){this.menuPanel&&(this.menuPanel.updateOpacity(i),this.menuPanel.updatePosition(e.getCamera(),t))}applyXRInputToScene(e){let t=this.presentedScene,i=t.pivot,r=this.placementBox;if(this.updatePlacementBoxOpacity(r,e),this.updateTwoHandInteractionState(),this.applyXRControllerRotations(i),this.handleScalingInXR(t,e),i.parent!==t)return void this.updateMenuPanel(t,r,e);let n=this.updatePivotPosition(t,e);this.updateYaw(t,e),this.dispatchCameraChangeEvent(t,n),this.updateMenuPanel(t,r,e)}updatePlacementBoxOpacity(e,t){let i=this.presentedScene.getCamera();e.update(t,i.position);let r=this.hover(this.xrController1),n=this.hover(this.xrController2),a=(r||n)&&!this.isTwoHandInteraction;e.setInteractionState(this.isTranslating||this.isRotating,a)}updateTwoHandInteractionState(){var e,t;let i=(null==(e=this.xrController1)?void 0:e.userData.isSelected)&&(null==(t=this.xrController2)?void 0:t.userData.isSelected);this.isTwoHandInteraction=!!i}applyXRControllerRotations(e){!this.isTwoHandInteraction&&(this.xrController1&&this.applyXRControllerRotation(this.xrController1,e),this.xrController2&&this.applyXRControllerRotation(this.xrController2,e))}dispatchCameraChangeEvent(e,t){e.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:t}}))}updateXRControllerHover(){let e=this.hover(this.xrController1),t=this.hover(this.xrController2),i=(e||t)&&!this.isTwoHandInteraction;this.placementBox&&(this.placementBox.setInteractionState(this.isTranslating||this.isRotating,i),this.placementBox.show=i)}enableWorldSpaceUserInteraction(){this.placementBox&&(this.placementBox.show=!0),this.presentedScene&&this.presentedScene.setShadowIntensity(.8)}handleFirstView(e,t){this.xrMode===pp&&this.worldSpaceInitialPlacementDone||this.moveToFloor(e),this.processInput(e);let i=t-this.lastTick;this.applyXRInputToScene(i),this.renderer.preRender(this.presentedScene,t,i),this.lastTick=t,this.presentedScene.renderShadow(this.threeRenderer)}onWebXRFrame(e,t){this.xrMode!==pd&&this.updateXRControllerHover(),this.frame=t,++this.frames;let i=this.threeRenderer.xr.getReferenceSpace(),r=t.getViewerPose(i);null==r&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:"not-tracking"}));let n=this.presentedScene;if(null==r||null==n||!n.element.loaded)return void this.threeRenderer.clear();!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:pa}));let a=!0;for(let i of r.views)this.updateView(i),a&&(this.handleFirstView(t,e),a=!1),this.threeRenderer.render(n,n.getCamera())}calculateWorldSpaceOptimalPlacement(e,t){let i=e.boundingBox,r={x:(i.max.x-i.min.x)/2,y:(i.max.y-i.min.y)/2,z:(i.max.z-i.min.z)/2},n=Math.max(1.65,2*Math.max(r.x,r.z)+.15),a=15*Math.PI/180,s=new it(0,-n*Math.sin(a),-n*Math.cos(a)),o=t.matrixWorld,l=s.clone().applyMatrix4(o),h=Math.max(r.x,r.z)+.15,c=Math.min(.3*n/Math.max(r.y,.01),.3*n/Math.max(h,.01));return{position:l.clone().sub(new it(0,c*r.y,0)),scale:c}}calculateWorldSpaceScaleLimits(e){let t=e.size,i=Math.max(t.x,t.y,t.z),r=Math.max(Math.min(t.x,t.y,t.z),.001),n=.01/Math.max(i,.001),a=70/Math.max(r,.001);this.minScale=Math.min(n,a,this.goalScale),this.maxScale=Math.max(n,a,this.goalScale)}}let pf=Symbol("prepared"),pg=Symbol("prepare"),pm=Symbol("preparedGLTF"),pv=Symbol("clone");class pb{static prepare(e){if(null==e.scene)throw Error("Model does not have a scene");if(e[pf])return e;let t=this[pg](e);return t[pf]=!0,t}static[pg](e){let{scene:t}=e,i=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:i})}get parser(){return this[pm].parser}get animations(){return this[pm].animations}get scene(){return this[pm].scene}get scenes(){return this[pm].scenes}get cameras(){return this[pm].cameras}get asset(){return this[pm].asset}get userData(){return this[pm].userData}constructor(e){this[pm]=e}clone(){return new this.constructor(this[pv]())}dispose(){this.scenes.forEach(e=>{e.traverse(e=>{e.material&&((Array.isArray(e.material)?e.material:[e.material]).forEach(e=>{for(let t in e){let i=e[t];if(i instanceof ib){let e=i.source.data;null!=e.close&&e.close(),i.dispose()}}e.dispose()}),e.geometry.dispose())})})}[pv](){var e;let t,i,r,n=this[pm],a=(e=this.scene,t=new Map,i=new Map,r=e.clone(),function e(t,i,r){r(t,i);for(let n=0;n<t.children.length;n++)e(t.children[n],i.children[n],r)}(e,r,function(e,r){t.set(r,e),i.set(e,r)}),r.traverse(function(e){if(!e.isSkinnedMesh)return;let r=t.get(e),n=r.skeleton.bones;e.skeleton=r.skeleton.clone(),e.bindMatrix.copy(r.bindMatrix),e.skeleton.bones=n.map(function(e){return i.get(e)}),e.bind(e.skeleton,e.bindMatrix)}),r);py(a,this.scene);let s=[a],o=n.userData?Object.assign({},n.userData):{};return Object.assign(Object.assign({},n),{scene:a,scenes:s,userData:o})}}let py=(e,t)=>{px(e,t,(e,t)=>{void 0!==t.userData.variantMaterials&&(e.userData.variantMaterials=new Map(t.userData.variantMaterials)),void 0!==t.userData.variantData&&(e.userData.variantData=t.userData.variantData),void 0!==t.userData.originalMaterial&&(e.userData.originalMaterial=t.userData.originalMaterial)})},px=(e,t,i)=>{i(e,t);for(let r=0;r<e.children.length;r++)px(e.children[r],t.children[r],i)},p_=Symbol("threeGLTF"),pE=Symbol("gltf"),pS=Symbol("gltfElementMap"),pC=Symbol("threeObjectMap"),pM=Symbol("parallelTraverseThreeScene"),pw=Symbol("correlateOriginalThreeGLTF"),pI=Symbol("correlateCloneThreeGLTF");class pT{static from(e,t){return null!=t?this[pI](e,t):this[pw](e)}static[pw](e){let t=e.parser.json,i=e.parser.associations,r=new Map,n={name:"Default"},a={index:-1};for(let e of i.keys())e instanceof rN&&null==i.get(e)&&(a.index<0&&(null==t.materials&&(t.materials=[]),a.index=t.materials.length,t.materials.push(n)),e.name=n.name,i.set(e,{materials:a.index}));for(let[e,n]of i)for(let i in n&&(e.userData=e.userData||{},e.userData.associations=n),n)if(null!=i&&"primitives"!==i){let a=(t[i]||[])[n[i]];if(null==a)continue;let s=r.get(a);null==s&&(s=new Set,r.set(a,s)),s.add(e)}return new pT(e,t,i,r)}static[pI](e,t){let i=t.threeGLTF,r=JSON.parse(JSON.stringify(t.gltf)),n=new Map,a=new Map;for(let s=0;s<i.scenes.length;s++)this[pM](i.scenes[s],e.scenes[s],(e,i)=>{let s=t.threeObjectMap.get(e);if(null!=s){for(let e in s)if(null!=e&&"primitives"!==e){let t=s[e],o=r[e][t],l=n.get(i)||{};l[e]=t,n.set(i,l);let h=a.get(o)||new Set;h.add(i),a.set(o,h)}}});return new pT(e,r,n,a)}static[pM](e,t,i){let r=(e,t)=>{if(i(e,t),e.isObject3D){if(e.material)if(Array.isArray(e.material))for(let r=0;r<e.material.length;++r)i(e.material[r],t.material[r]);else i(e.material,t.material);for(let i=0;i<e.children.length;++i)r(e.children[i],t.children[i])}};r(e,t)}get threeGLTF(){return this[p_]}get gltf(){return this[pE]}get gltfElementMap(){return this[pS]}get threeObjectMap(){return this[pC]}constructor(e,t,i,r){this[p_]=e,this[pE]=t,this[pS]=r,this[pC]=i}}let pB=Symbol("correlatedSceneGraph");class pR extends pb{static[pg](e){let t=super[pg](e);null==t[pB]&&(t[pB]=pT.from(t));let{scene:i}=t,r=new iz(void 0,1/0);return i.traverse(e=>{if(e.renderOrder=1e3,e.frustumCulled=!1,e.name||(e.name=e.uuid),e.material){let{geometry:i}=e;e.castShadow=!0,e.isSkinnedMesh&&(i.boundingSphere=r,i.boundingBox=null);let n=e.material;if(!0===n.isMeshBasicMaterial&&(n.toneMapped=!1),n.shadowSide=0,n.aoMap){let{gltf:e,threeObjectMap:r}=t[pB],a=r.get(n);if(null!=e.materials&&null!=a&&null!=a.materials){let t=e.materials[a.materials];t.occlusionTexture&&0===t.occlusionTexture.texCoord&&null!=i.attributes.uv&&i.setAttribute("uv2",i.attributes.uv)}}}}),t}get correlatedSceneGraph(){return this[pm][pB]}[pv](){let e=super[pv](),t=new Map;return e.scene.traverse(e=>{if(e.material){let i=e.material;if(null!=i){if(t.has(i.uuid)){e.material=t.get(i.uuid);return}e.material=i.clone(),t.set(i.uuid,e.material)}}void 0!==e.target&&e.add(e.target)}),e[pB]=pT.from(e,this.correlatedSceneGraph),e}}let pD=(e,t,i)=>{let r;switch(e){case 1009:r=new Uint8ClampedArray(t*i*4);break;case 1016:r=new Uint16Array(t*i*4);break;case 1014:r=new Uint32Array(t*i*4);break;case 1010:r=new Int8Array(t*i*4);break;case 1011:r=new Int16Array(t*i*4);break;case 1013:r=new Int32Array(t*i*4);break;case 1015:r=new Float32Array(t*i*4);break;default:throw Error("Unsupported data type")}return r};class pL{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(e){this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const t={format:1023,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:e.renderTargetOptions?.anisotropy!==void 0?e.renderTargetOptions?.anisotropy:1,generateMipmaps:e.renderTargetOptions?.generateMipmaps!==void 0&&e.renderTargetOptions?.generateMipmaps,magFilter:e.renderTargetOptions?.magFilter!==void 0?e.renderTargetOptions?.magFilter:1006,minFilter:e.renderTargetOptions?.minFilter!==void 0?e.renderTargetOptions?.minFilter:1006,samples:e.renderTargetOptions?.samples!==void 0?e.renderTargetOptions?.samples:void 0,wrapS:e.renderTargetOptions?.wrapS!==void 0?e.renderTargetOptions?.wrapS:1001,wrapT:e.renderTargetOptions?.wrapT!==void 0?e.renderTargetOptions?.wrapT:1001};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=pL.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new nx,this._camera=new sG,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!((e,t,i,r)=>{if(void 0!==h)return h;let n=new i_(1,1,r);t.setRenderTarget(n);let a=new nr(new a9,new rO({color:0xffffff}));t.render(a,i),t.setRenderTarget(null);let s=pD(e,n.width,n.height);return t.readRenderTargetPixels(n,0,0,n.width,n.height,s),n.dispose(),a.geometry.dispose(),a.material.dispose(),h=0!==s[0]})(this._type,this._renderer,this._camera,t)){let e;1016===this._type&&(e=this._renderer.extensions.has("EXT_color_buffer_float")?1015:void 0),void 0!==e?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to 1015`),this._type=e):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new nr(new a9,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new i_(this.width,this.height,t),this._renderTarget.texture.mapping=e.renderTargetOptions?.mapping!==void 0?e.renderTargetOptions?.mapping:300}static instantiateRenderer(){let e=new up;return e.setSize(128,128),e}render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)};toArray(){if(!this._supportsReadPixels)throw Error("Can't read pixels in this browser");let e=pD(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){let t=new nF(this.toArray(),this.width,this.height,1023,this._type,e?.mapping||300,e?.wrapS||1001,e?.wrapT||1001,e?.magFilter||1006,e?.minFilter||1006,e?.anisotropy||1,tW);return t.generateMipmaps=e?.generateMipmaps!==void 0&&e?.generateMipmaps,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof nh&&Object.values(this.material.uniforms).forEach(e=>{e.value instanceof ib&&e.value.dispose()}),Object.values(this.material).forEach(e=>{e instanceof ib&&e.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class pP extends Error{}class pU extends Error{}let pF=(e,t,i)=>{let r=RegExp(`${t}="([^"]*)"`,"i").exec(e);if(r)return r[1];let n=RegExp(`<${t}[^>]*>([\\s\\S]*?)</${t}>`,"i").exec(e);if(n){let e=n[1].match(/<rdf:li>([^<]*)<\/rdf:li>/g);return e&&3===e.length?e.map(e=>e.replace(/<\/?rdf:li>/g,"")):n[1].trim()}if(void 0!==i)return i;throw Error(`Can't find ${t} in gainmap metadata`)};class pN{options;constructor(e){this.options={debug:!!e&&void 0!==e.debug&&e.debug,extractFII:!e||void 0===e.extractFII||e.extractFII,extractNonFII:!e||void 0===e.extractNonFII||e.extractNonFII}}extract(e){return new Promise((t,i)=>{let r,n=this.options.debug,a=new DataView(e.buffer);if(65496!==a.getUint16(0))return void i(Error("Not a valid jpeg"));let s=a.byteLength,o=2,l=0;for(;o<s;){if(++l>250)return void i(Error(`Found no marker after ${l} loops 😵`));if(255!==a.getUint8(o))return void i(Error(`Not a valid marker at offset 0x${o.toString(16)}, found: 0x${a.getUint8(o).toString(16)}`));if(r=a.getUint8(o+1),n&&console.log(`Marker: ${r.toString(16)}`),226===r){n&&console.log("Found APP2 marker (0xffe2)");let e=o+4;if(0x4d504600===a.getUint32(e)){let r,n=e+4;if(18761===a.getUint16(n))r=!1;else{if(19789!==a.getUint16(n))return void i(Error("No valid endianness marker found in TIFF header"));r=!0}if(42!==a.getUint16(n+2,!r))return void i(Error("Not valid TIFF data! (no 0x002A marker)"));let s=a.getUint32(n+4,!r);if(s<8)return void i(Error("Not valid TIFF data! (First offset less than 8)"));let o=n+s,l=a.getUint16(o,!r),h=o+2,c=0;for(let e=h;e<h+12*l;e+=12)45057===a.getUint16(e,!r)&&(c=a.getUint32(e+8,!r));let u=o+2+12*l+4,d=[];for(let e=u;e<u+16*c;e+=16){let t={MPType:a.getUint32(e,!r),size:a.getUint32(e+4,!r),dataOffset:a.getUint32(e+8,!r),dependantImages:a.getUint32(e+12,!r),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=n+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,d.push(t)}if(this.options.extractNonFII&&d.length){let e=new Blob([a]),i=[];for(let t of d){if(t.isFII&&!this.options.extractFII)continue;let r=e.slice(t.start,t.end+1,"image/jpeg");i.push(r)}t(i)}}}o+=2+a.getUint16(o+2)}})}}let pO=async e=>{let t=(e=>{let t,i=(t="u">typeof TextDecoder?new TextDecoder().decode(e):e.toString()).indexOf("<x:xmpmeta");for(;-1!==i;){let e=t.indexOf("x:xmpmeta>",i),r=t.slice(i,e+10);try{let e=pF(r,"hdrgm:GainMapMin","0"),t=pF(r,"hdrgm:GainMapMax"),i=pF(r,"hdrgm:Gamma","1"),n=pF(r,"hdrgm:OffsetSDR","0.015625"),a=pF(r,"hdrgm:OffsetHDR","0.015625"),s=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(r),o=s?s[1]:"0",l=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(r);if(!l)throw Error("Incomplete gainmap metadata");let h=l[1];return{gainMapMin:Array.isArray(e)?e.map(e=>parseFloat(e)):[parseFloat(e),parseFloat(e),parseFloat(e)],gainMapMax:Array.isArray(t)?t.map(e=>parseFloat(e)):[parseFloat(t),parseFloat(t),parseFloat(t)],gamma:Array.isArray(i)?i.map(e=>parseFloat(e)):[parseFloat(i),parseFloat(i),parseFloat(i)],offsetSdr:Array.isArray(n)?n.map(e=>parseFloat(e)):[parseFloat(n),parseFloat(n),parseFloat(n)],offsetHdr:Array.isArray(a)?a.map(e=>parseFloat(e)):[parseFloat(a),parseFloat(a),parseFloat(a)],hdrCapacityMin:parseFloat(o),hdrCapacityMax:parseFloat(h)}}catch(e){}i=t.indexOf("<x:xmpmeta",e)}})(e);if(!t)throw new pU("Gain map XMP metadata not found");let i=new pN({extractFII:!0,extractNonFII:!0}),r=await i.extract(e);if(2!==r.length)throw new pP("Gain map recovery image not found");return{sdr:new Uint8Array(await r[0].arrayBuffer()),gainMap:new Uint8Array(await r[1].arrayBuffer()),metadata:t}},pk=e=>new Promise((t,i)=>{let r=document.createElement("img");r.onload=()=>{t(r)},r.onerror=e=>{i(e)},r.src=URL.createObjectURL(e)});class pQ extends sS{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,t){super(t),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new s_}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");let e=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new ib,sdr:new ib});return this._config.createQuadRenderer({width:16,height:16,type:1016,colorSpace:tW,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,i){let r,n,a=t?new Blob([t],{type:"image/jpeg"}):void 0,s=new Blob([e],{type:"image/jpeg"}),o=!1;if("u"<typeof createImageBitmap){let e=await Promise.all([a?pk(a):Promise.resolve(void 0),pk(s)]);n=e[0],r=e[1],o="flipY"===i}else{let e=await Promise.all([a?createImageBitmap(a,{imageOrientation:i||"flipY"}):Promise.resolve(void 0),createImageBitmap(s,{imageOrientation:i||"flipY"})]);n=e[0],r=e[1]}return{sdrImage:r,gainMapImage:n,needsFlip:o}}createTextures(e,t,i){let r=new ib(t||new ImageData(2,2),300,1001,1001,1006,1008,1023,1009,1,tW);r.flipY=i,r.needsUpdate=!0;let n=new ib(e,300,1001,1001,1006,1008,1023,1009,1,"srgb");return n.flipY=i,n.needsUpdate=!0,{gainMap:r,sdr:n}}updateQuadRenderer(e,t,i,r,n){e.width=t.width,e.height=t.height,e.material.gainMap=i,e.material.sdr=r,e.material.gainMapMin=n.gainMapMin,e.material.gainMapMax=n.gainMapMax,e.material.offsetHdr=n.offsetHdr,e.material.offsetSdr=n.offsetSdr,e.material.gamma=n.gamma,e.material.hdrCapacityMin=n.hdrCapacityMin,e.material.hdrCapacityMax=n.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,n.hdrCapacityMax),e.material.needsUpdate=!0}}let pG=`
|
|
808
|
+
varying vec2 vUv;
|
|
809
|
+
|
|
810
|
+
void main() {
|
|
811
|
+
vUv = uv;
|
|
812
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
813
|
+
}
|
|
814
|
+
`,pH=`
|
|
815
|
+
// min half float value
|
|
816
|
+
#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )
|
|
817
|
+
// max half float value
|
|
818
|
+
#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )
|
|
819
|
+
|
|
820
|
+
uniform sampler2D sdr;
|
|
821
|
+
uniform sampler2D gainMap;
|
|
822
|
+
uniform vec3 gamma;
|
|
823
|
+
uniform vec3 offsetHdr;
|
|
824
|
+
uniform vec3 offsetSdr;
|
|
825
|
+
uniform vec3 gainMapMin;
|
|
826
|
+
uniform vec3 gainMapMax;
|
|
827
|
+
uniform float weightFactor;
|
|
828
|
+
|
|
829
|
+
varying vec2 vUv;
|
|
830
|
+
|
|
831
|
+
void main() {
|
|
832
|
+
vec3 rgb = texture2D( sdr, vUv ).rgb;
|
|
833
|
+
vec3 recovery = texture2D( gainMap, vUv ).rgb;
|
|
834
|
+
vec3 logRecovery = pow( recovery, gamma );
|
|
835
|
+
vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;
|
|
836
|
+
vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;
|
|
837
|
+
vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));
|
|
838
|
+
gl_FragColor = vec4( clampedHdrColor , 1.0 );
|
|
839
|
+
}
|
|
840
|
+
`;class pz extends nh{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:i,gainMapMin:r,gainMapMax:n,maxDisplayBoost:a,hdrCapacityMin:s,hdrCapacityMax:o,sdr:l,gainMap:h}){super({name:"GainMapDecoderMaterial",vertexShader:pG,fragmentShader:pH,uniforms:{sdr:{value:l},gainMap:{value:h},gamma:{value:new it(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new it().fromArray(t)},offsetSdr:{value:new it().fromArray(i)},gainMapMin:{value:new it().fromArray(r)},gainMapMax:{value:new it().fromArray(n)},weightFactor:{value:(Math.log2(a)-s)/(o-s)}},blending:0,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=a,this._hdrCapacityMin=s,this._hdrCapacityMax=o,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){let e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){let t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){let e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class pV extends pQ{constructor(e,t){super({renderer:e,createMaterial:e=>new pz(e),createQuadRenderer:e=>new pL(e)},t)}async render(e,t,i,r){let{sdrImage:n,gainMapImage:a,needsFlip:s}=await this.processImages(i,r,"flipY"),{gainMap:o,sdr:l}=this.createTextures(n,a,s);this.updateQuadRenderer(e,n,o,l,t),e.render()}}class pW extends pV{load(e,t,i,r){let n=this.prepareQuadRenderer(),a=new sw(this._internalLoadingManager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(this.withCredentials),this.manager.itemStart(e),a.load(e,async i=>{let a,s,o;if("string"==typeof i)throw Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");let l=new Uint8Array(i);try{let e=await pO(l);a=e.sdr,s=e.gainMap,o=e.metadata}catch(t){if(t instanceof pU||t instanceof pP)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),o={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},a=l;else throw t}try{await this.render(n,o,a.buffer,s?.buffer)}catch(t){this.manager.itemError(e),"function"==typeof r&&r(t),n.disposeOnDemandRenderer();return}"function"==typeof t&&t(n),this.manager.itemEnd(e),n.disposeOnDemandRenderer()},i,t=>{this.manager.itemError(e),"function"==typeof r&&r(t)}),n}}class pq extends sB{constructor(e){super(e),this.type=1016}parse(e){let t,i,r,n=function(e,t){switch(e){case 1:throw Error("THREE.HDRLoader: Read Error: "+(t||""));case 2:throw Error("THREE.HDRLoader: Write Error: "+(t||""));case 3:throw Error("THREE.HDRLoader: Bad File Format: "+(t||""));default:throw Error("THREE.HDRLoader: Memory Error: "+(t||""))}},a=function(e,t,i){t=t||1024;let r=e.pos,n=-1,a=0,s="",o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));for(;0>(n=o.indexOf("\n"))&&a<t&&r<e.byteLength;)s+=o,a+=o.length,r+=128,o+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));return -1<n&&(!1!==i&&(e.pos+=a+n+1),s+o.slice(0,n))},s=new Uint8Array(e);s.pos=0;let o=function(e){let t,i,r=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,o=/^\s*FORMAT=(\S+)\s*$/,l=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,h={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};for(!(e.pos>=e.byteLength)&&(t=a(e))||n(1,"no header found"),(i=t.match(/^#\?(\S+)/))||n(3,"bad initial token"),h.valid|=1,h.programtype=i[1],h.string+=t+"\n";!1!==(t=a(e));){if(h.string+=t+"\n","#"===t.charAt(0)){h.comments+=t+"\n";continue}if((i=t.match(r))&&(h.gamma=parseFloat(i[1])),(i=t.match(s))&&(h.exposure=parseFloat(i[1])),(i=t.match(o))&&(h.valid|=2,h.format=i[1]),(i=t.match(l))&&(h.valid|=4,h.height=parseInt(i[1],10),h.width=parseInt(i[2],10)),2&h.valid&&4&h.valid)break}return 2&h.valid||n(3,"missing format specifier"),4&h.valid||n(3,"missing image size specifier"),h}(s),l=o.width,h=o.height,c=function(e,t,i){if(t<8||t>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);t!==(e[2]<<8|e[3])&&n(3,"wrong scanline width");let r=new Uint8Array(4*t*i);r.length||n(4,"unable to allocate buffer space");let a=0,s=0,o=4*t,l=new Uint8Array(4),h=new Uint8Array(o),c=i;for(;c>0&&s<e.byteLength;){s+4>e.byteLength&&n(1),l[0]=e[s++],l[1]=e[s++],l[2]=e[s++],l[3]=e[s++],(2!=l[0]||2!=l[1]||(l[2]<<8|l[3])!=t)&&n(3,"bad rgbe scanline format");let i=0,u;for(;i<o&&s<e.byteLength;){let t=(u=e[s++])>128;if(t&&(u-=128),(0===u||i+u>o)&&n(3,"bad scanline data"),t){let t=e[s++];for(let e=0;e<u;e++)h[i++]=t}else h.set(e.subarray(s,s+u),i),i+=u,s+=u}for(let e=0;e<t;e++){let i=0;r[a]=h[e+i],i+=t,r[a+1]=h[e+i],i+=t,r[a+2]=h[e+i],i+=t,r[a+3]=h[e+i],a+=4}c--}return r}(s.subarray(s.pos),l,h);switch(this.type){case 1015:let u=new Float32Array(4*(r=c.length/4));for(let e=0;e<r;e++)!function(e,t,i,r){let n=Math.pow(2,e[t+3]-128)/255;i[r+0]=e[t+0]*n,i[r+1]=e[t+1]*n,i[r+2]=e[t+2]*n,i[r+3]=1}(c,4*e,u,4*e);t=u,i=1015;break;case 1016:let d=new Uint16Array(4*(r=c.length/4));for(let e=0;e<r;e++)!function(e,t,i,r){let n=Math.pow(2,e[t+3]-128)/255;i[r+0]=rQ.toHalfFloat(Math.min(e[t+0]*n,65504)),i[r+1]=rQ.toHalfFloat(Math.min(e[t+1]*n,65504)),i[r+2]=rQ.toHalfFloat(Math.min(e[t+2]*n,65504)),i[r+3]=rQ.toHalfFloat(1)}(c,4*e,d,4*e);t=d,i=1016;break;default:throw Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:l,height:h,data:t,header:o.string,gamma:o.gamma,exposure:o.exposure,type:i}}setDataType(e){return this.type=e,this}load(e,t,i,r){return super.load(e,function(e,i){switch(e.type){case 1015:case 1016:e.colorSpace=tW,e.minFilter=1006,e.magFilter=1006,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,i)},i,r)}}class pj extends pq{constructor(e){console.warn("RGBELoader has been deprecated. Please use HDRLoader instead."),super(e)}}let pX={topLight:{intensity:500,position:[.418,16.199,.3]},room:{position:[-.757,13.219,.717],scale:[31.713,28.305,28.591]},boxes:[{position:[-10.906,2.009,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,.857,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:50,position:[-16.116,14.37,8.208],scale:[.1,2.428,2.739]},{intensity:50,position:[-16.109,18.021,-8.207],scale:[.1,2.425,2.751]},{intensity:17,position:[14.904,12.198,-1.832],scale:[.15,4.265,6.331]},{intensity:43,position:[-.462,8.89,14.52],scale:[4.38,5.441,.088]},{intensity:20,position:[3.235,11.486,-12.541],scale:[2.5,2,.1]},{intensity:100,position:[0,20,0],scale:[1,.1,1]}]},pY={topLight:{intensity:400,position:[.5,14,.5]},room:{position:[0,13.2,0],scale:[31.5,28.5,31.5]},boxes:[{position:[-10.906,-1,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,-.16,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:80,position:[-14,10,8],scale:[.1,2.5,2.5]},{intensity:80,position:[-14,14,-4],scale:[.1,2.5,2.5]},{intensity:23,position:[14,12,0],scale:[.1,5,5]},{intensity:16,position:[0,9,14],scale:[5,5,.1]},{intensity:80,position:[7,8,-14],scale:[2.5,2.5,.1]},{intensity:80,position:[-7,16,-14],scale:[2.5,2.5,.1]},{intensity:1,position:[0,20,0],scale:[.1,.1,.1]}]};class pK extends nx{constructor(e){super(),this.position.y=-3.5;const t=new na;t.deleteAttribute("uv");const i=new st({metalness:0,side:1}),r=new st({metalness:0}),n="legacy"==e?pX:pY,a=new sQ(0xffffff,n.topLight.intensity,28,2);a.position.set(...n.topLight.position),this.add(a);const s=new nr(t,i);for(const e of(s.position.set(...n.room.position),s.scale.set(...n.room.scale),this.add(s),n.boxes)){const i=new nr(t,r);i.position.set(...e.position),i.rotation.set(0,e.rotation,0),i.scale.set(...e.scale),this.add(i)}for(const e of n.lights){const i=new nr(t,this.createAreaLightMaterial(e.intensity));i.position.set(...e.position),i.scale.set(...e.scale),this.add(i)}}createAreaLightMaterial(e){let t=new rO;return t.color.setScalar(e),t}}let pJ=/\.hdr(\.js)?$/;class p${constructor(e){this.threeRenderer=e,this.lottieLoaderUrl="",this._ldrLoader=null,this._imageLoader=null,this._hdrLoader=null,this._lottieLoader=null,this.generatedEnvironmentMap=null,this.generatedEnvironmentMapAlt=null,this.skyboxCache=new Map,this.blurMaterial=null,this.blurScene=null}ldrLoader(e){return null==this._ldrLoader&&(this._ldrLoader=new sR),this._ldrLoader.setWithCredentials(e),this._ldrLoader}imageLoader(e){return null==this._imageLoader&&(this._imageLoader=new pW(this.threeRenderer)),this._imageLoader.setWithCredentials(e),this._imageLoader}hdrLoader(e){return null==this._hdrLoader&&(this._hdrLoader=new pj,this._hdrLoader.setDataType(1016)),this._hdrLoader.setWithCredentials(e),this._hdrLoader}async getLottieLoader(e){if(null==this._lottieLoader){let{LottieLoader:e}=await import(this.lottieLoaderUrl);this._lottieLoader=new e}return this._lottieLoader.setWithCredentials(e),this._lottieLoader}async loadImage(e,t){let i=await new Promise((i,r)=>this.ldrLoader(t).load(e,i,()=>{},r));return i.name=e,i.flipY=!1,i}async loadLottie(e,t,i){let r=await this.getLottieLoader(i);r.setQuality(t);let n=await new Promise((t,i)=>r.load(e,t,()=>{},i));return n.name=e,n}async loadEquirect(e,t=!1,i=()=>{}){try{let r=pJ.test(e),n=r?this.hdrLoader(t):this.imageLoader(t),a=await new Promise((t,r)=>n.load(e,e=>{let{renderTarget:i}=e;if(null!=i){let{texture:r}=i;e.dispose(!1),t(r)}else t(e)},e=>{i(e.loaded/e.total*.9)},r));return i(1),a.name=e,a.mapping=303,r||(a.colorSpace="srgb"),a}finally{i&&i(1)}}async generateEnvironmentMapAndSkybox(e=null,t=null,i=()=>{},r=!1){let n,a="legacy"!==t;("legacy"===t||"neutral"===t)&&(t=null),t=eJ(t);let s=Promise.resolve(null);e&&(s=this.loadEquirectFromUrl(e,r,i)),n=t?this.loadEquirectFromUrl(t,r,i):e?this.loadEquirectFromUrl(e,r,i):a?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();let[o,l]=await Promise.all([n,s]);if(null==o)throw Error("Failed to load environment map.");return{environmentMap:o,skybox:l}}async loadEquirectFromUrl(e,t,i){if(!this.skyboxCache.has(e)){let r=this.loadEquirect(e,t,i);this.skyboxCache.set(e,r)}return this.skyboxCache.get(e)}async GenerateEnvironmentMap(e,t){await ((e=0)=>new Promise(t=>setTimeout(t,e)))();let i=this.threeRenderer,r=new nm(256,{generateMipmaps:!1,type:1016,format:1023,colorSpace:tW,depthBuffer:!0}),n=new nf(.1,100,r),a=n.renderTarget.texture;a.name=t;let s=i.outputColorSpace,o=i.toneMapping;return i.toneMapping=0,i.outputColorSpace=tW,n.update(i,e),this.blurCubemap(r,.04),i.toneMapping=o,i.outputColorSpace=s,a}async loadGeneratedEnvironmentMap(){return null==this.generatedEnvironmentMap&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new pK("legacy"),"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return null==this.generatedEnvironmentMapAlt&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new pK("neutral"),"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(e,t){if(null==this.blurMaterial){this.blurMaterial=this.getBlurShader(20);let e=new nr(new na,this.blurMaterial);this.blurScene=new nx,this.blurScene.add(e)}let i=e.clone();this.halfblur(e,i,t,"latitudinal"),this.halfblur(i,e,t,"longitudinal")}halfblur(e,t,i,r){let n=e.width,a=isFinite(i)?Math.PI/(2*n):2*Math.PI/39,s=i/a,o=isFinite(i)?1+Math.floor(3*s):20;o>20&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${o} samples when the maximum is set to 20`);let l=[],h=0;for(let e=0;e<20;++e){let t=e/s,i=Math.exp(-t*t/2);l.push(i),0==e?h+=i:e<o&&(h+=2*i)}for(let e=0;e<l.length;e++)l[e]=l[e]/h;let c=this.blurMaterial.uniforms;c.envMap.value=e.texture,c.samples.value=o,c.weights.value=l,c.latitudinal.value="latitudinal"===r,c.dTheta.value=a,new nf(.1,100,t).update(this.threeRenderer,this.blurScene)}getBlurShader(e){let t=new Float32Array(e);return new nh({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:new it(0,1,0)}},vertexShader:`
|
|
841
|
+
|
|
842
|
+
varying vec3 vOutputDirection;
|
|
843
|
+
|
|
844
|
+
void main() {
|
|
845
|
+
|
|
846
|
+
vOutputDirection = vec3( position );
|
|
847
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
848
|
+
|
|
849
|
+
}
|
|
850
|
+
`,fragmentShader:`
|
|
851
|
+
varying vec3 vOutputDirection;
|
|
852
|
+
|
|
853
|
+
uniform samplerCube envMap;
|
|
854
|
+
uniform int samples;
|
|
855
|
+
uniform float weights[ n ];
|
|
856
|
+
uniform bool latitudinal;
|
|
857
|
+
uniform float dTheta;
|
|
858
|
+
uniform vec3 poleAxis;
|
|
859
|
+
|
|
860
|
+
vec3 getSample( float theta, vec3 axis ) {
|
|
861
|
+
|
|
862
|
+
float cosTheta = cos( theta );
|
|
863
|
+
// Rodrigues' axis-angle rotation
|
|
864
|
+
vec3 sampleDirection = vOutputDirection * cosTheta
|
|
865
|
+
+ cross( axis, vOutputDirection ) * sin( theta )
|
|
866
|
+
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
|
|
867
|
+
|
|
868
|
+
return vec3( textureCube( envMap, sampleDirection ) );
|
|
869
|
+
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
void main() {
|
|
873
|
+
|
|
874
|
+
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
|
|
875
|
+
|
|
876
|
+
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
|
|
877
|
+
|
|
878
|
+
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
|
|
879
|
+
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
axis = normalize( axis );
|
|
883
|
+
|
|
884
|
+
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
885
|
+
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
|
|
886
|
+
|
|
887
|
+
for ( int i = 1; i < n; i++ ) {
|
|
888
|
+
|
|
889
|
+
if ( i >= samples ) {
|
|
890
|
+
|
|
891
|
+
break;
|
|
892
|
+
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
float theta = dTheta * float( i );
|
|
896
|
+
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
|
|
897
|
+
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
|
|
898
|
+
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
`,blending:0,depthTest:!1,depthWrite:!1,side:1})}async dispose(){for(let[,e]of this.skyboxCache)(await e).dispose();null!=this.generatedEnvironmentMap&&((await this.generatedEnvironmentMap).dispose(),this.generatedEnvironmentMap=null),null!=this.generatedEnvironmentMapAlt&&((await this.generatedEnvironmentMapAlt).dispose(),this.generatedEnvironmentMapAlt=null),null!=this.blurMaterial&&this.blurMaterial.dispose()}}let pZ=[1,.79,.62,.5,.4,.31,.25],p0="high-performance";class p1 extends t1{static get singleton(){return this._singleton||(this._singleton=new p1({powerPreference:(self.ModelViewerElement||{}).powerPreference||p0,debug:e2()})),this._singleton}static resetSingleton(){let e=this._singleton.dispose();for(let t of e)t.disconnectedCallback();for(let t of(this._singleton=new p1({powerPreference:(self.ModelViewerElement||{}).powerPreference||p0,debug:e2()}),e))t.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return pZ[this.scaleStep]}set minScale(e){let t=1;for(;t<pZ.length&&!(pZ[t]<e);)++t;this.lastStep=t-1}constructor(e){super(),this.loader=new lg(pR),this.width=0,this.height=0,this.dpr=1,this.scenes=new Set,this.multipleScenesVisible=!1,this.lastTick=performance.now(),this.renderedLastFrame=!1,this.scaleStep=0,this.lastStep=3,this.avgFrameDuration=50,this.onWebGLContextLost=e=>{this.dispatchEvent({type:"contextlost",sourceEvent:e})},this.onWebGLContextRestored=()=>{var e;for(let t of(null==(e=this.textureUtils)||e.dispose(),this.textureUtils=this.canRender?new p$(this.threeRenderer):null,this.scenes))t.element[tN]()},this.dpr=window.devicePixelRatio,this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show");try{this.threeRenderer=new up({canvas:this.canvas3D,alpha:!0,antialias:!0,powerPreference:e.powerPreference,preserveDrawingBuffer:!0}),this.threeRenderer.autoClear=!0,this.threeRenderer.setPixelRatio(1),this.threeRenderer.debug={checkShaderErrors:!!e.debug,onShaderError:null},this.threeRenderer.toneMapping=7}catch(e){console.warn(e)}this.arRenderer=this.canRender?new pA(this):null,this.textureUtils=this.canRender?new p$(this.threeRenderer):null,this.canRender&&lg.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize()}registerScene(e){if(this.scenes.add(e),e.forceRescale(),this.canRender){let t=new t7;this.threeRenderer.getSize(t),e.canvas.width=t.x,e.canvas.height=t.y,this.scenes.size>0&&this.threeRenderer.setAnimationLoop((e,t)=>this.render(e,t))}}unregisterScene(e){this.scenes.delete(e),this.canvas3D.parentElement===e.canvas.parentElement&&e.canvas.parentElement.removeChild(this.canvas3D),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null)}displayCanvas(e){return e.element.modelIsVisible&&!this.multipleScenesVisible?this.canvas3D:e.element[fX]}countVisibleScenes(){let{canvas3D:e}=this,t=0,i=null;for(let r of this.scenes){let{element:n}=r;n.modelIsVisible&&null==r.externalRenderer&&++t,e.parentElement===r.canvas.parentElement&&(i=r)}let r=t>1;if(null!=i){let t=r&&!this.multipleScenesVisible,n=!i.element.modelIsVisible;if(t||n){let{width:t,height:r}=this.sceneSize(i);this.copyPixels(i,t,r),e.parentElement.removeChild(e)}}this.multipleScenesVisible=r}updateRendererSize(){var e;let t=window.devicePixelRatio;if(t!==this.dpr)for(let e of this.scenes){let{element:t}=e;t[fU](t.getBoundingClientRect())}let i=0,r=0;for(let e of this.scenes)i=Math.max(i,e.width),r=Math.max(r,e.height);if(i!==this.width||r!==this.height||t!==this.dpr)for(let n of(this.width=i,this.height=r,this.dpr=t,i=Math.ceil(i*t),r=Math.ceil(r*t),this.canRender&&this.threeRenderer.setSize(i,r,!1),this.scenes)){let{canvas:t}=n;t.width=i,t.height=r,n.forceRescale(),null==(e=n.effectRenderer)||e.setSize(i,r)}}updateRendererScale(e){let t=this.scaleStep;this.avgFrameDuration+=e1(.2*(e-this.avgFrameDuration),-5,5),this.avgFrameDuration>60?++this.scaleStep:this.avgFrameDuration<40&&this.scaleStep>0&&--this.scaleStep,this.scaleStep=Math.min(this.scaleStep,this.lastStep),t!==this.scaleStep&&(this.avgFrameDuration=50)}shouldRender(e){if(e.shouldRender())e.scaleStep!=this.scaleStep&&(e.scaleStep=this.scaleStep,this.rescaleCanvas(e));else{if(0==e.scaleStep)return!1;e.scaleStep=0,this.rescaleCanvas(e)}return!0}rescaleCanvas(e){let t=pZ[e.scaleStep],i=Math.ceil(this.width/t),r=Math.ceil(this.height/t),{style:n}=e.canvas;n.width=`${i}px`,n.height=`${r}px`,this.canvas3D.style.width=`${i}px`,this.canvas3D.style.height=`${r}px`;let a=this.dpr*t,s=t<1?"GPU throttling":this.dpr!==window.devicePixelRatio?"No meta viewport tag":"";e.element.dispatchEvent(new CustomEvent("render-scale",{detail:{reportedDpr:window.devicePixelRatio,renderedDpr:a,minimumDpr:this.dpr*pZ[this.lastStep],pixelWidth:Math.ceil(e.width*a),pixelHeight:Math.ceil(e.height*a),reason:s}}))}sceneSize(e){let{dpr:t}=this,i=pZ[e.scaleStep];return{width:Math.min(Math.ceil(e.width*i*t),this.canvas3D.width),height:Math.min(Math.ceil(e.height*i*t),this.canvas3D.height)}}copyPixels(e,t,i){let r=e.context;null==r?console.log("could not acquire 2d context"):(r.clearRect(0,0,t,i),r.drawImage(this.canvas3D,0,0,t,i,0,0,t,i),e.canvas.classList.add("show"))}orderedScenes(){let e=[];for(let t of[!1,!0])for(let i of this.scenes)i.element.modelIsVisible===t&&e.push(i);return e}get isPresenting(){var e;return(null==(e=this.arRenderer)?void 0:e.isPresenting)===!0}preRender(e,t,i){let{element:r,exposure:n,toneMapping:a}=e;r[fJ](t,i);let s="number"==typeof n&&!Number.isNaN(n),o=r.environmentImage,l=r.skyboxImage;this.threeRenderer.toneMappingExposure=(s?n:1)*(7!==a||"neutral"!==o&&"legacy"!==o&&(o||l)?1:1.3)}render(e,t){if(null!=t){null!=this.arRenderer&&this.arRenderer.onWebXRFrame(e,t);return}let i=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(i),this.renderedLastFrame=!1);let{canvas3D:r}=this;for(let t of this.orderedScenes()){let{element:n}=t;if(!n.loaded||!n.modelIsVisible&&t.renderCount>0||(this.preRender(t,e,i),!this.shouldRender(t)))continue;if(null!=t.externalRenderer){let e=t.getCamera();e.updateMatrix();let{matrix:i,projectionMatrix:r}=e,n=i.elements.slice(),a=t.getTarget();n[12]+=a.x,n[13]+=a.y,n[14]+=a.z,t.externalRenderer.render({viewMatrix:n,projectionMatrix:r.elements});continue}if(!n.modelIsVisible&&!this.multipleScenesVisible)for(let e of this.scenes)e.element.modelIsVisible&&e.queueRender();let{width:a,height:s}=this.sceneSize(t);t.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-s,a,s),null!=t.effectRenderer?t.effectRenderer.render(i):(this.threeRenderer.autoClear=!0,this.threeRenderer.toneMapping=t.toneMapping,this.threeRenderer.render(t,t.camera)),this.multipleScenesVisible||!t.element.modelIsVisible&&0===t.renderCount?this.copyPixels(t,a,s):r.parentElement!==t.canvas.parentElement&&(t.canvas.parentElement.appendChild(r),t.canvas.classList.remove("show")),t.hasRendered(),++t.renderCount,this.renderedLastFrame=!0}}dispose(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.threeRenderer&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null;let e=[];for(let t of this.scenes)e.push(t.element);return this.canvas3D.removeEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.removeEventListener("webglcontextrestored",this.onWebGLContextRestored),e}}let p2=Symbol("correlatedObjects"),p3=Symbol("onUpdate");class p4{constructor(e,t){this[p3]=e,this[p2]=t}}let p5=new rO,p8=new a9(2,2),p9=0,p6=Symbol("threeTexture"),p7=Symbol("threeTextures");Symbol("applyTexture");class Ae extends p4{get[p6](){var e;return null==(e=this[p2])?void 0:e.values().next().value}get[p7](){return this[p2]}constructor(e,t){super(e,new Set(t?[t]:[]));const i=this[p6].image;i.src||(i.src=t.name?t.name:"adhoc_image"+p9++),i.name||(i.name=t&&i&&i.src?i.src.split("/").pop():"adhoc_image")}get name(){return this[p6].image.name||""}get uri(){return this[p6].image.src}get bufferView(){return this[p6].image.bufferView}get element(){let e=this[p6];if(e&&(e.isCanvasTexture||e.isVideoTexture))return e.image}get animation(){let e=this[p6];if(e&&e.isCanvasTexture&&e.animation)return e.animation}get type(){return null!=this.uri?"external":"embedded"}set name(e){for(let t of this[p7])t.image.name=e}update(){let e=this[p6];e&&e.isCanvasTexture&&!e.animation&&(this[p6].needsUpdate=!0,this[p3]())}async createThumbnail(e,t){let i=new nx;p5.map=this[p6];let r=new nr(p8,p5);i.add(r);let n=new sG(-1,1,1,-1,0,1),{threeRenderer:a}=p1.singleton,s=new i_(e,t);a.setRenderTarget(s),a.render(i,n),a.setRenderTarget(null);let o=new Uint8Array(e*t*4);a.readRenderTargetPixels(s,0,0,e,t,o),fC.width=e,fC.height=t;let l=fC.getContext("2d"),h=l.createImageData(e,t);return h.data.set(o),l.putImageData(h,0,0),new Promise(async(e,t)=>{fC.toBlob(i=>{if(!i)return t("Failed to capture thumbnail.");e(URL.createObjectURL(i))},"image/png")})}}(e3=to||(to={}))[e3.Nearest=9728]="Nearest",e3[e3.Linear=9729]="Linear",e3[e3.NearestMipmapNearest=9984]="NearestMipmapNearest",e3[e3.LinearMipmapNearest=9985]="LinearMipmapNearest",e3[e3.NearestMipmapLinear=9986]="NearestMipmapLinear",e3[e3.LinearMipmapLinear=9987]="LinearMipmapLinear",(e4=tl||(tl={}))[e4.ClampToEdge=33071]="ClampToEdge",e4[e4.MirroredRepeat=33648]="MirroredRepeat",e4[e4.Repeat=10497]="Repeat";let At=new Map([[tl.Repeat,1e3],[tl.ClampToEdge,1001],[tl.MirroredRepeat,1002]]),Ai=new Map([[1e3,tl.Repeat],[1001,tl.ClampToEdge],[1002,tl.MirroredRepeat]]),Ar=new Map([[to.Nearest,1003],[to.Linear,1006],[to.NearestMipmapNearest,1004],[to.LinearMipmapNearest,1007],[to.NearestMipmapLinear,1005],[to.LinearMipmapLinear,1008]]),An=new Map([[1003,to.Nearest],[1006,to.Linear],[1004,to.NearestMipmapNearest],[1007,to.LinearMipmapNearest],[1005,to.NearestMipmapLinear],[1008,to.LinearMipmapLinear]]),Aa=new Map([[to.Nearest,1003],[to.Linear,1006]]),As=new Map([[1003,to.Nearest],[1006,to.Linear]]),Ao=Symbol("threeTexture"),Al=Symbol("threeTextures"),Ah=Symbol("setProperty");class Ac extends p4{get[Ao](){var e;return null==(e=this[p2])?void 0:e.values().next().value}get[Al](){return this[p2]}constructor(e,t){super(e,new Set(t?[t]:[]))}get name(){return this[Ao].name||""}get minFilter(){return An.get(this[Ao].minFilter)}get magFilter(){return As.get(this[Ao].magFilter)}get wrapS(){return Ai.get(this[Ao].wrapS)}get wrapT(){return Ai.get(this[Ao].wrapT)}get rotation(){return this[Ao].rotation}get scale(){return f8(this[Ao].repeat)}get offset(){return f8(this[Ao].offset)}setMinFilter(e){this[Ah]("minFilter",Ar.get(e))}setMagFilter(e){this[Ah]("magFilter",Aa.get(e))}setWrapS(e){this[Ah]("wrapS",At.get(e))}setWrapT(e){this[Ah]("wrapT",At.get(e))}setRotation(e){null==e&&(e=0),this[Ah]("rotation",e)}setScale(e){null==e&&(e={u:1,v:1}),this[Ah]("repeat",new t7(e.u,e.v))}setOffset(e){null==e&&(e={u:0,v:0}),this[Ah]("offset",new t7(e.u,e.v))}[Ah](e,t){if(((e,t)=>{switch(e){case"minFilter":let i;return i=t,An.has(i);case"magFilter":let r;return r=t,As.has(r);case"wrapS":case"wrapT":let n;return n=t,Ai.has(n);case"rotation":case"repeat":case"offset":return!0;default:throw Error(`Cannot configure property "${e}" on Sampler`)}})(e,t))for(let i of this[Al])i[e]=t,i.needsUpdate=!0;this[p3]()}}let Au=Symbol("image"),Ad=Symbol("sampler"),Ap=Symbol("threeTexture");class AA extends p4{get[Ap](){var e;return null==(e=this[p2])?void 0:e.values().next().value}constructor(e,t){super(e,new Set(t?[t]:[])),this[Ad]=new Ac(e,t),this[Au]=new Ae(e,t)}get name(){return this[Ap].name||""}set name(e){for(let t of this[p2])t.name=e}get sampler(){return this[Ad]}get source(){return this[Au]}}let Af=Symbol("texture"),Ag=Symbol("transform"),Am=Symbol("materials"),Av=Symbol("usage"),Ab=Symbol("onUpdate"),Ay=Symbol("activeVideo");(e5=td||(td={}))[e5.Base=0]="Base",e5[e5.MetallicRoughness=1]="MetallicRoughness",e5[e5.Normal=2]="Normal",e5[e5.Occlusion=3]="Occlusion",e5[e5.Emissive=4]="Emissive",e5[e5.Clearcoat=5]="Clearcoat",e5[e5.ClearcoatRoughness=6]="ClearcoatRoughness",e5[e5.ClearcoatNormal=7]="ClearcoatNormal",e5[e5.SheenColor=8]="SheenColor",e5[e5.SheenRoughness=9]="SheenRoughness",e5[e5.Transmission=10]="Transmission",e5[e5.Thickness=11]="Thickness",e5[e5.Specular=12]="Specular",e5[e5.SpecularColor=13]="SpecularColor",e5[e5.Iridescence=14]="Iridescence",e5[e5.IridescenceThickness=15]="IridescenceThickness",e5[e5.Anisotropy=16]="Anisotropy";class Ax{constructor(e,t,i,r){this[th]=null,this[tc]={rotation:0,scale:new t7(1,1),offset:new t7(0,0)},this[tu]=!1,i&&(this[Ag].rotation=i.rotation,this[Ag].scale.copy(i.repeat),this[Ag].offset.copy(i.offset),this[Af]=new AA(e,i)),this[Ab]=e,this[Am]=r,this[Av]=t}get texture(){return this[Af]}setTexture(e){var t,i;let r=null!=e?e.source[p6]:null,n=null==(t=this[Af])?void 0:t.source[p6];if(null!=n&&n.isVideoTexture?this[Ay]=!1:(null==(i=this[Af])?void 0:i.source.animation)&&this[Af].source.animation.removeEventListener("enterFrame",this[Ab]),this[Af]=e,null!=r&&r.isVideoTexture){let e=r.image;if(this[Ay]=!0,null!=e.requestVideoFrameCallback){let t=()=>{this[Ay]&&(this[Ab](),e.requestVideoFrameCallback(t))};e.requestVideoFrameCallback(t)}else{let e=()=>{this[Ay]&&(this[Ab](),requestAnimationFrame(e))};requestAnimationFrame(e)}}else(null==e?void 0:e.source.animation)!=null&&e.source.animation.addEventListener("enterFrame",this[Ab]);let a="srgb";if(this[Am])for(let e of this[Am]){switch(this[Av]){case td.Base:e.map=r;break;case td.MetallicRoughness:a=tW,e.metalnessMap=r,e.roughnessMap=r;break;case td.Normal:a=tW,e.normalMap=r;break;case td.Occlusion:a=tW,e.aoMap=r;break;case td.Emissive:e.emissiveMap=r;break;case td.Clearcoat:e.clearcoatMap=r;break;case td.ClearcoatRoughness:e.clearcoatRoughnessMap=r;break;case td.ClearcoatNormal:e.clearcoatNormalMap=r;break;case td.SheenColor:e.sheenColorMap=r;break;case td.SheenRoughness:e.sheenRoughnessMap=r;break;case td.Transmission:e.transmissionMap=r;break;case td.Thickness:e.thicknessMap=r;break;case td.Specular:e.specularIntensityMap=r;break;case td.SpecularColor:e.specularColorMap=r;break;case td.Iridescence:e.iridescenceMap=r;break;case td.IridescenceThickness:e.iridescenceThicknessMap=r;break;case td.Anisotropy:e.anisotropyMap=r}e.needsUpdate=!0}r&&(r.colorSpace=a,r.rotation=this[Ag].rotation,r.repeat=this[Ag].scale,r.offset=this[Ag].offset),this[Ab]()}}th=Af,tc=Ag,tu=Ay;let A_=Symbol("threeMaterial"),AE=Symbol("threeMaterials"),AS=Symbol("baseColorTexture"),AC=Symbol("metallicRoughnessTexture");class AM extends p4{get[AE](){return this[p2]}get[A_](){var e;return null==(e=this[p2])?void 0:e.values().next().value}constructor(e,t){super(e,t);const{map:i,metalnessMap:r}=t.values().next().value;this[AS]=new Ax(e,td.Base,i,t),this[AC]=new Ax(e,td.MetallicRoughness,r,t)}get baseColorFactor(){let e=[0,0,0,this[A_].opacity];return this[A_].color.toArray(e),e}get metallicFactor(){return this[A_].metalness}get roughnessFactor(){return this[A_].roughness}get baseColorTexture(){return this[AS]}get metallicRoughnessTexture(){return this[AC]}setBaseColorFactor(e){let t=new rP;for(let i of(e instanceof Array?t.fromArray(e):t.set(e),this[AE]))i.color.set(t),e instanceof Array&&e.length>3?i.opacity=e[3]:(e=[0,0,0,i.opacity],t.toArray(e));this[p3]()}setMetallicFactor(e){for(let t of this[AE])t.metalness=e;this[p3]()}setRoughnessFactor(e){for(let t of this[AE])t.roughness=e;this[p3]()}}let Aw=Symbol("pbrMetallicRoughness"),AI=Symbol("normalTexture"),AT=Symbol("occlusionTexture"),AB=Symbol("emissiveTexture"),AR=Symbol("backingThreeMaterial"),AD=Symbol("applyAlphaCutoff"),AL=Symbol("getAlphaMode"),AP=Symbol("lazyLoadGLTFInfo"),AU=Symbol("initialize"),AF=Symbol("getLoadedMaterial"),AN=Symbol("ensureMaterialIsLoaded"),AO=Symbol("gltfIndex"),Ak=Symbol("setActive"),AQ=Symbol("variantIndices"),AG=Symbol("isActive"),AH=Symbol("modelVariants"),Az=Symbol("name"),AV=Symbol("pbrTextures");class AW extends p4{get[(tp=AQ,tA=AV,AR)](){return this[p2].values().next().value}constructor(e,t,i,r,n,a,s){super(e,n),this[tp]=new Set,this[tA]=new Map,this[AO]=t,this[AG]=i,this[AH]=r,this[Az]=a,null==s?this[AU]():this[AP]=s}[AU](){let e=this[p3],t=this[p2];this[Aw]=new AM(e,t);let{normalMap:i,aoMap:r,emissiveMap:n}=t.values().next().value;this[AI]=new Ax(e,td.Normal,i,t),this[AT]=new Ax(e,td.Occlusion,r,t),this[AB]=new Ax(e,td.Emissive,n,t);let a=i=>{this[AV].set(i,new Ax(e,i,null,t))};a(td.Clearcoat),a(td.ClearcoatRoughness),a(td.ClearcoatNormal),a(td.SheenColor),a(td.SheenRoughness),a(td.Transmission),a(td.Thickness),a(td.Specular),a(td.SpecularColor),a(td.Iridescence),a(td.IridescenceThickness),a(td.Anisotropy)}async [AF](){if(null!=this[AP]){let e=await this[AP].doLazyLoad();return this[AU](),this[AP]=void 0,this.ensureLoaded=async()=>{},e}return null}colorFromRgb(e){let t=new rP;return e instanceof Array?t.fromArray(e):t.set(e),t}[AN](){if(null!=this[AP])throw Error(`Material "${this.name}" has not been loaded, call 'await
|
|
902
|
+
myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[AF]()}get isLoaded(){return null==this[AP]}get isActive(){return this[AG]}[Ak](e){this[AG]=e}get name(){return this[Az]||""}set name(e){if(this[Az]=e,null!=this[p2])for(let t of this[p2])t.name=e}get pbrMetallicRoughness(){return this[AN](),this[Aw]}get normalTexture(){return this[AN](),this[AI]}get occlusionTexture(){return this[AN](),this[AT]}get emissiveTexture(){return this[AN](),this[AB]}get emissiveFactor(){return this[AN](),this[AR].emissive.toArray()}get index(){return this[AO]}hasVariant(e){let t=this[AH].get(e);return null!=t&&this[AQ].has(t.index)}setEmissiveFactor(e){this[AN]();let t=this.colorFromRgb(e);for(let e of this[p2])e.emissive.set(t);this[p3]()}[AL](){return this[AR].transparent?"BLEND":this[AR].alphaTest>0?"MASK":"OPAQUE"}[AD](){for(let e of(this[AN](),this[p2]))"MASK"===this[AL]()?void 0==e.alphaTest&&(e.alphaTest=.5):e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(e){for(let t of(this[AN](),this[p2]))t.alphaTest=e,t.needsUpdate=!0;this[AD](),this[p3]()}getAlphaCutoff(){return this[AN](),this[AR].alphaTest}setDoubleSided(e){for(let t of(this[AN](),this[p2]))t.side=2*!!e,t.needsUpdate=!0;this[p3]()}getDoubleSided(){return this[AN](),2==this[AR].side}setAlphaMode(e){this[AN]();let t=(e,t)=>{e.transparent=t,e.depthWrite=!t};for(let i of this[p2])t(i,"BLEND"===e),"MASK"===e?i.alphaTest=.5:i.alphaTest=void 0,i.needsUpdate=!0;this[p3]()}getAlphaMode(){return this[AN](),this[AL]()}get emissiveStrength(){return this[AN](),this[AR].emissiveIntensity}setEmissiveStrength(e){for(let t of(this[AN](),this[p2]))t.emissiveIntensity=e;this[p3]()}get clearcoatFactor(){return this[AN](),this[AR].clearcoat}get clearcoatRoughnessFactor(){return this[AN](),this[AR].clearcoatRoughness}get clearcoatTexture(){return this[AN](),this[AV].get(td.Clearcoat)}get clearcoatRoughnessTexture(){return this[AN](),this[AV].get(td.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[AN](),this[AV].get(td.ClearcoatNormal)}get clearcoatNormalScale(){return this[AN](),this[AR].clearcoatNormalScale.x}setClearcoatFactor(e){for(let t of(this[AN](),this[p2]))t.clearcoat=e;this[p3]()}setClearcoatRoughnessFactor(e){for(let t of(this[AN](),this[p2]))t.clearcoatRoughness=e;this[p3]()}setClearcoatNormalScale(e){for(let t of(this[AN](),this[p2]))t.clearcoatNormalScale=new t7(e,e);this[p3]()}get ior(){return this[AN](),this[AR].ior}setIor(e){for(let t of(this[AN](),this[p2]))t.ior=e;this[p3]()}get sheenColorFactor(){return this[AN](),this[AR].sheenColor.toArray()}get sheenColorTexture(){return this[AN](),this[AV].get(td.SheenColor)}get sheenRoughnessFactor(){return this[AN](),this[AR].sheenRoughness}get sheenRoughnessTexture(){return this[AN](),this[AV].get(td.SheenRoughness)}setSheenColorFactor(e){this[AN]();let t=this.colorFromRgb(e);for(let e of this[p2])e.sheenColor.set(t),e.sheen=1;this[p3]()}setSheenRoughnessFactor(e){for(let t of(this[AN](),this[p2]))t.sheenRoughness=e,t.sheen=1;this[p3]()}get transmissionFactor(){return this[AN](),this[AR].transmission}get transmissionTexture(){return this[AN](),this[AV].get(td.Transmission)}setTransmissionFactor(e){for(let t of(this[AN](),this[p2]))t.transmission=e;this[p3]()}get thicknessFactor(){return this[AN](),this[AR].thickness}get thicknessTexture(){return this[AN](),this[AV].get(td.Thickness)}get attenuationDistance(){return this[AN](),this[AR].attenuationDistance}get attenuationColor(){return this[AN](),this[AR].attenuationColor.toArray()}setThicknessFactor(e){for(let t of(this[AN](),this[p2]))t.thickness=e;this[p3]()}setAttenuationDistance(e){for(let t of(this[AN](),this[p2]))t.attenuationDistance=e;this[p3]()}setAttenuationColor(e){this[AN]();let t=this.colorFromRgb(e);for(let e of this[p2])e.attenuationColor.set(t);this[p3]()}get specularFactor(){return this[AN](),this[AR].specularIntensity}get specularTexture(){return this[AN](),this[AV].get(td.Specular)}get specularColorFactor(){return this[AN](),this[AR].specularColor.toArray()}get specularColorTexture(){return this[AN](),this[AV].get(td.SheenColor)}setSpecularFactor(e){for(let t of(this[AN](),this[p2]))t.specularIntensity=e;this[p3]()}setSpecularColorFactor(e){this[AN]();let t=this.colorFromRgb(e);for(let e of this[p2])e.specularColor.set(t);this[p3]()}get iridescenceFactor(){return this[AN](),this[AR].iridescence}get iridescenceTexture(){return this[AN](),this[AV].get(td.Iridescence)}get iridescenceIor(){return this[AN](),this[AR].iridescenceIOR}get iridescenceThicknessMinimum(){return this[AN](),this[AR].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[AN](),this[AR].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[AN](),this[AV].get(td.IridescenceThickness)}setIridescenceFactor(e){for(let t of(this[AN](),this[p2]))t.iridescence=e;this[p3]()}setIridescenceIor(e){for(let t of(this[AN](),this[p2]))t.iridescenceIOR=e;this[p3]()}setIridescenceThicknessMinimum(e){for(let t of(this[AN](),this[p2]))t.iridescenceThicknessRange[0]=e;this[p3]()}setIridescenceThicknessMaximum(e){for(let t of(this[AN](),this[p2]))t.iridescenceThicknessRange[1]=e;this[p3]()}get anisotropyStrength(){return this[AN](),this[AR].anisotropy}get anisotropyRotation(){return this[AN](),this[AR].anisotropyRotation}get anisotropyTexture(){return this[AN](),this[AV].get(td.Anisotropy)}setAnisotropyStrength(e){for(let t of(this[AN](),this[p2]))t.anisotropy=e;this[p3]()}setAnisotropyRotation(e){for(let t of(this[AN](),this[p2]))t.anisotropyRotation=e;this[p3]()}}class Aq{constructor(e){this.name="",this.children=[],this.name=e}}class Aj extends Aq{constructor(e,t,i,r){super(e.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=e;const{gltf:n,threeGLTF:a,threeObjectMap:s}=r;this.parser=a.parser,this.modelVariants=i,this.mesh.userData.variantData=i;const o=s.get(e.material);null!=o.materials?this.initialMaterialIdx=this.activeMaterialIdx=o.materials:console.error(`Primitive (${e.name}) missing initial material reference.`);const l=e.userData.associations||{};if(null==l.meshes)return void console.error("Mesh is missing primitive index association");const h=((n.meshes||[])[l.meshes].primitives||[])[l.primitives];if(null==h)return void console.error("Mesh primitive definition is missing.");if(null!=h.material)this.materials.set(h.material,t[h.material]);else{const e=t.findIndex(e=>"Default"===e.name);e>=0?this.materials.set(e,t[e]):console.warn("gltfPrimitive has no material!")}if(h.extensions&&h.extensions.KHR_materials_variants){const e=h.extensions.KHR_materials_variants,r=a.parser.json.extensions.KHR_materials_variants.variants;for(const n of e.mappings){const e=t[n.material];for(const t of(this.materials.set(n.material,e),n.variants)){const{name:n}=r[t];this.variantToMaterialMap.set(t,e),e[AQ].add(t),i.has(n)||i.set(n,{name:n,index:t})}}}}async setActiveMaterial(e){let t=this.materials.get(e);if(e!==this.activeMaterialIdx){let i=t[p2],r=await t[AF]();null!=r?this.mesh.material=r:this.mesh.material=i.values().next().value,this.parser.assignFinalMaterial(this.mesh),i.add(this.mesh.material),this.activeMaterialIdx=e}return this.mesh.material}getActiveMaterial(){return this.materials.get(this.activeMaterialIdx)}getMaterial(e){return this.materials.get(e)}async enableVariant(e){if(null==e)return this.setActiveMaterial(this.initialMaterialIdx);if(null!=this.variantToMaterialMap&&this.modelVariants.has(e)){let t=this.modelVariants.get(e);return this.enableVariantHelper(t.index)}return null}async enableVariantHelper(e){if(null!=this.variantToMaterialMap&&null!=e){let t=this.variantToMaterialMap.get(e);if(null!=t)return this.setActiveMaterial(t.index)}return null}async instantiateVariants(){if(null!=this.variantToMaterialMap)for(let e of this.variantToMaterialMap.keys()){let t=this.mesh.userData.variantMaterials.get(e);if(null!=t.material)continue;let i=await this.enableVariantHelper(e);null!=i&&(t.material=i)}}get variantInfo(){return this.variantToMaterialMap}addVariant(e,t){if(!this.ensureVariantIsUnused(t))return!1;this.modelVariants.has(t)||this.modelVariants.set(t,{name:t,index:this.modelVariants.size});let i=this.modelVariants.get(t).index;return e[AQ].add(i),this.variantToMaterialMap.set(i,e),this.materials.set(e.index,e),this.updateVariantUserData(i,e),!0}deleteVariant(e){if(this.variantInfo.has(e)){this.variantInfo.delete(e);let t=this.mesh.userData.variantMaterials;null!=t&&t.delete(e)}}updateVariantUserData(e,t){t[AQ].add(e),this.mesh.userData.variantData=this.modelVariants,this.mesh.userData.variantMaterials=this.mesh.userData.variantMaterials||new Map,this.mesh.userData.variantMaterials.set(e,{material:t[p2].values().next().value,gltfMaterialIndex:t.index})}ensureVariantIsUnused(e){let t=this.modelVariants.get(e);return!(null!=t&&this.variantInfo.has(t.index))||(console.warn(`Primitive cannot add variant '${e}' for this material, it already exists.`),!1)}}let AX=Symbol("materials"),AY=Symbol("hierarchy"),AK=Symbol("roots"),AJ=Symbol("primitives");Symbol("loadVariant");let A$=Symbol("prepareVariantsForExport"),AZ=Symbol("switchVariant"),A0=Symbol("materialFromPoint"),A1=Symbol("nodeFromPoint"),A2=Symbol("nodeFromIndex"),A3=Symbol("variantData"),A4=Symbol("availableVariants"),A5=Symbol("modelOnUpdate"),A8=Symbol("cloneMaterial");class A9{constructor(e,t,i,r){this.gltf=e,this.gltfElementMap=t,this.mapKey=i,this.doLazyLoad=r}}class A6{constructor(e,t=()=>{}){this[tf]=[],this[tg]=[],this[tm]=[],this[tv]=[],this[tb]=()=>{},this[ty]=new Map,this[A5]=t;const{gltf:i,threeGLTF:r,gltfElementMap:n}=e;for(const[e,a]of i.materials.entries()){const s=n.get(a);if(null!=s)this[AX].push(new AW(t,e,!0,this[A3],s,a.name));else{const s=(i.materials||[])[e],o=new Set;n.set(s,o);const l=async()=>{let t=await r.parser.getDependency("material",e);return o.add(t),t};this[AX].push(new AW(t,e,!1,this[A3],o,a.name,new A9(i,n,s,l)))}}const a=new Map,s=[];for(const e of r.scene.children)s.push(e);for(;s.length>0;){const t=s.pop();let i=null;t instanceof nr?(i=new Aj(t,this.materials,this[A3],e),this[AJ].push(i)):i=new Aq(t.name);const r=a.get(t);for(const e of(null!=r?r.children.push(i):this[AK].push(i),this[AY].push(i),t.children))s.push(e),a.set(t,i)}}get materials(){return this[AX]}[(tf=AX,tg=AY,tm=AK,tv=AJ,tb=A5,ty=A3,A4)](){let e=Array.from(this[A3].values());return e.sort((e,t)=>e.index-t.index),e.map(e=>e.name)}getMaterialByName(e){let t=this[AX].filter(t=>t.name===e);return t.length>0?t[0]:null}[A2](e,t){let i=this[AY].find(i=>{if(i instanceof Aj){let{meshes:r,primitives:n}=i.mesh.userData.associations;if(r==e&&n==t)return!0}return!1});return null==i?null:i}[A1](e){return this[AY].find(t=>t instanceof Aj&&t.mesh===e.object||!1)}[A0](e){return this[A1](e).getActiveMaterial()}async [AZ](e){for(let t of this[AJ])await t.enableVariant(e);for(let e of this.materials)e[Ak](!1);for(let e of this[AJ])this.materials[e.getActiveMaterial().index][Ak](!0)}async [A$](){let e=[];for(let t of this[AJ])e.push(t.instantiateVariants());await Promise.all(e)}[A8](e,t){let i=this.materials[e];i.isLoaded||console.error(`Cloning an unloaded material,
|
|
903
|
+
call 'material.ensureLoaded() before cloning the material.`);let r=i[p2],n=new Set;for(let[e,i]of r.entries()){let a=i.clone();a.name=t+(r.size>1?"_inst"+e:""),n.add(a)}let a=new AW(this[A5],this[AX].length,!1,this[A3],n,t);return this[AX].push(a),a}createMaterialInstanceForVariant(e,t,i,r=!0){let n=null;for(let r of this[AJ]){let a=this[A3].get(i);null!=a&&r.variantInfo.has(a.index)||null!=r.getMaterial(e)&&(this.hasVariant(i)||this.createVariant(i),null==n&&(n=this[A8](e,t)),r.addVariant(n,i))}if(r&&null!=n)for(let t of(n[Ak](!0),this.materials[e][Ak](!1),this[AJ]))t.enableVariant(i);return n}createVariant(e){this[A3].has(e)?console.warn(`Variant '${e}'' already exists`):this[A3].set(e,{name:e,index:this[A3].size})}hasVariant(e){return this[A3].has(e)}setMaterialToVariant(e,t){if(null==this[A4]().find(e=>e===t))return void console.warn(`Can't add material to '${t}', the variant does not exist.'`);if(e<0||e>=this.materials.length)return void console.error("setMaterialToVariant(): materialIndex is out of bounds.");for(let i of this[AJ]){let r=i.getMaterial(e);null!=r&&i.addVariant(r,t)}}updateVariantName(e,t){let i=this[A3].get(e);null!=i&&(i.name=t,this[A3].set(t,i),this[A3].delete(e))}deleteVariant(e){let t=this[A3].get(e);if(null!=t){for(let i of this.materials)i.hasVariant(e)&&i[AQ].delete(t.index);for(let e of this[AJ])e.deleteVariant(t.index);this[A3].delete(e)}}}var A7=function(e,t,i,r){var n,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(s=(a<3?n(s):a>3?n(t,i,s):n(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let fe=Symbol("currentGLTF"),ft=Symbol("originalGltfJson"),fi=Symbol("model"),fr=Symbol("getOnUpdateMethod"),fn=Symbol("buildTexture");class fa extends nr{constructor(){super(void 0,new rO({depthWrite:!1})),this.height=0,this.radius=0,this.resolution=0,this.userData.noHit=!0}get map(){return this.material.map}set map(e){this.material.map=e}isUsable(){return this.height>0&&this.radius>0&&null!=this.geometry&&null!=this.map}updateGeometry(e=this.height,t=this.radius,i=128){(e!=this.height||t!=this.radius||i!=this.resolution)&&(this.height=e,this.radius=t,this.resolution=i,e>0&&t>0&&(this.geometry.dispose(),this.geometry=function(e,t,i){let r=new a7(t,2*i,i);r.scale(1,1,-1);let n=r.getAttribute("position"),a=new it;for(let t=0;t<n.count;++t)if(a.fromBufferAttribute(n,t),a.y<0){let i=-(3*e)/2,r=a.y<i?-e/a.y:1-a.y*a.y/(3*i*i);a.multiplyScalar(r),a.toArray(n.array,3*t)}return n.needsUpdate=!0,r}(e,t,i)))}}let fs=new it,fo=new it,fl=new it,fh=new ia,fc=new rT,fu=new ie;class fd extends lm{constructor(e){super(document.createElement("div")),this.normal=new it(0,1,0),this.initialized=!1,this.referenceCount=1,this.pivot=document.createElement("div"),this.slot=document.createElement("slot"),this.element.classList.add("annotation-wrapper"),this.slot.name=e.name,this.element.appendChild(this.pivot),this.pivot.appendChild(this.slot),this.updatePosition(e.position),this.updateNormal(e.normal),this.surface=e.surface}get facingCamera(){return!this.element.classList.contains("hide")}show(){this.facingCamera&&this.initialized||this.updateVisibility(!0)}hide(){(this.facingCamera||!this.initialized)&&this.updateVisibility(!1)}increment(){this.referenceCount++}decrement(){return this.referenceCount>0&&--this.referenceCount,0===this.referenceCount}updatePosition(e){if(null==e)return;let t=u_(e)[0].terms;for(let e=0;e<3;++e)this.position.setComponent(e,uL(t[e]).number);this.updateMatrixWorld()}updateNormal(e){if(null==e)return;let t=u_(e)[0].terms;for(let e=0;e<3;++e)this.normal.setComponent(e,t[e].number)}updateSurface(){let{mesh:e,tri:t,bary:i}=this;if(null==e||null==t||null==i)return;e.getVertexPosition(t.x,fs),e.getVertexPosition(t.y,fo),e.getVertexPosition(t.z,fl),fs.toArray(fh.elements,0),fo.toArray(fh.elements,3),fl.toArray(fh.elements,6),this.position.copy(i).applyMatrix3(fh);let r=this.parent;r.worldToLocal(e.localToWorld(this.position)),fc.set(fs,fo,fl),fc.getNormal(this.normal).transformDirection(e.matrixWorld);let n=r.parent;fu.setFromAxisAngle(fs.set(0,1,0),-n.rotation.y),this.normal.applyQuaternion(fu)}orient(e){this.pivot.style.transform=`rotate(${e}rad)`}updateVisibility(e){this.element.classList.toggle("hide",!e),this.slot.assignedNodes().forEach(t=>{if(t.nodeType!==Node.ELEMENT_NODE)return;let i=t.dataset.visibilityAttribute;if(null!=i){let r=`data-${i}`;t.toggleAttribute(r,e)}t.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))}),this.initialized=!0}}let fp={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:`
|
|
904
|
+
|
|
905
|
+
varying vec2 vUv;
|
|
906
|
+
|
|
907
|
+
void main() {
|
|
908
|
+
|
|
909
|
+
vUv = uv;
|
|
910
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
911
|
+
|
|
912
|
+
}`,fragmentShader:`
|
|
913
|
+
|
|
914
|
+
uniform sampler2D tDiffuse;
|
|
915
|
+
uniform float h;
|
|
916
|
+
|
|
917
|
+
varying vec2 vUv;
|
|
918
|
+
|
|
919
|
+
void main() {
|
|
920
|
+
|
|
921
|
+
vec4 sum = vec4( 0.0 );
|
|
922
|
+
|
|
923
|
+
sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;
|
|
924
|
+
sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;
|
|
925
|
+
sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;
|
|
926
|
+
sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;
|
|
927
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
|
|
928
|
+
sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;
|
|
929
|
+
sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;
|
|
930
|
+
sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;
|
|
931
|
+
sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;
|
|
932
|
+
|
|
933
|
+
gl_FragColor = sum;
|
|
934
|
+
|
|
935
|
+
}`},fA={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:`
|
|
936
|
+
|
|
937
|
+
varying vec2 vUv;
|
|
938
|
+
|
|
939
|
+
void main() {
|
|
940
|
+
|
|
941
|
+
vUv = uv;
|
|
942
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
943
|
+
|
|
944
|
+
}`,fragmentShader:`
|
|
945
|
+
|
|
946
|
+
uniform sampler2D tDiffuse;
|
|
947
|
+
uniform float v;
|
|
948
|
+
|
|
949
|
+
varying vec2 vUv;
|
|
950
|
+
|
|
951
|
+
void main() {
|
|
952
|
+
|
|
953
|
+
vec4 sum = vec4( 0.0 );
|
|
954
|
+
|
|
955
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;
|
|
956
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;
|
|
957
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;
|
|
958
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;
|
|
959
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
|
|
960
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;
|
|
961
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;
|
|
962
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;
|
|
963
|
+
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;
|
|
964
|
+
|
|
965
|
+
gl_FragColor = sum;
|
|
966
|
+
|
|
967
|
+
}`};class ff extends rf{constructor(e,t,i){super(),this.camera=new sG,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new sr,this.horizontalBlurMaterial=new nh(fp),this.verticalBlurMaterial=new nh(fA),this.intensity=0,this.softness=1,this.boundingBox=new iC,this.size=new it,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:r}=this;r.rotation.x=Math.PI/2,r.left=-.5,r.right=.5,r.bottom=-.5,r.top=.5,this.add(r);const n=new a9,a=new rO({opacity:1,transparent:!0,side:1});this.floor=new nr(n,a),this.floor.userData.noHit=!0,r.add(this.floor),this.blurPlane=new nr(n),this.blurPlane.visible=!1,r.add(this.blurPlane),e.target.add(this),this.depthMaterial.onBeforeCompile=function(e){e.fragmentShader=e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * opacity );")},this.depthMaterial.side=2,this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial.depthTest=!1,this.setScene(e,t,i)}setScene(e,t,i){let{boundingBox:r,size:n,rotation:a,position:s}=this;if(this.isAnimated=e.animationNames.length>0,this.boundingBox.copy(e.boundingBox),this.size.copy(e.size),this.maxDimension=Math.max(n.x,n.y,n.z)*(this.isAnimated?2:1),this.boundingBox.getCenter(s),"back"===i){let{min:e,max:t}=r;[e.y,e.z]=[e.z,e.y],[t.y,t.z]=[t.z,t.y],[n.y,n.z]=[n.z,n.y],a.x=Math.PI/2,a.y=Math.PI}else a.x=0,a.y=0;if(this.isAnimated){let e=r.min.y,t=r.max.y;n.y=this.maxDimension,r.expandByVector(n.subScalar(this.maxDimension).multiplyScalar(-.5)),r.min.y=e,r.max.y=t,n.set(this.maxDimension,t-e,this.maxDimension)}"bottom"===i?s.y=r.min.y:s.z=r.min.y,this.setSoftness(t)}setSoftness(e){this.softness=e;let{size:t,camera:i}=this,r=this.isAnimated?2:1,n=r*Math.pow(2,9-3*e);this.setMapSize(n);let a=t.y/2,s=t.y*r;i.near=0,i.far=(1-e)*s+e*a,this.depthMaterial.opacity=1/e,i.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(e){let{size:t}=this;this.isAnimated&&(e*=2);let i=Math.floor(t.x>t.z?e:e*t.x/t.z),r=Math.floor(t.x>t.z?e*t.z/t.x:e),n=10+i,a=10+r;if(null!=this.renderTarget&&(this.renderTarget.width!==n||this.renderTarget.height!==a)&&(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),null==this.renderTarget){let e={format:1023};this.renderTarget=new i_(n,a,e),this.renderTargetBlur=new i_(n,a,e),this.floor.material.map=this.renderTarget.texture}this.camera.scale.set(t.x*(1+10/i),t.z*(1+10/r),1),this.needsUpdate=!0}setIntensity(e){if(this.intensity=e,e>0){var t;this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=e*((1-(t=this.softness*this.softness))*.3+ +t)}else this.visible=!1,this.floor.visible=!1}getIntensity(){return this.intensity}setOffset(e){this.floor.position.z=-e+this.gap()}gap(){return .001*this.maxDimension}render(e,t){t.overrideMaterial=this.depthMaterial;let i=e.getClearAlpha();e.setClearAlpha(0),this.floor.visible=!1;let r=e.xr.enabled;e.xr.enabled=!1;let n=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.render(t,this.camera),t.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(e),e.xr.enabled=r,e.setRenderTarget(n),e.setClearAlpha(i)}blurShadow(e){let{camera:t,horizontalBlurMaterial:i,verticalBlurMaterial:r,renderTarget:n,renderTargetBlur:a,blurPlane:s}=this;s.visible=!0,s.material=i,i.uniforms.h.value=1/this.renderTarget.width,i.uniforms.tDiffuse.value=this.renderTarget.texture,e.setRenderTarget(a),e.render(s,t),s.material=r,r.uniforms.v.value=1/this.renderTarget.height,r.uniforms.tDiffuse.value=this.renderTargetBlur.texture,e.setRenderTarget(n),e.render(s,t),s.visible=!1}dispose(){null!=this.renderTarget&&this.renderTarget.dispose(),null!=this.renderTargetBlur&&this.renderTargetBlur.dispose(),this.depthMaterial.dispose(),this.horizontalBlurMaterial.dispose(),this.verticalBlurMaterial.dispose(),this.floor.material.dispose(),this.floor.geometry.dispose(),this.blurPlane.geometry.dispose(),this.removeFromParent()}}let fg=new it,fm=new it,fv=new it,fb=new class{constructor(e,t,i=0,r=1/0){this.ray=new iJ(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new i7,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):tZ("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return s9.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(s9),this}intersectObject(e,t=!0,i=[]){return s7(e,this,i,t),i.sort(s6),i}intersectObjects(e,t=!0,i=[]){for(let r=0,n=e.length;r<n;r++)s7(e[r],this,i,t);return i.sort(s6),i}},fy=new it,fx=new t7;class f_ extends nx{constructor({canvas:e,element:t,width:i,height:r}){super(),this.annotationRenderer=new lE,this.effectRenderer=null,this.schemaElement=document.createElement("script"),this.width=1,this.height=1,this.aspect=1,this.scaleStep=0,this.renderCount=0,this.externalRenderer=null,this.appendedAnimations=[],this.markedAnimations=[],this.camera=new nA(45,1,.1,100),this.xrCamera=null,this.url=null,this.pivot=new rf,this.target=new rf,this.animationNames=[],this.boundingBox=new iC,this.boundingSphere=new iz,this.size=new it,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=7,this.canScale=!0,this.isDirty=!1,this.goalTarget=new it,this.targetDamperX=new ug,this.targetDamperY=new ug,this.targetDamperZ=new ug,this._currentGLTF=null,this._model=null,this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationAction=null,this.groundedSkybox=new fa,this.name="ModelScene",this.element=t,this.canvas=e,this.camera=new nA(45,1,.1,100),this.camera.name="MainCamera",this.add(this.pivot),this.pivot.name="Pivot",this.pivot.add(this.target),this.setSize(i,r),this.target.name="Target",this.mixer=new s8(this.target);const{domElement:n}=this.annotationRenderer,{style:a}=n;a.display="none",a.pointerEvents="none",a.position="absolute",a.top="0",this.element.shadowRoot.querySelector(".default").appendChild(n),this.schemaElement.setAttribute("type","application/ld+json")}get context(){return this.canvas.getContext("2d")}getCamera(){return null!=this.xrCamera?this.xrCamera:this.camera}queueRender(){this.isDirty=!0}shouldRender(){return this.isDirty}hasRendered(){this.isDirty=!1}forceRescale(){this.scaleStep=-1,this.queueRender()}async setObject(e){this.reset(),this._model=e,this.target.add(e),await this.setupScene()}async setSource(e,t=()=>{}){let i;if(!e||e===this.url)return void t(1);if(this.reset(),this.url=e,null!=this.externalRenderer){let e=await this.externalRenderer.load(t);this.boundingSphere.radius=e.framedRadius,this.idealAspect=e.fieldOfViewAspect;return}null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);try{i=await new Promise((i,r)=>{this.cancelPendingSourceChange=()=>r(),(async()=>{try{let r=await this.element[f0].loader.load(e,this.element,t);i(r)}catch(e){r(e)}})()})}catch(e){if(null==e)return;throw e}this.cancelPendingSourceChange=null,this.reset(),this.url=e,this._currentGLTF=i,null!=i&&(this._model=i.scene,this.target.add(i.scene));let{animations:r}=i,n=new Map,a=[];for(let e of r)n.set(e.name,e),a.push(e.name);this.animations=r,this.animationsByName=n,this.animationNames=a,await this.setupScene()}async setupScene(){this.applyTransform(),this.updateBoundingBox(),await this.updateFraming(),this.updateShadow(),this.setShadowIntensity(this.shadowIntensity),this.setGroundedSkybox()}reset(){this.url=null,this.renderCount=0,this.queueRender(),null!=this.shadow&&this.shadow.setIntensity(0),this.bakedShadows.clear();let{_model:e}=this;null!=e&&(e.removeFromParent(),this._model=null);let t=this._currentGLTF;null!=t&&(t.dispose(),this._currentGLTF=null),null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}dispose(){this.reset(),null!=this.shadow&&(this.shadow.dispose(),this.shadow=null),this.element[fe]=null,this.element[ft]=null,this.element[fi]=null}get currentGLTF(){return this._currentGLTF}setSize(e,t){if(this.width!==e||this.height!==t){if(this.width=Math.max(e,1),this.height=Math.max(t,1),this.annotationRenderer.setSize(e,t),this.aspect=this.width/this.height,null!=this.externalRenderer){let i=window.devicePixelRatio;this.externalRenderer.resize(e*i,t*i)}this.queueRender()}}markBakedShadow(e){e.userData.noHit=!0,this.bakedShadows.add(e)}unmarkBakedShadow(e){e.userData.noHit=!1,e.visible=!0,this.bakedShadows.delete(e),this.boundingBox.expandByObject(e)}findBakedShadows(e){let t=new iC;e.traverse(e=>{if(!e.material||!e.material.transparent)return;t.setFromObject(e);let i=t.getSize(fy),r=Math.min(i.x,i.y,i.z);Math.max(i.x,i.y,i.z)<100*r||this.markBakedShadow(e)})}checkBakedShadows(){let{min:e,max:t}=this.boundingBox,i=new iC;for(let r of(this.boundingBox.getSize(this.size),this.bakedShadows))i.setFromObject(r),(!(i.min.y<e.y+this.size.y/100)||!(i.min.x<=e.x)||!(i.max.x>=t.x)||!(i.min.z<=e.z)||!(i.max.z>=t.z))&&(i.min.z<e.z+this.size.z/100&&i.min.x<=e.x&&i.max.x>=t.x&&i.min.y<=e.y&&i.max.y>=t.y||this.unmarkBakedShadow(r))}applyTransform(){let{model:e}=this;if(null==e)return;let t=u_(this.element.orientation)[0].terms,i=uL(t[0]).number,r=uL(t[1]).number,n=uL(t[2]).number;e.quaternion.setFromEuler(new i6(r,n,i,"YXZ"));let a=u_(this.element.scale)[0].terms;e.scale.set(a[0].number,a[1].number,a[2].number)}updateBoundingBox(){let{model:e}=this;if(null==e)return;this.target.remove(e),this.findBakedShadows(e);let t=(e,t)=>e.expandByPoint(t);this.setBakedShadowVisibility(!1),this.boundingBox=lS(e,t,new iC),this.boundingBox.isEmpty()&&(this.setBakedShadowVisibility(!0),this.bakedShadows.forEach(e=>this.unmarkBakedShadow(e)),this.boundingBox=lS(e,t,new iC)),this.checkBakedShadows(),this.setBakedShadowVisibility(),this.boundingBox.getSize(this.size),this.target.add(e)}async updateFraming(){let{model:e}=this;if(null==e)return;this.target.remove(e),this.setBakedShadowVisibility(!1);let{center:t}=this.boundingSphere;this.element.requestUpdate("cameraTarget"),await this.element.updateComplete,t.copy(this.getTarget()),this.boundingSphere.radius=Math.sqrt(lS(e,(e,i)=>Math.max(e,t.distanceToSquared(i)),0));let i=(e,i)=>(i.sub(t),Math.max(e,Math.sqrt(i.x*i.x+i.z*i.z)/(this.idealCameraDistance()-Math.abs(i.y))));this.idealAspect=lS(e,i,0)/Math.tan(this.framedFoVDeg/2*Math.PI/180),this.setBakedShadowVisibility(),this.target.add(e)}setBakedShadowVisibility(e=this.shadowIntensity<=0){for(let t of this.bakedShadows)t.visible=e}idealCameraDistance(){let e=this.framedFoVDeg/2*Math.PI/180;return this.boundingSphere.radius/Math.sin(e)}adjustedFoV(e){return 2*Math.atan(Math.tan(e/2*Math.PI/180)*Math.max(1,this.idealAspect/this.aspect))*180/Math.PI}getNDC(e,t){if(null!=this.xrCamera)fx.set(e/window.screen.width,t/window.screen.height);else{let i=this.element.getBoundingClientRect();fx.set((e-i.x)/this.width,(t-i.y)/this.height)}return fx.multiplyScalar(2).subScalar(1),fx.y*=-1,fx}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(e,t){this.element[f0].arRenderer.presentedScene!==this&&(this.environment=e,this.setBackground(t),this.queueRender())}setBackground(e){this.groundedSkybox.map=e,this.groundedSkybox.isUsable()?(this.target.add(this.groundedSkybox),this.background=null):(this.target.remove(this.groundedSkybox),this.background=e)}farRadius(){return this.boundingSphere.radius*(null!=this.groundedSkybox.parent?10:1)}setGroundedSkybox(){let e=uL(u_(this.element.skyboxHeight)[0].terms[0]).number,t=10*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(e,t),this.groundedSkybox.position.y=e-(this.shadow?2*this.shadow.gap():0),this.setBackground(this.groundedSkybox.map)}setTarget(e,t,i){this.goalTarget.set(-e,-t,-i)}setTargetDamperDecayTime(e){this.targetDamperX.setDecayTime(e),this.targetDamperY.setDecayTime(e),this.targetDamperZ.setDecayTime(e)}getTarget(){return this.goalTarget.clone().multiplyScalar(-1)}getDynamicTarget(){return this.target.position.clone().multiplyScalar(-1)}jumpToGoal(){this.updateTarget(1e4)}updateTarget(e){let t=this.goalTarget,i=this.target.position;if(t.equals(i))return!1;{let r=this.boundingSphere.radius/10,{x:n,y:a,z:s}=i;return n=this.targetDamperX.update(n,t.x,e,r),a=this.targetDamperY.update(a,t.y,e,r),s=this.targetDamperZ.update(s,t.z,e,r),this.groundedSkybox.position.x=-n,this.groundedSkybox.position.z=-s,this.target.position.set(n,a,s),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(e,t){let{x:i,z:r}=this.position;this.yaw=Math.atan2(e-i,t-r)}get model(){return this._model}set yaw(e){this.pivot.rotation.y=e,this.groundedSkybox.rotation.y=-e,this.queueRender()}get yaw(){return this.pivot.rotation.y}set animationTime(e){this.mixer.setTime(e),this.queueShadowRender()}get animationTime(){if(null!=this.currentAnimationAction){let e=Math.max(this.currentAnimationAction._loopCount,0);return 2202===this.currentAnimationAction.loop&&(1&e)==1?this.duration-this.currentAnimationAction.time:this.currentAnimationAction.time}return 0}set animationTimeScale(e){this.mixer.timeScale=e}get animationTimeScale(){return this.mixer.timeScale}get duration(){return null!=this.currentAnimationAction&&this.currentAnimationAction.getClip()?this.currentAnimationAction.getClip().duration:0}get hasActiveAnimation(){return null!=this.currentAnimationAction}playAnimation(e=null,t=0,i=2201,r=1/0){if(null==this._currentGLTF)return;let{animations:n}=this;if(null==n||0===n.length)return;let a=null;if(null!=e&&null==(a=this.animationsByName.get(e))){let t=parseInt(e);!isNaN(t)&&t>=0&&t<n.length&&(a=n[t])}null==a&&(a=n[0]);try{let{currentAnimationAction:e}=this,n=this.mixer.clipAction(a,this);this.currentAnimationAction=n,this.element.paused?this.mixer.stopAllAction():(n.paused=!1,null!=e&&n!==e?n.crossFadeFrom(e,t,!1):this.animationTimeScale>0&&this.animationTime==this.duration&&(this.animationTime=0)),n.setLoop(i,r),n.enabled=!0,n.clampWhenFinished=!0,n.play()}catch(e){console.error(e)}}appendAnimation(e="",t=2201,i=1/0,r=1,n=1,a=!1,s=!1,o=!0,l=null,h=!1){if(null==this._currentGLTF||e===this.element.animationName)return;let{animations:c}=this;if(null==c||0===c.length)return;let u=e?this.animationsByName.get(e):null;if(null==u)return;if("string"==typeof i?isNaN(parseFloat(i))?(i=1/0,console.warn(`Invalid repetitionCount value: ${i}. Using default: Infinity`)):(1>parseInt(i)&&console.warn(`Invalid repetitionCount value: ${i}. Using 1 as minimum.`),i=Math.max(parseInt(i),1)):"number"==typeof i&&i<1?(i=1,console.warn(`Invalid repetitionCount value: ${i}. Using 1 value as minimum.`)):console.warn(`Invalid repetitionCount value: ${i}. Using default: Infinity`),1===i&&2200!==t&&(t=2200),"string"==typeof r){let e=parseFloat(r);isNaN(e)||e<0||e>1?(r=1,console.warn(`Invalid weight value: ${r}. Using default: 1`)):r=e}if("string"==typeof n){let e=parseFloat(n);isNaN(e)||e<0?(n=1,console.warn(`Invalid timeScale value: ${n}. Using default: 1`)):n=e}if("string"==typeof l){let e=parseFloat(l);isNaN(e)?(l=null,console.warn(`Invalid time value: ${l}. Using default: 0 or previous time`)):l=e}let{shouldFade:d,duration:p}=this.parseFadeValue(a,!1,1.25),A=!1,f=0;"boolean"==typeof s?(A=s,f=1.25*!!s):"number"==typeof s?(A=s>0,f=Math.max(s,0),s<0&&console.warn(`Invalid warp value: ${s}. Using default: false`)):"string"==typeof s&&("true"===s.toLowerCase().trim()?(A=!0,f=1.25):"false"===s.toLowerCase().trim()?A=!1:isNaN(parseFloat(s))?console.warn(`Invalid warp value: ${s}. Using default: false`):(A=(f=Math.max(parseFloat(s),0))>0,f<=0&&console.warn(`Invalid warp value: ${s}. Using default: false`)));try{let a=this.mixer.existingAction(u)||this.mixer.clipAction(u,this),s=a.timeScale;h&&this.appendedAnimations.includes(e)&&!this.markedAnimations.map(e=>e.name).includes(e)&&this.markedAnimations.push({name:e,loopMode:t,repetitionCount:i}),"number"==typeof l&&(a.time=Math.min(Math.max(l,0),u.duration)),d?a.fadeIn(p):r>=0&&(a.weight=Math.min(Math.max(r,0),1)),A?a.warp(o?s:0,n,f):a.timeScale=n,a.isRunning()||(a.time==u.duration&&a.stop(),a.setLoop(t,i),a.paused=!1,a.enabled=!0,a.clampWhenFinished=!0,a.play()),this.appendedAnimations.includes(e)||this.element[fY].appendedAnimations.push(e)}catch(e){console.error(e)}}parseFadeValue(e,t=!0,i=1.5){if("boolean"==typeof e)return{shouldFade:e,duration:e?i:0};if("number"==typeof e){let t=Math.max(e,0);return{shouldFade:t>0,duration:t}}if("string"==typeof e){let t=e.toLowerCase().trim();if("true"===t)return{shouldFade:!0,duration:i};if("false"===t)return{shouldFade:!1,duration:0};let r=parseFloat(t);if(!isNaN(r)){let e=Math.max(r,0);return{shouldFade:e>0,duration:e}}}return console.warn(`Invalid fade value: ${e}. Using default: ${t}`),{shouldFade:t,duration:t?i:0}}detachAnimation(e="",t=!0){if(null==this._currentGLTF||e===this.element.animationName)return;let{animations:i}=this;if(null==i||0===i.length)return;let r=e?this.animationsByName.get(e):null;if(null==r)return;let{shouldFade:n,duration:a}=this.parseFadeValue(t,!0,1.5);try{let t=this.mixer.existingAction(r)||this.mixer.clipAction(r,this);n?t.fadeOut(a):t.stop(),this.element[fY].appendedAnimations=this.element[fY].appendedAnimations.filter(t=>t!==e)}catch(e){console.error(e)}}updateAnimationLoop(e="",t=2201,i=1/0){if(null==this._currentGLTF||e===this.element.animationName)return;let{animations:r}=this;if(null==r||0===r.length)return;let n=null;if(e&&(n=this.animationsByName.get(e)),null!=n)try{let e=this.mixer.existingAction(n)||this.mixer.clipAction(n,this);e.stop(),e.setLoop(t,i),e.play()}catch(e){console.error(e)}}stopAnimation(){this.currentAnimationAction=null,this.mixer.stopAllAction()}updateAnimation(e){this.mixer.update(e),this.queueShadowRender()}subscribeMixerEvent(e,t){this.mixer.addEventListener(e,t)}updateShadow(){let e=this.shadow;if(null!=e){let t="wall"===this.element.arPlacement?"back":"bottom";e.setScene(this,this.shadowSoftness,t),e.needsUpdate=!0}}renderShadow(e){let t=this.shadow;null!=t&&!0==t.needsUpdate&&(t.render(e,this),t.needsUpdate=!1)}queueShadowRender(){null!=this.shadow&&(this.shadow.needsUpdate=!0)}setShadowIntensity(e){if((this.shadowIntensity=e,null!=this._currentGLTF)&&(this.setBakedShadowVisibility(),!(e<=0)||null!=this.shadow)){if(null==this.shadow){let e="wall"===this.element.arPlacement?"back":"bottom";this.shadow=new ff(this,this.shadowSoftness,e)}this.shadow.setIntensity(e)}}setShadowSoftness(e){this.shadowSoftness=e;let t=this.shadow;null!=t&&t.setSoftness(e)}setShadowOffset(e){let t=this.shadow;null!=t&&t.setOffset(e)}getHit(e=this){return fb.intersectObject(e,!0).find(e=>e.object.visible&&!e.object.userData.noHit)}hitFromController(e,t=this){return fb.setFromXRController(e),this.getHit(t)}hitFromPoint(e,t=this){return fb.setFromCamera(e,this.getCamera()),this.getHit(t)}positionAndNormalFromPoint(e,t=this){var i;let r=this.hitFromPoint(e,t);if(null==r)return null;let n=r.point;return{position:n,normal:null!=r.face?r.face.normal.clone().applyNormalMatrix(new ia().getNormalMatrix(r.object.matrixWorld)):fb.ray.direction.clone().multiplyScalar(-1),uv:null!=(i=r.uv)?i:null}}surfaceFromPoint(e,t=this){let i=this.element.model;if(null==i)return null;let r=this.hitFromPoint(e,t);if(null==r||null==r.face)return null;let{meshes:n,primitives:a}=i[A1](r).mesh.userData.associations,s=new it,o=new it,l=new it,{a:h,b:c,c:u}=r.face,d=r.object;d.getVertexPosition(h,s),d.getVertexPosition(c,o),d.getVertexPosition(u,l);let p=new rT(s,o,l),A=new it;return p.getBarycoord(d.worldToLocal(r.point),A),`${n} ${a} ${h} ${c} ${u} ${A.x.toFixed(3)} ${A.y.toFixed(3)} ${A.z.toFixed(3)}`}addHotspot(e){this.target.add(e),this.annotationRenderer.domElement.appendChild(e.element),this.updateSurfaceHotspot(e)}removeHotspot(e){this.target.remove(e)}forHotspots(e){let{children:t}=this.target;for(let i=0,r=t.length;i<r;i++){let r=t[i];r instanceof fd&&e(r)}}updateSurfaceHotspot(e){if(null==e.surface||null==this.element.model)return;let t=u_(e.surface)[0].terms;if(8!=t.length)return void console.warn(e.surface+" does not have exactly 8 numbers.");let i=this.element.model[A2](t[0].number,t[1].number);if(null==i)return void console.warn(e.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");let r=i.mesh.geometry.attributes.position.count,n=new it(t[2].number,t[3].number,t[4].number);if(n.x>=r||n.y>=r||n.z>=r)return void console.warn(e.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");let a=new it(t[5].number,t[6].number,t[7].number);e.mesh=i.mesh,e.tri=n,e.bary=a,e.updateSurface()}animateSurfaceHotspots(){this.element.paused||this.forHotspots(e=>{e.updateSurface()})}updateHotspotsVisibility(e){this.forHotspots(t=>{fg.copy(e),fm.setFromMatrixPosition(t.matrixWorld),fg.sub(fm),fv.copy(t.normal).transformDirection(this.target.matrixWorld),0>fg.dot(fv)?t.hide():t.show()})}orientHotspots(e){this.forHotspots(t=>{t.orient(e)})}setHotspotsVisibility(e){this.forHotspots(t=>{t.visible=e})}updateSchema(e){var t;let{schemaElement:i,element:r}=this,{alt:n,poster:a,iosSrc:s}=r;if(null!=e){let r=[{"@type":"MediaObject",contentUrl:e,encodingFormat:(null==(t=e.split(".").pop())?void 0:t.toLowerCase())==="gltf"?"model/gltf+json":"model/gltf-binary"}];s&&r.push({"@type":"MediaObject",contentUrl:s,encodingFormat:"model/vnd.usdz+zip"}),i.textContent=JSON.stringify({"@context":"http://schema.org/","@type":"3DModel",image:null!=a?a:void 0,name:null!=n?n:void 0,encoding:r}),document.head.appendChild(i)}else null!=i.parentElement&&i.parentElement.removeChild(i)}}class fE extends EventTarget{constructor(){super(...arguments),this.ongoingActivities=new Set,this.totalProgress=0}get ongoingActivityCount(){return this.ongoingActivities.size}beginActivity(e){let t={progress:0,completed:!1};return this.ongoingActivities.add(t),1===this.ongoingActivityCount&&this.announceTotalProgress(t,0,e),i=>{let r;return(r=Math.max(e1(i,0,1),t.progress))!==t.progress&&this.announceTotalProgress(t,r,e),t.progress}}announceTotalProgress(e,t,i){let r=0,n=0;for(let i of(1==t&&(e.completed=!0),this.ongoingActivities)){let{progress:e}=i;r+=1-e,i.completed&&n++}let a=e.progress;e.progress=t,this.totalProgress+=(t-a)*(1-this.totalProgress)/r;let s=n===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:s,reason:i}})),n===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}}var fS=function(e,t,i,r){var n,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(s=(a<3?n(s):a>3?n(t,i,s):n(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let fC=document.createElement("canvas"),fM=Symbol("fallbackResizeHandler"),fw=Symbol("defaultAriaLabel"),fI=Symbol("resizeObserver"),fT=Symbol("clearModelTimeout"),fB=Symbol("onContextLost"),fR=Symbol("loaded"),fD=Symbol("status"),fL=Symbol("onFocus"),fP=Symbol("onBlur"),fU=Symbol("updateSize"),fF=Symbol("intersectionObserver"),fN=Symbol("isElementInViewport"),fO=Symbol("announceModelVisibility"),fk=Symbol("ariaLabel"),fQ=Symbol("altDefaulted"),fG=Symbol("statusElement"),fH=Symbol("updateStatus"),fz=Symbol("loadedTime"),fV=Symbol("updateSource"),fW=Symbol("markLoaded"),fq=Symbol("container"),fj=Symbol("input"),fX=Symbol("canvas"),fY=Symbol("scene"),fK=Symbol("needsRender"),fJ=Symbol("tick"),f$=Symbol("onModelLoad"),fZ=Symbol("onResize"),f0=Symbol("renderer"),f1=Symbol("progressTracker"),f2=Symbol("getLoaded"),f3=Symbol("getModelIsVisible"),f4=Symbol("shouldAttemptPreload"),f5=e=>({x:e.x,y:e.y,z:e.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}}),f8=e=>({u:e.x,v:e.y,toString(){return`${this.u} ${this.v}`}});class f9 extends K{static get is(){return"model-viewer"}static set modelCacheSize(e){lg[lA].evictionThreshold=e}static get modelCacheSize(){return lg[lA].evictionThreshold}static set minimumRenderScale(e){e>1&&console.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&console.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0.25."),p1.singleton.minScale=e}static get minimumRenderScale(){return p1.singleton.minScale}get loaded(){return this[f2]()}get[(tx=fN,t_=fR,tE=fz,tS=fD,tC=fT,tM=fM,tw=fO,tI=fI,tT=fF,tB=f1,f0)](){return p1.singleton}get modelIsVisible(){return this[f3]()}constructor(){let e,t;super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[tx]=!1,this[t_]=!1,this[tE]=0,this[tS]="",this[tC]=null,this[tM]=e0(()=>{let e=this.getBoundingClientRect();this[fU](e)},50),this[tw]=e0(e=>{let t=this.modelIsVisible;t!==e&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:t}}))},0),this[tI]=null,this[tT]=null,this[tB]=new fE,this[tR]=()=>{this[fG].textContent=this[fD]},this[tD]=()=>{this[fG].textContent=""},this[tL]=e=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:e.sourceEvent}}))},this.attachShadow({mode:"open"});const i=this.shadowRoot;if((e=>{eF(tH,e)})(i),this[fq]=i.querySelector(".container"),this[fj]=i.querySelector(".userInput"),this[fX]=i.querySelector("canvas"),this[fG]=i.querySelector("#status"),this[fw]=this[fj].getAttribute("aria-label"),this.isConnected){const i=this.getBoundingClientRect();e=i.width,t=i.height}else e=300,t=150;this[fY]=new f_({canvas:this[fX],element:this,width:e,height:t}),Promise.resolve().then(()=>{this[fU](this.getBoundingClientRect())}),eH&&(this[fI]=new ResizeObserver(e=>{if(!this[f0].isPresenting)for(let t of e)t.target===this&&this[fU](t.contentRect)})),ez?this[fF]=new IntersectionObserver(e=>{for(let t of e)if(t.target===this){let e=this.modelIsVisible;this[fN]=t.isIntersecting,this[fO](e),this[fN]&&!this.loaded&&this[fV]()}},{root:null,rootMargin:"0px",threshold:1e-5}):this[fN]=!0}connectedCallback(){super.connectedCallback&&super.connectedCallback(),eH?this[fI].observe(this):self.addEventListener("resize",this[fM]),ez&&this[fF].observe(this),this.addEventListener("focus",this[fL]),this.addEventListener("blur",this[fP]);let e=this[f0];e.addEventListener("contextlost",this[fB]),e.registerScene(this[fY]),null!=this[fT]&&(self.clearTimeout(this[fT]),this[fT]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),eH?this[fI].unobserve(this):self.removeEventListener("resize",this[fM]),ez&&this[fF].unobserve(this),this.removeEventListener("focus",this[fL]),this.removeEventListener("blur",this[fP]);let e=this[f0];e.removeEventListener("contextlost",this[fB]),e.unregisterScene(this[fY]),this[fT]=self.setTimeout(()=>{this[fY].dispose(),this[fT]=null},10)}updated(e){super.updated(e),e.has("src")&&(null==this.src?(this[fR]=!1,this[fz]=0,this[fY].reset()):this.src!==this[fY].url&&(this[fR]=!1,this[fz]=0,this[fV]())),e.has("alt")&&this[fj].setAttribute("aria-label",this[fk]),e.has("generateSchema")&&(this.generateSchema?this[fY].updateSchema(this.src):this[fY].updateSchema(null))}toDataURL(e,t){return this[f0].displayCanvas(this[fY]).toDataURL(e,t)}async toBlob(e){let t=e?e.mimeType:void 0,i=e?e.qualityArgument:void 0,r=e?e.idealAspect:void 0,{width:n,height:a,idealAspect:s,aspect:o}=this[fY],{dpr:l,scaleFactor:h}=this[f0],c=n*h*l,u=a*h*l,d=0,p=0;!0===r&&(s>o?p=(u-(u=Math.round(c/s)))/2:d=(c-(c=Math.round(u*s)))/2),fC.width=c,fC.height=u;try{return new Promise(async(e,r)=>{fC.getContext("2d").drawImage(this[f0].displayCanvas(this[fY]),d,p,c,u,0,0,c,u),fC.toBlob(t=>{if(!t)return r(Error("Unable to retrieve canvas blob"));e(t)},t,i)})}finally{this[fU]({width:n,height:a})}}registerEffectComposer(e){e.setRenderer(this[f0].threeRenderer),e.setMainCamera(this[fY].getCamera()),e.setMainScene(this[fY]),this[fY].effectRenderer=e}unregisterEffectComposer(){this[fY].effectRenderer=null}registerRenderer(e){this[fY].externalRenderer=e}unregisterRenderer(){this[fY].externalRenderer=null}get[fk](){return this[fQ]}get[fQ](){return null==this.alt||"null"===this.alt?this[fw]:this.alt}[f2](){return this[fR]}[f3](){return this.loaded&&this[fN]}[f4](){return!!this.src&&this[fN]}[fU]({width:e,height:t}){0!==e&&0!==t&&(this[fq].style.width=`${e}px`,this[fq].style.height=`${t}px`,this[fZ]({width:e,height:t}))}[fJ](e,t){var i;null==(i=this[fY].effectRenderer)||i.beforeRender(e,t)}[fW](){this[fR]||(this[fR]=!0,this[fz]=performance.now())}[fK](){this[fY].queueRender()}[f$](){}[fH](e){this[fD]=e;let t=this.getRootNode();null!=t&&t.activeElement===this&&this[fG].textContent!=e&&(this[fG].textContent=e)}[(tR=fL,tD=fP,fZ)](e){this[fY].setSize(e.width,e.height)}async [(tL=fB,fV)](){let e=this[fY];if(this.loaded||!this[f4]()||this.src===e.url)return;this.generateSchema&&e.updateSchema(this.src),this[fH]("Loading"),e.stopAnimation();let t=this[f1].beginActivity("model-load"),i=this.src;try{let r=e.setSource(i,e=>t(.95*e1(e,0,1))),n=this[tN]();await Promise.all([r,n]),this[fW](),this[f$](),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("before-render"))}),await new Promise(e=>{let t=setTimeout(()=>{console.warn("rAF timed out in updateSource"),e()},500);requestAnimationFrame(()=>{requestAnimationFrame(()=>{clearTimeout(t),e()})})}),this.dispatchEvent(new CustomEvent("load",{detail:{url:i}}))}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:e}}))}finally{t(1)}}}fS([$({type:String})],f9.prototype,"alt",void 0),fS([$({type:String})],f9.prototype,"src",void 0),fS([$({type:Boolean,attribute:"with-credentials"})],f9.prototype,"withCredentials",void 0),fS([$({type:Boolean,attribute:"generate-schema"})],f9.prototype,"generateSchema",void 0);var f6=function(e,t,i,r){var n,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(s=(a<3?n(s):a>3?n(t,i,s):n(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let f7=Symbol("changeAnimation"),ge=Symbol("appendAnimation"),gt=Symbol("detachAnimation"),gi=Symbol("paused"),gr={repetitions:1/0,pingpong:!1},gn={pingpong:!1,repetitions:null,weight:1,timeScale:1,fade:!1,warp:!1,relativeWarp:!0,time:null},ga={fade:!0},gs=Symbol("hotspotMap"),go=Symbol("mutationCallback"),gl=Symbol("observer"),gh=Symbol("addHotspot"),gc=Symbol("removeHotspot"),gu=new i$;var gd=Uint8Array,gp=Uint16Array,gA=Int32Array,gf=new gd([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,0,0,0]),gg=new gd([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,0,0]),gm=new gd([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gv=function(e,t){for(var i=new gp(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];for(var n=new gA(i[30]),r=1;r<30;++r)for(var a=i[r];a<i[r+1];++a)n[a]=a-i[r]<<5|r;return{b:i,r:n}},gb=gv(gf,2),gy=gb.b,gx=gb.r;gy[28]=258,gx[258]=28;for(var g_=gv(gg,0),gE=(g_.b,g_.r),gS=new gp(32768),gC=0;gC<32768;++gC){var gM=(43690&gC)>>1|(21845&gC)<<1;gM=(61680&(gM=(52428&gM)>>2|(13107&gM)<<2))>>4|(3855&gM)<<4,gS[gC]=((65280&gM)>>8|(255&gM)<<8)>>1}for(var gw=function(e,t,i){for(var r,n=e.length,a=0,s=new gp(t);a<n;++a)e[a]&&++s[e[a]-1];var o=new gp(t);for(a=1;a<t;++a)o[a]=o[a-1]+s[a-1]<<1;if(i){r=new gp(1<<t);var l=15-t;for(a=0;a<n;++a)if(e[a])for(var h=a<<4|e[a],c=t-e[a],u=o[e[a]-1]++<<c,d=u|(1<<c)-1;u<=d;++u)r[gS[u]>>l]=h}else for(a=0,r=new gp(n);a<n;++a)e[a]&&(r[a]=gS[o[e[a]-1]++]>>15-e[a]);return r},gI=new gd(288),gC=0;gC<144;++gC)gI[gC]=8;for(var gC=144;gC<256;++gC)gI[gC]=9;for(var gC=256;gC<280;++gC)gI[gC]=7;for(var gC=280;gC<288;++gC)gI[gC]=8;for(var gT=new gd(32),gC=0;gC<32;++gC)gT[gC]=5;var gB=gw(gI,9,0),gR=gw(gT,5,0),gD=function(e){return(e+7)/8|0},gL=function(e,t,i){return(null==t||t<0)&&(t=0),(null==i||i>e.length)&&(i=e.length),new gd(e.subarray(t,i))},gP=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],gU=function(e,t,i){var r=Error(t||gP[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,gU),!i)throw r;return r},gF=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>8},gN=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>8,e[r+2]|=i>>16},gO=function(e,t){for(var i=[],r=0;r<e.length;++r)e[r]&&i.push({s:r,f:e[r]});var n=i.length,a=i.slice();if(!n)return{t:gW,l:0};if(1==n){var s=new gd(i[0].s+1);return s[i[0].s]=1,{t:s,l:1}}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var o=i[0],l=i[1],h=0,c=1,u=2;for(i[0]={s:-1,f:o.f+l.f,l:o,r:l};c!=n-1;)o=i[i[h].f<i[u].f?h++:u++],l=i[h!=c&&i[h].f<i[u].f?h++:u++],i[c++]={s:-1,f:o.f+l.f,l:o,r:l};for(var d=a[0].s,r=1;r<n;++r)a[r].s>d&&(d=a[r].s);var p=new gp(d+1),A=gk(i[c-1],p,0);if(A>t){var r=0,f=0,g=A-t,m=1<<g;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<n;++r){var v=a[r].s;if(p[v]>t)f+=m-(1<<A-p[v]),p[v]=t;else break}for(f>>=g;f>0;){var b=a[r].s;p[b]<t?f-=1<<t-p[b]++-1:++r}for(;r>=0&&f;--r){var y=a[r].s;p[y]==t&&(--p[y],++f)}A=t}return{t:new gd(p),l:A}},gk=function(e,t,i){return -1==e.s?Math.max(gk(e.l,t,i+1),gk(e.r,t,i+1)):t[e.s]=i},gQ=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new gp(++t),r=0,n=e[0],a=1,s=function(e){i[r++]=e},o=1;o<=t;++o)if(e[o]==n&&o!=t)++a;else{if(!n&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(n),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}for(;a--;)s(n);a=1,n=e[o]}return{c:i.subarray(0,r),n:t}},gG=function(e,t){for(var i=0,r=0;r<t.length;++r)i+=e[r]*t[r];return i},gH=function(e,t,i){var r=i.length,n=gD(t+2);e[n]=255&r,e[n+1]=r>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var a=0;a<r;++a)e[n+a+4]=i[a];return(n+4+r)*8},gz=function(e,t,i,r,n,a,s,o,l,h,c){gF(t,c++,i),++n[256];for(var u,d,p,A,f=gO(n,15),g=f.t,m=f.l,v=gO(a,15),b=v.t,y=v.l,x=gQ(g),_=x.c,E=x.n,S=gQ(b),C=S.c,M=S.n,w=new gp(19),I=0;I<_.length;++I)++w[31&_[I]];for(var I=0;I<C.length;++I)++w[31&C[I]];for(var T=gO(w,7),B=T.t,R=T.l,D=19;D>4&&!B[gm[D-1]];--D);var L=h+5<<3,P=gG(n,gI)+gG(a,gT)+s,U=gG(n,g)+gG(a,b)+s+14+3*D+gG(w,B)+2*w[16]+3*w[17]+7*w[18];if(l>=0&&L<=P&&L<=U)return gH(t,c,e.subarray(l,l+h));if(gF(t,c,1+(U<P)),c+=2,U<P){u=gw(g,m,0),d=g,p=gw(b,y,0),A=b;var F=gw(B,R,0);gF(t,c,E-257),gF(t,c+5,M-1),gF(t,c+10,D-4),c+=14;for(var I=0;I<D;++I)gF(t,c+3*I,B[gm[I]]);c+=3*D;for(var N=[_,C],O=0;O<2;++O)for(var k=N[O],I=0;I<k.length;++I){var Q=31&k[I];gF(t,c,F[Q]),c+=B[Q],Q>15&&(gF(t,c,k[I]>>5&127),c+=k[I]>>12)}}else u=gB,d=gI,p=gR,A=gT;for(var I=0;I<o;++I){var G=r[I];if(G>255){var Q=G>>18&31;gN(t,c,u[Q+257]),c+=d[Q+257],Q>7&&(gF(t,c,G>>23&31),c+=gf[Q]);var H=31&G;gN(t,c,p[H]),c+=A[H],H>3&&(gN(t,c,G>>5&8191),c+=gg[H])}else gN(t,c,u[G]),c+=d[G]}return gN(t,c,u[256]),c+d[256]},gV=new gA([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),gW=new gd(0),gq=function(e,t,i,r,n,a){var s=a.z||e.length,o=new gd(r+s+5*(1+Math.ceil(s/7e3))+n),l=o.subarray(r,o.length-n),h=a.l,c=7&(a.r||0);if(t){c&&(l[0]=a.r>>3);for(var u=gV[t-1],d=u>>13,p=8191&u,A=(1<<i)-1,f=a.p||new gp(32768),g=a.h||new gp(A+1),m=Math.ceil(i/3),v=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<v)&A},y=new gA(25e3),x=new gp(288),_=new gp(32),E=0,S=0,C=a.i||0,M=0,w=a.w||0,I=0;C+2<s;++C){var T=b(C),B=32767&C,R=g[T];if(f[B]=R,g[T]=B,w<=C){var D=s-C;if((E>7e3||M>24576)&&(D>423||!h)){c=gz(e,l,0,y,x,_,S,M,I,C-I,c),M=E=S=0,I=C;for(var L=0;L<286;++L)x[L]=0;for(var L=0;L<30;++L)_[L]=0}var P=2,U=0,F=p,N=B-R&32767;if(D>2&&T==b(C-N))for(var O=Math.min(d,D)-1,k=Math.min(32767,C),Q=Math.min(258,D);N<=k&&--F&&B!=R;){if(e[C+P]==e[C+P-N]){for(var G=0;G<Q&&e[C+G]==e[C+G-N];++G);if(G>P){if(P=G,U=N,G>O)break;for(var H=Math.min(N,G-2),z=0,L=0;L<H;++L){var V=C-N+L&32767,W=f[V],q=V-W&32767;q>z&&(z=q,R=V)}}}R=f[B=R],N+=B-R&32767}if(U){y[M++]=0x10000000|gx[P]<<18|gE[U];var j=31&gx[P],X=31&gE[U];S+=gf[j]+gg[X],++x[257+j],++_[X],w=C+P,++E}else y[M++]=e[C],++x[e[C]]}}for(C=Math.max(C,w);C<s;++C)y[M++]=e[C],++x[e[C]];c=gz(e,l,h,y,x,_,S,M,I,C-I,c),h||(a.r=7&c|l[c/8|0]<<3,c-=7,a.h=g,a.p=f,a.i=C,a.w=w)}else{for(var C=a.w||0;C<s+h;C+=65535){var Y=C+65535;Y>=s&&(l[c/8|0]=h,Y=s),c=gH(l,c+1,e.subarray(C,Y))}a.i=s}return gL(o,0,r+gD(c)+n)},gj=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var i=t,r=9;--r;)i=(1&i&&-0x12477ce0)^i>>>1;e[t]=i}return e}(),gX=function(){var e=-1;return{p:function(t){for(var i=e,r=0;r<t.length;++r)i=gj[255&i^t[r]]^i>>>8;e=i},d:function(){return~e}}},gY=function(e,t,i,r,n){if(!n&&(n={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),s=new gd(a.length+e.length);s.set(a),s.set(e,a.length),e=s,n.w=a.length}return gq(e,null==t.level?6:t.level,null==t.mem?n.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,i,r,n)},gK=function(e,t){var i={};for(var r in e)i[r]=e[r];for(var r in t)i[r]=t[r];return i},gJ=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8},g$=function(e,t,i,r){for(var n in e){var a=e[n],s=t+n,o=r;Array.isArray(a)&&(o=gK(r,a[1]),a=a[0]),a instanceof gd?i[s]=[a,o]:(i[s+="/"]=[new gd(0),o],g$(a,s,i,r))}},gZ="u">typeof TextEncoder&&new TextEncoder,g0="u">typeof TextDecoder&&new TextDecoder;try{g0.decode(gW,{stream:!0})}catch(e){}function g1(e,t){if(t){for(var i=new gd(e.length),r=0;r<e.length;++r)i[r]=e.charCodeAt(r);return i}if(gZ)return gZ.encode(e);for(var n=e.length,a=new gd(e.length+(e.length>>1)),s=0,o=function(e){a[s++]=e},r=0;r<n;++r){if(s+5>a.length){var l=new gd(s+8+(n-r<<1));l.set(a),a=l}var h=e.charCodeAt(r);h<128||t?o(h):(h<2048?o(192|h>>6):(h>55295&&h<57344?(o(240|(h=65536+(1047552&h)|1023&e.charCodeAt(++r))>>18),o(128|h>>12&63)):o(224|h>>12),o(128|h>>6&63)),o(128|63&h))}return gL(a,0,s)}var g2=function(e){var t=0;if(e)for(var i in e){var r=e[i].length;r>65535&&gU(9),t+=r+4}return t},g3=function(e,t,i,r,n,a,s,o){var l=r.length,h=i.extra,c=o&&o.length,u=g2(h);gJ(e,t,null!=s?0x2014b50:0x4034b50),t+=4,null!=s&&(e[t++]=20,e[t++]=i.os),e[t]=20,t+=2,e[t++]=i.flag<<1|(a<0&&8),e[t++]=n&&8,e[t++]=255&i.compression,e[t++]=i.compression>>8;var d=new Date(null==i.mtime?Date.now():i.mtime),p=d.getFullYear()-1980;if((p<0||p>119)&&gU(10),gJ(e,t,p<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>1),t+=4,-1!=a&&(gJ(e,t,i.crc),gJ(e,t+4,a<0?-a-2:a),gJ(e,t+8,i.size)),gJ(e,t+12,l),gJ(e,t+14,u),t+=16,null!=s&&(gJ(e,t,c),gJ(e,t+6,i.attrs),gJ(e,t+10,s),t+=14),e.set(r,t),t+=l,u)for(var A in h){var f=h[A],g=f.length;gJ(e,t,+A),gJ(e,t+2,g),e.set(f,t+4),t+=4+g}return c&&(e.set(o,t),t+=c),t},g4=function(e,t,i,r,n){gJ(e,t,0x6054b50),gJ(e,t+8,i),gJ(e,t+10,i),gJ(e,t+12,r),gJ(e,t+16,n)};"function"==typeof queueMicrotask&&queueMicrotask;class g5{constructor(e,t="",i=[],r=[]){this.name=e,this.type=t,this.metadata=i,this.properties=r,this.children=[]}addMetadata(e,t){this.metadata.push({key:e,value:t})}addProperty(e,t=[]){this.properties.push({property:e,metadata:t})}addChild(e){this.children.push(e)}toString(e=0){let t=" ".repeat(e),i=this.metadata.map(e=>{let i=e.key,r=e.value;if(!Array.isArray(r))return`${i} = ${r}`;{let e=[];return e.push(`${i} = {`),r.forEach(i=>{e.push(`${t} ${i}`)}),e.push(`${t} }`),e.join("\n")}}),r=i.length?` (
|
|
968
|
+
${i.map(e=>`${t} ${e}`).join("\n")}
|
|
969
|
+
${t})`:"",n=this.properties.map(e=>{let i=e.property,r=e.metadata.length?` (
|
|
970
|
+
${e.metadata.map(e=>`${t} ${e}`).join("\n")}
|
|
971
|
+
${t} )`:"";return`${t} ${i}${r}`}),a=this.children.map(t=>t.toString(e+1)),s=[];if(n.length>0&&s.push(...n),a.length>0){n.length>0&&s.push("");for(let e=0;e<a.length;e++)s.push(a[e]),e<a.length-1&&s.push("")}let o=s.join("\n"),l=this.type?this.type+" ":"";return`${t}def ${l}"${this.name}"${r}
|
|
972
|
+
${t}{
|
|
973
|
+
${o}
|
|
974
|
+
${t}}`}}class g8{constructor(){this.textureUtils=null}setTextureUtils(e){this.textureUtils=e}parse(e,t,i,r){this.parseAsync(e,r).then(t).catch(i)}async parseAsync(e,t={}){let i;t=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},includeAnchoringProperties:!0,onlyVisible:!0,quickLookCompatible:!1,maxTextureSize:1024},t);let r=new Set,n={},a="model.usda";n[a]=null;let s=new g5("Root","Xform"),o=new g5("Scenes","Scope");o.addMetadata("kind",'"sceneLibrary"'),s.addChild(o);let l="Scene",h=new g5(l,"Xform");h.addMetadata("customData",["bool preliminary_collidesWithEnvironment = 0",`string sceneName = "${l}"`]),h.addMetadata("sceneName",`"${l}"`),t.includeAnchoringProperties&&(h.addProperty(`token preliminary:anchoring:type = "${t.ar.anchoring.type}"`),h.addProperty(`token preliminary:planeAnchoring:alignment = "${t.ar.planeAnchoring.alignment}"`)),o.addChild(h);let c={},u={};!function e(t,i,r,n,a,s){for(let o=0,l=t.children.length;o<l;o++){let l,h=t.children[o];if(!1!==h.visible||!0!==s.onlyVisible){if(h.isMesh){let e=h.geometry,t=h.material;if(t.isMeshStandardMaterial){let i="geometries/Geometry_"+e.id+".usda";if(!(i in a)){let t=function(e){let t=new g5("Geometry"),i=function(e){var t;let i=e.attributes,r=i.position.count,n=new g5("Geometry","Mesh");n.addProperty(`int[] faceVertexCounts = [${Array((null!==(t=e).index?t.index.count:t.attributes.position.count)/3).fill(3).join(", ")}]`),n.addProperty(`int[] faceVertexIndices = [${function(e){let t=e.index,i=[];if(null!==t)for(let e=0;e<t.count;e++)i.push(t.getX(e));else{let t=e.attributes.position.count;for(let e=0;e<t;e++)i.push(e)}return i.join(", ")}(e)}]`),n.addProperty(`normal3f[] normals = [${mi(i.normal,r)}]`,['interpolation = "vertex"']),n.addProperty(`point3f[] points = [${mi(i.position,r)}]`);for(let e=0;e<4;e++){let t=e>0?e:"",r=i["uv"+t];void 0!==r&&n.addProperty(`texCoord2f[] primvars:st${t} = [${function(e){let t=[];for(let i=0;i<e.count;i++){let r=e.getX(i),n=e.getY(i);t.push(`(${r.toPrecision(7)}, ${1-n.toPrecision(7)})`)}return t.join(", ")}(r)}]`,['interpolation = "vertex"'])}let a=i.color;return void 0!==a&&n.addProperty(`color3f[] primvars:displayColor = [${mi(a,r)}]`,['interpolation = "vertex"']),n.addProperty('uniform token subdivisionScheme = "none"'),n}(e);return t.addChild(i),t}(e);a[i]=g1(g6()+"\n"+t.toString())}t.uuid in r||(r[t.uuid]=t),l=function(e,t,i,r){let n=g7(e,r);return n.addMetadata("prepend references",`@./geometries/Geometry_${t.id}.usda@</Geometry>`),n.addMetadata("prepend apiSchemas",'["MaterialBindingAPI"]'),n.addProperty(`rel material:binding = </Materials/Material_${i.id}>`),n}(h,e,r[t.uuid],n)}else console.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",h)}else l=h.isCamera?function(e,t){let i,r,n=g9(e,t),a=me(e.matrix);0>e.matrix.determinant()&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",e);let s=new g5(n,"Camera");s.addProperty(`matrix4d xformOp:transform = ${a}`),s.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]');let o=e.isOrthographicCamera?"orthographic":"perspective";s.addProperty(`token projection = "${o}"`);let l=`(${e.near.toPrecision(7)}, ${e.far.toPrecision(7)})`;if(s.addProperty(`float2 clippingRange = ${l}`),i=e.isOrthographicCamera?((Math.abs(e.left)+Math.abs(e.right))*10).toPrecision(7):e.getFilmWidth().toPrecision(7),s.addProperty(`float horizontalAperture = ${i}`),r=e.isOrthographicCamera?((Math.abs(e.top)+Math.abs(e.bottom))*10).toPrecision(7):e.getFilmHeight().toPrecision(7),s.addProperty(`float verticalAperture = ${r}`),e.isPerspectiveCamera){let t=e.getFocalLength().toPrecision(7);s.addProperty(`float focalLength = ${t}`);let i=e.focus.toPrecision(7);s.addProperty(`float focusDistance = ${i}`)}return s}(h,n):g7(h,n);l&&(i.addChild(l),e(h,l,r,n,a,s))}}}(e,h,c,r,n,t);let d=function(e,t,i=!1){let r=new g5("Materials");for(let n in e){let a=e[n];r.addChild(function(e,t,i=!1){let r=new g5(`Material_${e.id}`,"Material");function n(r,n,a){var s;let o=r.source.id+"_"+r.flipY;t[o]=r;let l=r.channel>0?"st"+r.channel:"st",h={1e3:"repeat",1001:"clamp",1002:"mirror"},c=r.repeat.clone(),u=r.offset.clone(),d=r.rotation,p=Math.sin(d),A=Math.cos(d);u.y=1-u.y-c.y,i?(u.x=u.x/c.x,u.y=u.y/c.y,u.x+=p/c.x,u.y+=A-1):(u.x+=p*c.x,u.y+=(1-A)*c.y);let f=new g5(`PrimvarReader_${n}`,"Shader");f.addProperty('uniform token info:id = "UsdPrimvarReader_float2"'),f.addProperty("float2 inputs:fallback = (0.0, 0.0)"),f.addProperty(`string inputs:varname = "${l}"`),f.addProperty("float2 outputs:result");let g=new g5(`Transform2d_${n}`,"Shader");g.addProperty('uniform token info:id = "UsdTransform2d"'),g.addProperty(`float2 inputs:in.connect = </Materials/Material_${e.id}/PrimvarReader_${n}.outputs:result>`),g.addProperty(`float inputs:rotation = ${(180/Math.PI*d).toFixed(7)}`),g.addProperty(`float2 inputs:scale = ${mn(c)}`),g.addProperty(`float2 inputs:translation = ${mn(u)}`),g.addProperty("float2 outputs:result");let m=new g5(`Texture_${r.id}_${n}`,"Shader");return m.addProperty('uniform token info:id = "UsdUVTexture"'),m.addProperty(`asset inputs:file = @textures/Texture_${o}.png@`),m.addProperty(`float2 inputs:st.connect = </Materials/Material_${e.id}/Transform2d_${n}.outputs:result>`),void 0!==a&&m.addProperty(`float4 inputs:scale = ${(s=a,`(${s.r}, ${s.g}, ${s.b}, 1.0)`)}`),"normal"===n&&(m.addProperty("float4 inputs:scale = (2, 2, 2, 1)"),m.addProperty("float4 inputs:bias = (-1, -1, -1, 0)")),m.addProperty(`token inputs:sourceColorSpace = "${""===r.colorSpace?"raw":"sRGB"}"`),m.addProperty(`token inputs:wrapS = "${h[r.wrapS]}"`),m.addProperty(`token inputs:wrapT = "${h[r.wrapT]}"`),m.addProperty("float outputs:r"),m.addProperty("float outputs:g"),m.addProperty("float outputs:b"),m.addProperty("float3 outputs:rgb"),(e.transparent||e.alphaTest>0)&&m.addProperty("float outputs:a"),[f,g,m]}2===e.side&&console.warn("THREE.USDZExporter: USDZ does not support double sided materials",e);let a=new g5("PreviewSurface","Shader");if(a.addProperty('uniform token info:id = "UsdPreviewSurface"'),null!==e.map?(a.addProperty(`color3f inputs:diffuseColor.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:rgb>`),e.transparent?a.addProperty(`float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`):e.alphaTest>0&&(a.addProperty(`float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`),a.addProperty(`float inputs:opacityThreshold = ${e.alphaTest}`)),n(e.map,"diffuse",e.color).forEach(e=>r.addChild(e))):a.addProperty(`color3f inputs:diffuseColor = ${mr(e.color)}`),null!==e.emissiveMap){a.addProperty(`color3f inputs:emissiveColor.connect = </Materials/Material_${e.id}/Texture_${e.emissiveMap.id}_emissive.outputs:rgb>`);let t=new rP(e.emissive.r*e.emissiveIntensity,e.emissive.g*e.emissiveIntensity,e.emissive.b*e.emissiveIntensity);n(e.emissiveMap,"emissive",t).forEach(e=>r.addChild(e))}else e.emissive.getHex()>0&&a.addProperty(`color3f inputs:emissiveColor = ${mr(e.emissive)}`);if(null!==e.normalMap&&(a.addProperty(`normal3f inputs:normal.connect = </Materials/Material_${e.id}/Texture_${e.normalMap.id}_normal.outputs:rgb>`),n(e.normalMap,"normal").forEach(e=>r.addChild(e))),null!==e.aoMap){a.addProperty(`float inputs:occlusion.connect = </Materials/Material_${e.id}/Texture_${e.aoMap.id}_occlusion.outputs:r>`);let t=new rP(e.aoMapIntensity,e.aoMapIntensity,e.aoMapIntensity);n(e.aoMap,"occlusion",t).forEach(e=>r.addChild(e))}if(null!==e.roughnessMap){a.addProperty(`float inputs:roughness.connect = </Materials/Material_${e.id}/Texture_${e.roughnessMap.id}_roughness.outputs:g>`);let t=new rP(e.roughness,e.roughness,e.roughness);n(e.roughnessMap,"roughness",t).forEach(e=>r.addChild(e))}else a.addProperty(`float inputs:roughness = ${e.roughness}`);if(null!==e.metalnessMap){a.addProperty(`float inputs:metallic.connect = </Materials/Material_${e.id}/Texture_${e.metalnessMap.id}_metallic.outputs:b>`);let t=new rP(e.metalness,e.metalness,e.metalness);n(e.metalnessMap,"metallic",t).forEach(e=>r.addChild(e))}else a.addProperty(`float inputs:metallic = ${e.metalness}`);if(null!==e.alphaMap?(a.addProperty(`float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.alphaMap.id}_opacity.outputs:r>`),a.addProperty("float inputs:opacityThreshold = 0.0001"),n(e.alphaMap,"opacity").forEach(e=>r.addChild(e))):a.addProperty(`float inputs:opacity = ${e.opacity}`),e.isMeshPhysicalMaterial){if(null!==e.clearcoatMap){a.addProperty(`float inputs:clearcoat.connect = </Materials/Material_${e.id}/Texture_${e.clearcoatMap.id}_clearcoat.outputs:r>`);let t=new rP(e.clearcoat,e.clearcoat,e.clearcoat);n(e.clearcoatMap,"clearcoat",t).forEach(e=>r.addChild(e))}else a.addProperty(`float inputs:clearcoat = ${e.clearcoat}`);if(null!==e.clearcoatRoughnessMap){a.addProperty(`float inputs:clearcoatRoughness.connect = </Materials/Material_${e.id}/Texture_${e.clearcoatRoughnessMap.id}_clearcoatRoughness.outputs:g>`);let t=new rP(e.clearcoatRoughness,e.clearcoatRoughness,e.clearcoatRoughness);n(e.clearcoatRoughnessMap,"clearcoatRoughness",t).forEach(e=>r.addChild(e))}else a.addProperty(`float inputs:clearcoatRoughness = ${e.clearcoatRoughness}`);a.addProperty(`float inputs:ior = ${e.ior}`)}return a.addProperty("int inputs:useSpecularWorkflow = 0"),a.addProperty("token outputs:surface"),r.addChild(a),r.addProperty(`token outputs:surface.connect = </Materials/Material_${e.id}/PreviewSurface.outputs:surface>`),r}(a,t,i))}return r}(c,u,t.quickLookCompatible);for(let e in i=g6()+"\n"+s.toString()+"\n\n"+d.toString(),n[a]=g1(i),i=null,u){let i=u[e];if(!0===i.isCompressedTexture)if(null===this.textureUtils)throw Error("THREE.USDZExporter: setTextureUtils() must be called to process compressed textures.");else i=await this.textureUtils.decompress(i);let r=function(e,t,i){if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"u">typeof ImageBitmap&&e instanceof ImageBitmap){let r=i/Math.max(e.width,e.height),n=document.createElement("canvas");n.width=e.width*Math.min(1,r),n.height=e.height*Math.min(1,r);let a=n.getContext("2d");return!0===t&&(a.translate(0,n.height),a.scale(1,-1)),a.drawImage(e,0,0,n.width,n.height),n}throw Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}(i.image,i.flipY,t.maxTextureSize),a=await new Promise(e=>r.toBlob(e,"image/png",1));n[`textures/Texture_${e}.png`]=new Uint8Array(await a.arrayBuffer())}let p=0;for(let e in n){let t=n[e],i=63&(p+=34+e.length);if(4!==i){let r=new Uint8Array(64-i);n[e]=[t,{extra:{12345:r}}]}p=t.length}return function(e,t){t||(t={});var i={},r=[];g$(e,"",i,t);var n=0,a=0;for(var s in i){var o=i[s],l=o[0],h=o[1],c=8*(0!=h.level),u=g1(s),d=u.length,p=h.comment,A=p&&g1(p),f=A&&A.length,g=g2(h.extra);d>65535&&gU(11);var m=c?gY(l,h||{},0,0):l,v=m.length,b=gX();b.p(l),r.push(gK(h,{size:l.length,crc:b.d(),c:m,f:u,m:A,u:d!=s.length||A&&p.length!=f,o:n,compression:c})),n+=30+d+g+v,a+=76+2*(d+g)+(f||0)+v}for(var y=new gd(a+22),x=n,_=a-n,E=0;E<r.length;++E){var u=r[E];g3(y,u.o,u,u.f,u.u,u.c.length);var S=30+u.f.length+g2(u.extra);y.set(u.c,u.o+S),g3(y,n,u,u.f,u.u,u.c.length,u.o,u.m),n+=16+S+(u.m?u.m.length:0)}return g4(y,n,r.length,_,x),y}(n,{level:0})}}function g9(e,t){let i=e.name;return i=i.replace(/[^A-Za-z0-9_]/g,""),/^[0-9]/.test(i)&&(i="_"+i),""===i&&(i=e.isCamera?"Camera":"Object"),t.has(i)&&(i=i+"_"+e.id),t.add(i),i}function g6(){return`#usda 1.0
|
|
975
|
+
(
|
|
976
|
+
customLayerData = {
|
|
977
|
+
string creator = "Three.js USDZExporter"
|
|
978
|
+
}
|
|
979
|
+
defaultPrim = "Root"
|
|
980
|
+
metersPerUnit = 1
|
|
981
|
+
upAxis = "Y"
|
|
982
|
+
)
|
|
983
|
+
`}function g7(e,t){let i=g9(e,t),r=me(e.matrix);0>e.matrix.determinant()&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",e);let n=new g5(i,"Xform");return n.addProperty(`matrix4d xformOp:transform = ${r}`),n.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]'),n}function me(e){let t=e.elements;return`( ${mt(t,0)}, ${mt(t,4)}, ${mt(t,8)}, ${mt(t,12)} )`}function mt(e,t){return`(${e[t+0]}, ${e[t+1]}, ${e[t+2]}, ${e[t+3]})`}function mi(e,t){if(void 0===e)return console.warn("USDZExporter: Normals missing."),Array(t).fill("(0, 0, 0)").join(", ");let i=[];for(let t=0;t<e.count;t++){let r=e.getX(t),n=e.getY(t),a=e.getZ(t);i.push(`(${r.toPrecision(7)}, ${n.toPrecision(7)}, ${a.toPrecision(7)})`)}return i.join(", ")}function mr(e){return`(${e.r}, ${e.g}, ${e.b})`}function mn(e){return`(${e.x}, ${e.y})`}var ma=function(e,t,i,r){var n,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(s=(a<3?n(s):a>3?n(t,i,s):n(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let ms=!1,mo=!1,ml="#model-viewer-no-ar-fallback",mh=(B=["quick-look","scene-viewer","webxr","none"],e=>{try{let t=u_(e),i=(t.length?t[0].terms:[]).filter(e=>e&&"ident"===e.type).map(e=>e.value).filter(e=>B.indexOf(e)>-1);return new Set(i)}catch(e){}return new Set}),mc="quick-look",mu="scene-viewer",md="webxr",mp="none",mA=Symbol("arButtonContainer"),mf=Symbol("enterARWithWebXR"),mg=Symbol("openSceneViewer"),mm=Symbol("openIOSARQuickLook"),mv=Symbol("canActivateAR"),mb=Symbol("arMode"),my=Symbol("arModes"),mx=Symbol("arAnchor"),m_=Symbol("preload"),mE=Symbol("onARButtonContainerClick"),mS=Symbol("onARStatus"),mC=Symbol("onARTracking"),mM=Symbol("onARTap"),mw=Symbol("selectARMode"),mI=Symbol("triggerLoad");var mT=function(e,t,i,r){var n,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(s=(a<3?n(s):a>3?n(t,i,s):n(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let mB="auto",mR=Symbol("defaultProgressBarElement"),mD=Symbol("posterContainerElement"),mL=Symbol("defaultPosterElement"),mP=Symbol("shouldDismissPoster"),mU=Symbol("hidePoster"),mF=Symbol("modelIsRevealed"),mN=Symbol("updateProgressBar"),mO=Symbol("ariaLabelCallToAction"),mk=Symbol("onProgress");var mQ=function(e,t,i,r){var n,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(s=(a<3?n(s):a>3?n(t,i,s):n(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let mG={basis:[uR(ux(Math.PI/32,"rad"))],keywords:{auto:[null]}},mH=Symbol("autoRotateStartTime"),mz=Symbol("radiansPerSecond"),mV=Symbol("syncRotationRate"),mW=Symbol("onCameraChange"),mq=(e=>{var t,i,r;class n extends e{constructor(){super(...arguments),this[t]=new Map,this[i]=e=>{e.forEach(e=>{e instanceof MutationRecord&&"childList"!==e.type||(e.addedNodes.forEach(e=>{this[gh](e)}),e.removedNodes.forEach(e=>{this[gc](e)}),this[fK]())})},this[r]=new MutationObserver(this[go])}connectedCallback(){super.connectedCallback();for(let e=0;e<this.children.length;++e)this[gh](this.children[e]);let{ShadyDOM:e}=self;null==e?this[gl].observe(this,{childList:!0}):this[gl]=e.observeChildren(this,this[go])}disconnectedCallback(){super.disconnectedCallback();let{ShadyDOM:e}=self;null==e?this[gl].disconnect():e.unobserveChildren(this[gl])}[(t=gs,i=go,r=gl,f$)](){super[f$]();let e=this[fY];e.forHotspots(t=>{e.updateSurfaceHotspot(t)})}[fJ](e,t){super[fJ](e,t);let i=this[fY],{annotationRenderer:r}=i,n=i.getCamera();i.shouldRender()&&(i.animateSurfaceHotspots(),i.updateHotspotsVisibility(n.position),r.domElement.style.display="",r.render(i,n))}updateHotspot(e){let t=this[gs].get(e.name);null!=t&&(t.updatePosition(e.position),t.updateNormal(e.normal),t.surface=e.surface,this[fY].updateSurfaceHotspot(t),this[fK]())}queryHotspot(e){let t=this[gs].get(e);if(null==t)return null;let i=f5(t.position),r=f5(t.normal),n=t.facingCamera,a=this[fY],s=a.getCamera(),o=new it;o.setFromMatrixPosition(t.matrixWorld),o.project(s);let l=a.width/2,h=a.height/2;o.x=o.x*l+l,o.y=-(o.y*h)+h;let c=f5(new it(o.x,o.y,o.z));return Number.isFinite(c.x)&&Number.isFinite(c.y)?{position:i,normal:r,canvasPosition:c,facingCamera:n}:null}positionAndNormalFromPoint(e,t){let i=this[fY],r=i.getNDC(e,t),n=i.positionAndNormalFromPoint(r);if(null==n)return null;gu.copy(i.target.matrixWorld).invert();let a=f5(n.position.applyMatrix4(gu)),s=f5(n.normal.transformDirection(gu)),o=null;return null!=n.uv&&(o=f8(n.uv)),{position:a,normal:s,uv:o}}surfaceFromPoint(e,t){let i=this[fY],r=i.getNDC(e,t);return i.surfaceFromPoint(r)}[gh](e){if(!(e instanceof HTMLElement&&0===e.slot.indexOf("hotspot")))return;let t=this[gs].get(e.slot);null!=t?t.increment():(t=new fd({name:e.slot,position:e.dataset.position,normal:e.dataset.normal,surface:e.dataset.surface}),this[gs].set(e.slot,t),this[fY].addHotspot(t)),this[fY].queueRender()}[gc](e){if(!(e instanceof HTMLElement))return;let t=this[gs].get(e.slot);t&&(t.decrement()&&(this[fY].removeHotspot(t),this[gs].delete(e.slot)),this[fY].queueRender())}}return n})((e=>{var t,i,r;class n extends e{constructor(){super(...arguments),this[t]=void 0,this[i]=null,this[r]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[fi]}get availableVariants(){return this.model?this.model[A4]():[]}get originalGltfJson(){return this[ft]}[(t=fi,i=fe,r=ft,fr)](){return()=>{this[fK]()}}[fn](e){return e.colorSpace="srgb",e.wrapS=1e3,e.wrapT=1e3,new AA(this[fr](),e)}async createTexture(e,t="image/png"){let{textureUtils:i}=this[f0],r=await i.loadImage(e,this.withCredentials);return r.userData.mimeType=t,this[fn](r)}async createLottieTexture(e,t=1){let{textureUtils:i}=this[f0],r=await i.loadLottie(e,t,this.withCredentials);return this[fn](r)}createVideoTexture(e){let t=document.createElement("video");t.crossOrigin=this.withCredentials?"use-credentials":"anonymous",t.src=e,t.muted=!0,t.playsInline=!0,t.loop=!0,t.play();let i=new aA(t);return this[fn](i)}createCanvasTexture(){let e=new av(document.createElement("canvas"));return this[fn](e)}async updated(e){if(super.updated(e),e.has("variantName")){let e=this[f1].beginActivity("variant-update");e(.1);let t=this[fi],{variantName:i}=this;null!=t&&(await t[AZ](i),this[fK](),this.dispatchEvent(new CustomEvent("variant-applied"))),e(1)}if(e.has("orientation")||e.has("scale")){if(!this.loaded)return;let e=this[fY];e.applyTransform(),e.updateBoundingBox(),e.updateShadow(),this[f0].arRenderer.onUpdateScene(),this[fK]()}}[f$](){super[f$]();let{currentGLTF:e}=this[fY];if(null!=e){let{correlatedSceneGraph:t}=e;null!=t&&e!==this[fe]&&(this[fi]=new A6(t,this[fr]()),this[ft]=JSON.parse(JSON.stringify(t.gltf))),"variants"in e.userData&&this.requestUpdate("variantName")}this[fe]=e}async exportScene(e){let t=this[fY];return new Promise(async(i,r)=>{let n={binary:!0,onlyVisible:!0,maxTextureSize:1/0,includeCustomExtensions:!1,forceIndices:!1};Object.assign(n,e),n.animations=t.animations,n.truncateDrawRange=!0;let a=t.shadow,s=!1;null!=a&&(s=a.visible,a.visible=!1),await this[fi][A$](),new lM().register(e=>new l$(e)).parse(t.model,e=>i(new Blob([n.binary?e:JSON.stringify(e)],{type:n.binary?"application/octet-stream":"application/json"})),()=>r("glTF export failed"),n),null!=a&&(a.visible=s)})}materialFromPoint(e,t){let i=this[fi];if(null==i)return null;let r=this[fY],n=r.getNDC(e,t),a=r.hitFromPoint(n);return null==a||null==a.face?null:i[A0](a)}}return A7([$({type:String,attribute:"variant-name"})],n.prototype,"variantName",void 0),A7([$({type:String,attribute:"orientation"})],n.prototype,"orientation",void 0),A7([$({type:String,attribute:"scale"})],n.prototype,"scale",void 0),n})((e=>{var t,i,r;class n extends e{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this.rotationPerSecond="auto",this[t]=performance.now(),this[i]=0,this[r]=e=>{this.autoRotate&&"user-interaction"===e.detail.source&&(this[mH]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[mW]),this[mH]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[mW]),this[mH]=performance.now()}updated(e){super.updated(e),e.has("autoRotate")&&(this[mH]=performance.now())}[(t=mH,i=mz,mV)](e){this[mz]=e[0]}[fJ](e,t){if(super[fJ](e,t),!this.autoRotate||!this[f3]()||this[f0].isPresenting)return;let i=Math.min(t,e-this[mH]-this.autoRotateDelay);i>0&&(this[fY].yaw=this.turntableRotation+this[mz]*i*.001)}get turntableRotation(){return this[fY].yaw}resetTurntableRotation(e=0){this[fY].yaw=e}}return r=mW,mQ([$({type:Boolean,attribute:"auto-rotate"})],n.prototype,"autoRotate",void 0),mQ([$({type:Number,attribute:"auto-rotate-delay"})],n.prototype,"autoRotateDelay",void 0),mQ([de({intrinsics:mG,updateHandler:mV}),$({type:String,attribute:"rotation-per-second"})],n.prototype,"rotationPerSecond",void 0),n})((e=>{var t,i,r;class n extends e{constructor(){super(...arguments),this.environmentImage=null,this.skyboxImage=null,this.shadowIntensity=0,this.shadowSoftness=1,this.exposure=1,this.toneMapping="auto",this.skyboxHeight="0",this[t]=null,this[i]=null,this[r]=null}updated(e){var t;if(super.updated(e),e.has("shadowIntensity")&&(this[fY].setShadowIntensity(.5*this.shadowIntensity),this[fK]()),e.has("shadowSoftness")&&(this[fY].setShadowSoftness(this.shadowSoftness),this[fK]()),e.has("exposure")&&(this[fY].exposure=this.exposure,this[fK]()),e.has("toneMapping")){let e=new Map([["aces",4],["agx",6],["reinhard",2],["cineon",3],["linear",1],["none",0]]);this[fY].toneMapping=null!=(t=e.get(this.toneMapping))?t:7,this[fK]()}(e.has("environmentImage")||e.has("skyboxImage"))&&this[f4]()&&this[tN](),e.has("skyboxHeight")&&(this[fY].setGroundedSkybox(),this[fK]())}hasBakedShadow(){return this[fY].bakedShadows.size>0}async [(t=tU,i=tF,r=tO,tN)](){let{skyboxImage:e,environmentImage:t}=this;null!=this[tO]&&(this[tO](),this[tO]=null);let{textureUtils:i}=this[f0];if(null==i)return;let r=this[f1].beginActivity("environment-update");try{let{environmentMap:n,skybox:a}=await i.generateEnvironmentMapAndSkybox(eJ(e),t,e=>r(e1(e,0,1)),this.withCredentials);this[tU]!==n&&(this[tU]=n,this.dispatchEvent(new CustomEvent("environment-change"))),null!=a?this[tF]=a.name===n.name?n:a:this[tF]=null,this[fY].setEnvironmentAndSkybox(this[tU],this[tF])}catch(e){if(e instanceof Error)throw this[fY].setEnvironmentAndSkybox(null,null),e}finally{r(1)}}}return tP([$({type:String,attribute:"environment-image"})],n.prototype,"environmentImage",void 0),tP([$({type:String,attribute:"skybox-image"})],n.prototype,"skyboxImage",void 0),tP([$({type:Number,attribute:"shadow-intensity"})],n.prototype,"shadowIntensity",void 0),tP([$({type:Number,attribute:"shadow-softness"})],n.prototype,"shadowSoftness",void 0),tP([$({type:Number})],n.prototype,"exposure",void 0),tP([$({type:String,attribute:"tone-mapping"})],n.prototype,"toneMapping",void 0),tP([$({type:String,attribute:"skybox-height"})],n.prototype,"skyboxHeight",void 0),n})((e=>{var t,i,r,n,a,s,o,l,h,c,u,d,p,A,f,g,m,v;class b extends e{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=dl,this.cameraTarget="auto auto auto",this.fieldOfView="auto",this.minCameraOrbit="auto",this.maxCameraOrbit="auto",this.minFieldOfView="auto",this.maxFieldOfView="auto",this.interactionPromptThreshold=3e3,this.interactionPrompt=du,this.interactionPromptStyle=dd,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction="none",this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=50,this.a11y=null,this[t]=this.shadowRoot.querySelector(".interaction-prompt"),this[i]=this.shadowRoot.querySelector("#prompt"),this[r]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[n]=this.shadowRoot.querySelector(".pan-target"),this[a]=0,this[s]=1/0,this[o]=!1,this[l]=!1,this[h]=d4,this[c]=new d5(this[fY].camera,this[fj],this[fY]),this[u]=new oe,this[d]=!1,this[p]=!1,this[A]=!1,this[f]={},this[g]=()=>{let e=this[dE].changeSource;this[dQ]=e,e===d2&&(this[dN]=!0,this[dI]())},this[m]=()=>{this[dT](),this[fK]();let e=this[dE].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:e}}))},this[v]=e=>{this[fq].classList.toggle("pointer-tumbling","pointer-change-start"===e.type)}}get inputSensitivity(){return this[dE].inputSensitivity}set inputSensitivity(e){this[dE].inputSensitivity=e}getCameraOrbit(){let{theta:e,phi:t,radius:i}=this[dG];return{theta:e,phi:t,radius:i,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return f5(this[f0].isPresenting?this[f0].arRenderer.target:this[fY].getDynamicTarget())}getFieldOfView(){return this[dE].getFieldOfView()}getMinimumFieldOfView(){return this[dE].options.minimumFieldOfView}getMaximumFieldOfView(){return this[dE].options.maximumFieldOfView}getIdealAspect(){return this[fY].idealAspect}jumpCameraToGoal(){this[dH]=!0,this.requestUpdate(dH,!1)}resetInteractionPrompt(){this[dk]=0,this[dO]=1/0,this[dN]=!1,this[dF]=this.interactionPrompt===du&&this.cameraControls}zoom(e){let t=new WheelEvent("wheel",{deltaY:-30*e});this[fj].dispatchEvent(t)}connectedCallback(){super.connectedCallback(),this[dE].addEventListener("user-interaction",this[dL]),this[dE].addEventListener("pointer-change-start",this[dU]),this[dE].addEventListener("pointer-change-end",this[dU])}disconnectedCallback(){super.disconnectedCallback(),this[dE].removeEventListener("user-interaction",this[dL]),this[dE].removeEventListener("pointer-change-start",this[dU]),this[dE].removeEventListener("pointer-change-end",this[dU])}updated(e){super.updated(e);let t=this[dE],i=this[fY];if(e.has("cameraControls")&&(this.cameraControls?(t.enableInteraction(),this.interactionPrompt===du&&(this[dF]=!0)):(t.disableInteraction(),this[dI]()),this[fj].setAttribute("aria-label",this[fk])),e.has("disableZoom")&&(t.disableZoom=this.disableZoom),e.has("disablePan")&&(t.enablePan=!this.disablePan),e.has("disableTap")&&(t.enableTap=!this.disableTap),(e.has("interactionPrompt")||e.has("cameraControls")||e.has("src"))&&(this.interactionPrompt===du&&this.cameraControls&&!this[dN]?this[dF]=!0:this[dI]()),e.has("interactionPromptStyle")&&(this[dM].style.opacity="basic"==this.interactionPromptStyle?"1":"0"),e.has("touchAction")){let e=this.touchAction;t.applyOptions({touchAction:e}),t.updateTouchActionStyle()}e.has("orbitSensitivity")&&(t.orbitSensitivity=this.orbitSensitivity),e.has("zoomSensitivity")&&(t.zoomSensitivity=this.zoomSensitivity),e.has("panSensitivity")&&(t.panSensitivity=this.panSensitivity),e.has("interpolationDecay")&&(t.setDamperDecayTime(this.interpolationDecay),i.setTargetDamperDecayTime(this.interpolationDecay)),e.has("a11y")&&this[dR](),!0===this[dH]&&Promise.resolve().then(()=>{t.jumpToGoal(),i.jumpToGoal(),this[dP](),this[dH]=!1})}async updateFraming(){let e=this[fY],t=e.adjustedFoV(e.framedFoVDeg);await e.updateFraming();let i=e.adjustedFoV(e.framedFoVDeg),r=this[dE].getFieldOfView()/t;this[dE].setFieldOfView(i*r),this[dV]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(e,t,i){let r=this[fj],n=this[dw];if("1"===n[0].style.opacity)return void console.warn("interact() failed because an existing interaction is running.");let a=[];a.push({x:dr(t.x),y:dr(t.y)});let s=[{x:a[0].x(0),y:a[0].y(0)}];null!=i&&(a.push({x:dr(i.x),y:dr(i.y)}),s.push({x:a[1].x(0),y:a[1].y(0)}));let o=performance.now(),{width:l,height:h}=this[fY],c=this.getBoundingClientRect(),u=e=>{for(let[t,i]of s.entries()){let{style:a}=n[t];a.transform=`translateX(${l*i.x}px) translateY(${h*i.y}px)`,"pointerdown"===e?a.opacity="1":"pointerup"===e&&(a.opacity="0");let s={pointerId:t-5678,pointerType:"touch",target:r,clientX:l*i.x+c.x,clientY:h*i.y+c.y,altKey:!0};r.dispatchEvent(new PointerEvent(e,s))}},d=()=>{let t=this[dQ];if(t!==d4||!r.isConnected){for(let e of this[dw])e.style.opacity="0";u("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:t}})),document.removeEventListener("visibilitychange",p);return}let i=Math.min(1,(performance.now()-o)/e);for(let[e,t]of s.entries())t.x=a[e].x(i),t.y=a[e].y(i);u("pointermove"),i<1?requestAnimationFrame(d):(u("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:d4}})),document.removeEventListener("visibilitychange",p))},p=()=>{let e=0;"hidden"===document.visibilityState?e=performance.now()-o:o=performance.now()-e};document.addEventListener("visibilitychange",p),u("pointerdown"),this[dQ]=d4,requestAnimationFrame(d)}[(t=dC,i=dM,r=dw,n=dS,a=dk,s=dO,o=dN,l=dF,h=dQ,c=dE,u=dG,d=dH,p=dz,A=dV,f=dB,dq)](e){let t=this[dE],i=this[fY];i.framedFoVDeg=180*e[0]/Math.PI,t.changeSource=d3,t.setFieldOfView(i.adjustedFoV(i.framedFoVDeg)),this[dL]()}[dW](e){let t=this[dE];if(this[dV]){let{theta:t,phi:i}=this.getCameraOrbit();e[0]=t,e[1]=i,this[dV]=!1}t.changeSource=d3,t.setOrbit(e[0],e[1],e[2]),this[dL]()}[dX](e){this[dE].applyOptions({minimumAzimuthalAngle:e[0],minimumPolarAngle:e[1],minimumRadius:e[2]}),this.jumpCameraToGoal()}[dY](e){this[dE].applyOptions({maximumAzimuthalAngle:e[0],maximumPolarAngle:e[1],maximumRadius:e[2]}),this[dD](e[2]),this.jumpCameraToGoal()}[dK](e){this[dE].applyOptions({minimumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}[dJ](e){let t=this[fY].adjustedFoV(180*e[0]/Math.PI);this[dE].applyOptions({maximumFieldOfView:t}),this.jumpCameraToGoal()}[dj](e){let[t,i,r]=e;this[f0].arRenderer.isPresenting||this[fY].setTarget(t,i,r),this[dE].changeSource=d3,this[f0].arRenderer.updateTarget(),this[dL]()}[fJ](e,t){if(super[fJ](e,t),this[f0].isPresenting||!this[f3]())return;let i=this[dE],r=this[fY],n=performance.now();if(this[dF]&&this.loaded&&n>this[fz]+this.interactionPromptThreshold&&(this[dF]=!1,this[dO]=n,this[dC].classList.add("visible")),isFinite(this[dO])&&this.interactionPromptStyle===dd){let e=(n-this[dO])/5e3%1,t=da(e),a=ds(e);if(this[dM].style.opacity=`${a}`,t!==this[dk]){let e=t*r.width*.05,n=(t-this[dk])*Math.PI/16;this[dM].style.transform=`translateX(${e}px)`,i.changeSource=d4,i.adjustOrbit(n,0,0),this[dk]=t}}let a=i.update(e,t),s=r.updateTarget(t);(a||s)&&this[dP]()}[dI](){this[dF]=!1,this[dC].classList.remove("visible"),this[dO]=1/0}[dD](e){let t=Math.abs(2*Math.max(this[fY].farRadius(),e));this[dE].updateNearFar(0,t)}[dT](){let{theta:e,phi:t}=this[dE].getCameraSpherical(this[dG]),i=Math.floor(t/dy),r=dh[(4+Math.floor((e%d_+dx)/db))%4],n=dc[i],a=`${n}${r}`;a in this[dB]?this[fH](this[dB][a]):this[fH](`View from stage ${a}`)}get[fk](){let e=". Use mouse, touch or arrow keys to move.";return"interaction-prompt"in this[dB]&&(e=`. ${this[dB]["interaction-prompt"]}`),super[$ariaLabel].replace(/\.$/,"")+(this.cameraControls?e:"")}async [fZ](e){let t=this[dE],i=this[fY],r=i.adjustedFoV(i.framedFoVDeg);super[fZ](e);let n=i.adjustedFoV(i.framedFoVDeg)/r,a=t.getFieldOfView()*(isFinite(n)?n:1);t.updateAspect(this[fY].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[dE].setFieldOfView(a),this.jumpCameraToGoal()}[f$](){super[f$](),this[dz]?this[dV]=!0:this[dz]=!0,this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.requestUpdate("minCameraOrbit",this.minCameraOrbit),this.requestUpdate("maxCameraOrbit",this.maxCameraOrbit),this.requestUpdate("cameraOrbit",this.cameraOrbit),this.requestUpdate("cameraTarget",this.cameraTarget),this.jumpCameraToGoal()}[(g=dL,m=dP,v=dU,dR)](){if("string"==typeof this.a11y)if(this.a11y.startsWith("{"))try{this[dB]=JSON.parse(this.a11y)}catch(e){console.warn("Error parsing a11y JSON:",e)}else this.a11y.length>0?console.warn("Error not supported format, should be a JSON string:",this.a11y):this[dB]={};else"object"==typeof this.a11y&&null!=this.a11y?this[dB]=Object.assign({},this.a11y):this[dB]={};this[fj].setAttribute("aria-label",this[fk])}}return dn([$({type:Boolean,attribute:"camera-controls"})],b.prototype,"cameraControls",void 0),dn([de({intrinsics:df,observeEffects:!0,updateHandler:dW}),$({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],b.prototype,"cameraOrbit",void 0),dn([de({intrinsics:dv,observeEffects:!0,updateHandler:dj}),$({type:String,attribute:"camera-target",hasChanged:()=>!0})],b.prototype,"cameraTarget",void 0),dn([de({intrinsics:dp,observeEffects:!0,updateHandler:dq}),$({type:String,attribute:"field-of-view",hasChanged:()=>!0})],b.prototype,"fieldOfView",void 0),dn([de({intrinsics:dg,updateHandler:dX}),$({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],b.prototype,"minCameraOrbit",void 0),dn([de({intrinsics:dm,updateHandler:dY}),$({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],b.prototype,"maxCameraOrbit",void 0),dn([de({intrinsics:dA,updateHandler:dK}),$({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],b.prototype,"minFieldOfView",void 0),dn([de({intrinsics:dp,updateHandler:dJ}),$({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],b.prototype,"maxFieldOfView",void 0),dn([$({type:Number,attribute:"interaction-prompt-threshold"})],b.prototype,"interactionPromptThreshold",void 0),dn([$({type:String,attribute:"interaction-prompt"})],b.prototype,"interactionPrompt",void 0),dn([$({type:String,attribute:"interaction-prompt-style"})],b.prototype,"interactionPromptStyle",void 0),dn([$({type:Number,attribute:"orbit-sensitivity"})],b.prototype,"orbitSensitivity",void 0),dn([$({type:Number,attribute:"zoom-sensitivity"})],b.prototype,"zoomSensitivity",void 0),dn([$({type:Number,attribute:"pan-sensitivity"})],b.prototype,"panSensitivity",void 0),dn([$({type:String,attribute:"touch-action"})],b.prototype,"touchAction",void 0),dn([$({type:Boolean,attribute:"disable-zoom"})],b.prototype,"disableZoom",void 0),dn([$({type:Boolean,attribute:"disable-pan"})],b.prototype,"disablePan",void 0),dn([$({type:Boolean,attribute:"disable-tap"})],b.prototype,"disableTap",void 0),dn([$({type:Number,attribute:"interpolation-decay"})],b.prototype,"interpolationDecay",void 0),dn([$()],b.prototype,"a11y",void 0),b})((e=>{var t,i,r,n,a,s,o,l,h,c;class u extends e{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arUsdzMaxTextureSize="auto",this.arPlacement="floor",this.arModes="webxr scene-viewer quick-look",this.iosSrc=null,this.xrEnvironment=!1,this[t]=!1,this[i]=this.shadowRoot.querySelector(".ar-button"),this[r]=document.createElement("a"),this[n]=new Set,this[a]=mp,this[s]=!1,this[o]=e=>{e.preventDefault(),this.activateAR()},this[l]=({status:e})=>{(e===pi||this[f0].arRenderer.presentedScene===this[fY])&&(this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}})),e===pi?this.removeAttribute("ar-tracking"):e===pr&&this.setAttribute("ar-tracking",pa))},this[h]=({status:e})=>{this.setAttribute("ar-tracking",e),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:e}}))},this[c]=e=>{"_apple_ar_quicklook_button_tapped"==e.data&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[mb]!==mp}connectedCallback(){super.connectedCallback(),null!=this[f0].arRenderer&&(this[f0].arRenderer.addEventListener("status",this[mS]),this.setAttribute("ar-status",pi),this[f0].arRenderer.addEventListener("tracking",this[mC])),this[mx].addEventListener("message",this[mM])}disconnectedCallback(){super.disconnectedCallback(),null!=this[f0].arRenderer&&(this[f0].arRenderer.removeEventListener("status",this[mS]),this[f0].arRenderer.removeEventListener("tracking",this[mC])),this[mx].removeEventListener("message",this[mM])}update(e){super.update(e),e.has("arScale")&&(this[fY].canScale="fixed"!==this.arScale),e.has("arPlacement")&&(this[fY].updateShadow(),this[fK]()),e.has("arModes")&&(this[my]=mh(this.arModes)),(e.has("ar")||e.has("arModes")||e.has("src")||e.has("iosSrc")||e.has("arUsdzMaxTextureSize"))&&this[mw]()}async activateAR(){switch(this[mb]){case mc:await this[mm]();break;case md:await this[mf]();break;case mu:this[mg]();break;default:console.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async [(t=mv,i=mA,r=mx,n=my,a=mb,s=m_,o=mE,l=mS,h=mC,c=mM,mw)](){var e;let t=mp;if(this.ar){if(null!=this.src)for(let i of this[my]){if("webxr"===i&&eG&&!ms&&await this[f0].arRenderer.supportsPresentation()){t=md;break}if("scene-viewer"===i&&!mo&&(eX||navigator.userAgentData&&navigator.userAgentData.getHighEntropyValues&&(null==(e=(await navigator.userAgentData.getHighEntropyValues(["formFactor"])).formFactor)?void 0:e.includes("XR")))){t=mu;break}if("quick-look"===i&&eK){t=mc;break}}t===mp&&null!=this.iosSrc&&eK&&(t=mc)}if(t!==mp)this[mA].classList.add("enabled"),this[mA].addEventListener("click",this[mE]);else if(this[mA].classList.contains("enabled")){this[mA].removeEventListener("click",this[mE]),this[mA].classList.remove("enabled");let e="failed";this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}}))}this[mb]=t}async [mf](){console.log("Attempting to present in AR with WebXR..."),await this[mI]();try{this[mA].removeEventListener("click",this[mE]);let{arRenderer:e}=this[f0];e.placeOnWall="wall"===this.arPlacement,await e.present(this[fY],this.xrEnvironment)}catch(e){console.warn("Error while trying to present in AR with WebXR"),console.error(e),await this[f0].arRenderer.stopPresenting(),ms=!0,console.warn("Falling back to next ar-mode"),await this[mw](),this.activateAR()}finally{this[mw]()}}async [mI](){this.loaded||(this[m_]=!0,this[fV](),await ((e,t,i=null)=>new Promise(r=>{e.addEventListener(t,function n(a){(!i||i(a))&&(r(a),e.removeEventListener(t,n))})}))(this,"load"),this[m_]=!1)}[f4](){return super[f4]()||this[m_]}[mg](){let e=self.location.toString(),t=new URL(e),i=new URL(this.src,e);i.hash&&(i.hash="");let r=new URLSearchParams(i.search);if(t.hash=ml,r.set("mode","ar_preferred"),r.has("disable_occlusion")||r.set("disable_occlusion","true"),"fixed"===this.arScale&&r.set("resizable","false"),"wall"===this.arPlacement&&r.set("enable_vertical_placement","true"),r.has("sound")){let t=new URL(r.get("sound"),e);r.set("sound",t.toString())}if(r.has("link")){let t=new URL(r.get("link"),e);r.set("link",t.toString())}let n=`intent://arvr.google.com/scene-viewer/1.2?${r.toString()+"&file="+encodeURIComponent(i.toString())}#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(t.toString())};end;`,a=()=>{self.location.hash===ml&&(mo=!0,self.history.back(),console.warn("Error while trying to present in AR with Scene Viewer"),console.warn("Falling back to next ar-mode"),this[mw]())};self.addEventListener("hashchange",a,{once:!0}),this[mx].setAttribute("href",n),console.log("Attempting to present in AR with Scene Viewer..."),this[mx].click()}async [mm](){let e=!this.iosSrc;this[mA].classList.remove("enabled");let t=e?await this.prepareUSDZ():this.iosSrc,i=new URL(t,self.location.toString());if(e){let e=new URL(self.location.toString()),t=new URL(this.src,e);t.hash&&(i.hash=t.hash)}"fixed"===this.arScale&&(i.hash&&(i.hash+="&"),i.hash+="allowsContentScaling=0");let r=this[mx];r.setAttribute("rel","ar");let n=document.createElement("img");r.appendChild(n),r.setAttribute("href",i.toString()),e&&r.setAttribute("download","model.usdz"),r.style.display="none",r.isConnected||this.shadowRoot.appendChild(r),console.log("Attempting to present in AR with Quick Look..."),r.click(),r.removeChild(n),e&&URL.revokeObjectURL(t),this[mA].classList.add("enabled")}async prepareUSDZ(){let e=this[f1].beginActivity("usdz-conversion");await this[mI]();let{model:t,shadow:i,target:r}=this[fY];if(null==t)return"";let n=!1;null!=i&&(n=i.visible,i.visible=!1),e(.2);let a=new g8;r.remove(t),t.position.copy(r.position),t.updateWorldMatrix(!1,!0);let s=await a.parseAsync(t,{maxTextureSize:isNaN(this.arUsdzMaxTextureSize)?1/0:Math.max(parseInt(this.arUsdzMaxTextureSize),16)});t.position.set(0,0,0),r.add(t);let o=new Blob([s],{type:"model/vnd.usdz+zip"}),l=URL.createObjectURL(o);return e(1),null!=i&&(i.visible=n),l}}return ma([$({type:Boolean,attribute:"ar"})],u.prototype,"ar",void 0),ma([$({type:String,attribute:"ar-scale"})],u.prototype,"arScale",void 0),ma([$({type:String,attribute:"ar-usdz-max-texture-size"})],u.prototype,"arUsdzMaxTextureSize",void 0),ma([$({type:String,attribute:"ar-placement"})],u.prototype,"arPlacement",void 0),ma([$({type:String,attribute:"ar-modes"})],u.prototype,"arModes",void 0),ma([$({type:String,attribute:"ios-src"})],u.prototype,"iosSrc",void 0),ma([$({type:Boolean,attribute:"xr-environment"})],u.prototype,"xrEnvironment",void 0),u})((e=>{var t,i,r,n,a,s,o,l;class h extends e{static set dracoDecoderLocation(e){lg.setDRACODecoderLocation(e)}static get dracoDecoderLocation(){return lg.getDRACODecoderLocation()}static set ktx2TranscoderLocation(e){lg.setKTX2TranscoderLocation(e)}static get ktx2TranscoderLocation(){return lg.getKTX2TranscoderLocation()}static set meshoptDecoderLocation(e){lg.setMeshoptDecoderLocation(e)}static get meshoptDecoderLocation(){return lg.getMeshoptDecoderLocation()}static set lottieLoaderLocation(e){p1.singleton.textureUtils.lottieLoaderUrl=e}static get lottieLoaderLocation(){return p1.singleton.textureUtils.lottieLoaderUrl}static mapURLs(e){p1.singleton.loader[lp].manager.setURLModifier(e)}dismissPoster(){this.loaded?this[mU]():(this[mP]=!0,this[fV]())}showPoster(){let e=this[mD];if(e.classList.contains("show"))return;e.classList.add("show"),this[fj].classList.remove("show");let t=this[mL];t.removeAttribute("tabindex"),t.removeAttribute("aria-hidden");let i=this.modelIsVisible;this[mF]=!1,this[fO](i)}getDimensions(){return f5(this[fY].size)}getBoundingBoxCenter(){return f5(this[fY].boundingBox.getCenter(new it))}constructor(...e){super(...e),this.poster=null,this.reveal=mB,this.loading="auto",this[t]=!1,this[i]=!1,this[r]=this.shadowRoot.querySelector(".slot.poster"),this[n]=this.shadowRoot.querySelector("#default-poster"),this[a]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[s]=this[mL].getAttribute("aria-label"),this[o]=((e,t)=>{let i=null,r=(...r)=>{null==i&&(e(...r),i=self.setTimeout(()=>i=null,t))};return r.flush=()=>{null!=i&&(self.clearTimeout(i),i=null)},r})(e=>{let t=this[mR].parentNode;requestAnimationFrame(()=>{this[mR].style.transform=`scaleX(${e})`,0===e&&(t.removeChild(this[mR]),t.appendChild(this[mR])),this[mR].classList.toggle("hide",1===e)})},100),this[l]=e=>{let t=e.detail.totalProgress,i=e.detail.reason;1===t&&(this[mN].flush(),this.loaded&&(this[mP]||this.reveal===mB)&&this[mU]()),this[mN](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t,reason:i}}))};const h=self.ModelViewerElement||{},c=h.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.5.6/";lg.setDRACODecoderLocation(c);const u=h.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";lg.setKTX2TranscoderLocation(u),h.meshoptDecoderLocation&&lg.setMeshoptDecoderLocation(h.meshoptDecoderLocation);const d=h.lottieLoaderLocation||"https://cdn.jsdelivr.net/npm/three@0.149.0/examples/jsm/loaders/LottieLoader.js";null!=p1.singleton.textureUtils&&(p1.singleton.textureUtils.lottieLoaderUrl=d)}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[f1].addEventListener("progress",this[mk])}disconnectedCallback(){super.disconnectedCallback(),this[f1].removeEventListener("progress",this[mk])}async updated(e){super.updated(e),e.has("poster")&&null!=this.poster&&(this[mL].style.backgroundImage=`url(${this.poster})`),e.has("alt")&&this[mL].setAttribute("aria-label",this[fQ]),(e.has("reveal")||e.has("loading"))&&this[fV]()}[(t=mF,i=mP,r=mD,n=mL,a=mR,s=mO,o=mN,l=mk,f4)](){return!!this.src&&(this[mP]||"eager"===this.loading||this.reveal===mB&&this[fN])}[mU](){this[mP]=!1;let e=this[mD];if(!e.classList.contains("show"))return;e.classList.remove("show"),this[fj].classList.add("show");let t=this.modelIsVisible;this[mF]=!0,this[fO](t);let i=this.getRootNode();i&&i.activeElement===this&&this[fj].focus();let r=this[mL];r.setAttribute("aria-hidden","true"),r.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[f3](){return super[f3]()&&this[mF]}}return mT([$({type:String})],h.prototype,"poster",void 0),mT([$({type:String})],h.prototype,"reveal",void 0),mT([$({type:String})],h.prototype,"loading",void 0),h})((e=>{var t;class i extends e{constructor(...e){super(e),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[t]=!0,this[fY].subscribeMixerEvent("loop",e=>{let t=e.action._loopCount,i=e.action._clip.name,r=e.action._clip.uuid,n=this[fY].markedAnimations.find(e=>e.name===i);if(n){this[fY].updateAnimationLoop(n.name,n.loopMode,n.repetitionCount);let e=this[fY].markedAnimations.filter(e=>e.name!==i);this[fY].markedAnimations=e}this.dispatchEvent(new CustomEvent("loop",{detail:{count:t,name:i,uuid:r}}))}),this[fY].subscribeMixerEvent("finished",e=>{if(this[fY].appendedAnimations.includes(e.action._clip.name)){let t=this[fY].appendedAnimations.filter(t=>t!==e.action._clip.name);this[fY].appendedAnimations=t}else this[gi]=!0;this.dispatchEvent(new CustomEvent("finished"))})}get availableAnimations(){return this.loaded?this[fY].animationNames:[]}get duration(){return this[fY].duration}get paused(){return this[gi]}get currentTime(){return this[fY].animationTime}get appendedAnimations(){return this[fY].appendedAnimations}set currentTime(e){this[fY].animationTime=e,this[fK]()}get timeScale(){return this[fY].animationTimeScale}set timeScale(e){this[fY].animationTimeScale=e}pause(){this[gi]||(this[gi]=!0,this.dispatchEvent(new CustomEvent("pause")))}play(e){this.availableAnimations.length>0&&(this[gi]=!1,this[f7](e),this.dispatchEvent(new CustomEvent("play")))}appendAnimation(e,t){this.availableAnimations.length>0&&(this[gi]=!1,this[ge](e,t),this.dispatchEvent(new CustomEvent("append-animation")))}detachAnimation(e,t){this.availableAnimations.length>0&&(this[gi]=!1,this[gt](e,t),this.dispatchEvent(new CustomEvent("detach-animation")))}[(t=gi,f$)](){super[f$](),this[gi]=!0,null!=this.animationName&&this[f7](),this.autoplay&&this.play()}[fJ](e,t){super[fJ](e,t),!this[gi]&&(this[f3]()||this[f0].isPresenting)&&(this[fY].updateAnimation(t/1e3),this[fK]())}updated(e){super.updated(e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[f7]()}[f7](e=gr){var t;let i=null!=(t=e.repetitions)?t:1/0,r=e.pingpong?2202:1===i?2200:2201;this[fY].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3,r,i),this[gi]&&(this[fY].updateAnimation(0),this[fK]())}[ge](e="",t=gn){var i;let r=null!=(i=t.repetitions)?i:1/0,n=t.pingpong?2202:1===r?2200:2201,a=!!t.repetitions||"pingpong"in t;this[fY].appendAnimation(e||this.animationName,n,r,t.weight,t.timeScale,t.fade,t.warp,t.relativeWarp,t.time,a),this[gi]&&(this[fY].updateAnimation(0),this[fK]())}[gt](e="",t=ga){this[fY].detachAnimation(e||this.animationName,t.fade),this[gi]&&(this[fY].updateAnimation(0),this[fK]())}}return f6([$({type:Boolean})],i.prototype,"autoplay",void 0),f6([$({type:String,attribute:"animation-name"})],i.prototype,"animationName",void 0),f6([$({type:Number,attribute:"animation-crossfade-duration"})],i.prototype,"animationCrossfadeDuration",void 0),i})(f9))))))));customElements.define("model-viewer",mq)},4525(e,t,i){"use strict";i.d(t,{b:()=>o});var r=i(9081),n=i(4253),a=i(8525),s=r.forwardRef((e,t)=>(0,a.jsx)(n.sG.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));s.displayName="Label";var o=s},1104(e,t,i){"use strict";i.d(t,{C1:()=>ei,bL:()=>ee,q7:()=>et});var r=i(9081),n=i(6478),a=i(3577),s=i(7463),o=i(4253),l=i(2849),h=i(8525),c=i(4798),u=i(2274),d=i(8794),p=i(5422),A="rovingFocusGroup.onEntryFocus",f={bubbles:!1,cancelable:!0},g="RovingFocusGroup",[m,v,b]=function(e){let t=e+"CollectionProvider",[i,n]=(0,s.A)(t),[o,c]=i(t,{collectionRef:{current:null},itemMap:new Map}),u=e=>{let{scope:t,children:i}=e,n=r.useRef(null),a=r.useRef(new Map).current;return(0,h.jsx)(o,{scope:t,itemMap:a,collectionRef:n,children:i})};u.displayName=t;let d=e+"CollectionSlot",p=(0,l.TL)(d),A=r.forwardRef((e,t)=>{let{scope:i,children:r}=e,n=c(d,i),s=(0,a.s)(t,n.collectionRef);return(0,h.jsx)(p,{ref:s,children:r})});A.displayName=d;let f=e+"CollectionItemSlot",g="data-radix-collection-item",m=(0,l.TL)(f),v=r.forwardRef((e,t)=>{let{scope:i,children:n,...s}=e,o=r.useRef(null),l=(0,a.s)(t,o),u=c(f,i);return r.useEffect(()=>(u.itemMap.set(o,{ref:o,...s}),()=>void u.itemMap.delete(o))),(0,h.jsx)(m,{...{[g]:""},ref:l,children:n})});return v.displayName=f,[{Provider:u,Slot:A,ItemSlot:v},function(t){let i=c(e+"CollectionConsumer",t);return r.useCallback(()=>{let e=i.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${g}]`));return Array.from(i.itemMap.values()).sort((e,i)=>t.indexOf(e.ref.current)-t.indexOf(i.ref.current))},[i.collectionRef,i.itemMap])},n]}(g),[y,x]=(0,s.A)(g,[b]),[_,E]=y(g),S=r.forwardRef((e,t)=>(0,h.jsx)(m.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(m.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,h.jsx)(C,{...e,ref:t})})}));S.displayName=g;var C=r.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:i,orientation:s,loop:l=!1,dir:c,currentTabStopId:m,defaultCurrentTabStopId:b,onCurrentTabStopIdChange:y,onEntryFocus:x,preventScrollOnEntryFocus:E=!1,...S}=e,C=r.useRef(null),M=(0,a.s)(t,C),w=(0,p.jH)(c),[I,B]=(0,d.i)({prop:m,defaultProp:b??null,onChange:y,caller:g}),[R,D]=r.useState(!1),L=(0,u.c)(x),P=v(i),U=r.useRef(!1),[F,N]=r.useState(0);return r.useEffect(()=>{let e=C.current;if(e)return e.addEventListener(A,L),()=>e.removeEventListener(A,L)},[L]),(0,h.jsx)(_,{scope:i,orientation:s,dir:w,loop:l,currentTabStopId:I,onItemFocus:r.useCallback(e=>B(e),[B]),onItemShiftTab:r.useCallback(()=>D(!0),[]),onFocusableItemAdd:r.useCallback(()=>N(e=>e+1),[]),onFocusableItemRemove:r.useCallback(()=>N(e=>e-1),[]),children:(0,h.jsx)(o.sG.div,{tabIndex:R||0===F?-1:0,"data-orientation":s,...S,ref:M,style:{outline:"none",...e.style},onMouseDown:(0,n.mK)(e.onMouseDown,()=>{U.current=!0}),onFocus:(0,n.mK)(e.onFocus,e=>{let t=!U.current;if(e.target===e.currentTarget&&t&&!R){let t=new CustomEvent(A,f);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=P().filter(e=>e.focusable);T([e.find(e=>e.active),e.find(e=>e.id===I),...e].filter(Boolean).map(e=>e.ref.current),E)}}U.current=!1}),onBlur:(0,n.mK)(e.onBlur,()=>D(!1))})})}),M="RovingFocusGroupItem",w=r.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:i,focusable:a=!0,active:s=!1,tabStopId:l,children:u,...d}=e,p=(0,c.B)(),A=l||p,f=E(M,i),g=f.currentTabStopId===A,b=v(i),{onFocusableItemAdd:y,onFocusableItemRemove:x,currentTabStopId:_}=f;return r.useEffect(()=>{if(a)return y(),()=>x()},[a,y,x]),(0,h.jsx)(m.ItemSlot,{scope:i,id:A,focusable:a,active:s,children:(0,h.jsx)(o.sG.span,{tabIndex:g?0:-1,"data-orientation":f.orientation,...d,ref:t,onMouseDown:(0,n.mK)(e.onMouseDown,e=>{a?f.onItemFocus(A):e.preventDefault()}),onFocus:(0,n.mK)(e.onFocus,()=>f.onItemFocus(A)),onKeyDown:(0,n.mK)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void f.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,i){var r;let n=(r=e.key,"rtl"!==i?r:"ArrowLeft"===r?"ArrowRight":"ArrowRight"===r?"ArrowLeft":r);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(n))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)))return I[n]}(e,f.orientation,f.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=b().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)n.reverse();else if("prev"===t||"next"===t){var i,r;"prev"===t&&n.reverse();let a=n.indexOf(e.currentTarget);n=f.loop?(i=n,r=a+1,i.map((e,t)=>i[(r+t)%i.length])):n.slice(a+1)}setTimeout(()=>T(n))}}),children:"function"==typeof u?u({isCurrentTabStop:g,hasTabStop:null!=_}):u})})});w.displayName=M;var I={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function T(e,t=!1){let i=document.activeElement;for(let r of e)if(r===i||(r.focus({preventScroll:t}),document.activeElement!==i))return}var B=i(6026),R=i(7537),D="Radio",[L,P]=(0,s.A)(D),[U,F]=L(D),N=r.forwardRef((e,t)=>{let{__scopeRadio:i,name:s,checked:l=!1,required:c,disabled:u,value:d="on",onCheck:p,form:A,...f}=e,[g,m]=r.useState(null),v=(0,a.s)(t,e=>m(e)),b=r.useRef(!1),y=!g||A||!!g.closest("form");return(0,h.jsxs)(U,{scope:i,checked:l,disabled:u,children:[(0,h.jsx)(o.sG.button,{type:"button",role:"radio","aria-checked":l,"data-state":G(l),"data-disabled":u?"":void 0,disabled:u,value:d,...f,ref:v,onClick:(0,n.mK)(e.onClick,e=>{l||p?.(),y&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})}),y&&(0,h.jsx)(Q,{control:g,bubbles:!b.current,name:s,value:d,checked:l,required:c,disabled:u,form:A,style:{transform:"translateX(-100%)"}})]})});N.displayName=D;var O="RadioIndicator",k=r.forwardRef((e,t)=>{let{__scopeRadio:i,forceMount:r,...n}=e,a=F(O,i);return(0,h.jsx)(R.C,{present:r||a.checked,children:(0,h.jsx)(o.sG.span,{"data-state":G(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t})})});k.displayName=O;var Q=r.forwardRef(({__scopeRadio:e,control:t,checked:i,bubbles:n=!0,...s},l)=>{let c,u=r.useRef(null),d=(0,a.s)(u,l),p=(c=r.useRef({value:i,previous:i}),r.useMemo(()=>(c.current.value!==i&&(c.current.previous=c.current.value,c.current.value=i),c.current.previous),[i])),A=function(e){let[t,i]=r.useState(void 0);return(0,B.N)(()=>{if(e){i({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let r,n;if(!Array.isArray(t)||!t.length)return;let a=t[0];if("borderBoxSize"in a){let e=a.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,n=t.blockSize}else r=e.offsetWidth,n=e.offsetHeight;i({width:r,height:n})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}i(void 0)},[e]),t}(t);return r.useEffect(()=>{let e=u.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(p!==i&&t){let r=new Event("click",{bubbles:n});t.call(e,i),e.dispatchEvent(r)}},[p,i,n]),(0,h.jsx)(o.sG.input,{type:"radio","aria-hidden":!0,defaultChecked:i,...s,tabIndex:-1,ref:d,style:{...s.style,...A,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function G(e){return e?"checked":"unchecked"}Q.displayName="RadioBubbleInput";var H=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],z="RadioGroup",[V,W]=(0,s.A)(z,[x,P]),q=x(),j=P(),[X,Y]=V(z),K=r.forwardRef((e,t)=>{let{__scopeRadioGroup:i,name:r,defaultValue:n,value:a,required:s=!1,disabled:l=!1,orientation:c,dir:u,loop:A=!0,onValueChange:f,...g}=e,m=q(i),v=(0,p.jH)(u),[b,y]=(0,d.i)({prop:a,defaultProp:n??null,onChange:f,caller:z});return(0,h.jsx)(X,{scope:i,name:r,required:s,disabled:l,value:b,onValueChange:y,children:(0,h.jsx)(S,{asChild:!0,...m,orientation:c,dir:v,loop:A,children:(0,h.jsx)(o.sG.div,{role:"radiogroup","aria-required":s,"aria-orientation":c,"data-disabled":l?"":void 0,dir:v,...g,ref:t})})})});K.displayName=z;var J="RadioGroupItem",$=r.forwardRef((e,t)=>{let{__scopeRadioGroup:i,disabled:s,...o}=e,l=Y(J,i),c=l.disabled||s,u=q(i),d=j(i),p=r.useRef(null),A=(0,a.s)(t,p),f=l.value===o.value,g=r.useRef(!1);return r.useEffect(()=>{let e=e=>{H.includes(e.key)&&(g.current=!0)},t=()=>g.current=!1;return document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}},[]),(0,h.jsx)(w,{asChild:!0,...u,focusable:!c,active:f,children:(0,h.jsx)(N,{disabled:c,required:l.required,checked:f,...d,...o,name:l.name,ref:A,onCheck:()=>l.onValueChange(o.value),onKeyDown:(0,n.mK)(e=>{"Enter"===e.key&&e.preventDefault()}),onFocus:(0,n.mK)(o.onFocus,()=>{g.current&&p.current?.click()})})})});$.displayName=J;var Z=r.forwardRef((e,t)=>{let{__scopeRadioGroup:i,...r}=e,n=j(i);return(0,h.jsx)(k,{...n,...r,ref:t})});Z.displayName="RadioGroupIndicator";var ee=K,et=$,ei=Z},2608(e,t,i){"use strict";let r,n,a,s;i.d(t,{NNP:()=>tY,yLC:()=>tK});let o=(e,t)=>{if("number"==typeof e){if(3===t)return{mode:"rgb",r:(e>>8&15|e>>4&240)/255,g:(e>>4&15|240&e)/255,b:(15&e|e<<4&240)/255};if(4===t)return{mode:"rgb",r:(e>>12&15|e>>8&240)/255,g:(e>>8&15|e>>4&240)/255,b:(e>>4&15|240&e)/255,alpha:(15&e|e<<4&240)/255};if(6===t)return{mode:"rgb",r:(e>>16&255)/255,g:(e>>8&255)/255,b:(255&e)/255};if(8===t)return{mode:"rgb",r:(e>>24&255)/255,g:(e>>16&255)/255,b:(e>>8&255)/255,alpha:(255&e)/255}}},l={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},h=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,c="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)",u=`${c}%`,d=`(?:${c}%|${c})`,p=`(?:${c}%|${c}|none)`,A=`(?:${c}(deg|grad|rad|turn)|${c})`,f="\\s*,\\s*";RegExp("^"+p+"$");let g=RegExp(`^rgba?\\(\\s*${c}${f}${c}${f}${c}\\s*(?:,\\s*${d}\\s*)?\\)$`),m=RegExp(`^rgba?\\(\\s*${u}${f}${u}${f}${u}\\s*(?:,\\s*${d}\\s*)?\\)$`),v=(e="rgb")=>t=>{let i;return void 0!==(t=void 0===(i=t)?void 0:"object"!=typeof i?H(i):void 0!==i.mode?i:e?{...i,mode:e}:void 0)?t.mode===e?t:b[t.mode][e]?b[t.mode][e](t):"rgb"===e?b[t.mode].rgb(t):b.rgb[e](b[t.mode].rgb(t)):void 0},b={},y={},x=[],_={},E=e=>e,S=e=>(b[e.mode]={...b[e.mode],...e.toMode},Object.keys(e.fromMode||{}).forEach(t=>{b[t]||(b[t]={}),b[t][e.mode]=e.fromMode[t]}),e.ranges||(e.ranges={}),e.difference||(e.difference={}),e.channels.forEach(t=>{if(void 0===e.ranges[t]&&(e.ranges[t]=[0,1]),!e.interpolate[t])throw Error(`Missing interpolator for: ${t}`);"function"==typeof e.interpolate[t]&&(e.interpolate[t]={use:e.interpolate[t]}),e.interpolate[t].fixup||(e.interpolate[t].fixup=E)}),y[e.mode]=e,(e.parse||[]).forEach(t=>{C(t,e.mode)}),v(e.mode)),C=(e,t)=>{if("string"==typeof e){if(!t)throw Error("'mode' required when 'parser' is a string");_[e]=t}else"function"==typeof e&&0>x.indexOf(e)&&x.push(e)},M=/[^\x00-\x7F]|[a-zA-Z_]/,w=/[^\x00-\x7F]|[-\w]/,I="function",T="ident",B="number",R="percentage",D="none",L="alpha",P=0;function U(e){let t=e[P],i=e[P+1];return"-"===t||"+"===t?/\d/.test(i)||"."===i&&/\d/.test(e[P+2]):"."===t?/\d/.test(i):/\d/.test(t)}function F(e){if(P>=e.length)return!1;let t=e[P];if(M.test(t))return!0;if("-"===t){if(e.length-P<2)return!1;let t=e[P+1];if("-"===t||M.test(t))return!0}return!1}let N={deg:1,rad:180/Math.PI,grad:.9,turn:360};function O(e){let t="";if(("-"===e[P]||"+"===e[P])&&(t+=e[P++]),t+=k(e),"."===e[P]&&/\d/.test(e[P+1])&&(t+=e[P++]+k(e)),("e"===e[P]||"E"===e[P])&&(("-"===e[P+1]||"+"===e[P+1])&&/\d/.test(e[P+2])?t+=e[P++]+e[P++]+k(e):/\d/.test(e[P+1])&&(t+=e[P++]+k(e))),F(e)){let i=Q(e);return"deg"===i||"rad"===i||"turn"===i||"grad"===i?{type:"hue",value:t*N[i]}:void 0}return"%"===e[P]?(P++,{type:R,value:+t}):{type:B,value:+t}}function k(e){let t="";for(;/\d/.test(e[P]);)t+=e[P++];return t}function Q(e){let t="";for(;P<e.length&&w.test(e[P]);)t+=e[P++];return t}function G(e,t){let i,r=[];for(;e._i<e.length;){if((i=e[e._i++]).type===D||i.type===B||i.type===L||i.type===R||t&&"hue"===i.type){r.push(i);continue}if(")"===i.type){if(e._i<e.length)return;continue}return}if(!(r.length<3)&&!(r.length>4)){if(4===r.length){if(r[3].type!==L)return;r[3]=r[3].value}return 3===r.length&&r.push({type:D,value:void 0}),r.every(e=>e.type!==L)?r:void 0}}let H=e=>{let t;if("string"!=typeof e)return;let i=function(e=""){let t,i=e.trim(),r=[];for(P=0;P<i.length;){if("\n"===(t=i[P++])||" "===t||" "===t){for(;P<i.length&&("\n"===i[P]||" "===i[P]||" "===i[P]);)P++;continue}if(","===t)return;if(")"===t){r.push({type:")"});continue}if("+"===t){if(P--,U(i)){r.push(O(i));continue}return}if("-"===t){if(P--,U(i)){r.push(O(i));continue}if(F(i)){r.push({type:T,value:Q(i)});continue}return}if("."===t){if(P--,U(i)){r.push(O(i));continue}return}if("/"===t){let e;for(;P<i.length&&("\n"===i[P]||" "===i[P]||" "===i[P]);)P++;if(U(i)&&"hue"!==(e=O(i)).type){r.push({type:L,value:e});continue}if(F(i)&&"none"===Q(i)){r.push({type:L,value:{type:D,value:void 0}});continue}return}if(/\d/.test(t)){P--,r.push(O(i));continue}if(M.test(t)){P--,r.push(function(e){let t=Q(e);return"("===e[P]?(P++,{type:I,value:t}):"none"===t?{type:D,value:void 0}:{type:T,value:t}}(i));continue}return}return r}(e),r=i?function(e,t){e._i=0;let i=e[e._i++];if(!i||i.type!==I)return;let r=G(e,t);if(r)return r.unshift(i.value),r}(i,!0):void 0,n=0,a=x.length;for(;n<a;)if(void 0!==(t=x[n++](e,r)))return t;return i?function(e){e._i=0;let t=e[e._i++];if(!t||t.type!==I||"color"!==t.value||(t=e[e._i++]).type!==T)return;let i=_[t.value];if(!i)return;let r={mode:i},n=G(e,!1);if(!n)return;let a=y[i].channels;for(let e=0,t,i;e<a.length;e++)t=n[e],i=a[e],t.type!==D&&(r[i]=t.type===B?t.value:t.value/100,"alpha"===i&&(r[i]=Math.max(0,Math.min(1,r[i]))));return r}(i):void 0},z=(r=(e,t,i)=>e+i*(t-e),e=>{let t=(e=>{let t=[];for(let i=0;i<e.length-1;i++){let r=e[i],n=e[i+1];void 0===r&&void 0===n?t.push(void 0):void 0!==r&&void 0!==n?t.push([r,n]):t.push(void 0!==r?[r,r]:[n,n])}return t})(e);return e=>{let i=e*t.length,n=e>=1?t.length-1:Math.max(Math.floor(i),0),a=t[n];return void 0===a?void 0:r(a[0],a[1],i-n)}}),V=e=>{let t=!1,i=e.map(e=>void 0!==e?(t=!0,e):1);return t?i:e},W={mode:"rgb",channels:["r","g","b","alpha"],parse:[function(e,t){if(!t||"rgb"!==t[0]&&"rgba"!==t[0])return;let i={mode:"rgb"},[,r,n,a,s]=t;if("hue"!==r.type&&"hue"!==n.type&&"hue"!==a.type)return r.type!==D&&(i.r=r.type===B?r.value/255:r.value/100),n.type!==D&&(i.g=n.type===B?n.value/255:n.value/100),a.type!==D&&(i.b=a.type===B?a.value/255:a.value/100),s.type!==D&&(i.alpha=Math.min(1,Math.max(0,s.type===B?s.value:s.value/100))),i},e=>{let t;return(t=e.match(h))?o(parseInt(t[1],16),t[1].length):void 0},e=>{let t,i={mode:"rgb"};if(t=e.match(g))void 0!==t[1]&&(i.r=t[1]/255),void 0!==t[2]&&(i.g=t[2]/255),void 0!==t[3]&&(i.b=t[3]/255);else{if(!(t=e.match(m)))return;void 0!==t[1]&&(i.r=t[1]/100),void 0!==t[2]&&(i.g=t[2]/100),void 0!==t[3]&&(i.b=t[3]/100)}return void 0!==t[4]?i.alpha=Math.max(0,Math.min(1,t[4]/100)):void 0!==t[5]&&(i.alpha=Math.max(0,Math.min(1,+t[5]))),i},e=>o(l[e.toLowerCase()],6),e=>"transparent"===e?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,"srgb"],serialize:"srgb",interpolate:{r:z,g:z,b:z,alpha:{use:z,fixup:V}},gamut:!0,white:{r:1,g:1,b:1},black:{r:0,g:0,b:0}},q=(e=0)=>Math.pow(Math.abs(e),563/256)*Math.sign(e),j=e=>{let t=q(e.r),i=q(e.g),r=q(e.b),n={mode:"xyz65",x:.5766690429101305*t+.1855582379065463*i+.1882286462349947*r,y:.297344975250536*t+.6273635662554661*i+.0752914584939979*r,z:.0270313613864123*t+.0706888525358272*i+.9913375368376386*r};return void 0!==e.alpha&&(n.alpha=e.alpha),n},X=e=>Math.pow(Math.abs(e),256/563)*Math.sign(e),Y=({x:e,y:t,z:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n={mode:"a98",r:X(2.0415879038107465*e-.5650069742788597*t-.3447313507783297*i),g:X(-.9692436362808798*e+1.8759675015077206*t+.0415550574071756*i),b:X(.0134442806320312*e-.1183623922310184*t+1.0151749943912058*i)};return void 0!==r&&(n.alpha=r),n},K=(e=0)=>{let t=Math.abs(e);return t<=.04045?e/12.92:(Math.sign(e)||1)*Math.pow((t+.055)/1.055,2.4)},J=({r:e,g:t,b:i,alpha:r})=>{let n={mode:"lrgb",r:K(e),g:K(t),b:K(i)};return void 0!==r&&(n.alpha=r),n},$=e=>{let{r:t,g:i,b:r,alpha:n}=J(e),a={mode:"xyz65",x:.4123907992659593*t+.357584339383878*i+.1804807884018343*r,y:.2126390058715102*t+.715168678767756*i+.0721923153607337*r,z:.0193308187155918*t+.119194779794626*i+.9505321522496607*r};return void 0!==n&&(a.alpha=n),a},Z=(e=0)=>{let t=Math.abs(e);return t>.0031308?(Math.sign(e)||1)*(1.055*Math.pow(t,1/2.4)-.055):12.92*e},ee=({r:e,g:t,b:i,alpha:r},n="rgb")=>{let a={mode:n,r:Z(e),g:Z(t),b:Z(i)};return void 0!==r&&(a.alpha=r),a},et=({x:e,y:t,z:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=ee({r:3.2409699419045226*e-1.537383177570094*t-.4986107602930034*i,g:-.9692436362808796*e+1.8759675015077204*t+.0415550574071756*i,b:.0556300796969936*e-.2039769588889765*t+1.0569715142428784*i});return void 0!==r&&(n.alpha=r),n},ei={...W,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:e=>Y($(e)),xyz65:Y},toMode:{rgb:e=>et(j(e)),xyz65:j}},er=e=>(e%=360)<0?e+360:e,en=e=>{let t;return t=e=>180>=Math.abs(e)?e:e-360*Math.sign(e),e.map((i,r,n)=>{if(void 0===i)return i;let a=er(i);return 0===r||void 0===e[r-1]?a:t(a-er(n[r-1]))}).reduce((e,t)=>(e.length&&void 0!==t&&void 0!==e[e.length-1]?e.push(t+e[e.length-1]):e.push(t),e),[])},ea=[-.14861,1.78277,-.29227,-.90649,1.97294,0],es=Math.PI/180,eo=180/Math.PI,el=ea["3"]*ea["4"],eh=ea["1"]*ea["4"],ec=ea["1"]*ea["2"]-ea["0"]*ea["3"],eu=(e,t)=>{if(void 0===e.h||void 0===t.h||!e.s||!t.s)return 0;let i=er(e.h),r=Math.sin((er(t.h)-i+360)/2*Math.PI/180);return 2*Math.sqrt(e.s*t.s)*r},ed=(e,t)=>{if(void 0===e.h||void 0===t.h||!e.c||!t.c)return 0;let i=er(e.h),r=Math.sin((er(t.h)-i+360)/2*Math.PI/180);return 2*Math.sqrt(e.c*t.c)*r},ep=e=>{let t=e.reduce((e,t)=>{if(void 0!==t){let i=t*Math.PI/180;e.sin+=Math.sin(i),e.cos+=Math.cos(i)}return e},{sin:0,cos:0}),i=180*Math.atan2(t.sin,t.cos)/Math.PI;return i<0?360+i:i},eA={mode:"cubehelix",channels:["h","s","l","alpha"],parse:["--cubehelix"],serialize:"--cubehelix",ranges:{h:[0,360],s:[0,4.614],l:[0,1]},fromMode:{rgb:({r:e,g:t,b:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=(ec*i+e*el-t*eh)/(ec+el-eh),a=i-n,s=(ea["4"]*(t-n)-ea["2"]*a)/ea["3"],o={mode:"cubehelix",l:n,s:0===n||1===n?void 0:Math.sqrt(a*a+s*s)/(ea["4"]*n*(1-n))};return o.s&&(o.h=Math.atan2(s,a)*eo-120),void 0!==r&&(o.alpha=r),o}},toMode:{rgb:({h:e,s:t,l:i,alpha:r})=>{let n={mode:"rgb"};void 0===i&&(i=0);let a=void 0===t?0:t*i*(1-i),s=Math.cos(e=(void 0===e?0:e+120)*es),o=Math.sin(e);return n.r=i+a*(ea["0"]*s+ea["1"]*o),n.g=i+a*(ea["2"]*s+ea["3"]*o),n.b=i+a*(ea["4"]*s+ea["5"]*o),void 0!==r&&(n.alpha=r),n}},interpolate:{h:{use:z,fixup:en},s:z,l:z,alpha:{use:z,fixup:V}},difference:{h:eu},average:{h:ep}},ef=({l:e,a:t,b:i,alpha:r},n="lch")=>{void 0===t&&(t=0),void 0===i&&(i=0);let a=Math.sqrt(t*t+i*i),s={mode:n,l:e,c:a};return a&&(s.h=er(180*Math.atan2(i,t)/Math.PI)),void 0!==r&&(s.alpha=r),s},eg=({l:e,c:t,h:i,alpha:r},n="lab")=>{void 0===i&&(i=0);let a={mode:n,l:e,a:t?t*Math.cos(i/180*Math.PI):0,b:t?t*Math.sin(i/180*Math.PI):0};return void 0!==r&&(a.alpha=r),a},em={X:.3457/.3585,Y:1,Z:.8251046025104602},ev={X:.3127/.329,Y:1,Z:1.0890577507598784},eb=e=>Math.pow(e,3)>.008856451679035631?Math.pow(e,3):(116*e-16)/903.2962962962963,ey=({l:e,a:t,b:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=(e+16)/116,a=t/500+n,s=n-i/200,o={mode:"xyz65",x:eb(a)*ev.X,y:eb(n)*ev.Y,z:eb(s)*ev.Z};return void 0!==r&&(o.alpha=r),o},ex=e=>et(ey(e)),e_=e=>e>.008856451679035631?Math.cbrt(e):(903.2962962962963*e+16)/116,eE=({x:e,y:t,z:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=e_(e/ev.X),a=e_(t/ev.Y),s={mode:"lab65",l:116*a-16,a:500*(n-a),b:200*(a-e_(i/ev.Z))};return void 0!==r&&(s.alpha=r),s},eS=e=>{let t=eE($(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},eC=26/180*Math.PI,eM=Math.cos(eC),ew=Math.sin(eC),eI=100/Math.log(1.39),eT=({l:e,c:t,h:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n={mode:"lab65",l:(Math.exp(e/eI)-1)/.0039},a=(Math.exp(.0435*t*1)-1)/.075,s=a*Math.cos(i/180*Math.PI-eC),o=a*Math.sin(i/180*Math.PI-eC);return n.a=s*eM-o/.83*ew,n.b=s*ew+o/.83*eM,void 0!==r&&(n.alpha=r),n},eB=({l:e,a:t,b:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=t*eM+i*ew,a=.83*(i*eM-t*ew),s={mode:"dlch",l:eI/1*Math.log(1+.0039*e),c:Math.log(1+.075*Math.sqrt(n*n+a*a))/.0435};return s.c&&(s.h=er((Math.atan2(a,n)+eC)/Math.PI*180)),void 0!==r&&(s.alpha=r),s},eR=e=>eT(ef(e,"dlch")),eD=e=>eg(eB(e),"dlab"),eL=RegExp(`^hsla?\\(\\s*${A}${f}${u}${f}${u}\\s*(?:,\\s*${d}\\s*)?\\)$`),eP={mode:"hsl",toMode:{rgb:function({h:e,s:t,l:i,alpha:r}){let n;e=er(void 0!==e?e:0),void 0===t&&(t=0),void 0===i&&(i=0);let a=i+t*(i<.5?i:1-i),s=a-(a-i)*2*Math.abs(e/60%2-1);switch(Math.floor(e/60)){case 0:n={r:a,g:s,b:2*i-a};break;case 1:n={r:s,g:a,b:2*i-a};break;case 2:n={r:2*i-a,g:a,b:s};break;case 3:n={r:2*i-a,g:s,b:a};break;case 4:n={r:s,g:2*i-a,b:a};break;case 5:n={r:a,g:2*i-a,b:s};break;default:n={r:2*i-a,g:2*i-a,b:2*i-a}}return n.mode="rgb",void 0!==r&&(n.alpha=r),n}},fromMode:{rgb:function({r:e,g:t,b:i,alpha:r}){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=Math.max(e,t,i),a=Math.min(e,t,i),s={mode:"hsl",s:n===a?0:(n-a)/(1-Math.abs(n+a-1)),l:.5*(n+a)};return n-a!=0&&(s.h=(n===e?(t-i)/(n-a)+(t<i)*6:n===t?(i-e)/(n-a)+2:(e-t)/(n-a)+4)*60),void 0!==r&&(s.alpha=r),s}},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[function(e,t){if(!t||"hsl"!==t[0]&&"hsla"!==t[0])return;let i={mode:"hsl"},[,r,n,a,s]=t;if(r.type!==D){if(r.type===R)return;i.h=r.value}if(n.type!==D){if("hue"===n.type)return;i.s=n.value/100}if(a.type!==D){if("hue"===a.type)return;i.l=a.value/100}return s.type!==D&&(i.alpha=Math.min(1,Math.max(0,s.type===B?s.value:s.value/100))),i},e=>{let t=e.match(eL);if(!t)return;let i={mode:"hsl"};return void 0!==t[3]?i.h=+t[3]:void 0!==t[1]&&void 0!==t[2]&&(i.h=((e,t)=>{switch(t){case"deg":return+e;case"rad":return e/Math.PI*180;case"grad":return e/10*9;case"turn":return 360*e}})(t[1],t[2])),void 0!==t[4]&&(i.s=Math.min(Math.max(0,t[4]/100),1)),void 0!==t[5]&&(i.l=Math.min(Math.max(0,t[5]/100),1)),void 0!==t[6]?i.alpha=Math.max(0,Math.min(1,t[6]/100)):void 0!==t[7]&&(i.alpha=Math.max(0,Math.min(1,+t[7]))),i}],serialize:e=>`hsl(${void 0!==e.h?e.h:"none"} ${void 0!==e.s?100*e.s+"%":"none"} ${void 0!==e.l?100*e.l+"%":"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:z,fixup:en},s:z,l:z,alpha:{use:z,fixup:V}},difference:{h:eu},average:{h:ep}};function eU({h:e,s:t,v:i,alpha:r}){let n;e=er(void 0!==e?e:0),void 0===t&&(t=0),void 0===i&&(i=0);let a=Math.abs(e/60%2-1);switch(Math.floor(e/60)){case 0:n={r:i,g:i*(1-t*a),b:i*(1-t)};break;case 1:n={r:i*(1-t*a),g:i,b:i*(1-t)};break;case 2:n={r:i*(1-t),g:i,b:i*(1-t*a)};break;case 3:n={r:i*(1-t),g:i*(1-t*a),b:i};break;case 4:n={r:i*(1-t*a),g:i*(1-t),b:i};break;case 5:n={r:i,g:i*(1-t),b:i*(1-t*a)};break;default:n={r:i*(1-t),g:i*(1-t),b:i*(1-t)}}return n.mode="rgb",void 0!==r&&(n.alpha=r),n}function eF({r:e,g:t,b:i,alpha:r}){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=Math.max(e,t,i),a=Math.min(e,t,i),s={mode:"hsv",s:0===n?0:1-a/n,v:n};return n-a!=0&&(s.h=(n===e?(t-i)/(n-a)+(t<i)*6:n===t?(i-e)/(n-a)+2:(e-t)/(n-a)+4)*60),void 0!==r&&(s.alpha=r),s}let eN={mode:"hsv",toMode:{rgb:eU},parse:["--hsv"],serialize:"--hsv",fromMode:{rgb:eF},channels:["h","s","v","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:z,fixup:en},s:z,v:z,alpha:{use:z,fixup:V}},difference:{h:eu},average:{h:ep}};function eO(e){if(e<0)return 0;let t=Math.pow(e,.012683313515655966);return 1e4*Math.pow(Math.max(0,t-.8359375)/(18.8515625-18.6875*t),6.277394636015326)}function ek(e){if(e<0)return 0;let t=Math.pow(e/1e4,.1593017578125);return Math.pow((.8359375+18.8515625*t)/(1+18.6875*t),78.84375)}let eQ=e=>Math.max(e/203,0),eG=({i:e,t,p:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=eO(e+.008609037037932761*t+.11102962500302593*i),a=eO(e-.00860903703793275*t-.11102962500302599*i),s=eO(e+.5600313357106791*t-.32062717498731885*i),o={mode:"xyz65",x:eQ(2.070152218389422*n-1.3263473389671556*a+.2066510476294051*s),y:eQ(.3647385209748074*n+.680566024947227*a-.0453045459220346*s),z:eQ(-.049747207535812*n-.0492609666966138*a+1.1880659249923042*s)};return void 0!==r&&(o.alpha=r),o},eH=(e=0)=>Math.max(203*e,0),ez=({x:e,y:t,z:i,alpha:r})=>{let n=eH(e),a=eH(t),s=eH(i),o=ek(.3592832590121217*n+.6976051147779502*a-.0358915932320289*s),l=ek(-.1920808463704995*n+1.1004767970374323*a+.0753748658519118*s),h=ek(.0070797844607477*n+.0748396662186366*a+.8433265453898765*s),c={mode:"itp",i:.5*o+.5*l,t:1.61376953125*o-3.323486328125*l+1.709716796875*h,p:4.378173828125*o-4.24560546875*l-.132568359375*h};return void 0!==r&&(c.alpha=r),c},eV=e=>{if(e<0)return 0;let t=Math.pow(e/1e4,.1593017578125);return Math.pow((.8359375+18.8515625*t)/(1+18.6875*t),134.03437499999998)},eW=(e=0)=>Math.max(203*e,0),eq=({x:e,y:t,z:i,alpha:r})=>{e=eW(e),t=eW(t);let n=1.15*e-.15*(i=eW(i)),a=.66*t+.34*e,s=eV(.41478972*n+.579999*a+.014648*i),o=eV(-.20151*n+1.120649*a+.0531008*i),l=eV(-.0166008*n+.2648*a+.6684799*i),h=(s+o)/2,c={mode:"jab",j:.44*h/(1-.56*h)-16295499532821565e-27,a:3.524*s-4.066708*o+.542708*l,b:.199076*s+1.096799*o-1.295875*l};return void 0!==r&&(c.alpha=r),c},ej=e=>{if(e<0)return 0;let t=Math.pow(e,.007460772656268216);return 1e4*Math.pow((.8359375-t)/(18.6875*t-18.8515625),6.277394636015326)},eX=({j:e,a:t,b:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=(e+16295499532821565e-27)/(.44+.56*(e+16295499532821565e-27)),a=ej(n+.13860504*t+.058047316*i),s=ej(n-.13860504*t-.058047316*i),o=ej(n-.096019242*t-.8118919*i),l={mode:"xyz65",x:(1.661373024652174*a-.914523081304348*s+.23136208173913045*o)/203,y:(-.3250758611844533*a+1.571847026732543*s-.21825383453227928*o)/203,z:(-.090982811*a-.31272829*s+1.5227666*o)/203};return void 0!==r&&(l.alpha=r),l},eY=e=>{let t=eq($(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},eK=e=>et(eX(e)),eJ=({j:e,a:t,b:i,alpha:r})=>{void 0===t&&(t=0),void 0===i&&(i=0);let n=Math.sqrt(t*t+i*i),a={mode:"jch",j:e,c:n};return n&&(a.h=er(180*Math.atan2(i,t)/Math.PI)),void 0!==r&&(a.alpha=r),a},e$=({j:e,c:t,h:i,alpha:r})=>{void 0===i&&(i=0);let n={mode:"jab",j:e,a:t?t*Math.cos(i/180*Math.PI):0,b:t?t*Math.sin(i/180*Math.PI):0};return void 0!==r&&(n.alpha=r),n},eZ=e=>Math.pow(e,3)>.008856451679035631?Math.pow(e,3):(116*e-16)/903.2962962962963,e0=({l:e,a:t,b:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=(e+16)/116,a=t/500+n,s=n-i/200,o={mode:"xyz50",x:eZ(a)*em.X,y:eZ(n)*em.Y,z:eZ(s)*em.Z};return void 0!==r&&(o.alpha=r),o},e1=({x:e,y:t,z:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=ee({r:3.1341359569958707*e-1.6173863321612538*t-.4906619460083532*i,g:-.978795502912089*e+1.916254567259524*t+.03344273116131949*i,b:.07195537988411677*e-.2289768264158322*t+1.405386058324125*i});return void 0!==r&&(n.alpha=r),n},e2=e=>e1(e0(e)),e3=e=>{let{r:t,g:i,b:r,alpha:n}=J(e),a={mode:"xyz50",x:.436065742824811*t+.3851514688337912*i+.14307845442264197*r,y:.22249319175623702*t+.7168870538238823*i+.06061979053616537*r,z:.013923904500943465*t+.09708128566574634*i+.7140993584005155*r};return void 0!==n&&(a.alpha=n),a},e4=e=>e>.008856451679035631?Math.cbrt(e):(903.2962962962963*e+16)/116,e5=({x:e,y:t,z:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=e4(e/em.X),a=e4(t/em.Y),s={mode:"lab",l:116*a-16,a:500*(n-a),b:200*(a-e4(i/em.Z))};return void 0!==r&&(s.alpha=r),s},e8=e=>{let t=e5(e3(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},e9={mode:"lab",toMode:{xyz50:e0,rgb:e2},fromMode:{xyz50:e5,rgb:e8},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-125,125],b:[-125,125]},parse:[function(e,t){if(!t||"lab"!==t[0])return;let i={mode:"lab"},[,r,n,a,s]=t;if("hue"!==r.type&&"hue"!==n.type&&"hue"!==a.type)return r.type!==D&&(i.l=Math.min(Math.max(0,r.value),100)),n.type!==D&&(i.a=n.type===B?n.value:125*n.value/100),a.type!==D&&(i.b=a.type===B?a.value:125*a.value/100),s.type!==D&&(i.alpha=Math.min(1,Math.max(0,s.type===B?s.value:s.value/100))),i}],serialize:e=>`lab(${void 0!==e.l?e.l:"none"} ${void 0!==e.a?e.a:"none"} ${void 0!==e.b?e.b:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{l:z,a:z,b:z,alpha:{use:z,fixup:V}}},e6={...e9,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:ey,rgb:ex},fromMode:{xyz65:eE,rgb:eS},ranges:{l:[0,100],a:[-125,125],b:[-125,125]}},e7={mode:"lch",toMode:{lab:eg,rgb:e=>e2(eg(e))},fromMode:{rgb:e=>ef(e8(e)),lab:ef},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[function(e,t){if(!t||"lch"!==t[0])return;let i={mode:"lch"},[,r,n,a,s]=t;if(r.type!==D){if("hue"===r.type)return;i.l=Math.min(Math.max(0,r.value),100)}if(n.type!==D&&(i.c=Math.max(0,n.type===B?n.value:150*n.value/100)),a.type!==D){if(a.type===R)return;i.h=a.value}return s.type!==D&&(i.alpha=Math.min(1,Math.max(0,s.type===B?s.value:s.value/100))),i}],serialize:e=>`lch(${void 0!==e.l?e.l:"none"} ${void 0!==e.c?e.c:"none"} ${void 0!==e.h?e.h:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:z,fixup:en},c:z,l:z,alpha:{use:z,fixup:V}},difference:{h:ed},average:{h:ep}},te={...e7,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:e=>eg(e,"lab65"),rgb:e=>ex(eg(e,"lab65"))},fromMode:{rgb:e=>ef(eS(e),"lch65"),lab65:e=>ef(e,"lch65")},ranges:{l:[0,100],c:[0,150],h:[0,360]}},tt=({l:e,u:t,v:i,alpha:r})=>{void 0===t&&(t=0),void 0===i&&(i=0);let n=Math.sqrt(t*t+i*i),a={mode:"lchuv",l:e,c:n};return n&&(a.h=er(180*Math.atan2(i,t)/Math.PI)),void 0!==r&&(a.alpha=r),a},ti=({l:e,c:t,h:i,alpha:r})=>{void 0===i&&(i=0);let n={mode:"luv",l:e,u:t?t*Math.cos(i/180*Math.PI):0,v:t?t*Math.sin(i/180*Math.PI):0};return void 0!==r&&(n.alpha=r),n},tr=(e,t,i)=>4*e/(e+15*t+3*i),tn=(e,t,i)=>9*t/(e+15*t+3*i),ta=tr(em.X,em.Y,em.Z),ts=tn(em.X,em.Y,em.Z),to=({x:e,y:t,z:i,alpha:r})=>{let n;void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let a=(n=t/em.Y)<=.008856451679035631?903.2962962962963*n:116*Math.cbrt(n)-16,s=tr(e,t,i),o=tn(e,t,i);isFinite(s)&&isFinite(o)?(s=13*a*(s-ta),o=13*a*(o-ts)):a=s=o=0;let l={mode:"luv",l:a,u:s,v:o};return void 0!==r&&(l.alpha=r),l},tl=(n=em.X,4*n/(n+15*em.Y+3*em.Z)),th=(a=em.X,9*(s=em.Y)/(a+15*s+3*em.Z)),tc=({l:e,u:t,v:i,alpha:r})=>{if(void 0===e&&(e=0),0===e)return{mode:"xyz50",x:0,y:0,z:0};void 0===t&&(t=0),void 0===i&&(i=0);let n=t/(13*e)+tl,a=i/(13*e)+th,s=em.Y*(e<=8?e/903.2962962962963:Math.pow((e+16)/116,3)),o={mode:"xyz50",x:9*n*s/(4*a),y:s,z:s*(12-3*n-20*a)/(4*a)};return void 0!==r&&(o.alpha=r),o},tu={...W,mode:"lrgb",toMode:{rgb:ee},fromMode:{rgb:J},parse:["srgb-linear"],serialize:"srgb-linear"},td=({r:e,g:t,b:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=Math.cbrt(.412221469470763*e+.5363325372617348*t+.0514459932675022*i),a=Math.cbrt(.2119034958178252*e+.6806995506452344*t+.1073969535369406*i),s=Math.cbrt(.0883024591900564*e+.2817188391361215*t+.6299787016738222*i),o={mode:"oklab",l:.210454268309314*n+.7936177747023054*a-.0040720430116193*s,a:1.9779985324311684*n-2.42859224204858*a+.450593709617411*s,b:.0259040424655478*n+.7827717124575296*a-.8086757549230774*s};return void 0!==r&&(o.alpha=r),o},tp=e=>{let t=td(J(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},tA=({l:e,a:t,b:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=Math.pow(e+.3963377773761749*t+.2158037573099136*i,3),a=Math.pow(e-.1055613458156586*t-.0638541728258133*i,3),s=Math.pow(e-.0894841775298119*t-1.2914855480194092*i,3),o={mode:"lrgb",r:4.076741636075957*n-3.3077115392580616*a+.2309699031821044*s,g:-1.2684379732850317*n+2.6097573492876887*a-.3413193760026573*s,b:-.0041960761386756*n-.7034186179359362*a+1.7076146940746117*s};return void 0!==r&&(o.alpha=r),o},tf=e=>ee(tA(e));function tg(e){return .5*(1.206/1.03*e-.206+Math.sqrt((1.206/1.03*e-.206)*(1.206/1.03*e-.206)+1.206/1.03*.12*e))}function tm(e){return(e*e+.206*e)/(1.206/1.03*(e+.03))}function tv(e,t){let i,r,n,a,s,o,l,h,c,u,d,p,A,f,g,m,v,b=(-1.88170328*e-.80936493*t>1?(i=1.19086277,r=1.76576728,n=.59662641,a=.75515197,s=.56771245,o=4.0767416621,l=-3.3077115913,h=.2309699292):1.81444104*e-1.19445276*t>1?(i=.73956515,r=-.45954404,n=.08285427,a=.1254107,s=.14503204,o=-1.2684380046,l=2.6097574011,h=-.3413193965):(i=1.35733652,r=-.00915799,n=-1.1513021,a=-.50559606,s=.00692167,o=-.0041960863,l=-.7034186147,h=1.707614701),c=i+r*e+n*t+a*e*e+s*e*t,u=.3963377774*e+.2158037573*t,d=-.1055613458*e-.0638541728*t,p=-.0894841775*e-1.291485548*t,m=o*((A=1+c*u)*A*A)+l*((f=1+c*d)*f*f)+h*((g=1+c*p)*g*g),c-=m*(v=3*u*A*A*o+3*d*f*f*l+3*p*g*g*h)/(v*v-.5*m*(6*u*u*A*o+6*d*d*f*l+6*p*p*g*h))),y=tA({l:1,a:b*e,b:b*t}),x=Math.cbrt(1/Math.max(y.r,y.g,y.b));return[x,x*b]}function tb(e,t,i=null){i||(i=tv(e,t));let r=i[0],n=i[1];return[n/r,n/(1-r)]}function ty(e,t,i){let r=tv(t,i),n=function(e,t,i,r,n,a=null){let s;if(a||(a=tv(e,t)),(i-n)*a[1]-(a[0]-n)*1<=0)s=a[1]*n/(+a[0]+a[1]*(n-i));else{s=a[1]*(n-1)/(+(a[0]-1)+a[1]*(n-i));{let r=i-n,a=.3963377774*e+.2158037573*t,o=-.1055613458*e-.0638541728*t,l=-.0894841775*e-1.291485548*t,h=r+ +a,c=r+ +o,u=r+ +l;{let e=n*(1-s)+s*i,t=+s,r=e+t*a,d=e+t*o,p=e+t*l,A=r*r*r,f=d*d*d,g=p*p*p,m=3*h*r*r,v=3*c*d*d,b=3*u*p*p,y=6*h*h*r,x=6*c*c*d,_=6*u*u*p,E=4.0767416621*A-3.3077115913*f+.2309699292*g-1,S=4.0767416621*m-3.3077115913*v+.2309699292*b,C=S/(S*S-.5*E*(4.0767416621*y-3.3077115913*x+.2309699292*_)),M=-E*C,w=-1.2684380046*A+2.6097574011*f-.3413193965*g-1,I=-1.2684380046*m+2.6097574011*v-.3413193965*b,T=I/(I*I-.5*w*(-1.2684380046*y+2.6097574011*x-.3413193965*_)),B=-w*T,R=-.0041960863*A-.7034186147*f+1.707614701*g-1,D=-.0041960863*m-.7034186147*v+1.707614701*b,L=D/(D*D-.5*R*(-.0041960863*y-.7034186147*x+1.707614701*_)),P=-R*L;s+=Math.min(M=C>=0?M:1e6,Math.min(B=T>=0?B:1e6,P=L>=0?P:1e6))}}}return s}(t,i,e,0,e,r),a=tb(t,i,r),s=.11516993+1/(7.4477897+4.1590124*i+t*(-2.19557347+1.75198401*i+t*(-2.13704948-10.02301043*i+t*(-4.24894561+5.38770819*i+4.69891013*t)))),o=.11239642+1/(1.6132032-.68124379*i+t*(.40370612+.90148123*i+t*(-.27087943+.6122399*i+t*(.00299215-.45399568*i-.14661872*t)))),l=n/Math.min(e*a[0],(1-e)*a[1]),h=e*s,c=(1-e)*o,u=.9*l*Math.sqrt(Math.sqrt(1/(1/(h*h*h*h)+1/(c*c*c*c))));return[Math.sqrt(1/(1/((h=.4*e)*h)+1/((c=(1-e)*.8)*c))),u,n]}function tx(e){let t,i=void 0!==e.l?e.l:0,r=void 0!==e.a?e.a:0,n=void 0!==e.b?e.b:0,a={mode:"okhsl",l:tg(i)};void 0!==e.alpha&&(a.alpha=e.alpha);let s=Math.sqrt(r*r+n*n);if(!s)return a.s=0,a;let[o,l,h]=ty(i,r/s,n/s);if(s<l){let e=.8*o;t=(s-0)/(e+(1-e/l)*(s-0))*.8}else{let e=.2*l*l*1.5625/o;t=.8+.2*((s-l)/(e+(1-e/(h-l))*(s-l)))}return t&&(a.s=t,a.h=er(180*Math.atan2(n,r)/Math.PI)),a}function t_(e){let t,i,r,n,a=void 0!==e.h?e.h:0,s=void 0!==e.s?e.s:0,o=void 0!==e.l?e.l:0,l={mode:"oklab",l:tm(o)};if(void 0!==e.alpha&&(l.alpha=e.alpha),!s||1===o)return l.a=l.b=0,l;let h=Math.cos(a/180*Math.PI),c=Math.sin(a/180*Math.PI),[u,d,p]=ty(l.l,h,c);s<.8?(t=1.25*s,i=0,n=1-(r=.8*u)/d):(t=5*(s-.8),i=d,n=1-(r=.2*d*d*1.5625/u)/(p-d));let A=i+t*r/(1-n*t);return l.a=A*h,l.b=A*c,l}let tE={...eP,mode:"okhsl",channels:["h","s","l","alpha"],parse:["--okhsl"],serialize:"--okhsl",fromMode:{oklab:tx,rgb:e=>tx(tp(e))},toMode:{oklab:t_,rgb:e=>tf(t_(e))}};function tS(e){let t=void 0!==e.l?e.l:0,i=void 0!==e.a?e.a:0,r=void 0!==e.b?e.b:0,n=Math.sqrt(i*i+r*r),a=n?i/n:1,s=n?r/n:1,[o,l]=tb(a,s),h=l/(n+t*l),c=h*t,u=h*n,d=tm(c),p=u*d/c,A=tA({l:d,a:a*p,b:s*p}),f=Math.cbrt(1/Math.max(A.r,A.g,A.b,0));t/=f;let g={mode:"okhsv",s:(n=n/f*tg(t)/t)?(.5+l)*u/(.5*l+l*(1-.5/o)*u):0,v:(t=tg(t))?t/c:0};return g.s&&(g.h=er(180*Math.atan2(r,i)/Math.PI)),void 0!==e.alpha&&(g.alpha=e.alpha),g}function tC(e){let t={mode:"oklab"};void 0!==e.alpha&&(t.alpha=e.alpha);let i=void 0!==e.h?e.h:0,r=void 0!==e.s?e.s:0,n=void 0!==e.v?e.v:0,a=Math.cos(i/180*Math.PI),s=Math.sin(i/180*Math.PI),[o,l]=tb(a,s),h=1-.5/o,c=1-.5*r/(.5+l-l*h*r),u=r*l*.5/(.5+l-l*h*r),d=tm(c),p=u*d/c,A=tA({l:d,a:a*p,b:s*p}),f=Math.cbrt(1/Math.max(A.r,A.g,A.b,0)),g=tm(n*c),m=u*g/c;return t.l=g*f,t.a=m*a*f,t.b=m*s*f,t}let tM={...eN,mode:"okhsv",channels:["h","s","v","alpha"],parse:["--okhsv"],serialize:"--okhsv",fromMode:{oklab:tS,rgb:e=>tS(tp(e))},toMode:{oklab:tC,rgb:e=>tf(tC(e))}},tw={...e9,mode:"oklab",toMode:{lrgb:tA,rgb:tf},fromMode:{lrgb:td,rgb:tp},ranges:{l:[0,1],a:[-.4,.4],b:[-.4,.4]},parse:[function(e,t){if(!t||"oklab"!==t[0])return;let i={mode:"oklab"},[,r,n,a,s]=t;if("hue"!==r.type&&"hue"!==n.type&&"hue"!==a.type)return r.type!==D&&(i.l=Math.min(Math.max(0,r.type===B?r.value:r.value/100),1)),n.type!==D&&(i.a=n.type===B?n.value:.4*n.value/100),a.type!==D&&(i.b=a.type===B?a.value:.4*a.value/100),s.type!==D&&(i.alpha=Math.min(1,Math.max(0,s.type===B?s.value:s.value/100))),i}],serialize:e=>`oklab(${void 0!==e.l?e.l:"none"} ${void 0!==e.a?e.a:"none"} ${void 0!==e.b?e.b:"none"}${e.alpha<1?` / ${e.alpha}`:""})`},tI={...e7,mode:"oklch",toMode:{oklab:e=>eg(e,"oklab"),rgb:e=>tf(eg(e,"oklab"))},fromMode:{rgb:e=>ef(tp(e),"oklch"),oklab:e=>ef(e,"oklch")},parse:[function(e,t){if(!t||"oklch"!==t[0])return;let i={mode:"oklch"},[,r,n,a,s]=t;if(r.type!==D){if("hue"===r.type)return;i.l=Math.min(Math.max(0,r.type===B?r.value:r.value/100),1)}if(n.type!==D&&(i.c=Math.max(0,n.type===B?n.value:.4*n.value/100)),a.type!==D){if(a.type===R)return;i.h=a.value}return s.type!==D&&(i.alpha=Math.min(1,Math.max(0,s.type===B?s.value:s.value/100))),i}],serialize:e=>`oklch(${void 0!==e.l?e.l:"none"} ${void 0!==e.c?e.c:"none"} ${void 0!==e.h?e.h:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,ranges:{l:[0,1],c:[0,.4],h:[0,360]}},tT=e=>{let{r:t,g:i,b:r,alpha:n}=J(e),a={mode:"xyz65",x:.486570948648216*t+.265667693169093*i+.1982172852343625*r,y:.2289745640697487*t+.6917385218365062*i+.079286914093745*r,z:0*t+.0451133818589026*i+1.043944368900976*r};return void 0!==n&&(a.alpha=n),a},tB=({x:e,y:t,z:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=ee({r:2.4934969119414263*e-.9313836179191242*t-.402710784450717*i,g:-.8294889695615749*e+1.7626640603183465*t+.0236246858419436*i,b:.0358458302437845*e-.0761723892680418*t+.9568845240076871*i},"p3");return void 0!==r&&(n.alpha=r),n},tR={...W,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:e=>tB($(e)),xyz65:tB},toMode:{rgb:e=>et(tT(e)),xyz65:tT}},tD=e=>{let t=Math.abs(e);return t>=1/512?Math.sign(e)*Math.pow(t,1/1.8):16*e},tL=({x:e,y:t,z:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n={mode:"prophoto",r:tD(1.3457868816471585*e-.2555720873797946*t-.0511018649755453*i),g:tD(-.5446307051249019*e+1.5082477428451466*t+.0205274474364214*i),b:tD(0*e+0*t+1.2119675456389452*i)};return void 0!==r&&(n.alpha=r),n},tP=(e=0)=>{let t=Math.abs(e);return t>=16/512?Math.sign(e)*Math.pow(t,1.8):e/16},tU=e=>{let t=tP(e.r),i=tP(e.g),r=tP(e.b),n={mode:"xyz50",x:.7977666449006423*t+.1351812974005331*i+.0313477341283922*r,y:.2880748288194013*t+.7118352342418731*i+899369387256e-16*r,z:0*t+0*i+.8251046025104602*r};return void 0!==e.alpha&&(n.alpha=e.alpha),n},tF={...W,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:tL,rgb:e=>tL(e3(e))},toMode:{xyz50:tU,rgb:e=>e1(tU(e))}},tN=e=>{let t=Math.abs(e);return t>.018053968510807?(Math.sign(e)||1)*(1.09929682680944*Math.pow(t,.45)-(1.09929682680944-1)):4.5*e},tO=({x:e,y:t,z:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n={mode:"rec2020",r:tN(1.7166511879712683*e-.3556707837763925*t-.2533662813736599*i),g:tN(-.6666843518324893*e+1.6164812366349395*t+.0157685458139111*i),b:tN(.0176398574453108*e-.0427706132578085*t+.9421031212354739*i)};return void 0!==r&&(n.alpha=r),n},tk=(e=0)=>{let t=Math.abs(e);return t<.08124285829863151?e/4.5:(Math.sign(e)||1)*Math.pow((t+1.09929682680944-1)/1.09929682680944,1/.45)},tQ=e=>{let t=tk(e.r),i=tk(e.g),r=tk(e.b),n={mode:"xyz65",x:.6369580483012911*t+.1446169035862083*i+.1688809751641721*r,y:.262700212011267*t+.6779980715188708*i+.059301716469862*r,z:0*t+.0280726930490874*i+1.0609850577107909*r};return void 0!==e.alpha&&(n.alpha=e.alpha),n},tG={...W,mode:"rec2020",fromMode:{xyz65:tO,rgb:e=>tO($(e))},toMode:{xyz65:tQ,rgb:e=>et(tQ(e))},parse:["rec2020"],serialize:"rec2020"},tH=Math.cbrt(.0037930732552754493),tz=e=>Math.cbrt(e)-tH,tV=e=>Math.pow(e+tH,3),tW={mode:"xyb",channels:["x","y","b","alpha"],parse:["--xyb"],serialize:"--xyb",toMode:{rgb:({x:e,y:t,b:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=tV(e+t)-.0037930732552754493,a=tV(t-e)-.0037930732552754493,s=tV(i+t)-.0037930732552754493,o=ee({r:11.031566904639861*n-9.866943908131562*a-.16462299650829934*s,g:-3.2541473810744237*n+4.418770377582723*a-.16462299650829934*s,b:-3.6588512867136815*n+2.7129230459360922*a+1.9459282407775895*s});return void 0!==r&&(o.alpha=r),o}},fromMode:{rgb:e=>{let{r:t,g:i,b:r,alpha:n}=J(e),a=tz(.3*t+.622*i+.078*r+.0037930732552754493),s=tz(.23*t+.692*i+.078*r+.0037930732552754493),o={mode:"xyb",x:(a-s)/2,y:(a+s)/2,b:tz(.2434226892454782*t+.2047674442449682*i+.5518098665095535*r+.0037930732552754493)-(a+s)/2};return void 0!==n&&(o.alpha=n),o}},ranges:{x:[-.0154,.0281],y:[0,.8453],b:[-.2778,.388]},interpolate:{x:z,y:z,b:z,alpha:{use:z,fixup:V}}},tq={mode:"yiq",toMode:{rgb:({y:e,i:t,q:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n={mode:"rgb",r:e+.95608445*t+.6208885*i,g:e-.27137664*t-.6486059*i,b:e-1.10561724*t+1.70250126*i};return void 0!==r&&(n.alpha=r),n}},fromMode:{rgb:({r:e,g:t,b:i,alpha:r})=>{void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n={mode:"yiq",y:.29889531*e+.58662247*t+.11448223*i,i:.59597799*e-.2741761*t-.32180189*i,q:.21147017*e-.52261711*t+.31114694*i};return void 0!==r&&(n.alpha=r),n}},channels:["y","i","q","alpha"],parse:["--yiq"],serialize:"--yiq",ranges:{i:[-.595,.595],q:[-.522,.522]},interpolate:{y:z,i:z,q:z,alpha:{use:z,fixup:V}}};((e=4)=>t=>{let i;return"number"==typeof t?Math.round(t*(i=Math.pow(10,i=e)))/i:t})(2);let tj=e=>Math.round(255*Math.max(0,Math.min(1,e||0))),tX=v("rgb");v("hsl");let tY=e=>(e=>{if(void 0!==e)return"#"+(0x1000000|tj(e.r)<<16|tj(e.g)<<8|tj(e.b)).toString(16).slice(1)})(tX(e));S(ei),S(eA),S({mode:"dlab",parse:["--din99o-lab"],serialize:"--din99o-lab",toMode:{lab65:eR,rgb:e=>ex(eR(e))},fromMode:{lab65:eD,rgb:e=>eD(eS(e))},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-40.09,45.501],b:[-40.469,44.344]},interpolate:{l:z,a:z,b:z,alpha:{use:z,fixup:V}}}),S({mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:eT,dlab:e=>eg(e,"dlab"),rgb:e=>ex(eT(e))},fromMode:{lab65:eB,dlab:e=>ef(e,"dlch"),rgb:e=>eB(eS(e))},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,51.484],h:[0,360]},interpolate:{l:z,c:z,h:{use:z,fixup:en},alpha:{use:z,fixup:V}},difference:{h:ed},average:{h:ep}}),S({mode:"hsi",toMode:{rgb:function({h:e,s:t,i,alpha:r}){let n;e=er(void 0!==e?e:0),void 0===t&&(t=0),void 0===i&&(i=0);let a=Math.abs(e/60%2-1);switch(Math.floor(e/60)){case 0:n={r:i*(1+t*(3/(2-a)-1)),g:i*(1+t*(3*(1-a)/(2-a)-1)),b:i*(1-t)};break;case 1:n={r:i*(1+t*(3*(1-a)/(2-a)-1)),g:i*(1+t*(3/(2-a)-1)),b:i*(1-t)};break;case 2:n={r:i*(1-t),g:i*(1+t*(3/(2-a)-1)),b:i*(1+t*(3*(1-a)/(2-a)-1))};break;case 3:n={r:i*(1-t),g:i*(1+t*(3*(1-a)/(2-a)-1)),b:i*(1+t*(3/(2-a)-1))};break;case 4:n={r:i*(1+t*(3*(1-a)/(2-a)-1)),g:i*(1-t),b:i*(1+t*(3/(2-a)-1))};break;case 5:n={r:i*(1+t*(3/(2-a)-1)),g:i*(1-t),b:i*(1+t*(3*(1-a)/(2-a)-1))};break;default:n={r:i*(1-t),g:i*(1-t),b:i*(1-t)}}return n.mode="rgb",void 0!==r&&(n.alpha=r),n}},parse:["--hsi"],serialize:"--hsi",fromMode:{rgb:function({r:e,g:t,b:i,alpha:r}){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0);let n=Math.max(e,t,i),a=Math.min(e,t,i),s={mode:"hsi",s:e+t+i===0?0:1-3*a/(e+t+i),i:(e+t+i)/3};return n-a!=0&&(s.h=(n===e?(t-i)/(n-a)+(t<i)*6:n===t?(i-e)/(n-a)+2:(e-t)/(n-a)+4)*60),void 0!==r&&(s.alpha=r),s}},channels:["h","s","i","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:z,fixup:en},s:z,i:z,alpha:{use:z,fixup:V}},difference:{h:eu},average:{h:ep}}),S(eP),S(eN),S({mode:"hwb",toMode:{rgb:function({h:e,w:t,b:i,alpha:r}){if(void 0===t&&(t=0),void 0===i&&(i=0),t+i>1){let e=t+i;t/=e,i/=e}return eU({h:e,s:1===i?1:1-t/(1-i),v:1-i,alpha:r})}},fromMode:{rgb:function(e){let t=eF(e);if(void 0===t)return;let i=void 0!==t.s?t.s:0,r=void 0!==t.v?t.v:0,n={mode:"hwb",w:(1-i)*r,b:1-r};return void 0!==t.h&&(n.h=t.h),void 0!==t.alpha&&(n.alpha=t.alpha),n}},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[function(e,t){if(!t||"hwb"!==t[0])return;let i={mode:"hwb"},[,r,n,a,s]=t;if(r.type!==D){if(r.type===R)return;i.h=r.value}if(n.type!==D){if("hue"===n.type)return;i.w=n.value/100}if(a.type!==D){if("hue"===a.type)return;i.b=a.value/100}return s.type!==D&&(i.alpha=Math.min(1,Math.max(0,s.type===B?s.value:s.value/100))),i}],serialize:e=>`hwb(${void 0!==e.h?e.h:"none"} ${void 0!==e.w?100*e.w+"%":"none"} ${void 0!==e.b?100*e.b+"%":"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:z,fixup:en},w:z,b:z,alpha:{use:z,fixup:V}},difference:{h:(e,t)=>{if(void 0===e.h||void 0===t.h)return 0;let i=er(e.h),r=er(t.h);return Math.abs(r-i)>180?i-(r-360*Math.sign(r-i)):r-i}},average:{h:ep}}),S({mode:"itp",channels:["i","t","p","alpha"],parse:["--ictcp"],serialize:"--ictcp",toMode:{xyz65:eG,rgb:e=>et(eG(e))},fromMode:{xyz65:ez,rgb:e=>ez($(e))},ranges:{i:[0,.581],t:[-.369,.272],p:[-.164,.331]},interpolate:{i:z,t:z,p:z,alpha:{use:z,fixup:V}}}),S({mode:"jab",channels:["j","a","b","alpha"],parse:["--jzazbz"],serialize:"--jzazbz",fromMode:{rgb:eY,xyz65:eq},toMode:{rgb:eK,xyz65:eX},ranges:{j:[0,.222],a:[-.109,.129],b:[-.185,.134]},interpolate:{j:z,a:z,b:z,alpha:{use:z,fixup:V}}}),S({mode:"jch",parse:["--jzczhz"],serialize:"--jzczhz",toMode:{jab:e$,rgb:e=>eK(e$(e))},fromMode:{rgb:e=>eJ(eY(e)),jab:eJ},channels:["j","c","h","alpha"],ranges:{j:[0,.221],c:[0,.19],h:[0,360]},interpolate:{h:{use:z,fixup:en},c:z,j:z,alpha:{use:z,fixup:V}},difference:{h:ed},average:{h:ep}}),S(e9),S(e6),S(e7),S(te),S({mode:"lchuv",toMode:{luv:ti,rgb:e=>e1(tc(ti(e)))},fromMode:{rgb:e=>tt(to(e3(e))),luv:tt},channels:["l","c","h","alpha"],parse:["--lchuv"],serialize:"--lchuv",ranges:{l:[0,100],c:[0,176.956],h:[0,360]},interpolate:{h:{use:z,fixup:en},c:z,l:z,alpha:{use:z,fixup:V}},difference:{h:ed},average:{h:ep}}),S(tu),S({mode:"luv",toMode:{xyz50:tc,rgb:e=>e1(tc(e))},fromMode:{xyz50:to,rgb:e=>to(e3(e))},channels:["l","u","v","alpha"],parse:["--luv"],serialize:"--luv",ranges:{l:[0,100],u:[-84.936,175.042],v:[-125.882,87.243]},interpolate:{l:z,u:z,v:z,alpha:{use:z,fixup:V}}}),S(tE),S(tM),S(tw);let tK=S(tI);S(tR),S(tF),S(tG),S(W),S(tW),S({mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:e1,lab:e5},fromMode:{rgb:e3,lab:e0},channels:["x","y","z","alpha"],ranges:{x:[0,.964],y:[0,.999],z:[0,.825]},interpolate:{x:z,y:z,z:z,alpha:{use:z,fixup:V}}}),S({mode:"xyz65",toMode:{rgb:et,xyz50:e=>{let{x:t,y:i,z:r,alpha:n}=e;void 0===t&&(t=0),void 0===i&&(i=0),void 0===r&&(r=0);let a={mode:"xyz50",x:1.0479298208405488*t+.0229467933410191*i-.0501922295431356*r,y:.0296278156881593*t+.990434484573249*i-.0170738250293851*r,z:-.0092430581525912*t+.0150551448965779*i+.7518742899580008*r};return void 0!==n&&(a.alpha=n),a}},fromMode:{rgb:$,xyz50:e=>{let{x:t,y:i,z:r,alpha:n}=e;void 0===t&&(t=0),void 0===i&&(i=0),void 0===r&&(r=0);let a={mode:"xyz65",x:.9554734527042182*t-.0230985368742614*i+.0632593086610217*r,y:-.0283697069632081*t+1.0099954580058226*i+.021041398966943*r,z:.0123140016883199*t-.0205076964334779*i+1.3303659366080753*r};return void 0!==n&&(a.alpha=n),a}},ranges:{x:[0,.95],y:[0,1],z:[0,1.088]},channels:["x","y","z","alpha"],parse:["xyz","xyz-d65"],serialize:"xyz-d65",interpolate:{x:z,y:z,z:z,alpha:{use:z,fixup:V}}}),S(tq)}}]);
|