diff --git a/frontend/pass.css b/frontend/pass.css
index b2b866e..34c04fe 100644
--- a/frontend/pass.css
+++ b/frontend/pass.css
@@ -43,11 +43,11 @@ canvas {
gap: 10px;
padding: 11px 16px;
border: 1px solid #ffffff2b;
- border-radius: 999px;
+ border-radius: 5px;
color: #d7d7d7;
background: #0b0b0be6;
- box-shadow: 0 10px 30px #0008;
- font: 500 11px monospace;
+ box-shadow: none;
+ font: 500 15px monospace;
letter-spacing: 0.08em;
text-transform: uppercase;
cursor: pointer;
diff --git a/frontend/pass.jsx b/frontend/pass.jsx
index 1cb3d33..cdf2d68 100644
--- a/frontend/pass.jsx
+++ b/frontend/pass.jsx
@@ -45,32 +45,26 @@ function createBadgeTexture(pass) {
ctx.fillStyle = "#050505";
ctx.fillRect(0, 0, canvas.width, canvas.height);
- const sheen = ctx.createLinearGradient(0, 0, 912, 1288);
- sheen.addColorStop(0, "#ffffff09");
- sheen.addColorStop(0.45, "transparent");
- sheen.addColorStop(1, "#ffffff05");
- ctx.fillStyle = sheen;
- ctx.fillRect(0, 0, 912, 1288);
-
- ctx.strokeStyle = "#ffffff24";
+ ctx.strokeStyle = "#ffffff1f";
ctx.lineWidth = 1.5;
ctx.strokeRect(30, 30, 852, 1228);
ctx.fillStyle = "#ffffff";
- ctx.font = "700 29px Arial, sans-serif";
+ ctx.font = "700 34px Arial, sans-serif";
ctx.fillText("PASS", 58, 79);
ctx.fillStyle = "#8f8f8f";
- ctx.fillText("PORT", 140, 79);
- ctx.font = "500 13px monospace";
- ctx.fillText("DIGITAL ACCESS SYSTEM", 58, 105);
+ ctx.fillText("PORT", 154, 79);
+ ctx.font = "500 19px monospace";
+ ctx.fillText("DIGITAL ACCESS SYSTEM", 58, 110);
ctx.textAlign = "right";
ctx.fillStyle = accent;
+ ctx.font = "600 34px monospace";
+ const statusWidth = ctx.measureText(pass.status).width;
ctx.beginPath();
- ctx.arc(700, 77, 6, 0, Math.PI * 2);
+ ctx.arc(852 - statusWidth - 24, 74, 9, 0, Math.PI * 2);
ctx.fill();
- ctx.font = "600 16px monospace";
- ctx.fillText(pass.status, 852, 83);
+ ctx.fillText(pass.status, 852, 86);
ctx.textAlign = "left";
ctx.strokeStyle = "#ffffff2d";
@@ -79,67 +73,51 @@ function createBadgeTexture(pass) {
ctx.lineTo(854, 145);
ctx.stroke();
- ctx.save();
- ctx.globalAlpha = 0.075;
- ctx.strokeStyle = "#ffffff";
- ctx.lineWidth = 8;
- ctx.font = "800 350px Arial, sans-serif";
- ctx.strokeText("P", 590, 520);
- for (let row = 0; row < 9; row += 1) {
- for (let column = 0; column < 9; column += 1) {
- const radius = Math.max(1.5, 5 - (row + column) * 0.18);
- ctx.beginPath();
- ctx.arc(620 + column * 25, 250 + row * 25, radius, 0, Math.PI * 2);
- ctx.fillStyle = "#ffffff";
- ctx.fill();
- }
- }
- ctx.restore();
-
ctx.fillStyle = "#929292";
- ctx.font = "500 14px monospace";
- ctx.fillText("TEMPORARY / GUEST", 58, 220);
+ ctx.font = "500 22px monospace";
+ ctx.fillText("TEMPORARY ACCESS CREDENTIAL", 58, 220);
ctx.textAlign = "right";
ctx.fillText(`NO. ${pass.credentialId}`, 854, 220);
ctx.textAlign = "left";
ctx.fillStyle = "#ffffff";
- ctx.font = "700 86px Arial, sans-serif";
- ctx.fillText("ACCESS", 52, 350);
- ctx.font = "300 86px Arial, sans-serif";
- ctx.fillText("PASS", 52, 430);
+ ctx.font = "650 54px Arial, sans-serif";
+ ctx.fillText("GUEST ACCESS", 55, 350);
+ ctx.fillStyle = "#8e8e8e";
+ ctx.font = "400 25px Arial, sans-serif";
+ ctx.fillText("Temporary entry credential", 58, 398);
ctx.fillStyle = "#858585";
- ctx.font = "500 14px monospace";
- ctx.fillText("PASS HOLDER", 58, 545);
+ ctx.font = "500 22px monospace";
+ ctx.fillText("PASS HOLDER", 58, 510);
ctx.fillStyle = "#ffffff";
const holderSize = fitText(ctx, pass.holder, 796, 66);
ctx.font = `600 ${holderSize}px Arial, sans-serif`;
- ctx.fillText(pass.holder, 55, 625);
+ ctx.fillText(pass.holder, 55, 590);
ctx.strokeStyle = "#ffffff2d";
ctx.beginPath();
- ctx.moveTo(58, 685);
- ctx.lineTo(854, 685);
+ ctx.moveTo(58, 660);
+ ctx.lineTo(854, 660);
ctx.stroke();
ctx.fillStyle = "#858585";
- ctx.font = "500 14px monospace";
- ctx.fillText("AUTHORIZED LOCATION", 58, 738);
- ctx.fillText("VALID FROM", 520, 738);
+ ctx.font = "500 22px monospace";
+ ctx.fillText("AUTHORIZED LOCATION", 58, 718);
+ ctx.fillText("VALID FROM", 520, 718);
ctx.fillStyle = "#ffffff";
const locationSize = fitText(ctx, pass.location, 400, 32);
ctx.font = `500 ${locationSize}px Arial, sans-serif`;
- ctx.fillText(pass.location, 58, 782);
- ctx.font = "500 20px monospace";
- ctx.fillText(pass.validFrom, 520, 780);
+ ctx.fillText(pass.location, 58, 764);
+ ctx.font = "500 30px monospace";
+ ctx.fillText(pass.validFrom, 520, 762);
ctx.fillStyle = "#858585";
- ctx.font = "500 14px monospace";
- ctx.fillText("VALID UNTIL", 520, 842);
+ ctx.font = "500 22px monospace";
+ ctx.fillText("VALID UNTIL", 520, 832);
ctx.fillStyle = "#ffffff";
- ctx.font = "500 20px monospace";
- ctx.fillText(pass.validUntil, 520, 884);
+ ctx.font = "500 30px monospace";
+ ctx.fillText(pass.validUntil, 520, 876);
ctx.strokeStyle = "#ffffff2d";
ctx.beginPath();
@@ -155,19 +133,14 @@ function createBadgeTexture(pass) {
ctx.font = "700 14px Arial, sans-serif";
ctx.fillText("✓", 65, 1029);
ctx.fillStyle = "#9a9a9a";
- ctx.font = "500 13px monospace";
+ ctx.font = "500 20px monospace";
ctx.fillText("DIGITALLY SIGNED ACCESS CREDENTIAL", 100, 1020);
ctx.fillText("ISSUER / PASSPORT", 100, 1045);
ctx.textAlign = "right";
- ctx.fillStyle = "#ffffff";
- ctx.fillRect(803, 1003, 51, 51);
- ctx.fillStyle = "#050505";
- ctx.font = "700 26px Arial, sans-serif";
- ctx.fillText("P", 838, 1037);
ctx.textAlign = "left";
ctx.fillStyle = "#616161";
- ctx.font = "500 13px monospace";
+ ctx.font = "500 19px monospace";
ctx.fillText("TAP CARD TO VIEW VERIFICATION DETAILS", 58, 1205);
const texture = new THREE.CanvasTexture(canvas);
@@ -190,28 +163,27 @@ function createBackTexture(pass) {
ctx.strokeRect(30, 30, 852, 1228);
ctx.fillStyle = "#fff";
- ctx.font = "700 27px Arial, sans-serif";
+ ctx.font = "700 32px Arial, sans-serif";
ctx.fillText("PASS PORT", 58, 82);
ctx.textAlign = "right";
ctx.fillStyle = "#777";
- ctx.font = "500 14px monospace";
+ ctx.font = "500 19px monospace";
ctx.fillText("CREDENTIAL / REVERSE", 854, 82);
ctx.textAlign = "left";
- ctx.save();
- ctx.globalAlpha = 0.09;
- ctx.strokeStyle = "#fff";
- ctx.lineWidth = 8;
- ctx.font = "800 190px Arial, sans-serif";
- ctx.strokeText("SIGNED", 42, 315);
- ctx.restore();
+ ctx.fillStyle = "#8c8c8c";
+ ctx.font = "500 21px monospace";
+ ctx.fillText("VERIFICATION", 58, 210);
+ ctx.fillStyle = "#ffffff";
+ ctx.font = "650 48px Arial, sans-serif";
+ ctx.fillText("Credential details", 55, 275);
ctx.fillStyle = "#8c8c8c";
- ctx.font = "500 14px monospace";
- ctx.fillText("VERIFICATION STATUS", 58, 385);
+ ctx.font = "500 21px monospace";
+ ctx.fillText("CURRENT STATUS", 58, 390);
ctx.fillStyle = accent;
- ctx.font = "600 54px Arial, sans-serif";
- ctx.fillText(pass.status, 55, 453);
+ ctx.font = "600 56px Arial, sans-serif";
+ ctx.fillText(pass.status, 55, 450);
ctx.strokeStyle = "#ffffff2d";
ctx.beginPath();
@@ -229,11 +201,11 @@ function createBackTexture(pass) {
rows.forEach(([label, value], index) => {
const y = 570 + index * 92;
ctx.fillStyle = "#777";
- ctx.font = "500 14px monospace";
+ ctx.font = "500 20px monospace";
ctx.fillText(label, 58, y);
ctx.textAlign = "right";
ctx.fillStyle = "#fff";
- ctx.font = "500 20px Arial, sans-serif";
+ ctx.font = "500 27px Arial, sans-serif";
ctx.fillText(value, 854, y);
ctx.textAlign = "left";
ctx.strokeStyle = "#ffffff17";
@@ -244,15 +216,15 @@ function createBackTexture(pass) {
});
ctx.fillStyle = "#777";
- ctx.font = "500 14px monospace";
- ctx.fillText("USAGE", 58, 1060);
+ ctx.font = "500 20px monospace";
+ ctx.fillText("Credit", 58, 1060);
ctx.fillStyle = "#d5d5d5";
- ctx.font = "500 19px Arial, sans-serif";
- ctx.fillText("Present this credential at the authorized access point.", 58, 1100);
- ctx.fillText("Do not share the credential URL with another person.", 58, 1135);
+ ctx.font = "500 23px Arial, sans-serif";
+ ctx.fillText("https://github.com/hjopel/vercel-3d-card", 58, 1100);
+ ctx.fillText("@imnyang", 58, 1135);
ctx.fillStyle = "#666";
- ctx.font = "500 13px monospace";
+ ctx.font = "500 18px monospace";
ctx.fillText("TAP CARD TO RETURN TO FRONT", 58, 1210);
const texture = new THREE.CanvasTexture(canvas);
@@ -435,11 +407,11 @@ function Band({ pass, flipped, onFlip, maxSpeed = 50, minSpeed = 10 }) {
color="#080808"
clearcoat={1}
clearcoatRoughness={0.15}
- iridescence={1}
- iridescenceIOR={1}
- iridescenceThicknessRange={[0, 2400]}
- metalness={0.5}
- roughness={0.3}
+ iridescence={0.1}
+ iridescenceIOR={1.1}
+ iridescenceThicknessRange={[0, 300]}
+ metalness={0.25}
+ roughness={0.38}
/>
@@ -448,11 +420,11 @@ function Band({ pass, flipped, onFlip, maxSpeed = 50, minSpeed = 10 }) {
map={badgeTexture}
clearcoat={1}
clearcoatRoughness={0.12}
- iridescence={0.55}
+ iridescence={0.08}
iridescenceIOR={1.2}
- iridescenceThicknessRange={[0, 900]}
- metalness={0.2}
- roughness={0.28}
+ iridescenceThicknessRange={[0, 240]}
+ metalness={0.1}
+ roughness={0.34}
/>
diff --git a/static/dist/pass-app.css b/static/dist/pass-app.css
index fc81cc4..b350287 100644
--- a/static/dist/pass-app.css
+++ b/static/dist/pass-app.css
@@ -1 +1 @@
-*{box-sizing:border-box}html,body,#pass-root{width:100%;height:100%;margin:0;overflow:hidden;background:#000}body{min-width:320px}canvas{display:block;touch-action:none}.loading{display:grid;width:100%;height:100%;color:#fff;background:#000;font:12px monospace;letter-spacing:.12em;text-transform:uppercase;place-items:center}.flip-control{position:fixed;z-index:5;right:50%;bottom:28px;display:flex;align-items:center;gap:10px;padding:11px 16px;border:1px solid #ffffff2b;border-radius:999px;color:#d7d7d7;background:#0b0b0be6;box-shadow:0 10px 30px #0008;font:500 11px monospace;letter-spacing:.08em;text-transform:uppercase;cursor:pointer;transform:translate(50%);transition:color .16s ease,border-color .16s ease,background .16s ease}.flip-control:hover,.flip-control:focus-visible{border-color:#ffffff70;color:#fff;background:#151515f2;outline:none}.flip-control span{font:17px Arial,sans-serif}
+*{box-sizing:border-box}html,body,#pass-root{width:100%;height:100%;margin:0;overflow:hidden;background:#000}body{min-width:320px}canvas{display:block;touch-action:none}.loading{display:grid;width:100%;height:100%;color:#fff;background:#000;font:12px monospace;letter-spacing:.12em;text-transform:uppercase;place-items:center}.flip-control{position:fixed;z-index:5;right:50%;bottom:28px;display:flex;align-items:center;gap:10px;padding:11px 16px;border:1px solid #ffffff2b;border-radius:5px;color:#d7d7d7;background:#0b0b0be6;box-shadow:none;font:500 15px monospace;letter-spacing:.08em;text-transform:uppercase;cursor:pointer;transform:translate(50%);transition:color .16s ease,border-color .16s ease,background .16s ease}.flip-control:hover,.flip-control:focus-visible{border-color:#ffffff70;color:#fff;background:#151515f2;outline:none}.flip-control span{font:17px Arial,sans-serif}
diff --git a/static/dist/pass-app.js b/static/dist/pass-app.js
index f402398..c9353cb 100644
--- a/static/dist/pass-app.js
+++ b/static/dist/pass-app.js
@@ -6,7 +6,7 @@ var RN=Object.defineProperty;var LN=(B,A,I)=>A in B?RN(B,A,{enumerable:!0,config
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- */var nu;function YN(){if(nu)return ug;nu=1;var B=Symbol.for("react.element"),A=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),e=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),n=Symbol.for("react.suspense"),a=Symbol.for("react.memo"),r=Symbol.for("react.lazy"),D=Symbol.iterator;function h(P){return P===null||typeof P!="object"?null:(P=D&&P[D]||P["@@iterator"],typeof P=="function"?P:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},G=Object.assign,U={};function k(P,oA,vA){this.props=P,this.context=oA,this.refs=U,this.updater=vA||S}k.prototype.isReactComponent={},k.prototype.setState=function(P,oA){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,oA,"setState")},k.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function y(){}y.prototype=k.prototype;function d(P,oA,vA){this.props=P,this.context=oA,this.refs=U,this.updater=vA||S}var J=d.prototype=new y;J.constructor=d,G(J,k.prototype),J.isPureReactComponent=!0;var F=Array.isArray,v=Object.prototype.hasOwnProperty,m={current:null},x={key:!0,ref:!0,__self:!0,__source:!0};function T(P,oA,vA){var cA,FA={},wA=null,LA=null;if(oA!=null)for(cA in oA.ref!==void 0&&(LA=oA.ref),oA.key!==void 0&&(wA=""+oA.key),oA)v.call(oA,cA)&&!x.hasOwnProperty(cA)&&(FA[cA]=oA[cA]);var VA=arguments.length-2;if(VA===1)FA.children=vA;else if(1A in B?RN(B,A,{enumerable:!0,config
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- */var au;function qN(){if(au)return Xa;au=1;var B=cc(),A=Symbol.for("react.element"),I=Symbol.for("react.fragment"),g=Object.prototype.hasOwnProperty,C=B.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function e(E,n,a){var r,D={},h=null,S=null;a!==void 0&&(h=""+a),n.key!==void 0&&(h=""+n.key),n.ref!==void 0&&(S=n.ref);for(r in n)g.call(n,r)&&!i.hasOwnProperty(r)&&(D[r]=n[r]);if(E&&E.defaultProps)for(r in n=E.defaultProps,n)D[r]===void 0&&(D[r]=n[r]);return{$$typeof:A,type:E,key:h,ref:S,props:D,_owner:C.current}}return Xa.Fragment=I,Xa.jsx=e,Xa.jsxs=e,Xa}var ru;function mN(){return ru||(ru=1,zS.exports=qN()),zS.exports}var _I=mN(),GA=cc();const hg=tU(GA);var rD={},Aw={exports:{}},ki={},Iw={exports:{}},gw={};/**
+ */var au;function qN(){if(au)return Xa;au=1;var B=cc(),A=Symbol.for("react.element"),I=Symbol.for("react.fragment"),g=Object.prototype.hasOwnProperty,C=B.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function e(E,n,a){var l,D={},h=null,S=null;a!==void 0&&(h=""+a),n.key!==void 0&&(h=""+n.key),n.ref!==void 0&&(S=n.ref);for(l in n)g.call(n,l)&&!i.hasOwnProperty(l)&&(D[l]=n[l]);if(E&&E.defaultProps)for(l in n=E.defaultProps,n)D[l]===void 0&&(D[l]=n[l]);return{$$typeof:A,type:E,key:h,ref:S,props:D,_owner:C.current}}return Xa.Fragment=I,Xa.jsx=e,Xa.jsxs=e,Xa}var ru;function mN(){return ru||(ru=1,zS.exports=qN()),zS.exports}var _I=mN(),GA=cc();const hg=tU(GA);var rD={},Aw={exports:{}},ki={},Iw={exports:{}},gw={};/**
* @license React
* scheduler.production.min.js
*
@@ -22,7 +22,7 @@ var RN=Object.defineProperty;var LN=(B,A,I)=>A in B?RN(B,A,{enumerable:!0,config
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- */var lu;function HN(){return lu||(lu=1,(function(B){function A(V,aA){var BA=V.length;V.push(aA);A:for(;0>>1,oA=V[P];if(0>>1;PC(FA,BA))wAC(LA,FA)?(V[P]=LA,V[wA]=BA,P=wA):(V[P]=FA,V[cA]=BA,P=cA);else if(wAC(LA,BA))V[P]=LA,V[wA]=BA,P=wA;else break A}}return aA}function C(V,aA){var BA=V.sortIndex-aA.sortIndex;return BA!==0?BA:V.id-aA.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;B.unstable_now=function(){return i.now()}}else{var e=Date,E=e.now();B.unstable_now=function(){return e.now()-E}}var n=[],a=[],r=1,D=null,h=3,S=!1,G=!1,U=!1,k=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function J(V){for(var aA=I(a);aA!==null;){if(aA.callback===null)g(a);else if(aA.startTime<=V)g(a),aA.sortIndex=aA.expirationTime,A(n,aA);else break;aA=I(a)}}function F(V){if(U=!1,J(V),!G)if(I(n)!==null)G=!0,EA(v);else{var aA=I(a);aA!==null&&pA(F,aA.startTime-V)}}function v(V,aA){G=!1,U&&(U=!1,y(T),T=-1),S=!0;var BA=h;try{for(J(aA),D=I(n);D!==null&&(!(D.expirationTime>aA)||V&&!b());){var P=D.callback;if(typeof P=="function"){D.callback=null,h=D.priorityLevel;var oA=P(D.expirationTime<=aA);aA=B.unstable_now(),typeof oA=="function"?D.callback=oA:D===I(n)&&g(n),J(aA)}else g(n);D=I(n)}if(D!==null)var vA=!0;else{var cA=I(a);cA!==null&&pA(F,cA.startTime-aA),vA=!1}return vA}finally{D=null,h=BA,S=!1}}var m=!1,x=null,T=-1,L=5,Y=-1;function b(){return!(B.unstable_now()-YV||125P?(V.sortIndex=BA,A(a,V),I(n)===null&&V===I(a)&&(U?(y(T),T=-1):U=!0,pA(F,BA-P))):(V.sortIndex=oA,A(n,V),G||S||(G=!0,EA(v))),V},B.unstable_shouldYield=b,B.unstable_wrapCallback=function(V){var aA=h;return function(){var BA=h;h=aA;try{return V.apply(this,arguments)}finally{h=BA}}}})(gw)),gw}var Du;function TN(){return Du||(Du=1,Iw.exports=HN()),Iw.exports}/**
+ */var lu;function HN(){return lu||(lu=1,(function(B){function A(V,aA){var BA=V.length;V.push(aA);A:for(;0>>1,oA=V[P];if(0>>1;PC(FA,BA))wAC(LA,FA)?(V[P]=LA,V[wA]=BA,P=wA):(V[P]=FA,V[cA]=BA,P=cA);else if(wAC(LA,BA))V[P]=LA,V[wA]=BA,P=wA;else break A}}return aA}function C(V,aA){var BA=V.sortIndex-aA.sortIndex;return BA!==0?BA:V.id-aA.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;B.unstable_now=function(){return i.now()}}else{var e=Date,E=e.now();B.unstable_now=function(){return e.now()-E}}var n=[],a=[],l=1,D=null,h=3,S=!1,G=!1,U=!1,k=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,d=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function J(V){for(var aA=I(a);aA!==null;){if(aA.callback===null)g(a);else if(aA.startTime<=V)g(a),aA.sortIndex=aA.expirationTime,A(n,aA);else break;aA=I(a)}}function F(V){if(U=!1,J(V),!G)if(I(n)!==null)G=!0,EA(v);else{var aA=I(a);aA!==null&&pA(F,aA.startTime-V)}}function v(V,aA){G=!1,U&&(U=!1,y(T),T=-1),S=!0;var BA=h;try{for(J(aA),D=I(n);D!==null&&(!(D.expirationTime>aA)||V&&!b());){var P=D.callback;if(typeof P=="function"){D.callback=null,h=D.priorityLevel;var oA=P(D.expirationTime<=aA);aA=B.unstable_now(),typeof oA=="function"?D.callback=oA:D===I(n)&&g(n),J(aA)}else g(n);D=I(n)}if(D!==null)var vA=!0;else{var cA=I(a);cA!==null&&pA(F,cA.startTime-aA),vA=!1}return vA}finally{D=null,h=BA,S=!1}}var m=!1,x=null,T=-1,L=5,Y=-1;function b(){return!(B.unstable_now()-YV||125P?(V.sortIndex=BA,A(a,V),I(n)===null&&V===I(a)&&(U?(y(T),T=-1):U=!0,pA(F,BA-P))):(V.sortIndex=oA,A(n,V),G||S||(G=!0,EA(v))),V},B.unstable_shouldYield=b,B.unstable_wrapCallback=function(V){var aA=h;return function(){var BA=h;h=aA;try{return V.apply(this,arguments)}finally{h=BA}}}})(gw)),gw}var Du;function TN(){return Du||(Du=1,Iw.exports=HN()),Iw.exports}/**
* @license React
* react-dom.production.min.js
*
@@ -30,22 +30,22 @@ var RN=Object.defineProperty;var LN=(B,A,I)=>A in B?RN(B,A,{enumerable:!0,config
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- */var hu;function xN(){if(hu)return ki;hu=1;var B=cc(),A=TN();function I(Q){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+Q,l=1;l"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),n=Object.prototype.hasOwnProperty,a=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,r={},D={};function h(Q){return n.call(D,Q)?!0:n.call(r,Q)?!1:a.test(Q)?D[Q]=!0:(r[Q]=!0,!1)}function S(Q,t,l,w){if(l!==null&&l.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return w?!1:l!==null?!l.acceptsBooleans:(Q=Q.toLowerCase().slice(0,5),Q!=="data-"&&Q!=="aria-");default:return!1}}function G(Q,t,l,w){if(t===null||typeof t>"u"||S(Q,t,l,w))return!0;if(w)return!1;if(l!==null)switch(l.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function U(Q,t,l,w,M,K,H){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=w,this.attributeNamespace=M,this.mustUseProperty=l,this.propertyName=Q,this.type=t,this.sanitizeURL=K,this.removeEmptyString=H}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(Q){k[Q]=new U(Q,0,!1,Q,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(Q){var t=Q[0];k[t]=new U(t,1,!1,Q[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(Q){k[Q]=new U(Q,2,!1,Q.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(Q){k[Q]=new U(Q,2,!1,Q,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(Q){k[Q]=new U(Q,3,!1,Q.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(Q){k[Q]=new U(Q,3,!0,Q,null,!1,!1)}),["capture","download"].forEach(function(Q){k[Q]=new U(Q,4,!1,Q,null,!1,!1)}),["cols","rows","size","span"].forEach(function(Q){k[Q]=new U(Q,6,!1,Q,null,!1,!1)}),["rowSpan","start"].forEach(function(Q){k[Q]=new U(Q,5,!1,Q.toLowerCase(),null,!1,!1)});var y=/[\-:]([a-z])/g;function d(Q){return Q[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(Q){var t=Q.replace(y,d);k[t]=new U(t,1,!1,Q,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(Q){var t=Q.replace(y,d);k[t]=new U(t,1,!1,Q,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(Q){var t=Q.replace(y,d);k[t]=new U(t,1,!1,Q,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(Q){k[Q]=new U(Q,1,!1,Q.toLowerCase(),null,!1,!1)}),k.xlinkHref=new U("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(Q){k[Q]=new U(Q,1,!1,Q.toLowerCase(),null,!0,!0)});function J(Q,t,l,w){var M=k.hasOwnProperty(t)?k[t]:null;(M!==null?M.type!==0:w||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),n=Object.prototype.hasOwnProperty,a=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,l={},D={};function h(Q){return n.call(D,Q)?!0:n.call(l,Q)?!1:a.test(Q)?D[Q]=!0:(l[Q]=!0,!1)}function S(Q,t,r,w){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return w?!1:r!==null?!r.acceptsBooleans:(Q=Q.toLowerCase().slice(0,5),Q!=="data-"&&Q!=="aria-");default:return!1}}function G(Q,t,r,w){if(t===null||typeof t>"u"||S(Q,t,r,w))return!0;if(w)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function U(Q,t,r,w,M,K,H){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=w,this.attributeNamespace=M,this.mustUseProperty=r,this.propertyName=Q,this.type=t,this.sanitizeURL=K,this.removeEmptyString=H}var k={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(Q){k[Q]=new U(Q,0,!1,Q,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(Q){var t=Q[0];k[t]=new U(t,1,!1,Q[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(Q){k[Q]=new U(Q,2,!1,Q.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(Q){k[Q]=new U(Q,2,!1,Q,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(Q){k[Q]=new U(Q,3,!1,Q.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(Q){k[Q]=new U(Q,3,!0,Q,null,!1,!1)}),["capture","download"].forEach(function(Q){k[Q]=new U(Q,4,!1,Q,null,!1,!1)}),["cols","rows","size","span"].forEach(function(Q){k[Q]=new U(Q,6,!1,Q,null,!1,!1)}),["rowSpan","start"].forEach(function(Q){k[Q]=new U(Q,5,!1,Q.toLowerCase(),null,!1,!1)});var y=/[\-:]([a-z])/g;function d(Q){return Q[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(Q){var t=Q.replace(y,d);k[t]=new U(t,1,!1,Q,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(Q){var t=Q.replace(y,d);k[t]=new U(t,1,!1,Q,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(Q){var t=Q.replace(y,d);k[t]=new U(t,1,!1,Q,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(Q){k[Q]=new U(Q,1,!1,Q.toLowerCase(),null,!1,!1)}),k.xlinkHref=new U("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(Q){k[Q]=new U(Q,1,!1,Q.toLowerCase(),null,!0,!0)});function J(Q,t,r,w){var M=k.hasOwnProperty(t)?k[t]:null;(M!==null?M.type!==0:w||!(2AA||M[H]!==K[AA]){var tA=`
-`+M[H].replace(" at new "," at ");return Q.displayName&&tA.includes("")&&(tA=tA.replace("",Q.displayName)),tA}while(1<=H&&0<=AA);break}}}finally{vA=!1,Error.prepareStackTrace=l}return(Q=Q?Q.displayName||Q.name:"")?oA(Q):""}function FA(Q){switch(Q.tag){case 5:return oA(Q.type);case 16:return oA("Lazy");case 13:return oA("Suspense");case 19:return oA("SuspenseList");case 0:case 2:case 15:return Q=cA(Q.type,!1),Q;case 11:return Q=cA(Q.type.render,!1),Q;case 1:return Q=cA(Q.type,!0),Q;default:return""}}function wA(Q){if(Q==null)return null;if(typeof Q=="function")return Q.displayName||Q.name||null;if(typeof Q=="string")return Q;switch(Q){case x:return"Fragment";case m:return"Portal";case L:return"Profiler";case T:return"StrictMode";case CA:return"Suspense";case nA:return"SuspenseList"}if(typeof Q=="object")switch(Q.$$typeof){case b:return(Q.displayName||"Context")+".Consumer";case Y:return(Q._context.displayName||"Context")+".Provider";case IA:var t=Q.render;return Q=Q.displayName,Q||(Q=t.displayName||t.name||"",Q=Q!==""?"ForwardRef("+Q+")":"ForwardRef"),Q;case uA:return t=Q.displayName||null,t!==null?t:wA(Q.type)||"Memo";case EA:t=Q._payload,Q=Q._init;try{return wA(Q(t))}catch{}}return null}function LA(Q){var t=Q.type;switch(Q.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return Q=t.render,Q=Q.displayName||Q.name||"",t.displayName||(Q!==""?"ForwardRef("+Q+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return wA(t);case 8:return t===T?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function VA(Q){switch(typeof Q){case"boolean":case"number":case"string":case"undefined":return Q;case"object":return Q;default:return""}}function WA(Q){var t=Q.type;return(Q=Q.nodeName)&&Q.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function BI(Q){var t=WA(Q)?"checked":"value",l=Object.getOwnPropertyDescriptor(Q.constructor.prototype,t),w=""+Q[t];if(!Q.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var M=l.get,K=l.set;return Object.defineProperty(Q,t,{configurable:!0,get:function(){return M.call(this)},set:function(H){w=""+H,K.call(this,H)}}),Object.defineProperty(Q,t,{enumerable:l.enumerable}),{getValue:function(){return w},setValue:function(H){w=""+H},stopTracking:function(){Q._valueTracker=null,delete Q[t]}}}}function pI(Q){Q._valueTracker||(Q._valueTracker=BI(Q))}function TA(Q){if(!Q)return!1;var t=Q._valueTracker;if(!t)return!0;var l=t.getValue(),w="";return Q&&(w=WA(Q)?Q.checked?"true":"false":Q.value),Q=w,Q!==l?(t.setValue(Q),!0):!1}function _A(Q){if(Q=Q||(typeof document<"u"?document:void 0),typeof Q>"u")return null;try{return Q.activeElement||Q.body}catch{return Q.body}}function $(Q,t){var l=t.checked;return BA({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:l??Q._wrapperState.initialChecked})}function SI(Q,t){var l=t.defaultValue==null?"":t.defaultValue,w=t.checked!=null?t.checked:t.defaultChecked;l=VA(t.value!=null?t.value:l),Q._wrapperState={initialChecked:w,initialValue:l,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function jA(Q,t){t=t.checked,t!=null&&J(Q,"checked",t,!1)}function lI(Q,t){jA(Q,t);var l=VA(t.value),w=t.type;if(l!=null)w==="number"?(l===0&&Q.value===""||Q.value!=l)&&(Q.value=""+l):Q.value!==""+l&&(Q.value=""+l);else if(w==="submit"||w==="reset"){Q.removeAttribute("value");return}t.hasOwnProperty("value")?HI(Q,t.type,l):t.hasOwnProperty("defaultValue")&&HI(Q,t.type,VA(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(Q.defaultChecked=!!t.defaultChecked)}function CI(Q,t,l){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var w=t.type;if(!(w!=="submit"&&w!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+Q._wrapperState.initialValue,l||t===Q.value||(Q.value=t),Q.defaultValue=t}l=Q.name,l!==""&&(Q.name=""),Q.defaultChecked=!!Q._wrapperState.initialChecked,l!==""&&(Q.name=l)}function HI(Q,t,l){(t!=="number"||_A(Q.ownerDocument)!==Q)&&(l==null?Q.defaultValue=""+Q._wrapperState.initialValue:Q.defaultValue!==""+l&&(Q.defaultValue=""+l))}var nI=Array.isArray;function W(Q,t,l,w){if(Q=Q.options,t){t={};for(var M=0;M"+t.valueOf().toString()+"",t=tI.firstChild;Q.firstChild;)Q.removeChild(Q.firstChild);for(;t.firstChild;)Q.appendChild(t.firstChild)}});function Ig(Q,t){if(t){var l=Q.firstChild;if(l&&l===Q.lastChild&&l.nodeType===3){l.nodeValue=t;return}}Q.textContent=t}var zA={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},uI=["Webkit","ms","Moz","O"];Object.keys(zA).forEach(function(Q){uI.forEach(function(t){t=t+Q.charAt(0).toUpperCase()+Q.substring(1),zA[t]=zA[Q]})});function LI(Q,t,l){return t==null||typeof t=="boolean"||t===""?"":l||typeof t!="number"||t===0||zA.hasOwnProperty(Q)&&zA[Q]?(""+t).trim():t+"px"}function JI(Q,t){Q=Q.style;for(var l in t)if(t.hasOwnProperty(l)){var w=l.indexOf("--")===0,M=LI(l,t[l],w);l==="float"&&(l="cssFloat"),w?Q.setProperty(l,M):Q[l]=M}}var kI=BA({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function $I(Q,t){if(t){if(kI[Q]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(I(137,Q));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(I(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(I(61))}if(t.style!=null&&typeof t.style!="object")throw Error(I(62))}}function RI(Q,t){if(Q.indexOf("-")===-1)return typeof t.is=="string";switch(Q){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ZI=null;function sA(Q){return Q=Q.target||Q.srcElement||window,Q.correspondingUseElement&&(Q=Q.correspondingUseElement),Q.nodeType===3?Q.parentNode:Q}var KA=null,fA=null,bA=null;function hI(Q){if(Q=wQ(Q)){if(typeof KA!="function")throw Error(I(280));var t=Q.stateNode;t&&(t=Tn(t),KA(Q.stateNode,Q.type,t))}}function aI(Q){fA?bA?bA.push(Q):bA=[Q]:fA=Q}function PI(){if(fA){var Q=fA,t=bA;if(bA=fA=null,hI(Q),t)for(Q=0;Q>>=0,Q===0?32:31-(oI(Q)/jI|0)|0}var qg=64,Tg=4194304;function Mg(Q){switch(Q&-Q){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return Q&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return Q&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return Q}}function cg(Q,t){var l=Q.pendingLanes;if(l===0)return 0;var w=0,M=Q.suspendedLanes,K=Q.pingedLanes,H=l&268435455;if(H!==0){var AA=H&~M;AA!==0?w=Mg(AA):(K&=H,K!==0&&(w=Mg(K)))}else H=l&~M,H!==0?w=Mg(H):K!==0&&(w=Mg(K));if(w===0)return 0;if(t!==0&&t!==w&&(t&M)===0&&(M=w&-w,K=t&-t,M>=K||M===16&&(K&4194240)!==0))return t;if((w&4)!==0&&(w|=l&16),t=Q.entangledLanes,t!==0)for(Q=Q.entanglements,t&=w;0l;l++)t.push(Q);return t}function bg(Q,t,l){Q.pendingLanes|=t,t!==536870912&&(Q.suspendedLanes=0,Q.pingedLanes=0),Q=Q.eventTimes,t=31-wI(t),Q[t]=l}function jB(Q,t){var l=Q.pendingLanes&~t;Q.pendingLanes=t,Q.suspendedLanes=0,Q.pingedLanes=0,Q.expiredLanes&=t,Q.mutableReadLanes&=t,Q.entangledLanes&=t,t=Q.entanglements;var w=Q.eventTimes;for(Q=Q.expirationTimes;0=jC),hi=" ",sa=!1;function aa(Q,t){switch(Q){case"keyup":return na.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kn(Q){return Q=Q.detail,typeof Q=="object"&&"data"in Q?Q.data:null}var zQ=!1;function Nl(Q,t){switch(Q){case"compositionend":return kn(t);case"keypress":return t.which!==32?null:(sa=!0,hi);case"textInput":return Q=t.data,Q===hi&&sa?null:Q;default:return null}}function Nt(Q,t){if(zQ)return Q==="compositionend"||!kB&&aa(Q,t)?(Q=pt(),LB=ia=Ni=null,zQ=!1,Q):null;switch(Q){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:l,offset:t-Q};Q=w}A:{for(;l;){if(l.nextSibling){l=l.nextSibling;break A}l=l.parentNode}l=void 0}l=Jt(l)}}function Fe(Q,t){return Q&&t?Q===t?!0:Q&&Q.nodeType===3?!1:t&&t.nodeType===3?Fe(Q,t.parentNode):"contains"in Q?Q.contains(t):Q.compareDocumentPosition?!!(Q.compareDocumentPosition(t)&16):!1:!1}function EC(){for(var Q=window,t=_A();t instanceof Q.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)Q=t.contentWindow;else break;t=_A(Q.document)}return t}function mC(Q){var t=Q&&Q.nodeName&&Q.nodeName.toLowerCase();return t&&(t==="input"&&(Q.type==="text"||Q.type==="search"||Q.type==="tel"||Q.type==="url"||Q.type==="password")||t==="textarea"||Q.contentEditable==="true")}function HC(Q){var t=EC(),l=Q.focusedElem,w=Q.selectionRange;if(t!==l&&l&&l.ownerDocument&&Fe(l.ownerDocument.documentElement,l)){if(w!==null&&mC(l)){if(t=w.start,Q=w.end,Q===void 0&&(Q=t),"selectionStart"in l)l.selectionStart=t,l.selectionEnd=Math.min(Q,l.value.length);else if(Q=(t=l.ownerDocument||document)&&t.defaultView||window,Q.getSelection){Q=Q.getSelection();var M=l.textContent.length,K=Math.min(w.start,M);w=w.end===void 0?K:Math.min(w.end,M),!Q.extend&&K>w&&(M=w,w=K,K=M),M=$B(l,K);var H=$B(l,w);M&&H&&(Q.rangeCount!==1||Q.anchorNode!==M.node||Q.anchorOffset!==M.offset||Q.focusNode!==H.node||Q.focusOffset!==H.offset)&&(t=t.createRange(),t.setStart(M.node,M.offset),Q.removeAllRanges(),K>w?(Q.addRange(t),Q.extend(H.node,H.offset)):(t.setEnd(H.node,H.offset),Q.addRange(t)))}}for(t=[],Q=l;Q=Q.parentNode;)Q.nodeType===1&&t.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l=document.documentMode,Vi=null,fe=null,Kt=null,TC=!1;function dn(Q,t,l){var w=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;TC||Vi==null||Vi!==_A(w)||(w=Vi,"selectionStart"in w&&mC(w)?w={start:w.selectionStart,end:w.selectionEnd}:(w=(w.ownerDocument&&w.ownerDocument.defaultView||window).getSelection(),w={anchorNode:w.anchorNode,anchorOffset:w.anchorOffset,focusNode:w.focusNode,focusOffset:w.focusOffset}),Kt&&Ke(Kt,w)||(Kt=w,w=Ln(fe,"onSelect"),0xC||(Q.current=Ma[xC],Ma[xC]=null,xC--)}function jg(Q,t){xC++,Ma[xC]=Q.current,Q.current=t}var yQ={},XC=sC(yQ),uB=sC(!1),GQ=yQ;function qe(Q,t){var l=Q.type.contextTypes;if(!l)return yQ;var w=Q.stateNode;if(w&&w.__reactInternalMemoizedUnmaskedChildContext===t)return w.__reactInternalMemoizedMaskedChildContext;var M={},K;for(K in l)M[K]=t[K];return w&&(Q=Q.stateNode,Q.__reactInternalMemoizedUnmaskedChildContext=t,Q.__reactInternalMemoizedMaskedChildContext=M),M}function EB(Q){return Q=Q.childContextTypes,Q!=null}function Ht(){$g(uB),$g(XC)}function Ua(Q,t,l){if(XC.current!==yQ)throw Error(I(168));jg(XC,t),jg(uB,l)}function Tt(Q,t,l){var w=Q.stateNode;if(t=t.childContextTypes,typeof w.getChildContext!="function")return l;w=w.getChildContext();for(var M in w)if(!(M in t))throw Error(I(108,LA(Q)||"Unknown",M));return BA({},l,w)}function me(Q){return Q=(Q=Q.stateNode)&&Q.__reactInternalMemoizedMergedChildContext||yQ,GQ=XC.current,jg(XC,Q),jg(uB,uB.current),!0}function pa(Q,t,l){var w=Q.stateNode;if(!w)throw Error(I(169));l?(Q=Tt(Q,t,GQ),w.__reactInternalMemoizedMergedChildContext=Q,$g(uB),$g(XC),jg(XC,Q)):$g(uB),jg(uB,l)}var fi=null,xt=!1,xn=!1;function vt(Q){fi===null?fi=[Q]:fi.push(Q)}function ql(Q){xt=!0,vt(Q)}function Xi(){if(!xn&&fi!==null){xn=!0;var Q=0,t=Fg;try{var l=fi;for(Fg=1;Q>=H,M-=H,sI=1<<32-wI(t)+M|l<Bg?(sB=zI,zI=null):sB=zI.sibling;var xg=AI(UA,zI,dA[Bg],EI);if(xg===null){zI===null&&(zI=sB);break}Q&&zI&&xg.alternate===null&&t(UA,zI),rA=K(xg,rA,Bg),XI===null?vI=xg:XI.sibling=xg,XI=xg,zI=sB}if(Bg===dA.length)return l(UA,zI),IC&&kQ(UA,Bg),vI;if(zI===null){for(;BgBg?(sB=zI,zI=null):sB=zI.sibling;var XE=AI(UA,zI,xg.value,EI);if(XE===null){zI===null&&(zI=sB);break}Q&&zI&&XE.alternate===null&&t(UA,zI),rA=K(XE,rA,Bg),XI===null?vI=XE:XI.sibling=XE,XI=XE,zI=sB}if(xg.done)return l(UA,zI),IC&&kQ(UA,Bg),vI;if(zI===null){for(;!xg.done;Bg++,xg=dA.next())xg=gI(UA,xg.value,EI),xg!==null&&(rA=K(xg,rA,Bg),XI===null?vI=xg:XI.sibling=xg,XI=xg);return IC&&kQ(UA,Bg),vI}for(zI=w(UA,zI);!xg.done;Bg++,xg=dA.next())xg=NI(zI,UA,Bg,xg.value,EI),xg!==null&&(Q&&xg.alternate!==null&&zI.delete(xg.key===null?Bg:xg.key),rA=K(xg,rA,Bg),XI===null?vI=xg:XI.sibling=xg,XI=xg);return Q&&zI.forEach(function(fN){return t(UA,fN)}),IC&&kQ(UA,Bg),vI}function FC(UA,rA,dA,EI){if(typeof dA=="object"&&dA!==null&&dA.type===x&&dA.key===null&&(dA=dA.props.children),typeof dA=="object"&&dA!==null){switch(dA.$$typeof){case v:A:{for(var vI=dA.key,XI=rA;XI!==null;){if(XI.key===vI){if(vI=dA.type,vI===x){if(XI.tag===7){l(UA,XI.sibling),rA=M(XI,dA.props.children),rA.return=UA,UA=rA;break A}}else if(XI.elementType===vI||typeof vI=="object"&&vI!==null&&vI.$$typeof===EA&&fa(vI)===XI.type){l(UA,XI.sibling),rA=M(XI,dA.props),rA.ref=Ot(UA,XI,dA),rA.return=UA,UA=rA;break A}l(UA,XI);break}else t(UA,XI);XI=XI.sibling}dA.type===x?(rA=eo(dA.props.children,UA.mode,EI,dA.key),rA.return=UA,UA=rA):(EI=QD(dA.type,dA.key,dA.props,null,UA.mode,EI),EI.ref=Ot(UA,rA,dA),EI.return=UA,UA=EI)}return H(UA);case m:A:{for(XI=dA.key;rA!==null;){if(rA.key===XI)if(rA.tag===4&&rA.stateNode.containerInfo===dA.containerInfo&&rA.stateNode.implementation===dA.implementation){l(UA,rA.sibling),rA=M(rA,dA.children||[]),rA.return=UA,UA=rA;break A}else{l(UA,rA);break}else t(UA,rA);rA=rA.sibling}rA=PS(dA,UA.mode,EI),rA.return=UA,UA=rA}return H(UA);case EA:return XI=dA._init,FC(UA,rA,XI(dA._payload),EI)}if(nI(dA))return YI(UA,rA,dA,EI);if(aA(dA))return qI(UA,rA,dA,EI);bt(UA,dA)}return typeof dA=="string"&&dA!==""||typeof dA=="number"?(dA=""+dA,rA!==null&&rA.tag===6?(l(UA,rA.sibling),rA=M(rA,dA),rA.return=UA,UA=rA):(l(UA,rA),rA=ZS(dA,UA.mode,EI),rA.return=UA,UA=rA),H(UA)):l(UA,rA)}return FC}var xe=Ra(!0),_t=Ra(!1),ve=sC(null),Oe=null,MQ=null,TE=null;function be(){TE=MQ=Oe=null}function Zt(Q){var t=ve.current;$g(ve),Q._currentValue=t}function Pt(Q,t,l){for(;Q!==null;){var w=Q.alternate;if((Q.childLanes&t)!==t?(Q.childLanes|=t,w!==null&&(w.childLanes|=t)):w!==null&&(w.childLanes&t)!==t&&(w.childLanes|=t),Q===l)break;Q=Q.return}}function Be(Q,t){Oe=Q,TE=MQ=null,Q=Q.dependencies,Q!==null&&Q.firstContext!==null&&((Q.lanes&t)!==0&&(lg=!0),Q.firstContext=null)}function Ii(Q){var t=Q._currentValue;if(TE!==Q)if(Q={context:Q,memoizedValue:t,next:null},MQ===null){if(Oe===null)throw Error(I(308));MQ=Q,Oe.dependencies={lanes:0,firstContext:Q}}else MQ=MQ.next=Q;return t}var UQ=null;function La(Q){UQ===null?UQ=[Q]:UQ.push(Q)}function Wt(Q,t,l,w){var M=t.interleaved;return M===null?(l.next=l,La(t)):(l.next=M.next,M.next=l),t.interleaved=l,Ri(Q,w)}function Ri(Q,t){Q.lanes|=t;var l=Q.alternate;for(l!==null&&(l.lanes|=t),l=Q,Q=Q.return;Q!==null;)Q.childLanes|=t,l=Q.alternate,l!==null&&(l.childLanes|=t),l=Q,Q=Q.return;return l.tag===3?l.stateNode:null}var _g=!1;function ng(Q){Q.updateQueue={baseState:Q.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function cC(Q,t){Q=Q.updateQueue,t.updateQueue===Q&&(t.updateQueue={baseState:Q.baseState,firstBaseUpdate:Q.firstBaseUpdate,lastBaseUpdate:Q.lastBaseUpdate,shared:Q.shared,effects:Q.effects})}function Zg(Q,t){return{eventTime:Q,lane:t,tag:0,payload:null,callback:null,next:null}}function iC(Q,t,l){var w=Q.updateQueue;if(w===null)return null;if(w=w.shared,(mg&2)!==0){var M=w.pending;return M===null?t.next=t:(t.next=M.next,M.next=t),w.pending=t,Ri(Q,l)}return M=w.interleaved,M===null?(t.next=t,La(w)):(t.next=M.next,M.next=t),w.interleaved=t,Ri(Q,l)}function tB(Q,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194240)!==0)){var w=t.lanes;w&=Q.pendingLanes,l|=w,t.lanes=l,wE(Q,l)}}function _e(Q,t){var l=Q.updateQueue,w=Q.alternate;if(w!==null&&(w=w.updateQueue,l===w)){var M=null,K=null;if(l=l.firstBaseUpdate,l!==null){do{var H={eventTime:l.eventTime,lane:l.lane,tag:l.tag,payload:l.payload,callback:l.callback,next:null};K===null?M=K=H:K=K.next=H,l=l.next}while(l!==null);K===null?M=K=t:K=K.next=t}else M=K=t;l={baseState:w.baseState,firstBaseUpdate:M,lastBaseUpdate:K,shared:w.shared,effects:w.effects},Q.updateQueue=l;return}Q=l.lastBaseUpdate,Q===null?l.firstBaseUpdate=t:Q.next=t,l.lastBaseUpdate=t}function aC(Q,t,l,w){var M=Q.updateQueue;_g=!1;var K=M.firstBaseUpdate,H=M.lastBaseUpdate,AA=M.shared.pending;if(AA!==null){M.shared.pending=null;var tA=AA,RA=tA.next;tA.next=null,H===null?K=RA:H.next=RA,H=tA;var II=Q.alternate;II!==null&&(II=II.updateQueue,AA=II.lastBaseUpdate,AA!==H&&(AA===null?II.firstBaseUpdate=RA:AA.next=RA,II.lastBaseUpdate=tA))}if(K!==null){var gI=M.baseState;H=0,II=RA=tA=null,AA=K;do{var AI=AA.lane,NI=AA.eventTime;if((w&AI)===AI){II!==null&&(II=II.next={eventTime:NI,lane:0,tag:AA.tag,payload:AA.payload,callback:AA.callback,next:null});A:{var YI=Q,qI=AA;switch(AI=t,NI=l,qI.tag){case 1:if(YI=qI.payload,typeof YI=="function"){gI=YI.call(NI,gI,AI);break A}gI=YI;break A;case 3:YI.flags=YI.flags&-65537|128;case 0:if(YI=qI.payload,AI=typeof YI=="function"?YI.call(NI,gI,AI):YI,AI==null)break A;gI=BA({},gI,AI);break A;case 2:_g=!0}}AA.callback!==null&&AA.lane!==0&&(Q.flags|=64,AI=M.effects,AI===null?M.effects=[AA]:AI.push(AA))}else NI={eventTime:NI,lane:AI,tag:AA.tag,payload:AA.payload,callback:AA.callback,next:null},II===null?(RA=II=NI,tA=gI):II=II.next=NI,H|=AI;if(AA=AA.next,AA===null){if(AA=M.shared.pending,AA===null)break;AI=AA,AA=AI.next,AI.next=null,M.lastBaseUpdate=AI,M.shared.pending=null}}while(!0);if(II===null&&(tA=gI),M.baseState=tA,M.firstBaseUpdate=RA,M.lastBaseUpdate=II,t=M.shared.interleaved,t!==null){M=t;do H|=M.lane,M=M.next;while(M!==t)}else K===null&&(M.shared.lanes=0);Co|=H,Q.lanes=H,Q.memoizedState=gI}}function xE(Q,t,l){if(Q=t.effects,t.effects=null,Q!==null)for(t=0;tl?l:4,Q(!0);var w=Ve.transition;Ve.transition={};try{Q(!1),t()}finally{Fg=l,Ve.transition=w}}function JQ(){return Ci().memoizedState}function jn(Q,t,l){var w=WE(Q);if(l={lane:w,action:l,hasEagerState:!1,eagerState:null,next:null},Io(Q))Xn(t,l);else if(l=Wt(Q,t,l,w),l!==null){var M=Qi();RQ(l,Q,w,M),zn(l,t,w)}}function je(Q,t,l){var w=WE(Q),M={lane:w,action:l,hasEagerState:!1,eagerState:null,next:null};if(Io(Q))Xn(t,M);else{var K=Q.alternate;if(Q.lanes===0&&(K===null||K.lanes===0)&&(K=t.lastRenderedReducer,K!==null))try{var H=t.lastRenderedState,AA=K(H,l);if(M.hasEagerState=!0,M.eagerState=AA,zB(AA,H)){var tA=t.interleaved;tA===null?(M.next=M,La(t)):(M.next=tA.next,tA.next=M),t.interleaved=M;return}}catch{}finally{}l=Wt(Q,t,M,w),l!==null&&(M=Qi(),RQ(l,Q,w,M),zn(l,t,w))}}function Io(Q){var t=Q.alternate;return Q===AC||t!==null&&t===AC}function Xn(Q,t){oB=Yi=!0;var l=Q.pending;l===null?t.next=t:(t.next=l.next,l.next=t),Q.pending=t}function zn(Q,t,l){if((l&4194240)!==0){var w=t.lanes;w&=Q.pendingLanes,l|=w,t.lanes=l,wE(Q,l)}}var $n={readContext:Ii,useCallback:$C,useContext:$C,useEffect:$C,useImperativeHandle:$C,useInsertionEffect:$C,useLayoutEffect:$C,useMemo:$C,useReducer:$C,useRef:$C,useState:$C,useDebugValue:$C,useDeferredValue:$C,useTransition:$C,useMutableSource:$C,useSyncExternalStore:$C,useId:$C,unstable_isNewReconciler:!1},bl={readContext:Ii,useCallback:function(Q,t){return AB().memoizedState=[Q,t===void 0?null:t],Q},useContext:Ii,useEffect:pB,useImperativeHandle:function(Q,t,l){return l=l!=null?l.concat([Q]):null,AQ(4194308,4,vl.bind(null,t,Q),l)},useLayoutEffect:function(Q,t){return AQ(4194308,4,Q,t)},useInsertionEffect:function(Q,t){return AQ(4,2,Q,t)},useMemo:function(Q,t){var l=AB();return t=t===void 0?null:t,Q=Q(),l.memoizedState=[Q,t],Q},useReducer:function(Q,t,l){var w=AB();return t=l!==void 0?l(t):t,w.memoizedState=w.baseState=t,Q={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Q,lastRenderedState:t},w.queue=Q,Q=Q.dispatch=jn.bind(null,AC,Q),[w.memoizedState,Q]},useRef:function(Q){var t=AB();return Q={current:Q},t.memoizedState=Q},useState:Ta,useDebugValue:Wn,useDeferredValue:function(Q){return AB().memoizedState=Q},useTransition:function(){var Q=Ta(!1),t=Q[0];return Q=dS.bind(null,Q[1]),AB().memoizedState=Q,[t,Q]},useMutableSource:function(){},useSyncExternalStore:function(Q,t,l){var w=AC,M=AB();if(IC){if(l===void 0)throw Error(I(407));l=l()}else{if(l=t(),nB===null)throw Error(I(349));(dQ&30)!==0||Pn(w,t,l)}M.memoizedState=l;var K={value:l,getSnapshot:t};return M.queue=K,pB(ml.bind(null,w,K,Q),[Q]),w.flags|=2048,qi(9,$t.bind(null,w,K,l,t),void 0,null),l},useId:function(){var Q=AB(),t=nB.identifierPrefix;if(IC){var l=ci,w=sI;l=(w&~(1<<32-wI(w)-1)).toString(32)+l,t=":"+t+"R"+l,l=Qe++,0")&&(tA=tA.replace("",Q.displayName)),tA}while(1<=H&&0<=AA);break}}}finally{vA=!1,Error.prepareStackTrace=r}return(Q=Q?Q.displayName||Q.name:"")?oA(Q):""}function FA(Q){switch(Q.tag){case 5:return oA(Q.type);case 16:return oA("Lazy");case 13:return oA("Suspense");case 19:return oA("SuspenseList");case 0:case 2:case 15:return Q=cA(Q.type,!1),Q;case 11:return Q=cA(Q.type.render,!1),Q;case 1:return Q=cA(Q.type,!0),Q;default:return""}}function wA(Q){if(Q==null)return null;if(typeof Q=="function")return Q.displayName||Q.name||null;if(typeof Q=="string")return Q;switch(Q){case x:return"Fragment";case m:return"Portal";case L:return"Profiler";case T:return"StrictMode";case CA:return"Suspense";case nA:return"SuspenseList"}if(typeof Q=="object")switch(Q.$$typeof){case b:return(Q.displayName||"Context")+".Consumer";case Y:return(Q._context.displayName||"Context")+".Provider";case IA:var t=Q.render;return Q=Q.displayName,Q||(Q=t.displayName||t.name||"",Q=Q!==""?"ForwardRef("+Q+")":"ForwardRef"),Q;case uA:return t=Q.displayName||null,t!==null?t:wA(Q.type)||"Memo";case EA:t=Q._payload,Q=Q._init;try{return wA(Q(t))}catch{}}return null}function LA(Q){var t=Q.type;switch(Q.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return Q=t.render,Q=Q.displayName||Q.name||"",t.displayName||(Q!==""?"ForwardRef("+Q+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return wA(t);case 8:return t===T?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function VA(Q){switch(typeof Q){case"boolean":case"number":case"string":case"undefined":return Q;case"object":return Q;default:return""}}function WA(Q){var t=Q.type;return(Q=Q.nodeName)&&Q.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function BI(Q){var t=WA(Q)?"checked":"value",r=Object.getOwnPropertyDescriptor(Q.constructor.prototype,t),w=""+Q[t];if(!Q.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var M=r.get,K=r.set;return Object.defineProperty(Q,t,{configurable:!0,get:function(){return M.call(this)},set:function(H){w=""+H,K.call(this,H)}}),Object.defineProperty(Q,t,{enumerable:r.enumerable}),{getValue:function(){return w},setValue:function(H){w=""+H},stopTracking:function(){Q._valueTracker=null,delete Q[t]}}}}function pI(Q){Q._valueTracker||(Q._valueTracker=BI(Q))}function TA(Q){if(!Q)return!1;var t=Q._valueTracker;if(!t)return!0;var r=t.getValue(),w="";return Q&&(w=WA(Q)?Q.checked?"true":"false":Q.value),Q=w,Q!==r?(t.setValue(Q),!0):!1}function _A(Q){if(Q=Q||(typeof document<"u"?document:void 0),typeof Q>"u")return null;try{return Q.activeElement||Q.body}catch{return Q.body}}function $(Q,t){var r=t.checked;return BA({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??Q._wrapperState.initialChecked})}function SI(Q,t){var r=t.defaultValue==null?"":t.defaultValue,w=t.checked!=null?t.checked:t.defaultChecked;r=VA(t.value!=null?t.value:r),Q._wrapperState={initialChecked:w,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function jA(Q,t){t=t.checked,t!=null&&J(Q,"checked",t,!1)}function lI(Q,t){jA(Q,t);var r=VA(t.value),w=t.type;if(r!=null)w==="number"?(r===0&&Q.value===""||Q.value!=r)&&(Q.value=""+r):Q.value!==""+r&&(Q.value=""+r);else if(w==="submit"||w==="reset"){Q.removeAttribute("value");return}t.hasOwnProperty("value")?HI(Q,t.type,r):t.hasOwnProperty("defaultValue")&&HI(Q,t.type,VA(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(Q.defaultChecked=!!t.defaultChecked)}function CI(Q,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var w=t.type;if(!(w!=="submit"&&w!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+Q._wrapperState.initialValue,r||t===Q.value||(Q.value=t),Q.defaultValue=t}r=Q.name,r!==""&&(Q.name=""),Q.defaultChecked=!!Q._wrapperState.initialChecked,r!==""&&(Q.name=r)}function HI(Q,t,r){(t!=="number"||_A(Q.ownerDocument)!==Q)&&(r==null?Q.defaultValue=""+Q._wrapperState.initialValue:Q.defaultValue!==""+r&&(Q.defaultValue=""+r))}var nI=Array.isArray;function W(Q,t,r,w){if(Q=Q.options,t){t={};for(var M=0;M"+t.valueOf().toString()+"",t=tI.firstChild;Q.firstChild;)Q.removeChild(Q.firstChild);for(;t.firstChild;)Q.appendChild(t.firstChild)}});function Ig(Q,t){if(t){var r=Q.firstChild;if(r&&r===Q.lastChild&&r.nodeType===3){r.nodeValue=t;return}}Q.textContent=t}var zA={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},uI=["Webkit","ms","Moz","O"];Object.keys(zA).forEach(function(Q){uI.forEach(function(t){t=t+Q.charAt(0).toUpperCase()+Q.substring(1),zA[t]=zA[Q]})});function LI(Q,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||zA.hasOwnProperty(Q)&&zA[Q]?(""+t).trim():t+"px"}function JI(Q,t){Q=Q.style;for(var r in t)if(t.hasOwnProperty(r)){var w=r.indexOf("--")===0,M=LI(r,t[r],w);r==="float"&&(r="cssFloat"),w?Q.setProperty(r,M):Q[r]=M}}var kI=BA({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function $I(Q,t){if(t){if(kI[Q]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(I(137,Q));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(I(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(I(61))}if(t.style!=null&&typeof t.style!="object")throw Error(I(62))}}function RI(Q,t){if(Q.indexOf("-")===-1)return typeof t.is=="string";switch(Q){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ZI=null;function sA(Q){return Q=Q.target||Q.srcElement||window,Q.correspondingUseElement&&(Q=Q.correspondingUseElement),Q.nodeType===3?Q.parentNode:Q}var KA=null,fA=null,bA=null;function hI(Q){if(Q=wQ(Q)){if(typeof KA!="function")throw Error(I(280));var t=Q.stateNode;t&&(t=Tn(t),KA(Q.stateNode,Q.type,t))}}function aI(Q){fA?bA?bA.push(Q):bA=[Q]:fA=Q}function PI(){if(fA){var Q=fA,t=bA;if(bA=fA=null,hI(Q),t)for(Q=0;Q>>=0,Q===0?32:31-(oI(Q)/jI|0)|0}var qg=64,Tg=4194304;function Mg(Q){switch(Q&-Q){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return Q&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return Q&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return Q}}function cg(Q,t){var r=Q.pendingLanes;if(r===0)return 0;var w=0,M=Q.suspendedLanes,K=Q.pingedLanes,H=r&268435455;if(H!==0){var AA=H&~M;AA!==0?w=Mg(AA):(K&=H,K!==0&&(w=Mg(K)))}else H=r&~M,H!==0?w=Mg(H):K!==0&&(w=Mg(K));if(w===0)return 0;if(t!==0&&t!==w&&(t&M)===0&&(M=w&-w,K=t&-t,M>=K||M===16&&(K&4194240)!==0))return t;if((w&4)!==0&&(w|=r&16),t=Q.entangledLanes,t!==0)for(Q=Q.entanglements,t&=w;0r;r++)t.push(Q);return t}function bg(Q,t,r){Q.pendingLanes|=t,t!==536870912&&(Q.suspendedLanes=0,Q.pingedLanes=0),Q=Q.eventTimes,t=31-wI(t),Q[t]=r}function jB(Q,t){var r=Q.pendingLanes&~t;Q.pendingLanes=t,Q.suspendedLanes=0,Q.pingedLanes=0,Q.expiredLanes&=t,Q.mutableReadLanes&=t,Q.entangledLanes&=t,t=Q.entanglements;var w=Q.eventTimes;for(Q=Q.expirationTimes;0=jC),hi=" ",sa=!1;function aa(Q,t){switch(Q){case"keyup":return na.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kn(Q){return Q=Q.detail,typeof Q=="object"&&"data"in Q?Q.data:null}var zQ=!1;function Nl(Q,t){switch(Q){case"compositionend":return kn(t);case"keypress":return t.which!==32?null:(sa=!0,hi);case"textInput":return Q=t.data,Q===hi&&sa?null:Q;default:return null}}function Nt(Q,t){if(zQ)return Q==="compositionend"||!kB&&aa(Q,t)?(Q=pt(),LB=ia=Ni=null,zQ=!1,Q):null;switch(Q){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-Q};Q=w}A:{for(;r;){if(r.nextSibling){r=r.nextSibling;break A}r=r.parentNode}r=void 0}r=Jt(r)}}function Fe(Q,t){return Q&&t?Q===t?!0:Q&&Q.nodeType===3?!1:t&&t.nodeType===3?Fe(Q,t.parentNode):"contains"in Q?Q.contains(t):Q.compareDocumentPosition?!!(Q.compareDocumentPosition(t)&16):!1:!1}function EC(){for(var Q=window,t=_A();t instanceof Q.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)Q=t.contentWindow;else break;t=_A(Q.document)}return t}function mC(Q){var t=Q&&Q.nodeName&&Q.nodeName.toLowerCase();return t&&(t==="input"&&(Q.type==="text"||Q.type==="search"||Q.type==="tel"||Q.type==="url"||Q.type==="password")||t==="textarea"||Q.contentEditable==="true")}function HC(Q){var t=EC(),r=Q.focusedElem,w=Q.selectionRange;if(t!==r&&r&&r.ownerDocument&&Fe(r.ownerDocument.documentElement,r)){if(w!==null&&mC(r)){if(t=w.start,Q=w.end,Q===void 0&&(Q=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(Q,r.value.length);else if(Q=(t=r.ownerDocument||document)&&t.defaultView||window,Q.getSelection){Q=Q.getSelection();var M=r.textContent.length,K=Math.min(w.start,M);w=w.end===void 0?K:Math.min(w.end,M),!Q.extend&&K>w&&(M=w,w=K,K=M),M=$B(r,K);var H=$B(r,w);M&&H&&(Q.rangeCount!==1||Q.anchorNode!==M.node||Q.anchorOffset!==M.offset||Q.focusNode!==H.node||Q.focusOffset!==H.offset)&&(t=t.createRange(),t.setStart(M.node,M.offset),Q.removeAllRanges(),K>w?(Q.addRange(t),Q.extend(H.node,H.offset)):(t.setEnd(H.node,H.offset),Q.addRange(t)))}}for(t=[],Q=r;Q=Q.parentNode;)Q.nodeType===1&&t.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,Vi=null,fe=null,Kt=null,TC=!1;function dn(Q,t,r){var w=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;TC||Vi==null||Vi!==_A(w)||(w=Vi,"selectionStart"in w&&mC(w)?w={start:w.selectionStart,end:w.selectionEnd}:(w=(w.ownerDocument&&w.ownerDocument.defaultView||window).getSelection(),w={anchorNode:w.anchorNode,anchorOffset:w.anchorOffset,focusNode:w.focusNode,focusOffset:w.focusOffset}),Kt&&Ke(Kt,w)||(Kt=w,w=Ln(fe,"onSelect"),0xC||(Q.current=Ma[xC],Ma[xC]=null,xC--)}function jg(Q,t){xC++,Ma[xC]=Q.current,Q.current=t}var yQ={},XC=sC(yQ),uB=sC(!1),GQ=yQ;function qe(Q,t){var r=Q.type.contextTypes;if(!r)return yQ;var w=Q.stateNode;if(w&&w.__reactInternalMemoizedUnmaskedChildContext===t)return w.__reactInternalMemoizedMaskedChildContext;var M={},K;for(K in r)M[K]=t[K];return w&&(Q=Q.stateNode,Q.__reactInternalMemoizedUnmaskedChildContext=t,Q.__reactInternalMemoizedMaskedChildContext=M),M}function EB(Q){return Q=Q.childContextTypes,Q!=null}function Ht(){$g(uB),$g(XC)}function Ua(Q,t,r){if(XC.current!==yQ)throw Error(I(168));jg(XC,t),jg(uB,r)}function Tt(Q,t,r){var w=Q.stateNode;if(t=t.childContextTypes,typeof w.getChildContext!="function")return r;w=w.getChildContext();for(var M in w)if(!(M in t))throw Error(I(108,LA(Q)||"Unknown",M));return BA({},r,w)}function me(Q){return Q=(Q=Q.stateNode)&&Q.__reactInternalMemoizedMergedChildContext||yQ,GQ=XC.current,jg(XC,Q),jg(uB,uB.current),!0}function pa(Q,t,r){var w=Q.stateNode;if(!w)throw Error(I(169));r?(Q=Tt(Q,t,GQ),w.__reactInternalMemoizedMergedChildContext=Q,$g(uB),$g(XC),jg(XC,Q)):$g(uB),jg(uB,r)}var fi=null,xt=!1,xn=!1;function vt(Q){fi===null?fi=[Q]:fi.push(Q)}function ql(Q){xt=!0,vt(Q)}function Xi(){if(!xn&&fi!==null){xn=!0;var Q=0,t=Fg;try{var r=fi;for(Fg=1;Q>=H,M-=H,sI=1<<32-wI(t)+M|r<Bg?(sB=zI,zI=null):sB=zI.sibling;var xg=AI(UA,zI,dA[Bg],EI);if(xg===null){zI===null&&(zI=sB);break}Q&&zI&&xg.alternate===null&&t(UA,zI),rA=K(xg,rA,Bg),XI===null?vI=xg:XI.sibling=xg,XI=xg,zI=sB}if(Bg===dA.length)return r(UA,zI),IC&&kQ(UA,Bg),vI;if(zI===null){for(;BgBg?(sB=zI,zI=null):sB=zI.sibling;var XE=AI(UA,zI,xg.value,EI);if(XE===null){zI===null&&(zI=sB);break}Q&&zI&&XE.alternate===null&&t(UA,zI),rA=K(XE,rA,Bg),XI===null?vI=XE:XI.sibling=XE,XI=XE,zI=sB}if(xg.done)return r(UA,zI),IC&&kQ(UA,Bg),vI;if(zI===null){for(;!xg.done;Bg++,xg=dA.next())xg=gI(UA,xg.value,EI),xg!==null&&(rA=K(xg,rA,Bg),XI===null?vI=xg:XI.sibling=xg,XI=xg);return IC&&kQ(UA,Bg),vI}for(zI=w(UA,zI);!xg.done;Bg++,xg=dA.next())xg=NI(zI,UA,Bg,xg.value,EI),xg!==null&&(Q&&xg.alternate!==null&&zI.delete(xg.key===null?Bg:xg.key),rA=K(xg,rA,Bg),XI===null?vI=xg:XI.sibling=xg,XI=xg);return Q&&zI.forEach(function(fN){return t(UA,fN)}),IC&&kQ(UA,Bg),vI}function FC(UA,rA,dA,EI){if(typeof dA=="object"&&dA!==null&&dA.type===x&&dA.key===null&&(dA=dA.props.children),typeof dA=="object"&&dA!==null){switch(dA.$$typeof){case v:A:{for(var vI=dA.key,XI=rA;XI!==null;){if(XI.key===vI){if(vI=dA.type,vI===x){if(XI.tag===7){r(UA,XI.sibling),rA=M(XI,dA.props.children),rA.return=UA,UA=rA;break A}}else if(XI.elementType===vI||typeof vI=="object"&&vI!==null&&vI.$$typeof===EA&&fa(vI)===XI.type){r(UA,XI.sibling),rA=M(XI,dA.props),rA.ref=Ot(UA,XI,dA),rA.return=UA,UA=rA;break A}r(UA,XI);break}else t(UA,XI);XI=XI.sibling}dA.type===x?(rA=eo(dA.props.children,UA.mode,EI,dA.key),rA.return=UA,UA=rA):(EI=QD(dA.type,dA.key,dA.props,null,UA.mode,EI),EI.ref=Ot(UA,rA,dA),EI.return=UA,UA=EI)}return H(UA);case m:A:{for(XI=dA.key;rA!==null;){if(rA.key===XI)if(rA.tag===4&&rA.stateNode.containerInfo===dA.containerInfo&&rA.stateNode.implementation===dA.implementation){r(UA,rA.sibling),rA=M(rA,dA.children||[]),rA.return=UA,UA=rA;break A}else{r(UA,rA);break}else t(UA,rA);rA=rA.sibling}rA=PS(dA,UA.mode,EI),rA.return=UA,UA=rA}return H(UA);case EA:return XI=dA._init,FC(UA,rA,XI(dA._payload),EI)}if(nI(dA))return YI(UA,rA,dA,EI);if(aA(dA))return qI(UA,rA,dA,EI);bt(UA,dA)}return typeof dA=="string"&&dA!==""||typeof dA=="number"?(dA=""+dA,rA!==null&&rA.tag===6?(r(UA,rA.sibling),rA=M(rA,dA),rA.return=UA,UA=rA):(r(UA,rA),rA=ZS(dA,UA.mode,EI),rA.return=UA,UA=rA),H(UA)):r(UA,rA)}return FC}var xe=Ra(!0),_t=Ra(!1),ve=sC(null),Oe=null,MQ=null,TE=null;function be(){TE=MQ=Oe=null}function Zt(Q){var t=ve.current;$g(ve),Q._currentValue=t}function Pt(Q,t,r){for(;Q!==null;){var w=Q.alternate;if((Q.childLanes&t)!==t?(Q.childLanes|=t,w!==null&&(w.childLanes|=t)):w!==null&&(w.childLanes&t)!==t&&(w.childLanes|=t),Q===r)break;Q=Q.return}}function Be(Q,t){Oe=Q,TE=MQ=null,Q=Q.dependencies,Q!==null&&Q.firstContext!==null&&((Q.lanes&t)!==0&&(lg=!0),Q.firstContext=null)}function Ii(Q){var t=Q._currentValue;if(TE!==Q)if(Q={context:Q,memoizedValue:t,next:null},MQ===null){if(Oe===null)throw Error(I(308));MQ=Q,Oe.dependencies={lanes:0,firstContext:Q}}else MQ=MQ.next=Q;return t}var UQ=null;function La(Q){UQ===null?UQ=[Q]:UQ.push(Q)}function Wt(Q,t,r,w){var M=t.interleaved;return M===null?(r.next=r,La(t)):(r.next=M.next,M.next=r),t.interleaved=r,Ri(Q,w)}function Ri(Q,t){Q.lanes|=t;var r=Q.alternate;for(r!==null&&(r.lanes|=t),r=Q,Q=Q.return;Q!==null;)Q.childLanes|=t,r=Q.alternate,r!==null&&(r.childLanes|=t),r=Q,Q=Q.return;return r.tag===3?r.stateNode:null}var _g=!1;function ng(Q){Q.updateQueue={baseState:Q.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function cC(Q,t){Q=Q.updateQueue,t.updateQueue===Q&&(t.updateQueue={baseState:Q.baseState,firstBaseUpdate:Q.firstBaseUpdate,lastBaseUpdate:Q.lastBaseUpdate,shared:Q.shared,effects:Q.effects})}function Zg(Q,t){return{eventTime:Q,lane:t,tag:0,payload:null,callback:null,next:null}}function iC(Q,t,r){var w=Q.updateQueue;if(w===null)return null;if(w=w.shared,(mg&2)!==0){var M=w.pending;return M===null?t.next=t:(t.next=M.next,M.next=t),w.pending=t,Ri(Q,r)}return M=w.interleaved,M===null?(t.next=t,La(w)):(t.next=M.next,M.next=t),w.interleaved=t,Ri(Q,r)}function tB(Q,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var w=t.lanes;w&=Q.pendingLanes,r|=w,t.lanes=r,wE(Q,r)}}function _e(Q,t){var r=Q.updateQueue,w=Q.alternate;if(w!==null&&(w=w.updateQueue,r===w)){var M=null,K=null;if(r=r.firstBaseUpdate,r!==null){do{var H={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};K===null?M=K=H:K=K.next=H,r=r.next}while(r!==null);K===null?M=K=t:K=K.next=t}else M=K=t;r={baseState:w.baseState,firstBaseUpdate:M,lastBaseUpdate:K,shared:w.shared,effects:w.effects},Q.updateQueue=r;return}Q=r.lastBaseUpdate,Q===null?r.firstBaseUpdate=t:Q.next=t,r.lastBaseUpdate=t}function aC(Q,t,r,w){var M=Q.updateQueue;_g=!1;var K=M.firstBaseUpdate,H=M.lastBaseUpdate,AA=M.shared.pending;if(AA!==null){M.shared.pending=null;var tA=AA,RA=tA.next;tA.next=null,H===null?K=RA:H.next=RA,H=tA;var II=Q.alternate;II!==null&&(II=II.updateQueue,AA=II.lastBaseUpdate,AA!==H&&(AA===null?II.firstBaseUpdate=RA:AA.next=RA,II.lastBaseUpdate=tA))}if(K!==null){var gI=M.baseState;H=0,II=RA=tA=null,AA=K;do{var AI=AA.lane,NI=AA.eventTime;if((w&AI)===AI){II!==null&&(II=II.next={eventTime:NI,lane:0,tag:AA.tag,payload:AA.payload,callback:AA.callback,next:null});A:{var YI=Q,qI=AA;switch(AI=t,NI=r,qI.tag){case 1:if(YI=qI.payload,typeof YI=="function"){gI=YI.call(NI,gI,AI);break A}gI=YI;break A;case 3:YI.flags=YI.flags&-65537|128;case 0:if(YI=qI.payload,AI=typeof YI=="function"?YI.call(NI,gI,AI):YI,AI==null)break A;gI=BA({},gI,AI);break A;case 2:_g=!0}}AA.callback!==null&&AA.lane!==0&&(Q.flags|=64,AI=M.effects,AI===null?M.effects=[AA]:AI.push(AA))}else NI={eventTime:NI,lane:AI,tag:AA.tag,payload:AA.payload,callback:AA.callback,next:null},II===null?(RA=II=NI,tA=gI):II=II.next=NI,H|=AI;if(AA=AA.next,AA===null){if(AA=M.shared.pending,AA===null)break;AI=AA,AA=AI.next,AI.next=null,M.lastBaseUpdate=AI,M.shared.pending=null}}while(!0);if(II===null&&(tA=gI),M.baseState=tA,M.firstBaseUpdate=RA,M.lastBaseUpdate=II,t=M.shared.interleaved,t!==null){M=t;do H|=M.lane,M=M.next;while(M!==t)}else K===null&&(M.shared.lanes=0);Co|=H,Q.lanes=H,Q.memoizedState=gI}}function xE(Q,t,r){if(Q=t.effects,t.effects=null,Q!==null)for(t=0;tr?r:4,Q(!0);var w=Ve.transition;Ve.transition={};try{Q(!1),t()}finally{Fg=r,Ve.transition=w}}function JQ(){return Ci().memoizedState}function jn(Q,t,r){var w=WE(Q);if(r={lane:w,action:r,hasEagerState:!1,eagerState:null,next:null},Io(Q))Xn(t,r);else if(r=Wt(Q,t,r,w),r!==null){var M=Qi();RQ(r,Q,w,M),zn(r,t,w)}}function je(Q,t,r){var w=WE(Q),M={lane:w,action:r,hasEagerState:!1,eagerState:null,next:null};if(Io(Q))Xn(t,M);else{var K=Q.alternate;if(Q.lanes===0&&(K===null||K.lanes===0)&&(K=t.lastRenderedReducer,K!==null))try{var H=t.lastRenderedState,AA=K(H,r);if(M.hasEagerState=!0,M.eagerState=AA,zB(AA,H)){var tA=t.interleaved;tA===null?(M.next=M,La(t)):(M.next=tA.next,tA.next=M),t.interleaved=M;return}}catch{}finally{}r=Wt(Q,t,M,w),r!==null&&(M=Qi(),RQ(r,Q,w,M),zn(r,t,w))}}function Io(Q){var t=Q.alternate;return Q===AC||t!==null&&t===AC}function Xn(Q,t){oB=Yi=!0;var r=Q.pending;r===null?t.next=t:(t.next=r.next,r.next=t),Q.pending=t}function zn(Q,t,r){if((r&4194240)!==0){var w=t.lanes;w&=Q.pendingLanes,r|=w,t.lanes=r,wE(Q,r)}}var $n={readContext:Ii,useCallback:$C,useContext:$C,useEffect:$C,useImperativeHandle:$C,useInsertionEffect:$C,useLayoutEffect:$C,useMemo:$C,useReducer:$C,useRef:$C,useState:$C,useDebugValue:$C,useDeferredValue:$C,useTransition:$C,useMutableSource:$C,useSyncExternalStore:$C,useId:$C,unstable_isNewReconciler:!1},bl={readContext:Ii,useCallback:function(Q,t){return AB().memoizedState=[Q,t===void 0?null:t],Q},useContext:Ii,useEffect:pB,useImperativeHandle:function(Q,t,r){return r=r!=null?r.concat([Q]):null,AQ(4194308,4,vl.bind(null,t,Q),r)},useLayoutEffect:function(Q,t){return AQ(4194308,4,Q,t)},useInsertionEffect:function(Q,t){return AQ(4,2,Q,t)},useMemo:function(Q,t){var r=AB();return t=t===void 0?null:t,Q=Q(),r.memoizedState=[Q,t],Q},useReducer:function(Q,t,r){var w=AB();return t=r!==void 0?r(t):t,w.memoizedState=w.baseState=t,Q={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Q,lastRenderedState:t},w.queue=Q,Q=Q.dispatch=jn.bind(null,AC,Q),[w.memoizedState,Q]},useRef:function(Q){var t=AB();return Q={current:Q},t.memoizedState=Q},useState:Ta,useDebugValue:Wn,useDeferredValue:function(Q){return AB().memoizedState=Q},useTransition:function(){var Q=Ta(!1),t=Q[0];return Q=dS.bind(null,Q[1]),AB().memoizedState=Q,[t,Q]},useMutableSource:function(){},useSyncExternalStore:function(Q,t,r){var w=AC,M=AB();if(IC){if(r===void 0)throw Error(I(407));r=r()}else{if(r=t(),nB===null)throw Error(I(349));(dQ&30)!==0||Pn(w,t,r)}M.memoizedState=r;var K={value:r,getSnapshot:t};return M.queue=K,pB(ml.bind(null,w,K,Q),[Q]),w.flags|=2048,qi(9,$t.bind(null,w,K,r,t),void 0,null),r},useId:function(){var Q=AB(),t=nB.identifierPrefix;if(IC){var r=ci,w=sI;r=(w&~(1<<32-wI(w)-1)).toString(32)+r,t=":"+t+"R"+r,r=Qe++,0<\/script>",Q=Q.removeChild(Q.firstChild)):typeof w.is=="string"?Q=H.createElement(l,{is:w.is}):(Q=H.createElement(l),l==="select"&&(H=Q,w.multiple?H.multiple=!0:w.size&&(H.size=w.size))):Q=H.createElementNS(Q,l),Q[KC]=t,Q[qE]=w,Yk(Q,t,!1,!1),t.stateNode=Q;A:{switch(H=RI(l,w),l){case"dialog":zg("cancel",Q),zg("close",Q),M=w;break;case"iframe":case"object":case"embed":zg("load",Q),M=w;break;case"video":case"audio":for(M=0;MCs&&(t.flags|=128,w=!0,_a(K,!1),t.lanes=4194304)}else{if(!w)if(Q=Li(H),Q!==null){if(t.flags|=128,w=!0,l=Q.updateQueue,l!==null&&(t.updateQueue=l,t.flags|=4),_a(K,!0),K.tail===null&&K.tailMode==="hidden"&&!H.alternate&&!IC)return TB(t),null}else 2*yA()-K.renderingStartTime>Cs&&l!==1073741824&&(t.flags|=128,w=!0,_a(K,!1),t.lanes=4194304);K.isBackwards?(H.sibling=t.child,t.child=H):(l=K.last,l!==null?l.sibling=H:t.child=H,K.last=H)}return K.tail!==null?(t=K.tail,K.rendering=t,K.tail=t.sibling,K.renderingStartTime=yA(),t.sibling=null,l=gC.current,jg(gC,w?l&1|2:l&1),t):(TB(t),null);case 22:case 23:return OS(),w=t.memoizedState!==null,Q!==null&&Q.memoizedState!==null!==w&&(t.flags|=8192),w&&(t.mode&1)!==0?(mi&1073741824)!==0&&(TB(t),t.subtreeFlags&6&&(t.flags|=8192)):TB(t),null;case 24:return null;case 25:return null}throw Error(I(156,t.tag))}function aN(Q,t){switch(uQ(t),t.tag){case 1:return EB(t.type)&&Ht(),Q=t.flags,Q&65536?(t.flags=Q&-65537|128,t):null;case 3:return ie(),$g(uB),$g(XC),$i(),Q=t.flags,(Q&65536)!==0&&(Q&128)===0?(t.flags=Q&-65537|128,t):null;case 5:return vE(t),null;case 13:if($g(gC),Q=t.memoizedState,Q!==null&&Q.dehydrated!==null){if(t.alternate===null)throw Error(I(340));Ce()}return Q=t.flags,Q&65536?(t.flags=Q&-65537|128,t):null;case 19:return $g(gC),null;case 4:return ie(),null;case 10:return Zt(t.type._context),null;case 22:case 23:return OS(),null;case 24:return null;default:return null}}var jl=!1,xB=!1,rN=typeof WeakSet=="function"?WeakSet:Set,fI=null;function Is(Q,t){var l=Q.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(w){MC(Q,t,w)}else l.current=null}function KS(Q,t,l){try{l()}catch(w){MC(Q,t,w)}}var Hk=!1;function lN(Q,t){if(YE=si,Q=EC(),mC(Q)){if("selectionStart"in Q)var l={start:Q.selectionStart,end:Q.selectionEnd};else A:{l=(l=Q.ownerDocument)&&l.defaultView||window;var w=l.getSelection&&l.getSelection();if(w&&w.rangeCount!==0){l=w.anchorNode;var M=w.anchorOffset,K=w.focusNode;w=w.focusOffset;try{l.nodeType,K.nodeType}catch{l=null;break A}var H=0,AA=-1,tA=-1,RA=0,II=0,gI=Q,AI=null;I:for(;;){for(var NI;gI!==l||M!==0&&gI.nodeType!==3||(AA=H+M),gI!==K||w!==0&&gI.nodeType!==3||(tA=H+w),gI.nodeType===3&&(H+=gI.nodeValue.length),(NI=gI.firstChild)!==null;)AI=gI,gI=NI;for(;;){if(gI===Q)break I;if(AI===l&&++RA===M&&(AA=H),AI===K&&++II===w&&(tA=H),(NI=gI.nextSibling)!==null)break;gI=AI,AI=gI.parentNode}gI=NI}l=AA===-1||tA===-1?null:{start:AA,end:tA}}else l=null}l=l||{start:0,end:0}}else l=null;for(wa={focusedElem:Q,selectionRange:l},si=!1,fI=t;fI!==null;)if(t=fI,Q=t.child,(t.subtreeFlags&1028)!==0&&Q!==null)Q.return=t,fI=Q;else for(;fI!==null;){t=fI;try{var YI=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(YI!==null){var qI=YI.memoizedProps,FC=YI.memoizedState,UA=t.stateNode,rA=UA.getSnapshotBeforeUpdate(t.elementType===t.type?qI:wi(t.type,qI),FC);UA.__reactInternalSnapshotBeforeUpdate=rA}break;case 3:var dA=t.stateNode.containerInfo;dA.nodeType===1?dA.textContent="":dA.nodeType===9&&dA.documentElement&&dA.removeChild(dA.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(I(163))}}catch(EI){MC(t,t.return,EI)}if(Q=t.sibling,Q!==null){Q.return=t.return,fI=Q;break}fI=t.return}return YI=Hk,Hk=!1,YI}function Za(Q,t,l){var w=t.updateQueue;if(w=w!==null?w.lastEffect:null,w!==null){var M=w=w.next;do{if((M.tag&Q)===Q){var K=M.destroy;M.destroy=void 0,K!==void 0&&KS(t,l,K)}M=M.next}while(M!==w)}}function Xl(Q,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var l=t=t.next;do{if((l.tag&Q)===Q){var w=l.create;l.destroy=w()}l=l.next}while(l!==t)}}function FS(Q){var t=Q.ref;if(t!==null){var l=Q.stateNode;switch(Q.tag){case 5:Q=l;break;default:Q=l}typeof t=="function"?t(Q):t.current=Q}}function Tk(Q){var t=Q.alternate;t!==null&&(Q.alternate=null,Tk(t)),Q.child=null,Q.deletions=null,Q.sibling=null,Q.tag===5&&(t=Q.stateNode,t!==null&&(delete t[KC],delete t[qE],delete t[Ye],delete t[mn],delete t[Hn])),Q.stateNode=null,Q.return=null,Q.dependencies=null,Q.memoizedProps=null,Q.memoizedState=null,Q.pendingProps=null,Q.stateNode=null,Q.updateQueue=null}function xk(Q){return Q.tag===5||Q.tag===3||Q.tag===4}function vk(Q){A:for(;;){for(;Q.sibling===null;){if(Q.return===null||xk(Q.return))return null;Q=Q.return}for(Q.sibling.return=Q.return,Q=Q.sibling;Q.tag!==5&&Q.tag!==6&&Q.tag!==18;){if(Q.flags&2||Q.child===null||Q.tag===4)continue A;Q.child.return=Q,Q=Q.child}if(!(Q.flags&2))return Q.stateNode}}function fS(Q,t,l){var w=Q.tag;if(w===5||w===6)Q=Q.stateNode,t?l.nodeType===8?l.parentNode.insertBefore(Q,t):l.insertBefore(Q,t):(l.nodeType===8?(t=l.parentNode,t.insertBefore(Q,l)):(t=l,t.appendChild(Q)),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=mt));else if(w!==4&&(Q=Q.child,Q!==null))for(fS(Q,t,l),Q=Q.sibling;Q!==null;)fS(Q,t,l),Q=Q.sibling}function RS(Q,t,l){var w=Q.tag;if(w===5||w===6)Q=Q.stateNode,t?l.insertBefore(Q,t):l.appendChild(Q);else if(w!==4&&(Q=Q.child,Q!==null))for(RS(Q,t,l),Q=Q.sibling;Q!==null;)RS(Q,t,l),Q=Q.sibling}var dB=null,FQ=!1;function _E(Q,t,l){for(l=l.child;l!==null;)Ok(Q,t,l),l=l.sibling}function Ok(Q,t,l){if(rI&&typeof rI.onCommitFiberUnmount=="function")try{rI.onCommitFiberUnmount(FI,l)}catch{}switch(l.tag){case 5:xB||Is(l,t);case 6:var w=dB,M=FQ;dB=null,_E(Q,t,l),dB=w,FQ=M,dB!==null&&(FQ?(Q=dB,l=l.stateNode,Q.nodeType===8?Q.parentNode.removeChild(l):Q.removeChild(l)):dB.removeChild(l.stateNode));break;case 18:dB!==null&&(FQ?(Q=dB,l=l.stateNode,Q.nodeType===8?qn(Q.parentNode,l):Q.nodeType===1&&qn(Q,l),Ut(Q)):qn(dB,l.stateNode));break;case 4:w=dB,M=FQ,dB=l.stateNode.containerInfo,FQ=!0,_E(Q,t,l),dB=w,FQ=M;break;case 0:case 11:case 14:case 15:if(!xB&&(w=l.updateQueue,w!==null&&(w=w.lastEffect,w!==null))){M=w=w.next;do{var K=M,H=K.destroy;K=K.tag,H!==void 0&&((K&2)!==0||(K&4)!==0)&&KS(l,t,H),M=M.next}while(M!==w)}_E(Q,t,l);break;case 1:if(!xB&&(Is(l,t),w=l.stateNode,typeof w.componentWillUnmount=="function"))try{w.props=l.memoizedProps,w.state=l.memoizedState,w.componentWillUnmount()}catch(AA){MC(l,t,AA)}_E(Q,t,l);break;case 21:_E(Q,t,l);break;case 22:l.mode&1?(xB=(w=xB)||l.memoizedState!==null,_E(Q,t,l),xB=w):_E(Q,t,l);break;default:_E(Q,t,l)}}function bk(Q){var t=Q.updateQueue;if(t!==null){Q.updateQueue=null;var l=Q.stateNode;l===null&&(l=Q.stateNode=new rN),t.forEach(function(w){var M=uN.bind(null,Q,w);l.has(w)||(l.add(w),w.then(M,M))})}}function fQ(Q,t){var l=t.deletions;if(l!==null)for(var w=0;wM&&(M=H),w&=~K}if(w=M,w=yA()-w,w=(120>w?120:480>w?480:1080>w?1080:1920>w?1920:3e3>w?3e3:4320>w?4320:1960*hN(w/1960))-w,10Q?16:Q,PE===null)var w=!1;else{if(Q=PE,PE=null,gD=0,(mg&6)!==0)throw Error(I(331));var M=mg;for(mg|=4,fI=Q.current;fI!==null;){var K=fI,H=K.child;if((fI.flags&16)!==0){var AA=K.deletions;if(AA!==null){for(var tA=0;tAyA()-qS?io(Q,0):YS|=l),Gi(Q,t)}function Cu(Q,t){t===0&&((Q.mode&1)===0?t=1:(t=Tg,Tg<<=1,(Tg&130023424)===0&&(Tg=4194304)));var l=Qi();Q=Ri(Q,t),Q!==null&&(bg(Q,t,l),Gi(Q,l))}function kN(Q){var t=Q.memoizedState,l=0;t!==null&&(l=t.retryLane),Cu(Q,l)}function uN(Q,t){var l=0;switch(Q.tag){case 13:var w=Q.stateNode,M=Q.memoizedState;M!==null&&(l=M.retryLane);break;case 19:w=Q.stateNode;break;default:throw Error(I(314))}w!==null&&w.delete(t),Cu(Q,l)}var Bu;Bu=function(Q,t,l){if(Q!==null)if(Q.memoizedProps!==t.pendingProps||uB.current)lg=!0;else{if((Q.lanes&l)===0&&(t.flags&128)===0)return lg=!1,nN(Q,t,l);lg=(Q.flags&131072)!==0}else lg=!1,IC&&(t.flags&1048576)!==0&&da(t,On,t.index);switch(t.lanes=0,t.tag){case 2:var w=t.type;Vl(Q,t),Q=t.pendingProps;var M=qe(t,XC.current);Be(t,l),M=Xt(null,t,w,Q,M,l);var K=Ya();return t.flags|=1,typeof M=="object"&&M!==null&&typeof M.render=="function"&&M.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,EB(w)?(K=!0,me(t)):K=!1,t.memoizedState=M.state!==null&&M.state!==void 0?M.state:null,ng(t),M.updater=As,t.stateNode=M,M._reactInternals=t,c(t,w,Q,l),t=og(null,t,w,!0,K,l)):(t.tag=0,IC&&K&&Na(t),MI(null,t,M,l),t=t.child),t;case 16:w=t.elementType;A:{switch(Vl(Q,t),Q=t.pendingProps,M=w._init,w=M(w._payload),t.type=w,M=t.tag=UN(w),Q=wi(w,Q),M){case 0:t=GI(null,t,w,Q,l);break A;case 1:t=TI(null,t,w,Q,l);break A;case 11:t=IB(null,t,w,Q,l);break A;case 14:t=ii(null,t,w,wi(w.type,Q),l);break A}throw Error(I(306,w,""))}return t;case 0:return w=t.type,M=t.pendingProps,M=t.elementType===w?M:wi(w,M),GI(Q,t,w,M,l);case 1:return w=t.type,M=t.pendingProps,M=t.elementType===w?M:wi(w,M),TI(Q,t,w,M,l);case 3:A:{if(eg(t),Q===null)throw Error(I(387));w=t.pendingProps,K=t.memoizedState,M=K.element,cC(Q,t),aC(t,w,null,l);var H=t.memoizedState;if(w=H.element,K.isDehydrated)if(K={element:w,isDehydrated:!1,cache:H.cache,pendingSuspenseBoundaries:H.pendingSuspenseBoundaries,transitions:H.transitions},t.updateQueue.baseState=K,t.memoizedState=K,t.flags&256){M=u(Error(I(423)),t),t=Jg(Q,t,w,l,M);break A}else if(w!==M){M=u(Error(I(424)),t),t=Jg(Q,t,w,l,M);break A}else for(UB=SQ(t.stateNode.containerInfo.firstChild),zC=t,IC=!0,Si=null,l=_t(t,null,w,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(Ce(),w===M){t=Xe(Q,t,l);break A}MI(Q,t,w,l)}t=t.child}return t;case 5:return Pe(t),Q===null&&_n(t),w=t.type,M=t.pendingProps,K=Q!==null?Q.memoizedProps:null,H=M.children,ya(w,M)?H=null:K!==null&&ya(w,K)&&(t.flags|=32),YA(Q,t),MI(Q,t,H,l),t.child;case 6:return Q===null&&_n(t),null;case 13:return KQ(Q,t,l);case 4:return Vt(t,t.stateNode.containerInfo),w=t.pendingProps,Q===null?t.child=xe(t,null,w,l):MI(Q,t,w,l),t.child;case 11:return w=t.type,M=t.pendingProps,M=t.elementType===w?M:wi(w,M),IB(Q,t,w,M,l);case 7:return MI(Q,t,t.pendingProps,l),t.child;case 8:return MI(Q,t,t.pendingProps.children,l),t.child;case 12:return MI(Q,t,t.pendingProps.children,l),t.child;case 10:A:{if(w=t.type._context,M=t.pendingProps,K=t.memoizedProps,H=M.value,jg(ve,w._currentValue),w._currentValue=H,K!==null)if(zB(K.value,H)){if(K.children===M.children&&!uB.current){t=Xe(Q,t,l);break A}}else for(K=t.child,K!==null&&(K.return=t);K!==null;){var AA=K.dependencies;if(AA!==null){H=K.child;for(var tA=AA.firstContext;tA!==null;){if(tA.context===w){if(K.tag===1){tA=Zg(-1,l&-l),tA.tag=2;var RA=K.updateQueue;if(RA!==null){RA=RA.shared;var II=RA.pending;II===null?tA.next=tA:(tA.next=II.next,II.next=tA),RA.pending=tA}}K.lanes|=l,tA=K.alternate,tA!==null&&(tA.lanes|=l),Pt(K.return,l,t),AA.lanes|=l;break}tA=tA.next}}else if(K.tag===10)H=K.type===t.type?null:K.child;else if(K.tag===18){if(H=K.return,H===null)throw Error(I(341));H.lanes|=l,AA=H.alternate,AA!==null&&(AA.lanes|=l),Pt(H,l,t),H=K.sibling}else H=K.child;if(H!==null)H.return=K;else for(H=K;H!==null;){if(H===t){H=null;break}if(K=H.sibling,K!==null){K.return=H.return,H=K;break}H=H.return}K=H}MI(Q,t,M.children,l),t=t.child}return t;case 9:return M=t.type,w=t.pendingProps.children,Be(t,l),M=Ii(M),w=w(M),t.flags|=1,MI(Q,t,w,l),t.child;case 14:return w=t.type,M=wi(w,t.pendingProps),M=wi(w.type,M),ii(Q,t,w,M,l);case 15:return NA(Q,t,t.type,t.pendingProps,l);case 17:return w=t.type,M=t.pendingProps,M=t.elementType===w?M:wi(w,M),Vl(Q,t),t.tag=1,EB(w)?(Q=!0,me(t)):Q=!1,Be(t,l),o(t,w,M),c(t,w,M,l),og(null,t,w,!0,Q,l);case 19:return Lk(Q,t,l);case 22:return SA(Q,t,l)}throw Error(I(156,t.tag))};function iu(Q,t){return gA(Q,t)}function MN(Q,t,l,w){this.tag=Q,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function gQ(Q,t,l,w){return new MN(Q,t,l,w)}function _S(Q){return Q=Q.prototype,!(!Q||!Q.isReactComponent)}function UN(Q){if(typeof Q=="function")return _S(Q)?1:0;if(Q!=null){if(Q=Q.$$typeof,Q===IA)return 11;if(Q===uA)return 14}return 2}function jE(Q,t){var l=Q.alternate;return l===null?(l=gQ(Q.tag,t,Q.key,Q.mode),l.elementType=Q.elementType,l.type=Q.type,l.stateNode=Q.stateNode,l.alternate=Q,Q.alternate=l):(l.pendingProps=t,l.type=Q.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=Q.flags&14680064,l.childLanes=Q.childLanes,l.lanes=Q.lanes,l.child=Q.child,l.memoizedProps=Q.memoizedProps,l.memoizedState=Q.memoizedState,l.updateQueue=Q.updateQueue,t=Q.dependencies,l.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=Q.sibling,l.index=Q.index,l.ref=Q.ref,l}function QD(Q,t,l,w,M,K){var H=2;if(w=Q,typeof Q=="function")_S(Q)&&(H=1);else if(typeof Q=="string")H=5;else A:switch(Q){case x:return eo(l.children,M,K,t);case T:H=8,M|=8;break;case L:return Q=gQ(12,l,t,M|2),Q.elementType=L,Q.lanes=K,Q;case CA:return Q=gQ(13,l,t,M),Q.elementType=CA,Q.lanes=K,Q;case nA:return Q=gQ(19,l,t,M),Q.elementType=nA,Q.lanes=K,Q;case pA:return eD(l,M,K,t);default:if(typeof Q=="object"&&Q!==null)switch(Q.$$typeof){case Y:H=10;break A;case b:H=9;break A;case IA:H=11;break A;case uA:H=14;break A;case EA:H=16,w=null;break A}throw Error(I(130,Q==null?Q:typeof Q,""))}return t=gQ(H,l,t,M),t.elementType=Q,t.type=w,t.lanes=K,t}function eo(Q,t,l,w){return Q=gQ(7,Q,w,t),Q.lanes=l,Q}function eD(Q,t,l,w){return Q=gQ(22,Q,w,t),Q.elementType=pA,Q.lanes=l,Q.stateNode={isHidden:!1},Q}function ZS(Q,t,l){return Q=gQ(6,Q,null,t),Q.lanes=l,Q}function PS(Q,t,l){return t=gQ(4,Q.children!==null?Q.children:[],Q.key,t),t.lanes=l,t.stateNode={containerInfo:Q.containerInfo,pendingChildren:null,implementation:Q.implementation},t}function pN(Q,t,l,w,M){this.tag=t,this.containerInfo=Q,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=GC(0),this.expirationTimes=GC(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=GC(0),this.identifierPrefix=w,this.onRecoverableError=M,this.mutableSourceEagerHydrationData=null}function WS(Q,t,l,w,M,K,H,AA,tA){return Q=new pN(Q,t,l,AA,tA),t===1?(t=1,K===!0&&(t|=8)):t=0,K=gQ(3,null,null,t),Q.current=K,K.stateNode=Q,K.memoizedState={element:w,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},ng(K),Q}function dN(Q,t,l){var w=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(B)}catch(A){console.error(A)}}return B(),Aw.exports=xN(),Aw.exports}var Su;function ON(){if(Su)return rD;Su=1;var B=vN();return rD.createRoot=B.createRoot,rD.hydrateRoot=B.hydrateRoot,rD}var bN=ON();/**
+`+K.stack}return{value:Q,source:t,stack:M,digest:null}}function N(Q,t,r){return{value:Q,source:null,stack:r??null,digest:t??null}}function f(Q,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var X=typeof WeakMap=="function"?WeakMap:Map;function lA(Q,t,r){r=Zg(-1,r),r.tag=3,r.payload={element:null};var w=t.value;return r.callback=function(){AD||(AD=!0,mS=w),f(Q,t)},r}function mA(Q,t,r){r=Zg(-1,r),r.tag=3;var w=Q.type.getDerivedStateFromError;if(typeof w=="function"){var M=t.value;r.payload=function(){return w(M)},r.callback=function(){f(Q,t)}}var K=Q.stateNode;return K!==null&&typeof K.componentDidCatch=="function"&&(r.callback=function(){f(Q,t),typeof w!="function"&&(ZE===null?ZE=new Set([this]):ZE.add(this));var H=t.stack;this.componentDidCatch(t.value,{componentStack:H!==null?H:""})}),r}function QI(Q,t,r){var w=Q.pingCache;if(w===null){w=Q.pingCache=new X;var M=new Set;w.set(t,M)}else M=w.get(t),M===void 0&&(M=new Set,w.set(t,M));M.has(r)||(M.add(r),Q=GN.bind(null,Q,t,r),t.then(Q,Q))}function KI(Q){do{var t;if((t=Q.tag===13)&&(t=Q.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return Q;Q=Q.return}while(Q!==null);return null}function Qg(Q,t,r,w,M){return(Q.mode&1)===0?(Q===t?Q.flags|=65536:(Q.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=Zg(-1,1),t.tag=2,iC(r,t,1))),r.lanes|=1),Q):(Q.flags|=65536,Q.lanes=M,Q)}var WI=F.ReactCurrentOwner,lg=!1;function MI(Q,t,r,w){t.child=Q===null?_t(t,null,r,w):xe(t,Q.child,r,w)}function IB(Q,t,r,w,M){r=r.render;var K=t.ref;return Be(t,M),w=Xt(Q,t,r,w,K,M),r=Ya(),Q!==null&&!lg?(t.updateQueue=Q.updateQueue,t.flags&=-2053,Q.lanes&=~M,Xe(Q,t,M)):(IC&&r&&Na(t),t.flags|=1,MI(Q,t,w,M),t.child)}function ii(Q,t,r,w,M){if(Q===null){var K=r.type;return typeof K=="function"&&!_S(K)&&K.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=K,NA(Q,t,K,w,M)):(Q=QD(r.type,null,w,t,t.mode,M),Q.ref=t.ref,Q.return=t,t.child=Q)}if(K=Q.child,(Q.lanes&M)===0){var H=K.memoizedProps;if(r=r.compare,r=r!==null?r:Ke,r(H,w)&&Q.ref===t.ref)return Xe(Q,t,M)}return t.flags|=1,Q=jE(K,w),Q.ref=t.ref,Q.return=t,t.child=Q}function NA(Q,t,r,w,M){if(Q!==null){var K=Q.memoizedProps;if(Ke(K,w)&&Q.ref===t.ref)if(lg=!1,t.pendingProps=w=K,(Q.lanes&M)!==0)(Q.flags&131072)!==0&&(lg=!0);else return t.lanes=Q.lanes,Xe(Q,t,M)}return GI(Q,t,r,w,M)}function SA(Q,t,r){var w=t.pendingProps,M=w.children,K=Q!==null?Q.memoizedState:null;if(w.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},jg(gs,mi),mi|=r;else{if((r&1073741824)===0)return Q=K!==null?K.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:Q,cachePool:null,transitions:null},t.updateQueue=null,jg(gs,mi),mi|=Q,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},w=K!==null?K.baseLanes:r,jg(gs,mi),mi|=w}else K!==null?(w=K.baseLanes|r,t.memoizedState=null):w=r,jg(gs,mi),mi|=w;return MI(Q,t,M,r),t.child}function YA(Q,t){var r=t.ref;(Q===null&&r!==null||Q!==null&&Q.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function GI(Q,t,r,w,M){var K=EB(r)?GQ:XC.current;return K=qe(t,K),Be(t,M),r=Xt(Q,t,r,w,K,M),w=Ya(),Q!==null&&!lg?(t.updateQueue=Q.updateQueue,t.flags&=-2053,Q.lanes&=~M,Xe(Q,t,M)):(IC&&w&&Na(t),t.flags|=1,MI(Q,t,r,M),t.child)}function TI(Q,t,r,w,M){if(EB(r)){var K=!0;me(t)}else K=!1;if(Be(t,M),t.stateNode===null)Vl(Q,t),o(t,r,w),c(t,r,w,M),w=!0;else if(Q===null){var H=t.stateNode,AA=t.memoizedProps;H.props=AA;var tA=H.context,RA=r.contextType;typeof RA=="object"&&RA!==null?RA=Ii(RA):(RA=EB(r)?GQ:XC.current,RA=qe(t,RA));var II=r.getDerivedStateFromProps,gI=typeof II=="function"||typeof H.getSnapshotBeforeUpdate=="function";gI||typeof H.UNSAFE_componentWillReceiveProps!="function"&&typeof H.componentWillReceiveProps!="function"||(AA!==w||tA!==RA)&&s(t,H,w,RA),_g=!1;var AI=t.memoizedState;H.state=AI,aC(t,w,H,M),tA=t.memoizedState,AA!==w||AI!==tA||uB.current||_g?(typeof II=="function"&&(go(t,r,II,w),tA=t.memoizedState),(AA=_g||Pl(t,r,AA,w,AI,tA,RA))?(gI||typeof H.UNSAFE_componentWillMount!="function"&&typeof H.componentWillMount!="function"||(typeof H.componentWillMount=="function"&&H.componentWillMount(),typeof H.UNSAFE_componentWillMount=="function"&&H.UNSAFE_componentWillMount()),typeof H.componentDidMount=="function"&&(t.flags|=4194308)):(typeof H.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=w,t.memoizedState=tA),H.props=w,H.state=tA,H.context=RA,w=AA):(typeof H.componentDidMount=="function"&&(t.flags|=4194308),w=!1)}else{H=t.stateNode,cC(Q,t),AA=t.memoizedProps,RA=t.type===t.elementType?AA:wi(t.type,AA),H.props=RA,gI=t.pendingProps,AI=H.context,tA=r.contextType,typeof tA=="object"&&tA!==null?tA=Ii(tA):(tA=EB(r)?GQ:XC.current,tA=qe(t,tA));var NI=r.getDerivedStateFromProps;(II=typeof NI=="function"||typeof H.getSnapshotBeforeUpdate=="function")||typeof H.UNSAFE_componentWillReceiveProps!="function"&&typeof H.componentWillReceiveProps!="function"||(AA!==gI||AI!==tA)&&s(t,H,w,tA),_g=!1,AI=t.memoizedState,H.state=AI,aC(t,w,H,M);var YI=t.memoizedState;AA!==gI||AI!==YI||uB.current||_g?(typeof NI=="function"&&(go(t,r,NI,w),YI=t.memoizedState),(RA=_g||Pl(t,r,RA,w,AI,YI,tA)||!1)?(II||typeof H.UNSAFE_componentWillUpdate!="function"&&typeof H.componentWillUpdate!="function"||(typeof H.componentWillUpdate=="function"&&H.componentWillUpdate(w,YI,tA),typeof H.UNSAFE_componentWillUpdate=="function"&&H.UNSAFE_componentWillUpdate(w,YI,tA)),typeof H.componentDidUpdate=="function"&&(t.flags|=4),typeof H.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof H.componentDidUpdate!="function"||AA===Q.memoizedProps&&AI===Q.memoizedState||(t.flags|=4),typeof H.getSnapshotBeforeUpdate!="function"||AA===Q.memoizedProps&&AI===Q.memoizedState||(t.flags|=1024),t.memoizedProps=w,t.memoizedState=YI),H.props=w,H.state=YI,H.context=tA,w=RA):(typeof H.componentDidUpdate!="function"||AA===Q.memoizedProps&&AI===Q.memoizedState||(t.flags|=4),typeof H.getSnapshotBeforeUpdate!="function"||AA===Q.memoizedProps&&AI===Q.memoizedState||(t.flags|=1024),w=!1)}return og(Q,t,r,w,K,M)}function og(Q,t,r,w,M,K){YA(Q,t);var H=(t.flags&128)!==0;if(!w&&!H)return M&&pa(t,r,!1),Xe(Q,t,K);w=t.stateNode,WI.current=t;var AA=H&&typeof r.getDerivedStateFromError!="function"?null:w.render();return t.flags|=1,Q!==null&&H?(t.child=xe(t,Q.child,null,K),t.child=xe(t,null,AA,K)):MI(Q,t,AA,K),t.memoizedState=w.state,M&&pa(t,r,!0),t.child}function eg(Q){var t=Q.stateNode;t.pendingContext?Ua(Q,t.pendingContext,t.pendingContext!==t.context):t.context&&Ua(Q,t.context,!1),Vt(Q,t.containerInfo)}function Jg(Q,t,r,w,M){return Ce(),HE(M),t.flags|=256,MI(Q,t,r,w),t.child}var uC={dehydrated:null,treeContext:null,retryLane:0};function dg(Q){return{baseLanes:Q,cachePool:null,transitions:null}}function KQ(Q,t,r){var w=t.pendingProps,M=gC.current,K=!1,H=(t.flags&128)!==0,AA;if((AA=H)||(AA=Q!==null&&Q.memoizedState===null?!1:(M&2)!==0),AA?(K=!0,t.flags&=-129):(Q===null||Q.memoizedState!==null)&&(M|=1),jg(gC,M&1),Q===null)return _n(t),Q=t.memoizedState,Q!==null&&(Q=Q.dehydrated,Q!==null)?((t.mode&1)===0?t.lanes=1:Q.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(H=w.children,Q=w.fallback,K?(w=t.mode,K=t.child,H={mode:"hidden",children:H},(w&1)===0&&K!==null?(K.childLanes=0,K.pendingProps=H):K=eD(H,w,0,null),Q=eo(Q,w,r,null),K.return=t,Q.return=t,K.sibling=Q,t.child=K,t.child.memoizedState=dg(r),t.memoizedState=uC,Q):ba(t,H));if(M=Q.memoizedState,M!==null&&(AA=M.dehydrated,AA!==null))return oN(Q,t,H,w,AA,M,r);if(K){K=w.fallback,H=t.mode,M=Q.child,AA=M.sibling;var tA={mode:"hidden",children:w.children};return(H&1)===0&&t.child!==M?(w=t.child,w.childLanes=0,w.pendingProps=tA,t.deletions=null):(w=jE(M,tA),w.subtreeFlags=M.subtreeFlags&14680064),AA!==null?K=jE(AA,K):(K=eo(K,H,r,null),K.flags|=2),K.return=t,w.return=t,w.sibling=K,t.child=w,w=K,K=t.child,H=Q.child.memoizedState,H=H===null?dg(r):{baseLanes:H.baseLanes|r,cachePool:null,transitions:H.transitions},K.memoizedState=H,K.childLanes=Q.childLanes&~r,t.memoizedState=uC,w}return K=Q.child,Q=K.sibling,w=jE(K,{mode:"visible",children:w.children}),(t.mode&1)===0&&(w.lanes=r),w.return=t,w.sibling=null,Q!==null&&(r=t.deletions,r===null?(t.deletions=[Q],t.flags|=16):r.push(Q)),t.child=w,t.memoizedState=null,w}function ba(Q,t){return t=eD({mode:"visible",children:t},Q.mode,0,null),t.return=Q,Q.child=t}function Wl(Q,t,r,w){return w!==null&&HE(w),xe(t,Q.child,null,r),Q=ba(t,t.pendingProps.children),Q.flags|=2,t.memoizedState=null,Q}function oN(Q,t,r,w,M,K,H){if(r)return t.flags&256?(t.flags&=-257,w=N(Error(I(422))),Wl(Q,t,H,w)):t.memoizedState!==null?(t.child=Q.child,t.flags|=128,null):(K=w.fallback,M=t.mode,w=eD({mode:"visible",children:w.children},M,0,null),K=eo(K,M,H,null),K.flags|=2,w.return=t,K.return=t,w.sibling=K,t.child=w,(t.mode&1)!==0&&xe(t,Q.child,null,H),t.child.memoizedState=dg(H),t.memoizedState=uC,K);if((t.mode&1)===0)return Wl(Q,t,H,null);if(M.data==="$!"){if(w=M.nextSibling&&M.nextSibling.dataset,w)var AA=w.dgst;return w=AA,K=Error(I(419)),w=N(K,w,void 0),Wl(Q,t,H,w)}if(AA=(H&Q.childLanes)!==0,lg||AA){if(w=nB,w!==null){switch(H&-H){case 4:M=2;break;case 16:M=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:M=32;break;case 536870912:M=268435456;break;default:M=0}M=(M&(w.suspendedLanes|H))!==0?0:M,M!==0&&M!==K.retryLane&&(K.retryLane=M,Ri(Q,M),RQ(w,Q,M,-1))}return bS(),w=N(Error(I(421))),Wl(Q,t,H,w)}return M.data==="$?"?(t.flags|=128,t.child=Q.child,t=kN.bind(null,Q),M._reactRetry=t,null):(Q=K.treeContext,UB=SQ(M.nextSibling),zC=t,IC=!0,Si=null,Q!==null&&(MB[vC++]=sI,MB[vC++]=ci,MB[vC++]=Te,sI=Q.id,ci=Q.overflow,Te=t),t=ba(t,w.children),t.flags|=4096,t)}function Rk(Q,t,r){Q.lanes|=t;var w=Q.alternate;w!==null&&(w.lanes|=t),Pt(Q.return,t,r)}function NS(Q,t,r,w,M){var K=Q.memoizedState;K===null?Q.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:w,tail:r,tailMode:M}:(K.isBackwards=t,K.rendering=null,K.renderingStartTime=0,K.last=w,K.tail=r,K.tailMode=M)}function Lk(Q,t,r){var w=t.pendingProps,M=w.revealOrder,K=w.tail;if(MI(Q,t,w.children,r),w=gC.current,(w&2)!==0)w=w&1|2,t.flags|=128;else{if(Q!==null&&(Q.flags&128)!==0)A:for(Q=t.child;Q!==null;){if(Q.tag===13)Q.memoizedState!==null&&Rk(Q,r,t);else if(Q.tag===19)Rk(Q,r,t);else if(Q.child!==null){Q.child.return=Q,Q=Q.child;continue}if(Q===t)break A;for(;Q.sibling===null;){if(Q.return===null||Q.return===t)break A;Q=Q.return}Q.sibling.return=Q.return,Q=Q.sibling}w&=1}if(jg(gC,w),(t.mode&1)===0)t.memoizedState=null;else switch(M){case"forwards":for(r=t.child,M=null;r!==null;)Q=r.alternate,Q!==null&&Li(Q)===null&&(M=r),r=r.sibling;r=M,r===null?(M=t.child,t.child=null):(M=r.sibling,r.sibling=null),NS(t,!1,M,r,K);break;case"backwards":for(r=null,M=t.child,t.child=null;M!==null;){if(Q=M.alternate,Q!==null&&Li(Q)===null){t.child=M;break}Q=M.sibling,M.sibling=r,r=M,M=Q}NS(t,!0,r,null,K);break;case"together":NS(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Vl(Q,t){(t.mode&1)===0&&Q!==null&&(Q.alternate=null,t.alternate=null,t.flags|=2)}function Xe(Q,t,r){if(Q!==null&&(t.dependencies=Q.dependencies),Co|=t.lanes,(r&t.childLanes)===0)return null;if(Q!==null&&t.child!==Q.child)throw Error(I(153));if(t.child!==null){for(Q=t.child,r=jE(Q,Q.pendingProps),t.child=r,r.return=t;Q.sibling!==null;)Q=Q.sibling,r=r.sibling=jE(Q,Q.pendingProps),r.return=t;r.sibling=null}return t.child}function nN(Q,t,r){switch(t.tag){case 3:eg(t),Ce();break;case 5:Pe(t);break;case 1:EB(t.type)&&me(t);break;case 4:Vt(t,t.stateNode.containerInfo);break;case 10:var w=t.type._context,M=t.memoizedProps.value;jg(ve,w._currentValue),w._currentValue=M;break;case 13:if(w=t.memoizedState,w!==null)return w.dehydrated!==null?(jg(gC,gC.current&1),t.flags|=128,null):(r&t.child.childLanes)!==0?KQ(Q,t,r):(jg(gC,gC.current&1),Q=Xe(Q,t,r),Q!==null?Q.sibling:null);jg(gC,gC.current&1);break;case 19:if(w=(r&t.childLanes)!==0,(Q.flags&128)!==0){if(w)return Lk(Q,t,r);t.flags|=128}if(M=t.memoizedState,M!==null&&(M.rendering=null,M.tail=null,M.lastEffect=null),jg(gC,gC.current),w)break;return null;case 22:case 23:return t.lanes=0,SA(Q,t,r)}return Xe(Q,t,r)}var Yk,JS,qk,mk;Yk=function(Q,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)Q.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}},JS=function(){},qk=function(Q,t,r,w){var M=Q.memoizedProps;if(M!==w){Q=t.stateNode,kC(gi.current);var K=null;switch(r){case"input":M=$(Q,M),w=$(Q,w),K=[];break;case"select":M=BA({},M,{value:void 0}),w=BA({},w,{value:void 0}),K=[];break;case"textarea":M=O(Q,M),w=O(Q,w),K=[];break;default:typeof M.onClick!="function"&&typeof w.onClick=="function"&&(Q.onclick=mt)}$I(r,w);var H;r=null;for(RA in M)if(!w.hasOwnProperty(RA)&&M.hasOwnProperty(RA)&&M[RA]!=null)if(RA==="style"){var AA=M[RA];for(H in AA)AA.hasOwnProperty(H)&&(r||(r={}),r[H]="")}else RA!=="dangerouslySetInnerHTML"&&RA!=="children"&&RA!=="suppressContentEditableWarning"&&RA!=="suppressHydrationWarning"&&RA!=="autoFocus"&&(C.hasOwnProperty(RA)?K||(K=[]):(K=K||[]).push(RA,null));for(RA in w){var tA=w[RA];if(AA=M!=null?M[RA]:void 0,w.hasOwnProperty(RA)&&tA!==AA&&(tA!=null||AA!=null))if(RA==="style")if(AA){for(H in AA)!AA.hasOwnProperty(H)||tA&&tA.hasOwnProperty(H)||(r||(r={}),r[H]="");for(H in tA)tA.hasOwnProperty(H)&&AA[H]!==tA[H]&&(r||(r={}),r[H]=tA[H])}else r||(K||(K=[]),K.push(RA,r)),r=tA;else RA==="dangerouslySetInnerHTML"?(tA=tA?tA.__html:void 0,AA=AA?AA.__html:void 0,tA!=null&&AA!==tA&&(K=K||[]).push(RA,tA)):RA==="children"?typeof tA!="string"&&typeof tA!="number"||(K=K||[]).push(RA,""+tA):RA!=="suppressContentEditableWarning"&&RA!=="suppressHydrationWarning"&&(C.hasOwnProperty(RA)?(tA!=null&&RA==="onScroll"&&zg("scroll",Q),K||AA===tA||(K=[])):(K=K||[]).push(RA,tA))}r&&(K=K||[]).push("style",r);var RA=K;(t.updateQueue=RA)&&(t.flags|=4)}},mk=function(Q,t,r,w){r!==w&&(t.flags|=4)};function _a(Q,t){if(!IC)switch(Q.tailMode){case"hidden":t=Q.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?Q.tail=null:r.sibling=null;break;case"collapsed":r=Q.tail;for(var w=null;r!==null;)r.alternate!==null&&(w=r),r=r.sibling;w===null?t||Q.tail===null?Q.tail=null:Q.tail.sibling=null:w.sibling=null}}function TB(Q){var t=Q.alternate!==null&&Q.alternate.child===Q.child,r=0,w=0;if(t)for(var M=Q.child;M!==null;)r|=M.lanes|M.childLanes,w|=M.subtreeFlags&14680064,w|=M.flags&14680064,M.return=Q,M=M.sibling;else for(M=Q.child;M!==null;)r|=M.lanes|M.childLanes,w|=M.subtreeFlags,w|=M.flags,M.return=Q,M=M.sibling;return Q.subtreeFlags|=w,Q.childLanes=r,t}function sN(Q,t,r){var w=t.pendingProps;switch(uQ(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return TB(t),null;case 1:return EB(t.type)&&Ht(),TB(t),null;case 3:return w=t.stateNode,ie(),$g(uB),$g(XC),$i(),w.pendingContext&&(w.context=w.pendingContext,w.pendingContext=null),(Q===null||Q.child===null)&&(mE(t)?t.flags|=4:Q===null||Q.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Si!==null&&(xS(Si),Si=null))),JS(Q,t),TB(t),null;case 5:vE(t);var M=kC(pQ.current);if(r=t.type,Q!==null&&t.stateNode!=null)qk(Q,t,r,w,M),Q.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!w){if(t.stateNode===null)throw Error(I(166));return TB(t),null}if(Q=kC(gi.current),mE(t)){w=t.stateNode,r=t.type;var K=t.memoizedProps;switch(w[KC]=t,w[qE]=K,Q=(t.mode&1)!==0,r){case"dialog":zg("cancel",w),zg("close",w);break;case"iframe":case"object":case"embed":zg("load",w);break;case"video":case"audio":for(M=0;M<\/script>",Q=Q.removeChild(Q.firstChild)):typeof w.is=="string"?Q=H.createElement(r,{is:w.is}):(Q=H.createElement(r),r==="select"&&(H=Q,w.multiple?H.multiple=!0:w.size&&(H.size=w.size))):Q=H.createElementNS(Q,r),Q[KC]=t,Q[qE]=w,Yk(Q,t,!1,!1),t.stateNode=Q;A:{switch(H=RI(r,w),r){case"dialog":zg("cancel",Q),zg("close",Q),M=w;break;case"iframe":case"object":case"embed":zg("load",Q),M=w;break;case"video":case"audio":for(M=0;MCs&&(t.flags|=128,w=!0,_a(K,!1),t.lanes=4194304)}else{if(!w)if(Q=Li(H),Q!==null){if(t.flags|=128,w=!0,r=Q.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),_a(K,!0),K.tail===null&&K.tailMode==="hidden"&&!H.alternate&&!IC)return TB(t),null}else 2*yA()-K.renderingStartTime>Cs&&r!==1073741824&&(t.flags|=128,w=!0,_a(K,!1),t.lanes=4194304);K.isBackwards?(H.sibling=t.child,t.child=H):(r=K.last,r!==null?r.sibling=H:t.child=H,K.last=H)}return K.tail!==null?(t=K.tail,K.rendering=t,K.tail=t.sibling,K.renderingStartTime=yA(),t.sibling=null,r=gC.current,jg(gC,w?r&1|2:r&1),t):(TB(t),null);case 22:case 23:return OS(),w=t.memoizedState!==null,Q!==null&&Q.memoizedState!==null!==w&&(t.flags|=8192),w&&(t.mode&1)!==0?(mi&1073741824)!==0&&(TB(t),t.subtreeFlags&6&&(t.flags|=8192)):TB(t),null;case 24:return null;case 25:return null}throw Error(I(156,t.tag))}function aN(Q,t){switch(uQ(t),t.tag){case 1:return EB(t.type)&&Ht(),Q=t.flags,Q&65536?(t.flags=Q&-65537|128,t):null;case 3:return ie(),$g(uB),$g(XC),$i(),Q=t.flags,(Q&65536)!==0&&(Q&128)===0?(t.flags=Q&-65537|128,t):null;case 5:return vE(t),null;case 13:if($g(gC),Q=t.memoizedState,Q!==null&&Q.dehydrated!==null){if(t.alternate===null)throw Error(I(340));Ce()}return Q=t.flags,Q&65536?(t.flags=Q&-65537|128,t):null;case 19:return $g(gC),null;case 4:return ie(),null;case 10:return Zt(t.type._context),null;case 22:case 23:return OS(),null;case 24:return null;default:return null}}var jl=!1,xB=!1,rN=typeof WeakSet=="function"?WeakSet:Set,fI=null;function Is(Q,t){var r=Q.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(w){MC(Q,t,w)}else r.current=null}function KS(Q,t,r){try{r()}catch(w){MC(Q,t,w)}}var Hk=!1;function lN(Q,t){if(YE=si,Q=EC(),mC(Q)){if("selectionStart"in Q)var r={start:Q.selectionStart,end:Q.selectionEnd};else A:{r=(r=Q.ownerDocument)&&r.defaultView||window;var w=r.getSelection&&r.getSelection();if(w&&w.rangeCount!==0){r=w.anchorNode;var M=w.anchorOffset,K=w.focusNode;w=w.focusOffset;try{r.nodeType,K.nodeType}catch{r=null;break A}var H=0,AA=-1,tA=-1,RA=0,II=0,gI=Q,AI=null;I:for(;;){for(var NI;gI!==r||M!==0&&gI.nodeType!==3||(AA=H+M),gI!==K||w!==0&&gI.nodeType!==3||(tA=H+w),gI.nodeType===3&&(H+=gI.nodeValue.length),(NI=gI.firstChild)!==null;)AI=gI,gI=NI;for(;;){if(gI===Q)break I;if(AI===r&&++RA===M&&(AA=H),AI===K&&++II===w&&(tA=H),(NI=gI.nextSibling)!==null)break;gI=AI,AI=gI.parentNode}gI=NI}r=AA===-1||tA===-1?null:{start:AA,end:tA}}else r=null}r=r||{start:0,end:0}}else r=null;for(wa={focusedElem:Q,selectionRange:r},si=!1,fI=t;fI!==null;)if(t=fI,Q=t.child,(t.subtreeFlags&1028)!==0&&Q!==null)Q.return=t,fI=Q;else for(;fI!==null;){t=fI;try{var YI=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(YI!==null){var qI=YI.memoizedProps,FC=YI.memoizedState,UA=t.stateNode,rA=UA.getSnapshotBeforeUpdate(t.elementType===t.type?qI:wi(t.type,qI),FC);UA.__reactInternalSnapshotBeforeUpdate=rA}break;case 3:var dA=t.stateNode.containerInfo;dA.nodeType===1?dA.textContent="":dA.nodeType===9&&dA.documentElement&&dA.removeChild(dA.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(I(163))}}catch(EI){MC(t,t.return,EI)}if(Q=t.sibling,Q!==null){Q.return=t.return,fI=Q;break}fI=t.return}return YI=Hk,Hk=!1,YI}function Za(Q,t,r){var w=t.updateQueue;if(w=w!==null?w.lastEffect:null,w!==null){var M=w=w.next;do{if((M.tag&Q)===Q){var K=M.destroy;M.destroy=void 0,K!==void 0&&KS(t,r,K)}M=M.next}while(M!==w)}}function Xl(Q,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&Q)===Q){var w=r.create;r.destroy=w()}r=r.next}while(r!==t)}}function FS(Q){var t=Q.ref;if(t!==null){var r=Q.stateNode;switch(Q.tag){case 5:Q=r;break;default:Q=r}typeof t=="function"?t(Q):t.current=Q}}function Tk(Q){var t=Q.alternate;t!==null&&(Q.alternate=null,Tk(t)),Q.child=null,Q.deletions=null,Q.sibling=null,Q.tag===5&&(t=Q.stateNode,t!==null&&(delete t[KC],delete t[qE],delete t[Ye],delete t[mn],delete t[Hn])),Q.stateNode=null,Q.return=null,Q.dependencies=null,Q.memoizedProps=null,Q.memoizedState=null,Q.pendingProps=null,Q.stateNode=null,Q.updateQueue=null}function xk(Q){return Q.tag===5||Q.tag===3||Q.tag===4}function vk(Q){A:for(;;){for(;Q.sibling===null;){if(Q.return===null||xk(Q.return))return null;Q=Q.return}for(Q.sibling.return=Q.return,Q=Q.sibling;Q.tag!==5&&Q.tag!==6&&Q.tag!==18;){if(Q.flags&2||Q.child===null||Q.tag===4)continue A;Q.child.return=Q,Q=Q.child}if(!(Q.flags&2))return Q.stateNode}}function fS(Q,t,r){var w=Q.tag;if(w===5||w===6)Q=Q.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(Q,t):r.insertBefore(Q,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(Q,r)):(t=r,t.appendChild(Q)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=mt));else if(w!==4&&(Q=Q.child,Q!==null))for(fS(Q,t,r),Q=Q.sibling;Q!==null;)fS(Q,t,r),Q=Q.sibling}function RS(Q,t,r){var w=Q.tag;if(w===5||w===6)Q=Q.stateNode,t?r.insertBefore(Q,t):r.appendChild(Q);else if(w!==4&&(Q=Q.child,Q!==null))for(RS(Q,t,r),Q=Q.sibling;Q!==null;)RS(Q,t,r),Q=Q.sibling}var dB=null,FQ=!1;function _E(Q,t,r){for(r=r.child;r!==null;)Ok(Q,t,r),r=r.sibling}function Ok(Q,t,r){if(rI&&typeof rI.onCommitFiberUnmount=="function")try{rI.onCommitFiberUnmount(FI,r)}catch{}switch(r.tag){case 5:xB||Is(r,t);case 6:var w=dB,M=FQ;dB=null,_E(Q,t,r),dB=w,FQ=M,dB!==null&&(FQ?(Q=dB,r=r.stateNode,Q.nodeType===8?Q.parentNode.removeChild(r):Q.removeChild(r)):dB.removeChild(r.stateNode));break;case 18:dB!==null&&(FQ?(Q=dB,r=r.stateNode,Q.nodeType===8?qn(Q.parentNode,r):Q.nodeType===1&&qn(Q,r),Ut(Q)):qn(dB,r.stateNode));break;case 4:w=dB,M=FQ,dB=r.stateNode.containerInfo,FQ=!0,_E(Q,t,r),dB=w,FQ=M;break;case 0:case 11:case 14:case 15:if(!xB&&(w=r.updateQueue,w!==null&&(w=w.lastEffect,w!==null))){M=w=w.next;do{var K=M,H=K.destroy;K=K.tag,H!==void 0&&((K&2)!==0||(K&4)!==0)&&KS(r,t,H),M=M.next}while(M!==w)}_E(Q,t,r);break;case 1:if(!xB&&(Is(r,t),w=r.stateNode,typeof w.componentWillUnmount=="function"))try{w.props=r.memoizedProps,w.state=r.memoizedState,w.componentWillUnmount()}catch(AA){MC(r,t,AA)}_E(Q,t,r);break;case 21:_E(Q,t,r);break;case 22:r.mode&1?(xB=(w=xB)||r.memoizedState!==null,_E(Q,t,r),xB=w):_E(Q,t,r);break;default:_E(Q,t,r)}}function bk(Q){var t=Q.updateQueue;if(t!==null){Q.updateQueue=null;var r=Q.stateNode;r===null&&(r=Q.stateNode=new rN),t.forEach(function(w){var M=uN.bind(null,Q,w);r.has(w)||(r.add(w),w.then(M,M))})}}function fQ(Q,t){var r=t.deletions;if(r!==null)for(var w=0;wM&&(M=H),w&=~K}if(w=M,w=yA()-w,w=(120>w?120:480>w?480:1080>w?1080:1920>w?1920:3e3>w?3e3:4320>w?4320:1960*hN(w/1960))-w,10Q?16:Q,PE===null)var w=!1;else{if(Q=PE,PE=null,gD=0,(mg&6)!==0)throw Error(I(331));var M=mg;for(mg|=4,fI=Q.current;fI!==null;){var K=fI,H=K.child;if((fI.flags&16)!==0){var AA=K.deletions;if(AA!==null){for(var tA=0;tAyA()-qS?io(Q,0):YS|=r),Gi(Q,t)}function Cu(Q,t){t===0&&((Q.mode&1)===0?t=1:(t=Tg,Tg<<=1,(Tg&130023424)===0&&(Tg=4194304)));var r=Qi();Q=Ri(Q,t),Q!==null&&(bg(Q,t,r),Gi(Q,r))}function kN(Q){var t=Q.memoizedState,r=0;t!==null&&(r=t.retryLane),Cu(Q,r)}function uN(Q,t){var r=0;switch(Q.tag){case 13:var w=Q.stateNode,M=Q.memoizedState;M!==null&&(r=M.retryLane);break;case 19:w=Q.stateNode;break;default:throw Error(I(314))}w!==null&&w.delete(t),Cu(Q,r)}var Bu;Bu=function(Q,t,r){if(Q!==null)if(Q.memoizedProps!==t.pendingProps||uB.current)lg=!0;else{if((Q.lanes&r)===0&&(t.flags&128)===0)return lg=!1,nN(Q,t,r);lg=(Q.flags&131072)!==0}else lg=!1,IC&&(t.flags&1048576)!==0&&da(t,On,t.index);switch(t.lanes=0,t.tag){case 2:var w=t.type;Vl(Q,t),Q=t.pendingProps;var M=qe(t,XC.current);Be(t,r),M=Xt(null,t,w,Q,M,r);var K=Ya();return t.flags|=1,typeof M=="object"&&M!==null&&typeof M.render=="function"&&M.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,EB(w)?(K=!0,me(t)):K=!1,t.memoizedState=M.state!==null&&M.state!==void 0?M.state:null,ng(t),M.updater=As,t.stateNode=M,M._reactInternals=t,c(t,w,Q,r),t=og(null,t,w,!0,K,r)):(t.tag=0,IC&&K&&Na(t),MI(null,t,M,r),t=t.child),t;case 16:w=t.elementType;A:{switch(Vl(Q,t),Q=t.pendingProps,M=w._init,w=M(w._payload),t.type=w,M=t.tag=UN(w),Q=wi(w,Q),M){case 0:t=GI(null,t,w,Q,r);break A;case 1:t=TI(null,t,w,Q,r);break A;case 11:t=IB(null,t,w,Q,r);break A;case 14:t=ii(null,t,w,wi(w.type,Q),r);break A}throw Error(I(306,w,""))}return t;case 0:return w=t.type,M=t.pendingProps,M=t.elementType===w?M:wi(w,M),GI(Q,t,w,M,r);case 1:return w=t.type,M=t.pendingProps,M=t.elementType===w?M:wi(w,M),TI(Q,t,w,M,r);case 3:A:{if(eg(t),Q===null)throw Error(I(387));w=t.pendingProps,K=t.memoizedState,M=K.element,cC(Q,t),aC(t,w,null,r);var H=t.memoizedState;if(w=H.element,K.isDehydrated)if(K={element:w,isDehydrated:!1,cache:H.cache,pendingSuspenseBoundaries:H.pendingSuspenseBoundaries,transitions:H.transitions},t.updateQueue.baseState=K,t.memoizedState=K,t.flags&256){M=u(Error(I(423)),t),t=Jg(Q,t,w,r,M);break A}else if(w!==M){M=u(Error(I(424)),t),t=Jg(Q,t,w,r,M);break A}else for(UB=SQ(t.stateNode.containerInfo.firstChild),zC=t,IC=!0,Si=null,r=_t(t,null,w,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Ce(),w===M){t=Xe(Q,t,r);break A}MI(Q,t,w,r)}t=t.child}return t;case 5:return Pe(t),Q===null&&_n(t),w=t.type,M=t.pendingProps,K=Q!==null?Q.memoizedProps:null,H=M.children,ya(w,M)?H=null:K!==null&&ya(w,K)&&(t.flags|=32),YA(Q,t),MI(Q,t,H,r),t.child;case 6:return Q===null&&_n(t),null;case 13:return KQ(Q,t,r);case 4:return Vt(t,t.stateNode.containerInfo),w=t.pendingProps,Q===null?t.child=xe(t,null,w,r):MI(Q,t,w,r),t.child;case 11:return w=t.type,M=t.pendingProps,M=t.elementType===w?M:wi(w,M),IB(Q,t,w,M,r);case 7:return MI(Q,t,t.pendingProps,r),t.child;case 8:return MI(Q,t,t.pendingProps.children,r),t.child;case 12:return MI(Q,t,t.pendingProps.children,r),t.child;case 10:A:{if(w=t.type._context,M=t.pendingProps,K=t.memoizedProps,H=M.value,jg(ve,w._currentValue),w._currentValue=H,K!==null)if(zB(K.value,H)){if(K.children===M.children&&!uB.current){t=Xe(Q,t,r);break A}}else for(K=t.child,K!==null&&(K.return=t);K!==null;){var AA=K.dependencies;if(AA!==null){H=K.child;for(var tA=AA.firstContext;tA!==null;){if(tA.context===w){if(K.tag===1){tA=Zg(-1,r&-r),tA.tag=2;var RA=K.updateQueue;if(RA!==null){RA=RA.shared;var II=RA.pending;II===null?tA.next=tA:(tA.next=II.next,II.next=tA),RA.pending=tA}}K.lanes|=r,tA=K.alternate,tA!==null&&(tA.lanes|=r),Pt(K.return,r,t),AA.lanes|=r;break}tA=tA.next}}else if(K.tag===10)H=K.type===t.type?null:K.child;else if(K.tag===18){if(H=K.return,H===null)throw Error(I(341));H.lanes|=r,AA=H.alternate,AA!==null&&(AA.lanes|=r),Pt(H,r,t),H=K.sibling}else H=K.child;if(H!==null)H.return=K;else for(H=K;H!==null;){if(H===t){H=null;break}if(K=H.sibling,K!==null){K.return=H.return,H=K;break}H=H.return}K=H}MI(Q,t,M.children,r),t=t.child}return t;case 9:return M=t.type,w=t.pendingProps.children,Be(t,r),M=Ii(M),w=w(M),t.flags|=1,MI(Q,t,w,r),t.child;case 14:return w=t.type,M=wi(w,t.pendingProps),M=wi(w.type,M),ii(Q,t,w,M,r);case 15:return NA(Q,t,t.type,t.pendingProps,r);case 17:return w=t.type,M=t.pendingProps,M=t.elementType===w?M:wi(w,M),Vl(Q,t),t.tag=1,EB(w)?(Q=!0,me(t)):Q=!1,Be(t,r),o(t,w,M),c(t,w,M,r),og(null,t,w,!0,Q,r);case 19:return Lk(Q,t,r);case 22:return SA(Q,t,r)}throw Error(I(156,t.tag))};function iu(Q,t){return gA(Q,t)}function MN(Q,t,r,w){this.tag=Q,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function gQ(Q,t,r,w){return new MN(Q,t,r,w)}function _S(Q){return Q=Q.prototype,!(!Q||!Q.isReactComponent)}function UN(Q){if(typeof Q=="function")return _S(Q)?1:0;if(Q!=null){if(Q=Q.$$typeof,Q===IA)return 11;if(Q===uA)return 14}return 2}function jE(Q,t){var r=Q.alternate;return r===null?(r=gQ(Q.tag,t,Q.key,Q.mode),r.elementType=Q.elementType,r.type=Q.type,r.stateNode=Q.stateNode,r.alternate=Q,Q.alternate=r):(r.pendingProps=t,r.type=Q.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=Q.flags&14680064,r.childLanes=Q.childLanes,r.lanes=Q.lanes,r.child=Q.child,r.memoizedProps=Q.memoizedProps,r.memoizedState=Q.memoizedState,r.updateQueue=Q.updateQueue,t=Q.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=Q.sibling,r.index=Q.index,r.ref=Q.ref,r}function QD(Q,t,r,w,M,K){var H=2;if(w=Q,typeof Q=="function")_S(Q)&&(H=1);else if(typeof Q=="string")H=5;else A:switch(Q){case x:return eo(r.children,M,K,t);case T:H=8,M|=8;break;case L:return Q=gQ(12,r,t,M|2),Q.elementType=L,Q.lanes=K,Q;case CA:return Q=gQ(13,r,t,M),Q.elementType=CA,Q.lanes=K,Q;case nA:return Q=gQ(19,r,t,M),Q.elementType=nA,Q.lanes=K,Q;case pA:return eD(r,M,K,t);default:if(typeof Q=="object"&&Q!==null)switch(Q.$$typeof){case Y:H=10;break A;case b:H=9;break A;case IA:H=11;break A;case uA:H=14;break A;case EA:H=16,w=null;break A}throw Error(I(130,Q==null?Q:typeof Q,""))}return t=gQ(H,r,t,M),t.elementType=Q,t.type=w,t.lanes=K,t}function eo(Q,t,r,w){return Q=gQ(7,Q,w,t),Q.lanes=r,Q}function eD(Q,t,r,w){return Q=gQ(22,Q,w,t),Q.elementType=pA,Q.lanes=r,Q.stateNode={isHidden:!1},Q}function ZS(Q,t,r){return Q=gQ(6,Q,null,t),Q.lanes=r,Q}function PS(Q,t,r){return t=gQ(4,Q.children!==null?Q.children:[],Q.key,t),t.lanes=r,t.stateNode={containerInfo:Q.containerInfo,pendingChildren:null,implementation:Q.implementation},t}function pN(Q,t,r,w,M){this.tag=t,this.containerInfo=Q,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=GC(0),this.expirationTimes=GC(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=GC(0),this.identifierPrefix=w,this.onRecoverableError=M,this.mutableSourceEagerHydrationData=null}function WS(Q,t,r,w,M,K,H,AA,tA){return Q=new pN(Q,t,r,AA,tA),t===1?(t=1,K===!0&&(t|=8)):t=0,K=gQ(3,null,null,t),Q.current=K,K.stateNode=Q,K.memoizedState={element:w,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},ng(K),Q}function dN(Q,t,r){var w=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(B)}catch(A){console.error(A)}}return B(),Aw.exports=xN(),Aw.exports}var Su;function ON(){if(Su)return rD;Su=1;var B=vN();return rD.createRoot=B.createRoot,rD.hydrateRoot=B.hydrateRoot,rD}var bN=ON();/**
* @license
* Copyright 2010-2024 Three.js Authors
* SPDX-License-Identifier: MIT
- */const Ws="170",_N={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ZN={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},oU=0,ly=1,nU=2,PN=3,sU=0,Sc=1,kr=2,HQ=3,re=0,oi=1,vi=2,ne=0,Yo=1,Dy=2,hy=3,cy=4,aU=5,ot=100,rU=101,lU=102,DU=103,hU=104,cU=200,SU=201,wU=202,yU=203,Sh=204,wh=205,GU=206,kU=207,uU=208,MU=209,UU=210,pU=211,dU=212,NU=213,JU=214,yh=0,Gh=1,kh=2,xo=3,uh=4,Mh=5,Uh=6,ph=7,Il=0,KU=1,FU=2,se=0,fU=1,RU=2,LU=3,my=4,YU=5,qU=6,mU=7,Sy="attached",HU="detached",lt=300,le=301,Dt=302,Ys=303,Rr=304,Vs=306,De=1e3,LC=1001,qs=1002,cB=1003,wc=1004,WN=1004,po=1005,VN=1005,Og=1006,Ks=1007,jN=1007,tQ=1008,wy=1008,di=1009,yc=1010,Gc=1011,ms=1012,gl=1013,he=1014,yC=1015,hB=1016,kc=1017,uc=1018,vo=1020,Hy=35902,Ty=1021,xy=1022,YC=1023,vy=1024,Oy=1025,qo=1026,Oo=1027,Cl=1028,Bl=1029,by=1030,Mc=1031,XN=1032,Uc=1033,ur=33776,Mr=33777,Ur=33778,pr=33779,dh=35840,Nh=35841,Jh=35842,Kh=35843,Fh=36196,fh=37492,Rh=37496,Lh=37808,Yh=37809,qh=37810,mh=37811,Hh=37812,Th=37813,xh=37814,vh=37815,Oh=37816,bh=37817,_h=37818,Zh=37819,Ph=37820,Wh=37821,dr=36492,Vh=36494,jh=36495,_y=36283,Xh=36284,zh=36285,$h=36286,TU=2200,xU=2201,vU=2202,Hs=2300,Ts=2301,lh=2302,No=2400,Jo=2401,Lr=2402,pc=2500,Zy=2501,OU=0,Py=1,Ac=2,bU=3200,_U=3201,zN=3202,$N=3203,St=0,ZU=1,eE="",DB="srgb",ce="srgb-linear",il="linear",Xg="srgb",AJ=0,ko=7680,IJ=7681,gJ=7682,CJ=7683,BJ=34055,iJ=34056,QJ=5386,eJ=512,EJ=513,tJ=514,oJ=515,nJ=516,sJ=517,aJ=518,yy=519,PU=512,WU=513,VU=514,Wy=515,jU=516,XU=517,zU=518,$U=519,Yr=35044,Ap=35048,rJ=35040,lJ=35045,DJ=35049,hJ=35041,cJ=35046,SJ=35050,wJ=35042,yJ="100",Gy="300 es",oe=2e3,qr=2001;class Se{addEventListener(A,I){this._listeners===void 0&&(this._listeners={});const g=this._listeners;g[A]===void 0&&(g[A]=[]),g[A].indexOf(I)===-1&&g[A].push(I)}hasEventListener(A,I){if(this._listeners===void 0)return!1;const g=this._listeners;return g[A]!==void 0&&g[A].indexOf(I)!==-1}removeEventListener(A,I){if(this._listeners===void 0)return;const C=this._listeners[A];if(C!==void 0){const i=C.indexOf(I);i!==-1&&C.splice(i,1)}}dispatchEvent(A){if(this._listeners===void 0)return;const g=this._listeners[A.type];if(g!==void 0){A.target=this;const C=g.slice(0);for(let i=0,e=C.length;i>8&255]+vB[B>>16&255]+vB[B>>24&255]+"-"+vB[A&255]+vB[A>>8&255]+"-"+vB[A>>16&15|64]+vB[A>>24&255]+"-"+vB[I&63|128]+vB[I>>8&255]+"-"+vB[I>>16&255]+vB[I>>24&255]+vB[g&255]+vB[g>>8&255]+vB[g>>16&255]+vB[g>>24&255]).toLowerCase()}function NC(B,A,I){return Math.max(A,Math.min(I,B))}function Vy(B,A){return(B%A+A)%A}function GJ(B,A,I,g,C){return g+(B-A)*(C-g)/(I-A)}function kJ(B,A,I){return B!==A?(I-B)/(A-B):0}function Nr(B,A,I){return(1-I)*B+I*A}function uJ(B,A,I,g){return Nr(B,A,1-Math.exp(-I*g))}function MJ(B,A=1){return A-Math.abs(Vy(B,A*2)-A)}function UJ(B,A,I){return B<=A?0:B>=I?1:(B=(B-A)/(I-A),B*B*(3-2*B))}function pJ(B,A,I){return B<=A?0:B>=I?1:(B=(B-A)/(I-A),B*B*B*(B*(B*6-15)+10))}function dJ(B,A){return B+Math.floor(Math.random()*(A-B+1))}function NJ(B,A){return B+Math.random()*(A-B)}function JJ(B){return B*(.5-Math.random())}function KJ(B){B!==void 0&&(wu=B);let A=wu+=1831565813;return A=Math.imul(A^A>>>15,A|1),A^=A+Math.imul(A^A>>>7,A|61),((A^A>>>14)>>>0)/4294967296}function FJ(B){return B*mo}function fJ(B){return B*xs}function RJ(B){return(B&B-1)===0&&B!==0}function LJ(B){return Math.pow(2,Math.ceil(Math.log(B)/Math.LN2))}function YJ(B){return Math.pow(2,Math.floor(Math.log(B)/Math.LN2))}function qJ(B,A,I,g,C){const i=Math.cos,e=Math.sin,E=i(I/2),n=e(I/2),a=i((A+g)/2),r=e((A+g)/2),D=i((A-g)/2),h=e((A-g)/2),S=i((g-A)/2),G=e((g-A)/2);switch(C){case"XYX":B.set(E*r,n*D,n*h,E*a);break;case"YZY":B.set(n*h,E*r,n*D,E*a);break;case"ZXZ":B.set(n*D,n*h,E*r,E*a);break;case"XZX":B.set(E*r,n*G,n*S,E*a);break;case"YXY":B.set(n*S,E*r,n*G,E*a);break;case"ZYZ":B.set(n*G,n*S,E*r,E*a);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+C)}}function ti(B,A){switch(A.constructor){case Float32Array:return B;case Uint32Array:return B/4294967295;case Uint16Array:return B/65535;case Uint8Array:return B/255;case Int32Array:return Math.max(B/2147483647,-1);case Int16Array:return Math.max(B/32767,-1);case Int8Array:return Math.max(B/127,-1);default:throw new Error("Invalid component type.")}}function Dg(B,A){switch(A.constructor){case Float32Array:return B;case Uint32Array:return Math.round(B*4294967295);case Uint16Array:return Math.round(B*65535);case Uint8Array:return Math.round(B*255);case Int32Array:return Math.round(B*2147483647);case Int16Array:return Math.round(B*32767);case Int8Array:return Math.round(B*127);default:throw new Error("Invalid component type.")}}const dc={DEG2RAD:mo,RAD2DEG:xs,generateUUID:Oi,clamp:NC,euclideanModulo:Vy,mapLinear:GJ,inverseLerp:kJ,lerp:Nr,damp:uJ,pingpong:MJ,smoothstep:UJ,smootherstep:pJ,randInt:dJ,randFloat:NJ,randFloatSpread:JJ,seededRandom:KJ,degToRad:FJ,radToDeg:fJ,isPowerOfTwo:RJ,ceilPowerOfTwo:LJ,floorPowerOfTwo:YJ,setQuaternionFromProperEuler:qJ,normalize:Dg,denormalize:ti};class PA{constructor(A=0,I=0){PA.prototype.isVector2=!0,this.x=A,this.y=I}get width(){return this.x}set width(A){this.x=A}get height(){return this.y}set height(A){this.y=A}set(A,I){return this.x=A,this.y=I,this}setScalar(A){return this.x=A,this.y=A,this}setX(A){return this.x=A,this}setY(A){return this.y=A,this}setComponent(A,I){switch(A){case 0:this.x=I;break;case 1:this.y=I;break;default:throw new Error("index is out of range: "+A)}return this}getComponent(A){switch(A){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+A)}}clone(){return new this.constructor(this.x,this.y)}copy(A){return this.x=A.x,this.y=A.y,this}add(A){return this.x+=A.x,this.y+=A.y,this}addScalar(A){return this.x+=A,this.y+=A,this}addVectors(A,I){return this.x=A.x+I.x,this.y=A.y+I.y,this}addScaledVector(A,I){return this.x+=A.x*I,this.y+=A.y*I,this}sub(A){return this.x-=A.x,this.y-=A.y,this}subScalar(A){return this.x-=A,this.y-=A,this}subVectors(A,I){return this.x=A.x-I.x,this.y=A.y-I.y,this}multiply(A){return this.x*=A.x,this.y*=A.y,this}multiplyScalar(A){return this.x*=A,this.y*=A,this}divide(A){return this.x/=A.x,this.y/=A.y,this}divideScalar(A){return this.multiplyScalar(1/A)}applyMatrix3(A){const I=this.x,g=this.y,C=A.elements;return this.x=C[0]*I+C[3]*g+C[6],this.y=C[1]*I+C[4]*g+C[7],this}min(A){return this.x=Math.min(this.x,A.x),this.y=Math.min(this.y,A.y),this}max(A){return this.x=Math.max(this.x,A.x),this.y=Math.max(this.y,A.y),this}clamp(A,I){return this.x=Math.max(A.x,Math.min(I.x,this.x)),this.y=Math.max(A.y,Math.min(I.y,this.y)),this}clampScalar(A,I){return this.x=Math.max(A,Math.min(I,this.x)),this.y=Math.max(A,Math.min(I,this.y)),this}clampLength(A,I){const g=this.length();return this.divideScalar(g||1).multiplyScalar(Math.max(A,Math.min(I,g)))}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(A){return this.x*A.x+this.y*A.y}cross(A){return this.x*A.y-this.y*A.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(A){const I=Math.sqrt(this.lengthSq()*A.lengthSq());if(I===0)return Math.PI/2;const g=this.dot(A)/I;return Math.acos(NC(g,-1,1))}distanceTo(A){return Math.sqrt(this.distanceToSquared(A))}distanceToSquared(A){const I=this.x-A.x,g=this.y-A.y;return I*I+g*g}manhattanDistanceTo(A){return Math.abs(this.x-A.x)+Math.abs(this.y-A.y)}setLength(A){return this.normalize().multiplyScalar(A)}lerp(A,I){return this.x+=(A.x-this.x)*I,this.y+=(A.y-this.y)*I,this}lerpVectors(A,I,g){return this.x=A.x+(I.x-A.x)*g,this.y=A.y+(I.y-A.y)*g,this}equals(A){return A.x===this.x&&A.y===this.y}fromArray(A,I=0){return this.x=A[I],this.y=A[I+1],this}toArray(A=[],I=0){return A[I]=this.x,A[I+1]=this.y,A}fromBufferAttribute(A,I){return this.x=A.getX(I),this.y=A.getY(I),this}rotateAround(A,I){const g=Math.cos(I),C=Math.sin(I),i=this.x-A.x,e=this.y-A.y;return this.x=i*g-e*C+A.x,this.y=i*C+e*g+A.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class sg{constructor(A,I,g,C,i,e,E,n,a){sg.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],A!==void 0&&this.set(A,I,g,C,i,e,E,n,a)}set(A,I,g,C,i,e,E,n,a){const r=this.elements;return r[0]=A,r[1]=C,r[2]=E,r[3]=I,r[4]=i,r[5]=n,r[6]=g,r[7]=e,r[8]=a,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(A){const I=this.elements,g=A.elements;return I[0]=g[0],I[1]=g[1],I[2]=g[2],I[3]=g[3],I[4]=g[4],I[5]=g[5],I[6]=g[6],I[7]=g[7],I[8]=g[8],this}extractBasis(A,I,g){return A.setFromMatrix3Column(this,0),I.setFromMatrix3Column(this,1),g.setFromMatrix3Column(this,2),this}setFromMatrix4(A){const I=A.elements;return this.set(I[0],I[4],I[8],I[1],I[5],I[9],I[2],I[6],I[10]),this}multiply(A){return this.multiplyMatrices(this,A)}premultiply(A){return this.multiplyMatrices(A,this)}multiplyMatrices(A,I){const g=A.elements,C=I.elements,i=this.elements,e=g[0],E=g[3],n=g[6],a=g[1],r=g[4],D=g[7],h=g[2],S=g[5],G=g[8],U=C[0],k=C[3],y=C[6],d=C[1],J=C[4],F=C[7],v=C[2],m=C[5],x=C[8];return i[0]=e*U+E*d+n*v,i[3]=e*k+E*J+n*m,i[6]=e*y+E*F+n*x,i[1]=a*U+r*d+D*v,i[4]=a*k+r*J+D*m,i[7]=a*y+r*F+D*x,i[2]=h*U+S*d+G*v,i[5]=h*k+S*J+G*m,i[8]=h*y+S*F+G*x,this}multiplyScalar(A){const I=this.elements;return I[0]*=A,I[3]*=A,I[6]*=A,I[1]*=A,I[4]*=A,I[7]*=A,I[2]*=A,I[5]*=A,I[8]*=A,this}determinant(){const A=this.elements,I=A[0],g=A[1],C=A[2],i=A[3],e=A[4],E=A[5],n=A[6],a=A[7],r=A[8];return I*e*r-I*E*a-g*i*r+g*E*n+C*i*a-C*e*n}invert(){const A=this.elements,I=A[0],g=A[1],C=A[2],i=A[3],e=A[4],E=A[5],n=A[6],a=A[7],r=A[8],D=r*e-E*a,h=E*n-r*i,S=a*i-e*n,G=I*D+g*h+C*S;if(G===0)return this.set(0,0,0,0,0,0,0,0,0);const U=1/G;return A[0]=D*U,A[1]=(C*a-r*g)*U,A[2]=(E*g-C*e)*U,A[3]=h*U,A[4]=(r*I-C*n)*U,A[5]=(C*i-E*I)*U,A[6]=S*U,A[7]=(g*n-a*I)*U,A[8]=(e*I-g*i)*U,this}transpose(){let A;const I=this.elements;return A=I[1],I[1]=I[3],I[3]=A,A=I[2],I[2]=I[6],I[6]=A,A=I[5],I[5]=I[7],I[7]=A,this}getNormalMatrix(A){return this.setFromMatrix4(A).invert().transpose()}transposeIntoArray(A){const I=this.elements;return A[0]=I[0],A[1]=I[3],A[2]=I[6],A[3]=I[1],A[4]=I[4],A[5]=I[7],A[6]=I[2],A[7]=I[5],A[8]=I[8],this}setUvTransform(A,I,g,C,i,e,E){const n=Math.cos(i),a=Math.sin(i);return this.set(g*n,g*a,-g*(n*e+a*E)+e+A,-C*a,C*n,-C*(-a*e+n*E)+E+I,0,0,1),this}scale(A,I){return this.premultiply(Cw.makeScale(A,I)),this}rotate(A){return this.premultiply(Cw.makeRotation(-A)),this}translate(A,I){return this.premultiply(Cw.makeTranslation(A,I)),this}makeTranslation(A,I){return A.isVector2?this.set(1,0,A.x,0,1,A.y,0,0,1):this.set(1,0,A,0,1,I,0,0,1),this}makeRotation(A){const I=Math.cos(A),g=Math.sin(A);return this.set(I,-g,0,g,I,0,0,0,1),this}makeScale(A,I){return this.set(A,0,0,0,I,0,0,0,1),this}equals(A){const I=this.elements,g=A.elements;for(let C=0;C<9;C++)if(I[C]!==g[C])return!1;return!0}fromArray(A,I=0){for(let g=0;g<9;g++)this.elements[g]=A[g+I];return this}toArray(A=[],I=0){const g=this.elements;return A[I]=g[0],A[I+1]=g[1],A[I+2]=g[2],A[I+3]=g[3],A[I+4]=g[4],A[I+5]=g[5],A[I+6]=g[6],A[I+7]=g[7],A[I+8]=g[8],A}clone(){return new this.constructor().fromArray(this.elements)}}const Cw=new sg;function Ip(B){for(let A=B.length-1;A>=0;--A)if(B[A]>=65535)return!0;return!1}const mJ={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function ps(B,A){return new mJ[B](A)}function mr(B){return document.createElementNS("http://www.w3.org/1999/xhtml",B)}function gp(){const B=mr("canvas");return B.style.display="block",B}const yu={};function lr(B){B in yu||(yu[B]=!0,console.warn(B))}function HJ(B,A,I){return new Promise(function(g,C){function i(){switch(B.clientWaitSync(A,B.SYNC_FLUSH_COMMANDS_BIT,0)){case B.WAIT_FAILED:C();break;case B.TIMEOUT_EXPIRED:setTimeout(i,I);break;default:g()}}setTimeout(i,I)})}function TJ(B){const A=B.elements;A[2]=.5*A[2]+.5*A[3],A[6]=.5*A[6]+.5*A[7],A[10]=.5*A[10]+.5*A[11],A[14]=.5*A[14]+.5*A[15]}function xJ(B){const A=B.elements;A[11]===-1?(A[10]=-A[10]-1,A[14]=-A[14]):(A[10]=-A[10],A[14]=-A[14]+1)}const Kg={enabled:!0,workingColorSpace:ce,spaces:{},convert:function(B,A,I){return this.enabled===!1||A===I||!A||!I||(this.spaces[A].transfer===Xg&&(B.r=sE(B.r),B.g=sE(B.g),B.b=sE(B.b)),this.spaces[A].primaries!==this.spaces[I].primaries&&(B.applyMatrix3(this.spaces[A].toXYZ),B.applyMatrix3(this.spaces[I].fromXYZ)),this.spaces[I].transfer===Xg&&(B.r=Fs(B.r),B.g=Fs(B.g),B.b=Fs(B.b))),B},fromWorkingColorSpace:function(B,A){return this.convert(B,this.workingColorSpace,A)},toWorkingColorSpace:function(B,A){return this.convert(B,A,this.workingColorSpace)},getPrimaries:function(B){return this.spaces[B].primaries},getTransfer:function(B){return B===eE?il:this.spaces[B].transfer},getLuminanceCoefficients:function(B,A=this.workingColorSpace){return B.fromArray(this.spaces[A].luminanceCoefficients)},define:function(B){Object.assign(this.spaces,B)},_getMatrix:function(B,A,I){return B.copy(this.spaces[A].toXYZ).multiply(this.spaces[I].fromXYZ)},_getDrawingBufferColorSpace:function(B){return this.spaces[B].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(B=this.workingColorSpace){return this.spaces[B].workingColorSpaceConfig.unpackColorSpace}};function sE(B){return B<.04045?B*.0773993808:Math.pow(B*.9478672986+.0521327014,2.4)}function Fs(B){return B<.0031308?B*12.92:1.055*Math.pow(B,.41666)-.055}const Gu=[.64,.33,.3,.6,.15,.06],ku=[.2126,.7152,.0722],uu=[.3127,.329],Mu=new sg().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Uu=new sg().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);Kg.define({[ce]:{primaries:Gu,whitePoint:uu,transfer:il,toXYZ:Mu,fromXYZ:Uu,luminanceCoefficients:ku,workingColorSpaceConfig:{unpackColorSpace:DB},outputColorSpaceConfig:{drawingBufferColorSpace:DB}},[DB]:{primaries:Gu,whitePoint:uu,transfer:Xg,toXYZ:Mu,fromXYZ:Uu,luminanceCoefficients:ku,outputColorSpaceConfig:{drawingBufferColorSpace:DB}}});let is;class Cp{static getDataURL(A){if(/^data:/i.test(A.src)||typeof HTMLCanvasElement>"u")return A.src;let I;if(A instanceof HTMLCanvasElement)I=A;else{is===void 0&&(is=mr("canvas")),is.width=A.width,is.height=A.height;const g=is.getContext("2d");A instanceof ImageData?g.putImageData(A,0,0):g.drawImage(A,0,0,A.width,A.height),I=is}return I.width>2048||I.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",A),I.toDataURL("image/jpeg",.6)):I.toDataURL("image/png")}static sRGBToLinear(A){if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap){const I=mr("canvas");I.width=A.width,I.height=A.height;const g=I.getContext("2d");g.drawImage(A,0,0,A.width,A.height);const C=g.getImageData(0,0,A.width,A.height),i=C.data;for(let e=0;e0&&(g.userData=this.userData),I||(A.textures[this.uuid]=g),g}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(A){if(this.mapping!==lt)return A;if(A.applyMatrix3(this.matrix),A.x<0||A.x>1)switch(this.wrapS){case De:A.x=A.x-Math.floor(A.x);break;case LC:A.x=A.x<0?0:1;break;case qs:Math.abs(Math.floor(A.x)%2)===1?A.x=Math.ceil(A.x)-A.x:A.x=A.x-Math.floor(A.x);break}if(A.y<0||A.y>1)switch(this.wrapT){case De:A.y=A.y-Math.floor(A.y);break;case LC:A.y=A.y<0?0:1;break;case qs:Math.abs(Math.floor(A.y)%2)===1?A.y=Math.ceil(A.y)-A.y:A.y=A.y-Math.floor(A.y);break}return this.flipY&&(A.y=1-A.y),A}set needsUpdate(A){A===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(A){A===!0&&this.pmremVersion++}}Vg.DEFAULT_IMAGE=null;Vg.DEFAULT_MAPPING=lt;Vg.DEFAULT_ANISOTROPY=1;class Hg{constructor(A=0,I=0,g=0,C=1){Hg.prototype.isVector4=!0,this.x=A,this.y=I,this.z=g,this.w=C}get width(){return this.z}set width(A){this.z=A}get height(){return this.w}set height(A){this.w=A}set(A,I,g,C){return this.x=A,this.y=I,this.z=g,this.w=C,this}setScalar(A){return this.x=A,this.y=A,this.z=A,this.w=A,this}setX(A){return this.x=A,this}setY(A){return this.y=A,this}setZ(A){return this.z=A,this}setW(A){return this.w=A,this}setComponent(A,I){switch(A){case 0:this.x=I;break;case 1:this.y=I;break;case 2:this.z=I;break;case 3:this.w=I;break;default:throw new Error("index is out of range: "+A)}return this}getComponent(A){switch(A){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: "+A)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(A){return this.x=A.x,this.y=A.y,this.z=A.z,this.w=A.w!==void 0?A.w:1,this}add(A){return this.x+=A.x,this.y+=A.y,this.z+=A.z,this.w+=A.w,this}addScalar(A){return this.x+=A,this.y+=A,this.z+=A,this.w+=A,this}addVectors(A,I){return this.x=A.x+I.x,this.y=A.y+I.y,this.z=A.z+I.z,this.w=A.w+I.w,this}addScaledVector(A,I){return this.x+=A.x*I,this.y+=A.y*I,this.z+=A.z*I,this.w+=A.w*I,this}sub(A){return this.x-=A.x,this.y-=A.y,this.z-=A.z,this.w-=A.w,this}subScalar(A){return this.x-=A,this.y-=A,this.z-=A,this.w-=A,this}subVectors(A,I){return this.x=A.x-I.x,this.y=A.y-I.y,this.z=A.z-I.z,this.w=A.w-I.w,this}multiply(A){return this.x*=A.x,this.y*=A.y,this.z*=A.z,this.w*=A.w,this}multiplyScalar(A){return this.x*=A,this.y*=A,this.z*=A,this.w*=A,this}applyMatrix4(A){const I=this.x,g=this.y,C=this.z,i=this.w,e=A.elements;return this.x=e[0]*I+e[4]*g+e[8]*C+e[12]*i,this.y=e[1]*I+e[5]*g+e[9]*C+e[13]*i,this.z=e[2]*I+e[6]*g+e[10]*C+e[14]*i,this.w=e[3]*I+e[7]*g+e[11]*C+e[15]*i,this}divide(A){return this.x/=A.x,this.y/=A.y,this.z/=A.z,this.w/=A.w,this}divideScalar(A){return this.multiplyScalar(1/A)}setAxisAngleFromQuaternion(A){this.w=2*Math.acos(A.w);const I=Math.sqrt(1-A.w*A.w);return I<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=A.x/I,this.y=A.y/I,this.z=A.z/I),this}setAxisAngleFromRotationMatrix(A){let I,g,C,i;const n=A.elements,a=n[0],r=n[4],D=n[8],h=n[1],S=n[5],G=n[9],U=n[2],k=n[6],y=n[10];if(Math.abs(r-h)<.01&&Math.abs(D-U)<.01&&Math.abs(G-k)<.01){if(Math.abs(r+h)<.1&&Math.abs(D+U)<.1&&Math.abs(G+k)<.1&&Math.abs(a+S+y-3)<.1)return this.set(1,0,0,0),this;I=Math.PI;const J=(a+1)/2,F=(S+1)/2,v=(y+1)/2,m=(r+h)/4,x=(D+U)/4,T=(G+k)/4;return J>F&&J>v?J<.01?(g=0,C=.707106781,i=.707106781):(g=Math.sqrt(J),C=m/g,i=x/g):F>v?F<.01?(g=.707106781,C=0,i=.707106781):(C=Math.sqrt(F),g=m/C,i=T/C):v<.01?(g=.707106781,C=.707106781,i=0):(i=Math.sqrt(v),g=x/i,C=T/i),this.set(g,C,i,I),this}let d=Math.sqrt((k-G)*(k-G)+(D-U)*(D-U)+(h-r)*(h-r));return Math.abs(d)<.001&&(d=1),this.x=(k-G)/d,this.y=(D-U)/d,this.z=(h-r)/d,this.w=Math.acos((a+S+y-1)/2),this}setFromMatrixPosition(A){const I=A.elements;return this.x=I[12],this.y=I[13],this.z=I[14],this.w=I[15],this}min(A){return this.x=Math.min(this.x,A.x),this.y=Math.min(this.y,A.y),this.z=Math.min(this.z,A.z),this.w=Math.min(this.w,A.w),this}max(A){return this.x=Math.max(this.x,A.x),this.y=Math.max(this.y,A.y),this.z=Math.max(this.z,A.z),this.w=Math.max(this.w,A.w),this}clamp(A,I){return this.x=Math.max(A.x,Math.min(I.x,this.x)),this.y=Math.max(A.y,Math.min(I.y,this.y)),this.z=Math.max(A.z,Math.min(I.z,this.z)),this.w=Math.max(A.w,Math.min(I.w,this.w)),this}clampScalar(A,I){return this.x=Math.max(A,Math.min(I,this.x)),this.y=Math.max(A,Math.min(I,this.y)),this.z=Math.max(A,Math.min(I,this.z)),this.w=Math.max(A,Math.min(I,this.w)),this}clampLength(A,I){const g=this.length();return this.divideScalar(g||1).multiplyScalar(Math.max(A,Math.min(I,g)))}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(A){return this.x*A.x+this.y*A.y+this.z*A.z+this.w*A.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(A){return this.normalize().multiplyScalar(A)}lerp(A,I){return this.x+=(A.x-this.x)*I,this.y+=(A.y-this.y)*I,this.z+=(A.z-this.z)*I,this.w+=(A.w-this.w)*I,this}lerpVectors(A,I,g){return this.x=A.x+(I.x-A.x)*g,this.y=A.y+(I.y-A.y)*g,this.z=A.z+(I.z-A.z)*g,this.w=A.w+(I.w-A.w)*g,this}equals(A){return A.x===this.x&&A.y===this.y&&A.z===this.z&&A.w===this.w}fromArray(A,I=0){return this.x=A[I],this.y=A[I+1],this.z=A[I+2],this.w=A[I+3],this}toArray(A=[],I=0){return A[I]=this.x,A[I+1]=this.y,A[I+2]=this.z,A[I+3]=this.w,A}fromBufferAttribute(A,I){return this.x=A.getX(I),this.y=A.getY(I),this.z=A.getZ(I),this.w=A.getW(I),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 Bp extends Se{constructor(A=1,I=1,g={}){super(),this.isRenderTarget=!0,this.width=A,this.height=I,this.depth=1,this.scissor=new Hg(0,0,A,I),this.scissorTest=!1,this.viewport=new Hg(0,0,A,I);const C={width:A,height:I,depth:1};g=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Og,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},g);const i=new Vg(C,g.mapping,g.wrapS,g.wrapT,g.magFilter,g.minFilter,g.format,g.type,g.anisotropy,g.colorSpace);i.flipY=!1,i.generateMipmaps=g.generateMipmaps,i.internalFormat=g.internalFormat,this.textures=[];const e=g.count;for(let E=0;E=0?1:-1,J=1-y*y;if(J>Number.EPSILON){const v=Math.sqrt(J),m=Math.atan2(v,y*d);k=Math.sin(k*m)/v,E=Math.sin(E*m)/v}const F=E*d;if(n=n*k+h*F,a=a*k+S*F,r=r*k+G*F,D=D*k+U*F,k===1-E){const v=1/Math.sqrt(n*n+a*a+r*r+D*D);n*=v,a*=v,r*=v,D*=v}}A[I]=n,A[I+1]=a,A[I+2]=r,A[I+3]=D}static multiplyQuaternionsFlat(A,I,g,C,i,e){const E=g[C],n=g[C+1],a=g[C+2],r=g[C+3],D=i[e],h=i[e+1],S=i[e+2],G=i[e+3];return A[I]=E*G+r*D+n*S-a*h,A[I+1]=n*G+r*h+a*D-E*S,A[I+2]=a*G+r*S+E*h-n*D,A[I+3]=r*G-E*D-n*h-a*S,A}get x(){return this._x}set x(A){this._x=A,this._onChangeCallback()}get y(){return this._y}set y(A){this._y=A,this._onChangeCallback()}get z(){return this._z}set z(A){this._z=A,this._onChangeCallback()}get w(){return this._w}set w(A){this._w=A,this._onChangeCallback()}set(A,I,g,C){return this._x=A,this._y=I,this._z=g,this._w=C,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(A){return this._x=A.x,this._y=A.y,this._z=A.z,this._w=A.w,this._onChangeCallback(),this}setFromEuler(A,I=!0){const g=A._x,C=A._y,i=A._z,e=A._order,E=Math.cos,n=Math.sin,a=E(g/2),r=E(C/2),D=E(i/2),h=n(g/2),S=n(C/2),G=n(i/2);switch(e){case"XYZ":this._x=h*r*D+a*S*G,this._y=a*S*D-h*r*G,this._z=a*r*G+h*S*D,this._w=a*r*D-h*S*G;break;case"YXZ":this._x=h*r*D+a*S*G,this._y=a*S*D-h*r*G,this._z=a*r*G-h*S*D,this._w=a*r*D+h*S*G;break;case"ZXY":this._x=h*r*D-a*S*G,this._y=a*S*D+h*r*G,this._z=a*r*G+h*S*D,this._w=a*r*D-h*S*G;break;case"ZYX":this._x=h*r*D-a*S*G,this._y=a*S*D+h*r*G,this._z=a*r*G-h*S*D,this._w=a*r*D+h*S*G;break;case"YZX":this._x=h*r*D+a*S*G,this._y=a*S*D+h*r*G,this._z=a*r*G-h*S*D,this._w=a*r*D-h*S*G;break;case"XZY":this._x=h*r*D-a*S*G,this._y=a*S*D-h*r*G,this._z=a*r*G+h*S*D,this._w=a*r*D+h*S*G;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+e)}return I===!0&&this._onChangeCallback(),this}setFromAxisAngle(A,I){const g=I/2,C=Math.sin(g);return this._x=A.x*C,this._y=A.y*C,this._z=A.z*C,this._w=Math.cos(g),this._onChangeCallback(),this}setFromRotationMatrix(A){const I=A.elements,g=I[0],C=I[4],i=I[8],e=I[1],E=I[5],n=I[9],a=I[2],r=I[6],D=I[10],h=g+E+D;if(h>0){const S=.5/Math.sqrt(h+1);this._w=.25/S,this._x=(r-n)*S,this._y=(i-a)*S,this._z=(e-C)*S}else if(g>E&&g>D){const S=2*Math.sqrt(1+g-E-D);this._w=(r-n)/S,this._x=.25*S,this._y=(C+e)/S,this._z=(i+a)/S}else if(E>D){const S=2*Math.sqrt(1+E-g-D);this._w=(i-a)/S,this._x=(C+e)/S,this._y=.25*S,this._z=(n+r)/S}else{const S=2*Math.sqrt(1+D-g-E);this._w=(e-C)/S,this._x=(i+a)/S,this._y=(n+r)/S,this._z=.25*S}return this._onChangeCallback(),this}setFromUnitVectors(A,I){let g=A.dot(I)+1;return gMath.abs(A.z)?(this._x=-A.y,this._y=A.x,this._z=0,this._w=g):(this._x=0,this._y=-A.z,this._z=A.y,this._w=g)):(this._x=A.y*I.z-A.z*I.y,this._y=A.z*I.x-A.x*I.z,this._z=A.x*I.y-A.y*I.x,this._w=g),this.normalize()}angleTo(A){return 2*Math.acos(Math.abs(NC(this.dot(A),-1,1)))}rotateTowards(A,I){const g=this.angleTo(A);if(g===0)return this;const C=Math.min(1,I/g);return this.slerp(A,C),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(A){return this._x*A._x+this._y*A._y+this._z*A._z+this._w*A._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 A=this.length();return A===0?(this._x=0,this._y=0,this._z=0,this._w=1):(A=1/A,this._x=this._x*A,this._y=this._y*A,this._z=this._z*A,this._w=this._w*A),this._onChangeCallback(),this}multiply(A){return this.multiplyQuaternions(this,A)}premultiply(A){return this.multiplyQuaternions(A,this)}multiplyQuaternions(A,I){const g=A._x,C=A._y,i=A._z,e=A._w,E=I._x,n=I._y,a=I._z,r=I._w;return this._x=g*r+e*E+C*a-i*n,this._y=C*r+e*n+i*E-g*a,this._z=i*r+e*a+g*n-C*E,this._w=e*r-g*E-C*n-i*a,this._onChangeCallback(),this}slerp(A,I){if(I===0)return this;if(I===1)return this.copy(A);const g=this._x,C=this._y,i=this._z,e=this._w;let E=e*A._w+g*A._x+C*A._y+i*A._z;if(E<0?(this._w=-A._w,this._x=-A._x,this._y=-A._y,this._z=-A._z,E=-E):this.copy(A),E>=1)return this._w=e,this._x=g,this._y=C,this._z=i,this;const n=1-E*E;if(n<=Number.EPSILON){const S=1-I;return this._w=S*e+I*this._w,this._x=S*g+I*this._x,this._y=S*C+I*this._y,this._z=S*i+I*this._z,this.normalize(),this}const a=Math.sqrt(n),r=Math.atan2(a,E),D=Math.sin((1-I)*r)/a,h=Math.sin(I*r)/a;return this._w=e*D+this._w*h,this._x=g*D+this._x*h,this._y=C*D+this._y*h,this._z=i*D+this._z*h,this._onChangeCallback(),this}slerpQuaternions(A,I,g){return this.copy(A).slerp(I,g)}random(){const A=2*Math.PI*Math.random(),I=2*Math.PI*Math.random(),g=Math.random(),C=Math.sqrt(1-g),i=Math.sqrt(g);return this.set(C*Math.sin(A),C*Math.cos(A),i*Math.sin(I),i*Math.cos(I))}equals(A){return A._x===this._x&&A._y===this._y&&A._z===this._z&&A._w===this._w}fromArray(A,I=0){return this._x=A[I],this._y=A[I+1],this._z=A[I+2],this._w=A[I+3],this._onChangeCallback(),this}toArray(A=[],I=0){return A[I]=this._x,A[I+1]=this._y,A[I+2]=this._z,A[I+3]=this._w,A}fromBufferAttribute(A,I){return this._x=A.getX(I),this._y=A.getY(I),this._z=A.getZ(I),this._w=A.getW(I),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(A){return this._onChangeCallback=A,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Z{constructor(A=0,I=0,g=0){Z.prototype.isVector3=!0,this.x=A,this.y=I,this.z=g}set(A,I,g){return g===void 0&&(g=this.z),this.x=A,this.y=I,this.z=g,this}setScalar(A){return this.x=A,this.y=A,this.z=A,this}setX(A){return this.x=A,this}setY(A){return this.y=A,this}setZ(A){return this.z=A,this}setComponent(A,I){switch(A){case 0:this.x=I;break;case 1:this.y=I;break;case 2:this.z=I;break;default:throw new Error("index is out of range: "+A)}return this}getComponent(A){switch(A){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+A)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(A){return this.x=A.x,this.y=A.y,this.z=A.z,this}add(A){return this.x+=A.x,this.y+=A.y,this.z+=A.z,this}addScalar(A){return this.x+=A,this.y+=A,this.z+=A,this}addVectors(A,I){return this.x=A.x+I.x,this.y=A.y+I.y,this.z=A.z+I.z,this}addScaledVector(A,I){return this.x+=A.x*I,this.y+=A.y*I,this.z+=A.z*I,this}sub(A){return this.x-=A.x,this.y-=A.y,this.z-=A.z,this}subScalar(A){return this.x-=A,this.y-=A,this.z-=A,this}subVectors(A,I){return this.x=A.x-I.x,this.y=A.y-I.y,this.z=A.z-I.z,this}multiply(A){return this.x*=A.x,this.y*=A.y,this.z*=A.z,this}multiplyScalar(A){return this.x*=A,this.y*=A,this.z*=A,this}multiplyVectors(A,I){return this.x=A.x*I.x,this.y=A.y*I.y,this.z=A.z*I.z,this}applyEuler(A){return this.applyQuaternion(pu.setFromEuler(A))}applyAxisAngle(A,I){return this.applyQuaternion(pu.setFromAxisAngle(A,I))}applyMatrix3(A){const I=this.x,g=this.y,C=this.z,i=A.elements;return this.x=i[0]*I+i[3]*g+i[6]*C,this.y=i[1]*I+i[4]*g+i[7]*C,this.z=i[2]*I+i[5]*g+i[8]*C,this}applyNormalMatrix(A){return this.applyMatrix3(A).normalize()}applyMatrix4(A){const I=this.x,g=this.y,C=this.z,i=A.elements,e=1/(i[3]*I+i[7]*g+i[11]*C+i[15]);return this.x=(i[0]*I+i[4]*g+i[8]*C+i[12])*e,this.y=(i[1]*I+i[5]*g+i[9]*C+i[13])*e,this.z=(i[2]*I+i[6]*g+i[10]*C+i[14])*e,this}applyQuaternion(A){const I=this.x,g=this.y,C=this.z,i=A.x,e=A.y,E=A.z,n=A.w,a=2*(e*C-E*g),r=2*(E*I-i*C),D=2*(i*g-e*I);return this.x=I+n*a+e*D-E*r,this.y=g+n*r+E*a-i*D,this.z=C+n*D+i*r-e*a,this}project(A){return this.applyMatrix4(A.matrixWorldInverse).applyMatrix4(A.projectionMatrix)}unproject(A){return this.applyMatrix4(A.projectionMatrixInverse).applyMatrix4(A.matrixWorld)}transformDirection(A){const I=this.x,g=this.y,C=this.z,i=A.elements;return this.x=i[0]*I+i[4]*g+i[8]*C,this.y=i[1]*I+i[5]*g+i[9]*C,this.z=i[2]*I+i[6]*g+i[10]*C,this.normalize()}divide(A){return this.x/=A.x,this.y/=A.y,this.z/=A.z,this}divideScalar(A){return this.multiplyScalar(1/A)}min(A){return this.x=Math.min(this.x,A.x),this.y=Math.min(this.y,A.y),this.z=Math.min(this.z,A.z),this}max(A){return this.x=Math.max(this.x,A.x),this.y=Math.max(this.y,A.y),this.z=Math.max(this.z,A.z),this}clamp(A,I){return this.x=Math.max(A.x,Math.min(I.x,this.x)),this.y=Math.max(A.y,Math.min(I.y,this.y)),this.z=Math.max(A.z,Math.min(I.z,this.z)),this}clampScalar(A,I){return this.x=Math.max(A,Math.min(I,this.x)),this.y=Math.max(A,Math.min(I,this.y)),this.z=Math.max(A,Math.min(I,this.z)),this}clampLength(A,I){const g=this.length();return this.divideScalar(g||1).multiplyScalar(Math.max(A,Math.min(I,g)))}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(A){return this.x*A.x+this.y*A.y+this.z*A.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(A){return this.normalize().multiplyScalar(A)}lerp(A,I){return this.x+=(A.x-this.x)*I,this.y+=(A.y-this.y)*I,this.z+=(A.z-this.z)*I,this}lerpVectors(A,I,g){return this.x=A.x+(I.x-A.x)*g,this.y=A.y+(I.y-A.y)*g,this.z=A.z+(I.z-A.z)*g,this}cross(A){return this.crossVectors(this,A)}crossVectors(A,I){const g=A.x,C=A.y,i=A.z,e=I.x,E=I.y,n=I.z;return this.x=C*n-i*E,this.y=i*e-g*n,this.z=g*E-C*e,this}projectOnVector(A){const I=A.lengthSq();if(I===0)return this.set(0,0,0);const g=A.dot(this)/I;return this.copy(A).multiplyScalar(g)}projectOnPlane(A){return iw.copy(this).projectOnVector(A),this.sub(iw)}reflect(A){return this.sub(iw.copy(A).multiplyScalar(2*this.dot(A)))}angleTo(A){const I=Math.sqrt(this.lengthSq()*A.lengthSq());if(I===0)return Math.PI/2;const g=this.dot(A)/I;return Math.acos(NC(g,-1,1))}distanceTo(A){return Math.sqrt(this.distanceToSquared(A))}distanceToSquared(A){const I=this.x-A.x,g=this.y-A.y,C=this.z-A.z;return I*I+g*g+C*C}manhattanDistanceTo(A){return Math.abs(this.x-A.x)+Math.abs(this.y-A.y)+Math.abs(this.z-A.z)}setFromSpherical(A){return this.setFromSphericalCoords(A.radius,A.phi,A.theta)}setFromSphericalCoords(A,I,g){const C=Math.sin(I)*A;return this.x=C*Math.sin(g),this.y=Math.cos(I)*A,this.z=C*Math.cos(g),this}setFromCylindrical(A){return this.setFromCylindricalCoords(A.radius,A.theta,A.y)}setFromCylindricalCoords(A,I,g){return this.x=A*Math.sin(I),this.y=g,this.z=A*Math.cos(I),this}setFromMatrixPosition(A){const I=A.elements;return this.x=I[12],this.y=I[13],this.z=I[14],this}setFromMatrixScale(A){const I=this.setFromMatrixColumn(A,0).length(),g=this.setFromMatrixColumn(A,1).length(),C=this.setFromMatrixColumn(A,2).length();return this.x=I,this.y=g,this.z=C,this}setFromMatrixColumn(A,I){return this.fromArray(A.elements,I*4)}setFromMatrix3Column(A,I){return this.fromArray(A.elements,I*3)}setFromEuler(A){return this.x=A._x,this.y=A._y,this.z=A._z,this}setFromColor(A){return this.x=A.r,this.y=A.g,this.z=A.b,this}equals(A){return A.x===this.x&&A.y===this.y&&A.z===this.z}fromArray(A,I=0){return this.x=A[I],this.y=A[I+1],this.z=A[I+2],this}toArray(A=[],I=0){return A[I]=this.x,A[I+1]=this.y,A[I+2]=this.z,A}fromBufferAttribute(A,I){return this.x=A.getX(I),this.y=A.getY(I),this.z=A.getZ(I),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const A=Math.random()*Math.PI*2,I=Math.random()*2-1,g=Math.sqrt(1-I*I);return this.x=g*Math.cos(A),this.y=I,this.z=g*Math.sin(A),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const iw=new Z,pu=new BB;class _B{constructor(A=new Z(1/0,1/0,1/0),I=new Z(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=A,this.max=I}set(A,I){return this.min.copy(A),this.max.copy(I),this}setFromArray(A){this.makeEmpty();for(let I=0,g=A.length;I=this.min.x&&A.x<=this.max.x&&A.y>=this.min.y&&A.y<=this.max.y&&A.z>=this.min.z&&A.z<=this.max.z}containsBox(A){return this.min.x<=A.min.x&&A.max.x<=this.max.x&&this.min.y<=A.min.y&&A.max.y<=this.max.y&&this.min.z<=A.min.z&&A.max.z<=this.max.z}getParameter(A,I){return I.set((A.x-this.min.x)/(this.max.x-this.min.x),(A.y-this.min.y)/(this.max.y-this.min.y),(A.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(A){return A.max.x>=this.min.x&&A.min.x<=this.max.x&&A.max.y>=this.min.y&&A.min.y<=this.max.y&&A.max.z>=this.min.z&&A.min.z<=this.max.z}intersectsSphere(A){return this.clampPoint(A.center,LQ),LQ.distanceToSquared(A.center)<=A.radius*A.radius}intersectsPlane(A){let I,g;return A.normal.x>0?(I=A.normal.x*this.min.x,g=A.normal.x*this.max.x):(I=A.normal.x*this.max.x,g=A.normal.x*this.min.x),A.normal.y>0?(I+=A.normal.y*this.min.y,g+=A.normal.y*this.max.y):(I+=A.normal.y*this.max.y,g+=A.normal.y*this.min.y),A.normal.z>0?(I+=A.normal.z*this.min.z,g+=A.normal.z*this.max.z):(I+=A.normal.z*this.max.z,g+=A.normal.z*this.min.z),I<=-A.constant&&g>=-A.constant}intersectsTriangle(A){if(this.isEmpty())return!1;this.getCenter(za),DD.subVectors(this.max,za),Qs.subVectors(A.a,za),es.subVectors(A.b,za),Es.subVectors(A.c,za),zE.subVectors(es,Qs),$E.subVectors(Es,es),Eo.subVectors(Qs,Es);let I=[0,-zE.z,zE.y,0,-$E.z,$E.y,0,-Eo.z,Eo.y,zE.z,0,-zE.x,$E.z,0,-$E.x,Eo.z,0,-Eo.x,-zE.y,zE.x,0,-$E.y,$E.x,0,-Eo.y,Eo.x,0];return!Qw(I,Qs,es,Es,DD)||(I=[1,0,0,0,1,0,0,0,1],!Qw(I,Qs,es,Es,DD))?!1:(hD.crossVectors(zE,$E),I=[hD.x,hD.y,hD.z],Qw(I,Qs,es,Es,DD))}clampPoint(A,I){return I.copy(A).clamp(this.min,this.max)}distanceToPoint(A){return this.clampPoint(A,LQ).distanceTo(A)}getBoundingSphere(A){return this.isEmpty()?A.makeEmpty():(this.getCenter(A.center),A.radius=this.getSize(LQ).length()*.5),A}intersect(A){return this.min.max(A.min),this.max.min(A.max),this.isEmpty()&&this.makeEmpty(),this}union(A){return this.min.min(A.min),this.max.max(A.max),this}applyMatrix4(A){return this.isEmpty()?this:($e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(A),$e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(A),$e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(A),$e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(A),$e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(A),$e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(A),$e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(A),$e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(A),this.setFromPoints($e),this)}translate(A){return this.min.add(A),this.max.add(A),this}equals(A){return A.min.equals(this.min)&&A.max.equals(this.max)}}const $e=[new Z,new Z,new Z,new Z,new Z,new Z,new Z,new Z],LQ=new Z,lD=new _B,Qs=new Z,es=new Z,Es=new Z,zE=new Z,$E=new Z,Eo=new Z,za=new Z,DD=new Z,hD=new Z,to=new Z;function Qw(B,A,I,g,C){for(let i=0,e=B.length-3;i<=e;i+=3){to.fromArray(B,i);const E=C.x*Math.abs(to.x)+C.y*Math.abs(to.y)+C.z*Math.abs(to.z),n=A.dot(to),a=I.dot(to),r=g.dot(to);if(Math.max(-Math.max(n,a,r),Math.min(n,a,r))>E)return!1}return!0}const ZJ=new _B,$a=new Z,ew=new Z;class FB{constructor(A=new Z,I=-1){this.isSphere=!0,this.center=A,this.radius=I}set(A,I){return this.center.copy(A),this.radius=I,this}setFromPoints(A,I){const g=this.center;I!==void 0?g.copy(I):ZJ.setFromPoints(A).getCenter(g);let C=0;for(let i=0,e=A.length;ithis.radius*this.radius&&(I.sub(this.center).normalize(),I.multiplyScalar(this.radius).add(this.center)),I}getBoundingBox(A){return this.isEmpty()?(A.makeEmpty(),A):(A.set(this.center,this.center),A.expandByScalar(this.radius),A)}applyMatrix4(A){return this.center.applyMatrix4(A),this.radius=this.radius*A.getMaxScaleOnAxis(),this}translate(A){return this.center.add(A),this}expandByPoint(A){if(this.isEmpty())return this.center.copy(A),this.radius=0,this;$a.subVectors(A,this.center);const I=$a.lengthSq();if(I>this.radius*this.radius){const g=Math.sqrt(I),C=(g-this.radius)*.5;this.center.addScaledVector($a,C/g),this.radius+=C}return this}union(A){return A.isEmpty()?this:this.isEmpty()?(this.copy(A),this):(this.center.equals(A.center)===!0?this.radius=Math.max(this.radius,A.radius):(ew.subVectors(A.center,this.center).setLength(A.radius),this.expandByPoint($a.copy(A.center).add(ew)),this.expandByPoint($a.copy(A.center).sub(ew))),this)}equals(A){return A.center.equals(this.center)&&A.radius===this.radius}clone(){return new this.constructor().copy(this)}}const AE=new Z,Ew=new Z,cD=new Z,At=new Z,tw=new Z,SD=new Z,ow=new Z;class js{constructor(A=new Z,I=new Z(0,0,-1)){this.origin=A,this.direction=I}set(A,I){return this.origin.copy(A),this.direction.copy(I),this}copy(A){return this.origin.copy(A.origin),this.direction.copy(A.direction),this}at(A,I){return I.copy(this.origin).addScaledVector(this.direction,A)}lookAt(A){return this.direction.copy(A).sub(this.origin).normalize(),this}recast(A){return this.origin.copy(this.at(A,AE)),this}closestPointToPoint(A,I){I.subVectors(A,this.origin);const g=I.dot(this.direction);return g<0?I.copy(this.origin):I.copy(this.origin).addScaledVector(this.direction,g)}distanceToPoint(A){return Math.sqrt(this.distanceSqToPoint(A))}distanceSqToPoint(A){const I=AE.subVectors(A,this.origin).dot(this.direction);return I<0?this.origin.distanceToSquared(A):(AE.copy(this.origin).addScaledVector(this.direction,I),AE.distanceToSquared(A))}distanceSqToSegment(A,I,g,C){Ew.copy(A).add(I).multiplyScalar(.5),cD.copy(I).sub(A).normalize(),At.copy(this.origin).sub(Ew);const i=A.distanceTo(I)*.5,e=-this.direction.dot(cD),E=At.dot(this.direction),n=-At.dot(cD),a=At.lengthSq(),r=Math.abs(1-e*e);let D,h,S,G;if(r>0)if(D=e*n-E,h=e*E-n,G=i*r,D>=0)if(h>=-G)if(h<=G){const U=1/r;D*=U,h*=U,S=D*(D+e*h+2*E)+h*(e*D+h+2*n)+a}else h=i,D=Math.max(0,-(e*h+E)),S=-D*D+h*(h+2*n)+a;else h=-i,D=Math.max(0,-(e*h+E)),S=-D*D+h*(h+2*n)+a;else h<=-G?(D=Math.max(0,-(-e*i+E)),h=D>0?-i:Math.min(Math.max(-i,-n),i),S=-D*D+h*(h+2*n)+a):h<=G?(D=0,h=Math.min(Math.max(-i,-n),i),S=h*(h+2*n)+a):(D=Math.max(0,-(e*i+E)),h=D>0?i:Math.min(Math.max(-i,-n),i),S=-D*D+h*(h+2*n)+a);else h=e>0?-i:i,D=Math.max(0,-(e*h+E)),S=-D*D+h*(h+2*n)+a;return g&&g.copy(this.origin).addScaledVector(this.direction,D),C&&C.copy(Ew).addScaledVector(cD,h),S}intersectSphere(A,I){AE.subVectors(A.center,this.origin);const g=AE.dot(this.direction),C=AE.dot(AE)-g*g,i=A.radius*A.radius;if(C>i)return null;const e=Math.sqrt(i-C),E=g-e,n=g+e;return n<0?null:E<0?this.at(n,I):this.at(E,I)}intersectsSphere(A){return this.distanceSqToPoint(A.center)<=A.radius*A.radius}distanceToPlane(A){const I=A.normal.dot(this.direction);if(I===0)return A.distanceToPoint(this.origin)===0?0:null;const g=-(this.origin.dot(A.normal)+A.constant)/I;return g>=0?g:null}intersectPlane(A,I){const g=this.distanceToPlane(A);return g===null?null:this.at(g,I)}intersectsPlane(A){const I=A.distanceToPoint(this.origin);return I===0||A.normal.dot(this.direction)*I<0}intersectBox(A,I){let g,C,i,e,E,n;const a=1/this.direction.x,r=1/this.direction.y,D=1/this.direction.z,h=this.origin;return a>=0?(g=(A.min.x-h.x)*a,C=(A.max.x-h.x)*a):(g=(A.max.x-h.x)*a,C=(A.min.x-h.x)*a),r>=0?(i=(A.min.y-h.y)*r,e=(A.max.y-h.y)*r):(i=(A.max.y-h.y)*r,e=(A.min.y-h.y)*r),g>e||i>C||((i>g||isNaN(g))&&(g=i),(e=0?(E=(A.min.z-h.z)*D,n=(A.max.z-h.z)*D):(E=(A.max.z-h.z)*D,n=(A.min.z-h.z)*D),g>n||E>C)||((E>g||g!==g)&&(g=E),(n=0?g:C,I)}intersectsBox(A){return this.intersectBox(A,AE)!==null}intersectTriangle(A,I,g,C,i){tw.subVectors(I,A),SD.subVectors(g,A),ow.crossVectors(tw,SD);let e=this.direction.dot(ow),E;if(e>0){if(C)return null;E=1}else if(e<0)E=-1,e=-e;else return null;At.subVectors(this.origin,A);const n=E*this.direction.dot(SD.crossVectors(At,SD));if(n<0)return null;const a=E*this.direction.dot(tw.cross(At));if(a<0||n+a>e)return null;const r=-E*At.dot(ow);return r<0?null:this.at(r/e,i)}applyMatrix4(A){return this.origin.applyMatrix4(A),this.direction.transformDirection(A),this}equals(A){return A.origin.equals(this.origin)&&A.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class VI{constructor(A,I,g,C,i,e,E,n,a,r,D,h,S,G,U,k){VI.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],A!==void 0&&this.set(A,I,g,C,i,e,E,n,a,r,D,h,S,G,U,k)}set(A,I,g,C,i,e,E,n,a,r,D,h,S,G,U,k){const y=this.elements;return y[0]=A,y[4]=I,y[8]=g,y[12]=C,y[1]=i,y[5]=e,y[9]=E,y[13]=n,y[2]=a,y[6]=r,y[10]=D,y[14]=h,y[3]=S,y[7]=G,y[11]=U,y[15]=k,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 VI().fromArray(this.elements)}copy(A){const I=this.elements,g=A.elements;return I[0]=g[0],I[1]=g[1],I[2]=g[2],I[3]=g[3],I[4]=g[4],I[5]=g[5],I[6]=g[6],I[7]=g[7],I[8]=g[8],I[9]=g[9],I[10]=g[10],I[11]=g[11],I[12]=g[12],I[13]=g[13],I[14]=g[14],I[15]=g[15],this}copyPosition(A){const I=this.elements,g=A.elements;return I[12]=g[12],I[13]=g[13],I[14]=g[14],this}setFromMatrix3(A){const I=A.elements;return this.set(I[0],I[3],I[6],0,I[1],I[4],I[7],0,I[2],I[5],I[8],0,0,0,0,1),this}extractBasis(A,I,g){return A.setFromMatrixColumn(this,0),I.setFromMatrixColumn(this,1),g.setFromMatrixColumn(this,2),this}makeBasis(A,I,g){return this.set(A.x,I.x,g.x,0,A.y,I.y,g.y,0,A.z,I.z,g.z,0,0,0,0,1),this}extractRotation(A){const I=this.elements,g=A.elements,C=1/ts.setFromMatrixColumn(A,0).length(),i=1/ts.setFromMatrixColumn(A,1).length(),e=1/ts.setFromMatrixColumn(A,2).length();return I[0]=g[0]*C,I[1]=g[1]*C,I[2]=g[2]*C,I[3]=0,I[4]=g[4]*i,I[5]=g[5]*i,I[6]=g[6]*i,I[7]=0,I[8]=g[8]*e,I[9]=g[9]*e,I[10]=g[10]*e,I[11]=0,I[12]=0,I[13]=0,I[14]=0,I[15]=1,this}makeRotationFromEuler(A){const I=this.elements,g=A.x,C=A.y,i=A.z,e=Math.cos(g),E=Math.sin(g),n=Math.cos(C),a=Math.sin(C),r=Math.cos(i),D=Math.sin(i);if(A.order==="XYZ"){const h=e*r,S=e*D,G=E*r,U=E*D;I[0]=n*r,I[4]=-n*D,I[8]=a,I[1]=S+G*a,I[5]=h-U*a,I[9]=-E*n,I[2]=U-h*a,I[6]=G+S*a,I[10]=e*n}else if(A.order==="YXZ"){const h=n*r,S=n*D,G=a*r,U=a*D;I[0]=h+U*E,I[4]=G*E-S,I[8]=e*a,I[1]=e*D,I[5]=e*r,I[9]=-E,I[2]=S*E-G,I[6]=U+h*E,I[10]=e*n}else if(A.order==="ZXY"){const h=n*r,S=n*D,G=a*r,U=a*D;I[0]=h-U*E,I[4]=-e*D,I[8]=G+S*E,I[1]=S+G*E,I[5]=e*r,I[9]=U-h*E,I[2]=-e*a,I[6]=E,I[10]=e*n}else if(A.order==="ZYX"){const h=e*r,S=e*D,G=E*r,U=E*D;I[0]=n*r,I[4]=G*a-S,I[8]=h*a+U,I[1]=n*D,I[5]=U*a+h,I[9]=S*a-G,I[2]=-a,I[6]=E*n,I[10]=e*n}else if(A.order==="YZX"){const h=e*n,S=e*a,G=E*n,U=E*a;I[0]=n*r,I[4]=U-h*D,I[8]=G*D+S,I[1]=D,I[5]=e*r,I[9]=-E*r,I[2]=-a*r,I[6]=S*D+G,I[10]=h-U*D}else if(A.order==="XZY"){const h=e*n,S=e*a,G=E*n,U=E*a;I[0]=n*r,I[4]=-D,I[8]=a*r,I[1]=h*D+U,I[5]=e*r,I[9]=S*D-G,I[2]=G*D-S,I[6]=E*r,I[10]=U*D+h}return I[3]=0,I[7]=0,I[11]=0,I[12]=0,I[13]=0,I[14]=0,I[15]=1,this}makeRotationFromQuaternion(A){return this.compose(PJ,A,WJ)}lookAt(A,I,g){const C=this.elements;return Hi.subVectors(A,I),Hi.lengthSq()===0&&(Hi.z=1),Hi.normalize(),It.crossVectors(g,Hi),It.lengthSq()===0&&(Math.abs(g.z)===1?Hi.x+=1e-4:Hi.z+=1e-4,Hi.normalize(),It.crossVectors(g,Hi)),It.normalize(),wD.crossVectors(Hi,It),C[0]=It.x,C[4]=wD.x,C[8]=Hi.x,C[1]=It.y,C[5]=wD.y,C[9]=Hi.y,C[2]=It.z,C[6]=wD.z,C[10]=Hi.z,this}multiply(A){return this.multiplyMatrices(this,A)}premultiply(A){return this.multiplyMatrices(A,this)}multiplyMatrices(A,I){const g=A.elements,C=I.elements,i=this.elements,e=g[0],E=g[4],n=g[8],a=g[12],r=g[1],D=g[5],h=g[9],S=g[13],G=g[2],U=g[6],k=g[10],y=g[14],d=g[3],J=g[7],F=g[11],v=g[15],m=C[0],x=C[4],T=C[8],L=C[12],Y=C[1],b=C[5],IA=C[9],CA=C[13],nA=C[2],uA=C[6],EA=C[10],pA=C[14],V=C[3],aA=C[7],BA=C[11],P=C[15];return i[0]=e*m+E*Y+n*nA+a*V,i[4]=e*x+E*b+n*uA+a*aA,i[8]=e*T+E*IA+n*EA+a*BA,i[12]=e*L+E*CA+n*pA+a*P,i[1]=r*m+D*Y+h*nA+S*V,i[5]=r*x+D*b+h*uA+S*aA,i[9]=r*T+D*IA+h*EA+S*BA,i[13]=r*L+D*CA+h*pA+S*P,i[2]=G*m+U*Y+k*nA+y*V,i[6]=G*x+U*b+k*uA+y*aA,i[10]=G*T+U*IA+k*EA+y*BA,i[14]=G*L+U*CA+k*pA+y*P,i[3]=d*m+J*Y+F*nA+v*V,i[7]=d*x+J*b+F*uA+v*aA,i[11]=d*T+J*IA+F*EA+v*BA,i[15]=d*L+J*CA+F*pA+v*P,this}multiplyScalar(A){const I=this.elements;return I[0]*=A,I[4]*=A,I[8]*=A,I[12]*=A,I[1]*=A,I[5]*=A,I[9]*=A,I[13]*=A,I[2]*=A,I[6]*=A,I[10]*=A,I[14]*=A,I[3]*=A,I[7]*=A,I[11]*=A,I[15]*=A,this}determinant(){const A=this.elements,I=A[0],g=A[4],C=A[8],i=A[12],e=A[1],E=A[5],n=A[9],a=A[13],r=A[2],D=A[6],h=A[10],S=A[14],G=A[3],U=A[7],k=A[11],y=A[15];return G*(+i*n*D-C*a*D-i*E*h+g*a*h+C*E*S-g*n*S)+U*(+I*n*S-I*a*h+i*e*h-C*e*S+C*a*r-i*n*r)+k*(+I*a*D-I*E*S-i*e*D+g*e*S+i*E*r-g*a*r)+y*(-C*E*r-I*n*D+I*E*h+C*e*D-g*e*h+g*n*r)}transpose(){const A=this.elements;let I;return I=A[1],A[1]=A[4],A[4]=I,I=A[2],A[2]=A[8],A[8]=I,I=A[6],A[6]=A[9],A[9]=I,I=A[3],A[3]=A[12],A[12]=I,I=A[7],A[7]=A[13],A[13]=I,I=A[11],A[11]=A[14],A[14]=I,this}setPosition(A,I,g){const C=this.elements;return A.isVector3?(C[12]=A.x,C[13]=A.y,C[14]=A.z):(C[12]=A,C[13]=I,C[14]=g),this}invert(){const A=this.elements,I=A[0],g=A[1],C=A[2],i=A[3],e=A[4],E=A[5],n=A[6],a=A[7],r=A[8],D=A[9],h=A[10],S=A[11],G=A[12],U=A[13],k=A[14],y=A[15],d=D*k*a-U*h*a+U*n*S-E*k*S-D*n*y+E*h*y,J=G*h*a-r*k*a-G*n*S+e*k*S+r*n*y-e*h*y,F=r*U*a-G*D*a+G*E*S-e*U*S-r*E*y+e*D*y,v=G*D*n-r*U*n-G*E*h+e*U*h+r*E*k-e*D*k,m=I*d+g*J+C*F+i*v;if(m===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const x=1/m;return A[0]=d*x,A[1]=(U*h*i-D*k*i-U*C*S+g*k*S+D*C*y-g*h*y)*x,A[2]=(E*k*i-U*n*i+U*C*a-g*k*a-E*C*y+g*n*y)*x,A[3]=(D*n*i-E*h*i-D*C*a+g*h*a+E*C*S-g*n*S)*x,A[4]=J*x,A[5]=(r*k*i-G*h*i+G*C*S-I*k*S-r*C*y+I*h*y)*x,A[6]=(G*n*i-e*k*i-G*C*a+I*k*a+e*C*y-I*n*y)*x,A[7]=(e*h*i-r*n*i+r*C*a-I*h*a-e*C*S+I*n*S)*x,A[8]=F*x,A[9]=(G*D*i-r*U*i-G*g*S+I*U*S+r*g*y-I*D*y)*x,A[10]=(e*U*i-G*E*i+G*g*a-I*U*a-e*g*y+I*E*y)*x,A[11]=(r*E*i-e*D*i-r*g*a+I*D*a+e*g*S-I*E*S)*x,A[12]=v*x,A[13]=(r*U*C-G*D*C+G*g*h-I*U*h-r*g*k+I*D*k)*x,A[14]=(G*E*C-e*U*C-G*g*n+I*U*n+e*g*k-I*E*k)*x,A[15]=(e*D*C-r*E*C+r*g*n-I*D*n-e*g*h+I*E*h)*x,this}scale(A){const I=this.elements,g=A.x,C=A.y,i=A.z;return I[0]*=g,I[4]*=C,I[8]*=i,I[1]*=g,I[5]*=C,I[9]*=i,I[2]*=g,I[6]*=C,I[10]*=i,I[3]*=g,I[7]*=C,I[11]*=i,this}getMaxScaleOnAxis(){const A=this.elements,I=A[0]*A[0]+A[1]*A[1]+A[2]*A[2],g=A[4]*A[4]+A[5]*A[5]+A[6]*A[6],C=A[8]*A[8]+A[9]*A[9]+A[10]*A[10];return Math.sqrt(Math.max(I,g,C))}makeTranslation(A,I,g){return A.isVector3?this.set(1,0,0,A.x,0,1,0,A.y,0,0,1,A.z,0,0,0,1):this.set(1,0,0,A,0,1,0,I,0,0,1,g,0,0,0,1),this}makeRotationX(A){const I=Math.cos(A),g=Math.sin(A);return this.set(1,0,0,0,0,I,-g,0,0,g,I,0,0,0,0,1),this}makeRotationY(A){const I=Math.cos(A),g=Math.sin(A);return this.set(I,0,g,0,0,1,0,0,-g,0,I,0,0,0,0,1),this}makeRotationZ(A){const I=Math.cos(A),g=Math.sin(A);return this.set(I,-g,0,0,g,I,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(A,I){const g=Math.cos(I),C=Math.sin(I),i=1-g,e=A.x,E=A.y,n=A.z,a=i*e,r=i*E;return this.set(a*e+g,a*E-C*n,a*n+C*E,0,a*E+C*n,r*E+g,r*n-C*e,0,a*n-C*E,r*n+C*e,i*n*n+g,0,0,0,0,1),this}makeScale(A,I,g){return this.set(A,0,0,0,0,I,0,0,0,0,g,0,0,0,0,1),this}makeShear(A,I,g,C,i,e){return this.set(1,g,i,0,A,1,e,0,I,C,1,0,0,0,0,1),this}compose(A,I,g){const C=this.elements,i=I._x,e=I._y,E=I._z,n=I._w,a=i+i,r=e+e,D=E+E,h=i*a,S=i*r,G=i*D,U=e*r,k=e*D,y=E*D,d=n*a,J=n*r,F=n*D,v=g.x,m=g.y,x=g.z;return C[0]=(1-(U+y))*v,C[1]=(S+F)*v,C[2]=(G-J)*v,C[3]=0,C[4]=(S-F)*m,C[5]=(1-(h+y))*m,C[6]=(k+d)*m,C[7]=0,C[8]=(G+J)*x,C[9]=(k-d)*x,C[10]=(1-(h+U))*x,C[11]=0,C[12]=A.x,C[13]=A.y,C[14]=A.z,C[15]=1,this}decompose(A,I,g){const C=this.elements;let i=ts.set(C[0],C[1],C[2]).length();const e=ts.set(C[4],C[5],C[6]).length(),E=ts.set(C[8],C[9],C[10]).length();this.determinant()<0&&(i=-i),A.x=C[12],A.y=C[13],A.z=C[14],YQ.copy(this);const a=1/i,r=1/e,D=1/E;return YQ.elements[0]*=a,YQ.elements[1]*=a,YQ.elements[2]*=a,YQ.elements[4]*=r,YQ.elements[5]*=r,YQ.elements[6]*=r,YQ.elements[8]*=D,YQ.elements[9]*=D,YQ.elements[10]*=D,I.setFromRotationMatrix(YQ),g.x=i,g.y=e,g.z=E,this}makePerspective(A,I,g,C,i,e,E=oe){const n=this.elements,a=2*i/(I-A),r=2*i/(g-C),D=(I+A)/(I-A),h=(g+C)/(g-C);let S,G;if(E===oe)S=-(e+i)/(e-i),G=-2*e*i/(e-i);else if(E===qr)S=-e/(e-i),G=-e*i/(e-i);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+E);return n[0]=a,n[4]=0,n[8]=D,n[12]=0,n[1]=0,n[5]=r,n[9]=h,n[13]=0,n[2]=0,n[6]=0,n[10]=S,n[14]=G,n[3]=0,n[7]=0,n[11]=-1,n[15]=0,this}makeOrthographic(A,I,g,C,i,e,E=oe){const n=this.elements,a=1/(I-A),r=1/(g-C),D=1/(e-i),h=(I+A)*a,S=(g+C)*r;let G,U;if(E===oe)G=(e+i)*D,U=-2*D;else if(E===qr)G=i*D,U=-1*D;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+E);return n[0]=2*a,n[4]=0,n[8]=0,n[12]=-h,n[1]=0,n[5]=2*r,n[9]=0,n[13]=-S,n[2]=0,n[6]=0,n[10]=U,n[14]=-G,n[3]=0,n[7]=0,n[11]=0,n[15]=1,this}equals(A){const I=this.elements,g=A.elements;for(let C=0;C<16;C++)if(I[C]!==g[C])return!1;return!0}fromArray(A,I=0){for(let g=0;g<16;g++)this.elements[g]=A[g+I];return this}toArray(A=[],I=0){const g=this.elements;return A[I]=g[0],A[I+1]=g[1],A[I+2]=g[2],A[I+3]=g[3],A[I+4]=g[4],A[I+5]=g[5],A[I+6]=g[6],A[I+7]=g[7],A[I+8]=g[8],A[I+9]=g[9],A[I+10]=g[10],A[I+11]=g[11],A[I+12]=g[12],A[I+13]=g[13],A[I+14]=g[14],A[I+15]=g[15],A}}const ts=new Z,YQ=new VI,PJ=new Z(0,0,0),WJ=new Z(1,1,1),It=new Z,wD=new Z,Hi=new Z,du=new VI,Nu=new BB;class ZB{constructor(A=0,I=0,g=0,C=ZB.DEFAULT_ORDER){this.isEuler=!0,this._x=A,this._y=I,this._z=g,this._order=C}get x(){return this._x}set x(A){this._x=A,this._onChangeCallback()}get y(){return this._y}set y(A){this._y=A,this._onChangeCallback()}get z(){return this._z}set z(A){this._z=A,this._onChangeCallback()}get order(){return this._order}set order(A){this._order=A,this._onChangeCallback()}set(A,I,g,C=this._order){return this._x=A,this._y=I,this._z=g,this._order=C,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(A){return this._x=A._x,this._y=A._y,this._z=A._z,this._order=A._order,this._onChangeCallback(),this}setFromRotationMatrix(A,I=this._order,g=!0){const C=A.elements,i=C[0],e=C[4],E=C[8],n=C[1],a=C[5],r=C[9],D=C[2],h=C[6],S=C[10];switch(I){case"XYZ":this._y=Math.asin(NC(E,-1,1)),Math.abs(E)<.9999999?(this._x=Math.atan2(-r,S),this._z=Math.atan2(-e,i)):(this._x=Math.atan2(h,a),this._z=0);break;case"YXZ":this._x=Math.asin(-NC(r,-1,1)),Math.abs(r)<.9999999?(this._y=Math.atan2(E,S),this._z=Math.atan2(n,a)):(this._y=Math.atan2(-D,i),this._z=0);break;case"ZXY":this._x=Math.asin(NC(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-D,S),this._z=Math.atan2(-e,a)):(this._y=0,this._z=Math.atan2(n,i));break;case"ZYX":this._y=Math.asin(-NC(D,-1,1)),Math.abs(D)<.9999999?(this._x=Math.atan2(h,S),this._z=Math.atan2(n,i)):(this._x=0,this._z=Math.atan2(-e,a));break;case"YZX":this._z=Math.asin(NC(n,-1,1)),Math.abs(n)<.9999999?(this._x=Math.atan2(-r,a),this._y=Math.atan2(-D,i)):(this._x=0,this._y=Math.atan2(E,S));break;case"XZY":this._z=Math.asin(-NC(e,-1,1)),Math.abs(e)<.9999999?(this._x=Math.atan2(h,a),this._y=Math.atan2(E,i)):(this._x=Math.atan2(-r,S),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+I)}return this._order=I,g===!0&&this._onChangeCallback(),this}setFromQuaternion(A,I,g){return du.makeRotationFromQuaternion(A),this.setFromRotationMatrix(du,I,g)}setFromVector3(A,I=this._order){return this.set(A.x,A.y,A.z,I)}reorder(A){return Nu.setFromEuler(this),this.setFromQuaternion(Nu,A)}equals(A){return A._x===this._x&&A._y===this._y&&A._z===this._z&&A._order===this._order}fromArray(A){return this._x=A[0],this._y=A[1],this._z=A[2],A[3]!==void 0&&(this._order=A[3]),this._onChangeCallback(),this}toArray(A=[],I=0){return A[I]=this._x,A[I+1]=this._y,A[I+2]=this._z,A[I+3]=this._order,A}_onChange(A){return this._onChangeCallback=A,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}ZB.DEFAULT_ORDER="XYZ";class Ho{constructor(){this.mask=1}set(A){this.mask=(1<>>0}enable(A){this.mask|=1<1){for(let I=0;I1){for(let g=0;g0&&(C.userData=this.userData),C.layers=this.layers.mask,C.matrix=this.matrix.toArray(),C.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(C.matrixAutoUpdate=!1),this.isInstancedMesh&&(C.type="InstancedMesh",C.count=this.count,C.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(C.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(C.type="BatchedMesh",C.perObjectFrustumCulled=this.perObjectFrustumCulled,C.sortObjects=this.sortObjects,C.drawRanges=this._drawRanges,C.reservedRanges=this._reservedRanges,C.visibility=this._visibility,C.active=this._active,C.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()})),C.maxInstanceCount=this._maxInstanceCount,C.maxVertexCount=this._maxVertexCount,C.maxIndexCount=this._maxIndexCount,C.geometryInitialized=this._geometryInitialized,C.geometryCount=this._geometryCount,C.matricesTexture=this._matricesTexture.toJSON(A),this._colorsTexture!==null&&(C.colorsTexture=this._colorsTexture.toJSON(A)),this.boundingSphere!==null&&(C.boundingSphere={center:C.boundingSphere.center.toArray(),radius:C.boundingSphere.radius}),this.boundingBox!==null&&(C.boundingBox={min:C.boundingBox.min.toArray(),max:C.boundingBox.max.toArray()}));function i(E,n){return E[n.uuid]===void 0&&(E[n.uuid]=n.toJSON(A)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?C.background=this.background.toJSON():this.background.isTexture&&(C.background=this.background.toJSON(A).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(C.environment=this.environment.toJSON(A).uuid);else if(this.isMesh||this.isLine||this.isPoints){C.geometry=i(A.geometries,this.geometry);const E=this.geometry.parameters;if(E!==void 0&&E.shapes!==void 0){const n=E.shapes;if(Array.isArray(n))for(let a=0,r=n.length;a0){C.children=[];for(let E=0;E0){C.animations=[];for(let E=0;E0&&(g.geometries=E),n.length>0&&(g.materials=n),a.length>0&&(g.textures=a),r.length>0&&(g.images=r),D.length>0&&(g.shapes=D),h.length>0&&(g.skeletons=h),S.length>0&&(g.animations=S),G.length>0&&(g.nodes=G)}return g.object=C,g;function e(E){const n=[];for(const a in E){const r=E[a];delete r.metadata,n.push(r)}return n}}clone(A){return new this.constructor().copy(this,A)}copy(A,I=!0){if(this.name=A.name,this.up.copy(A.up),this.position.copy(A.position),this.rotation.order=A.rotation.order,this.quaternion.copy(A.quaternion),this.scale.copy(A.scale),this.matrix.copy(A.matrix),this.matrixWorld.copy(A.matrixWorld),this.matrixAutoUpdate=A.matrixAutoUpdate,this.matrixWorldAutoUpdate=A.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=A.matrixWorldNeedsUpdate,this.layers.mask=A.layers.mask,this.visible=A.visible,this.castShadow=A.castShadow,this.receiveShadow=A.receiveShadow,this.frustumCulled=A.frustumCulled,this.renderOrder=A.renderOrder,this.animations=A.animations.slice(),this.userData=JSON.parse(JSON.stringify(A.userData)),I===!0)for(let g=0;g0?C.multiplyScalar(1/Math.sqrt(i)):C.set(0,0,0)}static getBarycoord(A,I,g,C,i){qQ.subVectors(C,I),gE.subVectors(g,I),sw.subVectors(A,I);const e=qQ.dot(qQ),E=qQ.dot(gE),n=qQ.dot(sw),a=gE.dot(gE),r=gE.dot(sw),D=e*a-E*E;if(D===0)return i.set(0,0,0),null;const h=1/D,S=(a*n-E*r)*h,G=(e*r-E*n)*h;return i.set(1-S-G,G,S)}static containsPoint(A,I,g,C){return this.getBarycoord(A,I,g,C,CE)===null?!1:CE.x>=0&&CE.y>=0&&CE.x+CE.y<=1}static getInterpolation(A,I,g,C,i,e,E,n){return this.getBarycoord(A,I,g,C,CE)===null?(n.x=0,n.y=0,"z"in n&&(n.z=0),"w"in n&&(n.w=0),null):(n.setScalar(0),n.addScaledVector(i,CE.x),n.addScaledVector(e,CE.y),n.addScaledVector(E,CE.z),n)}static getInterpolatedAttribute(A,I,g,C,i,e){return Dw.setScalar(0),hw.setScalar(0),cw.setScalar(0),Dw.fromBufferAttribute(A,I),hw.fromBufferAttribute(A,g),cw.fromBufferAttribute(A,C),e.setScalar(0),e.addScaledVector(Dw,i.x),e.addScaledVector(hw,i.y),e.addScaledVector(cw,i.z),e}static isFrontFacing(A,I,g,C){return qQ.subVectors(g,I),gE.subVectors(A,I),qQ.cross(gE).dot(C)<0}set(A,I,g){return this.a.copy(A),this.b.copy(I),this.c.copy(g),this}setFromPointsAndIndices(A,I,g,C){return this.a.copy(A[I]),this.b.copy(A[g]),this.c.copy(A[C]),this}setFromAttributeAndIndices(A,I,g,C){return this.a.fromBufferAttribute(A,I),this.b.fromBufferAttribute(A,g),this.c.fromBufferAttribute(A,C),this}clone(){return new this.constructor().copy(this)}copy(A){return this.a.copy(A.a),this.b.copy(A.b),this.c.copy(A.c),this}getArea(){return qQ.subVectors(this.c,this.b),gE.subVectors(this.a,this.b),qQ.cross(gE).length()*.5}getMidpoint(A){return A.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(A){return Ui.getNormal(this.a,this.b,this.c,A)}getPlane(A){return A.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(A,I){return Ui.getBarycoord(A,this.a,this.b,this.c,I)}getInterpolation(A,I,g,C,i){return Ui.getInterpolation(A,this.a,this.b,this.c,I,g,C,i)}containsPoint(A){return Ui.containsPoint(A,this.a,this.b,this.c)}isFrontFacing(A){return Ui.isFrontFacing(this.a,this.b,this.c,A)}intersectsBox(A){return A.intersectsTriangle(this)}closestPointToPoint(A,I){const g=this.a,C=this.b,i=this.c;let e,E;ss.subVectors(C,g),as.subVectors(i,g),aw.subVectors(A,g);const n=ss.dot(aw),a=as.dot(aw);if(n<=0&&a<=0)return I.copy(g);rw.subVectors(A,C);const r=ss.dot(rw),D=as.dot(rw);if(r>=0&&D<=r)return I.copy(C);const h=n*D-r*a;if(h<=0&&n>=0&&r<=0)return e=n/(n-r),I.copy(g).addScaledVector(ss,e);lw.subVectors(A,i);const S=ss.dot(lw),G=as.dot(lw);if(G>=0&&S<=G)return I.copy(i);const U=S*a-n*G;if(U<=0&&a>=0&&G<=0)return E=a/(a-G),I.copy(g).addScaledVector(as,E);const k=r*G-S*D;if(k<=0&&D-r>=0&&S-G>=0)return Lu.subVectors(i,C),E=(D-r)/(D-r+(S-G)),I.copy(C).addScaledVector(Lu,E);const y=1/(k+U+h);return e=U*y,E=h*y,I.copy(g).addScaledVector(ss,e).addScaledVector(as,E)}equals(A){return A.a.equals(this.a)&&A.b.equals(this.b)&&A.c.equals(this.c)}}const ip={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},gt={h:0,s:0,l:0},GD={h:0,s:0,l:0};function Sw(B,A,I){return I<0&&(I+=1),I>1&&(I-=1),I<1/6?B+(A-B)*6*I:I<1/2?A:I<2/3?B+(A-B)*6*(2/3-I):B}class cI{constructor(A,I,g){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(A,I,g)}set(A,I,g){if(I===void 0&&g===void 0){const C=A;C&&C.isColor?this.copy(C):typeof C=="number"?this.setHex(C):typeof C=="string"&&this.setStyle(C)}else this.setRGB(A,I,g);return this}setScalar(A){return this.r=A,this.g=A,this.b=A,this}setHex(A,I=DB){return A=Math.floor(A),this.r=(A>>16&255)/255,this.g=(A>>8&255)/255,this.b=(A&255)/255,Kg.toWorkingColorSpace(this,I),this}setRGB(A,I,g,C=Kg.workingColorSpace){return this.r=A,this.g=I,this.b=g,Kg.toWorkingColorSpace(this,C),this}setHSL(A,I,g,C=Kg.workingColorSpace){if(A=Vy(A,1),I=NC(I,0,1),g=NC(g,0,1),I===0)this.r=this.g=this.b=g;else{const i=g<=.5?g*(1+I):g+I-g*I,e=2*g-i;this.r=Sw(e,i,A+1/3),this.g=Sw(e,i,A),this.b=Sw(e,i,A-1/3)}return Kg.toWorkingColorSpace(this,C),this}setStyle(A,I=DB){function g(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+A+" will be ignored.")}let C;if(C=/^(\w+)\(([^\)]*)\)/.exec(A)){let i;const e=C[1],E=C[2];switch(e){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(E))return g(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,I);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(E))return g(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,I);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(E))return g(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,I);break;default:console.warn("THREE.Color: Unknown color model "+A)}}else if(C=/^\#([A-Fa-f\d]+)$/.exec(A)){const i=C[1],e=i.length;if(e===3)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,I);if(e===6)return this.setHex(parseInt(i,16),I);console.warn("THREE.Color: Invalid hex color "+A)}else if(A&&A.length>0)return this.setColorName(A,I);return this}setColorName(A,I=DB){const g=ip[A.toLowerCase()];return g!==void 0?this.setHex(g,I):console.warn("THREE.Color: Unknown color "+A),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(A){return this.r=A.r,this.g=A.g,this.b=A.b,this}copySRGBToLinear(A){return this.r=sE(A.r),this.g=sE(A.g),this.b=sE(A.b),this}copyLinearToSRGB(A){return this.r=Fs(A.r),this.g=Fs(A.g),this.b=Fs(A.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(A=DB){return Kg.fromWorkingColorSpace(OB.copy(this),A),Math.round(NC(OB.r*255,0,255))*65536+Math.round(NC(OB.g*255,0,255))*256+Math.round(NC(OB.b*255,0,255))}getHexString(A=DB){return("000000"+this.getHex(A).toString(16)).slice(-6)}getHSL(A,I=Kg.workingColorSpace){Kg.fromWorkingColorSpace(OB.copy(this),I);const g=OB.r,C=OB.g,i=OB.b,e=Math.max(g,C,i),E=Math.min(g,C,i);let n,a;const r=(E+e)/2;if(E===e)n=0,a=0;else{const D=e-E;switch(a=r<=.5?D/(e+E):D/(2-e-E),e){case g:n=(C-i)/D+(C0!=A>0&&this.version++,this._alphaTest=A}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(A){if(A!==void 0)for(const I in A){const g=A[I];if(g===void 0){console.warn(`THREE.Material: parameter '${I}' has value of undefined.`);continue}const C=this[I];if(C===void 0){console.warn(`THREE.Material: '${I}' is not a property of THREE.${this.type}.`);continue}C&&C.isColor?C.set(g):C&&C.isVector3&&g&&g.isVector3?C.copy(g):this[I]=g}}toJSON(A){const I=A===void 0||typeof A=="string";I&&(A={textures:{},images:{}});const g={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};g.uuid=this.uuid,g.type=this.type,this.name!==""&&(g.name=this.name),this.color&&this.color.isColor&&(g.color=this.color.getHex()),this.roughness!==void 0&&(g.roughness=this.roughness),this.metalness!==void 0&&(g.metalness=this.metalness),this.sheen!==void 0&&(g.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(g.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(g.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(g.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(g.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(g.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(g.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(g.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(g.shininess=this.shininess),this.clearcoat!==void 0&&(g.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(g.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(g.clearcoatMap=this.clearcoatMap.toJSON(A).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(g.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(A).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(g.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(A).uuid,g.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(g.dispersion=this.dispersion),this.iridescence!==void 0&&(g.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(g.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(g.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(g.iridescenceMap=this.iridescenceMap.toJSON(A).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(g.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(A).uuid),this.anisotropy!==void 0&&(g.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(g.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(g.anisotropyMap=this.anisotropyMap.toJSON(A).uuid),this.map&&this.map.isTexture&&(g.map=this.map.toJSON(A).uuid),this.matcap&&this.matcap.isTexture&&(g.matcap=this.matcap.toJSON(A).uuid),this.alphaMap&&this.alphaMap.isTexture&&(g.alphaMap=this.alphaMap.toJSON(A).uuid),this.lightMap&&this.lightMap.isTexture&&(g.lightMap=this.lightMap.toJSON(A).uuid,g.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(g.aoMap=this.aoMap.toJSON(A).uuid,g.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(g.bumpMap=this.bumpMap.toJSON(A).uuid,g.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(g.normalMap=this.normalMap.toJSON(A).uuid,g.normalMapType=this.normalMapType,g.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(g.displacementMap=this.displacementMap.toJSON(A).uuid,g.displacementScale=this.displacementScale,g.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(g.roughnessMap=this.roughnessMap.toJSON(A).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(g.metalnessMap=this.metalnessMap.toJSON(A).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(g.emissiveMap=this.emissiveMap.toJSON(A).uuid),this.specularMap&&this.specularMap.isTexture&&(g.specularMap=this.specularMap.toJSON(A).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(g.specularIntensityMap=this.specularIntensityMap.toJSON(A).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(g.specularColorMap=this.specularColorMap.toJSON(A).uuid),this.envMap&&this.envMap.isTexture&&(g.envMap=this.envMap.toJSON(A).uuid,this.combine!==void 0&&(g.combine=this.combine)),this.envMapRotation!==void 0&&(g.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(g.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(g.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(g.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(g.gradientMap=this.gradientMap.toJSON(A).uuid),this.transmission!==void 0&&(g.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(g.transmissionMap=this.transmissionMap.toJSON(A).uuid),this.thickness!==void 0&&(g.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(g.thicknessMap=this.thicknessMap.toJSON(A).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(g.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(g.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(g.size=this.size),this.shadowSide!==null&&(g.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(g.sizeAttenuation=this.sizeAttenuation),this.blending!==Yo&&(g.blending=this.blending),this.side!==re&&(g.side=this.side),this.vertexColors===!0&&(g.vertexColors=!0),this.opacity<1&&(g.opacity=this.opacity),this.transparent===!0&&(g.transparent=!0),this.blendSrc!==Sh&&(g.blendSrc=this.blendSrc),this.blendDst!==wh&&(g.blendDst=this.blendDst),this.blendEquation!==ot&&(g.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(g.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(g.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(g.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(g.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(g.blendAlpha=this.blendAlpha),this.depthFunc!==xo&&(g.depthFunc=this.depthFunc),this.depthTest===!1&&(g.depthTest=this.depthTest),this.depthWrite===!1&&(g.depthWrite=this.depthWrite),this.colorWrite===!1&&(g.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(g.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==yy&&(g.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(g.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(g.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ko&&(g.stencilFail=this.stencilFail),this.stencilZFail!==ko&&(g.stencilZFail=this.stencilZFail),this.stencilZPass!==ko&&(g.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(g.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(g.rotation=this.rotation),this.polygonOffset===!0&&(g.polygonOffset=!0),this.polygonOffsetFactor!==0&&(g.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(g.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(g.linewidth=this.linewidth),this.dashSize!==void 0&&(g.dashSize=this.dashSize),this.gapSize!==void 0&&(g.gapSize=this.gapSize),this.scale!==void 0&&(g.scale=this.scale),this.dithering===!0&&(g.dithering=!0),this.alphaTest>0&&(g.alphaTest=this.alphaTest),this.alphaHash===!0&&(g.alphaHash=!0),this.alphaToCoverage===!0&&(g.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(g.premultipliedAlpha=!0),this.forceSinglePass===!0&&(g.forceSinglePass=!0),this.wireframe===!0&&(g.wireframe=!0),this.wireframeLinewidth>1&&(g.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(g.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(g.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(g.flatShading=!0),this.visible===!1&&(g.visible=!1),this.toneMapped===!1&&(g.toneMapped=!1),this.fog===!1&&(g.fog=!1),Object.keys(this.userData).length>0&&(g.userData=this.userData);function C(i){const e=[];for(const E in i){const n=i[E];delete n.metadata,e.push(n)}return e}if(I){const i=C(A.textures),e=C(A.images);i.length>0&&(g.textures=i),e.length>0&&(g.images=e)}return g}clone(){return new this.constructor().copy(this)}copy(A){this.name=A.name,this.blending=A.blending,this.side=A.side,this.vertexColors=A.vertexColors,this.opacity=A.opacity,this.transparent=A.transparent,this.blendSrc=A.blendSrc,this.blendDst=A.blendDst,this.blendEquation=A.blendEquation,this.blendSrcAlpha=A.blendSrcAlpha,this.blendDstAlpha=A.blendDstAlpha,this.blendEquationAlpha=A.blendEquationAlpha,this.blendColor.copy(A.blendColor),this.blendAlpha=A.blendAlpha,this.depthFunc=A.depthFunc,this.depthTest=A.depthTest,this.depthWrite=A.depthWrite,this.stencilWriteMask=A.stencilWriteMask,this.stencilFunc=A.stencilFunc,this.stencilRef=A.stencilRef,this.stencilFuncMask=A.stencilFuncMask,this.stencilFail=A.stencilFail,this.stencilZFail=A.stencilZFail,this.stencilZPass=A.stencilZPass,this.stencilWrite=A.stencilWrite;const I=A.clippingPlanes;let g=null;if(I!==null){const C=I.length;g=new Array(C);for(let i=0;i!==C;++i)g[i]=I[i].clone()}return this.clippingPlanes=g,this.clipIntersection=A.clipIntersection,this.clipShadows=A.clipShadows,this.shadowSide=A.shadowSide,this.colorWrite=A.colorWrite,this.precision=A.precision,this.polygonOffset=A.polygonOffset,this.polygonOffsetFactor=A.polygonOffsetFactor,this.polygonOffsetUnits=A.polygonOffsetUnits,this.dithering=A.dithering,this.alphaTest=A.alphaTest,this.alphaHash=A.alphaHash,this.alphaToCoverage=A.alphaToCoverage,this.premultipliedAlpha=A.premultipliedAlpha,this.forceSinglePass=A.forceSinglePass,this.visible=A.visible,this.toneMapped=A.toneMapped,this.userData=JSON.parse(JSON.stringify(A.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(A){A===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class pi extends iB{static get type(){return"MeshBasicMaterial"}constructor(A){super(),this.isMeshBasicMaterial=!0,this.color=new cI(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 ZB,this.combine=Il,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(A)}copy(A){return super.copy(A),this.color.copy(A.color),this.map=A.map,this.lightMap=A.lightMap,this.lightMapIntensity=A.lightMapIntensity,this.aoMap=A.aoMap,this.aoMapIntensity=A.aoMapIntensity,this.specularMap=A.specularMap,this.alphaMap=A.alphaMap,this.envMap=A.envMap,this.envMapRotation.copy(A.envMapRotation),this.combine=A.combine,this.reflectivity=A.reflectivity,this.refractionRatio=A.refractionRatio,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this.wireframeLinecap=A.wireframeLinecap,this.wireframeLinejoin=A.wireframeLinejoin,this.fog=A.fog,this}}const EE=AK();function AK(){const B=new ArrayBuffer(4),A=new Float32Array(B),I=new Uint32Array(B),g=new Uint32Array(512),C=new Uint32Array(512);for(let n=0;n<256;++n){const a=n-127;a<-27?(g[n]=0,g[n|256]=32768,C[n]=24,C[n|256]=24):a<-14?(g[n]=1024>>-a-14,g[n|256]=1024>>-a-14|32768,C[n]=-a-1,C[n|256]=-a-1):a<=15?(g[n]=a+15<<10,g[n|256]=a+15<<10|32768,C[n]=13,C[n|256]=13):a<128?(g[n]=31744,g[n|256]=64512,C[n]=24,C[n|256]=24):(g[n]=31744,g[n|256]=64512,C[n]=13,C[n|256]=13)}const i=new Uint32Array(2048),e=new Uint32Array(64),E=new Uint32Array(64);for(let n=1;n<1024;++n){let a=n<<13,r=0;for(;(a&8388608)===0;)a<<=1,r-=8388608;a&=-8388609,r+=947912704,i[n]=a|r}for(let n=1024;n<2048;++n)i[n]=939524096+(n-1024<<13);for(let n=1;n<31;++n)e[n]=n<<23;e[31]=1199570944,e[32]=2147483648;for(let n=33;n<63;++n)e[n]=2147483648+(n-32<<23);e[63]=3347054592;for(let n=1;n<64;++n)n!==32&&(E[n]=1024);return{floatView:A,uint32View:I,baseTable:g,shiftTable:C,mantissaTable:i,exponentTable:e,offsetTable:E}}function Mi(B){Math.abs(B)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),B=NC(B,-65504,65504),EE.floatView[0]=B;const A=EE.uint32View[0],I=A>>23&511;return EE.baseTable[I]+((A&8388607)>>EE.shiftTable[I])}function Dr(B){const A=B>>10;return EE.uint32View[0]=EE.mantissaTable[EE.offsetTable[A]+(B&1023)]+EE.exponentTable[A],EE.floatView[0]}const Fo={toHalfFloat:Mi,fromHalfFloat:Dr},bC=new Z,kD=new PA;class Eg{constructor(A,I,g=!1){if(Array.isArray(A))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=A,this.itemSize=I,this.count=A!==void 0?A.length/I:0,this.normalized=g,this.usage=Yr,this.updateRanges=[],this.gpuType=yC,this.version=0}onUploadCallback(){}set needsUpdate(A){A===!0&&this.version++}setUsage(A){return this.usage=A,this}addUpdateRange(A,I){this.updateRanges.push({start:A,count:I})}clearUpdateRanges(){this.updateRanges.length=0}copy(A){return this.name=A.name,this.array=new A.array.constructor(A.array),this.itemSize=A.itemSize,this.count=A.count,this.normalized=A.normalized,this.usage=A.usage,this.gpuType=A.gpuType,this}copyAt(A,I,g){A*=this.itemSize,g*=I.itemSize;for(let C=0,i=this.itemSize;CI.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),I.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new _B);const A=this.attributes.position,I=this.morphAttributes.position;if(A&&A.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Z(-1/0,-1/0,-1/0),new Z(1/0,1/0,1/0));return}if(A!==void 0){if(this.boundingBox.setFromBufferAttribute(A),I)for(let g=0,C=I.length;g0&&(A.userData=this.userData),this.parameters!==void 0){const n=this.parameters;for(const a in n)n[a]!==void 0&&(A[a]=n[a]);return A}A.data={attributes:{}};const I=this.index;I!==null&&(A.data.index={type:I.array.constructor.name,array:Array.prototype.slice.call(I.array)});const g=this.attributes;for(const n in g){const a=g[n];A.data.attributes[n]=a.toJSON(A.data)}const C={};let i=!1;for(const n in this.morphAttributes){const a=this.morphAttributes[n],r=[];for(let D=0,h=a.length;D0&&(C[n]=r,i=!0)}i&&(A.data.morphAttributes=C,A.data.morphTargetsRelative=this.morphTargetsRelative);const e=this.groups;e.length>0&&(A.data.groups=JSON.parse(JSON.stringify(e)));const E=this.boundingSphere;return E!==null&&(A.data.boundingSphere={center:E.center.toArray(),radius:E.radius}),A}clone(){return new this.constructor().copy(this)}copy(A){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const I={};this.name=A.name;const g=A.index;g!==null&&this.setIndex(g.clone(I));const C=A.attributes;for(const a in C){const r=C[a];this.setAttribute(a,r.clone(I))}const i=A.morphAttributes;for(const a in i){const r=[],D=i[a];for(let h=0,S=D.length;h0){const C=I[g[0]];if(C!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,e=C.length;i(A.far-A.near)**2))&&(Yu.copy(i).invert(),oo.copy(A.ray).applyMatrix4(Yu),!(g.boundingBox!==null&&oo.intersectsBox(g.boundingBox)===!1)&&this._computeIntersections(A,I,oo)))}_computeIntersections(A,I,g){let C;const i=this.geometry,e=this.material,E=i.index,n=i.attributes.position,a=i.attributes.uv,r=i.attributes.uv1,D=i.attributes.normal,h=i.groups,S=i.drawRange;if(E!==null)if(Array.isArray(e))for(let G=0,U=h.length;GI.far?null:{distance:a,point:ND.clone(),object:B}}function JD(B,A,I,g,C,i,e,E,n,a){B.getVertexPosition(E,MD),B.getVertexPosition(n,UD),B.getVertexPosition(a,pD);const r=EK(B,A,I,g,MD,UD,pD,mu);if(r){const D=new Z;Ui.getBarycoord(mu,MD,UD,pD,D),C&&(r.uv=Ui.getInterpolatedAttribute(C,E,n,a,D,new PA)),i&&(r.uv1=Ui.getInterpolatedAttribute(i,E,n,a,D,new PA)),e&&(r.normal=Ui.getInterpolatedAttribute(e,E,n,a,D,new Z),r.normal.dot(g.direction)>0&&r.normal.multiplyScalar(-1));const h={a:E,b:n,c:a,normal:new Z,materialIndex:0};Ui.getNormal(MD,UD,pD,h.normal),r.face=h,r.barycoord=D}return r}class In extends tg{constructor(A=1,I=1,g=1,C=1,i=1,e=1){super(),this.type="BoxGeometry",this.parameters={width:A,height:I,depth:g,widthSegments:C,heightSegments:i,depthSegments:e};const E=this;C=Math.floor(C),i=Math.floor(i),e=Math.floor(e);const n=[],a=[],r=[],D=[];let h=0,S=0;G("z","y","x",-1,-1,g,I,A,e,i,0),G("z","y","x",1,-1,g,I,-A,e,i,1),G("x","z","y",1,1,A,g,I,C,e,2),G("x","z","y",1,-1,A,g,-I,C,e,3),G("x","y","z",1,-1,A,I,g,C,i,4),G("x","y","z",-1,-1,A,I,-g,C,i,5),this.setIndex(n),this.setAttribute("position",new xI(a,3)),this.setAttribute("normal",new xI(r,3)),this.setAttribute("uv",new xI(D,2));function G(U,k,y,d,J,F,v,m,x,T,L){const Y=F/x,b=v/T,IA=F/2,CA=v/2,nA=m/2,uA=x+1,EA=T+1;let pA=0,V=0;const aA=new Z;for(let BA=0;BA0?1:-1,r.push(aA.x,aA.y,aA.z),D.push(oA/x),D.push(1-BA/T),pA+=1}}for(let BA=0;BA>8&255]+vB[B>>16&255]+vB[B>>24&255]+"-"+vB[A&255]+vB[A>>8&255]+"-"+vB[A>>16&15|64]+vB[A>>24&255]+"-"+vB[I&63|128]+vB[I>>8&255]+"-"+vB[I>>16&255]+vB[I>>24&255]+vB[g&255]+vB[g>>8&255]+vB[g>>16&255]+vB[g>>24&255]).toLowerCase()}function NC(B,A,I){return Math.max(A,Math.min(I,B))}function Vy(B,A){return(B%A+A)%A}function GJ(B,A,I,g,C){return g+(B-A)*(C-g)/(I-A)}function kJ(B,A,I){return B!==A?(I-B)/(A-B):0}function Nr(B,A,I){return(1-I)*B+I*A}function uJ(B,A,I,g){return Nr(B,A,1-Math.exp(-I*g))}function MJ(B,A=1){return A-Math.abs(Vy(B,A*2)-A)}function UJ(B,A,I){return B<=A?0:B>=I?1:(B=(B-A)/(I-A),B*B*(3-2*B))}function pJ(B,A,I){return B<=A?0:B>=I?1:(B=(B-A)/(I-A),B*B*B*(B*(B*6-15)+10))}function dJ(B,A){return B+Math.floor(Math.random()*(A-B+1))}function NJ(B,A){return B+Math.random()*(A-B)}function JJ(B){return B*(.5-Math.random())}function KJ(B){B!==void 0&&(wu=B);let A=wu+=1831565813;return A=Math.imul(A^A>>>15,A|1),A^=A+Math.imul(A^A>>>7,A|61),((A^A>>>14)>>>0)/4294967296}function FJ(B){return B*mo}function fJ(B){return B*xs}function RJ(B){return(B&B-1)===0&&B!==0}function LJ(B){return Math.pow(2,Math.ceil(Math.log(B)/Math.LN2))}function YJ(B){return Math.pow(2,Math.floor(Math.log(B)/Math.LN2))}function qJ(B,A,I,g,C){const i=Math.cos,e=Math.sin,E=i(I/2),n=e(I/2),a=i((A+g)/2),l=e((A+g)/2),D=i((A-g)/2),h=e((A-g)/2),S=i((g-A)/2),G=e((g-A)/2);switch(C){case"XYX":B.set(E*l,n*D,n*h,E*a);break;case"YZY":B.set(n*h,E*l,n*D,E*a);break;case"ZXZ":B.set(n*D,n*h,E*l,E*a);break;case"XZX":B.set(E*l,n*G,n*S,E*a);break;case"YXY":B.set(n*S,E*l,n*G,E*a);break;case"ZYZ":B.set(n*G,n*S,E*l,E*a);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+C)}}function ti(B,A){switch(A.constructor){case Float32Array:return B;case Uint32Array:return B/4294967295;case Uint16Array:return B/65535;case Uint8Array:return B/255;case Int32Array:return Math.max(B/2147483647,-1);case Int16Array:return Math.max(B/32767,-1);case Int8Array:return Math.max(B/127,-1);default:throw new Error("Invalid component type.")}}function Dg(B,A){switch(A.constructor){case Float32Array:return B;case Uint32Array:return Math.round(B*4294967295);case Uint16Array:return Math.round(B*65535);case Uint8Array:return Math.round(B*255);case Int32Array:return Math.round(B*2147483647);case Int16Array:return Math.round(B*32767);case Int8Array:return Math.round(B*127);default:throw new Error("Invalid component type.")}}const dc={DEG2RAD:mo,RAD2DEG:xs,generateUUID:Oi,clamp:NC,euclideanModulo:Vy,mapLinear:GJ,inverseLerp:kJ,lerp:Nr,damp:uJ,pingpong:MJ,smoothstep:UJ,smootherstep:pJ,randInt:dJ,randFloat:NJ,randFloatSpread:JJ,seededRandom:KJ,degToRad:FJ,radToDeg:fJ,isPowerOfTwo:RJ,ceilPowerOfTwo:LJ,floorPowerOfTwo:YJ,setQuaternionFromProperEuler:qJ,normalize:Dg,denormalize:ti};class PA{constructor(A=0,I=0){PA.prototype.isVector2=!0,this.x=A,this.y=I}get width(){return this.x}set width(A){this.x=A}get height(){return this.y}set height(A){this.y=A}set(A,I){return this.x=A,this.y=I,this}setScalar(A){return this.x=A,this.y=A,this}setX(A){return this.x=A,this}setY(A){return this.y=A,this}setComponent(A,I){switch(A){case 0:this.x=I;break;case 1:this.y=I;break;default:throw new Error("index is out of range: "+A)}return this}getComponent(A){switch(A){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+A)}}clone(){return new this.constructor(this.x,this.y)}copy(A){return this.x=A.x,this.y=A.y,this}add(A){return this.x+=A.x,this.y+=A.y,this}addScalar(A){return this.x+=A,this.y+=A,this}addVectors(A,I){return this.x=A.x+I.x,this.y=A.y+I.y,this}addScaledVector(A,I){return this.x+=A.x*I,this.y+=A.y*I,this}sub(A){return this.x-=A.x,this.y-=A.y,this}subScalar(A){return this.x-=A,this.y-=A,this}subVectors(A,I){return this.x=A.x-I.x,this.y=A.y-I.y,this}multiply(A){return this.x*=A.x,this.y*=A.y,this}multiplyScalar(A){return this.x*=A,this.y*=A,this}divide(A){return this.x/=A.x,this.y/=A.y,this}divideScalar(A){return this.multiplyScalar(1/A)}applyMatrix3(A){const I=this.x,g=this.y,C=A.elements;return this.x=C[0]*I+C[3]*g+C[6],this.y=C[1]*I+C[4]*g+C[7],this}min(A){return this.x=Math.min(this.x,A.x),this.y=Math.min(this.y,A.y),this}max(A){return this.x=Math.max(this.x,A.x),this.y=Math.max(this.y,A.y),this}clamp(A,I){return this.x=Math.max(A.x,Math.min(I.x,this.x)),this.y=Math.max(A.y,Math.min(I.y,this.y)),this}clampScalar(A,I){return this.x=Math.max(A,Math.min(I,this.x)),this.y=Math.max(A,Math.min(I,this.y)),this}clampLength(A,I){const g=this.length();return this.divideScalar(g||1).multiplyScalar(Math.max(A,Math.min(I,g)))}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(A){return this.x*A.x+this.y*A.y}cross(A){return this.x*A.y-this.y*A.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(A){const I=Math.sqrt(this.lengthSq()*A.lengthSq());if(I===0)return Math.PI/2;const g=this.dot(A)/I;return Math.acos(NC(g,-1,1))}distanceTo(A){return Math.sqrt(this.distanceToSquared(A))}distanceToSquared(A){const I=this.x-A.x,g=this.y-A.y;return I*I+g*g}manhattanDistanceTo(A){return Math.abs(this.x-A.x)+Math.abs(this.y-A.y)}setLength(A){return this.normalize().multiplyScalar(A)}lerp(A,I){return this.x+=(A.x-this.x)*I,this.y+=(A.y-this.y)*I,this}lerpVectors(A,I,g){return this.x=A.x+(I.x-A.x)*g,this.y=A.y+(I.y-A.y)*g,this}equals(A){return A.x===this.x&&A.y===this.y}fromArray(A,I=0){return this.x=A[I],this.y=A[I+1],this}toArray(A=[],I=0){return A[I]=this.x,A[I+1]=this.y,A}fromBufferAttribute(A,I){return this.x=A.getX(I),this.y=A.getY(I),this}rotateAround(A,I){const g=Math.cos(I),C=Math.sin(I),i=this.x-A.x,e=this.y-A.y;return this.x=i*g-e*C+A.x,this.y=i*C+e*g+A.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class sg{constructor(A,I,g,C,i,e,E,n,a){sg.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],A!==void 0&&this.set(A,I,g,C,i,e,E,n,a)}set(A,I,g,C,i,e,E,n,a){const l=this.elements;return l[0]=A,l[1]=C,l[2]=E,l[3]=I,l[4]=i,l[5]=n,l[6]=g,l[7]=e,l[8]=a,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(A){const I=this.elements,g=A.elements;return I[0]=g[0],I[1]=g[1],I[2]=g[2],I[3]=g[3],I[4]=g[4],I[5]=g[5],I[6]=g[6],I[7]=g[7],I[8]=g[8],this}extractBasis(A,I,g){return A.setFromMatrix3Column(this,0),I.setFromMatrix3Column(this,1),g.setFromMatrix3Column(this,2),this}setFromMatrix4(A){const I=A.elements;return this.set(I[0],I[4],I[8],I[1],I[5],I[9],I[2],I[6],I[10]),this}multiply(A){return this.multiplyMatrices(this,A)}premultiply(A){return this.multiplyMatrices(A,this)}multiplyMatrices(A,I){const g=A.elements,C=I.elements,i=this.elements,e=g[0],E=g[3],n=g[6],a=g[1],l=g[4],D=g[7],h=g[2],S=g[5],G=g[8],U=C[0],k=C[3],y=C[6],d=C[1],J=C[4],F=C[7],v=C[2],m=C[5],x=C[8];return i[0]=e*U+E*d+n*v,i[3]=e*k+E*J+n*m,i[6]=e*y+E*F+n*x,i[1]=a*U+l*d+D*v,i[4]=a*k+l*J+D*m,i[7]=a*y+l*F+D*x,i[2]=h*U+S*d+G*v,i[5]=h*k+S*J+G*m,i[8]=h*y+S*F+G*x,this}multiplyScalar(A){const I=this.elements;return I[0]*=A,I[3]*=A,I[6]*=A,I[1]*=A,I[4]*=A,I[7]*=A,I[2]*=A,I[5]*=A,I[8]*=A,this}determinant(){const A=this.elements,I=A[0],g=A[1],C=A[2],i=A[3],e=A[4],E=A[5],n=A[6],a=A[7],l=A[8];return I*e*l-I*E*a-g*i*l+g*E*n+C*i*a-C*e*n}invert(){const A=this.elements,I=A[0],g=A[1],C=A[2],i=A[3],e=A[4],E=A[5],n=A[6],a=A[7],l=A[8],D=l*e-E*a,h=E*n-l*i,S=a*i-e*n,G=I*D+g*h+C*S;if(G===0)return this.set(0,0,0,0,0,0,0,0,0);const U=1/G;return A[0]=D*U,A[1]=(C*a-l*g)*U,A[2]=(E*g-C*e)*U,A[3]=h*U,A[4]=(l*I-C*n)*U,A[5]=(C*i-E*I)*U,A[6]=S*U,A[7]=(g*n-a*I)*U,A[8]=(e*I-g*i)*U,this}transpose(){let A;const I=this.elements;return A=I[1],I[1]=I[3],I[3]=A,A=I[2],I[2]=I[6],I[6]=A,A=I[5],I[5]=I[7],I[7]=A,this}getNormalMatrix(A){return this.setFromMatrix4(A).invert().transpose()}transposeIntoArray(A){const I=this.elements;return A[0]=I[0],A[1]=I[3],A[2]=I[6],A[3]=I[1],A[4]=I[4],A[5]=I[7],A[6]=I[2],A[7]=I[5],A[8]=I[8],this}setUvTransform(A,I,g,C,i,e,E){const n=Math.cos(i),a=Math.sin(i);return this.set(g*n,g*a,-g*(n*e+a*E)+e+A,-C*a,C*n,-C*(-a*e+n*E)+E+I,0,0,1),this}scale(A,I){return this.premultiply(Cw.makeScale(A,I)),this}rotate(A){return this.premultiply(Cw.makeRotation(-A)),this}translate(A,I){return this.premultiply(Cw.makeTranslation(A,I)),this}makeTranslation(A,I){return A.isVector2?this.set(1,0,A.x,0,1,A.y,0,0,1):this.set(1,0,A,0,1,I,0,0,1),this}makeRotation(A){const I=Math.cos(A),g=Math.sin(A);return this.set(I,-g,0,g,I,0,0,0,1),this}makeScale(A,I){return this.set(A,0,0,0,I,0,0,0,1),this}equals(A){const I=this.elements,g=A.elements;for(let C=0;C<9;C++)if(I[C]!==g[C])return!1;return!0}fromArray(A,I=0){for(let g=0;g<9;g++)this.elements[g]=A[g+I];return this}toArray(A=[],I=0){const g=this.elements;return A[I]=g[0],A[I+1]=g[1],A[I+2]=g[2],A[I+3]=g[3],A[I+4]=g[4],A[I+5]=g[5],A[I+6]=g[6],A[I+7]=g[7],A[I+8]=g[8],A}clone(){return new this.constructor().fromArray(this.elements)}}const Cw=new sg;function Ip(B){for(let A=B.length-1;A>=0;--A)if(B[A]>=65535)return!0;return!1}const mJ={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function ps(B,A){return new mJ[B](A)}function mr(B){return document.createElementNS("http://www.w3.org/1999/xhtml",B)}function gp(){const B=mr("canvas");return B.style.display="block",B}const yu={};function lr(B){B in yu||(yu[B]=!0,console.warn(B))}function HJ(B,A,I){return new Promise(function(g,C){function i(){switch(B.clientWaitSync(A,B.SYNC_FLUSH_COMMANDS_BIT,0)){case B.WAIT_FAILED:C();break;case B.TIMEOUT_EXPIRED:setTimeout(i,I);break;default:g()}}setTimeout(i,I)})}function TJ(B){const A=B.elements;A[2]=.5*A[2]+.5*A[3],A[6]=.5*A[6]+.5*A[7],A[10]=.5*A[10]+.5*A[11],A[14]=.5*A[14]+.5*A[15]}function xJ(B){const A=B.elements;A[11]===-1?(A[10]=-A[10]-1,A[14]=-A[14]):(A[10]=-A[10],A[14]=-A[14]+1)}const Kg={enabled:!0,workingColorSpace:ce,spaces:{},convert:function(B,A,I){return this.enabled===!1||A===I||!A||!I||(this.spaces[A].transfer===Xg&&(B.r=sE(B.r),B.g=sE(B.g),B.b=sE(B.b)),this.spaces[A].primaries!==this.spaces[I].primaries&&(B.applyMatrix3(this.spaces[A].toXYZ),B.applyMatrix3(this.spaces[I].fromXYZ)),this.spaces[I].transfer===Xg&&(B.r=Fs(B.r),B.g=Fs(B.g),B.b=Fs(B.b))),B},fromWorkingColorSpace:function(B,A){return this.convert(B,this.workingColorSpace,A)},toWorkingColorSpace:function(B,A){return this.convert(B,A,this.workingColorSpace)},getPrimaries:function(B){return this.spaces[B].primaries},getTransfer:function(B){return B===eE?il:this.spaces[B].transfer},getLuminanceCoefficients:function(B,A=this.workingColorSpace){return B.fromArray(this.spaces[A].luminanceCoefficients)},define:function(B){Object.assign(this.spaces,B)},_getMatrix:function(B,A,I){return B.copy(this.spaces[A].toXYZ).multiply(this.spaces[I].fromXYZ)},_getDrawingBufferColorSpace:function(B){return this.spaces[B].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(B=this.workingColorSpace){return this.spaces[B].workingColorSpaceConfig.unpackColorSpace}};function sE(B){return B<.04045?B*.0773993808:Math.pow(B*.9478672986+.0521327014,2.4)}function Fs(B){return B<.0031308?B*12.92:1.055*Math.pow(B,.41666)-.055}const Gu=[.64,.33,.3,.6,.15,.06],ku=[.2126,.7152,.0722],uu=[.3127,.329],Mu=new sg().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Uu=new sg().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);Kg.define({[ce]:{primaries:Gu,whitePoint:uu,transfer:il,toXYZ:Mu,fromXYZ:Uu,luminanceCoefficients:ku,workingColorSpaceConfig:{unpackColorSpace:DB},outputColorSpaceConfig:{drawingBufferColorSpace:DB}},[DB]:{primaries:Gu,whitePoint:uu,transfer:Xg,toXYZ:Mu,fromXYZ:Uu,luminanceCoefficients:ku,outputColorSpaceConfig:{drawingBufferColorSpace:DB}}});let is;class Cp{static getDataURL(A){if(/^data:/i.test(A.src)||typeof HTMLCanvasElement>"u")return A.src;let I;if(A instanceof HTMLCanvasElement)I=A;else{is===void 0&&(is=mr("canvas")),is.width=A.width,is.height=A.height;const g=is.getContext("2d");A instanceof ImageData?g.putImageData(A,0,0):g.drawImage(A,0,0,A.width,A.height),I=is}return I.width>2048||I.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",A),I.toDataURL("image/jpeg",.6)):I.toDataURL("image/png")}static sRGBToLinear(A){if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap){const I=mr("canvas");I.width=A.width,I.height=A.height;const g=I.getContext("2d");g.drawImage(A,0,0,A.width,A.height);const C=g.getImageData(0,0,A.width,A.height),i=C.data;for(let e=0;e0&&(g.userData=this.userData),I||(A.textures[this.uuid]=g),g}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(A){if(this.mapping!==lt)return A;if(A.applyMatrix3(this.matrix),A.x<0||A.x>1)switch(this.wrapS){case De:A.x=A.x-Math.floor(A.x);break;case LC:A.x=A.x<0?0:1;break;case qs:Math.abs(Math.floor(A.x)%2)===1?A.x=Math.ceil(A.x)-A.x:A.x=A.x-Math.floor(A.x);break}if(A.y<0||A.y>1)switch(this.wrapT){case De:A.y=A.y-Math.floor(A.y);break;case LC:A.y=A.y<0?0:1;break;case qs:Math.abs(Math.floor(A.y)%2)===1?A.y=Math.ceil(A.y)-A.y:A.y=A.y-Math.floor(A.y);break}return this.flipY&&(A.y=1-A.y),A}set needsUpdate(A){A===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(A){A===!0&&this.pmremVersion++}}Vg.DEFAULT_IMAGE=null;Vg.DEFAULT_MAPPING=lt;Vg.DEFAULT_ANISOTROPY=1;class Hg{constructor(A=0,I=0,g=0,C=1){Hg.prototype.isVector4=!0,this.x=A,this.y=I,this.z=g,this.w=C}get width(){return this.z}set width(A){this.z=A}get height(){return this.w}set height(A){this.w=A}set(A,I,g,C){return this.x=A,this.y=I,this.z=g,this.w=C,this}setScalar(A){return this.x=A,this.y=A,this.z=A,this.w=A,this}setX(A){return this.x=A,this}setY(A){return this.y=A,this}setZ(A){return this.z=A,this}setW(A){return this.w=A,this}setComponent(A,I){switch(A){case 0:this.x=I;break;case 1:this.y=I;break;case 2:this.z=I;break;case 3:this.w=I;break;default:throw new Error("index is out of range: "+A)}return this}getComponent(A){switch(A){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: "+A)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(A){return this.x=A.x,this.y=A.y,this.z=A.z,this.w=A.w!==void 0?A.w:1,this}add(A){return this.x+=A.x,this.y+=A.y,this.z+=A.z,this.w+=A.w,this}addScalar(A){return this.x+=A,this.y+=A,this.z+=A,this.w+=A,this}addVectors(A,I){return this.x=A.x+I.x,this.y=A.y+I.y,this.z=A.z+I.z,this.w=A.w+I.w,this}addScaledVector(A,I){return this.x+=A.x*I,this.y+=A.y*I,this.z+=A.z*I,this.w+=A.w*I,this}sub(A){return this.x-=A.x,this.y-=A.y,this.z-=A.z,this.w-=A.w,this}subScalar(A){return this.x-=A,this.y-=A,this.z-=A,this.w-=A,this}subVectors(A,I){return this.x=A.x-I.x,this.y=A.y-I.y,this.z=A.z-I.z,this.w=A.w-I.w,this}multiply(A){return this.x*=A.x,this.y*=A.y,this.z*=A.z,this.w*=A.w,this}multiplyScalar(A){return this.x*=A,this.y*=A,this.z*=A,this.w*=A,this}applyMatrix4(A){const I=this.x,g=this.y,C=this.z,i=this.w,e=A.elements;return this.x=e[0]*I+e[4]*g+e[8]*C+e[12]*i,this.y=e[1]*I+e[5]*g+e[9]*C+e[13]*i,this.z=e[2]*I+e[6]*g+e[10]*C+e[14]*i,this.w=e[3]*I+e[7]*g+e[11]*C+e[15]*i,this}divide(A){return this.x/=A.x,this.y/=A.y,this.z/=A.z,this.w/=A.w,this}divideScalar(A){return this.multiplyScalar(1/A)}setAxisAngleFromQuaternion(A){this.w=2*Math.acos(A.w);const I=Math.sqrt(1-A.w*A.w);return I<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=A.x/I,this.y=A.y/I,this.z=A.z/I),this}setAxisAngleFromRotationMatrix(A){let I,g,C,i;const n=A.elements,a=n[0],l=n[4],D=n[8],h=n[1],S=n[5],G=n[9],U=n[2],k=n[6],y=n[10];if(Math.abs(l-h)<.01&&Math.abs(D-U)<.01&&Math.abs(G-k)<.01){if(Math.abs(l+h)<.1&&Math.abs(D+U)<.1&&Math.abs(G+k)<.1&&Math.abs(a+S+y-3)<.1)return this.set(1,0,0,0),this;I=Math.PI;const J=(a+1)/2,F=(S+1)/2,v=(y+1)/2,m=(l+h)/4,x=(D+U)/4,T=(G+k)/4;return J>F&&J>v?J<.01?(g=0,C=.707106781,i=.707106781):(g=Math.sqrt(J),C=m/g,i=x/g):F>v?F<.01?(g=.707106781,C=0,i=.707106781):(C=Math.sqrt(F),g=m/C,i=T/C):v<.01?(g=.707106781,C=.707106781,i=0):(i=Math.sqrt(v),g=x/i,C=T/i),this.set(g,C,i,I),this}let d=Math.sqrt((k-G)*(k-G)+(D-U)*(D-U)+(h-l)*(h-l));return Math.abs(d)<.001&&(d=1),this.x=(k-G)/d,this.y=(D-U)/d,this.z=(h-l)/d,this.w=Math.acos((a+S+y-1)/2),this}setFromMatrixPosition(A){const I=A.elements;return this.x=I[12],this.y=I[13],this.z=I[14],this.w=I[15],this}min(A){return this.x=Math.min(this.x,A.x),this.y=Math.min(this.y,A.y),this.z=Math.min(this.z,A.z),this.w=Math.min(this.w,A.w),this}max(A){return this.x=Math.max(this.x,A.x),this.y=Math.max(this.y,A.y),this.z=Math.max(this.z,A.z),this.w=Math.max(this.w,A.w),this}clamp(A,I){return this.x=Math.max(A.x,Math.min(I.x,this.x)),this.y=Math.max(A.y,Math.min(I.y,this.y)),this.z=Math.max(A.z,Math.min(I.z,this.z)),this.w=Math.max(A.w,Math.min(I.w,this.w)),this}clampScalar(A,I){return this.x=Math.max(A,Math.min(I,this.x)),this.y=Math.max(A,Math.min(I,this.y)),this.z=Math.max(A,Math.min(I,this.z)),this.w=Math.max(A,Math.min(I,this.w)),this}clampLength(A,I){const g=this.length();return this.divideScalar(g||1).multiplyScalar(Math.max(A,Math.min(I,g)))}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(A){return this.x*A.x+this.y*A.y+this.z*A.z+this.w*A.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(A){return this.normalize().multiplyScalar(A)}lerp(A,I){return this.x+=(A.x-this.x)*I,this.y+=(A.y-this.y)*I,this.z+=(A.z-this.z)*I,this.w+=(A.w-this.w)*I,this}lerpVectors(A,I,g){return this.x=A.x+(I.x-A.x)*g,this.y=A.y+(I.y-A.y)*g,this.z=A.z+(I.z-A.z)*g,this.w=A.w+(I.w-A.w)*g,this}equals(A){return A.x===this.x&&A.y===this.y&&A.z===this.z&&A.w===this.w}fromArray(A,I=0){return this.x=A[I],this.y=A[I+1],this.z=A[I+2],this.w=A[I+3],this}toArray(A=[],I=0){return A[I]=this.x,A[I+1]=this.y,A[I+2]=this.z,A[I+3]=this.w,A}fromBufferAttribute(A,I){return this.x=A.getX(I),this.y=A.getY(I),this.z=A.getZ(I),this.w=A.getW(I),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 Bp extends Se{constructor(A=1,I=1,g={}){super(),this.isRenderTarget=!0,this.width=A,this.height=I,this.depth=1,this.scissor=new Hg(0,0,A,I),this.scissorTest=!1,this.viewport=new Hg(0,0,A,I);const C={width:A,height:I,depth:1};g=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Og,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},g);const i=new Vg(C,g.mapping,g.wrapS,g.wrapT,g.magFilter,g.minFilter,g.format,g.type,g.anisotropy,g.colorSpace);i.flipY=!1,i.generateMipmaps=g.generateMipmaps,i.internalFormat=g.internalFormat,this.textures=[];const e=g.count;for(let E=0;E=0?1:-1,J=1-y*y;if(J>Number.EPSILON){const v=Math.sqrt(J),m=Math.atan2(v,y*d);k=Math.sin(k*m)/v,E=Math.sin(E*m)/v}const F=E*d;if(n=n*k+h*F,a=a*k+S*F,l=l*k+G*F,D=D*k+U*F,k===1-E){const v=1/Math.sqrt(n*n+a*a+l*l+D*D);n*=v,a*=v,l*=v,D*=v}}A[I]=n,A[I+1]=a,A[I+2]=l,A[I+3]=D}static multiplyQuaternionsFlat(A,I,g,C,i,e){const E=g[C],n=g[C+1],a=g[C+2],l=g[C+3],D=i[e],h=i[e+1],S=i[e+2],G=i[e+3];return A[I]=E*G+l*D+n*S-a*h,A[I+1]=n*G+l*h+a*D-E*S,A[I+2]=a*G+l*S+E*h-n*D,A[I+3]=l*G-E*D-n*h-a*S,A}get x(){return this._x}set x(A){this._x=A,this._onChangeCallback()}get y(){return this._y}set y(A){this._y=A,this._onChangeCallback()}get z(){return this._z}set z(A){this._z=A,this._onChangeCallback()}get w(){return this._w}set w(A){this._w=A,this._onChangeCallback()}set(A,I,g,C){return this._x=A,this._y=I,this._z=g,this._w=C,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(A){return this._x=A.x,this._y=A.y,this._z=A.z,this._w=A.w,this._onChangeCallback(),this}setFromEuler(A,I=!0){const g=A._x,C=A._y,i=A._z,e=A._order,E=Math.cos,n=Math.sin,a=E(g/2),l=E(C/2),D=E(i/2),h=n(g/2),S=n(C/2),G=n(i/2);switch(e){case"XYZ":this._x=h*l*D+a*S*G,this._y=a*S*D-h*l*G,this._z=a*l*G+h*S*D,this._w=a*l*D-h*S*G;break;case"YXZ":this._x=h*l*D+a*S*G,this._y=a*S*D-h*l*G,this._z=a*l*G-h*S*D,this._w=a*l*D+h*S*G;break;case"ZXY":this._x=h*l*D-a*S*G,this._y=a*S*D+h*l*G,this._z=a*l*G+h*S*D,this._w=a*l*D-h*S*G;break;case"ZYX":this._x=h*l*D-a*S*G,this._y=a*S*D+h*l*G,this._z=a*l*G-h*S*D,this._w=a*l*D+h*S*G;break;case"YZX":this._x=h*l*D+a*S*G,this._y=a*S*D+h*l*G,this._z=a*l*G-h*S*D,this._w=a*l*D-h*S*G;break;case"XZY":this._x=h*l*D-a*S*G,this._y=a*S*D-h*l*G,this._z=a*l*G+h*S*D,this._w=a*l*D+h*S*G;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+e)}return I===!0&&this._onChangeCallback(),this}setFromAxisAngle(A,I){const g=I/2,C=Math.sin(g);return this._x=A.x*C,this._y=A.y*C,this._z=A.z*C,this._w=Math.cos(g),this._onChangeCallback(),this}setFromRotationMatrix(A){const I=A.elements,g=I[0],C=I[4],i=I[8],e=I[1],E=I[5],n=I[9],a=I[2],l=I[6],D=I[10],h=g+E+D;if(h>0){const S=.5/Math.sqrt(h+1);this._w=.25/S,this._x=(l-n)*S,this._y=(i-a)*S,this._z=(e-C)*S}else if(g>E&&g>D){const S=2*Math.sqrt(1+g-E-D);this._w=(l-n)/S,this._x=.25*S,this._y=(C+e)/S,this._z=(i+a)/S}else if(E>D){const S=2*Math.sqrt(1+E-g-D);this._w=(i-a)/S,this._x=(C+e)/S,this._y=.25*S,this._z=(n+l)/S}else{const S=2*Math.sqrt(1+D-g-E);this._w=(e-C)/S,this._x=(i+a)/S,this._y=(n+l)/S,this._z=.25*S}return this._onChangeCallback(),this}setFromUnitVectors(A,I){let g=A.dot(I)+1;return gMath.abs(A.z)?(this._x=-A.y,this._y=A.x,this._z=0,this._w=g):(this._x=0,this._y=-A.z,this._z=A.y,this._w=g)):(this._x=A.y*I.z-A.z*I.y,this._y=A.z*I.x-A.x*I.z,this._z=A.x*I.y-A.y*I.x,this._w=g),this.normalize()}angleTo(A){return 2*Math.acos(Math.abs(NC(this.dot(A),-1,1)))}rotateTowards(A,I){const g=this.angleTo(A);if(g===0)return this;const C=Math.min(1,I/g);return this.slerp(A,C),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(A){return this._x*A._x+this._y*A._y+this._z*A._z+this._w*A._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 A=this.length();return A===0?(this._x=0,this._y=0,this._z=0,this._w=1):(A=1/A,this._x=this._x*A,this._y=this._y*A,this._z=this._z*A,this._w=this._w*A),this._onChangeCallback(),this}multiply(A){return this.multiplyQuaternions(this,A)}premultiply(A){return this.multiplyQuaternions(A,this)}multiplyQuaternions(A,I){const g=A._x,C=A._y,i=A._z,e=A._w,E=I._x,n=I._y,a=I._z,l=I._w;return this._x=g*l+e*E+C*a-i*n,this._y=C*l+e*n+i*E-g*a,this._z=i*l+e*a+g*n-C*E,this._w=e*l-g*E-C*n-i*a,this._onChangeCallback(),this}slerp(A,I){if(I===0)return this;if(I===1)return this.copy(A);const g=this._x,C=this._y,i=this._z,e=this._w;let E=e*A._w+g*A._x+C*A._y+i*A._z;if(E<0?(this._w=-A._w,this._x=-A._x,this._y=-A._y,this._z=-A._z,E=-E):this.copy(A),E>=1)return this._w=e,this._x=g,this._y=C,this._z=i,this;const n=1-E*E;if(n<=Number.EPSILON){const S=1-I;return this._w=S*e+I*this._w,this._x=S*g+I*this._x,this._y=S*C+I*this._y,this._z=S*i+I*this._z,this.normalize(),this}const a=Math.sqrt(n),l=Math.atan2(a,E),D=Math.sin((1-I)*l)/a,h=Math.sin(I*l)/a;return this._w=e*D+this._w*h,this._x=g*D+this._x*h,this._y=C*D+this._y*h,this._z=i*D+this._z*h,this._onChangeCallback(),this}slerpQuaternions(A,I,g){return this.copy(A).slerp(I,g)}random(){const A=2*Math.PI*Math.random(),I=2*Math.PI*Math.random(),g=Math.random(),C=Math.sqrt(1-g),i=Math.sqrt(g);return this.set(C*Math.sin(A),C*Math.cos(A),i*Math.sin(I),i*Math.cos(I))}equals(A){return A._x===this._x&&A._y===this._y&&A._z===this._z&&A._w===this._w}fromArray(A,I=0){return this._x=A[I],this._y=A[I+1],this._z=A[I+2],this._w=A[I+3],this._onChangeCallback(),this}toArray(A=[],I=0){return A[I]=this._x,A[I+1]=this._y,A[I+2]=this._z,A[I+3]=this._w,A}fromBufferAttribute(A,I){return this._x=A.getX(I),this._y=A.getY(I),this._z=A.getZ(I),this._w=A.getW(I),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(A){return this._onChangeCallback=A,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Z{constructor(A=0,I=0,g=0){Z.prototype.isVector3=!0,this.x=A,this.y=I,this.z=g}set(A,I,g){return g===void 0&&(g=this.z),this.x=A,this.y=I,this.z=g,this}setScalar(A){return this.x=A,this.y=A,this.z=A,this}setX(A){return this.x=A,this}setY(A){return this.y=A,this}setZ(A){return this.z=A,this}setComponent(A,I){switch(A){case 0:this.x=I;break;case 1:this.y=I;break;case 2:this.z=I;break;default:throw new Error("index is out of range: "+A)}return this}getComponent(A){switch(A){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+A)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(A){return this.x=A.x,this.y=A.y,this.z=A.z,this}add(A){return this.x+=A.x,this.y+=A.y,this.z+=A.z,this}addScalar(A){return this.x+=A,this.y+=A,this.z+=A,this}addVectors(A,I){return this.x=A.x+I.x,this.y=A.y+I.y,this.z=A.z+I.z,this}addScaledVector(A,I){return this.x+=A.x*I,this.y+=A.y*I,this.z+=A.z*I,this}sub(A){return this.x-=A.x,this.y-=A.y,this.z-=A.z,this}subScalar(A){return this.x-=A,this.y-=A,this.z-=A,this}subVectors(A,I){return this.x=A.x-I.x,this.y=A.y-I.y,this.z=A.z-I.z,this}multiply(A){return this.x*=A.x,this.y*=A.y,this.z*=A.z,this}multiplyScalar(A){return this.x*=A,this.y*=A,this.z*=A,this}multiplyVectors(A,I){return this.x=A.x*I.x,this.y=A.y*I.y,this.z=A.z*I.z,this}applyEuler(A){return this.applyQuaternion(pu.setFromEuler(A))}applyAxisAngle(A,I){return this.applyQuaternion(pu.setFromAxisAngle(A,I))}applyMatrix3(A){const I=this.x,g=this.y,C=this.z,i=A.elements;return this.x=i[0]*I+i[3]*g+i[6]*C,this.y=i[1]*I+i[4]*g+i[7]*C,this.z=i[2]*I+i[5]*g+i[8]*C,this}applyNormalMatrix(A){return this.applyMatrix3(A).normalize()}applyMatrix4(A){const I=this.x,g=this.y,C=this.z,i=A.elements,e=1/(i[3]*I+i[7]*g+i[11]*C+i[15]);return this.x=(i[0]*I+i[4]*g+i[8]*C+i[12])*e,this.y=(i[1]*I+i[5]*g+i[9]*C+i[13])*e,this.z=(i[2]*I+i[6]*g+i[10]*C+i[14])*e,this}applyQuaternion(A){const I=this.x,g=this.y,C=this.z,i=A.x,e=A.y,E=A.z,n=A.w,a=2*(e*C-E*g),l=2*(E*I-i*C),D=2*(i*g-e*I);return this.x=I+n*a+e*D-E*l,this.y=g+n*l+E*a-i*D,this.z=C+n*D+i*l-e*a,this}project(A){return this.applyMatrix4(A.matrixWorldInverse).applyMatrix4(A.projectionMatrix)}unproject(A){return this.applyMatrix4(A.projectionMatrixInverse).applyMatrix4(A.matrixWorld)}transformDirection(A){const I=this.x,g=this.y,C=this.z,i=A.elements;return this.x=i[0]*I+i[4]*g+i[8]*C,this.y=i[1]*I+i[5]*g+i[9]*C,this.z=i[2]*I+i[6]*g+i[10]*C,this.normalize()}divide(A){return this.x/=A.x,this.y/=A.y,this.z/=A.z,this}divideScalar(A){return this.multiplyScalar(1/A)}min(A){return this.x=Math.min(this.x,A.x),this.y=Math.min(this.y,A.y),this.z=Math.min(this.z,A.z),this}max(A){return this.x=Math.max(this.x,A.x),this.y=Math.max(this.y,A.y),this.z=Math.max(this.z,A.z),this}clamp(A,I){return this.x=Math.max(A.x,Math.min(I.x,this.x)),this.y=Math.max(A.y,Math.min(I.y,this.y)),this.z=Math.max(A.z,Math.min(I.z,this.z)),this}clampScalar(A,I){return this.x=Math.max(A,Math.min(I,this.x)),this.y=Math.max(A,Math.min(I,this.y)),this.z=Math.max(A,Math.min(I,this.z)),this}clampLength(A,I){const g=this.length();return this.divideScalar(g||1).multiplyScalar(Math.max(A,Math.min(I,g)))}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(A){return this.x*A.x+this.y*A.y+this.z*A.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(A){return this.normalize().multiplyScalar(A)}lerp(A,I){return this.x+=(A.x-this.x)*I,this.y+=(A.y-this.y)*I,this.z+=(A.z-this.z)*I,this}lerpVectors(A,I,g){return this.x=A.x+(I.x-A.x)*g,this.y=A.y+(I.y-A.y)*g,this.z=A.z+(I.z-A.z)*g,this}cross(A){return this.crossVectors(this,A)}crossVectors(A,I){const g=A.x,C=A.y,i=A.z,e=I.x,E=I.y,n=I.z;return this.x=C*n-i*E,this.y=i*e-g*n,this.z=g*E-C*e,this}projectOnVector(A){const I=A.lengthSq();if(I===0)return this.set(0,0,0);const g=A.dot(this)/I;return this.copy(A).multiplyScalar(g)}projectOnPlane(A){return iw.copy(this).projectOnVector(A),this.sub(iw)}reflect(A){return this.sub(iw.copy(A).multiplyScalar(2*this.dot(A)))}angleTo(A){const I=Math.sqrt(this.lengthSq()*A.lengthSq());if(I===0)return Math.PI/2;const g=this.dot(A)/I;return Math.acos(NC(g,-1,1))}distanceTo(A){return Math.sqrt(this.distanceToSquared(A))}distanceToSquared(A){const I=this.x-A.x,g=this.y-A.y,C=this.z-A.z;return I*I+g*g+C*C}manhattanDistanceTo(A){return Math.abs(this.x-A.x)+Math.abs(this.y-A.y)+Math.abs(this.z-A.z)}setFromSpherical(A){return this.setFromSphericalCoords(A.radius,A.phi,A.theta)}setFromSphericalCoords(A,I,g){const C=Math.sin(I)*A;return this.x=C*Math.sin(g),this.y=Math.cos(I)*A,this.z=C*Math.cos(g),this}setFromCylindrical(A){return this.setFromCylindricalCoords(A.radius,A.theta,A.y)}setFromCylindricalCoords(A,I,g){return this.x=A*Math.sin(I),this.y=g,this.z=A*Math.cos(I),this}setFromMatrixPosition(A){const I=A.elements;return this.x=I[12],this.y=I[13],this.z=I[14],this}setFromMatrixScale(A){const I=this.setFromMatrixColumn(A,0).length(),g=this.setFromMatrixColumn(A,1).length(),C=this.setFromMatrixColumn(A,2).length();return this.x=I,this.y=g,this.z=C,this}setFromMatrixColumn(A,I){return this.fromArray(A.elements,I*4)}setFromMatrix3Column(A,I){return this.fromArray(A.elements,I*3)}setFromEuler(A){return this.x=A._x,this.y=A._y,this.z=A._z,this}setFromColor(A){return this.x=A.r,this.y=A.g,this.z=A.b,this}equals(A){return A.x===this.x&&A.y===this.y&&A.z===this.z}fromArray(A,I=0){return this.x=A[I],this.y=A[I+1],this.z=A[I+2],this}toArray(A=[],I=0){return A[I]=this.x,A[I+1]=this.y,A[I+2]=this.z,A}fromBufferAttribute(A,I){return this.x=A.getX(I),this.y=A.getY(I),this.z=A.getZ(I),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const A=Math.random()*Math.PI*2,I=Math.random()*2-1,g=Math.sqrt(1-I*I);return this.x=g*Math.cos(A),this.y=I,this.z=g*Math.sin(A),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const iw=new Z,pu=new BB;class _B{constructor(A=new Z(1/0,1/0,1/0),I=new Z(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=A,this.max=I}set(A,I){return this.min.copy(A),this.max.copy(I),this}setFromArray(A){this.makeEmpty();for(let I=0,g=A.length;I=this.min.x&&A.x<=this.max.x&&A.y>=this.min.y&&A.y<=this.max.y&&A.z>=this.min.z&&A.z<=this.max.z}containsBox(A){return this.min.x<=A.min.x&&A.max.x<=this.max.x&&this.min.y<=A.min.y&&A.max.y<=this.max.y&&this.min.z<=A.min.z&&A.max.z<=this.max.z}getParameter(A,I){return I.set((A.x-this.min.x)/(this.max.x-this.min.x),(A.y-this.min.y)/(this.max.y-this.min.y),(A.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(A){return A.max.x>=this.min.x&&A.min.x<=this.max.x&&A.max.y>=this.min.y&&A.min.y<=this.max.y&&A.max.z>=this.min.z&&A.min.z<=this.max.z}intersectsSphere(A){return this.clampPoint(A.center,LQ),LQ.distanceToSquared(A.center)<=A.radius*A.radius}intersectsPlane(A){let I,g;return A.normal.x>0?(I=A.normal.x*this.min.x,g=A.normal.x*this.max.x):(I=A.normal.x*this.max.x,g=A.normal.x*this.min.x),A.normal.y>0?(I+=A.normal.y*this.min.y,g+=A.normal.y*this.max.y):(I+=A.normal.y*this.max.y,g+=A.normal.y*this.min.y),A.normal.z>0?(I+=A.normal.z*this.min.z,g+=A.normal.z*this.max.z):(I+=A.normal.z*this.max.z,g+=A.normal.z*this.min.z),I<=-A.constant&&g>=-A.constant}intersectsTriangle(A){if(this.isEmpty())return!1;this.getCenter(za),DD.subVectors(this.max,za),Qs.subVectors(A.a,za),es.subVectors(A.b,za),Es.subVectors(A.c,za),zE.subVectors(es,Qs),$E.subVectors(Es,es),Eo.subVectors(Qs,Es);let I=[0,-zE.z,zE.y,0,-$E.z,$E.y,0,-Eo.z,Eo.y,zE.z,0,-zE.x,$E.z,0,-$E.x,Eo.z,0,-Eo.x,-zE.y,zE.x,0,-$E.y,$E.x,0,-Eo.y,Eo.x,0];return!Qw(I,Qs,es,Es,DD)||(I=[1,0,0,0,1,0,0,0,1],!Qw(I,Qs,es,Es,DD))?!1:(hD.crossVectors(zE,$E),I=[hD.x,hD.y,hD.z],Qw(I,Qs,es,Es,DD))}clampPoint(A,I){return I.copy(A).clamp(this.min,this.max)}distanceToPoint(A){return this.clampPoint(A,LQ).distanceTo(A)}getBoundingSphere(A){return this.isEmpty()?A.makeEmpty():(this.getCenter(A.center),A.radius=this.getSize(LQ).length()*.5),A}intersect(A){return this.min.max(A.min),this.max.min(A.max),this.isEmpty()&&this.makeEmpty(),this}union(A){return this.min.min(A.min),this.max.max(A.max),this}applyMatrix4(A){return this.isEmpty()?this:($e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(A),$e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(A),$e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(A),$e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(A),$e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(A),$e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(A),$e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(A),$e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(A),this.setFromPoints($e),this)}translate(A){return this.min.add(A),this.max.add(A),this}equals(A){return A.min.equals(this.min)&&A.max.equals(this.max)}}const $e=[new Z,new Z,new Z,new Z,new Z,new Z,new Z,new Z],LQ=new Z,lD=new _B,Qs=new Z,es=new Z,Es=new Z,zE=new Z,$E=new Z,Eo=new Z,za=new Z,DD=new Z,hD=new Z,to=new Z;function Qw(B,A,I,g,C){for(let i=0,e=B.length-3;i<=e;i+=3){to.fromArray(B,i);const E=C.x*Math.abs(to.x)+C.y*Math.abs(to.y)+C.z*Math.abs(to.z),n=A.dot(to),a=I.dot(to),l=g.dot(to);if(Math.max(-Math.max(n,a,l),Math.min(n,a,l))>E)return!1}return!0}const ZJ=new _B,$a=new Z,ew=new Z;class FB{constructor(A=new Z,I=-1){this.isSphere=!0,this.center=A,this.radius=I}set(A,I){return this.center.copy(A),this.radius=I,this}setFromPoints(A,I){const g=this.center;I!==void 0?g.copy(I):ZJ.setFromPoints(A).getCenter(g);let C=0;for(let i=0,e=A.length;ithis.radius*this.radius&&(I.sub(this.center).normalize(),I.multiplyScalar(this.radius).add(this.center)),I}getBoundingBox(A){return this.isEmpty()?(A.makeEmpty(),A):(A.set(this.center,this.center),A.expandByScalar(this.radius),A)}applyMatrix4(A){return this.center.applyMatrix4(A),this.radius=this.radius*A.getMaxScaleOnAxis(),this}translate(A){return this.center.add(A),this}expandByPoint(A){if(this.isEmpty())return this.center.copy(A),this.radius=0,this;$a.subVectors(A,this.center);const I=$a.lengthSq();if(I>this.radius*this.radius){const g=Math.sqrt(I),C=(g-this.radius)*.5;this.center.addScaledVector($a,C/g),this.radius+=C}return this}union(A){return A.isEmpty()?this:this.isEmpty()?(this.copy(A),this):(this.center.equals(A.center)===!0?this.radius=Math.max(this.radius,A.radius):(ew.subVectors(A.center,this.center).setLength(A.radius),this.expandByPoint($a.copy(A.center).add(ew)),this.expandByPoint($a.copy(A.center).sub(ew))),this)}equals(A){return A.center.equals(this.center)&&A.radius===this.radius}clone(){return new this.constructor().copy(this)}}const AE=new Z,Ew=new Z,cD=new Z,At=new Z,tw=new Z,SD=new Z,ow=new Z;class js{constructor(A=new Z,I=new Z(0,0,-1)){this.origin=A,this.direction=I}set(A,I){return this.origin.copy(A),this.direction.copy(I),this}copy(A){return this.origin.copy(A.origin),this.direction.copy(A.direction),this}at(A,I){return I.copy(this.origin).addScaledVector(this.direction,A)}lookAt(A){return this.direction.copy(A).sub(this.origin).normalize(),this}recast(A){return this.origin.copy(this.at(A,AE)),this}closestPointToPoint(A,I){I.subVectors(A,this.origin);const g=I.dot(this.direction);return g<0?I.copy(this.origin):I.copy(this.origin).addScaledVector(this.direction,g)}distanceToPoint(A){return Math.sqrt(this.distanceSqToPoint(A))}distanceSqToPoint(A){const I=AE.subVectors(A,this.origin).dot(this.direction);return I<0?this.origin.distanceToSquared(A):(AE.copy(this.origin).addScaledVector(this.direction,I),AE.distanceToSquared(A))}distanceSqToSegment(A,I,g,C){Ew.copy(A).add(I).multiplyScalar(.5),cD.copy(I).sub(A).normalize(),At.copy(this.origin).sub(Ew);const i=A.distanceTo(I)*.5,e=-this.direction.dot(cD),E=At.dot(this.direction),n=-At.dot(cD),a=At.lengthSq(),l=Math.abs(1-e*e);let D,h,S,G;if(l>0)if(D=e*n-E,h=e*E-n,G=i*l,D>=0)if(h>=-G)if(h<=G){const U=1/l;D*=U,h*=U,S=D*(D+e*h+2*E)+h*(e*D+h+2*n)+a}else h=i,D=Math.max(0,-(e*h+E)),S=-D*D+h*(h+2*n)+a;else h=-i,D=Math.max(0,-(e*h+E)),S=-D*D+h*(h+2*n)+a;else h<=-G?(D=Math.max(0,-(-e*i+E)),h=D>0?-i:Math.min(Math.max(-i,-n),i),S=-D*D+h*(h+2*n)+a):h<=G?(D=0,h=Math.min(Math.max(-i,-n),i),S=h*(h+2*n)+a):(D=Math.max(0,-(e*i+E)),h=D>0?i:Math.min(Math.max(-i,-n),i),S=-D*D+h*(h+2*n)+a);else h=e>0?-i:i,D=Math.max(0,-(e*h+E)),S=-D*D+h*(h+2*n)+a;return g&&g.copy(this.origin).addScaledVector(this.direction,D),C&&C.copy(Ew).addScaledVector(cD,h),S}intersectSphere(A,I){AE.subVectors(A.center,this.origin);const g=AE.dot(this.direction),C=AE.dot(AE)-g*g,i=A.radius*A.radius;if(C>i)return null;const e=Math.sqrt(i-C),E=g-e,n=g+e;return n<0?null:E<0?this.at(n,I):this.at(E,I)}intersectsSphere(A){return this.distanceSqToPoint(A.center)<=A.radius*A.radius}distanceToPlane(A){const I=A.normal.dot(this.direction);if(I===0)return A.distanceToPoint(this.origin)===0?0:null;const g=-(this.origin.dot(A.normal)+A.constant)/I;return g>=0?g:null}intersectPlane(A,I){const g=this.distanceToPlane(A);return g===null?null:this.at(g,I)}intersectsPlane(A){const I=A.distanceToPoint(this.origin);return I===0||A.normal.dot(this.direction)*I<0}intersectBox(A,I){let g,C,i,e,E,n;const a=1/this.direction.x,l=1/this.direction.y,D=1/this.direction.z,h=this.origin;return a>=0?(g=(A.min.x-h.x)*a,C=(A.max.x-h.x)*a):(g=(A.max.x-h.x)*a,C=(A.min.x-h.x)*a),l>=0?(i=(A.min.y-h.y)*l,e=(A.max.y-h.y)*l):(i=(A.max.y-h.y)*l,e=(A.min.y-h.y)*l),g>e||i>C||((i>g||isNaN(g))&&(g=i),(e=0?(E=(A.min.z-h.z)*D,n=(A.max.z-h.z)*D):(E=(A.max.z-h.z)*D,n=(A.min.z-h.z)*D),g>n||E>C)||((E>g||g!==g)&&(g=E),(n=0?g:C,I)}intersectsBox(A){return this.intersectBox(A,AE)!==null}intersectTriangle(A,I,g,C,i){tw.subVectors(I,A),SD.subVectors(g,A),ow.crossVectors(tw,SD);let e=this.direction.dot(ow),E;if(e>0){if(C)return null;E=1}else if(e<0)E=-1,e=-e;else return null;At.subVectors(this.origin,A);const n=E*this.direction.dot(SD.crossVectors(At,SD));if(n<0)return null;const a=E*this.direction.dot(tw.cross(At));if(a<0||n+a>e)return null;const l=-E*At.dot(ow);return l<0?null:this.at(l/e,i)}applyMatrix4(A){return this.origin.applyMatrix4(A),this.direction.transformDirection(A),this}equals(A){return A.origin.equals(this.origin)&&A.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class VI{constructor(A,I,g,C,i,e,E,n,a,l,D,h,S,G,U,k){VI.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],A!==void 0&&this.set(A,I,g,C,i,e,E,n,a,l,D,h,S,G,U,k)}set(A,I,g,C,i,e,E,n,a,l,D,h,S,G,U,k){const y=this.elements;return y[0]=A,y[4]=I,y[8]=g,y[12]=C,y[1]=i,y[5]=e,y[9]=E,y[13]=n,y[2]=a,y[6]=l,y[10]=D,y[14]=h,y[3]=S,y[7]=G,y[11]=U,y[15]=k,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 VI().fromArray(this.elements)}copy(A){const I=this.elements,g=A.elements;return I[0]=g[0],I[1]=g[1],I[2]=g[2],I[3]=g[3],I[4]=g[4],I[5]=g[5],I[6]=g[6],I[7]=g[7],I[8]=g[8],I[9]=g[9],I[10]=g[10],I[11]=g[11],I[12]=g[12],I[13]=g[13],I[14]=g[14],I[15]=g[15],this}copyPosition(A){const I=this.elements,g=A.elements;return I[12]=g[12],I[13]=g[13],I[14]=g[14],this}setFromMatrix3(A){const I=A.elements;return this.set(I[0],I[3],I[6],0,I[1],I[4],I[7],0,I[2],I[5],I[8],0,0,0,0,1),this}extractBasis(A,I,g){return A.setFromMatrixColumn(this,0),I.setFromMatrixColumn(this,1),g.setFromMatrixColumn(this,2),this}makeBasis(A,I,g){return this.set(A.x,I.x,g.x,0,A.y,I.y,g.y,0,A.z,I.z,g.z,0,0,0,0,1),this}extractRotation(A){const I=this.elements,g=A.elements,C=1/ts.setFromMatrixColumn(A,0).length(),i=1/ts.setFromMatrixColumn(A,1).length(),e=1/ts.setFromMatrixColumn(A,2).length();return I[0]=g[0]*C,I[1]=g[1]*C,I[2]=g[2]*C,I[3]=0,I[4]=g[4]*i,I[5]=g[5]*i,I[6]=g[6]*i,I[7]=0,I[8]=g[8]*e,I[9]=g[9]*e,I[10]=g[10]*e,I[11]=0,I[12]=0,I[13]=0,I[14]=0,I[15]=1,this}makeRotationFromEuler(A){const I=this.elements,g=A.x,C=A.y,i=A.z,e=Math.cos(g),E=Math.sin(g),n=Math.cos(C),a=Math.sin(C),l=Math.cos(i),D=Math.sin(i);if(A.order==="XYZ"){const h=e*l,S=e*D,G=E*l,U=E*D;I[0]=n*l,I[4]=-n*D,I[8]=a,I[1]=S+G*a,I[5]=h-U*a,I[9]=-E*n,I[2]=U-h*a,I[6]=G+S*a,I[10]=e*n}else if(A.order==="YXZ"){const h=n*l,S=n*D,G=a*l,U=a*D;I[0]=h+U*E,I[4]=G*E-S,I[8]=e*a,I[1]=e*D,I[5]=e*l,I[9]=-E,I[2]=S*E-G,I[6]=U+h*E,I[10]=e*n}else if(A.order==="ZXY"){const h=n*l,S=n*D,G=a*l,U=a*D;I[0]=h-U*E,I[4]=-e*D,I[8]=G+S*E,I[1]=S+G*E,I[5]=e*l,I[9]=U-h*E,I[2]=-e*a,I[6]=E,I[10]=e*n}else if(A.order==="ZYX"){const h=e*l,S=e*D,G=E*l,U=E*D;I[0]=n*l,I[4]=G*a-S,I[8]=h*a+U,I[1]=n*D,I[5]=U*a+h,I[9]=S*a-G,I[2]=-a,I[6]=E*n,I[10]=e*n}else if(A.order==="YZX"){const h=e*n,S=e*a,G=E*n,U=E*a;I[0]=n*l,I[4]=U-h*D,I[8]=G*D+S,I[1]=D,I[5]=e*l,I[9]=-E*l,I[2]=-a*l,I[6]=S*D+G,I[10]=h-U*D}else if(A.order==="XZY"){const h=e*n,S=e*a,G=E*n,U=E*a;I[0]=n*l,I[4]=-D,I[8]=a*l,I[1]=h*D+U,I[5]=e*l,I[9]=S*D-G,I[2]=G*D-S,I[6]=E*l,I[10]=U*D+h}return I[3]=0,I[7]=0,I[11]=0,I[12]=0,I[13]=0,I[14]=0,I[15]=1,this}makeRotationFromQuaternion(A){return this.compose(PJ,A,WJ)}lookAt(A,I,g){const C=this.elements;return Hi.subVectors(A,I),Hi.lengthSq()===0&&(Hi.z=1),Hi.normalize(),It.crossVectors(g,Hi),It.lengthSq()===0&&(Math.abs(g.z)===1?Hi.x+=1e-4:Hi.z+=1e-4,Hi.normalize(),It.crossVectors(g,Hi)),It.normalize(),wD.crossVectors(Hi,It),C[0]=It.x,C[4]=wD.x,C[8]=Hi.x,C[1]=It.y,C[5]=wD.y,C[9]=Hi.y,C[2]=It.z,C[6]=wD.z,C[10]=Hi.z,this}multiply(A){return this.multiplyMatrices(this,A)}premultiply(A){return this.multiplyMatrices(A,this)}multiplyMatrices(A,I){const g=A.elements,C=I.elements,i=this.elements,e=g[0],E=g[4],n=g[8],a=g[12],l=g[1],D=g[5],h=g[9],S=g[13],G=g[2],U=g[6],k=g[10],y=g[14],d=g[3],J=g[7],F=g[11],v=g[15],m=C[0],x=C[4],T=C[8],L=C[12],Y=C[1],b=C[5],IA=C[9],CA=C[13],nA=C[2],uA=C[6],EA=C[10],pA=C[14],V=C[3],aA=C[7],BA=C[11],P=C[15];return i[0]=e*m+E*Y+n*nA+a*V,i[4]=e*x+E*b+n*uA+a*aA,i[8]=e*T+E*IA+n*EA+a*BA,i[12]=e*L+E*CA+n*pA+a*P,i[1]=l*m+D*Y+h*nA+S*V,i[5]=l*x+D*b+h*uA+S*aA,i[9]=l*T+D*IA+h*EA+S*BA,i[13]=l*L+D*CA+h*pA+S*P,i[2]=G*m+U*Y+k*nA+y*V,i[6]=G*x+U*b+k*uA+y*aA,i[10]=G*T+U*IA+k*EA+y*BA,i[14]=G*L+U*CA+k*pA+y*P,i[3]=d*m+J*Y+F*nA+v*V,i[7]=d*x+J*b+F*uA+v*aA,i[11]=d*T+J*IA+F*EA+v*BA,i[15]=d*L+J*CA+F*pA+v*P,this}multiplyScalar(A){const I=this.elements;return I[0]*=A,I[4]*=A,I[8]*=A,I[12]*=A,I[1]*=A,I[5]*=A,I[9]*=A,I[13]*=A,I[2]*=A,I[6]*=A,I[10]*=A,I[14]*=A,I[3]*=A,I[7]*=A,I[11]*=A,I[15]*=A,this}determinant(){const A=this.elements,I=A[0],g=A[4],C=A[8],i=A[12],e=A[1],E=A[5],n=A[9],a=A[13],l=A[2],D=A[6],h=A[10],S=A[14],G=A[3],U=A[7],k=A[11],y=A[15];return G*(+i*n*D-C*a*D-i*E*h+g*a*h+C*E*S-g*n*S)+U*(+I*n*S-I*a*h+i*e*h-C*e*S+C*a*l-i*n*l)+k*(+I*a*D-I*E*S-i*e*D+g*e*S+i*E*l-g*a*l)+y*(-C*E*l-I*n*D+I*E*h+C*e*D-g*e*h+g*n*l)}transpose(){const A=this.elements;let I;return I=A[1],A[1]=A[4],A[4]=I,I=A[2],A[2]=A[8],A[8]=I,I=A[6],A[6]=A[9],A[9]=I,I=A[3],A[3]=A[12],A[12]=I,I=A[7],A[7]=A[13],A[13]=I,I=A[11],A[11]=A[14],A[14]=I,this}setPosition(A,I,g){const C=this.elements;return A.isVector3?(C[12]=A.x,C[13]=A.y,C[14]=A.z):(C[12]=A,C[13]=I,C[14]=g),this}invert(){const A=this.elements,I=A[0],g=A[1],C=A[2],i=A[3],e=A[4],E=A[5],n=A[6],a=A[7],l=A[8],D=A[9],h=A[10],S=A[11],G=A[12],U=A[13],k=A[14],y=A[15],d=D*k*a-U*h*a+U*n*S-E*k*S-D*n*y+E*h*y,J=G*h*a-l*k*a-G*n*S+e*k*S+l*n*y-e*h*y,F=l*U*a-G*D*a+G*E*S-e*U*S-l*E*y+e*D*y,v=G*D*n-l*U*n-G*E*h+e*U*h+l*E*k-e*D*k,m=I*d+g*J+C*F+i*v;if(m===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const x=1/m;return A[0]=d*x,A[1]=(U*h*i-D*k*i-U*C*S+g*k*S+D*C*y-g*h*y)*x,A[2]=(E*k*i-U*n*i+U*C*a-g*k*a-E*C*y+g*n*y)*x,A[3]=(D*n*i-E*h*i-D*C*a+g*h*a+E*C*S-g*n*S)*x,A[4]=J*x,A[5]=(l*k*i-G*h*i+G*C*S-I*k*S-l*C*y+I*h*y)*x,A[6]=(G*n*i-e*k*i-G*C*a+I*k*a+e*C*y-I*n*y)*x,A[7]=(e*h*i-l*n*i+l*C*a-I*h*a-e*C*S+I*n*S)*x,A[8]=F*x,A[9]=(G*D*i-l*U*i-G*g*S+I*U*S+l*g*y-I*D*y)*x,A[10]=(e*U*i-G*E*i+G*g*a-I*U*a-e*g*y+I*E*y)*x,A[11]=(l*E*i-e*D*i-l*g*a+I*D*a+e*g*S-I*E*S)*x,A[12]=v*x,A[13]=(l*U*C-G*D*C+G*g*h-I*U*h-l*g*k+I*D*k)*x,A[14]=(G*E*C-e*U*C-G*g*n+I*U*n+e*g*k-I*E*k)*x,A[15]=(e*D*C-l*E*C+l*g*n-I*D*n-e*g*h+I*E*h)*x,this}scale(A){const I=this.elements,g=A.x,C=A.y,i=A.z;return I[0]*=g,I[4]*=C,I[8]*=i,I[1]*=g,I[5]*=C,I[9]*=i,I[2]*=g,I[6]*=C,I[10]*=i,I[3]*=g,I[7]*=C,I[11]*=i,this}getMaxScaleOnAxis(){const A=this.elements,I=A[0]*A[0]+A[1]*A[1]+A[2]*A[2],g=A[4]*A[4]+A[5]*A[5]+A[6]*A[6],C=A[8]*A[8]+A[9]*A[9]+A[10]*A[10];return Math.sqrt(Math.max(I,g,C))}makeTranslation(A,I,g){return A.isVector3?this.set(1,0,0,A.x,0,1,0,A.y,0,0,1,A.z,0,0,0,1):this.set(1,0,0,A,0,1,0,I,0,0,1,g,0,0,0,1),this}makeRotationX(A){const I=Math.cos(A),g=Math.sin(A);return this.set(1,0,0,0,0,I,-g,0,0,g,I,0,0,0,0,1),this}makeRotationY(A){const I=Math.cos(A),g=Math.sin(A);return this.set(I,0,g,0,0,1,0,0,-g,0,I,0,0,0,0,1),this}makeRotationZ(A){const I=Math.cos(A),g=Math.sin(A);return this.set(I,-g,0,0,g,I,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(A,I){const g=Math.cos(I),C=Math.sin(I),i=1-g,e=A.x,E=A.y,n=A.z,a=i*e,l=i*E;return this.set(a*e+g,a*E-C*n,a*n+C*E,0,a*E+C*n,l*E+g,l*n-C*e,0,a*n-C*E,l*n+C*e,i*n*n+g,0,0,0,0,1),this}makeScale(A,I,g){return this.set(A,0,0,0,0,I,0,0,0,0,g,0,0,0,0,1),this}makeShear(A,I,g,C,i,e){return this.set(1,g,i,0,A,1,e,0,I,C,1,0,0,0,0,1),this}compose(A,I,g){const C=this.elements,i=I._x,e=I._y,E=I._z,n=I._w,a=i+i,l=e+e,D=E+E,h=i*a,S=i*l,G=i*D,U=e*l,k=e*D,y=E*D,d=n*a,J=n*l,F=n*D,v=g.x,m=g.y,x=g.z;return C[0]=(1-(U+y))*v,C[1]=(S+F)*v,C[2]=(G-J)*v,C[3]=0,C[4]=(S-F)*m,C[5]=(1-(h+y))*m,C[6]=(k+d)*m,C[7]=0,C[8]=(G+J)*x,C[9]=(k-d)*x,C[10]=(1-(h+U))*x,C[11]=0,C[12]=A.x,C[13]=A.y,C[14]=A.z,C[15]=1,this}decompose(A,I,g){const C=this.elements;let i=ts.set(C[0],C[1],C[2]).length();const e=ts.set(C[4],C[5],C[6]).length(),E=ts.set(C[8],C[9],C[10]).length();this.determinant()<0&&(i=-i),A.x=C[12],A.y=C[13],A.z=C[14],YQ.copy(this);const a=1/i,l=1/e,D=1/E;return YQ.elements[0]*=a,YQ.elements[1]*=a,YQ.elements[2]*=a,YQ.elements[4]*=l,YQ.elements[5]*=l,YQ.elements[6]*=l,YQ.elements[8]*=D,YQ.elements[9]*=D,YQ.elements[10]*=D,I.setFromRotationMatrix(YQ),g.x=i,g.y=e,g.z=E,this}makePerspective(A,I,g,C,i,e,E=oe){const n=this.elements,a=2*i/(I-A),l=2*i/(g-C),D=(I+A)/(I-A),h=(g+C)/(g-C);let S,G;if(E===oe)S=-(e+i)/(e-i),G=-2*e*i/(e-i);else if(E===qr)S=-e/(e-i),G=-e*i/(e-i);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+E);return n[0]=a,n[4]=0,n[8]=D,n[12]=0,n[1]=0,n[5]=l,n[9]=h,n[13]=0,n[2]=0,n[6]=0,n[10]=S,n[14]=G,n[3]=0,n[7]=0,n[11]=-1,n[15]=0,this}makeOrthographic(A,I,g,C,i,e,E=oe){const n=this.elements,a=1/(I-A),l=1/(g-C),D=1/(e-i),h=(I+A)*a,S=(g+C)*l;let G,U;if(E===oe)G=(e+i)*D,U=-2*D;else if(E===qr)G=i*D,U=-1*D;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+E);return n[0]=2*a,n[4]=0,n[8]=0,n[12]=-h,n[1]=0,n[5]=2*l,n[9]=0,n[13]=-S,n[2]=0,n[6]=0,n[10]=U,n[14]=-G,n[3]=0,n[7]=0,n[11]=0,n[15]=1,this}equals(A){const I=this.elements,g=A.elements;for(let C=0;C<16;C++)if(I[C]!==g[C])return!1;return!0}fromArray(A,I=0){for(let g=0;g<16;g++)this.elements[g]=A[g+I];return this}toArray(A=[],I=0){const g=this.elements;return A[I]=g[0],A[I+1]=g[1],A[I+2]=g[2],A[I+3]=g[3],A[I+4]=g[4],A[I+5]=g[5],A[I+6]=g[6],A[I+7]=g[7],A[I+8]=g[8],A[I+9]=g[9],A[I+10]=g[10],A[I+11]=g[11],A[I+12]=g[12],A[I+13]=g[13],A[I+14]=g[14],A[I+15]=g[15],A}}const ts=new Z,YQ=new VI,PJ=new Z(0,0,0),WJ=new Z(1,1,1),It=new Z,wD=new Z,Hi=new Z,du=new VI,Nu=new BB;class ZB{constructor(A=0,I=0,g=0,C=ZB.DEFAULT_ORDER){this.isEuler=!0,this._x=A,this._y=I,this._z=g,this._order=C}get x(){return this._x}set x(A){this._x=A,this._onChangeCallback()}get y(){return this._y}set y(A){this._y=A,this._onChangeCallback()}get z(){return this._z}set z(A){this._z=A,this._onChangeCallback()}get order(){return this._order}set order(A){this._order=A,this._onChangeCallback()}set(A,I,g,C=this._order){return this._x=A,this._y=I,this._z=g,this._order=C,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(A){return this._x=A._x,this._y=A._y,this._z=A._z,this._order=A._order,this._onChangeCallback(),this}setFromRotationMatrix(A,I=this._order,g=!0){const C=A.elements,i=C[0],e=C[4],E=C[8],n=C[1],a=C[5],l=C[9],D=C[2],h=C[6],S=C[10];switch(I){case"XYZ":this._y=Math.asin(NC(E,-1,1)),Math.abs(E)<.9999999?(this._x=Math.atan2(-l,S),this._z=Math.atan2(-e,i)):(this._x=Math.atan2(h,a),this._z=0);break;case"YXZ":this._x=Math.asin(-NC(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(E,S),this._z=Math.atan2(n,a)):(this._y=Math.atan2(-D,i),this._z=0);break;case"ZXY":this._x=Math.asin(NC(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-D,S),this._z=Math.atan2(-e,a)):(this._y=0,this._z=Math.atan2(n,i));break;case"ZYX":this._y=Math.asin(-NC(D,-1,1)),Math.abs(D)<.9999999?(this._x=Math.atan2(h,S),this._z=Math.atan2(n,i)):(this._x=0,this._z=Math.atan2(-e,a));break;case"YZX":this._z=Math.asin(NC(n,-1,1)),Math.abs(n)<.9999999?(this._x=Math.atan2(-l,a),this._y=Math.atan2(-D,i)):(this._x=0,this._y=Math.atan2(E,S));break;case"XZY":this._z=Math.asin(-NC(e,-1,1)),Math.abs(e)<.9999999?(this._x=Math.atan2(h,a),this._y=Math.atan2(E,i)):(this._x=Math.atan2(-l,S),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+I)}return this._order=I,g===!0&&this._onChangeCallback(),this}setFromQuaternion(A,I,g){return du.makeRotationFromQuaternion(A),this.setFromRotationMatrix(du,I,g)}setFromVector3(A,I=this._order){return this.set(A.x,A.y,A.z,I)}reorder(A){return Nu.setFromEuler(this),this.setFromQuaternion(Nu,A)}equals(A){return A._x===this._x&&A._y===this._y&&A._z===this._z&&A._order===this._order}fromArray(A){return this._x=A[0],this._y=A[1],this._z=A[2],A[3]!==void 0&&(this._order=A[3]),this._onChangeCallback(),this}toArray(A=[],I=0){return A[I]=this._x,A[I+1]=this._y,A[I+2]=this._z,A[I+3]=this._order,A}_onChange(A){return this._onChangeCallback=A,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}ZB.DEFAULT_ORDER="XYZ";class Ho{constructor(){this.mask=1}set(A){this.mask=(1<>>0}enable(A){this.mask|=1<1){for(let I=0;I1){for(let g=0;g0&&(C.userData=this.userData),C.layers=this.layers.mask,C.matrix=this.matrix.toArray(),C.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(C.matrixAutoUpdate=!1),this.isInstancedMesh&&(C.type="InstancedMesh",C.count=this.count,C.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(C.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(C.type="BatchedMesh",C.perObjectFrustumCulled=this.perObjectFrustumCulled,C.sortObjects=this.sortObjects,C.drawRanges=this._drawRanges,C.reservedRanges=this._reservedRanges,C.visibility=this._visibility,C.active=this._active,C.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()})),C.maxInstanceCount=this._maxInstanceCount,C.maxVertexCount=this._maxVertexCount,C.maxIndexCount=this._maxIndexCount,C.geometryInitialized=this._geometryInitialized,C.geometryCount=this._geometryCount,C.matricesTexture=this._matricesTexture.toJSON(A),this._colorsTexture!==null&&(C.colorsTexture=this._colorsTexture.toJSON(A)),this.boundingSphere!==null&&(C.boundingSphere={center:C.boundingSphere.center.toArray(),radius:C.boundingSphere.radius}),this.boundingBox!==null&&(C.boundingBox={min:C.boundingBox.min.toArray(),max:C.boundingBox.max.toArray()}));function i(E,n){return E[n.uuid]===void 0&&(E[n.uuid]=n.toJSON(A)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?C.background=this.background.toJSON():this.background.isTexture&&(C.background=this.background.toJSON(A).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(C.environment=this.environment.toJSON(A).uuid);else if(this.isMesh||this.isLine||this.isPoints){C.geometry=i(A.geometries,this.geometry);const E=this.geometry.parameters;if(E!==void 0&&E.shapes!==void 0){const n=E.shapes;if(Array.isArray(n))for(let a=0,l=n.length;a0){C.children=[];for(let E=0;E0){C.animations=[];for(let E=0;E0&&(g.geometries=E),n.length>0&&(g.materials=n),a.length>0&&(g.textures=a),l.length>0&&(g.images=l),D.length>0&&(g.shapes=D),h.length>0&&(g.skeletons=h),S.length>0&&(g.animations=S),G.length>0&&(g.nodes=G)}return g.object=C,g;function e(E){const n=[];for(const a in E){const l=E[a];delete l.metadata,n.push(l)}return n}}clone(A){return new this.constructor().copy(this,A)}copy(A,I=!0){if(this.name=A.name,this.up.copy(A.up),this.position.copy(A.position),this.rotation.order=A.rotation.order,this.quaternion.copy(A.quaternion),this.scale.copy(A.scale),this.matrix.copy(A.matrix),this.matrixWorld.copy(A.matrixWorld),this.matrixAutoUpdate=A.matrixAutoUpdate,this.matrixWorldAutoUpdate=A.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=A.matrixWorldNeedsUpdate,this.layers.mask=A.layers.mask,this.visible=A.visible,this.castShadow=A.castShadow,this.receiveShadow=A.receiveShadow,this.frustumCulled=A.frustumCulled,this.renderOrder=A.renderOrder,this.animations=A.animations.slice(),this.userData=JSON.parse(JSON.stringify(A.userData)),I===!0)for(let g=0;g0?C.multiplyScalar(1/Math.sqrt(i)):C.set(0,0,0)}static getBarycoord(A,I,g,C,i){qQ.subVectors(C,I),gE.subVectors(g,I),sw.subVectors(A,I);const e=qQ.dot(qQ),E=qQ.dot(gE),n=qQ.dot(sw),a=gE.dot(gE),l=gE.dot(sw),D=e*a-E*E;if(D===0)return i.set(0,0,0),null;const h=1/D,S=(a*n-E*l)*h,G=(e*l-E*n)*h;return i.set(1-S-G,G,S)}static containsPoint(A,I,g,C){return this.getBarycoord(A,I,g,C,CE)===null?!1:CE.x>=0&&CE.y>=0&&CE.x+CE.y<=1}static getInterpolation(A,I,g,C,i,e,E,n){return this.getBarycoord(A,I,g,C,CE)===null?(n.x=0,n.y=0,"z"in n&&(n.z=0),"w"in n&&(n.w=0),null):(n.setScalar(0),n.addScaledVector(i,CE.x),n.addScaledVector(e,CE.y),n.addScaledVector(E,CE.z),n)}static getInterpolatedAttribute(A,I,g,C,i,e){return Dw.setScalar(0),hw.setScalar(0),cw.setScalar(0),Dw.fromBufferAttribute(A,I),hw.fromBufferAttribute(A,g),cw.fromBufferAttribute(A,C),e.setScalar(0),e.addScaledVector(Dw,i.x),e.addScaledVector(hw,i.y),e.addScaledVector(cw,i.z),e}static isFrontFacing(A,I,g,C){return qQ.subVectors(g,I),gE.subVectors(A,I),qQ.cross(gE).dot(C)<0}set(A,I,g){return this.a.copy(A),this.b.copy(I),this.c.copy(g),this}setFromPointsAndIndices(A,I,g,C){return this.a.copy(A[I]),this.b.copy(A[g]),this.c.copy(A[C]),this}setFromAttributeAndIndices(A,I,g,C){return this.a.fromBufferAttribute(A,I),this.b.fromBufferAttribute(A,g),this.c.fromBufferAttribute(A,C),this}clone(){return new this.constructor().copy(this)}copy(A){return this.a.copy(A.a),this.b.copy(A.b),this.c.copy(A.c),this}getArea(){return qQ.subVectors(this.c,this.b),gE.subVectors(this.a,this.b),qQ.cross(gE).length()*.5}getMidpoint(A){return A.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(A){return Ui.getNormal(this.a,this.b,this.c,A)}getPlane(A){return A.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(A,I){return Ui.getBarycoord(A,this.a,this.b,this.c,I)}getInterpolation(A,I,g,C,i){return Ui.getInterpolation(A,this.a,this.b,this.c,I,g,C,i)}containsPoint(A){return Ui.containsPoint(A,this.a,this.b,this.c)}isFrontFacing(A){return Ui.isFrontFacing(this.a,this.b,this.c,A)}intersectsBox(A){return A.intersectsTriangle(this)}closestPointToPoint(A,I){const g=this.a,C=this.b,i=this.c;let e,E;ss.subVectors(C,g),as.subVectors(i,g),aw.subVectors(A,g);const n=ss.dot(aw),a=as.dot(aw);if(n<=0&&a<=0)return I.copy(g);rw.subVectors(A,C);const l=ss.dot(rw),D=as.dot(rw);if(l>=0&&D<=l)return I.copy(C);const h=n*D-l*a;if(h<=0&&n>=0&&l<=0)return e=n/(n-l),I.copy(g).addScaledVector(ss,e);lw.subVectors(A,i);const S=ss.dot(lw),G=as.dot(lw);if(G>=0&&S<=G)return I.copy(i);const U=S*a-n*G;if(U<=0&&a>=0&&G<=0)return E=a/(a-G),I.copy(g).addScaledVector(as,E);const k=l*G-S*D;if(k<=0&&D-l>=0&&S-G>=0)return Lu.subVectors(i,C),E=(D-l)/(D-l+(S-G)),I.copy(C).addScaledVector(Lu,E);const y=1/(k+U+h);return e=U*y,E=h*y,I.copy(g).addScaledVector(ss,e).addScaledVector(as,E)}equals(A){return A.a.equals(this.a)&&A.b.equals(this.b)&&A.c.equals(this.c)}}const ip={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},gt={h:0,s:0,l:0},GD={h:0,s:0,l:0};function Sw(B,A,I){return I<0&&(I+=1),I>1&&(I-=1),I<1/6?B+(A-B)*6*I:I<1/2?A:I<2/3?B+(A-B)*6*(2/3-I):B}class cI{constructor(A,I,g){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(A,I,g)}set(A,I,g){if(I===void 0&&g===void 0){const C=A;C&&C.isColor?this.copy(C):typeof C=="number"?this.setHex(C):typeof C=="string"&&this.setStyle(C)}else this.setRGB(A,I,g);return this}setScalar(A){return this.r=A,this.g=A,this.b=A,this}setHex(A,I=DB){return A=Math.floor(A),this.r=(A>>16&255)/255,this.g=(A>>8&255)/255,this.b=(A&255)/255,Kg.toWorkingColorSpace(this,I),this}setRGB(A,I,g,C=Kg.workingColorSpace){return this.r=A,this.g=I,this.b=g,Kg.toWorkingColorSpace(this,C),this}setHSL(A,I,g,C=Kg.workingColorSpace){if(A=Vy(A,1),I=NC(I,0,1),g=NC(g,0,1),I===0)this.r=this.g=this.b=g;else{const i=g<=.5?g*(1+I):g+I-g*I,e=2*g-i;this.r=Sw(e,i,A+1/3),this.g=Sw(e,i,A),this.b=Sw(e,i,A-1/3)}return Kg.toWorkingColorSpace(this,C),this}setStyle(A,I=DB){function g(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+A+" will be ignored.")}let C;if(C=/^(\w+)\(([^\)]*)\)/.exec(A)){let i;const e=C[1],E=C[2];switch(e){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(E))return g(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,I);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(E))return g(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,I);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(E))return g(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,I);break;default:console.warn("THREE.Color: Unknown color model "+A)}}else if(C=/^\#([A-Fa-f\d]+)$/.exec(A)){const i=C[1],e=i.length;if(e===3)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,I);if(e===6)return this.setHex(parseInt(i,16),I);console.warn("THREE.Color: Invalid hex color "+A)}else if(A&&A.length>0)return this.setColorName(A,I);return this}setColorName(A,I=DB){const g=ip[A.toLowerCase()];return g!==void 0?this.setHex(g,I):console.warn("THREE.Color: Unknown color "+A),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(A){return this.r=A.r,this.g=A.g,this.b=A.b,this}copySRGBToLinear(A){return this.r=sE(A.r),this.g=sE(A.g),this.b=sE(A.b),this}copyLinearToSRGB(A){return this.r=Fs(A.r),this.g=Fs(A.g),this.b=Fs(A.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(A=DB){return Kg.fromWorkingColorSpace(OB.copy(this),A),Math.round(NC(OB.r*255,0,255))*65536+Math.round(NC(OB.g*255,0,255))*256+Math.round(NC(OB.b*255,0,255))}getHexString(A=DB){return("000000"+this.getHex(A).toString(16)).slice(-6)}getHSL(A,I=Kg.workingColorSpace){Kg.fromWorkingColorSpace(OB.copy(this),I);const g=OB.r,C=OB.g,i=OB.b,e=Math.max(g,C,i),E=Math.min(g,C,i);let n,a;const l=(E+e)/2;if(E===e)n=0,a=0;else{const D=e-E;switch(a=l<=.5?D/(e+E):D/(2-e-E),e){case g:n=(C-i)/D+(C0!=A>0&&this.version++,this._alphaTest=A}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(A){if(A!==void 0)for(const I in A){const g=A[I];if(g===void 0){console.warn(`THREE.Material: parameter '${I}' has value of undefined.`);continue}const C=this[I];if(C===void 0){console.warn(`THREE.Material: '${I}' is not a property of THREE.${this.type}.`);continue}C&&C.isColor?C.set(g):C&&C.isVector3&&g&&g.isVector3?C.copy(g):this[I]=g}}toJSON(A){const I=A===void 0||typeof A=="string";I&&(A={textures:{},images:{}});const g={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};g.uuid=this.uuid,g.type=this.type,this.name!==""&&(g.name=this.name),this.color&&this.color.isColor&&(g.color=this.color.getHex()),this.roughness!==void 0&&(g.roughness=this.roughness),this.metalness!==void 0&&(g.metalness=this.metalness),this.sheen!==void 0&&(g.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(g.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(g.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(g.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(g.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(g.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(g.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(g.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(g.shininess=this.shininess),this.clearcoat!==void 0&&(g.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(g.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(g.clearcoatMap=this.clearcoatMap.toJSON(A).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(g.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(A).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(g.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(A).uuid,g.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(g.dispersion=this.dispersion),this.iridescence!==void 0&&(g.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(g.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(g.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(g.iridescenceMap=this.iridescenceMap.toJSON(A).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(g.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(A).uuid),this.anisotropy!==void 0&&(g.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(g.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(g.anisotropyMap=this.anisotropyMap.toJSON(A).uuid),this.map&&this.map.isTexture&&(g.map=this.map.toJSON(A).uuid),this.matcap&&this.matcap.isTexture&&(g.matcap=this.matcap.toJSON(A).uuid),this.alphaMap&&this.alphaMap.isTexture&&(g.alphaMap=this.alphaMap.toJSON(A).uuid),this.lightMap&&this.lightMap.isTexture&&(g.lightMap=this.lightMap.toJSON(A).uuid,g.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(g.aoMap=this.aoMap.toJSON(A).uuid,g.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(g.bumpMap=this.bumpMap.toJSON(A).uuid,g.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(g.normalMap=this.normalMap.toJSON(A).uuid,g.normalMapType=this.normalMapType,g.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(g.displacementMap=this.displacementMap.toJSON(A).uuid,g.displacementScale=this.displacementScale,g.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(g.roughnessMap=this.roughnessMap.toJSON(A).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(g.metalnessMap=this.metalnessMap.toJSON(A).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(g.emissiveMap=this.emissiveMap.toJSON(A).uuid),this.specularMap&&this.specularMap.isTexture&&(g.specularMap=this.specularMap.toJSON(A).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(g.specularIntensityMap=this.specularIntensityMap.toJSON(A).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(g.specularColorMap=this.specularColorMap.toJSON(A).uuid),this.envMap&&this.envMap.isTexture&&(g.envMap=this.envMap.toJSON(A).uuid,this.combine!==void 0&&(g.combine=this.combine)),this.envMapRotation!==void 0&&(g.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(g.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(g.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(g.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(g.gradientMap=this.gradientMap.toJSON(A).uuid),this.transmission!==void 0&&(g.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(g.transmissionMap=this.transmissionMap.toJSON(A).uuid),this.thickness!==void 0&&(g.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(g.thicknessMap=this.thicknessMap.toJSON(A).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(g.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(g.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(g.size=this.size),this.shadowSide!==null&&(g.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(g.sizeAttenuation=this.sizeAttenuation),this.blending!==Yo&&(g.blending=this.blending),this.side!==re&&(g.side=this.side),this.vertexColors===!0&&(g.vertexColors=!0),this.opacity<1&&(g.opacity=this.opacity),this.transparent===!0&&(g.transparent=!0),this.blendSrc!==Sh&&(g.blendSrc=this.blendSrc),this.blendDst!==wh&&(g.blendDst=this.blendDst),this.blendEquation!==ot&&(g.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(g.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(g.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(g.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(g.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(g.blendAlpha=this.blendAlpha),this.depthFunc!==xo&&(g.depthFunc=this.depthFunc),this.depthTest===!1&&(g.depthTest=this.depthTest),this.depthWrite===!1&&(g.depthWrite=this.depthWrite),this.colorWrite===!1&&(g.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(g.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==yy&&(g.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(g.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(g.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ko&&(g.stencilFail=this.stencilFail),this.stencilZFail!==ko&&(g.stencilZFail=this.stencilZFail),this.stencilZPass!==ko&&(g.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(g.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(g.rotation=this.rotation),this.polygonOffset===!0&&(g.polygonOffset=!0),this.polygonOffsetFactor!==0&&(g.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(g.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(g.linewidth=this.linewidth),this.dashSize!==void 0&&(g.dashSize=this.dashSize),this.gapSize!==void 0&&(g.gapSize=this.gapSize),this.scale!==void 0&&(g.scale=this.scale),this.dithering===!0&&(g.dithering=!0),this.alphaTest>0&&(g.alphaTest=this.alphaTest),this.alphaHash===!0&&(g.alphaHash=!0),this.alphaToCoverage===!0&&(g.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(g.premultipliedAlpha=!0),this.forceSinglePass===!0&&(g.forceSinglePass=!0),this.wireframe===!0&&(g.wireframe=!0),this.wireframeLinewidth>1&&(g.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(g.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(g.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(g.flatShading=!0),this.visible===!1&&(g.visible=!1),this.toneMapped===!1&&(g.toneMapped=!1),this.fog===!1&&(g.fog=!1),Object.keys(this.userData).length>0&&(g.userData=this.userData);function C(i){const e=[];for(const E in i){const n=i[E];delete n.metadata,e.push(n)}return e}if(I){const i=C(A.textures),e=C(A.images);i.length>0&&(g.textures=i),e.length>0&&(g.images=e)}return g}clone(){return new this.constructor().copy(this)}copy(A){this.name=A.name,this.blending=A.blending,this.side=A.side,this.vertexColors=A.vertexColors,this.opacity=A.opacity,this.transparent=A.transparent,this.blendSrc=A.blendSrc,this.blendDst=A.blendDst,this.blendEquation=A.blendEquation,this.blendSrcAlpha=A.blendSrcAlpha,this.blendDstAlpha=A.blendDstAlpha,this.blendEquationAlpha=A.blendEquationAlpha,this.blendColor.copy(A.blendColor),this.blendAlpha=A.blendAlpha,this.depthFunc=A.depthFunc,this.depthTest=A.depthTest,this.depthWrite=A.depthWrite,this.stencilWriteMask=A.stencilWriteMask,this.stencilFunc=A.stencilFunc,this.stencilRef=A.stencilRef,this.stencilFuncMask=A.stencilFuncMask,this.stencilFail=A.stencilFail,this.stencilZFail=A.stencilZFail,this.stencilZPass=A.stencilZPass,this.stencilWrite=A.stencilWrite;const I=A.clippingPlanes;let g=null;if(I!==null){const C=I.length;g=new Array(C);for(let i=0;i!==C;++i)g[i]=I[i].clone()}return this.clippingPlanes=g,this.clipIntersection=A.clipIntersection,this.clipShadows=A.clipShadows,this.shadowSide=A.shadowSide,this.colorWrite=A.colorWrite,this.precision=A.precision,this.polygonOffset=A.polygonOffset,this.polygonOffsetFactor=A.polygonOffsetFactor,this.polygonOffsetUnits=A.polygonOffsetUnits,this.dithering=A.dithering,this.alphaTest=A.alphaTest,this.alphaHash=A.alphaHash,this.alphaToCoverage=A.alphaToCoverage,this.premultipliedAlpha=A.premultipliedAlpha,this.forceSinglePass=A.forceSinglePass,this.visible=A.visible,this.toneMapped=A.toneMapped,this.userData=JSON.parse(JSON.stringify(A.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(A){A===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class pi extends iB{static get type(){return"MeshBasicMaterial"}constructor(A){super(),this.isMeshBasicMaterial=!0,this.color=new cI(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 ZB,this.combine=Il,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(A)}copy(A){return super.copy(A),this.color.copy(A.color),this.map=A.map,this.lightMap=A.lightMap,this.lightMapIntensity=A.lightMapIntensity,this.aoMap=A.aoMap,this.aoMapIntensity=A.aoMapIntensity,this.specularMap=A.specularMap,this.alphaMap=A.alphaMap,this.envMap=A.envMap,this.envMapRotation.copy(A.envMapRotation),this.combine=A.combine,this.reflectivity=A.reflectivity,this.refractionRatio=A.refractionRatio,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this.wireframeLinecap=A.wireframeLinecap,this.wireframeLinejoin=A.wireframeLinejoin,this.fog=A.fog,this}}const EE=AK();function AK(){const B=new ArrayBuffer(4),A=new Float32Array(B),I=new Uint32Array(B),g=new Uint32Array(512),C=new Uint32Array(512);for(let n=0;n<256;++n){const a=n-127;a<-27?(g[n]=0,g[n|256]=32768,C[n]=24,C[n|256]=24):a<-14?(g[n]=1024>>-a-14,g[n|256]=1024>>-a-14|32768,C[n]=-a-1,C[n|256]=-a-1):a<=15?(g[n]=a+15<<10,g[n|256]=a+15<<10|32768,C[n]=13,C[n|256]=13):a<128?(g[n]=31744,g[n|256]=64512,C[n]=24,C[n|256]=24):(g[n]=31744,g[n|256]=64512,C[n]=13,C[n|256]=13)}const i=new Uint32Array(2048),e=new Uint32Array(64),E=new Uint32Array(64);for(let n=1;n<1024;++n){let a=n<<13,l=0;for(;(a&8388608)===0;)a<<=1,l-=8388608;a&=-8388609,l+=947912704,i[n]=a|l}for(let n=1024;n<2048;++n)i[n]=939524096+(n-1024<<13);for(let n=1;n<31;++n)e[n]=n<<23;e[31]=1199570944,e[32]=2147483648;for(let n=33;n<63;++n)e[n]=2147483648+(n-32<<23);e[63]=3347054592;for(let n=1;n<64;++n)n!==32&&(E[n]=1024);return{floatView:A,uint32View:I,baseTable:g,shiftTable:C,mantissaTable:i,exponentTable:e,offsetTable:E}}function Mi(B){Math.abs(B)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),B=NC(B,-65504,65504),EE.floatView[0]=B;const A=EE.uint32View[0],I=A>>23&511;return EE.baseTable[I]+((A&8388607)>>EE.shiftTable[I])}function Dr(B){const A=B>>10;return EE.uint32View[0]=EE.mantissaTable[EE.offsetTable[A]+(B&1023)]+EE.exponentTable[A],EE.floatView[0]}const Fo={toHalfFloat:Mi,fromHalfFloat:Dr},bC=new Z,kD=new PA;class Eg{constructor(A,I,g=!1){if(Array.isArray(A))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=A,this.itemSize=I,this.count=A!==void 0?A.length/I:0,this.normalized=g,this.usage=Yr,this.updateRanges=[],this.gpuType=yC,this.version=0}onUploadCallback(){}set needsUpdate(A){A===!0&&this.version++}setUsage(A){return this.usage=A,this}addUpdateRange(A,I){this.updateRanges.push({start:A,count:I})}clearUpdateRanges(){this.updateRanges.length=0}copy(A){return this.name=A.name,this.array=new A.array.constructor(A.array),this.itemSize=A.itemSize,this.count=A.count,this.normalized=A.normalized,this.usage=A.usage,this.gpuType=A.gpuType,this}copyAt(A,I,g){A*=this.itemSize,g*=I.itemSize;for(let C=0,i=this.itemSize;CI.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),I.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new _B);const A=this.attributes.position,I=this.morphAttributes.position;if(A&&A.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Z(-1/0,-1/0,-1/0),new Z(1/0,1/0,1/0));return}if(A!==void 0){if(this.boundingBox.setFromBufferAttribute(A),I)for(let g=0,C=I.length;g0&&(A.userData=this.userData),this.parameters!==void 0){const n=this.parameters;for(const a in n)n[a]!==void 0&&(A[a]=n[a]);return A}A.data={attributes:{}};const I=this.index;I!==null&&(A.data.index={type:I.array.constructor.name,array:Array.prototype.slice.call(I.array)});const g=this.attributes;for(const n in g){const a=g[n];A.data.attributes[n]=a.toJSON(A.data)}const C={};let i=!1;for(const n in this.morphAttributes){const a=this.morphAttributes[n],l=[];for(let D=0,h=a.length;D0&&(C[n]=l,i=!0)}i&&(A.data.morphAttributes=C,A.data.morphTargetsRelative=this.morphTargetsRelative);const e=this.groups;e.length>0&&(A.data.groups=JSON.parse(JSON.stringify(e)));const E=this.boundingSphere;return E!==null&&(A.data.boundingSphere={center:E.center.toArray(),radius:E.radius}),A}clone(){return new this.constructor().copy(this)}copy(A){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const I={};this.name=A.name;const g=A.index;g!==null&&this.setIndex(g.clone(I));const C=A.attributes;for(const a in C){const l=C[a];this.setAttribute(a,l.clone(I))}const i=A.morphAttributes;for(const a in i){const l=[],D=i[a];for(let h=0,S=D.length;h0){const C=I[g[0]];if(C!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,e=C.length;i(A.far-A.near)**2))&&(Yu.copy(i).invert(),oo.copy(A.ray).applyMatrix4(Yu),!(g.boundingBox!==null&&oo.intersectsBox(g.boundingBox)===!1)&&this._computeIntersections(A,I,oo)))}_computeIntersections(A,I,g){let C;const i=this.geometry,e=this.material,E=i.index,n=i.attributes.position,a=i.attributes.uv,l=i.attributes.uv1,D=i.attributes.normal,h=i.groups,S=i.drawRange;if(E!==null)if(Array.isArray(e))for(let G=0,U=h.length;GI.far?null:{distance:a,point:ND.clone(),object:B}}function JD(B,A,I,g,C,i,e,E,n,a){B.getVertexPosition(E,MD),B.getVertexPosition(n,UD),B.getVertexPosition(a,pD);const l=EK(B,A,I,g,MD,UD,pD,mu);if(l){const D=new Z;Ui.getBarycoord(mu,MD,UD,pD,D),C&&(l.uv=Ui.getInterpolatedAttribute(C,E,n,a,D,new PA)),i&&(l.uv1=Ui.getInterpolatedAttribute(i,E,n,a,D,new PA)),e&&(l.normal=Ui.getInterpolatedAttribute(e,E,n,a,D,new Z),l.normal.dot(g.direction)>0&&l.normal.multiplyScalar(-1));const h={a:E,b:n,c:a,normal:new Z,materialIndex:0};Ui.getNormal(MD,UD,pD,h.normal),l.face=h,l.barycoord=D}return l}class In extends tg{constructor(A=1,I=1,g=1,C=1,i=1,e=1){super(),this.type="BoxGeometry",this.parameters={width:A,height:I,depth:g,widthSegments:C,heightSegments:i,depthSegments:e};const E=this;C=Math.floor(C),i=Math.floor(i),e=Math.floor(e);const n=[],a=[],l=[],D=[];let h=0,S=0;G("z","y","x",-1,-1,g,I,A,e,i,0),G("z","y","x",1,-1,g,I,-A,e,i,1),G("x","z","y",1,1,A,g,I,C,e,2),G("x","z","y",1,-1,A,g,-I,C,e,3),G("x","y","z",1,-1,A,I,g,C,i,4),G("x","y","z",-1,-1,A,I,-g,C,i,5),this.setIndex(n),this.setAttribute("position",new xI(a,3)),this.setAttribute("normal",new xI(l,3)),this.setAttribute("uv",new xI(D,2));function G(U,k,y,d,J,F,v,m,x,T,L){const Y=F/x,b=v/T,IA=F/2,CA=v/2,nA=m/2,uA=x+1,EA=T+1;let pA=0,V=0;const aA=new Z;for(let BA=0;BA0?1:-1,l.push(aA.x,aA.y,aA.z),D.push(oA/x),D.push(1-BA/T),pA+=1}}for(let BA=0;BA0&&(I.defines=this.defines),I.vertexShader=this.vertexShader,I.fragmentShader=this.fragmentShader,I.lights=this.lights,I.clipping=this.clipping;const g={};for(const C in this.extensions)this.extensions[C]===!0&&(g[C]=!0);return Object.keys(g).length>0&&(I.extensions=g),I}}class Ql extends Ng{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new VI,this.projectionMatrix=new VI,this.projectionMatrixInverse=new VI,this.coordinateSystem=oe}copy(A,I){return super.copy(A,I),this.matrixWorldInverse.copy(A.matrixWorldInverse),this.projectionMatrix.copy(A.projectionMatrix),this.projectionMatrixInverse.copy(A.projectionMatrixInverse),this.coordinateSystem=A.coordinateSystem,this}getWorldDirection(A){return super.getWorldDirection(A).negate()}updateMatrixWorld(A){super.updateMatrixWorld(A),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(A,I){super.updateWorldMatrix(A,I),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Ct=new Z,Hu=new PA,Tu=new PA;class CB extends Ql{constructor(A=50,I=1,g=.1,C=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=A,this.zoom=1,this.near=g,this.far=C,this.focus=10,this.aspect=I,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(A,I){return super.copy(A,I),this.fov=A.fov,this.zoom=A.zoom,this.near=A.near,this.far=A.far,this.focus=A.focus,this.aspect=A.aspect,this.view=A.view===null?null:Object.assign({},A.view),this.filmGauge=A.filmGauge,this.filmOffset=A.filmOffset,this}setFocalLength(A){const I=.5*this.getFilmHeight()/A;this.fov=xs*2*Math.atan(I),this.updateProjectionMatrix()}getFocalLength(){const A=Math.tan(mo*.5*this.fov);return .5*this.getFilmHeight()/A}getEffectiveFOV(){return xs*2*Math.atan(Math.tan(mo*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(A,I,g){Ct.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),I.set(Ct.x,Ct.y).multiplyScalar(-A/Ct.z),Ct.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),g.set(Ct.x,Ct.y).multiplyScalar(-A/Ct.z)}getViewSize(A,I){return this.getViewBounds(A,Hu,Tu),I.subVectors(Tu,Hu)}setViewOffset(A,I,g,C,i,e){this.aspect=A/I,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=A,this.view.fullHeight=I,this.view.offsetX=g,this.view.offsetY=C,this.view.width=i,this.view.height=e,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const A=this.near;let I=A*Math.tan(mo*.5*this.fov)/this.zoom,g=2*I,C=this.aspect*g,i=-.5*C;const e=this.view;if(this.view!==null&&this.view.enabled){const n=e.fullWidth,a=e.fullHeight;i+=e.offsetX*C/n,I-=e.offsetY*g/a,C*=e.width/n,g*=e.height/a}const E=this.filmOffset;E!==0&&(i+=A*E/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+C,I,I-g,A,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(A){const I=super.toJSON(A);return I.object.fov=this.fov,I.object.zoom=this.zoom,I.object.near=this.near,I.object.far=this.far,I.object.focus=this.focus,I.object.aspect=this.aspect,this.view!==null&&(I.object.view=Object.assign({},this.view)),I.object.filmGauge=this.filmGauge,I.object.filmOffset=this.filmOffset,I}}const ls=-90,Ds=1;class Ep extends Ng{constructor(A,I,g){super(),this.type="CubeCamera",this.renderTarget=g,this.coordinateSystem=null,this.activeMipmapLevel=0;const C=new CB(ls,Ds,A,I);C.layers=this.layers,this.add(C);const i=new CB(ls,Ds,A,I);i.layers=this.layers,this.add(i);const e=new CB(ls,Ds,A,I);e.layers=this.layers,this.add(e);const E=new CB(ls,Ds,A,I);E.layers=this.layers,this.add(E);const n=new CB(ls,Ds,A,I);n.layers=this.layers,this.add(n);const a=new CB(ls,Ds,A,I);a.layers=this.layers,this.add(a)}updateCoordinateSystem(){const A=this.coordinateSystem,I=this.children.concat(),[g,C,i,e,E,n]=I;for(const a of I)this.remove(a);if(A===oe)g.up.set(0,1,0),g.lookAt(1,0,0),C.up.set(0,1,0),C.lookAt(-1,0,0),i.up.set(0,0,-1),i.lookAt(0,1,0),e.up.set(0,0,1),e.lookAt(0,-1,0),E.up.set(0,1,0),E.lookAt(0,0,1),n.up.set(0,1,0),n.lookAt(0,0,-1);else if(A===qr)g.up.set(0,-1,0),g.lookAt(-1,0,0),C.up.set(0,-1,0),C.lookAt(1,0,0),i.up.set(0,0,1),i.lookAt(0,1,0),e.up.set(0,0,-1),e.lookAt(0,-1,0),E.up.set(0,-1,0),E.lookAt(0,0,1),n.up.set(0,-1,0),n.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+A);for(const a of I)this.add(a),a.updateMatrixWorld()}update(A,I){this.parent===null&&this.updateMatrixWorld();const{renderTarget:g,activeMipmapLevel:C}=this;this.coordinateSystem!==A.coordinateSystem&&(this.coordinateSystem=A.coordinateSystem,this.updateCoordinateSystem());const[i,e,E,n,a,r]=this.children,D=A.getRenderTarget(),h=A.getActiveCubeFace(),S=A.getActiveMipmapLevel(),G=A.xr.enabled;A.xr.enabled=!1;const U=g.texture.generateMipmaps;g.texture.generateMipmaps=!1,A.setRenderTarget(g,0,C),A.render(I,i),A.setRenderTarget(g,1,C),A.render(I,e),A.setRenderTarget(g,2,C),A.render(I,E),A.setRenderTarget(g,3,C),A.render(I,n),A.setRenderTarget(g,4,C),A.render(I,a),g.texture.generateMipmaps=U,A.setRenderTarget(g,5,C),A.render(I,r),A.setRenderTarget(D,h,S),A.xr.enabled=G,g.texture.needsPMREMUpdate=!0}}class el extends Vg{constructor(A,I,g,C,i,e,E,n,a,r){A=A!==void 0?A:[],I=I!==void 0?I:le,super(A,I,g,C,i,e,E,n,a,r),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(A){this.image=A}}class $y extends bi{constructor(A=1,I={}){super(A,A,I),this.isWebGLCubeRenderTarget=!0;const g={width:A,height:A,depth:1},C=[g,g,g,g,g,g];this.texture=new el(C,I.mapping,I.wrapS,I.wrapT,I.magFilter,I.minFilter,I.format,I.type,I.anisotropy,I.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=I.generateMipmaps!==void 0?I.generateMipmaps:!1,this.texture.minFilter=I.minFilter!==void 0?I.minFilter:Og}fromEquirectangularTexture(A,I){this.texture.type=I.type,this.texture.colorSpace=I.colorSpace,this.texture.generateMipmaps=I.generateMipmaps,this.texture.minFilter=I.minFilter,this.texture.magFilter=I.magFilter;const g={uniforms:{tEquirect:{value:null}},vertexShader:`
+}`;class ni extends iB{static get type(){return"ShaderMaterial"}constructor(A){super(),this.isShaderMaterial=!0,this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=oK,this.fragmentShader=nK,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,A!==void 0&&this.setValues(A)}copy(A){return super.copy(A),this.fragmentShader=A.fragmentShader,this.vertexShader=A.vertexShader,this.uniforms=vs(A.uniforms),this.uniformsGroups=tK(A.uniformsGroups),this.defines=Object.assign({},A.defines),this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this.fog=A.fog,this.lights=A.lights,this.clipping=A.clipping,this.extensions=Object.assign({},A.extensions),this.glslVersion=A.glslVersion,this}toJSON(A){const I=super.toJSON(A);I.glslVersion=this.glslVersion,I.uniforms={};for(const C in this.uniforms){const e=this.uniforms[C].value;e&&e.isTexture?I.uniforms[C]={type:"t",value:e.toJSON(A).uuid}:e&&e.isColor?I.uniforms[C]={type:"c",value:e.getHex()}:e&&e.isVector2?I.uniforms[C]={type:"v2",value:e.toArray()}:e&&e.isVector3?I.uniforms[C]={type:"v3",value:e.toArray()}:e&&e.isVector4?I.uniforms[C]={type:"v4",value:e.toArray()}:e&&e.isMatrix3?I.uniforms[C]={type:"m3",value:e.toArray()}:e&&e.isMatrix4?I.uniforms[C]={type:"m4",value:e.toArray()}:I.uniforms[C]={value:e}}Object.keys(this.defines).length>0&&(I.defines=this.defines),I.vertexShader=this.vertexShader,I.fragmentShader=this.fragmentShader,I.lights=this.lights,I.clipping=this.clipping;const g={};for(const C in this.extensions)this.extensions[C]===!0&&(g[C]=!0);return Object.keys(g).length>0&&(I.extensions=g),I}}class Ql extends Ng{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new VI,this.projectionMatrix=new VI,this.projectionMatrixInverse=new VI,this.coordinateSystem=oe}copy(A,I){return super.copy(A,I),this.matrixWorldInverse.copy(A.matrixWorldInverse),this.projectionMatrix.copy(A.projectionMatrix),this.projectionMatrixInverse.copy(A.projectionMatrixInverse),this.coordinateSystem=A.coordinateSystem,this}getWorldDirection(A){return super.getWorldDirection(A).negate()}updateMatrixWorld(A){super.updateMatrixWorld(A),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(A,I){super.updateWorldMatrix(A,I),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Ct=new Z,Hu=new PA,Tu=new PA;class CB extends Ql{constructor(A=50,I=1,g=.1,C=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=A,this.zoom=1,this.near=g,this.far=C,this.focus=10,this.aspect=I,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(A,I){return super.copy(A,I),this.fov=A.fov,this.zoom=A.zoom,this.near=A.near,this.far=A.far,this.focus=A.focus,this.aspect=A.aspect,this.view=A.view===null?null:Object.assign({},A.view),this.filmGauge=A.filmGauge,this.filmOffset=A.filmOffset,this}setFocalLength(A){const I=.5*this.getFilmHeight()/A;this.fov=xs*2*Math.atan(I),this.updateProjectionMatrix()}getFocalLength(){const A=Math.tan(mo*.5*this.fov);return .5*this.getFilmHeight()/A}getEffectiveFOV(){return xs*2*Math.atan(Math.tan(mo*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(A,I,g){Ct.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),I.set(Ct.x,Ct.y).multiplyScalar(-A/Ct.z),Ct.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),g.set(Ct.x,Ct.y).multiplyScalar(-A/Ct.z)}getViewSize(A,I){return this.getViewBounds(A,Hu,Tu),I.subVectors(Tu,Hu)}setViewOffset(A,I,g,C,i,e){this.aspect=A/I,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=A,this.view.fullHeight=I,this.view.offsetX=g,this.view.offsetY=C,this.view.width=i,this.view.height=e,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const A=this.near;let I=A*Math.tan(mo*.5*this.fov)/this.zoom,g=2*I,C=this.aspect*g,i=-.5*C;const e=this.view;if(this.view!==null&&this.view.enabled){const n=e.fullWidth,a=e.fullHeight;i+=e.offsetX*C/n,I-=e.offsetY*g/a,C*=e.width/n,g*=e.height/a}const E=this.filmOffset;E!==0&&(i+=A*E/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+C,I,I-g,A,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(A){const I=super.toJSON(A);return I.object.fov=this.fov,I.object.zoom=this.zoom,I.object.near=this.near,I.object.far=this.far,I.object.focus=this.focus,I.object.aspect=this.aspect,this.view!==null&&(I.object.view=Object.assign({},this.view)),I.object.filmGauge=this.filmGauge,I.object.filmOffset=this.filmOffset,I}}const ls=-90,Ds=1;class Ep extends Ng{constructor(A,I,g){super(),this.type="CubeCamera",this.renderTarget=g,this.coordinateSystem=null,this.activeMipmapLevel=0;const C=new CB(ls,Ds,A,I);C.layers=this.layers,this.add(C);const i=new CB(ls,Ds,A,I);i.layers=this.layers,this.add(i);const e=new CB(ls,Ds,A,I);e.layers=this.layers,this.add(e);const E=new CB(ls,Ds,A,I);E.layers=this.layers,this.add(E);const n=new CB(ls,Ds,A,I);n.layers=this.layers,this.add(n);const a=new CB(ls,Ds,A,I);a.layers=this.layers,this.add(a)}updateCoordinateSystem(){const A=this.coordinateSystem,I=this.children.concat(),[g,C,i,e,E,n]=I;for(const a of I)this.remove(a);if(A===oe)g.up.set(0,1,0),g.lookAt(1,0,0),C.up.set(0,1,0),C.lookAt(-1,0,0),i.up.set(0,0,-1),i.lookAt(0,1,0),e.up.set(0,0,1),e.lookAt(0,-1,0),E.up.set(0,1,0),E.lookAt(0,0,1),n.up.set(0,1,0),n.lookAt(0,0,-1);else if(A===qr)g.up.set(0,-1,0),g.lookAt(-1,0,0),C.up.set(0,-1,0),C.lookAt(1,0,0),i.up.set(0,0,1),i.lookAt(0,1,0),e.up.set(0,0,-1),e.lookAt(0,-1,0),E.up.set(0,-1,0),E.lookAt(0,0,1),n.up.set(0,-1,0),n.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+A);for(const a of I)this.add(a),a.updateMatrixWorld()}update(A,I){this.parent===null&&this.updateMatrixWorld();const{renderTarget:g,activeMipmapLevel:C}=this;this.coordinateSystem!==A.coordinateSystem&&(this.coordinateSystem=A.coordinateSystem,this.updateCoordinateSystem());const[i,e,E,n,a,l]=this.children,D=A.getRenderTarget(),h=A.getActiveCubeFace(),S=A.getActiveMipmapLevel(),G=A.xr.enabled;A.xr.enabled=!1;const U=g.texture.generateMipmaps;g.texture.generateMipmaps=!1,A.setRenderTarget(g,0,C),A.render(I,i),A.setRenderTarget(g,1,C),A.render(I,e),A.setRenderTarget(g,2,C),A.render(I,E),A.setRenderTarget(g,3,C),A.render(I,n),A.setRenderTarget(g,4,C),A.render(I,a),g.texture.generateMipmaps=U,A.setRenderTarget(g,5,C),A.render(I,l),A.setRenderTarget(D,h,S),A.xr.enabled=G,g.texture.needsPMREMUpdate=!0}}class el extends Vg{constructor(A,I,g,C,i,e,E,n,a,l){A=A!==void 0?A:[],I=I!==void 0?I:le,super(A,I,g,C,i,e,E,n,a,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(A){this.image=A}}class $y extends bi{constructor(A=1,I={}){super(A,A,I),this.isWebGLCubeRenderTarget=!0;const g={width:A,height:A,depth:1},C=[g,g,g,g,g,g];this.texture=new el(C,I.mapping,I.wrapS,I.wrapT,I.magFilter,I.minFilter,I.format,I.type,I.anisotropy,I.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=I.generateMipmaps!==void 0?I.generateMipmaps:!1,this.texture.minFilter=I.minFilter!==void 0?I.minFilter:Og}fromEquirectangularTexture(A,I){this.texture.type=I.type,this.texture.colorSpace=I.colorSpace,this.texture.generateMipmaps=I.generateMipmaps,this.texture.minFilter=I.minFilter,this.texture.magFilter=I.magFilter;const g={uniforms:{tEquirect:{value:null}},vertexShader:`
varying vec3 vWorldDirection;
@@ -80,7 +80,7 @@ Error generating stack: `+K.message+`
gl_FragColor = texture2D( tEquirect, sampleUV );
}
- `},C=new In(5,5,5),i=new ni({name:"CubemapFromEquirect",uniforms:vs(g.uniforms),vertexShader:g.vertexShader,fragmentShader:g.fragmentShader,side:oi,blending:ne});i.uniforms.tEquirect.value=I;const e=new DC(C,i),E=I.minFilter;return I.minFilter===tQ&&(I.minFilter=Og),new Ep(1,10,this).update(A,e),I.minFilter=E,e.geometry.dispose(),e.material.dispose(),this}clear(A,I,g,C){const i=A.getRenderTarget();for(let e=0;e<6;e++)A.setRenderTarget(this,e),A.clear(I,g,C);A.setRenderTarget(i)}}const Gw=new Z,sK=new Z,aK=new sg;class tt{constructor(A=new Z(1,0,0),I=0){this.isPlane=!0,this.normal=A,this.constant=I}set(A,I){return this.normal.copy(A),this.constant=I,this}setComponents(A,I,g,C){return this.normal.set(A,I,g),this.constant=C,this}setFromNormalAndCoplanarPoint(A,I){return this.normal.copy(A),this.constant=-I.dot(this.normal),this}setFromCoplanarPoints(A,I,g){const C=Gw.subVectors(g,I).cross(sK.subVectors(A,I)).normalize();return this.setFromNormalAndCoplanarPoint(C,A),this}copy(A){return this.normal.copy(A.normal),this.constant=A.constant,this}normalize(){const A=1/this.normal.length();return this.normal.multiplyScalar(A),this.constant*=A,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(A){return this.normal.dot(A)+this.constant}distanceToSphere(A){return this.distanceToPoint(A.center)-A.radius}projectPoint(A,I){return I.copy(A).addScaledVector(this.normal,-this.distanceToPoint(A))}intersectLine(A,I){const g=A.delta(Gw),C=this.normal.dot(g);if(C===0)return this.distanceToPoint(A.start)===0?I.copy(A.start):null;const i=-(A.start.dot(this.normal)+this.constant)/C;return i<0||i>1?null:I.copy(A.start).addScaledVector(g,i)}intersectsLine(A){const I=this.distanceToPoint(A.start),g=this.distanceToPoint(A.end);return I<0&&g>0||g<0&&I>0}intersectsBox(A){return A.intersectsPlane(this)}intersectsSphere(A){return A.intersectsPlane(this)}coplanarPoint(A){return A.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(A,I){const g=I||aK.getNormalMatrix(A),C=this.coplanarPoint(Gw).applyMatrix4(A),i=this.normal.applyMatrix3(g).normalize();return this.constant=-C.dot(i),this}translate(A){return this.constant-=A.dot(this.normal),this}equals(A){return A.normal.equals(this.normal)&&A.constant===this.constant}clone(){return new this.constructor().copy(this)}}const no=new FB,KD=new Z;class El{constructor(A=new tt,I=new tt,g=new tt,C=new tt,i=new tt,e=new tt){this.planes=[A,I,g,C,i,e]}set(A,I,g,C,i,e){const E=this.planes;return E[0].copy(A),E[1].copy(I),E[2].copy(g),E[3].copy(C),E[4].copy(i),E[5].copy(e),this}copy(A){const I=this.planes;for(let g=0;g<6;g++)I[g].copy(A.planes[g]);return this}setFromProjectionMatrix(A,I=oe){const g=this.planes,C=A.elements,i=C[0],e=C[1],E=C[2],n=C[3],a=C[4],r=C[5],D=C[6],h=C[7],S=C[8],G=C[9],U=C[10],k=C[11],y=C[12],d=C[13],J=C[14],F=C[15];if(g[0].setComponents(n-i,h-a,k-S,F-y).normalize(),g[1].setComponents(n+i,h+a,k+S,F+y).normalize(),g[2].setComponents(n+e,h+r,k+G,F+d).normalize(),g[3].setComponents(n-e,h-r,k-G,F-d).normalize(),g[4].setComponents(n-E,h-D,k-U,F-J).normalize(),I===oe)g[5].setComponents(n+E,h+D,k+U,F+J).normalize();else if(I===qr)g[5].setComponents(E,D,U,J).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+I);return this}intersectsObject(A){if(A.boundingSphere!==void 0)A.boundingSphere===null&&A.computeBoundingSphere(),no.copy(A.boundingSphere).applyMatrix4(A.matrixWorld);else{const I=A.geometry;I.boundingSphere===null&&I.computeBoundingSphere(),no.copy(I.boundingSphere).applyMatrix4(A.matrixWorld)}return this.intersectsSphere(no)}intersectsSprite(A){return no.center.set(0,0,0),no.radius=.7071067811865476,no.applyMatrix4(A.matrixWorld),this.intersectsSphere(no)}intersectsSphere(A){const I=this.planes,g=A.center,C=-A.radius;for(let i=0;i<6;i++)if(I[i].distanceToPoint(g)0?A.max.x:A.min.x,KD.y=C.normal.y>0?A.max.y:A.min.y,KD.z=C.normal.z>0?A.max.z:A.min.z,C.distanceToPoint(KD)<0)return!1}return!0}containsPoint(A){const I=this.planes;for(let g=0;g<6;g++)if(I[g].distanceToPoint(A)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function tp(){let B=null,A=!1,I=null,g=null;function C(i,e){I(i,e),g=B.requestAnimationFrame(C)}return{start:function(){A!==!0&&I!==null&&(g=B.requestAnimationFrame(C),A=!0)},stop:function(){B.cancelAnimationFrame(g),A=!1},setAnimationLoop:function(i){I=i},setContext:function(i){B=i}}}function rK(B){const A=new WeakMap;function I(E,n){const a=E.array,r=E.usage,D=a.byteLength,h=B.createBuffer();B.bindBuffer(n,h),B.bufferData(n,a,r),E.onUploadCallback();let S;if(a instanceof Float32Array)S=B.FLOAT;else if(a instanceof Uint16Array)E.isFloat16BufferAttribute?S=B.HALF_FLOAT:S=B.UNSIGNED_SHORT;else if(a instanceof Int16Array)S=B.SHORT;else if(a instanceof Uint32Array)S=B.UNSIGNED_INT;else if(a instanceof Int32Array)S=B.INT;else if(a instanceof Int8Array)S=B.BYTE;else if(a instanceof Uint8Array)S=B.UNSIGNED_BYTE;else if(a instanceof Uint8ClampedArray)S=B.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+a);return{buffer:h,type:S,bytesPerElement:a.BYTES_PER_ELEMENT,version:E.version,size:D}}function g(E,n,a){const r=n.array,D=n.updateRanges;if(B.bindBuffer(a,E),D.length===0)B.bufferSubData(a,0,r);else{D.sort((S,G)=>S.start-G.start);let h=0;for(let S=1;S1?null:I.copy(A.start).addScaledVector(g,i)}intersectsLine(A){const I=this.distanceToPoint(A.start),g=this.distanceToPoint(A.end);return I<0&&g>0||g<0&&I>0}intersectsBox(A){return A.intersectsPlane(this)}intersectsSphere(A){return A.intersectsPlane(this)}coplanarPoint(A){return A.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(A,I){const g=I||aK.getNormalMatrix(A),C=this.coplanarPoint(Gw).applyMatrix4(A),i=this.normal.applyMatrix3(g).normalize();return this.constant=-C.dot(i),this}translate(A){return this.constant-=A.dot(this.normal),this}equals(A){return A.normal.equals(this.normal)&&A.constant===this.constant}clone(){return new this.constructor().copy(this)}}const no=new FB,KD=new Z;class El{constructor(A=new tt,I=new tt,g=new tt,C=new tt,i=new tt,e=new tt){this.planes=[A,I,g,C,i,e]}set(A,I,g,C,i,e){const E=this.planes;return E[0].copy(A),E[1].copy(I),E[2].copy(g),E[3].copy(C),E[4].copy(i),E[5].copy(e),this}copy(A){const I=this.planes;for(let g=0;g<6;g++)I[g].copy(A.planes[g]);return this}setFromProjectionMatrix(A,I=oe){const g=this.planes,C=A.elements,i=C[0],e=C[1],E=C[2],n=C[3],a=C[4],l=C[5],D=C[6],h=C[7],S=C[8],G=C[9],U=C[10],k=C[11],y=C[12],d=C[13],J=C[14],F=C[15];if(g[0].setComponents(n-i,h-a,k-S,F-y).normalize(),g[1].setComponents(n+i,h+a,k+S,F+y).normalize(),g[2].setComponents(n+e,h+l,k+G,F+d).normalize(),g[3].setComponents(n-e,h-l,k-G,F-d).normalize(),g[4].setComponents(n-E,h-D,k-U,F-J).normalize(),I===oe)g[5].setComponents(n+E,h+D,k+U,F+J).normalize();else if(I===qr)g[5].setComponents(E,D,U,J).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+I);return this}intersectsObject(A){if(A.boundingSphere!==void 0)A.boundingSphere===null&&A.computeBoundingSphere(),no.copy(A.boundingSphere).applyMatrix4(A.matrixWorld);else{const I=A.geometry;I.boundingSphere===null&&I.computeBoundingSphere(),no.copy(I.boundingSphere).applyMatrix4(A.matrixWorld)}return this.intersectsSphere(no)}intersectsSprite(A){return no.center.set(0,0,0),no.radius=.7071067811865476,no.applyMatrix4(A.matrixWorld),this.intersectsSphere(no)}intersectsSphere(A){const I=this.planes,g=A.center,C=-A.radius;for(let i=0;i<6;i++)if(I[i].distanceToPoint(g)0?A.max.x:A.min.x,KD.y=C.normal.y>0?A.max.y:A.min.y,KD.z=C.normal.z>0?A.max.z:A.min.z,C.distanceToPoint(KD)<0)return!1}return!0}containsPoint(A){const I=this.planes;for(let g=0;g<6;g++)if(I[g].distanceToPoint(A)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function tp(){let B=null,A=!1,I=null,g=null;function C(i,e){I(i,e),g=B.requestAnimationFrame(C)}return{start:function(){A!==!0&&I!==null&&(g=B.requestAnimationFrame(C),A=!0)},stop:function(){B.cancelAnimationFrame(g),A=!1},setAnimationLoop:function(i){I=i},setContext:function(i){B=i}}}function rK(B){const A=new WeakMap;function I(E,n){const a=E.array,l=E.usage,D=a.byteLength,h=B.createBuffer();B.bindBuffer(n,h),B.bufferData(n,a,l),E.onUploadCallback();let S;if(a instanceof Float32Array)S=B.FLOAT;else if(a instanceof Uint16Array)E.isFloat16BufferAttribute?S=B.HALF_FLOAT:S=B.UNSIGNED_SHORT;else if(a instanceof Int16Array)S=B.SHORT;else if(a instanceof Uint32Array)S=B.UNSIGNED_INT;else if(a instanceof Int32Array)S=B.INT;else if(a instanceof Int8Array)S=B.BYTE;else if(a instanceof Uint8Array)S=B.UNSIGNED_BYTE;else if(a instanceof Uint8ClampedArray)S=B.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+a);return{buffer:h,type:S,bytesPerElement:a.BYTES_PER_ELEMENT,version:E.version,size:D}}function g(E,n,a){const l=n.array,D=n.updateRanges;if(B.bindBuffer(a,E),D.length===0)B.bufferSubData(a,0,l);else{D.sort((S,G)=>S.start-G.start);let h=0;for(let S=1;S
#include
#include
-}`,wg={alphahash_fragment:lK,alphahash_pars_fragment:DK,alphamap_fragment:hK,alphamap_pars_fragment:cK,alphatest_fragment:SK,alphatest_pars_fragment:wK,aomap_fragment:yK,aomap_pars_fragment:GK,batching_pars_vertex:kK,batching_vertex:uK,begin_vertex:MK,beginnormal_vertex:UK,bsdfs:pK,iridescence_fragment:dK,bumpmap_pars_fragment:NK,clipping_planes_fragment:JK,clipping_planes_pars_fragment:KK,clipping_planes_pars_vertex:FK,clipping_planes_vertex:fK,color_fragment:RK,color_pars_fragment:LK,color_pars_vertex:YK,color_vertex:qK,common:mK,cube_uv_reflection_fragment:HK,defaultnormal_vertex:TK,displacementmap_pars_vertex:xK,displacementmap_vertex:vK,emissivemap_fragment:OK,emissivemap_pars_fragment:bK,colorspace_fragment:_K,colorspace_pars_fragment:ZK,envmap_fragment:PK,envmap_common_pars_fragment:WK,envmap_pars_fragment:VK,envmap_pars_vertex:jK,envmap_physical_pars_fragment:eF,envmap_vertex:XK,fog_vertex:zK,fog_pars_vertex:$K,fog_fragment:AF,fog_pars_fragment:IF,gradientmap_pars_fragment:gF,lightmap_pars_fragment:CF,lights_lambert_fragment:BF,lights_lambert_pars_fragment:iF,lights_pars_begin:QF,lights_toon_fragment:EF,lights_toon_pars_fragment:tF,lights_phong_fragment:oF,lights_phong_pars_fragment:nF,lights_physical_fragment:sF,lights_physical_pars_fragment:aF,lights_fragment_begin:rF,lights_fragment_maps:lF,lights_fragment_end:DF,logdepthbuf_fragment:hF,logdepthbuf_pars_fragment:cF,logdepthbuf_pars_vertex:SF,logdepthbuf_vertex:wF,map_fragment:yF,map_pars_fragment:GF,map_particle_fragment:kF,map_particle_pars_fragment:uF,metalnessmap_fragment:MF,metalnessmap_pars_fragment:UF,morphinstance_vertex:pF,morphcolor_vertex:dF,morphnormal_vertex:NF,morphtarget_pars_vertex:JF,morphtarget_vertex:KF,normal_fragment_begin:FF,normal_fragment_maps:fF,normal_pars_fragment:RF,normal_pars_vertex:LF,normal_vertex:YF,normalmap_pars_fragment:qF,clearcoat_normal_fragment_begin:mF,clearcoat_normal_fragment_maps:HF,clearcoat_pars_fragment:TF,iridescence_pars_fragment:xF,opaque_fragment:vF,packing:OF,premultiplied_alpha_fragment:bF,project_vertex:_F,dithering_fragment:ZF,dithering_pars_fragment:PF,roughnessmap_fragment:WF,roughnessmap_pars_fragment:VF,shadowmap_pars_fragment:jF,shadowmap_pars_vertex:XF,shadowmap_vertex:zF,shadowmask_pars_fragment:$F,skinbase_vertex:Af,skinning_pars_vertex:If,skinning_vertex:gf,skinnormal_vertex:Cf,specularmap_fragment:Bf,specularmap_pars_fragment:Qf,tonemapping_fragment:ef,tonemapping_pars_fragment:Ef,transmission_fragment:tf,transmission_pars_fragment:of,uv_pars_fragment:nf,uv_pars_vertex:sf,uv_vertex:af,worldpos_vertex:rf,background_vert:lf,background_frag:Df,backgroundCube_vert:hf,backgroundCube_frag:cf,cube_vert:Sf,cube_frag:wf,depth_vert:yf,depth_frag:Gf,distanceRGBA_vert:kf,distanceRGBA_frag:uf,equirect_vert:Mf,equirect_frag:Uf,linedashed_vert:pf,linedashed_frag:df,meshbasic_vert:Nf,meshbasic_frag:Jf,meshlambert_vert:Kf,meshlambert_frag:Ff,meshmatcap_vert:ff,meshmatcap_frag:Rf,meshnormal_vert:Lf,meshnormal_frag:Yf,meshphong_vert:qf,meshphong_frag:mf,meshphysical_vert:Hf,meshphysical_frag:Tf,meshtoon_vert:xf,meshtoon_frag:vf,points_vert:Of,points_frag:bf,shadow_vert:_f,shadow_frag:Zf,sprite_vert:Pf,sprite_frag:Wf},yI={common:{diffuse:{value:new cI(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new sg},alphaMap:{value:null},alphaMapTransform:{value:new sg},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new sg}},envmap:{envMap:{value:null},envMapRotation:{value:new sg},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new sg}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new sg}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new sg},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new sg},normalScale:{value:new PA(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new sg},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new sg}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new sg}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new sg}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new cI(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 cI(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new sg},alphaTest:{value:0},uvTransform:{value:new sg}},sprite:{diffuse:{value:new cI(16777215)},opacity:{value:1},center:{value:new PA(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new sg},alphaMap:{value:null},alphaMapTransform:{value:new sg},alphaTest:{value:0}}},xQ={basic:{uniforms:Ei([yI.common,yI.specularmap,yI.envmap,yI.aomap,yI.lightmap,yI.fog]),vertexShader:wg.meshbasic_vert,fragmentShader:wg.meshbasic_frag},lambert:{uniforms:Ei([yI.common,yI.specularmap,yI.envmap,yI.aomap,yI.lightmap,yI.emissivemap,yI.bumpmap,yI.normalmap,yI.displacementmap,yI.fog,yI.lights,{emissive:{value:new cI(0)}}]),vertexShader:wg.meshlambert_vert,fragmentShader:wg.meshlambert_frag},phong:{uniforms:Ei([yI.common,yI.specularmap,yI.envmap,yI.aomap,yI.lightmap,yI.emissivemap,yI.bumpmap,yI.normalmap,yI.displacementmap,yI.fog,yI.lights,{emissive:{value:new cI(0)},specular:{value:new cI(1118481)},shininess:{value:30}}]),vertexShader:wg.meshphong_vert,fragmentShader:wg.meshphong_frag},standard:{uniforms:Ei([yI.common,yI.envmap,yI.aomap,yI.lightmap,yI.emissivemap,yI.bumpmap,yI.normalmap,yI.displacementmap,yI.roughnessmap,yI.metalnessmap,yI.fog,yI.lights,{emissive:{value:new cI(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:wg.meshphysical_vert,fragmentShader:wg.meshphysical_frag},toon:{uniforms:Ei([yI.common,yI.aomap,yI.lightmap,yI.emissivemap,yI.bumpmap,yI.normalmap,yI.displacementmap,yI.gradientmap,yI.fog,yI.lights,{emissive:{value:new cI(0)}}]),vertexShader:wg.meshtoon_vert,fragmentShader:wg.meshtoon_frag},matcap:{uniforms:Ei([yI.common,yI.bumpmap,yI.normalmap,yI.displacementmap,yI.fog,{matcap:{value:null}}]),vertexShader:wg.meshmatcap_vert,fragmentShader:wg.meshmatcap_frag},points:{uniforms:Ei([yI.points,yI.fog]),vertexShader:wg.points_vert,fragmentShader:wg.points_frag},dashed:{uniforms:Ei([yI.common,yI.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:wg.linedashed_vert,fragmentShader:wg.linedashed_frag},depth:{uniforms:Ei([yI.common,yI.displacementmap]),vertexShader:wg.depth_vert,fragmentShader:wg.depth_frag},normal:{uniforms:Ei([yI.common,yI.bumpmap,yI.normalmap,yI.displacementmap,{opacity:{value:1}}]),vertexShader:wg.meshnormal_vert,fragmentShader:wg.meshnormal_frag},sprite:{uniforms:Ei([yI.sprite,yI.fog]),vertexShader:wg.sprite_vert,fragmentShader:wg.sprite_frag},background:{uniforms:{uvTransform:{value:new sg},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:wg.background_vert,fragmentShader:wg.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new sg}},vertexShader:wg.backgroundCube_vert,fragmentShader:wg.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:wg.cube_vert,fragmentShader:wg.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:wg.equirect_vert,fragmentShader:wg.equirect_frag},distanceRGBA:{uniforms:Ei([yI.common,yI.displacementmap,{referencePosition:{value:new Z},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:wg.distanceRGBA_vert,fragmentShader:wg.distanceRGBA_frag},shadow:{uniforms:Ei([yI.lights,yI.fog,{color:{value:new cI(0)},opacity:{value:1}}]),vertexShader:wg.shadow_vert,fragmentShader:wg.shadow_frag}};xQ.physical={uniforms:Ei([xQ.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new sg},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new sg},clearcoatNormalScale:{value:new PA(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new sg},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new sg},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new sg},sheen:{value:0},sheenColor:{value:new cI(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new sg},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new sg},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new sg},transmissionSamplerSize:{value:new PA},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new sg},attenuationDistance:{value:0},attenuationColor:{value:new cI(0)},specularColor:{value:new cI(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new sg},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new sg},anisotropyVector:{value:new PA},anisotropyMap:{value:null},anisotropyMapTransform:{value:new sg}}]),vertexShader:wg.meshphysical_vert,fragmentShader:wg.meshphysical_frag};const FD={r:0,b:0,g:0},so=new ZB,Vf=new VI;function jf(B,A,I,g,C,i,e){const E=new cI(0);let n=i===!0?0:1,a,r,D=null,h=0,S=null;function G(d){let J=d.isScene===!0?d.background:null;return J&&J.isTexture&&(J=(d.backgroundBlurriness>0?I:A).get(J)),J}function U(d){let J=!1;const F=G(d);F===null?y(E,n):F&&F.isColor&&(y(F,1),J=!0);const v=B.xr.getEnvironmentBlendMode();v==="additive"?g.buffers.color.setClear(0,0,0,1,e):v==="alpha-blend"&&g.buffers.color.setClear(0,0,0,0,e),(B.autoClear||J)&&(g.buffers.depth.setTest(!0),g.buffers.depth.setMask(!0),g.buffers.color.setMask(!0),B.clear(B.autoClearColor,B.autoClearDepth,B.autoClearStencil))}function k(d,J){const F=G(J);F&&(F.isCubeTexture||F.mapping===Vs)?(r===void 0&&(r=new DC(new In(1,1,1),new ni({name:"BackgroundCubeMaterial",uniforms:vs(xQ.backgroundCube.uniforms),vertexShader:xQ.backgroundCube.vertexShader,fragmentShader:xQ.backgroundCube.fragmentShader,side:oi,depthTest:!1,depthWrite:!1,fog:!1})),r.geometry.deleteAttribute("normal"),r.geometry.deleteAttribute("uv"),r.onBeforeRender=function(v,m,x){this.matrixWorld.copyPosition(x.matrixWorld)},Object.defineProperty(r.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),C.update(r)),so.copy(J.backgroundRotation),so.x*=-1,so.y*=-1,so.z*=-1,F.isCubeTexture&&F.isRenderTargetTexture===!1&&(so.y*=-1,so.z*=-1),r.material.uniforms.envMap.value=F,r.material.uniforms.flipEnvMap.value=F.isCubeTexture&&F.isRenderTargetTexture===!1?-1:1,r.material.uniforms.backgroundBlurriness.value=J.backgroundBlurriness,r.material.uniforms.backgroundIntensity.value=J.backgroundIntensity,r.material.uniforms.backgroundRotation.value.setFromMatrix4(Vf.makeRotationFromEuler(so)),r.material.toneMapped=Kg.getTransfer(F.colorSpace)!==Xg,(D!==F||h!==F.version||S!==B.toneMapping)&&(r.material.needsUpdate=!0,D=F,h=F.version,S=B.toneMapping),r.layers.enableAll(),d.unshift(r,r.geometry,r.material,0,0,null)):F&&F.isTexture&&(a===void 0&&(a=new DC(new wt(2,2),new ni({name:"BackgroundMaterial",uniforms:vs(xQ.background.uniforms),vertexShader:xQ.background.vertexShader,fragmentShader:xQ.background.fragmentShader,side:re,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),C.update(a)),a.material.uniforms.t2D.value=F,a.material.uniforms.backgroundIntensity.value=J.backgroundIntensity,a.material.toneMapped=Kg.getTransfer(F.colorSpace)!==Xg,F.matrixAutoUpdate===!0&&F.updateMatrix(),a.material.uniforms.uvTransform.value.copy(F.matrix),(D!==F||h!==F.version||S!==B.toneMapping)&&(a.material.needsUpdate=!0,D=F,h=F.version,S=B.toneMapping),a.layers.enableAll(),d.unshift(a,a.geometry,a.material,0,0,null))}function y(d,J){d.getRGB(FD,Qp(B)),g.buffers.color.setClear(FD.r,FD.g,FD.b,J,e)}return{getClearColor:function(){return E},setClearColor:function(d,J=1){E.set(d),n=J,y(E,n)},getClearAlpha:function(){return n},setClearAlpha:function(d){n=d,y(E,n)},render:U,addToRenderList:k}}function Xf(B,A){const I=B.getParameter(B.MAX_VERTEX_ATTRIBS),g={},C=h(null);let i=C,e=!1;function E(Y,b,IA,CA,nA){let uA=!1;const EA=D(CA,IA,b);i!==EA&&(i=EA,a(i.object)),uA=S(Y,CA,IA,nA),uA&&G(Y,CA,IA,nA),nA!==null&&A.update(nA,B.ELEMENT_ARRAY_BUFFER),(uA||e)&&(e=!1,F(Y,b,IA,CA),nA!==null&&B.bindBuffer(B.ELEMENT_ARRAY_BUFFER,A.get(nA).buffer))}function n(){return B.createVertexArray()}function a(Y){return B.bindVertexArray(Y)}function r(Y){return B.deleteVertexArray(Y)}function D(Y,b,IA){const CA=IA.wireframe===!0;let nA=g[Y.id];nA===void 0&&(nA={},g[Y.id]=nA);let uA=nA[b.id];uA===void 0&&(uA={},nA[b.id]=uA);let EA=uA[CA];return EA===void 0&&(EA=h(n()),uA[CA]=EA),EA}function h(Y){const b=[],IA=[],CA=[];for(let nA=0;nA=0){const BA=nA[V];let P=uA[V];if(P===void 0&&(V==="instanceMatrix"&&Y.instanceMatrix&&(P=Y.instanceMatrix),V==="instanceColor"&&Y.instanceColor&&(P=Y.instanceColor)),BA===void 0||BA.attribute!==P||P&&BA.data!==P.data)return!0;EA++}return i.attributesNum!==EA||i.index!==CA}function G(Y,b,IA,CA){const nA={},uA=b.attributes;let EA=0;const pA=IA.getAttributes();for(const V in pA)if(pA[V].location>=0){let BA=uA[V];BA===void 0&&(V==="instanceMatrix"&&Y.instanceMatrix&&(BA=Y.instanceMatrix),V==="instanceColor"&&Y.instanceColor&&(BA=Y.instanceColor));const P={};P.attribute=BA,BA&&BA.data&&(P.data=BA.data),nA[V]=P,EA++}i.attributes=nA,i.attributesNum=EA,i.index=CA}function U(){const Y=i.newAttributes;for(let b=0,IA=Y.length;b=0){let aA=nA[pA];if(aA===void 0&&(pA==="instanceMatrix"&&Y.instanceMatrix&&(aA=Y.instanceMatrix),pA==="instanceColor"&&Y.instanceColor&&(aA=Y.instanceColor)),aA!==void 0){const BA=aA.normalized,P=aA.itemSize,oA=A.get(aA);if(oA===void 0)continue;const vA=oA.buffer,cA=oA.type,FA=oA.bytesPerElement,wA=cA===B.INT||cA===B.UNSIGNED_INT||aA.gpuType===gl;if(aA.isInterleavedBufferAttribute){const LA=aA.data,VA=LA.stride,WA=aA.offset;if(LA.isInstancedInterleavedBuffer){for(let BI=0;BI0&&B.getShaderPrecisionFormat(B.FRAGMENT_SHADER,B.HIGH_FLOAT).precision>0)return"highp";x="mediump"}return x==="mediump"&&B.getShaderPrecisionFormat(B.VERTEX_SHADER,B.MEDIUM_FLOAT).precision>0&&B.getShaderPrecisionFormat(B.FRAGMENT_SHADER,B.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a=I.precision!==void 0?I.precision:"highp";const r=n(a);r!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",r,"instead."),a=r);const D=I.logarithmicDepthBuffer===!0,h=I.reverseDepthBuffer===!0&&A.has("EXT_clip_control"),S=B.getParameter(B.MAX_TEXTURE_IMAGE_UNITS),G=B.getParameter(B.MAX_VERTEX_TEXTURE_IMAGE_UNITS),U=B.getParameter(B.MAX_TEXTURE_SIZE),k=B.getParameter(B.MAX_CUBE_MAP_TEXTURE_SIZE),y=B.getParameter(B.MAX_VERTEX_ATTRIBS),d=B.getParameter(B.MAX_VERTEX_UNIFORM_VECTORS),J=B.getParameter(B.MAX_VARYING_VECTORS),F=B.getParameter(B.MAX_FRAGMENT_UNIFORM_VECTORS),v=G>0,m=B.getParameter(B.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:i,getMaxPrecision:n,textureFormatReadable:e,textureTypeReadable:E,precision:a,logarithmicDepthBuffer:D,reverseDepthBuffer:h,maxTextures:S,maxVertexTextures:G,maxTextureSize:U,maxCubemapSize:k,maxAttributes:y,maxVertexUniforms:d,maxVaryings:J,maxFragmentUniforms:F,vertexTextures:v,maxSamples:m}}function AR(B){const A=this;let I=null,g=0,C=!1,i=!1;const e=new tt,E=new sg,n={value:null,needsUpdate:!1};this.uniform=n,this.numPlanes=0,this.numIntersection=0,this.init=function(D,h){const S=D.length!==0||h||g!==0||C;return C=h,g=D.length,S},this.beginShadows=function(){i=!0,r(null)},this.endShadows=function(){i=!1},this.setGlobalState=function(D,h){I=r(D,h,0)},this.setState=function(D,h,S){const G=D.clippingPlanes,U=D.clipIntersection,k=D.clipShadows,y=B.get(D);if(!C||G===null||G.length===0||i&&!k)i?r(null):a();else{const d=i?0:g,J=d*4;let F=y.clippingState||null;n.value=F,F=r(G,h,J,S);for(let v=0;v!==J;++v)F[v]=I[v];y.clippingState=F,this.numIntersection=U?this.numPlanes:0,this.numPlanes+=d}};function a(){n.value!==I&&(n.value=I,n.needsUpdate=g>0),A.numPlanes=g,A.numIntersection=0}function r(D,h,S,G){const U=D!==null?D.length:0;let k=null;if(U!==0){if(k=n.value,G!==!0||k===null){const y=S+U*4,d=h.matrixWorldInverse;E.getNormalMatrix(d),(k===null||k.length0){const a=new $y(n.height);return a.fromEquirectangularTexture(B,e),A.set(e,a),e.addEventListener("dispose",C),I(a.texture,e.mapping)}else return null}}return e}function C(e){const E=e.target;E.removeEventListener("dispose",C);const n=A.get(E);n!==void 0&&(A.delete(E),n.dispose())}function i(){A=new WeakMap}return{get:g,dispose:i}}class gn extends Ql{constructor(A=-1,I=1,g=1,C=-1,i=.1,e=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=A,this.right=I,this.top=g,this.bottom=C,this.near=i,this.far=e,this.updateProjectionMatrix()}copy(A,I){return super.copy(A,I),this.left=A.left,this.right=A.right,this.top=A.top,this.bottom=A.bottom,this.near=A.near,this.far=A.far,this.zoom=A.zoom,this.view=A.view===null?null:Object.assign({},A.view),this}setViewOffset(A,I,g,C,i,e){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=A,this.view.fullHeight=I,this.view.offsetX=g,this.view.offsetY=C,this.view.width=i,this.view.height=e,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const A=(this.right-this.left)/(2*this.zoom),I=(this.top-this.bottom)/(2*this.zoom),g=(this.right+this.left)/2,C=(this.top+this.bottom)/2;let i=g-A,e=g+A,E=C+I,n=C-I;if(this.view!==null&&this.view.enabled){const a=(this.right-this.left)/this.view.fullWidth/this.zoom,r=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=a*this.view.offsetX,e=i+a*this.view.width,E-=r*this.view.offsetY,n=E-r*this.view.height}this.projectionMatrix.makeOrthographic(i,e,E,n,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(A){const I=super.toJSON(A);return I.object.zoom=this.zoom,I.object.left=this.left,I.object.right=this.right,I.object.top=this.top,I.object.bottom=this.bottom,I.object.near=this.near,I.object.far=this.far,this.view!==null&&(I.object.view=Object.assign({},this.view)),I}}const ds=4,xu=[.125,.215,.35,.446,.526,.582],Mo=20,kw=new gn,vu=new cI;let uw=null,Mw=0,Uw=0,pw=!1;const uo=(1+Math.sqrt(5))/2,hs=1/uo,Ou=[new Z(-uo,hs,0),new Z(uo,hs,0),new Z(-hs,0,uo),new Z(hs,0,uo),new Z(0,uo,-hs),new Z(0,uo,hs),new Z(-1,1,-1),new Z(1,1,-1),new Z(-1,1,1),new Z(1,1,1)];class ky{constructor(A){this._renderer=A,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(A,I=0,g=.1,C=100){uw=this._renderer.getRenderTarget(),Mw=this._renderer.getActiveCubeFace(),Uw=this._renderer.getActiveMipmapLevel(),pw=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const i=this._allocateTargets();return i.depthBuffer=!0,this._sceneToCubeUV(A,g,C,i),I>0&&this._blur(i,0,0,I),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(A,I=null){return this._fromTexture(A,I)}fromCubemap(A,I=null){return this._fromTexture(A,I)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Zu(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=_u(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(A){this._lodMax=Math.floor(Math.log2(A)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let A=0;A2?J:0,J,J),r.setRenderTarget(C),U&&r.render(G,E),r.render(A,E)}G.geometry.dispose(),G.material.dispose(),r.toneMapping=h,r.autoClear=D,A.background=k}_textureToCubeUV(A,I){const g=this._renderer,C=A.mapping===le||A.mapping===Dt;C?(this._cubemapMaterial===null&&(this._cubemapMaterial=Zu()),this._cubemapMaterial.uniforms.flipEnvMap.value=A.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=_u());const i=C?this._cubemapMaterial:this._equirectMaterial,e=new DC(this._lodPlanes[0],i),E=i.uniforms;E.envMap.value=A;const n=this._cubeSize;fD(I,0,0,3*n,2*n),g.setRenderTarget(I),g.render(e,kw)}_applyPMREM(A){const I=this._renderer,g=I.autoClear;I.autoClear=!1;const C=this._lodPlanes.length;for(let i=1;iMo&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${k} samples when the maximum is set to ${Mo}`);const y=[];let d=0;for(let x=0;xJ-ds?C-J+ds:0),m=4*(this._cubeSize-F);fD(I,v,m,3*F,2*F),n.setRenderTarget(I),n.render(D,kw)}}function gR(B){const A=[],I=[],g=[];let C=B;const i=B-ds+1+xu.length;for(let e=0;eB-ds?n=xu[e-B+ds-1]:e===0&&(n=0),g.push(n);const a=1/(E-2),r=-a,D=1+a,h=[r,r,D,r,D,D,r,r,D,D,r,D],S=6,G=6,U=3,k=2,y=1,d=new Float32Array(U*G*S),J=new Float32Array(k*G*S),F=new Float32Array(y*G*S);for(let m=0;m2?0:-1,L=[x,T,0,x+2/3,T,0,x+2/3,T+1,0,x,T,0,x+2/3,T+1,0,x,T+1,0];d.set(L,U*G*m),J.set(h,k*G*m);const Y=[m,m,m,m,m,m];F.set(Y,y*G*m)}const v=new tg;v.setAttribute("position",new Eg(d,U)),v.setAttribute("uv",new Eg(J,k)),v.setAttribute("faceIndex",new Eg(F,y)),A.push(v),C>ds&&C--}return{lodPlanes:A,sizeLods:I,sigmas:g}}function bu(B,A,I){const g=new bi(B,A,I);return g.texture.mapping=Vs,g.texture.name="PMREM.cubeUv",g.scissorTest=!0,g}function fD(B,A,I,g,C){B.viewport.set(A,I,g,C),B.scissor.set(A,I,g,C)}function CR(B,A,I){const g=new Float32Array(Mo),C=new Z(0,1,0);return new ni({name:"SphericalGaussianBlur",defines:{n:Mo,CUBEUV_TEXEL_WIDTH:1/A,CUBEUV_TEXEL_HEIGHT:1/I,CUBEUV_MAX_MIP:`${B}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:g},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:C}},vertexShader:AG(),fragmentShader:`
+}`,wg={alphahash_fragment:lK,alphahash_pars_fragment:DK,alphamap_fragment:hK,alphamap_pars_fragment:cK,alphatest_fragment:SK,alphatest_pars_fragment:wK,aomap_fragment:yK,aomap_pars_fragment:GK,batching_pars_vertex:kK,batching_vertex:uK,begin_vertex:MK,beginnormal_vertex:UK,bsdfs:pK,iridescence_fragment:dK,bumpmap_pars_fragment:NK,clipping_planes_fragment:JK,clipping_planes_pars_fragment:KK,clipping_planes_pars_vertex:FK,clipping_planes_vertex:fK,color_fragment:RK,color_pars_fragment:LK,color_pars_vertex:YK,color_vertex:qK,common:mK,cube_uv_reflection_fragment:HK,defaultnormal_vertex:TK,displacementmap_pars_vertex:xK,displacementmap_vertex:vK,emissivemap_fragment:OK,emissivemap_pars_fragment:bK,colorspace_fragment:_K,colorspace_pars_fragment:ZK,envmap_fragment:PK,envmap_common_pars_fragment:WK,envmap_pars_fragment:VK,envmap_pars_vertex:jK,envmap_physical_pars_fragment:eF,envmap_vertex:XK,fog_vertex:zK,fog_pars_vertex:$K,fog_fragment:AF,fog_pars_fragment:IF,gradientmap_pars_fragment:gF,lightmap_pars_fragment:CF,lights_lambert_fragment:BF,lights_lambert_pars_fragment:iF,lights_pars_begin:QF,lights_toon_fragment:EF,lights_toon_pars_fragment:tF,lights_phong_fragment:oF,lights_phong_pars_fragment:nF,lights_physical_fragment:sF,lights_physical_pars_fragment:aF,lights_fragment_begin:rF,lights_fragment_maps:lF,lights_fragment_end:DF,logdepthbuf_fragment:hF,logdepthbuf_pars_fragment:cF,logdepthbuf_pars_vertex:SF,logdepthbuf_vertex:wF,map_fragment:yF,map_pars_fragment:GF,map_particle_fragment:kF,map_particle_pars_fragment:uF,metalnessmap_fragment:MF,metalnessmap_pars_fragment:UF,morphinstance_vertex:pF,morphcolor_vertex:dF,morphnormal_vertex:NF,morphtarget_pars_vertex:JF,morphtarget_vertex:KF,normal_fragment_begin:FF,normal_fragment_maps:fF,normal_pars_fragment:RF,normal_pars_vertex:LF,normal_vertex:YF,normalmap_pars_fragment:qF,clearcoat_normal_fragment_begin:mF,clearcoat_normal_fragment_maps:HF,clearcoat_pars_fragment:TF,iridescence_pars_fragment:xF,opaque_fragment:vF,packing:OF,premultiplied_alpha_fragment:bF,project_vertex:_F,dithering_fragment:ZF,dithering_pars_fragment:PF,roughnessmap_fragment:WF,roughnessmap_pars_fragment:VF,shadowmap_pars_fragment:jF,shadowmap_pars_vertex:XF,shadowmap_vertex:zF,shadowmask_pars_fragment:$F,skinbase_vertex:Af,skinning_pars_vertex:If,skinning_vertex:gf,skinnormal_vertex:Cf,specularmap_fragment:Bf,specularmap_pars_fragment:Qf,tonemapping_fragment:ef,tonemapping_pars_fragment:Ef,transmission_fragment:tf,transmission_pars_fragment:of,uv_pars_fragment:nf,uv_pars_vertex:sf,uv_vertex:af,worldpos_vertex:rf,background_vert:lf,background_frag:Df,backgroundCube_vert:hf,backgroundCube_frag:cf,cube_vert:Sf,cube_frag:wf,depth_vert:yf,depth_frag:Gf,distanceRGBA_vert:kf,distanceRGBA_frag:uf,equirect_vert:Mf,equirect_frag:Uf,linedashed_vert:pf,linedashed_frag:df,meshbasic_vert:Nf,meshbasic_frag:Jf,meshlambert_vert:Kf,meshlambert_frag:Ff,meshmatcap_vert:ff,meshmatcap_frag:Rf,meshnormal_vert:Lf,meshnormal_frag:Yf,meshphong_vert:qf,meshphong_frag:mf,meshphysical_vert:Hf,meshphysical_frag:Tf,meshtoon_vert:xf,meshtoon_frag:vf,points_vert:Of,points_frag:bf,shadow_vert:_f,shadow_frag:Zf,sprite_vert:Pf,sprite_frag:Wf},yI={common:{diffuse:{value:new cI(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new sg},alphaMap:{value:null},alphaMapTransform:{value:new sg},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new sg}},envmap:{envMap:{value:null},envMapRotation:{value:new sg},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new sg}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new sg}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new sg},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new sg},normalScale:{value:new PA(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new sg},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new sg}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new sg}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new sg}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new cI(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 cI(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new sg},alphaTest:{value:0},uvTransform:{value:new sg}},sprite:{diffuse:{value:new cI(16777215)},opacity:{value:1},center:{value:new PA(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new sg},alphaMap:{value:null},alphaMapTransform:{value:new sg},alphaTest:{value:0}}},xQ={basic:{uniforms:Ei([yI.common,yI.specularmap,yI.envmap,yI.aomap,yI.lightmap,yI.fog]),vertexShader:wg.meshbasic_vert,fragmentShader:wg.meshbasic_frag},lambert:{uniforms:Ei([yI.common,yI.specularmap,yI.envmap,yI.aomap,yI.lightmap,yI.emissivemap,yI.bumpmap,yI.normalmap,yI.displacementmap,yI.fog,yI.lights,{emissive:{value:new cI(0)}}]),vertexShader:wg.meshlambert_vert,fragmentShader:wg.meshlambert_frag},phong:{uniforms:Ei([yI.common,yI.specularmap,yI.envmap,yI.aomap,yI.lightmap,yI.emissivemap,yI.bumpmap,yI.normalmap,yI.displacementmap,yI.fog,yI.lights,{emissive:{value:new cI(0)},specular:{value:new cI(1118481)},shininess:{value:30}}]),vertexShader:wg.meshphong_vert,fragmentShader:wg.meshphong_frag},standard:{uniforms:Ei([yI.common,yI.envmap,yI.aomap,yI.lightmap,yI.emissivemap,yI.bumpmap,yI.normalmap,yI.displacementmap,yI.roughnessmap,yI.metalnessmap,yI.fog,yI.lights,{emissive:{value:new cI(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:wg.meshphysical_vert,fragmentShader:wg.meshphysical_frag},toon:{uniforms:Ei([yI.common,yI.aomap,yI.lightmap,yI.emissivemap,yI.bumpmap,yI.normalmap,yI.displacementmap,yI.gradientmap,yI.fog,yI.lights,{emissive:{value:new cI(0)}}]),vertexShader:wg.meshtoon_vert,fragmentShader:wg.meshtoon_frag},matcap:{uniforms:Ei([yI.common,yI.bumpmap,yI.normalmap,yI.displacementmap,yI.fog,{matcap:{value:null}}]),vertexShader:wg.meshmatcap_vert,fragmentShader:wg.meshmatcap_frag},points:{uniforms:Ei([yI.points,yI.fog]),vertexShader:wg.points_vert,fragmentShader:wg.points_frag},dashed:{uniforms:Ei([yI.common,yI.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:wg.linedashed_vert,fragmentShader:wg.linedashed_frag},depth:{uniforms:Ei([yI.common,yI.displacementmap]),vertexShader:wg.depth_vert,fragmentShader:wg.depth_frag},normal:{uniforms:Ei([yI.common,yI.bumpmap,yI.normalmap,yI.displacementmap,{opacity:{value:1}}]),vertexShader:wg.meshnormal_vert,fragmentShader:wg.meshnormal_frag},sprite:{uniforms:Ei([yI.sprite,yI.fog]),vertexShader:wg.sprite_vert,fragmentShader:wg.sprite_frag},background:{uniforms:{uvTransform:{value:new sg},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:wg.background_vert,fragmentShader:wg.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new sg}},vertexShader:wg.backgroundCube_vert,fragmentShader:wg.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:wg.cube_vert,fragmentShader:wg.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:wg.equirect_vert,fragmentShader:wg.equirect_frag},distanceRGBA:{uniforms:Ei([yI.common,yI.displacementmap,{referencePosition:{value:new Z},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:wg.distanceRGBA_vert,fragmentShader:wg.distanceRGBA_frag},shadow:{uniforms:Ei([yI.lights,yI.fog,{color:{value:new cI(0)},opacity:{value:1}}]),vertexShader:wg.shadow_vert,fragmentShader:wg.shadow_frag}};xQ.physical={uniforms:Ei([xQ.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new sg},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new sg},clearcoatNormalScale:{value:new PA(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new sg},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new sg},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new sg},sheen:{value:0},sheenColor:{value:new cI(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new sg},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new sg},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new sg},transmissionSamplerSize:{value:new PA},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new sg},attenuationDistance:{value:0},attenuationColor:{value:new cI(0)},specularColor:{value:new cI(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new sg},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new sg},anisotropyVector:{value:new PA},anisotropyMap:{value:null},anisotropyMapTransform:{value:new sg}}]),vertexShader:wg.meshphysical_vert,fragmentShader:wg.meshphysical_frag};const FD={r:0,b:0,g:0},so=new ZB,Vf=new VI;function jf(B,A,I,g,C,i,e){const E=new cI(0);let n=i===!0?0:1,a,l,D=null,h=0,S=null;function G(d){let J=d.isScene===!0?d.background:null;return J&&J.isTexture&&(J=(d.backgroundBlurriness>0?I:A).get(J)),J}function U(d){let J=!1;const F=G(d);F===null?y(E,n):F&&F.isColor&&(y(F,1),J=!0);const v=B.xr.getEnvironmentBlendMode();v==="additive"?g.buffers.color.setClear(0,0,0,1,e):v==="alpha-blend"&&g.buffers.color.setClear(0,0,0,0,e),(B.autoClear||J)&&(g.buffers.depth.setTest(!0),g.buffers.depth.setMask(!0),g.buffers.color.setMask(!0),B.clear(B.autoClearColor,B.autoClearDepth,B.autoClearStencil))}function k(d,J){const F=G(J);F&&(F.isCubeTexture||F.mapping===Vs)?(l===void 0&&(l=new DC(new In(1,1,1),new ni({name:"BackgroundCubeMaterial",uniforms:vs(xQ.backgroundCube.uniforms),vertexShader:xQ.backgroundCube.vertexShader,fragmentShader:xQ.backgroundCube.fragmentShader,side:oi,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(v,m,x){this.matrixWorld.copyPosition(x.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),C.update(l)),so.copy(J.backgroundRotation),so.x*=-1,so.y*=-1,so.z*=-1,F.isCubeTexture&&F.isRenderTargetTexture===!1&&(so.y*=-1,so.z*=-1),l.material.uniforms.envMap.value=F,l.material.uniforms.flipEnvMap.value=F.isCubeTexture&&F.isRenderTargetTexture===!1?-1:1,l.material.uniforms.backgroundBlurriness.value=J.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=J.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(Vf.makeRotationFromEuler(so)),l.material.toneMapped=Kg.getTransfer(F.colorSpace)!==Xg,(D!==F||h!==F.version||S!==B.toneMapping)&&(l.material.needsUpdate=!0,D=F,h=F.version,S=B.toneMapping),l.layers.enableAll(),d.unshift(l,l.geometry,l.material,0,0,null)):F&&F.isTexture&&(a===void 0&&(a=new DC(new wt(2,2),new ni({name:"BackgroundMaterial",uniforms:vs(xQ.background.uniforms),vertexShader:xQ.background.vertexShader,fragmentShader:xQ.background.fragmentShader,side:re,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),C.update(a)),a.material.uniforms.t2D.value=F,a.material.uniforms.backgroundIntensity.value=J.backgroundIntensity,a.material.toneMapped=Kg.getTransfer(F.colorSpace)!==Xg,F.matrixAutoUpdate===!0&&F.updateMatrix(),a.material.uniforms.uvTransform.value.copy(F.matrix),(D!==F||h!==F.version||S!==B.toneMapping)&&(a.material.needsUpdate=!0,D=F,h=F.version,S=B.toneMapping),a.layers.enableAll(),d.unshift(a,a.geometry,a.material,0,0,null))}function y(d,J){d.getRGB(FD,Qp(B)),g.buffers.color.setClear(FD.r,FD.g,FD.b,J,e)}return{getClearColor:function(){return E},setClearColor:function(d,J=1){E.set(d),n=J,y(E,n)},getClearAlpha:function(){return n},setClearAlpha:function(d){n=d,y(E,n)},render:U,addToRenderList:k}}function Xf(B,A){const I=B.getParameter(B.MAX_VERTEX_ATTRIBS),g={},C=h(null);let i=C,e=!1;function E(Y,b,IA,CA,nA){let uA=!1;const EA=D(CA,IA,b);i!==EA&&(i=EA,a(i.object)),uA=S(Y,CA,IA,nA),uA&&G(Y,CA,IA,nA),nA!==null&&A.update(nA,B.ELEMENT_ARRAY_BUFFER),(uA||e)&&(e=!1,F(Y,b,IA,CA),nA!==null&&B.bindBuffer(B.ELEMENT_ARRAY_BUFFER,A.get(nA).buffer))}function n(){return B.createVertexArray()}function a(Y){return B.bindVertexArray(Y)}function l(Y){return B.deleteVertexArray(Y)}function D(Y,b,IA){const CA=IA.wireframe===!0;let nA=g[Y.id];nA===void 0&&(nA={},g[Y.id]=nA);let uA=nA[b.id];uA===void 0&&(uA={},nA[b.id]=uA);let EA=uA[CA];return EA===void 0&&(EA=h(n()),uA[CA]=EA),EA}function h(Y){const b=[],IA=[],CA=[];for(let nA=0;nA=0){const BA=nA[V];let P=uA[V];if(P===void 0&&(V==="instanceMatrix"&&Y.instanceMatrix&&(P=Y.instanceMatrix),V==="instanceColor"&&Y.instanceColor&&(P=Y.instanceColor)),BA===void 0||BA.attribute!==P||P&&BA.data!==P.data)return!0;EA++}return i.attributesNum!==EA||i.index!==CA}function G(Y,b,IA,CA){const nA={},uA=b.attributes;let EA=0;const pA=IA.getAttributes();for(const V in pA)if(pA[V].location>=0){let BA=uA[V];BA===void 0&&(V==="instanceMatrix"&&Y.instanceMatrix&&(BA=Y.instanceMatrix),V==="instanceColor"&&Y.instanceColor&&(BA=Y.instanceColor));const P={};P.attribute=BA,BA&&BA.data&&(P.data=BA.data),nA[V]=P,EA++}i.attributes=nA,i.attributesNum=EA,i.index=CA}function U(){const Y=i.newAttributes;for(let b=0,IA=Y.length;b=0){let aA=nA[pA];if(aA===void 0&&(pA==="instanceMatrix"&&Y.instanceMatrix&&(aA=Y.instanceMatrix),pA==="instanceColor"&&Y.instanceColor&&(aA=Y.instanceColor)),aA!==void 0){const BA=aA.normalized,P=aA.itemSize,oA=A.get(aA);if(oA===void 0)continue;const vA=oA.buffer,cA=oA.type,FA=oA.bytesPerElement,wA=cA===B.INT||cA===B.UNSIGNED_INT||aA.gpuType===gl;if(aA.isInterleavedBufferAttribute){const LA=aA.data,VA=LA.stride,WA=aA.offset;if(LA.isInstancedInterleavedBuffer){for(let BI=0;BI0&&B.getShaderPrecisionFormat(B.FRAGMENT_SHADER,B.HIGH_FLOAT).precision>0)return"highp";x="mediump"}return x==="mediump"&&B.getShaderPrecisionFormat(B.VERTEX_SHADER,B.MEDIUM_FLOAT).precision>0&&B.getShaderPrecisionFormat(B.FRAGMENT_SHADER,B.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a=I.precision!==void 0?I.precision:"highp";const l=n(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const D=I.logarithmicDepthBuffer===!0,h=I.reverseDepthBuffer===!0&&A.has("EXT_clip_control"),S=B.getParameter(B.MAX_TEXTURE_IMAGE_UNITS),G=B.getParameter(B.MAX_VERTEX_TEXTURE_IMAGE_UNITS),U=B.getParameter(B.MAX_TEXTURE_SIZE),k=B.getParameter(B.MAX_CUBE_MAP_TEXTURE_SIZE),y=B.getParameter(B.MAX_VERTEX_ATTRIBS),d=B.getParameter(B.MAX_VERTEX_UNIFORM_VECTORS),J=B.getParameter(B.MAX_VARYING_VECTORS),F=B.getParameter(B.MAX_FRAGMENT_UNIFORM_VECTORS),v=G>0,m=B.getParameter(B.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:i,getMaxPrecision:n,textureFormatReadable:e,textureTypeReadable:E,precision:a,logarithmicDepthBuffer:D,reverseDepthBuffer:h,maxTextures:S,maxVertexTextures:G,maxTextureSize:U,maxCubemapSize:k,maxAttributes:y,maxVertexUniforms:d,maxVaryings:J,maxFragmentUniforms:F,vertexTextures:v,maxSamples:m}}function AR(B){const A=this;let I=null,g=0,C=!1,i=!1;const e=new tt,E=new sg,n={value:null,needsUpdate:!1};this.uniform=n,this.numPlanes=0,this.numIntersection=0,this.init=function(D,h){const S=D.length!==0||h||g!==0||C;return C=h,g=D.length,S},this.beginShadows=function(){i=!0,l(null)},this.endShadows=function(){i=!1},this.setGlobalState=function(D,h){I=l(D,h,0)},this.setState=function(D,h,S){const G=D.clippingPlanes,U=D.clipIntersection,k=D.clipShadows,y=B.get(D);if(!C||G===null||G.length===0||i&&!k)i?l(null):a();else{const d=i?0:g,J=d*4;let F=y.clippingState||null;n.value=F,F=l(G,h,J,S);for(let v=0;v!==J;++v)F[v]=I[v];y.clippingState=F,this.numIntersection=U?this.numPlanes:0,this.numPlanes+=d}};function a(){n.value!==I&&(n.value=I,n.needsUpdate=g>0),A.numPlanes=g,A.numIntersection=0}function l(D,h,S,G){const U=D!==null?D.length:0;let k=null;if(U!==0){if(k=n.value,G!==!0||k===null){const y=S+U*4,d=h.matrixWorldInverse;E.getNormalMatrix(d),(k===null||k.length0){const a=new $y(n.height);return a.fromEquirectangularTexture(B,e),A.set(e,a),e.addEventListener("dispose",C),I(a.texture,e.mapping)}else return null}}return e}function C(e){const E=e.target;E.removeEventListener("dispose",C);const n=A.get(E);n!==void 0&&(A.delete(E),n.dispose())}function i(){A=new WeakMap}return{get:g,dispose:i}}class gn extends Ql{constructor(A=-1,I=1,g=1,C=-1,i=.1,e=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=A,this.right=I,this.top=g,this.bottom=C,this.near=i,this.far=e,this.updateProjectionMatrix()}copy(A,I){return super.copy(A,I),this.left=A.left,this.right=A.right,this.top=A.top,this.bottom=A.bottom,this.near=A.near,this.far=A.far,this.zoom=A.zoom,this.view=A.view===null?null:Object.assign({},A.view),this}setViewOffset(A,I,g,C,i,e){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=A,this.view.fullHeight=I,this.view.offsetX=g,this.view.offsetY=C,this.view.width=i,this.view.height=e,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const A=(this.right-this.left)/(2*this.zoom),I=(this.top-this.bottom)/(2*this.zoom),g=(this.right+this.left)/2,C=(this.top+this.bottom)/2;let i=g-A,e=g+A,E=C+I,n=C-I;if(this.view!==null&&this.view.enabled){const a=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=a*this.view.offsetX,e=i+a*this.view.width,E-=l*this.view.offsetY,n=E-l*this.view.height}this.projectionMatrix.makeOrthographic(i,e,E,n,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(A){const I=super.toJSON(A);return I.object.zoom=this.zoom,I.object.left=this.left,I.object.right=this.right,I.object.top=this.top,I.object.bottom=this.bottom,I.object.near=this.near,I.object.far=this.far,this.view!==null&&(I.object.view=Object.assign({},this.view)),I}}const ds=4,xu=[.125,.215,.35,.446,.526,.582],Mo=20,kw=new gn,vu=new cI;let uw=null,Mw=0,Uw=0,pw=!1;const uo=(1+Math.sqrt(5))/2,hs=1/uo,Ou=[new Z(-uo,hs,0),new Z(uo,hs,0),new Z(-hs,0,uo),new Z(hs,0,uo),new Z(0,uo,-hs),new Z(0,uo,hs),new Z(-1,1,-1),new Z(1,1,-1),new Z(-1,1,1),new Z(1,1,1)];class ky{constructor(A){this._renderer=A,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(A,I=0,g=.1,C=100){uw=this._renderer.getRenderTarget(),Mw=this._renderer.getActiveCubeFace(),Uw=this._renderer.getActiveMipmapLevel(),pw=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const i=this._allocateTargets();return i.depthBuffer=!0,this._sceneToCubeUV(A,g,C,i),I>0&&this._blur(i,0,0,I),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(A,I=null){return this._fromTexture(A,I)}fromCubemap(A,I=null){return this._fromTexture(A,I)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Zu(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=_u(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(A){this._lodMax=Math.floor(Math.log2(A)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let A=0;A2?J:0,J,J),l.setRenderTarget(C),U&&l.render(G,E),l.render(A,E)}G.geometry.dispose(),G.material.dispose(),l.toneMapping=h,l.autoClear=D,A.background=k}_textureToCubeUV(A,I){const g=this._renderer,C=A.mapping===le||A.mapping===Dt;C?(this._cubemapMaterial===null&&(this._cubemapMaterial=Zu()),this._cubemapMaterial.uniforms.flipEnvMap.value=A.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=_u());const i=C?this._cubemapMaterial:this._equirectMaterial,e=new DC(this._lodPlanes[0],i),E=i.uniforms;E.envMap.value=A;const n=this._cubeSize;fD(I,0,0,3*n,2*n),g.setRenderTarget(I),g.render(e,kw)}_applyPMREM(A){const I=this._renderer,g=I.autoClear;I.autoClear=!1;const C=this._lodPlanes.length;for(let i=1;iMo&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${k} samples when the maximum is set to ${Mo}`);const y=[];let d=0;for(let x=0;xJ-ds?C-J+ds:0),m=4*(this._cubeSize-F);fD(I,v,m,3*F,2*F),n.setRenderTarget(I),n.render(D,kw)}}function gR(B){const A=[],I=[],g=[];let C=B;const i=B-ds+1+xu.length;for(let e=0;eB-ds?n=xu[e-B+ds-1]:e===0&&(n=0),g.push(n);const a=1/(E-2),l=-a,D=1+a,h=[l,l,D,l,D,D,l,l,D,D,l,D],S=6,G=6,U=3,k=2,y=1,d=new Float32Array(U*G*S),J=new Float32Array(k*G*S),F=new Float32Array(y*G*S);for(let m=0;m2?0:-1,L=[x,T,0,x+2/3,T,0,x+2/3,T+1,0,x,T,0,x+2/3,T+1,0,x,T+1,0];d.set(L,U*G*m),J.set(h,k*G*m);const Y=[m,m,m,m,m,m];F.set(Y,y*G*m)}const v=new tg;v.setAttribute("position",new Eg(d,U)),v.setAttribute("uv",new Eg(J,k)),v.setAttribute("faceIndex",new Eg(F,y)),A.push(v),C>ds&&C--}return{lodPlanes:A,sizeLods:I,sigmas:g}}function bu(B,A,I){const g=new bi(B,A,I);return g.texture.mapping=Vs,g.texture.name="PMREM.cubeUv",g.scissorTest=!0,g}function fD(B,A,I,g,C){B.viewport.set(A,I,g,C),B.scissor.set(A,I,g,C)}function CR(B,A,I){const g=new Float32Array(Mo),C=new Z(0,1,0);return new ni({name:"SphericalGaussianBlur",defines:{n:Mo,CUBEUV_TEXEL_WIDTH:1/A,CUBEUV_TEXEL_HEIGHT:1/I,CUBEUV_MAX_MIP:`${B}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:g},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:C}},vertexShader:AG(),fragmentShader:`
precision mediump float;
precision mediump int;
@@ -3761,7 +3761,7 @@ void main() {
gl_Position = vec4( position, 1.0 );
}
- `}function BR(B){let A=new WeakMap,I=null;function g(E){if(E&&E.isTexture){const n=E.mapping,a=n===Ys||n===Rr,r=n===le||n===Dt;if(a||r){let D=A.get(E);const h=D!==void 0?D.texture.pmremVersion:0;if(E.isRenderTargetTexture&&E.pmremVersion!==h)return I===null&&(I=new ky(B)),D=a?I.fromEquirectangular(E,D):I.fromCubemap(E,D),D.texture.pmremVersion=E.pmremVersion,A.set(E,D),D.texture;if(D!==void 0)return D.texture;{const S=E.image;return a&&S&&S.height>0||r&&S&&C(S)?(I===null&&(I=new ky(B)),D=a?I.fromEquirectangular(E):I.fromCubemap(E),D.texture.pmremVersion=E.pmremVersion,A.set(E,D),E.addEventListener("dispose",i),D.texture):null}}}return E}function C(E){let n=0;const a=6;for(let r=0;rA.maxTextureSize&&(m=Math.ceil(v/A.maxTextureSize),v=A.maxTextureSize);const x=new Float32Array(v*m*4*D),T=new Nc(x,v,m,D);T.type=yC,T.needsUpdate=!0;const L=F*4;for(let b=0;b0)return B;const C=A*I;let i=Wu[C];if(i===void 0&&(i=new Float32Array(C),Wu[C]=i),A!==0){g.toArray(i,0);for(let e=1,E=0;e!==A;++e)E+=I,B[e].toArray(i,E)}return i}function QB(B,A){if(B.length!==A.length)return!1;for(let I=0,g=B.length;I0||l&&S&&C(S)?(I===null&&(I=new ky(B)),D=a?I.fromEquirectangular(E):I.fromCubemap(E),D.texture.pmremVersion=E.pmremVersion,A.set(E,D),E.addEventListener("dispose",i),D.texture):null}}}return E}function C(E){let n=0;const a=6;for(let l=0;lA.maxTextureSize&&(m=Math.ceil(v/A.maxTextureSize),v=A.maxTextureSize);const x=new Float32Array(v*m*4*D),T=new Nc(x,v,m,D);T.type=yC,T.needsUpdate=!0;const L=F*4;for(let b=0;b0)return B;const C=A*I;let i=Wu[C];if(i===void 0&&(i=new Float32Array(C),Wu[C]=i),A!==0){g.toArray(i,0);for(let e=1,E=0;e!==A;++e)E+=I,B[e].toArray(i,E)}return i}function QB(B,A){if(B.length!==A.length)return!1;for(let I=0,g=B.length;I":" "} ${E}: ${I[e]}`)}return g.join(`
`)}const I0=new sg;function BL(B){Kg._getMatrix(I0,Kg.workingColorSpace,B);const A=`mat3( ${I0.elements.map(I=>I.toFixed(4))} )`;switch(Kg.getTransfer(B)){case il:return[A,"LinearTransferOETF"];case Xg:return[A,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",B),[A,"LinearTransferOETF"]}}function g0(B,A,I){const g=B.getShaderParameter(A,B.COMPILE_STATUS),C=B.getShaderInfoLog(A).trim();if(g&&C==="")return"";const i=/ERROR: 0:(\d+)/.exec(C);if(i){const e=parseInt(i[1]);return I.toUpperCase()+`
@@ -3791,14 +3791,14 @@ void main() {
`;return B.precision==="highp"?A+=`
#define HIGH_PRECISION`:B.precision==="mediump"?A+=`
#define MEDIUM_PRECISION`:B.precision==="lowp"&&(A+=`
-#define LOW_PRECISION`),A}function DL(B){let A="SHADOWMAP_TYPE_BASIC";return B.shadowMapType===Sc?A="SHADOWMAP_TYPE_PCF":B.shadowMapType===kr?A="SHADOWMAP_TYPE_PCF_SOFT":B.shadowMapType===HQ&&(A="SHADOWMAP_TYPE_VSM"),A}function hL(B){let A="ENVMAP_TYPE_CUBE";if(B.envMap)switch(B.envMapMode){case le:case Dt:A="ENVMAP_TYPE_CUBE";break;case Vs:A="ENVMAP_TYPE_CUBE_UV";break}return A}function cL(B){let A="ENVMAP_MODE_REFLECTION";if(B.envMap)switch(B.envMapMode){case Dt:A="ENVMAP_MODE_REFRACTION";break}return A}function SL(B){let A="ENVMAP_BLENDING_NONE";if(B.envMap)switch(B.combine){case Il:A="ENVMAP_BLENDING_MULTIPLY";break;case KU:A="ENVMAP_BLENDING_MIX";break;case FU:A="ENVMAP_BLENDING_ADD";break}return A}function wL(B){const A=B.envMapCubeUVHeight;if(A===null)return null;const I=Math.log2(A)-2,g=1/A;return{texelWidth:1/(3*Math.max(Math.pow(2,I),112)),texelHeight:g,maxMip:I}}function yL(B,A,I,g){const C=B.getContext(),i=I.defines;let e=I.vertexShader,E=I.fragmentShader;const n=DL(I),a=hL(I),r=cL(I),D=SL(I),h=wL(I),S=EL(I),G=tL(i),U=C.createProgram();let k,y,d=I.glslVersion?"#version "+I.glslVersion+`
+#define LOW_PRECISION`),A}function DL(B){let A="SHADOWMAP_TYPE_BASIC";return B.shadowMapType===Sc?A="SHADOWMAP_TYPE_PCF":B.shadowMapType===kr?A="SHADOWMAP_TYPE_PCF_SOFT":B.shadowMapType===HQ&&(A="SHADOWMAP_TYPE_VSM"),A}function hL(B){let A="ENVMAP_TYPE_CUBE";if(B.envMap)switch(B.envMapMode){case le:case Dt:A="ENVMAP_TYPE_CUBE";break;case Vs:A="ENVMAP_TYPE_CUBE_UV";break}return A}function cL(B){let A="ENVMAP_MODE_REFLECTION";if(B.envMap)switch(B.envMapMode){case Dt:A="ENVMAP_MODE_REFRACTION";break}return A}function SL(B){let A="ENVMAP_BLENDING_NONE";if(B.envMap)switch(B.combine){case Il:A="ENVMAP_BLENDING_MULTIPLY";break;case KU:A="ENVMAP_BLENDING_MIX";break;case FU:A="ENVMAP_BLENDING_ADD";break}return A}function wL(B){const A=B.envMapCubeUVHeight;if(A===null)return null;const I=Math.log2(A)-2,g=1/A;return{texelWidth:1/(3*Math.max(Math.pow(2,I),112)),texelHeight:g,maxMip:I}}function yL(B,A,I,g){const C=B.getContext(),i=I.defines;let e=I.vertexShader,E=I.fragmentShader;const n=DL(I),a=hL(I),l=cL(I),D=SL(I),h=wL(I),S=EL(I),G=tL(i),U=C.createProgram();let k,y,d=I.glslVersion?"#version "+I.glslVersion+`
`:"";I.isRawShaderMaterial?(k=["#define SHADER_TYPE "+I.shaderType,"#define SHADER_NAME "+I.shaderName,G].filter(hr).join(`
`),k.length>0&&(k+=`
`),y=["#define SHADER_TYPE "+I.shaderType,"#define SHADER_NAME "+I.shaderName,G].filter(hr).join(`
`),y.length>0&&(y+=`
-`)):(k=[Q0(I),"#define SHADER_TYPE "+I.shaderType,"#define SHADER_NAME "+I.shaderName,G,I.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",I.batching?"#define USE_BATCHING":"",I.batchingColor?"#define USE_BATCHING_COLOR":"",I.instancing?"#define USE_INSTANCING":"",I.instancingColor?"#define USE_INSTANCING_COLOR":"",I.instancingMorph?"#define USE_INSTANCING_MORPH":"",I.useFog&&I.fog?"#define USE_FOG":"",I.useFog&&I.fogExp2?"#define FOG_EXP2":"",I.map?"#define USE_MAP":"",I.envMap?"#define USE_ENVMAP":"",I.envMap?"#define "+r:"",I.lightMap?"#define USE_LIGHTMAP":"",I.aoMap?"#define USE_AOMAP":"",I.bumpMap?"#define USE_BUMPMAP":"",I.normalMap?"#define USE_NORMALMAP":"",I.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",I.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",I.displacementMap?"#define USE_DISPLACEMENTMAP":"",I.emissiveMap?"#define USE_EMISSIVEMAP":"",I.anisotropy?"#define USE_ANISOTROPY":"",I.anisotropyMap?"#define USE_ANISOTROPYMAP":"",I.clearcoatMap?"#define USE_CLEARCOATMAP":"",I.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",I.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",I.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",I.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",I.specularMap?"#define USE_SPECULARMAP":"",I.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",I.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",I.roughnessMap?"#define USE_ROUGHNESSMAP":"",I.metalnessMap?"#define USE_METALNESSMAP":"",I.alphaMap?"#define USE_ALPHAMAP":"",I.alphaHash?"#define USE_ALPHAHASH":"",I.transmission?"#define USE_TRANSMISSION":"",I.transmissionMap?"#define USE_TRANSMISSIONMAP":"",I.thicknessMap?"#define USE_THICKNESSMAP":"",I.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",I.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",I.mapUv?"#define MAP_UV "+I.mapUv:"",I.alphaMapUv?"#define ALPHAMAP_UV "+I.alphaMapUv:"",I.lightMapUv?"#define LIGHTMAP_UV "+I.lightMapUv:"",I.aoMapUv?"#define AOMAP_UV "+I.aoMapUv:"",I.emissiveMapUv?"#define EMISSIVEMAP_UV "+I.emissiveMapUv:"",I.bumpMapUv?"#define BUMPMAP_UV "+I.bumpMapUv:"",I.normalMapUv?"#define NORMALMAP_UV "+I.normalMapUv:"",I.displacementMapUv?"#define DISPLACEMENTMAP_UV "+I.displacementMapUv:"",I.metalnessMapUv?"#define METALNESSMAP_UV "+I.metalnessMapUv:"",I.roughnessMapUv?"#define ROUGHNESSMAP_UV "+I.roughnessMapUv:"",I.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+I.anisotropyMapUv:"",I.clearcoatMapUv?"#define CLEARCOATMAP_UV "+I.clearcoatMapUv:"",I.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+I.clearcoatNormalMapUv:"",I.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+I.clearcoatRoughnessMapUv:"",I.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+I.iridescenceMapUv:"",I.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+I.iridescenceThicknessMapUv:"",I.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+I.sheenColorMapUv:"",I.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+I.sheenRoughnessMapUv:"",I.specularMapUv?"#define SPECULARMAP_UV "+I.specularMapUv:"",I.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+I.specularColorMapUv:"",I.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+I.specularIntensityMapUv:"",I.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+I.transmissionMapUv:"",I.thicknessMapUv?"#define THICKNESSMAP_UV "+I.thicknessMapUv:"",I.vertexTangents&&I.flatShading===!1?"#define USE_TANGENT":"",I.vertexColors?"#define USE_COLOR":"",I.vertexAlphas?"#define USE_COLOR_ALPHA":"",I.vertexUv1s?"#define USE_UV1":"",I.vertexUv2s?"#define USE_UV2":"",I.vertexUv3s?"#define USE_UV3":"",I.pointsUvs?"#define USE_POINTS_UV":"",I.flatShading?"#define FLAT_SHADED":"",I.skinning?"#define USE_SKINNING":"",I.morphTargets?"#define USE_MORPHTARGETS":"",I.morphNormals&&I.flatShading===!1?"#define USE_MORPHNORMALS":"",I.morphColors?"#define USE_MORPHCOLORS":"",I.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+I.morphTextureStride:"",I.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+I.morphTargetsCount:"",I.doubleSided?"#define DOUBLE_SIDED":"",I.flipSided?"#define FLIP_SIDED":"",I.shadowMapEnabled?"#define USE_SHADOWMAP":"",I.shadowMapEnabled?"#define "+n:"",I.sizeAttenuation?"#define USE_SIZEATTENUATION":"",I.numLightProbes>0?"#define USE_LIGHT_PROBES":"",I.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",I.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
+`)):(k=[Q0(I),"#define SHADER_TYPE "+I.shaderType,"#define SHADER_NAME "+I.shaderName,G,I.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",I.batching?"#define USE_BATCHING":"",I.batchingColor?"#define USE_BATCHING_COLOR":"",I.instancing?"#define USE_INSTANCING":"",I.instancingColor?"#define USE_INSTANCING_COLOR":"",I.instancingMorph?"#define USE_INSTANCING_MORPH":"",I.useFog&&I.fog?"#define USE_FOG":"",I.useFog&&I.fogExp2?"#define FOG_EXP2":"",I.map?"#define USE_MAP":"",I.envMap?"#define USE_ENVMAP":"",I.envMap?"#define "+l:"",I.lightMap?"#define USE_LIGHTMAP":"",I.aoMap?"#define USE_AOMAP":"",I.bumpMap?"#define USE_BUMPMAP":"",I.normalMap?"#define USE_NORMALMAP":"",I.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",I.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",I.displacementMap?"#define USE_DISPLACEMENTMAP":"",I.emissiveMap?"#define USE_EMISSIVEMAP":"",I.anisotropy?"#define USE_ANISOTROPY":"",I.anisotropyMap?"#define USE_ANISOTROPYMAP":"",I.clearcoatMap?"#define USE_CLEARCOATMAP":"",I.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",I.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",I.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",I.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",I.specularMap?"#define USE_SPECULARMAP":"",I.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",I.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",I.roughnessMap?"#define USE_ROUGHNESSMAP":"",I.metalnessMap?"#define USE_METALNESSMAP":"",I.alphaMap?"#define USE_ALPHAMAP":"",I.alphaHash?"#define USE_ALPHAHASH":"",I.transmission?"#define USE_TRANSMISSION":"",I.transmissionMap?"#define USE_TRANSMISSIONMAP":"",I.thicknessMap?"#define USE_THICKNESSMAP":"",I.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",I.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",I.mapUv?"#define MAP_UV "+I.mapUv:"",I.alphaMapUv?"#define ALPHAMAP_UV "+I.alphaMapUv:"",I.lightMapUv?"#define LIGHTMAP_UV "+I.lightMapUv:"",I.aoMapUv?"#define AOMAP_UV "+I.aoMapUv:"",I.emissiveMapUv?"#define EMISSIVEMAP_UV "+I.emissiveMapUv:"",I.bumpMapUv?"#define BUMPMAP_UV "+I.bumpMapUv:"",I.normalMapUv?"#define NORMALMAP_UV "+I.normalMapUv:"",I.displacementMapUv?"#define DISPLACEMENTMAP_UV "+I.displacementMapUv:"",I.metalnessMapUv?"#define METALNESSMAP_UV "+I.metalnessMapUv:"",I.roughnessMapUv?"#define ROUGHNESSMAP_UV "+I.roughnessMapUv:"",I.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+I.anisotropyMapUv:"",I.clearcoatMapUv?"#define CLEARCOATMAP_UV "+I.clearcoatMapUv:"",I.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+I.clearcoatNormalMapUv:"",I.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+I.clearcoatRoughnessMapUv:"",I.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+I.iridescenceMapUv:"",I.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+I.iridescenceThicknessMapUv:"",I.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+I.sheenColorMapUv:"",I.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+I.sheenRoughnessMapUv:"",I.specularMapUv?"#define SPECULARMAP_UV "+I.specularMapUv:"",I.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+I.specularColorMapUv:"",I.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+I.specularIntensityMapUv:"",I.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+I.transmissionMapUv:"",I.thicknessMapUv?"#define THICKNESSMAP_UV "+I.thicknessMapUv:"",I.vertexTangents&&I.flatShading===!1?"#define USE_TANGENT":"",I.vertexColors?"#define USE_COLOR":"",I.vertexAlphas?"#define USE_COLOR_ALPHA":"",I.vertexUv1s?"#define USE_UV1":"",I.vertexUv2s?"#define USE_UV2":"",I.vertexUv3s?"#define USE_UV3":"",I.pointsUvs?"#define USE_POINTS_UV":"",I.flatShading?"#define FLAT_SHADED":"",I.skinning?"#define USE_SKINNING":"",I.morphTargets?"#define USE_MORPHTARGETS":"",I.morphNormals&&I.flatShading===!1?"#define USE_MORPHNORMALS":"",I.morphColors?"#define USE_MORPHCOLORS":"",I.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+I.morphTextureStride:"",I.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+I.morphTargetsCount:"",I.doubleSided?"#define DOUBLE_SIDED":"",I.flipSided?"#define FLIP_SIDED":"",I.shadowMapEnabled?"#define USE_SHADOWMAP":"",I.shadowMapEnabled?"#define "+n:"",I.sizeAttenuation?"#define USE_SIZEATTENUATION":"",I.numLightProbes>0?"#define USE_LIGHT_PROBES":"",I.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",I.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
`].filter(hr).join(`
-`),y=[Q0(I),"#define SHADER_TYPE "+I.shaderType,"#define SHADER_NAME "+I.shaderName,G,I.useFog&&I.fog?"#define USE_FOG":"",I.useFog&&I.fogExp2?"#define FOG_EXP2":"",I.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",I.map?"#define USE_MAP":"",I.matcap?"#define USE_MATCAP":"",I.envMap?"#define USE_ENVMAP":"",I.envMap?"#define "+a:"",I.envMap?"#define "+r:"",I.envMap?"#define "+D:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",I.lightMap?"#define USE_LIGHTMAP":"",I.aoMap?"#define USE_AOMAP":"",I.bumpMap?"#define USE_BUMPMAP":"",I.normalMap?"#define USE_NORMALMAP":"",I.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",I.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",I.emissiveMap?"#define USE_EMISSIVEMAP":"",I.anisotropy?"#define USE_ANISOTROPY":"",I.anisotropyMap?"#define USE_ANISOTROPYMAP":"",I.clearcoat?"#define USE_CLEARCOAT":"",I.clearcoatMap?"#define USE_CLEARCOATMAP":"",I.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",I.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",I.dispersion?"#define USE_DISPERSION":"",I.iridescence?"#define USE_IRIDESCENCE":"",I.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",I.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",I.specularMap?"#define USE_SPECULARMAP":"",I.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",I.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",I.roughnessMap?"#define USE_ROUGHNESSMAP":"",I.metalnessMap?"#define USE_METALNESSMAP":"",I.alphaMap?"#define USE_ALPHAMAP":"",I.alphaTest?"#define USE_ALPHATEST":"",I.alphaHash?"#define USE_ALPHAHASH":"",I.sheen?"#define USE_SHEEN":"",I.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",I.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",I.transmission?"#define USE_TRANSMISSION":"",I.transmissionMap?"#define USE_TRANSMISSIONMAP":"",I.thicknessMap?"#define USE_THICKNESSMAP":"",I.vertexTangents&&I.flatShading===!1?"#define USE_TANGENT":"",I.vertexColors||I.instancingColor||I.batchingColor?"#define USE_COLOR":"",I.vertexAlphas?"#define USE_COLOR_ALPHA":"",I.vertexUv1s?"#define USE_UV1":"",I.vertexUv2s?"#define USE_UV2":"",I.vertexUv3s?"#define USE_UV3":"",I.pointsUvs?"#define USE_POINTS_UV":"",I.gradientMap?"#define USE_GRADIENTMAP":"",I.flatShading?"#define FLAT_SHADED":"",I.doubleSided?"#define DOUBLE_SIDED":"",I.flipSided?"#define FLIP_SIDED":"",I.shadowMapEnabled?"#define USE_SHADOWMAP":"",I.shadowMapEnabled?"#define "+n:"",I.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",I.numLightProbes>0?"#define USE_LIGHT_PROBES":"",I.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",I.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",I.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",I.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",I.toneMapping!==se?"#define TONE_MAPPING":"",I.toneMapping!==se?wg.tonemapping_pars_fragment:"",I.toneMapping!==se?QL("toneMapping",I.toneMapping):"",I.dithering?"#define DITHERING":"",I.opaque?"#define OPAQUE":"",wg.colorspace_pars_fragment,iL("linearToOutputTexel",I.outputColorSpace),eL(),I.useDepthPacking?"#define DEPTH_PACKING "+I.depthPacking:"",`
+`),y=[Q0(I),"#define SHADER_TYPE "+I.shaderType,"#define SHADER_NAME "+I.shaderName,G,I.useFog&&I.fog?"#define USE_FOG":"",I.useFog&&I.fogExp2?"#define FOG_EXP2":"",I.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",I.map?"#define USE_MAP":"",I.matcap?"#define USE_MATCAP":"",I.envMap?"#define USE_ENVMAP":"",I.envMap?"#define "+a:"",I.envMap?"#define "+l:"",I.envMap?"#define "+D:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",I.lightMap?"#define USE_LIGHTMAP":"",I.aoMap?"#define USE_AOMAP":"",I.bumpMap?"#define USE_BUMPMAP":"",I.normalMap?"#define USE_NORMALMAP":"",I.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",I.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",I.emissiveMap?"#define USE_EMISSIVEMAP":"",I.anisotropy?"#define USE_ANISOTROPY":"",I.anisotropyMap?"#define USE_ANISOTROPYMAP":"",I.clearcoat?"#define USE_CLEARCOAT":"",I.clearcoatMap?"#define USE_CLEARCOATMAP":"",I.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",I.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",I.dispersion?"#define USE_DISPERSION":"",I.iridescence?"#define USE_IRIDESCENCE":"",I.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",I.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",I.specularMap?"#define USE_SPECULARMAP":"",I.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",I.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",I.roughnessMap?"#define USE_ROUGHNESSMAP":"",I.metalnessMap?"#define USE_METALNESSMAP":"",I.alphaMap?"#define USE_ALPHAMAP":"",I.alphaTest?"#define USE_ALPHATEST":"",I.alphaHash?"#define USE_ALPHAHASH":"",I.sheen?"#define USE_SHEEN":"",I.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",I.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",I.transmission?"#define USE_TRANSMISSION":"",I.transmissionMap?"#define USE_TRANSMISSIONMAP":"",I.thicknessMap?"#define USE_THICKNESSMAP":"",I.vertexTangents&&I.flatShading===!1?"#define USE_TANGENT":"",I.vertexColors||I.instancingColor||I.batchingColor?"#define USE_COLOR":"",I.vertexAlphas?"#define USE_COLOR_ALPHA":"",I.vertexUv1s?"#define USE_UV1":"",I.vertexUv2s?"#define USE_UV2":"",I.vertexUv3s?"#define USE_UV3":"",I.pointsUvs?"#define USE_POINTS_UV":"",I.gradientMap?"#define USE_GRADIENTMAP":"",I.flatShading?"#define FLAT_SHADED":"",I.doubleSided?"#define DOUBLE_SIDED":"",I.flipSided?"#define FLIP_SIDED":"",I.shadowMapEnabled?"#define USE_SHADOWMAP":"",I.shadowMapEnabled?"#define "+n:"",I.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",I.numLightProbes>0?"#define USE_LIGHT_PROBES":"",I.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",I.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",I.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",I.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",I.toneMapping!==se?"#define TONE_MAPPING":"",I.toneMapping!==se?wg.tonemapping_pars_fragment:"",I.toneMapping!==se?QL("toneMapping",I.toneMapping):"",I.dithering?"#define DITHERING":"",I.opaque?"#define OPAQUE":"",wg.colorspace_pars_fragment,iL("linearToOutputTexel",I.outputColorSpace),eL(),I.useDepthPacking?"#define DEPTH_PACKING "+I.depthPacking:"",`
`].filter(hr).join(`
`)),e=uy(e),e=C0(e,I),e=B0(e,I),E=uy(E),E=C0(E,I),E=B0(E,I),e=i0(e),E=i0(E),I.isRawShaderMaterial!==!0&&(d=`#version 300 es
`,k=[S,"#define attribute in","#define varying out","#define texture2D texture"].join(`
@@ -3812,7 +3812,7 @@ Material Type: `+b.type+`
Program Info Log: `+IA+`
`+pA+`
-`+V)}else IA!==""?console.warn("THREE.WebGLProgram: Program Info Log:",IA):(CA===""||nA==="")&&(EA=!1);EA&&(b.diagnostics={runnable:uA,programLog:IA,vertexShader:{log:CA,prefix:k},fragmentShader:{log:nA,prefix:y}})}C.deleteShader(v),C.deleteShader(m),T=new Dh(C,U),L=oL(C,U)}let T;this.getUniforms=function(){return T===void 0&&x(this),T};let L;this.getAttributes=function(){return L===void 0&&x(this),L};let Y=I.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return Y===!1&&(Y=C.getProgramParameter(U,IL)),Y},this.destroy=function(){g.releaseStatesOfProgram(this),C.deleteProgram(U),this.program=void 0},this.type=I.shaderType,this.name=I.shaderName,this.id=gL++,this.cacheKey=A,this.usedTimes=1,this.program=U,this.vertexShader=v,this.fragmentShader=m,this}let GL=0;class kL{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(A){const I=A.vertexShader,g=A.fragmentShader,C=this._getShaderStage(I),i=this._getShaderStage(g),e=this._getShaderCacheForMaterial(A);return e.has(C)===!1&&(e.add(C),C.usedTimes++),e.has(i)===!1&&(e.add(i),i.usedTimes++),this}remove(A){const I=this.materialCache.get(A);for(const g of I)g.usedTimes--,g.usedTimes===0&&this.shaderCache.delete(g.code);return this.materialCache.delete(A),this}getVertexShaderID(A){return this._getShaderStage(A.vertexShader).id}getFragmentShaderID(A){return this._getShaderStage(A.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(A){const I=this.materialCache;let g=I.get(A);return g===void 0&&(g=new Set,I.set(A,g)),g}_getShaderStage(A){const I=this.shaderCache;let g=I.get(A);return g===void 0&&(g=new uL(A),I.set(A,g)),g}}class uL{constructor(A){this.id=GL++,this.code=A,this.usedTimes=0}}function ML(B,A,I,g,C,i,e){const E=new Ho,n=new kL,a=new Set,r=[],D=C.logarithmicDepthBuffer,h=C.vertexTextures;let S=C.precision;const G={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"};function U(L){return a.add(L),L===0?"uv":`uv${L}`}function k(L,Y,b,IA,CA){const nA=IA.fog,uA=CA.geometry,EA=L.isMeshStandardMaterial?IA.environment:null,pA=(L.isMeshStandardMaterial?I:A).get(L.envMap||EA),V=pA&&pA.mapping===Vs?pA.image.height:null,aA=G[L.type];L.precision!==null&&(S=C.getMaxPrecision(L.precision),S!==L.precision&&console.warn("THREE.WebGLProgram.getParameters:",L.precision,"not supported, using",S,"instead."));const BA=uA.morphAttributes.position||uA.morphAttributes.normal||uA.morphAttributes.color,P=BA!==void 0?BA.length:0;let oA=0;uA.morphAttributes.position!==void 0&&(oA=1),uA.morphAttributes.normal!==void 0&&(oA=2),uA.morphAttributes.color!==void 0&&(oA=3);let vA,cA,FA,wA;if(aA){const kg=xQ[aA];vA=kg.vertexShader,cA=kg.fragmentShader}else vA=L.vertexShader,cA=L.fragmentShader,n.update(L),FA=n.getVertexShaderID(L),wA=n.getFragmentShaderID(L);const LA=B.getRenderTarget(),VA=B.state.buffers.depth.getReversed(),WA=CA.isInstancedMesh===!0,BI=CA.isBatchedMesh===!0,pI=!!L.map,TA=!!L.matcap,_A=!!pA,$=!!L.aoMap,SI=!!L.lightMap,jA=!!L.bumpMap,lI=!!L.normalMap,CI=!!L.displacementMap,HI=!!L.emissiveMap,nI=!!L.metalnessMap,W=!!L.roughnessMap,O=L.anisotropy>0,MA=L.clearcoat>0,HA=L.dispersion>0,ZA=L.iridescence>0,xA=L.sheen>0,UI=L.transmission>0,tI=O&&!!L.anisotropyMap,DI=MA&&!!L.clearcoatMap,Ig=MA&&!!L.clearcoatNormalMap,zA=MA&&!!L.clearcoatRoughnessMap,uI=ZA&&!!L.iridescenceMap,LI=ZA&&!!L.iridescenceThicknessMap,JI=xA&&!!L.sheenColorMap,kI=xA&&!!L.sheenRoughnessMap,$I=!!L.specularMap,RI=!!L.specularColorMap,ZI=!!L.specularIntensityMap,sA=UI&&!!L.transmissionMap,KA=UI&&!!L.thicknessMap,fA=!!L.gradientMap,bA=!!L.alphaMap,hI=L.alphaTest>0,aI=!!L.alphaHash,PI=!!L.extensions;let Yg=se;L.toneMapped&&(LA===null||LA.isXRRenderTarget===!0)&&(Yg=B.toneMapping);const nC={shaderID:aA,shaderType:L.type,shaderName:L.name,vertexShader:vA,fragmentShader:cA,defines:L.defines,customVertexShaderID:FA,customFragmentShaderID:wA,isRawShaderMaterial:L.isRawShaderMaterial===!0,glslVersion:L.glslVersion,precision:S,batching:BI,batchingColor:BI&&CA._colorsTexture!==null,instancing:WA,instancingColor:WA&&CA.instanceColor!==null,instancingMorph:WA&&CA.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:LA===null?B.outputColorSpace:LA.isXRRenderTarget===!0?LA.texture.colorSpace:ce,alphaToCoverage:!!L.alphaToCoverage,map:pI,matcap:TA,envMap:_A,envMapMode:_A&&pA.mapping,envMapCubeUVHeight:V,aoMap:$,lightMap:SI,bumpMap:jA,normalMap:lI,displacementMap:h&&CI,emissiveMap:HI,normalMapObjectSpace:lI&&L.normalMapType===ZU,normalMapTangentSpace:lI&&L.normalMapType===St,metalnessMap:nI,roughnessMap:W,anisotropy:O,anisotropyMap:tI,clearcoat:MA,clearcoatMap:DI,clearcoatNormalMap:Ig,clearcoatRoughnessMap:zA,dispersion:HA,iridescence:ZA,iridescenceMap:uI,iridescenceThicknessMap:LI,sheen:xA,sheenColorMap:JI,sheenRoughnessMap:kI,specularMap:$I,specularColorMap:RI,specularIntensityMap:ZI,transmission:UI,transmissionMap:sA,thicknessMap:KA,gradientMap:fA,opaque:L.transparent===!1&&L.blending===Yo&&L.alphaToCoverage===!1,alphaMap:bA,alphaTest:hI,alphaHash:aI,combine:L.combine,mapUv:pI&&U(L.map.channel),aoMapUv:$&&U(L.aoMap.channel),lightMapUv:SI&&U(L.lightMap.channel),bumpMapUv:jA&&U(L.bumpMap.channel),normalMapUv:lI&&U(L.normalMap.channel),displacementMapUv:CI&&U(L.displacementMap.channel),emissiveMapUv:HI&&U(L.emissiveMap.channel),metalnessMapUv:nI&&U(L.metalnessMap.channel),roughnessMapUv:W&&U(L.roughnessMap.channel),anisotropyMapUv:tI&&U(L.anisotropyMap.channel),clearcoatMapUv:DI&&U(L.clearcoatMap.channel),clearcoatNormalMapUv:Ig&&U(L.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:zA&&U(L.clearcoatRoughnessMap.channel),iridescenceMapUv:uI&&U(L.iridescenceMap.channel),iridescenceThicknessMapUv:LI&&U(L.iridescenceThicknessMap.channel),sheenColorMapUv:JI&&U(L.sheenColorMap.channel),sheenRoughnessMapUv:kI&&U(L.sheenRoughnessMap.channel),specularMapUv:$I&&U(L.specularMap.channel),specularColorMapUv:RI&&U(L.specularColorMap.channel),specularIntensityMapUv:ZI&&U(L.specularIntensityMap.channel),transmissionMapUv:sA&&U(L.transmissionMap.channel),thicknessMapUv:KA&&U(L.thicknessMap.channel),alphaMapUv:bA&&U(L.alphaMap.channel),vertexTangents:!!uA.attributes.tangent&&(lI||O),vertexColors:L.vertexColors,vertexAlphas:L.vertexColors===!0&&!!uA.attributes.color&&uA.attributes.color.itemSize===4,pointsUvs:CA.isPoints===!0&&!!uA.attributes.uv&&(pI||bA),fog:!!nA,useFog:L.fog===!0,fogExp2:!!nA&&nA.isFogExp2,flatShading:L.flatShading===!0,sizeAttenuation:L.sizeAttenuation===!0,logarithmicDepthBuffer:D,reverseDepthBuffer:VA,skinning:CA.isSkinnedMesh===!0,morphTargets:uA.morphAttributes.position!==void 0,morphNormals:uA.morphAttributes.normal!==void 0,morphColors:uA.morphAttributes.color!==void 0,morphTargetsCount:P,morphTextureStride:oA,numDirLights:Y.directional.length,numPointLights:Y.point.length,numSpotLights:Y.spot.length,numSpotLightMaps:Y.spotLightMap.length,numRectAreaLights:Y.rectArea.length,numHemiLights:Y.hemi.length,numDirLightShadows:Y.directionalShadowMap.length,numPointLightShadows:Y.pointShadowMap.length,numSpotLightShadows:Y.spotShadowMap.length,numSpotLightShadowsWithMaps:Y.numSpotLightShadowsWithMaps,numLightProbes:Y.numLightProbes,numClippingPlanes:e.numPlanes,numClipIntersection:e.numIntersection,dithering:L.dithering,shadowMapEnabled:B.shadowMap.enabled&&b.length>0,shadowMapType:B.shadowMap.type,toneMapping:Yg,decodeVideoTexture:pI&&L.map.isVideoTexture===!0&&Kg.getTransfer(L.map.colorSpace)===Xg,decodeVideoTextureEmissive:HI&&L.emissiveMap.isVideoTexture===!0&&Kg.getTransfer(L.emissiveMap.colorSpace)===Xg,premultipliedAlpha:L.premultipliedAlpha,doubleSided:L.side===vi,flipSided:L.side===oi,useDepthPacking:L.depthPacking>=0,depthPacking:L.depthPacking||0,index0AttributeName:L.index0AttributeName,extensionClipCullDistance:PI&&L.extensions.clipCullDistance===!0&&g.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(PI&&L.extensions.multiDraw===!0||BI)&&g.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:g.has("KHR_parallel_shader_compile"),customProgramCacheKey:L.customProgramCacheKey()};return nC.vertexUv1s=a.has(1),nC.vertexUv2s=a.has(2),nC.vertexUv3s=a.has(3),a.clear(),nC}function y(L){const Y=[];if(L.shaderID?Y.push(L.shaderID):(Y.push(L.customVertexShaderID),Y.push(L.customFragmentShaderID)),L.defines!==void 0)for(const b in L.defines)Y.push(b),Y.push(L.defines[b]);return L.isRawShaderMaterial===!1&&(d(Y,L),J(Y,L),Y.push(B.outputColorSpace)),Y.push(L.customProgramCacheKey),Y.join()}function d(L,Y){L.push(Y.precision),L.push(Y.outputColorSpace),L.push(Y.envMapMode),L.push(Y.envMapCubeUVHeight),L.push(Y.mapUv),L.push(Y.alphaMapUv),L.push(Y.lightMapUv),L.push(Y.aoMapUv),L.push(Y.bumpMapUv),L.push(Y.normalMapUv),L.push(Y.displacementMapUv),L.push(Y.emissiveMapUv),L.push(Y.metalnessMapUv),L.push(Y.roughnessMapUv),L.push(Y.anisotropyMapUv),L.push(Y.clearcoatMapUv),L.push(Y.clearcoatNormalMapUv),L.push(Y.clearcoatRoughnessMapUv),L.push(Y.iridescenceMapUv),L.push(Y.iridescenceThicknessMapUv),L.push(Y.sheenColorMapUv),L.push(Y.sheenRoughnessMapUv),L.push(Y.specularMapUv),L.push(Y.specularColorMapUv),L.push(Y.specularIntensityMapUv),L.push(Y.transmissionMapUv),L.push(Y.thicknessMapUv),L.push(Y.combine),L.push(Y.fogExp2),L.push(Y.sizeAttenuation),L.push(Y.morphTargetsCount),L.push(Y.morphAttributeCount),L.push(Y.numDirLights),L.push(Y.numPointLights),L.push(Y.numSpotLights),L.push(Y.numSpotLightMaps),L.push(Y.numHemiLights),L.push(Y.numRectAreaLights),L.push(Y.numDirLightShadows),L.push(Y.numPointLightShadows),L.push(Y.numSpotLightShadows),L.push(Y.numSpotLightShadowsWithMaps),L.push(Y.numLightProbes),L.push(Y.shadowMapType),L.push(Y.toneMapping),L.push(Y.numClippingPlanes),L.push(Y.numClipIntersection),L.push(Y.depthPacking)}function J(L,Y){E.disableAll(),Y.supportsVertexTextures&&E.enable(0),Y.instancing&&E.enable(1),Y.instancingColor&&E.enable(2),Y.instancingMorph&&E.enable(3),Y.matcap&&E.enable(4),Y.envMap&&E.enable(5),Y.normalMapObjectSpace&&E.enable(6),Y.normalMapTangentSpace&&E.enable(7),Y.clearcoat&&E.enable(8),Y.iridescence&&E.enable(9),Y.alphaTest&&E.enable(10),Y.vertexColors&&E.enable(11),Y.vertexAlphas&&E.enable(12),Y.vertexUv1s&&E.enable(13),Y.vertexUv2s&&E.enable(14),Y.vertexUv3s&&E.enable(15),Y.vertexTangents&&E.enable(16),Y.anisotropy&&E.enable(17),Y.alphaHash&&E.enable(18),Y.batching&&E.enable(19),Y.dispersion&&E.enable(20),Y.batchingColor&&E.enable(21),L.push(E.mask),E.disableAll(),Y.fog&&E.enable(0),Y.useFog&&E.enable(1),Y.flatShading&&E.enable(2),Y.logarithmicDepthBuffer&&E.enable(3),Y.reverseDepthBuffer&&E.enable(4),Y.skinning&&E.enable(5),Y.morphTargets&&E.enable(6),Y.morphNormals&&E.enable(7),Y.morphColors&&E.enable(8),Y.premultipliedAlpha&&E.enable(9),Y.shadowMapEnabled&&E.enable(10),Y.doubleSided&&E.enable(11),Y.flipSided&&E.enable(12),Y.useDepthPacking&&E.enable(13),Y.dithering&&E.enable(14),Y.transmission&&E.enable(15),Y.sheen&&E.enable(16),Y.opaque&&E.enable(17),Y.pointsUvs&&E.enable(18),Y.decodeVideoTexture&&E.enable(19),Y.decodeVideoTextureEmissive&&E.enable(20),Y.alphaToCoverage&&E.enable(21),L.push(E.mask)}function F(L){const Y=G[L.type];let b;if(Y){const IA=xQ[Y];b=ep.clone(IA.uniforms)}else b=L.uniforms;return b}function v(L,Y){let b;for(let IA=0,CA=r.length;IA0?g.push(y):S.transparent===!0?C.push(y):I.push(y)}function n(D,h,S,G,U,k){const y=e(D,h,S,G,U,k);S.transmission>0?g.unshift(y):S.transparent===!0?C.unshift(y):I.unshift(y)}function a(D,h){I.length>1&&I.sort(D||pL),g.length>1&&g.sort(h||e0),C.length>1&&C.sort(h||e0)}function r(){for(let D=A,h=B.length;D=i.length?(e=new E0,i.push(e)):e=i[C],e}function I(){B=new WeakMap}return{get:A,dispose:I}}function NL(){const B={};return{get:function(A){if(B[A.id]!==void 0)return B[A.id];let I;switch(A.type){case"DirectionalLight":I={direction:new Z,color:new cI};break;case"SpotLight":I={position:new Z,direction:new Z,color:new cI,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":I={position:new Z,color:new cI,distance:0,decay:0};break;case"HemisphereLight":I={direction:new Z,skyColor:new cI,groundColor:new cI};break;case"RectAreaLight":I={color:new cI,position:new Z,halfWidth:new Z,halfHeight:new Z};break}return B[A.id]=I,I}}}function JL(){const B={};return{get:function(A){if(B[A.id]!==void 0)return B[A.id];let I;switch(A.type){case"DirectionalLight":I={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new PA};break;case"SpotLight":I={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new PA};break;case"PointLight":I={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new PA,shadowCameraNear:1,shadowCameraFar:1e3};break}return B[A.id]=I,I}}}let KL=0;function FL(B,A){return(A.castShadow?2:0)-(B.castShadow?2:0)+(A.map?1:0)-(B.map?1:0)}function fL(B){const A=new NL,I=JL(),g={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 a=0;a<9;a++)g.probe.push(new Z);const C=new Z,i=new VI,e=new VI;function E(a){let r=0,D=0,h=0;for(let L=0;L<9;L++)g.probe[L].set(0,0,0);let S=0,G=0,U=0,k=0,y=0,d=0,J=0,F=0,v=0,m=0,x=0;a.sort(FL);for(let L=0,Y=a.length;L0&&(B.has("OES_texture_float_linear")===!0?(g.rectAreaLTC1=yI.LTC_FLOAT_1,g.rectAreaLTC2=yI.LTC_FLOAT_2):(g.rectAreaLTC1=yI.LTC_HALF_1,g.rectAreaLTC2=yI.LTC_HALF_2)),g.ambient[0]=r,g.ambient[1]=D,g.ambient[2]=h;const T=g.hash;(T.directionalLength!==S||T.pointLength!==G||T.spotLength!==U||T.rectAreaLength!==k||T.hemiLength!==y||T.numDirectionalShadows!==d||T.numPointShadows!==J||T.numSpotShadows!==F||T.numSpotMaps!==v||T.numLightProbes!==x)&&(g.directional.length=S,g.spot.length=U,g.rectArea.length=k,g.point.length=G,g.hemi.length=y,g.directionalShadow.length=d,g.directionalShadowMap.length=d,g.pointShadow.length=J,g.pointShadowMap.length=J,g.spotShadow.length=F,g.spotShadowMap.length=F,g.directionalShadowMatrix.length=d,g.pointShadowMatrix.length=J,g.spotLightMatrix.length=F+v-m,g.spotLightMap.length=v,g.numSpotLightShadowsWithMaps=m,g.numLightProbes=x,T.directionalLength=S,T.pointLength=G,T.spotLength=U,T.rectAreaLength=k,T.hemiLength=y,T.numDirectionalShadows=d,T.numPointShadows=J,T.numSpotShadows=F,T.numSpotMaps=v,T.numLightProbes=x,g.version=KL++)}function n(a,r){let D=0,h=0,S=0,G=0,U=0;const k=r.matrixWorldInverse;for(let y=0,d=a.length;y=e.length?(E=new t0(B),e.push(E)):E=e[i],E}function g(){A=new WeakMap}return{get:I,dispose:g}}class gG extends iB{static get type(){return"MeshDepthMaterial"}constructor(A){super(),this.isMeshDepthMaterial=!0,this.depthPacking=bU,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(A)}copy(A){return super.copy(A),this.depthPacking=A.depthPacking,this.map=A.map,this.alphaMap=A.alphaMap,this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this}}class CG extends iB{static get type(){return"MeshDistanceMaterial"}constructor(A){super(),this.isMeshDistanceMaterial=!0,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(A)}copy(A){return super.copy(A),this.map=A.map,this.alphaMap=A.alphaMap,this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this}}const LL=`void main() {
+`+V)}else IA!==""?console.warn("THREE.WebGLProgram: Program Info Log:",IA):(CA===""||nA==="")&&(EA=!1);EA&&(b.diagnostics={runnable:uA,programLog:IA,vertexShader:{log:CA,prefix:k},fragmentShader:{log:nA,prefix:y}})}C.deleteShader(v),C.deleteShader(m),T=new Dh(C,U),L=oL(C,U)}let T;this.getUniforms=function(){return T===void 0&&x(this),T};let L;this.getAttributes=function(){return L===void 0&&x(this),L};let Y=I.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return Y===!1&&(Y=C.getProgramParameter(U,IL)),Y},this.destroy=function(){g.releaseStatesOfProgram(this),C.deleteProgram(U),this.program=void 0},this.type=I.shaderType,this.name=I.shaderName,this.id=gL++,this.cacheKey=A,this.usedTimes=1,this.program=U,this.vertexShader=v,this.fragmentShader=m,this}let GL=0;class kL{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(A){const I=A.vertexShader,g=A.fragmentShader,C=this._getShaderStage(I),i=this._getShaderStage(g),e=this._getShaderCacheForMaterial(A);return e.has(C)===!1&&(e.add(C),C.usedTimes++),e.has(i)===!1&&(e.add(i),i.usedTimes++),this}remove(A){const I=this.materialCache.get(A);for(const g of I)g.usedTimes--,g.usedTimes===0&&this.shaderCache.delete(g.code);return this.materialCache.delete(A),this}getVertexShaderID(A){return this._getShaderStage(A.vertexShader).id}getFragmentShaderID(A){return this._getShaderStage(A.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(A){const I=this.materialCache;let g=I.get(A);return g===void 0&&(g=new Set,I.set(A,g)),g}_getShaderStage(A){const I=this.shaderCache;let g=I.get(A);return g===void 0&&(g=new uL(A),I.set(A,g)),g}}class uL{constructor(A){this.id=GL++,this.code=A,this.usedTimes=0}}function ML(B,A,I,g,C,i,e){const E=new Ho,n=new kL,a=new Set,l=[],D=C.logarithmicDepthBuffer,h=C.vertexTextures;let S=C.precision;const G={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"};function U(L){return a.add(L),L===0?"uv":`uv${L}`}function k(L,Y,b,IA,CA){const nA=IA.fog,uA=CA.geometry,EA=L.isMeshStandardMaterial?IA.environment:null,pA=(L.isMeshStandardMaterial?I:A).get(L.envMap||EA),V=pA&&pA.mapping===Vs?pA.image.height:null,aA=G[L.type];L.precision!==null&&(S=C.getMaxPrecision(L.precision),S!==L.precision&&console.warn("THREE.WebGLProgram.getParameters:",L.precision,"not supported, using",S,"instead."));const BA=uA.morphAttributes.position||uA.morphAttributes.normal||uA.morphAttributes.color,P=BA!==void 0?BA.length:0;let oA=0;uA.morphAttributes.position!==void 0&&(oA=1),uA.morphAttributes.normal!==void 0&&(oA=2),uA.morphAttributes.color!==void 0&&(oA=3);let vA,cA,FA,wA;if(aA){const kg=xQ[aA];vA=kg.vertexShader,cA=kg.fragmentShader}else vA=L.vertexShader,cA=L.fragmentShader,n.update(L),FA=n.getVertexShaderID(L),wA=n.getFragmentShaderID(L);const LA=B.getRenderTarget(),VA=B.state.buffers.depth.getReversed(),WA=CA.isInstancedMesh===!0,BI=CA.isBatchedMesh===!0,pI=!!L.map,TA=!!L.matcap,_A=!!pA,$=!!L.aoMap,SI=!!L.lightMap,jA=!!L.bumpMap,lI=!!L.normalMap,CI=!!L.displacementMap,HI=!!L.emissiveMap,nI=!!L.metalnessMap,W=!!L.roughnessMap,O=L.anisotropy>0,MA=L.clearcoat>0,HA=L.dispersion>0,ZA=L.iridescence>0,xA=L.sheen>0,UI=L.transmission>0,tI=O&&!!L.anisotropyMap,DI=MA&&!!L.clearcoatMap,Ig=MA&&!!L.clearcoatNormalMap,zA=MA&&!!L.clearcoatRoughnessMap,uI=ZA&&!!L.iridescenceMap,LI=ZA&&!!L.iridescenceThicknessMap,JI=xA&&!!L.sheenColorMap,kI=xA&&!!L.sheenRoughnessMap,$I=!!L.specularMap,RI=!!L.specularColorMap,ZI=!!L.specularIntensityMap,sA=UI&&!!L.transmissionMap,KA=UI&&!!L.thicknessMap,fA=!!L.gradientMap,bA=!!L.alphaMap,hI=L.alphaTest>0,aI=!!L.alphaHash,PI=!!L.extensions;let Yg=se;L.toneMapped&&(LA===null||LA.isXRRenderTarget===!0)&&(Yg=B.toneMapping);const nC={shaderID:aA,shaderType:L.type,shaderName:L.name,vertexShader:vA,fragmentShader:cA,defines:L.defines,customVertexShaderID:FA,customFragmentShaderID:wA,isRawShaderMaterial:L.isRawShaderMaterial===!0,glslVersion:L.glslVersion,precision:S,batching:BI,batchingColor:BI&&CA._colorsTexture!==null,instancing:WA,instancingColor:WA&&CA.instanceColor!==null,instancingMorph:WA&&CA.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:LA===null?B.outputColorSpace:LA.isXRRenderTarget===!0?LA.texture.colorSpace:ce,alphaToCoverage:!!L.alphaToCoverage,map:pI,matcap:TA,envMap:_A,envMapMode:_A&&pA.mapping,envMapCubeUVHeight:V,aoMap:$,lightMap:SI,bumpMap:jA,normalMap:lI,displacementMap:h&&CI,emissiveMap:HI,normalMapObjectSpace:lI&&L.normalMapType===ZU,normalMapTangentSpace:lI&&L.normalMapType===St,metalnessMap:nI,roughnessMap:W,anisotropy:O,anisotropyMap:tI,clearcoat:MA,clearcoatMap:DI,clearcoatNormalMap:Ig,clearcoatRoughnessMap:zA,dispersion:HA,iridescence:ZA,iridescenceMap:uI,iridescenceThicknessMap:LI,sheen:xA,sheenColorMap:JI,sheenRoughnessMap:kI,specularMap:$I,specularColorMap:RI,specularIntensityMap:ZI,transmission:UI,transmissionMap:sA,thicknessMap:KA,gradientMap:fA,opaque:L.transparent===!1&&L.blending===Yo&&L.alphaToCoverage===!1,alphaMap:bA,alphaTest:hI,alphaHash:aI,combine:L.combine,mapUv:pI&&U(L.map.channel),aoMapUv:$&&U(L.aoMap.channel),lightMapUv:SI&&U(L.lightMap.channel),bumpMapUv:jA&&U(L.bumpMap.channel),normalMapUv:lI&&U(L.normalMap.channel),displacementMapUv:CI&&U(L.displacementMap.channel),emissiveMapUv:HI&&U(L.emissiveMap.channel),metalnessMapUv:nI&&U(L.metalnessMap.channel),roughnessMapUv:W&&U(L.roughnessMap.channel),anisotropyMapUv:tI&&U(L.anisotropyMap.channel),clearcoatMapUv:DI&&U(L.clearcoatMap.channel),clearcoatNormalMapUv:Ig&&U(L.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:zA&&U(L.clearcoatRoughnessMap.channel),iridescenceMapUv:uI&&U(L.iridescenceMap.channel),iridescenceThicknessMapUv:LI&&U(L.iridescenceThicknessMap.channel),sheenColorMapUv:JI&&U(L.sheenColorMap.channel),sheenRoughnessMapUv:kI&&U(L.sheenRoughnessMap.channel),specularMapUv:$I&&U(L.specularMap.channel),specularColorMapUv:RI&&U(L.specularColorMap.channel),specularIntensityMapUv:ZI&&U(L.specularIntensityMap.channel),transmissionMapUv:sA&&U(L.transmissionMap.channel),thicknessMapUv:KA&&U(L.thicknessMap.channel),alphaMapUv:bA&&U(L.alphaMap.channel),vertexTangents:!!uA.attributes.tangent&&(lI||O),vertexColors:L.vertexColors,vertexAlphas:L.vertexColors===!0&&!!uA.attributes.color&&uA.attributes.color.itemSize===4,pointsUvs:CA.isPoints===!0&&!!uA.attributes.uv&&(pI||bA),fog:!!nA,useFog:L.fog===!0,fogExp2:!!nA&&nA.isFogExp2,flatShading:L.flatShading===!0,sizeAttenuation:L.sizeAttenuation===!0,logarithmicDepthBuffer:D,reverseDepthBuffer:VA,skinning:CA.isSkinnedMesh===!0,morphTargets:uA.morphAttributes.position!==void 0,morphNormals:uA.morphAttributes.normal!==void 0,morphColors:uA.morphAttributes.color!==void 0,morphTargetsCount:P,morphTextureStride:oA,numDirLights:Y.directional.length,numPointLights:Y.point.length,numSpotLights:Y.spot.length,numSpotLightMaps:Y.spotLightMap.length,numRectAreaLights:Y.rectArea.length,numHemiLights:Y.hemi.length,numDirLightShadows:Y.directionalShadowMap.length,numPointLightShadows:Y.pointShadowMap.length,numSpotLightShadows:Y.spotShadowMap.length,numSpotLightShadowsWithMaps:Y.numSpotLightShadowsWithMaps,numLightProbes:Y.numLightProbes,numClippingPlanes:e.numPlanes,numClipIntersection:e.numIntersection,dithering:L.dithering,shadowMapEnabled:B.shadowMap.enabled&&b.length>0,shadowMapType:B.shadowMap.type,toneMapping:Yg,decodeVideoTexture:pI&&L.map.isVideoTexture===!0&&Kg.getTransfer(L.map.colorSpace)===Xg,decodeVideoTextureEmissive:HI&&L.emissiveMap.isVideoTexture===!0&&Kg.getTransfer(L.emissiveMap.colorSpace)===Xg,premultipliedAlpha:L.premultipliedAlpha,doubleSided:L.side===vi,flipSided:L.side===oi,useDepthPacking:L.depthPacking>=0,depthPacking:L.depthPacking||0,index0AttributeName:L.index0AttributeName,extensionClipCullDistance:PI&&L.extensions.clipCullDistance===!0&&g.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(PI&&L.extensions.multiDraw===!0||BI)&&g.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:g.has("KHR_parallel_shader_compile"),customProgramCacheKey:L.customProgramCacheKey()};return nC.vertexUv1s=a.has(1),nC.vertexUv2s=a.has(2),nC.vertexUv3s=a.has(3),a.clear(),nC}function y(L){const Y=[];if(L.shaderID?Y.push(L.shaderID):(Y.push(L.customVertexShaderID),Y.push(L.customFragmentShaderID)),L.defines!==void 0)for(const b in L.defines)Y.push(b),Y.push(L.defines[b]);return L.isRawShaderMaterial===!1&&(d(Y,L),J(Y,L),Y.push(B.outputColorSpace)),Y.push(L.customProgramCacheKey),Y.join()}function d(L,Y){L.push(Y.precision),L.push(Y.outputColorSpace),L.push(Y.envMapMode),L.push(Y.envMapCubeUVHeight),L.push(Y.mapUv),L.push(Y.alphaMapUv),L.push(Y.lightMapUv),L.push(Y.aoMapUv),L.push(Y.bumpMapUv),L.push(Y.normalMapUv),L.push(Y.displacementMapUv),L.push(Y.emissiveMapUv),L.push(Y.metalnessMapUv),L.push(Y.roughnessMapUv),L.push(Y.anisotropyMapUv),L.push(Y.clearcoatMapUv),L.push(Y.clearcoatNormalMapUv),L.push(Y.clearcoatRoughnessMapUv),L.push(Y.iridescenceMapUv),L.push(Y.iridescenceThicknessMapUv),L.push(Y.sheenColorMapUv),L.push(Y.sheenRoughnessMapUv),L.push(Y.specularMapUv),L.push(Y.specularColorMapUv),L.push(Y.specularIntensityMapUv),L.push(Y.transmissionMapUv),L.push(Y.thicknessMapUv),L.push(Y.combine),L.push(Y.fogExp2),L.push(Y.sizeAttenuation),L.push(Y.morphTargetsCount),L.push(Y.morphAttributeCount),L.push(Y.numDirLights),L.push(Y.numPointLights),L.push(Y.numSpotLights),L.push(Y.numSpotLightMaps),L.push(Y.numHemiLights),L.push(Y.numRectAreaLights),L.push(Y.numDirLightShadows),L.push(Y.numPointLightShadows),L.push(Y.numSpotLightShadows),L.push(Y.numSpotLightShadowsWithMaps),L.push(Y.numLightProbes),L.push(Y.shadowMapType),L.push(Y.toneMapping),L.push(Y.numClippingPlanes),L.push(Y.numClipIntersection),L.push(Y.depthPacking)}function J(L,Y){E.disableAll(),Y.supportsVertexTextures&&E.enable(0),Y.instancing&&E.enable(1),Y.instancingColor&&E.enable(2),Y.instancingMorph&&E.enable(3),Y.matcap&&E.enable(4),Y.envMap&&E.enable(5),Y.normalMapObjectSpace&&E.enable(6),Y.normalMapTangentSpace&&E.enable(7),Y.clearcoat&&E.enable(8),Y.iridescence&&E.enable(9),Y.alphaTest&&E.enable(10),Y.vertexColors&&E.enable(11),Y.vertexAlphas&&E.enable(12),Y.vertexUv1s&&E.enable(13),Y.vertexUv2s&&E.enable(14),Y.vertexUv3s&&E.enable(15),Y.vertexTangents&&E.enable(16),Y.anisotropy&&E.enable(17),Y.alphaHash&&E.enable(18),Y.batching&&E.enable(19),Y.dispersion&&E.enable(20),Y.batchingColor&&E.enable(21),L.push(E.mask),E.disableAll(),Y.fog&&E.enable(0),Y.useFog&&E.enable(1),Y.flatShading&&E.enable(2),Y.logarithmicDepthBuffer&&E.enable(3),Y.reverseDepthBuffer&&E.enable(4),Y.skinning&&E.enable(5),Y.morphTargets&&E.enable(6),Y.morphNormals&&E.enable(7),Y.morphColors&&E.enable(8),Y.premultipliedAlpha&&E.enable(9),Y.shadowMapEnabled&&E.enable(10),Y.doubleSided&&E.enable(11),Y.flipSided&&E.enable(12),Y.useDepthPacking&&E.enable(13),Y.dithering&&E.enable(14),Y.transmission&&E.enable(15),Y.sheen&&E.enable(16),Y.opaque&&E.enable(17),Y.pointsUvs&&E.enable(18),Y.decodeVideoTexture&&E.enable(19),Y.decodeVideoTextureEmissive&&E.enable(20),Y.alphaToCoverage&&E.enable(21),L.push(E.mask)}function F(L){const Y=G[L.type];let b;if(Y){const IA=xQ[Y];b=ep.clone(IA.uniforms)}else b=L.uniforms;return b}function v(L,Y){let b;for(let IA=0,CA=l.length;IA0?g.push(y):S.transparent===!0?C.push(y):I.push(y)}function n(D,h,S,G,U,k){const y=e(D,h,S,G,U,k);S.transmission>0?g.unshift(y):S.transparent===!0?C.unshift(y):I.unshift(y)}function a(D,h){I.length>1&&I.sort(D||pL),g.length>1&&g.sort(h||e0),C.length>1&&C.sort(h||e0)}function l(){for(let D=A,h=B.length;D=i.length?(e=new E0,i.push(e)):e=i[C],e}function I(){B=new WeakMap}return{get:A,dispose:I}}function NL(){const B={};return{get:function(A){if(B[A.id]!==void 0)return B[A.id];let I;switch(A.type){case"DirectionalLight":I={direction:new Z,color:new cI};break;case"SpotLight":I={position:new Z,direction:new Z,color:new cI,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":I={position:new Z,color:new cI,distance:0,decay:0};break;case"HemisphereLight":I={direction:new Z,skyColor:new cI,groundColor:new cI};break;case"RectAreaLight":I={color:new cI,position:new Z,halfWidth:new Z,halfHeight:new Z};break}return B[A.id]=I,I}}}function JL(){const B={};return{get:function(A){if(B[A.id]!==void 0)return B[A.id];let I;switch(A.type){case"DirectionalLight":I={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new PA};break;case"SpotLight":I={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new PA};break;case"PointLight":I={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new PA,shadowCameraNear:1,shadowCameraFar:1e3};break}return B[A.id]=I,I}}}let KL=0;function FL(B,A){return(A.castShadow?2:0)-(B.castShadow?2:0)+(A.map?1:0)-(B.map?1:0)}function fL(B){const A=new NL,I=JL(),g={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 a=0;a<9;a++)g.probe.push(new Z);const C=new Z,i=new VI,e=new VI;function E(a){let l=0,D=0,h=0;for(let L=0;L<9;L++)g.probe[L].set(0,0,0);let S=0,G=0,U=0,k=0,y=0,d=0,J=0,F=0,v=0,m=0,x=0;a.sort(FL);for(let L=0,Y=a.length;L0&&(B.has("OES_texture_float_linear")===!0?(g.rectAreaLTC1=yI.LTC_FLOAT_1,g.rectAreaLTC2=yI.LTC_FLOAT_2):(g.rectAreaLTC1=yI.LTC_HALF_1,g.rectAreaLTC2=yI.LTC_HALF_2)),g.ambient[0]=l,g.ambient[1]=D,g.ambient[2]=h;const T=g.hash;(T.directionalLength!==S||T.pointLength!==G||T.spotLength!==U||T.rectAreaLength!==k||T.hemiLength!==y||T.numDirectionalShadows!==d||T.numPointShadows!==J||T.numSpotShadows!==F||T.numSpotMaps!==v||T.numLightProbes!==x)&&(g.directional.length=S,g.spot.length=U,g.rectArea.length=k,g.point.length=G,g.hemi.length=y,g.directionalShadow.length=d,g.directionalShadowMap.length=d,g.pointShadow.length=J,g.pointShadowMap.length=J,g.spotShadow.length=F,g.spotShadowMap.length=F,g.directionalShadowMatrix.length=d,g.pointShadowMatrix.length=J,g.spotLightMatrix.length=F+v-m,g.spotLightMap.length=v,g.numSpotLightShadowsWithMaps=m,g.numLightProbes=x,T.directionalLength=S,T.pointLength=G,T.spotLength=U,T.rectAreaLength=k,T.hemiLength=y,T.numDirectionalShadows=d,T.numPointShadows=J,T.numSpotShadows=F,T.numSpotMaps=v,T.numLightProbes=x,g.version=KL++)}function n(a,l){let D=0,h=0,S=0,G=0,U=0;const k=l.matrixWorldInverse;for(let y=0,d=a.length;y=e.length?(E=new t0(B),e.push(E)):E=e[i],E}function g(){A=new WeakMap}return{get:I,dispose:g}}class gG extends iB{static get type(){return"MeshDepthMaterial"}constructor(A){super(),this.isMeshDepthMaterial=!0,this.depthPacking=bU,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(A)}copy(A){return super.copy(A),this.depthPacking=A.depthPacking,this.map=A.map,this.alphaMap=A.alphaMap,this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this}}class CG extends iB{static get type(){return"MeshDistanceMaterial"}constructor(A){super(),this.isMeshDistanceMaterial=!0,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(A)}copy(A){return super.copy(A),this.map=A.map,this.alphaMap=A.alphaMap,this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this}}const LL=`void main() {
gl_Position = vec4( position, 1.0 );
}`,YL=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
@@ -3840,7 +3840,7 @@ void main() {
squared_mean = squared_mean / samples;
float std_dev = sqrt( squared_mean - mean * mean );
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
-}`;function qL(B,A,I){let g=new El;const C=new PA,i=new PA,e=new Hg,E=new gG({depthPacking:_U}),n=new CG,a={},r=I.maxTextureSize,D={[re]:oi,[oi]:re,[vi]:vi},h=new ni({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new PA},radius:{value:4}},vertexShader:LL,fragmentShader:YL}),S=h.clone();S.defines.HORIZONTAL_PASS=1;const G=new tg;G.setAttribute("position",new Eg(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const U=new DC(G,h),k=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Sc;let y=this.type;this.render=function(m,x,T){if(k.enabled===!1||k.autoUpdate===!1&&k.needsUpdate===!1||m.length===0)return;const L=B.getRenderTarget(),Y=B.getActiveCubeFace(),b=B.getActiveMipmapLevel(),IA=B.state;IA.setBlending(ne),IA.buffers.color.setClear(1,1,1,1),IA.buffers.depth.setTest(!0),IA.setScissorTest(!1);const CA=y!==HQ&&this.type===HQ,nA=y===HQ&&this.type!==HQ;for(let uA=0,EA=m.length;uAr||C.y>r)&&(C.x>r&&(i.x=Math.floor(r/aA.x),C.x=i.x*aA.x,V.mapSize.x=i.x),C.y>r&&(i.y=Math.floor(r/aA.y),C.y=i.y*aA.y,V.mapSize.y=i.y)),V.map===null||CA===!0||nA===!0){const P=this.type!==HQ?{minFilter:cB,magFilter:cB}:{};V.map!==null&&V.map.dispose(),V.map=new bi(C.x,C.y,P),V.map.texture.name=pA.name+".shadowMap",V.camera.updateProjectionMatrix()}B.setRenderTarget(V.map),B.clear();const BA=V.getViewportCount();for(let P=0;P0||x.map&&x.alphaTest>0){const IA=Y.uuid,CA=x.uuid;let nA=a[IA];nA===void 0&&(nA={},a[IA]=nA);let uA=nA[CA];uA===void 0&&(uA=Y.clone(),nA[CA]=uA,x.addEventListener("dispose",v)),Y=uA}if(Y.visible=x.visible,Y.wireframe=x.wireframe,L===HQ?Y.side=x.shadowSide!==null?x.shadowSide:x.side:Y.side=x.shadowSide!==null?x.shadowSide:D[x.side],Y.alphaMap=x.alphaMap,Y.alphaTest=x.alphaTest,Y.map=x.map,Y.clipShadows=x.clipShadows,Y.clippingPlanes=x.clippingPlanes,Y.clipIntersection=x.clipIntersection,Y.displacementMap=x.displacementMap,Y.displacementScale=x.displacementScale,Y.displacementBias=x.displacementBias,Y.wireframeLinewidth=x.wireframeLinewidth,Y.linewidth=x.linewidth,T.isPointLight===!0&&Y.isMeshDistanceMaterial===!0){const IA=B.properties.get(Y);IA.light=T}return Y}function F(m,x,T,L,Y){if(m.visible===!1)return;if(m.layers.test(x.layers)&&(m.isMesh||m.isLine||m.isPoints)&&(m.castShadow||m.receiveShadow&&Y===HQ)&&(!m.frustumCulled||g.intersectsObject(m))){m.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,m.matrixWorld);const CA=A.update(m),nA=m.material;if(Array.isArray(nA)){const uA=CA.groups;for(let EA=0,pA=uA.length;EA=1):V.indexOf("OpenGL ES")!==-1&&(pA=parseFloat(/^OpenGL ES (\d)/.exec(V)[1]),EA=pA>=2);let aA=null,BA={};const P=B.getParameter(B.SCISSOR_BOX),oA=B.getParameter(B.VIEWPORT),vA=new Hg().fromArray(P),cA=new Hg().fromArray(oA);function FA(sA,KA,fA,bA){const hI=new Uint8Array(4),aI=B.createTexture();B.bindTexture(sA,aI),B.texParameteri(sA,B.TEXTURE_MIN_FILTER,B.NEAREST),B.texParameteri(sA,B.TEXTURE_MAG_FILTER,B.NEAREST);for(let PI=0;PIA?(B.repeat.x=1,B.repeat.y=I/A,B.offset.x=0,B.offset.y=(1-B.repeat.y)/2):(B.repeat.x=A/I,B.repeat.y=1,B.offset.x=(1-B.repeat.x)/2,B.offset.y=0),B}function xL(B,A){const I=B.image&&B.image.width?B.image.width/B.image.height:1;return I>A?(B.repeat.x=A/I,B.repeat.y=1,B.offset.x=(1-B.repeat.x)/2,B.offset.y=0):(B.repeat.x=1,B.repeat.y=I/A,B.offset.x=0,B.offset.y=(1-B.repeat.y)/2),B}function vL(B){return B.repeat.x=1,B.repeat.y=1,B.offset.x=0,B.offset.y=0,B}function My(B,A,I,g){const C=OL(g);switch(I){case Ty:return B*A;case vy:return B*A;case Oy:return B*A*2;case Cl:return B*A/C.components*C.byteLength;case Bl:return B*A/C.components*C.byteLength;case by:return B*A*2/C.components*C.byteLength;case Mc:return B*A*2/C.components*C.byteLength;case xy:return B*A*3/C.components*C.byteLength;case YC:return B*A*4/C.components*C.byteLength;case Uc:return B*A*4/C.components*C.byteLength;case ur:case Mr:return Math.floor((B+3)/4)*Math.floor((A+3)/4)*8;case Ur:case pr:return Math.floor((B+3)/4)*Math.floor((A+3)/4)*16;case Nh:case Kh:return Math.max(B,16)*Math.max(A,8)/4;case dh:case Jh:return Math.max(B,8)*Math.max(A,8)/2;case Fh:case fh:return Math.floor((B+3)/4)*Math.floor((A+3)/4)*8;case Rh:return Math.floor((B+3)/4)*Math.floor((A+3)/4)*16;case Lh:return Math.floor((B+3)/4)*Math.floor((A+3)/4)*16;case Yh:return Math.floor((B+4)/5)*Math.floor((A+3)/4)*16;case qh:return Math.floor((B+4)/5)*Math.floor((A+4)/5)*16;case mh:return Math.floor((B+5)/6)*Math.floor((A+4)/5)*16;case Hh:return Math.floor((B+5)/6)*Math.floor((A+5)/6)*16;case Th:return Math.floor((B+7)/8)*Math.floor((A+4)/5)*16;case xh:return Math.floor((B+7)/8)*Math.floor((A+5)/6)*16;case vh:return Math.floor((B+7)/8)*Math.floor((A+7)/8)*16;case Oh:return Math.floor((B+9)/10)*Math.floor((A+4)/5)*16;case bh:return Math.floor((B+9)/10)*Math.floor((A+5)/6)*16;case _h:return Math.floor((B+9)/10)*Math.floor((A+7)/8)*16;case Zh:return Math.floor((B+9)/10)*Math.floor((A+9)/10)*16;case Ph:return Math.floor((B+11)/12)*Math.floor((A+9)/10)*16;case Wh:return Math.floor((B+11)/12)*Math.floor((A+11)/12)*16;case dr:case Vh:case jh:return Math.ceil(B/4)*Math.ceil(A/4)*16;case _y:case Xh:return Math.ceil(B/4)*Math.ceil(A/4)*8;case zh:case $h:return Math.ceil(B/4)*Math.ceil(A/4)*16}throw new Error(`Unable to determine texture byte length for ${I} format.`)}function OL(B){switch(B){case di:case yc:return{byteLength:1,components:1};case ms:case Gc:case hB:return{byteLength:2,components:1};case kc:case uc:return{byteLength:2,components:4};case he:case gl:case yC:return{byteLength:4,components:1};case Hy:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${B}.`)}const bL={contain:TL,cover:xL,fill:vL,getByteLength:My};function _L(B,A,I,g,C,i,e){const E=A.has("WEBGL_multisampled_render_to_texture")?A.get("WEBGL_multisampled_render_to_texture"):null,n=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),a=new PA,r=new WeakMap;let D;const h=new WeakMap;let S=!1;try{S=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function G(W,O){return S?new OffscreenCanvas(W,O):mr("canvas")}function U(W,O,MA){let HA=1;const ZA=nI(W);if((ZA.width>MA||ZA.height>MA)&&(HA=MA/Math.max(ZA.width,ZA.height)),HA<1)if(typeof HTMLImageElement<"u"&&W instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&W instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&W instanceof ImageBitmap||typeof VideoFrame<"u"&&W instanceof VideoFrame){const xA=Math.floor(HA*ZA.width),UI=Math.floor(HA*ZA.height);D===void 0&&(D=G(xA,UI));const tI=O?G(xA,UI):D;return tI.width=xA,tI.height=UI,tI.getContext("2d").drawImage(W,0,0,xA,UI),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+ZA.width+"x"+ZA.height+") to ("+xA+"x"+UI+")."),tI}else return"data"in W&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+ZA.width+"x"+ZA.height+")."),W;return W}function k(W){return W.generateMipmaps}function y(W){B.generateMipmap(W)}function d(W){return W.isWebGLCubeRenderTarget?B.TEXTURE_CUBE_MAP:W.isWebGL3DRenderTarget?B.TEXTURE_3D:W.isWebGLArrayRenderTarget||W.isCompressedArrayTexture?B.TEXTURE_2D_ARRAY:B.TEXTURE_2D}function J(W,O,MA,HA,ZA=!1){if(W!==null){if(B[W]!==void 0)return B[W];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+W+"'")}let xA=O;if(O===B.RED&&(MA===B.FLOAT&&(xA=B.R32F),MA===B.HALF_FLOAT&&(xA=B.R16F),MA===B.UNSIGNED_BYTE&&(xA=B.R8)),O===B.RED_INTEGER&&(MA===B.UNSIGNED_BYTE&&(xA=B.R8UI),MA===B.UNSIGNED_SHORT&&(xA=B.R16UI),MA===B.UNSIGNED_INT&&(xA=B.R32UI),MA===B.BYTE&&(xA=B.R8I),MA===B.SHORT&&(xA=B.R16I),MA===B.INT&&(xA=B.R32I)),O===B.RG&&(MA===B.FLOAT&&(xA=B.RG32F),MA===B.HALF_FLOAT&&(xA=B.RG16F),MA===B.UNSIGNED_BYTE&&(xA=B.RG8)),O===B.RG_INTEGER&&(MA===B.UNSIGNED_BYTE&&(xA=B.RG8UI),MA===B.UNSIGNED_SHORT&&(xA=B.RG16UI),MA===B.UNSIGNED_INT&&(xA=B.RG32UI),MA===B.BYTE&&(xA=B.RG8I),MA===B.SHORT&&(xA=B.RG16I),MA===B.INT&&(xA=B.RG32I)),O===B.RGB_INTEGER&&(MA===B.UNSIGNED_BYTE&&(xA=B.RGB8UI),MA===B.UNSIGNED_SHORT&&(xA=B.RGB16UI),MA===B.UNSIGNED_INT&&(xA=B.RGB32UI),MA===B.BYTE&&(xA=B.RGB8I),MA===B.SHORT&&(xA=B.RGB16I),MA===B.INT&&(xA=B.RGB32I)),O===B.RGBA_INTEGER&&(MA===B.UNSIGNED_BYTE&&(xA=B.RGBA8UI),MA===B.UNSIGNED_SHORT&&(xA=B.RGBA16UI),MA===B.UNSIGNED_INT&&(xA=B.RGBA32UI),MA===B.BYTE&&(xA=B.RGBA8I),MA===B.SHORT&&(xA=B.RGBA16I),MA===B.INT&&(xA=B.RGBA32I)),O===B.RGB&&MA===B.UNSIGNED_INT_5_9_9_9_REV&&(xA=B.RGB9_E5),O===B.RGBA){const UI=ZA?il:Kg.getTransfer(HA);MA===B.FLOAT&&(xA=B.RGBA32F),MA===B.HALF_FLOAT&&(xA=B.RGBA16F),MA===B.UNSIGNED_BYTE&&(xA=UI===Xg?B.SRGB8_ALPHA8:B.RGBA8),MA===B.UNSIGNED_SHORT_4_4_4_4&&(xA=B.RGBA4),MA===B.UNSIGNED_SHORT_5_5_5_1&&(xA=B.RGB5_A1)}return(xA===B.R16F||xA===B.R32F||xA===B.RG16F||xA===B.RG32F||xA===B.RGBA16F||xA===B.RGBA32F)&&A.get("EXT_color_buffer_float"),xA}function F(W,O){let MA;return W?O===null||O===he||O===vo?MA=B.DEPTH24_STENCIL8:O===yC?MA=B.DEPTH32F_STENCIL8:O===ms&&(MA=B.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):O===null||O===he||O===vo?MA=B.DEPTH_COMPONENT24:O===yC?MA=B.DEPTH_COMPONENT32F:O===ms&&(MA=B.DEPTH_COMPONENT16),MA}function v(W,O){return k(W)===!0||W.isFramebufferTexture&&W.minFilter!==cB&&W.minFilter!==Og?Math.log2(Math.max(O.width,O.height))+1:W.mipmaps!==void 0&&W.mipmaps.length>0?W.mipmaps.length:W.isCompressedTexture&&Array.isArray(W.image)?O.mipmaps.length:1}function m(W){const O=W.target;O.removeEventListener("dispose",m),T(O),O.isVideoTexture&&r.delete(O)}function x(W){const O=W.target;O.removeEventListener("dispose",x),Y(O)}function T(W){const O=g.get(W);if(O.__webglInit===void 0)return;const MA=W.source,HA=h.get(MA);if(HA){const ZA=HA[O.__cacheKey];ZA.usedTimes--,ZA.usedTimes===0&&L(W),Object.keys(HA).length===0&&h.delete(MA)}g.remove(W)}function L(W){const O=g.get(W);B.deleteTexture(O.__webglTexture);const MA=W.source,HA=h.get(MA);delete HA[O.__cacheKey],e.memory.textures--}function Y(W){const O=g.get(W);if(W.depthTexture&&(W.depthTexture.dispose(),g.remove(W.depthTexture)),W.isWebGLCubeRenderTarget)for(let HA=0;HA<6;HA++){if(Array.isArray(O.__webglFramebuffer[HA]))for(let ZA=0;ZA=C.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+W+" texture units while this GPU supports only "+C.maxTextures),b+=1,W}function nA(W){const O=[];return O.push(W.wrapS),O.push(W.wrapT),O.push(W.wrapR||0),O.push(W.magFilter),O.push(W.minFilter),O.push(W.anisotropy),O.push(W.internalFormat),O.push(W.format),O.push(W.type),O.push(W.generateMipmaps),O.push(W.premultiplyAlpha),O.push(W.flipY),O.push(W.unpackAlignment),O.push(W.colorSpace),O.join()}function uA(W,O){const MA=g.get(W);if(W.isVideoTexture&&CI(W),W.isRenderTargetTexture===!1&&W.version>0&&MA.__version!==W.version){const HA=W.image;if(HA===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(HA.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{cA(MA,W,O);return}}I.bindTexture(B.TEXTURE_2D,MA.__webglTexture,B.TEXTURE0+O)}function EA(W,O){const MA=g.get(W);if(W.version>0&&MA.__version!==W.version){cA(MA,W,O);return}I.bindTexture(B.TEXTURE_2D_ARRAY,MA.__webglTexture,B.TEXTURE0+O)}function pA(W,O){const MA=g.get(W);if(W.version>0&&MA.__version!==W.version){cA(MA,W,O);return}I.bindTexture(B.TEXTURE_3D,MA.__webglTexture,B.TEXTURE0+O)}function V(W,O){const MA=g.get(W);if(W.version>0&&MA.__version!==W.version){FA(MA,W,O);return}I.bindTexture(B.TEXTURE_CUBE_MAP,MA.__webglTexture,B.TEXTURE0+O)}const aA={[De]:B.REPEAT,[LC]:B.CLAMP_TO_EDGE,[qs]:B.MIRRORED_REPEAT},BA={[cB]:B.NEAREST,[wc]:B.NEAREST_MIPMAP_NEAREST,[po]:B.NEAREST_MIPMAP_LINEAR,[Og]:B.LINEAR,[Ks]:B.LINEAR_MIPMAP_NEAREST,[tQ]:B.LINEAR_MIPMAP_LINEAR},P={[PU]:B.NEVER,[$U]:B.ALWAYS,[WU]:B.LESS,[Wy]:B.LEQUAL,[VU]:B.EQUAL,[zU]:B.GEQUAL,[jU]:B.GREATER,[XU]:B.NOTEQUAL};function oA(W,O){if(O.type===yC&&A.has("OES_texture_float_linear")===!1&&(O.magFilter===Og||O.magFilter===Ks||O.magFilter===po||O.magFilter===tQ||O.minFilter===Og||O.minFilter===Ks||O.minFilter===po||O.minFilter===tQ)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),B.texParameteri(W,B.TEXTURE_WRAP_S,aA[O.wrapS]),B.texParameteri(W,B.TEXTURE_WRAP_T,aA[O.wrapT]),(W===B.TEXTURE_3D||W===B.TEXTURE_2D_ARRAY)&&B.texParameteri(W,B.TEXTURE_WRAP_R,aA[O.wrapR]),B.texParameteri(W,B.TEXTURE_MAG_FILTER,BA[O.magFilter]),B.texParameteri(W,B.TEXTURE_MIN_FILTER,BA[O.minFilter]),O.compareFunction&&(B.texParameteri(W,B.TEXTURE_COMPARE_MODE,B.COMPARE_REF_TO_TEXTURE),B.texParameteri(W,B.TEXTURE_COMPARE_FUNC,P[O.compareFunction])),A.has("EXT_texture_filter_anisotropic")===!0){if(O.magFilter===cB||O.minFilter!==po&&O.minFilter!==tQ||O.type===yC&&A.has("OES_texture_float_linear")===!1)return;if(O.anisotropy>1||g.get(O).__currentAnisotropy){const MA=A.get("EXT_texture_filter_anisotropic");B.texParameterf(W,MA.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(O.anisotropy,C.getMaxAnisotropy())),g.get(O).__currentAnisotropy=O.anisotropy}}}function vA(W,O){let MA=!1;W.__webglInit===void 0&&(W.__webglInit=!0,O.addEventListener("dispose",m));const HA=O.source;let ZA=h.get(HA);ZA===void 0&&(ZA={},h.set(HA,ZA));const xA=nA(O);if(xA!==W.__cacheKey){ZA[xA]===void 0&&(ZA[xA]={texture:B.createTexture(),usedTimes:0},e.memory.textures++,MA=!0),ZA[xA].usedTimes++;const UI=ZA[W.__cacheKey];UI!==void 0&&(ZA[W.__cacheKey].usedTimes--,UI.usedTimes===0&&L(O)),W.__cacheKey=xA,W.__webglTexture=ZA[xA].texture}return MA}function cA(W,O,MA){let HA=B.TEXTURE_2D;(O.isDataArrayTexture||O.isCompressedArrayTexture)&&(HA=B.TEXTURE_2D_ARRAY),O.isData3DTexture&&(HA=B.TEXTURE_3D);const ZA=vA(W,O),xA=O.source;I.bindTexture(HA,W.__webglTexture,B.TEXTURE0+MA);const UI=g.get(xA);if(xA.version!==UI.__version||ZA===!0){I.activeTexture(B.TEXTURE0+MA);const tI=Kg.getPrimaries(Kg.workingColorSpace),DI=O.colorSpace===eE?null:Kg.getPrimaries(O.colorSpace),Ig=O.colorSpace===eE||tI===DI?B.NONE:B.BROWSER_DEFAULT_WEBGL;B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,O.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,O.unpackAlignment),B.pixelStorei(B.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ig);let zA=U(O.image,!1,C.maxTextureSize);zA=HI(O,zA);const uI=i.convert(O.format,O.colorSpace),LI=i.convert(O.type);let JI=J(O.internalFormat,uI,LI,O.colorSpace,O.isVideoTexture);oA(HA,O);let kI;const $I=O.mipmaps,RI=O.isVideoTexture!==!0,ZI=UI.__version===void 0||ZA===!0,sA=xA.dataReady,KA=v(O,zA);if(O.isDepthTexture)JI=F(O.format===Oo,O.type),ZI&&(RI?I.texStorage2D(B.TEXTURE_2D,1,JI,zA.width,zA.height):I.texImage2D(B.TEXTURE_2D,0,JI,zA.width,zA.height,0,uI,LI,null));else if(O.isDataTexture)if($I.length>0){RI&&ZI&&I.texStorage2D(B.TEXTURE_2D,KA,JI,$I[0].width,$I[0].height);for(let fA=0,bA=$I.length;fA0){const hI=My(kI.width,kI.height,O.format,O.type);for(const aI of O.layerUpdates){const PI=kI.data.subarray(aI*hI/kI.data.BYTES_PER_ELEMENT,(aI+1)*hI/kI.data.BYTES_PER_ELEMENT);I.compressedTexSubImage3D(B.TEXTURE_2D_ARRAY,fA,0,0,aI,kI.width,kI.height,1,uI,PI)}O.clearLayerUpdates()}else I.compressedTexSubImage3D(B.TEXTURE_2D_ARRAY,fA,0,0,0,kI.width,kI.height,zA.depth,uI,kI.data)}else I.compressedTexImage3D(B.TEXTURE_2D_ARRAY,fA,JI,kI.width,kI.height,zA.depth,0,kI.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else RI?sA&&I.texSubImage3D(B.TEXTURE_2D_ARRAY,fA,0,0,0,kI.width,kI.height,zA.depth,uI,LI,kI.data):I.texImage3D(B.TEXTURE_2D_ARRAY,fA,JI,kI.width,kI.height,zA.depth,0,uI,LI,kI.data)}else{RI&&ZI&&I.texStorage2D(B.TEXTURE_2D,KA,JI,$I[0].width,$I[0].height);for(let fA=0,bA=$I.length;fA0){const fA=My(zA.width,zA.height,O.format,O.type);for(const bA of O.layerUpdates){const hI=zA.data.subarray(bA*fA/zA.data.BYTES_PER_ELEMENT,(bA+1)*fA/zA.data.BYTES_PER_ELEMENT);I.texSubImage3D(B.TEXTURE_2D_ARRAY,0,0,0,bA,zA.width,zA.height,1,uI,LI,hI)}O.clearLayerUpdates()}else I.texSubImage3D(B.TEXTURE_2D_ARRAY,0,0,0,0,zA.width,zA.height,zA.depth,uI,LI,zA.data)}else I.texImage3D(B.TEXTURE_2D_ARRAY,0,JI,zA.width,zA.height,zA.depth,0,uI,LI,zA.data);else if(O.isData3DTexture)RI?(ZI&&I.texStorage3D(B.TEXTURE_3D,KA,JI,zA.width,zA.height,zA.depth),sA&&I.texSubImage3D(B.TEXTURE_3D,0,0,0,0,zA.width,zA.height,zA.depth,uI,LI,zA.data)):I.texImage3D(B.TEXTURE_3D,0,JI,zA.width,zA.height,zA.depth,0,uI,LI,zA.data);else if(O.isFramebufferTexture){if(ZI)if(RI)I.texStorage2D(B.TEXTURE_2D,KA,JI,zA.width,zA.height);else{let fA=zA.width,bA=zA.height;for(let hI=0;hI>=1,bA>>=1}}else if($I.length>0){if(RI&&ZI){const fA=nI($I[0]);I.texStorage2D(B.TEXTURE_2D,KA,JI,fA.width,fA.height)}for(let fA=0,bA=$I.length;fA0&&KA++;const bA=nI(uI[0]);I.texStorage2D(B.TEXTURE_CUBE_MAP,KA,$I,bA.width,bA.height)}for(let bA=0;bA<6;bA++)if(zA){RI?sA&&I.texSubImage2D(B.TEXTURE_CUBE_MAP_POSITIVE_X+bA,0,0,0,uI[bA].width,uI[bA].height,JI,kI,uI[bA].data):I.texImage2D(B.TEXTURE_CUBE_MAP_POSITIVE_X+bA,0,$I,uI[bA].width,uI[bA].height,0,JI,kI,uI[bA].data);for(let hI=0;hI>xA),LI=Math.max(1,O.height>>xA);ZA===B.TEXTURE_3D||ZA===B.TEXTURE_2D_ARRAY?I.texImage3D(ZA,xA,DI,uI,LI,O.depth,0,UI,tI,null):I.texImage2D(ZA,xA,DI,uI,LI,0,UI,tI,null)}I.bindFramebuffer(B.FRAMEBUFFER,W),lI(O)?E.framebufferTexture2DMultisampleEXT(B.FRAMEBUFFER,HA,ZA,zA.__webglTexture,0,jA(O)):(ZA===B.TEXTURE_2D||ZA>=B.TEXTURE_CUBE_MAP_POSITIVE_X&&ZA<=B.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&B.framebufferTexture2D(B.FRAMEBUFFER,HA,ZA,zA.__webglTexture,xA),I.bindFramebuffer(B.FRAMEBUFFER,null)}function LA(W,O,MA){if(B.bindRenderbuffer(B.RENDERBUFFER,W),O.depthBuffer){const HA=O.depthTexture,ZA=HA&&HA.isDepthTexture?HA.type:null,xA=F(O.stencilBuffer,ZA),UI=O.stencilBuffer?B.DEPTH_STENCIL_ATTACHMENT:B.DEPTH_ATTACHMENT,tI=jA(O);lI(O)?E.renderbufferStorageMultisampleEXT(B.RENDERBUFFER,tI,xA,O.width,O.height):MA?B.renderbufferStorageMultisample(B.RENDERBUFFER,tI,xA,O.width,O.height):B.renderbufferStorage(B.RENDERBUFFER,xA,O.width,O.height),B.framebufferRenderbuffer(B.FRAMEBUFFER,UI,B.RENDERBUFFER,W)}else{const HA=O.textures;for(let ZA=0;ZA{delete O.__boundDepthTexture,delete O.__depthDisposeCallback,HA.removeEventListener("dispose",ZA)};HA.addEventListener("dispose",ZA),O.__depthDisposeCallback=ZA}O.__boundDepthTexture=HA}if(W.depthTexture&&!O.__autoAllocateDepthBuffer){if(MA)throw new Error("target.depthTexture not supported in Cube render targets");VA(O.__webglFramebuffer,W)}else if(MA){O.__webglDepthbuffer=[];for(let HA=0;HA<6;HA++)if(I.bindFramebuffer(B.FRAMEBUFFER,O.__webglFramebuffer[HA]),O.__webglDepthbuffer[HA]===void 0)O.__webglDepthbuffer[HA]=B.createRenderbuffer(),LA(O.__webglDepthbuffer[HA],W,!1);else{const ZA=W.stencilBuffer?B.DEPTH_STENCIL_ATTACHMENT:B.DEPTH_ATTACHMENT,xA=O.__webglDepthbuffer[HA];B.bindRenderbuffer(B.RENDERBUFFER,xA),B.framebufferRenderbuffer(B.FRAMEBUFFER,ZA,B.RENDERBUFFER,xA)}}else if(I.bindFramebuffer(B.FRAMEBUFFER,O.__webglFramebuffer),O.__webglDepthbuffer===void 0)O.__webglDepthbuffer=B.createRenderbuffer(),LA(O.__webglDepthbuffer,W,!1);else{const HA=W.stencilBuffer?B.DEPTH_STENCIL_ATTACHMENT:B.DEPTH_ATTACHMENT,ZA=O.__webglDepthbuffer;B.bindRenderbuffer(B.RENDERBUFFER,ZA),B.framebufferRenderbuffer(B.FRAMEBUFFER,HA,B.RENDERBUFFER,ZA)}I.bindFramebuffer(B.FRAMEBUFFER,null)}function BI(W,O,MA){const HA=g.get(W);O!==void 0&&wA(HA.__webglFramebuffer,W,W.texture,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,0),MA!==void 0&&WA(W)}function pI(W){const O=W.texture,MA=g.get(W),HA=g.get(O);W.addEventListener("dispose",x);const ZA=W.textures,xA=W.isWebGLCubeRenderTarget===!0,UI=ZA.length>1;if(UI||(HA.__webglTexture===void 0&&(HA.__webglTexture=B.createTexture()),HA.__version=O.version,e.memory.textures++),xA){MA.__webglFramebuffer=[];for(let tI=0;tI<6;tI++)if(O.mipmaps&&O.mipmaps.length>0){MA.__webglFramebuffer[tI]=[];for(let DI=0;DI0){MA.__webglFramebuffer=[];for(let tI=0;tI0&&lI(W)===!1){MA.__webglMultisampledFramebuffer=B.createFramebuffer(),MA.__webglColorRenderbuffer=[],I.bindFramebuffer(B.FRAMEBUFFER,MA.__webglMultisampledFramebuffer);for(let tI=0;tI0)for(let DI=0;DI0)for(let DI=0;DI0){if(lI(W)===!1){const O=W.textures,MA=W.width,HA=W.height;let ZA=B.COLOR_BUFFER_BIT;const xA=W.stencilBuffer?B.DEPTH_STENCIL_ATTACHMENT:B.DEPTH_ATTACHMENT,UI=g.get(W),tI=O.length>1;if(tI)for(let DI=0;DI0&&A.has("WEBGL_multisampled_render_to_texture")===!0&&O.__useRenderToTexture!==!1}function CI(W){const O=e.render.frame;r.get(W)!==O&&(r.set(W,O),W.update())}function HI(W,O){const MA=W.colorSpace,HA=W.format,ZA=W.type;return W.isCompressedTexture===!0||W.isVideoTexture===!0||MA!==ce&&MA!==eE&&(Kg.getTransfer(MA)===Xg?(HA!==YC||ZA!==di)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",MA)),O}function nI(W){return typeof HTMLImageElement<"u"&&W instanceof HTMLImageElement?(a.width=W.naturalWidth||W.width,a.height=W.naturalHeight||W.height):typeof VideoFrame<"u"&&W instanceof VideoFrame?(a.width=W.displayWidth,a.height=W.displayHeight):(a.width=W.width,a.height=W.height),a}this.allocateTextureUnit=CA,this.resetTextureUnits=IA,this.setTexture2D=uA,this.setTexture2DArray=EA,this.setTexture3D=pA,this.setTextureCube=V,this.rebindTextures=BI,this.setupRenderTarget=pI,this.updateRenderTargetMipmap=TA,this.updateMultisampleRenderTarget=SI,this.setupDepthRenderbuffer=WA,this.setupFrameBufferTexture=wA,this.useMultisampledRTT=lI}function rp(B,A){function I(g,C=eE){let i;const e=Kg.getTransfer(C);if(g===di)return B.UNSIGNED_BYTE;if(g===kc)return B.UNSIGNED_SHORT_4_4_4_4;if(g===uc)return B.UNSIGNED_SHORT_5_5_5_1;if(g===Hy)return B.UNSIGNED_INT_5_9_9_9_REV;if(g===yc)return B.BYTE;if(g===Gc)return B.SHORT;if(g===ms)return B.UNSIGNED_SHORT;if(g===gl)return B.INT;if(g===he)return B.UNSIGNED_INT;if(g===yC)return B.FLOAT;if(g===hB)return B.HALF_FLOAT;if(g===Ty)return B.ALPHA;if(g===xy)return B.RGB;if(g===YC)return B.RGBA;if(g===vy)return B.LUMINANCE;if(g===Oy)return B.LUMINANCE_ALPHA;if(g===qo)return B.DEPTH_COMPONENT;if(g===Oo)return B.DEPTH_STENCIL;if(g===Cl)return B.RED;if(g===Bl)return B.RED_INTEGER;if(g===by)return B.RG;if(g===Mc)return B.RG_INTEGER;if(g===Uc)return B.RGBA_INTEGER;if(g===ur||g===Mr||g===Ur||g===pr)if(e===Xg)if(i=A.get("WEBGL_compressed_texture_s3tc_srgb"),i!==null){if(g===ur)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(g===Mr)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(g===Ur)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(g===pr)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(i=A.get("WEBGL_compressed_texture_s3tc"),i!==null){if(g===ur)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(g===Mr)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(g===Ur)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(g===pr)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(g===dh||g===Nh||g===Jh||g===Kh)if(i=A.get("WEBGL_compressed_texture_pvrtc"),i!==null){if(g===dh)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(g===Nh)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(g===Jh)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(g===Kh)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(g===Fh||g===fh||g===Rh)if(i=A.get("WEBGL_compressed_texture_etc"),i!==null){if(g===Fh||g===fh)return e===Xg?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(g===Rh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(g===Lh||g===Yh||g===qh||g===mh||g===Hh||g===Th||g===xh||g===vh||g===Oh||g===bh||g===_h||g===Zh||g===Ph||g===Wh)if(i=A.get("WEBGL_compressed_texture_astc"),i!==null){if(g===Lh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(g===Yh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(g===qh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(g===mh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(g===Hh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(g===Th)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(g===xh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(g===vh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(g===Oh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(g===bh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(g===_h)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(g===Zh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(g===Ph)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(g===Wh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(g===dr||g===Vh||g===jh)if(i=A.get("EXT_texture_compression_bptc"),i!==null){if(g===dr)return e===Xg?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(g===Vh)return i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(g===jh)return i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(g===_y||g===Xh||g===zh||g===$h)if(i=A.get("EXT_texture_compression_rgtc"),i!==null){if(g===dr)return i.COMPRESSED_RED_RGTC1_EXT;if(g===Xh)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(g===zh)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(g===$h)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return g===vo?B.UNSIGNED_INT_24_8:B[g]!==void 0?B[g]:null}return{convert:I}}class lp extends CB{constructor(A=[]){super(),this.isArrayCamera=!0,this.cameras=A}}class tE extends Ng{constructor(){super(),this.isGroup=!0,this.type="Group"}}const ZL={type:"move"};class Nw{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new tE,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new tE,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Z,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Z),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new tE,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Z,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Z),this._grip}dispatchEvent(A){return this._targetRay!==null&&this._targetRay.dispatchEvent(A),this._grip!==null&&this._grip.dispatchEvent(A),this._hand!==null&&this._hand.dispatchEvent(A),this}connect(A){if(A&&A.hand){const I=this._hand;if(I)for(const g of A.hand.values())this._getHandJoint(I,g)}return this.dispatchEvent({type:"connected",data:A}),this}disconnect(A){return this.dispatchEvent({type:"disconnected",data:A}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(A,I,g){let C=null,i=null,e=null;const E=this._targetRay,n=this._grip,a=this._hand;if(A&&I.session.visibilityState!=="visible-blurred"){if(a&&A.hand){e=!0;for(const U of A.hand.values()){const k=I.getJointPose(U,g),y=this._getHandJoint(a,U);k!==null&&(y.matrix.fromArray(k.transform.matrix),y.matrix.decompose(y.position,y.rotation,y.scale),y.matrixWorldNeedsUpdate=!0,y.jointRadius=k.radius),y.visible=k!==null}const r=a.joints["index-finger-tip"],D=a.joints["thumb-tip"],h=r.position.distanceTo(D.position),S=.02,G=.005;a.inputState.pinching&&h>S+G?(a.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:A.handedness,target:this})):!a.inputState.pinching&&h<=S-G&&(a.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:A.handedness,target:this}))}else n!==null&&A.gripSpace&&(i=I.getPose(A.gripSpace,g),i!==null&&(n.matrix.fromArray(i.transform.matrix),n.matrix.decompose(n.position,n.rotation,n.scale),n.matrixWorldNeedsUpdate=!0,i.linearVelocity?(n.hasLinearVelocity=!0,n.linearVelocity.copy(i.linearVelocity)):n.hasLinearVelocity=!1,i.angularVelocity?(n.hasAngularVelocity=!0,n.angularVelocity.copy(i.angularVelocity)):n.hasAngularVelocity=!1));E!==null&&(C=I.getPose(A.targetRaySpace,g),C===null&&i!==null&&(C=i),C!==null&&(E.matrix.fromArray(C.transform.matrix),E.matrix.decompose(E.position,E.rotation,E.scale),E.matrixWorldNeedsUpdate=!0,C.linearVelocity?(E.hasLinearVelocity=!0,E.linearVelocity.copy(C.linearVelocity)):E.hasLinearVelocity=!1,C.angularVelocity?(E.hasAngularVelocity=!0,E.angularVelocity.copy(C.angularVelocity)):E.hasAngularVelocity=!1,this.dispatchEvent(ZL)))}return E!==null&&(E.visible=C!==null),n!==null&&(n.visible=i!==null),a!==null&&(a.visible=e!==null),this}_getHandJoint(A,I){if(A.joints[I.jointName]===void 0){const g=new tE;g.matrixAutoUpdate=!1,g.visible=!1,A.joints[I.jointName]=g,A.add(g)}return A.joints[I.jointName]}}const PL=`
+}`;function qL(B,A,I){let g=new El;const C=new PA,i=new PA,e=new Hg,E=new gG({depthPacking:_U}),n=new CG,a={},l=I.maxTextureSize,D={[re]:oi,[oi]:re,[vi]:vi},h=new ni({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new PA},radius:{value:4}},vertexShader:LL,fragmentShader:YL}),S=h.clone();S.defines.HORIZONTAL_PASS=1;const G=new tg;G.setAttribute("position",new Eg(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const U=new DC(G,h),k=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Sc;let y=this.type;this.render=function(m,x,T){if(k.enabled===!1||k.autoUpdate===!1&&k.needsUpdate===!1||m.length===0)return;const L=B.getRenderTarget(),Y=B.getActiveCubeFace(),b=B.getActiveMipmapLevel(),IA=B.state;IA.setBlending(ne),IA.buffers.color.setClear(1,1,1,1),IA.buffers.depth.setTest(!0),IA.setScissorTest(!1);const CA=y!==HQ&&this.type===HQ,nA=y===HQ&&this.type!==HQ;for(let uA=0,EA=m.length;uAl||C.y>l)&&(C.x>l&&(i.x=Math.floor(l/aA.x),C.x=i.x*aA.x,V.mapSize.x=i.x),C.y>l&&(i.y=Math.floor(l/aA.y),C.y=i.y*aA.y,V.mapSize.y=i.y)),V.map===null||CA===!0||nA===!0){const P=this.type!==HQ?{minFilter:cB,magFilter:cB}:{};V.map!==null&&V.map.dispose(),V.map=new bi(C.x,C.y,P),V.map.texture.name=pA.name+".shadowMap",V.camera.updateProjectionMatrix()}B.setRenderTarget(V.map),B.clear();const BA=V.getViewportCount();for(let P=0;P0||x.map&&x.alphaTest>0){const IA=Y.uuid,CA=x.uuid;let nA=a[IA];nA===void 0&&(nA={},a[IA]=nA);let uA=nA[CA];uA===void 0&&(uA=Y.clone(),nA[CA]=uA,x.addEventListener("dispose",v)),Y=uA}if(Y.visible=x.visible,Y.wireframe=x.wireframe,L===HQ?Y.side=x.shadowSide!==null?x.shadowSide:x.side:Y.side=x.shadowSide!==null?x.shadowSide:D[x.side],Y.alphaMap=x.alphaMap,Y.alphaTest=x.alphaTest,Y.map=x.map,Y.clipShadows=x.clipShadows,Y.clippingPlanes=x.clippingPlanes,Y.clipIntersection=x.clipIntersection,Y.displacementMap=x.displacementMap,Y.displacementScale=x.displacementScale,Y.displacementBias=x.displacementBias,Y.wireframeLinewidth=x.wireframeLinewidth,Y.linewidth=x.linewidth,T.isPointLight===!0&&Y.isMeshDistanceMaterial===!0){const IA=B.properties.get(Y);IA.light=T}return Y}function F(m,x,T,L,Y){if(m.visible===!1)return;if(m.layers.test(x.layers)&&(m.isMesh||m.isLine||m.isPoints)&&(m.castShadow||m.receiveShadow&&Y===HQ)&&(!m.frustumCulled||g.intersectsObject(m))){m.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,m.matrixWorld);const CA=A.update(m),nA=m.material;if(Array.isArray(nA)){const uA=CA.groups;for(let EA=0,pA=uA.length;EA=1):V.indexOf("OpenGL ES")!==-1&&(pA=parseFloat(/^OpenGL ES (\d)/.exec(V)[1]),EA=pA>=2);let aA=null,BA={};const P=B.getParameter(B.SCISSOR_BOX),oA=B.getParameter(B.VIEWPORT),vA=new Hg().fromArray(P),cA=new Hg().fromArray(oA);function FA(sA,KA,fA,bA){const hI=new Uint8Array(4),aI=B.createTexture();B.bindTexture(sA,aI),B.texParameteri(sA,B.TEXTURE_MIN_FILTER,B.NEAREST),B.texParameteri(sA,B.TEXTURE_MAG_FILTER,B.NEAREST);for(let PI=0;PIA?(B.repeat.x=1,B.repeat.y=I/A,B.offset.x=0,B.offset.y=(1-B.repeat.y)/2):(B.repeat.x=A/I,B.repeat.y=1,B.offset.x=(1-B.repeat.x)/2,B.offset.y=0),B}function xL(B,A){const I=B.image&&B.image.width?B.image.width/B.image.height:1;return I>A?(B.repeat.x=A/I,B.repeat.y=1,B.offset.x=(1-B.repeat.x)/2,B.offset.y=0):(B.repeat.x=1,B.repeat.y=I/A,B.offset.x=0,B.offset.y=(1-B.repeat.y)/2),B}function vL(B){return B.repeat.x=1,B.repeat.y=1,B.offset.x=0,B.offset.y=0,B}function My(B,A,I,g){const C=OL(g);switch(I){case Ty:return B*A;case vy:return B*A;case Oy:return B*A*2;case Cl:return B*A/C.components*C.byteLength;case Bl:return B*A/C.components*C.byteLength;case by:return B*A*2/C.components*C.byteLength;case Mc:return B*A*2/C.components*C.byteLength;case xy:return B*A*3/C.components*C.byteLength;case YC:return B*A*4/C.components*C.byteLength;case Uc:return B*A*4/C.components*C.byteLength;case ur:case Mr:return Math.floor((B+3)/4)*Math.floor((A+3)/4)*8;case Ur:case pr:return Math.floor((B+3)/4)*Math.floor((A+3)/4)*16;case Nh:case Kh:return Math.max(B,16)*Math.max(A,8)/4;case dh:case Jh:return Math.max(B,8)*Math.max(A,8)/2;case Fh:case fh:return Math.floor((B+3)/4)*Math.floor((A+3)/4)*8;case Rh:return Math.floor((B+3)/4)*Math.floor((A+3)/4)*16;case Lh:return Math.floor((B+3)/4)*Math.floor((A+3)/4)*16;case Yh:return Math.floor((B+4)/5)*Math.floor((A+3)/4)*16;case qh:return Math.floor((B+4)/5)*Math.floor((A+4)/5)*16;case mh:return Math.floor((B+5)/6)*Math.floor((A+4)/5)*16;case Hh:return Math.floor((B+5)/6)*Math.floor((A+5)/6)*16;case Th:return Math.floor((B+7)/8)*Math.floor((A+4)/5)*16;case xh:return Math.floor((B+7)/8)*Math.floor((A+5)/6)*16;case vh:return Math.floor((B+7)/8)*Math.floor((A+7)/8)*16;case Oh:return Math.floor((B+9)/10)*Math.floor((A+4)/5)*16;case bh:return Math.floor((B+9)/10)*Math.floor((A+5)/6)*16;case _h:return Math.floor((B+9)/10)*Math.floor((A+7)/8)*16;case Zh:return Math.floor((B+9)/10)*Math.floor((A+9)/10)*16;case Ph:return Math.floor((B+11)/12)*Math.floor((A+9)/10)*16;case Wh:return Math.floor((B+11)/12)*Math.floor((A+11)/12)*16;case dr:case Vh:case jh:return Math.ceil(B/4)*Math.ceil(A/4)*16;case _y:case Xh:return Math.ceil(B/4)*Math.ceil(A/4)*8;case zh:case $h:return Math.ceil(B/4)*Math.ceil(A/4)*16}throw new Error(`Unable to determine texture byte length for ${I} format.`)}function OL(B){switch(B){case di:case yc:return{byteLength:1,components:1};case ms:case Gc:case hB:return{byteLength:2,components:1};case kc:case uc:return{byteLength:2,components:4};case he:case gl:case yC:return{byteLength:4,components:1};case Hy:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${B}.`)}const bL={contain:TL,cover:xL,fill:vL,getByteLength:My};function _L(B,A,I,g,C,i,e){const E=A.has("WEBGL_multisampled_render_to_texture")?A.get("WEBGL_multisampled_render_to_texture"):null,n=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),a=new PA,l=new WeakMap;let D;const h=new WeakMap;let S=!1;try{S=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function G(W,O){return S?new OffscreenCanvas(W,O):mr("canvas")}function U(W,O,MA){let HA=1;const ZA=nI(W);if((ZA.width>MA||ZA.height>MA)&&(HA=MA/Math.max(ZA.width,ZA.height)),HA<1)if(typeof HTMLImageElement<"u"&&W instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&W instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&W instanceof ImageBitmap||typeof VideoFrame<"u"&&W instanceof VideoFrame){const xA=Math.floor(HA*ZA.width),UI=Math.floor(HA*ZA.height);D===void 0&&(D=G(xA,UI));const tI=O?G(xA,UI):D;return tI.width=xA,tI.height=UI,tI.getContext("2d").drawImage(W,0,0,xA,UI),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+ZA.width+"x"+ZA.height+") to ("+xA+"x"+UI+")."),tI}else return"data"in W&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+ZA.width+"x"+ZA.height+")."),W;return W}function k(W){return W.generateMipmaps}function y(W){B.generateMipmap(W)}function d(W){return W.isWebGLCubeRenderTarget?B.TEXTURE_CUBE_MAP:W.isWebGL3DRenderTarget?B.TEXTURE_3D:W.isWebGLArrayRenderTarget||W.isCompressedArrayTexture?B.TEXTURE_2D_ARRAY:B.TEXTURE_2D}function J(W,O,MA,HA,ZA=!1){if(W!==null){if(B[W]!==void 0)return B[W];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+W+"'")}let xA=O;if(O===B.RED&&(MA===B.FLOAT&&(xA=B.R32F),MA===B.HALF_FLOAT&&(xA=B.R16F),MA===B.UNSIGNED_BYTE&&(xA=B.R8)),O===B.RED_INTEGER&&(MA===B.UNSIGNED_BYTE&&(xA=B.R8UI),MA===B.UNSIGNED_SHORT&&(xA=B.R16UI),MA===B.UNSIGNED_INT&&(xA=B.R32UI),MA===B.BYTE&&(xA=B.R8I),MA===B.SHORT&&(xA=B.R16I),MA===B.INT&&(xA=B.R32I)),O===B.RG&&(MA===B.FLOAT&&(xA=B.RG32F),MA===B.HALF_FLOAT&&(xA=B.RG16F),MA===B.UNSIGNED_BYTE&&(xA=B.RG8)),O===B.RG_INTEGER&&(MA===B.UNSIGNED_BYTE&&(xA=B.RG8UI),MA===B.UNSIGNED_SHORT&&(xA=B.RG16UI),MA===B.UNSIGNED_INT&&(xA=B.RG32UI),MA===B.BYTE&&(xA=B.RG8I),MA===B.SHORT&&(xA=B.RG16I),MA===B.INT&&(xA=B.RG32I)),O===B.RGB_INTEGER&&(MA===B.UNSIGNED_BYTE&&(xA=B.RGB8UI),MA===B.UNSIGNED_SHORT&&(xA=B.RGB16UI),MA===B.UNSIGNED_INT&&(xA=B.RGB32UI),MA===B.BYTE&&(xA=B.RGB8I),MA===B.SHORT&&(xA=B.RGB16I),MA===B.INT&&(xA=B.RGB32I)),O===B.RGBA_INTEGER&&(MA===B.UNSIGNED_BYTE&&(xA=B.RGBA8UI),MA===B.UNSIGNED_SHORT&&(xA=B.RGBA16UI),MA===B.UNSIGNED_INT&&(xA=B.RGBA32UI),MA===B.BYTE&&(xA=B.RGBA8I),MA===B.SHORT&&(xA=B.RGBA16I),MA===B.INT&&(xA=B.RGBA32I)),O===B.RGB&&MA===B.UNSIGNED_INT_5_9_9_9_REV&&(xA=B.RGB9_E5),O===B.RGBA){const UI=ZA?il:Kg.getTransfer(HA);MA===B.FLOAT&&(xA=B.RGBA32F),MA===B.HALF_FLOAT&&(xA=B.RGBA16F),MA===B.UNSIGNED_BYTE&&(xA=UI===Xg?B.SRGB8_ALPHA8:B.RGBA8),MA===B.UNSIGNED_SHORT_4_4_4_4&&(xA=B.RGBA4),MA===B.UNSIGNED_SHORT_5_5_5_1&&(xA=B.RGB5_A1)}return(xA===B.R16F||xA===B.R32F||xA===B.RG16F||xA===B.RG32F||xA===B.RGBA16F||xA===B.RGBA32F)&&A.get("EXT_color_buffer_float"),xA}function F(W,O){let MA;return W?O===null||O===he||O===vo?MA=B.DEPTH24_STENCIL8:O===yC?MA=B.DEPTH32F_STENCIL8:O===ms&&(MA=B.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):O===null||O===he||O===vo?MA=B.DEPTH_COMPONENT24:O===yC?MA=B.DEPTH_COMPONENT32F:O===ms&&(MA=B.DEPTH_COMPONENT16),MA}function v(W,O){return k(W)===!0||W.isFramebufferTexture&&W.minFilter!==cB&&W.minFilter!==Og?Math.log2(Math.max(O.width,O.height))+1:W.mipmaps!==void 0&&W.mipmaps.length>0?W.mipmaps.length:W.isCompressedTexture&&Array.isArray(W.image)?O.mipmaps.length:1}function m(W){const O=W.target;O.removeEventListener("dispose",m),T(O),O.isVideoTexture&&l.delete(O)}function x(W){const O=W.target;O.removeEventListener("dispose",x),Y(O)}function T(W){const O=g.get(W);if(O.__webglInit===void 0)return;const MA=W.source,HA=h.get(MA);if(HA){const ZA=HA[O.__cacheKey];ZA.usedTimes--,ZA.usedTimes===0&&L(W),Object.keys(HA).length===0&&h.delete(MA)}g.remove(W)}function L(W){const O=g.get(W);B.deleteTexture(O.__webglTexture);const MA=W.source,HA=h.get(MA);delete HA[O.__cacheKey],e.memory.textures--}function Y(W){const O=g.get(W);if(W.depthTexture&&(W.depthTexture.dispose(),g.remove(W.depthTexture)),W.isWebGLCubeRenderTarget)for(let HA=0;HA<6;HA++){if(Array.isArray(O.__webglFramebuffer[HA]))for(let ZA=0;ZA=C.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+W+" texture units while this GPU supports only "+C.maxTextures),b+=1,W}function nA(W){const O=[];return O.push(W.wrapS),O.push(W.wrapT),O.push(W.wrapR||0),O.push(W.magFilter),O.push(W.minFilter),O.push(W.anisotropy),O.push(W.internalFormat),O.push(W.format),O.push(W.type),O.push(W.generateMipmaps),O.push(W.premultiplyAlpha),O.push(W.flipY),O.push(W.unpackAlignment),O.push(W.colorSpace),O.join()}function uA(W,O){const MA=g.get(W);if(W.isVideoTexture&&CI(W),W.isRenderTargetTexture===!1&&W.version>0&&MA.__version!==W.version){const HA=W.image;if(HA===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(HA.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{cA(MA,W,O);return}}I.bindTexture(B.TEXTURE_2D,MA.__webglTexture,B.TEXTURE0+O)}function EA(W,O){const MA=g.get(W);if(W.version>0&&MA.__version!==W.version){cA(MA,W,O);return}I.bindTexture(B.TEXTURE_2D_ARRAY,MA.__webglTexture,B.TEXTURE0+O)}function pA(W,O){const MA=g.get(W);if(W.version>0&&MA.__version!==W.version){cA(MA,W,O);return}I.bindTexture(B.TEXTURE_3D,MA.__webglTexture,B.TEXTURE0+O)}function V(W,O){const MA=g.get(W);if(W.version>0&&MA.__version!==W.version){FA(MA,W,O);return}I.bindTexture(B.TEXTURE_CUBE_MAP,MA.__webglTexture,B.TEXTURE0+O)}const aA={[De]:B.REPEAT,[LC]:B.CLAMP_TO_EDGE,[qs]:B.MIRRORED_REPEAT},BA={[cB]:B.NEAREST,[wc]:B.NEAREST_MIPMAP_NEAREST,[po]:B.NEAREST_MIPMAP_LINEAR,[Og]:B.LINEAR,[Ks]:B.LINEAR_MIPMAP_NEAREST,[tQ]:B.LINEAR_MIPMAP_LINEAR},P={[PU]:B.NEVER,[$U]:B.ALWAYS,[WU]:B.LESS,[Wy]:B.LEQUAL,[VU]:B.EQUAL,[zU]:B.GEQUAL,[jU]:B.GREATER,[XU]:B.NOTEQUAL};function oA(W,O){if(O.type===yC&&A.has("OES_texture_float_linear")===!1&&(O.magFilter===Og||O.magFilter===Ks||O.magFilter===po||O.magFilter===tQ||O.minFilter===Og||O.minFilter===Ks||O.minFilter===po||O.minFilter===tQ)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),B.texParameteri(W,B.TEXTURE_WRAP_S,aA[O.wrapS]),B.texParameteri(W,B.TEXTURE_WRAP_T,aA[O.wrapT]),(W===B.TEXTURE_3D||W===B.TEXTURE_2D_ARRAY)&&B.texParameteri(W,B.TEXTURE_WRAP_R,aA[O.wrapR]),B.texParameteri(W,B.TEXTURE_MAG_FILTER,BA[O.magFilter]),B.texParameteri(W,B.TEXTURE_MIN_FILTER,BA[O.minFilter]),O.compareFunction&&(B.texParameteri(W,B.TEXTURE_COMPARE_MODE,B.COMPARE_REF_TO_TEXTURE),B.texParameteri(W,B.TEXTURE_COMPARE_FUNC,P[O.compareFunction])),A.has("EXT_texture_filter_anisotropic")===!0){if(O.magFilter===cB||O.minFilter!==po&&O.minFilter!==tQ||O.type===yC&&A.has("OES_texture_float_linear")===!1)return;if(O.anisotropy>1||g.get(O).__currentAnisotropy){const MA=A.get("EXT_texture_filter_anisotropic");B.texParameterf(W,MA.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(O.anisotropy,C.getMaxAnisotropy())),g.get(O).__currentAnisotropy=O.anisotropy}}}function vA(W,O){let MA=!1;W.__webglInit===void 0&&(W.__webglInit=!0,O.addEventListener("dispose",m));const HA=O.source;let ZA=h.get(HA);ZA===void 0&&(ZA={},h.set(HA,ZA));const xA=nA(O);if(xA!==W.__cacheKey){ZA[xA]===void 0&&(ZA[xA]={texture:B.createTexture(),usedTimes:0},e.memory.textures++,MA=!0),ZA[xA].usedTimes++;const UI=ZA[W.__cacheKey];UI!==void 0&&(ZA[W.__cacheKey].usedTimes--,UI.usedTimes===0&&L(O)),W.__cacheKey=xA,W.__webglTexture=ZA[xA].texture}return MA}function cA(W,O,MA){let HA=B.TEXTURE_2D;(O.isDataArrayTexture||O.isCompressedArrayTexture)&&(HA=B.TEXTURE_2D_ARRAY),O.isData3DTexture&&(HA=B.TEXTURE_3D);const ZA=vA(W,O),xA=O.source;I.bindTexture(HA,W.__webglTexture,B.TEXTURE0+MA);const UI=g.get(xA);if(xA.version!==UI.__version||ZA===!0){I.activeTexture(B.TEXTURE0+MA);const tI=Kg.getPrimaries(Kg.workingColorSpace),DI=O.colorSpace===eE?null:Kg.getPrimaries(O.colorSpace),Ig=O.colorSpace===eE||tI===DI?B.NONE:B.BROWSER_DEFAULT_WEBGL;B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,O.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,O.unpackAlignment),B.pixelStorei(B.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ig);let zA=U(O.image,!1,C.maxTextureSize);zA=HI(O,zA);const uI=i.convert(O.format,O.colorSpace),LI=i.convert(O.type);let JI=J(O.internalFormat,uI,LI,O.colorSpace,O.isVideoTexture);oA(HA,O);let kI;const $I=O.mipmaps,RI=O.isVideoTexture!==!0,ZI=UI.__version===void 0||ZA===!0,sA=xA.dataReady,KA=v(O,zA);if(O.isDepthTexture)JI=F(O.format===Oo,O.type),ZI&&(RI?I.texStorage2D(B.TEXTURE_2D,1,JI,zA.width,zA.height):I.texImage2D(B.TEXTURE_2D,0,JI,zA.width,zA.height,0,uI,LI,null));else if(O.isDataTexture)if($I.length>0){RI&&ZI&&I.texStorage2D(B.TEXTURE_2D,KA,JI,$I[0].width,$I[0].height);for(let fA=0,bA=$I.length;fA0){const hI=My(kI.width,kI.height,O.format,O.type);for(const aI of O.layerUpdates){const PI=kI.data.subarray(aI*hI/kI.data.BYTES_PER_ELEMENT,(aI+1)*hI/kI.data.BYTES_PER_ELEMENT);I.compressedTexSubImage3D(B.TEXTURE_2D_ARRAY,fA,0,0,aI,kI.width,kI.height,1,uI,PI)}O.clearLayerUpdates()}else I.compressedTexSubImage3D(B.TEXTURE_2D_ARRAY,fA,0,0,0,kI.width,kI.height,zA.depth,uI,kI.data)}else I.compressedTexImage3D(B.TEXTURE_2D_ARRAY,fA,JI,kI.width,kI.height,zA.depth,0,kI.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else RI?sA&&I.texSubImage3D(B.TEXTURE_2D_ARRAY,fA,0,0,0,kI.width,kI.height,zA.depth,uI,LI,kI.data):I.texImage3D(B.TEXTURE_2D_ARRAY,fA,JI,kI.width,kI.height,zA.depth,0,uI,LI,kI.data)}else{RI&&ZI&&I.texStorage2D(B.TEXTURE_2D,KA,JI,$I[0].width,$I[0].height);for(let fA=0,bA=$I.length;fA0){const fA=My(zA.width,zA.height,O.format,O.type);for(const bA of O.layerUpdates){const hI=zA.data.subarray(bA*fA/zA.data.BYTES_PER_ELEMENT,(bA+1)*fA/zA.data.BYTES_PER_ELEMENT);I.texSubImage3D(B.TEXTURE_2D_ARRAY,0,0,0,bA,zA.width,zA.height,1,uI,LI,hI)}O.clearLayerUpdates()}else I.texSubImage3D(B.TEXTURE_2D_ARRAY,0,0,0,0,zA.width,zA.height,zA.depth,uI,LI,zA.data)}else I.texImage3D(B.TEXTURE_2D_ARRAY,0,JI,zA.width,zA.height,zA.depth,0,uI,LI,zA.data);else if(O.isData3DTexture)RI?(ZI&&I.texStorage3D(B.TEXTURE_3D,KA,JI,zA.width,zA.height,zA.depth),sA&&I.texSubImage3D(B.TEXTURE_3D,0,0,0,0,zA.width,zA.height,zA.depth,uI,LI,zA.data)):I.texImage3D(B.TEXTURE_3D,0,JI,zA.width,zA.height,zA.depth,0,uI,LI,zA.data);else if(O.isFramebufferTexture){if(ZI)if(RI)I.texStorage2D(B.TEXTURE_2D,KA,JI,zA.width,zA.height);else{let fA=zA.width,bA=zA.height;for(let hI=0;hI>=1,bA>>=1}}else if($I.length>0){if(RI&&ZI){const fA=nI($I[0]);I.texStorage2D(B.TEXTURE_2D,KA,JI,fA.width,fA.height)}for(let fA=0,bA=$I.length;fA0&&KA++;const bA=nI(uI[0]);I.texStorage2D(B.TEXTURE_CUBE_MAP,KA,$I,bA.width,bA.height)}for(let bA=0;bA<6;bA++)if(zA){RI?sA&&I.texSubImage2D(B.TEXTURE_CUBE_MAP_POSITIVE_X+bA,0,0,0,uI[bA].width,uI[bA].height,JI,kI,uI[bA].data):I.texImage2D(B.TEXTURE_CUBE_MAP_POSITIVE_X+bA,0,$I,uI[bA].width,uI[bA].height,0,JI,kI,uI[bA].data);for(let hI=0;hI>xA),LI=Math.max(1,O.height>>xA);ZA===B.TEXTURE_3D||ZA===B.TEXTURE_2D_ARRAY?I.texImage3D(ZA,xA,DI,uI,LI,O.depth,0,UI,tI,null):I.texImage2D(ZA,xA,DI,uI,LI,0,UI,tI,null)}I.bindFramebuffer(B.FRAMEBUFFER,W),lI(O)?E.framebufferTexture2DMultisampleEXT(B.FRAMEBUFFER,HA,ZA,zA.__webglTexture,0,jA(O)):(ZA===B.TEXTURE_2D||ZA>=B.TEXTURE_CUBE_MAP_POSITIVE_X&&ZA<=B.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&B.framebufferTexture2D(B.FRAMEBUFFER,HA,ZA,zA.__webglTexture,xA),I.bindFramebuffer(B.FRAMEBUFFER,null)}function LA(W,O,MA){if(B.bindRenderbuffer(B.RENDERBUFFER,W),O.depthBuffer){const HA=O.depthTexture,ZA=HA&&HA.isDepthTexture?HA.type:null,xA=F(O.stencilBuffer,ZA),UI=O.stencilBuffer?B.DEPTH_STENCIL_ATTACHMENT:B.DEPTH_ATTACHMENT,tI=jA(O);lI(O)?E.renderbufferStorageMultisampleEXT(B.RENDERBUFFER,tI,xA,O.width,O.height):MA?B.renderbufferStorageMultisample(B.RENDERBUFFER,tI,xA,O.width,O.height):B.renderbufferStorage(B.RENDERBUFFER,xA,O.width,O.height),B.framebufferRenderbuffer(B.FRAMEBUFFER,UI,B.RENDERBUFFER,W)}else{const HA=O.textures;for(let ZA=0;ZA{delete O.__boundDepthTexture,delete O.__depthDisposeCallback,HA.removeEventListener("dispose",ZA)};HA.addEventListener("dispose",ZA),O.__depthDisposeCallback=ZA}O.__boundDepthTexture=HA}if(W.depthTexture&&!O.__autoAllocateDepthBuffer){if(MA)throw new Error("target.depthTexture not supported in Cube render targets");VA(O.__webglFramebuffer,W)}else if(MA){O.__webglDepthbuffer=[];for(let HA=0;HA<6;HA++)if(I.bindFramebuffer(B.FRAMEBUFFER,O.__webglFramebuffer[HA]),O.__webglDepthbuffer[HA]===void 0)O.__webglDepthbuffer[HA]=B.createRenderbuffer(),LA(O.__webglDepthbuffer[HA],W,!1);else{const ZA=W.stencilBuffer?B.DEPTH_STENCIL_ATTACHMENT:B.DEPTH_ATTACHMENT,xA=O.__webglDepthbuffer[HA];B.bindRenderbuffer(B.RENDERBUFFER,xA),B.framebufferRenderbuffer(B.FRAMEBUFFER,ZA,B.RENDERBUFFER,xA)}}else if(I.bindFramebuffer(B.FRAMEBUFFER,O.__webglFramebuffer),O.__webglDepthbuffer===void 0)O.__webglDepthbuffer=B.createRenderbuffer(),LA(O.__webglDepthbuffer,W,!1);else{const HA=W.stencilBuffer?B.DEPTH_STENCIL_ATTACHMENT:B.DEPTH_ATTACHMENT,ZA=O.__webglDepthbuffer;B.bindRenderbuffer(B.RENDERBUFFER,ZA),B.framebufferRenderbuffer(B.FRAMEBUFFER,HA,B.RENDERBUFFER,ZA)}I.bindFramebuffer(B.FRAMEBUFFER,null)}function BI(W,O,MA){const HA=g.get(W);O!==void 0&&wA(HA.__webglFramebuffer,W,W.texture,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,0),MA!==void 0&&WA(W)}function pI(W){const O=W.texture,MA=g.get(W),HA=g.get(O);W.addEventListener("dispose",x);const ZA=W.textures,xA=W.isWebGLCubeRenderTarget===!0,UI=ZA.length>1;if(UI||(HA.__webglTexture===void 0&&(HA.__webglTexture=B.createTexture()),HA.__version=O.version,e.memory.textures++),xA){MA.__webglFramebuffer=[];for(let tI=0;tI<6;tI++)if(O.mipmaps&&O.mipmaps.length>0){MA.__webglFramebuffer[tI]=[];for(let DI=0;DI0){MA.__webglFramebuffer=[];for(let tI=0;tI0&&lI(W)===!1){MA.__webglMultisampledFramebuffer=B.createFramebuffer(),MA.__webglColorRenderbuffer=[],I.bindFramebuffer(B.FRAMEBUFFER,MA.__webglMultisampledFramebuffer);for(let tI=0;tI0)for(let DI=0;DI0)for(let DI=0;DI0){if(lI(W)===!1){const O=W.textures,MA=W.width,HA=W.height;let ZA=B.COLOR_BUFFER_BIT;const xA=W.stencilBuffer?B.DEPTH_STENCIL_ATTACHMENT:B.DEPTH_ATTACHMENT,UI=g.get(W),tI=O.length>1;if(tI)for(let DI=0;DI0&&A.has("WEBGL_multisampled_render_to_texture")===!0&&O.__useRenderToTexture!==!1}function CI(W){const O=e.render.frame;l.get(W)!==O&&(l.set(W,O),W.update())}function HI(W,O){const MA=W.colorSpace,HA=W.format,ZA=W.type;return W.isCompressedTexture===!0||W.isVideoTexture===!0||MA!==ce&&MA!==eE&&(Kg.getTransfer(MA)===Xg?(HA!==YC||ZA!==di)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",MA)),O}function nI(W){return typeof HTMLImageElement<"u"&&W instanceof HTMLImageElement?(a.width=W.naturalWidth||W.width,a.height=W.naturalHeight||W.height):typeof VideoFrame<"u"&&W instanceof VideoFrame?(a.width=W.displayWidth,a.height=W.displayHeight):(a.width=W.width,a.height=W.height),a}this.allocateTextureUnit=CA,this.resetTextureUnits=IA,this.setTexture2D=uA,this.setTexture2DArray=EA,this.setTexture3D=pA,this.setTextureCube=V,this.rebindTextures=BI,this.setupRenderTarget=pI,this.updateRenderTargetMipmap=TA,this.updateMultisampleRenderTarget=SI,this.setupDepthRenderbuffer=WA,this.setupFrameBufferTexture=wA,this.useMultisampledRTT=lI}function rp(B,A){function I(g,C=eE){let i;const e=Kg.getTransfer(C);if(g===di)return B.UNSIGNED_BYTE;if(g===kc)return B.UNSIGNED_SHORT_4_4_4_4;if(g===uc)return B.UNSIGNED_SHORT_5_5_5_1;if(g===Hy)return B.UNSIGNED_INT_5_9_9_9_REV;if(g===yc)return B.BYTE;if(g===Gc)return B.SHORT;if(g===ms)return B.UNSIGNED_SHORT;if(g===gl)return B.INT;if(g===he)return B.UNSIGNED_INT;if(g===yC)return B.FLOAT;if(g===hB)return B.HALF_FLOAT;if(g===Ty)return B.ALPHA;if(g===xy)return B.RGB;if(g===YC)return B.RGBA;if(g===vy)return B.LUMINANCE;if(g===Oy)return B.LUMINANCE_ALPHA;if(g===qo)return B.DEPTH_COMPONENT;if(g===Oo)return B.DEPTH_STENCIL;if(g===Cl)return B.RED;if(g===Bl)return B.RED_INTEGER;if(g===by)return B.RG;if(g===Mc)return B.RG_INTEGER;if(g===Uc)return B.RGBA_INTEGER;if(g===ur||g===Mr||g===Ur||g===pr)if(e===Xg)if(i=A.get("WEBGL_compressed_texture_s3tc_srgb"),i!==null){if(g===ur)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(g===Mr)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(g===Ur)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(g===pr)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(i=A.get("WEBGL_compressed_texture_s3tc"),i!==null){if(g===ur)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(g===Mr)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(g===Ur)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(g===pr)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(g===dh||g===Nh||g===Jh||g===Kh)if(i=A.get("WEBGL_compressed_texture_pvrtc"),i!==null){if(g===dh)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(g===Nh)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(g===Jh)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(g===Kh)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(g===Fh||g===fh||g===Rh)if(i=A.get("WEBGL_compressed_texture_etc"),i!==null){if(g===Fh||g===fh)return e===Xg?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(g===Rh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(g===Lh||g===Yh||g===qh||g===mh||g===Hh||g===Th||g===xh||g===vh||g===Oh||g===bh||g===_h||g===Zh||g===Ph||g===Wh)if(i=A.get("WEBGL_compressed_texture_astc"),i!==null){if(g===Lh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(g===Yh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(g===qh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(g===mh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(g===Hh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(g===Th)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(g===xh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(g===vh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(g===Oh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(g===bh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(g===_h)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(g===Zh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(g===Ph)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(g===Wh)return e===Xg?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(g===dr||g===Vh||g===jh)if(i=A.get("EXT_texture_compression_bptc"),i!==null){if(g===dr)return e===Xg?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(g===Vh)return i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(g===jh)return i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(g===_y||g===Xh||g===zh||g===$h)if(i=A.get("EXT_texture_compression_rgtc"),i!==null){if(g===dr)return i.COMPRESSED_RED_RGTC1_EXT;if(g===Xh)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(g===zh)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(g===$h)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return g===vo?B.UNSIGNED_INT_24_8:B[g]!==void 0?B[g]:null}return{convert:I}}class lp extends CB{constructor(A=[]){super(),this.isArrayCamera=!0,this.cameras=A}}class tE extends Ng{constructor(){super(),this.isGroup=!0,this.type="Group"}}const ZL={type:"move"};class Nw{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new tE,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new tE,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Z,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Z),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new tE,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Z,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Z),this._grip}dispatchEvent(A){return this._targetRay!==null&&this._targetRay.dispatchEvent(A),this._grip!==null&&this._grip.dispatchEvent(A),this._hand!==null&&this._hand.dispatchEvent(A),this}connect(A){if(A&&A.hand){const I=this._hand;if(I)for(const g of A.hand.values())this._getHandJoint(I,g)}return this.dispatchEvent({type:"connected",data:A}),this}disconnect(A){return this.dispatchEvent({type:"disconnected",data:A}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(A,I,g){let C=null,i=null,e=null;const E=this._targetRay,n=this._grip,a=this._hand;if(A&&I.session.visibilityState!=="visible-blurred"){if(a&&A.hand){e=!0;for(const U of A.hand.values()){const k=I.getJointPose(U,g),y=this._getHandJoint(a,U);k!==null&&(y.matrix.fromArray(k.transform.matrix),y.matrix.decompose(y.position,y.rotation,y.scale),y.matrixWorldNeedsUpdate=!0,y.jointRadius=k.radius),y.visible=k!==null}const l=a.joints["index-finger-tip"],D=a.joints["thumb-tip"],h=l.position.distanceTo(D.position),S=.02,G=.005;a.inputState.pinching&&h>S+G?(a.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:A.handedness,target:this})):!a.inputState.pinching&&h<=S-G&&(a.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:A.handedness,target:this}))}else n!==null&&A.gripSpace&&(i=I.getPose(A.gripSpace,g),i!==null&&(n.matrix.fromArray(i.transform.matrix),n.matrix.decompose(n.position,n.rotation,n.scale),n.matrixWorldNeedsUpdate=!0,i.linearVelocity?(n.hasLinearVelocity=!0,n.linearVelocity.copy(i.linearVelocity)):n.hasLinearVelocity=!1,i.angularVelocity?(n.hasAngularVelocity=!0,n.angularVelocity.copy(i.angularVelocity)):n.hasAngularVelocity=!1));E!==null&&(C=I.getPose(A.targetRaySpace,g),C===null&&i!==null&&(C=i),C!==null&&(E.matrix.fromArray(C.transform.matrix),E.matrix.decompose(E.position,E.rotation,E.scale),E.matrixWorldNeedsUpdate=!0,C.linearVelocity?(E.hasLinearVelocity=!0,E.linearVelocity.copy(C.linearVelocity)):E.hasLinearVelocity=!1,C.angularVelocity?(E.hasAngularVelocity=!0,E.angularVelocity.copy(C.angularVelocity)):E.hasAngularVelocity=!1,this.dispatchEvent(ZL)))}return E!==null&&(E.visible=C!==null),n!==null&&(n.visible=i!==null),a!==null&&(a.visible=e!==null),this}_getHandJoint(A,I){if(A.joints[I.jointName]===void 0){const g=new tE;g.matrixAutoUpdate=!1,g.visible=!1,A.joints[I.jointName]=g,A.add(g)}return A.joints[I.jointName]}}const PL=`
void main() {
gl_Position = vec4( position, 1.0 );
@@ -3864,7 +3864,7 @@ void main() {
}
-}`;class VL{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(A,I,g){if(this.texture===null){const C=new Vg,i=A.properties.get(C);i.__webglTexture=I.texture,(I.depthNear!=g.depthNear||I.depthFar!=g.depthFar)&&(this.depthNear=I.depthNear,this.depthFar=I.depthFar),this.texture=C}}getMesh(A){if(this.texture!==null&&this.mesh===null){const I=A.cameras[0].viewport,g=new ni({vertexShader:PL,fragmentShader:WL,uniforms:{depthColor:{value:this.texture},depthWidth:{value:I.z},depthHeight:{value:I.w}}});this.mesh=new DC(new wt(20,20),g)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class jL extends Se{constructor(A,I){super();const g=this;let C=null,i=1,e=null,E="local-floor",n=1,a=null,r=null,D=null,h=null,S=null,G=null;const U=new VL,k=I.getContextAttributes();let y=null,d=null;const J=[],F=[],v=new PA;let m=null;const x=new CB;x.viewport=new Hg;const T=new CB;T.viewport=new Hg;const L=[x,T],Y=new lp;let b=null,IA=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(cA){let FA=J[cA];return FA===void 0&&(FA=new Nw,J[cA]=FA),FA.getTargetRaySpace()},this.getControllerGrip=function(cA){let FA=J[cA];return FA===void 0&&(FA=new Nw,J[cA]=FA),FA.getGripSpace()},this.getHand=function(cA){let FA=J[cA];return FA===void 0&&(FA=new Nw,J[cA]=FA),FA.getHandSpace()};function CA(cA){const FA=F.indexOf(cA.inputSource);if(FA===-1)return;const wA=J[FA];wA!==void 0&&(wA.update(cA.inputSource,cA.frame,a||e),wA.dispatchEvent({type:cA.type,data:cA.inputSource}))}function nA(){C.removeEventListener("select",CA),C.removeEventListener("selectstart",CA),C.removeEventListener("selectend",CA),C.removeEventListener("squeeze",CA),C.removeEventListener("squeezestart",CA),C.removeEventListener("squeezeend",CA),C.removeEventListener("end",nA),C.removeEventListener("inputsourceschange",uA);for(let cA=0;cA=0&&(F[LA]=null,J[LA].disconnect(wA))}for(let FA=0;FA=F.length){F.push(wA),LA=WA;break}else if(F[WA]===null){F[WA]=wA,LA=WA;break}if(LA===-1)break}const VA=J[LA];VA&&VA.connect(wA)}}const EA=new Z,pA=new Z;function V(cA,FA,wA){EA.setFromMatrixPosition(FA.matrixWorld),pA.setFromMatrixPosition(wA.matrixWorld);const LA=EA.distanceTo(pA),VA=FA.projectionMatrix.elements,WA=wA.projectionMatrix.elements,BI=VA[14]/(VA[10]-1),pI=VA[14]/(VA[10]+1),TA=(VA[9]+1)/VA[5],_A=(VA[9]-1)/VA[5],$=(VA[8]-1)/VA[0],SI=(WA[8]+1)/WA[0],jA=BI*$,lI=BI*SI,CI=LA/(-$+SI),HI=CI*-$;if(FA.matrixWorld.decompose(cA.position,cA.quaternion,cA.scale),cA.translateX(HI),cA.translateZ(CI),cA.matrixWorld.compose(cA.position,cA.quaternion,cA.scale),cA.matrixWorldInverse.copy(cA.matrixWorld).invert(),VA[10]===-1)cA.projectionMatrix.copy(FA.projectionMatrix),cA.projectionMatrixInverse.copy(FA.projectionMatrixInverse);else{const nI=BI+CI,W=pI+CI,O=jA-HI,MA=lI+(LA-HI),HA=TA*pI/W*nI,ZA=_A*pI/W*nI;cA.projectionMatrix.makePerspective(O,MA,HA,ZA,nI,W),cA.projectionMatrixInverse.copy(cA.projectionMatrix).invert()}}function aA(cA,FA){FA===null?cA.matrixWorld.copy(cA.matrix):cA.matrixWorld.multiplyMatrices(FA.matrixWorld,cA.matrix),cA.matrixWorldInverse.copy(cA.matrixWorld).invert()}this.updateCamera=function(cA){if(C===null)return;let FA=cA.near,wA=cA.far;U.texture!==null&&(U.depthNear>0&&(FA=U.depthNear),U.depthFar>0&&(wA=U.depthFar)),Y.near=T.near=x.near=FA,Y.far=T.far=x.far=wA,(b!==Y.near||IA!==Y.far)&&(C.updateRenderState({depthNear:Y.near,depthFar:Y.far}),b=Y.near,IA=Y.far),x.layers.mask=cA.layers.mask|2,T.layers.mask=cA.layers.mask|4,Y.layers.mask=x.layers.mask|T.layers.mask;const LA=cA.parent,VA=Y.cameras;aA(Y,LA);for(let WA=0;WA0&&(k.alphaTest.value=y.alphaTest);const d=A.get(y),J=d.envMap,F=d.envMapRotation;J&&(k.envMap.value=J,ao.copy(F),ao.x*=-1,ao.y*=-1,ao.z*=-1,J.isCubeTexture&&J.isRenderTargetTexture===!1&&(ao.y*=-1,ao.z*=-1),k.envMapRotation.value.setFromMatrix4(XL.makeRotationFromEuler(ao)),k.flipEnvMap.value=J.isCubeTexture&&J.isRenderTargetTexture===!1?-1:1,k.reflectivity.value=y.reflectivity,k.ior.value=y.ior,k.refractionRatio.value=y.refractionRatio),y.lightMap&&(k.lightMap.value=y.lightMap,k.lightMapIntensity.value=y.lightMapIntensity,I(y.lightMap,k.lightMapTransform)),y.aoMap&&(k.aoMap.value=y.aoMap,k.aoMapIntensity.value=y.aoMapIntensity,I(y.aoMap,k.aoMapTransform))}function e(k,y){k.diffuse.value.copy(y.color),k.opacity.value=y.opacity,y.map&&(k.map.value=y.map,I(y.map,k.mapTransform))}function E(k,y){k.dashSize.value=y.dashSize,k.totalSize.value=y.dashSize+y.gapSize,k.scale.value=y.scale}function n(k,y,d,J){k.diffuse.value.copy(y.color),k.opacity.value=y.opacity,k.size.value=y.size*d,k.scale.value=J*.5,y.map&&(k.map.value=y.map,I(y.map,k.uvTransform)),y.alphaMap&&(k.alphaMap.value=y.alphaMap,I(y.alphaMap,k.alphaMapTransform)),y.alphaTest>0&&(k.alphaTest.value=y.alphaTest)}function a(k,y){k.diffuse.value.copy(y.color),k.opacity.value=y.opacity,k.rotation.value=y.rotation,y.map&&(k.map.value=y.map,I(y.map,k.mapTransform)),y.alphaMap&&(k.alphaMap.value=y.alphaMap,I(y.alphaMap,k.alphaMapTransform)),y.alphaTest>0&&(k.alphaTest.value=y.alphaTest)}function r(k,y){k.specular.value.copy(y.specular),k.shininess.value=Math.max(y.shininess,1e-4)}function D(k,y){y.gradientMap&&(k.gradientMap.value=y.gradientMap)}function h(k,y){k.metalness.value=y.metalness,y.metalnessMap&&(k.metalnessMap.value=y.metalnessMap,I(y.metalnessMap,k.metalnessMapTransform)),k.roughness.value=y.roughness,y.roughnessMap&&(k.roughnessMap.value=y.roughnessMap,I(y.roughnessMap,k.roughnessMapTransform)),y.envMap&&(k.envMapIntensity.value=y.envMapIntensity)}function S(k,y,d){k.ior.value=y.ior,y.sheen>0&&(k.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),k.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(k.sheenColorMap.value=y.sheenColorMap,I(y.sheenColorMap,k.sheenColorMapTransform)),y.sheenRoughnessMap&&(k.sheenRoughnessMap.value=y.sheenRoughnessMap,I(y.sheenRoughnessMap,k.sheenRoughnessMapTransform))),y.clearcoat>0&&(k.clearcoat.value=y.clearcoat,k.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(k.clearcoatMap.value=y.clearcoatMap,I(y.clearcoatMap,k.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(k.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,I(y.clearcoatRoughnessMap,k.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(k.clearcoatNormalMap.value=y.clearcoatNormalMap,I(y.clearcoatNormalMap,k.clearcoatNormalMapTransform),k.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===oi&&k.clearcoatNormalScale.value.negate())),y.dispersion>0&&(k.dispersion.value=y.dispersion),y.iridescence>0&&(k.iridescence.value=y.iridescence,k.iridescenceIOR.value=y.iridescenceIOR,k.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],k.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(k.iridescenceMap.value=y.iridescenceMap,I(y.iridescenceMap,k.iridescenceMapTransform)),y.iridescenceThicknessMap&&(k.iridescenceThicknessMap.value=y.iridescenceThicknessMap,I(y.iridescenceThicknessMap,k.iridescenceThicknessMapTransform))),y.transmission>0&&(k.transmission.value=y.transmission,k.transmissionSamplerMap.value=d.texture,k.transmissionSamplerSize.value.set(d.width,d.height),y.transmissionMap&&(k.transmissionMap.value=y.transmissionMap,I(y.transmissionMap,k.transmissionMapTransform)),k.thickness.value=y.thickness,y.thicknessMap&&(k.thicknessMap.value=y.thicknessMap,I(y.thicknessMap,k.thicknessMapTransform)),k.attenuationDistance.value=y.attenuationDistance,k.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(k.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(k.anisotropyMap.value=y.anisotropyMap,I(y.anisotropyMap,k.anisotropyMapTransform))),k.specularIntensity.value=y.specularIntensity,k.specularColor.value.copy(y.specularColor),y.specularColorMap&&(k.specularColorMap.value=y.specularColorMap,I(y.specularColorMap,k.specularColorMapTransform)),y.specularIntensityMap&&(k.specularIntensityMap.value=y.specularIntensityMap,I(y.specularIntensityMap,k.specularIntensityMapTransform))}function G(k,y){y.matcap&&(k.matcap.value=y.matcap)}function U(k,y){const d=A.get(y).light;k.referencePosition.value.setFromMatrixPosition(d.matrixWorld),k.nearDistance.value=d.shadow.camera.near,k.farDistance.value=d.shadow.camera.far}return{refreshFogUniforms:g,refreshMaterialUniforms:C}}function $L(B,A,I,g){let C={},i={},e=[];const E=B.getParameter(B.MAX_UNIFORM_BUFFER_BINDINGS);function n(d,J){const F=J.program;g.uniformBlockBinding(d,F)}function a(d,J){let F=C[d.id];F===void 0&&(G(d),F=r(d),C[d.id]=F,d.addEventListener("dispose",k));const v=J.program;g.updateUBOMapping(d,v);const m=A.render.frame;i[d.id]!==m&&(h(d),i[d.id]=m)}function r(d){const J=D();d.__bindingPointIndex=J;const F=B.createBuffer(),v=d.__size,m=d.usage;return B.bindBuffer(B.UNIFORM_BUFFER,F),B.bufferData(B.UNIFORM_BUFFER,v,m),B.bindBuffer(B.UNIFORM_BUFFER,null),B.bindBufferBase(B.UNIFORM_BUFFER,J,F),F}function D(){for(let d=0;d0&&(F+=v-m),d.__size=F,d.__cache={},this}function U(d){const J={boundary:0,storage:0};return typeof d=="number"||typeof d=="boolean"?(J.boundary=4,J.storage=4):d.isVector2?(J.boundary=8,J.storage=8):d.isVector3||d.isColor?(J.boundary=16,J.storage=12):d.isVector4?(J.boundary=16,J.storage=16):d.isMatrix3?(J.boundary=48,J.storage=48):d.isMatrix4?(J.boundary=64,J.storage=64):d.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",d),J}function k(d){const J=d.target;J.removeEventListener("dispose",k);const F=e.indexOf(J.__bindingPointIndex);e.splice(F,1),B.deleteBuffer(C[J.id]),delete C[J.id],delete i[J.id]}function y(){for(const d in C)B.deleteBuffer(C[d]);e=[],C={},i={}}return{bind:n,update:a,dispose:y}}class BG{constructor(A={}){const{canvas:I=gp(),context:g=null,depth:C=!0,stencil:i=!1,alpha:e=!1,antialias:E=!1,premultipliedAlpha:n=!0,preserveDrawingBuffer:a=!1,powerPreference:r="default",failIfMajorPerformanceCaveat:D=!1,reverseDepthBuffer:h=!1}=A;this.isWebGLRenderer=!0;let S;if(g!==null){if(typeof WebGLRenderingContext<"u"&&g instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");S=g.getContextAttributes().alpha}else S=e;const G=new Uint32Array(4),U=new Int32Array(4);let k=null,y=null;const d=[],J=[];this.domElement=I,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=DB,this.toneMapping=se,this.toneMappingExposure=1;const F=this;let v=!1,m=0,x=0,T=null,L=-1,Y=null;const b=new Hg,IA=new Hg;let CA=null;const nA=new cI(0);let uA=0,EA=I.width,pA=I.height,V=1,aA=null,BA=null;const P=new Hg(0,0,EA,pA),oA=new Hg(0,0,EA,pA);let vA=!1;const cA=new El;let FA=!1,wA=!1;const LA=new VI,VA=new VI,WA=new Z,BI=new Hg,pI={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let TA=!1;function _A(){return T===null?V:1}let $=g;function SI(R,j){return I.getContext(R,j)}try{const R={alpha:!0,depth:C,stencil:i,antialias:E,premultipliedAlpha:n,preserveDrawingBuffer:a,powerPreference:r,failIfMajorPerformanceCaveat:D};if("setAttribute"in I&&I.setAttribute("data-engine",`three.js r${Ws}`),I.addEventListener("webglcontextlost",bA,!1),I.addEventListener("webglcontextrestored",hI,!1),I.addEventListener("webglcontextcreationerror",aI,!1),$===null){const j="webgl2";if($=SI(j,R),$===null)throw SI(j)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(R){throw console.error("THREE.WebGLRenderer: "+R.message),R}let jA,lI,CI,HI,nI,W,O,MA,HA,ZA,xA,UI,tI,DI,Ig,zA,uI,LI,JI,kI,$I,RI,ZI,sA;function KA(){jA=new iR($),jA.init(),RI=new rp($,jA),lI=new $f($,jA,A,RI),CI=new HL($,jA),lI.reverseDepthBuffer&&h&&CI.buffers.depth.setReversed(!0),HI=new ER($),nI=new UL,W=new _L($,jA,CI,nI,lI,RI,HI),O=new IR(F),MA=new BR(F),HA=new rK($),ZI=new Xf($,HA),ZA=new QR($,HA,HI,ZI),xA=new oR($,ZA,HA,HI),JI=new tR($,lI,W),zA=new AR(nI),UI=new ML(F,O,MA,jA,lI,ZI,zA),tI=new zL(F,nI),DI=new dL,Ig=new RL(jA),LI=new jf(F,O,MA,CI,xA,S,n),uI=new qL(F,xA,lI),sA=new $L($,HI,lI,CI),kI=new zf($,jA,HI),$I=new eR($,jA,HI),HI.programs=UI.programs,F.capabilities=lI,F.extensions=jA,F.properties=nI,F.renderLists=DI,F.shadowMap=uI,F.state=CI,F.info=HI}KA();const fA=new jL(F,$);this.xr=fA,this.getContext=function(){return $},this.getContextAttributes=function(){return $.getContextAttributes()},this.forceContextLoss=function(){const R=jA.get("WEBGL_lose_context");R&&R.loseContext()},this.forceContextRestore=function(){const R=jA.get("WEBGL_lose_context");R&&R.restoreContext()},this.getPixelRatio=function(){return V},this.setPixelRatio=function(R){R!==void 0&&(V=R,this.setSize(EA,pA,!1))},this.getSize=function(R){return R.set(EA,pA)},this.setSize=function(R,j,gA=!0){if(fA.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}EA=R,pA=j,I.width=Math.floor(R*V),I.height=Math.floor(j*V),gA===!0&&(I.style.width=R+"px",I.style.height=j+"px"),this.setViewport(0,0,R,j)},this.getDrawingBufferSize=function(R){return R.set(EA*V,pA*V).floor()},this.setDrawingBufferSize=function(R,j,gA){EA=R,pA=j,V=gA,I.width=Math.floor(R*gA),I.height=Math.floor(j*gA),this.setViewport(0,0,R,j)},this.getCurrentViewport=function(R){return R.copy(b)},this.getViewport=function(R){return R.copy(P)},this.setViewport=function(R,j,gA,iA){R.isVector4?P.set(R.x,R.y,R.z,R.w):P.set(R,j,gA,iA),CI.viewport(b.copy(P).multiplyScalar(V).round())},this.getScissor=function(R){return R.copy(oA)},this.setScissor=function(R,j,gA,iA){R.isVector4?oA.set(R.x,R.y,R.z,R.w):oA.set(R,j,gA,iA),CI.scissor(IA.copy(oA).multiplyScalar(V).round())},this.getScissorTest=function(){return vA},this.setScissorTest=function(R){CI.setScissorTest(vA=R)},this.setOpaqueSort=function(R){aA=R},this.setTransparentSort=function(R){BA=R},this.getClearColor=function(R){return R.copy(LI.getClearColor())},this.setClearColor=function(){LI.setClearColor.apply(LI,arguments)},this.getClearAlpha=function(){return LI.getClearAlpha()},this.setClearAlpha=function(){LI.setClearAlpha.apply(LI,arguments)},this.clear=function(R=!0,j=!0,gA=!0){let iA=0;if(R){let z=!1;if(T!==null){const kA=T.texture.format;z=kA===Uc||kA===Mc||kA===Bl}if(z){const kA=T.texture.type,yA=kA===di||kA===he||kA===ms||kA===vo||kA===kc||kA===uc,eI=LI.getClearColor(),OA=LI.getClearAlpha(),XA=eI.r,iI=eI.g,$A=eI.b;yA?(G[0]=XA,G[1]=iI,G[2]=$A,G[3]=OA,$.clearBufferuiv($.COLOR,0,G)):(U[0]=XA,U[1]=iI,U[2]=$A,U[3]=OA,$.clearBufferiv($.COLOR,0,U))}else iA|=$.COLOR_BUFFER_BIT}j&&(iA|=$.DEPTH_BUFFER_BIT),gA&&(iA|=$.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),$.clear(iA)},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(){I.removeEventListener("webglcontextlost",bA,!1),I.removeEventListener("webglcontextrestored",hI,!1),I.removeEventListener("webglcontextcreationerror",aI,!1),DI.dispose(),Ig.dispose(),nI.dispose(),O.dispose(),MA.dispose(),xA.dispose(),ZI.dispose(),sA.dispose(),UI.dispose(),fA.dispose(),fA.removeEventListener("sessionstart",PQ),fA.removeEventListener("sessionend",Zi),wB.stop()};function bA(R){R.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),v=!0}function hI(){console.log("THREE.WebGLRenderer: Context Restored."),v=!1;const R=HI.autoReset,j=uI.enabled,gA=uI.autoUpdate,iA=uI.needsUpdate,z=uI.type;KA(),HI.autoReset=R,uI.enabled=j,uI.autoUpdate=gA,uI.needsUpdate=iA,uI.type=z}function aI(R){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",R.statusMessage)}function PI(R){const j=R.target;j.removeEventListener("dispose",PI),Yg(j)}function Yg(R){nC(R),nI.remove(R)}function nC(R){const j=nI.get(R).programs;j!==void 0&&(j.forEach(function(gA){UI.releaseProgram(gA)}),R.isShaderMaterial&&UI.releaseShaderCache(R))}this.renderBufferDirect=function(R,j,gA,iA,z,kA){j===null&&(j=pI);const yA=z.isMesh&&z.matrixWorld.determinant()<0,eI=eA(R,j,gA,iA,z);CI.setMaterial(iA,yA);let OA=gA.index,XA=1;if(iA.wireframe===!0){if(OA=ZA.getWireframeAttribute(gA),OA===void 0)return;XA=2}const iI=gA.drawRange,$A=gA.attributes.position;let dI=iI.start*XA,FI=(iI.start+iI.count)*XA;kA!==null&&(dI=Math.max(dI,kA.start*XA),FI=Math.min(FI,(kA.start+kA.count)*XA)),OA!==null?(dI=Math.max(dI,0),FI=Math.min(FI,OA.count)):$A!=null&&(dI=Math.max(dI,0),FI=Math.min(FI,$A.count));const rI=FI-dI;if(rI<0||rI===1/0)return;ZI.setup(z,iA,eI,gA,OA);let OI,wI=kI;if(OA!==null&&(OI=HA.get(OA),wI=$I,wI.setIndex(OI)),z.isMesh)iA.wireframe===!0?(CI.setLineWidth(iA.wireframeLinewidth*_A()),wI.setMode($.LINES)):wI.setMode($.TRIANGLES);else if(z.isLine){let oI=iA.linewidth;oI===void 0&&(oI=1),CI.setLineWidth(oI*_A()),z.isLineSegments?wI.setMode($.LINES):z.isLineLoop?wI.setMode($.LINE_LOOP):wI.setMode($.LINE_STRIP)}else z.isPoints?wI.setMode($.POINTS):z.isSprite&&wI.setMode($.TRIANGLES);if(z.isBatchedMesh)if(z._multiDrawInstances!==null)wI.renderMultiDrawInstances(z._multiDrawStarts,z._multiDrawCounts,z._multiDrawCount,z._multiDrawInstances);else if(jA.get("WEBGL_multi_draw"))wI.renderMultiDraw(z._multiDrawStarts,z._multiDrawCounts,z._multiDrawCount);else{const oI=z._multiDrawStarts,jI=z._multiDrawCounts,bI=z._multiDrawCount,qg=OA?HA.get(OA).bytesPerElement:1,Tg=nI.get(iA).currentProgram.getUniforms();for(let Mg=0;Mg{function kA(){if(iA.forEach(function(yA){nI.get(yA).currentProgram.isReady()&&iA.delete(yA)}),iA.size===0){z(R);return}setTimeout(kA,10)}jA.get("KHR_parallel_shader_compile")!==null?kA():setTimeout(kA,10)})};let PC=null;function WC(R){PC&&PC(R)}function PQ(){wB.stop()}function Zi(){wB.start()}const wB=new tp;wB.setAnimationLoop(WC),typeof self<"u"&&wB.setContext(self),this.setAnimationLoop=function(R){PC=R,fA.setAnimationLoop(R),R===null?wB.stop():wB.start()},fA.addEventListener("sessionstart",PQ),fA.addEventListener("sessionend",Zi),this.render=function(R,j){if(j!==void 0&&j.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;if(R.matrixWorldAutoUpdate===!0&&R.updateMatrixWorld(),j.parent===null&&j.matrixWorldAutoUpdate===!0&&j.updateMatrixWorld(),fA.enabled===!0&&fA.isPresenting===!0&&(fA.cameraAutoUpdate===!0&&fA.updateCamera(j),j=fA.getCamera()),R.isScene===!0&&R.onBeforeRender(F,R,j,T),y=Ig.get(R,J.length),y.init(j),J.push(y),VA.multiplyMatrices(j.projectionMatrix,j.matrixWorldInverse),cA.setFromProjectionMatrix(VA),wA=this.localClippingEnabled,FA=zA.init(this.clippingPlanes,wA),k=DI.get(R,d.length),k.init(),d.push(k),fA.enabled===!0&&fA.isPresenting===!0){const kA=F.xr.getDepthSensingMesh();kA!==null&&WB(kA,j,-1/0,F.sortObjects)}WB(R,j,0,F.sortObjects),k.finish(),F.sortObjects===!0&&k.sort(aA,BA),TA=fA.enabled===!1||fA.isPresenting===!1||fA.hasDepthSensing()===!1,TA&&LI.addToRenderList(k,R),this.info.render.frame++,FA===!0&&zA.beginShadows();const gA=y.state.shadowsArray;uI.render(gA,R,j),FA===!0&&zA.endShadows(),this.info.autoReset===!0&&this.info.reset();const iA=k.opaque,z=k.transmissive;if(y.setupLights(),j.isArrayCamera){const kA=j.cameras;if(z.length>0)for(let yA=0,eI=kA.length;yA0&&VC(iA,z,R,j),TA&&LI.render(R),VB(k,R,j);T!==null&&(W.updateMultisampleRenderTarget(T),W.updateRenderTargetMipmap(T)),R.isScene===!0&&R.onAfterRender(F,R,j),ZI.resetDefaultState(),L=-1,Y=null,J.pop(),J.length>0?(y=J[J.length-1],FA===!0&&zA.setGlobalState(F.clippingPlanes,y.state.camera)):y=null,d.pop(),d.length>0?k=d[d.length-1]:k=null};function WB(R,j,gA,iA){if(R.visible===!1)return;if(R.layers.test(j.layers)){if(R.isGroup)gA=R.renderOrder;else if(R.isLOD)R.autoUpdate===!0&&R.update(j);else if(R.isLight)y.pushLight(R),R.castShadow&&y.pushShadow(R);else if(R.isSprite){if(!R.frustumCulled||cA.intersectsSprite(R)){iA&&BI.setFromMatrixPosition(R.matrixWorld).applyMatrix4(VA);const yA=xA.update(R),eI=R.material;eI.visible&&k.push(R,yA,eI,gA,BI.z,null)}}else if((R.isMesh||R.isLine||R.isPoints)&&(!R.frustumCulled||cA.intersectsObject(R))){const yA=xA.update(R),eI=R.material;if(iA&&(R.boundingSphere!==void 0?(R.boundingSphere===null&&R.computeBoundingSphere(),BI.copy(R.boundingSphere.center)):(yA.boundingSphere===null&&yA.computeBoundingSphere(),BI.copy(yA.boundingSphere.center)),BI.applyMatrix4(R.matrixWorld).applyMatrix4(VA)),Array.isArray(eI)){const OA=yA.groups;for(let XA=0,iI=OA.length;XA0&&ig(z,j,gA),kA.length>0&&ig(kA,j,gA),yA.length>0&&ig(yA,j,gA),CI.buffers.depth.setTest(!0),CI.buffers.depth.setMask(!0),CI.buffers.color.setMask(!0),CI.setPolygonOffset(!1)}function VC(R,j,gA,iA){if((gA.isScene===!0?gA.overrideMaterial:null)!==null)return;y.state.transmissionRenderTarget[iA.id]===void 0&&(y.state.transmissionRenderTarget[iA.id]=new bi(1,1,{generateMipmaps:!0,type:jA.has("EXT_color_buffer_half_float")||jA.has("EXT_color_buffer_float")?hB:di,minFilter:tQ,samples:4,stencilBuffer:i,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Kg.workingColorSpace}));const kA=y.state.transmissionRenderTarget[iA.id],yA=iA.viewport||b;kA.setSize(yA.z,yA.w);const eI=F.getRenderTarget();F.setRenderTarget(kA),F.getClearColor(nA),uA=F.getClearAlpha(),uA<1&&F.setClearColor(16777215,.5),F.clear(),TA&&LI.render(gA);const OA=F.toneMapping;F.toneMapping=se;const XA=iA.viewport;if(iA.viewport!==void 0&&(iA.viewport=void 0),y.setupLightsView(iA),FA===!0&&zA.setGlobalState(F.clippingPlanes,iA),ig(R,gA,iA),W.updateMultisampleRenderTarget(kA),W.updateRenderTargetMipmap(kA),jA.has("WEBGL_multisampled_render_to_texture")===!1){let iI=!1;for(let $A=0,dI=j.length;$A0),$A=!!gA.morphAttributes.position,dI=!!gA.morphAttributes.normal,FI=!!gA.morphAttributes.color;let rI=se;iA.toneMapped&&(T===null||T.isXRRenderTarget===!0)&&(rI=F.toneMapping);const OI=gA.morphAttributes.position||gA.morphAttributes.normal||gA.morphAttributes.color,wI=OI!==void 0?OI.length:0,oI=nI.get(iA),jI=y.state.lights;if(FA===!0&&(wA===!0||R!==Y)){const Gg=R===Y&&iA.id===L;zA.setState(iA,R,Gg)}let bI=!1;iA.version===oI.__version?(oI.needsLights&&oI.lightsStateVersion!==jI.state.version||oI.outputColorSpace!==eI||z.isBatchedMesh&&oI.batching===!1||!z.isBatchedMesh&&oI.batching===!0||z.isBatchedMesh&&oI.batchingColor===!0&&z.colorTexture===null||z.isBatchedMesh&&oI.batchingColor===!1&&z.colorTexture!==null||z.isInstancedMesh&&oI.instancing===!1||!z.isInstancedMesh&&oI.instancing===!0||z.isSkinnedMesh&&oI.skinning===!1||!z.isSkinnedMesh&&oI.skinning===!0||z.isInstancedMesh&&oI.instancingColor===!0&&z.instanceColor===null||z.isInstancedMesh&&oI.instancingColor===!1&&z.instanceColor!==null||z.isInstancedMesh&&oI.instancingMorph===!0&&z.morphTexture===null||z.isInstancedMesh&&oI.instancingMorph===!1&&z.morphTexture!==null||oI.envMap!==OA||iA.fog===!0&&oI.fog!==kA||oI.numClippingPlanes!==void 0&&(oI.numClippingPlanes!==zA.numPlanes||oI.numIntersection!==zA.numIntersection)||oI.vertexAlphas!==XA||oI.vertexTangents!==iI||oI.morphTargets!==$A||oI.morphNormals!==dI||oI.morphColors!==FI||oI.toneMapping!==rI||oI.morphTargetsCount!==wI)&&(bI=!0):(bI=!0,oI.__version=iA.version);let qg=oI.currentProgram;bI===!0&&(qg=WQ(iA,j,z));let Tg=!1,Mg=!1,cg=!1;const Cg=qg.getUniforms(),ag=oI.uniforms;if(CI.useProgram(qg.program)&&(Tg=!0,Mg=!0,cg=!0),iA.id!==L&&(L=iA.id,Mg=!0),Tg||Y!==R){CI.buffers.depth.getReversed()?(LA.copy(R.projectionMatrix),TJ(LA),xJ(LA),Cg.setValue($,"projectionMatrix",LA)):Cg.setValue($,"projectionMatrix",R.projectionMatrix),Cg.setValue($,"viewMatrix",R.matrixWorldInverse);const GC=Cg.map.cameraPosition;GC!==void 0&&GC.setValue($,WA.setFromMatrixPosition(R.matrixWorld)),lI.logarithmicDepthBuffer&&Cg.setValue($,"logDepthBufFC",2/(Math.log(R.far+1)/Math.LN2)),(iA.isMeshPhongMaterial||iA.isMeshToonMaterial||iA.isMeshLambertMaterial||iA.isMeshBasicMaterial||iA.isMeshStandardMaterial||iA.isShaderMaterial)&&Cg.setValue($,"isOrthographic",R.isOrthographicCamera===!0),Y!==R&&(Y=R,Mg=!0,cg=!0)}if(z.isSkinnedMesh){Cg.setOptional($,z,"bindMatrix"),Cg.setOptional($,z,"bindMatrixInverse");const Gg=z.skeleton;Gg&&(Gg.boneTexture===null&&Gg.computeBoneTexture(),Cg.setValue($,"boneTexture",Gg.boneTexture,W))}z.isBatchedMesh&&(Cg.setOptional($,z,"batchingTexture"),Cg.setValue($,"batchingTexture",z._matricesTexture,W),Cg.setOptional($,z,"batchingIdTexture"),Cg.setValue($,"batchingIdTexture",z._indirectTexture,W),Cg.setOptional($,z,"batchingColorTexture"),z._colorsTexture!==null&&Cg.setValue($,"batchingColorTexture",z._colorsTexture,W));const rg=gA.morphAttributes;if((rg.position!==void 0||rg.normal!==void 0||rg.color!==void 0)&&JI.update(z,gA,qg),(Mg||oI.receiveShadow!==z.receiveShadow)&&(oI.receiveShadow=z.receiveShadow,Cg.setValue($,"receiveShadow",z.receiveShadow)),iA.isMeshGouraudMaterial&&iA.envMap!==null&&(ag.envMap.value=OA,ag.flipEnvMap.value=OA.isCubeTexture&&OA.isRenderTargetTexture===!1?-1:1),iA.isMeshStandardMaterial&&iA.envMap===null&&j.environment!==null&&(ag.envMapIntensity.value=j.environmentIntensity),Mg&&(Cg.setValue($,"toneMappingExposure",F.toneMappingExposure),oI.needsLights&&JA(ag,cg),kA&&iA.fog===!0&&tI.refreshFogUniforms(ag,kA),tI.refreshMaterialUniforms(ag,iA,V,pA,y.state.transmissionRenderTarget[R.id]),Dh.upload($,q(oI),ag,W)),iA.isShaderMaterial&&iA.uniformsNeedUpdate===!0&&(Dh.upload($,q(oI),ag,W),iA.uniformsNeedUpdate=!1),iA.isSpriteMaterial&&Cg.setValue($,"center",z.center),Cg.setValue($,"modelViewMatrix",z.modelViewMatrix),Cg.setValue($,"normalMatrix",z.normalMatrix),Cg.setValue($,"modelMatrix",z.matrixWorld),iA.isShaderMaterial||iA.isRawShaderMaterial){const Gg=iA.uniformsGroups;for(let GC=0,bg=Gg.length;GC0&&W.useMultisampledRTT(R)===!1?z=nI.get(R).__webglMultisampledFramebuffer:Array.isArray(iI)?z=iI[gA]:z=iI,b.copy(R.viewport),IA.copy(R.scissor),CA=R.scissorTest}else b.copy(P).multiplyScalar(V).floor(),IA.copy(oA).multiplyScalar(V).floor(),CA=vA;if(CI.bindFramebuffer($.FRAMEBUFFER,z)&&iA&&CI.drawBuffers(R,z),CI.viewport(b),CI.scissor(IA),CI.setScissorTest(CA),kA){const OA=nI.get(R.texture);$.framebufferTexture2D($.FRAMEBUFFER,$.COLOR_ATTACHMENT0,$.TEXTURE_CUBE_MAP_POSITIVE_X+j,OA.__webglTexture,gA)}else if(yA){const OA=nI.get(R.texture),XA=j||0;$.framebufferTextureLayer($.FRAMEBUFFER,$.COLOR_ATTACHMENT0,OA.__webglTexture,gA||0,XA)}L=-1},this.readRenderTargetPixels=function(R,j,gA,iA,z,kA,yA){if(!(R&&R.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let eI=nI.get(R).__webglFramebuffer;if(R.isWebGLCubeRenderTarget&&yA!==void 0&&(eI=eI[yA]),eI){CI.bindFramebuffer($.FRAMEBUFFER,eI);try{const OA=R.texture,XA=OA.format,iI=OA.type;if(!lI.textureFormatReadable(XA)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!lI.textureTypeReadable(iI)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}j>=0&&j<=R.width-iA&&gA>=0&&gA<=R.height-z&&$.readPixels(j,gA,iA,z,RI.convert(XA),RI.convert(iI),kA)}finally{const OA=T!==null?nI.get(T).__webglFramebuffer:null;CI.bindFramebuffer($.FRAMEBUFFER,OA)}}},this.readRenderTargetPixelsAsync=async function(R,j,gA,iA,z,kA,yA){if(!(R&&R.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let eI=nI.get(R).__webglFramebuffer;if(R.isWebGLCubeRenderTarget&&yA!==void 0&&(eI=eI[yA]),eI){const OA=R.texture,XA=OA.format,iI=OA.type;if(!lI.textureFormatReadable(XA))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!lI.textureTypeReadable(iI))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(j>=0&&j<=R.width-iA&&gA>=0&&gA<=R.height-z){CI.bindFramebuffer($.FRAMEBUFFER,eI);const $A=$.createBuffer();$.bindBuffer($.PIXEL_PACK_BUFFER,$A),$.bufferData($.PIXEL_PACK_BUFFER,kA.byteLength,$.STREAM_READ),$.readPixels(j,gA,iA,z,RI.convert(XA),RI.convert(iI),0);const dI=T!==null?nI.get(T).__webglFramebuffer:null;CI.bindFramebuffer($.FRAMEBUFFER,dI);const FI=$.fenceSync($.SYNC_GPU_COMMANDS_COMPLETE,0);return $.flush(),await HJ($,FI,4),$.bindBuffer($.PIXEL_PACK_BUFFER,$A),$.getBufferSubData($.PIXEL_PACK_BUFFER,0,kA),$.deleteBuffer($A),$.deleteSync(FI),kA}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(R,j=null,gA=0){R.isTexture!==!0&&(lr("WebGLRenderer: copyFramebufferToTexture function signature has changed."),j=arguments[0]||null,R=arguments[1]);const iA=Math.pow(2,-gA),z=Math.floor(R.image.width*iA),kA=Math.floor(R.image.height*iA),yA=j!==null?j.x:0,eI=j!==null?j.y:0;W.setTexture2D(R,0),$.copyTexSubImage2D($.TEXTURE_2D,gA,0,0,yA,eI,z,kA),CI.unbindTexture()},this.copyTextureToTexture=function(R,j,gA=null,iA=null,z=0){R.isTexture!==!0&&(lr("WebGLRenderer: copyTextureToTexture function signature has changed."),iA=arguments[0]||null,R=arguments[1],j=arguments[2],z=arguments[3]||0,gA=null);let kA,yA,eI,OA,XA,iI,$A,dI,FI;const rI=R.isCompressedTexture?R.mipmaps[z]:R.image;gA!==null?(kA=gA.max.x-gA.min.x,yA=gA.max.y-gA.min.y,eI=gA.isBox3?gA.max.z-gA.min.z:1,OA=gA.min.x,XA=gA.min.y,iI=gA.isBox3?gA.min.z:0):(kA=rI.width,yA=rI.height,eI=rI.depth||1,OA=0,XA=0,iI=0),iA!==null?($A=iA.x,dI=iA.y,FI=iA.z):($A=0,dI=0,FI=0);const OI=RI.convert(j.format),wI=RI.convert(j.type);let oI;j.isData3DTexture?(W.setTexture3D(j,0),oI=$.TEXTURE_3D):j.isDataArrayTexture||j.isCompressedArrayTexture?(W.setTexture2DArray(j,0),oI=$.TEXTURE_2D_ARRAY):(W.setTexture2D(j,0),oI=$.TEXTURE_2D),$.pixelStorei($.UNPACK_FLIP_Y_WEBGL,j.flipY),$.pixelStorei($.UNPACK_PREMULTIPLY_ALPHA_WEBGL,j.premultiplyAlpha),$.pixelStorei($.UNPACK_ALIGNMENT,j.unpackAlignment);const jI=$.getParameter($.UNPACK_ROW_LENGTH),bI=$.getParameter($.UNPACK_IMAGE_HEIGHT),qg=$.getParameter($.UNPACK_SKIP_PIXELS),Tg=$.getParameter($.UNPACK_SKIP_ROWS),Mg=$.getParameter($.UNPACK_SKIP_IMAGES);$.pixelStorei($.UNPACK_ROW_LENGTH,rI.width),$.pixelStorei($.UNPACK_IMAGE_HEIGHT,rI.height),$.pixelStorei($.UNPACK_SKIP_PIXELS,OA),$.pixelStorei($.UNPACK_SKIP_ROWS,XA),$.pixelStorei($.UNPACK_SKIP_IMAGES,iI);const cg=R.isDataArrayTexture||R.isData3DTexture,Cg=j.isDataArrayTexture||j.isData3DTexture;if(R.isRenderTargetTexture||R.isDepthTexture){const ag=nI.get(R),rg=nI.get(j),Gg=nI.get(ag.__renderTarget),GC=nI.get(rg.__renderTarget);CI.bindFramebuffer($.READ_FRAMEBUFFER,Gg.__webglFramebuffer),CI.bindFramebuffer($.DRAW_FRAMEBUFFER,GC.__webglFramebuffer);for(let bg=0;bg0&&(I.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(I.object.backgroundIntensity=this.backgroundIntensity),I.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(I.object.environmentIntensity=this.environmentIntensity),I.object.environmentRotation=this.environmentRotation.toArray(),I}}class ol{constructor(A,I){this.isInterleavedBuffer=!0,this.array=A,this.stride=I,this.count=A!==void 0?A.length/I:0,this.usage=Yr,this.updateRanges=[],this.version=0,this.uuid=Oi()}onUploadCallback(){}set needsUpdate(A){A===!0&&this.version++}setUsage(A){return this.usage=A,this}addUpdateRange(A,I){this.updateRanges.push({start:A,count:I})}clearUpdateRanges(){this.updateRanges.length=0}copy(A){return this.array=new A.array.constructor(A.array),this.count=A.count,this.stride=A.stride,this.usage=A.usage,this}copyAt(A,I,g){A*=this.stride,g*=I.stride;for(let C=0,i=this.stride;CA.far||I.push({distance:n,point:gr.clone(),uv:Ui.getInterpolation(gr,LD,Br,YD,o0,Jw,n0,new PA),face:null,object:this})}copy(A,I){return super.copy(A,I),A.center!==void 0&&this.center.copy(A.center),this.material=A.material,this}}function qD(B,A,I,g,C,i){ys.subVectors(B,I).addScalar(.5).multiply(g),C!==void 0?(Cr.x=i*ys.x-C*ys.y,Cr.y=C*ys.x+i*ys.y):Cr.copy(ys),B.copy(A),B.x+=Cr.x,B.y+=Cr.y,B.applyMatrix4(Dp)}const mD=new Z,s0=new Z;class cp extends Ng{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(A){super.copy(A,!1);const I=A.levels;for(let g=0,C=I.length;g0){let g,C;for(g=1,C=I.length;g0){mD.setFromMatrixPosition(this.matrixWorld);const C=A.ray.origin.distanceTo(mD);this.getObjectForDistance(C).raycast(A,I)}}update(A){const I=this.levels;if(I.length>1){mD.setFromMatrixPosition(A.matrixWorld),s0.setFromMatrixPosition(this.matrixWorld);const g=mD.distanceTo(s0)/A.zoom;I[0].object.visible=!0;let C,i;for(C=1,i=I.length;C=e)I[C-1].object.visible=!1,I[C].object.visible=!0;else break}for(this._currentLevel=C-1;C=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});const E=i[this.index];e.push(E),this.index++,E.start=A,E.count=I,E.z=g,E.index=C}reset(){this.list.length=0,this.index=0}}const ui=new VI,QY=new cI(1,1,1),Rw=new El,xD=new _B,ro=new FB,er=new Z,y0=new Z,eY=new Z,Lw=new iY,bB=new DC,vD=[];function EY(B,A,I=0){const g=A.itemSize;if(B.isInterleavedBufferAttribute||B.array.constructor!==A.array.constructor){const C=B.count;for(let i=0;i65535?new Uint32Array(C):new Uint16Array(C);I.setIndex(new Eg(i,1))}this._geometryInitialized=!0}}_validateGeometry(A){const I=this.geometry;if(!!A.getIndex()!=!!I.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const g in I.attributes){if(!A.hasAttribute(g))throw new Error(`BatchedMesh: Added geometry missing "${g}". All geometries must have consistent attributes.`);const C=A.getAttribute(g),i=I.getAttribute(g);if(C.itemSize!==i.itemSize||C.normalized!==i.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(A){return this.customSort=A,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new _B);const A=this.boundingBox,I=this._instanceInfo;A.makeEmpty();for(let g=0,C=I.length;g=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("BatchedMesh: Maximum item count reached.");const g={visible:!0,active:!0,geometryIndex:A};let C=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(fw),C=this._availableInstanceIds.shift(),this._instanceInfo[C]=g):(C=this._instanceInfo.length,this._instanceInfo.push(g));const i=this._matricesTexture;ui.identity().toArray(i.image.data,C*16),i.needsUpdate=!0;const e=this._colorsTexture;return e&&(QY.toArray(e.image.data,C*4),e.needsUpdate=!0),this._visibilityChanged=!0,C}addGeometry(A,I=-1,g=-1){this._initializeGeometry(A),this._validateGeometry(A);const C={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},i=this._geometryInfo;C.vertexStart=this._nextVertexStart,C.reservedVertexCount=I===-1?A.getAttribute("position").count:I;const e=A.getIndex();if(e!==null&&(C.indexStart=this._nextIndexStart,C.reservedIndexCount=g===-1?e.count:g),C.indexStart!==-1&&C.indexStart+C.reservedIndexCount>this._maxIndexCount||C.vertexStart+C.reservedVertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");let n;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(fw),n=this._availableGeometryIds.shift(),i[n]=C):(n=this._geometryCount,this._geometryCount++,i.push(C)),this.setGeometryAt(n,A),this._nextIndexStart=C.indexStart+C.reservedIndexCount,this._nextVertexStart=C.vertexStart+C.reservedVertexCount,n}setGeometryAt(A,I){if(A>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(I);const g=this.geometry,C=g.getIndex()!==null,i=g.getIndex(),e=I.getIndex(),E=this._geometryInfo[A];if(C&&e.count>E.reservedIndexCount||I.attributes.position.count>E.reservedVertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const n=E.vertexStart,a=E.reservedVertexCount;E.vertexCount=I.getAttribute("position").count;for(const r in g.attributes){const D=I.getAttribute(r),h=g.getAttribute(r);EY(D,h,n);const S=D.itemSize;for(let G=D.count,U=a;G=I.length||I[A].active===!1)return this;const g=this._instanceInfo;for(let C=0,i=g.length;C=I.length||I[A].active===!1?this:(I[A].active=!1,this._availableInstanceIds.push(A),this._visibilityChanged=!0,this)}optimize(){let A=0,I=0;const g=this._geometryInfo,C=g.map((e,E)=>E).sort((e,E)=>g[e].vertexStart-g[E].vertexStart),i=this.geometry;for(let e=0,E=g.length;e=this._geometryCount)return null;const g=this.geometry,C=this._geometryInfo[A];if(C.boundingBox===null){const i=new _B,e=g.index,E=g.attributes.position;for(let n=C.start,a=C.start+C.count;n=this._geometryCount)return null;const g=this.geometry,C=this._geometryInfo[A];if(C.boundingSphere===null){const i=new FB;this.getBoundingBoxAt(A,xD),xD.getCenter(i.center);const e=g.index,E=g.attributes.position;let n=0;for(let a=C.start,r=C.start+C.count;a=g.length||g[A].active===!1?this:(I.toArray(i,A*16),C.needsUpdate=!0,this)}getMatrixAt(A,I){const g=this._instanceInfo,C=this._matricesTexture.image.data;return A>=g.length||g[A].active===!1?null:I.fromArray(C,A*16)}setColorAt(A,I){this._colorsTexture===null&&this._initColorsTexture();const g=this._colorsTexture,C=this._colorsTexture.image.data,i=this._instanceInfo;return A>=i.length||i[A].active===!1?this:(I.toArray(C,A*4),g.needsUpdate=!0,this)}getColorAt(A,I){const g=this._colorsTexture.image.data,C=this._instanceInfo;return A>=C.length||C[A].active===!1?null:I.fromArray(g,A*4)}setVisibleAt(A,I){const g=this._instanceInfo;return A>=g.length||g[A].active===!1||g[A].visible===I?this:(g[A].visible=I,this._visibilityChanged=!0,this)}getVisibleAt(A){const I=this._instanceInfo;return A>=I.length||I[A].active===!1?!1:I[A].visible}setGeometryIdAt(A,I){const g=this._instanceInfo,C=this._geometryInfo;return A>=g.length||g[A].active===!1||I>=C.length||C[I].active===!1?null:(g[A].geometryIndex=I,this)}getGeometryIdAt(A){const I=this._instanceInfo;return A>=I.length||I[A].active===!1?-1:I[A].geometryIndex}getGeometryRangeAt(A,I={}){if(A<0||A>=this._geometryCount)return null;const g=this._geometryInfo[A];return I.vertexStart=g.vertexStart,I.vertexCount=g.vertexCount,I.reservedVertexCount=g.reservedVertexCount,I.indexStart=g.indexStart,I.indexCount=g.indexCount,I.reservedIndexCount=g.reservedIndexCount,I.start=g.start,I.count=g.count,I}setInstanceCount(A){const I=this._availableInstanceIds,g=this._instanceInfo;for(I.sort(fw);I[I.length-1]===g.length;)g.pop(),I.pop();if(AE.active);if(Math.max(...g.map(E=>E.vertexStart+E.reservedVertexCount))>A)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${I}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...g.map(n=>n.indexStart+n.reservedIndexCount))>I)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${I}. Cannot shrink further.`);const i=this.geometry;i.dispose(),this._maxVertexCount=A,this._maxIndexCount=I,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new tg,this._initializeGeometry(i));const e=this.geometry;i.index&&lo(i.index.array,e.index.array);for(const E in i.attributes)lo(i.attributes[E].array,e.attributes[E].array)}raycast(A,I){const g=this._instanceInfo,C=this._geometryInfo,i=this.matrixWorld,e=this.geometry;bB.material=this.material,bB.geometry.index=e.index,bB.geometry.attributes=e.attributes,bB.geometry.boundingBox===null&&(bB.geometry.boundingBox=new _B),bB.geometry.boundingSphere===null&&(bB.geometry.boundingSphere=new FB);for(let E=0,n=g.length;E({...I,boundingBox:I.boundingBox!==null?I.boundingBox.clone():null,boundingSphere:I.boundingSphere!==null?I.boundingSphere.clone():null})),this._instanceInfo=A._instanceInfo.map(I=>({...I})),this._maxInstanceCount=A._maxInstanceCount,this._maxVertexCount=A._maxVertexCount,this._maxIndexCount=A._maxIndexCount,this._geometryInitialized=A._geometryInitialized,this._geometryCount=A._geometryCount,this._multiDrawCounts=A._multiDrawCounts.slice(),this._multiDrawStarts=A._multiDrawStarts.slice(),this._matricesTexture=A._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=A._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(A,I,g,C,i){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const e=C.getIndex(),E=e===null?1:e.array.BYTES_PER_ELEMENT,n=this._instanceInfo,a=this._multiDrawStarts,r=this._multiDrawCounts,D=this._geometryInfo,h=this.perObjectFrustumCulled,S=this._indirectTexture,G=S.image.data;h&&(ui.multiplyMatrices(g.projectionMatrix,g.matrixWorldInverse).multiply(this.matrixWorld),Rw.setFromProjectionMatrix(ui,A.coordinateSystem));let U=0;if(this.sortObjects){ui.copy(this.matrixWorld).invert(),er.setFromMatrixPosition(g.matrixWorld).applyMatrix4(ui),y0.set(0,0,-1).transformDirection(g.matrixWorld).transformDirection(ui);for(let d=0,J=n.length;d0){const C=I[g[0]];if(C!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,e=C.length;ig)return;Yw.applyMatrix4(B.matrixWorld);const n=A.ray.origin.distanceTo(Yw);if(!(nA.far))return{distance:n,point:k0.clone().applyMatrix4(B.matrixWorld),index:C,face:null,faceIndex:null,barycoord:null,object:B}}const u0=new Z,M0=new Z;class bQ extends rE{constructor(A,I){super(A,I),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const A=this.geometry;if(A.index===null){const I=A.attributes.position,g=[];for(let C=0,i=I.count;C0){const C=I[g[0]];if(C!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,e=C.length;iC.far)return;i.push({distance:a,distanceToRay:Math.sqrt(E),point:n,index:A,face:null,faceIndex:null,barycoord:null,object:e})}}class tY extends Vg{constructor(A,I,g,C,i,e,E,n,a){super(A,I,g,C,i,e,E,n,a),this.isVideoTexture=!0,this.minFilter=e!==void 0?e:Og,this.magFilter=i!==void 0?i:Og,this.generateMipmaps=!1;const r=this;function D(){r.needsUpdate=!0,A.requestVideoFrameCallback(D)}"requestVideoFrameCallback"in A&&A.requestVideoFrameCallback(D)}clone(){return new this.constructor(this.image).copy(this)}update(){const A=this.image;"requestVideoFrameCallback"in A===!1&&A.readyState>=A.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class oY extends Vg{constructor(A,I){super({width:A,height:I}),this.isFramebufferTexture=!0,this.magFilter=cB,this.minFilter=cB,this.generateMipmaps=!1,this.needsUpdate=!0}}class Lc extends Vg{constructor(A,I,g,C,i,e,E,n,a,r,D,h){super(null,e,E,n,a,r,C,i,D,h),this.isCompressedTexture=!0,this.image={width:I,height:g},this.mipmaps=A,this.flipY=!1,this.generateMipmaps=!1}}class nY extends Lc{constructor(A,I,g,C,i,e){super(A,I,g,i,e),this.isCompressedArrayTexture=!0,this.image.depth=C,this.wrapR=LC,this.layerUpdates=new Set}addLayerUpdate(A){this.layerUpdates.add(A)}clearLayerUpdates(){this.layerUpdates.clear()}}class sY extends Lc{constructor(A,I,g){super(void 0,A[0].width,A[0].height,I,g,le),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=A}}class Yc extends Vg{constructor(A,I,g,C,i,e,E,n,a){super(A,I,g,C,i,e,E,n,a),this.isCanvasTexture=!0,this.needsUpdate=!0}}class _Q{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(A,I){const g=this.getUtoTmapping(A);return this.getPoint(g,I)}getPoints(A=5){const I=[];for(let g=0;g<=A;g++)I.push(this.getPoint(g/A));return I}getSpacedPoints(A=5){const I=[];for(let g=0;g<=A;g++)I.push(this.getPointAt(g/A));return I}getLength(){const A=this.getLengths();return A[A.length-1]}getLengths(A=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===A+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const I=[];let g,C=this.getPoint(0),i=0;I.push(0);for(let e=1;e<=A;e++)g=this.getPoint(e/A),i+=g.distanceTo(C),I.push(i),C=g;return this.cacheArcLengths=I,I}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(A,I){const g=this.getLengths();let C=0;const i=g.length;let e;I?e=I:e=A*g[i-1];let E=0,n=i-1,a;for(;E<=n;)if(C=Math.floor(E+(n-E)/2),a=g[C]-e,a<0)E=C+1;else if(a>0)n=C-1;else{n=C;break}if(C=n,g[C]===e)return C/(i-1);const r=g[C],h=g[C+1]-r,S=(e-r)/h;return(C+S)/(i-1)}getTangent(A,I){let C=A-1e-4,i=A+1e-4;C<0&&(C=0),i>1&&(i=1);const e=this.getPoint(C),E=this.getPoint(i),n=I||(e.isVector2?new PA:new Z);return n.copy(E).sub(e).normalize(),n}getTangentAt(A,I){const g=this.getUtoTmapping(A);return this.getTangent(g,I)}computeFrenetFrames(A,I){const g=new Z,C=[],i=[],e=[],E=new Z,n=new VI;for(let S=0;S<=A;S++){const G=S/A;C[S]=this.getTangentAt(G,new Z)}i[0]=new Z,e[0]=new Z;let a=Number.MAX_VALUE;const r=Math.abs(C[0].x),D=Math.abs(C[0].y),h=Math.abs(C[0].z);r<=a&&(a=r,g.set(1,0,0)),D<=a&&(a=D,g.set(0,1,0)),h<=a&&g.set(0,0,1),E.crossVectors(C[0],g).normalize(),i[0].crossVectors(C[0],E),e[0].crossVectors(C[0],i[0]);for(let S=1;S<=A;S++){if(i[S]=i[S-1].clone(),e[S]=e[S-1].clone(),E.crossVectors(C[S-1],C[S]),E.length()>Number.EPSILON){E.normalize();const G=Math.acos(NC(C[S-1].dot(C[S]),-1,1));i[S].applyMatrix4(n.makeRotationAxis(E,G))}e[S].crossVectors(C[S],i[S])}if(I===!0){let S=Math.acos(NC(i[0].dot(i[A]),-1,1));S/=A,C[0].dot(E.crossVectors(i[0],i[A]))>0&&(S=-S);for(let G=1;G<=A;G++)i[G].applyMatrix4(n.makeRotationAxis(C[G],S*G)),e[G].crossVectors(C[G],i[G])}return{tangents:C,normals:i,binormals:e}}clone(){return new this.constructor().copy(this)}copy(A){return this.arcLengthDivisions=A.arcLengthDivisions,this}toJSON(){const A={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return A.arcLengthDivisions=this.arcLengthDivisions,A.type=this.type,A}fromJSON(A){return this.arcLengthDivisions=A.arcLengthDivisions,this}}class qc extends _Q{constructor(A=0,I=0,g=1,C=1,i=0,e=Math.PI*2,E=!1,n=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=A,this.aY=I,this.xRadius=g,this.yRadius=C,this.aStartAngle=i,this.aEndAngle=e,this.aClockwise=E,this.aRotation=n}getPoint(A,I=new PA){const g=I,C=Math.PI*2;let i=this.aEndAngle-this.aStartAngle;const e=Math.abs(i)C;)i-=C;i0?0:(Math.floor(Math.abs(E)/i)+1)*i:n===0&&E===i-1&&(E=i-2,n=1);let a,r;this.closed||E>0?a=C[(E-1)%i]:(PD.subVectors(C[0],C[1]).add(C[0]),a=PD);const D=C[E%i],h=C[(E+1)%i];if(this.closed||E+2C.length-2?C.length-1:e+1],D=C[e>C.length-3?C.length-1:e+2];return g.set(d0(E,n.x,a.x,r.x,D.x),d0(E,n.y,a.y,r.y,D.y)),g}copy(A){super.copy(A),this.points=[];for(let I=0,g=A.points.length;I=g){const e=C[i]-g,E=this.curves[i],n=E.getLength(),a=n===0?0:1-e/n;return E.getPointAt(a,I)}i++}return null}getLength(){const A=this.getCurveLengths();return A[A.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const A=[];let I=0;for(let g=0,C=this.curves.length;g1&&!I[I.length-1].equals(I[0])&&I.push(I[0]),I}copy(A){super.copy(A),this.curves=[];for(let I=0,g=A.curves.length;I0){const D=a.getPoint(0);D.equals(this.currentPoint)||this.lineTo(D.x,D.y)}this.curves.push(a);const r=a.getPoint(1);return this.currentPoint.copy(r),this}copy(A){return super.copy(A),this.currentPoint.copy(A.currentPoint),this}toJSON(){const A=super.toJSON();return A.currentPoint=this.currentPoint.toArray(),A}fromJSON(A){return super.fromJSON(A),this.currentPoint.fromArray(A.currentPoint),this}}class sl extends tg{constructor(A=[new PA(0,-.5),new PA(.5,0),new PA(0,.5)],I=12,g=0,C=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:A,segments:I,phiStart:g,phiLength:C},I=Math.floor(I),C=NC(C,0,Math.PI*2);const i=[],e=[],E=[],n=[],a=[],r=1/I,D=new Z,h=new PA,S=new Z,G=new Z,U=new Z;let k=0,y=0;for(let d=0;d<=A.length-1;d++)switch(d){case 0:k=A[d+1].x-A[d].x,y=A[d+1].y-A[d].y,S.x=y*1,S.y=-k,S.z=y*0,U.copy(S),S.normalize(),n.push(S.x,S.y,S.z);break;case A.length-1:n.push(U.x,U.y,U.z);break;default:k=A[d+1].x-A[d].x,y=A[d+1].y-A[d].y,S.x=y*1,S.y=-k,S.z=y*0,G.copy(S),S.x+=U.x,S.y+=U.y,S.z+=U.z,S.normalize(),n.push(S.x,S.y,S.z),U.copy(G)}for(let d=0;d<=I;d++){const J=g+d*r*C,F=Math.sin(J),v=Math.cos(J);for(let m=0;m<=A.length-1;m++){D.x=A[m].x*F,D.y=A[m].y,D.z=A[m].x*v,e.push(D.x,D.y,D.z),h.x=d/I,h.y=m/(A.length-1),E.push(h.x,h.y);const x=n[3*m+0]*F,T=n[3*m+1],L=n[3*m+0]*v;a.push(x,T,L)}}for(let d=0;d0&&J(!0),I>0&&J(!1)),this.setIndex(r),this.setAttribute("position",new xI(D,3)),this.setAttribute("normal",new xI(h,3)),this.setAttribute("uv",new xI(S,2));function d(){const F=new Z,v=new Z;let m=0;const x=(I-A)/g;for(let T=0;T<=i;T++){const L=[],Y=T/i,b=Y*(I-A)+A;for(let IA=0;IA<=C;IA++){const CA=IA/C,nA=CA*n+E,uA=Math.sin(nA),EA=Math.cos(nA);v.x=b*uA,v.y=-Y*g+k,v.z=b*EA,D.push(v.x,v.y,v.z),F.set(uA,x,EA).normalize(),h.push(F.x,F.y,F.z),S.push(CA,1-Y),L.push(G++)}U.push(L)}for(let T=0;T0||L!==0)&&(r.push(Y,b,CA),m+=3),(I>0||L!==i-1)&&(r.push(b,IA,CA),m+=3)}a.addGroup(y,m,0),y+=m}function J(F){const v=G,m=new PA,x=new Z;let T=0;const L=F===!0?A:I,Y=F===!0?1:-1;for(let IA=1;IA<=C;IA++)D.push(0,k*Y,0),h.push(0,Y,0),S.push(.5,.5),G++;const b=G;for(let IA=0;IA<=C;IA++){const nA=IA/C*n+E,uA=Math.cos(nA),EA=Math.sin(nA);x.x=L*EA,x.y=k*Y,x.z=L*uA,D.push(x.x,x.y,x.z),h.push(0,Y,0),m.x=uA*.5+.5,m.y=EA*.5*Y+.5,S.push(m.x,m.y),G++}for(let IA=0;IA.9&&x<.1&&(J<.2&&(e[d+0]+=1),F<.2&&(e[d+2]+=1),v<.2&&(e[d+4]+=1))}}function h(d){i.push(d.x,d.y,d.z)}function S(d,J){const F=d*3;J.x=A[F+0],J.y=A[F+1],J.z=A[F+2]}function G(){const d=new Z,J=new Z,F=new Z,v=new Z,m=new PA,x=new PA,T=new PA;for(let L=0,Y=0;L80*I){E=a=B[0],n=r=B[1];for(let G=I;Ga&&(a=D),h>r&&(r=h);S=Math.max(a-E,r-n),S=S!==0?32767/S:0}return Tr(i,e,I,E,n,S,0),e}};function Mp(B,A,I,g,C){let i,e;if(C===YY(B,A,I,g)>0)for(i=A;i=A;i-=g)e=N0(i,B[i],B[i+1],e);return e&&vc(e,e.next)&&(vr(e),e=e.next),e}function _o(B,A){if(!B)return B;A||(A=B);let I=B,g;do if(g=!1,!I.steiner&&(vc(I,I.next)||wC(I.prev,I,I.next)===0)){if(vr(I),I=A=I.prev,I===I.next)break;g=!0}else I=I.next;while(g||I!==A);return A}function Tr(B,A,I,g,C,i,e){if(!B)return;!e&&i&&JY(B,g,C,i);let E=B,n,a;for(;B.prev!==B.next;){if(n=B.prev,a=B.next,i?GY(B,g,C,i):yY(B)){A.push(n.i/I|0),A.push(B.i/I|0),A.push(a.i/I|0),vr(B),B=a.next,E=a.next;continue}if(B=a,B===E){e?e===1?(B=kY(_o(B),A,I),Tr(B,A,I,g,C,i,2)):e===2&&uY(B,A,I,g,C,i):Tr(_o(B),A,I,g,C,i,1);break}}}function yY(B){const A=B.prev,I=B,g=B.next;if(wC(A,I,g)>=0)return!1;const C=A.x,i=I.x,e=g.x,E=A.y,n=I.y,a=g.y,r=Ci?C>e?C:e:i>e?i:e,S=E>n?E>a?E:a:n>a?n:a;let G=g.next;for(;G!==A;){if(G.x>=r&&G.x<=h&&G.y>=D&&G.y<=S&&Ns(C,E,i,n,e,a,G.x,G.y)&&wC(G.prev,G,G.next)>=0)return!1;G=G.next}return!0}function GY(B,A,I,g){const C=B.prev,i=B,e=B.next;if(wC(C,i,e)>=0)return!1;const E=C.x,n=i.x,a=e.x,r=C.y,D=i.y,h=e.y,S=En?E>a?E:a:n>a?n:a,k=r>D?r>h?r:h:D>h?D:h,y=py(S,G,A,I,g),d=py(U,k,A,I,g);let J=B.prevZ,F=B.nextZ;for(;J&&J.z>=y&&F&&F.z<=d;){if(J.x>=S&&J.x<=U&&J.y>=G&&J.y<=k&&J!==C&&J!==e&&Ns(E,r,n,D,a,h,J.x,J.y)&&wC(J.prev,J,J.next)>=0||(J=J.prevZ,F.x>=S&&F.x<=U&&F.y>=G&&F.y<=k&&F!==C&&F!==e&&Ns(E,r,n,D,a,h,F.x,F.y)&&wC(F.prev,F,F.next)>=0))return!1;F=F.nextZ}for(;J&&J.z>=y;){if(J.x>=S&&J.x<=U&&J.y>=G&&J.y<=k&&J!==C&&J!==e&&Ns(E,r,n,D,a,h,J.x,J.y)&&wC(J.prev,J,J.next)>=0)return!1;J=J.prevZ}for(;F&&F.z<=d;){if(F.x>=S&&F.x<=U&&F.y>=G&&F.y<=k&&F!==C&&F!==e&&Ns(E,r,n,D,a,h,F.x,F.y)&&wC(F.prev,F,F.next)>=0)return!1;F=F.nextZ}return!0}function kY(B,A,I){let g=B;do{const C=g.prev,i=g.next.next;!vc(C,i)&&Up(C,g,g.next,i)&&xr(C,i)&&xr(i,C)&&(A.push(C.i/I|0),A.push(g.i/I|0),A.push(i.i/I|0),vr(g),vr(g.next),g=B=i),g=g.next}while(g!==B);return _o(g)}function uY(B,A,I,g,C,i){let e=B;do{let E=e.next.next;for(;E!==e.prev;){if(e.i!==E.i&&fY(e,E)){let n=pp(e,E);e=_o(e,e.next),n=_o(n,n.next),Tr(e,A,I,g,C,i,0),Tr(n,A,I,g,C,i,0);return}E=E.next}e=e.next}while(e!==B)}function MY(B,A,I,g){const C=[];let i,e,E,n,a;for(i=0,e=A.length;i=I.next.y&&I.next.y!==I.y){const h=I.x+(e-I.y)*(I.next.x-I.x)/(I.next.y-I.y);if(h<=i&&h>g&&(g=h,C=I.x=I.x&&I.x>=n&&i!==I.x&&Ns(eC.x||I.x===C.x&&NY(C,I)))&&(C=I,r=D)),I=I.next;while(I!==E);return C}function NY(B,A){return wC(B.prev,B,A.prev)<0&&wC(A.next,B,B.next)<0}function JY(B,A,I,g){let C=B;do C.z===0&&(C.z=py(C.x,C.y,A,I,g)),C.prevZ=C.prev,C.nextZ=C.next,C=C.next;while(C!==B);C.prevZ.nextZ=null,C.prevZ=null,KY(C)}function KY(B){let A,I,g,C,i,e,E,n,a=1;do{for(I=B,B=null,i=null,e=0;I;){for(e++,g=I,E=0,A=0;A0||n>0&&g;)E!==0&&(n===0||!g||I.z<=g.z)?(C=I,I=I.nextZ,E--):(C=g,g=g.nextZ,n--),i?i.nextZ=C:B=C,C.prevZ=i,i=C;I=g}i.nextZ=null,a*=2}while(e>1);return B}function py(B,A,I,g,C){return B=(B-I)*C|0,A=(A-g)*C|0,B=(B|B<<8)&16711935,B=(B|B<<4)&252645135,B=(B|B<<2)&858993459,B=(B|B<<1)&1431655765,A=(A|A<<8)&16711935,A=(A|A<<4)&252645135,A=(A|A<<2)&858993459,A=(A|A<<1)&1431655765,B|A<<1}function FY(B){let A=B,I=B;do(A.x=(B-e)*(i-E)&&(B-e)*(g-E)>=(I-e)*(A-E)&&(I-e)*(i-E)>=(C-e)*(g-E)}function fY(B,A){return B.next.i!==A.i&&B.prev.i!==A.i&&!RY(B,A)&&(xr(B,A)&&xr(A,B)&&LY(B,A)&&(wC(B.prev,B,A.prev)||wC(B,A.prev,A))||vc(B,A)&&wC(B.prev,B,B.next)>0&&wC(A.prev,A,A.next)>0)}function wC(B,A,I){return(A.y-B.y)*(I.x-A.x)-(A.x-B.x)*(I.y-A.y)}function vc(B,A){return B.x===A.x&&B.y===A.y}function Up(B,A,I,g){const C=zD(wC(B,A,I)),i=zD(wC(B,A,g)),e=zD(wC(I,g,B)),E=zD(wC(I,g,A));return!!(C!==i&&e!==E||C===0&&XD(B,I,A)||i===0&&XD(B,g,A)||e===0&&XD(I,B,g)||E===0&&XD(I,A,g))}function XD(B,A,I){return A.x<=Math.max(B.x,I.x)&&A.x>=Math.min(B.x,I.x)&&A.y<=Math.max(B.y,I.y)&&A.y>=Math.min(B.y,I.y)}function zD(B){return B>0?1:B<0?-1:0}function RY(B,A){let I=B;do{if(I.i!==B.i&&I.next.i!==B.i&&I.i!==A.i&&I.next.i!==A.i&&Up(I,I.next,B,A))return!0;I=I.next}while(I!==B);return!1}function xr(B,A){return wC(B.prev,B,B.next)<0?wC(B,A,B.next)>=0&&wC(B,B.prev,A)>=0:wC(B,A,B.prev)<0||wC(B,B.next,A)<0}function LY(B,A){let I=B,g=!1;const C=(B.x+A.x)/2,i=(B.y+A.y)/2;do I.y>i!=I.next.y>i&&I.next.y!==I.y&&C<(I.next.x-I.x)*(i-I.y)/(I.next.y-I.y)+I.x&&(g=!g),I=I.next;while(I!==B);return g}function pp(B,A){const I=new dy(B.i,B.x,B.y),g=new dy(A.i,A.x,A.y),C=B.next,i=A.prev;return B.next=A,A.prev=B,I.next=C,C.prev=I,g.next=I,I.prev=g,i.next=g,g.prev=i,g}function N0(B,A,I,g){const C=new dy(B,A,I);return g?(C.next=g.next,C.prev=g,g.next.prev=C,g.next=C):(C.prev=C,C.next=C),C}function vr(B){B.next.prev=B.prev,B.prev.next=B.next,B.prevZ&&(B.prevZ.nextZ=B.nextZ),B.nextZ&&(B.nextZ.prevZ=B.prevZ)}function dy(B,A,I){this.i=B,this.x=A,this.y=I,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function YY(B,A,I,g){let C=0;for(let i=A,e=I-g;i2&&B[A-1].equals(B[0])&&B.pop()}function K0(B,A){for(let I=0;INumber.EPSILON){const HA=Math.sqrt(O),ZA=Math.sqrt(nI*nI+W*W),xA=_A.x-HI/HA,UI=_A.y+CI/HA,tI=$.x-W/ZA,DI=$.y+nI/ZA,Ig=((tI-xA)*W-(DI-UI)*nI)/(CI*W-HI*nI);SI=xA+CI*Ig-TA.x,jA=UI+HI*Ig-TA.y;const zA=SI*SI+jA*jA;if(zA<=2)return new PA(SI,jA);lI=Math.sqrt(zA/2)}else{let HA=!1;CI>Number.EPSILON?nI>Number.EPSILON&&(HA=!0):CI<-Number.EPSILON?nI<-Number.EPSILON&&(HA=!0):Math.sign(HI)===Math.sign(W)&&(HA=!0),HA?(SI=-HI,jA=CI,lI=Math.sqrt(O)):(SI=CI,jA=HI,lI=Math.sqrt(O/2))}return new PA(SI/lI,jA/lI)}const aA=[];for(let TA=0,_A=nA.length,$=_A-1,SI=TA+1;TA<_A;TA++,$++,SI++)$===_A&&($=0),SI===_A&&(SI=0),aA[TA]=V(nA[TA],nA[$],nA[SI]);const BA=[];let P,oA=aA.concat();for(let TA=0,_A=b.length;TA<_A;TA++){const $=b[TA];P=[];for(let SI=0,jA=$.length,lI=jA-1,CI=SI+1;SI=0;TA--){const _A=TA/k,$=S*Math.cos(_A*Math.PI/2),SI=G*Math.sin(_A*Math.PI/2)+U;for(let jA=0,lI=nA.length;jA=0;){const SI=$;let jA=$-1;jA<0&&(jA=TA.length-1);for(let lI=0,CI=r+k*2;lI0)&&S.push(J,F,m),(y!==g-1||n0!=A>0&&this.version++,this._anisotropy=A}get clearcoat(){return this._clearcoat}set clearcoat(A){this._clearcoat>0!=A>0&&this.version++,this._clearcoat=A}get iridescence(){return this._iridescence}set iridescence(A){this._iridescence>0!=A>0&&this.version++,this._iridescence=A}get dispersion(){return this._dispersion}set dispersion(A){this._dispersion>0!=A>0&&this.version++,this._dispersion=A}get sheen(){return this._sheen}set sheen(A){this._sheen>0!=A>0&&this.version++,this._sheen=A}get transmission(){return this._transmission}set transmission(A){this._transmission>0!=A>0&&this.version++,this._transmission=A}copy(A){return super.copy(A),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=A.anisotropy,this.anisotropyRotation=A.anisotropyRotation,this.anisotropyMap=A.anisotropyMap,this.clearcoat=A.clearcoat,this.clearcoatMap=A.clearcoatMap,this.clearcoatRoughness=A.clearcoatRoughness,this.clearcoatRoughnessMap=A.clearcoatRoughnessMap,this.clearcoatNormalMap=A.clearcoatNormalMap,this.clearcoatNormalScale.copy(A.clearcoatNormalScale),this.dispersion=A.dispersion,this.ior=A.ior,this.iridescence=A.iridescence,this.iridescenceMap=A.iridescenceMap,this.iridescenceIOR=A.iridescenceIOR,this.iridescenceThicknessRange=[...A.iridescenceThicknessRange],this.iridescenceThicknessMap=A.iridescenceThicknessMap,this.sheen=A.sheen,this.sheenColor.copy(A.sheenColor),this.sheenColorMap=A.sheenColorMap,this.sheenRoughness=A.sheenRoughness,this.sheenRoughnessMap=A.sheenRoughnessMap,this.transmission=A.transmission,this.transmissionMap=A.transmissionMap,this.thickness=A.thickness,this.thicknessMap=A.thicknessMap,this.attenuationDistance=A.attenuationDistance,this.attenuationColor.copy(A.attenuationColor),this.specularIntensity=A.specularIntensity,this.specularIntensityMap=A.specularIntensityMap,this.specularColor.copy(A.specularColor),this.specularColorMap=A.specularColorMap,this}}class Kp extends iB{static get type(){return"MeshPhongMaterial"}constructor(A){super(),this.isMeshPhongMaterial=!0,this.color=new cI(16777215),this.specular=new cI(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new cI(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=St,this.normalScale=new PA(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ZB,this.combine=Il,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(A)}copy(A){return super.copy(A),this.color.copy(A.color),this.specular.copy(A.specular),this.shininess=A.shininess,this.map=A.map,this.lightMap=A.lightMap,this.lightMapIntensity=A.lightMapIntensity,this.aoMap=A.aoMap,this.aoMapIntensity=A.aoMapIntensity,this.emissive.copy(A.emissive),this.emissiveMap=A.emissiveMap,this.emissiveIntensity=A.emissiveIntensity,this.bumpMap=A.bumpMap,this.bumpScale=A.bumpScale,this.normalMap=A.normalMap,this.normalMapType=A.normalMapType,this.normalScale.copy(A.normalScale),this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this.specularMap=A.specularMap,this.alphaMap=A.alphaMap,this.envMap=A.envMap,this.envMapRotation.copy(A.envMapRotation),this.combine=A.combine,this.reflectivity=A.reflectivity,this.refractionRatio=A.refractionRatio,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this.wireframeLinecap=A.wireframeLinecap,this.wireframeLinejoin=A.wireframeLinejoin,this.flatShading=A.flatShading,this.fog=A.fog,this}}class Fp extends iB{static get type(){return"MeshToonMaterial"}constructor(A){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.color=new cI(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new cI(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=St,this.normalScale=new PA(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(A)}copy(A){return super.copy(A),this.color.copy(A.color),this.map=A.map,this.gradientMap=A.gradientMap,this.lightMap=A.lightMap,this.lightMapIntensity=A.lightMapIntensity,this.aoMap=A.aoMap,this.aoMapIntensity=A.aoMapIntensity,this.emissive.copy(A.emissive),this.emissiveMap=A.emissiveMap,this.emissiveIntensity=A.emissiveIntensity,this.bumpMap=A.bumpMap,this.bumpScale=A.bumpScale,this.normalMap=A.normalMap,this.normalMapType=A.normalMapType,this.normalScale.copy(A.normalScale),this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this.alphaMap=A.alphaMap,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this.wireframeLinecap=A.wireframeLinecap,this.wireframeLinejoin=A.wireframeLinejoin,this.fog=A.fog,this}}class fp extends iB{static get type(){return"MeshNormalMaterial"}constructor(A){super(),this.isMeshNormalMaterial=!0,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=St,this.normalScale=new PA(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(A)}copy(A){return super.copy(A),this.bumpMap=A.bumpMap,this.bumpScale=A.bumpScale,this.normalMap=A.normalMap,this.normalMapType=A.normalMapType,this.normalScale.copy(A.normalScale),this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this.flatShading=A.flatShading,this}}class Rp extends iB{static get type(){return"MeshLambertMaterial"}constructor(A){super(),this.isMeshLambertMaterial=!0,this.color=new cI(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new cI(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=St,this.normalScale=new PA(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ZB,this.combine=Il,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(A)}copy(A){return super.copy(A),this.color.copy(A.color),this.map=A.map,this.lightMap=A.lightMap,this.lightMapIntensity=A.lightMapIntensity,this.aoMap=A.aoMap,this.aoMapIntensity=A.aoMapIntensity,this.emissive.copy(A.emissive),this.emissiveMap=A.emissiveMap,this.emissiveIntensity=A.emissiveIntensity,this.bumpMap=A.bumpMap,this.bumpScale=A.bumpScale,this.normalMap=A.normalMap,this.normalMapType=A.normalMapType,this.normalScale.copy(A.normalScale),this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this.specularMap=A.specularMap,this.alphaMap=A.alphaMap,this.envMap=A.envMap,this.envMapRotation.copy(A.envMapRotation),this.combine=A.combine,this.reflectivity=A.reflectivity,this.refractionRatio=A.refractionRatio,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this.wireframeLinecap=A.wireframeLinecap,this.wireframeLinejoin=A.wireframeLinejoin,this.flatShading=A.flatShading,this.fog=A.fog,this}}class Lp extends iB{static get type(){return"MeshMatcapMaterial"}constructor(A){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.color=new cI(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=St,this.normalScale=new PA(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(A)}copy(A){return super.copy(A),this.defines={MATCAP:""},this.color.copy(A.color),this.matcap=A.matcap,this.map=A.map,this.bumpMap=A.bumpMap,this.bumpScale=A.bumpScale,this.normalMap=A.normalMap,this.normalMapType=A.normalMapType,this.normalScale.copy(A.normalScale),this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this.alphaMap=A.alphaMap,this.flatShading=A.flatShading,this.fog=A.fog,this}}class Yp extends PB{static get type(){return"LineDashedMaterial"}constructor(A){super(),this.isLineDashedMaterial=!0,this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(A)}copy(A){return super.copy(A),this.scale=A.scale,this.dashSize=A.dashSize,this.gapSize=A.gapSize,this}}function fo(B,A,I){return!B||!I&&B.constructor===A?B:typeof A.BYTES_PER_ELEMENT=="number"?new A(B):Array.prototype.slice.call(B)}function qp(B){return ArrayBuffer.isView(B)&&!(B instanceof DataView)}function mp(B){function A(C,i){return B[C]-B[i]}const I=B.length,g=new Array(I);for(let C=0;C!==I;++C)g[C]=C;return g.sort(A),g}function Ny(B,A,I){const g=B.length,C=new B.constructor(g);for(let i=0,e=0;e!==g;++i){const E=I[i]*A;for(let n=0;n!==A;++n)C[e++]=B[E+n]}return C}function hG(B,A,I,g){let C=1,i=B[0];for(;i!==void 0&&i[g]===void 0;)i=B[C++];if(i===void 0)return;let e=i[g];if(e!==void 0)if(Array.isArray(e))do e=i[g],e!==void 0&&(A.push(i.time),I.push.apply(I,e)),i=B[C++];while(i!==void 0);else if(e.toArray!==void 0)do e=i[g],e!==void 0&&(A.push(i.time),e.toArray(I,I.length)),i=B[C++];while(i!==void 0);else do e=i[g],e!==void 0&&(A.push(i.time),I.push(e)),i=B[C++];while(i!==void 0)}function TY(B,A,I,g,C=30){const i=B.clone();i.name=A;const e=[];for(let n=0;n=g)){D.push(a.times[S]);for(let U=0;Ui.tracks[n].times[0]&&(E=i.tracks[n].times[0]);for(let n=0;n=E.times[G]){const y=G*D+r,d=y+D-r;U=E.values.slice(y,d)}else{const y=E.createInterpolant(),d=r,J=D-r;y.evaluate(i),U=y.resultBuffer.slice(d,J)}n==="quaternion"&&new BB().fromArray(U).normalize().conjugate().toArray(U);const k=a.times.length;for(let y=0;y=i)){const E=I[1];A=i)break I}e=g,g=0;break g}break A}for(;g>>1;AI;)--e;if(++e,i!==0||e!==C){i>=e&&(e=Math.max(e,1),i=e-1);const E=this.getValueSize();this.times=g.slice(i,e),this.values=this.values.slice(i*E,e*E)}return this}validate(){let A=!0;const I=this.getValueSize();I-Math.floor(I)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),A=!1);const g=this.times,C=this.values,i=g.length;i===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),A=!1);let e=null;for(let E=0;E!==i;E++){const n=g[E];if(typeof n=="number"&&isNaN(n)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,E,n),A=!1;break}if(e!==null&&e>n){console.error("THREE.KeyframeTrack: Out of order keys.",this,E,n,e),A=!1;break}e=n}if(C!==void 0&&qp(C))for(let E=0,n=C.length;E!==n;++E){const a=C[E];if(isNaN(a)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,E,a),A=!1;break}}return A}optimize(){const A=this.times.slice(),I=this.values.slice(),g=this.getValueSize(),C=this.getInterpolation()===lh,i=A.length-1;let e=1;for(let E=1;E0){A[e]=A[i];for(let E=i*g,n=e*g,a=0;a!==g;++a)I[n+a]=I[E+a];++e}return e!==A.length?(this.times=A.slice(0,e),this.values=I.slice(0,e*g)):(this.times=A,this.values=I),this}clone(){const A=this.times.slice(),I=this.values.slice(),g=this.constructor,C=new g(this.name,A,I);return C.createInterpolant=this.createInterpolant,C}}ZQ.prototype.TimeBufferType=Float32Array;ZQ.prototype.ValueBufferType=Float32Array;ZQ.prototype.DefaultInterpolation=Ts;class Cn extends ZQ{constructor(A,I,g){super(A,I,g)}}Cn.prototype.ValueTypeName="bool";Cn.prototype.ValueBufferType=Array;Cn.prototype.DefaultInterpolation=Hs;Cn.prototype.InterpolantFactoryMethodLinear=void 0;Cn.prototype.InterpolantFactoryMethodSmooth=void 0;class SG extends ZQ{}SG.prototype.ValueTypeName="color";class Zo extends ZQ{}Zo.prototype.ValueTypeName="number";class xp extends $s{constructor(A,I,g,C){super(A,I,g,C)}interpolate_(A,I,g,C){const i=this.resultBuffer,e=this.sampleValues,E=this.valueSize,n=(g-I)/(C-I);let a=A*E;for(let r=a+E;a!==r;a+=4)BB.slerpFlat(i,0,e,a-E,e,a,n);return i}}class Po extends ZQ{InterpolantFactoryMethodLinear(A){return new xp(this.times,this.values,this.getValueSize(),A)}}Po.prototype.ValueTypeName="quaternion";Po.prototype.InterpolantFactoryMethodSmooth=void 0;class Bn extends ZQ{constructor(A,I,g){super(A,I,g)}}Bn.prototype.ValueTypeName="string";Bn.prototype.ValueBufferType=Array;Bn.prototype.DefaultInterpolation=Hs;Bn.prototype.InterpolantFactoryMethodLinear=void 0;Bn.prototype.InterpolantFactoryMethodSmooth=void 0;class Wo extends ZQ{}Wo.prototype.ValueTypeName="vector";class Os{constructor(A="",I=-1,g=[],C=pc){this.name=A,this.tracks=g,this.duration=I,this.blendMode=C,this.uuid=Oi(),this.duration<0&&this.resetDuration()}static parse(A){const I=[],g=A.tracks,C=1/(A.fps||1);for(let e=0,E=g.length;e!==E;++e)I.push(bY(g[e]).scale(C));const i=new this(A.name,A.duration,I,A.blendMode);return i.uuid=A.uuid,i}static toJSON(A){const I=[],g=A.tracks,C={name:A.name,duration:A.duration,tracks:I,uuid:A.uuid,blendMode:A.blendMode};for(let i=0,e=g.length;i!==e;++i)I.push(ZQ.toJSON(g[i]));return C}static CreateFromMorphTargetSequence(A,I,g,C){const i=I.length,e=[];for(let E=0;E1){const D=r[1];let h=C[D];h||(C[D]=h=[]),h.push(a)}}const e=[];for(const E in C)e.push(this.CreateFromMorphTargetSequence(E,C[E],I,g));return e}static parseAnimation(A,I){if(!A)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const g=function(D,h,S,G,U){if(S.length!==0){const k=[],y=[];hG(S,k,y,G),k.length!==0&&U.push(new D(h,k,y))}},C=[],i=A.name||"default",e=A.fps||30,E=A.blendMode;let n=A.length||-1;const a=A.hierarchy||[];for(let D=0;D{I&&I(i),this.manager.itemEnd(A)},0),i;if(BE[A]!==void 0){BE[A].push({onLoad:I,onProgress:g,onError:C});return}BE[A]=[],BE[A].push({onLoad:I,onProgress:g,onError:C});const e=new Request(A,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),E=this.mimeType,n=this.responseType;fetch(e).then(a=>{if(a.status===200||a.status===0){if(a.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||a.body===void 0||a.body.getReader===void 0)return a;const r=BE[A],D=a.body.getReader(),h=a.headers.get("X-File-Size")||a.headers.get("Content-Length"),S=h?parseInt(h):0,G=S!==0;let U=0;const k=new ReadableStream({start(y){d();function d(){D.read().then(({done:J,value:F})=>{if(J)y.close();else{U+=F.byteLength;const v=new ProgressEvent("progress",{lengthComputable:G,loaded:U,total:S});for(let m=0,x=r.length;m{y.error(J)})}}});return new Response(k)}else throw new _Y(`fetch for "${a.url}" responded with ${a.status}: ${a.statusText}`,a)}).then(a=>{switch(n){case"arraybuffer":return a.arrayBuffer();case"blob":return a.blob();case"document":return a.text().then(r=>new DOMParser().parseFromString(r,E));case"json":return a.json();default:if(E===void 0)return a.text();{const D=/charset="?([^;"\s]*)"?/i.exec(E),h=D&&D[1]?D[1].toLowerCase():void 0,S=new TextDecoder(h);return a.arrayBuffer().then(G=>S.decode(G))}}}).then(a=>{oE.add(A,a);const r=BE[A];delete BE[A];for(let D=0,h=r.length;D{const r=BE[A];if(r===void 0)throw this.manager.itemError(A),a;delete BE[A];for(let D=0,h=r.length;D{this.manager.itemEnd(A)}),this.manager.itemStart(A)}setResponseType(A){return this.responseType=A,this}setMimeType(A){return this.mimeType=A,this}}class ZY extends RB{constructor(A){super(A)}load(A,I,g,C){const i=this,e=new fB(this.manager);e.setPath(this.path),e.setRequestHeader(this.requestHeader),e.setWithCredentials(this.withCredentials),e.load(A,function(E){try{I(i.parse(JSON.parse(E)))}catch(n){C?C(n):console.error(n),i.manager.itemError(A)}},g,C)}parse(A){const I=[];for(let g=0;g0:C.vertexColors=A.vertexColors),A.uniforms!==void 0)for(const i in A.uniforms){const e=A.uniforms[i];switch(C.uniforms[i]={},e.type){case"t":C.uniforms[i].value=g(e.value);break;case"c":C.uniforms[i].value=new cI().setHex(e.value);break;case"v2":C.uniforms[i].value=new PA().fromArray(e.value);break;case"v3":C.uniforms[i].value=new Z().fromArray(e.value);break;case"v4":C.uniforms[i].value=new Hg().fromArray(e.value);break;case"m3":C.uniforms[i].value=new sg().fromArray(e.value);break;case"m4":C.uniforms[i].value=new VI().fromArray(e.value);break;default:C.uniforms[i].value=e.value}}if(A.defines!==void 0&&(C.defines=A.defines),A.vertexShader!==void 0&&(C.vertexShader=A.vertexShader),A.fragmentShader!==void 0&&(C.fragmentShader=A.fragmentShader),A.glslVersion!==void 0&&(C.glslVersion=A.glslVersion),A.extensions!==void 0)for(const i in A.extensions)C.extensions[i]=A.extensions[i];if(A.lights!==void 0&&(C.lights=A.lights),A.clipping!==void 0&&(C.clipping=A.clipping),A.size!==void 0&&(C.size=A.size),A.sizeAttenuation!==void 0&&(C.sizeAttenuation=A.sizeAttenuation),A.map!==void 0&&(C.map=g(A.map)),A.matcap!==void 0&&(C.matcap=g(A.matcap)),A.alphaMap!==void 0&&(C.alphaMap=g(A.alphaMap)),A.bumpMap!==void 0&&(C.bumpMap=g(A.bumpMap)),A.bumpScale!==void 0&&(C.bumpScale=A.bumpScale),A.normalMap!==void 0&&(C.normalMap=g(A.normalMap)),A.normalMapType!==void 0&&(C.normalMapType=A.normalMapType),A.normalScale!==void 0){let i=A.normalScale;Array.isArray(i)===!1&&(i=[i,i]),C.normalScale=new PA().fromArray(i)}return A.displacementMap!==void 0&&(C.displacementMap=g(A.displacementMap)),A.displacementScale!==void 0&&(C.displacementScale=A.displacementScale),A.displacementBias!==void 0&&(C.displacementBias=A.displacementBias),A.roughnessMap!==void 0&&(C.roughnessMap=g(A.roughnessMap)),A.metalnessMap!==void 0&&(C.metalnessMap=g(A.metalnessMap)),A.emissiveMap!==void 0&&(C.emissiveMap=g(A.emissiveMap)),A.emissiveIntensity!==void 0&&(C.emissiveIntensity=A.emissiveIntensity),A.specularMap!==void 0&&(C.specularMap=g(A.specularMap)),A.specularIntensityMap!==void 0&&(C.specularIntensityMap=g(A.specularIntensityMap)),A.specularColorMap!==void 0&&(C.specularColorMap=g(A.specularColorMap)),A.envMap!==void 0&&(C.envMap=g(A.envMap)),A.envMapRotation!==void 0&&C.envMapRotation.fromArray(A.envMapRotation),A.envMapIntensity!==void 0&&(C.envMapIntensity=A.envMapIntensity),A.reflectivity!==void 0&&(C.reflectivity=A.reflectivity),A.refractionRatio!==void 0&&(C.refractionRatio=A.refractionRatio),A.lightMap!==void 0&&(C.lightMap=g(A.lightMap)),A.lightMapIntensity!==void 0&&(C.lightMapIntensity=A.lightMapIntensity),A.aoMap!==void 0&&(C.aoMap=g(A.aoMap)),A.aoMapIntensity!==void 0&&(C.aoMapIntensity=A.aoMapIntensity),A.gradientMap!==void 0&&(C.gradientMap=g(A.gradientMap)),A.clearcoatMap!==void 0&&(C.clearcoatMap=g(A.clearcoatMap)),A.clearcoatRoughnessMap!==void 0&&(C.clearcoatRoughnessMap=g(A.clearcoatRoughnessMap)),A.clearcoatNormalMap!==void 0&&(C.clearcoatNormalMap=g(A.clearcoatNormalMap)),A.clearcoatNormalScale!==void 0&&(C.clearcoatNormalScale=new PA().fromArray(A.clearcoatNormalScale)),A.iridescenceMap!==void 0&&(C.iridescenceMap=g(A.iridescenceMap)),A.iridescenceThicknessMap!==void 0&&(C.iridescenceThicknessMap=g(A.iridescenceThicknessMap)),A.transmissionMap!==void 0&&(C.transmissionMap=g(A.transmissionMap)),A.thicknessMap!==void 0&&(C.thicknessMap=g(A.thicknessMap)),A.anisotropyMap!==void 0&&(C.anisotropyMap=g(A.anisotropyMap)),A.sheenColorMap!==void 0&&(C.sheenColorMap=g(A.sheenColorMap)),A.sheenRoughnessMap!==void 0&&(C.sheenRoughnessMap=g(A.sheenRoughnessMap)),C}setTextures(A){return this.textures=A,this}createMaterialFromType(A){return Xc.createMaterialFromType(A)}static createMaterialFromType(A){const I={ShadowMaterial:Np,SpriteMaterial:iG,RawShaderMaterial:Jp,ShaderMaterial:ni,PointsMaterial:Rc,MeshPhysicalMaterial:nQ,MeshStandardMaterial:Dl,MeshPhongMaterial:Kp,MeshToonMaterial:Fp,MeshNormalMaterial:fp,MeshLambertMaterial:Rp,MeshDepthMaterial:gG,MeshDistanceMaterial:CG,MeshBasicMaterial:pi,MeshMatcapMaterial:Lp,LineDashedMaterial:Yp,LineBasicMaterial:PB,Material:iB};return new I[A]}}class at{static decodeText(A){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(A);let I="";for(let g=0,C=A.length;g0){const n=new jc(I);i=new Or(n),i.setCrossOrigin(this.crossOrigin);for(let a=0,r=A.length;a0){C=new Or(this.manager),C.setCrossOrigin(this.crossOrigin);for(let e=0,E=A.length;e{const k=new _B;k.min.fromArray(U.boxMin),k.max.fromArray(U.boxMax);const y=new FB;return y.radius=U.sphereRadius,y.center.fromArray(U.sphereCenter),{boxInitialized:U.boxInitialized,box:k,sphereInitialized:U.sphereInitialized,sphere:y}}),e._maxInstanceCount=A.maxInstanceCount,e._maxVertexCount=A.maxVertexCount,e._maxIndexCount=A.maxIndexCount,e._geometryInitialized=A.geometryInitialized,e._geometryCount=A.geometryCount,e._matricesTexture=a(A.matricesTexture.uuid),A.colorsTexture!==void 0&&(e._colorsTexture=a(A.colorsTexture.uuid));break;case"LOD":e=new cp;break;case"Line":e=new rE(E(A.geometry),n(A.material));break;case"LineLoop":e=new EG(E(A.geometry),n(A.material));break;case"LineSegments":e=new bQ(E(A.geometry),n(A.material));break;case"PointCloud":case"Points":e=new tG(E(A.geometry),n(A.material));break;case"Sprite":e=new hp(n(A.material));break;case"Group":e=new tE;break;case"Bone":e=new fc;break;default:e=new Ng}if(e.uuid=A.uuid,A.name!==void 0&&(e.name=A.name),A.matrix!==void 0?(e.matrix.fromArray(A.matrix),A.matrixAutoUpdate!==void 0&&(e.matrixAutoUpdate=A.matrixAutoUpdate),e.matrixAutoUpdate&&e.matrix.decompose(e.position,e.quaternion,e.scale)):(A.position!==void 0&&e.position.fromArray(A.position),A.rotation!==void 0&&e.rotation.fromArray(A.rotation),A.quaternion!==void 0&&e.quaternion.fromArray(A.quaternion),A.scale!==void 0&&e.scale.fromArray(A.scale)),A.up!==void 0&&e.up.fromArray(A.up),A.castShadow!==void 0&&(e.castShadow=A.castShadow),A.receiveShadow!==void 0&&(e.receiveShadow=A.receiveShadow),A.shadow&&(A.shadow.intensity!==void 0&&(e.shadow.intensity=A.shadow.intensity),A.shadow.bias!==void 0&&(e.shadow.bias=A.shadow.bias),A.shadow.normalBias!==void 0&&(e.shadow.normalBias=A.shadow.normalBias),A.shadow.radius!==void 0&&(e.shadow.radius=A.shadow.radius),A.shadow.mapSize!==void 0&&e.shadow.mapSize.fromArray(A.shadow.mapSize),A.shadow.camera!==void 0&&(e.shadow.camera=this.parseObject(A.shadow.camera))),A.visible!==void 0&&(e.visible=A.visible),A.frustumCulled!==void 0&&(e.frustumCulled=A.frustumCulled),A.renderOrder!==void 0&&(e.renderOrder=A.renderOrder),A.userData!==void 0&&(e.userData=A.userData),A.layers!==void 0&&(e.layers.mask=A.layers),A.children!==void 0){const h=A.children;for(let S=0;S"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(A){return this.options=A,this}load(A,I,g,C){A===void 0&&(A=""),this.path!==void 0&&(A=this.path+A),A=this.manager.resolveURL(A);const i=this,e=oE.get(A);if(e!==void 0){if(i.manager.itemStart(A),e.then){e.then(a=>{I&&I(a),i.manager.itemEnd(A)}).catch(a=>{C&&C(a)});return}return setTimeout(function(){I&&I(e),i.manager.itemEnd(A)},0),e}const E={};E.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",E.headers=this.requestHeader;const n=fetch(A,E).then(function(a){return a.blob()}).then(function(a){return createImageBitmap(a,Object.assign(i.options,{colorSpaceConversion:"none"}))}).then(function(a){return oE.add(A,a),I&&I(a),i.manager.itemEnd(A),a}).catch(function(a){C&&C(a),oE.remove(A),i.manager.itemError(A),i.manager.itemEnd(A)});oE.add(A,n),i.manager.itemStart(A)}}let $D;class MG{static getContext(){return $D===void 0&&($D=new(window.AudioContext||window.webkitAudioContext)),$D}static setContext(A){$D=A}}class $Y extends RB{constructor(A){super(A)}load(A,I,g,C){const i=this,e=new fB(this.manager);e.setResponseType("arraybuffer"),e.setPath(this.path),e.setRequestHeader(this.requestHeader),e.setWithCredentials(this.withCredentials),e.load(A,function(n){try{const a=n.slice(0);MG.getContext().decodeAudioData(a,function(D){I(D)}).catch(E)}catch(a){E(a)}},g,C);function E(n){C?C(n):console.error(n),i.manager.itemError(A)}}}const H0=new VI,T0=new VI,Do=new VI;class Aq{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new CB,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new CB,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(A){const I=this._cache;if(I.focus!==A.focus||I.fov!==A.fov||I.aspect!==A.aspect*this.aspect||I.near!==A.near||I.far!==A.far||I.zoom!==A.zoom||I.eyeSep!==this.eyeSep){I.focus=A.focus,I.fov=A.fov,I.aspect=A.aspect*this.aspect,I.near=A.near,I.far=A.far,I.zoom=A.zoom,I.eyeSep=this.eyeSep,Do.copy(A.projectionMatrix);const C=I.eyeSep/2,i=C*I.near/I.focus,e=I.near*Math.tan(mo*I.fov*.5)/I.zoom;let E,n;T0.elements[12]=-C,H0.elements[12]=C,E=-e*I.aspect+i,n=e*I.aspect+i,Do.elements[0]=2*I.near/(n-E),Do.elements[8]=(n+E)/(n-E),this.cameraL.projectionMatrix.copy(Do),E=-e*I.aspect-i,n=e*I.aspect-i,Do.elements[0]=2*I.near/(n-E),Do.elements[8]=(n+E)/(n-E),this.cameraR.projectionMatrix.copy(Do)}this.cameraL.matrixWorld.copy(A.matrixWorld).multiply(T0),this.cameraR.matrixWorld.copy(A.matrixWorld).multiply(H0)}}class UG{constructor(A=!0){this.autoStart=A,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=x0(),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 A=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const I=x0();A=(I-this.oldTime)/1e3,this.oldTime=I,this.elapsedTime+=A}return A}}function x0(){return performance.now()}const ho=new Z,v0=new BB,Iq=new Z,co=new Z;class gq extends Ng{constructor(){super(),this.type="AudioListener",this.context=MG.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new UG}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(A){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=A,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(A){return this.gain.gain.setTargetAtTime(A,this.context.currentTime,.01),this}updateMatrixWorld(A){super.updateMatrixWorld(A);const I=this.context.listener,g=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(ho,v0,Iq),co.set(0,0,-1).applyQuaternion(v0),I.positionX){const C=this.context.currentTime+this.timeDelta;I.positionX.linearRampToValueAtTime(ho.x,C),I.positionY.linearRampToValueAtTime(ho.y,C),I.positionZ.linearRampToValueAtTime(ho.z,C),I.forwardX.linearRampToValueAtTime(co.x,C),I.forwardY.linearRampToValueAtTime(co.y,C),I.forwardZ.linearRampToValueAtTime(co.z,C),I.upX.linearRampToValueAtTime(g.x,C),I.upY.linearRampToValueAtTime(g.y,C),I.upZ.linearRampToValueAtTime(g.z,C)}else I.setPosition(ho.x,ho.y,ho.z),I.setOrientation(co.x,co.y,co.z,g.x,g.y,g.z)}}class $p extends Ng{constructor(A){super(),this.type="Audio",this.listener=A,this.context=A.context,this.gain=this.context.createGain(),this.gain.connect(A.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(A){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=A,this.connect(),this}setMediaElementSource(A){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(A),this.connect(),this}setMediaStreamSource(A){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(A),this.connect(),this}setBuffer(A){return this.buffer=A,this.sourceType="buffer",this.autoplay&&this.play(),this}play(A=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+A;const I=this.context.createBufferSource();return I.buffer=this.buffer,I.loop=this.loop,I.loopStart=this.loopStart,I.loopEnd=this.loopEnd,I.onended=this.onEnded.bind(this),I.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=I,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(A=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+A),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let A=1,I=this.filters.length;A0){this.source.disconnect(this.filters[0]);for(let A=1,I=this.filters.length;A0&&this._mixBufferRegionAdditive(g,C,this._addIndex*I,1,I);for(let n=I,a=I+I;n!==a;++n)if(g[n]!==g[n+I]){E.setValue(g,C);break}}saveOriginalState(){const A=this.binding,I=this.buffer,g=this.valueSize,C=g*this._origIndex;A.getValue(I,C);for(let i=g,e=C;i!==e;++i)I[i]=I[C+i%g];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const A=this.valueSize*3;this.binding.setValue(this.buffer,A)}_setAdditiveIdentityNumeric(){const A=this._addIndex*this.valueSize,I=A+this.valueSize;for(let g=A;g=.5)for(let e=0;e!==i;++e)A[I+e]=A[g+e]}_slerp(A,I,g,C){BB.slerpFlat(A,I,A,I,A,g,C)}_slerpAdditive(A,I,g,C,i){const e=this._workIndex*i;BB.multiplyQuaternionsFlat(A,e,A,I,A,g),BB.slerpFlat(A,I,A,I,A,e,C)}_lerp(A,I,g,C,i){const e=1-C;for(let E=0;E!==i;++E){const n=I+E;A[n]=A[n]*e+A[g+E]*C}}_lerpAdditive(A,I,g,C,i){for(let e=0;e!==i;++e){const E=I+e;A[E]=A[E]+A[g+e]*C}}}const pG="\\[\\]\\.:\\/",Qq=new RegExp("["+pG+"]","g"),dG="[^"+pG+"]",eq="[^"+pG.replace("\\.","")+"]",Eq=/((?:WC+[\/:])*)/.source.replace("WC",dG),tq=/(WCOD+)?/.source.replace("WCOD",eq),oq=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",dG),nq=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",dG),sq=new RegExp("^"+Eq+tq+oq+nq+"$"),aq=["material","materials","bones","map"];class rq{constructor(A,I,g){const C=g||Rg.parseTrackName(I);this._targetGroup=A,this._bindings=A.subscribe_(I,C)}getValue(A,I){this.bind();const g=this._targetGroup.nCachedObjects_,C=this._bindings[g];C!==void 0&&C.getValue(A,I)}setValue(A,I){const g=this._bindings;for(let C=this._targetGroup.nCachedObjects_,i=g.length;C!==i;++C)g[C].setValue(A,I)}bind(){const A=this._bindings;for(let I=this._targetGroup.nCachedObjects_,g=A.length;I!==g;++I)A[I].bind()}unbind(){const A=this._bindings;for(let I=this._targetGroup.nCachedObjects_,g=A.length;I!==g;++I)A[I].unbind()}}class Rg{constructor(A,I,g){this.path=I,this.parsedPath=g||Rg.parseTrackName(I),this.node=Rg.findNode(A,this.parsedPath.nodeName),this.rootNode=A,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(A,I,g){return A&&A.isAnimationObjectGroup?new Rg.Composite(A,I,g):new Rg(A,I,g)}static sanitizeNodeName(A){return A.replace(/\s/g,"_").replace(Qq,"")}static parseTrackName(A){const I=sq.exec(A);if(I===null)throw new Error("PropertyBinding: Cannot parse trackName: "+A);const g={nodeName:I[2],objectName:I[3],objectIndex:I[4],propertyName:I[5],propertyIndex:I[6]},C=g.nodeName&&g.nodeName.lastIndexOf(".");if(C!==void 0&&C!==-1){const i=g.nodeName.substring(C+1);aq.indexOf(i)!==-1&&(g.nodeName=g.nodeName.substring(0,C),g.objectName=i)}if(g.propertyName===null||g.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+A);return g}static findNode(A,I){if(I===void 0||I===""||I==="."||I===-1||I===A.name||I===A.uuid)return A;if(A.skeleton){const g=A.skeleton.getBoneByName(I);if(g!==void 0)return g}if(A.children){const g=function(i){for(let e=0;e=i){const D=i++,h=A[D];I[h.uuid]=r,A[r]=h,I[a]=D,A[D]=n;for(let S=0,G=C;S!==G;++S){const U=g[S],k=U[D],y=U[r];U[r]=k,U[D]=y}}}this.nCachedObjects_=i}uncache(){const A=this._objects,I=this._indicesByUUID,g=this._bindings,C=g.length;let i=this.nCachedObjects_,e=A.length;for(let E=0,n=arguments.length;E!==n;++E){const a=arguments[E],r=a.uuid,D=I[r];if(D!==void 0)if(delete I[r],D0&&(I[S.uuid]=D),A[D]=S,A.pop();for(let G=0,U=C;G!==U;++G){const k=g[G];k[D]=k[h],k.pop()}}}this.nCachedObjects_=i}subscribe_(A,I){const g=this._bindingsIndicesByPath;let C=g[A];const i=this._bindings;if(C!==void 0)return i[C];const e=this._paths,E=this._parsedPaths,n=this._objects,a=n.length,r=this.nCachedObjects_,D=new Array(a);C=i.length,g[A]=C,e.push(A),E.push(I),i.push(D);for(let h=r,S=n.length;h!==S;++h){const G=n[h];D[h]=new Rg(G,A,I)}return D}unsubscribe_(A){const I=this._bindingsIndicesByPath,g=I[A];if(g!==void 0){const C=this._paths,i=this._parsedPaths,e=this._bindings,E=e.length-1,n=e[E],a=A[E];I[a]=g,e[g]=n,e.pop(),i[g]=i[E],i.pop(),C[g]=C[E],C.pop()}}}class Id{constructor(A,I,g=null,C=I.blendMode){this._mixer=A,this._clip=I,this._localRoot=g,this.blendMode=C;const i=I.tracks,e=i.length,E=new Array(e),n={endingStart:No,endingEnd:No};for(let a=0;a!==e;++a){const r=i[a].createInterpolant(null);E[a]=r,r.settings=n}this._interpolantSettings=n,this._interpolants=E,this._propertyBindings=new Array(e),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=xU,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(A){return this._startTime=A,this}setLoop(A,I){return this.loop=A,this.repetitions=I,this}setEffectiveWeight(A){return this.weight=A,this._effectiveWeight=this.enabled?A:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(A){return this._scheduleFading(A,0,1)}fadeOut(A){return this._scheduleFading(A,1,0)}crossFadeFrom(A,I,g){if(A.fadeOut(I),this.fadeIn(I),g){const C=this._clip.duration,i=A._clip.duration,e=i/C,E=C/i;A.warp(1,e,I),this.warp(E,1,I)}return this}crossFadeTo(A,I,g){return A.crossFadeFrom(this,I,g)}stopFading(){const A=this._weightInterpolant;return A!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(A)),this}setEffectiveTimeScale(A){return this.timeScale=A,this._effectiveTimeScale=this.paused?0:A,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(A){return this.timeScale=this._clip.duration/A,this.stopWarping()}syncWith(A){return this.time=A.time,this.timeScale=A.timeScale,this.stopWarping()}halt(A){return this.warp(this._effectiveTimeScale,0,A)}warp(A,I,g){const C=this._mixer,i=C.time,e=this.timeScale;let E=this._timeScaleInterpolant;E===null&&(E=C._lendControlInterpolant(),this._timeScaleInterpolant=E);const n=E.parameterPositions,a=E.sampleValues;return n[0]=i,n[1]=i+g,a[0]=A/e,a[1]=I/e,this}stopWarping(){const A=this._timeScaleInterpolant;return A!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(A)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(A,I,g,C){if(!this.enabled){this._updateWeight(A);return}const i=this._startTime;if(i!==null){const n=(A-i)*g;n<0||g===0?I=0:(this._startTime=null,I=g*n)}I*=this._updateTimeScale(A);const e=this._updateTime(I),E=this._updateWeight(A);if(E>0){const n=this._interpolants,a=this._propertyBindings;switch(this.blendMode){case Zy:for(let r=0,D=n.length;r!==D;++r)n[r].evaluate(e),a[r].accumulateAdditive(E);break;case pc:default:for(let r=0,D=n.length;r!==D;++r)n[r].evaluate(e),a[r].accumulate(C,E)}}}_updateWeight(A){let I=0;if(this.enabled){I=this.weight;const g=this._weightInterpolant;if(g!==null){const C=g.evaluate(A)[0];I*=C,A>g.parameterPositions[1]&&(this.stopFading(),C===0&&(this.enabled=!1))}}return this._effectiveWeight=I,I}_updateTimeScale(A){let I=0;if(!this.paused){I=this.timeScale;const g=this._timeScaleInterpolant;if(g!==null){const C=g.evaluate(A)[0];I*=C,A>g.parameterPositions[1]&&(this.stopWarping(),I===0?this.paused=!0:this.timeScale=I)}}return this._effectiveTimeScale=I,I}_updateTime(A){const I=this._clip.duration,g=this.loop;let C=this.time+A,i=this._loopCount;const e=g===vU;if(A===0)return i===-1?C:e&&(i&1)===1?I-C:C;if(g===TU){i===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));A:{if(C>=I)C=I;else if(C<0)C=0;else{this.time=C;break A}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=C,this._mixer.dispatchEvent({type:"finished",action:this,direction:A<0?-1:1})}}else{if(i===-1&&(A>=0?(i=0,this._setEndings(!0,this.repetitions===0,e)):this._setEndings(this.repetitions===0,!0,e)),C>=I||C<0){const E=Math.floor(C/I);C-=I*E,i+=Math.abs(E);const n=this.repetitions-i;if(n<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,C=A>0?I:0,this.time=C,this._mixer.dispatchEvent({type:"finished",action:this,direction:A>0?1:-1});else{if(n===1){const a=A<0;this._setEndings(a,!a,e)}else this._setEndings(!1,!1,e);this._loopCount=i,this.time=C,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:E})}}else this.time=C;if(e&&(i&1)===1)return I-C}return C}_setEndings(A,I,g){const C=this._interpolantSettings;g?(C.endingStart=Jo,C.endingEnd=Jo):(A?C.endingStart=this.zeroSlopeAtStart?Jo:No:C.endingStart=Lr,I?C.endingEnd=this.zeroSlopeAtEnd?Jo:No:C.endingEnd=Lr)}_scheduleFading(A,I,g){const C=this._mixer,i=C.time;let e=this._weightInterpolant;e===null&&(e=C._lendControlInterpolant(),this._weightInterpolant=e);const E=e.parameterPositions,n=e.sampleValues;return E[0]=i,n[0]=I,E[1]=i+A,n[1]=g,this}}const Dq=new Float32Array(1);class hq extends Se{constructor(A){super(),this._root=A,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(A,I){const g=A._localRoot||this._root,C=A._clip.tracks,i=C.length,e=A._propertyBindings,E=A._interpolants,n=g.uuid,a=this._bindingsByRootAndName;let r=a[n];r===void 0&&(r={},a[n]=r);for(let D=0;D!==i;++D){const h=C[D],S=h.name;let G=r[S];if(G!==void 0)++G.referenceCount,e[D]=G;else{if(G=e[D],G!==void 0){G._cacheIndex===null&&(++G.referenceCount,this._addInactiveBinding(G,n,S));continue}const U=I&&I._propertyBindings[D].binding.parsedPath;G=new Ad(Rg.create(g,S,U),h.ValueTypeName,h.getValueSize()),++G.referenceCount,this._addInactiveBinding(G,n,S),e[D]=G}E[D].resultBuffer=G.buffer}}_activateAction(A){if(!this._isActiveAction(A)){if(A._cacheIndex===null){const g=(A._localRoot||this._root).uuid,C=A._clip.uuid,i=this._actionsByClip[C];this._bindAction(A,i&&i.knownActions[0]),this._addInactiveAction(A,C,g)}const I=A._propertyBindings;for(let g=0,C=I.length;g!==C;++g){const i=I[g];i.useCount++===0&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(A)}}_deactivateAction(A){if(this._isActiveAction(A)){const I=A._propertyBindings;for(let g=0,C=I.length;g!==C;++g){const i=I[g];--i.useCount===0&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(A)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const A=this;this.stats={actions:{get total(){return A._actions.length},get inUse(){return A._nActiveActions}},bindings:{get total(){return A._bindings.length},get inUse(){return A._nActiveBindings}},controlInterpolants:{get total(){return A._controlInterpolants.length},get inUse(){return A._nActiveControlInterpolants}}}}_isActiveAction(A){const I=A._cacheIndex;return I!==null&&I=0;--g)A[g].stop();return this}update(A){A*=this.timeScale;const I=this._actions,g=this._nActiveActions,C=this.time+=A,i=Math.sign(A),e=this._accuIndex^=1;for(let a=0;a!==g;++a)I[a]._update(C,A,i,e);const E=this._bindings,n=this._nActiveBindings;for(let a=0;a!==n;++a)E[a].apply(e);return this}setTime(A){this.time=0;for(let I=0;I=this.min.x&&A.x<=this.max.x&&A.y>=this.min.y&&A.y<=this.max.y}containsBox(A){return this.min.x<=A.min.x&&A.max.x<=this.max.x&&this.min.y<=A.min.y&&A.max.y<=this.max.y}getParameter(A,I){return I.set((A.x-this.min.x)/(this.max.x-this.min.x),(A.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(A){return A.max.x>=this.min.x&&A.min.x<=this.max.x&&A.max.y>=this.min.y&&A.min.y<=this.max.y}clampPoint(A,I){return I.copy(A).clamp(this.min,this.max)}distanceToPoint(A){return this.clampPoint(A,Z0).distanceTo(A)}intersect(A){return this.min.max(A.min),this.max.min(A.max),this.isEmpty()&&this.makeEmpty(),this}union(A){return this.min.min(A.min),this.max.max(A.max),this}translate(A){return this.min.add(A),this.max.add(A),this}equals(A){return A.min.equals(this.min)&&A.max.equals(this.max)}}const P0=new Z,Ah=new Z;class Mq{constructor(A=new Z,I=new Z){this.start=A,this.end=I}set(A,I){return this.start.copy(A),this.end.copy(I),this}copy(A){return this.start.copy(A.start),this.end.copy(A.end),this}getCenter(A){return A.addVectors(this.start,this.end).multiplyScalar(.5)}delta(A){return A.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(A,I){return this.delta(I).multiplyScalar(A).add(this.start)}closestPointToPointParameter(A,I){P0.subVectors(A,this.start),Ah.subVectors(this.end,this.start);const g=Ah.dot(Ah);let i=Ah.dot(P0)/g;return I&&(i=NC(i,0,1)),i}closestPointToPoint(A,I,g){const C=this.closestPointToPointParameter(A,I);return this.delta(g).multiplyScalar(C).add(this.start)}applyMatrix4(A){return this.start.applyMatrix4(A),this.end.applyMatrix4(A),this}equals(A){return A.start.equals(this.start)&&A.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const W0=new Z;class Uq extends Ng{constructor(A,I){super(),this.light=A,this.matrixAutoUpdate=!1,this.color=I,this.type="SpotLightHelper";const g=new tg,C=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let e=0,E=1,n=32;e