shopar-plugin 1.1.2 → 1.2.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ShopAR={})}(this,function(e){"use strict";const t=["AR","3D"];class n extends Error{constructor(e){super(e),this.name="PluginError"}}class i extends n{constructor(e){super(e),this.name="ValidationError"}}class r extends n{constructor(e,t){super(e),this.name="ApiError",this.status=t}}class a extends n{constructor(e){super(e),this.name="SanitizationError"}}class s extends n{constructor(e){super((null==e?void 0:e.trim())||"3D failed to launch."),this.name="Launch3DError"}}class o extends n{constructor(e){super((null==e?void 0:e.trim())||"AR failed to launch."),this.name="LaunchARError"}}class l extends o{constructor(e){super((null==e?void 0:e.trim())||"Camera permission denied."),this.name="CameraPermissionDeniedError"}}class c extends o{constructor(e){super((null==e?void 0:e.trim())||"QR failed."),this.name="QRError"}}function h(e,t,n,i){return new(n||(n=Promise))(function(r,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,o)}l((i=i.apply(e,t||[])).next())})}function A(e){return null!=e&&"object"==typeof e&&"name"in e&&"string"==typeof e.name?e.name:"Unknown"}function u(e){return null!=e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message?e.message:"Unknown error."}"function"==typeof SuppressedError&&SuppressedError;function d(e){if(null!=e&&"object"==typeof e&&"stack"in e&&"string"==typeof e.stack)return e.stack.length>1e3?e.stack.slice(0,1e3):e.stack}function p(e,t){return()=>h(this,void 0,void 0,function*(){try{return yield t()}catch(t){if(t instanceof n)throw t;throw new n(`${e} failed: ${u(t)}`)}})}const f=[Uint8Array,Uint32Array].length-2,g=["addEventListener","alert","atob","blur","btoa","cancelAnimationFrame","localStorage","location","locationbar","hash","hasOwnProperty","host","hostname","href","requestAnimationFrame"],m=[2,12,7,1],v=window[g[m[m[f]]]][g[m[m[m.length-1]]]];function E(){const e=(new TextEncoder).encode(v),t=g.map(e=>e.length);for(let n=0;n<e.length;n++)e[n]^=t[n%t.length];return window[g[t[2]]](String.fromCodePoint(...e))}v.charCodeAt(f);function b(e){return e*(180/Math.PI)}function C(e){return Math.round(100*e)/100}const _=["Glasses","Shoes","Watches","Bracelets","Scarves","Hats","Necklaces"],I=["Shoes"];const x="1.1.2";let y=`https://cdn.jsdelivr.net/npm/shopar-plugin@${x}/dist`;const w=e=>{null!=e&&(y=e.endsWith("/")?e.substring(0,e.length-1):e)},M=()=>y;function S(e,t){return h(this,void 0,void 0,function*(){if("function"!=typeof importScripts){if("function"==typeof window.define&&window.define.amd&&"function"==typeof window.require)return new Promise(n=>{window.require([e],e=>{window[t]=e,n()},()=>{n()})});{const t=document.createElement("script");return t.setAttribute("src",e),t.setAttribute("crossorigin","anonymous"),new Promise(e=>{t.addEventListener("load",()=>e(),!1),t.addEventListener("error",()=>e(),!1),document.body.appendChild(t)})}}importScripts(e.toString())})}let B;function T(e,t){let n=!0;return{qrPaused:()=>n,qrDraw:(i,r)=>h(this,void 0,void 0,function*(){!function(){h(this,void 0,void 0,function*(){null==B&&(B=S(`${M()}/shopar-qr.js`,"ShopAR__QR"))})}(),yield B;const a=`https://ar.shopar.ai/${x.includes("alpha")?"qr-alpha":"qr"}/?${new URLSearchParams({a:i,s:r,h:location.href})}`,s=yield window.ShopAR__QR.toDataURL(a),o=new Promise((e,n)=>{t.onload=e,t.onerror=n});t.src=s,yield o,n=!1,e.style.display=""}),qrPause:()=>h(this,void 0,void 0,function*(){n=!0,e.style.display="none"})}}const R={"loading.ar":"Loading Try On...","prompt.ar.shoes":void 0,"prompt.ar.glasses":void 0,"prompt.ar.watches":void 0,"prompt.ar.bracelets":void 0,"prompt.ar.scarves":void 0,"prompt.ar.hats":void 0,"prompt.ar.necklaces":void 0},D=Object.keys(R);const Q="--shopar";function U(e){return`var(${e.var}, ${e.default})`}const L={padding:{var:`${Q}-btn-padding`,default:"0.5rem 0.75rem"},gap:{var:`${Q}-btn-gap`,default:"0.25rem"},border:{var:`${Q}-btn-border`,default:"1px solid #dddddd"},borderRadius:{var:`${Q}-btn-border-radius`,default:"calc(infinity * 1px)"},bg:{var:`${Q}-btn-bg`,default:"#ffffff"},hoverBg:{var:`${Q}-btn-hover-bg`,default:"#f5f5f5"}};function P(e,t,n){const i=document.createElement("button");i.type="button",i.appendChild(n);{const t=document.createElement("span");t.textContent=e,i.appendChild(t)}i.ariaLabel=t;const r=i.style;r.display="none",r.pointerEvents="auto",r.padding=U(L.padding),r.justifyContent="center",r.alignItems="center",r.gap=U(L.gap),r.backgroundColor=U(L.bg),r.border=U(L.border),r.borderRadius=U(L.borderRadius),r.cursor="pointer";const a=U(L.bg),s=U(L.hoverBg);return i.addEventListener("mouseenter",()=>{r.backgroundColor=s}),i.addEventListener("mouseleave",()=>{r.backgroundColor=a}),i}const N={paddingBottom:{var:`${Q}-btn-container-padding-bottom`,default:"2rem"},gap:{var:`${Q}-btn-container-gap`,default:"0.5rem"}};const F={bg:{var:`${Q}-ar-prompt-bg`,default:"#1e293bb2"},gap:{var:`${Q}-ar-prompt-gap`,default:"1rem"},textColor:{var:`${Q}-ar-prompt-text-color`,default:"white"},imgMaxWidth:{var:`${Q}-ar-prompt-img-max-width`,default:"80%"},imgMaxHeight:{var:`${Q}-ar-prompt-img-max-height`,default:"50%"}};const O={containerDisplay:{var:`${Q}-ar-loading-container-display`,default:"flex"},containerBg:{var:`${Q}-ar-loading-container-bg`,default:"#ffffff"},containerGap:{var:`${Q}-ar-loading-container-gap`,default:"1rem"},barWidth:{var:`${Q}-ar-loading-bar-width`,default:"80%"},barHeight:{var:`${Q}-ar-loading-bar-height`,default:"0.5rem"},barRadius:{var:`${Q}-ar-loading-bar-radius`,default:"calc(infinity * 1px)"},barFg:{var:`${Q}-ar-loading-bar-fg`,default:"linear-gradient(90deg, #773cd8, #5fb9ec)"},barBg:{var:`${Q}-ar-loading-bar-bg`,default:"#e5e7eb"}};const k={bg:{var:`${Q}-qr-bg`,default:"#ffffff"}};function G(e,t,n,i){return new(n||(n=Promise))(function(r,a){function s(e){try{l(i.next(e))}catch(e){a(e)}}function o(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,o)}l((i=i.apply(e,t||[])).next())})}function H(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function z(e,t,n,i,r){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;const V=.1,W="function"==typeof Float32Array;function q(e,t){return 1-3*t+3*e}function j(e,t){return 3*t-6*e}function Y(e){return 3*e}function X(e,t,n){return((q(t,n)*e+j(t,n))*e+Y(t))*e}function K(e,t,n){return 3*q(t,n)*e*e+2*j(t,n)*e+Y(t)}function J(e){return e}function Z(e){if("hold"===e.type)return()=>0;if("bezier"===e.type){const t=function(e,t,n,i){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&n===i)return J;const r=W?new Float32Array(11):new Array(11);for(let t=0;t<11;++t)r[t]=X(t*V,e,n);function a(t){let i=0,a=1;for(;10!==a&&r[a]<=t;++a)i+=V;--a;const s=i+(t-r[a])/(r[a+1]-r[a])*V,o=K(s,e,n);return o>=.001?function(e,t,n,i){for(let r=0;r<4;++r){const r=K(t,n,i);if(0===r)return t;t-=(X(t,n,i)-e)/r}return t}(t,s,e,n):0===o?s:function(e,t,n,i,r){let a,s,o=0;do{s=t+(n-t)/2,a=X(s,i,r)-e,a>0?n=s:t=s}while(Math.abs(a)>1e-7&&++o<10);return s}(t,i,i+V,e,n)}return function(e){return 0===e||1===e?e:X(a(e),t,i)}}(e.x1,e.y1,e.x2,e.y2);return e=>t(e)}throw new Error(`Unknown interpolation: ${e}`)}function $(e){if(e.length<2)throw new Error("Expected at least two key frames.");const t=e[e.length-1].time,n=[...e].sort((e,t)=>e.time-t.time).map(({time:e,value:t,interpolation:n})=>({time:e,value:t,interpolate:Z(n)}));let i=0,r=n[0].value;const a=()=>{for(i<0&&(i=0);i>=t;)i-=t;for(let e=0;e<n.length-1;e++){const t=n[e],a=n[e+1];if(i>=t.time&&i<a.time){const e=t.interpolate((i-t.time)/(a.time-t.time));r=t.value+e*(a.value-t.value)}}};return{reset:()=>{i=0,a()},update:e=>{i+=e,a()},seek:e=>{i=e,a()},get:()=>r}}const ee="time",te="interpolation",ne="pitch",ie=[ee,"yaw",ne,"fov",te],re=Math.PI/180,ae="ease-in-out",se="cubic-bezier(";function oe(e){if("string"==typeof e)return function(e){const[t,...n]=function(e){return e.split(/\r?\n/).map(e=>function(e){const t=e.indexOf("#");return(-1!==t?e.substring(0,t):e).trim()}(e)).filter(e=>""!==e)}(e);if(null==t)throw new Error("Header missing.");const i=function(e){const t=[];for(let n=0;n<e.length;n++){const i=e[n];if(!ie.includes(i))throw new Error(`Invalid token in header: '${i}'.`);if(t.includes(i))throw new Error(`Duplicate token in header: '${i}'.`);t.push(i)}if(!t.includes(ee))throw new Error(`Missing required token: '${ee}'.`);return t}(t.split(/\s+/)),r={};if(n.length<2)throw new Error("Expected at least two key frames.");for(const e of n){const{theta:t,phi:n,fov:a}=le(i,e);null!=t&&(null==r.theta&&(r.theta=[]),r.theta.push(t)),null!=n&&(null==r.phi&&(r.phi=[]),r.phi.push(n)),null!=a&&(null==r.fov&&(r.fov=[]),r.fov.push(a))}if(0===Object.values(r).length)throw new Error("At least one parameter should be animated.");return r}(e);if(Array.isArray(e))return function(e){var t;const n={};if(e.length<2)throw new Error("Expected at least two key frames.");for(const i of e){const{time:e,pitch:r,yaw:a,fov:s}=i;if(null==e)throw new Error("Time missing.");const o=he(null!==(t=i.interpolation)&&void 0!==t?t:ae);null!=a&&(null==n.theta&&(n.theta=[]),n.theta.push({time:e,value:a*re,interpolation:o})),null!=r&&(null==n.phi&&(n.phi=[]),n.phi.push({time:e,value:r*re,interpolation:o})),null!=s&&(null==n.fov&&(n.fov=[]),n.fov.push({time:e,value:s*re,interpolation:o}))}if(0===Object.values(n).length)throw new Error("At least one parameter should be animated.");if(Object.values(n).every(t=>t.length!==e.length))throw new Error("All parameters should have the same key frame count.");return n}(e);throw new Error("Expected string or key frame config array.")}function le(e,t){const n=t.match(/[^()\s]+(\(.*?\))?/g);if(null==n||n.length<e.length)throw new Error(`Missing data for fields: '${e.filter(e=>!(null==n?void 0:n.includes(e))).join(", ")}'.`);if(n.length>e.length)throw new Error(`Excess data: '${n.filter(t=>!e.includes(t)).join(", ")}'.`);const i=e.indexOf(ee),r=function(e){return e.endsWith("ms")?ue(e.substring(0,e.length-2)):e.endsWith("s")?1e3*ue(e.substring(0,e.length-1)):ue(e)}(n[i]),a=e.indexOf(te),s=he(-1===a?ae:n[a]),o={};for(let t=0;t<n.length;t++){if(t===i||t===a)continue;const l=e[t],c=n[t];switch(l){case"yaw":o.theta={time:r,value:ce(c),interpolation:s};break;case ne:o.phi={time:r,value:ce(c),interpolation:s};break;case"fov":o.fov={time:r,value:ce(c),interpolation:s};break;default:throw new Error(`Unhandled value for header '${l}'.`)}}return o}function ce(e){return e.endsWith("deg")?ue(e.substring(0,e.length-3))*re:e.endsWith("rad")?ue(e.substring(0,e.length-3)):ue(e)*re}function he(e){if("hold"===e)return{type:"hold"};if("linear"===e)return Ae(0,0,1,1);if("sine"===e)return Ae(.37,0,.63,1);if("sine-in"===e)return Ae(.12,0,.39,0);if("sine-out"===e)return Ae(.61,1,.88,1);if("ease"===e)return Ae(.25,.1,.25,1);if("ease-in"===e)return Ae(.42,0,1,1);if("ease-out"===e)return Ae(0,0,.58,1);if("ease-in-out"===e)return Ae(.42,0,.58,1);if(e.startsWith(se)&&e.endsWith(")")){const t=e.substring(13,e.length-1).split(/\s*,\s*/);if(4!==t.length)throw new Error(`Expected 4 parameters for the Bezier curve, but got '${t}'.`);return{type:"bezier",x1:ue(t[0]),y1:ue(t[1]),x2:ue(t[2]),y2:ue(t[3])}}throw new Error(`Expected an interpolation token, but found: ${e}`)}function Ae(e,t,n,i){return{type:"bezier",x1:e,y1:t,x2:n,y2:i}}function ue(e){const t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error(`Expected a numeric value, but got: ${e}`);return t}
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ShopAR={})}(this,function(e){"use strict";const t=["AR","3D"];class n extends Error{constructor(e){super(e),this.name="PluginError"}}class i extends n{constructor(e){super(e),this.name="ValidationError"}}class r extends n{constructor(e,t){super(e),this.name="ApiError",this.status=t}}class a extends n{constructor(e){super(e),this.name="SanitizationError"}}class o extends n{constructor(e){super((null==e?void 0:e.trim())||"3D failed to launch."),this.name="Launch3DError"}}class s extends n{constructor(e){super((null==e?void 0:e.trim())||"AR failed to launch."),this.name="LaunchARError"}}class l extends s{constructor(e){super((null==e?void 0:e.trim())||"Camera permission denied."),this.name="CameraPermissionDeniedError"}}class c extends s{constructor(e){super((null==e?void 0:e.trim())||"QR failed."),this.name="QRError"}}function h(e,t,n,i){return new(n||(n=Promise))(function(r,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}l((i=i.apply(e,t||[])).next())})}function A(e){return null!=e&&"object"==typeof e&&"name"in e&&"string"==typeof e.name?e.name:"Unknown"}function u(e){return null!=e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message?e.message:"Unknown error."}"function"==typeof SuppressedError&&SuppressedError;function d(e){if(null!=e&&"object"==typeof e&&"stack"in e&&"string"==typeof e.stack)return e.stack.length>1e3?e.stack.slice(0,1e3):e.stack}function p(e,t){return()=>h(this,void 0,void 0,function*(){try{return yield t()}catch(t){if(t instanceof n)throw t;throw new n(`${e} failed: ${u(t)}`)}})}const f=[Uint8Array,Uint32Array].length-2,g=["addEventListener","alert","atob","blur","btoa","cancelAnimationFrame","localStorage","location","locationbar","hash","hasOwnProperty","host","hostname","href","requestAnimationFrame"],m=[2,12,7,1],v=window[g[m[m[f]]]][g[m[m[m.length-1]]]];function E(){const e=(new TextEncoder).encode(v),t=g.map(e=>e.length);for(let n=0;n<e.length;n++)e[n]^=t[n%t.length];return window[g[t[2]]](String.fromCodePoint(...e))}v.charCodeAt(f);function b(e){return e*(180/Math.PI)}function C(e){return Math.round(100*e)/100}const _=["Glasses","Shoes","Watches","Bracelets","Scarves","Hats","Necklaces"],I=["Shoes"];const x="1.2.0-alpha.1";let y=`https://cdn.jsdelivr.net/npm/shopar-plugin@${x}/dist`;const M=e=>{null!=e&&(y=e.endsWith("/")?e.substring(0,e.length-1):e)},w=()=>y;function S(e,t){return h(this,void 0,void 0,function*(){if("function"!=typeof importScripts){if("function"==typeof window.define&&window.define.amd&&"function"==typeof window.require)return new Promise(n=>{window.require([e],e=>{window[t]=e,n()},()=>{n()})});{const t=document.createElement("script");return t.setAttribute("src",e),t.setAttribute("crossorigin","anonymous"),new Promise(e=>{t.addEventListener("load",()=>e(),!1),t.addEventListener("error",()=>e(),!1),document.body.appendChild(t)})}}importScripts(e.toString())})}let B;function T(e,t){let n=!0;return{qrPaused:()=>n,qrDraw:(i,r)=>h(this,void 0,void 0,function*(){!function(){h(this,void 0,void 0,function*(){null==B&&(B=S(`${w()}/shopar-qr.js`,"ShopAR__QR"))})}(),yield B;const a=`https://ar.shopar.ai/${x.includes("alpha")?"qr-alpha":"qr"}/?${new URLSearchParams({a:i,s:r,h:location.href})}`,o=yield window.ShopAR__QR.toDataURL(a),s=new Promise((e,n)=>{t.onload=e,t.onerror=n});t.src=o,yield s,n=!1,e.style.display=""}),qrPause:()=>h(this,void 0,void 0,function*(){n=!0,e.style.display="none"})}}const R={"loading.ar":"Loading Try On...","prompt.ar.shoes":void 0,"prompt.ar.glasses":void 0,"prompt.ar.watches":void 0,"prompt.ar.bracelets":void 0,"prompt.ar.scarves":void 0,"prompt.ar.hats":void 0,"prompt.ar.necklaces":void 0},D=Object.keys(R);const Q="--shopar";function L(e){return`var(${e.var}, ${e.default})`}const U={padding:{var:`${Q}-btn-padding`,default:"0.5rem 0.75rem"},gap:{var:`${Q}-btn-gap`,default:"0.25rem"},border:{var:`${Q}-btn-border`,default:"1px solid #dddddd"},borderRadius:{var:`${Q}-btn-border-radius`,default:"calc(infinity * 1px)"},bg:{var:`${Q}-btn-bg`,default:"#ffffff"},hoverBg:{var:`${Q}-btn-hover-bg`,default:"#f5f5f5"}};function P(e,t,n){const i=document.createElement("button");i.type="button",i.appendChild(n);{const t=document.createElement("span");t.textContent=e,i.appendChild(t)}i.ariaLabel=t;const r=i.style;r.display="none",r.pointerEvents="auto",r.padding=L(U.padding),r.justifyContent="center",r.alignItems="center",r.gap=L(U.gap),r.backgroundColor=L(U.bg),r.border=L(U.border),r.borderRadius=L(U.borderRadius),r.cursor="pointer";const a=L(U.bg),o=L(U.hoverBg);return i.addEventListener("mouseenter",()=>{r.backgroundColor=o}),i.addEventListener("mouseleave",()=>{r.backgroundColor=a}),i}const N={paddingBottom:{var:`${Q}-btn-container-padding-bottom`,default:"2rem"},gap:{var:`${Q}-btn-container-gap`,default:"0.5rem"}};const F={bg:{var:`${Q}-ar-prompt-bg`,default:"#1e293bb2"},gap:{var:`${Q}-ar-prompt-gap`,default:"1rem"},textColor:{var:`${Q}-ar-prompt-text-color`,default:"white"},imgMaxWidth:{var:`${Q}-ar-prompt-img-max-width`,default:"80%"},imgMaxHeight:{var:`${Q}-ar-prompt-img-max-height`,default:"50%"}};const O={containerDisplay:{var:`${Q}-ar-loading-container-display`,default:"flex"},containerBg:{var:`${Q}-ar-loading-container-bg`,default:"#ffffff"},containerGap:{var:`${Q}-ar-loading-container-gap`,default:"1rem"},barWidth:{var:`${Q}-ar-loading-bar-width`,default:"80%"},barHeight:{var:`${Q}-ar-loading-bar-height`,default:"0.5rem"},barRadius:{var:`${Q}-ar-loading-bar-radius`,default:"calc(infinity * 1px)"},barFg:{var:`${Q}-ar-loading-bar-fg`,default:"linear-gradient(90deg, #773cd8, #5fb9ec)"},barBg:{var:`${Q}-ar-loading-bar-bg`,default:"#e5e7eb"}};const k={bg:{var:`${Q}-qr-bg`,default:"#ffffff"}};function G(e,t,n,i){return new(n||(n=Promise))(function(r,a){function o(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}l((i=i.apply(e,t||[])).next())})}function H(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function z(e,t,n,i,r){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;const V=.1,W="function"==typeof Float32Array;function q(e,t){return 1-3*t+3*e}function j(e,t){return 3*t-6*e}function Y(e){return 3*e}function X(e,t,n){return((q(t,n)*e+j(t,n))*e+Y(t))*e}function K(e,t,n){return 3*q(t,n)*e*e+2*j(t,n)*e+Y(t)}function J(e){return e}function Z(e){if("hold"===e.type)return()=>0;if("bezier"===e.type){const t=function(e,t,n,i){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&n===i)return J;const r=W?new Float32Array(11):new Array(11);for(let t=0;t<11;++t)r[t]=X(t*V,e,n);function a(t){let i=0,a=1;for(;10!==a&&r[a]<=t;++a)i+=V;--a;const o=i+(t-r[a])/(r[a+1]-r[a])*V,s=K(o,e,n);return s>=.001?function(e,t,n,i){for(let r=0;r<4;++r){const r=K(t,n,i);if(0===r)return t;t-=(X(t,n,i)-e)/r}return t}(t,o,e,n):0===s?o:function(e,t,n,i,r){let a,o,s=0;do{o=t+(n-t)/2,a=X(o,i,r)-e,a>0?n=o:t=o}while(Math.abs(a)>1e-7&&++s<10);return o}(t,i,i+V,e,n)}return function(e){return 0===e||1===e?e:X(a(e),t,i)}}(e.x1,e.y1,e.x2,e.y2);return e=>t(e)}throw new Error(`Unknown interpolation: ${e}`)}function $(e){if(e.length<2)throw new Error("Expected at least two key frames.");const t=e[e.length-1].time,n=[...e].sort((e,t)=>e.time-t.time).map(({time:e,value:t,interpolation:n})=>({time:e,value:t,interpolate:Z(n)}));let i=0,r=n[0].value;const a=()=>{for(i<0&&(i=0);i>=t;)i-=t;for(let e=0;e<n.length-1;e++){const t=n[e],a=n[e+1];if(i>=t.time&&i<a.time){const e=t.interpolate((i-t.time)/(a.time-t.time));r=t.value+e*(a.value-t.value)}}};return{reset:()=>{i=0,a()},update:e=>{i+=e,a()},seek:e=>{i=e,a()},get:()=>r}}const ee="time",te="interpolation",ne="pitch",ie=[ee,"yaw",ne,"fov",te],re=Math.PI/180,ae="ease-in-out",oe="cubic-bezier(";function se(e){if("string"==typeof e)return function(e){const[t,...n]=function(e){return e.split(/\r?\n/).map(e=>function(e){const t=e.indexOf("#");return(-1!==t?e.substring(0,t):e).trim()}(e)).filter(e=>""!==e)}(e);if(null==t)throw new Error("Header missing.");const i=function(e){const t=[];for(let n=0;n<e.length;n++){const i=e[n];if(!ie.includes(i))throw new Error(`Invalid token in header: '${i}'.`);if(t.includes(i))throw new Error(`Duplicate token in header: '${i}'.`);t.push(i)}if(!t.includes(ee))throw new Error(`Missing required token: '${ee}'.`);return t}(t.split(/\s+/)),r={};if(n.length<2)throw new Error("Expected at least two key frames.");for(const e of n){const{theta:t,phi:n,fov:a}=le(i,e);null!=t&&(null==r.theta&&(r.theta=[]),r.theta.push(t)),null!=n&&(null==r.phi&&(r.phi=[]),r.phi.push(n)),null!=a&&(null==r.fov&&(r.fov=[]),r.fov.push(a))}if(0===Object.values(r).length)throw new Error("At least one parameter should be animated.");return r}(e);if(Array.isArray(e))return function(e){var t;const n={};if(e.length<2)throw new Error("Expected at least two key frames.");for(const i of e){const{time:e,pitch:r,yaw:a,fov:o}=i;if(null==e)throw new Error("Time missing.");const s=he(null!==(t=i.interpolation)&&void 0!==t?t:ae);null!=a&&(null==n.theta&&(n.theta=[]),n.theta.push({time:e,value:a*re,interpolation:s})),null!=r&&(null==n.phi&&(n.phi=[]),n.phi.push({time:e,value:r*re,interpolation:s})),null!=o&&(null==n.fov&&(n.fov=[]),n.fov.push({time:e,value:o*re,interpolation:s}))}if(0===Object.values(n).length)throw new Error("At least one parameter should be animated.");if(Object.values(n).every(t=>t.length!==e.length))throw new Error("All parameters should have the same key frame count.");return n}(e);throw new Error("Expected string or key frame config array.")}function le(e,t){const n=t.match(/[^()\s]+(\(.*?\))?/g);if(null==n||n.length<e.length)throw new Error(`Missing data for fields: '${e.filter(e=>!(null==n?void 0:n.includes(e))).join(", ")}'.`);if(n.length>e.length)throw new Error(`Excess data: '${n.filter(t=>!e.includes(t)).join(", ")}'.`);const i=e.indexOf(ee),r=function(e){return e.endsWith("ms")?ue(e.substring(0,e.length-2)):e.endsWith("s")?1e3*ue(e.substring(0,e.length-1)):ue(e)}(n[i]),a=e.indexOf(te),o=he(-1===a?ae:n[a]),s={};for(let t=0;t<n.length;t++){if(t===i||t===a)continue;const l=e[t],c=n[t];switch(l){case"yaw":s.theta={time:r,value:ce(c),interpolation:o};break;case ne:s.phi={time:r,value:ce(c),interpolation:o};break;case"fov":s.fov={time:r,value:ce(c),interpolation:o};break;default:throw new Error(`Unhandled value for header '${l}'.`)}}return s}function ce(e){return e.endsWith("deg")?ue(e.substring(0,e.length-3))*re:e.endsWith("rad")?ue(e.substring(0,e.length-3)):ue(e)*re}function he(e){if("hold"===e)return{type:"hold"};if("linear"===e)return Ae(0,0,1,1);if("sine"===e)return Ae(.37,0,.63,1);if("sine-in"===e)return Ae(.12,0,.39,0);if("sine-out"===e)return Ae(.61,1,.88,1);if("ease"===e)return Ae(.25,.1,.25,1);if("ease-in"===e)return Ae(.42,0,1,1);if("ease-out"===e)return Ae(0,0,.58,1);if("ease-in-out"===e)return Ae(.42,0,.58,1);if(e.startsWith(oe)&&e.endsWith(")")){const t=e.substring(13,e.length-1).split(/\s*,\s*/);if(4!==t.length)throw new Error(`Expected 4 parameters for the Bezier curve, but got '${t}'.`);return{type:"bezier",x1:ue(t[0]),y1:ue(t[1]),x2:ue(t[2]),y2:ue(t[3])}}throw new Error(`Expected an interpolation token, but found: ${e}`)}function Ae(e,t,n,i){return{type:"bezier",x1:e,y1:t,x2:n,y2:i}}function ue(e){const t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error(`Expected a numeric value, but got: ${e}`);return t}
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2010-2024 Three.js Authors
5
5
  * SPDX-License-Identifier: MIT
6
- */const de="166dev",pe=0,fe=1,ge=2,me=100,ve=101,Ee=102,be=200,Ce=201,_e=202,Ie=203,xe=204,ye=205,we=206,Me=207,Se=208,Be=209,Te=210,Re=211,De=212,Qe=213,Ue=214,Le="attached",Pe=301,Ne=302,Fe=303,Oe=306,ke=1e3,Ge=1001,He=1002,ze=1003,Ve=1004,We=1005,qe=1006,je=1007,Ye=1008,Xe=1009,Ke=1012,Je=1014,Ze=1015,$e=1016,et=1020,tt=1023,nt=1026,it=1027,rt=1028,at=1030,st=33776,ot=33777,lt=33778,ct=33779,ht=35840,At=35842,ut=36196,dt=37492,pt=37496,ft=37808,gt=37812,mt=36492,vt=2300,Et=2301,bt=2302,Ct="",_t="srgb",It="srgb-linear",xt="display-p3",yt="display-p3-linear",wt="linear",Mt="srgb",St="rec709",Bt="p3",Tt=7680,Rt=512,Dt=513,Qt=514,Ut=515,Lt=516,Pt=517,Nt=518,Ft=519,Ot=35044,kt="300 es",Gt=2e3,Ht=2001;class zt{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,i=n.length;t<i;t++)n[t].call(this,e);e.target=null}}}const Vt=["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"];const Wt=Math.PI/180,qt=180/Math.PI;function jt(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(Vt[255&e]+Vt[e>>8&255]+Vt[e>>16&255]+Vt[e>>24&255]+"-"+Vt[255&t]+Vt[t>>8&255]+"-"+Vt[t>>16&15|64]+Vt[t>>24&255]+"-"+Vt[63&n|128]+Vt[n>>8&255]+"-"+Vt[n>>16&255]+Vt[n>>24&255]+Vt[255&i]+Vt[i>>8&255]+Vt[i>>16&255]+Vt[i>>24&255]).toLowerCase()}function Yt(e,t,n){return Math.max(t,Math.min(n,e))}function Xt(e,t){return(e%t+t)%t}function Kt(e,t,n){return(1-n)*e+n*t}function Jt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function Zt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}const $t=Wt,en=qt,tn=function(e){return e*qt};class nn{constructor(e=0,t=0){nn.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 new 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 new 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){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Yt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,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){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class rn{constructor(e,t,n,i,r,a,s,o,l){rn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,s,o,l)}set(e,t,n,i,r,a,s,o,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=s,c[3]=t,c[4]=r,c[5]=o,c[6]=n,c[7]=a,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const 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){const n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],c=n[4],h=n[7],A=n[2],u=n[5],d=n[8],p=i[0],f=i[3],g=i[6],m=i[1],v=i[4],E=i[7],b=i[2],C=i[5],_=i[8];return r[0]=a*p+s*m+o*b,r[3]=a*f+s*v+o*C,r[6]=a*g+s*E+o*_,r[1]=l*p+c*m+h*b,r[4]=l*f+c*v+h*C,r[7]=l*g+c*E+h*_,r[2]=A*p+u*m+d*b,r[5]=A*f+u*v+d*C,r[8]=A*g+u*E+d*_,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],c=e[8];return t*a*c-t*s*l-n*r*c+n*s*o+i*r*l-i*a*o}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],c=e[8],h=c*a-s*l,A=s*o-c*r,u=l*r-a*o,d=t*h+n*A+i*u;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const p=1/d;return e[0]=h*p,e[1]=(i*l-c*n)*p,e[2]=(s*n-i*a)*p,e[3]=A*p,e[4]=(c*t-i*o)*p,e[5]=(i*r-s*t)*p,e[6]=u*p,e[7]=(n*o-l*t)*p,e[8]=(a*t-n*r)*p,this}transpose(){let e;const 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){const 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,n,i,r,a,s){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*a+l*s)+a+e,-i*l,i*o,-i*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(an.makeScale(e,t)),this}rotate(e){return this.premultiply(an.makeRotation(-e)),this}translate(e,t){return this.premultiply(an.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){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}const an=new rn;function sn(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function on(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function ln(){const e=on("canvas");return e.style.display="block",e}const cn={};function hn(e){e in cn||(cn[e]=!0,console.warn(e))}const An=(new rn).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),un=(new rn).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),dn={[It]:{transfer:wt,primaries:St,toReference:e=>e,fromReference:e=>e},[_t]:{transfer:Mt,primaries:St,toReference:e=>e.convertSRGBToLinear(),fromReference:e=>e.convertLinearToSRGB()},[yt]:{transfer:wt,primaries:Bt,toReference:e=>e.applyMatrix3(un),fromReference:e=>e.applyMatrix3(An)},[xt]:{transfer:Mt,primaries:Bt,toReference:e=>e.convertSRGBToLinear().applyMatrix3(un),fromReference:e=>e.applyMatrix3(An).convertLinearToSRGB()}},pn=new Set([It,yt]),fn={enabled:!0,_workingColorSpace:It,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(e){if(!pn.has(e))throw new Error(`Unsupported working color space, "${e}".`);this._workingColorSpace=e},convert:function(e,t,n){if(!1===this.enabled||t===n||!t||!n)return e;const i=dn[t].toReference;return(0,dn[n].fromReference)(i(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this._workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this._workingColorSpace)},getPrimaries:function(e){return dn[e].primaries},getTransfer:function(e){return e===Ct?wt:dn[e].transfer}};function gn(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function mn(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let vn;class En{static getDataURL(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===vn&&(vn=on("canvas")),vn.width=e.width,vn.height=e.height;const n=vn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=vn}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=on("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e<r.length;e++)r[e]=255*gn(r[e]/255);return n.putImageData(i,0,0),t}if(e.data){const t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*gn(t[e]/255)):t[e]=gn(t[e]);return{data:t,width:e.width,height:e.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let bn=0;class Cn{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:bn++}),this.uuid=jt(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){!0===e&&this.version++}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t<n;t++)i[t].isDataTexture?e.push(_n(i[t].image)):e.push(_n(i[t]))}else e=_n(i);n.url=e}return t||(e.images[this.uuid]=n),n}}function _n(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?En.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let In=0;class xn extends zt{constructor(e=xn.DEFAULT_IMAGE,t=xn.DEFAULT_MAPPING,n=Ge,i=Ge,r=qe,a=1008,s=1023,o=1009,l=xn.DEFAULT_ANISOTROPY,c=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:In++}),this.uuid=jt(),this.name="",this.source=new Cn(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new nn(0,0),this.repeat=new nn(1,1),this.center=new nn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new rn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}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)}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.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const n={metadata:{version:4.6,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&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}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 ke:e.x=e.x-Math.floor(e.x);break;case Ge:e.x=e.x<0?0:1;break;case He: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 ke:e.y=e.y-Math.floor(e.y);break;case Ge:e.y=e.y<0?0:1;break;case He: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++}}xn.DEFAULT_IMAGE=null,xn.DEFAULT_MAPPING=300,xn.DEFAULT_ANISOTROPY=1;class yn{constructor(e=0,t=0,n=0,i=1){yn.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}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,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,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 new 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 new 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){const t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const 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,n,i,r;const a=.01,s=.1,o=e.elements,l=o[0],c=o[4],h=o[8],A=o[1],u=o[5],d=o[9],p=o[2],f=o[6],g=o[10];if(Math.abs(c-A)<a&&Math.abs(h-p)<a&&Math.abs(d-f)<a){if(Math.abs(c+A)<s&&Math.abs(h+p)<s&&Math.abs(d+f)<s&&Math.abs(l+u+g-3)<s)return this.set(1,0,0,0),this;t=Math.PI;const e=(l+1)/2,o=(u+1)/2,m=(g+1)/2,v=(c+A)/4,E=(h+p)/4,b=(d+f)/4;return e>o&&e>m?e<a?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(e),i=v/n,r=E/n):o>m?o<a?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(o),n=v/i,r=b/i):m<a?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(m),n=E/r,i=b/r),this.set(n,i,r,t),this}let m=Math.sqrt((f-d)*(f-d)+(h-p)*(h-p)+(A-c)*(A-c));return Math.abs(m)<.001&&(m=1),this.x=(f-d)/m,this.y=(h-p)/m,this.z=(A-c)/m,this.w=Math.acos((l+u+g-1)/2),this}setFromMatrixPosition(e){const 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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,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 wn extends zt{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new yn(0,0,e,t),this.scissorTest=!1,this.viewport=new yn(0,0,e,t);const i={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:qe,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const r=new xn(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let e=0;e<a;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n;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,n=e.textures.length;t<n;t++)this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Cn(t),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 Mn extends wn{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Sn extends xn{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=ze,this.minFilter=ze,this.wrapR=Ge,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Bn extends xn{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=ze,this.minFilter=ze,this.wrapR=Ge,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Tn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,a,s){let o=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3];const A=r[a+0],u=r[a+1],d=r[a+2],p=r[a+3];if(0===s)return e[t+0]=o,e[t+1]=l,e[t+2]=c,void(e[t+3]=h);if(1===s)return e[t+0]=A,e[t+1]=u,e[t+2]=d,void(e[t+3]=p);if(h!==p||o!==A||l!==u||c!==d){let e=1-s;const t=o*A+l*u+c*d+h*p,n=t>=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const r=Math.sqrt(i),a=Math.atan2(r,t*n);e=Math.sin(e*a)/r,s=Math.sin(s*a)/r}const r=s*n;if(o=o*e+A*r,l=l*e+u*r,c=c*e+d*r,h=h*e+p*r,e===1-s){const e=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=e,l*=e,c*=e,h*=e}}e[t]=o,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,r,a){const s=n[i],o=n[i+1],l=n[i+2],c=n[i+3],h=r[a],A=r[a+1],u=r[a+2],d=r[a+3];return e[t]=s*d+c*h+o*u-l*A,e[t+1]=o*d+c*A+l*h-s*u,e[t+2]=l*d+c*u+s*A-o*h,e[t+3]=c*d-s*h-o*A-l*u,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,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,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){const n=e._x,i=e._y,r=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(n/2),c=s(i/2),h=s(r/2),A=o(n/2),u=o(i/2),d=o(r/2);switch(a){case"XYZ":this._x=A*c*h+l*u*d,this._y=l*u*h-A*c*d,this._z=l*c*d+A*u*h,this._w=l*c*h-A*u*d;break;case"YXZ":this._x=A*c*h+l*u*d,this._y=l*u*h-A*c*d,this._z=l*c*d-A*u*h,this._w=l*c*h+A*u*d;break;case"ZXY":this._x=A*c*h-l*u*d,this._y=l*u*h+A*c*d,this._z=l*c*d+A*u*h,this._w=l*c*h-A*u*d;break;case"ZYX":this._x=A*c*h-l*u*d,this._y=l*u*h+A*c*d,this._z=l*c*d-A*u*h,this._w=l*c*h+A*u*d;break;case"YZX":this._x=A*c*h+l*u*d,this._y=l*u*h+A*c*d,this._z=l*c*d-A*u*h,this._w=l*c*h-A*u*d;break;case"XZY":this._x=A*c*h-l*u*d,this._y=l*u*h-A*c*d,this._z=l*c*d+A*u*h,this._w=l*c*h+A*u*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],s=t[5],o=t[9],l=t[2],c=t[6],h=t[10],A=n+s+h;if(A>0){const e=.5/Math.sqrt(A+1);this._w=.25/e,this._x=(c-o)*e,this._y=(r-l)*e,this._z=(a-i)*e}else if(n>s&&n>h){const e=2*Math.sqrt(1+n-s-h);this._w=(c-o)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(r+l)/e}else if(s>h){const e=2*Math.sqrt(1+s-n-h);this._w=(r-l)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(o+c)/e}else{const e=2*Math.sqrt(1+h-n-s);this._w=(a-i)/e,this._x=(r+l)/e,this._y=(o+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(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=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Yt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),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){const n=e._x,i=e._y,r=e._z,a=e._w,s=t._x,o=t._y,l=t._z,c=t._w;return this._x=n*c+a*s+i*l-r*o,this._y=i*c+a*o+r*s-n*l,this._z=r*c+a*l+n*o-i*s,this._w=a*c-n*s-i*o-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,r=this._z,a=this._w;let s=a*e._w+n*e._x+i*e._y+r*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;const o=1-s*s;if(o<=Number.EPSILON){const e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this}const l=Math.sqrt(o),c=Math.atan2(l,s),h=Math.sin((1-t)*c)/l,A=Math.sin(t*c)/l;return this._w=a*h+this._w*A,this._x=n*h+this._x*A,this._y=i*h+this._y*A,this._z=r*h+this._z*A,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*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 Rn{constructor(e=0,t=0,n=0){Rn.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,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 new 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 new 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(Qn.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Qn.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*i-s*n),c=2*(s*t-r*i),h=2*(r*n-a*t);return this.x=t+o*l+a*h-s*c,this.y=n+o*c+s*l-r*h,this.z=i+o*h+r*c-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){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,a=t.x,s=t.y,o=t.z;return this.x=i*o-r*s,this.y=r*a-n*o,this.z=n*s-i*a,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Dn.copy(this).projectOnVector(e),this.sub(Dn)}reflect(e){return this.sub(Dn.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Yt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}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,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,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(){const e=Math.random()*Math.PI*2,t=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Dn=new Rn,Qn=new Tn;class Un{constructor(e=new Rn(1/0,1/0,1/0),t=new Rn(-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,n=e.length;t<n;t+=3)this.expandByPoint(Pn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Pn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Pn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),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=1/0,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);const n=e.geometry;if(void 0!==n){const i=n.getAttribute("position");if(!0===t&&void 0!==i&&!0!==e.isInstancedMesh)for(let t=0,n=i.count;t<n;t++)!0===e.isMesh?e.getVertexPosition(t,Pn):Pn.fromBufferAttribute(i,t),Pn.applyMatrix4(e.matrixWorld),this.expandByPoint(Pn);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),Nn.copy(e.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),Nn.copy(n.boundingBox)),Nn.applyMatrix4(e.matrixWorld),this.union(Nn)}const i=e.children;for(let e=0,n=i.length;e<n;e++)this.expandByObject(i[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,Pn),Pn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Vn),Wn.subVectors(this.max,Vn),Fn.subVectors(e.a,Vn),On.subVectors(e.b,Vn),kn.subVectors(e.c,Vn),Gn.subVectors(On,Fn),Hn.subVectors(kn,On),zn.subVectors(Fn,kn);let t=[0,-Gn.z,Gn.y,0,-Hn.z,Hn.y,0,-zn.z,zn.y,Gn.z,0,-Gn.x,Hn.z,0,-Hn.x,zn.z,0,-zn.x,-Gn.y,Gn.x,0,-Hn.y,Hn.x,0,-zn.y,zn.x,0];return!!Yn(t,Fn,On,kn,Wn)&&(t=[1,0,0,0,1,0,0,0,1],!!Yn(t,Fn,On,kn,Wn)&&(qn.crossVectors(Gn,Hn),t=[qn.x,qn.y,qn.z],Yn(t,Fn,On,kn,Wn)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Pn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(Pn).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()||(Ln[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ln[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ln[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ln[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ln[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ln[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ln[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ln[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ln)),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)}}const Ln=[new Rn,new Rn,new Rn,new Rn,new Rn,new Rn,new Rn,new Rn],Pn=new Rn,Nn=new Un,Fn=new Rn,On=new Rn,kn=new Rn,Gn=new Rn,Hn=new Rn,zn=new Rn,Vn=new Rn,Wn=new Rn,qn=new Rn,jn=new Rn;function Yn(e,t,n,i,r){for(let a=0,s=e.length-3;a<=s;a+=3){jn.fromArray(e,a);const s=r.x*Math.abs(jn.x)+r.y*Math.abs(jn.y)+r.z*Math.abs(jn.z),o=t.dot(jn),l=n.dot(jn),c=i.dot(jn);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>s)return!1}return!0}const Xn=new Un,Kn=new Rn,Jn=new Rn;class Zn{constructor(e=new Rn,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){const n=this.center;void 0!==t?n.copy(t):Xn.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;t<r;t++)i=Math.max(i,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(i),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){const 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){const n=this.center.distanceToSquared(e);return t.copy(e),n>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):(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;Kn.subVectors(e,this.center);const t=Kn.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.addScaledVector(Kn,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(Jn.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Kn.copy(e.center).add(Jn)),this.expandByPoint(Kn.copy(e.center).sub(Jn))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const $n=new Rn,ei=new Rn,ti=new Rn,ni=new Rn,ii=new Rn,ri=new Rn,ai=new Rn;class si{constructor(e=new Rn,t=new Rn(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,$n)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=$n.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):($n.copy(this.origin).addScaledVector(this.direction,t),$n.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){ei.copy(e).add(t).multiplyScalar(.5),ti.copy(t).sub(e).normalize(),ni.copy(this.origin).sub(ei);const r=.5*e.distanceTo(t),a=-this.direction.dot(ti),s=ni.dot(this.direction),o=-ni.dot(ti),l=ni.lengthSq(),c=Math.abs(1-a*a);let h,A,u,d;if(c>0)if(h=a*o-s,A=a*s-o,d=r*c,h>=0)if(A>=-d)if(A<=d){const e=1/c;h*=e,A*=e,u=h*(h+a*A+2*s)+A*(a*h+A+2*o)+l}else A=r,h=Math.max(0,-(a*A+s)),u=-h*h+A*(A+2*o)+l;else A=-r,h=Math.max(0,-(a*A+s)),u=-h*h+A*(A+2*o)+l;else A<=-d?(h=Math.max(0,-(-a*r+s)),A=h>0?-r:Math.min(Math.max(-r,-o),r),u=-h*h+A*(A+2*o)+l):A<=d?(h=0,A=Math.min(Math.max(-r,-o),r),u=A*(A+2*o)+l):(h=Math.max(0,-(a*r+s)),A=h>0?r:Math.min(Math.max(-r,-o),r),u=-h*h+A*(A+2*o)+l);else A=a>0?-r:r,h=Math.max(0,-(a*A+s)),u=-h*h+A*(A+2*o)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(ei).addScaledVector(ti,A),u}intersectSphere(e,t){$n.subVectors(e.center,this.origin);const n=$n.dot(this.direction),i=$n.dot($n)-n*n,r=e.radius*e.radius;if(i>r)return null;const a=Math.sqrt(r-i),s=n-a,o=n+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,a,s,o;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,A=this.origin;return l>=0?(n=(e.min.x-A.x)*l,i=(e.max.x-A.x)*l):(n=(e.max.x-A.x)*l,i=(e.min.x-A.x)*l),c>=0?(r=(e.min.y-A.y)*c,a=(e.max.y-A.y)*c):(r=(e.max.y-A.y)*c,a=(e.min.y-A.y)*c),n>a||r>i?null:((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),h>=0?(s=(e.min.z-A.z)*h,o=(e.max.z-A.z)*h):(s=(e.max.z-A.z)*h,o=(e.min.z-A.z)*h),n>o||s>i?null:((s>n||n!=n)&&(n=s),(o<i||i!=i)&&(i=o),i<0?null:this.at(n>=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,$n)}intersectTriangle(e,t,n,i,r){ii.subVectors(t,e),ri.subVectors(n,e),ai.crossVectors(ii,ri);let a,s=this.direction.dot(ai);if(s>0){if(i)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}ni.subVectors(this.origin,e);const o=a*this.direction.dot(ri.crossVectors(ni,ri));if(o<0)return null;const l=a*this.direction.dot(ii.cross(ni));if(l<0)return null;if(o+l>s)return null;const c=-a*ni.dot(ai);return c<0?null:this.at(c/s,r)}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 oi{constructor(e,t,n,i,r,a,s,o,l,c,h,A,u,d,p,f){oi.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,n,i,r,a,s,o,l,c,h,A,u,d,p,f)}set(e,t,n,i,r,a,s,o,l,c,h,A,u,d,p,f){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=c,g[10]=h,g[14]=A,g[3]=u,g[7]=d,g[11]=p,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 oi).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const 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,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/li.setFromMatrixColumn(e,0).length(),r=1/li.setFromMatrixColumn(e,1).length(),a=1/li.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),s=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){const e=a*c,n=a*h,i=s*c,r=s*h;t[0]=o*c,t[4]=-o*h,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-s*o,t[2]=r-e*l,t[6]=i+n*l,t[10]=a*o}else if("YXZ"===e.order){const e=o*c,n=o*h,i=l*c,r=l*h;t[0]=e+r*s,t[4]=i*s-n,t[8]=a*l,t[1]=a*h,t[5]=a*c,t[9]=-s,t[2]=n*s-i,t[6]=r+e*s,t[10]=a*o}else if("ZXY"===e.order){const e=o*c,n=o*h,i=l*c,r=l*h;t[0]=e-r*s,t[4]=-a*h,t[8]=i+n*s,t[1]=n+i*s,t[5]=a*c,t[9]=r-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){const e=a*c,n=a*h,i=s*c,r=s*h;t[0]=o*c,t[4]=i*l-n,t[8]=e*l+r,t[1]=o*h,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){const e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*c,t[4]=r-e*h,t[8]=i*h+n,t[1]=h,t[5]=a*c,t[9]=-s*c,t[2]=-l*c,t[6]=n*h+i,t[10]=e-r*h}else if("XZY"===e.order){const e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*c,t[4]=-h,t[8]=l*c,t[1]=e*h+r,t[5]=a*c,t[9]=n*h-i,t[2]=i*h-n,t[6]=s*c,t[10]=r*h+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(hi,e,Ai)}lookAt(e,t,n){const i=this.elements;return pi.subVectors(e,t),0===pi.lengthSq()&&(pi.z=1),pi.normalize(),ui.crossVectors(n,pi),0===ui.lengthSq()&&(1===Math.abs(n.z)?pi.x+=1e-4:pi.z+=1e-4,pi.normalize(),ui.crossVectors(n,pi)),ui.normalize(),di.crossVectors(pi,ui),i[0]=ui.x,i[4]=di.x,i[8]=pi.x,i[1]=ui.y,i[5]=di.y,i[9]=pi.y,i[2]=ui.z,i[6]=di.z,i[10]=pi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],c=n[1],h=n[5],A=n[9],u=n[13],d=n[2],p=n[6],f=n[10],g=n[14],m=n[3],v=n[7],E=n[11],b=n[15],C=i[0],_=i[4],I=i[8],x=i[12],y=i[1],w=i[5],M=i[9],S=i[13],B=i[2],T=i[6],R=i[10],D=i[14],Q=i[3],U=i[7],L=i[11],P=i[15];return r[0]=a*C+s*y+o*B+l*Q,r[4]=a*_+s*w+o*T+l*U,r[8]=a*I+s*M+o*R+l*L,r[12]=a*x+s*S+o*D+l*P,r[1]=c*C+h*y+A*B+u*Q,r[5]=c*_+h*w+A*T+u*U,r[9]=c*I+h*M+A*R+u*L,r[13]=c*x+h*S+A*D+u*P,r[2]=d*C+p*y+f*B+g*Q,r[6]=d*_+p*w+f*T+g*U,r[10]=d*I+p*M+f*R+g*L,r[14]=d*x+p*S+f*D+g*P,r[3]=m*C+v*y+E*B+b*Q,r[7]=m*_+v*w+E*T+b*U,r[11]=m*I+v*M+E*R+b*L,r[15]=m*x+v*S+E*D+b*P,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],s=e[5],o=e[9],l=e[13],c=e[2],h=e[6],A=e[10],u=e[14];return e[3]*(+r*o*h-i*l*h-r*s*A+n*l*A+i*s*u-n*o*u)+e[7]*(+t*o*u-t*l*A+r*a*A-i*a*u+i*l*c-r*o*c)+e[11]*(+t*l*h-t*s*u-r*a*h+n*a*u+r*s*c-n*l*c)+e[15]*(-i*s*c-t*o*h+t*s*A+i*a*h-n*a*A+n*o*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],c=e[8],h=e[9],A=e[10],u=e[11],d=e[12],p=e[13],f=e[14],g=e[15],m=h*f*l-p*A*l+p*o*u-s*f*u-h*o*g+s*A*g,v=d*A*l-c*f*l-d*o*u+a*f*u+c*o*g-a*A*g,E=c*p*l-d*h*l+d*s*u-a*p*u-c*s*g+a*h*g,b=d*h*o-c*p*o-d*s*A+a*p*A+c*s*f-a*h*f,C=t*m+n*v+i*E+r*b;if(0===C)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const _=1/C;return e[0]=m*_,e[1]=(p*A*r-h*f*r-p*i*u+n*f*u+h*i*g-n*A*g)*_,e[2]=(s*f*r-p*o*r+p*i*l-n*f*l-s*i*g+n*o*g)*_,e[3]=(h*o*r-s*A*r-h*i*l+n*A*l+s*i*u-n*o*u)*_,e[4]=v*_,e[5]=(c*f*r-d*A*r+d*i*u-t*f*u-c*i*g+t*A*g)*_,e[6]=(d*o*r-a*f*r-d*i*l+t*f*l+a*i*g-t*o*g)*_,e[7]=(a*A*r-c*o*r+c*i*l-t*A*l-a*i*u+t*o*u)*_,e[8]=E*_,e[9]=(d*h*r-c*p*r-d*n*u+t*p*u+c*n*g-t*h*g)*_,e[10]=(a*p*r-d*s*r+d*n*l-t*p*l-a*n*g+t*s*g)*_,e[11]=(c*s*r-a*h*r-c*n*l+t*h*l+a*n*u-t*s*u)*_,e[12]=b*_,e[13]=(c*p*i-d*h*i+d*n*A-t*p*A-c*n*f+t*h*f)*_,e[14]=(d*s*i-a*p*i-d*n*o+t*p*o+a*n*f-t*s*f)*_,e[15]=(a*h*i-c*s*i+c*n*o-t*h*o-a*n*A+t*s*A)*_,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){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,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,s=e.y,o=e.z,l=r*a,c=r*s;return this.set(l*a+n,l*s-i*o,l*o+i*s,0,l*s+i*o,c*s+n,c*o-i*a,0,l*o-i*s,c*o+i*a,r*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,a=t._y,s=t._z,o=t._w,l=r+r,c=a+a,h=s+s,A=r*l,u=r*c,d=r*h,p=a*c,f=a*h,g=s*h,m=o*l,v=o*c,E=o*h,b=n.x,C=n.y,_=n.z;return i[0]=(1-(p+g))*b,i[1]=(u+E)*b,i[2]=(d-v)*b,i[3]=0,i[4]=(u-E)*C,i[5]=(1-(A+g))*C,i[6]=(f+m)*C,i[7]=0,i[8]=(d+v)*_,i[9]=(f-m)*_,i[10]=(1-(A+p))*_,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=li.set(i[0],i[1],i[2]).length();const a=li.set(i[4],i[5],i[6]).length(),s=li.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],ci.copy(this);const o=1/r,l=1/a,c=1/s;return ci.elements[0]*=o,ci.elements[1]*=o,ci.elements[2]*=o,ci.elements[4]*=l,ci.elements[5]*=l,ci.elements[6]*=l,ci.elements[8]*=c,ci.elements[9]*=c,ci.elements[10]*=c,t.setFromRotationMatrix(ci),n.x=r,n.y=a,n.z=s,this}makePerspective(e,t,n,i,r,a,s=2e3){const o=this.elements,l=2*r/(t-e),c=2*r/(n-i),h=(t+e)/(t-e),A=(n+i)/(n-i);let u,d;if(s===Gt)u=-(a+r)/(a-r),d=-2*a*r/(a-r);else{if(s!==Ht)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);u=-a/(a-r),d=-a*r/(a-r)}return o[0]=l,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=A,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,n,i,r,a,s=2e3){const o=this.elements,l=1/(t-e),c=1/(n-i),h=1/(a-r),A=(t+e)*l,u=(n+i)*c;let d,p;if(s===Gt)d=(a+r)*h,p=-2*h;else{if(s!==Ht)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);d=r*h,p=-1*h}return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-A,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=p,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const li=new Rn,ci=new oi,hi=new Rn(0,0,0),Ai=new Rn(1,1,1),ui=new Rn,di=new Rn,pi=new Rn,fi=new oi,gi=new Tn;class mi{constructor(e=0,t=0,n=0,i=mi.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}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,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,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,n=!0){const i=e.elements,r=i[0],a=i[4],s=i[8],o=i[1],l=i[5],c=i[9],h=i[2],A=i[6],u=i[10];switch(t){case"XYZ":this._y=Math.asin(Yt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,u),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(A,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Yt(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(s,u),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Yt(A,-1,1)),Math.abs(A)<.9999999?(this._y=Math.atan2(-h,u),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-Yt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(A,u),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Yt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(s,u));break;case"XZY":this._z=Math.asin(-Yt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(A,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-c,u),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return fi.makeRotationFromQuaternion(e),this.setFromRotationMatrix(fi,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return gi.setFromEuler(this),this.setFromQuaternion(gi,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}}mi.DEFAULT_ORDER="XYZ";class vi{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)}isEnabled(e){return!!(this.mask&1<<e)}}let Ei=0;const bi=new Rn,Ci=new Tn,_i=new oi,Ii=new Rn,xi=new Rn,yi=new Rn,wi=new Tn,Mi=new Rn(1,0,0),Si=new Rn(0,1,0),Bi=new Rn(0,0,1),Ti={type:"added"},Ri={type:"removed"},Di={type:"childadded",child:null},Qi={type:"childremoved",child:null};class Ui extends zt{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ei++}),this.uuid=jt(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ui.DEFAULT_UP.clone();const e=new Rn,t=new mi,n=new Tn,i=new Rn(1,1,1);t._onChange(function(){n.setFromEuler(t,!1)}),n._onChange(function(){t.setFromQuaternion(n,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:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new oi},normalMatrix:{value:new rn}}),this.matrix=new oi,this.matrixWorld=new oi,this.matrixWorldInv=new oi,this.offsetMatrix=(new oi).identity(),this.offsetMatrixInv=(new oi).identity(),this.center=new Rn,this.centerOffset=new Rn,this.modelOffsetMatrix=(new oi).identity(),this.modelOffsetMatrixInv=(new oi).identity(),this.matrixAutoUpdate=Ui.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Ui.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new vi,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],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 Ci.setFromAxisAngle(e,t),this.quaternion.multiply(Ci),this}rotateOnWorldAxis(e,t){return Ci.setFromAxisAngle(e,t),this.quaternion.premultiply(Ci),this}rotateX(e){return this.rotateOnAxis(Mi,e)}rotateY(e){return this.rotateOnAxis(Si,e)}rotateZ(e){return this.rotateOnAxis(Bi,e)}translateOnAxis(e,t){return bi.copy(e).applyQuaternion(this.quaternion),this.position.add(bi.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Mi,e)}translateY(e){return this.translateOnAxis(Si,e)}translateZ(e){return this.translateOnAxis(Bi,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(_i.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Ii.copy(e):Ii.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),xi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?_i.lookAt(xi,Ii,this.up):_i.lookAt(Ii,xi,this.up),this.quaternion.setFromRotationMatrix(_i),i&&(_i.extractRotation(i.matrixWorld),Ci.setFromRotationMatrix(_i),this.quaternion.premultiply(Ci.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Ti),Di.child=e,this.dispatchEvent(Di),Di.child=null):console.error("THREE.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}const t=this.children.indexOf(e);return-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Ri),Qi.child=e,this.dispatchEvent(Qi),Qi.child=null),this}removeFromParent(){const e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),_i.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),_i.multiply(e.parent.matrixWorld)),e.applyMatrix4(_i),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Ti),Di.child=e,this.dispatchEvent(Di),Di.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 n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xi,e,yi),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xi,wi,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const 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.matrixWorldInv.copy(this.matrixWorld).invert()):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldInv.copy(this.matrixWorld).invert())),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?(this.matrixWorld.copy(this.matrix),this.matrixWorldInv.copy(this.matrixWorld).invert()):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldInv.copy(this.matrixWorld).invert())),this.modelOffsetMatrix.copy(this.matrixWorld).multiply(this.offsetMatrix),this.modelOffsetMatrixInv.copy(this.modelOffsetMatrix).invert(),!0===t){const e=this.children;for(let t=0,n=e.length;t<n;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){const t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(e=>({boxInitialized:e.boxInitialized,boxMin:e.box.min.toArray(),boxMax:e.box.max.toArray(),sphereInitialized:e.sphereInitialized,sphereRadius:e.sphere.radius,sphereCenter:e.sphere.center.toArray()})),i.maxGeometryCount=this._maxGeometryCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const n=t.shapes;if(Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const i=n[t];r(e.shapes,i)}else r(e.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let n=0,i=this.material.length;n<i;n++)t.push(r(e.materials,this.material[n]));i.material=t}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let t=0;t<this.children.length;t++)i.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let t=0;t<this.animations.length;t++){const n=this.animations[t];i.animations.push(r(e.animations,n))}}if(t){const t=a(e.geometries),i=a(e.materials),r=a(e.textures),s=a(e.images),o=a(e.shapes),l=a(e.skeletons),c=a(e.animations),h=a(e.nodes);t.length>0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function a(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}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.matrixWorldInv.copy(e.matrixWorldInv),this.offsetMatrix.copy(e.offsetMatrix),this.offsetMatrixInv.copy(e.offsetMatrixInv),this.center.copy(e.center),this.centerOffset.copy(e.centerOffset),this.modelOffsetMatrix.copy(e.modelOffsetMatrix),this.modelOffsetMatrixInv.copy(e.modelOffsetMatrixInv),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++){const n=e.children[t];this.add(n.clone())}return this}}Ui.DEFAULT_UP=new Rn(0,1,0),Ui.DEFAULT_MATRIX_AUTO_UPDATE=!0,Ui.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Li=new Rn,Pi=new Rn,Ni=new Rn,Fi=new Rn,Oi=new Rn,ki=new Rn,Gi=new Rn,Hi=new Rn,zi=new Rn,Vi=new Rn;class Wi{constructor(e=new Rn,t=new Rn,n=new Rn){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Li.subVectors(e,t),i.cross(Li);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){Li.subVectors(i,t),Pi.subVectors(n,t),Ni.subVectors(e,t);const a=Li.dot(Li),s=Li.dot(Pi),o=Li.dot(Ni),l=Pi.dot(Pi),c=Pi.dot(Ni),h=a*l-s*s;if(0===h)return r.set(0,0,0),null;const A=1/h,u=(l*o-s*c)*A,d=(a*c-s*o)*A;return r.set(1-u-d,d,u)}static containsPoint(e,t,n,i){return null!==this.getBarycoord(e,t,n,i,Fi)&&Fi.x>=0&&Fi.y>=0&&Fi.x+Fi.y<=1}static getInterpolation(e,t,n,i,r,a,s,o){return null===this.getBarycoord(e,t,n,i,Fi)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,Fi.x),o.addScaledVector(a,Fi.y),o.addScaledVector(s,Fi.z),o)}static isFrontFacing(e,t,n,i){return Li.subVectors(n,t),Pi.subVectors(e,t),Li.cross(Pi).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),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 Li.subVectors(this.c,this.b),Pi.subVectors(this.a,this.b),.5*Li.cross(Pi).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Wi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Wi.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return Wi.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return Wi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Wi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let a,s;Oi.subVectors(i,n),ki.subVectors(r,n),Hi.subVectors(e,n);const o=Oi.dot(Hi),l=ki.dot(Hi);if(o<=0&&l<=0)return t.copy(n);zi.subVectors(e,i);const c=Oi.dot(zi),h=ki.dot(zi);if(c>=0&&h<=c)return t.copy(i);const A=o*h-c*l;if(A<=0&&o>=0&&c<=0)return a=o/(o-c),t.copy(n).addScaledVector(Oi,a);Vi.subVectors(e,r);const u=Oi.dot(Vi),d=ki.dot(Vi);if(d>=0&&u<=d)return t.copy(r);const p=u*l-o*d;if(p<=0&&l>=0&&d<=0)return s=l/(l-d),t.copy(n).addScaledVector(ki,s);const f=c*d-u*h;if(f<=0&&h-c>=0&&u-d>=0)return Gi.subVectors(r,i),s=(h-c)/(h-c+(u-d)),t.copy(i).addScaledVector(Gi,s);const g=1/(f+p+A);return a=p*g,s=A*g,t.copy(n).addScaledVector(Oi,a).addScaledVector(ki,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const qi={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ji={h:0,s:0,l:0},Yi={h:0,s:0,l:0};function Xi(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}class Ki{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(void 0===t&&void 0===n){const t=e;t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=_t){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,fn.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=fn.workingColorSpace){return this.r=e,this.g=t,this.b=n,fn.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=fn.workingColorSpace){if(e=Xt(e,1),t=Yt(t,0,1),n=Yt(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=Xi(r,i,e+1/3),this.g=Xi(r,i,e),this.b=Xi(r,i,e-1/3)}return fn.toWorkingColorSpace(this,i),this}setStyle(e,t=_t){function n(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const a=i[1],s=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===r)return this.setHex(parseInt(n,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=_t){const n=qi[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.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=gn(e.r),this.g=gn(e.g),this.b=gn(e.b),this}copyLinearToSRGB(e){return this.r=mn(e.r),this.g=mn(e.g),this.b=mn(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=_t){return fn.fromWorkingColorSpace(Ji.copy(this),e),65536*Math.round(Yt(255*Ji.r,0,255))+256*Math.round(Yt(255*Ji.g,0,255))+Math.round(Yt(255*Ji.b,0,255))}getHexString(e=_t){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=fn.workingColorSpace){fn.fromWorkingColorSpace(Ji.copy(this),t);const n=Ji.r,i=Ji.g,r=Ji.b,a=Math.max(n,i,r),s=Math.min(n,i,r);let o,l;const c=(s+a)/2;if(s===a)o=0,l=0;else{const e=a-s;switch(l=c<=.5?e/(a+s):e/(2-a-s),a){case n:o=(i-r)/e+(i<r?6:0);break;case i:o=(r-n)/e+2;break;case r:o=(n-i)/e+4}o/=6}return e.h=o,e.s=l,e.l=c,e}getRGB(e,t=fn.workingColorSpace){return fn.fromWorkingColorSpace(Ji.copy(this),t),e.r=Ji.r,e.g=Ji.g,e.b=Ji.b,e}getStyle(e=_t){fn.fromWorkingColorSpace(Ji.copy(this),e);const t=Ji.r,n=Ji.g,i=Ji.b;return e!==_t?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(e,t,n){return this.getHSL(ji),this.setHSL(ji.h+e,ji.s+t,ji.l+n)}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,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(ji),e.getHSL(Yi);const n=Kt(ji.h,Yi.h,t),i=Kt(ji.s,Yi.s,t),r=Kt(ji.l,Yi.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,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}}const Ji=new Ki;Ki.NAMES=qi;let Zi=0;class $i extends zt{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Zi++}),this.uuid=jt(),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=me,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ki(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=Tt,this.stencilZFail=Tt,this.stencilZPass=Tt,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.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}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),204!==this.blendSrc&&(n.blendSrc=this.blendSrc),205!==this.blendDst&&(n.blendDst=this.blendDst),this.blendEquation!==me&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Tt&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Tt&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Tt&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}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;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,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.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 er extends $i{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ki(16777215),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 mi,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}}const tr=function(){const e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(i[e]=0,i[256|e]=32768,r[e]=24,r[256|e]=24):t<-14?(i[e]=1024>>-t-14,i[256|e]=1024>>-t-14|32768,r[e]=-t-1,r[256|e]=-t-1):t<=15?(i[e]=t+15<<10,i[256|e]=t+15<<10|32768,r[e]=13,r[256|e]=13):t<128?(i[e]=31744,i[256|e]=64512,r[e]=24,r[256|e]=24):(i[e]=31744,i[256|e]=64512,r[e]=13,r[256|e]=13)}const a=new Uint32Array(2048),s=new Uint32Array(64),o=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;!(8388608&t);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,a[e]=t|n}for(let e=1024;e<2048;++e)a[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=1199570944,s[32]=2147483648;for(let e=33;e<63;++e)s[e]=2147483648+(e-32<<23);s[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(o[e]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:a,exponentTable:s,offsetTable:o}}();const nr=function(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=Yt(e,-65504,65504),tr.floatView[0]=e;const t=tr.uint32View[0],n=t>>23&511;return tr.baseTable[n]+((8388607&t)>>tr.shiftTable[n])},ir=new Rn,rr=new nn;class ar{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=Ot,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Ze,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return hn("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}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,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,n=this.count;t<n;t++)rr.fromBufferAttribute(this,t),rr.applyMatrix3(e),this.setXY(t,rr.x,rr.y);else if(3===this.itemSize)for(let t=0,n=this.count;t<n;t++)ir.fromBufferAttribute(this,t),ir.applyMatrix3(e),this.setXYZ(t,ir.x,ir.y,ir.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)ir.fromBufferAttribute(this,t),ir.applyMatrix4(e),this.setXYZ(t,ir.x,ir.y,ir.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ir.fromBufferAttribute(this,t),ir.applyNormalMatrix(e),this.setXYZ(t,ir.x,ir.y,ir.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ir.fromBufferAttribute(this,t),ir.transformDirection(e),this.setXYZ(t,ir.x,ir.y,ir.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Jt(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Zt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Jt(t,this.array)),t}setX(e,t){return this.normalized&&(t=Zt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Jt(t,this.array)),t}setY(e,t){return this.normalized&&(t=Zt(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=Jt(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Zt(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=Jt(t,this.array)),t}setW(e,t){return this.normalized&&(t=Zt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Zt(t,this.array),n=Zt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Zt(t,this.array),n=Zt(n,this.array),i=Zt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=Zt(t,this.array),n=Zt(n,this.array),i=Zt(i,this.array),r=Zt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==Ot&&(e.usage=this.usage),e}}class sr extends ar{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class or extends ar{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class lr extends ar{constructor(e,t,n){super(new Float32Array(e),t,n)}}let cr=0;const hr=new oi,Ar=new Ui,ur=new Rn,dr=new Un,pr=new Un,fr=new Rn;class gr extends zt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:cr++}),this.uuid=jt(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this.cubeMapNormalTarget=null}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(sn(e)?or:sr)(e,1):this.index=e,this}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,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const t=(new rn).getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return hr.makeRotationFromQuaternion(e),this.applyMatrix4(hr),this}rotateX(e){return hr.makeRotationX(e),this.applyMatrix4(hr),this}rotateY(e){return hr.makeRotationY(e),this.applyMatrix4(hr),this}rotateZ(e){return hr.makeRotationZ(e),this.applyMatrix4(hr),this}translate(e,t,n){return hr.makeTranslation(e,t,n),this.applyMatrix4(hr),this}scale(e,t,n){return hr.makeScale(e,t,n),this.applyMatrix4(hr),this}lookAt(e){return Ar.lookAt(e),Ar.updateMatrix(),this.applyMatrix4(Ar.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ur).negate(),this.translate(ur.x,ur.y,ur.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n];t.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new lr(t,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Un);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Rn(-1/0,-1/0,-1/0),new Rn(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];dr.setFromBufferAttribute(n),this.morphTargetsRelative?(fr.addVectors(this.boundingBox.min,dr.min),this.boundingBox.expandByPoint(fr),fr.addVectors(this.boundingBox.max,dr.max),this.boundingBox.expandByPoint(fr)):(this.boundingBox.expandByPoint(dr.min),this.boundingBox.expandByPoint(dr.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.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 Zn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new Rn,1/0);if(e){const n=this.boundingSphere.center;if(dr.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];pr.setFromBufferAttribute(n),this.morphTargetsRelative?(fr.addVectors(dr.min,pr.min),dr.expandByPoint(fr),fr.addVectors(dr.max,pr.max),dr.expandByPoint(fr)):(dr.expandByPoint(pr.min),dr.expandByPoint(pr.max))}dr.getCenter(n);let i=0;for(let t=0,r=e.count;t<r;t++)fr.fromBufferAttribute(e,t),i=Math.max(i,n.distanceToSquared(fr));if(t)for(let r=0,a=t.length;r<a;r++){const a=t[r],s=this.morphTargetsRelative;for(let t=0,r=a.count;t<r;t++)fr.fromBufferAttribute(a,t),s&&(ur.fromBufferAttribute(e,t),fr.add(ur)),i=Math.max(i,n.distanceToSquared(fr))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.position,i=t.normal,r=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new ar(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),s=[],o=[];for(let e=0;e<n.count;e++)s[e]=new Rn,o[e]=new Rn;const l=new Rn,c=new Rn,h=new Rn,A=new nn,u=new nn,d=new nn,p=new Rn,f=new Rn;function g(e,t,i){l.fromBufferAttribute(n,e),c.fromBufferAttribute(n,t),h.fromBufferAttribute(n,i),A.fromBufferAttribute(r,e),u.fromBufferAttribute(r,t),d.fromBufferAttribute(r,i),c.sub(l),h.sub(l),u.sub(A),d.sub(A);const a=1/(u.x*d.y-d.x*u.y);isFinite(a)&&(p.copy(c).multiplyScalar(d.y).addScaledVector(h,-u.y).multiplyScalar(a),f.copy(h).multiplyScalar(u.x).addScaledVector(c,-d.x).multiplyScalar(a),s[e].add(p),s[t].add(p),s[i].add(p),o[e].add(f),o[t].add(f),o[i].add(f))}let m=this.groups;0===m.length&&(m=[{start:0,count:e.count}]);for(let t=0,n=m.length;t<n;++t){const n=m[t],i=n.start;for(let t=i,r=i+n.count;t<r;t+=3)g(e.getX(t+0),e.getX(t+1),e.getX(t+2))}const v=new Rn,E=new Rn,b=new Rn,C=new Rn;function _(e){b.fromBufferAttribute(i,e),C.copy(b);const t=s[e];v.copy(t),v.sub(b.multiplyScalar(b.dot(t))).normalize(),E.crossVectors(C,t);const n=E.dot(o[e])<0?-1:1;a.setXYZW(e,v.x,v.y,v.z,n)}for(let t=0,n=m.length;t<n;++t){const n=m[t],i=n.start;for(let t=i,r=i+n.count;t<r;t+=3)_(e.getX(t+0)),_(e.getX(t+1)),_(e.getX(t+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(void 0!==t){let n=this.getAttribute("normal");if(void 0===n)n=new ar(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);const i=new Rn,r=new Rn,a=new Rn,s=new Rn,o=new Rn,l=new Rn,c=new Rn,h=new Rn;if(e)for(let A=0,u=e.count;A<u;A+=3){const u=e.getX(A+0),d=e.getX(A+1),p=e.getX(A+2);i.fromBufferAttribute(t,u),r.fromBufferAttribute(t,d),a.fromBufferAttribute(t,p),c.subVectors(a,r),h.subVectors(i,r),c.cross(h),s.fromBufferAttribute(n,u),o.fromBufferAttribute(n,d),l.fromBufferAttribute(n,p),s.add(c),o.add(c),l.add(c),n.setXYZ(u,s.x,s.y,s.z),n.setXYZ(d,o.x,o.y,o.z),n.setXYZ(p,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)i.fromBufferAttribute(t,e+0),r.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),c.subVectors(a,r),h.subVectors(i,r),c.cross(h),n.setXYZ(e+0,c.x,c.y,c.z),n.setXYZ(e+1,c.x,c.y,c.z),n.setXYZ(e+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)fr.fromBufferAttribute(e,t),fr.normalize(),e.setXYZ(t,fr.x,fr.y,fr.z)}toNonIndexed(){function e(e,t){const n=e.array,i=e.itemSize,r=e.normalized,a=new n.constructor(t.length*i);let s=0,o=0;for(let r=0,l=t.length;r<l;r++){s=e.isInterleavedBufferAttribute?t[r]*e.data.stride+e.offset:t[r]*i;for(let e=0;e<i;e++)a[o++]=n[s++]}return new ar(a,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new gr,n=this.index.array,i=this.attributes;for(const r in i){const a=e(i[r],n);t.setAttribute(r,a)}const r=this.morphAttributes;for(const i in r){const a=[],s=r[i];for(let t=0,i=s.length;t<i;t++){const i=e(s[t],n);a.push(i)}t.morphAttributes[i]=a}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let e=0,n=a.length;e<n;e++){const n=a[e];t.addGroup(n.start,n.count,n.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,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){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const i=n[t];e.data.attributes[t]=i.toJSON(e.data)}const i={};let r=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],a=[];for(let t=0,i=n.length;t<i;t++){const i=n[t];a.push(i.toJSON(e.data))}a.length>0&&(i[t]=a,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const s=this.boundingSphere;return null!==s&&(e.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),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;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const r=e.morphAttributes;for(const e in r){const n=[],i=r[e];for(let e=0,r=i.length;e<r;e++)n.push(i[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let e=0,t=a.length;e<t;e++){const t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}const s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());const 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,null!==e.cubeMapNormalTarget&&this.cubeMapNormalTarget.copy(e.cubeMapNormalTarget),this}dispose(){this.cubeMapNormalTarget&&this.cubeMapNormalTarget.dispose(),this.dispatchEvent({type:"dispose"})}}const mr=new oi,vr=new si,Er=new Zn,br=new Rn,Cr=new Rn,_r=new Rn,Ir=new Rn,xr=new Rn,yr=new Rn,wr=new nn,Mr=new nn,Sr=new nn,Br=new Rn,Tr=new Rn,Rr=new Rn,Dr=new Rn,Qr=new Rn;class Ur extends Ui{constructor(e=new gr,t=new er){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,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}computeOffsets(){this.geometry.computeBoundingBox(),this.geometry.computeBoundingSphere(),this.center=this.geometry.boundingSphere.center,this.offsetMatrix=this._computeOffsetMatrix(),this.offsetMatrixInv.copy(this.offsetMatrix).invert(),this.centerOffset.copy(this.center).applyMatrix4(this.offsetMatrixInv),this.modelOffsetMatrix.copy(this.matrixWorld).multiply(this.offsetMatrix),this.modelOffsetMatrixInv.copy(this.modelOffsetMatrix).invert()}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const s=this.morphTargetInfluences;if(r&&s){yr.set(0,0,0);for(let n=0,i=r.length;n<i;n++){const i=s[n],o=r[n];0!==i&&(xr.fromBufferAttribute(o,e),a?yr.addScaledVector(xr,i):yr.addScaledVector(xr.sub(t),i))}t.add(yr)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===n.boundingSphere&&n.computeBoundingSphere(),Er.copy(n.boundingSphere),Er.applyMatrix4(r),vr.copy(e.ray).recast(e.near),!1===Er.containsPoint(vr.origin)){if(null===vr.intersectSphere(Er,br))return;if(vr.origin.distanceToSquared(br)>(e.far-e.near)**2)return}mr.copy(r).invert(),vr.copy(e.ray).applyMatrix4(mr),null!==n.boundingBox&&!1===vr.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,vr)}}_computeOffsetMatrix(){const e=this.geometry,t=e.getAttribute("position"),n=e.getIndex(),i=new Rn(0,0,0),r=new Rn(0,0,0),a=new Rn(0,0,0),s=new Rn(0,0,0);if(void 0!==n){const o=Math.max(0,e.drawRange.start),l=(Math.min(n.count,e.drawRange.start+e.drawRange.count)-1)/3;for(let e=o;e<l;e+=3){const o=n.getX(e),l=n.getX(e+1),c=n.getX(e+2);r.set(t.getX(o),t.getY(o),t.getZ(o)),a.set(t.getX(l),t.getY(l),t.getZ(l)),s.set(t.getX(c),t.getY(c),t.getZ(c)),a.sub(r),s.sub(r),s.cross(a),s.normalize(),i.add(s)}}else for(let e=0;e<t.count;e+=3)r.set(t.getX(e),t.getY(e),t.getZ(e)),a.set(t.getX(e+1),t.getY(e+1),t.getZ(e+1)),s.set(t.getX(e+2),t.getY(e+2),t.getZ(e+2)),a.sub(r),s.sub(r),s.cross(a),s.normalize(),i.add(s);i.normalize();let o=!0,l=0;for(;o;){const e=l/3;if(n){if(e+1>=n.count)break}else if(e+1>=t.count)break;const r=n?n.getX(e):e,c=n?n.getX(e+1):e+1;a.set(t.getX(r),t.getY(r),t.getZ(r)),s.set(t.getX(c),t.getY(c),t.getZ(c)),a.sub(s),a.normalize();const h=i.dot(a);Math.abs(h-1)>.001&&a.length()>.5&&(o=!1),l+=3}s.crossVectors(a,i),s.normalize(),a.crossVectors(i,s),a.normalize();const c=new oi;c.elements[0]=a.x,c.elements[1]=a.y,c.elements[2]=a.z,c.elements[3]=0,c.elements[4]=i.x,c.elements[5]=i.y,c.elements[6]=i.z,c.elements[7]=0,c.elements[8]=s.x,c.elements[9]=s.y,c.elements[10]=s.z,c.elements[11]=0,c.elements[12]=0,c.elements[13]=0,c.elements[14]=0,c.elements[15]=1;const h=e.boundingSphere.radius,A=(new oi).makeScale(h,h,h);return c.multiply(A),c}_computeIntersections(e,t,n){let i;const r=this.geometry,a=this.material,s=r.index,o=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,A=r.groups,u=r.drawRange;if(null!==s)if(Array.isArray(a))for(let r=0,o=A.length;r<o;r++){const o=A[r],d=a[o.materialIndex];for(let r=Math.max(o.start,u.start),a=Math.min(s.count,Math.min(o.start+o.count,u.start+u.count));r<a;r+=3)i=Lr(this,d,e,n,l,c,h,s.getX(r),s.getX(r+1),s.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,t.push(i))}else for(let r=Math.max(0,u.start),o=Math.min(s.count,u.start+u.count);r<o;r+=3)i=Lr(this,a,e,n,l,c,h,s.getX(r),s.getX(r+1),s.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),t.push(i));else if(void 0!==o)if(Array.isArray(a))for(let r=0,s=A.length;r<s;r++){const s=A[r],d=a[s.materialIndex];for(let r=Math.max(s.start,u.start),a=Math.min(o.count,Math.min(s.start+s.count,u.start+u.count));r<a;r+=3)i=Lr(this,d,e,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=s.materialIndex,t.push(i))}else for(let r=Math.max(0,u.start),s=Math.min(o.count,u.start+u.count);r<s;r+=3)i=Lr(this,a,e,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),t.push(i))}}function Lr(e,t,n,i,r,a,s,o,l,c){e.getVertexPosition(o,Cr),e.getVertexPosition(l,_r),e.getVertexPosition(c,Ir);const h=function(e,t,n,i,r,a,s,o){let l;if(l=1===t.side?i.intersectTriangle(s,a,r,!0,o):i.intersectTriangle(r,a,s,0===t.side,o),null===l)return null;Qr.copy(o),Qr.applyMatrix4(e.matrixWorld);const c=n.ray.origin.distanceTo(Qr);return c<n.near||c>n.far?null:{distance:c,point:Qr.clone(),object:e}}(e,t,n,i,Cr,_r,Ir,Dr);if(h){r&&(wr.fromBufferAttribute(r,o),Mr.fromBufferAttribute(r,l),Sr.fromBufferAttribute(r,c),h.uv=Wi.getInterpolation(Dr,Cr,_r,Ir,wr,Mr,Sr,new nn)),a&&(wr.fromBufferAttribute(a,o),Mr.fromBufferAttribute(a,l),Sr.fromBufferAttribute(a,c),h.uv1=Wi.getInterpolation(Dr,Cr,_r,Ir,wr,Mr,Sr,new nn)),s&&(Br.fromBufferAttribute(s,o),Tr.fromBufferAttribute(s,l),Rr.fromBufferAttribute(s,c),h.normal=Wi.getInterpolation(Dr,Cr,_r,Ir,Br,Tr,Rr,new Rn),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const e={a:o,b:l,c:c,normal:new Rn,materialIndex:0};Wi.getNormal(Cr,_r,Ir,e.normal),h.face=e}return h}class Pr extends gr{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const s=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const o=[],l=[],c=[],h=[];let A=0,u=0;function d(e,t,n,i,r,a,d,p,f,g,m){const v=a/f,E=d/g,b=a/2,C=d/2,_=p/2,I=f+1,x=g+1;let y=0,w=0;const M=new Rn;for(let a=0;a<x;a++){const s=a*E-C;for(let o=0;o<I;o++){const A=o*v-b;M[e]=A*i,M[t]=s*r,M[n]=_,l.push(M.x,M.y,M.z),M[e]=0,M[t]=0,M[n]=p>0?1:-1,c.push(M.x,M.y,M.z),h.push(o/f),h.push(1-a/g),y+=1}}for(let e=0;e<g;e++)for(let t=0;t<f;t++){const n=A+t+I*e,i=A+t+I*(e+1),r=A+(t+1)+I*(e+1),a=A+(t+1)+I*e;o.push(n,i,a),o.push(i,r,a),w+=6}s.addGroup(u,w,m),u+=w,A+=y}d("z","y","x",-1,-1,n,t,e,a,r,0),d("z","y","x",1,-1,n,t,-e,a,r,1),d("x","z","y",1,1,e,n,t,i,a,2),d("x","z","y",1,-1,e,n,-t,i,a,3),d("x","y","z",1,-1,e,t,n,i,r,4),d("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(o),this.setAttribute("position",new lr(l,3)),this.setAttribute("normal",new lr(c,3)),this.setAttribute("uv",new lr(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Pr(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Nr(e){const t={};for(const n in e){t[n]={};for(const i in e[n]){const r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null):t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}}return t}function Fr(e){const t={};for(let n=0;n<e.length;n++){const i=Nr(e[n]);for(const e in i)t[e]=i[e]}return t}function Or(e){const t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:fn.workingColorSpace}const kr={clone:Nr,merge:Fr};class Gr extends $i{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_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=Nr(e.uniforms),this.uniformsGroups=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].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}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}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;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Hr extends Ui{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new oi,this.projectionMatrix=new oi,this.projectionMatrixInverse=new oi,this.coordinateSystem=Gt}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)}}const zr=new Rn,Vr=new nn,Wr=new nn;class qr extends Hr{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,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){const t=.5*this.getFilmHeight()/e;this.fov=2*qt*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*Wt*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*qt*Math.atan(Math.tan(.5*Wt*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,n){zr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(zr.x,zr.y).multiplyScalar(-e/zr.z),zr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(zr.x,zr.y).multiplyScalar(-e/zr.z)}getViewSize(e,t){return this.getViewBounds(e,Vr,Wr),t.subVectors(Wr,Vr)}setViewOffset(e,t,n,i,r,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=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*Wt*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const a=this.view;if(null!==this.view&&this.view.enabled){const e=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/e,t-=a.offsetY*n/s,i*=a.width/e,n*=a.height/s}const s=this.filmOffset;0!==s&&(r+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const 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}}const jr=-90;class Yr extends Ui{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new qr(jr,1,e,t);i.layers=this.layers,this.add(i);const r=new qr(jr,1,e,t);r.layers=this.layers,this.add(r);const a=new qr(jr,1,e,t);a.layers=this.layers,this.add(a);const s=new qr(jr,1,e,t);s.layers=this.layers,this.add(s);const o=new qr(jr,1,e,t);o.layers=this.layers,this.add(o);const l=new qr(jr,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,s,o]=t;for(const e of t)this.remove(e);if(e===Gt)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.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(e!==Ht)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.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)}for(const e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,a,s,o,l,c]=this.children,h=e.getRenderTarget(),A=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),d=e.xr.enabled;e.xr.enabled=!1;const p=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,s),e.setRenderTarget(n,3,i),e.render(t,o),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=p,e.setRenderTarget(n,5,i),e.render(t,c),e.setRenderTarget(h,A,u),e.xr.enabled=d,n.texture.needsPMREMUpdate=!0}}class Xr extends xn{constructor(e,t,n,i,r,a,s,o,l,c){super(e=void 0!==e?e:[],t=void 0!==t?t:Pe,n,i,r,a,s,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Kr extends Mn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Xr(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:qe}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;const n={tEquirect:{value:null}},i="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new Pr(5,5,5),s=new Gr({name:"CubemapFromEquirect",uniforms:Nr(n),vertexShader:i,fragmentShader:r,side:1,blending:0});s.uniforms.tEquirect.value=t;const o=new Ur(a,s),l=t.minFilter;return t.minFilter===Ye&&(t.minFilter=qe),new Yr(1,10,this).update(e,o),t.minFilter=l,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}const Jr=new Rn,Zr=new Rn,$r=new rn;class ea{constructor(e=new Rn(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,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Jr.subVectors(n,t).cross(Zr.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const 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){const n=e.delta(Jr),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<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){const n=t||$r.getNormalMatrix(e),i=this.coplanarPoint(Jr).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),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)}}const ta=new Zn,na=new Rn;class ia{constructor(e=new ea,t=new ea,n=new ea,i=new ea,r=new ea,a=new ea){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,a){const s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2e3){const n=this.planes,i=e.elements,r=i[0],a=i[1],s=i[2],o=i[3],l=i[4],c=i[5],h=i[6],A=i[7],u=i[8],d=i[9],p=i[10],f=i[11],g=i[12],m=i[13],v=i[14],E=i[15];if(n[0].setComponents(o-r,A-l,f-u,E-g).normalize(),n[1].setComponents(o+r,A+l,f+u,E+g).normalize(),n[2].setComponents(o+a,A+c,f+d,E+m).normalize(),n[3].setComponents(o-a,A-c,f-d,E-m).normalize(),n[4].setComponents(o-s,A-h,f-p,E-v).normalize(),t===Gt)n[5].setComponents(o+s,A+h,f+p,E+v).normalize();else{if(t!==Ht)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);n[5].setComponents(s,h,p,v).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),ta.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),ta.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ta)}intersectsSprite(e){return ta.center.set(0,0,0),ta.radius=.7071067811865476,ta.applyMatrix4(e.matrixWorld),this.intersectsSphere(ta)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(na.x=i.normal.x>0?e.max.x:e.min.x,na.y=i.normal.y>0?e.max.y:e.min.y,na.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(na)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function ra(){let e=null,t=!1,n=null,i=null;function r(t,a){n(t,a),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function aa(e){const t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=t.get(n);i&&(e.deleteBuffer(i.buffer),t.delete(n))},update:function(n,i){if(n.isGLBufferAttribute){const e=t.get(n);return void((!e||e.version<n.version)&&t.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version}))}n.isInterleavedBufferAttribute&&(n=n.data);const r=t.get(n);if(void 0===r)t.set(n,function(t,n){const i=t.array,r=t.usage,a=i.byteLength,s=e.createBuffer();let o;if(e.bindBuffer(n,s),e.bufferData(n,i,r),t.onUploadCallback(),i instanceof Float32Array)o=e.FLOAT;else if(i instanceof Uint16Array)o=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(i instanceof Int16Array)o=e.SHORT;else if(i instanceof Uint32Array)o=e.UNSIGNED_INT;else if(i instanceof Int32Array)o=e.INT;else if(i instanceof Int8Array)o=e.BYTE;else if(i instanceof Uint8Array)o=e.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);o=e.UNSIGNED_BYTE}return{buffer:s,type:o,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version,size:a}}(n,i));else if(r.version<n.version){if(r.size!==n.array.byteLength)throw new 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,n,i){const r=n.array,a=n._updateRange,s=n.updateRanges;if(e.bindBuffer(i,t),-1===a.count&&0===s.length&&e.bufferSubData(i,0,r),0!==s.length){for(let t=0,n=s.length;t<n;t++){const n=s[t];e.bufferSubData(i,n.start*r.BYTES_PER_ELEMENT,r,n.start,n.count)}n.clearUpdateRanges()}-1!==a.count&&(e.bufferSubData(i,a.offset*r.BYTES_PER_ELEMENT,r,a.offset,a.count),a.count=-1),n.onUploadCallback()}(r.buffer,n,i),r.version=n.version}}}}class sa extends gr{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,a=t/2,s=Math.floor(n),o=Math.floor(i),l=s+1,c=o+1,h=e/s,A=t/o,u=[],d=[],p=[],f=[];for(let e=0;e<c;e++){const t=e*A-a;for(let n=0;n<l;n++){const i=n*h-r;d.push(i,-t,0),p.push(0,0,1),f.push(n/s),f.push(1-e/o)}}for(let e=0;e<o;e++)for(let t=0;t<s;t++){const n=t+l*e,i=t+l*(e+1),r=t+1+l*(e+1),a=t+1+l*e;u.push(n,i,a),u.push(i,r,a)}this.setIndex(u),this.setAttribute("position",new lr(d,3)),this.setAttribute("normal",new lr(p,3)),this.setAttribute("uv",new lr(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sa(e.width,e.height,e.widthSegments,e.heightSegments)}}const oa={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn 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\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.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\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.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\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn 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}\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform 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\tvec3 diffuseColor;\n\tfloat 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\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.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\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 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\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.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\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_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\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat 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\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.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\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - 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\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#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\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat 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\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn 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\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn 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\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn 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\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid 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\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\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\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\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\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\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\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn 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\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform 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\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn 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\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#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\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_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\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( 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\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = 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\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform 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\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cubeNormals_vert:"varying vec3 vNormal;\nvarying vec3 vecPosition;\nuniform mat4 offsetMatrixInv;\nuniform vec3 center;\n#include <morphtarget_pars_vertex>\nvoid main() {\n\tvNormal = normalize((offsetMatrixInv * vec4(normal, 0.)).xyz);\n\t#include <begin_vertex>\n\ttransformed -= center;\n\t#include <morphtarget_vertex>\n\tvec4 offsetPos = offsetMatrixInv * vec4(transformed, 1.);\n\tvecPosition = (modelMatrix * offsetPos).xyz;\n\tgl_Position = projectionMatrix * modelViewMatrix * offsetPos;\n}",cubeNormals_frag:"varying vec3 vNormal;\nvarying vec3 vecPosition;\nuniform float radius;\nvoid main() {\n\tvec3 color = normalize(vNormal);\n\tcolor = color * 0.5 + 0.5;\n\tgl_FragColor = vec4(color.x, color.y, color.z, length(vecPosition) / radius);\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\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform 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\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_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\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\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 <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#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\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying 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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshdiamond_vert:"#ifndef USE_ENVMAP\n\t#define USE_ENVMAP\n#endif\nvarying vec3 vWorldPosition;\nvarying vec3 vWorldNormal;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;\nvarying vec2 vUv;\n#ifdef USE_INSTANCING\n\tuniform mat4 inverseModelMatrix;\n\tuniform mat4 modelOffsetMatrix;\n\tvarying mat4 vModelInstanceOffsetMatrix;\n\tvarying mat4 vModelInstanceOffsetMatrixInv;\n#endif\n#include <morphtarget_pars_vertex>\n#ifdef USE_MORPHTARGETS\n\tvarying vec3 vCenterOffset;\n\t#ifndef USE_INSTANCING\n\t\tuniform mat4 modelOffsetMatrixInv;\n\t#endif\n#endif\nvoid main() {\n\t#ifdef USE_INSTANCING\n\t\tvWorldNormal = (modelMatrix * instanceMatrix * vec4(normal, 0.0)).xyz;\n\t#else\n\t\tvWorldNormal = (modelMatrix * vec4(normal, 0.0)).xyz;\n\t#endif\n\t#include <beginnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#ifdef USE_MORPHTARGETS\n\t\tvCenterOffset = transformed;\n\t\t#include <morphtarget_vertex>\n\t\tvCenterOffset = transformed - vCenterOffset;\n\t\t#ifndef USE_INSTANCING\n\t\t\tvCenterOffset = (modelOffsetMatrixInv * modelMatrix * vec4(vCenterOffset, 1.0)).xyz;\n\t\t#endif\n\t#endif\n\t#include <project_vertex>\n\tvViewPosition = -mvPosition.xyz;\n\tvUv = uv;\n\t#include <worldpos_vertex>\n\tvWorldPosition = worldPosition.xyz;\n\t#ifdef USE_INSTANCING\n\t\tvModelInstanceOffsetMatrix = modelMatrix * instanceMatrix * inverseModelMatrix * modelOffsetMatrix;\n\t\tvModelInstanceOffsetMatrixInv = inverse(vModelInstanceOffsetMatrix);\n\t\t#ifdef USE_MORPHTARGETS\n\t\t\tvCenterOffset = (vModelInstanceOffsetMatrixInv * modelMatrix * vec4(vCenterOffset, 1.0)).xyz;\n\t\t#endif\n\t#endif\n}",meshdiamond_frag:"varying vec3 vWorldNormal;\nvarying vec3 vWorldPosition;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nuniform float radius;\nuniform vec3 centerOffset;\n#include <common>\n#ifdef USE_INSTANCING\n\tvarying mat4 vModelInstanceOffsetMatrix;\n\tvarying mat4 vModelInstanceOffsetMatrixInv;\n\t#define MODEL_OFFSET_MATRIX vModelInstanceOffsetMatrix\n\t#define INV_MODEL_OFFSET_MATRIX vModelInstanceOffsetMatrixInv\n#else\n\tuniform mat4 modelOffsetMatrixInv;\n\tuniform mat4 modelOffsetMatrix;\n\t#define MODEL_OFFSET_MATRIX modelOffsetMatrix\n\t#define INV_MODEL_OFFSET_MATRIX modelOffsetMatrixInv\n#endif\n#ifdef USE_MORPHTARGETS\n\tvarying vec3 vCenterOffset;\n\t#define CENTER_OFFSET (centerOffset + vCenterOffset)\n#else\n\t#define CENTER_OFFSET (centerOffset)\n#endif\nuniform mat4 projectionMatrix;\nuniform samplerCube tCubeMapNormals;\n#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#else\n\tuniform sampler2D envMap;\n#endif\nuniform float envMapIntensity;\nuniform float transmission;\nuniform vec2 transmissionSamplerSize;\nuniform sampler2D transmissionSamplerMap;\nuniform float ior;\nuniform float rIndexDelta;\nuniform float squashFactor;\nuniform float geometryFactor;\nuniform vec3 color;\nuniform vec3 colorCorrection;\nuniform vec3 boostFactors;\nuniform float gammaFactor;\nuniform float absorptionFactor;\nuniform float envMapRotation;\nuniform vec4 envMapRotationQuat;\nuniform float reflectivity;\nvec3 BRDF_Specular_GGX_Environment(const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness) {\n float dotNV = abs(dot(normal, viewDir));\n const vec4 c0 = vec4(-1, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n return specularColor * AB.x + AB.y;\n}\nvec2 cartesianToPolar(vec3 n) {\n vec2 uv;\n uv.x = atan(n.z, n.x) / (PI * 2.0) + 0.5;\n uv.y = asin(n.y) / PI + 0.5;\n return uv;\n}\nvec4 sampleEnvMap(vec3 direction) {\n\t#if !defined(USE_ENVMAP)\n\t\treturn vec4(direction, 1);\n\t#else\n\t\tfloat cs = cos(envMapRotation);\n\t\tfloat sn = sin(envMapRotation);\n\t\tfloat temp = cs * direction.x + sn * direction.z;\n\t\tdirection.z = -sn * direction.x + cs * direction.z;\n\t\tdirection.x = temp;\n\t\tdirection.x *= -1.;\n\t\tdirection.y *= -1.;\n\t\tdirection.z *= -1.;\n\t\tvec3 t = 2.0 * cross(envMapRotationQuat.xyz, direction);\n\t\tdirection += envMapRotationQuat.w * t + cross(envMapRotationQuat.xyz, t);\n\t\t#if defined( ENVMAP_TYPE_CUBE )\n\t\t\treturn (textureCube(envMap, direction));\n\t\t#elif defined( ENVMAP_TYPE_TEXTURE_2D )\n\t\t\treturn (texture2D(envMap, cartesianToPolar(direction)));\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\treturn (texture2D(envMap, cartesianToPolar(direction)));\n\t\t#endif\n\t\treturn vec4(1, 0, 1, 1);\n\t#endif\n}\nvec4 SampleSpecularReflection(vec3 direction) {\n\t#if defined(FIX_ENV_DIRECTION)\n\t\tdirection = (viewMatrix * vec4(direction, 0.0)).xyz;\n\t#endif\n\treturn envMapIntensity * (sampleEnvMap(direction));\n}\nvec4 SampleSpecularContribution(vec3 direction) {\n\t#if (DIA_ORIENT_ENVMAP < 1)\n\t\tdirection = mat3(MODEL_OFFSET_MATRIX) * direction;\n\t#endif\n\t#if defined(FIX_ENV_DIRECTION)\n\t\tdirection = (viewMatrix * vec4(direction, 0.0)).xyz;\n\t#endif\n direction = normalize(direction);\n direction.x *= -1.;\n direction.z *= -1.;\n return envMapIntensity * (sampleEnvMap(direction));\n}\nvec4 SampleSpecularContributionRef(vec3 origin, int i) {\n vec4 ndcPos = projectionMatrix * viewMatrix * vec4(origin, 1.);\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n return texture2D(transmissionSamplerMap, refractionCoords);\n}\nvec3 intersectSphere(vec3 origin, vec3 direction) {\n origin -= CENTER_OFFSET;\n direction.y /= squashFactor;\n float A = dot(direction, direction);\n float B = 2. * dot(origin, direction);\n float C = dot(origin, origin) - radius * radius;\n float disc = B * B - 4. * A * C;\n if(disc > 0.) {\n disc = sqrt(disc);\n float t1 = (-B + disc) * geometryFactor / A;\n float t2 = (-B - disc) * geometryFactor / A;\n float t = (t1 > t2) ? t1 : t2;\n direction.y *= squashFactor;\n return vec3(origin + CENTER_OFFSET + direction * t);\n }\n return vec3(0.);\n}\nvec3 linePlaneIntersect(in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal) {\n return lineDirection * (dot(planeNormal, pointOnPlane - pointOnLine) / dot(planeNormal, lineDirection)) + pointOnLine;\n}\nvec4 getNormalDistance(vec3 d) {\n return textureCube(tCubeMapNormals, d);\n}\nvec3 getSurfaceNormal(vec4 surfaceInfos) {\n vec3 surfaceNormal = surfaceInfos.rgb;\n surfaceNormal = surfaceNormal * 2. - 1.;\n return -normalize(surfaceNormal);\n}\nvec3 intersect(vec3 rayOrigin,vec3 rayDirection) {\n vec3 sphereHitPoint = intersectSphere(rayOrigin, rayDirection);\n vec3 direction1 = normalize(sphereHitPoint - CENTER_OFFSET);\n vec4 normalDistanceData1 = getNormalDistance(direction1);\n float distance1 = normalDistanceData1.a * radius;\n vec3 pointOnPlane1 = CENTER_OFFSET + direction1 * distance1;\n vec3 planeNormal1 = getSurfaceNormal(normalDistanceData1);\n vec3 hitPoint1 = linePlaneIntersect(rayOrigin, rayDirection, pointOnPlane1, planeNormal1);\n vec3 direction2 = normalize(hitPoint1 - CENTER_OFFSET);\n vec4 normalDistanceData2 = getNormalDistance(direction2);\n float distance2 = normalDistanceData2.a * radius;\n vec3 pointOnPlane2 = CENTER_OFFSET + direction2 * distance2;\n vec3 hitPoint = hitPoint1;\n vec3 planeNormal2 = getSurfaceNormal(normalDistanceData2);\n hitPoint = linePlaneIntersect(rayOrigin, rayDirection, pointOnPlane2, planeNormal2);\n return hitPoint;\n}\nvec3 getRefractionColor(vec3 origin, vec3 direction, vec3 normal) {\n vec3 outColor = vec3(0.);\n const float n1 = 1.;\n const float epsilon = 1e-4;\n float f0 = (2.4 - n1) / (2.4 + n1);\n f0 *= f0;\n vec3 attenuationFactor = vec3(1.);\n vec3 newDirection = refract(direction, normal, n1 / ior);\n vec3 brdfRefracted = BRDF_Specular_GGX_Environment(newDirection, -normal, vec3(f0), 0.);\n attenuationFactor *= (vec3(1.) - brdfRefracted);\n int count = 0;\n mat4 invModelOffsetMatrix = INV_MODEL_OFFSET_MATRIX;\n newDirection = normalize((invModelOffsetMatrix * vec4(newDirection, 0.)).xyz);\n origin = (invModelOffsetMatrix * vec4(origin, 1.)).xyz;\n for (int i = 0; i < RAY_BOUNCES; i++) {\n vec3 intersectedPos = intersect(origin, newDirection);\n vec3 dist = intersectedPos - origin;\n vec3 d = normalize(intersectedPos - CENTER_OFFSET);\n vec3 mappedNormal = getNormalDistance(d).rgb;\n mappedNormal = 2. * mappedNormal - 1.;\n mappedNormal = -normalize(mappedNormal);\n float r = length(dist) / radius * absorptionFactor;\n attenuationFactor *= exp(-r * (1. - color));\n origin = intersectedPos;\n vec3 origin2 = (MODEL_OFFSET_MATRIX * vec4(intersectedPos, 1)).xyz;\n vec3 oldDir = newDirection;\n newDirection = refract(newDirection, mappedNormal, ior / n1);\n if (dot(newDirection, newDirection) < epsilon) {\n newDirection = reflect(oldDir, mappedNormal);\n if (i == RAY_BOUNCES - 1) {\n vec3 brdfReflected = BRDF_Specular_GGX_Environment(-oldDir, mappedNormal, vec3(f0), 0.);\n vec3 d1 = mat3(MODEL_OFFSET_MATRIX) * oldDir;\n d1 = normalize(d1);\n float cosT = 1. - dot(direction, d1);\n outColor += ((transmission > 0. && cosT < transmission) ? SampleSpecularContributionRef(origin2 + 0.5 * d1 * cosT, i).rgb : SampleSpecularContribution(oldDir).rgb) * attenuationFactor * colorCorrection * boostFactors * (vec3(1.) - brdfReflected);\n }\n } else {\n vec3 brdfRefracted = vec3(1.) - BRDF_Specular_GGX_Environment(newDirection, -mappedNormal, vec3(f0), 0.);\n vec3 d1 = normalize(mat3(MODEL_OFFSET_MATRIX) * newDirection);\n float cosT = 1. - dot(direction, d1);\n if (transmission > 0. && cosT < transmission) {\n outColor += SampleSpecularContributionRef(origin2 + 0.5 * d1 * cosT, i).rgb * brdfRefracted * attenuationFactor * colorCorrection * boostFactors;\n } else {\n vec3 dir0 = newDirection;\n vec3 dir1 = refract(oldDir, mappedNormal, (ior + rIndexDelta) / n1);\n vec3 dir2 = refract(oldDir, mappedNormal, (ior - rIndexDelta) / n1);\n outColor += vec3(SampleSpecularContribution(dir1).r, SampleSpecularContribution(dir0).g, SampleSpecularContribution(dir2).b) * brdfRefracted * attenuationFactor * colorCorrection * boostFactors;\n }\n newDirection = reflect(oldDir, mappedNormal);\n vec3 brdfReflected = BRDF_Specular_GGX_Environment(newDirection, mappedNormal, vec3(f0), 0.);\n attenuationFactor *= brdfReflected * boostFactors;\n count++;\n }\n }\n return outColor;\n}\nvoid main() {\n vec3 normalizedNormal = normalize(vWorldNormal);\n vec3 viewVector = normalize(vWorldPosition - cameraPosition);\n const float n1 = 1.;\n const float epsilon = 1e-4;\n float f0 = (2.4 - n1) / (2.4 + n1);\n f0 *= f0;\n vec3 attenuationFactor = vec3(1.);\n vec3 reflectedDirection = reflect(viewVector, normalizedNormal);\n vec3 brdfReflected = BRDF_Specular_GGX_Environment(reflectedDirection, normalizedNormal, vec3(f0), 0.);\n vec3 reflectionColor = SampleSpecularReflection(reflectedDirection).rgb * brdfReflected * reflectivity * 2.;\n vec3 refractionColor = getRefractionColor(vWorldPosition, viewVector, normalizedNormal);\n vec3 normal = normalize(vNormal);\n vec3 diffuseColor = vec3(1.);\n gl_FragColor = vec4((refractionColor.rgb + reflectionColor.rgb) * diffuseColor, 1.);\n gl_FragColor.rgb = pow(gl_FragColor.rgb, vec3(gammaFactor));\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n\tgl_FragColor.rgb = max(vec3(0.0), gl_FragColor.rgb);\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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - 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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying 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\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - 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\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\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\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#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 <packing>\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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying 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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#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\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#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\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\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\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#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\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},la={common:{diffuse:{value:new Ki(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new rn},alphaMap:{value:null},alphaMapTransform:{value:new rn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new rn}},envmap:{envMap:{value:null},envMapRotation:{value:new rn},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new rn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new rn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new rn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new rn},normalScale:{value:new nn(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new rn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new rn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new rn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new rn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ki(16777215)}},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 Ki(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new rn},alphaTest:{value:0},uvTransform:{value:new rn}},sprite:{diffuse:{value:new Ki(16777215)},opacity:{value:1},center:{value:new nn(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new rn},alphaMap:{value:null},alphaMapTransform:{value:new rn},alphaTest:{value:0}}},ca={basic:{uniforms:Fr([la.common,la.specularmap,la.envmap,la.aomap,la.lightmap,la.fog]),vertexShader:oa.meshbasic_vert,fragmentShader:oa.meshbasic_frag},cubeNormals:{uniforms:Fr([la.common,{offsetMatrixInv:{value:(new oi).identity()},centerOffset:{value:new Rn(0,0,0)},radius:{value:1}}]),vertexShader:oa.cubeNormals_vert,fragmentShader:oa.cubeNormals_frag},diamond:{uniforms:Fr([la.common,la.envmap,{inverseModelMatrix:{value:(new oi).identity()},modelOffsetMatrix:{value:(new oi).identity()},modelOffsetMatrixInv:{value:(new oi).identity()},radius:{value:1},centerOffset:{value:new Rn(0,0,0)},tCubeMapNormals:{value:null},envMapIntensity:{value:1},envMapRotation:{value:0},transmission:{value:0},transmissionSamplerSize:{value:new nn},transmissionSamplerMap:{value:null},rIndexDelta:{value:.012},squashFactor:{value:.98},geometryFactor:{value:.5},color:{value:new Rn(1,1,1)},colorCorrection:{value:new Rn(1,1,1)},boostFactors:{value:new Rn(.892,.892,.98595025)},gammaFactor:{value:1},absorptionFactor:{value:1},envMapRotationQuat:{value:new Tn}}]),vertexShader:oa.meshdiamond_vert,fragmentShader:oa.meshdiamond_frag},lambert:{uniforms:Fr([la.common,la.specularmap,la.envmap,la.aomap,la.lightmap,la.emissivemap,la.bumpmap,la.normalmap,la.displacementmap,la.fog,la.lights,{emissive:{value:new Ki(0)}}]),vertexShader:oa.meshlambert_vert,fragmentShader:oa.meshlambert_frag},phong:{uniforms:Fr([la.common,la.specularmap,la.envmap,la.aomap,la.lightmap,la.emissivemap,la.bumpmap,la.normalmap,la.displacementmap,la.fog,la.lights,{emissive:{value:new Ki(0)},specular:{value:new Ki(1118481)},shininess:{value:30}}]),vertexShader:oa.meshphong_vert,fragmentShader:oa.meshphong_frag},standard:{uniforms:Fr([la.common,la.envmap,la.aomap,la.lightmap,la.emissivemap,la.bumpmap,la.normalmap,la.displacementmap,la.roughnessmap,la.metalnessmap,la.fog,la.lights,{emissive:{value:new Ki(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:oa.meshphysical_vert,fragmentShader:oa.meshphysical_frag},toon:{uniforms:Fr([la.common,la.aomap,la.lightmap,la.emissivemap,la.bumpmap,la.normalmap,la.displacementmap,la.gradientmap,la.fog,la.lights,{emissive:{value:new Ki(0)}}]),vertexShader:oa.meshtoon_vert,fragmentShader:oa.meshtoon_frag},matcap:{uniforms:Fr([la.common,la.bumpmap,la.normalmap,la.displacementmap,la.fog,{matcap:{value:null}}]),vertexShader:oa.meshmatcap_vert,fragmentShader:oa.meshmatcap_frag},points:{uniforms:Fr([la.points,la.fog]),vertexShader:oa.points_vert,fragmentShader:oa.points_frag},dashed:{uniforms:Fr([la.common,la.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:oa.linedashed_vert,fragmentShader:oa.linedashed_frag},depth:{uniforms:Fr([la.common,la.displacementmap]),vertexShader:oa.depth_vert,fragmentShader:oa.depth_frag},normal:{uniforms:Fr([la.common,la.bumpmap,la.normalmap,la.displacementmap,{opacity:{value:1}}]),vertexShader:oa.meshnormal_vert,fragmentShader:oa.meshnormal_frag},sprite:{uniforms:Fr([la.sprite,la.fog]),vertexShader:oa.sprite_vert,fragmentShader:oa.sprite_frag},background:{uniforms:{uvTransform:{value:new rn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:oa.background_vert,fragmentShader:oa.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new rn}},vertexShader:oa.backgroundCube_vert,fragmentShader:oa.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:oa.cube_vert,fragmentShader:oa.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:oa.equirect_vert,fragmentShader:oa.equirect_frag},distanceRGBA:{uniforms:Fr([la.common,la.displacementmap,{referencePosition:{value:new Rn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:oa.distanceRGBA_vert,fragmentShader:oa.distanceRGBA_frag},shadow:{uniforms:Fr([la.lights,la.fog,{color:{value:new Ki(0)},opacity:{value:1}}]),vertexShader:oa.shadow_vert,fragmentShader:oa.shadow_frag}};ca.physical={uniforms:Fr([ca.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new rn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new rn},clearcoatNormalScale:{value:new nn(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new rn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new rn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new rn},sheen:{value:0},sheenColor:{value:new Ki(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new rn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new rn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new rn},transmissionSamplerSize:{value:new nn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new rn},attenuationDistance:{value:0},attenuationColor:{value:new Ki(0)},specularColor:{value:new Ki(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new rn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new rn},anisotropyVector:{value:new nn},anisotropyMap:{value:null},anisotropyMapTransform:{value:new rn}}]),vertexShader:oa.meshphysical_vert,fragmentShader:oa.meshphysical_frag};const ha={r:0,b:0,g:0},Aa=new mi,ua=new oi;function da(e,t,n,i,r,a,s){const o=new Ki(0);let l,c,h=!0===a?0:1,A=null,u=0,d=null;function p(e){let i=!0===e.isScene?e.background:null;return i&&i.isTexture&&(i=(e.backgroundBlurriness>0?n:t).get(i)),i}function f(t,n){t.getRGB(ha,Or(e)),i.buffers.color.setClear(ha.r,ha.g,ha.b,n,s)}return{getClearColor:function(){return o},setClearColor:function(e,t=1){o.set(e),h=t,f(o,h)},getClearAlpha:function(){return h},setClearAlpha:function(e){h=e,f(o,h)},render:function(t){let n=!1;const r=p(t);null===r?f(o,h):r&&r.isColor&&(f(r,1),n=!0);const a=e.xr.getEnvironmentBlendMode();"additive"===a?i.buffers.color.setClear(0,0,0,1,s):"alpha-blend"===a&&i.buffers.color.setClear(0,0,0,0,s),(e.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){const i=p(n);i&&(i.isCubeTexture||i.mapping===Oe)?(void 0===c&&(c=new Ur(new Pr(1,1,1),new Gr({name:"BackgroundCubeMaterial",uniforms:Nr(ca.backgroundCube.uniforms),vertexShader:ca.backgroundCube.vertexShader,fragmentShader:ca.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),Aa.copy(n.backgroundRotation),Aa.x*=-1,Aa.y*=-1,Aa.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(Aa.y*=-1,Aa.z*=-1),c.material.uniforms.envMap.value=i,c.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(ua.makeRotationFromEuler(Aa)),c.material.toneMapped=fn.getTransfer(i.colorSpace)!==Mt,A===i&&u===i.version&&d===e.toneMapping||(c.material.needsUpdate=!0,A=i,u=i.version,d=e.toneMapping),c.layers.enableAll(),t.unshift(c,c.geometry,c.material,0,0,null)):i&&i.isTexture&&(void 0===l&&(l=new Ur(new sa(2,2),new Gr({name:"BackgroundMaterial",uniforms:Nr(ca.background.uniforms),vertexShader:ca.background.vertexShader,fragmentShader:ca.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=i,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=fn.getTransfer(i.colorSpace)!==Mt,!0===i.matrixAutoUpdate&&i.updateMatrix(),l.material.uniforms.uvTransform.value.copy(i.matrix),A===i&&u===i.version&&d===e.toneMapping||(l.material.needsUpdate=!0,A=i,u=i.version,d=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))}}}function pa(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=c(null);let a=r,s=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function c(e){const t=[],i=[],r=[];for(let e=0;e<n;e++)t[e]=0,i[e]=0,r[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:i,attributeDivisors:r,object:e,attributes:{},index:null}}function h(){const e=a.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function A(e){u(e,0)}function u(t,n){const i=a.newAttributes,r=a.enabledAttributes,s=a.attributeDivisors;i[t]=1,0===r[t]&&(e.enableVertexAttribArray(t),r[t]=1),s[t]!==n&&(e.vertexAttribDivisor(t,n),s[t]=n)}function d(){const t=a.newAttributes,n=a.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==t[i]&&(e.disableVertexAttribArray(i),n[i]=0)}function p(t,n,i,r,a,s,o){!0===o?e.vertexAttribIPointer(t,n,i,a,s):e.vertexAttribPointer(t,n,i,r,a,s)}function f(){g(),s=!0,a!==r&&(a=r,o(a.object))}function g(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(n,r,l,f,g){let m=!1;const v=function(t,n,r){const a=!0===r.wireframe;let s=i[t.id];void 0===s&&(s={},i[t.id]=s);let o=s[n.id];void 0===o&&(o={},s[n.id]=o);let l=o[a];return void 0===l&&(l=c(e.createVertexArray()),o[a]=l),l}(f,l,r);a!==v&&(a=v,o(a.object)),m=function(e,t,n,i){const r=a.attributes,s=t.attributes;let o=0;const l=n.getAttributes();for(const t in l)if(l[t].location>=0){const n=r[t];let i=s[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;o++}return a.attributesNum!==o||a.index!==i}(n,f,l,g),m&&function(e,t,n,i){const r={},s=t.attributes;let o=0;const l=n.getAttributes();for(const t in l)if(l[t].location>=0){let n=s[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,o++}a.attributes=r,a.attributesNum=o,a.index=i}(n,f,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(m||s)&&(s=!1,function(n,i,r,a){h();const s=a.attributes,o=r.getAttributes(),l=i.defaultAttributeValues;for(const i in o){const r=o[i];if(r.location>=0){let o=s[i];if(void 0===o&&("instanceMatrix"===i&&n.instanceMatrix&&(o=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(o=n.instanceColor)),void 0!==o){const i=o.normalized,s=o.itemSize,l=t.get(o);if(void 0===l)continue;const c=l.buffer,h=l.type,d=l.bytesPerElement,f=h===e.INT||h===e.UNSIGNED_INT||1013===o.gpuType;if(o.isInterleavedBufferAttribute){const t=o.data,l=t.stride,g=o.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<r.locationSize;e++)u(r.location+e,t.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<r.locationSize;e++)A(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)p(r.location+e,s/r.locationSize,h,i,l*d,(g+s/r.locationSize*e)*d,f)}else{if(o.isInstancedBufferAttribute){for(let e=0;e<r.locationSize;e++)u(r.location+e,o.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let e=0;e<r.locationSize;e++)A(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)p(r.location+e,s/r.locationSize,h,i,s*d,s/r.locationSize*e*d,f)}}else if(void 0!==l){const t=l[i];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(r.location,t);break;case 3:e.vertexAttrib3fv(r.location,t);break;case 4:e.vertexAttrib4fv(r.location,t);break;default:e.vertexAttrib1fv(r.location,t)}}}}d()}(n,r,l,f),null!==g&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(g).buffer))},reset:f,resetDefaultState:g,dispose:function(){f();for(const e in i){const t=i[e];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete i[e]}},releaseStatesOfGeometry:function(e){if(void 0===i[e.id])return;const t=i[e.id];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete i[e.id]},releaseStatesOfProgram:function(e){for(const t in i){const n=i[t];if(void 0===n[e.id])continue;const r=n[e.id];for(const e in r)l(r[e].object),delete r[e];delete n[e.id]}},initAttributes:h,enableAttribute:A,disableUnusedAttributes:d}}function fa(e,t,n){let i;function r(t,r,a){0!==a&&(e.drawArraysInstanced(i,t,r,a),n.update(r,i,a))}this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.update(r,i,1)},this.renderInstances=r,this.renderMultiDraw=function(e,r,a){if(0===a)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,e,0,r,0,a);let s=0;for(let e=0;e<a;e++)s+=r[e];n.update(s,i,1)},this.renderMultiDrawInstances=function(e,a,s,o){if(0===s)return;const l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<e.length;t++)r(e[t],a[t],o[t]);else{l.multiDrawArraysInstancedWEBGL(i,e,0,a,0,o,0,s);let t=0;for(let e=0;e<s;e++)t+=a[e];for(let e=0;e<o.length;e++)n.update(t,i,o[e])}}}function ga(e,t,n,i){let r;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!==n.precision?n.precision:"highp";const o=a(s);o!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);const l=!0===n.logarithmicDepthBuffer,c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:a,textureFormatReadable:function(t){return t===tt||i.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===$e&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==Xe&&i.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==Ze&&!r)},precision:s,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,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),vertexTextures:h>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function ma(e){const t=this;let n=null,i=0,r=!1,a=!1;const s=new ea,o=new rn,l={value:null,needsUpdate:!1};function c(e,n,i,r){const a=null!==e?e.length:0;let c=null;if(0!==a){if(c=l.value,!0!==r||null===c){const t=i+4*a,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length<t)&&(c=new Float32Array(t));for(let t=0,n=i;t!==a;++t,n+=4)s.copy(e[t]).applyMatrix4(r,o),s.normal.toArray(c,n),c[n+3]=s.constant}l.value=c,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){const n=0!==e.length||t||0!==i||r;return r=t,i=e.length,n},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=c(e,t,0)},this.setState=function(s,o,h){const A=s.clippingPlanes,u=s.clipIntersection,d=s.clipShadows,p=e.get(s);if(!r||null===A||0===A.length||a&&!d)a?c(null):(l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0);else{const e=a?0:i,t=4*e;let r=p.clippingState||null;l.value=r,r=c(A,o,t,h);for(let e=0;e!==t;++e)r[e]=n[e];p.clippingState=r,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=e}}}function va(e){let t=new WeakMap;function n(e,t){return t===Fe?e.mapping=Pe:304===t&&(e.mapping=Ne),e}function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping;if(a===Fe||304===a){if(t.has(r))return n(t.get(r).texture,r.mapping);{const a=r.image;if(a&&a.height>0){const s=new Kr(a.height);return s.fromEquirectangularTexture(e,r),t.set(r,s),r.addEventListener("dispose",i),n(s.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}class Ea extends Hr{constructor(e=-1,t=1,n=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,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,n,i,r,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=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,a=n+e,s=i+t,o=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,a=r+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}this.projectionMatrix.makeOrthographic(r,a,s,o,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const 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}}const ba=[.125,.215,.35,.446,.526,.582],Ca=new Ea,_a=new Ki;let Ia=null,xa=0,ya=0,wa=!1;const Ma=(1+Math.sqrt(5))/2,Sa=1/Ma,Ba=[new Rn(-Ma,Sa,0),new Rn(Ma,Sa,0),new Rn(-Sa,0,Ma),new Rn(Sa,0,Ma),new Rn(0,Ma,-Sa),new Rn(0,Ma,Sa),new Rn(-1,1,-1),new Rn(1,1,-1),new Rn(-1,1,1),new Rn(1,1,1)];class Ta{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Ia=this._renderer.getRenderTarget(),xa=this._renderer.getActiveCubeFace(),ya=this._renderer.getActiveMipmapLevel(),wa=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Ua(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Qa(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.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._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Ia,xa,ya),this._renderer.xr.enabled=wa,e.scissorTest=!1,Da(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Pe||e.mapping===Ne?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Ia=this._renderer.getRenderTarget(),xa=this._renderer.getActiveCubeFace(),ya=this._renderer.getActiveMipmapLevel(),wa=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:qe,minFilter:qe,generateMipmaps:!1,type:$e,format:tt,colorSpace:It,depthBuffer:!1},i=Ra(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=Ra(e,t,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(e){const t=[],n=[],i=[];let r=e;const a=e-4+1+ba.length;for(let s=0;s<a;s++){const a=Math.pow(2,r);n.push(a);let o=1/a;s>e-4?o=ba[s-e+4-1]:0===s&&(o=0),i.push(o);const l=1/(a-2),c=-l,h=1+l,A=[c,c,h,c,h,h,c,c,h,h,c,h],u=6,d=6,p=3,f=2,g=1,m=new Float32Array(p*d*u),v=new Float32Array(f*d*u),E=new Float32Array(g*d*u);for(let e=0;e<u;e++){const t=e%3*2/3-1,n=e>2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];m.set(i,p*d*e),v.set(A,f*d*e);const r=[e,e,e,e,e,e];E.set(r,g*d*e)}const b=new gr;b.setAttribute("position",new ar(m,p)),b.setAttribute("uv",new ar(v,f)),b.setAttribute("faceIndex",new ar(E,g)),t.push(b),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(e,t,n){const i=new Float32Array(20),r=new Rn(0,1,0);return new Gr({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(i,e,t)}return i}_compileMaterial(e){const t=new Ur(this._lodPlanes[0],e);this._renderer.compile(t,Ca)}_sceneToCubeUV(e,t,n,i){const r=new qr(90,1,t,n),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,c=o.toneMapping;o.getClearColor(_a),o.toneMapping=0,o.autoClear=!1;const h=new er({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),A=new Ur(new Pr,h);let u=!1;const d=e.background;d?d.isColor&&(h.color.copy(d),e.background=null,u=!0):(h.color.copy(_a),u=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(r.up.set(0,a[t],0),r.lookAt(s[t],0,0)):1===n?(r.up.set(0,0,a[t]),r.lookAt(0,s[t],0)):(r.up.set(0,a[t],0),r.lookAt(0,0,s[t]));const l=this._cubeSize;Da(i,n*l,t>2?l:0,l,l),o.setRenderTarget(i),u&&o.render(A,r),o.render(e,r)}A.geometry.dispose(),A.material.dispose(),o.toneMapping=c,o.autoClear=l,e.background=d}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Pe||e.mapping===Ne;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Ua()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Qa());const r=i?this._cubemapMaterial:this._equirectMaterial,a=new Ur(this._lodPlanes[0],r);r.uniforms.envMap.value=e;const s=this._cubeSize;Da(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,Ca)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let t=1;t<i;t++){const n=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),r=Ba[(i-t-1)%Ba.length];this._blur(e,t-1,t,n,r)}t.autoClear=n}_blur(e,t,n,i,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,s){const o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new Ur(this._lodPlanes[i],l),h=l.uniforms,A=this._sizeLods[n]-1,u=isFinite(r)?Math.PI/(2*A):2*Math.PI/39,d=r/u,p=isFinite(r)?1+Math.floor(3*d):20;p>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${p} samples when the maximum is set to 20`);const f=[];let g=0;for(let e=0;e<20;++e){const t=e/d,n=Math.exp(-t*t/2);f.push(n),0===e?g+=n:e<p&&(g+=2*n)}for(let e=0;e<f.length;e++)f[e]=f[e]/g;h.envMap.value=e.texture,h.samples.value=p,h.weights.value=f,h.latitudinal.value="latitudinal"===a,s&&(h.poleAxis.value=s);const{_lodMax:m}=this;h.dTheta.value=u,h.mipInt.value=m-n;const v=this._sizeLods[i];Da(t,3*v*(i>m-4?i-m+4:0),4*(this._cubeSize-v),3*v,2*v),o.setRenderTarget(t),o.render(c,Ca)}}function Ra(e,t,n){const i=new Mn(e,t,n);return i.texture.mapping=Oe,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Da(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Qa(){return new Gr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Ua(){return new Gr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function La(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping,s=a===Fe||304===a,o=a===Pe||a===Ne;if(s||o){let a=t.get(r);const l=void 0!==a?a.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new Ta(e)),a=s?n.fromEquirectangular(r,a):n.fromCubemap(r,a),a.texture.pmremVersion=r.pmremVersion,t.set(r,a),a.texture;if(void 0!==a)return a.texture;{const l=r.image;return s&&l&&l.height>0||o&&l&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(l)?(null===n&&(n=new Ta(e)),a=s?n.fromEquirectangular(r):n.fromCubemap(r),a.texture.pmremVersion=r.pmremVersion,t.set(r,a),r.addEventListener("dispose",i),a.texture):null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function Pa(e){const t={};function n(n){if(void 0!==t[n])return t[n];let i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){const t=n(e);return null===t&&hn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function Na(e,t,n,i){const r={},a=new WeakMap;function s(e){const o=e.target;null!==o.index&&t.remove(o.index);for(const e in o.attributes)t.remove(o.attributes[e]);for(const e in o.morphAttributes){const n=o.morphAttributes[e];for(let e=0,i=n.length;e<i;e++)t.remove(n[e])}o.removeEventListener("dispose",s),delete r[o.id];const l=a.get(o);l&&(t.remove(l),a.delete(o)),i.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(e){const n=[],i=e.index,r=e.attributes.position;let s=0;if(null!==i){const e=i.array;s=i.version;for(let t=0,i=e.length;t<i;t+=3){const i=e[t+0],r=e[t+1],a=e[t+2];n.push(i,r,r,a,a,i)}}else{if(void 0===r)return;{const e=r.array;s=r.version;for(let t=0,i=e.length/3-1;t<i;t+=3){const e=t+0,i=t+1,r=t+2;n.push(e,i,i,r,r,e)}}}const o=new(sn(n)?or:sr)(n,1);o.version=s;const l=a.get(e);l&&t.remove(l),a.set(e,o)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",s),r[t.id]=!0,n.memory.geometries++),t},update:function(n){const i=n.attributes;for(const n in i)t.update(i[n],e.ARRAY_BUFFER);const r=n.morphAttributes;for(const n in r){const i=r[n];for(let n=0,r=i.length;n<r;n++)t.update(i[n],e.ARRAY_BUFFER)}},getWireframeAttribute:function(e){const t=a.get(e);if(t){const n=e.index;null!==n&&t.version<n.version&&o(e)}else o(e);return a.get(e)}}}function Fa(e,t,n){let i,r,a;function s(t,s,o){0!==o&&(e.drawElementsInstanced(i,s,r,t*a,o),n.update(s,i,o))}this.setMode=function(e){i=e},this.setIndex=function(e){r=e.type,a=e.bytesPerElement},this.render=function(t,s){e.drawElements(i,s,r,t*a),n.update(s,i,1)},this.renderInstances=s,this.renderMultiDraw=function(e,a,s){if(0===s)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,a,0,r,e,0,s);let o=0;for(let e=0;e<s;e++)o+=a[e];n.update(o,i,1)},this.renderMultiDrawInstances=function(e,o,l,c){if(0===l)return;const h=t.get("WEBGL_multi_draw");if(null===h)for(let t=0;t<e.length;t++)s(e[t]/a,o[t],c[t]);else{h.multiDrawElementsInstancedWEBGL(i,o,0,r,e,0,c,0,l);let t=0;for(let e=0;e<l;e++)t+=o[e];for(let e=0;e<c.length;e++)n.update(t,i,c[e])}}}function Oa(e){const 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(n,i,r){switch(t.calls++,i){case e.TRIANGLES:t.triangles+=r*(n/3);break;case e.LINES:t.lines+=r*(n/2);break;case e.LINE_STRIP:t.lines+=r*(n-1);break;case e.LINE_LOOP:t.lines+=r*n;break;case e.POINTS:t.points+=r*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function ka(e,t,n){const i=new WeakMap,r=new yn;return{update:function(a,s,o){const l=a.morphTargetInfluences,c=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,h=void 0!==c?c.length:0;let A=i.get(s);if(void 0===A||A.count!==h){void 0!==A&&A.texture.dispose();const u=void 0!==s.morphAttributes.position,d=void 0!==s.morphAttributes.normal,p=void 0!==s.morphAttributes.color,f=s.morphAttributes.position||[],g=s.morphAttributes.normal||[],m=s.morphAttributes.color||[];let v=0;!0===u&&(v=1),!0===d&&(v=2),!0===p&&(v=3);let E=s.attributes.position.count*v,b=1;E>t.maxTextureSize&&(b=Math.ceil(E/t.maxTextureSize),E=t.maxTextureSize);const C=new Float32Array(E*b*4*h),_=new Sn(C,E,b,h);_.type=Ze,_.needsUpdate=!0;const I=4*v;for(let y=0;y<h;y++){const w=f[y],M=g[y],S=m[y],B=E*b*4*y;for(let T=0;T<w.count;T++){const R=T*I;!0===u&&(r.fromBufferAttribute(w,T),C[B+R+0]=r.x,C[B+R+1]=r.y,C[B+R+2]=r.z,C[B+R+3]=0),!0===d&&(r.fromBufferAttribute(M,T),C[B+R+4]=r.x,C[B+R+5]=r.y,C[B+R+6]=r.z,C[B+R+7]=0),!0===p&&(r.fromBufferAttribute(S,T),C[B+R+8]=r.x,C[B+R+9]=r.y,C[B+R+10]=r.z,C[B+R+11]=4===S.itemSize?r.w:1)}}function x(){_.dispose(),i.delete(s),s.removeEventListener("dispose",x)}A={count:h,texture:_,size:new nn(E,b)},i.set(s,A),s.addEventListener("dispose",x)}if(!0===a.isInstancedMesh&&null!==a.morphTexture)o.getUniforms().setValue(e,"morphTexture",a.morphTexture,n);else{let D=0;for(let U=0;U<l.length;U++)D+=l[U];const Q=s.morphTargetsRelative?1:1-D;o.getUniforms().setValue(e,"morphTargetBaseInfluence",Q),o.getUniforms().setValue(e,"morphTargetInfluences",l)}o.getUniforms().setValue(e,"morphTargetsTexture",A.texture,n),o.getUniforms().setValue(e,"morphTargetsTextureSize",A.size)}}}function Ga(e,t,n,i){let r=new WeakMap;function a(e){const t=e.target;t.removeEventListener("dispose",a),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(s){const o=i.render.frame,l=s.geometry,c=t.get(s,l);if(r.get(c)!==o&&(t.update(c),r.set(c,o)),s.isInstancedMesh&&(!1===s.hasEventListener("dispose",a)&&s.addEventListener("dispose",a),r.get(s)!==o&&(n.update(s.instanceMatrix,e.ARRAY_BUFFER),null!==s.instanceColor&&n.update(s.instanceColor,e.ARRAY_BUFFER),r.set(s,o))),s.isSkinnedMesh){const e=s.skeleton;r.get(e)!==o&&(e.update(),r.set(e,o))}return c},dispose:function(){r=new WeakMap}}}class Ha extends xn{constructor(e,t,n,i,r,a,s,o,l,c=1026){if(c!==nt&&c!==it)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===nt&&(n=Je),void 0===n&&c===it&&(n=et),super(null,i,r,a,s,o,c,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==s?s:ze,this.minFilter=void 0!==o?o:ze,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}const za=new xn,Va=new Ha(1,1);Va.compareFunction=515;const Wa=new Sn,qa=new Bn,ja=new Xr,Ya=[],Xa=[],Ka=new Float32Array(16),Ja=new Float32Array(9),Za=new Float32Array(4);function $a(e,t,n){const i=e[0];if(i<=0||i>0)return e;const r=t*n;let a=Ya[r];if(void 0===a&&(a=new Float32Array(r),Ya[r]=a),0!==t){i.toArray(a,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(a,r)}return a}function es(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function ts(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function ns(e,t){let n=Xa[t];void 0===n&&(n=new Int32Array(t),Xa[t]=n);for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function is(e,t){const n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function rs(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(es(n,t))return;e.uniform2fv(this.addr,t),ts(n,t)}}function as(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(es(n,t))return;e.uniform3fv(this.addr,t),ts(n,t)}}function ss(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(es(n,t))return;e.uniform4fv(this.addr,t),ts(n,t)}}function os(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(es(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),ts(n,t)}else{if(es(n,i))return;Za.set(i),e.uniformMatrix2fv(this.addr,!1,Za),ts(n,i)}}function ls(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(es(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),ts(n,t)}else{if(es(n,i))return;Ja.set(i),e.uniformMatrix3fv(this.addr,!1,Ja),ts(n,i)}}function cs(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(es(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),ts(n,t)}else{if(es(n,i))return;Ka.set(i),e.uniformMatrix4fv(this.addr,!1,Ka),ts(n,i)}}function hs(e,t){const n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function As(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(es(n,t))return;e.uniform2iv(this.addr,t),ts(n,t)}}function us(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(es(n,t))return;e.uniform3iv(this.addr,t),ts(n,t)}}function ds(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(es(n,t))return;e.uniform4iv(this.addr,t),ts(n,t)}}function ps(e,t){const n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function fs(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(es(n,t))return;e.uniform2uiv(this.addr,t),ts(n,t)}}function gs(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(es(n,t))return;e.uniform3uiv(this.addr,t),ts(n,t)}}function ms(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(es(n,t))return;e.uniform4uiv(this.addr,t),ts(n,t)}}function vs(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r);const a=this.type===e.SAMPLER_2D_SHADOW?Va:za;n.setTexture2D(t||a,r)}function Es(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||qa,r)}function bs(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(t||ja,r)}function Cs(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||Wa,r)}function _s(e,t){e.uniform1fv(this.addr,t)}function Is(e,t){const n=$a(t,this.size,2);e.uniform2fv(this.addr,n)}function xs(e,t){const n=$a(t,this.size,3);e.uniform3fv(this.addr,n)}function ys(e,t){const n=$a(t,this.size,4);e.uniform4fv(this.addr,n)}function ws(e,t){const n=$a(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function Ms(e,t){const n=$a(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Ss(e,t){const n=$a(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function Bs(e,t){e.uniform1iv(this.addr,t)}function Ts(e,t){e.uniform2iv(this.addr,t)}function Rs(e,t){e.uniform3iv(this.addr,t)}function Ds(e,t){e.uniform4iv(this.addr,t)}function Qs(e,t){e.uniform1uiv(this.addr,t)}function Us(e,t){e.uniform2uiv(this.addr,t)}function Ls(e,t){e.uniform3uiv(this.addr,t)}function Ps(e,t){e.uniform4uiv(this.addr,t)}function Ns(e,t,n){const i=this.cache,r=t.length,a=ns(n,r);es(i,a)||(e.uniform1iv(this.addr,a),ts(i,a));for(let e=0;e!==r;++e)n.setTexture2D(t[e]||za,a[e])}function Fs(e,t,n){const i=this.cache,r=t.length,a=ns(n,r);es(i,a)||(e.uniform1iv(this.addr,a),ts(i,a));for(let e=0;e!==r;++e)n.setTexture3D(t[e]||qa,a[e])}function Os(e,t,n){const i=this.cache,r=t.length,a=ns(n,r);es(i,a)||(e.uniform1iv(this.addr,a),ts(i,a));for(let e=0;e!==r;++e)n.setTextureCube(t[e]||ja,a[e])}function ks(e,t,n){const i=this.cache,r=t.length,a=ns(n,r);es(i,a)||(e.uniform1iv(this.addr,a),ts(i,a));for(let e=0;e!==r;++e)n.setTexture2DArray(t[e]||Wa,a[e])}class Gs{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return is;case 35664:return rs;case 35665:return as;case 35666:return ss;case 35674:return os;case 35675:return ls;case 35676:return cs;case 5124:case 35670:return hs;case 35667:case 35671:return As;case 35668:case 35672:return us;case 35669:case 35673:return ds;case 5125:return ps;case 36294:return fs;case 36295:return gs;case 36296:return ms;case 35678:case 36198:case 36298:case 36306:case 35682:return vs;case 35679:case 36299:case 36307:return Es;case 35680:case 36300:case 36308:case 36293:return bs;case 36289:case 36303:case 36311:case 36292:return Cs}}(t.type)}}class Hs{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return _s;case 35664:return Is;case 35665:return xs;case 35666:return ys;case 35674:return ws;case 35675:return Ms;case 35676:return Ss;case 5124:case 35670:return Bs;case 35667:case 35671:return Ts;case 35668:case 35672:return Rs;case 35669:case 35673:return Ds;case 5125:return Qs;case 36294:return Us;case 36295:return Ls;case 36296:return Ps;case 35678:case 36198:case 36298:case 36306:case 35682:return Ns;case 35679:case 36299:case 36307:return Fs;case 35680:case 36300:case 36308:case 36293:return Os;case 36289:case 36303:case 36311:case 36292:return ks}}(t.type)}}class zs{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let r=0,a=i.length;r!==a;++r){const a=i[r];a.setValue(e,t[a.id],n)}}}const Vs=/(\w+)(\])?(\[|\.)?/g;function Ws(e,t){e.seq.push(t),e.map[t.id]=t}function qs(e,t,n){const i=e.name,r=i.length;for(Vs.lastIndex=0;;){const a=Vs.exec(i),s=Vs.lastIndex;let o=a[1];const l="]"===a[2],c=a[3];if(l&&(o|=0),void 0===c||"["===c&&s+2===r){Ws(n,void 0===c?new Gs(o,e,t):new Hs(o,e,t));break}{let e=n.map[o];void 0===e&&(e=new zs(o),Ws(n,e)),n=e}}}class js{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const n=e.getActiveUniform(t,i);qs(n,e.getUniformLocation(t,n.name),this)}}setValue(e,t,n,i){const r=this.map[t];void 0!==r&&r.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];void 0!==i&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,a=t.length;r!==a;++r){const a=t[r],s=n[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const r=e[i];r.id in t&&n.push(r)}return n}}function Ys(e,t,n){const i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}let Xs=0;function Ks(e,t,n){const i=e.getShaderParameter(t,e.COMPILE_STATUS),r=e.getShaderInfoLog(t).trim();if(i&&""===r)return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const i=parseInt(a[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){const n=e.split("\n"),i=[],r=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let e=r;e<a;e++){const r=e+1;i.push(`${r===t?">":" "} ${r}: ${n[e]}`)}return i.join("\n")}(e.getShaderSource(t),i)}return r}function Js(e,t){const n=function(e){const t=fn.getPrimaries(fn.workingColorSpace),n=fn.getPrimaries(e);let i;switch(t===n?i="":t===Bt&&n===St?i="LinearDisplayP3ToLinearSRGB":t===St&&n===Bt&&(i="LinearSRGBToLinearDisplayP3"),e){case It:case yt:return[i,"LinearTransferOETF"];case _t:case xt:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),[i,"LinearTransferOETF"]}}(t);return`vec4 ${e}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function Zs(e,t){let n;switch(t){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 6:n="AgX";break;case 7:n="Neutral";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function $s(e){return""!==e}function eo(e,t){const n=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,n).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 to(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const no=/^[ \t]*#include +<([\w\d./]+)>/gm;function io(e){return e.replace(no,ao)}const ro=new Map;function ao(e,t){let n=oa[t];if(void 0===n){const e=ro.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");n=oa[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return io(n)}const so=/#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 oo(e){return e.replace(so,lo)}function lo(e,t,n,i){let r="";for(let e=parseInt(t);e<parseInt(n);e++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return r}function co(e){let t=`precision ${e.precision} float;\n\tprecision ${e.precision} int;\n\tprecision ${e.precision} sampler2D;\n\tprecision ${e.precision} samplerCube;\n\tprecision ${e.precision} sampler3D;\n\tprecision ${e.precision} sampler2DArray;\n\tprecision ${e.precision} sampler2DShadow;\n\tprecision ${e.precision} samplerCubeShadow;\n\tprecision ${e.precision} sampler2DArrayShadow;\n\tprecision ${e.precision} isampler2D;\n\tprecision ${e.precision} isampler3D;\n\tprecision ${e.precision} isamplerCube;\n\tprecision ${e.precision} isampler2DArray;\n\tprecision ${e.precision} usampler2D;\n\tprecision ${e.precision} usampler3D;\n\tprecision ${e.precision} usamplerCube;\n\tprecision ${e.precision} usampler2DArray;\n\t`;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}function ho(e,t,n,i){const r=e.getContext(),a=n.defines;let s=n.vertexShader,o=n.fragmentShader;const l=function(e){let t="SHADOWMAP_TYPE_BASIC";return 1===e.shadowMapType?t="SHADOWMAP_TYPE_PCF":2===e.shadowMapType?t="SHADOWMAP_TYPE_PCF_SOFT":3===e.shadowMapType&&(t="SHADOWMAP_TYPE_VSM"),t}(n),c=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 300:t="ENVMAP_TYPE_TEXTURE_2D";break;case Pe:case Ne:t="ENVMAP_TYPE_CUBE";break;case Oe:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),h=function(e){let t="ENVMAP_MODE_REFLECTION";return e.envMap&&e.envMapMode===Ne&&(t="ENVMAP_MODE_REFRACTION"),t}(n),A=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(n),u=function(e){const t=e.envMapCubeUVHeight;if(null===t)return null;const n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),d=function(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter($s).join("\n")}(n),p=function(e){const t=[];for(const n in e){const i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(a),f=r.createProgram();let g,m,v=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,p].filter($s).join("\n"),g.length>0&&(g+="\n"),m=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,p].filter($s).join("\n"),m.length>0&&(m+="\n")):(g=[co(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,p,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.fixedEnvMapDirection?"#define FIX_ENV_DIRECTION":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter($s).join("\n"),m=[co(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,p,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+A:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.fixedEnvMapDirection?"#define FIX_ENV_DIRECTION":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?oa.tonemapping_pars_fragment:"",0!==n.toneMapping?Zs("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",oa.colorspace_pars_fragment,Js("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter($s).join("\n")),s=io(s),s=eo(s,n),s=to(s,n),o=io(o),o=eo(o,n),o=to(o,n),o=function(e,t){return e.replace(/RAY_BOUNCES/g,t.rayBounces)}(o,n),o=function(e,t){return e.replace(/DIA_ORIENT_ENVMAP/g,t.diamondOrientedEnvMap)}(o,n),s=oo(s),o=oo(o),!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",g=[d,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,m=["#define varying in",n.glslVersion===kt?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===kt?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+m);const E=v+g+s,b=v+m+o,C=Ys(r,r.VERTEX_SHADER,E),_=Ys(r,r.FRAGMENT_SHADER,b);function I(t){if(e.debug.checkShaderErrors){const n=r.getProgramInfoLog(f).trim(),i=r.getShaderInfoLog(C).trim(),a=r.getShaderInfoLog(_).trim();let s=!0,o=!0;if(!1===r.getProgramParameter(f,r.LINK_STATUS))if(s=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(r,f,C,_);else{const e=Ks(r,C,"vertex"),i=Ks(r,_,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(f,r.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+n+"\n"+e+"\n"+i)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==i&&""!==a||(o=!1);o&&(t.diagnostics={runnable:s,programLog:n,vertexShader:{log:i,prefix:g},fragmentShader:{log:a,prefix:m}})}r.deleteShader(C),r.deleteShader(_),x=new js(r,f),y=function(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const i=e.getActiveAttrib(t,r),a=i.name;let s=1;i.type===e.FLOAT_MAT2&&(s=2),i.type===e.FLOAT_MAT3&&(s=3),i.type===e.FLOAT_MAT4&&(s=4),n[a]={type:i.type,location:e.getAttribLocation(t,a),locationSize:s}}return n}(r,f)}let x,y;r.attachShader(f,C),r.attachShader(f,_),void 0!==n.index0AttributeName?r.bindAttribLocation(f,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(f,0,"position"),r.linkProgram(f),this.getUniforms=function(){return void 0===x&&I(this),x},this.getAttributes=function(){return void 0===y&&I(this),y};let w=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===w&&(w=r.getProgramParameter(f,37297)),w},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(f),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Xs++,this.cacheKey=t,this.usedTimes=1,this.program=f,this.vertexShader=C,this.fragmentShader=_,this}let Ao=0;class uo{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return!1===a.has(i)&&(a.add(i),i.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const e of t)e.usedTimes--,0===e.usedTimes&&this.shaderCache.delete(e.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){const t=this.materialCache;let n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return void 0===n&&(n=new po(e),t.set(e,n)),n}}class po{constructor(e){this.id=Ao++,this.code=e,this.usedTimes=0}}function fo(e,t,n,i,r,a,s){const o=new vi,l=new uo,c=new Set,h=[],A=r.logarithmicDepthBuffer,u=r.vertexTextures;let d=r.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",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",MeshDiamondMaterial:"diamond",CubeNormalsMaterial:"cubeNormals"};function f(e){return c.add(e),0===e?"uv":`uv${e}`}return{getParameters:function(a,o,h,g,m){const v=g.fog,E=m.geometry,b=a.isMeshStandardMaterial?g.environment:null,C=(a.isMeshStandardMaterial?n:t).get(a.envMap||b),_=C&&C.mapping===Oe?C.image.height:null,I=p[a.type];null!==a.precision&&(d=r.getMaxPrecision(a.precision),d!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",d,"instead."));const x=E.morphAttributes.position||E.morphAttributes.normal||E.morphAttributes.color,y=void 0!==x?x.length:0;let w,M,S,B,T=0;if(void 0!==E.morphAttributes.position&&(T=1),void 0!==E.morphAttributes.normal&&(T=2),void 0!==E.morphAttributes.color&&(T=3),I){const e=ca[I];w=e.vertexShader,M=e.fragmentShader}else w=a.vertexShader,M=a.fragmentShader,l.update(a),S=l.getVertexShaderID(a),B=l.getFragmentShaderID(a);const R=e.getRenderTarget(),D=!0===m.isInstancedMesh,Q=!0===m.isBatchedMesh,U=!!a.map,L=!!a.matcap,P=!!C,N=!!a.aoMap,F=!!a.lightMap,O=!!a.bumpMap,k=!!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,Y=a.iridescence>0,X=a.sheen>0,K=a.transmission>0,J=W&&!!a.anisotropyMap,Z=q&&!!a.clearcoatMap,$=q&&!!a.clearcoatNormalMap,ee=q&&!!a.clearcoatRoughnessMap,te=Y&&!!a.iridescenceMap,ne=Y&&!!a.iridescenceThicknessMap,ie=X&&!!a.sheenColorMap,re=X&&!!a.sheenRoughnessMap,ae=!!a.specularMap,se=!!a.specularColorMap,oe=!!a.specularIntensityMap,le=K&&!!a.transmissionMap,ce=K&&!!a.thicknessMap,he=!!a.gradientMap,Ae=!!a.alphaMap,ue=a.alphaTest>0,de=!!a.alphaHash,pe=!!a.extensions;let fe=0;a.toneMapped&&(null!==R&&!0!==R.isXRRenderTarget||(fe=e.toneMapping));const ge={shaderID:I,shaderType:a.type,shaderName:a.name,vertexShader:w,fragmentShader:M,defines:a.defines,customVertexShaderID:S,customFragmentShaderID:B,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:d,batching:Q,batchingColor:Q&&null!==m._colorsTexture,instancing:D,instancingColor:D&&null!==m.instanceColor,instancingMorph:D&&null!==m.morphTexture,supportsVertexTextures:u,outputColorSpace:null===R?e.outputColorSpace:!0===R.isXRRenderTarget?R.texture.colorSpace:It,alphaToCoverage:!!a.alphaToCoverage,map:U,matcap:L,envMap:P,envMapMode:P&&C.mapping,envMapCubeUVHeight:_,aoMap:N,lightMap:F,bumpMap:O,normalMap:k,displacementMap:u&&G,emissiveMap:H,normalMapObjectSpace:k&&1===a.normalMapType,normalMapTangentSpace:k&&0===a.normalMapType,metalnessMap:z,roughnessMap:V,anisotropy:W,anisotropyMap:J,clearcoat:q,clearcoatMap:Z,clearcoatNormalMap:$,clearcoatRoughnessMap:ee,dispersion:j,iridescence:Y,iridescenceMap:te,iridescenceThicknessMap:ne,sheen:X,sheenColorMap:ie,sheenRoughnessMap:re,specularMap:ae,specularColorMap:se,specularIntensityMap:oe,transmission:K,transmissionMap:le,thicknessMap:ce,gradientMap:he,opaque:!1===a.transparent&&1===a.blending&&!1===a.alphaToCoverage,alphaMap:Ae,alphaTest:ue,alphaHash:de,combine:a.combine,mapUv:U&&f(a.map.channel),aoMapUv:N&&f(a.aoMap.channel),lightMapUv:F&&f(a.lightMap.channel),bumpMapUv:O&&f(a.bumpMap.channel),normalMapUv:k&&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:Z&&f(a.clearcoatMap.channel),clearcoatNormalMapUv:$&&f(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ee&&f(a.clearcoatRoughnessMap.channel),iridescenceMapUv:te&&f(a.iridescenceMap.channel),iridescenceThicknessMapUv:ne&&f(a.iridescenceThicknessMap.channel),sheenColorMapUv:ie&&f(a.sheenColorMap.channel),sheenRoughnessMapUv:re&&f(a.sheenRoughnessMap.channel),specularMapUv:ae&&f(a.specularMap.channel),specularColorMapUv:se&&f(a.specularColorMap.channel),specularIntensityMapUv:oe&&f(a.specularIntensityMap.channel),transmissionMapUv:le&&f(a.transmissionMap.channel),thicknessMapUv:ce&&f(a.thicknessMap.channel),alphaMapUv:Ae&&f(a.alphaMap.channel),vertexTangents:!!E.attributes.tangent&&(k||W),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!E.attributes.color&&4===E.attributes.color.itemSize,pointsUvs:!0===m.isPoints&&!!E.attributes.uv&&(U||Ae),fog:!!v,useFog:!0===a.fog,fogExp2:!!v&&v.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:A,skinning:!0===m.isSkinnedMesh,morphTargets:void 0!==E.morphAttributes.position,morphNormals:void 0!==E.morphAttributes.normal,morphColors:void 0!==E.morphAttributes.color,morphTargetsCount:y,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,diamondOrientedEnvMap:a.diamondOrientedEnvMap,rayBounces:a.rayBounces,fixedEnvMapDirection:a.fixedEnvMapDirection,shadowMapEnabled:e.shadowMap.enabled&&h.length>0,shadowMapType:e.shadowMap.type,toneMapping:fe,decodeVideoTexture:U&&!0===a.map.isVideoTexture&&fn.getTransfer(a.map.colorSpace)===Mt,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:pe&&!0===a.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(pe&&!0===a.extensions.multiDraw||Q)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return ge.vertexUv1s=c.has(1),ge.vertexUv2s=c.has(2),ge.vertexUv3s=c.has(3),c.clear(),ge},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){o.disableAll(),t.supportsVertexTextures&&o.enable(0),t.instancing&&o.enable(1),t.instancingColor&&o.enable(2),t.instancingMorph&&o.enable(3),t.matcap&&o.enable(4),t.envMap&&o.enable(5),t.normalMapObjectSpace&&o.enable(6),t.normalMapTangentSpace&&o.enable(7),t.clearcoat&&o.enable(8),t.iridescence&&o.enable(9),t.alphaTest&&o.enable(10),t.vertexColors&&o.enable(11),t.vertexAlphas&&o.enable(12),t.vertexUv1s&&o.enable(13),t.vertexUv2s&&o.enable(14),t.vertexUv3s&&o.enable(15),t.vertexTangents&&o.enable(16),t.anisotropy&&o.enable(17),t.alphaHash&&o.enable(18),t.batching&&o.enable(19),t.dispersion&&o.enable(20),t.batchingColor&&o.enable(21),e.push(o.mask),o.disableAll(),t.fog&&o.enable(0),t.useFog&&o.enable(1),t.flatShading&&o.enable(2),t.logarithmicDepthBuffer&&o.enable(3),t.skinning&&o.enable(4),t.morphTargets&&o.enable(5),t.morphNormals&&o.enable(6),t.morphColors&&o.enable(7),t.premultipliedAlpha&&o.enable(8),t.shadowMapEnabled&&o.enable(9),t.doubleSided&&o.enable(10),t.flipSided&&o.enable(11),t.useDepthPacking&&o.enable(12),t.dithering&&o.enable(13),t.transmission&&o.enable(14),t.sheen&&o.enable(15),t.opaque&&o.enable(16),t.pointsUvs&&o.enable(17),t.decodeVideoTexture&&o.enable(18),t.alphaToCoverage&&o.enable(19),e.push(o.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=p[e.type];let n;if(t){const e=ca[t];n=kr.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=h.length;e<t;e++){const t=h[e];if(t.cacheKey===n){i=t,++i.usedTimes;break}}return void 0===i&&(i=new ho(e,n,t,a),h.push(i)),i},releaseProgram:function(e){if(0==--e.usedTimes){const t=h.indexOf(e);h[t]=h[h.length-1],h.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:h,dispose:function(){l.dispose()}}}function go(){let e=new WeakMap;return{get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function mo(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 vo(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 Eo(){const e=[];let t=0;const n=[],i=[],r=[];function a(n,i,r,a,s,o){let l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:a,renderOrder:n.renderOrder,z:s,group:o},e[t]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=s,l.group=o),t++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){t=0,n.length=0,i.length=0,r.length=0},push:function(e,t,s,o,l,c){const h=a(e,t,s,o,l,c);s.transmission>0?i.push(h):!0===s.transparent?r.push(h):n.push(h)},unshift:function(e,t,s,o,l,c){const h=a(e,t,s,o,l,c);s.transmission>0?i.unshift(h):!0===s.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=t,i=e.length;n<i;n++){const t=e[n];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){n.length>1&&n.sort(e||mo),i.length>1&&i.sort(t||vo),r.length>1&&r.sort(t||vo)}}}function bo(){let e=new WeakMap;return{get:function(t,n){const i=e.get(t);let r;return void 0===i?(r=new Eo,e.set(t,[r])):n>=i.length?(r=new Eo,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function Co(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new Rn,color:new Ki};break;case"SpotLight":n={position:new Rn,direction:new Rn,color:new Ki,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Rn,color:new Ki,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Rn,skyColor:new Ki,groundColor:new Ki};break;case"RectAreaLight":n={color:new Ki,position:new Rn,halfWidth:new Rn,halfHeight:new Rn}}return e[t.id]=n,n}}}let _o=0;function Io(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function xo(e){const t=new Co,n=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new nn};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new nn,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),i={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++)i.probe.push(new Rn);const r=new Rn,a=new oi,s=new oi;return{setup:function(r){let a=0,s=0,o=0;for(let e=0;e<9;e++)i.probe[e].set(0,0,0);let l=0,c=0,h=0,A=0,u=0,d=0,p=0,f=0,g=0,m=0,v=0;r.sort(Io);for(let e=0,E=r.length;e<E;e++){const E=r[e],b=E.color,C=E.intensity,_=E.distance,I=E.shadow&&E.shadow.map?E.shadow.map.texture:null;if(E.isAmbientLight)a+=b.r*C,s+=b.g*C,o+=b.b*C;else if(E.isLightProbe){for(let e=0;e<9;e++)i.probe[e].addScaledVector(E.sh.coefficients[e],C);v++}else if(E.isDirectionalLight){const e=t.get(E);if(e.color.copy(E.color).multiplyScalar(E.intensity),E.castShadow){const e=E.shadow,t=n.get(E);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,i.directionalShadow[l]=t,i.directionalShadowMap[l]=I,i.directionalShadowMatrix[l]=E.shadow.matrix,d++}i.directional[l]=e,l++}else if(E.isSpotLight){const e=t.get(E);e.position.setFromMatrixPosition(E.matrixWorld),e.color.copy(b).multiplyScalar(C),e.distance=_,e.coneCos=Math.cos(E.angle),e.penumbraCos=Math.cos(E.angle*(1-E.penumbra)),e.decay=E.decay,i.spot[h]=e;const r=E.shadow;if(E.map&&(i.spotLightMap[g]=E.map,g++,r.updateMatrices(E),E.castShadow&&m++),i.spotLightMatrix[h]=r.matrix,E.castShadow){const e=n.get(E);e.shadowIntensity=r.intensity,e.shadowBias=r.bias,e.shadowNormalBias=r.normalBias,e.shadowRadius=r.radius,e.shadowMapSize=r.mapSize,i.spotShadow[h]=e,i.spotShadowMap[h]=I,f++}h++}else if(E.isRectAreaLight){const e=t.get(E);e.color.copy(b).multiplyScalar(C),e.halfWidth.set(.5*E.width,0,0),e.halfHeight.set(0,.5*E.height,0),i.rectArea[A]=e,A++}else if(E.isPointLight){const e=t.get(E);if(e.color.copy(E.color).multiplyScalar(E.intensity),e.distance=E.distance,e.decay=E.decay,E.castShadow){const e=E.shadow,t=n.get(E);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,i.pointShadow[c]=t,i.pointShadowMap[c]=I,i.pointShadowMatrix[c]=E.shadow.matrix,p++}i.point[c]=e,c++}else if(E.isHemisphereLight){const e=t.get(E);e.skyColor.copy(E.color).multiplyScalar(C),e.groundColor.copy(E.groundColor).multiplyScalar(C),i.hemi[u]=e,u++}}A>0&&(!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=la.LTC_FLOAT_1,i.rectAreaLTC2=la.LTC_FLOAT_2):(i.rectAreaLTC1=la.LTC_HALF_1,i.rectAreaLTC2=la.LTC_HALF_2)),i.ambient[0]=a,i.ambient[1]=s,i.ambient[2]=o;const E=i.hash;E.directionalLength===l&&E.pointLength===c&&E.spotLength===h&&E.rectAreaLength===A&&E.hemiLength===u&&E.numDirectionalShadows===d&&E.numPointShadows===p&&E.numSpotShadows===f&&E.numSpotMaps===g&&E.numLightProbes===v||(i.directional.length=l,i.spot.length=h,i.rectArea.length=A,i.point.length=c,i.hemi.length=u,i.directionalShadow.length=d,i.directionalShadowMap.length=d,i.pointShadow.length=p,i.pointShadowMap.length=p,i.spotShadow.length=f,i.spotShadowMap.length=f,i.directionalShadowMatrix.length=d,i.pointShadowMatrix.length=p,i.spotLightMatrix.length=f+g-m,i.spotLightMap.length=g,i.numSpotLightShadowsWithMaps=m,i.numLightProbes=v,E.directionalLength=l,E.pointLength=c,E.spotLength=h,E.rectAreaLength=A,E.hemiLength=u,E.numDirectionalShadows=d,E.numPointShadows=p,E.numSpotShadows=f,E.numSpotMaps=g,E.numLightProbes=v,i.version=_o++)},setupView:function(e,t){let n=0,o=0,l=0,c=0,h=0;const A=t.matrixWorldInverse;for(let t=0,u=e.length;t<u;t++){const u=e[t];if(u.isDirectionalLight){const e=i.directional[n];e.direction.setFromMatrixPosition(u.matrixWorld),r.setFromMatrixPosition(u.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(A),n++}else if(u.isSpotLight){const e=i.spot[l];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(A),e.direction.setFromMatrixPosition(u.matrixWorld),r.setFromMatrixPosition(u.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(A),l++}else if(u.isRectAreaLight){const e=i.rectArea[c];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(A),s.identity(),a.copy(u.matrixWorld),a.premultiply(A),s.extractRotation(a),e.halfWidth.set(.5*u.width,0,0),e.halfHeight.set(0,.5*u.height,0),e.halfWidth.applyMatrix4(s),e.halfHeight.applyMatrix4(s),c++}else if(u.isPointLight){const e=i.point[o];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(A),o++}else if(u.isHemisphereLight){const e=i.hemi[h];e.direction.setFromMatrixPosition(u.matrixWorld),e.direction.transformDirection(A),h++}}},state:i}}function yo(e){const t=new xo(e),n=[],i=[],r={lightsArray:n,shadowsArray:i,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function(e){r.camera=e,n.length=0,i.length=0},state:r,setupLights:function(){t.setup(n)},setupLightsView:function(e){t.setupView(n,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){i.push(e)}}}function wo(e){let t=new WeakMap;return{get:function(n,i=0){const r=t.get(n);let a;return void 0===r?(a=new yo(e),t.set(n,[a])):i>=r.length?(a=new yo(e),r.push(a)):a=r[i],a},dispose:function(){t=new WeakMap}}}class Mo extends $i{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 So extends $i{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 Bo(e,t,n){let i=new ia;const r=new nn,a=new nn,s=new yn,o=new Mo({depthPacking:3201}),l=new So,c={},h=n.maxTextureSize,A={[pe]:1,[fe]:0,[ge]:2},u=new Gr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new nn},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),d=u.clone();d.defines.HORIZONTAL_PASS=1;const p=new gr;p.setAttribute("position",new ar(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const f=new Ur(p,u),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let m=this.type;function v(n,i){const a=t.update(f);u.defines.VSM_SAMPLES!==n.blurSamples&&(u.defines.VSM_SAMPLES=n.blurSamples,d.defines.VSM_SAMPLES=n.blurSamples,u.needsUpdate=!0,d.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new Mn(r.x,r.y)),u.uniforms.shadow_pass.value=n.map.texture,u.uniforms.resolution.value=n.mapSize,u.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,a,u,f,null),d.uniforms.shadow_pass.value=n.mapPass.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,a,d,f,null)}function E(t,n,i,r){let a=null;const s=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===i.isPointLight?l:o,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const e=a.uuid,t=n.uuid;let i=c[e];void 0===i&&(i={},c[e]=i);let r=i[t];void 0===r&&(r=a.clone(),i[t]=r,n.addEventListener("dispose",C)),a=r}return a.visible=n.visible,a.wireframe=n.wireframe,a.side=3===r?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:A[n.side],a.alphaMap=n.alphaMap,a.alphaTest=n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial&&(e.properties.get(a).light=i),a}function b(n,r,a,s,o){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===o)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);const i=t.update(n),l=n.material;if(Array.isArray(l)){const t=i.groups;for(let c=0,h=t.length;c<h;c++){const h=t[c],A=l[h.materialIndex];if(A&&A.visible){const t=E(n,A,s,o);n.onBeforeShadow(e,n,r,a,i,t,h),e.renderBufferDirect(a,null,i,t,n,h),n.onAfterShadow(e,n,r,a,i,t,h)}}}else if(l.visible){const t=E(n,l,s,o);n.onBeforeShadow(e,n,r,a,i,t,null),e.renderBufferDirect(a,null,i,t,n,null),n.onAfterShadow(e,n,r,a,i,t,null)}}const l=n.children;for(let e=0,t=l.length;e<t;e++)b(l[e],r,a,s,o)}function C(e){e.target.removeEventListener("dispose",C);for(const t in c){const n=c[t],i=e.target.uuid;i in n&&(n[i].dispose(),delete n[i])}}this.render=function(t,n,o){if(!1===g.enabled)return;if(!1===g.autoUpdate&&!1===g.needsUpdate)return;if(0===t.length)return;const l=e.getRenderTarget(),c=e.getActiveCubeFace(),A=e.getActiveMipmapLevel(),u=e.state;u.setBlending(0),u.buffers.color.setClear(1,1,1,1),u.buffers.depth.setTest(!0),u.setScissorTest(!1);const d=3!==m&&3===this.type,p=3===m&&3!==this.type;for(let l=0,c=t.length;l<c;l++){const c=t[l],A=c.shadow;if(void 0===A){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===A.autoUpdate&&!1===A.needsUpdate)continue;r.copy(A.mapSize);const f=A.getFrameExtents();if(r.multiply(f),a.copy(A.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(a.x=Math.floor(h/f.x),r.x=a.x*f.x,A.mapSize.x=a.x),r.y>h&&(a.y=Math.floor(h/f.y),r.y=a.y*f.y,A.mapSize.y=a.y)),null===A.map||!0===d||!0===p){const e=3!==this.type?{minFilter:ze,magFilter:ze}:{};null!==A.map&&A.map.dispose(),A.map=new Mn(r.x,r.y,e),A.map.texture.name=c.name+".shadowMap",A.camera.updateProjectionMatrix()}e.setRenderTarget(A.map),e.clear();const g=A.getViewportCount();for(let e=0;e<g;e++){const t=A.getViewport(e);s.set(a.x*t.x,a.y*t.y,a.x*t.z,a.y*t.w),u.viewport(s),A.updateMatrices(c,e),i=A.getFrustum(),b(n,o,A.camera,c,this.type)}!0!==A.isPointLightShadow&&3===this.type&&v(A,o),A.needsUpdate=!1}m=this.type,g.needsUpdate=!1,e.setRenderTarget(l,c,A)}}function To(e){const t=new function(){let t=!1;const n=new yn;let i=null;const r=new yn(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,a,s,o){!0===o&&(t*=s,i*=s,a*=s),n.set(t,i,a,s),!1===r.equals(n)&&(e.clearColor(t,i,a,s),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},n=new function(){let t=!1,n=null,i=null,r=null;return{setTest:function(t){t?O(e.DEPTH_TEST):k(e.DEPTH_TEST)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(i!==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)}i=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,i=null,r=null}}},i=new function(){let t=!1,n=null,i=null,r=null,a=null,s=null,o=null,l=null,c=null;return{setTest:function(n){t||(n?O(e.STENCIL_TEST):k(e.STENCIL_TEST))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,s){i===t&&r===n&&a===s||(e.stencilFunc(t,n,s),i=t,r=n,a=s)},setOp:function(t,n,i){s===t&&o===n&&l===i||(e.stencilOp(t,n,i),s=t,o=n,l=i)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,i=null,r=null,a=null,s=null,o=null,l=null,c=null}}},r=new WeakMap,a=new WeakMap;let s={},o={},l=new WeakMap,c=[],h=null,A=!1,u=null,d=null,p=null,f=null,g=null,m=null,v=null,E=new Ki(0,0,0),b=0,C=!1,_=null,I=null,x=null,y=null,w=null;const M=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let S=!1,B=0;const T=e.getParameter(e.VERSION);-1!==T.indexOf("WebGL")?(B=parseFloat(/^WebGL (\d)/.exec(T)[1]),S=B>=1):-1!==T.indexOf("OpenGL ES")&&(B=parseFloat(/^OpenGL ES (\d)/.exec(T)[1]),S=B>=2);let R=null,D={};const Q=e.getParameter(e.SCISSOR_BOX),U=e.getParameter(e.VIEWPORT),L=(new yn).fromArray(Q),P=(new yn).fromArray(U);function N(t,n,i,r){const 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<i;s++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,r,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(n+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return s}const F={};function O(t){!0!==s[t]&&(e.enable(t),s[t]=!0)}function k(t){!1!==s[t]&&(e.disable(t),s[t]=!1)}F[e.TEXTURE_2D]=N(e.TEXTURE_2D,e.TEXTURE_2D,1),F[e.TEXTURE_CUBE_MAP]=N(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),F[e.TEXTURE_2D_ARRAY]=N(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),F[e.TEXTURE_3D]=N(e.TEXTURE_3D,e.TEXTURE_3D,1,1),t.setClear(0,0,0,1),n.setClear(1),i.setClear(0),O(e.DEPTH_TEST),n.setFunc(3),V(!1),W(1),O(e.CULL_FACE),z(0);const G={[me]:e.FUNC_ADD,[ve]:e.FUNC_SUBTRACT,[Ee]:e.FUNC_REVERSE_SUBTRACT};G[103]=e.MIN,G[104]=e.MAX;const H={[be]:e.ZERO,[Ce]:e.ONE,[_e]:e.SRC_COLOR,[xe]:e.SRC_ALPHA,[Te]:e.SRC_ALPHA_SATURATE,[Se]:e.DST_COLOR,[we]:e.DST_ALPHA,[Ie]:e.ONE_MINUS_SRC_COLOR,[ye]:e.ONE_MINUS_SRC_ALPHA,[Be]:e.ONE_MINUS_DST_COLOR,[Me]:e.ONE_MINUS_DST_ALPHA,[Re]:e.CONSTANT_COLOR,[De]:e.ONE_MINUS_CONSTANT_COLOR,[Qe]:e.CONSTANT_ALPHA,[Ue]:e.ONE_MINUS_CONSTANT_ALPHA};function z(t,n,i,r,a,s,o,l,c,h){if(0!==t){if(!1===A&&(O(e.BLEND),A=!0),5===t)a=a||n,s=s||i,o=o||r,n===d&&a===g||(e.blendEquationSeparate(G[n],G[a]),d=n,g=a),i===p&&r===f&&s===m&&o===v||(e.blendFuncSeparate(H[i],H[r],H[s],H[o]),p=i,f=r,m=s,v=o),!1!==l.equals(E)&&c===b||(e.blendColor(l.r,l.g,l.b,c),E.copy(l),b=c),u=t,C=!1;else if(t!==u||h!==C){if(d===me&&g===me||(e.blendEquation(e.FUNC_ADD),d=me,g=me),h)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.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.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.blendFunc(e.SRC_ALPHA,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}p=null,f=null,m=null,v=null,E.set(0,0,0),b=0,u=t,C=h}}else!0===A&&(k(e.BLEND),A=!1)}function V(t){_!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),_=t)}function W(t){0!==t?(O(e.CULL_FACE),t!==I&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):k(e.CULL_FACE),I=t}function q(t,n,i){t?(O(e.POLYGON_OFFSET_FILL),y===n&&w===i||(e.polygonOffset(n,i),y=n,w=i)):k(e.POLYGON_OFFSET_FILL)}return{buffers:{color:t,depth:n,stencil:i},enable:O,disable:k,bindFramebuffer:function(t,n){return o[t]!==n&&(e.bindFramebuffer(t,n),o[t]=n,t===e.DRAW_FRAMEBUFFER&&(o[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(o[e.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(t,n){let i=c,r=!1;if(t){i=l.get(n),void 0===i&&(i=[],l.set(n,i));const a=t.textures;if(i.length!==a.length||i[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=a.length;t<n;t++)i[t]=e.COLOR_ATTACHMENT0+t;i.length=a.length,r=!0}}else i[0]!==e.BACK&&(i[0]=e.BACK,r=!0);r&&e.drawBuffers(i)},useProgram:function(t){return h!==t&&(e.useProgram(t),h=t,!0)},setBlending:z,setMaterial:function(r,a){2===r.side?k(e.CULL_FACE):O(e.CULL_FACE);let s=1===r.side;a&&(s=!s),V(s),1===r.blending&&!1===r.transparent?z(0):z(r.blending,r.blendEquation,r.blendSrc,r.blendDst,r.blendEquationAlpha,r.blendSrcAlpha,r.blendDstAlpha,r.blendColor,r.blendAlpha,r.premultipliedAlpha),n.setFunc(r.depthFunc),n.setTest(r.depthTest),n.setMask(r.depthWrite),t.setMask(r.colorWrite);const o=r.stencilWrite;i.setTest(o),o&&(i.setMask(r.stencilWriteMask),i.setFunc(r.stencilFunc,r.stencilRef,r.stencilFuncMask),i.setOp(r.stencilFail,r.stencilZFail,r.stencilZPass)),q(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits),!0===r.alphaToCoverage?O(e.SAMPLE_ALPHA_TO_COVERAGE):k(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:V,setCullFace:W,setLineWidth:function(t){t!==x&&(S&&e.lineWidth(t),x=t)},setPolygonOffset:q,setScissorTest:function(t){t?O(e.SCISSOR_TEST):k(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+M-1),R!==t&&(e.activeTexture(t),R=t)},bindTexture:function(t,n,i){void 0===i&&(i=null===R?e.TEXTURE0+M-1:R);let r=D[i];void 0===r&&(r={type:void 0,texture:void 0},D[i]=r),r.type===t&&r.texture===n||(R!==i&&(e.activeTexture(i),R=i),e.bindTexture(t,n||F[t]),r.type=t,r.texture=n)},unbindTexture:function(){const 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.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,n){let i=a.get(n);void 0===i&&(i=new WeakMap,a.set(n,i));let r=i.get(t);void 0===r&&(r=e.getUniformBlockIndex(n,t.name),i.set(t,r))},uniformBlockBinding:function(t,n){const i=a.get(n).get(t);r.get(n)!==i&&(e.uniformBlockBinding(n,i,t.__bindingPointIndex),r.set(n,i))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===L.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),L.copy(t))},viewport:function(t){!1===P.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),P.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),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),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),s={},R=null,D={},o={},l=new WeakMap,c=[],h=null,A=!1,u=null,d=null,p=null,f=null,g=null,m=null,v=null,E=new Ki(0,0,0),b=0,C=!1,_=null,I=null,x=null,y=null,w=null,L.set(0,0,e.canvas.width,e.canvas.height),P.set(0,0,e.canvas.width,e.canvas.height),t.reset(),n.reset(),i.reset()}}}function Ro(e,t,n,i,r,a,s){const o=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new nn,h=new WeakMap;let A;const u=new WeakMap;let d=!1;try{d="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function p(e,t){return d?new OffscreenCanvas(e,t):on("canvas")}function f(e,t,n){let i=1;const r=k(e);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){const n=Math.floor(i*r.width),a=Math.floor(i*r.height);void 0===A&&(A=p(n,a));const s=t?p(n,a):A;return s.width=n,s.height=a,s.getContext("2d").drawImage(e,0,0,n,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+a+")."),s}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),e}return e}function g(e){return e.generateMipmaps&&e.minFilter!==ze&&e.minFilter!==qe}function m(t){e.generateMipmap(t)}function v(n,i,r,a,s=!1){if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=i;if(i===e.RED&&(r===e.FLOAT&&(o=e.R32F),r===e.HALF_FLOAT&&(o=e.R16F),r===e.UNSIGNED_BYTE&&(o=e.R8)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.R8UI),r===e.UNSIGNED_SHORT&&(o=e.R16UI),r===e.UNSIGNED_INT&&(o=e.R32UI),r===e.BYTE&&(o=e.R8I),r===e.SHORT&&(o=e.R16I),r===e.INT&&(o=e.R32I)),i===e.RG&&(r===e.FLOAT&&(o=e.RG32F),r===e.HALF_FLOAT&&(o=e.RG16F),r===e.UNSIGNED_BYTE&&(o=e.RG8)),i===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.RG8UI),r===e.UNSIGNED_SHORT&&(o=e.RG16UI),r===e.UNSIGNED_INT&&(o=e.RG32UI),r===e.BYTE&&(o=e.RG8I),r===e.SHORT&&(o=e.RG16I),r===e.INT&&(o=e.RG32I)),i===e.RGB&&r===e.UNSIGNED_INT_5_9_9_9_REV&&(o=e.RGB9_E5),i===e.RGBA){const t=s?wt:fn.getTransfer(a);r===e.FLOAT&&(o=e.RGBA32F),r===e.HALF_FLOAT&&(o=e.RGBA16F),r===e.UNSIGNED_BYTE&&(o=t===Mt?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),r===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 E(t,n){let i;return t?null===n||n===Je||n===et?i=e.DEPTH24_STENCIL8:n===Ze?i=e.DEPTH32F_STENCIL8:n===Ke&&(i=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===Je||n===et?i=e.DEPTH_COMPONENT24:n===Ze?i=e.DEPTH_COMPONENT32F:n===Ke&&(i=e.DEPTH_COMPONENT16),i}function b(e,t){return!0===g(e)||e.isFramebufferTexture&&e.minFilter!==ze&&e.minFilter!==qe?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 C(e){const t=e.target;t.removeEventListener("dispose",C),function(e){const t=i.get(e);if(void 0===t.__webglInit)return;const n=e.source,r=u.get(n);if(r){const i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&I(e),0===Object.keys(r).length&&u.delete(n)}i.remove(e)}(t),t.isVideoTexture&&h.delete(t)}function _(t){const n=t.target;n.removeEventListener("dispose",_),function(t){const n=i.get(t);if(t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let i=0;i<n.__webglFramebuffer[t].length;i++)e.deleteFramebuffer(n.__webglFramebuffer[t][i]);else e.deleteFramebuffer(n.__webglFramebuffer[t]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t])}else{if(Array.isArray(n.__webglFramebuffer))for(let t=0;t<n.__webglFramebuffer.length;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}const r=t.textures;for(let t=0,n=r.length;t<n;t++){const n=i.get(r[t]);n.__webglTexture&&(e.deleteTexture(n.__webglTexture),s.memory.textures--),i.remove(r[t])}i.remove(t)}(n)}function I(t){const n=i.get(t);e.deleteTexture(n.__webglTexture);const r=t.source;delete u.get(r)[n.__cacheKey],s.memory.textures--}let x=0;function y(t,r){const a=i.get(t);if(t.isVideoTexture&&function(e){const t=s.render.frame;h.get(e)!==t&&(h.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version){const e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void R(a,t,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+r)}const w={[ke]:e.REPEAT,[Ge]:e.CLAMP_TO_EDGE,[He]:e.MIRRORED_REPEAT},M={[ze]:e.NEAREST,[Ve]:e.NEAREST_MIPMAP_NEAREST,[We]:e.NEAREST_MIPMAP_LINEAR,[qe]:e.LINEAR,[je]:e.LINEAR_MIPMAP_NEAREST,[Ye]:e.LINEAR_MIPMAP_LINEAR},S={[Rt]:e.NEVER,[Ft]:e.ALWAYS,[Dt]:e.LESS,[Ut]:e.LEQUAL,[Qt]:e.EQUAL,[Nt]:e.GEQUAL,[Lt]:e.GREATER,[Pt]:e.NOTEQUAL};function B(n,a){if(a.type!==Ze||!1!==t.has("OES_texture_float_linear")||a.magFilter!==qe&&a.magFilter!==je&&a.magFilter!==We&&a.magFilter!==Ye&&a.minFilter!==qe&&a.minFilter!==je&&a.minFilter!==We&&a.minFilter!==Ye||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,w[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,w[a.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,w[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,M[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,M[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,S[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){if(a.magFilter===ze)return;if(a.minFilter!==We&&a.minFilter!==Ye)return;if(a.type===Ze&&!1===t.has("OES_texture_float_linear"))return;if(a.anisotropy>1||i.get(a).__currentAnisotropy){const s=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy}}}function T(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",C));const r=n.source;let a=u.get(r);void 0===a&&(a={},u.set(r,a));const o=function(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(o!==t.__cacheKey){void 0===a[o]&&(a[o]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,i=!0),a[o].usedTimes++;const r=a[t.__cacheKey];void 0!==r&&(a[t.__cacheKey].usedTimes--,0===r.usedTimes&&I(n)),t.__cacheKey=o,t.__webglTexture=a[o].texture}return i}function R(t,s,o){let l=e.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),s.isData3DTexture&&(l=e.TEXTURE_3D);const c=T(t,s),h=s.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);const A=i.get(h);if(h.version!==A.__version||!0===c){n.activeTexture(e.TEXTURE0+o);const t=fn.getPrimaries(fn.workingColorSpace),i=s.colorSpace===Ct?null:fn.getPrimaries(s.colorSpace),u=s.colorSpace===Ct||t===i?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,u);let d=f(s.image,!1,r.maxTextureSize);d=O(s,d);const p=a.convert(s.format,s.colorSpace),C=a.convert(s.type);let _,I=v(s.internalFormat,p,C,s.colorSpace,s.isVideoTexture);B(l,s);const x=s.mipmaps,y=!0!==s.isVideoTexture,w=void 0===A.__version||!0===c,M=h.dataReady,S=b(s,d);if(s.isDepthTexture)I=E(s.format===it,s.type),w&&(y?n.texStorage2D(e.TEXTURE_2D,1,I,d.width,d.height):n.texImage2D(e.TEXTURE_2D,0,I,d.width,d.height,0,p,C,null));else if(s.isDataTexture)if(x.length>0){y&&w&&n.texStorage2D(e.TEXTURE_2D,S,I,x[0].width,x[0].height);for(let t=0,i=x.length;t<i;t++)_=x[t],y?M&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,_.width,_.height,p,C,_.data):n.texImage2D(e.TEXTURE_2D,t,I,_.width,_.height,0,p,C,_.data);s.generateMipmaps=!1}else y?(w&&n.texStorage2D(e.TEXTURE_2D,S,I,d.width,d.height),M&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,d.width,d.height,p,C,d.data)):n.texImage2D(e.TEXTURE_2D,0,I,d.width,d.height,0,p,C,d.data);else if(s.isCompressedTexture)if(s.isCompressedArrayTexture){y&&w&&n.texStorage3D(e.TEXTURE_2D_ARRAY,S,I,x[0].width,x[0].height,d.depth);for(let t=0,i=x.length;t<i;t++)if(_=x[t],s.format!==tt)if(null!==p)if(y){if(M)if(s.layerUpdates.size>0){for(const i of s.layerUpdates){const r=_.width*_.height;n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,i,_.width,_.height,1,p,_.data.slice(r*i,r*(i+1)),0,0)}s.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,_.width,_.height,d.depth,p,_.data,0,0)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,I,_.width,_.height,d.depth,0,_.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else y?M&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,_.width,_.height,d.depth,p,C,_.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,I,_.width,_.height,d.depth,0,p,C,_.data)}else{y&&w&&n.texStorage2D(e.TEXTURE_2D,S,I,x[0].width,x[0].height);for(let t=0,i=x.length;t<i;t++)_=x[t],s.format!==tt?null!==p?y?M&&n.compressedTexSubImage2D(e.TEXTURE_2D,t,0,0,_.width,_.height,p,_.data):n.compressedTexImage2D(e.TEXTURE_2D,t,I,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):y?M&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,_.width,_.height,p,C,_.data):n.texImage2D(e.TEXTURE_2D,t,I,_.width,_.height,0,p,C,_.data)}else if(s.isDataArrayTexture)if(y){if(w&&n.texStorage3D(e.TEXTURE_2D_ARRAY,S,I,d.width,d.height,d.depth),M)if(s.layerUpdates.size>0){let t;switch(C){case e.UNSIGNED_BYTE:switch(p){case e.ALPHA:case e.LUMINANCE:t=1;break;case e.LUMINANCE_ALPHA:t=2;break;case e.RGB:t=3;break;case e.RGBA:t=4;break;default:throw new Error(`Unknown texel size for format ${p}.`)}break;case e.UNSIGNED_SHORT_4_4_4_4:case e.UNSIGNED_SHORT_5_5_5_1:case e.UNSIGNED_SHORT_5_6_5:t=1;break;default:throw new Error(`Unknown texel size for type ${C}.`)}const i=d.width*d.height*t;for(const t of s.layerUpdates)n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,t,d.width,d.height,1,p,C,d.data.slice(i*t,i*(t+1)));s.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,d.width,d.height,d.depth,p,C,d.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,I,d.width,d.height,d.depth,0,p,C,d.data);else if(s.isData3DTexture)y?(w&&n.texStorage3D(e.TEXTURE_3D,S,I,d.width,d.height,d.depth),M&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,d.width,d.height,d.depth,p,C,d.data)):n.texImage3D(e.TEXTURE_3D,0,I,d.width,d.height,d.depth,0,p,C,d.data);else if(s.isFramebufferTexture){if(w)if(y)n.texStorage2D(e.TEXTURE_2D,S,I,d.width,d.height);else{let t=d.width,i=d.height;for(let r=0;r<S;r++)n.texImage2D(e.TEXTURE_2D,r,I,t,i,0,p,C,null),t>>=1,i>>=1}}else if(x.length>0){if(y&&w){const t=k(x[0]);n.texStorage2D(e.TEXTURE_2D,S,I,t.width,t.height)}for(let t=0,i=x.length;t<i;t++)_=x[t],y?M&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,p,C,_):n.texImage2D(e.TEXTURE_2D,t,I,p,C,_);s.generateMipmaps=!1}else if(y){if(w){const t=k(d);n.texStorage2D(e.TEXTURE_2D,S,I,t.width,t.height)}M&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,p,C,d)}else n.texImage2D(e.TEXTURE_2D,0,I,p,C,d);g(s)&&m(l),A.__version=h.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}function D(t,r,s,l,c,h){const A=a.convert(s.format,s.colorSpace),u=a.convert(s.type),d=v(s.internalFormat,A,u,s.colorSpace);if(!i.get(r).__hasExternalTextures){const t=Math.max(1,r.width>>h),i=Math.max(1,r.height>>h);c===e.TEXTURE_3D||c===e.TEXTURE_2D_ARRAY?n.texImage3D(c,h,d,t,i,r.depth,0,A,u,null):n.texImage2D(c,h,d,t,i,0,A,u,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),F(r)?o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,l,c,i.get(s).__webglTexture,0,N(r)):(c===e.TEXTURE_2D||c>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,l,c,i.get(s).__webglTexture,h),n.bindFramebuffer(e.FRAMEBUFFER,null)}function Q(t,n,i){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){const r=n.depthTexture,a=r&&r.isDepthTexture?r.type:null,s=E(n.stencilBuffer,a),l=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=N(n);F(n)?o.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,c,s,n.width,n.height):i?e.renderbufferStorageMultisample(e.RENDERBUFFER,c,s,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,s,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,t)}else{const t=n.textures;for(let r=0;r<t.length;r++){const s=t[r],l=a.convert(s.format,s.colorSpace),c=a.convert(s.type),h=v(s.internalFormat,l,c,s.colorSpace),A=N(n);i&&!1===F(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,A,h,n.width,n.height):F(n)?o.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,A,h,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,h,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function U(t){const r=i.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!r.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(e.FRAMEBUFFER,t),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),y(r.depthTexture,0);const a=i.get(r.depthTexture).__webglTexture,s=N(r);if(r.depthTexture.format===nt)F(r)?o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0,s):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0);else{if(r.depthTexture.format!==it)throw new Error("Unknown depthTexture format");F(r)?o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0,s):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0)}}(r.__webglFramebuffer,t)}else if(a){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[i]),r.__webglDepthbuffer[i]=e.createRenderbuffer(),Q(r.__webglDepthbuffer[i],t,!1)}else n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=e.createRenderbuffer(),Q(r.__webglDepthbuffer,t,!1);n.bindFramebuffer(e.FRAMEBUFFER,null)}const L=[],P=[];function N(e){return Math.min(r.maxSamples,e.samples)}function F(e){const n=i.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function O(e,t){const n=e.colorSpace,i=e.format,r=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==It&&n!==Ct&&(fn.getTransfer(n)===Mt?i===tt&&r===Xe||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),t}function k(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):"undefined"!=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(){const e=x;return e>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures),x+=1,e},this.resetTextureUnits=function(){x=0},this.setTexture2D=y,this.setTexture2DArray=function(t,r){const a=i.get(t);t.version>0&&a.__version!==t.version?R(a,t,r):n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+r)},this.setTexture3D=function(t,r){const a=i.get(t);t.version>0&&a.__version!==t.version?R(a,t,r):n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,s){const o=i.get(t);t.version>0&&o.__version!==t.version?function(t,s,o){if(6!==s.image.length)return;const l=T(t,s),c=s.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);const h=i.get(c);if(c.version!==h.__version||!0===l){n.activeTexture(e.TEXTURE0+o);const t=fn.getPrimaries(fn.workingColorSpace),i=s.colorSpace===Ct?null:fn.getPrimaries(s.colorSpace),A=s.colorSpace===Ct||t===i?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,A);const u=s.isCompressedTexture||s.image[0].isCompressedTexture,d=s.image[0]&&s.image[0].isDataTexture,p=[];for(let e=0;e<6;e++)p[e]=u||d?d?s.image[e].image:s.image[e]:f(s.image[e],!0,r.maxCubemapSize),p[e]=O(s,p[e]);const E=p[0],C=a.convert(s.format,s.colorSpace),_=a.convert(s.type),I=v(s.internalFormat,C,_,s.colorSpace),x=!0!==s.isVideoTexture,y=void 0===h.__version||!0===l,w=c.dataReady;let M,S=b(s,E);if(B(e.TEXTURE_CUBE_MAP,s),u){x&&y&&n.texStorage2D(e.TEXTURE_CUBE_MAP,S,I,E.width,E.height);for(let t=0;t<6;t++){M=p[t].mipmaps;for(let i=0;i<M.length;i++){const r=M[i];s.format!==tt?null!==C?x?w&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,C,r.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,I,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):x?w&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,C,_,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,I,r.width,r.height,0,C,_,r.data)}}}else{if(M=s.mipmaps,x&&y){M.length>0&&S++;const t=k(p[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,S,I,t.width,t.height)}for(let t=0;t<6;t++)if(d){x?w&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,p[t].width,p[t].height,C,_,p[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,I,p[t].width,p[t].height,0,C,_,p[t].data);for(let i=0;i<M.length;i++){const r=M[i].image[t].image;x?w&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,r.width,r.height,C,_,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,I,r.width,r.height,0,C,_,r.data)}}else{x?w&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,C,_,p[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,I,C,_,p[t]);for(let i=0;i<M.length;i++){const r=M[i];x?w&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,C,_,r.image[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,I,C,_,r.image[t])}}}g(s)&&m(e.TEXTURE_CUBE_MAP),h.__version=c.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}(o,t,s):n.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture,e.TEXTURE0+s)},this.rebindTextures=function(t,n,r){const a=i.get(t);void 0!==n&&D(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==r&&U(t)},this.setupRenderTarget=function(t){const r=t.texture,o=i.get(t),l=i.get(r);t.addEventListener("dispose",_);const c=t.textures,h=!0===t.isWebGLCubeRenderTarget,A=c.length>1;if(A||(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=r.version,s.memory.textures++),h){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let n=0;n<r.mipmaps.length;n++)o.__webglFramebuffer[t][n]=e.createFramebuffer()}else o.__webglFramebuffer[t]=e.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer=[];for(let t=0;t<r.mipmaps.length;t++)o.__webglFramebuffer[t]=e.createFramebuffer()}else o.__webglFramebuffer=e.createFramebuffer();if(A)for(let t=0,n=c.length;t<n;t++){const n=i.get(c[t]);void 0===n.__webglTexture&&(n.__webglTexture=e.createTexture(),s.memory.textures++)}if(t.samples>0&&!1===F(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let n=0;n<c.length;n++){const i=c[n];o.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,o.__webglColorRenderbuffer[n]);const r=a.convert(i.format,i.colorSpace),s=a.convert(i.type),l=v(i.internalFormat,r,s,i.colorSpace,!0===t.isXRRenderTarget),h=N(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,h,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+n,e.RENDERBUFFER,o.__webglColorRenderbuffer[n])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(o.__webglDepthRenderbuffer=e.createRenderbuffer(),Q(o.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(h){n.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),B(e.TEXTURE_CUBE_MAP,r);for(let n=0;n<6;n++)if(r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)D(o.__webglFramebuffer[n][i],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,i);else D(o.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);g(r)&&m(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(A){for(let r=0,a=c.length;r<a;r++){const a=c[r],s=i.get(a);n.bindTexture(e.TEXTURE_2D,s.__webglTexture),B(e.TEXTURE_2D,a),D(o.__webglFramebuffer,t,a,e.COLOR_ATTACHMENT0+r,e.TEXTURE_2D,0),g(a)&&m(e.TEXTURE_2D)}n.unbindTexture()}else{let i=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(i=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(i,l.__webglTexture),B(i,r),r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)D(o.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,i,n);else D(o.__webglFramebuffer,t,r,e.COLOR_ATTACHMENT0,i,0);g(r)&&m(i),n.unbindTexture()}t.depthBuffer&&U(t)},this.updateRenderTargetMipmap=function(t){const r=t.textures;for(let a=0,s=r.length;a<s;a++){const s=r[a];if(g(s)){const r=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,a=i.get(s).__webglTexture;n.bindTexture(r,a),m(r),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0)if(!1===F(t)){const r=t.textures,a=t.width,s=t.height;let o=e.COLOR_BUFFER_BIT;const c=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,h=i.get(t),A=r.length>1;if(A)for(let t=0;t<r.length;t++)n.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let n=0;n<r.length;n++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(o|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(o|=e.STENCIL_BUFFER_BIT)),A){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,h.__webglColorRenderbuffer[n]);const t=i.get(r[n]).__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===l&&(L.length=0,P.length=0,L.push(e.COLOR_ATTACHMENT0+n),t.depthBuffer&&!1===t.resolveDepthBuffer&&(L.push(c),P.push(c),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,P)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,L))}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),A)for(let t=0;t<r.length;t++){n.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,h.__webglColorRenderbuffer[t]);const a=i.get(r[t]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&l){const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}},this.setupDepthRenderbuffer=U,this.setupFrameBufferTexture=D,this.useMultisampledRTT=F}function Do(e,t){return{convert:function(n,i=""){let r;const a=fn.getTransfer(i);if(n===Xe)return e.UNSIGNED_BYTE;if(1017===n)return e.UNSIGNED_SHORT_4_4_4_4;if(1018===n)return e.UNSIGNED_SHORT_5_5_5_1;if(35902===n)return e.UNSIGNED_INT_5_9_9_9_REV;if(1010===n)return e.BYTE;if(1011===n)return e.SHORT;if(n===Ke)return e.UNSIGNED_SHORT;if(1013===n)return e.INT;if(n===Je)return e.UNSIGNED_INT;if(n===Ze)return e.FLOAT;if(n===$e)return e.HALF_FLOAT;if(1021===n)return e.ALPHA;if(1022===n)return e.RGB;if(n===tt)return e.RGBA;if(1024===n)return e.LUMINANCE;if(1025===n)return e.LUMINANCE_ALPHA;if(n===nt)return e.DEPTH_COMPONENT;if(n===it)return e.DEPTH_STENCIL;if(n===rt)return e.RED;if(1029===n)return e.RED_INTEGER;if(n===at)return e.RG;if(1031===n)return e.RG_INTEGER;if(1033===n)return e.RGBA_INTEGER;if(n===st||n===ot||n===lt||n===ct)if(a===Mt){if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(n===st)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===ot)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===lt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===ct)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=t.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(n===st)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===ot)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===lt)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===ct)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===ht||35841===n||n===At||35843===n){if(r=t.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(n===ht)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===n)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===At)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===n)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===ut||n===dt||n===pt){if(r=t.get("WEBGL_compressed_texture_etc"),null===r)return null;if(n===ut||n===dt)return a===Mt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===pt)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===ft||37809===n||37810===n||37811===n||n===gt||37813===n||37814===n||37815===n||37816===n||37817===n||37818===n||37819===n||37820===n||37821===n){if(r=t.get("WEBGL_compressed_texture_astc"),null===r)return null;if(n===ft)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===gt)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===n)return a===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===mt||36494===n||36495===n){if(r=t.get("EXT_texture_compression_bptc"),null===r)return null;if(n===mt)return a===Mt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(36494===n)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(36495===n)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===n||36284===n||36285===n||36286===n){if(r=t.get("EXT_texture_compression_rgtc"),null===r)return null;if(n===mt)return r.COMPRESSED_RED_RGTC1_EXT;if(36284===n)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===n)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===n)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===et?e.UNSIGNED_INT_24_8:void 0!==e[n]?e[n]:null}}}class Qo extends qr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Uo extends Ui{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Lo={type:"move"};class Po{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Uo,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 Uo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Rn,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Rn),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Uo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Rn,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Rn),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){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}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,n){let i=null,r=null,a=null;const s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){a=!0;for(const i of e.hand.values()){const e=t.getJointPose(i,n),r=this._getHandJoint(l,i);null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=e.radius),r.visible=null!==e}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=i.position.distanceTo(r.position),o=.02,c=.005;l.inputState.pinching&&s>o+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==s&&(i=t.getPose(e.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(Lo)))}return null!==s&&(s.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){const n=new Uo;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class No{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(null===this.texture){const i=new xn;e.properties.get(i).__webglTexture=t.texture,t.depthNear==n.depthNear&&t.depthFar==n.depthFar||(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(null!==this.texture&&null===this.mesh){const t=e.cameras[0].viewport,n=new Gr({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Ur(new sa(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Fo extends zt{constructor(e,t){super();const n=this;let i=null,r=1,a=null,s="local-floor",o=1,l=null,c=null,h=null,A=null,u=null,d=null;const p=new No,f=t.getContextAttributes();let g=null,m=null;const v=[],E=[],b=new nn;let C=null;const _=new qr;_.layers.enable(1),_.viewport=new yn;const I=new qr;I.layers.enable(2),I.viewport=new yn;const x=[_,I],y=new Qo;y.layers.enable(1),y.layers.enable(2);let w=null,M=null;function S(e){const t=E.indexOf(e.inputSource);if(-1===t)return;const n=v[t];void 0!==n&&(n.update(e.inputSource,e.frame,l||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function B(){i.removeEventListener("select",S),i.removeEventListener("selectstart",S),i.removeEventListener("selectend",S),i.removeEventListener("squeeze",S),i.removeEventListener("squeezestart",S),i.removeEventListener("squeezeend",S),i.removeEventListener("end",B),i.removeEventListener("inputsourceschange",T);for(let e=0;e<v.length;e++){const t=E[e];null!==t&&(E[e]=null,v[e].disconnect(t))}w=null,M=null,p.reset(),e.setRenderTarget(g),u=null,A=null,h=null,i=null,m=null,L.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(b.width,b.height,!1),n.dispatchEvent({type:"sessionend"})}function T(e){for(let t=0;t<e.removed.length;t++){const n=e.removed[t],i=E.indexOf(n);i>=0&&(E[i]=null,v[i].disconnect(n))}for(let t=0;t<e.added.length;t++){const n=e.added[t];let i=E.indexOf(n);if(-1===i){for(let e=0;e<v.length;e++){if(e>=E.length){E.push(n),i=e;break}if(null===E[e]){E[e]=n,i=e;break}}if(-1===i)break}const r=v[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=v[e];return void 0===t&&(t=new Po,v[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=v[e];return void 0===t&&(t=new Po,v[e]=t),t.getGripSpace()},this.getHand=function(e){let t=v[e];return void 0===t&&(t=new Po,v[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===n.isPresenting&&console.warn("THREE.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!==A?A:u},this.getBinding=function(){return h},this.getFrame=function(){return d},this.getSession=function(){return i},this.setSession=async function(c){if(i=c,null!==i){if(g=e.getRenderTarget(),i.addEventListener("select",S),i.addEventListener("selectstart",S),i.addEventListener("selectend",S),i.addEventListener("squeeze",S),i.addEventListener("squeezestart",S),i.addEventListener("squeezeend",S),i.addEventListener("end",B),i.addEventListener("inputsourceschange",T),!0!==f.xrCompatible&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(b),void 0===i.renderState.layers){const n={antialias:f.antialias,alpha:!0,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:r};u=new XRWebGLLayer(i,t,n),i.updateRenderState({baseLayer:u}),e.setPixelRatio(1),e.setSize(u.framebufferWidth,u.framebufferHeight,!1),m=new Mn(u.framebufferWidth,u.framebufferHeight,{format:tt,type:Xe,colorSpace:e.outputColorSpace,stencilBuffer:f.stencil})}else{let n=null,a=null,s=null;f.depth&&(s=f.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=f.stencil?it:nt,a=f.stencil?et:Je);const o={colorFormat:t.RGBA8,depthFormat:s,scaleFactor:r};h=new XRWebGLBinding(i,t),A=h.createProjectionLayer(o),i.updateRenderState({layers:[A]}),e.setPixelRatio(1),e.setSize(A.textureWidth,A.textureHeight,!1),m=new Mn(A.textureWidth,A.textureHeight,{format:tt,type:Xe,depthTexture:new Ha(A.textureWidth,A.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:f.stencil,colorSpace:e.outputColorSpace,samples:f.antialias?4:0,resolveDepthBuffer:!1===A.ignoreDepthValues})}m.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await i.requestReferenceSpace(s),L.setContext(i),L.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode},this.getDepthTexture=function(){return p.getDepthTexture()};const R=new Rn,D=new Rn;function Q(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){if(null===i)return;null!==p.texture&&(e.near=p.depthNear,e.far=p.depthFar),y.near=I.near=_.near=e.near,y.far=I.far=_.far=e.far,w===y.near&&M===y.far||(i.updateRenderState({depthNear:y.near,depthFar:y.far}),w=y.near,M=y.far,_.near=w,_.far=M,I.near=w,I.far=M,_.updateProjectionMatrix(),I.updateProjectionMatrix(),e.updateProjectionMatrix());const t=e.parent,n=y.cameras;Q(y,t);for(let e=0;e<n.length;e++)Q(n[e],t);2===n.length?function(e,t,n){R.setFromMatrixPosition(t.matrixWorld),D.setFromMatrixPosition(n.matrixWorld);const i=R.distanceTo(D),r=t.projectionMatrix.elements,a=n.projectionMatrix.elements,s=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],A=(a[8]+1)/a[0],u=s*h,d=s*A,p=i/(-h+A),f=p*-h;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(f),e.translateZ(p),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();const g=s+p,m=o+p,v=u-f,E=d+(i-f),b=l*o/m*g,C=c*o/m*g;e.projectionMatrix.makePerspective(v,E,b,C,g,m),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}(y,_,I):y.projectionMatrix.copy(_.projectionMatrix),function(e,t,n){null===n?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld)),e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*qt*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}(e,y,t)},this.getCamera=function(){return y},this.getFoveation=function(){if(null!==A||null!==u)return o},this.setFoveation=function(e){o=e,null!==A&&(A.fixedFoveation=e),null!==u&&void 0!==u.fixedFoveation&&(u.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==p.texture},this.getDepthSensingMesh=function(){return p.getMesh(y)};let U=null;const L=new ra;L.setAnimationLoop(function(t,r){if(c=r.getViewerPose(l||a),d=r,null!==c){const t=c.views;null!==u&&(e.setRenderTargetFramebuffer(m,u.framebuffer),e.setRenderTarget(m));let n=!1;t.length!==y.cameras.length&&(y.cameras.length=0,n=!0);for(let i=0;i<t.length;i++){const r=t[i];let a=null;if(null!==u)a=u.getViewport(r);else{const t=h.getViewSubImage(A,r);a=t.viewport,0===i&&(e.setRenderTargetTextures(m,t.colorTexture,A.ignoreDepthValues?void 0:t.depthStencilTexture),e.setRenderTarget(m))}let s=x[i];void 0===s&&(s=new qr,s.layers.enable(i),s.viewport=new yn,x[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&&(y.matrix.copy(s.matrix),y.matrix.decompose(y.position,y.quaternion,y.scale)),!0===n&&y.cameras.push(s)}const r=i.enabledFeatures;if(r&&r.includes("depth-sensing")){const n=h.getDepthInformation(t[0]);n&&n.isValid&&n.texture&&p.init(e,n,i.renderState)}}for(let e=0;e<v.length;e++){const t=E[e],n=v[e];null!==t&&void 0!==n&&n.update(t,r,l||a)}U&&U(t,r),r.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:r}),d=null}),this.setAnimationLoop=function(e){U=e},this.dispose=function(){}}}const Oo=new mi,ko=new oi;function Go(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function i(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map,n(i.map,e.mapTransform)),i.alphaMap&&(e.alphaMap.value=i.alphaMap,n(i.alphaMap,e.alphaMapTransform)),i.bumpMap&&(e.bumpMap.value=i.bumpMap,n(i.bumpMap,e.bumpMapTransform),e.bumpScale.value=i.bumpScale,1===i.side&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,n(i.normalMap,e.normalMapTransform),e.normalScale.value.copy(i.normalScale),1===i.side&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,n(i.displacementMap,e.displacementMapTransform),e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,e.emissiveMapTransform)),i.specularMap&&(e.specularMap.value=i.specularMap,n(i.specularMap,e.specularMapTransform)),i.alphaTest>0&&(e.alphaTest.value=i.alphaTest);const r=t.get(i),a=r.envMap,s=r.envMapRotation;a&&(e.envMap.value=a,Oo.copy(s),Oo.x*=-1,Oo.y*=-1,Oo.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(Oo.y*=-1,Oo.z*=-1),e.envMapRotation.value.setFromMatrix4(ko.makeRotationFromEuler(Oo)),e.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,Or(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,a,s,o,l){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(i(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(i(e,r),function(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,i){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),1===t.side&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,r,o)):r.isMeshMatcapMaterial?(i(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,n){const i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,i,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*r,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r,a,s):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial?r.uniformsNeedUpdate=!1:r.isMeshDiamondMaterial&&function(e,n,i,r){e.opacity.value=n.opacity,e.reflectivity.value=n.reflectivity,e.ior.value=n.ior,e.radius.value=n.radius,e.squashFactor.value=n.squashFactor,e.geometryFactor.value=n.geometryFactor,e.gammaFactor.value=n.gammaFactor,e.absorptionFactor.value=n.absorptionFactor,e.rIndexDelta.value=n.rIndexDelta,n.boostFactors&&e.boostFactors.value.copy(n.boostFactors),n.colorCorrection&&e.colorCorrection.value.set(n.colorCorrection.r,n.colorCorrection.g,n.colorCorrection.b),n.color&&(e.diffuse.value.copy(n.color),e.color.value.set(n.color.r,n.color.g,n.color.b));const a=t.get(n).envMap;a&&(e.envMap.value=a,e.envMapRotation.value=n.envMapRotation,e.envMapIntensity.value=n.envMapIntensity),n.transmission>0&&(e.transmission.value=n.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height)),r&&(e.tCubeMapNormals.value=r.texture)}(e,r,o,l)}}}function Ho(e,t,n,i){let r={},a={},s=[];const o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e,t,n,i){const r=e.value,a=t+"_"+n;if(void 0===i[a])return i[a]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const e=i[a];if("number"==typeof r||"boolean"==typeof r){if(e!==r)return i[a]=r,!0}else if(!1===e.equals(r))return e.copy(r),!0}return!1}function c(e){const 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?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function h(t){const n=t.target;n.removeEventListener("dispose",h);const i=s.indexOf(n.__bindingPointIndex);s.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}return{bind:function(e,t){const n=t.program;i.uniformBlockBinding(e,n)},update:function(n,A){let u=r[n.id];void 0===u&&(function(e){const t=e.uniforms;let n=0;for(let e=0,i=t.length;e<i;e++){const i=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=i.length;e<t;e++){const t=i[e],r=Array.isArray(t.value)?t.value:[t.value];for(let e=0,i=r.length;e<i;e++){const i=c(r[e]),a=n%16;0!==a&&16-a<i.boundary&&(n+=16-a),t.__data=new Float32Array(i.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=i.storage}}}const i=n%16;i>0&&(n+=16-i),e.__size=n,e.__cache={}}(n),u=function(t){const n=function(){for(let e=0;e<o;e++)if(-1===s.indexOf(e))return s.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=n;const i=e.createBuffer(),r=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,i),e.bufferData(e.UNIFORM_BUFFER,r,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=u,n.addEventListener("dispose",h));const d=A.program;i.updateUBOMapping(n,d);const p=t.render.frame;a[n.id]!==p&&(function(t){const n=r[t.id],i=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let t=0,n=i.length;t<n;t++){const n=Array.isArray(i[t])?i[t]:[i[t]];for(let i=0,r=n.length;i<r;i++){const r=n[i];if(!0===l(r,t,i,a)){const t=r.__offset,n=Array.isArray(r.value)?r.value:[r.value];let i=0;for(let a=0;a<n.length;a++){const s=n[a],o=c(s);"number"==typeof s||"boolean"==typeof s?(r.__data[0]=s,e.bufferSubData(e.UNIFORM_BUFFER,t+i,r.__data)):s.isMatrix3?(r.__data[0]=s.elements[0],r.__data[1]=s.elements[1],r.__data[2]=s.elements[2],r.__data[3]=0,r.__data[4]=s.elements[3],r.__data[5]=s.elements[4],r.__data[6]=s.elements[5],r.__data[7]=0,r.__data[8]=s.elements[6],r.__data[9]=s.elements[7],r.__data[10]=s.elements[8],r.__data[11]=0):(s.toArray(r.__data,i),i+=o.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,r.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(n),a[n.id]=p)},dispose:function(){for(const t in r)e.deleteBuffer(r[t]);s=[],r={},a={}}}}class zo extends Gr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Vo extends $i{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ki(16777215),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}}class Wo extends $i{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Ki(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ki(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new nn(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 mi,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 qo extends Wo{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 nn(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Yt(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 Ki(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 Ki(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ki(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 jo extends $i{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ki(16777215),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}}class Yo extends $i{constructor(e){super(),this.isMeshDiamondMaterial=!0,this.type="MeshDiamondMaterial",this.defines={RAY_BOUNCES:5},this.color=new Ki(16777215),this.map=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=0,this.envMapRotationQuat=(new Tn).identity(),this.envMapIntensity=.01,this.ior=2.4,this.reflectivity=.5,this.roughness=1,this.metalness=0,this.radius=1,this.transmission=0,this.squashFactor=.98,this.geometryFactor=.5,this.gammaFactor=1,this.absorptionFactor=1,this.rIndexDelta=.012,this.diamondOrientedEnvMap=0,this.boostFactors=new Rn(1,1,1),this.fixedEnvMapDirection=!1,this.rayBounces=5,this.colorCorrection=new Ki(16777215),this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.defines=Object.assign({},e.defines),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation=e.envMapRotation,this.envMapRotationQuat.copy(e.envMapRotationQuat),this.envMapIntensity=e.envMapIntensity,this.ior=e.ior,this.reflectivity=e.reflectivity,this.roughness=e.roughness,this.metalness=e.metalness,this.radius=e.radius,this.transmission=e.transmission,this.squashFactor=e.squashFactor,this.geometryFactor=e.geometryFactor,this.gammaFactor=e.gammaFactor,this.absorptionFactor=e.absorptionFactor,this.colorCorrection=e.colorCorrection,this.rIndexDelta=e.rIndexDelta,this.diamondOrientedEnvMap=e.diamondOrientedEnvMap,this.boostFactors.copy(e.boostFactors),this.fixedEnvMapDirection=e.fixedEnvMapDirection,this.rayBounces=e.rayBounces,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}class Xo extends $i{constructor(e){super(),this.isCubeNormalsMaterial=!0,this.type="CubeNormalsMaterial",this.radius=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.radius=e.radius,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}class Ko extends Ui{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 mi,this.environmentIntensity=1,this.environmentRotation=new mi,this.overrideMaterial=null,"undefined"!=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){const 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 Jo{constructor(e={}){const{canvas:t=ln(),context:n=null,depth:i=!0,stencil:r=!1,alpha:a=!1,antialias:s=!1,premultipliedAlpha:o=!0,preserveDrawingBuffer:l=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:h=!1}=e;let A;if(this.isWebGLRenderer=!0,null!==n){if("undefined"!=typeof WebGLRenderingContext&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");A=n.getContextAttributes().alpha}else A=a;const u=new Uint32Array(4),d=new Int32Array(4);let p=null,f=null;const g=[],m=[];this.domElement=t,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._outputColorSpace=_t,this.toneMapping=0,this.toneMappingExposure=1;const v=this;let E=!1,b=0,C=0,_=null,I=-1,x=null;const y=new yn,w=new yn;let M=null;const S=new Ki(0);let B=0,T=t.width,R=t.height,D=1,Q=null,U=null;const L=new yn(0,0,T,R),P=new yn(0,0,T,R);let N=!1;const F=new ia;let O=!1,k=!1;const G=new oi,H=new Rn,z=new yn,V={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let W=!1;function q(){return null===_?D:1}let j,Y,X,K,J,Z,$,ee,te,ne,ie,re,ae,se,oe,le,ce,he,Ae,ue,pe,fe,ge,me,ve=n;function Ee(e,n){return t.getContext(e,n)}try{const e={alpha:!0,depth:i,stencil:r,antialias:s,premultipliedAlpha:o,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${de}`),t.addEventListener("webglcontextlost",_e,!1),t.addEventListener("webglcontextrestored",Ie,!1),t.addEventListener("webglcontextcreationerror",xe,!1),null===ve){const t="webgl2";if(ve=Ee(t,e),null===ve)throw Ee(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function be(){j=new Pa(ve),j.init(),fe=new Do(ve,j),Y=new ga(ve,j,e,fe),X=new To(ve),K=new Oa(ve),J=new go,Z=new Ro(ve,j,X,J,Y,fe,K),$=new va(v),ee=new La(v),te=new aa(ve),ge=new pa(ve,te),ne=new Na(ve,te,K,ge),ie=new Ga(ve,ne,te,K),Ae=new ka(ve,Y,Z),le=new ma(J),re=new fo(v,$,ee,j,Y,ge,le),ae=new Go(v,J),se=new bo,oe=new wo(j),he=new da(v,$,ee,X,ie,A,o),ce=new Bo(v,ie,Y),me=new Ho(ve,K,Y,X),ue=new fa(ve,j,K),pe=new Fa(ve,j,K),K.programs=re.programs,v.capabilities=Y,v.extensions=j,v.properties=J,v.renderLists=se,v.shadowMap=ce,v.state=X,v.info=K}be();const Ce=new Fo(v,ve);function _e(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),E=!0}function Ie(){console.log("THREE.WebGLRenderer: Context Restored."),E=!1;const e=K.autoReset,t=ce.enabled,n=ce.autoUpdate,i=ce.needsUpdate,r=ce.type;be(),K.autoReset=e,ce.enabled=t,ce.autoUpdate=n,ce.needsUpdate=i,ce.type=r}function xe(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function ye(e){const t=e.target;t.removeEventListener("dispose",ye),function(e){(function(e){const t=J.get(e).programs;void 0!==t&&(t.forEach(function(e){re.releaseProgram(e)}),e.isShaderMaterial&&re.releaseShaderCache(e))})(e),J.remove(e)}(t)}function we(e,t,n){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,Pe(e,t,n),e.side=0,e.needsUpdate=!0,Pe(e,t,n),e.side=2):Pe(e,t,n)}this.xr=Ce,this.getContext=function(){return ve},this.getContextAttributes=function(){return ve.getContextAttributes()},this.forceContextLoss=function(){const e=j.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=j.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return D},this.setPixelRatio=function(e){void 0!==e&&(D=e,this.setSize(T,R,!1))},this.getSize=function(e){return e.set(T,R)},this.setSize=function(e,n,i=!0){Ce.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(T=e,R=n,t.width=Math.floor(e*D),t.height=Math.floor(n*D),!0===i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(T*D,R*D).floor()},this.setDrawingBufferSize=function(e,n,i){T=e,R=n,D=i,t.width=Math.floor(e*i),t.height=Math.floor(n*i),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(y)},this.getViewport=function(e){return e.copy(L)},this.setViewport=function(e,t,n,i){e.isVector4?L.set(e.x,e.y,e.z,e.w):L.set(e,t,n,i),X.viewport(y.copy(L).multiplyScalar(D).round())},this.getScissor=function(e){return e.copy(P)},this.setScissor=function(e,t,n,i){e.isVector4?P.set(e.x,e.y,e.z,e.w):P.set(e,t,n,i),X.scissor(w.copy(P).multiplyScalar(D).round())},this.getScissorTest=function(){return N},this.setScissorTest=function(e){X.setScissorTest(N=e)},this.setOpaqueSort=function(e){Q=e},this.setTransparentSort=function(e){U=e},this.getClearColor=function(e){return e.copy(he.getClearColor())},this.setClearColor=function(){he.setClearColor.apply(he,arguments)},this.getClearAlpha=function(){return he.getClearAlpha()},this.setClearAlpha=function(){he.setClearAlpha.apply(he,arguments)},this.clear=function(e=!0,t=!0,n=!0){let i=0;if(e){let e=!1;if(null!==_){const t=_.texture.format;e=1033===t||1031===t||1029===t}if(e){const e=_.texture.type,t=e===Xe||e===Je||e===Ke||e===et||1017===e||1018===e,n=he.getClearColor(),i=he.getClearAlpha(),r=n.r,a=n.g,s=n.b;t?(u[0]=r,u[1]=a,u[2]=s,u[3]=i,ve.clearBufferuiv(ve.COLOR,0,u)):(d[0]=r,d[1]=a,d[2]=s,d[3]=i,ve.clearBufferiv(ve.COLOR,0,d))}else i|=ve.COLOR_BUFFER_BIT}t&&(i|=ve.DEPTH_BUFFER_BIT),n&&(i|=ve.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ve.clear(i)},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(){t.removeEventListener("webglcontextlost",_e,!1),t.removeEventListener("webglcontextrestored",Ie,!1),t.removeEventListener("webglcontextcreationerror",xe,!1),se.dispose(),oe.dispose(),J.dispose(),$.dispose(),ee.dispose(),ie.dispose(),ge.dispose(),me.dispose(),re.dispose(),Ce.dispose(),Ce.removeEventListener("sessionstart",Se),Ce.removeEventListener("sessionend",Be),Te.stop()},this.renderBufferDirect=function(e,t,n,i,r,a){null===t&&(t=V);const s=r.isMesh&&r.matrixWorld.determinant()<0,o=function(e,t,n,i,r){!0!==t.isScene&&(t=V),Z.resetTextureUnits();const a=t.fog,s=i.isMeshStandardMaterial?t.environment:null,o=null===_?v.outputColorSpace:!0===_.isXRRenderTarget?_.texture.colorSpace:It,l=(i.isMeshStandardMaterial?ee:$).get(i.envMap||s),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),A=!!n.morphAttributes.position,u=!!n.morphAttributes.normal,d=!!n.morphAttributes.color;let p=0;i.toneMapped&&(null!==_&&!0!==_.isXRRenderTarget||(p=v.toneMapping));const g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,m=void 0!==g?g.length:0,E=J.get(i),b=f.state.lights;if(!0===O&&(!0===k||e!==x)){const t=e===x&&i.id===I;le.setState(i,e,t)}let C=!1;i.version===E.__version?E.needsLights&&E.lightsStateVersion!==b.state.version||E.outputColorSpace!==o||r.isBatchedMesh&&!1===E.batching?C=!0:r.isBatchedMesh||!0!==E.batching?r.isBatchedMesh&&!0===E.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===E.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===E.instancing?C=!0:r.isInstancedMesh||!0!==E.instancing?r.isSkinnedMesh&&!1===E.skinning?C=!0:r.isSkinnedMesh||!0!==E.skinning?r.isInstancedMesh&&!0===E.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===E.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===E.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===E.instancingMorph&&null!==r.morphTexture||E.envMap!==l||!0===i.fog&&E.fog!==a?C=!0:void 0===E.numClippingPlanes||E.numClippingPlanes===le.numPlanes&&E.numIntersection===le.numIntersection?(E.vertexAlphas!==c||E.vertexTangents!==h||E.morphTargets!==A||E.morphNormals!==u||E.morphColors!==d||E.toneMapping!==p||E.morphTargetsCount!==m)&&(C=!0):C=!0:C=!0:C=!0:C=!0:(C=!0,E.__version=i.version);let y=E.currentProgram;!0===C&&(y=Pe(i,t,r));let w=!1,M=!1,S=!1;const B=y.getUniforms(),T=E.uniforms;if(X.useProgram(y.program)&&(w=!0,M=!0,S=!0),i.id!==I&&(I=i.id,M=!0),n.cubeMapNormalTarget&&(M=!0),w||x!==e){B.setValue(ve,"projectionMatrix",e.projectionMatrix),B.setValue(ve,"viewMatrix",e.matrixWorldInverse);const t=B.map.cameraPosition;void 0!==t&&t.setValue(ve,H.setFromMatrixPosition(e.matrixWorld)),Y.logarithmicDepthBuffer&&B.setValue(ve,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&B.setValue(ve,"isOrthographic",!0===e.isOrthographicCamera),x!==e&&(x=e,M=!0,S=!0)}if(r.isSkinnedMesh){B.setOptional(ve,r,"bindMatrix"),B.setOptional(ve,r,"bindMatrixInverse");const e=r.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),B.setValue(ve,"boneTexture",e.boneTexture,Z))}r.isBatchedMesh&&(B.setOptional(ve,r,"batchingTexture"),B.setValue(ve,"batchingTexture",r._matricesTexture,Z),B.setOptional(ve,r,"batchingIdTexture"),B.setValue(ve,"batchingIdTexture",r._indirectTexture,Z),B.setOptional(ve,r,"batchingColorTexture"),null!==r._colorsTexture&&B.setValue(ve,"batchingColorTexture",r._colorsTexture,Z));const Q=n.morphAttributes;var U,L;if(void 0===Q.position&&void 0===Q.normal&&void 0===Q.color||Ae.update(r,n,y),(M||E.receiveShadow!==r.receiveShadow)&&(E.receiveShadow=r.receiveShadow,B.setValue(ve,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(T.envMap.value=l,T.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==t.environment&&(T.envMapIntensity.value=t.environmentIntensity),M&&(B.setValue(ve,"toneMappingExposure",v.toneMappingExposure),E.needsLights&&(L=S,(U=T).ambientLightColor.needsUpdate=L,U.lightProbe.needsUpdate=L,U.directionalLights.needsUpdate=L,U.directionalLightShadows.needsUpdate=L,U.pointLights.needsUpdate=L,U.pointLightShadows.needsUpdate=L,U.spotLights.needsUpdate=L,U.spotLightShadows.needsUpdate=L,U.rectAreaLights.needsUpdate=L,U.hemisphereLights.needsUpdate=L),a&&!0===i.fog&&ae.refreshFogUniforms(T,a),ae.refreshMaterialUniforms(T,i,D,R,f.state.transmissionRenderTarget[e.id],n.cubeMapNormalTarget),js.upload(ve,Ne(E),T,Z)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(js.upload(ve,Ne(E),T,Z),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&B.setValue(ve,"center",r.center),B.setValue(ve,"modelViewMatrix",r.modelViewMatrix),B.setValue(ve,"normalMatrix",r.normalMatrix),B.setValue(ve,"modelMatrix",r.matrixWorld),B.setValue(ve,"inverseModelMatrix",r.matrixWorldInv),B.setValue(ve,"offsetMatrixInv",r.offsetMatrixInv),B.setValue(ve,"offsetMatrix",r.offsetMatrix),B.setValue(ve,"centerOffset",r.centerOffset),(i.isCubeNormalsMaterial||i.isMeshDiamondMaterial)&&B.setValue(ve,"center",r.center),i.isMeshDiamondMaterial&&(r.modelOffsetMatrix.copy(r.matrixWorld).multiply(r.offsetMatrix),B.setValue(ve,"modelOffsetMatrix",r.modelOffsetMatrix),r.modelOffsetMatrixInv.copy(r.modelOffsetMatrix).invert(),B.setValue(ve,"modelOffsetMatrixInv",r.modelOffsetMatrixInv)),i.isShaderMaterial||i.isRawShaderMaterial){const e=i.uniformsGroups;for(let t=0,n=e.length;t<n;t++){const n=e[t];me.update(n,y),me.bind(n,y)}}return y}(e,t,n,i,r);X.setMaterial(i,s);let l=n.index,c=1;if(!0===i.wireframe){if(l=ne.getWireframeAttribute(n),void 0===l)return;c=2}const h=n.drawRange,A=n.attributes.position;let u=h.start*c,d=(h.start+h.count)*c;null!==a&&(u=Math.max(u,a.start*c),d=Math.min(d,(a.start+a.count)*c)),null!==l?(u=Math.max(u,0),d=Math.min(d,l.count)):null!=A&&(u=Math.max(u,0),d=Math.min(d,A.count));const p=d-u;if(p<0||p===1/0)return;let g;ge.setup(r,i,o,n,l);let m=ue;if(null!==l&&(g=te.get(l),m=pe,m.setIndex(g)),r.isMesh)!0===i.wireframe?(X.setLineWidth(i.wireframeLinewidth*q()),m.setMode(ve.LINES)):m.setMode(ve.TRIANGLES);else if(r.isLine){let e=i.linewidth;void 0===e&&(e=1),X.setLineWidth(e*q()),r.isLineSegments?m.setMode(ve.LINES):r.isLineLoop?m.setMode(ve.LINE_LOOP):m.setMode(ve.LINE_STRIP)}else r.isPoints?m.setMode(ve.POINTS):r.isSprite&&m.setMode(ve.TRIANGLES);if(r.isBatchedMesh)if(null!==r._multiDrawInstances)m.renderMultiDrawInstances(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount,r._multiDrawInstances);else if(j.get("WEBGL_multi_draw"))m.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else{const e=r._multiDrawStarts,t=r._multiDrawCounts,n=r._multiDrawCount,a=l?te.get(l).bytesPerElement:1,s=J.get(i).currentProgram.getUniforms();for(let i=0;i<n;i++)s.setValue(ve,"_gl_DrawID",i),m.render(e[i]/a,t[i])}else if(r.isInstancedMesh)m.renderInstances(u,p,r.count);else if(n.isInstancedBufferGeometry){const e=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,t=Math.min(n.instanceCount,e);m.renderInstances(u,p,t)}else m.render(u,p)},this.compile=function(e,t,n=null){null===n&&(n=e),f=oe.get(n),f.init(t),m.push(f),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(f.pushLight(e),e.castShadow&&f.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(f.pushLight(e),e.castShadow&&f.pushShadow(e))}),f.setupLights();const i=new Set;return e.traverse(function(e){const t=e.material;if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++){const a=t[r];we(a,n,e),i.add(a)}else we(t,n,e),i.add(t)}),m.pop(),f=null,i},this.compileAsync=function(e,t,n=null){const i=this.compile(e,t,n);return new Promise(t=>{function n(){i.forEach(function(e){J.get(e).currentProgram.isReady()&&i.delete(e)}),0!==i.size?setTimeout(n,10):t(e)}null!==j.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)})};let Me=null;function Se(){Te.stop()}function Be(){Te.start()}const Te=new ra;function Re(e,t,n,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)f.pushLight(e),e.castShadow&&f.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||F.intersectsSprite(e)){i&&z.setFromMatrixPosition(e.matrixWorld).applyMatrix4(G);const t=ie.update(e),r=e.material;r.visible&&p.push(e,t,r,n,z.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||F.intersectsObject(e))){const t=ie.update(e),r=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),z.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),z.copy(t.boundingSphere.center)),z.applyMatrix4(e.matrixWorld).applyMatrix4(G)),Array.isArray(r)){const i=t.groups;for(let a=0,s=i.length;a<s;a++){const s=i[a],o=r[s.materialIndex];o&&o.visible&&p.push(e,t,o,n,z.z,s)}}else r.visible&&p.push(e,t,r,n,z.z,null)}const r=e.children;for(let e=0,a=r.length;e<a;e++)Re(r[e],t,n,i)}function De(e,t,n,i){const r=e.opaque,a=e.transmissive,s=e.transparent;f.setupLightsView(n),!0===O&&le.setGlobalState(v.clippingPlanes,n),i&&X.viewport(y.copy(i)),r.length>0&&Ue(r,t,n),a.length>0&&Ue(a,t,n),s.length>0&&Ue(s,t,n),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1)}function Qe(e,t,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===f.state.transmissionRenderTarget[i.id]&&(f.state.transmissionRenderTarget[i.id]=new Mn(1,1,{generateMipmaps:!0,type:j.has("EXT_color_buffer_half_float")||j.has("EXT_color_buffer_float")?$e:Xe,minFilter:Ye,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:fn.workingColorSpace}));const a=f.state.transmissionRenderTarget[i.id],s=i.viewport||y;a.setSize(s.z,s.w);const o=v.getRenderTarget();v.setRenderTarget(a),v.getClearColor(S),B=v.getClearAlpha(),B<1&&v.setClearColor(16777215,.5),W?he.render(n):v.clear();const l=v.toneMapping;v.toneMapping=0;const c=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),f.setupLightsView(i),!0===O&&le.setGlobalState(v.clippingPlanes,i),Ue(e,n,i),Z.updateMultisampleRenderTarget(a),Z.updateRenderTargetMipmap(a),!1===j.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let r=0,a=t.length;r<a;r++){const a=t[r],s=a.object,o=a.geometry,l=a.material,c=a.group;if(2===l.side&&s.layers.test(i.layers)){const t=l.side;l.side=1,l.needsUpdate=!0,Le(s,n,i,o,l,c),l.side=t,l.needsUpdate=!0,e=!0}}!0===e&&(Z.updateMultisampleRenderTarget(a),Z.updateRenderTargetMipmap(a))}v.setRenderTarget(o),v.setClearColor(S,B),void 0!==c&&(i.viewport=c),v.toneMapping=l}function Ue(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let r=0,a=e.length;r<a;r++){const a=e[r],s=a.object,o=a.geometry,l=null===i?a.material:i,c=a.group;s.layers.test(n.layers)&&Le(s,t,n,o,l,c)}}function Le(e,t,n,i,r,a){e.onBeforeRender(v,t,n,i,r,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),r.onBeforeRender(v,t,n,i,e,a),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=1,r.needsUpdate=!0,v.renderBufferDirect(n,t,i,r,e,a),r.side=0,r.needsUpdate=!0,v.renderBufferDirect(n,t,i,r,e,a),r.side=2):v.renderBufferDirect(n,t,i,r,e,a),e.onAfterRender(v,t,n,i,r,a)}function Pe(e,t,n){!0!==t.isScene&&(t=V);const i=J.get(e),r=f.state.lights,a=f.state.shadowsArray,s=r.state.version,o=re.getParameters(e,r.state,a,t,n),l=re.getProgramCacheKey(o);let c=i.programs;i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.envMap=(e.isMeshStandardMaterial?ee:$).get(e.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===c&&(e.addEventListener("dispose",ye),c=new Map,i.programs=c);let h=c.get(l);if(void 0!==h){if(i.currentProgram===h&&i.lightsStateVersion===s)return Fe(e,o),h}else o.uniforms=re.getUniforms(e),e.onBuild(n,o,v),e.onBeforeCompile(o,v),h=re.acquireProgram(o,l),c.set(l,h),i.uniforms=o.uniforms;const A=i.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(A.clippingPlanes=le.uniform),Fe(e,o),i.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),i.lightsStateVersion=s,i.needsLights&&(A.ambientLightColor.value=r.state.ambient,A.lightProbe.value=r.state.probe,A.directionalLights.value=r.state.directional,A.directionalLightShadows.value=r.state.directionalShadow,A.spotLights.value=r.state.spot,A.spotLightShadows.value=r.state.spotShadow,A.rectAreaLights.value=r.state.rectArea,A.ltc_1.value=r.state.rectAreaLTC1,A.ltc_2.value=r.state.rectAreaLTC2,A.pointLights.value=r.state.point,A.pointLightShadows.value=r.state.pointShadow,A.hemisphereLights.value=r.state.hemi,A.directionalShadowMap.value=r.state.directionalShadowMap,A.directionalShadowMatrix.value=r.state.directionalShadowMatrix,A.spotShadowMap.value=r.state.spotShadowMap,A.spotLightMatrix.value=r.state.spotLightMatrix,A.spotLightMap.value=r.state.spotLightMap,A.pointShadowMap.value=r.state.pointShadowMap,A.pointShadowMatrix.value=r.state.pointShadowMatrix),i.currentProgram=h,i.uniformsList=null,h}function Ne(e){if(null===e.uniformsList){const t=e.currentProgram.getUniforms();e.uniformsList=js.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function Fe(e,t){const n=J.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}Te.setAnimationLoop(function(e){Me&&Me(e)}),"undefined"!=typeof self&&Te.setContext(self),this.setAnimationLoop=function(e){Me=e,Ce.setAnimationLoop(e),null===e?Te.stop():Te.start()},Ce.addEventListener("sessionstart",Se),Ce.addEventListener("sessionend",Be),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===E)return;if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===Ce.enabled&&!0===Ce.isPresenting&&(!0===Ce.cameraAutoUpdate&&Ce.updateCamera(t),t=Ce.getCamera()),!0===e.isScene&&e.onBeforeRender(v,e,t,_),f=oe.get(e,m.length),f.init(t),m.push(f),G.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),F.setFromProjectionMatrix(G),k=this.localClippingEnabled,O=le.init(this.clippingPlanes,k),p=se.get(e,g.length),p.init(),g.push(p),!0===Ce.enabled&&!0===Ce.isPresenting){const e=v.xr.getDepthSensingMesh();null!==e&&Re(e,t,-1/0,v.sortObjects)}Re(e,t,0,v.sortObjects),p.finish(),!0===v.sortObjects&&p.sort(Q,U),W=!1===Ce.enabled||!1===Ce.isPresenting||!1===Ce.hasDepthSensing(),W&&he.addToRenderList(p,e),this.info.render.frame++,!0===O&&le.beginShadows();const n=f.state.shadowsArray;ce.render(n,e,t),!0===O&&le.endShadows(),!0===this.info.autoReset&&this.info.reset();const i=p.opaque,r=p.transmissive;if(f.setupLights(),t.isArrayCamera){const n=t.cameras;if(r.length>0)for(let t=0,a=n.length;t<a;t++)Qe(i,r,e,n[t]);W&&he.render(e);for(let t=0,i=n.length;t<i;t++){const i=n[t];De(p,e,i,i.viewport)}}else r.length>0&&Qe(i,r,e,t),W&&he.render(e),De(p,e,t);null!==_&&(Z.updateMultisampleRenderTarget(_),Z.updateRenderTargetMipmap(_)),!0===e.isScene&&e.onAfterRender(v,e,t),ge.resetDefaultState(),I=-1,x=null,m.pop(),m.length>0?(f=m[m.length-1],!0===O&&le.setGlobalState(v.clippingPlanes,f.state.camera)):f=null,g.pop(),p=g.length>0?g[g.length-1]:null},this.renderCubeMapNormals=function(e){const t=function(e){const t=new Set;return e.traverse(e=>{e.isMesh&&e.geometry&&e.material&&e.material.isMeshDiamondMaterial&&t.add(e.geometry)}),t}(e);if(0===t.size)return;const n=new Xo;n.side=2;const i=new Ko;for(const e of t)if(!e.cubeMapNormalTarget){const t=new Kr(512,{type:j.has("EXT_color_buffer_half_float")||j.has("EXT_color_buffer_float")?$e:Xe,magFilter:ze,minFilter:ze});e.cubeMapNormalTarget=t;const r=new Yr(1e-4,100,t),a=new Ur(e);a.material=n,a.computeOffsets(),i.add(a),i.add(r),r.update(this,i),i.remove(a),i.remove(r),a.geometry=null,a.material=null}},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return _},this.setRenderTargetTextures=function(e,t,n){J.get(e.texture).__webglTexture=t,J.get(e.depthTexture).__webglTexture=n;const i=J.get(e);i.__hasExternalTextures=!0,i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===j.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(e,t){const n=J.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){_=e,b=t,C=n;let i=!0,r=null,a=!1,s=!1;if(e){const o=J.get(e);void 0!==o.__useDefaultFramebuffer?(X.bindFramebuffer(ve.FRAMEBUFFER,null),i=!1):void 0===o.__webglFramebuffer?Z.setupRenderTarget(e):o.__hasExternalTextures&&Z.rebindTextures(e,J.get(e.texture).__webglTexture,J.get(e.depthTexture).__webglTexture);const l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(s=!0);const c=J.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(c[t])?c[t][n]:c[t],a=!0):r=e.samples>0&&!1===Z.useMultisampledRTT(e)?J.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,y.copy(e.viewport),w.copy(e.scissor),M=e.scissorTest}else y.copy(L).multiplyScalar(D).floor(),w.copy(P).multiplyScalar(D).floor(),M=N;if(X.bindFramebuffer(ve.FRAMEBUFFER,r)&&i&&X.drawBuffers(e,r),X.viewport(y),X.scissor(w),X.setScissorTest(M),a){const i=J.get(e.texture);ve.framebufferTexture2D(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(s){const i=J.get(e.texture),r=t||0;ve.framebufferTextureLayer(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,i.__webglTexture,n||0,r)}I=-1},this.readRenderTargetPixels=function(e,t,n,i,r,a,s){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=J.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){X.bindFramebuffer(ve.FRAMEBUFFER,o);try{const s=e.texture,o=s.format,l=s.type;if(!Y.textureFormatReadable(o))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!Y.textureTypeReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&ve.readPixels(t,n,i,r,fe.convert(o),fe.convert(l),a)}finally{const e=null!==_?J.get(_).__webglFramebuffer:null;X.bindFramebuffer(ve.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,i,r,a,s){if(!e||!e.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=J.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){X.bindFramebuffer(ve.FRAMEBUFFER,o);try{const s=e.texture,o=s.format,l=s.type;if(!Y.textureFormatReadable(o))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Y.textureTypeReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r){const e=ve.createBuffer();ve.bindBuffer(ve.PIXEL_PACK_BUFFER,e),ve.bufferData(ve.PIXEL_PACK_BUFFER,a.byteLength,ve.STREAM_READ),ve.readPixels(t,n,i,r,fe.convert(o),fe.convert(l),0),ve.flush();const s=ve.fenceSync(ve.SYNC_GPU_COMMANDS_COMPLETE,0);await function(e,t){return new Promise(function(n,i){setTimeout(function r(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(r,4);break;default:n()}},4)})}(ve,s);try{ve.bindBuffer(ve.PIXEL_PACK_BUFFER,e),ve.getBufferSubData(ve.PIXEL_PACK_BUFFER,0,a)}finally{ve.deleteBuffer(e),ve.deleteSync(s)}return a}}finally{const e=null!==_?J.get(_).__webglFramebuffer:null;X.bindFramebuffer(ve.FRAMEBUFFER,e)}}},this.copyFramebufferToTexture=function(e,t=null,n=0){!0!==e.isTexture&&(console.warn("WebGLRenderer: copyFramebufferToTexture function signature has changed."),t=arguments[0]||null,e=arguments[1]);const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),a=Math.floor(e.image.height*i),s=null!==t?t.x:0,o=null!==t?t.y:0;Z.setTexture2D(e,0),ve.copyTexSubImage2D(ve.TEXTURE_2D,n,0,0,s,o,r,a),X.unbindTexture()},this.copyTextureToTexture=function(e,t,n=null,i=null,r=0){let a,s,o,l,c,h;!0!==e.isTexture&&(console.warn("WebGLRenderer: copyTextureToTexture function signature has changed."),i=arguments[0]||null,e=arguments[1],t=arguments[2],r=arguments[3]||0,n=null),null!==n?(a=n.max.x-n.min.x,s=n.max.y-n.min.y,o=n.min.x,l=n.min.y):(a=e.image.width,s=e.image.height,o=0,l=0),null!==i?(c=i.x,h=i.y):(c=0,h=0);const A=fe.convert(t.format),u=fe.convert(t.type);Z.setTexture2D(t,0),ve.pixelStorei(ve.UNPACK_FLIP_Y_WEBGL,t.flipY),ve.pixelStorei(ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),ve.pixelStorei(ve.UNPACK_ALIGNMENT,t.unpackAlignment);const d=ve.getParameter(ve.UNPACK_ROW_LENGTH),p=ve.getParameter(ve.UNPACK_IMAGE_HEIGHT),f=ve.getParameter(ve.UNPACK_SKIP_PIXELS),g=ve.getParameter(ve.UNPACK_SKIP_ROWS),m=ve.getParameter(ve.UNPACK_SKIP_IMAGES),v=e.isCompressedTexture?e.mipmaps[r]:e.image;ve.pixelStorei(ve.UNPACK_ROW_LENGTH,v.width),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,v.height),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,o),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,l),e.isDataTexture?ve.texSubImage2D(ve.TEXTURE_2D,r,c,h,a,s,A,u,v.data):e.isCompressedTexture?ve.compressedTexSubImage2D(ve.TEXTURE_2D,r,c,h,v.width,v.height,A,v.data):ve.texSubImage2D(ve.TEXTURE_2D,r,c,h,A,u,v),ve.pixelStorei(ve.UNPACK_ROW_LENGTH,d),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,p),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,f),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,g),ve.pixelStorei(ve.UNPACK_SKIP_IMAGES,m),0===r&&t.generateMipmaps&&ve.generateMipmap(ve.TEXTURE_2D),X.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n=null,i=null,r=0){let a,s,o,l,c,h,A,u,d;!0!==e.isTexture&&(console.warn("WebGLRenderer: copyTextureToTexture3D function signature has changed."),n=arguments[0]||null,i=arguments[1]||null,e=arguments[2],t=arguments[3],r=arguments[4]||0);const p=e.isCompressedTexture?e.mipmaps[r]:e.image;null!==n?(a=n.max.x-n.min.x,s=n.max.y-n.min.y,o=n.max.z-n.min.z,l=n.min.x,c=n.min.y,h=n.min.z):(a=p.width,s=p.height,o=p.depth,l=0,c=0,h=0),null!==i?(A=i.x,u=i.y,d=i.z):(A=0,u=0,d=0);const f=fe.convert(t.format),g=fe.convert(t.type);let m;if(t.isData3DTexture)Z.setTexture3D(t,0),m=ve.TEXTURE_3D;else{if(!t.isDataArrayTexture&&!t.isCompressedArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Z.setTexture2DArray(t,0),m=ve.TEXTURE_2D_ARRAY}ve.pixelStorei(ve.UNPACK_FLIP_Y_WEBGL,t.flipY),ve.pixelStorei(ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),ve.pixelStorei(ve.UNPACK_ALIGNMENT,t.unpackAlignment);const v=ve.getParameter(ve.UNPACK_ROW_LENGTH),E=ve.getParameter(ve.UNPACK_IMAGE_HEIGHT),b=ve.getParameter(ve.UNPACK_SKIP_PIXELS),C=ve.getParameter(ve.UNPACK_SKIP_ROWS),_=ve.getParameter(ve.UNPACK_SKIP_IMAGES);ve.pixelStorei(ve.UNPACK_ROW_LENGTH,p.width),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,p.height),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,l),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,c),ve.pixelStorei(ve.UNPACK_SKIP_IMAGES,h),e.isDataTexture||e.isData3DTexture?ve.texSubImage3D(m,r,A,u,d,a,s,o,f,g,p.data):t.isCompressedArrayTexture?ve.compressedTexSubImage3D(m,r,A,u,d,a,s,o,f,p.data):ve.texSubImage3D(m,r,A,u,d,a,s,o,f,g,p),ve.pixelStorei(ve.UNPACK_ROW_LENGTH,v),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,E),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,b),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,C),ve.pixelStorei(ve.UNPACK_SKIP_IMAGES,_),0===r&&t.generateMipmaps&&ve.generateMipmap(m),X.unbindTexture()},this.initRenderTarget=function(e){void 0===J.get(e).__webglFramebuffer&&Z.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?Z.setTextureCube(e,0):e.isData3DTexture?Z.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?Z.setTexture2DArray(e,0):Z.setTexture2D(e,0),X.unbindTexture()},this.resetState=function(){b=0,C=0,_=null,X.reset(),ge.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Gt}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===xt?"display-p3":"srgb",t.unpackColorSpace=fn.workingColorSpace===yt?"display-p3":"srgb"}}class Zo{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=Ot,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=jt()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return hn("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}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,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];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=jt()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}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=jt()),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}}}const $o=new Rn;class el{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}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,n=this.data.count;t<n;t++)$o.fromBufferAttribute(this,t),$o.applyMatrix4(e),this.setXYZ(t,$o.x,$o.y,$o.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)$o.fromBufferAttribute(this,t),$o.applyNormalMatrix(e),this.setXYZ(t,$o.x,$o.y,$o.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)$o.fromBufferAttribute(this,t),$o.transformDirection(e),this.setXYZ(t,$o.x,$o.y,$o.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Jt(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Zt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Zt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Zt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Zt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Zt(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=Jt(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Jt(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Jt(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Jt(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zt(t,this.array),n=Zt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zt(t,this.array),n=Zt(n,this.array),i=Zt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zt(t,this.array),n=Zt(n,this.array),i=Zt(i,this.array),r=Zt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new ar(new this.array.constructor(e),this.itemSize,this.normalized)}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new el(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}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}}}const tl=new Rn,nl=new yn,il=new yn,rl=new Rn,al=new oi,sl=new Rn,ol=new Zn,ll=new oi,cl=new si;class hl extends Ur{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Le,this.bindMatrix=new oi,this.bindMatrixInverse=new oi,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;null===this.boundingBox&&(this.boundingBox=new Un),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,sl),this.boundingBox.expandByPoint(sl)}computeBoundingSphere(){const e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new Zn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,sl),this.boundingSphere.expandByPoint(sl)}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){const n=this.material,i=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),ol.copy(this.boundingSphere),ol.applyMatrix4(i),!1!==e.ray.intersectsSphere(ol)&&(ll.copy(i).invert(),cl.copy(e.ray).applyMatrix4(ll),null!==this.boundingBox&&!1===cl.intersectsBox(this.boundingBox)||this._computeIntersections(e,t,cl)))}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(){const e=new yn,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Le?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;nl.fromBufferAttribute(i.attributes.skinIndex,e),il.fromBufferAttribute(i.attributes.skinWeight,e),tl.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){const i=il.getComponent(e);if(0!==i){const r=nl.getComponent(e);al.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),t.addScaledVector(rl.copy(tl).applyMatrix4(al),i)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Al extends Ui{constructor(){super(),this.isBone=!0,this.type="Bone"}}class ul extends xn{constructor(e=null,t=1,n=1,i,r,a,s,o,l=1003,c=1003,h,A){super(null,a,s,o,l,c,i,r,h,A),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const dl=new oi,pl=new oi;class fl{constructor(e=[],t=[]){this.uuid=jt(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const 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){console.warn("THREE.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 oi)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const t=new oi;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++){const t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const 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(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let i=0,r=e.length;i<r;i++){const r=e[i]?e[i].matrixWorld:pl;dl.multiplyMatrices(r,t[i]),dl.toArray(n,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new fl(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length);e=4*Math.ceil(e/4),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new ul(t,e,e,tt,Ze);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const n=this.bones[t];if(n.name===e)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const i=e.bones[n];let r=t[i];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),r=new Al),this.bones.push(r),this.boneInverses.push((new oi).fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const r=t[i];e.bones.push(r.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class gl extends ar{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const ml=new oi,vl=new oi,El=[],bl=new Un,Cl=new oi,_l=new Ur,Il=new Zn;class xl extends Ur{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new gl(new Float32Array(16*n),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<n;e++)this.setMatrixAt(e,Cl)}computeBoundingBox(){const e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new Un),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ml),bl.copy(e.boundingBox).applyMatrix4(ml),this.boundingBox.union(bl)}computeBoundingSphere(){const e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new Zn),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ml),Il.copy(e.boundingSphere).applyMatrix4(ml),this.boundingSphere.union(Il)}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){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=e*(n.length+1)+1;for(let e=0;e<n.length;e++)n[e]=i[r+e]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(_l.geometry=this.geometry,_l.material=this.material,void 0!==_l.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),Il.copy(this.boundingSphere),Il.applyMatrix4(n),!1!==e.ray.intersectsSphere(Il)))for(let r=0;r<i;r++){this.getMatrixAt(r,ml),vl.multiplyMatrices(n,ml),_l.matrixWorld=vl,_l.raycast(e,El);for(let e=0,n=El.length;e<n;e++){const n=El[e];n.instanceId=r,n.object=this,t.push(n)}El.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new gl(new Float32Array(3*this.instanceMatrix.count),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;null===this.morphTexture&&(this.morphTexture=new ul(new Float32Array(i*this.count),i,this.count,rt,Ze));const r=this.morphTexture.source.data.data;let a=0;for(let e=0;e<n.length;e++)a+=n[e];const s=this.geometry.morphTargetsRelative?1:1-a,o=i*e;r[o]=s,r.set(n,o+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null),this}}const yl=new Rn,wl=new Rn,Ml=new oi,Sl=new si,Bl=new Zn,Tl=new Rn,Rl=new Rn;class Dl extends Ui{constructor(e=new gr,t=new jo){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,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(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[0];for(let e=1,i=t.count;e<i;e++)yl.fromBufferAttribute(t,e-1),wl.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=yl.distanceTo(wl);e.setAttribute("lineDistance",new lr(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Bl.copy(n.boundingSphere),Bl.applyMatrix4(i),Bl.radius+=r,!1===e.ray.intersectsSphere(Bl))return;Ml.copy(i).invert(),Sl.copy(e.ray).applyMatrix4(Ml);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=this.isLineSegments?2:1,c=n.index,h=n.attributes.position;if(null!==c){const n=Math.max(0,a.start),i=Math.min(c.count,a.start+a.count);for(let r=n,a=i-1;r<a;r+=l){const n=c.getX(r),i=c.getX(r+1),a=Ql(this,e,Sl,o,n,i);a&&t.push(a)}if(this.isLineLoop){const r=c.getX(i-1),a=c.getX(n),s=Ql(this,e,Sl,o,r,a);s&&t.push(s)}}else{const n=Math.max(0,a.start),i=Math.min(h.count,a.start+a.count);for(let r=n,a=i-1;r<a;r+=l){const n=Ql(this,e,Sl,o,r,r+1);n&&t.push(n)}if(this.isLineLoop){const r=Ql(this,e,Sl,o,i-1,n);r&&t.push(r)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function Ql(e,t,n,i,r,a){const s=e.geometry.attributes.position;if(yl.fromBufferAttribute(s,r),wl.fromBufferAttribute(s,a),n.distanceSqToSegment(yl,wl,Tl,Rl)>i)return;Tl.applyMatrix4(e.matrixWorld);const o=t.ray.origin.distanceTo(Tl);return o<t.near||o>t.far?void 0:{distance:o,point:Rl.clone().applyMatrix4(e.matrixWorld),index:r,face:null,faceIndex:null,object:e}}const Ul=new Rn,Ll=new Rn;class Pl extends Dl{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e<i;e+=2)Ul.fromBufferAttribute(t,e),Ll.fromBufferAttribute(t,e+1),n[e]=0===e?0:n[e-1],n[e+1]=n[e]+Ul.distanceTo(Ll);e.setAttribute("lineDistance",new lr(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Nl extends Dl{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}const Fl=new oi,Ol=new si,kl=new Zn,Gl=new Rn;class Hl extends Ui{constructor(e=new gr,t=new Vo){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,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){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),kl.copy(n.boundingSphere),kl.applyMatrix4(i),kl.radius+=r,!1===e.ray.intersectsSphere(kl))return;Fl.copy(i).invert(),Ol.copy(e.ray).applyMatrix4(Fl);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=n.index,c=n.attributes.position;if(null!==l)for(let n=Math.max(0,a.start),r=Math.min(l.count,a.start+a.count);n<r;n++){const r=l.getX(n);Gl.fromBufferAttribute(c,r),zl(Gl,r,o,i,e,t,this)}else for(let n=Math.max(0,a.start),r=Math.min(c.count,a.start+a.count);n<r;n++)Gl.fromBufferAttribute(c,n),zl(Gl,n,o,i,e,t,this)}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function zl(e,t,n,i,r,a,s){const o=Ol.distanceSqToPoint(e);if(o<n){const n=new Rn;Ol.closestPointToPoint(e,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;a.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:t,face:null,object:s})}}class Vl extends xn{constructor(e,t,n,i,r,a,s,o,l,c,h,A){super(null,a,s,o,l,c,i,r,h,A),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Wl extends Vl{constructor(e,t,n,i,r,a){super(e,t,n,r,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Ge,this.layerUpdates=new Set}addLayerUpdates(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class ql extends Vl{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Pe),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}function jl(e,t,n){return e&&e.constructor!==t?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function Yl(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort(function(t,n){return e[t]-e[n]}),n}function Xl(e,t,n){const i=e.length,r=new e.constructor(i);for(let a=0,s=0;s!==i;++a){const i=n[a]*t;for(let n=0;n!==t;++n)r[s++]=e[i+n]}return r}function Kl(e,t,n,i){let r=1,a=e[0];for(;void 0!==a&&void 0===a[i];)a=e[r++];if(void 0===a)return;let s=a[i];if(void 0!==s)if(Array.isArray(s))do{s=a[i],void 0!==s&&(t.push(a.time),n.push.apply(n,s)),a=e[r++]}while(void 0!==a);else if(void 0!==s.toArray)do{s=a[i],void 0!==s&&(t.push(a.time),s.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{s=a[i],void 0!==s&&(t.push(a.time),n.push(s)),a=e[r++]}while(void 0!==a)}class Jl{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let a=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(r=i,i=t[++n],e<i)break t}a=t.length;break n}if(e>=r)break e;{const s=t[1];e<s&&(n=2,r=s);for(let a=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(i=r,r=t[--n-1],e>=r)break t}a=n,n=0}}for(;n<a;){const i=n+a>>>1;e<t[i]?a=i:n=i+1}if(i=t[n],r=t[n-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let e=0;e!==i;++e)t[e]=n[r+e];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Zl extends Jl{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,a=e+1,s=i[r],o=i[a];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:r=e,s=2*t-n;break;case 2402:r=i.length-2,s=t+i[r]-i[r+1];break;default:r=e,s=n}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:a=e,o=2*n-t;break;case 2402:a=1,o=n+i[1]-i[0];break;default:a=e-1,o=t}const l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(o-n),this._offsetPrev=r*c,this._offsetNext=a*c}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,c=this._offsetPrev,h=this._offsetNext,A=this._weightPrev,u=this._weightNext,d=(n-t)/(i-t),p=d*d,f=p*d,g=-A*f+2*A*p-A*d,m=(1+A)*f+(-1.5-2*A)*p+(-.5+A)*d+1,v=(-1-u)*f+(1.5+u)*p+.5*d,E=u*f-u*p;for(let e=0;e!==s;++e)r[e]=g*a[c+e]+m*a[l+e]+v*a[o+e]+E*a[h+e];return r}}class $l extends Jl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,c=(n-t)/(i-t),h=1-c;for(let e=0;e!==s;++e)r[e]=a[l+e]*h+a[o+e]*c;return r}}class ec extends Jl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class tc{constructor(e,t,n,i){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=jl(t,this.TimeBufferType),this.values=jl(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:jl(e.times,Array),values:jl(e.values,Array)};const t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new ec(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new $l(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Zl(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case vt:t=this.InterpolantFactoryMethodDiscrete;break;case Et:t=this.InterpolantFactoryMethodLinear;break;case bt:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){const t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(t);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return vt;case this.InterpolantFactoryMethodLinear:return Et;case this.InterpolantFactoryMethodSmooth:return bt}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(1!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,a=i-1;for(;r!==i&&n[r]<e;)++r;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==r||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);const e=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*e,a*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let t=0;t!==r;t++){const i=n[t];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==a&&a>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,i,a),e=!1;break}a=i}if(void 0!==i&&(s=i,ArrayBuffer.isView(s)&&!(s instanceof DataView)))for(let t=0,n=i.length;t!==n;++t){const n=i[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}var s;return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===bt,r=e.length-1;let a=1;for(let s=1;s<r;++s){let r=!1;const o=e[s];if(o!==e[s+1]&&(1!==s||o!==e[0]))if(i)r=!0;else{const e=s*n,i=e-n,a=e+n;for(let s=0;s!==n;++s){const n=t[e+s];if(n!==t[i+s]||n!==t[a+s]){r=!0;break}}}if(r){if(s!==a){e[a]=e[s];const i=s*n,r=a*n;for(let e=0;e!==n;++e)t[r+e]=t[i+e]}++a}}if(r>0){e[a]=e[r];for(let e=r*n,i=a*n,s=0;s!==n;++s)t[i+s]=t[e+s];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=new this.constructor(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}tc.prototype.TimeBufferType=Float32Array,tc.prototype.ValueBufferType=Float32Array,tc.prototype.DefaultInterpolation=Et;class nc extends tc{constructor(e,t,n){super(e,t,n)}}nc.prototype.ValueTypeName="bool",nc.prototype.ValueBufferType=Array,nc.prototype.DefaultInterpolation=vt,nc.prototype.InterpolantFactoryMethodLinear=void 0,nc.prototype.InterpolantFactoryMethodSmooth=void 0;class ic extends tc{}ic.prototype.ValueTypeName="color";class rc extends tc{}rc.prototype.ValueTypeName="number";class ac extends Jl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(n-t)/(i-t);let l=e*s;for(let e=l+s;l!==e;l+=4)Tn.slerpFlat(r,0,a,l-s,a,l,o);return r}}class sc extends tc{InterpolantFactoryMethodLinear(e){return new ac(this.times,this.values,this.getValueSize(),e)}}sc.prototype.ValueTypeName="quaternion",sc.prototype.InterpolantFactoryMethodSmooth=void 0;class oc extends tc{constructor(e,t,n){super(e,t,n)}}oc.prototype.ValueTypeName="string",oc.prototype.ValueBufferType=Array,oc.prototype.DefaultInterpolation=vt,oc.prototype.InterpolantFactoryMethodLinear=void 0,oc.prototype.InterpolantFactoryMethodSmooth=void 0;class lc extends tc{}lc.prototype.ValueTypeName="vector";class cc{constructor(e="",t=-1,n=[],i=2500){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=jt(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let e=0,r=n.length;e!==r;++e)t.push(hc(n[e]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,i=n.length;e!==i;++e)t.push(tc.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,a=[];for(let e=0;e<r;e++){let s=[],o=[];s.push((e+r-1)%r,e,(e+1)%r),o.push(0,1,0);const l=Yl(s);s=Xl(s,1,l),o=Xl(o,1,l),i||0!==s[0]||(s.push(r),o.push(o[0])),a.push(new rc(".morphTargetInfluences["+t[e].name+"]",s,o).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const t=e;n=t.geometry&&t.geometry.animations||t.animations}for(let e=0;e<n.length;e++)if(n[e].name===t)return n[e];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let t=0,n=e.length;t<n;t++){const n=e[t],a=n.name.match(r);if(a&&a.length>1){const e=a[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const a=[];for(const e in i)a.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,r){if(0!==n.length){const a=[],s=[];Kl(n,a,s,i),0!==a.length&&r.push(new e(t,a,s))}},i=[],r=e.name||"default",a=e.fps||30,s=e.blendMode;let o=e.length||-1;const l=e.hierarchy||[];for(let e=0;e<l.length;e++){const r=l[e].keys;if(r&&0!==r.length)if(r[0].morphTargets){const e={};let t;for(t=0;t<r.length;t++)if(r[t].morphTargets)for(let n=0;n<r[t].morphTargets.length;n++)e[r[t].morphTargets[n]]=-1;for(const n in e){const e=[],a=[];for(let i=0;i!==r[t].morphTargets.length;++i){const i=r[t];e.push(i.time),a.push(i.morphTarget===n?1:0)}i.push(new rc(".morphTargetInfluence["+n+"]",e,a))}o=e.length*a}else{const a=".bones["+t[e].name+"]";n(lc,a+".position",r,"pos",i),n(sc,a+".quaternion",r,"rot",i),n(lc,a+".scale",r,"scl",i)}}return 0===i.length?null:new this(r,o,i,s)}resetDuration(){let e=0;for(let t=0,n=this.tracks.length;t!==n;++t){const n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}return this.duration=e,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(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function hc(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return rc;case"vector":case"vector2":case"vector3":case"vector4":return lc;case"color":return ic;case"quaternion":return sc;case"bool":case"boolean":return nc;case"string":return oc}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){const t=[],n=[];Kl(e.keys,t,n,"value"),e.times=t,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}const Ac={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={}}};const uc=new class{constructor(e,t,n){const i=this;let r,a=!1,s=0,o=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,!1===a&&void 0!==i.onStart&&i.onStart(e,s,o),a=!0},this.itemEnd=function(e){s++,void 0!==i.onProgress&&i.onProgress(e,s,o),s===o&&(a=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.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){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;t<n;t+=2){const n=l[t],i=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return i}return null}}};class dc{constructor(e){this.manager=void 0!==e?e:uc,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}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}}dc.DEFAULT_MATERIAL_NAME="__DEFAULT";const pc={};class fc extends Error{constructor(e,t){super(e),this.response=t}}class gc extends dc{constructor(e){super(e)}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=Ac.get(e);if(void 0!==r)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(void 0!==pc[e])return void pc[e].push({onLoad:t,onProgress:n,onError:i});pc[e]=[],pc[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,o=this.responseType;fetch(a).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const n=pc[e],i=t.body.getReader(),r=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),a=r?parseInt(r):0,s=0!==a;let o=0;const l=new ReadableStream({start(e){!function t(){i.read().then(({done:i,value:r})=>{if(i)e.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:s,loaded:o,total:a});for(let e=0,t=n.length;e<t;e++){const t=n[e];t.onProgress&&t.onProgress(i)}e.enqueue(r),t()}},t=>{e.error(t)})}()}});return new Response(l)}throw new fc(`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(void 0===s)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(s),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then(e=>i.decode(e))}}}).then(t=>{Ac.add(e,t);const n=pc[e];delete pc[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onLoad&&i.onLoad(t)}}).catch(t=>{const n=pc[e];if(void 0===n)throw this.manager.itemError(e),t;delete pc[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onError&&i.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}}class mc extends dc{constructor(e){super(e)}load(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=Ac.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;const s=on("img");function o(){c(),Ac.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){c(),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}function c(){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),r.manager.itemStart(e),s.src=e,s}}class vc extends dc{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new ul,s=new gc(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(r.withCredentials),s.load(e,function(e){let n;try{n=r.parse(e)}catch(e){if(void 0===i)return void console.error(e);i(e)}void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:Ge,a.wrapT=void 0!==n.wrapT?n.wrapT:Ge,a.magFilter=void 0!==n.magFilter?n.magFilter:qe,a.minFilter=void 0!==n.minFilter?n.minFilter:qe,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace&&(a.colorSpace=n.colorSpace),void 0!==n.flipY&&(a.flipY=n.flipY),void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=Ye),1===n.mipmapCount&&(a.minFilter=qe),void 0!==n.generateMipmaps&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n)},n,i),a}}class Ec extends dc{constructor(e){super(e)}load(e,t,n,i){const r=new xn,a=new mc(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){r.image=e,r.needsUpdate=!0,void 0!==t&&t(r)},n,i),r}}class bc extends Ui{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ki(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}const Cc=new oi,_c=new Rn,Ic=new Rn;class xc{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new nn(512,512),this.map=null,this.mapPass=null,this.matrix=new oi,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ia,this._frameExtents=new nn(1,1),this._viewportCount=1,this._viewports=[new yn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;_c.setFromMatrixPosition(e.matrixWorld),t.position.copy(_c),Ic.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Ic),t.updateMatrixWorld(),Cc.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Cc),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Cc)}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.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const 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 yc extends xc{constructor(){super(new qr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=2*qt*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class wc extends bc{constructor(e,t,n=0,i=Math.PI/3,r=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Ui.DEFAULT_UP),this.updateMatrix(),this.target=new Ui,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new yc}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}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.shadow=e.shadow.clone(),this}}const Mc=new oi,Sc=new Rn,Bc=new Rn;class Tc extends xc{constructor(){super(new qr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new nn(4,2),this._viewportCount=6,this._viewports=[new yn(2,1,1,1),new yn(0,1,1,1),new yn(3,1,1,1),new yn(1,1,1,1),new yn(3,0,1,1),new yn(1,0,1,1)],this._cubeDirections=[new Rn(1,0,0),new Rn(-1,0,0),new Rn(0,0,1),new Rn(0,0,-1),new Rn(0,1,0),new Rn(0,-1,0)],this._cubeUps=[new Rn(0,1,0),new Rn(0,1,0),new Rn(0,1,0),new Rn(0,1,0),new Rn(0,0,1),new Rn(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Sc.setFromMatrixPosition(e.matrixWorld),n.position.copy(Sc),Bc.copy(n.position),Bc.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Bc),n.updateMatrixWorld(),i.makeTranslation(-Sc.x,-Sc.y,-Sc.z),Mc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Mc)}}class Rc extends bc{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Tc}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}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}}class Dc extends xc{constructor(){super(new Ea(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Qc extends bc{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ui.DEFAULT_UP),this.updateMatrix(),this.target=new Ui,this.shadow=new Dc}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Uc{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}static extractUrlBase(e){const 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)}}class Lc extends dc{constructor(e){super(e),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=Ac.get(e);if(void 0!==a)return r.manager.itemStart(e),a.then?void a.then(n=>{t&&t(n),r.manager.itemEnd(e)}).catch(e=>{i&&i(e)}):(setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a);const s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader;const o=fetch(e,s).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(n){return Ac.add(e,n),t&&t(n),r.manager.itemEnd(e),n}).catch(function(t){i&&i(t),Ac.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)});Ac.add(e,o),r.manager.itemStart(e)}}class Pc{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Nc(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=Nc();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Nc(){return("undefined"==typeof performance?Date:performance).now()}const Fc="\\[\\]\\.:\\/",Oc=new RegExp("["+Fc+"]","g"),kc="[^"+Fc+"]",Gc="[^"+Fc.replace("\\.","")+"]",Hc=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",kc)+/(WCOD+)?/.source.replace("WCOD",Gc)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",kc)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",kc)+"$"),zc=["material","materials","bones","map"];class Vc{constructor(e,t,n){this.path=t,this.parsedPath=n||Vc.parseTrackName(t),this.node=Vc.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Vc.Composite(e,t,n):new Vc(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Oc,"")}static parseTrackName(e){const t=Hc.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==zc.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let i=0;i<e.length;i++){const r=e[i];if(r.name===t||r.uuid===t)return r;const a=n(r.children);if(a)return a}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_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){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=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;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=Vc.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(n){let i=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.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 console.error("THREE.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===i){i=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void console.error("THREE.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[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==i){if(void 0===e[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[i]}}const a=e[i];if(void 0===a){const n=t.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",e)}let s=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}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=i;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}}Vc.Composite=class{constructor(e,t,n){const i=n||Vc.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},Vc.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Vc.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Vc.prototype.GetterByBindingType=[Vc.prototype._getValue_direct,Vc.prototype._getValue_array,Vc.prototype._getValue_arrayElement,Vc.prototype._getValue_toArray],Vc.prototype.SetterByBindingTypeAndVersioning=[[Vc.prototype._setValue_direct,Vc.prototype._setValue_direct_setNeedsUpdate,Vc.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Vc.prototype._setValue_array,Vc.prototype._setValue_array_setNeedsUpdate,Vc.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Vc.prototype._setValue_arrayElement,Vc.prototype._setValue_arrayElement_setNeedsUpdate,Vc.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Vc.prototype._setValue_fromArray,Vc.prototype._setValue_fromArray_setNeedsUpdate,Vc.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Wc{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){const e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Yt(t/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:de}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=de);const qc=["Glasses","Shoes","Watches","Handbags","Rings","Bottles","Bracelets","Scarves","Hats","Necklaces","Earrings"],jc=["Linear","ACES","Neutral"],Yc=["none","pan-x","pan-y"];function Xc(e){return qc.includes(e)}const Kc={Glasses:new Rn(67.5,15,90),Shoes:new Rn(-55,30,30),Watches:new Rn(0,-10,40),Handbags:new Rn(40,0,0),Rings:new Rn(0,0,10),Bottles:new Rn(40,0,0),Bracelets:new Rn(0,0,40),Hats:new Rn(40,0,0),Scarves:new Rn(40,0,0),Necklaces:new Rn(40,0,0),Earrings:new Rn(40,0,0)},Jc="Shoes",Zc=[1e3,2e3,4e3],$c=Zc.length;function eh(e){return G(this,arguments,void 0,function*(e,t=0){try{return yield e()}catch(n){if(t>=$c)throw n;return yield new Promise(e=>setTimeout(e,Zc[t])),eh(e,t+1)}})}function th(e){return`Resource unavailable: ${e}`}function nh(){return th("Network error.")}function ih(){return th("Request aborted.")}function rh(){return th("Request timeout.")}function ah(e){return`Resource download failed with status ${e}.`}function sh(e){return`Resource has invalid body: ${e}`}function oh(){return sh("Response is null.")}function lh(){return sh("Response is not an ArrayBuffer.")}function ch(){return sh("Response is empty.")}function hh(e,t){return G(this,void 0,void 0,function*(){return eh(()=>G(this,void 0,void 0,function*(){return new Promise((n,i)=>{const r=new XMLHttpRequest;r.open("GET",e),r.responseType="arraybuffer",r.onprogress=n=>{const i=function(e,t){var n;if(e.lengthComputable&&e.total>0)return e.total;const i=parseInt(null!==(n=t.getResponseHeader("x-amz-meta-content-length"))&&void 0!==n?n:"",10);return i>0?i:null}(n,r);null!=i&&(null==t||t.updateProgress(e,n.loaded,i))},r.onload=()=>{r.status<200||r.status>=300?i(new Error(ah(r.status))):r.response?r.response instanceof ArrayBuffer?0!==r.response.byteLength?n(r.response):i(new Error(ch())):i(new Error(lh())):i(new Error(oh()))},r.onerror=()=>i(new Error(nh())),r.onabort=()=>i(new Error(ih())),r.ontimeout=()=>i(new Error(rh())),r.send()})}))})}const Ah=[Uint8Array,Uint32Array],uh=Ah.length-2,dh=["addEventListener","alert","atob","blur","btoa","cancelAnimationFrame","localStorage","location","locationbar","hash","hasOwnProperty","host","hostname","href","open","requestAnimationFrame","send"],ph=[2,12,7,1],fh=(window[dh[ph[ph[uh]]]][dh[ph[ph[ph.length-1]]]].charCodeAt(uh),0),gh=new Ah[1]([fh]);function mh(e,t,n,i){return G(this,void 0,void 0,function*(){let r=dh[15].charCodeAt(2)-10,a=dh[5].charCodeAt(6)-14;r>>=1,r+=a;const s=String.fromCharCode,o=s(r-26);a>>=2,r-=a;const l=s(r-18);a|=9,r^=a;const c=`${o}${l}`,h=s(++r);a>>=1,r^=a+2;const A=s(r-3);r^=a+29;const u="object"[(+!+[]+ +!+[])*(+!+[]+ +!+[])+r^114],d=`${h}${A}`,p=s(r-2);a<<=3,r|=a;const f=s(r-3);a^=r+9;const g=s(r+c.length),m="object"[3*+!+[]],v=`${m}${p}${g}`,E=s(a+6),b=`${u}${u}${f}${E}`,C=s(r),_=`${m}${C}${u}`;a>>=1,r-=a;const I=s(r-6);a-=7,r^=a;const x=`${I}${s(r-13)}`,y=s(r+x.length);r+=a;const w=s(r+1),M="object"[+!+[]-+!+[]];a++;const S=s(r-(a>>3)+1),B=`${M}${S}`,T=`${w}${m}${C}${f}`;a-=T.length,r+=a>>2;const R=s(r+1),D=`${y}${R}${f}`;a>>=1,r-=a;const Q=s(r-T.length),U=`${g}${Q}${Q}${m}${w}`;a-=U.length,r-=a;const L=s(r+1),P=s(r),N=`${P}${u}`;a+=r>>2,r-=a;const F=s(r+2),O=s(r+1),k=`${w}${P}${R}`,H=`${m}${w}${w}`,z=`${M}${g}${u}`;r^=a+U.length;const V=s(r+3),W=r-2<<1,q=(a<<3)+(36&r),j=yield eh(()=>G(this,void 0,void 0,function*(){return new Promise((t,n)=>{const r=new window[`${d}${c}${b}${v}${_}`];r[dh[14]](`${x}${y}`,e),r[`${T}${B}${C}${m}${D}${m}`]=`${P}${w}${k}${L}${U}`,r[`${B}${f}${w}${M}g${w}${m}${C}${C}`]=t=>{const n=t[`${u}${M}${u}${P}l`];t[`l${m}${S}g${u}hC${M}m${f}${g}${u}${P}${L}l${m}`]&&n>0&&(null==i||i[`${g}${f}d${N}${m}P${w}${M}g${w}${m}s${C}`](e,t[`l${M}${P}d${m}d`],n))},r[`${B}l${M}${P}d`]=()=>{const e=r[`${C}${u}${N}${g}${C}`];if(e<W||e>=q)return void n(new Error(ah(e)));const i=r[`${T}${B}${C}${m}`];i?i instanceof window[`${O}${w}${k}${F}${U}`]?0!==i[`${L}${R}${u}${m}${o}${m}${S}g${u}h`]?t(new Ah[0](i)):n(new Error(ch())):n(new Error(lh())):n(new Error(oh()))},r[`${B}${H}${M}${w}`]=()=>n(new Error(nh())),r[`${B}${P}${L}${M}${w}${u}`]=()=>n(new Error(ih())),r[`${B}${u}${V}m${m}${z}`]=()=>n(new Error(rh())),r[dh[16]]()})}));n+=a;const Y=j[`${L}${R}${u}${m}${o}${m}${S}g${u}h`];if(gh[fh]=Math.min(76,t)*((r>>5)-1),152===gh[fh]&&(gh[fh]=Y),n==fh)return j;n=fh,n^=fh;for(let e=0,t=j.length;e<t;e++)gh[fh]^=gh[n]<<13,gh[fh]^=gh[n]>>17,gh[fh]^=gh[n]<<5,j[e]=j[e]^gh[fh];return n^=gh[0],n^=gh[1],n^=gh[2],j})}const vh={},Eh={};function bh(e,t,n){return n?(null==vh[e]&&(vh[e]=hh(e,t).catch(t=>{throw delete vh[e],t}).finally(()=>{t.completeTask(e)})),vh[e]):hh(e,t).finally(()=>{t.completeTask(e)})}function Ch(e,t,n,i,r){return r?(null==Eh[e]&&(Eh[e]=mh(e,t,n,i).catch(t=>{throw delete Eh[e],t}).finally(()=>{i.completeTask(e)})),Eh[e]):mh(e,t,n,i).finally(()=>{i.completeTask(e)})}var _h,Ih,xh,yh,wh;class Mh{constructor(){_h.add(this),Ih.set(this,new Map),xh.set(this,null),yh.set(this,0)}setOnProgress(e){z(this,xh,e)}updateProgress(e,t,n){const i=H(this,Ih,"f").get(e);(null==i?void 0:i.completed)||(i?(i.loaded=t,i.total=n):H(this,Ih,"f").set(e,{loaded:t,total:n,completed:!1}),H(this,_h,"m",wh).call(this))}completeTask(e){const t=H(this,Ih,"f").get(e);t&&(t.loaded=t.total,t.completed=!0),H(this,_h,"m",wh).call(this)}}Ih=new WeakMap,xh=new WeakMap,yh=new WeakMap,_h=new WeakSet,wh=function(){if(null==H(this,xh,"f"))return;let e=0,t=0,n=!0;for(const i of H(this,Ih,"f").values())e+=i.loaded,t+=i.total,i.completed||(n=!1);if(H(this,Ih,"f").size>0&&n)return H(this,Ih,"f").clear(),z(this,yh,0),void H(this,xh,"f").call(this,1);const i=t>0?Math.min(e/t,1):0;z(this,yh,Math.max(H(this,yh,"f"),i)),H(this,xh,"f").call(this,H(this,yh,"f"))};class Sh extends vc{constructor(e){super(e),this.type=$e}parse(e){const t=function(e,t){switch(e){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(t||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(t||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(t||""));default:throw new Error("THREE.RGBELoader: Memory Error: "+(t||""))}},n=function(e,t,n){t=t||1024;let i=e.pos,r=-1,a=0,s="",o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));for(;0>(r=o.indexOf("\n"))&&a<t&&i<e.byteLength;)s+=o,a+=o.length,i+=128,o+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));return-1<r&&(e.pos+=a+r+1,s+o.slice(0,r))},i=function(e,t,n,i){const r=e[t+3],a=Math.pow(2,r-128)/255;n[i+0]=e[t+0]*a,n[i+1]=e[t+1]*a,n[i+2]=e[t+2]*a,n[i+3]=1},r=function(e,t,n,i){const r=e[t+3],a=Math.pow(2,r-128)/255;n[i+0]=nr(Math.min(e[t+0]*a,65504)),n[i+1]=nr(Math.min(e[t+1]*a,65504)),n[i+2]=nr(Math.min(e[t+2]*a,65504)),n[i+3]=nr(1)},a=new Uint8Array(e);a.pos=0;const s=function(e){const i=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,r=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,a=/^\s*FORMAT=(\S+)\s*$/,s=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,o={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let l,c;for((e.pos>=e.byteLength||!(l=n(e)))&&t(1,"no header found"),(c=l.match(/^#\?(\S+)/))||t(3,"bad initial token"),o.valid|=1,o.programtype=c[1],o.string+=l+"\n";l=n(e),!1!==l;)if(o.string+=l+"\n","#"!==l.charAt(0)){if((c=l.match(i))&&(o.gamma=parseFloat(c[1])),(c=l.match(r))&&(o.exposure=parseFloat(c[1])),(c=l.match(a))&&(o.valid|=2,o.format=c[1]),(c=l.match(s))&&(o.valid|=4,o.height=parseInt(c[1],10),o.width=parseInt(c[2],10)),2&o.valid&&4&o.valid)break}else o.comments+=l+"\n";return 2&o.valid||t(3,"missing format specifier"),4&o.valid||t(3,"missing image size specifier"),o}(a),o=s.width,l=s.height,c=function(e,n,i){const r=n;if(r<8||r>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);r!==(e[2]<<8|e[3])&&t(3,"wrong scanline width");const a=new Uint8Array(4*n*i);a.length||t(4,"unable to allocate buffer space");let s=0,o=0;const l=4*r,c=new Uint8Array(4),h=new Uint8Array(l);let A=i;for(;A>0&&o<e.byteLength;){o+4>e.byteLength&&t(1),c[0]=e[o++],c[1]=e[o++],c[2]=e[o++],c[3]=e[o++],2==c[0]&&2==c[1]&&(c[2]<<8|c[3])==r||t(3,"bad rgbe scanline format");let n,i=0;for(;i<l&&o<e.byteLength;){n=e[o++];const r=n>128;if(r&&(n-=128),(0===n||i+n>l)&&t(3,"bad scanline data"),r){const t=e[o++];for(let e=0;e<n;e++)h[i++]=t}else h.set(e.subarray(o,o+n),i),i+=n,o+=n}const u=r;for(let e=0;e<u;e++){let t=0;a[s]=h[e+t],t+=r,a[s+1]=h[e+t],t+=r,a[s+2]=h[e+t],t+=r,a[s+3]=h[e+t],s+=4}A--}return a}(a.subarray(a.pos),o,l);let h,A,u;switch(this.type){case Ze:u=c.length/4;const e=new Float32Array(4*u);for(let t=0;t<u;t++)i(c,4*t,e,4*t);h=e,A=Ze;break;case $e:u=c.length/4;const t=new Uint16Array(4*u);for(let e=0;e<u;e++)r(c,4*e,t,4*e);h=t,A=$e;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:o,height:l,data:h,header:s.string,gamma:s.gamma,exposure:s.exposure,type:A}}setDataType(e){return this.type=e,this}load(e,t,n,i){return super.load(e,function(e,n){switch(e.type){case Ze:case $e:e.colorSpace=It,e.minFilter=qe,e.magFilter=qe,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,n)},n,i)}}
6
+ */const de="166dev",pe=0,fe=1,ge=2,me=100,ve=101,Ee=102,be=200,Ce=201,_e=202,Ie=203,xe=204,ye=205,Me=206,we=207,Se=208,Be=209,Te=210,Re=211,De=212,Qe=213,Le=214,Ue="attached",Pe=301,Ne=302,Fe=303,Oe=306,ke=1e3,Ge=1001,He=1002,ze=1003,Ve=1004,We=1005,qe=1006,je=1007,Ye=1008,Xe=1009,Ke=1012,Je=1014,Ze=1015,$e=1016,et=1020,tt=1023,nt=1026,it=1027,rt=1028,at=1030,ot=33776,st=33777,lt=33778,ct=33779,ht=35840,At=35842,ut=36196,dt=37492,pt=37496,ft=37808,gt=37812,mt=36492,vt=2300,Et=2301,bt=2302,Ct="",_t="srgb",It="srgb-linear",xt="display-p3",yt="display-p3-linear",Mt="linear",wt="srgb",St="rec709",Bt="p3",Tt=7680,Rt=512,Dt=513,Qt=514,Lt=515,Ut=516,Pt=517,Nt=518,Ft=519,Ot=35044,kt="300 es",Gt=2e3,Ht=2001;class zt{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,i=n.length;t<i;t++)n[t].call(this,e);e.target=null}}}const Vt=["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"];const Wt=Math.PI/180,qt=180/Math.PI;function jt(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(Vt[255&e]+Vt[e>>8&255]+Vt[e>>16&255]+Vt[e>>24&255]+"-"+Vt[255&t]+Vt[t>>8&255]+"-"+Vt[t>>16&15|64]+Vt[t>>24&255]+"-"+Vt[63&n|128]+Vt[n>>8&255]+"-"+Vt[n>>16&255]+Vt[n>>24&255]+Vt[255&i]+Vt[i>>8&255]+Vt[i>>16&255]+Vt[i>>24&255]).toLowerCase()}function Yt(e,t,n){return Math.max(t,Math.min(n,e))}function Xt(e,t){return(e%t+t)%t}function Kt(e,t,n){return(1-n)*e+n*t}function Jt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function Zt(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}const $t=Wt,en=qt,tn=function(e){return e*qt};class nn{constructor(e=0,t=0){nn.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 new 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 new 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){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Yt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,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){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class rn{constructor(e,t,n,i,r,a,o,s,l){rn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,o,s,l)}set(e,t,n,i,r,a,o,s,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=r,c[5]=s,c[6]=n,c[7]=a,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const 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){const n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],c=n[4],h=n[7],A=n[2],u=n[5],d=n[8],p=i[0],f=i[3],g=i[6],m=i[1],v=i[4],E=i[7],b=i[2],C=i[5],_=i[8];return r[0]=a*p+o*m+s*b,r[3]=a*f+o*v+s*C,r[6]=a*g+o*E+s*_,r[1]=l*p+c*m+h*b,r[4]=l*f+c*v+h*C,r[7]=l*g+c*E+h*_,r[2]=A*p+u*m+d*b,r[5]=A*f+u*v+d*C,r[8]=A*g+u*E+d*_,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8];return t*a*c-t*o*l-n*r*c+n*o*s+i*r*l-i*a*s}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8],h=c*a-o*l,A=o*s-c*r,u=l*r-a*s,d=t*h+n*A+i*u;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const p=1/d;return e[0]=h*p,e[1]=(i*l-c*n)*p,e[2]=(o*n-i*a)*p,e[3]=A*p,e[4]=(c*t-i*s)*p,e[5]=(i*r-o*t)*p,e[6]=u*p,e[7]=(n*s-l*t)*p,e[8]=(a*t-n*r)*p,this}transpose(){let e;const 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){const 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,n,i,r,a,o){const s=Math.cos(r),l=Math.sin(r);return this.set(n*s,n*l,-n*(s*a+l*o)+a+e,-i*l,i*s,-i*(-l*a+s*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(an.makeScale(e,t)),this}rotate(e){return this.premultiply(an.makeRotation(-e)),this}translate(e,t){return this.premultiply(an.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){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}const an=new rn;function on(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function sn(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function ln(){const e=sn("canvas");return e.style.display="block",e}const cn={};function hn(e){e in cn||(cn[e]=!0,console.warn(e))}const An=(new rn).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),un=(new rn).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),dn={[It]:{transfer:Mt,primaries:St,toReference:e=>e,fromReference:e=>e},[_t]:{transfer:wt,primaries:St,toReference:e=>e.convertSRGBToLinear(),fromReference:e=>e.convertLinearToSRGB()},[yt]:{transfer:Mt,primaries:Bt,toReference:e=>e.applyMatrix3(un),fromReference:e=>e.applyMatrix3(An)},[xt]:{transfer:wt,primaries:Bt,toReference:e=>e.convertSRGBToLinear().applyMatrix3(un),fromReference:e=>e.applyMatrix3(An).convertLinearToSRGB()}},pn=new Set([It,yt]),fn={enabled:!0,_workingColorSpace:It,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(e){if(!pn.has(e))throw new Error(`Unsupported working color space, "${e}".`);this._workingColorSpace=e},convert:function(e,t,n){if(!1===this.enabled||t===n||!t||!n)return e;const i=dn[t].toReference;return(0,dn[n].fromReference)(i(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this._workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this._workingColorSpace)},getPrimaries:function(e){return dn[e].primaries},getTransfer:function(e){return e===Ct?Mt:dn[e].transfer}};function gn(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function mn(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let vn;class En{static getDataURL(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===vn&&(vn=sn("canvas")),vn.width=e.width,vn.height=e.height;const n=vn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=vn}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=sn("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e<r.length;e++)r[e]=255*gn(r[e]/255);return n.putImageData(i,0,0),t}if(e.data){const t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*gn(t[e]/255)):t[e]=gn(t[e]);return{data:t,width:e.width,height:e.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let bn=0;class Cn{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:bn++}),this.uuid=jt(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){!0===e&&this.version++}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t<n;t++)i[t].isDataTexture?e.push(_n(i[t].image)):e.push(_n(i[t]))}else e=_n(i);n.url=e}return t||(e.images[this.uuid]=n),n}}function _n(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?En.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let In=0;class xn extends zt{constructor(e=xn.DEFAULT_IMAGE,t=xn.DEFAULT_MAPPING,n=Ge,i=Ge,r=qe,a=1008,o=1023,s=1009,l=xn.DEFAULT_ANISOTROPY,c=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:In++}),this.uuid=jt(),this.name="",this.source=new Cn(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=s,this.offset=new nn(0,0),this.repeat=new nn(1,1),this.center=new nn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new rn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}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)}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.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const n={metadata:{version:4.6,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&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}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 ke:e.x=e.x-Math.floor(e.x);break;case Ge:e.x=e.x<0?0:1;break;case He: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 ke:e.y=e.y-Math.floor(e.y);break;case Ge:e.y=e.y<0?0:1;break;case He: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++}}xn.DEFAULT_IMAGE=null,xn.DEFAULT_MAPPING=300,xn.DEFAULT_ANISOTROPY=1;class yn{constructor(e=0,t=0,n=0,i=1){yn.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}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,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,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 new 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 new 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){const t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const 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,n,i,r;const a=.01,o=.1,s=e.elements,l=s[0],c=s[4],h=s[8],A=s[1],u=s[5],d=s[9],p=s[2],f=s[6],g=s[10];if(Math.abs(c-A)<a&&Math.abs(h-p)<a&&Math.abs(d-f)<a){if(Math.abs(c+A)<o&&Math.abs(h+p)<o&&Math.abs(d+f)<o&&Math.abs(l+u+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;const e=(l+1)/2,s=(u+1)/2,m=(g+1)/2,v=(c+A)/4,E=(h+p)/4,b=(d+f)/4;return e>s&&e>m?e<a?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(e),i=v/n,r=E/n):s>m?s<a?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(s),n=v/i,r=b/i):m<a?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(m),n=E/r,i=b/r),this.set(n,i,r,t),this}let m=Math.sqrt((f-d)*(f-d)+(h-p)*(h-p)+(A-c)*(A-c));return Math.abs(m)<.001&&(m=1),this.x=(f-d)/m,this.y=(h-p)/m,this.z=(A-c)/m,this.w=Math.acos((l+u+g-1)/2),this}setFromMatrixPosition(e){const 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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,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 Mn extends zt{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new yn(0,0,e,t),this.scissorTest=!1,this.viewport=new yn(0,0,e,t);const i={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:qe,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const r=new xn(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let e=0;e<a;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n;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,n=e.textures.length;t<n;t++)this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Cn(t),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 wn extends Mn{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Sn extends xn{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=ze,this.minFilter=ze,this.wrapR=Ge,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Bn extends xn{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=ze,this.minFilter=ze,this.wrapR=Ge,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Tn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,a,o){let s=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3];const A=r[a+0],u=r[a+1],d=r[a+2],p=r[a+3];if(0===o)return e[t+0]=s,e[t+1]=l,e[t+2]=c,void(e[t+3]=h);if(1===o)return e[t+0]=A,e[t+1]=u,e[t+2]=d,void(e[t+3]=p);if(h!==p||s!==A||l!==u||c!==d){let e=1-o;const t=s*A+l*u+c*d+h*p,n=t>=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const r=Math.sqrt(i),a=Math.atan2(r,t*n);e=Math.sin(e*a)/r,o=Math.sin(o*a)/r}const r=o*n;if(s=s*e+A*r,l=l*e+u*r,c=c*e+d*r,h=h*e+p*r,e===1-o){const e=1/Math.sqrt(s*s+l*l+c*c+h*h);s*=e,l*=e,c*=e,h*=e}}e[t]=s,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,r,a){const o=n[i],s=n[i+1],l=n[i+2],c=n[i+3],h=r[a],A=r[a+1],u=r[a+2],d=r[a+3];return e[t]=o*d+c*h+s*u-l*A,e[t+1]=s*d+c*A+l*h-o*u,e[t+2]=l*d+c*u+o*A-s*h,e[t+3]=c*d-o*h-s*A-l*u,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,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,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){const n=e._x,i=e._y,r=e._z,a=e._order,o=Math.cos,s=Math.sin,l=o(n/2),c=o(i/2),h=o(r/2),A=s(n/2),u=s(i/2),d=s(r/2);switch(a){case"XYZ":this._x=A*c*h+l*u*d,this._y=l*u*h-A*c*d,this._z=l*c*d+A*u*h,this._w=l*c*h-A*u*d;break;case"YXZ":this._x=A*c*h+l*u*d,this._y=l*u*h-A*c*d,this._z=l*c*d-A*u*h,this._w=l*c*h+A*u*d;break;case"ZXY":this._x=A*c*h-l*u*d,this._y=l*u*h+A*c*d,this._z=l*c*d+A*u*h,this._w=l*c*h-A*u*d;break;case"ZYX":this._x=A*c*h-l*u*d,this._y=l*u*h+A*c*d,this._z=l*c*d-A*u*h,this._w=l*c*h+A*u*d;break;case"YZX":this._x=A*c*h+l*u*d,this._y=l*u*h+A*c*d,this._z=l*c*d-A*u*h,this._w=l*c*h-A*u*d;break;case"XZY":this._x=A*c*h-l*u*d,this._y=l*u*h-A*c*d,this._z=l*c*d+A*u*h,this._w=l*c*h+A*u*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],o=t[5],s=t[9],l=t[2],c=t[6],h=t[10],A=n+o+h;if(A>0){const e=.5/Math.sqrt(A+1);this._w=.25/e,this._x=(c-s)*e,this._y=(r-l)*e,this._z=(a-i)*e}else if(n>o&&n>h){const e=2*Math.sqrt(1+n-o-h);this._w=(c-s)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(r+l)/e}else if(o>h){const e=2*Math.sqrt(1+o-n-h);this._w=(r-l)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(s+c)/e}else{const e=2*Math.sqrt(1+h-n-o);this._w=(a-i)/e,this._x=(r+l)/e,this._y=(s+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(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=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Yt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),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){const n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+a*o+i*l-r*s,this._y=i*c+a*s+r*o-n*l,this._z=r*c+a*l+n*s-i*o,this._w=a*c-n*o-i*s-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,r=this._z,a=this._w;let o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;const s=1-o*o;if(s<=Number.EPSILON){const e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this}const l=Math.sqrt(s),c=Math.atan2(l,o),h=Math.sin((1-t)*c)/l,A=Math.sin(t*c)/l;return this._w=a*h+this._w*A,this._x=n*h+this._x*A,this._y=i*h+this._y*A,this._z=r*h+this._z*A,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*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 Rn{constructor(e=0,t=0,n=0){Rn.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,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 new 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 new 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(Qn.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Qn.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,s=e.w,l=2*(a*i-o*n),c=2*(o*t-r*i),h=2*(r*n-a*t);return this.x=t+s*l+a*h-o*c,this.y=n+s*c+o*l-r*h,this.z=i+s*h+r*c-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){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Dn.copy(this).projectOnVector(e),this.sub(Dn)}reflect(e){return this.sub(Dn.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Yt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}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,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,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(){const e=Math.random()*Math.PI*2,t=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Dn=new Rn,Qn=new Tn;class Ln{constructor(e=new Rn(1/0,1/0,1/0),t=new Rn(-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,n=e.length;t<n;t+=3)this.expandByPoint(Pn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Pn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Pn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),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=1/0,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);const n=e.geometry;if(void 0!==n){const i=n.getAttribute("position");if(!0===t&&void 0!==i&&!0!==e.isInstancedMesh)for(let t=0,n=i.count;t<n;t++)!0===e.isMesh?e.getVertexPosition(t,Pn):Pn.fromBufferAttribute(i,t),Pn.applyMatrix4(e.matrixWorld),this.expandByPoint(Pn);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),Nn.copy(e.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),Nn.copy(n.boundingBox)),Nn.applyMatrix4(e.matrixWorld),this.union(Nn)}const i=e.children;for(let e=0,n=i.length;e<n;e++)this.expandByObject(i[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,Pn),Pn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Vn),Wn.subVectors(this.max,Vn),Fn.subVectors(e.a,Vn),On.subVectors(e.b,Vn),kn.subVectors(e.c,Vn),Gn.subVectors(On,Fn),Hn.subVectors(kn,On),zn.subVectors(Fn,kn);let t=[0,-Gn.z,Gn.y,0,-Hn.z,Hn.y,0,-zn.z,zn.y,Gn.z,0,-Gn.x,Hn.z,0,-Hn.x,zn.z,0,-zn.x,-Gn.y,Gn.x,0,-Hn.y,Hn.x,0,-zn.y,zn.x,0];return!!Yn(t,Fn,On,kn,Wn)&&(t=[1,0,0,0,1,0,0,0,1],!!Yn(t,Fn,On,kn,Wn)&&(qn.crossVectors(Gn,Hn),t=[qn.x,qn.y,qn.z],Yn(t,Fn,On,kn,Wn)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Pn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(Pn).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()||(Un[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Un[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Un[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Un[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Un[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Un[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Un[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Un[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Un)),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)}}const Un=[new Rn,new Rn,new Rn,new Rn,new Rn,new Rn,new Rn,new Rn],Pn=new Rn,Nn=new Ln,Fn=new Rn,On=new Rn,kn=new Rn,Gn=new Rn,Hn=new Rn,zn=new Rn,Vn=new Rn,Wn=new Rn,qn=new Rn,jn=new Rn;function Yn(e,t,n,i,r){for(let a=0,o=e.length-3;a<=o;a+=3){jn.fromArray(e,a);const o=r.x*Math.abs(jn.x)+r.y*Math.abs(jn.y)+r.z*Math.abs(jn.z),s=t.dot(jn),l=n.dot(jn),c=i.dot(jn);if(Math.max(-Math.max(s,l,c),Math.min(s,l,c))>o)return!1}return!0}const Xn=new Ln,Kn=new Rn,Jn=new Rn;class Zn{constructor(e=new Rn,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){const n=this.center;void 0!==t?n.copy(t):Xn.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;t<r;t++)i=Math.max(i,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(i),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){const 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){const n=this.center.distanceToSquared(e);return t.copy(e),n>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):(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;Kn.subVectors(e,this.center);const t=Kn.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.addScaledVector(Kn,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(Jn.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Kn.copy(e.center).add(Jn)),this.expandByPoint(Kn.copy(e.center).sub(Jn))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const $n=new Rn,ei=new Rn,ti=new Rn,ni=new Rn,ii=new Rn,ri=new Rn,ai=new Rn;class oi{constructor(e=new Rn,t=new Rn(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,$n)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=$n.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):($n.copy(this.origin).addScaledVector(this.direction,t),$n.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){ei.copy(e).add(t).multiplyScalar(.5),ti.copy(t).sub(e).normalize(),ni.copy(this.origin).sub(ei);const r=.5*e.distanceTo(t),a=-this.direction.dot(ti),o=ni.dot(this.direction),s=-ni.dot(ti),l=ni.lengthSq(),c=Math.abs(1-a*a);let h,A,u,d;if(c>0)if(h=a*s-o,A=a*o-s,d=r*c,h>=0)if(A>=-d)if(A<=d){const e=1/c;h*=e,A*=e,u=h*(h+a*A+2*o)+A*(a*h+A+2*s)+l}else A=r,h=Math.max(0,-(a*A+o)),u=-h*h+A*(A+2*s)+l;else A=-r,h=Math.max(0,-(a*A+o)),u=-h*h+A*(A+2*s)+l;else A<=-d?(h=Math.max(0,-(-a*r+o)),A=h>0?-r:Math.min(Math.max(-r,-s),r),u=-h*h+A*(A+2*s)+l):A<=d?(h=0,A=Math.min(Math.max(-r,-s),r),u=A*(A+2*s)+l):(h=Math.max(0,-(a*r+o)),A=h>0?r:Math.min(Math.max(-r,-s),r),u=-h*h+A*(A+2*s)+l);else A=a>0?-r:r,h=Math.max(0,-(a*A+o)),u=-h*h+A*(A+2*s)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(ei).addScaledVector(ti,A),u}intersectSphere(e,t){$n.subVectors(e.center,this.origin);const n=$n.dot(this.direction),i=$n.dot($n)-n*n,r=e.radius*e.radius;if(i>r)return null;const a=Math.sqrt(r-i),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,a,o,s;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,A=this.origin;return l>=0?(n=(e.min.x-A.x)*l,i=(e.max.x-A.x)*l):(n=(e.max.x-A.x)*l,i=(e.min.x-A.x)*l),c>=0?(r=(e.min.y-A.y)*c,a=(e.max.y-A.y)*c):(r=(e.max.y-A.y)*c,a=(e.min.y-A.y)*c),n>a||r>i?null:((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),h>=0?(o=(e.min.z-A.z)*h,s=(e.max.z-A.z)*h):(o=(e.max.z-A.z)*h,s=(e.min.z-A.z)*h),n>s||o>i?null:((o>n||n!=n)&&(n=o),(s<i||i!=i)&&(i=s),i<0?null:this.at(n>=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,$n)}intersectTriangle(e,t,n,i,r){ii.subVectors(t,e),ri.subVectors(n,e),ai.crossVectors(ii,ri);let a,o=this.direction.dot(ai);if(o>0){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}ni.subVectors(this.origin,e);const s=a*this.direction.dot(ri.crossVectors(ni,ri));if(s<0)return null;const l=a*this.direction.dot(ii.cross(ni));if(l<0)return null;if(s+l>o)return null;const c=-a*ni.dot(ai);return c<0?null:this.at(c/o,r)}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 si{constructor(e,t,n,i,r,a,o,s,l,c,h,A,u,d,p,f){si.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,n,i,r,a,o,s,l,c,h,A,u,d,p,f)}set(e,t,n,i,r,a,o,s,l,c,h,A,u,d,p,f){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=o,g[13]=s,g[2]=l,g[6]=c,g[10]=h,g[14]=A,g[3]=u,g[7]=d,g[11]=p,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 si).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const 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,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/li.setFromMatrixColumn(e,0).length(),r=1/li.setFromMatrixColumn(e,1).length(),a=1/li.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){const e=a*c,n=a*h,i=o*c,r=o*h;t[0]=s*c,t[4]=-s*h,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-o*s,t[2]=r-e*l,t[6]=i+n*l,t[10]=a*s}else if("YXZ"===e.order){const e=s*c,n=s*h,i=l*c,r=l*h;t[0]=e+r*o,t[4]=i*o-n,t[8]=a*l,t[1]=a*h,t[5]=a*c,t[9]=-o,t[2]=n*o-i,t[6]=r+e*o,t[10]=a*s}else if("ZXY"===e.order){const e=s*c,n=s*h,i=l*c,r=l*h;t[0]=e-r*o,t[4]=-a*h,t[8]=i+n*o,t[1]=n+i*o,t[5]=a*c,t[9]=r-e*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){const e=a*c,n=a*h,i=o*c,r=o*h;t[0]=s*c,t[4]=i*l-n,t[8]=e*l+r,t[1]=s*h,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){const e=a*s,n=a*l,i=o*s,r=o*l;t[0]=s*c,t[4]=r-e*h,t[8]=i*h+n,t[1]=h,t[5]=a*c,t[9]=-o*c,t[2]=-l*c,t[6]=n*h+i,t[10]=e-r*h}else if("XZY"===e.order){const e=a*s,n=a*l,i=o*s,r=o*l;t[0]=s*c,t[4]=-h,t[8]=l*c,t[1]=e*h+r,t[5]=a*c,t[9]=n*h-i,t[2]=i*h-n,t[6]=o*c,t[10]=r*h+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(hi,e,Ai)}lookAt(e,t,n){const i=this.elements;return pi.subVectors(e,t),0===pi.lengthSq()&&(pi.z=1),pi.normalize(),ui.crossVectors(n,pi),0===ui.lengthSq()&&(1===Math.abs(n.z)?pi.x+=1e-4:pi.z+=1e-4,pi.normalize(),ui.crossVectors(n,pi)),ui.normalize(),di.crossVectors(pi,ui),i[0]=ui.x,i[4]=di.x,i[8]=pi.x,i[1]=ui.y,i[5]=di.y,i[9]=pi.y,i[2]=ui.z,i[6]=di.z,i[10]=pi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],c=n[1],h=n[5],A=n[9],u=n[13],d=n[2],p=n[6],f=n[10],g=n[14],m=n[3],v=n[7],E=n[11],b=n[15],C=i[0],_=i[4],I=i[8],x=i[12],y=i[1],M=i[5],w=i[9],S=i[13],B=i[2],T=i[6],R=i[10],D=i[14],Q=i[3],L=i[7],U=i[11],P=i[15];return r[0]=a*C+o*y+s*B+l*Q,r[4]=a*_+o*M+s*T+l*L,r[8]=a*I+o*w+s*R+l*U,r[12]=a*x+o*S+s*D+l*P,r[1]=c*C+h*y+A*B+u*Q,r[5]=c*_+h*M+A*T+u*L,r[9]=c*I+h*w+A*R+u*U,r[13]=c*x+h*S+A*D+u*P,r[2]=d*C+p*y+f*B+g*Q,r[6]=d*_+p*M+f*T+g*L,r[10]=d*I+p*w+f*R+g*U,r[14]=d*x+p*S+f*D+g*P,r[3]=m*C+v*y+E*B+b*Q,r[7]=m*_+v*M+E*T+b*L,r[11]=m*I+v*w+E*R+b*U,r[15]=m*x+v*S+E*D+b*P,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],s=e[9],l=e[13],c=e[2],h=e[6],A=e[10],u=e[14];return e[3]*(+r*s*h-i*l*h-r*o*A+n*l*A+i*o*u-n*s*u)+e[7]*(+t*s*u-t*l*A+r*a*A-i*a*u+i*l*c-r*s*c)+e[11]*(+t*l*h-t*o*u-r*a*h+n*a*u+r*o*c-n*l*c)+e[15]*(-i*o*c-t*s*h+t*o*A+i*a*h-n*a*A+n*s*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8],h=e[9],A=e[10],u=e[11],d=e[12],p=e[13],f=e[14],g=e[15],m=h*f*l-p*A*l+p*s*u-o*f*u-h*s*g+o*A*g,v=d*A*l-c*f*l-d*s*u+a*f*u+c*s*g-a*A*g,E=c*p*l-d*h*l+d*o*u-a*p*u-c*o*g+a*h*g,b=d*h*s-c*p*s-d*o*A+a*p*A+c*o*f-a*h*f,C=t*m+n*v+i*E+r*b;if(0===C)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const _=1/C;return e[0]=m*_,e[1]=(p*A*r-h*f*r-p*i*u+n*f*u+h*i*g-n*A*g)*_,e[2]=(o*f*r-p*s*r+p*i*l-n*f*l-o*i*g+n*s*g)*_,e[3]=(h*s*r-o*A*r-h*i*l+n*A*l+o*i*u-n*s*u)*_,e[4]=v*_,e[5]=(c*f*r-d*A*r+d*i*u-t*f*u-c*i*g+t*A*g)*_,e[6]=(d*s*r-a*f*r-d*i*l+t*f*l+a*i*g-t*s*g)*_,e[7]=(a*A*r-c*s*r+c*i*l-t*A*l-a*i*u+t*s*u)*_,e[8]=E*_,e[9]=(d*h*r-c*p*r-d*n*u+t*p*u+c*n*g-t*h*g)*_,e[10]=(a*p*r-d*o*r+d*n*l-t*p*l-a*n*g+t*o*g)*_,e[11]=(c*o*r-a*h*r-c*n*l+t*h*l+a*n*u-t*o*u)*_,e[12]=b*_,e[13]=(c*p*i-d*h*i+d*n*A-t*p*A-c*n*f+t*h*f)*_,e[14]=(d*o*i-a*p*i-d*n*s+t*p*s+a*n*f-t*o*f)*_,e[15]=(a*h*i-c*o*i+c*n*s-t*h*s-a*n*A+t*o*A)*_,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){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,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,o=e.y,s=e.z,l=r*a,c=r*o;return this.set(l*a+n,l*o-i*s,l*s+i*o,0,l*o+i*s,c*o+n,c*s-i*a,0,l*s-i*o,c*s+i*a,r*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,a=t._y,o=t._z,s=t._w,l=r+r,c=a+a,h=o+o,A=r*l,u=r*c,d=r*h,p=a*c,f=a*h,g=o*h,m=s*l,v=s*c,E=s*h,b=n.x,C=n.y,_=n.z;return i[0]=(1-(p+g))*b,i[1]=(u+E)*b,i[2]=(d-v)*b,i[3]=0,i[4]=(u-E)*C,i[5]=(1-(A+g))*C,i[6]=(f+m)*C,i[7]=0,i[8]=(d+v)*_,i[9]=(f-m)*_,i[10]=(1-(A+p))*_,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=li.set(i[0],i[1],i[2]).length();const a=li.set(i[4],i[5],i[6]).length(),o=li.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],ci.copy(this);const s=1/r,l=1/a,c=1/o;return ci.elements[0]*=s,ci.elements[1]*=s,ci.elements[2]*=s,ci.elements[4]*=l,ci.elements[5]*=l,ci.elements[6]*=l,ci.elements[8]*=c,ci.elements[9]*=c,ci.elements[10]*=c,t.setFromRotationMatrix(ci),n.x=r,n.y=a,n.z=o,this}makePerspective(e,t,n,i,r,a,o=2e3){const s=this.elements,l=2*r/(t-e),c=2*r/(n-i),h=(t+e)/(t-e),A=(n+i)/(n-i);let u,d;if(o===Gt)u=-(a+r)/(a-r),d=-2*a*r/(a-r);else{if(o!==Ht)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);u=-a/(a-r),d=-a*r/(a-r)}return s[0]=l,s[4]=0,s[8]=h,s[12]=0,s[1]=0,s[5]=c,s[9]=A,s[13]=0,s[2]=0,s[6]=0,s[10]=u,s[14]=d,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,n,i,r,a,o=2e3){const s=this.elements,l=1/(t-e),c=1/(n-i),h=1/(a-r),A=(t+e)*l,u=(n+i)*c;let d,p;if(o===Gt)d=(a+r)*h,p=-2*h;else{if(o!==Ht)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);d=r*h,p=-1*h}return s[0]=2*l,s[4]=0,s[8]=0,s[12]=-A,s[1]=0,s[5]=2*c,s[9]=0,s[13]=-u,s[2]=0,s[6]=0,s[10]=p,s[14]=-d,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const li=new Rn,ci=new si,hi=new Rn(0,0,0),Ai=new Rn(1,1,1),ui=new Rn,di=new Rn,pi=new Rn,fi=new si,gi=new Tn;class mi{constructor(e=0,t=0,n=0,i=mi.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}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,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,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,n=!0){const i=e.elements,r=i[0],a=i[4],o=i[8],s=i[1],l=i[5],c=i[9],h=i[2],A=i[6],u=i[10];switch(t){case"XYZ":this._y=Math.asin(Yt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,u),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(A,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Yt(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,u),this._z=Math.atan2(s,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Yt(A,-1,1)),Math.abs(A)<.9999999?(this._y=Math.atan2(-h,u),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(s,r));break;case"ZYX":this._y=Math.asin(-Yt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(A,u),this._z=Math.atan2(s,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Yt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(o,u));break;case"XZY":this._z=Math.asin(-Yt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(A,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-c,u),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return fi.makeRotationFromQuaternion(e),this.setFromRotationMatrix(fi,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return gi.setFromEuler(this),this.setFromQuaternion(gi,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}}mi.DEFAULT_ORDER="XYZ";class vi{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)}isEnabled(e){return!!(this.mask&1<<e)}}let Ei=0;const bi=new Rn,Ci=new Tn,_i=new si,Ii=new Rn,xi=new Rn,yi=new Rn,Mi=new Tn,wi=new Rn(1,0,0),Si=new Rn(0,1,0),Bi=new Rn(0,0,1),Ti={type:"added"},Ri={type:"removed"},Di={type:"childadded",child:null},Qi={type:"childremoved",child:null};class Li extends zt{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ei++}),this.uuid=jt(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Li.DEFAULT_UP.clone();const e=new Rn,t=new mi,n=new Tn,i=new Rn(1,1,1);t._onChange(function(){n.setFromEuler(t,!1)}),n._onChange(function(){t.setFromQuaternion(n,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:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new si},normalMatrix:{value:new rn}}),this.matrix=new si,this.matrixWorld=new si,this.matrixWorldInv=new si,this.offsetMatrix=(new si).identity(),this.offsetMatrixInv=(new si).identity(),this.center=new Rn,this.centerOffset=new Rn,this.modelOffsetMatrix=(new si).identity(),this.modelOffsetMatrixInv=(new si).identity(),this.matrixAutoUpdate=Li.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Li.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new vi,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],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 Ci.setFromAxisAngle(e,t),this.quaternion.multiply(Ci),this}rotateOnWorldAxis(e,t){return Ci.setFromAxisAngle(e,t),this.quaternion.premultiply(Ci),this}rotateX(e){return this.rotateOnAxis(wi,e)}rotateY(e){return this.rotateOnAxis(Si,e)}rotateZ(e){return this.rotateOnAxis(Bi,e)}translateOnAxis(e,t){return bi.copy(e).applyQuaternion(this.quaternion),this.position.add(bi.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(wi,e)}translateY(e){return this.translateOnAxis(Si,e)}translateZ(e){return this.translateOnAxis(Bi,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(_i.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Ii.copy(e):Ii.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),xi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?_i.lookAt(xi,Ii,this.up):_i.lookAt(Ii,xi,this.up),this.quaternion.setFromRotationMatrix(_i),i&&(_i.extractRotation(i.matrixWorld),Ci.setFromRotationMatrix(_i),this.quaternion.premultiply(Ci.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Ti),Di.child=e,this.dispatchEvent(Di),Di.child=null):console.error("THREE.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}const t=this.children.indexOf(e);return-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Ri),Qi.child=e,this.dispatchEvent(Qi),Qi.child=null),this}removeFromParent(){const e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),_i.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),_i.multiply(e.parent.matrixWorld)),e.applyMatrix4(_i),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Ti),Di.child=e,this.dispatchEvent(Di),Di.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 n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xi,e,yi),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xi,Mi,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const 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.matrixWorldInv.copy(this.matrixWorld).invert()):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldInv.copy(this.matrixWorld).invert())),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?(this.matrixWorld.copy(this.matrix),this.matrixWorldInv.copy(this.matrixWorld).invert()):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldInv.copy(this.matrixWorld).invert())),this.modelOffsetMatrix.copy(this.matrixWorld).multiply(this.offsetMatrix),this.modelOffsetMatrixInv.copy(this.modelOffsetMatrix).invert(),!0===t){const e=this.children;for(let t=0,n=e.length;t<n;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){const t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(e=>({boxInitialized:e.boxInitialized,boxMin:e.box.min.toArray(),boxMax:e.box.max.toArray(),sphereInitialized:e.sphereInitialized,sphereRadius:e.sphere.radius,sphereCenter:e.sphere.center.toArray()})),i.maxGeometryCount=this._maxGeometryCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const n=t.shapes;if(Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const i=n[t];r(e.shapes,i)}else r(e.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let n=0,i=this.material.length;n<i;n++)t.push(r(e.materials,this.material[n]));i.material=t}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let t=0;t<this.children.length;t++)i.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let t=0;t<this.animations.length;t++){const n=this.animations[t];i.animations.push(r(e.animations,n))}}if(t){const t=a(e.geometries),i=a(e.materials),r=a(e.textures),o=a(e.images),s=a(e.shapes),l=a(e.skeletons),c=a(e.animations),h=a(e.nodes);t.length>0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function a(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}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.matrixWorldInv.copy(e.matrixWorldInv),this.offsetMatrix.copy(e.offsetMatrix),this.offsetMatrixInv.copy(e.offsetMatrixInv),this.center.copy(e.center),this.centerOffset.copy(e.centerOffset),this.modelOffsetMatrix.copy(e.modelOffsetMatrix),this.modelOffsetMatrixInv.copy(e.modelOffsetMatrixInv),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++){const n=e.children[t];this.add(n.clone())}return this}}Li.DEFAULT_UP=new Rn(0,1,0),Li.DEFAULT_MATRIX_AUTO_UPDATE=!0,Li.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Ui=new Rn,Pi=new Rn,Ni=new Rn,Fi=new Rn,Oi=new Rn,ki=new Rn,Gi=new Rn,Hi=new Rn,zi=new Rn,Vi=new Rn;class Wi{constructor(e=new Rn,t=new Rn,n=new Rn){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Ui.subVectors(e,t),i.cross(Ui);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){Ui.subVectors(i,t),Pi.subVectors(n,t),Ni.subVectors(e,t);const a=Ui.dot(Ui),o=Ui.dot(Pi),s=Ui.dot(Ni),l=Pi.dot(Pi),c=Pi.dot(Ni),h=a*l-o*o;if(0===h)return r.set(0,0,0),null;const A=1/h,u=(l*s-o*c)*A,d=(a*c-o*s)*A;return r.set(1-u-d,d,u)}static containsPoint(e,t,n,i){return null!==this.getBarycoord(e,t,n,i,Fi)&&Fi.x>=0&&Fi.y>=0&&Fi.x+Fi.y<=1}static getInterpolation(e,t,n,i,r,a,o,s){return null===this.getBarycoord(e,t,n,i,Fi)?(s.x=0,s.y=0,"z"in s&&(s.z=0),"w"in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(r,Fi.x),s.addScaledVector(a,Fi.y),s.addScaledVector(o,Fi.z),s)}static isFrontFacing(e,t,n,i){return Ui.subVectors(n,t),Pi.subVectors(e,t),Ui.cross(Pi).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),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 Ui.subVectors(this.c,this.b),Pi.subVectors(this.a,this.b),.5*Ui.cross(Pi).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Wi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Wi.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return Wi.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return Wi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Wi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let a,o;Oi.subVectors(i,n),ki.subVectors(r,n),Hi.subVectors(e,n);const s=Oi.dot(Hi),l=ki.dot(Hi);if(s<=0&&l<=0)return t.copy(n);zi.subVectors(e,i);const c=Oi.dot(zi),h=ki.dot(zi);if(c>=0&&h<=c)return t.copy(i);const A=s*h-c*l;if(A<=0&&s>=0&&c<=0)return a=s/(s-c),t.copy(n).addScaledVector(Oi,a);Vi.subVectors(e,r);const u=Oi.dot(Vi),d=ki.dot(Vi);if(d>=0&&u<=d)return t.copy(r);const p=u*l-s*d;if(p<=0&&l>=0&&d<=0)return o=l/(l-d),t.copy(n).addScaledVector(ki,o);const f=c*d-u*h;if(f<=0&&h-c>=0&&u-d>=0)return Gi.subVectors(r,i),o=(h-c)/(h-c+(u-d)),t.copy(i).addScaledVector(Gi,o);const g=1/(f+p+A);return a=p*g,o=A*g,t.copy(n).addScaledVector(Oi,a).addScaledVector(ki,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const qi={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ji={h:0,s:0,l:0},Yi={h:0,s:0,l:0};function Xi(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}class Ki{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(void 0===t&&void 0===n){const t=e;t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=_t){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,fn.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=fn.workingColorSpace){return this.r=e,this.g=t,this.b=n,fn.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=fn.workingColorSpace){if(e=Xt(e,1),t=Yt(t,0,1),n=Yt(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=Xi(r,i,e+1/3),this.g=Xi(r,i,e),this.b=Xi(r,i,e-1/3)}return fn.toWorkingColorSpace(this,i),this}setStyle(e,t=_t){function n(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===r)return this.setHex(parseInt(n,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=_t){const n=qi[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.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=gn(e.r),this.g=gn(e.g),this.b=gn(e.b),this}copyLinearToSRGB(e){return this.r=mn(e.r),this.g=mn(e.g),this.b=mn(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=_t){return fn.fromWorkingColorSpace(Ji.copy(this),e),65536*Math.round(Yt(255*Ji.r,0,255))+256*Math.round(Yt(255*Ji.g,0,255))+Math.round(Yt(255*Ji.b,0,255))}getHexString(e=_t){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=fn.workingColorSpace){fn.fromWorkingColorSpace(Ji.copy(this),t);const n=Ji.r,i=Ji.g,r=Ji.b,a=Math.max(n,i,r),o=Math.min(n,i,r);let s,l;const c=(o+a)/2;if(o===a)s=0,l=0;else{const e=a-o;switch(l=c<=.5?e/(a+o):e/(2-a-o),a){case n:s=(i-r)/e+(i<r?6:0);break;case i:s=(r-n)/e+2;break;case r:s=(n-i)/e+4}s/=6}return e.h=s,e.s=l,e.l=c,e}getRGB(e,t=fn.workingColorSpace){return fn.fromWorkingColorSpace(Ji.copy(this),t),e.r=Ji.r,e.g=Ji.g,e.b=Ji.b,e}getStyle(e=_t){fn.fromWorkingColorSpace(Ji.copy(this),e);const t=Ji.r,n=Ji.g,i=Ji.b;return e!==_t?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(e,t,n){return this.getHSL(ji),this.setHSL(ji.h+e,ji.s+t,ji.l+n)}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,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(ji),e.getHSL(Yi);const n=Kt(ji.h,Yi.h,t),i=Kt(ji.s,Yi.s,t),r=Kt(ji.l,Yi.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,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}}const Ji=new Ki;Ki.NAMES=qi;let Zi=0;class $i extends zt{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Zi++}),this.uuid=jt(),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=me,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ki(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=Tt,this.stencilZFail=Tt,this.stencilZPass=Tt,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.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}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),204!==this.blendSrc&&(n.blendSrc=this.blendSrc),205!==this.blendDst&&(n.blendDst=this.blendDst),this.blendEquation!==me&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Tt&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Tt&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Tt&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}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;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,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.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 er extends $i{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ki(16777215),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 mi,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}}const tr=function(){const e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(i[e]=0,i[256|e]=32768,r[e]=24,r[256|e]=24):t<-14?(i[e]=1024>>-t-14,i[256|e]=1024>>-t-14|32768,r[e]=-t-1,r[256|e]=-t-1):t<=15?(i[e]=t+15<<10,i[256|e]=t+15<<10|32768,r[e]=13,r[256|e]=13):t<128?(i[e]=31744,i[256|e]=64512,r[e]=24,r[256|e]=24):(i[e]=31744,i[256|e]=64512,r[e]=13,r[256|e]=13)}const a=new Uint32Array(2048),o=new Uint32Array(64),s=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;!(8388608&t);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,a[e]=t|n}for(let e=1024;e<2048;++e)a[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)o[e]=e<<23;o[31]=1199570944,o[32]=2147483648;for(let e=33;e<63;++e)o[e]=2147483648+(e-32<<23);o[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(s[e]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:a,exponentTable:o,offsetTable:s}}();const nr=function(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=Yt(e,-65504,65504),tr.floatView[0]=e;const t=tr.uint32View[0],n=t>>23&511;return tr.baseTable[n]+((8388607&t)>>tr.shiftTable[n])},ir=new Rn,rr=new nn;class ar{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=Ot,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=Ze,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return hn("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}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,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,n=this.count;t<n;t++)rr.fromBufferAttribute(this,t),rr.applyMatrix3(e),this.setXY(t,rr.x,rr.y);else if(3===this.itemSize)for(let t=0,n=this.count;t<n;t++)ir.fromBufferAttribute(this,t),ir.applyMatrix3(e),this.setXYZ(t,ir.x,ir.y,ir.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)ir.fromBufferAttribute(this,t),ir.applyMatrix4(e),this.setXYZ(t,ir.x,ir.y,ir.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ir.fromBufferAttribute(this,t),ir.applyNormalMatrix(e),this.setXYZ(t,ir.x,ir.y,ir.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ir.fromBufferAttribute(this,t),ir.transformDirection(e),this.setXYZ(t,ir.x,ir.y,ir.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Jt(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Zt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Jt(t,this.array)),t}setX(e,t){return this.normalized&&(t=Zt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Jt(t,this.array)),t}setY(e,t){return this.normalized&&(t=Zt(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=Jt(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Zt(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=Jt(t,this.array)),t}setW(e,t){return this.normalized&&(t=Zt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Zt(t,this.array),n=Zt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Zt(t,this.array),n=Zt(n,this.array),i=Zt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=Zt(t,this.array),n=Zt(n,this.array),i=Zt(i,this.array),r=Zt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==Ot&&(e.usage=this.usage),e}}class or extends ar{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class sr extends ar{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class lr extends ar{constructor(e,t,n){super(new Float32Array(e),t,n)}}let cr=0;const hr=new si,Ar=new Li,ur=new Rn,dr=new Ln,pr=new Ln,fr=new Rn;class gr extends zt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:cr++}),this.uuid=jt(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this.cubeMapNormalTarget=null}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(on(e)?sr:or)(e,1):this.index=e,this}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,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const t=(new rn).getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return hr.makeRotationFromQuaternion(e),this.applyMatrix4(hr),this}rotateX(e){return hr.makeRotationX(e),this.applyMatrix4(hr),this}rotateY(e){return hr.makeRotationY(e),this.applyMatrix4(hr),this}rotateZ(e){return hr.makeRotationZ(e),this.applyMatrix4(hr),this}translate(e,t,n){return hr.makeTranslation(e,t,n),this.applyMatrix4(hr),this}scale(e,t,n){return hr.makeScale(e,t,n),this.applyMatrix4(hr),this}lookAt(e){return Ar.lookAt(e),Ar.updateMatrix(),this.applyMatrix4(Ar.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ur).negate(),this.translate(ur.x,ur.y,ur.z),this}setFromPoints(e){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n];t.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new lr(t,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Ln);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Rn(-1/0,-1/0,-1/0),new Rn(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];dr.setFromBufferAttribute(n),this.morphTargetsRelative?(fr.addVectors(this.boundingBox.min,dr.min),this.boundingBox.expandByPoint(fr),fr.addVectors(this.boundingBox.max,dr.max),this.boundingBox.expandByPoint(fr)):(this.boundingBox.expandByPoint(dr.min),this.boundingBox.expandByPoint(dr.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.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 Zn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new Rn,1/0);if(e){const n=this.boundingSphere.center;if(dr.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];pr.setFromBufferAttribute(n),this.morphTargetsRelative?(fr.addVectors(dr.min,pr.min),dr.expandByPoint(fr),fr.addVectors(dr.max,pr.max),dr.expandByPoint(fr)):(dr.expandByPoint(pr.min),dr.expandByPoint(pr.max))}dr.getCenter(n);let i=0;for(let t=0,r=e.count;t<r;t++)fr.fromBufferAttribute(e,t),i=Math.max(i,n.distanceToSquared(fr));if(t)for(let r=0,a=t.length;r<a;r++){const a=t[r],o=this.morphTargetsRelative;for(let t=0,r=a.count;t<r;t++)fr.fromBufferAttribute(a,t),o&&(ur.fromBufferAttribute(e,t),fr.add(ur)),i=Math.max(i,n.distanceToSquared(fr))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.position,i=t.normal,r=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new ar(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],s=[];for(let e=0;e<n.count;e++)o[e]=new Rn,s[e]=new Rn;const l=new Rn,c=new Rn,h=new Rn,A=new nn,u=new nn,d=new nn,p=new Rn,f=new Rn;function g(e,t,i){l.fromBufferAttribute(n,e),c.fromBufferAttribute(n,t),h.fromBufferAttribute(n,i),A.fromBufferAttribute(r,e),u.fromBufferAttribute(r,t),d.fromBufferAttribute(r,i),c.sub(l),h.sub(l),u.sub(A),d.sub(A);const a=1/(u.x*d.y-d.x*u.y);isFinite(a)&&(p.copy(c).multiplyScalar(d.y).addScaledVector(h,-u.y).multiplyScalar(a),f.copy(h).multiplyScalar(u.x).addScaledVector(c,-d.x).multiplyScalar(a),o[e].add(p),o[t].add(p),o[i].add(p),s[e].add(f),s[t].add(f),s[i].add(f))}let m=this.groups;0===m.length&&(m=[{start:0,count:e.count}]);for(let t=0,n=m.length;t<n;++t){const n=m[t],i=n.start;for(let t=i,r=i+n.count;t<r;t+=3)g(e.getX(t+0),e.getX(t+1),e.getX(t+2))}const v=new Rn,E=new Rn,b=new Rn,C=new Rn;function _(e){b.fromBufferAttribute(i,e),C.copy(b);const t=o[e];v.copy(t),v.sub(b.multiplyScalar(b.dot(t))).normalize(),E.crossVectors(C,t);const n=E.dot(s[e])<0?-1:1;a.setXYZW(e,v.x,v.y,v.z,n)}for(let t=0,n=m.length;t<n;++t){const n=m[t],i=n.start;for(let t=i,r=i+n.count;t<r;t+=3)_(e.getX(t+0)),_(e.getX(t+1)),_(e.getX(t+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(void 0!==t){let n=this.getAttribute("normal");if(void 0===n)n=new ar(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);const i=new Rn,r=new Rn,a=new Rn,o=new Rn,s=new Rn,l=new Rn,c=new Rn,h=new Rn;if(e)for(let A=0,u=e.count;A<u;A+=3){const u=e.getX(A+0),d=e.getX(A+1),p=e.getX(A+2);i.fromBufferAttribute(t,u),r.fromBufferAttribute(t,d),a.fromBufferAttribute(t,p),c.subVectors(a,r),h.subVectors(i,r),c.cross(h),o.fromBufferAttribute(n,u),s.fromBufferAttribute(n,d),l.fromBufferAttribute(n,p),o.add(c),s.add(c),l.add(c),n.setXYZ(u,o.x,o.y,o.z),n.setXYZ(d,s.x,s.y,s.z),n.setXYZ(p,l.x,l.y,l.z)}else for(let e=0,o=t.count;e<o;e+=3)i.fromBufferAttribute(t,e+0),r.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),c.subVectors(a,r),h.subVectors(i,r),c.cross(h),n.setXYZ(e+0,c.x,c.y,c.z),n.setXYZ(e+1,c.x,c.y,c.z),n.setXYZ(e+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)fr.fromBufferAttribute(e,t),fr.normalize(),e.setXYZ(t,fr.x,fr.y,fr.z)}toNonIndexed(){function e(e,t){const n=e.array,i=e.itemSize,r=e.normalized,a=new n.constructor(t.length*i);let o=0,s=0;for(let r=0,l=t.length;r<l;r++){o=e.isInterleavedBufferAttribute?t[r]*e.data.stride+e.offset:t[r]*i;for(let e=0;e<i;e++)a[s++]=n[o++]}return new ar(a,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new gr,n=this.index.array,i=this.attributes;for(const r in i){const a=e(i[r],n);t.setAttribute(r,a)}const r=this.morphAttributes;for(const i in r){const a=[],o=r[i];for(let t=0,i=o.length;t<i;t++){const i=e(o[t],n);a.push(i)}t.morphAttributes[i]=a}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let e=0,n=a.length;e<n;e++){const n=a[e];t.addGroup(n.start,n.count,n.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,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){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const i=n[t];e.data.attributes[t]=i.toJSON(e.data)}const i={};let r=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],a=[];for(let t=0,i=n.length;t<i;t++){const i=n[t];a.push(i.toJSON(e.data))}a.length>0&&(i[t]=a,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return null!==o&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),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;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const r=e.morphAttributes;for(const e in r){const n=[],i=r[e];for(let e=0,r=i.length;e<r;e++)n.push(i[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let e=0,t=a.length;e<t;e++){const t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}const o=e.boundingBox;null!==o&&(this.boundingBox=o.clone());const s=e.boundingSphere;return null!==s&&(this.boundingSphere=s.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,null!==e.cubeMapNormalTarget&&this.cubeMapNormalTarget.copy(e.cubeMapNormalTarget),this}dispose(){this.cubeMapNormalTarget&&this.cubeMapNormalTarget.dispose(),this.dispatchEvent({type:"dispose"})}}const mr=new si,vr=new oi,Er=new Zn,br=new Rn,Cr=new Rn,_r=new Rn,Ir=new Rn,xr=new Rn,yr=new Rn,Mr=new nn,wr=new nn,Sr=new nn,Br=new Rn,Tr=new Rn,Rr=new Rn,Dr=new Rn,Qr=new Rn;class Lr extends Li{constructor(e=new gr,t=new er){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,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}computeOffsets(){this.geometry.computeBoundingBox(),this.geometry.computeBoundingSphere(),this.center=this.geometry.boundingSphere.center,this.offsetMatrix=this._computeOffsetMatrix(),this.offsetMatrixInv.copy(this.offsetMatrix).invert(),this.centerOffset.copy(this.center).applyMatrix4(this.offsetMatrixInv),this.modelOffsetMatrix.copy(this.matrixWorld).multiply(this.offsetMatrix),this.modelOffsetMatrixInv.copy(this.modelOffsetMatrix).invert()}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(r&&o){yr.set(0,0,0);for(let n=0,i=r.length;n<i;n++){const i=o[n],s=r[n];0!==i&&(xr.fromBufferAttribute(s,e),a?yr.addScaledVector(xr,i):yr.addScaledVector(xr.sub(t),i))}t.add(yr)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===n.boundingSphere&&n.computeBoundingSphere(),Er.copy(n.boundingSphere),Er.applyMatrix4(r),vr.copy(e.ray).recast(e.near),!1===Er.containsPoint(vr.origin)){if(null===vr.intersectSphere(Er,br))return;if(vr.origin.distanceToSquared(br)>(e.far-e.near)**2)return}mr.copy(r).invert(),vr.copy(e.ray).applyMatrix4(mr),null!==n.boundingBox&&!1===vr.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,vr)}}_computeOffsetMatrix(){const e=this.geometry,t=e.getAttribute("position"),n=e.getIndex(),i=new Rn(0,0,0),r=new Rn(0,0,0),a=new Rn(0,0,0),o=new Rn(0,0,0);if(void 0!==n){const s=Math.max(0,e.drawRange.start),l=(Math.min(n.count,e.drawRange.start+e.drawRange.count)-1)/3;for(let e=s;e<l;e+=3){const s=n.getX(e),l=n.getX(e+1),c=n.getX(e+2);r.set(t.getX(s),t.getY(s),t.getZ(s)),a.set(t.getX(l),t.getY(l),t.getZ(l)),o.set(t.getX(c),t.getY(c),t.getZ(c)),a.sub(r),o.sub(r),o.cross(a),o.normalize(),i.add(o)}}else for(let e=0;e<t.count;e+=3)r.set(t.getX(e),t.getY(e),t.getZ(e)),a.set(t.getX(e+1),t.getY(e+1),t.getZ(e+1)),o.set(t.getX(e+2),t.getY(e+2),t.getZ(e+2)),a.sub(r),o.sub(r),o.cross(a),o.normalize(),i.add(o);i.normalize();let s=!0,l=0;for(;s;){const e=l/3;if(n){if(e+1>=n.count)break}else if(e+1>=t.count)break;const r=n?n.getX(e):e,c=n?n.getX(e+1):e+1;a.set(t.getX(r),t.getY(r),t.getZ(r)),o.set(t.getX(c),t.getY(c),t.getZ(c)),a.sub(o),a.normalize();const h=i.dot(a);Math.abs(h-1)>.001&&a.length()>.5&&(s=!1),l+=3}o.crossVectors(a,i),o.normalize(),a.crossVectors(i,o),a.normalize();const c=new si;c.elements[0]=a.x,c.elements[1]=a.y,c.elements[2]=a.z,c.elements[3]=0,c.elements[4]=i.x,c.elements[5]=i.y,c.elements[6]=i.z,c.elements[7]=0,c.elements[8]=o.x,c.elements[9]=o.y,c.elements[10]=o.z,c.elements[11]=0,c.elements[12]=0,c.elements[13]=0,c.elements[14]=0,c.elements[15]=1;const h=e.boundingSphere.radius,A=(new si).makeScale(h,h,h);return c.multiply(A),c}_computeIntersections(e,t,n){let i;const r=this.geometry,a=this.material,o=r.index,s=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,A=r.groups,u=r.drawRange;if(null!==o)if(Array.isArray(a))for(let r=0,s=A.length;r<s;r++){const s=A[r],d=a[s.materialIndex];for(let r=Math.max(s.start,u.start),a=Math.min(o.count,Math.min(s.start+s.count,u.start+u.count));r<a;r+=3)i=Ur(this,d,e,n,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=s.materialIndex,t.push(i))}else for(let r=Math.max(0,u.start),s=Math.min(o.count,u.start+u.count);r<s;r+=3)i=Ur(this,a,e,n,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),t.push(i));else if(void 0!==s)if(Array.isArray(a))for(let r=0,o=A.length;r<o;r++){const o=A[r],d=a[o.materialIndex];for(let r=Math.max(o.start,u.start),a=Math.min(s.count,Math.min(o.start+o.count,u.start+u.count));r<a;r+=3)i=Ur(this,d,e,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,t.push(i))}else for(let r=Math.max(0,u.start),o=Math.min(s.count,u.start+u.count);r<o;r+=3)i=Ur(this,a,e,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),t.push(i))}}function Ur(e,t,n,i,r,a,o,s,l,c){e.getVertexPosition(s,Cr),e.getVertexPosition(l,_r),e.getVertexPosition(c,Ir);const h=function(e,t,n,i,r,a,o,s){let l;if(l=1===t.side?i.intersectTriangle(o,a,r,!0,s):i.intersectTriangle(r,a,o,0===t.side,s),null===l)return null;Qr.copy(s),Qr.applyMatrix4(e.matrixWorld);const c=n.ray.origin.distanceTo(Qr);return c<n.near||c>n.far?null:{distance:c,point:Qr.clone(),object:e}}(e,t,n,i,Cr,_r,Ir,Dr);if(h){r&&(Mr.fromBufferAttribute(r,s),wr.fromBufferAttribute(r,l),Sr.fromBufferAttribute(r,c),h.uv=Wi.getInterpolation(Dr,Cr,_r,Ir,Mr,wr,Sr,new nn)),a&&(Mr.fromBufferAttribute(a,s),wr.fromBufferAttribute(a,l),Sr.fromBufferAttribute(a,c),h.uv1=Wi.getInterpolation(Dr,Cr,_r,Ir,Mr,wr,Sr,new nn)),o&&(Br.fromBufferAttribute(o,s),Tr.fromBufferAttribute(o,l),Rr.fromBufferAttribute(o,c),h.normal=Wi.getInterpolation(Dr,Cr,_r,Ir,Br,Tr,Rr,new Rn),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const e={a:s,b:l,c:c,normal:new Rn,materialIndex:0};Wi.getNormal(Cr,_r,Ir,e.normal),h.face=e}return h}class Pr extends gr{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const o=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const s=[],l=[],c=[],h=[];let A=0,u=0;function d(e,t,n,i,r,a,d,p,f,g,m){const v=a/f,E=d/g,b=a/2,C=d/2,_=p/2,I=f+1,x=g+1;let y=0,M=0;const w=new Rn;for(let a=0;a<x;a++){const o=a*E-C;for(let s=0;s<I;s++){const A=s*v-b;w[e]=A*i,w[t]=o*r,w[n]=_,l.push(w.x,w.y,w.z),w[e]=0,w[t]=0,w[n]=p>0?1:-1,c.push(w.x,w.y,w.z),h.push(s/f),h.push(1-a/g),y+=1}}for(let e=0;e<g;e++)for(let t=0;t<f;t++){const n=A+t+I*e,i=A+t+I*(e+1),r=A+(t+1)+I*(e+1),a=A+(t+1)+I*e;s.push(n,i,a),s.push(i,r,a),M+=6}o.addGroup(u,M,m),u+=M,A+=y}d("z","y","x",-1,-1,n,t,e,a,r,0),d("z","y","x",1,-1,n,t,-e,a,r,1),d("x","z","y",1,1,e,n,t,i,a,2),d("x","z","y",1,-1,e,n,-t,i,a,3),d("x","y","z",1,-1,e,t,n,i,r,4),d("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(s),this.setAttribute("position",new lr(l,3)),this.setAttribute("normal",new lr(c,3)),this.setAttribute("uv",new lr(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Pr(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Nr(e){const t={};for(const n in e){t[n]={};for(const i in e[n]){const r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null):t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}}return t}function Fr(e){const t={};for(let n=0;n<e.length;n++){const i=Nr(e[n]);for(const e in i)t[e]=i[e]}return t}function Or(e){const t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:fn.workingColorSpace}const kr={clone:Nr,merge:Fr};class Gr extends $i{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_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=Nr(e.uniforms),this.uniformsGroups=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].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}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}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;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Hr extends Li{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new si,this.projectionMatrix=new si,this.projectionMatrixInverse=new si,this.coordinateSystem=Gt}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)}}const zr=new Rn,Vr=new nn,Wr=new nn;class qr extends Hr{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,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){const t=.5*this.getFilmHeight()/e;this.fov=2*qt*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*Wt*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*qt*Math.atan(Math.tan(.5*Wt*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,n){zr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(zr.x,zr.y).multiplyScalar(-e/zr.z),zr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(zr.x,zr.y).multiplyScalar(-e/zr.z)}getViewSize(e,t){return this.getViewBounds(e,Vr,Wr),t.subVectors(Wr,Vr)}setViewOffset(e,t,n,i,r,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=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*Wt*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const a=this.view;if(null!==this.view&&this.view.enabled){const e=a.fullWidth,o=a.fullHeight;r+=a.offsetX*i/e,t-=a.offsetY*n/o,i*=a.width/e,n*=a.height/o}const o=this.filmOffset;0!==o&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const 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}}const jr=-90;class Yr extends Li{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new qr(jr,1,e,t);i.layers=this.layers,this.add(i);const r=new qr(jr,1,e,t);r.layers=this.layers,this.add(r);const a=new qr(jr,1,e,t);a.layers=this.layers,this.add(a);const o=new qr(jr,1,e,t);o.layers=this.layers,this.add(o);const s=new qr(jr,1,e,t);s.layers=this.layers,this.add(s);const l=new qr(jr,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,o,s]=t;for(const e of t)this.remove(e);if(e===Gt)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),s.up.set(0,1,0),s.lookAt(0,0,-1);else{if(e!==Ht)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),s.up.set(0,-1,0),s.lookAt(0,0,-1)}for(const e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,a,o,s,l,c]=this.children,h=e.getRenderTarget(),A=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),d=e.xr.enabled;e.xr.enabled=!1;const p=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,a),e.setRenderTarget(n,2,i),e.render(t,o),e.setRenderTarget(n,3,i),e.render(t,s),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=p,e.setRenderTarget(n,5,i),e.render(t,c),e.setRenderTarget(h,A,u),e.xr.enabled=d,n.texture.needsPMREMUpdate=!0}}class Xr extends xn{constructor(e,t,n,i,r,a,o,s,l,c){super(e=void 0!==e?e:[],t=void 0!==t?t:Pe,n,i,r,a,o,s,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Kr extends wn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Xr(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:qe}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;const n={tEquirect:{value:null}},i="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new Pr(5,5,5),o=new Gr({name:"CubemapFromEquirect",uniforms:Nr(n),vertexShader:i,fragmentShader:r,side:1,blending:0});o.uniforms.tEquirect.value=t;const s=new Lr(a,o),l=t.minFilter;return t.minFilter===Ye&&(t.minFilter=qe),new Yr(1,10,this).update(e,s),t.minFilter=l,s.geometry.dispose(),s.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}const Jr=new Rn,Zr=new Rn,$r=new rn;class ea{constructor(e=new Rn(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,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Jr.subVectors(n,t).cross(Zr.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const 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){const n=e.delta(Jr),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<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){const n=t||$r.getNormalMatrix(e),i=this.coplanarPoint(Jr).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),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)}}const ta=new Zn,na=new Rn;class ia{constructor(e=new ea,t=new ea,n=new ea,i=new ea,r=new ea,a=new ea){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=2e3){const n=this.planes,i=e.elements,r=i[0],a=i[1],o=i[2],s=i[3],l=i[4],c=i[5],h=i[6],A=i[7],u=i[8],d=i[9],p=i[10],f=i[11],g=i[12],m=i[13],v=i[14],E=i[15];if(n[0].setComponents(s-r,A-l,f-u,E-g).normalize(),n[1].setComponents(s+r,A+l,f+u,E+g).normalize(),n[2].setComponents(s+a,A+c,f+d,E+m).normalize(),n[3].setComponents(s-a,A-c,f-d,E-m).normalize(),n[4].setComponents(s-o,A-h,f-p,E-v).normalize(),t===Gt)n[5].setComponents(s+o,A+h,f+p,E+v).normalize();else{if(t!==Ht)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);n[5].setComponents(o,h,p,v).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),ta.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),ta.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ta)}intersectsSprite(e){return ta.center.set(0,0,0),ta.radius=.7071067811865476,ta.applyMatrix4(e.matrixWorld),this.intersectsSphere(ta)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(na.x=i.normal.x>0?e.max.x:e.min.x,na.y=i.normal.y>0?e.max.y:e.min.y,na.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(na)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function ra(){let e=null,t=!1,n=null,i=null;function r(t,a){n(t,a),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function aa(e){const t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=t.get(n);i&&(e.deleteBuffer(i.buffer),t.delete(n))},update:function(n,i){if(n.isGLBufferAttribute){const e=t.get(n);return void((!e||e.version<n.version)&&t.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version}))}n.isInterleavedBufferAttribute&&(n=n.data);const r=t.get(n);if(void 0===r)t.set(n,function(t,n){const i=t.array,r=t.usage,a=i.byteLength,o=e.createBuffer();let s;if(e.bindBuffer(n,o),e.bufferData(n,i,r),t.onUploadCallback(),i instanceof Float32Array)s=e.FLOAT;else if(i instanceof Uint16Array)s=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(i instanceof Int16Array)s=e.SHORT;else if(i instanceof Uint32Array)s=e.UNSIGNED_INT;else if(i instanceof Int32Array)s=e.INT;else if(i instanceof Int8Array)s=e.BYTE;else if(i instanceof Uint8Array)s=e.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);s=e.UNSIGNED_BYTE}return{buffer:o,type:s,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version,size:a}}(n,i));else if(r.version<n.version){if(r.size!==n.array.byteLength)throw new 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,n,i){const r=n.array,a=n._updateRange,o=n.updateRanges;if(e.bindBuffer(i,t),-1===a.count&&0===o.length&&e.bufferSubData(i,0,r),0!==o.length){for(let t=0,n=o.length;t<n;t++){const n=o[t];e.bufferSubData(i,n.start*r.BYTES_PER_ELEMENT,r,n.start,n.count)}n.clearUpdateRanges()}-1!==a.count&&(e.bufferSubData(i,a.offset*r.BYTES_PER_ELEMENT,r,a.offset,a.count),a.count=-1),n.onUploadCallback()}(r.buffer,n,i),r.version=n.version}}}}class oa extends gr{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,a=t/2,o=Math.floor(n),s=Math.floor(i),l=o+1,c=s+1,h=e/o,A=t/s,u=[],d=[],p=[],f=[];for(let e=0;e<c;e++){const t=e*A-a;for(let n=0;n<l;n++){const i=n*h-r;d.push(i,-t,0),p.push(0,0,1),f.push(n/o),f.push(1-e/s)}}for(let e=0;e<s;e++)for(let t=0;t<o;t++){const n=t+l*e,i=t+l*(e+1),r=t+1+l*(e+1),a=t+1+l*e;u.push(n,i,a),u.push(i,r,a)}this.setIndex(u),this.setAttribute("position",new lr(d,3)),this.setAttribute("normal",new lr(p,3)),this.setAttribute("uv",new lr(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new oa(e.width,e.height,e.widthSegments,e.heightSegments)}}const sa={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn 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\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.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\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.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\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn 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}\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform 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\tvec3 diffuseColor;\n\tfloat 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\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.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\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 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\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.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\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_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\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat 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\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.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\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - 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\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#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\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat 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\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn 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\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn 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\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn 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\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid 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\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\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\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\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\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\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\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn 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\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform 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\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn 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\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#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\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_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\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( 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\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = 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\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform 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\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cubeNormals_vert:"varying vec3 vNormal;\nvarying vec3 vecPosition;\nuniform mat4 offsetMatrixInv;\nuniform vec3 center;\n#include <morphtarget_pars_vertex>\nvoid main() {\n\tvNormal = normalize((offsetMatrixInv * vec4(normal, 0.)).xyz);\n\t#include <begin_vertex>\n\ttransformed -= center;\n\t#include <morphtarget_vertex>\n\tvec4 offsetPos = offsetMatrixInv * vec4(transformed, 1.);\n\tvecPosition = (modelMatrix * offsetPos).xyz;\n\tgl_Position = projectionMatrix * modelViewMatrix * offsetPos;\n}",cubeNormals_frag:"varying vec3 vNormal;\nvarying vec3 vecPosition;\nuniform float radius;\nvoid main() {\n\tvec3 color = normalize(vNormal);\n\tcolor = color * 0.5 + 0.5;\n\tgl_FragColor = vec4(color.x, color.y, color.z, length(vecPosition) / radius);\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\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform 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\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_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\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\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 <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#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\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying 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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshdiamond_vert:"#ifndef USE_ENVMAP\n\t#define USE_ENVMAP\n#endif\nvarying vec3 vWorldPosition;\nvarying vec3 vWorldNormal;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;\nvarying vec2 vUv;\n#ifdef USE_INSTANCING\n\tuniform mat4 inverseModelMatrix;\n\tuniform mat4 modelOffsetMatrix;\n\tvarying mat4 vModelInstanceOffsetMatrix;\n\tvarying mat4 vModelInstanceOffsetMatrixInv;\n#endif\n#include <morphtarget_pars_vertex>\n#ifdef USE_MORPHTARGETS\n\tvarying vec3 vCenterOffset;\n\t#ifndef USE_INSTANCING\n\t\tuniform mat4 modelOffsetMatrixInv;\n\t#endif\n#endif\nvoid main() {\n\t#ifdef USE_INSTANCING\n\t\tvWorldNormal = (modelMatrix * instanceMatrix * vec4(normal, 0.0)).xyz;\n\t#else\n\t\tvWorldNormal = (modelMatrix * vec4(normal, 0.0)).xyz;\n\t#endif\n\t#include <beginnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#ifdef USE_MORPHTARGETS\n\t\tvCenterOffset = transformed;\n\t\t#include <morphtarget_vertex>\n\t\tvCenterOffset = transformed - vCenterOffset;\n\t\t#ifndef USE_INSTANCING\n\t\t\tvCenterOffset = (modelOffsetMatrixInv * modelMatrix * vec4(vCenterOffset, 1.0)).xyz;\n\t\t#endif\n\t#endif\n\t#include <project_vertex>\n\tvViewPosition = -mvPosition.xyz;\n\tvUv = uv;\n\t#include <worldpos_vertex>\n\tvWorldPosition = worldPosition.xyz;\n\t#ifdef USE_INSTANCING\n\t\tvModelInstanceOffsetMatrix = modelMatrix * instanceMatrix * inverseModelMatrix * modelOffsetMatrix;\n\t\tvModelInstanceOffsetMatrixInv = inverse(vModelInstanceOffsetMatrix);\n\t\t#ifdef USE_MORPHTARGETS\n\t\t\tvCenterOffset = (vModelInstanceOffsetMatrixInv * modelMatrix * vec4(vCenterOffset, 1.0)).xyz;\n\t\t#endif\n\t#endif\n}",meshdiamond_frag:"varying vec3 vWorldNormal;\nvarying vec3 vWorldPosition;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nuniform float radius;\nuniform vec3 centerOffset;\n#include <common>\n#ifdef USE_INSTANCING\n\tvarying mat4 vModelInstanceOffsetMatrix;\n\tvarying mat4 vModelInstanceOffsetMatrixInv;\n\t#define MODEL_OFFSET_MATRIX vModelInstanceOffsetMatrix\n\t#define INV_MODEL_OFFSET_MATRIX vModelInstanceOffsetMatrixInv\n#else\n\tuniform mat4 modelOffsetMatrixInv;\n\tuniform mat4 modelOffsetMatrix;\n\t#define MODEL_OFFSET_MATRIX modelOffsetMatrix\n\t#define INV_MODEL_OFFSET_MATRIX modelOffsetMatrixInv\n#endif\n#ifdef USE_MORPHTARGETS\n\tvarying vec3 vCenterOffset;\n\t#define CENTER_OFFSET (centerOffset + vCenterOffset)\n#else\n\t#define CENTER_OFFSET (centerOffset)\n#endif\nuniform mat4 projectionMatrix;\nuniform samplerCube tCubeMapNormals;\n#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#else\n\tuniform sampler2D envMap;\n#endif\nuniform float envMapIntensity;\nuniform float transmission;\nuniform vec2 transmissionSamplerSize;\nuniform sampler2D transmissionSamplerMap;\nuniform float ior;\nuniform float rIndexDelta;\nuniform float squashFactor;\nuniform float geometryFactor;\nuniform vec3 color;\nuniform vec3 colorCorrection;\nuniform vec3 boostFactors;\nuniform float gammaFactor;\nuniform float absorptionFactor;\nuniform float envMapRotation;\nuniform vec4 envMapRotationQuat;\nuniform float reflectivity;\nvec3 BRDF_Specular_GGX_Environment(const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness) {\n float dotNV = abs(dot(normal, viewDir));\n const vec4 c0 = vec4(-1, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n return specularColor * AB.x + AB.y;\n}\nvec2 cartesianToPolar(vec3 n) {\n vec2 uv;\n uv.x = atan(n.z, n.x) / (PI * 2.0) + 0.5;\n uv.y = asin(n.y) / PI + 0.5;\n return uv;\n}\nvec4 sampleEnvMap(vec3 direction) {\n\t#if !defined(USE_ENVMAP)\n\t\treturn vec4(direction, 1);\n\t#else\n\t\tfloat cs = cos(envMapRotation);\n\t\tfloat sn = sin(envMapRotation);\n\t\tfloat temp = cs * direction.x + sn * direction.z;\n\t\tdirection.z = -sn * direction.x + cs * direction.z;\n\t\tdirection.x = temp;\n\t\tdirection.x *= -1.;\n\t\tdirection.y *= -1.;\n\t\tdirection.z *= -1.;\n\t\tvec3 t = 2.0 * cross(envMapRotationQuat.xyz, direction);\n\t\tdirection += envMapRotationQuat.w * t + cross(envMapRotationQuat.xyz, t);\n\t\t#if defined( ENVMAP_TYPE_CUBE )\n\t\t\treturn (textureCube(envMap, direction));\n\t\t#elif defined( ENVMAP_TYPE_TEXTURE_2D )\n\t\t\treturn (texture2D(envMap, cartesianToPolar(direction)));\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\treturn (texture2D(envMap, cartesianToPolar(direction)));\n\t\t#endif\n\t\treturn vec4(1, 0, 1, 1);\n\t#endif\n}\nvec4 SampleSpecularReflection(vec3 direction) {\n\t#if defined(FIX_ENV_DIRECTION)\n\t\tdirection = (viewMatrix * vec4(direction, 0.0)).xyz;\n\t#endif\n\treturn envMapIntensity * (sampleEnvMap(direction));\n}\nvec4 SampleSpecularContribution(vec3 direction) {\n\t#if (DIA_ORIENT_ENVMAP < 1)\n\t\tdirection = mat3(MODEL_OFFSET_MATRIX) * direction;\n\t#endif\n\t#if defined(FIX_ENV_DIRECTION)\n\t\tdirection = (viewMatrix * vec4(direction, 0.0)).xyz;\n\t#endif\n direction = normalize(direction);\n direction.x *= -1.;\n direction.z *= -1.;\n return envMapIntensity * (sampleEnvMap(direction));\n}\nvec4 SampleSpecularContributionRef(vec3 origin, int i) {\n vec4 ndcPos = projectionMatrix * viewMatrix * vec4(origin, 1.);\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n return texture2D(transmissionSamplerMap, refractionCoords);\n}\nvec3 intersectSphere(vec3 origin, vec3 direction) {\n origin -= CENTER_OFFSET;\n direction.y /= squashFactor;\n float A = dot(direction, direction);\n float B = 2. * dot(origin, direction);\n float C = dot(origin, origin) - radius * radius;\n float disc = B * B - 4. * A * C;\n if(disc > 0.) {\n disc = sqrt(disc);\n float t1 = (-B + disc) * geometryFactor / A;\n float t2 = (-B - disc) * geometryFactor / A;\n float t = (t1 > t2) ? t1 : t2;\n direction.y *= squashFactor;\n return vec3(origin + CENTER_OFFSET + direction * t);\n }\n return vec3(0.);\n}\nvec3 linePlaneIntersect(in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal) {\n return lineDirection * (dot(planeNormal, pointOnPlane - pointOnLine) / dot(planeNormal, lineDirection)) + pointOnLine;\n}\nvec4 getNormalDistance(vec3 d) {\n return textureCube(tCubeMapNormals, d);\n}\nvec3 getSurfaceNormal(vec4 surfaceInfos) {\n vec3 surfaceNormal = surfaceInfos.rgb;\n surfaceNormal = surfaceNormal * 2. - 1.;\n return -normalize(surfaceNormal);\n}\nvec3 intersect(vec3 rayOrigin,vec3 rayDirection) {\n vec3 sphereHitPoint = intersectSphere(rayOrigin, rayDirection);\n vec3 direction1 = normalize(sphereHitPoint - CENTER_OFFSET);\n vec4 normalDistanceData1 = getNormalDistance(direction1);\n float distance1 = normalDistanceData1.a * radius;\n vec3 pointOnPlane1 = CENTER_OFFSET + direction1 * distance1;\n vec3 planeNormal1 = getSurfaceNormal(normalDistanceData1);\n vec3 hitPoint1 = linePlaneIntersect(rayOrigin, rayDirection, pointOnPlane1, planeNormal1);\n vec3 direction2 = normalize(hitPoint1 - CENTER_OFFSET);\n vec4 normalDistanceData2 = getNormalDistance(direction2);\n float distance2 = normalDistanceData2.a * radius;\n vec3 pointOnPlane2 = CENTER_OFFSET + direction2 * distance2;\n vec3 hitPoint = hitPoint1;\n vec3 planeNormal2 = getSurfaceNormal(normalDistanceData2);\n hitPoint = linePlaneIntersect(rayOrigin, rayDirection, pointOnPlane2, planeNormal2);\n return hitPoint;\n}\nvec3 getRefractionColor(vec3 origin, vec3 direction, vec3 normal) {\n vec3 outColor = vec3(0.);\n const float n1 = 1.;\n const float epsilon = 1e-4;\n float f0 = (2.4 - n1) / (2.4 + n1);\n f0 *= f0;\n vec3 attenuationFactor = vec3(1.);\n vec3 newDirection = refract(direction, normal, n1 / ior);\n vec3 brdfRefracted = BRDF_Specular_GGX_Environment(newDirection, -normal, vec3(f0), 0.);\n attenuationFactor *= (vec3(1.) - brdfRefracted);\n int count = 0;\n mat4 invModelOffsetMatrix = INV_MODEL_OFFSET_MATRIX;\n newDirection = normalize((invModelOffsetMatrix * vec4(newDirection, 0.)).xyz);\n origin = (invModelOffsetMatrix * vec4(origin, 1.)).xyz;\n for (int i = 0; i < RAY_BOUNCES; i++) {\n vec3 intersectedPos = intersect(origin, newDirection);\n vec3 dist = intersectedPos - origin;\n vec3 d = normalize(intersectedPos - CENTER_OFFSET);\n vec3 mappedNormal = getNormalDistance(d).rgb;\n mappedNormal = 2. * mappedNormal - 1.;\n mappedNormal = -normalize(mappedNormal);\n float r = length(dist) / radius * absorptionFactor;\n attenuationFactor *= exp(-r * (1. - color));\n origin = intersectedPos;\n vec3 origin2 = (MODEL_OFFSET_MATRIX * vec4(intersectedPos, 1)).xyz;\n vec3 oldDir = newDirection;\n newDirection = refract(newDirection, mappedNormal, ior / n1);\n if (dot(newDirection, newDirection) < epsilon) {\n newDirection = reflect(oldDir, mappedNormal);\n if (i == RAY_BOUNCES - 1) {\n vec3 brdfReflected = BRDF_Specular_GGX_Environment(-oldDir, mappedNormal, vec3(f0), 0.);\n vec3 d1 = mat3(MODEL_OFFSET_MATRIX) * oldDir;\n d1 = normalize(d1);\n float cosT = 1. - dot(direction, d1);\n outColor += ((transmission > 0. && cosT < transmission) ? SampleSpecularContributionRef(origin2 + 0.5 * d1 * cosT, i).rgb : SampleSpecularContribution(oldDir).rgb) * attenuationFactor * colorCorrection * boostFactors * (vec3(1.) - brdfReflected);\n }\n } else {\n vec3 brdfRefracted = vec3(1.) - BRDF_Specular_GGX_Environment(newDirection, -mappedNormal, vec3(f0), 0.);\n vec3 d1 = normalize(mat3(MODEL_OFFSET_MATRIX) * newDirection);\n float cosT = 1. - dot(direction, d1);\n if (transmission > 0. && cosT < transmission) {\n outColor += SampleSpecularContributionRef(origin2 + 0.5 * d1 * cosT, i).rgb * brdfRefracted * attenuationFactor * colorCorrection * boostFactors;\n } else {\n vec3 dir0 = newDirection;\n vec3 dir1 = refract(oldDir, mappedNormal, (ior + rIndexDelta) / n1);\n vec3 dir2 = refract(oldDir, mappedNormal, (ior - rIndexDelta) / n1);\n outColor += vec3(SampleSpecularContribution(dir1).r, SampleSpecularContribution(dir0).g, SampleSpecularContribution(dir2).b) * brdfRefracted * attenuationFactor * colorCorrection * boostFactors;\n }\n newDirection = reflect(oldDir, mappedNormal);\n vec3 brdfReflected = BRDF_Specular_GGX_Environment(newDirection, mappedNormal, vec3(f0), 0.);\n attenuationFactor *= brdfReflected * boostFactors;\n count++;\n }\n }\n return outColor;\n}\nvoid main() {\n vec3 normalizedNormal = normalize(vWorldNormal);\n vec3 viewVector = normalize(vWorldPosition - cameraPosition);\n const float n1 = 1.;\n const float epsilon = 1e-4;\n float f0 = (2.4 - n1) / (2.4 + n1);\n f0 *= f0;\n vec3 attenuationFactor = vec3(1.);\n vec3 reflectedDirection = reflect(viewVector, normalizedNormal);\n vec3 brdfReflected = BRDF_Specular_GGX_Environment(reflectedDirection, normalizedNormal, vec3(f0), 0.);\n vec3 reflectionColor = SampleSpecularReflection(reflectedDirection).rgb * brdfReflected * reflectivity * 2.;\n vec3 refractionColor = getRefractionColor(vWorldPosition, viewVector, normalizedNormal);\n vec3 normal = normalize(vNormal);\n vec3 diffuseColor = vec3(1.);\n gl_FragColor = vec4((refractionColor.rgb + reflectionColor.rgb) * diffuseColor, 1.);\n gl_FragColor.rgb = pow(gl_FragColor.rgb, vec3(gammaFactor));\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n\tgl_FragColor.rgb = max(vec3(0.0), gl_FragColor.rgb);\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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - 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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying 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\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - 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\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\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\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#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 <packing>\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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying 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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#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\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#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\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#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\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\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\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#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\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#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\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},la={common:{diffuse:{value:new Ki(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new rn},alphaMap:{value:null},alphaMapTransform:{value:new rn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new rn}},envmap:{envMap:{value:null},envMapRotation:{value:new rn},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new rn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new rn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new rn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new rn},normalScale:{value:new nn(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new rn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new rn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new rn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new rn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ki(16777215)}},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 Ki(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new rn},alphaTest:{value:0},uvTransform:{value:new rn}},sprite:{diffuse:{value:new Ki(16777215)},opacity:{value:1},center:{value:new nn(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new rn},alphaMap:{value:null},alphaMapTransform:{value:new rn},alphaTest:{value:0}}},ca={basic:{uniforms:Fr([la.common,la.specularmap,la.envmap,la.aomap,la.lightmap,la.fog]),vertexShader:sa.meshbasic_vert,fragmentShader:sa.meshbasic_frag},cubeNormals:{uniforms:Fr([la.common,{offsetMatrixInv:{value:(new si).identity()},centerOffset:{value:new Rn(0,0,0)},radius:{value:1}}]),vertexShader:sa.cubeNormals_vert,fragmentShader:sa.cubeNormals_frag},diamond:{uniforms:Fr([la.common,la.envmap,{inverseModelMatrix:{value:(new si).identity()},modelOffsetMatrix:{value:(new si).identity()},modelOffsetMatrixInv:{value:(new si).identity()},radius:{value:1},centerOffset:{value:new Rn(0,0,0)},tCubeMapNormals:{value:null},envMapIntensity:{value:1},envMapRotation:{value:0},transmission:{value:0},transmissionSamplerSize:{value:new nn},transmissionSamplerMap:{value:null},rIndexDelta:{value:.012},squashFactor:{value:.98},geometryFactor:{value:.5},color:{value:new Rn(1,1,1)},colorCorrection:{value:new Rn(1,1,1)},boostFactors:{value:new Rn(.892,.892,.98595025)},gammaFactor:{value:1},absorptionFactor:{value:1},envMapRotationQuat:{value:new Tn}}]),vertexShader:sa.meshdiamond_vert,fragmentShader:sa.meshdiamond_frag},lambert:{uniforms:Fr([la.common,la.specularmap,la.envmap,la.aomap,la.lightmap,la.emissivemap,la.bumpmap,la.normalmap,la.displacementmap,la.fog,la.lights,{emissive:{value:new Ki(0)}}]),vertexShader:sa.meshlambert_vert,fragmentShader:sa.meshlambert_frag},phong:{uniforms:Fr([la.common,la.specularmap,la.envmap,la.aomap,la.lightmap,la.emissivemap,la.bumpmap,la.normalmap,la.displacementmap,la.fog,la.lights,{emissive:{value:new Ki(0)},specular:{value:new Ki(1118481)},shininess:{value:30}}]),vertexShader:sa.meshphong_vert,fragmentShader:sa.meshphong_frag},standard:{uniforms:Fr([la.common,la.envmap,la.aomap,la.lightmap,la.emissivemap,la.bumpmap,la.normalmap,la.displacementmap,la.roughnessmap,la.metalnessmap,la.fog,la.lights,{emissive:{value:new Ki(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:sa.meshphysical_vert,fragmentShader:sa.meshphysical_frag},toon:{uniforms:Fr([la.common,la.aomap,la.lightmap,la.emissivemap,la.bumpmap,la.normalmap,la.displacementmap,la.gradientmap,la.fog,la.lights,{emissive:{value:new Ki(0)}}]),vertexShader:sa.meshtoon_vert,fragmentShader:sa.meshtoon_frag},matcap:{uniforms:Fr([la.common,la.bumpmap,la.normalmap,la.displacementmap,la.fog,{matcap:{value:null}}]),vertexShader:sa.meshmatcap_vert,fragmentShader:sa.meshmatcap_frag},points:{uniforms:Fr([la.points,la.fog]),vertexShader:sa.points_vert,fragmentShader:sa.points_frag},dashed:{uniforms:Fr([la.common,la.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:sa.linedashed_vert,fragmentShader:sa.linedashed_frag},depth:{uniforms:Fr([la.common,la.displacementmap]),vertexShader:sa.depth_vert,fragmentShader:sa.depth_frag},normal:{uniforms:Fr([la.common,la.bumpmap,la.normalmap,la.displacementmap,{opacity:{value:1}}]),vertexShader:sa.meshnormal_vert,fragmentShader:sa.meshnormal_frag},sprite:{uniforms:Fr([la.sprite,la.fog]),vertexShader:sa.sprite_vert,fragmentShader:sa.sprite_frag},background:{uniforms:{uvTransform:{value:new rn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:sa.background_vert,fragmentShader:sa.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new rn}},vertexShader:sa.backgroundCube_vert,fragmentShader:sa.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:sa.cube_vert,fragmentShader:sa.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:sa.equirect_vert,fragmentShader:sa.equirect_frag},distanceRGBA:{uniforms:Fr([la.common,la.displacementmap,{referencePosition:{value:new Rn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:sa.distanceRGBA_vert,fragmentShader:sa.distanceRGBA_frag},shadow:{uniforms:Fr([la.lights,la.fog,{color:{value:new Ki(0)},opacity:{value:1}}]),vertexShader:sa.shadow_vert,fragmentShader:sa.shadow_frag}};ca.physical={uniforms:Fr([ca.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new rn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new rn},clearcoatNormalScale:{value:new nn(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new rn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new rn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new rn},sheen:{value:0},sheenColor:{value:new Ki(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new rn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new rn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new rn},transmissionSamplerSize:{value:new nn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new rn},attenuationDistance:{value:0},attenuationColor:{value:new Ki(0)},specularColor:{value:new Ki(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new rn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new rn},anisotropyVector:{value:new nn},anisotropyMap:{value:null},anisotropyMapTransform:{value:new rn}}]),vertexShader:sa.meshphysical_vert,fragmentShader:sa.meshphysical_frag};const ha={r:0,b:0,g:0},Aa=new mi,ua=new si;function da(e,t,n,i,r,a,o){const s=new Ki(0);let l,c,h=!0===a?0:1,A=null,u=0,d=null;function p(e){let i=!0===e.isScene?e.background:null;return i&&i.isTexture&&(i=(e.backgroundBlurriness>0?n:t).get(i)),i}function f(t,n){t.getRGB(ha,Or(e)),i.buffers.color.setClear(ha.r,ha.g,ha.b,n,o)}return{getClearColor:function(){return s},setClearColor:function(e,t=1){s.set(e),h=t,f(s,h)},getClearAlpha:function(){return h},setClearAlpha:function(e){h=e,f(s,h)},render:function(t){let n=!1;const r=p(t);null===r?f(s,h):r&&r.isColor&&(f(r,1),n=!0);const a=e.xr.getEnvironmentBlendMode();"additive"===a?i.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===a&&i.buffers.color.setClear(0,0,0,0,o),(e.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){const i=p(n);i&&(i.isCubeTexture||i.mapping===Oe)?(void 0===c&&(c=new Lr(new Pr(1,1,1),new Gr({name:"BackgroundCubeMaterial",uniforms:Nr(ca.backgroundCube.uniforms),vertexShader:ca.backgroundCube.vertexShader,fragmentShader:ca.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),Aa.copy(n.backgroundRotation),Aa.x*=-1,Aa.y*=-1,Aa.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(Aa.y*=-1,Aa.z*=-1),c.material.uniforms.envMap.value=i,c.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(ua.makeRotationFromEuler(Aa)),c.material.toneMapped=fn.getTransfer(i.colorSpace)!==wt,A===i&&u===i.version&&d===e.toneMapping||(c.material.needsUpdate=!0,A=i,u=i.version,d=e.toneMapping),c.layers.enableAll(),t.unshift(c,c.geometry,c.material,0,0,null)):i&&i.isTexture&&(void 0===l&&(l=new Lr(new oa(2,2),new Gr({name:"BackgroundMaterial",uniforms:Nr(ca.background.uniforms),vertexShader:ca.background.vertexShader,fragmentShader:ca.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=i,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=fn.getTransfer(i.colorSpace)!==wt,!0===i.matrixAutoUpdate&&i.updateMatrix(),l.material.uniforms.uvTransform.value.copy(i.matrix),A===i&&u===i.version&&d===e.toneMapping||(l.material.needsUpdate=!0,A=i,u=i.version,d=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))}}}function pa(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=c(null);let a=r,o=!1;function s(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function c(e){const t=[],i=[],r=[];for(let e=0;e<n;e++)t[e]=0,i[e]=0,r[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:i,attributeDivisors:r,object:e,attributes:{},index:null}}function h(){const e=a.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function A(e){u(e,0)}function u(t,n){const i=a.newAttributes,r=a.enabledAttributes,o=a.attributeDivisors;i[t]=1,0===r[t]&&(e.enableVertexAttribArray(t),r[t]=1),o[t]!==n&&(e.vertexAttribDivisor(t,n),o[t]=n)}function d(){const t=a.newAttributes,n=a.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==t[i]&&(e.disableVertexAttribArray(i),n[i]=0)}function p(t,n,i,r,a,o,s){!0===s?e.vertexAttribIPointer(t,n,i,a,o):e.vertexAttribPointer(t,n,i,r,a,o)}function f(){g(),o=!0,a!==r&&(a=r,s(a.object))}function g(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(n,r,l,f,g){let m=!1;const v=function(t,n,r){const a=!0===r.wireframe;let o=i[t.id];void 0===o&&(o={},i[t.id]=o);let s=o[n.id];void 0===s&&(s={},o[n.id]=s);let l=s[a];return void 0===l&&(l=c(e.createVertexArray()),s[a]=l),l}(f,l,r);a!==v&&(a=v,s(a.object)),m=function(e,t,n,i){const r=a.attributes,o=t.attributes;let s=0;const l=n.getAttributes();for(const t in l)if(l[t].location>=0){const n=r[t];let i=o[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;s++}return a.attributesNum!==s||a.index!==i}(n,f,l,g),m&&function(e,t,n,i){const r={},o=t.attributes;let s=0;const l=n.getAttributes();for(const t in l)if(l[t].location>=0){let n=o[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,s++}a.attributes=r,a.attributesNum=s,a.index=i}(n,f,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(m||o)&&(o=!1,function(n,i,r,a){h();const o=a.attributes,s=r.getAttributes(),l=i.defaultAttributeValues;for(const i in s){const r=s[i];if(r.location>=0){let s=o[i];if(void 0===s&&("instanceMatrix"===i&&n.instanceMatrix&&(s=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(s=n.instanceColor)),void 0!==s){const i=s.normalized,o=s.itemSize,l=t.get(s);if(void 0===l)continue;const c=l.buffer,h=l.type,d=l.bytesPerElement,f=h===e.INT||h===e.UNSIGNED_INT||1013===s.gpuType;if(s.isInterleavedBufferAttribute){const t=s.data,l=t.stride,g=s.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<r.locationSize;e++)u(r.location+e,t.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<r.locationSize;e++)A(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)p(r.location+e,o/r.locationSize,h,i,l*d,(g+o/r.locationSize*e)*d,f)}else{if(s.isInstancedBufferAttribute){for(let e=0;e<r.locationSize;e++)u(r.location+e,s.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=s.meshPerAttribute*s.count)}else for(let e=0;e<r.locationSize;e++)A(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)p(r.location+e,o/r.locationSize,h,i,o*d,o/r.locationSize*e*d,f)}}else if(void 0!==l){const t=l[i];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(r.location,t);break;case 3:e.vertexAttrib3fv(r.location,t);break;case 4:e.vertexAttrib4fv(r.location,t);break;default:e.vertexAttrib1fv(r.location,t)}}}}d()}(n,r,l,f),null!==g&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(g).buffer))},reset:f,resetDefaultState:g,dispose:function(){f();for(const e in i){const t=i[e];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete i[e]}},releaseStatesOfGeometry:function(e){if(void 0===i[e.id])return;const t=i[e.id];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete i[e.id]},releaseStatesOfProgram:function(e){for(const t in i){const n=i[t];if(void 0===n[e.id])continue;const r=n[e.id];for(const e in r)l(r[e].object),delete r[e];delete n[e.id]}},initAttributes:h,enableAttribute:A,disableUnusedAttributes:d}}function fa(e,t,n){let i;function r(t,r,a){0!==a&&(e.drawArraysInstanced(i,t,r,a),n.update(r,i,a))}this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.update(r,i,1)},this.renderInstances=r,this.renderMultiDraw=function(e,r,a){if(0===a)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,e,0,r,0,a);let o=0;for(let e=0;e<a;e++)o+=r[e];n.update(o,i,1)},this.renderMultiDrawInstances=function(e,a,o,s){if(0===o)return;const l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<e.length;t++)r(e[t],a[t],s[t]);else{l.multiDrawArraysInstancedWEBGL(i,e,0,a,0,s,0,o);let t=0;for(let e=0;e<o;e++)t+=a[e];for(let e=0;e<s.length;e++)n.update(t,i,s[e])}}}function ga(e,t,n,i){let r;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 o=void 0!==n.precision?n.precision:"highp";const s=a(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);const l=!0===n.logarithmicDepthBuffer,c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:a,textureFormatReadable:function(t){return t===tt||i.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===$e&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==Xe&&i.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==Ze&&!r)},precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,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),vertexTextures:h>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function ma(e){const t=this;let n=null,i=0,r=!1,a=!1;const o=new ea,s=new rn,l={value:null,needsUpdate:!1};function c(e,n,i,r){const a=null!==e?e.length:0;let c=null;if(0!==a){if(c=l.value,!0!==r||null===c){const t=i+4*a,r=n.matrixWorldInverse;s.getNormalMatrix(r),(null===c||c.length<t)&&(c=new Float32Array(t));for(let t=0,n=i;t!==a;++t,n+=4)o.copy(e[t]).applyMatrix4(r,s),o.normal.toArray(c,n),c[n+3]=o.constant}l.value=c,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){const n=0!==e.length||t||0!==i||r;return r=t,i=e.length,n},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=c(e,t,0)},this.setState=function(o,s,h){const A=o.clippingPlanes,u=o.clipIntersection,d=o.clipShadows,p=e.get(o);if(!r||null===A||0===A.length||a&&!d)a?c(null):(l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0);else{const e=a?0:i,t=4*e;let r=p.clippingState||null;l.value=r,r=c(A,s,t,h);for(let e=0;e!==t;++e)r[e]=n[e];p.clippingState=r,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=e}}}function va(e){let t=new WeakMap;function n(e,t){return t===Fe?e.mapping=Pe:304===t&&(e.mapping=Ne),e}function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping;if(a===Fe||304===a){if(t.has(r))return n(t.get(r).texture,r.mapping);{const a=r.image;if(a&&a.height>0){const o=new Kr(a.height);return o.fromEquirectangularTexture(e,r),t.set(r,o),r.addEventListener("dispose",i),n(o.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}class Ea extends Hr{constructor(e=-1,t=1,n=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,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,n,i,r,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=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,a=n+e,o=i+t,s=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,a=r+e*this.view.width,o-=t*this.view.offsetY,s=o-t*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const 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}}const ba=[.125,.215,.35,.446,.526,.582],Ca=new Ea,_a=new Ki;let Ia=null,xa=0,ya=0,Ma=!1;const wa=(1+Math.sqrt(5))/2,Sa=1/wa,Ba=[new Rn(-wa,Sa,0),new Rn(wa,Sa,0),new Rn(-Sa,0,wa),new Rn(Sa,0,wa),new Rn(0,wa,-Sa),new Rn(0,wa,Sa),new Rn(-1,1,-1),new Rn(1,1,-1),new Rn(-1,1,1),new Rn(1,1,1)];class Ta{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Ia=this._renderer.getRenderTarget(),xa=this._renderer.getActiveCubeFace(),ya=this._renderer.getActiveMipmapLevel(),Ma=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=La(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Qa(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.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._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Ia,xa,ya),this._renderer.xr.enabled=Ma,e.scissorTest=!1,Da(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Pe||e.mapping===Ne?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Ia=this._renderer.getRenderTarget(),xa=this._renderer.getActiveCubeFace(),ya=this._renderer.getActiveMipmapLevel(),Ma=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:qe,minFilter:qe,generateMipmaps:!1,type:$e,format:tt,colorSpace:It,depthBuffer:!1},i=Ra(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=Ra(e,t,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(e){const t=[],n=[],i=[];let r=e;const a=e-4+1+ba.length;for(let o=0;o<a;o++){const a=Math.pow(2,r);n.push(a);let s=1/a;o>e-4?s=ba[o-e+4-1]:0===o&&(s=0),i.push(s);const l=1/(a-2),c=-l,h=1+l,A=[c,c,h,c,h,h,c,c,h,h,c,h],u=6,d=6,p=3,f=2,g=1,m=new Float32Array(p*d*u),v=new Float32Array(f*d*u),E=new Float32Array(g*d*u);for(let e=0;e<u;e++){const t=e%3*2/3-1,n=e>2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];m.set(i,p*d*e),v.set(A,f*d*e);const r=[e,e,e,e,e,e];E.set(r,g*d*e)}const b=new gr;b.setAttribute("position",new ar(m,p)),b.setAttribute("uv",new ar(v,f)),b.setAttribute("faceIndex",new ar(E,g)),t.push(b),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(e,t,n){const i=new Float32Array(20),r=new Rn(0,1,0);return new Gr({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(i,e,t)}return i}_compileMaterial(e){const t=new Lr(this._lodPlanes[0],e);this._renderer.compile(t,Ca)}_sceneToCubeUV(e,t,n,i){const r=new qr(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,l=s.autoClear,c=s.toneMapping;s.getClearColor(_a),s.toneMapping=0,s.autoClear=!1;const h=new er({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),A=new Lr(new Pr,h);let u=!1;const d=e.background;d?d.isColor&&(h.color.copy(d),e.background=null,u=!0):(h.color.copy(_a),u=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(r.up.set(0,a[t],0),r.lookAt(o[t],0,0)):1===n?(r.up.set(0,0,a[t]),r.lookAt(0,o[t],0)):(r.up.set(0,a[t],0),r.lookAt(0,0,o[t]));const l=this._cubeSize;Da(i,n*l,t>2?l:0,l,l),s.setRenderTarget(i),u&&s.render(A,r),s.render(e,r)}A.geometry.dispose(),A.material.dispose(),s.toneMapping=c,s.autoClear=l,e.background=d}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Pe||e.mapping===Ne;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=La()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Qa());const r=i?this._cubemapMaterial:this._equirectMaterial,a=new Lr(this._lodPlanes[0],r);r.uniforms.envMap.value=e;const o=this._cubeSize;Da(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(a,Ca)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let t=1;t<i;t++){const n=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),r=Ba[(i-t-1)%Ba.length];this._blur(e,t-1,t,n,r)}t.autoClear=n}_blur(e,t,n,i,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,o){const s=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new Lr(this._lodPlanes[i],l),h=l.uniforms,A=this._sizeLods[n]-1,u=isFinite(r)?Math.PI/(2*A):2*Math.PI/39,d=r/u,p=isFinite(r)?1+Math.floor(3*d):20;p>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${p} samples when the maximum is set to 20`);const f=[];let g=0;for(let e=0;e<20;++e){const t=e/d,n=Math.exp(-t*t/2);f.push(n),0===e?g+=n:e<p&&(g+=2*n)}for(let e=0;e<f.length;e++)f[e]=f[e]/g;h.envMap.value=e.texture,h.samples.value=p,h.weights.value=f,h.latitudinal.value="latitudinal"===a,o&&(h.poleAxis.value=o);const{_lodMax:m}=this;h.dTheta.value=u,h.mipInt.value=m-n;const v=this._sizeLods[i];Da(t,3*v*(i>m-4?i-m+4:0),4*(this._cubeSize-v),3*v,2*v),s.setRenderTarget(t),s.render(c,Ca)}}function Ra(e,t,n){const i=new wn(e,t,n);return i.texture.mapping=Oe,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Da(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Qa(){return new Gr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function La(){return new Gr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Ua(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping,o=a===Fe||304===a,s=a===Pe||a===Ne;if(o||s){let a=t.get(r);const l=void 0!==a?a.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new Ta(e)),a=o?n.fromEquirectangular(r,a):n.fromCubemap(r,a),a.texture.pmremVersion=r.pmremVersion,t.set(r,a),a.texture;if(void 0!==a)return a.texture;{const l=r.image;return o&&l&&l.height>0||s&&l&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(l)?(null===n&&(n=new Ta(e)),a=o?n.fromEquirectangular(r):n.fromCubemap(r),a.texture.pmremVersion=r.pmremVersion,t.set(r,a),r.addEventListener("dispose",i),a.texture):null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function Pa(e){const t={};function n(n){if(void 0!==t[n])return t[n];let i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){const t=n(e);return null===t&&hn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function Na(e,t,n,i){const r={},a=new WeakMap;function o(e){const s=e.target;null!==s.index&&t.remove(s.index);for(const e in s.attributes)t.remove(s.attributes[e]);for(const e in s.morphAttributes){const n=s.morphAttributes[e];for(let e=0,i=n.length;e<i;e++)t.remove(n[e])}s.removeEventListener("dispose",o),delete r[s.id];const l=a.get(s);l&&(t.remove(l),a.delete(s)),i.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(e){const n=[],i=e.index,r=e.attributes.position;let o=0;if(null!==i){const e=i.array;o=i.version;for(let t=0,i=e.length;t<i;t+=3){const i=e[t+0],r=e[t+1],a=e[t+2];n.push(i,r,r,a,a,i)}}else{if(void 0===r)return;{const e=r.array;o=r.version;for(let t=0,i=e.length/3-1;t<i;t+=3){const e=t+0,i=t+1,r=t+2;n.push(e,i,i,r,r,e)}}}const s=new(on(n)?sr:or)(n,1);s.version=o;const l=a.get(e);l&&t.remove(l),a.set(e,s)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",o),r[t.id]=!0,n.memory.geometries++),t},update:function(n){const i=n.attributes;for(const n in i)t.update(i[n],e.ARRAY_BUFFER);const r=n.morphAttributes;for(const n in r){const i=r[n];for(let n=0,r=i.length;n<r;n++)t.update(i[n],e.ARRAY_BUFFER)}},getWireframeAttribute:function(e){const t=a.get(e);if(t){const n=e.index;null!==n&&t.version<n.version&&s(e)}else s(e);return a.get(e)}}}function Fa(e,t,n){let i,r,a;function o(t,o,s){0!==s&&(e.drawElementsInstanced(i,o,r,t*a,s),n.update(o,i,s))}this.setMode=function(e){i=e},this.setIndex=function(e){r=e.type,a=e.bytesPerElement},this.render=function(t,o){e.drawElements(i,o,r,t*a),n.update(o,i,1)},this.renderInstances=o,this.renderMultiDraw=function(e,a,o){if(0===o)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,a,0,r,e,0,o);let s=0;for(let e=0;e<o;e++)s+=a[e];n.update(s,i,1)},this.renderMultiDrawInstances=function(e,s,l,c){if(0===l)return;const h=t.get("WEBGL_multi_draw");if(null===h)for(let t=0;t<e.length;t++)o(e[t]/a,s[t],c[t]);else{h.multiDrawElementsInstancedWEBGL(i,s,0,r,e,0,c,0,l);let t=0;for(let e=0;e<l;e++)t+=s[e];for(let e=0;e<c.length;e++)n.update(t,i,c[e])}}}function Oa(e){const 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(n,i,r){switch(t.calls++,i){case e.TRIANGLES:t.triangles+=r*(n/3);break;case e.LINES:t.lines+=r*(n/2);break;case e.LINE_STRIP:t.lines+=r*(n-1);break;case e.LINE_LOOP:t.lines+=r*n;break;case e.POINTS:t.points+=r*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function ka(e,t,n){const i=new WeakMap,r=new yn;return{update:function(a,o,s){const l=a.morphTargetInfluences,c=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=void 0!==c?c.length:0;let A=i.get(o);if(void 0===A||A.count!==h){void 0!==A&&A.texture.dispose();const u=void 0!==o.morphAttributes.position,d=void 0!==o.morphAttributes.normal,p=void 0!==o.morphAttributes.color,f=o.morphAttributes.position||[],g=o.morphAttributes.normal||[],m=o.morphAttributes.color||[];let v=0;!0===u&&(v=1),!0===d&&(v=2),!0===p&&(v=3);let E=o.attributes.position.count*v,b=1;E>t.maxTextureSize&&(b=Math.ceil(E/t.maxTextureSize),E=t.maxTextureSize);const C=new Float32Array(E*b*4*h),_=new Sn(C,E,b,h);_.type=Ze,_.needsUpdate=!0;const I=4*v;for(let y=0;y<h;y++){const M=f[y],w=g[y],S=m[y],B=E*b*4*y;for(let T=0;T<M.count;T++){const R=T*I;!0===u&&(r.fromBufferAttribute(M,T),C[B+R+0]=r.x,C[B+R+1]=r.y,C[B+R+2]=r.z,C[B+R+3]=0),!0===d&&(r.fromBufferAttribute(w,T),C[B+R+4]=r.x,C[B+R+5]=r.y,C[B+R+6]=r.z,C[B+R+7]=0),!0===p&&(r.fromBufferAttribute(S,T),C[B+R+8]=r.x,C[B+R+9]=r.y,C[B+R+10]=r.z,C[B+R+11]=4===S.itemSize?r.w:1)}}function x(){_.dispose(),i.delete(o),o.removeEventListener("dispose",x)}A={count:h,texture:_,size:new nn(E,b)},i.set(o,A),o.addEventListener("dispose",x)}if(!0===a.isInstancedMesh&&null!==a.morphTexture)s.getUniforms().setValue(e,"morphTexture",a.morphTexture,n);else{let D=0;for(let L=0;L<l.length;L++)D+=l[L];const Q=o.morphTargetsRelative?1:1-D;s.getUniforms().setValue(e,"morphTargetBaseInfluence",Q),s.getUniforms().setValue(e,"morphTargetInfluences",l)}s.getUniforms().setValue(e,"morphTargetsTexture",A.texture,n),s.getUniforms().setValue(e,"morphTargetsTextureSize",A.size)}}}function Ga(e,t,n,i){let r=new WeakMap;function a(e){const t=e.target;t.removeEventListener("dispose",a),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(o){const s=i.render.frame,l=o.geometry,c=t.get(o,l);if(r.get(c)!==s&&(t.update(c),r.set(c,s)),o.isInstancedMesh&&(!1===o.hasEventListener("dispose",a)&&o.addEventListener("dispose",a),r.get(o)!==s&&(n.update(o.instanceMatrix,e.ARRAY_BUFFER),null!==o.instanceColor&&n.update(o.instanceColor,e.ARRAY_BUFFER),r.set(o,s))),o.isSkinnedMesh){const e=o.skeleton;r.get(e)!==s&&(e.update(),r.set(e,s))}return c},dispose:function(){r=new WeakMap}}}class Ha extends xn{constructor(e,t,n,i,r,a,o,s,l,c=1026){if(c!==nt&&c!==it)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===nt&&(n=Je),void 0===n&&c===it&&(n=et),super(null,i,r,a,o,s,c,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==o?o:ze,this.minFilter=void 0!==s?s:ze,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}const za=new xn,Va=new Ha(1,1);Va.compareFunction=515;const Wa=new Sn,qa=new Bn,ja=new Xr,Ya=[],Xa=[],Ka=new Float32Array(16),Ja=new Float32Array(9),Za=new Float32Array(4);function $a(e,t,n){const i=e[0];if(i<=0||i>0)return e;const r=t*n;let a=Ya[r];if(void 0===a&&(a=new Float32Array(r),Ya[r]=a),0!==t){i.toArray(a,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(a,r)}return a}function eo(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function to(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function no(e,t){let n=Xa[t];void 0===n&&(n=new Int32Array(t),Xa[t]=n);for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function io(e,t){const n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function ro(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(eo(n,t))return;e.uniform2fv(this.addr,t),to(n,t)}}function ao(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(eo(n,t))return;e.uniform3fv(this.addr,t),to(n,t)}}function oo(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(eo(n,t))return;e.uniform4fv(this.addr,t),to(n,t)}}function so(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(eo(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),to(n,t)}else{if(eo(n,i))return;Za.set(i),e.uniformMatrix2fv(this.addr,!1,Za),to(n,i)}}function lo(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(eo(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),to(n,t)}else{if(eo(n,i))return;Ja.set(i),e.uniformMatrix3fv(this.addr,!1,Ja),to(n,i)}}function co(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(eo(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),to(n,t)}else{if(eo(n,i))return;Ka.set(i),e.uniformMatrix4fv(this.addr,!1,Ka),to(n,i)}}function ho(e,t){const n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Ao(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(eo(n,t))return;e.uniform2iv(this.addr,t),to(n,t)}}function uo(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(eo(n,t))return;e.uniform3iv(this.addr,t),to(n,t)}}function po(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(eo(n,t))return;e.uniform4iv(this.addr,t),to(n,t)}}function fo(e,t){const n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function go(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(eo(n,t))return;e.uniform2uiv(this.addr,t),to(n,t)}}function mo(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(eo(n,t))return;e.uniform3uiv(this.addr,t),to(n,t)}}function vo(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(eo(n,t))return;e.uniform4uiv(this.addr,t),to(n,t)}}function Eo(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r);const a=this.type===e.SAMPLER_2D_SHADOW?Va:za;n.setTexture2D(t||a,r)}function bo(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||qa,r)}function Co(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(t||ja,r)}function _o(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||Wa,r)}function Io(e,t){e.uniform1fv(this.addr,t)}function xo(e,t){const n=$a(t,this.size,2);e.uniform2fv(this.addr,n)}function yo(e,t){const n=$a(t,this.size,3);e.uniform3fv(this.addr,n)}function Mo(e,t){const n=$a(t,this.size,4);e.uniform4fv(this.addr,n)}function wo(e,t){const n=$a(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function So(e,t){const n=$a(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Bo(e,t){const n=$a(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function To(e,t){e.uniform1iv(this.addr,t)}function Ro(e,t){e.uniform2iv(this.addr,t)}function Do(e,t){e.uniform3iv(this.addr,t)}function Qo(e,t){e.uniform4iv(this.addr,t)}function Lo(e,t){e.uniform1uiv(this.addr,t)}function Uo(e,t){e.uniform2uiv(this.addr,t)}function Po(e,t){e.uniform3uiv(this.addr,t)}function No(e,t){e.uniform4uiv(this.addr,t)}function Fo(e,t,n){const i=this.cache,r=t.length,a=no(n,r);eo(i,a)||(e.uniform1iv(this.addr,a),to(i,a));for(let e=0;e!==r;++e)n.setTexture2D(t[e]||za,a[e])}function Oo(e,t,n){const i=this.cache,r=t.length,a=no(n,r);eo(i,a)||(e.uniform1iv(this.addr,a),to(i,a));for(let e=0;e!==r;++e)n.setTexture3D(t[e]||qa,a[e])}function ko(e,t,n){const i=this.cache,r=t.length,a=no(n,r);eo(i,a)||(e.uniform1iv(this.addr,a),to(i,a));for(let e=0;e!==r;++e)n.setTextureCube(t[e]||ja,a[e])}function Go(e,t,n){const i=this.cache,r=t.length,a=no(n,r);eo(i,a)||(e.uniform1iv(this.addr,a),to(i,a));for(let e=0;e!==r;++e)n.setTexture2DArray(t[e]||Wa,a[e])}class Ho{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return io;case 35664:return ro;case 35665:return ao;case 35666:return oo;case 35674:return so;case 35675:return lo;case 35676:return co;case 5124:case 35670:return ho;case 35667:case 35671:return Ao;case 35668:case 35672:return uo;case 35669:case 35673:return po;case 5125:return fo;case 36294:return go;case 36295:return mo;case 36296:return vo;case 35678:case 36198:case 36298:case 36306:case 35682:return Eo;case 35679:case 36299:case 36307:return bo;case 35680:case 36300:case 36308:case 36293:return Co;case 36289:case 36303:case 36311:case 36292:return _o}}(t.type)}}class zo{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return Io;case 35664:return xo;case 35665:return yo;case 35666:return Mo;case 35674:return wo;case 35675:return So;case 35676:return Bo;case 5124:case 35670:return To;case 35667:case 35671:return Ro;case 35668:case 35672:return Do;case 35669:case 35673:return Qo;case 5125:return Lo;case 36294:return Uo;case 36295:return Po;case 36296:return No;case 35678:case 36198:case 36298:case 36306:case 35682:return Fo;case 35679:case 36299:case 36307:return Oo;case 35680:case 36300:case 36308:case 36293:return ko;case 36289:case 36303:case 36311:case 36292:return Go}}(t.type)}}class Vo{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let r=0,a=i.length;r!==a;++r){const a=i[r];a.setValue(e,t[a.id],n)}}}const Wo=/(\w+)(\])?(\[|\.)?/g;function qo(e,t){e.seq.push(t),e.map[t.id]=t}function jo(e,t,n){const i=e.name,r=i.length;for(Wo.lastIndex=0;;){const a=Wo.exec(i),o=Wo.lastIndex;let s=a[1];const l="]"===a[2],c=a[3];if(l&&(s|=0),void 0===c||"["===c&&o+2===r){qo(n,void 0===c?new Ho(s,e,t):new zo(s,e,t));break}{let e=n.map[s];void 0===e&&(e=new Vo(s),qo(n,e)),n=e}}}class Yo{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const n=e.getActiveUniform(t,i);jo(n,e.getUniformLocation(t,n.name),this)}}setValue(e,t,n,i){const r=this.map[t];void 0!==r&&r.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];void 0!==i&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,a=t.length;r!==a;++r){const a=t[r],o=n[a.id];!1!==o.needsUpdate&&a.setValue(e,o.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const r=e[i];r.id in t&&n.push(r)}return n}}function Xo(e,t,n){const i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}let Ko=0;function Jo(e,t,n){const i=e.getShaderParameter(t,e.COMPILE_STATUS),r=e.getShaderInfoLog(t).trim();if(i&&""===r)return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const i=parseInt(a[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){const n=e.split("\n"),i=[],r=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let e=r;e<a;e++){const r=e+1;i.push(`${r===t?">":" "} ${r}: ${n[e]}`)}return i.join("\n")}(e.getShaderSource(t),i)}return r}function Zo(e,t){const n=function(e){const t=fn.getPrimaries(fn.workingColorSpace),n=fn.getPrimaries(e);let i;switch(t===n?i="":t===Bt&&n===St?i="LinearDisplayP3ToLinearSRGB":t===St&&n===Bt&&(i="LinearSRGBToLinearDisplayP3"),e){case It:case yt:return[i,"LinearTransferOETF"];case _t:case xt:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),[i,"LinearTransferOETF"]}}(t);return`vec4 ${e}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function $o(e,t){let n;switch(t){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 6:n="AgX";break;case 7:n="Neutral";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function es(e){return""!==e}function ts(e,t){const n=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,n).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 ns(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const is=/^[ \t]*#include +<([\w\d./]+)>/gm;function rs(e){return e.replace(is,os)}const as=new Map;function os(e,t){let n=sa[t];if(void 0===n){const e=as.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");n=sa[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return rs(n)}const ss=/#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 ls(e){return e.replace(ss,cs)}function cs(e,t,n,i){let r="";for(let e=parseInt(t);e<parseInt(n);e++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return r}function hs(e){let t=`precision ${e.precision} float;\n\tprecision ${e.precision} int;\n\tprecision ${e.precision} sampler2D;\n\tprecision ${e.precision} samplerCube;\n\tprecision ${e.precision} sampler3D;\n\tprecision ${e.precision} sampler2DArray;\n\tprecision ${e.precision} sampler2DShadow;\n\tprecision ${e.precision} samplerCubeShadow;\n\tprecision ${e.precision} sampler2DArrayShadow;\n\tprecision ${e.precision} isampler2D;\n\tprecision ${e.precision} isampler3D;\n\tprecision ${e.precision} isamplerCube;\n\tprecision ${e.precision} isampler2DArray;\n\tprecision ${e.precision} usampler2D;\n\tprecision ${e.precision} usampler3D;\n\tprecision ${e.precision} usamplerCube;\n\tprecision ${e.precision} usampler2DArray;\n\t`;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}function As(e,t,n,i){const r=e.getContext(),a=n.defines;let o=n.vertexShader,s=n.fragmentShader;const l=function(e){let t="SHADOWMAP_TYPE_BASIC";return 1===e.shadowMapType?t="SHADOWMAP_TYPE_PCF":2===e.shadowMapType?t="SHADOWMAP_TYPE_PCF_SOFT":3===e.shadowMapType&&(t="SHADOWMAP_TYPE_VSM"),t}(n),c=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 300:t="ENVMAP_TYPE_TEXTURE_2D";break;case Pe:case Ne:t="ENVMAP_TYPE_CUBE";break;case Oe:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),h=function(e){let t="ENVMAP_MODE_REFLECTION";return e.envMap&&e.envMapMode===Ne&&(t="ENVMAP_MODE_REFRACTION"),t}(n),A=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(n),u=function(e){const t=e.envMapCubeUVHeight;if(null===t)return null;const n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),d=function(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(es).join("\n")}(n),p=function(e){const t=[];for(const n in e){const i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(a),f=r.createProgram();let g,m,v=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,p].filter(es).join("\n"),g.length>0&&(g+="\n"),m=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,p].filter(es).join("\n"),m.length>0&&(m+="\n")):(g=[hs(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,p,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.fixedEnvMapDirection?"#define FIX_ENV_DIRECTION":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(es).join("\n"),m=[hs(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,p,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+A:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.fixedEnvMapDirection?"#define FIX_ENV_DIRECTION":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?sa.tonemapping_pars_fragment:"",0!==n.toneMapping?$o("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",sa.colorspace_pars_fragment,Zo("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(es).join("\n")),o=rs(o),o=ts(o,n),o=ns(o,n),s=rs(s),s=ts(s,n),s=ns(s,n),s=function(e,t){return e.replace(/RAY_BOUNCES/g,t.rayBounces)}(s,n),s=function(e,t){return e.replace(/DIA_ORIENT_ENVMAP/g,t.diamondOrientedEnvMap)}(s,n),o=ls(o),s=ls(s),!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",g=[d,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,m=["#define varying in",n.glslVersion===kt?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===kt?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+m);const E=v+g+o,b=v+m+s,C=Xo(r,r.VERTEX_SHADER,E),_=Xo(r,r.FRAGMENT_SHADER,b);function I(t){if(e.debug.checkShaderErrors){const n=r.getProgramInfoLog(f).trim(),i=r.getShaderInfoLog(C).trim(),a=r.getShaderInfoLog(_).trim();let o=!0,s=!0;if(!1===r.getProgramParameter(f,r.LINK_STATUS))if(o=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(r,f,C,_);else{const e=Jo(r,C,"vertex"),i=Jo(r,_,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(f,r.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+n+"\n"+e+"\n"+i)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==i&&""!==a||(s=!1);s&&(t.diagnostics={runnable:o,programLog:n,vertexShader:{log:i,prefix:g},fragmentShader:{log:a,prefix:m}})}r.deleteShader(C),r.deleteShader(_),x=new Yo(r,f),y=function(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const i=e.getActiveAttrib(t,r),a=i.name;let o=1;i.type===e.FLOAT_MAT2&&(o=2),i.type===e.FLOAT_MAT3&&(o=3),i.type===e.FLOAT_MAT4&&(o=4),n[a]={type:i.type,location:e.getAttribLocation(t,a),locationSize:o}}return n}(r,f)}let x,y;r.attachShader(f,C),r.attachShader(f,_),void 0!==n.index0AttributeName?r.bindAttribLocation(f,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(f,0,"position"),r.linkProgram(f),this.getUniforms=function(){return void 0===x&&I(this),x},this.getAttributes=function(){return void 0===y&&I(this),y};let M=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===M&&(M=r.getProgramParameter(f,37297)),M},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(f),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Ko++,this.cacheKey=t,this.usedTimes=1,this.program=f,this.vertexShader=C,this.fragmentShader=_,this}let us=0;class ds{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return!1===a.has(i)&&(a.add(i),i.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const e of t)e.usedTimes--,0===e.usedTimes&&this.shaderCache.delete(e.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){const t=this.materialCache;let n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return void 0===n&&(n=new ps(e),t.set(e,n)),n}}class ps{constructor(e){this.id=us++,this.code=e,this.usedTimes=0}}function fs(e,t,n,i,r,a,o){const s=new vi,l=new ds,c=new Set,h=[],A=r.logarithmicDepthBuffer,u=r.vertexTextures;let d=r.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",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",MeshDiamondMaterial:"diamond",CubeNormalsMaterial:"cubeNormals"};function f(e){return c.add(e),0===e?"uv":`uv${e}`}return{getParameters:function(a,s,h,g,m){const v=g.fog,E=m.geometry,b=a.isMeshStandardMaterial?g.environment:null,C=(a.isMeshStandardMaterial?n:t).get(a.envMap||b),_=C&&C.mapping===Oe?C.image.height:null,I=p[a.type];null!==a.precision&&(d=r.getMaxPrecision(a.precision),d!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",d,"instead."));const x=E.morphAttributes.position||E.morphAttributes.normal||E.morphAttributes.color,y=void 0!==x?x.length:0;let M,w,S,B,T=0;if(void 0!==E.morphAttributes.position&&(T=1),void 0!==E.morphAttributes.normal&&(T=2),void 0!==E.morphAttributes.color&&(T=3),I){const e=ca[I];M=e.vertexShader,w=e.fragmentShader}else M=a.vertexShader,w=a.fragmentShader,l.update(a),S=l.getVertexShaderID(a),B=l.getFragmentShaderID(a);const R=e.getRenderTarget(),D=!0===m.isInstancedMesh,Q=!0===m.isBatchedMesh,L=!!a.map,U=!!a.matcap,P=!!C,N=!!a.aoMap,F=!!a.lightMap,O=!!a.bumpMap,k=!!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,Y=a.iridescence>0,X=a.sheen>0,K=a.transmission>0,J=W&&!!a.anisotropyMap,Z=q&&!!a.clearcoatMap,$=q&&!!a.clearcoatNormalMap,ee=q&&!!a.clearcoatRoughnessMap,te=Y&&!!a.iridescenceMap,ne=Y&&!!a.iridescenceThicknessMap,ie=X&&!!a.sheenColorMap,re=X&&!!a.sheenRoughnessMap,ae=!!a.specularMap,oe=!!a.specularColorMap,se=!!a.specularIntensityMap,le=K&&!!a.transmissionMap,ce=K&&!!a.thicknessMap,he=!!a.gradientMap,Ae=!!a.alphaMap,ue=a.alphaTest>0,de=!!a.alphaHash,pe=!!a.extensions;let fe=0;a.toneMapped&&(null!==R&&!0!==R.isXRRenderTarget||(fe=e.toneMapping));const ge={shaderID:I,shaderType:a.type,shaderName:a.name,vertexShader:M,fragmentShader:w,defines:a.defines,customVertexShaderID:S,customFragmentShaderID:B,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:d,batching:Q,batchingColor:Q&&null!==m._colorsTexture,instancing:D,instancingColor:D&&null!==m.instanceColor,instancingMorph:D&&null!==m.morphTexture,supportsVertexTextures:u,outputColorSpace:null===R?e.outputColorSpace:!0===R.isXRRenderTarget?R.texture.colorSpace:It,alphaToCoverage:!!a.alphaToCoverage,map:L,matcap:U,envMap:P,envMapMode:P&&C.mapping,envMapCubeUVHeight:_,aoMap:N,lightMap:F,bumpMap:O,normalMap:k,displacementMap:u&&G,emissiveMap:H,normalMapObjectSpace:k&&1===a.normalMapType,normalMapTangentSpace:k&&0===a.normalMapType,metalnessMap:z,roughnessMap:V,anisotropy:W,anisotropyMap:J,clearcoat:q,clearcoatMap:Z,clearcoatNormalMap:$,clearcoatRoughnessMap:ee,dispersion:j,iridescence:Y,iridescenceMap:te,iridescenceThicknessMap:ne,sheen:X,sheenColorMap:ie,sheenRoughnessMap:re,specularMap:ae,specularColorMap:oe,specularIntensityMap:se,transmission:K,transmissionMap:le,thicknessMap:ce,gradientMap:he,opaque:!1===a.transparent&&1===a.blending&&!1===a.alphaToCoverage,alphaMap:Ae,alphaTest:ue,alphaHash:de,combine:a.combine,mapUv:L&&f(a.map.channel),aoMapUv:N&&f(a.aoMap.channel),lightMapUv:F&&f(a.lightMap.channel),bumpMapUv:O&&f(a.bumpMap.channel),normalMapUv:k&&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:Z&&f(a.clearcoatMap.channel),clearcoatNormalMapUv:$&&f(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ee&&f(a.clearcoatRoughnessMap.channel),iridescenceMapUv:te&&f(a.iridescenceMap.channel),iridescenceThicknessMapUv:ne&&f(a.iridescenceThicknessMap.channel),sheenColorMapUv:ie&&f(a.sheenColorMap.channel),sheenRoughnessMapUv:re&&f(a.sheenRoughnessMap.channel),specularMapUv:ae&&f(a.specularMap.channel),specularColorMapUv:oe&&f(a.specularColorMap.channel),specularIntensityMapUv:se&&f(a.specularIntensityMap.channel),transmissionMapUv:le&&f(a.transmissionMap.channel),thicknessMapUv:ce&&f(a.thicknessMap.channel),alphaMapUv:Ae&&f(a.alphaMap.channel),vertexTangents:!!E.attributes.tangent&&(k||W),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!E.attributes.color&&4===E.attributes.color.itemSize,pointsUvs:!0===m.isPoints&&!!E.attributes.uv&&(L||Ae),fog:!!v,useFog:!0===a.fog,fogExp2:!!v&&v.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:A,skinning:!0===m.isSkinnedMesh,morphTargets:void 0!==E.morphAttributes.position,morphNormals:void 0!==E.morphAttributes.normal,morphColors:void 0!==E.morphAttributes.color,morphTargetsCount:y,morphTextureStride:T,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,diamondOrientedEnvMap:a.diamondOrientedEnvMap,rayBounces:a.rayBounces,fixedEnvMapDirection:a.fixedEnvMapDirection,shadowMapEnabled:e.shadowMap.enabled&&h.length>0,shadowMapType:e.shadowMap.type,toneMapping:fe,decodeVideoTexture:L&&!0===a.map.isVideoTexture&&fn.getTransfer(a.map.colorSpace)===wt,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:pe&&!0===a.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(pe&&!0===a.extensions.multiDraw||Q)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return ge.vertexUv1s=c.has(1),ge.vertexUv2s=c.has(2),ge.vertexUv3s=c.has(3),c.clear(),ge},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){s.disableAll(),t.supportsVertexTextures&&s.enable(0),t.instancing&&s.enable(1),t.instancingColor&&s.enable(2),t.instancingMorph&&s.enable(3),t.matcap&&s.enable(4),t.envMap&&s.enable(5),t.normalMapObjectSpace&&s.enable(6),t.normalMapTangentSpace&&s.enable(7),t.clearcoat&&s.enable(8),t.iridescence&&s.enable(9),t.alphaTest&&s.enable(10),t.vertexColors&&s.enable(11),t.vertexAlphas&&s.enable(12),t.vertexUv1s&&s.enable(13),t.vertexUv2s&&s.enable(14),t.vertexUv3s&&s.enable(15),t.vertexTangents&&s.enable(16),t.anisotropy&&s.enable(17),t.alphaHash&&s.enable(18),t.batching&&s.enable(19),t.dispersion&&s.enable(20),t.batchingColor&&s.enable(21),e.push(s.mask),s.disableAll(),t.fog&&s.enable(0),t.useFog&&s.enable(1),t.flatShading&&s.enable(2),t.logarithmicDepthBuffer&&s.enable(3),t.skinning&&s.enable(4),t.morphTargets&&s.enable(5),t.morphNormals&&s.enable(6),t.morphColors&&s.enable(7),t.premultipliedAlpha&&s.enable(8),t.shadowMapEnabled&&s.enable(9),t.doubleSided&&s.enable(10),t.flipSided&&s.enable(11),t.useDepthPacking&&s.enable(12),t.dithering&&s.enable(13),t.transmission&&s.enable(14),t.sheen&&s.enable(15),t.opaque&&s.enable(16),t.pointsUvs&&s.enable(17),t.decodeVideoTexture&&s.enable(18),t.alphaToCoverage&&s.enable(19),e.push(s.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=p[e.type];let n;if(t){const e=ca[t];n=kr.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=h.length;e<t;e++){const t=h[e];if(t.cacheKey===n){i=t,++i.usedTimes;break}}return void 0===i&&(i=new As(e,n,t,a),h.push(i)),i},releaseProgram:function(e){if(0==--e.usedTimes){const t=h.indexOf(e);h[t]=h[h.length-1],h.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:h,dispose:function(){l.dispose()}}}function gs(){let e=new WeakMap;return{get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function ms(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 vs(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 Es(){const e=[];let t=0;const n=[],i=[],r=[];function a(n,i,r,a,o,s){let l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:a,renderOrder:n.renderOrder,z:o,group:s},e[t]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=o,l.group=s),t++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){t=0,n.length=0,i.length=0,r.length=0},push:function(e,t,o,s,l,c){const h=a(e,t,o,s,l,c);o.transmission>0?i.push(h):!0===o.transparent?r.push(h):n.push(h)},unshift:function(e,t,o,s,l,c){const h=a(e,t,o,s,l,c);o.transmission>0?i.unshift(h):!0===o.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=t,i=e.length;n<i;n++){const t=e[n];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){n.length>1&&n.sort(e||ms),i.length>1&&i.sort(t||vs),r.length>1&&r.sort(t||vs)}}}function bs(){let e=new WeakMap;return{get:function(t,n){const i=e.get(t);let r;return void 0===i?(r=new Es,e.set(t,[r])):n>=i.length?(r=new Es,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function Cs(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new Rn,color:new Ki};break;case"SpotLight":n={position:new Rn,direction:new Rn,color:new Ki,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Rn,color:new Ki,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Rn,skyColor:new Ki,groundColor:new Ki};break;case"RectAreaLight":n={color:new Ki,position:new Rn,halfWidth:new Rn,halfHeight:new Rn}}return e[t.id]=n,n}}}let _s=0;function Is(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function xs(e){const t=new Cs,n=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new nn};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new nn,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),i={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++)i.probe.push(new Rn);const r=new Rn,a=new si,o=new si;return{setup:function(r){let a=0,o=0,s=0;for(let e=0;e<9;e++)i.probe[e].set(0,0,0);let l=0,c=0,h=0,A=0,u=0,d=0,p=0,f=0,g=0,m=0,v=0;r.sort(Is);for(let e=0,E=r.length;e<E;e++){const E=r[e],b=E.color,C=E.intensity,_=E.distance,I=E.shadow&&E.shadow.map?E.shadow.map.texture:null;if(E.isAmbientLight)a+=b.r*C,o+=b.g*C,s+=b.b*C;else if(E.isLightProbe){for(let e=0;e<9;e++)i.probe[e].addScaledVector(E.sh.coefficients[e],C);v++}else if(E.isDirectionalLight){const e=t.get(E);if(e.color.copy(E.color).multiplyScalar(E.intensity),E.castShadow){const e=E.shadow,t=n.get(E);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,i.directionalShadow[l]=t,i.directionalShadowMap[l]=I,i.directionalShadowMatrix[l]=E.shadow.matrix,d++}i.directional[l]=e,l++}else if(E.isSpotLight){const e=t.get(E);e.position.setFromMatrixPosition(E.matrixWorld),e.color.copy(b).multiplyScalar(C),e.distance=_,e.coneCos=Math.cos(E.angle),e.penumbraCos=Math.cos(E.angle*(1-E.penumbra)),e.decay=E.decay,i.spot[h]=e;const r=E.shadow;if(E.map&&(i.spotLightMap[g]=E.map,g++,r.updateMatrices(E),E.castShadow&&m++),i.spotLightMatrix[h]=r.matrix,E.castShadow){const e=n.get(E);e.shadowIntensity=r.intensity,e.shadowBias=r.bias,e.shadowNormalBias=r.normalBias,e.shadowRadius=r.radius,e.shadowMapSize=r.mapSize,i.spotShadow[h]=e,i.spotShadowMap[h]=I,f++}h++}else if(E.isRectAreaLight){const e=t.get(E);e.color.copy(b).multiplyScalar(C),e.halfWidth.set(.5*E.width,0,0),e.halfHeight.set(0,.5*E.height,0),i.rectArea[A]=e,A++}else if(E.isPointLight){const e=t.get(E);if(e.color.copy(E.color).multiplyScalar(E.intensity),e.distance=E.distance,e.decay=E.decay,E.castShadow){const e=E.shadow,t=n.get(E);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,i.pointShadow[c]=t,i.pointShadowMap[c]=I,i.pointShadowMatrix[c]=E.shadow.matrix,p++}i.point[c]=e,c++}else if(E.isHemisphereLight){const e=t.get(E);e.skyColor.copy(E.color).multiplyScalar(C),e.groundColor.copy(E.groundColor).multiplyScalar(C),i.hemi[u]=e,u++}}A>0&&(!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=la.LTC_FLOAT_1,i.rectAreaLTC2=la.LTC_FLOAT_2):(i.rectAreaLTC1=la.LTC_HALF_1,i.rectAreaLTC2=la.LTC_HALF_2)),i.ambient[0]=a,i.ambient[1]=o,i.ambient[2]=s;const E=i.hash;E.directionalLength===l&&E.pointLength===c&&E.spotLength===h&&E.rectAreaLength===A&&E.hemiLength===u&&E.numDirectionalShadows===d&&E.numPointShadows===p&&E.numSpotShadows===f&&E.numSpotMaps===g&&E.numLightProbes===v||(i.directional.length=l,i.spot.length=h,i.rectArea.length=A,i.point.length=c,i.hemi.length=u,i.directionalShadow.length=d,i.directionalShadowMap.length=d,i.pointShadow.length=p,i.pointShadowMap.length=p,i.spotShadow.length=f,i.spotShadowMap.length=f,i.directionalShadowMatrix.length=d,i.pointShadowMatrix.length=p,i.spotLightMatrix.length=f+g-m,i.spotLightMap.length=g,i.numSpotLightShadowsWithMaps=m,i.numLightProbes=v,E.directionalLength=l,E.pointLength=c,E.spotLength=h,E.rectAreaLength=A,E.hemiLength=u,E.numDirectionalShadows=d,E.numPointShadows=p,E.numSpotShadows=f,E.numSpotMaps=g,E.numLightProbes=v,i.version=_s++)},setupView:function(e,t){let n=0,s=0,l=0,c=0,h=0;const A=t.matrixWorldInverse;for(let t=0,u=e.length;t<u;t++){const u=e[t];if(u.isDirectionalLight){const e=i.directional[n];e.direction.setFromMatrixPosition(u.matrixWorld),r.setFromMatrixPosition(u.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(A),n++}else if(u.isSpotLight){const e=i.spot[l];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(A),e.direction.setFromMatrixPosition(u.matrixWorld),r.setFromMatrixPosition(u.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(A),l++}else if(u.isRectAreaLight){const e=i.rectArea[c];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(A),o.identity(),a.copy(u.matrixWorld),a.premultiply(A),o.extractRotation(a),e.halfWidth.set(.5*u.width,0,0),e.halfHeight.set(0,.5*u.height,0),e.halfWidth.applyMatrix4(o),e.halfHeight.applyMatrix4(o),c++}else if(u.isPointLight){const e=i.point[s];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(A),s++}else if(u.isHemisphereLight){const e=i.hemi[h];e.direction.setFromMatrixPosition(u.matrixWorld),e.direction.transformDirection(A),h++}}},state:i}}function ys(e){const t=new xs(e),n=[],i=[],r={lightsArray:n,shadowsArray:i,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function(e){r.camera=e,n.length=0,i.length=0},state:r,setupLights:function(){t.setup(n)},setupLightsView:function(e){t.setupView(n,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){i.push(e)}}}function Ms(e){let t=new WeakMap;return{get:function(n,i=0){const r=t.get(n);let a;return void 0===r?(a=new ys(e),t.set(n,[a])):i>=r.length?(a=new ys(e),r.push(a)):a=r[i],a},dispose:function(){t=new WeakMap}}}class ws extends $i{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 Ss extends $i{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 Bs(e,t,n){let i=new ia;const r=new nn,a=new nn,o=new yn,s=new ws({depthPacking:3201}),l=new Ss,c={},h=n.maxTextureSize,A={[pe]:1,[fe]:0,[ge]:2},u=new Gr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new nn},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),d=u.clone();d.defines.HORIZONTAL_PASS=1;const p=new gr;p.setAttribute("position",new ar(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const f=new Lr(p,u),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let m=this.type;function v(n,i){const a=t.update(f);u.defines.VSM_SAMPLES!==n.blurSamples&&(u.defines.VSM_SAMPLES=n.blurSamples,d.defines.VSM_SAMPLES=n.blurSamples,u.needsUpdate=!0,d.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new wn(r.x,r.y)),u.uniforms.shadow_pass.value=n.map.texture,u.uniforms.resolution.value=n.mapSize,u.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,a,u,f,null),d.uniforms.shadow_pass.value=n.mapPass.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,a,d,f,null)}function E(t,n,i,r){let a=null;const o=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==o)a=o;else if(a=!0===i.isPointLight?l:s,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const e=a.uuid,t=n.uuid;let i=c[e];void 0===i&&(i={},c[e]=i);let r=i[t];void 0===r&&(r=a.clone(),i[t]=r,n.addEventListener("dispose",C)),a=r}return a.visible=n.visible,a.wireframe=n.wireframe,a.side=3===r?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:A[n.side],a.alphaMap=n.alphaMap,a.alphaTest=n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial&&(e.properties.get(a).light=i),a}function b(n,r,a,o,s){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);const i=t.update(n),l=n.material;if(Array.isArray(l)){const t=i.groups;for(let c=0,h=t.length;c<h;c++){const h=t[c],A=l[h.materialIndex];if(A&&A.visible){const t=E(n,A,o,s);n.onBeforeShadow(e,n,r,a,i,t,h),e.renderBufferDirect(a,null,i,t,n,h),n.onAfterShadow(e,n,r,a,i,t,h)}}}else if(l.visible){const t=E(n,l,o,s);n.onBeforeShadow(e,n,r,a,i,t,null),e.renderBufferDirect(a,null,i,t,n,null),n.onAfterShadow(e,n,r,a,i,t,null)}}const l=n.children;for(let e=0,t=l.length;e<t;e++)b(l[e],r,a,o,s)}function C(e){e.target.removeEventListener("dispose",C);for(const t in c){const n=c[t],i=e.target.uuid;i in n&&(n[i].dispose(),delete n[i])}}this.render=function(t,n,s){if(!1===g.enabled)return;if(!1===g.autoUpdate&&!1===g.needsUpdate)return;if(0===t.length)return;const l=e.getRenderTarget(),c=e.getActiveCubeFace(),A=e.getActiveMipmapLevel(),u=e.state;u.setBlending(0),u.buffers.color.setClear(1,1,1,1),u.buffers.depth.setTest(!0),u.setScissorTest(!1);const d=3!==m&&3===this.type,p=3===m&&3!==this.type;for(let l=0,c=t.length;l<c;l++){const c=t[l],A=c.shadow;if(void 0===A){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===A.autoUpdate&&!1===A.needsUpdate)continue;r.copy(A.mapSize);const f=A.getFrameExtents();if(r.multiply(f),a.copy(A.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(a.x=Math.floor(h/f.x),r.x=a.x*f.x,A.mapSize.x=a.x),r.y>h&&(a.y=Math.floor(h/f.y),r.y=a.y*f.y,A.mapSize.y=a.y)),null===A.map||!0===d||!0===p){const e=3!==this.type?{minFilter:ze,magFilter:ze}:{};null!==A.map&&A.map.dispose(),A.map=new wn(r.x,r.y,e),A.map.texture.name=c.name+".shadowMap",A.camera.updateProjectionMatrix()}e.setRenderTarget(A.map),e.clear();const g=A.getViewportCount();for(let e=0;e<g;e++){const t=A.getViewport(e);o.set(a.x*t.x,a.y*t.y,a.x*t.z,a.y*t.w),u.viewport(o),A.updateMatrices(c,e),i=A.getFrustum(),b(n,s,A.camera,c,this.type)}!0!==A.isPointLightShadow&&3===this.type&&v(A,s),A.needsUpdate=!1}m=this.type,g.needsUpdate=!1,e.setRenderTarget(l,c,A)}}function Ts(e){const t=new function(){let t=!1;const n=new yn;let i=null;const r=new yn(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,a,o,s){!0===s&&(t*=o,i*=o,a*=o),n.set(t,i,a,o),!1===r.equals(n)&&(e.clearColor(t,i,a,o),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},n=new function(){let t=!1,n=null,i=null,r=null;return{setTest:function(t){t?O(e.DEPTH_TEST):k(e.DEPTH_TEST)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(i!==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)}i=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,i=null,r=null}}},i=new function(){let t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(n){t||(n?O(e.STENCIL_TEST):k(e.STENCIL_TEST))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,o){i===t&&r===n&&a===o||(e.stencilFunc(t,n,o),i=t,r=n,a=o)},setOp:function(t,n,i){o===t&&s===n&&l===i||(e.stencilOp(t,n,i),o=t,s=n,l=i)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null}}},r=new WeakMap,a=new WeakMap;let o={},s={},l=new WeakMap,c=[],h=null,A=!1,u=null,d=null,p=null,f=null,g=null,m=null,v=null,E=new Ki(0,0,0),b=0,C=!1,_=null,I=null,x=null,y=null,M=null;const w=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let S=!1,B=0;const T=e.getParameter(e.VERSION);-1!==T.indexOf("WebGL")?(B=parseFloat(/^WebGL (\d)/.exec(T)[1]),S=B>=1):-1!==T.indexOf("OpenGL ES")&&(B=parseFloat(/^OpenGL ES (\d)/.exec(T)[1]),S=B>=2);let R=null,D={};const Q=e.getParameter(e.SCISSOR_BOX),L=e.getParameter(e.VIEWPORT),U=(new yn).fromArray(Q),P=(new yn).fromArray(L);function N(t,n,i,r){const a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o<i;o++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,r,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(n+o,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return o}const F={};function O(t){!0!==o[t]&&(e.enable(t),o[t]=!0)}function k(t){!1!==o[t]&&(e.disable(t),o[t]=!1)}F[e.TEXTURE_2D]=N(e.TEXTURE_2D,e.TEXTURE_2D,1),F[e.TEXTURE_CUBE_MAP]=N(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),F[e.TEXTURE_2D_ARRAY]=N(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),F[e.TEXTURE_3D]=N(e.TEXTURE_3D,e.TEXTURE_3D,1,1),t.setClear(0,0,0,1),n.setClear(1),i.setClear(0),O(e.DEPTH_TEST),n.setFunc(3),V(!1),W(1),O(e.CULL_FACE),z(0);const G={[me]:e.FUNC_ADD,[ve]:e.FUNC_SUBTRACT,[Ee]:e.FUNC_REVERSE_SUBTRACT};G[103]=e.MIN,G[104]=e.MAX;const H={[be]:e.ZERO,[Ce]:e.ONE,[_e]:e.SRC_COLOR,[xe]:e.SRC_ALPHA,[Te]:e.SRC_ALPHA_SATURATE,[Se]:e.DST_COLOR,[Me]:e.DST_ALPHA,[Ie]:e.ONE_MINUS_SRC_COLOR,[ye]:e.ONE_MINUS_SRC_ALPHA,[Be]:e.ONE_MINUS_DST_COLOR,[we]:e.ONE_MINUS_DST_ALPHA,[Re]:e.CONSTANT_COLOR,[De]:e.ONE_MINUS_CONSTANT_COLOR,[Qe]:e.CONSTANT_ALPHA,[Le]:e.ONE_MINUS_CONSTANT_ALPHA};function z(t,n,i,r,a,o,s,l,c,h){if(0!==t){if(!1===A&&(O(e.BLEND),A=!0),5===t)a=a||n,o=o||i,s=s||r,n===d&&a===g||(e.blendEquationSeparate(G[n],G[a]),d=n,g=a),i===p&&r===f&&o===m&&s===v||(e.blendFuncSeparate(H[i],H[r],H[o],H[s]),p=i,f=r,m=o,v=s),!1!==l.equals(E)&&c===b||(e.blendColor(l.r,l.g,l.b,c),E.copy(l),b=c),u=t,C=!1;else if(t!==u||h!==C){if(d===me&&g===me||(e.blendEquation(e.FUNC_ADD),d=me,g=me),h)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.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.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.blendFunc(e.SRC_ALPHA,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}p=null,f=null,m=null,v=null,E.set(0,0,0),b=0,u=t,C=h}}else!0===A&&(k(e.BLEND),A=!1)}function V(t){_!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),_=t)}function W(t){0!==t?(O(e.CULL_FACE),t!==I&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):k(e.CULL_FACE),I=t}function q(t,n,i){t?(O(e.POLYGON_OFFSET_FILL),y===n&&M===i||(e.polygonOffset(n,i),y=n,M=i)):k(e.POLYGON_OFFSET_FILL)}return{buffers:{color:t,depth:n,stencil:i},enable:O,disable:k,bindFramebuffer:function(t,n){return s[t]!==n&&(e.bindFramebuffer(t,n),s[t]=n,t===e.DRAW_FRAMEBUFFER&&(s[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(s[e.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(t,n){let i=c,r=!1;if(t){i=l.get(n),void 0===i&&(i=[],l.set(n,i));const a=t.textures;if(i.length!==a.length||i[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=a.length;t<n;t++)i[t]=e.COLOR_ATTACHMENT0+t;i.length=a.length,r=!0}}else i[0]!==e.BACK&&(i[0]=e.BACK,r=!0);r&&e.drawBuffers(i)},useProgram:function(t){return h!==t&&(e.useProgram(t),h=t,!0)},setBlending:z,setMaterial:function(r,a){2===r.side?k(e.CULL_FACE):O(e.CULL_FACE);let o=1===r.side;a&&(o=!o),V(o),1===r.blending&&!1===r.transparent?z(0):z(r.blending,r.blendEquation,r.blendSrc,r.blendDst,r.blendEquationAlpha,r.blendSrcAlpha,r.blendDstAlpha,r.blendColor,r.blendAlpha,r.premultipliedAlpha),n.setFunc(r.depthFunc),n.setTest(r.depthTest),n.setMask(r.depthWrite),t.setMask(r.colorWrite);const s=r.stencilWrite;i.setTest(s),s&&(i.setMask(r.stencilWriteMask),i.setFunc(r.stencilFunc,r.stencilRef,r.stencilFuncMask),i.setOp(r.stencilFail,r.stencilZFail,r.stencilZPass)),q(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits),!0===r.alphaToCoverage?O(e.SAMPLE_ALPHA_TO_COVERAGE):k(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:V,setCullFace:W,setLineWidth:function(t){t!==x&&(S&&e.lineWidth(t),x=t)},setPolygonOffset:q,setScissorTest:function(t){t?O(e.SCISSOR_TEST):k(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+w-1),R!==t&&(e.activeTexture(t),R=t)},bindTexture:function(t,n,i){void 0===i&&(i=null===R?e.TEXTURE0+w-1:R);let r=D[i];void 0===r&&(r={type:void 0,texture:void 0},D[i]=r),r.type===t&&r.texture===n||(R!==i&&(e.activeTexture(i),R=i),e.bindTexture(t,n||F[t]),r.type=t,r.texture=n)},unbindTexture:function(){const 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.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,n){let i=a.get(n);void 0===i&&(i=new WeakMap,a.set(n,i));let r=i.get(t);void 0===r&&(r=e.getUniformBlockIndex(n,t.name),i.set(t,r))},uniformBlockBinding:function(t,n){const i=a.get(n).get(t);r.get(n)!==i&&(e.uniformBlockBinding(n,i,t.__bindingPointIndex),r.set(n,i))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.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===P.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),P.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),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),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={},s={},l=new WeakMap,c=[],h=null,A=!1,u=null,d=null,p=null,f=null,g=null,m=null,v=null,E=new Ki(0,0,0),b=0,C=!1,_=null,I=null,x=null,y=null,M=null,U.set(0,0,e.canvas.width,e.canvas.height),P.set(0,0,e.canvas.width,e.canvas.height),t.reset(),n.reset(),i.reset()}}}function Rs(e,t,n,i,r,a,o){const s=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new nn,h=new WeakMap;let A;const u=new WeakMap;let d=!1;try{d="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function p(e,t){return d?new OffscreenCanvas(e,t):sn("canvas")}function f(e,t,n){let i=1;const r=k(e);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){const n=Math.floor(i*r.width),a=Math.floor(i*r.height);void 0===A&&(A=p(n,a));const o=t?p(n,a):A;return o.width=n,o.height=a,o.getContext("2d").drawImage(e,0,0,n,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+a+")."),o}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),e}return e}function g(e){return e.generateMipmaps&&e.minFilter!==ze&&e.minFilter!==qe}function m(t){e.generateMipmap(t)}function v(n,i,r,a,o=!1){if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let s=i;if(i===e.RED&&(r===e.FLOAT&&(s=e.R32F),r===e.HALF_FLOAT&&(s=e.R16F),r===e.UNSIGNED_BYTE&&(s=e.R8)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(s=e.R8UI),r===e.UNSIGNED_SHORT&&(s=e.R16UI),r===e.UNSIGNED_INT&&(s=e.R32UI),r===e.BYTE&&(s=e.R8I),r===e.SHORT&&(s=e.R16I),r===e.INT&&(s=e.R32I)),i===e.RG&&(r===e.FLOAT&&(s=e.RG32F),r===e.HALF_FLOAT&&(s=e.RG16F),r===e.UNSIGNED_BYTE&&(s=e.RG8)),i===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(s=e.RG8UI),r===e.UNSIGNED_SHORT&&(s=e.RG16UI),r===e.UNSIGNED_INT&&(s=e.RG32UI),r===e.BYTE&&(s=e.RG8I),r===e.SHORT&&(s=e.RG16I),r===e.INT&&(s=e.RG32I)),i===e.RGB&&r===e.UNSIGNED_INT_5_9_9_9_REV&&(s=e.RGB9_E5),i===e.RGBA){const t=o?Mt:fn.getTransfer(a);r===e.FLOAT&&(s=e.RGBA32F),r===e.HALF_FLOAT&&(s=e.RGBA16F),r===e.UNSIGNED_BYTE&&(s=t===wt?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(s=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(s=e.RGB5_A1)}return s!==e.R16F&&s!==e.R32F&&s!==e.RG16F&&s!==e.RG32F&&s!==e.RGBA16F&&s!==e.RGBA32F||t.get("EXT_color_buffer_float"),s}function E(t,n){let i;return t?null===n||n===Je||n===et?i=e.DEPTH24_STENCIL8:n===Ze?i=e.DEPTH32F_STENCIL8:n===Ke&&(i=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===Je||n===et?i=e.DEPTH_COMPONENT24:n===Ze?i=e.DEPTH_COMPONENT32F:n===Ke&&(i=e.DEPTH_COMPONENT16),i}function b(e,t){return!0===g(e)||e.isFramebufferTexture&&e.minFilter!==ze&&e.minFilter!==qe?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 C(e){const t=e.target;t.removeEventListener("dispose",C),function(e){const t=i.get(e);if(void 0===t.__webglInit)return;const n=e.source,r=u.get(n);if(r){const i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&I(e),0===Object.keys(r).length&&u.delete(n)}i.remove(e)}(t),t.isVideoTexture&&h.delete(t)}function _(t){const n=t.target;n.removeEventListener("dispose",_),function(t){const n=i.get(t);if(t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let i=0;i<n.__webglFramebuffer[t].length;i++)e.deleteFramebuffer(n.__webglFramebuffer[t][i]);else e.deleteFramebuffer(n.__webglFramebuffer[t]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t])}else{if(Array.isArray(n.__webglFramebuffer))for(let t=0;t<n.__webglFramebuffer.length;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}const r=t.textures;for(let t=0,n=r.length;t<n;t++){const n=i.get(r[t]);n.__webglTexture&&(e.deleteTexture(n.__webglTexture),o.memory.textures--),i.remove(r[t])}i.remove(t)}(n)}function I(t){const n=i.get(t);e.deleteTexture(n.__webglTexture);const r=t.source;delete u.get(r)[n.__cacheKey],o.memory.textures--}let x=0;function y(t,r){const a=i.get(t);if(t.isVideoTexture&&function(e){const t=o.render.frame;h.get(e)!==t&&(h.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version){const e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void R(a,t,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+r)}const M={[ke]:e.REPEAT,[Ge]:e.CLAMP_TO_EDGE,[He]:e.MIRRORED_REPEAT},w={[ze]:e.NEAREST,[Ve]:e.NEAREST_MIPMAP_NEAREST,[We]:e.NEAREST_MIPMAP_LINEAR,[qe]:e.LINEAR,[je]:e.LINEAR_MIPMAP_NEAREST,[Ye]:e.LINEAR_MIPMAP_LINEAR},S={[Rt]:e.NEVER,[Ft]:e.ALWAYS,[Dt]:e.LESS,[Lt]:e.LEQUAL,[Qt]:e.EQUAL,[Nt]:e.GEQUAL,[Ut]:e.GREATER,[Pt]:e.NOTEQUAL};function B(n,a){if(a.type!==Ze||!1!==t.has("OES_texture_float_linear")||a.magFilter!==qe&&a.magFilter!==je&&a.magFilter!==We&&a.magFilter!==Ye&&a.minFilter!==qe&&a.minFilter!==je&&a.minFilter!==We&&a.minFilter!==Ye||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,M[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,M[a.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,M[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,w[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,w[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,S[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){if(a.magFilter===ze)return;if(a.minFilter!==We&&a.minFilter!==Ye)return;if(a.type===Ze&&!1===t.has("OES_texture_float_linear"))return;if(a.anisotropy>1||i.get(a).__currentAnisotropy){const o=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy}}}function T(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",C));const r=n.source;let a=u.get(r);void 0===a&&(a={},u.set(r,a));const s=function(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(s!==t.__cacheKey){void 0===a[s]&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,i=!0),a[s].usedTimes++;const r=a[t.__cacheKey];void 0!==r&&(a[t.__cacheKey].usedTimes--,0===r.usedTimes&&I(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return i}function R(t,o,s){let l=e.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),o.isData3DTexture&&(l=e.TEXTURE_3D);const c=T(t,o),h=o.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+s);const A=i.get(h);if(h.version!==A.__version||!0===c){n.activeTexture(e.TEXTURE0+s);const t=fn.getPrimaries(fn.workingColorSpace),i=o.colorSpace===Ct?null:fn.getPrimaries(o.colorSpace),u=o.colorSpace===Ct||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);let d=f(o.image,!1,r.maxTextureSize);d=O(o,d);const p=a.convert(o.format,o.colorSpace),C=a.convert(o.type);let _,I=v(o.internalFormat,p,C,o.colorSpace,o.isVideoTexture);B(l,o);const x=o.mipmaps,y=!0!==o.isVideoTexture,M=void 0===A.__version||!0===c,w=h.dataReady,S=b(o,d);if(o.isDepthTexture)I=E(o.format===it,o.type),M&&(y?n.texStorage2D(e.TEXTURE_2D,1,I,d.width,d.height):n.texImage2D(e.TEXTURE_2D,0,I,d.width,d.height,0,p,C,null));else if(o.isDataTexture)if(x.length>0){y&&M&&n.texStorage2D(e.TEXTURE_2D,S,I,x[0].width,x[0].height);for(let t=0,i=x.length;t<i;t++)_=x[t],y?w&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,_.width,_.height,p,C,_.data):n.texImage2D(e.TEXTURE_2D,t,I,_.width,_.height,0,p,C,_.data);o.generateMipmaps=!1}else y?(M&&n.texStorage2D(e.TEXTURE_2D,S,I,d.width,d.height),w&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,d.width,d.height,p,C,d.data)):n.texImage2D(e.TEXTURE_2D,0,I,d.width,d.height,0,p,C,d.data);else if(o.isCompressedTexture)if(o.isCompressedArrayTexture){y&&M&&n.texStorage3D(e.TEXTURE_2D_ARRAY,S,I,x[0].width,x[0].height,d.depth);for(let t=0,i=x.length;t<i;t++)if(_=x[t],o.format!==tt)if(null!==p)if(y){if(w)if(o.layerUpdates.size>0){for(const i of o.layerUpdates){const r=_.width*_.height;n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,i,_.width,_.height,1,p,_.data.slice(r*i,r*(i+1)),0,0)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,_.width,_.height,d.depth,p,_.data,0,0)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,I,_.width,_.height,d.depth,0,_.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else y?w&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,_.width,_.height,d.depth,p,C,_.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,I,_.width,_.height,d.depth,0,p,C,_.data)}else{y&&M&&n.texStorage2D(e.TEXTURE_2D,S,I,x[0].width,x[0].height);for(let t=0,i=x.length;t<i;t++)_=x[t],o.format!==tt?null!==p?y?w&&n.compressedTexSubImage2D(e.TEXTURE_2D,t,0,0,_.width,_.height,p,_.data):n.compressedTexImage2D(e.TEXTURE_2D,t,I,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):y?w&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,_.width,_.height,p,C,_.data):n.texImage2D(e.TEXTURE_2D,t,I,_.width,_.height,0,p,C,_.data)}else if(o.isDataArrayTexture)if(y){if(M&&n.texStorage3D(e.TEXTURE_2D_ARRAY,S,I,d.width,d.height,d.depth),w)if(o.layerUpdates.size>0){let t;switch(C){case e.UNSIGNED_BYTE:switch(p){case e.ALPHA:case e.LUMINANCE:t=1;break;case e.LUMINANCE_ALPHA:t=2;break;case e.RGB:t=3;break;case e.RGBA:t=4;break;default:throw new Error(`Unknown texel size for format ${p}.`)}break;case e.UNSIGNED_SHORT_4_4_4_4:case e.UNSIGNED_SHORT_5_5_5_1:case e.UNSIGNED_SHORT_5_6_5:t=1;break;default:throw new Error(`Unknown texel size for type ${C}.`)}const i=d.width*d.height*t;for(const t of o.layerUpdates)n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,t,d.width,d.height,1,p,C,d.data.slice(i*t,i*(t+1)));o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,d.width,d.height,d.depth,p,C,d.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,I,d.width,d.height,d.depth,0,p,C,d.data);else if(o.isData3DTexture)y?(M&&n.texStorage3D(e.TEXTURE_3D,S,I,d.width,d.height,d.depth),w&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,d.width,d.height,d.depth,p,C,d.data)):n.texImage3D(e.TEXTURE_3D,0,I,d.width,d.height,d.depth,0,p,C,d.data);else if(o.isFramebufferTexture){if(M)if(y)n.texStorage2D(e.TEXTURE_2D,S,I,d.width,d.height);else{let t=d.width,i=d.height;for(let r=0;r<S;r++)n.texImage2D(e.TEXTURE_2D,r,I,t,i,0,p,C,null),t>>=1,i>>=1}}else if(x.length>0){if(y&&M){const t=k(x[0]);n.texStorage2D(e.TEXTURE_2D,S,I,t.width,t.height)}for(let t=0,i=x.length;t<i;t++)_=x[t],y?w&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,p,C,_):n.texImage2D(e.TEXTURE_2D,t,I,p,C,_);o.generateMipmaps=!1}else if(y){if(M){const t=k(d);n.texStorage2D(e.TEXTURE_2D,S,I,t.width,t.height)}w&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,p,C,d)}else n.texImage2D(e.TEXTURE_2D,0,I,p,C,d);g(o)&&m(l),A.__version=h.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}function D(t,r,o,l,c,h){const A=a.convert(o.format,o.colorSpace),u=a.convert(o.type),d=v(o.internalFormat,A,u,o.colorSpace);if(!i.get(r).__hasExternalTextures){const t=Math.max(1,r.width>>h),i=Math.max(1,r.height>>h);c===e.TEXTURE_3D||c===e.TEXTURE_2D_ARRAY?n.texImage3D(c,h,d,t,i,r.depth,0,A,u,null):n.texImage2D(c,h,d,t,i,0,A,u,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),F(r)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,l,c,i.get(o).__webglTexture,0,N(r)):(c===e.TEXTURE_2D||c>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,l,c,i.get(o).__webglTexture,h),n.bindFramebuffer(e.FRAMEBUFFER,null)}function Q(t,n,i){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){const r=n.depthTexture,a=r&&r.isDepthTexture?r.type:null,o=E(n.stencilBuffer,a),l=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=N(n);F(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,c,o,n.width,n.height):i?e.renderbufferStorageMultisample(e.RENDERBUFFER,c,o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,t)}else{const t=n.textures;for(let r=0;r<t.length;r++){const o=t[r],l=a.convert(o.format,o.colorSpace),c=a.convert(o.type),h=v(o.internalFormat,l,c,o.colorSpace),A=N(n);i&&!1===F(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,A,h,n.width,n.height):F(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,A,h,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,h,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function L(t){const r=i.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!r.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(e.FRAMEBUFFER,t),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),y(r.depthTexture,0);const a=i.get(r.depthTexture).__webglTexture,o=N(r);if(r.depthTexture.format===nt)F(r)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0,o):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,a,0);else{if(r.depthTexture.format!==it)throw new Error("Unknown depthTexture format");F(r)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0,o):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,a,0)}}(r.__webglFramebuffer,t)}else if(a){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[i]),r.__webglDepthbuffer[i]=e.createRenderbuffer(),Q(r.__webglDepthbuffer[i],t,!1)}else n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=e.createRenderbuffer(),Q(r.__webglDepthbuffer,t,!1);n.bindFramebuffer(e.FRAMEBUFFER,null)}const U=[],P=[];function N(e){return Math.min(r.maxSamples,e.samples)}function F(e){const n=i.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function O(e,t){const n=e.colorSpace,i=e.format,r=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==It&&n!==Ct&&(fn.getTransfer(n)===wt?i===tt&&r===Xe||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),t}function k(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):"undefined"!=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(){const e=x;return e>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures),x+=1,e},this.resetTextureUnits=function(){x=0},this.setTexture2D=y,this.setTexture2DArray=function(t,r){const a=i.get(t);t.version>0&&a.__version!==t.version?R(a,t,r):n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+r)},this.setTexture3D=function(t,r){const a=i.get(t);t.version>0&&a.__version!==t.version?R(a,t,r):n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,o){const s=i.get(t);t.version>0&&s.__version!==t.version?function(t,o,s){if(6!==o.image.length)return;const l=T(t,o),c=o.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+s);const h=i.get(c);if(c.version!==h.__version||!0===l){n.activeTexture(e.TEXTURE0+s);const t=fn.getPrimaries(fn.workingColorSpace),i=o.colorSpace===Ct?null:fn.getPrimaries(o.colorSpace),A=o.colorSpace===Ct||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,A);const u=o.isCompressedTexture||o.image[0].isCompressedTexture,d=o.image[0]&&o.image[0].isDataTexture,p=[];for(let e=0;e<6;e++)p[e]=u||d?d?o.image[e].image:o.image[e]:f(o.image[e],!0,r.maxCubemapSize),p[e]=O(o,p[e]);const E=p[0],C=a.convert(o.format,o.colorSpace),_=a.convert(o.type),I=v(o.internalFormat,C,_,o.colorSpace),x=!0!==o.isVideoTexture,y=void 0===h.__version||!0===l,M=c.dataReady;let w,S=b(o,E);if(B(e.TEXTURE_CUBE_MAP,o),u){x&&y&&n.texStorage2D(e.TEXTURE_CUBE_MAP,S,I,E.width,E.height);for(let t=0;t<6;t++){w=p[t].mipmaps;for(let i=0;i<w.length;i++){const r=w[i];o.format!==tt?null!==C?x?M&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,C,r.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,I,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):x?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,C,_,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,I,r.width,r.height,0,C,_,r.data)}}}else{if(w=o.mipmaps,x&&y){w.length>0&&S++;const t=k(p[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,S,I,t.width,t.height)}for(let t=0;t<6;t++)if(d){x?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,p[t].width,p[t].height,C,_,p[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,I,p[t].width,p[t].height,0,C,_,p[t].data);for(let i=0;i<w.length;i++){const r=w[i].image[t].image;x?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,r.width,r.height,C,_,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,I,r.width,r.height,0,C,_,r.data)}}else{x?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,C,_,p[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,I,C,_,p[t]);for(let i=0;i<w.length;i++){const r=w[i];x?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,C,_,r.image[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,I,C,_,r.image[t])}}}g(o)&&m(e.TEXTURE_CUBE_MAP),h.__version=c.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}(s,t,o):n.bindTexture(e.TEXTURE_CUBE_MAP,s.__webglTexture,e.TEXTURE0+o)},this.rebindTextures=function(t,n,r){const a=i.get(t);void 0!==n&&D(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==r&&L(t)},this.setupRenderTarget=function(t){const r=t.texture,s=i.get(t),l=i.get(r);t.addEventListener("dispose",_);const c=t.textures,h=!0===t.isWebGLCubeRenderTarget,A=c.length>1;if(A||(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=r.version,o.memory.textures++),h){s.__webglFramebuffer=[];for(let t=0;t<6;t++)if(r.mipmaps&&r.mipmaps.length>0){s.__webglFramebuffer[t]=[];for(let n=0;n<r.mipmaps.length;n++)s.__webglFramebuffer[t][n]=e.createFramebuffer()}else s.__webglFramebuffer[t]=e.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){s.__webglFramebuffer=[];for(let t=0;t<r.mipmaps.length;t++)s.__webglFramebuffer[t]=e.createFramebuffer()}else s.__webglFramebuffer=e.createFramebuffer();if(A)for(let t=0,n=c.length;t<n;t++){const n=i.get(c[t]);void 0===n.__webglTexture&&(n.__webglTexture=e.createTexture(),o.memory.textures++)}if(t.samples>0&&!1===F(t)){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(let n=0;n<c.length;n++){const i=c[n];s.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,s.__webglColorRenderbuffer[n]);const r=a.convert(i.format,i.colorSpace),o=a.convert(i.type),l=v(i.internalFormat,r,o,i.colorSpace,!0===t.isXRRenderTarget),h=N(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,h,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+n,e.RENDERBUFFER,s.__webglColorRenderbuffer[n])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(s.__webglDepthRenderbuffer=e.createRenderbuffer(),Q(s.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(h){n.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),B(e.TEXTURE_CUBE_MAP,r);for(let n=0;n<6;n++)if(r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)D(s.__webglFramebuffer[n][i],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,i);else D(s.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);g(r)&&m(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(A){for(let r=0,a=c.length;r<a;r++){const a=c[r],o=i.get(a);n.bindTexture(e.TEXTURE_2D,o.__webglTexture),B(e.TEXTURE_2D,a),D(s.__webglFramebuffer,t,a,e.COLOR_ATTACHMENT0+r,e.TEXTURE_2D,0),g(a)&&m(e.TEXTURE_2D)}n.unbindTexture()}else{let i=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(i=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(i,l.__webglTexture),B(i,r),r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)D(s.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,i,n);else D(s.__webglFramebuffer,t,r,e.COLOR_ATTACHMENT0,i,0);g(r)&&m(i),n.unbindTexture()}t.depthBuffer&&L(t)},this.updateRenderTargetMipmap=function(t){const r=t.textures;for(let a=0,o=r.length;a<o;a++){const o=r[a];if(g(o)){const r=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,a=i.get(o).__webglTexture;n.bindTexture(r,a),m(r),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0)if(!1===F(t)){const r=t.textures,a=t.width,o=t.height;let s=e.COLOR_BUFFER_BIT;const c=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,h=i.get(t),A=r.length>1;if(A)for(let t=0;t<r.length;t++)n.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let n=0;n<r.length;n++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(s|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(s|=e.STENCIL_BUFFER_BIT)),A){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,h.__webglColorRenderbuffer[n]);const t=i.get(r[n]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,a,o,0,0,a,o,s,e.NEAREST),!0===l&&(U.length=0,P.length=0,U.push(e.COLOR_ATTACHMENT0+n),t.depthBuffer&&!1===t.resolveDepthBuffer&&(U.push(c),P.push(c),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,P)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,U))}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),A)for(let t=0;t<r.length;t++){n.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,h.__webglColorRenderbuffer[t]);const a=i.get(r[t]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&l){const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}},this.setupDepthRenderbuffer=L,this.setupFrameBufferTexture=D,this.useMultisampledRTT=F}function Ds(e,t){return{convert:function(n,i=""){let r;const a=fn.getTransfer(i);if(n===Xe)return e.UNSIGNED_BYTE;if(1017===n)return e.UNSIGNED_SHORT_4_4_4_4;if(1018===n)return e.UNSIGNED_SHORT_5_5_5_1;if(35902===n)return e.UNSIGNED_INT_5_9_9_9_REV;if(1010===n)return e.BYTE;if(1011===n)return e.SHORT;if(n===Ke)return e.UNSIGNED_SHORT;if(1013===n)return e.INT;if(n===Je)return e.UNSIGNED_INT;if(n===Ze)return e.FLOAT;if(n===$e)return e.HALF_FLOAT;if(1021===n)return e.ALPHA;if(1022===n)return e.RGB;if(n===tt)return e.RGBA;if(1024===n)return e.LUMINANCE;if(1025===n)return e.LUMINANCE_ALPHA;if(n===nt)return e.DEPTH_COMPONENT;if(n===it)return e.DEPTH_STENCIL;if(n===rt)return e.RED;if(1029===n)return e.RED_INTEGER;if(n===at)return e.RG;if(1031===n)return e.RG_INTEGER;if(1033===n)return e.RGBA_INTEGER;if(n===ot||n===st||n===lt||n===ct)if(a===wt){if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(n===ot)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===st)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===lt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===ct)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=t.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(n===ot)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===st)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===lt)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===ct)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===ht||35841===n||n===At||35843===n){if(r=t.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(n===ht)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===n)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===At)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===n)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===ut||n===dt||n===pt){if(r=t.get("WEBGL_compressed_texture_etc"),null===r)return null;if(n===ut||n===dt)return a===wt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===pt)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===ft||37809===n||37810===n||37811===n||n===gt||37813===n||37814===n||37815===n||37816===n||37817===n||37818===n||37819===n||37820===n||37821===n){if(r=t.get("WEBGL_compressed_texture_astc"),null===r)return null;if(n===ft)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===gt)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===n)return a===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===mt||36494===n||36495===n){if(r=t.get("EXT_texture_compression_bptc"),null===r)return null;if(n===mt)return a===wt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(36494===n)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(36495===n)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===n||36284===n||36285===n||36286===n){if(r=t.get("EXT_texture_compression_rgtc"),null===r)return null;if(n===mt)return r.COMPRESSED_RED_RGTC1_EXT;if(36284===n)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===n)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===n)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===et?e.UNSIGNED_INT_24_8:void 0!==e[n]?e[n]:null}}}class Qs extends qr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ls extends Li{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Us={type:"move"};class Ps{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Ls,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 Ls,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Rn,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Rn),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Ls,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Rn,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Rn),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){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}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,n){let i=null,r=null,a=null;const o=this._targetRay,s=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){a=!0;for(const i of e.hand.values()){const e=t.getJointPose(i,n),r=this._getHandJoint(l,i);null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=e.radius),r.visible=null!==e}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],o=i.position.distanceTo(r.position),s=.02,c=.005;l.inputState.pinching&&o>s+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&o<=s-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==s&&e.gripSpace&&(r=t.getPose(e.gripSpace,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));null!==o&&(i=t.getPose(e.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Us)))}return null!==o&&(o.visible=null!==i),null!==s&&(s.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){const n=new Ls;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class Ns{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(null===this.texture){const i=new xn;e.properties.get(i).__webglTexture=t.texture,t.depthNear==n.depthNear&&t.depthFar==n.depthFar||(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(null!==this.texture&&null===this.mesh){const t=e.cameras[0].viewport,n=new Gr({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Lr(new oa(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Fs extends zt{constructor(e,t){super();const n=this;let i=null,r=1,a=null,o="local-floor",s=1,l=null,c=null,h=null,A=null,u=null,d=null;const p=new Ns,f=t.getContextAttributes();let g=null,m=null;const v=[],E=[],b=new nn;let C=null;const _=new qr;_.layers.enable(1),_.viewport=new yn;const I=new qr;I.layers.enable(2),I.viewport=new yn;const x=[_,I],y=new Qs;y.layers.enable(1),y.layers.enable(2);let M=null,w=null;function S(e){const t=E.indexOf(e.inputSource);if(-1===t)return;const n=v[t];void 0!==n&&(n.update(e.inputSource,e.frame,l||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function B(){i.removeEventListener("select",S),i.removeEventListener("selectstart",S),i.removeEventListener("selectend",S),i.removeEventListener("squeeze",S),i.removeEventListener("squeezestart",S),i.removeEventListener("squeezeend",S),i.removeEventListener("end",B),i.removeEventListener("inputsourceschange",T);for(let e=0;e<v.length;e++){const t=E[e];null!==t&&(E[e]=null,v[e].disconnect(t))}M=null,w=null,p.reset(),e.setRenderTarget(g),u=null,A=null,h=null,i=null,m=null,U.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(b.width,b.height,!1),n.dispatchEvent({type:"sessionend"})}function T(e){for(let t=0;t<e.removed.length;t++){const n=e.removed[t],i=E.indexOf(n);i>=0&&(E[i]=null,v[i].disconnect(n))}for(let t=0;t<e.added.length;t++){const n=e.added[t];let i=E.indexOf(n);if(-1===i){for(let e=0;e<v.length;e++){if(e>=E.length){E.push(n),i=e;break}if(null===E[e]){E[e]=n,i=e;break}}if(-1===i)break}const r=v[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=v[e];return void 0===t&&(t=new Ps,v[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=v[e];return void 0===t&&(t=new Ps,v[e]=t),t.getGripSpace()},this.getHand=function(e){let t=v[e];return void 0===t&&(t=new Ps,v[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){o=e,!0===n.isPresenting&&console.warn("THREE.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!==A?A:u},this.getBinding=function(){return h},this.getFrame=function(){return d},this.getSession=function(){return i},this.setSession=async function(c){if(i=c,null!==i){if(g=e.getRenderTarget(),i.addEventListener("select",S),i.addEventListener("selectstart",S),i.addEventListener("selectend",S),i.addEventListener("squeeze",S),i.addEventListener("squeezestart",S),i.addEventListener("squeezeend",S),i.addEventListener("end",B),i.addEventListener("inputsourceschange",T),!0!==f.xrCompatible&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(b),void 0===i.renderState.layers){const n={antialias:f.antialias,alpha:!0,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:r};u=new XRWebGLLayer(i,t,n),i.updateRenderState({baseLayer:u}),e.setPixelRatio(1),e.setSize(u.framebufferWidth,u.framebufferHeight,!1),m=new wn(u.framebufferWidth,u.framebufferHeight,{format:tt,type:Xe,colorSpace:e.outputColorSpace,stencilBuffer:f.stencil})}else{let n=null,a=null,o=null;f.depth&&(o=f.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=f.stencil?it:nt,a=f.stencil?et:Je);const s={colorFormat:t.RGBA8,depthFormat:o,scaleFactor:r};h=new XRWebGLBinding(i,t),A=h.createProjectionLayer(s),i.updateRenderState({layers:[A]}),e.setPixelRatio(1),e.setSize(A.textureWidth,A.textureHeight,!1),m=new wn(A.textureWidth,A.textureHeight,{format:tt,type:Xe,depthTexture:new Ha(A.textureWidth,A.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:f.stencil,colorSpace:e.outputColorSpace,samples:f.antialias?4:0,resolveDepthBuffer:!1===A.ignoreDepthValues})}m.isXRRenderTarget=!0,this.setFoveation(s),l=null,a=await i.requestReferenceSpace(o),U.setContext(i),U.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode},this.getDepthTexture=function(){return p.getDepthTexture()};const R=new Rn,D=new Rn;function Q(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){if(null===i)return;null!==p.texture&&(e.near=p.depthNear,e.far=p.depthFar),y.near=I.near=_.near=e.near,y.far=I.far=_.far=e.far,M===y.near&&w===y.far||(i.updateRenderState({depthNear:y.near,depthFar:y.far}),M=y.near,w=y.far,_.near=M,_.far=w,I.near=M,I.far=w,_.updateProjectionMatrix(),I.updateProjectionMatrix(),e.updateProjectionMatrix());const t=e.parent,n=y.cameras;Q(y,t);for(let e=0;e<n.length;e++)Q(n[e],t);2===n.length?function(e,t,n){R.setFromMatrixPosition(t.matrixWorld),D.setFromMatrixPosition(n.matrixWorld);const i=R.distanceTo(D),r=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],A=(a[8]+1)/a[0],u=o*h,d=o*A,p=i/(-h+A),f=p*-h;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(f),e.translateZ(p),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();const g=o+p,m=s+p,v=u-f,E=d+(i-f),b=l*s/m*g,C=c*s/m*g;e.projectionMatrix.makePerspective(v,E,b,C,g,m),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}(y,_,I):y.projectionMatrix.copy(_.projectionMatrix),function(e,t,n){null===n?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld)),e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*qt*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}(e,y,t)},this.getCamera=function(){return y},this.getFoveation=function(){if(null!==A||null!==u)return s},this.setFoveation=function(e){s=e,null!==A&&(A.fixedFoveation=e),null!==u&&void 0!==u.fixedFoveation&&(u.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==p.texture},this.getDepthSensingMesh=function(){return p.getMesh(y)};let L=null;const U=new ra;U.setAnimationLoop(function(t,r){if(c=r.getViewerPose(l||a),d=r,null!==c){const t=c.views;null!==u&&(e.setRenderTargetFramebuffer(m,u.framebuffer),e.setRenderTarget(m));let n=!1;t.length!==y.cameras.length&&(y.cameras.length=0,n=!0);for(let i=0;i<t.length;i++){const r=t[i];let a=null;if(null!==u)a=u.getViewport(r);else{const t=h.getViewSubImage(A,r);a=t.viewport,0===i&&(e.setRenderTargetTextures(m,t.colorTexture,A.ignoreDepthValues?void 0:t.depthStencilTexture),e.setRenderTarget(m))}let o=x[i];void 0===o&&(o=new qr,o.layers.enable(i),o.viewport=new yn,x[i]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(a.x,a.y,a.width,a.height),0===i&&(y.matrix.copy(o.matrix),y.matrix.decompose(y.position,y.quaternion,y.scale)),!0===n&&y.cameras.push(o)}const r=i.enabledFeatures;if(r&&r.includes("depth-sensing")){const n=h.getDepthInformation(t[0]);n&&n.isValid&&n.texture&&p.init(e,n,i.renderState)}}for(let e=0;e<v.length;e++){const t=E[e],n=v[e];null!==t&&void 0!==n&&n.update(t,r,l||a)}L&&L(t,r),r.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:r}),d=null}),this.setAnimationLoop=function(e){L=e},this.dispose=function(){}}}const Os=new mi,ks=new si;function Gs(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function i(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map,n(i.map,e.mapTransform)),i.alphaMap&&(e.alphaMap.value=i.alphaMap,n(i.alphaMap,e.alphaMapTransform)),i.bumpMap&&(e.bumpMap.value=i.bumpMap,n(i.bumpMap,e.bumpMapTransform),e.bumpScale.value=i.bumpScale,1===i.side&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,n(i.normalMap,e.normalMapTransform),e.normalScale.value.copy(i.normalScale),1===i.side&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,n(i.displacementMap,e.displacementMapTransform),e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,e.emissiveMapTransform)),i.specularMap&&(e.specularMap.value=i.specularMap,n(i.specularMap,e.specularMapTransform)),i.alphaTest>0&&(e.alphaTest.value=i.alphaTest);const r=t.get(i),a=r.envMap,o=r.envMapRotation;a&&(e.envMap.value=a,Os.copy(o),Os.x*=-1,Os.y*=-1,Os.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(Os.y*=-1,Os.z*=-1),e.envMapRotation.value.setFromMatrix4(ks.makeRotationFromEuler(Os)),e.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,Or(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,a,o,s,l){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(i(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(i(e,r),function(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,i){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),1===t.side&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,r,s)):r.isMeshMatcapMaterial?(i(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,n){const i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,i,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*r,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r,a,o):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial?r.uniformsNeedUpdate=!1:r.isMeshDiamondMaterial&&function(e,n,i,r){e.opacity.value=n.opacity,e.reflectivity.value=n.reflectivity,e.ior.value=n.ior,e.radius.value=n.radius,e.squashFactor.value=n.squashFactor,e.geometryFactor.value=n.geometryFactor,e.gammaFactor.value=n.gammaFactor,e.absorptionFactor.value=n.absorptionFactor,e.rIndexDelta.value=n.rIndexDelta,n.boostFactors&&e.boostFactors.value.copy(n.boostFactors),n.colorCorrection&&e.colorCorrection.value.set(n.colorCorrection.r,n.colorCorrection.g,n.colorCorrection.b),n.color&&(e.diffuse.value.copy(n.color),e.color.value.set(n.color.r,n.color.g,n.color.b));const a=t.get(n).envMap;a&&(e.envMap.value=a,e.envMapRotation.value=n.envMapRotation,e.envMapIntensity.value=n.envMapIntensity),n.transmission>0&&(e.transmission.value=n.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height)),r&&(e.tCubeMapNormals.value=r.texture)}(e,r,s,l)}}}function Hs(e,t,n,i){let r={},a={},o=[];const s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e,t,n,i){const r=e.value,a=t+"_"+n;if(void 0===i[a])return i[a]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const e=i[a];if("number"==typeof r||"boolean"==typeof r){if(e!==r)return i[a]=r,!0}else if(!1===e.equals(r))return e.copy(r),!0}return!1}function c(e){const 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?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function h(t){const n=t.target;n.removeEventListener("dispose",h);const i=o.indexOf(n.__bindingPointIndex);o.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}return{bind:function(e,t){const n=t.program;i.uniformBlockBinding(e,n)},update:function(n,A){let u=r[n.id];void 0===u&&(function(e){const t=e.uniforms;let n=0;for(let e=0,i=t.length;e<i;e++){const i=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=i.length;e<t;e++){const t=i[e],r=Array.isArray(t.value)?t.value:[t.value];for(let e=0,i=r.length;e<i;e++){const i=c(r[e]),a=n%16;0!==a&&16-a<i.boundary&&(n+=16-a),t.__data=new Float32Array(i.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=i.storage}}}const i=n%16;i>0&&(n+=16-i),e.__size=n,e.__cache={}}(n),u=function(t){const n=function(){for(let e=0;e<s;e++)if(-1===o.indexOf(e))return o.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=n;const i=e.createBuffer(),r=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,i),e.bufferData(e.UNIFORM_BUFFER,r,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=u,n.addEventListener("dispose",h));const d=A.program;i.updateUBOMapping(n,d);const p=t.render.frame;a[n.id]!==p&&(function(t){const n=r[t.id],i=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let t=0,n=i.length;t<n;t++){const n=Array.isArray(i[t])?i[t]:[i[t]];for(let i=0,r=n.length;i<r;i++){const r=n[i];if(!0===l(r,t,i,a)){const t=r.__offset,n=Array.isArray(r.value)?r.value:[r.value];let i=0;for(let a=0;a<n.length;a++){const o=n[a],s=c(o);"number"==typeof o||"boolean"==typeof o?(r.__data[0]=o,e.bufferSubData(e.UNIFORM_BUFFER,t+i,r.__data)):o.isMatrix3?(r.__data[0]=o.elements[0],r.__data[1]=o.elements[1],r.__data[2]=o.elements[2],r.__data[3]=0,r.__data[4]=o.elements[3],r.__data[5]=o.elements[4],r.__data[6]=o.elements[5],r.__data[7]=0,r.__data[8]=o.elements[6],r.__data[9]=o.elements[7],r.__data[10]=o.elements[8],r.__data[11]=0):(o.toArray(r.__data,i),i+=s.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,r.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(n),a[n.id]=p)},dispose:function(){for(const t in r)e.deleteBuffer(r[t]);o=[],r={},a={}}}}class zs extends Gr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Vs extends $i{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ki(16777215),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}}class Ws extends $i{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Ki(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ki(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new nn(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 mi,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 qs extends Ws{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 nn(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Yt(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 Ki(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 Ki(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ki(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 js extends $i{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ki(16777215),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}}class Ys extends $i{constructor(e){super(),this.isMeshDiamondMaterial=!0,this.type="MeshDiamondMaterial",this.defines={RAY_BOUNCES:5},this.color=new Ki(16777215),this.map=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=0,this.envMapRotationQuat=(new Tn).identity(),this.envMapIntensity=.01,this.ior=2.4,this.reflectivity=.5,this.roughness=1,this.metalness=0,this.radius=1,this.transmission=0,this.squashFactor=.98,this.geometryFactor=.5,this.gammaFactor=1,this.absorptionFactor=1,this.rIndexDelta=.012,this.diamondOrientedEnvMap=0,this.boostFactors=new Rn(1,1,1),this.fixedEnvMapDirection=!1,this.rayBounces=5,this.colorCorrection=new Ki(16777215),this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.defines=Object.assign({},e.defines),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation=e.envMapRotation,this.envMapRotationQuat.copy(e.envMapRotationQuat),this.envMapIntensity=e.envMapIntensity,this.ior=e.ior,this.reflectivity=e.reflectivity,this.roughness=e.roughness,this.metalness=e.metalness,this.radius=e.radius,this.transmission=e.transmission,this.squashFactor=e.squashFactor,this.geometryFactor=e.geometryFactor,this.gammaFactor=e.gammaFactor,this.absorptionFactor=e.absorptionFactor,this.colorCorrection=e.colorCorrection,this.rIndexDelta=e.rIndexDelta,this.diamondOrientedEnvMap=e.diamondOrientedEnvMap,this.boostFactors.copy(e.boostFactors),this.fixedEnvMapDirection=e.fixedEnvMapDirection,this.rayBounces=e.rayBounces,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}class Xs extends $i{constructor(e){super(),this.isCubeNormalsMaterial=!0,this.type="CubeNormalsMaterial",this.radius=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.radius=e.radius,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}class Ks extends Li{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 mi,this.environmentIntensity=1,this.environmentRotation=new mi,this.overrideMaterial=null,"undefined"!=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){const 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 Js{constructor(e={}){const{canvas:t=ln(),context:n=null,depth:i=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:l=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:h=!1}=e;let A;if(this.isWebGLRenderer=!0,null!==n){if("undefined"!=typeof WebGLRenderingContext&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");A=n.getContextAttributes().alpha}else A=a;const u=new Uint32Array(4),d=new Int32Array(4);let p=null,f=null;const g=[],m=[];this.domElement=t,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._outputColorSpace=_t,this.toneMapping=0,this.toneMappingExposure=1;const v=this;let E=!1,b=0,C=0,_=null,I=-1,x=null;const y=new yn,M=new yn;let w=null;const S=new Ki(0);let B=0,T=t.width,R=t.height,D=1,Q=null,L=null;const U=new yn(0,0,T,R),P=new yn(0,0,T,R);let N=!1;const F=new ia;let O=!1,k=!1;const G=new si,H=new Rn,z=new yn,V={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let W=!1;function q(){return null===_?D:1}let j,Y,X,K,J,Z,$,ee,te,ne,ie,re,ae,oe,se,le,ce,he,Ae,ue,pe,fe,ge,me,ve=n;function Ee(e,n){return t.getContext(e,n)}try{const e={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${de}`),t.addEventListener("webglcontextlost",_e,!1),t.addEventListener("webglcontextrestored",Ie,!1),t.addEventListener("webglcontextcreationerror",xe,!1),null===ve){const t="webgl2";if(ve=Ee(t,e),null===ve)throw Ee(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function be(){j=new Pa(ve),j.init(),fe=new Ds(ve,j),Y=new ga(ve,j,e,fe),X=new Ts(ve),K=new Oa(ve),J=new gs,Z=new Rs(ve,j,X,J,Y,fe,K),$=new va(v),ee=new Ua(v),te=new aa(ve),ge=new pa(ve,te),ne=new Na(ve,te,K,ge),ie=new Ga(ve,ne,te,K),Ae=new ka(ve,Y,Z),le=new ma(J),re=new fs(v,$,ee,j,Y,ge,le),ae=new Gs(v,J),oe=new bs,se=new Ms(j),he=new da(v,$,ee,X,ie,A,s),ce=new Bs(v,ie,Y),me=new Hs(ve,K,Y,X),ue=new fa(ve,j,K),pe=new Fa(ve,j,K),K.programs=re.programs,v.capabilities=Y,v.extensions=j,v.properties=J,v.renderLists=oe,v.shadowMap=ce,v.state=X,v.info=K}be();const Ce=new Fs(v,ve);function _e(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),E=!0}function Ie(){console.log("THREE.WebGLRenderer: Context Restored."),E=!1;const e=K.autoReset,t=ce.enabled,n=ce.autoUpdate,i=ce.needsUpdate,r=ce.type;be(),K.autoReset=e,ce.enabled=t,ce.autoUpdate=n,ce.needsUpdate=i,ce.type=r}function xe(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function ye(e){const t=e.target;t.removeEventListener("dispose",ye),function(e){(function(e){const t=J.get(e).programs;void 0!==t&&(t.forEach(function(e){re.releaseProgram(e)}),e.isShaderMaterial&&re.releaseShaderCache(e))})(e),J.remove(e)}(t)}function Me(e,t,n){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,Pe(e,t,n),e.side=0,e.needsUpdate=!0,Pe(e,t,n),e.side=2):Pe(e,t,n)}this.xr=Ce,this.getContext=function(){return ve},this.getContextAttributes=function(){return ve.getContextAttributes()},this.forceContextLoss=function(){const e=j.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=j.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return D},this.setPixelRatio=function(e){void 0!==e&&(D=e,this.setSize(T,R,!1))},this.getSize=function(e){return e.set(T,R)},this.setSize=function(e,n,i=!0){Ce.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(T=e,R=n,t.width=Math.floor(e*D),t.height=Math.floor(n*D),!0===i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(T*D,R*D).floor()},this.setDrawingBufferSize=function(e,n,i){T=e,R=n,D=i,t.width=Math.floor(e*i),t.height=Math.floor(n*i),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(y)},this.getViewport=function(e){return e.copy(U)},this.setViewport=function(e,t,n,i){e.isVector4?U.set(e.x,e.y,e.z,e.w):U.set(e,t,n,i),X.viewport(y.copy(U).multiplyScalar(D).round())},this.getScissor=function(e){return e.copy(P)},this.setScissor=function(e,t,n,i){e.isVector4?P.set(e.x,e.y,e.z,e.w):P.set(e,t,n,i),X.scissor(M.copy(P).multiplyScalar(D).round())},this.getScissorTest=function(){return N},this.setScissorTest=function(e){X.setScissorTest(N=e)},this.setOpaqueSort=function(e){Q=e},this.setTransparentSort=function(e){L=e},this.getClearColor=function(e){return e.copy(he.getClearColor())},this.setClearColor=function(){he.setClearColor.apply(he,arguments)},this.getClearAlpha=function(){return he.getClearAlpha()},this.setClearAlpha=function(){he.setClearAlpha.apply(he,arguments)},this.clear=function(e=!0,t=!0,n=!0){let i=0;if(e){let e=!1;if(null!==_){const t=_.texture.format;e=1033===t||1031===t||1029===t}if(e){const e=_.texture.type,t=e===Xe||e===Je||e===Ke||e===et||1017===e||1018===e,n=he.getClearColor(),i=he.getClearAlpha(),r=n.r,a=n.g,o=n.b;t?(u[0]=r,u[1]=a,u[2]=o,u[3]=i,ve.clearBufferuiv(ve.COLOR,0,u)):(d[0]=r,d[1]=a,d[2]=o,d[3]=i,ve.clearBufferiv(ve.COLOR,0,d))}else i|=ve.COLOR_BUFFER_BIT}t&&(i|=ve.DEPTH_BUFFER_BIT),n&&(i|=ve.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ve.clear(i)},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(){t.removeEventListener("webglcontextlost",_e,!1),t.removeEventListener("webglcontextrestored",Ie,!1),t.removeEventListener("webglcontextcreationerror",xe,!1),oe.dispose(),se.dispose(),J.dispose(),$.dispose(),ee.dispose(),ie.dispose(),ge.dispose(),me.dispose(),re.dispose(),Ce.dispose(),Ce.removeEventListener("sessionstart",Se),Ce.removeEventListener("sessionend",Be),Te.stop()},this.renderBufferDirect=function(e,t,n,i,r,a){null===t&&(t=V);const o=r.isMesh&&r.matrixWorld.determinant()<0,s=function(e,t,n,i,r){!0!==t.isScene&&(t=V),Z.resetTextureUnits();const a=t.fog,o=i.isMeshStandardMaterial?t.environment:null,s=null===_?v.outputColorSpace:!0===_.isXRRenderTarget?_.texture.colorSpace:It,l=(i.isMeshStandardMaterial?ee:$).get(i.envMap||o),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),A=!!n.morphAttributes.position,u=!!n.morphAttributes.normal,d=!!n.morphAttributes.color;let p=0;i.toneMapped&&(null!==_&&!0!==_.isXRRenderTarget||(p=v.toneMapping));const g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,m=void 0!==g?g.length:0,E=J.get(i),b=f.state.lights;if(!0===O&&(!0===k||e!==x)){const t=e===x&&i.id===I;le.setState(i,e,t)}let C=!1;i.version===E.__version?E.needsLights&&E.lightsStateVersion!==b.state.version||E.outputColorSpace!==s||r.isBatchedMesh&&!1===E.batching?C=!0:r.isBatchedMesh||!0!==E.batching?r.isBatchedMesh&&!0===E.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===E.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===E.instancing?C=!0:r.isInstancedMesh||!0!==E.instancing?r.isSkinnedMesh&&!1===E.skinning?C=!0:r.isSkinnedMesh||!0!==E.skinning?r.isInstancedMesh&&!0===E.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===E.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===E.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===E.instancingMorph&&null!==r.morphTexture||E.envMap!==l||!0===i.fog&&E.fog!==a?C=!0:void 0===E.numClippingPlanes||E.numClippingPlanes===le.numPlanes&&E.numIntersection===le.numIntersection?(E.vertexAlphas!==c||E.vertexTangents!==h||E.morphTargets!==A||E.morphNormals!==u||E.morphColors!==d||E.toneMapping!==p||E.morphTargetsCount!==m)&&(C=!0):C=!0:C=!0:C=!0:C=!0:(C=!0,E.__version=i.version);let y=E.currentProgram;!0===C&&(y=Pe(i,t,r));let M=!1,w=!1,S=!1;const B=y.getUniforms(),T=E.uniforms;if(X.useProgram(y.program)&&(M=!0,w=!0,S=!0),i.id!==I&&(I=i.id,w=!0),n.cubeMapNormalTarget&&(w=!0),M||x!==e){B.setValue(ve,"projectionMatrix",e.projectionMatrix),B.setValue(ve,"viewMatrix",e.matrixWorldInverse);const t=B.map.cameraPosition;void 0!==t&&t.setValue(ve,H.setFromMatrixPosition(e.matrixWorld)),Y.logarithmicDepthBuffer&&B.setValue(ve,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&B.setValue(ve,"isOrthographic",!0===e.isOrthographicCamera),x!==e&&(x=e,w=!0,S=!0)}if(r.isSkinnedMesh){B.setOptional(ve,r,"bindMatrix"),B.setOptional(ve,r,"bindMatrixInverse");const e=r.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),B.setValue(ve,"boneTexture",e.boneTexture,Z))}r.isBatchedMesh&&(B.setOptional(ve,r,"batchingTexture"),B.setValue(ve,"batchingTexture",r._matricesTexture,Z),B.setOptional(ve,r,"batchingIdTexture"),B.setValue(ve,"batchingIdTexture",r._indirectTexture,Z),B.setOptional(ve,r,"batchingColorTexture"),null!==r._colorsTexture&&B.setValue(ve,"batchingColorTexture",r._colorsTexture,Z));const Q=n.morphAttributes;var L,U;if(void 0===Q.position&&void 0===Q.normal&&void 0===Q.color||Ae.update(r,n,y),(w||E.receiveShadow!==r.receiveShadow)&&(E.receiveShadow=r.receiveShadow,B.setValue(ve,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(T.envMap.value=l,T.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==t.environment&&(T.envMapIntensity.value=t.environmentIntensity),w&&(B.setValue(ve,"toneMappingExposure",v.toneMappingExposure),E.needsLights&&(U=S,(L=T).ambientLightColor.needsUpdate=U,L.lightProbe.needsUpdate=U,L.directionalLights.needsUpdate=U,L.directionalLightShadows.needsUpdate=U,L.pointLights.needsUpdate=U,L.pointLightShadows.needsUpdate=U,L.spotLights.needsUpdate=U,L.spotLightShadows.needsUpdate=U,L.rectAreaLights.needsUpdate=U,L.hemisphereLights.needsUpdate=U),a&&!0===i.fog&&ae.refreshFogUniforms(T,a),ae.refreshMaterialUniforms(T,i,D,R,f.state.transmissionRenderTarget[e.id],n.cubeMapNormalTarget),Yo.upload(ve,Ne(E),T,Z)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Yo.upload(ve,Ne(E),T,Z),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&B.setValue(ve,"center",r.center),B.setValue(ve,"modelViewMatrix",r.modelViewMatrix),B.setValue(ve,"normalMatrix",r.normalMatrix),B.setValue(ve,"modelMatrix",r.matrixWorld),B.setValue(ve,"inverseModelMatrix",r.matrixWorldInv),B.setValue(ve,"offsetMatrixInv",r.offsetMatrixInv),B.setValue(ve,"offsetMatrix",r.offsetMatrix),B.setValue(ve,"centerOffset",r.centerOffset),(i.isCubeNormalsMaterial||i.isMeshDiamondMaterial)&&B.setValue(ve,"center",r.center),i.isMeshDiamondMaterial&&(r.modelOffsetMatrix.copy(r.matrixWorld).multiply(r.offsetMatrix),B.setValue(ve,"modelOffsetMatrix",r.modelOffsetMatrix),r.modelOffsetMatrixInv.copy(r.modelOffsetMatrix).invert(),B.setValue(ve,"modelOffsetMatrixInv",r.modelOffsetMatrixInv)),i.isShaderMaterial||i.isRawShaderMaterial){const e=i.uniformsGroups;for(let t=0,n=e.length;t<n;t++){const n=e[t];me.update(n,y),me.bind(n,y)}}return y}(e,t,n,i,r);X.setMaterial(i,o);let l=n.index,c=1;if(!0===i.wireframe){if(l=ne.getWireframeAttribute(n),void 0===l)return;c=2}const h=n.drawRange,A=n.attributes.position;let u=h.start*c,d=(h.start+h.count)*c;null!==a&&(u=Math.max(u,a.start*c),d=Math.min(d,(a.start+a.count)*c)),null!==l?(u=Math.max(u,0),d=Math.min(d,l.count)):null!=A&&(u=Math.max(u,0),d=Math.min(d,A.count));const p=d-u;if(p<0||p===1/0)return;let g;ge.setup(r,i,s,n,l);let m=ue;if(null!==l&&(g=te.get(l),m=pe,m.setIndex(g)),r.isMesh)!0===i.wireframe?(X.setLineWidth(i.wireframeLinewidth*q()),m.setMode(ve.LINES)):m.setMode(ve.TRIANGLES);else if(r.isLine){let e=i.linewidth;void 0===e&&(e=1),X.setLineWidth(e*q()),r.isLineSegments?m.setMode(ve.LINES):r.isLineLoop?m.setMode(ve.LINE_LOOP):m.setMode(ve.LINE_STRIP)}else r.isPoints?m.setMode(ve.POINTS):r.isSprite&&m.setMode(ve.TRIANGLES);if(r.isBatchedMesh)if(null!==r._multiDrawInstances)m.renderMultiDrawInstances(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount,r._multiDrawInstances);else if(j.get("WEBGL_multi_draw"))m.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else{const e=r._multiDrawStarts,t=r._multiDrawCounts,n=r._multiDrawCount,a=l?te.get(l).bytesPerElement:1,o=J.get(i).currentProgram.getUniforms();for(let i=0;i<n;i++)o.setValue(ve,"_gl_DrawID",i),m.render(e[i]/a,t[i])}else if(r.isInstancedMesh)m.renderInstances(u,p,r.count);else if(n.isInstancedBufferGeometry){const e=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,t=Math.min(n.instanceCount,e);m.renderInstances(u,p,t)}else m.render(u,p)},this.compile=function(e,t,n=null){null===n&&(n=e),f=se.get(n),f.init(t),m.push(f),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(f.pushLight(e),e.castShadow&&f.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(f.pushLight(e),e.castShadow&&f.pushShadow(e))}),f.setupLights();const i=new Set;return e.traverse(function(e){const t=e.material;if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++){const a=t[r];Me(a,n,e),i.add(a)}else Me(t,n,e),i.add(t)}),m.pop(),f=null,i},this.compileAsync=function(e,t,n=null){const i=this.compile(e,t,n);return new Promise(t=>{function n(){i.forEach(function(e){J.get(e).currentProgram.isReady()&&i.delete(e)}),0!==i.size?setTimeout(n,10):t(e)}null!==j.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)})};let we=null;function Se(){Te.stop()}function Be(){Te.start()}const Te=new ra;function Re(e,t,n,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)f.pushLight(e),e.castShadow&&f.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||F.intersectsSprite(e)){i&&z.setFromMatrixPosition(e.matrixWorld).applyMatrix4(G);const t=ie.update(e),r=e.material;r.visible&&p.push(e,t,r,n,z.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||F.intersectsObject(e))){const t=ie.update(e),r=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),z.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),z.copy(t.boundingSphere.center)),z.applyMatrix4(e.matrixWorld).applyMatrix4(G)),Array.isArray(r)){const i=t.groups;for(let a=0,o=i.length;a<o;a++){const o=i[a],s=r[o.materialIndex];s&&s.visible&&p.push(e,t,s,n,z.z,o)}}else r.visible&&p.push(e,t,r,n,z.z,null)}const r=e.children;for(let e=0,a=r.length;e<a;e++)Re(r[e],t,n,i)}function De(e,t,n,i){const r=e.opaque,a=e.transmissive,o=e.transparent;f.setupLightsView(n),!0===O&&le.setGlobalState(v.clippingPlanes,n),i&&X.viewport(y.copy(i)),r.length>0&&Le(r,t,n),a.length>0&&Le(a,t,n),o.length>0&&Le(o,t,n),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1)}function Qe(e,t,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===f.state.transmissionRenderTarget[i.id]&&(f.state.transmissionRenderTarget[i.id]=new wn(1,1,{generateMipmaps:!0,type:j.has("EXT_color_buffer_half_float")||j.has("EXT_color_buffer_float")?$e:Xe,minFilter:Ye,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:fn.workingColorSpace}));const a=f.state.transmissionRenderTarget[i.id],o=i.viewport||y;a.setSize(o.z,o.w);const s=v.getRenderTarget();v.setRenderTarget(a),v.getClearColor(S),B=v.getClearAlpha(),B<1&&v.setClearColor(16777215,.5),W?he.render(n):v.clear();const l=v.toneMapping;v.toneMapping=0;const c=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),f.setupLightsView(i),!0===O&&le.setGlobalState(v.clippingPlanes,i),Le(e,n,i),Z.updateMultisampleRenderTarget(a),Z.updateRenderTargetMipmap(a),!1===j.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let r=0,a=t.length;r<a;r++){const a=t[r],o=a.object,s=a.geometry,l=a.material,c=a.group;if(2===l.side&&o.layers.test(i.layers)){const t=l.side;l.side=1,l.needsUpdate=!0,Ue(o,n,i,s,l,c),l.side=t,l.needsUpdate=!0,e=!0}}!0===e&&(Z.updateMultisampleRenderTarget(a),Z.updateRenderTargetMipmap(a))}v.setRenderTarget(s),v.setClearColor(S,B),void 0!==c&&(i.viewport=c),v.toneMapping=l}function Le(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let r=0,a=e.length;r<a;r++){const a=e[r],o=a.object,s=a.geometry,l=null===i?a.material:i,c=a.group;o.layers.test(n.layers)&&Ue(o,t,n,s,l,c)}}function Ue(e,t,n,i,r,a){e.onBeforeRender(v,t,n,i,r,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),r.onBeforeRender(v,t,n,i,e,a),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=1,r.needsUpdate=!0,v.renderBufferDirect(n,t,i,r,e,a),r.side=0,r.needsUpdate=!0,v.renderBufferDirect(n,t,i,r,e,a),r.side=2):v.renderBufferDirect(n,t,i,r,e,a),e.onAfterRender(v,t,n,i,r,a)}function Pe(e,t,n){!0!==t.isScene&&(t=V);const i=J.get(e),r=f.state.lights,a=f.state.shadowsArray,o=r.state.version,s=re.getParameters(e,r.state,a,t,n),l=re.getProgramCacheKey(s);let c=i.programs;i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.envMap=(e.isMeshStandardMaterial?ee:$).get(e.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===c&&(e.addEventListener("dispose",ye),c=new Map,i.programs=c);let h=c.get(l);if(void 0!==h){if(i.currentProgram===h&&i.lightsStateVersion===o)return Fe(e,s),h}else s.uniforms=re.getUniforms(e),e.onBuild(n,s,v),e.onBeforeCompile(s,v),h=re.acquireProgram(s,l),c.set(l,h),i.uniforms=s.uniforms;const A=i.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(A.clippingPlanes=le.uniform),Fe(e,s),i.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),i.lightsStateVersion=o,i.needsLights&&(A.ambientLightColor.value=r.state.ambient,A.lightProbe.value=r.state.probe,A.directionalLights.value=r.state.directional,A.directionalLightShadows.value=r.state.directionalShadow,A.spotLights.value=r.state.spot,A.spotLightShadows.value=r.state.spotShadow,A.rectAreaLights.value=r.state.rectArea,A.ltc_1.value=r.state.rectAreaLTC1,A.ltc_2.value=r.state.rectAreaLTC2,A.pointLights.value=r.state.point,A.pointLightShadows.value=r.state.pointShadow,A.hemisphereLights.value=r.state.hemi,A.directionalShadowMap.value=r.state.directionalShadowMap,A.directionalShadowMatrix.value=r.state.directionalShadowMatrix,A.spotShadowMap.value=r.state.spotShadowMap,A.spotLightMatrix.value=r.state.spotLightMatrix,A.spotLightMap.value=r.state.spotLightMap,A.pointShadowMap.value=r.state.pointShadowMap,A.pointShadowMatrix.value=r.state.pointShadowMatrix),i.currentProgram=h,i.uniformsList=null,h}function Ne(e){if(null===e.uniformsList){const t=e.currentProgram.getUniforms();e.uniformsList=Yo.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function Fe(e,t){const n=J.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}Te.setAnimationLoop(function(e){we&&we(e)}),"undefined"!=typeof self&&Te.setContext(self),this.setAnimationLoop=function(e){we=e,Ce.setAnimationLoop(e),null===e?Te.stop():Te.start()},Ce.addEventListener("sessionstart",Se),Ce.addEventListener("sessionend",Be),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===E)return;if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===Ce.enabled&&!0===Ce.isPresenting&&(!0===Ce.cameraAutoUpdate&&Ce.updateCamera(t),t=Ce.getCamera()),!0===e.isScene&&e.onBeforeRender(v,e,t,_),f=se.get(e,m.length),f.init(t),m.push(f),G.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),F.setFromProjectionMatrix(G),k=this.localClippingEnabled,O=le.init(this.clippingPlanes,k),p=oe.get(e,g.length),p.init(),g.push(p),!0===Ce.enabled&&!0===Ce.isPresenting){const e=v.xr.getDepthSensingMesh();null!==e&&Re(e,t,-1/0,v.sortObjects)}Re(e,t,0,v.sortObjects),p.finish(),!0===v.sortObjects&&p.sort(Q,L),W=!1===Ce.enabled||!1===Ce.isPresenting||!1===Ce.hasDepthSensing(),W&&he.addToRenderList(p,e),this.info.render.frame++,!0===O&&le.beginShadows();const n=f.state.shadowsArray;ce.render(n,e,t),!0===O&&le.endShadows(),!0===this.info.autoReset&&this.info.reset();const i=p.opaque,r=p.transmissive;if(f.setupLights(),t.isArrayCamera){const n=t.cameras;if(r.length>0)for(let t=0,a=n.length;t<a;t++)Qe(i,r,e,n[t]);W&&he.render(e);for(let t=0,i=n.length;t<i;t++){const i=n[t];De(p,e,i,i.viewport)}}else r.length>0&&Qe(i,r,e,t),W&&he.render(e),De(p,e,t);null!==_&&(Z.updateMultisampleRenderTarget(_),Z.updateRenderTargetMipmap(_)),!0===e.isScene&&e.onAfterRender(v,e,t),ge.resetDefaultState(),I=-1,x=null,m.pop(),m.length>0?(f=m[m.length-1],!0===O&&le.setGlobalState(v.clippingPlanes,f.state.camera)):f=null,g.pop(),p=g.length>0?g[g.length-1]:null},this.renderCubeMapNormals=function(e){const t=function(e){const t=new Set;return e.traverse(e=>{e.isMesh&&e.geometry&&e.material&&e.material.isMeshDiamondMaterial&&t.add(e.geometry)}),t}(e);if(0===t.size)return;const n=new Xs;n.side=2;const i=new Ks;for(const e of t)if(!e.cubeMapNormalTarget){const t=new Kr(512,{type:j.has("EXT_color_buffer_half_float")||j.has("EXT_color_buffer_float")?$e:Xe,magFilter:ze,minFilter:ze});e.cubeMapNormalTarget=t;const r=new Yr(1e-4,100,t),a=new Lr(e);a.material=n,a.computeOffsets(),i.add(a),i.add(r),r.update(this,i),i.remove(a),i.remove(r),a.geometry=null,a.material=null}},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return _},this.setRenderTargetTextures=function(e,t,n){J.get(e.texture).__webglTexture=t,J.get(e.depthTexture).__webglTexture=n;const i=J.get(e);i.__hasExternalTextures=!0,i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===j.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(e,t){const n=J.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){_=e,b=t,C=n;let i=!0,r=null,a=!1,o=!1;if(e){const s=J.get(e);void 0!==s.__useDefaultFramebuffer?(X.bindFramebuffer(ve.FRAMEBUFFER,null),i=!1):void 0===s.__webglFramebuffer?Z.setupRenderTarget(e):s.__hasExternalTextures&&Z.rebindTextures(e,J.get(e.texture).__webglTexture,J.get(e.depthTexture).__webglTexture);const l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(o=!0);const c=J.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(c[t])?c[t][n]:c[t],a=!0):r=e.samples>0&&!1===Z.useMultisampledRTT(e)?J.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,y.copy(e.viewport),M.copy(e.scissor),w=e.scissorTest}else y.copy(U).multiplyScalar(D).floor(),M.copy(P).multiplyScalar(D).floor(),w=N;if(X.bindFramebuffer(ve.FRAMEBUFFER,r)&&i&&X.drawBuffers(e,r),X.viewport(y),X.scissor(M),X.setScissorTest(w),a){const i=J.get(e.texture);ve.framebufferTexture2D(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,ve.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(o){const i=J.get(e.texture),r=t||0;ve.framebufferTextureLayer(ve.FRAMEBUFFER,ve.COLOR_ATTACHMENT0,i.__webglTexture,n||0,r)}I=-1},this.readRenderTargetPixels=function(e,t,n,i,r,a,o){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let s=J.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){X.bindFramebuffer(ve.FRAMEBUFFER,s);try{const o=e.texture,s=o.format,l=o.type;if(!Y.textureFormatReadable(s))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!Y.textureTypeReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&ve.readPixels(t,n,i,r,fe.convert(s),fe.convert(l),a)}finally{const e=null!==_?J.get(_).__webglFramebuffer:null;X.bindFramebuffer(ve.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,i,r,a,o){if(!e||!e.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let s=J.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){X.bindFramebuffer(ve.FRAMEBUFFER,s);try{const o=e.texture,s=o.format,l=o.type;if(!Y.textureFormatReadable(s))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Y.textureTypeReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r){const e=ve.createBuffer();ve.bindBuffer(ve.PIXEL_PACK_BUFFER,e),ve.bufferData(ve.PIXEL_PACK_BUFFER,a.byteLength,ve.STREAM_READ),ve.readPixels(t,n,i,r,fe.convert(s),fe.convert(l),0),ve.flush();const o=ve.fenceSync(ve.SYNC_GPU_COMMANDS_COMPLETE,0);await function(e,t){return new Promise(function(n,i){setTimeout(function r(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(r,4);break;default:n()}},4)})}(ve,o);try{ve.bindBuffer(ve.PIXEL_PACK_BUFFER,e),ve.getBufferSubData(ve.PIXEL_PACK_BUFFER,0,a)}finally{ve.deleteBuffer(e),ve.deleteSync(o)}return a}}finally{const e=null!==_?J.get(_).__webglFramebuffer:null;X.bindFramebuffer(ve.FRAMEBUFFER,e)}}},this.copyFramebufferToTexture=function(e,t=null,n=0){!0!==e.isTexture&&(console.warn("WebGLRenderer: copyFramebufferToTexture function signature has changed."),t=arguments[0]||null,e=arguments[1]);const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),a=Math.floor(e.image.height*i),o=null!==t?t.x:0,s=null!==t?t.y:0;Z.setTexture2D(e,0),ve.copyTexSubImage2D(ve.TEXTURE_2D,n,0,0,o,s,r,a),X.unbindTexture()},this.copyTextureToTexture=function(e,t,n=null,i=null,r=0){let a,o,s,l,c,h;!0!==e.isTexture&&(console.warn("WebGLRenderer: copyTextureToTexture function signature has changed."),i=arguments[0]||null,e=arguments[1],t=arguments[2],r=arguments[3]||0,n=null),null!==n?(a=n.max.x-n.min.x,o=n.max.y-n.min.y,s=n.min.x,l=n.min.y):(a=e.image.width,o=e.image.height,s=0,l=0),null!==i?(c=i.x,h=i.y):(c=0,h=0);const A=fe.convert(t.format),u=fe.convert(t.type);Z.setTexture2D(t,0),ve.pixelStorei(ve.UNPACK_FLIP_Y_WEBGL,t.flipY),ve.pixelStorei(ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),ve.pixelStorei(ve.UNPACK_ALIGNMENT,t.unpackAlignment);const d=ve.getParameter(ve.UNPACK_ROW_LENGTH),p=ve.getParameter(ve.UNPACK_IMAGE_HEIGHT),f=ve.getParameter(ve.UNPACK_SKIP_PIXELS),g=ve.getParameter(ve.UNPACK_SKIP_ROWS),m=ve.getParameter(ve.UNPACK_SKIP_IMAGES),v=e.isCompressedTexture?e.mipmaps[r]:e.image;ve.pixelStorei(ve.UNPACK_ROW_LENGTH,v.width),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,v.height),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,s),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,l),e.isDataTexture?ve.texSubImage2D(ve.TEXTURE_2D,r,c,h,a,o,A,u,v.data):e.isCompressedTexture?ve.compressedTexSubImage2D(ve.TEXTURE_2D,r,c,h,v.width,v.height,A,v.data):ve.texSubImage2D(ve.TEXTURE_2D,r,c,h,A,u,v),ve.pixelStorei(ve.UNPACK_ROW_LENGTH,d),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,p),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,f),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,g),ve.pixelStorei(ve.UNPACK_SKIP_IMAGES,m),0===r&&t.generateMipmaps&&ve.generateMipmap(ve.TEXTURE_2D),X.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n=null,i=null,r=0){let a,o,s,l,c,h,A,u,d;!0!==e.isTexture&&(console.warn("WebGLRenderer: copyTextureToTexture3D function signature has changed."),n=arguments[0]||null,i=arguments[1]||null,e=arguments[2],t=arguments[3],r=arguments[4]||0);const p=e.isCompressedTexture?e.mipmaps[r]:e.image;null!==n?(a=n.max.x-n.min.x,o=n.max.y-n.min.y,s=n.max.z-n.min.z,l=n.min.x,c=n.min.y,h=n.min.z):(a=p.width,o=p.height,s=p.depth,l=0,c=0,h=0),null!==i?(A=i.x,u=i.y,d=i.z):(A=0,u=0,d=0);const f=fe.convert(t.format),g=fe.convert(t.type);let m;if(t.isData3DTexture)Z.setTexture3D(t,0),m=ve.TEXTURE_3D;else{if(!t.isDataArrayTexture&&!t.isCompressedArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Z.setTexture2DArray(t,0),m=ve.TEXTURE_2D_ARRAY}ve.pixelStorei(ve.UNPACK_FLIP_Y_WEBGL,t.flipY),ve.pixelStorei(ve.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),ve.pixelStorei(ve.UNPACK_ALIGNMENT,t.unpackAlignment);const v=ve.getParameter(ve.UNPACK_ROW_LENGTH),E=ve.getParameter(ve.UNPACK_IMAGE_HEIGHT),b=ve.getParameter(ve.UNPACK_SKIP_PIXELS),C=ve.getParameter(ve.UNPACK_SKIP_ROWS),_=ve.getParameter(ve.UNPACK_SKIP_IMAGES);ve.pixelStorei(ve.UNPACK_ROW_LENGTH,p.width),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,p.height),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,l),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,c),ve.pixelStorei(ve.UNPACK_SKIP_IMAGES,h),e.isDataTexture||e.isData3DTexture?ve.texSubImage3D(m,r,A,u,d,a,o,s,f,g,p.data):t.isCompressedArrayTexture?ve.compressedTexSubImage3D(m,r,A,u,d,a,o,s,f,p.data):ve.texSubImage3D(m,r,A,u,d,a,o,s,f,g,p),ve.pixelStorei(ve.UNPACK_ROW_LENGTH,v),ve.pixelStorei(ve.UNPACK_IMAGE_HEIGHT,E),ve.pixelStorei(ve.UNPACK_SKIP_PIXELS,b),ve.pixelStorei(ve.UNPACK_SKIP_ROWS,C),ve.pixelStorei(ve.UNPACK_SKIP_IMAGES,_),0===r&&t.generateMipmaps&&ve.generateMipmap(m),X.unbindTexture()},this.initRenderTarget=function(e){void 0===J.get(e).__webglFramebuffer&&Z.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?Z.setTextureCube(e,0):e.isData3DTexture?Z.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?Z.setTexture2DArray(e,0):Z.setTexture2D(e,0),X.unbindTexture()},this.resetState=function(){b=0,C=0,_=null,X.reset(),ge.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Gt}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===xt?"display-p3":"srgb",t.unpackColorSpace=fn.workingColorSpace===yt?"display-p3":"srgb"}}class Zs{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=Ot,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=jt()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return hn("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}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,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];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=jt()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}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=jt()),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}}}const $s=new Rn;class el{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}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,n=this.data.count;t<n;t++)$s.fromBufferAttribute(this,t),$s.applyMatrix4(e),this.setXYZ(t,$s.x,$s.y,$s.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)$s.fromBufferAttribute(this,t),$s.applyNormalMatrix(e),this.setXYZ(t,$s.x,$s.y,$s.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)$s.fromBufferAttribute(this,t),$s.transformDirection(e),this.setXYZ(t,$s.x,$s.y,$s.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Jt(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Zt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Zt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Zt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Zt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Zt(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=Jt(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Jt(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Jt(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Jt(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zt(t,this.array),n=Zt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zt(t,this.array),n=Zt(n,this.array),i=Zt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zt(t,this.array),n=Zt(n,this.array),i=Zt(i,this.array),r=Zt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new ar(new this.array.constructor(e),this.itemSize,this.normalized)}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new el(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}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}}}const tl=new Rn,nl=new yn,il=new yn,rl=new Rn,al=new si,ol=new Rn,sl=new Zn,ll=new si,cl=new oi;class hl extends Lr{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Ue,this.bindMatrix=new si,this.bindMatrixInverse=new si,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;null===this.boundingBox&&(this.boundingBox=new Ln),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,ol),this.boundingBox.expandByPoint(ol)}computeBoundingSphere(){const e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new Zn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,ol),this.boundingSphere.expandByPoint(ol)}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){const n=this.material,i=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),sl.copy(this.boundingSphere),sl.applyMatrix4(i),!1!==e.ray.intersectsSphere(sl)&&(ll.copy(i).invert(),cl.copy(e.ray).applyMatrix4(ll),null!==this.boundingBox&&!1===cl.intersectsBox(this.boundingBox)||this._computeIntersections(e,t,cl)))}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(){const e=new yn,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Ue?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;nl.fromBufferAttribute(i.attributes.skinIndex,e),il.fromBufferAttribute(i.attributes.skinWeight,e),tl.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){const i=il.getComponent(e);if(0!==i){const r=nl.getComponent(e);al.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),t.addScaledVector(rl.copy(tl).applyMatrix4(al),i)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Al extends Li{constructor(){super(),this.isBone=!0,this.type="Bone"}}class ul extends xn{constructor(e=null,t=1,n=1,i,r,a,o,s,l=1003,c=1003,h,A){super(null,a,o,s,l,c,i,r,h,A),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const dl=new si,pl=new si;class fl{constructor(e=[],t=[]){this.uuid=jt(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const 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){console.warn("THREE.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 si)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const t=new si;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++){const t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const 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(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let i=0,r=e.length;i<r;i++){const r=e[i]?e[i].matrixWorld:pl;dl.multiplyMatrices(r,t[i]),dl.toArray(n,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new fl(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length);e=4*Math.ceil(e/4),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new ul(t,e,e,tt,Ze);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const n=this.bones[t];if(n.name===e)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const i=e.bones[n];let r=t[i];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),r=new Al),this.bones.push(r),this.boneInverses.push((new si).fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const r=t[i];e.bones.push(r.uuid);const a=n[i];e.boneInverses.push(a.toArray())}return e}}class gl extends ar{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const ml=new si,vl=new si,El=[],bl=new Ln,Cl=new si,_l=new Lr,Il=new Zn;class xl extends Lr{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new gl(new Float32Array(16*n),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<n;e++)this.setMatrixAt(e,Cl)}computeBoundingBox(){const e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new Ln),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ml),bl.copy(e.boundingBox).applyMatrix4(ml),this.boundingBox.union(bl)}computeBoundingSphere(){const e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new Zn),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,ml),Il.copy(e.boundingSphere).applyMatrix4(ml),this.boundingSphere.union(Il)}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){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=e*(n.length+1)+1;for(let e=0;e<n.length;e++)n[e]=i[r+e]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(_l.geometry=this.geometry,_l.material=this.material,void 0!==_l.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),Il.copy(this.boundingSphere),Il.applyMatrix4(n),!1!==e.ray.intersectsSphere(Il)))for(let r=0;r<i;r++){this.getMatrixAt(r,ml),vl.multiplyMatrices(n,ml),_l.matrixWorld=vl,_l.raycast(e,El);for(let e=0,n=El.length;e<n;e++){const n=El[e];n.instanceId=r,n.object=this,t.push(n)}El.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new gl(new Float32Array(3*this.instanceMatrix.count),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;null===this.morphTexture&&(this.morphTexture=new ul(new Float32Array(i*this.count),i,this.count,rt,Ze));const r=this.morphTexture.source.data.data;let a=0;for(let e=0;e<n.length;e++)a+=n[e];const o=this.geometry.morphTargetsRelative?1:1-a,s=i*e;r[s]=o,r.set(n,s+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null),this}}const yl=new Rn,Ml=new Rn,wl=new si,Sl=new oi,Bl=new Zn,Tl=new Rn,Rl=new Rn;class Dl extends Li{constructor(e=new gr,t=new js){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,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(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[0];for(let e=1,i=t.count;e<i;e++)yl.fromBufferAttribute(t,e-1),Ml.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=yl.distanceTo(Ml);e.setAttribute("lineDistance",new lr(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Bl.copy(n.boundingSphere),Bl.applyMatrix4(i),Bl.radius+=r,!1===e.ray.intersectsSphere(Bl))return;wl.copy(i).invert(),Sl.copy(e.ray).applyMatrix4(wl);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=this.isLineSegments?2:1,c=n.index,h=n.attributes.position;if(null!==c){const n=Math.max(0,a.start),i=Math.min(c.count,a.start+a.count);for(let r=n,a=i-1;r<a;r+=l){const n=c.getX(r),i=c.getX(r+1),a=Ql(this,e,Sl,s,n,i);a&&t.push(a)}if(this.isLineLoop){const r=c.getX(i-1),a=c.getX(n),o=Ql(this,e,Sl,s,r,a);o&&t.push(o)}}else{const n=Math.max(0,a.start),i=Math.min(h.count,a.start+a.count);for(let r=n,a=i-1;r<a;r+=l){const n=Ql(this,e,Sl,s,r,r+1);n&&t.push(n)}if(this.isLineLoop){const r=Ql(this,e,Sl,s,i-1,n);r&&t.push(r)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function Ql(e,t,n,i,r,a){const o=e.geometry.attributes.position;if(yl.fromBufferAttribute(o,r),Ml.fromBufferAttribute(o,a),n.distanceSqToSegment(yl,Ml,Tl,Rl)>i)return;Tl.applyMatrix4(e.matrixWorld);const s=t.ray.origin.distanceTo(Tl);return s<t.near||s>t.far?void 0:{distance:s,point:Rl.clone().applyMatrix4(e.matrixWorld),index:r,face:null,faceIndex:null,object:e}}const Ll=new Rn,Ul=new Rn;class Pl extends Dl{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e<i;e+=2)Ll.fromBufferAttribute(t,e),Ul.fromBufferAttribute(t,e+1),n[e]=0===e?0:n[e-1],n[e+1]=n[e]+Ll.distanceTo(Ul);e.setAttribute("lineDistance",new lr(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Nl extends Dl{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}const Fl=new si,Ol=new oi,kl=new Zn,Gl=new Rn;class Hl extends Li{constructor(e=new gr,t=new Vs){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,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){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),kl.copy(n.boundingSphere),kl.applyMatrix4(i),kl.radius+=r,!1===e.ray.intersectsSphere(kl))return;Fl.copy(i).invert(),Ol.copy(e.ray).applyMatrix4(Fl);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=n.index,c=n.attributes.position;if(null!==l)for(let n=Math.max(0,a.start),r=Math.min(l.count,a.start+a.count);n<r;n++){const r=l.getX(n);Gl.fromBufferAttribute(c,r),zl(Gl,r,s,i,e,t,this)}else for(let n=Math.max(0,a.start),r=Math.min(c.count,a.start+a.count);n<r;n++)Gl.fromBufferAttribute(c,n),zl(Gl,n,s,i,e,t,this)}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function zl(e,t,n,i,r,a,o){const s=Ol.distanceSqToPoint(e);if(s<n){const n=new Rn;Ol.closestPointToPoint(e,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,object:o})}}class Vl extends xn{constructor(e,t,n,i,r,a,o,s,l,c,h,A){super(null,a,o,s,l,c,i,r,h,A),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Wl extends Vl{constructor(e,t,n,i,r,a){super(e,t,n,r,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Ge,this.layerUpdates=new Set}addLayerUpdates(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class ql extends Vl{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Pe),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}function jl(e,t,n){return e&&e.constructor!==t?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function Yl(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort(function(t,n){return e[t]-e[n]}),n}function Xl(e,t,n){const i=e.length,r=new e.constructor(i);for(let a=0,o=0;o!==i;++a){const i=n[a]*t;for(let n=0;n!==t;++n)r[o++]=e[i+n]}return r}function Kl(e,t,n,i){let r=1,a=e[0];for(;void 0!==a&&void 0===a[i];)a=e[r++];if(void 0===a)return;let o=a[i];if(void 0!==o)if(Array.isArray(o))do{o=a[i],void 0!==o&&(t.push(a.time),n.push.apply(n,o)),a=e[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{o=a[i],void 0!==o&&(t.push(a.time),o.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{o=a[i],void 0!==o&&(t.push(a.time),n.push(o)),a=e[r++]}while(void 0!==a)}class Jl{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let a=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(r=i,i=t[++n],e<i)break t}a=t.length;break n}if(e>=r)break e;{const o=t[1];e<o&&(n=2,r=o);for(let a=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(i=r,r=t[--n-1],e>=r)break t}a=n,n=0}}for(;n<a;){const i=n+a>>>1;e<t[i]?a=i:n=i+1}if(i=t[n],r=t[n-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let e=0;e!==i;++e)t[e]=n[r+e];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Zl extends Jl{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,a=e+1,o=i[r],s=i[a];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:r=e,o=2*t-n;break;case 2402:r=i.length-2,o=t+i[r]-i[r+1];break;default:r=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:a=e,s=2*n-t;break;case 2402:a=1,s=n+i[1]-i[0];break;default:a=e-1,s=t}const l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(s-n),this._offsetPrev=r*c,this._offsetNext=a*c}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=this._offsetPrev,h=this._offsetNext,A=this._weightPrev,u=this._weightNext,d=(n-t)/(i-t),p=d*d,f=p*d,g=-A*f+2*A*p-A*d,m=(1+A)*f+(-1.5-2*A)*p+(-.5+A)*d+1,v=(-1-u)*f+(1.5+u)*p+.5*d,E=u*f-u*p;for(let e=0;e!==o;++e)r[e]=g*a[c+e]+m*a[l+e]+v*a[s+e]+E*a[h+e];return r}}class $l extends Jl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=(n-t)/(i-t),h=1-c;for(let e=0;e!==o;++e)r[e]=a[l+e]*h+a[s+e]*c;return r}}class ec extends Jl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class tc{constructor(e,t,n,i){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=jl(t,this.TimeBufferType),this.values=jl(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:jl(e.times,Array),values:jl(e.values,Array)};const t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new ec(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new $l(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Zl(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case vt:t=this.InterpolantFactoryMethodDiscrete;break;case Et:t=this.InterpolantFactoryMethodLinear;break;case bt:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){const t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(t);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return vt;case this.InterpolantFactoryMethodLinear:return Et;case this.InterpolantFactoryMethodSmooth:return bt}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(1!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,a=i-1;for(;r!==i&&n[r]<e;)++r;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==r||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);const e=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*e,a*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let t=0;t!==r;t++){const i=n[t];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==a&&a>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,i,a),e=!1;break}a=i}if(void 0!==i&&(o=i,ArrayBuffer.isView(o)&&!(o instanceof DataView)))for(let t=0,n=i.length;t!==n;++t){const n=i[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}var o;return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===bt,r=e.length-1;let a=1;for(let o=1;o<r;++o){let r=!1;const s=e[o];if(s!==e[o+1]&&(1!==o||s!==e[0]))if(i)r=!0;else{const e=o*n,i=e-n,a=e+n;for(let o=0;o!==n;++o){const n=t[e+o];if(n!==t[i+o]||n!==t[a+o]){r=!0;break}}}if(r){if(o!==a){e[a]=e[o];const i=o*n,r=a*n;for(let e=0;e!==n;++e)t[r+e]=t[i+e]}++a}}if(r>0){e[a]=e[r];for(let e=r*n,i=a*n,o=0;o!==n;++o)t[i+o]=t[e+o];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=new this.constructor(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}tc.prototype.TimeBufferType=Float32Array,tc.prototype.ValueBufferType=Float32Array,tc.prototype.DefaultInterpolation=Et;class nc extends tc{constructor(e,t,n){super(e,t,n)}}nc.prototype.ValueTypeName="bool",nc.prototype.ValueBufferType=Array,nc.prototype.DefaultInterpolation=vt,nc.prototype.InterpolantFactoryMethodLinear=void 0,nc.prototype.InterpolantFactoryMethodSmooth=void 0;class ic extends tc{}ic.prototype.ValueTypeName="color";class rc extends tc{}rc.prototype.ValueTypeName="number";class ac extends Jl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(i-t);let l=e*o;for(let e=l+o;l!==e;l+=4)Tn.slerpFlat(r,0,a,l-o,a,l,s);return r}}class oc extends tc{InterpolantFactoryMethodLinear(e){return new ac(this.times,this.values,this.getValueSize(),e)}}oc.prototype.ValueTypeName="quaternion",oc.prototype.InterpolantFactoryMethodSmooth=void 0;class sc extends tc{constructor(e,t,n){super(e,t,n)}}sc.prototype.ValueTypeName="string",sc.prototype.ValueBufferType=Array,sc.prototype.DefaultInterpolation=vt,sc.prototype.InterpolantFactoryMethodLinear=void 0,sc.prototype.InterpolantFactoryMethodSmooth=void 0;class lc extends tc{}lc.prototype.ValueTypeName="vector";class cc{constructor(e="",t=-1,n=[],i=2500){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=jt(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let e=0,r=n.length;e!==r;++e)t.push(hc(n[e]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,i=n.length;e!==i;++e)t.push(tc.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,a=[];for(let e=0;e<r;e++){let o=[],s=[];o.push((e+r-1)%r,e,(e+1)%r),s.push(0,1,0);const l=Yl(o);o=Xl(o,1,l),s=Xl(s,1,l),i||0!==o[0]||(o.push(r),s.push(s[0])),a.push(new rc(".morphTargetInfluences["+t[e].name+"]",o,s).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const t=e;n=t.geometry&&t.geometry.animations||t.animations}for(let e=0;e<n.length;e++)if(n[e].name===t)return n[e];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let t=0,n=e.length;t<n;t++){const n=e[t],a=n.name.match(r);if(a&&a.length>1){const e=a[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const a=[];for(const e in i)a.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,r){if(0!==n.length){const a=[],o=[];Kl(n,a,o,i),0!==a.length&&r.push(new e(t,a,o))}},i=[],r=e.name||"default",a=e.fps||30,o=e.blendMode;let s=e.length||-1;const l=e.hierarchy||[];for(let e=0;e<l.length;e++){const r=l[e].keys;if(r&&0!==r.length)if(r[0].morphTargets){const e={};let t;for(t=0;t<r.length;t++)if(r[t].morphTargets)for(let n=0;n<r[t].morphTargets.length;n++)e[r[t].morphTargets[n]]=-1;for(const n in e){const e=[],a=[];for(let i=0;i!==r[t].morphTargets.length;++i){const i=r[t];e.push(i.time),a.push(i.morphTarget===n?1:0)}i.push(new rc(".morphTargetInfluence["+n+"]",e,a))}s=e.length*a}else{const a=".bones["+t[e].name+"]";n(lc,a+".position",r,"pos",i),n(oc,a+".quaternion",r,"rot",i),n(lc,a+".scale",r,"scl",i)}}return 0===i.length?null:new this(r,s,i,o)}resetDuration(){let e=0;for(let t=0,n=this.tracks.length;t!==n;++t){const n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}return this.duration=e,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(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function hc(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return rc;case"vector":case"vector2":case"vector3":case"vector4":return lc;case"color":return ic;case"quaternion":return oc;case"bool":case"boolean":return nc;case"string":return sc}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){const t=[],n=[];Kl(e.keys,t,n,"value"),e.times=t,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}const Ac={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={}}};const uc=new class{constructor(e,t,n){const i=this;let r,a=!1,o=0,s=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){s++,!1===a&&void 0!==i.onStart&&i.onStart(e,o,s),a=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,s),o===s&&(a=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.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){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;t<n;t+=2){const n=l[t],i=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return i}return null}}};class dc{constructor(e){this.manager=void 0!==e?e:uc,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}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}}dc.DEFAULT_MATERIAL_NAME="__DEFAULT";const pc={};class fc extends Error{constructor(e,t){super(e),this.response=t}}class gc extends dc{constructor(e){super(e)}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=Ac.get(e);if(void 0!==r)return this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0),r;if(void 0!==pc[e])return void pc[e].push({onLoad:t,onProgress:n,onError:i});pc[e]=[],pc[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,s=this.responseType;fetch(a).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const n=pc[e],i=t.body.getReader(),r=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),a=r?parseInt(r):0,o=0!==a;let s=0;const l=new ReadableStream({start(e){!function t(){i.read().then(({done:i,value:r})=>{if(i)e.close();else{s+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:o,loaded:s,total:a});for(let e=0,t=n.length;e<t;e++){const t=n[e];t.onProgress&&t.onProgress(i)}e.enqueue(r),t()}},t=>{e.error(t)})}()}});return new Response(l)}throw new fc(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(s){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>(new DOMParser).parseFromString(e,o));case"json":return e.json();default:if(void 0===o)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then(e=>i.decode(e))}}}).then(t=>{Ac.add(e,t);const n=pc[e];delete pc[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onLoad&&i.onLoad(t)}}).catch(t=>{const n=pc[e];if(void 0===n)throw this.manager.itemError(e),t;delete pc[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onError&&i.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}}class mc extends dc{constructor(e){super(e)}load(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=Ac.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;const o=sn("img");function s(){c(),Ac.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){c(),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}function c(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o}}class vc extends dc{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new ul,o=new gc(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(e,function(e){let n;try{n=r.parse(e)}catch(e){if(void 0===i)return void console.error(e);i(e)}void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:Ge,a.wrapT=void 0!==n.wrapT?n.wrapT:Ge,a.magFilter=void 0!==n.magFilter?n.magFilter:qe,a.minFilter=void 0!==n.minFilter?n.minFilter:qe,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace&&(a.colorSpace=n.colorSpace),void 0!==n.flipY&&(a.flipY=n.flipY),void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=Ye),1===n.mipmapCount&&(a.minFilter=qe),void 0!==n.generateMipmaps&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n)},n,i),a}}class Ec extends dc{constructor(e){super(e)}load(e,t,n,i){const r=new xn,a=new mc(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){r.image=e,r.needsUpdate=!0,void 0!==t&&t(r)},n,i),r}}class bc extends Li{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ki(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}const Cc=new si,_c=new Rn,Ic=new Rn;class xc{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new nn(512,512),this.map=null,this.mapPass=null,this.matrix=new si,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ia,this._frameExtents=new nn(1,1),this._viewportCount=1,this._viewports=[new yn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;_c.setFromMatrixPosition(e.matrixWorld),t.position.copy(_c),Ic.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Ic),t.updateMatrixWorld(),Cc.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Cc),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Cc)}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.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const 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 yc extends xc{constructor(){super(new qr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=2*qt*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Mc extends bc{constructor(e,t,n=0,i=Math.PI/3,r=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Li.DEFAULT_UP),this.updateMatrix(),this.target=new Li,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new yc}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}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.shadow=e.shadow.clone(),this}}const wc=new si,Sc=new Rn,Bc=new Rn;class Tc extends xc{constructor(){super(new qr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new nn(4,2),this._viewportCount=6,this._viewports=[new yn(2,1,1,1),new yn(0,1,1,1),new yn(3,1,1,1),new yn(1,1,1,1),new yn(3,0,1,1),new yn(1,0,1,1)],this._cubeDirections=[new Rn(1,0,0),new Rn(-1,0,0),new Rn(0,0,1),new Rn(0,0,-1),new Rn(0,1,0),new Rn(0,-1,0)],this._cubeUps=[new Rn(0,1,0),new Rn(0,1,0),new Rn(0,1,0),new Rn(0,1,0),new Rn(0,0,1),new Rn(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Sc.setFromMatrixPosition(e.matrixWorld),n.position.copy(Sc),Bc.copy(n.position),Bc.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Bc),n.updateMatrixWorld(),i.makeTranslation(-Sc.x,-Sc.y,-Sc.z),wc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(wc)}}class Rc extends bc{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Tc}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}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}}class Dc extends xc{constructor(){super(new Ea(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Qc extends bc{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Li.DEFAULT_UP),this.updateMatrix(),this.target=new Li,this.shadow=new Dc}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Lc{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}static extractUrlBase(e){const 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)}}class Uc extends dc{constructor(e){super(e),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=Ac.get(e);if(void 0!==a)return r.manager.itemStart(e),a.then?void a.then(n=>{t&&t(n),r.manager.itemEnd(e)}).catch(e=>{i&&i(e)}):(setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a);const o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader;const s=fetch(e,o).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(n){return Ac.add(e,n),t&&t(n),r.manager.itemEnd(e),n}).catch(function(t){i&&i(t),Ac.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)});Ac.add(e,s),r.manager.itemStart(e)}}class Pc{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Nc(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=Nc();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Nc(){return("undefined"==typeof performance?Date:performance).now()}const Fc="\\[\\]\\.:\\/",Oc=new RegExp("["+Fc+"]","g"),kc="[^"+Fc+"]",Gc="[^"+Fc.replace("\\.","")+"]",Hc=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",kc)+/(WCOD+)?/.source.replace("WCOD",Gc)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",kc)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",kc)+"$"),zc=["material","materials","bones","map"];class Vc{constructor(e,t,n){this.path=t,this.parsedPath=n||Vc.parseTrackName(t),this.node=Vc.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Vc.Composite(e,t,n):new Vc(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Oc,"")}static parseTrackName(e){const t=Hc.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==zc.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let i=0;i<e.length;i++){const r=e[i];if(r.name===t||r.uuid===t)return r;const a=n(r.children);if(a)return a}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_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){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=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;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=Vc.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(n){let i=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.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 console.error("THREE.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===i){i=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void console.error("THREE.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[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==i){if(void 0===e[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[i]}}const a=e[i];if(void 0===a){const n=t.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",e)}let o=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?o=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(o=this.Versioning.MatrixWorldNeedsUpdate);let s=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}s=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else void 0!==a.fromArray&&void 0!==a.toArray?(s=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(s=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[s],this.setValue=this.SetterByBindingTypeAndVersioning[s][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Vc.Composite=class{constructor(e,t,n){const i=n||Vc.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},Vc.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Vc.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Vc.prototype.GetterByBindingType=[Vc.prototype._getValue_direct,Vc.prototype._getValue_array,Vc.prototype._getValue_arrayElement,Vc.prototype._getValue_toArray],Vc.prototype.SetterByBindingTypeAndVersioning=[[Vc.prototype._setValue_direct,Vc.prototype._setValue_direct_setNeedsUpdate,Vc.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Vc.prototype._setValue_array,Vc.prototype._setValue_array_setNeedsUpdate,Vc.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Vc.prototype._setValue_arrayElement,Vc.prototype._setValue_arrayElement_setNeedsUpdate,Vc.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Vc.prototype._setValue_fromArray,Vc.prototype._setValue_fromArray_setNeedsUpdate,Vc.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Wc{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){const e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Yt(t/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:de}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=de);const qc=["Glasses","Shoes","Watches","Handbags","Rings","Bottles","Bracelets","Scarves","Hats","Necklaces","Earrings"],jc=["Linear","ACES","Neutral"],Yc=["none","pan-x","pan-y"];function Xc(e){return qc.includes(e)}const Kc={Glasses:new Rn(67.5,15,90),Shoes:new Rn(-55,30,30),Watches:new Rn(0,-10,40),Handbags:new Rn(40,0,0),Rings:new Rn(0,0,10),Bottles:new Rn(40,0,0),Bracelets:new Rn(0,0,40),Hats:new Rn(40,0,0),Scarves:new Rn(40,0,0),Necklaces:new Rn(40,0,0),Earrings:new Rn(40,0,0)},Jc="Shoes",Zc=[1e3,2e3,4e3],$c=Zc.length;function eh(e){return G(this,arguments,void 0,function*(e,t=0){try{return yield e()}catch(n){if(t>=$c)throw n;return yield new Promise(e=>setTimeout(e,Zc[t])),eh(e,t+1)}})}function th(e){return`Resource unavailable: ${e}`}function nh(){return th("Network error.")}function ih(){return th("Request aborted.")}function rh(){return th("Request timeout.")}function ah(e){return`Resource download failed with status ${e}.`}function oh(e){return`Resource has invalid body: ${e}`}function sh(){return oh("Response is null.")}function lh(){return oh("Response is not an ArrayBuffer.")}function ch(){return oh("Response is empty.")}function hh(e,t){return G(this,void 0,void 0,function*(){return eh(()=>G(this,void 0,void 0,function*(){return new Promise((n,i)=>{const r=new XMLHttpRequest;r.open("GET",e),r.responseType="arraybuffer",r.onprogress=n=>{const i=function(e,t){var n;if(e.lengthComputable&&e.total>0)return e.total;const i=parseInt(null!==(n=t.getResponseHeader("x-amz-meta-content-length"))&&void 0!==n?n:"",10);return i>0?i:null}(n,r);null!=i&&(null==t||t.updateProgress(e,n.loaded,i))},r.onload=()=>{r.status<200||r.status>=300?i(new Error(ah(r.status))):r.response?r.response instanceof ArrayBuffer?0!==r.response.byteLength?n(r.response):i(new Error(ch())):i(new Error(lh())):i(new Error(sh()))},r.onerror=()=>i(new Error(nh())),r.onabort=()=>i(new Error(ih())),r.ontimeout=()=>i(new Error(rh())),r.send()})}))})}const Ah=[Uint8Array,Uint32Array],uh=Ah.length-2,dh=["addEventListener","alert","atob","blur","btoa","cancelAnimationFrame","localStorage","location","locationbar","hash","hasOwnProperty","host","hostname","href","open","requestAnimationFrame","send"],ph=[2,12,7,1],fh=(window[dh[ph[ph[uh]]]][dh[ph[ph[ph.length-1]]]].charCodeAt(uh),0),gh=new Ah[1]([fh]);function mh(e,t,n,i){return G(this,void 0,void 0,function*(){let r=dh[15].charCodeAt(2)-10,a=dh[5].charCodeAt(6)-14;r>>=1,r+=a;const o=String.fromCharCode,s=o(r-26);a>>=2,r-=a;const l=o(r-18);a|=9,r^=a;const c=`${s}${l}`,h=o(++r);a>>=1,r^=a+2;const A=o(r-3);r^=a+29;const u="object"[(+!+[]+ +!+[])*(+!+[]+ +!+[])+r^114],d=`${h}${A}`,p=o(r-2);a<<=3,r|=a;const f=o(r-3);a^=r+9;const g=o(r+c.length),m="object"[3*+!+[]],v=`${m}${p}${g}`,E=o(a+6),b=`${u}${u}${f}${E}`,C=o(r),_=`${m}${C}${u}`;a>>=1,r-=a;const I=o(r-6);a-=7,r^=a;const x=`${I}${o(r-13)}`,y=o(r+x.length);r+=a;const M=o(r+1),w="object"[+!+[]-+!+[]];a++;const S=o(r-(a>>3)+1),B=`${w}${S}`,T=`${M}${m}${C}${f}`;a-=T.length,r+=a>>2;const R=o(r+1),D=`${y}${R}${f}`;a>>=1,r-=a;const Q=o(r-T.length),L=`${g}${Q}${Q}${m}${M}`;a-=L.length,r-=a;const U=o(r+1),P=o(r),N=`${P}${u}`;a+=r>>2,r-=a;const F=o(r+2),O=o(r+1),k=`${M}${P}${R}`,H=`${m}${M}${M}`,z=`${w}${g}${u}`;r^=a+L.length;const V=o(r+3),W=r-2<<1,q=(a<<3)+(36&r),j=yield eh(()=>G(this,void 0,void 0,function*(){return new Promise((t,n)=>{const r=new window[`${d}${c}${b}${v}${_}`];r[dh[14]](`${x}${y}`,e),r[`${T}${B}${C}${m}${D}${m}`]=`${P}${M}${k}${U}${L}`,r[`${B}${f}${M}${w}g${M}${m}${C}${C}`]=t=>{const n=t[`${u}${w}${u}${P}l`];t[`l${m}${S}g${u}hC${w}m${f}${g}${u}${P}${U}l${m}`]&&n>0&&(null==i||i[`${g}${f}d${N}${m}P${M}${w}g${M}${m}s${C}`](e,t[`l${w}${P}d${m}d`],n))},r[`${B}l${w}${P}d`]=()=>{const e=r[`${C}${u}${N}${g}${C}`];if(e<W||e>=q)return void n(new Error(ah(e)));const i=r[`${T}${B}${C}${m}`];i?i instanceof window[`${O}${M}${k}${F}${L}`]?0!==i[`${U}${R}${u}${m}${s}${m}${S}g${u}h`]?t(new Ah[0](i)):n(new Error(ch())):n(new Error(lh())):n(new Error(sh()))},r[`${B}${H}${w}${M}`]=()=>n(new Error(nh())),r[`${B}${P}${U}${w}${M}${u}`]=()=>n(new Error(ih())),r[`${B}${u}${V}m${m}${z}`]=()=>n(new Error(rh())),r[dh[16]]()})}));n+=a;const Y=j[`${U}${R}${u}${m}${s}${m}${S}g${u}h`];if(gh[fh]=Math.min(76,t)*((r>>5)-1),152===gh[fh]&&(gh[fh]=Y),n==fh)return j;n=fh,n^=fh;for(let e=0,t=j.length;e<t;e++)gh[fh]^=gh[n]<<13,gh[fh]^=gh[n]>>17,gh[fh]^=gh[n]<<5,j[e]=j[e]^gh[fh];return n^=gh[0],n^=gh[1],n^=gh[2],j})}const vh={},Eh={};function bh(e,t,n){return n?(null==vh[e]&&(vh[e]=hh(e,t).catch(t=>{throw delete vh[e],t}).finally(()=>{t.completeTask(e)})),vh[e]):hh(e,t).finally(()=>{t.completeTask(e)})}function Ch(e,t,n,i,r){return r?(null==Eh[e]&&(Eh[e]=mh(e,t,n,i).catch(t=>{throw delete Eh[e],t}).finally(()=>{i.completeTask(e)})),Eh[e]):mh(e,t,n,i).finally(()=>{i.completeTask(e)})}var _h,Ih,xh,yh,Mh;class wh{constructor(){_h.add(this),Ih.set(this,new Map),xh.set(this,null),yh.set(this,0)}setOnProgress(e){z(this,xh,e)}updateProgress(e,t,n){const i=H(this,Ih,"f").get(e);(null==i?void 0:i.completed)||(i?(i.loaded=t,i.total=n):H(this,Ih,"f").set(e,{loaded:t,total:n,completed:!1}),H(this,_h,"m",Mh).call(this))}completeTask(e){const t=H(this,Ih,"f").get(e);t&&(t.loaded=t.total,t.completed=!0),H(this,_h,"m",Mh).call(this)}}Ih=new WeakMap,xh=new WeakMap,yh=new WeakMap,_h=new WeakSet,Mh=function(){if(null==H(this,xh,"f"))return;let e=0,t=0,n=!0;for(const i of H(this,Ih,"f").values())e+=i.loaded,t+=i.total,i.completed||(n=!1);if(H(this,Ih,"f").size>0&&n)return H(this,Ih,"f").clear(),z(this,yh,0),void H(this,xh,"f").call(this,1);const i=t>0?Math.min(e/t,1):0;z(this,yh,Math.max(H(this,yh,"f"),i)),H(this,xh,"f").call(this,H(this,yh,"f"))};class Sh extends vc{constructor(e){super(e),this.type=$e}parse(e){const t=function(e,t){switch(e){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(t||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(t||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(t||""));default:throw new Error("THREE.RGBELoader: Memory Error: "+(t||""))}},n=function(e,t,n){t=t||1024;let i=e.pos,r=-1,a=0,o="",s=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));for(;0>(r=s.indexOf("\n"))&&a<t&&i<e.byteLength;)o+=s,a+=s.length,i+=128,s+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));return-1<r&&(e.pos+=a+r+1,o+s.slice(0,r))},i=function(e,t,n,i){const r=e[t+3],a=Math.pow(2,r-128)/255;n[i+0]=e[t+0]*a,n[i+1]=e[t+1]*a,n[i+2]=e[t+2]*a,n[i+3]=1},r=function(e,t,n,i){const r=e[t+3],a=Math.pow(2,r-128)/255;n[i+0]=nr(Math.min(e[t+0]*a,65504)),n[i+1]=nr(Math.min(e[t+1]*a,65504)),n[i+2]=nr(Math.min(e[t+2]*a,65504)),n[i+3]=nr(1)},a=new Uint8Array(e);a.pos=0;const o=function(e){const i=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,r=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,a=/^\s*FORMAT=(\S+)\s*$/,o=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,s={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let l,c;for((e.pos>=e.byteLength||!(l=n(e)))&&t(1,"no header found"),(c=l.match(/^#\?(\S+)/))||t(3,"bad initial token"),s.valid|=1,s.programtype=c[1],s.string+=l+"\n";l=n(e),!1!==l;)if(s.string+=l+"\n","#"!==l.charAt(0)){if((c=l.match(i))&&(s.gamma=parseFloat(c[1])),(c=l.match(r))&&(s.exposure=parseFloat(c[1])),(c=l.match(a))&&(s.valid|=2,s.format=c[1]),(c=l.match(o))&&(s.valid|=4,s.height=parseInt(c[1],10),s.width=parseInt(c[2],10)),2&s.valid&&4&s.valid)break}else s.comments+=l+"\n";return 2&s.valid||t(3,"missing format specifier"),4&s.valid||t(3,"missing image size specifier"),s}(a),s=o.width,l=o.height,c=function(e,n,i){const r=n;if(r<8||r>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);r!==(e[2]<<8|e[3])&&t(3,"wrong scanline width");const a=new Uint8Array(4*n*i);a.length||t(4,"unable to allocate buffer space");let o=0,s=0;const l=4*r,c=new Uint8Array(4),h=new Uint8Array(l);let A=i;for(;A>0&&s<e.byteLength;){s+4>e.byteLength&&t(1),c[0]=e[s++],c[1]=e[s++],c[2]=e[s++],c[3]=e[s++],2==c[0]&&2==c[1]&&(c[2]<<8|c[3])==r||t(3,"bad rgbe scanline format");let n,i=0;for(;i<l&&s<e.byteLength;){n=e[s++];const r=n>128;if(r&&(n-=128),(0===n||i+n>l)&&t(3,"bad scanline data"),r){const t=e[s++];for(let e=0;e<n;e++)h[i++]=t}else h.set(e.subarray(s,s+n),i),i+=n,s+=n}const u=r;for(let e=0;e<u;e++){let t=0;a[o]=h[e+t],t+=r,a[o+1]=h[e+t],t+=r,a[o+2]=h[e+t],t+=r,a[o+3]=h[e+t],o+=4}A--}return a}(a.subarray(a.pos),s,l);let h,A,u;switch(this.type){case Ze:u=c.length/4;const e=new Float32Array(4*u);for(let t=0;t<u;t++)i(c,4*t,e,4*t);h=e,A=Ze;break;case $e:u=c.length/4;const t=new Uint16Array(4*u);for(let e=0;e<u;e++)r(c,4*e,t,4*e);h=t,A=$e;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:s,height:l,data:h,header:o.string,gamma:o.gamma,exposure:o.exposure,type:A}}setDataType(e){return this.type=e,this}load(e,t,n,i){return super.load(e,function(e,n){switch(e.type){case Ze:case $e:e.colorSpace=It,e.minFilter=qe,e.magFilter=qe,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,n)},n,i)}}
7
7
  /*!
8
8
  fflate - fast JavaScript compression/decompression
9
9
  <https://101arrowz.github.io/fflate>
10
10
  Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
11
11
  version 0.8.2
12
- */var Bh=Uint8Array,Th=Uint16Array,Rh=Int32Array,Dh=new Bh([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]),Qh=new Bh([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]),Uh=new Bh([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Lh=function(e,t){for(var n=new Th(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var r=new Rh(n[30]);for(i=1;i<30;++i)for(var a=n[i];a<n[i+1];++a)r[a]=a-n[i]<<5|i;return{b:n,r:r}},Ph=Lh(Dh,2),Nh=Ph.b,Fh=Ph.r;Nh[28]=258,Fh[258]=28;for(var Oh=Lh(Qh,0).b,kh=new Th(32768),Gh=0;Gh<32768;++Gh){var Hh=(43690&Gh)>>1|(21845&Gh)<<1;Hh=(61680&(Hh=(52428&Hh)>>2|(13107&Hh)<<2))>>4|(3855&Hh)<<4,kh[Gh]=((65280&Hh)>>8|(255&Hh)<<8)>>1}var zh=function(e,t,n){for(var i=e.length,r=0,a=new Th(t);r<i;++r)e[r]&&++a[e[r]-1];var s,o=new Th(t);for(r=1;r<t;++r)o[r]=o[r-1]+a[r-1]<<1;s=new Th(1<<t);var l=15-t;for(r=0;r<i;++r)if(e[r])for(var c=r<<4|e[r],h=t-e[r],A=o[e[r]-1]++<<h,u=A|(1<<h)-1;A<=u;++A)s[kh[A]>>l]=c;return s},Vh=new Bh(288);for(Gh=0;Gh<144;++Gh)Vh[Gh]=8;for(Gh=144;Gh<256;++Gh)Vh[Gh]=9;for(Gh=256;Gh<280;++Gh)Vh[Gh]=7;for(Gh=280;Gh<288;++Gh)Vh[Gh]=8;var Wh=new Bh(32);for(Gh=0;Gh<32;++Gh)Wh[Gh]=5;var qh=zh(Vh,9),jh=zh(Wh,5),Yh=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Xh=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(7&t)&n},Kh=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},Jh=function(e){return(e+7)/8|0},Zh=["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"],$h=function(e,t,n){var i=new Error(t||Zh[e]);if(i.code=e,Error.captureStackTrace&&Error.captureStackTrace(i,$h),!n)throw i;return i},eA=new Bh(0);function tA(e,t){return function(e,t,n,i){var r=e.length;if(!r||t.f&&!t.l)return n||new Bh(0);var a=!n,s=a||2!=t.i,o=t.i;a&&(n=new Bh(3*r));var l=function(e){var t=n.length;if(e>t){var i=new Bh(Math.max(2*t,e));i.set(n),n=i}},c=t.f||0,h=t.p||0,A=t.b||0,u=t.l,d=t.d,p=t.m,f=t.n,g=8*r;do{if(!u){c=Xh(e,h,1);var m=Xh(e,h+1,3);if(h+=3,!m){var v=e[(B=Jh(h)+4)-4]|e[B-3]<<8,E=B+v;if(E>r){o&&$h(0);break}s&&l(A+v),n.set(e.subarray(B,E),A),t.b=A+=v,t.p=h=8*E,t.f=c;continue}if(1==m)u=qh,d=jh,p=9,f=5;else if(2==m){var b=Xh(e,h,31)+257,C=Xh(e,h+10,15)+4,_=b+Xh(e,h+5,31)+1;h+=14;for(var I=new Bh(_),x=new Bh(19),y=0;y<C;++y)x[Uh[y]]=Xh(e,h+3*y,7);h+=3*C;var w=Yh(x),M=(1<<w)-1,S=zh(x,w);for(y=0;y<_;){var B,T=S[Xh(e,h,M)];if(h+=15&T,(B=T>>4)<16)I[y++]=B;else{var R=0,D=0;for(16==B?(D=3+Xh(e,h,3),h+=2,R=I[y-1]):17==B?(D=3+Xh(e,h,7),h+=3):18==B&&(D=11+Xh(e,h,127),h+=7);D--;)I[y++]=R}}var Q=I.subarray(0,b),U=I.subarray(b);p=Yh(Q),f=Yh(U),u=zh(Q,p),d=zh(U,f)}else $h(1);if(h>g){o&&$h(0);break}}s&&l(A+131072);for(var L=(1<<p)-1,P=(1<<f)-1,N=h;;N=h){var F=(R=u[Kh(e,h)&L])>>4;if((h+=15&R)>g){o&&$h(0);break}if(R||$h(2),F<256)n[A++]=F;else{if(256==F){N=h,u=null;break}var O=F-254;if(F>264){var k=Dh[y=F-257];O=Xh(e,h,(1<<k)-1)+Nh[y],h+=k}var G=d[Kh(e,h)&P],H=G>>4;if(G||$h(3),h+=15&G,U=Oh[H],H>3&&(k=Qh[H],U+=Kh(e,h)&(1<<k)-1,h+=k),h>g){o&&$h(0);break}s&&l(A+131072);var z=A+O;if(A<U){var V=0-U,W=Math.min(U,z);for(V+A<0&&$h(3);A<W;++A)n[A]=i[V+A]}for(;A<z;++A)n[A]=n[A-U]}}t.l=u,t.p=N,t.b=A,t.f=c,u&&(c=1,t.m=p,t.d=d,t.n=f)}while(!c);return A!=n.length&&a?function(e,t,n){return(null==n||n>e.length)&&(n=e.length),new Bh(e.subarray(0,n))}(n,0,A):n.subarray(0,A)}(e.subarray((i=t,(8!=(15&(n=e)[0])||n[0]>>4>7||(n[0]<<8|n[1])%31)&&$h(6,"invalid zlib data"),(n[1]>>5&1)==+!i&&$h(6,"invalid zlib data: "+(32&n[1]?"need":"unexpected")+" dictionary"),2+(n[1]>>3&4)),-4),{i:2},t,t);var n,i}var nA="undefined"!=typeof TextDecoder&&new TextDecoder;try{nA.decode(eA,{stream:!0})}catch($d){}class iA extends vc{constructor(e){super(e),this.type=$e}parse(e){const t=65536,n=14,i=65537,r=Math.pow(2.7182818,2.2),a={l:0,c:0,lc:0};function s(e,t,n,i,r){for(;n<e;)t=t<<8|k(i,r),n+=8;n-=e,a.l=t>>n&(1<<e)-1,a.c=t,a.lc=n}const o=new Array(59);function l(e,t,n,r,l,c){const h=t;let A=0,u=0;for(;r<=l;r++){if(h.value-t.value>n)return!1;s(6,A,u,e,h);const i=a.l;if(A=a.c,u=a.lc,c[r]=i,63==i){if(h.value-t.value>n)throw new Error("Something wrong with hufUnpackEncTable");s(8,A,u,e,h);let i=a.l+6;if(A=a.c,u=a.lc,r+i>l+1)throw new Error("Something wrong with hufUnpackEncTable");for(;i--;)c[r++]=0;r--}else if(i>=59){let e=i-59+2;if(r+e>l+1)throw new Error("Something wrong with hufUnpackEncTable");for(;e--;)c[r++]=0;r--}}!function(e){for(let e=0;e<=58;++e)o[e]=0;for(let t=0;t<i;++t)o[e[t]]+=1;let t=0;for(let e=58;e>0;--e){const n=t+o[e]>>1;o[e]=t,t=n}for(let t=0;t<i;++t){const n=e[t];n>0&&(e[t]=n|o[n]++<<6)}}(c)}function c(e){return 63&e}function h(e){return e>>6}const A={c:0,lc:0};function u(e,t,n,i){e=e<<8|k(n,i),t+=8,A.c=e,A.lc=t}const d={c:0,lc:0};function p(e,t,n,i,r,a,s,o,l){if(e==t){i<8&&(u(n,i,r,a),n=A.c,i=A.lc);let e=n>>(i-=8);if(e=new Uint8Array([e])[0],o.value+e>l)return!1;const t=s[o.value-1];for(;e-- >0;)s[o.value++]=t}else{if(!(o.value<l))return!1;s[o.value++]=e}d.c=n,d.lc=i}function f(e){return 65535&e}function g(e){const t=f(e);return t>32767?t-65536:t}const m={a:0,b:0};function v(e,t){const n=g(e),i=g(t),r=n+(1&i)+(i>>1),a=r,s=r-i;m.a=a,m.b=s}function E(e,t){const n=f(e),i=f(t),r=n-(i>>1)&65535,a=i+r-32768&65535;m.a=a,m.b=r}function b(e,t,n,i,r,a,s){const o=s<16384,l=n>r?r:n;let c,h,A=1;for(;A<=l;)A<<=1;for(A>>=1,c=A,A>>=1;A>=1;){h=0;const s=h+a*(r-c),l=a*A,u=a*c,d=i*A,p=i*c;let f,g,b,C;for(;h<=s;h+=u){let r=h;const a=h+i*(n-c);for(;r<=a;r+=p){const n=r+d,i=r+l,a=i+d;o?(v(e[r+t],e[i+t]),f=m.a,b=m.b,v(e[n+t],e[a+t]),g=m.a,C=m.b,v(f,g),e[r+t]=m.a,e[n+t]=m.b,v(b,C),e[i+t]=m.a,e[a+t]=m.b):(E(e[r+t],e[i+t]),f=m.a,b=m.b,E(e[n+t],e[a+t]),g=m.a,C=m.b,E(f,g),e[r+t]=m.a,e[n+t]=m.b,E(b,C),e[i+t]=m.a,e[a+t]=m.b)}if(n&A){const n=r+l;o?v(e[r+t],e[n+t]):E(e[r+t],e[n+t]),f=m.a,e[n+t]=m.b,e[r+t]=f}}if(r&A){let r=h;const a=h+i*(n-c);for(;r<=a;r+=p){const n=r+d;o?v(e[r+t],e[n+t]):E(e[r+t],e[n+t]),f=m.a,e[n+t]=m.b,e[r+t]=f}}c=A,A>>=1}return h}function C(e,t,r,a,s,o){const f=r.value,g=O(t,r),m=O(t,r);r.value+=4;const v=O(t,r);if(r.value+=4,g<0||g>=i||m<0||m>=i)throw new Error("Something wrong with HUF_ENCSIZE");const E=new Array(i),b=new Array(16384);if(function(e){for(let t=0;t<16384;t++)e[t]={},e[t].len=0,e[t].lit=0,e[t].p=null}(b),l(e,r,a-(r.value-f),g,m,E),v>8*(a-(r.value-f)))throw new Error("Something wrong with hufUncompress");!function(e,t,i,r){for(;t<=i;t++){const i=h(e[t]),a=c(e[t]);if(i>>a)throw new Error("Invalid table entry");if(a>n){const e=r[i>>a-n];if(e.len)throw new Error("Invalid table entry");if(e.lit++,e.p){const t=e.p;e.p=new Array(e.lit);for(let n=0;n<e.lit-1;++n)e.p[n]=t[n]}else e.p=new Array(1);e.p[e.lit-1]=t}else if(a){let e=0;for(let s=1<<n-a;s>0;s--){const s=r[(i<<n-a)+e];if(s.len||s.p)throw new Error("Invalid table entry");s.len=a,s.lit=t,e++}}}}(E,g,m,b),function(e,t,i,r,a,s,o,l,f){let g=0,m=0;const v=o,E=Math.trunc(r.value+(a+7)/8);for(;r.value<E;)for(u(g,m,i,r),g=A.c,m=A.lc;m>=n;){const a=t[g>>m-n&16383];if(a.len)m-=a.len,p(a.lit,s,g,m,i,r,l,f,v),g=d.c,m=d.lc;else{if(!a.p)throw new Error("hufDecode issues");let t;for(t=0;t<a.lit;t++){const n=c(e[a.p[t]]);for(;m<n&&r.value<E;)u(g,m,i,r),g=A.c,m=A.lc;if(m>=n&&h(e[a.p[t]])==(g>>m-n&(1<<n)-1)){m-=n,p(a.p[t],s,g,m,i,r,l,f,v),g=d.c,m=d.lc;break}}if(t==a.lit)throw new Error("hufDecode issues")}}const b=8-a&7;for(g>>=b,m-=b;m>0;){const e=t[g<<n-m&16383];if(!e.len)throw new Error("hufDecode issues");m-=e.len,p(e.lit,s,g,m,i,r,l,f,v),g=d.c,m=d.lc}}(E,b,e,r,v,m,o,s,{value:0})}function _(e){for(let t=1;t<e.length;t++){const n=e[t-1]+e[t]-128;e[t]=n}}function I(e,t){let n=0,i=Math.floor((e.length+1)/2),r=0;const a=e.length-1;for(;!(r>a||(t[r++]=e[n++],r>a));)t[r++]=e[i++]}function x(e){let t=e.byteLength;const n=new Array;let i=0;const r=new DataView(e);for(;t>0;){const e=r.getInt8(i++);if(e<0){const a=-e;t-=a+1;for(let e=0;e<a;e++)n.push(r.getUint8(i++))}else{const a=e;t-=2;const s=r.getUint8(i++);for(let e=0;e<a+1;e++)n.push(s)}}return n}function y(e,t,n){let i,r=1;for(;r<64;)i=t[e.value],65280==i?r=64:i>>8==255?r+=255&i:(n[r]=i,r++),e.value++}function w(e,t){t[0]=W(e[0]),t[1]=W(e[1]),t[2]=W(e[5]),t[3]=W(e[6]),t[4]=W(e[14]),t[5]=W(e[15]),t[6]=W(e[27]),t[7]=W(e[28]),t[8]=W(e[2]),t[9]=W(e[4]),t[10]=W(e[7]),t[11]=W(e[13]),t[12]=W(e[16]),t[13]=W(e[26]),t[14]=W(e[29]),t[15]=W(e[42]),t[16]=W(e[3]),t[17]=W(e[8]),t[18]=W(e[12]),t[19]=W(e[17]),t[20]=W(e[25]),t[21]=W(e[30]),t[22]=W(e[41]),t[23]=W(e[43]),t[24]=W(e[9]),t[25]=W(e[11]),t[26]=W(e[18]),t[27]=W(e[24]),t[28]=W(e[31]),t[29]=W(e[40]),t[30]=W(e[44]),t[31]=W(e[53]),t[32]=W(e[10]),t[33]=W(e[19]),t[34]=W(e[23]),t[35]=W(e[32]),t[36]=W(e[39]),t[37]=W(e[45]),t[38]=W(e[52]),t[39]=W(e[54]),t[40]=W(e[20]),t[41]=W(e[22]),t[42]=W(e[33]),t[43]=W(e[38]),t[44]=W(e[46]),t[45]=W(e[51]),t[46]=W(e[55]),t[47]=W(e[60]),t[48]=W(e[21]),t[49]=W(e[34]),t[50]=W(e[37]),t[51]=W(e[47]),t[52]=W(e[50]),t[53]=W(e[56]),t[54]=W(e[59]),t[55]=W(e[61]),t[56]=W(e[35]),t[57]=W(e[36]),t[58]=W(e[48]),t[59]=W(e[49]),t[60]=W(e[57]),t[61]=W(e[58]),t[62]=W(e[62]),t[63]=W(e[63])}function M(e){const t=.5*Math.cos(.7853975),n=.5*Math.cos(3.14159/16),i=.5*Math.cos(3.14159/8),r=.5*Math.cos(3*3.14159/16),a=.5*Math.cos(.981746875),s=.5*Math.cos(3*3.14159/8),o=.5*Math.cos(1.374445625),l=new Array(4),c=new Array(4),h=new Array(4),A=new Array(4);for(let u=0;u<8;++u){const d=8*u;l[0]=i*e[d+2],l[1]=s*e[d+2],l[2]=i*e[d+6],l[3]=s*e[d+6],c[0]=n*e[d+1]+r*e[d+3]+a*e[d+5]+o*e[d+7],c[1]=r*e[d+1]-o*e[d+3]-n*e[d+5]-a*e[d+7],c[2]=a*e[d+1]-n*e[d+3]+o*e[d+5]+r*e[d+7],c[3]=o*e[d+1]-a*e[d+3]+r*e[d+5]-n*e[d+7],h[0]=t*(e[d+0]+e[d+4]),h[3]=t*(e[d+0]-e[d+4]),h[1]=l[0]+l[3],h[2]=l[1]-l[2],A[0]=h[0]+h[1],A[1]=h[3]+h[2],A[2]=h[3]-h[2],A[3]=h[0]-h[1],e[d+0]=A[0]+c[0],e[d+1]=A[1]+c[1],e[d+2]=A[2]+c[2],e[d+3]=A[3]+c[3],e[d+4]=A[3]-c[3],e[d+5]=A[2]-c[2],e[d+6]=A[1]-c[1],e[d+7]=A[0]-c[0]}for(let u=0;u<8;++u)l[0]=i*e[16+u],l[1]=s*e[16+u],l[2]=i*e[48+u],l[3]=s*e[48+u],c[0]=n*e[8+u]+r*e[24+u]+a*e[40+u]+o*e[56+u],c[1]=r*e[8+u]-o*e[24+u]-n*e[40+u]-a*e[56+u],c[2]=a*e[8+u]-n*e[24+u]+o*e[40+u]+r*e[56+u],c[3]=o*e[8+u]-a*e[24+u]+r*e[40+u]-n*e[56+u],h[0]=t*(e[u]+e[32+u]),h[3]=t*(e[u]-e[32+u]),h[1]=l[0]+l[3],h[2]=l[1]-l[2],A[0]=h[0]+h[1],A[1]=h[3]+h[2],A[2]=h[3]-h[2],A[3]=h[0]-h[1],e[0+u]=A[0]+c[0],e[8+u]=A[1]+c[1],e[16+u]=A[2]+c[2],e[24+u]=A[3]+c[3],e[32+u]=A[3]-c[3],e[40+u]=A[2]-c[2],e[48+u]=A[1]-c[1],e[56+u]=A[0]-c[0]}function S(e){for(let t=0;t<64;++t){const n=e[0][t],i=e[1][t],r=e[2][t];e[0][t]=n+1.5747*r,e[1][t]=n-.1873*i-.4682*r,e[2][t]=n+1.8556*i}}function B(e,t,n){for(let i=0;i<64;++i)t[n+i]=nr(T(e[i]))}function T(e){return e<=1?Math.sign(e)*Math.pow(Math.abs(e),2.2):Math.sign(e)*Math.pow(r,Math.abs(e)-1)}function R(e){return new DataView(e.array.buffer,e.offset.value,e.size)}function D(e){const t=e.viewer.buffer.slice(e.offset.value,e.offset.value+e.size),n=new Uint8Array(x(t)),i=new Uint8Array(n.length);return _(n),I(n,i),new DataView(i.buffer)}function Q(e){const t=tA(e.array.slice(e.offset.value,e.offset.value+e.size)),n=new Uint8Array(t.length);return _(t),I(t,n),new DataView(n.buffer)}function U(e){const n=e.viewer,i={value:e.offset.value},r=new Uint16Array(e.columns*e.lines*(e.inputChannels.length*e.type)),a=new Uint8Array(8192);let s=0;const o=new Array(e.inputChannels.length);for(let t=0,n=e.inputChannels.length;t<n;t++)o[t]={},o[t].start=s,o[t].end=o[t].start,o[t].nx=e.columns,o[t].ny=e.lines,o[t].size=e.type,s+=o[t].nx*o[t].ny*o[t].size;const l=q(n,i),c=q(n,i);if(c>=8192)throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");if(l<=c)for(let e=0;e<c-l+1;e++)a[e+l]=G(n,i);const h=new Uint16Array(t),A=function(e,n){let i=0;for(let r=0;r<t;++r)(0==r||e[r>>3]&1<<(7&r))&&(n[i++]=r);const r=i-1;for(;i<t;)n[i++]=0;return r}(a,h),u=O(n,i);C(e.array,n,i,u,r,s);for(let t=0;t<e.inputChannels.length;++t){const e=o[t];for(let n=0;n<o[t].size;++n)b(r,e.start+n,e.nx,e.size,e.ny,e.nx*e.size,A)}!function(e,t,n){for(let i=0;i<n;++i)t[i]=e[t[i]]}(h,r,s);let d=0;const p=new Uint8Array(r.buffer.byteLength);for(let t=0;t<e.lines;t++)for(let t=0;t<e.inputChannels.length;t++){const e=o[t],n=e.nx*e.size,i=new Uint8Array(r.buffer,2*e.end,2*n);p.set(i,d),d+=2*n,e.end+=n}return new DataView(p.buffer)}function L(e){const t=tA(e.array.slice(e.offset.value,e.offset.value+e.size)),n=e.inputChannels.length*e.lines*e.columns*e.totalBytes,i=new ArrayBuffer(n),r=new DataView(i);let a=0,s=0;const o=new Array(4);for(let n=0;n<e.lines;n++)for(let n=0;n<e.inputChannels.length;n++){let i=0;switch(e.inputChannels[n].pixelType){case 1:o[0]=a,o[1]=o[0]+e.columns,a=o[1]+e.columns;for(let n=0;n<e.columns;++n)i+=t[o[0]++]<<8|t[o[1]++],r.setUint16(s,i,!0),s+=2;break;case 2:o[0]=a,o[1]=o[0]+e.columns,o[2]=o[1]+e.columns,a=o[2]+e.columns;for(let n=0;n<e.columns;++n)i+=t[o[0]++]<<24|t[o[1]++]<<16|t[o[2]++]<<8,r.setUint32(s,i,!0),s+=4}}return r}function P(e){const t=e.viewer,n={value:e.offset.value},i=new Uint8Array(e.columns*e.lines*(e.inputChannels.length*e.type*2)),r={version:H(t,n),unknownUncompressedSize:H(t,n),unknownCompressedSize:H(t,n),acCompressedSize:H(t,n),dcCompressedSize:H(t,n),rleCompressedSize:H(t,n),rleUncompressedSize:H(t,n),rleRawSize:H(t,n),totalAcUncompressedCount:H(t,n),totalDcUncompressedCount:H(t,n),acCompression:H(t,n)};if(r.version<2)throw new Error("EXRLoader.parse: "+te.compression+" version "+r.version+" is unsupported");const a=new Array;let s=q(t,n)-2;for(;s>0;){const e=N(t.buffer,n),i=G(t,n),r=i>>2&3,o=new Int8Array([(i>>4)-1])[0],l=G(t,n);a.push({name:e,index:o,type:l,compression:r}),s-=e.length+3}const o=te.channels,l=new Array(e.inputChannels.length);for(let t=0;t<e.inputChannels.length;++t){const n=l[t]={},i=o[t];n.name=i.name,n.compression=0,n.decoded=!1,n.type=i.pixelType,n.pLinear=i.pLinear,n.width=e.columns,n.height=e.lines}const c={idx:new Array(3)};for(let t=0;t<e.inputChannels.length;++t){const e=l[t];for(let n=0;n<a.length;++n){const i=a[n];e.name==i.name&&(e.compression=i.compression,i.index>=0&&(c.idx[i.index]=t),e.offset=t)}}let h,A,u;if(r.acCompressedSize>0)switch(r.acCompression){case 0:h=new Uint16Array(r.totalAcUncompressedCount),C(e.array,t,n,r.acCompressedSize,h,r.totalAcUncompressedCount);break;case 1:const i=tA(e.array.slice(n.value,n.value+r.totalAcUncompressedCount));h=new Uint16Array(i.buffer),n.value+=r.totalAcUncompressedCount}if(r.dcCompressedSize>0){const t={array:e.array,offset:n,size:r.dcCompressedSize};A=new Uint16Array(Q(t).buffer),n.value+=r.dcCompressedSize}r.rleRawSize>0&&(u=x(tA(e.array.slice(n.value,n.value+r.rleCompressedSize)).buffer),n.value+=r.rleCompressedSize);let d=0;const p=new Array(l.length);for(let e=0;e<p.length;++e)p[e]=new Array;for(let t=0;t<e.lines;++t)for(let t=0;t<l.length;++t)p[t].push(d),d+=l[t].width*e.type*2;!function(e,t,n,i,r,a){let s=new DataView(a.buffer);const o=n[e.idx[0]].width,l=n[e.idx[0]].height,c=Math.floor(o/8),h=Math.ceil(o/8),A=Math.ceil(l/8),u=o-8*(h-1),d=l-8*(A-1),p={value:0},f=new Array(3),g=new Array(3),m=new Array(3),v=new Array(3),E=new Array(3);for(let n=0;n<3;++n)E[n]=t[e.idx[n]],f[n]=n<1?0:f[n-1]+h*A,g[n]=new Float32Array(64),m[n]=new Uint16Array(64),v[n]=new Uint16Array(64*h);for(let t=0;t<A;++t){let a=8;t==A-1&&(a=d);let o=8;for(let e=0;e<h;++e){e==h-1&&(o=u);for(let e=0;e<3;++e)m[e].fill(0),m[e][0]=r[f[e]++],y(p,i,m[e]),w(m[e],g[e]),M(g[e]);S(g);for(let t=0;t<3;++t)B(g[t],v[t],64*e)}let l=0;for(let i=0;i<3;++i){const r=n[e.idx[i]].type;for(let e=8*t;e<8*t+a;++e){l=E[i][e];for(let t=0;t<c;++t){const n=64*t+8*(7&e);s.setUint16(l+0*r,v[i][n+0],!0),s.setUint16(l+2*r,v[i][n+1],!0),s.setUint16(l+4*r,v[i][n+2],!0),s.setUint16(l+6*r,v[i][n+3],!0),s.setUint16(l+8*r,v[i][n+4],!0),s.setUint16(l+10*r,v[i][n+5],!0),s.setUint16(l+12*r,v[i][n+6],!0),s.setUint16(l+14*r,v[i][n+7],!0),l+=16*r}}if(c!=h)for(let e=8*t;e<8*t+a;++e){const t=E[i][e]+8*c*2*r,n=64*c+8*(7&e);for(let e=0;e<o;++e)s.setUint16(t+2*e*r,v[i][n+e],!0)}}}const b=new Uint16Array(o);s=new DataView(a.buffer);for(let t=0;t<3;++t){n[e.idx[t]].decoded=!0;const i=n[e.idx[t]].type;if(2==n[t].type)for(let e=0;e<l;++e){const n=E[t][e];for(let e=0;e<o;++e)b[e]=s.getUint16(n+2*e*i,!0);for(let e=0;e<o;++e)s.setFloat32(n+2*e*i,W(b[e]),!0)}}}(c,p,l,h,A,i);for(let t=0;t<l.length;++t){const n=l[t];if(!n.decoded){if(2!==n.compression)throw new Error("EXRLoader.parse: unsupported channel compression");{let r=0,a=0;for(let s=0;s<e.lines;++s){let e=p[t][r];for(let t=0;t<n.width;++t){for(let t=0;t<2*n.type;++t)i[e++]=u[a+t*n.width*n.height];a++}r++}}}}return new DataView(i.buffer)}function N(e,t){const n=new Uint8Array(e);let i=0;for(;0!=n[t.value+i];)i+=1;const r=(new TextDecoder).decode(n.slice(t.value,t.value+i));return t.value=t.value+i+1,r}function F(e,t){const n=e.getInt32(t.value,!0);return t.value=t.value+4,n}function O(e,t){const n=e.getUint32(t.value,!0);return t.value=t.value+4,n}function k(e,t){const n=e[t.value];return t.value=t.value+1,n}function G(e,t){const n=e.getUint8(t.value);return t.value=t.value+1,n}const H=function(e,t){let n;return n="getBigInt64"in DataView.prototype?Number(e.getBigInt64(t.value,!0)):e.getUint32(t.value+4,!0)+Number(e.getUint32(t.value,!0)<<32),t.value+=8,n};function z(e,t){const n=e.getFloat32(t.value,!0);return t.value+=4,n}function V(e,t){return nr(z(e,t))}function W(e){const t=(31744&e)>>10,n=1023&e;return(e>>15?-1:1)*(t?31===t?n?NaN:1/0:Math.pow(2,t-15)*(1+n/1024):n/1024*6103515625e-14)}function q(e,t){const n=e.getUint16(t.value,!0);return t.value+=2,n}function j(e,t){return W(q(e,t))}function Y(e,t,n,i,r){return"string"===i||"stringvector"===i||"iccProfile"===i?function(e,t,n){const i=(new TextDecoder).decode(new Uint8Array(e).slice(t.value,t.value+n));return t.value=t.value+n,i}(t,n,r):"chlist"===i?function(e,t,n,i){const r=n.value,a=[];for(;n.value<r+i-1;){const i=N(t,n),r=F(e,n),s=G(e,n);n.value+=3;const o=F(e,n),l=F(e,n);a.push({name:i,pixelType:r,pLinear:s,xSampling:o,ySampling:l})}return n.value+=1,a}(e,t,n,r):"chromaticities"===i?function(e,t){return{redX:z(e,t),redY:z(e,t),greenX:z(e,t),greenY:z(e,t),blueX:z(e,t),blueY:z(e,t),whiteX:z(e,t),whiteY:z(e,t)}}(e,n):"compression"===i?function(e,t){return["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"][G(e,t)]}(e,n):"box2i"===i?function(e,t){return{xMin:F(e,t),yMin:F(e,t),xMax:F(e,t),yMax:F(e,t)}}(e,n):"envmap"===i?function(e,t){return["ENVMAP_LATLONG","ENVMAP_CUBE"][G(e,t)]}(e,n):"tiledesc"===i?function(e,t){const n=O(e,t),i=O(e,t),r=G(e,t);return{xSize:n,ySize:i,levelMode:["ONE_LEVEL","MIPMAP_LEVELS","RIPMAP_LEVELS"][15&r],roundingMode:["ROUND_DOWN","ROUND_UP"][r>>4]}}(e,n):"lineOrder"===i?function(e,t){return["INCREASING_Y","DECREASING_Y","RANDOM_Y"][G(e,t)]}(e,n):"float"===i?z(e,n):"v2f"===i?function(e,t){return[z(e,t),z(e,t)]}(e,n):"v3f"===i?function(e,t){return[z(e,t),z(e,t),z(e,t)]}(e,n):"int"===i?F(e,n):"rational"===i?function(e,t){return[F(e,t),O(e,t)]}(e,n):"timecode"===i?function(e,t){return[O(e,t),O(e,t)]}(e,n):"preview"===i?(n.value+=r,"skipped"):void(n.value+=r)}function X(e,t,n,i){const r=new Array(e);for(let a=0;a<e;a++){const e=1<<a;let s=t/e|0;"ROUND_UP"==i&&s*e<t&&(s+=1);const o=Math.max(s,1);r[a]=(o+n-1)/n|0}return r}function K(){const e=this,t=e.offset,n={value:0};for(let i=0;i<e.tileCount;i++){const i=F(e.viewer,t),r=F(e.viewer,t);t.value+=8,e.size=O(e.viewer,t);const a=i*e.blockWidth,s=r*e.blockHeight;e.columns=a+e.blockWidth>e.width?e.width-a:e.blockWidth,e.lines=s+e.blockHeight>e.height?e.height-s:e.blockHeight;const o=e.columns*e.totalBytes,l=e.size<e.lines*o?e.uncompress(e):R(e);t.value+=e.size;for(let t=0;t<e.lines;t++){const i=t*e.columns*e.totalBytes;for(let r=0;r<e.inputChannels.length;r++){const o=te.channels[r].name,c=e.channelByteOffsets[o]*e.columns,h=e.decodeChannels[o];if(void 0===h)continue;n.value=i+c;const A=(e.height-(1+s+t))*e.outLineWidth;for(let t=0;t<e.columns;t++){const i=A+(t+a)*e.outputChannels+h;e.byteArray[i]=e.getter(l,n)}}}}}function J(){const e=this,t=e.offset,n={value:0};for(let i=0;i<e.height/e.blockHeight;i++){const r=F(e.viewer,t)-te.dataWindow.yMin;e.size=O(e.viewer,t),e.lines=r+e.blockHeight>e.height?e.height-r:e.blockHeight;const a=e.columns*e.totalBytes,s=e.size<e.lines*a?e.uncompress(e):R(e);t.value+=e.size;for(let t=0;t<e.blockHeight;t++){const r=i*e.blockHeight,o=t+e.scanOrder(r);if(o>=e.height)continue;const l=t*a,c=(e.height-1-o)*e.outLineWidth;for(let t=0;t<e.inputChannels.length;t++){const i=te.channels[t].name,r=e.channelByteOffsets[i]*e.columns,a=e.decodeChannels[i];if(void 0!==a){n.value=l+r;for(let t=0;t<e.columns;t++){const i=c+t*e.outputChannels+a;e.byteArray[i]=e.getter(s,n)}}}}}}const Z={value:0},$=new DataView(e),ee=new Uint8Array(e),te=function(e,t,n){const i={};if(20000630!=e.getUint32(0,!0))throw new Error("THREE.EXRLoader: Provided file doesn't appear to be in OpenEXR format.");i.version=e.getUint8(4);const r=e.getUint8(5);i.spec={singleTile:!!(2&r),longName:!!(4&r),deepFormat:!!(8&r),multiPart:!!(16&r)},n.value=8;let a=!0;for(;a;){const r=N(t,n);if(0==r)a=!1;else{const a=N(t,n),s=Y(e,t,n,a,O(e,n));void 0===s?console.warn(`THREE.EXRLoader: Skipped unknown header attribute type '${a}'.`):i[r]=s}}if(-7&r)throw console.error("THREE.EXRHeader:",i),new Error("THREE.EXRLoader: Provided file is currently unsupported.");return i}($,e,Z),ne=function(e,t,n,i,r){const a={size:0,viewer:t,array:n,offset:i,width:e.dataWindow.xMax-e.dataWindow.xMin+1,height:e.dataWindow.yMax-e.dataWindow.yMin+1,inputChannels:e.channels,channelByteOffsets:{},scanOrder:null,totalBytes:null,columns:null,lines:null,type:null,uncompress:null,getter:null,format:null,colorSpace:It};switch(e.compression){case"NO_COMPRESSION":a.blockHeight=1,a.uncompress=R;break;case"RLE_COMPRESSION":a.blockHeight=1,a.uncompress=D;break;case"ZIPS_COMPRESSION":a.blockHeight=1,a.uncompress=Q;break;case"ZIP_COMPRESSION":a.blockHeight=16,a.uncompress=Q;break;case"PIZ_COMPRESSION":a.blockHeight=32,a.uncompress=U;break;case"PXR24_COMPRESSION":a.blockHeight=16,a.uncompress=L;break;case"DWAA_COMPRESSION":a.blockHeight=32,a.uncompress=P;break;case"DWAB_COMPRESSION":a.blockHeight=256,a.uncompress=P;break;default:throw new Error("EXRLoader.parse: "+e.compression+" is unsupported")}const s={};for(const t of e.channels)switch(t.name){case"Y":case"R":case"G":case"B":case"A":s[t.name]=!0,a.type=t.pixelType}let o=!1;if(s.R&&s.G&&s.B)o=!s.A,a.outputChannels=4,a.decodeChannels={R:0,G:1,B:2,A:3};else{if(!s.Y)throw new Error("EXRLoader.parse: file contains unsupported data channels.");a.outputChannels=1,a.decodeChannels={Y:0}}if(1==a.type)switch(r){case Ze:a.getter=j;break;case $e:a.getter=q}else{if(2!=a.type)throw new Error("EXRLoader.parse: unsupported pixelType "+a.type+" for "+e.compression+".");switch(r){case Ze:a.getter=z;break;case $e:a.getter=V}}a.columns=a.width;const l=a.width*a.height*a.outputChannels;switch(r){case Ze:a.byteArray=new Float32Array(l),o&&a.byteArray.fill(1,0,l);break;case $e:a.byteArray=new Uint16Array(l),o&&a.byteArray.fill(15360,0,l);break;default:console.error("THREE.EXRLoader: unsupported type: ",r)}let c=0;for(const t of e.channels)void 0!==a.decodeChannels[t.name]&&(a.channelByteOffsets[t.name]=c),c+=2*t.pixelType;if(a.totalBytes=c,a.outLineWidth=a.width*a.outputChannels,"INCREASING_Y"===e.lineOrder?a.scanOrder=e=>e:a.scanOrder=e=>a.height-1-e,4==a.outputChannels?(a.format=tt,a.colorSpace=It):(a.format=rt,a.colorSpace=Ct),e.spec.singleTile){a.blockHeight=e.tiles.ySize,a.blockWidth=e.tiles.xSize;const n=function(e,t,n){let i=0;switch(e.levelMode){case"ONE_LEVEL":i=1;break;case"MIPMAP_LEVELS":i=function(e,t){const n=Math.log2(e);return"ROUND_DOWN"==t?Math.floor(n):Math.ceil(n)}(Math.max(t,n),e.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return i}(e.tiles,a.width,a.height),r=X(n,a.width,e.tiles.xSize,e.tiles.roundingMode),s=X(n,a.height,e.tiles.ySize,e.tiles.roundingMode);a.tileCount=r[0]*s[0];for(let e=0;e<n;e++)for(let n=0;n<s[e];n++)for(let n=0;n<r[e];n++)H(t,i);a.decode=K.bind(a)}else{a.blockWidth=a.width;const e=Math.ceil(a.height/a.blockHeight);for(let n=0;n<e;n++)H(t,i);a.decode=J.bind(a)}return a}(te,$,ee,Z,this.type);return ne.decode(),{header:te,width:ne.width,height:ne.height,data:ne.byteArray,format:ne.format,colorSpace:ne.colorSpace,type:this.type}}setDataType(e){return this.type=e,this}load(e,t,n,i){return super.load(e,function(e,n){e.colorSpace=n.colorSpace,e.minFilter=qe,e.magFilter=qe,e.generateMipmaps=!1,e.flipY=!1,t&&t(e,n)},n,i)}}let rA,aA=!1;function sA(e){aA||(rA=new Sh,new iA,aA=!0);const t=function(e){const t=new ul(e.data,e.width,e.height,void 0,e.type,void 0,Ge,Ge,qe,qe,1,It);return t.flipY=!0,t.generateMipmaps=!1,t.needsUpdate=!0,t}(rA.parse(e));return t.mapping=Fe,t.colorSpace=It,t}var oA=function(){var e=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]),t=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 n,i=WebAssembly.validate(e)?"b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp: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:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp: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:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;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:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;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:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb":"b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok: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;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",r=WebAssembly.instantiate(a(i),{}).then(function(e){(n=e.instance).exports.__wasm_call_ctors()});function a(e){for(var n=new Uint8Array(e.length),i=0;i<e.length;++i){var r=e.charCodeAt(i);n[i]=r>96?r-97:r>64?r-39:r+4}var a=0;for(i=0;i<e.length;++i)n[a++]=n[i]<60?t[n[i]]:64*(n[i]-60)+n[++i];return n.buffer.slice(0,a)}function s(e,t,i,r,a,s){var o=n.exports.sbrk,l=i+3&-4,c=o(l*r),h=o(a.length),A=new Uint8Array(n.exports.memory.buffer);A.set(a,h);var u=e(c,i,r,h,a.length);if(0==u&&s&&s(c,l,r),t.set(A.subarray(c,c+i*r)),o(c-o(0)),0!=u)throw new Error("Malformed buffer data: "+u)}var o={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},l={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},c=[],h=0;function A(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){var n=e.data;t.pending-=n.count,t.requests[n.id][n.action](n.value),delete t.requests[n.id]},t}function u(e){r.then(function(){var t=e.data;try{var i=new Uint8Array(t.count*t.size);s(n.exports[t.mode],i,t.count,t.size,t.source,n.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:r,supported:!0,useWorkers:function(e){!function(e){for(var t="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(a(i))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+s.toString()+u.toString(),n=new Blob([t],{type:"text/javascript"}),r=URL.createObjectURL(n),o=0;o<e;++o)c[o]=A(r);URL.revokeObjectURL(r)}(e)},decodeVertexBuffer:function(e,t,i,r,a){s(n.exports.meshopt_decodeVertexBuffer,e,t,i,r,n.exports[o[a]])},decodeIndexBuffer:function(e,t,i,r){s(n.exports.meshopt_decodeIndexBuffer,e,t,i,r)},decodeIndexSequence:function(e,t,i,r){s(n.exports.meshopt_decodeIndexSequence,e,t,i,r)},decodeGltfBuffer:function(e,t,i,r,a,c){s(n.exports[l[a]],e,t,i,r,n.exports[o[c]])},decodeGltfBufferAsync:function(e,t,i,a,A){return c.length>0?function(e,t,n,i,r){for(var a=c[0],s=1;s<c.length;++s)c[s].pending<a.pending&&(a=c[s]);return new Promise(function(s,o){var l=new Uint8Array(n),c=h++;a.pending+=e,a.requests[c]={resolve:s,reject:o},a.object.postMessage({id:c,count:e,size:t,source:l,mode:i,filter:r},[l.buffer])})}(e,t,i,l[a],o[A]):r.then(function(){var r=new Uint8Array(e*t);return s(n.exports[l[a]],r,e,t,i,n.exports[o[A]]),r})}}}();const lA=new WeakMap;class cA extends dc{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,n,i){const r=new gc(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,e=>{this.parse(e,t,i)},n,i)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,_t,n).catch(n)}decodeDracoFile(e,t,n,i,r=It,a=()=>{}){const s={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:r};return this.decodeGeometry(e,s).then(t).catch(a)}decodeGeometry(e,t){const n=JSON.stringify(t);if(lA.has(e)){const t=lA.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const r=this.workerNextTaskID++,a=e.byteLength,s=this._getWorker(r,a).then(n=>(i=n,new Promise((n,a)=>{i._callbacks[r]={resolve:n,reject:a},i.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return s.catch(()=>!0).then(()=>{i&&r&&this._releaseTask(i,r)}),lA.set(e,{key:n,promise:s}),s}_createGeometry(e){const t=new gr;e.index&&t.setIndex(new ar(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const i=e.attributes[n],r=i.name,a=i.array,s=i.itemSize,o=new ar(a,s);"color"===r&&(this._assignVertexColorSpace(o,i.vertexColorSpace),o.normalized=a instanceof Float32Array==0),t.setAttribute(r,o)}return t}_assignVertexColorSpace(e,t){if(t!==_t)return;const n=new Ki;for(let t=0,i=e.count;t<i;t++)n.fromBufferAttribute(e,t).convertSRGBToLinear(),e.setXYZ(t,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new gc(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((t,i)=>{n.load(e,t,void 0,i)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const 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=>{const n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const i=hA.toString(),r=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){const n=t.data;switch(n.type){case"decode":e._callbacks[n.id].resolve(n);break;case"error":e._callbacks[n.id].reject(n);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+n.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort(function(e,t){return e._taskLoad>t._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_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}}function hA(){let e,t;function n(e,t,n,i,r,a){const s=a.num_components(),o=n.num_points()*s,l=o*r.BYTES_PER_ELEMENT,c=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,r),h=e._malloc(l);t.GetAttributeDataArrayForAllPoints(n,a,c,l,h);const A=new r(e.HEAPF32.buffer,h,o).slice();return e._free(h),{name:i,array:A,itemSize:s}}onmessage=function(i){const 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":const i=r.buffer,a=r.taskConfig;t.then(e=>{const t=e.draco,s=new t.Decoder;try{const e=function(e,t,i,r){const a=r.attributeIDs,s=r.attributeTypes;let o,l;const c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)o=new e.Mesh,l=t.DecodeArrayToMesh(i,i.byteLength,o);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new e.PointCloud,l=t.DecodeArrayToPointCloud(i,i.byteLength,o)}if(!l.ok()||0===o.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const h={index:null,attributes:[]};for(const i in a){const l=self[s[i]];let c,A;if(r.useUniqueIDs)A=a[i],c=t.GetAttributeByUniqueId(o,A);else{if(A=t.GetAttributeId(o,e[a[i]]),-1===A)continue;c=t.GetAttribute(o,A)}const u=n(e,t,o,i,l,c);"color"===i&&(u.vertexColorSpace=r.vertexColorSpace),h.attributes.push(u)}return c===e.TRIANGULAR_MESH&&(h.index=function(e,t,n){const i=3*n.num_faces(),r=4*i,a=e._malloc(r);t.GetTrianglesUInt32Array(n,r,a);const s=new Uint32Array(e.HEAPF32.buffer,a,i).slice();return e._free(a),{array:s,itemSize:1}}(e,t,o)),e.destroy(o),h}(t,s,new Int8Array(i),a),o=e.attributes.map(e=>e.array.buffer);e.index&&o.push(e.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:e},o)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(s)}})}}}function AA(e,t){if(0===t)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2===t||1===t){let n=e.getIndex();if(null===n){const t=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<i.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}const i=n.count-2,r=[];if(2===t)for(let e=1;e<=i;e++)r.push(n.getX(0)),r.push(n.getX(e)),r.push(n.getX(e+1));else for(let e=0;e<i;e++)e%2==0?(r.push(n.getX(e)),r.push(n.getX(e+1)),r.push(n.getX(e+2))):(r.push(n.getX(e+2)),r.push(n.getX(e+1)),r.push(n.getX(e)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const a=e.clone();return a.setIndex(r),a.clearGroups(),a}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}class uA extends dc{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new CA(e)}),this.register(function(e){return new vA(e)}),this.register(function(e){return new EA(e)}),this.register(function(e){return new BA(e)}),this.register(function(e){return new TA(e)}),this.register(function(e){return new RA(e)}),this.register(function(e){return new _A(e)}),this.register(function(e){return new IA(e)}),this.register(function(e){return new xA(e)}),this.register(function(e){return new yA(e)}),this.register(function(e){return new mA(e)}),this.register(function(e){return new wA(e)}),this.register(function(e){return new bA(e)}),this.register(function(e){return new SA(e)}),this.register(function(e){return new MA(e)}),this.register(function(e){return new fA(e)}),this.register(function(e){return new DA(e)}),this.register(function(e){return new QA(e)})}load(e,t,n,i){const r=this;let a;if(""!==this.resourcePath)a=this.resourcePath;else if(""!==this.path){const t=Uc.extractUrlBase(e);a=Uc.resolveURL(t,this.path)}else a=Uc.extractUrlBase(e);this.manager.itemStart(e);const s=function(t){i?i(t):console.error(t),r.manager.itemError(e),r.manager.itemEnd(e)},o=new gc(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(n){try{r.parse(n,a,function(n){t(n),r.manager.itemEnd(e)},s)}catch(e){s(e)}},n,s)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}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,n,i){let r;const a={},s={},o=new TextDecoder;if("string"==typeof e)r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(o.decode(new Uint8Array(e,0,4))===UA){try{a[pA.KHR_BINARY_GLTF]=new LA(e)}catch(e){return void(i&&i(e))}r=JSON.parse(a[pA.KHR_BINARY_GLTF].content)}else r=JSON.parse(o.decode(e));else r=e;if(void 0===r.asset||r.asset.version[0]<2)return void(i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const l=new ru(r,{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++){const 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(r.extensionsUsed)for(let e=0;e<r.extensionsUsed.length;++e){const t=r.extensionsUsed[e],n=r.extensionsRequired||[];switch(t){case pA.KHR_MATERIALS_UNLIT:a[t]=new gA;break;case pA.KHR_DRACO_MESH_COMPRESSION:a[t]=new PA(r,this.dracoLoader);break;case pA.KHR_TEXTURE_TRANSFORM:a[t]=new NA;break;case pA.KHR_MESH_QUANTIZATION:a[t]=new FA;break;default:n.indexOf(t)>=0&&void 0===s[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(a),l.setPlugins(s),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,r){n.parse(e,t,i,r)})}}function dA(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const pA={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",DEEPAR_MATERIALS_DIAMOND:"DEEPAR_materials_diamond"};class fA{constructor(e){this.parser=e,this.name=pA.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const i=t[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const r=t.json,a=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let s;const o=new Ki(16777215);void 0!==a.color&&o.setRGB(a.color[0],a.color[1],a.color[2],It);const l=void 0!==a.range?a.range:0;switch(a.type){case"directional":s=new Qc(o),s.target.position.set(0,0,-1),s.add(s.target);break;case"point":s=new Rc(o),s.distance=l;break;case"spot":s=new wc(o),s.distance=l,a.spot=a.spot||{},a.spot.innerConeAngle=void 0!==a.spot.innerConeAngle?a.spot.innerConeAngle:0,a.spot.outerConeAngle=void 0!==a.spot.outerConeAngle?a.spot.outerConeAngle:Math.PI/4,s.angle=a.spot.outerConeAngle,s.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,s.target.position.set(0,0,-1),s.add(s.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return s.position.set(0,0,0),s.decay=2,ZA(s,a),void 0!==a.intensity&&(s.intensity=a.intensity),s.name=t.createUniqueName(a.name||"light_"+e),i=Promise.resolve(s),t.cache.add(n,i),i}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,i=n.json.nodes[e],r=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then(function(e){return n._getNodeRef(t.cache,r,e)})}}class gA{constructor(){this.name=pA.KHR_MATERIALS_UNLIT}getMaterialType(){return er}extendParams(e,t,n){const i=[];e.color=new Ki(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const t=r.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],It),e.opacity=t[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(e,"map",r.baseColorTexture,_t))}return Promise.all(i)}}class mA{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return void 0!==i&&(t.emissiveIntensity=i),Promise.resolve()}}class vA{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qo:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];if(void 0!==a.clearcoatFactor&&(t.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&r.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(r.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){const e=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new nn(e,e)}return Promise.all(r)}}class EA{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_DISPERSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qo:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.dispersion=void 0!==i.dispersion?i.dispersion:0,Promise.resolve()}}class bA{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qo:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return void 0!==a.iridescenceFactor&&(t.iridescence=a.iridescenceFactor),void 0!==a.iridescenceTexture&&r.push(n.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&&r.push(n.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(r)}}class CA{constructor(e){this.parser=e,this.name=pA.DEEPAR_MATERIALS_DIAMOND}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Yo:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();t.envMapIntensity=1,t.envMapRotation=0,t.rIndexDelta=.012,t.squashFactor=.98,t.geometryFactor=.5,t.gammaFactor=1,t.absorptionFactor=1,t.reflectivity=.5,t.diamondOrientedEnvMap=0,t.boostFactors=new Rn(1,1,1),t.fixedEnvMapDirection=!1,t.rayBounces=5,t.defines={RAY_BOUNCES:5};const i=n.extensions[this.name];if(void 0!==i.envMapIntensity&&(t.envMapIntensity=i.envMapIntensity),void 0!==i.envMapRotationOffset&&(t.envMapRotation=i.envMapRotationOffset),void 0!==i.dispersion&&(t.rIndexDelta=i.dispersion),void 0!==i.squashFactor&&(t.squashFactor=i.squashFactor),void 0!==i.geometryFactor&&(t.geometryFactor=i.geometryFactor),void 0!==i.gammaFactor&&(t.gammaFactor=i.gammaFactor),void 0!==i.absorptionFactor&&(t.absorptionFactor=i.absorptionFactor),void 0!==i.reflectivity&&(t.reflectivity=i.reflectivity),void 0!==i.diamondOrientedEnvMap&&(t.diamondOrientedEnvMap=i.diamondOrientedEnvMap),void 0!==i.boostFactors){const e=i.boostFactors;t.boostFactors.set(e[0],e[1],e[2])}return void 0!==i.fixedEnvMapDirection&&(t.fixedEnvMapDirection=i.fixedEnvMapDirection),void 0!==i.rayBounces&&(t.rayBounces=i.rayBounces,t.defines={RAY_BOUNCES:i.rayBounces}),Promise.resolve()}}class _A{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qo:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new Ki(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=i.extensions[this.name];if(void 0!==a.sheenColorFactor){const e=a.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],It)}return void 0!==a.sheenRoughnessFactor&&(t.sheenRoughness=a.sheenRoughnessFactor),void 0!==a.sheenColorTexture&&r.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,_t)),void 0!==a.sheenRoughnessTexture&&r.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(r)}}class IA{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qo:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&r.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(r)}}class xA{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qo:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];t.thickness=void 0!==a.thicknessFactor?a.thicknessFactor:0,void 0!==a.thicknessTexture&&r.push(n.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;const s=a.attenuationColor||[1,1,1];return t.attenuationColor=(new Ki).setRGB(s[0],s[1],s[2],It),Promise.all(r)}}class yA{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qo:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class wA{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qo:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];t.specularIntensity=void 0!==a.specularFactor?a.specularFactor:1,void 0!==a.specularTexture&&r.push(n.assignTexture(t,"specularIntensityMap",a.specularTexture));const s=a.specularColorFactor||[1,1,1];return t.specularColor=(new Ki).setRGB(s[0],s[1],s[2],It),void 0!==a.specularColorTexture&&r.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,_t)),Promise.all(r)}}class MA{constructor(e){this.parser=e,this.name=pA.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qo:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return t.bumpScale=void 0!==a.bumpFactor?a.bumpFactor:1,void 0!==a.bumpTexture&&r.push(n.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(r)}}class SA{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qo:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return void 0!==a.anisotropyStrength&&(t.anisotropy=a.anisotropyStrength),void 0!==a.anisotropyRotation&&(t.anisotropyRotation=a.anisotropyRotation),void 0!==a.anisotropyTexture&&r.push(n.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(r)}}class BA{constructor(e){this.parser=e,this.name=pA.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,a)}}class TA{constructor(e){this.parser=e,this.name=pA.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],s=i.images[a.source];let o=n.textureLoader;if(s.uri){const e=n.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then(function(r){if(r)return n.loadTextureImage(e,a.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class RA{constructor(e){this.parser=e,this.name=pA.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],s=i.images[a.source];let o=n.textureLoader;if(s.uri){const e=n.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then(function(r){if(r)return n.loadTextureImage(e,a.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class DA{constructor(e){this.name=pA.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const e=n.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(t){const n=e.byteOffset||0,i=e.byteLength||0,a=e.count,s=e.byteStride,o=new Uint8Array(t,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(a,s,o,e.mode,e.filter).then(function(e){return e.buffer}):r.ready.then(function(){const t=new ArrayBuffer(a*s);return r.decodeGltfBuffer(new Uint8Array(t),a,s,o,e.mode,e.filter),t})})}return null}}class QA{constructor(e){this.name=pA.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=t.meshes[n.mesh];for(const e of i.primitives)if(e.mode!==HA.TRIANGLES&&e.mode!==HA.TRIANGLE_STRIP&&e.mode!==HA.TRIANGLE_FAN&&void 0!==e.mode)return null;const r=n.extensions[this.name].attributes,a=[],s={};for(const e in r)a.push(this.parser.getDependency("accessor",r[e]).then(t=>(s[e]=t,s[e])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(e=>{const t=e.pop(),n=t.isGroup?t.children:[t],i=e[0].count,r=[];for(const e of n){const t=new oi,n=new Rn,a=new Tn,o=new Rn(1,1,1),l=new xl(e.geometry,e.material,i);for(let e=0;e<i;e++)s.TRANSLATION&&n.fromBufferAttribute(s.TRANSLATION,e),s.ROTATION&&a.fromBufferAttribute(s.ROTATION,e),s.SCALE&&o.fromBufferAttribute(s.SCALE,e),l.setMatrixAt(e,t.compose(n,a,o));for(const t in s)if("_COLOR_0"===t){const e=s[t];l.instanceColor=new gl(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,s[t]);Ui.prototype.copy.call(l,e),this.parser.assignFinalMaterial(l),r.push(l)}return t.isGroup?(t.clear(),t.add(...r),t):r[0]}))}}const UA="glTF";class LA{constructor(e){this.name=pA.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==UA)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-12,r=new DataView(e,12);let a=0;for(;a<i;){const t=r.getUint32(a,!0);a+=4;const i=r.getUint32(a,!0);if(a+=4,1313821514===i){const i=new Uint8Array(e,12+a,t);this.content=n.decode(i)}else if(5130562===i){const n=12+a;this.body=e.slice(n,n+t)}a+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class PA{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=pA.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,s={},o={},l={};for(const e in a){const t=jA[e]||e.toLowerCase();s[t]=a[e]}for(const t in e.attributes){const i=jA[t]||t.toLowerCase();if(void 0!==a[t]){const r=n.accessors[e.attributes[t]],a=zA[r.componentType];l[i]=a.name,o[i]=!0===r.normalized}}return t.getDependency("bufferView",r).then(function(e){return new Promise(function(t,n){i.decodeDracoFile(e,function(e){for(const t in e.attributes){const n=e.attributes[t],i=o[t];void 0!==i&&(n.normalized=i)}t(e)},s,l,It,n)})})}}class NA{constructor(){this.name=pA.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):e}}class FA{constructor(){this.name=pA.KHR_MESH_QUANTIZATION}}class OA extends Jl{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let e=0;e!==i;e++)t[e]=n[r+e];return t}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=2*s,l=3*s,c=i-t,h=(n-t)/c,A=h*h,u=A*h,d=e*l,p=d-l,f=-2*u+3*A,g=u-A,m=1-f,v=g-A+h;for(let e=0;e!==s;e++){const t=a[p+e+s],n=a[p+e+o]*c,i=a[d+e+s],l=a[d+e]*c;r[e]=m*t+v*n+f*i+g*l}return r}}const kA=new Tn;class GA extends OA{interpolate_(e,t,n,i){const r=super.interpolate_(e,t,n,i);return kA.fromArray(r).normalize().toArray(r),r}}const HA={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},zA={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},VA={9728:ze,9729:qe,9984:1004,9985:je,9986:We,9987:Ye},WA={33071:Ge,33648:He,10497:ke},qA={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},jA={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"},YA={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},XA={CUBICSPLINE:void 0,LINEAR:Et,STEP:vt};function KA(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new Wo({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function JA(e,t,n){for(const i in n.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i])}function ZA(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 $A(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let n=0,i=t.weights.length;n<i;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){const n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,i=n.length;t<i;t++)e.morphTargetDictionary[n[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function eu(e){let t;const n=e.extensions&&e.extensions[pA.KHR_DRACO_MESH_COMPRESSION];if(t=n?"draco:"+n.bufferView+":"+n.indices+":"+tu(n.attributes):e.indices+":"+tu(e.attributes)+":"+e.mode,void 0!==e.targets)for(let n=0,i=e.targets.length;n<i;n++)t+=":"+tu(e.targets[n]);return t}function tu(e){let t="";const n=Object.keys(e).sort();for(let i=0,r=n.length;i<r;i++)t+=n[i]+":"+e[n[i]]+";";return t}function nu(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 new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const iu=new oi;class ru{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new dA,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 n=!1,i=!1,r=-1;"undefined"!=typeof navigator&&(n=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),i=navigator.userAgent.indexOf("Firefox")>-1,r=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||n||i&&r<98?this.textureLoader=new Ec(this.options.manager):this.textureLoader=new Lc(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new gc(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){const n=this,i=this.json,r=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([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(t){const a={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:n,userData:{}};return JA(r,a,i),ZA(a,i),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(const e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,i=t.length;n<i;n++){const i=t[n].joints;for(let t=0,n=i.length;t<n;t++)e[i[t]].isBone=!0}for(let t=0,i=e.length;t<i;t++){const i=e[t];void 0!==i.mesh&&(this._addNodeRef(this.meshCache,i.mesh),void 0!==i.skin&&(n[i.mesh].isSkinnedMesh=!0)),void 0!==i.camera&&this._addNodeRef(this.cameraCache,i.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,n){if(e.refs[t]<=1)return n;const i=n.clone(),r=(e,t)=>{const n=this.associations.get(e);null!=n&&this.associations.set(t,n);for(const[n,i]of e.children.entries())r(i,t.children[n])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const r=e(t[i]);r&&n.push(r)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":i=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e)}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(i.map(function(t,i){return n.getDependency(e,i)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[pA.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(e,r){n.load(Uc.resolveURL(t.uri,i.path),e,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){const n=t.byteLength||0,i=t.byteOffset||0;return e.slice(i,i+n)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse){const e=qA[i.type],t=zA[i.componentType],n=!0===i.normalized,r=new t(i.count*e);return Promise.resolve(new ar(r,e,n))}const r=[];return void 0!==i.bufferView?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),void 0!==i.sparse&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then(function(e){const r=e[0],a=qA[i.type],s=zA[i.componentType],o=s.BYTES_PER_ELEMENT,l=o*a,c=i.byteOffset||0,h=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,A=!0===i.normalized;let u,d;if(h&&h!==l){const e=Math.floor(c/h),n="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+e+":"+i.count;let l=t.cache.get(n);l||(u=new s(r,e*h,i.count*h/o),l=new Zo(u,h/o),t.cache.add(n,l)),d=new el(l,a,c%h/o,A)}else u=null===r?new s(i.count*a):new s(r,c,i.count*a),d=new ar(u,a,A);if(void 0!==i.sparse){const t=qA.SCALAR,n=zA[i.sparse.indices.componentType],o=i.sparse.indices.byteOffset||0,l=i.sparse.values.byteOffset||0,c=new n(e[1],o,i.sparse.count*t),h=new s(e[2],l,i.sparse.count*a);null!==r&&(d=new ar(d.array.slice(),d.itemSize,d.normalized));for(let e=0,t=c.length;e<t;e++){const t=c[e];if(d.setX(t,h[e*a]),a>=2&&d.setY(t,h[e*a+1]),a>=3&&d.setZ(t,h[e*a+2]),a>=4&&d.setW(t,h[e*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return d})}loadTexture(e){const t=this.json,n=this.options,i=t.textures[e].source,r=t.images[i];let a=this.textureLoader;if(r.uri){const e=n.manager.getHandler(r.uri);null!==e&&(a=e)}return this.loadTextureImage(e,i,a)}loadTextureImage(e,t,n){const i=this,r=this.json,a=r.textures[e],s=r.images[t],o=(s.uri||s.bufferView)+":"+a.sampler;if(this.textureCache[o])return this.textureCache[o];const l=this.loadImageSource(t,n).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);const n=(r.samplers||{})[a.sampler]||{};return t.magFilter=VA[n.magFilter]||qe,t.minFilter=VA[n.minFilter]||Ye,t.wrapS=WA[n.wrapS]||ke,t.wrapT=WA[n.wrapT]||ke,i.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[o]=l,l}loadImageSource(e,t){const n=this.json,i=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());const r=n.images[e],a=self.URL||self.webkitURL;let s=r.uri||"",o=!1;if(void 0!==r.bufferView)s=this.getDependency("bufferView",r.bufferView).then(function(e){o=!0;const t=new Blob([e],{type:r.mimeType});return s=a.createObjectURL(t),s});else if(void 0===r.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const l=Promise.resolve(s).then(function(e){return new Promise(function(n,r){let a=n;!0===t.isImageBitmapLoader&&(a=function(e){const t=new xn(e);t.needsUpdate=!0,n(t)}),t.load(Uc.resolveURL(e,i.path),a,void 0,r)})}).then(function(e){var t;return!0===o&&a.revokeObjectURL(s),ZA(e,r),e.userData.mimeType=r.mimeType||((t=r.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":"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,n,i){const r=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((a=a.clone()).channel=n.texCoord),r.extensions[pA.KHR_TEXTURE_TRANSFORM]){const e=void 0!==n.extensions?n.extensions[pA.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=r.associations.get(a);a=r.extensions[pA.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),r.associations.set(a,t)}}return void 0!==i&&(a.colorSpace=i),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=void 0===t.attributes.tangent,r=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new Vo,$i.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new jo,$i.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(i||r||a){let e="ClonedMaterial:"+n.uuid+":";i&&(e+="derivative-tangents:"),r&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),r&&(t.vertexColors=!0),a&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return Wo}loadMaterial(e){const t=this,n=this.json,i=this.extensions,r=n.materials[e];let a;const s={},o=[];if((r.extensions||{})[pA.KHR_MATERIALS_UNLIT]){const e=i[pA.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),o.push(e.extendParams(s,r,t))}else{const n=r.pbrMetallicRoughness||{};if(s.color=new Ki(1,1,1),s.opacity=1,Array.isArray(n.baseColorFactor)){const e=n.baseColorFactor;s.color.setRGB(e[0],e[1],e[2],It),s.opacity=e[3]}void 0!==n.baseColorTexture&&o.push(t.assignTexture(s,"map",n.baseColorTexture,_t)),s.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,s.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(o.push(t.assignTexture(s,"metalnessMap",n.metallicRoughnessTexture)),o.push(t.assignTexture(s,"roughnessMap",n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),o.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)})))}!0===r.doubleSided&&(s.side=2);const l=r.alphaMode||"OPAQUE";if("BLEND"===l?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,"MASK"===l&&(s.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&a!==er&&(o.push(t.assignTexture(s,"normalMap",r.normalTexture)),s.normalScale=new nn(1,1),void 0!==r.normalTexture.scale)){const e=r.normalTexture.scale;s.normalScale.set(e,e)}if(void 0!==r.occlusionTexture&&a!==er&&(o.push(t.assignTexture(s,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(s.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&a!==er){const e=r.emissiveFactor;s.emissive=(new Ki).setRGB(e[0],e[1],e[2],It)}return void 0!==r.emissiveTexture&&a!==er&&o.push(t.assignTexture(s,"emissiveMap",r.emissiveTexture,_t)),Promise.all(o).then(function(){const n=new a(s);return r.name&&(n.name=r.name),ZA(n,r),t.associations.set(n,{materials:e}),r.extensions&&JA(i,n,r),n})}createUniqueName(e){const t=Vc.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function r(e){return n[pA.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return au(n,e,t)})}const a=[];for(let n=0,s=e.length;n<s;n++){const s=e[n],o=eu(s),l=i[o];if(l)a.push(l.promise);else{let e;e=s.extensions&&s.extensions[pA.KHR_DRACO_MESH_COMPRESSION]?r(s):au(new gr,s,t),i[o]={primitive:s,promise:e},a.push(e)}}return Promise.all(a)}loadMesh(e){const t=this,n=this.json,i=this.extensions,r=n.meshes[e],a=r.primitives,s=[];for(let e=0,t=a.length;e<t;e++){const t=void 0===a[e].material?KA(this.cache):this.getDependency("material",a[e].material);s.push(t)}return s.push(t.loadGeometries(a)),Promise.all(s).then(function(n){const s=n.slice(0,n.length-1),o=n[n.length-1],l=[];for(let n=0,c=o.length;n<c;n++){const c=o[n],h=a[n];let A;const u=s[n];if(h.mode===HA.TRIANGLES||h.mode===HA.TRIANGLE_STRIP||h.mode===HA.TRIANGLE_FAN||void 0===h.mode)A=!0===r.isSkinnedMesh?new hl(c,u):new Ur(c,u),!0===A.isSkinnedMesh&&A.normalizeSkinWeights(),h.mode===HA.TRIANGLE_STRIP?A.geometry=AA(A.geometry,1):h.mode===HA.TRIANGLE_FAN&&(A.geometry=AA(A.geometry,2));else if(h.mode===HA.LINES)A=new Pl(c,u);else if(h.mode===HA.LINE_STRIP)A=new Dl(c,u);else if(h.mode===HA.LINE_LOOP)A=new Nl(c,u);else{if(h.mode!==HA.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);A=new Hl(c,u)}Object.keys(A.geometry.morphAttributes).length>0&&$A(A,r),A.name=t.createUniqueName(r.name||"mesh_"+e),ZA(A,r),h.extensions&&JA(i,A,h),t.assignFinalMaterial(A),A.computeOffsets(),l.push(A)}for(let n=0,i=l.length;n<i;n++)t.associations.set(l[n],{meshes:e,primitives:n});if(1===l.length)return r.extensions&&JA(i,l[0],r),l[0];const c=new Uo;r.extensions&&JA(i,c,r),t.associations.set(c,{meshes:e});for(let e=0,t=l.length;e<t;e++)c.add(l[e]);return c})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(i)return"perspective"===n.type?t=new qr(tn(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(t=new Ea(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),ZA(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],n=[];for(let e=0,i=t.joints.length;e<i;e++)n.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(e){const n=e.pop(),i=e,r=[],a=[];for(let e=0,s=i.length;e<s;e++){const s=i[e];if(s){r.push(s);const t=new oi;null!==n&&t.fromArray(n.array,16*e),a.push(t)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new fl(r,a)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,a=[],s=[],o=[],l=[],c=[];for(let e=0,t=i.channels.length;e<t;e++){const t=i.channels[e],n=i.samplers[t.sampler],r=t.target,h=r.node,A=void 0!==i.parameters?i.parameters[n.input]:n.input,u=void 0!==i.parameters?i.parameters[n.output]:n.output;void 0!==r.node&&(a.push(this.getDependency("node",h)),s.push(this.getDependency("accessor",A)),o.push(this.getDependency("accessor",u)),l.push(n),c.push(r))}return Promise.all([Promise.all(a),Promise.all(s),Promise.all(o),Promise.all(l),Promise.all(c)]).then(function(e){const t=e[0],i=e[1],a=e[2],s=e[3],o=e[4],l=[];for(let e=0,r=t.length;e<r;e++){const r=t[e],c=i[e],h=a[e],A=s[e],u=o[e];if(void 0===r)continue;r.updateMatrix&&r.updateMatrix();const d=n._createAnimationTracks(r,c,h,A,u);if(d)for(let e=0;e<d.length;e++)l.push(d[e])}return new cc(r,void 0,l)})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return void 0===i.mesh?null:n.getDependency("mesh",i.mesh).then(function(e){const t=n._getNodeRef(n.meshCache,i.mesh,e);return void 0!==i.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,n=i.weights.length;t<n;t++)e.morphTargetInfluences[t]=i.weights[t]}),t})}loadNode(e){const t=this,n=this.json.nodes[e],i=t._loadNodeShallow(e),r=[],a=n.children||[];for(let e=0,n=a.length;e<n;e++)r.push(t.getDependency("node",a[e]));const s=void 0===n.skin?Promise.resolve(null):t.getDependency("skin",n.skin);return Promise.all([i,Promise.all(r),s]).then(function(e){const t=e[0],n=e[1],i=e[2];null!==i&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(i,iu)});for(let e=0,i=n.length;e<i;e++)t.add(n[e]);return t})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const r=t.nodes[e],a=r.name?i.createUniqueName(r.name):"",s=[],o=i._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return o&&s.push(o),void 0!==r.camera&&s.push(i.getDependency("camera",r.camera).then(function(e){return i._getNodeRef(i.cameraCache,r.camera,e)})),i._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===r.isBone?new Al:t.length>1?new Uo:1===t.length?t[0]:new Ui,s!==t[0])for(let e=0,n=t.length;e<n;e++)s.add(t[e]);if(r.name&&(s.userData.name=r.name,s.name=a),ZA(s,r),r.extensions&&JA(n,s,r),void 0!==r.matrix){const e=new oi;e.fromArray(r.matrix),s.applyMatrix4(e)}else void 0!==r.translation&&s.position.fromArray(r.translation),void 0!==r.rotation&&s.quaternion.fromArray(r.rotation),void 0!==r.scale&&s.scale.fromArray(r.scale);return i.associations.has(s)||i.associations.set(s,{}),i.associations.get(s).nodes=e,s}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,r=new Uo;n.name&&(r.name=i.createUniqueName(n.name)),ZA(r,n),n.extensions&&JA(t,r,n);const a=n.nodes||[],s=[];for(let e=0,t=a.length;e<t;e++)s.push(i.getDependency("node",a[e]));return Promise.all(s).then(function(e){for(let t=0,n=e.length;t<n;t++)r.add(e[t]);return i.associations=(e=>{const t=new Map;for(const[e,n]of i.associations)(e instanceof $i||e instanceof xn)&&t.set(e,n);return e.traverse(e=>{const n=i.associations.get(e);null!=n&&t.set(e,n)}),t})(r),r.userData.isDiamondScene=i._sceneContainsDiamondMaterial(r),r})}_sceneContainsDiamondMaterial(e){let t=!1;return e.traverse(e=>{e.material&&e.material.isMeshDiamondMaterial&&(t=!0)}),t}_createAnimationTracks(e,t,n,i,r){const a=[],s=e.name?e.name:e.uuid,o=[];let l;switch(YA[r.path]===YA.weights?e.traverse(function(e){e.morphTargetInfluences&&o.push(e.name?e.name:e.uuid)}):o.push(s),YA[r.path]){case YA.weights:l=rc;break;case YA.rotation:l=sc;break;case YA.position:case YA.scale:l=lc;break;default:l=1===n.itemSize?rc:lc}const c=void 0!==i.interpolation?XA[i.interpolation]:Et,h=this._getArrayFromAccessor(n);for(let e=0,n=o.length;e<n;e++){const n=new l(o[e]+"."+YA[r.path],t.array,h,c);"CUBICSPLINE"===i.interpolation&&this._createCubicSplineTrackInterpolant(n),a.push(n)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=nu(t.constructor),n=new Float32Array(t.length);for(let i=0,r=t.length;i<r;i++)n[i]=t[i]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof sc?GA:OA)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function au(e,t,n){const i=t.attributes,r=[];function a(t,i){return n.getDependency("accessor",t).then(function(t){e.setAttribute(i,t)})}for(const t in i){const n=jA[t]||t.toLowerCase();n in e.attributes||r.push(a(i[t],n))}if(void 0!==t.indices&&!e.index){const i=n.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});r.push(i)}return fn.workingColorSpace!==It&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${fn.workingColorSpace}" not supported.`),ZA(e,t),function(e,t,n){const i=t.attributes,r=new Un;if(void 0===i.POSITION)return;{const e=n.json.accessors[i.POSITION],t=e.min,a=e.max;if(void 0===t||void 0===a)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(r.set(new Rn(t[0],t[1],t[2]),new Rn(a[0],a[1],a[2])),e.normalized){const t=nu(zA[e.componentType]);r.min.multiplyScalar(t),r.max.multiplyScalar(t)}}const a=t.targets;if(void 0!==a){const e=new Rn,t=new Rn;for(let i=0,r=a.length;i<r;i++){const r=a[i];if(void 0!==r.POSITION){const i=n.json.accessors[r.POSITION],a=i.min,s=i.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]))),i.normalized){const e=nu(zA[i.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(e)}e.boundingBox=r;const s=new Zn;r.getCenter(s.center),s.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=s}(e,t,n),Promise.all(r).then(function(){return void 0!==t.targets?function(e,t,n){let i=!1,r=!1,a=!1;for(let e=0,n=t.length;e<n;e++){const n=t[e];if(void 0!==n.POSITION&&(i=!0),void 0!==n.NORMAL&&(r=!0),void 0!==n.COLOR_0&&(a=!0),i&&r&&a)break}if(!i&&!r&&!a)return Promise.resolve(e);const s=[],o=[],l=[];for(let c=0,h=t.length;c<h;c++){const h=t[c];if(i){const t=void 0!==h.POSITION?n.getDependency("accessor",h.POSITION):e.attributes.position;s.push(t)}if(r){const t=void 0!==h.NORMAL?n.getDependency("accessor",h.NORMAL):e.attributes.normal;o.push(t)}if(a){const t=void 0!==h.COLOR_0?n.getDependency("accessor",h.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(s),Promise.all(o),Promise.all(l)]).then(function(t){const n=t[0],s=t[1],o=t[2];return i&&(e.morphAttributes.position=n),r&&(e.morphAttributes.normal=s),a&&(e.morphAttributes.color=o),e.morphTargetsRelative=!0,e})}(e,t.targets,n):e})}class su{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const 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){const n=this.workersResolve[e];if(n&&n(t),this.queue.length){const{resolve:t,msg:n,transfer:i}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(n,i)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(n=>{const i=this._getIdleWorker();-1!==i?(this._initWorker(i),this.workerStatus|=1<<i,this.workersResolve[i]=n,this.workers[i].postMessage(e,t)):this.queue.push({resolve:n,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}}const ou=9,lu=15,cu=16,hu=22,Au=37,uu=43,du=76,pu=83,fu=97,gu=100,mu=103,vu=109,Eu=165,bu=166;class Cu{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize: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:[]}],this.keyValue={},this.globalData=null}}class _u{constructor(e,t,n,i){this._dataView=new DataView(e.buffer,e.byteOffset+t,n),this._littleEndian=i,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_skip(e){return this._offset+=e,this}_scan(e,t=0){const n=this._offset;let i=0;for(;this._dataView.getUint8(this._offset)!==t&&i<e;)i++,this._offset++;return i<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,i)}}const Iu=[171,75,84,88,32,50,48,187,13,10,26,10];function xu(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):Buffer.from(e).toString("utf8")}let yu,wu,Mu;const Su={env:{emscripten_notify_memory_growth:function(e){Mu=new Uint8Array(wu.exports.memory.buffer)}}};class Bu{init(){return yu||(yu="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+Tu).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,Su)).then(this._init):WebAssembly.instantiate(Buffer.from(Tu,"base64"),Su).then(this._init),yu)}_init(e){wu=e.instance,Su.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!wu)throw new Error("ZSTDDecoder: Await .init() before decoding.");const n=e.byteLength,i=wu.exports.malloc(n);Mu.set(e,i),t=t||Number(wu.exports.ZSTD_findDecompressedSize(i,n));const r=wu.exports.malloc(t),a=wu.exports.ZSTD_decompress(r,t,i,n),s=Mu.slice(r,r+a);return wu.exports.free(i),wu.exports.free(r),s}}const Tu="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IAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQh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ASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigC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C0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdB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IAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/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/QQ8hAiABIABJBEAgAUEE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",Ru=new WeakMap;let Du,Qu=0;class Uu extends dc{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new su,this.workerSourceURL="",this.workerConfig=null,"undefined"!=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 this.workerConfig={astcSupported:await e.hasFeatureAsync("texture-compression-astc"),etc1Supported:await e.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await e.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await e.hasFeatureAsync("texture-compression-bc"),bptcSupported:await e.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await e.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:e.hasFeature("texture-compression-bptc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),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")},this}init(){if(!this.transcoderPending){const e=new gc(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),n=new gc(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);const i=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,i]).then(([e,t])=>{const n=Uu.BasisWorker.toString(),i=["/* constants */","let _EngineFormat = "+JSON.stringify(Uu.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(Uu.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Uu.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i])),this.transcoderBinary=t,this.workerPool.setWorkerCreator(()=>{const e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e})}),Qu>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Qu++}return this.transcoderPending}load(e,t,n,i){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const r=new gc(this.manager);r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials),r.load(e,e=>{if(Ru.has(e))return Ru.get(e).promise.then(t).catch(i);this._createTexture(e).then(e=>t?t(e):null).catch(i)},n,i)}_createTextureFrom(e,t){const{faces:n,width:i,height:r,format:a,type:s,error:o,dfdFlags:l}=e;if("error"===s)return Promise.reject(o);let c;if(6===t.faceCount)c=new ql(n,a,Xe);else{const e=n[0].mipmaps;c=t.layerCount>1?new Wl(e,i,r,t.layerCount,a,Xe):new Vl(e,i,r,a,Xe)}return c.minFilter=1===n[0].mipmaps.length?qe:Ye,c.magFilter=qe,c.generateMipmaps=!1,c.needsUpdate=!0,c.colorSpace=Fu(t),c.premultiplyAlpha=!!(1&l),c}async _createTexture(e,t={}){const n=function(e){const t=new Uint8Array(e.buffer,e.byteOffset,Iu.length);if(t[0]!==Iu[0]||t[1]!==Iu[1]||t[2]!==Iu[2]||t[3]!==Iu[3]||t[4]!==Iu[4]||t[5]!==Iu[5]||t[6]!==Iu[6]||t[7]!==Iu[7]||t[8]!==Iu[8]||t[9]!==Iu[9]||t[10]!==Iu[10]||t[11]!==Iu[11])throw new Error("Missing KTX 2.0 identifier.");const n=new Cu,i=17*Uint32Array.BYTES_PER_ELEMENT,r=new _u(e,Iu.length,i,!0);n.vkFormat=r._nextUint32(),n.typeSize=r._nextUint32(),n.pixelWidth=r._nextUint32(),n.pixelHeight=r._nextUint32(),n.pixelDepth=r._nextUint32(),n.layerCount=r._nextUint32(),n.faceCount=r._nextUint32();const a=r._nextUint32();n.supercompressionScheme=r._nextUint32();const s=r._nextUint32(),o=r._nextUint32(),l=r._nextUint32(),c=r._nextUint32(),h=r._nextUint64(),A=r._nextUint64(),u=new _u(e,Iu.length+i,3*a*8,!0);for(let t=0;t<a;t++)n.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+u._nextUint64(),u._nextUint64()),uncompressedByteLength:u._nextUint64()});const d=new _u(e,s,o,!0),p={vendorId:d._skip(4)._nextUint16(),descriptorType:d._nextUint16(),versionNumber:d._nextUint16(),descriptorBlockSize:d._nextUint16(),colorModel:d._nextUint8(),colorPrimaries:d._nextUint8(),transferFunction:d._nextUint8(),flags:d._nextUint8(),texelBlockDimension:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],bytesPlane:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],samples:[]},f=(p.descriptorBlockSize/4-6)/4;for(let e=0;e<f;e++){const t={bitOffset:d._nextUint16(),bitLength:d._nextUint8(),channelType:d._nextUint8(),samplePosition:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=d._nextInt32(),t.sampleUpper=d._nextInt32()):(t.sampleLower=d._nextUint32(),t.sampleUpper=d._nextUint32()),p.samples[e]=t}n.dataFormatDescriptor.length=0,n.dataFormatDescriptor.push(p);const g=new _u(e,l,c,!0);for(;g._offset<c;){const e=g._nextUint32(),t=g._scan(e),i=xu(t),r=g._scan(e-t.byteLength);n.keyValue[i]=i.match(/^ktx/i)?xu(r):r,g._offset%4&&g._skip(4-g._offset%4)}if(A<=0)return n;const m=new _u(e,h,A,!0),v=m._nextUint16(),E=m._nextUint16(),b=m._nextUint32(),C=m._nextUint32(),_=m._nextUint32(),I=m._nextUint32(),x=[];for(let e=0;e<a;e++)x.push({imageFlags:m._nextUint32(),rgbSliceByteOffset:m._nextUint32(),rgbSliceByteLength:m._nextUint32(),alphaSliceByteOffset:m._nextUint32(),alphaSliceByteLength:m._nextUint32()});const y=h+m._offset,w=y+b,M=w+C,S=M+_,B=new Uint8Array(e.buffer,e.byteOffset+y,b),T=new Uint8Array(e.buffer,e.byteOffset+w,C),R=new Uint8Array(e.buffer,e.byteOffset+M,_),D=new Uint8Array(e.buffer,e.byteOffset+S,I);return n.globalData={endpointCount:v,selectorCount:E,imageDescs:x,endpointsData:B,selectorsData:T,tablesData:R,extendedData:D},n}(new Uint8Array(e));if(0!==n.vkFormat)return async function(e){const{vkFormat:t}=e;if(void 0===Pu[t])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let n;2===e.supercompressionScheme&&(Du||(Du=new Promise(async e=>{const t=new Bu;await t.init(),e(t)})),n=await Du);const i=[];for(let r=0;r<e.levels.length;r++){const a=Math.max(1,e.pixelWidth>>r),s=Math.max(1,e.pixelHeight>>r),o=e.pixelDepth?Math.max(1,e.pixelDepth>>r):0,l=e.levels[r];let c,h;if(0===e.supercompressionScheme)c=l.levelData;else{if(2!==e.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");c=n.decode(l.levelData,l.uncompressedByteLength)}h=Nu[t]===Ze?new Float32Array(c.buffer,c.byteOffset,c.byteLength/Float32Array.BYTES_PER_ELEMENT):Nu[t]===$e?new Uint16Array(c.buffer,c.byteOffset,c.byteLength/Uint16Array.BYTES_PER_ELEMENT):c,i.push({data:h,width:a,height:s,depth:o})}let r;if(Lu.has(Pu[t]))r=0===e.pixelDepth?new ul(i[0].data,e.pixelWidth,e.pixelHeight):new Bn(i[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");r=new Vl(i,e.pixelWidth,e.pixelHeight)}return r.mipmaps=i,r.type=Nu[t],r.format=Pu[t],r.colorSpace=Fu(e),r.needsUpdate=!0,Promise.resolve(r)}(n);const i=t,r=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:i},[e])).then(e=>this._createTextureFrom(e.data,n));return Ru.set(e,{promise:r}),r}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Qu--,this}}Uu.BasisFormat={ETC1S:0,UASTC_4x4:1},Uu.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},Uu.EngineFormat={RGBAFormat:tt,RGBA_ASTC_4x4_Format:ft,RGBA_BPTC_Format:mt,RGBA_ETC2_EAC_Format:pt,RGBA_PVRTC_4BPPV1_Format:At,RGBA_S3TC_DXT5_Format:ct,RGB_ETC1_Format:ut,RGB_ETC2_Format:dt,RGB_PVRTC_4BPPV1_Format:ht,RGBA_S3TC_DXT1_Format:ot},Uu.BasisWorker=function(){let e,t,n;const i=_EngineFormat,r=_TranscoderFormat,a=_BasisFormat;self.addEventListener("message",function(s){const A=s.data;switch(A.type){case"init":e=A.config,u=A.transcoderBinary,t=new Promise(e=>{n={wasmBinary:u,onRuntimeInitialized:e},BASIS(n)}).then(()=>{n.initializeBasis(),void 0===n.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")});break;case"transcode":t.then(()=>{try{const{faces:t,buffers:s,width:u,height:d,hasAlpha:p,format:f,dfdFlags:g}=function(t){const s=new n.KTX2File(new Uint8Array(t));function A(){s.close(),s.delete()}if(!s.isValid())throw A(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");const u=s.isUASTC()?a.UASTC_4x4:a.ETC1S,d=s.getWidth(),p=s.getHeight(),f=s.getLayers()||1,g=s.getLevels(),m=s.getFaces(),v=s.getHasAlpha(),E=s.getDFDFlags(),{transcoderFormat:b,engineFormat:C}=function(t,n,s,h){let A,u;const d=t===a.ETC1S?o:l;for(let i=0;i<d.length;i++){const r=d[i];if(e[r.if]&&r.basisFormat.includes(t)&&!(h&&r.transcoderFormat.length<2)&&(!r.needsPowerOfTwo||c(n)&&c(s)))return A=r.transcoderFormat[h?1:0],u=r.engineFormat[h?1:0],{transcoderFormat:A,engineFormat:u}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),A=r.RGBA32,u=i.RGBAFormat,{transcoderFormat:A,engineFormat:u}}(u,d,p,v);if(!d||!p||!g)throw A(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!s.startTranscoding())throw A(),new Error("THREE.KTX2Loader: .startTranscoding failed");const _=[],I=[];for(let e=0;e<m;e++){const t=[];for(let n=0;n<g;n++){const i=[];let r,a;for(let t=0;t<f;t++){const o=s.getImageLevelInfo(n,t,e);0!==e||0!==n||0!==t||o.origWidth%4==0&&o.origHeight%4==0||console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),g>1?(r=o.origWidth,a=o.origHeight):(r=o.width,a=o.height);const l=new Uint8Array(s.getImageTranscodedSizeInBytes(n,t,0,b));if(!s.transcodeImage(l,n,t,e,b,0,-1,-1))throw A(),new Error("THREE.KTX2Loader: .transcodeImage failed.");i.push(l)}const o=h(i);t.push({data:o,width:r,height:a}),I.push(o.buffer)}_.push({mipmaps:t,width:d,height:p,format:C})}return A(),{faces:_,buffers:I,width:d,height:p,hasAlpha:v,format:C,dfdFlags:E}}(A.buffer);self.postMessage({type:"transcode",id:A.id,faces:t,width:u,height:d,hasAlpha:p,format:f,dfdFlags:g},s)}catch(e){console.error(e),self.postMessage({type:"error",id:A.id,error:e.message})}})}var u});const s=[{if:"astcSupported",basisFormat:[a.UASTC_4x4],transcoderFormat:[r.ASTC_4x4,r.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.BC7_M5,r.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.BC1,r.BC3],engineFormat:[i.RGBA_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.ETC1,r.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.ETC1],engineFormat:[i.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.PVRTC1_4_RGB,r.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],o=s.sort(function(e,t){return e.priorityETC1S-t.priorityETC1S}),l=s.sort(function(e,t){return e.priorityUASTC-t.priorityUASTC});function c(e){return e<=2||!(e&e-1)&&0!==e}function h(e){if(1===e.length)return e[0];let t=0;for(let n=0;n<e.length;n++)t+=e[n].byteLength;const n=new Uint8Array(t);let i=0;for(let t=0;t<e.length;t++){const r=e[t];n.set(r,i),i+=r.byteLength}return n}};const Lu=new Set([tt,at,rt]),Pu={[vu]:tt,[fu]:tt,[Au]:tt,[uu]:tt,[mu]:at,[pu]:at,[cu]:at,[hu]:at,[gu]:rt,[du]:rt,[lu]:rt,[ou]:rt,[bu]:gt,[Eu]:gt},Nu={[vu]:Ze,[fu]:$e,[Au]:Xe,[uu]:Xe,[mu]:Ze,[pu]:$e,[cu]:Xe,[hu]:Xe,[gu]:Ze,[du]:$e,[lu]:Xe,[ou]:Xe,[bu]:Xe,[Eu]:Xe};function Fu(e){const t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?_t:It:10===t.colorPrimaries?2===t.transferFunction?xt:yt:(0===t.colorPrimaries||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),Ct)}let Ou=null;const ku=e=>{Ou=null==e?null:e.endsWith("/")?e.substring(0,e.length-1):e},Gu=()=>null!=Ou?`${Ou}/libs`:"https://cdn.jsdelivr.net/npm/three@0.165.0/examples/jsm/libs",Hu=(()=>{const e=(()=>{var e;if(null===(e=document.documentElement.getAttribute("itemtype"))||void 0===e?void 0:e.includes("schema.org/SearchResultsPage"))return!0;const t=null!=document.head?Array.from(document.head.querySelectorAll("meta")):[];for(const e of t)if("viewport"===e.name)return!0;return!1})();return e||console.error('No <meta name="viewport"> detected. This might cause ShopAR to crash on iOS.\nPlease add the following line to your HTML:\n<meta name="viewport" content="width=device-width, initial-scale=1.0">'),()=>e?Math.min(window.devicePixelRatio||1,2):1})(),zu=new Ki(16777215);let Vu,Wu,qu=!1,ju=1,Yu=1,Xu=1;function Ku(){return Ju(),Vu}function Ju(){if(qu)return;Xu=Hu(),Wu=document.createElement("canvas");const e=Wu.style;e.position="absolute",e.top="0",e.left="0",e.width="100%",e.height="100%",Vu=new Jo({powerPreference:"high-performance",canvas:Wu,antialias:!0,alpha:!0}),Vu.outputColorSpace=_t,Vu.toneMapping=4,Vu.setClearColor(new Ki(16777215),0),qu=!0}function Zu(e,t,n,i,r){const{width:a,height:s}=t,o=Vu.toneMapping,l=Vu.toneMappingExposure;if(Vu.toneMapping=i,Vu.toneMappingExposure=r,Vu.setViewport(0,0,a,s),Vu.setClearColor(zu,n),e.setSize(a,s),e.render(),Vu.toneMapping=o,Vu.toneMappingExposure=l,t.isBlitted()){const{context2d:e}=t;if(null==e)return;e.clearRect(0,0,a,s),Wu.width>0&&Wu.height>0&&e.drawImage(Wu,0,Yu-s,a,s,0,0,a,s)}}function $u(e,t){const n=Hu();e=Math.ceil(e*n),t=Math.ceil(t*n),e===ju&&t===Yu&&n===Xu||(ju=e,Yu=t,Xu=n,Ku().setSize(ju,Yu,!1))}function ed(e,t){Ku().renderCubeMapNormals(e),e.traverse(e=>{e instanceof Ur&&e.material&&e.material.isMeshDiamondMaterial&&(e.material.envMap=t)})}let td,nd=!1;function id(e){return nd||rd(),td.parseAsync(e.buffer,"")}function rd(){if(nd)return;const e=(new cA).setDecoderPath(`${Gu()}/draco/gltf/`);e.preload();const t=(new Uu).setTranscoderPath(`${Gu()}/basis/`).detectSupport(Ku());td=(new uA).setDRACOLoader(e).setKTX2Loader(t).setMeshoptDecoder(oA),nd=!0}function ad(e){null!=e&&(Object.values(e).forEach(e=>{(null==e?void 0:e.dispose)instanceof Function&&e.dispose()}),e.dispose())}function sd(e,t,n,i,r,a){if(null==e)return new Rn;const s=od(e,i,r,new Rn),o=ld(e);od(e,s.scale,s.quaternion,s.position);const l=o.getSize(new Rn),c=o.getCenter(new Rn);let h=0;return h=l.x/2+t/2,n&&(h=-h),new Rn(-c.x+h,-c.y+l.y/2,-c.z)}function od(e,t,n,i){let r,a,s;return null!=t&&(r=e.scale.x,e.scale.set(t,t,t)),null!=n&&(a=e.quaternion.clone(),e.quaternion.copy(n)),null!=i&&(s=e.position.clone(),e.position.copy(i)),{scale:r,quaternion:a,position:s}}function ld(e){return(new Un).setFromObject(e,!0)}function cd(e){e.traverse(e=>{var t;e instanceof Ur&&(null===(t=e.geometry)||void 0===t||t.dispose(),Array.isArray(e.material)?e.material.forEach(ad):ad(e.material))}),e.clear()}const hd={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor = opacity * texel;\n\n\n\t\t}"};class Ad{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const ud=new Ea(-1,1,1,-1,0,1),dd=new class extends gr{constructor(){super(),this.setAttribute("position",new lr([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new lr([0,2,0,0,2,0],2))}};class pd{constructor(e){this._mesh=new Ur(dd,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,ud)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class fd extends Ad{constructor(e,t){super(),this.textureID=void 0!==t?t:"tDiffuse",e instanceof Gr?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=kr.clone(e.uniforms),this.material=new Gr({name:void 0!==e.name?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new pd(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class gd extends Ad{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const i=e.getContext(),r=e.state;let a,s;r.buffers.color.setMask(!1),r.buffers.depth.setMask(!1),r.buffers.color.setLocked(!0),r.buffers.depth.setLocked(!0),this.inverse?(a=0,s=1):(a=1,s=0),r.buffers.stencil.setTest(!0),r.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),r.buffers.stencil.setFunc(i.ALWAYS,a,4294967295),r.buffers.stencil.setClear(s),r.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),r.buffers.color.setLocked(!1),r.buffers.depth.setLocked(!1),r.buffers.color.setMask(!0),r.buffers.depth.setMask(!0),r.buffers.stencil.setLocked(!1),r.buffers.stencil.setFunc(i.EQUAL,1,4294967295),r.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),r.buffers.stencil.setLocked(!0)}}class md extends Ad{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class vd{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),void 0===t){const n=e.getSize(new nn);this._width=n.width,this._height=n.height,(t=new Mn(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:$e})).texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new fd(hd),this.copyPass.material.blending=0,this.clock=new Pc}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);-1!==t&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){void 0===e&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let n=!1;for(let t=0,i=this.passes.length;t<i;t++){const i=this.passes[t];if(!1!==i.enabled){if(i.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(t),i.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),i.needsSwap){if(n){const t=this.renderer.getContext(),n=this.renderer.state.buffers.stencil;n.setFunc(t.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),n.setFunc(t.EQUAL,1,4294967295)}this.swapBuffers()}void 0!==gd&&(i instanceof gd?n=!0:i instanceof md&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(void 0===e){const t=this.renderer.getSize(new nn);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,i=this._height*this._pixelRatio;this.renderTarget1.setSize(n,i),this.renderTarget2.setSize(n,i);for(let e=0;e<this.passes.length;e++)this.passes[e].setSize(n,i)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}const Ed={name:"OutputShader",uniforms:{tDiffuse:{value:null},toneMappingExposure:{value:1}},vertexShader:"\n\t\tprecision highp float;\n\n\t\tuniform mat4 modelViewMatrix;\n\t\tuniform mat4 projectionMatrix;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\t\n\t\tprecision highp float;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\t#include <tonemapping_pars_fragment>\n\t\t#include <colorspace_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\n\t\t\t// tone mapping\n\n\t\t\t#ifdef LINEAR_TONE_MAPPING\n\n\t\t\t\tgl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( REINHARD_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( CINEON_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = OptimizedCineonToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( ACES_FILMIC_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( AGX_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( NEUTRAL_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );\n\n\t\t\t#endif\n\n\t\t\t// color space\n\n\t\t\t#ifdef SRGB_TRANSFER\n\n\t\t\t\tgl_FragColor = sRGBTransferOETF( gl_FragColor );\n\n\t\t\t#endif\n\n\t\t}"};class bd extends Ad{constructor(){super();const e=Ed;this.uniforms=kr.clone(e.uniforms),this.material=new zo({name:e.name,uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader}),this.fsQuad=new pd(this.material),this._outputColorSpace=null,this._toneMapping=null}render(e,t,n){this.uniforms.tDiffuse.value=n.texture,this.uniforms.toneMappingExposure.value=e.toneMappingExposure,this._outputColorSpace===e.outputColorSpace&&this._toneMapping===e.toneMapping||(this._outputColorSpace=e.outputColorSpace,this._toneMapping=e.toneMapping,this.material.defines={},fn.getTransfer(this._outputColorSpace)===Mt&&(this.material.defines.SRGB_TRANSFER=""),1===this._toneMapping?this.material.defines.LINEAR_TONE_MAPPING="":2===this._toneMapping?this.material.defines.REINHARD_TONE_MAPPING="":3===this._toneMapping?this.material.defines.CINEON_TONE_MAPPING="":4===this._toneMapping?this.material.defines.ACES_FILMIC_TONE_MAPPING="":6===this._toneMapping?this.material.defines.AGX_TONE_MAPPING="":7===this._toneMapping&&(this.material.defines.NEUTRAL_TONE_MAPPING=""),this.material.needsUpdate=!0),!0===this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class Cd extends Ad{constructor(e,t,n=null,i=null,r=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=i,this.clearAlpha=r,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new Ki}render(e,t,n){const i=e.autoClear;let r,a;e.autoClear=!1,null!==this.overrideMaterial&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),null!==this.clearColor&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),null!==this.clearAlpha&&(r=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),1==this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),!0===this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),null!==this.clearColor&&e.setClearColor(this._oldClearColor),null!==this.clearAlpha&&e.setClearAlpha(r),null!==this.overrideMaterial&&(this.scene.overrideMaterial=a),e.autoClear=i}}const _d={uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new Ki(0)},defaultOpacity:{value:0}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform vec3 defaultColor;\n\t\tuniform float defaultOpacity;\n\t\tuniform float luminosityThreshold;\n\t\tuniform float smoothWidth;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n\t\t\tfloat v = dot( texel.xyz, luma );\n\n\t\t\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n\t\t\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n\t\t\tgl_FragColor = mix( outputColor, texel, alpha );\n\t\t\tgl_FragColor.rgb = max( gl_FragColor.rgb, vec3( 0.0 ) );\n\n\t\t}"};class Id extends Ad{constructor(e,t,n,i){super(),this.strength=void 0!==t?t:1,this.radius=n,this.threshold=i,this.resolution=void 0!==e?new nn(e.x,e.y):new nn(256,256),this.clearColor=new Ki(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let r=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);this.renderTargetBright=new Mn(r,a,{type:$e}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let e=0;e<this.nMips;e++){const t=new Mn(r,a,{type:$e});t.texture.name="UnrealBloomPass.h"+e,t.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(t);const n=new Mn(r,a,{type:$e});n.texture.name="UnrealBloomPass.v"+e,n.texture.generateMipmaps=!1,this.renderTargetsVertical.push(n),r=Math.round(r/2),a=Math.round(a/2)}const s=_d;this.highPassUniforms=kr.clone(s.uniforms),this.highPassUniforms.luminosityThreshold.value=i,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new Gr({uniforms:this.highPassUniforms,vertexShader:s.vertexShader,fragmentShader:s.fragmentShader}),this.separableBlurMaterials=[];const o=[3,5,7,9,11];r=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);for(let e=0;e<this.nMips;e++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(o[e])),this.separableBlurMaterials[e].uniforms.invSize.value=new nn(1/r,1/a),r=Math.round(r/2),a=Math.round(a/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=t,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],this.bloomTintColors=[new Rn(1,1,1),new Rn(1,1,1),new Rn(1,1,1),new Rn(1,1,1),new Rn(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const l=hd;this.copyUniforms=kr.clone(l.uniforms),this.blendMaterial=new Gr({uniforms:this.copyUniforms,vertexShader:l.vertexShader,fragmentShader:l.fragmentShader,blending:2,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new Ki,this.oldClearAlpha=1,this.basic=new er,this.fsQuad=new pd(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose();for(let e=0;e<this.separableBlurMaterials.length;e++)this.separableBlurMaterials[e].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this.basic.dispose(),this.fsQuad.dispose()}setSize(e,t){let n=Math.round(e/2),i=Math.round(t/2);this.renderTargetBright.setSize(n,i);for(let e=0;e<this.nMips;e++)this.renderTargetsHorizontal[e].setSize(n,i),this.renderTargetsVertical[e].setSize(n,i),this.separableBlurMaterials[e].uniforms.invSize.value=new nn(1/n,1/i),n=Math.round(n/2),i=Math.round(i/2)}render(e,t,n,i,r){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const a=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),r&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=n.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e);let s=this.renderTargetBright;for(let t=0;t<this.nMips;t++)this.fsQuad.material=this.separableBlurMaterials[t],this.separableBlurMaterials[t].uniforms.colorTexture.value=s.texture,this.separableBlurMaterials[t].uniforms.direction.value=Id.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[t]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[t].uniforms.colorTexture.value=this.renderTargetsHorizontal[t].texture,this.separableBlurMaterials[t].uniforms.direction.value=Id.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[t]),e.clear(),this.fsQuad.render(e),s=this.renderTargetsVertical[t];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,r&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(n),this.fsQuad.render(e)),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=a}getSeperableBlurMaterial(e){const t=[];for(let n=0;n<e;n++)t.push(.39894*Math.exp(-.5*n*n/(e*e))/e);return new Gr({defines:{KERNEL_RADIUS:e},uniforms:{colorTexture:{value:null},invSize:{value:new nn(.5,.5)},direction:{value:new nn(.5,.5)},gaussianCoefficients:{value:t}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 invSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float gaussianCoefficients[KERNEL_RADIUS];\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tfloat weightSum = gaussianCoefficients[0];\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianCoefficients[i];\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})}getCompositeMaterial(e){return new Gr({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}"})}}Id.BlurDirectionX=new nn(1,0),Id.BlurDirectionY=new nn(0,1);const xd="backgroundTexture",yd=`\n uniform sampler2D ${xd};\n uniform sampler2D bloomTexture;\n uniform sampler2D objectMaskTexture;\n\n varying vec2 vUv;\n\n void main() {\n gl_FragColor = texture2D( ${xd}, vUv );\n gl_FragColor.rgb += texture2D( bloomTexture, vUv ).rgb * texture2D( objectMaskTexture, vUv ).a;\n }\n`;class wd extends fd{constructor(e,t){super(new Gr({uniforms:{[xd]:{value:null},bloomTexture:{value:e},objectMaskTexture:{value:t}},vertexShader:"\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n",fragmentShader:yd}),xd)}}var Md,Sd,Bd,Td,Rd,Dd,Qd,Ud,Ld,Pd,Nd,Fd,Od,kd,Gd,Hd,zd,Vd;const Wd="neverDarken",qd="shadowObject";class jd{constructor(e,t){Md.set(this,void 0),Sd.set(this,void 0),Bd.set(this,!1),Td.set(this,.25),Rd.set(this,0),Dd.set(this,2),Qd.set(this,null),Ud.set(this,null),Ld.set(this,null),Pd.set(this,null),Nd.set(this,null),Fd.set(this,null),Od.set(this,null),kd.set(this,null),Gd.set(this,null),Hd.set(this,{}),zd.set(this,null),Vd.set(this,new Ki),z(this,Md,e),z(this,Sd,t)}set strength(e){z(this,Td,e),null!=H(this,Ld,"f")&&(H(this,Ld,"f").strength=H(this,Td,"f"))}set radius(e){z(this,Rd,e),null!=H(this,Ld,"f")&&(H(this,Ld,"f").radius=H(this,Rd,"f"))}set threshold(e){z(this,Dd,e),null!=H(this,Ld,"f")&&(H(this,Ld,"f").threshold=H(this,Dd,"f"))}init(){H(this,Bd,"f")||(z(this,Qd,new vd(Ku())),z(this,Ud,new Cd(H(this,Md,"f"),H(this,Sd,"f"))),H(this,Ud,"f").clearColor=new Ki(0),H(this,Ud,"f").clearAlpha=0,H(this,Qd,"f").addPass(H(this,Ud,"f")),z(this,Ld,new Id(new nn(256,256),H(this,Td,"f"),H(this,Rd,"f"),H(this,Dd,"f"))),H(this,Qd,"f").addPass(H(this,Ld,"f")),z(this,Pd,new bd),H(this,Pd,"f").needsSwap=!1,H(this,Qd,"f").addPass(H(this,Pd,"f")),H(this,Qd,"f").renderToScreen=!1,z(this,kd,new vd(Ku())),z(this,Gd,new Cd(H(this,Md,"f"),H(this,Sd,"f"))),H(this,kd,"f").addPass(H(this,Gd,"f")),H(this,kd,"f").renderToScreen=!1,z(this,Nd,new vd(Ku())),z(this,Fd,new Cd(H(this,Md,"f"),H(this,Sd,"f"))),H(this,Nd,"f").addPass(H(this,Fd,"f")),z(this,Od,new wd(H(this,Qd,"f").renderTarget1.texture,H(this,kd,"f").renderTarget2.texture)),H(this,Nd,"f").addPass(H(this,Od,"f")),z(this,zd,new er({color:0})),z(this,Bd,!0))}destroy(){H(this,Bd,"f")&&(H(this,zd,"f").dispose(),z(this,zd,null),H(this,Od,"f").dispose(),z(this,Od,null),H(this,Fd,"f").dispose(),z(this,Fd,null),H(this,Nd,"f").dispose(),z(this,Nd,null),H(this,Gd,"f").dispose(),z(this,Gd,null),H(this,kd,"f").dispose(),z(this,kd,null),H(this,Pd,"f").dispose(),z(this,Pd,null),H(this,Ld,"f").dispose(),z(this,Ld,null),H(this,Ud,"f").dispose(),z(this,Ud,null),H(this,Qd,"f").dispose(),z(this,Qd,null),z(this,Bd,!1))}setSize(e,t){null!=H(this,Qd,"f")&&null!=H(this,kd,"f")&&null!=H(this,Nd,"f")&&(H(this,Qd,"f").setSize(e,t),H(this,kd,"f").setSize(e,t),H(this,Nd,"f").setSize(e,t))}render(){null!=H(this,Qd,"f")&&null!=H(this,kd,"f")&&null!=H(this,Gd,"f")&&null!=H(this,Nd,"f")&&null!=H(this,Fd,"f")&&(H(this,Qd,"f").render(),this.darkenMaterials(),this.hideShadow(),H(this,Gd,"f").clearColor=Ku().getClearColor(H(this,Vd,"f")),H(this,Gd,"f").clearAlpha=Ku().getClearAlpha(),H(this,kd,"f").render(),this.showShadow(),H(this,Fd,"f").clearColor=Ku().getClearColor(H(this,Vd,"f")),H(this,Fd,"f").clearAlpha=Ku().getClearAlpha(),H(this,Nd,"f").render(),this.restoreDarkenedMaterials())}hideShadow(){H(this,Md,"f").traverse(e=>{e instanceof Ur&&e.material.userData[qd]&&(e.visible=!1)})}showShadow(){H(this,Md,"f").traverse(e=>{e instanceof Ur&&e.material.userData[qd]&&(e.visible=!0)})}onSceneUpdate(){Ku().renderCubeMapNormals(H(this,Md,"f"))}darkenMaterials(){H(this,Md,"f").traverse(e=>{if(e instanceof Ur){if(e.material.userData[Wd])return;H(this,Hd,"f")[e.uuid]=e.material,e.material=H(this,zd,"f")}})}restoreDarkenedMaterials(){H(this,Md,"f").traverse(e=>{if(e instanceof Ur){if(e.material!==H(this,zd,"f"))return;e.material=H(this,Hd,"f")[e.uuid],delete H(this,Hd,"f")[e.uuid]}})}}var Yd,Xd,Kd,Jd,Zd,$d;Md=new WeakMap,Sd=new WeakMap,Bd=new WeakMap,Td=new WeakMap,Rd=new WeakMap,Dd=new WeakMap,Qd=new WeakMap,Ud=new WeakMap,Ld=new WeakMap,Pd=new WeakMap,Nd=new WeakMap,Fd=new WeakMap,Od=new WeakMap,kd=new WeakMap,Gd=new WeakMap,Hd=new WeakMap,zd=new WeakMap,Vd=new WeakMap,($d=Zd||(Zd={}))[$d.Direct=0]="Direct",$d[$d.Postprocessed=1]="Postprocessed";class ep{constructor(e,t){Yd.set(this,void 0),Xd.set(this,void 0),Kd.set(this,Zd.Direct),Jd.set(this,void 0),z(this,Yd,e),z(this,Xd,t),z(this,Jd,new jd(H(this,Yd,"f"),H(this,Xd,"f")))}get bloomEnabled(){return H(this,Kd,"f")===Zd.Postprocessed}set bloomEnabled(e){e?(H(this,Jd,"f").init(),z(this,Kd,Zd.Postprocessed)):(H(this,Jd,"f").destroy(),z(this,Kd,Zd.Direct))}set bloomStrength(e){H(this,Jd,"f").strength=e}set bloomRadius(e){H(this,Jd,"f").radius=e}set bloomThreshold(e){H(this,Jd,"f").threshold=e}dispose(){H(this,Jd,"f").destroy(),z(this,Kd,Zd.Direct)}setSize(e,t){H(this,Jd,"f").setSize(e,t)}render(){H(this,Kd,"f")===Zd.Direct?Ku().render(H(this,Yd,"f"),H(this,Xd,"f")):H(this,Kd,"f")===Zd.Postprocessed&&H(this,Jd,"f").render()}}Yd=new WeakMap,Xd=new WeakMap,Kd=new WeakMap,Jd=new WeakMap;const tp={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"},np={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"};let ip,rp,ap,sp=!1;const op=300,lp=2*Math.PI/32,cp=he("hold"),hp=he("sine"),Ap=he("sine-in"),up=he("sine-out");function dp(){let e=!0,t=!1,n=null,i=null,r=null;return{get custom(){return t},set:e=>{const{theta:a,phi:s,fov:o}=e;n=a,i=s,r=o,t=null!=a||null!=s||null!=o},reset:e=>{var a;t?(null==n||n.reset(),null==i||i.reset(),null==r||r.reset()):(n=$([{time:0,value:a=e,interpolation:cp},{time:op,value:a,interpolation:up},{time:800,value:a+lp,interpolation:hp},{time:1800,value:a-lp,interpolation:Ap},{time:2300,value:a,interpolation:cp},{time:4300,value:a,interpolation:cp}]),i=null,r=null)},get running(){return e},set running(t){e=t},update:t=>{e&&(null==n||n.update(t),null==i||i.update(t),null==r||r.update(t))},get theta(){return null==n?void 0:n.get()},get phi(){return null==i?void 0:i.get()},get fov(){return null==r?void 0:r.get()}}}var pp;!function(e){e[e.NONE=0]="NONE",e[e.USER_INTERACTION=1]="USER_INTERACTION",e[e.AUTOMATIC=2]="AUTOMATIC"}(pp||(pp={}));const fp="pan-y",gp=1e-6,mp=Math.PI/8,vp=new Rn;class Ep extends zt{constructor(e,t){super(),this.touchAction_=fp,this.enablePan=!0,this.screenSpacePanning=!0,this.enableZoom_=!0,this.enableKeyControls=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.defaultFov=16,this.minFovFactor=.2,this.maxFovFactor=1.6,this.minFov=this.defaultFov*this.minFovFactor,this.maxFov=this.defaultFov*this.maxFovFactor,this.fovMultiplier_=1,this.enableDamping=!0,this.dampingFactor=.3,this.interactionEnabled=!1,this.userInteracted=!1,this.target=new Rn,this.panSphereCenter=new Rn,this.panSphereRadius=1/0,this.spherical=new Wc,this.goalSpherical=new Wc,this.fov=this.defaultFov,this.panOffset=new Rn,this.fovDelta=0,this.lastPosition=new Rn,this.lastQuaternion=new Tn,this.lastTargetPosition=new Rn,this.lastFov=this.fov,this.changeSource=pp.NONE,this.panInProgress=!1,this.touchMode=null,this.pointers=[],this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.passiveTouchHandler=()=>{},this.onPointerDown=e=>{if(this.pointers.length>2)return;const{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);try{t.setPointerCapture(e.pointerId)}catch(e){}this.pointers.push({clientX:e.clientX,clientY:e.clientY,id:e.pointerId}),"touch"===e.pointerType?(this.changeSource=e.altKey?pp.AUTOMATIC:pp.USER_INTERACTION,this.onTouchChange()):(this.changeSource=pp.USER_INTERACTION,this.onMouseDown(e))},this.onPointerMove=e=>{const 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);const n=this.pointers.length,i=(e.clientX-t.clientX)/n,r=(e.clientY-t.clientY)/n;0===i&&0===r||(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?pp.AUTOMATIC:pp.USER_INTERACTION,null!==this.touchMode&&this.touchMode(i,r)):(this.changeSource=pp.USER_INTERACTION,this.panInProgress?this.pan(i,r):this.handleSinglePointerMove(i,r)))},this.onPointerUp=e=>{const t=this.pointers.findIndex(t=>t.id===e.pointerId);-1!==t&&this.pointers.splice(t,1);const{element:n}=this;0===this.pointers.length?(n.removeEventListener("pointermove",this.onPointerMove),n.removeEventListener("pointerup",this.onPointerUp),n.removeEventListener("touchmove",this.disableScroll)):null!==this.touchMode&&this.onTouchChange(),n.style.cursor="grab",this.panInProgress=!1},this.onWheel=e=>{this.changeSource=pp.USER_INTERACTION;const t=e.deltaY*(1==e.deltaMode?18:1)*.2/30;this.userAdjustOrbit(0,0,t),e.preventDefault()},this.onKeyDown=e=>{const{changeSource:t}=this;this.changeSource=pp.USER_INTERACTION,(e.shiftKey&&this.enablePan?this.panKeyCodeHandler(e):this.orbitZoomKeyCodeHandler(e))?e.preventDefault():this.changeSource=t},this.disableScroll=e=>{e.preventDefault()},this.onContext=e=>{if(this.enablePan)e.preventDefault();else for(const e of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:e.id})))},this.onTouchChange=()=>{if(1===this.pointers.length)this.touchMode=this.touchModeRotate;else{if(!this.enableZoom_)return this.touchMode=null,void this.element.removeEventListener("touchmove",this.disableScroll);this.touchMode=this.touchDecided&&null===this.touchMode?null:this.touchModeZoom,this.touchDecided=!0,this.element.addEventListener("touchmove",this.disableScroll,{passive:!1}),this.lastSeparation=Cp(this.pointers[0],this.pointers[1]),this.enablePan&&null!=this.touchMode&&this.initializePan()}},this.onMouseDown=e=>{this.panInProgress=!1,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&this.initializePan(),this.element.style.cursor="grabbing"},this.touchModeZoom=(e,t)=>{if(this.enableZoom_){const e=Cp(this.pointers[0],this.pointers[1]),t=.2*(this.lastSeparation-e)*35/this.element.clientHeight;this.lastSeparation=e,this.userAdjustOrbit(0,0,t)}this.panInProgress&&this.pan(e,t)},this.touchModeRotate=(e,t)=>{if(!this.touchDecided){this.touchDecided=!0;const n=Math.abs(e),i=Math.abs(t),r="pan-x"===this.touchAction_&&n>i,a="pan-y"===this.touchAction_&&i>n;if(this.changeSource===pp.USER_INTERACTION&&(r||a))return void(this.touchMode=null);this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(e,t)},this.camera=e,this.element=t,this.quat=(new Tn).setFromUnitVectors(e.up,new Rn(0,1,0)),this.quatInverse=this.quat.clone().invert(),this.update(0)}set touchAction(e){this.touchAction_=null!=e?e:fp,this.updateTouchActionStyle()}set enableZoom(e){this.enableZoom_!=e&&(this.enableZoom_=e,e?this.element.addEventListener("wheel",this.onWheel):this.element.removeEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}set minZoom(e){this.maxFovFactor=null!=e?1/e:1.6,this.maxFov=this.defaultFov*this.fovMultiplier_*this.maxFovFactor,this.fov=bp(this.fov,this.minFov,this.maxFov)}set maxZoom(e){this.minFovFactor=null!=e?1/e:.2,this.minFov=this.defaultFov*this.fovMultiplier_*this.minFovFactor,this.fov=bp(this.fov,this.minFov,this.maxFov)}set fovMultiplier(e){this.fovMultiplier_=e,this.fov=this.defaultFov*this.fovMultiplier_,this.minFov=this.fov*this.minFovFactor,this.maxFov=this.fov*this.maxFovFactor}reset(e,t,n,i,r){i||(this.fov=this.defaultFov*this.fovMultiplier_,this.minFov=this.fov*this.minFovFactor,this.maxFov=this.fov*this.maxFovFactor,this.camera.fov=this.camera.aspect<1?2*Math.atan(Math.tan(this.fov/2*$t)/this.camera.aspect)*en:this.fov,this.camera.updateProjectionMatrix()),r?vp.copy(this.target).sub(this.panSphereCenter).divideScalar(this.panSphereRadius):vp.set(0,0,0),this.panSphereCenter.set(e.x,e.y,e.z);const a=t/Math.tan(this.defaultFov/2*$t);this.panSphereRadius=Math.min(t,a-t),vp.multiplyScalar(this.panSphereRadius);const s=e.clone().addScaledVector(n,a).add(vp);this.camera.position.set(s.x,s.y,s.z),this.target.set(e.x,e.y,e.z).add(vp),this.camera.lookAt(this.target),vp.copy(this.camera.position).sub(this.target),vp.applyQuaternion(this.quat),this.spherical.setFromVector3(vp),this.goalSpherical.copy(this.spherical),this.lastPosition.copy(this.camera.position),this.lastQuaternion.copy(this.camera.quaternion),this.lastTargetPosition.copy(this.target),this.lastFov=this.fov,this.userInteracted=!1}hasUserInteracted(){return this.userInteracted}update(e){this.spherical.theta+=(this.goalSpherical.theta-this.spherical.theta)*Math.min(.03*e,1),this.spherical.phi+=(this.goalSpherical.phi-this.spherical.phi)*Math.min(.03*e,1),this.spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this.spherical.phi)),this.spherical.makeSafe(),!0===this.enableDamping?this.target.addScaledVector(this.panOffset,this.dampingFactor):this.target.add(this.panOffset),this.target.sub(this.panSphereCenter),this.target.clampLength(0,this.panSphereRadius),this.target.add(this.panSphereCenter),vp.setFromSpherical(this.spherical),vp.applyQuaternion(this.quatInverse),this.camera.position.copy(this.target).add(vp),this.camera.lookAt(this.target),this.fov=Math.pow(Math.sqrt(this.fov)+this.fovDelta,2),this.fov=bp(this.fov,this.minFov,this.maxFov),this.fovDelta=0,!0===this.enableDamping?this.panOffset.multiplyScalar(1-this.dampingFactor):this.panOffset.set(0,0,0);let t=!1;const{aspect:n}=this.camera,i=this.element.clientWidth/this.element.clientHeight;i!==n&&(this.camera.aspect=i,t=!0);const r=Math.abs(this.lastFov-this.fov)>gp;return(t||r)&&(this.camera.fov=this.camera.aspect<1?2*Math.atan(Math.tan(this.fov/2*$t)/this.camera.aspect)*en:this.fov),this.camera.updateProjectionMatrix(),(this.lastPosition.distanceToSquared(this.camera.position)>gp||8*(1-this.lastQuaternion.dot(this.camera.quaternion))>gp||this.lastTargetPosition.distanceToSquared(this.target)>0||r)&&(this.dispatchEvent({type:"change"}),this.lastPosition.copy(this.camera.position),this.lastQuaternion.copy(this.camera.quaternion),this.lastTargetPosition.copy(this.target),this.lastFov=this.fov,t=!0),this.userInteracted=!1,t}getPose(e){return e.copy(this.camera.position),e.sub(this.target),e.normalize(),e}getTheta(){const e=this.camera.position;return vp.copy(e).sub(this.target),vp.applyQuaternion(this.quat),this.spherical.setFromVector3(vp),this.spherical.theta}set(e,t,n){return null!=e&&this.setTheta(e),null!=t&&this.setPhi(t),null!=n&&this.setFovRadians(n),null!=e||null!=t||null!=n}setTheta(e){const t=this.camera.position;vp.copy(t).sub(this.target),vp.applyQuaternion(this.quat),this.spherical.setFromVector3(vp),this.spherical.theta=e,this.spherical.makeSafe(),this.goalSpherical.copy(this.spherical),this.target.sub(this.panSphereCenter),this.target.clampLength(0,this.panSphereRadius),this.target.add(this.panSphereCenter),vp.setFromSpherical(this.spherical),vp.applyQuaternion(this.quatInverse),t.copy(this.target).add(vp),this.camera.lookAt(this.target),this.lastPosition.copy(t),this.lastQuaternion.copy(this.camera.quaternion),this.camera.updateProjectionMatrix()}setPhi(e){const t=this.camera.position;vp.copy(t).sub(this.target),vp.applyQuaternion(this.quat),this.spherical.setFromVector3(vp),this.spherical.phi=e,this.spherical.makeSafe(),this.goalSpherical.copy(this.spherical),this.target.sub(this.panSphereCenter),this.target.clampLength(0,this.panSphereRadius),this.target.add(this.panSphereCenter),vp.setFromSpherical(this.spherical),vp.applyQuaternion(this.quatInverse),t.copy(this.target).add(vp),this.camera.lookAt(this.target),this.lastPosition.copy(t),this.lastQuaternion.copy(this.camera.quaternion),this.camera.updateProjectionMatrix()}setFovRadians(e){this.fov=e*this.fovMultiplier_*en,this.fov=bp(this.fov,this.minFov,this.maxFov),this.camera.fov=this.camera.aspect<1?2*Math.atan(Math.tan(this.fov/2*$t)/this.camera.aspect)*en:this.fov,this.lastFov=this.fov}setInteractionEnabled(e){e?this.enableInteraction():this.disableInteraction()}enableInteraction(){if(!1===this.interactionEnabled){const{element:e}=this;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointercancel",this.onPointerUp),this.enableZoom_&&e.addEventListener("wheel",this.onWheel),this.enableKeyControls&&(e.tabIndex=1,e.addEventListener("keydown",this.onKeyDown)),e.addEventListener("touchmove",this.passiveTouchHandler,{passive:!1}),e.addEventListener("contextmenu",this.onContext),e.style.cursor="grab",this.interactionEnabled=!0,this.updateTouchActionStyle()}}disableInteraction(){if(!0===this.interactionEnabled){const{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.tabIndex=-1,e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("touchmove",this.passiveTouchHandler),e.removeEventListener("touchmove",this.disableScroll),e.removeEventListener("contextmenu",this.onContext),e.style.cursor="",this.touchMode=null,this.interactionEnabled=!1,this.updateTouchActionStyle()}}dispose(){this.disableInteraction(),this.pointers.length=0}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,.2);break;case"PageDown":this.userAdjustOrbit(0,0,-.2);break;case"ArrowUp":this.userAdjustOrbit(0,-mp,0);break;case"ArrowDown":this.userAdjustOrbit(0,mp,0);break;case"ArrowLeft":this.userAdjustOrbit(-mp,0,0);break;case"ArrowRight":this.userAdjustOrbit(mp,0,0);break;default:t=!1}return t}panKeyCodeHandler(e){this.initializePan();let t=!0;switch(e.key){case"ArrowUp":this.pan(0,10);break;case"ArrowDown":this.pan(0,-10);break;case"ArrowLeft":this.pan(10,0);break;case"ArrowRight":this.pan(-10,0);break;default:t=!1}return t}initializePan(){this.panInProgress=!0}pan(e,t){const n=this.element,i=this.camera.position;vp.copy(i).sub(this.target);let r=vp.length();r*=Math.tan(this.camera.fov/2*Math.PI/180),this.panLeft(2*e*r/n.clientHeight,this.camera.matrix),this.panUp(2*t*r/n.clientHeight,this.camera.matrix)}panLeft(e,t){vp.setFromMatrixColumn(t,0),vp.multiplyScalar(-e),this.panOffset.add(vp)}panUp(e,t){!0===this.screenSpacePanning?vp.setFromMatrixColumn(t,1):(vp.setFromMatrixColumn(t,0),vp.crossVectors(this.camera.up,vp)),vp.multiplyScalar(e),this.panOffset.add(vp)}handleSinglePointerMove(e,t){const n=this.pixelLengthToSphericalAngle(e),i=this.pixelLengthToSphericalAngle(t);this.userAdjustOrbit(n,i,0)}userAdjustOrbit(e,t,n){this.goalSpherical.theta+=.5*e*this.fovMultiplier_,this.goalSpherical.phi+=.5*t*this.fovMultiplier_,this.goalSpherical.makeSafe(),this.fovDelta+=n,this.userInteracted=!0}pixelLengthToSphericalAngle(e){return-2*Math.PI*e/Math.min(this.element.clientHeight,this.element.clientWidth)}updateTouchActionStyle(){const{style:e}=this.element;this.interactionEnabled?this.enableZoom_?e.touchAction=this.touchAction_:e.touchAction="manipulation":e.touchAction=""}}function bp(e,t,n){return Math.max(t,Math.min(n,e))}function Cp(e,t){const{clientX:n,clientY:i}=e,{clientX:r,clientY:a}=t,s=r-n,o=a-i;return Math.sqrt(s*s+o*o)}const _p=new Map;let Ip=null;function xp(){Ku().setAnimationLoop(yp)}function yp(e){!function(){for(const e of _p.values())e.prepareResize()}(),function(e){for(const t of _p.values())t.update(e)}(e);let t=function(){let e=null;for(const t of _p.values())if(t.needsRender){if(null!=e)return null;e=t}return e}();null!=Ip&&t!==Ip&&(Ip.ensureBlittedMode(),t=null),Ip=t,0!==function(){let e=0;for(const t of _p.values())t.needsRender&&e++;return e}()&&(null!=t?(t.ensureDirectMode(),wp(),$u(t.width,t.height),Mp()):(function(){for(const e of _p.values())e.needsRender&&e.ensureBlittedMode()}(),wp(),$u(function(){let e=0;for(const t of _p.values())t.needsRender&&(e=Math.max(e,t.width));return e}(),function(){let e=0;for(const t of _p.values())t.needsRender&&(e=Math.max(e,t.height));return e}()),Mp()))}function wp(){for(const e of _p.values())e.commitResize()}function Mp(){for(const e of _p.values())e.render()}function Sp(){let e=null,t=null;return{reset:()=>{e=$([{time:0,value:0,interpolation:cp},{time:op,value:1,interpolation:cp},{time:2300,value:0,interpolation:cp},{time:4300,value:0,interpolation:cp}]),t=$([{time:0,value:0,interpolation:cp},{time:op,value:0,interpolation:up},{time:800,value:-.05,interpolation:hp},{time:1800,value:.05,interpolation:Ap},{time:2300,value:0,interpolation:cp},{time:4300,value:0,interpolation:cp}])},clear:()=>{e=null,t=null},update:n=>{null==e||e.update(n),null==t||t.update(n)},get visibility(){return null==e?void 0:e.get()},get position(){return null==t?void 0:t.get()}}}const Bp=2e3,Tp=2*Math.PI,Rp=Tp/12,Dp=Tp/60,Qp=Tp/60;function Up(e){return $([{time:0,value:0,interpolation:{type:"bezier",x1:.9,y1:0,x2:.6,y2:1}},{time:Bp,value:e,interpolation:{type:"hold"}}])}function Lp(e,t,n){return-1*Rp*(e%12+t/60+n/3600)}function Pp(e,t){return-1*Dp*(e+t/60)}function Np(e,t){return-1*Qp*(e+t/1e3)}function Fp(e,t){let n,i,r,a,s,o,l,c,h,A,u,d,p,f=!1,g=null,m=new Rn(1,0,0),v=!1,E=!1,b=!1,C=!0,_=!1,I=!1,x=4,y=1,w=!0,M=!1,S=null,B=!1,T=!1,R=!1,D=0,Q=0,U=0,L=0,P=0;const N={get paused(){return C},get needsRender(){return!(!f||C)&&_},ensureDirectMode:()=>{e.isDirect()||(_=!0),e.ensureDirectMode()},ensureBlittedMode:()=>{e.isBlitted()||(_=!0),e.ensureBlittedMode()},update:t=>{if(M||!f||C||null==s||!function(e){const t=e.getBoundingClientRect();return t.bottom>0&&t.top<Math.max(document.documentElement.clientHeight,window.innerHeight)&&t.right>0&&t.left<Math.max(document.documentElement.clientWidth,window.innerWidth)}(e.element))return;let n=0!==P?t-P:0;P=t,0===L?_=!0:L<3&&(n=0),L++,B||(a.hasUserInteracted()?(B=!0,u.running=!1,d.clear(),I=!0):(u.update(n),d.update(n),u.running&&a.set(u.theta,u.phi,u.fov)&&(_=!0),null==d.visibility&&null==d.position||(I=!0))),a.update(n)&&(_=!0,T=!0),0!==n&&p.update()&&(_=!0)},render:()=>{if(!M&&f&&!C){if(_){if(Zu(n,e,!E&&!n.bloomEnabled||b?0:1,x,y),_=!1,!R&&null!=S&&T&&B){const e=performance.now();U>0&&(D++,Q+=e-U),U=e,Q>=2e3&&(R=!0,S({fps:D/Q*1e3}))}else U=0;T=!1,null==h||h()}I&&(t.visible=w&&!B,null!=d.visibility&&(t.opacity=`${d.visibility}`),null!=d.position&&(t.transform=`translateX(${d.position*Math.min(e.width,e.height)}px)`),I=!1)}},get width(){return e.element.clientWidth},get height(){return e.element.clientHeight},prepareResize:()=>{const{clientWidth:t,clientHeight:n}=e.element;e.clientWidth=t,e.clientHeight=n,e.dpr=Xu,e.sizeDirty&&(_=!0)},commitResize:()=>{e.commitResize()}},F=(e,t)=>{const n=l.min.clone().add(l.max).divideScalar(2),i=Math.sqrt(function(e,t){let n=0;const i=new Rn;return e.updateWorldMatrix(!0,!0),e.traverseVisible(e=>{const{geometry:r}=e;if(void 0!==r){const{position:a}=r.attributes;if(void 0!==a)for(let r=0,s=a.count;r<s;r++)e.isMesh?e.getVertexPosition(r,i):i.fromBufferAttribute(a,r),e.isSkinnedMesh||i.applyMatrix4(e.matrixWorld),n=t(n,i)}}),n}(e,(e,t)=>Math.max(e,n.distanceToSquared(t))));a.reset(n,i,t?a.getPose(new Rn):m,t,t),null!=u&&(u.reset(a.getTheta()),a.set(u.theta,u.phi,u.fov))},O={init:()=>{f||(function(e,t){_p.set(e,t),1===_p.size&&(Ju(),sp||(ip=new Mo,ip.userData.darkness={value:1},ip.onBeforeCompile=e=>{e.uniforms.darkness=ip.userData.darkness;const t=e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * darkness );");e.fragmentShader=`uniform float darkness;\n${t}`},ip.depthTest=!1,ip.depthWrite=!1,rp=new Gr(tp),rp.depthTest=!1,ap=new Gr(np),ap.depthTest=!1,sp=!0))}(e.element,N),i=new Ko,r=new qr(25,1,.5),a=new Ep(r,e.element),a.setInteractionEnabled(w),n=new ep(i,r),c=function(e){let t,n,i,r,a,s,o,l,c=!1;function h(e){o.visible=!0,rp.uniforms.tDiffuse.value=t.texture,rp.uniforms.h.value=1*e/256,o.material=rp;const i=Ku();i.setRenderTarget(n),i.render(o,l),ap.uniforms.tDiffuse.value=n.texture,ap.uniforms.v.value=1*e/256,o.material=ap,i.setRenderTarget(t),i.render(o,l),o.visible=!1}return{init:()=>{c||(t=new Mn(512,512),t.texture.generateMipmaps=!1,n=new Mn(512,512),n.texture.generateMipmaps=!1,i=new Uo,i.position.y=-.7,r=new sa(45,45).rotateX(Math.PI/2),a=new er({map:t.texture,opacity:.5,transparent:!0,depthWrite:!1,userData:{[Wd]:!0,[qd]:!0}}),s=new Ur(r,a),s.renderOrder=1,s.scale.y=-1,i.add(s),o=new Ur(r),o.visible=!1,i.add(o),l=new Ea(-22.5,22.5,22.5,-22.5,0,3),l.rotation.x=Math.PI/2,i.add(l),c=!0)},destroy:()=>{c&&(l=null,o.clear(),o=null,s.clear(),s=null,ad(a),a=null,r.dispose(),r=null,i.clear(),i=null,n.dispose(),n=null,t.dispose(),t=null,c=!1)},get group(){return i},render:()=>{const n=e.background;e.background=null,e.overrideMaterial=ip;const i=Ku(),r=i.getClearAlpha();i.setClearAlpha(0),i.setRenderTarget(t),i.render(e,l),e.overrideMaterial=null,h(1.5),h(.4*1.5),i.setRenderTarget(null),i.setClearAlpha(r),e.background=n}}}(i),c.init(),u=dp(),d=Sp(),p=function(){let e,t,n,i,r=!1,a=null;return{clear:()=>{r=!1,e=void 0,t=void 0,n=void 0,a=null},reset:i=>{r=!0,e=i.getObjectByName("hours"),t=i.getObjectByName("minutes"),n=i.getObjectByName("seconds"),a=function(e,t,n){let i,r,a,s,o=!1,l=!1;return{update:c=>{if(!o){i=new Date(c),i.setMilliseconds(i.getMilliseconds()+Bp);const e=i.getHours(),t=i.getMinutes(),n=i.getSeconds(),l=i.getMilliseconds();r=Up(Lp(e,t,n)),a=Up(Pp(t,n)),s=Up(Np(n,l)),o=!0}if(l)return;const h=i.getTime()-c.getTime(),A=Bp-h;h<=0?l=!0:(null!=e&&(r.seek(A),e.rotation.y=r.get()),null!=t&&(a.seek(A),t.rotation.y=a.get()),null!=n&&(s.seek(A),n.rotation.y=s.get()))},get done(){return l}}}(e,t,n)},update:()=>{if(!r)return!1;const s=new Date;if(null==i&&(i=new Date),null!=a){if(a.update(s),!a.done)return i=s,!0;a=null}if(Math.abs(s.getTime()-i.getTime())<125)return!1;const o=s.getHours(),l=s.getMinutes(),c=s.getSeconds(),h=s.getMilliseconds();return null!=e&&(e.rotation.y=Lp(o,l,c)),null!=t&&(t.rotation.y=Pp(l,c)),null!=n&&(n.rotation.y=Np(c,h)),i=s,!0}}}(),f=!0)},destroy:()=>{var t;f&&(null===(t=i.environment)||void 0===t||t.dispose(),i.environment=null,p=null,d=null,u=null,c.destroy(),c=null,n.dispose(),n=null,null!=A&&a.removeEventListener("change",A),A=null,a.dispose(),a=null,r=null,cd(i),i=null,function(e){_p.delete(e),0===_p.size&&(sp&&(ad(ap),ap=null,ad(rp),rp=null,ad(ip),ip=null,sp=!1),Ip=null,qu&&(Vu.dispose(),Vu=null,Wu=null,ju=1,Yu=1,Xu=1,qu=!1))}(e.element),f=!1)},set gltfScene(e){s=e,cd(i),null!=s&&(i.add(s),this.isDiamondScene&&ed(s,o),l=(new Un).setFromObject(s),c.group.position.y=l.min.y-0,i.add(c.group),c.render(),E=function(e){let t=!1;return e.traverse(e=>{if(!t&&e instanceof Ur){const n=e.material;Array.isArray(n)?n.forEach(e=>{e.transmission>0&&(t=!0)}):n.transmission>0&&(t=!0)}}),t}(i),F(s,v&&B),u.reset(a.getTheta()),d.reset(),p.clear(),"Watches"===g&&p.reset(s),C||xp()),L=0,_=!0},get isDiamondScene(){var e;return!!(null===(e=null==s?void 0:s.userData)||void 0===e?void 0:e.isDiamondScene)},set environment(e){var t;null===(t=i.environment)||void 0===t||t.dispose(),i.environment=e},set diamondEnvironment(e){o=e,this.isDiamondScene&&null!=s&&ed(s,e)},set environmentRotation(e){i.environmentRotation.y=e*Math.PI/180,_=!0},updateOnce:e=>{f&&!C&&(B||(u.update(e),u.running&&a.set(u.theta,u.phi,u.fov)&&(_=!0)),0!==e&&p.update()&&(_=!0))},renderOnce:()=>{N.prepareResize(),N.ensureBlittedMode(),N.commitResize(),$u(N.width,N.height),B||a.set(u.theta,u.phi,u.fov),Zu(n,e,!E&&!n.bloomEnabled||b?0:1,x,y),null==h||h()},get category(){return g},set category(e){g=e},set initialPose(e){m=e},set toneMapping(e){const t={ACES:4,Linear:1,Neutral:7};null!=t[e]&&(x=t[e]),_=!0},set toneMappingExposure(e){y=e,_=!0},set paused(e){e?(C=!0,a.setInteractionEnabled(!1),function(){for(const{paused:e}of _p.values())if(!e)return!1;return!0}()&&Ku().setAnimationLoop(null),t.opacity="0",t.visible=!1):(C=!1,a.setInteractionEnabled(w),null!=s&&(F(s,!1),_=!0,xp()),P=0)},set interactive(e){w=e,a.setInteractionEnabled(e)},set touchAction(e){a.touchAction=e},set zoomEnabled(e){a.enableZoom=e},set minZoom(e){a.minZoom=e},set maxZoom(e){a.maxZoom=e},set preserveCameraOnReload(e){v=e},set forcedTransparency(e){b=e,_=!0},set defaultFov(e){a.defaultFov=e},set fovMultiplier(e){a.fovMultiplier=e,_=!0},set bloomEnabled(e){n.bloomEnabled=e,_=!0},set bloomStrength(e){n.bloomStrength=e,_=!0},set bloomRadius(e){n.bloomRadius=e,_=!0},set bloomThreshold(e){n.bloomThreshold=e,_=!0},set nonLiveRendering(e){M=e},set onRendered(e){h=e},set onInteracted(e){null!=A&&a.removeEventListener("change",A),A=e,null!=e&&a.addEventListener("change",e)},set onInteractionPerf(e){S=e},setAnimationConfig:e=>{u.set(e),null!=s&&F(s,!0),u.custom||(u.reset(a.getTheta()),d.reset()),_=!0}};return O}function Op(e){return t=>G(this,void 0,void 0,function*(){try{yield t()}catch(t){e(t)}})}const kp={initialized:!1,paused:!1,posterUrl:null,glbUrl:null,envUrl:null,diamondEnvUrl:null,envRotation:null,toneMapping:null,toneMappingExposure:null,bloomEnabled:null,bloomStrength:null,bloomRadius:null,bloomThreshold:null,category:null,glbLocal:!1,interactive:!1,touchAction:null,zoomEnabled:!1,minZoom:null,maxZoom:null,preserveCameraOnReload:!1,alwaysTransparentBackground:!1,defaultFov:null,fovMultiplier:null,defaultCameraPositions:null,interactionPromptUrl:null,interactionPromptSize:null,nonLiveRendering:null,baseUrl:null,downloadCacheEnabled:!1,onModelLoaded:null,onRendered:null,onInteracted:null,onInteractionPerf:null,animation:null,thetaAnimation:null,phiAnimation:null,fovAnimation:null};function Gp(e,t){const n=e,i=t,r=Fp(i.canvasWrapper,i.prompt),a=function(){const e=Object.assign({},Kc);return{set vectors(t){for(const i of Object.keys(e)){if(!Xc(i))continue;const r=null==t?void 0:t[i];e[i]=null!=r?new Rn((n=r)[0],n[1],n[2]):Kc[i]}var n},getVector:t=>{var n;return(null==t?e.Glasses:null!==(n=e[t])&&void 0!==n?n:e.Glasses).normalize()}}}();let s=()=>{};const o=[],l=new Mh;let c,h,A,u,d,p,f,g,m,v,E,b,C,_,I,x;l.setOnProgress(e=>{i.loading.progress=e,e>0&&(i.loading.visible=!0)});const y=function(){const e=Object.keys(kp).reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:0}),{});return t=>{const n=++e[t];return()=>n!==e[t]}}(),w=function(){const e=Object.keys(kp).reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:!1}),{});return{lock:t=>{e[t]=!0},unlock:t=>{e[t]=!1},anyLocked:()=>Object.values(e).some(e=>e),locks_:e}}(),M=function(e,t){return n=>{t.length>0?(t.forEach(e=>e.reject(n)),t.length=0):e.onError?e.onError(n):console.error(n)}}(n,o),S=function(e,t){return(n,i)=>G(this,void 0,void 0,function*(){const r=Op(t),a=function(e,t){const n=e(t);return e=>G(this,void 0,void 0,function*(){yield e(n)})}(e,n);yield r(()=>a(i))})}(y,M),B=function(e,t,n,i){return(r,a)=>G(this,void 0,void 0,function*(){const s=function(e,t){return n=>G(this,void 0,void 0,function*(){e.lock(t),yield n(),e.unlock(t)})}(e,r),o=Op(i),l=function(e,t,n,i){const r=t(i);return t=>G(this,void 0,void 0,function*(){yield Promise.resolve(),r()||(yield t(r))&&(e.unlock(i),e.anyLocked()||n())})}(e,t,n,r);yield s(()=>o(()=>l(a)))})}(w,y,()=>{void 0!==E&&(r.category=E,r.initialPose=a.getVector(null!=E?E:Jc)),void 0!==c&&(r.gltfScene=c),void 0!==h&&(r.environment=h),void 0!==A&&(r.diamondEnvironment=A),void 0!==u&&(r.environmentRotation=null!=u?u:0),void 0!==f&&(r.bloomEnabled=null!=f&&f),void 0!==g&&(r.bloomStrength=null!=g?g:.25),void 0!==m&&(r.bloomRadius=null!=m?m:0),void 0!==v&&(r.bloomThreshold=null!=v?v:2),null==s||s(),void 0!==x&&r.setAnimationConfig(x),void 0!==d&&(r.toneMapping=null!=d?d:"Neutral"),void 0!==p&&(r.toneMappingExposure=null!=p?p:1),void 0!==b&&(r.forcedTransparency=b),void 0!==C&&(r.onRendered=C),void 0!==_&&(r.onInteracted=_),void 0!==I&&(r.onInteractionPerf=I),r.renderOnce(),i.canvasVisible=!0,i.posterVisible=!1,i.loading.visible=!1,o.forEach(e=>e.resolve()),o.length=0,c=void 0,h=void 0,A=void 0,d=void 0,p=void 0,E=void 0,b=void 0,C=void 0,_=void 0,I=void 0},M);return n.onInitializedChange=e=>S("initialized",t=>G(this,void 0,void 0,function*(){e?(r.init(),r.paused=n.paused):r.destroy()})),n.onPausedChange=e=>S("paused",t=>G(this,void 0,void 0,function*(){r.paused=e})),n.onPosterUrlChange=e=>S("posterUrl",t=>G(this,void 0,void 0,function*(){i.loadPoster(e),i.posterVisible=w.anyLocked(),i.canvasVisible=!w.anyLocked()})),n.onGlbUrlChange=t=>B("glbUrl",r=>G(this,void 0,void 0,function*(){if(r()||!n.initialized)return!1;if(null!=t)if(rd(),"string"==typeof t){null!=n.posterUrl&&(i.posterVisible=!0,i.canvasVisible=!1);const a=255,s=Hp(e.glbLocal)?new Uint8Array(yield bh(t,l,n.downloadCacheEnabled)):yield Ch(t,(new Date).getTime()+a,Math.random()*a,l,n.downloadCacheEnabled);if(r()||!n.initialized)return!1;const o=yield id(s);if(r()||!n.initialized)return!1;c=o.scene}else{const i=255,a=Hp(e.glbLocal,"left")?bh(t.left,l,n.downloadCacheEnabled).then(e=>new Uint8Array(e)):Ch(t.left,(new Date).getTime()+i,Math.random()*i,l,n.downloadCacheEnabled),s=Hp(e.glbLocal,"right")?bh(t.right,l,n.downloadCacheEnabled).then(e=>new Uint8Array(e)):Ch(t.right,(new Date).getTime()+i,Math.random()*i,l,n.downloadCacheEnabled),o=yield a;if(r()||!n.initialized)return!1;const h=yield s;if(r()||!n.initialized)return!1;const A=(yield id(o)).scene;if(r()||!n.initialized)return!1;const u=(yield id(h)).scene;if(r()||!n.initialized)return!1;c=function(e,t){const n=new Uo,i=ld(e).getSize(new Rn),r=ld(t).getSize(new Rn),a=.075*Math.max(i.z,r.z),s=sd(e,a,!1,void 0,new Tn(0,0,0,1));e.position.set(s.x,s.y,s.z);const o=sd(t,a,!0,void 0,new Tn(0,0,0,1));return t.position.set(o.x,o.y,o.z),n.add(e,t),n}(A,u)}else c=null;return!0})),n.onEnvUrlChange=e=>B("envUrl",t=>G(this,void 0,void 0,function*(){if(t()||!n.initialized)return!1;if(null!=e){const i=yield bh(e,l,n.downloadCacheEnabled);if(t()||!n.initialized)return!1;h=sA(i)}else h=null;return!0})),n.onDiamondEnvUrlChange=e=>B("diamondEnvUrl",t=>G(this,void 0,void 0,function*(){if(t()||!n.initialized)return!1;if(null!=e){const i=yield bh(e,l,n.downloadCacheEnabled);if(t()||!n.initialized)return!1;A=sA(i)}else A=null;return!0})),n.onEnvRotationChange=e=>B("envRotation",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(u=e,0))})),n.onToneMappingChange=e=>B("toneMapping",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(d=e,0))})),n.onToneMappingExposureChange=e=>B("toneMappingExposure",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(p=e,0))})),n.onBloomEnabledChange=e=>B("bloomEnabled",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(f=e,0))})),n.onBloomStrengthChange=e=>B("bloomStrength",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(g=e,0))})),n.onBloomRadiusChange=e=>B("bloomRadius",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(m=e,0))})),n.onBloomThresholdChange=e=>B("bloomThreshold",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(v=e,0))})),n.onCategoryChange=e=>B("category",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(E=e,0))})),n.onInteractiveChange=e=>S("interactive",t=>G(this,void 0,void 0,function*(){r.interactive=e})),n.onTouchActionChange=e=>S("touchAction",t=>G(this,void 0,void 0,function*(){r.touchAction=e})),n.onZoomEnabledChange=e=>S("zoomEnabled",t=>G(this,void 0,void 0,function*(){r.zoomEnabled=e})),n.onMinZoomChange=e=>S("minZoom",t=>G(this,void 0,void 0,function*(){r.minZoom=e})),n.onMaxZoomChange=e=>S("maxZoom",t=>G(this,void 0,void 0,function*(){r.maxZoom=e})),n.onPreserveCameraOnReloadChange=e=>S("preserveCameraOnReload",t=>G(this,void 0,void 0,function*(){r.preserveCameraOnReload=e})),n.onAlwaysTransparentBackgroundChange=e=>B("alwaysTransparentBackground",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(b=e,0))})),n.onDefaultFovChange=e=>S("defaultFov",t=>G(this,void 0,void 0,function*(){r.defaultFov=null!=e?e:16})),n.onFovMultiplierChange=e=>S("fovMultiplier",t=>G(this,void 0,void 0,function*(){r.fovMultiplier=null!=e?e:1})),n.onDefaultCameraPositionsChange=e=>S("defaultCameraPositions",t=>G(this,void 0,void 0,function*(){var t;a.vectors=e,r.initialPose=a.getVector(null!==(t=r.category)&&void 0!==t?t:Jc)})),n.onInteractionPromptUrlChange=e=>S("interactionPromptUrl",t=>G(this,void 0,void 0,function*(){i.prompt.imageUrl=e})),n.onInteractionPromptSizeChange=e=>S("interactionPromptSize",t=>G(this,void 0,void 0,function*(){i.prompt.imageSize=e})),n.onNonLiveRenderingChange=e=>S("nonLiveRendering",t=>G(this,void 0,void 0,function*(){r.nonLiveRendering=!!e})),n.onBaseUrlChange=e=>S("baseUrl",t=>G(this,void 0,void 0,function*(){ku(e)})),n.onOnModelLoadedChange=e=>S("onModelLoaded",t=>G(this,void 0,void 0,function*(){s=e})),n.onOnRenderedChange=e=>B("onRendered",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(C=e,0))})),n.onOnInteractedChange=e=>B("onInteracted",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(_=e,0))})),n.onOnInteractionPerfChange=e=>B("onInteractionPerf",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(I=e,0))})),n.onAnimationChange=e=>B("animation",t=>G(this,void 0,void 0,function*(){if(t()||!n.initialized)return!1;if(null==e)return x={theta:null,phi:null,fov:null},!0;const i=oe(e);return x={theta:null!=i.theta?$(i.theta):null,phi:null!=i.phi?$(i.phi):null,fov:null!=i.fov?$(i.fov):null},!0})),{render:e=>{r.updateOnce(e),r.renderOnce()},flushChanges:()=>new Promise((e,t)=>{w.anyLocked()?o.push({resolve:e,reject:t}):e()})}}function Hp(e,t){if(null==t){if("boolean"==typeof e)return e;const t=e.left||e.right;return console.warn(`Expected 'glbLocal' to be boolean, but got object (treating as ${t}).`),t}return"boolean"==typeof e?e:e[t]}var zp,Vp,Wp,qp,jp,Yp,Xp,Kp,Jp,Zp,$p,ef;!function(e){e[e.Empty=0]="Empty",e[e.Direct=1]="Direct",e[e.Blitted=2]="Blitted"}(ef||(ef={}));class tf{constructor(){zp.add(this),Vp.set(this,document.createElement("div")),Wp.set(this,ef.Empty),qp.set(this,null),jp.set(this,1),Yp.set(this,1),Xp.set(this,1),Kp.set(this,1),Jp.set(this,1),Zp.set(this,!1);const{style:e}=H(this,Vp,"f");e.position="absolute",e.top="0",e.left="0",e.width="100%",e.height="100%",e.pointerEvents="auto"}get element(){return H(this,Vp,"f")}isDirect(){return H(this,Wp,"f")===ef.Direct}ensureDirectMode(){if(H(this,Wp,"f")===ef.Direct)return;z(this,Wp,ef.Direct);const e=Ku().domElement;document.contains(e)&&console.warn("[ShopAR 3D] Direct rendering not working properly!"),H(this,Vp,"f").replaceChildren(e),z(this,qp,null),z(this,Zp,!0)}isBlitted(){return H(this,Wp,"f")===ef.Blitted}ensureBlittedMode(){H(this,Wp,"f")!==ef.Blitted&&(z(this,Wp,ef.Blitted),z(this,qp,function(){const e=document.createElement("canvas"),{style:t}=e;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",e}()),H(this,Vp,"f").replaceChildren(H(this,qp,"f")),z(this,Zp,!0))}set visible(e){H(this,Vp,"f").style.visibility=e?"visible":"hidden"}get width(){return H(this,Xp,"f")}get height(){return H(this,Kp,"f")}set clientWidth(e){e!==H(this,jp,"f")&&z(this,Zp,!0),z(this,jp,e)}set clientHeight(e){e!==H(this,Yp,"f")&&z(this,Zp,!0),z(this,Yp,e)}get dpr(){return H(this,Jp,"f")}set dpr(e){e!==this.dpr&&z(this,Zp,!0),z(this,Jp,e)}get sizeDirty(){return H(this,Zp,"f")}commitResize(){if(!H(this,Zp,"f"))return;z(this,Zp,!1);const e=H(this,zp,"m",$p).call(this);null!=e&&(z(this,Xp,Math.ceil(H(this,jp,"f")*H(this,Jp,"f"))),z(this,Kp,Math.ceil(H(this,Yp,"f")*H(this,Jp,"f"))),e.width=H(this,Xp,"f"),e.height=H(this,Kp,"f"))}get context2d(){var e,t;return null!==(t=null===(e=H(this,qp,"f"))||void 0===e?void 0:e.getContext("2d"))&&void 0!==t?t:null}}function nf(e){return`var(${e.var}, ${e.default})`}Vp=new WeakMap,Wp=new WeakMap,qp=new WeakMap,jp=new WeakMap,Yp=new WeakMap,Xp=new WeakMap,Kp=new WeakMap,Jp=new WeakMap,Zp=new WeakMap,zp=new WeakSet,$p=function(){return H(this,Wp,"f")===ef.Direct?Ku().domElement:H(this,Wp,"f")===ef.Blitted?H(this,qp,"f"):null};const rf="--shopar-3d",af={display:{var:`${rf}-loading-display`,default:"block"},top:{var:`${rf}-loading-top`,default:"0"},bottom:{var:`${rf}-loading-bottom`,default:"auto"},height:{var:`${rf}-loading-height`,default:"0.375rem"},radius:{var:`${rf}-loading-radius`,default:"calc(infinity * 1px)"},fg:{var:`${rf}-loading-fg`,default:"linear-gradient(90deg, #773cd8, #5fb9ec)"},bg:{var:`${rf}-loading-bg`,default:"#e5e7eb"}},sf="width 0.05s ease-out";const of="data:image/svg+xml,%3csvg width='869' height='1251' viewBox='0 0 869 1251' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg clip-path='url(%23clip0_894_1533)'%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M303.44 353.132C304.829 314.64 330.051 282.714 363.992 272.987C371.106 271.049 378.436 270.01 385.808 269.895C391.367 269.895 396.717 270.486 401.893 271.424C439.69 278.372 467.899 309.36 467.899 346.462V654.953H511.671C613.911 606.665 685.371 500.36 685.371 376.165C685.571 306.213 662.333 238.211 619.365 183.01L604.427 165.64C577.851 136.528 545.96 112.766 510.212 96.1603C473.492 79.1377 432.881 69.4105 390.012 69.4105C347.143 69.4105 306.636 79.0683 269.812 96.1603C234.029 112.766 202.173 136.528 175.666 165.64L160.728 183.01C117.761 238.211 94.5225 306.213 94.722 376.165C94.714 391.336 95.8054 406.487 97.9875 421.5C99.0297 428.796 101.045 435.744 102.504 442.935L107.228 464.613C110.112 474.548 114.037 484.067 117.824 493.516L122.132 505.085C127.341 516.473 133.246 527.53 139.814 538.192L142.073 542.43C171.755 590.029 214.112 628.416 264.392 653.286L302.954 671.941V353.097L303.44 353.132Z' fill='white' fill-opacity='0.5'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M797.001 876.074L701.118 1144.96C695.143 1161.81 677.634 1172.75 657.589 1172.75H425.283C369.49 1172.75 317.867 1149.13 287.018 1109.53C231.711 1038.38 160.321 976.75 74.7561 926.447C71.4558 924.536 69.5451 921.687 69.4757 918.456C69.3367 914.982 71.0737 911.647 76.1805 908.139C95.6349 894.486 119.05 887.295 143.09 887.295C151.152 887.279 159.195 888.083 167.095 889.692L338.085 924.223V346.427C338.085 323.395 359.45 304.635 385.679 304.635C411.908 304.635 433.377 323.395 433.377 346.427V689.728H535.964C545.448 689.728 554.481 692.264 562.263 697.024L779.631 831.606C780.569 832.197 781.194 833.065 782.063 833.691C796.306 843.974 802.42 860.441 796.862 876.074M142.499 542.431C141.665 541.041 141.04 539.547 140.241 538.192C133.666 527.534 127.76 516.477 122.558 505.085C120.891 501.368 119.779 497.338 118.251 493.517L107.655 464.613C105.64 457.595 104.528 450.161 102.93 442.935L98.4141 421.501C96.2308 406.488 95.1394 391.336 95.1485 376.165C95.1485 302.968 119.953 235.815 161.155 183.011L176.093 165.641C202.634 136.459 234.525 112.731 270.238 96.1605C306.993 79.1379 347.569 69.4107 390.439 69.4107C433.308 69.4107 473.884 79.1379 510.639 96.1605C546.421 112.731 578.278 136.459 604.854 165.641L619.723 183.011C662.719 238.184 685.972 306.182 685.763 376.13C685.763 500.395 614.338 606.665 512.063 654.953H468.291V346.393C468.291 309.325 439.735 278.302 402.285 271.354C397.074 270.382 391.724 269.826 386.2 269.826C378.557 269.826 371.366 271.111 364.384 272.952C330.443 282.68 305.221 314.571 303.832 353.063V671.907L265.27 653.251C214.758 628.725 172.376 590.58 142.499 542.431ZM798.043 802.147L580.71 667.564C577.166 665.375 573.136 664.16 569.245 662.562C662.453 600.03 720.503 493.899 720.503 376.2C720.503 359.316 719.218 342.71 716.89 326.521C709.659 275.243 691.021 226.238 662.348 183.115L652.1 168.941L649.807 165.745C639.725 152.491 628.708 139.976 616.839 128.295C604.958 116.692 592.243 105.957 578.834 96.2647C538.709 67.2916 492.261 47.2118 441.958 38.9437L416.528 35.8866L390.543 34.8444C373.298 34.8447 356.082 36.2272 339.058 38.9785C288.789 47.2466 242.272 67.3263 202.182 96.2995C192.322 103.7 182.893 111.657 173.939 120.131C163.518 129.655 153.713 139.831 144.584 150.598L131.209 165.779L118.702 183.149L108.697 199.408L94.1758 226.436L92.7862 229.562C72.1854 274.029 60.478 323.708 60.478 376.234C60.478 509.358 136.281 631.295 253.632 686.741L303.554 710.364V882.188L173.765 855.994C163.608 853.965 153.273 852.964 142.916 853.006C142.325 853.006 141.735 853.11 141.179 853.11C132.425 853.249 123.705 854.257 115.124 855.89C112.364 856.472 109.619 857.121 106.891 857.835C100.186 859.433 93.62 861.552 87.1583 864.088C84.5528 865.13 81.9473 866.068 79.3418 867.562C70.6568 871.523 62.1803 876.039 54.2248 881.632C47.9431 885.96 42.8502 891.798 39.4144 898.609C35.9785 905.42 34.3099 912.986 34.562 920.61C34.9201 928.091 37.1618 935.359 41.079 941.742C44.9961 948.125 50.4619 953.415 56.9693 957.122C139.025 1004.85 207.116 1063.53 259.677 1131.24C264.329 1137.24 269.365 1142.94 274.754 1148.3C312.482 1185.88 367.024 1207.81 425.04 1207.88H657.693C683.679 1207.84 707.372 1196.31 722.24 1177.58C727.173 1171.33 731.134 1164.38 733.913 1156.67L829.691 887.781C832.957 878.749 834.207 869.369 833.582 860.197C832.957 851.026 830.525 842.133 826.53 833.795C820.225 820.757 810.33 809.79 798.008 802.182' fill='black' fill-opacity='0.6'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M779.738 831.676L562.37 697.093C554.446 692.276 545.346 689.739 536.072 689.763H433.485V346.532C433.485 323.499 412.085 304.74 385.787 304.74C359.489 304.74 338.193 323.499 338.193 346.532V924.71L167.203 890.178C159.291 888.569 151.236 887.766 143.163 887.781C119.267 887.676 95.9182 894.929 76.2881 908.555C71.1813 912.099 69.4096 915.434 69.5485 918.908C69.6875 922.174 71.5635 925.022 74.8638 926.898C160.394 977.202 231.784 1038.76 287.125 1109.98C317.94 1149.58 369.563 1173.2 425.39 1173.2H657.662C677.707 1173.2 695.181 1161.88 701.191 1145.41L797.074 876.525C802.632 860.962 796.483 844.46 782.274 834.142C781.406 833.448 780.781 832.649 779.843 832.058L779.738 831.676Z' fill='white'/%3e%3cmask id='mask0_894_1533' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='869' height='1243'%3e%3cpath d='M0.0664062 0.0349731H868.462V1242.62H0.0664062V0.0349731Z' fill='white'/%3e%3c/mask%3e%3cg mask='url(%23mask0_894_1533)'%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M833.58 860.197C834.209 869.559 832.897 878.95 829.724 887.781L733.911 1156.67C731.132 1164.31 727.172 1171.36 722.239 1177.58C707.405 1196.34 683.677 1207.81 657.727 1207.88H425.038C367.022 1207.81 312.481 1185.88 274.753 1148.3C269.403 1142.95 264.331 1137.25 259.676 1131.27C207.114 1063.57 139.024 1004.89 57.2458 956.809C43.8709 948.993 35.4985 935.34 34.8385 920.332C34.5864 912.708 36.255 905.143 39.6909 898.332C43.1267 891.521 48.2196 885.682 54.5013 881.354C62.4292 875.912 70.8363 871.202 79.6183 867.284L87.4348 863.81C93.8598 861.272 100.453 859.183 107.167 857.557L115.401 855.612C124.016 854.014 132.771 853.006 141.456 852.833C142.081 852.833 142.637 852.728 143.193 852.728C153.719 852.694 163.932 853.666 174.111 855.716L303.413 881.84V710.399L253.527 686.775C136.21 631.33 60.3724 509.393 60.3724 376.269C60.3724 323.812 72.045 274.134 92.6806 229.597C93.2017 228.555 93.5491 227.513 94.0702 226.47C98.4821 217.195 103.38 208.232 108.591 199.443C111.822 193.884 115.053 188.465 118.597 183.184C120.785 179.884 123.217 176.723 125.545 173.561L131.138 165.675C135.237 160.291 140.17 155.601 144.513 150.494C153.753 140.072 163.411 129.511 173.868 120.027C182.822 111.552 192.251 103.596 202.112 96.1953C242.202 67.2569 288.753 47.2119 339.022 38.8743C356.034 36.1219 373.239 34.7394 390.472 34.7402C399.145 34.7313 407.815 35.0906 416.457 35.8172C425.038 36.512 433.48 37.5542 441.922 38.8743C492.225 47.1424 538.707 67.2221 578.797 96.1953C592.242 105.923 604.922 116.622 616.803 128.226C628.681 139.898 639.699 152.413 649.771 165.675L652.064 168.871C655.607 173.492 659.116 178.182 662.312 183.045C690.997 226.166 709.647 275.171 716.889 326.452C719.182 342.676 720.467 359.281 720.467 376.13C720.467 493.829 662.451 600.307 569.244 662.492C573.065 664.09 577.13 665.271 580.708 667.495L798.041 802.077C810.895 810.068 820.449 821.184 826.528 833.343C830.523 841.681 832.955 850.644 833.58 859.746M857.794 818.231C848.588 799.124 834.275 783.248 816.315 772.166L631.394 657.628C709.732 586.863 755.207 484.971 755.207 375.748C755.207 299.667 733.078 226.227 691.285 163.348C686.908 156.817 682.253 150.494 677.389 144.171C654.982 114.712 628.684 88.5872 599.155 67.6043C537.561 23.5887 465.337 0.0349731 390.472 0.0349731C315.457 0.0670918 242.383 23.8817 181.754 68.0559C152.294 89.3863 125.961 115.163 103.485 144.658C98.7601 150.911 94.0354 157.268 89.6582 163.765C47.7965 226.679 25.6671 300.119 25.6671 376.2C25.6671 522.733 109.286 656.899 238.728 718.111L268.708 732.354V839.77L180.99 822.053C168.622 819.621 156.081 818.37 143.609 818.37C104.55 818.376 66.4474 830.462 34.5258 852.971C11.8406 868.952 -0.978479 894.729 0.133201 921.861C0.732449 935.148 4.66826 948.071 11.5776 959.437C18.4869 970.803 28.1472 980.245 39.6673 986.894C117.485 1032.68 182.31 1088.44 232.231 1152.67C276.004 1208.95 348.02 1242.65 425.038 1242.72H657.727C707.057 1242.68 750.83 1212.84 766.602 1168.45L862.484 899.558C871.933 873.26 870.266 844.53 857.829 818.787' fill='black' fill-opacity='0.05'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath id='clip0_894_1533'%3e%3crect width='868.5' height='1250.64' fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",lf="2rem";function cf(e){const t=function(){const e=document.createElement("div"),{style:t}=e;return t.position="relative",t.width="100%",t.height="100%",t.pointerEvents="none",e}(),n=function(){const e=document.createElement("div");e.draggable=!1;const{style:t}=e;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",t.objectFit="contain",t.visibility="hidden",t.backgroundSize="contain",t.backgroundRepeat="no-repeat",t.backgroundPosition="center",e}();t.appendChild(n);const i=new tf;t.appendChild(i.element);const r=function(){const e=function(){const e=document.createElement("div"),{style:t}=e;return t.display=nf(af.display),t.opacity="0",t.transition="opacity 0.2s ease-out",t.position="absolute",t.top=nf(af.top),t.bottom=nf(af.bottom),t.left="0",t.width="100%",t.height=nf(af.height),t.overflow="hidden",e}(),t=function(){const e=document.createElement("div"),{style:t}=e;return t.position="absolute",t.width="100%",t.height="100%",t.background=nf(af.bg),e}(),n=function(){const e=document.createElement("div"),{style:t}=e;return t.position="absolute",t.top="0",t.left="0",t.width="0%",t.height="100%",t.background=nf(af.fg),t.borderRadius=nf(af.radius),t.transition=sf,e}();t.appendChild(n),e.appendChild(t);let i=0;return{get container(){return e},set progress(e){e<i?(n.style.transition="none",n.style.width=100*e+"%",n.offsetWidth,n.style.transition=sf):n.style.width=100*e+"%",i=e},set visible(t){e.style.opacity=t?"1":"0"}}}();t.appendChild(r.container);const a=function(){const e=function(){const e=document.createElement("div"),{style:t}=e;return t.visibility="hidden",t.position="absolute",t.width="100%",t.height="100%",t.display="flex",t.justifyContent="center",t.alignItems="center",e}(),t=function(){const e=function(e){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("width",e),t.setAttribute("height",e),t}(lf),{style:t}=e;return t.transition="opacity 0.3s",t.opacity="0",e}(),n=function(e,t){const n=document.createElementNS("http://www.w3.org/2000/svg","image");return n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t),n.setAttribute("width",e),n.setAttribute("height",e),n}(lf,of);return t.appendChild(n),e.appendChild(t),{get container(){return e},get svg(){return t},set imageUrl(e){n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",null!=e?e:of)},set imageSize(e){const i=null!=e?e:lf;t.setAttribute("width",i),t.setAttribute("height",i),n.setAttribute("width",i),n.setAttribute("height",i)},set visible(t){e.style.visibility=t?"visible":"hidden"},set opacity(e){t.style.opacity=e},set transform(e){t.style.transform=e}}}();return t.appendChild(a.container),{get root(){return t},get canvasWrapper(){return i},get loading(){return r},get prompt(){return a},set canvasVisible(e){i.visible=e},set posterVisible(e){n.style.visibility=e?"visible":"hidden"},loadPoster:e=>{n.style.backgroundImage=e?`url(${e})`:""}}}var hf,Af,uf,df;class pf extends HTMLElement{constructor(){super(),hf.add(this),Af.set(this,void 0),uf.set(this,void 0),z(this,Af,function(){let e,t,n,i,r,a,s,o,l,c,h,A,u,d,p,f,g,m,v,E,b,C,_,I,x,y,w,M,S,B,T,R,D,Q,U,L,P=()=>{},N=()=>{},F=()=>{},O=()=>{},k=()=>{},G=()=>{},H=()=>{},z=()=>{},V=()=>{},W=()=>{},q=()=>{},j=()=>{},Y=()=>{},X=()=>{},K=()=>{},J=()=>{},Z=()=>{},$=()=>{},ee=()=>{},te=()=>{},ne=()=>{},ie=()=>{},re=()=>{},ae=()=>{},se=()=>{},oe=()=>{},le=()=>{},ce=()=>{},he=()=>{},Ae=()=>{},ue=()=>{},de=()=>{},pe=()=>{},fe=()=>{},ge=()=>{},me=()=>{};function ve(){e=!1,t=!1,n=null,i=null,r=null,a=null,s=null,o=null,l=null,c=null,h=null,A=null,u=null,d=null,p=!1,f=!0,g=null,m=null,v=null,E=null,b=null,C=null,_=!0,I=null,x=null,y=!1,w=!1,M=null,S=null,B=null,T=null,R=null,D=null,Q=null,U=null,L=!1}return ve(),{get initialized(){return e},set initialized(t){const n=t!==e;e=t,t||ve(),n&&(null==P||P(e))},set onInitializedChange(e){P=e},get paused(){return t},set paused(e){const n=e!==t;t=e,n&&(null==N||N(t))},set onPausedChange(e){N=e},get posterUrl(){return n},set posterUrl(e){const t=e!==n;n=e,t&&(null==F||F(e))},set onPosterUrlChange(e){F=e},set glbUrl(e){const t=e!==i;i=e,t&&(null==O||O(i))},set onGlbUrlChange(e){O=e},set envUrl(e){const t=e!==r;r=e,t&&(null==k||k(r))},set onEnvUrlChange(e){k=e},set diamondEnvUrl(e){const t=e!==a;a=e,t&&(null==G||G(a))},set onDiamondEnvUrlChange(e){G=e},set envRotation(e){const t=e!==s;s=e,t&&(null==H||H(s))},set onEnvRotationChange(e){H=e},set toneMapping(e){const t=e!==o;o=e,t&&(null==z||z(o))},set onToneMappingChange(e){z=e},set toneMappingExposure(e){const t=e!==l;l=e,t&&(null==V||V(l))},set onToneMappingExposureChange(e){V=e},set bloomEnabled(e){const t=e!==c;c=e,t&&(null==W||W(c))},set onBloomEnabledChange(e){W=e},set bloomStrength(e){const t=e!==h;h=e,t&&(null==q||q(h))},set onBloomStrengthChange(e){q=e},set bloomRadius(e){const t=e!==A;A=e,t&&(null==j||j(A))},set onBloomRadiusChange(e){j=e},set bloomThreshold(e){const t=e!==u;u=e,t&&(null==Y||Y(u))},set onBloomThresholdChange(e){Y=e},set category(e){const t=e!==d;d=e,t&&(null==X||X(d))},set onCategoryChange(e){X=e},get glbLocal(){return p},set glbLocal(e){const t=e!==p;p=e,t&&(null==K||K(p))},set onGlbLocalChange(e){K=e},set interactive(e){const t=e!==f;f=e,t&&(null==J||J(f))},set onInteractiveChange(e){J=e},set onModelLoaded(e){const t=e!==g;g=e,t&&(null==Z||Z(g))},set onOnModelLoadedChange(e){Z=e},set onRendered(e){const t=e!==m;m=e,t&&(null==$||$(m))},set onOnRenderedChange(e){$=e},set onInteracted(e){const t=e!==v;v=e,t&&(null==ee||ee(v))},set onOnInteractedChange(e){ee=e},set onInteractionPerf(e){const t=e!==E;E=e,t&&(null==te||te(E))},set onOnInteractionPerfChange(e){te=e},get onError(){return b},set onError(e){const t=e!==b;b=e,t&&(null==ne||ne(b))},set onOnErrorChange(e){ne=e},set touchAction(e){const t=e!==C;C=e,t&&(null==ie||ie(C))},set onTouchActionChange(e){ie=e},set zoomEnabled(e){const t=e!==_;_=e,t&&(null==re||re(_))},set onZoomEnabledChange(e){re=e},set minZoom(e){const t=e!==I;I=e,t&&(null==ae||ae(I))},set onMinZoomChange(e){ae=e},set maxZoom(e){const t=e!==x;x=e,t&&(null==se||se(x))},set onMaxZoomChange(e){se=e},set preserveCameraOnReload(e){const t=e!==y;y=e,t&&(null==oe||oe(y))},set onPreserveCameraOnReloadChange(e){oe=e},set alwaysTransparentBackground(e){const t=e!==w;w=e,t&&(null==le||le(w))},set onAlwaysTransparentBackgroundChange(e){le=e},set defaultFov(e){const t=e!==M;M=e,t&&(null==ce||ce(M))},set onDefaultFovChange(e){ce=e},set fovMultiplier(e){const t=e!==S;S=e,t&&(null==he||he(S))},set onFovMultiplierChange(e){he=e},set defaultCameraPositions(e){const t=e!==B;B=e,t&&(null==Ae||Ae(B))},set onDefaultCameraPositionsChange(e){Ae=e},set interactionPromptUrl(e){const t=e!==T;T=e,t&&(null==ue||ue(T))},set onInteractionPromptUrlChange(e){ue=e},set interactionPromptSize(e){const t=e!==R;R=e,t&&(null==de||de(R))},set onInteractionPromptSizeChange(e){de=e},set animation(e){const t=e!==D;D=e,t&&(null==pe||pe(D))},set onAnimationChange(e){pe=e},set nonLiveRendering(e){const t=e!==Q;Q=e,t&&(null==fe||fe(Q))},set onNonLiveRenderingChange(e){fe=e},set baseUrl(e){const t=e!==U;U=e,t&&(null==ge||ge(U))},set onBaseUrlChange(e){ge=e},get downloadCacheEnabled(){return L},set downloadCacheEnabled(e){const t=e!==L;L=e,t&&(null==me||me(L))},set onDownloadCacheEnabledChange(e){me=e}}}());const e=cf(H(this,Af,"f"));z(this,uf,Gp(H(this,Af,"f"),e)),this.attachShadow({mode:"open"}).appendChild(e.root)}connectedCallback(){H(this,Af,"f").initialized=!0}disconnectedCallback(){H(this,Af,"f").paused=!0,H(this,Af,"f").initialized=!1}attributeChangedCallback(e,t,n){var i,r;if(H(this,Af,"f").initialized)if("paused"===e)H(this,Af,"f").paused=ff(n);else if("poster-url"===e)H(this,Af,"f").posterUrl=n;else if("glb-url"===e)H(this,Af,"f").glbUrl=function(e){if(null==e?void 0:e.includes("|")){const[t,n]=e.split("|",2);return{left:t,right:n}}return e}(n);else if("env-url"===e)H(this,Af,"f").envUrl=n;else if("diamond-env-url"===e)H(this,Af,"f").diamondEnvUrl=n;else if("env-rotation"===e)H(this,Af,"f").envRotation=gf(n);else if("tone-mapping"===e)H(this,Af,"f").toneMapping=(r=i=n,jc.includes(r)?i:null);else if("tone-mapping-exposure"===e)H(this,Af,"f").toneMappingExposure=gf(n);else if("bloom-enabled"===e)H(this,Af,"f").bloomEnabled=ff(n);else if("bloom-strength"===e)H(this,Af,"f").bloomStrength=gf(n);else if("bloom-radius"===e)H(this,Af,"f").bloomRadius=gf(n);else if("bloom-threshold"===e)H(this,Af,"f").bloomThreshold=gf(n);else if("category"===e)H(this,Af,"f").category=function(e){return Xc(e)?e:null}(n);else if("glb-local"===e)H(this,Af,"f").glbLocal=function(e){if(null==e?void 0:e.includes("|")){const[t,n]=e.split("|",2);return{left:"true"===t,right:"true"===n}}return ff(e)}(n);else if("interactivity-disabled"===e)H(this,Af,"f").interactive=!ff(n);else if("touch-action"===e)H(this,Af,"f").touchAction=function(e){return function(e){return Yc.includes(e)}(e)?e:null}(n);else if("zoom-disabled"===e)H(this,Af,"f").zoomEnabled=!ff(n);else if("min-zoom"===e)H(this,Af,"f").minZoom=gf(n);else if("max-zoom"===e)H(this,Af,"f").maxZoom=gf(n);else if("preserve-camera-on-reload"===e)H(this,Af,"f").preserveCameraOnReload=ff(n);else if("always-transparent-background"===e)H(this,Af,"f").alwaysTransparentBackground=ff(n);else if("default-fov"===e)H(this,Af,"f").defaultFov=gf(n);else if("fov-multiplier"===e)H(this,Af,"f").fovMultiplier=gf(n);else if("interaction-prompt-url"===e)H(this,Af,"f").interactionPromptUrl=n;else if("interaction-prompt-size"===e)H(this,Af,"f").interactionPromptSize=n;else if("non-live-rendering"===e)H(this,Af,"f").nonLiveRendering=ff(n);else if("base-url"===e)H(this,Af,"f").baseUrl=n;else{if("download-cache-enabled"!==e)throw new Error(`Unknown attribute: ${e} (changed from '${t}' to '${n}')`);H(this,Af,"f").downloadCacheEnabled=ff(n)}}set paused(e){H(this,hf,"m",df).call(this,"paused",e?"":null)}set posterUrl(e){H(this,hf,"m",df).call(this,"poster-url",e)}set glbUrl(e){H(this,hf,"m",df).call(this,"glb-url","string"==typeof e||null==e?e:`${e.left}|${e.right}`)}set envUrl(e){H(this,hf,"m",df).call(this,"env-url",e)}set diamondEnvUrl(e){H(this,hf,"m",df).call(this,"diamond-env-url",e)}set envRotation(e){H(this,hf,"m",df).call(this,"env-rotation",null!=e?`${e}`:null)}set toneMapping(e){H(this,hf,"m",df).call(this,"tone-mapping",e)}set toneMappingExposure(e){H(this,hf,"m",df).call(this,"tone-mapping-exposure",`${e}`)}set bloomEnabled(e){H(this,hf,"m",df).call(this,"bloom-enabled",e?"":null)}set bloomStrength(e){H(this,hf,"m",df).call(this,"bloom-strength",null!=e?`${e}`:null)}set bloomRadius(e){H(this,hf,"m",df).call(this,"bloom-radius",null!=e?`${e}`:null)}set bloomThreshold(e){H(this,hf,"m",df).call(this,"bloom-threshold",null!=e?`${e}`:null)}set category(e){H(this,hf,"m",df).call(this,"category",e)}set animation(e){H(this,Af,"f").animation=e}set glbLocal(e){H(this,hf,"m",df).call(this,"glb-local","boolean"==typeof e||null==e?e?"":null:`${e.left}|${e.right}`)}set interactivityDisabled(e){H(this,hf,"m",df).call(this,"interactivity-disabled",e?"":null)}set touchAction(e){H(this,hf,"m",df).call(this,"touch-action",e)}set zoomDisabled(e){H(this,hf,"m",df).call(this,"zoom-disabled",e?"":null)}set minZoom(e){H(this,hf,"m",df).call(this,"min-zoom",null!=e?`${e}`:null)}set maxZoom(e){H(this,hf,"m",df).call(this,"max-zoom",null!=e?`${e}`:null)}set preserveCameraOnReload(e){H(this,hf,"m",df).call(this,"preserve-camera-on-reload",e?"":null)}set alwaysTransparentBackground(e){H(this,hf,"m",df).call(this,"always-transparent-background",e?"":null)}set defaultFov(e){H(this,hf,"m",df).call(this,"default-fov",`${e}`)}set fovMultiplier(e){H(this,hf,"m",df).call(this,"fov-multiplier",`${e}`)}set defaultCameraPositions(e){H(this,Af,"f").defaultCameraPositions=e}set interactionPromptUrl(e){H(this,hf,"m",df).call(this,"interaction-prompt-url",e)}set interactionPromptSize(e){H(this,hf,"m",df).call(this,"interaction-prompt-size",e)}set nonLiveRendering(e){H(this,hf,"m",df).call(this,"non-live-rendering",e?"":null)}set baseUrl(e){H(this,hf,"m",df).call(this,"base-url",e)}set downloadCacheEnabled(e){H(this,hf,"m",df).call(this,"download-cache-enabled",e?"":null)}set onModelLoaded(e){H(this,Af,"f").onModelLoaded=e}set onRendered(e){H(this,Af,"f").onRendered=e}set onInteracted(e){H(this,Af,"f").onInteracted=e}set onInteractionPerf(e){H(this,Af,"f").onInteractionPerf=e}set onError(e){H(this,Af,"f").onError=e}render(e){H(this,uf,"f").render(e)}flushChanges(){return H(this,uf,"f").flushChanges()}}function ff(e){return null!=e}function gf(e){return null==e?null:Number.parseFloat(e)}if(Af=new WeakMap,uf=new WeakMap,hf=new WeakSet,df=function(e,t){null==t?this.removeAttribute(e):this.setAttribute(e,t)},pf.observedAttributes=["paused","poster-url","glb-url","env-url","diamond-env-url","env-rotation","tone-mapping","tone-mapping-exposure","category","glb-local","interactivity-disabled","touch-action","zoom-disabled","min-zoom","max-zoom","preserve-camera-on-reload","always-transparent-background","default-fov","fov-multiplier","interaction-prompt-url","interaction-prompt-size","bloom-enabled","bloom-strength","bloom-radius","bloom-threshold","non-live-rendering","base-url","download-cache-enabled"],null==window)throw new Error("window is not defined. ShopAR 3D only works in a browser environment.");const{customElements:mf}=window;try{mf.define("shopar-3d",pf)}catch($d){console.error($d)}const vf={bg:{var:`${Q}-3d-bg`,default:"#ffffff"}};function Ef(e){var t,n;const i=document.createElementNS("http://www.w3.org/2000/svg","svg");return i.setAttribute("width",null!==(t=e.getAttribute("width"))&&void 0!==t?t:"1rem"),i.setAttribute("height",null!==(n=e.getAttribute("height"))&&void 0!==n?n:"1rem"),i.appendChild(e),i}function bf(e,t){const n=document.createElementNS("http://www.w3.org/2000/svg","image");return n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22/%3E"),n.setAttribute("width",e),n.setAttribute("height",e),n}var Cf;function _f(){const e=function(){const e=document.createElement("div");e.id="shopar-main";const t=e.style;return t.position="absolute",t.top="0",t.bottom="0",t.left="0",t.right="0",t.pointerEvents="none",e}(),t=function(){const e=document.createElement("div");return e.style.textAlign="center",e}(),n=function(){const e=new Image;e.draggable=!1;const t=e.style;return t.maxWidth="100%",t.maxHeight="100%",e}(),i=function(e,t){const n=document.createElement("div"),i=n.style;i.position="absolute",i.top="0",i.left="0",i.width="100%",i.height="100%",i.display="none",i.pointerEvents="auto",i.userSelect="none";const r=document.createElement("div"),a=r.style;a.position="relative",a.top="0",a.left="0",a.width="100%",a.height="100%",a.display="flex",a.flexDirection="column",a.justifyContent="center",a.alignItems="center",a.background=U(k.bg),n.appendChild(r),r.appendChild(e);const s=document.createElement("div");return s.appendChild(t),r.appendChild(s),n}(t,n);e.appendChild(i);const r=function(){const e=document.createElement("div"),t=e.style;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",t.display="none",t.pointerEvents="auto",e}();e.appendChild(r);const a=document.createElement("div");a.dataset.placeholder="shopar-3d",e.appendChild(a);let s=null;const o=function(){const e=document.createElement("div");return e.style.textAlign="center",e.style.color=U(F.textColor),e}(),l=function(){const e=new Image,{style:t}=e;return t.maxWidth=U(F.imgMaxWidth),t.maxHeight=U(F.imgMaxHeight),t.objectFit="contain",e}(),c=function(e,t){const n=document.createElement("div"),{style:i}=n;return i.position="absolute",i.width="100%",i.height="100%",i.opacity="0",i.display="flex",i.flexDirection="column",i.justifyContent="center",i.alignItems="center",i.gap=U(F.gap),i.backgroundColor=U(F.bg),i.transition="0.3s ease-in-out opacity",n.appendChild(e),n.appendChild(t),n}(o,l);e.appendChild(c);const h=function(){const e=document.createElement("div"),t=e.style;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",t.pointerEvents="auto",t.userSelect="none",t.display=U(O.containerDisplay),t.flexDirection="column",t.justifyContent="center",t.alignItems="center",t.gap=U(O.containerGap),t.backgroundColor=U(O.containerBg),e}(),A=function(e){const t=document.createElement("div");return t.textContent=e,t.style.textAlign="center",t}(R["loading.ar"]);h.appendChild(A);const u=function(){const e=document.createElement("div"),t=e.style;return t.position="relative",t.overflow="hidden",t.width=U(O.barWidth),t.height=U(O.barHeight),t.backgroundColor=U(O.barBg),t.borderRadius=U(O.barRadius),e}(),d=function(){const e=document.createElement("div"),t=e.style;return t.height="100%",t.width="0%",t.background=U(O.barFg),t.borderRadius=U(O.barRadius),t.transition="width 0.05s ease-out",e}(),p=function(){const e=document.createElement("div");return e.textContent="0%",e.style.textAlign="center",e}();u.appendChild(d),h.appendChild(u),h.appendChild(p),e.appendChild(h);const f=function(){const e=document.createElement("div");return e.style.textAlign="center",e}(),g=function(e){const t=document.createElement("div"),n=t.style;n.position="absolute",n.width="100%",n.height="100%",n.display="none",n.pointerEvents="auto",n.userSelect="none";const i=document.createElement("div"),r=i.style;return r.position="absolute",r.width="100%",r.height="100%",r.backgroundColor="#ffffff",r.display="flex",r.flexDirection="column",r.justifyContent="center",r.alignItems="center",t.appendChild(i),i.appendChild(e),t}(f);e.appendChild(g);const m=function(){const e=document.createElement("div");e.role="group",e.ariaLabel="Preview type chooser";const{style:t}=e;return t.display="none",t.position="absolute",t.width="100%",t.bottom="0",t.paddingBottom=U(N.paddingBottom),t.justifyContent="center",t.gap=U(N.gap),e}();e.appendChild(m);const v=bf("1.75rem"),E=P("Try-on","Launch ShopAR virtual try-on",Ef(v));m.appendChild(E);const b=bf("1.75rem"),C=P("3D","Launch ShopAR 3D preview",Ef(b));m.appendChild(C);const _=bf("1.75rem"),I=P("Close","Close ShopAR view",Ef(_));m.append(I);let x,y,w=Cf.None,S=!1,B=!1,T=!1,D=!1;function Q(){d.style.width="100%",p.textContent="100%",h.style.visibility="hidden",d.style.width="0%",p.textContent="0%"}return{setTargetElement:function(t){t.style.position="relative",t.appendChild(e)},getQRTarget:function(){return i},getQRImage:function(){return n},getDeepARTarget:function(){return r},getDeepARPrompt:function(){return c},getThreeTarget:function(){return null==s&&(s=function(){const e=document.createElement("shopar-3d"),{style:t}=e;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",t.pointerEvents="auto",t.display="none",t.background=U(vf.bg),e}(),a.replaceWith(s)),s},hasThreeTarget:function(){return null!=s},removeThreeTarget:function(){null!=s&&(s.replaceWith(a),s=null)},customizeDeepARPrompt:function(e,t){o.textContent=e,l.src=t},customizeCameraError:function(e){f.textContent=null!=e?e:"Please reload page and allow camera access to continue"},customizeQRPrompt:function(e){t.textContent=null!=e?e:"Scan on mobile or tablet to try on"},setVisibilityParameters:function(e,t,n,i,r,a){var s;S=e,B=t,T=n,D=i,x=r,y=a,xf(m,S),xf(E,S&&(T||B)&&w===Cf.None),xf(C,S&&D&&w===Cf.None),xf(I,S&&w!==Cf.None),Q(),S||""===(s=g).style.display&&If(s,!1)},getUIState:function(){return w},setUIState:function(e){w=e,w===Cf.None?(Q(),S&&(If(g,!1),xf(I,!1),(B||T)&&xf(E,!0),D&&xf(C,!0))):w===Cf.QR||w===Cf.AR?S&&(If(g,!1),xf(E,!1),xf(C,D&&"AR"===y),xf(I,"AR"!==y)):w===Cf.Preview&&S&&(If(g,!1),xf(E,(B||T)&&"3D"===y),xf(C,!1),xf(I,"3D"!==y))},setDefaultUIActions:function(e,t,n){S&&((B||T)&&(!function(e){const t={Glasses:"glasses.svg",Shoes:"shoe.svg",Watches:"watch.svg",Bracelets:"watch.svg",Scarves:"glasses.svg",Hats:"glasses.svg",Necklaces:"glasses.svg"},n=null!=e&&t[e]||t.Glasses,i=`${M()}/img/icons/${n}`;v.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i)}(x),E.onclick=e),D&&(b.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",`${M()}/img/icons/cube.svg`),C.onclick=t),_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",`${M()}/img/icons/close.svg`),I.onclick=n)},startDeepARLoading:function(){d.style.width="0%",h.style.visibility="visible"},stopDeepARLoading:Q,updateDeepARLoadingProgress:function(e){d.style.width=`${e}%`,p.textContent=`${Math.floor(e)}%`},showCameraError:function(){S&&If(g,!0)}}}function If(e,t){e.style.display=t?"":"none"}function xf(e,t){e.style.display=t?"flex":"none"}!function(e){e[e.None=0]="None",e[e.QR=1]="QR",e[e.AR=2]="AR",e[e.Preview=3]="Preview"}(Cf||(Cf={}));const yf=new Map;function wf(e){let t=yf.get(e);return null==t?(t=function(){let e=0,t=null,n=null,i=!0;const r=()=>(null==t&&(t=_f()),t);return{getSetupId:()=>e,incrementSetupId_:()=>e++,getUI_:()=>t,findUI:r,findQR:()=>{if(null==n){const{getQRTarget:e,getQRImage:t}=r();n=T(e(),t())}return n},isInteractive:()=>i,setInteractive:e=>{i=e,(null==t?void 0:t.hasThreeTarget())&&(t.getThreeTarget().interactivityDisabled=!e)}}}(),yf.set(e,t)):t.incrementSetupId_(),t}function Mf(e){for(const t of yf.values()){if(t===e)continue;const n=t.getUI_();if(null==n)continue;const{getUIState:i,setUIState:r}=n;i()===Cf.AR&&r(Cf.None)}}const Sf=[];for(let e=0;e<256;++e)Sf.push((e+256).toString(16).slice(1));let Bf;const Tf=new Uint8Array(16);var Rf={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Df(e,t,n){const i=(e=e||{}).random??e.rng?.()??function(){if(!Bf){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Bf=crypto.getRandomValues.bind(crypto)}return Bf(Tf)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,function(e,t=0){return(Sf[e[t+0]]+Sf[e[t+1]]+Sf[e[t+2]]+Sf[e[t+3]]+"-"+Sf[e[t+4]]+Sf[e[t+5]]+"-"+Sf[e[t+6]]+Sf[e[t+7]]+"-"+Sf[e[t+8]]+Sf[e[t+9]]+"-"+Sf[e[t+10]]+Sf[e[t+11]]+Sf[e[t+12]]+Sf[e[t+13]]+Sf[e[t+14]]+Sf[e[t+15]]).toLowerCase()}(i)}function Qf(e,t,n){return Rf.randomUUID&&!e?Rf.randomUUID():Df(e)}var Uf="undefined"!=typeof Float32Array?Float32Array:Array;function Lf(){var e=new Uf(16);return Uf!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function Pf(e,t){var n=t[0],i=t[1],r=t[2],a=t[3],s=t[4],o=t[5],l=t[6],c=t[7],h=t[8],A=t[9],u=t[10],d=t[11],p=t[12],f=t[13],g=t[14],m=t[15],v=n*o-i*s,E=n*l-r*s,b=n*c-a*s,C=i*l-r*o,_=i*c-a*o,I=r*c-a*l,x=h*f-A*p,y=h*g-u*p,w=h*m-d*p,M=A*g-u*f,S=A*m-d*f,B=u*m-d*g,T=v*B-E*S+b*M+C*w-_*y+I*x;return T?(T=1/T,e[0]=(o*B-l*S+c*M)*T,e[1]=(r*S-i*B-a*M)*T,e[2]=(f*I-g*_+m*C)*T,e[3]=(u*_-A*I-d*C)*T,e[4]=(l*w-s*B-c*y)*T,e[5]=(n*B-r*w+a*y)*T,e[6]=(g*b-p*I-m*E)*T,e[7]=(h*I-u*b+d*E)*T,e[8]=(s*S-o*w+c*x)*T,e[9]=(i*w-n*S-a*x)*T,e[10]=(p*_-f*b+m*v)*T,e[11]=(A*b-h*_-d*v)*T,e[12]=(o*y-s*M-l*x)*T,e[13]=(n*M-i*y+r*x)*T,e[14]=(f*E-p*C-g*v)*T,e[15]=(h*C-A*E+u*v)*T,e):null}function Nf(e,t,n){var i=t[0],r=t[1],a=t[2],s=t[3],o=t[4],l=t[5],c=t[6],h=t[7],A=t[8],u=t[9],d=t[10],p=t[11],f=t[12],g=t[13],m=t[14],v=t[15],E=n[0],b=n[1],C=n[2],_=n[3];return e[0]=E*i+b*o+C*A+_*f,e[1]=E*r+b*l+C*u+_*g,e[2]=E*a+b*c+C*d+_*m,e[3]=E*s+b*h+C*p+_*v,E=n[4],b=n[5],C=n[6],_=n[7],e[4]=E*i+b*o+C*A+_*f,e[5]=E*r+b*l+C*u+_*g,e[6]=E*a+b*c+C*d+_*m,e[7]=E*s+b*h+C*p+_*v,E=n[8],b=n[9],C=n[10],_=n[11],e[8]=E*i+b*o+C*A+_*f,e[9]=E*r+b*l+C*u+_*g,e[10]=E*a+b*c+C*d+_*m,e[11]=E*s+b*h+C*p+_*v,E=n[12],b=n[13],C=n[14],_=n[15],e[12]=E*i+b*o+C*A+_*f,e[13]=E*r+b*l+C*u+_*g,e[14]=E*a+b*c+C*d+_*m,e[15]=E*s+b*h+C*p+_*v,e}function Ff(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Of(e,t){var n=t[0],i=t[1],r=t[2],a=t[4],s=t[5],o=t[6],l=t[8],c=t[9],h=t[10];return e[0]=Math.hypot(n,i,r),e[1]=Math.hypot(a,s,o),e[2]=Math.hypot(l,c,h),e}function kf(e,t){var n=new Uf(3);Of(n,t);var i=1/n[0],r=1/n[1],a=1/n[2],s=t[0]*i,o=t[1]*r,l=t[2]*a,c=t[4]*i,h=t[5]*r,A=t[6]*a,u=t[8]*i,d=t[9]*r,p=t[10]*a,f=s+h+p,g=0;return f>0?(g=2*Math.sqrt(f+1),e[3]=.25*g,e[0]=(A-d)/g,e[1]=(u-l)/g,e[2]=(o-c)/g):s>h&&s>p?(g=2*Math.sqrt(1+s-h-p),e[3]=(A-d)/g,e[0]=.25*g,e[1]=(o+c)/g,e[2]=(u+l)/g):h>p?(g=2*Math.sqrt(1+h-s-p),e[3]=(u-l)/g,e[0]=(o+c)/g,e[1]=.25*g,e[2]=(A+d)/g):(g=2*Math.sqrt(1+p-s-h),e[3]=(o-c)/g,e[0]=(u+l)/g,e[1]=(A+d)/g,e[2]=.25*g),e}function Gf(){var e=new Uf(3);return Uf!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Hf(e,t,n){var i=new Uf(3);return i[0]=e,i[1]=t,i[2]=n,i}function zf(e,t){var n=t[0]-e[0],i=t[1]-e[1],r=t[2]-e[2];return Math.hypot(n,i,r)}function Vf(e,t,n){var i=t[0],r=t[1],a=t[2],s=n[3]*i+n[7]*r+n[11]*a+n[15];return s=s||1,e[0]=(n[0]*i+n[4]*r+n[8]*a+n[12])/s,e[1]=(n[1]*i+n[5]*r+n[9]*a+n[13])/s,e[2]=(n[2]*i+n[6]*r+n[10]*a+n[14])/s,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function Wf(){var e=new Uf(4);return Uf!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}Gf(),function(){var e,t=(e=new Uf(4),Uf!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e)}();var qf;Gf(),Hf(1,0,0),Hf(0,1,0),Wf(),Wf(),qf=new Uf(9),Uf!=Float32Array&&(qf[1]=0,qf[2]=0,qf[3]=0,qf[5]=0,qf[6]=0,qf[7]=0),qf[0]=1,qf[4]=1,qf[8]=1;async function jf(){const e=await async function(){const e=await fetch("data:application/octet-stream;base64,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");return await function(e={}){var t,n,i,r,a,s=e,o=new Promise((e,n)=>{t=e}),l={1076:e=>{const t=[e,Date.now()],n=t.length-2,r=["addEventListener","alert","atob","blur","btoa","cancelAnimationFrame","localStorage","location","locationbar","hash","hasOwnProperty","host","hostname","href","requestAnimationFrame","navigator","userAgent"],a=[2,12,7,1],s=window[r[r[a[a[a.length-1]]+2].length-a[t.length]+1]][r[Math.pow(a[n],r[a.length].length)]]||"no user agent",o=c(32);for(let e=0;e<32;++e)i[o+e]=s.charCodeAt(e%s.length);return o},1870:e=>{var t,n=function(){var e;try{e=Function('return (function() {}.constructor("return this")( ));')()}catch(t){e=window}return e}(),r=Date.now();for(var a in n)if(8==a.length&&110==a.charCodeAt(7)&&105==a.charCodeAt(5)&&97==a.charCodeAt(3)&&108==a.charCodeAt(0)){r=a,t=e;break}for(var s in n[r])if(8==s.length&&97==s.charCodeAt(5)&&104==s.charCodeAt(0)){t=s;break}const o=n[r][t]||"no hostname",l=c(32);for(let e=0;e<32;++e)i[l+e]=o.charCodeAt(e%o.length);return l}};s.noExitRuntime;var c,h=[],A=(e,t,s)=>{var o=((e,t)=>{var s;for(h.length=0;s=i[e++];){var o=105!=s;t+=(o&=112!=s)&&t%8?4:0,h.push(112==s?r[t>>2]:105==s?n[t>>2]:a[t>>3]),t+=o?8:4}return h})(t,s);return l[e](...o)},u={a:{a:(e,t,n)=>A(e,t,n),c:()=>Date.now(),b:e=>{i.length,function(){throw"OOM"}()}}};return WebAssembly.instantiate(s.wasm,u).then(e=>{var o,l=e.instance.exports;s._magic=l.f,s._free=l.g,s._malloc=c=l.i,o=l.d.buffer,s.HEAPU8=i=new Uint8Array(o),n=new Int32Array(o),r=new Uint32Array(o),a=new Float64Array(o),function(e){e.e()}(l),t(s)}),o}({wasm:await e.arrayBuffer()})}();return function(t){const n=e._malloc(32);for(let i=0;i<t.size()&&i<32;i++)e.HEAPU8[n+i]=t.get(i);const i=e._malloc(64);e._magic(n,i);const r=new Uint8Array(64);for(let t=0;t<64;++t)r[t]=e.HEAPU8[i+t];return e._free(n),e._free(i),r}}let Yf,Xf,Kf,Jf,Zf,$f,eg=!1,tg=null,ng=[],ig=[];function rg(e){return h(this,void 0,void 0,function*(){eg=!1;const{ShopAR__TrueScale:t}=window;yield t.initialize(`${M()}/wasm/mediapipe`,e),tg&&clearInterval(tg);const n=[],i=[];tg=setInterval(()=>h(this,void 0,void 0,function*(){if(eg)return;const{error:e,faceWidth:r,ipd:a,translation:s,rotation:o}=yield t.predict(performance.now());eg||(null!=s&&null!=o&&function(e){for(let t of ng)t(e)}({translation:s,rotation:o}),null==e&&(n.push(r),i.push(a),n.length<10||(n.shift(),i.shift(),function(e,t){for(let n of ig)n({faceWidth:e,IPD:t})}(sg(n),sg(i)))))}),200)})}function ag(){ig=[],ng=[],eg=!0}function sg(e){let t=0;const n=e.length;for(let i=0;i<n;i++)t+=e[i];return t/n}let og=null;const lg=new Set;let cg,hg,Ag,ug,dg,pg,fg=!1;function gg(){null==Yf&&(Yf=S(`${M()}/shopar-deepar.js`,"ShopAR__DeepAR"))}function mg(){null==Xf&&(Xf=S(`${M()}/shopar-true-scale.js`,"ShopAR__TrueScale"))}function vg(e){return h(this,void 0,void 0,function*(){const{licenseKey:t,truescaleUsecase:n,onProgress:i,effectUrl:r,effectOptions:a}=e;a&&null==a.envmap&&(a.envmap=`${M()}/deepar/default_envmap.webp`),dg=n;const s=null!=e.videoConfig;return null==cg&&(cg=(()=>h(this,void 0,void 0,function*(){fg=!1;const n=function(e){var t;const n={Glasses:"user",Shoes:"environment",Watches:"environment",Bracelets:"environment",Hats:"user",Scarves:"user",Necklaces:"user"};return null==e?"user":null!==(t=n[e])&&void 0!==t?t:"user"}(Zf);try{Kf=yield window.ShopAR__DeepAR.deepar.initialize({licenseKey:t||"your_license_key_goes_here",previewElement:$f,effect:r,effectOptions:a,rootPath:`${M()}/deepar`,additionalOptions:{hint:pg,cameraConfig:{disableDefaultCamera:s,facingMode:n},pixelRatio:Math.min(window.devicePixelRatio,2),onVerify:yield jf()},onProgress:i})}catch(e){throw cg=null,e}Kf.setWatchTicking("Watches"===Zf),s&&Kf.setVideoElement(e.videoConfig.video,null==e?void 0:e.videoConfig.mirror),"Glasses"===Zf&&null==e.customTrueScaleFaceWidth?(yield Xf,Jf=Kf.getVideoElement(),rg(Jf),"DetectionLoop"!==dg&&kg(e=>{ug=e.faceWidth})):"Glasses"===Zf&&null!=e.customTrueScaleFaceWidth&&(ug=e.customTrueScaleFaceWidth),fg=!0,Rg(),$f.style.display=""}))()),cg})}function Eg(e,t){t=null!=t?t:function(e){const t={Glasses:["rigidFaceTrackingInit","faceInit"],Shoes:["footInit"],Watches:["wristInit"],Bracelets:["wristInit"],Hats:["rigidFaceTrackingInit","faceInit"],Scarves:["rigidFaceTrackingInit","faceInit"],Necklaces:["rigidFaceTrackingInit","faceInit"]};return null==e?void 0:t[e]}(e),e===Zf&&function(e,t){return e===t||null!=e&&null!=t&&e.length===t.length&&e.every(e=>t.find(t=>e===t))&&t.every(t=>e.find(e=>e===t))}(t,pg)||(Zf=e,pg=t)}function bg(e){Dg(),e!==$f&&($f=e,null!=Kf&&Kf.changePreviewElement($f,Math.min(window.devicePixelRatio,2)))}function Cg(e){og=e}function _g(e,t){Kf.callbacks.onFaceTracked=n=>{var i;if(n.some(e=>e.detected)){if(ug){const e=137/(ug+5);Kf.changeParameterVector("GLASSES","","scale",e,e,e,0),Kf.changeParameterVector("shopar_glasses","","scale",e,e,e,0),function(e){const t=[-8.362421,4.549,-9.275],n=[8.362421,4.549,-9.275];try{const i=Kf.getTransformationBetween("face_position","temples"),r=Fg(i,"temple_left","temple_left_outer","temple_tip_outer_left",n,e).map(Ug),a=Fg(i,"temple_right","temple_right_outer","temple_tip_outer_right",t,e).map(Ug);Kf.changeParameterVector("temple_left","","rotation",r[0],r[1],r[2],0),Kf.changeParameterVector("temple_right","","rotation",a[0],a[1],a[2],0)}catch(e){return}}(e),ag(),ug=null}e(),Qg("Glasses")}null===(i=null==t?void 0:t.onFaceTracked)||void 0===i||i.call(t,n)},Kf.callbacks.onFeetTracked=(n,i)=>{var r;(n.detected||i.detected)&&(e(),Qg("Shoes")),null===(r=null==t?void 0:t.onFeetTracked)||void 0===r||r.call(t,n,i)},Kf.callbacks.onWristTracked=n=>{var i;n.detected&&(e(),Qg("Watches")),null===(i=null==t?void 0:t.onWristTracked)||void 0===i||i.call(t,n)}}function Ig(e){ug=e}function xg(e){null==Kf||Kf.setStatsCapture(e)}function yg(e,t,n){return h(this,void 0,void 0,function*(){return null!=hg&&Ag===n||(yield hg,t.trackingInit={face:(null==pg?void 0:pg.includes("rigidFaceTrackingInit"))||(null==pg?void 0:pg.includes("faceInit")),foot:null==pg?void 0:pg.includes("footInit"),wrist:null==pg?void 0:pg.includes("wristInit")},null==t.envmap&&(t.envmap=`${M()}/deepar/default_envmap.webp`),hg=Kf.switchEffect(e,t),Kf.setWatchTicking("Watches"===Zf),Ag=n,Rg(),$f.style.display=""),hg})}function wg(e,t){null!=e&&null!=t&&(Kf.setToneMapping(e),Kf.setExposure(t))}function Mg(e,t,n,i){Kf.setBloomEnabled(!!e),null!=t&&Kf.setBloomStrength(t),null!=n&&Kf.setBloomRadius(n),null!=i&&Kf.setBloomThreshold(i)}function Sg(){null!=Kf&&(ag(),null!=Jf&&null!=Jf.srcObject&&Jf.srcObject instanceof MediaStream&&(Jf.srcObject.getTracks().forEach(e=>e.stop()),Jf=null),Kf.shutdown(),Dg(),fg=!1,Kf=null,cg=null,$f.style.display="none")}function Bg(){return fg}function Tg(e){Kf.setVideoElement(e.video,e.mirror)}function Rg(){null!=og&&(null==Zf||lg.has(Zf)||(og.style.visibility="visible",og.style.opacity="1"))}function Dg(){null!=og&&(og.style.visibility="hidden",og.style.opacity="0")}function Qg(e){null!=og&&(lg.has(e)||(lg.add(e),og.style.opacity="0"))}function Ug(e){return 180*e/Math.PI}function Lg(e,t){let n=t[0],i=t[1],r=t[2],a=t[3],s=n*n,o=i*i,l=r*r;return e[0]=Math.atan2(2*(a*n+i*r),1-2*(s+o)),e[1]=-Math.PI/2+2*Math.atan2(Math.sqrt(1+2*(a*i-n*r)),Math.sqrt(1-2*(a*i-n*r))),e[2]=Math.atan2(2*(a*r+n*i),1-2*(o+l)),e}function Pg(e,t,n){const i=Pf(Lf(),e),r=function(e,t){var n=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}(Lf(),-n),a=Nf(Lf(),i,r),s=Nf(Lf(),a,e),o=Nf(Lf(),s,t),l=kf(Wf(),o);return Lg(Gf(),l)}function Ng(e,t){let n=Kf.getTransformationBetween("face_position",t);const i=Lg(Gf(),kf(Wf(),n)).map(Ug);n=function(e,t,n,i){var r=t[0],a=t[1],s=t[2],o=t[3],l=r+r,c=a+a,h=s+s,A=r*l,u=r*c,d=r*h,p=a*c,f=a*h,g=s*h,m=o*l,v=o*c,E=o*h,b=i[0],C=i[1],_=i[2];return e[0]=(1-(p+g))*b,e[1]=(u+E)*b,e[2]=(d-v)*b,e[3]=0,e[4]=(u-E)*C,e[5]=(1-(A+g))*C,e[6]=(f+m)*C,e[7]=0,e[8]=(d+v)*_,e[9]=(f-m)*_,e[10]=(1-(A+p))*_,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}(Lf(),function(e,t,n,i){var r=.5*Math.PI/180;t*=r,n*=r,i*=r;var a=Math.sin(t),s=Math.cos(t),o=Math.sin(n),l=Math.cos(n),c=Math.sin(i),h=Math.cos(i);return e[0]=a*l*h-s*o*c,e[1]=s*o*h+a*l*c,e[2]=s*l*c-a*o*h,e[3]=s*l*h+a*o*c,e}(Wf(),i[0],0,i[2]),Ff(Gf(),n),Of(Gf(),n));const r=Pf(Lf(),e);return Nf(Lf(),r,n)}function Fg(e,t,n,i,r,a){let s=Ng(e,t);const o=Nf(Lf(),e,s),l=Vf(Gf(),Ff(Gf(),o),function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}(Lf(),[a,a,a])),c=Math.atan2(r[0]-l[0],Math.abs(r[2]-l[2]));let h;try{h=Kf.getTransformationBetween(t,n)}catch(t){return Pg(e,s,c)}const A=Nf(Lf(),o,h),u=Hf(l[0],r[1],r[2]),d=Vf(Gf(),u,Pf(Lf(),A));let p=Kf.getClosestPointOnMesh(n,d);try{const e=Kf.getClosestPointOnMesh(i,d);zf(d,e)<zf(d,p)&&(p=e)}catch(e){}const f=Vf(Gf(),p,A);return Pg(e,s,c-Math.atan2(f[0]-l[0],Math.abs(f[2]-l[2])))}function Og(e){!function(e){ng.push(e)}(e)}function kg(e){!function(e){ig.push(e)}(e)}function Gg(e){let t,n=!1,i=!1;return{onTracked(r,a){if(!n&&a)if(i){if(r-t>=2e3){const{Fps:t,"Engine update":r,"Face tracking":a,"Foot tracking time":s,"Wrist tracking time":o}=null==Kf?void 0:Kf.getStats();xg(!1),n=!0,i=!1,e({fps:t,tickDuration:r.avg,faceTrackDuration:a.avg,footTrackDuration:s.avg,wristTrackDuration:o.avg})}}else i=!0,t=r,xg(!0);i&&!a&&(i=!1,xg(!1))}}}function Hg(){let e=!1,t=0,n=0;return{get dirty(){return e},clearDirty(){e=!1},get engagementMs(){return Math.round(t)},interact(i){const r=i-n;n=i,r<200&&(t+=r,e=!0)}}}function zg(){let e,t,n=0,i=0,r=2e3;return{set debounceDurationMs(e){r=null!=e?e:2e3},set onDebouncedEngagement(e){t=e},interact(a){const s=a-i;i=a,s<200&&(n+=s),e&&clearTimeout(e),e=setTimeout(()=>{n>0&&t&&(t(Math.round(n)),n=0,i=0),e=void 0},r)},flush(){e&&(clearTimeout(e),e=void 0,n>0&&t&&(t(Math.round(n)),n=0,i=0))}}}const Vg="arRecord",Wg="previewPerf",qg=45e3;function jg(e){let t=0,n=0;const i=[],r=[],a=[];let s,o=1,l=1,c=1,h=-1,A=qg,u=!1;function d(){let e=0;for(let t=0;t<i.length;t++)e+=+i[t].detected,e+=+r[t].detected;const n=5*i.length+28*e,s=new ArrayBuffer(n),h=new DataView(s);let A=0;for(let e=0;e<i.length;e++){const t=i[e],n=r[e];h.setFloat32(A,a[e],!0),A+=4,h.setUint8(A++,+t.detected+(+n.detected<<1)),t.detected&&(h.setFloat32(A+0,t.position[0],!0),h.setFloat32(A+4,t.position[1],!0),h.setFloat32(A+8,t.position[2],!0),A+=12,h.setFloat32(A+0,t.rotation[0],!0),h.setFloat32(A+4,t.rotation[1],!0),h.setFloat32(A+8,t.rotation[2],!0),h.setFloat32(A+12,t.rotation[3],!0),A+=16),n.detected&&(h.setFloat32(A+0,n.position[0],!0),h.setFloat32(A+4,n.position[1],!0),h.setFloat32(A+8,n.position[2],!0),A+=12,h.setFloat32(A+0,n.rotation[0],!0),h.setFloat32(A+4,n.rotation[1],!0),h.setFloat32(A+8,n.rotation[2],!0),h.setFloat32(A+12,n.rotation[3],!0),A+=16)}if(0===t){const e=function(){var e,t,n,i;return{width:null!==(t=null===(e=null==Kf?void 0:Kf.getVideoElement())||void 0===e?void 0:e.videoWidth)&&void 0!==t?t:0,height:null!==(i=null===(n=null==Kf?void 0:Kf.getVideoElement())||void 0===n?void 0:n.videoHeight)&&void 0!==i?i:0}}(),t=function(){var e,t,n,i;return{width:null!==(t=null===(e=null==Kf?void 0:Kf.getCanvas())||void 0===e?void 0:e.width)&&void 0!==t?t:0,height:null!==(i=null===(n=null==Kf?void 0:Kf.getCanvas())||void 0===n?void 0:n.height)&&void 0!==i?i:0}}();o=e.width/e.height,l=t.width/t.height,c=function(){var e;return null!==(e=null==Kf?void 0:Kf.getFov())&&void 0!==e?e:85}()}return{recordType:"FOOT",idx:t++,arRecord:btoa(String.fromCharCode.apply(null,new Uint8Array(s))),cameraAspect:o,canvasAspect:l,fov:c}}function p(){if(i.length>0){const t=d();e(t),i.length=0,r.length=0,a.length=0}}return{start(e=45e3){u||(A=e>qg?qg:e,u=!0,s=window.setInterval(()=>{p()},1e3))},stop(){u&&(p(),clearInterval(s),t=0,n=0,i.length=0,r.length=0,a.length=0,u=!1)},onFeetTracked(e,s){if(!u)return;const o=performance.now();h<0&&(h=o),o-h>A?stop():(i.push(e),r.push(s),0===t&&0===a.length?a.push(0):a.push(o-n),n=o)}}}let Yg,Xg,Kg=!1;const Jg=window.navigator.userAgent||"no user agent",Zg=[];function $g(){null==Yg&&(Xg=Qf(),Yg=S(`${M()}/shopar-analytics.js`,"ShopAR__analytics"),Yg.then(()=>{Kg=!0,window.ShopAR__analytics.initializeImpl(),Zg.forEach(e=>e())}))}function em(e,t){const n=performance.now(),i=Qf(),r=Hg(),a=Hg(),s=zg(),o=zg();window.setInterval(()=>{if(r.dirty||a.dirty){const e=r.engagementMs,t=a.engagementMs,n=e+t;r.clearDirty(),a.clearDirty(),h("heartbeat",{engagementTotal:n,engagementAR:e,engagement3D:t})}},1e3);const l=(r,a={})=>({name:r,props:a=Object.assign(Object.assign({},a),{userAgent:Jg,hostname:window.location.hostname,href:window.location.href,pluginVersion:x,sessionId:Xg,setupId:i,timeSinceSetup:performance.now()-n,sku:e,apiKey:t})}),c=({name:e,props:t})=>{tm(()=>{window.ShopAR__analytics.trackEventImpl(e,t)})},h=(e,t={})=>{c(l(e,t))},A=function(e){const t=Gg(e),n=Gg(e),i=Gg(e);return{onFaceTracked(e){e.length>0&&t.onTracked(performance.now(),e[0].detected)},onFeetTracked(e,t){n.onTracked(performance.now(),e.detected&&t.detected)},onWristTracked(e){i.onTracked(performance.now(),e.detected)}}}(e=>{h("arPerf",e)}),{footRecorder:u,onFeetTracked:d}=function(e){const t=jg(e);return{footRecorder:t,onFeetTracked(e,n){t.onFeetTracked(e,n)}}}(e=>{0===e.idx?h(Vg,e):((e,t={})=>{c({name:e,props:Object.assign(Object.assign({},t),{sessionId:Xg,setupId:i})})})(Vg,{idx:e.idx,arRecord:e.arRecord})}),p=(f=[A,{onFeetTracked:d}],{onFaceTracked:e=>{var t;for(const n of f)null===(t=n.onFaceTracked)||void 0===t||t.call(n,e)},onFeetTracked:(e,t)=>{var n;for(const i of f)null===(n=i.onFeetTracked)||void 0===n||n.call(i,e,t)},onWristTracked:e=>{var t;for(const n of f)null===(t=n.onWristTracked)||void 0===t||t.call(n,e)}});var f;return{prepareEvent:l,submitEvent:c,trackEvent:h,arInteracted:()=>{const e=performance.now();r.interact(e),s.interact(e)},previewInteracted:()=>{const e=performance.now();a.interact(e),o.interact(e)},setDebounceAREngagementMs:e=>{s.debounceDurationMs=e},setOnDebouncedAREngagement:e=>{s.onDebouncedEngagement=e},setDebouncePreviewEngagementMs:e=>{o.debounceDurationMs=e},setOnDebouncedPreviewEngagement:e=>{o.onDebouncedEngagement=e},flushEngagementCallbacks:()=>{s.flush(),o.flush()},arTrackingEvents:p,footRecorder:u}}function tm(e){Kg?e():Zg.push(e)}function nm(e,t,n,i,r,a){let s,o,l=0,c=0;return{launched(){s=performance.now(),l=0,c=0,r(e)},loaded(){o=performance.now(),r(t,{duration:o-s})},failed(e){r(n,{errorName:A(e),errorMessage:u(e),errorStack:d(e),duration:performance.now()-s})},interacted(){if(null==a||a(),null==s)return;const e=performance.now(),t=e-c;c=e,t<200&&(l+=t)},closed(e){if(null==s)return;const t=null!=o;r(i,{duration:t?performance.now()-o:void 0,engagement:t?Math.round(l):void 0,trigger:e,loaded:t}),s=void 0,o=void 0,l=0,c=0}}}const im=.1,rm="function"==typeof Float32Array;function am(e,t,n,i){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&n===i)return Am;const r=rm?new Float32Array(11):new Array(11);for(let t=0;t<11;++t)r[t]=cm(t*im,e,n);function a(t){let i=0,a=1;for(;10!==a&&r[a]<=t;++a)i+=im;--a;const s=i+(t-r[a])/(r[a+1]-r[a])*im,o=hm(s,e,n);return o>=.001?function(e,t,n,i){for(let r=0;r<4;++r){const r=hm(t,n,i);if(0===r)return t;t-=(cm(t,n,i)-e)/r}return t}(t,s,e,n):0===o?s:function(e,t,n,i,r){let a,s,o=0;do{s=t+(n-t)/2,a=cm(s,i,r)-e,a>0?n=s:t=s}while(Math.abs(a)>1e-7&&++o<10);return s}(t,i,i+im,e,n)}return function(e){return 0===e||1===e?e:cm(a(e),t,i)}}function sm(e,t){return 1-3*t+3*e}function om(e,t){return 3*t-6*e}function lm(e){return 3*e}function cm(e,t,n){return((sm(t,n)*e+om(t,n))*e+lm(t))*e}function hm(e,t,n){return 3*sm(t,n)*e*e+2*om(t,n)*e+lm(t)}function Am(e){return e}function um(e){if("hold"===e.type)return()=>0;if("bezier"===e.type){const t=am(e.x1,e.y1,e.x2,e.y2);return e=>t(e)}throw new Error(`Unknown interpolation: ${e}`)}function dm(e){if(e.length<2)throw new Error("Expected at least two key frames.");const t=e[e.length-1].time,n=[...e].sort((e,t)=>e.time-t.time).map(({time:e,value:t,interpolation:n})=>({time:e,value:t,interpolate:um(n)}));let i=0,r=n[0].value;return{reset:()=>{i=0},update:e=>{for(i+=e;i>=t;)i-=t;for(let e=0;e<n.length-1;e++){const t=n[e],a=n[e+1];if(i>=t.time&&i<a.time){const e=t.interpolate((i-t.time)/(a.time-t.time));r=t.value+e*(a.value-t.value)}}},get:()=>r}}const pm="time",fm="interpolation",gm="pitch",mm=[pm,"yaw",gm,"fov",fm],vm="s",Em="ms",bm=Math.PI/180,Cm="ease-in-out",_m="cubic-bezier(";function Im(e){if("string"==typeof e)return function(e){const[t,...n]=function(e){return e.split(/\r?\n/).map(e=>function(e){const t=e.indexOf("#");return(-1!==t?e.substring(0,t):e).trim()}(e)).filter(e=>""!==e)}(e);if(null==t)throw new Error("Header missing.");const i=function(e){const t=[];for(let n=0;n<e.length;n++){const i=e[n];if(!mm.includes(i))throw new Error(`Invalid token in header: '${i}'.`);if(t.includes(i))throw new Error(`Duplicate token in header: '${i}'.`);t.push(i)}if(!t.includes(pm))throw new Error(`Missing required token: '${pm}'.`);return t}(t.split(/\s+/)),r={};if(n.length<2)throw new Error("Expected at least two key frames.");for(const e of n){const{theta:t,phi:n,fov:a}=xm(i,e);null!=t&&(null==r.theta&&(r.theta=[]),r.theta.push(t)),null!=n&&(null==r.phi&&(r.phi=[]),r.phi.push(n)),null!=a&&(null==r.fov&&(r.fov=[]),r.fov.push(a))}if(0===Object.values(r).length)throw new Error("At least one parameter should be animated.");return r}(e);if(Array.isArray(e))return function(e){var t;const n={};if(e.length<2)throw new Error("Expected at least two key frames.");for(const i of e){const{time:e,pitch:r,yaw:a,fov:s}=i;if(null==e)throw new Error("Time missing.");const o=wm(null!==(t=i.interpolation)&&void 0!==t?t:Cm);null!=a&&(null==n.theta&&(n.theta=[]),n.theta.push({time:e,value:a*bm,interpolation:o})),null!=r&&(null==n.phi&&(n.phi=[]),n.phi.push({time:e,value:r*bm,interpolation:o})),null!=s&&(null==n.fov&&(n.fov=[]),n.fov.push({time:e,value:s*bm,interpolation:o}))}if(0===Object.values(n).length)throw new Error("At least one parameter should be animated.");if(Object.values(n).every(t=>t.length!==e.length))throw new Error("All parameters should have the same key frame count.");return n}(e);throw new Error("Expected string or key frame config array.")}function xm(e,t){const n=t.match(/[^()\s]+(\(.*?\))?/g);if(null==n||n.length<e.length)throw new Error(`Missing data for fields: '${e.filter(e=>!(null==n?void 0:n.includes(e))).join(", ")}'.`);if(n.length>e.length)throw new Error(`Excess data: '${n.filter(t=>!e.includes(t)).join(", ")}'.`);const i=e.indexOf(pm),r=function(e){if(e.endsWith(Em))return Sm(e.substring(0,e.length-2));if(e.endsWith(vm))return 1e3*Sm(e.substring(0,e.length-1));return Sm(e)}(n[i]),a=e.indexOf(fm),s=wm(-1===a?Cm:n[a]),o={};for(let t=0;t<n.length;t++){if(t===i||t===a)continue;const l=e[t],c=n[t];switch(l){case"yaw":o.theta={time:r,value:ym(c),interpolation:s};break;case gm:o.phi={time:r,value:ym(c),interpolation:s};break;case"fov":o.fov={time:r,value:ym(c),interpolation:s};break;default:throw new Error(`Unhandled value for header '${l}'.`)}}return o}function ym(e){return e.endsWith("deg")?Sm(e.substring(0,e.length-3))*bm:e.endsWith("rad")?Sm(e.substring(0,e.length-3)):Sm(e)*bm}function wm(e){if("hold"===e)return{type:"hold"};if("linear"===e)return Mm(0,0,1,1);if("sine"===e)return Mm(.37,0,.63,1);if("sine-in"===e)return Mm(.12,0,.39,0);if("sine-out"===e)return Mm(.61,1,.88,1);if("ease"===e)return Mm(.25,.1,.25,1);if("ease-in"===e)return Mm(.42,0,1,1);if("ease-out"===e)return Mm(0,0,.58,1);if("ease-in-out"===e)return Mm(.42,0,.58,1);if(e.startsWith(_m)&&e.endsWith(")")){const t=e.substring(13,e.length-1).split(/\s*,\s*/);if(4!==t.length)throw new Error(`Expected 4 parameters for the Bezier curve, but got '${t}'.`);return{type:"bezier",x1:Sm(t[0]),y1:Sm(t[1]),x2:Sm(t[2]),y2:Sm(t[3])}}throw new Error(`Expected an interpolation token, but found: ${e}`)}function Mm(e,t,n,i){return{type:"bezier",x1:e,y1:t,x2:n,y2:i}}function Sm(e){const t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error(`Expected a numeric value, but got: ${e}`);return t}var Bm;function Tm(){return[Bm.Android,Bm.iOS,Bm.Tablet].includes(function(){if("undefined"!=typeof window&&window.navigator){const e=window.navigator.userAgent,t=window.navigator.platform||"",n=["Macintosh","MacIntel","MacPPC","Mac68K"],i=["Win32","Win64","Windows","WinCE"],r=["iPhone","iPod","iPad"],a="ontouchstart"in window||navigator.maxTouchPoints>0;return-1!==r.indexOf(t)?Bm.iOS:-1!==n.indexOf(t)?a?Bm.Tablet:Bm.MacOS:-1!==i.indexOf(t)?Bm.Windows:/Android/.test(e)?Bm.Android:/Linux/.test(t)?Bm.Linux:a?Bm.Tablet:Bm.Unknown}return Bm.Unknown}())}!function(e){e[e.Unknown=0]="Unknown",e[e.Android=1]="Android",e[e.iOS=2]="iOS",e[e.Tablet=3]="Tablet",e[e.MacOS=4]="MacOS",e[e.Windows=5]="Windows",e[e.Linux=6]="Linux"}(Bm||(Bm={}));const Rm=["demo.deepar.ai","dbeochk72stb2.cloudfront.net","d1q93hnxt3ps3w.cloudfront.net","dj5e08oeu5ym4.cloudfront.net"];function Dm(e,{trustUrls:t=!1}={}){const n=Object.assign({},e);if(n.category&&!qc.includes(n.category))throw new a(`Invalid response category: ${e.category}`);if(n.arToneMapping&&!jc.includes(n.arToneMapping))throw new a(`Invalid tone mapping: ${e.arToneMapping}`);if(n.previewToneMapping&&!jc.includes(n.previewToneMapping))throw new a(`Invalid tone mapping: ${e.previewToneMapping}`);const i=t?Qm:Um;return n.arUrl=n.arUrl?i(n.arUrl):void 0,n.arEnvUrl=n.arEnvUrl?i(n.arEnvUrl):void 0,n.arDiamondEnvUrl=n.arDiamondEnvUrl?i(n.arDiamondEnvUrl):void 0,n.arPromptImage=n.arPromptImage?i(n.arPromptImage):void 0,n.previewUrl=n.previewUrl?i(n.previewUrl):void 0,n.previewEnvUrl=n.previewEnvUrl?i(n.previewEnvUrl):void 0,n.previewDiamondEnvUrl=n.previewDiamondEnvUrl?i(n.previewDiamondEnvUrl):void 0,n.previewPosterUrl=n.previewPosterUrl?i(n.previewPosterUrl):void 0,n}function Qm(e){if(null==e||"string"!=typeof e)throw new a(`Invalid url: ${e}.`);let t;try{t=new URL(e)}catch(t){throw new a(`Invalid url: ${e}. ${t.message}`)}if("https:"!==t.protocol)throw new a(`Invalid url: ${e}.`);return t.toString()}function Um(e){const t=Qm(e);if(!function(e){return Rm.includes(e)}(new URL(t).hostname))throw new a(`Invalid url: ${e}.`);return t}const Lm=[1e3,2e3,4e3],Pm=Lm.length;function Nm(e){return h(this,arguments,void 0,function*(e,t=0){try{return yield e()}catch(n){if(t>=Pm)throw n;return yield new Promise(e=>setTimeout(e,Lm[t])),Nm(e,t+1)}})}const Fm={};function Om(e){const t=function(e){const{apiKey:t,sku:n,yaw:i,pitch:r,fov:a,forcedTransparency:s}=e,o=[];o.push(`apiKey=${t}`),o.push(`sku=${n}`),null!=i&&o.push(`yaw=${i}`);null!=r&&o.push(`pitch=${r}`);null!=a&&o.push(`fov=${a}`);null!=s&&o.push(`forcedTransparency=${s}`);return o.join("&")}(e),n=null!=Fm[t];return n||(Fm[t]=function(e){return h(this,void 0,void 0,function*(){return Dm(yield Nm(()=>h(this,void 0,void 0,function*(){const t=yield fetch(`https://dashboard.shopar.ai/plugin?${new URLSearchParams(e)}`).catch(e=>{throw new r(`API unavailable: ${u(e)}`)});if(!t.ok)throw new r("API response not OK.",t.status);const n=t.headers.get("content-length");if(n&&parseInt(n)>1048576)throw new r("API response too large.");try{return yield t.json()}catch(e){throw new r(`API returned invalid body: ${u(e)}`)}})))})}(e).catch(e=>{throw delete Fm[t],e})),{promise:Fm[t],cacheHit:n}}function km(e,t){if(null==e)throw new i(`'${t}' not specified.`)}function Gm(e,t){if("boolean"!=typeof e)throw new i(`'${t}' must be a boolean.`)}function Hm(e,t){if("number"!=typeof e)throw new i(`'${t}' must be a number.`)}function zm(e,t,n,r){if("number"!=typeof e)throw new i(`'${t}' must be a number.`);if(e<n)throw new i(`'${t}' must be greater than ${n}.`);if(e>r)throw new i(`'${t}' must be less than ${r}.`)}function Vm(e,t){if("string"!=typeof e)throw new i(`'${t}' must be a string.`)}function Wm(e,t,n){if("string"!=typeof e)throw new i(`'${t}' must be a string.`);if(!n.includes(e))throw new i(`'${t}' must be ${n.join("' or '")}.`)}function qm(e,t){if(!(e instanceof HTMLElement))throw new i(`'${t}' must be an HTMLElement.`)}function jm(e,t){if("function"!=typeof e)throw new i(`'${t}' must be a function.`)}function Ym(e){const{apiKey:n,sku:r,skuData:a,targetElement:s,initialState:o,initialAnimation:l,baseUrl:c,defaultUI:h,interactive:A,touchAction:u,zoomEnabled:d,minZoom:p,maxZoom:f,alwaysTransparentBackground:g,strings:m,debounceAREngagementMs:v,onDebouncedAREngagement:E,debounce3DEngagementMs:b,onDebounced3DEngagement:C,customArVideo:_,customTrueScaleFaceWidth:I}=e;Xm(n),function(e){km(e,"sku"),Vm(e,"sku"),function(e){if(0===e.length||e.length>100||!/^[\p{L}0-9 ./_-]+$/u.test(e))throw new i("Invalid 'sku'.")}(e)}(r),null!=a&&function(e,t){if("object"!=typeof e)throw new i(`'${t}' must be an object.`)}(a,"skuData"),km(s,"targetElement"),qm(s,"targetElement"),null!=o&&Wm(o,"initialState",t),null!=l&&function(e,t){if("string"!=typeof e&&!Array.isArray(e))throw new i(`'${t}' must be a string or array.`)}(l,"initialAnimation"),null!=c&&Vm(c,"baseUrl"),null!=h&&Gm(h,"defaultUI"),null!=A&&Gm(A,"interactive"),null!=u&&Wm(u,"touchAction",Yc),null!=d&&Gm(d,"zoomEnabled"),null!=p&&zm(p,"minZoom",.1,1),null!=f&&zm(f,"maxZoom",1,1/0),null!=g&&Gm(g,"alwaysTransparentBackground"),null!=m&&function(e,t,n){for(const r of n){const n=e[r];if(null!=n&&"string"!=typeof n)throw new i(`Value for key '${r}' in '${t}' must be a string or undefined.`)}}(m,"strings",D),null!=v&&Hm(v,"debounceAREngagementMs"),null!=E&&jm(E,"onDebouncedAREngagement"),null!=b&&Hm(b,"debounce3DEngagementMs"),null!=C&&jm(C,"onDebounced3DEngagement"),null!=_&&(km(_.video,"customArVideo.video"),function(e,t){if(!(e instanceof HTMLVideoElement))throw new i(`'${t}' must be an HTMLVideoElement.`)}(_.video,"customArVideo.video"),km(_.mirror,"customArVideo.mirror"),Gm(_.mirror,"customArVideo.mirror")),null!=I&&Hm(I,"customTrueScaleFaceWidth")}function Xm(e){km(e,"apiKey"),Vm(e,"apiKey"),function(e){if(!function(e){return 24===e.length&&/^[0-9a-fA-F]{24}$/.test(e)}(e))throw new i("Invalid 'apiKey'.")}(e)}let Km=!1;function Jm(e){return h(this,void 0,void 0,function*(){!function(e){const{apiKey:t,targetElement:n}=e;Xm(t),km(n,"targetElement"),qm(n,"targetElement")}(e);const{targetElement:t}=e;w(e.baseUrl),$g();const{trackEvent:n}=function(e){const t=performance.now(),n=Qf();return{trackEvent:(i,r={})=>{r=Object.assign(Object.assign({},r),{userAgent:Jg,hostname:window.location.hostname,href:window.location.href,pluginVersion:x,sessionId:Xg,setupId:n,timeSinceSetup:performance.now()-t,apiKey:e}),tm(()=>{window.ShopAR__analytics.trackEventImpl(i,r)})}}}(e.apiKey);n("visionSetup");const i=yield function(e){return h(this,void 0,void 0,function*(){return yield Nm(()=>h(this,void 0,void 0,function*(){const t=yield fetch(`https://dashboard.shopar.ai/plugin/vision?${new URLSearchParams({apiKey:e,sid:E()})}`).catch(e=>{throw new r(`API unavailable: ${u(e)}`)});if(!t.ok)throw new r("API response not OK.",t.status);const n=t.headers.get("content-length");if(n&&parseInt(n)>1048576)throw new r("API response too large.");try{return yield t.json()}catch(e){throw new r(`API returned invalid body: ${u(e)}`)}}))})}(e.apiKey);n("visionApiResponse",i);const{arKey:a}=i,s=wf(t),{getSetupId:o,findUI:l}=s,c=o();gg(),mg();const{setTargetElement:d,getDeepARTarget:p,setVisibilityParameters:f,getUIState:g,setUIState:m,startDeepARLoading:v,stopDeepARLoading:b,showCameraError:C}=l();if(g()!=Cf.None)throw Error("UI state is not None, this is weird..");m(Cf.AR),d(t),f(!1,!1,!0,!1,void 0,void 0),v(),yield Yf,Zm(o(),c);try{n("visionArLaunch"),Eg("Glasses",["faceInit"]),bg(p()),yield vg({licenseKey:a,truescaleUsecase:"DetectionLoop"}),Zm(o(),c),Zm(o(),c)}catch(e){const t=u(e);throw n("visionArLaunchFailure",{errorName:A(e),errorMessage:t}),C(),new Error(`AR failed: ${t}`)}finally{b()}return Km=!0,{registerFacePoseListener:e=>{Km&&(n("registerFacePoseListener"),Og(e))},registerFaceMeasurementListener:e=>{Km&&(n("registerFaceMeasurementListener"),kg(e))},switchEffect:e=>h(this,void 0,void 0,function*(){Km&&(n("switchEffect",{arUrl:e}),function(e){Kf.switchEffect(e)}(e))}),clearEffect:()=>{Km&&(n("clearEffect"),Kf.clearEffect())},close:()=>{if(Km){if(Km=!1,n("visionClose"),g()!==Cf.AR)throw new Error("AR not launched.");m(Cf.None)}}}})}function Zm(e,t){if(e!==t)throw new Error("Setup cancelled. Please ensure that setup is only called once.")}function $m(e){return h(this,void 0,void 0,function*(){var t,n,a,d;Ym(e);const{apiKey:f,sku:g,skuData:m,targetElement:v,initialState:x,initialAnimation:y}=e,S=e.touchAction,B=null==e.zoomEnabled||e.zoomEnabled,T=e.minZoom,D=e.maxZoom,Q=!0===e.alwaysTransparentBackground;!function(e){const t=getComputedStyle(e);if(!["static","relative"].includes(t.position))throw new i(`Invalid targetElement's position. Expected 'static' or 'relative', but found '${t.position}'.`)}(v),w(e.baseUrl),function(e){if(null!=e)for(const t of Object.keys(e)){if(!Object.prototype.hasOwnProperty.call(R,t)){console.warn(`String for key '${t}' will be ignored.`);continue}const n=e[t];null!=n&&(R[t]=n)}}(e.strings);const U=null!=y?Im(y):null,L=null!=(null==U?void 0:U.theta)?dm(U.theta):null,P=null!=(null==U?void 0:U.phi)?dm(U.phi):null,N=null!=(null==U?void 0:U.fov)?dm(U.fov):null,F=function(e,t){if(null!=e)return{apiUsed:!1,skuData:Dm(e,{trustUrls:!0})};const n=performance.now(),{promise:i,cacheHit:r}=Om(t);return{apiUsed:!0,promise:i,startTimestamp:n,cacheHit:r}}(m,function(e,t,n,i,r,a){return Object.assign(Object.assign(Object.assign(Object.assign({apiKey:e,sku:t,sid:E(),initialFov:"16"},null!=n&&{yaw:`${C(b(n))}`}),null!=i&&{pitch:`${C(b(i))}`}),null!=r&&{fov:`${C(b(r))}`}),a&&{forcedTransparency:`${a}`})}(f,g,null==L?void 0:L.get(),null==P?void 0:P.get(),null==N?void 0:N.get(),Q)),O=wf(v),{getSetupId:k,findUI:G,findQR:H,isInteractive:z,setInteractive:V}=O,W=k();$g();const{prepareEvent:q,submitEvent:j,trackEvent:Y,arInteracted:X,previewInteracted:K,setDebounceAREngagementMs:J,setOnDebouncedAREngagement:Z,setDebouncePreviewEngagementMs:$,setOnDebouncedPreviewEngagement:ee,flushEngagementCallbacks:te,arTrackingEvents:ne,footRecorder:ie}=em(g,f),re=q("setup");J(e.debounceAREngagementMs),Z(e.onDebouncedAREngagement),$(e.debounce3DEngagementMs),ee(e.onDebounced3DEngagement);let ae,se=!1;if(F.apiUsed){try{ae=yield F.promise}catch(e){const t=u(e),n=performance.now()-F.startTimestamp;throw Y("apiError",{errorName:A(e),errorMessage:t,errorStatusCode:e instanceof r?e.status:void 0,duration:n}),e instanceof r?e:new r(t)}ev(k(),W)}else ae=F.skuData;const{category:oe,arUrl:le,arEnvUrl:ce,arDiamondEnvUrl:he,arToneMapping:Ae,arToneMappingExposure:ue,arBloomEnabled:de,arBloomStrength:pe,arBloomRadius:fe,arBloomThreshold:ge,arKey:me,arPromptEnabled:ve,arPromptText:Ee,arPromptImage:be,previewUrl:Ce,previewEnvUrl:_e,previewDiamondEnvUrl:Ie,previewToneMapping:xe,previewToneMappingExposure:ye,previewBloomEnabled:we,previewBloomStrength:Me,previewBloomRadius:Se,previewBloomThreshold:Be,previewPosterUrl:Te,cameraErrorText:Re,qrPromptText:De,arSessionRecording:Qe,arSessionRecordingMaxDurationMs:Ue}=ae;if(F.apiUsed){const e=performance.now()-F.startTimestamp;null!=le||null!=Ce?(j(re),Y("apiResponse",Object.assign(Object.assign({},ae),{duration:e,cacheHit:F.cacheHit}))):(Y("apiResponseFailure",Object.assign(Object.assign({},ae),{duration:e,cacheHit:F.cacheHit})),Le="SKU not found (or both 3D and AR disabled).",console.error(`ShopAR Plugin: ${Le}`))}var Le;const Pe=null!=le&&function(e){return null!=e&&_.includes(e)}(oe),Ne=null==(null===(t=e._internalOptions)||void 0===t?void 0:t.qrEnabled)||(null===(n=e._internalOptions)||void 0===n?void 0:n.qrEnabled),Fe=Pe&&function(e){return null!=e&&I.includes(e)}(oe),Oe=Ne&&Fe&&!Tm(),ke=Pe&&!Oe,Ge=null!=Ce;ev(k(),W);const{setTargetElement:He,getDeepARTarget:ze,getDeepARPrompt:Ve,getThreeTarget:We,removeThreeTarget:qe,customizeDeepARPrompt:je,customizeCameraError:Ye,customizeQRPrompt:Xe,setVisibilityParameters:Ke,getUIState:Je,setUIState:Ze,setDefaultUIActions:$e,startDeepARLoading:et,stopDeepARLoading:tt,showCameraError:nt,updateDeepARLoadingProgress:it}=G();He(v);Ke(null==e.defaultUI||e.defaultUI,Oe,ke,Ge,oe,x),je(null!==(d=null!==(a=function(e){switch(e){case"Glasses":return R["prompt.ar.glasses"];case"Shoes":return R["prompt.ar.shoes"];case"Watches":return R["prompt.ar.watches"];case"Bracelets":return R["prompt.ar.bracelets"];case"Scarves":return R["prompt.ar.scarves"];case"Hats":return R["prompt.ar.hats"];case"Necklaces":return R["prompt.ar.necklaces"];default:return}}(oe))&&void 0!==a?a:Ee)&&void 0!==d?d:"",null!=be?be:F.apiUsed?"":`${M()}/img/prompt/ar-foot.webp`),Ye(Re),Xe(De);const rt=nm("qrLaunch","qrLaunchSuccess","qrLaunchFailure","qrClose",Y),at=nm("arLaunch","arLaunchSuccess","arLaunchFailure","arClose",Y,X),st=nm("previewLaunch","previewLaunchSuccess","previewLaunchFailure","previewClose",Y,K);!function(e,t){const n=e.parentNode;if(null==n)throw new Error("Parent node missing.");new MutationObserver(n=>{for(const i of n)for(const n of i.removedNodes)if(n===e)return void t()}).observe(n,{childList:!0})}(v,()=>{te(),Je()===Cf.QR?(rt.closed("detach"),ot()||ct()):Je()===Cf.AR?(at.closed("detach"),Bg()&&(ie.stop(),Sg())):Je()===Cf.Preview&&(st.closed("detach"),qe()),Ze(Cf.None),function(e){yf.delete(e)}(v)});const{qrPaused:ot,qrDraw:lt,qrPause:ct}=H(),ht=null==e.interactive||e.interactive;let At=0;if(Je()===Cf.QR){if(!ot())if(Oe){rt.launched();try{yield lt(f,g)}catch(e){const t=u(e);throw new c(t)}rt.loaded()}else ct(),Ze(Cf.None)}else if(Je()===Cf.AR){if(Bg())if(ke&&!Km){at.launched(),ie.stop(),et(),gg(),"Glasses"===oe&&mg(),Mf(O),bg(ze()),Eg(oe),Cg(ve?Ve():null);const t=e=>{it(e.loaded/e.total*100)};null!=e.customArVideo&&Tg(e.customArVideo),yield yg(le,{envmap:ce,diamondEnvMap:he,onProgress:t},`${le}${ce}${he}`),wg(Ae,ue),Mg(de,pe,fe,ge),_g(at.interacted,ne),Qe&&"Shoes"===oe&&F.apiUsed&&ie.start(Ue),ev(k(),W),tt(),null!=e.customTrueScaleFaceWidth&&Ig(e.customTrueScaleFaceWidth),at.loaded()}else ie.stop(),Sg(),Ze(Cf.None)}else if(Je()===Cf.Preview)if(Ge){st.launched(),yield customElements.whenDefined("shopar-3d");const e=We();e.baseUrl=`${M()}/3d`,e.interactivityDisabled=!ht,e.posterUrl=null!=Te?Te:null,e.glbUrl=Ce,e.envUrl=null!=_e?_e:`${M()}/env/default.hdr`,e.diamondEnvUrl=null!=Ie?Ie:null,e.category=null!=oe?oe:null,e.touchAction=null!=S?S:null,e.zoomDisabled=!B,e.minZoom=null!=T?T:null,e.maxZoom=null!=D?D:null,e.alwaysTransparentBackground=Q,e.toneMapping=null!=xe?xe:"ACES",e.toneMappingExposure=null!=ye?ye:1,e.bloomEnabled=null!=we?we:null,e.bloomStrength=null!=Me?Me:null,e.bloomRadius=null!=Se?Se:null,e.bloomThreshold=null!=Be?Be:null,e.onInteracted=st.interacted,e.onInteractionPerf=se?null:t=>{se=!0,e.onInteractionPerf=null,Y(Wg,t)},e.animation=null!=y?y:null,e.paused=!1,e.style.display="",yield e.flushChanges(),st.loaded()}else qe(),Ze(Cf.None);const ut=()=>h(this,void 0,void 0,function*(){if(Oe){rt.launched();try{const e=++At;if(Je()===Cf.Preview&&(st.closed("switch"),qe()),Ze(Cf.QR),yield lt(f,g),At!==e)return;return ev(k(),W),void rt.loaded()}catch(e){throw rt.failed(e),new c(u(e))}}if(!ke)throw new o("Model does not have AR enabled.");at.launched();try{const t=++At;if(Je()===Cf.Preview&&(st.closed("switch"),qe()),Mf(O),Ze(Cf.AR),gg(),"Glasses"===oe&&mg(),et(),yield Yf,At!==t)return;ev(k(),W),Eg(oe),bg(ze()),Cg(ve?Ve():null);const n=e=>{it(e.loaded/e.total*100)};if(ie.stop(),Bg())null!=e.customArVideo&&Tg(e.customArVideo),yield yg(le,{envmap:ce,diamondEnvMap:he,onProgress:n},`${le}${ce}${he}`),null!=e.customTrueScaleFaceWidth&&Ig(e.customTrueScaleFaceWidth);else{if(yield vg({licenseKey:me,effectUrl:le,effectOptions:{envmap:ce,diamondEnvMap:he},onProgress:n,videoConfig:e.customArVideo,customTrueScaleFaceWidth:e.customTrueScaleFaceWidth}),At!==t)return;ev(k(),W)}if(wg(Ae,ue),Mg(de,pe,fe,ge),_g(at.interacted,ne),Qe&&"Shoes"===oe&&F.apiUsed&&ie.start(Ue),At!==t)return;if(ev(k(),W),At!==t)return;ev(k(),W),at.loaded()}catch(e){at.failed(e),nt();const t=u(e);if("CameraPermissionDeniedError"===A(e))throw new l(t);throw new o(t)}finally{tt()}}),dt=()=>h(this,void 0,void 0,function*(){if(!Ge)throw new s("Model does not have 3D enabled.");st.launched();try{Je()===Cf.AR&&(at.closed("switch"),ie.stop(),Sg(),ct()),Ze(Cf.Preview),yield customElements.whenDefined("shopar-3d");const e=We();e.baseUrl=`${M()}/3d`,e.interactivityDisabled=!ht,e.posterUrl=null!=Te?Te:null,e.glbUrl=Ce,e.envUrl=null!=_e?_e:`${M()}/env/default.hdr`,e.diamondEnvUrl=null!=Ie?Ie:null,e.category=null!=oe?oe:null,e.touchAction=null!=S?S:null,e.zoomDisabled=!B,e.minZoom=null!=T?T:null,e.maxZoom=null!=D?D:null,e.alwaysTransparentBackground=Q,e.toneMapping=null!=xe?xe:"ACES",e.toneMappingExposure=null!=ye?ye:1,e.bloomEnabled=null!=we?we:null,e.bloomStrength=null!=Me?Me:null,e.bloomRadius=null!=Se?Se:null,e.bloomThreshold=null!=Be?Be:null,e.onInteracted=st.interacted,e.onInteractionPerf=se?null:t=>{se=!0,e.onInteractionPerf=null,Y(Wg,t)},e.animation=null!=y?y:null,e.paused=!1,e.style.display="",yield e.flushChanges(),st.loaded()}catch(e){throw st.failed(e),new s(u(e))}}),pt=()=>h(this,void 0,void 0,function*(){Je()!==Cf.None&&("AR"!==x||Je()!==Cf.AR&&Je()!==Cf.QR)&&("3D"===x&&Je()===Cf.Preview||(++At,te(),Je()===Cf.QR||Je()===Cf.AR?(Je()===Cf.QR?rt.closed("close"):at.closed("close"),ie.stop(),Sg(),ct()):Je()===Cf.Preview&&(st.closed("close"),qe()),Ze(Cf.None),"AR"!==x?"3D"!==x||(yield dt()):yield ut()))});return $e(p("launchAR",ut),p("launch3D",dt),p("close",pt)),"AR"===x?(yield ut(),ev(k(),W)):"3D"===x&&(yield dt(),ev(k(),W)),Km=!1,{launchAR:Pe?p("launchAR",ut):void 0,launch3D:Ge?p("launch3D",dt):void 0,closeAR:Pe?p("closeAR",()=>h(this,void 0,void 0,function*(){Je()!==Cf.AR&&Je()!==Cf.QR||"AR"!==x&&(++At,te(),Je()===Cf.QR?rt.closed("close"):at.closed("close"),ie.stop(),Sg(),ct(),Ze(Cf.None),"3D"!==x||(yield dt()))})):void 0,close3D:Ge?p("close3D",()=>h(this,void 0,void 0,function*(){Je()===Cf.Preview&&"3D"!==x&&(++At,te(),st.closed("close"),qe(),Ze(Cf.None),"AR"!==x||(yield ut()))})):void 0,close:Pe||Ge?p("close",pt):void 0,isInteractive:()=>z(),setInteractive:e=>V(e)}})}function ev(e,t){if(e!==t)throw new Error("Setup cancelled. Please ensure that setup is only called once.")}const tv={setup:function(e){return h(this,void 0,void 0,function*(){return p("visionSetup",()=>Jm(e))()})}},nv={setup:function(e){return h(this,void 0,void 0,function*(){return p("setup",()=>$m(e))()})},version:x};e.ApiError=r,e.CameraPermissionDeniedError=l,e.Launch3DError=s,e.LaunchARError=o,e.PREVIEW_STATES=t,e.PluginError=n,e.QRError=c,e.SanitizationError=a,e.ValidationError=i,e.plugin=nv,e.vision=tv});
12
+ */var Bh=Uint8Array,Th=Uint16Array,Rh=Int32Array,Dh=new Bh([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]),Qh=new Bh([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]),Lh=new Bh([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Uh=function(e,t){for(var n=new Th(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var r=new Rh(n[30]);for(i=1;i<30;++i)for(var a=n[i];a<n[i+1];++a)r[a]=a-n[i]<<5|i;return{b:n,r:r}},Ph=Uh(Dh,2),Nh=Ph.b,Fh=Ph.r;Nh[28]=258,Fh[258]=28;for(var Oh=Uh(Qh,0).b,kh=new Th(32768),Gh=0;Gh<32768;++Gh){var Hh=(43690&Gh)>>1|(21845&Gh)<<1;Hh=(61680&(Hh=(52428&Hh)>>2|(13107&Hh)<<2))>>4|(3855&Hh)<<4,kh[Gh]=((65280&Hh)>>8|(255&Hh)<<8)>>1}var zh=function(e,t,n){for(var i=e.length,r=0,a=new Th(t);r<i;++r)e[r]&&++a[e[r]-1];var o,s=new Th(t);for(r=1;r<t;++r)s[r]=s[r-1]+a[r-1]<<1;o=new Th(1<<t);var l=15-t;for(r=0;r<i;++r)if(e[r])for(var c=r<<4|e[r],h=t-e[r],A=s[e[r]-1]++<<h,u=A|(1<<h)-1;A<=u;++A)o[kh[A]>>l]=c;return o},Vh=new Bh(288);for(Gh=0;Gh<144;++Gh)Vh[Gh]=8;for(Gh=144;Gh<256;++Gh)Vh[Gh]=9;for(Gh=256;Gh<280;++Gh)Vh[Gh]=7;for(Gh=280;Gh<288;++Gh)Vh[Gh]=8;var Wh=new Bh(32);for(Gh=0;Gh<32;++Gh)Wh[Gh]=5;var qh=zh(Vh,9),jh=zh(Wh,5),Yh=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Xh=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(7&t)&n},Kh=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},Jh=function(e){return(e+7)/8|0},Zh=["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"],$h=function(e,t,n){var i=new Error(t||Zh[e]);if(i.code=e,Error.captureStackTrace&&Error.captureStackTrace(i,$h),!n)throw i;return i},eA=new Bh(0);function tA(e,t){return function(e,t,n,i){var r=e.length;if(!r||t.f&&!t.l)return n||new Bh(0);var a=!n,o=a||2!=t.i,s=t.i;a&&(n=new Bh(3*r));var l=function(e){var t=n.length;if(e>t){var i=new Bh(Math.max(2*t,e));i.set(n),n=i}},c=t.f||0,h=t.p||0,A=t.b||0,u=t.l,d=t.d,p=t.m,f=t.n,g=8*r;do{if(!u){c=Xh(e,h,1);var m=Xh(e,h+1,3);if(h+=3,!m){var v=e[(B=Jh(h)+4)-4]|e[B-3]<<8,E=B+v;if(E>r){s&&$h(0);break}o&&l(A+v),n.set(e.subarray(B,E),A),t.b=A+=v,t.p=h=8*E,t.f=c;continue}if(1==m)u=qh,d=jh,p=9,f=5;else if(2==m){var b=Xh(e,h,31)+257,C=Xh(e,h+10,15)+4,_=b+Xh(e,h+5,31)+1;h+=14;for(var I=new Bh(_),x=new Bh(19),y=0;y<C;++y)x[Lh[y]]=Xh(e,h+3*y,7);h+=3*C;var M=Yh(x),w=(1<<M)-1,S=zh(x,M);for(y=0;y<_;){var B,T=S[Xh(e,h,w)];if(h+=15&T,(B=T>>4)<16)I[y++]=B;else{var R=0,D=0;for(16==B?(D=3+Xh(e,h,3),h+=2,R=I[y-1]):17==B?(D=3+Xh(e,h,7),h+=3):18==B&&(D=11+Xh(e,h,127),h+=7);D--;)I[y++]=R}}var Q=I.subarray(0,b),L=I.subarray(b);p=Yh(Q),f=Yh(L),u=zh(Q,p),d=zh(L,f)}else $h(1);if(h>g){s&&$h(0);break}}o&&l(A+131072);for(var U=(1<<p)-1,P=(1<<f)-1,N=h;;N=h){var F=(R=u[Kh(e,h)&U])>>4;if((h+=15&R)>g){s&&$h(0);break}if(R||$h(2),F<256)n[A++]=F;else{if(256==F){N=h,u=null;break}var O=F-254;if(F>264){var k=Dh[y=F-257];O=Xh(e,h,(1<<k)-1)+Nh[y],h+=k}var G=d[Kh(e,h)&P],H=G>>4;if(G||$h(3),h+=15&G,L=Oh[H],H>3&&(k=Qh[H],L+=Kh(e,h)&(1<<k)-1,h+=k),h>g){s&&$h(0);break}o&&l(A+131072);var z=A+O;if(A<L){var V=0-L,W=Math.min(L,z);for(V+A<0&&$h(3);A<W;++A)n[A]=i[V+A]}for(;A<z;++A)n[A]=n[A-L]}}t.l=u,t.p=N,t.b=A,t.f=c,u&&(c=1,t.m=p,t.d=d,t.n=f)}while(!c);return A!=n.length&&a?function(e,t,n){return(null==n||n>e.length)&&(n=e.length),new Bh(e.subarray(0,n))}(n,0,A):n.subarray(0,A)}(e.subarray((i=t,(8!=(15&(n=e)[0])||n[0]>>4>7||(n[0]<<8|n[1])%31)&&$h(6,"invalid zlib data"),(n[1]>>5&1)==+!i&&$h(6,"invalid zlib data: "+(32&n[1]?"need":"unexpected")+" dictionary"),2+(n[1]>>3&4)),-4),{i:2},t,t);var n,i}var nA="undefined"!=typeof TextDecoder&&new TextDecoder;try{nA.decode(eA,{stream:!0})}catch($d){}class iA extends vc{constructor(e){super(e),this.type=$e}parse(e){const t=65536,n=14,i=65537,r=Math.pow(2.7182818,2.2),a={l:0,c:0,lc:0};function o(e,t,n,i,r){for(;n<e;)t=t<<8|k(i,r),n+=8;n-=e,a.l=t>>n&(1<<e)-1,a.c=t,a.lc=n}const s=new Array(59);function l(e,t,n,r,l,c){const h=t;let A=0,u=0;for(;r<=l;r++){if(h.value-t.value>n)return!1;o(6,A,u,e,h);const i=a.l;if(A=a.c,u=a.lc,c[r]=i,63==i){if(h.value-t.value>n)throw new Error("Something wrong with hufUnpackEncTable");o(8,A,u,e,h);let i=a.l+6;if(A=a.c,u=a.lc,r+i>l+1)throw new Error("Something wrong with hufUnpackEncTable");for(;i--;)c[r++]=0;r--}else if(i>=59){let e=i-59+2;if(r+e>l+1)throw new Error("Something wrong with hufUnpackEncTable");for(;e--;)c[r++]=0;r--}}!function(e){for(let e=0;e<=58;++e)s[e]=0;for(let t=0;t<i;++t)s[e[t]]+=1;let t=0;for(let e=58;e>0;--e){const n=t+s[e]>>1;s[e]=t,t=n}for(let t=0;t<i;++t){const n=e[t];n>0&&(e[t]=n|s[n]++<<6)}}(c)}function c(e){return 63&e}function h(e){return e>>6}const A={c:0,lc:0};function u(e,t,n,i){e=e<<8|k(n,i),t+=8,A.c=e,A.lc=t}const d={c:0,lc:0};function p(e,t,n,i,r,a,o,s,l){if(e==t){i<8&&(u(n,i,r,a),n=A.c,i=A.lc);let e=n>>(i-=8);if(e=new Uint8Array([e])[0],s.value+e>l)return!1;const t=o[s.value-1];for(;e-- >0;)o[s.value++]=t}else{if(!(s.value<l))return!1;o[s.value++]=e}d.c=n,d.lc=i}function f(e){return 65535&e}function g(e){const t=f(e);return t>32767?t-65536:t}const m={a:0,b:0};function v(e,t){const n=g(e),i=g(t),r=n+(1&i)+(i>>1),a=r,o=r-i;m.a=a,m.b=o}function E(e,t){const n=f(e),i=f(t),r=n-(i>>1)&65535,a=i+r-32768&65535;m.a=a,m.b=r}function b(e,t,n,i,r,a,o){const s=o<16384,l=n>r?r:n;let c,h,A=1;for(;A<=l;)A<<=1;for(A>>=1,c=A,A>>=1;A>=1;){h=0;const o=h+a*(r-c),l=a*A,u=a*c,d=i*A,p=i*c;let f,g,b,C;for(;h<=o;h+=u){let r=h;const a=h+i*(n-c);for(;r<=a;r+=p){const n=r+d,i=r+l,a=i+d;s?(v(e[r+t],e[i+t]),f=m.a,b=m.b,v(e[n+t],e[a+t]),g=m.a,C=m.b,v(f,g),e[r+t]=m.a,e[n+t]=m.b,v(b,C),e[i+t]=m.a,e[a+t]=m.b):(E(e[r+t],e[i+t]),f=m.a,b=m.b,E(e[n+t],e[a+t]),g=m.a,C=m.b,E(f,g),e[r+t]=m.a,e[n+t]=m.b,E(b,C),e[i+t]=m.a,e[a+t]=m.b)}if(n&A){const n=r+l;s?v(e[r+t],e[n+t]):E(e[r+t],e[n+t]),f=m.a,e[n+t]=m.b,e[r+t]=f}}if(r&A){let r=h;const a=h+i*(n-c);for(;r<=a;r+=p){const n=r+d;s?v(e[r+t],e[n+t]):E(e[r+t],e[n+t]),f=m.a,e[n+t]=m.b,e[r+t]=f}}c=A,A>>=1}return h}function C(e,t,r,a,o,s){const f=r.value,g=O(t,r),m=O(t,r);r.value+=4;const v=O(t,r);if(r.value+=4,g<0||g>=i||m<0||m>=i)throw new Error("Something wrong with HUF_ENCSIZE");const E=new Array(i),b=new Array(16384);if(function(e){for(let t=0;t<16384;t++)e[t]={},e[t].len=0,e[t].lit=0,e[t].p=null}(b),l(e,r,a-(r.value-f),g,m,E),v>8*(a-(r.value-f)))throw new Error("Something wrong with hufUncompress");!function(e,t,i,r){for(;t<=i;t++){const i=h(e[t]),a=c(e[t]);if(i>>a)throw new Error("Invalid table entry");if(a>n){const e=r[i>>a-n];if(e.len)throw new Error("Invalid table entry");if(e.lit++,e.p){const t=e.p;e.p=new Array(e.lit);for(let n=0;n<e.lit-1;++n)e.p[n]=t[n]}else e.p=new Array(1);e.p[e.lit-1]=t}else if(a){let e=0;for(let o=1<<n-a;o>0;o--){const o=r[(i<<n-a)+e];if(o.len||o.p)throw new Error("Invalid table entry");o.len=a,o.lit=t,e++}}}}(E,g,m,b),function(e,t,i,r,a,o,s,l,f){let g=0,m=0;const v=s,E=Math.trunc(r.value+(a+7)/8);for(;r.value<E;)for(u(g,m,i,r),g=A.c,m=A.lc;m>=n;){const a=t[g>>m-n&16383];if(a.len)m-=a.len,p(a.lit,o,g,m,i,r,l,f,v),g=d.c,m=d.lc;else{if(!a.p)throw new Error("hufDecode issues");let t;for(t=0;t<a.lit;t++){const n=c(e[a.p[t]]);for(;m<n&&r.value<E;)u(g,m,i,r),g=A.c,m=A.lc;if(m>=n&&h(e[a.p[t]])==(g>>m-n&(1<<n)-1)){m-=n,p(a.p[t],o,g,m,i,r,l,f,v),g=d.c,m=d.lc;break}}if(t==a.lit)throw new Error("hufDecode issues")}}const b=8-a&7;for(g>>=b,m-=b;m>0;){const e=t[g<<n-m&16383];if(!e.len)throw new Error("hufDecode issues");m-=e.len,p(e.lit,o,g,m,i,r,l,f,v),g=d.c,m=d.lc}}(E,b,e,r,v,m,s,o,{value:0})}function _(e){for(let t=1;t<e.length;t++){const n=e[t-1]+e[t]-128;e[t]=n}}function I(e,t){let n=0,i=Math.floor((e.length+1)/2),r=0;const a=e.length-1;for(;!(r>a||(t[r++]=e[n++],r>a));)t[r++]=e[i++]}function x(e){let t=e.byteLength;const n=new Array;let i=0;const r=new DataView(e);for(;t>0;){const e=r.getInt8(i++);if(e<0){const a=-e;t-=a+1;for(let e=0;e<a;e++)n.push(r.getUint8(i++))}else{const a=e;t-=2;const o=r.getUint8(i++);for(let e=0;e<a+1;e++)n.push(o)}}return n}function y(e,t,n){let i,r=1;for(;r<64;)i=t[e.value],65280==i?r=64:i>>8==255?r+=255&i:(n[r]=i,r++),e.value++}function M(e,t){t[0]=W(e[0]),t[1]=W(e[1]),t[2]=W(e[5]),t[3]=W(e[6]),t[4]=W(e[14]),t[5]=W(e[15]),t[6]=W(e[27]),t[7]=W(e[28]),t[8]=W(e[2]),t[9]=W(e[4]),t[10]=W(e[7]),t[11]=W(e[13]),t[12]=W(e[16]),t[13]=W(e[26]),t[14]=W(e[29]),t[15]=W(e[42]),t[16]=W(e[3]),t[17]=W(e[8]),t[18]=W(e[12]),t[19]=W(e[17]),t[20]=W(e[25]),t[21]=W(e[30]),t[22]=W(e[41]),t[23]=W(e[43]),t[24]=W(e[9]),t[25]=W(e[11]),t[26]=W(e[18]),t[27]=W(e[24]),t[28]=W(e[31]),t[29]=W(e[40]),t[30]=W(e[44]),t[31]=W(e[53]),t[32]=W(e[10]),t[33]=W(e[19]),t[34]=W(e[23]),t[35]=W(e[32]),t[36]=W(e[39]),t[37]=W(e[45]),t[38]=W(e[52]),t[39]=W(e[54]),t[40]=W(e[20]),t[41]=W(e[22]),t[42]=W(e[33]),t[43]=W(e[38]),t[44]=W(e[46]),t[45]=W(e[51]),t[46]=W(e[55]),t[47]=W(e[60]),t[48]=W(e[21]),t[49]=W(e[34]),t[50]=W(e[37]),t[51]=W(e[47]),t[52]=W(e[50]),t[53]=W(e[56]),t[54]=W(e[59]),t[55]=W(e[61]),t[56]=W(e[35]),t[57]=W(e[36]),t[58]=W(e[48]),t[59]=W(e[49]),t[60]=W(e[57]),t[61]=W(e[58]),t[62]=W(e[62]),t[63]=W(e[63])}function w(e){const t=.5*Math.cos(.7853975),n=.5*Math.cos(3.14159/16),i=.5*Math.cos(3.14159/8),r=.5*Math.cos(3*3.14159/16),a=.5*Math.cos(.981746875),o=.5*Math.cos(3*3.14159/8),s=.5*Math.cos(1.374445625),l=new Array(4),c=new Array(4),h=new Array(4),A=new Array(4);for(let u=0;u<8;++u){const d=8*u;l[0]=i*e[d+2],l[1]=o*e[d+2],l[2]=i*e[d+6],l[3]=o*e[d+6],c[0]=n*e[d+1]+r*e[d+3]+a*e[d+5]+s*e[d+7],c[1]=r*e[d+1]-s*e[d+3]-n*e[d+5]-a*e[d+7],c[2]=a*e[d+1]-n*e[d+3]+s*e[d+5]+r*e[d+7],c[3]=s*e[d+1]-a*e[d+3]+r*e[d+5]-n*e[d+7],h[0]=t*(e[d+0]+e[d+4]),h[3]=t*(e[d+0]-e[d+4]),h[1]=l[0]+l[3],h[2]=l[1]-l[2],A[0]=h[0]+h[1],A[1]=h[3]+h[2],A[2]=h[3]-h[2],A[3]=h[0]-h[1],e[d+0]=A[0]+c[0],e[d+1]=A[1]+c[1],e[d+2]=A[2]+c[2],e[d+3]=A[3]+c[3],e[d+4]=A[3]-c[3],e[d+5]=A[2]-c[2],e[d+6]=A[1]-c[1],e[d+7]=A[0]-c[0]}for(let u=0;u<8;++u)l[0]=i*e[16+u],l[1]=o*e[16+u],l[2]=i*e[48+u],l[3]=o*e[48+u],c[0]=n*e[8+u]+r*e[24+u]+a*e[40+u]+s*e[56+u],c[1]=r*e[8+u]-s*e[24+u]-n*e[40+u]-a*e[56+u],c[2]=a*e[8+u]-n*e[24+u]+s*e[40+u]+r*e[56+u],c[3]=s*e[8+u]-a*e[24+u]+r*e[40+u]-n*e[56+u],h[0]=t*(e[u]+e[32+u]),h[3]=t*(e[u]-e[32+u]),h[1]=l[0]+l[3],h[2]=l[1]-l[2],A[0]=h[0]+h[1],A[1]=h[3]+h[2],A[2]=h[3]-h[2],A[3]=h[0]-h[1],e[0+u]=A[0]+c[0],e[8+u]=A[1]+c[1],e[16+u]=A[2]+c[2],e[24+u]=A[3]+c[3],e[32+u]=A[3]-c[3],e[40+u]=A[2]-c[2],e[48+u]=A[1]-c[1],e[56+u]=A[0]-c[0]}function S(e){for(let t=0;t<64;++t){const n=e[0][t],i=e[1][t],r=e[2][t];e[0][t]=n+1.5747*r,e[1][t]=n-.1873*i-.4682*r,e[2][t]=n+1.8556*i}}function B(e,t,n){for(let i=0;i<64;++i)t[n+i]=nr(T(e[i]))}function T(e){return e<=1?Math.sign(e)*Math.pow(Math.abs(e),2.2):Math.sign(e)*Math.pow(r,Math.abs(e)-1)}function R(e){return new DataView(e.array.buffer,e.offset.value,e.size)}function D(e){const t=e.viewer.buffer.slice(e.offset.value,e.offset.value+e.size),n=new Uint8Array(x(t)),i=new Uint8Array(n.length);return _(n),I(n,i),new DataView(i.buffer)}function Q(e){const t=tA(e.array.slice(e.offset.value,e.offset.value+e.size)),n=new Uint8Array(t.length);return _(t),I(t,n),new DataView(n.buffer)}function L(e){const n=e.viewer,i={value:e.offset.value},r=new Uint16Array(e.columns*e.lines*(e.inputChannels.length*e.type)),a=new Uint8Array(8192);let o=0;const s=new Array(e.inputChannels.length);for(let t=0,n=e.inputChannels.length;t<n;t++)s[t]={},s[t].start=o,s[t].end=s[t].start,s[t].nx=e.columns,s[t].ny=e.lines,s[t].size=e.type,o+=s[t].nx*s[t].ny*s[t].size;const l=q(n,i),c=q(n,i);if(c>=8192)throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");if(l<=c)for(let e=0;e<c-l+1;e++)a[e+l]=G(n,i);const h=new Uint16Array(t),A=function(e,n){let i=0;for(let r=0;r<t;++r)(0==r||e[r>>3]&1<<(7&r))&&(n[i++]=r);const r=i-1;for(;i<t;)n[i++]=0;return r}(a,h),u=O(n,i);C(e.array,n,i,u,r,o);for(let t=0;t<e.inputChannels.length;++t){const e=s[t];for(let n=0;n<s[t].size;++n)b(r,e.start+n,e.nx,e.size,e.ny,e.nx*e.size,A)}!function(e,t,n){for(let i=0;i<n;++i)t[i]=e[t[i]]}(h,r,o);let d=0;const p=new Uint8Array(r.buffer.byteLength);for(let t=0;t<e.lines;t++)for(let t=0;t<e.inputChannels.length;t++){const e=s[t],n=e.nx*e.size,i=new Uint8Array(r.buffer,2*e.end,2*n);p.set(i,d),d+=2*n,e.end+=n}return new DataView(p.buffer)}function U(e){const t=tA(e.array.slice(e.offset.value,e.offset.value+e.size)),n=e.inputChannels.length*e.lines*e.columns*e.totalBytes,i=new ArrayBuffer(n),r=new DataView(i);let a=0,o=0;const s=new Array(4);for(let n=0;n<e.lines;n++)for(let n=0;n<e.inputChannels.length;n++){let i=0;switch(e.inputChannels[n].pixelType){case 1:s[0]=a,s[1]=s[0]+e.columns,a=s[1]+e.columns;for(let n=0;n<e.columns;++n)i+=t[s[0]++]<<8|t[s[1]++],r.setUint16(o,i,!0),o+=2;break;case 2:s[0]=a,s[1]=s[0]+e.columns,s[2]=s[1]+e.columns,a=s[2]+e.columns;for(let n=0;n<e.columns;++n)i+=t[s[0]++]<<24|t[s[1]++]<<16|t[s[2]++]<<8,r.setUint32(o,i,!0),o+=4}}return r}function P(e){const t=e.viewer,n={value:e.offset.value},i=new Uint8Array(e.columns*e.lines*(e.inputChannels.length*e.type*2)),r={version:H(t,n),unknownUncompressedSize:H(t,n),unknownCompressedSize:H(t,n),acCompressedSize:H(t,n),dcCompressedSize:H(t,n),rleCompressedSize:H(t,n),rleUncompressedSize:H(t,n),rleRawSize:H(t,n),totalAcUncompressedCount:H(t,n),totalDcUncompressedCount:H(t,n),acCompression:H(t,n)};if(r.version<2)throw new Error("EXRLoader.parse: "+te.compression+" version "+r.version+" is unsupported");const a=new Array;let o=q(t,n)-2;for(;o>0;){const e=N(t.buffer,n),i=G(t,n),r=i>>2&3,s=new Int8Array([(i>>4)-1])[0],l=G(t,n);a.push({name:e,index:s,type:l,compression:r}),o-=e.length+3}const s=te.channels,l=new Array(e.inputChannels.length);for(let t=0;t<e.inputChannels.length;++t){const n=l[t]={},i=s[t];n.name=i.name,n.compression=0,n.decoded=!1,n.type=i.pixelType,n.pLinear=i.pLinear,n.width=e.columns,n.height=e.lines}const c={idx:new Array(3)};for(let t=0;t<e.inputChannels.length;++t){const e=l[t];for(let n=0;n<a.length;++n){const i=a[n];e.name==i.name&&(e.compression=i.compression,i.index>=0&&(c.idx[i.index]=t),e.offset=t)}}let h,A,u;if(r.acCompressedSize>0)switch(r.acCompression){case 0:h=new Uint16Array(r.totalAcUncompressedCount),C(e.array,t,n,r.acCompressedSize,h,r.totalAcUncompressedCount);break;case 1:const i=tA(e.array.slice(n.value,n.value+r.totalAcUncompressedCount));h=new Uint16Array(i.buffer),n.value+=r.totalAcUncompressedCount}if(r.dcCompressedSize>0){const t={array:e.array,offset:n,size:r.dcCompressedSize};A=new Uint16Array(Q(t).buffer),n.value+=r.dcCompressedSize}r.rleRawSize>0&&(u=x(tA(e.array.slice(n.value,n.value+r.rleCompressedSize)).buffer),n.value+=r.rleCompressedSize);let d=0;const p=new Array(l.length);for(let e=0;e<p.length;++e)p[e]=new Array;for(let t=0;t<e.lines;++t)for(let t=0;t<l.length;++t)p[t].push(d),d+=l[t].width*e.type*2;!function(e,t,n,i,r,a){let o=new DataView(a.buffer);const s=n[e.idx[0]].width,l=n[e.idx[0]].height,c=Math.floor(s/8),h=Math.ceil(s/8),A=Math.ceil(l/8),u=s-8*(h-1),d=l-8*(A-1),p={value:0},f=new Array(3),g=new Array(3),m=new Array(3),v=new Array(3),E=new Array(3);for(let n=0;n<3;++n)E[n]=t[e.idx[n]],f[n]=n<1?0:f[n-1]+h*A,g[n]=new Float32Array(64),m[n]=new Uint16Array(64),v[n]=new Uint16Array(64*h);for(let t=0;t<A;++t){let a=8;t==A-1&&(a=d);let s=8;for(let e=0;e<h;++e){e==h-1&&(s=u);for(let e=0;e<3;++e)m[e].fill(0),m[e][0]=r[f[e]++],y(p,i,m[e]),M(m[e],g[e]),w(g[e]);S(g);for(let t=0;t<3;++t)B(g[t],v[t],64*e)}let l=0;for(let i=0;i<3;++i){const r=n[e.idx[i]].type;for(let e=8*t;e<8*t+a;++e){l=E[i][e];for(let t=0;t<c;++t){const n=64*t+8*(7&e);o.setUint16(l+0*r,v[i][n+0],!0),o.setUint16(l+2*r,v[i][n+1],!0),o.setUint16(l+4*r,v[i][n+2],!0),o.setUint16(l+6*r,v[i][n+3],!0),o.setUint16(l+8*r,v[i][n+4],!0),o.setUint16(l+10*r,v[i][n+5],!0),o.setUint16(l+12*r,v[i][n+6],!0),o.setUint16(l+14*r,v[i][n+7],!0),l+=16*r}}if(c!=h)for(let e=8*t;e<8*t+a;++e){const t=E[i][e]+8*c*2*r,n=64*c+8*(7&e);for(let e=0;e<s;++e)o.setUint16(t+2*e*r,v[i][n+e],!0)}}}const b=new Uint16Array(s);o=new DataView(a.buffer);for(let t=0;t<3;++t){n[e.idx[t]].decoded=!0;const i=n[e.idx[t]].type;if(2==n[t].type)for(let e=0;e<l;++e){const n=E[t][e];for(let e=0;e<s;++e)b[e]=o.getUint16(n+2*e*i,!0);for(let e=0;e<s;++e)o.setFloat32(n+2*e*i,W(b[e]),!0)}}}(c,p,l,h,A,i);for(let t=0;t<l.length;++t){const n=l[t];if(!n.decoded){if(2!==n.compression)throw new Error("EXRLoader.parse: unsupported channel compression");{let r=0,a=0;for(let o=0;o<e.lines;++o){let e=p[t][r];for(let t=0;t<n.width;++t){for(let t=0;t<2*n.type;++t)i[e++]=u[a+t*n.width*n.height];a++}r++}}}}return new DataView(i.buffer)}function N(e,t){const n=new Uint8Array(e);let i=0;for(;0!=n[t.value+i];)i+=1;const r=(new TextDecoder).decode(n.slice(t.value,t.value+i));return t.value=t.value+i+1,r}function F(e,t){const n=e.getInt32(t.value,!0);return t.value=t.value+4,n}function O(e,t){const n=e.getUint32(t.value,!0);return t.value=t.value+4,n}function k(e,t){const n=e[t.value];return t.value=t.value+1,n}function G(e,t){const n=e.getUint8(t.value);return t.value=t.value+1,n}const H=function(e,t){let n;return n="getBigInt64"in DataView.prototype?Number(e.getBigInt64(t.value,!0)):e.getUint32(t.value+4,!0)+Number(e.getUint32(t.value,!0)<<32),t.value+=8,n};function z(e,t){const n=e.getFloat32(t.value,!0);return t.value+=4,n}function V(e,t){return nr(z(e,t))}function W(e){const t=(31744&e)>>10,n=1023&e;return(e>>15?-1:1)*(t?31===t?n?NaN:1/0:Math.pow(2,t-15)*(1+n/1024):n/1024*6103515625e-14)}function q(e,t){const n=e.getUint16(t.value,!0);return t.value+=2,n}function j(e,t){return W(q(e,t))}function Y(e,t,n,i,r){return"string"===i||"stringvector"===i||"iccProfile"===i?function(e,t,n){const i=(new TextDecoder).decode(new Uint8Array(e).slice(t.value,t.value+n));return t.value=t.value+n,i}(t,n,r):"chlist"===i?function(e,t,n,i){const r=n.value,a=[];for(;n.value<r+i-1;){const i=N(t,n),r=F(e,n),o=G(e,n);n.value+=3;const s=F(e,n),l=F(e,n);a.push({name:i,pixelType:r,pLinear:o,xSampling:s,ySampling:l})}return n.value+=1,a}(e,t,n,r):"chromaticities"===i?function(e,t){return{redX:z(e,t),redY:z(e,t),greenX:z(e,t),greenY:z(e,t),blueX:z(e,t),blueY:z(e,t),whiteX:z(e,t),whiteY:z(e,t)}}(e,n):"compression"===i?function(e,t){return["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"][G(e,t)]}(e,n):"box2i"===i?function(e,t){return{xMin:F(e,t),yMin:F(e,t),xMax:F(e,t),yMax:F(e,t)}}(e,n):"envmap"===i?function(e,t){return["ENVMAP_LATLONG","ENVMAP_CUBE"][G(e,t)]}(e,n):"tiledesc"===i?function(e,t){const n=O(e,t),i=O(e,t),r=G(e,t);return{xSize:n,ySize:i,levelMode:["ONE_LEVEL","MIPMAP_LEVELS","RIPMAP_LEVELS"][15&r],roundingMode:["ROUND_DOWN","ROUND_UP"][r>>4]}}(e,n):"lineOrder"===i?function(e,t){return["INCREASING_Y","DECREASING_Y","RANDOM_Y"][G(e,t)]}(e,n):"float"===i?z(e,n):"v2f"===i?function(e,t){return[z(e,t),z(e,t)]}(e,n):"v3f"===i?function(e,t){return[z(e,t),z(e,t),z(e,t)]}(e,n):"int"===i?F(e,n):"rational"===i?function(e,t){return[F(e,t),O(e,t)]}(e,n):"timecode"===i?function(e,t){return[O(e,t),O(e,t)]}(e,n):"preview"===i?(n.value+=r,"skipped"):void(n.value+=r)}function X(e,t,n,i){const r=new Array(e);for(let a=0;a<e;a++){const e=1<<a;let o=t/e|0;"ROUND_UP"==i&&o*e<t&&(o+=1);const s=Math.max(o,1);r[a]=(s+n-1)/n|0}return r}function K(){const e=this,t=e.offset,n={value:0};for(let i=0;i<e.tileCount;i++){const i=F(e.viewer,t),r=F(e.viewer,t);t.value+=8,e.size=O(e.viewer,t);const a=i*e.blockWidth,o=r*e.blockHeight;e.columns=a+e.blockWidth>e.width?e.width-a:e.blockWidth,e.lines=o+e.blockHeight>e.height?e.height-o:e.blockHeight;const s=e.columns*e.totalBytes,l=e.size<e.lines*s?e.uncompress(e):R(e);t.value+=e.size;for(let t=0;t<e.lines;t++){const i=t*e.columns*e.totalBytes;for(let r=0;r<e.inputChannels.length;r++){const s=te.channels[r].name,c=e.channelByteOffsets[s]*e.columns,h=e.decodeChannels[s];if(void 0===h)continue;n.value=i+c;const A=(e.height-(1+o+t))*e.outLineWidth;for(let t=0;t<e.columns;t++){const i=A+(t+a)*e.outputChannels+h;e.byteArray[i]=e.getter(l,n)}}}}}function J(){const e=this,t=e.offset,n={value:0};for(let i=0;i<e.height/e.blockHeight;i++){const r=F(e.viewer,t)-te.dataWindow.yMin;e.size=O(e.viewer,t),e.lines=r+e.blockHeight>e.height?e.height-r:e.blockHeight;const a=e.columns*e.totalBytes,o=e.size<e.lines*a?e.uncompress(e):R(e);t.value+=e.size;for(let t=0;t<e.blockHeight;t++){const r=i*e.blockHeight,s=t+e.scanOrder(r);if(s>=e.height)continue;const l=t*a,c=(e.height-1-s)*e.outLineWidth;for(let t=0;t<e.inputChannels.length;t++){const i=te.channels[t].name,r=e.channelByteOffsets[i]*e.columns,a=e.decodeChannels[i];if(void 0!==a){n.value=l+r;for(let t=0;t<e.columns;t++){const i=c+t*e.outputChannels+a;e.byteArray[i]=e.getter(o,n)}}}}}}const Z={value:0},$=new DataView(e),ee=new Uint8Array(e),te=function(e,t,n){const i={};if(20000630!=e.getUint32(0,!0))throw new Error("THREE.EXRLoader: Provided file doesn't appear to be in OpenEXR format.");i.version=e.getUint8(4);const r=e.getUint8(5);i.spec={singleTile:!!(2&r),longName:!!(4&r),deepFormat:!!(8&r),multiPart:!!(16&r)},n.value=8;let a=!0;for(;a;){const r=N(t,n);if(0==r)a=!1;else{const a=N(t,n),o=Y(e,t,n,a,O(e,n));void 0===o?console.warn(`THREE.EXRLoader: Skipped unknown header attribute type '${a}'.`):i[r]=o}}if(-7&r)throw console.error("THREE.EXRHeader:",i),new Error("THREE.EXRLoader: Provided file is currently unsupported.");return i}($,e,Z),ne=function(e,t,n,i,r){const a={size:0,viewer:t,array:n,offset:i,width:e.dataWindow.xMax-e.dataWindow.xMin+1,height:e.dataWindow.yMax-e.dataWindow.yMin+1,inputChannels:e.channels,channelByteOffsets:{},scanOrder:null,totalBytes:null,columns:null,lines:null,type:null,uncompress:null,getter:null,format:null,colorSpace:It};switch(e.compression){case"NO_COMPRESSION":a.blockHeight=1,a.uncompress=R;break;case"RLE_COMPRESSION":a.blockHeight=1,a.uncompress=D;break;case"ZIPS_COMPRESSION":a.blockHeight=1,a.uncompress=Q;break;case"ZIP_COMPRESSION":a.blockHeight=16,a.uncompress=Q;break;case"PIZ_COMPRESSION":a.blockHeight=32,a.uncompress=L;break;case"PXR24_COMPRESSION":a.blockHeight=16,a.uncompress=U;break;case"DWAA_COMPRESSION":a.blockHeight=32,a.uncompress=P;break;case"DWAB_COMPRESSION":a.blockHeight=256,a.uncompress=P;break;default:throw new Error("EXRLoader.parse: "+e.compression+" is unsupported")}const o={};for(const t of e.channels)switch(t.name){case"Y":case"R":case"G":case"B":case"A":o[t.name]=!0,a.type=t.pixelType}let s=!1;if(o.R&&o.G&&o.B)s=!o.A,a.outputChannels=4,a.decodeChannels={R:0,G:1,B:2,A:3};else{if(!o.Y)throw new Error("EXRLoader.parse: file contains unsupported data channels.");a.outputChannels=1,a.decodeChannels={Y:0}}if(1==a.type)switch(r){case Ze:a.getter=j;break;case $e:a.getter=q}else{if(2!=a.type)throw new Error("EXRLoader.parse: unsupported pixelType "+a.type+" for "+e.compression+".");switch(r){case Ze:a.getter=z;break;case $e:a.getter=V}}a.columns=a.width;const l=a.width*a.height*a.outputChannels;switch(r){case Ze:a.byteArray=new Float32Array(l),s&&a.byteArray.fill(1,0,l);break;case $e:a.byteArray=new Uint16Array(l),s&&a.byteArray.fill(15360,0,l);break;default:console.error("THREE.EXRLoader: unsupported type: ",r)}let c=0;for(const t of e.channels)void 0!==a.decodeChannels[t.name]&&(a.channelByteOffsets[t.name]=c),c+=2*t.pixelType;if(a.totalBytes=c,a.outLineWidth=a.width*a.outputChannels,"INCREASING_Y"===e.lineOrder?a.scanOrder=e=>e:a.scanOrder=e=>a.height-1-e,4==a.outputChannels?(a.format=tt,a.colorSpace=It):(a.format=rt,a.colorSpace=Ct),e.spec.singleTile){a.blockHeight=e.tiles.ySize,a.blockWidth=e.tiles.xSize;const n=function(e,t,n){let i=0;switch(e.levelMode){case"ONE_LEVEL":i=1;break;case"MIPMAP_LEVELS":i=function(e,t){const n=Math.log2(e);return"ROUND_DOWN"==t?Math.floor(n):Math.ceil(n)}(Math.max(t,n),e.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return i}(e.tiles,a.width,a.height),r=X(n,a.width,e.tiles.xSize,e.tiles.roundingMode),o=X(n,a.height,e.tiles.ySize,e.tiles.roundingMode);a.tileCount=r[0]*o[0];for(let e=0;e<n;e++)for(let n=0;n<o[e];n++)for(let n=0;n<r[e];n++)H(t,i);a.decode=K.bind(a)}else{a.blockWidth=a.width;const e=Math.ceil(a.height/a.blockHeight);for(let n=0;n<e;n++)H(t,i);a.decode=J.bind(a)}return a}(te,$,ee,Z,this.type);return ne.decode(),{header:te,width:ne.width,height:ne.height,data:ne.byteArray,format:ne.format,colorSpace:ne.colorSpace,type:this.type}}setDataType(e){return this.type=e,this}load(e,t,n,i){return super.load(e,function(e,n){e.colorSpace=n.colorSpace,e.minFilter=qe,e.magFilter=qe,e.generateMipmaps=!1,e.flipY=!1,t&&t(e,n)},n,i)}}let rA,aA=!1;function oA(e){aA||(rA=new Sh,new iA,aA=!0);const t=function(e){const t=new ul(e.data,e.width,e.height,void 0,e.type,void 0,Ge,Ge,qe,qe,1,It);return t.flipY=!0,t.generateMipmaps=!1,t.needsUpdate=!0,t}(rA.parse(e));return t.mapping=Fe,t.colorSpace=It,t}var sA=function(){var e=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]),t=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 n,i=WebAssembly.validate(e)?"b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp: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:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp: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:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;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:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;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:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb":"b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok: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;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",r=WebAssembly.instantiate(a(i),{}).then(function(e){(n=e.instance).exports.__wasm_call_ctors()});function a(e){for(var n=new Uint8Array(e.length),i=0;i<e.length;++i){var r=e.charCodeAt(i);n[i]=r>96?r-97:r>64?r-39:r+4}var a=0;for(i=0;i<e.length;++i)n[a++]=n[i]<60?t[n[i]]:64*(n[i]-60)+n[++i];return n.buffer.slice(0,a)}function o(e,t,i,r,a,o){var s=n.exports.sbrk,l=i+3&-4,c=s(l*r),h=s(a.length),A=new Uint8Array(n.exports.memory.buffer);A.set(a,h);var u=e(c,i,r,h,a.length);if(0==u&&o&&o(c,l,r),t.set(A.subarray(c,c+i*r)),s(c-s(0)),0!=u)throw new Error("Malformed buffer data: "+u)}var s={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},l={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},c=[],h=0;function A(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){var n=e.data;t.pending-=n.count,t.requests[n.id][n.action](n.value),delete t.requests[n.id]},t}function u(e){r.then(function(){var t=e.data;try{var i=new Uint8Array(t.count*t.size);o(n.exports[t.mode],i,t.count,t.size,t.source,n.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:r,supported:!0,useWorkers:function(e){!function(e){for(var t="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(a(i))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+o.toString()+u.toString(),n=new Blob([t],{type:"text/javascript"}),r=URL.createObjectURL(n),s=0;s<e;++s)c[s]=A(r);URL.revokeObjectURL(r)}(e)},decodeVertexBuffer:function(e,t,i,r,a){o(n.exports.meshopt_decodeVertexBuffer,e,t,i,r,n.exports[s[a]])},decodeIndexBuffer:function(e,t,i,r){o(n.exports.meshopt_decodeIndexBuffer,e,t,i,r)},decodeIndexSequence:function(e,t,i,r){o(n.exports.meshopt_decodeIndexSequence,e,t,i,r)},decodeGltfBuffer:function(e,t,i,r,a,c){o(n.exports[l[a]],e,t,i,r,n.exports[s[c]])},decodeGltfBufferAsync:function(e,t,i,a,A){return c.length>0?function(e,t,n,i,r){for(var a=c[0],o=1;o<c.length;++o)c[o].pending<a.pending&&(a=c[o]);return new Promise(function(o,s){var l=new Uint8Array(n),c=h++;a.pending+=e,a.requests[c]={resolve:o,reject:s},a.object.postMessage({id:c,count:e,size:t,source:l,mode:i,filter:r},[l.buffer])})}(e,t,i,l[a],s[A]):r.then(function(){var r=new Uint8Array(e*t);return o(n.exports[l[a]],r,e,t,i,n.exports[s[A]]),r})}}}();const lA=new WeakMap;class cA extends dc{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,n,i){const r=new gc(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,e=>{this.parse(e,t,i)},n,i)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,_t,n).catch(n)}decodeDracoFile(e,t,n,i,r=It,a=()=>{}){const o={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:r};return this.decodeGeometry(e,o).then(t).catch(a)}decodeGeometry(e,t){const n=JSON.stringify(t);if(lA.has(e)){const t=lA.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const r=this.workerNextTaskID++,a=e.byteLength,o=this._getWorker(r,a).then(n=>(i=n,new Promise((n,a)=>{i._callbacks[r]={resolve:n,reject:a},i.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return o.catch(()=>!0).then(()=>{i&&r&&this._releaseTask(i,r)}),lA.set(e,{key:n,promise:o}),o}_createGeometry(e){const t=new gr;e.index&&t.setIndex(new ar(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const i=e.attributes[n],r=i.name,a=i.array,o=i.itemSize,s=new ar(a,o);"color"===r&&(this._assignVertexColorSpace(s,i.vertexColorSpace),s.normalized=a instanceof Float32Array==0),t.setAttribute(r,s)}return t}_assignVertexColorSpace(e,t){if(t!==_t)return;const n=new Ki;for(let t=0,i=e.count;t<i;t++)n.fromBufferAttribute(e,t).convertSRGBToLinear(),e.setXYZ(t,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new gc(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((t,i)=>{n.load(e,t,void 0,i)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const 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=>{const n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const i=hA.toString(),r=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){const n=t.data;switch(n.type){case"decode":e._callbacks[n.id].resolve(n);break;case"error":e._callbacks[n.id].reject(n);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+n.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort(function(e,t){return e._taskLoad>t._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_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}}function hA(){let e,t;function n(e,t,n,i,r,a){const o=a.num_components(),s=n.num_points()*o,l=s*r.BYTES_PER_ELEMENT,c=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,r),h=e._malloc(l);t.GetAttributeDataArrayForAllPoints(n,a,c,l,h);const A=new r(e.HEAPF32.buffer,h,s).slice();return e._free(h),{name:i,array:A,itemSize:o}}onmessage=function(i){const 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":const i=r.buffer,a=r.taskConfig;t.then(e=>{const t=e.draco,o=new t.Decoder;try{const e=function(e,t,i,r){const a=r.attributeIDs,o=r.attributeTypes;let s,l;const c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)s=new e.Mesh,l=t.DecodeArrayToMesh(i,i.byteLength,s);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");s=new e.PointCloud,l=t.DecodeArrayToPointCloud(i,i.byteLength,s)}if(!l.ok()||0===s.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const h={index:null,attributes:[]};for(const i in a){const l=self[o[i]];let c,A;if(r.useUniqueIDs)A=a[i],c=t.GetAttributeByUniqueId(s,A);else{if(A=t.GetAttributeId(s,e[a[i]]),-1===A)continue;c=t.GetAttribute(s,A)}const u=n(e,t,s,i,l,c);"color"===i&&(u.vertexColorSpace=r.vertexColorSpace),h.attributes.push(u)}return c===e.TRIANGULAR_MESH&&(h.index=function(e,t,n){const i=3*n.num_faces(),r=4*i,a=e._malloc(r);t.GetTrianglesUInt32Array(n,r,a);const o=new Uint32Array(e.HEAPF32.buffer,a,i).slice();return e._free(a),{array:o,itemSize:1}}(e,t,s)),e.destroy(s),h}(t,o,new Int8Array(i),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(o)}})}}}function AA(e,t){if(0===t)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2===t||1===t){let n=e.getIndex();if(null===n){const t=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<i.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}const i=n.count-2,r=[];if(2===t)for(let e=1;e<=i;e++)r.push(n.getX(0)),r.push(n.getX(e)),r.push(n.getX(e+1));else for(let e=0;e<i;e++)e%2==0?(r.push(n.getX(e)),r.push(n.getX(e+1)),r.push(n.getX(e+2))):(r.push(n.getX(e+2)),r.push(n.getX(e+1)),r.push(n.getX(e)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const a=e.clone();return a.setIndex(r),a.clearGroups(),a}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}class uA extends dc{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new CA(e)}),this.register(function(e){return new vA(e)}),this.register(function(e){return new EA(e)}),this.register(function(e){return new BA(e)}),this.register(function(e){return new TA(e)}),this.register(function(e){return new RA(e)}),this.register(function(e){return new _A(e)}),this.register(function(e){return new IA(e)}),this.register(function(e){return new xA(e)}),this.register(function(e){return new yA(e)}),this.register(function(e){return new mA(e)}),this.register(function(e){return new MA(e)}),this.register(function(e){return new bA(e)}),this.register(function(e){return new SA(e)}),this.register(function(e){return new wA(e)}),this.register(function(e){return new fA(e)}),this.register(function(e){return new DA(e)}),this.register(function(e){return new QA(e)})}load(e,t,n,i){const r=this;let a;if(""!==this.resourcePath)a=this.resourcePath;else if(""!==this.path){const t=Lc.extractUrlBase(e);a=Lc.resolveURL(t,this.path)}else a=Lc.extractUrlBase(e);this.manager.itemStart(e);const o=function(t){i?i(t):console.error(t),r.manager.itemError(e),r.manager.itemEnd(e)},s=new gc(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(n){try{r.parse(n,a,function(n){t(n),r.manager.itemEnd(e)},o)}catch(e){o(e)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}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,n,i){let r;const a={},o={},s=new TextDecoder;if("string"==typeof e)r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(s.decode(new Uint8Array(e,0,4))===LA){try{a[pA.KHR_BINARY_GLTF]=new UA(e)}catch(e){return void(i&&i(e))}r=JSON.parse(a[pA.KHR_BINARY_GLTF].content)}else r=JSON.parse(s.decode(e));else r=e;if(void 0===r.asset||r.asset.version[0]<2)return void(i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const l=new ru(r,{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++){const t=this.pluginCallbacks[e](l);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[t.name]=t,a[t.name]=!0}if(r.extensionsUsed)for(let e=0;e<r.extensionsUsed.length;++e){const t=r.extensionsUsed[e],n=r.extensionsRequired||[];switch(t){case pA.KHR_MATERIALS_UNLIT:a[t]=new gA;break;case pA.KHR_DRACO_MESH_COMPRESSION:a[t]=new PA(r,this.dracoLoader);break;case pA.KHR_TEXTURE_TRANSFORM:a[t]=new NA;break;case pA.KHR_MESH_QUANTIZATION:a[t]=new FA;break;default:n.indexOf(t)>=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(a),l.setPlugins(o),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,r){n.parse(e,t,i,r)})}}function dA(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const pA={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",DEEPAR_MATERIALS_DIAMOND:"DEEPAR_materials_diamond"};class fA{constructor(e){this.parser=e,this.name=pA.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const i=t[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const r=t.json,a=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let o;const s=new Ki(16777215);void 0!==a.color&&s.setRGB(a.color[0],a.color[1],a.color[2],It);const l=void 0!==a.range?a.range:0;switch(a.type){case"directional":o=new Qc(s),o.target.position.set(0,0,-1),o.add(o.target);break;case"point":o=new Rc(s),o.distance=l;break;case"spot":o=new Mc(s),o.distance=l,a.spot=a.spot||{},a.spot.innerConeAngle=void 0!==a.spot.innerConeAngle?a.spot.innerConeAngle:0,a.spot.outerConeAngle=void 0!==a.spot.outerConeAngle?a.spot.outerConeAngle:Math.PI/4,o.angle=a.spot.outerConeAngle,o.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return o.position.set(0,0,0),o.decay=2,ZA(o,a),void 0!==a.intensity&&(o.intensity=a.intensity),o.name=t.createUniqueName(a.name||"light_"+e),i=Promise.resolve(o),t.cache.add(n,i),i}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,i=n.json.nodes[e],r=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then(function(e){return n._getNodeRef(t.cache,r,e)})}}class gA{constructor(){this.name=pA.KHR_MATERIALS_UNLIT}getMaterialType(){return er}extendParams(e,t,n){const i=[];e.color=new Ki(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const t=r.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],It),e.opacity=t[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(e,"map",r.baseColorTexture,_t))}return Promise.all(i)}}class mA{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return void 0!==i&&(t.emissiveIntensity=i),Promise.resolve()}}class vA{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qs:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];if(void 0!==a.clearcoatFactor&&(t.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&r.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(r.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){const e=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new nn(e,e)}return Promise.all(r)}}class EA{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_DISPERSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qs:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.dispersion=void 0!==i.dispersion?i.dispersion:0,Promise.resolve()}}class bA{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qs:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return void 0!==a.iridescenceFactor&&(t.iridescence=a.iridescenceFactor),void 0!==a.iridescenceTexture&&r.push(n.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&&r.push(n.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(r)}}class CA{constructor(e){this.parser=e,this.name=pA.DEEPAR_MATERIALS_DIAMOND}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Ys:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();t.envMapIntensity=1,t.envMapRotation=0,t.rIndexDelta=.012,t.squashFactor=.98,t.geometryFactor=.5,t.gammaFactor=1,t.absorptionFactor=1,t.reflectivity=.5,t.diamondOrientedEnvMap=0,t.boostFactors=new Rn(1,1,1),t.fixedEnvMapDirection=!1,t.rayBounces=5,t.defines={RAY_BOUNCES:5};const i=n.extensions[this.name];if(void 0!==i.envMapIntensity&&(t.envMapIntensity=i.envMapIntensity),void 0!==i.envMapRotationOffset&&(t.envMapRotation=i.envMapRotationOffset),void 0!==i.dispersion&&(t.rIndexDelta=i.dispersion),void 0!==i.squashFactor&&(t.squashFactor=i.squashFactor),void 0!==i.geometryFactor&&(t.geometryFactor=i.geometryFactor),void 0!==i.gammaFactor&&(t.gammaFactor=i.gammaFactor),void 0!==i.absorptionFactor&&(t.absorptionFactor=i.absorptionFactor),void 0!==i.reflectivity&&(t.reflectivity=i.reflectivity),void 0!==i.diamondOrientedEnvMap&&(t.diamondOrientedEnvMap=i.diamondOrientedEnvMap),void 0!==i.boostFactors){const e=i.boostFactors;t.boostFactors.set(e[0],e[1],e[2])}return void 0!==i.fixedEnvMapDirection&&(t.fixedEnvMapDirection=i.fixedEnvMapDirection),void 0!==i.rayBounces&&(t.rayBounces=i.rayBounces,t.defines={RAY_BOUNCES:i.rayBounces}),Promise.resolve()}}class _A{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qs:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new Ki(0,0,0),t.sheenRoughness=0,t.sheen=1;const a=i.extensions[this.name];if(void 0!==a.sheenColorFactor){const e=a.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],It)}return void 0!==a.sheenRoughnessFactor&&(t.sheenRoughness=a.sheenRoughnessFactor),void 0!==a.sheenColorTexture&&r.push(n.assignTexture(t,"sheenColorMap",a.sheenColorTexture,_t)),void 0!==a.sheenRoughnessTexture&&r.push(n.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(r)}}class IA{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qs:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&r.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(r)}}class xA{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qs:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];t.thickness=void 0!==a.thicknessFactor?a.thicknessFactor:0,void 0!==a.thicknessTexture&&r.push(n.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;const o=a.attenuationColor||[1,1,1];return t.attenuationColor=(new Ki).setRGB(o[0],o[1],o[2],It),Promise.all(r)}}class yA{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qs:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class MA{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qs:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];t.specularIntensity=void 0!==a.specularFactor?a.specularFactor:1,void 0!==a.specularTexture&&r.push(n.assignTexture(t,"specularIntensityMap",a.specularTexture));const o=a.specularColorFactor||[1,1,1];return t.specularColor=(new Ki).setRGB(o[0],o[1],o[2],It),void 0!==a.specularColorTexture&&r.push(n.assignTexture(t,"specularColorMap",a.specularColorTexture,_t)),Promise.all(r)}}class wA{constructor(e){this.parser=e,this.name=pA.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qs:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return t.bumpScale=void 0!==a.bumpFactor?a.bumpFactor:1,void 0!==a.bumpTexture&&r.push(n.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(r)}}class SA{constructor(e){this.parser=e,this.name=pA.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?qs:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],a=i.extensions[this.name];return void 0!==a.anisotropyStrength&&(t.anisotropy=a.anisotropyStrength),void 0!==a.anisotropyRotation&&(t.anisotropyRotation=a.anisotropyRotation),void 0!==a.anisotropyTexture&&r.push(n.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(r)}}class BA{constructor(e){this.parser=e,this.name=pA.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,a)}}class TA{constructor(e){this.parser=e,this.name=pA.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],o=i.images[a.source];let s=n.textureLoader;if(o.uri){const e=n.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then(function(r){if(r)return n.loadTextureImage(e,a.source,s);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class RA{constructor(e){this.parser=e,this.name=pA.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],o=i.images[a.source];let s=n.textureLoader;if(o.uri){const e=n.options.manager.getHandler(o.uri);null!==e&&(s=e)}return this.detectSupport().then(function(r){if(r)return n.loadTextureImage(e,a.source,s);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class DA{constructor(e){this.name=pA.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const e=n.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(t){const n=e.byteOffset||0,i=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):r.ready.then(function(){const t=new ArrayBuffer(a*o);return r.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}return null}}class QA{constructor(e){this.name=pA.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=t.meshes[n.mesh];for(const e of i.primitives)if(e.mode!==HA.TRIANGLES&&e.mode!==HA.TRIANGLE_STRIP&&e.mode!==HA.TRIANGLE_FAN&&void 0!==e.mode)return null;const r=n.extensions[this.name].attributes,a=[],o={};for(const e in r)a.push(this.parser.getDependency("accessor",r[e]).then(t=>(o[e]=t,o[e])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(e=>{const t=e.pop(),n=t.isGroup?t.children:[t],i=e[0].count,r=[];for(const e of n){const t=new si,n=new Rn,a=new Tn,s=new Rn(1,1,1),l=new xl(e.geometry,e.material,i);for(let e=0;e<i;e++)o.TRANSLATION&&n.fromBufferAttribute(o.TRANSLATION,e),o.ROTATION&&a.fromBufferAttribute(o.ROTATION,e),o.SCALE&&s.fromBufferAttribute(o.SCALE,e),l.setMatrixAt(e,t.compose(n,a,s));for(const t in o)if("_COLOR_0"===t){const e=o[t];l.instanceColor=new gl(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,o[t]);Li.prototype.copy.call(l,e),this.parser.assignFinalMaterial(l),r.push(l)}return t.isGroup?(t.clear(),t.add(...r),t):r[0]}))}}const LA="glTF";class UA{constructor(e){this.name=pA.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==LA)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-12,r=new DataView(e,12);let a=0;for(;a<i;){const t=r.getUint32(a,!0);a+=4;const i=r.getUint32(a,!0);if(a+=4,1313821514===i){const i=new Uint8Array(e,12+a,t);this.content=n.decode(i)}else if(5130562===i){const n=12+a;this.body=e.slice(n,n+t)}a+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class PA{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=pA.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},l={};for(const e in a){const t=jA[e]||e.toLowerCase();o[t]=a[e]}for(const t in e.attributes){const i=jA[t]||t.toLowerCase();if(void 0!==a[t]){const r=n.accessors[e.attributes[t]],a=zA[r.componentType];l[i]=a.name,s[i]=!0===r.normalized}}return t.getDependency("bufferView",r).then(function(e){return new Promise(function(t,n){i.decodeDracoFile(e,function(e){for(const t in e.attributes){const n=e.attributes[t],i=s[t];void 0!==i&&(n.normalized=i)}t(e)},o,l,It,n)})})}}class NA{constructor(){this.name=pA.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):e}}class FA{constructor(){this.name=pA.KHR_MESH_QUANTIZATION}}class OA extends Jl{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let e=0;e!==i;e++)t[e]=n[r+e];return t}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,l=3*o,c=i-t,h=(n-t)/c,A=h*h,u=A*h,d=e*l,p=d-l,f=-2*u+3*A,g=u-A,m=1-f,v=g-A+h;for(let e=0;e!==o;e++){const t=a[p+e+o],n=a[p+e+s]*c,i=a[d+e+o],l=a[d+e]*c;r[e]=m*t+v*n+f*i+g*l}return r}}const kA=new Tn;class GA extends OA{interpolate_(e,t,n,i){const r=super.interpolate_(e,t,n,i);return kA.fromArray(r).normalize().toArray(r),r}}const HA={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},zA={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},VA={9728:ze,9729:qe,9984:1004,9985:je,9986:We,9987:Ye},WA={33071:Ge,33648:He,10497:ke},qA={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},jA={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"},YA={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},XA={CUBICSPLINE:void 0,LINEAR:Et,STEP:vt};function KA(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new Ws({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function JA(e,t,n){for(const i in n.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i])}function ZA(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 $A(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let n=0,i=t.weights.length;n<i;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){const n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,i=n.length;t<i;t++)e.morphTargetDictionary[n[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function eu(e){let t;const n=e.extensions&&e.extensions[pA.KHR_DRACO_MESH_COMPRESSION];if(t=n?"draco:"+n.bufferView+":"+n.indices+":"+tu(n.attributes):e.indices+":"+tu(e.attributes)+":"+e.mode,void 0!==e.targets)for(let n=0,i=e.targets.length;n<i;n++)t+=":"+tu(e.targets[n]);return t}function tu(e){let t="";const n=Object.keys(e).sort();for(let i=0,r=n.length;i<r;i++)t+=n[i]+":"+e[n[i]]+";";return t}function nu(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 new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const iu=new si;class ru{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new dA,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 n=!1,i=!1,r=-1;"undefined"!=typeof navigator&&(n=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),i=navigator.userAgent.indexOf("Firefox")>-1,r=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||n||i&&r<98?this.textureLoader=new Ec(this.options.manager):this.textureLoader=new Uc(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new gc(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){const n=this,i=this.json,r=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([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(t){const a={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:n,userData:{}};return JA(r,a,i),ZA(a,i),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(const e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,i=t.length;n<i;n++){const i=t[n].joints;for(let t=0,n=i.length;t<n;t++)e[i[t]].isBone=!0}for(let t=0,i=e.length;t<i;t++){const i=e[t];void 0!==i.mesh&&(this._addNodeRef(this.meshCache,i.mesh),void 0!==i.skin&&(n[i.mesh].isSkinnedMesh=!0)),void 0!==i.camera&&this._addNodeRef(this.cameraCache,i.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,n){if(e.refs[t]<=1)return n;const i=n.clone(),r=(e,t)=>{const n=this.associations.get(e);null!=n&&this.associations.set(t,n);for(const[n,i]of e.children.entries())r(i,t.children[n])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const r=e(t[i]);r&&n.push(r)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":i=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e)}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(i.map(function(t,i){return n.getDependency(e,i)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[pA.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(e,r){n.load(Lc.resolveURL(t.uri,i.path),e,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){const n=t.byteLength||0,i=t.byteOffset||0;return e.slice(i,i+n)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse){const e=qA[i.type],t=zA[i.componentType],n=!0===i.normalized,r=new t(i.count*e);return Promise.resolve(new ar(r,e,n))}const r=[];return void 0!==i.bufferView?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),void 0!==i.sparse&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then(function(e){const r=e[0],a=qA[i.type],o=zA[i.componentType],s=o.BYTES_PER_ELEMENT,l=s*a,c=i.byteOffset||0,h=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,A=!0===i.normalized;let u,d;if(h&&h!==l){const e=Math.floor(c/h),n="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+e+":"+i.count;let l=t.cache.get(n);l||(u=new o(r,e*h,i.count*h/s),l=new Zs(u,h/s),t.cache.add(n,l)),d=new el(l,a,c%h/s,A)}else u=null===r?new o(i.count*a):new o(r,c,i.count*a),d=new ar(u,a,A);if(void 0!==i.sparse){const t=qA.SCALAR,n=zA[i.sparse.indices.componentType],s=i.sparse.indices.byteOffset||0,l=i.sparse.values.byteOffset||0,c=new n(e[1],s,i.sparse.count*t),h=new o(e[2],l,i.sparse.count*a);null!==r&&(d=new ar(d.array.slice(),d.itemSize,d.normalized));for(let e=0,t=c.length;e<t;e++){const t=c[e];if(d.setX(t,h[e*a]),a>=2&&d.setY(t,h[e*a+1]),a>=3&&d.setZ(t,h[e*a+2]),a>=4&&d.setW(t,h[e*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return d})}loadTexture(e){const t=this.json,n=this.options,i=t.textures[e].source,r=t.images[i];let a=this.textureLoader;if(r.uri){const e=n.manager.getHandler(r.uri);null!==e&&(a=e)}return this.loadTextureImage(e,i,a)}loadTextureImage(e,t,n){const i=this,r=this.json,a=r.textures[e],o=r.images[t],s=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[s])return this.textureCache[s];const l=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||o.name||"",""===t.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(t.name=o.uri);const n=(r.samplers||{})[a.sampler]||{};return t.magFilter=VA[n.magFilter]||qe,t.minFilter=VA[n.minFilter]||Ye,t.wrapS=WA[n.wrapS]||ke,t.wrapT=WA[n.wrapT]||ke,i.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=l,l}loadImageSource(e,t){const n=this.json,i=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());const r=n.images[e],a=self.URL||self.webkitURL;let o=r.uri||"",s=!1;if(void 0!==r.bufferView)o=this.getDependency("bufferView",r.bufferView).then(function(e){s=!0;const t=new Blob([e],{type:r.mimeType});return o=a.createObjectURL(t),o});else if(void 0===r.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const l=Promise.resolve(o).then(function(e){return new Promise(function(n,r){let a=n;!0===t.isImageBitmapLoader&&(a=function(e){const t=new xn(e);t.needsUpdate=!0,n(t)}),t.load(Lc.resolveURL(e,i.path),a,void 0,r)})}).then(function(e){var t;return!0===s&&a.revokeObjectURL(o),ZA(e,r),e.userData.mimeType=r.mimeType||((t=r.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":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),e});return this.sourceCache[e]=l,l}assignTexture(e,t,n,i){const r=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((a=a.clone()).channel=n.texCoord),r.extensions[pA.KHR_TEXTURE_TRANSFORM]){const e=void 0!==n.extensions?n.extensions[pA.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=r.associations.get(a);a=r.extensions[pA.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),r.associations.set(a,t)}}return void 0!==i&&(a.colorSpace=i),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=void 0===t.attributes.tangent,r=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new Vs,$i.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new js,$i.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(i||r||a){let e="ClonedMaterial:"+n.uuid+":";i&&(e+="derivative-tangents:"),r&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),r&&(t.vertexColors=!0),a&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return Ws}loadMaterial(e){const t=this,n=this.json,i=this.extensions,r=n.materials[e];let a;const o={},s=[];if((r.extensions||{})[pA.KHR_MATERIALS_UNLIT]){const e=i[pA.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),s.push(e.extendParams(o,r,t))}else{const n=r.pbrMetallicRoughness||{};if(o.color=new Ki(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){const e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],It),o.opacity=e[3]}void 0!==n.baseColorTexture&&s.push(t.assignTexture(o,"map",n.baseColorTexture,_t)),o.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,o.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(s.push(t.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),s.push(t.assignTexture(o,"roughnessMap",n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),s.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}!0===r.doubleSided&&(o.side=2);const l=r.alphaMode||"OPAQUE";if("BLEND"===l?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,"MASK"===l&&(o.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&a!==er&&(s.push(t.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new nn(1,1),void 0!==r.normalTexture.scale)){const e=r.normalTexture.scale;o.normalScale.set(e,e)}if(void 0!==r.occlusionTexture&&a!==er&&(s.push(t.assignTexture(o,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(o.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&a!==er){const e=r.emissiveFactor;o.emissive=(new Ki).setRGB(e[0],e[1],e[2],It)}return void 0!==r.emissiveTexture&&a!==er&&s.push(t.assignTexture(o,"emissiveMap",r.emissiveTexture,_t)),Promise.all(s).then(function(){const n=new a(o);return r.name&&(n.name=r.name),ZA(n,r),t.associations.set(n,{materials:e}),r.extensions&&JA(i,n,r),n})}createUniqueName(e){const t=Vc.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function r(e){return n[pA.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return au(n,e,t)})}const a=[];for(let n=0,o=e.length;n<o;n++){const o=e[n],s=eu(o),l=i[s];if(l)a.push(l.promise);else{let e;e=o.extensions&&o.extensions[pA.KHR_DRACO_MESH_COMPRESSION]?r(o):au(new gr,o,t),i[s]={primitive:o,promise:e},a.push(e)}}return Promise.all(a)}loadMesh(e){const t=this,n=this.json,i=this.extensions,r=n.meshes[e],a=r.primitives,o=[];for(let e=0,t=a.length;e<t;e++){const t=void 0===a[e].material?KA(this.cache):this.getDependency("material",a[e].material);o.push(t)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(n){const o=n.slice(0,n.length-1),s=n[n.length-1],l=[];for(let n=0,c=s.length;n<c;n++){const c=s[n],h=a[n];let A;const u=o[n];if(h.mode===HA.TRIANGLES||h.mode===HA.TRIANGLE_STRIP||h.mode===HA.TRIANGLE_FAN||void 0===h.mode)A=!0===r.isSkinnedMesh?new hl(c,u):new Lr(c,u),!0===A.isSkinnedMesh&&A.normalizeSkinWeights(),h.mode===HA.TRIANGLE_STRIP?A.geometry=AA(A.geometry,1):h.mode===HA.TRIANGLE_FAN&&(A.geometry=AA(A.geometry,2));else if(h.mode===HA.LINES)A=new Pl(c,u);else if(h.mode===HA.LINE_STRIP)A=new Dl(c,u);else if(h.mode===HA.LINE_LOOP)A=new Nl(c,u);else{if(h.mode!==HA.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);A=new Hl(c,u)}Object.keys(A.geometry.morphAttributes).length>0&&$A(A,r),A.name=t.createUniqueName(r.name||"mesh_"+e),ZA(A,r),h.extensions&&JA(i,A,h),t.assignFinalMaterial(A),A.computeOffsets(),l.push(A)}for(let n=0,i=l.length;n<i;n++)t.associations.set(l[n],{meshes:e,primitives:n});if(1===l.length)return r.extensions&&JA(i,l[0],r),l[0];const c=new Ls;r.extensions&&JA(i,c,r),t.associations.set(c,{meshes:e});for(let e=0,t=l.length;e<t;e++)c.add(l[e]);return c})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(i)return"perspective"===n.type?t=new qr(tn(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(t=new Ea(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),ZA(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],n=[];for(let e=0,i=t.joints.length;e<i;e++)n.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(e){const n=e.pop(),i=e,r=[],a=[];for(let e=0,o=i.length;e<o;e++){const o=i[e];if(o){r.push(o);const t=new si;null!==n&&t.fromArray(n.array,16*e),a.push(t)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new fl(r,a)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,a=[],o=[],s=[],l=[],c=[];for(let e=0,t=i.channels.length;e<t;e++){const t=i.channels[e],n=i.samplers[t.sampler],r=t.target,h=r.node,A=void 0!==i.parameters?i.parameters[n.input]:n.input,u=void 0!==i.parameters?i.parameters[n.output]:n.output;void 0!==r.node&&(a.push(this.getDependency("node",h)),o.push(this.getDependency("accessor",A)),s.push(this.getDependency("accessor",u)),l.push(n),c.push(r))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(l),Promise.all(c)]).then(function(e){const t=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=[];for(let e=0,r=t.length;e<r;e++){const r=t[e],c=i[e],h=a[e],A=o[e],u=s[e];if(void 0===r)continue;r.updateMatrix&&r.updateMatrix();const d=n._createAnimationTracks(r,c,h,A,u);if(d)for(let e=0;e<d.length;e++)l.push(d[e])}return new cc(r,void 0,l)})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return void 0===i.mesh?null:n.getDependency("mesh",i.mesh).then(function(e){const t=n._getNodeRef(n.meshCache,i.mesh,e);return void 0!==i.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,n=i.weights.length;t<n;t++)e.morphTargetInfluences[t]=i.weights[t]}),t})}loadNode(e){const t=this,n=this.json.nodes[e],i=t._loadNodeShallow(e),r=[],a=n.children||[];for(let e=0,n=a.length;e<n;e++)r.push(t.getDependency("node",a[e]));const o=void 0===n.skin?Promise.resolve(null):t.getDependency("skin",n.skin);return Promise.all([i,Promise.all(r),o]).then(function(e){const t=e[0],n=e[1],i=e[2];null!==i&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(i,iu)});for(let e=0,i=n.length;e<i;e++)t.add(n[e]);return t})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const r=t.nodes[e],a=r.name?i.createUniqueName(r.name):"",o=[],s=i._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return s&&o.push(s),void 0!==r.camera&&o.push(i.getDependency("camera",r.camera).then(function(e){return i._getNodeRef(i.cameraCache,r.camera,e)})),i._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){o.push(e)}),this.nodeCache[e]=Promise.all(o).then(function(t){let o;if(o=!0===r.isBone?new Al:t.length>1?new Ls:1===t.length?t[0]:new Li,o!==t[0])for(let e=0,n=t.length;e<n;e++)o.add(t[e]);if(r.name&&(o.userData.name=r.name,o.name=a),ZA(o,r),r.extensions&&JA(n,o,r),void 0!==r.matrix){const e=new si;e.fromArray(r.matrix),o.applyMatrix4(e)}else void 0!==r.translation&&o.position.fromArray(r.translation),void 0!==r.rotation&&o.quaternion.fromArray(r.rotation),void 0!==r.scale&&o.scale.fromArray(r.scale);return i.associations.has(o)||i.associations.set(o,{}),i.associations.get(o).nodes=e,o}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,r=new Ls;n.name&&(r.name=i.createUniqueName(n.name)),ZA(r,n),n.extensions&&JA(t,r,n);const a=n.nodes||[],o=[];for(let e=0,t=a.length;e<t;e++)o.push(i.getDependency("node",a[e]));return Promise.all(o).then(function(e){for(let t=0,n=e.length;t<n;t++)r.add(e[t]);return i.associations=(e=>{const t=new Map;for(const[e,n]of i.associations)(e instanceof $i||e instanceof xn)&&t.set(e,n);return e.traverse(e=>{const n=i.associations.get(e);null!=n&&t.set(e,n)}),t})(r),r.userData.isDiamondScene=i._sceneContainsDiamondMaterial(r),r})}_sceneContainsDiamondMaterial(e){let t=!1;return e.traverse(e=>{e.material&&e.material.isMeshDiamondMaterial&&(t=!0)}),t}_createAnimationTracks(e,t,n,i,r){const a=[],o=e.name?e.name:e.uuid,s=[];let l;switch(YA[r.path]===YA.weights?e.traverse(function(e){e.morphTargetInfluences&&s.push(e.name?e.name:e.uuid)}):s.push(o),YA[r.path]){case YA.weights:l=rc;break;case YA.rotation:l=oc;break;case YA.position:case YA.scale:l=lc;break;default:l=1===n.itemSize?rc:lc}const c=void 0!==i.interpolation?XA[i.interpolation]:Et,h=this._getArrayFromAccessor(n);for(let e=0,n=s.length;e<n;e++){const n=new l(s[e]+"."+YA[r.path],t.array,h,c);"CUBICSPLINE"===i.interpolation&&this._createCubicSplineTrackInterpolant(n),a.push(n)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=nu(t.constructor),n=new Float32Array(t.length);for(let i=0,r=t.length;i<r;i++)n[i]=t[i]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof oc?GA:OA)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function au(e,t,n){const i=t.attributes,r=[];function a(t,i){return n.getDependency("accessor",t).then(function(t){e.setAttribute(i,t)})}for(const t in i){const n=jA[t]||t.toLowerCase();n in e.attributes||r.push(a(i[t],n))}if(void 0!==t.indices&&!e.index){const i=n.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});r.push(i)}return fn.workingColorSpace!==It&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${fn.workingColorSpace}" not supported.`),ZA(e,t),function(e,t,n){const i=t.attributes,r=new Ln;if(void 0===i.POSITION)return;{const e=n.json.accessors[i.POSITION],t=e.min,a=e.max;if(void 0===t||void 0===a)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(r.set(new Rn(t[0],t[1],t[2]),new Rn(a[0],a[1],a[2])),e.normalized){const t=nu(zA[e.componentType]);r.min.multiplyScalar(t),r.max.multiplyScalar(t)}}const a=t.targets;if(void 0!==a){const e=new Rn,t=new Rn;for(let i=0,r=a.length;i<r;i++){const r=a[i];if(void 0!==r.POSITION){const i=n.json.accessors[r.POSITION],a=i.min,o=i.max;if(void 0!==a&&void 0!==o){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(o[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(o[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(o[2]))),i.normalized){const e=nu(zA[i.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(e)}e.boundingBox=r;const o=new Zn;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=o}(e,t,n),Promise.all(r).then(function(){return void 0!==t.targets?function(e,t,n){let i=!1,r=!1,a=!1;for(let e=0,n=t.length;e<n;e++){const n=t[e];if(void 0!==n.POSITION&&(i=!0),void 0!==n.NORMAL&&(r=!0),void 0!==n.COLOR_0&&(a=!0),i&&r&&a)break}if(!i&&!r&&!a)return Promise.resolve(e);const o=[],s=[],l=[];for(let c=0,h=t.length;c<h;c++){const h=t[c];if(i){const t=void 0!==h.POSITION?n.getDependency("accessor",h.POSITION):e.attributes.position;o.push(t)}if(r){const t=void 0!==h.NORMAL?n.getDependency("accessor",h.NORMAL):e.attributes.normal;s.push(t)}if(a){const t=void 0!==h.COLOR_0?n.getDependency("accessor",h.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(l)]).then(function(t){const n=t[0],o=t[1],s=t[2];return i&&(e.morphAttributes.position=n),r&&(e.morphAttributes.normal=o),a&&(e.morphAttributes.color=s),e.morphTargetsRelative=!0,e})}(e,t.targets,n):e})}class ou{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const 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){const n=this.workersResolve[e];if(n&&n(t),this.queue.length){const{resolve:t,msg:n,transfer:i}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(n,i)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(n=>{const i=this._getIdleWorker();-1!==i?(this._initWorker(i),this.workerStatus|=1<<i,this.workersResolve[i]=n,this.workers[i].postMessage(e,t)):this.queue.push({resolve:n,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}}const su=9,lu=15,cu=16,hu=22,Au=37,uu=43,du=76,pu=83,fu=97,gu=100,mu=103,vu=109,Eu=165,bu=166;class Cu{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize: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:[]}],this.keyValue={},this.globalData=null}}class _u{constructor(e,t,n,i){this._dataView=new DataView(e.buffer,e.byteOffset+t,n),this._littleEndian=i,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_skip(e){return this._offset+=e,this}_scan(e,t=0){const n=this._offset;let i=0;for(;this._dataView.getUint8(this._offset)!==t&&i<e;)i++,this._offset++;return i<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,i)}}const Iu=[171,75,84,88,32,50,48,187,13,10,26,10];function xu(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):Buffer.from(e).toString("utf8")}let yu,Mu,wu;const Su={env:{emscripten_notify_memory_growth:function(e){wu=new Uint8Array(Mu.exports.memory.buffer)}}};class Bu{init(){return yu||(yu="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+Tu).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,Su)).then(this._init):WebAssembly.instantiate(Buffer.from(Tu,"base64"),Su).then(this._init),yu)}_init(e){Mu=e.instance,Su.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!Mu)throw new Error("ZSTDDecoder: Await .init() before decoding.");const n=e.byteLength,i=Mu.exports.malloc(n);wu.set(e,i),t=t||Number(Mu.exports.ZSTD_findDecompressedSize(i,n));const r=Mu.exports.malloc(t),a=Mu.exports.ZSTD_decompress(r,t,i,n),o=wu.slice(r,r+a);return Mu.exports.free(i),Mu.exports.free(r),o}}const Tu="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IAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQh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ASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigC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C0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/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/QQ8hAiABIABJBEAgAUEE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",Ru=new WeakMap;let Du,Qu=0;class Lu extends dc{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new ou,this.workerSourceURL="",this.workerConfig=null,"undefined"!=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 this.workerConfig={astcSupported:await e.hasFeatureAsync("texture-compression-astc"),etc1Supported:await e.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await e.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await e.hasFeatureAsync("texture-compression-bc"),bptcSupported:await e.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await e.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:e.hasFeature("texture-compression-bptc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),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")},this}init(){if(!this.transcoderPending){const e=new gc(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),n=new gc(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);const i=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,i]).then(([e,t])=>{const n=Lu.BasisWorker.toString(),i=["/* constants */","let _EngineFormat = "+JSON.stringify(Lu.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(Lu.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Lu.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i])),this.transcoderBinary=t,this.workerPool.setWorkerCreator(()=>{const e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e})}),Qu>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Qu++}return this.transcoderPending}load(e,t,n,i){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const r=new gc(this.manager);r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials),r.load(e,e=>{if(Ru.has(e))return Ru.get(e).promise.then(t).catch(i);this._createTexture(e).then(e=>t?t(e):null).catch(i)},n,i)}_createTextureFrom(e,t){const{faces:n,width:i,height:r,format:a,type:o,error:s,dfdFlags:l}=e;if("error"===o)return Promise.reject(s);let c;if(6===t.faceCount)c=new ql(n,a,Xe);else{const e=n[0].mipmaps;c=t.layerCount>1?new Wl(e,i,r,t.layerCount,a,Xe):new Vl(e,i,r,a,Xe)}return c.minFilter=1===n[0].mipmaps.length?qe:Ye,c.magFilter=qe,c.generateMipmaps=!1,c.needsUpdate=!0,c.colorSpace=Fu(t),c.premultiplyAlpha=!!(1&l),c}async _createTexture(e,t={}){const n=function(e){const t=new Uint8Array(e.buffer,e.byteOffset,Iu.length);if(t[0]!==Iu[0]||t[1]!==Iu[1]||t[2]!==Iu[2]||t[3]!==Iu[3]||t[4]!==Iu[4]||t[5]!==Iu[5]||t[6]!==Iu[6]||t[7]!==Iu[7]||t[8]!==Iu[8]||t[9]!==Iu[9]||t[10]!==Iu[10]||t[11]!==Iu[11])throw new Error("Missing KTX 2.0 identifier.");const n=new Cu,i=17*Uint32Array.BYTES_PER_ELEMENT,r=new _u(e,Iu.length,i,!0);n.vkFormat=r._nextUint32(),n.typeSize=r._nextUint32(),n.pixelWidth=r._nextUint32(),n.pixelHeight=r._nextUint32(),n.pixelDepth=r._nextUint32(),n.layerCount=r._nextUint32(),n.faceCount=r._nextUint32();const a=r._nextUint32();n.supercompressionScheme=r._nextUint32();const o=r._nextUint32(),s=r._nextUint32(),l=r._nextUint32(),c=r._nextUint32(),h=r._nextUint64(),A=r._nextUint64(),u=new _u(e,Iu.length+i,3*a*8,!0);for(let t=0;t<a;t++)n.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+u._nextUint64(),u._nextUint64()),uncompressedByteLength:u._nextUint64()});const d=new _u(e,o,s,!0),p={vendorId:d._skip(4)._nextUint16(),descriptorType:d._nextUint16(),versionNumber:d._nextUint16(),descriptorBlockSize:d._nextUint16(),colorModel:d._nextUint8(),colorPrimaries:d._nextUint8(),transferFunction:d._nextUint8(),flags:d._nextUint8(),texelBlockDimension:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],bytesPlane:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],samples:[]},f=(p.descriptorBlockSize/4-6)/4;for(let e=0;e<f;e++){const t={bitOffset:d._nextUint16(),bitLength:d._nextUint8(),channelType:d._nextUint8(),samplePosition:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=d._nextInt32(),t.sampleUpper=d._nextInt32()):(t.sampleLower=d._nextUint32(),t.sampleUpper=d._nextUint32()),p.samples[e]=t}n.dataFormatDescriptor.length=0,n.dataFormatDescriptor.push(p);const g=new _u(e,l,c,!0);for(;g._offset<c;){const e=g._nextUint32(),t=g._scan(e),i=xu(t),r=g._scan(e-t.byteLength);n.keyValue[i]=i.match(/^ktx/i)?xu(r):r,g._offset%4&&g._skip(4-g._offset%4)}if(A<=0)return n;const m=new _u(e,h,A,!0),v=m._nextUint16(),E=m._nextUint16(),b=m._nextUint32(),C=m._nextUint32(),_=m._nextUint32(),I=m._nextUint32(),x=[];for(let e=0;e<a;e++)x.push({imageFlags:m._nextUint32(),rgbSliceByteOffset:m._nextUint32(),rgbSliceByteLength:m._nextUint32(),alphaSliceByteOffset:m._nextUint32(),alphaSliceByteLength:m._nextUint32()});const y=h+m._offset,M=y+b,w=M+C,S=w+_,B=new Uint8Array(e.buffer,e.byteOffset+y,b),T=new Uint8Array(e.buffer,e.byteOffset+M,C),R=new Uint8Array(e.buffer,e.byteOffset+w,_),D=new Uint8Array(e.buffer,e.byteOffset+S,I);return n.globalData={endpointCount:v,selectorCount:E,imageDescs:x,endpointsData:B,selectorsData:T,tablesData:R,extendedData:D},n}(new Uint8Array(e));if(0!==n.vkFormat)return async function(e){const{vkFormat:t}=e;if(void 0===Pu[t])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let n;2===e.supercompressionScheme&&(Du||(Du=new Promise(async e=>{const t=new Bu;await t.init(),e(t)})),n=await Du);const i=[];for(let r=0;r<e.levels.length;r++){const a=Math.max(1,e.pixelWidth>>r),o=Math.max(1,e.pixelHeight>>r),s=e.pixelDepth?Math.max(1,e.pixelDepth>>r):0,l=e.levels[r];let c,h;if(0===e.supercompressionScheme)c=l.levelData;else{if(2!==e.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");c=n.decode(l.levelData,l.uncompressedByteLength)}h=Nu[t]===Ze?new Float32Array(c.buffer,c.byteOffset,c.byteLength/Float32Array.BYTES_PER_ELEMENT):Nu[t]===$e?new Uint16Array(c.buffer,c.byteOffset,c.byteLength/Uint16Array.BYTES_PER_ELEMENT):c,i.push({data:h,width:a,height:o,depth:s})}let r;if(Uu.has(Pu[t]))r=0===e.pixelDepth?new ul(i[0].data,e.pixelWidth,e.pixelHeight):new Bn(i[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");r=new Vl(i,e.pixelWidth,e.pixelHeight)}return r.mipmaps=i,r.type=Nu[t],r.format=Pu[t],r.colorSpace=Fu(e),r.needsUpdate=!0,Promise.resolve(r)}(n);const i=t,r=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:i},[e])).then(e=>this._createTextureFrom(e.data,n));return Ru.set(e,{promise:r}),r}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Qu--,this}}Lu.BasisFormat={ETC1S:0,UASTC_4x4:1},Lu.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},Lu.EngineFormat={RGBAFormat:tt,RGBA_ASTC_4x4_Format:ft,RGBA_BPTC_Format:mt,RGBA_ETC2_EAC_Format:pt,RGBA_PVRTC_4BPPV1_Format:At,RGBA_S3TC_DXT5_Format:ct,RGB_ETC1_Format:ut,RGB_ETC2_Format:dt,RGB_PVRTC_4BPPV1_Format:ht,RGBA_S3TC_DXT1_Format:st},Lu.BasisWorker=function(){let e,t,n;const i=_EngineFormat,r=_TranscoderFormat,a=_BasisFormat;self.addEventListener("message",function(o){const A=o.data;switch(A.type){case"init":e=A.config,u=A.transcoderBinary,t=new Promise(e=>{n={wasmBinary:u,onRuntimeInitialized:e},BASIS(n)}).then(()=>{n.initializeBasis(),void 0===n.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")});break;case"transcode":t.then(()=>{try{const{faces:t,buffers:o,width:u,height:d,hasAlpha:p,format:f,dfdFlags:g}=function(t){const o=new n.KTX2File(new Uint8Array(t));function A(){o.close(),o.delete()}if(!o.isValid())throw A(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");const u=o.isUASTC()?a.UASTC_4x4:a.ETC1S,d=o.getWidth(),p=o.getHeight(),f=o.getLayers()||1,g=o.getLevels(),m=o.getFaces(),v=o.getHasAlpha(),E=o.getDFDFlags(),{transcoderFormat:b,engineFormat:C}=function(t,n,o,h){let A,u;const d=t===a.ETC1S?s:l;for(let i=0;i<d.length;i++){const r=d[i];if(e[r.if]&&r.basisFormat.includes(t)&&!(h&&r.transcoderFormat.length<2)&&(!r.needsPowerOfTwo||c(n)&&c(o)))return A=r.transcoderFormat[h?1:0],u=r.engineFormat[h?1:0],{transcoderFormat:A,engineFormat:u}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),A=r.RGBA32,u=i.RGBAFormat,{transcoderFormat:A,engineFormat:u}}(u,d,p,v);if(!d||!p||!g)throw A(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!o.startTranscoding())throw A(),new Error("THREE.KTX2Loader: .startTranscoding failed");const _=[],I=[];for(let e=0;e<m;e++){const t=[];for(let n=0;n<g;n++){const i=[];let r,a;for(let t=0;t<f;t++){const s=o.getImageLevelInfo(n,t,e);0!==e||0!==n||0!==t||s.origWidth%4==0&&s.origHeight%4==0||console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),g>1?(r=s.origWidth,a=s.origHeight):(r=s.width,a=s.height);const l=new Uint8Array(o.getImageTranscodedSizeInBytes(n,t,0,b));if(!o.transcodeImage(l,n,t,e,b,0,-1,-1))throw A(),new Error("THREE.KTX2Loader: .transcodeImage failed.");i.push(l)}const s=h(i);t.push({data:s,width:r,height:a}),I.push(s.buffer)}_.push({mipmaps:t,width:d,height:p,format:C})}return A(),{faces:_,buffers:I,width:d,height:p,hasAlpha:v,format:C,dfdFlags:E}}(A.buffer);self.postMessage({type:"transcode",id:A.id,faces:t,width:u,height:d,hasAlpha:p,format:f,dfdFlags:g},o)}catch(e){console.error(e),self.postMessage({type:"error",id:A.id,error:e.message})}})}var u});const o=[{if:"astcSupported",basisFormat:[a.UASTC_4x4],transcoderFormat:[r.ASTC_4x4,r.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.BC7_M5,r.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.BC1,r.BC3],engineFormat:[i.RGBA_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.ETC1,r.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.ETC1],engineFormat:[i.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.PVRTC1_4_RGB,r.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],s=o.sort(function(e,t){return e.priorityETC1S-t.priorityETC1S}),l=o.sort(function(e,t){return e.priorityUASTC-t.priorityUASTC});function c(e){return e<=2||!(e&e-1)&&0!==e}function h(e){if(1===e.length)return e[0];let t=0;for(let n=0;n<e.length;n++)t+=e[n].byteLength;const n=new Uint8Array(t);let i=0;for(let t=0;t<e.length;t++){const r=e[t];n.set(r,i),i+=r.byteLength}return n}};const Uu=new Set([tt,at,rt]),Pu={[vu]:tt,[fu]:tt,[Au]:tt,[uu]:tt,[mu]:at,[pu]:at,[cu]:at,[hu]:at,[gu]:rt,[du]:rt,[lu]:rt,[su]:rt,[bu]:gt,[Eu]:gt},Nu={[vu]:Ze,[fu]:$e,[Au]:Xe,[uu]:Xe,[mu]:Ze,[pu]:$e,[cu]:Xe,[hu]:Xe,[gu]:Ze,[du]:$e,[lu]:Xe,[su]:Xe,[bu]:Xe,[Eu]:Xe};function Fu(e){const t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?_t:It:10===t.colorPrimaries?2===t.transferFunction?xt:yt:(0===t.colorPrimaries||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),Ct)}let Ou=null;const ku=e=>{Ou=null==e?null:e.endsWith("/")?e.substring(0,e.length-1):e},Gu=()=>null!=Ou?`${Ou}/libs`:"https://cdn.jsdelivr.net/npm/three@0.165.0/examples/jsm/libs",Hu=(()=>{const e=(()=>{var e;if(null===(e=document.documentElement.getAttribute("itemtype"))||void 0===e?void 0:e.includes("schema.org/SearchResultsPage"))return!0;const t=null!=document.head?Array.from(document.head.querySelectorAll("meta")):[];for(const e of t)if("viewport"===e.name)return!0;return!1})();return e||console.error('No <meta name="viewport"> detected. This might cause ShopAR to crash on iOS.\nPlease add the following line to your HTML:\n<meta name="viewport" content="width=device-width, initial-scale=1.0">'),()=>e?Math.min(window.devicePixelRatio||1,2):1})(),zu=new Ki(16777215);let Vu,Wu,qu=!1,ju=1,Yu=1,Xu=1;function Ku(){return Ju(),Vu}function Ju(){if(qu)return;Xu=Hu(),Wu=document.createElement("canvas");const e=Wu.style;e.position="absolute",e.top="0",e.left="0",e.width="100%",e.height="100%",Vu=new Js({powerPreference:"high-performance",canvas:Wu,antialias:!0,alpha:!0}),Vu.outputColorSpace=_t,Vu.toneMapping=4,Vu.setClearColor(new Ki(16777215),0),qu=!0}function Zu(e,t,n,i,r){const{width:a,height:o}=t,s=Vu.toneMapping,l=Vu.toneMappingExposure;if(Vu.toneMapping=i,Vu.toneMappingExposure=r,Vu.setViewport(0,0,a,o),Vu.setClearColor(zu,n),e.setSize(a,o),e.render(),Vu.toneMapping=s,Vu.toneMappingExposure=l,t.isBlitted()){const{context2d:e}=t;if(null==e)return;e.clearRect(0,0,a,o),Wu.width>0&&Wu.height>0&&e.drawImage(Wu,0,Yu-o,a,o,0,0,a,o)}}function $u(e,t){const n=Hu();e=Math.ceil(e*n),t=Math.ceil(t*n),e===ju&&t===Yu&&n===Xu||(ju=e,Yu=t,Xu=n,Ku().setSize(ju,Yu,!1))}function ed(e,t){Ku().renderCubeMapNormals(e),e.traverse(e=>{e instanceof Lr&&e.material&&e.material.isMeshDiamondMaterial&&(e.material.envMap=t)})}let td,nd=!1;function id(e){return nd||rd(),td.parseAsync(e.buffer,"")}function rd(){if(nd)return;const e=(new cA).setDecoderPath(`${Gu()}/draco/gltf/`);e.preload();const t=(new Lu).setTranscoderPath(`${Gu()}/basis/`).detectSupport(Ku());td=(new uA).setDRACOLoader(e).setKTX2Loader(t).setMeshoptDecoder(sA),nd=!0}function ad(e){null!=e&&(Object.values(e).forEach(e=>{(null==e?void 0:e.dispose)instanceof Function&&e.dispose()}),e.dispose())}function od(e,t,n,i,r,a){if(null==e)return new Rn;const o=sd(e,i,r,new Rn),s=ld(e);sd(e,o.scale,o.quaternion,o.position);const l=s.getSize(new Rn),c=s.getCenter(new Rn);let h=0;return h=l.x/2+t/2,n&&(h=-h),new Rn(-c.x+h,-c.y+l.y/2,-c.z)}function sd(e,t,n,i){let r,a,o;return null!=t&&(r=e.scale.x,e.scale.set(t,t,t)),null!=n&&(a=e.quaternion.clone(),e.quaternion.copy(n)),null!=i&&(o=e.position.clone(),e.position.copy(i)),{scale:r,quaternion:a,position:o}}function ld(e){return(new Ln).setFromObject(e,!0)}function cd(e){e.traverse(e=>{var t;e instanceof Lr&&(null===(t=e.geometry)||void 0===t||t.dispose(),Array.isArray(e.material)?e.material.forEach(ad):ad(e.material))}),e.clear()}const hd={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor = opacity * texel;\n\n\n\t\t}"};class Ad{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const ud=new Ea(-1,1,1,-1,0,1),dd=new class extends gr{constructor(){super(),this.setAttribute("position",new lr([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new lr([0,2,0,0,2,0],2))}};class pd{constructor(e){this._mesh=new Lr(dd,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,ud)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class fd extends Ad{constructor(e,t){super(),this.textureID=void 0!==t?t:"tDiffuse",e instanceof Gr?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=kr.clone(e.uniforms),this.material=new Gr({name:void 0!==e.name?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new pd(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class gd extends Ad{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const i=e.getContext(),r=e.state;let a,o;r.buffers.color.setMask(!1),r.buffers.depth.setMask(!1),r.buffers.color.setLocked(!0),r.buffers.depth.setLocked(!0),this.inverse?(a=0,o=1):(a=1,o=0),r.buffers.stencil.setTest(!0),r.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),r.buffers.stencil.setFunc(i.ALWAYS,a,4294967295),r.buffers.stencil.setClear(o),r.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),r.buffers.color.setLocked(!1),r.buffers.depth.setLocked(!1),r.buffers.color.setMask(!0),r.buffers.depth.setMask(!0),r.buffers.stencil.setLocked(!1),r.buffers.stencil.setFunc(i.EQUAL,1,4294967295),r.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),r.buffers.stencil.setLocked(!0)}}class md extends Ad{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class vd{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),void 0===t){const n=e.getSize(new nn);this._width=n.width,this._height=n.height,(t=new wn(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:$e})).texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new fd(hd),this.copyPass.material.blending=0,this.clock=new Pc}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);-1!==t&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){void 0===e&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let n=!1;for(let t=0,i=this.passes.length;t<i;t++){const i=this.passes[t];if(!1!==i.enabled){if(i.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(t),i.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),i.needsSwap){if(n){const t=this.renderer.getContext(),n=this.renderer.state.buffers.stencil;n.setFunc(t.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),n.setFunc(t.EQUAL,1,4294967295)}this.swapBuffers()}void 0!==gd&&(i instanceof gd?n=!0:i instanceof md&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(void 0===e){const t=this.renderer.getSize(new nn);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,i=this._height*this._pixelRatio;this.renderTarget1.setSize(n,i),this.renderTarget2.setSize(n,i);for(let e=0;e<this.passes.length;e++)this.passes[e].setSize(n,i)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}const Ed={name:"OutputShader",uniforms:{tDiffuse:{value:null},toneMappingExposure:{value:1}},vertexShader:"\n\t\tprecision highp float;\n\n\t\tuniform mat4 modelViewMatrix;\n\t\tuniform mat4 projectionMatrix;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\t\n\t\tprecision highp float;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\t#include <tonemapping_pars_fragment>\n\t\t#include <colorspace_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\n\t\t\t// tone mapping\n\n\t\t\t#ifdef LINEAR_TONE_MAPPING\n\n\t\t\t\tgl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( REINHARD_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( CINEON_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = OptimizedCineonToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( ACES_FILMIC_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( AGX_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( NEUTRAL_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );\n\n\t\t\t#endif\n\n\t\t\t// color space\n\n\t\t\t#ifdef SRGB_TRANSFER\n\n\t\t\t\tgl_FragColor = sRGBTransferOETF( gl_FragColor );\n\n\t\t\t#endif\n\n\t\t}"};class bd extends Ad{constructor(){super();const e=Ed;this.uniforms=kr.clone(e.uniforms),this.material=new zs({name:e.name,uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader}),this.fsQuad=new pd(this.material),this._outputColorSpace=null,this._toneMapping=null}render(e,t,n){this.uniforms.tDiffuse.value=n.texture,this.uniforms.toneMappingExposure.value=e.toneMappingExposure,this._outputColorSpace===e.outputColorSpace&&this._toneMapping===e.toneMapping||(this._outputColorSpace=e.outputColorSpace,this._toneMapping=e.toneMapping,this.material.defines={},fn.getTransfer(this._outputColorSpace)===wt&&(this.material.defines.SRGB_TRANSFER=""),1===this._toneMapping?this.material.defines.LINEAR_TONE_MAPPING="":2===this._toneMapping?this.material.defines.REINHARD_TONE_MAPPING="":3===this._toneMapping?this.material.defines.CINEON_TONE_MAPPING="":4===this._toneMapping?this.material.defines.ACES_FILMIC_TONE_MAPPING="":6===this._toneMapping?this.material.defines.AGX_TONE_MAPPING="":7===this._toneMapping&&(this.material.defines.NEUTRAL_TONE_MAPPING=""),this.material.needsUpdate=!0),!0===this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class Cd extends Ad{constructor(e,t,n=null,i=null,r=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=i,this.clearAlpha=r,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new Ki}render(e,t,n){const i=e.autoClear;let r,a;e.autoClear=!1,null!==this.overrideMaterial&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),null!==this.clearColor&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),null!==this.clearAlpha&&(r=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),1==this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),!0===this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),null!==this.clearColor&&e.setClearColor(this._oldClearColor),null!==this.clearAlpha&&e.setClearAlpha(r),null!==this.overrideMaterial&&(this.scene.overrideMaterial=a),e.autoClear=i}}const _d={uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new Ki(0)},defaultOpacity:{value:0}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform vec3 defaultColor;\n\t\tuniform float defaultOpacity;\n\t\tuniform float luminosityThreshold;\n\t\tuniform float smoothWidth;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n\t\t\tfloat v = dot( texel.xyz, luma );\n\n\t\t\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n\t\t\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n\t\t\tgl_FragColor = mix( outputColor, texel, alpha );\n\t\t\tgl_FragColor.rgb = max( gl_FragColor.rgb, vec3( 0.0 ) );\n\n\t\t}"};class Id extends Ad{constructor(e,t,n,i){super(),this.strength=void 0!==t?t:1,this.radius=n,this.threshold=i,this.resolution=void 0!==e?new nn(e.x,e.y):new nn(256,256),this.clearColor=new Ki(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let r=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);this.renderTargetBright=new wn(r,a,{type:$e}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let e=0;e<this.nMips;e++){const t=new wn(r,a,{type:$e});t.texture.name="UnrealBloomPass.h"+e,t.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(t);const n=new wn(r,a,{type:$e});n.texture.name="UnrealBloomPass.v"+e,n.texture.generateMipmaps=!1,this.renderTargetsVertical.push(n),r=Math.round(r/2),a=Math.round(a/2)}const o=_d;this.highPassUniforms=kr.clone(o.uniforms),this.highPassUniforms.luminosityThreshold.value=i,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new Gr({uniforms:this.highPassUniforms,vertexShader:o.vertexShader,fragmentShader:o.fragmentShader}),this.separableBlurMaterials=[];const s=[3,5,7,9,11];r=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);for(let e=0;e<this.nMips;e++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(s[e])),this.separableBlurMaterials[e].uniforms.invSize.value=new nn(1/r,1/a),r=Math.round(r/2),a=Math.round(a/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=t,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],this.bloomTintColors=[new Rn(1,1,1),new Rn(1,1,1),new Rn(1,1,1),new Rn(1,1,1),new Rn(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors;const l=hd;this.copyUniforms=kr.clone(l.uniforms),this.blendMaterial=new Gr({uniforms:this.copyUniforms,vertexShader:l.vertexShader,fragmentShader:l.fragmentShader,blending:2,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new Ki,this.oldClearAlpha=1,this.basic=new er,this.fsQuad=new pd(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose();for(let e=0;e<this.separableBlurMaterials.length;e++)this.separableBlurMaterials[e].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this.basic.dispose(),this.fsQuad.dispose()}setSize(e,t){let n=Math.round(e/2),i=Math.round(t/2);this.renderTargetBright.setSize(n,i);for(let e=0;e<this.nMips;e++)this.renderTargetsHorizontal[e].setSize(n,i),this.renderTargetsVertical[e].setSize(n,i),this.separableBlurMaterials[e].uniforms.invSize.value=new nn(1/n,1/i),n=Math.round(n/2),i=Math.round(i/2)}render(e,t,n,i,r){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const a=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),r&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=n.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e);let o=this.renderTargetBright;for(let t=0;t<this.nMips;t++)this.fsQuad.material=this.separableBlurMaterials[t],this.separableBlurMaterials[t].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[t].uniforms.direction.value=Id.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[t]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[t].uniforms.colorTexture.value=this.renderTargetsHorizontal[t].texture,this.separableBlurMaterials[t].uniforms.direction.value=Id.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[t]),e.clear(),this.fsQuad.render(e),o=this.renderTargetsVertical[t];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,r&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(n),this.fsQuad.render(e)),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=a}getSeperableBlurMaterial(e){const t=[];for(let n=0;n<e;n++)t.push(.39894*Math.exp(-.5*n*n/(e*e))/e);return new Gr({defines:{KERNEL_RADIUS:e},uniforms:{colorTexture:{value:null},invSize:{value:new nn(.5,.5)},direction:{value:new nn(.5,.5)},gaussianCoefficients:{value:t}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 invSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float gaussianCoefficients[KERNEL_RADIUS];\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tfloat weightSum = gaussianCoefficients[0];\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianCoefficients[i];\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})}getCompositeMaterial(e){return new Gr({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}"})}}Id.BlurDirectionX=new nn(1,0),Id.BlurDirectionY=new nn(0,1);const xd="backgroundTexture",yd=`\n uniform sampler2D ${xd};\n uniform sampler2D bloomTexture;\n uniform sampler2D objectMaskTexture;\n\n varying vec2 vUv;\n\n void main() {\n gl_FragColor = texture2D( ${xd}, vUv );\n gl_FragColor.rgb += texture2D( bloomTexture, vUv ).rgb * texture2D( objectMaskTexture, vUv ).a;\n }\n`;class Md extends fd{constructor(e,t){super(new Gr({uniforms:{[xd]:{value:null},bloomTexture:{value:e},objectMaskTexture:{value:t}},vertexShader:"\n varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n",fragmentShader:yd}),xd)}}var wd,Sd,Bd,Td,Rd,Dd,Qd,Ld,Ud,Pd,Nd,Fd,Od,kd,Gd,Hd,zd,Vd;const Wd="neverDarken",qd="shadowObject";class jd{constructor(e,t){wd.set(this,void 0),Sd.set(this,void 0),Bd.set(this,!1),Td.set(this,.25),Rd.set(this,0),Dd.set(this,2),Qd.set(this,null),Ld.set(this,null),Ud.set(this,null),Pd.set(this,null),Nd.set(this,null),Fd.set(this,null),Od.set(this,null),kd.set(this,null),Gd.set(this,null),Hd.set(this,{}),zd.set(this,null),Vd.set(this,new Ki),z(this,wd,e),z(this,Sd,t)}set strength(e){z(this,Td,e),null!=H(this,Ud,"f")&&(H(this,Ud,"f").strength=H(this,Td,"f"))}set radius(e){z(this,Rd,e),null!=H(this,Ud,"f")&&(H(this,Ud,"f").radius=H(this,Rd,"f"))}set threshold(e){z(this,Dd,e),null!=H(this,Ud,"f")&&(H(this,Ud,"f").threshold=H(this,Dd,"f"))}init(){H(this,Bd,"f")||(z(this,Qd,new vd(Ku())),z(this,Ld,new Cd(H(this,wd,"f"),H(this,Sd,"f"))),H(this,Ld,"f").clearColor=new Ki(0),H(this,Ld,"f").clearAlpha=0,H(this,Qd,"f").addPass(H(this,Ld,"f")),z(this,Ud,new Id(new nn(256,256),H(this,Td,"f"),H(this,Rd,"f"),H(this,Dd,"f"))),H(this,Qd,"f").addPass(H(this,Ud,"f")),z(this,Pd,new bd),H(this,Pd,"f").needsSwap=!1,H(this,Qd,"f").addPass(H(this,Pd,"f")),H(this,Qd,"f").renderToScreen=!1,z(this,kd,new vd(Ku())),z(this,Gd,new Cd(H(this,wd,"f"),H(this,Sd,"f"))),H(this,kd,"f").addPass(H(this,Gd,"f")),H(this,kd,"f").renderToScreen=!1,z(this,Nd,new vd(Ku())),z(this,Fd,new Cd(H(this,wd,"f"),H(this,Sd,"f"))),H(this,Nd,"f").addPass(H(this,Fd,"f")),z(this,Od,new Md(H(this,Qd,"f").renderTarget1.texture,H(this,kd,"f").renderTarget2.texture)),H(this,Nd,"f").addPass(H(this,Od,"f")),z(this,zd,new er({color:0})),z(this,Bd,!0))}destroy(){H(this,Bd,"f")&&(H(this,zd,"f").dispose(),z(this,zd,null),H(this,Od,"f").dispose(),z(this,Od,null),H(this,Fd,"f").dispose(),z(this,Fd,null),H(this,Nd,"f").dispose(),z(this,Nd,null),H(this,Gd,"f").dispose(),z(this,Gd,null),H(this,kd,"f").dispose(),z(this,kd,null),H(this,Pd,"f").dispose(),z(this,Pd,null),H(this,Ud,"f").dispose(),z(this,Ud,null),H(this,Ld,"f").dispose(),z(this,Ld,null),H(this,Qd,"f").dispose(),z(this,Qd,null),z(this,Bd,!1))}setSize(e,t){null!=H(this,Qd,"f")&&null!=H(this,kd,"f")&&null!=H(this,Nd,"f")&&(H(this,Qd,"f").setSize(e,t),H(this,kd,"f").setSize(e,t),H(this,Nd,"f").setSize(e,t))}render(){null!=H(this,Qd,"f")&&null!=H(this,kd,"f")&&null!=H(this,Gd,"f")&&null!=H(this,Nd,"f")&&null!=H(this,Fd,"f")&&(H(this,Qd,"f").render(),this.darkenMaterials(),this.hideShadow(),H(this,Gd,"f").clearColor=Ku().getClearColor(H(this,Vd,"f")),H(this,Gd,"f").clearAlpha=Ku().getClearAlpha(),H(this,kd,"f").render(),this.showShadow(),H(this,Fd,"f").clearColor=Ku().getClearColor(H(this,Vd,"f")),H(this,Fd,"f").clearAlpha=Ku().getClearAlpha(),H(this,Nd,"f").render(),this.restoreDarkenedMaterials())}hideShadow(){H(this,wd,"f").traverse(e=>{e instanceof Lr&&e.material.userData[qd]&&(e.visible=!1)})}showShadow(){H(this,wd,"f").traverse(e=>{e instanceof Lr&&e.material.userData[qd]&&(e.visible=!0)})}onSceneUpdate(){Ku().renderCubeMapNormals(H(this,wd,"f"))}darkenMaterials(){H(this,wd,"f").traverse(e=>{if(e instanceof Lr){if(e.material.userData[Wd])return;H(this,Hd,"f")[e.uuid]=e.material,e.material=H(this,zd,"f")}})}restoreDarkenedMaterials(){H(this,wd,"f").traverse(e=>{if(e instanceof Lr){if(e.material!==H(this,zd,"f"))return;e.material=H(this,Hd,"f")[e.uuid],delete H(this,Hd,"f")[e.uuid]}})}}var Yd,Xd,Kd,Jd,Zd,$d;wd=new WeakMap,Sd=new WeakMap,Bd=new WeakMap,Td=new WeakMap,Rd=new WeakMap,Dd=new WeakMap,Qd=new WeakMap,Ld=new WeakMap,Ud=new WeakMap,Pd=new WeakMap,Nd=new WeakMap,Fd=new WeakMap,Od=new WeakMap,kd=new WeakMap,Gd=new WeakMap,Hd=new WeakMap,zd=new WeakMap,Vd=new WeakMap,($d=Zd||(Zd={}))[$d.Direct=0]="Direct",$d[$d.Postprocessed=1]="Postprocessed";class ep{constructor(e,t){Yd.set(this,void 0),Xd.set(this,void 0),Kd.set(this,Zd.Direct),Jd.set(this,void 0),z(this,Yd,e),z(this,Xd,t),z(this,Jd,new jd(H(this,Yd,"f"),H(this,Xd,"f")))}get bloomEnabled(){return H(this,Kd,"f")===Zd.Postprocessed}set bloomEnabled(e){e?(H(this,Jd,"f").init(),z(this,Kd,Zd.Postprocessed)):(H(this,Jd,"f").destroy(),z(this,Kd,Zd.Direct))}set bloomStrength(e){H(this,Jd,"f").strength=e}set bloomRadius(e){H(this,Jd,"f").radius=e}set bloomThreshold(e){H(this,Jd,"f").threshold=e}dispose(){H(this,Jd,"f").destroy(),z(this,Kd,Zd.Direct)}setSize(e,t){H(this,Jd,"f").setSize(e,t)}render(){H(this,Kd,"f")===Zd.Direct?Ku().render(H(this,Yd,"f"),H(this,Xd,"f")):H(this,Kd,"f")===Zd.Postprocessed&&H(this,Jd,"f").render()}}Yd=new WeakMap,Xd=new WeakMap,Kd=new WeakMap,Jd=new WeakMap;const tp={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"},np={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"};let ip,rp,ap,op=!1;const sp=300,lp=2*Math.PI/32,cp=he("hold"),hp=he("sine"),Ap=he("sine-in"),up=he("sine-out");function dp(){let e=!0,t=!1,n=null,i=null,r=null;return{get custom(){return t},set:e=>{const{theta:a,phi:o,fov:s}=e;n=a,i=o,r=s,t=null!=a||null!=o||null!=s},reset:e=>{var a;t?(null==n||n.reset(),null==i||i.reset(),null==r||r.reset()):(n=$([{time:0,value:a=e,interpolation:cp},{time:sp,value:a,interpolation:up},{time:800,value:a+lp,interpolation:hp},{time:1800,value:a-lp,interpolation:Ap},{time:2300,value:a,interpolation:cp},{time:4300,value:a,interpolation:cp}]),i=null,r=null)},get running(){return e},set running(t){e=t},update:t=>{e&&(null==n||n.update(t),null==i||i.update(t),null==r||r.update(t))},get theta(){return null==n?void 0:n.get()},get phi(){return null==i?void 0:i.get()},get fov(){return null==r?void 0:r.get()}}}var pp;!function(e){e[e.NONE=0]="NONE",e[e.USER_INTERACTION=1]="USER_INTERACTION",e[e.AUTOMATIC=2]="AUTOMATIC"}(pp||(pp={}));const fp="pan-y",gp=1e-6,mp=.03,vp=Math.PI/8,Ep=new Rn;class bp extends zt{constructor(e,t){super(),this.touchAction_=fp,this.enablePan=!0,this.screenSpacePanning=!0,this.enableZoom_=!0,this.enableKeyControls=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.defaultFov=16,this.minFovFactor=.2,this.maxFovFactor=1.6,this.minFov=this.defaultFov*this.minFovFactor,this.maxFov=this.defaultFov*this.maxFovFactor,this.fovMultiplier_=1,this.enableDamping=!0,this.dampingFactor=.3,this.interactionEnabled=!1,this.userInteracted=!1,this.target=new Rn,this.panSphereCenter=new Rn,this.panSphereRadius=1/0,this.spherical=new Wc,this.goalSpherical=new Wc,this.fov=this.defaultFov,this.goalFov=this.defaultFov,this.panOffset=new Rn,this.lastPosition=new Rn,this.lastQuaternion=new Tn,this.lastTargetPosition=new Rn,this.lastFov=this.fov,this.changeSource=pp.NONE,this.panInProgress=!1,this.touchMode=null,this.pointers=[],this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.passiveTouchHandler=()=>{},this.atMaxZoom_=!1,this.atMinZoom_=!1,this.onMaxZoomEnter=null,this.onMaxZoomLeave=null,this.onMinZoomEnter=null,this.onMinZoomLeave=null,this.atMinVerticalAngle_=!1,this.atMaxVerticalAngle_=!1,this.onMinVerticalAngleEnter=null,this.onMinVerticalAngleLeave=null,this.onMaxVerticalAngleEnter=null,this.onMaxVerticalAngleLeave=null,this.onPointerDown=e=>{if(this.pointers.length>2)return;const{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);try{t.setPointerCapture(e.pointerId)}catch(e){}this.pointers.push({clientX:e.clientX,clientY:e.clientY,id:e.pointerId}),"touch"===e.pointerType?(this.changeSource=e.altKey?pp.AUTOMATIC:pp.USER_INTERACTION,this.onTouchChange()):(this.changeSource=pp.USER_INTERACTION,this.onMouseDown(e))},this.onPointerMove=e=>{const 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);const n=this.pointers.length,i=(e.clientX-t.clientX)/n,r=(e.clientY-t.clientY)/n;0===i&&0===r||(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?pp.AUTOMATIC:pp.USER_INTERACTION,null!==this.touchMode&&this.touchMode(i,r)):(this.changeSource=pp.USER_INTERACTION,this.panInProgress?this.pan(i,r):this.handleSinglePointerMove(i,r)))},this.onPointerUp=e=>{const t=this.pointers.findIndex(t=>t.id===e.pointerId);-1!==t&&this.pointers.splice(t,1);const{element:n}=this;0===this.pointers.length?(n.removeEventListener("pointermove",this.onPointerMove),n.removeEventListener("pointerup",this.onPointerUp),n.removeEventListener("touchmove",this.disableScroll)):null!==this.touchMode&&this.onTouchChange(),n.style.cursor="grab",this.panInProgress=!1},this.onWheel=e=>{this.changeSource=pp.USER_INTERACTION;const t=e.deltaY*(1==e.deltaMode?18:1)*.2/30;this.userAdjustOrbit(0,0,t),e.preventDefault()},this.onKeyDown=e=>{const{changeSource:t}=this;this.changeSource=pp.USER_INTERACTION,(e.shiftKey&&this.enablePan?this.panKeyCodeHandler(e):this.orbitZoomKeyCodeHandler(e))?e.preventDefault():this.changeSource=t},this.disableScroll=e=>{e.preventDefault()},this.onContext=e=>{if(this.enablePan)e.preventDefault();else for(const e of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:e.id})))},this.onTouchChange=()=>{if(1===this.pointers.length)this.touchMode=this.touchModeRotate;else{if(!this.enableZoom_)return this.touchMode=null,void this.element.removeEventListener("touchmove",this.disableScroll);this.touchMode=this.touchDecided&&null===this.touchMode?null:this.touchModeZoom,this.touchDecided=!0,this.element.addEventListener("touchmove",this.disableScroll,{passive:!1}),this.lastSeparation=_p(this.pointers[0],this.pointers[1]),this.enablePan&&null!=this.touchMode&&this.initializePan()}},this.onMouseDown=e=>{this.panInProgress=!1,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&this.initializePan(),this.element.style.cursor="grabbing"},this.touchModeZoom=(e,t)=>{if(this.enableZoom_){const e=_p(this.pointers[0],this.pointers[1]),t=.2*(this.lastSeparation-e)*35/this.element.clientHeight;this.lastSeparation=e,this.userAdjustOrbit(0,0,t)}this.panInProgress&&this.pan(e,t)},this.touchModeRotate=(e,t)=>{if(!this.touchDecided){this.touchDecided=!0;const n=Math.abs(e),i=Math.abs(t),r="pan-x"===this.touchAction_&&n>i,a="pan-y"===this.touchAction_&&i>n;if(this.changeSource===pp.USER_INTERACTION&&(r||a))return void(this.touchMode=null);this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(e,t)},this.camera=e,this.element=t,this.quat=(new Tn).setFromUnitVectors(e.up,new Rn(0,1,0)),this.quatInverse=this.quat.clone().invert(),this.update(0)}set touchAction(e){this.touchAction_=null!=e?e:fp,this.updateTouchActionStyle()}set enableZoom(e){this.enableZoom_!=e&&(this.enableZoom_=e,e?this.element.addEventListener("wheel",this.onWheel):this.element.removeEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}set minZoom(e){this.maxFovFactor=null!=e?1/e:1.6,this.maxFov=this.defaultFov*this.fovMultiplier_*this.maxFovFactor,this.fov=Cp(this.fov,this.minFov,this.maxFov),this.goalFov=Cp(this.goalFov,this.minFov,this.maxFov)}set maxZoom(e){this.minFovFactor=null!=e?1/e:.2,this.minFov=this.defaultFov*this.fovMultiplier_*this.minFovFactor,this.fov=Cp(this.fov,this.minFov,this.maxFov),this.goalFov=Cp(this.goalFov,this.minFov,this.maxFov)}set fovMultiplier(e){this.fovMultiplier_=e,this.fov=this.defaultFov*this.fovMultiplier_,this.goalFov=this.fov,this.minFov=this.fov*this.minFovFactor,this.maxFov=this.fov*this.maxFovFactor}reset(e,t,n,i,r){i||(this.fov=this.defaultFov*this.fovMultiplier_,this.goalFov=this.fov,this.minFov=this.fov*this.minFovFactor,this.maxFov=this.fov*this.maxFovFactor,this.camera.fov=this.camera.aspect<1?2*Math.atan(Math.tan(this.fov/2*$t)/this.camera.aspect)*en:this.fov,this.camera.updateProjectionMatrix()),r?Ep.copy(this.target).sub(this.panSphereCenter).divideScalar(this.panSphereRadius):Ep.set(0,0,0),this.panSphereCenter.set(e.x,e.y,e.z);const a=t/Math.tan(this.defaultFov/2*$t);this.panSphereRadius=Math.min(t,a-t),Ep.multiplyScalar(this.panSphereRadius);const o=e.clone().addScaledVector(n,a).add(Ep);this.camera.position.set(o.x,o.y,o.z),this.target.set(e.x,e.y,e.z).add(Ep),this.camera.lookAt(this.target),Ep.copy(this.camera.position).sub(this.target),Ep.applyQuaternion(this.quat),this.spherical.setFromVector3(Ep),this.goalSpherical.copy(this.spherical),this.lastPosition.copy(this.camera.position),this.lastQuaternion.copy(this.camera.quaternion),this.lastTargetPosition.copy(this.target),this.lastFov=this.fov,this.userInteracted=!1}hasUserInteracted(){return this.userInteracted}update(e){this.spherical.theta+=(this.goalSpherical.theta-this.spherical.theta)*Math.min(mp*e,1),this.spherical.phi+=(this.goalSpherical.phi-this.spherical.phi)*Math.min(mp*e,1),this.spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this.spherical.phi)),this.spherical.makeSafe(),!0===this.enableDamping?this.target.addScaledVector(this.panOffset,this.dampingFactor):this.target.add(this.panOffset),this.target.sub(this.panSphereCenter),this.target.clampLength(0,this.panSphereRadius),this.target.add(this.panSphereCenter),Ep.setFromSpherical(this.spherical),Ep.applyQuaternion(this.quatInverse),this.camera.position.copy(this.target).add(Ep),this.camera.lookAt(this.target),this.fov+=(this.goalFov-this.fov)*Math.min(mp*e,1),this.fov=Cp(this.fov,this.minFov,this.maxFov),!0===this.enableDamping?this.panOffset.multiplyScalar(1-this.dampingFactor):this.panOffset.set(0,0,0),this.checkZoomLimits(),this.checkVerticalAngleLimits();let t=!1;const{aspect:n}=this.camera,i=this.element.clientWidth/this.element.clientHeight;i!==n&&(this.camera.aspect=i,t=!0);const r=Math.abs(this.lastFov-this.fov)>gp;return(t||r)&&(this.camera.fov=this.camera.aspect<1?2*Math.atan(Math.tan(this.fov/2*$t)/this.camera.aspect)*en:this.fov),this.camera.updateProjectionMatrix(),(this.lastPosition.distanceToSquared(this.camera.position)>gp||8*(1-this.lastQuaternion.dot(this.camera.quaternion))>gp||this.lastTargetPosition.distanceToSquared(this.target)>0||r)&&(this.dispatchEvent({type:"change"}),this.lastPosition.copy(this.camera.position),this.lastQuaternion.copy(this.camera.quaternion),this.lastTargetPosition.copy(this.target),this.lastFov=this.fov,t=!0),this.userInteracted=!1,t}getPose(e){return e.copy(this.camera.position),e.sub(this.target),e.normalize(),e}getTheta(){const e=this.camera.position;return Ep.copy(e).sub(this.target),Ep.applyQuaternion(this.quat),this.spherical.setFromVector3(Ep),this.spherical.theta}adjustZoom(e){this.enableZoom_&&(this.goalFov=Cp(this.goalFov*Math.pow(2,-e),this.minFov,this.maxFov),this.userInteracted=!0)}adjustOrbit(e,t){this.goalSpherical.theta+=e,this.goalSpherical.phi+=t,this.goalSpherical.makeSafe(),this.userInteracted=!0}set(e,t,n){return null!=e&&this.setTheta(e),null!=t&&this.setPhi(t),null!=n&&this.setFovRadians(n),null!=e||null!=t||null!=n}setTheta(e){const t=this.camera.position;Ep.copy(t).sub(this.target),Ep.applyQuaternion(this.quat),this.spherical.setFromVector3(Ep),this.spherical.theta=e,this.spherical.makeSafe(),this.goalSpherical.copy(this.spherical),this.target.sub(this.panSphereCenter),this.target.clampLength(0,this.panSphereRadius),this.target.add(this.panSphereCenter),Ep.setFromSpherical(this.spherical),Ep.applyQuaternion(this.quatInverse),t.copy(this.target).add(Ep),this.camera.lookAt(this.target),this.lastPosition.copy(t),this.lastQuaternion.copy(this.camera.quaternion),this.camera.updateProjectionMatrix()}setPhi(e){const t=this.camera.position;Ep.copy(t).sub(this.target),Ep.applyQuaternion(this.quat),this.spherical.setFromVector3(Ep),this.spherical.phi=e,this.spherical.makeSafe(),this.goalSpherical.copy(this.spherical),this.target.sub(this.panSphereCenter),this.target.clampLength(0,this.panSphereRadius),this.target.add(this.panSphereCenter),Ep.setFromSpherical(this.spherical),Ep.applyQuaternion(this.quatInverse),t.copy(this.target).add(Ep),this.camera.lookAt(this.target),this.lastPosition.copy(t),this.lastQuaternion.copy(this.camera.quaternion),this.camera.updateProjectionMatrix()}setFovRadians(e){this.fov=Cp(e*this.fovMultiplier_*en,this.minFov,this.maxFov),this.goalFov=this.fov,this.camera.fov=this.camera.aspect<1?2*Math.atan(Math.tan(this.fov/2*$t)/this.camera.aspect)*en:this.fov,this.lastFov=this.fov}setInteractionEnabled(e){e?this.enableInteraction():this.disableInteraction()}enableInteraction(){if(!1===this.interactionEnabled){const{element:e}=this;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointercancel",this.onPointerUp),this.enableZoom_&&e.addEventListener("wheel",this.onWheel),this.enableKeyControls&&(e.tabIndex=1,e.addEventListener("keydown",this.onKeyDown)),e.addEventListener("touchmove",this.passiveTouchHandler,{passive:!1}),e.addEventListener("contextmenu",this.onContext),e.style.cursor="grab",this.interactionEnabled=!0,this.updateTouchActionStyle()}}disableInteraction(){if(!0===this.interactionEnabled){const{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.tabIndex=-1,e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("touchmove",this.passiveTouchHandler),e.removeEventListener("touchmove",this.disableScroll),e.removeEventListener("contextmenu",this.onContext),e.style.cursor="",this.touchMode=null,this.interactionEnabled=!1,this.updateTouchActionStyle()}}dispose(){this.disableInteraction(),this.pointers.length=0}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,.2);break;case"PageDown":this.userAdjustOrbit(0,0,-.2);break;case"ArrowUp":this.userAdjustOrbit(0,-vp,0);break;case"ArrowDown":this.userAdjustOrbit(0,vp,0);break;case"ArrowLeft":this.userAdjustOrbit(-vp,0,0);break;case"ArrowRight":this.userAdjustOrbit(vp,0,0);break;default:t=!1}return t}panKeyCodeHandler(e){this.initializePan();let t=!0;switch(e.key){case"ArrowUp":this.pan(0,10);break;case"ArrowDown":this.pan(0,-10);break;case"ArrowLeft":this.pan(10,0);break;case"ArrowRight":this.pan(-10,0);break;default:t=!1}return t}initializePan(){this.panInProgress=!0}pan(e,t){const n=this.element,i=this.camera.position;Ep.copy(i).sub(this.target);let r=Ep.length();r*=Math.tan(this.camera.fov/2*Math.PI/180),this.panLeft(2*e*r/n.clientHeight,this.camera.matrix),this.panUp(2*t*r/n.clientHeight,this.camera.matrix)}panLeft(e,t){Ep.setFromMatrixColumn(t,0),Ep.multiplyScalar(-e),this.panOffset.add(Ep)}panUp(e,t){!0===this.screenSpacePanning?Ep.setFromMatrixColumn(t,1):(Ep.setFromMatrixColumn(t,0),Ep.crossVectors(this.camera.up,Ep)),Ep.multiplyScalar(e),this.panOffset.add(Ep)}handleSinglePointerMove(e,t){const n=this.pixelLengthToSphericalAngle(e),i=this.pixelLengthToSphericalAngle(t);this.userAdjustOrbit(n,i,0)}userAdjustOrbit(e,t,n){this.goalSpherical.theta+=.5*e*this.fovMultiplier_,this.goalSpherical.phi+=.5*t*this.fovMultiplier_,this.goalSpherical.makeSafe();const i=Cp(Math.pow(Math.sqrt(this.fov)+n,2),this.minFov,this.maxFov);this.fov=i,this.goalFov=i,this.userInteracted=!0}pixelLengthToSphericalAngle(e){return-2*Math.PI*e/Math.min(this.element.clientHeight,this.element.clientWidth)}checkZoomLimits(){var e,t,n,i;const r=this.goalFov<=this.minFov+gp,a=this.goalFov>=this.maxFov-gp;r!==this.atMaxZoom_&&(this.atMaxZoom_=r,r?null===(e=this.onMaxZoomEnter)||void 0===e||e.call(this):null===(t=this.onMaxZoomLeave)||void 0===t||t.call(this)),a!==this.atMinZoom_&&(this.atMinZoom_=a,a?null===(n=this.onMinZoomEnter)||void 0===n||n.call(this):null===(i=this.onMinZoomLeave)||void 0===i||i.call(this))}checkVerticalAngleLimits(){var e,t,n,i;const r=this.goalSpherical.phi<=this.minPolarAngle+gp,a=this.goalSpherical.phi>=this.maxPolarAngle-gp;r!==this.atMinVerticalAngle_&&(this.atMinVerticalAngle_=r,r?null===(e=this.onMinVerticalAngleEnter)||void 0===e||e.call(this):null===(t=this.onMinVerticalAngleLeave)||void 0===t||t.call(this)),a!==this.atMaxVerticalAngle_&&(this.atMaxVerticalAngle_=a,a?null===(n=this.onMaxVerticalAngleEnter)||void 0===n||n.call(this):null===(i=this.onMaxVerticalAngleLeave)||void 0===i||i.call(this))}updateTouchActionStyle(){const{style:e}=this.element;this.interactionEnabled?this.enableZoom_?e.touchAction=this.touchAction_:e.touchAction="manipulation":e.touchAction=""}}function Cp(e,t,n){return Math.max(t,Math.min(n,e))}function _p(e,t){const{clientX:n,clientY:i}=e,{clientX:r,clientY:a}=t,o=r-n,s=a-i;return Math.sqrt(o*o+s*s)}const Ip=new Map;let xp=null;function yp(){Ku().setAnimationLoop(Mp)}function Mp(e){!function(){for(const e of Ip.values())e.prepareResize()}(),function(e){for(const t of Ip.values())t.update(e)}(e);let t=function(){let e=null;for(const t of Ip.values())if(t.needsRender){if(null!=e)return null;e=t}return e}();null!=xp&&t!==xp&&(xp.ensureBlittedMode(),t=null),xp=t,0!==function(){let e=0;for(const t of Ip.values())t.needsRender&&e++;return e}()&&(null!=t?(t.ensureDirectMode(),wp(),$u(t.width,t.height),Sp()):(function(){for(const e of Ip.values())e.needsRender&&e.ensureBlittedMode()}(),wp(),$u(function(){let e=0;for(const t of Ip.values())t.needsRender&&(e=Math.max(e,t.width));return e}(),function(){let e=0;for(const t of Ip.values())t.needsRender&&(e=Math.max(e,t.height));return e}()),Sp()))}function wp(){for(const e of Ip.values())e.commitResize()}function Sp(){for(const e of Ip.values())e.render()}function Bp(){let e=null,t=null;return{reset:()=>{e=$([{time:0,value:0,interpolation:cp},{time:sp,value:1,interpolation:cp},{time:2300,value:0,interpolation:cp},{time:4300,value:0,interpolation:cp}]),t=$([{time:0,value:0,interpolation:cp},{time:sp,value:0,interpolation:up},{time:800,value:-.05,interpolation:hp},{time:1800,value:.05,interpolation:Ap},{time:2300,value:0,interpolation:cp},{time:4300,value:0,interpolation:cp}])},clear:()=>{e=null,t=null},update:n=>{null==e||e.update(n),null==t||t.update(n)},get visibility(){return null==e?void 0:e.get()},get position(){return null==t?void 0:t.get()}}}const Tp=2e3,Rp=2*Math.PI,Dp=Rp/12,Qp=Rp/60,Lp=Rp/60;function Up(e){return $([{time:0,value:0,interpolation:{type:"bezier",x1:.9,y1:0,x2:.6,y2:1}},{time:Tp,value:e,interpolation:{type:"hold"}}])}function Pp(e,t,n){return-1*Dp*(e%12+t/60+n/3600)}function Np(e,t){return-1*Qp*(e+t/60)}function Fp(e,t){return-1*Lp*(e+t/1e3)}function Op(e,t){let n,i,r,a,o,s,l,c,h,A,u,d,p,f=!1,g=null,m=new Rn(1,0,0),v=!1,E=!1,b=!1,C=!0,_=!1,I=!1,x=4,y=1,M=!0,w=!1,S=null,B=!1,T=!1,R=!1,D=0,Q=0,L=0,U=0,P=0;const N={get paused(){return C},get needsRender(){return!(!f||C)&&_},ensureDirectMode:()=>{e.isDirect()||(_=!0),e.ensureDirectMode()},ensureBlittedMode:()=>{e.isBlitted()||(_=!0),e.ensureBlittedMode()},update:t=>{if(w||!f||C||null==o||!function(e){const t=e.getBoundingClientRect();return t.bottom>0&&t.top<Math.max(document.documentElement.clientHeight,window.innerHeight)&&t.right>0&&t.left<Math.max(document.documentElement.clientWidth,window.innerWidth)}(e.element))return;let n=0!==P?t-P:0;P=t,0===U?_=!0:U<3&&(n=0),U++,B||(a.hasUserInteracted()?(B=!0,u.running=!1,d.clear(),I=!0):(u.update(n),d.update(n),u.running&&a.set(u.theta,u.phi,u.fov)&&(_=!0),null==d.visibility&&null==d.position||(I=!0))),a.update(n)&&(_=!0,T=!0),0!==n&&p.update()&&(_=!0)},render:()=>{if(!w&&f&&!C){if(_){if(Zu(n,e,!E&&!n.bloomEnabled||b?0:1,x,y),_=!1,!R&&null!=S&&T&&B){const e=performance.now();L>0&&(D++,Q+=e-L),L=e,Q>=2e3&&(R=!0,S({fps:D/Q*1e3}))}else L=0;T=!1,null==h||h()}I&&(t.visible=M&&!B,null!=d.visibility&&(t.opacity=`${d.visibility}`),null!=d.position&&(t.transform=`translateX(${d.position*Math.min(e.width,e.height)}px)`),I=!1)}},get width(){return e.element.clientWidth},get height(){return e.element.clientHeight},prepareResize:()=>{const{clientWidth:t,clientHeight:n}=e.element;e.clientWidth=t,e.clientHeight=n,e.dpr=Xu,e.sizeDirty&&(_=!0)},commitResize:()=>{e.commitResize()}},F=(e,t)=>{const n=l.min.clone().add(l.max).divideScalar(2),i=Math.sqrt(function(e,t){let n=0;const i=new Rn;return e.updateWorldMatrix(!0,!0),e.traverseVisible(e=>{const{geometry:r}=e;if(void 0!==r){const{position:a}=r.attributes;if(void 0!==a)for(let r=0,o=a.count;r<o;r++)e.isMesh?e.getVertexPosition(r,i):i.fromBufferAttribute(a,r),e.isSkinnedMesh||i.applyMatrix4(e.matrixWorld),n=t(n,i)}}),n}(e,(e,t)=>Math.max(e,n.distanceToSquared(t))));a.reset(n,i,t?a.getPose(new Rn):m,t,t),null!=u&&(u.reset(a.getTheta()),a.set(u.theta,u.phi,u.fov))},O={init:()=>{f||(function(e,t){Ip.set(e,t),1===Ip.size&&(Ju(),op||(ip=new ws,ip.userData.darkness={value:1},ip.onBeforeCompile=e=>{e.uniforms.darkness=ip.userData.darkness;const t=e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * darkness );");e.fragmentShader=`uniform float darkness;\n${t}`},ip.depthTest=!1,ip.depthWrite=!1,rp=new Gr(tp),rp.depthTest=!1,ap=new Gr(np),ap.depthTest=!1,op=!0))}(e.element,N),i=new Ks,r=new qr(25,1,.5),a=new bp(r,e.element),a.setInteractionEnabled(M),n=new ep(i,r),c=function(e){let t,n,i,r,a,o,s,l,c=!1;function h(e){s.visible=!0,rp.uniforms.tDiffuse.value=t.texture,rp.uniforms.h.value=1*e/256,s.material=rp;const i=Ku();i.setRenderTarget(n),i.render(s,l),ap.uniforms.tDiffuse.value=n.texture,ap.uniforms.v.value=1*e/256,s.material=ap,i.setRenderTarget(t),i.render(s,l),s.visible=!1}return{init:()=>{c||(t=new wn(512,512),t.texture.generateMipmaps=!1,n=new wn(512,512),n.texture.generateMipmaps=!1,i=new Ls,i.position.y=-.7,r=new oa(45,45).rotateX(Math.PI/2),a=new er({map:t.texture,opacity:.5,transparent:!0,depthWrite:!1,userData:{[Wd]:!0,[qd]:!0}}),o=new Lr(r,a),o.renderOrder=1,o.scale.y=-1,i.add(o),s=new Lr(r),s.visible=!1,i.add(s),l=new Ea(-22.5,22.5,22.5,-22.5,0,3),l.rotation.x=Math.PI/2,i.add(l),c=!0)},destroy:()=>{c&&(l=null,s.clear(),s=null,o.clear(),o=null,ad(a),a=null,r.dispose(),r=null,i.clear(),i=null,n.dispose(),n=null,t.dispose(),t=null,c=!1)},get group(){return i},render:()=>{const n=e.background;e.background=null,e.overrideMaterial=ip;const i=Ku(),r=i.getClearAlpha();i.setClearAlpha(0),i.setRenderTarget(t),i.render(e,l),e.overrideMaterial=null,h(1.5),h(.4*1.5),i.setRenderTarget(null),i.setClearAlpha(r),e.background=n}}}(i),c.init(),u=dp(),d=Bp(),p=function(){let e,t,n,i,r=!1,a=null;return{clear:()=>{r=!1,e=void 0,t=void 0,n=void 0,a=null},reset:i=>{r=!0,e=i.getObjectByName("hours"),t=i.getObjectByName("minutes"),n=i.getObjectByName("seconds"),a=function(e,t,n){let i,r,a,o,s=!1,l=!1;return{update:c=>{if(!s){i=new Date(c),i.setMilliseconds(i.getMilliseconds()+Tp);const e=i.getHours(),t=i.getMinutes(),n=i.getSeconds(),l=i.getMilliseconds();r=Up(Pp(e,t,n)),a=Up(Np(t,n)),o=Up(Fp(n,l)),s=!0}if(l)return;const h=i.getTime()-c.getTime(),A=Tp-h;h<=0?l=!0:(null!=e&&(r.seek(A),e.rotation.y=r.get()),null!=t&&(a.seek(A),t.rotation.y=a.get()),null!=n&&(o.seek(A),n.rotation.y=o.get()))},get done(){return l}}}(e,t,n)},update:()=>{if(!r)return!1;const o=new Date;if(null==i&&(i=new Date),null!=a){if(a.update(o),!a.done)return i=o,!0;a=null}if(Math.abs(o.getTime()-i.getTime())<125)return!1;const s=o.getHours(),l=o.getMinutes(),c=o.getSeconds(),h=o.getMilliseconds();return null!=e&&(e.rotation.y=Pp(s,l,c)),null!=t&&(t.rotation.y=Np(l,c)),null!=n&&(n.rotation.y=Fp(c,h)),i=o,!0}}}(),f=!0)},destroy:()=>{var t;f&&(null===(t=i.environment)||void 0===t||t.dispose(),i.environment=null,p=null,d=null,u=null,c.destroy(),c=null,n.dispose(),n=null,null!=A&&a.removeEventListener("change",A),A=null,a.dispose(),a=null,r=null,cd(i),i=null,function(e){Ip.delete(e),0===Ip.size&&(op&&(ad(ap),ap=null,ad(rp),rp=null,ad(ip),ip=null,op=!1),xp=null,qu&&(Vu.dispose(),Vu=null,Wu=null,ju=1,Yu=1,Xu=1,qu=!1))}(e.element),f=!1)},set gltfScene(e){o=e,cd(i),null!=o&&(i.add(o),this.isDiamondScene&&ed(o,s),l=(new Ln).setFromObject(o),c.group.position.y=l.min.y-0,i.add(c.group),c.render(),E=function(e){let t=!1;return e.traverse(e=>{if(!t&&e instanceof Lr){const n=e.material;Array.isArray(n)?n.forEach(e=>{e.transmission>0&&(t=!0)}):n.transmission>0&&(t=!0)}}),t}(i),F(o,v&&B),u.reset(a.getTheta()),d.reset(),p.clear(),"Watches"===g&&p.reset(o),C||yp()),U=0,_=!0},get isDiamondScene(){var e;return!!(null===(e=null==o?void 0:o.userData)||void 0===e?void 0:e.isDiamondScene)},set environment(e){var t;null===(t=i.environment)||void 0===t||t.dispose(),i.environment=e},set diamondEnvironment(e){s=e,this.isDiamondScene&&null!=o&&ed(o,e)},set environmentRotation(e){i.environmentRotation.y=e*Math.PI/180,_=!0},updateOnce:e=>{f&&!C&&(B||(u.update(e),u.running&&a.set(u.theta,u.phi,u.fov)&&(_=!0)),0!==e&&p.update()&&(_=!0))},renderOnce:()=>{N.prepareResize(),N.ensureBlittedMode(),N.commitResize(),$u(N.width,N.height),B||a.set(u.theta,u.phi,u.fov),Zu(n,e,!E&&!n.bloomEnabled||b?0:1,x,y),null==h||h()},get category(){return g},set category(e){g=e},set initialPose(e){m=e},set toneMapping(e){const t={ACES:4,Linear:1,Neutral:7};null!=t[e]&&(x=t[e]),_=!0},set toneMappingExposure(e){y=e,_=!0},set paused(e){e?(C=!0,a.setInteractionEnabled(!1),function(){for(const{paused:e}of Ip.values())if(!e)return!1;return!0}()&&Ku().setAnimationLoop(null),t.opacity="0",t.visible=!1):(C=!1,a.setInteractionEnabled(M),null!=o&&(F(o,!1),_=!0,yp()),P=0)},set interactive(e){M=e,a.setInteractionEnabled(e)},set touchAction(e){a.touchAction=e},set zoomEnabled(e){a.enableZoom=e},set minZoom(e){a.minZoom=e},set maxZoom(e){a.maxZoom=e},set preserveCameraOnReload(e){v=e},set forcedTransparency(e){b=e,_=!0},set defaultFov(e){a.defaultFov=e},set fovMultiplier(e){a.fovMultiplier=e,_=!0},set bloomEnabled(e){n.bloomEnabled=e,_=!0},set bloomStrength(e){n.bloomStrength=e,_=!0},set bloomRadius(e){n.bloomRadius=e,_=!0},set bloomThreshold(e){n.bloomThreshold=e,_=!0},set nonLiveRendering(e){w=e},set onRendered(e){h=e},set onInteracted(e){null!=A&&a.removeEventListener("change",A),A=e,null!=e&&a.addEventListener("change",e)},set onInteractionPerf(e){S=e},set onMaxZoomEnter(e){a.onMaxZoomEnter=e},set onMaxZoomLeave(e){a.onMaxZoomLeave=e},set onMinZoomEnter(e){a.onMinZoomEnter=e},set onMinZoomLeave(e){a.onMinZoomLeave=e},set onMinVerticalAngleEnter(e){a.onMinVerticalAngleEnter=e},set onMinVerticalAngleLeave(e){a.onMinVerticalAngleLeave=e},set onMaxVerticalAngleEnter(e){a.onMaxVerticalAngleEnter=e},set onMaxVerticalAngleLeave(e){a.onMaxVerticalAngleLeave=e},zoomBy:e=>{f&&!C&&(a.adjustZoom(e),_=!0)},rotateBy:(e,t)=>{f&&!C&&(a.adjustOrbit(-e*Math.PI/180,t*Math.PI/180),_=!0)},setAnimationConfig:e=>{u.set(e),null!=o&&F(o,!0),u.custom||(u.reset(a.getTheta()),d.reset()),_=!0}};return O}function kp(e){return t=>G(this,void 0,void 0,function*(){try{yield t()}catch(t){e(t)}})}const Gp={initialized:!1,paused:!1,posterUrl:null,glbUrl:null,envUrl:null,diamondEnvUrl:null,envRotation:null,toneMapping:null,toneMappingExposure:null,bloomEnabled:null,bloomStrength:null,bloomRadius:null,bloomThreshold:null,category:null,glbLocal:!1,interactive:!1,touchAction:null,zoomEnabled:!1,minZoom:null,maxZoom:null,preserveCameraOnReload:!1,alwaysTransparentBackground:!1,defaultFov:null,fovMultiplier:null,defaultCameraPositions:null,interactionPromptUrl:null,interactionPromptSize:null,nonLiveRendering:null,baseUrl:null,downloadCacheEnabled:!1,onModelLoaded:null,onRendered:null,onInteracted:null,onInteractionPerf:null,onMaxZoomEnter:null,onMaxZoomLeave:null,onMinZoomEnter:null,onMinZoomLeave:null,onMinVerticalAngleEnter:null,onMinVerticalAngleLeave:null,onMaxVerticalAngleEnter:null,onMaxVerticalAngleLeave:null,animation:null,thetaAnimation:null,phiAnimation:null,fovAnimation:null};function Hp(e,t){const n=e,i=t,r=Op(i.canvasWrapper,i.prompt),a=function(){const e=Object.assign({},Kc);return{set vectors(t){for(const i of Object.keys(e)){if(!Xc(i))continue;const r=null==t?void 0:t[i];e[i]=null!=r?new Rn((n=r)[0],n[1],n[2]):Kc[i]}var n},getVector:t=>{var n;return(null==t?e.Glasses:null!==(n=e[t])&&void 0!==n?n:e.Glasses).normalize()}}}();let o=()=>{};const s=[],l=new wh;let c,h,A,u,d,p,f,g,m,v,E,b,C,_,I,x;l.setOnProgress(e=>{i.loading.progress=e,e>0&&(i.loading.visible=!0)});const y=function(){const e=Object.keys(Gp).reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:0}),{});return t=>{const n=++e[t];return()=>n!==e[t]}}(),M=function(){const e=Object.keys(Gp).reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:!1}),{});return{lock:t=>{e[t]=!0},unlock:t=>{e[t]=!1},anyLocked:()=>Object.values(e).some(e=>e),locks_:e}}(),w=function(e,t){return n=>{t.length>0?(t.forEach(e=>e.reject(n)),t.length=0):e.onError?e.onError(n):console.error(n)}}(n,s),S=function(e,t){return(n,i)=>G(this,void 0,void 0,function*(){const r=kp(t),a=function(e,t){const n=e(t);return e=>G(this,void 0,void 0,function*(){yield e(n)})}(e,n);yield r(()=>a(i))})}(y,w),B=function(e,t,n,i){return(r,a)=>G(this,void 0,void 0,function*(){const o=function(e,t){return n=>G(this,void 0,void 0,function*(){e.lock(t),yield n(),e.unlock(t)})}(e,r),s=kp(i),l=function(e,t,n,i){const r=t(i);return t=>G(this,void 0,void 0,function*(){yield Promise.resolve(),r()||(yield t(r))&&(e.unlock(i),e.anyLocked()||n())})}(e,t,n,r);yield o(()=>s(()=>l(a)))})}(M,y,()=>{void 0!==E&&(r.category=E,r.initialPose=a.getVector(null!=E?E:Jc)),void 0!==c&&(r.gltfScene=c),void 0!==h&&(r.environment=h),void 0!==A&&(r.diamondEnvironment=A),void 0!==u&&(r.environmentRotation=null!=u?u:0),void 0!==f&&(r.bloomEnabled=null!=f&&f),void 0!==g&&(r.bloomStrength=null!=g?g:.25),void 0!==m&&(r.bloomRadius=null!=m?m:0),void 0!==v&&(r.bloomThreshold=null!=v?v:2),null==o||o(),void 0!==x&&r.setAnimationConfig(x),void 0!==d&&(r.toneMapping=null!=d?d:"Neutral"),void 0!==p&&(r.toneMappingExposure=null!=p?p:1),void 0!==b&&(r.forcedTransparency=b),void 0!==C&&(r.onRendered=C),void 0!==_&&(r.onInteracted=_),void 0!==I&&(r.onInteractionPerf=I),r.renderOnce(),i.canvasVisible=!0,i.posterVisible=!1,i.loading.visible=!1,s.forEach(e=>e.resolve()),s.length=0,c=void 0,h=void 0,A=void 0,d=void 0,p=void 0,E=void 0,b=void 0,C=void 0,_=void 0,I=void 0},w);return n.onInitializedChange=e=>S("initialized",t=>G(this,void 0,void 0,function*(){e?(r.init(),r.paused=n.paused):r.destroy()})),n.onPausedChange=e=>S("paused",t=>G(this,void 0,void 0,function*(){r.paused=e})),n.onPosterUrlChange=e=>S("posterUrl",t=>G(this,void 0,void 0,function*(){i.loadPoster(e),i.posterVisible=M.anyLocked(),i.canvasVisible=!M.anyLocked()})),n.onGlbUrlChange=t=>B("glbUrl",r=>G(this,void 0,void 0,function*(){if(r()||!n.initialized)return!1;if(null!=t)if(rd(),"string"==typeof t){null!=n.posterUrl&&(i.posterVisible=!0,i.canvasVisible=!1);const a=255,o=zp(e.glbLocal)?new Uint8Array(yield bh(t,l,n.downloadCacheEnabled)):yield Ch(t,(new Date).getTime()+a,Math.random()*a,l,n.downloadCacheEnabled);if(r()||!n.initialized)return!1;const s=yield id(o);if(r()||!n.initialized)return!1;c=s.scene}else{const i=255,a=zp(e.glbLocal,"left")?bh(t.left,l,n.downloadCacheEnabled).then(e=>new Uint8Array(e)):Ch(t.left,(new Date).getTime()+i,Math.random()*i,l,n.downloadCacheEnabled),o=zp(e.glbLocal,"right")?bh(t.right,l,n.downloadCacheEnabled).then(e=>new Uint8Array(e)):Ch(t.right,(new Date).getTime()+i,Math.random()*i,l,n.downloadCacheEnabled),s=yield a;if(r()||!n.initialized)return!1;const h=yield o;if(r()||!n.initialized)return!1;const A=(yield id(s)).scene;if(r()||!n.initialized)return!1;const u=(yield id(h)).scene;if(r()||!n.initialized)return!1;c=function(e,t){const n=new Ls,i=ld(e).getSize(new Rn),r=ld(t).getSize(new Rn),a=.075*Math.max(i.z,r.z),o=od(e,a,!1,void 0,new Tn(0,0,0,1));e.position.set(o.x,o.y,o.z);const s=od(t,a,!0,void 0,new Tn(0,0,0,1));return t.position.set(s.x,s.y,s.z),n.add(e,t),n}(A,u)}else c=null;return!0})),n.onEnvUrlChange=e=>B("envUrl",t=>G(this,void 0,void 0,function*(){if(t()||!n.initialized)return!1;if(null!=e){const i=yield bh(e,l,n.downloadCacheEnabled);if(t()||!n.initialized)return!1;h=oA(i)}else h=null;return!0})),n.onDiamondEnvUrlChange=e=>B("diamondEnvUrl",t=>G(this,void 0,void 0,function*(){if(t()||!n.initialized)return!1;if(null!=e){const i=yield bh(e,l,n.downloadCacheEnabled);if(t()||!n.initialized)return!1;A=oA(i)}else A=null;return!0})),n.onEnvRotationChange=e=>B("envRotation",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(u=e,0))})),n.onToneMappingChange=e=>B("toneMapping",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(d=e,0))})),n.onToneMappingExposureChange=e=>B("toneMappingExposure",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(p=e,0))})),n.onBloomEnabledChange=e=>B("bloomEnabled",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(f=e,0))})),n.onBloomStrengthChange=e=>B("bloomStrength",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(g=e,0))})),n.onBloomRadiusChange=e=>B("bloomRadius",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(m=e,0))})),n.onBloomThresholdChange=e=>B("bloomThreshold",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(v=e,0))})),n.onCategoryChange=e=>B("category",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(E=e,0))})),n.onInteractiveChange=e=>S("interactive",t=>G(this,void 0,void 0,function*(){r.interactive=e})),n.onTouchActionChange=e=>S("touchAction",t=>G(this,void 0,void 0,function*(){r.touchAction=e})),n.onZoomEnabledChange=e=>S("zoomEnabled",t=>G(this,void 0,void 0,function*(){r.zoomEnabled=e})),n.onMinZoomChange=e=>S("minZoom",t=>G(this,void 0,void 0,function*(){r.minZoom=e})),n.onMaxZoomChange=e=>S("maxZoom",t=>G(this,void 0,void 0,function*(){r.maxZoom=e})),n.onPreserveCameraOnReloadChange=e=>S("preserveCameraOnReload",t=>G(this,void 0,void 0,function*(){r.preserveCameraOnReload=e})),n.onAlwaysTransparentBackgroundChange=e=>B("alwaysTransparentBackground",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(b=e,0))})),n.onDefaultFovChange=e=>S("defaultFov",t=>G(this,void 0,void 0,function*(){r.defaultFov=null!=e?e:16})),n.onFovMultiplierChange=e=>S("fovMultiplier",t=>G(this,void 0,void 0,function*(){r.fovMultiplier=null!=e?e:1})),n.onDefaultCameraPositionsChange=e=>S("defaultCameraPositions",t=>G(this,void 0,void 0,function*(){var t;a.vectors=e,r.initialPose=a.getVector(null!==(t=r.category)&&void 0!==t?t:Jc)})),n.onInteractionPromptUrlChange=e=>S("interactionPromptUrl",t=>G(this,void 0,void 0,function*(){i.prompt.imageUrl=e})),n.onInteractionPromptSizeChange=e=>S("interactionPromptSize",t=>G(this,void 0,void 0,function*(){i.prompt.imageSize=e})),n.onNonLiveRenderingChange=e=>S("nonLiveRendering",t=>G(this,void 0,void 0,function*(){r.nonLiveRendering=!!e})),n.onBaseUrlChange=e=>S("baseUrl",t=>G(this,void 0,void 0,function*(){ku(e)})),n.onOnModelLoadedChange=e=>S("onModelLoaded",t=>G(this,void 0,void 0,function*(){o=e})),n.onOnRenderedChange=e=>B("onRendered",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(C=e,0))})),n.onOnInteractedChange=e=>B("onInteracted",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(_=e,0))})),n.onOnInteractionPerfChange=e=>B("onInteractionPerf",t=>G(this,void 0,void 0,function*(){return!(t()||!n.initialized||(I=e,0))})),n.onOnMaxZoomEnterChange=e=>S("onMaxZoomEnter",t=>G(this,void 0,void 0,function*(){r.onMaxZoomEnter=e})),n.onOnMaxZoomLeaveChange=e=>S("onMaxZoomLeave",t=>G(this,void 0,void 0,function*(){r.onMaxZoomLeave=e})),n.onOnMinZoomEnterChange=e=>S("onMinZoomEnter",t=>G(this,void 0,void 0,function*(){r.onMinZoomEnter=e})),n.onOnMinZoomLeaveChange=e=>S("onMinZoomLeave",t=>G(this,void 0,void 0,function*(){r.onMinZoomLeave=e})),n.onOnMinVerticalAngleEnterChange=e=>S("onMinVerticalAngleEnter",t=>G(this,void 0,void 0,function*(){r.onMinVerticalAngleEnter=e})),n.onOnMinVerticalAngleLeaveChange=e=>S("onMinVerticalAngleLeave",t=>G(this,void 0,void 0,function*(){r.onMinVerticalAngleLeave=e})),n.onOnMaxVerticalAngleEnterChange=e=>S("onMaxVerticalAngleEnter",t=>G(this,void 0,void 0,function*(){r.onMaxVerticalAngleEnter=e})),n.onOnMaxVerticalAngleLeaveChange=e=>S("onMaxVerticalAngleLeave",t=>G(this,void 0,void 0,function*(){r.onMaxVerticalAngleLeave=e})),n.onAnimationChange=e=>B("animation",t=>G(this,void 0,void 0,function*(){if(t()||!n.initialized)return!1;if(null==e)return x={theta:null,phi:null,fov:null},!0;const i=se(e);return x={theta:null!=i.theta?$(i.theta):null,phi:null!=i.phi?$(i.phi):null,fov:null!=i.fov?$(i.fov):null},!0})),{render:e=>{r.updateOnce(e),r.renderOnce()},flushChanges:()=>new Promise((e,t)=>{M.anyLocked()?s.push({resolve:e,reject:t}):e()}),zoomBy:e=>{r.zoomBy(e)},rotateBy:(e,t)=>{r.rotateBy(e,t)}}}function zp(e,t){if(null==t){if("boolean"==typeof e)return e;const t=e.left||e.right;return console.warn(`Expected 'glbLocal' to be boolean, but got object (treating as ${t}).`),t}return"boolean"==typeof e?e:e[t]}var Vp,Wp,qp,jp,Yp,Xp,Kp,Jp,Zp,$p,ef,tf;!function(e){e[e.Empty=0]="Empty",e[e.Direct=1]="Direct",e[e.Blitted=2]="Blitted"}(tf||(tf={}));class nf{constructor(){Vp.add(this),Wp.set(this,document.createElement("div")),qp.set(this,tf.Empty),jp.set(this,null),Yp.set(this,1),Xp.set(this,1),Kp.set(this,1),Jp.set(this,1),Zp.set(this,1),$p.set(this,!1);const{style:e}=H(this,Wp,"f");e.position="absolute",e.top="0",e.left="0",e.width="100%",e.height="100%",e.pointerEvents="auto"}get element(){return H(this,Wp,"f")}isDirect(){return H(this,qp,"f")===tf.Direct}ensureDirectMode(){if(H(this,qp,"f")===tf.Direct)return;z(this,qp,tf.Direct);const e=Ku().domElement;document.contains(e)&&console.warn("[ShopAR 3D] Direct rendering not working properly!"),H(this,Wp,"f").replaceChildren(e),z(this,jp,null),z(this,$p,!0)}isBlitted(){return H(this,qp,"f")===tf.Blitted}ensureBlittedMode(){H(this,qp,"f")!==tf.Blitted&&(z(this,qp,tf.Blitted),z(this,jp,function(){const e=document.createElement("canvas"),{style:t}=e;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",e}()),H(this,Wp,"f").replaceChildren(H(this,jp,"f")),z(this,$p,!0))}set visible(e){H(this,Wp,"f").style.visibility=e?"visible":"hidden"}get width(){return H(this,Kp,"f")}get height(){return H(this,Jp,"f")}set clientWidth(e){e!==H(this,Yp,"f")&&z(this,$p,!0),z(this,Yp,e)}set clientHeight(e){e!==H(this,Xp,"f")&&z(this,$p,!0),z(this,Xp,e)}get dpr(){return H(this,Zp,"f")}set dpr(e){e!==this.dpr&&z(this,$p,!0),z(this,Zp,e)}get sizeDirty(){return H(this,$p,"f")}commitResize(){if(!H(this,$p,"f"))return;z(this,$p,!1);const e=H(this,Vp,"m",ef).call(this);null!=e&&(z(this,Kp,Math.ceil(H(this,Yp,"f")*H(this,Zp,"f"))),z(this,Jp,Math.ceil(H(this,Xp,"f")*H(this,Zp,"f"))),e.width=H(this,Kp,"f"),e.height=H(this,Jp,"f"))}get context2d(){var e,t;return null!==(t=null===(e=H(this,jp,"f"))||void 0===e?void 0:e.getContext("2d"))&&void 0!==t?t:null}}function rf(e){return`var(${e.var}, ${e.default})`}Wp=new WeakMap,qp=new WeakMap,jp=new WeakMap,Yp=new WeakMap,Xp=new WeakMap,Kp=new WeakMap,Jp=new WeakMap,Zp=new WeakMap,$p=new WeakMap,Vp=new WeakSet,ef=function(){return H(this,qp,"f")===tf.Direct?Ku().domElement:H(this,qp,"f")===tf.Blitted?H(this,jp,"f"):null};const af="--shopar-3d",of={display:{var:`${af}-loading-display`,default:"block"},top:{var:`${af}-loading-top`,default:"0"},bottom:{var:`${af}-loading-bottom`,default:"auto"},height:{var:`${af}-loading-height`,default:"0.375rem"},radius:{var:`${af}-loading-radius`,default:"calc(infinity * 1px)"},fg:{var:`${af}-loading-fg`,default:"linear-gradient(90deg, #773cd8, #5fb9ec)"},bg:{var:`${af}-loading-bg`,default:"#e5e7eb"}},sf="width 0.05s ease-out";const lf="data:image/svg+xml,%3csvg width='869' height='1251' viewBox='0 0 869 1251' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cg clip-path='url(%23clip0_894_1533)'%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M303.44 353.132C304.829 314.64 330.051 282.714 363.992 272.987C371.106 271.049 378.436 270.01 385.808 269.895C391.367 269.895 396.717 270.486 401.893 271.424C439.69 278.372 467.899 309.36 467.899 346.462V654.953H511.671C613.911 606.665 685.371 500.36 685.371 376.165C685.571 306.213 662.333 238.211 619.365 183.01L604.427 165.64C577.851 136.528 545.96 112.766 510.212 96.1603C473.492 79.1377 432.881 69.4105 390.012 69.4105C347.143 69.4105 306.636 79.0683 269.812 96.1603C234.029 112.766 202.173 136.528 175.666 165.64L160.728 183.01C117.761 238.211 94.5225 306.213 94.722 376.165C94.714 391.336 95.8054 406.487 97.9875 421.5C99.0297 428.796 101.045 435.744 102.504 442.935L107.228 464.613C110.112 474.548 114.037 484.067 117.824 493.516L122.132 505.085C127.341 516.473 133.246 527.53 139.814 538.192L142.073 542.43C171.755 590.029 214.112 628.416 264.392 653.286L302.954 671.941V353.097L303.44 353.132Z' fill='white' fill-opacity='0.5'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M797.001 876.074L701.118 1144.96C695.143 1161.81 677.634 1172.75 657.589 1172.75H425.283C369.49 1172.75 317.867 1149.13 287.018 1109.53C231.711 1038.38 160.321 976.75 74.7561 926.447C71.4558 924.536 69.5451 921.687 69.4757 918.456C69.3367 914.982 71.0737 911.647 76.1805 908.139C95.6349 894.486 119.05 887.295 143.09 887.295C151.152 887.279 159.195 888.083 167.095 889.692L338.085 924.223V346.427C338.085 323.395 359.45 304.635 385.679 304.635C411.908 304.635 433.377 323.395 433.377 346.427V689.728H535.964C545.448 689.728 554.481 692.264 562.263 697.024L779.631 831.606C780.569 832.197 781.194 833.065 782.063 833.691C796.306 843.974 802.42 860.441 796.862 876.074M142.499 542.431C141.665 541.041 141.04 539.547 140.241 538.192C133.666 527.534 127.76 516.477 122.558 505.085C120.891 501.368 119.779 497.338 118.251 493.517L107.655 464.613C105.64 457.595 104.528 450.161 102.93 442.935L98.4141 421.501C96.2308 406.488 95.1394 391.336 95.1485 376.165C95.1485 302.968 119.953 235.815 161.155 183.011L176.093 165.641C202.634 136.459 234.525 112.731 270.238 96.1605C306.993 79.1379 347.569 69.4107 390.439 69.4107C433.308 69.4107 473.884 79.1379 510.639 96.1605C546.421 112.731 578.278 136.459 604.854 165.641L619.723 183.011C662.719 238.184 685.972 306.182 685.763 376.13C685.763 500.395 614.338 606.665 512.063 654.953H468.291V346.393C468.291 309.325 439.735 278.302 402.285 271.354C397.074 270.382 391.724 269.826 386.2 269.826C378.557 269.826 371.366 271.111 364.384 272.952C330.443 282.68 305.221 314.571 303.832 353.063V671.907L265.27 653.251C214.758 628.725 172.376 590.58 142.499 542.431ZM798.043 802.147L580.71 667.564C577.166 665.375 573.136 664.16 569.245 662.562C662.453 600.03 720.503 493.899 720.503 376.2C720.503 359.316 719.218 342.71 716.89 326.521C709.659 275.243 691.021 226.238 662.348 183.115L652.1 168.941L649.807 165.745C639.725 152.491 628.708 139.976 616.839 128.295C604.958 116.692 592.243 105.957 578.834 96.2647C538.709 67.2916 492.261 47.2118 441.958 38.9437L416.528 35.8866L390.543 34.8444C373.298 34.8447 356.082 36.2272 339.058 38.9785C288.789 47.2466 242.272 67.3263 202.182 96.2995C192.322 103.7 182.893 111.657 173.939 120.131C163.518 129.655 153.713 139.831 144.584 150.598L131.209 165.779L118.702 183.149L108.697 199.408L94.1758 226.436L92.7862 229.562C72.1854 274.029 60.478 323.708 60.478 376.234C60.478 509.358 136.281 631.295 253.632 686.741L303.554 710.364V882.188L173.765 855.994C163.608 853.965 153.273 852.964 142.916 853.006C142.325 853.006 141.735 853.11 141.179 853.11C132.425 853.249 123.705 854.257 115.124 855.89C112.364 856.472 109.619 857.121 106.891 857.835C100.186 859.433 93.62 861.552 87.1583 864.088C84.5528 865.13 81.9473 866.068 79.3418 867.562C70.6568 871.523 62.1803 876.039 54.2248 881.632C47.9431 885.96 42.8502 891.798 39.4144 898.609C35.9785 905.42 34.3099 912.986 34.562 920.61C34.9201 928.091 37.1618 935.359 41.079 941.742C44.9961 948.125 50.4619 953.415 56.9693 957.122C139.025 1004.85 207.116 1063.53 259.677 1131.24C264.329 1137.24 269.365 1142.94 274.754 1148.3C312.482 1185.88 367.024 1207.81 425.04 1207.88H657.693C683.679 1207.84 707.372 1196.31 722.24 1177.58C727.173 1171.33 731.134 1164.38 733.913 1156.67L829.691 887.781C832.957 878.749 834.207 869.369 833.582 860.197C832.957 851.026 830.525 842.133 826.53 833.795C820.225 820.757 810.33 809.79 798.008 802.182' fill='black' fill-opacity='0.6'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M779.738 831.676L562.37 697.093C554.446 692.276 545.346 689.739 536.072 689.763H433.485V346.532C433.485 323.499 412.085 304.74 385.787 304.74C359.489 304.74 338.193 323.499 338.193 346.532V924.71L167.203 890.178C159.291 888.569 151.236 887.766 143.163 887.781C119.267 887.676 95.9182 894.929 76.2881 908.555C71.1813 912.099 69.4096 915.434 69.5485 918.908C69.6875 922.174 71.5635 925.022 74.8638 926.898C160.394 977.202 231.784 1038.76 287.125 1109.98C317.94 1149.58 369.563 1173.2 425.39 1173.2H657.662C677.707 1173.2 695.181 1161.88 701.191 1145.41L797.074 876.525C802.632 860.962 796.483 844.46 782.274 834.142C781.406 833.448 780.781 832.649 779.843 832.058L779.738 831.676Z' fill='white'/%3e%3cmask id='mask0_894_1533' style='mask-type:luminance' maskUnits='userSpaceOnUse' x='0' y='0' width='869' height='1243'%3e%3cpath d='M0.0664062 0.0349731H868.462V1242.62H0.0664062V0.0349731Z' fill='white'/%3e%3c/mask%3e%3cg mask='url(%23mask0_894_1533)'%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M833.58 860.197C834.209 869.559 832.897 878.95 829.724 887.781L733.911 1156.67C731.132 1164.31 727.172 1171.36 722.239 1177.58C707.405 1196.34 683.677 1207.81 657.727 1207.88H425.038C367.022 1207.81 312.481 1185.88 274.753 1148.3C269.403 1142.95 264.331 1137.25 259.676 1131.27C207.114 1063.57 139.024 1004.89 57.2458 956.809C43.8709 948.993 35.4985 935.34 34.8385 920.332C34.5864 912.708 36.255 905.143 39.6909 898.332C43.1267 891.521 48.2196 885.682 54.5013 881.354C62.4292 875.912 70.8363 871.202 79.6183 867.284L87.4348 863.81C93.8598 861.272 100.453 859.183 107.167 857.557L115.401 855.612C124.016 854.014 132.771 853.006 141.456 852.833C142.081 852.833 142.637 852.728 143.193 852.728C153.719 852.694 163.932 853.666 174.111 855.716L303.413 881.84V710.399L253.527 686.775C136.21 631.33 60.3724 509.393 60.3724 376.269C60.3724 323.812 72.045 274.134 92.6806 229.597C93.2017 228.555 93.5491 227.513 94.0702 226.47C98.4821 217.195 103.38 208.232 108.591 199.443C111.822 193.884 115.053 188.465 118.597 183.184C120.785 179.884 123.217 176.723 125.545 173.561L131.138 165.675C135.237 160.291 140.17 155.601 144.513 150.494C153.753 140.072 163.411 129.511 173.868 120.027C182.822 111.552 192.251 103.596 202.112 96.1953C242.202 67.2569 288.753 47.2119 339.022 38.8743C356.034 36.1219 373.239 34.7394 390.472 34.7402C399.145 34.7313 407.815 35.0906 416.457 35.8172C425.038 36.512 433.48 37.5542 441.922 38.8743C492.225 47.1424 538.707 67.2221 578.797 96.1953C592.242 105.923 604.922 116.622 616.803 128.226C628.681 139.898 639.699 152.413 649.771 165.675L652.064 168.871C655.607 173.492 659.116 178.182 662.312 183.045C690.997 226.166 709.647 275.171 716.889 326.452C719.182 342.676 720.467 359.281 720.467 376.13C720.467 493.829 662.451 600.307 569.244 662.492C573.065 664.09 577.13 665.271 580.708 667.495L798.041 802.077C810.895 810.068 820.449 821.184 826.528 833.343C830.523 841.681 832.955 850.644 833.58 859.746M857.794 818.231C848.588 799.124 834.275 783.248 816.315 772.166L631.394 657.628C709.732 586.863 755.207 484.971 755.207 375.748C755.207 299.667 733.078 226.227 691.285 163.348C686.908 156.817 682.253 150.494 677.389 144.171C654.982 114.712 628.684 88.5872 599.155 67.6043C537.561 23.5887 465.337 0.0349731 390.472 0.0349731C315.457 0.0670918 242.383 23.8817 181.754 68.0559C152.294 89.3863 125.961 115.163 103.485 144.658C98.7601 150.911 94.0354 157.268 89.6582 163.765C47.7965 226.679 25.6671 300.119 25.6671 376.2C25.6671 522.733 109.286 656.899 238.728 718.111L268.708 732.354V839.77L180.99 822.053C168.622 819.621 156.081 818.37 143.609 818.37C104.55 818.376 66.4474 830.462 34.5258 852.971C11.8406 868.952 -0.978479 894.729 0.133201 921.861C0.732449 935.148 4.66826 948.071 11.5776 959.437C18.4869 970.803 28.1472 980.245 39.6673 986.894C117.485 1032.68 182.31 1088.44 232.231 1152.67C276.004 1208.95 348.02 1242.65 425.038 1242.72H657.727C707.057 1242.68 750.83 1212.84 766.602 1168.45L862.484 899.558C871.933 873.26 870.266 844.53 857.829 818.787' fill='black' fill-opacity='0.05'/%3e%3c/g%3e%3c/g%3e%3cdefs%3e%3cclipPath id='clip0_894_1533'%3e%3crect width='868.5' height='1250.64' fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",cf="2rem";function hf(e){const t=function(){const e=document.createElement("div"),{style:t}=e;return t.position="relative",t.width="100%",t.height="100%",t.pointerEvents="none",e}(),n=function(){const e=document.createElement("div");e.draggable=!1;const{style:t}=e;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",t.objectFit="contain",t.visibility="hidden",t.backgroundSize="contain",t.backgroundRepeat="no-repeat",t.backgroundPosition="center",e}();t.appendChild(n);const i=new nf;t.appendChild(i.element);const r=function(){const e=function(){const e=document.createElement("div"),{style:t}=e;return t.display=rf(of.display),t.opacity="0",t.transition="opacity 0.2s ease-out",t.position="absolute",t.top=rf(of.top),t.bottom=rf(of.bottom),t.left="0",t.width="100%",t.height=rf(of.height),t.overflow="hidden",e}(),t=function(){const e=document.createElement("div"),{style:t}=e;return t.position="absolute",t.width="100%",t.height="100%",t.background=rf(of.bg),e}(),n=function(){const e=document.createElement("div"),{style:t}=e;return t.position="absolute",t.top="0",t.left="0",t.width="0%",t.height="100%",t.background=rf(of.fg),t.borderRadius=rf(of.radius),t.transition=sf,e}();t.appendChild(n),e.appendChild(t);let i=0;return{get container(){return e},set progress(e){e<i?(n.style.transition="none",n.style.width=100*e+"%",n.offsetWidth,n.style.transition=sf):n.style.width=100*e+"%",i=e},set visible(t){e.style.opacity=t?"1":"0"}}}();t.appendChild(r.container);const a=function(){const e=function(){const e=document.createElement("div"),{style:t}=e;return t.visibility="hidden",t.position="absolute",t.width="100%",t.height="100%",t.display="flex",t.justifyContent="center",t.alignItems="center",e}(),t=function(){const e=function(e){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("width",e),t.setAttribute("height",e),t}(cf),{style:t}=e;return t.transition="opacity 0.3s",t.opacity="0",e}(),n=function(e,t){const n=document.createElementNS("http://www.w3.org/2000/svg","image");return n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",t),n.setAttribute("width",e),n.setAttribute("height",e),n}(cf,lf);return t.appendChild(n),e.appendChild(t),{get container(){return e},get svg(){return t},set imageUrl(e){n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",null!=e?e:lf)},set imageSize(e){const i=null!=e?e:cf;t.setAttribute("width",i),t.setAttribute("height",i),n.setAttribute("width",i),n.setAttribute("height",i)},set visible(t){e.style.visibility=t?"visible":"hidden"},set opacity(e){t.style.opacity=e},set transform(e){t.style.transform=e}}}();return t.appendChild(a.container),{get root(){return t},get canvasWrapper(){return i},get loading(){return r},get prompt(){return a},set canvasVisible(e){i.visible=e},set posterVisible(e){n.style.visibility=e?"visible":"hidden"},loadPoster:e=>{n.style.backgroundImage=e?`url(${e})`:""}}}var Af,uf,df,pf;class ff extends HTMLElement{constructor(){super(),Af.add(this),uf.set(this,void 0),df.set(this,void 0),z(this,uf,function(){let e,t,n,i,r,a,o,s,l,c,h,A,u,d,p,f,g,m,v,E,b,C,_,I,x,y,M,w,S,B,T,R,D,Q,L,U,P,N,F,O,k,G,H,z,V=()=>{},W=()=>{},q=()=>{},j=()=>{},Y=()=>{},X=()=>{},K=()=>{},J=()=>{},Z=()=>{},$=()=>{},ee=()=>{},te=()=>{},ne=()=>{},ie=()=>{},re=()=>{},ae=()=>{},oe=()=>{},se=()=>{},le=()=>{},ce=()=>{},he=()=>{},Ae=()=>{},ue=()=>{},de=()=>{},pe=()=>{},fe=()=>{},ge=()=>{},me=()=>{},ve=()=>{},Ee=()=>{},be=()=>{},Ce=()=>{},_e=()=>{},Ie=()=>{},xe=()=>{},ye=()=>{},Me=()=>{},we=()=>{},Se=()=>{},Be=()=>{},Te=()=>{},Re=()=>{},De=()=>{},Qe=()=>{};function Le(){e=!1,t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null,h=null,A=null,u=null,d=null,p=!1,f=!0,g=null,m=null,v=null,E=null,b=null,C=null,_=null,I=null,x=null,y=null,M=null,w=null,S=null,B=null,T=!0,R=null,D=null,Q=!1,L=!1,U=null,P=null,N=null,F=null,O=null,k=null,G=null,H=null,z=!1}return Le(),{get initialized(){return e},set initialized(t){const n=t!==e;e=t,t||Le(),n&&(null==V||V(e))},set onInitializedChange(e){V=e},get paused(){return t},set paused(e){const n=e!==t;t=e,n&&(null==W||W(t))},set onPausedChange(e){W=e},get posterUrl(){return n},set posterUrl(e){const t=e!==n;n=e,t&&(null==q||q(e))},set onPosterUrlChange(e){q=e},set glbUrl(e){const t=e!==i;i=e,t&&(null==j||j(i))},set onGlbUrlChange(e){j=e},set envUrl(e){const t=e!==r;r=e,t&&(null==Y||Y(r))},set onEnvUrlChange(e){Y=e},set diamondEnvUrl(e){const t=e!==a;a=e,t&&(null==X||X(a))},set onDiamondEnvUrlChange(e){X=e},set envRotation(e){const t=e!==o;o=e,t&&(null==K||K(o))},set onEnvRotationChange(e){K=e},set toneMapping(e){const t=e!==s;s=e,t&&(null==J||J(s))},set onToneMappingChange(e){J=e},set toneMappingExposure(e){const t=e!==l;l=e,t&&(null==Z||Z(l))},set onToneMappingExposureChange(e){Z=e},set bloomEnabled(e){const t=e!==c;c=e,t&&(null==$||$(c))},set onBloomEnabledChange(e){$=e},set bloomStrength(e){const t=e!==h;h=e,t&&(null==ee||ee(h))},set onBloomStrengthChange(e){ee=e},set bloomRadius(e){const t=e!==A;A=e,t&&(null==te||te(A))},set onBloomRadiusChange(e){te=e},set bloomThreshold(e){const t=e!==u;u=e,t&&(null==ne||ne(u))},set onBloomThresholdChange(e){ne=e},set category(e){const t=e!==d;d=e,t&&(null==ie||ie(d))},set onCategoryChange(e){ie=e},get glbLocal(){return p},set glbLocal(e){const t=e!==p;p=e,t&&(null==re||re(p))},set onGlbLocalChange(e){re=e},set interactive(e){const t=e!==f;f=e,t&&(null==ae||ae(f))},set onInteractiveChange(e){ae=e},set onModelLoaded(e){const t=e!==g;g=e,t&&(null==oe||oe(g))},set onOnModelLoadedChange(e){oe=e},set onRendered(e){const t=e!==m;m=e,t&&(null==se||se(m))},set onOnRenderedChange(e){se=e},set onInteracted(e){const t=e!==v;v=e,t&&(null==le||le(v))},set onOnInteractedChange(e){le=e},set onInteractionPerf(e){const t=e!==E;E=e,t&&(null==ce||ce(E))},set onOnInteractionPerfChange(e){ce=e},set onMaxZoomEnter(e){const t=e!==b;b=e,t&&(null==he||he(b))},set onOnMaxZoomEnterChange(e){he=e},set onMaxZoomLeave(e){const t=e!==C;C=e,t&&(null==Ae||Ae(C))},set onOnMaxZoomLeaveChange(e){Ae=e},set onMinZoomEnter(e){const t=e!==_;_=e,t&&(null==ue||ue(_))},set onOnMinZoomEnterChange(e){ue=e},set onMinZoomLeave(e){const t=e!==I;I=e,t&&(null==de||de(I))},set onOnMinZoomLeaveChange(e){de=e},set onMinVerticalAngleEnter(e){const t=e!==x;x=e,t&&(null==pe||pe(x))},set onOnMinVerticalAngleEnterChange(e){pe=e},set onMinVerticalAngleLeave(e){const t=e!==y;y=e,t&&(null==fe||fe(y))},set onOnMinVerticalAngleLeaveChange(e){fe=e},set onMaxVerticalAngleEnter(e){const t=e!==M;M=e,t&&(null==ge||ge(M))},set onOnMaxVerticalAngleEnterChange(e){ge=e},set onMaxVerticalAngleLeave(e){const t=e!==w;w=e,t&&(null==me||me(w))},set onOnMaxVerticalAngleLeaveChange(e){me=e},get onError(){return S},set onError(e){const t=e!==S;S=e,t&&(null==ve||ve(S))},set onOnErrorChange(e){ve=e},set touchAction(e){const t=e!==B;B=e,t&&(null==Ee||Ee(B))},set onTouchActionChange(e){Ee=e},set zoomEnabled(e){const t=e!==T;T=e,t&&(null==be||be(T))},set onZoomEnabledChange(e){be=e},set minZoom(e){const t=e!==R;R=e,t&&(null==Ce||Ce(R))},set onMinZoomChange(e){Ce=e},set maxZoom(e){const t=e!==D;D=e,t&&(null==_e||_e(D))},set onMaxZoomChange(e){_e=e},set preserveCameraOnReload(e){const t=e!==Q;Q=e,t&&(null==Ie||Ie(Q))},set onPreserveCameraOnReloadChange(e){Ie=e},set alwaysTransparentBackground(e){const t=e!==L;L=e,t&&(null==xe||xe(L))},set onAlwaysTransparentBackgroundChange(e){xe=e},set defaultFov(e){const t=e!==U;U=e,t&&(null==ye||ye(U))},set onDefaultFovChange(e){ye=e},set fovMultiplier(e){const t=e!==P;P=e,t&&(null==Me||Me(P))},set onFovMultiplierChange(e){Me=e},set defaultCameraPositions(e){const t=e!==N;N=e,t&&(null==we||we(N))},set onDefaultCameraPositionsChange(e){we=e},set interactionPromptUrl(e){const t=e!==F;F=e,t&&(null==Se||Se(F))},set onInteractionPromptUrlChange(e){Se=e},set interactionPromptSize(e){const t=e!==O;O=e,t&&(null==Be||Be(O))},set onInteractionPromptSizeChange(e){Be=e},set animation(e){const t=e!==k;k=e,t&&(null==Te||Te(k))},set onAnimationChange(e){Te=e},set nonLiveRendering(e){const t=e!==G;G=e,t&&(null==Re||Re(G))},set onNonLiveRenderingChange(e){Re=e},set baseUrl(e){const t=e!==H;H=e,t&&(null==De||De(H))},set onBaseUrlChange(e){De=e},get downloadCacheEnabled(){return z},set downloadCacheEnabled(e){const t=e!==z;z=e,t&&(null==Qe||Qe(z))},set onDownloadCacheEnabledChange(e){Qe=e}}}());const e=hf(H(this,uf,"f"));z(this,df,Hp(H(this,uf,"f"),e)),this.attachShadow({mode:"open"}).appendChild(e.root)}connectedCallback(){H(this,uf,"f").initialized=!0}disconnectedCallback(){H(this,uf,"f").paused=!0,H(this,uf,"f").initialized=!1}attributeChangedCallback(e,t,n){var i,r;if(H(this,uf,"f").initialized)if("paused"===e)H(this,uf,"f").paused=gf(n);else if("poster-url"===e)H(this,uf,"f").posterUrl=n;else if("glb-url"===e)H(this,uf,"f").glbUrl=function(e){if(null==e?void 0:e.includes("|")){const[t,n]=e.split("|",2);return{left:t,right:n}}return e}(n);else if("env-url"===e)H(this,uf,"f").envUrl=n;else if("diamond-env-url"===e)H(this,uf,"f").diamondEnvUrl=n;else if("env-rotation"===e)H(this,uf,"f").envRotation=mf(n);else if("tone-mapping"===e)H(this,uf,"f").toneMapping=(r=i=n,jc.includes(r)?i:null);else if("tone-mapping-exposure"===e)H(this,uf,"f").toneMappingExposure=mf(n);else if("bloom-enabled"===e)H(this,uf,"f").bloomEnabled=gf(n);else if("bloom-strength"===e)H(this,uf,"f").bloomStrength=mf(n);else if("bloom-radius"===e)H(this,uf,"f").bloomRadius=mf(n);else if("bloom-threshold"===e)H(this,uf,"f").bloomThreshold=mf(n);else if("category"===e)H(this,uf,"f").category=function(e){return Xc(e)?e:null}(n);else if("glb-local"===e)H(this,uf,"f").glbLocal=function(e){if(null==e?void 0:e.includes("|")){const[t,n]=e.split("|",2);return{left:"true"===t,right:"true"===n}}return gf(e)}(n);else if("interactivity-disabled"===e)H(this,uf,"f").interactive=!gf(n);else if("touch-action"===e)H(this,uf,"f").touchAction=function(e){return function(e){return Yc.includes(e)}(e)?e:null}(n);else if("zoom-disabled"===e)H(this,uf,"f").zoomEnabled=!gf(n);else if("min-zoom"===e)H(this,uf,"f").minZoom=mf(n);else if("max-zoom"===e)H(this,uf,"f").maxZoom=mf(n);else if("preserve-camera-on-reload"===e)H(this,uf,"f").preserveCameraOnReload=gf(n);else if("always-transparent-background"===e)H(this,uf,"f").alwaysTransparentBackground=gf(n);else if("default-fov"===e)H(this,uf,"f").defaultFov=mf(n);else if("fov-multiplier"===e)H(this,uf,"f").fovMultiplier=mf(n);else if("interaction-prompt-url"===e)H(this,uf,"f").interactionPromptUrl=n;else if("interaction-prompt-size"===e)H(this,uf,"f").interactionPromptSize=n;else if("non-live-rendering"===e)H(this,uf,"f").nonLiveRendering=gf(n);else if("base-url"===e)H(this,uf,"f").baseUrl=n;else{if("download-cache-enabled"!==e)throw new Error(`Unknown attribute: ${e} (changed from '${t}' to '${n}')`);H(this,uf,"f").downloadCacheEnabled=gf(n)}}set paused(e){H(this,Af,"m",pf).call(this,"paused",e?"":null)}set posterUrl(e){H(this,Af,"m",pf).call(this,"poster-url",e)}set glbUrl(e){H(this,Af,"m",pf).call(this,"glb-url","string"==typeof e||null==e?e:`${e.left}|${e.right}`)}set envUrl(e){H(this,Af,"m",pf).call(this,"env-url",e)}set diamondEnvUrl(e){H(this,Af,"m",pf).call(this,"diamond-env-url",e)}set envRotation(e){H(this,Af,"m",pf).call(this,"env-rotation",null!=e?`${e}`:null)}set toneMapping(e){H(this,Af,"m",pf).call(this,"tone-mapping",e)}set toneMappingExposure(e){H(this,Af,"m",pf).call(this,"tone-mapping-exposure",`${e}`)}set bloomEnabled(e){H(this,Af,"m",pf).call(this,"bloom-enabled",e?"":null)}set bloomStrength(e){H(this,Af,"m",pf).call(this,"bloom-strength",null!=e?`${e}`:null)}set bloomRadius(e){H(this,Af,"m",pf).call(this,"bloom-radius",null!=e?`${e}`:null)}set bloomThreshold(e){H(this,Af,"m",pf).call(this,"bloom-threshold",null!=e?`${e}`:null)}set category(e){H(this,Af,"m",pf).call(this,"category",e)}set animation(e){H(this,uf,"f").animation=e}set glbLocal(e){H(this,Af,"m",pf).call(this,"glb-local","boolean"==typeof e||null==e?e?"":null:`${e.left}|${e.right}`)}set interactivityDisabled(e){H(this,Af,"m",pf).call(this,"interactivity-disabled",e?"":null)}set touchAction(e){H(this,Af,"m",pf).call(this,"touch-action",e)}set zoomDisabled(e){H(this,Af,"m",pf).call(this,"zoom-disabled",e?"":null)}set minZoom(e){H(this,Af,"m",pf).call(this,"min-zoom",null!=e?`${e}`:null)}set maxZoom(e){H(this,Af,"m",pf).call(this,"max-zoom",null!=e?`${e}`:null)}set preserveCameraOnReload(e){H(this,Af,"m",pf).call(this,"preserve-camera-on-reload",e?"":null)}set alwaysTransparentBackground(e){H(this,Af,"m",pf).call(this,"always-transparent-background",e?"":null)}set defaultFov(e){H(this,Af,"m",pf).call(this,"default-fov",`${e}`)}set fovMultiplier(e){H(this,Af,"m",pf).call(this,"fov-multiplier",`${e}`)}set defaultCameraPositions(e){H(this,uf,"f").defaultCameraPositions=e}set interactionPromptUrl(e){H(this,Af,"m",pf).call(this,"interaction-prompt-url",e)}set interactionPromptSize(e){H(this,Af,"m",pf).call(this,"interaction-prompt-size",e)}set nonLiveRendering(e){H(this,Af,"m",pf).call(this,"non-live-rendering",e?"":null)}set baseUrl(e){H(this,Af,"m",pf).call(this,"base-url",e)}set downloadCacheEnabled(e){H(this,Af,"m",pf).call(this,"download-cache-enabled",e?"":null)}set onModelLoaded(e){H(this,uf,"f").onModelLoaded=e}set onRendered(e){H(this,uf,"f").onRendered=e}set onInteracted(e){H(this,uf,"f").onInteracted=e}set onInteractionPerf(e){H(this,uf,"f").onInteractionPerf=e}set onMaxZoomEnter(e){H(this,uf,"f").onMaxZoomEnter=e}set onMaxZoomLeave(e){H(this,uf,"f").onMaxZoomLeave=e}set onMinZoomEnter(e){H(this,uf,"f").onMinZoomEnter=e}set onMinZoomLeave(e){H(this,uf,"f").onMinZoomLeave=e}set onMinVerticalAngleEnter(e){H(this,uf,"f").onMinVerticalAngleEnter=e}set onMinVerticalAngleLeave(e){H(this,uf,"f").onMinVerticalAngleLeave=e}set onMaxVerticalAngleEnter(e){H(this,uf,"f").onMaxVerticalAngleEnter=e}set onMaxVerticalAngleLeave(e){H(this,uf,"f").onMaxVerticalAngleLeave=e}set onError(e){H(this,uf,"f").onError=e}zoomBy(e){H(this,df,"f").zoomBy(e)}rotateBy(e,t){H(this,df,"f").rotateBy(e,t)}render(e){H(this,df,"f").render(e)}flushChanges(){return H(this,df,"f").flushChanges()}}function gf(e){return null!=e}function mf(e){return null==e?null:Number.parseFloat(e)}if(uf=new WeakMap,df=new WeakMap,Af=new WeakSet,pf=function(e,t){null==t?this.removeAttribute(e):this.setAttribute(e,t)},ff.observedAttributes=["paused","poster-url","glb-url","env-url","diamond-env-url","env-rotation","tone-mapping","tone-mapping-exposure","category","glb-local","interactivity-disabled","touch-action","zoom-disabled","min-zoom","max-zoom","preserve-camera-on-reload","always-transparent-background","default-fov","fov-multiplier","interaction-prompt-url","interaction-prompt-size","bloom-enabled","bloom-strength","bloom-radius","bloom-threshold","non-live-rendering","base-url","download-cache-enabled"],null==window)throw new Error("window is not defined. ShopAR 3D only works in a browser environment.");const{customElements:vf}=window;try{vf.define("shopar-3d",ff)}catch($d){console.error($d)}const Ef={bg:{var:`${Q}-3d-bg`,default:"#ffffff"}};function bf(e){var t,n;const i=document.createElementNS("http://www.w3.org/2000/svg","svg");return i.setAttribute("width",null!==(t=e.getAttribute("width"))&&void 0!==t?t:"1rem"),i.setAttribute("height",null!==(n=e.getAttribute("height"))&&void 0!==n?n:"1rem"),i.appendChild(e),i}function Cf(e,t){const n=document.createElementNS("http://www.w3.org/2000/svg","image");return n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22/%3E"),n.setAttribute("width",e),n.setAttribute("height",e),n}var _f;function If(){const e=function(){const e=document.createElement("div");e.id="shopar-main";const t=e.style;return t.position="absolute",t.top="0",t.bottom="0",t.left="0",t.right="0",t.pointerEvents="none",e}(),t=function(){const e=document.createElement("div");return e.style.textAlign="center",e}(),n=function(){const e=new Image;e.draggable=!1;const t=e.style;return t.maxWidth="100%",t.maxHeight="100%",e}(),i=function(e,t){const n=document.createElement("div"),i=n.style;i.position="absolute",i.top="0",i.left="0",i.width="100%",i.height="100%",i.display="none",i.pointerEvents="auto",i.userSelect="none";const r=document.createElement("div"),a=r.style;a.position="relative",a.top="0",a.left="0",a.width="100%",a.height="100%",a.display="flex",a.flexDirection="column",a.justifyContent="center",a.alignItems="center",a.background=L(k.bg),n.appendChild(r),r.appendChild(e);const o=document.createElement("div");return o.appendChild(t),r.appendChild(o),n}(t,n);e.appendChild(i);const r=function(){const e=document.createElement("div"),t=e.style;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",t.display="none",t.pointerEvents="auto",e}();e.appendChild(r);const a=document.createElement("div");a.dataset.placeholder="shopar-3d",e.appendChild(a);let o=null;const s=function(){const e=document.createElement("div");return e.style.textAlign="center",e.style.color=L(F.textColor),e}(),l=function(){const e=new Image;e.alt="",e.setAttribute("role","presentation");const{style:t}=e;return t.maxWidth=L(F.imgMaxWidth),t.maxHeight=L(F.imgMaxHeight),t.objectFit="contain",e}(),c=function(e,t){const n=document.createElement("div"),{style:i}=n;return i.position="absolute",i.width="100%",i.height="100%",i.opacity="0",i.display="flex",i.flexDirection="column",i.justifyContent="center",i.alignItems="center",i.gap=L(F.gap),i.backgroundColor=L(F.bg),i.transition="0.3s ease-in-out opacity",n.setAttribute("aria-hidden","true"),n.appendChild(e),n.appendChild(t),n}(s,l);e.appendChild(c);const h=function(){const e=document.createElement("div"),t=e.style;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",t.pointerEvents="auto",t.userSelect="none",t.display=L(O.containerDisplay),t.flexDirection="column",t.justifyContent="center",t.alignItems="center",t.gap=L(O.containerGap),t.backgroundColor=L(O.containerBg),e}(),A=function(e){const t=document.createElement("div");return t.textContent=e,t.style.textAlign="center",t}(R["loading.ar"]);h.appendChild(A);const u=function(){const e=document.createElement("div"),t=e.style;return t.position="relative",t.overflow="hidden",t.width=L(O.barWidth),t.height=L(O.barHeight),t.backgroundColor=L(O.barBg),t.borderRadius=L(O.barRadius),e}(),d=function(){const e=document.createElement("div"),t=e.style;return t.height="100%",t.width="0%",t.background=L(O.barFg),t.borderRadius=L(O.barRadius),t.transition="width 0.05s ease-out",e}(),p=function(){const e=document.createElement("div");return e.textContent="0%",e.style.textAlign="center",e}();u.appendChild(d),h.appendChild(u),h.appendChild(p),e.appendChild(h);const f=function(){const e=document.createElement("div");return e.style.textAlign="center",e}(),g=function(e){const t=document.createElement("div"),n=t.style;n.position="absolute",n.width="100%",n.height="100%",n.display="none",n.pointerEvents="auto",n.userSelect="none";const i=document.createElement("div"),r=i.style;return r.position="absolute",r.width="100%",r.height="100%",r.backgroundColor="#ffffff",r.display="flex",r.flexDirection="column",r.justifyContent="center",r.alignItems="center",t.appendChild(i),i.appendChild(e),t}(f);e.appendChild(g);const m=function(){const e=document.createElement("div");e.role="group",e.ariaLabel="Preview type chooser";const{style:t}=e;return t.display="none",t.position="absolute",t.width="100%",t.bottom="0",t.paddingBottom=L(N.paddingBottom),t.justifyContent="center",t.gap=L(N.gap),e}();e.appendChild(m);const v=Cf("1.75rem"),E=P("Try-on","Launch ShopAR virtual try-on",bf(v));m.appendChild(E);const b=Cf("1.75rem"),C=P("3D","Launch ShopAR 3D preview",bf(b));m.appendChild(C);const _=Cf("1.75rem"),I=P("Close","Close ShopAR view",bf(_));m.append(I);let x,y,M=_f.None,S=!1,B=!1,T=!1,D=!1;function Q(){d.style.width="100%",p.textContent="100%",h.style.visibility="hidden",d.style.width="0%",p.textContent="0%"}return{setTargetElement:function(t){t.style.position="relative",t.appendChild(e)},getQRTarget:function(){return i},getQRImage:function(){return n},getDeepARTarget:function(){return r},getDeepARPrompt:function(){return c},getThreeTarget:function(){return null==o&&(o=function(){const e=document.createElement("shopar-3d"),{style:t}=e;return t.position="absolute",t.top="0",t.left="0",t.width="100%",t.height="100%",t.pointerEvents="auto",t.display="none",t.background=L(Ef.bg),e}(),a.replaceWith(o)),o},hasThreeTarget:function(){return null!=o},removeThreeTarget:function(){null!=o&&(o.replaceWith(a),o=null)},customizeDeepARPrompt:function(e,t){s.textContent=e,l.src=t},customizeCameraError:function(e){f.textContent=null!=e?e:"Please reload page and allow camera access to continue"},customizeQRPrompt:function(e){t.textContent=null!=e?e:"Scan on mobile or tablet to try on"},setVisibilityParameters:function(e,t,n,i,r,a){var o;S=e,B=t,T=n,D=i,x=r,y=a,yf(m,S),yf(E,S&&(T||B)&&M===_f.None),yf(C,S&&D&&M===_f.None),yf(I,S&&M!==_f.None),Q(),S||""===(o=g).style.display&&xf(o,!1)},getUIState:function(){return M},setUIState:function(e){M=e,M===_f.None?(Q(),S&&(xf(g,!1),yf(I,!1),(B||T)&&yf(E,!0),D&&yf(C,!0))):M===_f.QR||M===_f.AR?S&&(xf(g,!1),yf(E,!1),yf(C,D&&"AR"===y),yf(I,"AR"!==y)):M===_f.Preview&&S&&(xf(g,!1),yf(E,(B||T)&&"3D"===y),yf(C,!1),yf(I,"3D"!==y))},setDefaultUIActions:function(e,t,n){S&&((B||T)&&(!function(e){const t={Glasses:"glasses.svg",Shoes:"shoe.svg",Watches:"watch.svg",Bracelets:"watch.svg",Scarves:"glasses.svg",Hats:"glasses.svg",Necklaces:"glasses.svg"},n=null!=e&&t[e]||t.Glasses,i=`${w()}/img/icons/${n}`;v.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i)}(x),E.onclick=e),D&&(b.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",`${w()}/img/icons/cube.svg`),C.onclick=t),_.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",`${w()}/img/icons/close.svg`),I.onclick=n)},startDeepARLoading:function(){d.style.width="0%",h.style.visibility="visible"},stopDeepARLoading:Q,updateDeepARLoadingProgress:function(e){d.style.width=`${e}%`,p.textContent=`${Math.floor(e)}%`},showCameraError:function(){S&&xf(g,!0)}}}function xf(e,t){e.style.display=t?"":"none"}function yf(e,t){e.style.display=t?"flex":"none"}!function(e){e[e.None=0]="None",e[e.QR=1]="QR",e[e.AR=2]="AR",e[e.Preview=3]="Preview"}(_f||(_f={}));const Mf=new Map;function wf(e){let t=Mf.get(e);return null==t?(t=function(){let e=0,t=null,n=null,i=!0;const r=()=>(null==t&&(t=If()),t);return{getSetupId:()=>e,incrementSetupId_:()=>e++,getUI_:()=>t,findUI:r,findQR:()=>{if(null==n){const{getQRTarget:e,getQRImage:t}=r();n=T(e(),t())}return n},isInteractive:()=>i,setInteractive:e=>{i=e,(null==t?void 0:t.hasThreeTarget())&&(t.getThreeTarget().interactivityDisabled=!e)}}}(),Mf.set(e,t)):t.incrementSetupId_(),t}function Sf(e){for(const t of Mf.values()){if(t===e)continue;const n=t.getUI_();if(null==n)continue;const{getUIState:i,setUIState:r}=n;i()===_f.AR&&r(_f.None)}}const Bf=[];for(let e=0;e<256;++e)Bf.push((e+256).toString(16).slice(1));let Tf;const Rf=new Uint8Array(16);var Df={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Qf(e,t,n){const i=(e=e||{}).random??e.rng?.()??function(){if(!Tf){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Tf=crypto.getRandomValues.bind(crypto)}return Tf(Rf)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,function(e,t=0){return(Bf[e[t+0]]+Bf[e[t+1]]+Bf[e[t+2]]+Bf[e[t+3]]+"-"+Bf[e[t+4]]+Bf[e[t+5]]+"-"+Bf[e[t+6]]+Bf[e[t+7]]+"-"+Bf[e[t+8]]+Bf[e[t+9]]+"-"+Bf[e[t+10]]+Bf[e[t+11]]+Bf[e[t+12]]+Bf[e[t+13]]+Bf[e[t+14]]+Bf[e[t+15]]).toLowerCase()}(i)}function Lf(e,t,n){return Df.randomUUID&&!e?Df.randomUUID():Qf(e)}var Uf="undefined"!=typeof Float32Array?Float32Array:Array;function Pf(){var e=new Uf(16);return Uf!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function Nf(e,t){var n=t[0],i=t[1],r=t[2],a=t[3],o=t[4],s=t[5],l=t[6],c=t[7],h=t[8],A=t[9],u=t[10],d=t[11],p=t[12],f=t[13],g=t[14],m=t[15],v=n*s-i*o,E=n*l-r*o,b=n*c-a*o,C=i*l-r*s,_=i*c-a*s,I=r*c-a*l,x=h*f-A*p,y=h*g-u*p,M=h*m-d*p,w=A*g-u*f,S=A*m-d*f,B=u*m-d*g,T=v*B-E*S+b*w+C*M-_*y+I*x;return T?(T=1/T,e[0]=(s*B-l*S+c*w)*T,e[1]=(r*S-i*B-a*w)*T,e[2]=(f*I-g*_+m*C)*T,e[3]=(u*_-A*I-d*C)*T,e[4]=(l*M-o*B-c*y)*T,e[5]=(n*B-r*M+a*y)*T,e[6]=(g*b-p*I-m*E)*T,e[7]=(h*I-u*b+d*E)*T,e[8]=(o*S-s*M+c*x)*T,e[9]=(i*M-n*S-a*x)*T,e[10]=(p*_-f*b+m*v)*T,e[11]=(A*b-h*_-d*v)*T,e[12]=(s*y-o*w-l*x)*T,e[13]=(n*w-i*y+r*x)*T,e[14]=(f*E-p*C-g*v)*T,e[15]=(h*C-A*E+u*v)*T,e):null}function Ff(e,t,n){var i=t[0],r=t[1],a=t[2],o=t[3],s=t[4],l=t[5],c=t[6],h=t[7],A=t[8],u=t[9],d=t[10],p=t[11],f=t[12],g=t[13],m=t[14],v=t[15],E=n[0],b=n[1],C=n[2],_=n[3];return e[0]=E*i+b*s+C*A+_*f,e[1]=E*r+b*l+C*u+_*g,e[2]=E*a+b*c+C*d+_*m,e[3]=E*o+b*h+C*p+_*v,E=n[4],b=n[5],C=n[6],_=n[7],e[4]=E*i+b*s+C*A+_*f,e[5]=E*r+b*l+C*u+_*g,e[6]=E*a+b*c+C*d+_*m,e[7]=E*o+b*h+C*p+_*v,E=n[8],b=n[9],C=n[10],_=n[11],e[8]=E*i+b*s+C*A+_*f,e[9]=E*r+b*l+C*u+_*g,e[10]=E*a+b*c+C*d+_*m,e[11]=E*o+b*h+C*p+_*v,E=n[12],b=n[13],C=n[14],_=n[15],e[12]=E*i+b*s+C*A+_*f,e[13]=E*r+b*l+C*u+_*g,e[14]=E*a+b*c+C*d+_*m,e[15]=E*o+b*h+C*p+_*v,e}function Of(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function kf(e,t){var n=t[0],i=t[1],r=t[2],a=t[4],o=t[5],s=t[6],l=t[8],c=t[9],h=t[10];return e[0]=Math.hypot(n,i,r),e[1]=Math.hypot(a,o,s),e[2]=Math.hypot(l,c,h),e}function Gf(e,t){var n=new Uf(3);kf(n,t);var i=1/n[0],r=1/n[1],a=1/n[2],o=t[0]*i,s=t[1]*r,l=t[2]*a,c=t[4]*i,h=t[5]*r,A=t[6]*a,u=t[8]*i,d=t[9]*r,p=t[10]*a,f=o+h+p,g=0;return f>0?(g=2*Math.sqrt(f+1),e[3]=.25*g,e[0]=(A-d)/g,e[1]=(u-l)/g,e[2]=(s-c)/g):o>h&&o>p?(g=2*Math.sqrt(1+o-h-p),e[3]=(A-d)/g,e[0]=.25*g,e[1]=(s+c)/g,e[2]=(u+l)/g):h>p?(g=2*Math.sqrt(1+h-o-p),e[3]=(u-l)/g,e[0]=(s+c)/g,e[1]=.25*g,e[2]=(A+d)/g):(g=2*Math.sqrt(1+p-o-h),e[3]=(s-c)/g,e[0]=(u+l)/g,e[1]=(A+d)/g,e[2]=.25*g),e}function Hf(){var e=new Uf(3);return Uf!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function zf(e,t,n){var i=new Uf(3);return i[0]=e,i[1]=t,i[2]=n,i}function Vf(e,t){var n=t[0]-e[0],i=t[1]-e[1],r=t[2]-e[2];return Math.hypot(n,i,r)}function Wf(e,t,n){var i=t[0],r=t[1],a=t[2],o=n[3]*i+n[7]*r+n[11]*a+n[15];return o=o||1,e[0]=(n[0]*i+n[4]*r+n[8]*a+n[12])/o,e[1]=(n[1]*i+n[5]*r+n[9]*a+n[13])/o,e[2]=(n[2]*i+n[6]*r+n[10]*a+n[14])/o,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function qf(){var e=new Uf(4);return Uf!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}Hf(),function(){var e,t=(e=new Uf(4),Uf!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e)}();var jf;Hf(),zf(1,0,0),zf(0,1,0),qf(),qf(),jf=new Uf(9),Uf!=Float32Array&&(jf[1]=0,jf[2]=0,jf[3]=0,jf[5]=0,jf[6]=0,jf[7]=0),jf[0]=1,jf[4]=1,jf[8]=1;async function Yf(){const e=await async function(){const e=await fetch("data:application/octet-stream;base64,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");return await function(e={}){var t,n,i,r,a,o=e,s=new Promise((e,n)=>{t=e}),l={1076:e=>{const t=[e,Date.now()],n=t.length-2,r=["addEventListener","alert","atob","blur","btoa","cancelAnimationFrame","localStorage","location","locationbar","hash","hasOwnProperty","host","hostname","href","requestAnimationFrame","navigator","userAgent"],a=[2,12,7,1],o=window[r[r[a[a[a.length-1]]+2].length-a[t.length]+1]][r[Math.pow(a[n],r[a.length].length)]]||"no user agent",s=c(32);for(let e=0;e<32;++e)i[s+e]=o.charCodeAt(e%o.length);return s},1870:e=>{var t,n=function(){var e;try{e=Function('return (function() {}.constructor("return this")( ));')()}catch(t){e=window}return e}(),r=Date.now();for(var a in n)if(8==a.length&&110==a.charCodeAt(7)&&105==a.charCodeAt(5)&&97==a.charCodeAt(3)&&108==a.charCodeAt(0)){r=a,t=e;break}for(var o in n[r])if(8==o.length&&97==o.charCodeAt(5)&&104==o.charCodeAt(0)){t=o;break}const s=n[r][t]||"no hostname",l=c(32);for(let e=0;e<32;++e)i[l+e]=s.charCodeAt(e%s.length);return l}};o.noExitRuntime;var c,h=[],A=(e,t,o)=>{var s=((e,t)=>{var o;for(h.length=0;o=i[e++];){var s=105!=o;t+=(s&=112!=o)&&t%8?4:0,h.push(112==o?r[t>>2]:105==o?n[t>>2]:a[t>>3]),t+=s?8:4}return h})(t,o);return l[e](...s)},u={a:{a:(e,t,n)=>A(e,t,n),c:()=>Date.now(),b:e=>{i.length,function(){throw"OOM"}()}}};return WebAssembly.instantiate(o.wasm,u).then(e=>{var s,l=e.instance.exports;o._magic=l.f,o._free=l.g,o._malloc=c=l.i,s=l.d.buffer,o.HEAPU8=i=new Uint8Array(s),n=new Int32Array(s),r=new Uint32Array(s),a=new Float64Array(s),function(e){e.e()}(l),t(o)}),s}({wasm:await e.arrayBuffer()})}();return function(t){const n=e._malloc(32);for(let i=0;i<t.size()&&i<32;i++)e.HEAPU8[n+i]=t.get(i);const i=e._malloc(64);e._magic(n,i);const r=new Uint8Array(64);for(let t=0;t<64;++t)r[t]=e.HEAPU8[i+t];return e._free(n),e._free(i),r}}let Xf,Kf,Jf,Zf,$f,eg,tg=!1,ng=null,ig=[],rg=[];function ag(e){return h(this,void 0,void 0,function*(){tg=!1;const{ShopAR__TrueScale:t}=window;yield t.initialize(`${w()}/wasm/mediapipe`,e),ng&&clearInterval(ng);const n=[],i=[];ng=setInterval(()=>h(this,void 0,void 0,function*(){if(tg)return;const{error:e,faceWidth:r,ipd:a,translation:o,rotation:s}=yield t.predict(performance.now());tg||(null!=o&&null!=s&&function(e){for(let t of ig)t(e)}({translation:o,rotation:s}),null==e&&(n.push(r),i.push(a),n.length<10||(n.shift(),i.shift(),function(e,t){for(let n of rg)n({faceWidth:e,IPD:t})}(sg(n),sg(i)))))}),200)})}function og(){rg=[],ig=[],tg=!0}function sg(e){let t=0;const n=e.length;for(let i=0;i<n;i++)t+=e[i];return t/n}let lg=null;const cg=new Set;let hg,Ag,ug,dg,pg,fg,gg=!1;function mg(){null==Xf&&(Xf=S(`${w()}/shopar-deepar.js`,"ShopAR__DeepAR"))}function vg(){null==Kf&&(Kf=S(`${w()}/shopar-true-scale.js`,"ShopAR__TrueScale"))}function Eg(e){return h(this,void 0,void 0,function*(){const{licenseKey:t,truescaleUsecase:n,onProgress:i,effectUrl:r,effectOptions:a}=e;a&&null==a.envmap&&(a.envmap=`${w()}/deepar/default_envmap.webp`),pg=n;const o=null!=e.videoConfig;return null==hg&&(hg=(()=>h(this,void 0,void 0,function*(){gg=!1;const n=function(e){var t;const n={Glasses:"user",Shoes:"environment",Watches:"environment",Bracelets:"environment",Hats:"user",Scarves:"user",Necklaces:"user"};return null==e?"user":null!==(t=n[e])&&void 0!==t?t:"user"}($f);try{Jf=yield window.ShopAR__DeepAR.deepar.initialize({licenseKey:t||"your_license_key_goes_here",previewElement:eg,effect:r,effectOptions:a,rootPath:`${w()}/deepar`,additionalOptions:{hint:fg,cameraConfig:{disableDefaultCamera:o,facingMode:n},pixelRatio:Math.min(window.devicePixelRatio,2),onVerify:yield Yf()},onProgress:i})}catch(e){throw hg=null,e}Jf.setWatchTicking("Watches"===$f),o&&Jf.setVideoElement(e.videoConfig.video,null==e?void 0:e.videoConfig.mirror),"Glasses"===$f&&null==e.customTrueScaleFaceWidth?(yield Kf,Zf=Jf.getVideoElement(),ag(Zf),"DetectionLoop"!==pg&&Gg(e=>{dg=e.faceWidth})):"Glasses"===$f&&null!=e.customTrueScaleFaceWidth&&(dg=e.customTrueScaleFaceWidth),gg=!0,Dg(),eg.style.display=""}))()),hg})}function bg(e,t){t=null!=t?t:function(e){const t={Glasses:["rigidFaceTrackingInit","faceInit"],Shoes:["footInit"],Watches:["wristInit"],Bracelets:["wristInit"],Hats:["rigidFaceTrackingInit","faceInit"],Scarves:["rigidFaceTrackingInit","faceInit"],Necklaces:["rigidFaceTrackingInit","faceInit"]};return null==e?void 0:t[e]}(e),e===$f&&function(e,t){return e===t||null!=e&&null!=t&&e.length===t.length&&e.every(e=>t.find(t=>e===t))&&t.every(t=>e.find(e=>e===t))}(t,fg)||($f=e,fg=t)}function Cg(e){Qg(),e!==eg&&(eg=e,null!=Jf&&Jf.changePreviewElement(eg,Math.min(window.devicePixelRatio,2)))}function _g(e){lg=e}function Ig(e,t){Jf.callbacks.onFaceTracked=n=>{var i;if(n.some(e=>e.detected)){if(dg){const e=137/(dg+5);Jf.changeParameterVector("GLASSES","","scale",e,e,e,0),Jf.changeParameterVector("shopar_glasses","","scale",e,e,e,0),function(e){const t=[-8.362421,4.549,-9.275],n=[8.362421,4.549,-9.275];try{const i=Jf.getTransformationBetween("face_position","temples"),r=Og(i,"temple_left","temple_left_outer","temple_tip_outer_left",n,e).map(Ug),a=Og(i,"temple_right","temple_right_outer","temple_tip_outer_right",t,e).map(Ug);Jf.changeParameterVector("temple_left","","rotation",r[0],r[1],r[2],0),Jf.changeParameterVector("temple_right","","rotation",a[0],a[1],a[2],0)}catch(e){return}}(e),og(),dg=null}e(),Lg("Glasses")}null===(i=null==t?void 0:t.onFaceTracked)||void 0===i||i.call(t,n)},Jf.callbacks.onFeetTracked=(n,i)=>{var r;(n.detected||i.detected)&&(e(),Lg("Shoes")),null===(r=null==t?void 0:t.onFeetTracked)||void 0===r||r.call(t,n,i)},Jf.callbacks.onWristTracked=n=>{var i;n.detected&&(e(),Lg("Watches")),null===(i=null==t?void 0:t.onWristTracked)||void 0===i||i.call(t,n)}}function xg(e){dg=e}function yg(e){null==Jf||Jf.setStatsCapture(e)}function Mg(e,t,n){return h(this,void 0,void 0,function*(){return null!=Ag&&ug===n||(yield Ag,t.trackingInit={face:(null==fg?void 0:fg.includes("rigidFaceTrackingInit"))||(null==fg?void 0:fg.includes("faceInit")),foot:null==fg?void 0:fg.includes("footInit"),wrist:null==fg?void 0:fg.includes("wristInit")},null==t.envmap&&(t.envmap=`${w()}/deepar/default_envmap.webp`),Ag=Jf.switchEffect(e,t),Jf.setWatchTicking("Watches"===$f),ug=n,Dg(),eg.style.display=""),Ag})}function wg(e,t){null!=e&&null!=t&&(Jf.setToneMapping(e),Jf.setExposure(t))}function Sg(e,t,n,i){Jf.setBloomEnabled(!!e),null!=t&&Jf.setBloomStrength(t),null!=n&&Jf.setBloomRadius(n),null!=i&&Jf.setBloomThreshold(i)}function Bg(){null!=Jf&&(og(),null!=Zf&&null!=Zf.srcObject&&Zf.srcObject instanceof MediaStream&&(Zf.srcObject.getTracks().forEach(e=>e.stop()),Zf=null),Jf.shutdown(),Qg(),gg=!1,Jf=null,hg=null,eg.style.display="none")}function Tg(){return gg}function Rg(e){Jf.setVideoElement(e.video,e.mirror)}function Dg(){null!=lg&&(null==$f||cg.has($f)||(lg.removeAttribute("aria-hidden"),lg.style.visibility="visible",lg.style.opacity="1"))}function Qg(){null!=lg&&(lg.setAttribute("aria-hidden","true"),lg.style.visibility="hidden",lg.style.opacity="0")}function Lg(e){null!=lg&&(cg.has(e)||(cg.add(e),lg.setAttribute("aria-hidden","true"),lg.style.opacity="0"))}function Ug(e){return 180*e/Math.PI}function Pg(e,t){let n=t[0],i=t[1],r=t[2],a=t[3],o=n*n,s=i*i,l=r*r;return e[0]=Math.atan2(2*(a*n+i*r),1-2*(o+s)),e[1]=-Math.PI/2+2*Math.atan2(Math.sqrt(1+2*(a*i-n*r)),Math.sqrt(1-2*(a*i-n*r))),e[2]=Math.atan2(2*(a*r+n*i),1-2*(s+l)),e}function Ng(e,t,n){const i=Nf(Pf(),e),r=function(e,t){var n=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}(Pf(),-n),a=Ff(Pf(),i,r),o=Ff(Pf(),a,e),s=Ff(Pf(),o,t),l=Gf(qf(),s);return Pg(Hf(),l)}function Fg(e,t){let n=Jf.getTransformationBetween("face_position",t);const i=Pg(Hf(),Gf(qf(),n)).map(Ug);n=function(e,t,n,i){var r=t[0],a=t[1],o=t[2],s=t[3],l=r+r,c=a+a,h=o+o,A=r*l,u=r*c,d=r*h,p=a*c,f=a*h,g=o*h,m=s*l,v=s*c,E=s*h,b=i[0],C=i[1],_=i[2];return e[0]=(1-(p+g))*b,e[1]=(u+E)*b,e[2]=(d-v)*b,e[3]=0,e[4]=(u-E)*C,e[5]=(1-(A+g))*C,e[6]=(f+m)*C,e[7]=0,e[8]=(d+v)*_,e[9]=(f-m)*_,e[10]=(1-(A+p))*_,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}(Pf(),function(e,t,n,i){var r=.5*Math.PI/180;t*=r,n*=r,i*=r;var a=Math.sin(t),o=Math.cos(t),s=Math.sin(n),l=Math.cos(n),c=Math.sin(i),h=Math.cos(i);return e[0]=a*l*h-o*s*c,e[1]=o*s*h+a*l*c,e[2]=o*l*c-a*s*h,e[3]=o*l*h+a*s*c,e}(qf(),i[0],0,i[2]),Of(Hf(),n),kf(Hf(),n));const r=Nf(Pf(),e);return Ff(Pf(),r,n)}function Og(e,t,n,i,r,a){let o=Fg(e,t);const s=Ff(Pf(),e,o),l=Wf(Hf(),Of(Hf(),s),function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}(Pf(),[a,a,a])),c=Math.atan2(r[0]-l[0],Math.abs(r[2]-l[2]));let h;try{h=Jf.getTransformationBetween(t,n)}catch(t){return Ng(e,o,c)}const A=Ff(Pf(),s,h),u=zf(l[0],r[1],r[2]),d=Wf(Hf(),u,Nf(Pf(),A));let p=Jf.getClosestPointOnMesh(n,d);try{const e=Jf.getClosestPointOnMesh(i,d);Vf(d,e)<Vf(d,p)&&(p=e)}catch(e){}const f=Wf(Hf(),p,A);return Ng(e,o,c-Math.atan2(f[0]-l[0],Math.abs(f[2]-l[2])))}function kg(e){!function(e){ig.push(e)}(e)}function Gg(e){!function(e){rg.push(e)}(e)}function Hg(e){let t,n=!1,i=!1;return{onTracked(r,a){if(!n&&a)if(i){if(r-t>=2e3){const{Fps:t,"Engine update":r,"Face tracking":a,"Foot tracking time":o,"Wrist tracking time":s}=null==Jf?void 0:Jf.getStats();yg(!1),n=!0,i=!1,e({fps:t,tickDuration:r.avg,faceTrackDuration:a.avg,footTrackDuration:o.avg,wristTrackDuration:s.avg})}}else i=!0,t=r,yg(!0);i&&!a&&(i=!1,yg(!1))}}}function zg(){let e=!1,t=0,n=0;return{get dirty(){return e},clearDirty(){e=!1},get engagementMs(){return Math.round(t)},interact(i){const r=i-n;n=i,r<200&&(t+=r,e=!0)}}}function Vg(){let e,t,n=0,i=0,r=2e3;return{set debounceDurationMs(e){r=null!=e?e:2e3},set onDebouncedEngagement(e){t=e},interact(a){const o=a-i;i=a,o<200&&(n+=o),e&&clearTimeout(e),e=setTimeout(()=>{n>0&&t&&(t(Math.round(n)),n=0,i=0),e=void 0},r)},flush(){e&&(clearTimeout(e),e=void 0,n>0&&t&&(t(Math.round(n)),n=0,i=0))}}}const Wg="arRecord",qg="previewPerf",jg=45e3;function Yg(e){let t=0,n=0;const i=[],r=[],a=[];let o,s=1,l=1,c=1,h=-1,A=jg,u=!1;function d(){let e=0;for(let t=0;t<i.length;t++)e+=+i[t].detected,e+=+r[t].detected;const n=5*i.length+28*e,o=new ArrayBuffer(n),h=new DataView(o);let A=0;for(let e=0;e<i.length;e++){const t=i[e],n=r[e];h.setFloat32(A,a[e],!0),A+=4,h.setUint8(A++,+t.detected+(+n.detected<<1)),t.detected&&(h.setFloat32(A+0,t.position[0],!0),h.setFloat32(A+4,t.position[1],!0),h.setFloat32(A+8,t.position[2],!0),A+=12,h.setFloat32(A+0,t.rotation[0],!0),h.setFloat32(A+4,t.rotation[1],!0),h.setFloat32(A+8,t.rotation[2],!0),h.setFloat32(A+12,t.rotation[3],!0),A+=16),n.detected&&(h.setFloat32(A+0,n.position[0],!0),h.setFloat32(A+4,n.position[1],!0),h.setFloat32(A+8,n.position[2],!0),A+=12,h.setFloat32(A+0,n.rotation[0],!0),h.setFloat32(A+4,n.rotation[1],!0),h.setFloat32(A+8,n.rotation[2],!0),h.setFloat32(A+12,n.rotation[3],!0),A+=16)}if(0===t){const e=function(){var e,t,n,i;return{width:null!==(t=null===(e=null==Jf?void 0:Jf.getVideoElement())||void 0===e?void 0:e.videoWidth)&&void 0!==t?t:0,height:null!==(i=null===(n=null==Jf?void 0:Jf.getVideoElement())||void 0===n?void 0:n.videoHeight)&&void 0!==i?i:0}}(),t=function(){var e,t,n,i;return{width:null!==(t=null===(e=null==Jf?void 0:Jf.getCanvas())||void 0===e?void 0:e.width)&&void 0!==t?t:0,height:null!==(i=null===(n=null==Jf?void 0:Jf.getCanvas())||void 0===n?void 0:n.height)&&void 0!==i?i:0}}();s=e.width/e.height,l=t.width/t.height,c=function(){var e;return null!==(e=null==Jf?void 0:Jf.getFov())&&void 0!==e?e:85}()}return{recordType:"FOOT",idx:t++,arRecord:btoa(String.fromCharCode.apply(null,new Uint8Array(o))),cameraAspect:s,canvasAspect:l,fov:c}}function p(){if(i.length>0){const t=d();e(t),i.length=0,r.length=0,a.length=0}}return{start(e=45e3){u||(A=e>jg?jg:e,u=!0,o=window.setInterval(()=>{p()},1e3))},stop(){u&&(p(),clearInterval(o),t=0,n=0,i.length=0,r.length=0,a.length=0,u=!1)},onFeetTracked(e,o){if(!u)return;const s=performance.now();h<0&&(h=s),s-h>A?stop():(i.push(e),r.push(o),0===t&&0===a.length?a.push(0):a.push(s-n),n=s)}}}let Xg,Kg,Jg=!1;const Zg=window.navigator.userAgent||"no user agent",$g=[];function em(){null==Xg&&(Kg=Lf(),Xg=S(`${w()}/shopar-analytics.js`,"ShopAR__analytics"),Xg.then(()=>{Jg=!0,window.ShopAR__analytics.initializeImpl(),$g.forEach(e=>e())}))}function tm(e,t){const n=performance.now(),i=Lf(),r=zg(),a=zg(),o=Vg(),s=Vg();window.setInterval(()=>{if(r.dirty||a.dirty){const e=r.engagementMs,t=a.engagementMs,n=e+t;r.clearDirty(),a.clearDirty(),h("heartbeat",{engagementTotal:n,engagementAR:e,engagement3D:t})}},1e3);const l=(r,a={})=>({name:r,props:a=Object.assign(Object.assign({},a),{userAgent:Zg,hostname:window.location.hostname,href:window.location.href,pluginVersion:x,sessionId:Kg,setupId:i,timeSinceSetup:performance.now()-n,sku:e,apiKey:t})}),c=({name:e,props:t})=>{nm(()=>{window.ShopAR__analytics.trackEventImpl(e,t)})},h=(e,t={})=>{c(l(e,t))},A=function(e){const t=Hg(e),n=Hg(e),i=Hg(e);return{onFaceTracked(e){e.length>0&&t.onTracked(performance.now(),e[0].detected)},onFeetTracked(e,t){n.onTracked(performance.now(),e.detected&&t.detected)},onWristTracked(e){i.onTracked(performance.now(),e.detected)}}}(e=>{h("arPerf",e)}),{footRecorder:u,onFeetTracked:d}=function(e){const t=Yg(e);return{footRecorder:t,onFeetTracked(e,n){t.onFeetTracked(e,n)}}}(e=>{0===e.idx?h(Wg,e):((e,t={})=>{c({name:e,props:Object.assign(Object.assign({},t),{sessionId:Kg,setupId:i})})})(Wg,{idx:e.idx,arRecord:e.arRecord})}),p=(f=[A,{onFeetTracked:d}],{onFaceTracked:e=>{var t;for(const n of f)null===(t=n.onFaceTracked)||void 0===t||t.call(n,e)},onFeetTracked:(e,t)=>{var n;for(const i of f)null===(n=i.onFeetTracked)||void 0===n||n.call(i,e,t)},onWristTracked:e=>{var t;for(const n of f)null===(t=n.onWristTracked)||void 0===t||t.call(n,e)}});var f;return{prepareEvent:l,submitEvent:c,trackEvent:h,arInteracted:()=>{const e=performance.now();r.interact(e),o.interact(e)},previewInteracted:()=>{const e=performance.now();a.interact(e),s.interact(e)},setDebounceAREngagementMs:e=>{o.debounceDurationMs=e},setOnDebouncedAREngagement:e=>{o.onDebouncedEngagement=e},setDebouncePreviewEngagementMs:e=>{s.debounceDurationMs=e},setOnDebouncedPreviewEngagement:e=>{s.onDebouncedEngagement=e},flushEngagementCallbacks:()=>{o.flush(),s.flush()},arTrackingEvents:p,footRecorder:u}}function nm(e){Jg?e():$g.push(e)}function im(e,t,n,i,r,a){let o,s,l=0,c=0;return{launched(){o=performance.now(),l=0,c=0,r(e)},loaded(){s=performance.now(),r(t,{duration:s-o})},failed(e){r(n,{errorName:A(e),errorMessage:u(e),errorStack:d(e),duration:performance.now()-o})},interacted(){if(null==a||a(),null==o)return;const e=performance.now(),t=e-c;c=e,t<200&&(l+=t)},closed(e){if(null==o)return;const t=null!=s;r(i,{duration:t?performance.now()-s:void 0,engagement:t?Math.round(l):void 0,trigger:e,loaded:t}),o=void 0,s=void 0,l=0,c=0}}}const rm=.1,am="function"==typeof Float32Array;function om(e,t,n,i){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(e===t&&n===i)return um;const r=am?new Float32Array(11):new Array(11);for(let t=0;t<11;++t)r[t]=hm(t*rm,e,n);function a(t){let i=0,a=1;for(;10!==a&&r[a]<=t;++a)i+=rm;--a;const o=i+(t-r[a])/(r[a+1]-r[a])*rm,s=Am(o,e,n);return s>=.001?function(e,t,n,i){for(let r=0;r<4;++r){const r=Am(t,n,i);if(0===r)return t;t-=(hm(t,n,i)-e)/r}return t}(t,o,e,n):0===s?o:function(e,t,n,i,r){let a,o,s=0;do{o=t+(n-t)/2,a=hm(o,i,r)-e,a>0?n=o:t=o}while(Math.abs(a)>1e-7&&++s<10);return o}(t,i,i+rm,e,n)}return function(e){return 0===e||1===e?e:hm(a(e),t,i)}}function sm(e,t){return 1-3*t+3*e}function lm(e,t){return 3*t-6*e}function cm(e){return 3*e}function hm(e,t,n){return((sm(t,n)*e+lm(t,n))*e+cm(t))*e}function Am(e,t,n){return 3*sm(t,n)*e*e+2*lm(t,n)*e+cm(t)}function um(e){return e}function dm(e){if("hold"===e.type)return()=>0;if("bezier"===e.type){const t=om(e.x1,e.y1,e.x2,e.y2);return e=>t(e)}throw new Error(`Unknown interpolation: ${e}`)}function pm(e){if(e.length<2)throw new Error("Expected at least two key frames.");const t=e[e.length-1].time,n=[...e].sort((e,t)=>e.time-t.time).map(({time:e,value:t,interpolation:n})=>({time:e,value:t,interpolate:dm(n)}));let i=0,r=n[0].value;return{reset:()=>{i=0},update:e=>{for(i+=e;i>=t;)i-=t;for(let e=0;e<n.length-1;e++){const t=n[e],a=n[e+1];if(i>=t.time&&i<a.time){const e=t.interpolate((i-t.time)/(a.time-t.time));r=t.value+e*(a.value-t.value)}}},get:()=>r}}const fm="time",gm="interpolation",mm="pitch",vm=[fm,"yaw",mm,"fov",gm],Em="s",bm="ms",Cm=Math.PI/180,_m="ease-in-out",Im="cubic-bezier(";function xm(e){if("string"==typeof e)return function(e){const[t,...n]=function(e){return e.split(/\r?\n/).map(e=>function(e){const t=e.indexOf("#");return(-1!==t?e.substring(0,t):e).trim()}(e)).filter(e=>""!==e)}(e);if(null==t)throw new Error("Header missing.");const i=function(e){const t=[];for(let n=0;n<e.length;n++){const i=e[n];if(!vm.includes(i))throw new Error(`Invalid token in header: '${i}'.`);if(t.includes(i))throw new Error(`Duplicate token in header: '${i}'.`);t.push(i)}if(!t.includes(fm))throw new Error(`Missing required token: '${fm}'.`);return t}(t.split(/\s+/)),r={};if(n.length<2)throw new Error("Expected at least two key frames.");for(const e of n){const{theta:t,phi:n,fov:a}=ym(i,e);null!=t&&(null==r.theta&&(r.theta=[]),r.theta.push(t)),null!=n&&(null==r.phi&&(r.phi=[]),r.phi.push(n)),null!=a&&(null==r.fov&&(r.fov=[]),r.fov.push(a))}if(0===Object.values(r).length)throw new Error("At least one parameter should be animated.");return r}(e);if(Array.isArray(e))return function(e){var t;const n={};if(e.length<2)throw new Error("Expected at least two key frames.");for(const i of e){const{time:e,pitch:r,yaw:a,fov:o}=i;if(null==e)throw new Error("Time missing.");const s=wm(null!==(t=i.interpolation)&&void 0!==t?t:_m);null!=a&&(null==n.theta&&(n.theta=[]),n.theta.push({time:e,value:a*Cm,interpolation:s})),null!=r&&(null==n.phi&&(n.phi=[]),n.phi.push({time:e,value:r*Cm,interpolation:s})),null!=o&&(null==n.fov&&(n.fov=[]),n.fov.push({time:e,value:o*Cm,interpolation:s}))}if(0===Object.values(n).length)throw new Error("At least one parameter should be animated.");if(Object.values(n).every(t=>t.length!==e.length))throw new Error("All parameters should have the same key frame count.");return n}(e);throw new Error("Expected string or key frame config array.")}function ym(e,t){const n=t.match(/[^()\s]+(\(.*?\))?/g);if(null==n||n.length<e.length)throw new Error(`Missing data for fields: '${e.filter(e=>!(null==n?void 0:n.includes(e))).join(", ")}'.`);if(n.length>e.length)throw new Error(`Excess data: '${n.filter(t=>!e.includes(t)).join(", ")}'.`);const i=e.indexOf(fm),r=function(e){if(e.endsWith(bm))return Bm(e.substring(0,e.length-2));if(e.endsWith(Em))return 1e3*Bm(e.substring(0,e.length-1));return Bm(e)}(n[i]),a=e.indexOf(gm),o=wm(-1===a?_m:n[a]),s={};for(let t=0;t<n.length;t++){if(t===i||t===a)continue;const l=e[t],c=n[t];switch(l){case"yaw":s.theta={time:r,value:Mm(c),interpolation:o};break;case mm:s.phi={time:r,value:Mm(c),interpolation:o};break;case"fov":s.fov={time:r,value:Mm(c),interpolation:o};break;default:throw new Error(`Unhandled value for header '${l}'.`)}}return s}function Mm(e){return e.endsWith("deg")?Bm(e.substring(0,e.length-3))*Cm:e.endsWith("rad")?Bm(e.substring(0,e.length-3)):Bm(e)*Cm}function wm(e){if("hold"===e)return{type:"hold"};if("linear"===e)return Sm(0,0,1,1);if("sine"===e)return Sm(.37,0,.63,1);if("sine-in"===e)return Sm(.12,0,.39,0);if("sine-out"===e)return Sm(.61,1,.88,1);if("ease"===e)return Sm(.25,.1,.25,1);if("ease-in"===e)return Sm(.42,0,1,1);if("ease-out"===e)return Sm(0,0,.58,1);if("ease-in-out"===e)return Sm(.42,0,.58,1);if(e.startsWith(Im)&&e.endsWith(")")){const t=e.substring(13,e.length-1).split(/\s*,\s*/);if(4!==t.length)throw new Error(`Expected 4 parameters for the Bezier curve, but got '${t}'.`);return{type:"bezier",x1:Bm(t[0]),y1:Bm(t[1]),x2:Bm(t[2]),y2:Bm(t[3])}}throw new Error(`Expected an interpolation token, but found: ${e}`)}function Sm(e,t,n,i){return{type:"bezier",x1:e,y1:t,x2:n,y2:i}}function Bm(e){const t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error(`Expected a numeric value, but got: ${e}`);return t}var Tm;function Rm(){return[Tm.Android,Tm.iOS,Tm.Tablet].includes(function(){if("undefined"!=typeof window&&window.navigator){const e=window.navigator.userAgent,t=window.navigator.platform||"",n=["Macintosh","MacIntel","MacPPC","Mac68K"],i=["Win32","Win64","Windows","WinCE"],r=["iPhone","iPod","iPad"],a="ontouchstart"in window||navigator.maxTouchPoints>0;return-1!==r.indexOf(t)?Tm.iOS:-1!==n.indexOf(t)?a?Tm.Tablet:Tm.MacOS:-1!==i.indexOf(t)?Tm.Windows:/Android/.test(e)?Tm.Android:/Linux/.test(t)?Tm.Linux:a?Tm.Tablet:Tm.Unknown}return Tm.Unknown}())}!function(e){e[e.Unknown=0]="Unknown",e[e.Android=1]="Android",e[e.iOS=2]="iOS",e[e.Tablet=3]="Tablet",e[e.MacOS=4]="MacOS",e[e.Windows=5]="Windows",e[e.Linux=6]="Linux"}(Tm||(Tm={}));const Dm=["demo.deepar.ai","dbeochk72stb2.cloudfront.net","d1q93hnxt3ps3w.cloudfront.net","dj5e08oeu5ym4.cloudfront.net"];function Qm(e,{trustUrls:t=!1}={}){const n=Object.assign({},e);if(n.category&&!qc.includes(n.category))throw new a(`Invalid response category: ${e.category}`);if(n.arToneMapping&&!jc.includes(n.arToneMapping))throw new a(`Invalid tone mapping: ${e.arToneMapping}`);if(n.previewToneMapping&&!jc.includes(n.previewToneMapping))throw new a(`Invalid tone mapping: ${e.previewToneMapping}`);const i=t?Lm:Um;return n.arUrl=n.arUrl?i(n.arUrl):void 0,n.arEnvUrl=n.arEnvUrl?i(n.arEnvUrl):void 0,n.arDiamondEnvUrl=n.arDiamondEnvUrl?i(n.arDiamondEnvUrl):void 0,n.arPromptImage=n.arPromptImage?i(n.arPromptImage):void 0,n.previewUrl=n.previewUrl?i(n.previewUrl):void 0,n.previewEnvUrl=n.previewEnvUrl?i(n.previewEnvUrl):void 0,n.previewDiamondEnvUrl=n.previewDiamondEnvUrl?i(n.previewDiamondEnvUrl):void 0,n.previewPosterUrl=n.previewPosterUrl?i(n.previewPosterUrl):void 0,n}function Lm(e){if(null==e||"string"!=typeof e)throw new a(`Invalid url: ${e}.`);let t;try{t=new URL(e)}catch(t){throw new a(`Invalid url: ${e}. ${t.message}`)}if("https:"!==t.protocol)throw new a(`Invalid url: ${e}.`);return t.toString()}function Um(e){const t=Lm(e);if(!function(e){return Dm.includes(e)}(new URL(t).hostname))throw new a(`Invalid url: ${e}.`);return t}const Pm=[1e3,2e3,4e3],Nm=Pm.length;function Fm(e){return h(this,arguments,void 0,function*(e,t=0){try{return yield e()}catch(n){if(t>=Nm)throw n;return yield new Promise(e=>setTimeout(e,Pm[t])),Fm(e,t+1)}})}const Om={};function km(e){const t=function(e){const{apiKey:t,sku:n,yaw:i,pitch:r,fov:a,forcedTransparency:o}=e,s=[];s.push(`apiKey=${t}`),s.push(`sku=${n}`),null!=i&&s.push(`yaw=${i}`);null!=r&&s.push(`pitch=${r}`);null!=a&&s.push(`fov=${a}`);null!=o&&s.push(`forcedTransparency=${o}`);return s.join("&")}(e),n=null!=Om[t];return n||(Om[t]=function(e){return h(this,void 0,void 0,function*(){return Qm(yield Fm(()=>h(this,void 0,void 0,function*(){const t=yield fetch(`https://dashboard.shopar.ai/plugin?${new URLSearchParams(e)}`).catch(e=>{throw new r(`API unavailable: ${u(e)}`)});if(!t.ok)throw new r("API response not OK.",t.status);const n=t.headers.get("content-length");if(n&&parseInt(n)>1048576)throw new r("API response too large.");try{return yield t.json()}catch(e){throw new r(`API returned invalid body: ${u(e)}`)}})))})}(e).catch(e=>{throw delete Om[t],e})),{promise:Om[t],cacheHit:n}}function Gm(e,t){if(null==e)throw new i(`'${t}' not specified.`)}function Hm(e,t){if("boolean"!=typeof e)throw new i(`'${t}' must be a boolean.`)}function zm(e,t){if("number"!=typeof e)throw new i(`'${t}' must be a number.`)}function Vm(e,t,n,r){if("number"!=typeof e)throw new i(`'${t}' must be a number.`);if(e<n)throw new i(`'${t}' must be greater than ${n}.`);if(e>r)throw new i(`'${t}' must be less than ${r}.`)}function Wm(e,t){if("string"!=typeof e)throw new i(`'${t}' must be a string.`)}function qm(e,t,n){if("string"!=typeof e)throw new i(`'${t}' must be a string.`);if(!n.includes(e))throw new i(`'${t}' must be ${n.join("' or '")}.`)}function jm(e,t){if(!(e instanceof HTMLElement))throw new i(`'${t}' must be an HTMLElement.`)}function Ym(e,t){if("function"!=typeof e)throw new i(`'${t}' must be a function.`)}function Xm(e){const{apiKey:n,sku:r,skuData:a,targetElement:o,initialState:s,initialAnimation:l,baseUrl:c,defaultUI:h,interactive:A,touchAction:u,zoomEnabled:d,minZoom:p,maxZoom:f,alwaysTransparentBackground:g,strings:m,onFirstAREngagement:v,onFirst3DEngagement:E,debounceAREngagementMs:b,onDebouncedAREngagement:C,debounce3DEngagementMs:_,onDebounced3DEngagement:I,onMaxZoomEnter:x,onMaxZoomLeave:y,onMinZoomEnter:M,onMinZoomLeave:w,onMinVerticalAngleEnter:S,onMinVerticalAngleLeave:B,onMaxVerticalAngleEnter:T,onMaxVerticalAngleLeave:R,customArVideo:Q,customTrueScaleFaceWidth:L}=e;Km(n),function(e){Gm(e,"sku"),Wm(e,"sku"),function(e){if(0===e.length||e.length>100||!/^[\p{L}0-9 ./_-]+$/u.test(e))throw new i("Invalid 'sku'.")}(e)}(r),null!=a&&function(e,t){if("object"!=typeof e)throw new i(`'${t}' must be an object.`)}(a,"skuData"),Gm(o,"targetElement"),jm(o,"targetElement"),null!=s&&qm(s,"initialState",t),null!=l&&function(e,t){if("string"!=typeof e&&!Array.isArray(e))throw new i(`'${t}' must be a string or array.`)}(l,"initialAnimation"),null!=c&&Wm(c,"baseUrl"),null!=h&&Hm(h,"defaultUI"),null!=A&&Hm(A,"interactive"),null!=u&&qm(u,"touchAction",Yc),null!=d&&Hm(d,"zoomEnabled"),null!=p&&Vm(p,"minZoom",.1,1),null!=f&&Vm(f,"maxZoom",1,1/0),null!=g&&Hm(g,"alwaysTransparentBackground"),null!=m&&function(e,t,n){for(const r of n){const n=e[r];if(null!=n&&"string"!=typeof n)throw new i(`Value for key '${r}' in '${t}' must be a string or undefined.`)}}(m,"strings",D),null!=v&&Ym(v,"onFirstAREngagement"),null!=E&&Ym(E,"onFirst3DEngagement"),null!=b&&zm(b,"debounceAREngagementMs"),null!=C&&Ym(C,"onDebouncedAREngagement"),null!=_&&zm(_,"debounce3DEngagementMs"),null!=I&&Ym(I,"onDebounced3DEngagement"),null!=x&&Ym(x,"onMaxZoomEnter"),null!=y&&Ym(y,"onMaxZoomLeave"),null!=M&&Ym(M,"onMinZoomEnter"),null!=w&&Ym(w,"onMinZoomLeave"),null!=S&&Ym(S,"onMinVerticalAngleEnter"),null!=B&&Ym(B,"onMinVerticalAngleLeave"),null!=T&&Ym(T,"onMaxVerticalAngleEnter"),null!=R&&Ym(R,"onMaxVerticalAngleLeave"),null!=Q&&(Gm(Q.video,"customArVideo.video"),function(e,t){if(!(e instanceof HTMLVideoElement))throw new i(`'${t}' must be an HTMLVideoElement.`)}(Q.video,"customArVideo.video"),Gm(Q.mirror,"customArVideo.mirror"),Hm(Q.mirror,"customArVideo.mirror")),null!=L&&zm(L,"customTrueScaleFaceWidth")}function Km(e){Gm(e,"apiKey"),Wm(e,"apiKey"),function(e){if(!function(e){return 24===e.length&&/^[0-9a-fA-F]{24}$/.test(e)}(e))throw new i("Invalid 'apiKey'.")}(e)}let Jm=!1;function Zm(e){return h(this,void 0,void 0,function*(){!function(e){const{apiKey:t,targetElement:n}=e;Km(t),Gm(n,"targetElement"),jm(n,"targetElement")}(e);const{targetElement:t}=e;M(e.baseUrl),em();const{trackEvent:n}=function(e){const t=performance.now(),n=Lf();return{trackEvent:(i,r={})=>{r=Object.assign(Object.assign({},r),{userAgent:Zg,hostname:window.location.hostname,href:window.location.href,pluginVersion:x,sessionId:Kg,setupId:n,timeSinceSetup:performance.now()-t,apiKey:e}),nm(()=>{window.ShopAR__analytics.trackEventImpl(i,r)})}}}(e.apiKey);n("visionSetup");const i=yield function(e){return h(this,void 0,void 0,function*(){return yield Fm(()=>h(this,void 0,void 0,function*(){const t=yield fetch(`https://dashboard.shopar.ai/plugin/vision?${new URLSearchParams({apiKey:e,sid:E()})}`).catch(e=>{throw new r(`API unavailable: ${u(e)}`)});if(!t.ok)throw new r("API response not OK.",t.status);const n=t.headers.get("content-length");if(n&&parseInt(n)>1048576)throw new r("API response too large.");try{return yield t.json()}catch(e){throw new r(`API returned invalid body: ${u(e)}`)}}))})}(e.apiKey);n("visionApiResponse",i);const{arKey:a}=i,o=wf(t),{getSetupId:s,findUI:l}=o,c=s();mg(),vg();const{setTargetElement:d,getDeepARTarget:p,setVisibilityParameters:f,getUIState:g,setUIState:m,startDeepARLoading:v,stopDeepARLoading:b,showCameraError:C}=l();if(g()!=_f.None)throw Error("UI state is not None, this is weird..");m(_f.AR),d(t),f(!1,!1,!0,!1,void 0,void 0),v(),yield Xf,$m(s(),c);try{n("visionArLaunch"),bg("Glasses",["faceInit"]),Cg(p()),yield Eg({licenseKey:a,truescaleUsecase:"DetectionLoop"}),$m(s(),c),$m(s(),c)}catch(e){const t=u(e);throw n("visionArLaunchFailure",{errorName:A(e),errorMessage:t}),C(),new Error(`AR failed: ${t}`)}finally{b()}return Jm=!0,{registerFacePoseListener:e=>{Jm&&(n("registerFacePoseListener"),kg(e))},registerFaceMeasurementListener:e=>{Jm&&(n("registerFaceMeasurementListener"),Gg(e))},switchEffect:e=>h(this,void 0,void 0,function*(){Jm&&(n("switchEffect",{arUrl:e}),function(e){Jf.switchEffect(e)}(e))}),clearEffect:()=>{Jm&&(n("clearEffect"),Jf.clearEffect())},close:()=>{if(Jm){if(Jm=!1,n("visionClose"),g()!==_f.AR)throw new Error("AR not launched.");m(_f.None)}}}})}function $m(e,t){if(e!==t)throw new Error("Setup cancelled. Please ensure that setup is only called once.")}function ev(e){return h(this,void 0,void 0,function*(){var t,n,a,d,f,g,m,v,x,y,S,B;Xm(e);const{apiKey:T,sku:D,skuData:Q,targetElement:L,initialState:U,initialAnimation:P}=e,N=e.touchAction,F=null==e.zoomEnabled||e.zoomEnabled,O=e.minZoom,k=e.maxZoom,G=null!==(t=e.onMaxZoomEnter)&&void 0!==t?t:null,H=null!==(n=e.onMaxZoomLeave)&&void 0!==n?n:null,z=null!==(a=e.onMinZoomEnter)&&void 0!==a?a:null,V=null!==(d=e.onMinZoomLeave)&&void 0!==d?d:null,W=null!==(f=e.onMinVerticalAngleEnter)&&void 0!==f?f:null,q=null!==(g=e.onMinVerticalAngleLeave)&&void 0!==g?g:null,j=null!==(m=e.onMaxVerticalAngleEnter)&&void 0!==m?m:null,Y=null!==(v=e.onMaxVerticalAngleLeave)&&void 0!==v?v:null,X=!0===e.alwaysTransparentBackground;!function(e){const t=getComputedStyle(e);if(!["static","relative"].includes(t.position))throw new i(`Invalid targetElement's position. Expected 'static' or 'relative', but found '${t.position}'.`)}(L),M(e.baseUrl),function(e){if(null!=e)for(const t of Object.keys(e)){if(!Object.prototype.hasOwnProperty.call(R,t)){console.warn(`String for key '${t}' will be ignored.`);continue}const n=e[t];null!=n&&(R[t]=n)}}(e.strings);const K=null!=P?xm(P):null,J=null!=(null==K?void 0:K.theta)?pm(K.theta):null,Z=null!=(null==K?void 0:K.phi)?pm(K.phi):null,$=null!=(null==K?void 0:K.fov)?pm(K.fov):null,ee=function(e,t){if(null!=e)return{apiUsed:!1,skuData:Qm(e,{trustUrls:!0})};const n=performance.now(),{promise:i,cacheHit:r}=km(t);return{apiUsed:!0,promise:i,startTimestamp:n,cacheHit:r}}(Q,function(e,t,n,i,r,a){return Object.assign(Object.assign(Object.assign(Object.assign({apiKey:e,sku:t,sid:E(),initialFov:"16"},null!=n&&{yaw:`${C(b(n))}`}),null!=i&&{pitch:`${C(b(i))}`}),null!=r&&{fov:`${C(b(r))}`}),a&&{forcedTransparency:`${a}`})}(T,D,null==J?void 0:J.get(),null==Z?void 0:Z.get(),null==$?void 0:$.get(),X)),te=wf(L),{getSetupId:ne,findUI:ie,findQR:re,isInteractive:ae,setInteractive:oe}=te,se=ne();em();const{prepareEvent:le,submitEvent:ce,trackEvent:he,arInteracted:Ae,previewInteracted:ue,setDebounceAREngagementMs:de,setOnDebouncedAREngagement:pe,setDebouncePreviewEngagementMs:fe,setOnDebouncedPreviewEngagement:ge,flushEngagementCallbacks:me,arTrackingEvents:ve,footRecorder:Ee}=tm(D,T),be=le("setup");de(e.debounceAREngagementMs),pe(e.onDebouncedAREngagement),fe(e.debounce3DEngagementMs),ge(e.onDebounced3DEngagement);let Ce,_e=!1;if(ee.apiUsed){try{Ce=yield ee.promise}catch(e){const t=u(e),n=performance.now()-ee.startTimestamp;throw he("apiError",{errorName:A(e),errorMessage:t,errorStatusCode:e instanceof r?e.status:void 0,duration:n}),e instanceof r?e:new r(t)}tv(ne(),se)}else Ce=ee.skuData;const{category:Ie,arUrl:xe,arEnvUrl:ye,arDiamondEnvUrl:Me,arToneMapping:we,arToneMappingExposure:Se,arBloomEnabled:Be,arBloomStrength:Te,arBloomRadius:Re,arBloomThreshold:De,arKey:Qe,arPromptEnabled:Le,arPromptText:Ue,arPromptImage:Pe,previewUrl:Ne,previewEnvUrl:Fe,previewDiamondEnvUrl:Oe,previewToneMapping:ke,previewToneMappingExposure:Ge,previewBloomEnabled:He,previewBloomStrength:ze,previewBloomRadius:Ve,previewBloomThreshold:We,previewPosterUrl:qe,cameraErrorText:je,qrPromptText:Ye,arSessionRecording:Xe,arSessionRecordingMaxDurationMs:Ke}=Ce;if(ee.apiUsed){const e=performance.now()-ee.startTimestamp;null!=xe||null!=Ne?(ce(be),he("apiResponse",Object.assign(Object.assign({},Ce),{duration:e,cacheHit:ee.cacheHit}))):(he("apiResponseFailure",Object.assign(Object.assign({},Ce),{duration:e,cacheHit:ee.cacheHit})),Je="SKU not found (or both 3D and AR disabled).",console.error(`ShopAR Plugin: ${Je}`))}var Je;const Ze=null!=xe&&function(e){return null!=e&&_.includes(e)}(Ie),$e=null==(null===(x=e._internalOptions)||void 0===x?void 0:x.qrEnabled)||(null===(y=e._internalOptions)||void 0===y?void 0:y.qrEnabled),et=Ze&&function(e){return null!=e&&I.includes(e)}(Ie),tt=$e&&et&&!Rm(),nt=Ze&&!tt,it=null!=Ne;tv(ne(),se);const{setTargetElement:rt,getDeepARTarget:at,getDeepARPrompt:ot,getThreeTarget:st,hasThreeTarget:lt,removeThreeTarget:ct,customizeDeepARPrompt:ht,customizeCameraError:At,customizeQRPrompt:ut,setVisibilityParameters:dt,getUIState:pt,setUIState:ft,setDefaultUIActions:gt,startDeepARLoading:mt,stopDeepARLoading:vt,showCameraError:Et,updateDeepARLoadingProgress:bt}=ie();rt(L);dt(null==e.defaultUI||e.defaultUI,tt,nt,it,Ie,U),ht(null!==(B=null!==(S=function(e){switch(e){case"Glasses":return R["prompt.ar.glasses"];case"Shoes":return R["prompt.ar.shoes"];case"Watches":return R["prompt.ar.watches"];case"Bracelets":return R["prompt.ar.bracelets"];case"Scarves":return R["prompt.ar.scarves"];case"Hats":return R["prompt.ar.hats"];case"Necklaces":return R["prompt.ar.necklaces"];default:return}}(Ie))&&void 0!==S?S:Ue)&&void 0!==B?B:"",null!=Pe?Pe:ee.apiUsed?"":`${w()}/img/prompt/ar-foot.webp`),At(je),ut(Ye);const Ct=im("qrLaunch","qrLaunchSuccess","qrLaunchFailure","qrClose",he),_t=im("arLaunch","arLaunchSuccess","arLaunchFailure","arClose",he,Ae),It=im("previewLaunch","previewLaunchSuccess","previewLaunchFailure","previewClose",he,ue);let xt=!1;const yt=()=>{var t;_t.interacted(),xt||(xt=!0,null===(t=e.onFirstAREngagement)||void 0===t||t.call(e))};let Mt=!1;const wt=()=>{var t;It.interacted(),Mt||(Mt=!0,null===(t=e.onFirst3DEngagement)||void 0===t||t.call(e))};!function(e,t){const n=e.parentNode;if(null==n)throw new Error("Parent node missing.");new MutationObserver(n=>{for(const i of n)for(const n of i.removedNodes)if(n===e)return void t()}).observe(n,{childList:!0})}(L,()=>{me(),pt()===_f.QR?(Ct.closed("detach"),St()||Tt()):pt()===_f.AR?(_t.closed("detach"),Tg()&&(Ee.stop(),Bg())):pt()===_f.Preview&&(It.closed("detach"),ct()),ft(_f.None),function(e){Mf.delete(e)}(L)});const{qrPaused:St,qrDraw:Bt,qrPause:Tt}=re(),Rt=null==e.interactive||e.interactive;let Dt=0;if(pt()===_f.QR){if(!St())if(tt){Ct.launched();try{yield Bt(T,D)}catch(e){const t=u(e);throw new c(t)}Ct.loaded()}else Tt(),ft(_f.None)}else if(pt()===_f.AR){if(Tg())if(nt&&!Jm){_t.launched(),Ee.stop(),mt(),mg(),"Glasses"===Ie&&vg(),Sf(te),Cg(at()),bg(Ie),_g(Le?ot():null);const t=e=>{bt(e.loaded/e.total*100)};null!=e.customArVideo&&Rg(e.customArVideo),yield Mg(xe,{envmap:ye,diamondEnvMap:Me,onProgress:t},`${xe}${ye}${Me}`),wg(we,Se),Sg(Be,Te,Re,De),Ig(yt,ve),Xe&&"Shoes"===Ie&&ee.apiUsed&&Ee.start(Ke),tv(ne(),se),vt(),null!=e.customTrueScaleFaceWidth&&xg(e.customTrueScaleFaceWidth),_t.loaded()}else Ee.stop(),Bg(),ft(_f.None)}else if(pt()===_f.Preview)if(it){It.launched(),yield customElements.whenDefined("shopar-3d");const e=st();e.baseUrl=`${w()}/3d`,e.interactivityDisabled=!Rt,e.posterUrl=null!=qe?qe:null,e.glbUrl=Ne,e.envUrl=null!=Fe?Fe:`${w()}/env/default.hdr`,e.diamondEnvUrl=null!=Oe?Oe:null,e.category=null!=Ie?Ie:null,e.touchAction=null!=N?N:null,e.zoomDisabled=!F,e.minZoom=null!=O?O:null,e.maxZoom=null!=k?k:null,e.alwaysTransparentBackground=X,e.toneMapping=null!=ke?ke:"ACES",e.toneMappingExposure=null!=Ge?Ge:1,e.bloomEnabled=null!=He?He:null,e.bloomStrength=null!=ze?ze:null,e.bloomRadius=null!=Ve?Ve:null,e.bloomThreshold=null!=We?We:null,e.onInteracted=wt,e.onInteractionPerf=_e?null:t=>{_e=!0,e.onInteractionPerf=null,he(qg,t)},e.onMaxZoomEnter=G,e.onMaxZoomLeave=H,e.onMinZoomEnter=z,e.onMinZoomLeave=V,e.onMinVerticalAngleEnter=W,e.onMinVerticalAngleLeave=q,e.onMaxVerticalAngleEnter=j,e.onMaxVerticalAngleLeave=Y,e.animation=null!=P?P:null,e.paused=!1,e.style.display="",yield e.flushChanges(),It.loaded()}else ct(),ft(_f.None);const Qt=()=>h(this,void 0,void 0,function*(){if(tt){Ct.launched();try{const e=++Dt;if(pt()===_f.Preview&&(It.closed("switch"),ct()),ft(_f.QR),yield Bt(T,D),Dt!==e)return;return tv(ne(),se),void Ct.loaded()}catch(e){throw Ct.failed(e),new c(u(e))}}if(!nt)throw new s("Model does not have AR enabled.");_t.launched();try{const t=++Dt;if(pt()===_f.Preview&&(It.closed("switch"),ct()),Sf(te),ft(_f.AR),mg(),"Glasses"===Ie&&vg(),mt(),yield Xf,Dt!==t)return;tv(ne(),se),bg(Ie),Cg(at()),_g(Le?ot():null);const n=e=>{bt(e.loaded/e.total*100)};if(Ee.stop(),Tg())null!=e.customArVideo&&Rg(e.customArVideo),yield Mg(xe,{envmap:ye,diamondEnvMap:Me,onProgress:n},`${xe}${ye}${Me}`),null!=e.customTrueScaleFaceWidth&&xg(e.customTrueScaleFaceWidth);else{if(yield Eg({licenseKey:Qe,effectUrl:xe,effectOptions:{envmap:ye,diamondEnvMap:Me},onProgress:n,videoConfig:e.customArVideo,customTrueScaleFaceWidth:e.customTrueScaleFaceWidth}),Dt!==t)return;tv(ne(),se)}if(wg(we,Se),Sg(Be,Te,Re,De),Ig(yt,ve),Xe&&"Shoes"===Ie&&ee.apiUsed&&Ee.start(Ke),Dt!==t)return;if(tv(ne(),se),Dt!==t)return;tv(ne(),se),_t.loaded()}catch(e){_t.failed(e),Et();const t=u(e);if("CameraPermissionDeniedError"===A(e))throw new l(t);throw new s(t)}finally{vt()}}),Lt=()=>h(this,void 0,void 0,function*(){if(!it)throw new o("Model does not have 3D enabled.");It.launched();try{pt()===_f.AR&&(_t.closed("switch"),Ee.stop(),Bg(),Tt()),ft(_f.Preview),yield customElements.whenDefined("shopar-3d");const e=st();e.baseUrl=`${w()}/3d`,e.interactivityDisabled=!Rt,e.posterUrl=null!=qe?qe:null,e.glbUrl=Ne,e.envUrl=null!=Fe?Fe:`${w()}/env/default.hdr`,e.diamondEnvUrl=null!=Oe?Oe:null,e.category=null!=Ie?Ie:null,e.touchAction=null!=N?N:null,e.zoomDisabled=!F,e.minZoom=null!=O?O:null,e.maxZoom=null!=k?k:null,e.alwaysTransparentBackground=X,e.toneMapping=null!=ke?ke:"ACES",e.toneMappingExposure=null!=Ge?Ge:1,e.bloomEnabled=null!=He?He:null,e.bloomStrength=null!=ze?ze:null,e.bloomRadius=null!=Ve?Ve:null,e.bloomThreshold=null!=We?We:null,e.onInteracted=wt,e.onInteractionPerf=_e?null:t=>{_e=!0,e.onInteractionPerf=null,he(qg,t)},e.onMaxZoomEnter=G,e.onMaxZoomLeave=H,e.onMinZoomEnter=z,e.onMinZoomLeave=V,e.onMinVerticalAngleEnter=W,e.onMinVerticalAngleLeave=q,e.onMaxVerticalAngleEnter=j,e.onMaxVerticalAngleLeave=Y,e.animation=null!=P?P:null,e.paused=!1,e.style.display="",yield e.flushChanges(),It.loaded()}catch(e){throw It.failed(e),new o(u(e))}}),Ut=()=>h(this,void 0,void 0,function*(){pt()!==_f.None&&("AR"!==U||pt()!==_f.AR&&pt()!==_f.QR)&&("3D"===U&&pt()===_f.Preview||(++Dt,me(),pt()===_f.QR||pt()===_f.AR?(pt()===_f.QR?Ct.closed("close"):_t.closed("close"),Ee.stop(),Bg(),Tt()):pt()===_f.Preview&&(It.closed("close"),ct()),ft(_f.None),"AR"!==U?"3D"!==U||(yield Lt()):yield Qt()))});return gt(p("launchAR",Qt),p("launch3D",Lt),p("close",Ut)),"AR"===U?(yield Qt(),tv(ne(),se)):"3D"===U&&(yield Lt(),tv(ne(),se)),Jm=!1,{launchAR:Ze?p("launchAR",Qt):void 0,launch3D:it?p("launch3D",Lt):void 0,closeAR:Ze?p("closeAR",()=>h(this,void 0,void 0,function*(){pt()!==_f.AR&&pt()!==_f.QR||"AR"!==U&&(++Dt,me(),pt()===_f.QR?Ct.closed("close"):_t.closed("close"),Ee.stop(),Bg(),Tt(),ft(_f.None),"3D"!==U||(yield Lt()))})):void 0,close3D:it?p("close3D",()=>h(this,void 0,void 0,function*(){pt()===_f.Preview&&"3D"!==U&&(++Dt,me(),It.closed("close"),ct(),ft(_f.None),"AR"!==U||(yield Qt()))})):void 0,close:Ze||it?p("close",Ut):void 0,isInteractive:()=>ae(),setInteractive:e=>oe(e),zoomIn3D:it?e=>{pt()===_f.Preview&&lt()&&st().zoomBy(e)}:void 0,zoomOut3D:it?e=>{pt()===_f.Preview&&lt()&&st().zoomBy(-e)}:void 0,rotateHorizontally3D:it?e=>{pt()===_f.Preview&&lt()&&st().rotateBy(e,0)}:void 0,rotateVertically3D:it?e=>{pt()===_f.Preview&&lt()&&st().rotateBy(0,e)}:void 0}})}function tv(e,t){if(e!==t)throw new Error("Setup cancelled. Please ensure that setup is only called once.")}const nv={setup:function(e){return h(this,void 0,void 0,function*(){return p("visionSetup",()=>Zm(e))()})}},iv={setup:function(e){return h(this,void 0,void 0,function*(){return p("setup",()=>ev(e))()})},version:x};e.ApiError=r,e.CameraPermissionDeniedError=l,e.Launch3DError=o,e.LaunchARError=s,e.PREVIEW_STATES=t,e.PluginError=n,e.QRError=c,e.SanitizationError=a,e.ValidationError=i,e.plugin=iv,e.vision=nv});