(function(cn){typeof define=="function"&&define.amd?define(cn):cn()})(function(){"use strict";var Aj=Object.defineProperty,Sj=Object.defineProperties;var Mj=Object.getOwnPropertyDescriptors;var V0=Object.getOwnPropertySymbols;var $D=Object.prototype.hasOwnProperty,eF=Object.prototype.propertyIsEnumerable;var W0=Math.pow,L1=(cn,En,mn)=>En in cn?Aj(cn,En,{enumerable:!0,configurable:!0,writable:!0,value:mn}):cn[En]=mn,ye=(cn,En)=>{for(var mn in En||(En={}))$D.call(En,mn)&&L1(cn,mn,En[mn]);if(V0)for(var mn of V0(En))eF.call(En,mn)&&L1(cn,mn,En[mn]);return cn},wt=(cn,En)=>Sj(cn,Mj(En));var Un=(cn,En)=>{var mn={};for(var nr in cn)$D.call(cn,nr)&&En.indexOf(nr)<0&&(mn[nr]=cn[nr]);if(cn!=null&&V0)for(var nr of V0(cn))En.indexOf(nr)<0&&eF.call(cn,nr)&&(mn[nr]=cn[nr]);return mn};var tF=(cn,En,mn)=>L1(cn,typeof En!="symbol"?En+"":En,mn);var du=(cn,En,mn)=>new Promise((nr,Ut)=>{var ja=$s=>{try{ff(mn.next($s))}catch(df){Ut(df)}},X0=$s=>{try{ff(mn.throw($s))}catch(df){Ut(df)}},ff=$s=>$s.done?nr($s.value):Promise.resolve($s.value).then(ja,X0);ff((mn=mn.apply(cn,En)).next())});function cn(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var En={exports:{}},mn={},nr={exports:{}},Ut={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ja=Symbol.for("react.element"),X0=Symbol.for("react.portal"),ff=Symbol.for("react.fragment"),$s=Symbol.for("react.strict_mode"),df=Symbol.for("react.profiler"),nF=Symbol.for("react.provider"),iF=Symbol.for("react.context"),rF=Symbol.for("react.forward_ref"),sF=Symbol.for("react.suspense"),oF=Symbol.for("react.memo"),aF=Symbol.for("react.lazy"),D1=Symbol.iterator;function lF(n){return n===null||typeof n!="object"?null:(n=D1&&n[D1]||n["@@iterator"],typeof n=="function"?n:null)}var F1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N1=Object.assign,U1={};function hu(n,e,t){this.props=n,this.context=e,this.refs=U1,this.updater=t||F1}hu.prototype.isReactComponent={},hu.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=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,n,e,"setState")},hu.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function O1(){}O1.prototype=hu.prototype;function j0(n,e,t){this.props=n,this.context=e,this.refs=U1,this.updater=t||F1}var J0=j0.prototype=new O1;J0.constructor=j0,N1(J0,hu.prototype),J0.isPureReactComponent=!0;var k1=Array.isArray,z1=Object.prototype.hasOwnProperty,K0={current:null},H1={key:!0,ref:!0,__self:!0,__source:!0};function G1(n,e,t){var i,r={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)z1.call(e,i)&&!H1.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(a===1)r.children=t;else if(1>>1,Ce=z[de];if(0>>1;der(Me,ne))Ier(Be,Me)?(z[de]=Be,z[Ie]=ne,de=Ie):(z[de]=Me,z[re]=ne,de=re);else if(Ier(Be,ne))z[de]=Be,z[Ie]=ne,de=Ie;else break e}}return $}function r(z,$){var ne=z.sortIndex-$.sortIndex;return ne!==0?ne:z.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],u=[],d=1,h=null,p=3,g=!1,v=!1,S=!1,_=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate!="undefined"?setImmediate:null;typeof navigator!="undefined"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function A(z){for(var $=t(u);$!==null;){if($.callback===null)i(u);else if($.startTime<=z)i(u),$.sortIndex=$.expirationTime,e(l,$);else break;$=t(u)}}function w(z){if(S=!1,A(z),!v)if(t(l)!==null)v=!0,Z(I);else{var $=t(u);$!==null&&fe(w,$.startTime-z)}}function I(z,$){v=!1,S&&(S=!1,m(N),N=-1),g=!0;var ne=p;try{for(A($),h=t(l);h!==null&&(!(h.expirationTime>$)||z&&!F());){var de=h.callback;if(typeof de=="function"){h.callback=null,p=h.priorityLevel;var Ce=de(h.expirationTime<=$);$=n.unstable_now(),typeof Ce=="function"?h.callback=Ce:h===t(l)&&i(l),A($)}else i(l);h=t(l)}if(h!==null)var ot=!0;else{var re=t(u);re!==null&&fe(w,re.startTime-$),ot=!1}return ot}finally{h=null,p=ne,g=!1}}var P=!1,D=null,N=-1,B=5,T=-1;function F(){return!(n.unstable_now()-Tz||125de?(z.sortIndex=ne,e(u,z),t(l)===null&&z===t(u)&&(S?(m(N),N=-1):S=!0,fe(w,ne-de))):(z.sortIndex=Ce,e(l,z),v||g||(v=!0,Z(I))),z},n.unstable_shouldYield=F,n.unstable_wrapCallback=function(z){var $=p;return function(){var ne=p;p=$;try{return z.apply(this,arguments)}finally{p=ne}}}})(K1),J1.exports=K1;var _F=J1.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var AF=me,Ar=_F;function Re(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;te}return!1}function Gi(n,e,t,i,r,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var gi={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){gi[n]=new Gi(n,0,!1,n,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];gi[e]=new Gi(e,1,!1,n[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(n){gi[n]=new Gi(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){gi[n]=new Gi(n,2,!1,n,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(n){gi[n]=new Gi(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(n){gi[n]=new Gi(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(function(n){gi[n]=new Gi(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(function(n){gi[n]=new Gi(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(function(n){gi[n]=new Gi(n,5,!1,n.toLowerCase(),null,!1,!1)});var $0=/[\-:]([a-z])/g;function ey(n){return n[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(n){var e=n.replace($0,ey);gi[e]=new Gi(e,1,!1,n,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace($0,ey);gi[e]=new Gi(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace($0,ey);gi[e]=new Gi(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(n){gi[n]=new Gi(n,1,!1,n.toLowerCase(),null,!1,!1)}),gi.xlinkHref=new Gi("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(n){gi[n]=new Gi(n,1,!1,n.toLowerCase(),null,!0,!0)});function ty(n,e,t,i){var r=gi.hasOwnProperty(e)?gi[e]:null;(r!==null?r.type!==0:i||!(2a||r[o]!==s[a]){var l=` `+r[o].replace(" at new "," at ");return n.displayName&&l.includes("")&&(l=l.replace("",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{uy=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?mf(n):""}function CF(n){switch(n.tag){case 5:return mf(n.type);case 16:return mf("Lazy");case 13:return mf("Suspense");case 19:return mf("SuspenseList");case 0:case 2:case 15:return n=cy(n.type,!1),n;case 11:return n=cy(n.type.render,!1),n;case 1:return n=cy(n.type,!0),n;default:return""}}function fy(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case gu:return"Fragment";case mu:return"Portal";case iy:return"Profiler";case ny:return"StrictMode";case sy:return"Suspense";case oy:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case $1:return(n.displayName||"Context")+".Consumer";case Z1:return(n._context.displayName||"Context")+".Provider";case ry:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case ay:return e=n.displayName||null,e!==null?e:fy(n.type)||"Memo";case Uo:e=n._payload,n=n._init;try{return fy(n(e))}catch(t){}}return null}function TF(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return fy(e);case 8:return e===ny?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Oo(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function nw(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function bF(n){var e=nw(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t!="undefined"&&typeof t.get=="function"&&typeof t.set=="function"){var r=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function ep(n){n._valueTracker||(n._valueTracker=bF(n))}function iw(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=nw(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function tp(n){if(n=n||(typeof document!="undefined"?document:void 0),typeof n=="undefined")return null;try{return n.activeElement||n.body}catch(e){return n.body}}function dy(n,e){var t=e.checked;return Pn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t!=null?t:n._wrapperState.initialChecked})}function rw(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=Oo(e.value!=null?e.value:t),n._wrapperState={initialChecked:i,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function sw(n,e){e=e.checked,e!=null&&ty(n,"checked",e,!1)}function hy(n,e){sw(n,e);var t=Oo(e.value),i=e.type;if(t!=null)i==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(i==="submit"||i==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?py(n,e.type,t):e.hasOwnProperty("defaultValue")&&py(n,e.type,Oo(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function ow(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function py(n,e,t){(e!=="number"||tp(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var gf=Array.isArray;function vu(n,e,t,i){if(n=n.options,e){e={};for(var r=0;r"+e.valueOf().toString()+"",e=np.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function vf(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var yf={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},RF=["Webkit","ms","Moz","O"];Object.keys(yf).forEach(function(n){RF.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),yf[e]=yf[n]})});function dw(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||yf.hasOwnProperty(n)&&yf[n]?(""+e).trim():e+"px"}function hw(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=dw(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var PF=Pn({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 vy(n,e){if(e){if(PF[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Re(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Re(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Re(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Re(62))}}function yy(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){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 xy=null;function _y(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Ay=null,yu=null,xu=null;function pw(n){if(n=zf(n)){if(typeof Ay!="function")throw Error(Re(280));var e=n.stateNode;e&&(e=Ep(e),Ay(n.stateNode,n.type,e))}}function mw(n){yu?xu?xu.push(n):xu=[n]:yu=n}function gw(){if(yu){var n=yu,e=xu;if(xu=yu=null,pw(n),e)for(n=0;n>>=0,n===0?32:31-(HF(n)/GF|0)|0}var ap=64,lp=4194304;function Sf(n){switch(n&-n){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 n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function up(n,e){var t=n.pendingLanes;if(t===0)return 0;var i=0,r=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~r;a!==0?i=Sf(a):(s&=o,s!==0&&(i=Sf(s)))}else o=t&~r,o!==0?i=Sf(o):s!==0&&(i=Sf(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0t;t++)e.push(n);return e}function Mf(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-os(e),n[e]=t}function jF(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var i=n.eventTimes;for(n=n.expirationTimes;0=If),Ww=" ",Xw=!1;function jw(n,e){switch(n){case"keyup":return _N.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jw(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Su=!1;function SN(n,e){switch(n){case"compositionend":return Jw(e);case"keypress":return e.which!==32?null:(Xw=!0,Ww);case"textInput":return n=e.data,n===Ww&&Xw?null:n;default:return null}}function MN(n,e){if(Su)return n==="compositionend"||!ky&&jw(n,e)?(n=Ow(),pp=Ly=Vo=null,Su=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:t,offset:e-n};n=i}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=eE(t)}}function nE(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?nE(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function iE(){for(var n=window,e=tp();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch(i){t=!1}if(t)n=e.contentWindow;else break;e=tp(n.document)}return e}function Gy(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function BN(n){var e=iE(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&nE(t.ownerDocument.documentElement,t)){if(i!==null&&Gy(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var r=t.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!n.extend&&s>i&&(r=i,i=s,s=r),r=tE(t,s);var o=tE(t,i);r&&o&&(n.rangeCount!==1||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),n.removeAllRanges(),s>i?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,Mu=null,Vy=null,Ff=null,Wy=!1;function rE(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;Wy||Mu==null||Mu!==tp(i)||(i=Mu,"selectionStart"in i&&Gy(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Ff&&Df(Ff,i)||(Ff=i,i=Sp(Vy,"onSelect"),0bu||(n.current=nx[bu],nx[bu]=null,bu--)}function gn(n,e){bu++,nx[bu]=n.current,n.current=e}var Jo={},wi=jo(Jo),ir=jo(!1),Qa=Jo;function Ru(n,e){var t=n.type.contextTypes;if(!t)return Jo;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in t)r[s]=e[s];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=r),r}function rr(n){return n=n.childContextTypes,n!=null}function Cp(){Sn(ir),Sn(wi)}function xE(n,e,t){if(wi.current!==Jo)throw Error(Re(168));gn(wi,e),gn(ir,t)}function _E(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(Re(108,TF(n)||"Unknown",r));return Pn({},t,i)}function Tp(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Jo,Qa=wi.current,gn(wi,n),gn(ir,ir.current),!0}function AE(n,e,t){var i=n.stateNode;if(!i)throw Error(Re(169));t?(n=_E(n,e,Qa),i.__reactInternalMemoizedMergedChildContext=n,Sn(ir),Sn(wi),gn(wi,n)):Sn(ir),gn(ir,t)}var io=null,bp=!1,ix=!1;function SE(n){io===null?io=[n]:io.push(n)}function WN(n){bp=!0,SE(n)}function Ko(){if(!ix&&io!==null){ix=!0;var n=0,e=an;try{var t=io;for(an=1;n>=o,r-=o,ro=1<<32-os(e)+r|t<N?(B=D,D=null):B=D.sibling;var T=p(m,D,A[N],w);if(T===null){D===null&&(D=B);break}n&&D&&T.alternate===null&&e(m,D),x=s(T,x,N),P===null?I=T:P.sibling=T,P=T,D=B}if(N===A.length)return t(m,D),Cn&&Za(m,N),I;if(D===null){for(;NN?(B=D,D=null):B=D.sibling;var F=p(m,D,T.value,w);if(F===null){D===null&&(D=B);break}n&&D&&F.alternate===null&&e(m,D),x=s(F,x,N),P===null?I=F:P.sibling=F,P=F,D=B}if(T.done)return t(m,D),Cn&&Za(m,N),I;if(D===null){for(;!T.done;N++,T=A.next())T=h(m,T.value,w),T!==null&&(x=s(T,x,N),P===null?I=T:P.sibling=T,P=T);return Cn&&Za(m,N),I}for(D=i(m,D);!T.done;N++,T=A.next())T=g(D,m,N,T.value,w),T!==null&&(n&&T.alternate!==null&&D.delete(T.key===null?N:T.key),x=s(T,x,N),P===null?I=T:P.sibling=T,P=T);return n&&D.forEach(function(X){return e(m,X)}),Cn&&Za(m,N),I}function _(m,x,A,w){if(typeof A=="object"&&A!==null&&A.type===gu&&A.key===null&&(A=A.props.children),typeof A=="object"&&A!==null){switch(A.$$typeof){case $h:e:{for(var I=A.key,P=x;P!==null;){if(P.key===I){if(I=A.type,I===gu){if(P.tag===7){t(m,P.sibling),x=r(P,A.props.children),x.return=m,m=x;break e}}else if(P.elementType===I||typeof I=="object"&&I!==null&&I.$$typeof===Uo&&bE(I)===P.type){t(m,P.sibling),x=r(P,A.props),x.ref=Hf(m,P,A),x.return=m,m=x;break e}t(m,P);break}else e(m,P);P=P.sibling}A.type===gu?(x=ol(A.props.children,m.mode,w,A.key),x.return=m,m=x):(w=nm(A.type,A.key,A.props,null,m.mode,w),w.ref=Hf(m,x,A),w.return=m,m=w)}return o(m);case mu:e:{for(P=A.key;x!==null;){if(x.key===P)if(x.tag===4&&x.stateNode.containerInfo===A.containerInfo&&x.stateNode.implementation===A.implementation){t(m,x.sibling),x=r(x,A.children||[]),x.return=m,m=x;break e}else{t(m,x);break}else e(m,x);x=x.sibling}x=e_(A,m.mode,w),x.return=m,m=x}return o(m);case Uo:return P=A._init,_(m,x,P(A._payload),w)}if(gf(A))return v(m,x,A,w);if(pf(A))return S(m,x,A,w);Bp(m,A)}return typeof A=="string"&&A!==""||typeof A=="number"?(A=""+A,x!==null&&x.tag===6?(t(m,x.sibling),x=r(x,A),x.return=m,m=x):(t(m,x),x=$x(A,m.mode,w),x.return=m,m=x),o(m)):t(m,x)}return _}var Lu=RE(!0),PE=RE(!1),Lp=jo(null),Dp=null,Du=null,ux=null;function cx(){ux=Du=Dp=null}function fx(n){var e=Lp.current;Sn(Lp),n._currentValue=e}function dx(n,e,t){for(;n!==null;){var i=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),n===t)break;n=n.return}}function Fu(n,e){Dp=n,ux=Du=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(sr=!0),n.firstContext=null)}function Hr(n){var e=n._currentValue;if(ux!==n)if(n={context:n,memoizedValue:e,next:null},Du===null){if(Dp===null)throw Error(Re(308));Du=n,Dp.dependencies={lanes:0,firstContext:n}}else Du=Du.next=n;return e}var $a=null;function hx(n){$a===null?$a=[n]:$a.push(n)}function IE(n,e,t,i){var r=e.interleaved;return r===null?(t.next=t,hx(e)):(t.next=r.next,r.next=t),e.interleaved=t,oo(n,i)}function oo(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var Yo=!1;function px(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function BE(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function ao(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function Qo(n,e,t){var i=n.updateQueue;if(i===null)return null;if(i=i.shared,Zt&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,oo(n,t)}return r=i.interleaved,r===null?(e.next=e,hx(i)):(e.next=r.next,r.next=e),i.interleaved=e,oo(n,t)}function Fp(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,by(n,t)}}function LE(n,e){var t=n.updateQueue,i=n.alternate;if(i!==null&&(i=i.updateQueue,t===i)){var r=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?r=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?r=s=e:s=s.next=e}else r=s=e;t={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function Np(n,e,t,i){var r=n.updateQueue;Yo=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?s=u:o.next=u,o=l;var d=n.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=l))}if(s!==null){var h=r.baseState;o=0,d=u=l=null,a=s;do{var p=a.lane,g=a.eventTime;if((i&p)===p){d!==null&&(d=d.next={eventTime:g,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var v=n,S=a;switch(p=e,g=t,S.tag){case 1:if(v=S.payload,typeof v=="function"){h=v.call(g,h,p);break e}h=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=S.payload,p=typeof v=="function"?v.call(g,h,p):v,p==null)break e;h=Pn({},h,p);break e;case 2:Yo=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,p=r.effects,p===null?r.effects=[a]:p.push(a))}else g={eventTime:g,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=g,l=h):d=d.next=g,o|=p;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;p=a,a=p.next,p.next=null,r.lastBaseUpdate=p,r.shared.pending=null}}while(!0);if(d===null&&(l=h),r.baseState=l,r.firstBaseUpdate=u,r.lastBaseUpdate=d,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);nl|=o,n.lanes=o,n.memoizedState=h}}function DE(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;et?t:4,n(!0);var i=xx.transition;xx.transition={};try{n(!1),e()}finally{an=t,xx.transition=i}}function $E(){return Gr().memoizedState}function KN(n,e,t){var i=ea(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},eC(n))tC(e,t);else if(t=IE(n,e,t,i),t!==null){var r=Wi();ds(t,n,i,r),nC(t,e,i)}}function YN(n,e,t){var i=ea(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(eC(n))tC(e,r);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(r.hasEagerState=!0,r.eagerState=a,as(a,o)){var l=e.interleaved;l===null?(r.next=r,hx(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch(u){}finally{}t=IE(n,e,r,i),t!==null&&(r=Wi(),ds(t,n,i,r),nC(t,e,i))}}function eC(n){var e=n.alternate;return n===Bn||e!==null&&e===Bn}function tC(n,e){Xf=kp=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function nC(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,by(n,t)}}var Gp={readContext:Hr,useCallback:Ei,useContext:Ei,useEffect:Ei,useImperativeHandle:Ei,useInsertionEffect:Ei,useLayoutEffect:Ei,useMemo:Ei,useReducer:Ei,useRef:Ei,useState:Ei,useDebugValue:Ei,useDeferredValue:Ei,useTransition:Ei,useMutableSource:Ei,useSyncExternalStore:Ei,useId:Ei,unstable_isNewReconciler:!1},QN={readContext:Hr,useCallback:function(n,e){return Ds().memoizedState=[n,e===void 0?null:e],n},useContext:Hr,useEffect:XE,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,zp(4194308,4,KE.bind(null,e,n),t)},useLayoutEffect:function(n,e){return zp(4194308,4,n,e)},useInsertionEffect:function(n,e){return zp(4,2,n,e)},useMemo:function(n,e){var t=Ds();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=Ds();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=KN.bind(null,Bn,n),[i.memoizedState,n]},useRef:function(n){var e=Ds();return n={current:n},e.memoizedState=n},useState:VE,useDebugValue:Cx,useDeferredValue:function(n){return Ds().memoizedState=n},useTransition:function(){var n=VE(!1),e=n[0];return n=JN.bind(null,n[1]),Ds().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=Bn,r=Ds();if(Cn){if(t===void 0)throw Error(Re(407));t=t()}else{if(t=e(),hi===null)throw Error(Re(349));tl&30||OE(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,XE(zE.bind(null,i,s,n),[n]),i.flags|=2048,Kf(9,kE.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=Ds(),e=hi.identifierPrefix;if(Cn){var t=so,i=ro;t=(i&~(1<<32-os(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=jf++,0<\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=o.createElement(t,{is:i.is}):(n=o.createElement(t),t==="select"&&(o=n,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):n=o.createElementNS(n,t),n[Bs]=e,n[kf]=i,SC(n,e,!1,!1),e.stateNode=n;e:{switch(o=yy(t,i),t){case"dialog":An("cancel",n),An("close",n),r=i;break;case"iframe":case"object":case"embed":An("load",n),r=i;break;case"video":case"audio":for(r=0;rzu&&(e.flags|=128,i=!0,Yf(s,!1),e.lanes=4194304)}else{if(!i)if(n=Up(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Yf(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Cn)return Ci(e),null}else 2*Xn()-s.renderingStartTime>zu&&t!==1073741824&&(e.flags|=128,i=!0,Yf(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Xn(),e.sibling=null,t=In.current,gn(In,i?t&1|2:t&1),e):(Ci(e),null);case 22:case 23:return Qx(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?Er&1073741824&&(Ci(e),e.subtreeFlags&6&&(e.flags|=8192)):Ci(e),null;case 24:return null;case 25:return null}throw Error(Re(156,e.tag))}function r3(n,e){switch(sx(e),e.tag){case 1:return rr(e.type)&&Cp(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Nu(),Sn(ir),Sn(wi),yx(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return gx(e),null;case 13:if(Sn(In),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Re(340));Bu()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return Sn(In),null;case 4:return Nu(),null;case 10:return fx(e.type._context),null;case 22:case 23:return Qx(),null;case 24:return null;default:return null}}var jp=!1,Ti=!1,s3=typeof WeakSet=="function"?WeakSet:Set,tt=null;function Ou(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){On(n,e,i)}else t.current=null}function Ox(n,e,t){try{t()}catch(i){On(n,e,i)}}var EC=!1;function o3(n,e){if(Qy=dp,n=iE(),Gy(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{t.nodeType,s.nodeType}catch(w){t=null;break e}var o=0,a=-1,l=-1,u=0,d=0,h=n,p=null;t:for(;;){for(var g;h!==t||r!==0&&h.nodeType!==3||(a=o+r),h!==s||i!==0&&h.nodeType!==3||(l=o+i),h.nodeType===3&&(o+=h.nodeValue.length),(g=h.firstChild)!==null;)p=h,h=g;for(;;){if(h===n)break t;if(p===t&&++u===r&&(a=o),p===s&&++d===i&&(l=o),(g=h.nextSibling)!==null)break;h=p,p=h.parentNode}h=g}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(qy={focusedElem:n,selectionRange:t},dp=!1,tt=e;tt!==null;)if(e=tt,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,tt=n;else for(;tt!==null;){e=tt;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var S=v.memoizedProps,_=v.memoizedState,m=e.stateNode,x=m.getSnapshotBeforeUpdate(e.elementType===e.type?S:us(e.type,S),_);m.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var A=e.stateNode.containerInfo;A.nodeType===1?A.textContent="":A.nodeType===9&&A.documentElement&&A.removeChild(A.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Re(163))}}catch(w){On(e,e.return,w)}if(n=e.sibling,n!==null){n.return=e.return,tt=n;break}tt=e.return}return v=EC,EC=!1,v}function Qf(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&n)===n){var s=r.destroy;r.destroy=void 0,s!==void 0&&Ox(e,t,s)}r=r.next}while(r!==i)}}function Jp(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function kx(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function CC(n){var e=n.alternate;e!==null&&(n.alternate=null,CC(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Bs],delete e[kf],delete e[tx],delete e[GN],delete e[VN])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function TC(n){return n.tag===5||n.tag===3||n.tag===4}function bC(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||TC(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function zx(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=wp));else if(i!==4&&(n=n.child,n!==null))for(zx(n,e,t),n=n.sibling;n!==null;)zx(n,e,t),n=n.sibling}function Hx(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(Hx(n,e,t),n=n.sibling;n!==null;)Hx(n,e,t),n=n.sibling}var vi=null,cs=!1;function qo(n,e,t){for(t=t.child;t!==null;)RC(n,e,t),t=t.sibling}function RC(n,e,t){if(Is&&typeof Is.onCommitFiberUnmount=="function")try{Is.onCommitFiberUnmount(op,t)}catch(a){}switch(t.tag){case 5:Ti||Ou(t,e);case 6:var i=vi,r=cs;vi=null,qo(n,e,t),vi=i,cs=r,vi!==null&&(cs?(n=vi,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):vi.removeChild(t.stateNode));break;case 18:vi!==null&&(cs?(n=vi,t=t.stateNode,n.nodeType===8?ex(n.parentNode,t):n.nodeType===1&&ex(n,t),bf(n)):ex(vi,t.stateNode));break;case 4:i=vi,r=cs,vi=t.stateNode.containerInfo,cs=!0,qo(n,e,t),vi=i,cs=r;break;case 0:case 11:case 14:case 15:if(!Ti&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Ox(t,e,o),r=r.next}while(r!==i)}qo(n,e,t);break;case 1:if(!Ti&&(Ou(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){On(t,e,a)}qo(n,e,t);break;case 21:qo(n,e,t);break;case 22:t.mode&1?(Ti=(i=Ti)||t.memoizedState!==null,qo(n,e,t),Ti=i):qo(n,e,t);break;default:qo(n,e,t)}}function PC(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new s3),e.forEach(function(i){var r=m3.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function fs(n,e){var t=e.deletions;if(t!==null)for(var i=0;ir&&(r=o),i&=~s}if(i=r,i=Xn()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*l3(i/1960))-i,10n?16:n,$o===null)var i=!1;else{if(n=$o,$o=null,Zp=0,Zt&6)throw Error(Re(331));var r=Zt;for(Zt|=4,tt=n.current;tt!==null;){var s=tt,o=s.child;if(tt.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lXn()-Wx?rl(n,0):Vx|=t),ar(n,e)}function VC(n,e){e===0&&(n.mode&1?(e=lp,lp<<=1,!(lp&130023424)&&(lp=4194304)):e=1);var t=Wi();n=oo(n,e),n!==null&&(Mf(n,e,t),ar(n,t))}function p3(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),VC(n,t)}function m3(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,r=n.memoizedState;r!==null&&(t=r.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(Re(314))}i!==null&&i.delete(e),VC(n,t)}var WC;WC=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||ir.current)sr=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return sr=!1,n3(n,e,t);sr=!!(n.flags&131072)}else sr=!1,Cn&&e.flags&1048576&&ME(e,Pp,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;Xp(n,e),n=e.pendingProps;var r=Ru(e,wi.current);Fu(e,t),r=Ax(null,e,i,n,r,t);var s=Sx();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,rr(i)?(s=!0,Tp(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,px(e),r.updater=Vp,e.stateNode=r,r._reactInternals=e,bx(e,i,n,t),e=Bx(null,e,i,!0,s,t)):(e.tag=0,Cn&&s&&rx(e),Vi(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(Xp(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=v3(i),n=us(i,n),r){case 0:e=Ix(null,e,i,n,t);break e;case 1:e=gC(null,e,i,n,t);break e;case 11:e=fC(null,e,i,n,t);break e;case 14:e=dC(null,e,i,us(i.type,n),t);break e}throw Error(Re(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:us(i,r),Ix(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:us(i,r),gC(n,e,i,r,t);case 3:e:{if(vC(e),n===null)throw Error(Re(387));i=e.pendingProps,s=e.memoizedState,r=s.element,BE(n,e),Np(e,i,null,t);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=Uu(Error(Re(423)),e),e=yC(n,e,i,t,r);break e}else if(i!==r){r=Uu(Error(Re(424)),e),e=yC(n,e,i,t,r);break e}else for(wr=Xo(e.stateNode.containerInfo.firstChild),Mr=e,Cn=!0,ls=null,t=PE(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Bu(),i===r){e=lo(n,e,t);break e}Vi(n,e,i,t)}e=e.child}return e;case 5:return FE(e),n===null&&ax(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,o=r.children,Zy(i,r)?o=null:s!==null&&Zy(i,s)&&(e.flags|=32),mC(n,e),Vi(n,e,o,t),e.child;case 6:return n===null&&ax(e),null;case 13:return xC(n,e,t);case 4:return mx(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=Lu(e,null,i,t):Vi(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:us(i,r),fC(n,e,i,r,t);case 7:return Vi(n,e,e.pendingProps,t),e.child;case 8:return Vi(n,e,e.pendingProps.children,t),e.child;case 12:return Vi(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,gn(Lp,i._currentValue),i._currentValue=o,s!==null)if(as(s.value,o)){if(s.children===r.children&&!ir.current){e=lo(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===i){if(s.tag===1){l=ao(-1,t&-t),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),dx(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Re(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),dx(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Vi(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,Fu(e,t),r=Hr(r),i=i(r),e.flags|=1,Vi(n,e,i,t),e.child;case 14:return i=e.type,r=us(i,e.pendingProps),r=us(i.type,r),dC(n,e,i,r,t);case 15:return hC(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:us(i,r),Xp(n,e),e.tag=1,rr(i)?(n=!0,Tp(e)):n=!1,Fu(e,t),rC(e,i,r),bx(e,i,r,t),Bx(null,e,i,!0,n,t);case 19:return AC(n,e,t);case 22:return pC(n,e,t)}throw Error(Re(156,e.tag))};function XC(n,e){return ww(n,e)}function g3(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Wr(n,e,t,i){return new g3(n,e,t,i)}function Zx(n){return n=n.prototype,!(!n||!n.isReactComponent)}function v3(n){if(typeof n=="function")return Zx(n)?1:0;if(n!=null){if(n=n.$$typeof,n===ry)return 11;if(n===ay)return 14}return 2}function na(n,e){var t=n.alternate;return t===null?(t=Wr(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function nm(n,e,t,i,r,s){var o=2;if(i=n,typeof n=="function")Zx(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case gu:return ol(t.children,r,s,e);case ny:o=8,r|=8;break;case iy:return n=Wr(12,t,e,r|2),n.elementType=iy,n.lanes=s,n;case sy:return n=Wr(13,t,e,r),n.elementType=sy,n.lanes=s,n;case oy:return n=Wr(19,t,e,r),n.elementType=oy,n.lanes=s,n;case ew:return im(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case Z1:o=10;break e;case $1:o=9;break e;case ry:o=11;break e;case ay:o=14;break e;case Uo:o=16,i=null;break e}throw Error(Re(130,n==null?n:typeof n,""))}return e=Wr(o,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function ol(n,e,t,i){return n=Wr(7,n,i,e),n.lanes=t,n}function im(n,e,t,i){return n=Wr(22,n,i,e),n.elementType=ew,n.lanes=t,n.stateNode={isHidden:!1},n}function $x(n,e,t){return n=Wr(6,n,null,e),n.lanes=t,n}function e_(n,e,t){return e=Wr(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function y3(n,e,t,i,r){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ty(0),this.expirationTimes=Ty(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ty(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function t_(n,e,t,i,r,s,o,a,l){return n=new y3(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Wr(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},px(s),n}function x3(n,e,t){var i=3n(...i);return new Proxy(t,{get:(i,r)=>r==="create"?n:(e.has(r)||e.set(r,n(r)),e.get(r))})}function cm(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}const s_=n=>Array.isArray(n);function $C(n,e){if(!Array.isArray(e))return!1;const t=e.length;if(t!==n.length)return!1;for(let i=0;i{e[0][i]=t.get(),e[1][i]=t.getVelocity()}),e}function o_(n,e,t,i){if(typeof e=="function"){const[r,s]=eT(i);e=e(t!==void 0?t:n.custom,r,s)}if(typeof e=="string"&&(e=n.variants&&n.variants[e]),typeof e=="function"){const[r,s]=eT(i);e=e(t!==void 0?t:n.custom,r,s)}return e}function fm(n,e,t){const i=n.getProps();return o_(i,e,t!==void 0?t:i.custom,n)}const a_=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],l_=["initial",...a_],nd=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],al=new Set(nd),co=n=>n*1e3,fo=n=>n/1e3,C3={type:"spring",stiffness:500,damping:25,restSpeed:10},T3=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),b3={type:"keyframes",duration:.8},R3={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},P3=(n,{keyframes:e})=>e.length>2?b3:al.has(n)?n.startsWith("scale")?T3(e[1]):C3:R3;function u_(n,e){return n?n[e]||n.default||n:void 0}const I3={skipAnimations:!1,useManualTiming:!1},B3=n=>n!==null;function dm(n,{repeat:e,repeatType:t="loop"},i){const r=n.filter(B3),s=e&&t!=="loop"&&e%2===1?0:r.length-1;return!s||i===void 0?r[s]:i}const xi=n=>n;function L3(n){let e=new Set,t=new Set,i=!1,r=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(u){s.has(u)&&(l.schedule(u),n()),u(o)}const l={schedule:(u,d=!1,h=!1)=>{const g=h&&i?e:t;return d&&s.add(u),g.has(u)||g.add(u),u},cancel:u=>{t.delete(u),s.delete(u)},process:u=>{if(o=u,i){r=!0;return}i=!0,[e,t]=[t,e],t.clear(),e.forEach(a),i=!1,r&&(r=!1,l.process(u))}};return l}const hm=["read","resolveKeyframes","update","preRender","render","postRender"],D3=40;function tT(n,e){let t=!1,i=!0;const r={delta:0,timestamp:0,isProcessing:!1},s=()=>t=!0,o=hm.reduce((m,x)=>(m[x]=L3(s),m),{}),{read:a,resolveKeyframes:l,update:u,preRender:d,render:h,postRender:p}=o,g=()=>{const m=performance.now();t=!1,r.delta=i?1e3/60:Math.max(Math.min(m-r.timestamp,D3),1),r.timestamp=m,r.isProcessing=!0,a.process(r),l.process(r),u.process(r),d.process(r),h.process(r),p.process(r),r.isProcessing=!1,t&&e&&(i=!1,n(g))},v=()=>{t=!0,i=!0,r.isProcessing||n(g)};return{schedule:hm.reduce((m,x)=>{const A=o[x];return m[x]=(w,I=!1,P=!1)=>(t||v(),A.schedule(w,I,P)),m},{}),cancel:m=>{for(let x=0;x(((1-3*t+3*e)*n+(3*t-6*e))*n+3*e)*n,F3=1e-7,N3=12;function U3(n,e,t,i,r){let s,o,a=0;do o=e+(t-e)/2,s=nT(o,i,r)-n,s>0?t=o:e=o;while(Math.abs(s)>F3&&++aU3(s,0,1,n,t);return s=>s===0||s===1?s:nT(r(s),e,i)}const iT=n=>e=>e<=.5?n(2*e)/2:(2-n(2*(1-e)))/2,rT=n=>e=>1-n(1-e),sT=id(.33,1.53,.69,.99),f_=rT(sT),oT=iT(f_),aT=n=>(n*=2)<1?.5*f_(n):.5*(2-Math.pow(2,-10*(n-1))),d_=n=>1-Math.sin(Math.acos(n)),lT=rT(d_),uT=iT(d_),cT=n=>/^0[^.\s]+$/u.test(n);function O3(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||cT(n):!0}let k3=xi,h_=xi;const fT=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n),dT=n=>e=>typeof e=="string"&&e.startsWith(n),hT=dT("--"),z3=dT("var(--"),p_=n=>z3(n)?H3.test(n.split("/*")[0].trim()):!1,H3=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,G3=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function V3(n){const e=G3.exec(n);if(!e)return[,];const[,t,i,r]=e;return[`--${t!=null?t:i}`,r]}function pT(n,e,t=1){const[i,r]=V3(n);if(!i)return;const s=window.getComputedStyle(e).getPropertyValue(i);if(s){const o=s.trim();return fT(o)?parseFloat(o):o}return p_(r)?pT(r,e,t+1):r}const ia=(n,e,t)=>t>e?e:ttypeof n=="number",parse:parseFloat,transform:n=>n},rd=wt(ye({},Gu),{transform:n=>ia(0,1,n)}),pm=wt(ye({},Gu),{default:1}),sd=n=>({test:e=>typeof e=="string"&&e.endsWith(n)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${n}`}),ra=sd("deg"),Ns=sd("%"),St=sd("px"),W3=sd("vh"),X3=sd("vw"),mT=wt(ye({},Ns),{parse:n=>Ns.parse(n)/100,transform:n=>Ns.transform(n*100)}),j3=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),gT=n=>n===Gu||n===St,vT=(n,e)=>parseFloat(n.split(", ")[e]),yT=(n,e)=>(t,{transform:i})=>{if(i==="none"||!i)return 0;const r=i.match(/^matrix3d\((.+)\)$/u);if(r)return vT(r[1],e);{const s=i.match(/^matrix\((.+)\)$/u);return s?vT(s[1],n):0}},J3=new Set(["x","y","z"]),K3=nd.filter(n=>!J3.has(n));function Y3(n){const e=[];return K3.forEach(t=>{const i=n.getValue(t);i!==void 0&&(e.push([t,i.get()]),i.set(t.startsWith("scale")?1:0))}),e}const Vu={width:({x:n},{paddingLeft:e="0",paddingRight:t="0"})=>n.max-n.min-parseFloat(e)-parseFloat(t),height:({y:n},{paddingTop:e="0",paddingBottom:t="0"})=>n.max-n.min-parseFloat(e)-parseFloat(t),top:(n,{top:e})=>parseFloat(e),left:(n,{left:e})=>parseFloat(e),bottom:({y:n},{top:e})=>parseFloat(e)+(n.max-n.min),right:({x:n},{left:e})=>parseFloat(e)+(n.max-n.min),x:yT(4,13),y:yT(5,14)};Vu.translateX=Vu.x,Vu.translateY=Vu.y;const xT=n=>e=>e.test(n),_T=[Gu,St,Ns,ra,X3,W3,{test:n=>n==="auto",parse:n=>n}],AT=n=>_T.find(xT(n)),ll=new Set;let m_=!1,g_=!1;function ST(){if(g_){const n=Array.from(ll).filter(i=>i.needsMeasurement),e=new Set(n.map(i=>i.element)),t=new Map;e.forEach(i=>{const r=Y3(i);r.length&&(t.set(i,r),i.render())}),n.forEach(i=>i.measureInitialState()),e.forEach(i=>{i.render();const r=t.get(i);r&&r.forEach(([s,o])=>{var a;(a=i.getValue(s))===null||a===void 0||a.set(o)})}),n.forEach(i=>i.measureEndState()),n.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}g_=!1,m_=!1,ll.forEach(n=>n.complete()),ll.clear()}function MT(){ll.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(g_=!0)})}function Q3(){MT(),ST()}class v_{constructor(e,t,i,r,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=i,this.motionValue=r,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(ll.add(this),m_||(m_=!0,Xt.read(MT),Xt.resolveKeyframes(ST))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:i,motionValue:r}=this;for(let s=0;sMath.round(n*1e5)/1e5,y_=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function q3(n){return n==null}const Z3=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,x_=(n,e)=>t=>!!(typeof t=="string"&&Z3.test(t)&&t.startsWith(n)||e&&!q3(t)&&Object.prototype.hasOwnProperty.call(t,e)),wT=(n,e,t)=>i=>{if(typeof i!="string")return i;const[r,s,o,a]=i.match(y_);return{[n]:parseFloat(r),[e]:parseFloat(s),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},$3=n=>ia(0,255,n),__=wt(ye({},Gu),{transform:n=>Math.round($3(n))}),ul={test:x_("rgb","red"),parse:wT("red","green","blue"),transform:({red:n,green:e,blue:t,alpha:i=1})=>"rgba("+__.transform(n)+", "+__.transform(e)+", "+__.transform(t)+", "+od(rd.transform(i))+")"};function eU(n){let e="",t="",i="",r="";return n.length>5?(e=n.substring(1,3),t=n.substring(3,5),i=n.substring(5,7),r=n.substring(7,9)):(e=n.substring(1,2),t=n.substring(2,3),i=n.substring(3,4),r=n.substring(4,5),e+=e,t+=t,i+=i,r+=r),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const A_={test:x_("#"),parse:eU,transform:ul.transform},Wu={test:x_("hsl","hue"),parse:wT("hue","saturation","lightness"),transform:({hue:n,saturation:e,lightness:t,alpha:i=1})=>"hsla("+Math.round(n)+", "+Ns.transform(od(e))+", "+Ns.transform(od(t))+", "+od(rd.transform(i))+")"},bi={test:n=>ul.test(n)||A_.test(n)||Wu.test(n),parse:n=>ul.test(n)?ul.parse(n):Wu.test(n)?Wu.parse(n):A_.parse(n),transform:n=>typeof n=="string"?n:n.hasOwnProperty("red")?ul.transform(n):Wu.transform(n)},tU=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function nU(n){var e,t;return isNaN(n)&&typeof n=="string"&&(((e=n.match(y_))===null||e===void 0?void 0:e.length)||0)+(((t=n.match(tU))===null||t===void 0?void 0:t.length)||0)>0}const ET="number",CT="color",iU="var",rU="var(",TT="${}",sU=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ad(n){const e=n.toString(),t=[],i={color:[],number:[],var:[]},r=[];let s=0;const a=e.replace(sU,l=>(bi.test(l)?(i.color.push(s),r.push(CT),t.push(bi.parse(l))):l.startsWith(rU)?(i.var.push(s),r.push(iU),t.push(l)):(i.number.push(s),r.push(ET),t.push(parseFloat(l))),++s,TT)).split(TT);return{values:t,split:a,indexes:i,types:r}}function bT(n){return ad(n).values}function RT(n){const{split:e,types:t}=ad(n),i=e.length;return r=>{let s="";for(let o=0;otypeof n=="number"?0:n;function aU(n){const e=bT(n);return RT(n)(e.map(oU))}const sa={test:nU,parse:bT,createTransformer:RT,getAnimatableNone:aU},lU=new Set(["brightness","contrast","saturate","opacity"]);function uU(n){const[e,t]=n.slice(0,-1).split("(");if(e==="drop-shadow")return n;const[i]=t.match(y_)||[];if(!i)return n;const r=t.replace(i,"");let s=lU.has(e)?1:0;return i!==t&&(s*=100),e+"("+s+r+")"}const cU=/\b([a-z-]*)\(.*?\)/gu,S_=wt(ye({},sa),{getAnimatableNone:n=>{const e=n.match(cU);return e?e.map(uU).join(" "):n}}),fU={borderWidth:St,borderTopWidth:St,borderRightWidth:St,borderBottomWidth:St,borderLeftWidth:St,borderRadius:St,radius:St,borderTopLeftRadius:St,borderTopRightRadius:St,borderBottomRightRadius:St,borderBottomLeftRadius:St,width:St,maxWidth:St,height:St,maxHeight:St,top:St,right:St,bottom:St,left:St,padding:St,paddingTop:St,paddingRight:St,paddingBottom:St,paddingLeft:St,margin:St,marginTop:St,marginRight:St,marginBottom:St,marginLeft:St,backgroundPositionX:St,backgroundPositionY:St},dU={rotate:ra,rotateX:ra,rotateY:ra,rotateZ:ra,scale:pm,scaleX:pm,scaleY:pm,scaleZ:pm,skew:ra,skewX:ra,skewY:ra,distance:St,translateX:St,translateY:St,translateZ:St,x:St,y:St,z:St,perspective:St,transformPerspective:St,opacity:rd,originX:mT,originY:mT,originZ:St},PT=wt(ye({},Gu),{transform:Math.round}),M_=wt(ye(ye({},fU),dU),{zIndex:PT,size:St,fillOpacity:rd,strokeOpacity:rd,numOctaves:PT}),hU=wt(ye({},M_),{color:bi,backgroundColor:bi,outlineColor:bi,fill:bi,stroke:bi,borderColor:bi,borderTopColor:bi,borderRightColor:bi,borderBottomColor:bi,borderLeftColor:bi,filter:S_,WebkitFilter:S_}),w_=n=>hU[n];function IT(n,e){let t=w_(n);return t!==S_&&(t=sa),t.getAnimatableNone?t.getAnimatableNone(e):void 0}const pU=new Set(["auto","none","0"]);function mU(n,e,t){let i=0,r;for(;i{t.getValue(l).set(u)}),this.resolveNoneKeyframes()}}function E_(n){return typeof n=="function"}let mm;function gU(){mm=void 0}const Us={now:()=>(mm===void 0&&Us.set(si.isProcessing||I3.useManualTiming?si.timestamp:performance.now()),mm),set:n=>{mm=n,queueMicrotask(gU)}},LT=(n,e)=>e==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(sa.test(n)||n==="0")&&!n.startsWith("url("));function vU(n){const e=n[0];if(n.length===1)return!0;for(let t=0;txU?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&Q3(),this._resolved}onKeyframesResolved(e,t){this.resolvedAt=Us.now(),this.hasAttemptedResolve=!0;const{name:i,type:r,velocity:s,delay:o,onComplete:a,onUpdate:l,isGenerator:u}=this.options;if(!u&&!yU(e,i,r,s))if(o)this.options.duration=0;else{l==null||l(dm(e,this.options,t)),a==null||a(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,t);d!==!1&&(this._resolved=ye({keyframes:e,finalKeyframe:t},d),this.onPostResolved())}onPostResolved(){}then(e,t){return this.currentFinishedPromise.then(e,t)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function C_(n,e){return e?n*(1e3/e):0}const _U=5;function FT(n,e,t){const i=Math.max(e-_U,0);return C_(t-n(i),e-i)}const T_=.001,AU=.01,SU=10,MU=.05,wU=1;function EU({duration:n=800,bounce:e=.25,velocity:t=0,mass:i=1}){let r,s,o=1-e;o=ia(MU,wU,o),n=ia(AU,SU,fo(n)),o<1?(r=u=>{const d=u*o,h=d*n,p=d-t,g=b_(u,o),v=Math.exp(-h);return T_-p/g*v},s=u=>{const h=u*o*n,p=h*t+t,g=Math.pow(o,2)*Math.pow(u,2)*n,v=Math.exp(-h),S=b_(Math.pow(u,2),o);return(-r(u)+T_>0?-1:1)*((p-g)*v)/S}):(r=u=>{const d=Math.exp(-u*n),h=(u-t)*n+1;return-T_+d*h},s=u=>{const d=Math.exp(-u*n),h=(t-u)*(n*n);return d*h});const a=5/n,l=TU(r,s,a);if(n=co(n),isNaN(l))return{stiffness:100,damping:10,duration:n};{const u=Math.pow(l,2)*i;return{stiffness:u,damping:o*2*Math.sqrt(i*u),duration:n}}}const CU=12;function TU(n,e,t){let i=t;for(let r=1;rn[t]!==void 0)}function PU(n){let e=ye({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},n);if(!NT(n,RU)&&NT(n,bU)){const t=EU(n);e=wt(ye(ye({},e),t),{mass:1}),e.isResolvedFromDuration=!0}return e}function UT(r){var s=r,{keyframes:n,restDelta:e,restSpeed:t}=s,i=Un(s,["keyframes","restDelta","restSpeed"]);const o=n[0],a=n[n.length-1],l={done:!1,value:o},{stiffness:u,damping:d,mass:h,duration:p,velocity:g,isResolvedFromDuration:v}=PU(wt(ye({},i),{velocity:-fo(i.velocity||0)})),S=g||0,_=d/(2*Math.sqrt(u*h)),m=a-o,x=fo(Math.sqrt(u/h)),A=Math.abs(m)<5;t||(t=A?.01:2),e||(e=A?.005:.5);let w;if(_<1){const I=b_(x,_);w=P=>{const D=Math.exp(-_*x*P);return a-D*((S+_*x*m)/I*Math.sin(I*P)+m*Math.cos(I*P))}}else if(_===1)w=I=>a-Math.exp(-x*I)*(m+(S+x*m)*I);else{const I=x*Math.sqrt(_*_-1);w=P=>{const D=Math.exp(-_*x*P),N=Math.min(I*P,300);return a-D*((S+_*x*m)*Math.sinh(N)+I*m*Math.cosh(N))/I}}return{calculatedDuration:v&&p||null,next:I=>{const P=w(I);if(v)l.done=I>=p;else{let D=0;_<1&&(D=I===0?co(S):FT(w,I,P));const N=Math.abs(D)<=t,B=Math.abs(a-P)<=e;l.done=N&&B}return l.value=l.done?a:P,l}}}function OT({keyframes:n,velocity:e=0,power:t=.8,timeConstant:i=325,bounceDamping:r=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:l,restDelta:u=.5,restSpeed:d}){const h=n[0],p={done:!1,value:h},g=N=>a!==void 0&&Nl,v=N=>a===void 0?l:l===void 0||Math.abs(a-N)-S*Math.exp(-N/i),A=N=>m+x(N),w=N=>{const B=x(N),T=A(N);p.done=Math.abs(B)<=u,p.value=p.done?m:T};let I,P;const D=N=>{g(p.value)&&(I=N,P=UT({keyframes:[p.value,v(p.value)],velocity:FT(A,N,p.value),damping:r,stiffness:s,restDelta:u,restSpeed:d}))};return D(0),{calculatedDuration:null,next:N=>{let B=!1;return!P&&I===void 0&&(B=!0,w(N),D(N)),I!==void 0&&N>=I?P.next(N-I):(!B&&w(N),p)}}}const IU=id(.42,0,1,1),BU=id(0,0,.58,1),kT=id(.42,0,.58,1),LU=n=>Array.isArray(n)&&typeof n[0]!="number",R_=n=>Array.isArray(n)&&typeof n[0]=="number",zT={linear:xi,easeIn:IU,easeInOut:kT,easeOut:BU,circIn:d_,circInOut:uT,circOut:lT,backIn:f_,backInOut:oT,backOut:sT,anticipate:aT},HT=n=>{if(R_(n)){h_(n.length===4);const[e,t,i,r]=n;return id(e,t,i,r)}else if(typeof n=="string")return h_(zT[n]!==void 0),zT[n];return n},DU=(n,e)=>t=>e(n(t)),Os=(...n)=>n.reduce(DU),cl=(n,e,t)=>{const i=e-n;return i===0?1:(t-n)/i},Ln=(n,e,t)=>n+(e-n)*t;function P_(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*(2/3-t)*6:n}function FU({hue:n,saturation:e,lightness:t,alpha:i}){n/=360,e/=100,t/=100;let r=0,s=0,o=0;if(!e)r=s=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;r=P_(l,a,n+1/3),s=P_(l,a,n),o=P_(l,a,n-1/3)}return{red:Math.round(r*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:i}}function gm(n,e){return t=>t>0?e:n}const I_=(n,e,t)=>{const i=n*n,r=t*(e*e-i)+i;return r<0?0:Math.sqrt(r)},NU=[A_,ul,Wu],UU=n=>NU.find(e=>e.test(n));function GT(n){const e=UU(n);if(!e)return!1;let t=e.parse(n);return e===Wu&&(t=FU(t)),t}const VT=(n,e)=>{const t=GT(n),i=GT(e);if(!t||!i)return gm(n,e);const r=ye({},t);return s=>(r.red=I_(t.red,i.red,s),r.green=I_(t.green,i.green,s),r.blue=I_(t.blue,i.blue,s),r.alpha=Ln(t.alpha,i.alpha,s),ul.transform(r))},B_=new Set(["none","hidden"]);function OU(n,e){return B_.has(n)?t=>t<=0?n:e:t=>t>=1?e:n}function kU(n,e){return t=>Ln(n,e,t)}function L_(n){return typeof n=="number"?kU:typeof n=="string"?p_(n)?gm:bi.test(n)?VT:GU:Array.isArray(n)?WT:typeof n=="object"?bi.test(n)?VT:zU:gm}function WT(n,e){const t=[...n],i=t.length,r=n.map((s,o)=>L_(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in i)t[s]=i[s](r);return t}}function HU(n,e){var t;const i=[],r={color:0,var:0,number:0};for(let s=0;s{const t=sa.createTransformer(e),i=ad(n),r=ad(e);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?B_.has(n)&&!r.values.length||B_.has(e)&&!i.values.length?OU(n,e):Os(WT(HU(i,r),r.values),t):gm(n,e)};function XT(n,e,t){return typeof n=="number"&&typeof e=="number"&&typeof t=="number"?Ln(n,e,t):L_(n)(n,e)}function VU(n,e,t){const i=[],r=t||XT,s=n.length-1;for(let o=0;oe[0];if(s===2&&n[0]===n[1])return()=>e[1];n[0]>n[s-1]&&(n=[...n].reverse(),e=[...e].reverse());const o=VU(e,i,r),a=o.length,l=u=>{let d=0;if(a>1)for(;dl(ia(n[0],n[s-1],u)):l}function WU(n,e){const t=n[n.length-1];for(let i=1;i<=e;i++){const r=cl(0,e,i);n.push(Ln(t,1,r))}}function jT(n){const e=[0];return WU(e,n.length-1),e}function XU(n,e){return n.map(t=>t*e)}function jU(n,e){return n.map(()=>e||kT).splice(0,n.length-1)}function vm({duration:n=300,keyframes:e,times:t,ease:i="easeInOut"}){const r=LU(i)?i.map(HT):HT(i),s={done:!1,value:e[0]},o=XU(t&&t.length===e.length?t:jT(e),n),a=D_(o,e,{ease:Array.isArray(r)?r:jU(e,r)});return{calculatedDuration:n,next:l=>(s.value=a(l),s.done=l>=n,s)}}const JT=2e4;function JU(n){let e=0;const t=50;let i=n.next(e);for(;!i.done&&e=JT?1/0:e}const KU=n=>{const e=({timestamp:t})=>n(t);return{start:()=>Xt.update(e,!0),stop:()=>hs(e),now:()=>si.isProcessing?si.timestamp:Us.now()}},YU={decay:OT,inertia:OT,tween:vm,keyframes:vm,spring:UT},QU=n=>n/100;class ym extends DT{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:l}=this.options;l&&l()};const{name:t,motionValue:i,element:r,keyframes:s}=this.options,o=(r==null?void 0:r.KeyframeResolver)||v_,a=(l,u)=>this.onKeyframesResolved(l,u);this.resolver=new o(s,a,t,i,r),this.resolver.scheduleResolve()}initPlayback(e){const{type:t="keyframes",repeat:i=0,repeatDelay:r=0,repeatType:s,velocity:o=0}=this.options,a=E_(t)?t:YU[t]||vm;let l,u;a!==vm&&typeof e[0]!="number"&&(l=Os(QU,XT(e[0],e[1])),e=[0,100]);const d=a(wt(ye({},this.options),{keyframes:e}));s==="mirror"&&(u=a(wt(ye({},this.options),{keyframes:[...e].reverse(),velocity:-o}))),d.calculatedDuration===null&&(d.calculatedDuration=JU(d));const{calculatedDuration:h}=d,p=h+r,g=p*(i+1)-r;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:l,calculatedDuration:h,resolvedDuration:p,totalDuration:g}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,t=!1){const{resolved:i}=this;if(!i){const{keyframes:N}=this.options;return{done:!0,value:N[N.length-1]}}const{finalKeyframe:r,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:u,totalDuration:d,resolvedDuration:h}=i;if(this.startTime===null)return s.next(0);const{delay:p,repeat:g,repeatType:v,repeatDelay:S,onUpdate:_}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),t?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const m=this.currentTime-p*(this.speed>=0?1:-1),x=this.speed>=0?m<0:m>d;this.currentTime=Math.max(m,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let A=this.currentTime,w=s;if(g){const N=Math.min(this.currentTime,d)/h;let B=Math.floor(N),T=N%1;!T&&N>=1&&(T=1),T===1&&B--,B=Math.min(B,g+1),!!(B%2)&&(v==="reverse"?(T=1-T,S&&(T-=S/h)):v==="mirror"&&(w=o)),A=ia(0,1,T)*h}const I=x?{done:!1,value:l[0]}:w.next(A);a&&(I.value=a(I.value));let{done:P}=I;!x&&u!==null&&(P=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const D=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&P);return D&&r!==void 0&&(I.value=dm(l,this.options,r)),_&&_(I.value),D&&this.finish(),I}get duration(){const{resolved:e}=this;return e?fo(e.calculatedDuration):0}get time(){return fo(this.currentTime)}set time(e){e=co(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=fo(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=KU,onPlay:t,startTime:i}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),t&&t();const r=this.driver.now();this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=r):this.startTime=i!=null?i:this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}function qU(n){return new ym(n)}const ZU=new Set(["opacity","clipPath","filter","transform"]),$U=10,eO=(n,e)=>{let t="";const i=Math.max(Math.round(e/$U),2);for(let r=0;r(e===void 0&&(e=n()),e)}const tO={linearEasing:void 0};function nO(n,e){const t=F_(n);return()=>{var i;return(i=tO[e])!==null&&i!==void 0?i:t()}}const xm=nO(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(n){return!1}return!0},"linearEasing");function KT(n){return!!(typeof n=="function"&&xm()||!n||typeof n=="string"&&(n in N_||xm())||R_(n)||Array.isArray(n)&&n.every(KT))}const ld=([n,e,t,i])=>`cubic-bezier(${n}, ${e}, ${t}, ${i})`,N_={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ld([0,.65,.55,1]),circOut:ld([.55,0,1,.45]),backIn:ld([.31,.01,.66,-.59]),backOut:ld([.33,1.53,.69,.99])};function YT(n,e){if(n)return typeof n=="function"&&xm()?eO(n,e):R_(n)?ld(n):Array.isArray(n)?n.map(t=>YT(t,e)||N_.easeOut):N_[n]}function iO(n,e,t,{delay:i=0,duration:r=300,repeat:s=0,repeatType:o="loop",ease:a,times:l}={}){const u={[e]:t};l&&(u.offset=l);const d=YT(a,r);return Array.isArray(d)&&(u.easing=d),n.animate(u,{delay:i,duration:r,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function QT(n,e){n.timeline=e,n.onfinish=null}const rO=F_(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),_m=10,sO=2e4;function oO(n){return E_(n.type)||n.type==="spring"||!KT(n.ease)}function aO(n,e){const t=new ym(wt(ye({},e),{keyframes:n,repeat:0,delay:0,isGenerator:!0}));let i={done:!1,value:n[0]};const r=[];let s=0;for(;!i.done&&sthis.onKeyframesResolved(o,a),t,i,r),this.resolver.scheduleResolve()}initPlayback(e,t){var i;let{duration:r=300,times:s,ease:o,type:a,motionValue:l,name:u,startTime:d}=this.options;if(!(!((i=l.owner)===null||i===void 0)&&i.current))return!1;if(typeof o=="string"&&xm()&&lO(o)&&(o=qT[o]),oO(this.options)){const p=this.options,{onComplete:g,onUpdate:v,motionValue:S,element:_}=p,m=Un(p,["onComplete","onUpdate","motionValue","element"]),x=aO(e,m);e=x.keyframes,e.length===1&&(e[1]=e[0]),r=x.duration,s=x.times,o=x.ease,a="keyframes"}const h=iO(l.owner.current,u,e,wt(ye({},this.options),{duration:r,times:s,ease:o}));return h.startTime=d!=null?d:this.calcStartTime(),this.pendingTimeline?(QT(h,this.pendingTimeline),this.pendingTimeline=void 0):h.onfinish=()=>{const{onComplete:g}=this.options;l.set(dm(e,this.options,t)),g&&g(),this.cancel(),this.resolveFinishedPromise()},{animation:h,duration:r,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:t}=e;return fo(t)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:t}=e;return fo(t.currentTime||0)}set time(e){const{resolved:t}=this;if(!t)return;const{animation:i}=t;i.currentTime=co(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:t}=e;return t.playbackRate}set speed(e){const{resolved:t}=this;if(!t)return;const{animation:i}=t;i.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:t}=e;return t.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:t}=e;return t.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:t}=this;if(!t)return xi;const{animation:i}=t;QT(i,e)}return xi}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:t}=e;t.playState==="finished"&&this.updateFinishedPromise(),t.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:t}=e;t.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:t,keyframes:i,duration:r,type:s,ease:o,times:a}=e;if(t.playState==="idle"||t.playState==="finished")return;if(this.time){const u=this.options,{motionValue:d,onUpdate:h,onComplete:p,element:g}=u,v=Un(u,["motionValue","onUpdate","onComplete","element"]),S=new ym(wt(ye({},v),{keyframes:i,duration:r,type:s,ease:o,times:a,isGenerator:!0})),_=co(this.time);d.setWithVelocity(S.sample(_-_m).value,S.sample(_).value,_m)}const{onStop:l}=this.options;l&&l(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:t,name:i,repeatDelay:r,repeatType:s,damping:o,type:a}=e;return rO()&&i&&ZU.has(i)&&t&&t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate&&!r&&s!=="mirror"&&o!==0&&a!=="inertia"}}const $T=F_(()=>window.ScrollTimeline!==void 0);class uO{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,t){return Promise.all(this.animations).then(e).catch(t)}getAll(e){return this.animations[0][e]}setAll(e,t){for(let i=0;i$T()&&r.attachTimeline?r.attachTimeline(e):t(r));return()=>{i.forEach((r,s)=>{r&&r(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let t=0;tt[e]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function cO(h){var p=h,{when:n,delay:e,delayChildren:t,staggerChildren:i,staggerDirection:r,repeat:s,repeatType:o,repeatDelay:a,from:l,elapsed:u}=p,d=Un(p,["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);return!!Object.keys(d).length}const U_=(n,e,t,i={},r,s)=>o=>{const a=u_(i,n)||{},l=a.delay||i.delay||0;let{elapsed:u=0}=i;u=u-co(l);let d=wt(ye({keyframes:Array.isArray(t)?t:[null,t],ease:"easeOut",velocity:e.getVelocity()},a),{delay:-u,onUpdate:p=>{e.set(p),a.onUpdate&&a.onUpdate(p)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:n,motionValue:e,element:s?void 0:r});cO(a)||(d=ye(ye({},d),P3(n,d))),d.duration&&(d.duration=co(d.duration)),d.repeatDelay&&(d.repeatDelay=co(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let h=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(h=!0)),h&&!s&&e.get()!==void 0){const p=dm(d.keyframes,a);if(p!==void 0)return Xt.update(()=>{d.onUpdate(p),d.onComplete()}),new uO([])}return!s&&ZT.supports(d)?new ZT(d):new ym(d)},fO=n=>!!(n&&typeof n=="object"&&n.mix&&n.toValue),dO=n=>s_(n)?n[n.length-1]||0:n;function O_(n,e){n.indexOf(e)===-1&&n.push(e)}function k_(n,e){const t=n.indexOf(e);t>-1&&n.splice(t,1)}class z_{constructor(){this.subscriptions=[]}add(e){return O_(this.subscriptions,e),()=>k_(this.subscriptions,e)}notify(e,t,i){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,i);else for(let s=0;s!isNaN(parseFloat(n)),ud={current:void 0};class pO{constructor(e,t={}){this.version="11.11.10",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(i,r=!0)=>{const s=Us.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),r&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Us.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=hO(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new z_);const i=this.events[e].add(t);return e==="change"?()=>{i(),Xt.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e,t=!0){!t||!this.passiveEffect?this.updateAndNotify(e,t):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,t,i){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-i}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return ud.current&&ud.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=Us.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>eb)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,eb);return C_(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function ks(n,e){return new pO(n,e)}function mO(n,e,t){n.hasValue(e)?n.getValue(e).set(t):n.addValue(e,ks(t))}function gO(n,e){let o=fm(n,e)||{},{transitionEnd:i={},transition:r={}}=o,s=Un(o,["transitionEnd","transition"]);s=ye(ye({},s),i);for(const a in s){const l=dO(s[a]);mO(n,a,l)}}const H_=n=>n.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),tb="data-"+H_("framerAppearId");function nb(n){return n.props[tb]}const Tn=n=>!!(n&&n.getVelocity);function vO(n){return!!(Tn(n)&&n.add)}function G_(n,e){const t=n.getValue("willChange");if(vO(t))return t.add(e)}function yO({protectedKeys:n,needsAnimating:e},t){const i=n.hasOwnProperty(t)&&e[t]!==!0;return e[t]=!1,i}function ib(n,e,{delay:t=0,transitionOverride:i,type:r}={}){var s;let h=e,{transition:o=n.getDefaultTransition(),transitionEnd:a}=h,l=Un(h,["transition","transitionEnd"]);i&&(o=i);const u=[],d=r&&n.animationState&&n.animationState.getState()[r];for(const p in l){const g=n.getValue(p,(s=n.latestValues[p])!==null&&s!==void 0?s:null),v=l[p];if(v===void 0||d&&yO(d,p))continue;const S=ye({delay:t},u_(o||{},p));let _=!1;if(window.MotionHandoffAnimation){const x=nb(n);if(x){const A=window.MotionHandoffAnimation(x,p,Xt);A!==null&&(S.startTime=A,_=!0)}}G_(n,p),g.start(U_(p,g,v,n.shouldReduceMotion&&al.has(p)?{type:!1}:S,n,_));const m=g.animation;m&&u.push(m)}return a&&Promise.all(u).then(()=>{Xt.update(()=>{a&&gO(n,a)})}),u}function V_(n,e,t={}){var i;const r=fm(n,e,t.type==="exit"?(i=n.presenceContext)===null||i===void 0?void 0:i.custom:void 0);let{transition:s=n.getDefaultTransition()||{}}=r||{};t.transitionOverride&&(s=t.transitionOverride);const o=r?()=>Promise.all(ib(n,r,t)):()=>Promise.resolve(),a=n.variantChildren&&n.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:h,staggerDirection:p}=s;return xO(n,e,d+u,h,p,t)}:()=>Promise.resolve(),{when:l}=s;if(l){const[u,d]=l==="beforeChildren"?[o,a]:[a,o];return u().then(()=>d())}else return Promise.all([o(),a(t.delay)])}function xO(n,e,t=0,i=0,r=1,s){const o=[],a=(n.variantChildren.size-1)*i,l=r===1?(u=0)=>u*i:(u=0)=>a-u*i;return Array.from(n.variantChildren).sort(_O).forEach((u,d)=>{u.notify("AnimationStart",e),o.push(V_(u,e,wt(ye({},s),{delay:t+l(d)})).then(()=>u.notify("AnimationComplete",e)))}),Promise.all(o)}function _O(n,e){return n.sortNodePosition(e)}function AO(n,e,t={}){n.notify("AnimationStart",e);let i;if(Array.isArray(e)){const r=e.map(s=>V_(n,s,t));i=Promise.all(r)}else if(typeof e=="string")i=V_(n,e,t);else{const r=typeof e=="function"?fm(n,e,t.custom):e;i=Promise.all(ib(n,r,t))}return i.then(()=>{n.notify("AnimationComplete",e)})}const SO=l_.length;function rb(n){if(!n)return;if(!n.isControllingVariants){const t=n.parent?rb(n.parent)||{}:{};return n.props.initial!==void 0&&(t.initial=n.props.initial),t}const e={};for(let t=0;tPromise.all(e.map(({animation:t,options:i})=>AO(n,t,i)))}function CO(n){let e=EO(n),t=sb(),i=!0;const r=l=>(u,d)=>{var h;const p=fm(n,d,l==="exit"?(h=n.presenceContext)===null||h===void 0?void 0:h.custom:void 0);if(p){const g=p,{transition:v,transitionEnd:S}=g,_=Un(g,["transition","transitionEnd"]);u=ye(ye(ye({},u),_),S)}return u};function s(l){e=l(n)}function o(l){const{props:u}=n,d=rb(n.parent)||{},h=[],p=new Set;let g={},v=1/0;for(let _=0;_v&&w,B=!1;const T=Array.isArray(A)?A:[A];let F=T.reduce(r(m),{});I===!1&&(F={});const{prevResolvedValues:X={}}=x,J=ye(ye({},X),F),Q=fe=>{N=!0,p.has(fe)&&(B=!0,p.delete(fe)),x.needsAnimating[fe]=!0;const z=n.getValue(fe);z&&(z.liveStyle=!1)};for(const fe in J){const z=F[fe],$=X[fe];if(g.hasOwnProperty(fe))continue;let ne=!1;s_(z)&&s_($)?ne=!$C(z,$):ne=z!==$,ne?z!=null?Q(fe):p.add(fe):z!==void 0&&p.has(fe)?Q(fe):x.protectedKeys[fe]=!0}x.prevProp=A,x.prevResolvedValues=F,x.isActive&&(g=ye(ye({},g),F)),i&&n.blockInitialAnimation&&(N=!1),N&&(!(P&&D)||B)&&h.push(...T.map(fe=>({animation:fe,options:{type:m}})))}if(p.size){const _={};p.forEach(m=>{const x=n.getBaseTarget(m),A=n.getValue(m);A&&(A.liveStyle=!0),_[m]=x!=null?x:null}),h.push({animation:_})}let S=!!h.length;return i&&(u.initial===!1||u.initial===u.animate)&&!n.manuallyAnimateOnMount&&(S=!1),i=!1,S?e(h):Promise.resolve()}function a(l,u){var d;if(t[l].isActive===u)return Promise.resolve();(d=n.variantChildren)===null||d===void 0||d.forEach(p=>{var g;return(g=p.animationState)===null||g===void 0?void 0:g.setActive(l,u)}),t[l].isActive=u;const h=o(l);for(const p in t)t[p].protectedKeys={};return h}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>t,reset:()=>{t=sb(),i=!0}}}function TO(n,e){return typeof e=="string"?e!==n:Array.isArray(e)?!$C(e,n):!1}function fl(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function sb(){return{animate:fl(!0),whileInView:fl(),whileHover:fl(),whileTap:fl(),whileDrag:fl(),whileFocus:fl(),exit:fl()}}class oa{constructor(e){this.isMounted=!1,this.node=e}update(){}}class bO extends oa{constructor(e){super(e),e.animationState||(e.animationState=CO(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();cm(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let RO=0;class PO extends oa{constructor(){super(...arguments),this.id=RO++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const r=this.node.animationState.setActive("exit",!e);t&&!e&&r.then(()=>t(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const ob={animation:{Feature:bO},exit:{Feature:PO}},ab=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1;function Am(n,e="page"){return{point:{x:n[`${e}X`],y:n[`${e}Y`]}}}const lb=n=>e=>ab(e)&&n(e,Am(e));function ho(n,e,t,i={passive:!0}){return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t)}function ps(n,e,t,i){return ho(n,e,lb(t),i)}const ub=(n,e)=>Math.abs(n-e);function IO(n,e){const t=ub(n.x,e.x),i=ub(n.y,e.y);return Math.sqrt(W0(t,2)+W0(i,2))}class cb{constructor(e,t,{transformPagePoint:i,contextWindow:r,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const h=X_(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,g=IO(h.offset,{x:0,y:0})>=3;if(!p&&!g)return;const{point:v}=h,{timestamp:S}=si;this.history.push(wt(ye({},v),{timestamp:S}));const{onStart:_,onMove:m}=this.handlers;p||(_&&_(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),m&&m(this.lastMoveEvent,h)},this.handlePointerMove=(h,p)=>{this.lastMoveEvent=h,this.lastMoveEventInfo=W_(p,this.transformPagePoint),Xt.update(this.updatePoint,!0)},this.handlePointerUp=(h,p)=>{this.end();const{onEnd:g,onSessionEnd:v,resumeAnimation:S}=this.handlers;if(this.dragSnapToOrigin&&S&&S(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const _=X_(h.type==="pointercancel"?this.lastMoveEventInfo:W_(p,this.transformPagePoint),this.history);this.startEvent&&g&&g(h,_),v&&v(h,_)},!ab(e))return;this.dragSnapToOrigin=s,this.handlers=t,this.transformPagePoint=i,this.contextWindow=r||window;const o=Am(e),a=W_(o,this.transformPagePoint),{point:l}=a,{timestamp:u}=si;this.history=[wt(ye({},l),{timestamp:u})];const{onSessionStart:d}=t;d&&d(e,X_(a,this.history)),this.removeListeners=Os(ps(this.contextWindow,"pointermove",this.handlePointerMove),ps(this.contextWindow,"pointerup",this.handlePointerUp),ps(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),hs(this.updatePoint)}}function W_(n,e){return e?{point:e(n.point)}:n}function fb(n,e){return{x:n.x-e.x,y:n.y-e.y}}function X_({point:n},e){return{point:n,delta:fb(n,db(e)),offset:fb(n,BO(e)),velocity:LO(e,.1)}}function BO(n){return n[0]}function db(n){return n[n.length-1]}function LO(n,e){if(n.length<2)return{x:0,y:0};let t=n.length-1,i=null;const r=db(n);for(;t>=0&&(i=n[t],!(r.timestamp-i.timestamp>co(e)));)t--;if(!i)return{x:0,y:0};const s=fo(r.timestamp-i.timestamp);if(s===0)return{x:0,y:0};const o={x:(r.x-i.x)/s,y:(r.y-i.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function hb(n){let e=null;return()=>{const t=()=>{e=null};return e===null?(e=n,t):!1}}const pb=hb("dragHorizontal"),mb=hb("dragVertical");function gb(n){let e=!1;if(n==="y")e=mb();else if(n==="x")e=pb();else{const t=pb(),i=mb();t&&i?e=()=>{t(),i()}:(t&&t(),i&&i())}return e}function j_(){const n=gb(!0);return n?(n(),!1):!0}function Xu(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}const vb=1e-4,DO=1-vb,FO=1+vb,yb=.01,NO=0-yb,UO=0+yb;function Cr(n){return n.max-n.min}function OO(n,e,t){return Math.abs(n-e)<=t}function xb(n,e,t,i=.5){n.origin=i,n.originPoint=Ln(e.min,e.max,n.origin),n.scale=Cr(t)/Cr(e),n.translate=Ln(t.min,t.max,n.origin)-n.originPoint,(n.scale>=DO&&n.scale<=FO||isNaN(n.scale))&&(n.scale=1),(n.translate>=NO&&n.translate<=UO||isNaN(n.translate))&&(n.translate=0)}function cd(n,e,t,i){xb(n.x,e.x,t.x,i?i.originX:void 0),xb(n.y,e.y,t.y,i?i.originY:void 0)}function _b(n,e,t){n.min=t.min+e.min,n.max=n.min+Cr(e)}function kO(n,e,t){_b(n.x,e.x,t.x),_b(n.y,e.y,t.y)}function Ab(n,e,t){n.min=e.min-t.min,n.max=n.min+Cr(e)}function fd(n,e,t){Ab(n.x,e.x,t.x),Ab(n.y,e.y,t.y)}function zO(n,{min:e,max:t},i){return e!==void 0&&nt&&(n=i?Ln(t,n,i.max):Math.min(n,t)),n}function Sb(n,e,t){return{min:e!==void 0?n.min+e:void 0,max:t!==void 0?n.max+t-(n.max-n.min):void 0}}function HO(n,{top:e,left:t,bottom:i,right:r}){return{x:Sb(n.x,t,r),y:Sb(n.y,e,i)}}function Mb(n,e){let t=e.min-n.min,i=e.max-n.max;return e.max-e.mini?t=cl(e.min,e.max-i,n.min):i>r&&(t=cl(n.min,n.max-r,e.min)),ia(0,1,t)}function WO(n,e){const t={};return e.min!==void 0&&(t.min=e.min-n.min),e.max!==void 0&&(t.max=e.max-n.min),t}const J_=.35;function XO(n=J_){return n===!1?n=0:n===!0&&(n=J_),{x:wb(n,"left","right"),y:wb(n,"top","bottom")}}function wb(n,e,t){return{min:Eb(n,e),max:Eb(n,t)}}function Eb(n,e){return typeof n=="number"?n:n[e]||0}const Cb=()=>({translate:0,scale:1,origin:0,originPoint:0}),ju=()=>({x:Cb(),y:Cb()}),Tb=()=>({min:0,max:0}),kn=()=>({x:Tb(),y:Tb()});function Xr(n){return[n("x"),n("y")]}function bb({top:n,left:e,right:t,bottom:i}){return{x:{min:e,max:t},y:{min:n,max:i}}}function jO({x:n,y:e}){return{top:e.min,right:n.max,bottom:e.max,left:n.min}}function JO(n,e){if(!e)return n;const t=e({x:n.left,y:n.top}),i=e({x:n.right,y:n.bottom});return{top:t.y,left:t.x,bottom:i.y,right:i.x}}function K_(n){return n===void 0||n===1}function Y_({scale:n,scaleX:e,scaleY:t}){return!K_(n)||!K_(e)||!K_(t)}function dl(n){return Y_(n)||Rb(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function Rb(n){return Pb(n.x)||Pb(n.y)}function Pb(n){return n&&n!=="0%"}function Sm(n,e,t){const i=n-t,r=e*i;return t+r}function Ib(n,e,t,i,r){return r!==void 0&&(n=Sm(n,r,i)),Sm(n,t,i)+e}function Q_(n,e=0,t=1,i,r){n.min=Ib(n.min,e,t,i,r),n.max=Ib(n.max,e,t,i,r)}function Bb(n,{x:e,y:t}){Q_(n.x,e.translate,e.scale,e.originPoint),Q_(n.y,t.translate,t.scale,t.originPoint)}const Lb=.999999999999,Db=1.0000000000001;function KO(n,e,t,i=!1){const r=t.length;if(!r)return;e.x=e.y=1;let s,o;for(let a=0;aLb&&(e.x=1),e.yLb&&(e.y=1)}function Ju(n,e){n.min=n.min+e,n.max=n.max+e}function Fb(n,e,t,i,r=.5){const s=Ln(n.min,n.max,r);Q_(n,e,t,s,i)}function Ku(n,e){Fb(n.x,e.x,e.scaleX,e.scale,e.originX),Fb(n.y,e.y,e.scaleY,e.scale,e.originY)}function Nb(n,e){return bb(JO(n.getBoundingClientRect(),e))}function YO(n,e,t){const i=Nb(n,t),{scroll:r}=e;return r&&(Ju(i.x,r.offset.x),Ju(i.y,r.offset.y)),i}const Ub=({current:n})=>n?n.ownerDocument.defaultView:null,QO=new WeakMap;class qO{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=kn(),this.visualElement=e}start(e,{snapToCursor:t=!1}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const r=d=>{const{dragSnapToOrigin:h}=this.getProps();h?this.pauseAnimation():this.stopAnimation(),t&&this.snapToCursor(Am(d,"page").point)},s=(d,h)=>{const{drag:p,dragPropagation:g,onDragStart:v}=this.getProps();if(p&&!g&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=gb(p),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Xr(_=>{let m=this.getAxisMotionValue(_).get()||0;if(Ns.test(m)){const{projection:x}=this.visualElement;if(x&&x.layout){const A=x.layout.layoutBox[_];A&&(m=Cr(A)*(parseFloat(m)/100))}}this.originPoint[_]=m}),v&&Xt.postRender(()=>v(d,h)),G_(this.visualElement,"transform");const{animationState:S}=this.visualElement;S&&S.setActive("whileDrag",!0)},o=(d,h)=>{const{dragPropagation:p,dragDirectionLock:g,onDirectionLock:v,onDrag:S}=this.getProps();if(!p&&!this.openGlobalLock)return;const{offset:_}=h;if(g&&this.currentDirection===null){this.currentDirection=ZO(_),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",h.point,_),this.updateAxis("y",h.point,_),this.visualElement.render(),S&&S(d,h)},a=(d,h)=>this.stop(d,h),l=()=>Xr(d=>{var h;return this.getAnimationState(d)==="paused"&&((h=this.getAxisMotionValue(d).animation)===null||h===void 0?void 0:h.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new cb(e,{onSessionStart:r,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:Ub(this.visualElement)})}stop(e,t){const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:r}=t;this.startAnimation(r);const{onDragEnd:s}=this.getProps();s&&Xt.postRender(()=>s(e,t))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),t&&t.setActive("whileDrag",!1)}updateAxis(e,t,i){const{drag:r}=this.getProps();if(!i||!Mm(e,r,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(o=zO(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:t,dragElastic:i}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;t&&Xu(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=HO(r.layoutBox,t):this.constraints=!1,this.elastic=XO(i),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Xr(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=WO(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Xu(e))return!1;const i=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const s=YO(i,r.root,this.visualElement.getTransformPagePoint());let o=GO(r.layout.layoutBox,s);if(t){const a=t(jO(o));this.hasMutatedConstraints=!!a,a&&(o=bb(a))}return o}startAnimation(e){const{drag:t,dragMomentum:i,dragElastic:r,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=Xr(d=>{if(!Mm(d,t,this.currentDirection))return;let h=l&&l[d]||{};o&&(h={min:0,max:0});const p=r?200:1e6,g=r?40:1e7,v=ye(ye({type:"inertia",velocity:i?e[d]:0,bounceStiffness:p,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10},s),h);return this.startAxisValueAnimation(d,v)});return Promise.all(u).then(a)}startAxisValueAnimation(e,t){const i=this.getAxisMotionValue(e);return G_(this.visualElement,e),i.start(U_(e,i,0,t,this.visualElement,!1))}stopAnimation(){Xr(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Xr(e=>{var t;return(t=this.getAxisMotionValue(e).animation)===null||t===void 0?void 0:t.pause()})}getAnimationState(e){var t;return(t=this.getAxisMotionValue(e).animation)===null||t===void 0?void 0:t.state}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,i=this.visualElement.getProps(),r=i[t];return r||this.visualElement.getValue(e,(i.initial?i.initial[e]:void 0)||0)}snapToCursor(e){Xr(t=>{const{drag:i}=this.getProps();if(!Mm(t,i,this.currentDirection))return;const{projection:r}=this.visualElement,s=this.getAxisMotionValue(t);if(r&&r.layout){const{min:o,max:a}=r.layout.layoutBox[t];s.set(e[t]-Ln(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:i}=this.visualElement;if(!Xu(t)||!i||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Xr(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();r[o]=VO({min:l,max:l},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),Xr(o=>{if(!Mm(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:u}=this.constraints[o];a.set(Ln(l,u,r[o]))})}addListeners(){if(!this.visualElement.current)return;QO.set(this.visualElement,this);const e=this.visualElement.current,t=ps(e,"pointerdown",l=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(l)}),i=()=>{const{dragConstraints:l}=this.getProps();Xu(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,s=r.addEventListener("measure",i);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),Xt.read(i);const o=ho(window,"resize",()=>this.scalePositionWithinConstraints()),a=r.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(Xr(d=>{const h=this.getAxisMotionValue(d);h&&(this.originPoint[d]+=l[d].translate,h.set(h.get()+l[d].translate))}),this.visualElement.render())});return()=>{o(),t(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:i=!1,dragPropagation:r=!1,dragConstraints:s=!1,dragElastic:o=J_,dragMomentum:a=!0}=e;return wt(ye({},e),{drag:t,dragDirectionLock:i,dragPropagation:r,dragConstraints:s,dragElastic:o,dragMomentum:a})}}function Mm(n,e,t){return(e===!0||e===n)&&(t===null||t===n)}function ZO(n,e=10){let t=null;return Math.abs(n.y)>e?t="y":Math.abs(n.x)>e&&(t="x"),t}class $O extends oa{constructor(e){super(e),this.removeGroupControls=xi,this.removeListeners=xi,this.controls=new qO(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||xi}unmount(){this.removeGroupControls(),this.removeListeners()}}const Ob=n=>(e,t)=>{n&&Xt.postRender(()=>n(e,t))};class ek extends oa{constructor(){super(...arguments),this.removePointerDownListener=xi}onPointerDown(e){this.session=new cb(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Ub(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:i,onPanEnd:r}=this.node.getProps();return{onSessionStart:Ob(e),onStart:Ob(t),onMove:i,onEnd:(s,o)=>{delete this.session,r&&Xt.postRender(()=>r(s,o))}}}mount(){this.removePointerDownListener=ps(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const q_=me.createContext(null);function tk(){const n=me.useContext(q_);if(n===null)return[!0,null];const{isPresent:e,onExitComplete:t,register:i}=n,r=me.useId();me.useEffect(()=>i(r),[]);const s=me.useCallback(()=>t&&t(r),[r,t]);return!e&&t?[!1,s]:[!0]}const kb=me.createContext({}),zb=me.createContext({}),wm={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Hb(n,e){return e.max===e.min?0:n/(e.max-e.min)*100}const dd={correct:(n,e)=>{if(!e.target)return n;if(typeof n=="string")if(St.test(n))n=parseFloat(n);else return n;const t=Hb(n,e.target.x),i=Hb(n,e.target.y);return`${t}% ${i}%`}},nk={correct:(n,{treeScale:e,projectionDelta:t})=>{const i=n,r=sa.parse(n);if(r.length>5)return i;const s=sa.createTransformer(n),o=typeof r[0]!="number"?1:0,a=t.x.scale*e.x,l=t.y.scale*e.y;r[0+o]/=a,r[1+o]/=l;const u=Ln(a,l,.5);return typeof r[2+o]=="number"&&(r[2+o]/=u),typeof r[3+o]=="number"&&(r[3+o]/=u),s(r)}},Em={};function ik(n){Object.assign(Em,n)}const{schedule:Z_,cancel:Cj}=tT(queueMicrotask,!1);class rk extends me.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:i,layoutId:r}=this.props,{projection:s}=e;ik(sk),s&&(t.group&&t.group.add(s),i&&i.register&&r&&i.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions(wt(ye({},s.options),{onExitComplete:()=>this.safeToRemove()}))),wm.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:i,drag:r,isPresent:s}=this.props,o=i.projection;return o&&(o.isPresent=s,r||e.layoutDependency!==t||t===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Xt.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),Z_.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:i}=this.props,{projection:r}=e;r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),i&&i.deregister&&i.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Gb(n){const[e,t]=tk(),i=me.useContext(kb);return ge.jsx(rk,wt(ye({},n),{layoutGroup:i,switchLayoutGroup:me.useContext(zb),isPresent:e,safeToRemove:t}))}const sk={borderRadius:wt(ye({},dd),{applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]}),borderTopLeftRadius:dd,borderTopRightRadius:dd,borderBottomLeftRadius:dd,borderBottomRightRadius:dd,boxShadow:nk},Vb=["TopLeft","TopRight","BottomLeft","BottomRight"],ok=Vb.length,Wb=n=>typeof n=="string"?parseFloat(n):n,Xb=n=>typeof n=="number"||St.test(n);function ak(n,e,t,i,r,s){r?(n.opacity=Ln(0,t.opacity!==void 0?t.opacity:1,lk(i)),n.opacityExit=Ln(e.opacity!==void 0?e.opacity:1,0,uk(i))):s&&(n.opacity=Ln(e.opacity!==void 0?e.opacity:1,t.opacity!==void 0?t.opacity:1,i));for(let o=0;oie?1:t(cl(n,e,i))}function Kb(n,e){n.min=e.min,n.max=e.max}function jr(n,e){Kb(n.x,e.x),Kb(n.y,e.y)}function Yb(n,e){n.translate=e.translate,n.scale=e.scale,n.originPoint=e.originPoint,n.origin=e.origin}function Qb(n,e,t,i,r){return n-=e,n=Sm(n,1/t,i),r!==void 0&&(n=Sm(n,1/r,i)),n}function ck(n,e=0,t=1,i=.5,r,s=n,o=n){if(Ns.test(e)&&(e=parseFloat(e),e=Ln(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Ln(s.min,s.max,i);n===s&&(a-=e),n.min=Qb(n.min,e,t,a,r),n.max=Qb(n.max,e,t,a,r)}function qb(n,e,[t,i,r],s,o){ck(n,e[t],e[i],e[r],e.scale,s,o)}const fk=["x","scaleX","originX"],dk=["y","scaleY","originY"];function Zb(n,e,t,i){qb(n.x,e,fk,t?t.x:void 0,i?i.x:void 0),qb(n.y,e,dk,t?t.y:void 0,i?i.y:void 0)}function $b(n){return n.translate===0&&n.scale===1}function eR(n){return $b(n.x)&&$b(n.y)}function tR(n,e){return n.min===e.min&&n.max===e.max}function hk(n,e){return tR(n.x,e.x)&&tR(n.y,e.y)}function nR(n,e){return Math.round(n.min)===Math.round(e.min)&&Math.round(n.max)===Math.round(e.max)}function iR(n,e){return nR(n.x,e.x)&&nR(n.y,e.y)}function rR(n){return Cr(n.x)/Cr(n.y)}function sR(n,e){return n.translate===e.translate&&n.scale===e.scale&&n.originPoint===e.originPoint}class pk{constructor(){this.members=[]}add(e){O_(this.members,e),e.scheduleRender()}remove(e){if(k_(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(e){const t=this.members.findIndex(r=>e===r);if(t===0)return!1;let i;for(let r=t;r>=0;r--){const s=this.members[r];if(s.isPresent!==!1){i=s;break}}return i?(this.promote(i),!0):!1}promote(e,t){const i=this.lead;if(e!==i&&(this.prevLead=i,this.lead=e,e.show(),i)){i.instance&&i.scheduleRender(),e.scheduleRender(),e.resumeFrom=i,t&&(e.resumeFrom.preserveOpacity=!0),i.snapshot&&(e.snapshot=i.snapshot,e.snapshot.latestValues=i.animationValues||i.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:r}=e.options;r===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:t,resumingFrom:i}=e;t.onExitComplete&&t.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function mk(n,e,t){let i="";const r=n.x.translate/e.x,s=n.y.translate/e.y,o=(t==null?void 0:t.z)||0;if((r||s||o)&&(i=`translate3d(${r}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(i+=`scale(${1/e.x}, ${1/e.y}) `),t){const{transformPerspective:u,rotate:d,rotateX:h,rotateY:p,skewX:g,skewY:v}=t;u&&(i=`perspective(${u}px) ${i}`),d&&(i+=`rotate(${d}deg) `),h&&(i+=`rotateX(${h}deg) `),p&&(i+=`rotateY(${p}deg) `),g&&(i+=`skewX(${g}deg) `),v&&(i+=`skewY(${v}deg) `)}const a=n.x.scale*e.x,l=n.y.scale*e.y;return(a!==1||l!==1)&&(i+=`scale(${a}, ${l})`),i||"none"}const gk=(n,e)=>n.depth-e.depth;class vk{constructor(){this.children=[],this.isDirty=!1}add(e){O_(this.children,e),this.isDirty=!0}remove(e){k_(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(gk),this.isDirty=!1,this.children.forEach(e)}}function hd(n){const e=Tn(n)?n.get():n;return fO(e)?e.toValue():e}function yk(n,e){const t=Us.now(),i=({timestamp:r})=>{const s=r-t;s>=e&&(hs(i),n(s-e))};return Xt.read(i,!0),()=>hs(i)}function xk(n){return n instanceof SVGElement&&n.tagName!=="svg"}function _k(n,e,t){const i=Tn(n)?n:ks(n);return i.start(U_("",i,e,t)),i.animation}const hl={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},pd=typeof window!="undefined"&&window.MotionDebug!==void 0,$_=["","X","Y","Z"],Ak={visibility:"hidden"},oR=1e3;let Sk=0;function eA(n,e,t,i){const{latestValues:r}=e;r[n]&&(t[n]=r[n],e.setStaticValue(n,0),i&&(i[n]=0))}function aR(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:e}=n.options;if(!e)return;const t=nb(e);if(window.MotionHasOptimisedAnimation(t,"transform")){const{layout:r,layoutId:s}=n.options;window.MotionCancelOptimisedAnimation(t,"transform",Xt,!(r||s))}const{parent:i}=n;i&&!i.hasCheckedOptimisedAppear&&aR(i)}function lR({attachResizeListener:n,defaultParent:e,measureScroll:t,checkIsScrollRoot:i,resetTransform:r}){return class{constructor(o={},a=e==null?void 0:e()){this.id=Sk++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,pd&&(hl.totalNodes=hl.resolvedTargetDeltas=hl.recalculatedProjection=0),this.nodes.forEach(Ek),this.nodes.forEach(Pk),this.nodes.forEach(Ik),this.nodes.forEach(Ck),pd&&window.MotionDebug.record(hl)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;n(o,()=>{this.root.updateBlockedByResize=!0,h&&h(),h=yk(p,250),wm.hasAnimatedSinceResize&&(wm.hasAnimatedSinceResize=!1,this.nodes.forEach(cR))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&d&&(l||u)&&this.addEventListener("didUpdate",({delta:h,hasLayoutChanged:p,hasRelativeTargetChanged:g,layout:v})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const S=this.options.transition||d.getDefaultTransition()||Nk,{onLayoutAnimationStart:_,onLayoutAnimationComplete:m}=d.getProps(),x=!this.targetLayout||!iR(this.targetLayout,v)||g,A=!p&&g;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||A||p&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(h,A);const w=wt(ye({},u_(S,"layout")),{onPlay:_,onComplete:m});(d.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w)}else p||cR(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=v})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,hs(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Bk),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&aR(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const I=w/1e3;fR(h.x,o.x,I),fR(h.y,o.y,I),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(fd(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Dk(this.relativeTarget,this.relativeTargetOrigin,p,I),A&&hk(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=kn()),jr(A,this.relativeTarget)),S&&(this.animationValues=d,ak(d,u,this.latestValues,I,x,m)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=I},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(hs(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Xt.update(()=>{wm.hasAnimatedSinceResize=!0,this.currentAnimation=_k(0,oR,wt(ye({},o),{onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}})),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(oR),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:d}=o;if(!(!a||!l||!u)){if(this!==o&&this.layout&&u&&gR(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||kn();const h=Cr(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+h;const p=Cr(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+p}jr(a,l),Ku(a,d),cd(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new pk),this.sharedNodes.get(o).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const u={};l.z&&eA("z",o,u,this.animationValues);for(let d=0;d<$_.length;d++)eA(`rotate${$_[d]}`,o,u,this.animationValues),eA(`skew${$_[d]}`,o,u,this.animationValues);o.render();for(const d in u)o.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);o.scheduleRender()}getProjectionStyles(o){var a,l;if(!this.instance||this.isSVG)return;if(!this.isVisible)return Ak;const u={visibility:""},d=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,u.opacity="",u.pointerEvents=hd(o==null?void 0:o.pointerEvents)||"",u.transform=d?d(this.latestValues,""):"none",u;const h=this.getLead();if(!this.projectionDelta||!this.layout||!h.target){const S={};return this.options.layoutId&&(S.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,S.pointerEvents=hd(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!dl(this.latestValues)&&(S.transform=d?d({},""):"none",this.hasProjected=!1),S}const p=h.animationValues||h.latestValues;this.applyTransformsToTarget(),u.transform=mk(this.projectionDeltaWithTransform,this.treeScale,p),d&&(u.transform=d(p,u.transform));const{x:g,y:v}=this.projectionDelta;u.transformOrigin=`${g.origin*100}% ${v.origin*100}% 0`,h.animationValues?u.opacity=h===this?(l=(a=p.opacity)!==null&&a!==void 0?a:this.latestValues.opacity)!==null&&l!==void 0?l:1:this.preserveOpacity?this.latestValues.opacity:p.opacityExit:u.opacity=h===this?p.opacity!==void 0?p.opacity:"":p.opacityExit!==void 0?p.opacityExit:0;for(const S in Em){if(p[S]===void 0)continue;const{correct:_,applyTo:m}=Em[S],x=u.transform==="none"?p[S]:_(p[S],h);if(m){const A=m.length;for(let w=0;w{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(uR),this.root.sharedNodes.clear()}}}function Mk(n){n.updateLayout()}function wk(n){var e;const t=((e=n.resumeFrom)===null||e===void 0?void 0:e.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&t&&n.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:r}=n.layout,{animationType:s}=n.options,o=t.source!==n.layout.source;s==="size"?Xr(h=>{const p=o?t.measuredBox[h]:t.layoutBox[h],g=Cr(p);p.min=i[h].min,p.max=p.min+g}):gR(s,t.layoutBox,i)&&Xr(h=>{const p=o?t.measuredBox[h]:t.layoutBox[h],g=Cr(i[h]);p.max=p.min+g,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[h].max=n.relativeTarget[h].min+g)});const a=ju();cd(a,i,t.layoutBox);const l=ju();o?cd(l,n.applyTransform(r,!0),t.measuredBox):cd(l,i,t.layoutBox);const u=!eR(a);let d=!1;if(!n.resumeFrom){const h=n.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:p,layout:g}=h;if(p&&g){const v=kn();fd(v,t.layoutBox,p.layoutBox);const S=kn();fd(S,i,g.layoutBox),iR(v,S)||(d=!0),h.options.layoutRoot&&(n.relativeTarget=S,n.relativeTargetOrigin=v,n.relativeParent=h)}}}n.notifyListeners("didUpdate",{layout:i,snapshot:t,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(n.isLead()){const{onExitComplete:i}=n.options;i&&i()}n.options.transition=void 0}function Ek(n){pd&&hl.totalNodes++,n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function Ck(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function Tk(n){n.clearSnapshot()}function uR(n){n.clearMeasurements()}function bk(n){n.isLayoutDirty=!1}function Rk(n){const{visualElement:e}=n.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),n.resetTransform()}function cR(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function Pk(n){n.resolveTargetDelta()}function Ik(n){n.calcProjection()}function Bk(n){n.resetSkewAndRotation()}function Lk(n){n.removeLeadSnapshot()}function fR(n,e,t){n.translate=Ln(e.translate,0,t),n.scale=Ln(e.scale,1,t),n.origin=e.origin,n.originPoint=e.originPoint}function dR(n,e,t,i){n.min=Ln(e.min,t.min,i),n.max=Ln(e.max,t.max,i)}function Dk(n,e,t,i){dR(n.x,e.x,t.x,i),dR(n.y,e.y,t.y,i)}function Fk(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const Nk={duration:.45,ease:[.4,0,.1,1]},hR=n=>typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),pR=hR("applewebkit/")&&!hR("chrome/")?Math.round:xi;function mR(n){n.min=pR(n.min),n.max=pR(n.max)}function Uk(n){mR(n.x),mR(n.y)}function gR(n,e,t){return n==="position"||n==="preserve-aspect"&&!OO(rR(e),rR(t),.2)}function Ok(n){var e;return n!==n.root&&((e=n.scroll)===null||e===void 0?void 0:e.wasRoot)}const kk=lR({attachResizeListener:(n,e)=>ho(n,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),tA={current:void 0},vR=lR({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!tA.current){const n=new kk({});n.mount(window),n.setOptions({layoutScroll:!0}),tA.current=n}return tA.current},resetTransform:(n,e)=>{n.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),zk={pan:{Feature:ek},drag:{Feature:$O,ProjectionNode:vR,MeasureLayout:Gb}};function yR(n,e){const t=e?"pointerenter":"pointerleave",i=e?"onHoverStart":"onHoverEnd",r=(s,o)=>{if(s.pointerType==="touch"||j_())return;const a=n.getProps();n.animationState&&a.whileHover&&n.animationState.setActive("whileHover",e);const l=a[i];l&&Xt.postRender(()=>l(s,o))};return ps(n.current,t,r,{passive:!n.getProps()[i]})}class Hk extends oa{mount(){this.unmount=Os(yR(this.node,!0),yR(this.node,!1))}unmount(){}}class Gk extends oa{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Os(ho(this.node.current,"focus",()=>this.onFocus()),ho(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const xR=(n,e)=>e?n===e?!0:xR(n,e.parentElement):!1;function nA(n,e){if(!e)return;const t=new PointerEvent("pointer"+n);e(t,Am(t))}class Vk extends oa{constructor(){super(...arguments),this.removeStartListeners=xi,this.removeEndListeners=xi,this.removeAccessibleListeners=xi,this.startPointerPress=(e,t)=>{if(this.isPressing)return;this.removeEndListeners();const i=this.node.getProps(),s=ps(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:d,globalTapTarget:h}=this.node.getProps(),p=!h&&!xR(this.node.current,a.target)?d:u;p&&Xt.update(()=>p(a,l))},{passive:!(i.onTap||i.onPointerUp)}),o=ps(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(i.onTapCancel||i.onPointerCancel)});this.removeEndListeners=Os(s,o),this.startPress(e,t)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||nA("up",(l,u)=>{const{onTap:d}=this.node.getProps();d&&Xt.postRender(()=>d(l,u))})};this.removeEndListeners(),this.removeEndListeners=ho(this.node.current,"keyup",o),nA("down",(a,l)=>{this.startPress(a,l)})},t=ho(this.node.current,"keydown",e),i=()=>{this.isPressing&&nA("cancel",(s,o)=>this.cancelPress(s,o))},r=ho(this.node.current,"blur",i);this.removeAccessibleListeners=Os(t,r)}}startPress(e,t){this.isPressing=!0;const{onTapStart:i,whileTap:r}=this.node.getProps();r&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),i&&Xt.postRender(()=>i(e,t))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!j_()}cancelPress(e,t){if(!this.checkPressEnd())return;const{onTapCancel:i}=this.node.getProps();i&&Xt.postRender(()=>i(e,t))}mount(){const e=this.node.getProps(),t=ps(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),i=ho(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Os(t,i)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const iA=new WeakMap,rA=new WeakMap,Wk=n=>{const e=iA.get(n.target);e&&e(n)},Xk=n=>{n.forEach(Wk)};function jk(t){var i=t,{root:n}=i,e=Un(i,["root"]);const r=n||document;rA.has(r)||rA.set(r,{});const s=rA.get(r),o=JSON.stringify(e);return s[o]||(s[o]=new IntersectionObserver(Xk,ye({root:n},e))),s[o]}function Jk(n,e,t){const i=jk(e);return iA.set(n,t),i.observe(n),()=>{iA.delete(n),i.unobserve(n)}}const Kk={some:0,all:1};class Yk extends oa{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:t,margin:i,amount:r="some",once:s}=e,o={root:t?t.current:void 0,rootMargin:i,threshold:typeof r=="number"?r:Kk[r]},a=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,s&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:h}=this.node.getProps(),p=u?d:h;p&&p(l)};return Jk(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver=="undefined")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(Qk(e,t))&&this.startObserver()}unmount(){}}function Qk({viewport:n={}},{viewport:e={}}={}){return t=>n[t]!==e[t]}const qk={inView:{Feature:Yk},tap:{Feature:Vk},focus:{Feature:Gk},hover:{Feature:Hk}},Zk={layout:{ProjectionNode:vR,MeasureLayout:Gb}},Cm=me.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"}),Tm=me.createContext({}),sA=typeof window!="undefined",bm=sA?me.useLayoutEffect:me.useEffect,_R=me.createContext({strict:!1});function $k(n,e,t,i,r){var s,o;const{visualElement:a}=me.useContext(Tm),l=me.useContext(_R),u=me.useContext(q_),d=me.useContext(Cm).reducedMotion,h=me.useRef();i=i||l.renderer,!h.current&&i&&(h.current=i(n,{visualState:e,parent:a,props:t,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const p=h.current,g=me.useContext(zb);p&&!p.projection&&r&&(p.type==="html"||p.type==="svg")&&ez(h.current,t,r,g),me.useInsertionEffect(()=>{p&&p.update(t,u)});const v=t[tb],S=me.useRef(!!v&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,v))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,v)));return bm(()=>{p&&(window.MotionIsMounted=!0,p.updateFeatures(),Z_.render(p.render),S.current&&p.animationState&&p.animationState.animateChanges())}),me.useEffect(()=>{p&&(!S.current&&p.animationState&&p.animationState.animateChanges(),S.current&&(queueMicrotask(()=>{var _;(_=window.MotionHandoffMarkAsComplete)===null||_===void 0||_.call(window,v)}),S.current=!1))}),p}function ez(n,e,t,i){const{layoutId:r,layout:s,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:u}=e;n.projection=new t(n.latestValues,e["data-framer-portal-id"]?void 0:AR(n.parent)),n.projection.setOptions({layoutId:r,layout:s,alwaysMeasureLayout:!!o||a&&Xu(a),visualElement:n,animationType:typeof s=="string"?s:"both",initialPromotionConfig:i,layoutScroll:l,layoutRoot:u})}function AR(n){if(n)return n.options.allowProjection!==!1?n.projection:AR(n.parent)}function tz(n,e,t){return me.useCallback(i=>{i&&n.mount&&n.mount(i),e&&(i?e.mount(i):e.unmount()),t&&(typeof t=="function"?t(i):Xu(t)&&(t.current=i))},[e])}function Rm(n){return cm(n.animate)||l_.some(e=>td(n[e]))}function SR(n){return!!(Rm(n)||n.variants)}function nz(n,e){if(Rm(n)){const{initial:t,animate:i}=n;return{initial:t===!1||td(t)?t:void 0,animate:td(i)?i:void 0}}return n.inherit!==!1?e:{}}function iz(n){const{initial:e,animate:t}=nz(n,me.useContext(Tm));return me.useMemo(()=>({initial:e,animate:t}),[MR(e),MR(t)])}function MR(n){return Array.isArray(n)?n.join(" "):n}const wR={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Yu={};for(const n in wR)Yu[n]={isEnabled:e=>wR[n].some(t=>!!e[t])};function rz(n){for(const e in n)Yu[e]=ye(ye({},Yu[e]),n[e])}const sz=Symbol.for("motionComponentSymbol");function ER({preloadedFeatures:n,createVisualElement:e,useRender:t,useVisualState:i,Component:r}){n&&rz(n);function s(a,l){let u;const d=wt(ye(ye({},me.useContext(Cm)),a),{layoutId:oz(a)}),{isStatic:h}=d,p=iz(a),g=i(a,h);if(!h&&sA){az();const v=lz(d);u=v.MeasureLayout,p.visualElement=$k(r,g,d,e,v.ProjectionNode)}return ge.jsxs(Tm.Provider,{value:p,children:[u&&p.visualElement?ge.jsx(u,ye({visualElement:p.visualElement},d)):null,t(r,a,tz(g,p.visualElement,l),g,h,p.visualElement)]})}const o=me.forwardRef(s);return o[sz]=r,o}function oz({layoutId:n}){const e=me.useContext(kb).id;return e&&n!==void 0?e+"-"+n:n}function az(n,e){me.useContext(_R).strict}function lz(n){const{drag:e,layout:t}=Yu;if(!e&&!t)return{};const i=ye(ye({},e),t);return{MeasureLayout:e!=null&&e.isEnabled(n)||t!=null&&t.isEnabled(n)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}const uz=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function oA(n){return typeof n!="string"||n.includes("-")?!1:!!(uz.indexOf(n)>-1||/[A-Z]/u.test(n))}function CR(n,{style:e,vars:t},i,r){Object.assign(n.style,e,r&&r.getProjectionStyles(i));for(const s in t)n.style.setProperty(s,t[s])}const TR=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function bR(n,e,t,i){CR(n,e,void 0,i);for(const r in e.attrs)n.setAttribute(TR.has(r)?r:H_(r),e.attrs[r])}function RR(n,{layout:e,layoutId:t}){return al.has(n)||n.startsWith("origin")||(e||t!==void 0)&&(!!Em[n]||n==="opacity")}function aA(n,e,t){var i;const{style:r}=n,s={};for(const o in r)(Tn(r[o])||e.style&&Tn(e.style[o])||RR(o,n)||((i=t==null?void 0:t.getValue(o))===null||i===void 0?void 0:i.liveStyle)!==void 0)&&(s[o]=r[o]);return s}function PR(n,e,t){const i=aA(n,e,t);for(const r in n)if(Tn(n[r])||Tn(e[r])){const s=nd.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;i[s]=n[r]}return i}function Pm(n){const e=me.useRef(null);return e.current===null&&(e.current=n()),e.current}function cz({scrapeMotionValuesFromProps:n,createRenderState:e,onMount:t},i,r,s){const o={latestValues:fz(i,r,s,n),renderState:e()};return t&&(o.mount=a=>t(i,a,o)),o}const lA=n=>(e,t)=>{const i=me.useContext(Tm),r=me.useContext(q_),s=()=>cz(n,e,i,r);return t?s():Pm(s)};function fz(n,e,t,i){const r={},s=i(n,{});for(const g in s)r[g]=hd(s[g]);let{initial:o,animate:a}=n;const l=Rm(n),u=SR(n);e&&u&&!l&&n.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=t?t.initial===!1:!1;d=d||o===!1;const h=d?a:o;if(h&&typeof h!="boolean"&&!cm(h)){const g=Array.isArray(h)?h:[h];for(let v=0;v({style:{},transform:{},transformOrigin:{},vars:{}}),IR=()=>wt(ye({},uA()),{attrs:{}}),BR=(n,e)=>e&&typeof n=="number"?e.transform(n):n,dz={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},hz=nd.length;function pz(n,e,t){let i="",r=!0;for(let s=0;stypeof n=="string"&&n.toLowerCase()==="svg",xz={useVisualState:lA({scrapeMotionValuesFromProps:PR,createRenderState:IR,onMount:(n,e,{renderState:t,latestValues:i})=>{Xt.read(()=>{try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch(r){t.dimensions={x:0,y:0,width:0,height:0}}}),Xt.render(()=>{fA(t,i,dA(e.tagName),n.transformTemplate),bR(e,t)})}})},_z={useVisualState:lA({scrapeMotionValuesFromProps:aA,createRenderState:uA})};function DR(n,e,t){for(const i in e)!Tn(e[i])&&!RR(i,t)&&(n[i]=e[i])}function Az({transformTemplate:n},e){return me.useMemo(()=>{const t=uA();return cA(t,e,n),Object.assign({},t.vars,t.style)},[e])}function Sz(n,e){const t=n.style||{},i={};return DR(i,t,n),Object.assign(i,Az(n,e)),i}function Mz(n,e){const t={},i=Sz(n,e);return n.drag&&n.dragListener!==!1&&(t.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(t.tabIndex=0),t.style=i,t}const wz=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Im(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||wz.has(n)}let FR=n=>!Im(n);function Ez(n){n&&(FR=e=>e.startsWith("on")?!Im(e):n(e))}try{Ez(require("@emotion/is-prop-valid").default)}catch(n){}function NR(n,e,t){const i={};for(const r in n)r==="values"&&typeof n.values=="object"||(FR(r)||t===!0&&Im(r)||!e&&!Im(r)||n.draggable&&r.startsWith("onDrag"))&&(i[r]=n[r]);return i}function Cz(n,e,t,i){const r=me.useMemo(()=>{const s=IR();return fA(s,e,dA(i),n.transformTemplate),wt(ye({},s.attrs),{style:ye({},s.style)})},[e]);if(n.style){const s={};DR(s,n.style,n),r.style=ye(ye({},s),r.style)}return r}function Tz(n=!1){return(t,i,r,{latestValues:s},o)=>{const l=(oA(t)?Cz:Mz)(i,s,o,t),u=NR(i,typeof t=="string",n),d=t!==me.Fragment?wt(ye(ye({},u),l),{ref:r}):{},{children:h}=i,p=me.useMemo(()=>Tn(h)?h.get():h,[h]);return me.createElement(t,wt(ye({},d),{children:p}))}}function bz(n,e){return function(i,{forwardMotionProps:r}={forwardMotionProps:!1}){const s=oA(i)?xz:_z,o=wt(ye({},s),{preloadedFeatures:n,useRender:Tz(r),createVisualElement:e,Component:i});return ER(o)}}const hA={current:null},UR={current:!1};function Rz(){if(UR.current=!0,!!sA)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),e=()=>hA.current=n.matches;n.addListener(e),e()}else hA.current=!1}function Pz(n,e,t){for(const i in e){const r=e[i],s=t[i];if(Tn(r))n.addValue(i,r);else if(Tn(s))n.addValue(i,ks(r,{owner:n}));else if(s!==r)if(n.hasValue(i)){const o=n.getValue(i);o.liveStyle===!0?o.jump(r):o.hasAnimated||o.set(r)}else{const o=n.getStaticValue(i);n.addValue(i,ks(o!==void 0?o:r,{owner:n}))}}for(const i in t)e[i]===void 0&&n.removeValue(i);return e}const OR=new WeakMap,Iz=[..._T,bi,sa],Bz=n=>Iz.find(xT(n)),kR=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class zR{scrapeMotionValuesFromProps(e,t,i){return{}}constructor({parent:e,props:t,presenceContext:i,reducedMotionConfig:r,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=v_,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const g=Us.now();this.renderScheduledAtthis.bindToMotionValue(i,t)),UR.current||Rz(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:hA.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){OR.delete(this.current),this.projection&&this.projection.unmount(),hs(this.notifyUpdate),hs(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}bindToMotionValue(e,t){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const i=al.has(e),r=t.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Xt.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0)}),s=t.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),s(),o&&o(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Yu){const t=Yu[e];if(!t)continue;const{isEnabled:i,Feature:r}=t;if(!this.features[e]&&r&&i(this.props)&&(this.features[e]=new r(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):kn()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let i=0;it.variantChildren.delete(e)}addValue(e,t){const i=this.values.get(e);t!==i&&(i&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let i=this.values.get(e);return i===void 0&&t!==void 0&&(i=ks(t===null?void 0:t,{owner:this}),this.addValue(e,i)),i}readValue(e,t){var i;let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(i=this.getBaseTargetFromProps(this.props,e))!==null&&i!==void 0?i:this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(fT(r)||cT(r))?r=parseFloat(r):!Bz(r)&&sa.test(t)&&(r=IT(e,t)),this.setBaseTarget(e,Tn(r)?r.get():r)),Tn(r)?r.get():r}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;const{initial:i}=this.props;let r;if(typeof i=="string"||typeof i=="object"){const o=o_(this.props,i,(t=this.presenceContext)===null||t===void 0?void 0:t.custom);o&&(r=o[e])}if(i&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Tn(s)?s:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new z_),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}}class HR extends zR{constructor(){super(...arguments),this.KeyframeResolver=BT}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:i}){delete t[e],delete i[e]}}function Lz(n){return window.getComputedStyle(n)}class Dz extends HR{constructor(){super(...arguments),this.type="html",this.renderInstance=CR}readValueFromInstance(e,t){if(al.has(t)){const i=w_(t);return i&&i.default||0}else{const i=Lz(e),r=(hT(t)?i.getPropertyValue(t):i[t])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Nb(e,t)}build(e,t,i){cA(e,t,i.transformTemplate)}scrapeMotionValuesFromProps(e,t,i){return aA(e,t,i)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Tn(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}class Fz extends HR{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=kn}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(al.has(t)){const i=w_(t);return i&&i.default||0}return t=TR.has(t)?t:H_(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,i){return PR(e,t,i)}build(e,t,i){fA(e,t,this.isSVGTag,i.transformTemplate)}renderInstance(e,t,i,r){bR(e,t,i,r)}mount(e){this.isSVGTag=dA(e.tagName),super.mount(e)}}const Nz=(n,e)=>oA(n)?new Fz(e):new Dz(e,{allowProjection:n!==me.Fragment}),Uz=bz(ye(ye(ye(ye({},ob),qk),zk),Zk),Nz),Xi=E3(Uz);function GR(n){const e=Pm(()=>ks(n)),{isStatic:t}=me.useContext(Cm);if(t){const[,i]=me.useState(n);me.useEffect(()=>e.on("change",i),[])}return e}function VR(n,e){const t=GR(e()),i=()=>t.set(e());return i(),bm(()=>{const r=()=>Xt.preRender(i,!1,!0),s=n.map(o=>o.on("change",r));return()=>{s.forEach(o=>o()),hs(i)}}),t}const Oz=n=>n&&typeof n=="object"&&n.mix,kz=n=>Oz(n)?n.mix:void 0;function zz(...n){const e=!Array.isArray(n[0]),t=e?0:-1,i=n[0+t],r=n[1+t],s=n[2+t],o=n[3+t],a=D_(r,s,ye({mixer:kz(s[0])},o));return e?a(i):a}function Hz(n){ud.current=[],n();const e=VR(ud.current,n);return ud.current=void 0,e}function lr(n,e,t,i){if(typeof n=="function")return Hz(n);const r=typeof e=="function"?e:zz(e,t,i);return Array.isArray(n)?WR(n,r):WR([n],([s])=>r(s))}function WR(n,e){const t=Pm(()=>[]);return VR(n,()=>{t.length=0;const i=n.length;for(let r=0;r{}),a=()=>{const u=i.current;u&&u.time===0&&u.sample(si.delta),l(),i.current=qU(wt(ye({keyframes:[r.get(),s.current],velocity:r.getVelocity(),type:"spring",restDelta:.001,restSpeed:.01},e),{onUpdate:o.current}))},l=()=>{i.current&&i.current.stop()};return me.useInsertionEffect(()=>r.attach((u,d)=>t?d(u):(s.current=u,o.current=d,Xt.update(a),r.get()),l),[JSON.stringify(e)]),bm(()=>{if(Tn(n))return n.on("change",u=>r.set(XR(u)))},[r]),r}function Gz(n,e,t){return typeof n=="string"?n=document.querySelectorAll(n):n instanceof Element&&(n=[n]),Array.from(n||[])}const Lm=new WeakMap;let aa;function Vz(n,e){if(e){const{inlineSize:t,blockSize:i}=e[0];return{width:t,height:i}}else return n instanceof SVGElement&&"getBBox"in n?n.getBBox():{width:n.offsetWidth,height:n.offsetHeight}}function Wz({target:n,contentRect:e,borderBoxSize:t}){var i;(i=Lm.get(n))===null||i===void 0||i.forEach(r=>{r({target:n,contentSize:e,get size(){return Vz(n,t)}})})}function Xz(n){n.forEach(Wz)}function jz(){typeof ResizeObserver!="undefined"&&(aa=new ResizeObserver(Xz))}function Jz(n,e){aa||jz();const t=Gz(n);return t.forEach(i=>{let r=Lm.get(i);r||(r=new Set,Lm.set(i,r)),r.add(e),aa==null||aa.observe(i)}),()=>{t.forEach(i=>{const r=Lm.get(i);r==null||r.delete(e),r!=null&&r.size||aa==null||aa.unobserve(i)})}}const Dm=new Set;let md;function Kz(){md=()=>{const n={width:window.innerWidth,height:window.innerHeight},e={target:window,size:n,contentSize:n};Dm.forEach(t=>t(e))},window.addEventListener("resize",md)}function Yz(n){return Dm.add(n),md||Kz(),()=>{Dm.delete(n),!Dm.size&&md&&(md=void 0)}}function Qz(n,e){return typeof n=="function"?Yz(n):Jz(n,e)}const qz=50,jR=()=>({current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}),Zz=()=>({time:0,x:jR(),y:jR()}),$z={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function JR(n,e,t,i){const r=t[e],{length:s,position:o}=$z[e],a=r.current,l=t.time;r.current=n[`scroll${o}`],r.scrollLength=n[`scroll${s}`]-n[`client${s}`],r.offset.length=0,r.offset[0]=0,r.offset[1]=r.scrollLength,r.progress=cl(0,r.scrollLength,r.current);const u=i-l;r.velocity=u>qz?0:C_(r.current-a,u)}function eH(n,e,t){JR(n,"x",e,t),JR(n,"y",e,t),e.time=t}function tH(n,e){const t={x:0,y:0};let i=n;for(;i&&i!==e;)if(i instanceof HTMLElement)t.x+=i.offsetLeft,t.y+=i.offsetTop,i=i.offsetParent;else if(i.tagName==="svg"){const r=i.getBoundingClientRect();i=i.parentElement;const s=i.getBoundingClientRect();t.x+=r.left-s.left,t.y+=r.top-s.top}else if(i instanceof SVGGraphicsElement){const{x:r,y:s}=i.getBBox();t.x+=r,t.y+=s;let o=null,a=i.parentNode;for(;!o;)a.tagName==="svg"&&(o=a),a=i.parentNode;i=o}else break;return t}const nH={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},pA={start:0,center:.5,end:1};function KR(n,e,t=0){let i=0;if(n in pA&&(n=pA[n]),typeof n=="string"){const r=parseFloat(n);n.endsWith("px")?i=r:n.endsWith("%")?n=r/100:n.endsWith("vw")?i=r/100*document.documentElement.clientWidth:n.endsWith("vh")?i=r/100*document.documentElement.clientHeight:n=r}return typeof n=="number"&&(i=e*n),t+i}const iH=[0,0];function rH(n,e,t,i){let r=Array.isArray(n)?n:iH,s=0,o=0;return typeof n=="number"?r=[n,n]:typeof n=="string"&&(n=n.trim(),n.includes(" ")?r=n.split(" "):r=[n,pA[n]?n:"0"]),s=KR(r[0],t,i),o=KR(r[1],e),s-o}const sH={x:0,y:0};function oH(n){return"getBBox"in n&&n.tagName!=="svg"?n.getBBox():{width:n.clientWidth,height:n.clientHeight}}function aH(n,e,t){const{offset:i=nH.All}=t,{target:r=n,axis:s="y"}=t,o=s==="y"?"height":"width",a=r!==n?tH(r,n):sH,l=r===n?{width:n.scrollWidth,height:n.scrollHeight}:oH(r),u={width:n.clientWidth,height:n.clientHeight};e[s].offset.length=0;let d=!e[s].interpolate;const h=i.length;for(let p=0;plH(n,i.target,t),update:r=>{eH(n,t,r),(i.offset||i.target)&&aH(n,t,i)},notify:()=>e(t)}}const gd=new WeakMap,YR=new WeakMap,mA=new WeakMap,QR=n=>n===document.documentElement?window:n;function gA(n,i={}){var r=i,{container:e=document.documentElement}=r,t=Un(r,["container"]);let s=mA.get(e);s||(s=new Set,mA.set(e,s));const o=Zz(),a=uH(e,n,o,t);if(s.add(a),!gd.has(e)){const u=()=>{for(const v of s)v.measure()},d=()=>{for(const v of s)v.update(si.timestamp)},h=()=>{for(const v of s)v.notify()},p=()=>{Xt.read(u,!1,!0),Xt.read(d,!1,!0),Xt.update(h,!1,!0)};gd.set(e,p);const g=QR(e);window.addEventListener("resize",p,{passive:!0}),e!==document.documentElement&&YR.set(e,Qz(e,p)),g.addEventListener("scroll",p,{passive:!0})}const l=gd.get(e);return Xt.read(l,!1,!0),()=>{var u;hs(l);const d=mA.get(e);if(!d||(d.delete(a),d.size))return;const h=gd.get(e);gd.delete(e),h&&(QR(e).removeEventListener("scroll",h),(u=YR.get(e))===null||u===void 0||u(),window.removeEventListener("resize",h))}}function qR(n,e){let t;const i=()=>{const{currentTime:r}=e,o=(r===null?0:r.value)/100;t!==o&&n(o),t=o};return Xt.update(i,!0),()=>hs(i)}function cH({source:n,container:e,axis:t="y"}){n&&(e=n);const i={value:0},r=gA(s=>{i.value=s[t].progress*100},{container:e,axis:t});return{currentTime:i,cancel:r}}const vA=new Map;function ZR({source:n,container:e=document.documentElement,axis:t="y"}={}){n&&(e=n),vA.has(e)||vA.set(e,{});const i=vA.get(e);return i[t]||(i[t]=$T()?new ScrollTimeline({source:e,axis:t}):cH({source:e,axis:t})),i[t]}function fH(n){return n.length===2}function $R(n){return n&&(n.target||n.offset)}function dH(n,e){return fH(n)||$R(e)?gA(t=>{n(t[e.axis].progress,t)},e):qR(n,ZR(e))}function hH(n,e){if($R(e))return n.pause(),gA(t=>{n.time=n.duration*t[e.axis].progress},e);{const t=ZR(e);return n.attachTimeline(t,i=>(i.pause(),qR(r=>{i.time=i.duration*r},t)))}}function pH(n,i={}){var r=i,{axis:e="y"}=r,t=Un(r,["axis"]);const s=ye({axis:e},t);return typeof n=="function"?dH(n,s):hH(n,s)}function eP(n,e){k3(!!(!e||e.current))}const mH=()=>({scrollX:ks(0),scrollY:ks(0),scrollXProgress:ks(0),scrollYProgress:ks(0)});function tP(r={}){var s=r,{container:n,target:e,layoutEffect:t=!0}=s,i=Un(s,["container","target","layoutEffect"]);const o=Pm(mH);return(t?bm:me.useEffect)(()=>(eP("target",e),eP("container",n),pH((l,{x:u,y:d})=>{o.scrollX.set(u.current),o.scrollXProgress.set(u.progress),o.scrollY.set(d.current),o.scrollYProgress.set(d.progress)},wt(ye({},i),{container:(n==null?void 0:n.current)||void 0,target:(e==null?void 0:e.current)||void 0}))),[n,e,JSON.stringify(i.offset)]),o}let yA=class extends me.Component{constructor(){super(...arguments);tF(this,"state",{hasError:!1})}static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,i){console.error("Uncaught error:",t,i)}render(){return this.state.hasError?this.props.fallback:this.props.children}};const Jr=(n,e,t,i)=>{const r=n.target,s={event:"custEv_contentClick",blade:{id:e,name:"sf/open",source:"www",variant:"dc-overview-refresh",position:i||1,state:"rendered",module:{id:e,name:t,link:{url:r.getAttribute("href"),text:r.innerText,elementType:r.tagName}}}};console.log("-- CLICK TRACKING QA --"),console.log(s),window.dataLayer.push(ye({},s))},nP=({position:n,x:e})=>n==="right"?ge.jsx(Xi.div,{initial:{opacity:0},animate:{opacity:1},style:{x:e},className:"data-dust absolute right-[8%] top-[-8%] z-30 w-[50px] sm:w-[150px] visible max-sm:hidden",children:ge.jsx("img",{src:"https://wp.salesforce.com/en-us/wp-content/uploads/sites/4/2024/07/3D-DataDust-1.png?w=100",alt:""})}):ge.jsx(Xi.div,{initial:{opacity:0},animate:{opacity:1},style:{x:e},className:"data-dust absolute visible left-[2%] top-[22%] z-30 w-[60px] sm:w-[160px] max-sm:hidden",children:ge.jsx("img",{src:"https://wp.salesforce.com/en-us/wp-content/uploads/sites/4/2024/07/3D-DataDust-1.png?w=100",alt:""})});var iP={exports:{}};(function(n,e){(function(i,r){n.exports=r()})(window,function(){return function(t){var i={};function r(s){if(i[s])return i[s].exports;var o=i[s]={i:s,l:!1,exports:{}};return t[s].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=i,r.d=function(s,o,a){r.o(s,o)||Object.defineProperty(s,o,{enumerable:!0,get:a})},r.r=function(s){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},r.t=function(s,o){if(o&1&&(s=r(s)),o&8||o&4&&typeof s=="object"&&s&&s.__esModule)return s;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:s}),o&2&&typeof s!="string")for(var l in s)r.d(a,l,function(u){return s[u]}.bind(null,l));return a},r.n=function(s){var o=s&&s.__esModule?function(){return s.default}:function(){return s};return r.d(o,"a",o),o},r.o=function(s,o){return Object.prototype.hasOwnProperty.call(s,o)},r.p="",r(r.s=6)}([function(t,i){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(s){typeof window=="object"&&(r=window)}t.exports=r},function(t,i,r){function s(){return s=Object.assign||function(w){for(var I=1;I-1&&(_=_.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var m=_.replace(/^\s+/,"").replace(/\(eval code/g,"(").split(/\s+/).slice(1),x=this.extractLocation(m.pop()),A=m.join(" ")||void 0,w=["eval",""].indexOf(x[0])>-1?void 0:x[0];return new u({functionName:A,fileName:w,lineNumber:x[1],columnNumber:x[2],source:_})},this)},parseFFOrSafari:function(v){var S=v.stack.split(` `).filter(function(_){return!_.match(p)},this);return S.map(function(_){if(_.indexOf(" > eval")>-1&&(_=_.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),_.indexOf("@")===-1&&_.indexOf(":")===-1)return new u({functionName:_});var m=/((.*".+"[^@]*)?[^@]*)(?:@)/,x=_.match(m),A=x&&x[1]?x[1]:void 0,w=this.extractLocation(_.replace(m,""));return new u({functionName:A,fileName:w[0],lineNumber:w[1],columnNumber:w[2],source:_})},this)},parseOpera:function(v){return!v.stacktrace||v.message.indexOf(` `)>-1&&v.message.split(` `).length>v.stacktrace.split(` `).length?this.parseOpera9(v):v.stack?this.parseOpera11(v):this.parseOpera10(v)},parseOpera9:function(v){for(var S=/Line (\d+).*script (?:in )?(\S+)/i,_=v.message.split(` `),m=[],x=2,A=_.length;x/,"$2").replace(/\([^\)]*\)/g,"")||void 0,I;A.match(/\(([^\)]*)\)/)&&(I=A.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var P=I===void 0||I==="[arguments not available]"?void 0:I.split(",");return new u({functionName:w,args:P,fileName:x[0],lineNumber:x[1],columnNumber:x[2],source:_})},this)}}})},function(t,i,r){Object.defineProperty(i,"__esModule",{value:!0});var s=function(){function o(a){var l=a===void 0?{emit:!1,logger:console.log}:a,u=l.emit,d=l.logger;this.emit=u,this.externalLogger=d,this.buffer=[],this.customLevel={},this.error=this.setLevel(1),this.warn=this.setLevel(2),this.info=this.setLevel(3),this.log=this.setLevel(4)}return o.prototype.getLogs=function(a){return typeof a=="function"?this.buffer.filter(function(l){return l.level===a.level}):a?this.buffer.filter(function(l){return l.level===a}):this.buffer},o.prototype.setLevel=function(a){var l=this,u=function(){for(var d=[],h=0;h '+k+" ":k};return'
'+L('')+"
"},Ke=function(b){var C=document.createElement("script");return C.type="application/ld+json",C.text=JSON.stringify(b),C},kt=function(b){return new u(function(C,L){return K({error:L,success:C,url:""+Et()+b+Me,uuid:"style_"+b})})},Ct=function(b){return new u(function(C,L){return K({error:L,success:C,url:""+Et()+b+de,uuid:"integrations_"+b})})},et=function(b){return new u(function(C,L){return K({error:L,success:C,url:""+Et()+b+re,uuid:"details_"+b})})},Tt=function(b,C){return new u(function(L,k){var j=encodeURIComponent(C),ue=""+Et()+b+"/contact/"+j+"/marketoContact.js";K({error:k,success:L,url:ue,uuid:"marketoContact_"+b})})},Ft=function(b){var C=b.error,L=b.url,k=b.requestUuid,j=document.createElement("script");return j.type="application/javascript",j.onerror=C,j.src=L+"?callback=window.VidyardV4.jsonp."+k+".done",j.setAttribute("data-playbackurl",$e()),document.body.appendChild(j),j},sn={},K=function(b){var C=b.url,L=b.uuid,k=b.success,j=b.error,ue=L.replace(/-/g,""),he=Ft({error:j,url:C,requestUuid:ue}),Fe=I(function(Je){k(Je),he.parentNode.removeChild(he)});sn[ue]=sn[ue]||[],sn[ue].push(Fe),window.VidyardV4.jsonp[ue]={done:function(Je){sn[ue].forEach(function(gt){return gt(Je)})}}},Le={errors:{placeholder:"Cannot render the player, check the placeholder Image"}},_e=function(b,C){var L={};for(var k in b)Object.prototype.hasOwnProperty.call(b,k)&&C.indexOf(k)<0&&(L[k]=b[k]);if(b!=null&&typeof Object.getOwnPropertySymbols=="function")for(var j=0,k=Object.getOwnPropertySymbols(b);j=ot*2;z(L.container,"playlist-open",pt)}k("getStyle sent"),kt(L.uuid).then(function(pt){k("getStyle received: "+JSON.stringify(pt));var Nn=pt.pl===1&&C.playlist_always_open!=="0"||C.playlist_always_open==="1";Nn?(L.iframe.parentElement.setAttribute("data-pl","true"),d("resize","onresize",gt),gt()):L.iframe.parentElement.setAttribute("data-pl","false")}).catch(function(pt){k("getStyle failed, likely a network error")})},wn=Vt,Kn=function(b){b===void 0&&(b=document.body);for(var C=0,L=Array.from(b.children);C=0}).sort(te)},Xe=["button:enabled:not([readonly])","select:enabled:not([readonly])","textarea:enabled:not([readonly])","input:enabled:not([readonly])","a[href]","area[href]","iframe","object","embed","[tabindex]","[contenteditable]","[autofocus]"],nt=Xe.join(","),Ze=function(C,L){return C.reduce(function(k,j){return k.concat(Vn(j.querySelectorAll(nt)),j.parentNode?Vn(j.parentNode.querySelectorAll(Xe.join(","))).filter(function(ue){return ue===j}):[])},[])},ht=function(C){var L=C.querySelectorAll("["+ba+"]");return Vn(L).map(function(k){return Ze([k])}).reduce(function(k,j){return k.concat(j)},[])},yt=function(C){return!C||!C.getPropertyValue?!1:C.getPropertyValue("display")==="none"||C.getPropertyValue("visibility")==="hidden"},ft=function b(C){return!C||C===document||C.nodeType===Node.DOCUMENT_NODE||!yt(window.getComputedStyle(C,null))&&b(C.parentNode)},Yt=function(C){return!((C.tagName==="INPUT"||C.tagName==="BUTTON")&&(C.type==="hidden"||C.disabled))},ln=function b(C){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return L.push(C),C.parentNode&&b(C.parentNode,L),L},en=function(C,L){for(var k=ln(C),j=ln(L),ue=0;ue=0)return he}return!1},xn=function(C){return Vn(C).filter(function(L){return ft(L)}).filter(function(L){return Yt(L)})},st=function(C,L){return De(xn(Ze(C)),!0)},Ue=function(C){return De(xn(Ze(C)),!1)},fn=function(C){return xn(ht(C))},At=function(C){return C.tagName==="INPUT"&&C.type==="radio"},un=function(C,L){return L.filter(At).filter(function(k){return k.name===C.name}).filter(function(k){return k.checked})[0]||C},Ui=function(C){return C[0]&&C.length>1&&At(C[0])&&C[0].name?un(C[0],C):C[0]},Fn=function(C,L){return C.length>1&&At(C[L])&&C[L].name?C.indexOf(un(C[L],C)):L},Yn=Ui,hn=function(C){return function(L){return!!L.autofocus||L.dataset&&!!L.dataset.autofocus||C.indexOf(L)>=0}},dr=function(C){return C&&C.dataset&&C.dataset.focusGuard},js=function(C){return!dr(C)},ci=function(C,L,k,j,ue){var he=C.length,Fe=C[0],Je=C[he-1],gt=dr(k);if(!(C.indexOf(k)>=0)){var pt=L.indexOf(k),Nn=L.indexOf(j||pt),Wn=C.indexOf(j),qt=pt-Nn,Ps=L.indexOf(Fe),Ge=L.indexOf(Je),at=Fn(C,0),bt=Fn(C,he-1);if(pt===-1||Wn===-1)return C.indexOf(ue&&ue.length?Yn(ue):Yn(C));if(!qt&&Wn>=0)return Wn;if(pt<=Ps&>&&Math.abs(qt)>1)return bt;if(pt>=Ps&>&&Math.abs(qt)>1)return at;if(qt&&Math.abs(qt)>1)return Wn;if(pt<=Ps)return bt;if(pt>Ge)return at;if(qt)return Math.abs(qt)>1?Wn:(he+Wn+qt)%he}},Pa=function(C,L,k){var j=Dr(C),ue=Dr(L),he=j[0],Fe=null;return ue.filter(Boolean).forEach(function(Je){Fe=en(Fe||Je,Je)||Fe,k.filter(Boolean).forEach(function(gt){var pt=en(he,gt);pt&&(!Fe||pt.contains(Fe)?Fe=pt:Fe=en(pt,Fe))})}),Fe},qi=function(C){return C.reduce(function(L,k){return L.concat(fn(k))},[])},Yc=function(C,L){var k=new Map;return L.forEach(function(j){return k.set(j.node,j)}),C.map(function(j){return k.get(j)}).filter(Boolean)},HM=function(C,L){var k=document&&document.activeElement,j=Kc(C).filter(js),ue=Pa(k||C,C,j),he=st(j).filter(function(Nn){var Wn=Nn.node;return js(Wn)});if(!(!he[0]&&(he=Ue(j).filter(function(Nn){var Wn=Nn.node;return js(Wn)}),!he[0]))){var Fe=st([ue]).map(function(Nn){var Wn=Nn.node;return Wn}),Je=Yc(Fe,he),gt=Je.map(function(Nn){var Wn=Nn.node;return Wn}),pt=ci(gt,Fe,k,L,gt.filter(hn(qi(j))));return pt===void 0?pt:Je[pt]}},GM=HM,Qc=function(C){C.focus(),C.contentWindow&&C.contentWindow.focus()},Ia=0,Bo=!1,qc=function(b,C){var L=GM(b,C);if(!Bo&&L){if(Ia>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),Bo=!0,setTimeout(function(){Bo=!1},1);return}Ia++,Qc(L.node),Ia--}},VM=qc,Ah=0,Zc=null,Sh=function(){return document&&document.activeElement===document.body},eu=function(){return Sh()||Ra()},WM=function(){var C=!1;if(Ah){var L=Ah;eu()||(L&&!le(L)&&(C=VM(L,Zc)),Zc=document.activeElement)}return C},Mh=function(C){return C.filter(function(L){return L}).slice(-1)[0]},Qt=function(C){Ah=C,C&&WM()},Js=[],Ba=function(C){return Qt(Mh(Js))?(C&&C.preventDefault(),!0):!1},$v=function(){document.addEventListener("focusin",Ba)},XM=function(){document.removeEventListener("focusin",Ba)},jM={on:function(C){Js.length===0&&$v(),Js.indexOf(C)<0&&(Js.push(C),Ba())},off:function(C){Js=Js.filter(function(L){return L!==C}),Ba(),Js.length===0&&XM()}},Qn=jM,wh=r(1),e0=r.n(wh);function Eh(b,C,L){var k=YM(b),j=$r(L),ue=es(C),he=document.createElement("div");return he.id="vidyard-focusable-element",he.tabIndex=0,j.popbox.appendChild(k.backerElement),j.popbox.appendChild(k.containingDiv),j.popbox.appendChild(ue),Qi.ios()&&Kn(),document.body.appendChild(j.overlayWrapper),document.body.appendChild(he),j.closeContainer.focus(),Qn.on(j.overlayWrapper),e0.a.trap(j.overlayWrapper),setTimeout(function(){j.overlayWrapper.style.opacity="1",j.overlayWrapper.style.filter="alpha(opacity=100)"},0),{container:k,lightbox:j}}function JM(b){var C=document.getElementById("vidyard-content-fixed"),L=document.getElementById("vidyard-focusable-element"),k=document.getElementById("vidyard-overlay"),j=document.getElementById("vidyard-overlay-wrapper"),ue=document.getElementById("vidyard-popbox");if(!(!C||!k||!j||!ue)){L&&L.parentNode.removeChild(L),Qn.off(j),e0.a.untrap(j),j.style.opacity="0",j.style.filter="alpha(opacity=0)";var he=function(){j.parentNode.removeChild(j)};Qi.ios()&&Jt(),setTimeout(he,Ce*1e3)}}function $c(b){b.style.opacity="1"}function $r(b){var C=document.createElement("div"),L=document.createElement("div"),k=document.createElement("div"),j=document.createElement("div"),ue=KM().closeContainer;return C.id="vidyard-overlay",C.setAttribute("aria-hidden","true"),C.style.display="block",L.id="vidyard-content-fixed",L.setAttribute("aria-label","media player lightbox"),L.setAttribute("role","dialog"),L.style.display="block",k.id="vidyard-popbox",j.id="vidyard-overlay-wrapper",j.style.display="block",L.appendChild(k),j.appendChild(C),j.appendChild(ue),j.appendChild(L),b&&(C.style.zIndex=""+b,L.style.zIndex=""+(b+2),ue.style.zIndex=""+(b+1)),{closeContainer:ue,contentFixed:L,overlay:C,overlayWrapper:j,popbox:k}}function KM(){var b=document.createElement("div"),C=document.createElement("div");return b.className="vidyard-close-container",b.setAttribute("aria-label","Close Player"),b.setAttribute("role","button"),b.setAttribute("tabindex","0"),C.className="vidyard-close-x",document.documentMode<9&&(C.className+=" simple-close",C.innerHTML="×"),b.appendChild(C),{closeButton:C,closeContainer:b}}function YM(b){var C=document.createElement("div");C.className="vidyard-lightbox-content-backer";var L=document.createElement("div");L.innerHTML=b;var k=L.getElementsByTagName("div")[0];k.style.position="absolute",k.style.height="100%",k.style.width="100%",k.style.zIndex="2";var j=L.getElementsByTagName("iframe")[0],ue=j.parentNode;return ue.style.position="static",ue.style.paddingBottom="0",j.style.opacity="1",setTimeout(function(){C.style.opacity="1",C.style.filter="alpha(opacity=100)"},0),{backerElement:C,containerElement:L,containingDiv:k,iframe:j}}function es(b){var C=_("vidyard-lightbox-image","img",b)[0].cloneNode();return C.className="",C.id="vidyard-popbox-constraint",C.alt="",C.setAttribute("aria-hidden","true"),C}var Fr,hr={};function Ch(b){var C=_("vidyard-lightbox-centering","div",b.container)[0];b.player.showLightbox=function(){ve.setLevel(b.player.uuid)("show lightbox"),t0({container:b.container,iframe:b.iframe,overlayZindex:b.overlayZindex,player:b.player})},b.player.hideLightbox=function(){return Ai(b.player)},d("click","onclick",b.player.showLightbox,C),d("keydown","onkeydown",P(function(L){L.preventDefault(),b.player.showLightbox(L)}),C)}function t0(b){if(!(!b.iframe||document.getElementById("vidyard-overlay"))){Fr=document.activeElement;var C=Eh(b.iframe,b.container,b.overlayZindex);b.player.iframe=C.container.iframe,b.player.on("metadata",function he(Fe){var Je=Fe[0];b.player.iframe.title=Je.name,b.player.off("metadata",he)});var L=b.player.uuid,k=C.container.iframe,j=ef(k,L,b.player),ue=qM(k,L);hr.iframeLoaded=d("load","onload",j,C.container.iframe),hr.messageHandler=d("message","onmessage",H(function(he){j(),ue(),QM(he,b.player)}),window),hr.overlayClick=d("click","onclick",function(){return Ai(b.player)},C.lightbox.overlayWrapper),hr.fixedClick=d("click","onclick",function(){return Ai(b.player)},C.lightbox.contentFixed),hr.closeKeyPress=d("keydown","onkeydown",P(function(){return Ai(b.player)}),C.lightbox.closeContainer),hr.responsivePlayerSize=d("resize","onresize",n0,window)}}function n0(){var b=document.getElementById("vidyard-popbox-constraint"),C=parseFloat((window.innerHeight/window.innerWidth*100).toFixed(2)),L=parseFloat(m(b)),k=C
video thumbnail
'}var bh=function(b){var C=b.dataParams,L=b.player,k=ve.setLevel(C.uuid);k("injecting lighbox embed"),L.placeholder.style.display="none";var j={ratio:m(L.placeholder)},ue=Pe(C,j),he={maxHeight:C.height?parseInt(C.height,10):null,maxWidth:C.width?parseInt(C.width,10):null,ratio:m(L.placeholder)};tf(L.container,C,he),Ch({container:L.container,iframe:ue,overlayZindex:C.overlayZindex,player:L}),k("getStyle sent"),kt(L.uuid).then(function(Fe){k("getStyle received: "+JSON.stringify(Fe)),La(Fe,L.container)}).catch(function(Fe){k("getStyle failed, likely a network error")})},i0=bh,Rh=/(vidyard|vystaging|hubspot)\.com$/,Ph=function(b,C,L){if(L===void 0&&(L=!1),!(!L&&(!C||!C.hasBacklink||Rh.test(document.location.host)))){var k=document.createElement("a"),j=document.createElement("span"),ue=document.createElement("img");ue.src="https://cdn.vidyard.com/client-logos/vidyard.png",ue.id="backlink-icon",ue.alt="Vidyard Logo",j.id="backlink-text",j.textContent="Powered by Vidyard",k.id="backlink",k.appendChild(ue),k.appendChild(j),k.href=C.backlinkURL,k.rel="nofollow",k.target="_blank",k.setAttribute("aria-label","Link to Vidyard"),k.dataset.testid="backlink",d("click","onclick",function(){var he={data:{event:"Acquisition - Clicked the Backlink"},event:"sendMetricsEvent",uuid:b.uuid};Mt(he,"https://"+$e(),b.iframe)},k),b.container.appendChild(k)}},Da=Ph;function pr(b){var C=window.VidyardV4.integrations,L=ve.setLevel(b.uuid),k=C.getCookie("marketo");k&&(L("getMarketoLead sent"),Tt(b.uuid,k).then(F).then(function(j){L("getMarketoLead received: "+j),b.on("ready",function(){C.addKnownVisitor("marketo",j,b.org)})}).catch(function(){ve.warn("Invalid Marketo cookie")})),L("getIntegrations"),Ct(b.uuid).then(function(j){L("getIntegrations received: "+JSON.stringify(j)),b.on("ready",function(){b._tmpOrg=j,C.updatePlayer(b)})}).catch(function(j){L("getIntegrations failed, likely a network error")})}function ts(b){var C=ve.setLevel(b);return C("getSEO sent"),et(b).then(function(L){if(C("getSEO: "+JSON.stringify(L)),!g(L)){var k=Ke(L);document.getElementsByTagName("head")[0].appendChild(k)}return L}).catch(function(L){C("getSEO failed, likely a network error")})}var Ks=function(b,C){var L=document.createElement("div");L.className="vidyard-player-container",L.setAttribute("uuid",b);var k=L.style;return k.margin="auto",k.width="100%",k.height="auto",k.overflow="hidden",k.display="block",C.type==="inline"&&(k.maxWidth=C.width?C.width+"px":"",k.maxHeight=C.height?C.height+"px":""),L},Ih=Ks,r0=function(){function b(C){var L=this;this.disable_popouts=1;var k=fe(Q(C));Object.keys(k).forEach(function(he){L[he]=k[he]}),this.type!=="inline"&&this.type!=="lightbox"&&(x("Invalid Vidyard player embed type, defaulting to inline.","warn"),this.type="inline"),this.v=$,this.disable_popouts=1,this.custom_id=this.custom_id||ie("vycustom_id"),this.vyemail=this.vyemail||ie("vyemail"),this.vysfid=this.vysfid||ie("vysfid"),this.vyetoken=this.vyetoken||ie("vyetoken");var j=ie("vyac"),ue=ie("vyplayer");j&&ue&&ue===this.uuid?this.access_code=j:j&&ue&&x("Invalid Vidyard player access code.","warn")}return b.prototype.toQueryString=function(){var C="?",L;for(L in this)this.hasOwnProperty(L)&&(L==="height"||L==="uuid"||L==="width"||this[L]!==void 0&&(C+=C!=="?"?"&":"",C+=encodeURIComponent(L)+"="+encodeURIComponent(this[L])));return C==="?"?"":C},b}(),ns=r0;function Ys(b){b===void 0&&(b=_("vidyard-player-embed","img"));for(var C=0,L=b;C-1&&this._callbackStore[C].splice(j,1)}else this._callbackStore[C]=[]},b.prototype.ready=function(){return this._ready},b.prototype.play=function(){this._message({event:"play"})},b.prototype.pause=function(){this._message({event:"pause"})},b.prototype.resume=function(){this._message({event:"resume"})},b.prototype.seek=function(C){this._message({event:"seek",position:C})},b.prototype.setVolume=function(C){this._message({event:"setVolume",newVolume:C})},b.prototype.setPlaybackSpeed=function(C){this._message({event:"setPlaybackSpeed",speed:C})},b.prototype.playChapter=function(C){x("playChapter() is deprecated. We recommend to use playVideoAtIndex() instead."),this.playVideoAtIndex(C)},b.prototype.playVideoAtIndex=function(C){this._message({chapter_index:C,event:"playChapter"})},b.prototype.setAudioTrack=function(C){this._message({audioTrackId:C,event:"setAudioTrack"})},b.prototype.enableCaption=function(C,L){this._message({event:"enableCaption",label:C,language:L})},b.prototype.disableCaption=function(C,L){this._message({event:"disableCaption",label:C,language:L})},b.prototype.consentToGDPR=function(C){this._message({consent:C,event:"consentToGDPR"})},b.prototype.createCta=function(C){this._message({attributes:S({display_once:!1,duration:10,fullscreen:!1,html:"",opacity:1,start:0,width:300},C),event:"createCta"})},b.prototype.updateCta=function(C,L){this._message({attributes:L,event:"updateCta",id:C})},b.prototype.createVideoSection=function(C,L){this._message({event:"createVideoSection",title:C,milliseconds:L})},b.prototype.updateVideoSection=function(C,L,k){this._message({event:"updateVideoSection",index:C,title:L,milliseconds:k})},b.prototype.deleteVideoSection=function(C){this._message({event:"deleteVideoSection",index:C})},b.prototype.addEvent=function(C){var L=C.start,k=L===void 0?0:L,j=C.duration,ue=j===void 0?1:j,he=C.videoIndex,Fe=C.chapterIndex,Je=C.eventId;if(!Je){x("Missing arguments. Need eventId");return}Fe>=0&&x("Parameter chapterIndex is deprecated. We recommend to use videoIndex instead.");var gt=0;gt=Fe||gt,gt=he||gt,this._message({chapterIndex:gt,duration:ue,event:"addEvent",id:Je,start:k})},b.prototype.getCurrentChapter=function(){return x("getCurrentChapter() is deprecated. We recommend to use getCurrentVideoIndex() instead."),this.getCurrentVideoIndex()},b.prototype.getCurrentVideoIndex=function(){return this.status===null?null:this.status.chapterIndex},b.prototype.currentTime=function(){return this.status===null?null:this.status.currentTime},b.prototype.scrubbing=function(){return this.status===null?null:this.status.scrubbing},b.prototype.toggleFullscreen=function(){var C=this,L=J();if(L){var k=this.iframe[L.requestFullscreen]();k?k.then(function(){C._message({event:"toggleFullscreen"})}):this._message({event:"toggleFullscreen"}),d(L.fullscreenchange,"MSFullscreenChange",function(){document[L.fullscreenElement]||C._message({event:"exitFullscreen"})}),d("message","onmessage",H(function(j){j.event==="fullScreenChange"&&j.params===!1&&document[L.fullscreenElement]&&document[L.exitFullscreen]()}))}else this._message({event:"toggleFullscreen"})},b.prototype.resetPlayer=function(){this._message({event:"resetPlayer"})},b.prototype._message=function(C){if(this.ready()!==!0){x("Player is not ready yet! No messages can be recieved.","error");return}Mt(s0({},C,{uuid:this.uuid}),"https://"+$e(),this.iframe)},b.prototype._updateStatus=function(C){if(typeof C.status=="object"&&(this.status=C.status),typeof C.metadata=="object"&&(this.metadata=C.metadata,this.trigger("metadata",C.metadata)),this.status){if(this.status.currentTime!==this._previousTime&&this._callbackStore.timeupdate)for(var L=0,k=this._callbackStore.timeupdate;Lk?1:0});for(var C=0;C1)){C>=1&&(k.partOfVideoWatched[Math.floor(C)]=1),k.timeWatched=Object.keys(k.partOfVideoWatched).length;for(var ue=k.player.metadata.chapters_attributes[L].video_attributes.length_in_milliseconds,he=Math.floor(ue/1e3),Fe=k.timeWatched/he*100;Fe>=k.thresholds[k.thresholds.length-1];)k.callback({chapter:L,event:k.thresholds.pop(),player:b,videoIndex:L})}}}function f0(b,C,L){mr(b,C,L);var k=function(j){return Do(b,j)};return b.on("timeupdate",k),{player:b,removeEventListeners:function(){b.off("timeupdate",k),Rs(b)}}}function Lh(b,C,L){var k;C===void 0&&(C=[1,25,50,75,90]);var j=[],ue=L?(k={},k[L.uuid]=L,k):Dh(),he=Na(C),Fe=function(gt){if(ue.hasOwnProperty(gt)&>.length>0&&ue[gt]!==""){var pt=f0(ue[gt],b,he);j.push(pt)}else x(function(){return console.error("Could not attach Progress Events to player "+gt+", make sure to load the Vidyard Player API")})};for(var Je in ue)Fe(Je);return j.length===0&&x(function(){return console.warn("No Vidyard Players found. (include this script below player embed codes)")}),j}function Dh(){try{return window.Vidyard.players()}catch(b){return x(function(){return console.error("The Vidyard Player API must be loaded before this script can execute")}),{}}}function Zi(){for(var b=[],C=0;C=0&&p.splice(F,1)}function x(T){var F=document.createElement("style");return T.attrs.type===void 0&&(T.attrs.type="text/css"),w(F,T.attrs),_(T,F),F}function A(T){var F=document.createElement("link");return T.attrs.type===void 0&&(T.attrs.type="text/css"),T.attrs.rel="stylesheet",w(F,T.attrs),_(T,F),F}function w(T,F){Object.keys(F).forEach(function(X){T.setAttribute(X,F[X])})}function I(T,F){var X,J,Q,ie;if(F.transform&&T.css)if(ie=F.transform(T.css),ie)T.css=ie;else return function(){};if(F.singleton){var Z=h++;X=d||(d=x(F)),J=D.bind(null,X,Z,!1),Q=D.bind(null,X,Z,!0)}else T.sourceMap&&typeof URL=="function"&&typeof URL.createObjectURL=="function"&&typeof URL.revokeObjectURL=="function"&&typeof Blob=="function"&&typeof btoa=="function"?(X=A(F),J=B.bind(null,X,F),Q=function(){m(X),X.href&&URL.revokeObjectURL(X.href)}):(X=x(F),J=N.bind(null,X),Q=function(){m(X)});return J(T),function(z){if(z){if(z.css===T.css&&z.media===T.media&&z.sourceMap===T.sourceMap)return;J(T=z)}else Q()}}var P=function(){var T=[];return function(F,X){return T[F]=X,T.filter(Boolean).join(` `)}}();function D(T,F,X,J){var Q=X?"":J.css;if(T.styleSheet)T.styleSheet.cssText=P(F,Q);else{var ie=document.createTextNode(Q),Z=T.childNodes;Z[F]&&T.removeChild(Z[F]),Z.length?T.insertBefore(ie,Z[F]):T.appendChild(ie)}}function N(T,F){var X=F.css,J=F.media;if(J&&T.setAttribute("media",J),T.styleSheet)T.styleSheet.cssText=X;else{for(;T.firstChild;)T.removeChild(T.firstChild);T.appendChild(document.createTextNode(X))}}function B(T,F,X){var J=X.css,Q=X.sourceMap,ie=F.convertToAbsoluteUrls===void 0&&Q;(F.convertToAbsoluteUrls||ie)&&(J=g(J)),Q&&(J+=` /*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(Q))))+" */");var Z=new Blob([J],{type:"text/css"}),fe=T.href;T.href=URL.createObjectURL(Z),fe&&URL.revokeObjectURL(fe)}},function(t,i){t.exports=function(o){var a=[];return a.toString=function(){return this.map(function(u){var d=r(u,o);return u[2]?"@media "+u[2]+"{"+d+"}":d}).join("")},a.i=function(l,u){typeof l=="string"&&(l=[[null,l,""]]);for(var d={},h=0;h1&&arguments[1]!==void 0?arguments[1]:[],_=v.previousSibling;return _?(S.push(_),l(_,S)):S}function u(v){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],_=v.nextSibling;return _?(S.push(_),u(_,S)):S}function d(v){var S=l(v).concat(u(v));return S.filter(o)}function h(v){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],_=v.parentNode;return _?(S.push(_),h(_,S)):S}function p(v){return h(v).filter(s)}function g(v){return p(v).map(function(S){return d(S)}).reduce(a,[])}t.exports={getSiblings:d,getAncestors:p,getSiblingsOfAncestors:g}},function(t,i,r){(function(s){var o=s.CustomEvent;function a(){try{var l=new o("cat",{detail:{foo:"bar"}});return l.type==="cat"&&l.detail.foo==="bar"}catch(u){}return!1}t.exports=a()?o:typeof document!="undefined"&&typeof document.createEvent=="function"?function(u,d){var h=document.createEvent("CustomEvent");return d?h.initCustomEvent(u,d.bubbles,d.cancelable,d.detail):h.initCustomEvent(u,!1,!1,void 0),h}:function(u,d){var h=document.createEventObject();return h.type=u,d?(h.bubbles=!!d.bubbles,h.cancelable=!!d.cancelable,h.detail=d.detail):(h.bubbles=!1,h.cancelable=!1,h.detail=void 0),h}}).call(this,r(0))},,function(t,i){var r=t.exports={},s,o;function a(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?s=setTimeout:s=a}catch(A){s=a}try{typeof clearTimeout=="function"?o=clearTimeout:o=l}catch(A){o=l}})();function u(A){if(s===setTimeout)return setTimeout(A,0);if((s===a||!s)&&setTimeout)return s=setTimeout,setTimeout(A,0);try{return s(A,0)}catch(w){try{return s.call(null,A,0)}catch(I){return s.call(this,A,0)}}}function d(A){if(o===clearTimeout)return clearTimeout(A);if((o===l||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(A);try{return o(A)}catch(w){try{return o.call(null,A)}catch(I){return o.call(this,A)}}}var h=[],p=!1,g,v=-1;function S(){!p||!g||(p=!1,g.length?h=g.concat(h):v=-1,h.length&&_())}function _(){if(!p){var A=u(S);p=!0;for(var w=h.length;w;){for(g=h,h=[];++v1)for(var I=1;I=0&&(u._idleTimeoutId=setTimeout(function(){u._onTimeout&&u._onTimeout()},d))},r(17),i.setImmediate=typeof self!="undefined"&&self.setImmediate||typeof s!="undefined"&&s.setImmediate||this&&this.setImmediate,i.clearImmediate=typeof self!="undefined"&&self.clearImmediate||typeof s!="undefined"&&s.clearImmediate||this&&this.clearImmediate}).call(this,r(0))}])})})(iP);var Fm=iP.exports;const gH=({api:n,aspect:e,maxHeight:t,maxWidth:i,params:r,playbackUrl:s,type:o,uuid:a})=>{const[l,u]=me.useState(!1),[d,h]=me.useState(!0),p=me.useRef(null),g=me.useRef(void 0),v=me.useRef(!1);return me.useEffect(()=>{if(!(!p.current||v.current))return v.current=!0,s&&Fm._debug.setPlaybackURL(s),Fm.api.renderPlayer(ye({aspect:e,container:p.current,height:t,type:o,uuid:a,width:i},r)).then(S=>{g.current=S,h(!1),typeof n=="function"&&n(S,Fm.api)}).catch(S=>{u(!0),console.warn(S.message)}),()=>{g.current&&(Fm.api.destroyPlayer(g.current),g.current=void 0,v.current=!1)}},[n,e,t,i,r,s,o,a]),ge.jsx(yA,{fallback:l,children:ge.jsx("div",{className:"video-loaded aspect-video sm:max-w-[940px] m-auto bg-sfnavy overflow-hidden rounded-2xl z-10 mb-10 sm:mb-20",style:{margin:"auto",width:"100%",height:"auto",overflow:"hidden",zIndex:10,maxWidth:"940px",maxHeight:"506px"},ref:p,children:d?ge.jsx("img",{rel:"preload",className:"object-cover aspect-video absolute top-0 w-full m-auto overflow-hidden h-auto sm:min-h-[506px] z-10 max-w-[940px] rounded-2xl",style:{margin:"auto",width:"100%",height:"auto",overflow:"hidden",maxWidth:"940px",maxHeight:"506px",zIndex:1},src:`https://play.vidyard.com/${a}.jpg`,width:"940",height:"506"}):null})})},vH=({attributes:n,blade_id:e,blade_position:t})=>{var N,B;const{headline:i="",description:r="",link_1:s,link_2:o,media:a}=n!=null?n:{},l=me.useRef(null),{scrollYProgress:u}=tP({target:l,offset:["start start","end start"]}),d=Bm(u,{stiffness:140,damping:30,restDelta:.001}),h=Bm(u,{stiffness:220,damping:100,restDelta:.002}),p=Bm(u,{stiffness:200,damping:30}),g=lr(u,[0,1],["0%","300%"]),v=lr(u,[0,1],["0%","100%"]),S=lr(p,[0,1],["0%","350%"]),_=lr(p,[.18,.25],["100%","0%"]),m=lr(d,[0,.6],["0px","200px"]),x=lr(d,[0,.7],["0px","400px"]),A=lr(d,[0,.5],["0px","300px"]),w=lr(h,[0,.8],["0px","-200px"]),I=lr(h,[0,.7],["0px","-400px"]),P=lr(h,[0,.5],["0px","-300px"]),D=me.lazy(()=>Promise.resolve().then(()=>VX));return ge.jsxs("div",{ref:l,className:"relative grid min-h-screen w-screen place-items-center overflow-hidden mb-16",children:[ge.jsx(Xi.div,{style:{backgroundImage:"url('https://wp.salesforce.com/en-us/wp-content/uploads/sites/4/2024/07/marquee-bg-back.png?w=500')",backgroundSize:"120%",backgroundPositionY:v,backgroundPosition:"bottom"},className:"bg-blur absolute inset-0 z-0 opacity-20"}),ge.jsx(Xi.div,{style:{backgroundImage:"url('https://wp.salesforce.com/en-us/wp-content/uploads/sites/4/2024/07/marquee-bg-front.png?w=500')",backgroundSize:"120%",backgroundPositionY:g,backgroundPosition:"bottom"},className:"bg-blur visible absolute inset-0 z-0 opacity-20 max-sm:hidden"}),ge.jsx(Xi.div,{style:{backgroundImage:"url('https://wp.salesforce.com/en-us/wp-content/uploads/sites/4/2024/07/marquee-bg-middle.png?w=1200')",backgroundSize:"120%",backgroundPositionY:v,backgroundPosition:"bottom",backgroundRepeat:"no-repeat"},className:"bg-blur z-1 visible absolute inset-0 opacity-20"}),ge.jsxs("div",{className:"container relative flex flex-col items-center justify-start gap-10",children:[ge.jsx(yA,{fallback:null,children:ge.jsxs(me.Suspense,{fallback:ge.jsx(nP,{position:"left",x:w}),children:[ge.jsx(Xi.div,{style:{x:w},className:"data-dust absolute visible left-[2%] top-[20%] z-30 w-[60px] sm:w-[160px] max-sm:hidden",children:ge.jsx(D,{progress:u,direction:"left",size:"lg"})}),ge.jsx(Xi.div,{style:{x:P},className:"data-dust absolute left-[-1%] top-[30%] z-30 w-[60px] sm:w-[160px] visible max-sm:hidden",children:ge.jsx(D,{progress:u,direction:"right",size:"md"})}),ge.jsx(Xi.div,{style:{x:I},className:"data-dust absolute left-[5%] top-[28%] z-30 w-[60px] sm:w-[160px] visible max-sm:hidden",children:ge.jsx(D,{progress:u,direction:"right",size:"sm"})})]})}),ge.jsxs(Xi.div,{className:"flex flex-col items-center justify-center max-sm:px-1",style:{y:S,opacity:_},children:[ge.jsx("h1",{className:"marquee__accent antialiased z-0 mx-2 mt-8 text-center font-display text-[2.4rem] text-white sm:text-[3rem] md:text-[4rem] lg:text-[5rem]",dangerouslySetInnerHTML:{__html:i}}),ge.jsx("p",{className:"mt-8 text-center font-sans text-[1rem] text-white sm:text-[1.3rem]",dangerouslySetInnerHTML:{__html:r}}),ge.jsxs("div",{className:"flex items-center justify-center gap-4 mt-10",children:[(s==null?void 0:s.label)&&ge.jsx("a",{href:s==null?void 0:s.url,className:"inline-flex w-auto items-center justify-center font-sans text-[1.1rem] rounded-[4px] bg-sfnavy px-[32px] py-4 font-semibold text-white antialiased hover:bg-sfprimary hover:text-white",onClick:T=>{var F,X,J;return Jr(T,e,(J=(X=n==null?void 0:n.headline)!=null?X:(F=n==null?void 0:n.link_1)==null?void 0:F.label)!=null?J:"missing headline",t)},target:s==null?void 0:s.target,"aria-label":s==null?void 0:s.ariaLabel,children:s==null?void 0:s.label}),(o==null?void 0:o.label)&&ge.jsx("a",{href:o==null?void 0:o.url,className:"inline-flex w-auto items-center justify-center font-sans text-[1.1rem] rounded-[4px] bg-white px-[32px] py-4 font-semibold text-sfnavy antialiased hover:bg-sfprimary hover:text-white",onClick:T=>{var F,X,J;return Jr(T,e,(J=(X=n==null?void 0:n.headline)!=null?X:(F=n==null?void 0:n.link_1)==null?void 0:F.label)!=null?J:"missing headline",t)},target:o==null?void 0:o.target,"aria-label":o==null?void 0:o.ariaLabel,children:o==null?void 0:o.label})]})]}),ge.jsxs("div",{className:"video-wrapper w-full relative",children:[ge.jsx(yA,{children:ge.jsxs(me.Suspense,{fallback:ge.jsx(nP,{position:"right",x:A}),children:[ge.jsx(Xi.div,{style:{x:m},className:"data-dust absolute right-[8%] top-[-8%] z-30 w-[50px] sm:w-[150px] visible max-sm:hidden",children:ge.jsx(D,{progress:u,direction:"right",size:"lg"})}),ge.jsx(Xi.div,{style:{x},className:"data-dust absolute right-[5%] top-[10%] z-30 w-[50px] sm:w-[150px] visible max-sm:hidden",children:ge.jsx(D,{progress:u,direction:"left",size:"md"})}),ge.jsx(Xi.div,{style:{x:A},className:"data-dust absolute right-[1%] top-[1%] z-30 w-[50px] sm:w-[150px] visible max-sm:hidden",children:ge.jsx(D,{progress:u,direction:"left",size:"sm"})})]})}),ge.jsx("div",{className:"w-full sm:max-w-[900px] m-auto bg-sfnavy overflow-hidden rounded-2xl z-10 mb-10 sm:mb-20",children:((N=a==null?void 0:a.video)==null?void 0:N.uuid)!==void 0?ge.jsx(gH,{uuid:(B=a==null?void 0:a.video)==null?void 0:B.uuid,maxWidth:"940px",maxHeight:"506px",type:"inline"}):null})]})]})]})},yH=({attributes:n,blade_id:e,media_items:t,blade_position:i})=>{var s,o;const r={transition:{duration:.3,ease:[.45,.14,.1,.97]}};return ge.jsxs("section",{className:"container mx-auto px-8 mt-12 py-8 text-white rounded-2xl max-w-[1280px]",children:[ge.jsxs("div",{className:"text-center mb-12 mx-auto ",children:[ge.jsx("h2",{className:"text-3xl sm:text-5xl font-display text-white mx-0 sm:mx-6",children:n==null?void 0:n.headline}),ge.jsx("p",{className:"mt-4 text-lg font-sans",children:n==null?void 0:n.description}),(n==null?void 0:n.link_1)&&ge.jsx("a",{href:(s=n==null?void 0:n.link_1)==null?void 0:s.url,className:"text-white text-base font-bold font-sans leading-normal mr-4",onClick:a=>{var l,u,d;return Jr(a,e,(d=(u=n.headline)!=null?u:(l=n==null?void 0:n.link_1)==null?void 0:l.label)!=null?d:"missing headline",i)},children:ge.jsx("div",{className:"h-[54px] px-8 py-[15px] rounded border border-white justify-center items-center gap-2 inline-flex hover:bg-white/10",children:n.link_1.label})}),(n==null?void 0:n.link_2)&&ge.jsx("a",{href:(o=n==null?void 0:n.link_2)==null?void 0:o.url,className:"text-white text-base font-bold font-sans leading-normal mr-4",onClick:a=>{var l,u,d;return Jr(a,e,(d=(u=n.headline)!=null?u:(l=n==null?void 0:n.link_2)==null?void 0:l.label)!=null?d:"missing headline",i)},children:ge.jsx("div",{className:"h-[54px] px-8 py-[15px] rounded border border-white justify-center items-center gap-2 inline-flex",children:n.link_2.label})})]}),ge.jsx("div",{className:"grid gap-8 grid-cols-1 sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-3",children:t==null?void 0:t.map((a,l)=>{var d,h,p,g,v;const u=a;return ge.jsxs(Xi.div,{className:"bg-white flex flex-col rounded-2xl overflow-hidden text-left shadow-2xl",transition:r,initial:{scale:.9,opacity:0},whileInView:{scale:1,opacity:1,transition:{duration:.3,ease:[.45,.14,.1,.97],delay:l*.1}},children:[ge.jsx("img",{src:(d=u.image)==null?void 0:d.src,alt:(h=u.image)==null?void 0:h.alt,className:"w-full object-cover aspect-video"}),ge.jsxs("div",{className:"flex flex-col h-full gap-4 px-8 py-8",children:[ge.jsx("a",{href:u.link_1.url,"aria-label":u.headline,target:u.link_1.target,onClick:S=>Jr(S,e,u.headline,i),children:ge.jsx("h3",{className:"text-2xl font-display font-semibold mb-2 text-left text-sfnavy",children:u.headline})}),ge.jsx("p",{className:"font-sans mb-4 text-left text-sfdarkgrey",dangerouslySetInnerHTML:{__html:(p=u.description)!=null?p:""}}),((g=u.link_1)==null?void 0:g.url)&&ge.jsx("a",{href:u.link_1.url,"aria-label":(v=u.link_1.ariaLabel)!=null?v:`${u.link_1.label} : ${u.headline}`,target:u.link_1.target,className:"text-sfnavy mt-auto hover:text-sfprimary hover:no-underline underline-offset-2 font-sans font-bold underline",onClick:S=>Jr(S,e,u.headline,i),children:u.link_1.label})]})]},l)})})]})},xH=({i:n,attributes:e,progress:t,targetScale:i,range:r,id:s,blade_position:o})=>{var m,x,A,w;const a=me.useRef(null),l=s;Bm(t,{stiffness:300,damping:50,restDelta:.001});const u=lr(t,r,[1,i]),{headline:d,link_1:h,link_2:p,eyebrow:g,description:v,media:S,blade_layout:_}=e||{};return ge.jsx(Xi.section,{ref:a,style:{scale:u},className:"card-section relative mx-auto flex w-full",children:ge.jsxs("div",{className:`card-container h-auto sm:max-h-[90vh] p-6 sm:p-16 w-full relative flex max-sm:flex-col-reverse flex-col overflow-hidden items-start justify-end gap-6 sm:rounded-[5rem] sm:items-start sm:gap-12 rounded-[3rem] shadow-2xl ${`bg-${(m=g==null?void 0:g.label)==null?void 0:m.toLocaleLowerCase()}-gradient`} ${_==="right"?"sm:flex-row":"sm:flex-row-reverse"}`,children:[ge.jsx("div",{className:"w-full flex items-center justify-center sm:w-1/2",children:ge.jsx("img",{className:"object-contain w-full h-full max-h-[300px] sm:max-h-[500px]",src:(x=S==null?void 0:S.image)==null?void 0:x.src,alt:((A=S==null?void 0:S.image)==null?void 0:A.alt)||""})}),ge.jsxs("div",{className:"copy flex w-full flex-col items-start justify-center gap-3 sm:gap-6 sm:w-1/2",children:[ge.jsxs("div",{className:"pill rounded-full bg-white px-5 py-3 flex items-center justify-center gap-2 font-display text-sm text-sfnavy sm:text-lg",children:[ge.jsx("img",{src:(w=g==null?void 0:g.image)==null?void 0:w.src,alt:"",className:"w-6 h-6"}),g==null?void 0:g.label]}),ge.jsx("h2",{className:"font-display text-2xl sm:text-clamp text-white",children:d}),ge.jsx("div",{className:"stacking-card__desc font-sans text-base text-white sm:text-[1.2rem]",dangerouslySetInnerHTML:{__html:v||""}}),ge.jsxs("div",{className:"flex w-full items-center justify-start gap-6",children:[h&&ge.jsx("a",{href:h==null?void 0:h.url,className:"cta-button lg:my-8 my-2 rounded bg-white px-6 py-4 font-sans text-[1rem] font-semibold text-sfnavy","data-variant":h==null?void 0:h.variant,"aria-label":h==null?void 0:h.ariaLabel,onClick:I=>{var P;return Jr(I,l,(P=d!=null?d:h.label)!=null?P:"missing headline",o)},children:h==null?void 0:h.label}),p&&ge.jsx("a",{href:p==null?void 0:p.url,className:'cta-button data-[variant="secondary"]:border-2 bg-black/50 my-8 rounded text-white px-6 py-4 font-sans text-[1rem] font-semibold underline underline-offset-2 hover:no-underline',"data-variant":p==null?void 0:p.variant,"aria-label":p==null?void 0:p.ariaLabel,onClick:I=>{var P;return Jr(I,l,(P=d!=null?d:p.label)!=null?P:"missing headline",o)},children:p==null?void 0:p.label})]})]})]})},n)},_H=({attributes:n,progress:e,blade_id:t,blade_position:i})=>{const{headline:r,description:s,blade_layout:o}=n||{},a=lr(e,[.67,.69],["100%","0%"]),l=lr(e,[.67,.69],["0px","-30px"]);return n?ge.jsxs(Xi.div,{className:`text-${o} w-full mb-16`,style:{opacity:a,zIndex:0,y:l},children:[ge.jsx("h2",{className:"text-white text-4xl sm:text-5xl font-semibold mx-4 mb-4 font-display",children:r}),ge.jsx("div",{className:"text-white text-base sm:text-2xl mx-4 font-bold font-sans leading-[43.20px]",dangerouslySetInnerHTML:{__html:s}}),n.link_1&&ge.jsx("a",{href:n.link_1.url,className:"text-white text-base font-bold font-sans leading-normal mr-4",onClick:u=>Jr(u,t,n.headline,i),"aria-label":n.link_1.ariaLabel,children:ge.jsx("div",{className:"h-[54px] px-8 py-[15px] rounded border border-white justify-center items-center gap-2 inline-flex hover:bg-white/10",children:n.link_1.label})}),n.link_2&&ge.jsx("a",{href:n.link_2.url,className:"text-white text-base font-bold font-sans leading-normal mr-4",onClick:u=>Jr(u,t,n.headline,i),"aria-label":n.link_2.ariaLabel,children:ge.jsx("div",{className:"h-[54px] px-8 py-[15px] rounded border border-white justify-center items-center gap-2 inline-flex",children:n.link_2.label})})]}):null},AH=({attributes:n,blade_id:e,blade_position:t})=>{const{headline:i,link_1:r,link_2:s,description:o,image:a,blade_layout:l}=n||{};return ge.jsxs("div",{className:`px-8 mb-16 sm:px-16 gap-6 sm:gap-24 container mx-auto flex items-center justify-center flex-col ${l==="right"?"sm:flex-row":"sm:flex-row-reverse"}`,children:[ge.jsxs("div",{className:"max-sm:w-full sm:w-2/3 flex flex-col gap-4",children:[ge.jsx("h2",{className:"font-display text-4xl sm:text-5xl text-white",children:i}),ge.jsx("div",{className:"blade__description font-sans text-base text-white sm:text-[1.2rem]",dangerouslySetInnerHTML:{__html:o!=null?o:""}}),ge.jsxs("div",{className:"flex w-full items-center justify-start gap-6",children:[r!==void 0?ge.jsx("a",{href:r==null?void 0:r.url,className:"cta-button my-8 rounded bg-white px-6 py-4 font-sans text-[1rem] font-semibold text-sfnavy","data-variant":r==null?void 0:r.variant,"aria-label":r==null?void 0:r.ariaLabel,onClick:u=>Jr(u,e,i!=null?i:"missing headline",t),children:r==null?void 0:r.label}):null,s!==void 0?ge.jsx("a",{href:s==null?void 0:s.url,className:'cta-button data-[variant="secondary"]:border-2 bg-black/50 my-8 rounded text-white px-6 py-4 font-sans text-[1rem] font-semibold underline underline-offset-2 hover:no-underline',"data-variant":s==null?void 0:s.variant,"aria-label":s==null?void 0:s.ariaLabel,onClick:u=>Jr(u,e,i!=null?i:"missing headline",t),children:s==null?void 0:s.label}):null]})]}),ge.jsx("div",{className:"max-sm:w-full sm:md:w-1/3 flex flex-col",children:ge.jsx("img",{className:"object-contain w-full h-full max-h-[300px] sm:max-h-[500px]",src:a==null?void 0:a.src,alt:a==null?void 0:a.alt})})]})},SH=me.lazy(()=>Promise.resolve().then(()=>WX));function MH({appUrl:n,bladeCount:e}){var g,v,S;const[t,i]=me.useState(),[r,s]=me.useState(!0);me.useEffect(()=>{n?fetch(n).then(_=>_.json()).then(_=>{const m=_.blades.filter(x=>x.name!=="sf/notification"&&x.name!=="sf/openblade").slice(0,e!=null?e:9).map((x,A)=>{const w=wt(ye({},x),{blade_position:A,blade_id:x.id}),I=document.getElementById(x.id);return I?(console.log("removing section element id",x.id," blade name:",x.name),I.remove(),I.remove()):console.log("section element not found id",x.id," blade name:",x.name),w});i(m),s(!1)}):(console.error("appUrl is not defined"),s(!1))},[]);const o=(g=t==null?void 0:t.filter(_=>_.name==="sf/oneup"))!=null?g:[],a=t==null?void 0:t.find(_=>_.name==="sf/marquee"),l=t==null?void 0:t.find(_=>_.name==="sf/promotion"),u=t==null?void 0:t.find(_=>_.name==="sf/text"),d=t==null?void 0:t.find(_=>_.name==="sf/nup"),h=me.useRef(null),{scrollYProgress:p}=tP({target:h,offset:["start start","end end"]});return ge.jsx("div",{className:"gt-dark-bg min-h-screen sm:rounded-b-[5rem] rounded-b-[3rem]",children:r?ge.jsx(SH,{}):ge.jsxs(ge.Fragment,{children:[ge.jsx(vH,{attributes:a==null?void 0:a.attributes,blade_id:a.blade_id,blade_position:a.blade_position}),ge.jsxs(me.Suspense,{fallback:ge.jsx("div",{children:"Loading..."}),children:[ge.jsx(AH,{attributes:l==null?void 0:l.attributes,blade_id:(v=l==null?void 0:l.id)!=null?v:"",blade_position:l==null?void 0:l.blade_position}),ge.jsx("div",{className:"relative pb-10",children:ge.jsx(yH,{attributes:d.attributes,blade_id:d.blade_id,media_items:d.media_items,blade_position:(S=d.blade_position)!=null?S:0})}),ge.jsxs("div",{ref:h,className:"parallax-section relative",children:[ge.jsx(_H,{attributes:u.attributes,blade_id:u.blade_id,blade_position:u.blade_position,progress:p}),o==null?void 0:o.map((_,m)=>ge.jsx(xH,{attributes:_.attributes,blade_id:_.id,i:m,range:[m*.25,1],progress:p,blade_position:_.blade_position,targetScale:1},m))]})]})]})})}const Nm=document.getElementById("wps-dc-overview-ws"),wH=(Nm==null?void 0:Nm.dataset)||{};q0.createRoot(Nm).render(ge.jsx(hF.StrictMode,{children:ge.jsx(MH,ye({},wH))}));function EH(n,{whileHover:e,onHoverStart:t,onHoverEnd:i,onPointerOver:r,onPointerOut:s},o){return n||!o||!(e||t||i)?{}:{onPointerOver:l=>{var u;(u=o.animationState)===null||u===void 0||u.setActive("whileHover",!0),r&&r(l)},onPointerOut:l=>{var u;(u=o.animationState)===null||u===void 0||u.setActive("whileHover",!1),s&&s(l)}}}function CH(n,{whileTap:e,onTapStart:t,onTap:i,onTapCancel:r,onPointerDown:s},o){const a=i||t||r||e,l=me.useRef(!1),u=me.useRef(null);if(n||!o||!a)return{};function d(){var v;(v=u.current)===null||v===void 0||v.call(u),u.current=null}function h(){var v;return d(),l.current=!1,(v=o.animationState)===null||v===void 0||v.setActive("whileTap",!1),!j_()}function p(v,S){h()&&(i==null||i(v,S))}function g(v,S){h()&&(r==null||r(v,S))}return{onPointerDown:lb((v,S)=>{var _;if(d(),l.current)return;l.current=!0;const m={passive:!(t||i||r||s)};u.current=Os(ps(window,"pointerup",p,m),ps(window,"pointercancel",g,m)),(_=o.animationState)===null||_===void 0||_.setActive("whileTap",!0),s==null||s(v),t==null||t(v,S)})}}const TH=(n,e,t,i,r,s)=>{const o=bH(e);return me.createElement(n,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ref:t},NR(e,!1,!1)),o),{onUpdate:e.onInstanceUpdate}),EH(r,e,s)),CH(r,e,s)))};function bH(n){return me.useMemo(()=>{const e={};for(const t in n){const i=n[t];Tn(i)?e[t]=i.get():Array.isArray(i)&&i.includes(Tn)&&(e[t]=i.map(hd))}return e},[])}/** * @license * Copyright 2010-2024 Three.js Authors * SPDX-License-Identifier: MIT */const vd="167",RH={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},PH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},rP=0,xA=1,sP=2,IH=3,oP=0,Um=1,yd=2,ms=3,zs=0,ji=1,gs=2,po=0,pl=1,_A=2,AA=3,SA=4,aP=5,la=100,lP=101,uP=102,cP=103,fP=104,dP=200,hP=201,pP=202,mP=203,Om=204,km=205,gP=206,vP=207,yP=208,xP=209,_P=210,AP=211,SP=212,MP=213,wP=214,EP=0,CP=1,TP=2,xd=3,bP=4,RP=5,PP=6,IP=7,_d=0,BP=1,LP=2,Hs=0,DP=1,FP=2,NP=3,MA=4,UP=5,OP=6,kP=7,wA="attached",zP="detached",zm=300,mo=301,ua=302,Ad=303,Sd=304,Qu=306,ca=1e3,Tr=1001,qu=1002,oi=1003,Hm=1004,BH=1004,ml=1005,LH=1005,zn=1006,Zu=1007,DH=1007,Kr=1008,FH=1008,vs=1009,EA=1010,CA=1011,$u=1012,Gm=1013,go=1014,ur=1015,ec=1016,Vm=1017,Wm=1018,gl=1020,TA=35902,bA=1021,RA=1022,Ri=1023,PA=1024,IA=1025,vl=1026,yl=1027,Xm=1028,Md=1029,BA=1030,jm=1031,NH=1032,Jm=1033,wd=33776,Ed=33777,Cd=33778,Td=33779,Km=35840,Ym=35841,Qm=35842,qm=35843,Zm=36196,$m=37492,eg=37496,tg=37808,ng=37809,ig=37810,rg=37811,sg=37812,og=37813,ag=37814,lg=37815,ug=37816,cg=37817,fg=37818,dg=37819,hg=37820,pg=37821,bd=36492,mg=36494,gg=36495,LA=36283,vg=36284,yg=36285,xg=36286,HP=2200,GP=2201,VP=2202,tc=2300,nc=2301,_g=2302,xl=2400,_l=2401,Rd=2402,Ag=2500,DA=2501,WP=0,FA=1,Sg=2,XP=3200,jP=3201,UH=3202,OH=3203,fa=0,JP=1,vo="",Yr="srgb",yo="srgb-linear",Mg="display-p3",Pd="display-p3-linear",Id="linear",vn="srgb",Bd="rec709",Ld="p3",kH=0,Al=7680,zH=7681,HH=7682,GH=7683,VH=34055,WH=34056,XH=5386,jH=512,JH=513,KH=514,YH=515,QH=516,qH=517,ZH=518,NA=519,KP=512,YP=513,QP=514,UA=515,qP=516,ZP=517,$P=518,eI=519,Dd=35044,$H=35048,eG=35040,tG=35045,nG=35049,iG=35041,rG=35046,sG=35050,oG=35042,aG="100",OA="300 es",Gs=2e3,Fd=2001;class xo{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s>8&255]+Pi[n>>16&255]+Pi[n>>24&255]+"-"+Pi[e&255]+Pi[e>>8&255]+"-"+Pi[e>>16&15|64]+Pi[e>>24&255]+"-"+Pi[t&63|128]+Pi[t>>8&255]+"-"+Pi[t>>16&255]+Pi[t>>24&255]+Pi[i&255]+Pi[i>>8&255]+Pi[i>>16&255]+Pi[i>>24&255]).toLowerCase()}function Hn(n,e,t){return Math.max(e,Math.min(t,n))}function kA(n,e){return(n%e+e)%e}function lG(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function uG(n,e,t){return n!==e?(t-n)/(e-n):0}function Nd(n,e,t){return(1-t)*n+t*e}function cG(n,e,t,i){return Nd(n,e,1-Math.exp(-t*i))}function fG(n,e=1){return e-Math.abs(kA(n,e*2)-e)}function dG(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function hG(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function pG(n,e){return n+Math.floor(Math.random()*(e-n+1))}function mG(n,e){return n+Math.random()*(e-n)}function gG(n){return n*(.5-Math.random())}function vG(n){n!==void 0&&(tI=n);let e=tI+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function yG(n){return n*Sl}function xG(n){return n*ic}function _G(n){return(n&n-1)===0&&n!==0}function AG(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function SG(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function MG(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),u=s((e+i)/2),d=o((e+i)/2),h=s((e-i)/2),p=o((e-i)/2),g=s((i-e)/2),v=o((i-e)/2);switch(r){case"XYX":n.set(a*d,l*h,l*p,a*u);break;case"YZY":n.set(l*p,a*d,l*h,a*u);break;case"ZXZ":n.set(l*h,l*p,a*d,a*u);break;case"XZX":n.set(a*d,l*v,l*g,a*u);break;case"YXY":n.set(l*g,a*d,l*v,a*u);break;case"ZYZ":n.set(l*v,l*g,a*d,a*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Ji(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Lt(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const nI={DEG2RAD:Sl,RAD2DEG:ic,generateUUID:br,clamp:Hn,euclideanModulo:kA,mapLinear:lG,inverseLerp:uG,lerp:Nd,damp:cG,pingpong:fG,smoothstep:dG,smootherstep:hG,randInt:pG,randFloat:mG,randFloatSpread:gG,seededRandom:vG,degToRad:yG,radToDeg:xG,isPowerOfTwo:_G,ceilPowerOfTwo:AG,floorPowerOfTwo:SG,setQuaternionFromProperEuler:MG,normalize:Lt,denormalize:Ji};class Ae{constructor(e=0,t=0){Ae.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(Hn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Dt{constructor(e,t,i,r,s,o,a,l,u){Dt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,u)}set(e,t,i,r,s,o,a,l,u){const d=this.elements;return d[0]=e,d[1]=r,d[2]=a,d[3]=t,d[4]=s,d[5]=l,d[6]=i,d[7]=o,d[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[3],l=i[6],u=i[1],d=i[4],h=i[7],p=i[2],g=i[5],v=i[8],S=r[0],_=r[3],m=r[6],x=r[1],A=r[4],w=r[7],I=r[2],P=r[5],D=r[8];return s[0]=o*S+a*x+l*I,s[3]=o*_+a*A+l*P,s[6]=o*m+a*w+l*D,s[1]=u*S+d*x+h*I,s[4]=u*_+d*A+h*P,s[7]=u*m+d*w+h*D,s[2]=p*S+g*x+v*I,s[5]=p*_+g*A+v*P,s[8]=p*m+g*w+v*D,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],u=e[7],d=e[8];return t*o*d-t*a*u-i*s*d+i*a*l+r*s*u-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],u=e[7],d=e[8],h=d*o-a*u,p=a*l-d*s,g=u*s-o*l,v=t*h+i*p+r*g;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/v;return e[0]=h*S,e[1]=(r*u-d*i)*S,e[2]=(a*i-r*o)*S,e[3]=p*S,e[4]=(d*t-r*l)*S,e[5]=(r*s-a*t)*S,e[6]=g*S,e[7]=(i*l-u*t)*S,e[8]=(o*t-i*s)*S,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,o,a){const l=Math.cos(s),u=Math.sin(s);return this.set(i*l,i*u,-i*(l*o+u*a)+o+e,-r*u,r*l,-r*(-u*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(zA.makeScale(e,t)),this}rotate(e){return this.premultiply(zA.makeRotation(-e)),this}translate(e,t){return this.premultiply(zA.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const zA=new Dt;function iI(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const wG={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function rc(n,e){return new wG[n](e)}function Ud(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function rI(){const n=Ud("canvas");return n.style.display="block",n}const sI={};function sc(n){n in sI||(sI[n]=!0,console.warn(n))}function EG(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}const oI=new Dt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),aI=new Dt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Od={[yo]:{transfer:Id,primaries:Bd,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n,fromReference:n=>n},[Yr]:{transfer:vn,primaries:Bd,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[Pd]:{transfer:Id,primaries:Ld,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.applyMatrix3(aI),fromReference:n=>n.applyMatrix3(oI)},[Mg]:{transfer:vn,primaries:Ld,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.convertSRGBToLinear().applyMatrix3(aI),fromReference:n=>n.applyMatrix3(oI).convertLinearToSRGB()}},CG=new Set([yo,Pd]),tn={enabled:!0,_workingColorSpace:yo,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!CG.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=Od[e].toReference,r=Od[t].fromReference;return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return Od[n].primaries},getTransfer:function(n){return n===vo?Id:Od[n].transfer},getLuminanceCoefficients:function(n,e=this._workingColorSpace){return n.fromArray(Od[e].luminanceCoefficients)}};function oc(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function HA(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let ac;class lI{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{ac===void 0&&(ac=Ud("canvas")),ac.width=e.width,ac.height=e.height;const i=ac.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=ac}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap){const t=Ud("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==zm)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ca:e.x=e.x-Math.floor(e.x);break;case Tr:e.x=e.x<0?0:1;break;case qu:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case ca:e.y=e.y-Math.floor(e.y);break;case Tr:e.y=e.y<0?0:1;break;case qu:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Mn.DEFAULT_IMAGE=null,Mn.DEFAULT_MAPPING=zm,Mn.DEFAULT_ANISOTROPY=1;class on{constructor(e=0,t=0,i=0,r=1){on.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,u=l[0],d=l[4],h=l[8],p=l[1],g=l[5],v=l[9],S=l[2],_=l[6],m=l[10];if(Math.abs(d-p)<.01&&Math.abs(h-S)<.01&&Math.abs(v-_)<.01){if(Math.abs(d+p)<.1&&Math.abs(h+S)<.1&&Math.abs(v+_)<.1&&Math.abs(u+g+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const A=(u+1)/2,w=(g+1)/2,I=(m+1)/2,P=(d+p)/4,D=(h+S)/4,N=(v+_)/4;return A>w&&A>I?A<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(A),r=P/i,s=D/i):w>I?w<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(w),i=P/r,s=N/r):I<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(I),i=D/s,r=N/s),this.set(i,r,s,t),this}let x=Math.sqrt((_-v)*(_-v)+(h-S)*(h-S)+(p-d)*(p-d));return Math.abs(x)<.001&&(x=1),this.x=(_-v)/x,this.y=(h-S)/x,this.z=(p-d)/x,this.w=Math.acos((u+g+m-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class uI extends xo{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new on(0,0,e,t),this.scissorTest=!1,this.viewport=new on(0,0,e,t);const r={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:zn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const s=new Mn(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];const o=i.count;for(let a=0;a=0?1:-1,A=1-m*m;if(A>Number.EPSILON){const I=Math.sqrt(A),P=Math.atan2(I,m*x);_=Math.sin(_*P)/I,a=Math.sin(a*P)/I}const w=a*x;if(l=l*_+p*w,u=u*_+g*w,d=d*_+v*w,h=h*_+S*w,_===1-a){const I=1/Math.sqrt(l*l+u*u+d*d+h*h);l*=I,u*=I,d*=I,h*=I}}e[t]=l,e[t+1]=u,e[t+2]=d,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],u=i[r+2],d=i[r+3],h=s[o],p=s[o+1],g=s[o+2],v=s[o+3];return e[t]=a*v+d*h+l*g-u*p,e[t+1]=l*v+d*p+u*h-a*g,e[t+2]=u*v+d*g+a*p-l*h,e[t+3]=d*v-a*h-l*p-u*g,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,u=a(i/2),d=a(r/2),h=a(s/2),p=l(i/2),g=l(r/2),v=l(s/2);switch(o){case"XYZ":this._x=p*d*h+u*g*v,this._y=u*g*h-p*d*v,this._z=u*d*v+p*g*h,this._w=u*d*h-p*g*v;break;case"YXZ":this._x=p*d*h+u*g*v,this._y=u*g*h-p*d*v,this._z=u*d*v-p*g*h,this._w=u*d*h+p*g*v;break;case"ZXY":this._x=p*d*h-u*g*v,this._y=u*g*h+p*d*v,this._z=u*d*v+p*g*h,this._w=u*d*h-p*g*v;break;case"ZYX":this._x=p*d*h-u*g*v,this._y=u*g*h+p*d*v,this._z=u*d*v-p*g*h,this._w=u*d*h+p*g*v;break;case"YZX":this._x=p*d*h+u*g*v,this._y=u*g*h+p*d*v,this._z=u*d*v-p*g*h,this._w=u*d*h-p*g*v;break;case"XZY":this._x=p*d*h-u*g*v,this._y=u*g*h-p*d*v,this._z=u*d*v+p*g*h,this._w=u*d*h+p*g*v;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],u=t[2],d=t[6],h=t[10],p=i+a+h;if(p>0){const g=.5/Math.sqrt(p+1);this._w=.25/g,this._x=(d-l)*g,this._y=(s-u)*g,this._z=(o-r)*g}else if(i>a&&i>h){const g=2*Math.sqrt(1+i-a-h);this._w=(d-l)/g,this._x=.25*g,this._y=(r+o)/g,this._z=(s+u)/g}else if(a>h){const g=2*Math.sqrt(1+a-i-h);this._w=(s-u)/g,this._x=(r+o)/g,this._y=.25*g,this._z=(l+d)/g}else{const g=2*Math.sqrt(1+h-i-a);this._w=(o-r)/g,this._x=(s+u)/g,this._y=(l+d)/g,this._z=.25*g}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Hn(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,u=t._z,d=t._w;return this._x=i*d+o*a+r*u-s*l,this._y=r*d+o*l+s*a-i*u,this._z=s*d+o*u+i*l-r*a,this._w=o*d-i*a-r*l-s*u,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const g=1-t;return this._w=g*o+t*this._w,this._x=g*i+t*this._x,this._y=g*r+t*this._y,this._z=g*s+t*this._z,this.normalize(),this}const u=Math.sqrt(l),d=Math.atan2(u,a),h=Math.sin((1-t)*d)/u,p=Math.sin(t*d)/u;return this._w=o*h+this._w*p,this._x=i*h+this._x*p,this._y=r*h+this._y*p,this._z=s*h+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class G{constructor(e=0,t=0,i=0){G.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(cI.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(cI.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,u=2*(o*r-a*i),d=2*(a*t-s*r),h=2*(s*i-o*t);return this.x=t+l*u+o*h-a*d,this.y=i+l*d+a*u-s*h,this.z=r+l*h+s*d-o*u,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return WA.copy(this).projectOnVector(e),this.sub(WA)}reflect(e){return this.sub(WA.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(Hn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const WA=new G,cI=new Ii;class Bi{constructor(e=new G(1/0,1/0,1/0),t=new G(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,xs),xs.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(kd),Cg.subVectors(this.max,kd),lc.subVectors(e.a,kd),uc.subVectors(e.b,kd),cc.subVectors(e.c,kd),da.subVectors(uc,lc),ha.subVectors(cc,uc),wl.subVectors(lc,cc);let t=[0,-da.z,da.y,0,-ha.z,ha.y,0,-wl.z,wl.y,da.z,0,-da.x,ha.z,0,-ha.x,wl.z,0,-wl.x,-da.y,da.x,0,-ha.y,ha.x,0,-wl.y,wl.x,0];return!XA(t,lc,uc,cc,Cg)||(t=[1,0,0,0,1,0,0,0,1],!XA(t,lc,uc,cc,Cg))?!1:(Tg.crossVectors(da,ha),t=[Tg.x,Tg.y,Tg.z],XA(t,lc,uc,cc,Cg))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,xs).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(xs).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(_o[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_o[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_o[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_o[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_o[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_o[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_o[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_o[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_o),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const _o=[new G,new G,new G,new G,new G,new G,new G,new G],xs=new G,Eg=new Bi,lc=new G,uc=new G,cc=new G,da=new G,ha=new G,wl=new G,kd=new G,Cg=new G,Tg=new G,El=new G;function XA(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){El.fromArray(n,s);const a=r.x*Math.abs(El.x)+r.y*Math.abs(El.y)+r.z*Math.abs(El.z),l=e.dot(El),u=t.dot(El),d=i.dot(El);if(Math.max(-Math.max(l,u,d),Math.min(l,u,d))>a)return!1}return!0}const IG=new Bi,zd=new G,jA=new G;class _i{constructor(e=new G,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):IG.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;zd.subVectors(e,this.center);const t=zd.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(zd,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(jA.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(zd.copy(e.center).add(jA)),this.expandByPoint(zd.copy(e.center).sub(jA))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ao=new G,JA=new G,bg=new G,pa=new G,KA=new G,Rg=new G,YA=new G;class fc{constructor(e=new G,t=new G(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ao)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ao.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ao.copy(this.origin).addScaledVector(this.direction,t),Ao.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){JA.copy(e).add(t).multiplyScalar(.5),bg.copy(t).sub(e).normalize(),pa.copy(this.origin).sub(JA);const s=e.distanceTo(t)*.5,o=-this.direction.dot(bg),a=pa.dot(this.direction),l=-pa.dot(bg),u=pa.lengthSq(),d=Math.abs(1-o*o);let h,p,g,v;if(d>0)if(h=o*l-a,p=o*a-l,v=s*d,h>=0)if(p>=-v)if(p<=v){const S=1/d;h*=S,p*=S,g=h*(h+o*p+2*a)+p*(o*h+p+2*l)+u}else p=s,h=Math.max(0,-(o*p+a)),g=-h*h+p*(p+2*l)+u;else p=-s,h=Math.max(0,-(o*p+a)),g=-h*h+p*(p+2*l)+u;else p<=-v?(h=Math.max(0,-(-o*s+a)),p=h>0?-s:Math.min(Math.max(-s,-l),s),g=-h*h+p*(p+2*l)+u):p<=v?(h=0,p=Math.min(Math.max(-s,-l),s),g=p*(p+2*l)+u):(h=Math.max(0,-(o*s+a)),p=h>0?s:Math.min(Math.max(-s,-l),s),g=-h*h+p*(p+2*l)+u);else p=o>0?-s:s,h=Math.max(0,-(o*p+a)),g=-h*h+p*(p+2*l)+u;return i&&i.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(JA).addScaledVector(bg,p),g}intersectSphere(e,t){Ao.subVectors(e.center,this.origin);const i=Ao.dot(this.direction),r=Ao.dot(Ao)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,o,a,l;const u=1/this.direction.x,d=1/this.direction.y,h=1/this.direction.z,p=this.origin;return u>=0?(i=(e.min.x-p.x)*u,r=(e.max.x-p.x)*u):(i=(e.max.x-p.x)*u,r=(e.min.x-p.x)*u),d>=0?(s=(e.min.y-p.y)*d,o=(e.max.y-p.y)*d):(s=(e.max.y-p.y)*d,o=(e.min.y-p.y)*d),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o=0?(a=(e.min.z-p.z)*h,l=(e.max.z-p.z)*h):(a=(e.max.z-p.z)*h,l=(e.min.z-p.z)*h),i>l||a>r)||((a>i||i!==i)&&(i=a),(l=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Ao)!==null}intersectTriangle(e,t,i,r,s){KA.subVectors(t,e),Rg.subVectors(i,e),YA.crossVectors(KA,Rg);let o=this.direction.dot(YA),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;pa.subVectors(this.origin,e);const l=a*this.direction.dot(Rg.crossVectors(pa,Rg));if(l<0)return null;const u=a*this.direction.dot(KA.cross(pa));if(u<0||l+u>o)return null;const d=-a*pa.dot(YA);return d<0?null:this.at(d/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class mt{constructor(e,t,i,r,s,o,a,l,u,d,h,p,g,v,S,_){mt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,u,d,h,p,g,v,S,_)}set(e,t,i,r,s,o,a,l,u,d,h,p,g,v,S,_){const m=this.elements;return m[0]=e,m[4]=t,m[8]=i,m[12]=r,m[1]=s,m[5]=o,m[9]=a,m[13]=l,m[2]=u,m[6]=d,m[10]=h,m[14]=p,m[3]=g,m[7]=v,m[11]=S,m[15]=_,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 mt().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/dc.setFromMatrixColumn(e,0).length(),s=1/dc.setFromMatrixColumn(e,1).length(),o=1/dc.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),u=Math.sin(r),d=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const p=o*d,g=o*h,v=a*d,S=a*h;t[0]=l*d,t[4]=-l*h,t[8]=u,t[1]=g+v*u,t[5]=p-S*u,t[9]=-a*l,t[2]=S-p*u,t[6]=v+g*u,t[10]=o*l}else if(e.order==="YXZ"){const p=l*d,g=l*h,v=u*d,S=u*h;t[0]=p+S*a,t[4]=v*a-g,t[8]=o*u,t[1]=o*h,t[5]=o*d,t[9]=-a,t[2]=g*a-v,t[6]=S+p*a,t[10]=o*l}else if(e.order==="ZXY"){const p=l*d,g=l*h,v=u*d,S=u*h;t[0]=p-S*a,t[4]=-o*h,t[8]=v+g*a,t[1]=g+v*a,t[5]=o*d,t[9]=S-p*a,t[2]=-o*u,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const p=o*d,g=o*h,v=a*d,S=a*h;t[0]=l*d,t[4]=v*u-g,t[8]=p*u+S,t[1]=l*h,t[5]=S*u+p,t[9]=g*u-v,t[2]=-u,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const p=o*l,g=o*u,v=a*l,S=a*u;t[0]=l*d,t[4]=S-p*h,t[8]=v*h+g,t[1]=h,t[5]=o*d,t[9]=-a*d,t[2]=-u*d,t[6]=g*h+v,t[10]=p-S*h}else if(e.order==="XZY"){const p=o*l,g=o*u,v=a*l,S=a*u;t[0]=l*d,t[4]=-h,t[8]=u*d,t[1]=p*h+S,t[5]=o*d,t[9]=g*h-v,t[2]=v*h-g,t[6]=a*d,t[10]=S*h+p}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(BG,e,LG)}lookAt(e,t,i){const r=this.elements;return Rr.subVectors(e,t),Rr.lengthSq()===0&&(Rr.z=1),Rr.normalize(),ma.crossVectors(i,Rr),ma.lengthSq()===0&&(Math.abs(i.z)===1?Rr.x+=1e-4:Rr.z+=1e-4,Rr.normalize(),ma.crossVectors(i,Rr)),ma.normalize(),Pg.crossVectors(Rr,ma),r[0]=ma.x,r[4]=Pg.x,r[8]=Rr.x,r[1]=ma.y,r[5]=Pg.y,r[9]=Rr.y,r[2]=ma.z,r[6]=Pg.z,r[10]=Rr.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[4],l=i[8],u=i[12],d=i[1],h=i[5],p=i[9],g=i[13],v=i[2],S=i[6],_=i[10],m=i[14],x=i[3],A=i[7],w=i[11],I=i[15],P=r[0],D=r[4],N=r[8],B=r[12],T=r[1],F=r[5],X=r[9],J=r[13],Q=r[2],ie=r[6],Z=r[10],fe=r[14],z=r[3],$=r[7],ne=r[11],de=r[15];return s[0]=o*P+a*T+l*Q+u*z,s[4]=o*D+a*F+l*ie+u*$,s[8]=o*N+a*X+l*Z+u*ne,s[12]=o*B+a*J+l*fe+u*de,s[1]=d*P+h*T+p*Q+g*z,s[5]=d*D+h*F+p*ie+g*$,s[9]=d*N+h*X+p*Z+g*ne,s[13]=d*B+h*J+p*fe+g*de,s[2]=v*P+S*T+_*Q+m*z,s[6]=v*D+S*F+_*ie+m*$,s[10]=v*N+S*X+_*Z+m*ne,s[14]=v*B+S*J+_*fe+m*de,s[3]=x*P+A*T+w*Q+I*z,s[7]=x*D+A*F+w*ie+I*$,s[11]=x*N+A*X+w*Z+I*ne,s[15]=x*B+A*J+w*fe+I*de,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],u=e[13],d=e[2],h=e[6],p=e[10],g=e[14],v=e[3],S=e[7],_=e[11],m=e[15];return v*(+s*l*h-r*u*h-s*a*p+i*u*p+r*a*g-i*l*g)+S*(+t*l*g-t*u*p+s*o*p-r*o*g+r*u*d-s*l*d)+_*(+t*u*h-t*a*g-s*o*h+i*o*g+s*a*d-i*u*d)+m*(-r*a*d-t*l*h+t*a*p+r*o*h-i*o*p+i*l*d)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],u=e[7],d=e[8],h=e[9],p=e[10],g=e[11],v=e[12],S=e[13],_=e[14],m=e[15],x=h*_*u-S*p*u+S*l*g-a*_*g-h*l*m+a*p*m,A=v*p*u-d*_*u-v*l*g+o*_*g+d*l*m-o*p*m,w=d*S*u-v*h*u+v*a*g-o*S*g-d*a*m+o*h*m,I=v*h*l-d*S*l-v*a*p+o*S*p+d*a*_-o*h*_,P=t*x+i*A+r*w+s*I;if(P===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const D=1/P;return e[0]=x*D,e[1]=(S*p*s-h*_*s-S*r*g+i*_*g+h*r*m-i*p*m)*D,e[2]=(a*_*s-S*l*s+S*r*u-i*_*u-a*r*m+i*l*m)*D,e[3]=(h*l*s-a*p*s-h*r*u+i*p*u+a*r*g-i*l*g)*D,e[4]=A*D,e[5]=(d*_*s-v*p*s+v*r*g-t*_*g-d*r*m+t*p*m)*D,e[6]=(v*l*s-o*_*s-v*r*u+t*_*u+o*r*m-t*l*m)*D,e[7]=(o*p*s-d*l*s+d*r*u-t*p*u-o*r*g+t*l*g)*D,e[8]=w*D,e[9]=(v*h*s-d*S*s-v*i*g+t*S*g+d*i*m-t*h*m)*D,e[10]=(o*S*s-v*a*s+v*i*u-t*S*u-o*i*m+t*a*m)*D,e[11]=(d*a*s-o*h*s-d*i*u+t*h*u+o*i*g-t*a*g)*D,e[12]=I*D,e[13]=(d*S*r-v*h*r+v*i*p-t*S*p-d*i*_+t*h*_)*D,e[14]=(v*a*r-o*S*r-v*i*l+t*S*l+o*i*_-t*a*_)*D,e[15]=(o*h*r-d*a*r+d*i*l-t*h*l-o*i*p+t*a*p)*D,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,o=e.x,a=e.y,l=e.z,u=s*o,d=s*a;return this.set(u*o+i,u*a-r*l,u*l+r*a,0,u*a+r*l,d*a+i,d*l-r*o,0,u*l-r*a,d*l+r*o,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,u=s+s,d=o+o,h=a+a,p=s*u,g=s*d,v=s*h,S=o*d,_=o*h,m=a*h,x=l*u,A=l*d,w=l*h,I=i.x,P=i.y,D=i.z;return r[0]=(1-(S+m))*I,r[1]=(g+w)*I,r[2]=(v-A)*I,r[3]=0,r[4]=(g-w)*P,r[5]=(1-(p+m))*P,r[6]=(_+x)*P,r[7]=0,r[8]=(v+A)*D,r[9]=(_-x)*D,r[10]=(1-(p+S))*D,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=dc.set(r[0],r[1],r[2]).length();const o=dc.set(r[4],r[5],r[6]).length(),a=dc.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],_s.copy(this);const u=1/s,d=1/o,h=1/a;return _s.elements[0]*=u,_s.elements[1]*=u,_s.elements[2]*=u,_s.elements[4]*=d,_s.elements[5]*=d,_s.elements[6]*=d,_s.elements[8]*=h,_s.elements[9]*=h,_s.elements[10]*=h,t.setFromRotationMatrix(_s),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=Gs){const l=this.elements,u=2*s/(t-e),d=2*s/(i-r),h=(t+e)/(t-e),p=(i+r)/(i-r);let g,v;if(a===Gs)g=-(o+s)/(o-s),v=-2*o*s/(o-s);else if(a===Fd)g=-o/(o-s),v=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=u,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=d,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=g,l[14]=v,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=Gs){const l=this.elements,u=1/(t-e),d=1/(i-r),h=1/(o-s),p=(t+e)*u,g=(i+r)*d;let v,S;if(a===Gs)v=(o+s)*h,S=-2*h;else if(a===Fd)v=s*h,S=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*u,l[4]=0,l[8]=0,l[12]=-p,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-g,l[2]=0,l[6]=0,l[10]=S,l[14]=-v,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const dc=new G,_s=new mt,BG=new G(0,0,0),LG=new G(1,1,1),ma=new G,Pg=new G,Rr=new G,fI=new mt,dI=new Ii;class cr{constructor(e=0,t=0,i=0,r=cr.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],u=r[5],d=r[9],h=r[2],p=r[6],g=r[10];switch(t){case"XYZ":this._y=Math.asin(Hn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-d,g),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,u),this._z=0);break;case"YXZ":this._x=Math.asin(-Hn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(a,g),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(Hn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-h,g),this._z=Math.atan2(-o,u)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Hn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(p,g),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,u));break;case"YZX":this._z=Math.asin(Hn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,u),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,g));break;case"XZY":this._z=Math.asin(-Hn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,u),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-d,g),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return fI.makeRotationFromQuaternion(e),this.setFromRotationMatrix(fI,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return dI.setFromEuler(this),this.setFromQuaternion(dI,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}cr.DEFAULT_ORDER="XYZ";class Cl{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let u=0,d=l.length;u0){r.children=[];for(let a=0;a0){r.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),u.length>0&&(i.textures=u),d.length>0&&(i.images=d),h.length>0&&(i.shapes=h),p.length>0&&(i.skeletons=p),g.length>0&&(i.animations=g),v.length>0&&(i.nodes=v)}return i.object=r,i;function o(a){const l=[];for(const u in a){const d=a[u];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){As.subVectors(r,t),Mo.subVectors(i,t),qA.subVectors(e,t);const o=As.dot(As),a=As.dot(Mo),l=As.dot(qA),u=Mo.dot(Mo),d=Mo.dot(qA),h=o*u-a*a;if(h===0)return s.set(0,0,0),null;const p=1/h,g=(u*l-a*d)*p,v=(o*d-a*l)*p;return s.set(1-g-v,v,g)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,wo)===null?!1:wo.x>=0&&wo.y>=0&&wo.x+wo.y<=1}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,wo)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,wo.x),l.addScaledVector(o,wo.y),l.addScaledVector(a,wo.z),l)}static isFrontFacing(e,t,i,r){return As.subVectors(i,t),Mo.subVectors(e,t),As.cross(Mo).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return As.subVectors(this.c,this.b),Mo.subVectors(this.a,this.b),As.cross(Mo).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Pr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Pr.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return Pr.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return Pr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Pr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let o,a;mc.subVectors(r,i),gc.subVectors(s,i),ZA.subVectors(e,i);const l=mc.dot(ZA),u=gc.dot(ZA);if(l<=0&&u<=0)return t.copy(i);$A.subVectors(e,r);const d=mc.dot($A),h=gc.dot($A);if(d>=0&&h<=d)return t.copy(r);const p=l*h-d*u;if(p<=0&&l>=0&&d<=0)return o=l/(l-d),t.copy(i).addScaledVector(mc,o);eS.subVectors(e,s);const g=mc.dot(eS),v=gc.dot(eS);if(v>=0&&g<=v)return t.copy(s);const S=g*u-l*v;if(S<=0&&u>=0&&v<=0)return a=u/(u-v),t.copy(i).addScaledVector(gc,a);const _=d*v-g*h;if(_<=0&&h-d>=0&&g-v>=0)return yI.subVectors(s,r),a=(h-d)/(h-d+(g-v)),t.copy(r).addScaledVector(yI,a);const m=1/(_+S+p);return o=S*m,a=p*m,t.copy(i).addScaledVector(mc,o).addScaledVector(gc,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const xI={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},ga={h:0,s:0,l:0},Bg={h:0,s:0,l:0};function tS(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class ke{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Yr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,tn.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=tn.workingColorSpace){return this.r=e,this.g=t,this.b=i,tn.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=tn.workingColorSpace){if(e=kA(e,1),t=Hn(t,0,1),i=Hn(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=tS(o,s,e+1/3),this.g=tS(o,s,e),this.b=tS(o,s,e-1/3)}return tn.toWorkingColorSpace(this,r),this}setStyle(e,t=Yr){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Yr){const i=xI[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=oc(e.r),this.g=oc(e.g),this.b=oc(e.b),this}copyLinearToSRGB(e){return this.r=HA(e.r),this.g=HA(e.g),this.b=HA(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Yr){return tn.fromWorkingColorSpace(Li.copy(this),e),Math.round(Hn(Li.r*255,0,255))*65536+Math.round(Hn(Li.g*255,0,255))*256+Math.round(Hn(Li.b*255,0,255))}getHexString(e=Yr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=tn.workingColorSpace){tn.fromWorkingColorSpace(Li.copy(this),t);const i=Li.r,r=Li.g,s=Li.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,u;const d=(a+o)/2;if(a===o)l=0,u=0;else{const h=o-a;switch(u=d<=.5?h/(o+a):h/(2-o-a),o){case i:l=(r-s)/h+(r0!=e>0&&this.version++,this._alphaTest=e}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==pl&&(i.blending=this.blending),this.side!==zs&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Om&&(i.blendSrc=this.blendSrc),this.blendDst!==km&&(i.blendDst=this.blendDst),this.blendEquation!==la&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==xd&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==NA&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Al&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Al&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Al&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}onBeforeRender(){console.warn("Material: onBeforeRender() has been removed.")}}class Ir extends $n{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ke(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 cr,this.combine=_d,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Eo=kG();function kG(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const u=l-127;u<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):u<-14?(i[l]=1024>>-u-14,i[l|256]=1024>>-u-14|32768,r[l]=-u-1,r[l|256]=-u-1):u<=15?(i[l]=u+15<<10,i[l|256]=u+15<<10|32768,r[l]=13,r[l|256]=13):u<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let u=l<<13,d=0;for(;!(u&8388608);)u<<=1,d-=8388608;u&=-8388609,d+=947912704,s[l]=u|d}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function fr(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=Hn(n,-65504,65504),Eo.floatView[0]=n;const e=Eo.uint32View[0],t=e>>23&511;return Eo.baseTable[t]+((e&8388607)>>Eo.shiftTable[t])}function Gd(n){const e=n>>10;return Eo.uint32View[0]=Eo.mantissaTable[Eo.offsetTable[e]+(n&1023)]+Eo.exponentTable[e],Eo.floatView[0]}const zG={toHalfFloat:fr,fromHalfFloat:Gd},ei=new G,Lg=new Ae;class $t{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Dd,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=ur,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return sc("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const u in l)l[u]!==void 0&&(e[u]=l[u]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const u=i[l];e.data.attributes[l]=u.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const u=this.morphAttributes[l],d=[];for(let h=0,p=u.length;h0&&(r[l]=d,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const u in r){const d=r[u];this.setAttribute(u,d.clone(t))}const s=e.morphAttributes;for(const u in s){const d=[],h=s[u];for(let p=0,g=h.length;p0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;sW0(e.far-e.near,2)))&&(_I.copy(s).invert(),Tl.copy(e.ray).applyMatrix4(_I),!(i.boundingBox!==null&&Tl.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Tl)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,u=s.attributes.uv,d=s.attributes.uv1,h=s.attributes.normal,p=s.groups,g=s.drawRange;if(a!==null)if(Array.isArray(o))for(let v=0,S=p.length;vt.far?null:{distance:u,point:zg.clone(),object:n}}function Hg(n,e,t,i,r,s,o,a,l,u){n.getVertexPosition(a,yc),n.getVertexPosition(l,xc),n.getVertexPosition(u,_c);const d=KG(n,e,t,i,yc,xc,_c,kg);if(d){r&&(Ng.fromBufferAttribute(r,a),Ug.fromBufferAttribute(r,l),Og.fromBufferAttribute(r,u),d.uv=Pr.getInterpolation(kg,yc,xc,_c,Ng,Ug,Og,new Ae)),s&&(Ng.fromBufferAttribute(s,a),Ug.fromBufferAttribute(s,l),Og.fromBufferAttribute(s,u),d.uv1=Pr.getInterpolation(kg,yc,xc,_c,Ng,Ug,Og,new Ae)),o&&(SI.fromBufferAttribute(o,a),MI.fromBufferAttribute(o,l),wI.fromBufferAttribute(o,u),d.normal=Pr.getInterpolation(kg,yc,xc,_c,SI,MI,wI,new G),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));const h={a,b:l,c:u,normal:new G,materialIndex:0};Pr.getNormal(yc,xc,_c,h.normal),d.face=h}return d}class bl extends Pt{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],u=[],d=[],h=[];let p=0,g=0;v("z","y","x",-1,-1,i,t,e,o,s,0),v("z","y","x",1,-1,i,t,-e,o,s,1),v("x","z","y",1,1,e,i,t,r,o,2),v("x","z","y",1,-1,e,i,-t,r,o,3),v("x","y","z",1,-1,e,t,i,r,s,4),v("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new rt(u,3)),this.setAttribute("normal",new rt(d,3)),this.setAttribute("uv",new rt(h,2));function v(S,_,m,x,A,w,I,P,D,N,B){const T=w/D,F=I/N,X=w/2,J=I/2,Q=P/2,ie=D+1,Z=N+1;let fe=0,z=0;const $=new G;for(let ne=0;ne0?1:-1,d.push($.x,$.y,$.z),h.push(Ce/D),h.push(1-ne/N),fe+=1}}for(let ne=0;ne0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class Wd extends jt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new mt,this.projectionMatrix=new mt,this.projectionMatrixInverse=new mt,this.coordinateSystem=Gs}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const va=new G,TI=new Ae,bI=new Ae;class ai extends Wd{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=ic*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Sl*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ic*2*Math.atan(Math.tan(Sl*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){va.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(va.x,va.y).multiplyScalar(-e/va.z),va.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(va.x,va.y).multiplyScalar(-e/va.z)}getViewSize(e,t){return this.getViewBounds(e,TI,bI),t.subVectors(bI,TI)}setViewOffset(e,t,i,r,s,o){this.aspect=e/t,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=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Sl*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,u=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*i/u,r*=o.width/l,i*=o.height/u}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Sc=-90,Mc=1;class RI extends jt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new ai(Sc,Mc,e,t);r.layers=this.layers,this.add(r);const s=new ai(Sc,Mc,e,t);s.layers=this.layers,this.add(s);const o=new ai(Sc,Mc,e,t);o.layers=this.layers,this.add(o);const a=new ai(Sc,Mc,e,t);a.layers=this.layers,this.add(a);const l=new ai(Sc,Mc,e,t);l.layers=this.layers,this.add(l);const u=new ai(Sc,Mc,e,t);u.layers=this.layers,this.add(u)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,o,a,l]=t;for(const u of t)this.remove(u);if(e===Gs)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Fd)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const u of t)this.add(u),u.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,u,d]=this.children,h=e.getRenderTarget(),p=e.getActiveCubeFace(),g=e.getActiveMipmapLevel(),v=e.xr.enabled;e.xr.enabled=!1;const S=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,s),e.setRenderTarget(i,1,r),e.render(t,o),e.setRenderTarget(i,2,r),e.render(t,a),e.setRenderTarget(i,3,r),e.render(t,l),e.setRenderTarget(i,4,r),e.render(t,u),i.texture.generateMipmaps=S,e.setRenderTarget(i,5,r),e.render(t,d),e.setRenderTarget(h,p,g),e.xr.enabled=v,i.texture.needsPMREMUpdate=!0}}class Xd extends Mn{constructor(e,t,i,r,s,o,a,l,u,d){e=e!==void 0?e:[],t=t!==void 0?t:mo,super(e,t,i,r,s,o,a,l,u,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class PI extends ys{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new Xd(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:zn}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include } `,fragmentShader:` uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); } `},r=new bl(5,5,5),s=new Ss({name:"CubemapFromEquirect",uniforms:Ac(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:ji,blending:po});s.uniforms.tEquirect.value=t;const o=new jn(r,s),a=t.minFilter;return t.minFilter===Kr&&(t.minFilter=zn),new RI(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,r);e.setRenderTarget(s)}}const oS=new G,ZG=new G,$G=new Dt;class ya{constructor(e=new G(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=oS.subVectors(i,t).cross(ZG.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(oS),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||$G.getNormalMatrix(e),r=this.coplanarPoint(oS).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Rl=new _i,Gg=new G;class jd{constructor(e=new ya,t=new ya,i=new ya,r=new ya,s=new ya,o=new ya){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Gs){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],u=r[4],d=r[5],h=r[6],p=r[7],g=r[8],v=r[9],S=r[10],_=r[11],m=r[12],x=r[13],A=r[14],w=r[15];if(i[0].setComponents(l-s,p-u,_-g,w-m).normalize(),i[1].setComponents(l+s,p+u,_+g,w+m).normalize(),i[2].setComponents(l+o,p+d,_+v,w+x).normalize(),i[3].setComponents(l-o,p-d,_-v,w-x).normalize(),i[4].setComponents(l-a,p-h,_-S,w-A).normalize(),t===Gs)i[5].setComponents(l+a,p+h,_+S,w+A).normalize();else if(t===Fd)i[5].setComponents(a,h,S,A).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Rl.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Rl.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Rl)}intersectsSprite(e){return Rl.center.set(0,0,0),Rl.radius=.7071067811865476,Rl.applyMatrix4(e.matrixWorld),this.intersectsSphere(Rl)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)0?e.max.x:e.min.x,Gg.y=r.normal.y>0?e.max.y:e.min.y,Gg.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Gg)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function II(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function e4(n){const e=new WeakMap;function t(a,l){const u=a.array,d=a.usage,h=u.byteLength,p=n.createBuffer();n.bindBuffer(l,p),n.bufferData(l,u,d),a.onUploadCallback();let g;if(u instanceof Float32Array)g=n.FLOAT;else if(u instanceof Uint16Array)a.isFloat16BufferAttribute?g=n.HALF_FLOAT:g=n.UNSIGNED_SHORT;else if(u instanceof Int16Array)g=n.SHORT;else if(u instanceof Uint32Array)g=n.UNSIGNED_INT;else if(u instanceof Int32Array)g=n.INT;else if(u instanceof Int8Array)g=n.BYTE;else if(u instanceof Uint8Array)g=n.UNSIGNED_BYTE;else if(u instanceof Uint8ClampedArray)g=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+u);return{buffer:p,type:g,bytesPerElement:u.BYTES_PER_ELEMENT,version:a.version,size:h}}function i(a,l,u){const d=l.array,h=l._updateRange,p=l.updateRanges;if(n.bindBuffer(u,a),h.count===-1&&p.length===0&&n.bufferSubData(u,0,d),p.length!==0){for(let g=0,v=p.length;g 0 vec4 plane; #ifdef ALPHA_TO_COVERAGE float distanceToPlane, distanceGradient; float clipOpacity = 1.0; #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; distanceGradient = fwidth( distanceToPlane ) / 2.0; clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); if ( clipOpacity == 0.0 ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES float unionClipOpacity = 1.0; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; distanceGradient = fwidth( distanceToPlane ) / 2.0; unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); } #pragma unroll_loop_end clipOpacity *= 1.0 - unionClipOpacity; #endif diffuseColor.a *= clipOpacity; if ( diffuseColor.a == 0.0 ) discard; #else #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES bool clipped = true; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; } #pragma unroll_loop_end if ( clipped ) discard; #endif #endif #endif`,v4=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,y4=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif`,x4=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif`,_4=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; #endif`,A4=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; #endif`,S4=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) varying vec3 vColor; #endif`,M4=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) vColor = vec3( 1.0 ); #endif #ifdef USE_COLOR vColor *= color; #endif #ifdef USE_INSTANCING_COLOR vColor.xyz *= instanceColor.xyz; #endif #ifdef USE_BATCHING_COLOR vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); vColor.xyz *= batchingColor.xyz; #endif`,w4=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 #define RECIPROCAL_PI2 0.15915494309189535 #define EPSILON 1e-6 #ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif #define whiteComplement( a ) ( 1.0 - saturate( a ) ) float pow2( const in float x ) { return x*x; } vec3 pow2( const in vec3 x ) { return x*x; } float pow3( const in float x ) { return x*x*x; } float pow4( const in float x ) { float x2 = x*x; return x2*x2; } float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } highp float rand( const in vec2 uv ) { const highp float a = 12.9898, b = 78.233, c = 43758.5453; highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); return fract( sin( sn ) * c ); } #ifdef HIGH_PRECISION float precisionSafeLength( vec3 v ) { return length( v ); } #else float precisionSafeLength( vec3 v ) { float maxComponent = max3( abs( v ) ); return length( v / maxComponent ) * maxComponent; } #endif struct IncidentLight { vec3 color; vec3 direction; bool visible; }; struct ReflectedLight { vec3 directDiffuse; vec3 directSpecular; vec3 indirectDiffuse; vec3 indirectSpecular; }; #ifdef USE_ALPHAHASH varying vec3 vPosition; #endif vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); } mat3 transposeMat3( const in mat3 m ) { mat3 tmp; tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); return tmp; } bool isPerspectiveMatrix( mat4 m ) { return m[ 2 ][ 3 ] == - 1.0; } vec2 equirectUv( in vec3 dir ) { float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; return vec2( u, v ); } vec3 BRDF_Lambert( const in vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor; } vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } // validated`,E4=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { vec3 absDirection = abs( direction ); float face = - 1.0; if ( absDirection.x > absDirection.z ) { if ( absDirection.x > absDirection.y ) face = direction.x > 0.0 ? 0.0 : 3.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } else { if ( absDirection.z > absDirection.y ) face = direction.z > 0.0 ? 2.0 : 5.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } return face; } vec2 getUV( vec3 direction, float face ) { vec2 uv; if ( face == 0.0 ) { uv = vec2( direction.z, direction.y ) / abs( direction.x ); } else if ( face == 1.0 ) { uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); } else if ( face == 2.0 ) { uv = vec2( - direction.x, direction.y ) / abs( direction.z ); } else if ( face == 3.0 ) { uv = vec2( - direction.z, direction.y ) / abs( direction.x ); } else if ( face == 4.0 ) { uv = vec2( - direction.x, direction.z ) / abs( direction.y ); } else { uv = vec2( direction.x, direction.y ) / abs( direction.z ); } return 0.5 * ( uv + 1.0 ); } vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { float face = getFace( direction ); float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); mipInt = max( mipInt, cubeUV_minMipLevel ); float faceSize = exp2( mipInt ); highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; if ( face > 2.0 ) { uv.y += faceSize; face -= 3.0; } uv.x += face * faceSize; uv.x += filterInt * 3.0 * cubeUV_minTileSize; uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); uv.x *= CUBEUV_TEXEL_WIDTH; uv.y *= CUBEUV_TEXEL_HEIGHT; #ifdef texture2DGradEXT return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; #else return texture2D( envMap, uv ).rgb; #endif } #define cubeUV_r0 1.0 #define cubeUV_m0 - 2.0 #define cubeUV_r1 0.8 #define cubeUV_m1 - 1.0 #define cubeUV_r4 0.4 #define cubeUV_m4 2.0 #define cubeUV_r5 0.305 #define cubeUV_m5 3.0 #define cubeUV_r6 0.21 #define cubeUV_m6 4.0 float roughnessToMip( float roughness ) { float mip = 0.0; if ( roughness >= cubeUV_r1 ) { mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; } else if ( roughness >= cubeUV_r4 ) { mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; } else if ( roughness >= cubeUV_r5 ) { mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; } else if ( roughness >= cubeUV_r6 ) { mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; } else { mip = - 2.0 * log2( 1.16 * roughness ); } return mip; } vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); float mipF = fract( mip ); float mipInt = floor( mip ); vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); if ( mipF == 0.0 ) { return vec4( color0, 1.0 ); } else { vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); return vec4( mix( color0, color1, mipF ), 1.0 ); } } #endif`,C4=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif #ifdef USE_BATCHING mat3 bm = mat3( batchingMatrix ); transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); transformedNormal = bm * transformedNormal; #ifdef USE_TANGENT transformedTangent = bm * transformedTangent; #endif #endif #ifdef USE_INSTANCING mat3 im = mat3( instanceMatrix ); transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); transformedNormal = im * transformedNormal; #ifdef USE_TANGENT transformedTangent = im * transformedTangent; #endif #endif transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedNormal = - transformedNormal; #endif #ifdef USE_TANGENT transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif #endif`,T4=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`,b4=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); #endif`,R4=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; #endif`,P4=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`,I4="gl_FragColor = linearToOutputTexel( gl_FragColor );",B4=` const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( vec3( 0.8224621, 0.177538, 0.0 ), vec3( 0.0331941, 0.9668058, 0.0 ), vec3( 0.0170827, 0.0723974, 0.9105199 ) ); const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( vec3( 1.2249401, - 0.2249404, 0.0 ), vec3( - 0.0420569, 1.0420571, 0.0 ), vec3( - 0.0196376, - 0.0786361, 1.0982735 ) ); vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); } vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); } vec4 LinearTransferOETF( in vec4 value ) { return value; } vec4 sRGBTransferOETF( in vec4 value ) { return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); }`,L4=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToFrag = normalize( vWorldPosition - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vec3 reflectVec = reflect( cameraToFrag, worldNormal ); #else vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); #endif #else vec3 reflectVec = vReflect; #endif #ifdef ENVMAP_TYPE_CUBE vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); #else vec4 envColor = vec4( 0.0 ); #endif #ifdef ENVMAP_BLENDING_MULTIPLY outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_MIX ) outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif #endif`,D4=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; uniform mat3 envMapRotation; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #else uniform sampler2D envMap; #endif #endif`,F4=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; uniform float refractionRatio; #else varying vec3 vReflect; #endif #endif`,N4=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; #else varying vec3 vReflect; uniform float refractionRatio; #endif #endif`,U4=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else vec3 cameraToVertex; if ( isOrthographic ) { cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vReflect = reflect( cameraToVertex, worldNormal ); #else vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif #endif`,O4=`#ifdef USE_FOG vFogDepth = - mvPosition.z; #endif`,k4=`#ifdef USE_FOG varying float vFogDepth; #endif`,z4=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); #endif`,H4=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`,G4=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { float dotNL = dot( normal, lightDirection ); vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); #ifdef USE_GRADIENTMAP return vec3( texture2D( gradientMap, coord ).r ); #else vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif }`,V4=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`,W4=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularStrength = specularStrength;`,X4=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; }; void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,j4=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; #endif vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { float x = normal.x, y = normal.y, z = normal.z; vec3 result = shCoefficients[ 0 ] * 0.886227; result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); return result; } vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); return irradiance; } vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { vec3 irradiance = ambientLightColor; return irradiance; } float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); if ( cutoffDistance > 0.0 ) { distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); } return distanceFalloff; } float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { return smoothstep( coneCosine, penumbraCosine, angleCosine ); } #if NUM_DIR_LIGHTS > 0 struct DirectionalLight { vec3 direction; vec3 color; }; uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { light.color = directionalLight.color; light.direction = directionalLight.direction; light.visible = true; } #endif #if NUM_POINT_LIGHTS > 0 struct PointLight { vec3 position; vec3 color; float distance; float decay; }; uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = pointLight.position - geometryPosition; light.direction = normalize( lVector ); float lightDistance = length( lVector ); light.color = pointLight.color; light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } #endif #if NUM_SPOT_LIGHTS > 0 struct SpotLight { vec3 position; vec3 direction; vec3 color; float distance; float decay; float coneCos; float penumbraCos; }; uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = spotLight.position - geometryPosition; light.direction = normalize( lVector ); float angleCos = dot( light.direction, spotLight.direction ); float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); if ( spotAttenuation > 0.0 ) { float lightDistance = length( lVector ); light.color = spotLight.color * spotAttenuation; light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } else { light.color = vec3( 0.0 ); light.visible = false; } } #endif #if NUM_RECT_AREA_LIGHTS > 0 struct RectAreaLight { vec3 color; vec3 position; vec3 halfWidth; vec3 halfHeight; }; uniform sampler2D ltc_1; uniform sampler2D ltc_2; uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; #endif #if NUM_HEMI_LIGHTS > 0 struct HemisphereLight { vec3 direction; vec3 skyColor; vec3 groundColor; }; uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { float dotNL = dot( normal, hemiLight.direction ); float hemiDiffuseWeight = 0.5 * dotNL + 0.5; vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } #endif`,J4=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); return PI * envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 reflectVec = reflect( - viewDir, normal ); reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); return envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } #ifdef USE_ANISOTROPY vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 bentNormal = cross( bitangent, viewDir ); bentNormal = normalize( cross( bentNormal, bitangent ) ); bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); return getIBLRadiance( viewDir, bentNormal, roughness ); #else return vec3( 0.0 ); #endif } #endif #endif`,K4=`ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`,Y4=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Q4=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`,q4=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; float specularShininess; float specularStrength; }; void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; } void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Z4=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; material.roughness = min( material.roughness, 1.0 ); #ifdef IOR material.ior = ior; #ifdef USE_SPECULAR float specularIntensityFactor = specularIntensity; vec3 specularColorFactor = specularColor; #ifdef USE_SPECULAR_COLORMAP specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; #endif #ifdef USE_SPECULAR_INTENSITYMAP specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; #endif material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); #else float specularIntensityFactor = 1.0; vec3 specularColorFactor = vec3( 1.0 ); material.specularF90 = 1.0; #endif material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); #else material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); material.specularF90 = 1.0; #endif #ifdef USE_CLEARCOAT material.clearcoat = clearcoat; material.clearcoatRoughness = clearcoatRoughness; material.clearcoatF0 = vec3( 0.04 ); material.clearcoatF90 = 1.0; #ifdef USE_CLEARCOATMAP material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; #endif material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); material.clearcoatRoughness += geometryRoughness; material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); #endif #ifdef USE_DISPERSION material.dispersion = dispersion; #endif #ifdef USE_IRIDESCENCE material.iridescence = iridescence; material.iridescenceIOR = iridescenceIOR; #ifdef USE_IRIDESCENCEMAP material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; #else material.iridescenceThickness = iridescenceThicknessMaximum; #endif #endif #ifdef USE_SHEEN material.sheenColor = sheenColor; #ifdef USE_SHEEN_COLORMAP material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; #endif material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); #ifdef USE_SHEEN_ROUGHNESSMAP material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; #endif #endif #ifdef USE_ANISOTROPY #ifdef USE_ANISOTROPYMAP mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; #else vec2 anisotropyV = anisotropyVector; #endif material.anisotropy = length( anisotropyV ); if( material.anisotropy == 0.0 ) { anisotropyV = vec2( 1.0, 0.0 ); } else { anisotropyV /= material.anisotropy; material.anisotropy = saturate( material.anisotropy ); } material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; #endif`,$4=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; float specularF90; float dispersion; #ifdef USE_CLEARCOAT float clearcoat; float clearcoatRoughness; vec3 clearcoatF0; float clearcoatF90; #endif #ifdef USE_IRIDESCENCE float iridescence; float iridescenceIOR; float iridescenceThickness; vec3 iridescenceFresnel; vec3 iridescenceF0; #endif #ifdef USE_SHEEN vec3 sheenColor; float sheenRoughness; #endif #ifdef IOR float ior; #endif #ifdef USE_TRANSMISSION float transmission; float transmissionAlpha; float thickness; float attenuationDistance; vec3 attenuationColor; #endif #ifdef USE_ANISOTROPY float anisotropy; float alphaT; vec3 anisotropyT; vec3 anisotropyB; #endif }; vec3 clearcoatSpecularDirect = vec3( 0.0 ); vec3 clearcoatSpecularIndirect = vec3( 0.0 ); vec3 sheenSpecularDirect = vec3( 0.0 ); vec3 sheenSpecularIndirect = vec3(0.0 ); vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); float x2 = x * x; float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); } float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { float a2 = pow2( alpha ); float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); return 0.5 / max( gv + gl, EPSILON ); } float D_GGX( const in float alpha, const in float dotNH ) { float a2 = pow2( alpha ); float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; return RECIPROCAL_PI * a2 / pow2( denom ); } #ifdef USE_ANISOTROPY float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); float v = 0.5 / ( gv + gl ); return saturate(v); } float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { float a2 = alphaT * alphaB; highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); highp float v2 = dot( v, v ); float w2 = a2 / v2; return RECIPROCAL_PI * a2 * pow2 ( w2 ); } #endif #ifdef USE_CLEARCOAT vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { vec3 f0 = material.clearcoatF0; float f90 = material.clearcoatF90; float roughness = material.clearcoatRoughness; float alpha = pow2( roughness ); vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); return F * ( V * D ); } #endif vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { vec3 f0 = material.specularColor; float f90 = material.specularF90; float roughness = material.roughness; float alpha = pow2( roughness ); vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); #ifdef USE_IRIDESCENCE F = mix( F, material.iridescenceFresnel, material.iridescence ); #endif #ifdef USE_ANISOTROPY float dotTL = dot( material.anisotropyT, lightDir ); float dotTV = dot( material.anisotropyT, viewDir ); float dotTH = dot( material.anisotropyT, halfDir ); float dotBL = dot( material.anisotropyB, lightDir ); float dotBV = dot( material.anisotropyB, viewDir ); float dotBH = dot( material.anisotropyB, halfDir ); float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); #else float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); #endif return F * ( V * D ); } vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { const float LUT_SIZE = 64.0; const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; const float LUT_BIAS = 0.5 / LUT_SIZE; float dotNV = saturate( dot( N, V ) ); vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); uv = uv * LUT_SCALE + LUT_BIAS; return uv; } float LTC_ClippedSphereFormFactor( const in vec3 f ) { float l = length( f ); return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); } vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { float x = dot( v1, v2 ); float y = abs( x ); float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; float b = 3.4175940 + ( 4.1616724 + y ) * y; float v = a / b; float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; return cross( v1, v2 ) * theta_sintheta; } vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; vec3 lightNormal = cross( v1, v2 ); if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); vec3 T1, T2; T1 = normalize( V - N * dot( V, N ) ); T2 = - cross( N, T1 ); mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); vec3 coords[ 4 ]; coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); coords[ 0 ] = normalize( coords[ 0 ] ); coords[ 1 ] = normalize( coords[ 1 ] ); coords[ 2 ] = normalize( coords[ 2 ] ); coords[ 3 ] = normalize( coords[ 3 ] ); vec3 vectorFormFactor = vec3( 0.0 ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); return vec3( result ); } #if defined( USE_SHEEN ) float D_Charlie( float roughness, float dotNH ) { float alpha = pow2( roughness ); float invAlpha = 1.0 / alpha; float cos2h = dotNH * dotNH; float sin2h = max( 1.0 - cos2h, 0.0078125 ); return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); } float V_Neubelt( float dotNV, float dotNL ) { return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); } vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float D = D_Charlie( sheenRoughness, dotNH ); float V = V_Neubelt( dotNV, dotNL ); return sheenColor * ( D * V ); } #endif float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); float r2 = roughness * roughness; float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); return saturate( DG * RECIPROCAL_PI ); } vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); vec4 r = roughness * c0 + c1; float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; return fab; } vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { vec2 fab = DFGApprox( normal, viewDir, roughness ); return specularColor * fab.x + specularF90 * fab.y; } #ifdef USE_IRIDESCENCE void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { #else void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { #endif vec2 fab = DFGApprox( normal, viewDir, roughness ); #ifdef USE_IRIDESCENCE vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); #else vec3 Fr = specularColor; #endif vec3 FssEss = Fr * fab.x + specularF90 * fab.y; float Ess = fab.x + fab.y; float Ems = 1.0 - Ess; vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); singleScatter += FssEss; multiScatter += Fms * Ems; } #if NUM_RECT_AREA_LIGHTS > 0 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { vec3 normal = geometryNormal; vec3 viewDir = geometryViewDir; vec3 position = geometryPosition; vec3 lightPos = rectAreaLight.position; vec3 halfWidth = rectAreaLight.halfWidth; vec3 halfHeight = rectAreaLight.halfHeight; vec3 lightColor = rectAreaLight.color; float roughness = material.roughness; vec3 rectCoords[ 4 ]; rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; vec2 uv = LTC_Uv( normal, viewDir, roughness ); vec4 t1 = texture2D( ltc_1, uv ); vec4 t2 = texture2D( ltc_2, uv ); mat3 mInv = mat3( vec3( t1.x, 0, t1.y ), vec3( 0, 1, 0 ), vec3( t1.z, 0, t1.w ) ); vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); } #endif void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; #ifdef USE_CLEARCOAT float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); vec3 ccIrradiance = dotNLcc * directLight.color; clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); #endif #ifdef USE_SHEEN sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); #endif reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { #ifdef USE_CLEARCOAT clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); #endif #ifdef USE_SHEEN sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); #endif vec3 singleScattering = vec3( 0.0 ); vec3 multiScattering = vec3( 0.0 ); vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; #ifdef USE_IRIDESCENCE computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); #else computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); #endif vec3 totalScattering = singleScattering + multiScattering; vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); reflectedLight.indirectSpecular += radiance * singleScattering; reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; } #define RE_Direct RE_Direct_Physical #define RE_Direct_RectArea RE_Direct_RectArea_Physical #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); }`,eV=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); vec3 geometryClearcoatNormal = vec3( 0.0 ); #ifdef USE_CLEARCOAT geometryClearcoatNormal = clearcoatNormal; #endif #ifdef USE_IRIDESCENCE float dotNVi = saturate( dot( normal, geometryViewDir ) ); if ( material.iridescenceThickness == 0.0 ) { material.iridescence = 0.0; } else { material.iridescence = saturate( material.iridescence ); } if ( material.iridescence > 0.0 ) { material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); } #endif IncidentLight directLight; #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) PointLight pointLight; #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { pointLight = pointLights[ i ]; getPointLightInfo( pointLight, geometryPosition, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) pointLightShadow = pointLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) SpotLight spotLight; vec4 spotColor; vec3 spotLightCoord; bool inSpotLightMap; #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { spotLight = spotLights[ i ]; getSpotLightInfo( spotLight, geometryPosition, directLight ); #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS #else #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #endif #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; #endif #undef SPOT_LIGHT_MAP_INDEX #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) spotLightShadow = spotLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) DirectionalLight directionalLight; #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { directionalLight = directionalLights[ i ]; getDirectionalLightInfo( directionalLight, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) directionalLightShadow = directionalLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) RectAreaLight rectAreaLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { rectAreaLight = rectAreaLights[ i ]; RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if defined( RE_IndirectDiffuse ) vec3 iblIrradiance = vec3( 0.0 ); vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); #if defined( USE_LIGHT_PROBES ) irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); #endif #if ( NUM_HEMI_LIGHTS > 0 ) #pragma unroll_loop_start for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); } #pragma unroll_loop_end #endif #endif #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); #endif`,tV=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; irradiance += lightMapIrradiance; #endif #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) iblIrradiance += getIBLIrradiance( geometryNormal ); #endif #endif #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) #ifdef USE_ANISOTROPY radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); #else radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); #endif #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif #endif`,nV=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif`,iV=`#if defined( USE_LOGDEPTHBUF ) gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,rV=`#if defined( USE_LOGDEPTHBUF ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`,sV=`#ifdef USE_LOGDEPTHBUF varying float vFragDepth; varying float vIsPerspective; #endif`,oV=`#ifdef USE_LOGDEPTHBUF vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); #endif`,aV=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); #endif diffuseColor *= sampledDiffuseColor; #endif`,lV=`#ifdef USE_MAP uniform sampler2D map; #endif`,uV=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; #endif #endif #ifdef USE_MAP diffuseColor *= texture2D( map, uv ); #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; #endif`,cV=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) uniform mat3 uvTransform; #endif #endif #ifdef USE_MAP uniform sampler2D map; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; #endif`,fV=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; #endif`,dV=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`,hV=`#ifdef USE_INSTANCING_MORPH float morphTargetInfluences[ MORPHTARGETS_COUNT ]; float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; } #endif`,pV=`#if defined( USE_MORPHCOLORS ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; #elif defined( USE_COLOR ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } #endif`,mV=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; } #endif`,gV=`#ifdef USE_MORPHTARGETS #ifndef USE_INSTANCING_MORPH uniform float morphTargetBaseInfluence; uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; #endif uniform sampler2DArray morphTargetsTexture; uniform ivec2 morphTargetsTextureSize; vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; int y = texelIndex / morphTargetsTextureSize.x; int x = texelIndex - y * morphTargetsTextureSize.x; ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } #endif`,vV=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; } #endif`,yV=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); vec3 normal = normalize( cross( fdx, fdy ) ); #else vec3 normal = normalize( vNormal ); #ifdef DOUBLE_SIDED normal *= faceDirection; #endif #endif #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) #ifdef USE_TANGENT mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn = getTangentFrame( - vViewPosition, normal, #if defined( USE_NORMALMAP ) vNormalMapUv #elif defined( USE_CLEARCOAT_NORMALMAP ) vClearcoatNormalMapUv #else vUv #endif ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn[0] *= faceDirection; tbn[1] *= faceDirection; #endif #endif #ifdef USE_CLEARCOAT_NORMALMAP #ifdef USE_TANGENT mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn2[0] *= faceDirection; tbn2[1] *= faceDirection; #endif #endif vec3 nonPerturbedNormal = normal;`,xV=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; #endif #ifdef DOUBLE_SIDED normal = normal * faceDirection; #endif normal = normalize( normalMatrix * normal ); #elif defined( USE_NORMALMAP_TANGENTSPACE ) vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; mapN.xy *= normalScale; normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); #endif`,_V=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,AV=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,SV=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif`,MV=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif #ifdef USE_NORMALMAP_OBJECTSPACE uniform mat3 normalMatrix; #endif #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { vec3 q0 = dFdx( eye_pos.xyz ); vec3 q1 = dFdy( eye_pos.xyz ); vec2 st0 = dFdx( uv.st ); vec2 st1 = dFdy( uv.st ); vec3 N = surf_norm; vec3 q1perp = cross( q1, N ); vec3 q0perp = cross( N, q0 ); vec3 T = q1perp * st0.x + q0perp * st1.x; vec3 B = q1perp * st0.y + q0perp * st1.y; float det = max( dot( T, T ), dot( B, B ) ); float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } #endif`,wV=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; #endif`,EV=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); #endif`,CV=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform sampler2D clearcoatNormalMap; uniform vec2 clearcoatNormalScale; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; #endif`,TV=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; #endif`,bV=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,RV=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { return 2.0 * rgb.xyz - 1.0; } const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; const float Inv255 = 1. / 255.; const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); vec4 packDepthToRGBA( const in float v ) { if( v <= 0.0 ) return vec4( 0., 0., 0., 0. ); if( v >= 1.0 ) return vec4( 1., 1., 1., 1. ); float vuf; float af = modf( v * PackFactors.a, vuf ); float bf = modf( vuf * ShiftRight8, vuf ); float gf = modf( vuf * ShiftRight8, vuf ); return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); } vec3 packDepthToRGB( const in float v ) { if( v <= 0.0 ) return vec3( 0., 0., 0. ); if( v >= 1.0 ) return vec3( 1., 1., 1. ); float vuf; float bf = modf( v * PackFactors.b, vuf ); float gf = modf( vuf * ShiftRight8, vuf ); return vec3( vuf * Inv255, gf * PackUpscale, bf ); } vec2 packDepthToRG( const in float v ) { if( v <= 0.0 ) return vec2( 0., 0. ); if( v >= 1.0 ) return vec2( 1., 1. ); float vuf; float gf = modf( v * 256., vuf ); return vec2( vuf * Inv255, gf ); } float unpackRGBAToDepth( const in vec4 v ) { return dot( v, UnpackFactors4 ); } float unpackRGBToDepth( const in vec3 v ) { return dot( v, UnpackFactors3 ); } float unpackRGToDepth( const in vec2 v ) { return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; } vec4 pack2HalfToRGBA( const in vec2 v ) { vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); } vec2 unpackRGBATo2Half( const in vec4 v ) { return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); } float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { return ( viewZ + near ) / ( near - far ); } float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { return depth * ( near - far ) - near; } float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * depth - far ); }`,PV=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`,IV=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;`,BV=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`,LV=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } #endif`,DV=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; #endif`,FV=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`,NV=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; #endif #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; struct SpotLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); } vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { return unpackRGBATo2Half( texture2D( shadow, uv ) ); } float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ float occlusion = 1.0; vec2 distribution = texture2DDistribution( shadow, uv ); float hard_shadow = step( compare , distribution.x ); if (hard_shadow != 1.0 ) { float distance = compare - distribution.x ; float variance = max( 0.00000, distribution.y * distribution.y ); float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); } return occlusion; } float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { float shadow = 1.0; shadowCoord.xyz /= shadowCoord.w; shadowCoord.z += shadowBias; bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; bool frustumTest = inFrustum && shadowCoord.z <= 1.0; if ( frustumTest ) { #if defined( SHADOWMAP_TYPE_PCF ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx0 = - texelSize.x * shadowRadius; float dy0 = - texelSize.y * shadowRadius; float dx1 = + texelSize.x * shadowRadius; float dy1 = + texelSize.y * shadowRadius; float dx2 = dx0 / 2.0; float dy2 = dy0 / 2.0; float dx3 = dx1 / 2.0; float dy3 = dy1 / 2.0; shadow = ( texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) ) * ( 1.0 / 17.0 ); #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx = texelSize.x; float dy = texelSize.y; vec2 uv = shadowCoord.xy; vec2 f = fract( uv * shadowMapSize + 0.5 ); uv -= f * texelSize; shadow = ( texture2DCompare( shadowMap, uv, shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), f.x ), mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), f.x ), f.y ) ) * ( 1.0 / 9.0 ); #elif defined( SHADOWMAP_TYPE_VSM ) shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); #else shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); #endif } return mix( 1.0, shadow, shadowIntensity ); } vec2 cubeToUV( vec3 v, float texelSizeY ) { vec3 absV = abs( v ); float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); absV *= scaleToCube; v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); vec2 planar = v.xy; float almostATexel = 1.5 * texelSizeY; float almostOne = 1.0 - almostATexel; if ( absV.z >= almostOne ) { if ( v.z > 0.0 ) planar.x = 4.0 - v.x; } else if ( absV.x >= almostOne ) { float signX = sign( v.x ); planar.x = v.z * signX + 2.0 * signX; } else if ( absV.y >= almostOne ) { float signY = sign( v.y ); planar.x = v.x + 2.0 * signY + 2.0; planar.y = v.z * signY - 2.0; } return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); } float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { float shadow = 1.0; vec3 lightToPosition = shadowCoord.xyz; float lightToPositionLength = length( lightToPosition ); if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; vec3 bd3D = normalize( lightToPosition ); vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; shadow = ( texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) ) * ( 1.0 / 9.0 ); #else shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } return mix( 1.0, shadow, shadowIntensity ); } #endif`,UV=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 struct SpotLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif #endif`,OV=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif #if defined( USE_SHADOWMAP ) #if NUM_DIR_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #endif #if NUM_SPOT_LIGHT_COORDS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { shadowWorldPosition = worldPosition; #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; #endif vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif`,kV=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { directionalLight = directionalLightShadows[ i ]; shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { spotLight = spotLightShadows[ i ]; shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { pointLight = pointLightShadows[ i ]; shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; } #pragma unroll_loop_end #endif #endif return shadow; }`,zV=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`,HV=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; mat4 getBoneMatrix( const in float i ) { int size = textureSize( boneTexture, 0 ).x; int j = int( i ) * 4; int x = j % size; int y = j / size; vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } #endif`,GV=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; skinned += boneMatY * skinVertex * skinWeight.y; skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; #endif`,VV=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; skinMatrix += skinWeight.z * boneMatZ; skinMatrix += skinWeight.w * boneMatW; skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif #endif`,WV=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`,XV=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`,jV=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`,JV=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; vec3 LinearToneMapping( vec3 color ) { return saturate( toneMappingExposure * color ); } vec3 ReinhardToneMapping( vec3 color ) { color *= toneMappingExposure; return saturate( color / ( vec3( 1.0 ) + color ) ); } vec3 OptimizedCineonToneMapping( vec3 color ) { color *= toneMappingExposure; color = max( vec3( 0.0 ), color - 0.004 ); return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); } vec3 RRTAndODTFit( vec3 v ) { vec3 a = v * ( v + 0.0245786 ) - 0.000090537; vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; return a / b; } vec3 ACESFilmicToneMapping( vec3 color ) { const mat3 ACESInputMat = mat3( vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), vec3( 0.04823, 0.01566, 0.83777 ) ); const mat3 ACESOutputMat = mat3( vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), vec3( -0.07367, -0.00605, 1.07602 ) ); color *= toneMappingExposure / 0.6; color = ACESInputMat * color; color = RRTAndODTFit( color ); color = ACESOutputMat * color; return saturate( color ); } const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( vec3( 1.6605, - 0.1246, - 0.0182 ), vec3( - 0.5876, 1.1329, - 0.1006 ), vec3( - 0.0728, - 0.0083, 1.1187 ) ); const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( vec3( 0.6274, 0.0691, 0.0164 ), vec3( 0.3293, 0.9195, 0.0880 ), vec3( 0.0433, 0.0113, 0.8956 ) ); vec3 agxDefaultContrastApprox( vec3 x ) { vec3 x2 = x * x; vec3 x4 = x2 * x2; return + 15.5 * x4 * x2 - 40.14 * x4 * x + 31.96 * x4 - 6.868 * x2 * x + 0.4298 * x2 + 0.1191 * x - 0.00232; } vec3 AgXToneMapping( vec3 color ) { const mat3 AgXInsetMatrix = mat3( vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) ); const mat3 AgXOutsetMatrix = mat3( vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) ); const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; color *= toneMappingExposure; color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; color = AgXInsetMatrix * color; color = max( color, 1e-10 ); color = log2( color ); color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); color = clamp( color, 0.0, 1.0 ); color = agxDefaultContrastApprox( color ); color = AgXOutsetMatrix * color; color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); color = LINEAR_REC2020_TO_LINEAR_SRGB * color; color = clamp( color, 0.0, 1.0 ); return color; } vec3 NeutralToneMapping( vec3 color ) { const float StartCompression = 0.8 - 0.04; const float Desaturation = 0.15; color *= toneMappingExposure; float x = min( color.r, min( color.g, color.b ) ); float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; color -= offset; float peak = max( color.r, max( color.g, color.b ) ); if ( peak < StartCompression ) return color; float d = 1. - StartCompression; float newPeak = 1. - d * d / ( peak + d - StartCompression ); color *= newPeak / peak; float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); return mix( color, vec3( newPeak ), g ); } vec3 CustomToneMapping( vec3 color ) { return color; }`,KV=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; material.attenuationDistance = attenuationDistance; material.attenuationColor = attenuationColor; #ifdef USE_TRANSMISSIONMAP material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; #endif #ifdef USE_THICKNESSMAP material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; #endif vec3 pos = vWorldPosition; vec3 v = normalize( cameraPosition - pos ); vec3 n = inverseTransformDirection( normal, viewMatrix ); vec4 transmitted = getIBLVolumeRefraction( n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); #endif`,YV=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; uniform vec3 attenuationColor; #ifdef USE_TRANSMISSIONMAP uniform sampler2D transmissionMap; #endif #ifdef USE_THICKNESSMAP uniform sampler2D thicknessMap; #endif uniform vec2 transmissionSamplerSize; uniform sampler2D transmissionSamplerMap; uniform mat4 modelMatrix; uniform mat4 projectionMatrix; varying vec3 vWorldPosition; float w0( float a ) { return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); } float w1( float a ) { return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); } float w2( float a ){ return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); } float w3( float a ) { return ( 1.0 / 6.0 ) * ( a * a * a ); } float g0( float a ) { return w0( a ) + w1( a ); } float g1( float a ) { return w2( a ) + w3( a ); } float h0( float a ) { return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); } float h1( float a ) { return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); } vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { uv = uv * texelSize.zw + 0.5; vec2 iuv = floor( uv ); vec2 fuv = fract( uv ); float g0x = g0( fuv.x ); float g1x = g1( fuv.x ); float h0x = h0( fuv.x ); float h1x = h1( fuv.x ); float h0y = h0( fuv.y ); float h1y = h1( fuv.y ); vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); } vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); vec2 fLodSizeInv = 1.0 / fLodSize; vec2 cLodSizeInv = 1.0 / cLodSize; vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); return mix( fSample, cSample, fract( lod ) ); } vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); vec3 modelScale; modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); return normalize( refractionVector ) * thickness * modelScale; } float applyIorToRoughness( const in float roughness, const in float ior ) { return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); } vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); } vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { if ( isinf( attenuationDistance ) ) { return vec3( 1.0 ); } else { vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; } } vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, const in vec3 attenuationColor, const in float attenuationDistance ) { vec4 transmittedLight; vec3 transmittance; #ifdef USE_DISPERSION float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); for ( int i = 0; i < 3; i ++ ) { vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); vec3 refractedRayExit = position + transmissionRay; vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); transmittedLight[ i ] = transmissionSample[ i ]; transmittedLight.a += transmissionSample.a; transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; } transmittedLight.a /= 3.0; #else vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); vec3 refractedRayExit = position + transmissionRay; vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); #endif vec3 attenuatedColor = transmittance * transmittedLight.rgb; vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); } #endif`,QV=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP varying vec2 vNormalMapUv; #endif #ifdef USE_EMISSIVEMAP varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SHEEN_COLORMAP varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_SPECULARMAP varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif`,qV=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP uniform mat3 mapTransform; varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP uniform mat3 alphaMapTransform; varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP uniform mat3 lightMapTransform; varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP uniform mat3 aoMapTransform; varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP uniform mat3 bumpMapTransform; varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP uniform mat3 normalMapTransform; varying vec2 vNormalMapUv; #endif #ifdef USE_DISPLACEMENTMAP uniform mat3 displacementMapTransform; varying vec2 vDisplacementMapUv; #endif #ifdef USE_EMISSIVEMAP uniform mat3 emissiveMapTransform; varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP uniform mat3 metalnessMapTransform; varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP uniform mat3 roughnessMapTransform; varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP uniform mat3 anisotropyMapTransform; varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP uniform mat3 clearcoatMapTransform; varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform mat3 clearcoatNormalMapTransform; varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform mat3 clearcoatRoughnessMapTransform; varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_SHEEN_COLORMAP uniform mat3 sheenColorMapTransform; varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform mat3 sheenRoughnessMapTransform; varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP uniform mat3 iridescenceMapTransform; varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform mat3 iridescenceThicknessMapTransform; varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SPECULARMAP uniform mat3 specularMapTransform; varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP uniform mat3 specularColorMapTransform; varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform mat3 specularIntensityMapTransform; varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif`,ZV=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; #endif #ifdef USE_ALPHAMAP vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; #endif #ifdef USE_LIGHTMAP vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; #endif #ifdef USE_AOMAP vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; #endif #ifdef USE_BUMPMAP vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; #endif #ifdef USE_NORMALMAP vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_DISPLACEMENTMAP vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; #endif #ifdef USE_EMISSIVEMAP vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; #endif #ifdef USE_METALNESSMAP vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ROUGHNESSMAP vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ANISOTROPYMAP vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOATMAP vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_NORMALMAP vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCEMAP vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_COLORMAP vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_ROUGHNESSMAP vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULARMAP vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_COLORMAP vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_INTENSITYMAP vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; #endif #ifdef USE_TRANSMISSIONMAP vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; #endif`,$V=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING worldPosition = batchingMatrix * worldPosition; #endif #ifdef USE_INSTANCING worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; #endif`;const Nt={alphahash_fragment:t4,alphahash_pars_fragment:n4,alphamap_fragment:i4,alphamap_pars_fragment:r4,alphatest_fragment:s4,alphatest_pars_fragment:o4,aomap_fragment:a4,aomap_pars_fragment:l4,batching_pars_vertex:u4,batching_vertex:c4,begin_vertex:f4,beginnormal_vertex:d4,bsdfs:h4,iridescence_fragment:p4,bumpmap_pars_fragment:m4,clipping_planes_fragment:g4,clipping_planes_pars_fragment:v4,clipping_planes_pars_vertex:y4,clipping_planes_vertex:x4,color_fragment:_4,color_pars_fragment:A4,color_pars_vertex:S4,color_vertex:M4,common:w4,cube_uv_reflection_fragment:E4,defaultnormal_vertex:C4,displacementmap_pars_vertex:T4,displacementmap_vertex:b4,emissivemap_fragment:R4,emissivemap_pars_fragment:P4,colorspace_fragment:I4,colorspace_pars_fragment:B4,envmap_fragment:L4,envmap_common_pars_fragment:D4,envmap_pars_fragment:F4,envmap_pars_vertex:N4,envmap_physical_pars_fragment:J4,envmap_vertex:U4,fog_vertex:O4,fog_pars_vertex:k4,fog_fragment:z4,fog_pars_fragment:H4,gradientmap_pars_fragment:G4,lightmap_pars_fragment:V4,lights_lambert_fragment:W4,lights_lambert_pars_fragment:X4,lights_pars_begin:j4,lights_toon_fragment:K4,lights_toon_pars_fragment:Y4,lights_phong_fragment:Q4,lights_phong_pars_fragment:q4,lights_physical_fragment:Z4,lights_physical_pars_fragment:$4,lights_fragment_begin:eV,lights_fragment_maps:tV,lights_fragment_end:nV,logdepthbuf_fragment:iV,logdepthbuf_pars_fragment:rV,logdepthbuf_pars_vertex:sV,logdepthbuf_vertex:oV,map_fragment:aV,map_pars_fragment:lV,map_particle_fragment:uV,map_particle_pars_fragment:cV,metalnessmap_fragment:fV,metalnessmap_pars_fragment:dV,morphinstance_vertex:hV,morphcolor_vertex:pV,morphnormal_vertex:mV,morphtarget_pars_vertex:gV,morphtarget_vertex:vV,normal_fragment_begin:yV,normal_fragment_maps:xV,normal_pars_fragment:_V,normal_pars_vertex:AV,normal_vertex:SV,normalmap_pars_fragment:MV,clearcoat_normal_fragment_begin:wV,clearcoat_normal_fragment_maps:EV,clearcoat_pars_fragment:CV,iridescence_pars_fragment:TV,opaque_fragment:bV,packing:RV,premultiplied_alpha_fragment:PV,project_vertex:IV,dithering_fragment:BV,dithering_pars_fragment:LV,roughnessmap_fragment:DV,roughnessmap_pars_fragment:FV,shadowmap_pars_fragment:NV,shadowmap_pars_vertex:UV,shadowmap_vertex:OV,shadowmask_pars_fragment:kV,skinbase_vertex:zV,skinning_pars_vertex:HV,skinning_vertex:GV,skinnormal_vertex:VV,specularmap_fragment:WV,specularmap_pars_fragment:XV,tonemapping_fragment:jV,tonemapping_pars_fragment:JV,transmission_fragment:KV,transmission_pars_fragment:YV,uv_pars_fragment:QV,uv_pars_vertex:qV,uv_vertex:ZV,worldpos_vertex:$V,background_vert:`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`,background_frag:`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { vec4 texColor = texture2D( t2D, vUv ); #ifdef DECODE_VIDEO_TEXTURE texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,backgroundCube_vert:`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,backgroundCube_frag:`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; #endif uniform float flipEnvMap; uniform float backgroundBlurriness; uniform float backgroundIntensity; uniform mat3 backgroundRotation; varying vec3 vWorldDirection; #include void main() { #ifdef ENVMAP_TYPE_CUBE vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); #elif defined( ENVMAP_TYPE_CUBE_UV ) vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); #else vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,cube_vert:`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,cube_frag:`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; void main() { vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); gl_FragColor = texColor; gl_FragColor.a *= opacity; #include #include }`,depth_vert:`#include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include #include #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vHighPrecisionZW = gl_Position.zw; }`,depth_frag:`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include #include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { vec4 diffuseColor = vec4( 1.0 ); #include #if DEPTH_PACKING == 3200 diffuseColor.a = opacity; #endif #include #include #include #include #include float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; #if DEPTH_PACKING == 3200 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #elif DEPTH_PACKING == 3202 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); #elif DEPTH_PACKING == 3203 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); #endif }`,distanceRGBA_vert:`#define DISTANCE varying vec3 vWorldPosition; #include #include #include #include #include #include #include void main() { #include #include #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vWorldPosition = worldPosition.xyz; }`,distanceRGBA_frag:`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; varying vec3 vWorldPosition; #include #include #include #include #include #include #include #include void main () { vec4 diffuseColor = vec4( 1.0 ); #include #include #include #include #include float dist = length( vWorldPosition - referencePosition ); dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); }`,equirect_vert:`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`,equirect_frag:`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include }`,linedashed_vert:`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include #include #include #include #include #include #include void main() { vLineDistance = scale * lineDistance; #include #include #include #include #include #include #include #include #include #include }`,linedashed_frag:`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; varying float vLineDistance; #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include if ( mod( vLineDistance, totalSize ) > dashSize ) { discard; } vec3 outgoingLight = vec3( 0.0 ); #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,meshbasic_vert:`#include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) #include #include #include #include #include #endif #include #include #include #include #include #include #include #include #include }`,meshbasic_frag:`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; #else reflectedLight.indirectDiffuse += vec3( 1.0 ); #endif #include reflectedLight.indirectDiffuse *= diffuseColor.rgb; vec3 outgoingLight = reflectedLight.indirectDiffuse; #include #include #include #include #include #include #include }`,meshlambert_vert:`#define LAMBERT varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,meshlambert_frag:`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,meshmatcap_vert:`#define MATCAP varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; }`,meshmatcap_frag:`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include #include #include vec3 viewDir = normalize( vViewPosition ); vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); vec3 y = cross( viewDir, x ); vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; #ifdef USE_MATCAP vec4 matcapColor = texture2D( matcap, uv ); #else vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); #endif vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; #include #include #include #include #include #include }`,meshnormal_vert:`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif }`,meshnormal_frag:`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); #include #include #include #include gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); #ifdef OPAQUE gl_FragColor.a = 1.0; #endif }`,meshphong_vert:`#define PHONG varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,meshphong_frag:`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; uniform float shininess; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,meshphysical_vert:`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; #endif #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif }`,meshphysical_frag:`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR #endif uniform vec3 diffuse; uniform vec3 emissive; uniform float roughness; uniform float metalness; uniform float opacity; #ifdef IOR uniform float ior; #endif #ifdef USE_SPECULAR uniform float specularIntensity; uniform vec3 specularColor; #ifdef USE_SPECULAR_COLORMAP uniform sampler2D specularColorMap; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform sampler2D specularIntensityMap; #endif #endif #ifdef USE_CLEARCOAT uniform float clearcoat; uniform float clearcoatRoughness; #endif #ifdef USE_DISPERSION uniform float dispersion; #endif #ifdef USE_IRIDESCENCE uniform float iridescence; uniform float iridescenceIOR; uniform float iridescenceThicknessMinimum; uniform float iridescenceThicknessMaximum; #endif #ifdef USE_SHEEN uniform vec3 sheenColor; uniform float sheenRoughness; #ifdef USE_SHEEN_COLORMAP uniform sampler2D sheenColorMap; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform sampler2D sheenRoughnessMap; #endif #endif #ifdef USE_ANISOTROPY uniform vec2 anisotropyVector; #ifdef USE_ANISOTROPYMAP uniform sampler2D anisotropyMap; #endif #endif varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; #include vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; #ifdef USE_SHEEN float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; #endif #ifdef USE_CLEARCOAT float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; #endif #include #include #include #include #include #include }`,meshtoon_vert:`#define TOON varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include }`,meshtoon_frag:`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include }`,points_vert:`uniform float size; uniform float scale; #include #include #include #include #include #include #ifdef USE_POINTS_UV varying vec2 vUv; uniform mat3 uvTransform; #endif void main() { #ifdef USE_POINTS_UV vUv = ( uvTransform * vec3( uv, 1 ) ).xy; #endif #include #include #include #include #include #include gl_PointSize = size; #ifdef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); #endif #include #include #include #include }`,points_frag:`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include vec3 outgoingLight = vec3( 0.0 ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,shadow_vert:`#include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include }`,shadow_frag:`uniform vec3 color; uniform float opacity; #include #include #include #include #include #include #include #include void main() { #include gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); #include #include #include }`,sprite_vert:`uniform float rotation; uniform vec2 center; #include #include #include #include #include void main() { #include vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); vec2 scale; scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); #ifndef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) scale *= - mvPosition.z; #endif vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; vec2 rotatedPosition; rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; mvPosition.xy += rotatedPosition; gl_Position = projectionMatrix * mvPosition; #include #include #include }`,sprite_frag:`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include vec3 outgoingLight = vec3( 0.0 ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include }`},We={common:{diffuse:{value:new ke(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Dt},alphaMap:{value:null},alphaMapTransform:{value:new Dt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Dt}},envmap:{envMap:{value:null},envMapRotation:{value:new Dt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Dt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Dt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Dt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Dt},normalScale:{value:new Ae(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Dt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Dt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Dt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Dt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ke(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 ke(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Dt},alphaTest:{value:0},uvTransform:{value:new Dt}},sprite:{diffuse:{value:new ke(16777215)},opacity:{value:1},center:{value:new Ae(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Dt},alphaMap:{value:null},alphaMapTransform:{value:new Dt},alphaTest:{value:0}}},Ms={basic:{uniforms:Ki([We.common,We.specularmap,We.envmap,We.aomap,We.lightmap,We.fog]),vertexShader:Nt.meshbasic_vert,fragmentShader:Nt.meshbasic_frag},lambert:{uniforms:Ki([We.common,We.specularmap,We.envmap,We.aomap,We.lightmap,We.emissivemap,We.bumpmap,We.normalmap,We.displacementmap,We.fog,We.lights,{emissive:{value:new ke(0)}}]),vertexShader:Nt.meshlambert_vert,fragmentShader:Nt.meshlambert_frag},phong:{uniforms:Ki([We.common,We.specularmap,We.envmap,We.aomap,We.lightmap,We.emissivemap,We.bumpmap,We.normalmap,We.displacementmap,We.fog,We.lights,{emissive:{value:new ke(0)},specular:{value:new ke(1118481)},shininess:{value:30}}]),vertexShader:Nt.meshphong_vert,fragmentShader:Nt.meshphong_frag},standard:{uniforms:Ki([We.common,We.envmap,We.aomap,We.lightmap,We.emissivemap,We.bumpmap,We.normalmap,We.displacementmap,We.roughnessmap,We.metalnessmap,We.fog,We.lights,{emissive:{value:new ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Nt.meshphysical_vert,fragmentShader:Nt.meshphysical_frag},toon:{uniforms:Ki([We.common,We.aomap,We.lightmap,We.emissivemap,We.bumpmap,We.normalmap,We.displacementmap,We.gradientmap,We.fog,We.lights,{emissive:{value:new ke(0)}}]),vertexShader:Nt.meshtoon_vert,fragmentShader:Nt.meshtoon_frag},matcap:{uniforms:Ki([We.common,We.bumpmap,We.normalmap,We.displacementmap,We.fog,{matcap:{value:null}}]),vertexShader:Nt.meshmatcap_vert,fragmentShader:Nt.meshmatcap_frag},points:{uniforms:Ki([We.points,We.fog]),vertexShader:Nt.points_vert,fragmentShader:Nt.points_frag},dashed:{uniforms:Ki([We.common,We.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Nt.linedashed_vert,fragmentShader:Nt.linedashed_frag},depth:{uniforms:Ki([We.common,We.displacementmap]),vertexShader:Nt.depth_vert,fragmentShader:Nt.depth_frag},normal:{uniforms:Ki([We.common,We.bumpmap,We.normalmap,We.displacementmap,{opacity:{value:1}}]),vertexShader:Nt.meshnormal_vert,fragmentShader:Nt.meshnormal_frag},sprite:{uniforms:Ki([We.sprite,We.fog]),vertexShader:Nt.sprite_vert,fragmentShader:Nt.sprite_frag},background:{uniforms:{uvTransform:{value:new Dt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Nt.background_vert,fragmentShader:Nt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Dt}},vertexShader:Nt.backgroundCube_vert,fragmentShader:Nt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Nt.cube_vert,fragmentShader:Nt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Nt.equirect_vert,fragmentShader:Nt.equirect_frag},distanceRGBA:{uniforms:Ki([We.common,We.displacementmap,{referencePosition:{value:new G},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Nt.distanceRGBA_vert,fragmentShader:Nt.distanceRGBA_frag},shadow:{uniforms:Ki([We.lights,We.fog,{color:{value:new ke(0)},opacity:{value:1}}]),vertexShader:Nt.shadow_vert,fragmentShader:Nt.shadow_frag}};Ms.physical={uniforms:Ki([Ms.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Dt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Dt},clearcoatNormalScale:{value:new Ae(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Dt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Dt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Dt},sheen:{value:0},sheenColor:{value:new ke(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Dt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Dt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Dt},transmissionSamplerSize:{value:new Ae},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Dt},attenuationDistance:{value:0},attenuationColor:{value:new ke(0)},specularColor:{value:new ke(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Dt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Dt},anisotropyVector:{value:new Ae},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Dt}}]),vertexShader:Nt.meshphysical_vert,fragmentShader:Nt.meshphysical_frag};const Vg={r:0,b:0,g:0},Pl=new cr,e9=new mt;function t9(n,e,t,i,r,s,o){const a=new ke(0);let l=s===!0?0:1,u,d,h=null,p=0,g=null;function v(x){let A=x.isScene===!0?x.background:null;return A&&A.isTexture&&(A=(x.backgroundBlurriness>0?t:e).get(A)),A}function S(x){let A=!1;const w=v(x);w===null?m(a,l):w&&w.isColor&&(m(w,1),A=!0);const I=n.xr.getEnvironmentBlendMode();I==="additive"?i.buffers.color.setClear(0,0,0,1,o):I==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||A)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function _(x,A){const w=v(A);w&&(w.isCubeTexture||w.mapping===Qu)?(d===void 0&&(d=new jn(new bl(1,1,1),new Ss({name:"BackgroundCubeMaterial",uniforms:Ac(Ms.backgroundCube.uniforms),vertexShader:Ms.backgroundCube.vertexShader,fragmentShader:Ms.backgroundCube.fragmentShader,side:ji,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(I,P,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(d)),Pl.copy(A.backgroundRotation),Pl.x*=-1,Pl.y*=-1,Pl.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(Pl.y*=-1,Pl.z*=-1),d.material.uniforms.envMap.value=w,d.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=A.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(e9.makeRotationFromEuler(Pl)),d.material.toneMapped=tn.getTransfer(w.colorSpace)!==vn,(h!==w||p!==w.version||g!==n.toneMapping)&&(d.material.needsUpdate=!0,h=w,p=w.version,g=n.toneMapping),d.layers.enableAll(),x.unshift(d,d.geometry,d.material,0,0,null)):w&&w.isTexture&&(u===void 0&&(u=new jn(new wc(2,2),new Ss({name:"BackgroundMaterial",uniforms:Ac(Ms.background.uniforms),vertexShader:Ms.background.vertexShader,fragmentShader:Ms.background.fragmentShader,side:zs,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(u)),u.material.uniforms.t2D.value=w,u.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,u.material.toneMapped=tn.getTransfer(w.colorSpace)!==vn,w.matrixAutoUpdate===!0&&w.updateMatrix(),u.material.uniforms.uvTransform.value.copy(w.matrix),(h!==w||p!==w.version||g!==n.toneMapping)&&(u.material.needsUpdate=!0,h=w,p=w.version,g=n.toneMapping),u.layers.enableAll(),x.unshift(u,u.geometry,u.material,0,0,null))}function m(x,A){x.getRGB(Vg,EI(n)),i.buffers.color.setClear(Vg.r,Vg.g,Vg.b,A,o)}return{getClearColor:function(){return a},setClearColor:function(x,A=1){a.set(x),l=A,m(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(x){l=x,m(a,l)},render:S,addToRenderList:_}}function n9(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=p(null);let s=r,o=!1;function a(T,F,X,J,Q){let ie=!1;const Z=h(J,X,F);s!==Z&&(s=Z,u(s.object)),ie=g(T,J,X,Q),ie&&v(T,J,X,Q),Q!==null&&e.update(Q,n.ELEMENT_ARRAY_BUFFER),(ie||o)&&(o=!1,w(T,F,X,J),Q!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(Q).buffer))}function l(){return n.createVertexArray()}function u(T){return n.bindVertexArray(T)}function d(T){return n.deleteVertexArray(T)}function h(T,F,X){const J=X.wireframe===!0;let Q=i[T.id];Q===void 0&&(Q={},i[T.id]=Q);let ie=Q[F.id];ie===void 0&&(ie={},Q[F.id]=ie);let Z=ie[J];return Z===void 0&&(Z=p(l()),ie[J]=Z),Z}function p(T){const F=[],X=[],J=[];for(let Q=0;Q=0){const ne=Q[z];let de=ie[z];if(de===void 0&&(z==="instanceMatrix"&&T.instanceMatrix&&(de=T.instanceMatrix),z==="instanceColor"&&T.instanceColor&&(de=T.instanceColor)),ne===void 0||ne.attribute!==de||de&&ne.data!==de.data)return!0;Z++}return s.attributesNum!==Z||s.index!==J}function v(T,F,X,J){const Q={},ie=F.attributes;let Z=0;const fe=X.getAttributes();for(const z in fe)if(fe[z].location>=0){let ne=ie[z];ne===void 0&&(z==="instanceMatrix"&&T.instanceMatrix&&(ne=T.instanceMatrix),z==="instanceColor"&&T.instanceColor&&(ne=T.instanceColor));const de={};de.attribute=ne,ne&&ne.data&&(de.data=ne.data),Q[z]=de,Z++}s.attributes=Q,s.attributesNum=Z,s.index=J}function S(){const T=s.newAttributes;for(let F=0,X=T.length;F=0){let $=Q[fe];if($===void 0&&(fe==="instanceMatrix"&&T.instanceMatrix&&($=T.instanceMatrix),fe==="instanceColor"&&T.instanceColor&&($=T.instanceColor)),$!==void 0){const ne=$.normalized,de=$.itemSize,Ce=e.get($);if(Ce===void 0)continue;const ot=Ce.buffer,re=Ce.type,Me=Ce.bytesPerElement,Ie=re===n.INT||re===n.UNSIGNED_INT||$.gpuType===Gm;if($.isInterleavedBufferAttribute){const Be=$.data,$e=Be.stride,Et=$.offset;if(Be.isInstancedInterleavedBuffer){for(let vt=0;vt0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";P="mediump"}return P==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let u=t.precision!==void 0?t.precision:"highp";const d=l(u);d!==u&&(console.warn("THREE.WebGLRenderer:",u,"not supported, using",d,"instead."),u=d);const h=t.logarithmicDepthBuffer===!0,p=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),g=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),v=n.getParameter(n.MAX_TEXTURE_SIZE),S=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),_=n.getParameter(n.MAX_VERTEX_ATTRIBS),m=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),x=n.getParameter(n.MAX_VARYING_VECTORS),A=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),w=g>0,I=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:u,logarithmicDepthBuffer:h,maxTextures:p,maxVertexTextures:g,maxTextureSize:v,maxCubemapSize:S,maxAttributes:_,maxVertexUniforms:m,maxVaryings:x,maxFragmentUniforms:A,vertexTextures:w,maxSamples:I}}function s9(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new ya,a=new Dt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,p){const g=h.length!==0||p||i!==0||r;return r=p,i=h.length,g},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,p){t=d(h,p,0)},this.setState=function(h,p,g){const v=h.clippingPlanes,S=h.clipIntersection,_=h.clipShadows,m=n.get(h);if(!r||v===null||v.length===0||s&&!_)s?d(null):u();else{const x=s?0:i,A=x*4;let w=m.clippingState||null;l.value=w,w=d(v,p,A,g);for(let I=0;I!==A;++I)w[I]=t[I];m.clippingState=w,this.numIntersection=S?this.numPlanes:0,this.numPlanes+=x}};function u(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function d(h,p,g,v){const S=h!==null?h.length:0;let _=null;if(S!==0){if(_=l.value,v!==!0||_===null){const m=g+S*4,x=p.matrixWorldInverse;a.getNormalMatrix(x),(_===null||_.length0){const u=new PI(l.height);return u.fromEquirectangularTexture(n,o),e.set(o,u),o.addEventListener("dispose",r),t(u.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class Ec extends Wd{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,o){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=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,o=i+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const u=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=u*this.view.offsetX,o=s+u*this.view.width,a-=d*this.view.offsetY,l=a-d*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Cc=4,BI=[.125,.215,.35,.446,.526,.582],Il=20,aS=new Ec,LI=new ke;let lS=null,uS=0,cS=0,fS=!1;const Bl=(1+Math.sqrt(5))/2,Tc=1/Bl,DI=[new G(-Bl,Tc,0),new G(Bl,Tc,0),new G(-Tc,0,Bl),new G(Tc,0,Bl),new G(0,Bl,-Tc),new G(0,Bl,Tc),new G(-1,1,-1),new G(1,1,-1),new G(-1,1,1),new G(1,1,1)];class dS{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){lS=this._renderer.getRenderTarget(),uS=this._renderer.getActiveCubeFace(),cS=this._renderer.getActiveMipmapLevel(),fS=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=UI(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=NI(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?A:0,A,A),d.setRenderTarget(r),S&&d.render(v,a),d.render(e,a)}v.geometry.dispose(),v.material.dispose(),d.toneMapping=p,d.autoClear=h,e.background=_}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===mo||e.mapping===ua;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=UI()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=NI());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new jn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Wg(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,aS)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;sIl&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${Il}`);const m=[];let x=0;for(let D=0;DA-Cc?r-A+Cc:0),P=4*(this._cubeSize-w);Wg(t,I,P,3*w,2*w),l.setRenderTarget(t),l.render(h,aS)}}function a9(n){const e=[],t=[],i=[];let r=n;const s=n-Cc+1+BI.length;for(let o=0;on-Cc?l=BI[o-n+Cc-1]:o===0&&(l=0),i.push(l);const u=1/(a-2),d=-u,h=1+u,p=[d,d,h,d,h,h,d,d,h,h,d,h],g=6,v=6,S=3,_=2,m=1,x=new Float32Array(S*v*g),A=new Float32Array(_*v*g),w=new Float32Array(m*v*g);for(let P=0;P2?0:-1,B=[D,N,0,D+2/3,N,0,D+2/3,N+1,0,D,N,0,D+2/3,N+1,0,D,N+1,0];x.set(B,S*v*P),A.set(p,_*v*P);const T=[P,P,P,P,P,P];w.set(T,m*v*P)}const I=new Pt;I.setAttribute("position",new $t(x,S)),I.setAttribute("uv",new $t(A,_)),I.setAttribute("faceIndex",new $t(w,m)),e.push(I),r>Cc&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function FI(n,e,t){const i=new ys(n,e,t);return i.texture.mapping=Qu,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Wg(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function l9(n,e,t){const i=new Float32Array(Il),r=new G(0,1,0);return new Ss({name:"SphericalGaussianBlur",defines:{n:Il,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:hS(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; uniform int samples; uniform float weights[ n ]; uniform bool latitudinal; uniform float dTheta; uniform float mipInt; uniform vec3 poleAxis; #define ENVMAP_TYPE_CUBE_UV #include vec3 getSample( float theta, vec3 axis ) { float cosTheta = cos( theta ); // Rodrigues' axis-angle rotation vec3 sampleDirection = vOutputDirection * cosTheta + cross( axis, vOutputDirection ) * sin( theta ) + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); return bilinearCubeUV( envMap, sampleDirection, mipInt ); } void main() { vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); if ( all( equal( axis, vec3( 0.0 ) ) ) ) { axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); } axis = normalize( axis ); gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); for ( int i = 1; i < n; i++ ) { if ( i >= samples ) { break; } float theta = dTheta * float( i ); gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); } } `,blending:po,depthTest:!1,depthWrite:!1})}function NI(){return new Ss({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:hS(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; #include void main() { vec3 outputDirection = normalize( vOutputDirection ); vec2 uv = equirectUv( outputDirection ); gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } `,blending:po,depthTest:!1,depthWrite:!1})}function UI(){return new Ss({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:hS(),fragmentShader:` precision mediump float; precision mediump int; uniform float flipEnvMap; varying vec3 vOutputDirection; uniform samplerCube envMap; void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } `,blending:po,depthTest:!1,depthWrite:!1})}function hS(){return` precision mediump float; precision mediump int; attribute float faceIndex; varying vec3 vOutputDirection; // RH coordinate system; PMREM face-indexing convention vec3 getDirection( vec2 uv, float face ) { uv = 2.0 * uv - 1.0; vec3 direction = vec3( uv, 1.0 ); if ( face == 0.0 ) { direction = direction.zyx; // ( 1, v, u ) pos x } else if ( face == 1.0 ) { direction = direction.xzy; direction.xz *= -1.0; // ( -u, 1, -v ) pos y } else if ( face == 2.0 ) { direction.x *= -1.0; // ( -u, v, 1 ) pos z } else if ( face == 3.0 ) { direction = direction.zyx; direction.xz *= -1.0; // ( -1, v, -u ) neg x } else if ( face == 4.0 ) { direction = direction.xzy; direction.xy *= -1.0; // ( -u, -1, v ) neg y } else if ( face == 5.0 ) { direction.z *= -1.0; // ( u, v, -1 ) neg z } return direction; } void main() { vOutputDirection = getDirection( uv, faceIndex ); gl_Position = vec4( position, 1.0 ); } `}function u9(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,u=l===Ad||l===Sd,d=l===mo||l===ua;if(u||d){let h=e.get(a);const p=h!==void 0?h.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==p)return t===null&&(t=new dS(n)),h=u?t.fromEquirectangular(a,h):t.fromCubemap(a,h),h.texture.pmremVersion=a.pmremVersion,e.set(a,h),h.texture;if(h!==void 0)return h.texture;{const g=a.image;return u&&g&&g.height>0||d&&g&&r(g)?(t===null&&(t=new dS(n)),h=u?t.fromEquirectangular(a):t.fromCubemap(a),h.texture.pmremVersion=a.pmremVersion,e.set(a,h),a.addEventListener("dispose",s),h.texture):null}}}return a}function r(a){let l=0;const u=6;for(let d=0;de.maxTextureSize&&(I=Math.ceil(w/e.maxTextureSize),w=e.maxTextureSize);const P=new Float32Array(w*I*4*h),D=new wg(P,w,I,h);D.type=ur,D.needsUpdate=!0;const N=A*4;for(let T=0;T0)return n;const r=e*t;let s=VI[r];if(s===void 0&&(s=new Float32Array(r),VI[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function li(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${a}: ${t[o]}`)}return i.join(` `)}function u5(n){const e=tn.getPrimaries(tn.workingColorSpace),t=tn.getPrimaries(n);let i;switch(e===t?i="":e===Ld&&t===Bd?i="LinearDisplayP3ToLinearSRGB":e===Bd&&t===Ld&&(i="LinearSRGBToLinearDisplayP3"),n){case yo:case Pd:return[i,"LinearTransferOETF"];case Yr:case Mg:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function QI(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` `+r+` `+l5(n.getShaderSource(e),o)}else return r}function c5(n,e){const t=u5(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function f5(n,e){let t;switch(e){case DP:t="Linear";break;case FP:t="Reinhard";break;case NP:t="OptimizedCineon";break;case MA:t="ACESFilmic";break;case OP:t="AgX";break;case kP:t="Neutral";break;case UP:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Jg=new G;function d5(){tn.getLuminanceCoefficients(Jg);const n=Jg.x.toFixed(4),e=Jg.y.toFixed(4),t=Jg.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` `)}function h5(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Jd).join(` `)}function p5(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` `)}function m5(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r/gm;function gS(n){return n.replace(g5,y5)}const v5=new Map;function y5(n,e){let t=Nt[e];if(t===void 0){const i=v5.get(e);if(i!==void 0)t=Nt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return gS(t)}const x5=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function $I(n){return n.replace(x5,_5)}function _5(n,e,t,i){let r="";for(let s=parseInt(e);s0&&(_+=` `),m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(Jd).join(` `),m.length>0&&(m+=` `)):(_=[eB(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," 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(Jd).join(` `),m=[eB(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.envMap?"#define "+d:"",t.envMap?"#define "+h:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Hs?"#define TONE_MAPPING":"",t.toneMapping!==Hs?Nt.tonemapping_pars_fragment:"",t.toneMapping!==Hs?f5("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Nt.colorspace_pars_fragment,c5("linearToOutputTexel",t.outputColorSpace),d5(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `].filter(Jd).join(` `)),o=gS(o),o=qI(o,t),o=ZI(o,t),a=gS(a),a=qI(a,t),a=ZI(a,t),o=$I(o),a=$I(a),t.isRawShaderMaterial!==!0&&(x=`#version 300 es `,_=[g,"#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+_,m=["#define varying in",t.glslVersion===OA?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===OA?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` `)+` `+m);const A=x+_+o,w=x+m+a,I=YI(r,r.VERTEX_SHADER,A),P=YI(r,r.FRAGMENT_SHADER,w);r.attachShader(S,I),r.attachShader(S,P),t.index0AttributeName!==void 0?r.bindAttribLocation(S,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(S,0,"position"),r.linkProgram(S);function D(F){if(n.debug.checkShaderErrors){const X=r.getProgramInfoLog(S).trim(),J=r.getShaderInfoLog(I).trim(),Q=r.getShaderInfoLog(P).trim();let ie=!0,Z=!0;if(r.getProgramParameter(S,r.LINK_STATUS)===!1)if(ie=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,S,I,P);else{const fe=QI(r,I,"vertex"),z=QI(r,P,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(S,r.VALIDATE_STATUS)+` Material Name: `+F.name+` Material Type: `+F.type+` Program Info Log: `+X+` `+fe+` `+z)}else X!==""?console.warn("THREE.WebGLProgram: Program Info Log:",X):(J===""||Q==="")&&(Z=!1);Z&&(F.diagnostics={runnable:ie,programLog:X,vertexShader:{log:J,prefix:_},fragmentShader:{log:Q,prefix:m}})}r.deleteShader(I),r.deleteShader(P),N=new jg(r,S),B=m5(r,S)}let N;this.getUniforms=function(){return N===void 0&&D(this),N};let B;this.getAttributes=function(){return B===void 0&&D(this),B};let T=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return T===!1&&(T=r.getProgramParameter(S,o5)),T},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(S),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=a5++,this.cacheKey=e,this.usedTimes=1,this.program=S,this.vertexShader=I,this.fragmentShader=P,this}let T5=0;class b5{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new R5(e),t.set(e,i)),i}}class R5{constructor(e){this.id=T5++,this.code=e,this.usedTimes=0}}function P5(n,e,t,i,r,s,o){const a=new Cl,l=new b5,u=new Set,d=[],h=r.logarithmicDepthBuffer,p=r.vertexTextures;let g=r.precision;const v={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 S(B){return u.add(B),B===0?"uv":`uv${B}`}function _(B,T,F,X,J){const Q=X.fog,ie=J.geometry,Z=B.isMeshStandardMaterial?X.environment:null,fe=(B.isMeshStandardMaterial?t:e).get(B.envMap||Z),z=fe&&fe.mapping===Qu?fe.image.height:null,$=v[B.type];B.precision!==null&&(g=r.getMaxPrecision(B.precision),g!==B.precision&&console.warn("THREE.WebGLProgram.getParameters:",B.precision,"not supported, using",g,"instead."));const ne=ie.morphAttributes.position||ie.morphAttributes.normal||ie.morphAttributes.color,de=ne!==void 0?ne.length:0;let Ce=0;ie.morphAttributes.position!==void 0&&(Ce=1),ie.morphAttributes.normal!==void 0&&(Ce=2),ie.morphAttributes.color!==void 0&&(Ce=3);let ot,re,Me,Ie;if($){const Jt=Ms[$];ot=Jt.vertexShader,re=Jt.fragmentShader}else ot=B.vertexShader,re=B.fragmentShader,l.update(B),Me=l.getVertexShaderID(B),Ie=l.getFragmentShaderID(B);const Be=n.getRenderTarget(),$e=J.isInstancedMesh===!0,Et=J.isBatchedMesh===!0,vt=!!B.map,Mt=!!B.matcap,H=!!fe,Te=!!B.aoMap,be=!!B.lightMap,He=!!B.bumpMap,xe=!!B.normalMap,dt=!!B.displacementMap,Ve=!!B.emissiveMap,qe=!!B.metalnessMap,W=!!B.roughnessMap,U=B.anisotropy>0,ae=B.clearcoat>0,ve=B.dispersion>0,we=B.iridescence>0,Ee=B.sheen>0,ut=B.transmission>0,ze=U&&!!B.anisotropyMap,Qe=ae&&!!B.clearcoatMap,Rt=ae&&!!B.clearcoatNormalMap,Pe=ae&&!!B.clearcoatRoughnessMap,Ke=we&&!!B.iridescenceMap,kt=we&&!!B.iridescenceThicknessMap,Ct=Ee&&!!B.sheenColorMap,et=Ee&&!!B.sheenRoughnessMap,Tt=!!B.specularMap,Ft=!!B.specularColorMap,sn=!!B.specularIntensityMap,K=ut&&!!B.transmissionMap,Le=ut&&!!B.thicknessMap,_e=!!B.gradientMap,Se=!!B.alphaMap,Oe=B.alphaTest>0,_t=!!B.alphaHash,Vt=!!B.extensions;let wn=Hs;B.toneMapped&&(Be===null||Be.isXRRenderTarget===!0)&&(wn=n.toneMapping);const Kn={shaderID:$,shaderType:B.type,shaderName:B.name,vertexShader:ot,fragmentShader:re,defines:B.defines,customVertexShaderID:Me,customFragmentShaderID:Ie,isRawShaderMaterial:B.isRawShaderMaterial===!0,glslVersion:B.glslVersion,precision:g,batching:Et,batchingColor:Et&&J._colorsTexture!==null,instancing:$e,instancingColor:$e&&J.instanceColor!==null,instancingMorph:$e&&J.morphTexture!==null,supportsVertexTextures:p,outputColorSpace:Be===null?n.outputColorSpace:Be.isXRRenderTarget===!0?Be.texture.colorSpace:yo,alphaToCoverage:!!B.alphaToCoverage,map:vt,matcap:Mt,envMap:H,envMapMode:H&&fe.mapping,envMapCubeUVHeight:z,aoMap:Te,lightMap:be,bumpMap:He,normalMap:xe,displacementMap:p&&dt,emissiveMap:Ve,normalMapObjectSpace:xe&&B.normalMapType===JP,normalMapTangentSpace:xe&&B.normalMapType===fa,metalnessMap:qe,roughnessMap:W,anisotropy:U,anisotropyMap:ze,clearcoat:ae,clearcoatMap:Qe,clearcoatNormalMap:Rt,clearcoatRoughnessMap:Pe,dispersion:ve,iridescence:we,iridescenceMap:Ke,iridescenceThicknessMap:kt,sheen:Ee,sheenColorMap:Ct,sheenRoughnessMap:et,specularMap:Tt,specularColorMap:Ft,specularIntensityMap:sn,transmission:ut,transmissionMap:K,thicknessMap:Le,gradientMap:_e,opaque:B.transparent===!1&&B.blending===pl&&B.alphaToCoverage===!1,alphaMap:Se,alphaTest:Oe,alphaHash:_t,combine:B.combine,mapUv:vt&&S(B.map.channel),aoMapUv:Te&&S(B.aoMap.channel),lightMapUv:be&&S(B.lightMap.channel),bumpMapUv:He&&S(B.bumpMap.channel),normalMapUv:xe&&S(B.normalMap.channel),displacementMapUv:dt&&S(B.displacementMap.channel),emissiveMapUv:Ve&&S(B.emissiveMap.channel),metalnessMapUv:qe&&S(B.metalnessMap.channel),roughnessMapUv:W&&S(B.roughnessMap.channel),anisotropyMapUv:ze&&S(B.anisotropyMap.channel),clearcoatMapUv:Qe&&S(B.clearcoatMap.channel),clearcoatNormalMapUv:Rt&&S(B.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Pe&&S(B.clearcoatRoughnessMap.channel),iridescenceMapUv:Ke&&S(B.iridescenceMap.channel),iridescenceThicknessMapUv:kt&&S(B.iridescenceThicknessMap.channel),sheenColorMapUv:Ct&&S(B.sheenColorMap.channel),sheenRoughnessMapUv:et&&S(B.sheenRoughnessMap.channel),specularMapUv:Tt&&S(B.specularMap.channel),specularColorMapUv:Ft&&S(B.specularColorMap.channel),specularIntensityMapUv:sn&&S(B.specularIntensityMap.channel),transmissionMapUv:K&&S(B.transmissionMap.channel),thicknessMapUv:Le&&S(B.thicknessMap.channel),alphaMapUv:Se&&S(B.alphaMap.channel),vertexTangents:!!ie.attributes.tangent&&(xe||U),vertexColors:B.vertexColors,vertexAlphas:B.vertexColors===!0&&!!ie.attributes.color&&ie.attributes.color.itemSize===4,pointsUvs:J.isPoints===!0&&!!ie.attributes.uv&&(vt||Se),fog:!!Q,useFog:B.fog===!0,fogExp2:!!Q&&Q.isFogExp2,flatShading:B.flatShading===!0,sizeAttenuation:B.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:J.isSkinnedMesh===!0,morphTargets:ie.morphAttributes.position!==void 0,morphNormals:ie.morphAttributes.normal!==void 0,morphColors:ie.morphAttributes.color!==void 0,morphTargetsCount:de,morphTextureStride:Ce,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numSpotLightMaps:T.spotLightMap.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numSpotLightShadowsWithMaps:T.numSpotLightShadowsWithMaps,numLightProbes:T.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:B.dithering,shadowMapEnabled:n.shadowMap.enabled&&F.length>0,shadowMapType:n.shadowMap.type,toneMapping:wn,decodeVideoTexture:vt&&B.map.isVideoTexture===!0&&tn.getTransfer(B.map.colorSpace)===vn,premultipliedAlpha:B.premultipliedAlpha,doubleSided:B.side===gs,flipSided:B.side===ji,useDepthPacking:B.depthPacking>=0,depthPacking:B.depthPacking||0,index0AttributeName:B.index0AttributeName,extensionClipCullDistance:Vt&&B.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Vt&&B.extensions.multiDraw===!0||Et)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:B.customProgramCacheKey()};return Kn.vertexUv1s=u.has(1),Kn.vertexUv2s=u.has(2),Kn.vertexUv3s=u.has(3),u.clear(),Kn}function m(B){const T=[];if(B.shaderID?T.push(B.shaderID):(T.push(B.customVertexShaderID),T.push(B.customFragmentShaderID)),B.defines!==void 0)for(const F in B.defines)T.push(F),T.push(B.defines[F]);return B.isRawShaderMaterial===!1&&(x(T,B),A(T,B),T.push(n.outputColorSpace)),T.push(B.customProgramCacheKey),T.join()}function x(B,T){B.push(T.precision),B.push(T.outputColorSpace),B.push(T.envMapMode),B.push(T.envMapCubeUVHeight),B.push(T.mapUv),B.push(T.alphaMapUv),B.push(T.lightMapUv),B.push(T.aoMapUv),B.push(T.bumpMapUv),B.push(T.normalMapUv),B.push(T.displacementMapUv),B.push(T.emissiveMapUv),B.push(T.metalnessMapUv),B.push(T.roughnessMapUv),B.push(T.anisotropyMapUv),B.push(T.clearcoatMapUv),B.push(T.clearcoatNormalMapUv),B.push(T.clearcoatRoughnessMapUv),B.push(T.iridescenceMapUv),B.push(T.iridescenceThicknessMapUv),B.push(T.sheenColorMapUv),B.push(T.sheenRoughnessMapUv),B.push(T.specularMapUv),B.push(T.specularColorMapUv),B.push(T.specularIntensityMapUv),B.push(T.transmissionMapUv),B.push(T.thicknessMapUv),B.push(T.combine),B.push(T.fogExp2),B.push(T.sizeAttenuation),B.push(T.morphTargetsCount),B.push(T.morphAttributeCount),B.push(T.numDirLights),B.push(T.numPointLights),B.push(T.numSpotLights),B.push(T.numSpotLightMaps),B.push(T.numHemiLights),B.push(T.numRectAreaLights),B.push(T.numDirLightShadows),B.push(T.numPointLightShadows),B.push(T.numSpotLightShadows),B.push(T.numSpotLightShadowsWithMaps),B.push(T.numLightProbes),B.push(T.shadowMapType),B.push(T.toneMapping),B.push(T.numClippingPlanes),B.push(T.numClipIntersection),B.push(T.depthPacking)}function A(B,T){a.disableAll(),T.supportsVertexTextures&&a.enable(0),T.instancing&&a.enable(1),T.instancingColor&&a.enable(2),T.instancingMorph&&a.enable(3),T.matcap&&a.enable(4),T.envMap&&a.enable(5),T.normalMapObjectSpace&&a.enable(6),T.normalMapTangentSpace&&a.enable(7),T.clearcoat&&a.enable(8),T.iridescence&&a.enable(9),T.alphaTest&&a.enable(10),T.vertexColors&&a.enable(11),T.vertexAlphas&&a.enable(12),T.vertexUv1s&&a.enable(13),T.vertexUv2s&&a.enable(14),T.vertexUv3s&&a.enable(15),T.vertexTangents&&a.enable(16),T.anisotropy&&a.enable(17),T.alphaHash&&a.enable(18),T.batching&&a.enable(19),T.dispersion&&a.enable(20),T.batchingColor&&a.enable(21),B.push(a.mask),a.disableAll(),T.fog&&a.enable(0),T.useFog&&a.enable(1),T.flatShading&&a.enable(2),T.logarithmicDepthBuffer&&a.enable(3),T.skinning&&a.enable(4),T.morphTargets&&a.enable(5),T.morphNormals&&a.enable(6),T.morphColors&&a.enable(7),T.premultipliedAlpha&&a.enable(8),T.shadowMapEnabled&&a.enable(9),T.doubleSided&&a.enable(10),T.flipSided&&a.enable(11),T.useDepthPacking&&a.enable(12),T.dithering&&a.enable(13),T.transmission&&a.enable(14),T.sheen&&a.enable(15),T.opaque&&a.enable(16),T.pointsUvs&&a.enable(17),T.decodeVideoTexture&&a.enable(18),T.alphaToCoverage&&a.enable(19),B.push(a.mask)}function w(B){const T=v[B.type];let F;if(T){const X=Ms[T];F=CI.clone(X.uniforms)}else F=B.uniforms;return F}function I(B,T){let F;for(let X=0,J=d.length;X0?i.push(m):g.transparent===!0?r.push(m):t.push(m)}function l(h,p,g,v,S,_){const m=o(h,p,g,v,S,_);g.transmission>0?i.unshift(m):g.transparent===!0?r.unshift(m):t.unshift(m)}function u(h,p){t.length>1&&t.sort(h||B5),i.length>1&&i.sort(p||tB),r.length>1&&r.sort(p||tB)}function d(){for(let h=e,p=n.length;h=s.length?(o=new nB,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function D5(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new G,color:new ke};break;case"SpotLight":t={position:new G,direction:new G,color:new ke,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new G,color:new ke,distance:0,decay:0};break;case"HemisphereLight":t={direction:new G,skyColor:new ke,groundColor:new ke};break;case"RectAreaLight":t={color:new ke,position:new G,halfWidth:new G,halfHeight:new G};break}return n[e.id]=t,t}}}function F5(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ae};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ae};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ae,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let N5=0;function U5(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function O5(n){const e=new D5,t=F5(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let u=0;u<9;u++)i.probe.push(new G);const r=new G,s=new mt,o=new mt;function a(u){let d=0,h=0,p=0;for(let B=0;B<9;B++)i.probe[B].set(0,0,0);let g=0,v=0,S=0,_=0,m=0,x=0,A=0,w=0,I=0,P=0,D=0;u.sort(U5);for(let B=0,T=u.length;B0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=We.LTC_FLOAT_1,i.rectAreaLTC2=We.LTC_FLOAT_2):(i.rectAreaLTC1=We.LTC_HALF_1,i.rectAreaLTC2=We.LTC_HALF_2)),i.ambient[0]=d,i.ambient[1]=h,i.ambient[2]=p;const N=i.hash;(N.directionalLength!==g||N.pointLength!==v||N.spotLength!==S||N.rectAreaLength!==_||N.hemiLength!==m||N.numDirectionalShadows!==x||N.numPointShadows!==A||N.numSpotShadows!==w||N.numSpotMaps!==I||N.numLightProbes!==D)&&(i.directional.length=g,i.spot.length=S,i.rectArea.length=_,i.point.length=v,i.hemi.length=m,i.directionalShadow.length=x,i.directionalShadowMap.length=x,i.pointShadow.length=A,i.pointShadowMap.length=A,i.spotShadow.length=w,i.spotShadowMap.length=w,i.directionalShadowMatrix.length=x,i.pointShadowMatrix.length=A,i.spotLightMatrix.length=w+I-P,i.spotLightMap.length=I,i.numSpotLightShadowsWithMaps=P,i.numLightProbes=D,N.directionalLength=g,N.pointLength=v,N.spotLength=S,N.rectAreaLength=_,N.hemiLength=m,N.numDirectionalShadows=x,N.numPointShadows=A,N.numSpotShadows=w,N.numSpotMaps=I,N.numLightProbes=D,i.version=N5++)}function l(u,d){let h=0,p=0,g=0,v=0,S=0;const _=d.matrixWorldInverse;for(let m=0,x=u.length;m=o.length?(a=new iB(n),o.push(a)):a=o[s],a}function i(){e=new WeakMap}return{get:t,dispose:i}}class vS extends $n{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=XP,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class yS extends $n{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const z5=`void main() { gl_Position = vec4( position, 1.0 ); }`,H5=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include void main() { const float samples = float( VSM_SAMPLES ); float mean = 0.0; float squared_mean = 0.0; float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); float uvStart = samples <= 1.0 ? 0.0 : - 1.0; for ( float i = 0.0; i < samples; i ++ ) { float uvOffset = uvStart + i * uvStride; #ifdef HORIZONTAL_PASS vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); mean += distribution.x; squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; #else float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); mean += depth; squared_mean += depth * depth; #endif } mean = mean / samples; squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); }`;function G5(n,e,t){let i=new jd;const r=new Ae,s=new Ae,o=new on,a=new vS({depthPacking:jP}),l=new yS,u={},d=t.maxTextureSize,h={[zs]:ji,[ji]:zs,[gs]:gs},p=new Ss({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ae},radius:{value:4}},vertexShader:z5,fragmentShader:H5}),g=p.clone();g.defines.HORIZONTAL_PASS=1;const v=new Pt;v.setAttribute("position",new $t(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new jn(v,p),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Um;let m=this.type;this.render=function(P,D,N){if(_.enabled===!1||_.autoUpdate===!1&&_.needsUpdate===!1||P.length===0)return;const B=n.getRenderTarget(),T=n.getActiveCubeFace(),F=n.getActiveMipmapLevel(),X=n.state;X.setBlending(po),X.buffers.color.setClear(1,1,1,1),X.buffers.depth.setTest(!0),X.setScissorTest(!1);const J=m!==ms&&this.type===ms,Q=m===ms&&this.type!==ms;for(let ie=0,Z=P.length;ied||r.y>d)&&(r.x>d&&(s.x=Math.floor(d/$.x),r.x=s.x*$.x,z.mapSize.x=s.x),r.y>d&&(s.y=Math.floor(d/$.y),r.y=s.y*$.y,z.mapSize.y=s.y)),z.map===null||J===!0||Q===!0){const de=this.type!==ms?{minFilter:oi,magFilter:oi}:{};z.map!==null&&z.map.dispose(),z.map=new ys(r.x,r.y,de),z.map.texture.name=fe.name+".shadowMap",z.camera.updateProjectionMatrix()}n.setRenderTarget(z.map),n.clear();const ne=z.getViewportCount();for(let de=0;de0||D.map&&D.alphaTest>0){const X=T.uuid,J=D.uuid;let Q=u[X];Q===void 0&&(Q={},u[X]=Q);let ie=Q[J];ie===void 0&&(ie=T.clone(),Q[J]=ie,D.addEventListener("dispose",I)),T=ie}if(T.visible=D.visible,T.wireframe=D.wireframe,B===ms?T.side=D.shadowSide!==null?D.shadowSide:D.side:T.side=D.shadowSide!==null?D.shadowSide:h[D.side],T.alphaMap=D.alphaMap,T.alphaTest=D.alphaTest,T.map=D.map,T.clipShadows=D.clipShadows,T.clippingPlanes=D.clippingPlanes,T.clipIntersection=D.clipIntersection,T.displacementMap=D.displacementMap,T.displacementScale=D.displacementScale,T.displacementBias=D.displacementBias,T.wireframeLinewidth=D.wireframeLinewidth,T.linewidth=D.linewidth,N.isPointLight===!0&&T.isMeshDistanceMaterial===!0){const X=n.properties.get(T);X.light=N}return T}function w(P,D,N,B,T){if(P.visible===!1)return;if(P.layers.test(D.layers)&&(P.isMesh||P.isLine||P.isPoints)&&(P.castShadow||P.receiveShadow&&T===ms)&&(!P.frustumCulled||i.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,P.matrixWorld);const J=e.update(P),Q=P.material;if(Array.isArray(Q)){const ie=J.groups;for(let Z=0,fe=ie.length;Z=1):fe.indexOf("OpenGL ES")!==-1&&(Z=parseFloat(/^OpenGL ES (\d)/.exec(fe)[1]),ie=Z>=2);let z=null,$={};const ne=n.getParameter(n.SCISSOR_BOX),de=n.getParameter(n.VIEWPORT),Ce=new on().fromArray(ne),ot=new on().fromArray(de);function re(K,Le,_e,Se){const Oe=new Uint8Array(4),_t=n.createTexture();n.bindTexture(K,_t),n.texParameteri(K,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(K,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Vt=0;Vt<_e;Vt++)K===n.TEXTURE_3D||K===n.TEXTURE_2D_ARRAY?n.texImage3D(Le,0,n.RGBA,1,1,Se,0,n.RGBA,n.UNSIGNED_BYTE,Oe):n.texImage2D(Le+Vt,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,Oe);return _t}const Me={};Me[n.TEXTURE_2D]=re(n.TEXTURE_2D,n.TEXTURE_2D,1),Me[n.TEXTURE_CUBE_MAP]=re(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),Me[n.TEXTURE_2D_ARRAY]=re(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),Me[n.TEXTURE_3D]=re(n.TEXTURE_3D,n.TEXTURE_3D,1,1),r.setClear(0,0,0,1),s.setClear(1),o.setClear(0),Ie(n.DEPTH_TEST),s.setFunc(xd),He(!1),xe(xA),Ie(n.CULL_FACE),Te(po);function Ie(K){u[K]!==!0&&(n.enable(K),u[K]=!0)}function Be(K){u[K]!==!1&&(n.disable(K),u[K]=!1)}function $e(K,Le){return d[K]!==Le?(n.bindFramebuffer(K,Le),d[K]=Le,K===n.DRAW_FRAMEBUFFER&&(d[n.FRAMEBUFFER]=Le),K===n.FRAMEBUFFER&&(d[n.DRAW_FRAMEBUFFER]=Le),!0):!1}function Et(K,Le){let _e=p,Se=!1;if(K){_e=h.get(Le),_e===void 0&&(_e=[],h.set(Le,_e));const Oe=K.textures;if(_e.length!==Oe.length||_e[0]!==n.COLOR_ATTACHMENT0){for(let _t=0,Vt=Oe.length;_te?(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2):(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0),n}function X5(n,e){const t=n.image&&n.image.width?n.image.width/n.image.height:1;return t>e?(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0):(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2),n}function j5(n){return n.repeat.x=1,n.repeat.y=1,n.offset.x=0,n.offset.y=0,n}function xS(n,e,t,i){const r=J5(i);switch(t){case bA:return n*e;case PA:return n*e;case IA:return n*e*2;case Xm:return n*e/r.components*r.byteLength;case Md:return n*e/r.components*r.byteLength;case BA:return n*e*2/r.components*r.byteLength;case jm:return n*e*2/r.components*r.byteLength;case RA:return n*e*3/r.components*r.byteLength;case Ri:return n*e*4/r.components*r.byteLength;case Jm:return n*e*4/r.components*r.byteLength;case wd:case Ed:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Cd:case Td:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Ym:case qm:return Math.max(n,16)*Math.max(e,8)/4;case Km:case Qm:return Math.max(n,8)*Math.max(e,8)/2;case Zm:case $m:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case eg:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case tg:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case ng:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case ig:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case rg:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case sg:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case og:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case ag:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case lg:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case ug:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case cg:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case fg:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case dg:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case hg:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case pg:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case bd:case mg:case gg:return Math.ceil(n/4)*Math.ceil(e/4)*16;case LA:case vg:return Math.ceil(n/4)*Math.ceil(e/4)*8;case yg:case xg:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function J5(n){switch(n){case vs:case EA:return{byteLength:1,components:1};case $u:case CA:case ec:return{byteLength:2,components:1};case Vm:case Wm:return{byteLength:2,components:4};case go:case Gm:case ur:return{byteLength:4,components:1};case TA:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}const K5={contain:W5,cover:X5,fill:j5,getByteLength:xS};function Y5(n,e,t,i,r,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator=="undefined"?!1:/OculusBrowser/g.test(navigator.userAgent),u=new Ae,d=new WeakMap;let h;const p=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(W){}function v(W,U){return g?new OffscreenCanvas(W,U):Ud("canvas")}function S(W,U,ae){let ve=1;const we=qe(W);if((we.width>ae||we.height>ae)&&(ve=ae/Math.max(we.width,we.height)),ve<1)if(typeof HTMLImageElement!="undefined"&&W instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&W instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&W instanceof ImageBitmap||typeof VideoFrame!="undefined"&&W instanceof VideoFrame){const Ee=Math.floor(ve*we.width),ut=Math.floor(ve*we.height);h===void 0&&(h=v(Ee,ut));const ze=U?v(Ee,ut):h;return ze.width=Ee,ze.height=ut,ze.getContext("2d").drawImage(W,0,0,Ee,ut),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+we.width+"x"+we.height+") to ("+Ee+"x"+ut+")."),ze}else return"data"in W&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+we.width+"x"+we.height+")."),W;return W}function _(W){return W.generateMipmaps&&W.minFilter!==oi&&W.minFilter!==zn}function m(W){n.generateMipmap(W)}function x(W,U,ae,ve,we=!1){if(W!==null){if(n[W]!==void 0)return n[W];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+W+"'")}let Ee=U;if(U===n.RED&&(ae===n.FLOAT&&(Ee=n.R32F),ae===n.HALF_FLOAT&&(Ee=n.R16F),ae===n.UNSIGNED_BYTE&&(Ee=n.R8)),U===n.RED_INTEGER&&(ae===n.UNSIGNED_BYTE&&(Ee=n.R8UI),ae===n.UNSIGNED_SHORT&&(Ee=n.R16UI),ae===n.UNSIGNED_INT&&(Ee=n.R32UI),ae===n.BYTE&&(Ee=n.R8I),ae===n.SHORT&&(Ee=n.R16I),ae===n.INT&&(Ee=n.R32I)),U===n.RG&&(ae===n.FLOAT&&(Ee=n.RG32F),ae===n.HALF_FLOAT&&(Ee=n.RG16F),ae===n.UNSIGNED_BYTE&&(Ee=n.RG8)),U===n.RG_INTEGER&&(ae===n.UNSIGNED_BYTE&&(Ee=n.RG8UI),ae===n.UNSIGNED_SHORT&&(Ee=n.RG16UI),ae===n.UNSIGNED_INT&&(Ee=n.RG32UI),ae===n.BYTE&&(Ee=n.RG8I),ae===n.SHORT&&(Ee=n.RG16I),ae===n.INT&&(Ee=n.RG32I)),U===n.RGB&&ae===n.UNSIGNED_INT_5_9_9_9_REV&&(Ee=n.RGB9_E5),U===n.RGBA){const ut=we?Id:tn.getTransfer(ve);ae===n.FLOAT&&(Ee=n.RGBA32F),ae===n.HALF_FLOAT&&(Ee=n.RGBA16F),ae===n.UNSIGNED_BYTE&&(Ee=ut===vn?n.SRGB8_ALPHA8:n.RGBA8),ae===n.UNSIGNED_SHORT_4_4_4_4&&(Ee=n.RGBA4),ae===n.UNSIGNED_SHORT_5_5_5_1&&(Ee=n.RGB5_A1)}return(Ee===n.R16F||Ee===n.R32F||Ee===n.RG16F||Ee===n.RG32F||Ee===n.RGBA16F||Ee===n.RGBA32F)&&e.get("EXT_color_buffer_float"),Ee}function A(W,U){let ae;return W?U===null||U===go||U===gl?ae=n.DEPTH24_STENCIL8:U===ur?ae=n.DEPTH32F_STENCIL8:U===$u&&(ae=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):U===null||U===go||U===gl?ae=n.DEPTH_COMPONENT24:U===ur?ae=n.DEPTH_COMPONENT32F:U===$u&&(ae=n.DEPTH_COMPONENT16),ae}function w(W,U){return _(W)===!0||W.isFramebufferTexture&&W.minFilter!==oi&&W.minFilter!==zn?Math.log2(Math.max(U.width,U.height))+1:W.mipmaps!==void 0&&W.mipmaps.length>0?W.mipmaps.length:W.isCompressedTexture&&Array.isArray(W.image)?U.mipmaps.length:1}function I(W){const U=W.target;U.removeEventListener("dispose",I),D(U),U.isVideoTexture&&d.delete(U)}function P(W){const U=W.target;U.removeEventListener("dispose",P),B(U)}function D(W){const U=i.get(W);if(U.__webglInit===void 0)return;const ae=W.source,ve=p.get(ae);if(ve){const we=ve[U.__cacheKey];we.usedTimes--,we.usedTimes===0&&N(W),Object.keys(ve).length===0&&p.delete(ae)}i.remove(W)}function N(W){const U=i.get(W);n.deleteTexture(U.__webglTexture);const ae=W.source,ve=p.get(ae);delete ve[U.__cacheKey],o.memory.textures--}function B(W){const U=i.get(W);if(W.depthTexture&&W.depthTexture.dispose(),W.isWebGLCubeRenderTarget)for(let ve=0;ve<6;ve++){if(Array.isArray(U.__webglFramebuffer[ve]))for(let we=0;we=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+W+" texture units while this GPU supports only "+r.maxTextures),T+=1,W}function J(W){const U=[];return U.push(W.wrapS),U.push(W.wrapT),U.push(W.wrapR||0),U.push(W.magFilter),U.push(W.minFilter),U.push(W.anisotropy),U.push(W.internalFormat),U.push(W.format),U.push(W.type),U.push(W.generateMipmaps),U.push(W.premultiplyAlpha),U.push(W.flipY),U.push(W.unpackAlignment),U.push(W.colorSpace),U.join()}function Q(W,U){const ae=i.get(W);if(W.isVideoTexture&&dt(W),W.isRenderTargetTexture===!1&&W.version>0&&ae.__version!==W.version){const ve=W.image;if(ve===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ve.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ot(ae,W,U);return}}t.bindTexture(n.TEXTURE_2D,ae.__webglTexture,n.TEXTURE0+U)}function ie(W,U){const ae=i.get(W);if(W.version>0&&ae.__version!==W.version){ot(ae,W,U);return}t.bindTexture(n.TEXTURE_2D_ARRAY,ae.__webglTexture,n.TEXTURE0+U)}function Z(W,U){const ae=i.get(W);if(W.version>0&&ae.__version!==W.version){ot(ae,W,U);return}t.bindTexture(n.TEXTURE_3D,ae.__webglTexture,n.TEXTURE0+U)}function fe(W,U){const ae=i.get(W);if(W.version>0&&ae.__version!==W.version){re(ae,W,U);return}t.bindTexture(n.TEXTURE_CUBE_MAP,ae.__webglTexture,n.TEXTURE0+U)}const z={[ca]:n.REPEAT,[Tr]:n.CLAMP_TO_EDGE,[qu]:n.MIRRORED_REPEAT},$={[oi]:n.NEAREST,[Hm]:n.NEAREST_MIPMAP_NEAREST,[ml]:n.NEAREST_MIPMAP_LINEAR,[zn]:n.LINEAR,[Zu]:n.LINEAR_MIPMAP_NEAREST,[Kr]:n.LINEAR_MIPMAP_LINEAR},ne={[KP]:n.NEVER,[eI]:n.ALWAYS,[YP]:n.LESS,[UA]:n.LEQUAL,[QP]:n.EQUAL,[$P]:n.GEQUAL,[qP]:n.GREATER,[ZP]:n.NOTEQUAL};function de(W,U){if(U.type===ur&&e.has("OES_texture_float_linear")===!1&&(U.magFilter===zn||U.magFilter===Zu||U.magFilter===ml||U.magFilter===Kr||U.minFilter===zn||U.minFilter===Zu||U.minFilter===ml||U.minFilter===Kr)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(W,n.TEXTURE_WRAP_S,z[U.wrapS]),n.texParameteri(W,n.TEXTURE_WRAP_T,z[U.wrapT]),(W===n.TEXTURE_3D||W===n.TEXTURE_2D_ARRAY)&&n.texParameteri(W,n.TEXTURE_WRAP_R,z[U.wrapR]),n.texParameteri(W,n.TEXTURE_MAG_FILTER,$[U.magFilter]),n.texParameteri(W,n.TEXTURE_MIN_FILTER,$[U.minFilter]),U.compareFunction&&(n.texParameteri(W,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(W,n.TEXTURE_COMPARE_FUNC,ne[U.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(U.magFilter===oi||U.minFilter!==ml&&U.minFilter!==Kr||U.type===ur&&e.has("OES_texture_float_linear")===!1)return;if(U.anisotropy>1||i.get(U).__currentAnisotropy){const ae=e.get("EXT_texture_filter_anisotropic");n.texParameterf(W,ae.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(U.anisotropy,r.getMaxAnisotropy())),i.get(U).__currentAnisotropy=U.anisotropy}}}function Ce(W,U){let ae=!1;W.__webglInit===void 0&&(W.__webglInit=!0,U.addEventListener("dispose",I));const ve=U.source;let we=p.get(ve);we===void 0&&(we={},p.set(ve,we));const Ee=J(U);if(Ee!==W.__cacheKey){we[Ee]===void 0&&(we[Ee]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,ae=!0),we[Ee].usedTimes++;const ut=we[W.__cacheKey];ut!==void 0&&(we[W.__cacheKey].usedTimes--,ut.usedTimes===0&&N(U)),W.__cacheKey=Ee,W.__webglTexture=we[Ee].texture}return ae}function ot(W,U,ae){let ve=n.TEXTURE_2D;(U.isDataArrayTexture||U.isCompressedArrayTexture)&&(ve=n.TEXTURE_2D_ARRAY),U.isData3DTexture&&(ve=n.TEXTURE_3D);const we=Ce(W,U),Ee=U.source;t.bindTexture(ve,W.__webglTexture,n.TEXTURE0+ae);const ut=i.get(Ee);if(Ee.version!==ut.__version||we===!0){t.activeTexture(n.TEXTURE0+ae);const ze=tn.getPrimaries(tn.workingColorSpace),Qe=U.colorSpace===vo?null:tn.getPrimaries(U.colorSpace),Rt=U.colorSpace===vo||ze===Qe?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,U.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,U.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,U.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Rt);let Pe=S(U.image,!1,r.maxTextureSize);Pe=Ve(U,Pe);const Ke=s.convert(U.format,U.colorSpace),kt=s.convert(U.type);let Ct=x(U.internalFormat,Ke,kt,U.colorSpace,U.isVideoTexture);de(ve,U);let et;const Tt=U.mipmaps,Ft=U.isVideoTexture!==!0,sn=ut.__version===void 0||we===!0,K=Ee.dataReady,Le=w(U,Pe);if(U.isDepthTexture)Ct=A(U.format===yl,U.type),sn&&(Ft?t.texStorage2D(n.TEXTURE_2D,1,Ct,Pe.width,Pe.height):t.texImage2D(n.TEXTURE_2D,0,Ct,Pe.width,Pe.height,0,Ke,kt,null));else if(U.isDataTexture)if(Tt.length>0){Ft&&sn&&t.texStorage2D(n.TEXTURE_2D,Le,Ct,Tt[0].width,Tt[0].height);for(let _e=0,Se=Tt.length;_e0){const Oe=xS(et.width,et.height,U.format,U.type);for(const _t of U.layerUpdates){const Vt=et.data.subarray(_t*Oe/et.data.BYTES_PER_ELEMENT,(_t+1)*Oe/et.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,_e,0,0,_t,et.width,et.height,1,Ke,Vt,0,0)}U.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,_e,0,0,0,et.width,et.height,Pe.depth,Ke,et.data,0,0)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,_e,Ct,et.width,et.height,Pe.depth,0,et.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ft?K&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,_e,0,0,0,et.width,et.height,Pe.depth,Ke,kt,et.data):t.texImage3D(n.TEXTURE_2D_ARRAY,_e,Ct,et.width,et.height,Pe.depth,0,Ke,kt,et.data)}else{Ft&&sn&&t.texStorage2D(n.TEXTURE_2D,Le,Ct,Tt[0].width,Tt[0].height);for(let _e=0,Se=Tt.length;_e0){const _e=xS(Pe.width,Pe.height,U.format,U.type);for(const Se of U.layerUpdates){const Oe=Pe.data.subarray(Se*_e/Pe.data.BYTES_PER_ELEMENT,(Se+1)*_e/Pe.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,Se,Pe.width,Pe.height,1,Ke,kt,Oe)}U.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,Pe.width,Pe.height,Pe.depth,Ke,kt,Pe.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,Ct,Pe.width,Pe.height,Pe.depth,0,Ke,kt,Pe.data);else if(U.isData3DTexture)Ft?(sn&&t.texStorage3D(n.TEXTURE_3D,Le,Ct,Pe.width,Pe.height,Pe.depth),K&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,Pe.width,Pe.height,Pe.depth,Ke,kt,Pe.data)):t.texImage3D(n.TEXTURE_3D,0,Ct,Pe.width,Pe.height,Pe.depth,0,Ke,kt,Pe.data);else if(U.isFramebufferTexture){if(sn)if(Ft)t.texStorage2D(n.TEXTURE_2D,Le,Ct,Pe.width,Pe.height);else{let _e=Pe.width,Se=Pe.height;for(let Oe=0;Oe>=1,Se>>=1}}else if(Tt.length>0){if(Ft&&sn){const _e=qe(Tt[0]);t.texStorage2D(n.TEXTURE_2D,Le,Ct,_e.width,_e.height)}for(let _e=0,Se=Tt.length;_e0&&Le++;const Se=qe(Ke[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,Le,Tt,Se.width,Se.height)}for(let Se=0;Se<6;Se++)if(Pe){Ft?K&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Se,0,0,0,Ke[Se].width,Ke[Se].height,Ct,et,Ke[Se].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Se,0,Tt,Ke[Se].width,Ke[Se].height,0,Ct,et,Ke[Se].data);for(let Oe=0;Oe<_e.length;Oe++){const Vt=_e[Oe].image[Se].image;Ft?K&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Oe+1,0,0,Vt.width,Vt.height,Ct,et,Vt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Oe+1,Tt,Vt.width,Vt.height,0,Ct,et,Vt.data)}}else{Ft?K&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Se,0,0,0,Ct,et,Ke[Se]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Se,0,Tt,Ct,et,Ke[Se]);for(let Oe=0;Oe<_e.length;Oe++){const _t=_e[Oe];Ft?K&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Oe+1,0,0,Ct,et,_t.image[Se]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Oe+1,Tt,Ct,et,_t.image[Se])}}}_(U)&&m(n.TEXTURE_CUBE_MAP),Ee.__version=we.version,U.onUpdate&&U.onUpdate(U)}W.__version=U.version}function Me(W,U,ae,ve,we,Ee){const ut=s.convert(ae.format,ae.colorSpace),ze=s.convert(ae.type),Qe=x(ae.internalFormat,ut,ze,ae.colorSpace);if(!i.get(U).__hasExternalTextures){const Pe=Math.max(1,U.width>>Ee),Ke=Math.max(1,U.height>>Ee);we===n.TEXTURE_3D||we===n.TEXTURE_2D_ARRAY?t.texImage3D(we,Ee,Qe,Pe,Ke,U.depth,0,ut,ze,null):t.texImage2D(we,Ee,Qe,Pe,Ke,0,ut,ze,null)}t.bindFramebuffer(n.FRAMEBUFFER,W),xe(U)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,ve,we,i.get(ae).__webglTexture,0,He(U)):(we===n.TEXTURE_2D||we>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&we<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,ve,we,i.get(ae).__webglTexture,Ee),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Ie(W,U,ae){if(n.bindRenderbuffer(n.RENDERBUFFER,W),U.depthBuffer){const ve=U.depthTexture,we=ve&&ve.isDepthTexture?ve.type:null,Ee=A(U.stencilBuffer,we),ut=U.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ze=He(U);xe(U)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ze,Ee,U.width,U.height):ae?n.renderbufferStorageMultisample(n.RENDERBUFFER,ze,Ee,U.width,U.height):n.renderbufferStorage(n.RENDERBUFFER,Ee,U.width,U.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,ut,n.RENDERBUFFER,W)}else{const ve=U.textures;for(let we=0;we1;if(ut||(ve.__webglTexture===void 0&&(ve.__webglTexture=n.createTexture()),ve.__version=U.version,o.memory.textures++),Ee){ae.__webglFramebuffer=[];for(let ze=0;ze<6;ze++)if(U.mipmaps&&U.mipmaps.length>0){ae.__webglFramebuffer[ze]=[];for(let Qe=0;Qe0){ae.__webglFramebuffer=[];for(let ze=0;ze0&&xe(W)===!1){ae.__webglMultisampledFramebuffer=n.createFramebuffer(),ae.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,ae.__webglMultisampledFramebuffer);for(let ze=0;ze0)for(let Qe=0;Qe0)for(let Qe=0;Qe0){if(xe(W)===!1){const U=W.textures,ae=W.width,ve=W.height;let we=n.COLOR_BUFFER_BIT;const Ee=W.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ut=i.get(W),ze=U.length>1;if(ze)for(let Qe=0;Qe0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&U.__useRenderToTexture!==!1}function dt(W){const U=o.render.frame;d.get(W)!==U&&(d.set(W,U),W.update())}function Ve(W,U){const ae=W.colorSpace,ve=W.format,we=W.type;return W.isCompressedTexture===!0||W.isVideoTexture===!0||ae!==yo&&ae!==vo&&(tn.getTransfer(ae)===vn?(ve!==Ri||we!==vs)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ae)),U}function qe(W){return typeof HTMLImageElement!="undefined"&&W instanceof HTMLImageElement?(u.width=W.naturalWidth||W.width,u.height=W.naturalHeight||W.height):typeof VideoFrame!="undefined"&&W instanceof VideoFrame?(u.width=W.displayWidth,u.height=W.displayHeight):(u.width=W.width,u.height=W.height),u}this.allocateTextureUnit=X,this.resetTextureUnits=F,this.setTexture2D=Q,this.setTexture2DArray=ie,this.setTexture3D=Z,this.setTextureCube=fe,this.rebindTextures=Et,this.setupRenderTarget=vt,this.updateRenderTargetMipmap=Mt,this.updateMultisampleRenderTarget=be,this.setupDepthRenderbuffer=$e,this.setupFrameBufferTexture=Me,this.useMultisampledRTT=xe}function rB(n,e){function t(i,r=vo){let s;const o=tn.getTransfer(r);if(i===vs)return n.UNSIGNED_BYTE;if(i===Vm)return n.UNSIGNED_SHORT_4_4_4_4;if(i===Wm)return n.UNSIGNED_SHORT_5_5_5_1;if(i===TA)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===EA)return n.BYTE;if(i===CA)return n.SHORT;if(i===$u)return n.UNSIGNED_SHORT;if(i===Gm)return n.INT;if(i===go)return n.UNSIGNED_INT;if(i===ur)return n.FLOAT;if(i===ec)return n.HALF_FLOAT;if(i===bA)return n.ALPHA;if(i===RA)return n.RGB;if(i===Ri)return n.RGBA;if(i===PA)return n.LUMINANCE;if(i===IA)return n.LUMINANCE_ALPHA;if(i===vl)return n.DEPTH_COMPONENT;if(i===yl)return n.DEPTH_STENCIL;if(i===Xm)return n.RED;if(i===Md)return n.RED_INTEGER;if(i===BA)return n.RG;if(i===jm)return n.RG_INTEGER;if(i===Jm)return n.RGBA_INTEGER;if(i===wd||i===Ed||i===Cd||i===Td)if(o===vn)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===wd)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Ed)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Cd)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Td)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===wd)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Ed)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Cd)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Td)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Km||i===Ym||i===Qm||i===qm)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===Km)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Ym)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Qm)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===qm)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===Zm||i===$m||i===eg)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===Zm||i===$m)return o===vn?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===eg)return o===vn?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===tg||i===ng||i===ig||i===rg||i===sg||i===og||i===ag||i===lg||i===ug||i===cg||i===fg||i===dg||i===hg||i===pg)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===tg)return o===vn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===ng)return o===vn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===ig)return o===vn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===rg)return o===vn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===sg)return o===vn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===og)return o===vn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===ag)return o===vn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===lg)return o===vn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===ug)return o===vn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===cg)return o===vn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===fg)return o===vn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===dg)return o===vn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===hg)return o===vn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===pg)return o===vn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===bd||i===mg||i===gg)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===bd)return o===vn?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===mg)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===gg)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===LA||i===vg||i===yg||i===xg)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===bd)return s.COMPRESSED_RED_RGTC1_EXT;if(i===vg)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===yg)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===xg)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===gl?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}class sB extends ai{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Co extends jt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Q5={type:"move"};class _S{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Co,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 Co,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new G,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new G),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Co,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new G,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new G),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,u=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(u&&e.hand){o=!0;for(const S of e.hand.values()){const _=t.getJointPose(S,i),m=this._getHandJoint(u,S);_!==null&&(m.matrix.fromArray(_.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=_.radius),m.visible=_!==null}const d=u.joints["index-finger-tip"],h=u.joints["thumb-tip"],p=d.position.distanceTo(h.position),g=.02,v=.005;u.inputState.pinching&&p>g+v?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&p<=g-v&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Q5)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),u!==null&&(u.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Co;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const q5=` void main() { gl_Position = vec4( position, 1.0 ); }`,Z5=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; void main() { vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); if ( coord.x >= 1.0 ) { gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; } else { gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; } }`;class $5{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const r=new Mn,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new Ss({vertexShader:q5,fragmentShader:Z5,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new jn(new wc(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class e8 extends xo{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,u=null,d=null,h=null,p=null,g=null,v=null;const S=new $5,_=t.getContextAttributes();let m=null,x=null;const A=[],w=[],I=new Ae;let P=null;const D=new ai;D.layers.enable(1),D.viewport=new on;const N=new ai;N.layers.enable(2),N.viewport=new on;const B=[D,N],T=new sB;T.layers.enable(1),T.layers.enable(2);let F=null,X=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(re){let Me=A[re];return Me===void 0&&(Me=new _S,A[re]=Me),Me.getTargetRaySpace()},this.getControllerGrip=function(re){let Me=A[re];return Me===void 0&&(Me=new _S,A[re]=Me),Me.getGripSpace()},this.getHand=function(re){let Me=A[re];return Me===void 0&&(Me=new _S,A[re]=Me),Me.getHandSpace()};function J(re){const Me=w.indexOf(re.inputSource);if(Me===-1)return;const Ie=A[Me];Ie!==void 0&&(Ie.update(re.inputSource,re.frame,u||o),Ie.dispatchEvent({type:re.type,data:re.inputSource}))}function Q(){r.removeEventListener("select",J),r.removeEventListener("selectstart",J),r.removeEventListener("selectend",J),r.removeEventListener("squeeze",J),r.removeEventListener("squeezestart",J),r.removeEventListener("squeezeend",J),r.removeEventListener("end",Q),r.removeEventListener("inputsourceschange",ie);for(let re=0;re=0&&(w[Be]=null,A[Be].disconnect(Ie))}for(let Me=0;Me=w.length){w.push(Ie),Be=Et;break}else if(w[Et]===null){w[Et]=Ie,Be=Et;break}if(Be===-1)break}const $e=A[Be];$e&&$e.connect(Ie)}}const Z=new G,fe=new G;function z(re,Me,Ie){Z.setFromMatrixPosition(Me.matrixWorld),fe.setFromMatrixPosition(Ie.matrixWorld);const Be=Z.distanceTo(fe),$e=Me.projectionMatrix.elements,Et=Ie.projectionMatrix.elements,vt=$e[14]/($e[10]-1),Mt=$e[14]/($e[10]+1),H=($e[9]+1)/$e[5],Te=($e[9]-1)/$e[5],be=($e[8]-1)/$e[0],He=(Et[8]+1)/Et[0],xe=vt*be,dt=vt*He,Ve=Be/(-be+He),qe=Ve*-be;Me.matrixWorld.decompose(re.position,re.quaternion,re.scale),re.translateX(qe),re.translateZ(Ve),re.matrixWorld.compose(re.position,re.quaternion,re.scale),re.matrixWorldInverse.copy(re.matrixWorld).invert();const W=vt+Ve,U=Mt+Ve,ae=xe-qe,ve=dt+(Be-qe),we=H*Mt/U*W,Ee=Te*Mt/U*W;re.projectionMatrix.makePerspective(ae,ve,we,Ee,W,U),re.projectionMatrixInverse.copy(re.projectionMatrix).invert()}function $(re,Me){Me===null?re.matrixWorld.copy(re.matrix):re.matrixWorld.multiplyMatrices(Me.matrixWorld,re.matrix),re.matrixWorldInverse.copy(re.matrixWorld).invert()}this.updateCamera=function(re){if(r===null)return;S.texture!==null&&(re.near=S.depthNear,re.far=S.depthFar),T.near=N.near=D.near=re.near,T.far=N.far=D.far=re.far,(F!==T.near||X!==T.far)&&(r.updateRenderState({depthNear:T.near,depthFar:T.far}),F=T.near,X=T.far,D.near=F,D.far=X,N.near=F,N.far=X,D.updateProjectionMatrix(),N.updateProjectionMatrix(),re.updateProjectionMatrix());const Me=re.parent,Ie=T.cameras;$(T,Me);for(let Be=0;Be0&&(_.alphaTest.value=m.alphaTest);const x=e.get(m),A=x.envMap,w=x.envMapRotation;A&&(_.envMap.value=A,Ll.copy(w),Ll.x*=-1,Ll.y*=-1,Ll.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(Ll.y*=-1,Ll.z*=-1),_.envMapRotation.value.setFromMatrix4(t8.makeRotationFromEuler(Ll)),_.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=m.reflectivity,_.ior.value=m.ior,_.refractionRatio.value=m.refractionRatio),m.lightMap&&(_.lightMap.value=m.lightMap,_.lightMapIntensity.value=m.lightMapIntensity,t(m.lightMap,_.lightMapTransform)),m.aoMap&&(_.aoMap.value=m.aoMap,_.aoMapIntensity.value=m.aoMapIntensity,t(m.aoMap,_.aoMapTransform))}function o(_,m){_.diffuse.value.copy(m.color),_.opacity.value=m.opacity,m.map&&(_.map.value=m.map,t(m.map,_.mapTransform))}function a(_,m){_.dashSize.value=m.dashSize,_.totalSize.value=m.dashSize+m.gapSize,_.scale.value=m.scale}function l(_,m,x,A){_.diffuse.value.copy(m.color),_.opacity.value=m.opacity,_.size.value=m.size*x,_.scale.value=A*.5,m.map&&(_.map.value=m.map,t(m.map,_.uvTransform)),m.alphaMap&&(_.alphaMap.value=m.alphaMap,t(m.alphaMap,_.alphaMapTransform)),m.alphaTest>0&&(_.alphaTest.value=m.alphaTest)}function u(_,m){_.diffuse.value.copy(m.color),_.opacity.value=m.opacity,_.rotation.value=m.rotation,m.map&&(_.map.value=m.map,t(m.map,_.mapTransform)),m.alphaMap&&(_.alphaMap.value=m.alphaMap,t(m.alphaMap,_.alphaMapTransform)),m.alphaTest>0&&(_.alphaTest.value=m.alphaTest)}function d(_,m){_.specular.value.copy(m.specular),_.shininess.value=Math.max(m.shininess,1e-4)}function h(_,m){m.gradientMap&&(_.gradientMap.value=m.gradientMap)}function p(_,m){_.metalness.value=m.metalness,m.metalnessMap&&(_.metalnessMap.value=m.metalnessMap,t(m.metalnessMap,_.metalnessMapTransform)),_.roughness.value=m.roughness,m.roughnessMap&&(_.roughnessMap.value=m.roughnessMap,t(m.roughnessMap,_.roughnessMapTransform)),m.envMap&&(_.envMapIntensity.value=m.envMapIntensity)}function g(_,m,x){_.ior.value=m.ior,m.sheen>0&&(_.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),_.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(_.sheenColorMap.value=m.sheenColorMap,t(m.sheenColorMap,_.sheenColorMapTransform)),m.sheenRoughnessMap&&(_.sheenRoughnessMap.value=m.sheenRoughnessMap,t(m.sheenRoughnessMap,_.sheenRoughnessMapTransform))),m.clearcoat>0&&(_.clearcoat.value=m.clearcoat,_.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(_.clearcoatMap.value=m.clearcoatMap,t(m.clearcoatMap,_.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,t(m.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(_.clearcoatNormalMap.value=m.clearcoatNormalMap,t(m.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===ji&&_.clearcoatNormalScale.value.negate())),m.dispersion>0&&(_.dispersion.value=m.dispersion),m.iridescence>0&&(_.iridescence.value=m.iridescence,_.iridescenceIOR.value=m.iridescenceIOR,_.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(_.iridescenceMap.value=m.iridescenceMap,t(m.iridescenceMap,_.iridescenceMapTransform)),m.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=m.iridescenceThicknessMap,t(m.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),m.transmission>0&&(_.transmission.value=m.transmission,_.transmissionSamplerMap.value=x.texture,_.transmissionSamplerSize.value.set(x.width,x.height),m.transmissionMap&&(_.transmissionMap.value=m.transmissionMap,t(m.transmissionMap,_.transmissionMapTransform)),_.thickness.value=m.thickness,m.thicknessMap&&(_.thicknessMap.value=m.thicknessMap,t(m.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=m.attenuationDistance,_.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(_.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(_.anisotropyMap.value=m.anisotropyMap,t(m.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=m.specularIntensity,_.specularColor.value.copy(m.specularColor),m.specularColorMap&&(_.specularColorMap.value=m.specularColorMap,t(m.specularColorMap,_.specularColorMapTransform)),m.specularIntensityMap&&(_.specularIntensityMap.value=m.specularIntensityMap,t(m.specularIntensityMap,_.specularIntensityMapTransform))}function v(_,m){m.matcap&&(_.matcap.value=m.matcap)}function S(_,m){const x=e.get(m).light;_.referencePosition.value.setFromMatrixPosition(x.matrixWorld),_.nearDistance.value=x.shadow.camera.near,_.farDistance.value=x.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function i8(n,e,t,i){let r={},s={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(x,A){const w=A.program;i.uniformBlockBinding(x,w)}function u(x,A){let w=r[x.id];w===void 0&&(v(x),w=d(x),r[x.id]=w,x.addEventListener("dispose",_));const I=A.program;i.updateUBOMapping(x,I);const P=e.render.frame;s[x.id]!==P&&(p(x),s[x.id]=P)}function d(x){const A=h();x.__bindingPointIndex=A;const w=n.createBuffer(),I=x.__size,P=x.usage;return n.bindBuffer(n.UNIFORM_BUFFER,w),n.bufferData(n.UNIFORM_BUFFER,I,P),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,A,w),w}function h(){for(let x=0;x0&&(w+=I-P),x.__size=w,x.__cache={},this}function S(x){const A={boundary:0,storage:0};return typeof x=="number"||typeof x=="boolean"?(A.boundary=4,A.storage=4):x.isVector2?(A.boundary=8,A.storage=8):x.isVector3||x.isColor?(A.boundary=16,A.storage=12):x.isVector4?(A.boundary=16,A.storage=16):x.isMatrix3?(A.boundary=48,A.storage=48):x.isMatrix4?(A.boundary=64,A.storage=64):x.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",x),A}function _(x){const A=x.target;A.removeEventListener("dispose",_);const w=o.indexOf(A.__bindingPointIndex);o.splice(w,1),n.deleteBuffer(r[A.id]),delete r[A.id],delete s[A.id]}function m(){for(const x in r)n.deleteBuffer(r[x]);o=[],r={},s={}}return{bind:l,update:u,dispose:m}}class oB{constructor(e={}){const{canvas:t=rI(),context:i=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:u=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let p;if(i!==null){if(typeof WebGLRenderingContext!="undefined"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=i.getContextAttributes().alpha}else p=o;const g=new Uint32Array(4),v=new Int32Array(4);let S=null,_=null;const m=[],x=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Yr,this.toneMapping=Hs,this.toneMappingExposure=1;const A=this;let w=!1,I=0,P=0,D=null,N=-1,B=null;const T=new on,F=new on;let X=null;const J=new ke(0);let Q=0,ie=t.width,Z=t.height,fe=1,z=null,$=null;const ne=new on(0,0,ie,Z),de=new on(0,0,ie,Z);let Ce=!1;const ot=new jd;let re=!1,Me=!1;const Ie=new mt,Be=new G,$e=new on,Et={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let vt=!1;function Mt(){return D===null?fe:1}let H=i;function Te(O,q){return t.getContext(O,q)}try{const O={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:u,powerPreference:d,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${vd}`),t.addEventListener("webglcontextlost",_e,!1),t.addEventListener("webglcontextrestored",Se,!1),t.addEventListener("webglcontextcreationerror",Oe,!1),H===null){const q="webgl2";if(H=Te(q,O),H===null)throw Te(q)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(O){throw console.error("THREE.WebGLRenderer: "+O.message),O}let be,He,xe,dt,Ve,qe,W,U,ae,ve,we,Ee,ut,ze,Qe,Rt,Pe,Ke,kt,Ct,et,Tt,Ft,sn;function K(){be=new c9(H),be.init(),Tt=new rB(H,be),He=new r9(H,be,e,Tt),xe=new V5(H),dt=new h9(H),Ve=new I5,qe=new Y5(H,be,xe,Ve,He,Tt,dt),W=new o9(A),U=new u9(A),ae=new e4(H),Ft=new n9(H,ae),ve=new f9(H,ae,dt,Ft),we=new m9(H,ve,ae,dt),kt=new p9(H,He,qe),Rt=new s9(Ve),Ee=new P5(A,W,U,be,He,Ft,Rt),ut=new n8(A,Ve),ze=new L5,Qe=new k5(be),Ke=new t9(A,W,U,xe,we,p,l),Pe=new G5(A,we,He),sn=new i8(H,dt,He,xe),Ct=new i9(H,be,dt),et=new d9(H,be,dt),dt.programs=Ee.programs,A.capabilities=He,A.extensions=be,A.properties=Ve,A.renderLists=ze,A.shadowMap=Pe,A.state=xe,A.info=dt}K();const Le=new e8(A,H);this.xr=Le,this.getContext=function(){return H},this.getContextAttributes=function(){return H.getContextAttributes()},this.forceContextLoss=function(){const O=be.get("WEBGL_lose_context");O&&O.loseContext()},this.forceContextRestore=function(){const O=be.get("WEBGL_lose_context");O&&O.restoreContext()},this.getPixelRatio=function(){return fe},this.setPixelRatio=function(O){O!==void 0&&(fe=O,this.setSize(ie,Z,!1))},this.getSize=function(O){return O.set(ie,Z)},this.setSize=function(O,q,oe=!0){if(Le.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}ie=O,Z=q,t.width=Math.floor(O*fe),t.height=Math.floor(q*fe),oe===!0&&(t.style.width=O+"px",t.style.height=q+"px"),this.setViewport(0,0,O,q)},this.getDrawingBufferSize=function(O){return O.set(ie*fe,Z*fe).floor()},this.setDrawingBufferSize=function(O,q,oe){ie=O,Z=q,fe=oe,t.width=Math.floor(O*oe),t.height=Math.floor(q*oe),this.setViewport(0,0,O,q)},this.getCurrentViewport=function(O){return O.copy(T)},this.getViewport=function(O){return O.copy(ne)},this.setViewport=function(O,q,oe,le){O.isVector4?ne.set(O.x,O.y,O.z,O.w):ne.set(O,q,oe,le),xe.viewport(T.copy(ne).multiplyScalar(fe).round())},this.getScissor=function(O){return O.copy(de)},this.setScissor=function(O,q,oe,le){O.isVector4?de.set(O.x,O.y,O.z,O.w):de.set(O,q,oe,le),xe.scissor(F.copy(de).multiplyScalar(fe).round())},this.getScissorTest=function(){return Ce},this.setScissorTest=function(O){xe.setScissorTest(Ce=O)},this.setOpaqueSort=function(O){z=O},this.setTransparentSort=function(O){$=O},this.getClearColor=function(O){return O.copy(Ke.getClearColor())},this.setClearColor=function(){Ke.setClearColor.apply(Ke,arguments)},this.getClearAlpha=function(){return Ke.getClearAlpha()},this.setClearAlpha=function(){Ke.setClearAlpha.apply(Ke,arguments)},this.clear=function(O=!0,q=!0,oe=!0){let le=0;if(O){let te=!1;if(D!==null){const De=D.texture.format;te=De===Jm||De===jm||De===Md}if(te){const De=D.texture.type,Xe=De===vs||De===go||De===$u||De===gl||De===Vm||De===Wm,nt=Ke.getClearColor(),Ze=Ke.getClearAlpha(),ht=nt.r,yt=nt.g,ft=nt.b;Xe?(g[0]=ht,g[1]=yt,g[2]=ft,g[3]=Ze,H.clearBufferuiv(H.COLOR,0,g)):(v[0]=ht,v[1]=yt,v[2]=ft,v[3]=Ze,H.clearBufferiv(H.COLOR,0,v))}else le|=H.COLOR_BUFFER_BIT}q&&(le|=H.DEPTH_BUFFER_BIT),oe&&(le|=H.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),H.clear(le)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",_e,!1),t.removeEventListener("webglcontextrestored",Se,!1),t.removeEventListener("webglcontextcreationerror",Oe,!1),ze.dispose(),Qe.dispose(),Ve.dispose(),W.dispose(),U.dispose(),we.dispose(),Ft.dispose(),sn.dispose(),Ee.dispose(),Le.dispose(),Le.removeEventListener("sessionstart",Vn),Le.removeEventListener("sessionend",Xc),Dr.stop()};function _e(O){O.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),w=!0}function Se(){console.log("THREE.WebGLRenderer: Context Restored."),w=!1;const O=dt.autoReset,q=Pe.enabled,oe=Pe.autoUpdate,le=Pe.needsUpdate,te=Pe.type;K(),dt.autoReset=O,Pe.enabled=q,Pe.autoUpdate=oe,Pe.needsUpdate=le,Pe.type=te}function Oe(O){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",O.statusMessage)}function _t(O){const q=O.target;q.removeEventListener("dispose",_t),Vt(q)}function Vt(O){wn(O),Ve.remove(O)}function wn(O){const q=Ve.get(O).programs;q!==void 0&&(q.forEach(function(oe){Ee.releaseProgram(oe)}),O.isShaderMaterial&&Ee.releaseShaderCache(O))}this.renderBufferDirect=function(O,q,oe,le,te,De){q===null&&(q=Et);const Xe=te.isMesh&&te.matrixWorld.determinant()<0,nt=xh(O,q,oe,le,te);xe.setMaterial(le,Xe);let Ze=oe.index,ht=1;if(le.wireframe===!0){if(Ze=ve.getWireframeAttribute(oe),Ze===void 0)return;ht=2}const yt=oe.drawRange,ft=oe.attributes.position;let Yt=yt.start*ht,ln=(yt.start+yt.count)*ht;De!==null&&(Yt=Math.max(Yt,De.start*ht),ln=Math.min(ln,(De.start+De.count)*ht)),Ze!==null?(Yt=Math.max(Yt,0),ln=Math.min(ln,Ze.count)):ft!=null&&(Yt=Math.max(Yt,0),ln=Math.min(ln,ft.count));const en=ln-Yt;if(en<0||en===1/0)return;Ft.setup(te,le,nt,oe,Ze);let xn,st=Ct;if(Ze!==null&&(xn=ae.get(Ze),st=et,st.setIndex(xn)),te.isMesh)le.wireframe===!0?(xe.setLineWidth(le.wireframeLinewidth*Mt()),st.setMode(H.LINES)):st.setMode(H.TRIANGLES);else if(te.isLine){let Ue=le.linewidth;Ue===void 0&&(Ue=1),xe.setLineWidth(Ue*Mt()),te.isLineSegments?st.setMode(H.LINES):te.isLineLoop?st.setMode(H.LINE_LOOP):st.setMode(H.LINE_STRIP)}else te.isPoints?st.setMode(H.POINTS):te.isSprite&&st.setMode(H.TRIANGLES);if(te.isBatchedMesh)if(te._multiDrawInstances!==null)st.renderMultiDrawInstances(te._multiDrawStarts,te._multiDrawCounts,te._multiDrawCount,te._multiDrawInstances);else if(be.get("WEBGL_multi_draw"))st.renderMultiDraw(te._multiDrawStarts,te._multiDrawCounts,te._multiDrawCount);else{const Ue=te._multiDrawStarts,fn=te._multiDrawCounts,At=te._multiDrawCount,un=Ze?ae.get(Ze).bytesPerElement:1,Ui=Ve.get(le).currentProgram.getUniforms();for(let Fn=0;Fn{function De(){if(le.forEach(function(Xe){Ve.get(Xe).currentProgram.isReady()&&le.delete(Xe)}),le.size===0){te(O);return}setTimeout(De,10)}be.get("KHR_parallel_shader_compile")!==null?De():setTimeout(De,10)})};let Jt=null;function Qi(O){Jt&&Jt(O)}function Vn(){Dr.stop()}function Xc(){Dr.start()}const Dr=new II;Dr.setAnimationLoop(Qi),typeof self!="undefined"&&Dr.setContext(self),this.setAnimationLoop=function(O){Jt=O,Le.setAnimationLoop(O),O===null?Dr.stop():Dr.start()},Le.addEventListener("sessionstart",Vn),Le.addEventListener("sessionend",Xc),this.render=function(O,q){if(q!==void 0&&q.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(w===!0)return;if(O.matrixWorldAutoUpdate===!0&&O.updateMatrixWorld(),q.parent===null&&q.matrixWorldAutoUpdate===!0&&q.updateMatrixWorld(),Le.enabled===!0&&Le.isPresenting===!0&&(Le.cameraAutoUpdate===!0&&Le.updateCamera(q),q=Le.getCamera()),O.isScene===!0&&O.onBeforeRender(A,O,q,D),_=Qe.get(O,x.length),_.init(q),x.push(_),Ie.multiplyMatrices(q.projectionMatrix,q.matrixWorldInverse),ot.setFromProjectionMatrix(Ie),Me=this.localClippingEnabled,re=Rt.init(this.clippingPlanes,Me),S=ze.get(O,m.length),S.init(),m.push(S),Le.enabled===!0&&Le.isPresenting===!0){const De=A.xr.getDepthSensingMesh();De!==null&&Ca(De,q,-1/0,A.sortObjects)}Ca(O,q,0,A.sortObjects),S.finish(),A.sortObjects===!0&&S.sort(z,$),vt=Le.enabled===!1||Le.isPresenting===!1||Le.hasDepthSensing()===!1,vt&&Ke.addToRenderList(S,O),this.info.render.frame++,re===!0&&Rt.beginShadows();const oe=_.state.shadowsArray;Pe.render(oe,O,q),re===!0&&Rt.endShadows(),this.info.autoReset===!0&&this.info.reset();const le=S.opaque,te=S.transmissive;if(_.setupLights(),q.isArrayCamera){const De=q.cameras;if(te.length>0)for(let Xe=0,nt=De.length;Xe0&&Ta(le,te,O,q),vt&&Ke.render(O),$l(S,O,q);D!==null&&(qe.updateMultisampleRenderTarget(D),qe.updateRenderTargetMipmap(D)),O.isScene===!0&&O.onAfterRender(A,O,q),Ft.resetDefaultState(),N=-1,B=null,x.pop(),x.length>0?(_=x[x.length-1],re===!0&&Rt.setGlobalState(A.clippingPlanes,_.state.camera)):_=null,m.pop(),m.length>0?S=m[m.length-1]:S=null};function Ca(O,q,oe,le){if(O.visible===!1)return;if(O.layers.test(q.layers)){if(O.isGroup)oe=O.renderOrder;else if(O.isLOD)O.autoUpdate===!0&&O.update(q);else if(O.isLight)_.pushLight(O),O.castShadow&&_.pushShadow(O);else if(O.isSprite){if(!O.frustumCulled||ot.intersectsSprite(O)){le&&$e.setFromMatrixPosition(O.matrixWorld).applyMatrix4(Ie);const Xe=we.update(O),nt=O.material;nt.visible&&S.push(O,Xe,nt,oe,$e.z,null)}}else if((O.isMesh||O.isLine||O.isPoints)&&(!O.frustumCulled||ot.intersectsObject(O))){const Xe=we.update(O),nt=O.material;if(le&&(O.boundingSphere!==void 0?(O.boundingSphere===null&&O.computeBoundingSphere(),$e.copy(O.boundingSphere.center)):(Xe.boundingSphere===null&&Xe.computeBoundingSphere(),$e.copy(Xe.boundingSphere.center)),$e.applyMatrix4(O.matrixWorld).applyMatrix4(Ie)),Array.isArray(nt)){const Ze=Xe.groups;for(let ht=0,yt=Ze.length;ht0&&ba(te,q,oe),De.length>0&&ba(De,q,oe),Xe.length>0&&ba(Xe,q,oe),xe.buffers.depth.setTest(!0),xe.buffers.depth.setMask(!0),xe.buffers.color.setMask(!0),xe.setPolygonOffset(!1)}function Ta(O,q,oe,le){if((oe.isScene===!0?oe.overrideMaterial:null)!==null)return;_.state.transmissionRenderTarget[le.id]===void 0&&(_.state.transmissionRenderTarget[le.id]=new ys(1,1,{generateMipmaps:!0,type:be.has("EXT_color_buffer_half_float")||be.has("EXT_color_buffer_float")?ec:vs,minFilter:Kr,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:tn.workingColorSpace}));const De=_.state.transmissionRenderTarget[le.id],Xe=le.viewport||T;De.setSize(Xe.z,Xe.w);const nt=A.getRenderTarget();A.setRenderTarget(De),A.getClearColor(J),Q=A.getClearAlpha(),Q<1&&A.setClearColor(16777215,.5),A.clear(),vt&&Ke.render(oe);const Ze=A.toneMapping;A.toneMapping=Hs;const ht=le.viewport;if(le.viewport!==void 0&&(le.viewport=void 0),_.setupLightsView(le),re===!0&&Rt.setGlobalState(A.clippingPlanes,le),ba(O,oe,le),qe.updateMultisampleRenderTarget(De),qe.updateRenderTargetMipmap(De),be.has("WEBGL_multisampled_render_to_texture")===!1){let yt=!1;for(let ft=0,Yt=q.length;ft0),ft=!!oe.morphAttributes.position,Yt=!!oe.morphAttributes.normal,ln=!!oe.morphAttributes.color;let en=Hs;le.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(en=A.toneMapping);const xn=oe.morphAttributes.position||oe.morphAttributes.normal||oe.morphAttributes.color,st=xn!==void 0?xn.length:0,Ue=Ve.get(le),fn=_.state.lights;if(re===!0&&(Me===!0||O!==B)){const ci=O===B&&le.id===N;Rt.setState(le,O,ci)}let At=!1;le.version===Ue.__version?(Ue.needsLights&&Ue.lightsStateVersion!==fn.state.version||Ue.outputColorSpace!==nt||te.isBatchedMesh&&Ue.batching===!1||!te.isBatchedMesh&&Ue.batching===!0||te.isBatchedMesh&&Ue.batchingColor===!0&&te.colorTexture===null||te.isBatchedMesh&&Ue.batchingColor===!1&&te.colorTexture!==null||te.isInstancedMesh&&Ue.instancing===!1||!te.isInstancedMesh&&Ue.instancing===!0||te.isSkinnedMesh&&Ue.skinning===!1||!te.isSkinnedMesh&&Ue.skinning===!0||te.isInstancedMesh&&Ue.instancingColor===!0&&te.instanceColor===null||te.isInstancedMesh&&Ue.instancingColor===!1&&te.instanceColor!==null||te.isInstancedMesh&&Ue.instancingMorph===!0&&te.morphTexture===null||te.isInstancedMesh&&Ue.instancingMorph===!1&&te.morphTexture!==null||Ue.envMap!==Ze||le.fog===!0&&Ue.fog!==De||Ue.numClippingPlanes!==void 0&&(Ue.numClippingPlanes!==Rt.numPlanes||Ue.numIntersection!==Rt.numIntersection)||Ue.vertexAlphas!==ht||Ue.vertexTangents!==yt||Ue.morphTargets!==ft||Ue.morphNormals!==Yt||Ue.morphColors!==ln||Ue.toneMapping!==en||Ue.morphTargetsCount!==st)&&(At=!0):(At=!0,Ue.__version=le.version);let un=Ue.currentProgram;At===!0&&(un=Ra(le,q,te));let Ui=!1,Fn=!1,Yn=!1;const hn=un.getUniforms(),dr=Ue.uniforms;if(xe.useProgram(un.program)&&(Ui=!0,Fn=!0,Yn=!0),le.id!==N&&(N=le.id,Fn=!0),Ui||B!==O){hn.setValue(H,"projectionMatrix",O.projectionMatrix),hn.setValue(H,"viewMatrix",O.matrixWorldInverse);const ci=hn.map.cameraPosition;ci!==void 0&&ci.setValue(H,Be.setFromMatrixPosition(O.matrixWorld)),He.logarithmicDepthBuffer&&hn.setValue(H,"logDepthBufFC",2/(Math.log(O.far+1)/Math.LN2)),(le.isMeshPhongMaterial||le.isMeshToonMaterial||le.isMeshLambertMaterial||le.isMeshBasicMaterial||le.isMeshStandardMaterial||le.isShaderMaterial)&&hn.setValue(H,"isOrthographic",O.isOrthographicCamera===!0),B!==O&&(B=O,Fn=!0,Yn=!0)}if(te.isSkinnedMesh){hn.setOptional(H,te,"bindMatrix"),hn.setOptional(H,te,"bindMatrixInverse");const ci=te.skeleton;ci&&(ci.boneTexture===null&&ci.computeBoneTexture(),hn.setValue(H,"boneTexture",ci.boneTexture,qe))}te.isBatchedMesh&&(hn.setOptional(H,te,"batchingTexture"),hn.setValue(H,"batchingTexture",te._matricesTexture,qe),hn.setOptional(H,te,"batchingIdTexture"),hn.setValue(H,"batchingIdTexture",te._indirectTexture,qe),hn.setOptional(H,te,"batchingColorTexture"),te._colorsTexture!==null&&hn.setValue(H,"batchingColorTexture",te._colorsTexture,qe));const js=oe.morphAttributes;if((js.position!==void 0||js.normal!==void 0||js.color!==void 0)&&kt.update(te,oe,un),(Fn||Ue.receiveShadow!==te.receiveShadow)&&(Ue.receiveShadow=te.receiveShadow,hn.setValue(H,"receiveShadow",te.receiveShadow)),le.isMeshGouraudMaterial&&le.envMap!==null&&(dr.envMap.value=Ze,dr.flipEnvMap.value=Ze.isCubeTexture&&Ze.isRenderTargetTexture===!1?-1:1),le.isMeshStandardMaterial&&le.envMap===null&&q.environment!==null&&(dr.envMapIntensity.value=q.environmentIntensity),Fn&&(hn.setValue(H,"toneMappingExposure",A.toneMappingExposure),Ue.needsLights&&_h(dr,Yn),De&&le.fog===!0&&ut.refreshFogUniforms(dr,De),ut.refreshMaterialUniforms(dr,le,fe,Z,_.state.transmissionRenderTarget[O.id]),jg.upload(H,jc(Ue),dr,qe)),le.isShaderMaterial&&le.uniformsNeedUpdate===!0&&(jg.upload(H,jc(Ue),dr,qe),le.uniformsNeedUpdate=!1),le.isSpriteMaterial&&hn.setValue(H,"center",te.center),hn.setValue(H,"modelViewMatrix",te.modelViewMatrix),hn.setValue(H,"normalMatrix",te.normalMatrix),hn.setValue(H,"modelMatrix",te.matrixWorld),le.isShaderMaterial||le.isRawShaderMaterial){const ci=le.uniformsGroups;for(let Pa=0,qi=ci.length;Pa0&&qe.useMultisampledRTT(O)===!1?te=Ve.get(O).__webglMultisampledFramebuffer:Array.isArray(yt)?te=yt[oe]:te=yt,T.copy(O.viewport),F.copy(O.scissor),X=O.scissorTest}else T.copy(ne).multiplyScalar(fe).floor(),F.copy(de).multiplyScalar(fe).floor(),X=Ce;if(xe.bindFramebuffer(H.FRAMEBUFFER,te)&&le&&xe.drawBuffers(O,te),xe.viewport(T),xe.scissor(F),xe.setScissorTest(X),De){const Ze=Ve.get(O.texture);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_CUBE_MAP_POSITIVE_X+q,Ze.__webglTexture,oe)}else if(Xe){const Ze=Ve.get(O.texture),ht=q||0;H.framebufferTextureLayer(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,Ze.__webglTexture,oe||0,ht)}N=-1},this.readRenderTargetPixels=function(O,q,oe,le,te,De,Xe){if(!(O&&O.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let nt=Ve.get(O).__webglFramebuffer;if(O.isWebGLCubeRenderTarget&&Xe!==void 0&&(nt=nt[Xe]),nt){xe.bindFramebuffer(H.FRAMEBUFFER,nt);try{const Ze=O.texture,ht=Ze.format,yt=Ze.type;if(!He.textureFormatReadable(ht)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!He.textureTypeReadable(yt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}q>=0&&q<=O.width-le&&oe>=0&&oe<=O.height-te&&H.readPixels(q,oe,le,te,Tt.convert(ht),Tt.convert(yt),De)}finally{const Ze=D!==null?Ve.get(D).__webglFramebuffer:null;xe.bindFramebuffer(H.FRAMEBUFFER,Ze)}}},this.readRenderTargetPixelsAsync=function(O,q,oe,le,te,De,Xe){return du(this,null,function*(){if(!(O&&O.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let nt=Ve.get(O).__webglFramebuffer;if(O.isWebGLCubeRenderTarget&&Xe!==void 0&&(nt=nt[Xe]),nt){xe.bindFramebuffer(H.FRAMEBUFFER,nt);try{const Ze=O.texture,ht=Ze.format,yt=Ze.type;if(!He.textureFormatReadable(ht))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!He.textureTypeReadable(yt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(q>=0&&q<=O.width-le&&oe>=0&&oe<=O.height-te){const ft=H.createBuffer();H.bindBuffer(H.PIXEL_PACK_BUFFER,ft),H.bufferData(H.PIXEL_PACK_BUFFER,De.byteLength,H.STREAM_READ),H.readPixels(q,oe,le,te,Tt.convert(ht),Tt.convert(yt),0),H.flush();const Yt=H.fenceSync(H.SYNC_GPU_COMMANDS_COMPLETE,0);yield EG(H,Yt,4);try{H.bindBuffer(H.PIXEL_PACK_BUFFER,ft),H.getBufferSubData(H.PIXEL_PACK_BUFFER,0,De)}finally{H.deleteBuffer(ft),H.deleteSync(Yt)}return De}}finally{const Ze=D!==null?Ve.get(D).__webglFramebuffer:null;xe.bindFramebuffer(H.FRAMEBUFFER,Ze)}}})},this.copyFramebufferToTexture=function(O,q=null,oe=0){O.isTexture!==!0&&(sc("WebGLRenderer: copyFramebufferToTexture function signature has changed."),q=arguments[0]||null,O=arguments[1]);const le=Math.pow(2,-oe),te=Math.floor(O.image.width*le),De=Math.floor(O.image.height*le),Xe=q!==null?q.x:0,nt=q!==null?q.y:0;qe.setTexture2D(O,0),H.copyTexSubImage2D(H.TEXTURE_2D,oe,0,0,Xe,nt,te,De),xe.unbindTexture()},this.copyTextureToTexture=function(O,q,oe=null,le=null,te=0){O.isTexture!==!0&&(sc("WebGLRenderer: copyTextureToTexture function signature has changed."),le=arguments[0]||null,O=arguments[1],q=arguments[2],te=arguments[3]||0,oe=null);let De,Xe,nt,Ze,ht,yt;oe!==null?(De=oe.max.x-oe.min.x,Xe=oe.max.y-oe.min.y,nt=oe.min.x,Ze=oe.min.y):(De=O.image.width,Xe=O.image.height,nt=0,Ze=0),le!==null?(ht=le.x,yt=le.y):(ht=0,yt=0);const ft=Tt.convert(q.format),Yt=Tt.convert(q.type);qe.setTexture2D(q,0),H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,q.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,q.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,q.unpackAlignment);const ln=H.getParameter(H.UNPACK_ROW_LENGTH),en=H.getParameter(H.UNPACK_IMAGE_HEIGHT),xn=H.getParameter(H.UNPACK_SKIP_PIXELS),st=H.getParameter(H.UNPACK_SKIP_ROWS),Ue=H.getParameter(H.UNPACK_SKIP_IMAGES),fn=O.isCompressedTexture?O.mipmaps[te]:O.image;H.pixelStorei(H.UNPACK_ROW_LENGTH,fn.width),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,fn.height),H.pixelStorei(H.UNPACK_SKIP_PIXELS,nt),H.pixelStorei(H.UNPACK_SKIP_ROWS,Ze),O.isDataTexture?H.texSubImage2D(H.TEXTURE_2D,te,ht,yt,De,Xe,ft,Yt,fn.data):O.isCompressedTexture?H.compressedTexSubImage2D(H.TEXTURE_2D,te,ht,yt,fn.width,fn.height,ft,fn.data):H.texSubImage2D(H.TEXTURE_2D,te,ht,yt,De,Xe,ft,Yt,fn),H.pixelStorei(H.UNPACK_ROW_LENGTH,ln),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,en),H.pixelStorei(H.UNPACK_SKIP_PIXELS,xn),H.pixelStorei(H.UNPACK_SKIP_ROWS,st),H.pixelStorei(H.UNPACK_SKIP_IMAGES,Ue),te===0&&q.generateMipmaps&&H.generateMipmap(H.TEXTURE_2D),xe.unbindTexture()},this.copyTextureToTexture3D=function(O,q,oe=null,le=null,te=0){O.isTexture!==!0&&(sc("WebGLRenderer: copyTextureToTexture3D function signature has changed."),oe=arguments[0]||null,le=arguments[1]||null,O=arguments[2],q=arguments[3],te=arguments[4]||0);let De,Xe,nt,Ze,ht,yt,ft,Yt,ln;const en=O.isCompressedTexture?O.mipmaps[te]:O.image;oe!==null?(De=oe.max.x-oe.min.x,Xe=oe.max.y-oe.min.y,nt=oe.max.z-oe.min.z,Ze=oe.min.x,ht=oe.min.y,yt=oe.min.z):(De=en.width,Xe=en.height,nt=en.depth,Ze=0,ht=0,yt=0),le!==null?(ft=le.x,Yt=le.y,ln=le.z):(ft=0,Yt=0,ln=0);const xn=Tt.convert(q.format),st=Tt.convert(q.type);let Ue;if(q.isData3DTexture)qe.setTexture3D(q,0),Ue=H.TEXTURE_3D;else if(q.isDataArrayTexture||q.isCompressedArrayTexture)qe.setTexture2DArray(q,0),Ue=H.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,q.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,q.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,q.unpackAlignment);const fn=H.getParameter(H.UNPACK_ROW_LENGTH),At=H.getParameter(H.UNPACK_IMAGE_HEIGHT),un=H.getParameter(H.UNPACK_SKIP_PIXELS),Ui=H.getParameter(H.UNPACK_SKIP_ROWS),Fn=H.getParameter(H.UNPACK_SKIP_IMAGES);H.pixelStorei(H.UNPACK_ROW_LENGTH,en.width),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,en.height),H.pixelStorei(H.UNPACK_SKIP_PIXELS,Ze),H.pixelStorei(H.UNPACK_SKIP_ROWS,ht),H.pixelStorei(H.UNPACK_SKIP_IMAGES,yt),O.isDataTexture||O.isData3DTexture?H.texSubImage3D(Ue,te,ft,Yt,ln,De,Xe,nt,xn,st,en.data):q.isCompressedArrayTexture?H.compressedTexSubImage3D(Ue,te,ft,Yt,ln,De,Xe,nt,xn,en.data):H.texSubImage3D(Ue,te,ft,Yt,ln,De,Xe,nt,xn,st,en),H.pixelStorei(H.UNPACK_ROW_LENGTH,fn),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,At),H.pixelStorei(H.UNPACK_SKIP_PIXELS,un),H.pixelStorei(H.UNPACK_SKIP_ROWS,Ui),H.pixelStorei(H.UNPACK_SKIP_IMAGES,Fn),te===0&&q.generateMipmaps&&H.generateMipmap(Ue),xe.unbindTexture()},this.initRenderTarget=function(O){Ve.get(O).__webglFramebuffer===void 0&&qe.setupRenderTarget(O)},this.initTexture=function(O){O.isCubeTexture?qe.setTextureCube(O,0):O.isData3DTexture?qe.setTexture3D(O,0):O.isDataArrayTexture||O.isCompressedArrayTexture?qe.setTexture2DArray(O,0):qe.setTexture2D(O,0),xe.unbindTexture()},this.resetState=function(){I=0,P=0,D=null,xe.reset(),Ft.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Gs}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Mg?"display-p3":"srgb",t.unpackColorSpace=tn.workingColorSpace===Pd?"display-p3":"srgb"}}class Kg{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new ke(e),this.density=t}clone(){return new Kg(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Yg{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new ke(e),this.near=t,this.far=i}clone(){return new Yg(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Qg extends jt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new cr,this.environmentIntensity=1,this.environmentRotation=new cr,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class Kd{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Dd,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=br()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return sc("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;re.far||t.push({distance:l,point:Yd.clone(),uv:Pr.getInterpolation(Yd,qg,qd,Zg,lB,SS,uB,new Ae),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function $g(n,e,t,i,r,s){Bc.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(Qd.x=s*Bc.x-r*Bc.y,Qd.y=r*Bc.x+s*Bc.y):Qd.copy(Bc),n.copy(e),n.x+=Qd.x,n.y+=Qd.y,n.applyMatrix4(aB)}const ev=new G,fB=new G;class dB extends jt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,r=t.length;i0){let i,r;for(i=1,r=t.length;i0){ev.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(ev);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){ev.setFromMatrixPosition(e.matrixWorld),fB.setFromMatrixPosition(this.matrixWorld);const i=ev.distanceTo(fB)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r=o)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const o=r[this.index];s.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=t,o.index=i}reset(){this.list.length=0,this.index=0}}const _a=new mt,TS=new mt,c8=new mt,f8=new ke(1,1,1),AB=new mt,bS=new jd,rv=new Bi,Fl=new _i,th=new G,SB=new G,d8=new G,RS=new u8,Di=new jn,sv=[];function h8(n,e,t=0){const i=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const r=n.count;for(let s=0;s65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new $t(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const i in t.attributes){if(!e.hasAttribute(i))throw new Error(`BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const r=e.getAttribute(i),s=t.getAttribute(i);if(r.itemSize!==s.itemSize||r.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Bi);const e=this._geometryCount,t=this.boundingBox,i=this._drawInfo;t.makeEmpty();for(let r=0;r=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");this._drawInfo.push({visible:!0,active:!0,geometryIndex:e});const t=this._drawInfo.length-1,i=this._matricesTexture,r=i.image.data;c8.toArray(r,t*16),i.needsUpdate=!0;const s=this._colorsTexture;return s&&(f8.toArray(s.image.data,t*4),s.needsUpdate=!0),t}addGeometry(e,t=-1,i=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const r={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const o=this._reservedRanges,a=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=o[o.length-1]),t===-1?r.vertexCount=e.getAttribute("position").count:r.vertexCount=t,s===null?r.vertexStart=0:r.vertexStart=s.vertexStart+s.vertexCount;const u=e.getIndex(),d=u!==null;if(d&&(i===-1?r.indexCount=u.count:r.indexCount=i,s===null?r.indexStart=0:r.indexStart=s.indexStart+s.indexCount),r.indexStart!==-1&&r.indexStart+r.indexCount>this._maxIndexCount||r.vertexStart+r.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const h=this._geometryCount;return this._geometryCount++,o.push(r),a.push({start:d?r.indexStart:r.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new Bi,sphereInitialized:!1,sphere:new _i}),this.setGeometryAt(h,e),h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const i=this.geometry,r=i.getIndex()!==null,s=i.getIndex(),o=t.getIndex(),a=this._reservedRanges[e];if(r&&o.count>a.indexCount||t.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,u=a.vertexCount;for(const g in i.attributes){const v=t.getAttribute(g),S=i.getAttribute(g);h8(v,S,l);const _=v.itemSize;for(let m=v.count,x=u;m=this._geometryCount)return null;const i=this._bounds[e],r=i.box,s=this.geometry;if(i.boxInitialized===!1){r.makeEmpty();const o=s.index,a=s.attributes.position,l=this._drawRanges[e];for(let u=l.start,d=l.start+l.count;u=this._geometryCount)return null;const i=this._bounds[e],r=i.sphere,s=this.geometry;if(i.sphereInitialized===!1){r.makeEmpty(),this.getBoundingBoxAt(e,rv),rv.getCenter(r.center);const o=s.index,a=s.attributes.position,l=this._drawRanges[e];let u=0;for(let d=l.start,h=l.start+l.count;d=i.length||i[e].active===!1?this:(t.toArray(s,e*16),r.needsUpdate=!0,this)}getMatrixAt(e,t){const i=this._drawInfo,r=this._matricesTexture.image.data;return e>=i.length||i[e].active===!1?null:t.fromArray(r,e*16)}setColorAt(e,t){this._colorsTexture===null&&this._initColorsTexture();const i=this._colorsTexture,r=this._colorsTexture.image.data,s=this._drawInfo;return e>=s.length||s[e].active===!1?this:(t.toArray(r,e*4),i.needsUpdate=!0,this)}getColorAt(e,t){const i=this._colorsTexture.image.data,r=this._drawInfo;return e>=r.length||r[e].active===!1?null:t.fromArray(i,e*4)}setVisibleAt(e,t){const i=this._drawInfo;return e>=i.length||i[e].active===!1||i[e].visible===t?this:(i[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?!1:t[e].visible}raycast(e,t){const i=this._drawInfo,r=this._drawRanges,s=this.matrixWorld,o=this.geometry;Di.material=this.material,Di.geometry.index=o.index,Di.geometry.attributes=o.attributes,Di.geometry.boundingBox===null&&(Di.geometry.boundingBox=new Bi),Di.geometry.boundingSphere===null&&(Di.geometry.boundingSphere=new _i);for(let a=0,l=i.length;aye({},t)),this._reservedRanges=e._reservedRanges.map(t=>ye({},t)),this._drawInfo=e._drawInfo.map(t=>ye({},t)),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._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(e,t,i,r,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=r.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._drawInfo,u=this._multiDrawStarts,d=this._multiDrawCounts,h=this._drawRanges,p=this.perObjectFrustumCulled,g=this._indirectTexture,v=g.image.data;p&&(AB.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),bS.setFromProjectionMatrix(AB,e.coordinateSystem));let S=0;if(this.sortObjects){TS.copy(this.matrixWorld).invert(),th.setFromMatrixPosition(i.matrixWorld).applyMatrix4(TS),SB.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(TS);for(let x=0,A=l.length;x0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;si)return;PS.applyMatrix4(n.matrixWorld);const l=e.ray.origin.distanceTo(PS);if(!(le.far))return{distance:l,point:EB.clone().applyMatrix4(n.matrixWorld),index:r,face:null,faceIndex:null,object:n}}const CB=new G,TB=new G;class ws extends To{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let r=0,s=t.count;r0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;sr.far)return;s.push({distance:u,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class p8 extends Mn{constructor(e,t,i,r,s,o,a,l,u){super(e,t,i,r,s,o,a,l,u),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:zn,this.magFilter=s!==void 0?s:zn,this.generateMipmaps=!1;const d=this;function h(){d.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class m8 extends Mn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=oi,this.minFilter=oi,this.generateMipmaps=!1,this.needsUpdate=!0}}class hv extends Mn{constructor(e,t,i,r,s,o,a,l,u,d,h,p){super(null,o,a,l,u,d,r,s,h,p),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class g8 extends hv{constructor(e,t,i,r,s,o){super(e,t,i,s,o),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=Tr,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class v8 extends hv{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,mo),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class y8 extends Mn{constructor(e,t,i,r,s,o,a,l,u){super(e,t,i,r,s,o,a,l,u),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Es{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let o;t?o=t:o=e*i[s-1];let a=0,l=s-1,u;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),u=i[r]-o,u<0)a=r+1;else if(u>0)l=r-1;else{l=r;break}if(r=l,i[r]===o)return r/(s-1);const d=i[r],p=i[r+1]-d,g=(o-d)/p;return(r+g)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new Ae:new G);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new G,r=[],s=[],o=[],a=new G,l=new mt;for(let g=0;g<=e;g++){const v=g/e;r[g]=this.getTangentAt(v,new G)}s[0]=new G,o[0]=new G;let u=Number.MAX_VALUE;const d=Math.abs(r[0].x),h=Math.abs(r[0].y),p=Math.abs(r[0].z);d<=u&&(u=d,i.set(1,0,0)),h<=u&&(u=h,i.set(0,1,0)),p<=u&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let g=1;g<=e;g++){if(s[g]=s[g-1].clone(),o[g]=o[g-1].clone(),a.crossVectors(r[g-1],r[g]),a.length()>Number.EPSILON){a.normalize();const v=Math.acos(Hn(r[g-1].dot(r[g]),-1,1));s[g].applyMatrix4(l.makeRotationAxis(a,v))}o[g].crossVectors(r[g],s[g])}if(t===!0){let g=Math.acos(Hn(s[0].dot(s[e]),-1,1));g/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(g=-g);for(let v=1;v<=e;v++)s[v].applyMatrix4(l.makeRotationAxis(r[v],g*v)),o[v].crossVectors(r[v],s[v])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class pv extends Es{constructor(e=0,t=0,i=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Ae){const i=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)r;)s-=r;s0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let u,d;this.closed||a>0?u=r[(a-1)%s]:(mv.subVectors(r[0],r[1]).add(r[0]),u=mv);const h=r[a%s],p=r[(a+1)%s];if(this.closed||a+2r.length-2?r.length-1:o+1],h=r[o>r.length-3?r.length-1:o+2];return i.set(BB(a,l.x,u.x,d.x,h.x),BB(a,l.y,u.y,d.y,h.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t=i){const o=r[s]-i,a=this.curves[s],l=a.getLength(),u=l===0?0:1-o/l;return a.getPointAt(u,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,r=this.curves.length;i1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t0){const h=u.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(u);const d=u.getPoint(1);return this.currentPoint.copy(d),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class oh extends Pt{constructor(e=[new Ae(0,-.5),new Ae(.5,0),new Ae(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=Hn(r,0,Math.PI*2);const s=[],o=[],a=[],l=[],u=[],d=1/t,h=new G,p=new Ae,g=new G,v=new G,S=new G;let _=0,m=0;for(let x=0;x<=e.length-1;x++)switch(x){case 0:_=e[x+1].x-e[x].x,m=e[x+1].y-e[x].y,g.x=m*1,g.y=-_,g.z=m*0,S.copy(g),g.normalize(),l.push(g.x,g.y,g.z);break;case e.length-1:l.push(S.x,S.y,S.z);break;default:_=e[x+1].x-e[x].x,m=e[x+1].y-e[x].y,g.x=m*1,g.y=-_,g.z=m*0,v.copy(g),g.x+=S.x,g.y+=S.y,g.z+=S.z,g.normalize(),l.push(g.x,g.y,g.z),S.copy(v)}for(let x=0;x<=t;x++){const A=i+x*d*r,w=Math.sin(A),I=Math.cos(A);for(let P=0;P<=e.length-1;P++){h.x=e[P].x*w,h.y=e[P].y,h.z=e[P].x*I,o.push(h.x,h.y,h.z),p.x=x/t,p.y=P/(e.length-1),a.push(p.x,p.y);const D=l[3*P+0]*w,N=l[3*P+1],B=l[3*P+0]*I;u.push(D,N,B)}}for(let x=0;x0&&A(!0),t>0&&A(!1)),this.setIndex(d),this.setAttribute("position",new rt(h,3)),this.setAttribute("normal",new rt(p,3)),this.setAttribute("uv",new rt(g,2));function x(){const w=new G,I=new G;let P=0;const D=(t-e)/i;for(let N=0;N<=s;N++){const B=[],T=N/s,F=T*(t-e)+e;for(let X=0;X<=r;X++){const J=X/r,Q=J*l+a,ie=Math.sin(Q),Z=Math.cos(Q);I.x=F*ie,I.y=-T*i+_,I.z=F*Z,h.push(I.x,I.y,I.z),w.set(ie,D,Z).normalize(),p.push(w.x,w.y,w.z),g.push(J,1-T),B.push(v++)}S.push(B)}for(let N=0;N.9&&D<.1&&(A<.2&&(o[x+0]+=1),w<.2&&(o[x+2]+=1),I<.2&&(o[x+4]+=1))}}function p(x){s.push(x.x,x.y,x.z)}function g(x,A){const w=x*3;A.x=e[w+0],A.y=e[w+1],A.z=e[w+2]}function v(){const x=new G,A=new G,w=new G,I=new G,P=new Ae,D=new Ae,N=new Ae;for(let B=0,T=0;B80*t){a=u=n[0],l=d=n[1];for(let v=t;vu&&(u=h),p>d&&(d=p);g=Math.max(u-a,d-l),g=g!==0?32767/g:0}return ah(s,o,t,a,l,g,0),o}};function UB(n,e,t,i,r){let s,o;if(r===G8(n,e,t,i)>0)for(s=e;s=e;s-=i)o=zB(s,n[s],n[s+1],o);return o&&wv(o,o.next)&&(uh(o),o=o.next),o}function Ul(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(wv(t,t.next)||Dn(t.prev,t,t.next)===0)){if(uh(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function ah(n,e,t,i,r,s,o){if(!n)return;!o&&s&&N8(n,i,r,s);let a=n,l,u;for(;n.prev!==n.next;){if(l=n.prev,u=n.next,s?b8(n,i,r,s):T8(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(u.i/t|0),uh(n),n=u.next,a=u.next;continue}if(n=u,n===a){o?o===1?(n=R8(Ul(n),e,t),ah(n,e,t,i,r,s,2)):o===2&&P8(n,e,t,i,r,s):ah(Ul(n),e,t,i,r,s,1);break}}}function T8(n){const e=n.prev,t=n,i=n.next;if(Dn(e,t,i)>=0)return!1;const r=e.x,s=t.x,o=i.x,a=e.y,l=t.y,u=i.y,d=rs?r>o?r:o:s>o?s:o,g=a>l?a>u?a:u:l>u?l:u;let v=i.next;for(;v!==e;){if(v.x>=d&&v.x<=p&&v.y>=h&&v.y<=g&&Fc(r,a,s,l,o,u,v.x,v.y)&&Dn(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function b8(n,e,t,i){const r=n.prev,s=n,o=n.next;if(Dn(r,s,o)>=0)return!1;const a=r.x,l=s.x,u=o.x,d=r.y,h=s.y,p=o.y,g=al?a>u?a:u:l>u?l:u,_=d>h?d>p?d:p:h>p?h:p,m=WS(g,v,e,t,i),x=WS(S,_,e,t,i);let A=n.prevZ,w=n.nextZ;for(;A&&A.z>=m&&w&&w.z<=x;){if(A.x>=g&&A.x<=S&&A.y>=v&&A.y<=_&&A!==r&&A!==o&&Fc(a,d,l,h,u,p,A.x,A.y)&&Dn(A.prev,A,A.next)>=0||(A=A.prevZ,w.x>=g&&w.x<=S&&w.y>=v&&w.y<=_&&w!==r&&w!==o&&Fc(a,d,l,h,u,p,w.x,w.y)&&Dn(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;A&&A.z>=m;){if(A.x>=g&&A.x<=S&&A.y>=v&&A.y<=_&&A!==r&&A!==o&&Fc(a,d,l,h,u,p,A.x,A.y)&&Dn(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;w&&w.z<=x;){if(w.x>=g&&w.x<=S&&w.y>=v&&w.y<=_&&w!==r&&w!==o&&Fc(a,d,l,h,u,p,w.x,w.y)&&Dn(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function R8(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!wv(r,s)&&OB(r,i,i.next,s)&&lh(r,s)&&lh(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),uh(i),uh(i.next),i=n=s),i=i.next}while(i!==n);return Ul(i)}function P8(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&k8(o,a)){let l=kB(o,a);o=Ul(o,o.next),l=Ul(l,l.next),ah(o,e,t,i,r,s,0),ah(l,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function I8(n,e,t,i){const r=[];let s,o,a,l,u;for(s=0,o=e.length;s=t.next.y&&t.next.y!==t.y){const p=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(p<=s&&p>i&&(i=p,r=t.x=t.x&&t.x>=l&&s!==t.x&&Fc(or.x||t.x===r.x&&F8(r,t)))&&(r=t,d=h)),t=t.next;while(t!==a);return r}function F8(n,e){return Dn(n.prev,n,e.prev)<0&&Dn(e.next,n,n.next)<0}function N8(n,e,t,i){let r=n;do r.z===0&&(r.z=WS(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,U8(r)}function U8(n){let e,t,i,r,s,o,a,l,u=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,u*=2}while(o>1);return n}function WS(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function O8(n){let e=n,t=n;do(e.x=(n-o)*(s-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(i-a)}function k8(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!z8(n,e)&&(lh(n,e)&&lh(e,n)&&H8(n,e)&&(Dn(n.prev,n,e.prev)||Dn(n,e.prev,e))||wv(n,e)&&Dn(n.prev,n,n.next)>0&&Dn(e.prev,e,e.next)>0)}function Dn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function wv(n,e){return n.x===e.x&&n.y===e.y}function OB(n,e,t,i){const r=Cv(Dn(n,e,t)),s=Cv(Dn(n,e,i)),o=Cv(Dn(t,i,n)),a=Cv(Dn(t,i,e));return!!(r!==s&&o!==a||r===0&&Ev(n,t,e)||s===0&&Ev(n,i,e)||o===0&&Ev(t,n,i)||a===0&&Ev(t,e,i))}function Ev(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Cv(n){return n>0?1:n<0?-1:0}function z8(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&OB(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function lh(n,e){return Dn(n.prev,n,n.next)<0?Dn(n,e,n.next)>=0&&Dn(n,n.prev,e)>=0:Dn(n,e,n.prev)<0||Dn(n,n.next,e)<0}function H8(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function kB(n,e){const t=new XS(n.i,n.x,n.y),i=new XS(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function zB(n,e,t,i){const r=new XS(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function uh(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function XS(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function G8(n,e,t,i){let r=0;for(let s=e,o=t-i;s2&&n[e-1].equals(n[0])&&n.pop()}function GB(n,e){for(let t=0;tNumber.EPSILON){const we=Math.sqrt(ae),Ee=Math.sqrt(W*W+U*U),ut=Te.x-qe/we,ze=Te.y+Ve/we,Qe=be.x-U/Ee,Rt=be.y+W/Ee,Pe=((Qe-ut)*U-(Rt-ze)*W)/(Ve*U-qe*W);He=ut+Ve*Pe-H.x,xe=ze+qe*Pe-H.y;const Ke=He*He+xe*xe;if(Ke<=2)return new Ae(He,xe);dt=Math.sqrt(Ke/2)}else{let we=!1;Ve>Number.EPSILON?W>Number.EPSILON&&(we=!0):Ve<-Number.EPSILON?W<-Number.EPSILON&&(we=!0):Math.sign(qe)===Math.sign(U)&&(we=!0),we?(He=-qe,xe=Ve,dt=Math.sqrt(ae)):(He=Ve,xe=qe,dt=Math.sqrt(ae/2))}return new Ae(He/dt,xe/dt)}const $=[];for(let H=0,Te=Q.length,be=Te-1,He=H+1;H=0;H--){const Te=H/_,be=g*Math.cos(Te*Math.PI/2),He=v*Math.sin(Te*Math.PI/2)+S;for(let xe=0,dt=Q.length;xe=0;){const He=be;let xe=be-1;xe<0&&(xe=H.length-1);for(let dt=0,Ve=d+_*2;dt0)&&g.push(A,w,P),(m!==i-1||l0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class KB extends $n{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ke(16777215),this.specular=new ke(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fa,this.normalScale=new Ae(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new cr,this.combine=_d,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(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class YB extends $n{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ke(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fa,this.normalScale=new Ae(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(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class QB extends $n{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fa,this.normalScale=new Ae(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class qB extends $n{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ke(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fa,this.normalScale=new Ae(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new cr,this.combine=_d,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(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class ZB extends $n{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ke(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fa,this.normalScale=new Ae(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class $B extends Fi{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Ol(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function eL(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function tL(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function jS(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,o=0;o!==i;++s){const a=t[s]*e;for(let l=0;l!==e;++l)r[o++]=n[a+l]}return r}function JS(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),t.push(o)),s=n[r++];while(s!==void 0)}function j8(n,e,t,i,r=30){const s=n.clone();s.name=e;const o=[];for(let l=0;l=i)){h.push(u.times[g]);for(let S=0;Ss.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=a.times[v]){const m=v*h+d,x=m+h-d;S=a.values.slice(m,x)}else{const m=a.createInterpolant(),x=d,A=h-d;m.evaluate(s),S=m.resultBuffer.slice(x,A)}l==="quaternion"&&new Ii().fromArray(S).normalize().conjugate().toArray(S);const _=u.times.length;for(let m=0;m<_;++m){const x=m*g+p;if(l==="quaternion")Ii.multiplyQuaternionsFlat(u.values,x,S,0,u.values,x);else{const A=g-p*2;for(let w=0;w=s)){const a=t[1];e=s)break t}o=i,i=0;break n}break e}for(;i>>1;et;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=i.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&eL(r))for(let a=0,l=r.length;a!==l;++a){const u=r[a];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,u),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===_g,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*i,l=o*i,u=0;u!==i;++u)t[l+u]=t[a+u];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}Cs.prototype.TimeBufferType=Float32Array,Cs.prototype.ValueBufferType=Float32Array,Cs.prototype.DefaultInterpolation=nc;class kl extends Cs{constructor(e,t,i){super(e,t,i)}}kl.prototype.ValueTypeName="bool",kl.prototype.ValueBufferType=Array,kl.prototype.DefaultInterpolation=tc,kl.prototype.InterpolantFactoryMethodLinear=void 0,kl.prototype.InterpolantFactoryMethodSmooth=void 0;class YS extends Cs{}YS.prototype.ValueTypeName="color";class zl extends Cs{}zl.prototype.ValueTypeName="number";class rL extends Nc{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(r-t);let u=e*a;for(let d=u+a;u!==d;u+=4)Ii.slerpFlat(s,0,o,u-a,o,u,l);return s}}class Hl extends Cs{InterpolantFactoryMethodLinear(e){return new rL(this.times,this.values,this.getValueSize(),e)}}Hl.prototype.ValueTypeName="quaternion",Hl.prototype.InterpolantFactoryMethodSmooth=void 0;class Gl extends Cs{constructor(e,t,i){super(e,t,i)}}Gl.prototype.ValueTypeName="string",Gl.prototype.ValueBufferType=Array,Gl.prototype.DefaultInterpolation=tc,Gl.prototype.InterpolantFactoryMethodLinear=void 0,Gl.prototype.InterpolantFactoryMethodSmooth=void 0;class Vl extends Cs{}Vl.prototype.ValueTypeName="vector";class Uc{constructor(e="",t=-1,i=[],r=Ag){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=br(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(Q8(i[o]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=i.length;s!==o;++s)t.push(Cs.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,o=[];for(let a=0;a1){const h=d[1];let p=r[h];p||(r[h]=p=[]),p.push(u)}}const o=[];for(const a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(h,p,g,v,S){if(g.length!==0){const _=[],m=[];JS(g,_,m,v),_.length!==0&&S.push(new h(p,_,m))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const u=e.hierarchy||[];for(let h=0;h{t&&t(s),this.manager.itemEnd(e)},0),s;if(Ro[e]!==void 0){Ro[e].push({onLoad:t,onProgress:i,onError:r});return}Ro[e]=[],Ro[e].push({onLoad:t,onProgress:i,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(u=>{if(u.status===200||u.status===0){if(u.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream=="undefined"||u.body===void 0||u.body.getReader===void 0)return u;const d=Ro[e],h=u.body.getReader(),p=u.headers.get("X-File-Size")||u.headers.get("Content-Length"),g=p?parseInt(p):0,v=g!==0;let S=0;const _=new ReadableStream({start(m){x();function x(){h.read().then(({done:A,value:w})=>{if(A)m.close();else{S+=w.byteLength;const I=new ProgressEvent("progress",{lengthComputable:v,loaded:S,total:g});for(let P=0,D=d.length;P{m.error(A)})}}});return new Response(_)}else throw new q8(`fetch for "${u.url}" responded with ${u.status}: ${u.statusText}`,u)}).then(u=>{switch(l){case"arraybuffer":return u.arrayBuffer();case"blob":return u.blob();case"document":return u.text().then(d=>new DOMParser().parseFromString(d,a));case"json":return u.json();default:if(a===void 0)return u.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),p=h&&h[1]?h[1].toLowerCase():void 0,g=new TextDecoder(p);return u.arrayBuffer().then(v=>g.decode(v))}}}).then(u=>{bo.add(e,u);const d=Ro[e];delete Ro[e];for(let h=0,p=d.length;h{const d=Ro[e];if(d===void 0)throw this.manager.itemError(e),u;delete Ro[e];for(let h=0,p=d.length;h{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Z8 extends Ni{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Lr(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=[];for(let i=0;i0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(r.uniforms[s]={},o.type){case"t":r.uniforms[s].value=i(o.value);break;case"c":r.uniforms[s].value=new ke().setHex(o.value);break;case"v2":r.uniforms[s].value=new Ae().fromArray(o.value);break;case"v3":r.uniforms[s].value=new G().fromArray(o.value);break;case"v4":r.uniforms[s].value=new on().fromArray(o.value);break;case"m3":r.uniforms[s].value=new Dt().fromArray(o.value);break;case"m4":r.uniforms[s].value=new mt().fromArray(o.value);break;default:r.uniforms[s].value=o.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=i(e.map)),e.matcap!==void 0&&(r.matcap=i(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new Ae().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=i(e.envMap)),e.envMapRotation!==void 0&&r.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new Ae().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:jB,SpriteMaterial:AS,RawShaderMaterial:JB,ShaderMaterial:Ss,PointsMaterial:cv,MeshPhysicalMaterial:qr,MeshStandardMaterial:dh,MeshPhongMaterial:KB,MeshToonMaterial:YB,MeshNormalMaterial:QB,MeshLambertMaterial:qB,MeshDepthMaterial:vS,MeshDistanceMaterial:yS,MeshBasicMaterial:Ir,MeshMatcapMaterial:ZB,LineDashedMaterial:$B,LineBasicMaterial:Fi,Material:$n};return new t[e]}}class Ma{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder!="undefined")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i0){const l=new QS(t);s=new hh(l),s.setCrossOrigin(this.crossOrigin);for(let u=0,d=e.length;u0){r=new hh(this.manager),r.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o{const _=new Bi;_.min.fromArray(S.boxMin),_.max.fromArray(S.boxMax);const m=new _i;return m.radius=S.sphereRadius,m.center.fromArray(S.sphereCenter),{boxInitialized:S.boxInitialized,box:_,sphereInitialized:S.sphereInitialized,sphere:m}}),o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=u(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=u(e.colorsTexture.uuid));break;case"LOD":o=new dB;break;case"Line":o=new To(a(e.geometry),l(e.material));break;case"LineLoop":o=new IS(a(e.geometry),l(e.material));break;case"LineSegments":o=new ws(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new LS(a(e.geometry),l(e.material));break;case"Sprite":o=new cB(l(e.material));break;case"Group":o=new Co;break;case"Bone":o=new nv;break;default:o=new jt}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const p=e.children;for(let g=0;g{t&&t(u),s.manager.itemEnd(e)}).catch(u=>{r&&r(u)});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(u){return u.blob()}).then(function(u){return createImageBitmap(u,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(u){return bo.add(e,u),t&&t(u),s.manager.itemEnd(e),u}).catch(function(u){r&&r(u),bo.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});bo.add(e,l),s.manager.itemStart(e)}}let Nv;class iM{static getContext(){return Nv===void 0&&(Nv=new(window.AudioContext||window.webkitAudioContext)),Nv}static setContext(e){Nv=e}}class aW extends Ni{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Lr(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const u=l.slice(0);iM.getContext().decodeAudioData(u,function(h){t(h)}).catch(a)}catch(u){a(u)}},i,r);function a(l){r?r(l):console.error(l),s.manager.itemError(e)}}}const _L=new mt,AL=new mt,Wl=new mt;class lW{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ai,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ai,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(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Wl.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,o=t.near*Math.tan(Sl*t.fov*.5)/t.zoom;let a,l;AL.elements[12]=-r,_L.elements[12]=r,a=-o*t.aspect+s,l=o*t.aspect+s,Wl.elements[0]=2*t.near/(l-a),Wl.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Wl),a=-o*t.aspect-s,l=o*t.aspect-s,Wl.elements[0]=2*t.near/(l-a),Wl.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Wl)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(AL),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(_L)}}class rM{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=SL(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=SL();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function SL(){return(typeof performance=="undefined"?Date:performance).now()}const Xl=new G,ML=new Ii,uW=new G,jl=new G;class cW extends jt{constructor(){super(),this.type="AudioListener",this.context=iM.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new rM}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(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Xl,ML,uW),jl.set(0,0,-1).applyQuaternion(ML),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Xl.x,r),t.positionY.linearRampToValueAtTime(Xl.y,r),t.positionZ.linearRampToValueAtTime(Xl.z,r),t.forwardX.linearRampToValueAtTime(jl.x,r),t.forwardY.linearRampToValueAtTime(jl.y,r),t.forwardZ.linearRampToValueAtTime(jl.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(Xl.x,Xl.y,Xl.z),t.setOrientation(jl.x,jl.y,jl.z,i.x,i.y,i.z)}}class wL extends jt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.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(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=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+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,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(){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.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let l=t,u=t+t;l!==u;++l)if(i[l]!==i[l+t]){a.setValue(i,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let s=i,o=r;s!==o;++s)t[s]=t[r+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i=.5)for(let o=0;o!==s;++o)e[t+o]=e[i+o]}_slerp(e,t,i,r){Ii.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const o=this._workIndex*s;Ii.multiplyQuaternionsFlat(e,o,e,t,e,i),Ii.slerpFlat(e,t,e,t,e,o,r)}_lerp(e,t,i,r,s){const o=1-r;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[i+a]*r}}_lerpAdditive(e,t,i,r,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[i+o]*r}}}const sM="\\[\\]\\.:\\/",pW=new RegExp("["+sM+"]","g"),oM="[^"+sM+"]",mW="[^"+sM.replace("\\.","")+"]",gW=/((?:WC+[\/:])*)/.source.replace("WC",oM),vW=/(WCOD+)?/.source.replace("WCOD",mW),yW=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",oM),xW=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",oM),_W=new RegExp("^"+gW+vW+yW+xW+"$"),AW=["material","materials","bones","map"];class SW{constructor(e,t,i){const r=i||Kt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class Kt{constructor(e,t,i){this.path=t,this.parsedPath=i||Kt.parseTrackName(t),this.node=Kt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new Kt.Composite(e,t,i):new Kt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(pW,"")}static parseTrackName(e){const t=_W.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);AW.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let o=0;o=s){const h=s++,p=e[h];t[p.uuid]=d,e[d]=p,t[u]=h,e[h]=l;for(let g=0,v=r;g!==v;++g){const S=i[g],_=S[h],m=S[d];S[d]=_,S[h]=m}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const u=arguments[a],d=u.uuid,h=t[d];if(h!==void 0)if(delete t[d],h0&&(t[g.uuid]=h),e[h]=g,e.pop();for(let v=0,S=r;v!==S;++v){const _=i[v];_[h]=_[p],_.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let r=i[e];const s=this._bindings;if(r!==void 0)return s[r];const o=this._paths,a=this._parsedPaths,l=this._objects,u=l.length,d=this.nCachedObjects_,h=new Array(u);r=s.length,i[e]=r,o.push(e),a.push(t),s.push(h);for(let p=d,g=l.length;p!==g;++p){const v=l[p];h[p]=new Kt(v,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const r=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],u=e[a];t[u]=i,o[i]=l,o.pop(),s[i]=s[a],s.pop(),r[i]=r[a],r.pop()}}}class TL{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:xl,endingEnd:xl};for(let u=0;u!==o;++u){const d=s[u].createInterpolant(null);a[u]=d,d.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=GP,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(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){const r=this._clip.duration,s=e._clip.duration,o=s/r,a=r/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){const r=this._mixer,s=r.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,u=a.sampleValues;return l[0]=s,l[1]=s+i,u[0]=e/o,u[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,u=this._propertyBindings;switch(this.blendMode){case DA:for(let d=0,h=l.length;d!==h;++d)l[d].evaluate(o),u[d].accumulateAdditive(a);break;case Ag:default:for(let d=0,h=l.length;d!==h;++d)l[d].evaluate(o),u[d].accumulate(r,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const o=i===VP;if(e===0)return s===-1?r:o&&(s&1)===1?t-r:r;if(i===HP){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),r>=t||r<0){const a=Math.floor(r/t);r-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const u=e<0;this._setEndings(u,!u,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=r;if(o&&(s&1)===1)return t-r}return r}_setEndings(e,t,i){const r=this._interpolantSettings;i?(r.endingStart=_l,r.endingEnd=_l):(e?r.endingStart=this.zeroSlopeAtStart?_l:xl:r.endingStart=Rd,t?r.endingEnd=this.zeroSlopeAtEnd?_l:xl:r.endingEnd=Rd)}_scheduleFading(e,t,i){const r=this._mixer,s=r.time;let o=this._weightInterpolant;o===null&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=i,this}}const wW=new Float32Array(1);class EW extends xo{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,o=e._propertyBindings,a=e._interpolants,l=i.uuid,u=this._bindingsByRootAndName;let d=u[l];d===void 0&&(d={},u[l]=d);for(let h=0;h!==s;++h){const p=r[h],g=p.name;let v=d[g];if(v!==void 0)++v.referenceCount,o[h]=v;else{if(v=o[h],v!==void 0){v._cacheIndex===null&&(++v.referenceCount,this._addInactiveBinding(v,l,g));continue}const S=t&&t._propertyBindings[h].binding.parsedPath;v=new CL(Kt.create(i,g,S),p.ValueTypeName,p.getValueSize()),++v.referenceCount,this._addInactiveBinding(v,l,g),o[h]=v}a[h].resultBuffer=v.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let u=0;u!==i;++u)t[u]._update(r,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let u=0;u!==l;++u)a[u].apply(o);return this}setTime(e){this.time=0;for(let t=0;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,IL).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const BL=new G,Uv=new G;class LW{constructor(e=new G,t=new G){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){BL.subVectors(e,this.start),Uv.subVectors(this.end,this.start);const i=Uv.dot(Uv);let s=Uv.dot(BL)/i;return t&&(s=Hn(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const LL=new G;class DW extends jt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new Pt,r=[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 o=0,a=1,l=32;o1)for(let h=0;h.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{kL.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(kL,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class JW extends ws{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new Pt;r.setAttribute("position",new rt(t,3)),r.setAttribute("color",new rt(i,3));const s=new Fi({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new ke,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class KW{constructor(){this.type="ShapePath",this.color=new ke,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new sh,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,o){return this.currentPath.bezierCurveTo(e,t,i,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(m){const x=[];for(let A=0,w=m.length;ANumber.EPSILON){if(T<0&&(D=x[P],B=-B,N=x[I],T=-T),m.yN.y)continue;if(m.y===D.y){if(m.x===D.x)return!0}else{const F=T*(m.x-D.x)-B*(m.y-D.y);if(F===0)return!0;if(F<0)continue;w=!w}}else{if(m.y!==D.y)continue;if(N.x<=m.x&&m.x<=D.x||D.x<=m.x&&m.x<=N.x)return!0}}return w}const r=Ws.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const u=[];if(s.length===1)return a=s[0],l=new Nl,l.curves=a.curves,u.push(l),u;let d=!r(s[0].getPoints());d=e?!d:d;const h=[],p=[];let g=[],v=0,S;p[v]=void 0,g[v]=[];for(let m=0,x=s.length;m1){let m=!1,x=0;for(let A=0,w=p.length;A0&&m===!1&&(g=h)}let _;for(let m=0,x=p.length;mt=>(i,r)=>{i[n]===void 0&&(i[n]=new G(e)),i[n].setComponent(t,r)},qW=(n,e)=>t=>(i,r)=>{i[n]===void 0&&(i[n]=new cr(e));const s=i[n];s[t]=r},HL=n=>(e,t)=>{e[n]===void 0&&(e[n]=new ke(t)),e[n].set(t)},dM=zL("scale",1),hM=zL("position",0),pM=qW("rotation",0),GL={x:hM(0),y:hM(1),z:hM(2),scale:(n,e)=>{n.scale===void 0&&(n.scale=new G(1)),n.scale.set(e,e,e)},scaleX:dM(0),scaleY:dM(1),scaleZ:dM(2),rotateX:pM("x"),rotateY:pM("y"),rotateZ:pM("z"),color:HL("color"),specular:HL("specular")};function ZW(n,e,t){e in GL?GL[e](n,t[e]):(e==="opacity"&&!n.transparent&&(n.transparent=!0),n[e]=t[e])}const mM=(n,e)=>t=>i=>{const r=i[n];return r?r[t]:e},gM=mM("position",0),Vv=mM("scale",1),vM=mM("rotation",0),VL={x:gM("x"),y:gM("y"),z:gM("z"),scale:Vv("x"),scaleX:Vv("x"),scaleY:Vv("y"),scaleZ:Vv("z"),rotateX:vM("x"),rotateY:vM("y"),rotateZ:vM("z")};function $W(n){if(n!==void 0)return n instanceof ke?n.getStyle():n}function e6(n,e){return e in VL?VL[e](n):$W(n[e])||0}const t6=["x","y","z"],WL={"position-x":"x","position-y":"y","position-z":"z","rotation-x":"rotateX","rotation-y":"rotateY","rotation-z":"rotateZ","scale-x":"scaleX","scale-y":"scaleY","scale-z":"scaleZ"},XL=(n,e)=>{const t={};let i;for(i in n){const r=n[i];if(Tn(r)||Tn(e[i])){const s=WL[i]||i;t[s]=r}else if(Array.isArray(r))for(let s=0;s({});class i6 extends zR{constructor(){super(...arguments),this.type="three",this.measureInstanceViewportBox=kn}readValueFromInstance(e,t){return e6(e,t)}getBaseTargetFromProps(){}sortInstanceNodePosition(e,t){return e.id-t.id}removeValueFromRenderState(){}scrapeMotionValuesFromProps(e,t){return XL(e,t)}build(e,t){for(const i in t)e[i]=t[i]}renderInstance(e,t){for(const i in t)ZW(e,i,t)}}const r6=(n,e)=>new i6(e,{}),s6=lA({scrapeMotionValuesFromProps:XL,createRenderState:n6}),o6=Object.assign({},ob);function jL(n){return ER({Component:n,preloadedFeatures:o6,useRender:TH,useVisualState:s6,createVisualElement:r6})}const yM=new Map,JL=new Proxy(jL,{get:(n,e)=>(!yM.has(e)&&yM.set(e,jL(e)),yM.get(e))});var KL={exports:{}},Yl={};/** * @license React * react-reconciler-constants.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */Yl.ConcurrentRoot=1,Yl.ContinuousEventPriority=4,Yl.DefaultEventPriority=16,Yl.DiscreteEventPriority=1,Yl.IdleEventPriority=536870912,Yl.LegacyRoot=0,KL.exports=Yl;var Oc=KL.exports;function a6(n){let e;const t=new Set,i=(u,d)=>{const h=typeof u=="function"?u(e):u;if(h!==e){const p=e;e=d?h:Object.assign({},e,h),t.forEach(g=>g(e,p))}},r=()=>e,s=(u,d=r,h=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let p=d(e);function g(){const v=d(e);if(!h(p,v)){const S=p;u(p=v,S)}}return t.add(g),()=>t.delete(g)},l={setState:i,getState:r,subscribe:(u,d,h)=>d||h?s(u,d,h):(t.add(u),()=>t.delete(u)),destroy:()=>t.clear()};return e=n(i,r,l),l}const YL=typeof window=="undefined"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent)?me.useEffect:me.useLayoutEffect;function l6(n){const e=typeof n=="function"?a6(n):n,t=(i=e.getState,r=Object.is)=>{const[,s]=me.useReducer(_=>_+1,0),o=e.getState(),a=me.useRef(o),l=me.useRef(i),u=me.useRef(r),d=me.useRef(!1),h=me.useRef();h.current===void 0&&(h.current=i(o));let p,g=!1;(a.current!==o||l.current!==i||u.current!==r||d.current)&&(p=i(o),g=!r(h.current,p)),YL(()=>{g&&(h.current=p),a.current=o,l.current=i,u.current=r,d.current=!1});const v=me.useRef(o);YL(()=>{const _=()=>{try{const x=e.getState(),A=l.current(x);u.current(h.current,A)||(a.current=x,h.current=A,s())}catch(x){d.current=!0,s()}},m=e.subscribe(_);return e.getState()!==v.current&&_(),m},[]);const S=g?p:h.current;return me.useDebugValue(S),S};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const i=[t,e];return{next(){const r=i.length<=0;return{value:i.shift(),done:r}}}},t}const u6=n=>typeof n=="object"&&typeof n.then=="function",Ql=[];function QL(n,e,t=(i,r)=>i===r){if(n===e)return!0;if(!n||!e)return!1;const i=n.length;if(e.length!==i)return!1;for(let r=0;r0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,i.lifespan)),s.response;if(!t)throw s.promise}const r={keys:e,equal:i.equal,remove:()=>{const s=Ql.indexOf(r);s!==-1&&Ql.splice(s,1)},promise:(u6(n)?n:n(...e)).then(s=>{r.response=s,i.lifespan&&i.lifespan>0&&(r.timeout=setTimeout(r.remove,i.lifespan))}).catch(s=>r.error=s)};if(Ql.push(r),!t)throw r.promise}const c6=(n,e,t)=>qL(n,e,!1,t),f6=(n,e,t)=>void qL(n,e,!0,t),d6=n=>{if(n===void 0||n.length===0)Ql.splice(0,Ql.length);else{const e=Ql.find(t=>QL(n,t.keys,t.equal));e&&e.remove()}};var ZL={exports:{}},$L={exports:{}},e2={};/** * @license React * scheduler.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */(function(n){function e(z,$){var ne=z.length;z.push($);e:for(;0>>1,Ce=z[de];if(0>>1;der(Me,ne))Ier(Be,Me)?(z[de]=Be,z[Ie]=ne,de=Ie):(z[de]=Me,z[re]=ne,de=re);else if(Ier(Be,ne))z[de]=Be,z[Ie]=ne,de=Ie;else break e}}return $}function r(z,$){var ne=z.sortIndex-$.sortIndex;return ne!==0?ne:z.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],u=[],d=1,h=null,p=3,g=!1,v=!1,S=!1,_=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate!="undefined"?setImmediate:null;typeof navigator!="undefined"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function A(z){for(var $=t(u);$!==null;){if($.callback===null)i(u);else if($.startTime<=z)i(u),$.sortIndex=$.expirationTime,e(l,$);else break;$=t(u)}}function w(z){if(S=!1,A(z),!v)if(t(l)!==null)v=!0,Z(I);else{var $=t(u);$!==null&&fe(w,$.startTime-z)}}function I(z,$){v=!1,S&&(S=!1,m(N),N=-1),g=!0;var ne=p;try{for(A($),h=t(l);h!==null&&(!(h.expirationTime>$)||z&&!F());){var de=h.callback;if(typeof de=="function"){h.callback=null,p=h.priorityLevel;var Ce=de(h.expirationTime<=$);$=n.unstable_now(),typeof Ce=="function"?h.callback=Ce:h===t(l)&&i(l),A($)}else i(l);h=t(l)}if(h!==null)var ot=!0;else{var re=t(u);re!==null&&fe(w,re.startTime-$),ot=!1}return ot}finally{h=null,p=ne,g=!1}}var P=!1,D=null,N=-1,B=5,T=-1;function F(){return!(n.unstable_now()-Tz||125de?(z.sortIndex=ne,e(u,z),t(l)===null&&z===t(u)&&(S?(m(N),N=-1):S=!0,fe(w,ne-de))):(z.sortIndex=Ce,e(l,z),v||g||(v=!0,Z(I))),z},n.unstable_shouldYield=F,n.unstable_wrapCallback=function(z){var $=p;return function(){var ne=p;p=$;try{return z.apply(this,arguments)}finally{p=ne}}}})(e2),$L.exports=e2;var xM=$L.exports;/** * @license React * react-reconciler.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var h6=function(e){var t={},i=me,r=xM,s=Object.assign;function o(c){for(var f="https://reactjs.org/docs/error-decoder.html?invariant="+c,y=1;yY||E[V]!==R[Y]){var pe=` `+E[V].replace(" at new "," at ");return c.displayName&&pe.includes("")&&(pe=pe.replace("",c.displayName)),pe}while(1<=V&&0<=Y);break}}}finally{yt=!1,Error.prepareStackTrace=y}return(c=c?c.displayName||c.name:"")?ht(c):""}var Yt=Object.prototype.hasOwnProperty,ln=[],en=-1;function xn(c){return{current:c}}function st(c){0>en||(c.current=ln[en],ln[en]=null,en--)}function Ue(c,f){en++,ln[en]=c.current,c.current=f}var fn={},At=xn(fn),un=xn(!1),Ui=fn;function Fn(c,f){var y=c.type.contextTypes;if(!y)return fn;var M=c.stateNode;if(M&&M.__reactInternalMemoizedUnmaskedChildContext===f)return M.__reactInternalMemoizedMaskedChildContext;var E={},R;for(R in y)E[R]=f[R];return M&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=f,c.__reactInternalMemoizedMaskedChildContext=E),E}function Yn(c){return c=c.childContextTypes,c!=null}function hn(){st(un),st(At)}function dr(c,f,y){if(At.current!==fn)throw Error(o(168));Ue(At,f),Ue(un,y)}function js(c,f,y){var M=c.stateNode;if(f=f.childContextTypes,typeof M.getChildContext!="function")return y;M=M.getChildContext();for(var E in M)if(!(E in f))throw Error(o(108,N(c)||"Unknown",E));return s({},y,M)}function ci(c){return c=(c=c.stateNode)&&c.__reactInternalMemoizedMergedChildContext||fn,Ui=At.current,Ue(At,c),Ue(un,un.current),!0}function Pa(c,f,y){var M=c.stateNode;if(!M)throw Error(o(169));y?(c=js(c,f,Ui),M.__reactInternalMemoizedMergedChildContext=c,st(un),st(At),Ue(At,c)):st(un),Ue(un,y)}var qi=Math.clz32?Math.clz32:GM,Yc=Math.log,HM=Math.LN2;function GM(c){return c>>>=0,c===0?32:31-(Yc(c)/HM|0)|0}var Qc=64,Ia=4194304;function Bo(c){switch(c&-c){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 c&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return c&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return c}}function qc(c,f){var y=c.pendingLanes;if(y===0)return 0;var M=0,E=c.suspendedLanes,R=c.pingedLanes,V=y&268435455;if(V!==0){var Y=V&~E;Y!==0?M=Bo(Y):(R&=V,R!==0&&(M=Bo(R)))}else V=y&~E,V!==0?M=Bo(V):R!==0&&(M=Bo(R));if(M===0)return 0;if(f!==0&&f!==M&&!(f&E)&&(E=M&-M,R=f&-f,E>=R||E===16&&(R&4194240)!==0))return f;if(M&4&&(M|=y&16),f=c.entangledLanes,f!==0)for(c=c.entanglements,f&=M;0y;y++)f.push(c);return f}function eu(c,f,y){c.pendingLanes|=f,f!==536870912&&(c.suspendedLanes=0,c.pingedLanes=0),c=c.eventTimes,f=31-qi(f),c[f]=y}function WM(c,f){var y=c.pendingLanes&~f;c.pendingLanes=f,c.suspendedLanes=0,c.pingedLanes=0,c.expiredLanes&=f,c.mutableReadLanes&=f,c.entangledLanes&=f,f=c.entanglements;var M=c.eventTimes;for(c=c.expirationTimes;0>=V,E-=V,bs=1<<32-qi(f)+E|y<nn?(mi=Bt,Bt=null):mi=Bt.sibling;var rn=xt(se,Bt,ce[nn],Ye);if(rn===null){Bt===null&&(Bt=mi);break}c&&Bt&&rn.alternate===null&&f(se,Bt),ee=R(rn,ee,nn),Ot===null?lt=rn:Ot.sibling=rn,Ot=rn,Bt=mi}if(nn===ce.length)return y(se,Bt),_n&&Do(se,nn),lt;if(Bt===null){for(;nnnn?(mi=Bt,Bt=null):mi=Bt.sibling;var Xa=xt(se,Bt,rn.value,Ye);if(Xa===null){Bt===null&&(Bt=mi);break}c&&Bt&&Xa.alternate===null&&f(se,Bt),ee=R(Xa,ee,nn),Ot===null?lt=Xa:Ot.sibling=Xa,Ot=Xa,Bt=mi}if(rn.done)return y(se,Bt),_n&&Do(se,nn),lt;if(Bt===null){for(;!rn.done;nn++,rn=ce.next())rn=It(se,rn.value,Ye),rn!==null&&(ee=R(rn,ee,nn),Ot===null?lt=rn:Ot.sibling=rn,Ot=rn);return _n&&Do(se,nn),lt}for(Bt=M(se,Bt);!rn.done;nn++,rn=ce.next())rn=pn(Bt,se,nn,rn.value,Ye),rn!==null&&(c&&rn.alternate!==null&&Bt.delete(rn.key===null?nn:rn.key),ee=R(rn,ee,nn),Ot===null?lt=rn:Ot.sibling=rn,Ot=rn);return c&&Bt.forEach(function(_j){return f(se,_j)}),_n&&Do(se,nn),lt}function ss(se,ee,ce,Ye){if(typeof ce=="object"&&ce!==null&&ce.type===d&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case l:e:{for(var lt=ce.key,Ot=ee;Ot!==null;){if(Ot.key===lt){if(lt=ce.type,lt===d){if(Ot.tag===7){y(se,Ot.sibling),ee=E(Ot,ce.props.children),ee.return=se,se=ee;break e}}else if(Ot.elementType===lt||typeof lt=="object"&<!==null&<.$$typeof===A&&b(lt)===Ot.type){y(se,Ot.sibling),ee=E(Ot,ce.props),ee.ref=iu(se,Ot,ce),ee.return=se,se=ee;break e}y(se,Ot);break}else f(se,Ot);Ot=Ot.sibling}ce.type===d?(ee=fu(ce.props.children,se.mode,Ye,ce.key),ee.return=se,se=ee):(Ye=H0(ce.type,ce.key,ce.props,null,se.mode,Ye),Ye.ref=iu(se,ee,ce),Ye.return=se,se=Ye)}return V(se);case u:e:{for(Ot=ce.key;ee!==null;){if(ee.key===Ot)if(ee.tag===4&&ee.stateNode.containerInfo===ce.containerInfo&&ee.stateNode.implementation===ce.implementation){y(se,ee.sibling),ee=E(ee,ce.children||[]),ee.return=se,se=ee;break e}else{y(se,ee);break}else f(se,ee);ee=ee.sibling}ee=I1(ce,se.mode,Ye),ee.return=se,se=ee}return V(se);case A:return Ot=ce._init,ss(se,ee,Ot(ce._payload),Ye)}if(ie(ce))return ct(se,ee,ce,Ye);if(P(ce))return zi(se,ee,ce,Ye);af(se,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"?(ce=""+ce,ee!==null&&ee.tag===6?(y(se,ee.sibling),ee=E(ee,ce),ee.return=se,se=ee):(y(se,ee),ee=P1(ce,se.mode,Ye),ee.return=se,se=ee),V(se)):y(se,ee)}return ss}var L=C(!0),k=C(!1),j={},ue=xn(j),he=xn(j),Fe=xn(j);function Je(c){if(c===j)throw Error(o(174));return c}function gt(c,f){Ue(Fe,f),Ue(he,c),Ue(ue,j),c=fe(f),st(ue),Ue(ue,c)}function pt(){st(ue),st(he),st(Fe)}function Nn(c){var f=Je(Fe.current),y=Je(ue.current);f=z(y,c.type,f),y!==f&&(Ue(he,c),Ue(ue,f))}function Wn(c){he.current===c&&(st(ue),st(he))}var qt=xn(0);function Ps(c){for(var f=c;f!==null;){if(f.tag===13){var y=f.memoizedState;if(y!==null&&(y=y.dehydrated,y===null||$l(y)||Ta(y)))return f}else if(f.tag===19&&f.memoizedProps.revealOrder!==void 0){if(f.flags&128)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===c)break;for(;f.sibling===null;){if(f.return===null||f.return===c)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var Ge=[];function at(){for(var c=0;cy?y:4,c(!0);var M=zt.transition;zt.transition={};try{c(!1),f()}finally{Qt=y,zt.transition=M}}function eD(){return qs().memoizedState}function JX(c,f,y){var M=Ga(c);y={lane:M,action:y,hasEagerState:!1,eagerState:null,next:null},tD(c)?nD(f,y):(iD(c,f,y),y=tr(),c=is(c,M,y),c!==null&&rD(c,f,M))}function KX(c,f,y){var M=Ga(c),E={lane:M,action:y,hasEagerState:!1,eagerState:null,next:null};if(tD(c))nD(f,E);else{iD(c,f,E);var R=c.alternate;if(c.lanes===0&&(R===null||R.lanes===0)&&(R=f.lastRenderedReducer,R!==null))try{var V=f.lastRenderedState,Y=R(V,y);if(E.hasEagerState=!0,E.eagerState=Y,es(Y,V))return}catch(pe){}finally{}y=tr(),c=is(c,M,y),c!==null&&rD(c,f,M)}}function tD(c){var f=c.alternate;return c===Ht||f!==null&&f===Ht}function nD(c,f){ru=ka=!0;var y=c.pending;y===null?f.next=f:(f.next=y.next,y.next=f),c.pending=f}function iD(c,f,y){ti!==null&&c.mode&1&&!(Gt&2)?(c=f.interleaved,c===null?(y.next=y,ts===null?ts=[f]:ts.push(f)):(y.next=c.next,c.next=y),f.interleaved=y):(c=f.pending,c===null?y.next=y:(y.next=c.next,c.next=y),f.pending=y)}function rD(c,f,y){if(y&4194240){var M=f.lanes;M&=c.pendingLanes,y|=M,f.lanes=y,Mh(c,y)}}var y0={readContext:pr,useCallback:Oi,useContext:Oi,useEffect:Oi,useImperativeHandle:Oi,useInsertionEffect:Oi,useLayoutEffect:Oi,useMemo:Oi,useReducer:Oi,useRef:Oi,useState:Oi,useDebugValue:Oi,useDeferredValue:Oi,useTransition:Oi,useMutableSource:Oi,useSyncExternalStore:Oi,useId:Oi,unstable_isNewReconciler:!1},YX={readContext:pr,useCallback:function(c,f){return Fo().memoizedState=[c,f===void 0?null:f],c},useContext:pr,useEffect:n1,useImperativeHandle:function(c,f,y){return y=y!=null?y.concat([c]):null,g0(4194308,4,Q2.bind(null,f,c),y)},useLayoutEffect:function(c,f){return g0(4194308,4,c,f)},useInsertionEffect:function(c,f){return g0(4,2,c,f)},useMemo:function(c,f){var y=Fo();return f=f===void 0?null:f,c=c(),y.memoizedState=[c,f],c},useReducer:function(c,f,y){var M=Fo();return f=y!==void 0?y(f):f,M.memoizedState=M.baseState=f,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:f},M.queue=c,c=c.dispatch=JX.bind(null,Ht,c),[M.memoizedState,c]},useRef:function(c){var f=Fo();return c={current:c},f.memoizedState=c},useState:t1,useDebugValue:i1,useDeferredValue:function(c){var f=t1(c),y=f[0],M=f[1];return n1(function(){var E=zt.transition;zt.transition={};try{M(c)}finally{zt.transition=E}},[c]),y},useTransition:function(){var c=t1(!1),f=c[0];return c=jX.bind(null,c[1]),Fo().memoizedState=c,[f,c]},useMutableSource:function(){},useSyncExternalStore:function(c,f,y){var M=Ht,E=Fo();if(_n){if(y===void 0)throw Error(o(407));y=y()}else{if(y=f(),ti===null)throw Error(o(349));dn&30||V2(M,f,y)}E.memoizedState=y;var R={value:y,getSnapshot:f};return E.queue=R,n1(X2.bind(null,M,R,c),[c]),M.flags|=2048,zh(9,W2.bind(null,M,R,y,f),void 0,null),y},useId:function(){var c=Fo(),f=ti.identifierPrefix;if(_n){var y=Rs,M=bs;y=(M&~(1<<32-qi(M)-1)).toString(32)+y,f=":"+f+"R"+y,y=kh++,0S1&&(f.flags|=128,M=!0,Wh(E,!1),f.lanes=4194304)}else{if(!M)if(c=Ps(R),c!==null){if(f.flags|=128,M=!0,c=c.updateQueue,c!==null&&(f.updateQueue=c,f.flags|=4),Wh(E,!0),E.tail===null&&E.tailMode==="hidden"&&!R.alternate&&!_n)return ki(f),null}else 2*Qn()-E.renderingStartTime>S1&&y!==1073741824&&(f.flags|=128,M=!0,Wh(E,!1),f.lanes=4194304);E.isBackwards?(R.sibling=f.child,f.child=R):(c=E.last,c!==null?c.sibling=R:f.child=R,E.last=R)}return E.tail!==null?(f=E.tail,E.rendering=f,E.tail=f.sibling,E.renderingStartTime=Qn(),f.sibling=null,c=qt.current,Ue(qt,M?c&1|2:c&1),f):(ki(f),null);case 22:case 23:return T1(),M=f.memoizedState!==null,c!==null&&c.memoizedState!==null!==M&&(f.flags|=8192),M&&f.mode&1?Or&1073741824&&(ki(f),Mt&&f.subtreeFlags&6&&(f.flags|=8192)):ki(f),null;case 24:return null;case 25:return null}throw Error(o(156,f.tag))}var ej=a.ReactCurrentOwner,Ur=!1;function er(c,f,y,M){f.child=c===null?k(f,null,y,M):L(f,c.child,y,M)}function dD(c,f,y,M,E){y=y.render;var R=f.ref;return Da(f,E),M=$M(c,f,y,M,R,E),y=e1(),c!==null&&!Ur?(f.updateQueue=c.updateQueue,f.flags&=-2053,c.lanes&=~E,No(c,f,E)):(_n&&y&&Lh(f),f.flags|=1,er(c,f,M,E),f.child)}function hD(c,f,y,M,E){if(c===null){var R=y.type;return typeof R=="function"&&!R1(R)&&R.defaultProps===void 0&&y.compare===null&&y.defaultProps===void 0?(f.tag=15,f.type=R,pD(c,f,R,M,E)):(c=H0(y.type,null,M,f,f.mode,E),c.ref=f.ref,c.return=f,f.child=c)}if(R=c.child,!(c.lanes&E)){var V=R.memoizedProps;if(y=y.compare,y=y!==null?y:ef,y(V,M)&&c.ref===f.ref)return No(c,f,E)}return f.flags|=1,c=Wa(R,M),c.ref=f.ref,c.return=f,f.child=c}function pD(c,f,y,M,E){if(c!==null&&ef(c.memoizedProps,M)&&c.ref===f.ref)if(Ur=!1,(c.lanes&E)!==0)c.flags&131072&&(Ur=!0);else return f.lanes=c.lanes,No(c,f,E);return o1(c,f,y,M,E)}function mD(c,f,y){var M=f.pendingProps,E=M.children,R=c!==null?c.memoizedState:null;if(M.mode==="hidden")if(!(f.mode&1))f.memoizedState={baseLanes:0,cachePool:null},Ue(lf,Or),Or|=y;else if(y&1073741824)f.memoizedState={baseLanes:0,cachePool:null},M=R!==null?R.baseLanes:y,Ue(lf,Or),Or|=M;else return c=R!==null?R.baseLanes|y:y,f.lanes=f.childLanes=1073741824,f.memoizedState={baseLanes:c,cachePool:null},f.updateQueue=null,Ue(lf,Or),Or|=c,null;else R!==null?(M=R.baseLanes|y,f.memoizedState=null):M=y,Ue(lf,Or),Or|=M;return er(c,f,E,y),f.child}function gD(c,f){var y=f.ref;(c===null&&y!==null||c!==null&&c.ref!==y)&&(f.flags|=512,f.flags|=2097152)}function o1(c,f,y,M,E){var R=Yn(y)?Ui:At.current;return R=Fn(f,R),Da(f,E),y=$M(c,f,y,M,R,E),M=e1(),c!==null&&!Ur?(f.updateQueue=c.updateQueue,f.flags&=-2053,c.lanes&=~E,No(c,f,E)):(_n&&M&&Lh(f),f.flags|=1,er(c,f,y,E),f.child)}function vD(c,f,y,M,E){if(Yn(y)){var R=!0;ci(f)}else R=!1;if(Da(f,E),f.stateNode===null)c!==null&&(c.alternate=null,f.alternate=null,f.flags|=2),u0(f,y,M),Bh(f,y,M,E),M=!0;else if(c===null){var V=f.stateNode,Y=f.memoizedProps;V.props=Y;var pe=V.context,Ne=y.contextType;typeof Ne=="object"&&Ne!==null?Ne=pr(Ne):(Ne=Yn(y)?Ui:At.current,Ne=Fn(f,Ne));var it=y.getDerivedStateFromProps,It=typeof it=="function"||typeof V.getSnapshotBeforeUpdate=="function";It||typeof V.UNSAFE_componentWillReceiveProps!="function"&&typeof V.componentWillReceiveProps!="function"||(Y!==M||pe!==Ne)&&c0(f,V,M,Ne),Ks=!1;var xt=f.memoizedState;V.state=xt,rf(f,M,V,E),pe=f.memoizedState,Y!==M||xt!==pe||un.current||Ks?(typeof it=="function"&&(sf(f,y,it,M),pe=f.memoizedState),(Y=Ks||l0(f,y,Y,M,xt,pe,Ne))?(It||typeof V.UNSAFE_componentWillMount!="function"&&typeof V.componentWillMount!="function"||(typeof V.componentWillMount=="function"&&V.componentWillMount(),typeof V.UNSAFE_componentWillMount=="function"&&V.UNSAFE_componentWillMount()),typeof V.componentDidMount=="function"&&(f.flags|=4194308)):(typeof V.componentDidMount=="function"&&(f.flags|=4194308),f.memoizedProps=M,f.memoizedState=pe),V.props=M,V.state=pe,V.context=Ne,M=Y):(typeof V.componentDidMount=="function"&&(f.flags|=4194308),M=!1)}else{V=f.stateNode,r0(c,f),Y=f.memoizedProps,Ne=f.type===f.elementType?Y:Nr(f.type,Y),V.props=Ne,It=f.pendingProps,xt=V.context,pe=y.contextType,typeof pe=="object"&&pe!==null?pe=pr(pe):(pe=Yn(y)?Ui:At.current,pe=Fn(f,pe));var pn=y.getDerivedStateFromProps;(it=typeof pn=="function"||typeof V.getSnapshotBeforeUpdate=="function")||typeof V.UNSAFE_componentWillReceiveProps!="function"&&typeof V.componentWillReceiveProps!="function"||(Y!==It||xt!==pe)&&c0(f,V,M,pe),Ks=!1,xt=f.memoizedState,V.state=xt,rf(f,M,V,E);var ct=f.memoizedState;Y!==It||xt!==ct||un.current||Ks?(typeof pn=="function"&&(sf(f,y,pn,M),ct=f.memoizedState),(Ne=Ks||l0(f,y,Ne,M,xt,ct,pe)||!1)?(it||typeof V.UNSAFE_componentWillUpdate!="function"&&typeof V.componentWillUpdate!="function"||(typeof V.componentWillUpdate=="function"&&V.componentWillUpdate(M,ct,pe),typeof V.UNSAFE_componentWillUpdate=="function"&&V.UNSAFE_componentWillUpdate(M,ct,pe)),typeof V.componentDidUpdate=="function"&&(f.flags|=4),typeof V.getSnapshotBeforeUpdate=="function"&&(f.flags|=1024)):(typeof V.componentDidUpdate!="function"||Y===c.memoizedProps&&xt===c.memoizedState||(f.flags|=4),typeof V.getSnapshotBeforeUpdate!="function"||Y===c.memoizedProps&&xt===c.memoizedState||(f.flags|=1024),f.memoizedProps=M,f.memoizedState=ct),V.props=M,V.state=ct,V.context=pe,M=Ne):(typeof V.componentDidUpdate!="function"||Y===c.memoizedProps&&xt===c.memoizedState||(f.flags|=4),typeof V.getSnapshotBeforeUpdate!="function"||Y===c.memoizedProps&&xt===c.memoizedState||(f.flags|=1024),M=!1)}return a1(c,f,y,M,R,E)}function a1(c,f,y,M,E,R){gD(c,f);var V=(f.flags&128)!==0;if(!M&&!V)return E&&Pa(f,y,!1),No(c,f,R);M=f.stateNode,ej.current=f;var Y=V&&typeof y.getDerivedStateFromError!="function"?null:M.render();return f.flags|=1,c!==null&&V?(f.child=L(f,c.child,null,R),f.child=L(f,null,Y,R)):er(c,f,Y,R),f.memoizedState=M.state,E&&Pa(f,y,!0),f.child}function yD(c){var f=c.stateNode;f.pendingContext?dr(c,f.pendingContext,f.pendingContext!==f.context):f.context&&dr(c,f.context,!1),gt(c,f.containerInfo)}function xD(c,f,y,M,E){return Oa(),Oh(E),f.flags|=256,er(c,f,y,M),f.child}var A0={dehydrated:null,treeContext:null,retryLane:0};function S0(c){return{baseLanes:c,cachePool:null}}function _D(c,f,y){var M=f.pendingProps,E=qt.current,R=!1,V=(f.flags&128)!==0,Y;if((Y=V)||(Y=c!==null&&c.memoizedState===null?!1:(E&2)!==0),Y?(R=!0,f.flags&=-129):(c===null||c.memoizedState!==null)&&(E|=1),Ue(qt,E&1),c===null)return Nh(f),c=f.memoizedState,c!==null&&(c=c.dehydrated,c!==null)?(f.mode&1?Ta(c)?f.lanes=8:f.lanes=1073741824:f.lanes=1,null):(E=M.children,c=M.fallback,R?(M=f.mode,R=f.child,E={mode:"hidden",children:E},!(M&1)&&R!==null?(R.childLanes=0,R.pendingProps=E):R=G0(E,M,0,null),c=fu(c,M,y,null),R.return=f,c.return=f,R.sibling=c,f.child=R,f.child.memoizedState=S0(y),f.memoizedState=A0,c):l1(f,E));if(E=c.memoizedState,E!==null){if(Y=E.dehydrated,Y!==null){if(V)return f.flags&256?(f.flags&=-257,M0(c,f,y,Error(o(422)))):f.memoizedState!==null?(f.child=c.child,f.flags|=128,null):(R=M.fallback,E=f.mode,M=G0({mode:"visible",children:M.children},E,0,null),R=fu(R,E,y,null),R.flags|=2,M.return=f,R.return=f,M.sibling=R,f.child=M,f.mode&1&&L(f,c.child,null,y),f.child.memoizedState=S0(y),f.memoizedState=A0,R);if(!(f.mode&1))f=M0(c,f,y,null);else if(Ta(Y))f=M0(c,f,y,Error(o(419)));else if(M=(y&c.childLanes)!==0,Ur||M){if(M=ti,M!==null){switch(y&-y){case 4:R=2;break;case 16:R=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:R=32;break;case 536870912:R=268435456;break;default:R=0}M=R&(M.suspendedLanes|y)?0:R,M!==0&&M!==E.retryLane&&(E.retryLane=M,is(c,M,-1))}b1(),f=M0(c,f,y,Error(o(421)))}else $l(Y)?(f.flags|=128,f.child=c.child,f=hj.bind(null,c),ba(Y,f),f=null):(y=E.treeContext,Te&&($i=Jc(Y),Zi=f,_n=!0,Si=null,nu=!1,y!==null&&(mr[gr++]=bs,mr[gr++]=Rs,mr[gr++]=Lo,bs=y.id,Rs=y.overflow,Lo=f)),f=l1(f,f.pendingProps.children),f.flags|=4096);return f}return R?(M=SD(c,f,M.children,M.fallback,y),R=f.child,E=c.child.memoizedState,R.memoizedState=E===null?S0(y):{baseLanes:E.baseLanes|y,cachePool:null},R.childLanes=c.childLanes&~y,f.memoizedState=A0,M):(y=AD(c,f,M.children,y),f.memoizedState=null,y)}return R?(M=SD(c,f,M.children,M.fallback,y),R=f.child,E=c.child.memoizedState,R.memoizedState=E===null?S0(y):{baseLanes:E.baseLanes|y,cachePool:null},R.childLanes=c.childLanes&~y,f.memoizedState=A0,M):(y=AD(c,f,M.children,y),f.memoizedState=null,y)}function l1(c,f){return f=G0({mode:"visible",children:f},c.mode,0,null),f.return=c,c.child=f}function AD(c,f,y,M){var E=c.child;return c=E.sibling,y=Wa(E,{mode:"visible",children:y}),!(f.mode&1)&&(y.lanes=M),y.return=f,y.sibling=null,c!==null&&(M=f.deletions,M===null?(f.deletions=[c],f.flags|=16):M.push(c)),f.child=y}function SD(c,f,y,M,E){var R=f.mode;c=c.child;var V=c.sibling,Y={mode:"hidden",children:y};return!(R&1)&&f.child!==c?(y=f.child,y.childLanes=0,y.pendingProps=Y,f.deletions=null):(y=Wa(c,Y),y.subtreeFlags=c.subtreeFlags&14680064),V!==null?M=Wa(V,M):(M=fu(M,R,E,null),M.flags|=2),M.return=f,y.return=f,y.sibling=M,f.child=y,M}function M0(c,f,y,M){return M!==null&&Oh(M),L(f,c.child,null,y),c=l1(f,f.pendingProps.children),c.flags|=2,f.memoizedState=null,c}function MD(c,f,y){c.lanes|=f;var M=c.alternate;M!==null&&(M.lanes|=f),Ph(c.return,f,y)}function u1(c,f,y,M,E){var R=c.memoizedState;R===null?c.memoizedState={isBackwards:f,rendering:null,renderingStartTime:0,last:M,tail:y,tailMode:E}:(R.isBackwards=f,R.rendering=null,R.renderingStartTime=0,R.last=M,R.tail=y,R.tailMode=E)}function wD(c,f,y){var M=f.pendingProps,E=M.revealOrder,R=M.tail;if(er(c,f,M.children,y),M=qt.current,M&2)M=M&1|2,f.flags|=128;else{if(c!==null&&c.flags&128)e:for(c=f.child;c!==null;){if(c.tag===13)c.memoizedState!==null&&MD(c,y,f);else if(c.tag===19)MD(c,y,f);else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===f)break e;for(;c.sibling===null;){if(c.return===null||c.return===f)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}M&=1}if(Ue(qt,M),!(f.mode&1))f.memoizedState=null;else switch(E){case"forwards":for(y=f.child,E=null;y!==null;)c=y.alternate,c!==null&&Ps(c)===null&&(E=y),y=y.sibling;y=E,y===null?(E=f.child,f.child=null):(E=y.sibling,y.sibling=null),u1(f,!1,E,y,R);break;case"backwards":for(y=null,E=f.child,f.child=null;E!==null;){if(c=E.alternate,c!==null&&Ps(c)===null){f.child=E;break}c=E.sibling,E.sibling=y,y=E,E=c}u1(f,!0,y,null,R);break;case"together":u1(f,!1,null,null,void 0);break;default:f.memoizedState=null}return f.child}function No(c,f,y){if(c!==null&&(f.dependencies=c.dependencies),uf|=f.lanes,!(y&f.childLanes))return null;if(c!==null&&f.child!==c.child)throw Error(o(153));if(f.child!==null){for(c=f.child,y=Wa(c,c.pendingProps),f.child=y,y.return=f;c.sibling!==null;)c=c.sibling,y=y.sibling=Wa(c,c.pendingProps),y.return=f;y.sibling=null}return f.child}function tj(c,f,y){switch(f.tag){case 3:yD(f),Oa();break;case 5:Nn(f);break;case 1:Yn(f.type)&&ci(f);break;case 4:gt(f,f.stateNode.containerInfo);break;case 10:i0(f,f.type._context,f.memoizedProps.value);break;case 13:var M=f.memoizedState;if(M!==null)return M.dehydrated!==null?(Ue(qt,qt.current&1),f.flags|=128,null):y&f.child.childLanes?_D(c,f,y):(Ue(qt,qt.current&1),c=No(c,f,y),c!==null?c.sibling:null);Ue(qt,qt.current&1);break;case 19:if(M=(y&f.childLanes)!==0,c.flags&128){if(M)return wD(c,f,y);f.flags|=128}var E=f.memoizedState;if(E!==null&&(E.rendering=null,E.tail=null,E.lastEffect=null),Ue(qt,qt.current),M)break;return null;case 22:case 23:return f.lanes=0,mD(c,f,y)}return No(c,f,y)}function nj(c,f){switch(Dh(f),f.tag){case 1:return Yn(f.type)&&hn(),c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 3:return pt(),st(un),st(At),at(),c=f.flags,c&65536&&!(c&128)?(f.flags=c&-65537|128,f):null;case 5:return Wn(f),null;case 13:if(st(qt),c=f.memoizedState,c!==null&&c.dehydrated!==null){if(f.alternate===null)throw Error(o(340));Oa()}return c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 19:return st(qt),null;case 4:return pt(),null;case 10:return Rh(f.type._context),null;case 22:case 23:return T1(),null;case 24:return null;default:return null}}var w0=!1,ou=!1,ij=typeof WeakSet=="function"?WeakSet:Set,je=null;function E0(c,f){var y=c.ref;if(y!==null)if(typeof y=="function")try{y(null)}catch(M){xr(c,f,M)}else y.current=null}function c1(c,f,y){try{y()}catch(M){xr(c,f,M)}}var ED=!1;function rj(c,f){for($(c.containerInfo),je=f;je!==null;)if(c=je,f=c.child,(c.subtreeFlags&1028)!==0&&f!==null)f.return=c,je=f;else for(;je!==null;){c=je;try{var y=c.alternate;if(c.flags&1024)switch(c.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var M=y.memoizedProps,E=y.memoizedState,R=c.stateNode,V=R.getSnapshotBeforeUpdate(c.elementType===c.type?M:Nr(c.type,M),E);R.__reactInternalSnapshotBeforeUpdate=V}break;case 3:Mt&&Oe(c.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(Y){xr(c,c.return,Y)}if(f=c.sibling,f!==null){f.return=c.return,je=f;break}je=c.return}return y=ED,ED=!1,y}function au(c,f,y){var M=f.updateQueue;if(M=M!==null?M.lastEffect:null,M!==null){var E=M=M.next;do{if((E.tag&c)===c){var R=E.destroy;E.destroy=void 0,R!==void 0&&c1(f,y,R)}E=E.next}while(E!==M)}}function Xh(c,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var y=f=f.next;do{if((y.tag&c)===c){var M=y.create;y.destroy=M()}y=y.next}while(y!==f)}}function f1(c){var f=c.ref;if(f!==null){var y=c.stateNode;switch(c.tag){case 5:c=Z(y);break;default:c=y}typeof f=="function"?f(c):f.current=c}}function CD(c,f,y){if($r&&typeof $r.onCommitFiberUnmount=="function")try{$r.onCommitFiberUnmount($c,f)}catch(V){}switch(f.tag){case 0:case 11:case 14:case 15:if(c=f.updateQueue,c!==null&&(c=c.lastEffect,c!==null)){var M=c=c.next;do{var E=M,R=E.destroy;E=E.tag,R!==void 0&&(E&2||E&4)&&c1(f,y,R),M=M.next}while(M!==c)}break;case 1:if(E0(f,y),c=f.stateNode,typeof c.componentWillUnmount=="function")try{c.props=f.memoizedProps,c.state=f.memoizedState,c.componentWillUnmount()}catch(V){xr(f,y,V)}break;case 5:E0(f,y);break;case 4:Mt?BD(c,f,y):H&&H&&(f=f.stateNode.containerInfo,y=Vt(f),Jt(f,y))}}function TD(c,f,y){for(var M=f;;)if(CD(c,M,y),M.child===null||Mt&&M.tag===4){if(M===f)break;for(;M.sibling===null;){if(M.return===null||M.return===f)return;M=M.return}M.sibling.return=M.return,M=M.sibling}else M.child.return=M,M=M.child}function bD(c){var f=c.alternate;f!==null&&(c.alternate=null,bD(f)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(f=c.stateNode,f!==null&&dt(f)),c.stateNode=null,c.return=null,c.dependencies=null,c.memoizedProps=null,c.memoizedState=null,c.pendingProps=null,c.stateNode=null,c.updateQueue=null}function RD(c){return c.tag===5||c.tag===3||c.tag===4}function PD(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||RD(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function ID(c){if(Mt){e:{for(var f=c.return;f!==null;){if(RD(f))break e;f=f.return}throw Error(o(160))}var y=f;switch(y.tag){case 5:f=y.stateNode,y.flags&32&&(sn(f),y.flags&=-33),y=PD(c),h1(c,y,f);break;case 3:case 4:f=y.stateNode.containerInfo,y=PD(c),d1(c,y,f);break;default:throw Error(o(161))}}}function d1(c,f,y){var M=c.tag;if(M===5||M===6)c=c.stateNode,f?et(y,c,f):Rt(y,c);else if(M!==4&&(c=c.child,c!==null))for(d1(c,f,y),c=c.sibling;c!==null;)d1(c,f,y),c=c.sibling}function h1(c,f,y){var M=c.tag;if(M===5||M===6)c=c.stateNode,f?Ct(y,c,f):Qe(y,c);else if(M!==4&&(c=c.child,c!==null))for(h1(c,f,y),c=c.sibling;c!==null;)h1(c,f,y),c=c.sibling}function BD(c,f,y){for(var M=f,E=!1,R,V;;){if(!E){E=M.return;e:for(;;){if(E===null)throw Error(o(160));switch(R=E.stateNode,E.tag){case 5:V=!1;break e;case 3:R=R.containerInfo,V=!0;break e;case 4:R=R.containerInfo,V=!0;break e}E=E.return}E=!0}if(M.tag===5||M.tag===6)TD(c,M,y),V?Ft(R,M.stateNode):Tt(R,M.stateNode);else if(M.tag===18)V?te(R,M.stateNode):le(R,M.stateNode);else if(M.tag===4){if(M.child!==null){R=M.stateNode.containerInfo,V=!0,M.child.return=M,M=M.child;continue}}else if(CD(c,M,y),M.child!==null){M.child.return=M,M=M.child;continue}if(M===f)break;for(;M.sibling===null;){if(M.return===null||M.return===f)return;M=M.return,M.tag===4&&(E=!1)}M.sibling.return=M.return,M=M.sibling}}function p1(c,f){if(Mt){switch(f.tag){case 0:case 11:case 14:case 15:au(3,f,f.return),Xh(3,f),au(5,f,f.return);return;case 1:return;case 5:var y=f.stateNode;if(y!=null){var M=f.memoizedProps;c=c!==null?c.memoizedProps:M;var E=f.type,R=f.updateQueue;f.updateQueue=null,R!==null&&kt(y,R,E,c,M,f)}return;case 6:if(f.stateNode===null)throw Error(o(162));y=f.memoizedProps,Pe(f.stateNode,c!==null?c.memoizedProps:y,y);return;case 3:Te&&c!==null&&c.memoizedState.isDehydrated&&q(f.stateNode.containerInfo);return;case 12:return;case 13:C0(f);return;case 19:C0(f);return;case 17:return}throw Error(o(163))}switch(f.tag){case 0:case 11:case 14:case 15:au(3,f,f.return),Xh(3,f),au(5,f,f.return);return;case 12:return;case 13:C0(f);return;case 19:C0(f);return;case 3:Te&&c!==null&&c.memoizedState.isDehydrated&&q(f.stateNode.containerInfo);break;case 22:case 23:return}e:if(H){switch(f.tag){case 1:case 5:case 6:break e;case 3:case 4:f=f.stateNode,Jt(f.containerInfo,f.pendingChildren);break e}throw Error(o(163))}}function C0(c){var f=c.updateQueue;if(f!==null){c.updateQueue=null;var y=c.stateNode;y===null&&(y=c.stateNode=new ij),f.forEach(function(M){var E=pj.bind(null,c,M);y.has(M)||(y.add(M),M.then(E,E))})}}function sj(c,f){for(je=f;je!==null;){f=je;var y=f.deletions;if(y!==null)for(var M=0;M";case b0:return":has("+(v1(c)||"")+")";case R0:return'[role="'+c.value+'"]';case I0:return'"'+c.value+'"';case P0:return'[data-testname="'+c.value+'"]';default:throw Error(o(365))}}function UD(c,f){var y=[];c=[c,0];for(var M=0;ME&&(E=V),M&=~R}if(M=E,M=Qn()-M,M=(120>M?120:480>M?480:1080>M?1080:1920>M?1920:3e3>M?3e3:4320>M?4320:1960*aj(M/1960))-M,10c?16:c,Ha===null)var M=!1;else{if(c=Ha,Ha=null,N0=0,Gt&6)throw Error(o(331));var E=Gt;for(Gt|=4,je=c.current;je!==null;){var R=je,V=R.child;if(je.flags&16){var Y=R.deletions;if(Y!==null){for(var pe=0;peQn()-A1?lu(c,0):_1|=y),yr(c,f)}function jD(c,f){f===0&&(c.mode&1?(f=Ia,Ia<<=1,!(Ia&130023424)&&(Ia=4194304)):f=1);var y=tr();c=k0(c,f),c!==null&&(eu(c,f,y),yr(c,y))}function hj(c){var f=c.memoizedState,y=0;f!==null&&(y=f.retryLane),jD(c,y)}function pj(c,f){var y=0;switch(c.tag){case 13:var M=c.stateNode,E=c.memoizedState;E!==null&&(y=E.retryLane);break;case 19:M=c.stateNode;break;default:throw Error(o(314))}M!==null&&M.delete(f),jD(c,y)}var JD;JD=function(c,f,y){if(c!==null)if(c.memoizedProps!==f.pendingProps||un.current)Ur=!0;else{if(!(c.lanes&y)&&!(f.flags&128))return Ur=!1,tj(c,f,y);Ur=!!(c.flags&131072)}else Ur=!1,_n&&f.flags&1048576&&f0(f,Ts,f.index);switch(f.lanes=0,f.tag){case 2:var M=f.type;c!==null&&(c.alternate=null,f.alternate=null,f.flags|=2),c=f.pendingProps;var E=Fn(f,At.current);Da(f,y),E=$M(null,f,M,c,E,y);var R=e1();return f.flags|=1,typeof E=="object"&&E!==null&&typeof E.render=="function"&&E.$$typeof===void 0?(f.tag=1,f.memoizedState=null,f.updateQueue=null,Yn(M)?(R=!0,ci(f)):R=!1,f.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,Ih(f),E.updater=of,f.stateNode=E,E._reactInternals=f,Bh(f,M,c,y),f=a1(null,f,M,!0,R,y)):(f.tag=0,_n&&R&&Lh(f),er(null,f,E,y),f=f.child),f;case 16:M=f.elementType;e:{switch(c!==null&&(c.alternate=null,f.alternate=null,f.flags|=2),c=f.pendingProps,E=M._init,M=E(M._payload),f.type=M,E=f.tag=gj(M),c=Nr(M,c),E){case 0:f=o1(null,f,M,c,y);break e;case 1:f=vD(null,f,M,c,y);break e;case 11:f=dD(null,f,M,c,y);break e;case 14:f=hD(null,f,M,Nr(M.type,c),y);break e}throw Error(o(306,M,""))}return f;case 0:return M=f.type,E=f.pendingProps,E=f.elementType===M?E:Nr(M,E),o1(c,f,M,E,y);case 1:return M=f.type,E=f.pendingProps,E=f.elementType===M?E:Nr(M,E),vD(c,f,M,E,y);case 3:e:{if(yD(f),c===null)throw Error(o(387));M=f.pendingProps,R=f.memoizedState,E=R.element,r0(c,f),rf(f,M,null,y);var V=f.memoizedState;if(M=V.element,Te&&R.isDehydrated)if(R={element:M,isDehydrated:!1,cache:V.cache,transitions:V.transitions},f.updateQueue.baseState=R,f.memoizedState=R,f.flags&256){E=Error(o(423)),f=xD(c,f,M,y,E);break e}else if(M!==E){E=Error(o(424)),f=xD(c,f,M,y,E);break e}else for(Te&&($i=jc(f.stateNode.containerInfo),Zi=f,_n=!0,Si=null,nu=!1),y=k(f,null,M,y),f.child=y;y;)y.flags=y.flags&-3|4096,y=y.sibling;else{if(Oa(),M===E){f=No(c,f,y);break e}er(c,f,M,y)}f=f.child}return f;case 5:return Nn(f),c===null&&Nh(f),M=f.type,E=f.pendingProps,R=c!==null?c.memoizedProps:null,V=E.children,Me(M,E)?V=null:R!==null&&Me(M,R)&&(f.flags|=32),gD(c,f),er(c,f,V,y),f.child;case 6:return c===null&&Nh(f),null;case 13:return _D(c,f,y);case 4:return gt(f,f.stateNode.containerInfo),M=f.pendingProps,c===null?f.child=L(f,null,M,y):er(c,f,M,y),f.child;case 11:return M=f.type,E=f.pendingProps,E=f.elementType===M?E:Nr(M,E),dD(c,f,M,E,y);case 7:return er(c,f,f.pendingProps,y),f.child;case 8:return er(c,f,f.pendingProps.children,y),f.child;case 12:return er(c,f,f.pendingProps.children,y),f.child;case 10:e:{if(M=f.type._context,E=f.pendingProps,R=f.memoizedProps,V=E.value,i0(f,M,V),R!==null)if(es(R.value,V)){if(R.children===E.children&&!un.current){f=No(c,f,y);break e}}else for(R=f.child,R!==null&&(R.return=f);R!==null;){var Y=R.dependencies;if(Y!==null){V=R.child;for(var pe=Y.firstContext;pe!==null;){if(pe.context===M){if(R.tag===1){pe=ns(-1,y&-y),pe.tag=2;var Ne=R.updateQueue;if(Ne!==null){Ne=Ne.shared;var it=Ne.pending;it===null?pe.next=pe:(pe.next=it.next,it.next=pe),Ne.pending=pe}}R.lanes|=y,pe=R.alternate,pe!==null&&(pe.lanes|=y),Ph(R.return,y,f),Y.lanes|=y;break}pe=pe.next}}else if(R.tag===10)V=R.type===f.type?null:R.child;else if(R.tag===18){if(V=R.return,V===null)throw Error(o(341));V.lanes|=y,Y=V.alternate,Y!==null&&(Y.lanes|=y),Ph(V,y,f),V=R.sibling}else V=R.child;if(V!==null)V.return=R;else for(V=R;V!==null;){if(V===f){V=null;break}if(R=V.sibling,R!==null){R.return=V.return,V=R;break}V=V.return}R=V}er(c,f,E.children,y),f=f.child}return f;case 9:return E=f.type,M=f.pendingProps.children,Da(f,y),E=pr(E),M=M(E),f.flags|=1,er(c,f,M,y),f.child;case 14:return M=f.type,E=Nr(M,f.pendingProps),E=Nr(M.type,E),hD(c,f,M,E,y);case 15:return pD(c,f,f.type,f.pendingProps,y);case 17:return M=f.type,E=f.pendingProps,E=f.elementType===M?E:Nr(M,E),c!==null&&(c.alternate=null,f.alternate=null,f.flags|=2),f.tag=1,Yn(M)?(c=!0,ci(f)):c=!1,Da(f,y),u0(f,M,E),Bh(f,M,E,y),a1(null,f,M,!0,c,y);case 19:return wD(c,f,y);case 22:return mD(c,f,y)}throw Error(o(156,f.tag))};function KD(c,f){return Ba(c,f)}function mj(c,f,y,M){this.tag=c,this.key=y,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=M,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rs(c,f,y,M){return new mj(c,f,y,M)}function R1(c){return c=c.prototype,!(!c||!c.isReactComponent)}function gj(c){if(typeof c=="function")return R1(c)?1:0;if(c!=null){if(c=c.$$typeof,c===S)return 11;if(c===x)return 14}return 2}function Wa(c,f){var y=c.alternate;return y===null?(y=rs(c.tag,f,c.key,c.mode),y.elementType=c.elementType,y.type=c.type,y.stateNode=c.stateNode,y.alternate=c,c.alternate=y):(y.pendingProps=f,y.type=c.type,y.flags=0,y.subtreeFlags=0,y.deletions=null),y.flags=c.flags&14680064,y.childLanes=c.childLanes,y.lanes=c.lanes,y.child=c.child,y.memoizedProps=c.memoizedProps,y.memoizedState=c.memoizedState,y.updateQueue=c.updateQueue,f=c.dependencies,y.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},y.sibling=c.sibling,y.index=c.index,y.ref=c.ref,y}function H0(c,f,y,M,E,R){var V=2;if(M=c,typeof c=="function")R1(c)&&(V=1);else if(typeof c=="string")V=5;else e:switch(c){case d:return fu(y.children,E,R,f);case h:V=8,E|=8;break;case p:return c=rs(12,y,f,E|2),c.elementType=p,c.lanes=R,c;case _:return c=rs(13,y,f,E),c.elementType=_,c.lanes=R,c;case m:return c=rs(19,y,f,E),c.elementType=m,c.lanes=R,c;case w:return G0(y,E,R,f);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case g:V=10;break e;case v:V=9;break e;case S:V=11;break e;case x:V=14;break e;case A:V=16,M=null;break e}throw Error(o(130,c==null?c:typeof c,""))}return f=rs(V,y,f,E),f.elementType=c,f.type=M,f.lanes=R,f}function fu(c,f,y,M){return c=rs(7,c,M,f),c.lanes=y,c}function G0(c,f,y,M){return c=rs(22,c,M,f),c.elementType=w,c.lanes=y,c.stateNode={},c}function P1(c,f,y){return c=rs(6,c,null,f),c.lanes=y,c}function I1(c,f,y){return f=rs(4,c.children!==null?c.children:[],c.key,f),f.lanes=y,f.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},f}function vj(c,f,y,M,E){this.tag=f,this.containerInfo=c,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Et,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Sh(0),this.expirationTimes=Sh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Sh(0),this.identifierPrefix=M,this.onRecoverableError=E,Te&&(this.mutableSourceEagerHydrationData=null)}function YD(c,f,y,M,E,R,V,Y,pe){return c=new vj(c,f,y,Y,pe),f===1?(f=1,R===!0&&(f|=8)):f=0,R=rs(3,null,null,f),c.current=R,R.stateNode=c,R.memoizedState={element:M,isDehydrated:y,cache:null,transitions:null},Ih(R),c}function QD(c){if(!c)return fn;c=c._reactInternals;e:{if(B(c)!==c||c.tag!==1)throw Error(o(170));var f=c;do{switch(f.tag){case 3:f=f.stateNode.context;break e;case 1:if(Yn(f.type)){f=f.stateNode.__reactInternalMemoizedMergedChildContext;break e}}f=f.return}while(f!==null);throw Error(o(171))}if(c.tag===1){var y=c.type;if(Yn(y))return js(c,y,f)}return f}function qD(c){var f=c._reactInternals;if(f===void 0)throw typeof c.render=="function"?Error(o(188)):(c=Object.keys(c).join(","),Error(o(268,c)));return c=X(f),c===null?null:c.stateNode}function ZD(c,f){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var y=c.retryLane;c.retryLane=y!==0&&y=Ne&&R>=It&&E<=it&&V<=xt){c.splice(f,1);break}else if(M!==Ne||y.width!==pe.width||xtV){if(!(R!==It||y.height!==pe.height||itE)){Ne>M&&(pe.width+=Ne-M,pe.x=M),itR&&(pe.height+=It-R,pe.y=R),xty&&(y=V)),V ")+` No matching component was found for: `)+c.join(" > ")}return null},t.getPublicRootInstance=function(c){if(c=c.current,!c.child)return null;switch(c.child.tag){case 5:return Z(c.child.stateNode);default:return c.child.stateNode}},t.injectIntoDevTools=function(c){if(c={bundleType:c.bundleType,version:c.version,rendererPackageName:c.rendererPackageName,rendererConfig:c.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:yj,findFiberByHostInstance:c.findFiberByHostInstance||xj,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined")c=!1;else{var f=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f.isDisabled||!f.supportsFiber)c=!0;else{try{$c=f.inject(c),$r=f}catch(y){}c=!!f.checkDCE}}return c},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(c,f,y,M){if(!W)throw Error(o(363));c=y1(c,f);var E=ze(c,y,M).disconnect;return{disconnect:function(){E()}}},t.registerMutableSourceForHydration=function(c,f){var y=f._getVersion;y=y(f._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[f,y]:c.mutableSourceEagerHydrationData.push(f,y)},t.runWithPriority=function(c,f){var y=Qt;try{return Qt=c,f()}finally{Qt=y}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(c,f,y,M){var E=f.current,R=tr(),V=Ga(E);return y=QD(y),f.context===null?f.context=y:f.pendingContext=y,f=ns(R,V),f.payload={element:c},M=M===void 0?null:M,M!==null&&(f.callback=M),Ys(E,f),c=is(E,V,R),c!==null&&nf(c,E,V),V},t};ZL.exports=h6;var p6=ZL.exports;const m6=cn(p6),_M={},g6=n=>void Object.assign(_M,n);function v6(n,e){function t(d,S,v){var _=S,{args:h=[],attach:p}=_,g=Un(_,["args","attach"]);let m=`${d[0].toUpperCase()}${d.slice(1)}`,x;if(d==="primitive"){if(g.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const A=g.object;x=kc(A,{type:d,root:v,attach:p,primitive:!0})}else{const A=_M[m];if(!A)throw new Error(`R3F: ${m} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(h))throw new Error("R3F: The args prop must be an array!");x=kc(new A(...h),{type:d,root:v,attach:p,memoizedProps:{args:h}})}return x.__r3f.attach===void 0&&(x instanceof Pt?x.__r3f.attach="geometry":x instanceof $n&&(x.__r3f.attach="material")),m!=="inject"&&wM(x,g),x}function i(d,h){let p=!1;if(h){var g,v;(g=h.__r3f)!=null&&g.attach?MM(d,h,h.__r3f.attach):h.isObject3D&&d.isObject3D&&(d.add(h),p=!0),p||(v=d.__r3f)==null||v.objects.push(h),h.__r3f||kc(h,{}),h.__r3f.parent=d,EM(h),zc(h)}}function r(d,h,p){let g=!1;if(h){var v,S;if((v=h.__r3f)!=null&&v.attach)MM(d,h,h.__r3f.attach);else if(h.isObject3D&&d.isObject3D){h.parent=d,h.dispatchEvent({type:"added"}),d.dispatchEvent({type:"childadded",child:h});const _=d.children.filter(x=>x!==h),m=_.indexOf(p);d.children=[..._.slice(0,m),h,..._.slice(m)],g=!0}g||(S=d.__r3f)==null||S.objects.push(h),h.__r3f||kc(h,{}),h.__r3f.parent=d,EM(h),zc(h)}}function s(d,h,p=!1){d&&[...d].forEach(g=>o(h,g,p))}function o(d,h,p){if(h){var g,v,S;if(h.__r3f&&(h.__r3f.parent=null),(g=d.__r3f)!=null&&g.objects&&(d.__r3f.objects=d.__r3f.objects.filter(w=>w!==h)),(v=h.__r3f)!=null&&v.attach)c2(d,h,h.__r3f.attach);else if(h.isObject3D&&d.isObject3D){var _;d.remove(h),(_=h.__r3f)!=null&&_.root&&T6(Xv(h),h)}const x=(S=h.__r3f)==null?void 0:S.primitive,A=!x&&(p===void 0?h.dispose!==null:p);if(!x){var m;s((m=h.__r3f)==null?void 0:m.objects,h,A),s(h.children,h,A)}if(delete h.__r3f,A&&h.dispose&&h.type!=="Scene"){const w=()=>{try{h.dispose()}catch(I){}};typeof IS_REACT_ACT_ENVIRONMENT=="undefined"?xM.unstable_scheduleCallback(xM.unstable_IdlePriority,w):w()}zc(d)}}function a(d,h,p,g){var v;const S=(v=d.__r3f)==null?void 0:v.parent;if(!S)return;const _=t(h,p,d.__r3f.root);if(d.children){for(const m of d.children)m.__r3f&&i(_,m);d.children=d.children.filter(m=>!m.__r3f)}d.__r3f.objects.forEach(m=>i(_,m)),d.__r3f.objects=[],d.__r3f.autoRemovedBeforeAppend||o(S,d),_.parent&&(_.__r3f.autoRemovedBeforeAppend=!0),i(S,_),_.raycast&&_.__r3f.eventCount&&Xv(_).getState().internal.interaction.push(_),[g,g.alternate].forEach(m=>{m!==null&&(m.stateNode=_,m.ref&&(typeof m.ref=="function"?m.ref(_):m.ref.current=_))})}const l=()=>{};return{reconciler:m6({createInstance:t,removeChild:o,appendChild:i,appendInitialChild:i,insertBefore:r,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(d,h)=>{if(!h)return;const p=d.getState().scene;p.__r3f&&(p.__r3f.root=d,i(p,h))},removeChildFromContainer:(d,h)=>{h&&o(d.getState().scene,h)},insertInContainerBefore:(d,h,p)=>{if(!h||!p)return;const g=d.getState().scene;g.__r3f&&r(g,h,p)},getRootHostContext:()=>null,getChildHostContext:d=>d,finalizeInitialChildren(d){var h;return!!((h=d==null?void 0:d.__r3f)!=null?h:{}).handlers},prepareUpdate(d,h,p,g){var v;if(((v=d==null?void 0:d.__r3f)!=null?v:{}).primitive&&g.object&&g.object!==d)return[!0];{const _=g,{args:x=[],children:A}=_,w=Un(_,["args","children"]),m=p,{args:I=[],children:P}=m,D=Un(m,["args","children"]);if(!Array.isArray(x))throw new Error("R3F: the args prop must be an array!");if(x.some((B,T)=>B!==I[T]))return[!0];const N=f2(d,w,D,!0);return N.changes.length?[!1,N]:null}},commitUpdate(d,[h,p],g,v,S,_){h?a(d,g,S,_):wM(d,p)},commitMount(d,h,p,g){var v;const S=(v=d.__r3f)!=null?v:{};d.raycast&&S.handlers&&S.eventCount&&Xv(d).getState().internal.interaction.push(d)},getPublicInstance:d=>d,prepareForCommit:()=>null,preparePortalMount:d=>kc(d.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(d){var h;const{attach:p,parent:g}=(h=d.__r3f)!=null?h:{};p&&g&&c2(g,d,p),d.isObject3D&&(d.visible=!1),zc(d)},unhideInstance(d,h){var p;const{attach:g,parent:v}=(p=d.__r3f)!=null?p:{};g&&v&&MM(v,d,g),(d.isObject3D&&h.visible==null||h.visible)&&(d.visible=!0),zc(d)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Oc.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance!="undefined"&&yn.fun(performance.now)?performance.now:yn.fun(Date.now)?Date.now:()=>0,scheduleTimeout:yn.fun(setTimeout)?setTimeout:void 0,cancelTimeout:yn.fun(clearTimeout)?clearTimeout:void 0}),applyProps:wM}}var t2,n2;const AM=n=>"colorSpace"in n||"outputColorSpace"in n,i2=()=>{var n;return(n=_M.ColorManagement)!=null?n:null},r2=n=>n&&n.isOrthographicCamera,y6=n=>n&&n.hasOwnProperty("current"),Wv=typeof window!="undefined"&&((t2=window.document)!=null&&t2.createElement||((n2=window.navigator)==null?void 0:n2.product)==="ReactNative")?me.useLayoutEffect:me.useEffect;function x6(n){const e=me.useRef(n);return Wv(()=>void(e.current=n),[n]),e}function _6({set:n}){return Wv(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}class s2 extends me.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}s2.getDerivedStateFromError=()=>({error:!0});const o2="__default",a2=new Map,A6=n=>n&&!!n.memoized&&!!n.changes;function l2(n){var e;const t=typeof window!="undefined"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(n)?Math.min(Math.max(n[0],t),n[1]):n}const mh=n=>{var e;return(e=n.__r3f)==null?void 0:e.root.getState()};function Xv(n){let e=n.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const yn={obj:n=>n===Object(n)&&!yn.arr(n)&&typeof n!="function",fun:n=>typeof n=="function",str:n=>typeof n=="string",num:n=>typeof n=="number",boo:n=>typeof n=="boolean",und:n=>n===void 0,arr:n=>Array.isArray(n),equ(n,e,{arrays:t="shallow",objects:i="reference",strict:r=!0}={}){if(typeof n!=typeof e||!!n!=!!e)return!1;if(yn.str(n)||yn.num(n)||yn.boo(n))return n===e;const s=yn.obj(n);if(s&&i==="reference")return n===e;const o=yn.arr(n);if(o&&t==="reference")return n===e;if((o||s)&&n===e)return!0;let a;for(a in n)if(!(a in e))return!1;if(s&&t==="shallow"&&i==="shallow"){for(a in r?e:n)if(!yn.equ(n[a],e[a],{strict:r,objects:"reference"}))return!1}else for(a in r?e:n)if(n[a]!==e[a])return!1;if(yn.und(a)){if(o&&n.length===0&&e.length===0||s&&Object.keys(n).length===0&&Object.keys(e).length===0)return!0;if(n!==e)return!1}return!0}};function S6(n){const e={nodes:{},materials:{}};return n&&n.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material)}),e}function M6(n){n.dispose&&n.type!=="Scene"&&n.dispose();for(const e in n)e.dispose==null||e.dispose(),delete n[e]}function kc(n,e){const t=n;return t.__r3f=ye({type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null},e),n}function SM(n,e){let t=n;if(e.includes("-")){const i=e.split("-"),r=i.pop();return t=i.reduce((s,o)=>s[o],n),{target:t,key:r}}else return{target:t,key:e}}const u2=/-\d+$/;function MM(n,e,t){if(yn.str(t)){if(u2.test(t)){const s=t.replace(u2,""),{target:o,key:a}=SM(n,s);Array.isArray(o[a])||(o[a]=[])}const{target:i,key:r}=SM(n,t);e.__r3f.previousAttach=i[r],i[r]=e}else e.__r3f.previousAttach=t(n,e)}function c2(n,e,t){var i,r;if(yn.str(t)){const{target:s,key:o}=SM(n,t),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(i=e.__r3f)==null||i.previousAttach==null||i.previousAttach(n,e);(r=e.__r3f)==null||delete r.previousAttach}function f2(n,d,p={},u=!1){var h=d,{children:e,key:t,ref:i}=h,r=Un(h,["children","key","ref"]);var g=p,{children:s,key:o,ref:a}=g,l=Un(g,["children","key","ref"]);const v=n.__r3f,S=Object.entries(r),_=[];if(u){const x=Object.keys(l);for(let A=0;A{var w;if((w=n.__r3f)!=null&&w.primitive&&x==="object"||yn.equ(A,l[x]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(x))return _.push([x,A,!0,[]]);let I=[];x.includes("-")&&(I=x.split("-")),_.push([x,A,!1,I]);for(const P in r){const D=r[P];P.startsWith(`${x}-`)&&_.push([P,D,!1,P.split("-")])}});const m=ye({},r);return v!=null&&v.memoizedProps&&v!=null&&v.memoizedProps.args&&(m.args=v.memoizedProps.args),v!=null&&v.memoizedProps&&v!=null&&v.memoizedProps.attach&&(m.attach=v.memoizedProps.attach),{memoized:m,changes:_}}const w6=typeof process!="undefined"&&!1;function wM(n,e){var t;const i=n.__r3f,r=i==null?void 0:i.root,s=r==null||r.getState==null?void 0:r.getState(),{memoized:o,changes:a}=A6(e)?e:f2(n,e),l=i==null?void 0:i.eventCount;n.__r3f&&(n.__r3f.memoizedProps=o);for(let d=0;dm[x],n),!(_&&_.set))){const[m,...x]=v.reverse();S=x.reverse().reduce((A,w)=>A[w],n),h=m}if(p===o2+"remove")if(S.constructor){let m=a2.get(S.constructor);m||(m=new S.constructor,a2.set(S.constructor,m)),p=m[h]}else p=0;if(g&&i)p?i.handlers[h]=p:delete i.handlers[h],i.eventCount=Object.keys(i.handlers).length;else if(_&&_.set&&(_.copy||_ instanceof Cl)){if(Array.isArray(p))_.fromArray?_.fromArray(p):_.set(...p);else if(_.copy&&p&&p.constructor&&(w6?_.constructor.name===p.constructor.name:_.constructor===p.constructor))_.copy(p);else if(p!==void 0){const m=_ instanceof ke;!m&&_.setScalar?_.setScalar(p):_ instanceof Cl&&p instanceof Cl?_.mask=p.mask:_.set(p),!i2()&&s&&!s.linear&&m&&_.convertSRGBToLinear()}}else if(S[h]=p,S[h]instanceof Mn&&S[h].format===Ri&&S[h].type===vs&&s){const m=S[h];AM(m)&&AM(s.gl)?m.colorSpace=s.gl.outputColorSpace:m.encoding=s.gl.outputEncoding}zc(n)}if(i&&i.parent&&n.raycast&&l!==i.eventCount){const d=Xv(n).getState().internal,h=d.interaction.indexOf(n);h>-1&&d.interaction.splice(h,1),i.eventCount&&d.interaction.push(n)}return!(a.length===1&&a[0][0]==="onUpdate")&&a.length&&(t=n.__r3f)!=null&&t.parent&&EM(n),n}function zc(n){var e,t;const i=(e=n.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();i&&i.internal.frames===0&&i.invalidate()}function EM(n){n.onUpdate==null||n.onUpdate(n)}function E6(n,e){n.manual||(r2(n)?(n.left=e.width/-2,n.right=e.width/2,n.top=e.height/2,n.bottom=e.height/-2):n.aspect=e.width/e.height,n.updateProjectionMatrix(),n.updateMatrixWorld())}function jv(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function C6(){var n;const e=typeof self!="undefined"&&self||typeof window!="undefined"&&window;if(!e)return Oc.DefaultEventPriority;switch((n=e.event)==null?void 0:n.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Oc.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Oc.ContinuousEventPriority;default:return Oc.DefaultEventPriority}}function d2(n,e,t,i){const r=t.get(e);r&&(t.delete(e),t.size===0&&(n.delete(i),r.target.releasePointerCapture(i)))}function T6(n,e){const{internal:t}=n.getState();t.interaction=t.interaction.filter(i=>i!==e),t.initialHits=t.initialHits.filter(i=>i!==e),t.hovered.forEach((i,r)=>{(i.eventObject===e||i.object===e)&&t.hovered.delete(r)}),t.capturedMap.forEach((i,r)=>{d2(t.capturedMap,e,i,r)})}function b6(n){function e(l){const{internal:u}=n.getState(),d=l.offsetX-u.initialClick[0],h=l.offsetY-u.initialClick[1];return Math.round(Math.sqrt(d*d+h*h))}function t(l){return l.filter(u=>["Move","Over","Enter","Out","Leave"].some(d=>{var h;return(h=u.__r3f)==null?void 0:h.handlers["onPointer"+d]}))}function i(l,u){const d=n.getState(),h=new Set,p=[],g=u?u(d.internal.interaction):d.internal.interaction;for(let m=0;m{const A=mh(m.object),w=mh(x.object);return!A||!w?m.distance-x.distance:w.events.priority-A.events.priority||m.distance-x.distance}).filter(m=>{const x=jv(m);return h.has(x)?!1:(h.add(x),!0)});d.events.filter&&(S=d.events.filter(S,d));for(const m of S){let x=m.object;for(;x;){var _;(_=x.__r3f)!=null&&_.eventCount&&p.push(wt(ye({},m),{eventObject:x})),x=x.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let m of d.internal.capturedMap.get(l.pointerId).values())h.has(jv(m.intersection))||p.push(m.intersection);return p}function r(l,u,d,h){const p=n.getState();if(l.length){const g={stopped:!1};for(const v of l){const S=mh(v.object)||p,{raycaster:_,pointer:m,camera:x,internal:A}=S,w=new G(m.x,m.y,0).unproject(x),I=T=>{var F,X;return(F=(X=A.capturedMap.get(T))==null?void 0:X.has(v.eventObject))!=null?F:!1},P=T=>{const F={intersection:v,target:u.target};A.capturedMap.has(T)?A.capturedMap.get(T).set(v.eventObject,F):A.capturedMap.set(T,new Map([[v.eventObject,F]])),u.target.setPointerCapture(T)},D=T=>{const F=A.capturedMap.get(T);F&&d2(A.capturedMap,v.eventObject,F,T)};let N={};for(let T in u){let F=u[T];typeof F!="function"&&(N[T]=F)}let B=wt(ye(ye({},v),N),{pointer:m,intersections:l,stopped:g.stopped,delta:d,unprojectedPoint:w,ray:_.ray,camera:x,stopPropagation(){const T="pointerId"in u&&A.capturedMap.get(u.pointerId);if((!T||T.has(v.eventObject))&&(B.stopped=g.stopped=!0,A.hovered.size&&Array.from(A.hovered.values()).find(F=>F.eventObject===v.eventObject))){const F=l.slice(0,l.indexOf(v));s([...F,v])}},target:{hasPointerCapture:I,setPointerCapture:P,releasePointerCapture:D},currentTarget:{hasPointerCapture:I,setPointerCapture:P,releasePointerCapture:D},nativeEvent:u});if(h(B),g.stopped===!0)break}}return l}function s(l){const{internal:u}=n.getState();for(const d of u.hovered.values())if(!l.length||!l.find(h=>h.object===d.object&&h.index===d.index&&h.instanceId===d.instanceId)){const p=d.eventObject.__r3f,g=p==null?void 0:p.handlers;if(u.hovered.delete(jv(d)),p!=null&&p.eventCount){const v=wt(ye({},d),{intersections:l});g.onPointerOut==null||g.onPointerOut(v),g.onPointerLeave==null||g.onPointerLeave(v)}}}function o(l,u){for(let d=0;ds([]);case"onLostPointerCapture":return u=>{const{internal:d}=n.getState();"pointerId"in u&&d.capturedMap.has(u.pointerId)&&requestAnimationFrame(()=>{d.capturedMap.has(u.pointerId)&&(d.capturedMap.delete(u.pointerId),s([]))})}}return function(d){const{onPointerMissed:h,internal:p}=n.getState();p.lastEvent.current=d;const g=l==="onPointerMove",v=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",_=i(d,g?t:void 0),m=v?e(d):0;l==="onPointerDown"&&(p.initialClick=[d.offsetX,d.offsetY],p.initialHits=_.map(A=>A.eventObject)),v&&!_.length&&m<=2&&(o(d,p.interaction),h&&h(d)),g&&s(_);function x(A){const w=A.eventObject,I=w.__r3f,P=I==null?void 0:I.handlers;if(I!=null&&I.eventCount)if(g){if(P.onPointerOver||P.onPointerEnter||P.onPointerOut||P.onPointerLeave){const D=jv(A),N=p.hovered.get(D);N?N.stopped&&A.stopPropagation():(p.hovered.set(D,A),P.onPointerOver==null||P.onPointerOver(A),P.onPointerEnter==null||P.onPointerEnter(A))}P.onPointerMove==null||P.onPointerMove(A)}else{const D=P[l];D?(!v||p.initialHits.includes(w))&&(o(d,p.interaction.filter(N=>!p.initialHits.includes(N))),D(A)):v&&p.initialHits.includes(w)&&o(d,p.interaction.filter(N=>!p.initialHits.includes(N)))}}r(_,d,m,x)}}return{handlePointer:a}}const h2=n=>!!(n!=null&&n.render),R6=me.createContext(null),P6=(n,e)=>{const t=l6((a,l)=>{const u=new G,d=new G,h=new G;function p(m=l().camera,x=d,A=l().size){const{width:w,height:I,top:P,left:D}=A,N=w/I;x instanceof G?h.copy(x):h.set(...x);const B=m.getWorldPosition(u).distanceTo(h);if(r2(m))return{width:w/m.zoom,height:I/m.zoom,top:P,left:D,factor:1,distance:B,aspect:N};{const T=m.fov*Math.PI/180,F=2*Math.tan(T/2)*B,X=F*(w/I);return{width:X,height:F,top:P,left:D,factor:w/X,distance:B,aspect:N}}}let g;const v=m=>a(x=>({performance:wt(ye({},x.performance),{current:m})})),S=new Ae;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(m=1)=>n(l(),m),advance:(m,x)=>e(m,x,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new rM,pointer:S,mouse:S,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const m=l();g&&clearTimeout(g),m.performance.current!==m.performance.min&&v(m.performance.min),g=setTimeout(()=>v(l().performance.max),m.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:p},setEvents:m=>a(x=>wt(ye({},x),{events:ye(ye({},x.events),m)})),setSize:(m,x,A,w,I)=>{const P=l().camera,D={width:m,height:x,top:w||0,left:I||0,updateStyle:A};a(N=>({size:D,viewport:ye(ye({},N.viewport),p(P,d,D))}))},setDpr:m=>a(x=>{const A=l2(m);return{viewport:wt(ye({},x.viewport),{dpr:A,initialDpr:x.viewport.initialDpr||A})}}),setFrameloop:(m="always")=>{const x=l().clock;x.stop(),x.elapsedTime=0,m!=="never"&&(x.start(),x.elapsedTime=0),a(()=>({frameloop:m}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:me.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(m,x,A)=>{const w=l().internal;return w.priority=w.priority+(x>0?1:0),w.subscribers.push({ref:m,priority:x,store:A}),w.subscribers=w.subscribers.sort((I,P)=>I.priority-P.priority),()=>{const I=l().internal;I!=null&&I.subscribers&&(I.priority=I.priority-(x>0?1:0),I.subscribers=I.subscribers.filter(P=>P.ref!==m))}}}}}),i=t.getState();let r=i.size,s=i.viewport.dpr,o=i.camera;return t.subscribe(()=>{const{camera:a,size:l,viewport:u,gl:d,set:h}=t.getState();if(l.width!==r.width||l.height!==r.height||u.dpr!==s){var p;r=l,s=u.dpr,E6(a,l),d.setPixelRatio(u.dpr);const g=(p=l.updateStyle)!=null?p:typeof HTMLCanvasElement!="undefined"&&d.domElement instanceof HTMLCanvasElement;d.setSize(l.width,l.height,g)}a!==o&&(o=a,h(g=>({viewport:ye(ye({},g.viewport),g.viewport.getCurrentViewport(a))})))}),t.subscribe(a=>n(a)),t};let Jv,I6=new Set,B6=new Set,L6=new Set;function CM(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function gh(n,e){switch(n){case"before":return CM(I6,e);case"after":return CM(B6,e);case"tail":return CM(L6,e)}}let TM,bM;function RM(n,e,t){let i=e.clock.getDelta();for(e.frameloop==="never"&&typeof n=="number"&&(i=n-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=n),TM=e.internal.subscribers,Jv=0;Jv0)&&!((d=s.gl.xr)!=null&&d.isPresenting)&&(i+=RM(u,s))}if(t=!1,gh("after",u),i===0)return gh("tail",u),e=!1,cancelAnimationFrame(r)}function a(u,d=1){var h;if(!u)return n.forEach(p=>a(p.store.getState(),d));(h=u.gl.xr)!=null&&h.isPresenting||!u.internal.active||u.frameloop==="never"||(d>1?u.internal.frames=Math.min(60,u.internal.frames+d):t?u.internal.frames=2:u.internal.frames=1,e||(e=!0,requestAnimationFrame(o)))}function l(u,d=!0,h,p){if(d&&gh("before",u),h)RM(u,h,p);else for(const g of n.values())RM(u,g.store.getState());d&&gh("after",u)}return{loop:o,invalidate:a,advance:l}}const p2=new WeakMap;function m2(n,e){return function(t,...i){let r=p2.get(t);return r||(r=new t,p2.set(t,r)),n&&n(r),Promise.all(i.map(s=>new Promise((o,a)=>r.load(s,l=>{l.scene&&Object.assign(l,S6(l.scene)),o(l)},e,l=>a(new Error(`Could not load ${s}: ${l==null?void 0:l.message}`))))))}}function vh(n,e,t,i){const r=Array.isArray(e)?e:[e],s=c6(m2(t,i),[n,...r],{equal:yn.equ});return Array.isArray(e)?s:s[0]}vh.preload=function(n,e,t){const i=Array.isArray(e)?e:[e];return f6(m2(t),[n,...i])},vh.clear=function(n,e){const t=Array.isArray(e)?e:[e];return d6([n,...t])};const Hc=new Map,{invalidate:g2,advance:v2}=D6(Hc),{reconciler:Kv,applyProps:Gc}=v6(Hc,C6),Vc={objects:"shallow",strict:!1},F6=(n,e)=>{const t=typeof n=="function"?n(e):n;return h2(t)?t:new oB(ye({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0},n))};function N6(n,e){const t=typeof HTMLCanvasElement!="undefined"&&n instanceof HTMLCanvasElement;if(e){const{width:i,height:r,top:s,left:o,updateStyle:a=t}=e;return{width:i,height:r,top:s,left:o,updateStyle:a}}else if(typeof HTMLCanvasElement!="undefined"&&n instanceof HTMLCanvasElement&&n.parentElement){const{width:i,height:r,top:s,left:o}=n.parentElement.getBoundingClientRect();return{width:i,height:r,top:s,left:o,updateStyle:t}}else if(typeof OffscreenCanvas!="undefined"&&n instanceof OffscreenCanvas)return{width:n.width,height:n.height,top:0,left:0,updateStyle:t};return{width:0,height:0,top:0,left:0}}function U6(n){const e=Hc.get(n),t=e==null?void 0:e.fiber,i=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,s=i||P6(g2,v2),o=t||Kv.createContainer(s,Oc.ConcurrentRoot,null,!1,null,"",r,null);e||Hc.set(n,{fiber:o,store:s});let a,l=!1,u;return{configure(d={}){let{gl:h,size:p,scene:g,events:v,onCreated:S,shadows:_=!1,linear:m=!1,flat:x=!1,legacy:A=!1,orthographic:w=!1,frameloop:I="always",dpr:P=[1,2],performance:D,raycaster:N,camera:B,onPointerMissed:T}=d,F=s.getState(),X=F.gl;F.gl||F.set({gl:X=F6(h,n)});let J=F.raycaster;J||F.set({raycaster:J=new RL});const ne=N||{},{params:Q}=ne,ie=Un(ne,["params"]);if(yn.equ(ie,J,Vc)||Gc(J,ye({},ie)),yn.equ(Q,J.params,Vc)||Gc(J,{params:ye(ye({},J.params),Q)}),!F.camera||F.camera===u&&!yn.equ(u,B,Vc)){u=B;const de=B instanceof Wd,Ce=de?B:w?new Ec(0,0,0,0,.1,1e3):new ai(75,0,.1,1e3);de||(Ce.position.z=5,B&&(Gc(Ce,B),("aspect"in B||"left"in B||"right"in B||"bottom"in B||"top"in B)&&(Ce.manual=!0,Ce.updateProjectionMatrix())),!F.camera&&!(B!=null&&B.rotation)&&Ce.lookAt(0,0,0)),F.set({camera:Ce}),J.camera=Ce}if(!F.scene){let de;g instanceof Qg?de=g:(de=new Qg,g&&Gc(de,g)),F.set({scene:kc(de)})}if(!F.xr){var Z;const de=(re,Me)=>{const Ie=s.getState();Ie.frameloop!=="never"&&v2(re,!0,Ie,Me)},Ce=()=>{const re=s.getState();re.gl.xr.enabled=re.gl.xr.isPresenting,re.gl.xr.setAnimationLoop(re.gl.xr.isPresenting?de:null),re.gl.xr.isPresenting||g2(re)},ot={connect(){const re=s.getState().gl;re.xr.addEventListener("sessionstart",Ce),re.xr.addEventListener("sessionend",Ce)},disconnect(){const re=s.getState().gl;re.xr.removeEventListener("sessionstart",Ce),re.xr.removeEventListener("sessionend",Ce)}};typeof((Z=X.xr)==null?void 0:Z.addEventListener)=="function"&&ot.connect(),F.set({xr:ot})}if(X.shadowMap){const de=X.shadowMap.enabled,Ce=X.shadowMap.type;if(X.shadowMap.enabled=!!_,yn.boo(_))X.shadowMap.type=yd;else if(yn.str(_)){var fe;const ot={basic:oP,percentage:Um,soft:yd,variance:ms};X.shadowMap.type=(fe=ot[_])!=null?fe:yd}else yn.obj(_)&&Object.assign(X.shadowMap,_);(de!==X.shadowMap.enabled||Ce!==X.shadowMap.type)&&(X.shadowMap.needsUpdate=!0)}const z=i2();z&&("enabled"in z?z.enabled=!A:"legacyMode"in z&&(z.legacyMode=A)),l||Gc(X,{outputEncoding:m?3e3:3001,toneMapping:x?Hs:MA}),F.legacy!==A&&F.set(()=>({legacy:A})),F.linear!==m&&F.set(()=>({linear:m})),F.flat!==x&&F.set(()=>({flat:x})),h&&!yn.fun(h)&&!h2(h)&&!yn.equ(h,X,Vc)&&Gc(X,h),v&&!F.events.handlers&&F.set({events:v(s)});const $=N6(n,p);return yn.equ($,F.size,Vc)||F.setSize($.width,$.height,$.updateStyle,$.top,$.left),P&&F.viewport.dpr!==l2(P)&&F.setDpr(P),F.frameloop!==I&&F.setFrameloop(I),F.onPointerMissed||F.set({onPointerMissed:T}),D&&!yn.equ(D,F.performance,Vc)&&F.set(de=>({performance:ye(ye({},de.performance),D)})),a=S,l=!0,this},render(d){return l||this.configure(),Kv.updateContainer(ge.jsx(O6,{store:s,children:d,onCreated:a,rootElement:n}),o,null,()=>{}),s},unmount(){y2(n)}}}function O6({store:n,children:e,onCreated:t,rootElement:i}){return Wv(()=>{const r=n.getState();r.set(s=>({internal:wt(ye({},s.internal),{active:!0})})),t&&t(r),n.getState().events.connected||r.events.connect==null||r.events.connect(i)},[]),ge.jsx(R6.Provider,{value:n,children:e})}function y2(n,e){const t=Hc.get(n),i=t==null?void 0:t.fiber;if(i){const r=t==null?void 0:t.store.getState();r&&(r.internal.active=!1),Kv.updateContainer(null,i,null,()=>{r&&setTimeout(()=>{try{var s,o,a,l;r.events.disconnect==null||r.events.disconnect(),(s=r.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=r.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=r.gl)!=null&&l.xr&&r.xr.disconnect(),M6(r),Hc.delete(n)}catch(u){}},500)})}}Kv.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:me.version});const PM={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function k6(n){const{handlePointer:e}=b6(n);return{priority:1,enabled:!0,compute(t,i,r){i.pointer.set(t.offsetX/i.size.width*2-1,-(t.offsetY/i.size.height)*2+1),i.raycaster.setFromCamera(i.pointer,i.camera)},connected:void 0,handlers:Object.keys(PM).reduce((t,i)=>wt(ye({},t),{[i]:e(i)}),{}),update:()=>{var t;const{events:i,internal:r}=n.getState();(t=r.lastEvent)!=null&&t.current&&i.handlers&&i.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{var i;const{set:r,events:s}=n.getState();s.disconnect==null||s.disconnect(),r(o=>({events:wt(ye({},o.events),{connected:t})})),Object.entries((i=s.handlers)!=null?i:[]).forEach(([o,a])=>{const[l,u]=PM[o];t.addEventListener(l,a,{passive:u})})},disconnect:()=>{const{set:t,events:i}=n.getState();if(i.connected){var r;Object.entries((r=i.handlers)!=null?r:[]).forEach(([s,o])=>{if(i&&i.connected instanceof HTMLElement){const[a]=PM[s];i.connected.removeEventListener(a,o)}}),t(s=>({events:wt(ye({},s.events),{connected:void 0})}))}}}}function IM(n,e,t){var i,r,s,o,a;e==null&&(e=100);function l(){var d=Date.now()-o;d=0?i=setTimeout(l,e-d):(i=null,t||(a=n.apply(s,r),s=r=null))}var u=function(){s=this,r=arguments,o=Date.now();var d=t&&!i;return i||(i=setTimeout(l,e)),d&&(a=n.apply(s,r),s=r=null),a};return u.clear=function(){i&&(clearTimeout(i),i=null)},u.flush=function(){i&&(a=n.apply(s,r),s=r=null,clearTimeout(i),i=null)},u}IM.debounce=IM;var z6=IM;const x2=cn(z6);var H6=Object.defineProperty,G6=Object.defineProperties,V6=Object.getOwnPropertyDescriptors,_2=Object.getOwnPropertySymbols,W6=Object.prototype.hasOwnProperty,X6=Object.prototype.propertyIsEnumerable,A2=(n,e,t)=>e in n?H6(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,S2=(n,e)=>{for(var t in e||(e={}))W6.call(e,t)&&A2(n,t,e[t]);if(_2)for(var t of _2(e))X6.call(e,t)&&A2(n,t,e[t]);return n},j6=(n,e)=>G6(n,V6(e)),M2,w2;typeof window!="undefined"&&((M2=window.document)!=null&&M2.createElement||((w2=window.navigator)==null?void 0:w2.product)==="ReactNative")?me.useLayoutEffect:me.useEffect;function E2(n,e,t){if(!n)return;if(t(n)===!0)return n;let i=n.child;for(;i;){const r=E2(i,e,t);if(r)return r;i=i.sibling}}function C2(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch(e){return n}}const T2=console.error;console.error=function(){const n=[...arguments].join("");if(n!=null&&n.startsWith("Warning:")&&n.includes("useContext")){console.error=T2;return}return T2.apply(this,arguments)};const BM=C2(me.createContext(null));class b2 extends me.Component{render(){return me.createElement(BM.Provider,{value:this._reactInternals},this.props.children)}}function J6(){const n=me.useContext(BM);if(n===null)throw new Error("its-fine: useFiber must be called within a !");const e=me.useId();return me.useMemo(()=>{for(const i of[n,n==null?void 0:n.alternate]){if(!i)continue;const r=E2(i,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(r)return r}},[n,e])}function K6(){const n=J6(),[e]=me.useState(()=>new Map);e.clear();let t=n;for(;t;){if(t.type&&typeof t.type=="object"){const r=t.type._context===void 0&&t.type.Provider===t.type?t.type:t.type._context;r&&r!==BM&&!e.has(r)&&e.set(r,me.useContext(C2(r)))}t=t.return}return e}function Y6(){const n=K6();return me.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>i=>me.createElement(e,null,me.createElement(t.Provider,j6(S2({},i),{value:n.get(t)}))),e=>me.createElement(b2,S2({},e))),[n])}function Q6({debounce:n,scroll:e,polyfill:t,offsetSize:i}={debounce:0,scroll:!1,offsetSize:!1}){const r=t||typeof window!="undefined"&&window.ResizeObserver,[s,o]=me.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0});if(!r)return s.width=1280,s.height=800,[()=>{},s,()=>{}];const a=me.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),l=n?typeof n=="number"?n:n.scroll:null,u=n?typeof n=="number"?n:n.resize:null,d=me.useRef(!1);me.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[h,p,g]=me.useMemo(()=>{const m=()=>{if(!a.current.element)return;const{left:x,top:A,width:w,height:I,bottom:P,right:D,x:N,y:B}=a.current.element.getBoundingClientRect(),T={left:x,top:A,width:w,height:I,bottom:P,right:D,x:N,y:B};a.current.element instanceof HTMLElement&&i&&(T.height=a.current.element.offsetHeight,T.width=a.current.element.offsetWidth),Object.freeze(T),d.current&&!eX(a.current.lastBounds,T)&&o(a.current.lastBounds=T)};return[m,u?x2(m,u):m,l?x2(m,l):m]},[o,i,l,u]);function v(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(m=>m.removeEventListener("scroll",g,!0)),a.current.scrollContainers=null),a.current.resizeObserver&&(a.current.resizeObserver.disconnect(),a.current.resizeObserver=null),a.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",a.current.orientationHandler))}function S(){var m;a.current.element&&(a.current.resizeObserver=new r(p),(m=a.current.resizeObserver)==null||m.observe(a.current.element),e&&a.current.scrollContainers&&a.current.scrollContainers.forEach(x=>x.addEventListener("scroll",g,{capture:!0,passive:!0})),a.current.orientationHandler=()=>{g()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",a.current.orientationHandler))}const _=m=>{!m||m===a.current.element||(v(),a.current.element=m,a.current.scrollContainers=R2(m),S())};return Z6(g,!!e),q6(p),me.useEffect(()=>{v(),S()},[e,g,p]),me.useEffect(()=>v,[]),[_,s,h]}function q6(n){me.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function Z6(n,e){me.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function R2(n){const e=[];if(!n||n===document.body)return e;const{overflow:t,overflowX:i,overflowY:r}=window.getComputedStyle(n);return[t,i,r].some(s=>s==="auto"||s==="scroll")&&e.push(n),[...e,...R2(n.parentElement)]}const $6=["x","y","top","bottom","left","right","width","height"],eX=(n,e)=>$6.every(t=>n[t]===e[t]),tX=me.forwardRef(function(N,D){var B=N,{children:e,fallback:t,resize:i,style:r,gl:s,events:o=k6,eventSource:a,eventPrefix:l,shadows:u,linear:d,flat:h,legacy:p,orthographic:g,frameloop:v,dpr:S,performance:_,raycaster:m,camera:x,scene:A,onPointerMissed:w,onCreated:I}=B,P=Un(B,["children","fallback","resize","style","gl","events","eventSource","eventPrefix","shadows","linear","flat","legacy","orthographic","frameloop","dpr","performance","raycaster","camera","scene","onPointerMissed","onCreated"]);me.useMemo(()=>g6(QW),[]);const T=Y6(),[F,X]=Q6(ye({scroll:!0,debounce:{scroll:50,resize:0}},i)),J=me.useRef(null),Q=me.useRef(null);me.useImperativeHandle(D,()=>J.current);const ie=x6(w),[Z,fe]=me.useState(!1),[z,$]=me.useState(!1);if(Z)throw Z;if(z)throw z;const ne=me.useRef(null);Wv(()=>{const Ce=J.current;X.width>0&&X.height>0&&Ce&&(ne.current||(ne.current=U6(Ce)),ne.current.configure({gl:s,events:o,shadows:u,linear:d,flat:h,legacy:p,orthographic:g,frameloop:v,dpr:S,performance:_,raycaster:m,camera:x,scene:A,size:X,onPointerMissed:(...ot)=>ie.current==null?void 0:ie.current(...ot),onCreated:ot=>{ot.events.connect==null||ot.events.connect(a?y6(a)?a.current:a:Q.current),l&&ot.setEvents({compute:(re,Me)=>{const Ie=re[l+"X"],Be=re[l+"Y"];Me.pointer.set(Ie/Me.size.width*2-1,-(Be/Me.size.height)*2+1),Me.raycaster.setFromCamera(Me.pointer,Me.camera)}}),I==null||I(ot)}}),ne.current.render(ge.jsx(T,{children:ge.jsx(s2,{set:$,children:ge.jsx(me.Suspense,{fallback:ge.jsx(_6,{set:fe}),children:e})})})))}),me.useEffect(()=>{const Ce=J.current;if(Ce)return()=>y2(Ce)},[]);const de=a?"none":"auto";return ge.jsx("div",wt(ye({ref:Q,style:ye({position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:de},r)},P),{children:ge.jsx("div",{ref:F,style:{width:"100%",height:"100%"},children:ge.jsx("canvas",{ref:J,style:{display:"block"},children:t})})}))}),nX=me.forwardRef(function(e,t){return ge.jsx(b2,{children:ge.jsx(tX,wt(ye({},e),{ref:t}))})}),iX=parseInt(vd.replace(/\D+/g,""));function P2(n,e){if(e===WP)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),n;if(e===Sg||e===FA){let t=n.getIndex();if(t===null){const o=[],a=n.getAttribute("position");if(a!==void 0){for(let l=0;l=2.0 are supported."));return}const l=new UX(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u=0&&a[d]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}l.setExtensions(o),l.setPlugins(a),l.parse(i,r)}parseAsync(e,t){const i=this;return new Promise(function(r,s){i.parse(e,t,r,s)})}}function sX(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const Wt={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class oX{constructor(e){this.parser=e,this.name=Wt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class _X{constructor(e){this.parser=e,this.name=Wt.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const u=i.options.manager.getHandler(a.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class AX{constructor(e){this.parser=e,this.name=Wt.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const u=i.options.manager.getHandler(a.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class SX{constructor(e){this.name=Wt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const r=i.extensions[this.name],s=this.parser.getDependency("buffer",r.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=r.byteOffset||0,u=r.byteLength||0,d=r.count,h=r.byteStride,p=new Uint8Array(a,l,u);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(d,h,p,r.mode,r.filter).then(function(g){return g.buffer}):o.ready.then(function(){const g=new ArrayBuffer(d*h);return o.decodeGltfBuffer(new Uint8Array(g),d,h,p,r.mode,r.filter),g})})}else return null}}class MX{constructor(e){this.name=Wt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const r=t.meshes[i.mesh];for(const u of r.primitives)if(u.mode!==Zr.TRIANGLES&&u.mode!==Zr.TRIANGLE_STRIP&&u.mode!==Zr.TRIANGLE_FAN&&u.mode!==void 0)return null;const o=i.extensions[this.name].attributes,a=[],l={};for(const u in o)a.push(this.parser.getDependency("accessor",o[u]).then(d=>(l[u]=d,l[u])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(u=>{const d=u.pop(),h=d.isGroup?d.children:[d],p=u[0].count,g=[];for(const v of h){const S=new mt,_=new G,m=new Ii,x=new G(1,1,1),A=new CS(v.geometry,v.material,p);for(let w=0;w=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"}),{COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"}),Ea={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},PX={CUBICSPLINE:void 0,LINEAR:nc,STEP:tc},NM={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function IX(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new dh({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:zs})),n.DefaultMaterial}function Zl(n,e,t){for(const i in t.extensions)n[i]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=t.extensions[i])}function Io(n,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(n.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function BX(n,e,t){let i=!1,r=!1,s=!1;for(let u=0,d=e.length;u0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const NX=new mt;class UX{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new sX,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,r=!1,s=-1;typeof navigator!="undefined"&&typeof navigator.userAgent!="undefined"&&(i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,r=navigator.userAgent.indexOf("Firefox")>-1,s=r?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap=="undefined"||i||r&&s<98?this.textureLoader=new oL(this.options.manager):this.textureLoader=new xL(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Lr(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,r=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(o){const a={scene:o[0][r.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:r.asset,parser:i,userData:{}};return Zl(s,a,r),Io(a,r),Promise.all(i._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let r=0,s=t.length;r{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[u,d]of o.children.entries())s(d,a.children[u])};return s(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i=2&&_.setY(B,P[D*l+1]),l>=3&&_.setZ(B,P[D*l+2]),l>=4&&_.setW(B,P[D*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return _})}loadTexture(e){const t=this.json,i=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=i.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,i){const r=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const u=this.loadImageSource(t,i).then(function(d){d.flipY=!1,d.name=o.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const p=(s.samplers||{})[o.sampler]||{};return d.magFilter=F2[p.magFilter]||zn,d.minFilter=F2[p.minFilter]||Kr,d.wrapS=N2[p.wrapS]||ca,d.wrapT=N2[p.wrapT]||ca,r.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[l]=u,u}loadImageSource(e,t){const i=this,r=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());const o=r.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",u=!1;if(o.bufferView!==void 0)l=i.getDependency("bufferView",o.bufferView).then(function(h){u=!0;const p=new Blob([h],{type:o.mimeType});return l=a.createObjectURL(p),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(l).then(function(h){return new Promise(function(p,g){let v=p;t.isImageBitmapLoader===!0&&(v=function(S){const _=new Mn(S);_.needsUpdate=!0,p(_)}),t.load(Ma.resolveURL(h,s.path),v,void 0,g)})}).then(function(h){return u===!0&&a.revokeObjectURL(l),Io(h,o),h.userData.mimeType=o.mimeType||FX(o.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),h});return this.sourceCache[e]=d,d}assignTexture(e,t,i,r){const s=this;return this.getDependency("texture",i.index).then(function(o){if(!o)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(o=o.clone(),o.channel=i.texCoord),s.extensions[Wt.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[Wt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[Wt.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return r!==void 0&&(typeof r=="number"&&(r=r===I2?ql:Po),"colorSpace"in o?o.colorSpace=r:o.encoding=r===ql?I2:rX),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const r=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new cv,$n.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,l.sizeAttenuation=!1,this.cache.add(a,l)),i=l}else if(e.isLine){const a="LineBasicMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new Fi,$n.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,this.cache.add(a,l)),i=l}if(r||s||o){let a="ClonedMaterial:"+i.uuid+":";r&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=i.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),r&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(i))),i=l}e.material=i}getMaterialType(){return dh}loadMaterial(e){const t=this,i=this.json,r=this.extensions,s=i.materials[e];let o;const a={},l=s.extensions||{},u=[];if(l[Wt.KHR_MATERIALS_UNLIT]){const h=r[Wt.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),u.push(h.extendParams(a,s,t))}else{const h=s.pbrMetallicRoughness||{};if(a.color=new ke(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){const p=h.baseColorFactor;a.color.setRGB(p[0],p[1],p[2],Po),a.opacity=p[3]}h.baseColorTexture!==void 0&&u.push(t.assignTexture(a,"map",h.baseColorTexture,ql)),a.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,a.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(u.push(t.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),u.push(t.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture))),o=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),u.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=gs);const d=s.alphaMode||NM.OPAQUE;if(d===NM.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===NM.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Ir&&(u.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new Ae(1,1),s.normalTexture.scale!==void 0)){const h=s.normalTexture.scale;a.normalScale.set(h,h)}if(s.occlusionTexture!==void 0&&o!==Ir&&(u.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Ir){const h=s.emissiveFactor;a.emissive=new ke().setRGB(h[0],h[1],h[2],Po)}return s.emissiveTexture!==void 0&&o!==Ir&&u.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,ql)),Promise.all(u).then(function(){const h=new o(a);return s.name&&(h.name=s.name),Io(h,s),t.associations.set(h,{materials:e}),s.extensions&&Zl(r,h,s),h})}createUniqueName(e){const t=Kt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,r=this.primitiveCache;function s(a){return i[Wt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return U2(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&LX(m,s),m.name=t.createUniqueName(s.name||"mesh_"+e),Io(m,s),_.extensions&&Zl(r,m,_),t.assignFinalMaterial(m),h.push(m)}for(let g=0,v=h.length;g1?d=new Co:u.length===1?d=u[0]:d=new jt,d!==u[0])for(let h=0,p=u.length;h{const h=new Map;for(const[p,g]of r.associations)(p instanceof $n||p instanceof Mn)&&h.set(p,g);return d.traverse(p=>{const g=r.associations.get(p);g!=null&&h.set(p,g)}),h};return r.associations=u(s),s})}_createAnimationTracks(e,t,i,r,s){const o=[],a=e.name?e.name:e.uuid,l=[];Ea[s.path]===Ea.weights?e.traverse(function(p){p.morphTargetInfluences&&l.push(p.name?p.name:p.uuid)}):l.push(a);let u;switch(Ea[s.path]){case Ea.weights:u=zl;break;case Ea.rotation:u=Hl;break;case Ea.position:case Ea.scale:u=Vl;break;default:switch(i.itemSize){case 1:u=zl;break;case 2:case 3:default:u=Vl;break}break}const d=r.interpolation!==void 0?PX[r.interpolation]:nc,h=this._getArrayFromAccessor(i);for(let p=0,g=l.length;p{const a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(o,a).then(t).catch(r)},i,r)}decodeDracoFile(e,t,i,r){const s={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i};this.decodeGeometry(e,s).then(t)}decodeGeometry(e,t){for(const l in t.attributeTypes){const u=t.attributeTypes[l];u.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[l]=u.name)}const i=JSON.stringify(t);if(kM.has(e)){const l=kM.get(e);if(l.key===i)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r;const s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(l=>(r=l,new Promise((u,d)=>{r._callbacks[s]={resolve:u,reject:d},r.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{r&&s&&this._releaseTask(r,s)}),kM.set(e,{key:i,promise:a}),a}_createGeometry(e){const t=new Pt;e.index&&t.setIndex(new $t(e.index.array,1));for(let i=0;i{i.load(e,r,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(i=>{const r=i[0];e||(this.decoderConfig.wasmBinary=i[1]);const s=zX.toString(),o=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(` `);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.lengths._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e{const h=d.draco,p=new h.Decoder,g=new h.DecoderBuffer;g.Init(new Int8Array(l),l.byteLength);try{const v=t(h,p,g,u),S=v.attributes.map(_=>_.array.buffer);v.index&&S.push(v.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:v},S)}catch(v){console.error(v),self.postMessage({type:"error",id:a.id,error:v.message})}finally{h.destroy(g),h.destroy(p)}});break}};function t(o,a,l,u){const d=u.attributeIDs,h=u.attributeTypes;let p,g;const v=a.GetEncodedGeometryType(l);if(v===o.TRIANGULAR_MESH)p=new o.Mesh,g=a.DecodeBufferToMesh(l,p);else if(v===o.POINT_CLOUD)p=new o.PointCloud,g=a.DecodeBufferToPointCloud(l,p);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!g.ok()||p.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());const S={index:null,attributes:[]};for(const _ in d){const m=self[h[_]];let x,A;if(u.useUniqueIDs)A=d[_],x=a.GetAttributeByUniqueId(p,A);else{if(A=a.GetAttributeId(p,o[d[_]]),A===-1)continue;x=a.GetAttribute(p,A)}S.attributes.push(r(o,a,p,_,m,x))}return v===o.TRIANGULAR_MESH&&(S.index=i(o,a,p)),o.destroy(p),S}function i(o,a,l){const d=l.num_faces()*3,h=d*4,p=o._malloc(h);a.GetTrianglesUInt32Array(l,h,p);const g=new Uint32Array(o.HEAPF32.buffer,p,d).slice();return o._free(p),{array:g,itemSize:1}}function r(o,a,l,u,d,h){const p=h.num_components(),v=l.num_points()*p,S=v*d.BYTES_PER_ELEMENT,_=s(o,d),m=o._malloc(S);a.GetAttributeDataArrayForAllPoints(l,h,_,S,m);const x=new d(o.HEAPF32.buffer,m,v).slice();return o._free(m),{name:u,array:x,itemSize:p}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}let Qv;const zM=()=>{if(Qv)return Qv;const n="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",e="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),i=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if(typeof WebAssembly!="object")return{supported:!1};let r=n;WebAssembly.validate(t)&&(r=e);let s;const o=WebAssembly.instantiate(a(r),{}).then(h=>{s=h.instance,s.exports.__wasm_call_ctors()});function a(h){const p=new Uint8Array(h.length);for(let v=0;v96?S-71:S>64?S-65:S>47?S+4:S>46?63:62}let g=0;for(let v=0;v{t&&t(i),n&&(qv||(qv=new kX),qv.setDecoderPath(typeof n=="string"?n:O2),i.setDRACOLoader(qv)),e&&i.setMeshoptDecoder(typeof zM=="function"?zM():zM)}}const Zv=(n,e,t,i)=>vh(LM,n,k2(e,t,i));Zv.preload=(n,e,t,i)=>vh.preload(LM,n,k2(e,t,i)),Zv.clear=n=>vh.clear(LM,n),Zv.setDecoderPath=n=>{O2=n};const z2={name:"dc-overview-ws",private:!0,version:"0.1.21",type:"module",scripts:{dev:"vite",build:"vite build",lint:"eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",preview:"vite preview",commit:"git-cz"},dependencies:{"@react-three/drei":"^9.111.1","@react-three/fiber":"^8.17.5","@vidyard/embed-code":"^4.3.15","framer-motion":"^11.3.19","framer-motion-3d":"^11.3.28",react:"^18.2.0","react-aria-components":"^1.2.1","react-dom":"^18.2.0",three:"^0.167.1"},devDependencies:{"@sfdc-www/chassis-core":"^1.70.0","@sfdc-www/chassis-core-types":"^1.30.0","@sfdc-www/www-schemas":"1.172.0","@types/react":"^18.2.66","@types/react-dom":"^18.2.22","@typescript-eslint/eslint-plugin":"^7.2.0","@typescript-eslint/parser":"^7.2.0","@vitejs/plugin-react":"^4.2.1",autoprefixer:"^10.4.19",eslint:"^8.57.0","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-react-refresh":"^0.4.6",postcss:"^8.4.38","postcss-prefix-selector":"^1.16.1",tailwindcss:"^3.4.3",typescript:"^5.2.2",vite:"^5.2.0"},config:{commitizen:{path:"./node_modules/cz-conventional-changelog"}}},HX=z2.version,GX=`https://a.sfdcstatic.com/digital/@sfdc-www/open-blade-libs/${z2.name}/v${HX}/data-dust.glb`,VX=Object.freeze(Object.defineProperty({__proto__:null,default:({progress:n,direction:e,size:t})=>{const{nodes:i}=Zv(GX),r=lr(n,[0,1],[e==="left"?0:10,e==="left"?10:0]),s=[[2,2,5,.4],[8,0,4,.3]];return ge.jsx(JL.div,{initial:{opacity:0},animate:{opacity:1},children:ge.jsxs(nX,{resize:{offsetSize:!0},dpr:[1,2],camera:{position:[0,0,5.5],fov:t==="sm"?25:t==="md"?15:10},children:[ge.jsx("ambientLight",{intensity:.3,color:"#63B1F8"}),s.map(([o,a,l,u],d)=>ge.jsx("pointLight",{intensity:u,position:[o/8,a/8,l/8],color:"#63B1F8"},d)),ge.jsx("group",{dispose:null,children:ge.jsx(JL.mesh,{geometry:i.Star.geometry,rotation:[Math.PI/2,0,r],scale:8,animate:{rotateZ:0,transition:{rotateZ:{duration:15,ease:"linear",repeat:1/0}}},children:ge.jsx("meshPhongMaterial",{color:"#63B1F8",emissive:"#416FB6",specular:"#89DCFA",shininess:30})})})]})})}},Symbol.toStringTag,{value:"Module"})),WX=Object.freeze(Object.defineProperty({__proto__:null,default:()=>ge.jsx("div",{className:"flex justify-center items-center h-screen",children:ge.jsxs("svg",{className:"animate-spin mt-20 h-20 w-20 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[ge.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),ge.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})},Symbol.toStringTag,{value:"Module"}))});