(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();function DS(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var mR={exports:{}},iv={},gR={exports:{}},Kt={};/** * @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 rp=Symbol.for("react.element"),AN=Symbol.for("react.portal"),CN=Symbol.for("react.fragment"),RN=Symbol.for("react.strict_mode"),bN=Symbol.for("react.profiler"),PN=Symbol.for("react.provider"),LN=Symbol.for("react.context"),IN=Symbol.for("react.forward_ref"),DN=Symbol.for("react.suspense"),NN=Symbol.for("react.memo"),FN=Symbol.for("react.lazy"),DT=Symbol.iterator;function UN(n){return n===null||typeof n!="object"?null:(n=DT&&n[DT]||n["@@iterator"],typeof n=="function"?n:null)}var vR={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_R=Object.assign,yR={};function Rf(n,e,t){this.props=n,this.context=e,this.refs=yR,this.updater=t||vR}Rf.prototype.isReactComponent={};Rf.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")};Rf.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function xR(){}xR.prototype=Rf.prototype;function NS(n,e,t){this.props=n,this.context=e,this.refs=yR,this.updater=t||vR}var FS=NS.prototype=new xR;FS.constructor=NS;_R(FS,Rf.prototype);FS.isPureReactComponent=!0;var NT=Array.isArray,SR=Object.prototype.hasOwnProperty,US={current:null},MR={key:!0,ref:!0,__self:!0,__source:!0};function wR(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)SR.call(e,i)&&!MR.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(a===1)r.children=t;else if(1>>1,j=k[re];if(0>>1;rer(Pe,F))_er(Re,Pe)?(k[re]=Re,k[_e]=F,re=_e):(k[re]=Pe,k[le]=F,re=le);else if(_er(Re,F))k[re]=Re,k[_e]=F,re=_e;else break e}}return G}function r(k,G){var F=k.sortIndex-G.sortIndex;return F!==0?F:k.id-G.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=[],f=[],h=1,d=null,p=3,m=!1,_=!1,x=!1,y=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(k){for(var G=t(f);G!==null;){if(G.callback===null)i(f);else if(G.startTime<=k)i(f),G.sortIndex=G.expirationTime,e(l,G);else break;G=t(f)}}function E(k){if(x=!1,S(k),!_)if(t(l)!==null)_=!0,oe(C);else{var G=t(f);G!==null&&$(E,G.startTime-k)}}function C(k,G){_=!1,x&&(x=!1,g(D),D=-1),m=!0;var F=p;try{for(S(G),d=t(l);d!==null&&(!(d.expirationTime>G)||k&&!z());){var re=d.callback;if(typeof re=="function"){d.callback=null,p=d.priorityLevel;var j=re(d.expirationTime<=G);G=n.unstable_now(),typeof j=="function"?d.callback=j:d===t(l)&&i(l),S(G)}else i(l);d=t(l)}if(d!==null)var ve=!0;else{var le=t(f);le!==null&&$(E,le.startTime-G),ve=!1}return ve}finally{d=null,p=F,m=!1}}var R=!1,P=null,D=-1,b=5,I=-1;function z(){return!(n.unstable_now()-Ik||125re?(k.sortIndex=F,e(f,k),t(l)===null&&k===t(f)&&(x?(g(D),D=-1):x=!0,$(E,F-re))):(k.sortIndex=j,e(l,k),_||m||(_=!0,oe(C))),k},n.unstable_shouldYield=z,n.unstable_wrapCallback=function(k){var G=p;return function(){var F=p;p=G;try{return k.apply(this,arguments)}finally{p=F}}}})(CR);AR.exports=CR;var jN=AR.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 RR=ie,Jr=jN;function Fe(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ax=Object.prototype.hasOwnProperty,qN=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,UT={},kT={};function ZN(n){return Ax.call(kT,n)?!0:Ax.call(UT,n)?!1:qN.test(n)?kT[n]=!0:(UT[n]=!0,!1)}function KN(n,e,t,i){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function JN(n,e,t,i){if(e===null||typeof e>"u"||KN(n,e,t,i))return!0;if(i)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function pr(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 Di={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){Di[n]=new pr(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];Di[e]=new pr(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){Di[n]=new pr(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){Di[n]=new pr(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){Di[n]=new pr(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){Di[n]=new pr(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){Di[n]=new pr(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){Di[n]=new pr(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){Di[n]=new pr(n,5,!1,n.toLowerCase(),null,!1,!1)});var OS=/[\-:]([a-z])/g;function zS(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(OS,zS);Di[e]=new pr(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(OS,zS);Di[e]=new pr(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(OS,zS);Di[e]=new pr(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){Di[n]=new pr(n,1,!1,n.toLowerCase(),null,!1,!1)});Di.xlinkHref=new pr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){Di[n]=new pr(n,1,!1,n.toLowerCase(),null,!0,!0)});function BS(n,e,t,i){var r=Di.hasOwnProperty(e)?Di[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{q_=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?Ph(n):""}function QN(n){switch(n.tag){case 5:return Ph(n.type);case 16:return Ph("Lazy");case 13:return Ph("Suspense");case 19:return Ph("SuspenseList");case 0:case 2:case 15:return n=Z_(n.type,!1),n;case 11:return n=Z_(n.type.render,!1),n;case 1:return n=Z_(n.type,!0),n;default:return""}}function Px(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 bc:return"Fragment";case Rc:return"Portal";case Cx:return"Profiler";case HS:return"StrictMode";case Rx:return"Suspense";case bx:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case LR:return(n.displayName||"Context")+".Consumer";case PR:return(n._context.displayName||"Context")+".Provider";case VS:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case GS:return e=n.displayName||null,e!==null?e:Px(n.type)||"Memo";case Pa:e=n._payload,n=n._init;try{return Px(n(e))}catch{}}return null}function $N(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 Px(e);case 8:return e===HS?"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 rl(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function DR(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function eF(n){var e=DR(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&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 wm(n){n._valueTracker||(n._valueTracker=eF(n))}function NR(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=DR(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function v0(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function Lx(n,e){var t=e.checked;return Hn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function zT(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=rl(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 FR(n,e){e=e.checked,e!=null&&BS(n,"checked",e,!1)}function Ix(n,e){FR(n,e);var t=rl(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")?Dx(n,e.type,t):e.hasOwnProperty("defaultValue")&&Dx(n,e.type,rl(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function BT(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 Dx(n,e,t){(e!=="number"||v0(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var Lh=Array.isArray;function Zc(n,e,t,i){if(n=n.options,e){e={};for(var r=0;r"+e.valueOf().toString()+"",e=Em.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function md(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var Hh={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},tF=["Webkit","ms","Moz","O"];Object.keys(Hh).forEach(function(n){tF.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),Hh[e]=Hh[n]})});function zR(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||Hh.hasOwnProperty(n)&&Hh[n]?(""+e).trim():e+"px"}function BR(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=zR(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var nF=Hn({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 Ux(n,e){if(e){if(nF[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Fe(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Fe(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Fe(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Fe(62))}}function kx(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 Ox=null;function WS(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var zx=null,Kc=null,Jc=null;function GT(n){if(n=ap(n)){if(typeof zx!="function")throw Error(Fe(280));var e=n.stateNode;e&&(e=lv(e),zx(n.stateNode,n.type,e))}}function HR(n){Kc?Jc?Jc.push(n):Jc=[n]:Kc=n}function VR(){if(Kc){var n=Kc,e=Jc;if(Jc=Kc=null,GT(n),e)for(n=0;n>>=0,n===0?32:31-(dF(n)/pF|0)|0}var Tm=64,Am=4194304;function Ih(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 S0(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=Ih(a):(s&=o,s!==0&&(i=Ih(s)))}else o=t&~r,o!==0?i=Ih(o):s!==0&&(i=Ih(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 sp(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-js(e),n[e]=t}function _F(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=Gh),QT=String.fromCharCode(32),$T=!1;function lb(n,e){switch(n){case"keyup":return YF.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ub(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Pc=!1;function qF(n,e){switch(n){case"compositionend":return ub(e);case"keypress":return e.which!==32?null:($T=!0,QT);case"textInput":return n=e.data,n===QT&&$T?null:n;default:return null}}function ZF(n,e){if(Pc)return n==="compositionend"||!QS&&lb(n,e)?(n=ob(),Wg=ZS=Fa=null,Pc=!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=iA(t)}}function db(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?db(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function pb(){for(var n=window,e=v0();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=v0(n.document)}return e}function $S(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 rU(n){var e=pb(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&db(t.ownerDocument.documentElement,t)){if(i!==null&&$S(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=rA(t,s);var o=rA(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,Lc=null,Xx=null,Xh=null,Yx=!1;function sA(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;Yx||Lc==null||Lc!==v0(i)||(i=Lc,"selectionStart"in i&&$S(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}),Xh&&Sd(Xh,i)||(Xh=i,i=E0(Xx,"onSelect"),0Nc||(n.current=Qx[Nc],Qx[Nc]=null,Nc--)}function Sn(n,e){Nc++,Qx[Nc]=n.current,n.current=e}var sl={},Ji=dl(sl),Tr=dl(!1),vu=sl;function cf(n,e){var t=n.type.contextTypes;if(!t)return sl;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 Ar(n){return n=n.childContextTypes,n!=null}function A0(){An(Tr),An(Ji)}function hA(n,e,t){if(Ji.current!==sl)throw Error(Fe(168));Sn(Ji,e),Sn(Tr,t)}function wb(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(Fe(108,$N(n)||"Unknown",r));return Hn({},t,i)}function C0(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||sl,vu=Ji.current,Sn(Ji,n),Sn(Tr,Tr.current),!0}function dA(n,e,t){var i=n.stateNode;if(!i)throw Error(Fe(169));t?(n=wb(n,e,vu),i.__reactInternalMemoizedMergedChildContext=n,An(Tr),An(Ji),Sn(Ji,n)):An(Tr),Sn(Tr,t)}var Go=null,uv=!1,uy=!1;function Eb(n){Go===null?Go=[n]:Go.push(n)}function gU(n){uv=!0,Eb(n)}function pl(){if(!uy&&Go!==null){uy=!0;var n=0,e=pn;try{var t=Go;for(pn=1;n>=o,r-=o,qo=1<<32-js(e)+r|t<D?(b=P,P=null):b=P.sibling;var I=p(g,P,S[D],E);if(I===null){P===null&&(P=b);break}n&&P&&I.alternate===null&&e(g,P),M=s(I,M,D),R===null?C=I:R.sibling=I,R=I,P=b}if(D===S.length)return t(g,P),Pn&&Bl(g,D),C;if(P===null){for(;DD?(b=P,P=null):b=P.sibling;var z=p(g,P,I.value,E);if(z===null){P===null&&(P=b);break}n&&P&&z.alternate===null&&e(g,P),M=s(z,M,D),R===null?C=z:R.sibling=z,R=z,P=b}if(I.done)return t(g,P),Pn&&Bl(g,D),C;if(P===null){for(;!I.done;D++,I=S.next())I=d(g,I.value,E),I!==null&&(M=s(I,M,D),R===null?C=I:R.sibling=I,R=I);return Pn&&Bl(g,D),C}for(P=i(g,P);!I.done;D++,I=S.next())I=m(P,g,D,I.value,E),I!==null&&(n&&I.alternate!==null&&P.delete(I.key===null?D:I.key),M=s(I,M,D),R===null?C=I:R.sibling=I,R=I);return n&&P.forEach(function(q){return e(g,q)}),Pn&&Bl(g,D),C}function y(g,M,S,E){if(typeof S=="object"&&S!==null&&S.type===bc&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case Mm:e:{for(var C=S.key,R=M;R!==null;){if(R.key===C){if(C=S.type,C===bc){if(R.tag===7){t(g,R.sibling),M=r(R,S.props.children),M.return=g,g=M;break e}}else if(R.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Pa&&xA(C)===R.type){t(g,R.sibling),M=r(R,S.props),M.ref=fh(g,R,S),M.return=g,g=M;break e}t(g,R);break}else e(g,R);R=R.sibling}S.type===bc?(M=su(S.props.children,g.mode,E,S.key),M.return=g,g=M):(E=Qg(S.type,S.key,S.props,null,g.mode,E),E.ref=fh(g,M,S),E.return=g,g=E)}return o(g);case Rc:e:{for(R=S.key;M!==null;){if(M.key===R)if(M.tag===4&&M.stateNode.containerInfo===S.containerInfo&&M.stateNode.implementation===S.implementation){t(g,M.sibling),M=r(M,S.children||[]),M.return=g,g=M;break e}else{t(g,M);break}else e(g,M);M=M.sibling}M=vy(S,g.mode,E),M.return=g,g=M}return o(g);case Pa:return R=S._init,y(g,M,R(S._payload),E)}if(Lh(S))return _(g,M,S,E);if(oh(S))return x(g,M,S,E);Dm(g,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,M!==null&&M.tag===6?(t(g,M.sibling),M=r(M,S),M.return=g,g=M):(t(g,M),M=gy(S,g.mode,E),M.return=g,g=M),o(g)):t(g,M)}return y}var hf=Ib(!0),Db=Ib(!1),lp={},_o=dl(lp),Td=dl(lp),Ad=dl(lp);function Kl(n){if(n===lp)throw Error(Fe(174));return n}function lM(n,e){switch(Sn(Ad,e),Sn(Td,n),Sn(_o,lp),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Fx(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=Fx(e,n)}An(_o),Sn(_o,e)}function df(){An(_o),An(Td),An(Ad)}function Nb(n){Kl(Ad.current);var e=Kl(_o.current),t=Fx(e,n.type);e!==t&&(Sn(Td,n),Sn(_o,t))}function uM(n){Td.current===n&&(An(_o),An(Td))}var Fn=dl(0);function D0(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var cy=[];function cM(){for(var n=0;nt?t:4,n(!0);var i=fy.transition;fy.transition={};try{n(!1),e()}finally{pn=t,fy.transition=i}}function Kb(){return Rs().memoizedState}function xU(n,e,t){var i=Za(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},Jb(n))Qb(e,t);else if(t=Rb(n,e,t,i),t!==null){var r=hr();qs(t,n,i,r),$b(t,e,i)}}function SU(n,e,t){var i=Za(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(Jb(n))Qb(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,Ks(a,o)){var l=e.interleaved;l===null?(r.next=r,oM(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}t=Rb(n,e,r,i),t!==null&&(r=hr(),qs(t,n,i,r),$b(t,e,i))}}function Jb(n){var e=n.alternate;return n===zn||e!==null&&e===zn}function Qb(n,e){Yh=N0=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function $b(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,YS(n,t)}}var F0={readContext:Cs,useCallback:zi,useContext:zi,useEffect:zi,useImperativeHandle:zi,useInsertionEffect:zi,useLayoutEffect:zi,useMemo:zi,useReducer:zi,useRef:zi,useState:zi,useDebugValue:zi,useDeferredValue:zi,useTransition:zi,useMutableSource:zi,useSyncExternalStore:zi,useId:zi,unstable_isNewReconciler:!1},MU={readContext:Cs,useCallback:function(n,e){return co().memoizedState=[n,e===void 0?null:e],n},useContext:Cs,useEffect:MA,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,qg(4194308,4,Xb.bind(null,e,n),t)},useLayoutEffect:function(n,e){return qg(4194308,4,n,e)},useInsertionEffect:function(n,e){return qg(4,2,n,e)},useMemo:function(n,e){var t=co();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=co();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=xU.bind(null,zn,n),[i.memoizedState,n]},useRef:function(n){var e=co();return n={current:n},e.memoizedState=n},useState:SA,useDebugValue:mM,useDeferredValue:function(n){return co().memoizedState=n},useTransition:function(){var n=SA(!1),e=n[0];return n=yU.bind(null,n[1]),co().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=zn,r=co();if(Pn){if(t===void 0)throw Error(Fe(407));t=t()}else{if(t=e(),wi===null)throw Error(Fe(349));yu&30||kb(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,MA(zb.bind(null,i,s,n),[n]),i.flags|=2048,bd(9,Ob.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=co(),e=wi.identifierPrefix;if(Pn){var t=Zo,i=qo;t=(i&~(1<<32-js(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=Cd++,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[ho]=e,n[Ed]=i,lP(n,e,!1,!1),e.stateNode=n;e:{switch(o=kx(t,i),t){case"dialog":Mn("cancel",n),Mn("close",n),r=i;break;case"iframe":case"object":case"embed":Mn("load",n),r=i;break;case"video":case"audio":for(r=0;rmf&&(e.flags|=128,i=!0,hh(s,!1),e.lanes=4194304)}else{if(!i)if(n=D0(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),hh(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Pn)return Bi(e),null}else 2*ei()-s.renderingStartTime>mf&&t!==1073741824&&(e.flags|=128,i=!0,hh(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=ei(),e.sibling=null,t=Fn.current,Sn(Fn,i?t&1|2:t&1),e):(Bi(e),null);case 22:case 23:return SM(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?Hr&1073741824&&(Bi(e),e.subtreeFlags&6&&(e.flags|=8192)):Bi(e),null;case 24:return null;case 25:return null}throw Error(Fe(156,e.tag))}function PU(n,e){switch(tM(e),e.tag){case 1:return Ar(e.type)&&A0(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return df(),An(Tr),An(Ji),cM(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return uM(e),null;case 13:if(An(Fn),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Fe(340));ff()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return An(Fn),null;case 4:return df(),null;case 10:return sM(e.type._context),null;case 22:case 23:return SM(),null;case 24:return null;default:return null}}var Fm=!1,Wi=!1,LU=typeof WeakSet=="function"?WeakSet:Set,lt=null;function Oc(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){Xn(n,e,i)}else t.current=null}function c1(n,e,t){try{t()}catch(i){Xn(n,e,i)}}var LA=!1;function IU(n,e){if(jx=M0,n=pb(),$S(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{t=null;break e}var o=0,a=-1,l=-1,f=0,h=0,d=n,p=null;t:for(;;){for(var m;d!==t||r!==0&&d.nodeType!==3||(a=o+r),d!==s||i!==0&&d.nodeType!==3||(l=o+i),d.nodeType===3&&(o+=d.nodeValue.length),(m=d.firstChild)!==null;)p=d,d=m;for(;;){if(d===n)break t;if(p===t&&++f===r&&(a=o),p===s&&++h===i&&(l=o),(m=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=m}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(qx={focusedElem:n,selectionRange:t},M0=!1,lt=e;lt!==null;)if(e=lt,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,lt=n;else for(;lt!==null;){e=lt;try{var _=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(_!==null){var x=_.memoizedProps,y=_.memoizedState,g=e.stateNode,M=g.getSnapshotBeforeUpdate(e.elementType===e.type?x:Bs(e.type,x),y);g.__reactInternalSnapshotBeforeUpdate=M}break;case 3:var S=e.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Fe(163))}}catch(E){Xn(e,e.return,E)}if(n=e.sibling,n!==null){n.return=e.return,lt=n;break}lt=e.return}return _=LA,LA=!1,_}function jh(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&&c1(e,t,s)}r=r.next}while(r!==i)}}function hv(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 f1(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 fP(n){var e=n.alternate;e!==null&&(n.alternate=null,fP(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[ho],delete e[Ed],delete e[Jx],delete e[pU],delete e[mU])),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 hP(n){return n.tag===5||n.tag===3||n.tag===4}function IA(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||hP(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 h1(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=T0));else if(i!==4&&(n=n.child,n!==null))for(h1(n,e,t),n=n.sibling;n!==null;)h1(n,e,t),n=n.sibling}function d1(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(d1(n,e,t),n=n.sibling;n!==null;)d1(n,e,t),n=n.sibling}var Ci=null,Vs=!1;function Ma(n,e,t){for(t=t.child;t!==null;)dP(n,e,t),t=t.sibling}function dP(n,e,t){if(vo&&typeof vo.onCommitFiberUnmount=="function")try{vo.onCommitFiberUnmount(rv,t)}catch{}switch(t.tag){case 5:Wi||Oc(t,e);case 6:var i=Ci,r=Vs;Ci=null,Ma(n,e,t),Ci=i,Vs=r,Ci!==null&&(Vs?(n=Ci,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Ci.removeChild(t.stateNode));break;case 18:Ci!==null&&(Vs?(n=Ci,t=t.stateNode,n.nodeType===8?ly(n.parentNode,t):n.nodeType===1&&ly(n,t),yd(n)):ly(Ci,t.stateNode));break;case 4:i=Ci,r=Vs,Ci=t.stateNode.containerInfo,Vs=!0,Ma(n,e,t),Ci=i,Vs=r;break;case 0:case 11:case 14:case 15:if(!Wi&&(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)&&c1(t,e,o),r=r.next}while(r!==i)}Ma(n,e,t);break;case 1:if(!Wi&&(Oc(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){Xn(t,e,a)}Ma(n,e,t);break;case 21:Ma(n,e,t);break;case 22:t.mode&1?(Wi=(i=Wi)||t.memoizedState!==null,Ma(n,e,t),Wi=i):Ma(n,e,t);break;default:Ma(n,e,t)}}function DA(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new LU),e.forEach(function(i){var r=HU.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function Ns(n,e){var t=e.deletions;if(t!==null)for(var i=0;ir&&(r=o),i&=~s}if(i=r,i=ei()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*NU(i/1960))-i,10n?16:n,Ua===null)var i=!1;else{if(n=Ua,Ua=null,O0=0,rn&6)throw Error(Fe(331));var r=rn;for(rn|=4,lt=n.current;lt!==null;){var s=lt,o=s.child;if(lt.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lei()-yM?ru(n,0):_M|=t),Cr(n,e)}function SP(n,e){e===0&&(n.mode&1?(e=Am,Am<<=1,!(Am&130023424)&&(Am=4194304)):e=1);var t=hr();n=ra(n,e),n!==null&&(sp(n,e,t),Cr(n,t))}function BU(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),SP(n,t)}function HU(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(Fe(314))}i!==null&&i.delete(e),SP(n,t)}var MP;MP=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Tr.current)Er=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Er=!1,RU(n,e,t);Er=!!(n.flags&131072)}else Er=!1,Pn&&e.flags&1048576&&Tb(e,b0,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;Zg(n,e),n=e.pendingProps;var r=cf(e,Ji.current);$c(e,t),r=hM(null,e,i,n,r,t);var s=dM();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,Ar(i)?(s=!0,C0(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,aM(e),r.updater=cv,e.stateNode=r,r._reactInternals=e,i1(e,i,n,t),e=o1(null,e,i,!0,s,t)):(e.tag=0,Pn&&s&&eM(e),rr(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(Zg(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=GU(i),n=Bs(i,n),r){case 0:e=s1(null,e,i,n,t);break e;case 1:e=RA(null,e,i,n,t);break e;case 11:e=AA(null,e,i,n,t);break e;case 14:e=CA(null,e,i,Bs(i.type,n),t);break e}throw Error(Fe(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Bs(i,r),s1(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Bs(i,r),RA(n,e,i,r,t);case 3:e:{if(sP(e),n===null)throw Error(Fe(387));i=e.pendingProps,s=e.memoizedState,r=s.element,bb(n,e),I0(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=pf(Error(Fe(423)),e),e=bA(n,e,i,t,r);break e}else if(i!==r){r=pf(Error(Fe(424)),e),e=bA(n,e,i,t,r);break e}else for(Yr=Ya(e.stateNode.containerInfo.firstChild),qr=e,Pn=!0,Gs=null,t=Db(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(ff(),i===r){e=sa(n,e,t);break e}rr(n,e,i,t)}e=e.child}return e;case 5:return Nb(e),n===null&&e1(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,o=r.children,Zx(i,r)?o=null:s!==null&&Zx(i,s)&&(e.flags|=32),rP(n,e),rr(n,e,o,t),e.child;case 6:return n===null&&e1(e),null;case 13:return oP(n,e,t);case 4:return lM(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=hf(e,null,i,t):rr(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Bs(i,r),AA(n,e,i,r,t);case 7:return rr(n,e,e.pendingProps,t),e.child;case 8:return rr(n,e,e.pendingProps.children,t),e.child;case 12:return rr(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,Sn(P0,i._currentValue),i._currentValue=o,s!==null)if(Ks(s.value,o)){if(s.children===r.children&&!Tr.current){e=sa(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=$o(-1,t&-t),l.tag=2;var f=s.updateQueue;if(f!==null){f=f.shared;var h=f.pending;h===null?l.next=l:(l.next=h.next,h.next=l),f.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),t1(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(Fe(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),t1(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}rr(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,$c(e,t),r=Cs(r),i=i(r),e.flags|=1,rr(n,e,i,t),e.child;case 14:return i=e.type,r=Bs(i,e.pendingProps),r=Bs(i.type,r),CA(n,e,i,r,t);case 15:return nP(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Bs(i,r),Zg(n,e),e.tag=1,Ar(i)?(n=!0,C0(e)):n=!1,$c(e,t),Lb(e,i,r),i1(e,i,r,t),o1(null,e,i,!0,n,t);case 19:return aP(n,e,t);case 22:return iP(n,e,t)}throw Error(Fe(156,e.tag))};function wP(n,e){return ZR(n,e)}function VU(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 xs(n,e,t,i){return new VU(n,e,t,i)}function wM(n){return n=n.prototype,!(!n||!n.isReactComponent)}function GU(n){if(typeof n=="function")return wM(n)?1:0;if(n!=null){if(n=n.$$typeof,n===VS)return 11;if(n===GS)return 14}return 2}function Ka(n,e){var t=n.alternate;return t===null?(t=xs(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 Qg(n,e,t,i,r,s){var o=2;if(i=n,typeof n=="function")wM(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case bc:return su(t.children,r,s,e);case HS:o=8,r|=8;break;case Cx:return n=xs(12,t,e,r|2),n.elementType=Cx,n.lanes=s,n;case Rx:return n=xs(13,t,e,r),n.elementType=Rx,n.lanes=s,n;case bx:return n=xs(19,t,e,r),n.elementType=bx,n.lanes=s,n;case IR:return pv(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case PR:o=10;break e;case LR:o=9;break e;case VS:o=11;break e;case GS:o=14;break e;case Pa:o=16,i=null;break e}throw Error(Fe(130,n==null?n:typeof n,""))}return e=xs(o,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function su(n,e,t,i){return n=xs(7,n,i,e),n.lanes=t,n}function pv(n,e,t,i){return n=xs(22,n,i,e),n.elementType=IR,n.lanes=t,n.stateNode={isHidden:!1},n}function gy(n,e,t){return n=xs(6,n,null,e),n.lanes=t,n}function vy(n,e,t){return e=xs(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function WU(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=J_(0),this.expirationTimes=J_(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=J_(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function EM(n,e,t,i,r,s,o,a,l){return n=new WU(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=xs(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},aM(s),n}function XU(n,e,t){var i=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(CP)}catch(n){console.error(n)}}CP(),TR.exports=$r;var KU=TR.exports,RP,HA=KU;RP=HA.createRoot,HA.hydrateRoot;/** * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT */const yv="153",JU={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},QU={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},bP=0,_1=1,PP=2,$U=3,LP=0,xv=1,Kh=2,Hs=3,wo=0,qi=1,Ys=2,ek=2,ea=0,ou=1,y1=2,x1=3,S1=4,IP=5,Yl=100,DP=101,NP=102,M1=103,w1=104,FP=200,UP=201,kP=202,OP=203,RM=204,bM=205,zP=206,BP=207,HP=208,VP=209,GP=210,WP=0,XP=1,YP=2,H0=3,jP=4,qP=5,ZP=6,KP=7,up=0,JP=1,QP=2,Ts=0,$P=1,e3=2,t3=3,PM=4,n3=5,Sv=300,oa=301,ol=302,gf=303,Ld=304,Lf=306,Id=1e3,Xi=1001,Dd=1002,$n=1003,V0=1004,tk=1004,Jh=1005,nk=1005,yn=1006,LM=1007,ik=1007,al=1008,rk=1008,yo=1009,i3=1010,r3=1011,Mv=1012,IM=1013,Ko=1014,Pi=1015,ji=1016,DM=1017,NM=1018,Ja=1020,s3=1021,lr=1023,o3=1024,a3=1025,Qa=1026,Mu=1027,FM=1028,UM=1029,l3=1030,kM=1031,OM=1033,$g=33776,e0=33777,t0=33778,n0=33779,E1=35840,T1=35841,A1=35842,C1=35843,u3=36196,R1=37492,b1=37496,P1=37808,L1=37809,I1=37810,D1=37811,N1=37812,F1=37813,U1=37814,k1=37815,O1=37816,z1=37817,B1=37818,H1=37819,V1=37820,G1=37821,i0=36492,c3=36283,W1=36284,X1=36285,Y1=36286,f3=2200,h3=2201,d3=2202,Nd=2300,Fd=2301,r0=2302,Jl=2400,Ql=2401,Ud=2402,wv=2500,zM=2501,sk=0,ok=1,ak=2,BM=3e3,$a=3001,p3=3200,m3=3201,ml=0,g3=1,el="",kt="srgb",Js="srgb-linear",HM="display-p3",lk=0,s0=7680,uk=7681,ck=7682,fk=7683,hk=34055,dk=34056,pk=5386,mk=512,gk=513,vk=514,_k=515,yk=516,xk=517,Sk=518,v3=519,_3=512,y3=513,x3=514,S3=515,M3=516,w3=517,E3=518,T3=519,kd=35044,Mk=35048,wk=35040,Ek=35045,Tk=35049,Ak=35041,Ck=35046,Rk=35050,bk=35042,Pk="100",j1="300 es",G0=1035,mo=2e3,Od=2001;class fa{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]+Hi[n>>16&255]+Hi[n>>24&255]+"-"+Hi[e&255]+Hi[e>>8&255]+"-"+Hi[e>>16&15|64]+Hi[e>>24&255]+"-"+Hi[t&63|128]+Hi[t>>8&255]+"-"+Hi[t>>16&255]+Hi[t>>24&255]+Hi[i&255]+Hi[i>>8&255]+Hi[i>>16&255]+Hi[i>>24&255]).toLowerCase()}function Yn(n,e,t){return Math.max(e,Math.min(t,n))}function VM(n,e){return(n%e+e)%e}function Lk(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function Ik(n,e,t){return n!==e?(t-n)/(e-n):0}function Qh(n,e,t){return(1-t)*n+t*e}function Dk(n,e,t,i){return Qh(n,e,1-Math.exp(-t*i))}function Nk(n,e=1){return e-Math.abs(VM(n,e*2)-e)}function Fk(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Uk(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function kk(n,e){return n+Math.floor(Math.random()*(e-n+1))}function Ok(n,e){return n+Math.random()*(e-n)}function zk(n){return n*(.5-Math.random())}function Bk(n){n!==void 0&&(VA=n);let e=VA+=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 Hk(n){return n*au}function Vk(n){return n*vf}function q1(n){return(n&n-1)===0&&n!==0}function A3(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function W0(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Gk(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),f=s((e+i)/2),h=o((e+i)/2),d=s((e-i)/2),p=o((e-i)/2),m=s((i-e)/2),_=o((i-e)/2);switch(r){case"XYX":n.set(a*h,l*d,l*p,a*f);break;case"YZY":n.set(l*p,a*h,l*d,a*f);break;case"ZXZ":n.set(l*d,l*p,a*h,a*f);break;case"XZX":n.set(a*h,l*_,l*m,a*f);break;case"YXY":n.set(l*m,a*h,l*_,a*f);break;case"ZYZ":n.set(l*_,l*m,a*h,a*f);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function jr(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 Gt(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 GM={DEG2RAD:au,RAD2DEG:vf,generateUUID:Zr,clamp:Yn,euclideanModulo:VM,mapLinear:Lk,inverseLerp:Ik,lerp:Qh,damp:Dk,pingpong:Nk,smoothstep:Fk,smootherstep:Uk,randInt:kk,randFloat:Ok,randFloatSpread:zk,seededRandom:Bk,degToRad:Hk,radToDeg:Vk,isPowerOfTwo:q1,ceilPowerOfTwo:A3,floorPowerOfTwo:W0,setQuaternionFromProperEuler:Gk,normalize:Gt,denormalize:jr};class be{constructor(e=0,t=0){be.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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(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(Yn(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 Vt{constructor(e,t,i,r,s,o,a,l,f){Vt.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,f)}set(e,t,i,r,s,o,a,l,f){const h=this.elements;return h[0]=e,h[1]=r,h[2]=a,h[3]=t,h[4]=s,h[5]=l,h[6]=i,h[7]=o,h[8]=f,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],f=i[1],h=i[4],d=i[7],p=i[2],m=i[5],_=i[8],x=r[0],y=r[3],g=r[6],M=r[1],S=r[4],E=r[7],C=r[2],R=r[5],P=r[8];return s[0]=o*x+a*M+l*C,s[3]=o*y+a*S+l*R,s[6]=o*g+a*E+l*P,s[1]=f*x+h*M+d*C,s[4]=f*y+h*S+d*R,s[7]=f*g+h*E+d*P,s[2]=p*x+m*M+_*C,s[5]=p*y+m*S+_*R,s[8]=p*g+m*E+_*P,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],f=e[7],h=e[8];return t*o*h-t*a*f-i*s*h+i*a*l+r*s*f-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],f=e[7],h=e[8],d=h*o-a*f,p=a*l-h*s,m=f*s-o*l,_=t*d+i*p+r*m;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const x=1/_;return e[0]=d*x,e[1]=(r*f-h*i)*x,e[2]=(a*i-r*o)*x,e[3]=p*x,e[4]=(h*t-r*l)*x,e[5]=(r*s-a*t)*x,e[6]=m*x,e[7]=(i*l-f*t)*x,e[8]=(o*t-i*s)*x,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),f=Math.sin(s);return this.set(i*l,i*f,-i*(l*o+f*a)+o+e,-r*f,r*l,-r*(-f*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(_y.makeScale(e,t)),this}rotate(e){return this.premultiply(_y.makeRotation(-e)),this}translate(e,t){return this.premultiply(_y.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 _y=new Vt;function C3(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const Wk={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Bc(n,e){return new Wk[n](e)}function zd(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}const GA={};function $h(n){n in GA||(GA[n]=!0,console.warn(n))}function tf(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function yy(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const Xk=new Vt().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),Yk=new Vt().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function jk(n){return n.convertSRGBToLinear().applyMatrix3(Yk)}function qk(n){return n.applyMatrix3(Xk).convertLinearToSRGB()}const Zk={[Js]:n=>n,[kt]:n=>n.convertSRGBToLinear(),[HM]:jk},Kk={[Js]:n=>n,[kt]:n=>n.convertLinearToSRGB(),[HM]:qk},fs={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(n){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!n},get workingColorSpace(){return Js},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=Zk[e],r=Kk[t];if(i===void 0||r===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);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)}};let Ju;class WM{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Ju===void 0&&(Ju=zd("canvas")),Ju.width=e.width,Ju.height=e.height;const i=Ju.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Ju}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<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=zd("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!==Sv)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Id:e.x=e.x-Math.floor(e.x);break;case Xi:e.x=e.x<0?0:1;break;case Dd: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 Id:e.y=e.y-Math.floor(e.y);break;case Xi:e.y=e.y<0?0:1;break;case Dd: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)}get encoding(){return $h("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===kt?$a:BM}set encoding(e){$h("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===$a?kt:el}}Bn.DEFAULT_IMAGE=null;Bn.DEFAULT_MAPPING=Sv;Bn.DEFAULT_ANISOTROPY=1;class dn{constructor(e=0,t=0,i=0,r=1){dn.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,f=l[0],h=l[4],d=l[8],p=l[1],m=l[5],_=l[9],x=l[2],y=l[6],g=l[10];if(Math.abs(h-p)<.01&&Math.abs(d-x)<.01&&Math.abs(_-y)<.01){if(Math.abs(h+p)<.1&&Math.abs(d+x)<.1&&Math.abs(_+y)<.1&&Math.abs(f+m+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const S=(f+1)/2,E=(m+1)/2,C=(g+1)/2,R=(h+p)/4,P=(d+x)/4,D=(_+y)/4;return S>E&&S>C?S<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(S),r=R/i,s=P/i):E>C?E<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(E),i=R/r,s=D/r):C<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(C),i=P/s,r=D/s),this.set(i,r,s,t),this}let M=Math.sqrt((y-_)*(y-_)+(d-x)*(d-x)+(p-h)*(p-h));return Math.abs(M)<.001&&(M=1),this.x=(y-_)/M,this.y=(d-x)/M,this.z=(p-h)/M,this.w=Math.acos((f+m+g-1)/2),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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(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 bs extends fa{constructor(e=1,t=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new dn(0,0,e,t),this.scissorTest=!1,this.viewport=new dn(0,0,e,t);const r={width:e,height:t,depth:1};i.encoding!==void 0&&($h("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===$a?kt:el),this.texture=new Bn(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.internalFormat=i.internalFormat!==void 0?i.internalFormat:null,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:yn,this.depthBuffer=i.depthBuffer!==void 0?i.depthBuffer:!0,this.stencilBuffer=i.stencilBuffer!==void 0?i.stencilBuffer:!1,this.depthTexture=i.depthTexture!==void 0?i.depthTexture:null,this.samples=i.samples!==void 0?i.samples:0}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new $l(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ev extends Bn{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=$n,this.minFilter=$n,this.wrapR=Xi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class $k extends bs{constructor(e=1,t=1,i=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new Ev(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class XM extends Bn{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=$n,this.minFilter=$n,this.wrapR=Xi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class eO extends bs{constructor(e=1,t=1,i=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new XM(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class tO extends bs{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let o=0;o=0?1:-1,S=1-g*g;if(S>Number.EPSILON){const C=Math.sqrt(S),R=Math.atan2(C,g*M);y=Math.sin(y*R)/C,a=Math.sin(a*R)/C}const E=a*M;if(l=l*y+p*E,f=f*y+m*E,h=h*y+_*E,d=d*y+x*E,y===1-a){const C=1/Math.sqrt(l*l+f*f+h*h+d*d);l*=C,f*=C,h*=C,d*=C}}e[t]=l,e[t+1]=f,e[t+2]=h,e[t+3]=d}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],f=i[r+2],h=i[r+3],d=s[o],p=s[o+1],m=s[o+2],_=s[o+3];return e[t]=a*_+h*d+l*m-f*p,e[t+1]=l*_+h*p+f*d-a*m,e[t+2]=f*_+h*m+a*p-l*d,e[t+3]=h*_-a*d-l*p-f*m,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){const i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,f=a(i/2),h=a(r/2),d=a(s/2),p=l(i/2),m=l(r/2),_=l(s/2);switch(o){case"XYZ":this._x=p*h*d+f*m*_,this._y=f*m*d-p*h*_,this._z=f*h*_+p*m*d,this._w=f*h*d-p*m*_;break;case"YXZ":this._x=p*h*d+f*m*_,this._y=f*m*d-p*h*_,this._z=f*h*_-p*m*d,this._w=f*h*d+p*m*_;break;case"ZXY":this._x=p*h*d-f*m*_,this._y=f*m*d+p*h*_,this._z=f*h*_+p*m*d,this._w=f*h*d-p*m*_;break;case"ZYX":this._x=p*h*d-f*m*_,this._y=f*m*d+p*h*_,this._z=f*h*_-p*m*d,this._w=f*h*d+p*m*_;break;case"YZX":this._x=p*h*d+f*m*_,this._y=f*m*d+p*h*_,this._z=f*h*_-p*m*d,this._w=f*h*d-p*m*_;break;case"XZY":this._x=p*h*d-f*m*_,this._y=f*m*d-p*h*_,this._z=f*h*_+p*m*d,this._w=f*h*d+p*m*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&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],f=t[2],h=t[6],d=t[10],p=i+a+d;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(h-l)*m,this._y=(s-f)*m,this._z=(o-r)*m}else if(i>a&&i>d){const m=2*Math.sqrt(1+i-a-d);this._w=(h-l)/m,this._x=.25*m,this._y=(r+o)/m,this._z=(s+f)/m}else if(a>d){const m=2*Math.sqrt(1+a-i-d);this._w=(s-f)/m,this._x=(r+o)/m,this._y=.25*m,this._z=(l+h)/m}else{const m=2*Math.sqrt(1+d-i-a);this._w=(o-r)/m,this._x=(s+f)/m,this._y=(l+h)/m,this._z=.25*m}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(Yn(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,f=t._z,h=t._w;return this._x=i*h+o*a+r*f-s*l,this._y=r*h+o*l+s*a-i*f,this._z=s*h+o*f+i*l-r*a,this._w=o*h-i*a-r*l-s*f,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 m=1-t;return this._w=m*o+t*this._w,this._x=m*i+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const f=Math.sqrt(l),h=Math.atan2(f,a),d=Math.sin((1-t)*h)/f,p=Math.sin(t*h)/f;return this._w=o*d+this._w*p,this._x=i*d+this._x*p,this._y=r*d+this._y*p,this._z=s*d+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(r),i*Math.sin(s),i*Math.cos(s),t*Math.sin(r))}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}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 V{constructor(e=0,t=0,i=0){V.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(WA.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(WA.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,f=l*t+o*r-a*i,h=l*i+a*t-s*r,d=l*r+s*i-o*t,p=-s*t-o*i-a*r;return this.x=f*l+p*-s+h*-a-d*-o,this.y=h*l+p*-o+d*-s-f*-a,this.z=d*l+p*-a+f*-o-h*-s,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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(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 Sy.copy(this).projectOnVector(e),this.sub(Sy)}reflect(e){return this.sub(Sy.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(Yn(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()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Sy=new V,WA=new Rr;class To{constructor(e=new V(1/0,1/0,1/0),t=new V(-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;tthis.max.x||e.ythis.max.y||e.zthis.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.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Fo),Fo.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(ph),Om.subVectors(this.max,ph),$u.subVectors(e.a,ph),ec.subVectors(e.b,ph),tc.subVectors(e.c,ph),wa.subVectors(ec,$u),Ea.subVectors(tc,ec),bl.subVectors($u,tc);let t=[0,-wa.z,wa.y,0,-Ea.z,Ea.y,0,-bl.z,bl.y,wa.z,0,-wa.x,Ea.z,0,-Ea.x,bl.z,0,-bl.x,-wa.y,wa.x,0,-Ea.y,Ea.x,0,-bl.y,bl.x,0];return!My(t,$u,ec,tc,Om)||(t=[1,0,0,0,1,0,0,0,1],!My(t,$u,ec,tc,Om))?!1:(zm.crossVectors(wa,Ea),t=[zm.x,zm.y,zm.z],My(t,$u,ec,tc,Om))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Fo).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Fo).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:(No[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),No[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),No[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),No[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),No[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),No[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),No[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),No[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(No),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 No=[new V,new V,new V,new V,new V,new V,new V,new V],Fo=new V,Qu=new To,$u=new V,ec=new V,tc=new V,wa=new V,Ea=new V,bl=new V,ph=new V,Om=new V,zm=new V,Pl=new V;function My(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){Pl.fromArray(n,s);const a=r.x*Math.abs(Pl.x)+r.y*Math.abs(Pl.y)+r.z*Math.abs(Pl.z),l=e.dot(Pl),f=t.dot(Pl),h=i.dot(Pl);if(Math.max(-Math.max(l,f,h),Math.min(l,f,h))>a)return!1}return!0}const nO=new To,mh=new V,wy=new V;class Qs{constructor(e=new V,t=-1){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):nO.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;mh.subVectors(e,this.center);const t=mh.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(mh,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):(wy.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(mh.copy(e.center).add(wy)),this.expandByPoint(mh.copy(e.center).sub(wy))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Uo=new V,Ey=new V,Bm=new V,Ta=new V,Ty=new V,Hm=new V,Ay=new V;class If{constructor(e=new V,t=new V(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,Uo)),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=Uo.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Uo.copy(this.origin).addScaledVector(this.direction,t),Uo.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Ey.copy(e).add(t).multiplyScalar(.5),Bm.copy(t).sub(e).normalize(),Ta.copy(this.origin).sub(Ey);const s=e.distanceTo(t)*.5,o=-this.direction.dot(Bm),a=Ta.dot(this.direction),l=-Ta.dot(Bm),f=Ta.lengthSq(),h=Math.abs(1-o*o);let d,p,m,_;if(h>0)if(d=o*l-a,p=o*a-l,_=s*h,d>=0)if(p>=-_)if(p<=_){const x=1/h;d*=x,p*=x,m=d*(d+o*p+2*a)+p*(o*d+p+2*l)+f}else p=s,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*l)+f;else p=-s,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*l)+f;else p<=-_?(d=Math.max(0,-(-o*s+a)),p=d>0?-s:Math.min(Math.max(-s,-l),s),m=-d*d+p*(p+2*l)+f):p<=_?(d=0,p=Math.min(Math.max(-s,-l),s),m=p*(p+2*l)+f):(d=Math.max(0,-(o*s+a)),p=d>0?s:Math.min(Math.max(-s,-l),s),m=-d*d+p*(p+2*l)+f);else p=o>0?-s:s,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*l)+f;return i&&i.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(Ey).addScaledVector(Bm,p),m}intersectSphere(e,t){Uo.subVectors(e.center,this.origin);const i=Uo.dot(this.direction),r=Uo.dot(Uo)-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 f=1/this.direction.x,h=1/this.direction.y,d=1/this.direction.z,p=this.origin;return f>=0?(i=(e.min.x-p.x)*f,r=(e.max.x-p.x)*f):(i=(e.max.x-p.x)*f,r=(e.min.x-p.x)*f),h>=0?(s=(e.min.y-p.y)*h,o=(e.max.y-p.y)*h):(s=(e.max.y-p.y)*h,o=(e.min.y-p.y)*h),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o=0?(a=(e.min.z-p.z)*d,l=(e.max.z-p.z)*d):(a=(e.max.z-p.z)*d,l=(e.min.z-p.z)*d),i>l||a>r)||((a>i||i!==i)&&(i=a),(l=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Uo)!==null}intersectTriangle(e,t,i,r,s){Ty.subVectors(t,e),Hm.subVectors(i,e),Ay.crossVectors(Ty,Hm);let o=this.direction.dot(Ay),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Ta.subVectors(this.origin,e);const l=a*this.direction.dot(Hm.crossVectors(Ta,Hm));if(l<0)return null;const f=a*this.direction.dot(Ty.cross(Ta));if(f<0||l+f>o)return null;const h=-a*Ta.dot(Ay);return h<0?null:this.at(h/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 Ft{constructor(e,t,i,r,s,o,a,l,f,h,d,p,m,_,x,y){Ft.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,f,h,d,p,m,_,x,y)}set(e,t,i,r,s,o,a,l,f,h,d,p,m,_,x,y){const g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=r,g[1]=s,g[5]=o,g[9]=a,g[13]=l,g[2]=f,g[6]=h,g[10]=d,g[14]=p,g[3]=m,g[7]=_,g[11]=x,g[15]=y,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 Ft().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/nc.setFromMatrixColumn(e,0).length(),s=1/nc.setFromMatrixColumn(e,1).length(),o=1/nc.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),f=Math.sin(r),h=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const p=o*h,m=o*d,_=a*h,x=a*d;t[0]=l*h,t[4]=-l*d,t[8]=f,t[1]=m+_*f,t[5]=p-x*f,t[9]=-a*l,t[2]=x-p*f,t[6]=_+m*f,t[10]=o*l}else if(e.order==="YXZ"){const p=l*h,m=l*d,_=f*h,x=f*d;t[0]=p+x*a,t[4]=_*a-m,t[8]=o*f,t[1]=o*d,t[5]=o*h,t[9]=-a,t[2]=m*a-_,t[6]=x+p*a,t[10]=o*l}else if(e.order==="ZXY"){const p=l*h,m=l*d,_=f*h,x=f*d;t[0]=p-x*a,t[4]=-o*d,t[8]=_+m*a,t[1]=m+_*a,t[5]=o*h,t[9]=x-p*a,t[2]=-o*f,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const p=o*h,m=o*d,_=a*h,x=a*d;t[0]=l*h,t[4]=_*f-m,t[8]=p*f+x,t[1]=l*d,t[5]=x*f+p,t[9]=m*f-_,t[2]=-f,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const p=o*l,m=o*f,_=a*l,x=a*f;t[0]=l*h,t[4]=x-p*d,t[8]=_*d+m,t[1]=d,t[5]=o*h,t[9]=-a*h,t[2]=-f*h,t[6]=m*d+_,t[10]=p-x*d}else if(e.order==="XZY"){const p=o*l,m=o*f,_=a*l,x=a*f;t[0]=l*h,t[4]=-d,t[8]=f*h,t[1]=p*d+x,t[5]=o*h,t[9]=m*d-_,t[2]=_*d-m,t[6]=a*h,t[10]=x*d+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(iO,e,rO)}lookAt(e,t,i){const r=this.elements;return kr.subVectors(e,t),kr.lengthSq()===0&&(kr.z=1),kr.normalize(),Aa.crossVectors(i,kr),Aa.lengthSq()===0&&(Math.abs(i.z)===1?kr.x+=1e-4:kr.z+=1e-4,kr.normalize(),Aa.crossVectors(i,kr)),Aa.normalize(),Vm.crossVectors(kr,Aa),r[0]=Aa.x,r[4]=Vm.x,r[8]=kr.x,r[1]=Aa.y,r[5]=Vm.y,r[9]=kr.y,r[2]=Aa.z,r[6]=Vm.z,r[10]=kr.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],f=i[12],h=i[1],d=i[5],p=i[9],m=i[13],_=i[2],x=i[6],y=i[10],g=i[14],M=i[3],S=i[7],E=i[11],C=i[15],R=r[0],P=r[4],D=r[8],b=r[12],I=r[1],z=r[5],q=r[9],J=r[13],Q=r[2],ee=r[6],oe=r[10],$=r[14],k=r[3],G=r[7],F=r[11],re=r[15];return s[0]=o*R+a*I+l*Q+f*k,s[4]=o*P+a*z+l*ee+f*G,s[8]=o*D+a*q+l*oe+f*F,s[12]=o*b+a*J+l*$+f*re,s[1]=h*R+d*I+p*Q+m*k,s[5]=h*P+d*z+p*ee+m*G,s[9]=h*D+d*q+p*oe+m*F,s[13]=h*b+d*J+p*$+m*re,s[2]=_*R+x*I+y*Q+g*k,s[6]=_*P+x*z+y*ee+g*G,s[10]=_*D+x*q+y*oe+g*F,s[14]=_*b+x*J+y*$+g*re,s[3]=M*R+S*I+E*Q+C*k,s[7]=M*P+S*z+E*ee+C*G,s[11]=M*D+S*q+E*oe+C*F,s[15]=M*b+S*J+E*$+C*re,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],f=e[13],h=e[2],d=e[6],p=e[10],m=e[14],_=e[3],x=e[7],y=e[11],g=e[15];return _*(+s*l*d-r*f*d-s*a*p+i*f*p+r*a*m-i*l*m)+x*(+t*l*m-t*f*p+s*o*p-r*o*m+r*f*h-s*l*h)+y*(+t*f*d-t*a*m-s*o*d+i*o*m+s*a*h-i*f*h)+g*(-r*a*h-t*l*d+t*a*p+r*o*d-i*o*p+i*l*h)}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],f=e[7],h=e[8],d=e[9],p=e[10],m=e[11],_=e[12],x=e[13],y=e[14],g=e[15],M=d*y*f-x*p*f+x*l*m-a*y*m-d*l*g+a*p*g,S=_*p*f-h*y*f-_*l*m+o*y*m+h*l*g-o*p*g,E=h*x*f-_*d*f+_*a*m-o*x*m-h*a*g+o*d*g,C=_*d*l-h*x*l-_*a*p+o*x*p+h*a*y-o*d*y,R=t*M+i*S+r*E+s*C;if(R===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const P=1/R;return e[0]=M*P,e[1]=(x*p*s-d*y*s-x*r*m+i*y*m+d*r*g-i*p*g)*P,e[2]=(a*y*s-x*l*s+x*r*f-i*y*f-a*r*g+i*l*g)*P,e[3]=(d*l*s-a*p*s-d*r*f+i*p*f+a*r*m-i*l*m)*P,e[4]=S*P,e[5]=(h*y*s-_*p*s+_*r*m-t*y*m-h*r*g+t*p*g)*P,e[6]=(_*l*s-o*y*s-_*r*f+t*y*f+o*r*g-t*l*g)*P,e[7]=(o*p*s-h*l*s+h*r*f-t*p*f-o*r*m+t*l*m)*P,e[8]=E*P,e[9]=(_*d*s-h*x*s-_*i*m+t*x*m+h*i*g-t*d*g)*P,e[10]=(o*x*s-_*a*s+_*i*f-t*x*f-o*i*g+t*a*g)*P,e[11]=(h*a*s-o*d*s-h*i*f+t*d*f+o*i*m-t*a*m)*P,e[12]=C*P,e[13]=(h*x*r-_*d*r+_*i*p-t*x*p-h*i*y+t*d*y)*P,e[14]=(_*a*r-o*x*r-_*i*l+t*x*l+o*i*y-t*a*y)*P,e[15]=(o*d*r-h*a*r+h*i*l-t*d*l-o*i*p+t*a*p)*P,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,f=s*o,h=s*a;return this.set(f*o+i,f*a-r*l,f*l+r*a,0,f*a+r*l,h*a+i,h*l-r*o,0,f*l-r*a,h*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,f=s+s,h=o+o,d=a+a,p=s*f,m=s*h,_=s*d,x=o*h,y=o*d,g=a*d,M=l*f,S=l*h,E=l*d,C=i.x,R=i.y,P=i.z;return r[0]=(1-(x+g))*C,r[1]=(m+E)*C,r[2]=(_-S)*C,r[3]=0,r[4]=(m-E)*R,r[5]=(1-(p+g))*R,r[6]=(y+M)*R,r[7]=0,r[8]=(_+S)*P,r[9]=(y-M)*P,r[10]=(1-(p+x))*P,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=nc.set(r[0],r[1],r[2]).length();const o=nc.set(r[4],r[5],r[6]).length(),a=nc.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],Fs.copy(this);const f=1/s,h=1/o,d=1/a;return Fs.elements[0]*=f,Fs.elements[1]*=f,Fs.elements[2]*=f,Fs.elements[4]*=h,Fs.elements[5]*=h,Fs.elements[6]*=h,Fs.elements[8]*=d,Fs.elements[9]*=d,Fs.elements[10]*=d,t.setFromRotationMatrix(Fs),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=mo){const l=this.elements,f=2*s/(t-e),h=2*s/(i-r),d=(t+e)/(t-e),p=(i+r)/(i-r);let m,_;if(a===mo)m=-(o+s)/(o-s),_=-2*o*s/(o-s);else if(a===Od)m=-o/(o-s),_=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=f,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=h,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=mo){const l=this.elements,f=1/(t-e),h=1/(i-r),d=1/(o-s),p=(t+e)*f,m=(i+r)*h;let _,x;if(a===mo)_=(o+s)*d,x=-2*d;else if(a===Od)_=s*d,x=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*f,l[4]=0,l[8]=0,l[12]=-p,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=x,l[14]=-_,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 nc=new V,Fs=new Ft,iO=new V(0,0,0),rO=new V(1,1,1),Aa=new V,Vm=new V,kr=new V,XA=new Ft,YA=new Rr;class cp{constructor(e=0,t=0,i=0,r=cp.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],f=r[5],h=r[9],d=r[2],p=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(Yn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,m),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,f),this._z=0);break;case"YXZ":this._x=Math.asin(-Yn(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,f)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(Yn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-d,m),this._z=Math.atan2(-o,f)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Yn(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(p,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,f));break;case"YZX":this._z=Math.asin(Yn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,f),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-Yn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,f),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,m),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 XA.makeRotationFromQuaternion(e),this.setFromRotationMatrix(XA,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return YA.setFromEuler(this),this.setFromQuaternion(YA,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}}cp.DEFAULT_ORDER="XYZ";class lu{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&&(i=i.concat(o))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(gh,e,oO),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(gh,aO,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;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()));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 f=0,h=l.length;f0){r.children=[];for(let a=0;a0){r.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),f.length>0&&(i.textures=f),h.length>0&&(i.images=h),d.length>0&&(i.shapes=d),p.length>0&&(i.skeletons=p),m.length>0&&(i.animations=m),_.length>0&&(i.nodes=_)}return i.object=r,i;function o(a){const l=[];for(const f in a){const h=a[f];delete h.metadata,l.push(h)}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.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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,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){Us.subVectors(r,t),Oo.subVectors(i,t),Cy.subVectors(e,t);const o=Us.dot(Us),a=Us.dot(Oo),l=Us.dot(Cy),f=Oo.dot(Oo),h=Oo.dot(Cy),d=o*f-a*a;if(d===0)return s.set(-2,-1,-1);const p=1/d,m=(f*l-a*h)*p,_=(o*h-a*l)*p;return s.set(1-m-_,_,m)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,zo),zo.x>=0&&zo.y>=0&&zo.x+zo.y<=1}static getUV(e,t,i,r,s,o,a,l){return Wm===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Wm=!0),this.getInterpolation(e,t,i,r,s,o,a,l)}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,zo),l.setScalar(0),l.addScaledVector(s,zo.x),l.addScaledVector(o,zo.y),l.addScaledVector(a,zo.z),l}static isFrontFacing(e,t,i,r){return Us.subVectors(i,t),Oo.subVectors(e,t),Us.cross(Oo).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 Us.subVectors(this.c,this.b),Oo.subVectors(this.a,this.b),Us.cross(Oo).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return wr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return wr.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,s){return Wm===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Wm=!0),wr.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}getInterpolation(e,t,i,r,s){return wr.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return wr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return wr.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;rc.subVectors(r,i),sc.subVectors(s,i),Ry.subVectors(e,i);const l=rc.dot(Ry),f=sc.dot(Ry);if(l<=0&&f<=0)return t.copy(i);by.subVectors(e,r);const h=rc.dot(by),d=sc.dot(by);if(h>=0&&d<=h)return t.copy(r);const p=l*d-h*f;if(p<=0&&l>=0&&h<=0)return o=l/(l-h),t.copy(i).addScaledVector(rc,o);Py.subVectors(e,s);const m=rc.dot(Py),_=sc.dot(Py);if(_>=0&&m<=_)return t.copy(s);const x=m*f-l*_;if(x<=0&&f>=0&&_<=0)return a=f/(f-_),t.copy(i).addScaledVector(sc,a);const y=h*_-m*d;if(y<=0&&d-h>=0&&m-_>=0)return QA.subVectors(s,r),a=(d-h)/(d-h+(m-_)),t.copy(r).addScaledVector(QA,a);const g=1/(y+x+p);return o=x*g,a=p*g,t.copy(i).addScaledVector(rc,o).addScaledVector(sc,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let uO=0;class Ni extends fa{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:uO++}),this.uuid=Zr(),this.name="",this.type="Material",this.blending=ou,this.side=wo,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=RM,this.blendDst=bM,this.blendEquation=Yl,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=H0,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=v3,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=s0,this.stencilZFail=s0,this.stencilZPass=s0,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(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&&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.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.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!==ou&&(i.blending=this.blending),this.side!==wo&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,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.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(i.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(i.wireframe=this.wireframe),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=this.flatShading),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.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.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++}}const R3={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},ks={h:0,s:0,l:0},Xm={h:0,s:0,l:0};function Ly(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 Ge{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=kt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,fs.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=fs.workingColorSpace){return this.r=e,this.g=t,this.b=i,fs.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=fs.workingColorSpace){if(e=VM(e,1),t=Yn(t,0,1),i=Yn(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=Ly(o,s,e+1/3),this.g=Ly(o,s,e),this.b=Ly(o,s,e-1/3)}return fs.toWorkingColorSpace(this,r),this}setStyle(e,t=kt){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=kt){const i=R3[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=tf(e.r),this.g=tf(e.g),this.b=tf(e.b),this}copyLinearToSRGB(e){return this.r=yy(e.r),this.g=yy(e.g),this.b=yy(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=kt){return fs.fromWorkingColorSpace(Vi.copy(this),e),Math.round(Yn(Vi.r*255,0,255))*65536+Math.round(Yn(Vi.g*255,0,255))*256+Math.round(Yn(Vi.b*255,0,255))}getHexString(e=kt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=fs.workingColorSpace){fs.fromWorkingColorSpace(Vi.copy(this),t);const i=Vi.r,r=Vi.g,s=Vi.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,f;const h=(a+o)/2;if(a===o)l=0,f=0;else{const d=o-a;switch(f=h<=.5?d/(o+a):d/(2-o-a),o){case i:l=(r-s)/d+(r>-f-14,i[l|256]=1024>>-f-14|32768,r[l]=-f-1,r[l|256]=-f-1):f<=15?(i[l]=f+15<<10,i[l|256]=f+15<<10|32768,r[l]=13,r[l|256]=13):f<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 f=l<<13,h=0;for(;!(f&8388608);)f<<=1,h-=8388608;f&=-8388609,h+=947912704,s[l]=f|h}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 xr(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=Yn(n,-65504,65504),Xo.floatView[0]=n;const e=Xo.uint32View[0],t=e>>23&511;return Xo.baseTable[t]+((e&8388607)>>Xo.shiftTable[t])}function Nh(n){const e=n>>10;return Xo.uint32View[0]=Xo.mantissaTable[Xo.offsetTable[e]+(n&1023)]+Xo.exponentTable[e],Xo.floatView[0]}const eu={toHalfFloat:xr,fromHalfFloat:Nh},ii=new V,Ym=new be;class xn{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=kd,this.updateRange={offset:0,count:-1},this.gpuType=Pi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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 f in l)l[f]!==void 0&&(e[f]=l[f]);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 f=i[l];e.data.attributes[l]=f.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const f=this.morphAttributes[l],h=[];for(let d=0,p=f.length;d0&&(r[l]=h,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 f in r){const h=r[f];this.setAttribute(f,h.clone(t))}const s=e.morphAttributes;for(const f in s){const h=[],d=s[f];for(let p=0,m=d.length;p0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s(e.far-e.near)**2))&&($A.copy(s).invert(),Ll.copy(e.ray).applyMatrix4($A),!(i.boundingBox!==null&&Ll.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Ll)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,f=s.attributes.uv,h=s.attributes.uv1,d=s.attributes.normal,p=s.groups,m=s.drawRange;if(a!==null)if(Array.isArray(o))for(let _=0,x=p.length;_t.far?null:{distance:f,point:$m.clone(),object:n}}function eg(n,e,t,i,r,s,o,a,l,f){n.getVertexPosition(a,ac),n.getVertexPosition(l,lc),n.getVertexPosition(f,uc);const h=yO(n,e,t,i,ac,lc,uc,Qm);if(h){r&&(Zm.fromBufferAttribute(r,a),Km.fromBufferAttribute(r,l),Jm.fromBufferAttribute(r,f),h.uv=wr.getInterpolation(Qm,ac,lc,uc,Zm,Km,Jm,new be)),s&&(Zm.fromBufferAttribute(s,a),Km.fromBufferAttribute(s,l),Jm.fromBufferAttribute(s,f),h.uv1=wr.getInterpolation(Qm,ac,lc,uc,Zm,Km,Jm,new be),h.uv2=h.uv1),o&&(tC.fromBufferAttribute(o,a),nC.fromBufferAttribute(o,l),iC.fromBufferAttribute(o,f),h.normal=wr.getInterpolation(Qm,ac,lc,uc,tC,nC,iC,new V),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const d={a,b:l,c:f,normal:new V,materialIndex:0};wr.getNormal(ac,lc,uc,d.normal),h.face=d}return h}class vl extends Wt{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=[],f=[],h=[],d=[];let p=0,m=0;_("z","y","x",-1,-1,i,t,e,o,s,0),_("z","y","x",1,-1,i,t,-e,o,s,1),_("x","z","y",1,1,e,i,t,r,o,2),_("x","z","y",1,-1,e,i,-t,r,o,3),_("x","y","z",1,-1,e,t,i,r,s,4),_("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new pt(f,3)),this.setAttribute("normal",new pt(h,3)),this.setAttribute("uv",new pt(d,2));function _(x,y,g,M,S,E,C,R,P,D,b){const I=E/P,z=C/D,q=E/2,J=C/2,Q=R/2,ee=P+1,oe=D+1;let $=0,k=0;const G=new V;for(let F=0;F0?1:-1,h.push(G.x,G.y,G.z),d.push(j/P),d.push(1-F/D),$+=1}}for(let F=0;F0&&(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 fp extends jt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ft,this.projectionMatrix=new Ft,this.projectionMatrixInverse=new Ft,this.coordinateSystem=mo}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){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}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)}}class Si extends fp{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=vf*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(au*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return vf*2*Math.atan(Math.tan(au*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}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(au*.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,f=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*i/f,r*=o.width/l,i*=o.height/f}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 cc=-90,fc=1;class ZM extends jt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null;const r=new Si(cc,fc,e,t);r.layers=this.layers,this.add(r);const s=new Si(cc,fc,e,t);s.layers=this.layers,this.add(s);const o=new Si(cc,fc,e,t);o.layers=this.layers,this.add(o);const a=new Si(cc,fc,e,t);a.layers=this.layers,this.add(a);const l=new Si(cc,fc,e,t);l.layers=this.layers,this.add(l);const f=new Si(cc,fc,e,t);f.layers=this.layers,this.add(f)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,o,a,l]=t;for(const f of t)this.remove(f);if(e===mo)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===Od)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 f of t)this.add(f),f.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const i=this.renderTarget;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,s,o,a,l,f]=this.children,h=e.getRenderTarget(),d=e.toneMapping,p=e.xr.enabled;e.toneMapping=Ts,e.xr.enabled=!1;const m=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,r),e.setRenderTarget(i,1),e.render(t,s),e.setRenderTarget(i,2),e.render(t,o),e.setRenderTarget(i,3),e.render(t,a),e.setRenderTarget(i,4),e.render(t,l),i.texture.generateMipmaps=m,e.setRenderTarget(i,5),e.render(t,f),e.setRenderTarget(h),e.toneMapping=d,e.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class hp extends Bn{constructor(e,t,i,r,s,o,a,l,f,h){e=e!==void 0?e:[],t=t!==void 0?t:oa,super(e,t,i,r,s,o,a,l,f,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Tv extends bs{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];t.encoding!==void 0&&($h("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===$a?kt:el),this.texture=new hp(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:yn}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 vl(5,5,5),s=new Ps({name:"CubemapFromEquirect",uniforms:_f(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:qi,blending:ea});s.uniforms.tEquirect.value=t;const o=new Mi(r,s),a=t.minFilter;return t.minFilter===al&&(t.minFilter=yn),new ZM(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 Ny=new V,wO=new V,EO=new Vt;class Ia{constructor(e=new V(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=Ny.subVectors(i,t).cross(wO.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(Ny),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||EO.getNormalMatrix(e),r=this.coplanarPoint(Ny).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 Il=new Qs,tg=new V;class Av{constructor(e=new Ia,t=new Ia,i=new Ia,r=new Ia,s=new Ia,o=new Ia){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=mo){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],f=r[4],h=r[5],d=r[6],p=r[7],m=r[8],_=r[9],x=r[10],y=r[11],g=r[12],M=r[13],S=r[14],E=r[15];if(i[0].setComponents(l-s,p-f,y-m,E-g).normalize(),i[1].setComponents(l+s,p+f,y+m,E+g).normalize(),i[2].setComponents(l+o,p+h,y+_,E+M).normalize(),i[3].setComponents(l-o,p-h,y-_,E-M).normalize(),i[4].setComponents(l-a,p-d,y-x,E-S).normalize(),t===mo)i[5].setComponents(l+a,p+d,y+x,E+S).normalize();else if(t===Od)i[5].setComponents(a,d,x,S).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(),Il.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Il.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Il)}intersectsSprite(e){return Il.center.set(0,0,0),Il.radius=.7071067811865476,Il.applyMatrix4(e.matrixWorld),this.intersectsSphere(Il)}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,tg.y=r.normal.y>0?e.max.y:e.min.y,tg.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(tg)<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 P3(){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 TO(n,e){const t=e.isWebGL2,i=new WeakMap;function r(f,h){const d=f.array,p=f.usage,m=n.createBuffer();n.bindBuffer(h,m),n.bufferData(h,d,p),f.onUploadCallback();let _;if(d instanceof Float32Array)_=n.FLOAT;else if(d instanceof Uint16Array)if(f.isFloat16BufferAttribute)if(t)_=n.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else _=n.UNSIGNED_SHORT;else if(d instanceof Int16Array)_=n.SHORT;else if(d instanceof Uint32Array)_=n.UNSIGNED_INT;else if(d instanceof Int32Array)_=n.INT;else if(d instanceof Int8Array)_=n.BYTE;else if(d instanceof Uint8Array)_=n.UNSIGNED_BYTE;else if(d instanceof Uint8ClampedArray)_=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:m,type:_,bytesPerElement:d.BYTES_PER_ELEMENT,version:f.version}}function s(f,h,d){const p=h.array,m=h.updateRange;n.bindBuffer(d,f),m.count===-1?n.bufferSubData(d,0,p):(t?n.bufferSubData(d,m.offset*p.BYTES_PER_ELEMENT,p,m.offset,m.count):n.bufferSubData(d,m.offset*p.BYTES_PER_ELEMENT,p.subarray(m.offset,m.offset+m.count)),m.count=-1),h.onUploadCallback()}function o(f){return f.isInterleavedBufferAttribute&&(f=f.data),i.get(f)}function a(f){f.isInterleavedBufferAttribute&&(f=f.data);const h=i.get(f);h&&(n.deleteBuffer(h.buffer),i.delete(f))}function l(f,h){if(f.isGLBufferAttribute){const p=i.get(f);(!p||p.version 0 vec4 plane; #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`,OO=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,zO=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif`,BO=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif`,HO=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; #endif`,VO=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; #endif`,GO=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; #endif`,WO=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) vColor = vec3( 1.0 ); #endif #ifdef USE_COLOR vColor *= color; #endif #ifdef USE_INSTANCING_COLOR vColor.xyz *= instanceColor.xyz; #endif`,XO=`#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; }; struct GeometricContext { vec3 position; vec3 normal; vec3 viewDir; #ifdef USE_CLEARCOAT vec3 clearcoatNormal; #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; } float luminance( const in vec3 rgb ) { const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); return dot( weights, rgb ); } 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`,YO=`#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_v0 0.339 #define cubeUV_m0 - 2.0 #define cubeUV_r1 0.8 #define cubeUV_v1 0.276 #define cubeUV_m1 - 1.0 #define cubeUV_r4 0.4 #define cubeUV_v4 0.046 #define cubeUV_m4 2.0 #define cubeUV_r5 0.305 #define cubeUV_v5 0.016 #define cubeUV_m5 3.0 #define cubeUV_r6 0.21 #define cubeUV_v6 0.0038 #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`,jO=`vec3 transformedNormal = objectNormal; #ifdef USE_INSTANCING mat3 m = mat3( instanceMatrix ); transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); transformedNormal = m * transformedNormal; #endif transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedNormal = - transformedNormal; #endif #ifdef USE_TANGENT vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif #endif`,qO=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`,ZO=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); #endif`,KO=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; #endif`,JO=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`,QO="gl_FragColor = linearToOutputTexel( gl_FragColor );",$O=`vec4 LinearToLinear( in vec4 value ) { return value; } vec4 LinearTosRGB( 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 ); }`,ez=`#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, 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`,tz=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #else uniform sampler2D envMap; #endif #endif`,nz=`#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`,iz=`#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`,rz=`#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`,sz=`#ifdef USE_FOG vFogDepth = - mvPosition.z; #endif`,oz=`#ifdef USE_FOG varying float vFogDepth; #endif`,az=`#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`,lz=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`,uz=`#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 }`,cz=`#ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; reflectedLight.indirectDiffuse += lightMapIrradiance; #endif`,fz=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`,hz=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularStrength = specularStrength;`,dz=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; }; void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, 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`,pz=`uniform bool receiveShadow; uniform vec3 ambientLightColor; uniform vec3 lightProbe[ 9 ]; 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 ) { #if defined ( LEGACY_LIGHTS ) if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); } return 1.0; #else float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); if ( cutoffDistance > 0.0 ) { distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); } return distanceFalloff; #endif } 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, const in GeometricContext geometry, 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 GeometricContext geometry, out IncidentLight light ) { vec3 lVector = pointLight.position - geometry.position; 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 GeometricContext geometry, out IncidentLight light ) { vec3 lVector = spotLight.position - geometry.position; 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`,mz=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, 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, 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`,gz=`ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`,vz=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, 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`,_z=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`,yz=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; float specularShininess; float specularStrength; }; void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength; } void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, 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`,xz=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); 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_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 ); 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`,Sz=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; float specularF90; #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 clearcoatSpecular = vec3( 0.0 ); vec3 sheenSpecular = 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { vec3 normal = geometry.normal; vec3 viewDir = geometry.viewDir; vec3 position = geometry.position; 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; #ifdef USE_CLEARCOAT float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); vec3 ccIrradiance = dotNLcc * directLight.color; clearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material ); #endif #ifdef USE_SHEEN sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness ); #endif reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material ); reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { #ifdef USE_CLEARCOAT clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); #endif #ifdef USE_SHEEN sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness ); #endif vec3 singleScattering = vec3( 0.0 ); vec3 multiScattering = vec3( 0.0 ); vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; #ifdef USE_IRIDESCENCE computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); #else computeMultiscattering( geometry.normal, geometry.viewDir, 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 ); }`,Mz=` GeometricContext geometry; geometry.position = - vViewPosition; geometry.normal = normal; geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); #ifdef USE_CLEARCOAT geometry.clearcoatNormal = clearcoatNormal; #endif #ifdef USE_IRIDESCENCE float dotNVi = saturate( dot( normal, geometry.viewDir ) ); 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, geometry, 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.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; #endif RE_Direct( directLight, geometry, 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, geometry, 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.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometry, 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, geometry, 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.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometry, 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, geometry, material, reflectedLight ); } #pragma unroll_loop_end #endif #if defined( RE_IndirectDiffuse ) vec3 iblIrradiance = vec3( 0.0 ); vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); irradiance += getLightProbeIrradiance( lightProbe, geometry.normal ); #if ( NUM_HEMI_LIGHTS > 0 ) #pragma unroll_loop_start for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); } #pragma unroll_loop_end #endif #endif #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); #endif`,wz=`#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( geometry.normal ); #endif #endif #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) #ifdef USE_ANISOTROPY radiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy ); #else radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness ); #endif #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); #endif #endif`,Ez=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); #endif`,Tz=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,Az=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`,Cz=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif #endif`,Rz=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); #else if ( isPerspectiveMatrix( projectionMatrix ) ) { gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; gl_Position.z *= gl_Position.w; } #endif #endif`,bz=`#ifdef USE_MAP diffuseColor *= texture2D( map, vMapUv ); #endif`,Pz=`#ifdef USE_MAP uniform sampler2D map; #endif`,Lz=`#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`,Iz=`#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`,Dz=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; #endif`,Nz=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`,Fz=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) 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`,Uz=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; } #else objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; #endif #endif`,kz=`#ifdef USE_MORPHTARGETS uniform float morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 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 ); } #else #ifndef USE_MORPHNORMALS uniform float morphTargetInfluences[ 8 ]; #else uniform float morphTargetInfluences[ 4 ]; #endif #endif #endif`,Oz=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; } #else transformed += morphTarget0 * morphTargetInfluences[ 0 ]; transformed += morphTarget1 * morphTargetInfluences[ 1 ]; transformed += morphTarget2 * morphTargetInfluences[ 2 ]; transformed += morphTarget3 * morphTargetInfluences[ 3 ]; #ifndef USE_MORPHNORMALS transformed += morphTarget4 * morphTargetInfluences[ 4 ]; transformed += morphTarget5 * morphTargetInfluences[ 5 ]; transformed += morphTarget6 * morphTargetInfluences[ 6 ]; transformed += morphTarget7 * morphTargetInfluences[ 7 ]; #endif #endif #endif`,zz=`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, vNormalMapUv ); #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 geometryNormal = normal;`,Bz=`#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`,Hz=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,Vz=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,Gz=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif`,Wz=`#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`,Xz=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = geometryNormal; #endif`,Yz=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); #endif`,jz=`#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`,qz=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; #endif`,Zz=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Kz=`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 vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); const float ShiftRight8 = 1. / 256.; vec4 packDepthToRGBA( const in float v ) { vec4 r = vec4( fract( v * PackFactors ), v ); r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; } float unpackRGBAToDepth( const in vec4 v ) { return dot( v, UnpackFactors ); } vec2 packDepthToRG( in highp float v ) { return packDepthToRGBA( v ).yx; } float unpackRGToDepth( const in highp vec2 v ) { return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); } vec4 pack2HalfToRGBA( 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( 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 ); }`,Jz=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`,Qz=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;`,$z=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`,e4=`#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`,t4=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; #endif`,n4=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`,i4=`#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 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 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 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 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 shadow; } 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 shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); vec3 lightToPosition = shadowCoord.xyz; float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; vec3 bd3D = normalize( lightToPosition ); #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; return ( 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 return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } #endif`,r4=`#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 shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 struct SpotLightShadow { 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 shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif #endif`,s4=`#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`,o4=`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.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.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.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; } #pragma unroll_loop_end #endif #endif return shadow; }`,a4=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`,l4=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; uniform int boneTextureSize; mat4 getBoneMatrix( const in float i ) { float j = i * 4.0; float x = mod( j, float( boneTextureSize ) ); float y = floor( j / float( boneTextureSize ) ); float dx = 1.0 / float( boneTextureSize ); float dy = 1.0 / float( boneTextureSize ); y = dy * ( y + 0.5 ); vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); mat4 bone = mat4( v1, v2, v3, v4 ); return bone; } #endif`,u4=`#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`,c4=`#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`,f4=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`,h4=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`,d4=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`,p4=`#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 ); } vec3 CustomToneMapping( vec3 color ) { return color; }`,m4=`#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.ior, material.thickness, material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); #endif`,g4=`#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 ior, const in float thickness, const in vec3 attenuationColor, const in float attenuationDistance ) { 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; vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 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`,v4=`#ifdef USE_UV 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`,_4=`#ifdef USE_UV 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`,y4=`#ifdef USE_UV 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`,x4=`#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_INSTANCING worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; #endif`;const S4=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`,M4=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { vec4 texColor = texture2D( t2D, vUv ); texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,w4=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,E4=`#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; varying vec3 vWorldDirection; #include void main() { #ifdef ENVMAP_TYPE_CUBE vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); #elif defined( ENVMAP_TYPE_CUBE_UV ) vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness ); #else vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,T4=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,A4=`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 }`,C4=`#include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vHighPrecisionZW = gl_Position.zw; }`,R4=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include vec4 diffuseColor = vec4( 1.0 ); #if DEPTH_PACKING == 3200 diffuseColor.a = opacity; #endif #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 ); #endif }`,b4=`#define DISTANCE varying vec3 vWorldPosition; #include #include #include #include #include #include void main() { #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vWorldPosition = worldPosition.xyz; }`,P4=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; varying vec3 vWorldPosition; #include #include #include #include #include #include #include void main () { #include vec4 diffuseColor = vec4( 1.0 ); #include #include #include float dist = length( vWorldPosition - referencePosition ); dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); }`,L4=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`,I4=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include }`,D4=`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 }`,N4=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; varying float vLineDistance; #include #include #include #include #include #include #include void main() { #include if ( mod( vLineDistance, totalSize ) > dashSize ) { discard; } vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,F4=`#include #include #include #include #include #include #include #include #include void main() { #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 }`,U4=`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 void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); #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 }`,k4=`#define LAMBERT 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 vViewPosition = - mvPosition.xyz; #include #include #include #include }`,O4=`#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 void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); 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 #include }`,z4=`#define MATCAP varying vec3 vViewPosition; #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 vViewPosition = - mvPosition.xyz; }`,B4=`#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 void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); #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 }`,H4=`#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 void main() { #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 }`,V4=`#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() { #include #include #include #include gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); #ifdef OPAQUE gl_FragColor.a = 1.0; #endif }`,G4=`#define PHONG 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 vViewPosition = - mvPosition.xyz; #include #include #include #include }`,W4=`#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 void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); 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 + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,X4=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; #endif #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 vViewPosition = - mvPosition.xyz; #include #include #include #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif }`,Y4=`#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_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 void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); 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 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 + sheenSpecular; #endif #ifdef USE_CLEARCOAT float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; #endif #include #include #include #include #include #include }`,j4=`#define TOON 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 vViewPosition = - mvPosition.xyz; #include #include #include }`,q4=`#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 void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); 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 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include }`,Z4=`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 gl_PointSize = size; #ifdef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); #endif #include #include #include #include }`,K4=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include void main() { #include vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,J4=`#include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include }`,Q4=`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 }`,$4=`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 }`,eB=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include void main() { #include vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include }`,Ht={alphamap_fragment:AO,alphamap_pars_fragment:CO,alphatest_fragment:RO,alphatest_pars_fragment:bO,aomap_fragment:PO,aomap_pars_fragment:LO,begin_vertex:IO,beginnormal_vertex:DO,bsdfs:NO,iridescence_fragment:FO,bumpmap_pars_fragment:UO,clipping_planes_fragment:kO,clipping_planes_pars_fragment:OO,clipping_planes_pars_vertex:zO,clipping_planes_vertex:BO,color_fragment:HO,color_pars_fragment:VO,color_pars_vertex:GO,color_vertex:WO,common:XO,cube_uv_reflection_fragment:YO,defaultnormal_vertex:jO,displacementmap_pars_vertex:qO,displacementmap_vertex:ZO,emissivemap_fragment:KO,emissivemap_pars_fragment:JO,encodings_fragment:QO,encodings_pars_fragment:$O,envmap_fragment:ez,envmap_common_pars_fragment:tz,envmap_pars_fragment:nz,envmap_pars_vertex:iz,envmap_physical_pars_fragment:mz,envmap_vertex:rz,fog_vertex:sz,fog_pars_vertex:oz,fog_fragment:az,fog_pars_fragment:lz,gradientmap_pars_fragment:uz,lightmap_fragment:cz,lightmap_pars_fragment:fz,lights_lambert_fragment:hz,lights_lambert_pars_fragment:dz,lights_pars_begin:pz,lights_toon_fragment:gz,lights_toon_pars_fragment:vz,lights_phong_fragment:_z,lights_phong_pars_fragment:yz,lights_physical_fragment:xz,lights_physical_pars_fragment:Sz,lights_fragment_begin:Mz,lights_fragment_maps:wz,lights_fragment_end:Ez,logdepthbuf_fragment:Tz,logdepthbuf_pars_fragment:Az,logdepthbuf_pars_vertex:Cz,logdepthbuf_vertex:Rz,map_fragment:bz,map_pars_fragment:Pz,map_particle_fragment:Lz,map_particle_pars_fragment:Iz,metalnessmap_fragment:Dz,metalnessmap_pars_fragment:Nz,morphcolor_vertex:Fz,morphnormal_vertex:Uz,morphtarget_pars_vertex:kz,morphtarget_vertex:Oz,normal_fragment_begin:zz,normal_fragment_maps:Bz,normal_pars_fragment:Hz,normal_pars_vertex:Vz,normal_vertex:Gz,normalmap_pars_fragment:Wz,clearcoat_normal_fragment_begin:Xz,clearcoat_normal_fragment_maps:Yz,clearcoat_pars_fragment:jz,iridescence_pars_fragment:qz,output_fragment:Zz,packing:Kz,premultiplied_alpha_fragment:Jz,project_vertex:Qz,dithering_fragment:$z,dithering_pars_fragment:e4,roughnessmap_fragment:t4,roughnessmap_pars_fragment:n4,shadowmap_pars_fragment:i4,shadowmap_pars_vertex:r4,shadowmap_vertex:s4,shadowmask_pars_fragment:o4,skinbase_vertex:a4,skinning_pars_vertex:l4,skinning_vertex:u4,skinnormal_vertex:c4,specularmap_fragment:f4,specularmap_pars_fragment:h4,tonemapping_fragment:d4,tonemapping_pars_fragment:p4,transmission_fragment:m4,transmission_pars_fragment:g4,uv_pars_fragment:v4,uv_pars_vertex:_4,uv_vertex:y4,worldpos_vertex:x4,background_vert:S4,background_frag:M4,backgroundCube_vert:w4,backgroundCube_frag:E4,cube_vert:T4,cube_frag:A4,depth_vert:C4,depth_frag:R4,distanceRGBA_vert:b4,distanceRGBA_frag:P4,equirect_vert:L4,equirect_frag:I4,linedashed_vert:D4,linedashed_frag:N4,meshbasic_vert:F4,meshbasic_frag:U4,meshlambert_vert:k4,meshlambert_frag:O4,meshmatcap_vert:z4,meshmatcap_frag:B4,meshnormal_vert:H4,meshnormal_frag:V4,meshphong_vert:G4,meshphong_frag:W4,meshphysical_vert:X4,meshphysical_frag:Y4,meshtoon_vert:j4,meshtoon_frag:q4,points_vert:Z4,points_frag:K4,shadow_vert:J4,shadow_frag:Q4,sprite_vert:$4,sprite_frag:eB},Xe={common:{diffuse:{value:new Ge(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Vt},alphaMap:{value:null},alphaMapTransform:{value:new Vt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Vt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Vt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Vt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Vt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Vt},normalScale:{value:new be(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Vt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Vt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Vt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Vt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ge(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{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 Ge(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Vt},alphaTest:{value:0},uvTransform:{value:new Vt}},sprite:{diffuse:{value:new Ge(16777215)},opacity:{value:1},center:{value:new be(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Vt},alphaMap:{value:null},alphaMapTransform:{value:new Vt},alphaTest:{value:0}}},Ws={basic:{uniforms:ir([Xe.common,Xe.specularmap,Xe.envmap,Xe.aomap,Xe.lightmap,Xe.fog]),vertexShader:Ht.meshbasic_vert,fragmentShader:Ht.meshbasic_frag},lambert:{uniforms:ir([Xe.common,Xe.specularmap,Xe.envmap,Xe.aomap,Xe.lightmap,Xe.emissivemap,Xe.bumpmap,Xe.normalmap,Xe.displacementmap,Xe.fog,Xe.lights,{emissive:{value:new Ge(0)}}]),vertexShader:Ht.meshlambert_vert,fragmentShader:Ht.meshlambert_frag},phong:{uniforms:ir([Xe.common,Xe.specularmap,Xe.envmap,Xe.aomap,Xe.lightmap,Xe.emissivemap,Xe.bumpmap,Xe.normalmap,Xe.displacementmap,Xe.fog,Xe.lights,{emissive:{value:new Ge(0)},specular:{value:new Ge(1118481)},shininess:{value:30}}]),vertexShader:Ht.meshphong_vert,fragmentShader:Ht.meshphong_frag},standard:{uniforms:ir([Xe.common,Xe.envmap,Xe.aomap,Xe.lightmap,Xe.emissivemap,Xe.bumpmap,Xe.normalmap,Xe.displacementmap,Xe.roughnessmap,Xe.metalnessmap,Xe.fog,Xe.lights,{emissive:{value:new Ge(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ht.meshphysical_vert,fragmentShader:Ht.meshphysical_frag},toon:{uniforms:ir([Xe.common,Xe.aomap,Xe.lightmap,Xe.emissivemap,Xe.bumpmap,Xe.normalmap,Xe.displacementmap,Xe.gradientmap,Xe.fog,Xe.lights,{emissive:{value:new Ge(0)}}]),vertexShader:Ht.meshtoon_vert,fragmentShader:Ht.meshtoon_frag},matcap:{uniforms:ir([Xe.common,Xe.bumpmap,Xe.normalmap,Xe.displacementmap,Xe.fog,{matcap:{value:null}}]),vertexShader:Ht.meshmatcap_vert,fragmentShader:Ht.meshmatcap_frag},points:{uniforms:ir([Xe.points,Xe.fog]),vertexShader:Ht.points_vert,fragmentShader:Ht.points_frag},dashed:{uniforms:ir([Xe.common,Xe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ht.linedashed_vert,fragmentShader:Ht.linedashed_frag},depth:{uniforms:ir([Xe.common,Xe.displacementmap]),vertexShader:Ht.depth_vert,fragmentShader:Ht.depth_frag},normal:{uniforms:ir([Xe.common,Xe.bumpmap,Xe.normalmap,Xe.displacementmap,{opacity:{value:1}}]),vertexShader:Ht.meshnormal_vert,fragmentShader:Ht.meshnormal_frag},sprite:{uniforms:ir([Xe.sprite,Xe.fog]),vertexShader:Ht.sprite_vert,fragmentShader:Ht.sprite_frag},background:{uniforms:{uvTransform:{value:new Vt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ht.background_vert,fragmentShader:Ht.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Ht.backgroundCube_vert,fragmentShader:Ht.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ht.cube_vert,fragmentShader:Ht.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ht.equirect_vert,fragmentShader:Ht.equirect_frag},distanceRGBA:{uniforms:ir([Xe.common,Xe.displacementmap,{referencePosition:{value:new V},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ht.distanceRGBA_vert,fragmentShader:Ht.distanceRGBA_frag},shadow:{uniforms:ir([Xe.lights,Xe.fog,{color:{value:new Ge(0)},opacity:{value:1}}]),vertexShader:Ht.shadow_vert,fragmentShader:Ht.shadow_frag}};Ws.physical={uniforms:ir([Ws.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Vt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Vt},clearcoatNormalScale:{value:new be(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Vt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Vt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Vt},sheen:{value:0},sheenColor:{value:new Ge(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Vt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Vt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Vt},transmissionSamplerSize:{value:new be},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Vt},attenuationDistance:{value:0},attenuationColor:{value:new Ge(0)},specularColor:{value:new Ge(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Vt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Vt},anisotropyVector:{value:new be},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Vt}}]),vertexShader:Ht.meshphysical_vert,fragmentShader:Ht.meshphysical_frag};const ng={r:0,b:0,g:0};function tB(n,e,t,i,r,s,o){const a=new Ge(0);let l=s===!0?0:1,f,h,d=null,p=0,m=null;function _(y,g){let M=!1,S=g.isScene===!0?g.background:null;switch(S&&S.isTexture&&(S=(g.backgroundBlurriness>0?t:e).get(S)),S===null?x(a,l):S&&S.isColor&&(x(S,1),M=!0),n.xr.getEnvironmentBlendMode()){case"opaque":M=!0;break;case"additive":i.buffers.color.setClear(0,0,0,1,o),M=!0;break;case"alpha-blend":i.buffers.color.setClear(0,0,0,0,o),M=!0;break}(n.autoClear||M)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),S&&(S.isCubeTexture||S.mapping===Lf)?(h===void 0&&(h=new Mi(new vl(1,1,1),new Ps({name:"BackgroundCubeMaterial",uniforms:_f(Ws.backgroundCube.uniforms),vertexShader:Ws.backgroundCube.vertexShader,fragmentShader:Ws.backgroundCube.fragmentShader,side:qi,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(R,P,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(h)),h.material.uniforms.envMap.value=S,h.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,h.material.toneMapped=S.colorSpace!==kt,(d!==S||p!==S.version||m!==n.toneMapping)&&(h.material.needsUpdate=!0,d=S,p=S.version,m=n.toneMapping),h.layers.enableAll(),y.unshift(h,h.geometry,h.material,0,0,null)):S&&S.isTexture&&(f===void 0&&(f=new Mi(new Df(2,2),new Ps({name:"BackgroundMaterial",uniforms:_f(Ws.background.uniforms),vertexShader:Ws.background.vertexShader,fragmentShader:Ws.background.fragmentShader,side:wo,depthTest:!1,depthWrite:!1,fog:!1})),f.geometry.deleteAttribute("normal"),Object.defineProperty(f.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(f)),f.material.uniforms.t2D.value=S,f.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,f.material.toneMapped=S.colorSpace!==kt,S.matrixAutoUpdate===!0&&S.updateMatrix(),f.material.uniforms.uvTransform.value.copy(S.matrix),(d!==S||p!==S.version||m!==n.toneMapping)&&(f.material.needsUpdate=!0,d=S,p=S.version,m=n.toneMapping),f.layers.enableAll(),y.unshift(f,f.geometry,f.material,0,0,null))}function x(y,g){y.getRGB(ng,b3(n)),i.buffers.color.setClear(ng.r,ng.g,ng.b,g,o)}return{getClearColor:function(){return a},setClearColor:function(y,g=1){a.set(y),l=g,x(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(y){l=y,x(a,l)},render:_}}function nB(n,e,t,i){const r=n.getParameter(n.MAX_VERTEX_ATTRIBS),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||s!==null,a={},l=y(null);let f=l,h=!1;function d(Q,ee,oe,$,k){let G=!1;if(o){const F=x($,oe,ee);f!==F&&(f=F,m(f.object)),G=g(Q,$,oe,k),G&&M(Q,$,oe,k)}else{const F=ee.wireframe===!0;(f.geometry!==$.id||f.program!==oe.id||f.wireframe!==F)&&(f.geometry=$.id,f.program=oe.id,f.wireframe=F,G=!0)}k!==null&&t.update(k,n.ELEMENT_ARRAY_BUFFER),(G||h)&&(h=!1,D(Q,ee,oe,$),k!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(k).buffer))}function p(){return i.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function m(Q){return i.isWebGL2?n.bindVertexArray(Q):s.bindVertexArrayOES(Q)}function _(Q){return i.isWebGL2?n.deleteVertexArray(Q):s.deleteVertexArrayOES(Q)}function x(Q,ee,oe){const $=oe.wireframe===!0;let k=a[Q.id];k===void 0&&(k={},a[Q.id]=k);let G=k[ee.id];G===void 0&&(G={},k[ee.id]=G);let F=G[$];return F===void 0&&(F=y(p()),G[$]=F),F}function y(Q){const ee=[],oe=[],$=[];for(let k=0;k=0){const le=k[j];let Pe=G[j];if(Pe===void 0&&(j==="instanceMatrix"&&Q.instanceMatrix&&(Pe=Q.instanceMatrix),j==="instanceColor"&&Q.instanceColor&&(Pe=Q.instanceColor)),le===void 0||le.attribute!==Pe||Pe&&le.data!==Pe.data)return!0;F++}return f.attributesNum!==F||f.index!==$}function M(Q,ee,oe,$){const k={},G=ee.attributes;let F=0;const re=oe.getAttributes();for(const j in re)if(re[j].location>=0){let le=G[j];le===void 0&&(j==="instanceMatrix"&&Q.instanceMatrix&&(le=Q.instanceMatrix),j==="instanceColor"&&Q.instanceColor&&(le=Q.instanceColor));const Pe={};Pe.attribute=le,le&&le.data&&(Pe.data=le.data),k[j]=Pe,F++}f.attributes=k,f.attributesNum=F,f.index=$}function S(){const Q=f.newAttributes;for(let ee=0,oe=Q.length;ee=0){let ve=k[re];if(ve===void 0&&(re==="instanceMatrix"&&Q.instanceMatrix&&(ve=Q.instanceMatrix),re==="instanceColor"&&Q.instanceColor&&(ve=Q.instanceColor)),ve!==void 0){const le=ve.normalized,Pe=ve.itemSize,_e=t.get(ve);if(_e===void 0)continue;const Re=_e.buffer,nt=_e.type,it=_e.bytesPerElement,Pt=i.isWebGL2===!0&&(nt===n.INT||nt===n.UNSIGNED_INT||ve.gpuType===IM);if(ve.isInterleavedBufferAttribute){const Ze=ve.data,Z=Ze.stride,we=ve.offset;if(Ze.isInstancedInterleavedBuffer){for(let ye=0;ye0&&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"}const o=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const f=o||e.has("WEBGL_draw_buffers"),h=t.logarithmicDepthBuffer===!0,d=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),p=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_TEXTURE_SIZE),_=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),x=n.getParameter(n.MAX_VERTEX_ATTRIBS),y=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),g=n.getParameter(n.MAX_VARYING_VECTORS),M=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),S=p>0,E=o||e.has("OES_texture_float"),C=S&&E,R=o?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:f,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:h,maxTextures:d,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:_,maxAttributes:x,maxVertexUniforms:y,maxVaryings:g,maxFragmentUniforms:M,vertexTextures:S,floatFragmentTextures:E,floatVertexTextures:C,maxSamples:R}}function sB(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new Ia,a=new Vt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,p){const m=d.length!==0||p||i!==0||r;return r=p,i=d.length,m},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,p){t=h(d,p,0)},this.setState=function(d,p,m){const _=d.clippingPlanes,x=d.clipIntersection,y=d.clipShadows,g=n.get(d);if(!r||_===null||_.length===0||s&&!y)s?h(null):f();else{const M=s?0:i,S=M*4;let E=g.clippingState||null;l.value=E,E=h(_,p,S,m);for(let C=0;C!==S;++C)E[C]=t[C];g.clippingState=E,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=M}};function f(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(d,p,m,_){const x=d!==null?d.length:0;let y=null;if(x!==0){if(y=l.value,_!==!0||y===null){const g=m+x*4,M=p.matrixWorldInverse;a.getNormalMatrix(M),(y===null||y.length0){const f=new Tv(l.height/2);return f.fromEquirectangularTexture(n,o),e.set(o,f),o.addEventListener("dispose",r),t(f.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 dp extends fp{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 f=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=f*this.view.offsetX,o=s+f*this.view.width,a-=h*this.view.offsetY,l=a-h*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 Hc=4,rC=[.125,.215,.35,.446,.526,.582],jl=20,Fy=new dp,sC=new Ge;let Uy=null;const Vl=(1+Math.sqrt(5))/2,hc=1/Vl,oC=[new V(1,1,1),new V(-1,1,1),new V(1,1,-1),new V(-1,1,-1),new V(0,Vl,hc),new V(0,Vl,-hc),new V(hc,0,Vl),new V(-hc,0,Vl),new V(Vl,hc,0),new V(-Vl,hc,0)];class Z1{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){Uy=this._renderer.getRenderTarget(),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=uC(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=lC(),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?S:0,S,S),h.setRenderTarget(r),x&&h.render(_,a),h.render(e,a)}_.geometry.dispose(),_.material.dispose(),h.toneMapping=p,h.autoClear=d,e.background=y}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===oa||e.mapping===ol;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=uC()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=lC());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new Mi(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;ig(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,Fy)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let r=1;rjl&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${jl}`);const g=[];let M=0;for(let P=0;PS-Hc?r-S+Hc:0),R=4*(this._cubeSize-E);ig(t,C,R,3*E,2*E),l.setRenderTarget(t),l.render(d,Fy)}}function aB(n){const e=[],t=[],i=[];let r=n;const s=n-Hc+1+rC.length;for(let o=0;on-Hc?l=rC[o-n+Hc-1]:o===0&&(l=0),i.push(l);const f=1/(a-2),h=-f,d=1+f,p=[h,h,d,h,d,d,h,h,d,d,h,d],m=6,_=6,x=3,y=2,g=1,M=new Float32Array(x*_*m),S=new Float32Array(y*_*m),E=new Float32Array(g*_*m);for(let R=0;R2?0:-1,b=[P,D,0,P+2/3,D,0,P+2/3,D+1,0,P,D,0,P+2/3,D+1,0,P,D+1,0];M.set(b,x*_*R),S.set(p,y*_*R);const I=[R,R,R,R,R,R];E.set(I,g*_*R)}const C=new Wt;C.setAttribute("position",new xn(M,x)),C.setAttribute("uv",new xn(S,y)),C.setAttribute("faceIndex",new xn(E,g)),e.push(C),r>Hc&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function aC(n,e,t){const i=new bs(n,e,t);return i.texture.mapping=Lf,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function ig(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function lB(n,e,t){const i=new Float32Array(jl),r=new V(0,1,0);return new Ps({name:"SphericalGaussianBlur",defines:{n:jl,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:KM(),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:ea,depthTest:!1,depthWrite:!1})}function lC(){return new Ps({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:KM(),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:ea,depthTest:!1,depthWrite:!1})}function uC(){return new Ps({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:KM(),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:ea,depthTest:!1,depthWrite:!1})}function KM(){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 uB(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,f=l===gf||l===Ld,h=l===oa||l===ol;if(f||h)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let d=e.get(a);return t===null&&(t=new Z1(n)),d=f?t.fromEquirectangular(a,d):t.fromCubemap(a,d),e.set(a,d),d.texture}else{if(e.has(a))return e.get(a).texture;{const d=a.image;if(f&&d&&d.height>0||h&&d&&r(d)){t===null&&(t=new Z1(n));const p=f?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,p),a.addEventListener("dispose",s),p.texture}else return null}}}return a}function r(a){let l=0;const f=6;for(let h=0;he.maxTextureSize&&(z=Math.ceil(I/e.maxTextureSize),I=e.maxTextureSize);const q=new Float32Array(I*z*4*x),J=new Ev(q,I,z,x);J.type=Pi,J.needsUpdate=!0;const Q=b*4;for(let oe=0;oe0)return n;const r=e*t;let s=cC[r];if(s===void 0&&(s=new Float32Array(r),cC[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 hi(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${a}: ${t[o]}`)}return i.join(` `)}function c5(n){switch(n){case Js:return["Linear","( value )"];case kt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),["Linear","( value )"]}}function vC(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+` `+u5(n.getShaderSource(e),o)}else return r}function f5(n,e){const t=c5(e);return"vec4 "+n+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function h5(n,e){let t;switch(e){case $P:t="Linear";break;case e3:t="Reinhard";break;case t3:t="OptimizedCineon";break;case PM:t="ACESFilmic";break;case n3:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function d5(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.normalMapTangentSpace||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Fh).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 K1(n){return n.replace(g5,v5)}function v5(n,e){const t=Ht[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return K1(t)}const _5=/#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 xC(n){return n.replace(_5,y5)}function y5(n,e,t,i){let r="";for(let s=parseInt(e);s0&&(y+=` `),g=[m,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Fh).join(` `),g.length>0&&(g+=` `)):(y=[SC(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",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 "+h:"",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.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.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?"#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&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#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.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","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","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","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` `].filter(Fh).join(` `),g=[m,SC(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.envMap?"#define "+h:"",t.envMap?"#define "+d:"",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.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.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?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#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.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ts?"#define TONE_MAPPING":"",t.toneMapping!==Ts?Ht.tonemapping_pars_fragment:"",t.toneMapping!==Ts?h5("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Ht.encodings_pars_fragment,f5("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `].filter(Fh).join(` `)),o=K1(o),o=_C(o,t),o=yC(o,t),a=K1(a),a=_C(a,t),a=yC(a,t),o=xC(o),a=xC(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(M=`#version 300 es `,y=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+y,g=["#define varying in",t.glslVersion===j1?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===j1?"":"#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(` `)+` `+g);const S=M+y+o,E=M+g+a,C=gC(r,r.VERTEX_SHADER,S),R=gC(r,r.FRAGMENT_SHADER,E);if(r.attachShader(x,C),r.attachShader(x,R),t.index0AttributeName!==void 0?r.bindAttribLocation(x,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(x,0,"position"),r.linkProgram(x),n.debug.checkShaderErrors){const b=r.getProgramInfoLog(x).trim(),I=r.getShaderInfoLog(C).trim(),z=r.getShaderInfoLog(R).trim();let q=!0,J=!0;if(r.getProgramParameter(x,r.LINK_STATUS)===!1)if(q=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,x,C,R);else{const Q=vC(r,C,"vertex"),ee=vC(r,R,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(x,r.VALIDATE_STATUS)+` Program Info Log: `+b+` `+Q+` `+ee)}else b!==""?console.warn("THREE.WebGLProgram: Program Info Log:",b):(I===""||z==="")&&(J=!1);J&&(this.diagnostics={runnable:q,programLog:b,vertexShader:{log:I,prefix:y},fragmentShader:{log:z,prefix:g}})}r.deleteShader(C),r.deleteShader(R);let P;this.getUniforms=function(){return P===void 0&&(P=new o0(r,x)),P};let D;return this.getAttributes=function(){return D===void 0&&(D=m5(r,x)),D},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(x),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=l5++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=C,this.fragmentShader=R,this}let A5=0;class C5{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=A5++,this.code=e,this.usedTimes=0}}function b5(n,e,t,i,r,s,o){const a=new lu,l=new C5,f=[],h=r.isWebGL2,d=r.logarithmicDepthBuffer,p=r.vertexTextures;let m=r.precision;const _={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 x(b){return b===0?"uv":`uv${b}`}function y(b,I,z,q,J){const Q=q.fog,ee=J.geometry,oe=b.isMeshStandardMaterial?q.environment:null,$=(b.isMeshStandardMaterial?t:e).get(b.envMap||oe),k=$&&$.mapping===Lf?$.image.height:null,G=_[b.type];b.precision!==null&&(m=r.getMaxPrecision(b.precision),m!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",m,"instead."));const F=ee.morphAttributes.position||ee.morphAttributes.normal||ee.morphAttributes.color,re=F!==void 0?F.length:0;let j=0;ee.morphAttributes.position!==void 0&&(j=1),ee.morphAttributes.normal!==void 0&&(j=2),ee.morphAttributes.color!==void 0&&(j=3);let ve,le,Pe,_e;if(G){const tn=Ws[G];ve=tn.vertexShader,le=tn.fragmentShader}else ve=b.vertexShader,le=b.fragmentShader,l.update(b),Pe=l.getVertexShaderID(b),_e=l.getFragmentShaderID(b);const Re=n.getRenderTarget(),nt=J.isInstancedMesh===!0,it=!!b.map,Pt=!!b.matcap,Ze=!!$,Z=!!b.aoMap,we=!!b.lightMap,ye=!!b.bumpMap,Ie=!!b.normalMap,Ae=!!b.displacementMap,te=!!b.emissiveMap,He=!!b.metalnessMap,Ye=!!b.roughnessMap,mt=b.anisotropy>0,dt=b.clearcoat>0,$t=b.iridescence>0,W=b.sheen>0,O=b.transmission>0,de=mt&&!!b.anisotropyMap,Ce=dt&&!!b.clearcoatMap,Le=dt&&!!b.clearcoatNormalMap,Ue=dt&&!!b.clearcoatRoughnessMap,tt=$t&&!!b.iridescenceMap,Oe=$t&&!!b.iridescenceThicknessMap,Me=W&&!!b.sheenColorMap,rt=W&&!!b.sheenRoughnessMap,ot=!!b.specularMap,Je=!!b.specularColorMap,Qe=!!b.specularIntensityMap,je=O&&!!b.transmissionMap,ft=O&&!!b.thicknessMap,Mt=!!b.gradientMap,K=!!b.alphaMap,he=b.alphaTest>0,ce=!!b.extensions,Ne=!!ee.attributes.uv1,Be=!!ee.attributes.uv2,bt=!!ee.attributes.uv3;return{isWebGL2:h,shaderID:G,shaderType:b.type,shaderName:b.name,vertexShader:ve,fragmentShader:le,defines:b.defines,customVertexShaderID:Pe,customFragmentShaderID:_e,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:m,instancing:nt,instancingColor:nt&&J.instanceColor!==null,supportsVertexTextures:p,outputColorSpace:Re===null?n.outputColorSpace:Re.isXRRenderTarget===!0?Re.texture.colorSpace:Js,map:it,matcap:Pt,envMap:Ze,envMapMode:Ze&&$.mapping,envMapCubeUVHeight:k,aoMap:Z,lightMap:we,bumpMap:ye,normalMap:Ie,displacementMap:p&&Ae,emissiveMap:te,normalMapObjectSpace:Ie&&b.normalMapType===g3,normalMapTangentSpace:Ie&&b.normalMapType===ml,metalnessMap:He,roughnessMap:Ye,anisotropy:mt,anisotropyMap:de,clearcoat:dt,clearcoatMap:Ce,clearcoatNormalMap:Le,clearcoatRoughnessMap:Ue,iridescence:$t,iridescenceMap:tt,iridescenceThicknessMap:Oe,sheen:W,sheenColorMap:Me,sheenRoughnessMap:rt,specularMap:ot,specularColorMap:Je,specularIntensityMap:Qe,transmission:O,transmissionMap:je,thicknessMap:ft,gradientMap:Mt,opaque:b.transparent===!1&&b.blending===ou,alphaMap:K,alphaTest:he,combine:b.combine,mapUv:it&&x(b.map.channel),aoMapUv:Z&&x(b.aoMap.channel),lightMapUv:we&&x(b.lightMap.channel),bumpMapUv:ye&&x(b.bumpMap.channel),normalMapUv:Ie&&x(b.normalMap.channel),displacementMapUv:Ae&&x(b.displacementMap.channel),emissiveMapUv:te&&x(b.emissiveMap.channel),metalnessMapUv:He&&x(b.metalnessMap.channel),roughnessMapUv:Ye&&x(b.roughnessMap.channel),anisotropyMapUv:de&&x(b.anisotropyMap.channel),clearcoatMapUv:Ce&&x(b.clearcoatMap.channel),clearcoatNormalMapUv:Le&&x(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ue&&x(b.clearcoatRoughnessMap.channel),iridescenceMapUv:tt&&x(b.iridescenceMap.channel),iridescenceThicknessMapUv:Oe&&x(b.iridescenceThicknessMap.channel),sheenColorMapUv:Me&&x(b.sheenColorMap.channel),sheenRoughnessMapUv:rt&&x(b.sheenRoughnessMap.channel),specularMapUv:ot&&x(b.specularMap.channel),specularColorMapUv:Je&&x(b.specularColorMap.channel),specularIntensityMapUv:Qe&&x(b.specularIntensityMap.channel),transmissionMapUv:je&&x(b.transmissionMap.channel),thicknessMapUv:ft&&x(b.thicknessMap.channel),alphaMapUv:K&&x(b.alphaMap.channel),vertexTangents:!!ee.attributes.tangent&&(Ie||mt),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!ee.attributes.color&&ee.attributes.color.itemSize===4,vertexUv1s:Ne,vertexUv2s:Be,vertexUv3s:bt,pointsUvs:J.isPoints===!0&&!!ee.attributes.uv&&(it||K),fog:!!Q,useFog:b.fog===!0,fogExp2:Q&&Q.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:J.isSkinnedMesh===!0,morphTargets:ee.morphAttributes.position!==void 0,morphNormals:ee.morphAttributes.normal!==void 0,morphColors:ee.morphAttributes.color!==void 0,morphTargetsCount:re,morphTextureStride:j,numDirLights:I.directional.length,numPointLights:I.point.length,numSpotLights:I.spot.length,numSpotLightMaps:I.spotLightMap.length,numRectAreaLights:I.rectArea.length,numHemiLights:I.hemi.length,numDirLightShadows:I.directionalShadowMap.length,numPointLightShadows:I.pointShadowMap.length,numSpotLightShadows:I.spotShadowMap.length,numSpotLightShadowsWithMaps:I.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:b.dithering,shadowMapEnabled:n.shadowMap.enabled&&z.length>0,shadowMapType:n.shadowMap.type,toneMapping:b.toneMapped?n.toneMapping:Ts,useLegacyLights:n.useLegacyLights,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===Ys,flipSided:b.side===qi,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionDerivatives:ce&&b.extensions.derivatives===!0,extensionFragDepth:ce&&b.extensions.fragDepth===!0,extensionDrawBuffers:ce&&b.extensions.drawBuffers===!0,extensionShaderTextureLOD:ce&&b.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),customProgramCacheKey:b.customProgramCacheKey()}}function g(b){const I=[];if(b.shaderID?I.push(b.shaderID):(I.push(b.customVertexShaderID),I.push(b.customFragmentShaderID)),b.defines!==void 0)for(const z in b.defines)I.push(z),I.push(b.defines[z]);return b.isRawShaderMaterial===!1&&(M(I,b),S(I,b),I.push(n.outputColorSpace)),I.push(b.customProgramCacheKey),I.join()}function M(b,I){b.push(I.precision),b.push(I.outputColorSpace),b.push(I.envMapMode),b.push(I.envMapCubeUVHeight),b.push(I.mapUv),b.push(I.alphaMapUv),b.push(I.lightMapUv),b.push(I.aoMapUv),b.push(I.bumpMapUv),b.push(I.normalMapUv),b.push(I.displacementMapUv),b.push(I.emissiveMapUv),b.push(I.metalnessMapUv),b.push(I.roughnessMapUv),b.push(I.anisotropyMapUv),b.push(I.clearcoatMapUv),b.push(I.clearcoatNormalMapUv),b.push(I.clearcoatRoughnessMapUv),b.push(I.iridescenceMapUv),b.push(I.iridescenceThicknessMapUv),b.push(I.sheenColorMapUv),b.push(I.sheenRoughnessMapUv),b.push(I.specularMapUv),b.push(I.specularColorMapUv),b.push(I.specularIntensityMapUv),b.push(I.transmissionMapUv),b.push(I.thicknessMapUv),b.push(I.combine),b.push(I.fogExp2),b.push(I.sizeAttenuation),b.push(I.morphTargetsCount),b.push(I.morphAttributeCount),b.push(I.numDirLights),b.push(I.numPointLights),b.push(I.numSpotLights),b.push(I.numSpotLightMaps),b.push(I.numHemiLights),b.push(I.numRectAreaLights),b.push(I.numDirLightShadows),b.push(I.numPointLightShadows),b.push(I.numSpotLightShadows),b.push(I.numSpotLightShadowsWithMaps),b.push(I.shadowMapType),b.push(I.toneMapping),b.push(I.numClippingPlanes),b.push(I.numClipIntersection),b.push(I.depthPacking)}function S(b,I){a.disableAll(),I.isWebGL2&&a.enable(0),I.supportsVertexTextures&&a.enable(1),I.instancing&&a.enable(2),I.instancingColor&&a.enable(3),I.matcap&&a.enable(4),I.envMap&&a.enable(5),I.normalMapObjectSpace&&a.enable(6),I.normalMapTangentSpace&&a.enable(7),I.clearcoat&&a.enable(8),I.iridescence&&a.enable(9),I.alphaTest&&a.enable(10),I.vertexColors&&a.enable(11),I.vertexAlphas&&a.enable(12),I.vertexUv1s&&a.enable(13),I.vertexUv2s&&a.enable(14),I.vertexUv3s&&a.enable(15),I.vertexTangents&&a.enable(16),I.anisotropy&&a.enable(17),b.push(a.mask),a.disableAll(),I.fog&&a.enable(0),I.useFog&&a.enable(1),I.flatShading&&a.enable(2),I.logarithmicDepthBuffer&&a.enable(3),I.skinning&&a.enable(4),I.morphTargets&&a.enable(5),I.morphNormals&&a.enable(6),I.morphColors&&a.enable(7),I.premultipliedAlpha&&a.enable(8),I.shadowMapEnabled&&a.enable(9),I.useLegacyLights&&a.enable(10),I.doubleSided&&a.enable(11),I.flipSided&&a.enable(12),I.useDepthPacking&&a.enable(13),I.dithering&&a.enable(14),I.transmission&&a.enable(15),I.sheen&&a.enable(16),I.opaque&&a.enable(17),I.pointsUvs&&a.enable(18),b.push(a.mask)}function E(b){const I=_[b.type];let z;if(I){const q=Ws[I];z=qM.clone(q.uniforms)}else z=b.uniforms;return z}function C(b,I){let z;for(let q=0,J=f.length;q0?i.push(g):m.transparent===!0?r.push(g):t.push(g)}function l(d,p,m,_,x,y){const g=o(d,p,m,_,x,y);m.transmission>0?i.unshift(g):m.transparent===!0?r.unshift(g):t.unshift(g)}function f(d,p){t.length>1&&t.sort(d||L5),i.length>1&&i.sort(p||MC),r.length>1&&r.sort(p||MC)}function h(){for(let d=e,p=n.length;d=s.length?(o=new wC,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 V,color:new Ge};break;case"SpotLight":t={position:new V,direction:new V,color:new Ge,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new V,color:new Ge,distance:0,decay:0};break;case"HemisphereLight":t={direction:new V,skyColor:new Ge,groundColor:new Ge};break;case"RectAreaLight":t={color:new Ge,position:new V,halfWidth:new V,halfHeight:new V};break}return n[e.id]=t,t}}}function N5(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new be};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new be};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new be,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let F5=0;function U5(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function k5(n,e){const t=new D5,i=N5(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-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};for(let h=0;h<9;h++)r.probe.push(new V);const s=new V,o=new Ft,a=new Ft;function l(h,d){let p=0,m=0,_=0;for(let z=0;z<9;z++)r.probe[z].set(0,0,0);let x=0,y=0,g=0,M=0,S=0,E=0,C=0,R=0,P=0,D=0;h.sort(U5);const b=d===!0?Math.PI:1;for(let z=0,q=h.length;z0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=Xe.LTC_FLOAT_1,r.rectAreaLTC2=Xe.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=Xe.LTC_HALF_1,r.rectAreaLTC2=Xe.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=p,r.ambient[1]=m,r.ambient[2]=_;const I=r.hash;(I.directionalLength!==x||I.pointLength!==y||I.spotLength!==g||I.rectAreaLength!==M||I.hemiLength!==S||I.numDirectionalShadows!==E||I.numPointShadows!==C||I.numSpotShadows!==R||I.numSpotMaps!==P)&&(r.directional.length=x,r.spot.length=g,r.rectArea.length=M,r.point.length=y,r.hemi.length=S,r.directionalShadow.length=E,r.directionalShadowMap.length=E,r.pointShadow.length=C,r.pointShadowMap.length=C,r.spotShadow.length=R,r.spotShadowMap.length=R,r.directionalShadowMatrix.length=E,r.pointShadowMatrix.length=C,r.spotLightMatrix.length=R+P-D,r.spotLightMap.length=P,r.numSpotLightShadowsWithMaps=D,I.directionalLength=x,I.pointLength=y,I.spotLength=g,I.rectAreaLength=M,I.hemiLength=S,I.numDirectionalShadows=E,I.numPointShadows=C,I.numSpotShadows=R,I.numSpotMaps=P,r.version=F5++)}function f(h,d){let p=0,m=0,_=0,x=0,y=0;const g=d.matrixWorldInverse;for(let M=0,S=h.length;M=a.length?(l=new EC(n,e),a.push(l)):l=a[o],l}function r(){t=new WeakMap}return{get:i,dispose:r}}class JM extends Ni{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=p3,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 QM extends Ni{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 ); }`,B5=`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 H5(n,e,t){let i=new Av;const r=new be,s=new be,o=new dn,a=new JM({depthPacking:m3}),l=new QM,f={},h=t.maxTextureSize,d={[wo]:qi,[qi]:wo,[Ys]:Ys},p=new Ps({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new be},radius:{value:4}},vertexShader:z5,fragmentShader:B5}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const _=new Wt;_.setAttribute("position",new xn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new Mi(_,p),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=xv;let g=this.type;this.render=function(C,R,P){if(y.enabled===!1||y.autoUpdate===!1&&y.needsUpdate===!1||C.length===0)return;const D=n.getRenderTarget(),b=n.getActiveCubeFace(),I=n.getActiveMipmapLevel(),z=n.state;z.setBlending(ea),z.buffers.color.setClear(1,1,1,1),z.buffers.depth.setTest(!0),z.setScissorTest(!1);const q=g!==Hs&&this.type===Hs,J=g===Hs&&this.type!==Hs;for(let Q=0,ee=C.length;Qh||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/k.x),r.x=s.x*k.x,$.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/k.y),r.y=s.y*k.y,$.mapSize.y=s.y)),$.map===null||q===!0||J===!0){const F=this.type!==Hs?{minFilter:$n,magFilter:$n}:{};$.map!==null&&$.map.dispose(),$.map=new bs(r.x,r.y,F),$.map.texture.name=oe.name+".shadowMap",$.camera.updateProjectionMatrix()}n.setRenderTarget($.map),n.clear();const G=$.getViewportCount();for(let F=0;F0||R.map&&R.alphaTest>0){const z=b.uuid,q=R.uuid;let J=f[z];J===void 0&&(J={},f[z]=J);let Q=J[q];Q===void 0&&(Q=b.clone(),J[q]=Q),b=Q}if(b.visible=R.visible,b.wireframe=R.wireframe,D===Hs?b.side=R.shadowSide!==null?R.shadowSide:R.side:b.side=R.shadowSide!==null?R.shadowSide:d[R.side],b.alphaMap=R.alphaMap,b.alphaTest=R.alphaTest,b.map=R.map,b.clipShadows=R.clipShadows,b.clippingPlanes=R.clippingPlanes,b.clipIntersection=R.clipIntersection,b.displacementMap=R.displacementMap,b.displacementScale=R.displacementScale,b.displacementBias=R.displacementBias,b.wireframeLinewidth=R.wireframeLinewidth,b.linewidth=R.linewidth,P.isPointLight===!0&&b.isMeshDistanceMaterial===!0){const z=n.properties.get(b);z.light=P}return b}function E(C,R,P,D,b){if(C.visible===!1)return;if(C.layers.test(R.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&b===Hs)&&(!C.frustumCulled||i.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,C.matrixWorld);const q=e.update(C),J=C.material;if(Array.isArray(J)){const Q=q.groups;for(let ee=0,oe=Q.length;ee=1):k.indexOf("OpenGL ES")!==-1&&($=parseFloat(/^OpenGL ES (\d)/.exec(k)[1]),oe=$>=2);let G=null,F={};const re=n.getParameter(n.SCISSOR_BOX),j=n.getParameter(n.VIEWPORT),ve=new dn().fromArray(re),le=new dn().fromArray(j);function Pe(K,he,ce,Ne){const Be=new Uint8Array(4),bt=n.createTexture();n.bindTexture(K,bt),n.texParameteri(K,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(K,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let en=0;en"u"?!1:/OculusBrowser/g.test(navigator.userAgent),_=new WeakMap;let x;const y=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function M(W,O){return g?new OffscreenCanvas(W,O):zd("canvas")}function S(W,O,de,Ce){let Le=1;if((W.width>Ce||W.height>Ce)&&(Le=Ce/Math.max(W.width,W.height)),Le<1||O===!0)if(typeof HTMLImageElement<"u"&&W instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&W instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&W instanceof ImageBitmap){const Ue=O?W0:Math.floor,tt=Ue(Le*W.width),Oe=Ue(Le*W.height);x===void 0&&(x=M(tt,Oe));const Me=de?M(tt,Oe):x;return Me.width=tt,Me.height=Oe,Me.getContext("2d").drawImage(W,0,0,tt,Oe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+W.width+"x"+W.height+") to ("+tt+"x"+Oe+")."),Me}else return"data"in W&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+W.width+"x"+W.height+")."),W;return W}function E(W){return q1(W.width)&&q1(W.height)}function C(W){return a?!1:W.wrapS!==Xi||W.wrapT!==Xi||W.minFilter!==$n&&W.minFilter!==yn}function R(W,O){return W.generateMipmaps&&O&&W.minFilter!==$n&&W.minFilter!==yn}function P(W){n.generateMipmap(W)}function D(W,O,de,Ce,Le=!1){if(a===!1)return O;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 Ue=O;return O===n.RED&&(de===n.FLOAT&&(Ue=n.R32F),de===n.HALF_FLOAT&&(Ue=n.R16F),de===n.UNSIGNED_BYTE&&(Ue=n.R8)),O===n.RG&&(de===n.FLOAT&&(Ue=n.RG32F),de===n.HALF_FLOAT&&(Ue=n.RG16F),de===n.UNSIGNED_BYTE&&(Ue=n.RG8)),O===n.RGBA&&(de===n.FLOAT&&(Ue=n.RGBA32F),de===n.HALF_FLOAT&&(Ue=n.RGBA16F),de===n.UNSIGNED_BYTE&&(Ue=Ce===kt&&Le===!1?n.SRGB8_ALPHA8:n.RGBA8),de===n.UNSIGNED_SHORT_4_4_4_4&&(Ue=n.RGBA4),de===n.UNSIGNED_SHORT_5_5_5_1&&(Ue=n.RGB5_A1)),(Ue===n.R16F||Ue===n.R32F||Ue===n.RG16F||Ue===n.RG32F||Ue===n.RGBA16F||Ue===n.RGBA32F)&&e.get("EXT_color_buffer_float"),Ue}function b(W,O,de){return R(W,de)===!0||W.isFramebufferTexture&&W.minFilter!==$n&&W.minFilter!==yn?Math.log2(Math.max(O.width,O.height))+1:W.mipmaps!==void 0&&W.mipmaps.length>0?W.mipmaps.length:W.isCompressedTexture&&Array.isArray(W.image)?O.mipmaps.length:1}function I(W){return W===$n||W===V0||W===Jh?n.NEAREST:n.LINEAR}function z(W){const O=W.target;O.removeEventListener("dispose",z),J(O),O.isVideoTexture&&_.delete(O)}function q(W){const O=W.target;O.removeEventListener("dispose",q),ee(O)}function J(W){const O=i.get(W);if(O.__webglInit===void 0)return;const de=W.source,Ce=y.get(de);if(Ce){const Le=Ce[O.__cacheKey];Le.usedTimes--,Le.usedTimes===0&&Q(W),Object.keys(Ce).length===0&&y.delete(de)}i.remove(W)}function Q(W){const O=i.get(W);n.deleteTexture(O.__webglTexture);const de=W.source,Ce=y.get(de);delete Ce[O.__cacheKey],o.memory.textures--}function ee(W){const O=W.texture,de=i.get(W),Ce=i.get(O);if(Ce.__webglTexture!==void 0&&(n.deleteTexture(Ce.__webglTexture),o.memory.textures--),W.depthTexture&&W.depthTexture.dispose(),W.isWebGLCubeRenderTarget)for(let Le=0;Le<6;Le++)n.deleteFramebuffer(de.__webglFramebuffer[Le]),de.__webglDepthbuffer&&n.deleteRenderbuffer(de.__webglDepthbuffer[Le]);else{if(n.deleteFramebuffer(de.__webglFramebuffer),de.__webglDepthbuffer&&n.deleteRenderbuffer(de.__webglDepthbuffer),de.__webglMultisampledFramebuffer&&n.deleteFramebuffer(de.__webglMultisampledFramebuffer),de.__webglColorRenderbuffer)for(let Le=0;Le=l&&console.warn("THREE.WebGLTextures: Trying to use "+W+" texture units while this GPU supports only "+l),oe+=1,W}function G(W){const O=[];return O.push(W.wrapS),O.push(W.wrapT),O.push(W.wrapR||0),O.push(W.magFilter),O.push(W.minFilter),O.push(W.anisotropy),O.push(W.internalFormat),O.push(W.format),O.push(W.type),O.push(W.generateMipmaps),O.push(W.premultiplyAlpha),O.push(W.flipY),O.push(W.unpackAlignment),O.push(W.colorSpace),O.join()}function F(W,O){const de=i.get(W);if(W.isVideoTexture&&dt(W),W.isRenderTargetTexture===!1&&W.version>0&&de.__version!==W.version){const Ce=W.image;if(Ce===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Ce.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{it(de,W,O);return}}t.bindTexture(n.TEXTURE_2D,de.__webglTexture,n.TEXTURE0+O)}function re(W,O){const de=i.get(W);if(W.version>0&&de.__version!==W.version){it(de,W,O);return}t.bindTexture(n.TEXTURE_2D_ARRAY,de.__webglTexture,n.TEXTURE0+O)}function j(W,O){const de=i.get(W);if(W.version>0&&de.__version!==W.version){it(de,W,O);return}t.bindTexture(n.TEXTURE_3D,de.__webglTexture,n.TEXTURE0+O)}function ve(W,O){const de=i.get(W);if(W.version>0&&de.__version!==W.version){Pt(de,W,O);return}t.bindTexture(n.TEXTURE_CUBE_MAP,de.__webglTexture,n.TEXTURE0+O)}const le={[Id]:n.REPEAT,[Xi]:n.CLAMP_TO_EDGE,[Dd]:n.MIRRORED_REPEAT},Pe={[$n]:n.NEAREST,[V0]:n.NEAREST_MIPMAP_NEAREST,[Jh]:n.NEAREST_MIPMAP_LINEAR,[yn]:n.LINEAR,[LM]:n.LINEAR_MIPMAP_NEAREST,[al]:n.LINEAR_MIPMAP_LINEAR},_e={[_3]:n.NEVER,[T3]:n.ALWAYS,[y3]:n.LESS,[S3]:n.LEQUAL,[x3]:n.EQUAL,[E3]:n.GEQUAL,[M3]:n.GREATER,[w3]:n.NOTEQUAL};function Re(W,O,de){if(de?(n.texParameteri(W,n.TEXTURE_WRAP_S,le[O.wrapS]),n.texParameteri(W,n.TEXTURE_WRAP_T,le[O.wrapT]),(W===n.TEXTURE_3D||W===n.TEXTURE_2D_ARRAY)&&n.texParameteri(W,n.TEXTURE_WRAP_R,le[O.wrapR]),n.texParameteri(W,n.TEXTURE_MAG_FILTER,Pe[O.magFilter]),n.texParameteri(W,n.TEXTURE_MIN_FILTER,Pe[O.minFilter])):(n.texParameteri(W,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(W,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(W===n.TEXTURE_3D||W===n.TEXTURE_2D_ARRAY)&&n.texParameteri(W,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(O.wrapS!==Xi||O.wrapT!==Xi)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(W,n.TEXTURE_MAG_FILTER,I(O.magFilter)),n.texParameteri(W,n.TEXTURE_MIN_FILTER,I(O.minFilter)),O.minFilter!==$n&&O.minFilter!==yn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),O.compareFunction&&(n.texParameteri(W,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(W,n.TEXTURE_COMPARE_FUNC,_e[O.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const Ce=e.get("EXT_texture_filter_anisotropic");if(O.magFilter===$n||O.minFilter!==Jh&&O.minFilter!==al||O.type===Pi&&e.has("OES_texture_float_linear")===!1||a===!1&&O.type===ji&&e.has("OES_texture_half_float_linear")===!1)return;(O.anisotropy>1||i.get(O).__currentAnisotropy)&&(n.texParameterf(W,Ce.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(O.anisotropy,r.getMaxAnisotropy())),i.get(O).__currentAnisotropy=O.anisotropy)}}function nt(W,O){let de=!1;W.__webglInit===void 0&&(W.__webglInit=!0,O.addEventListener("dispose",z));const Ce=O.source;let Le=y.get(Ce);Le===void 0&&(Le={},y.set(Ce,Le));const Ue=G(O);if(Ue!==W.__cacheKey){Le[Ue]===void 0&&(Le[Ue]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,de=!0),Le[Ue].usedTimes++;const tt=Le[W.__cacheKey];tt!==void 0&&(Le[W.__cacheKey].usedTimes--,tt.usedTimes===0&&Q(O)),W.__cacheKey=Ue,W.__webglTexture=Le[Ue].texture}return de}function it(W,O,de){let Ce=n.TEXTURE_2D;(O.isDataArrayTexture||O.isCompressedArrayTexture)&&(Ce=n.TEXTURE_2D_ARRAY),O.isData3DTexture&&(Ce=n.TEXTURE_3D);const Le=nt(W,O),Ue=O.source;t.bindTexture(Ce,W.__webglTexture,n.TEXTURE0+de);const tt=i.get(Ue);if(Ue.version!==tt.__version||Le===!0){t.activeTexture(n.TEXTURE0+de),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,O.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,O.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.NONE);const Oe=C(O)&&E(O.image)===!1;let Me=S(O.image,Oe,!1,h);Me=$t(O,Me);const rt=E(Me)||a,ot=s.convert(O.format,O.colorSpace);let Je=s.convert(O.type),Qe=D(O.internalFormat,ot,Je,O.colorSpace);Re(Ce,O,rt);let je;const ft=O.mipmaps,Mt=a&&O.isVideoTexture!==!0,K=tt.__version===void 0||Le===!0,he=b(O,Me,rt);if(O.isDepthTexture)Qe=n.DEPTH_COMPONENT,a?O.type===Pi?Qe=n.DEPTH_COMPONENT32F:O.type===Ko?Qe=n.DEPTH_COMPONENT24:O.type===Ja?Qe=n.DEPTH24_STENCIL8:Qe=n.DEPTH_COMPONENT16:O.type===Pi&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),O.format===Qa&&Qe===n.DEPTH_COMPONENT&&O.type!==Mv&&O.type!==Ko&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),O.type=Ko,Je=s.convert(O.type)),O.format===Mu&&Qe===n.DEPTH_COMPONENT&&(Qe=n.DEPTH_STENCIL,O.type!==Ja&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),O.type=Ja,Je=s.convert(O.type))),K&&(Mt?t.texStorage2D(n.TEXTURE_2D,1,Qe,Me.width,Me.height):t.texImage2D(n.TEXTURE_2D,0,Qe,Me.width,Me.height,0,ot,Je,null));else if(O.isDataTexture)if(ft.length>0&&rt){Mt&&K&&t.texStorage2D(n.TEXTURE_2D,he,Qe,ft[0].width,ft[0].height);for(let ce=0,Ne=ft.length;ce>=1,Ne>>=1}}else if(ft.length>0&&rt){Mt&&K&&t.texStorage2D(n.TEXTURE_2D,he,Qe,ft[0].width,ft[0].height);for(let ce=0,Ne=ft.length;ce0&&K++,t.texStorage2D(n.TEXTURE_CUBE_MAP,K,je,Me[0].width,Me[0].height));for(let ce=0;ce<6;ce++)if(Oe){ft?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ce,0,0,0,Me[ce].width,Me[ce].height,Je,Qe,Me[ce].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ce,0,je,Me[ce].width,Me[ce].height,0,Je,Qe,Me[ce].data);for(let Ne=0;Ne=n.TEXTURE_CUBE_MAP_POSITIVE_X&&Le<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,Ce,Le,i.get(de).__webglTexture,0),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Z(W,O,de){if(n.bindRenderbuffer(n.RENDERBUFFER,W),O.depthBuffer&&!O.stencilBuffer){let Ce=n.DEPTH_COMPONENT16;if(de||mt(O)){const Le=O.depthTexture;Le&&Le.isDepthTexture&&(Le.type===Pi?Ce=n.DEPTH_COMPONENT32F:Le.type===Ko&&(Ce=n.DEPTH_COMPONENT24));const Ue=Ye(O);mt(O)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Ue,Ce,O.width,O.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,Ue,Ce,O.width,O.height)}else n.renderbufferStorage(n.RENDERBUFFER,Ce,O.width,O.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,W)}else if(O.depthBuffer&&O.stencilBuffer){const Ce=Ye(O);de&&mt(O)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Ce,n.DEPTH24_STENCIL8,O.width,O.height):mt(O)?p.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Ce,n.DEPTH24_STENCIL8,O.width,O.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,O.width,O.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,W)}else{const Ce=O.isWebGLMultipleRenderTargets===!0?O.texture:[O.texture];for(let Le=0;Le0&&mt(W)===!1){const Oe=Ue?O:[O];de.__webglMultisampledFramebuffer=n.createFramebuffer(),de.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,de.__webglMultisampledFramebuffer);for(let Me=0;Me0&&mt(W)===!1){const O=W.isWebGLMultipleRenderTargets?W.texture:[W.texture],de=W.width,Ce=W.height;let Le=n.COLOR_BUFFER_BIT;const Ue=[],tt=W.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Oe=i.get(W),Me=W.isWebGLMultipleRenderTargets===!0;if(Me)for(let rt=0;rt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&O.__useRenderToTexture!==!1}function dt(W){const O=o.render.frame;_.get(W)!==O&&(_.set(W,O),W.update())}function $t(W,O){const de=W.colorSpace,Ce=W.format,Le=W.type;return W.isCompressedTexture===!0||W.format===G0||de!==Js&&de!==el&&(de===kt?a===!1?e.has("EXT_sRGB")===!0&&Ce===lr?(W.format=G0,W.minFilter=yn,W.generateMipmaps=!1):O=WM.sRGBToLinear(O):(Ce!==lr||Le!==yo)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",de)),O}this.allocateTextureUnit=k,this.resetTextureUnits=$,this.setTexture2D=F,this.setTexture2DArray=re,this.setTexture3D=j,this.setTextureCube=ve,this.rebindTextures=Ie,this.setupRenderTarget=Ae,this.updateRenderTargetMipmap=te,this.updateMultisampleRenderTarget=He,this.setupDepthRenderbuffer=ye,this.setupFrameBufferTexture=Ze,this.useMultisampledRTT=mt}function F3(n,e,t){const i=t.isWebGL2;function r(s,o=el){let a;if(s===yo)return n.UNSIGNED_BYTE;if(s===DM)return n.UNSIGNED_SHORT_4_4_4_4;if(s===NM)return n.UNSIGNED_SHORT_5_5_5_1;if(s===i3)return n.BYTE;if(s===r3)return n.SHORT;if(s===Mv)return n.UNSIGNED_SHORT;if(s===IM)return n.INT;if(s===Ko)return n.UNSIGNED_INT;if(s===Pi)return n.FLOAT;if(s===ji)return i?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===s3)return n.ALPHA;if(s===lr)return n.RGBA;if(s===o3)return n.LUMINANCE;if(s===a3)return n.LUMINANCE_ALPHA;if(s===Qa)return n.DEPTH_COMPONENT;if(s===Mu)return n.DEPTH_STENCIL;if(s===G0)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===FM)return n.RED;if(s===UM)return n.RED_INTEGER;if(s===l3)return n.RG;if(s===kM)return n.RG_INTEGER;if(s===OM)return n.RGBA_INTEGER;if(s===$g||s===e0||s===t0||s===n0)if(o===kt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===$g)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===e0)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===t0)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===n0)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===$g)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===e0)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===t0)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===n0)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===E1||s===T1||s===A1||s===C1)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===E1)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===T1)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===A1)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===C1)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===u3)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===R1||s===b1)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===R1)return o===kt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===b1)return o===kt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===P1||s===L1||s===I1||s===D1||s===N1||s===F1||s===U1||s===k1||s===O1||s===z1||s===B1||s===H1||s===V1||s===G1)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===P1)return o===kt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===L1)return o===kt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===I1)return o===kt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===D1)return o===kt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===N1)return o===kt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===F1)return o===kt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===U1)return o===kt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===k1)return o===kt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===O1)return o===kt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===z1)return o===kt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===B1)return o===kt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===H1)return o===kt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===V1)return o===kt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===G1)return o===kt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===i0)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===i0)return o===kt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===c3||s===W1||s===X1||s===Y1)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===i0)return a.COMPRESSED_RED_RGTC1_EXT;if(s===W1)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===X1)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===Y1)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Ja?i?n.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:r}}class U3 extends Si{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Vc extends jt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const W5={type:"move"};class Oy{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Vc,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 Vc,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new V,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new V),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Vc,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new V,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new V),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,f=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(f&&e.hand){o=!0;for(const x of e.hand.values()){const y=t.getJointPose(x,i),g=this._getHandJoint(f,x);y!==null&&(g.matrix.fromArray(y.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,g.jointRadius=y.radius),g.visible=y!==null}const h=f.joints["index-finger-tip"],d=f.joints["thumb-tip"],p=h.position.distanceTo(d.position),m=.02,_=.005;f.inputState.pinching&&p>m+_?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!f.inputState.pinching&&p<=m-_&&(f.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(W5)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),f!==null&&(f.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Vc;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class $M extends Bn{constructor(e,t,i,r,s,o,a,l,f,h){if(h=h!==void 0?h:Qa,h!==Qa&&h!==Mu)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&h===Qa&&(i=Ko),i===void 0&&h===Mu&&(i=Ja),super(null,r,s,o,a,l,h,i,f),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:$n,this.minFilter=l!==void 0?l:$n,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class X5 extends fa{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,f=null,h=null,d=null,p=null,m=null,_=null;const x=t.getContextAttributes();let y=null,g=null;const M=[],S=[];let E=null;const C=new Si;C.layers.enable(1),C.viewport=new dn;const R=new Si;R.layers.enable(2),R.viewport=new dn;const P=[C,R],D=new U3;D.layers.enable(1),D.layers.enable(2);let b=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getCamera=function(){},this.setUserCamera=function(j){E=j},this.getController=function(j){let ve=M[j];return ve===void 0&&(ve=new Oy,M[j]=ve),ve.getTargetRaySpace()},this.getControllerGrip=function(j){let ve=M[j];return ve===void 0&&(ve=new Oy,M[j]=ve),ve.getGripSpace()},this.getHand=function(j){let ve=M[j];return ve===void 0&&(ve=new Oy,M[j]=ve),ve.getHandSpace()};function z(j){const ve=S.indexOf(j.inputSource);if(ve===-1)return;const le=M[ve];le!==void 0&&(le.update(j.inputSource,j.frame,f||o),le.dispatchEvent({type:j.type,data:j.inputSource}))}function q(){r.removeEventListener("select",z),r.removeEventListener("selectstart",z),r.removeEventListener("selectend",z),r.removeEventListener("squeeze",z),r.removeEventListener("squeezestart",z),r.removeEventListener("squeezeend",z),r.removeEventListener("end",q),r.removeEventListener("inputsourceschange",J);for(let j=0;j=0&&(S[Pe]=null,M[Pe].disconnect(le))}for(let ve=0;ve=S.length){S.push(le),Pe=Re;break}else if(S[Re]===null){S[Re]=le,Pe=Re;break}if(Pe===-1)break}const _e=M[Pe];_e&&_e.connect(le)}}const Q=new V,ee=new V;function oe(j,ve,le){Q.setFromMatrixPosition(ve.matrixWorld),ee.setFromMatrixPosition(le.matrixWorld);const Pe=Q.distanceTo(ee),_e=ve.projectionMatrix.elements,Re=le.projectionMatrix.elements,nt=_e[14]/(_e[10]-1),it=_e[14]/(_e[10]+1),Pt=(_e[9]+1)/_e[5],Ze=(_e[9]-1)/_e[5],Z=(_e[8]-1)/_e[0],we=(Re[8]+1)/Re[0],ye=nt*Z,Ie=nt*we,Ae=Pe/(-Z+we),te=Ae*-Z;ve.matrixWorld.decompose(j.position,j.quaternion,j.scale),j.translateX(te),j.translateZ(Ae),j.matrixWorld.compose(j.position,j.quaternion,j.scale),j.matrixWorldInverse.copy(j.matrixWorld).invert();const He=nt+Ae,Ye=it+Ae,mt=ye-te,dt=Ie+(Pe-te),$t=Pt*it/Ye*He,W=Ze*it/Ye*He;j.projectionMatrix.makePerspective(mt,dt,$t,W,He,Ye),j.projectionMatrixInverse.copy(j.projectionMatrix).invert()}function $(j,ve){ve===null?j.matrixWorld.copy(j.matrix):j.matrixWorld.multiplyMatrices(ve.matrixWorld,j.matrix),j.matrixWorldInverse.copy(j.matrixWorld).invert()}this.updateCameraXR=function(j){if(r===null)return j;E&&(j=E),D.near=R.near=C.near=j.near,D.far=R.far=C.far=j.far,(b!==D.near||I!==D.far)&&(r.updateRenderState({depthNear:D.near,depthFar:D.far}),b=D.near,I=D.far);const ve=j.parent,le=D.cameras;$(D,ve);for(let Pe=0;Pe0&&(y.alphaTest.value=g.alphaTest);const M=e.get(g).envMap;if(M&&(y.envMap.value=M,y.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=g.reflectivity,y.ior.value=g.ior,y.refractionRatio.value=g.refractionRatio),g.lightMap){y.lightMap.value=g.lightMap;const S=n.useLegacyLights===!0?Math.PI:1;y.lightMapIntensity.value=g.lightMapIntensity*S,t(g.lightMap,y.lightMapTransform)}g.aoMap&&(y.aoMap.value=g.aoMap,y.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,y.aoMapTransform))}function o(y,g){y.diffuse.value.copy(g.color),y.opacity.value=g.opacity,g.map&&(y.map.value=g.map,t(g.map,y.mapTransform))}function a(y,g){y.dashSize.value=g.dashSize,y.totalSize.value=g.dashSize+g.gapSize,y.scale.value=g.scale}function l(y,g,M,S){y.diffuse.value.copy(g.color),y.opacity.value=g.opacity,y.size.value=g.size*M,y.scale.value=S*.5,g.map&&(y.map.value=g.map,t(g.map,y.uvTransform)),g.alphaMap&&(y.alphaMap.value=g.alphaMap,t(g.alphaMap,y.alphaMapTransform)),g.alphaTest>0&&(y.alphaTest.value=g.alphaTest)}function f(y,g){y.diffuse.value.copy(g.color),y.opacity.value=g.opacity,y.rotation.value=g.rotation,g.map&&(y.map.value=g.map,t(g.map,y.mapTransform)),g.alphaMap&&(y.alphaMap.value=g.alphaMap,t(g.alphaMap,y.alphaMapTransform)),g.alphaTest>0&&(y.alphaTest.value=g.alphaTest)}function h(y,g){y.specular.value.copy(g.specular),y.shininess.value=Math.max(g.shininess,1e-4)}function d(y,g){g.gradientMap&&(y.gradientMap.value=g.gradientMap)}function p(y,g){y.metalness.value=g.metalness,g.metalnessMap&&(y.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,y.metalnessMapTransform)),y.roughness.value=g.roughness,g.roughnessMap&&(y.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,y.roughnessMapTransform)),e.get(g).envMap&&(y.envMapIntensity.value=g.envMapIntensity)}function m(y,g,M){y.ior.value=g.ior,g.sheen>0&&(y.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),y.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(y.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,y.sheenColorMapTransform)),g.sheenRoughnessMap&&(y.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,y.sheenRoughnessMapTransform))),g.clearcoat>0&&(y.clearcoat.value=g.clearcoat,y.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(y.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,y.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(y.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===qi&&y.clearcoatNormalScale.value.negate())),g.iridescence>0&&(y.iridescence.value=g.iridescence,y.iridescenceIOR.value=g.iridescenceIOR,y.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(y.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,y.iridescenceMapTransform)),g.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),g.transmission>0&&(y.transmission.value=g.transmission,y.transmissionSamplerMap.value=M.texture,y.transmissionSamplerSize.value.set(M.width,M.height),g.transmissionMap&&(y.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,y.transmissionMapTransform)),y.thickness.value=g.thickness,g.thicknessMap&&(y.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=g.attenuationDistance,y.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(y.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(y.anisotropyMap.value=g.anisotropyMap,t(g.anisotropyMap,y.anisotropyMapTransform))),y.specularIntensity.value=g.specularIntensity,y.specularColor.value.copy(g.specularColor),g.specularColorMap&&(y.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,y.specularColorMapTransform)),g.specularIntensityMap&&(y.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,y.specularIntensityMapTransform))}function _(y,g){g.matcap&&(y.matcap.value=g.matcap)}function x(y,g){const M=e.get(g).light;y.referencePosition.value.setFromMatrixPosition(M.matrixWorld),y.nearDistance.value=M.shadow.camera.near,y.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function j5(n,e,t,i){let r={},s={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(M,S){const E=S.program;i.uniformBlockBinding(M,E)}function f(M,S){let E=r[M.id];E===void 0&&(_(M),E=h(M),r[M.id]=E,M.addEventListener("dispose",y));const C=S.program;i.updateUBOMapping(M,C);const R=e.render.frame;s[M.id]!==R&&(p(M),s[M.id]=R)}function h(M){const S=d();M.__bindingPointIndex=S;const E=n.createBuffer(),C=M.__size,R=M.usage;return n.bindBuffer(n.UNIFORM_BUFFER,E),n.bufferData(n.UNIFORM_BUFFER,C,R),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,S,E),E}function d(){for(let M=0;M0){R=E%C;const q=C-R;R!==0&&q-I.boundary<0&&(E+=C-R,b.__offset=E)}E+=I.storage}return R=E%C,R>0&&(E+=C-R),M.__size=E,M.__cache={},this}function x(M){const S={boundary:0,storage:0};return typeof M=="number"?(S.boundary=4,S.storage=4):M.isVector2?(S.boundary=8,S.storage=8):M.isVector3||M.isColor?(S.boundary=16,S.storage=12):M.isVector4?(S.boundary=16,S.storage=16):M.isMatrix3?(S.boundary=48,S.storage=48):M.isMatrix4?(S.boundary=64,S.storage=64):M.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",M),S}function y(M){const S=M.target;S.removeEventListener("dispose",y);const E=o.indexOf(S.__bindingPointIndex);o.splice(E,1),n.deleteBuffer(r[S.id]),delete r[S.id],delete s[S.id]}function g(){for(const M in r)n.deleteBuffer(r[M]);o=[],r={},s={}}return{bind:l,update:f,dispose:g}}function q5(){const n=zd("canvas");return n.style.display="block",n}class ew{constructor(e={}){const{canvas:t=q5(),context:i=null,depth:r=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:f=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let p;i!==null?p=i.getContextAttributes().alpha:p=o;const m=new Uint32Array(4),_=new Int32Array(4);let x=null,y=null;const g=[],M=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputColorSpace=kt,this.useLegacyLights=!0,this.toneMapping=Ts,this.toneMappingExposure=1;const S=this;let E=!1,C=0,R=0,P=null,D=-1,b=null;const I=new dn,z=new dn;let q=null;const J=new Ge(0);let Q=0,ee=t.width,oe=t.height,$=1,k=null,G=null;const F=new dn(0,0,ee,oe),re=new dn(0,0,ee,oe);let j=!1;const ve=new Av;let le=!1,Pe=!1,_e=null;const Re=new Ft,nt=new be,it=new V,Pt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ze(){return P===null?$:1}let Z=i;function we(A,U){for(let H=0;H0?y=M[M.length-1]:y=null,g.pop(),g.length>0?x=g[g.length-1]:x=null};function $e(A,U,H,B){if(A.visible===!1)return;if(A.layers.test(U.layers)){if(A.isGroup)H=A.renderOrder;else if(A.isLOD)A.autoUpdate===!0&&A.update(U);else if(A.isLight)y.pushLight(A),A.castShadow&&y.pushShadow(A);else if(A.isSprite){if(!A.frustumCulled||ve.intersectsSprite(A)){B&&it.setFromMatrixPosition(A.matrixWorld).applyMatrix4(Re);const ue=O.update(A),me=A.material;me.visible&&x.push(A,ue,me,H,it.z,null)}}else if((A.isMesh||A.isLine||A.isPoints)&&(!A.frustumCulled||ve.intersectsObject(A))){A.isSkinnedMesh&&A.skeleton.frame!==te.render.frame&&(A.skeleton.update(),A.skeleton.frame=te.render.frame);const ue=O.update(A),me=A.material;if(B&&(A.boundingSphere!==void 0?(A.boundingSphere===null&&A.computeBoundingSphere(),it.copy(A.boundingSphere.center)):(ue.boundingSphere===null&&ue.computeBoundingSphere(),it.copy(ue.boundingSphere.center)),it.applyMatrix4(A.matrixWorld).applyMatrix4(Re)),Array.isArray(me)){const xe=ue.groups;for(let Te=0,pe=xe.length;Te0&&xt(X,ae,U,H),B&&Ae.viewport(I.copy(B)),X.length>0&&At(X,U,H),ae.length>0&&At(ae,U,H),ue.length>0&&At(ue,U,H),Ae.buffers.depth.setTest(!0),Ae.buffers.depth.setMask(!0),Ae.buffers.color.setMask(!0),Ae.setPolygonOffset(!1)}function xt(A,U,H,B){const X=Ie.isWebGL2;_e===null&&(_e=new bs(1,1,{generateMipmaps:!0,type:ye.has("EXT_color_buffer_half_float")?ji:yo,minFilter:al,samples:X&&a===!0?4:0})),S.getDrawingBufferSize(nt),X?_e.setSize(nt.x,nt.y):_e.setSize(W0(nt.x),W0(nt.y));const ae=S.getRenderTarget();S.setRenderTarget(_e),S.getClearColor(J),Q=S.getClearAlpha(),Q<1&&S.setClearColor(16777215,.5),S.clear();const ue=S.toneMapping;S.toneMapping=Ts,At(A,H,B),Ye.updateMultisampleRenderTarget(_e),Ye.updateRenderTargetMipmap(_e);let me=!1;for(let xe=0,Te=U.length;xe0),ke=!!H.morphAttributes.position,De=!!H.morphAttributes.normal,Ve=!!H.morphAttributes.color,gt=B.toneMapped?S.toneMapping:Ts,vt=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,at=vt!==void 0?vt.length:0,qe=He.get(B),wt=y.state.lights;if(le===!0&&(Pe===!0||A!==b)){const Lt=A===b&&B.id===D;tt.setState(B,A,Lt)}let st=!1;B.version===qe.__version?(qe.needsLights&&qe.lightsStateVersion!==wt.state.version||qe.outputColorSpace!==me||X.isInstancedMesh&&qe.instancing===!1||!X.isInstancedMesh&&qe.instancing===!0||X.isSkinnedMesh&&qe.skinning===!1||!X.isSkinnedMesh&&qe.skinning===!0||qe.envMap!==xe||B.fog===!0&&qe.fog!==ae||qe.numClippingPlanes!==void 0&&(qe.numClippingPlanes!==tt.numPlanes||qe.numIntersection!==tt.numIntersection)||qe.vertexAlphas!==Te||qe.vertexTangents!==pe||qe.morphTargets!==ke||qe.morphNormals!==De||qe.morphColors!==Ve||qe.toneMapping!==gt||Ie.isWebGL2===!0&&qe.morphTargetsCount!==at)&&(st=!0):(st=!0,qe.__version=B.version);let It=qe.currentProgram;st===!0&&(It=Tt(B,U,X));let cn=!1,Rt=!1,fn=!1;const sn=It.getUniforms(),mn=qe.uniforms;if(Ae.useProgram(It.program)&&(cn=!0,Rt=!0,fn=!0),B.id!==D&&(D=B.id,Rt=!0),cn||b!==A){if(sn.setValue(Z,"projectionMatrix",A.projectionMatrix),Ie.logarithmicDepthBuffer&&sn.setValue(Z,"logDepthBufFC",2/(Math.log(A.far+1)/Math.LN2)),b!==A&&(b=A,Rt=!0,fn=!0),B.isShaderMaterial||B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshStandardMaterial||B.envMap){const Lt=sn.map.cameraPosition;Lt!==void 0&&Lt.setValue(Z,it.setFromMatrixPosition(A.matrixWorld))}(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial)&&sn.setValue(Z,"isOrthographic",A.isOrthographicCamera===!0),(B.isMeshPhongMaterial||B.isMeshToonMaterial||B.isMeshLambertMaterial||B.isMeshBasicMaterial||B.isMeshStandardMaterial||B.isShaderMaterial||B.isShadowMaterial||X.isSkinnedMesh)&&sn.setValue(Z,"viewMatrix",A.matrixWorldInverse)}if(X.isSkinnedMesh){sn.setOptional(Z,X,"bindMatrix"),sn.setOptional(Z,X,"bindMatrixInverse");const Lt=X.skeleton;Lt&&(Ie.floatVertexTextures?(Lt.boneTexture===null&&Lt.computeBoneTexture(),sn.setValue(Z,"boneTexture",Lt.boneTexture,Ye),sn.setValue(Z,"boneTextureSize",Lt.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const Zn=H.morphAttributes;if((Zn.position!==void 0||Zn.normal!==void 0||Zn.color!==void 0&&Ie.isWebGL2===!0)&&rt.update(X,H,It),(Rt||qe.receiveShadow!==X.receiveShadow)&&(qe.receiveShadow=X.receiveShadow,sn.setValue(Z,"receiveShadow",X.receiveShadow)),B.isMeshGouraudMaterial&&B.envMap!==null&&(mn.envMap.value=xe,mn.flipEnvMap.value=xe.isCubeTexture&&xe.isRenderTargetTexture===!1?-1:1),Rt&&(sn.setValue(Z,"toneMappingExposure",S.toneMappingExposure),qe.needsLights&&Ln(mn,fn),ae&&B.fog===!0&&Ce.refreshFogUniforms(mn,ae),Ce.refreshMaterialUniforms(mn,B,$,oe,_e),o0.upload(Z,qe.uniformsList,mn,Ye)),B.isShaderMaterial&&B.uniformsNeedUpdate===!0&&(o0.upload(Z,qe.uniformsList,mn,Ye),B.uniformsNeedUpdate=!1),B.isSpriteMaterial&&sn.setValue(Z,"center",X.center),sn.setValue(Z,"modelViewMatrix",X.modelViewMatrix),sn.setValue(Z,"normalMatrix",X.normalMatrix),sn.setValue(Z,"modelMatrix",X.matrixWorld),B.isShaderMaterial||B.isRawShaderMaterial){const Lt=B.uniformsGroups;for(let In=0,un=Lt.length;In0&&Ye.useMultisampledRTT(A)===!1?X=He.get(A).__webglMultisampledFramebuffer:X=pe,I.copy(A.viewport),z.copy(A.scissor),q=A.scissorTest}else I.copy(F).multiplyScalar($).floor(),z.copy(re).multiplyScalar($).floor(),q=j;if(Ae.bindFramebuffer(Z.FRAMEBUFFER,X)&&Ie.drawBuffers&&B&&Ae.drawBuffers(A,X),Ae.viewport(I),Ae.scissor(z),Ae.setScissorTest(q),ae){const xe=He.get(A.texture);Z.framebufferTexture2D(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Z.TEXTURE_CUBE_MAP_POSITIVE_X+U,xe.__webglTexture,H)}else if(ue){const xe=He.get(A.texture),Te=U||0;Z.framebufferTextureLayer(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,xe.__webglTexture,H||0,Te)}D=-1},this.readRenderTargetPixels=function(A,U,H,B,X,ae,ue){if(!(A&&A.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let me=He.get(A).__webglFramebuffer;if(A.isWebGLCubeRenderTarget&&ue!==void 0&&(me=me[ue]),me){Ae.bindFramebuffer(Z.FRAMEBUFFER,me);try{const xe=A.texture,Te=xe.format,pe=xe.type;if(Te!==lr&&Qe.convert(Te)!==Z.getParameter(Z.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ke=pe===ji&&(ye.has("EXT_color_buffer_half_float")||Ie.isWebGL2&&ye.has("EXT_color_buffer_float"));if(pe!==yo&&Qe.convert(pe)!==Z.getParameter(Z.IMPLEMENTATION_COLOR_READ_TYPE)&&!(pe===Pi&&(Ie.isWebGL2||ye.has("OES_texture_float")||ye.has("WEBGL_color_buffer_float")))&&!ke){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U>=0&&U<=A.width-B&&H>=0&&H<=A.height-X&&Z.readPixels(U,H,B,X,Qe.convert(Te),Qe.convert(pe),ae)}finally{const xe=P!==null?He.get(P).__webglFramebuffer:null;Ae.bindFramebuffer(Z.FRAMEBUFFER,xe)}}},this.copyFramebufferToTexture=function(A,U,H=0){const B=Math.pow(2,-H),X=Math.floor(U.image.width*B),ae=Math.floor(U.image.height*B);Ye.setTexture2D(U,0),Z.copyTexSubImage2D(Z.TEXTURE_2D,H,0,0,A.x,A.y,X,ae),Ae.unbindTexture()},this.copyTextureToTexture=function(A,U,H,B=0){const X=U.image.width,ae=U.image.height,ue=Qe.convert(H.format),me=Qe.convert(H.type);Ye.setTexture2D(H,0),Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,H.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,H.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,H.unpackAlignment),U.isDataTexture?Z.texSubImage2D(Z.TEXTURE_2D,B,A.x,A.y,X,ae,ue,me,U.image.data):U.isCompressedTexture?Z.compressedTexSubImage2D(Z.TEXTURE_2D,B,A.x,A.y,U.mipmaps[0].width,U.mipmaps[0].height,ue,U.mipmaps[0].data):Z.texSubImage2D(Z.TEXTURE_2D,B,A.x,A.y,ue,me,U.image),B===0&&H.generateMipmaps&&Z.generateMipmap(Z.TEXTURE_2D),Ae.unbindTexture()},this.copyTextureToTexture3D=function(A,U,H,B,X=0){if(S.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const ae=A.max.x-A.min.x+1,ue=A.max.y-A.min.y+1,me=A.max.z-A.min.z+1,xe=Qe.convert(B.format),Te=Qe.convert(B.type);let pe;if(B.isData3DTexture)Ye.setTexture3D(B,0),pe=Z.TEXTURE_3D;else if(B.isDataArrayTexture)Ye.setTexture2DArray(B,0),pe=Z.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,B.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,B.unpackAlignment);const ke=Z.getParameter(Z.UNPACK_ROW_LENGTH),De=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),Ve=Z.getParameter(Z.UNPACK_SKIP_PIXELS),gt=Z.getParameter(Z.UNPACK_SKIP_ROWS),vt=Z.getParameter(Z.UNPACK_SKIP_IMAGES),at=H.isCompressedTexture?H.mipmaps[0]:H.image;Z.pixelStorei(Z.UNPACK_ROW_LENGTH,at.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,at.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,A.min.x),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,A.min.y),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,A.min.z),H.isDataTexture||H.isData3DTexture?Z.texSubImage3D(pe,X,U.x,U.y,U.z,ae,ue,me,xe,Te,at.data):H.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Z.compressedTexSubImage3D(pe,X,U.x,U.y,U.z,ae,ue,me,xe,at.data)):Z.texSubImage3D(pe,X,U.x,U.y,U.z,ae,ue,me,xe,Te,at),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,ke),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,De),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Ve),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,gt),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,vt),X===0&&B.generateMipmaps&&Z.generateMipmap(pe),Ae.unbindTexture()},this.initTexture=function(A){A.isCubeTexture?Ye.setTextureCube(A,0):A.isData3DTexture?Ye.setTexture3D(A,0):A.isDataArrayTexture||A.isCompressedArrayTexture?Ye.setTexture2DArray(A,0):Ye.setTexture2D(A,0),Ae.unbindTexture()},this.resetState=function(){C=0,R=0,P=null,Ae.reset(),je.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return mo}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===kt?$a:BM}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===$a?kt:Js}}class k3 extends ew{}k3.prototype.isWebGL1Renderer=!0;class Rv{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Ge(e),this.density=t}clone(){return new Rv(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class bv{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new Ge(e),this.near=t,this.far=i}clone(){return new bv(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class Bd 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.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__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,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}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class Pv{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=kd,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Zr()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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:_h.clone(),uv:wr.getInterpolation(_h,rg,xh,sg,TC,zy,AC,new be),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 og(n,e,t,i,r,s){gc.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(yh.x=s*gc.x-r*gc.y,yh.y=r*gc.x+s*gc.y):yh.copy(gc),n.copy(e),n.x+=yh.x,n.y+=yh.y,n.applyMatrix4(O3)}const ag=new V,CC=new V;class B3 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){ag.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(ag);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){ag.setFromMatrixPosition(e.matrixWorld),CC.setFromMatrixPosition(this.matrixWorld);const i=ag.distanceTo(CC)/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;rl)continue;p.applyMatrix4(this.matrixWorld);const D=e.ray.origin.distanceTo(p);De.far||t.push({distance:D,point:d.clone().applyMatrix4(this.matrixWorld),index:S,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,o.start),M=Math.min(y.count,o.start+o.count);for(let S=g,E=M-1;Sl)continue;p.applyMatrix4(this.matrixWorld);const R=e.ray.origin.distanceTo(p);Re.far||t.push({distance:R,point:d.clone().applyMatrix4(this.matrixWorld),index:S,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s0){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:f,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class Q5 extends Bn{constructor(e,t,i,r,s,o,a,l,f){super(e,t,i,r,s,o,a,l,f),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:yn,this.magFilter=s!==void 0?s:yn,this.generateMipmaps=!1;const h=this;function d(){h.needsUpdate=!0,e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(d)}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 $5 extends Bn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=$n,this.minFilter=$n,this.generateMipmaps=!1,this.needsUpdate=!0}}class rw extends Bn{constructor(e,t,i,r,s,o,a,l,f,h,d,p){super(null,o,a,l,f,h,r,s,d,p),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class eH extends rw{constructor(e,t,i,r,s,o){super(e,t,i,s,o),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=Xi}}class tH extends Bn{constructor(e,t,i,r,s,o,a,l,f){super(e,t,i,r,s,o,a,l,f),this.isCanvasTexture=!0,this.needsUpdate=!0}}class $s{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,f;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),f=i[r]-o,f<0)a=r+1;else if(f>0)l=r-1;else{l=r;break}if(r=l,i[r]===o)return r/(s-1);const h=i[r],p=i[r+1]-h,m=(o-h)/p;return(r+m)/(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 be:new V);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 V,r=[],s=[],o=[],a=new V,l=new Ft;for(let m=0;m<=e;m++){const _=m/e;r[m]=this.getTangentAt(_,new V)}s[0]=new V,o[0]=new V;let f=Number.MAX_VALUE;const h=Math.abs(r[0].x),d=Math.abs(r[0].y),p=Math.abs(r[0].z);h<=f&&(f=h,i.set(1,0,0)),d<=f&&(f=d,i.set(0,1,0)),p<=f&&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 m=1;m<=e;m++){if(s[m]=s[m-1].clone(),o[m]=o[m-1].clone(),a.crossVectors(r[m-1],r[m]),a.length()>Number.EPSILON){a.normalize();const _=Math.acos(Yn(r[m-1].dot(r[m]),-1,1));s[m].applyMatrix4(l.makeRotationAxis(a,_))}o[m].crossVectors(r[m],s[m])}if(t===!0){let m=Math.acos(Yn(s[0].dot(s[e]),-1,1));m/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(m=-m);for(let _=1;_<=e;_++)s[_].applyMatrix4(l.makeRotationAxis(r[_],m*_)),o[_].crossVectors(r[_],s[_])}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 Iv extends $s{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){const i=t||new be,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 f,h;this.closed||a>0?f=r[(a-1)%s]:(hg.subVectors(r[0],r[1]).add(r[0]),f=hg);const d=r[a%s],p=r[(a+1)%s];if(this.closed||a+2r.length-2?r.length-1:o+1],d=r[o>r.length-3?r.length-1:o+2];return i.set(GC(a,l.x,f.x,h.x,d.x),GC(a,l.y,f.y,h.y,d.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(),f=l===0?0:1-o/l;return a.getPointAt(f,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 d=f.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(f);const h=f.getPoint(1);return this.currentPoint.copy(h),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 Ff extends Wt{constructor(e=[new be(0,-.5),new be(.5,0),new be(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=Yn(r,0,Math.PI*2);const s=[],o=[],a=[],l=[],f=[],h=1/t,d=new V,p=new be,m=new V,_=new V,x=new V;let y=0,g=0;for(let M=0;M<=e.length-1;M++)switch(M){case 0:y=e[M+1].x-e[M].x,g=e[M+1].y-e[M].y,m.x=g*1,m.y=-y,m.z=g*0,x.copy(m),m.normalize(),l.push(m.x,m.y,m.z);break;case e.length-1:l.push(x.x,x.y,x.z);break;default:y=e[M+1].x-e[M].x,g=e[M+1].y-e[M].y,m.x=g*1,m.y=-y,m.z=g*0,_.copy(m),m.x+=x.x,m.y+=x.y,m.z+=x.z,m.normalize(),l.push(m.x,m.y,m.z),x.copy(_)}for(let M=0;M<=t;M++){const S=i+M*h*r,E=Math.sin(S),C=Math.cos(S);for(let R=0;R<=e.length-1;R++){d.x=e[R].x*E,d.y=e[R].y,d.z=e[R].x*C,o.push(d.x,d.y,d.z),p.x=M/t,p.y=R/(e.length-1),a.push(p.x,p.y);const P=l[3*R+0]*E,D=l[3*R+1],b=l[3*R+0]*C;f.push(P,D,b)}}for(let M=0;M0&&S(!0),t>0&&S(!1)),this.setIndex(h),this.setAttribute("position",new pt(d,3)),this.setAttribute("normal",new pt(p,3)),this.setAttribute("uv",new pt(m,2));function M(){const E=new V,C=new V;let R=0;const P=(t-e)/i;for(let D=0;D<=s;D++){const b=[],I=D/s,z=I*(t-e)+e;for(let q=0;q<=r;q++){const J=q/r,Q=J*l+a,ee=Math.sin(Q),oe=Math.cos(Q);C.x=z*ee,C.y=-I*i+y,C.z=z*oe,d.push(C.x,C.y,C.z),E.set(ee,P,oe).normalize(),p.push(E.x,E.y,E.z),m.push(J,1-I),b.push(_++)}x.push(b)}for(let D=0;D.9&&P<.1&&(S<.2&&(o[M+0]+=1),E<.2&&(o[M+2]+=1),C<.2&&(o[M+4]+=1))}}function p(M){s.push(M.x,M.y,M.z)}function m(M,S){const E=M*3;S.x=e[E+0],S.y=e[E+1],S.z=e[E+2]}function _(){const M=new V,S=new V,E=new V,C=new V,R=new be,P=new be,D=new be;for(let b=0,I=0;b80*t){a=f=n[0],l=h=n[1];for(let _=t;_f&&(f=d),p>h&&(h=p);m=Math.max(f-a,h-l),m=m!==0?32767/m:0}return Vd(s,o,t,a,l,m,0),o}};function J3(n,e,t,i,r){let s,o;if(r===TH(n,e,t,i)>0)for(s=e;s=e;s-=i)o=WC(s,n[s],n[s+1],o);return o&&Nv(o,o.next)&&(Wd(o),o=o.next),o}function Eu(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(Nv(t,t.next)||kn(t.prev,t,t.next)===0)){if(Wd(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Vd(n,e,t,i,r,s,o){if(!n)return;!o&&s&&yH(n,i,r,s);let a=n,l,f;for(;n.prev!==n.next;){if(l=n.prev,f=n.next,s?fH(n,i,r,s):cH(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(f.i/t|0),Wd(n),n=f.next,a=f.next;continue}if(n=f,n===a){o?o===1?(n=hH(Eu(n),e,t),Vd(n,e,t,i,r,s,2)):o===2&&dH(n,e,t,i,r,s):Vd(Eu(n),e,t,i,r,s,1);break}}}function cH(n){const e=n.prev,t=n,i=n.next;if(kn(e,t,i)>=0)return!1;const r=e.x,s=t.x,o=i.x,a=e.y,l=t.y,f=i.y,h=rs?r>o?r:o:s>o?s:o,m=a>l?a>f?a:f:l>f?l:f;let _=i.next;for(;_!==e;){if(_.x>=h&&_.x<=p&&_.y>=d&&_.y<=m&&Gc(r,a,s,l,o,f,_.x,_.y)&&kn(_.prev,_,_.next)>=0)return!1;_=_.next}return!0}function fH(n,e,t,i){const r=n.prev,s=n,o=n.next;if(kn(r,s,o)>=0)return!1;const a=r.x,l=s.x,f=o.x,h=r.y,d=s.y,p=o.y,m=al?a>f?a:f:l>f?l:f,y=h>d?h>p?h:p:d>p?d:p,g=Q1(m,_,e,t,i),M=Q1(x,y,e,t,i);let S=n.prevZ,E=n.nextZ;for(;S&&S.z>=g&&E&&E.z<=M;){if(S.x>=m&&S.x<=x&&S.y>=_&&S.y<=y&&S!==r&&S!==o&&Gc(a,h,l,d,f,p,S.x,S.y)&&kn(S.prev,S,S.next)>=0||(S=S.prevZ,E.x>=m&&E.x<=x&&E.y>=_&&E.y<=y&&E!==r&&E!==o&&Gc(a,h,l,d,f,p,E.x,E.y)&&kn(E.prev,E,E.next)>=0))return!1;E=E.nextZ}for(;S&&S.z>=g;){if(S.x>=m&&S.x<=x&&S.y>=_&&S.y<=y&&S!==r&&S!==o&&Gc(a,h,l,d,f,p,S.x,S.y)&&kn(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;E&&E.z<=M;){if(E.x>=m&&E.x<=x&&E.y>=_&&E.y<=y&&E!==r&&E!==o&&Gc(a,h,l,d,f,p,E.x,E.y)&&kn(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function hH(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!Nv(r,s)&&Q3(r,i,i.next,s)&&Gd(r,s)&&Gd(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),Wd(i),Wd(i.next),i=n=s),i=i.next}while(i!==n);return Eu(i)}function dH(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&MH(o,a)){let l=$3(o,a);o=Eu(o,o.next),l=Eu(l,l.next),Vd(o,e,t,i,r,s,0),Vd(l,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function pH(n,e,t,i){const r=[];let s,o,a,l,f;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&&Gc(or.x||t.x===r.x&&_H(r,t)))&&(r=t,h=d)),t=t.next;while(t!==a);return r}function _H(n,e){return kn(n.prev,n,e.prev)<0&&kn(e.next,n,n.next)<0}function yH(n,e,t,i){let r=n;do r.z===0&&(r.z=Q1(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,xH(r)}function xH(n){let e,t,i,r,s,o,a,l,f=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,f*=2}while(o>1);return n}function Q1(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 SH(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 MH(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!wH(n,e)&&(Gd(n,e)&&Gd(e,n)&&EH(n,e)&&(kn(n.prev,n,e.prev)||kn(n,e.prev,e))||Nv(n,e)&&kn(n.prev,n,n.next)>0&&kn(e.prev,e,e.next)>0)}function kn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Nv(n,e){return n.x===e.x&&n.y===e.y}function Q3(n,e,t,i){const r=vg(kn(n,e,t)),s=vg(kn(n,e,i)),o=vg(kn(t,i,n)),a=vg(kn(t,i,e));return!!(r!==s&&o!==a||r===0&&gg(n,t,e)||s===0&&gg(n,i,e)||o===0&&gg(t,n,i)||a===0&&gg(t,e,i))}function gg(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 vg(n){return n>0?1:n<0?-1:0}function wH(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&&Q3(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Gd(n,e){return kn(n.prev,n,n.next)<0?kn(n,e,n.next)>=0&&kn(n,n.prev,e)>=0:kn(n,e,n.prev)<0||kn(n,n.next,e)<0}function EH(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 $3(n,e){const t=new $1(n.i,n.x,n.y),i=new $1(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 WC(n,e,t,i){const r=new $1(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 Wd(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 $1(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 TH(n,e,t,i){let r=0;for(let s=e,o=t-i;s2&&n[e-1].equals(n[0])&&n.pop()}function YC(n,e){for(let t=0;tNumber.EPSILON){const O=Math.sqrt($t),de=Math.sqrt(mt*mt+dt*dt),Ce=we.x-Ye/O,Le=we.y+He/O,Ue=ye.x-dt/de,tt=ye.y+mt/de,Oe=((Ue-Ce)*dt-(tt-Le)*mt)/(He*dt-Ye*mt);Ie=Ce+He*Oe-Z.x,Ae=Le+Ye*Oe-Z.y;const Me=Ie*Ie+Ae*Ae;if(Me<=2)return new be(Ie,Ae);te=Math.sqrt(Me/2)}else{let O=!1;He>Number.EPSILON?mt>Number.EPSILON&&(O=!0):He<-Number.EPSILON?mt<-Number.EPSILON&&(O=!0):Math.sign(Ye)===Math.sign(dt)&&(O=!0),O?(Ie=-Ye,Ae=He,te=Math.sqrt($t)):(Ie=He,Ae=Ye,te=Math.sqrt($t/2))}return new be(Ie/te,Ae/te)}const G=[];for(let Z=0,we=Q.length,ye=we-1,Ie=Z+1;Z=0;Z--){const we=Z/y,ye=m*Math.cos(we*Math.PI/2),Ie=_*Math.sin(we*Math.PI/2)+x;for(let Ae=0,te=Q.length;Ae=0;){const Ie=ye;let Ae=ye-1;Ae<0&&(Ae=Z.length-1);for(let te=0,He=h+y*2;te0)&&m.push(S,E,R),(g!==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 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.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 iL extends Ni{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ge(16777215),this.specular=new Ge(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ge(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ml,this.normalScale=new be(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=up,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.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 rL extends Ni{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ge(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ge(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ml,this.normalScale=new be(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 sL extends Ni{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ml,this.normalScale=new be(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 oL extends Ni{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ge(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ge(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ml,this.normalScale=new be(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=up,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.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 aL extends Ni{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ge(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ml,this.normalScale=new be(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 lL extends mr{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 ps(n,e,t){return hw(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function tu(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 hw(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function uL(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 eS(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 dw(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 bH(n,e,t,i,r=30){const s=n.clone();s.name=e;const o=[];for(let l=0;l=i)){d.push(f.times[m]);for(let x=0;xs.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=a.times[_]){const g=_*d+h,M=g+d-h;x=ps(a.values,g,M)}else{const g=a.createInterpolant(),M=h,S=d-h;g.evaluate(s),x=ps(g.resultBuffer,M,S)}l==="quaternion"&&new Rr().fromArray(x).normalize().conjugate().toArray(x);const y=f.times.length;for(let g=0;g=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=ps(i,s,o),this.values=ps(this.values,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&&hw(r))for(let a=0,l=r.length;a!==l;++a){const f=r[a];if(isNaN(f)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,f),e=!1;break}}return e}optimize(){const e=ps(this.times),t=ps(this.values),i=this.getValueSize(),r=this.getInterpolation()===r0,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*i,l=o*i,f=0;f!==i;++f)t[l+f]=t[a+f];++o}return o!==e.length?(this.times=ps(e,0,o),this.values=ps(t,0,o*i)):(this.times=e,this.values=t),this}clone(){const e=ps(this.times,0),t=ps(this.values,0),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}eo.prototype.TimeBufferType=Float32Array;eo.prototype.ValueBufferType=Float32Array;eo.prototype.DefaultInterpolation=Fd;class Nu extends eo{}Nu.prototype.ValueTypeName="bool";Nu.prototype.ValueBufferType=Array;Nu.prototype.DefaultInterpolation=Nd;Nu.prototype.InterpolantFactoryMethodLinear=void 0;Nu.prototype.InterpolantFactoryMethodSmooth=void 0;class mw extends eo{}mw.prototype.ValueTypeName="color";class Xd extends eo{}Xd.prototype.ValueTypeName="number";class hL extends Tp{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 f=e*a;for(let h=f+a;f!==h;f+=4)Rr.slerpFlat(s,0,o,f-a,o,f,l);return s}}class zf extends eo{InterpolantFactoryMethodLinear(e){return new hL(this.times,this.values,this.getValueSize(),e)}}zf.prototype.ValueTypeName="quaternion";zf.prototype.DefaultInterpolation=Fd;zf.prototype.InterpolantFactoryMethodSmooth=void 0;class Fu extends eo{}Fu.prototype.ValueTypeName="string";Fu.prototype.ValueBufferType=Array;Fu.prototype.DefaultInterpolation=Nd;Fu.prototype.InterpolantFactoryMethodLinear=void 0;Fu.prototype.InterpolantFactoryMethodSmooth=void 0;class Yd extends eo{}Yd.prototype.ValueTypeName="vector";class jd{constructor(e,t=-1,i,r=wv){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=Zr(),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(DH(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(eo.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,o=[];for(let a=0;a1){const d=h[1];let p=r[d];p||(r[d]=p=[]),p.push(f)}}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(d,p,m,_,x){if(m.length!==0){const y=[],g=[];dw(m,y,g,_),y.length!==0&&x.push(new d(p,y,g))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const f=e.hierarchy||[];for(let d=0;d{t&&t(s),this.manager.itemEnd(e)},0),s;if(Bo[e]!==void 0){Bo[e].push({onLoad:t,onProgress:i,onError:r});return}Bo[e]=[],Bo[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(f=>{if(f.status===200||f.status===0){if(f.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;const h=Bo[e],d=f.body.getReader(),p=f.headers.get("Content-Length")||f.headers.get("X-File-Size"),m=p?parseInt(p):0,_=m!==0;let x=0;const y=new ReadableStream({start(g){M();function M(){d.read().then(({done:S,value:E})=>{if(S)g.close();else{x+=E.byteLength;const C=new ProgressEvent("progress",{lengthComputable:_,loaded:x,total:m});for(let R=0,P=h.length;R{switch(l){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(h=>new DOMParser().parseFromString(h,a));case"json":return f.json();default:if(a===void 0)return f.text();{const d=/charset="?([^;"\s]*)"?/i.exec(a),p=d&&d[1]?d[1].toLowerCase():void 0,m=new TextDecoder(p);return f.arrayBuffer().then(_=>m.decode(_))}}}).then(f=>{Tu.add(e,f);const h=Bo[e];delete Bo[e];for(let d=0,p=h.length;d{const h=Bo[e];if(h===void 0)throw this.manager.itemError(e),f;delete Bo[e];for(let d=0,p=h.length;d{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class FH extends ts{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new aa(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 Ge().setHex(o.value);break;case"v2":r.uniforms[s].value=new be().fromArray(o.value);break;case"v3":r.uniforms[s].value=new V().fromArray(o.value);break;case"v4":r.uniforms[s].value=new dn().fromArray(o.value);break;case"m3":r.uniforms[s].value=new Vt().fromArray(o.value);break;case"m4":r.uniforms[s].value=new Ft().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 be().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.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 be().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:tL,SpriteMaterial:tw,RawShaderMaterial:nL,ShaderMaterial:Ps,PointsMaterial:iw,MeshPhysicalMaterial:Fv,MeshStandardMaterial:fw,MeshPhongMaterial:iL,MeshToonMaterial:rL,MeshNormalMaterial:sL,MeshLambertMaterial:oL,MeshDepthMaterial:JM,MeshDistanceMaterial:QM,MeshBasicMaterial:gl,MeshMatcapMaterial:aL,LineDashedMaterial:lL,LineBasicMaterial:mr,Material:Ni};return new t[e]}}class tS{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i0){const l=new gw(t);s=new qd(l),s.setCrossOrigin(this.crossOrigin);for(let f=0,h=e.length;f0){r=new qd(this.manager),r.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Tu.get(e);if(o!==void 0)return s.manager.itemStart(e),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,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){Tu.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){r&&r(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}let _g;class yw{static getContext(){return _g===void 0&&(_g=new(window.AudioContext||window.webkitAudioContext)),_g}static setContext(e){_g=e}}class WH extends ts{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new aa(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const f=l.slice(0);yw.getContext().decodeAudioData(f,function(d){t(d)},a)}catch(f){a(f)}},i,r);function a(l){r?r(l):console.error(l),s.manager.itemError(e)}}}class XH extends Uv{constructor(e,t,i=1){super(void 0,i),this.isHemisphereLightProbe=!0;const r=new Ge().set(e),s=new Ge().set(t),o=new V(r.r,r.g,r.b),a=new V(s.r,s.g,s.b),l=Math.sqrt(Math.PI),f=l*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(f)}}class YH extends Uv{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const i=new Ge().set(e);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const e2=new Ft,t2=new Ft,Dl=new Ft;class jH{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Si,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Si,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,Dl.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,o=t.near*Math.tan(au*t.fov*.5)/t.zoom;let a,l;t2.elements[12]=-r,e2.elements[12]=r,a=-o*t.aspect+s,l=o*t.aspect+s,Dl.elements[0]=2*t.near/(l-a),Dl.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Dl),a=-o*t.aspect-s,l=o*t.aspect-s,Dl.elements[0]=2*t.near/(l-a),Dl.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Dl)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(t2),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(e2)}}class xw{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=n2(),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=n2();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function n2(){return(typeof performance>"u"?Date:performance).now()}const Nl=new V,i2=new Rr,qH=new V,Fl=new V;class ZH extends jt{constructor(){super(),this.type="AudioListener",this.context=yw.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new xw}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(Nl,i2,qH),Fl.set(0,0,-1).applyQuaternion(i2),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Nl.x,r),t.positionY.linearRampToValueAtTime(Nl.y,r),t.positionZ.linearRampToValueAtTime(Nl.z,r),t.forwardX.linearRampToValueAtTime(Fl.x,r),t.forwardY.linearRampToValueAtTime(Fl.y,r),t.forwardZ.linearRampToValueAtTime(Fl.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(Nl.x,Nl.y,Nl.z),t.setOrientation(Fl.x,Fl.y,Fl.z,i.x,i.y,i.z)}}class EL 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,f=t+t;l!==f;++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){Rr.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const o=this._workIndex*s;Rr.multiplyQuaternionsFlat(e,o,e,t,e,i),Rr.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 Sw="\\[\\]\\.:\\/",$H=new RegExp("["+Sw+"]","g"),Mw="[^"+Sw+"]",eV="[^"+Sw.replace("\\.","")+"]",tV=/((?:WC+[\/:])*)/.source.replace("WC",Mw),nV=/(WCOD+)?/.source.replace("WCOD",eV),iV=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Mw),rV=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Mw),sV=new RegExp("^"+tV+nV+iV+rV+"$"),oV=["material","materials","bones","map"];class aV{constructor(e,t,i){const r=i||nn.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 nn{constructor(e,t,i){this.path=t,this.parsedPath=i||nn.parseTrackName(t),this.node=nn.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 nn.Composite(e,t,i):new nn(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace($H,"")}static parseTrackName(e){const t=sV.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);oV.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 d=s++,p=e[d];t[p.uuid]=h,e[h]=p,t[f]=d,e[d]=l;for(let m=0,_=r;m!==_;++m){const x=i[m],y=x[d],g=x[h];x[h]=y,x[d]=g}}}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 f=arguments[a],h=f.uuid,d=t[h];if(d!==void 0)if(delete t[h],d0&&(t[m.uuid]=d),e[d]=m,e.pop();for(let _=0,x=r;_!==x;++_){const y=i[_];y[d]=y[p],y.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,f=l.length,h=this.nCachedObjects_,d=new Array(f);r=s.length,i[e]=r,o.push(e),a.push(t),s.push(d);for(let p=h,m=l.length;p!==m;++p){const _=l[p];d[p]=new nn(_,e,t)}return d}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],f=e[a];t[f]=i,o[i]=l,o.pop(),s[i]=s[a],s.pop(),r[i]=r[a],r.pop()}}}class AL{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:Jl,endingEnd:Jl};for(let f=0;f!==o;++f){const h=s[f].createInterpolant(null);a[f]=h,h.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=h3,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,f=a.sampleValues;return l[0]=s,l[1]=s+i,f[0]=e/o,f[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,f=this._propertyBindings;switch(this.blendMode){case zM:for(let h=0,d=l.length;h!==d;++h)l[h].evaluate(o),f[h].accumulateAdditive(a);break;case wv:default:for(let h=0,d=l.length;h!==d;++h)l[h].evaluate(o),f[h].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===d3;if(e===0)return s===-1?r:o&&(s&1)===1?t-r:r;if(i===f3){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 f=e<0;this._setEndings(f,!f,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=Ql,r.endingEnd=Ql):(e?r.endingStart=this.zeroSlopeAtStart?Ql:Jl:r.endingStart=Ud,t?r.endingEnd=this.zeroSlopeAtEnd?Ql:Jl:r.endingEnd=Ud)}_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 uV=new Float32Array(1);class cV extends fa{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,f=this._bindingsByRootAndName;let h=f[l];h===void 0&&(h={},f[l]=h);for(let d=0;d!==s;++d){const p=r[d],m=p.name;let _=h[m];if(_!==void 0)++_.referenceCount,o[d]=_;else{if(_=o[d],_!==void 0){_._cacheIndex===null&&(++_.referenceCount,this._addInactiveBinding(_,l,m));continue}const x=t&&t._propertyBindings[d].binding.parsedPath;_=new TL(nn.create(i,m,x),p.ValueTypeName,p.getValueSize()),++_.referenceCount,this._addInactiveBinding(_,l,m),o[d]=_}a[d].resultBuffer=_.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 f=0;f!==i;++f)t[f]._update(r,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let f=0;f!==l;++f)a[f].apply(o);return this}setTime(e){this.time=0;for(let t=0;tthis.max.x||e.ythis.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.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,o2).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 a2=new V,yg=new V;class _V{constructor(e=new V,t=new V){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){a2.subVectors(e,this.start),yg.subVectors(this.end,this.start);const i=yg.dot(yg);let s=yg.dot(a2)/i;return t&&(s=Yn(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 l2=new V;class yV extends jt{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new Wt,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 d=0;d.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{d2.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(d2,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 IV extends Ao{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 Wt;r.setAttribute("position",new pt(t,3)),r.setAttribute("color",new pt(i,3));const s=new mr({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new Ge,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 DV{constructor(){this.type="ShapePath",this.color=new Ge,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Hd,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(g){const M=[];for(let S=0,E=g.length;SNumber.EPSILON){if(I<0&&(P=M[R],b=-b,D=M[C],I=-I),g.yD.y)continue;if(g.y===P.y){if(g.x===P.x)return!0}else{const z=I*(g.x-P.x)-b*(g.y-P.y);if(z===0)return!0;if(z<0)continue;E=!E}}else{if(g.y!==P.y)continue;if(D.x<=g.x&&g.x<=P.x||P.x<=g.x&&g.x<=D.x)return!0}}return E}const r=xo.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const f=[];if(s.length===1)return a=s[0],l=new uu,l.curves=a.curves,f.push(l),f;let h=!r(s[0].getPoints());h=e?!h:h;const d=[],p=[];let m=[],_=0,x;p[_]=void 0,m[_]=[];for(let g=0,M=s.length;g1){let g=!1,M=0;for(let S=0,E=p.length;S0&&g===!1&&(m=d)}let y;for(let g=0,M=p.length;g{const d=typeof f=="function"?f(e):f;if(d!==e){const p=e;e=h?d:Object.assign({},e,d),t.forEach(m=>m(e,p))}},r=()=>e,s=(f,h=r,d=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let p=h(e);function m(){const _=h(e);if(!d(p,_)){const x=p;f(p=_,x)}}return t.add(m),()=>t.delete(m)},l={setState:i,getState:r,subscribe:(f,h,d)=>h||d?s(f,h,d):(t.add(f),()=>t.delete(f)),destroy:()=>t.clear()};return e=n(i,r,l),l}const tG=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),p2=tG?ie.useEffect:ie.useLayoutEffect;function bL(n){const e=typeof n=="function"?eG(n):n,t=(i=e.getState,r=Object.is)=>{const[,s]=ie.useReducer(y=>y+1,0),o=e.getState(),a=ie.useRef(o),l=ie.useRef(i),f=ie.useRef(r),h=ie.useRef(!1),d=ie.useRef();d.current===void 0&&(d.current=i(o));let p,m=!1;(a.current!==o||l.current!==i||f.current!==r||h.current)&&(p=i(o),m=!r(d.current,p)),p2(()=>{m&&(d.current=p),a.current=o,l.current=i,f.current=r,h.current=!1});const _=ie.useRef(o);p2(()=>{const y=()=>{try{const M=e.getState(),S=l.current(M);f.current(d.current,S)||(a.current=M,d.current=S,s())}catch{h.current=!0,s()}},g=e.subscribe(y);return e.getState()!==_.current&&y(),g},[]);const x=m?p:d.current;return ie.useDebugValue(x),x};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}var PL={exports:{}},Jy={exports:{}},Qy={};/** * @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. */var m2;function nG(){return m2||(m2=1,function(n){function e(k,G){var F=k.length;k.push(G);e:for(;0>>1,j=k[re];if(0>>1;rer(Pe,F))_er(Re,Pe)?(k[re]=Re,k[_e]=F,re=_e):(k[re]=Pe,k[le]=F,re=le);else if(_er(Re,F))k[re]=Re,k[_e]=F,re=_e;else break e}}return G}function r(k,G){var F=k.sortIndex-G.sortIndex;return F!==0?F:k.id-G.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=[],f=[],h=1,d=null,p=3,m=!1,_=!1,x=!1,y=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(k){for(var G=t(f);G!==null;){if(G.callback===null)i(f);else if(G.startTime<=k)i(f),G.sortIndex=G.expirationTime,e(l,G);else break;G=t(f)}}function E(k){if(x=!1,S(k),!_)if(t(l)!==null)_=!0,oe(C);else{var G=t(f);G!==null&&$(E,G.startTime-k)}}function C(k,G){_=!1,x&&(x=!1,g(D),D=-1),m=!0;var F=p;try{for(S(G),d=t(l);d!==null&&(!(d.expirationTime>G)||k&&!z());){var re=d.callback;if(typeof re=="function"){d.callback=null,p=d.priorityLevel;var j=re(d.expirationTime<=G);G=n.unstable_now(),typeof j=="function"?d.callback=j:d===t(l)&&i(l),S(G)}else i(l);d=t(l)}if(d!==null)var ve=!0;else{var le=t(f);le!==null&&$(E,le.startTime-G),ve=!1}return ve}finally{d=null,p=F,m=!1}}var R=!1,P=null,D=-1,b=5,I=-1;function z(){return!(n.unstable_now()-Ik||125re?(k.sortIndex=F,e(f,k),t(l)===null&&k===t(f)&&(x?(g(D),D=-1):x=!0,$(E,F-re))):(k.sortIndex=j,e(l,k),_||m||(_=!0,oe(C))),k},n.unstable_shouldYield=z,n.unstable_wrapCallback=function(k){var G=p;return function(){var F=p;p=G;try{return k.apply(this,arguments)}finally{p=F}}}}(Qy)),Qy}var g2;function iG(){return g2||(g2=1,Jy.exports=nG()),Jy.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 rG=function(e){var t={},i=ie,r=iG(),s=Object.assign;function o(u){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+u,v=1;vne||T[Y]!==L[ne]){var Ee=` `+T[Y].replace(" at new "," at ");return u.displayName&&Ee.includes("")&&(Ee=Ee.replace("",u.displayName)),Ee}while(1<=Y&&0<=ne);break}}}finally{De=!1,Error.prepareStackTrace=v}return(u=u?u.displayName||u.name:"")?ke(u):""}var gt=Object.prototype.hasOwnProperty,vt=[],at=-1;function qe(u){return{current:u}}function wt(u){0>at||(u.current=vt[at],vt[at]=null,at--)}function st(u,c){at++,vt[at]=u.current,u.current=c}var It={},cn=qe(It),Rt=qe(!1),fn=It;function sn(u,c){var v=u.type.contextTypes;if(!v)return It;var w=u.stateNode;if(w&&w.__reactInternalMemoizedUnmaskedChildContext===c)return w.__reactInternalMemoizedMaskedChildContext;var T={},L;for(L in v)T[L]=c[L];return w&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=c,u.__reactInternalMemoizedMaskedChildContext=T),T}function mn(u){return u=u.childContextTypes,u!=null}function Zn(){wt(Rt),wt(cn)}function Lt(u,c,v){if(cn.current!==It)throw Error(o(168));st(cn,c),st(Rt,v)}function In(u,c,v){var w=u.stateNode;if(c=c.childContextTypes,typeof w.getChildContext!="function")return v;w=w.getChildContext();for(var T in w)if(!(T in c))throw Error(o(108,D(u)||"Unknown",T));return s({},v,w)}function un(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||It,fn=cn.current,st(cn,u),st(Rt,Rt.current),!0}function Jt(u,c,v){var w=u.stateNode;if(!w)throw Error(o(169));v?(u=In(u,c,fn),w.__reactInternalMemoizedMergedChildContext=u,wt(Rt),wt(cn),st(cn,u)):wt(Rt),st(Rt,v)}var Cn=Math.clz32?Math.clz32:to,Co=Math.log,Qi=Math.LN2;function to(u){return u>>>=0,u===0?32:31-(Co(u)/Qi|0)|0}var bp=64,Pp=4194304;function Hf(u){switch(u&-u){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 u&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return u&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return u}}function Lp(u,c){var v=u.pendingLanes;if(v===0)return 0;var w=0,T=u.suspendedLanes,L=u.pingedLanes,Y=v&268435455;if(Y!==0){var ne=Y&~T;ne!==0?w=Hf(ne):(L&=Y,L!==0&&(w=Hf(L)))}else Y=v&~T,Y!==0?w=Hf(Y):L!==0&&(w=Hf(L));if(w===0)return 0;if(c!==0&&c!==w&&!(c&T)&&(T=w&-w,L=c&-c,T>=L||T===16&&(L&4194240)!==0))return c;if(w&4&&(w|=v&16),c=u.entangledLanes,c!==0)for(u=u.entanglements,c&=w;0v;v++)c.push(u);return c}function Vf(u,c,v){u.pendingLanes|=c,c!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,c=31-Cn(c),u[c]=v}function BD(u,c){var v=u.pendingLanes&~c;u.pendingLanes=c,u.suspendedLanes=0,u.pingedLanes=0,u.expiredLanes&=c,u.mutableReadLanes&=c,u.entangledLanes&=c,c=u.entanglements;var w=u.eventTimes;for(u=u.expirationTimes;0>=Y,T-=Y,Po=1<<32-Cn(c)+T|v<an?(gi=Nt,Nt=null):gi=Nt.sibling;var ln=Et(fe,Nt,Se[an],et);if(ln===null){Nt===null&&(Nt=gi);break}u&&Nt&&ln.alternate===null&&c(fe,Nt),se=L(ln,se,an),Bt===null?_t=ln:Bt.sibling=ln,Bt=ln,Nt=gi}if(an===Se.length)return v(fe,Nt),Rn&&Sl(fe,an),_t;if(Nt===null){for(;anan?(gi=Nt,Nt=null):gi=Nt.sibling;var Sa=Et(fe,Nt,ln.value,et);if(Sa===null){Nt===null&&(Nt=gi);break}u&&Nt&&Sa.alternate===null&&c(fe,Nt),se=L(Sa,se,an),Bt===null?_t=Sa:Bt.sibling=Sa,Bt=Sa,Nt=gi}if(ln.done)return v(fe,Nt),Rn&&Sl(fe,an),_t;if(Nt===null){for(;!ln.done;an++,ln=Se.next())ln=Dt(fe,ln.value,et),ln!==null&&(se=L(ln,se,an),Bt===null?_t=ln:Bt.sibling=ln,Bt=ln);return Rn&&Sl(fe,an),_t}for(Nt=w(fe,Nt);!ln.done;an++,ln=Se.next())ln=gn(Nt,fe,an,ln.value,et),ln!==null&&(u&&ln.alternate!==null&&Nt.delete(ln.key===null?an:ln.key),se=L(ln,se,an),Bt===null?_t=ln:Bt.sibling=ln,Bt=ln);return u&&Nt.forEach(function(TN){return c(fe,TN)}),Rn&&Sl(fe,an),_t}function us(fe,se,Se,et){if(typeof Se=="object"&&Se!==null&&Se.type===h&&Se.key===null&&(Se=Se.props.children),typeof Se=="object"&&Se!==null){switch(Se.$$typeof){case l:e:{for(var _t=Se.key,Bt=se;Bt!==null;){if(Bt.key===_t){if(_t=Se.type,_t===h){if(Bt.tag===7){v(fe,Bt.sibling),se=T(Bt,Se.props.children),se.return=fe,fe=se;break e}}else if(Bt.elementType===_t||typeof _t=="object"&&_t!==null&&_t.$$typeof===S&&vE(_t)===Bt.type){v(fe,Bt.sibling),se=T(Bt,Se.props),se.ref=Xf(fe,Bt,Se),se.return=fe,fe=se;break e}v(fe,Bt);break}else c(fe,Bt);Bt=Bt.sibling}Se.type===h?(se=Rl(Se.props.children,fe.mode,et,Se.key),se.return=fe,fe=se):(et=ym(Se.type,Se.key,Se.props,null,fe.mode,et),et.ref=Xf(fe,se,Se),et.return=fe,fe=et)}return Y(fe);case f:e:{for(Bt=Se.key;se!==null;){if(se.key===Bt)if(se.tag===4&&se.stateNode.containerInfo===Se.containerInfo&&se.stateNode.implementation===Se.implementation){v(fe,se.sibling),se=T(se,Se.children||[]),se.return=fe,fe=se;break e}else{v(fe,se);break}else c(fe,se);se=se.sibling}se=W_(Se,fe.mode,et),se.return=fe,fe=se}return Y(fe);case S:return Bt=Se._init,us(fe,se,Bt(Se._payload),et)}if(ee(Se))return yt(fe,se,Se,et);if(R(Se))return Oi(fe,se,Se,et);Vp(fe,Se)}return typeof Se=="string"&&Se!==""||typeof Se=="number"?(Se=""+Se,se!==null&&se.tag===6?(v(fe,se.sibling),se=T(se,Se),se.return=fe,fe=se):(v(fe,se),se=G_(Se,fe.mode,et),se.return=fe,fe=se),Y(fe)):v(fe,se)}return us}var Gu=_E(!0),yE=_E(!1),Yf={},ss=qe(Yf),jf=qe(Yf),Wu=qe(Yf);function oo(u){if(u===Yf)throw Error(o(174));return u}function a_(u,c){st(Wu,c),st(jf,u),st(ss,Yf),u=$(c),wt(ss),st(ss,u)}function Xu(){wt(ss),wt(jf),wt(Wu)}function xE(u){var c=oo(Wu.current),v=oo(ss.current);c=k(v,u.type,c),v!==c&&(st(jf,u),st(ss,c))}function l_(u){jf.current===u&&(wt(ss),wt(jf))}var Dn=qe(0);function Gp(u){for(var c=u;c!==null;){if(c.tag===13){var v=c.memoizedState;if(v!==null&&(v=v.dehydrated,v===null||xt(v)||At(v)))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if(c.flags&128)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===u)break;for(;c.sibling===null;){if(c.return===null||c.return===u)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var u_=[];function c_(){for(var u=0;uv?v:4,u(!0);var w=os.transition;os.transition={};try{u(!1),c()}finally{on=v,os.transition=w}}function NE(){return ao().memoizedState}function QD(u,c,v){var w=_a(u);v={lane:w,action:v,hasEagerState:!1,eagerState:null,next:null},FE(u)?UE(c,v):(kE(u,c,v),v=er(),u=as(u,w,v),u!==null&&OE(u,c,w))}function $D(u,c,v){var w=_a(u),T={lane:w,action:v,hasEagerState:!1,eagerState:null,next:null};if(FE(u))UE(c,T);else{kE(u,c,T);var L=u.alternate;if(u.lanes===0&&(L===null||L.lanes===0)&&(L=c.lastRenderedReducer,L!==null))try{var Y=c.lastRenderedState,ne=L(Y,v);if(T.hasEagerState=!0,T.eagerState=ne,io(ne,Y))return}catch{}finally{}v=er(),u=as(u,w,v),u!==null&&OE(u,c,w)}}function FE(u){var c=u.alternate;return u===Gn||c!==null&&c===Gn}function UE(u,c){qf=Xp=!0;var v=u.pending;v===null?c.next=c:(c.next=v.next,v.next=c),u.pending=c}function kE(u,c,v){ti!==null&&u.mode&1&&!(Xt&2)?(u=c.interleaved,u===null?(v.next=v,so===null?so=[c]:so.push(c)):(v.next=u.next,u.next=v),c.interleaved=v):(u=c.pending,u===null?v.next=v:(v.next=u.next,u.next=v),c.pending=v)}function OE(u,c,v){if(v&4194240){var w=c.lanes;w&=u.pendingLanes,v|=w,c.lanes=v,Wv(u,v)}}var Kp={readContext:ns,useCallback:Ui,useContext:Ui,useEffect:Ui,useImperativeHandle:Ui,useInsertionEffect:Ui,useLayoutEffect:Ui,useMemo:Ui,useReducer:Ui,useRef:Ui,useState:Ui,useDebugValue:Ui,useDeferredValue:Ui,useTransition:Ui,useMutableSource:Ui,useSyncExternalStore:Ui,useId:Ui,unstable_isNewReconciler:!1},eN={readContext:ns,useCallback:function(u,c){return Io().memoizedState=[u,c===void 0?null:c],u},useContext:ns,useEffect:m_,useImperativeHandle:function(u,c,v){return v=v!=null?v.concat([u]):null,qp(4194308,4,PE.bind(null,c,u),v)},useLayoutEffect:function(u,c){return qp(4194308,4,u,c)},useInsertionEffect:function(u,c){return qp(4,2,u,c)},useMemo:function(u,c){var v=Io();return c=c===void 0?null:c,u=u(),v.memoizedState=[u,c],u},useReducer:function(u,c,v){var w=Io();return c=v!==void 0?v(c):c,w.memoizedState=w.baseState=c,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:c},w.queue=u,u=u.dispatch=QD.bind(null,Gn,u),[w.memoizedState,u]},useRef:function(u){var c=Io();return u={current:u},c.memoizedState=u},useState:p_,useDebugValue:g_,useDeferredValue:function(u){var c=p_(u),v=c[0],w=c[1];return m_(function(){var T=os.transition;os.transition={};try{w(u)}finally{os.transition=T}},[u]),v},useTransition:function(){var u=p_(!1),c=u[0];return u=JD.bind(null,u[1]),Io().memoizedState=u,[c,u]},useMutableSource:function(){},useSyncExternalStore:function(u,c,v){var w=Gn,T=Io();if(Rn){if(v===void 0)throw Error(o(407));v=v()}else{if(v=c(),ti===null)throw Error(o(349));Yu&30||wE(w,c,v)}T.memoizedState=v;var L={value:v,getSnapshot:c};return T.queue=L,m_(TE.bind(null,w,L,u),[u]),w.flags|=2048,Kf(9,EE.bind(null,w,L,v,c),void 0,null),v},useId:function(){var u=Io(),c=ti.identifierPrefix;if(Rn){var v=Lo,w=Po;v=(w&~(1<<32-Cn(w)-1)).toString(32)+v,c=":"+c+"R"+v,v=Zf++,0F_&&(c.flags|=128,w=!0,eh(T,!1),c.lanes=4194304)}else{if(!w)if(u=Gp(L),u!==null){if(c.flags|=128,w=!0,u=u.updateQueue,u!==null&&(c.updateQueue=u,c.flags|=4),eh(T,!0),T.tail===null&&T.tailMode==="hidden"&&!L.alternate&&!Rn)return ki(c),null}else 2*pi()-T.renderingStartTime>F_&&v!==1073741824&&(c.flags|=128,w=!0,eh(T,!1),c.lanes=4194304);T.isBackwards?(L.sibling=c.child,c.child=L):(u=T.last,u!==null?u.sibling=L:c.child=L,T.last=L)}return T.tail!==null?(c=T.tail,T.rendering=c,T.tail=c.sibling,T.renderingStartTime=pi(),c.sibling=null,u=Dn.current,st(Dn,w?u&1|2:u&1),c):(ki(c),null);case 22:case 23:return B_(),w=c.memoizedState!==null,u!==null&&u.memoizedState!==null!==w&&(c.flags|=8192),w&&c.mode&1?Ur&1073741824&&(ki(c),Ze&&c.subtreeFlags&6&&(c.flags|=8192)):ki(c),null;case 24:return null;case 25:return null}throw Error(o(156,c.tag))}var sN=a.ReactCurrentOwner,Fr=!1;function $i(u,c,v,w){c.child=u===null?yE(c,null,v,w):Gu(c,u.child,v,w)}function YE(u,c,v,w,T){v=v.render;var L=c.ref;return zu(c,T),w=h_(u,c,v,w,L,T),v=d_(),u!==null&&!Fr?(c.updateQueue=u.updateQueue,c.flags&=-2053,u.lanes&=~T,Do(u,c,T)):(Rn&&v&&n_(c),c.flags|=1,$i(u,c,w,T),c.child)}function jE(u,c,v,w,T){if(u===null){var L=v.type;return typeof L=="function"&&!V_(L)&&L.defaultProps===void 0&&v.compare===null&&v.defaultProps===void 0?(c.tag=15,c.type=L,qE(u,c,L,w,T)):(u=ym(v.type,null,w,c,c.mode,T),u.ref=c.ref,u.return=c,c.child=u)}if(L=u.child,!(u.lanes&T)){var Y=L.memoizedProps;if(v=v.compare,v=v!==null?v:Np,v(Y,w)&&u.ref===c.ref)return Do(u,c,T)}return c.flags|=1,u=xa(L,w),u.ref=c.ref,u.return=c,c.child=u}function qE(u,c,v,w,T){if(u!==null&&Np(u.memoizedProps,w)&&u.ref===c.ref)if(Fr=!1,(u.lanes&T)!==0)u.flags&131072&&(Fr=!0);else return c.lanes=u.lanes,Do(u,c,T);return y_(u,c,v,w,T)}function ZE(u,c,v){var w=c.pendingProps,T=w.children,L=u!==null?u.memoizedState:null;if(w.mode==="hidden")if(!(c.mode&1))c.memoizedState={baseLanes:0,cachePool:null},st(ju,Ur),Ur|=v;else if(v&1073741824)c.memoizedState={baseLanes:0,cachePool:null},w=L!==null?L.baseLanes:v,st(ju,Ur),Ur|=w;else return u=L!==null?L.baseLanes|v:v,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:u,cachePool:null},c.updateQueue=null,st(ju,Ur),Ur|=u,null;else L!==null?(w=L.baseLanes|v,c.memoizedState=null):w=v,st(ju,Ur),Ur|=w;return $i(u,c,T,v),c.child}function KE(u,c){var v=c.ref;(u===null&&v!==null||u!==null&&u.ref!==v)&&(c.flags|=512,c.flags|=2097152)}function y_(u,c,v,w,T){var L=mn(v)?fn:cn.current;return L=sn(c,L),zu(c,T),v=h_(u,c,v,w,L,T),w=d_(),u!==null&&!Fr?(c.updateQueue=u.updateQueue,c.flags&=-2053,u.lanes&=~T,Do(u,c,T)):(Rn&&w&&n_(c),c.flags|=1,$i(u,c,v,T),c.child)}function JE(u,c,v,w,T){if(mn(v)){var L=!0;un(c)}else L=!1;if(zu(c,T),c.stateNode===null)u!==null&&(u.alternate=null,c.alternate=null,c.flags|=2),fE(c,v,w),t_(c,v,w,T),w=!0;else if(u===null){var Y=c.stateNode,ne=c.memoizedProps;Y.props=ne;var Ee=Y.context,ze=v.contextType;typeof ze=="object"&&ze!==null?ze=ns(ze):(ze=mn(v)?fn:cn.current,ze=sn(c,ze));var ut=v.getDerivedStateFromProps,Dt=typeof ut=="function"||typeof Y.getSnapshotBeforeUpdate=="function";Dt||typeof Y.UNSAFE_componentWillReceiveProps!="function"&&typeof Y.componentWillReceiveProps!="function"||(ne!==w||Ee!==ze)&&hE(c,Y,w,ze),pa=!1;var Et=c.memoizedState;Y.state=Et,Op(c,w,Y,T),Ee=c.memoizedState,ne!==w||Et!==Ee||Rt.current||pa?(typeof ut=="function"&&(e_(c,v,ut,w),Ee=c.memoizedState),(ne=pa||cE(c,v,ne,w,Et,Ee,ze))?(Dt||typeof Y.UNSAFE_componentWillMount!="function"&&typeof Y.componentWillMount!="function"||(typeof Y.componentWillMount=="function"&&Y.componentWillMount(),typeof Y.UNSAFE_componentWillMount=="function"&&Y.UNSAFE_componentWillMount()),typeof Y.componentDidMount=="function"&&(c.flags|=4194308)):(typeof Y.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=w,c.memoizedState=Ee),Y.props=w,Y.state=Ee,Y.context=ze,w=ne):(typeof Y.componentDidMount=="function"&&(c.flags|=4194308),w=!1)}else{Y=c.stateNode,oE(u,c),ne=c.memoizedProps,ze=c.type===c.elementType?ne:Is(c.type,ne),Y.props=ze,Dt=c.pendingProps,Et=Y.context,Ee=v.contextType,typeof Ee=="object"&&Ee!==null?Ee=ns(Ee):(Ee=mn(v)?fn:cn.current,Ee=sn(c,Ee));var gn=v.getDerivedStateFromProps;(ut=typeof gn=="function"||typeof Y.getSnapshotBeforeUpdate=="function")||typeof Y.UNSAFE_componentWillReceiveProps!="function"&&typeof Y.componentWillReceiveProps!="function"||(ne!==Dt||Et!==Ee)&&hE(c,Y,w,Ee),pa=!1,Et=c.memoizedState,Y.state=Et,Op(c,w,Y,T);var yt=c.memoizedState;ne!==Dt||Et!==yt||Rt.current||pa?(typeof gn=="function"&&(e_(c,v,gn,w),yt=c.memoizedState),(ze=pa||cE(c,v,ze,w,Et,yt,Ee)||!1)?(ut||typeof Y.UNSAFE_componentWillUpdate!="function"&&typeof Y.componentWillUpdate!="function"||(typeof Y.componentWillUpdate=="function"&&Y.componentWillUpdate(w,yt,Ee),typeof Y.UNSAFE_componentWillUpdate=="function"&&Y.UNSAFE_componentWillUpdate(w,yt,Ee)),typeof Y.componentDidUpdate=="function"&&(c.flags|=4),typeof Y.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof Y.componentDidUpdate!="function"||ne===u.memoizedProps&&Et===u.memoizedState||(c.flags|=4),typeof Y.getSnapshotBeforeUpdate!="function"||ne===u.memoizedProps&&Et===u.memoizedState||(c.flags|=1024),c.memoizedProps=w,c.memoizedState=yt),Y.props=w,Y.state=yt,Y.context=Ee,w=ze):(typeof Y.componentDidUpdate!="function"||ne===u.memoizedProps&&Et===u.memoizedState||(c.flags|=4),typeof Y.getSnapshotBeforeUpdate!="function"||ne===u.memoizedProps&&Et===u.memoizedState||(c.flags|=1024),w=!1)}return x_(u,c,v,w,L,T)}function x_(u,c,v,w,T,L){KE(u,c);var Y=(c.flags&128)!==0;if(!w&&!Y)return T&&Jt(c,v,!1),Do(u,c,L);w=c.stateNode,sN.current=c;var ne=Y&&typeof v.getDerivedStateFromError!="function"?null:w.render();return c.flags|=1,u!==null&&Y?(c.child=Gu(c,u.child,null,L),c.child=Gu(c,null,ne,L)):$i(u,c,ne,L),c.memoizedState=w.state,T&&Jt(c,v,!0),c.child}function QE(u){var c=u.stateNode;c.pendingContext?Lt(u,c.pendingContext,c.pendingContext!==c.context):c.context&&Lt(u,c.context,!1),a_(u,c.containerInfo)}function $E(u,c,v,w,T){return Vu(),o_(T),c.flags|=256,$i(u,c,v,w),c.child}var $p={dehydrated:null,treeContext:null,retryLane:0};function em(u){return{baseLanes:u,cachePool:null}}function eT(u,c,v){var w=c.pendingProps,T=Dn.current,L=!1,Y=(c.flags&128)!==0,ne;if((ne=Y)||(ne=u!==null&&u.memoizedState===null?!1:(T&2)!==0),ne?(L=!0,c.flags&=-129):(u===null||u.memoizedState!==null)&&(T|=1),st(Dn,T&1),u===null)return s_(c),u=c.memoizedState,u!==null&&(u=u.dehydrated,u!==null)?(c.mode&1?At(u)?c.lanes=8:c.lanes=1073741824:c.lanes=1,null):(T=w.children,u=w.fallback,L?(w=c.mode,L=c.child,T={mode:"hidden",children:T},!(w&1)&&L!==null?(L.childLanes=0,L.pendingProps=T):L=xm(T,w,0,null),u=Rl(u,w,v,null),L.return=c,u.return=c,L.sibling=u,c.child=L,c.child.memoizedState=em(v),c.memoizedState=$p,u):S_(c,T));if(T=u.memoizedState,T!==null){if(ne=T.dehydrated,ne!==null){if(Y)return c.flags&256?(c.flags&=-257,tm(u,c,v,Error(o(422)))):c.memoizedState!==null?(c.child=u.child,c.flags|=128,null):(L=w.fallback,T=c.mode,w=xm({mode:"visible",children:w.children},T,0,null),L=Rl(L,T,v,null),L.flags|=2,w.return=c,L.return=c,w.sibling=L,c.child=w,c.mode&1&&Gu(c,u.child,null,v),c.child.memoizedState=em(v),c.memoizedState=$p,L);if(!(c.mode&1))c=tm(u,c,v,null);else if(At(ne))c=tm(u,c,v,Error(o(419)));else if(w=(v&u.childLanes)!==0,Fr||w){if(w=ti,w!==null){switch(v&-v){case 4:L=2;break;case 16:L=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:L=32;break;case 536870912:L=268435456;break;default:L=0}w=L&(w.suspendedLanes|v)?0:L,w!==0&&w!==T.retryLane&&(T.retryLane=w,as(u,w,-1))}H_(),c=tm(u,c,v,Error(o(421)))}else xt(ne)?(c.flags|=128,c.child=u.child,c=_N.bind(null,u),hn(ne,c),c=null):(v=T.treeContext,we&&(Nr=Ln(ne),Dr=c,Rn=!0,Ds=null,Gf=!1,v!==null&&(is[rs++]=Po,is[rs++]=Lo,is[rs++]=xl,Po=v.id,Lo=v.overflow,xl=c)),c=S_(c,c.pendingProps.children),c.flags|=4096);return c}return L?(w=nT(u,c,w.children,w.fallback,v),L=c.child,T=u.child.memoizedState,L.memoizedState=T===null?em(v):{baseLanes:T.baseLanes|v,cachePool:null},L.childLanes=u.childLanes&~v,c.memoizedState=$p,w):(v=tT(u,c,w.children,v),c.memoizedState=null,v)}return L?(w=nT(u,c,w.children,w.fallback,v),L=c.child,T=u.child.memoizedState,L.memoizedState=T===null?em(v):{baseLanes:T.baseLanes|v,cachePool:null},L.childLanes=u.childLanes&~v,c.memoizedState=$p,w):(v=tT(u,c,w.children,v),c.memoizedState=null,v)}function S_(u,c){return c=xm({mode:"visible",children:c},u.mode,0,null),c.return=u,u.child=c}function tT(u,c,v,w){var T=u.child;return u=T.sibling,v=xa(T,{mode:"visible",children:v}),!(c.mode&1)&&(v.lanes=w),v.return=c,v.sibling=null,u!==null&&(w=c.deletions,w===null?(c.deletions=[u],c.flags|=16):w.push(u)),c.child=v}function nT(u,c,v,w,T){var L=c.mode;u=u.child;var Y=u.sibling,ne={mode:"hidden",children:v};return!(L&1)&&c.child!==u?(v=c.child,v.childLanes=0,v.pendingProps=ne,c.deletions=null):(v=xa(u,ne),v.subtreeFlags=u.subtreeFlags&14680064),Y!==null?w=xa(Y,w):(w=Rl(w,L,T,null),w.flags|=2),w.return=c,v.return=c,v.sibling=w,c.child=v,w}function tm(u,c,v,w){return w!==null&&o_(w),Gu(c,u.child,null,v),u=S_(c,c.pendingProps.children),u.flags|=2,c.memoizedState=null,u}function iT(u,c,v){u.lanes|=c;var w=u.alternate;w!==null&&(w.lanes|=c),Qv(u.return,c,v)}function M_(u,c,v,w,T){var L=u.memoizedState;L===null?u.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:w,tail:v,tailMode:T}:(L.isBackwards=c,L.rendering=null,L.renderingStartTime=0,L.last=w,L.tail=v,L.tailMode=T)}function rT(u,c,v){var w=c.pendingProps,T=w.revealOrder,L=w.tail;if($i(u,c,w.children,v),w=Dn.current,w&2)w=w&1|2,c.flags|=128;else{if(u!==null&&u.flags&128)e:for(u=c.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&iT(u,v,c);else if(u.tag===19)iT(u,v,c);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===c)break e;for(;u.sibling===null;){if(u.return===null||u.return===c)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}w&=1}if(st(Dn,w),!(c.mode&1))c.memoizedState=null;else switch(T){case"forwards":for(v=c.child,T=null;v!==null;)u=v.alternate,u!==null&&Gp(u)===null&&(T=v),v=v.sibling;v=T,v===null?(T=c.child,c.child=null):(T=v.sibling,v.sibling=null),M_(c,!1,T,v,L);break;case"backwards":for(v=null,T=c.child,c.child=null;T!==null;){if(u=T.alternate,u!==null&&Gp(u)===null){c.child=T;break}u=T.sibling,T.sibling=v,v=T,T=u}M_(c,!0,v,null,L);break;case"together":M_(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function Do(u,c,v){if(u!==null&&(c.dependencies=u.dependencies),qu|=c.lanes,!(v&c.childLanes))return null;if(u!==null&&c.child!==u.child)throw Error(o(153));if(c.child!==null){for(u=c.child,v=xa(u,u.pendingProps),c.child=v,v.return=c;u.sibling!==null;)u=u.sibling,v=v.sibling=xa(u,u.pendingProps),v.return=c;v.sibling=null}return c.child}function oN(u,c,v){switch(c.tag){case 3:QE(c),Vu();break;case 5:xE(c);break;case 1:mn(c.type)&&un(c);break;case 4:a_(c,c.stateNode.containerInfo);break;case 10:sE(c,c.type._context,c.memoizedProps.value);break;case 13:var w=c.memoizedState;if(w!==null)return w.dehydrated!==null?(st(Dn,Dn.current&1),c.flags|=128,null):v&c.child.childLanes?eT(u,c,v):(st(Dn,Dn.current&1),u=Do(u,c,v),u!==null?u.sibling:null);st(Dn,Dn.current&1);break;case 19:if(w=(v&c.childLanes)!==0,u.flags&128){if(w)return rT(u,c,v);c.flags|=128}var T=c.memoizedState;if(T!==null&&(T.rendering=null,T.tail=null,T.lastEffect=null),st(Dn,Dn.current),w)break;return null;case 22:case 23:return c.lanes=0,ZE(u,c,v)}return Do(u,c,v)}function aN(u,c){switch(i_(c),c.tag){case 1:return mn(c.type)&&Zn(),u=c.flags,u&65536?(c.flags=u&-65537|128,c):null;case 3:return Xu(),wt(Rt),wt(cn),c_(),u=c.flags,u&65536&&!(u&128)?(c.flags=u&-65537|128,c):null;case 5:return l_(c),null;case 13:if(wt(Dn),u=c.memoizedState,u!==null&&u.dehydrated!==null){if(c.alternate===null)throw Error(o(340));Vu()}return u=c.flags,u&65536?(c.flags=u&-65537|128,c):null;case 19:return wt(Dn),null;case 4:return Xu(),null;case 10:return Jv(c.type._context),null;case 22:case 23:return B_(),null;case 24:return null;default:return null}}var nm=!1,wl=!1,lN=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function im(u,c){var v=u.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(w){_r(u,c,w)}else v.current=null}function w_(u,c,v){try{v()}catch(w){_r(u,c,w)}}var sT=!1;function uN(u,c){for(G(u.containerInfo),Ke=c;Ke!==null;)if(u=Ke,c=u.child,(u.subtreeFlags&1028)!==0&&c!==null)c.return=u,Ke=c;else for(;Ke!==null;){u=Ke;try{var v=u.alternate;if(u.flags&1024)switch(u.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var w=v.memoizedProps,T=v.memoizedState,L=u.stateNode,Y=L.getSnapshotBeforeUpdate(u.elementType===u.type?w:Is(u.type,w),T);L.__reactInternalSnapshotBeforeUpdate=Y}break;case 3:Ze&&Ne(u.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(ne){_r(u,u.return,ne)}if(c=u.sibling,c!==null){c.return=u.return,Ke=c;break}Ke=u.return}return v=sT,sT=!1,v}function El(u,c,v){var w=c.updateQueue;if(w=w!==null?w.lastEffect:null,w!==null){var T=w=w.next;do{if((T.tag&u)===u){var L=T.destroy;T.destroy=void 0,L!==void 0&&w_(c,v,L)}T=T.next}while(T!==w)}}function th(u,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var v=c=c.next;do{if((v.tag&u)===u){var w=v.create;v.destroy=w()}v=v.next}while(v!==c)}}function E_(u){var c=u.ref;if(c!==null){var v=u.stateNode;switch(u.tag){case 5:u=oe(v);break;default:u=v}typeof c=="function"?c(u):c.current=u}}function oT(u,c,v){if(no&&typeof no.onCommitFiberUnmount=="function")try{no.onCommitFiberUnmount(Ip,c)}catch{}switch(c.tag){case 0:case 11:case 14:case 15:if(u=c.updateQueue,u!==null&&(u=u.lastEffect,u!==null)){var w=u=u.next;do{var T=w,L=T.destroy;T=T.tag,L!==void 0&&(T&2||T&4)&&w_(c,v,L),w=w.next}while(w!==u)}break;case 1:if(im(c,v),u=c.stateNode,typeof u.componentWillUnmount=="function")try{u.props=c.memoizedProps,u.state=c.memoizedState,u.componentWillUnmount()}catch(Y){_r(c,v,Y)}break;case 5:im(c,v);break;case 4:Ze?hT(u,c,v):Z&&Z&&(c=c.stateNode.containerInfo,v=bt(c),St(c,v))}}function aT(u,c,v){for(var w=c;;)if(oT(u,w,v),w.child===null||Ze&&w.tag===4){if(w===c)break;for(;w.sibling===null;){if(w.return===null||w.return===c)return;w=w.return}w.sibling.return=w.return,w=w.sibling}else w.child.return=w,w=w.child}function lT(u){var c=u.alternate;c!==null&&(u.alternate=null,lT(c)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(c=u.stateNode,c!==null&&te(c)),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}function uT(u){return u.tag===5||u.tag===3||u.tag===4}function cT(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||uT(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function fT(u){if(Ze){e:{for(var c=u.return;c!==null;){if(uT(c))break e;c=c.return}throw Error(o(160))}var v=c;switch(v.tag){case 5:c=v.stateNode,v.flags&32&&(ft(c),v.flags&=-33),v=cT(u),A_(u,v,c);break;case 3:case 4:c=v.stateNode.containerInfo,v=cT(u),T_(u,v,c);break;default:throw Error(o(161))}}}function T_(u,c,v){var w=u.tag;if(w===5||w===6)u=u.stateNode,c?Je(v,u,c):tt(v,u);else if(w!==4&&(u=u.child,u!==null))for(T_(u,c,v),u=u.sibling;u!==null;)T_(u,c,v),u=u.sibling}function A_(u,c,v){var w=u.tag;if(w===5||w===6)u=u.stateNode,c?ot(v,u,c):Ue(v,u);else if(w!==4&&(u=u.child,u!==null))for(A_(u,c,v),u=u.sibling;u!==null;)A_(u,c,v),u=u.sibling}function hT(u,c,v){for(var w=c,T=!1,L,Y;;){if(!T){T=w.return;e:for(;;){if(T===null)throw Error(o(160));switch(L=T.stateNode,T.tag){case 5:Y=!1;break e;case 3:L=L.containerInfo,Y=!0;break e;case 4:L=L.containerInfo,Y=!0;break e}T=T.return}T=!0}if(w.tag===5||w.tag===6)aT(u,w,v),Y?je(L,w.stateNode):Qe(L,w.stateNode);else if(w.tag===18)Y?ue(L,w.stateNode):ae(L,w.stateNode);else if(w.tag===4){if(w.child!==null){L=w.stateNode.containerInfo,Y=!0,w.child.return=w,w=w.child;continue}}else if(oT(u,w,v),w.child!==null){w.child.return=w,w=w.child;continue}if(w===c)break;for(;w.sibling===null;){if(w.return===null||w.return===c)return;w=w.return,w.tag===4&&(T=!1)}w.sibling.return=w.return,w=w.sibling}}function C_(u,c){if(Ze){switch(c.tag){case 0:case 11:case 14:case 15:El(3,c,c.return),th(3,c),El(5,c,c.return);return;case 1:return;case 5:var v=c.stateNode;if(v!=null){var w=c.memoizedProps;u=u!==null?u.memoizedProps:w;var T=c.type,L=c.updateQueue;c.updateQueue=null,L!==null&&rt(v,L,T,u,w,c)}return;case 6:if(c.stateNode===null)throw Error(o(162));v=c.memoizedProps,Oe(c.stateNode,u!==null?u.memoizedProps:v,v);return;case 3:we&&u!==null&&u.memoizedState.isDehydrated&&B(c.stateNode.containerInfo);return;case 12:return;case 13:rm(c);return;case 19:rm(c);return;case 17:return}throw Error(o(163))}switch(c.tag){case 0:case 11:case 14:case 15:El(3,c,c.return),th(3,c),El(5,c,c.return);return;case 12:return;case 13:rm(c);return;case 19:rm(c);return;case 3:we&&u!==null&&u.memoizedState.isDehydrated&&B(c.stateNode.containerInfo);break;case 22:case 23:return}e:if(Z){switch(c.tag){case 1:case 5:case 6:break e;case 3:case 4:c=c.stateNode,St(c.containerInfo,c.pendingChildren);break e}throw Error(o(163))}}function rm(u){var c=u.updateQueue;if(c!==null){u.updateQueue=null;var v=u.stateNode;v===null&&(v=u.stateNode=new lN),c.forEach(function(w){var T=yN.bind(null,u,w);v.has(w)||(v.add(w),w.then(T,T))})}}function cN(u,c){for(Ke=c;Ke!==null;){c=Ke;var v=c.deletions;if(v!==null)for(var w=0;w";case om:return":has("+(P_(u)||"")+")";case am:return'[role="'+u.value+'"]';case um:return'"'+u.value+'"';case lm:return'[data-testname="'+u.value+'"]';default:throw Error(o(365))}}function vT(u,c){var v=[];u=[u,0];for(var w=0;wT&&(T=Y),w&=~L}if(w=T,w=pi()-w,w=(120>w?120:480>w?480:1080>w?1080:1920>w?1920:3e3>w?3e3:4320>w?4320:1960*hN(w/1960))-w,10u?16:u,va===null)var w=!1;else{if(u=va,va=null,pm=0,Xt&6)throw Error(o(331));var T=Xt;for(Xt|=4,Ke=u.current;Ke!==null;){var L=Ke,Y=L.child;if(Ke.flags&16){var ne=L.deletions;if(ne!==null){for(var Ee=0;Eepi()-N_?Tl(u,0):D_|=v),vr(u,c)}function AT(u,c){c===0&&(u.mode&1?(c=Pp,Pp<<=1,!(Pp&130023424)&&(Pp=4194304)):c=1);var v=er();u=vm(u,c),u!==null&&(Vf(u,c,v),vr(u,v))}function _N(u){var c=u.memoizedState,v=0;c!==null&&(v=c.retryLane),AT(u,v)}function yN(u,c){var v=0;switch(u.tag){case 13:var w=u.stateNode,T=u.memoizedState;T!==null&&(v=T.retryLane);break;case 19:w=u.stateNode;break;default:throw Error(o(314))}w!==null&&w.delete(c),AT(u,v)}var CT;CT=function(u,c,v){if(u!==null)if(u.memoizedProps!==c.pendingProps||Rt.current)Fr=!0;else{if(!(u.lanes&v)&&!(c.flags&128))return Fr=!1,oN(u,c,v);Fr=!!(u.flags&131072)}else Fr=!1,Rn&&c.flags&1048576&&dE(c,Hp,c.index);switch(c.lanes=0,c.tag){case 2:var w=c.type;u!==null&&(u.alternate=null,c.alternate=null,c.flags|=2),u=c.pendingProps;var T=sn(c,cn.current);zu(c,v),T=h_(null,c,w,u,T,v);var L=d_();return c.flags|=1,typeof T=="object"&&T!==null&&typeof T.render=="function"&&T.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,mn(w)?(L=!0,un(c)):L=!1,c.memoizedState=T.state!==null&&T.state!==void 0?T.state:null,$v(c),T.updater=zp,c.stateNode=T,T._reactInternals=c,t_(c,w,u,v),c=x_(null,c,w,!0,L,v)):(c.tag=0,Rn&&L&&n_(c),$i(null,c,T,v),c=c.child),c;case 16:w=c.elementType;e:{switch(u!==null&&(u.alternate=null,c.alternate=null,c.flags|=2),u=c.pendingProps,T=w._init,w=T(w._payload),c.type=w,T=c.tag=SN(w),u=Is(w,u),T){case 0:c=y_(null,c,w,u,v);break e;case 1:c=JE(null,c,w,u,v);break e;case 11:c=YE(null,c,w,u,v);break e;case 14:c=jE(null,c,w,Is(w.type,u),v);break e}throw Error(o(306,w,""))}return c;case 0:return w=c.type,T=c.pendingProps,T=c.elementType===w?T:Is(w,T),y_(u,c,w,T,v);case 1:return w=c.type,T=c.pendingProps,T=c.elementType===w?T:Is(w,T),JE(u,c,w,T,v);case 3:e:{if(QE(c),u===null)throw Error(o(387));w=c.pendingProps,L=c.memoizedState,T=L.element,oE(u,c),Op(c,w,null,v);var Y=c.memoizedState;if(w=Y.element,we&&L.isDehydrated)if(L={element:w,isDehydrated:!1,cache:Y.cache,transitions:Y.transitions},c.updateQueue.baseState=L,c.memoizedState=L,c.flags&256){T=Error(o(423)),c=$E(u,c,w,v,T);break e}else if(w!==T){T=Error(o(424)),c=$E(u,c,w,v,T);break e}else for(we&&(Nr=Vn(c.stateNode.containerInfo),Dr=c,Rn=!0,Ds=null,Gf=!1),v=yE(c,null,w,v),c.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(Vu(),w===T){c=Do(u,c,v);break e}$i(u,c,w,v)}c=c.child}return c;case 5:return xE(c),u===null&&s_(c),w=c.type,T=c.pendingProps,L=u!==null?u.memoizedProps:null,Y=T.children,Pe(w,T)?Y=null:L!==null&&Pe(w,L)&&(c.flags|=32),KE(u,c),$i(u,c,Y,v),c.child;case 6:return u===null&&s_(c),null;case 13:return eT(u,c,v);case 4:return a_(c,c.stateNode.containerInfo),w=c.pendingProps,u===null?c.child=Gu(c,null,w,v):$i(u,c,w,v),c.child;case 11:return w=c.type,T=c.pendingProps,T=c.elementType===w?T:Is(w,T),YE(u,c,w,T,v);case 7:return $i(u,c,c.pendingProps,v),c.child;case 8:return $i(u,c,c.pendingProps.children,v),c.child;case 12:return $i(u,c,c.pendingProps.children,v),c.child;case 10:e:{if(w=c.type._context,T=c.pendingProps,L=c.memoizedProps,Y=T.value,sE(c,w,Y),L!==null)if(io(L.value,Y)){if(L.children===T.children&&!Rt.current){c=Do(u,c,v);break e}}else for(L=c.child,L!==null&&(L.return=c);L!==null;){var ne=L.dependencies;if(ne!==null){Y=L.child;for(var Ee=ne.firstContext;Ee!==null;){if(Ee.context===w){if(L.tag===1){Ee=bo(-1,v&-v),Ee.tag=2;var ze=L.updateQueue;if(ze!==null){ze=ze.shared;var ut=ze.pending;ut===null?Ee.next=Ee:(Ee.next=ut.next,ut.next=Ee),ze.pending=Ee}}L.lanes|=v,Ee=L.alternate,Ee!==null&&(Ee.lanes|=v),Qv(L.return,v,c),ne.lanes|=v;break}Ee=Ee.next}}else if(L.tag===10)Y=L.type===c.type?null:L.child;else if(L.tag===18){if(Y=L.return,Y===null)throw Error(o(341));Y.lanes|=v,ne=Y.alternate,ne!==null&&(ne.lanes|=v),Qv(Y,v,c),Y=L.sibling}else Y=L.child;if(Y!==null)Y.return=L;else for(Y=L;Y!==null;){if(Y===c){Y=null;break}if(L=Y.sibling,L!==null){L.return=Y.return,Y=L;break}Y=Y.return}L=Y}$i(u,c,T.children,v),c=c.child}return c;case 9:return T=c.type,w=c.pendingProps.children,zu(c,v),T=ns(T),w=w(T),c.flags|=1,$i(u,c,w,v),c.child;case 14:return w=c.type,T=Is(w,c.pendingProps),T=Is(w.type,T),jE(u,c,w,T,v);case 15:return qE(u,c,c.type,c.pendingProps,v);case 17:return w=c.type,T=c.pendingProps,T=c.elementType===w?T:Is(w,T),u!==null&&(u.alternate=null,c.alternate=null,c.flags|=2),c.tag=1,mn(w)?(u=!0,un(c)):u=!1,zu(c,v),fE(c,w,T),t_(c,w,T,v),x_(null,c,w,!0,u,v);case 19:return rT(u,c,v);case 22:return ZE(u,c,v)}throw Error(o(156,c.tag))};function RT(u,c){return Xv(u,c)}function xN(u,c,v,w){this.tag=u,this.key=v,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ls(u,c,v,w){return new xN(u,c,v,w)}function V_(u){return u=u.prototype,!(!u||!u.isReactComponent)}function SN(u){if(typeof u=="function")return V_(u)?1:0;if(u!=null){if(u=u.$$typeof,u===x)return 11;if(u===M)return 14}return 2}function xa(u,c){var v=u.alternate;return v===null?(v=ls(u.tag,c,u.key,u.mode),v.elementType=u.elementType,v.type=u.type,v.stateNode=u.stateNode,v.alternate=u,u.alternate=v):(v.pendingProps=c,v.type=u.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=u.flags&14680064,v.childLanes=u.childLanes,v.lanes=u.lanes,v.child=u.child,v.memoizedProps=u.memoizedProps,v.memoizedState=u.memoizedState,v.updateQueue=u.updateQueue,c=u.dependencies,v.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},v.sibling=u.sibling,v.index=u.index,v.ref=u.ref,v}function ym(u,c,v,w,T,L){var Y=2;if(w=u,typeof u=="function")V_(u)&&(Y=1);else if(typeof u=="string")Y=5;else e:switch(u){case h:return Rl(v.children,T,L,c);case d:Y=8,T|=8;break;case p:return u=ls(12,v,c,T|2),u.elementType=p,u.lanes=L,u;case y:return u=ls(13,v,c,T),u.elementType=y,u.lanes=L,u;case g:return u=ls(19,v,c,T),u.elementType=g,u.lanes=L,u;case E:return xm(v,T,L,c);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case m:Y=10;break e;case _:Y=9;break e;case x:Y=11;break e;case M:Y=14;break e;case S:Y=16,w=null;break e}throw Error(o(130,u==null?u:typeof u,""))}return c=ls(Y,v,c,T),c.elementType=u,c.type=w,c.lanes=L,c}function Rl(u,c,v,w){return u=ls(7,u,w,c),u.lanes=v,u}function xm(u,c,v,w){return u=ls(22,u,w,c),u.elementType=E,u.lanes=v,u.stateNode={},u}function G_(u,c,v){return u=ls(6,u,null,c),u.lanes=v,u}function W_(u,c,v){return c=ls(4,u.children!==null?u.children:[],u.key,c),c.lanes=v,c.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},c}function MN(u,c,v,w,T){this.tag=c,this.containerInfo=u,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=it,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Gv(0),this.expirationTimes=Gv(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gv(0),this.identifierPrefix=w,this.onRecoverableError=T,we&&(this.mutableSourceEagerHydrationData=null)}function bT(u,c,v,w,T,L,Y,ne,Ee){return u=new MN(u,c,v,ne,Ee),c===1?(c=1,L===!0&&(c|=8)):c=0,L=ls(3,null,null,c),u.current=L,L.stateNode=u,L.memoizedState={element:w,isDehydrated:v,cache:null,transitions:null},$v(L),u}function PT(u){if(!u)return It;u=u._reactInternals;e:{if(b(u)!==u||u.tag!==1)throw Error(o(170));var c=u;do{switch(c.tag){case 3:c=c.stateNode.context;break e;case 1:if(mn(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(o(171))}if(u.tag===1){var v=u.type;if(mn(v))return In(u,v,c)}return c}function LT(u){var c=u._reactInternals;if(c===void 0)throw typeof u.render=="function"?Error(o(188)):(u=Object.keys(u).join(","),Error(o(268,u)));return u=q(c),u===null?null:u.stateNode}function IT(u,c){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var v=u.retryLane;u.retryLane=v!==0&&v=ze&&L>=Dt&&T<=ut&&Y<=Et){u.splice(c,1);break}else if(w!==ze||v.width!==Ee.width||EtY){if(!(L!==Dt||v.height!==Ee.height||utT)){ze>w&&(Ee.width+=ze-w,Ee.x=w),utL&&(Ee.height+=Dt-L,Ee.y=L),Etv&&(v=Y)),Y ")+` No matching component was found for: `)+u.join(" > ")}return null},t.getPublicRootInstance=function(u){if(u=u.current,!u.child)return null;switch(u.child.tag){case 5:return oe(u.child.stateNode);default:return u.child.stateNode}},t.injectIntoDevTools=function(u){if(u={bundleType:u.bundleType,version:u.version,rendererPackageName:u.rendererPackageName,rendererConfig:u.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:wN,findFiberByHostInstance:u.findFiberByHostInstance||EN,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")u=!1;else{var c=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(c.isDisabled||!c.supportsFiber)u=!0;else{try{Ip=c.inject(u),no=c}catch{}u=!!c.checkDCE}}return u},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(u,c,v,w){if(!mt)throw Error(o(363));u=L_(u,c);var T=Le(u,v,w).disconnect;return{disconnect:function(){T()}}},t.registerMutableSourceForHydration=function(u,c){var v=c._getVersion;v=v(c._source),u.mutableSourceEagerHydrationData==null?u.mutableSourceEagerHydrationData=[c,v]:u.mutableSourceEagerHydrationData.push(c,v)},t.runWithPriority=function(u,c){var v=on;try{return on=u,c()}finally{on=v}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(u,c,v,w){var T=c.current,L=er(),Y=_a(T);return v=PT(v),c.context===null?c.context=v:c.pendingContext=v,c=bo(L,Y),c.payload={element:u},w=w===void 0?null:w,w!==null&&(c.callback=w),ma(T,c),u=as(T,Y,L),u!==null&&kp(u,T,Y),Y},t};PL.exports=rG;var sG=PL.exports;const oG=DS(sG);var LL={exports:{}},IL={};/** * @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(k,G){var F=k.length;k.push(G);e:for(;0>>1,j=k[re];if(0>>1;rer(Pe,F))_er(Re,Pe)?(k[re]=Re,k[_e]=F,re=_e):(k[re]=Pe,k[le]=F,re=le);else if(_er(Re,F))k[re]=Re,k[_e]=F,re=_e;else break e}}return G}function r(k,G){var F=k.sortIndex-G.sortIndex;return F!==0?F:k.id-G.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=[],f=[],h=1,d=null,p=3,m=!1,_=!1,x=!1,y=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(k){for(var G=t(f);G!==null;){if(G.callback===null)i(f);else if(G.startTime<=k)i(f),G.sortIndex=G.expirationTime,e(l,G);else break;G=t(f)}}function E(k){if(x=!1,S(k),!_)if(t(l)!==null)_=!0,oe(C);else{var G=t(f);G!==null&&$(E,G.startTime-k)}}function C(k,G){_=!1,x&&(x=!1,g(D),D=-1),m=!0;var F=p;try{for(S(G),d=t(l);d!==null&&(!(d.expirationTime>G)||k&&!z());){var re=d.callback;if(typeof re=="function"){d.callback=null,p=d.priorityLevel;var j=re(d.expirationTime<=G);G=n.unstable_now(),typeof j=="function"?d.callback=j:d===t(l)&&i(l),S(G)}else i(l);d=t(l)}if(d!==null)var ve=!0;else{var le=t(f);le!==null&&$(E,le.startTime-G),ve=!1}return ve}finally{d=null,p=F,m=!1}}var R=!1,P=null,D=-1,b=5,I=-1;function z(){return!(n.unstable_now()-Ik||125re?(k.sortIndex=F,e(f,k),t(l)===null&&k===t(f)&&(x?(g(D),D=-1):x=!0,$(E,F-re))):(k.sortIndex=j,e(l,k),_||m||(_=!0,oe(C))),k},n.unstable_shouldYield=z,n.unstable_wrapCallback=function(k){var G=p;return function(){var F=p;p=G;try{return k.apply(this,arguments)}finally{p=F}}}})(IL);LL.exports=IL;var v2=LL.exports;function DL(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;rr.response=s).then(()=>{i.lifespan&&i.lifespan>0&&setTimeout(()=>{const s=Yo.indexOf(r);s!==-1&&Yo.splice(s,1)},i.lifespan)}).catch(s=>r.error=s)};if(Yo.push(r),!t)throw r.promise}const FL=(n,e,t)=>NL(n,e,!1,t),aG=(n,e,t)=>void NL(n,e,!0,t),lG=n=>{if(n===void 0||n.length===0)Yo.splice(0,Yo.length);else{const e=Yo.find(t=>DL(n,t.keys,t.equal));if(e){const t=Yo.indexOf(e);t!==-1&&Yo.splice(t,1)}}},Tw={},Aw=n=>void Object.assign(Tw,n);function uG(n,e){function t(h,{args:d=[],attach:p,...m},_){let x=`${h[0].toUpperCase()}${h.slice(1)}`,y;if(h==="primitive"){if(m.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const g=m.object;y=Ec(g,{type:h,root:_,attach:p,primitive:!0})}else{const g=Tw[x];if(!g)throw new Error(`R3F: ${x} 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(d))throw new Error("R3F: The args prop must be an array!");y=Ec(new g(...d),{type:h,root:_,attach:p,memoizedProps:{args:d}})}return y.__r3f.attach===void 0&&(y instanceof Wt?y.__r3f.attach="geometry":y instanceof Ni&&(y.__r3f.attach="material")),x!=="inject"&&tx(y,m),y}function i(h,d){let p=!1;if(d){var m,_;(m=d.__r3f)!=null&&m.attach?ex(h,d,d.__r3f.attach):d.isObject3D&&h.isObject3D&&(h.add(d),p=!0),p||(_=h.__r3f)==null||_.objects.push(d),d.__r3f||Ec(d,{}),d.__r3f.parent=h,rS(d),Tc(d)}}function r(h,d,p){let m=!1;if(d){var _,x;if((_=d.__r3f)!=null&&_.attach)ex(h,d,d.__r3f.attach);else if(d.isObject3D&&h.isObject3D){d.parent=h,d.dispatchEvent({type:"added"});const y=h.children.filter(M=>M!==d),g=y.indexOf(p);h.children=[...y.slice(0,g),d,...y.slice(g)],m=!0}m||(x=h.__r3f)==null||x.objects.push(d),d.__r3f||Ec(d,{}),d.__r3f.parent=h,rS(d),Tc(d)}}function s(h,d,p=!1){h&&[...h].forEach(m=>o(d,m,p))}function o(h,d,p){if(d){var m,_,x;if(d.__r3f&&(d.__r3f.parent=null),(m=h.__r3f)!=null&&m.objects&&(h.__r3f.objects=h.__r3f.objects.filter(E=>E!==d)),(_=d.__r3f)!=null&&_.attach)M2(h,d,d.__r3f.attach);else if(d.isObject3D&&h.isObject3D){var y;h.remove(d),(y=d.__r3f)!=null&&y.root&&gG(d.__r3f.root,d)}const M=(x=d.__r3f)==null?void 0:x.primitive,S=p===void 0?d.dispose!==null&&!M:p;if(!M){var g;s((g=d.__r3f)==null?void 0:g.objects,d,S),s(d.children,d,S)}d.__r3f&&(delete d.__r3f.root,delete d.__r3f.objects,delete d.__r3f.handlers,delete d.__r3f.memoizedProps,M||delete d.__r3f),S&&d.dispose&&d.type!=="Scene"&&v2.unstable_scheduleCallback(v2.unstable_IdlePriority,()=>{try{d.dispose()}catch{}}),Tc(h)}}function a(h,d,p,m){var _;const x=(_=h.__r3f)==null?void 0:_.parent;if(!x)return;const y=t(d,p,h.__r3f.root);if(h.children){for(const g of h.children)g.__r3f&&i(y,g);h.children=h.children.filter(g=>!g.__r3f)}h.__r3f.objects.forEach(g=>i(y,g)),h.__r3f.objects=[],h.__r3f.autoRemovedBeforeAppend||o(x,h),y.parent&&(y.__r3f.autoRemovedBeforeAppend=!0),i(x,y),y.raycast&&y.__r3f.eventCount&&y.__r3f.root.getState().internal.interaction.push(y),[m,m.alternate].forEach(g=>{g!==null&&(g.stateNode=y,g.ref&&(typeof g.ref=="function"?g.ref(y):g.ref.current=y))})}const l=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:oG({createInstance:t,removeChild:o,appendChild:i,appendInitialChild:i,insertBefore:r,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(h,d)=>{if(!d)return;const p=h.getState().scene;p.__r3f&&(p.__r3f.root=h,i(p,d))},removeChildFromContainer:(h,d)=>{d&&o(h.getState().scene,d)},insertInContainerBefore:(h,d,p)=>{if(!d||!p)return;const m=h.getState().scene;m.__r3f&&r(m,d,p)},getRootHostContext:()=>null,getChildHostContext:h=>h,finalizeInitialChildren(h){var d;return!!((d=h==null?void 0:h.__r3f)!=null?d:{}).handlers},prepareUpdate(h,d,p,m){if(h.__r3f.primitive&&m.object&&m.object!==h)return[!0];{const{args:_=[],children:x,...y}=m,{args:g=[],children:M,...S}=p;if(!Array.isArray(_))throw new Error("R3F: the args prop must be an array!");if(_.some((C,R)=>C!==g[R]))return[!0];const E=VL(h,y,S,!0);return E.changes.length?[!1,E]:null}},commitUpdate(h,[d,p],m,_,x,y){d?a(h,m,x,y):tx(h,p)},commitMount(h,d,p,m){var _;const x=(_=h.__r3f)!=null?_:{};h.raycast&&x.handlers&&x.eventCount&&h.__r3f.root.getState().internal.interaction.push(h)},getPublicInstance:h=>h,prepareForCommit:()=>null,preparePortalMount:h=>Ec(h.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(h){var d;const{attach:p,parent:m}=(d=h.__r3f)!=null?d:{};p&&m&&M2(m,h,p),h.isObject3D&&(h.visible=!1),Tc(h)},unhideInstance(h,d){var p;const{attach:m,parent:_}=(p=h.__r3f)!=null?p:{};m&&_&&ex(_,h,m),(h.isObject3D&&d.visible==null||d.visible)&&(h.visible=!0),Tc(h)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Wc.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&wn.fun(performance.now)?performance.now:wn.fun(Date.now)?Date.now:()=>0,scheduleTimeout:wn.fun(setTimeout)?setTimeout:void 0,cancelTimeout:wn.fun(clearTimeout)?clearTimeout:void 0}),applyProps:tx}}var _2,y2;const $y=n=>"colorSpace"in n||"outputColorSpace"in n,UL=()=>{var n;return(n=Tw.ColorManagement)!=null?n:null},kL=n=>n&&n.isOrthographicCamera,cG=n=>n&&n.hasOwnProperty("current"),Ap=typeof window<"u"&&((_2=window.document)!=null&&_2.createElement||((y2=window.navigator)==null?void 0:y2.product)==="ReactNative")?ie.useLayoutEffect:ie.useEffect;function OL(n){const e=ie.useRef(n);return Ap(()=>void(e.current=n),[n]),e}function fG({set:n}){return Ap(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}class zL extends ie.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}zL.getDerivedStateFromError=()=>({error:!0});const BL="__default",x2=new Map,hG=n=>n&&!!n.memoized&&!!n.changes;function HL(n){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(n)?Math.min(Math.max(n[0],t),n[1]):n}const Eh=n=>{var e;return(e=n.__r3f)==null?void 0:e.root.getState()},wn={obj:n=>n===Object(n)&&!wn.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(wn.str(n)||wn.num(n))return n===e;const s=wn.obj(n);if(s&&i==="reference")return n===e;const o=wn.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(!wn.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(wn.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 dG(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 pG(n){n.dispose&&n.type!=="Scene"&&n.dispose();for(const e in n)e.dispose==null||e.dispose(),delete n[e]}function Ec(n,e){const t=n;return(e!=null&&e.primitive||!t.__r3f)&&(t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e}),n}function iS(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 S2=/-\d+$/;function ex(n,e,t){if(wn.str(t)){if(S2.test(t)){const s=t.replace(S2,""),{target:o,key:a}=iS(n,s);Array.isArray(o[a])||(o[a]=[])}const{target:i,key:r}=iS(n,t);e.__r3f.previousAttach=i[r],i[r]=e}else e.__r3f.previousAttach=t(n,e)}function M2(n,e,t){var i,r;if(wn.str(t)){const{target:s,key:o}=iS(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 VL(n,{children:e,key:t,ref:i,...r},{children:s,key:o,ref:a,...l}={},f=!1){var h;const d=(h=n==null?void 0:n.__r3f)!=null?h:{},p=Object.entries(r),m=[];if(f){const x=Object.keys(l);for(let y=0;y{var g;if((g=n.__r3f)!=null&&g.primitive&&x==="object"||wn.equ(y,l[x]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(x))return m.push([x,y,!0,[]]);let M=[];x.includes("-")&&(M=x.split("-")),m.push([x,y,!1,M]);for(const S in r){const E=r[S];S.startsWith(`${x}-`)&&m.push([S,E,!1,S.split("-")])}});const _={...r};return d.memoizedProps&&d.memoizedProps.args&&(_.args=d.memoizedProps.args),d.memoizedProps&&d.memoizedProps.attach&&(_.attach=d.memoizedProps.attach),{memoized:_,changes:m}}function tx(n,e){var t,i,r;const s=(t=n.__r3f)!=null?t:{},o=s.root,a=(i=o==null||o.getState==null?void 0:o.getState())!=null?i:{},{memoized:l,changes:f}=hG(e)?e:VL(n,e),h=s.eventCount;n.__r3f&&(n.__r3f.memoizedProps=l);for(let p=0;pS[E],n),!(M&&M.set))){const[S,...E]=y.reverse();g=E.reverse().reduce((C,R)=>C[R],n),m=S}if(_===BL+"remove")if(g.constructor){let S=x2.get(g.constructor);S||(S=new g.constructor,x2.set(g.constructor,S)),_=S[m]}else _=0;if(x)_?s.handlers[m]=_:delete s.handlers[m],s.eventCount=Object.keys(s.handlers).length;else if(M&&M.set&&(M.copy||M instanceof lu)){if(Array.isArray(_))M.fromArray?M.fromArray(_):M.set(..._);else if(M.copy&&_&&_.constructor&&M.constructor===_.constructor)M.copy(_);else if(_!==void 0){const S=M instanceof Ge;!S&&M.setScalar?M.setScalar(_):M instanceof lu&&_ instanceof lu?M.mask=_.mask:M.set(_),!UL()&&!a.linear&&S&&M.convertSRGBToLinear()}}else if(g[m]=_,g[m]instanceof Bn&&g[m].format===lr&&g[m].type===yo){const S=g[m];$y(S)&&$y(a.gl)?S.colorSpace=a.gl.outputColorSpace:S.encoding=a.gl.outputEncoding}Tc(n)}if(s.parent&&a.internal&&n.raycast&&h!==s.eventCount){const p=a.internal.interaction.indexOf(n);p>-1&&a.internal.interaction.splice(p,1),s.eventCount&&a.internal.interaction.push(n)}return!(f.length===1&&f[0][0]==="onUpdate")&&f.length&&(r=n.__r3f)!=null&&r.parent&&rS(n),n}function Tc(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 rS(n){n.onUpdate==null||n.onUpdate(n)}function GL(n,e){n.manual||(kL(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 Tg(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function mG(){var n;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Wc.DefaultEventPriority;switch((n=e.event)==null?void 0:n.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Wc.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Wc.ContinuousEventPriority;default:return Wc.DefaultEventPriority}}function WL(n,e,t,i){const r=t.get(e);r&&(t.delete(e),t.size===0&&(n.delete(i),r.target.releasePointerCapture(i)))}function gG(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)=>{WL(t.capturedMap,e,i,r)})}function vG(n){function e(l){const{internal:f}=n.getState(),h=l.offsetX-f.initialClick[0],d=l.offsetY-f.initialClick[1];return Math.round(Math.sqrt(h*h+d*d))}function t(l){return l.filter(f=>["Move","Over","Enter","Out","Leave"].some(h=>{var d;return(d=f.__r3f)==null?void 0:d.handlers["onPointer"+h]}))}function i(l,f){const h=n.getState(),d=new Set,p=[],m=f?f(h.internal.interaction):h.internal.interaction;for(let g=0;g{const S=Eh(g.object),E=Eh(M.object);return!S||!E?g.distance-M.distance:E.events.priority-S.events.priority||g.distance-M.distance}).filter(g=>{const M=Tg(g);return d.has(M)?!1:(d.add(M),!0)});h.events.filter&&(x=h.events.filter(x,h));for(const g of x){let M=g.object;for(;M;){var y;(y=M.__r3f)!=null&&y.eventCount&&p.push({...g,eventObject:M}),M=M.parent}}if("pointerId"in l&&h.internal.capturedMap.has(l.pointerId))for(let g of h.internal.capturedMap.get(l.pointerId).values())d.has(Tg(g.intersection))||p.push(g.intersection);return p}function r(l,f,h,d){const p=n.getState();if(l.length){const m={stopped:!1};for(const _ of l){const x=Eh(_.object)||p,{raycaster:y,pointer:g,camera:M,internal:S}=x,E=new V(g.x,g.y,0).unproject(M),C=I=>{var z,q;return(z=(q=S.capturedMap.get(I))==null?void 0:q.has(_.eventObject))!=null?z:!1},R=I=>{const z={intersection:_,target:f.target};S.capturedMap.has(I)?S.capturedMap.get(I).set(_.eventObject,z):S.capturedMap.set(I,new Map([[_.eventObject,z]])),f.target.setPointerCapture(I)},P=I=>{const z=S.capturedMap.get(I);z&&WL(S.capturedMap,_.eventObject,z,I)};let D={};for(let I in f){let z=f[I];typeof z!="function"&&(D[I]=z)}let b={..._,...D,pointer:g,intersections:l,stopped:m.stopped,delta:h,unprojectedPoint:E,ray:y.ray,camera:M,stopPropagation(){const I="pointerId"in f&&S.capturedMap.get(f.pointerId);if((!I||I.has(_.eventObject))&&(b.stopped=m.stopped=!0,S.hovered.size&&Array.from(S.hovered.values()).find(z=>z.eventObject===_.eventObject))){const z=l.slice(0,l.indexOf(_));s([...z,_])}},target:{hasPointerCapture:C,setPointerCapture:R,releasePointerCapture:P},currentTarget:{hasPointerCapture:C,setPointerCapture:R,releasePointerCapture:P},nativeEvent:f};if(d(b),m.stopped===!0)break}}return l}function s(l){const{internal:f}=n.getState();for(const h of f.hovered.values())if(!l.length||!l.find(d=>d.object===h.object&&d.index===h.index&&d.instanceId===h.instanceId)){const p=h.eventObject.__r3f,m=p==null?void 0:p.handlers;if(f.hovered.delete(Tg(h)),p!=null&&p.eventCount){const _={...h,intersections:l};m.onPointerOut==null||m.onPointerOut(_),m.onPointerLeave==null||m.onPointerLeave(_)}}}function o(l,f){for(let h=0;hs([]);case"onLostPointerCapture":return f=>{const{internal:h}=n.getState();"pointerId"in f&&h.capturedMap.has(f.pointerId)&&requestAnimationFrame(()=>{h.capturedMap.has(f.pointerId)&&(h.capturedMap.delete(f.pointerId),s([]))})}}return function(h){const{onPointerMissed:d,internal:p}=n.getState();p.lastEvent.current=h;const m=l==="onPointerMove",_=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",y=i(h,m?t:void 0),g=_?e(h):0;l==="onPointerDown"&&(p.initialClick=[h.offsetX,h.offsetY],p.initialHits=y.map(S=>S.eventObject)),_&&!y.length&&g<=2&&(o(h,p.interaction),d&&d(h)),m&&s(y);function M(S){const E=S.eventObject,C=E.__r3f,R=C==null?void 0:C.handlers;if(C!=null&&C.eventCount)if(m){if(R.onPointerOver||R.onPointerEnter||R.onPointerOut||R.onPointerLeave){const P=Tg(S),D=p.hovered.get(P);D?D.stopped&&S.stopPropagation():(p.hovered.set(P,S),R.onPointerOver==null||R.onPointerOver(S),R.onPointerEnter==null||R.onPointerEnter(S))}R.onPointerMove==null||R.onPointerMove(S)}else{const P=R[l];P?(!_||p.initialHits.includes(E))&&(o(h,p.interaction.filter(D=>!p.initialHits.includes(D))),P(S)):_&&p.initialHits.includes(E)&&o(h,p.interaction.filter(D=>!p.initialHits.includes(D)))}}r(y,h,g,M)}}return{handlePointer:a}}const _G=["set","get","setSize","setFrameloop","setDpr","events","invalidate","advance","size","viewport"],XL=n=>!!(n!=null&&n.render),Cw=ie.createContext(null),yG=(n,e)=>{const t=bL((a,l)=>{const f=new V,h=new V,d=new V;function p(g=l().camera,M=h,S=l().size){const{width:E,height:C,top:R,left:P}=S,D=E/C;M instanceof V?d.copy(M):d.set(...M);const b=g.getWorldPosition(f).distanceTo(d);if(kL(g))return{width:E/g.zoom,height:C/g.zoom,top:R,left:P,factor:1,distance:b,aspect:D};{const I=g.fov*Math.PI/180,z=2*Math.tan(I/2)*b,q=z*(E/C);return{width:q,height:z,top:R,left:P,factor:E/q,distance:b,aspect:D}}}let m;const _=g=>a(M=>({performance:{...M.performance,current:g}})),x=new be;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(g=1)=>n(l(),g),advance:(g,M)=>e(g,M,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new xw,pointer:x,mouse:x,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const g=l();m&&clearTimeout(m),g.performance.current!==g.performance.min&&_(g.performance.min),m=setTimeout(()=>_(l().performance.max),g.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:g=>a(M=>({...M,events:{...M.events,...g}})),setSize:(g,M,S,E,C)=>{const R=l().camera,P={width:g,height:M,top:E||0,left:C||0,updateStyle:S};a(D=>({size:P,viewport:{...D.viewport,...p(R,h,P)}}))},setDpr:g=>a(M=>{const S=HL(g);return{viewport:{...M.viewport,dpr:S,initialDpr:M.viewport.initialDpr||S}}}),setFrameloop:(g="always")=>{const M=l().clock;M.stop(),M.elapsedTime=0,g!=="never"&&(M.start(),M.elapsedTime=0),a(()=>({frameloop:g}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:ie.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(g,M,S)=>{const E=l().internal;return E.priority=E.priority+(M>0?1:0),E.subscribers.push({ref:g,priority:M,store:S}),E.subscribers=E.subscribers.sort((C,R)=>C.priority-R.priority),()=>{const C=l().internal;C!=null&&C.subscribers&&(C.priority=C.priority-(M>0?1:0),C.subscribers=C.subscribers.filter(R=>R.ref!==g))}}}}}),i=t.getState();let r=i.size,s=i.viewport.dpr,o=i.camera;return t.subscribe(()=>{const{camera:a,size:l,viewport:f,gl:h,set:d}=t.getState();if(l!==r||f.dpr!==s){var p;r=l,s=f.dpr,GL(a,l),h.setPixelRatio(f.dpr);const m=(p=l.updateStyle)!=null?p:typeof HTMLCanvasElement<"u"&&h.domElement instanceof HTMLCanvasElement;h.setSize(l.width,l.height,m)}a!==o&&(o=a,d(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(a)}})))}),t.subscribe(a=>n(a)),t};let Ag,xG=new Set,SG=new Set,MG=new Set;function nx(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function Th(n,e){switch(n){case"before":return nx(xG,e);case"after":return nx(SG,e);case"tail":return nx(MG,e)}}let ix,rx;function sx(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),ix=e.internal.subscribers,Ag=0;Ag0)&&!((f=r.gl.xr)!=null&&f.isPresenting)&&(t+=sx(l,r))}if(Th("after",l),t===0)return Th("tail",l),e=!1,cancelAnimationFrame(i)}function o(l,f=1){var h;if(!l)return n.forEach(d=>o(d.store.getState()),f);(h=l.gl.xr)!=null&&h.isPresenting||!l.internal.active||l.frameloop==="never"||(l.internal.frames=Math.min(60,l.internal.frames+f),e||(e=!0,requestAnimationFrame(s)))}function a(l,f=!0,h,d){if(f&&Th("before",l),h)sx(l,h,d);else for(const p of n.values())sx(l,p.store.getState());f&&Th("after",l)}return{loop:s,invalidate:o,advance:a}}function Rw(){const n=ie.useContext(Cw);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function bi(n=t=>t,e){return Rw()(n,e)}function da(n,e=0){const t=Rw(),i=t.getState().internal.subscribe,r=OL(n);return Ap(()=>i(r,e,t),[e,i,t]),null}function YL(n,e){return function(t,...i){const r=new t;return n&&n(r),Promise.all(i.map(s=>new Promise((o,a)=>r.load(s,l=>{l.scene&&Object.assign(l,dG(l.scene)),o(l)},e,l=>a(new Error(`Could not load ${s}: ${l.message})`))))))}}function bw(n,e,t,i){const r=Array.isArray(e)?e:[e],s=FL(YL(t,i),[n,...r],{equal:wn.equ});return Array.isArray(e)?s:s[0]}bw.preload=function(n,e,t){const i=Array.isArray(e)?e:[e];return aG(YL(t),[n,...i])};bw.clear=function(n,e){const t=Array.isArray(e)?e:[e];return lG([n,...t])};const xf=new Map,{invalidate:w2,advance:E2}=wG(xf),{reconciler:Zd,applyProps:yc}=uG(xf,mG),xc={objects:"shallow",strict:!1},EG=(n,e)=>{const t=typeof n=="function"?n(e):n;return XL(t)?t:new ew({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...n})};function TG(n,e){if(e)return e;if(typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement&&n.parentElement){const{width:t,height:i,top:r,left:s}=n.parentElement.getBoundingClientRect();return{width:t,height:i,top:r,left:s}}else if(typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas)return{width:n.width,height:n.height,top:0,left:0};return{width:0,height:0,top:0,left:0}}function AG(n){const e=xf.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||yG(w2,E2),o=t||Zd.createContainer(s,Wc.ConcurrentRoot,null,!1,null,"",r,null);e||xf.set(n,{fiber:o,store:s});let a,l=!1,f;return{configure(h={}){let{gl:d,size:p,scene:m,events:_,onCreated:x,shadows:y=!1,linear:g=!1,flat:M=!1,legacy:S=!1,orthographic:E=!1,frameloop:C="always",dpr:R=[1,2],performance:P,raycaster:D,camera:b,onPointerMissed:I}=h,z=s.getState(),q=z.gl;z.gl||z.set({gl:q=EG(d,n)});let J=z.raycaster;J||z.set({raycaster:J=new Ew});const{params:Q,...ee}=D||{};if(wn.equ(ee,J,xc)||yc(J,{...ee}),wn.equ(Q,J.params,xc)||yc(J,{params:{...J.params,...Q}}),!z.camera||z.camera===f&&!wn.equ(f,b,xc)){f=b;const re=b instanceof fp,j=re?b:E?new dp(0,0,0,0,.1,1e3):new Si(75,0,.1,1e3);re||(j.position.z=5,b&&yc(j,b),!z.camera&&!(b!=null&&b.rotation)&&j.lookAt(0,0,0)),z.set({camera:j})}if(!z.scene){let re;m instanceof Bd?re=m:(re=new Bd,m&&yc(re,m)),z.set({scene:Ec(re)})}if(!z.xr){const re=(le,Pe)=>{const _e=s.getState();_e.frameloop!=="never"&&E2(le,!0,_e,Pe)},j=()=>{const le=s.getState();le.gl.xr.enabled=le.gl.xr.isPresenting,le.gl.xr.setAnimationLoop(le.gl.xr.isPresenting?re:null),le.gl.xr.isPresenting||w2(le)},ve={connect(){const le=s.getState().gl;le.xr.addEventListener("sessionstart",j),le.xr.addEventListener("sessionend",j)},disconnect(){const le=s.getState().gl;le.xr.removeEventListener("sessionstart",j),le.xr.removeEventListener("sessionend",j)}};q.xr&&ve.connect(),z.set({xr:ve})}if(q.shadowMap){const re=q.shadowMap.enabled,j=q.shadowMap.type;if(q.shadowMap.enabled=!!y,wn.boo(y))q.shadowMap.type=Kh;else if(wn.str(y)){var oe;const ve={basic:LP,percentage:xv,soft:Kh,variance:Hs};q.shadowMap.type=(oe=ve[y])!=null?oe:Kh}else wn.obj(y)&&Object.assign(q.shadowMap,y);(re!==q.shadowMap.enabled||j!==q.shadowMap.type)&&(q.shadowMap.needsUpdate=!0)}const $=UL();$&&("enabled"in $?$.enabled=!S:"legacyMode"in $&&($.legacyMode=S)),yc(q,{outputEncoding:g?3e3:3001,toneMapping:M?Ts:PM}),z.legacy!==S&&z.set(()=>({legacy:S})),z.linear!==g&&z.set(()=>({linear:g})),z.flat!==M&&z.set(()=>({flat:M})),d&&!wn.fun(d)&&!XL(d)&&!wn.equ(d,q,xc)&&yc(q,d),_&&!z.events.handlers&&z.set({events:_(s)});const F=TG(n,p);return wn.equ(F,z.size,xc)||z.setSize(F.width,F.height,F.updateStyle,F.top,F.left),R&&z.viewport.dpr!==HL(R)&&z.setDpr(R),z.frameloop!==C&&z.setFrameloop(C),z.onPointerMissed||z.set({onPointerMissed:I}),P&&!wn.equ(P,z.performance,xc)&&z.set(re=>({performance:{...re.performance,...P}})),a=x,l=!0,this},render(h){return l||this.configure(),Zd.updateContainer(ie.createElement(CG,{store:s,children:h,onCreated:a,rootElement:n}),o,null,()=>{}),s},unmount(){jL(n)}}}function CG({store:n,children:e,onCreated:t,rootElement:i}){return Ap(()=>{const r=n.getState();r.set(s=>({internal:{...s.internal,active:!0}})),t&&t(r),n.getState().events.connected||r.events.connect==null||r.events.connect(i)},[]),ie.createElement(Cw.Provider,{value:n},e)}function jL(n,e){const t=xf.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),Zd.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(),pG(r),xf.delete(n),e&&e(n)}catch{}},500)})}}function RG(n,e,t){return ie.createElement(bG,{key:e.uuid,children:n,container:e,state:t})}function bG({state:n={},children:e,container:t}){const{events:i,size:r,...s}=n,o=Rw(),[a]=ie.useState(()=>new Ew),[l]=ie.useState(()=>new be),f=ie.useCallback((d,p)=>{const m={...d};Object.keys(d).forEach(x=>{(_G.includes(x)||d[x]!==p[x]&&p[x])&&delete m[x]});let _;if(p&&r){const x=p.camera;_=d.viewport.getCurrentViewport(x,new V,r),x!==d.camera&&GL(x,r)}return{...m,scene:t,raycaster:a,pointer:l,mouse:l,previousRoot:o,events:{...d.events,...p==null?void 0:p.events,...i},size:{...d.size,...r},viewport:{...d.viewport,..._},...s}},[n]),[h]=ie.useState(()=>{const d=o.getState();return bL((m,_)=>({...d,scene:t,raycaster:a,pointer:l,mouse:l,previousRoot:o,events:{...d.events,...i},size:{...d.size,...r},...s,set:m,get:_,setEvents:x=>m(y=>({...y,events:{...y.events,...x}}))}))});return ie.useEffect(()=>{const d=o.subscribe(p=>h.setState(m=>f(p,m)));return()=>{d(),h.destroy()}},[]),ie.useEffect(()=>{h.setState(d=>f(o.getState(),d))},[f]),ie.createElement(ie.Fragment,null,Zd.createPortal(ie.createElement(Cw.Provider,{value:h},e),h,null))}Zd.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:ie.version});function Sf(){return Sf=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0?i=setTimeout(l,e-h):(i=null,t||(a=n.apply(s,r),s=r=null))}var f=function(){s=this,r=arguments,o=Date.now();var h=t&&!i;return i||(i=setTimeout(l,e)),h&&(a=n.apply(s,r),s=r=null),a};return f.clear=function(){i&&(clearTimeout(i),i=null)},f.flush=function(){i&&(a=n.apply(s,r),s=r=null,clearTimeout(i),i=null)},f}sS.debounce=sS;var PG=sS;const T2=DS(PG);function LG(n){let{debounce:e,scroll:t,polyfill:i,offsetSize:r}=n===void 0?{debounce:0,scroll:!1,offsetSize:!1}:n;const s=i||(typeof window>"u"?class{}:window.ResizeObserver);if(!s)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,a]=ie.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=ie.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o}),f=e?typeof e=="number"?e:e.scroll:null,h=e?typeof e=="number"?e:e.resize:null,d=ie.useRef(!1);ie.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[p,m,_]=ie.useMemo(()=>{const M=()=>{if(!l.current.element)return;const{left:S,top:E,width:C,height:R,bottom:P,right:D,x:b,y:I}=l.current.element.getBoundingClientRect(),z={left:S,top:E,width:C,height:R,bottom:P,right:D,x:b,y:I};l.current.element instanceof HTMLElement&&r&&(z.height=l.current.element.offsetHeight,z.width=l.current.element.offsetWidth),Object.freeze(z),d.current&&!FG(l.current.lastBounds,z)&&a(l.current.lastBounds=z)};return[M,h?T2(M,h):M,f?T2(M,f):M]},[a,r,f,h]);function x(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(M=>M.removeEventListener("scroll",_,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null)}function y(){l.current.element&&(l.current.resizeObserver=new s(_),l.current.resizeObserver.observe(l.current.element),t&&l.current.scrollContainers&&l.current.scrollContainers.forEach(M=>M.addEventListener("scroll",_,{capture:!0,passive:!0})))}const g=M=>{!M||M===l.current.element||(x(),l.current.element=M,l.current.scrollContainers=qL(M),y())};return DG(_,!!t),IG(m),ie.useEffect(()=>{x(),y()},[t,_,m]),ie.useEffect(()=>x,[]),[g,o,p]}function IG(n){ie.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function DG(n,e){ie.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function qL(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,...qL(n.parentElement)]}const NG=["x","y","top","bottom","left","right","width","height"],FG=(n,e)=>NG.every(t=>n[t]===e[t]);var UG=Object.defineProperty,kG=Object.defineProperties,OG=Object.getOwnPropertyDescriptors,A2=Object.getOwnPropertySymbols,zG=Object.prototype.hasOwnProperty,BG=Object.prototype.propertyIsEnumerable,C2=(n,e,t)=>e in n?UG(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,R2=(n,e)=>{for(var t in e||(e={}))zG.call(e,t)&&C2(n,t,e[t]);if(A2)for(var t of A2(e))BG.call(e,t)&&C2(n,t,e[t]);return n},HG=(n,e)=>kG(n,OG(e));function ZL(n,e,t){if(!n)return;if(t(n)===!0)return n;let i=e?n.return:n.child;for(;i;){const r=ZL(i,e,t);if(r)return r;i=e?null:i.sibling}}function KL(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const Pw=KL(ie.createContext(null));class JL extends ie.Component{render(){return ie.createElement(Pw.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:b2,ReactCurrentDispatcher:P2}=ie.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function VG(){const n=ie.useContext(Pw);if(n===null)throw new Error("its-fine: useFiber must be called within a !");const e=ie.useId();return ie.useMemo(()=>{for(const i of[b2==null?void 0:b2.current,n,n==null?void 0:n.alternate]){if(!i)continue;const r=ZL(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 GG(){var n,e;const t=VG(),[i]=ie.useState(()=>new Map);i.clear();let r=t;for(;r;){const s=(n=r.type)==null?void 0:n._context;s&&s!==Pw&&!i.has(s)&&i.set(s,(e=P2==null?void 0:P2.current)==null?void 0:e.readContext(KL(s))),r=r.return}return i}function WG(){const n=GG();return ie.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>i=>ie.createElement(e,null,ie.createElement(t.Provider,HG(R2({},i),{value:n.get(t)}))),e=>ie.createElement(JL,R2({},e))),[n])}const ox={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 XG(n){const{handlePointer:e}=vG(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(ox).reduce((t,i)=>({...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:{...o.events,connected:t}})),Object.entries((i=s.handlers)!=null?i:[]).forEach(([o,a])=>{const[l,f]=ox[o];t.addEventListener(l,a,{passive:f})})},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]=ox[s];i.connected.removeEventListener(a,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}const YG=ie.forwardRef(function({children:e,fallback:t,resize:i,style:r,gl:s,events:o=XG,eventSource:a,eventPrefix:l,shadows:f,linear:h,flat:d,legacy:p,orthographic:m,frameloop:_,dpr:x,performance:y,raycaster:g,camera:M,onPointerMissed:S,onCreated:E,...C},R){ie.useMemo(()=>Aw($V),[]);const P=WG(),[D,b]=LG({scroll:!0,debounce:{scroll:50,resize:0},...i}),I=ie.useRef(null),z=ie.useRef(null);ie.useImperativeHandle(R,()=>I.current);const q=OL(S),[J,Q]=ie.useState(!1),[ee,oe]=ie.useState(!1);if(J)throw J;if(ee)throw ee;const $=ie.useRef(null);Ap(()=>{const G=I.current;b.width>0&&b.height>0&&G&&($.current||($.current=AG(G)),$.current.configure({gl:s,events:o,shadows:f,linear:h,flat:d,legacy:p,orthographic:m,frameloop:_,dpr:x,performance:y,raycaster:g,camera:M,size:b,onPointerMissed:(...F)=>q.current==null?void 0:q.current(...F),onCreated:F=>{F.events.connect==null||F.events.connect(a?cG(a)?a.current:a:z.current),l&&F.setEvents({compute:(re,j)=>{const ve=re[l+"X"],le=re[l+"Y"];j.pointer.set(ve/j.size.width*2-1,-(le/j.size.height)*2+1),j.raycaster.setFromCamera(j.pointer,j.camera)}}),E==null||E(F)}}),$.current.render(ie.createElement(P,null,ie.createElement(zL,{set:oe},ie.createElement(ie.Suspense,{fallback:ie.createElement(fG,{set:Q})},e)))))}),ie.useEffect(()=>{const G=I.current;if(G)return()=>jL(G)},[]);const k=a?"none":"auto";return ie.createElement("div",Sf({ref:z,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:k,...r}},C),ie.createElement("div",{ref:D,style:{width:"100%",height:"100%"}},ie.createElement("canvas",{ref:I,style:{display:"block"}},t)))}),jG=ie.forwardRef(function(e,t){return ie.createElement(JL,null,ie.createElement(YG,Sf({},e,{ref:t})))});function qG(n){return function(e){n.forEach(function(t){typeof t=="function"?t(e):t!=null&&(t.current=e)})}}var ys=Uint8Array,ka=Uint16Array,oS=Uint32Array,QL=new ys([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),$L=new ys([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ZG=new ys([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),eI=function(n,e){for(var t=new ka(31),i=0;i<31;++i)t[i]=e+=1<>>1|(Tn&21845)<<1;Ra=(Ra&52428)>>>2|(Ra&13107)<<2,Ra=(Ra&61680)>>>4|(Ra&3855)<<4,aS[Tn]=((Ra&65280)>>>8|(Ra&255)<<8)>>>1}var nd=function(n,e,t){for(var i=n.length,r=0,s=new ka(e);r>>l]=f}else for(a=new ka(i),r=0;r>>15-n[r]);return a},Cp=new ys(288);for(var Tn=0;Tn<144;++Tn)Cp[Tn]=8;for(var Tn=144;Tn<256;++Tn)Cp[Tn]=9;for(var Tn=256;Tn<280;++Tn)Cp[Tn]=7;for(var Tn=280;Tn<288;++Tn)Cp[Tn]=8;var iI=new ys(32);for(var Tn=0;Tn<32;++Tn)iI[Tn]=5;var $G=nd(Cp,9,1),e6=nd(iI,5,1),ax=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},Os=function(n,e,t){var i=e/8|0;return(n[i]|n[i+1]<<8)>>(e&7)&t},lx=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},t6=function(n){return(n/8|0)+(n&7&&1)},n6=function(n,e,t){(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length);var i=new(n instanceof ka?ka:n instanceof oS?oS:ys)(t-e);return i.set(n.subarray(e,t)),i},i6=function(n,e,t){var i=n.length;if(!i||t&&!t.l&&i<5)return e||new ys(0);var r=!e||t,s=!t||t.i;t||(t={}),e||(e=new ys(i*3));var o=function(_e){var Re=e.length;if(_e>Re){var nt=new ys(Math.max(Re*2,_e));nt.set(e),e=nt}},a=t.f||0,l=t.p||0,f=t.b||0,h=t.l,d=t.d,p=t.m,m=t.n,_=i*8;do{if(!h){t.f=a=Os(n,l,1);var x=Os(n,l+1,3);if(l+=3,x)if(x==1)h=$G,d=e6,p=9,m=5;else if(x==2){var S=Os(n,l,31)+257,E=Os(n,l+10,15)+4,C=S+Os(n,l+5,31)+1;l+=14;for(var R=new ys(C),P=new ys(19),D=0;D>>4;if(y<16)R[D++]=y;else{var J=0,Q=0;for(y==16?(Q=3+Os(n,l,3),l+=2,J=R[D-1]):y==17?(Q=3+Os(n,l,7),l+=3):y==18&&(Q=11+Os(n,l,127),l+=7);Q--;)R[D++]=J}}var ee=R.subarray(0,S),oe=R.subarray(S);p=ax(ee),m=ax(oe),h=nd(ee,p,1),d=nd(oe,m,1)}else throw"invalid block type";else{var y=t6(l)+4,g=n[y-4]|n[y-3]<<8,M=y+g;if(M>i){if(s)throw"unexpected EOF";break}r&&o(f+g),e.set(n.subarray(y,M),f),t.b=f+=g,t.p=l=M*8;continue}if(l>_){if(s)throw"unexpected EOF";break}}r&&o(f+131072);for(var $=(1<>>4;if(l+=J&15,l>_){if(s)throw"unexpected EOF";break}if(!J)throw"invalid length/literal";if(F<256)e[f++]=F;else if(F==256){G=l,h=null;break}else{var re=F-254;if(F>264){var D=F-257,j=QL[D];re=Os(n,l,(1<>>4;if(!ve)throw"invalid distance";l+=ve&15;var oe=QG[le];if(le>3){var j=$L[le];oe+=lx(n,l)&(1<_){if(s)throw"unexpected EOF";break}r&&o(f+131072);for(var Pe=f+re;f>>4>7||(n[0]<<8|n[1])%31)throw"invalid zlib data";if(n[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function Cg(n,e){return i6((s6(n),n.subarray(2,-4)),e)}var o6=typeof TextDecoder<"u"&&new TextDecoder,a6=0;try{o6.decode(r6,{stream:!0}),a6=1}catch{}const l6=n=>n&&n.isCubeTexture;class u6 extends Mi{constructor(e,t){var i,r;const s=l6(e),a=((r=s?(i=e.image[0])==null?void 0:i.width:e.image.width)!=null?r:1024)/4,l=Math.floor(Math.log2(a)),f=Math.pow(2,l),h=3*Math.max(f,16*7),d=4*f,p=[s?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/h}`,`#define CUBEUV_TEXEL_HEIGHT ${1/d}`,`#define CUBEUV_MAX_MIP ${l}.0`],m=` varying vec3 vWorldPosition; void main() { vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); vWorldPosition = worldPosition.xyz; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); } `,_=p.join(` `)+` #define ENVMAP_TYPE_CUBE_UV varying vec3 vWorldPosition; uniform float radius; uniform float height; uniform float angle; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube map; #else uniform sampler2D map; #endif // From: https://www.shadertoy.com/view/4tsBD7 float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) { float d = dot ( rd, n ); if( d > 0.0 ) { return 1e6; } vec3 o = ro - c; float t = - dot( n, o ) / d; vec3 q = o + rd * t; return ( dot( q, q ) < r * r ) ? t : 1e6; } // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) { vec3 oc = ro - ce; float b = dot( oc, rd ); float c = dot( oc, oc ) - ra * ra; float h = b * b - c; if( h < 0.0 ) { return -1.0; } h = sqrt( h ); return - b + h; } vec3 project() { vec3 p = normalize( vWorldPosition ); vec3 camPos = cameraPosition; camPos.y -= height; float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); if( intersection > 0.0 ) { vec3 h = vec3( 0.0, - height, 0.0 ); float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); p = ( camPos + min( intersection, intersection2 ) * p ) / radius; } else { p = vec3( 0.0, 1.0, 0.0 ); } return p; } #include #include void main() { vec3 projectedWorldPosition = project(); #ifdef ENVMAP_TYPE_CUBE vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; #else vec3 direction = normalize( projectedWorldPosition ); vec2 uv = equirectUv( direction ); vec3 outcolor = texture2D( map, uv ).rgb; #endif gl_FragColor = vec4( outcolor, 1.0 ); #include #include } `,x={map:{value:e},height:{value:(t==null?void 0:t.height)||15},radius:{value:(t==null?void 0:t.radius)||100}},y=new Uf(1,16),g=new Ps({uniforms:x,fragmentShader:_,vertexShader:m,side:Ys});super(y,g)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}class c6 extends vw{constructor(e){super(e),this.type=ji}parse(e){const a=function(S,E){switch(S){case 1:console.error("THREE.RGBELoader Read Error: "+(E||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(E||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(E||""));break;default:case 4:console.error("THREE.RGBELoader: Error: "+(E||""))}return-1},d=` `,p=function(S,E,C){E=E||1024;let P=S.pos,D=-1,b=0,I="",z=String.fromCharCode.apply(null,new Uint16Array(S.subarray(P,P+128)));for(;0>(D=z.indexOf(d))&&b=S.byteLength||!(I=p(S)))return a(1,"no header found");if(!(z=I.match(E)))return a(3,"bad initial token");for(b.valid|=1,b.programtype=z[1],b.string+=I+` `;I=p(S),I!==!1;){if(b.string+=I+` `,I.charAt(0)==="#"){b.comments+=I+` `;continue}if((z=I.match(C))&&(b.gamma=parseFloat(z[1])),(z=I.match(R))&&(b.exposure=parseFloat(z[1])),(z=I.match(P))&&(b.valid|=2,b.format=z[1]),(z=I.match(D))&&(b.valid|=4,b.height=parseInt(z[1],10),b.width=parseInt(z[2],10)),b.valid&2&&b.valid&4)break}return b.valid&2?b.valid&4?b:a(3,"missing image size specifier"):a(3,"missing format specifier")},_=function(S,E,C){const R=E;if(R<8||R>32767||S[0]!==2||S[1]!==2||S[2]&128)return new Uint8Array(S);if(R!==(S[2]<<8|S[3]))return a(3,"wrong scanline width");const P=new Uint8Array(4*E*C);if(!P.length)return a(4,"unable to allocate buffer space");let D=0,b=0;const I=4*R,z=new Uint8Array(4),q=new Uint8Array(I);let J=C;for(;J>0&&bS.byteLength)return a(1);if(z[0]=S[b++],z[1]=S[b++],z[2]=S[b++],z[3]=S[b++],z[0]!=2||z[1]!=2||(z[2]<<8|z[3])!=R)return a(3,"bad rgbe scanline format");let Q=0,ee;for(;Q128;if($&&(ee-=128),ee===0||Q+ee>I)return a(3,"bad scanline data");if($){const k=S[b++];for(let G=0;G>3]&1<<(H&7))&&(A[U++]=H);for(var B=U-1;U<65536;)A[U++]=0;return B}function z(N){for(var A=0;A<16384;A++)N[A]={},N[A].len=0,N[A].lit=0,N[A].p=null}const q={l:0,c:0,lc:0};function J(N,A,U,H,B){for(;U>U&(1<0;--A){var H=U+Q[A]>>1;Q[A]=U,U=H}for(var A=0;A<65537;++A){var B=N[A];B>0&&(N[A]=B|Q[B]++<<6)}}function oe(N,A,U,H,B,X,ae){for(var ue=U,me=0,xe=0;B<=X;B++){if(ue.value-U.value>H)return!1;J(6,me,xe,N,ue);var Te=q.l;if(me=q.c,xe=q.lc,ae[B]=Te,Te==63){if(ue.value-U.value>H)throw"Something wrong with hufUnpackEncTable";J(8,me,xe,N,ue);var pe=q.l+6;if(me=q.c,xe=q.lc,B+pe>X+1)throw"Something wrong with hufUnpackEncTable";for(;pe--;)ae[B++]=0;B--}else if(Te>=59){var pe=Te-59+2;if(B+pe>X+1)throw"Something wrong with hufUnpackEncTable";for(;pe--;)ae[B++]=0;B--}}ee(ae)}function $(N){return N&63}function k(N){return N>>6}function G(N,A,U,H){for(;A<=U;A++){var B=k(N[A]),X=$(N[A]);if(B>>X)throw"Invalid table entry";if(X>14){var ae=H[B>>X-14];if(ae.len)throw"Invalid table entry";if(ae.lit++,ae.p){var ue=ae.p;ae.p=new Array(ae.lit);for(var me=0;me0;me--){var ae=H[(B<<14-X)+xe];if(ae.len||ae.p)throw"Invalid table entry";ae.len=X,ae.lit=A,xe++}}return!0}const F={c:0,lc:0};function re(N,A,U,H){N=N<<8|Qe(U,H),A+=8,F.c=N,F.lc=A}const j={c:0,lc:0};function ve(N,A,U,H,B,X,ae,ue,me,xe){if(N==A){H<8&&(re(U,H,B,ae),U=F.c,H=F.lc),H-=8;var Te=U>>H,Te=new Uint8Array([Te])[0];if(me.value+Te>xe)return!1;for(var pe=ue[me.value-1];Te-- >0;)ue[me.value++]=pe}else if(me.value32767?A-65536:A}const _e={a:0,b:0};function Re(N,A){var U=Pe(N),H=Pe(A),B=H,X=U+(B&1)+(B>>1),ae=X,ue=X-B;_e.a=ae,_e.b=ue}function nt(N,A){var U=le(N),H=le(A),B=U-(H>>1)&65535,X=H+B-32768&65535;_e.a=X,_e.b=B}function it(N,A,U,H,B,X,ae){for(var ue=ae<16384,me=U>B?B:U,xe=1,Te;xe<=me;)xe<<=1;for(xe>>=1,Te=xe,xe>>=1;xe>=1;){for(var pe=0,ke=pe+X*(B-Te),De=X*xe,Ve=X*Te,gt=H*xe,vt=H*Te,at,qe,wt,st;pe<=ke;pe+=Ve){for(var It=pe,cn=pe+H*(U-Te);It<=cn;It+=vt){var Rt=It+gt,fn=It+De,sn=fn+gt;ue?(Re(N[It+A],N[fn+A]),at=_e.a,wt=_e.b,Re(N[Rt+A],N[sn+A]),qe=_e.a,st=_e.b,Re(at,qe),N[It+A]=_e.a,N[Rt+A]=_e.b,Re(wt,st),N[fn+A]=_e.a,N[sn+A]=_e.b):(nt(N[It+A],N[fn+A]),at=_e.a,wt=_e.b,nt(N[Rt+A],N[sn+A]),qe=_e.a,st=_e.b,nt(at,qe),N[It+A]=_e.a,N[Rt+A]=_e.b,nt(wt,st),N[fn+A]=_e.a,N[sn+A]=_e.b)}if(U&xe){var fn=It+De;ue?Re(N[It+A],N[fn+A]):nt(N[It+A],N[fn+A]),at=_e.a,N[fn+A]=_e.b,N[It+A]=at}}if(B&xe)for(var It=pe,cn=pe+H*(U-Te);It<=cn;It+=vt){var Rt=It+gt;ue?Re(N[It+A],N[Rt+A]):nt(N[It+A],N[Rt+A]),at=_e.a,N[Rt+A]=_e.b,N[It+A]=at}Te=xe,xe>>=1}return pe}function Pt(N,A,U,H,B,X,ae,ue,me,xe){for(var Te=0,pe=0,ke=ue,De=Math.trunc(B.value+(X+7)/8);B.value=14;){var Ve=Te>>pe-14&16383,gt=A[Ve];if(gt.len)pe-=gt.len,ve(gt.lit,ae,Te,pe,U,H,B,me,xe,ke),Te=j.c,pe=j.lc;else{if(!gt.p)throw"hufDecode issues";var vt;for(vt=0;vt=at&&k(N[gt.p[vt]])==(Te>>pe-at&(1<>=qe,pe-=qe;pe>0;){var gt=A[Te<<14-pe&16383];if(gt.len)pe-=gt.len,ve(gt.lit,ae,Te,pe,U,H,B,me,xe,ke),Te=j.c,pe=j.lc;else throw"hufDecode issues"}return!0}function Ze(N,A,U,H,B,X){var ae={value:0},ue=U.value,me=Je(A,U),xe=Je(A,U);U.value+=4;var Te=Je(A,U);if(U.value+=4,me<0||me>=65537||xe<0||xe>=65537)throw"Something wrong with HUF_ENCSIZE";var pe=new Array(65537),ke=new Array(16384);z(ke);var De=H-(U.value-ue);if(oe(N,A,U,De,me,xe,pe),Te>8*(H-(U.value-ue)))throw"Something wrong with hufUncompress";G(pe,me,xe,ke),Pt(pe,ke,N,A,U,Te,xe,X,B,ae)}function Z(N,A,U){for(var H=0;HX||(A[B++]=N[U++],B>X));)A[B++]=N[H++]}function Ie(N){for(var A=N.byteLength,U=new Array,H=0,B=new DataView(N);A>0;){var X=B.getInt8(H++);if(X<0){var ae=-X;A-=ae+1;for(var ue=0;ue>8==255?B+=H&255:(U[B]=H,B++),N.value++}function He(N,A){A[0]=he(N[0]),A[1]=he(N[1]),A[2]=he(N[5]),A[3]=he(N[6]),A[4]=he(N[14]),A[5]=he(N[15]),A[6]=he(N[27]),A[7]=he(N[28]),A[8]=he(N[2]),A[9]=he(N[4]),A[10]=he(N[7]),A[11]=he(N[13]),A[12]=he(N[16]),A[13]=he(N[26]),A[14]=he(N[29]),A[15]=he(N[42]),A[16]=he(N[3]),A[17]=he(N[8]),A[18]=he(N[12]),A[19]=he(N[17]),A[20]=he(N[25]),A[21]=he(N[30]),A[22]=he(N[41]),A[23]=he(N[43]),A[24]=he(N[9]),A[25]=he(N[11]),A[26]=he(N[18]),A[27]=he(N[24]),A[28]=he(N[31]),A[29]=he(N[40]),A[30]=he(N[44]),A[31]=he(N[53]),A[32]=he(N[10]),A[33]=he(N[19]),A[34]=he(N[23]),A[35]=he(N[32]),A[36]=he(N[39]),A[37]=he(N[45]),A[38]=he(N[52]),A[39]=he(N[54]),A[40]=he(N[20]),A[41]=he(N[22]),A[42]=he(N[33]),A[43]=he(N[38]),A[44]=he(N[46]),A[45]=he(N[51]),A[46]=he(N[55]),A[47]=he(N[60]),A[48]=he(N[21]),A[49]=he(N[34]),A[50]=he(N[37]),A[51]=he(N[47]),A[52]=he(N[50]),A[53]=he(N[56]),A[54]=he(N[59]),A[55]=he(N[61]),A[56]=he(N[35]),A[57]=he(N[36]),A[58]=he(N[48]),A[59]=he(N[49]),A[60]=he(N[57]),A[61]=he(N[58]),A[62]=he(N[62]),A[63]=he(N[63])}function Ye(N){const A=.5*Math.cos(.7853975),U=.5*Math.cos(3.14159/16),H=.5*Math.cos(3.14159/8),B=.5*Math.cos(3*3.14159/16),X=.5*Math.cos(5*3.14159/16),ae=.5*Math.cos(3*3.14159/8),ue=.5*Math.cos(7*3.14159/16);for(var me=new Array(4),xe=new Array(4),Te=new Array(4),pe=new Array(4),ke=0;ke<8;++ke){var De=ke*8;me[0]=H*N[De+2],me[1]=ae*N[De+2],me[2]=H*N[De+6],me[3]=ae*N[De+6],xe[0]=U*N[De+1]+B*N[De+3]+X*N[De+5]+ue*N[De+7],xe[1]=B*N[De+1]-ue*N[De+3]-U*N[De+5]-X*N[De+7],xe[2]=X*N[De+1]-U*N[De+3]+ue*N[De+5]+B*N[De+7],xe[3]=ue*N[De+1]-X*N[De+3]+B*N[De+5]-U*N[De+7],Te[0]=A*(N[De+0]+N[De+4]),Te[3]=A*(N[De+0]-N[De+4]),Te[1]=me[0]+me[3],Te[2]=me[1]-me[2],pe[0]=Te[0]+Te[1],pe[1]=Te[3]+Te[2],pe[2]=Te[3]-Te[2],pe[3]=Te[0]-Te[1],N[De+0]=pe[0]+xe[0],N[De+1]=pe[1]+xe[1],N[De+2]=pe[2]+xe[2],N[De+3]=pe[3]+xe[3],N[De+4]=pe[3]-xe[3],N[De+5]=pe[2]-xe[2],N[De+6]=pe[1]-xe[1],N[De+7]=pe[0]-xe[0]}for(var Ve=0;Ve<8;++Ve)me[0]=H*N[16+Ve],me[1]=ae*N[16+Ve],me[2]=H*N[48+Ve],me[3]=ae*N[48+Ve],xe[0]=U*N[8+Ve]+B*N[24+Ve]+X*N[40+Ve]+ue*N[56+Ve],xe[1]=B*N[8+Ve]-ue*N[24+Ve]-U*N[40+Ve]-X*N[56+Ve],xe[2]=X*N[8+Ve]-U*N[24+Ve]+ue*N[40+Ve]+B*N[56+Ve],xe[3]=ue*N[8+Ve]-X*N[24+Ve]+B*N[40+Ve]-U*N[56+Ve],Te[0]=A*(N[Ve]+N[32+Ve]),Te[3]=A*(N[Ve]-N[32+Ve]),Te[1]=me[0]+me[3],Te[2]=me[1]-me[2],pe[0]=Te[0]+Te[1],pe[1]=Te[3]+Te[2],pe[2]=Te[3]-Te[2],pe[3]=Te[0]-Te[1],N[0+Ve]=pe[0]+xe[0],N[8+Ve]=pe[1]+xe[1],N[16+Ve]=pe[2]+xe[2],N[24+Ve]=pe[3]+xe[3],N[32+Ve]=pe[3]-xe[3],N[40+Ve]=pe[2]-xe[2],N[48+Ve]=pe[1]-xe[1],N[56+Ve]=pe[0]-xe[0]}function mt(N){for(var A=0;A<64;++A){var U=N[0][A],H=N[1][A],B=N[2][A];N[0][A]=U+1.5747*B,N[1][A]=U-.1873*H-.4682*B,N[2][A]=U+1.8556*H}}function dt(N,A,U){for(var H=0;H<64;++H)A[U+H]=eu.toHalfFloat($t(N[H]))}function $t(N){return N<=1?Math.sign(N)*Math.pow(Math.abs(N),2.2):Math.sign(N)*Math.pow(b,Math.abs(N)-1)}function W(N){return new DataView(N.array.buffer,N.offset.value,N.size)}function O(N){var A=N.viewer.buffer.slice(N.offset.value,N.offset.value+N.size),U=new Uint8Array(Ie(A)),H=new Uint8Array(U.length);return we(U),ye(U,H),new DataView(H.buffer)}function de(N){var A=N.array.slice(N.offset.value,N.offset.value+N.size),U=Cg(A),H=new Uint8Array(U.length);return we(U),ye(U,H),new DataView(H.buffer)}function Ce(N){for(var A=N.viewer,U={value:N.offset.value},H=new Uint16Array(N.width*N.scanlineBlockSize*(N.channels*N.type)),B=new Uint8Array(8192),X=0,ae=new Array(N.channels),ue=0;ue=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(me<=xe)for(var ue=0;ue0;){var ue=tt(A.buffer,U),me=je(A,U),xe=me>>2&3,Te=(me>>4)-1,pe=new Int8Array([Te])[0],ke=je(A,U);X.push({name:ue,index:pe,type:ke,compression:xe}),ae-=ue.length+3}for(var De=Tt.channels,Ve=new Array(N.channels),gt=0;gt=0&&(qe.idx[st.index]=wt),vt.offset=wt)}if(B.acCompressedSize>0)switch(B.acCompression){case 0:var Rt=new Uint16Array(B.totalAcUncompressedCount);Ze(N.array,A,U,B.acCompressedSize,Rt,B.totalAcUncompressedCount);break;case 1:var It=N.array.slice(U.value,U.value+B.totalAcUncompressedCount),cn=Cg(It),Rt=new Uint16Array(cn.buffer);U.value+=B.totalAcUncompressedCount;break}if(B.dcCompressedSize>0){var fn={array:N.array,offset:U,size:B.dcCompressedSize},sn=new Uint16Array(de(fn).buffer);U.value+=B.dcCompressedSize}if(B.rleRawSize>0){var It=N.array.slice(U.value,U.value+B.rleCompressedSize),cn=Cg(It),mn=Ie(cn.buffer);U.value+=B.rleCompressedSize}for(var Zn=0,Lt=new Array(Ve.length),gt=0;gt>10,U=N&1023;return(N>>15?-1:1)*(A?A===31?U?NaN:1/0:Math.pow(2,A-15)*(1+U/1024):6103515625e-14*(U/1024))}function ce(N,A){var U=N.getUint16(A.value,!0);return A.value+=2,U}function Ne(N,A){return he(ce(N,A))}function Be(N,A,U,H){for(var B=U.value,X=[];U.valueht.height?ht.height-A:ht.scanlineBlockSize;const H=ht.size=ht.height)break;for(let ae=0;ae{const d=qM.clone({[f]:{value:h}});return{...l,...d}},{}),vertexShader:e,fragmentShader:t}),this.key="",a.forEach(([l])=>Object.defineProperty(this,l,{get:()=>this.uniforms[l].value,set:f=>this.uniforms[l].value=f})),Object.assign(this,o),i&&i(this)}};return r.key=GM.generateUUID(),r}function I2(n,e,t){const i=bi(p=>p.size),r=bi(p=>p.viewport),s=typeof n=="number"?n:i.width*r.dpr,o=typeof e=="number"?e:i.height*r.dpr,a=(typeof n=="number"?t:n)||{},{samples:l=0,depth:f,...h}=a,d=ie.useMemo(()=>{const p=new bs(s,o,{minFilter:yn,magFilter:yn,type:ji,...h});return f&&(p.depthTexture=new $M(s,o,Pi)),p.samples=l,p},[]);return ie.useLayoutEffect(()=>{d.setSize(s,o),l&&(d.samples=l)},[l,d,s,o]),ie.useEffect(()=>()=>d.dispose(),[]),d}const h6=f6({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }");class d6 extends Fv{constructor(e=6,t=!1){super(),this.uniforms={chromaticAberration:{value:.05},transmission:{value:0},_transmission:{value:1},transmissionMap:{value:null},roughness:{value:0},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:1/0},attenuationColor:{value:new Ge("white")},anisotropicBlur:{value:.1},time:{value:0},distortion:{value:0},distortionScale:{value:.5},temporalDistortion:{value:0},buffer:{value:null}},this.onBeforeCompile=i=>{i.uniforms={...i.uniforms,...this.uniforms},t?i.defines.USE_SAMPLER="":i.defines.USE_TRANSMISSION="",i.fragmentShader=` uniform float chromaticAberration; uniform float anisotropicBlur; uniform float time; uniform float distortion; uniform float distortionScale; uniform float temporalDistortion; uniform sampler2D buffer; vec3 random3(vec3 c) { float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0))); vec3 r; r.z = fract(512.0*j); j *= .125; r.x = fract(512.0*j); j *= .125; r.y = fract(512.0*j); return r-0.5; } float seed = 0.0; uint hash( uint x ) { x += ( x << 10u ); x ^= ( x >> 6u ); x += ( x << 3u ); x ^= ( x >> 11u ); x += ( x << 15u ); return x; } // Compound versions of the hashing algorithm I whipped together. uint hash( uvec2 v ) { return hash( v.x ^ hash(v.y) ); } uint hash( uvec3 v ) { return hash( v.x ^ hash(v.y) ^ hash(v.z) ); } uint hash( uvec4 v ) { return hash( v.x ^ hash(v.y) ^ hash(v.z) ^ hash(v.w) ); } // Construct a float with half-open range [0:1] using low 23 bits. // All zeroes yields 0.0, all ones yields the next smallest representable value below 1.0. float floatConstruct( uint m ) { const uint ieeeMantissa = 0x007FFFFFu; // binary32 mantissa bitmask const uint ieeeOne = 0x3F800000u; // 1.0 in IEEE binary32 m &= ieeeMantissa; // Keep only mantissa bits (fractional part) m |= ieeeOne; // Add fractional part to 1.0 float f = uintBitsToFloat( m ); // Range [1:2] return f - 1.0; // Range [0:1] } // Pseudo-random value in half-open range [0:1]. float random( float x ) { return floatConstruct(hash(floatBitsToUint(x))); } float random( vec2 v ) { return floatConstruct(hash(floatBitsToUint(v))); } float random( vec3 v ) { return floatConstruct(hash(floatBitsToUint(v))); } float random( vec4 v ) { return floatConstruct(hash(floatBitsToUint(v))); } float rand() { float result = random(vec3(gl_FragCoord.xy, seed)); seed += 1.0; return result; } const float F3 = 0.3333333; const float G3 = 0.1666667; float snoise(vec3 p) { vec3 s = floor(p + dot(p, vec3(F3))); vec3 x = p - s + dot(s, vec3(G3)); vec3 e = step(vec3(0.0), x - x.yzx); vec3 i1 = e*(1.0 - e.zxy); vec3 i2 = 1.0 - e.zxy*(1.0 - e); vec3 x1 = x - i1 + G3; vec3 x2 = x - i2 + 2.0*G3; vec3 x3 = x - 1.0 + 3.0*G3; vec4 w, d; w.x = dot(x, x); w.y = dot(x1, x1); w.z = dot(x2, x2); w.w = dot(x3, x3); w = max(0.6 - w, 0.0); d.x = dot(random3(s), x); d.y = dot(random3(s + i1), x1); d.z = dot(random3(s + i2), x2); d.w = dot(random3(s + 1.0), x3); w *= w; w *= w; d *= w; return dot(d, vec4(52.0)); } float snoiseFractal(vec3 m) { return 0.5333333* snoise(m) +0.2666667* snoise(2.0*m) +0.1333333* snoise(4.0*m) +0.0666667* snoise(8.0*m); } `+i.fragmentShader,i.fragmentShader=i.fragmentShader.replace("#include ",` #ifdef USE_TRANSMISSION // Transmission code is based on glTF-Sampler-Viewer // https://github.com/KhronosGroup/glTF-Sample-Viewer 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; vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { // Direction of refracted light. vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); // Compute rotation-independant scaling of the model matrix. vec3 modelScale; modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); // The thickness is specified in local space. return normalize( refractionVector ) * thickness * modelScale; } float applyIorToRoughness( const in float roughness, const in float ior ) { // Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and // an IOR of 1.5 results in the default amount of microfacet refraction. 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 framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); #ifdef USE_SAMPLER #ifdef texture2DLodEXT return texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod); #else return texture2D(transmissionSamplerMap, fragCoord.xy, framebufferLod); #endif #else return texture2D(buffer, fragCoord.xy); #endif } vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { if ( isinf( attenuationDistance ) ) { // Attenuation distance is +∞, i.e. the transmitted color is not attenuated at all. return radiance; } else { // Compute light attenuation using Beer's law. vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); // Beer's law return transmittance * radiance; } } 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 ior, const in float thickness, const in vec3 attenuationColor, const in float attenuationDistance ) { vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); vec3 refractedRayExit = position + transmissionRay; // Project refracted vector on the framebuffer, while mapping to normalized device coordinates. vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; // Sample framebuffer to get pixel the refracted ray hits. vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance ); // Get the specular component. vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); } #endif `),i.fragmentShader=i.fragmentShader.replace("#include ",` // Improve the refraction to use the world pos material.transmission = _transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; material.attenuationDistance = attenuationDistance; material.attenuationColor = attenuationColor; #ifdef USE_TRANSMISSIONMAP material.transmission *= texture2D( transmissionMap, vUv ).r; #endif #ifdef USE_THICKNESSMAP material.thickness *= texture2D( thicknessMap, vUv ).g; #endif vec3 pos = vWorldPosition; vec3 v = normalize( cameraPosition - pos ); vec3 n = inverseTransformDirection( normal, viewMatrix ); vec3 transmission = vec3(0.0); float transmissionR, transmissionB, transmissionG; float randomCoords = rand(); float thickness_smear = thickness * max(pow(roughnessFactor, 0.33), anisotropicBlur); vec3 distortionNormal = vec3(0.0); vec3 temporalOffset = vec3(time, -time, -time) * temporalDistortion; if (distortion > 0.0) { distortionNormal = distortion * vec3(snoiseFractal(vec3((pos * distortionScale + temporalOffset))), snoiseFractal(vec3(pos.zxy * distortionScale - temporalOffset)), snoiseFractal(vec3(pos.yxz * distortionScale + temporalOffset))); } for (float i = 0.0; i < ${e}.0; i ++) { vec3 sampleNorm = normalize(n + roughnessFactor * roughnessFactor * 2.0 * normalize(vec3(rand() - 0.5, rand() - 0.5, rand() - 0.5)) * pow(rand(), 0.33) + distortionNormal); transmissionR = getIBLVolumeRefraction( sampleNorm, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness + thickness_smear * (i + randomCoords) / float(${e}), material.attenuationColor, material.attenuationDistance ).r; transmissionG = getIBLVolumeRefraction( sampleNorm, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, material.ior * (1.0 + chromaticAberration * (i + randomCoords) / float(${e})) , material.thickness + thickness_smear * (i + randomCoords) / float(${e}), material.attenuationColor, material.attenuationDistance ).g; transmissionB = getIBLVolumeRefraction( sampleNorm, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, material.ior * (1.0 + 2.0 * chromaticAberration * (i + randomCoords) / float(${e})), material.thickness + thickness_smear * (i + randomCoords) / float(${e}), material.attenuationColor, material.attenuationDistance ).b; transmission.r += transmissionR; transmission.g += transmissionG; transmission.b += transmissionB; } transmission /= ${e}.0; totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission ); `)},Object.keys(this.uniforms).forEach(i=>Object.defineProperty(this,i,{get:()=>this.uniforms[i].value,set:r=>this.uniforms[i].value=r}))}}const Au=ie.forwardRef(({buffer:n,transmissionSampler:e=!1,backside:t=!1,side:i=wo,transmission:r=1,thickness:s=0,backsideThickness:o=0,samples:a=10,resolution:l,backsideResolution:f,background:h,anisotropy:d,anisotropicBlur:p,...m},_)=>{Aw({MeshTransmissionMaterial:d6});const x=ie.useRef(null),[y]=ie.useState(()=>new h6),g=I2(f||l),M=I2(l);let S,E,C;return da(R=>{x.current.time=R.clock.getElapsedTime(),x.current.buffer===M.texture&&!e&&(C=x.current.__r3f.parent,C&&(E=R.gl.toneMapping,S=R.scene.background,R.gl.toneMapping=Ts,h&&(R.scene.background=h),C.material=y,t&&(R.gl.setRenderTarget(g),R.gl.render(R.scene,R.camera),C.material=x.current,C.material.buffer=g.texture,C.material.thickness=o,C.material.side=qi),R.gl.setRenderTarget(M),R.gl.render(R.scene,R.camera),C.material.thickness=s,C.material.side=i,C.material.buffer=M.texture,R.scene.background=S,R.gl.setRenderTarget(null),C.material=x.current,R.gl.toneMapping=E))}),ie.useImperativeHandle(_,()=>x.current,[]),ie.createElement("meshTransmissionMaterial",Sf({args:[a,e],ref:x},m,{buffer:n||M.texture,_transmission:r,anisotropicBlur:p??d,transmission:e?r:0,thickness:s,side:i}))}),D2=ie.forwardRef(({children:n,enabled:e=!0,speed:t=1,rotationIntensity:i=1,floatIntensity:r=1,floatingRange:s=[-.1,.1],...o},a)=>{const l=ie.useRef(null),f=ie.useRef(Math.random()*1e4);return da(h=>{var d,p;if(!e||t===0)return;const m=f.current+h.clock.getElapsedTime();l.current.rotation.x=Math.cos(m/4*t)/8*i,l.current.rotation.y=Math.sin(m/4*t)/8*i,l.current.rotation.z=Math.sin(m/4*t)/20*i;let _=Math.sin(m/4*t)/10;_=GM.mapLinear(_,-.1,.1,(d=s==null?void 0:s[0])!==null&&d!==void 0?d:-.1,(p=s==null?void 0:s[1])!==null&&p!==void 0?p:.1),l.current.position.y=_*r,l.current.updateMatrix()}),ie.createElement("group",o,ie.createElement("group",{ref:qG([l,a]),matrixAutoUpdate:!1},n))}),ux={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},p6="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",m6=n=>typeof n=="object"&&typeof n.then=="function",N2=n=>Array.isArray(n);function rI({files:n=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"],path:e="",preset:t=void 0,encoding:i=void 0,extensions:r}={}){let s=null,o=!1,a;if(t){if(!(t in ux))throw new Error("Preset must be one of: "+Object.keys(ux).join(", "));n=ux[t],e=p6}if(m6(n))n=FL(async m=>(await m).default,[n]),s=L2;else{var l;o=N2(n),a=!N2(n)&&((l=n.split(".").pop())==null?void 0:l.toLowerCase()),s=o?pL:a==="hdr"?c6:a==="exr"?L2:null}if(!s)throw new Error("useEnvironment: Unrecognized file extension: "+n);const f=bw(s,o?[n]:n,m=>{m.setPath==null||m.setPath(e),r&&r(m)}),h=o?f[0]:f;h.mapping=o?oa:gf;const d=3001,p=3e3;return"colorSpace"in h?h.colorSpace=i??o?"srgb":"srgb-linear":h.encoding=i??o?d:p,h}const g6=n=>n.current&&n.current.isScene,v6=n=>g6(n)?n.current:n;function Lw(n,e,t,i,r=0){const s=v6(e||t),o=s.background,a=s.environment,l=s.backgroundBlurriness||0;return n!=="only"&&(s.environment=i),n&&(s.background=i),n&&s.backgroundBlurriness!==void 0&&(s.backgroundBlurriness=r),()=>{n!=="only"&&(s.environment=a),n&&(s.background=o),n&&s.backgroundBlurriness!==void 0&&(s.backgroundBlurriness=l)}}function Iw({scene:n,background:e=!1,blur:t,map:i}){const r=bi(s=>s.scene);return ie.useLayoutEffect(()=>{if(i)return Lw(e,n,r,i,t)},[r,n,i,e,t]),null}function sI({background:n=!1,scene:e,blur:t,...i}){const r=rI(i),s=bi(o=>o.scene);return ie.useLayoutEffect(()=>Lw(n,e,s,r,t),[r,n,e,s,t]),null}function _6({children:n,near:e=1,far:t=1e3,resolution:i=256,frames:r=1,map:s,background:o=!1,blur:a,scene:l,files:f,path:h,preset:d=void 0,extensions:p}){const m=bi(S=>S.gl),_=bi(S=>S.scene),x=ie.useRef(null),[y]=ie.useState(()=>new Bd),g=ie.useMemo(()=>{const S=new Tv(i);return S.texture.type=ji,S},[i]);ie.useLayoutEffect(()=>(r===1&&x.current.update(m,y),Lw(o,l,_,g.texture,a)),[n,y,g.texture,l,_,o,r,m]);let M=1;return da(()=>{(r===1/0||MAw({GroundProjectedEnvImpl:u6}),[]);const a=ie.useMemo(()=>[o],[o]),l=(e=n.ground)==null?void 0:e.height,f=(t=n.ground)==null?void 0:t.radius,h=(i=(r=n.ground)==null?void 0:r.scale)!==null&&i!==void 0?i:1e3;return ie.createElement(ie.Fragment,null,ie.createElement(Iw,Sf({},n,{map:o})),ie.createElement("groundProjectedEnvImpl",{args:a,scale:h,height:l,radius:f}))}function x6(n){return n.ground?ie.createElement(y6,n):n.map?ie.createElement(Iw,n):n.children?ie.createElement(_6,n):ie.createElement(sI,n)}var oI={exports:{}},S6="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",M6=S6,w6=M6;function aI(){}function lI(){}lI.resetWarningCache=aI;var E6=function(){function n(i,r,s,o,a,l){if(l!==w6){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}n.isRequired=n;function e(){return n}var t={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:e,element:n,elementType:n,instanceOf:e,node:n,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:lI,resetWarningCache:aI};return t.PropTypes=t,t};oI.exports=E6();var T6=oI.exports;const Bf=DS(T6);function A6({all:n,scene:e,camera:t}){const i=bi(({gl:o})=>o),r=bi(({camera:o})=>o),s=bi(({scene:o})=>o);return ie.useLayoutEffect(()=>{const o=[];n&&(e||s).traverse(f=>{f.visible===!1&&(o.push(f),f.visible=!0)}),i.compile(e||s,t||r);const a=new Tv(128);new ZM(.01,1e5,a).update(i,e||s),a.dispose(),o.forEach(f=>f.visible=!1)},[]),null}function C6({pixelated:n}){const e=bi(o=>o.gl),t=bi(o=>o.internal.active),i=bi(o=>o.performance.current),r=bi(o=>o.viewport.initialDpr),s=bi(o=>o.setDpr);return ie.useEffect(()=>{const o=e.domElement;return()=>{t&&s(r),n&&o&&(o.style.imageRendering="auto")}},[]),ie.useEffect(()=>{s(i*r),n&&e.domElement&&(e.domElement.style.imageRendering=i===1?"auto":"pixelated")},[i]),null}function R6(){const n=bi(i=>i.get),e=bi(i=>i.setEvents),t=bi(i=>i.performance.current);return ie.useEffect(()=>{const i=n().events.enabled;return()=>e({enabled:i})},[]),ie.useEffect(()=>e({enabled:t===1}),[t]),null}const b6=ie.createContext(null);function P6({iterations:n=10,ms:e=250,threshold:t=.75,step:i=.1,factor:r=.5,flipflops:s=1/0,bounds:o=p=>p>100?[60,100]:[40,60],onIncline:a,onDecline:l,onChange:f,onFallback:h,children:d}){const p=Math.pow(10,0),[m,_]=ie.useState(()=>({fps:0,index:0,factor:r,flipped:0,refreshrate:0,fallback:!1,frames:[],averages:[],subscriptions:new Map,subscribe:y=>{const g=Symbol();return m.subscriptions.set(g,y.current),()=>void m.subscriptions.delete(g)}}));let x=0;return da(()=>{const{frames:y,averages:g}=m;if(!m.fallback&&g.length=e){if(m.fps=Math.round(y.length/M*1e3*p)/p,m.refreshrate=Math.max(m.refreshrate,m.fps),g[m.index++%n]=m.fps,g.length===n){const[S,E]=o(m.refreshrate),C=g.filter(P=>P>=E),R=g.filter(P=>Pn*t&&(m.factor=Math.min(1,m.factor+i),m.flipped++,a&&a(m),m.subscriptions.forEach(P=>P.onIncline&&P.onIncline(m))),R.length>n*t&&(m.factor=Math.max(0,m.factor-i),m.flipped++,l&&l(m),m.subscriptions.forEach(P=>P.onDecline&&P.onDecline(m))),x!==m.factor&&(x=m.factor,f&&f(m),m.subscriptions.forEach(P=>P.onChange&&P.onChange(m))),m.flipped>s&&!m.fallback&&(m.fallback=!0,h&&h(m),m.subscriptions.forEach(P=>P.onFallback&&P.onFallback(m))),m.averages=[]}m.frames=[]}}}),ie.createElement(b6.Provider,{value:m},d)}function Vo(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function uI(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e}/*! * GSAP 3.12.1 * https://greensock.com * * @license Copyright 2008-2023, GreenSock. All rights reserved. * Subject to the terms at https://greensock.com/standard-license or for * Club GreenSock members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com */var Kr={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Mf={duration:.5,overwrite:!1,delay:0},Dw,Zi,jn,Ss=1e8,_n=1/Ss,lS=Math.PI*2,L6=lS/4,I6=0,cI=Math.sqrt,D6=Math.cos,N6=Math.sin,Ei=function(e){return typeof e=="string"},qn=function(e){return typeof e=="function"},la=function(e){return typeof e=="number"},Nw=function(e){return typeof e>"u"},Eo=function(e){return typeof e=="object"},br=function(e){return e!==!1},Fw=function(){return typeof window<"u"},Rg=function(e){return qn(e)||Ei(e)},fI=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Ki=Array.isArray,uS=/(?:-?\.?\d|\.)+/gi,hI=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Xc=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,cx=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,dI=/[+-]=-?[.\d]+/,pI=/[^,'"\[\]\s]+/gi,F6=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Un,ds,cS,Uw,Qr={},X0={},mI,gI=function(e){return(X0=Cu(e,Qr))&&Ir},kw=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},Y0=function(e,t){return!t&&console.warn(e)},vI=function(e,t){return e&&(Qr[e]=t)&&X0&&(X0[e]=t)||Qr},Kd=function(){return 0},U6={suppressEvents:!0,isStart:!0,kill:!1},a0={suppressEvents:!0,kill:!1},k6={suppressEvents:!0},Ow={},tl=[],fS={},_I,Gr={},fx={},F2=30,l0=[],zw="",Bw=function(e){var t=e[0],i,r;if(Eo(t)||qn(t)||(e=[e]),!(i=(t._gsap||{}).harness)){for(r=l0.length;r--&&!l0[r].targetTest(t););i=l0[r]}for(r=e.length;r--;)e[r]&&(e[r]._gsap||(e[r]._gsap=new VI(e[r],i)))||e.splice(r,1);return e},cu=function(e){return e._gsap||Bw(Ms(e))[0]._gsap},yI=function(e,t,i){return(i=e[t])&&qn(i)?e[t]():Nw(i)&&e.getAttribute&&e.getAttribute(t)||i},Pr=function(e,t){return(e=e.split(",")).forEach(t)||e},Qn=function(e){return Math.round(e*1e5)/1e5||0},Ri=function(e){return Math.round(e*1e7)/1e7||0},rf=function(e,t){var i=t.charAt(0),r=parseFloat(t.substr(2));return e=parseFloat(e),i==="+"?e+r:i==="-"?e-r:i==="*"?e*r:e/r},O6=function(e,t){for(var i=t.length,r=0;e.indexOf(t[r])<0&&++ra;)o=o._prev;return o?(t._next=o._next,o._next=t):(t._next=e[i],e[i]=t),t._next?t._next._prev=t:e[r]=t,t._prev=o,t.parent=t._dp=e,t},Ov=function(e,t,i,r){i===void 0&&(i="_first"),r===void 0&&(r="_last");var s=t._prev,o=t._next;s?s._next=o:e[i]===t&&(e[i]=o),o?o._prev=s:e[r]===t&&(e[r]=s),t._next=t._prev=t.parent=null},ul=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove&&e.parent.remove(e),e._act=0},fu=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var i=e;i;)i._dirty=1,i=i.parent;return e},H6=function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e},hS=function(e,t,i,r){return e._startAt&&(Zi?e._startAt.revert(a0):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(t,!0,r))},V6=function n(e){return!e||e._ts&&n(e.parent)},k2=function(e){return e._repeat?wf(e._tTime,e=e.duration()+e._rDelay)*e:0},wf=function(e,t){var i=Math.floor(e/=t);return e&&i===e?i-1:i},Z0=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},zv=function(e){return e._end=Ri(e._start+(e._tDur/Math.abs(e._ts||e._rts||_n)||0))},Bv=function(e,t){var i=e._dp;return i&&i.smoothChildTiming&&e._ts&&(e._start=Ri(i._time-(e._ts>0?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),zv(e),i._dirty||fu(i,e)),e},EI=function(e,t){var i;if((t._time||t._initted&&!t._dur)&&(i=Z0(e.rawTime(),t),(!t._dur||Rp(0,t.totalDuration(),i)-t._tTime>_n)&&t.render(i,!0)),fu(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur=0&&i.totalTime(i._tTime),i=i._dp;e._zTime=-_n}},po=function(e,t,i,r){return t.parent&&ul(t),t._start=Ri((la(i)?i:i||e!==Un?hs(e,i,t):e._time)+t._delay),t._end=Ri(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),wI(e,t,"_first","_last",e._sort?"_start":0),dS(t)||(e._recent=t),r||EI(e,t),e._ts<0&&Bv(e,e._tTime),e},TI=function(e,t){return(Qr.ScrollTrigger||kw("scrollTrigger",t))&&Qr.ScrollTrigger.create(t,e)},AI=function(e,t,i,r,s){if(Vw(e,t,s),!e._initted)return 1;if(!i&&e._pt&&!Zi&&(e._dur&&e.vars.lazy!==!1||!e._dur&&e.vars.lazy)&&_I!==Wr.frame)return tl.push(e),e._lazy=[s,r],1},G6=function n(e){var t=e.parent;return t&&t._ts&&t._initted&&!t._lock&&(t.rawTime()<0||n(t))},dS=function(e){var t=e.data;return t==="isFromStart"||t==="isStart"},W6=function(e,t,i,r){var s=e.ratio,o=t<0||!t&&(!e._start&&G6(e)&&!(!e._initted&&dS(e))||(e._ts<0||e._dp._ts<0)&&!dS(e))?0:1,a=e._rDelay,l=0,f,h,d;if(a&&e._repeat&&(l=Rp(0,e._tDur,t),h=wf(l,a),e._yoyo&&h&1&&(o=1-o),h!==wf(e._tTime,a)&&(s=1-o,e.vars.repeatRefresh&&e._initted&&e.invalidate())),o!==s||Zi||r||e._zTime===_n||!t&&e._zTime){if(!e._initted&&AI(e,t,r,i,l))return;for(d=e._zTime,e._zTime=t||(i?_n:0),i||(i=t&&!d),e.ratio=o,e._from&&(o=1-o),e._time=0,e._tTime=l,f=e._pt;f;)f.r(o,f.d),f=f._next;t<0&&hS(e,t,i,!0),e._onUpdate&&!i&&ws(e,"onUpdate"),l&&e._repeat&&!i&&e.parent&&ws(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===o&&(o&&ul(e,1),!i&&!Zi&&(ws(e,o?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=t)},X6=function(e,t,i){var r;if(i>t)for(r=e._first;r&&r._start<=i;){if(r.data==="isPause"&&r._start>t)return r;r=r._next}else for(r=e._last;r&&r._start>=i;){if(r.data==="isPause"&&r._start0&&!r&&Bv(e,e._tTime=e._tDur*a),e.parent&&zv(e),i||fu(e.parent,e),e},O2=function(e){return e instanceof ur?fu(e):Ef(e,e._dur)},Y6={_start:0,endTime:Kd,totalDuration:Kd},hs=function n(e,t,i){var r=e.labels,s=e._recent||Y6,o=e.duration()>=Ss?s.endTime(!1):e._dur,a,l,f;return Ei(t)&&(isNaN(t)||t in r)?(l=t.charAt(0),f=t.substr(-1)==="%",a=t.indexOf("="),l==="<"||l===">"?(a>=0&&(t=t.replace(/=/,"")),(l==="<"?s._start:s.endTime(s._repeat>=0))+(parseFloat(t.substr(1))||0)*(f?(a<0?s:i).totalDuration()/100:1)):a<0?(t in r||(r[t]=o),r[t]):(l=parseFloat(t.charAt(a-1)+t.substr(a+1)),f&&i&&(l=l/100*(Ki(i)?i[0]:i).totalDuration()),a>1?n(e,t.substr(0,a-1),i)+l:o+l)):t==null?o:+t},rd=function(e,t,i){var r=la(t[1]),s=(r?2:1)+(e<2?0:1),o=t[s],a,l;if(r&&(o.duration=t[1]),o.parent=i,e){for(a=o,l=i;l&&!("immediateRender"in a);)a=l.vars.defaults||{},l=br(l.vars.inherit)&&l.parent;o.immediateRender=br(a.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new si(t[0],o,t[s+1])},yl=function(e,t){return e||e===0?t(e):t},Rp=function(e,t,i){return it?t:i},Yi=function(e,t){return!Ei(e)||!(t=F6.exec(e))?"":t[1]},j6=function(e,t,i){return yl(i,function(r){return Rp(e,t,r)})},pS=[].slice,CI=function(e,t){return e&&Eo(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&Eo(e[0]))&&!e.nodeType&&e!==ds},q6=function(e,t,i){return i===void 0&&(i=[]),e.forEach(function(r){var s;return Ei(r)&&!t||CI(r,1)?(s=i).push.apply(s,Ms(r)):i.push(r)})||i},Ms=function(e,t,i){return jn&&!t&&jn.selector?jn.selector(e):Ei(e)&&!i&&(cS||!Tf())?pS.call((t||Uw).querySelectorAll(e),0):Ki(e)?q6(e,i):CI(e)?pS.call(e,0):e?[e]:[]},mS=function(e){return e=Ms(e)[0]||Y0("Invalid scope")||{},function(t){var i=e.current||e.nativeElement||e;return Ms(t,i.querySelectorAll?i:i===e?Y0("Invalid scope")||Uw.createElement("div"):e)}},RI=function(e){return e.sort(function(){return .5-Math.random()})},bI=function(e){if(qn(e))return e;var t=Eo(e)?e:{each:e},i=hu(t.ease),r=t.from||0,s=parseFloat(t.base)||0,o={},a=r>0&&r<1,l=isNaN(r)||a,f=t.axis,h=r,d=r;return Ei(r)?h=d={center:.5,edges:.5,end:1}[r]||0:!a&&l&&(h=r[0],d=r[1]),function(p,m,_){var x=(_||t).length,y=o[x],g,M,S,E,C,R,P,D,b;if(!y){if(b=t.grid==="auto"?0:(t.grid||[1,Ss])[1],!b){for(P=-Ss;P<(P=_[b++].getBoundingClientRect().left)&&bP&&(P=C),Cx?x-1:f?f==="y"?x/b:b:Math.max(b,x/b))||0)*(r==="edges"?-1:1),y.b=x<0?s-x:s,y.u=Yi(t.amount||t.each)||0,i=i&&x<0?zI(i):i}return x=(y[p]-y.min)/y.max||0,Ri(y.b+(i?i(x):x)*y.v)+y.u}},gS=function(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(i){var r=Ri(Math.round(parseFloat(i)/e)*e*t);return(r-r%1)/t+(la(i)?0:Yi(i))}},PI=function(e,t){var i=Ki(e),r,s;return!i&&Eo(e)&&(r=i=e.radius||Ss,e.values?(e=Ms(e.values),(s=!la(e[0]))&&(r*=r)):e=gS(e.increment)),yl(t,i?qn(e)?function(o){return s=e(o),Math.abs(s-o)<=r?s:o}:function(o){for(var a=parseFloat(s?o.x:o),l=parseFloat(s?o.y:0),f=Ss,h=0,d=e.length,p,m;d--;)s?(p=e[d].x-a,m=e[d].y-l,p=p*p+m*m):p=Math.abs(e[d]-a),pr?s-o:o)})},Jd=function(e){for(var t=0,i="",r,s,o,a;~(r=e.indexOf("random(",t));)o=e.indexOf(")",r),a=e.charAt(r+7)==="[",s=e.substr(r+7,o-r-7).match(a?pI:uS),i+=e.substr(t,r-t)+LI(a?s:+s[0],a?0:+s[1],+s[2]||1e-5),t=o+1;return i+e.substr(t,e.length-t)},DI=function(e,t,i,r,s){var o=t-e,a=r-i;return yl(s,function(l){return i+((l-e)/o*a||0)})},e8=function n(e,t,i,r){var s=isNaN(e+t)?0:function(m){return(1-m)*e+m*t};if(!s){var o=Ei(e),a={},l,f,h,d,p;if(i===!0&&(r=1)&&(i=null),o)e={p:e},t={p:t};else if(Ki(e)&&!Ki(t)){for(h=[],d=e.length,p=d-2,f=1;f(a=Math.abs(a))&&(l=o,s=a);return l},ws=function(e,t,i){var r=e.vars,s=r[t],o=jn,a=e._ctx,l,f,h;if(s)return l=r[t+"Params"],f=r.callbackScope||e,i&&tl.length&&j0(),a&&(jn=a),h=l?s.apply(f,l):s.call(f),jn=o,h},Uh=function(e){return ul(e),e.scrollTrigger&&e.scrollTrigger.kill(!!Zi),e.progress()<1&&ws(e,"onInterrupt"),e},Yc,NI=[],FI=function(e){if(Fw()&&e){e=!e.name&&e.default||e;var t=e.name,i=qn(e),r=t&&!i&&e.init?function(){this._props=[]}:e,s={init:Kd,render:Xw,add:Hw,kill:g8,modifier:m8,rawVars:0},o={targetTest:0,get:0,getSetter:Ww,aliases:{},register:0};if(Tf(),e!==r){if(Gr[t])return;Ls(r,Ls(q0(e,s),o)),Cu(r.prototype,Cu(s,q0(e,o))),Gr[r.prop=t]=r,e.targetTest&&(l0.push(r),Ow[t]=1),t=(t==="css"?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}vI(t,r),e.register&&e.register(Ir,r,Lr)}else e&&NI.push(e)},vn=255,kh={aqua:[0,vn,vn],lime:[0,vn,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,vn],navy:[0,0,128],white:[vn,vn,vn],olive:[128,128,0],yellow:[vn,vn,0],orange:[vn,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[vn,0,0],pink:[vn,192,203],cyan:[0,vn,vn],transparent:[vn,vn,vn,0]},hx=function(e,t,i){return e+=e<0?1:e>1?-1:0,(e*6<1?t+(i-t)*e*6:e<.5?i:e*3<2?t+(i-t)*(2/3-e)*6:t)*vn+.5|0},UI=function(e,t,i){var r=e?la(e)?[e>>16,e>>8&vn,e&vn]:0:kh.black,s,o,a,l,f,h,d,p,m,_;if(!r){if(e.substr(-1)===","&&(e=e.substr(0,e.length-1)),kh[e])r=kh[e];else if(e.charAt(0)==="#"){if(e.length<6&&(s=e.charAt(1),o=e.charAt(2),a=e.charAt(3),e="#"+s+s+o+o+a+a+(e.length===5?e.charAt(4)+e.charAt(4):"")),e.length===9)return r=parseInt(e.substr(1,6),16),[r>>16,r>>8&vn,r&vn,parseInt(e.substr(7),16)/255];e=parseInt(e.substr(1),16),r=[e>>16,e>>8&vn,e&vn]}else if(e.substr(0,3)==="hsl"){if(r=_=e.match(uS),!t)l=+r[0]%360/360,f=+r[1]/100,h=+r[2]/100,o=h<=.5?h*(f+1):h+f-h*f,s=h*2-o,r.length>3&&(r[3]*=1),r[0]=hx(l+1/3,s,o),r[1]=hx(l,s,o),r[2]=hx(l-1/3,s,o);else if(~e.indexOf("="))return r=e.match(hI),i&&r.length<4&&(r[3]=1),r}else r=e.match(uS)||kh.transparent;r=r.map(Number)}return t&&!_&&(s=r[0]/vn,o=r[1]/vn,a=r[2]/vn,d=Math.max(s,o,a),p=Math.min(s,o,a),h=(d+p)/2,d===p?l=f=0:(m=d-p,f=h>.5?m/(2-d-p):m/(d+p),l=d===s?(o-a)/m+(oe&&(i+=g-t),r+=g,C=r-i,S=C-o,(S>0||M)&&(R=++d.frame,p=C-d.time*1e3,d.time=C=C/1e3,o+=S+(S>=s?4:s-S),E=1),M||(l=f(x)),E)for(m=0;m=g&&m--},_listeners:a},d}(),Tf=function(){return!Qd&&Wr.wake()},Qt={},n8=/^[\d.\-M][\d.\-,\s]/,i8=/["']/g,r8=function(e){for(var t={},i=e.substr(1,e.length-3).split(":"),r=i[0],s=1,o=i.length,a,l,f;s1&&i.config?i.config.apply(null,~e.indexOf("{")?[r8(t[1])]:s8(e).split(",").map(SI)):Qt._CE&&n8.test(e)?Qt._CE("",e):i},zI=function(e){return function(t){return 1-e(1-t)}},BI=function n(e,t){for(var i=e._first,r;i;)i instanceof ur?n(i,t):i.vars.yoyoEase&&(!i._yoyo||!i._repeat)&&i._yoyo!==t&&(i.timeline?n(i.timeline,t):(r=i._ease,i._ease=i._yEase,i._yEase=r,i._yoyo=t)),i=i._next},hu=function(e,t){return e&&(qn(e)?e:Qt[e]||o8(e))||t},ku=function(e,t,i,r){i===void 0&&(i=function(l){return 1-t(1-l)}),r===void 0&&(r=function(l){return l<.5?t(l*2)/2:1-t((1-l)*2)/2});var s={easeIn:t,easeOut:i,easeInOut:r},o;return Pr(e,function(a){Qt[a]=Qr[a]=s,Qt[o=a.toLowerCase()]=i;for(var l in s)Qt[o+(l==="easeIn"?".in":l==="easeOut"?".out":".inOut")]=Qt[a+"."+l]=s[l]}),s},HI=function(e){return function(t){return t<.5?(1-e(1-t*2))/2:.5+e((t-.5)*2)/2}},dx=function n(e,t,i){var r=t>=1?t:1,s=(i||(e?.3:.45))/(t<1?t:1),o=s/lS*(Math.asin(1/r)||0),a=function(h){return h===1?1:r*Math.pow(2,-10*h)*N6((h-o)*s)+1},l=e==="out"?a:e==="in"?function(f){return 1-a(1-f)}:HI(a);return s=lS/s,l.config=function(f,h){return n(e,f,h)},l},px=function n(e,t){t===void 0&&(t=1.70158);var i=function(o){return o?--o*o*((t+1)*o+t)+1:0},r=e==="out"?i:e==="in"?function(s){return 1-i(1-s)}:HI(i);return r.config=function(s){return n(e,s)},r};Pr("Linear,Quad,Cubic,Quart,Quint,Strong",function(n,e){var t=e<5?e+1:e;ku(n+",Power"+(t-1),e?function(i){return Math.pow(i,t)}:function(i){return i},function(i){return 1-Math.pow(1-i,t)},function(i){return i<.5?Math.pow(i*2,t)/2:1-Math.pow((1-i)*2,t)/2})});Qt.Linear.easeNone=Qt.none=Qt.Linear.easeIn;ku("Elastic",dx("in"),dx("out"),dx());(function(n,e){var t=1/e,i=2*t,r=2.5*t,s=function(a){return a0?i+(i+this._rDelay)*this._repeat:i):this.totalDuration()&&this._dur},e.totalDuration=function(i){return arguments.length?(this._dirty=0,Ef(this,this._repeat<0?i:(i-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(i,r){if(Tf(),!arguments.length)return this._tTime;var s=this._dp;if(s&&s.smoothChildTiming&&this._ts){for(Bv(this,i),!s._dp||s.parent||EI(s,this);s&&s.parent;)s.parent._time!==s._start+(s._ts>=0?s._tTime/s._ts:(s.totalDuration()-s._tTime)/-s._ts)&&s.totalTime(s._tTime,!0),s=s.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&i0||!this._tDur&&!i)&&po(this._dp,this,this._start-this._delay)}return(this._tTime!==i||!this._dur&&!r||this._initted&&Math.abs(this._zTime)===_n||!i&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=i),xI(this,i,r)),this},e.time=function(i,r){return arguments.length?this.totalTime(Math.min(this.totalDuration(),i+k2(this))%(this._dur+this._rDelay)||(i?this._dur:0),r):this._time},e.totalProgress=function(i,r){return arguments.length?this.totalTime(this.totalDuration()*i,r):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio},e.progress=function(i,r){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-i:i)+k2(this),r):this.duration()?Math.min(1,this._time/this._dur):this.ratio},e.iteration=function(i,r){var s=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(i-1)*s,r):this._repeat?wf(this._tTime,s)+1:1},e.timeScale=function(i){if(!arguments.length)return this._rts===-_n?0:this._rts;if(this._rts===i)return this;var r=this.parent&&this._ts?Z0(this.parent._time,this):this._tTime;return this._rts=+i||0,this._ts=this._ps||i===-_n?0:this._rts,this.totalTime(Rp(-Math.abs(this._delay),this._tDur,r),!0),zv(this),H6(this)},e.paused=function(i){return arguments.length?(this._ps!==i&&(this._ps=i,i?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Tf(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==_n&&(this._tTime-=_n)))),this):this._ps},e.startTime=function(i){if(arguments.length){this._start=i;var r=this.parent||this._dp;return r&&(r._sort||!this.parent)&&po(r,this,i-this._delay),this}return this._start},e.endTime=function(i){return this._start+(br(i)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},e.rawTime=function(i){var r=this.parent||this._dp;return r?i&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?Z0(r.rawTime(i),this):this._tTime:this._tTime},e.revert=function(i){i===void 0&&(i=k6);var r=Zi;return Zi=i,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(i),this.totalTime(-.01,i.suppressEvents)),this.data!=="nested"&&i.kill!==!1&&this.kill(),Zi=r,this},e.globalTime=function(i){for(var r=this,s=arguments.length?i:r.rawTime();r;)s=r._start+s/(r._ts||1),r=r._dp;return!this.parent&&this._sat?this._sat.vars.immediateRender?-1:this._sat.globalTime(i):s},e.repeat=function(i){return arguments.length?(this._repeat=i===1/0?-2:i,O2(this)):this._repeat===-2?1/0:this._repeat},e.repeatDelay=function(i){if(arguments.length){var r=this._time;return this._rDelay=i,O2(this),r?this.time(r):this}return this._rDelay},e.yoyo=function(i){return arguments.length?(this._yoyo=i,this):this._yoyo},e.seek=function(i,r){return this.totalTime(hs(this,i),br(r))},e.restart=function(i,r){return this.play().totalTime(i?-this._delay:0,br(r))},e.play=function(i,r){return i!=null&&this.seek(i,r),this.reversed(!1).paused(!1)},e.reverse=function(i,r){return i!=null&&this.seek(i||this.totalDuration(),r),this.reversed(!0).paused(!1)},e.pause=function(i,r){return i!=null&&this.seek(i,r),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(i){return arguments.length?(!!i!==this.reversed()&&this.timeScale(-this._rts||(i?-_n:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-_n,this},e.isActive=function(){var i=this.parent||this._dp,r=this._start,s;return!!(!i||this._ts&&this._initted&&i.isActive()&&(s=i.rawTime(!0))>=r&&s1?(r?(o[i]=r,s&&(o[i+"Params"]=s),i==="onUpdate"&&(this._onUpdate=r)):delete o[i],this):o[i]},e.then=function(i){var r=this;return new Promise(function(s){var o=qn(i)?i:MI,a=function(){var f=r.then;r.then=null,qn(o)&&(o=o(r))&&(o.then||o===r)&&(r.then=f),s(o),r.then=f};r._initted&&r.totalProgress()===1&&r._ts>=0||!r._tTime&&r._ts<0?a():r._prom=a})},e.kill=function(){Uh(this)},n}();Ls($d.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-_n,_prom:0,_ps:!1,_rts:1});var ur=function(n){uI(e,n);function e(i,r){var s;return i===void 0&&(i={}),s=n.call(this,i)||this,s.labels={},s.smoothChildTiming=!!i.smoothChildTiming,s.autoRemoveChildren=!!i.autoRemoveChildren,s._sort=br(i.sortChildren),Un&&po(i.parent||Un,Vo(s),r),i.reversed&&s.reverse(),i.paused&&s.paused(!0),i.scrollTrigger&&TI(Vo(s),i.scrollTrigger),s}var t=e.prototype;return t.to=function(r,s,o){return rd(0,arguments,this),this},t.from=function(r,s,o){return rd(1,arguments,this),this},t.fromTo=function(r,s,o,a){return rd(2,arguments,this),this},t.set=function(r,s,o){return s.duration=0,s.parent=this,id(s).repeatDelay||(s.repeat=0),s.immediateRender=!!s.immediateRender,new si(r,s,hs(this,o),1),this},t.call=function(r,s,o){return po(this,si.delayedCall(0,r,s),o)},t.staggerTo=function(r,s,o,a,l,f,h){return o.duration=s,o.stagger=o.stagger||a,o.onComplete=f,o.onCompleteParams=h,o.parent=this,new si(r,o,hs(this,l)),this},t.staggerFrom=function(r,s,o,a,l,f,h){return o.runBackwards=1,id(o).immediateRender=br(o.immediateRender),this.staggerTo(r,s,o,a,l,f,h)},t.staggerFromTo=function(r,s,o,a,l,f,h,d){return a.startAt=o,id(a).immediateRender=br(a.immediateRender),this.staggerTo(r,s,a,l,f,h,d)},t.render=function(r,s,o){var a=this._time,l=this._dirty?this.totalDuration():this._tDur,f=this._dur,h=r<=0?0:Ri(r),d=this._zTime<0!=r<0&&(this._initted||!f),p,m,_,x,y,g,M,S,E,C,R,P;if(this!==Un&&h>l&&r>=0&&(h=l),h!==this._tTime||o||d){if(a!==this._time&&f&&(h+=this._time-a,r+=this._time-a),p=h,E=this._start,S=this._ts,g=!S,d&&(f||(a=this._zTime),(r||!s)&&(this._zTime=r)),this._repeat){if(R=this._yoyo,y=f+this._rDelay,this._repeat<-1&&r<0)return this.totalTime(y*100+r,s,o);if(p=Ri(h%y),h===l?(x=this._repeat,p=f):(x=~~(h/y),x&&x===h/y&&(p=f,x--),p>f&&(p=f)),C=wf(this._tTime,y),!a&&this._tTime&&C!==x&&this._tTime-C*y-this._dur<=0&&(C=x),R&&x&1&&(p=f-p,P=1),x!==C&&!this._lock){var D=R&&C&1,b=D===(R&&x&1);if(x=a&&r>=0)for(m=this._first;m;){if(_=m._next,(m._act||p>=m._start)&&m._ts&&M!==m){if(m.parent!==this)return this.render(r,s,o);if(m.render(m._ts>0?(p-m._start)*m._ts:(m._dirty?m.totalDuration():m._tDur)+(p-m._start)*m._ts,s,o),p!==this._time||!this._ts&&!g){M=0,_&&(h+=this._zTime=-_n);break}}m=_}else{m=this._last;for(var I=r<0?r:p;m;){if(_=m._prev,(m._act||I<=m._end)&&m._ts&&M!==m){if(m.parent!==this)return this.render(r,s,o);if(m.render(m._ts>0?(I-m._start)*m._ts:(m._dirty?m.totalDuration():m._tDur)+(I-m._start)*m._ts,s,o||Zi&&(m._initted||m._startAt)),p!==this._time||!this._ts&&!g){M=0,_&&(h+=this._zTime=I?-_n:_n);break}}m=_}}if(M&&!s&&(this.pause(),M.render(p>=a?0:-_n)._zTime=p>=a?1:-1,this._ts))return this._start=E,zv(this),this.render(r,s,o);this._onUpdate&&!s&&ws(this,"onUpdate",!0),(h===l&&this._tTime>=this.totalDuration()||!h&&a)&&(E===this._start||Math.abs(S)!==Math.abs(this._ts))&&(this._lock||((r||!f)&&(h===l&&this._ts>0||!h&&this._ts<0)&&ul(this,1),!s&&!(r<0&&!a)&&(h||a||!l)&&(ws(this,h===l&&r>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(h0)&&this._prom())))}return this},t.add=function(r,s){var o=this;if(la(s)||(s=hs(this,s,r)),!(r instanceof $d)){if(Ki(r))return r.forEach(function(a){return o.add(a,s)}),this;if(Ei(r))return this.addLabel(r,s);if(qn(r))r=si.delayedCall(0,r);else return this}return this!==r?po(this,r,s):this},t.getChildren=function(r,s,o,a){r===void 0&&(r=!0),s===void 0&&(s=!0),o===void 0&&(o=!0),a===void 0&&(a=-Ss);for(var l=[],f=this._first;f;)f._start>=a&&(f instanceof si?s&&l.push(f):(o&&l.push(f),r&&l.push.apply(l,f.getChildren(!0,s,o)))),f=f._next;return l},t.getById=function(r){for(var s=this.getChildren(1,1,1),o=s.length;o--;)if(s[o].vars.id===r)return s[o]},t.remove=function(r){return Ei(r)?this.removeLabel(r):qn(r)?this.killTweensOf(r):(Ov(this,r),r===this._recent&&(this._recent=this._last),fu(this))},t.totalTime=function(r,s){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Ri(Wr.time-(this._ts>0?r/this._ts:(this.totalDuration()-r)/-this._ts))),n.prototype.totalTime.call(this,r,s),this._forcing=0,this):this._tTime},t.addLabel=function(r,s){return this.labels[r]=hs(this,s),this},t.removeLabel=function(r){return delete this.labels[r],this},t.addPause=function(r,s,o){var a=si.delayedCall(0,s||Kd,o);return a.data="isPause",this._hasPause=1,po(this,a,hs(this,r))},t.removePause=function(r){var s=this._first;for(r=hs(this,r);s;)s._start===r&&s.data==="isPause"&&ul(s),s=s._next},t.killTweensOf=function(r,s,o){for(var a=this.getTweensOf(r,o),l=a.length;l--;)Oa!==a[l]&&a[l].kill(r,s);return this},t.getTweensOf=function(r,s){for(var o=[],a=Ms(r),l=this._first,f=la(s),h;l;)l instanceof si?O6(l._targets,a)&&(f?(!Oa||l._initted&&l._ts)&&l.globalTime(0)<=s&&l.globalTime(l.totalDuration())>s:!s||l.isActive())&&o.push(l):(h=l.getTweensOf(a,s)).length&&o.push.apply(o,h),l=l._next;return o},t.tweenTo=function(r,s){s=s||{};var o=this,a=hs(o,r),l=s,f=l.startAt,h=l.onStart,d=l.onStartParams,p=l.immediateRender,m,_=si.to(o,Ls({ease:s.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:s.duration||Math.abs((a-(f&&"time"in f?f.time:o._time))/o.timeScale())||_n,onStart:function(){if(o.pause(),!m){var y=s.duration||Math.abs((a-(f&&"time"in f?f.time:o._time))/o.timeScale());_._dur!==y&&Ef(_,y,0,1).render(_._time,!0,!0),m=1}h&&h.apply(_,d||[])}},s));return p?_.render(0):_},t.tweenFromTo=function(r,s,o){return this.tweenTo(s,Ls({startAt:{time:hs(this,r)}},o))},t.recent=function(){return this._recent},t.nextLabel=function(r){return r===void 0&&(r=this._time),z2(this,hs(this,r))},t.previousLabel=function(r){return r===void 0&&(r=this._time),z2(this,hs(this,r),1)},t.currentLabel=function(r){return arguments.length?this.seek(r,!0):this.previousLabel(this._time+_n)},t.shiftChildren=function(r,s,o){o===void 0&&(o=0);for(var a=this._first,l=this.labels,f;a;)a._start>=o&&(a._start+=r,a._end+=r),a=a._next;if(s)for(f in l)l[f]>=o&&(l[f]+=r);return fu(this)},t.invalidate=function(r){var s=this._first;for(this._lock=0;s;)s.invalidate(r),s=s._next;return n.prototype.invalidate.call(this,r)},t.clear=function(r){r===void 0&&(r=!0);for(var s=this._first,o;s;)o=s._next,this.remove(s),s=o;return this._dp&&(this._time=this._tTime=this._pTime=0),r&&(this.labels={}),fu(this)},t.totalDuration=function(r){var s=0,o=this,a=o._last,l=Ss,f,h,d;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-r:r));if(o._dirty){for(d=o.parent;a;)f=a._prev,a._dirty&&a.totalDuration(),h=a._start,h>l&&o._sort&&a._ts&&!o._lock?(o._lock=1,po(o,a,h-a._delay,1)._lock=0):l=h,h<0&&a._ts&&(s-=h,(!d&&!o._dp||d&&d.smoothChildTiming)&&(o._start+=h/o._ts,o._time-=h,o._tTime-=h),o.shiftChildren(-h,!1,-1/0),l=0),a._end>s&&a._ts&&(s=a._end),a=f;Ef(o,o===Un&&o._time>s?o._time:s,1,1),o._dirty=0}return o._tDur},e.updateRoot=function(r){if(Un._ts&&(xI(Un,Z0(r,Un)),_I=Wr.frame),Wr.frame>=F2){F2+=Kr.autoSleep||120;var s=Un._first;if((!s||!s._ts)&&Kr.autoSleep&&Wr._listeners.length<2){for(;s&&!s._ts;)s=s._next;s||Wr.sleep()}}},e}($d);Ls(ur.prototype,{_lock:0,_hasPause:0,_forcing:0});var a8=function(e,t,i,r,s,o,a){var l=new Lr(this._pt,e,t,0,1,qI,null,s),f=0,h=0,d,p,m,_,x,y,g,M;for(l.b=i,l.e=r,i+="",r+="",(g=~r.indexOf("random("))&&(r=Jd(r)),o&&(M=[i,r],o(M,e,t),i=M[0],r=M[1]),p=i.match(cx)||[];d=cx.exec(r);)_=d[0],x=r.substring(f,d.index),m?m=(m+1)%5:x.substr(-5)==="rgba("&&(m=1),_!==p[h++]&&(y=parseFloat(p[h-1])||0,l._pt={_next:l._pt,p:x||h===1?x:",",s:y,c:_.charAt(1)==="="?rf(y,_)-y:parseFloat(_)-y,m:m&&m<4?Math.round:0},f=cx.lastIndex);return l.c=f")}),E.duration();else{R={};for(D in _)D==="ease"||D==="easeEach"||f8(D,_[D],R,_.easeEach);for(D in R)for(J=R[D].sort(function(oe,$){return oe.t-$.t}),q=0,C=0;Cl-_n&&!h?l:r<_n?0:r,p,m,_,x,y,g,M,S,E;if(!f)W6(this,r,s,o);else if(d!==this._tTime||!r||o||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==h){if(p=d,S=this.timeline,this._repeat){if(x=f+this._rDelay,this._repeat<-1&&h)return this.totalTime(x*100+r,s,o);if(p=Ri(d%x),d===l?(_=this._repeat,p=f):(_=~~(d/x),_&&_===d/x&&(p=f,_--),p>f&&(p=f)),g=this._yoyo&&_&1,g&&(E=this._yEase,p=f-p),y=wf(this._tTime,x),p===a&&!o&&this._initted)return this._tTime=d,this;_!==y&&(S&&this._yEase&&BI(S,g),this.vars.repeatRefresh&&!g&&!this._lock&&(this._lock=o=1,this.render(Ri(x*_),!0).invalidate()._lock=0))}if(!this._initted){if(AI(this,h?r:p,o,s,d))return this._tTime=0,this;if(a!==this._time)return this;if(f!==this._dur)return this.render(r,s,o)}if(this._tTime=d,this._time=p,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=M=(E||this._ease)(p/f),this._from&&(this.ratio=M=1-M),p&&!a&&!s&&!_&&(ws(this,"onStart"),this._tTime!==d))return this;for(m=this._pt;m;)m.r(M,m.d),m=m._next;S&&S.render(r<0?r:!p&&g?-_n:S._dur*S._ease(p/this._dur),s,o)||this._startAt&&(this._zTime=r),this._onUpdate&&!s&&(h&&hS(this,r,s,o),ws(this,"onUpdate")),this._repeat&&_!==y&&this.vars.onRepeat&&!s&&this.parent&&ws(this,"onRepeat"),(d===this._tDur||!d)&&this._tTime===d&&(h&&!this._onUpdate&&hS(this,r,!0,!0),(r||!f)&&(d===this._tDur&&this._ts>0||!d&&this._ts<0)&&ul(this,1),!s&&!(h&&!a)&&(d||a||g)&&(ws(this,d===l?"onComplete":"onReverseComplete",!0),this._prom&&!(d0)&&this._prom()))}return this},t.targets=function(){return this._targets},t.invalidate=function(r){return(!r||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(r),n.prototype.invalidate.call(this,r)},t.resetTo=function(r,s,o,a){Qd||Wr.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),f;return this._initted||Vw(this,l),f=this._ease(l/this._dur),u8(this,r,s,o,a,f,l)?this.resetTo(r,s,o,a):(Bv(this,0),this.parent||wI(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},t.kill=function(r,s){if(s===void 0&&(s="all"),!r&&(!s||s==="all"))return this._lazy=this._pt=0,this.parent?Uh(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(r,s,Oa&&Oa.vars.overwrite!==!0)._first||Uh(this),this.parent&&o!==this.timeline.totalDuration()&&Ef(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,l=r?Ms(r):a,f=this._ptLookup,h=this._pt,d,p,m,_,x,y,g;if((!s||s==="all")&&B6(a,l))return s==="all"&&(this._pt=0),Uh(this);for(d=this._op=this._op||[],s!=="all"&&(Ei(s)&&(x={},Pr(s,function(M){return x[M]=1}),s=x),s=c8(a,s)),g=a.length;g--;)if(~l.indexOf(a[g])){p=f[g],s==="all"?(d[g]=s,_=p,m={}):(m=d[g]=d[g]||{},_=s);for(x in _)y=p&&p[x],y&&((!("kill"in y.d)||y.d.kill(x)===!0)&&Ov(this,y,"_pt"),delete p[x]),m!=="all"&&(m[x]=1)}return this._initted&&!this._pt&&h&&Uh(this),this},e.to=function(r,s){return new e(r,s,arguments[2])},e.from=function(r,s){return rd(1,arguments)},e.delayedCall=function(r,s,o,a){return new e(s,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:r,onComplete:s,onReverseComplete:s,onCompleteParams:o,onReverseCompleteParams:o,callbackScope:a})},e.fromTo=function(r,s,o){return rd(2,arguments)},e.set=function(r,s){return s.duration=0,s.repeatDelay||(s.repeat=0),new e(r,s)},e.killTweensOf=function(r,s,o){return Un.killTweensOf(r,s,o)},e}($d);Ls(si.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});Pr("staggerTo,staggerFrom,staggerFromTo",function(n){si[n]=function(){var e=new ur,t=pS.call(arguments,0);return t.splice(n==="staggerFromTo"?5:4,0,0),e[n].apply(e,t)}});var Gw=function(e,t,i){return e[t]=i},YI=function(e,t,i){return e[t](i)},h8=function(e,t,i,r){return e[t](r.fp,i)},d8=function(e,t,i){return e.setAttribute(t,i)},Ww=function(e,t){return qn(e[t])?YI:Nw(e[t])&&e.setAttribute?d8:Gw},jI=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e6)/1e6,t)},p8=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},qI=function(e,t){var i=t._pt,r="";if(!e&&t.b)r=t.b;else if(e===1&&t.e)r=t.e;else{for(;i;)r=i.p+(i.m?i.m(i.s+i.c*e):Math.round((i.s+i.c*e)*1e4)/1e4)+r,i=i._next;r+=t.c}t.set(t.t,t.p,r,t)},Xw=function(e,t){for(var i=t._pt;i;)i.r(e,i.d),i=i._next},m8=function(e,t,i,r){for(var s=this._pt,o;s;)o=s._next,s.p===r&&s.modifier(e,t,i),s=o},g8=function(e){for(var t=this._pt,i,r;t;)r=t._next,t.p===e&&!t.op||t.op===e?Ov(this,t,"_pt"):t.dep||(i=1),t=r;return!i},v8=function(e,t,i,r){r.mSet(e,t,r.m.call(r.tween,i,r.mt),r)},ZI=function(e){for(var t=e._pt,i,r,s,o;t;){for(i=t._next,r=s;r&&r.pr>t.pr;)r=r._next;(t._prev=r?r._prev:o)?t._prev._next=t:s=t,(t._next=r)?r._prev=t:o=t,t=i}e._pt=s},Lr=function(){function n(t,i,r,s,o,a,l,f,h){this.t=i,this.s=s,this.c=o,this.p=r,this.r=a||jI,this.d=l||this,this.set=f||Gw,this.pr=h||0,this._next=t,t&&(t._prev=this)}var e=n.prototype;return e.modifier=function(i,r,s){this.mSet=this.mSet||this.set,this.set=v8,this.m=i,this.mt=s,this.tween=r},n}();Pr(zw+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(n){return Ow[n]=1});Qr.TweenMax=Qr.TweenLite=si;Qr.TimelineLite=Qr.TimelineMax=ur;Un=new ur({sortChildren:!1,defaults:Mf,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});Kr.stringFilter=OI;var du=[],u0={},_8=[],H2=0,y8=0,mx=function(e){return(u0[e]||_8).map(function(t){return t()})},_S=function(){var e=Date.now(),t=[];e-H2>2&&(mx("matchMediaInit"),du.forEach(function(i){var r=i.queries,s=i.conditions,o,a,l,f;for(a in r)o=ds.matchMedia(r[a]).matches,o&&(l=1),o!==s[a]&&(s[a]=o,f=1);f&&(i.revert(),l&&t.push(i))}),mx("matchMediaRevert"),t.forEach(function(i){return i.onMatch(i)}),H2=e,mx("matchMedia"))},KI=function(){function n(t,i){this.selector=i&&mS(i),this.data=[],this._r=[],this.isReverted=!1,this.id=y8++,t&&this.add(t)}var e=n.prototype;return e.add=function(i,r,s){qn(i)&&(s=r,r=i,i=qn);var o=this,a=function(){var f=jn,h=o.selector,d;return f&&f!==o&&f.data.push(o),s&&(o.selector=mS(s)),jn=o,d=r.apply(o,arguments),qn(d)&&o._r.push(d),jn=f,o.selector=h,o.isReverted=!1,d};return o.last=a,i===qn?a(o):i?o[i]=a:a},e.ignore=function(i){var r=jn;jn=null,i(this),jn=r},e.getTweens=function(){var i=[];return this.data.forEach(function(r){return r instanceof n?i.push.apply(i,r.getTweens()):r instanceof si&&!(r.parent&&r.parent.data==="nested")&&i.push(r)}),i},e.clear=function(){this._r.length=this.data.length=0},e.kill=function(i,r){var s=this;if(i){var o=this.getTweens();this.data.forEach(function(l){l.data==="isFlip"&&(l.revert(),l.getChildren(!0,!0,!1).forEach(function(f){return o.splice(o.indexOf(f),1)}))}),o.map(function(l){return{g:l.globalTime(0),t:l}}).sort(function(l,f){return f.g-l.g||-1}).forEach(function(l){return l.t.revert(i)}),this.data.forEach(function(l){return l instanceof ur?l.data!=="nested"&&l.kill():!(l instanceof si)&&l.revert&&l.revert(i)}),this._r.forEach(function(l){return l(i,s)}),this.isReverted=!0}else this.data.forEach(function(l){return l.kill&&l.kill()});if(this.clear(),r)for(var a=du.length;a--;)du[a].id===this.id&&du.splice(a,1)},e.revert=function(i){this.kill(i||{})},n}(),x8=function(){function n(t){this.contexts=[],this.scope=t}var e=n.prototype;return e.add=function(i,r,s){Eo(i)||(i={matches:i});var o=new KI(0,s||this.scope),a=o.conditions={},l,f,h;jn&&!o.selector&&(o.selector=jn.selector),this.contexts.push(o),r=o.add("onMatch",r),o.queries=i;for(f in i)f==="all"?h=1:(l=ds.matchMedia(i[f]),l&&(du.indexOf(o)<0&&du.push(o),(a[f]=l.matches)&&(h=1),l.addListener?l.addListener(_S):l.addEventListener("change",_S)));return h&&r(o),this},e.revert=function(i){this.kill(i||{})},e.kill=function(i){this.contexts.forEach(function(r){return r.kill(i,!0)})},n}(),K0={registerPlugin:function(){for(var e=arguments.length,t=new Array(e),i=0;i1){var r=e.map(function(h){return Ir.quickSetter(h,t,i)}),s=r.length;return function(h){for(var d=s;d--;)r[d](h)}}e=e[0]||{};var o=Gr[t],a=cu(e),l=a.harness&&(a.harness.aliases||{})[t]||t,f=o?function(h){var d=new o;Yc._pt=0,d.init(e,i?h+i:h,Yc,0,[e]),d.render(1,d),Yc._pt&&Xw(1,Yc)}:a.set(e,l);return o?f:function(h){return f(e,l,i?h+i:h,a,1)}},quickTo:function(e,t,i){var r,s=Ir.to(e,Cu((r={},r[t]="+=0.1",r.paused=!0,r),i||{})),o=function(l,f,h){return s.resetTo(t,l,f,h)};return o.tween=s,o},isTweening:function(e){return Un.getTweensOf(e,!0).length>0},defaults:function(e){return e&&e.ease&&(e.ease=hu(e.ease,Mf.ease)),U2(Mf,e||{})},config:function(e){return U2(Kr,e||{})},registerEffect:function(e){var t=e.name,i=e.effect,r=e.plugins,s=e.defaults,o=e.extendTimeline;(r||"").split(",").forEach(function(a){return a&&!Gr[a]&&!Qr[a]&&Y0(t+" effect requires "+a+" plugin.")}),fx[t]=function(a,l,f){return i(Ms(a),Ls(l||{},s),f)},o&&(ur.prototype[t]=function(a,l,f){return this.add(fx[t](a,Eo(l)?l:(f=l)&&{},this),f)})},registerEase:function(e,t){Qt[e]=hu(t)},parseEase:function(e,t){return arguments.length?hu(e,t):Qt},getById:function(e){return Un.getById(e)},exportRoot:function(e,t){e===void 0&&(e={});var i=new ur(e),r,s;for(i.smoothChildTiming=br(e.smoothChildTiming),Un.remove(i),i._dp=0,i._time=i._tTime=Un._time,r=Un._first;r;)s=r._next,(t||!(!r._dur&&r instanceof si&&r.vars.onComplete===r._targets[0]))&&po(i,r,r._start-r._delay),r=s;return po(Un,i,0),i},context:function(e,t){return e?new KI(e,t):jn},matchMedia:function(e){return new x8(e)},matchMediaRefresh:function(){return du.forEach(function(e){var t=e.conditions,i,r;for(r in t)t[r]&&(t[r]=!1,i=1);i&&e.revert()})||_S()},addEventListener:function(e,t){var i=u0[e]||(u0[e]=[]);~i.indexOf(t)||i.push(t)},removeEventListener:function(e,t){var i=u0[e],r=i&&i.indexOf(t);r>=0&&i.splice(r,1)},utils:{wrap:Q6,wrapYoyo:$6,distribute:bI,random:LI,snap:PI,normalize:J6,getUnit:Yi,clamp:j6,splitColor:UI,toArray:Ms,selector:mS,mapRange:DI,pipe:Z6,unitize:K6,interpolate:e8,shuffle:RI},install:gI,effects:fx,ticker:Wr,updateRoot:ur.updateRoot,plugins:Gr,globalTimeline:Un,core:{PropTween:Lr,globals:vI,Tween:si,Timeline:ur,Animation:$d,getCache:cu,_removeLinkedListItem:Ov,reverting:function(){return Zi},context:function(e){return e&&jn&&(jn.data.push(e),e._ctx=jn),jn},suppressOverwrites:function(e){return Dw=e}}};Pr("to,from,fromTo,delayedCall,set,killTweensOf",function(n){return K0[n]=si[n]});Wr.add(ur.updateRoot);Yc=K0.to({},{duration:0});var S8=function(e,t){for(var i=e._pt;i&&i.p!==t&&i.op!==t&&i.fp!==t;)i=i._next;return i},M8=function(e,t){var i=e._targets,r,s,o;for(r in t)for(s=i.length;s--;)o=e._ptLookup[s][r],o&&(o=o.d)&&(o._pt&&(o=S8(o,r)),o&&o.modifier&&o.modifier(t[r],e,i[s],r))},gx=function(e,t){return{name:e,rawVars:1,init:function(r,s,o){o._onInit=function(a){var l,f;if(Ei(s)&&(l={},Pr(s,function(h){return l[h]=1}),s=l),t){l={};for(f in s)l[f]=t(s[f]);s=l}M8(a,s)}}}},Ir=K0.registerPlugin({name:"attr",init:function(e,t,i,r,s){var o,a,l;this.tween=i;for(o in t)l=e.getAttribute(o)||"",a=this.add(e,"setAttribute",(l||0)+"",t[o],r,s,0,0,o),a.op=o,a.b=l,this._props.push(o)},render:function(e,t){for(var i=t._pt;i;)Zi?i.set(i.t,i.p,i.b,i):i.r(e,i.d),i=i._next}},{name:"endArray",init:function(e,t){for(var i=t.length;i--;)this.add(e,i,e[i]||0,t[i],0,0,0,0,0,1)}},gx("roundProps",gS),gx("modifiers"),gx("snap",PI))||K0;si.version=ur.version=Ir.version="3.12.1";mI=1;Fw()&&Tf();Qt.Power0;Qt.Power1;Qt.Power2;Qt.Power3;Qt.Power4;Qt.Linear;Qt.Quad;Qt.Cubic;Qt.Quart;Qt.Quint;Qt.Strong;Qt.Elastic;Qt.Back;Qt.SteppedEase;Qt.Bounce;Qt.Sine;Qt.Expo;Qt.Circ;/*! * CSSPlugin 3.12.1 * https://greensock.com * * Copyright 2008-2023, GreenSock. All rights reserved. * Subject to the terms at https://greensock.com/standard-license or for * Club GreenSock members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com */var V2,za,sf,Yw,nu,G2,jw,w8=function(){return typeof window<"u"},ua={},Gl=180/Math.PI,of=Math.PI/180,Sc=Math.atan2,W2=1e8,qw=/([A-Z])/g,E8=/(left|right|width|margin|padding|x)/i,T8=/[\s,\(]\S/,go={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},yS=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},A8=function(e,t){return t.set(t.t,t.p,e===1?t.e:Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},C8=function(e,t){return t.set(t.t,t.p,e?Math.round((t.s+t.c*e)*1e4)/1e4+t.u:t.b,t)},R8=function(e,t){var i=t.s+t.c*e;t.set(t.t,t.p,~~(i+(i<0?-.5:.5))+t.u,t)},JI=function(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)},QI=function(e,t){return t.set(t.t,t.p,e!==1?t.b:t.e,t)},b8=function(e,t,i){return e.style[t]=i},P8=function(e,t,i){return e.style.setProperty(t,i)},L8=function(e,t,i){return e._gsap[t]=i},I8=function(e,t,i){return e._gsap.scaleX=e._gsap.scaleY=i},D8=function(e,t,i,r,s){var o=e._gsap;o.scaleX=o.scaleY=i,o.renderTransform(s,o)},N8=function(e,t,i,r,s){var o=e._gsap;o[t]=i,o.renderTransform(s,o)},On="transform",Zs=On+"Origin",F8=function n(e,t){var i=this,r=this.target,s=r.style;if(e in ua&&s){if(this.tfm=this.tfm||{},e!=="transform")e=go[e]||e,~e.indexOf(",")?e.split(",").forEach(function(o){return i.tfm[o]=Wo(r,o)}):this.tfm[e]=r._gsap.x?r._gsap[e]:Wo(r,e);else return go.transform.split(",").forEach(function(o){return n.call(i,o,t)});if(this.props.indexOf(On)>=0)return;r._gsap.svg&&(this.svgo=r.getAttribute("data-svg-origin"),this.props.push(Zs,t,"")),e=On}(s||t)&&this.props.push(e,t,s[e])},$I=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},U8=function(){var e=this.props,t=this.target,i=t.style,r=t._gsap,s,o;for(s=0;s=0?X2[o]:"")+e},SS=function(){w8()&&window.document&&(V2=window,za=V2.document,sf=za.documentElement,nu=xS("div")||{style:{}},xS("div"),On=Af(On),Zs=On+"Origin",nu.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",tD=!!Af("perspective"),jw=Ir.core.reverting,Yw=1)},vx=function n(e){var t=xS("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=this.parentNode,r=this.nextSibling,s=this.style.cssText,o;if(sf.appendChild(t),t.appendChild(this),this.style.display="block",e)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=n}catch{}else this._gsapBBox&&(o=this._gsapBBox());return i&&(r?i.insertBefore(this,r):i.appendChild(this)),sf.removeChild(t),this.style.cssText=s,o},Y2=function(e,t){for(var i=t.length;i--;)if(e.hasAttribute(t[i]))return e.getAttribute(t[i])},nD=function(e){var t;try{t=e.getBBox()}catch{t=vx.call(e,!0)}return t&&(t.width||t.height)||e.getBBox===vx||(t=vx.call(e,!0)),t&&!t.width&&!t.x&&!t.y?{x:+Y2(e,["x","cx","x1"])||0,y:+Y2(e,["y","cy","y1"])||0,width:0,height:0}:t},iD=function(e){return!!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&nD(e))},ep=function(e,t){if(t){var i=e.style;t in ua&&t!==Zs&&(t=On),i.removeProperty?((t.substr(0,2)==="ms"||t.substr(0,6)==="webkit")&&(t="-"+t),i.removeProperty(t.replace(qw,"-$1").toLowerCase())):i.removeAttribute(t)}},Ba=function(e,t,i,r,s,o){var a=new Lr(e._pt,t,i,0,1,o?QI:JI);return e._pt=a,a.b=r,a.e=s,e._props.push(i),a},j2={deg:1,rad:1,turn:1},k8={grid:1,flex:1},cl=function n(e,t,i,r){var s=parseFloat(i)||0,o=(i+"").trim().substr((s+"").length)||"px",a=nu.style,l=E8.test(t),f=e.tagName.toLowerCase()==="svg",h=(f?"client":"offset")+(l?"Width":"Height"),d=100,p=r==="px",m=r==="%",_,x,y,g;return r===o||!s||j2[r]||j2[o]?s:(o!=="px"&&!p&&(s=n(e,t,i,"px")),g=e.getCTM&&iD(e),(m||o==="%")&&(ua[t]||~t.indexOf("adius"))?(_=g?e.getBBox()[l?"width":"height"]:e[h],Qn(m?s/_*d:s/100*_)):(a[l?"width":"height"]=d+(p?o:r),x=~t.indexOf("adius")||r==="em"&&e.appendChild&&!f?e:e.parentNode,g&&(x=(e.ownerSVGElement||{}).parentNode),(!x||x===za||!x.appendChild)&&(x=za.body),y=x._gsap,y&&m&&y.width&&l&&y.time===Wr.time&&!y.uncache?Qn(s/y.width*d):((m||o==="%")&&!k8[So(x,"display")]&&(a.position=So(e,"position")),x===e&&(a.position="static"),x.appendChild(nu),_=nu[h],x.removeChild(nu),a.position="absolute",l&&m&&(y=cu(x),y.time=Wr.time,y.width=x[h]),Qn(p?_*s/d:_&&s?d/_*s:0))))},Wo=function(e,t,i,r){var s;return Yw||SS(),t in go&&t!=="transform"&&(t=go[t],~t.indexOf(",")&&(t=t.split(",")[0])),ua[t]&&t!=="transform"?(s=np(e,r),s=t!=="transformOrigin"?s[t]:s.svg?s.origin:Q0(So(e,Zs))+" "+s.zOrigin+"px"):(s=e.style[t],(!s||s==="auto"||r||~(s+"").indexOf("calc("))&&(s=J0[t]&&J0[t](e,t,i)||So(e,t)||yI(e,t)||(t==="opacity"?1:0))),i&&!~(s+"").trim().indexOf(" ")?cl(e,t,s,i)+i:s},O8=function(e,t,i,r){if(!i||i==="none"){var s=Af(t,e,1),o=s&&So(e,s,1);o&&o!==i?(t=s,i=o):t==="borderColor"&&(i=So(e,"borderTopColor"))}var a=new Lr(this._pt,e.style,t,0,1,qI),l=0,f=0,h,d,p,m,_,x,y,g,M,S,E,C;if(a.b=i,a.e=r,i+="",r+="",r==="auto"&&(e.style[t]=r,r=So(e,t)||r,e.style[t]=i),h=[i,r],OI(h),i=h[0],r=h[1],p=i.match(Xc)||[],C=r.match(Xc)||[],C.length){for(;d=Xc.exec(r);)y=d[0],M=r.substring(l,d.index),_?_=(_+1)%5:(M.substr(-5)==="rgba("||M.substr(-5)==="hsla(")&&(_=1),y!==(x=p[f++]||"")&&(m=parseFloat(x)||0,E=x.substr((m+"").length),y.charAt(1)==="="&&(y=rf(m,y)+E),g=parseFloat(y),S=y.substr((g+"").length),l=Xc.lastIndex-S.length,S||(S=S||Kr.units[t]||E,l===r.length&&(r+=S,a.e+=S)),E!==S&&(m=cl(e,t,x,S)||0),a._pt={_next:a._pt,p:M||f===1?M:",",s:m,c:g-m,m:_&&_<4||t==="zIndex"?Math.round:0});a.c=l-1;)a=s[f],ua[a]&&(l=1,a=a==="transformOrigin"?Zs:On),ep(i,a);l&&(ep(i,On),o&&(o.svg&&i.removeAttribute("transform"),np(i,1),o.uncache=1,$I(r)))}},J0={clearProps:function(e,t,i,r,s){if(s.data!=="isFromStart"){var o=e._pt=new Lr(e._pt,t,i,0,0,B8);return o.u=r,o.pr=-10,o.tween=s,e._props.push(i),1}}},tp=[1,0,0,1,0,0],rD={},sD=function(e){return e==="matrix(1, 0, 0, 1, 0, 0)"||e==="none"||!e},Z2=function(e){var t=So(e,On);return sD(t)?tp:t.substr(7).match(hI).map(Qn)},Zw=function(e,t){var i=e._gsap||cu(e),r=e.style,s=Z2(e),o,a,l,f;return i.svg&&e.getAttribute("transform")?(l=e.transform.baseVal.consolidate().matrix,s=[l.a,l.b,l.c,l.d,l.e,l.f],s.join(",")==="1,0,0,1,0,0"?tp:s):(s===tp&&!e.offsetParent&&e!==sf&&!i.svg&&(l=r.display,r.display="block",o=e.parentNode,(!o||!e.offsetParent)&&(f=1,a=e.nextElementSibling,sf.appendChild(e)),s=Z2(e),l?r.display=l:ep(e,"display"),f&&(a?o.insertBefore(e,a):o?o.appendChild(e):sf.removeChild(e))),t&&s.length>6?[s[0],s[1],s[4],s[5],s[12],s[13]]:s)},MS=function(e,t,i,r,s,o){var a=e._gsap,l=s||Zw(e,!0),f=a.xOrigin||0,h=a.yOrigin||0,d=a.xOffset||0,p=a.yOffset||0,m=l[0],_=l[1],x=l[2],y=l[3],g=l[4],M=l[5],S=t.split(" "),E=parseFloat(S[0])||0,C=parseFloat(S[1])||0,R,P,D,b;i?l!==tp&&(P=m*y-_*x)&&(D=E*(y/P)+C*(-x/P)+(x*M-y*g)/P,b=E*(-_/P)+C*(m/P)-(m*M-_*g)/P,E=D,C=b):(R=nD(e),E=R.x+(~S[0].indexOf("%")?E/100*R.width:E),C=R.y+(~(S[1]||S[0]).indexOf("%")?C/100*R.height:C)),r||r!==!1&&a.smooth?(g=E-f,M=C-h,a.xOffset=d+(g*m+M*x)-g,a.yOffset=p+(g*_+M*y)-M):a.xOffset=a.yOffset=0,a.xOrigin=E,a.yOrigin=C,a.smooth=!!r,a.origin=t,a.originIsAbsolute=!!i,e.style[Zs]="0px 0px",o&&(Ba(o,a,"xOrigin",f,E),Ba(o,a,"yOrigin",h,C),Ba(o,a,"xOffset",d,a.xOffset),Ba(o,a,"yOffset",p,a.yOffset)),e.setAttribute("data-svg-origin",E+" "+C)},np=function(e,t){var i=e._gsap||new VI(e);if("x"in i&&!t&&!i.uncache)return i;var r=e.style,s=i.scaleX<0,o="px",a="deg",l=getComputedStyle(e),f=So(e,Zs)||"0",h,d,p,m,_,x,y,g,M,S,E,C,R,P,D,b,I,z,q,J,Q,ee,oe,$,k,G,F,re,j,ve,le,Pe;return h=d=p=x=y=g=M=S=E=0,m=_=1,i.svg=!!(e.getCTM&&iD(e)),l.translate&&((l.translate!=="none"||l.scale!=="none"||l.rotate!=="none")&&(r[On]=(l.translate!=="none"?"translate3d("+(l.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(l.rotate!=="none"?"rotate("+l.rotate+") ":"")+(l.scale!=="none"?"scale("+l.scale.split(" ").join(",")+") ":"")+(l[On]!=="none"?l[On]:"")),r.scale=r.rotate=r.translate="none"),P=Zw(e,i.svg),i.svg&&(i.uncache?(k=e.getBBox(),f=i.xOrigin-k.x+"px "+(i.yOrigin-k.y)+"px",$=""):$=!t&&e.getAttribute("data-svg-origin"),MS(e,$||f,!!$||i.originIsAbsolute,i.smooth!==!1,P)),C=i.xOrigin||0,R=i.yOrigin||0,P!==tp&&(z=P[0],q=P[1],J=P[2],Q=P[3],h=ee=P[4],d=oe=P[5],P.length===6?(m=Math.sqrt(z*z+q*q),_=Math.sqrt(Q*Q+J*J),x=z||q?Sc(q,z)*Gl:0,M=J||Q?Sc(J,Q)*Gl+x:0,M&&(_*=Math.abs(Math.cos(M*of))),i.svg&&(h-=C-(C*z+R*J),d-=R-(C*q+R*Q))):(Pe=P[6],ve=P[7],F=P[8],re=P[9],j=P[10],le=P[11],h=P[12],d=P[13],p=P[14],D=Sc(Pe,j),y=D*Gl,D&&(b=Math.cos(-D),I=Math.sin(-D),$=ee*b+F*I,k=oe*b+re*I,G=Pe*b+j*I,F=ee*-I+F*b,re=oe*-I+re*b,j=Pe*-I+j*b,le=ve*-I+le*b,ee=$,oe=k,Pe=G),D=Sc(-J,j),g=D*Gl,D&&(b=Math.cos(-D),I=Math.sin(-D),$=z*b-F*I,k=q*b-re*I,G=J*b-j*I,le=Q*I+le*b,z=$,q=k,J=G),D=Sc(q,z),x=D*Gl,D&&(b=Math.cos(D),I=Math.sin(D),$=z*b+q*I,k=ee*b+oe*I,q=q*b-z*I,oe=oe*b-ee*I,z=$,ee=k),y&&Math.abs(y)+Math.abs(x)>359.9&&(y=x=0,g=180-g),m=Qn(Math.sqrt(z*z+q*q+J*J)),_=Qn(Math.sqrt(oe*oe+Pe*Pe)),D=Sc(ee,oe),M=Math.abs(D)>2e-4?D*Gl:0,E=le?1/(le<0?-le:le):0),i.svg&&($=e.getAttribute("transform"),i.forceCSS=e.setAttribute("transform","")||!sD(So(e,On)),$&&e.setAttribute("transform",$))),Math.abs(M)>90&&Math.abs(M)<270&&(s?(m*=-1,M+=x<=0?180:-180,x+=x<=0?180:-180):(_*=-1,M+=M<=0?180:-180)),t=t||i.uncache,i.x=h-((i.xPercent=h&&(!t&&i.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-h)?-50:0)))?e.offsetWidth*i.xPercent/100:0)+o,i.y=d-((i.yPercent=d&&(!t&&i.yPercent||(Math.round(e.offsetHeight/2)===Math.round(-d)?-50:0)))?e.offsetHeight*i.yPercent/100:0)+o,i.z=p+o,i.scaleX=Qn(m),i.scaleY=Qn(_),i.rotation=Qn(x)+a,i.rotationX=Qn(y)+a,i.rotationY=Qn(g)+a,i.skewX=M+a,i.skewY=S+a,i.transformPerspective=E+o,(i.zOrigin=parseFloat(f.split(" ")[2])||0)&&(r[Zs]=Q0(f)),i.xOffset=i.yOffset=0,i.force3D=Kr.force3D,i.renderTransform=i.svg?V8:tD?oD:H8,i.uncache=0,i},Q0=function(e){return(e=e.split(" "))[0]+" "+e[1]},_x=function(e,t,i){var r=Yi(t);return Qn(parseFloat(t)+parseFloat(cl(e,"x",i+"px",r)))+r},H8=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,oD(e,t)},Ol="0deg",Ch="0px",zl=") ",oD=function(e,t){var i=t||this,r=i.xPercent,s=i.yPercent,o=i.x,a=i.y,l=i.z,f=i.rotation,h=i.rotationY,d=i.rotationX,p=i.skewX,m=i.skewY,_=i.scaleX,x=i.scaleY,y=i.transformPerspective,g=i.force3D,M=i.target,S=i.zOrigin,E="",C=g==="auto"&&e&&e!==1||g===!0;if(S&&(d!==Ol||h!==Ol)){var R=parseFloat(h)*of,P=Math.sin(R),D=Math.cos(R),b;R=parseFloat(d)*of,b=Math.cos(R),o=_x(M,o,P*b*-S),a=_x(M,a,-Math.sin(R)*-S),l=_x(M,l,D*b*-S+S)}y!==Ch&&(E+="perspective("+y+zl),(r||s)&&(E+="translate("+r+"%, "+s+"%) "),(C||o!==Ch||a!==Ch||l!==Ch)&&(E+=l!==Ch||C?"translate3d("+o+", "+a+", "+l+") ":"translate("+o+", "+a+zl),f!==Ol&&(E+="rotate("+f+zl),h!==Ol&&(E+="rotateY("+h+zl),d!==Ol&&(E+="rotateX("+d+zl),(p!==Ol||m!==Ol)&&(E+="skew("+p+", "+m+zl),(_!==1||x!==1)&&(E+="scale("+_+", "+x+zl),M.style[On]=E||"translate(0, 0)"},V8=function(e,t){var i=t||this,r=i.xPercent,s=i.yPercent,o=i.x,a=i.y,l=i.rotation,f=i.skewX,h=i.skewY,d=i.scaleX,p=i.scaleY,m=i.target,_=i.xOrigin,x=i.yOrigin,y=i.xOffset,g=i.yOffset,M=i.forceCSS,S=parseFloat(o),E=parseFloat(a),C,R,P,D,b;l=parseFloat(l),f=parseFloat(f),h=parseFloat(h),h&&(h=parseFloat(h),f+=h,l+=h),l||f?(l*=of,f*=of,C=Math.cos(l)*d,R=Math.sin(l)*d,P=Math.sin(l-f)*-p,D=Math.cos(l-f)*p,f&&(h*=of,b=Math.tan(f-h),b=Math.sqrt(1+b*b),P*=b,D*=b,h&&(b=Math.tan(h),b=Math.sqrt(1+b*b),C*=b,R*=b)),C=Qn(C),R=Qn(R),P=Qn(P),D=Qn(D)):(C=d,D=p,R=P=0),(S&&!~(o+"").indexOf("px")||E&&!~(a+"").indexOf("px"))&&(S=cl(m,"x",o,"px"),E=cl(m,"y",a,"px")),(_||x||y||g)&&(S=Qn(S+_-(_*C+x*P)+y),E=Qn(E+x-(_*R+x*D)+g)),(r||s)&&(b=m.getBBox(),S=Qn(S+r/100*b.width),E=Qn(E+s/100*b.height)),b="matrix("+C+","+R+","+P+","+D+","+S+","+E+")",m.setAttribute("transform",b),M&&(m.style[On]=b)},G8=function(e,t,i,r,s){var o=360,a=Ei(s),l=parseFloat(s)*(a&&~s.indexOf("rad")?Gl:1),f=l-r,h=r+f+"deg",d,p;return a&&(d=s.split("_")[1],d==="short"&&(f%=o,f!==f%(o/2)&&(f+=f<0?o:-o)),d==="cw"&&f<0?f=(f+o*W2)%o-~~(f/o)*o:d==="ccw"&&f>0&&(f=(f-o*W2)%o-~~(f/o)*o)),e._pt=p=new Lr(e._pt,t,i,r,f,A8),p.e=h,p.u="deg",e._props.push(i),p},K2=function(e,t){for(var i in t)e[i]=t[i];return e},W8=function(e,t,i){var r=K2({},i._gsap),s="perspective,force3D,transformOrigin,svgOrigin",o=i.style,a,l,f,h,d,p,m,_;r.svg?(f=i.getAttribute("transform"),i.setAttribute("transform",""),o[On]=t,a=np(i,1),ep(i,On),i.setAttribute("transform",f)):(f=getComputedStyle(i)[On],o[On]=t,a=np(i,1),o[On]=f);for(l in ua)f=r[l],h=a[l],f!==h&&s.indexOf(l)<0&&(m=Yi(f),_=Yi(h),d=m!==_?cl(i,l,f,_):parseFloat(f),p=parseFloat(h),e._pt=new Lr(e._pt,a,l,d,p-d,yS),e._pt.u=_||0,e._props.push(l));K2(a,r)};Pr("padding,margin,Width,Radius",function(n,e){var t="Top",i="Right",r="Bottom",s="Left",o=(e<3?[t,i,r,s]:[t+s,t+i,r+i,r+s]).map(function(a){return e<2?n+a:"border"+a+n});J0[e>1?"border"+n:n]=function(a,l,f,h,d){var p,m;if(arguments.length<4)return p=o.map(function(_){return Wo(a,_,f)}),m=p.join(" "),m.split(p[0]).length===5?p[0]:m;p=(h+"").split(" "),m={},o.forEach(function(_,x){return m[_]=p[x]=p[x]||p[(x-1)/2|0]}),a.init(l,m,d)}});var aD={name:"css",register:SS,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,i,r,s){var o=this._props,a=e.style,l=i.vars.startAt,f,h,d,p,m,_,x,y,g,M,S,E,C,R,P,D;Yw||SS(),this.styles=this.styles||eD(e),D=this.styles.props,this.tween=i;for(x in t)if(x!=="autoRound"&&(h=t[x],!(Gr[x]&&GI(x,t,i,r,e,s)))){if(m=typeof h,_=J0[x],m==="function"&&(h=h.call(i,r,e,s),m=typeof h),m==="string"&&~h.indexOf("random(")&&(h=Jd(h)),_)_(this,e,x,h,i)&&(P=1);else if(x.substr(0,2)==="--")f=(getComputedStyle(e).getPropertyValue(x)+"").trim(),h+="",nl.lastIndex=0,nl.test(f)||(y=Yi(f),g=Yi(h)),g?y!==g&&(f=cl(e,x,f,g)+g):y&&(h+=y),this.add(a,"setProperty",f,h,r,s,0,0,x),o.push(x),D.push(x,0,a[x]);else if(m!=="undefined"){if(l&&x in l?(f=typeof l[x]=="function"?l[x].call(i,r,e,s):l[x],Ei(f)&&~f.indexOf("random(")&&(f=Jd(f)),Yi(f+"")||(f+=Kr.units[x]||Yi(Wo(e,x))||""),(f+"").charAt(1)==="="&&(f=Wo(e,x))):f=Wo(e,x),p=parseFloat(f),M=m==="string"&&h.charAt(1)==="="&&h.substr(0,2),M&&(h=h.substr(2)),d=parseFloat(h),x in go&&(x==="autoAlpha"&&(p===1&&Wo(e,"visibility")==="hidden"&&d&&(p=0),D.push("visibility",0,a.visibility),Ba(this,a,"visibility",p?"inherit":"hidden",d?"inherit":"hidden",!d)),x!=="scale"&&x!=="transform"&&(x=go[x],~x.indexOf(",")&&(x=x.split(",")[0]))),S=x in ua,S){if(this.styles.save(x),E||(C=e._gsap,C.renderTransform&&!t.parseTransform||np(e,t.parseTransform),R=t.smoothOrigin!==!1&&C.smooth,E=this._pt=new Lr(this._pt,a,On,0,1,C.renderTransform,C,0,-1),E.dep=1),x==="scale")this._pt=new Lr(this._pt,C,"scaleY",C.scaleY,(M?rf(C.scaleY,M+d):d)-C.scaleY||0,yS),this._pt.u=0,o.push("scaleY",x),x+="X";else if(x==="transformOrigin"){D.push(Zs,0,a[Zs]),h=z8(h),C.svg?MS(e,h,0,R,0,this):(g=parseFloat(h.split(" ")[2])||0,g!==C.zOrigin&&Ba(this,C,"zOrigin",C.zOrigin,g),Ba(this,a,x,Q0(f),Q0(h)));continue}else if(x==="svgOrigin"){MS(e,h,1,R,0,this);continue}else if(x in rD){G8(this,C,x,p,M?rf(p,M+h):h);continue}else if(x==="smoothOrigin"){Ba(this,C,"smooth",C.smooth,h);continue}else if(x==="force3D"){C[x]=h;continue}else if(x==="transform"){W8(this,h,e);continue}}else x in a||(x=Af(x)||x);if(S||(d||d===0)&&(p||p===0)&&!T8.test(h)&&x in a)y=(f+"").substr((p+"").length),d||(d=0),g=Yi(h)||(x in Kr.units?Kr.units[x]:y),y!==g&&(p=cl(e,x,f,g)),this._pt=new Lr(this._pt,S?C:a,x,p,(M?rf(p,M+d):d)-p,!S&&(g==="px"||x==="zIndex")&&t.autoRound!==!1?R8:yS),this._pt.u=g||0,y!==g&&g!=="%"&&(this._pt.b=f,this._pt.r=C8);else if(x in a)O8.call(this,e,x,f,M?M+h:h);else if(x in e)this.add(e,x,f||e[x],M?M+h:h,r,s);else if(x!=="parseTransform"){kw(x,h);continue}S||(x in a?D.push(x,0,a[x]):D.push(x,1,f||e[x])),o.push(x)}}P&&ZI(this)},render:function(e,t){if(t.tween._time||!jw())for(var i=t._pt;i;)i.r(e,i.d),i=i._next;else t.styles.revert()},get:Wo,aliases:go,getSetter:function(e,t,i){var r=go[t];return r&&r.indexOf(",")<0&&(t=r),t in ua&&t!==Zs&&(e._gsap.x||Wo(e,"x"))?i&&G2===i?t==="scale"?I8:L8:(G2=i||{})&&(t==="scale"?D8:N8):e.style&&!Nw(e.style[t])?b8:~t.indexOf("-")?P8:Ww(e,t)},core:{_removeProperty:ep,_getMatrix:Zw}};Ir.utils.checkPrefix=Af;Ir.core.getStyleSaver=eD;(function(n,e,t,i){var r=Pr(n+","+e+","+t,function(s){ua[s]=1});Pr(e,function(s){Kr.units[s]="deg",rD[s]=1}),go[r[13]]=n+","+e,Pr(i,function(s){var o=s.split(":");go[o[1]]=r[o[0]]})})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");Pr("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(n){Kr.units[n]="px"});Ir.registerPlugin(aD);var En=Ir.registerPlugin(aD)||Ir;En.core.Tween;function J2(n,e){for(var t=0;tl?(s=r,r=_,a=o,o=y):i?r+=_:r=s+(_-s)/(y-a)*(o-a)},d=function(){s=r=i?0:r,a=o=0},p=function(_){var x=a,y=s,g=ad();return(_||_===0)&&_!==r&&h(_),o===a||g-a>f?0:(r+(i?y:-y))/((i?g:o)-x)*1e3};return{update:h,reset:d,getVelocity:p}},Rh=function(e,t){return t&&!e._gsapAllow&&e.preventDefault(),e.changedTouches?e.changedTouches[0]:e},Q2=function(e){var t=Math.max.apply(Math,e),i=Math.min.apply(Math,e);return Math.abs(t)>=Math.abs(i)?t:i},dD=function(){od=Li.core.globals().ScrollTrigger,od&&od.core&&Y8()},pD=function(e){return Li=e||fD(),Li&&typeof document<"u"&&document.body&&(Xr=window,Ha=document,Va=Ha.documentElement,af=Ha.body,uD=[Xr,Ha,Va,af],Li.utils.clamp,cD=Li.core.context||function(){},Wl="onpointerenter"in af?"pointer":"mouse",lD=ai.isTouch=Xr.matchMedia&&Xr.matchMedia("(hover: none), (pointer: coarse)").matches?1:"ontouchstart"in Xr||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0?2:0,zs=ai.eventTypes=("ontouchstart"in Va?"touchstart,touchmove,touchcancel,touchend":"onpointerdown"in Va?"pointerdown,pointermove,pointercancel,pointerup":"mousedown,mousemove,mouseup,mouseup").split(","),setTimeout(function(){return hD=0},500),dD(),wS=1),wS};cr.op=ci;qt.cache=0;var ai=function(){function n(t){this.init(t)}var e=n.prototype;return e.init=function(i){wS||pD(Li)||console.warn("Please gsap.registerPlugin(Observer)"),od||dD();var r=i.tolerance,s=i.dragMinimum,o=i.type,a=i.target,l=i.lineHeight,f=i.debounce,h=i.preventDefault,d=i.onStop,p=i.onStopDelay,m=i.ignore,_=i.wheelSpeed,x=i.event,y=i.onDragStart,g=i.onDragEnd,M=i.onDrag,S=i.onPress,E=i.onRelease,C=i.onRight,R=i.onLeft,P=i.onUp,D=i.onDown,b=i.onChangeX,I=i.onChangeY,z=i.onChange,q=i.onToggleX,J=i.onToggleY,Q=i.onHover,ee=i.onHoverEnd,oe=i.onMove,$=i.ignoreCheck,k=i.isNormalizer,G=i.onGestureStart,F=i.onGestureEnd,re=i.onWheel,j=i.onEnable,ve=i.onDisable,le=i.onClick,Pe=i.scrollSpeed,_e=i.capture,Re=i.allowClicks,nt=i.lockAxis,it=i.onLockAxis;this.target=a=Sr(a)||Va,this.vars=i,m&&(m=Li.utils.toArray(m)),r=r||1e-9,s=s||0,_=_||1,Pe=Pe||1,o=o||"wheel,touch,pointer",f=f!==!1,l||(l=parseFloat(Xr.getComputedStyle(af).lineHeight)||22);var Pt,Ze,Z,we,ye,Ie,Ae,te=this,He=0,Ye=0,mt=fl(a,cr),dt=fl(a,ci),$t=mt(),W=dt(),O=~o.indexOf("touch")&&!~o.indexOf("pointer")&&zs[0]==="pointerdown",de=ld(a),Ce=a.ownerDocument||Ha,Le=[0,0,0],Ue=[0,0,0],tt=0,Oe=function(){return tt=ad()},Me=function(We,Ct){return(te.event=We)&&m&&~m.indexOf(We.target)||Ct&&O&&We.pointerType!=="touch"||$&&$(We,Ct)},rt=function(){te._vx.reset(),te._vy.reset(),Ze.pause(),d&&d(te)},ot=function(){var We=te.deltaX=Q2(Le),Ct=te.deltaY=Q2(Ue),Ut=Math.abs(We)>=r,$e=Math.abs(Ct)>=r;z&&(Ut||$e)&&z(te,We,Ct,Le,Ue),Ut&&(C&&te.deltaX>0&&C(te),R&&te.deltaX<0&&R(te),b&&b(te),q&&te.deltaX<0!=He<0&&q(te),He=te.deltaX,Le[0]=Le[1]=Le[2]=0),$e&&(D&&te.deltaY>0&&D(te),P&&te.deltaY<0&&P(te),I&&I(te),J&&te.deltaY<0!=Ye<0&&J(te),Ye=te.deltaY,Ue[0]=Ue[1]=Ue[2]=0),(we||Z)&&(oe&&oe(te),Z&&(M(te),Z=!1),we=!1),Ie&&!(Ie=!1)&&it&&it(te),ye&&(re(te),ye=!1),Pt=0},Je=function(We,Ct,Ut){Le[Ut]+=We,Ue[Ut]+=Ct,te._vx.update(We),te._vy.update(Ct),f?Pt||(Pt=requestAnimationFrame(ot)):ot()},Qe=function(We,Ct){nt&&!Ae&&(te.axis=Ae=Math.abs(We)>Math.abs(Ct)?"x":"y",Ie=!0),Ae!=="y"&&(Le[2]+=We,te._vx.update(We,!0)),Ae!=="x"&&(Ue[2]+=Ct,te._vy.update(Ct,!0)),f?Pt||(Pt=requestAnimationFrame(ot)):ot()},je=function(We){if(!Me(We,1)){We=Rh(We,h);var Ct=We.clientX,Ut=We.clientY,$e=Ct-te.x,Ot=Ut-te.y,xt=te.isDragging;te.x=Ct,te.y=Ut,(xt||Math.abs(te.startX-Ct)>=s||Math.abs(te.startY-Ut)>=s)&&(M&&(Z=!0),xt||(te.isDragging=!0),Qe($e,Ot),xt||y&&y(te))}},ft=te.onPress=function(St){Me(St,1)||St&&St.button||(te.axis=Ae=null,Ze.pause(),te.isPressed=!0,St=Rh(St),He=Ye=0,te.startX=te.x=St.clientX,te.startY=te.y=St.clientY,te._vx.reset(),te._vy.reset(),yr(k?a:Ce,zs[1],je,h,!0),te.deltaX=te.deltaY=0,S&&S(te))},Mt=te.onRelease=function(St){if(!Me(St,1)){nr(k?a:Ce,zs[1],je,!0);var We=!isNaN(te.y-te.startY),Ct=te.isDragging&&(Math.abs(te.x-te.startX)>3||Math.abs(te.y-te.startY)>3),Ut=Rh(St);!Ct&&We&&(te._vx.reset(),te._vy.reset(),h&&Re&&Li.delayedCall(.08,function(){if(ad()-tt>300&&!St.defaultPrevented){if(St.target.click)St.target.click();else if(Ce.createEvent){var $e=Ce.createEvent("MouseEvents");$e.initMouseEvent("click",!0,!0,Xr,1,Ut.screenX,Ut.screenY,Ut.clientX,Ut.clientY,!1,!1,!1,!1,0,null),St.target.dispatchEvent($e)}}})),te.isDragging=te.isGesturing=te.isPressed=!1,d&&!k&&Ze.restart(!0),g&&Ct&&g(te),E&&E(te,Ct)}},K=function(We){return We.touches&&We.touches.length>1&&(te.isGesturing=!0)&&G(We,te.isDragging)},he=function(){return(te.isGesturing=!1)||F(te)},ce=function(We){if(!Me(We)){var Ct=mt(),Ut=dt();Je((Ct-$t)*Pe,(Ut-W)*Pe,1),$t=Ct,W=Ut,d&&Ze.restart(!0)}},Ne=function(We){if(!Me(We)){We=Rh(We,h),re&&(ye=!0);var Ct=(We.deltaMode===1?l:We.deltaMode===2?Xr.innerHeight:1)*_;Je(We.deltaX*Ct,We.deltaY*Ct,0),d&&!k&&Ze.restart(!0)}},Be=function(We){if(!Me(We)){var Ct=We.clientX,Ut=We.clientY,$e=Ct-te.x,Ot=Ut-te.y;te.x=Ct,te.y=Ut,we=!0,($e||Ot)&&Qe($e,Ot)}},bt=function(We){te.event=We,Q(te)},en=function(We){te.event=We,ee(te)},tn=function(We){return Me(We)||Rh(We,h)&&le(te)};Ze=te._dc=Li.delayedCall(p||.25,rt).pause(),te.deltaX=te.deltaY=0,te._vx=AS(0,50,!0),te._vy=AS(0,50,!0),te.scrollX=mt,te.scrollY=dt,te.isDragging=te.isGesturing=te.isPressed=!1,cD(this),te.enable=function(St){return te.isEnabled||(yr(de?Ce:a,"scroll",TS),o.indexOf("scroll")>=0&&yr(de?Ce:a,"scroll",ce,h,_e),o.indexOf("wheel")>=0&&yr(a,"wheel",Ne,h,_e),(o.indexOf("touch")>=0&&lD||o.indexOf("pointer")>=0)&&(yr(a,zs[0],ft,h,_e),yr(Ce,zs[2],Mt),yr(Ce,zs[3],Mt),Re&&yr(a,"click",Oe,!1,!0),le&&yr(a,"click",tn),G&&yr(Ce,"gesturestart",K),F&&yr(Ce,"gestureend",he),Q&&yr(a,Wl+"enter",bt),ee&&yr(a,Wl+"leave",en),oe&&yr(a,Wl+"move",Be)),te.isEnabled=!0,St&&St.type&&ft(St),j&&j(te)),te},te.disable=function(){te.isEnabled&&(jc.filter(function(St){return St!==te&&ld(St.target)}).length||nr(de?Ce:a,"scroll",TS),te.isPressed&&(te._vx.reset(),te._vy.reset(),nr(k?a:Ce,zs[1],je,!0)),nr(de?Ce:a,"scroll",ce,_e),nr(a,"wheel",Ne,_e),nr(a,zs[0],ft,_e),nr(Ce,zs[2],Mt),nr(Ce,zs[3],Mt),nr(a,"click",Oe,!0),nr(a,"click",tn),nr(Ce,"gesturestart",K),nr(Ce,"gestureend",he),nr(a,Wl+"enter",bt),nr(a,Wl+"leave",en),nr(a,Wl+"move",Be),te.isEnabled=te.isPressed=te.isDragging=!1,ve&&ve(te))},te.kill=te.revert=function(){te.disable();var St=jc.indexOf(te);St>=0&&jc.splice(St,1),Jo===te&&(Jo=0)},jc.push(te),k&&ld(a)&&(Jo=te),te.enable(x)},X8(n,[{key:"velocityX",get:function(){return this._vx.getVelocity()}},{key:"velocityY",get:function(){return this._vy.getVelocity()}}]),n}();ai.version="3.12.1";ai.create=function(n){return new ai(n)};ai.register=pD;ai.getAll=function(){return jc.slice()};ai.getById=function(n){return jc.filter(function(e){return e.vars.id===n})[0]};fD()&&Li.registerPlugin(ai);/*! * ScrollTrigger 3.12.1 * https://greensock.com * * @license Copyright 2008-2023, GreenSock. All rights reserved. * Subject to the terms at https://greensock.com/standard-license or for * Club GreenSock members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com */var ct,Ac,Zt,bn,Xs,Nn,mD,ev,tv,qc,c0,Lg,Gi,Hv,CS,sr,$2,eR,Cc,gD,yx,vD,zr,_D,yD,xD,ba,RS,Kw,xx,Ig=1,ar=Date.now,Sx=ar(),As=0,Oh=0,tR=function(e,t,i){var r=Vr(e)&&(e.substr(0,6)==="clamp("||e.indexOf("max")>-1);return i["_"+t+"Clamp"]=r,r?e.substr(6,e.length-7):e},nR=function(e,t){return t&&(!Vr(e)||e.substr(0,6)!=="clamp(")?"clamp("+e+")":e},j8=function n(){return Oh&&requestAnimationFrame(n)},iR=function(){return Hv=1},rR=function(){return Hv=0},fo=function(e){return e},zh=function(e){return Math.round(e*1e5)/1e5||0},SD=function(){return typeof window<"u"},MD=function(){return ct||SD()&&(ct=window.gsap)&&ct.registerPlugin&&ct},Ru=function(e){return!!~mD.indexOf(e)},wD=function(e){return il(e,"getBoundingClientRect")||(Ru(e)?function(){return g0.width=Zt.innerWidth,g0.height=Zt.innerHeight,g0}:function(){return jo(e)})},q8=function(e,t,i){var r=i.d,s=i.d2,o=i.a;return(o=il(e,"getBoundingClientRect"))?function(){return o()[r]}:function(){return(t?Zt["inner"+s]:e["client"+s])||0}},Z8=function(e,t){return!t||~Mo.indexOf(e)?wD(e):function(){return g0}},Qo=function(e,t){var i=t.s,r=t.d2,s=t.d,o=t.a;return Math.max(0,(i="scroll"+r)&&(o=il(e,i))?o()-wD(e)()[s]:Ru(e)?(Xs[i]||Nn[i])-(Zt["inner"+r]||Xs["client"+r]||Nn["client"+r]):e[i]-e["offset"+r])},Dg=function(e,t){for(var i=0;i0){for(r-=o,a=0;a=r)return i[a];return i[a-1]}else for(a=i.length,r+=o;a--;)if(i[a]<=r)return i[a];return i[0]}:function(r,s,o){o===void 0&&(o=.001);var a=t(r);return!s||Math.abs(a-r)i&&(r*=t/100),e=e.substr(0,i-1)),e=r+(e in nv?nv[e]*t:~e.indexOf("%")?parseFloat(e)*t/100:parseFloat(e)||0)}return e},kg=function(e,t,i,r,s,o,a,l){var f=s.startColor,h=s.endColor,d=s.fontSize,p=s.indent,m=s.fontWeight,_=bn.createElement("div"),x=Ru(i)||il(i,"pinType")==="fixed",y=e.indexOf("scroller")!==-1,g=x?Nn:i,M=e.indexOf("start")!==-1,S=M?f:h,E="border-color:"+S+";font-size:"+d+";color:"+S+";font-weight:"+m+";pointer-events:none;white-space:nowrap;font-family:sans-serif,Arial;z-index:1000;padding:4px 8px;border-width:0;border-style:solid;";return E+="position:"+((y||l)&&x?"fixed;":"absolute;"),(y||l||!x)&&(E+=(r===ci?Jw:Qw)+":"+(o+parseFloat(p))+"px;"),a&&(E+="box-sizing:border-box;text-align:left;width:"+a.offsetWidth+"px;"),_._isStart=M,_.setAttribute("class","gsap-marker-"+e+(t?" marker-"+t:"")),_.style.cssText=E,_.innerText=t||t===0?e+"-"+t:e,g.children[0]?g.insertBefore(_,g.children[0]):g.appendChild(_),_._offset=_["offset"+r.op.d2],d0(_,0,r,M),_},d0=function(e,t,i,r){var s={display:"block"},o=i[r?"os2":"p2"],a=i[r?"p2":"os2"];e._isFlipped=r,s[i.a+"Percent"]=r?-100:0,s[i.a]=r?"1px":0,s["border"+o+Cf]=1,s["border"+a+Cf]=0,s[i.p]=t+"px",ct.set(e,s)},Yt=[],PS={},ip,aR=function(){return ar()-As>34&&(ip||(ip=requestAnimationFrame(ta)))},wc=function(){(!zr||!zr.isPressed||zr.startX>Nn.clientWidth)&&(qt.cache++,zr?ip||(ip=requestAnimationFrame(ta)):ta(),As||Pu("scrollStart"),As=ar())},wx=function(){xD=Zt.innerWidth,yD=Zt.innerHeight},Bh=function(){qt.cache++,!Gi&&!vD&&!bn.fullscreenElement&&!bn.webkitFullscreenElement&&(!_D||xD!==Zt.innerWidth||Math.abs(Zt.innerHeight-yD)>Zt.innerHeight*.25)&&ev.restart(!0)},bu={},$8=[],CD=function n(){return _i(zt,"scrollEnd",n)||iu(!0)},Pu=function(e){return bu[e]&&bu[e].map(function(t){return t()})||$8},Br=[],RD=function(e){for(var t=0;ts)&&r.setPositions(r.start,Math.max(r.start+1,s),!0)}),i.forEach(function(r){return r&&r.render&&r.render(-1)}),qt.forEach(function(r){fr(r)&&(r.smooth&&requestAnimationFrame(function(){return r.target.style.scrollBehavior="smooth"}),r.rec&&r(r.rec))}),bD(Kw,1),ev.pause(),gu++,or=2,ta(2),Yt.forEach(function(r){return fr(r.vars.onRefresh)&&r.vars.onRefresh(r)}),or=zt.isRefreshing=!1,Pu("refresh")},LS=0,p0=1,dd,ta=function(e){if(!or||e===2){zt.isUpdating=!0,dd&&dd.update(0);var t=Yt.length,i=ar(),r=i-Sx>=50,s=t&&Yt[0].scroll();if(p0=LS>s?-1:1,or||(LS=s),r&&(As&&!Hv&&i-As>200&&(As=0,Pu("scrollEnd")),c0=Sx,Sx=i),p0<0){for(sr=t;sr-- >0;)Yt[sr]&&Yt[sr].update(0,r);p0=1}else for(sr=0;sr20),i-=i-R}if(_&&(l[_]=e||-.001,e<0&&(e=0)),o){var D=e+i,b=o._isStart;y="scroll"+r.d2,d0(o,D,r,b&&D>20||!b&&(d?Math.max(Nn[y],Xs[y]):o.parentNode[y])<=D+1),d&&(f=jo(a),d&&(o.style[r.op.p]=f[r.op.p]-r.op.m-o._offset+Ai))}return m&&M&&(y=jo(M),m.seek(p),g=jo(M),m._caScrollDist=y[r.p]-g[r.p],e=e/m._caScrollDist*p),m&&m.seek(x),m?e:Math.round(e)},rW=/(webkit|moz|length|cssText|inset)/i,cR=function(e,t,i,r){if(e.parentNode!==t){var s=e.style,o,a;if(t===Nn){e._stOrig=s.cssText,a=_s(e);for(o in a)!+o&&!rW.test(o)&&a[o]&&typeof s[o]=="string"&&o!=="0"&&(s[o]=a[o]);s.top=i,s.left=r}else s.cssText=e._stOrig;ct.core.getCache(e).uncache=1,t.appendChild(e)}},PD=function(e,t,i){var r=t,s=r;return function(o){var a=Math.round(e());return a!==r&&a!==s&&Math.abs(a-r)>3&&Math.abs(a-s)>3&&(o=a,i&&i()),s=r,r=o,o}},zg=function(e,t,i){var r={};r[t.p]="+="+i,ct.set(e,r)},fR=function(e,t){var i=fl(e,t),r="_scroll"+t.p2,s=function o(a,l,f,h,d){var p=o.tween,m=l.onComplete,_={};f=f||i();var x=PD(i,f,function(){p.kill(),o.tween=0});return d=h&&d||0,h=h||a-f,p&&p.kill(),l[r]=a,l.modifiers=_,_[r]=function(){return x(f+h*p.ratio+d*p.ratio*p.ratio)},l.onUpdate=function(){qt.cache++,ta()},l.onComplete=function(){o.tween=0,m&&m.call(p)},p=o.tween=ct.to(e,l),p};return e[r]=i,i.wheelHandler=function(){return s.tween&&s.tween.kill()&&(s.tween=0)},yi(e,"wheel",i.wheelHandler),zt.isTouch&&yi(e,"touchmove",i.wheelHandler),s},zt=function(){function n(t,i){Ac||n.register(ct)||console.warn("Please gsap.registerPlugin(ScrollTrigger)"),RS(this),this.init(t,i)}var e=n.prototype;return e.init=function(i,r){if(this.progress=this.start=0,this.vars&&this.kill(!0,!0),!Oh){this.update=this.refresh=this.kill=fo;return}i=sR(Vr(i)||f0(i)||i.nodeType?{trigger:i}:i,Ug);var s=i,o=s.onUpdate,a=s.toggleClass,l=s.id,f=s.onToggle,h=s.onRefresh,d=s.scrub,p=s.trigger,m=s.pin,_=s.pinSpacing,x=s.invalidateOnRefresh,y=s.anticipatePin,g=s.onScrubComplete,M=s.onSnapComplete,S=s.once,E=s.snap,C=s.pinReparent,R=s.pinSpacer,P=s.containerAnimation,D=s.fastScrollEnd,b=s.preventOverlaps,I=i.horizontal||i.containerAnimation&&i.horizontal!==!1?cr:ci,z=!d&&d!==0,q=Sr(i.scroller||Zt),J=ct.core.getCache(q),Q=Ru(q),ee=("pinType"in i?i.pinType:il(q,"pinType")||Q&&"fixed")==="fixed",oe=[i.onEnter,i.onLeave,i.onEnterBack,i.onLeaveBack],$=z&&i.toggleActions.split(" "),k="markers"in i?i.markers:Ug.markers,G=Q?0:parseFloat(_s(q)["border"+I.p2+Cf])||0,F=this,re=i.onRefreshInit&&function(){return i.onRefreshInit(F)},j=q8(q,Q,I),ve=Z8(q,Q),le=0,Pe=0,_e=0,Re=fl(q,I),nt,it,Pt,Ze,Z,we,ye,Ie,Ae,te,He,Ye,mt,dt,$t,W,O,de,Ce,Le,Ue,tt,Oe,Me,rt,ot,Je,Qe,je,ft,Mt,K,he,ce,Ne,Be,bt,en,tn;if(F._startClamp=F._endClamp=!1,F._dir=I,y*=45,F.scroller=q,F.scroll=P?P.time.bind(P):Re,Ze=Re(),F.vars=i,r=r||i.animation,"refreshPriority"in i&&(gD=1,i.refreshPriority===-9999&&(dd=F)),J.tweenScroll=J.tweenScroll||{top:fR(q,ci),left:fR(q,cr)},F.tweenTo=nt=J.tweenScroll[I.p],F.scrubDuration=function($e){he=f0($e)&&$e,he?K?K.duration($e):K=ct.to(r,{ease:"expo",totalProgress:"+=0",duration:he,paused:!0,onComplete:function(){return g&&g(F)}}):(K&&K.progress(1).kill(),K=0)},r&&(r.vars.lazy=!1,r._initted&&!F.isReverted||r.vars.immediateRender!==!1&&i.immediateRender!==!1&&r.duration()&&r.render(0,!0,!0),F.animation=r.pause(),r.scrollTrigger=F,F.scrubDuration(d),ft=0,l||(l=r.vars.id)),E&&((!Xl(E)||E.push)&&(E={snapTo:E}),"scrollBehavior"in Nn.style&&ct.set(Q?[Nn,Xs]:q,{scrollBehavior:"auto"}),qt.forEach(function($e){return fr($e)&&$e.target===(Q?bn.scrollingElement||Xs:q)&&($e.smooth=!1)}),Pt=fr(E.snapTo)?E.snapTo:E.snapTo==="labels"?J8(r):E.snapTo==="labelsDirectional"?Q8(r):E.directional!==!1?function($e,Ot){return eE(E.snapTo)($e,ar()-Pe<500?0:Ot.direction)}:ct.utils.snap(E.snapTo),ce=E.duration||{min:.1,max:2},ce=Xl(ce)?qc(ce.min,ce.max):qc(ce,ce),Ne=ct.delayedCall(E.delay||he/2||.1,function(){var $e=Re(),Ot=ar()-Pe<500,xt=nt.tween;if((Ot||Math.abs(F.getVelocity())<10)&&!xt&&!Hv&&le!==$e){var At=($e-we)/dt,hn=r&&!z?r.totalProgress():At,Tt=Ot?0:(hn-Mt)/(ar()-c0)*1e3||0,ht=ct.utils.clamp(-At,1-At,Mc(Tt/2)*Tt/.185),Vn=At+(E.inertia===!1?0:ht),Ln=qc(0,1,Pt(Vn,F)),N=Math.round(we+Ln*dt),A=E,U=A.onStart,H=A.onInterrupt,B=A.onComplete;if($e<=ye&&$e>=we&&N!==$e){if(xt&&!xt._initted&&xt.data<=Mc(N-$e))return;E.inertia===!1&&(ht=Ln-At),nt(N,{duration:ce(Mc(Math.max(Mc(Vn-hn),Mc(Ln-hn))*.185/Tt/.05||0)),ease:E.ease||"power3",data:Mc(N-$e),onInterrupt:function(){return Ne.restart(!0)&&H&&H(F)},onComplete:function(){F.update(),le=Re(),ft=Mt=r&&!z?r.totalProgress():F.progress,M&&M(F),B&&B(F)}},$e,ht*dt,N-$e-ht*dt),U&&U(F,nt.tween)}}else F.isActive&&le!==$e&&Ne.restart(!0)}).pause()),l&&(PS[l]=F),p=F.trigger=Sr(p||m!==!0&&m),tn=p&&p._gsap&&p._gsap.stRevert,tn&&(tn=tn(F)),m=m===!0?p:Sr(m),Vr(a)&&(a={targets:p,className:a}),m&&(_===!1||_===vs||(_=!_&&m.parentNode&&m.parentNode.style&&_s(m.parentNode).display==="flex"?!1:ri),F.pin=m,it=ct.core.getCache(m),it.spacer?$t=it.pinState:(R&&(R=Sr(R),R&&!R.nodeType&&(R=R.current||R.nativeElement),it.spacerIsNative=!!R,R&&(it.spacerState=Og(R))),it.spacer=de=R||bn.createElement("div"),de.classList.add("pin-spacer"),l&&de.classList.add("pin-spacer-"+l),it.pinState=$t=Og(m)),i.force3D!==!1&&ct.set(m,{force3D:!0}),F.spacer=de=it.spacer,je=_s(m),Me=je[_+I.os2],Le=ct.getProperty(m),Ue=ct.quickSetter(m,I.a,Ai),Ex(m,de,je),O=Og(m)),k){Ye=Xl(k)?sR(k,oR):oR,te=kg("scroller-start",l,q,I,Ye,0),He=kg("scroller-end",l,q,I,Ye,0,te),Ce=te["offset"+I.op.d2];var St=Sr(il(q,"content")||q);Ie=this.markerStart=kg("start",l,St,I,Ye,Ce,0,P),Ae=this.markerEnd=kg("end",l,St,I,Ye,Ce,0,P),P&&(en=ct.quickSetter([Ie,Ae],I.a,Ai)),!ee&&!(Mo.length&&il(q,"fixedMarkers")===!0)&&(K8(Q?Nn:q),ct.set([te,He],{force3D:!0}),ot=ct.quickSetter(te,I.a,Ai),Qe=ct.quickSetter(He,I.a,Ai))}if(P){var We=P.vars.onUpdate,Ct=P.vars.onUpdateParams;P.eventCallback("onUpdate",function(){F.update(0,0,1),We&&We.apply(P,Ct||[])})}if(F.previous=function(){return Yt[Yt.indexOf(F)-1]},F.next=function(){return Yt[Yt.indexOf(F)+1]},F.revert=function($e,Ot){if(!Ot)return F.kill(!0);var xt=$e!==!1||!F.enabled,At=Gi;xt!==F.isReverted&&(xt&&(Be=Math.max(Re(),F.scroll.rec||0),_e=F.progress,bt=r&&r.progress()),Ie&&[Ie,Ae,te,He].forEach(function(hn){return hn.style.display=xt?"none":"block"}),xt&&(Gi=F,F.update(xt)),m&&(!C||!F.isActive)&&(xt?tW(m,de,$t):Ex(m,de,_s(m),rt)),xt||F.update(xt),Gi=At,F.isReverted=xt)},F.refresh=function($e,Ot,xt,At){if(!((Gi||!F.enabled)&&!Ot)){if(m&&$e&&As){yi(n,"scrollEnd",CD);return}!or&&re&&re(F),Gi=F,nt.tween&&(nt.tween.kill(),nt.tween=0),K&&K.pause(),x&&r&&r.revert({kill:!1}).invalidate(),F.isReverted||F.revert(!0,!0),F._subPinOffset=!1;var hn=j(),Tt=ve(),ht=P?P.duration():Qo(q,I),Vn=dt<=.01,Ln=0,N=At||0,A=Xl(xt)?xt.end:i.end,U=i.endTrigger||p,H=Xl(xt)?xt.start:i.start||(i.start===0||!p?0:m?"0 0":"0 100%"),B=F.pinnedContainer=i.pinnedContainer&&Sr(i.pinnedContainer,F),X=p&&Math.max(0,Yt.indexOf(F))||0,ae=X,ue,me,xe,Te,pe,ke,De,Ve,gt,vt,at,qe,wt;for(k&&Xl(xt)&&(qe=ct.getProperty(te,I.p),wt=ct.getProperty(He,I.p));ae--;)ke=Yt[ae],ke.end||ke.refresh(0,1)||(Gi=F),De=ke.pin,De&&(De===p||De===m||De===B)&&!ke.isReverted&&(vt||(vt=[]),vt.unshift(ke),ke.revert(!0,!0)),ke!==Yt[ae]&&(X--,ae--);for(fr(H)&&(H=H(F)),H=tR(H,"start",F),we=uR(H,p,hn,I,Re(),Ie,te,F,Tt,G,ee,ht,P,F._startClamp&&"_startClamp")||(m?-.001:0),fr(A)&&(A=A(F)),Vr(A)&&!A.indexOf("+=")&&(~A.indexOf(" ")?A=(Vr(H)?H.split(" ")[0]:"")+A:(Ln=h0(A.substr(2),hn),A=Vr(H)?H:(P?ct.utils.mapRange(0,P.duration(),P.scrollTrigger.start,P.scrollTrigger.end,we):we)+Ln,U=p)),A=tR(A,"end",F),ye=Math.max(we,uR(A||(U?"100% 0":ht),U,hn,I,Re()+Ln,Ae,He,F,Tt,G,ee,ht,P,F._endClamp&&"_endClamp"))||-.001,Ln=0,ae=X;ae--;)ke=Yt[ae],De=ke.pin,De&&ke.start-ke._pinPush<=we&&!P&&ke.end>0&&(ue=ke.end-(F._startClamp?Math.max(0,ke.start):ke.start),(De===p&&ke.start-ke._pinPush1&&(at=(Q?bn.scrollingElement||Xs:q).style,at={style:at,value:at["overflow"+I.a.toUpperCase()]},Q&&_s(Nn)["overflow"+I.a.toUpperCase()]!=="scroll"&&(at.style["overflow"+I.a.toUpperCase()]="scroll")),Ex(m,de,ue),O=Og(m),me=jo(m,!0),Ve=ee&&fl(q,Te?cr:ci)(),_&&(rt=[_+I.os2,dt+N+Ai],rt.t=de,ae=_===ri?bS(m,I)+dt+N:0,ae&&rt.push(I.d,ae+Ai),lf(rt),B&&Yt.forEach(function(st){st.pin===B&&st.vars.pinSpacing!==!1&&(st._subPinOffset=!0)}),ee&&Re(Be)),ee&&(pe={top:me.top+(Te?xe-we:Ve)+Ai,left:me.left+(Te?Ve:xe-we)+Ai,boxSizing:"border-box",position:"fixed"},pe[pu]=pe["max"+Cf]=Math.ceil(me.width)+Ai,pe[mu]=pe["max"+$w]=Math.ceil(me.height)+Ai,pe[vs]=pe[vs+fd]=pe[vs+ud]=pe[vs+hd]=pe[vs+cd]="0",pe[ri]=ue[ri],pe[ri+fd]=ue[ri+fd],pe[ri+ud]=ue[ri+ud],pe[ri+hd]=ue[ri+hd],pe[ri+cd]=ue[ri+cd],W=iW($t,pe,C),or&&Re(0)),r?(gt=r._initted,yx(1),r.render(r.duration(),!0,!0),Oe=Le(I.a)-tt+dt+N,Je=Math.abs(dt-Oe)>1,ee&&Je&&W.splice(W.length-2,2),r.render(0,!0,!0),gt||r.invalidate(!0),r.parent||r.totalTime(r.totalTime()),yx(0)):Oe=dt,at&&(at.value?at.style["overflow"+I.a.toUpperCase()]=at.value:at.style.removeProperty("overflow-"+I.a));else if(p&&Re()&&!P)for(me=p.parentNode;me&&me!==Nn;)me._pinOffset&&(we-=me._pinOffset,ye-=me._pinOffset),me=me.parentNode;vt&&vt.forEach(function(st){return st.revert(!1,!0)}),F.start=we,F.end=ye,Ze=Z=or?Be:Re(),!P&&!or&&(Ze0?Yt.slice(0,Ot).reverse():Yt.slice(Ot+1);return(Vr($e)?xt.filter(function(At){return At.vars.preventOverlaps===$e}):xt).filter(function(At){return F.direction>0?At.end<=we:At.start>=ye})},F.update=function($e,Ot,xt){if(!(P&&!xt&&!$e)){var At=or===!0?Be:F.scroll(),hn=$e?0:(At-we)/dt,Tt=hn<0?0:hn>1?1:hn||0,ht=F.progress,Vn,Ln,N,A,U,H,B,X;if(Ot&&(Z=Ze,Ze=P?Re():At,E&&(Mt=ft,ft=r&&!z?r.totalProgress():Tt)),y&&!Tt&&m&&!Gi&&!Ig&&As&&weht?1:-1,F.progress=Tt,U&&!Gi&&(N=Tt&&!ht?0:Tt===1?1:ht===1?2:3,z&&(A=!H&&$[N+1]!=="none"&&$[N+1]||$[N],X=r&&(A==="complete"||A==="reset"||A in r))),b&&(H||X)&&(X||d||!r)&&(fr(b)?b(F):F.getTrailing(b).forEach(function(xe){return xe.endAnimation()})),z||(K&&!Gi&&!Ig?(K._dp._time-K._start!==K._time&&K.render(K._dp._time-K._start),K.resetTo?K.resetTo("totalProgress",Tt,r._tTime/r._tDur):(K.vars.totalProgress=Tt,K.invalidate().restart())):r&&r.totalProgress(Tt,!!(Gi&&(Pe||$e)))),m){if($e&&_&&(de.style[_+I.os2]=Me),!ee)Ue(zh(tt+Oe*Tt));else if(U){if(B=!$e&&Tt>ht&&ye+1>At&&At+1>=Qo(q,I),C)if(!$e&&(Vn||B)){var ae=jo(m,!0),ue=At-we;cR(m,Nn,ae.top+(I===ci?ue:0)+Ai,ae.left+(I===ci?0:ue)+Ai)}else cR(m,de);lf(Vn||B?W:O),Je&&Tt<1&&Vn||Ue(tt+(Tt===1&&!B?Oe:0))}}E&&!nt.tween&&!Gi&&!Ig&&Ne.restart(!0),a&&(H||S&&Tt&&(Tt<1||!xx))&&tv(a.targets).forEach(function(xe){return xe.classList[Vn||S?"add":"remove"](a.className)}),o&&!z&&!$e&&o(F),U&&!Gi?(z&&(X&&(A==="complete"?r.pause().totalProgress(1):A==="reset"?r.restart(!0).pause():A==="restart"?r.restart(!0):r[A]()),o&&o(F)),(H||!xx)&&(f&&H&&Mx(F,f),oe[N]&&Mx(F,oe[N]),S&&(Tt===1?F.kill(!1,1):oe[N]=0),H||(N=Tt===1?1:3,oe[N]&&Mx(F,oe[N]))),D&&!Vn&&Math.abs(F.getVelocity())>(f0(D)?D:2500)&&(bh(F.callbackAnimation),K?K.progress(1):bh(r,A==="reverse"?1:!Tt,1))):z&&o&&!Gi&&o(F)}if(Qe){var me=P?At/P.duration()*(P._caScrollDist||0):At;ot(me+(te._isFlipped?1:0)),Qe(me)}en&&en(-At/P.duration()*(P._caScrollDist||0))}},F.enable=function($e,Ot){F.enabled||(F.enabled=!0,yi(q,"resize",Bh),yi(Q?bn:q,"scroll",wc),re&&yi(n,"refreshInit",re),$e!==!1&&(F.progress=_e=0,Ze=Z=le=Re()),Ot!==!1&&F.refresh())},F.getTween=function($e){return $e&&nt?nt.tween:K},F.setPositions=function($e,Ot,xt,At){if(P){var hn=P.scrollTrigger,Tt=P.duration(),ht=hn.end-hn.start;$e=hn.start+ht*$e/Tt,Ot=hn.start+ht*Ot/Tt}F.refresh(!1,!1,{start:nR($e,xt&&!!F._startClamp),end:nR(Ot,xt&&!!F._endClamp)},At),F.update()},F.adjustPinSpacing=function($e){if(rt&&$e){var Ot=rt.indexOf(I.d)+1;rt[Ot]=parseFloat(rt[Ot])+$e+Ai,rt[1]=parseFloat(rt[1])+$e+Ai,lf(rt)}},F.disable=function($e,Ot){if(F.enabled&&($e!==!1&&F.revert(!0,!0),F.enabled=F.isActive=!1,Ot||K&&K.pause(),Be=0,it&&(it.uncache=1),re&&_i(n,"refreshInit",re),Ne&&(Ne.pause(),nt.tween&&nt.tween.kill()&&(nt.tween=0)),!Q)){for(var xt=Yt.length;xt--;)if(Yt[xt].scroller===q&&Yt[xt]!==F)return;_i(q,"resize",Bh),_i(q,"scroll",wc)}},F.kill=function($e,Ot){F.disable($e,Ot),K&&!Ot&&K.kill(),l&&delete PS[l];var xt=Yt.indexOf(F);xt>=0&&Yt.splice(xt,1),xt===sr&&p0>0&&sr--,xt=0,Yt.forEach(function(At){return At.scroller===F.scroller&&(xt=1)}),xt||or||(F.scroll.rec=0),r&&(r.scrollTrigger=null,$e&&r.revert({kill:!1}),Ot||r.kill()),Ie&&[Ie,Ae,te,He].forEach(function(At){return At.parentNode&&At.parentNode.removeChild(At)}),dd===F&&(dd=0),m&&(it&&(it.uncache=1),xt=0,Yt.forEach(function(At){return At.pin===m&&xt++}),xt||(it.spacer=0)),i.onKill&&i.onKill(F)},Yt.push(F),F.enable(!1,!1),tn&&tn(F),r&&r.add&&!dt){var Ut=F.update;F.update=function(){F.update=Ut,we||ye||F.refresh()},ct.delayedCall(.01,F.update),dt=.01,we=ye=0}else F.refresh();m&&eW()},n.register=function(i){return Ac||(ct=i||MD(),SD()&&window.document&&n.enable(),Ac=Oh),Ac},n.defaults=function(i){if(i)for(var r in i)Ug[r]=i[r];return Ug},n.disable=function(i,r){Oh=0,Yt.forEach(function(o){return o[r?"kill":"disable"](i)}),_i(Zt,"wheel",wc),_i(bn,"scroll",wc),clearInterval(Lg),_i(bn,"touchcancel",fo),_i(Nn,"touchstart",fo),Ng(_i,bn,"pointerdown,touchstart,mousedown",iR),Ng(_i,bn,"pointerup,touchend,mouseup",rR),ev.kill(),Dg(_i);for(var s=0;s0&&o.left+a0&&o.top+a=0&&Br.splice(t,5),Br.push(e,e.style.cssText,e.getBBox&&e.getAttribute("transform"),ct.core.getCache(e),RS())}}):Br};zt.revert=function(n,e){return tE(!n,e)};zt.create=function(n,e){return new zt(n,e)};zt.refresh=function(n){return n?Bh():(Ac||zt.register())&&iu(!0)};zt.update=function(n){return++qt.cache&&ta(n===!0?2:0)};zt.clearScrollMemory=bD;zt.maxScroll=function(n,e){return Qo(n,e?cr:ci)};zt.getScrollFunc=function(n,e){return fl(Sr(n),e?cr:ci)};zt.getById=function(n){return PS[n]};zt.getAll=function(){return Yt.filter(function(n){return n.vars.id!=="ScrollSmoother"})};zt.isScrolling=function(){return!!As};zt.snapDirectional=eE;zt.addEventListener=function(n,e){var t=bu[n]||(bu[n]=[]);~t.indexOf(e)||t.push(e)};zt.removeEventListener=function(n,e){var t=bu[n],i=t&&t.indexOf(e);i>=0&&t.splice(i,1)};zt.batch=function(n,e){var t=[],i={},r=e.interval||.016,s=e.batchMax||1e9,o=function(f,h){var d=[],p=[],m=ct.delayedCall(r,function(){h(d,p),d=[],p=[]}).pause();return function(_){d.length||m.restart(!0),d.push(_.trigger),p.push(_),s<=d.length&&m.progress(1)}},a;for(a in e)i[a]=a.substr(0,2)==="on"&&fr(e[a])&&a!=="onRefreshInit"?o(a,e[a]):e[a];return fr(s)&&(s=s(),yi(zt,"refresh",function(){return s=e.batchMax()})),tv(n).forEach(function(l){var f={};for(a in i)f[a]=i[a];f.trigger=l,t.push(zt.create(f))}),t};var hR=function(e,t,i,r){return t>r?e(r):t<0&&e(0),i>r?(r-t)/(i-t):i<0?t/(t-i):1},Tx=function n(e,t){t===!0?e.style.removeProperty("touch-action"):e.style.touchAction=t===!0?"auto":t?"pan-"+t+(ai.isTouch?" pinch-zoom":""):"none",e===Xs&&n(Nn,t)},Bg={auto:1,scroll:1},sW=function(e){var t=e.event,i=e.target,r=e.axis,s=(t.changedTouches?t.changedTouches[0]:t).target,o=s._gsap||ct.core.getCache(s),a=ar(),l;if(!o._isScrollT||a-o._isScrollT>2e3){for(;s&&s!==Nn&&(s.scrollHeight<=s.clientHeight&&s.scrollWidth<=s.clientWidth||!(Bg[(l=_s(s)).overflowY]||Bg[l.overflowX]));)s=s.parentNode;o._isScroll=s&&s!==i&&!Ru(s)&&(Bg[(l=_s(s)).overflowY]||Bg[l.overflowX]),o._isScrollT=a}(o._isScroll||r==="x")&&(t.stopPropagation(),t._gsapAllow=!0)},LD=function(e,t,i,r){return ai.create({target:e,capture:!0,debounce:!1,lockAxis:!0,type:t,onWheel:r=r&&sW,onPress:r,onDrag:r,onScroll:r,onEnable:function(){return i&&yi(bn,ai.eventTypes[0],pR,!1,!0)},onDisable:function(){return _i(bn,ai.eventTypes[0],pR,!0)}})},oW=/(input|label|select|textarea)/i,dR,pR=function(e){var t=oW.test(e.target.tagName);(t||dR)&&(e._gsapAllow=!0,dR=t)},aW=function(e){Xl(e)||(e={}),e.preventDefault=e.isNormalizer=e.allowClicks=!0,e.type||(e.type="wheel,touch"),e.debounce=!!e.debounce,e.id=e.id||"normalizer";var t=e,i=t.normalizeScrollX,r=t.momentum,s=t.allowNestedScroll,o=t.onRelease,a,l,f=Sr(e.target)||Xs,h=ct.core.globals().ScrollSmoother,d=h&&h.get(),p=ba&&(e.content&&Sr(e.content)||d&&e.content!==!1&&!d.smooth()&&d.content()),m=fl(f,ci),_=fl(f,cr),x=1,y=(ai.isTouch&&Zt.visualViewport?Zt.visualViewport.scale*Zt.visualViewport.width:Zt.outerWidth)/Zt.innerWidth,g=0,M=fr(r)?function(){return r(a)}:function(){return r||2.8},S,E,C=LD(f,e.type,!0,s),R=function(){return E=!1},P=fo,D=fo,b=function(){l=Qo(f,ci),D=qc(ba?1:0,l),i&&(P=qc(0,Qo(f,cr))),S=gu},I=function(){p._gsap.y=zh(parseFloat(p._gsap.y)+m.offset)+"px",p.style.transform="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, "+parseFloat(p._gsap.y)+", 0, 1)",m.offset=m.cacheID=0},z=function(){if(E){requestAnimationFrame(R);var k=zh(a.deltaY/2),G=D(m.v-k);if(p&&G!==m.v+m.offset){m.offset=G-m.v;var F=zh((parseFloat(p&&p._gsap.y)||0)-m.offset);p.style.transform="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, "+F+", 0, 1)",p._gsap.y=F+"px",m.cacheID=qt.cache,ta()}return!0}m.offset&&I(),E=!0},q,J,Q,ee,oe=function(){b(),q.isActive()&&q.vars.scrollY>l&&(m()>l?q.progress(1)&&m(l):q.resetTo("scrollY",l))};return p&&ct.set(p,{y:"+=0"}),e.ignoreCheck=function($){return ba&&$.type==="touchmove"&&z()||x>1.05&&$.type!=="touchstart"||a.isGesturing||$.touches&&$.touches.length>1},e.onPress=function(){E=!1;var $=x;x=zh((Zt.visualViewport&&Zt.visualViewport.scale||1)/y),q.pause(),$!==x&&Tx(f,x>1.01?!0:i?!1:"x"),J=_(),Q=m(),b(),S=gu},e.onRelease=e.onGestureStart=function($,k){if(m.offset&&I(),!k)ee.restart(!0);else{qt.cache++;var G=M(),F,re;i&&(F=_(),re=F+G*.05*-$.velocityX/.227,G*=hR(_,F,re,Qo(f,cr)),q.vars.scrollX=P(re)),F=m(),re=F+G*.05*-$.velocityY/.227,G*=hR(m,F,re,Qo(f,ci)),q.vars.scrollY=D(re),q.invalidate().duration(G).play(.01),(ba&&q.vars.scrollY>=l||F>=l-1)&&ct.to({},{onUpdate:oe,duration:G})}o&&o($)},e.onWheel=function(){q._ts&&q.pause(),ar()-g>1e3&&(S=0,g=ar())},e.onChange=function($,k,G,F,re){if(gu!==S&&b(),k&&i&&_(P(F[2]===k?J+($.startX-$.x):_()+k-F[1])),G){m.offset&&I();var j=re[2]===G,ve=j?Q+$.startY-$.y:m()+G-re[1],le=D(ve);j&&ve!==le&&(Q+=le-ve),m(le)}(G||k)&&ta()},e.onEnable=function(){Tx(f,i?!1:"x"),zt.addEventListener("refresh",oe),yi(Zt,"resize",oe),m.smooth&&(m.target.style.scrollBehavior="auto",m.smooth=_.smooth=!1),C.enable()},e.onDisable=function(){Tx(f,!0),_i(Zt,"resize",oe),zt.removeEventListener("refresh",oe),C.kill()},e.lockAxis=e.lockAxis!==!1,a=new ai(e),a.iOS=ba,ba&&!m()&&m(1),ba&&ct.ticker.add(fo),ee=a._dc,q=ct.to(a,{ease:"power4",paused:!0,scrollX:i?"+=0.1":"+=0",scrollY:"+=0.1",modifiers:{scrollY:PD(m,m(),function(){return q.pause()})},onUpdate:ta,onComplete:ee.vars.onComplete}),a};zt.sort=function(n){return Yt.sort(n||function(e,t){return(e.vars.refreshPriority||0)*-1e6+e.start-(t.start+(t.vars.refreshPriority||0)*-1e6)})};zt.observe=function(n){return new ai(n)};zt.normalizeScroll=function(n){if(typeof n>"u")return zr;if(n===!0&&zr)return zr.enable();if(n===!1)return zr&&zr.kill();var e=n instanceof ai?n:aW(n);return zr&&zr.target===e.target&&zr.kill(),Ru(e.target)&&(zr=e),e};zt.core={_getVelocityProp:AS,_inputObserver:LD,_scrollers:qt,_proxies:Mo,bridge:{ss:function(){As||Pu("scrollStart"),As=ar()},ref:function(){return Gi}}};MD()&&ct.registerPlugin(zt);ID.propTypes={page:Bf.number.isRequired};function ID(n){const e=ie.useRef(),t=ie.useRef(),i=ie.useRef(null),r=ie.useRef(),s=ie.useRef(200),o=ie.useRef(0),a=new jt,l=[5,8,11,14,17,20,23],f=ie.useRef(.9),[h,d]=ie.useState(!1);return da(({clock:p})=>{if(!i.current)n.page===2&&(i.current=p.getElapsedTime()),r.current.scale.set(0,0,0);else{const m=p.getElapsedTime()-i.current;r.current.rotation.z=m*-.05;let _=0,x=0,y=s.current;if(o.current<200)for(let g=0;g0;){let g=Math.ceil(y/(l.length-x)/2);x===0&&(g=10);const M=2*Math.PI/g,S=l[x];for(let E=0;E0;E++){const C=E*M+Math.PI/g;a.position.set(S*Math.cos(C),S*Math.sin(C),0);const R=_++;x===0?a.scale.set(1,1,1):i.current&&a.scale.set(Math.min(o.current*E/50,.8),Math.min(o.current*E/50,.8),Math.min(o.current*E/50,.8)),a.updateMatrix(),e.current.setMatrixAt(R,a.matrix),t.current.setMatrixAt(R,a.matrix),y--}x++}}e.current.instanceMatrix.needsUpdate=!0,t.current.instanceMatrix.needsUpdate=!0,e.current.material.needsUpdate=!0,t.current.material.needsUpdate=!0}),ie.useEffect(()=>{En.timeline({scrollTrigger:{trigger:"#page-2",start:"top bottom",end:"top top",scrub:.2,onUpdate:_=>{_.progress>.4?d(!0):d(!1)}}}).from(r.current.position,{duration:1,y:-25}).to(r.current.scale,{duration:1,x:.8,y:.8,z:.8}),En.timeline({scrollTrigger:{trigger:"#page-2",start:"top top",end:"bottom center",scrub:.2}}).to(e.current.material,{duration:1,opacity:0}).to(t.current.material,{duration:1,opacity:0,onComplete:()=>{d(!1)}},"<")},[]),ge.jsx(ge.Fragment,{children:ge.jsxs("group",{position:[18,-13,-20],ref:r,scale:[.8,.8,.8],visible:n.page<3&&h,children:[ge.jsxs("instancedMesh",{ref:e,args:[null,null,s.current],children:[ge.jsx("sphereGeometry",{args:[1,16,16]}),ge.jsx(Au,{color:"#FFF4EB",backside:!1,thickness:.8,transmission:.96,roughness:.2,ior:1,opacity:f.current,transparent:!0})]}),ge.jsxs("instancedMesh",{ref:t,args:[null,null,s.current],children:[ge.jsx("sphereGeometry",{args:[.4,8,8]}),ge.jsx("meshPhysicalMaterial",{color:"#eee",transparent:!0,opacity:f.current})]})]})})}DD.propTypes={page:Bf.number.isRequired};En.registerPlugin(zt);function DD(n){const e=ie.useRef(),t=ie.useRef(),i=new Fv({color:"#eee",depthWrite:!1}),[r,s]=ie.useState(!0);return ie.useEffect(()=>{const o=En.timeline({scrollTrigger:{trigger:"#page-1",start:"top top",end:"bottom top",scrub:.2,onUpdate:a=>{a.progress>.4?s(!1):s(!0)}}});o.to(e.current.position,{duration:1,x:9,y:15,z:-15}),o.to(t.current.position,{duration:1,x:10,y:20,z:-15},"<"),o.to(".blur-c",{duration:1,opacity:0},"<")},[]),ge.jsxs(ge.Fragment,{children:[ge.jsx(D2,{speed:1,rotationIntensity:1,floatIntensity:1,floatingRange:[-.5,.5],children:ge.jsxs("group",{position:[3,0,-6],ref:e,visible:n.page<3&&r,children:[ge.jsxs("mesh",{children:[ge.jsx("sphereGeometry",{args:[1,16,16]}),ge.jsx(Au,{color:"#ffffff",thickness:.8,transmission:.96,roughness:.2,ior:1.25})]}),ge.jsx("mesh",{material:i,children:ge.jsx("sphereGeometry",{args:[.4,16,16]})})]})}),ge.jsx(D2,{speed:1,rotationIntensity:1,floatIntensity:1,floatingRange:[-.5,.5],children:ge.jsxs("group",{position:[5,0,-3],ref:t,visible:n.page<3&&r,children:[ge.jsxs("mesh",{children:[ge.jsx("sphereGeometry",{args:[1,16,16]}),ge.jsx(Au,{color:"#ffffff",thickness:.8,transmission:.96,roughness:.2,ior:1.25})]}),ge.jsx("mesh",{material:i,children:ge.jsx("sphereGeometry",{args:[.4,16,16]})})]})})]})}ND.propTypes={page:Bf.number.isRequired};function ND(n){const e=ie.useRef(),t=ie.useRef(),i=ie.useRef(),r=ie.useRef(),s=ie.useRef(0),o=ie.useRef(100),a=ie.useRef(100),l=new jt,f=new jt,[h,d]=ie.useState(!1),p=ie.useMemo(()=>{const m=[["#61FF00","#9E00FF"],["#FF005C","#00A3FF"],["#61FF00","#9E00FF"],["#FF005C","#00A3FF"]],_=o.current,x=new Array(_*3).fill(0);let y=0;for(let g=0;g<_;g++){const M=m[g%m.length];new Ge(M[Math.floor(g/2)%M.length]).toArray(x,y),y+=3}return x},[o]);return ie.useLayoutEffect(()=>{for(let m=0;m{const x=m.getElapsedTime();for(let y=0;y{En.timeline({scrollTrigger:{trigger:"#page-3",start:"top bottom",end:"top top",scrub:.2,onUpdate:x=>{x.progress>.2?d(!0):d(!1)}}}).from(r.current.position,{y:100,duration:1}),En.timeline({scrollTrigger:{trigger:"#page-3",start:"top top",end:"bottom top",scrub:.2}}).to(r.current.position,{x:120,duration:1})},[]),ge.jsx(ge.Fragment,{children:ge.jsxs("group",{ref:r,position:[0,-10,0],visible:n.page>1&&n.page<5&&h,children:[ge.jsx("group",{position:[25,-5,-100],children:ge.jsxs("instancedMesh",{ref:e,args:[null,null,o.current],children:[ge.jsx("coneGeometry",{args:[.5,1,4]}),ge.jsx("meshBasicMaterial",{color:p,wireframe:!0})]})}),ge.jsx("group",{position:[20,-10,-70],children:ge.jsxs("instancedMesh",{ref:t,args:[null,null,a.current],children:[ge.jsx("sphereGeometry",{args:[1,8,8]}),ge.jsx(Au,{color:"#FFF4EB",backside:!1,thickness:.8,transmission:.96,roughness:.2,ior:1})]})}),ge.jsx("group",{position:[20,-10,-70],children:ge.jsxs("instancedMesh",{ref:i,args:[null,null,a.current],children:[ge.jsx("sphereGeometry",{args:[.4,8,8]}),ge.jsx("meshPhysicalMaterial",{color:"#eee"})]})})]})})}FD.propTypes={page:Bf.number.isRequired};function FD(n){const e=ie.useRef(),t=new jt,i=50,r=ie.useRef(null),s=ie.useRef(),o=ie.useMemo(()=>{let a=["#61FF00","#9E00FF","#FF005C","#00A3FF"];const l=i,f=new Array(l*3).fill(0);for(let h=0;h{for(let a=0;a{const f=a.getElapsedTime()-r.current,h=10,d=2,p=5,m=1,_=10,x=new V(40,-10,0);for(let y=0;y{En.timeline({scrollTrigger:{trigger:"#page-6",start:"top center",end:"top top",scrub:.2}}).to(s.current.scale,{duration:1,x:1,y:1,z:1}).to(s.current.position,{duration:1,x:-20,y:0,z:-50},"<"),En.timeline({scrollTrigger:{trigger:"#page-6",start:"top top",end:"bottom center",scrub:.2}}).to(s.current.scale,{duration:1,x:0,y:0,z:0}).to(s.current.position,{duration:1,x:5,y:-10,z:-50},"<")},[]),ge.jsx("group",{scale:[0,0,0],position:[0,0,-50],ref:s,visible:n.page>4&&n.page<8,children:ge.jsxs("instancedMesh",{ref:e,args:[null,null,i],children:[ge.jsx("coneGeometry",{args:[.8,1,4]}),ge.jsx("meshPhysicalMaterial",{color:o,depthWrite:!1,wireframe:!0})]})})}UD.propTypes={page:Bf.number.isRequired};function UD(n){const e=ie.useRef(),t=ie.useRef(),i=ie.useRef(),r=ie.useRef(),s=ie.useRef(10),o=ie.useRef(150),a=ie.useRef(0),l=new jt,f=ie.useRef(0),[h,d]=ie.useState(!0),p=ie.useMemo(()=>{let m=[["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"]];const _=o.current,x=new Array(_*3).fill(0);let y=0;for(let g=0;g{let m=0;for(let _=0;_{if(!r.current)n.page===4&&(r.current=m.getElapsedTime()),i.current.scale.set(0,0,0);else{i.current.scale.set(1,1,1);const _=m.getElapsedTime()-r.current;if(i.current.rotation.y+=.001,a.current<200)for(let x=0;x{zt.create({trigger:"#page-4",start:"top center",end:"top top",scrub:.2,onUpdate:g=>{e.current.material.opacity=g.progress,t.current.material.opacity=g.progress}}),En.timeline({scrollTrigger:{trigger:"#page-4",start:"top top",end:"bottom top",scrub:.2}}).to(i.current.position,{duration:1,z:-30,x:15}).to(s,{duration:1,current:7},"<"),En.timeline({scrollTrigger:{trigger:"#page-5",start:"top top",end:"bottom top",scrub:.2}}).to(i.current.position,{duration:1,y:-13}),En.timeline({scrollTrigger:{trigger:"#page-7",start:"top top",end:"bottom top",scrub:.2}}).to(i.current.position,{duration:1,y:-5,z:-40},"<"),En.timeline({scrollTrigger:{trigger:"#page-8",start:"top top",end:"bottom center",scrub:.2,onUpdate:g=>{g.progress>.9?d(!1):d(!0)}}}).to(e.current.material,{duration:1,opacity:0}).to(t.current.material,{duration:1,opacity:0},"<")},[]),ge.jsx(ge.Fragment,{children:ge.jsxs("group",{position:[0,0,0],ref:i,visible:n.page>2&&h,children:[ge.jsxs("instancedMesh",{ref:e,args:[null,null,o.current],children:[ge.jsx("sphereGeometry",{args:[1,16,16]}),ge.jsx(Au,{backside:!1,color:"#FFF4EB",thickness:.6,transmission:.96,roughness:.2,ior:1.1,opacity:f.current,transparent:!0})]}),ge.jsxs("instancedMesh",{ref:t,args:[null,null,o.current],children:[ge.jsx("sphereGeometry",{args:[.5,8,8]}),ge.jsx("meshPhysicalMaterial",{color:p,opacity:f.current,transparent:!0})]})]})})}kD.propTypes={page:Bf.number.isRequired};function kD(n){const e=ie.useRef(),t=ie.useRef(),i=ie.useRef(),r=ie.useRef(),s=ie.useRef(),o=ie.useRef(),a=ie.useRef(5),l=ie.useRef(80),f=ie.useRef(1),h=ie.useMemo(()=>new jt,[]),[d,p]=ie.useState(!0),m=ie.useMemo(()=>{let _=[["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"],["#FCD2CA","#FF4775"],["#F4755D","#F4755D"]];const x=l.current,y=new Array(x*3).fill(0);let g=0;for(let M=0;M<_.length;M++){const S=_[M];for(let E=0;E{let _=0;for(let x=0;x{for(let _=0;_{i.current.rotation.y+=.001,o.current.rotation.y+=.001}),ie.useEffect(()=>{En.timeline({scrollTrigger:{trigger:"#page-8",start:"top bottom",end:"top top",scrub:.2}}).from(i.current.position,{duration:1,y:50}).to(i.current.scale,{x:1,y:1,z:1,duration:1},"<"),En.timeline({scrollTrigger:{trigger:"#page-7",start:"top center",end:"bottom top",scrub:.2}}).from(o.current.position,{duration:1,y:50}).to(o.current.scale,{x:1,y:1,z:1,duration:1},"<"),En.timeline({scrollTrigger:{trigger:"#page-8",start:"top top",end:"bottom center",scrub:.2,onUpdate:g=>{g.progress>.9?p(!1):p(!0)}}}).to(e.current.material,{duration:1,opacity:0}).to(t.current.material,{duration:1,opacity:0},"<").to(r.current.material,{duration:1,opacity:0},"<").to(s.current.material,{duration:1,opacity:0},"<")},[]),ge.jsxs(ge.Fragment,{children:[ge.jsxs("group",{position:[15,5,-28],ref:i,visible:n.page>6&&d,children:[ge.jsxs("instancedMesh",{ref:e,args:[null,null,l.current],children:[ge.jsx("sphereGeometry",{args:[1,16,16]}),ge.jsx(Au,{color:"#FFF4EB",thickness:.6,transmission:.96,roughness:.2,ior:1.25,opacity:f.current,transparent:!0})]}),ge.jsxs("instancedMesh",{ref:t,args:[null,null,l.current],children:[ge.jsx("sphereGeometry",{args:[.5,8,8]}),ge.jsx("meshPhysicalMaterial",{color:m,depthWrite:!1,opacity:f.current,transparent:!0})]})]}),ge.jsxs("group",{position:[8,3,-30],ref:o,visible:n.page>5&&d,children:[ge.jsxs("instancedMesh",{ref:r,args:[null,null,l.current],children:[ge.jsx("sphereGeometry",{args:[1,16,16]}),ge.jsx(Au,{color:"#FFF4EB",backside:!1,thickness:.6,transmission:.96,roughness:.2,ior:1.1,opacity:f.current,transparent:!0})]}),ge.jsxs("instancedMesh",{ref:s,args:[null,null,l.current],children:[ge.jsx("sphereGeometry",{args:[.5,8,8]}),ge.jsx("meshPhysicalMaterial",{color:m,depthWrite:!1,opacity:f.current,transparent:!0})]})]})]})}En.registerPlugin(zt);function lW(){const[n,e]=ie.useState(1),[t,i]=ie.useState(!1),[r,s]=ie.useState(1),o=ie.useRef(0);return ie.useEffect(()=>{zt.create({trigger:".tech-embed-wrapper",start:"top top",scrub:!0,onUpdate:a=>{let l=a.progress*10+1;e(Math.round(l)),o.current.style.width=`${a.progress*100}%`}})},[n]),ie.useEffect(()=>{En.timeline({scrollTrigger:{trigger:".is--page-10",start:"top top",end:"bottom top",scrub:.2,pin:!0,onUpdate:l=>{Math.round(l.progress*10)/10>.5?i(!0):i(!1)},onEnterBack:()=>{document.querySelector(".section_bring-out").classList.remove("active"),document.querySelector(".trigger-roll-in").click()}}}).to(".is--page-10 > .white-bg",{duration:1,width:"100%",height:"100%",borderRadius:"0",filter:"blur(0px)",onComplete:()=>{document.querySelector(".section_bring-out").classList.add("active"),document.querySelector(".trigger-roll-in").click()}})},[]),ie.useEffect(()=>{document.querySelectorAll(".section-page-circle-text").forEach(l=>{l.classList.toggle("hidden")})},[t]),ie.useEffect(()=>{En.timeline({scrollTrigger:{trigger:".microscrop-svg",start:"top 35%",scrub:!0,easeing:"power1.inOut"}}).to(".microscrop-svg",{duration:.7,scale:10,x:window.innerWidth>1920?"-55vw":"-75vw",y:"65vh"}).to(".section_from-cell-to-delicious",{duration:.2,backgroundColor:"#222"},"<").to(".microscope-s",{duration:.2,backgroundColor:"#222"},"<").to(".microscrop-svg",{duration:.3,opacity:0})},[]),ge.jsx(ge.Fragment,{children:ge.jsxs("div",{className:"canvas-wrapper",children:[ge.jsx("div",{className:"canvas-c",children:ge.jsxs(jG,{performance:{min:.5},dpr:r,gl:{antialias:!1,alpha:!1,depth:!1,stencil:!1,preserveDrawingBuffer:!1,sortObjects:!1,shadowMap:{enabled:!1,autoUpdate:!1,needsUpdate:!1}},camera:{near:.1,far:200,fov:55},children:[ge.jsx("color",{attach:"background",args:["#222"]}),ge.jsx(x6,{preset:"warehouse"}),ge.jsxs(ie.Suspense,{fallback:null,children:[n<3&&ge.jsx(DD,{page:n}),n<4&&ge.jsx(ID,{page:n}),n>1&&n<5&&ge.jsx(ND,{page:n}),ge.jsx(UD,{page:n}),n>5&&n<8&&ge.jsx(FD,{page:n}),n>6&&n<10&&ge.jsx(kD,{page:n})]}),ge.jsx(A6,{all:!0}),ge.jsx(P6,{onChange:({factor:a})=>{s(Math.round(.5+1.5*a,1))}}),ge.jsx(R6,{}),ge.jsx(C6,{pixelated:!0})]})}),ge.jsx("div",{className:"progress-container",children:ge.jsx("div",{className:"progress-c",children:ge.jsx("div",{className:"progress",ref:o})})})]})})}function uW(){const n=window.innerWidth<=991;return ie.useEffect(()=>{if(n){En.registerPlugin(zt),En.timeline({scrollTrigger:{trigger:".microscrop-svg ",start:"top 35%",scrub:!0,onEnterBack:()=>{document.querySelector(".microscrop-svg").style.display="flex"}}}).to(".microscrop-svg svg",{duration:1,scale:10,x:"-200vw",y:"25vh"}).to(".section_from-cell-to-delicious",{duration:.2,backgroundColor:"#222"},"<").to(".microscope-s",{duration:.2,backgroundColor:"#222"},"<").from(".tech-embed-wrapper",{opacity:0,duration:.3,onComplete:()=>{setTimeout(()=>{document.querySelector("#page-1").classList.add("active"),document.querySelector(".progress-container").classList.add("active")},200)}},"<").to(".microscrop-svg svg",{duration:.2,opacity:0,onComplete:()=>{document.querySelector(".microscrop-svg").style.display="none"}});const t=document.querySelector(".progress");zt.create({trigger:".tech-embed-wrapper",start:"top top",scrub:!0,onUpdate:s=>{t.style.width=`${s.progress*100}%`}});const i=document.querySelectorAll(".mobile-tech-sticky > .section_page");let r=0;En.timeline({scrollTrigger:{trigger:".tech-embed-wrapper",start:"top top",end:"bottom bottom",scrub:!0,onUpdate:s=>{r=Math.round(s.progress*10)+1,i.forEach(o=>{o.id===`page-${r}`?o.classList.add("active"):o.classList.remove("active")}),s.progress>.98?(document.querySelector(".section_bring-out").classList.add("active"),document.querySelector(".trigger-roll-in").click()):(document.querySelector(".section_bring-out").classList.remove("active"),document.querySelector(".trigger-roll-in").click())}}})}},[n]),ge.jsxs(ge.Fragment,{children:[!n&&ge.jsx(lW,{}),!n&&ge.jsxs("div",{className:"page-w",children:[ge.jsxs("div",{className:"section_page",id:"page-1",children:[ge.jsx("div",{className:"container",children:ge.jsx("div",{className:"section-page-content",children:ge.jsx("h2",{className:"section-page-h2",children:"Using proprietary Forsea methods, we collect stem cells from fish without causing them any harm."})})}),ge.jsx("div",{className:"blur-c"})]}),ge.jsx("div",{className:"section_page",id:"page-2",children:ge.jsx("div",{className:"container",children:ge.jsx("div",{className:"section-page-content",children:ge.jsx("h2",{className:"section-page-h2",children:"We create a master cell bank from the cells we’ve collected, which has unique characteristics and infinite cell growth capabilities."})})})}),ge.jsx("div",{className:"section_page",id:"page-3",children:ge.jsx("div",{className:"container",children:ge.jsx("div",{className:"section-page-content",children:ge.jsx("h2",{className:"section-page-h2",children:"We use bioreactors to build and grow organoids."})})})}),ge.jsx("div",{className:"section_page",id:"page-4",children:ge.jsx("div",{className:"container",children:ge.jsx("div",{className:"section-page-content",children:ge.jsx("h2",{className:"section-page-h2",children:"These organoids contain all of the addible cells we need."})})})}),ge.jsx("div",{className:"section_page",id:"page-5",children:ge.jsx("div",{className:"container",children:ge.jsx("div",{className:"section-page-content",children:ge.jsx("h2",{className:"section-page-h2 is--xl",children:"With our organoids, we are changing the landscape of cultivated meat"})})})}),ge.jsx("div",{className:"section_page",id:"page-6",children:ge.jsx("div",{className:"container",children:ge.jsxs("div",{className:"section-page-content",children:[ge.jsx("div",{className:"section-page-pagination",children:"01/04"}),ge.jsx("h3",{className:"section-page-h3",children:" Less Growth Factors"}),ge.jsx("p",{className:"section-page-p",children:"Organoids are directed to grow naturally into mini-tissue, allowing for a remarkable reduction in growth factors usage."})]})})}),ge.jsx("div",{className:"section_page",id:"page-7",children:ge.jsx("div",{className:"container",children:ge.jsxs("div",{className:"section-page-content",children:[ge.jsx("div",{className:"section-page-pagination",children:"02/04"}),ge.jsx("h3",{className:"section-page-h3",children:"Non-GMO"}),ge.jsx("p",{className:"section-page-p",children:"By harnessing nature’s tissue formation methods, we are able to produce non-GMO cultivated meat that is both healthy and nourishing."})]})})}),ge.jsx("div",{className:"section_page",id:"page-8",children:ge.jsx("div",{className:"container",children:ge.jsxs("div",{className:"section-page-content",children:[ge.jsx("div",{className:"section-page-pagination",children:"03/04"}),ge.jsx("h3",{className:"section-page-h3",children:"No Scaffolding"}),ge.jsx("p",{className:"section-page-p",children:"Our organoids contain the edible cell. Therefore, scaffolding is not necessary for cultivating our seafood meat."})]})})}),ge.jsxs("div",{className:"section_page is--page-9",id:"page-9",children:[ge.jsx("div",{className:"scalable-video-embed",children:ge.jsxs("video",{autoPlay:!0,muted:!0,loop:!0,id:"scalableVideo",children:[ge.jsx("source",{src:"https://uploads-ssl.webflow.com/6490147be4f743ad6fe5e064/64c62cc18516d8d5e11d826a_Comp-transcode.mp4"}),ge.jsx("source",{src:"https://uploads-ssl.webflow.com/6490147be4f743ad6fe5e064/64c62cc18516d8d5e11d826a_Comp-transcode.webm"})]})}),ge.jsx("div",{className:"container",children:ge.jsxs("div",{className:"section-page-content",children:[ge.jsx("div",{className:"section-page-pagination",children:"04/04"}),ge.jsx("h3",{className:"section-page-h3",children:"A Scalable Cost- Effective Process"}),ge.jsx("p",{className:"section-page-p",children:"The organoid’s unique characteristics allow us to bypass many costly production steps."})]})})]})]})]})}RP(document.getElementById("root")).render(ge.jsx(uW,{}));