function VE(n,e){for(var t=0;tr[i]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function t(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=t(i);fetch(i.href,o)}})();var HE=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof{}<"u"?{}:typeof self<"u"?self:{};function ow(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var vc={},GE={get exports(){return vc},set exports(n){vc=n}},Rd={},b={},WE={get exports(){return b},set exports(n){b=n}},ut={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Yc=Symbol.for("react.element"),jE=Symbol.for("react.portal"),XE=Symbol.for("react.fragment"),KE=Symbol.for("react.strict_mode"),YE=Symbol.for("react.profiler"),qE=Symbol.for("react.provider"),ZE=Symbol.for("react.context"),QE=Symbol.for("react.forward_ref"),JE=Symbol.for("react.suspense"),eT=Symbol.for("react.memo"),tT=Symbol.for("react.lazy"),Av=Symbol.iterator;function nT(n){return n===null||typeof n!="object"?null:(n=Av&&n[Av]||n["@@iterator"],typeof n=="function"?n:null)}var sw={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},aw=Object.assign,lw={};function Ja(n,e,t){this.props=n,this.context=e,this.refs=lw,this.updater=t||sw}Ja.prototype.isReactComponent={};Ja.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")};Ja.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function cw(){}cw.prototype=Ja.prototype;function Lg(n,e,t){this.props=n,this.context=e,this.refs=lw,this.updater=t||sw}var Rg=Lg.prototype=new cw;Rg.constructor=Lg;aw(Rg,Ja.prototype);Rg.isPureReactComponent=!0;var Lv=Array.isArray,uw=Object.prototype.hasOwnProperty,Dg={current:null},fw={key:!0,ref:!0,__self:!0,__source:!0};function dw(n,e,t){var r,i={},o=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(o=""+e.key),e)uw.call(e,r)&&!fw.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=t;else if(1=R?H:""+Array(R+1-Z.length).join(N)+H},S={s:x,z:function(H){var R=-H.utcOffset(),N=Math.abs(R),Z=Math.floor(N/60),K=N%60;return(R<=0?"+":"-")+x(Z,2,"0")+":"+x(K,2,"0")},m:function H(R,N){if(R.date()1)return H($[0])}else{var W=R.name;C[W]=R,K=W}return!Z&&K&&(T=K),K||!Z&&T},A=function(H,R){if(L(H))return H.clone();var N=typeof R=="object"?R:{};return N.date=H,N.args=arguments,new q(N)},I=S;I.l=E,I.i=L,I.w=function(H,R){return A(H,{locale:R.$L,utc:R.$u,x:R.$x,$offset:R.$offset})};var q=function(){function H(N){this.$L=E(N.locale,null,!0),this.parse(N)}var R=H.prototype;return R.parse=function(N){this.$d=function(Z){var K=Z.date,B=Z.utc;if(K===null)return new Date(NaN);if(I.u(K))return new Date;if(K instanceof Date)return new Date(K);if(typeof K=="string"&&!/Z$/i.test(K)){var $=K.match(g);if($){var W=$[2]-1||0,ie=($[7]||"0").substring(0,3);return B?new Date(Date.UTC($[1],W,$[3]||1,$[4]||0,$[5]||0,$[6]||0,ie)):new Date($[1],W,$[3]||1,$[4]||0,$[5]||0,$[6]||0,ie)}}return new Date(K)}(N),this.$x=N.x||{},this.init()},R.init=function(){var N=this.$d;this.$y=N.getFullYear(),this.$M=N.getMonth(),this.$D=N.getDate(),this.$W=N.getDay(),this.$H=N.getHours(),this.$m=N.getMinutes(),this.$s=N.getSeconds(),this.$ms=N.getMilliseconds()},R.$utils=function(){return I},R.isValid=function(){return this.$d.toString()!==m},R.isSame=function(N,Z){var K=A(N);return this.startOf(Z)<=K&&K<=this.endOf(Z)},R.isAfter=function(N,Z){return A(N)n.forEach(t=>gT(t,e))}function Ot(...n){return b.useCallback(mw(...n),n)}function vT(n,e){const t=b.createContext(e);function r(o){const{children:s,...a}=o,l=b.useMemo(()=>a,Object.values(a));return b.createElement(t.Provider,{value:l},s)}function i(o){const s=b.useContext(t);if(s)return s;if(e!==void 0)return e;throw new Error(`\`${o}\` must be used within \`${n}\``)}return r.displayName=n+"Provider",[r,i]}function vi(n,e=[]){let t=[];function r(o,s){const a=b.createContext(s),l=t.length;t=[...t,s];function c(u){const{scope:d,children:p,...v}=u,m=d?.[n][l]||a,g=b.useMemo(()=>v,Object.values(v));return b.createElement(m.Provider,{value:g},p)}function f(u,d){const p=d?.[n][l]||a,v=b.useContext(p);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${u}\` must be used within \`${o}\``)}return c.displayName=o+"Provider",[c,f]}const i=()=>{const o=t.map(s=>b.createContext(s));return function(a){const l=a?.[n]||o;return b.useMemo(()=>({[`__scope${n}`]:{...a,[n]:l}}),[a,l])}};return i.scopeName=n,[r,yT(i,...e)]}function yT(...n){const e=n[0];if(n.length===1)return e;const t=()=>{const r=n.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const u=l(o)[`__scope${c}`];return{...a,...u}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return t.scopeName=e.scopeName,t}const ki=Boolean(globalThis?.document)?b.useLayoutEffect:()=>{},_T=aT["useId".toString()]||(()=>{});let xT=0;function wo(n){const[e,t]=b.useState(_T());return ki(()=>{n||t(r=>r??String(xT++))},[n]),n||(e?`radix-${e}`:"")}function Hn(n){const e=b.useRef(n);return b.useEffect(()=>{e.current=n}),b.useMemo(()=>(...t)=>{var r;return(r=e.current)===null||r===void 0?void 0:r.call(e,...t)},[])}function el({prop:n,defaultProp:e,onChange:t=()=>{}}){const[r,i]=wT({defaultProp:e,onChange:t}),o=n!==void 0,s=o?n:r,a=Hn(t),l=b.useCallback(c=>{if(o){const u=typeof c=="function"?c(n):c;u!==n&&a(u)}else i(c)},[o,n,i,a]);return[s,l]}function wT({defaultProp:n,onChange:e}){const t=b.useState(n),[r]=t,i=b.useRef(r),o=Hn(e);return b.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),t}var Fo={},ST={get exports(){return Fo},set exports(n){Fo=n}},pr={},sm={},bT={get exports(){return sm},set exports(n){sm=n}},gw={};/** * @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(B,$){var W=B.length;B.push($);e:for(;0>>1,j=B[ie];if(0>>1;iei(Q,W))mei(pe,Q)?(B[ie]=pe,B[me]=W,ie=me):(B[ie]=Q,B[ue]=W,ie=ue);else if(mei(pe,W))B[ie]=pe,B[me]=W,ie=me;else break e}}return $}function i(B,$){var W=B.sortIndex-$.sortIndex;return W!==0?W:B.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;n.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();n.unstable_now=function(){return s.now()-a}}var l=[],c=[],f=1,u=null,d=3,p=!1,v=!1,m=!1,g=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(B){for(var $=t(c);$!==null;){if($.callback===null)r(c);else if($.startTime<=B)r(c),$.sortIndex=$.expirationTime,e(l,$);else break;$=t(c)}}function S(B){if(m=!1,x(B),!v)if(t(l)!==null)v=!0,Z(T);else{var $=t(c);$!==null&&K(S,$.startTime-B)}}function T(B,$){v=!1,m&&(m=!1,_(E),E=-1),p=!0;var W=d;try{for(x($),u=t(l);u!==null&&(!(u.expirationTime>$)||B&&!q());){var ie=u.callback;if(typeof ie=="function"){u.callback=null,d=u.priorityLevel;var j=ie(u.expirationTime<=$);$=n.unstable_now(),typeof j=="function"?u.callback=j:u===t(l)&&r(l),x($)}else r(l);u=t(l)}if(u!==null)var se=!0;else{var ue=t(c);ue!==null&&K(S,ue.startTime-$),se=!1}return se}finally{u=null,d=W,p=!1}}var C=!1,L=null,E=-1,A=5,I=-1;function q(){return!(n.unstable_now()-IB||125ie?(B.sortIndex=W,e(c,B),t(l)===null&&B===t(c)&&(m?(_(E),E=-1):m=!0,K(S,W-ie))):(B.sortIndex=j,e(l,B),v||p||(v=!0,Z(T))),B},n.unstable_shouldYield=q,n.unstable_wrapCallback=function(B){var $=d;return function(){var W=d;d=$;try{return B.apply(this,arguments)}finally{d=W}}}})(gw);(function(n){n.exports=gw})(bT);/** * @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 vw=b,hr=sm;function ye(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"),am=Object.prototype.hasOwnProperty,MT=/^[: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]*$/,Dv={},Iv={};function ET(n){return am.call(Iv,n)?!0:am.call(Dv,n)?!1:MT.test(n)?Iv[n]=!0:(Dv[n]=!0,!1)}function TT(n,e,t,r){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function CT(n,e,t,r){if(e===null||typeof e>"u"||TT(n,e,t,r))return!0;if(r)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 Wn(n,e,t,r,i,o,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=o,this.removeEmptyString=s}var Cn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){Cn[n]=new Wn(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];Cn[e]=new Wn(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){Cn[n]=new Wn(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){Cn[n]=new Wn(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){Cn[n]=new Wn(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){Cn[n]=new Wn(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){Cn[n]=new Wn(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){Cn[n]=new Wn(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){Cn[n]=new Wn(n,5,!1,n.toLowerCase(),null,!1,!1)});var kg=/[\-:]([a-z])/g;function Og(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(kg,Og);Cn[e]=new Wn(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(kg,Og);Cn[e]=new Wn(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(kg,Og);Cn[e]=new Wn(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){Cn[n]=new Wn(n,1,!1,n.toLowerCase(),null,!1,!1)});Cn.xlinkHref=new Wn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){Cn[n]=new Wn(n,1,!1,n.toLowerCase(),null,!0,!0)});function Fg(n,e,t,r){var i=Cn.hasOwnProperty(e)?Cn[e]:null;(i!==null?i.type!==0:r||!(2a||i[s]!==o[a]){var l=` `+i[s].replace(" at new "," at ");return n.displayName&&l.includes("")&&(l=l.replace("",n.displayName)),l}while(1<=s&&0<=a);break}}}finally{Lh=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?Xl(n):""}function PT(n){switch(n.tag){case 5:return Xl(n.type);case 16:return Xl("Lazy");case 13:return Xl("Suspense");case 19:return Xl("SuspenseList");case 0:case 2:case 15:return n=Rh(n.type,!1),n;case 11:return n=Rh(n.type.render,!1),n;case 1:return n=Rh(n.type,!0),n;default:return""}}function fm(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 pa:return"Fragment";case ha:return"Portal";case lm:return"Profiler";case Ng:return"StrictMode";case cm:return"Suspense";case um:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case xw:return(n.displayName||"Context")+".Consumer";case _w:return(n._context.displayName||"Context")+".Provider";case $g:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case Ug:return e=n.displayName||null,e!==null?e:fm(n.type)||"Memo";case co:e=n._payload,n=n._init;try{return fm(n(e))}catch{}}return null}function AT(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 fm(e);case 8:return e===Ng?"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 No(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Sw(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function LT(n){var e=Sw(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),r=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var i=t.get,o=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function vu(n){n._valueTracker||(n._valueTracker=LT(n))}function bw(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),r="";return n&&(r=Sw(n)?n.checked?"true":"false":n.value),n=r,n!==t?(e.setValue(n),!0):!1}function Vf(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 dm(n,e){var t=e.checked;return Gt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function Ov(n,e){var t=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;t=No(e.value!=null?e.value:t),n._wrapperState={initialChecked:r,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Mw(n,e){e=e.checked,e!=null&&Fg(n,"checked",e,!1)}function hm(n,e){Mw(n,e);var t=No(e.value),r=e.type;if(t!=null)r==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(r==="submit"||r==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?pm(n,e.type,t):e.hasOwnProperty("defaultValue")&&pm(n,e.type,No(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function Fv(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="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 pm(n,e,t){(e!=="number"||Vf(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var Kl=Array.isArray;function Ca(n,e,t,r){if(n=n.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=yu.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function _c(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var rc={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},RT=["Webkit","ms","Moz","O"];Object.keys(rc).forEach(function(n){RT.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),rc[e]=rc[n]})});function Pw(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||rc.hasOwnProperty(n)&&rc[n]?(""+e).trim():e+"px"}function Aw(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=Pw(t,e[t],r);t==="float"&&(t="cssFloat"),r?n.setProperty(t,i):n[t]=i}}var DT=Gt({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 vm(n,e){if(e){if(DT[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(ye(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(ye(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(ye(61))}if(e.style!=null&&typeof e.style!="object")throw Error(ye(62))}}function ym(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 _m=null;function zg(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var xm=null,Pa=null,Aa=null;function Uv(n){if(n=Qc(n)){if(typeof xm!="function")throw Error(ye(280));var e=n.stateNode;e&&(e=Fd(e),xm(n.stateNode,n.type,e))}}function Lw(n){Pa?Aa?Aa.push(n):Aa=[n]:Pa=n}function Rw(){if(Pa){var n=Pa,e=Aa;if(Aa=Pa=null,Uv(n),e)for(n=0;n>>=0,n===0?32:31-(HT(n)/GT|0)|0}var _u=64,xu=4194304;function Yl(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 jf(n,e){var t=n.pendingLanes;if(t===0)return 0;var r=0,i=n.suspendedLanes,o=n.pingedLanes,s=t&268435455;if(s!==0){var a=s&~i;a!==0?r=Yl(a):(o&=s,o!==0&&(r=Yl(o)))}else s=t&~i,s!==0?r=Yl(s):o!==0&&(r=Yl(o));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(r&4&&(r|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=r;0t;t++)e.push(n);return e}function qc(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-Gr(e),n[e]=t}function KT(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 r=n.eventTimes;for(n=n.expirationTimes;0=oc),Kv=String.fromCharCode(32),Yv=!1;function Zw(n,e){switch(n){case"keyup":return S3.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Qw(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var ma=!1;function M3(n,e){switch(n){case"compositionend":return Qw(e);case"keypress":return e.which!==32?null:(Yv=!0,Kv);case"textInput":return n=e.data,n===Kv&&Yv?null:n;default:return null}}function E3(n,e){if(ma)return n==="compositionend"||!Kg&&Zw(n,e)?(n=Yw(),Tf=Wg=mo=null,ma=!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=r}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=Jv(t)}}function nS(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?nS(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function rS(){for(var n=window,e=Vf();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=Vf(n.document)}return e}function Yg(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 k3(n){var e=rS(),t=n.focusedElem,r=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&nS(t.ownerDocument.documentElement,t)){if(r!==null&&Yg(t)){if(e=r.start,n=r.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 i=t.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!n.extend&&o>r&&(i=r,r=o,o=i),i=ey(t,o);var s=ey(t,r);i&&s&&(n.rangeCount!==1||n.anchorNode!==i.node||n.anchorOffset!==i.offset||n.focusNode!==s.node||n.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),n.removeAllRanges(),o>r?(n.addRange(e),n.extend(s.node,s.offset)):(e.setEnd(s.node,s.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,ga=null,Tm=null,ac=null,Cm=!1;function ty(n,e,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;Cm||ga==null||ga!==Vf(r)||(r=ga,"selectionStart"in r&&Yg(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ac&&Ec(ac,r)||(ac=r,r=Yf(Tm,"onSelect"),0_a||(n.current=Im[_a],Im[_a]=null,_a--)}function At(n,e){_a++,Im[_a]=n.current,n.current=e}var $o={},Fn=Wo($o),tr=Wo(!1),Ms=$o;function za(n,e){var t=n.type.contextTypes;if(!t)return $o;var r=n.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in t)i[o]=e[o];return r&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=i),i}function nr(n){return n=n.childContextTypes,n!=null}function Zf(){kt(tr),kt(Fn)}function ly(n,e,t){if(Fn.current!==$o)throw Error(ye(168));At(Fn,e),At(tr,t)}function dS(n,e,t){var r=n.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return t;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(ye(108,AT(n)||"Unknown",i));return Gt({},t,r)}function Qf(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||$o,Ms=Fn.current,At(Fn,n),At(tr,tr.current),!0}function cy(n,e,t){var r=n.stateNode;if(!r)throw Error(ye(169));t?(n=dS(n,e,Ms),r.__reactInternalMemoizedMergedChildContext=n,kt(tr),kt(Fn),At(Fn,n)):kt(tr),At(tr,t)}var Di=null,Nd=!1,Wh=!1;function hS(n){Di===null?Di=[n]:Di.push(n)}function j3(n){Nd=!0,hS(n)}function jo(){if(!Wh&&Di!==null){Wh=!0;var n=0,e=xt;try{var t=Di;for(xt=1;n>=s,i-=s,Oi=1<<32-Gr(e)+i|t<E?(A=L,L=null):A=L.sibling;var I=d(_,L,x[E],S);if(I===null){L===null&&(L=A);break}n&&L&&I.alternate===null&&e(_,L),y=o(I,y,E),C===null?T=I:C.sibling=I,C=I,L=A}if(E===x.length)return t(_,L),Ut&&os(_,E),T;if(L===null){for(;EE?(A=L,L=null):A=L.sibling;var q=d(_,L,I.value,S);if(q===null){L===null&&(L=A);break}n&&L&&q.alternate===null&&e(_,L),y=o(q,y,E),C===null?T=q:C.sibling=q,C=q,L=A}if(I.done)return t(_,L),Ut&&os(_,E),T;if(L===null){for(;!I.done;E++,I=x.next())I=u(_,I.value,S),I!==null&&(y=o(I,y,E),C===null?T=I:C.sibling=I,C=I);return Ut&&os(_,E),T}for(L=r(_,L);!I.done;E++,I=x.next())I=p(L,_,E,I.value,S),I!==null&&(n&&I.alternate!==null&&L.delete(I.key===null?E:I.key),y=o(I,y,E),C===null?T=I:C.sibling=I,C=I);return n&&L.forEach(function(ee){return e(_,ee)}),Ut&&os(_,E),T}function g(_,y,x,S){if(typeof x=="object"&&x!==null&&x.type===pa&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case gu:e:{for(var T=x.key,C=y;C!==null;){if(C.key===T){if(T=x.type,T===pa){if(C.tag===7){t(_,C.sibling),y=i(C,x.props.children),y.return=_,_=y;break e}}else if(C.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===co&&gy(T)===C.type){t(_,C.sibling),y=i(C,x.props),y.ref=Ml(_,C,x),y.return=_,_=y;break e}t(_,C);break}else e(_,C);C=C.sibling}x.type===pa?(y=Ss(x.props.children,_.mode,S,x.key),y.return=_,_=y):(S=kf(x.type,x.key,x.props,null,_.mode,S),S.ref=Ml(_,y,x),S.return=_,_=S)}return s(_);case ha:e:{for(C=x.key;y!==null;){if(y.key===C)if(y.tag===4&&y.stateNode.containerInfo===x.containerInfo&&y.stateNode.implementation===x.implementation){t(_,y.sibling),y=i(y,x.children||[]),y.return=_,_=y;break e}else{t(_,y);break}else e(_,y);y=y.sibling}y=Jh(x,_.mode,S),y.return=_,_=y}return s(_);case co:return C=x._init,g(_,y,C(x._payload),S)}if(Kl(x))return v(_,y,x,S);if(_l(x))return m(_,y,x,S);Cu(_,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,y!==null&&y.tag===6?(t(_,y.sibling),y=i(y,x),y.return=_,_=y):(t(_,y),y=Qh(x,_.mode,S),y.return=_,_=y),s(_)):t(_,y)}return g}var Va=wS(!0),SS=wS(!1),Jc={},fi=Wo(Jc),Ac=Wo(Jc),Lc=Wo(Jc);function _s(n){if(n===Jc)throw Error(ye(174));return n}function i0(n,e){switch(At(Lc,e),At(Ac,n),At(fi,Jc),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:gm(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=gm(e,n)}kt(fi),At(fi,e)}function Ha(){kt(fi),kt(Ac),kt(Lc)}function bS(n){_s(Lc.current);var e=_s(fi.current),t=gm(e,n.type);e!==t&&(At(Ac,n),At(fi,t))}function o0(n){Ac.current===n&&(kt(fi),kt(Ac))}var Bt=Wo(0);function id(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 jh=[];function s0(){for(var n=0;nt?t:4,n(!0);var r=Xh.transition;Xh.transition={};try{n(!1),e()}finally{xt=t,Xh.transition=r}}function US(){return Lr().memoizedState}function q3(n,e,t){var r=Po(n);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},zS(n))BS(e,t);else if(t=vS(n,e,t,r),t!==null){var i=Vn();Wr(t,n,r,i),VS(t,e,r)}}function Z3(n,e,t){var r=Po(n),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(zS(n))BS(e,i);else{var o=n.alternate;if(n.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,a=o(s,t);if(i.hasEagerState=!0,i.eagerState=a,Xr(a,s)){var l=e.interleaved;l===null?(i.next=i,n0(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}t=vS(n,e,i,r),t!==null&&(i=Vn(),Wr(t,n,r,i),VS(t,e,r))}}function zS(n){var e=n.alternate;return n===Vt||e!==null&&e===Vt}function BS(n,e){lc=od=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function VS(n,e,t){if(t&4194240){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,Vg(n,t)}}var sd={readContext:Ar,useCallback:Ln,useContext:Ln,useEffect:Ln,useImperativeHandle:Ln,useInsertionEffect:Ln,useLayoutEffect:Ln,useMemo:Ln,useReducer:Ln,useRef:Ln,useState:Ln,useDebugValue:Ln,useDeferredValue:Ln,useTransition:Ln,useMutableSource:Ln,useSyncExternalStore:Ln,useId:Ln,unstable_isNewReconciler:!1},Q3={readContext:Ar,useCallback:function(n,e){return ni().memoizedState=[n,e===void 0?null:e],n},useContext:Ar,useEffect:yy,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,Lf(4194308,4,kS.bind(null,e,n),t)},useLayoutEffect:function(n,e){return Lf(4194308,4,n,e)},useInsertionEffect:function(n,e){return Lf(4,2,n,e)},useMemo:function(n,e){var t=ni();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var r=ni();return e=t!==void 0?t(e):e,r.memoizedState=r.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},r.queue=n,n=n.dispatch=q3.bind(null,Vt,n),[r.memoizedState,n]},useRef:function(n){var e=ni();return n={current:n},e.memoizedState=n},useState:vy,useDebugValue:f0,useDeferredValue:function(n){return ni().memoizedState=n},useTransition:function(){var n=vy(!1),e=n[0];return n=Y3.bind(null,n[1]),ni().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var r=Vt,i=ni();if(Ut){if(t===void 0)throw Error(ye(407));t=t()}else{if(t=e(),vn===null)throw Error(ye(349));Ts&30||TS(r,e,t)}i.memoizedState=t;var o={value:t,getSnapshot:e};return i.queue=o,yy(PS.bind(null,r,o,n),[n]),r.flags|=2048,Ic(9,CS.bind(null,r,o,t,e),void 0,null),t},useId:function(){var n=ni(),e=vn.identifierPrefix;if(Ut){var t=Fi,r=Oi;t=(r&~(1<<32-Gr(r)-1)).toString(32)+t,e=":"+e+"R"+t,t=Rc++,0<\/script>",n=n.removeChild(n.firstChild)):typeof r.is=="string"?n=s.createElement(t,{is:r.is}):(n=s.createElement(t),t==="select"&&(s=n,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):n=s.createElementNS(n,t),n[si]=e,n[Pc]=r,ZS(n,e,!1,!1),e.stateNode=n;e:{switch(s=ym(t,r),t){case"dialog":Rt("cancel",n),Rt("close",n),i=r;break;case"iframe":case"object":case"embed":Rt("load",n),i=r;break;case"video":case"audio":for(i=0;iWa&&(e.flags|=128,r=!0,El(o,!1),e.lanes=4194304)}else{if(!r)if(n=id(s),n!==null){if(e.flags|=128,r=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),El(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!Ut)return Rn(e),null}else 2*tn()-o.renderingStartTime>Wa&&t!==1073741824&&(e.flags|=128,r=!0,El(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(t=o.last,t!==null?t.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=tn(),e.sibling=null,t=Bt.current,At(Bt,r?t&1|2:t&1),e):(Rn(e),null);case 22:case 23:return v0(),r=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?lr&1073741824&&(Rn(e),e.subtreeFlags&6&&(e.flags|=8192)):Rn(e),null;case 24:return null;case 25:return null}throw Error(ye(156,e.tag))}function sC(n,e){switch(Zg(e),e.tag){case 1:return nr(e.type)&&Zf(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Ha(),kt(tr),kt(Fn),s0(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return o0(e),null;case 13:if(kt(Bt),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(ye(340));Ba()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return kt(Bt),null;case 4:return Ha(),null;case 10:return t0(e.type._context),null;case 22:case 23:return v0(),null;case 24:return null;default:return null}}var Au=!1,kn=!1,aC=typeof WeakSet=="function"?WeakSet:Set,De=null;function ba(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){Xt(n,e,r)}else t.current=null}function Wm(n,e,t){try{t()}catch(r){Xt(n,e,r)}}var Cy=!1;function lC(n,e){if(Pm=Xf,n=rS(),Yg(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{t.nodeType,o.nodeType}catch{t=null;break e}var s=0,a=-1,l=-1,c=0,f=0,u=n,d=null;t:for(;;){for(var p;u!==t||i!==0&&u.nodeType!==3||(a=s+i),u!==o||r!==0&&u.nodeType!==3||(l=s+r),u.nodeType===3&&(s+=u.nodeValue.length),(p=u.firstChild)!==null;)d=u,u=p;for(;;){if(u===n)break t;if(d===t&&++c===i&&(a=s),d===o&&++f===r&&(l=s),(p=u.nextSibling)!==null)break;u=d,d=u.parentNode}u=p}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(Am={focusedElem:n,selectionRange:t},Xf=!1,De=e;De!==null;)if(e=De,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,De=n;else for(;De!==null;){e=De;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var m=v.memoizedProps,g=v.memoizedState,_=e.stateNode,y=_.getSnapshotBeforeUpdate(e.elementType===e.type?m:Br(e.type,m),g);_.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var x=e.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ye(163))}}catch(S){Xt(e,e.return,S)}if(n=e.sibling,n!==null){n.return=e.return,De=n;break}De=e.return}return v=Cy,Cy=!1,v}function cc(n,e,t){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&n)===n){var o=i.destroy;i.destroy=void 0,o!==void 0&&Wm(e,t,o)}i=i.next}while(i!==r)}}function zd(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 r=t.create;t.destroy=r()}t=t.next}while(t!==e)}}function jm(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 eb(n){var e=n.alternate;e!==null&&(n.alternate=null,eb(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[si],delete e[Pc],delete e[Dm],delete e[G3],delete e[W3])),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 tb(n){return n.tag===5||n.tag===3||n.tag===4}function Py(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||tb(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 Xm(n,e,t){var r=n.tag;if(r===5||r===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=qf));else if(r!==4&&(n=n.child,n!==null))for(Xm(n,e,t),n=n.sibling;n!==null;)Xm(n,e,t),n=n.sibling}function Km(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(r!==4&&(n=n.child,n!==null))for(Km(n,e,t),n=n.sibling;n!==null;)Km(n,e,t),n=n.sibling}var Sn=null,Vr=!1;function eo(n,e,t){for(t=t.child;t!==null;)nb(n,e,t),t=t.sibling}function nb(n,e,t){if(ui&&typeof ui.onCommitFiberUnmount=="function")try{ui.onCommitFiberUnmount(Dd,t)}catch{}switch(t.tag){case 5:kn||ba(t,e);case 6:var r=Sn,i=Vr;Sn=null,eo(n,e,t),Sn=r,Vr=i,Sn!==null&&(Vr?(n=Sn,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Sn.removeChild(t.stateNode));break;case 18:Sn!==null&&(Vr?(n=Sn,t=t.stateNode,n.nodeType===8?Gh(n.parentNode,t):n.nodeType===1&&Gh(n,t),bc(n)):Gh(Sn,t.stateNode));break;case 4:r=Sn,i=Vr,Sn=t.stateNode.containerInfo,Vr=!0,eo(n,e,t),Sn=r,Vr=i;break;case 0:case 11:case 14:case 15:if(!kn&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&Wm(t,e,s),i=i.next}while(i!==r)}eo(n,e,t);break;case 1:if(!kn&&(ba(t,e),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){Xt(t,e,a)}eo(n,e,t);break;case 21:eo(n,e,t);break;case 22:t.mode&1?(kn=(r=kn)||t.memoizedState!==null,eo(n,e,t),kn=r):eo(n,e,t);break;default:eo(n,e,t)}}function Ay(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new aC),e.forEach(function(r){var i=vC.bind(null,n,r);t.has(r)||(t.add(r),r.then(i,i))})}}function kr(n,e){var t=e.deletions;if(t!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=tn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*uC(r/1960))-r,10n?16:n,go===null)var r=!1;else{if(n=go,go=null,cd=0,ht&6)throw Error(ye(331));var i=ht;for(ht|=4,De=n.current;De!==null;){var o=De,s=o.child;if(De.flags&16){var a=o.deletions;if(a!==null){for(var l=0;ltn()-m0?ws(n,0):p0|=t),rr(n,e)}function ub(n,e){e===0&&(n.mode&1?(e=xu,xu<<=1,!(xu&130023424)&&(xu=4194304)):e=1);var t=Vn();n=ji(n,e),n!==null&&(qc(n,e,t),rr(n,t))}function gC(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),ub(n,t)}function vC(n,e){var t=0;switch(n.tag){case 13:var r=n.stateNode,i=n.memoizedState;i!==null&&(t=i.retryLane);break;case 19:r=n.stateNode;break;default:throw Error(ye(314))}r!==null&&r.delete(e),ub(n,t)}var fb;fb=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||tr.current)Jn=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Jn=!1,iC(n,e,t);Jn=!!(n.flags&131072)}else Jn=!1,Ut&&e.flags&1048576&&pS(e,ed,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Rf(n,e),n=e.pendingProps;var i=za(e,Fn.current);Ra(e,t),i=l0(null,e,r,n,i,t);var o=c0();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,nr(r)?(o=!0,Qf(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,r0(e),i.updater=$d,e.stateNode=i,i._reactInternals=e,$m(e,r,n,t),e=Bm(null,e,r,!0,o,t)):(e.tag=0,Ut&&o&&qg(e),zn(null,e,i,t),e=e.child),e;case 16:r=e.elementType;e:{switch(Rf(n,e),n=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=_C(r),n=Br(r,n),i){case 0:e=zm(null,e,r,n,t);break e;case 1:e=My(null,e,r,n,t);break e;case 11:e=Sy(null,e,r,n,t);break e;case 14:e=by(null,e,r,Br(r.type,n),t);break e}throw Error(ye(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Br(r,i),zm(n,e,r,i,t);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Br(r,i),My(n,e,r,i,t);case 3:e:{if(KS(e),n===null)throw Error(ye(387));r=e.pendingProps,o=e.memoizedState,i=o.element,yS(n,e),rd(e,r,null,t);var s=e.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=Ga(Error(ye(423)),e),e=Ey(n,e,r,t,i);break e}else if(r!==i){i=Ga(Error(ye(424)),e),e=Ey(n,e,r,t,i);break e}else for(ur=Eo(e.stateNode.containerInfo.firstChild),fr=e,Ut=!0,Hr=null,t=SS(e,null,r,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Ba(),r===i){e=Xi(n,e,t);break e}zn(n,e,r,t)}e=e.child}return e;case 5:return bS(e),n===null&&Om(e),r=e.type,i=e.pendingProps,o=n!==null?n.memoizedProps:null,s=i.children,Lm(r,i)?s=null:o!==null&&Lm(r,o)&&(e.flags|=32),XS(n,e),zn(n,e,s,t),e.child;case 6:return n===null&&Om(e),null;case 13:return YS(n,e,t);case 4:return i0(e,e.stateNode.containerInfo),r=e.pendingProps,n===null?e.child=Va(e,null,r,t):zn(n,e,r,t),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Br(r,i),Sy(n,e,r,i,t);case 7:return zn(n,e,e.pendingProps,t),e.child;case 8:return zn(n,e,e.pendingProps.children,t),e.child;case 12:return zn(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,At(td,r._currentValue),r._currentValue=s,o!==null)if(Xr(o.value,s)){if(o.children===i.children&&!tr.current){e=Xi(n,e,t);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var a=o.dependencies;if(a!==null){s=o.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=Ui(-1,t&-t),l.tag=2;var c=o.updateQueue;if(c!==null){c=c.shared;var f=c.pending;f===null?l.next=l:(l.next=f.next,f.next=l),c.pending=l}}o.lanes|=t,l=o.alternate,l!==null&&(l.lanes|=t),Fm(o.return,t,e),a.lanes|=t;break}l=l.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(ye(341));s.lanes|=t,a=s.alternate,a!==null&&(a.lanes|=t),Fm(s,t,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}zn(n,e,i.children,t),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Ra(e,t),i=Ar(i),r=r(i),e.flags|=1,zn(n,e,r,t),e.child;case 14:return r=e.type,i=Br(r,e.pendingProps),i=Br(r.type,i),by(n,e,r,i,t);case 15:return WS(n,e,e.type,e.pendingProps,t);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Br(r,i),Rf(n,e),e.tag=1,nr(r)?(n=!0,Qf(e)):n=!1,Ra(e,t),xS(e,r,i),$m(e,r,i,t),Bm(null,e,r,!0,n,t);case 19:return qS(n,e,t);case 22:return jS(n,e,t)}throw Error(ye(156,e.tag))};function db(n,e){return $w(n,e)}function yC(n,e,t,r){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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Tr(n,e,t,r){return new yC(n,e,t,r)}function _0(n){return n=n.prototype,!(!n||!n.isReactComponent)}function _C(n){if(typeof n=="function")return _0(n)?1:0;if(n!=null){if(n=n.$$typeof,n===$g)return 11;if(n===Ug)return 14}return 2}function Ao(n,e){var t=n.alternate;return t===null?(t=Tr(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 kf(n,e,t,r,i,o){var s=2;if(r=n,typeof n=="function")_0(n)&&(s=1);else if(typeof n=="string")s=5;else e:switch(n){case pa:return Ss(t.children,i,o,e);case Ng:s=8,i|=8;break;case lm:return n=Tr(12,t,e,i|2),n.elementType=lm,n.lanes=o,n;case cm:return n=Tr(13,t,e,i),n.elementType=cm,n.lanes=o,n;case um:return n=Tr(19,t,e,i),n.elementType=um,n.lanes=o,n;case ww:return Vd(t,i,o,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case _w:s=10;break e;case xw:s=9;break e;case $g:s=11;break e;case Ug:s=14;break e;case co:s=16,r=null;break e}throw Error(ye(130,n==null?n:typeof n,""))}return e=Tr(s,t,e,i),e.elementType=n,e.type=r,e.lanes=o,e}function Ss(n,e,t,r){return n=Tr(7,n,r,e),n.lanes=t,n}function Vd(n,e,t,r){return n=Tr(22,n,r,e),n.elementType=ww,n.lanes=t,n.stateNode={isHidden:!1},n}function Qh(n,e,t){return n=Tr(6,n,null,e),n.lanes=t,n}function Jh(n,e,t){return e=Tr(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function xC(n,e,t,r,i){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=Ih(0),this.expirationTimes=Ih(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ih(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function x0(n,e,t,r,i,o,s,a,l){return n=new xC(n,e,t,a,l),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Tr(3,null,null,e),n.current=o,o.stateNode=n,o.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},r0(o),n}function wC(n,e,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}e(),n.exports=pr})(ST);const TC=ow(Fo),As=b.forwardRef((n,e)=>{const{children:t,...r}=n,i=b.Children.toArray(t),o=i.find(CC);if(o){const s=o.props.children,a=i.map(l=>l===o?b.Children.count(s)>1?b.Children.only(null):b.isValidElement(s)?s.props.children:null:l);return b.createElement(Jm,Se({},r,{ref:e}),b.isValidElement(s)?b.cloneElement(s,void 0,a):null)}return b.createElement(Jm,Se({},r,{ref:e}),t)});As.displayName="Slot";const Jm=b.forwardRef((n,e)=>{const{children:t,...r}=n;return b.isValidElement(t)?b.cloneElement(t,{...PC(r,t.props),ref:mw(e,t.ref)}):b.Children.count(t)>1?b.Children.only(null):null});Jm.displayName="SlotClone";const gb=({children:n})=>b.createElement(b.Fragment,null,n);function CC(n){return b.isValidElement(n)&&n.type===gb}function PC(n,e){const t={...e};for(const r in e){const i=n[r],o=e[r];/^on[A-Z]/.test(r)?i&&o?t[r]=(...a)=>{o(...a),i(...a)}:i&&(t[r]=i):r==="style"?t[r]={...i,...o}:r==="className"&&(t[r]=[i,o].filter(Boolean).join(" "))}return{...n,...t}}const AC=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],vt=AC.reduce((n,e)=>{const t=b.forwardRef((r,i)=>{const{asChild:o,...s}=r,a=o?As:e;return b.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),b.createElement(a,Se({},s,{ref:i}))});return t.displayName=`Primitive.${e}`,{...n,[e]:t}},{});function M0(n,e){n&&Fo.flushSync(()=>n.dispatchEvent(e))}function LC(n,e=globalThis?.document){const t=Hn(n);b.useEffect(()=>{const r=i=>{i.key==="Escape"&&t(i)};return e.addEventListener("keydown",r),()=>e.removeEventListener("keydown",r)},[t,e])}const eg="dismissableLayer.update",RC="dismissableLayer.pointerDownOutside",DC="dismissableLayer.focusOutside";let Ny;const vb=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Xd=b.forwardRef((n,e)=>{var t;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=n,f=b.useContext(vb),[u,d]=b.useState(null),p=(t=u?.ownerDocument)!==null&&t!==void 0?t:globalThis?.document,[,v]=b.useState({}),m=Ot(e,E=>d(E)),g=Array.from(f.layers),[_]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),y=g.indexOf(_),x=u?g.indexOf(u):-1,S=f.layersWithOutsidePointerEventsDisabled.size>0,T=x>=y,C=kC(E=>{const A=E.target,I=[...f.branches].some(q=>q.contains(A));!T||I||(o?.(E),a?.(E),E.defaultPrevented||l?.())},p),L=OC(E=>{const A=E.target;[...f.branches].some(q=>q.contains(A))||(s?.(E),a?.(E),E.defaultPrevented||l?.())},p);return LC(E=>{x===f.layers.size-1&&(i?.(E),!E.defaultPrevented&&l&&(E.preventDefault(),l()))},p),b.useEffect(()=>{if(u)return r&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Ny=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(u)),f.layers.add(u),$y(),()=>{r&&f.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=Ny)}},[u,p,r,f]),b.useEffect(()=>()=>{u&&(f.layers.delete(u),f.layersWithOutsidePointerEventsDisabled.delete(u),$y())},[u,f]),b.useEffect(()=>{const E=()=>v({});return document.addEventListener(eg,E),()=>document.removeEventListener(eg,E)},[]),b.createElement(vt.div,Se({},c,{ref:m,style:{pointerEvents:S?T?"auto":"none":void 0,...n.style},onFocusCapture:Ve(n.onFocusCapture,L.onFocusCapture),onBlurCapture:Ve(n.onBlurCapture,L.onBlurCapture),onPointerDownCapture:Ve(n.onPointerDownCapture,C.onPointerDownCapture)}))}),IC=b.forwardRef((n,e)=>{const t=b.useContext(vb),r=b.useRef(null),i=Ot(e,r);return b.useEffect(()=>{const o=r.current;if(o)return t.branches.add(o),()=>{t.branches.delete(o)}},[t.branches]),b.createElement(vt.div,Se({},n,{ref:i}))});function kC(n,e=globalThis?.document){const t=Hn(n),r=b.useRef(!1),i=b.useRef(()=>{});return b.useEffect(()=>{const o=a=>{if(a.target&&!r.current){let c=function(){yb(RC,t,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=c,e.addEventListener("click",i.current,{once:!0})):c()}r.current=!1},s=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(s),e.removeEventListener("pointerdown",o),e.removeEventListener("click",i.current)}},[e,t]),{onPointerDownCapture:()=>r.current=!0}}function OC(n,e=globalThis?.document){const t=Hn(n),r=b.useRef(!1);return b.useEffect(()=>{const i=o=>{o.target&&!r.current&&yb(DC,t,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,t]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function $y(){const n=new CustomEvent(eg);document.dispatchEvent(n)}function yb(n,e,t,{discrete:r}){const i=t.originalEvent.target,o=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:t});e&&i.addEventListener(n,e,{once:!0}),r?M0(i,o):i.dispatchEvent(o)}const FC=Xd,NC=IC,ep="focusScope.autoFocusOnMount",tp="focusScope.autoFocusOnUnmount",Uy={bubbles:!1,cancelable:!0},E0=b.forwardRef((n,e)=>{const{loop:t=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=n,[a,l]=b.useState(null),c=Hn(i),f=Hn(o),u=b.useRef(null),d=Ot(e,m=>l(m)),p=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let m=function(_){if(p.paused||!a)return;const y=_.target;a.contains(y)?u.current=y:as(u.current,{select:!0})},g=function(_){p.paused||!a||a.contains(_.relatedTarget)||as(u.current,{select:!0})};return document.addEventListener("focusin",m),document.addEventListener("focusout",g),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",g)}}},[r,a,p.paused]),b.useEffect(()=>{if(a){By.add(p);const m=document.activeElement;if(!a.contains(m)){const _=new CustomEvent(ep,Uy);a.addEventListener(ep,c),a.dispatchEvent(_),_.defaultPrevented||($C(HC(_b(a)),{select:!0}),document.activeElement===m&&as(a))}return()=>{a.removeEventListener(ep,c),setTimeout(()=>{const _=new CustomEvent(tp,Uy);a.addEventListener(tp,f),a.dispatchEvent(_),_.defaultPrevented||as(m??document.body,{select:!0}),a.removeEventListener(tp,f),By.remove(p)},0)}}},[a,c,f,p]);const v=b.useCallback(m=>{if(!t&&!r||p.paused)return;const g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,_=document.activeElement;if(g&&_){const y=m.currentTarget,[x,S]=UC(y);x&&S?!m.shiftKey&&_===S?(m.preventDefault(),t&&as(x,{select:!0})):m.shiftKey&&_===x&&(m.preventDefault(),t&&as(S,{select:!0})):_===y&&m.preventDefault()}},[t,r,p.paused]);return b.createElement(vt.div,Se({tabIndex:-1},s,{ref:d,onKeyDown:v}))});function $C(n,{select:e=!1}={}){const t=document.activeElement;for(const r of n)if(as(r,{select:e}),document.activeElement!==t)return}function UC(n){const e=_b(n),t=zy(e,n),r=zy(e.reverse(),n);return[t,r]}function _b(n){const e=[],t=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)e.push(t.currentNode);return e}function zy(n,e){for(const t of n)if(!zC(t,{upTo:e}))return t}function zC(n,{upTo:e}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(e!==void 0&&n===e)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function BC(n){return n instanceof HTMLInputElement&&"select"in n}function as(n,{select:e=!1}={}){if(n&&n.focus){const t=document.activeElement;n.focus({preventScroll:!0}),n!==t&&BC(n)&&e&&n.select()}}const By=VC();function VC(){let n=[];return{add(e){const t=n[0];e!==t&&t?.pause(),n=Vy(n,e),n.unshift(e)},remove(e){var t;n=Vy(n,e),(t=n[0])===null||t===void 0||t.resume()}}}function Vy(n,e){const t=[...n],r=t.indexOf(e);return r!==-1&&t.splice(r,1),t}function HC(n){return n.filter(e=>e.tagName!=="A")}const Kd=b.forwardRef((n,e)=>{var t;const{container:r=globalThis==null||(t=globalThis.document)===null||t===void 0?void 0:t.body,...i}=n;return r?TC.createPortal(b.createElement(vt.div,Se({},i,{ref:e})),r):null});function GC(n,e){return b.useReducer((t,r)=>{const i=e[t][r];return i??t},n)}const yi=n=>{const{present:e,children:t}=n,r=WC(e),i=typeof t=="function"?t({present:r.isPresent}):b.Children.only(t),o=Ot(r.ref,i.ref);return typeof t=="function"||r.isPresent?b.cloneElement(i,{ref:o}):null};yi.displayName="Presence";function WC(n){const[e,t]=b.useState(),r=b.useRef({}),i=b.useRef(n),o=b.useRef("none"),s=n?"mounted":"unmounted",[a,l]=GC(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const c=Du(r.current);o.current=a==="mounted"?c:"none"},[a]),ki(()=>{const c=r.current,f=i.current;if(f!==n){const d=o.current,p=Du(c);n?l("MOUNT"):p==="none"||c?.display==="none"?l("UNMOUNT"):l(f&&d!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=n}},[n,l]),ki(()=>{if(e){const c=u=>{const p=Du(r.current).includes(u.animationName);u.target===e&&p&&Fo.flushSync(()=>l("ANIMATION_END"))},f=u=>{u.target===e&&(o.current=Du(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",c),e.addEventListener("animationend",c),()=>{e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",c),e.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:b.useCallback(c=>{c&&(r.current=getComputedStyle(c)),t(c)},[])}}function Du(n){return n?.animationName||"none"}let np=0;function T0(){b.useEffect(()=>{var n,e;const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(n=t[0])!==null&&n!==void 0?n:Hy()),document.body.insertAdjacentElement("beforeend",(e=t[1])!==null&&e!==void 0?e:Hy()),np++,()=>{np===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),np--}},[])}function Hy(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",n}var ai=function(){return ai=Object.assign||function(e){for(var t,r=1,i=arguments.length;r"u")return lP;var e=cP(n),t=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-t+e[2]-e[0])}},fP=bb(),dP=function(n,e,t,r){var i=n.left,o=n.top,s=n.right,a=n.gap;return t===void 0&&(t="margin"),` .`.concat(XC,` { overflow: hidden `).concat(r,`; padding-right: `).concat(a,"px ").concat(r,`; } body { overflow: hidden `).concat(r,`; overscroll-behavior: contain; `).concat([e&&"position: relative ".concat(r,";"),t==="margin"&&` padding-left: `.concat(i,`px; padding-top: `).concat(o,`px; padding-right: `).concat(s,`px; margin-left:0; margin-top:0; margin-right: `).concat(a,"px ").concat(r,`; `),t==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),` } .`).concat(Of,` { right: `).concat(a,"px ").concat(r,`; } .`).concat(Ff,` { margin-right: `).concat(a,"px ").concat(r,`; } .`).concat(Of," .").concat(Of,` { right: 0 `).concat(r,`; } .`).concat(Ff," .").concat(Ff,` { margin-right: 0 `).concat(r,`; } body { `).concat(KC,": ").concat(a,`px; } `)},hP=function(n){var e=n.noRelative,t=n.noImportant,r=n.gapMode,i=r===void 0?"margin":r,o=b.useMemo(function(){return uP(i)},[i]);return b.createElement(fP,{styles:dP(o,!e,i,t?"":"!important")})},tg=!1;if(typeof window<"u")try{var Iu=Object.defineProperty({},"passive",{get:function(){return tg=!0,!0}});window.addEventListener("test",Iu,Iu),window.removeEventListener("test",Iu,Iu)}catch{tg=!1}var zs=tg?{passive:!1}:!1,pP=function(n){return n.tagName==="TEXTAREA"},Mb=function(n,e){var t=window.getComputedStyle(n);return t[e]!=="hidden"&&!(t.overflowY===t.overflowX&&!pP(n)&&t[e]==="visible")},mP=function(n){return Mb(n,"overflowY")},gP=function(n){return Mb(n,"overflowX")},Wy=function(n,e){var t=e;do{typeof ShadowRoot<"u"&&t instanceof ShadowRoot&&(t=t.host);var r=Eb(n,t);if(r){var i=Tb(n,t),o=i[1],s=i[2];if(o>s)return!0}t=t.parentNode}while(t&&t!==document.body);return!1},vP=function(n){var e=n.scrollTop,t=n.scrollHeight,r=n.clientHeight;return[e,t,r]},yP=function(n){var e=n.scrollLeft,t=n.scrollWidth,r=n.clientWidth;return[e,t,r]},Eb=function(n,e){return n==="v"?mP(e):gP(e)},Tb=function(n,e){return n==="v"?vP(e):yP(e)},_P=function(n,e){return n==="h"&&e==="rtl"?-1:1},xP=function(n,e,t,r,i){var o=_P(n,window.getComputedStyle(e).direction),s=o*r,a=t.target,l=e.contains(a),c=!1,f=s>0,u=0,d=0;do{var p=Tb(n,a),v=p[0],m=p[1],g=p[2],_=m-g-o*v;(v||_)&&Eb(n,a)&&(u+=_,d+=v),a=a.parentNode}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(f&&(i&&u===0||!i&&s>u)||!f&&(i&&d===0||!i&&-s>d))&&(c=!0),c},ku=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},jy=function(n){return[n.deltaX,n.deltaY]},Xy=function(n){return n&&"current"in n?n.current:n},wP=function(n,e){return n[0]===e[0]&&n[1]===e[1]},SP=function(n){return` .block-interactivity-`.concat(n,` {pointer-events: none;} .allow-interactivity-`).concat(n,` {pointer-events: all;} `)},bP=0,Bs=[];function MP(n){var e=b.useRef([]),t=b.useRef([0,0]),r=b.useRef(),i=b.useState(bP++)[0],o=b.useState(function(){return bb()})[0],s=b.useRef(n);b.useEffect(function(){s.current=n},[n]),b.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(i));var m=jC([n.lockRef.current],(n.shards||[]).map(Xy),!0).filter(Boolean);return m.forEach(function(g){return g.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(i))})}}},[n.inert,n.lockRef.current,n.shards]);var a=b.useCallback(function(m,g){if("touches"in m&&m.touches.length===2)return!s.current.allowPinchZoom;var _=ku(m),y=t.current,x="deltaX"in m?m.deltaX:y[0]-_[0],S="deltaY"in m?m.deltaY:y[1]-_[1],T,C=m.target,L=Math.abs(x)>Math.abs(S)?"h":"v";if("touches"in m&&L==="h"&&C.type==="range")return!1;var E=Wy(L,C);if(!E)return!0;if(E?T=L:(T=L==="v"?"h":"v",E=Wy(L,C)),!E)return!1;if(!r.current&&"changedTouches"in m&&(x||S)&&(r.current=T),!T)return!0;var A=r.current||T;return xP(A,g,m,A==="h"?x:S,!0)},[]),l=b.useCallback(function(m){var g=m;if(!(!Bs.length||Bs[Bs.length-1]!==o)){var _="deltaY"in g?jy(g):ku(g),y=e.current.filter(function(T){return T.name===g.type&&T.target===g.target&&wP(T.delta,_)})[0];if(y&&y.should){g.cancelable&&g.preventDefault();return}if(!y){var x=(s.current.shards||[]).map(Xy).filter(Boolean).filter(function(T){return T.contains(g.target)}),S=x.length>0?a(g,x[0]):!s.current.noIsolation;S&&g.cancelable&&g.preventDefault()}}},[]),c=b.useCallback(function(m,g,_,y){var x={name:m,delta:g,target:_,should:y};e.current.push(x),setTimeout(function(){e.current=e.current.filter(function(S){return S!==x})},1)},[]),f=b.useCallback(function(m){t.current=ku(m),r.current=void 0},[]),u=b.useCallback(function(m){c(m.type,jy(m),m.target,a(m,n.lockRef.current))},[]),d=b.useCallback(function(m){c(m.type,ku(m),m.target,a(m,n.lockRef.current))},[]);b.useEffect(function(){return Bs.push(o),n.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:d}),document.addEventListener("wheel",l,zs),document.addEventListener("touchmove",l,zs),document.addEventListener("touchstart",f,zs),function(){Bs=Bs.filter(function(m){return m!==o}),document.removeEventListener("wheel",l,zs),document.removeEventListener("touchmove",l,zs),document.removeEventListener("touchstart",f,zs)}},[]);var p=n.removeScrollBar,v=n.inert;return b.createElement(b.Fragment,null,v?b.createElement(o,{styles:SP(i)}):null,p?b.createElement(hP,{gapMode:"margin"}):null)}const EP=tP(Sb,MP);var Cb=b.forwardRef(function(n,e){return b.createElement(Yd,ai({},n,{ref:e,sideCar:EP}))});Cb.classNames=Yd.classNames;const C0=Cb;var TP=function(n){if(typeof document>"u")return null;var e=Array.isArray(n)?n[0]:n;return e.ownerDocument.body},Vs=new WeakMap,Ou=new WeakMap,Fu={},op=0,Pb=function(n){return n&&(n.host||Pb(n.parentNode))},CP=function(n,e){return e.map(function(t){if(n.contains(t))return t;var r=Pb(t);return r&&n.contains(r)?r:(console.error("aria-hidden",t,"in not contained inside",n,". Doing nothing"),null)}).filter(function(t){return Boolean(t)})},PP=function(n,e,t,r){var i=CP(e,Array.isArray(n)?n:[n]);Fu[t]||(Fu[t]=new WeakMap);var o=Fu[t],s=[],a=new Set,l=new Set(i),c=function(u){!u||a.has(u)||(a.add(u),c(u.parentNode))};i.forEach(c);var f=function(u){!u||l.has(u)||Array.prototype.forEach.call(u.children,function(d){if(a.has(d))f(d);else{var p=d.getAttribute(r),v=p!==null&&p!=="false",m=(Vs.get(d)||0)+1,g=(o.get(d)||0)+1;Vs.set(d,m),o.set(d,g),s.push(d),m===1&&v&&Ou.set(d,!0),g===1&&d.setAttribute(t,"true"),v||d.setAttribute(r,"true")}})};return f(e),a.clear(),op++,function(){s.forEach(function(u){var d=Vs.get(u)-1,p=o.get(u)-1;Vs.set(u,d),o.set(u,p),d||(Ou.has(u)||u.removeAttribute(r),Ou.delete(u)),p||u.removeAttribute(t)}),op--,op||(Vs=new WeakMap,Vs=new WeakMap,Ou=new WeakMap,Fu={})}},P0=function(n,e,t){t===void 0&&(t="data-aria-hidden");var r=Array.from(Array.isArray(n)?n:[n]),i=e||TP(n);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),PP(r,i,t,"aria-hidden")):function(){return null}};const Ab="Dialog",[Lb,Rb]=vi(Ab),[AP,_i]=Lb(Ab),LP=n=>{const{__scopeDialog:e,children:t,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=n,a=b.useRef(null),l=b.useRef(null),[c=!1,f]=el({prop:r,defaultProp:i,onChange:o});return b.createElement(AP,{scope:e,triggerRef:a,contentRef:l,contentId:wo(),titleId:wo(),descriptionId:wo(),open:c,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(u=>!u),[f]),modal:s},t)},Db="DialogPortal",[RP,Ib]=Lb(Db,{forceMount:void 0}),DP=n=>{const{__scopeDialog:e,forceMount:t,children:r,container:i}=n,o=_i(Db,e);return b.createElement(RP,{scope:e,forceMount:t},b.Children.map(r,s=>b.createElement(yi,{present:t||o.open},b.createElement(Kd,{asChild:!0,container:i},s))))},ng="DialogOverlay",IP=b.forwardRef((n,e)=>{const t=Ib(ng,n.__scopeDialog),{forceMount:r=t.forceMount,...i}=n,o=_i(ng,n.__scopeDialog);return o.modal?b.createElement(yi,{present:r||o.open},b.createElement(kP,Se({},i,{ref:e}))):null}),kP=b.forwardRef((n,e)=>{const{__scopeDialog:t,...r}=n,i=_i(ng,t);return b.createElement(C0,{as:As,allowPinchZoom:!0,shards:[i.contentRef]},b.createElement(vt.div,Se({"data-state":Fb(i.open)},r,{ref:e,style:{pointerEvents:"auto",...r.style}})))}),ja="DialogContent",OP=b.forwardRef((n,e)=>{const t=Ib(ja,n.__scopeDialog),{forceMount:r=t.forceMount,...i}=n,o=_i(ja,n.__scopeDialog);return b.createElement(yi,{present:r||o.open},o.modal?b.createElement(FP,Se({},i,{ref:e})):b.createElement(NP,Se({},i,{ref:e})))}),FP=b.forwardRef((n,e)=>{const t=_i(ja,n.__scopeDialog),r=b.useRef(null),i=Ot(e,t.contentRef,r);return b.useEffect(()=>{const o=r.current;if(o)return P0(o)},[]),b.createElement(kb,Se({},n,{ref:i,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ve(n.onCloseAutoFocus,o=>{var s;o.preventDefault(),(s=t.triggerRef.current)===null||s===void 0||s.focus()}),onPointerDownOutside:Ve(n.onPointerDownOutside,o=>{const s=o.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&o.preventDefault()}),onFocusOutside:Ve(n.onFocusOutside,o=>o.preventDefault())}))}),NP=b.forwardRef((n,e)=>{const t=_i(ja,n.__scopeDialog),r=b.useRef(!1);return b.createElement(kb,Se({},n,{ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o;if((o=n.onCloseAutoFocus)===null||o===void 0||o.call(n,i),!i.defaultPrevented){var s;r.current||(s=t.triggerRef.current)===null||s===void 0||s.focus(),i.preventDefault()}r.current=!1},onInteractOutside:i=>{var o,s;(o=n.onInteractOutside)===null||o===void 0||o.call(n,i),i.defaultPrevented||(r.current=!0);const a=i.target;((s=t.triggerRef.current)===null||s===void 0?void 0:s.contains(a))&&i.preventDefault()}}))}),kb=b.forwardRef((n,e)=>{const{__scopeDialog:t,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=n,a=_i(ja,t),l=b.useRef(null),c=Ot(e,l);return T0(),b.createElement(b.Fragment,null,b.createElement(E0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o},b.createElement(Xd,Se({role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Fb(a.open)},s,{ref:c,onDismiss:()=>a.onOpenChange(!1)}))),!1)}),Ob="DialogTitle",$P=b.forwardRef((n,e)=>{const{__scopeDialog:t,...r}=n,i=_i(Ob,t);return b.createElement(vt.h2,Se({id:i.titleId},r,{ref:e}))}),UP="DialogDescription",zP=b.forwardRef((n,e)=>{const{__scopeDialog:t,...r}=n,i=_i(UP,t);return b.createElement(vt.p,Se({id:i.descriptionId},r,{ref:e}))}),BP="DialogClose",VP=b.forwardRef((n,e)=>{const{__scopeDialog:t,...r}=n,i=_i(BP,t);return b.createElement(vt.button,Se({type:"button"},r,{ref:e,onClick:Ve(n.onClick,()=>i.onOpenChange(!1))}))});function Fb(n){return n?"open":"closed"}const HP="DialogTitleWarning",[GP,z7]=vT(HP,{contentName:ja,titleName:Ob,docsSlug:"dialog"}),Nb=LP,$b=DP,Ub=IP,zb=OP,Bb=$P,WP=zP,Ky=VP;function Xo(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o=0)&&(t[i]=n[i]);return t}var jP=["color"],Cl=b.forwardRef(function(n,e){var t=n.color,r=t===void 0?"currentColor":t,i=Xo(n,jP);return b.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:e}),b.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),XP=["color"],KP=b.forwardRef(function(n,e){var t=n.color,r=t===void 0?"currentColor":t,i=Xo(n,XP);return b.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:e}),b.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),YP=["color"],qP=b.forwardRef(function(n,e){var t=n.color,r=t===void 0?"currentColor":t,i=Xo(n,YP);return b.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:e}),b.createElement("path",{d:"M9.875 7.5C9.875 8.81168 8.81168 9.875 7.5 9.875C6.18832 9.875 5.125 8.81168 5.125 7.5C5.125 6.18832 6.18832 5.125 7.5 5.125C8.81168 5.125 9.875 6.18832 9.875 7.5Z",fill:r}))}),ZP=["color"],QP=b.forwardRef(function(n,e){var t=n.color,r=t===void 0?"currentColor":t,i=Xo(n,ZP);return b.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:e}),b.createElement("path",{d:"M5 4.63601C5 3.76031 5.24219 3.1054 5.64323 2.67357C6.03934 2.24705 6.64582 1.9783 7.5014 1.9783C8.35745 1.9783 8.96306 2.24652 9.35823 2.67208C9.75838 3.10299 10 3.75708 10 4.63325V5.99999H5V4.63601ZM4 5.99999V4.63601C4 3.58148 4.29339 2.65754 4.91049 1.99307C5.53252 1.32329 6.42675 0.978302 7.5014 0.978302C8.57583 0.978302 9.46952 1.32233 10.091 1.99162C10.7076 2.65557 11 3.57896 11 4.63325V5.99999H12C12.5523 5.99999 13 6.44771 13 6.99999V13C13 13.5523 12.5523 14 12 14H3C2.44772 14 2 13.5523 2 13V6.99999C2 6.44771 2.44772 5.99999 3 5.99999H4ZM3 6.99999H12V13H3V6.99999Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),JP=["color"],eA=b.forwardRef(function(n,e){var t=n.color,r=t===void 0?"currentColor":t,i=Xo(n,JP);return b.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:e}),b.createElement("path",{d:"M9 3.63601C9 2.76044 9.24207 2.11211 9.64154 1.68623C10.0366 1.26502 10.6432 1 11.5014 1C12.4485 1 13.0839 1.30552 13.4722 1.80636C13.8031 2.23312 14 2.84313 14 3.63325H15C15 2.68242 14.7626 1.83856 14.2625 1.19361C13.6389 0.38943 12.6743 0 11.5014 0C10.4294 0 9.53523 0.337871 8.91218 1.0021C8.29351 1.66167 8 2.58135 8 3.63601V6H1C0.447715 6 0 6.44772 0 7V13C0 13.5523 0.447715 14 1 14H10C10.5523 14 11 13.5523 11 13V7C11 6.44772 10.5523 6 10 6H9V3.63601ZM1 7H10V13H1V7Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),tA=["color"],nA=b.forwardRef(function(n,e){var t=n.color,r=t===void 0?"currentColor":t,i=Xo(n,tA);return b.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:e}),b.createElement("path",{d:"M2.05005 13.5C2.05005 13.7485 2.25152 13.95 2.50005 13.95C2.74858 13.95 2.95005 13.7485 2.95005 13.5L2.95005 1.49995C2.95005 1.25142 2.74858 1.04995 2.50005 1.04995C2.25152 1.04995 2.05005 1.25142 2.05005 1.49995L2.05005 13.5ZM8.4317 11.0681C8.60743 11.2439 8.89236 11.2439 9.06809 11.0681C9.24383 10.8924 9.24383 10.6075 9.06809 10.4317L6.58629 7.94993L14.5 7.94993C14.7485 7.94993 14.95 7.74846 14.95 7.49993C14.95 7.2514 14.7485 7.04993 14.5 7.04993L6.58629 7.04993L9.06809 4.56813C9.24383 4.39239 9.24383 4.10746 9.06809 3.93173C8.89236 3.75599 8.60743 3.75599 8.4317 3.93173L5.1817 7.18173C5.00596 7.35746 5.00596 7.64239 5.1817 7.81812L8.4317 11.0681Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),rA=["color"],iA=b.forwardRef(function(n,e){var t=n.color,r=t===void 0?"currentColor":t,i=Xo(n,rA);return b.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:e}),b.createElement("path",{d:"M4.85355 2.14645C5.04882 2.34171 5.04882 2.65829 4.85355 2.85355L3.70711 4H9C11.4853 4 13.5 6.01472 13.5 8.5C13.5 10.9853 11.4853 13 9 13H5C4.72386 13 4.5 12.7761 4.5 12.5C4.5 12.2239 4.72386 12 5 12H9C10.933 12 12.5 10.433 12.5 8.5C12.5 6.567 10.933 5 9 5H3.70711L4.85355 6.14645C5.04882 6.34171 5.04882 6.65829 4.85355 6.85355C4.65829 7.04882 4.34171 7.04882 4.14645 6.85355L2.14645 4.85355C1.95118 4.65829 1.95118 4.34171 2.14645 4.14645L4.14645 2.14645C4.34171 1.95118 4.65829 1.95118 4.85355 2.14645Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),oA=["color"],sA=b.forwardRef(function(n,e){var t=n.color,r=t===void 0?"currentColor":t,i=Xo(n,oA);return b.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:e}),b.createElement("path",{d:"M3.04995 2.74995C3.04995 2.44619 2.80371 2.19995 2.49995 2.19995C2.19619 2.19995 1.94995 2.44619 1.94995 2.74995V12.25C1.94995 12.5537 2.19619 12.8 2.49995 12.8C2.80371 12.8 3.04995 12.5537 3.04995 12.25V2.74995ZM5.73333 2.30776C5.57835 2.22596 5.39185 2.23127 5.24177 2.32176C5.0917 2.41225 4.99995 2.57471 4.99995 2.74995V12.25C4.99995 12.4252 5.0917 12.5877 5.24177 12.6781C5.39185 12.7686 5.57835 12.7739 5.73333 12.6921L14.7333 7.94214C14.8973 7.85559 15 7.68539 15 7.49995C15 7.31452 14.8973 7.14431 14.7333 7.05776L5.73333 2.30776ZM5.99995 11.4207V3.5792L13.4287 7.49995L5.99995 11.4207Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const aA="_DialogOverlay_1bzhl_6",lA="_overlayShow_1bzhl_1",cA="_DialogContent_1bzhl_14",uA="_contentShow_1bzhl_1",fA="_DialogTitle_1bzhl_34",dA="_DialogDescription_1bzhl_41",hA="_Button_1bzhl_51",pA="_violet_1bzhl_63",mA="_green_1bzhl_74",gA="_IconButton_1bzhl_85",vA={DialogOverlay:aA,overlayShow:lA,DialogContent:cA,contentShow:uA,DialogTitle:fA,DialogDescription:dA,Button:hA,violet:pA,green:mA,IconButton:gA};var mn=globalThis&&globalThis.__assign||function(){return mn=Object.assign||function(n){for(var e,t=1,r=arguments.length;t=e||L<0||u&&E>=o}function _(){var C=ap();if(g(C))return y(C);a=setTimeout(_,m(C))}function y(C){return a=void 0,d&&r?p(C):(r=i=void 0,s)}function x(){a!==void 0&&clearTimeout(a),c=0,r=l=i=a=void 0}function S(){return a===void 0?s:y(ap())}function T(){var C=ap(),L=g(C);if(r=arguments,i=this,l=C,L){if(a===void 0)return v(l);if(u)return clearTimeout(a),a=setTimeout(_,e),p(l)}return a===void 0&&(a=setTimeout(_,e)),s}return T.cancel=x,T.flush=S,T}var ig={},fL={get exports(){return ig},set exports(n){ig=n}};/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */(function(n){(function(){var e={}.hasOwnProperty;function t(){for(var r=[],i=0;i{const i=ol();return fe(Nb,{defaultOpen:!0,open:i.visible,onOpenChange:o=>{o?i.show():i.hide()},children:qe($b,{children:[fe(Ub,{className:dL}),qe(zb,{className:hL,children:[fe(Bb,{className:pL,children:n}),fe(WP,{className:mL,children:e}),qe("div",{children:[" ",t]}),fe("div",{style:{display:"flex",marginTop:25,justifyContent:"flex-end"},children:fe(Ky,{asChild:!0,children:fe("button",{className:Yn(gL,yL),onClick:()=>{i.resolve("action")},children:r})})}),fe(Ky,{asChild:!0,children:fe("button",{className:vL,children:fe(KP,{})})})]})]})})});async function xL(n){return console.log(n),await xi.show(_L,n)}function jr(n){return jr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jr(n)}function qr(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function wL(n,e){if(jr(n)!=="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(jr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function qb(n){var e=wL(n,"string");return jr(e)==="symbol"?e:String(e)}function Qy(n,e){for(var t=0;tn.length)&&(e=n.length);for(var t=0,r=new Array(e);t1&&arguments[1]!==void 0?arguments[1]:{};qr(this,n),this.init(e,t)}return Zr(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=t||CL,this.options=r,this.debug=r.debug}},{key:"setDebug",value:function(t){this.debug=t}},{key:"log",value:function(){for(var t=arguments.length,r=new Array(t),i=0;i1?r-1:0),o=1;o-1?a.replace(/###/g,"."):a}function i(){return!n||typeof n=="string"}for(var o=typeof e!="string"?[].concat(e):e.split(".");o.length>1;){if(i())return{};var s=r(o.shift());!n[s]&&t&&(n[s]=new t),Object.prototype.hasOwnProperty.call(n,s)?n=n[s]:n={}}return i()?{}:{obj:n,k:r(o.shift())}}function r1(n,e,t){var r=R0(n,e,Object),i=r.obj,o=r.k;i[o]=t}function LL(n,e,t,r){var i=R0(n,e,Object),o=i.obj,s=i.k;o[s]=o[s]||[],r&&(o[s]=o[s].concat(t)),r||o[s].push(t)}function hd(n,e){var t=R0(n,e),r=t.obj,i=t.k;if(r)return r[i]}function i1(n,e,t){var r=hd(n,t);return r!==void 0?r:hd(e,t)}function Zb(n,e,t){for(var r in e)r!=="__proto__"&&r!=="constructor"&&(r in n?typeof n[r]=="string"||n[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?t&&(n[r]=e[r]):Zb(n[r],e[r],t):n[r]=e[r]);return n}function Hs(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var RL={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function DL(n){return typeof n=="string"?n.replace(/[&<>"'\/]/g,function(e){return RL[e]}):n}var Qd=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,IL=[" ",",","?","!",";"];function kL(n,e,t){e=e||"",t=t||"";var r=IL.filter(function(a){return e.indexOf(a)<0&&t.indexOf(a)<0});if(r.length===0)return!0;var i=new RegExp("(".concat(r.map(function(a){return a==="?"?"\\?":a}).join("|"),")")),o=!i.test(n);if(!o){var s=n.indexOf(t);s>0&&!i.test(n.substring(0,s))&&(o=!0)}return o}function o1(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Nu(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Qb(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(n){if(n[e])return n[e];for(var r=e.split(t),i=n,o=0;oo+s;)s++,a=r.slice(o,o+s).join(t),l=i[a];if(l===void 0)return;if(l===null)return null;if(e.endsWith(a)){if(typeof l=="string")return l;if(a&&typeof l[a]=="string")return l[a]}var c=r.slice(o+s).join(t);return c?Qb(l,c,t):void 0}i=i[r[o]]}return i}}var NL=function(n){Zd(t,n);var e=OL(t);function t(r){var i,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return qr(this,t),i=e.call(this),Qd&&Uo.call(Lo(i)),i.data=r||{},i.options=o,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.options.ignoreJSONStructure===void 0&&(i.options.ignoreJSONStructure=!0),i}return Zr(t,[{key:"addNamespaces",value:function(i){this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}},{key:"removeNamespaces",value:function(i){var o=this.options.ns.indexOf(i);o>-1&&this.options.ns.splice(o,1)}},{key:"getResource",value:function(i,o,s){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},l=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,c=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure,f=[i,o];s&&typeof s!="string"&&(f=f.concat(s)),s&&typeof s=="string"&&(f=f.concat(l?s.split(l):s)),i.indexOf(".")>-1&&(f=i.split("."));var u=hd(this.data,f);return u||!c||typeof s!="string"?u:Qb(this.data&&this.data[i]&&this.data[i][o],s,l)}},{key:"addResource",value:function(i,o,s,a){var l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},c=this.options.keySeparator;c===void 0&&(c=".");var f=[i,o];s&&(f=f.concat(c?s.split(c):s)),i.indexOf(".")>-1&&(f=i.split("."),a=o,o=f[1]),this.addNamespaces(o),r1(this.data,f,a),l.silent||this.emit("added",i,o,s,a)}},{key:"addResources",value:function(i,o,s){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var l in s)(typeof s[l]=="string"||Object.prototype.toString.apply(s[l])==="[object Array]")&&this.addResource(i,o,l,s[l],{silent:!0});a.silent||this.emit("added",i,o,s)}},{key:"addResourceBundle",value:function(i,o,s,a,l){var c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},f=[i,o];i.indexOf(".")>-1&&(f=i.split("."),a=s,s=o,o=f[1]),this.addNamespaces(o);var u=hd(this.data,f)||{};a?Zb(u,s,l):u=Nu(Nu({},u),s),r1(this.data,f,u),c.silent||this.emit("added",i,o,s)}},{key:"removeResourceBundle",value:function(i,o){this.hasResourceBundle(i,o)&&delete this.data[i][o],this.removeNamespaces(o),this.emit("removed",i,o)}},{key:"hasResourceBundle",value:function(i,o){return this.getResource(i,o)!==void 0}},{key:"getResourceBundle",value:function(i,o){return o||(o=this.options.defaultNS),this.options.compatibilityAPI==="v1"?Nu(Nu({},{}),this.getResource(i,o)):this.getResource(i,o)}},{key:"getDataByLanguage",value:function(i){return this.data[i]}},{key:"hasLanguageSomeTranslations",value:function(i){var o=this.getDataByLanguage(i),s=o&&Object.keys(o)||[];return!!s.find(function(a){return o[a]&&Object.keys(o[a]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),t}(Uo),Jb={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,r,i,o){var s=this;return e.forEach(function(a){s.processors[a]&&(t=s.processors[a].process(t,r,i,o))}),t}};function s1(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Nn(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var a1={},l1=function(n){Zd(t,n);var e=$L(t);function t(r){var i,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return qr(this,t),i=e.call(this),Qd&&Uo.call(Lo(i)),AL(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,Lo(i)),i.options=o,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=ci.create("translator"),i}return Zr(t,[{key:"changeLanguage",value:function(i){i&&(this.language=i)}},{key:"exists",value:function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(i==null)return!1;var s=this.resolve(i,o);return s&&s.res!==void 0}},{key:"extractFromKey",value:function(i,o){var s=o.nsSeparator!==void 0?o.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");var a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,l=o.ns||this.options.defaultNS||[],c=s&&i.indexOf(s)>-1,f=!this.options.userDefinedKeySeparator&&!o.keySeparator&&!this.options.userDefinedNsSeparator&&!o.nsSeparator&&!kL(i,s,a);if(c&&!f){var u=i.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:i,namespaces:l};var d=i.split(s);(s!==a||s===a&&this.options.ns.indexOf(d[0])>-1)&&(l=d.shift()),i=d.join(a)}return typeof l=="string"&&(l=[l]),{key:i,namespaces:l}}},{key:"translate",value:function(i,o,s){var a=this;if(jr(o)!=="object"&&this.options.overloadTranslationOptionHandler&&(o=this.options.overloadTranslationOptionHandler(arguments)),o||(o={}),i==null)return"";Array.isArray(i)||(i=[String(i)]);var l=o.returnDetails!==void 0?o.returnDetails:this.options.returnDetails,c=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator,f=this.extractFromKey(i[i.length-1],o),u=f.key,d=f.namespaces,p=d[d.length-1],v=o.lng||this.language,m=o.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(v&&v.toLowerCase()==="cimode"){if(m){var g=o.nsSeparator||this.options.nsSeparator;return l?{res:"".concat(p).concat(g).concat(u),usedKey:u,exactUsedKey:u,usedLng:v,usedNS:p}:"".concat(p).concat(g).concat(u)}return l?{res:u,usedKey:u,exactUsedKey:u,usedLng:v,usedNS:p}:u}var _=this.resolve(i,o),y=_&&_.res,x=_&&_.usedKey||u,S=_&&_.exactUsedKey||u,T=Object.prototype.toString.apply(y),C=["[object Number]","[object Function]","[object RegExp]"],L=o.joinArrays!==void 0?o.joinArrays:this.options.joinArrays,E=!this.i18nFormat||this.i18nFormat.handleAsObject,A=typeof y!="string"&&typeof y!="boolean"&&typeof y!="number";if(E&&y&&A&&C.indexOf(T)<0&&!(typeof L=="string"&&T==="[object Array]")){if(!o.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var I=this.options.returnedObjectHandler?this.options.returnedObjectHandler(x,y,Nn(Nn({},o),{},{ns:d})):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");return l?(_.res=I,_):I}if(c){var q=T==="[object Array]",ee=q?[]:{},H=q?S:x;for(var R in y)if(Object.prototype.hasOwnProperty.call(y,R)){var N="".concat(H).concat(c).concat(R);ee[R]=this.translate(N,Nn(Nn({},o),{joinArrays:!1,ns:d})),ee[R]===N&&(ee[R]=y[R])}y=ee}}else if(E&&typeof L=="string"&&T==="[object Array]")y=y.join(L),y&&(y=this.extendTranslation(y,i,o,s));else{var Z=!1,K=!1,B=o.count!==void 0&&typeof o.count!="string",$=t.hasDefaultValue(o),W=B?this.pluralResolver.getSuffix(v,o.count,o):"",ie=o["defaultValue".concat(W)]||o.defaultValue;!this.isValidLookup(y)&&$&&(Z=!0,y=ie),this.isValidLookup(y)||(K=!0,y=u);var j=o.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,se=j&&K?void 0:y,ue=$&&ie!==y&&this.options.updateMissing;if(K||Z||ue){if(this.logger.log(ue?"updateKey":"missingKey",v,p,u,ue?ie:y),c){var Q=this.resolve(u,Nn(Nn({},o),{},{keySeparator:!1}));Q&&Q.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var me=[],pe=this.languageUtils.getFallbackCodes(this.options.fallbackLng,o.lng||this.language);if(this.options.saveMissingTo==="fallback"&&pe&&pe[0])for(var we=0;we1&&arguments[1]!==void 0?arguments[1]:{},a,l,c,f,u;return typeof i=="string"&&(i=[i]),i.forEach(function(d){if(!o.isValidLookup(a)){var p=o.extractFromKey(d,s),v=p.key;l=v;var m=p.namespaces;o.options.fallbackNS&&(m=m.concat(o.options.fallbackNS));var g=s.count!==void 0&&typeof s.count!="string",_=g&&!s.ordinal&&s.count===0&&o.pluralResolver.shouldUseIntlApi(),y=s.context!==void 0&&(typeof s.context=="string"||typeof s.context=="number")&&s.context!=="",x=s.lngs?s.lngs:o.languageUtils.toResolveHierarchy(s.lng||o.language,s.fallbackLng);m.forEach(function(S){o.isValidLookup(a)||(u=S,!a1["".concat(x[0],"-").concat(S)]&&o.utils&&o.utils.hasLoadedNamespace&&!o.utils.hasLoadedNamespace(u)&&(a1["".concat(x[0],"-").concat(S)]=!0,o.logger.warn('key "'.concat(l,'" for languages "').concat(x.join(", "),`" won't get resolved as namespace "`).concat(u,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),x.forEach(function(T){if(!o.isValidLookup(a)){f=T;var C=[v];if(o.i18nFormat&&o.i18nFormat.addLookupKeys)o.i18nFormat.addLookupKeys(C,v,T,S,s);else{var L;g&&(L=o.pluralResolver.getSuffix(T,s.count,s));var E="".concat(o.options.pluralSeparator,"zero");if(g&&(C.push(v+L),_&&C.push(v+E)),y){var A="".concat(v).concat(o.options.contextSeparator).concat(s.context);C.push(A),g&&(C.push(A+L),_&&C.push(A+E))}}for(var I;I=C.pop();)o.isValidLookup(a)||(c=I,a=o.getResource(T,S,I,s))}}))})}}),{res:a,usedKey:l,exactUsedKey:c,usedLng:f,usedNS:u}}},{key:"isValidLookup",value:function(i){return i!==void 0&&!(!this.options.returnNull&&i===null)&&!(!this.options.returnEmptyString&&i==="")}},{key:"getResource",value:function(i,o,s){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(i,o,s,a):this.resourceStore.getResource(i,o,s,a)}}],[{key:"hasDefaultValue",value:function(i){var o="defaultValue";for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&o===s.substring(0,o.length)&&i[s]!==void 0)return!0;return!1}}]),t}(Uo);function lp(n){return n.charAt(0).toUpperCase()+n.slice(1)}var c1=function(){function n(e){qr(this,n),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ci.create("languageUtils")}return Zr(n,[{key:"getScriptPartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return null;var r=t.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}},{key:"getLanguagePartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return t;var r=t.split("-");return this.formatLanguageCode(r[0])}},{key:"formatLanguageCode",value:function(t){if(typeof t=="string"&&t.indexOf("-")>-1){var r=["hans","hant","latn","cyrl","cans","mong","arab"],i=t.split("-");return this.options.lowerCaseLng?i=i.map(function(o){return o.toLowerCase()}):i.length===2?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=lp(i[1].toLowerCase()))):i.length===3&&(i[0]=i[0].toLowerCase(),i[1].length===2&&(i[1]=i[1].toUpperCase()),i[0]!=="sgn"&&i[2].length===2&&(i[2]=i[2].toUpperCase()),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=lp(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=lp(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}},{key:"isSupportedCode",value:function(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}},{key:"getBestMatchFromCodes",value:function(t){var r=this;if(!t)return null;var i;return t.forEach(function(o){if(!i){var s=r.formatLanguageCode(o);(!r.options.supportedLngs||r.isSupportedCode(s))&&(i=s)}}),!i&&this.options.supportedLngs&&t.forEach(function(o){if(!i){var s=r.getLanguagePartFromCode(o);if(r.isSupportedCode(s))return i=s;i=r.options.supportedLngs.find(function(a){if(a.indexOf(s)===0)return a})}}),i||(i=this.getFallbackCodes(this.options.fallbackLng)[0]),i}},{key:"getFallbackCodes",value:function(t,r){if(!t)return[];if(typeof t=="function"&&(t=t(r)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!r)return t.default||[];var i=t[r];return i||(i=t[this.getScriptPartFromCode(r)]),i||(i=t[this.formatLanguageCode(r)]),i||(i=t[this.getLanguagePartFromCode(r)]),i||(i=t.default),i||[]}},{key:"toResolveHierarchy",value:function(t,r){var i=this,o=this.getFallbackCodes(r||this.options.fallbackLng||[],t),s=[],a=function(c){c&&(i.isSupportedCode(c)?s.push(c):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(c)))};return typeof t=="string"&&t.indexOf("-")>-1?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(t))):typeof t=="string"&&a(this.formatLanguageCode(t)),o.forEach(function(l){s.indexOf(l)<0&&a(i.formatLanguageCode(l))}),s}}]),n}(),zL=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],BL={1:function(e){return Number(e>1)},2:function(e){return Number(e!=1)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(e==1?0:e>=2&&e<=4?1:2)},7:function(e){return Number(e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(e==1?0:e==2?1:e!=8&&e!=11?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(e==1?0:e==2?1:e<7?2:e<11?3:4)},11:function(e){return Number(e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(e!==0)},14:function(e){return Number(e==1?0:e==2?1:e==3?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:e!==0?1:2)},17:function(e){return Number(e==1||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(e==0?0:e==1?1:2)},19:function(e){return Number(e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(e==1?0:e==0||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3)}},VL=["v1","v2","v3"],u1={zero:0,one:1,two:2,few:3,many:4,other:5};function HL(){var n={};return zL.forEach(function(e){e.lngs.forEach(function(t){n[t]={numbers:e.nr,plurals:BL[e.fc]}})}),n}var GL=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};qr(this,n),this.languageUtils=e,this.options=t,this.logger=ci.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=HL()}return Zr(n,[{key:"addRule",value:function(t,r){this.rules[t]=r}},{key:"getRule",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(t,{type:r.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}},{key:"needsPlural",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(t,r);return this.shouldUseIntlApi()?i&&i.resolvedOptions().pluralCategories.length>1:i&&i.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(t,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,i).map(function(o){return"".concat(r).concat(o)})}},{key:"getSuffixes",value:function(t){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=this.getRule(t,i);return o?this.shouldUseIntlApi()?o.resolvedOptions().pluralCategories.sort(function(s,a){return u1[s]-u1[a]}).map(function(s){return"".concat(r.options.prepend).concat(s)}):o.numbers.map(function(s){return r.getSuffix(t,s,i)}):[]}},{key:"getSuffix",value:function(t,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=this.getRule(t,i);return o?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(o.select(r)):this.getSuffixRetroCompatible(o,r):(this.logger.warn("no plural rule found for: ".concat(t)),"")}},{key:"getSuffixRetroCompatible",value:function(t,r){var i=this,o=t.noAbs?t.plurals(r):t.plurals(Math.abs(r)),s=t.numbers[o];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));var a=function(){return i.options.prepend&&s.toString()?i.options.prepend+s.toString():s.toString()};return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?"_plural_".concat(s.toString()):a():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?a():this.options.prepend&&o.toString()?this.options.prepend+o.toString():o.toString()}},{key:"shouldUseIntlApi",value:function(){return!VL.includes(this.options.compatibilityJSON)}}]),n}();function f1(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Or(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};qr(this,n),this.logger=ci.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(t){return t},this.init(e)}return Zr(n,[{key:"init",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});var r=t.interpolation;this.escape=r.escape!==void 0?r.escape:DL,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?Hs(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?Hs(r.suffix):r.suffixEscaped||"}}",this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||",",this.unescapePrefix=r.unescapeSuffix?"":r.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":r.unescapeSuffix||"",this.nestingPrefix=r.nestingPrefix?Hs(r.nestingPrefix):r.nestingPrefixEscaped||Hs("$t("),this.nestingSuffix=r.nestingSuffix?Hs(r.nestingSuffix):r.nestingSuffixEscaped||Hs(")"),this.nestingOptionsSeparator=r.nestingOptionsSeparator?r.nestingOptionsSeparator:r.nestingOptionsSeparator||",",this.maxReplaces=r.maxReplaces?r.maxReplaces:1e3,this.alwaysFormat=r.alwaysFormat!==void 0?r.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var t="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(t,"g");var r="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(r,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(t,r,i,o){var s=this,a,l,c,f=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(g){return g.replace(/\$/g,"$$$$")}var d=function(_){if(_.indexOf(s.formatSeparator)<0){var y=i1(r,f,_);return s.alwaysFormat?s.format(y,void 0,i,Or(Or(Or({},o),r),{},{interpolationkey:_})):y}var x=_.split(s.formatSeparator),S=x.shift().trim(),T=x.join(s.formatSeparator).trim();return s.format(i1(r,f,S),T,i,Or(Or(Or({},o),r),{},{interpolationkey:S}))};this.resetRegExp();var p=o&&o.missingInterpolationHandler||this.options.missingInterpolationHandler,v=o&&o.interpolation&&o.interpolation.skipOnVariables!==void 0?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,m=[{regex:this.regexpUnescape,safeValue:function(_){return u(_)}},{regex:this.regexp,safeValue:function(_){return s.escapeValue?u(s.escape(_)):u(_)}}];return m.forEach(function(g){for(c=0;a=g.regex.exec(t);){var _=a[1].trim();if(l=d(_),l===void 0)if(typeof p=="function"){var y=p(t,a,o);l=typeof y=="string"?y:""}else if(o&&Object.prototype.hasOwnProperty.call(o,_))l="";else if(v){l=a[0];continue}else s.logger.warn("missed to pass in variable ".concat(_," for interpolating ").concat(t)),l="";else typeof l!="string"&&!s.useRawValueToEscape&&(l=n1(l));var x=g.safeValue(l);if(t=t.replace(a[0],x),v?(g.regex.lastIndex+=l.length,g.regex.lastIndex-=a[0].length):g.regex.lastIndex=0,c++,c>=s.maxReplaces)break}}),t}},{key:"nest",value:function(t,r){var i=this,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,a,l;function c(p,v){var m=this.nestingOptionsSeparator;if(p.indexOf(m)<0)return p;var g=p.split(new RegExp("".concat(m,"[ ]*{"))),_="{".concat(g[1]);p=g[0],_=this.interpolate(_,l);var y=_.match(/'/g),x=_.match(/"/g);(y&&y.length%2===0&&!x||x.length%2!==0)&&(_=_.replace(/'/g,'"'));try{l=JSON.parse(_),v&&(l=Or(Or({},v),l))}catch(S){return this.logger.warn("failed parsing options string in nesting for key ".concat(p),S),"".concat(p).concat(m).concat(_)}return delete l.defaultValue,p}for(;s=this.nestingRegexp.exec(t);){var f=[];l=Or({},o),l=l.replace&&typeof l.replace!="string"?l.replace:l,l.applyPostProcessor=!1,delete l.defaultValue;var u=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){var d=s[1].split(this.formatSeparator).map(function(p){return p.trim()});s[1]=d.shift(),f=d,u=!0}if(a=r(c.call(this,s[1].trim(),l),l),a&&s[0]===t&&typeof a!="string")return a;typeof a!="string"&&(a=n1(a)),a||(this.logger.warn("missed to resolve ".concat(s[1]," for nesting ").concat(t)),a=""),u&&(a=f.reduce(function(p,v){return i.format(p,v,o.lng,Or(Or({},o),{},{interpolationkey:s[1].trim()}))},a.trim())),t=t.replace(s[0],a),this.regexp.lastIndex=0}return t}}]),n}();function d1(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function bi(n){for(var e=1;e-1){var r=n.split("(");e=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);if(e==="currency"&&i.indexOf(":")<0)t.currency||(t.currency=i.trim());else if(e==="relativetime"&&i.indexOf(":")<0)t.range||(t.range=i.trim());else{var o=i.split(";");o.forEach(function(s){if(s){var a=s.split(":"),l=TL(a),c=l[0],f=l.slice(1),u=f.join(":").trim().replace(/^'+|'+$/g,"");t[c.trim()]||(t[c.trim()]=u),u==="false"&&(t[c.trim()]=!1),u==="true"&&(t[c.trim()]=!0),isNaN(u)||(t[c.trim()]=parseInt(u,10))}})}}return{formatName:e,formatOptions:t}}function Gs(n){var e={};return function(r,i,o){var s=i+JSON.stringify(o),a=e[s];return a||(a=n(i,o),e[s]=a),a(r)}}var XL=function(){function n(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};qr(this,n),this.logger=ci.create("formatter"),this.options=e,this.formats={number:Gs(function(t,r){var i=new Intl.NumberFormat(t,bi({},r));return function(o){return i.format(o)}}),currency:Gs(function(t,r){var i=new Intl.NumberFormat(t,bi(bi({},r),{},{style:"currency"}));return function(o){return i.format(o)}}),datetime:Gs(function(t,r){var i=new Intl.DateTimeFormat(t,bi({},r));return function(o){return i.format(o)}}),relativetime:Gs(function(t,r){var i=new Intl.RelativeTimeFormat(t,bi({},r));return function(o){return i.format(o,r.range||"day")}}),list:Gs(function(t,r){var i=new Intl.ListFormat(t,bi({},r));return function(o){return i.format(o)}})},this.init(e)}return Zr(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},i=r.interpolation;this.formatSeparator=i.formatSeparator?i.formatSeparator:i.formatSeparator||","}},{key:"add",value:function(t,r){this.formats[t.toLowerCase().trim()]=r}},{key:"addCached",value:function(t,r){this.formats[t.toLowerCase().trim()]=Gs(r)}},{key:"format",value:function(t,r,i){var o=this,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=r.split(this.formatSeparator),l=a.reduce(function(c,f){var u=jL(f),d=u.formatName,p=u.formatOptions;if(o.formats[d]){var v=c;try{var m=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},g=m.locale||m.lng||s.locale||s.lng||i;v=o.formats[d](c,g,bi(bi(bi({},p),s),m))}catch(_){o.logger.warn(_)}return v}else o.logger.warn("there was no format function for ".concat(d));return c},t);return l}}]),n}();function h1(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function p1(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function qL(n,e){n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)}var ZL=function(n){Zd(t,n);var e=KL(t);function t(r,i,o){var s,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return qr(this,t),s=e.call(this),Qd&&Uo.call(Lo(s)),s.backend=r,s.store=i,s.services=o,s.languageUtils=o.languageUtils,s.options=a,s.logger=ci.create("backendConnector"),s.waitingReads=[],s.maxParallelReads=a.maxParallelReads||10,s.readingCalls=0,s.maxRetries=a.maxRetries>=0?a.maxRetries:5,s.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,s.state={},s.queue=[],s.backend&&s.backend.init&&s.backend.init(o,a.backend,a),s}return Zr(t,[{key:"queueLoad",value:function(i,o,s,a){var l=this,c={},f={},u={},d={};return i.forEach(function(p){var v=!0;o.forEach(function(m){var g="".concat(p,"|").concat(m);!s.reload&&l.store.hasResourceBundle(p,m)?l.state[g]=2:l.state[g]<0||(l.state[g]===1?f[g]===void 0&&(f[g]=!0):(l.state[g]=1,v=!1,f[g]===void 0&&(f[g]=!0),c[g]===void 0&&(c[g]=!0),d[m]===void 0&&(d[m]=!0)))}),v||(u[p]=!0)}),(Object.keys(c).length||Object.keys(f).length)&&this.queue.push({pending:f,pendingCount:Object.keys(f).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(c),pending:Object.keys(f),toLoadLanguages:Object.keys(u),toLoadNamespaces:Object.keys(d)}}},{key:"loaded",value:function(i,o,s){var a=i.split("|"),l=a[0],c=a[1];o&&this.emit("failedLoading",l,c,o),s&&this.store.addResourceBundle(l,c,s),this.state[i]=o?-1:2;var f={};this.queue.forEach(function(u){LL(u.loaded,[l],c),qL(u,i),o&&u.errors.push(o),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(function(d){f[d]||(f[d]={});var p=u.loaded[d];p.length&&p.forEach(function(v){f[d][v]===void 0&&(f[d][v]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",f),this.queue=this.queue.filter(function(u){return!u.done})}},{key:"read",value:function(i,o,s){var a=this,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,f=arguments.length>5?arguments[5]:void 0;if(!i.length)return f(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:o,fcName:s,tried:l,wait:c,callback:f});return}this.readingCalls++;var u=function(m,g){if(a.readingCalls--,a.waitingReads.length>0){var _=a.waitingReads.shift();a.read(_.lng,_.ns,_.fcName,_.tried,_.wait,_.callback)}if(m&&g&&l2&&arguments[2]!==void 0?arguments[2]:{},l=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),l&&l();typeof i=="string"&&(i=this.languageUtils.toResolveHierarchy(i)),typeof o=="string"&&(o=[o]);var c=this.queueLoad(i,o,a,l);if(!c.toLoad.length)return c.pending.length||l(),null;c.toLoad.forEach(function(f){s.loadOne(f)})}},{key:"load",value:function(i,o,s){this.prepareLoading(i,o,{},s)}},{key:"reload",value:function(i,o,s){this.prepareLoading(i,o,{reload:!0},s)}},{key:"loadOne",value:function(i){var o=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",a=i.split("|"),l=a[0],c=a[1];this.read(l,c,"read",void 0,void 0,function(f,u){f&&o.logger.warn("".concat(s,"loading namespace ").concat(c," for language ").concat(l," failed"),f),!f&&u&&o.logger.log("".concat(s,"loaded namespace ").concat(c," for language ").concat(l),u),o.loaded(i,f,u)})}},{key:"saveMissing",value:function(i,o,s,a,l){var c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},f=arguments.length>6&&arguments[6]!==void 0?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(o)){this.logger.warn('did not save key "'.concat(s,'" as the namespace "').concat(o,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(s==null||s==="")){if(this.backend&&this.backend.create){var u=p1(p1({},c),{},{isUpdate:l}),d=this.backend.create.bind(this.backend);if(d.length<6)try{var p;d.length===5?p=d(i,o,s,a,u):p=d(i,o,s,a),p&&typeof p.then=="function"?p.then(function(v){return f(null,v)}).catch(f):f(null,p)}catch(v){f(v)}else d(i,o,s,a,f,u)}!i||!i[0]||this.store.addResource(i[0],o,s,a)}}}]),t}(Uo);function m1(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if(jr(e[1])==="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),jr(e[2])==="object"||jr(e[3])==="object"){var r=e[3]||e[2];Object.keys(r).forEach(function(i){t[i]=r[i]})}return t},interpolation:{escapeValue:!0,format:function(e,t,r,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function g1(n){return typeof n.ns=="string"&&(n.ns=[n.ns]),typeof n.fallbackLng=="string"&&(n.fallbackLng=[n.fallbackLng]),typeof n.fallbackNS=="string"&&(n.fallbackNS=[n.fallbackNS]),n.supportedLngs&&n.supportedLngs.indexOf("cimode")<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),n}function v1(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Jr(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function $u(){}function eR(n){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(n));e.forEach(function(t){typeof n[t]=="function"&&(n[t]=n[t].bind(n))})}var pd=function(n){Zd(t,n);var e=QL(t);function t(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;if(qr(this,t),r=e.call(this),Qd&&Uo.call(Lo(r)),r.options=g1(i),r.services={},r.logger=ci,r.modules={external:[]},eR(Lo(r)),o&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,o),eu(r,Lo(r));setTimeout(function(){r.init(i,o)},0)}return r}return Zr(t,[{key:"init",value:function(){var i=this,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;typeof o=="function"&&(s=o,o={}),!o.defaultNS&&o.defaultNS!==!1&&o.ns&&(typeof o.ns=="string"?o.defaultNS=o.ns:o.ns.indexOf("translation")<0&&(o.defaultNS=o.ns[0]));var a=m1();this.options=Jr(Jr(Jr({},a),this.options),g1(o)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=Jr(Jr({},a.interpolation),this.options.interpolation)),o.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=o.keySeparator),o.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=o.nsSeparator);function l(_){return _?typeof _=="function"?new _:_:null}if(!this.options.isClone){this.modules.logger?ci.init(l(this.modules.logger),this.options):ci.init(null,this.options);var c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=XL);var f=new c1(this.options);this.store=new NL(this.options.resources,this.options);var u=this.services;u.logger=ci,u.resourceStore=this.store,u.languageUtils=f,u.pluralResolver=new GL(f,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===a.interpolation.format)&&(u.formatter=l(c),u.formatter.init(u,this.options),this.options.interpolation.format=u.formatter.format.bind(u.formatter)),u.interpolator=new WL(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new ZL(l(this.modules.backend),u.resourceStore,u,this.options),u.backendConnector.on("*",function(_){for(var y=arguments.length,x=new Array(y>1?y-1:0),S=1;S1?y-1:0),S=1;S0&&d[0]!=="dev"&&(this.options.lng=d[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var p=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];p.forEach(function(_){i[_]=function(){var y;return(y=i.store)[_].apply(y,arguments)}});var v=["addResource","addResources","addResourceBundle","removeResourceBundle"];v.forEach(function(_){i[_]=function(){var y;return(y=i.store)[_].apply(y,arguments),i}});var m=Al(),g=function(){var y=function(S,T){i.isInitialized&&!i.initializedStoreOnce&&i.logger.warn("init: i18next is already initialized. You should call init just once!"),i.isInitialized=!0,i.options.isClone||i.logger.log("initialized",i.options),i.emit("initialized",i.options),m.resolve(T),s(S,T)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return y(null,i.t.bind(i));i.changeLanguage(i.options.lng,y)};return this.options.resources||!this.options.initImmediate?g():setTimeout(g,0),m}},{key:"loadResources",value:function(i){var o=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:$u,a=s,l=typeof i=="string"?i:this.language;if(typeof i=="function"&&(a=i),!this.options.resources||this.options.partialBundledLanguages){if(l&&l.toLowerCase()==="cimode")return a();var c=[],f=function(p){if(p){var v=o.services.languageUtils.toResolveHierarchy(p);v.forEach(function(m){c.indexOf(m)<0&&c.push(m)})}};if(l)f(l);else{var u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.forEach(function(d){return f(d)})}this.options.preload&&this.options.preload.forEach(function(d){return f(d)}),this.services.backendConnector.load(c,this.options.ns,function(d){!d&&!o.resolvedLanguage&&o.language&&o.setResolvedLanguage(o.language),a(d)})}else a(null)}},{key:"reloadResources",value:function(i,o,s){var a=Al();return i||(i=this.languages),o||(o=this.options.ns),s||(s=$u),this.services.backendConnector.reload(i,o,function(l){a.resolve(),s(l)}),a}},{key:"use",value:function(i){if(!i)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!i.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return i.type==="backend"&&(this.modules.backend=i),(i.type==="logger"||i.log&&i.warn&&i.error)&&(this.modules.logger=i),i.type==="languageDetector"&&(this.modules.languageDetector=i),i.type==="i18nFormat"&&(this.modules.i18nFormat=i),i.type==="postProcessor"&&Jb.addPostProcessor(i),i.type==="formatter"&&(this.modules.formatter=i),i.type==="3rdParty"&&this.modules.external.push(i),this}},{key:"setResolvedLanguage",value:function(i){if(!(!i||!this.languages)&&!(["cimode","dev"].indexOf(i)>-1))for(var o=0;o-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}}},{key:"changeLanguage",value:function(i,o){var s=this;this.isLanguageChangingTo=i;var a=Al();this.emit("languageChanging",i);var l=function(d){s.language=d,s.languages=s.services.languageUtils.toResolveHierarchy(d),s.resolvedLanguage=void 0,s.setResolvedLanguage(d)},c=function(d,p){p?(l(p),s.translator.changeLanguage(p),s.isLanguageChangingTo=void 0,s.emit("languageChanged",p),s.logger.log("languageChanged",p)):s.isLanguageChangingTo=void 0,a.resolve(function(){return s.t.apply(s,arguments)}),o&&o(d,function(){return s.t.apply(s,arguments)})},f=function(d){!i&&!d&&s.services.languageDetector&&(d=[]);var p=typeof d=="string"?d:s.services.languageUtils.getBestMatchFromCodes(d);p&&(s.language||l(p),s.translator.language||s.translator.changeLanguage(p),s.services.languageDetector&&s.services.languageDetector.cacheUserLanguage&&s.services.languageDetector.cacheUserLanguage(p)),s.loadResources(p,function(v){c(v,p)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?f(this.services.languageDetector.detect()):!i&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(f):this.services.languageDetector.detect(f):f(i),a}},{key:"getFixedT",value:function(i,o,s){var a=this,l=function c(f,u){var d;if(jr(u)!=="object"){for(var p=arguments.length,v=new Array(p>2?p-2:0),m=2;m1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var a=this.resolvedLanguage||this.languages[0],l=this.options?this.options.fallbackLng:!1,c=this.languages[this.languages.length-1];if(a.toLowerCase()==="cimode")return!0;var f=function(p,v){var m=o.services.backendConnector.state["".concat(p,"|").concat(v)];return m===-1||m===2};if(s.precheck){var u=s.precheck(this,f);if(u!==void 0)return u}return!!(this.hasResourceBundle(a,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||f(a,i)&&(!l||f(c,i)))}},{key:"loadNamespaces",value:function(i,o){var s=this,a=Al();return this.options.ns?(typeof i=="string"&&(i=[i]),i.forEach(function(l){s.options.ns.indexOf(l)<0&&s.options.ns.push(l)}),this.loadResources(function(l){a.resolve(),o&&o(l)}),a):(o&&o(),Promise.resolve())}},{key:"loadLanguages",value:function(i,o){var s=Al();typeof i=="string"&&(i=[i]);var a=this.options.preload||[],l=i.filter(function(c){return a.indexOf(c)<0});return l.length?(this.options.preload=a.concat(l),this.loadResources(function(c){s.resolve(),o&&o(c)}),s):(o&&o(),Promise.resolve())}},{key:"dir",value:function(i){if(i||(i=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!i)return"rtl";var o=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],s=this.services&&this.services.languageUtils||new c1(m1());return o.indexOf(s.getLanguagePartFromCode(i))>-1||i.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var i=this,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:$u,a=Jr(Jr(Jr({},this.options),o),{isClone:!0}),l=new t(a);(o.debug!==void 0||o.prefix!==void 0)&&(l.logger=l.logger.clone(o));var c=["store","services","language"];return c.forEach(function(f){l[f]=i[f]}),l.services=Jr({},this.services),l.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},l.translator=new l1(l.services,l.options),l.translator.on("*",function(f){for(var u=arguments.length,d=new Array(u>1?u-1:0),p=1;p0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return new pd(n,e)});var ge=pd.createInstance();ge.createInstance=pd.createInstance;ge.createInstance;ge.dir;ge.init;ge.loadResources;ge.reloadResources;ge.use;ge.changeLanguage;ge.getFixedT;ge.t;ge.exists;ge.setDefaultNamespace;ge.hasLoadedNamespace;ge.loadNamespaces;ge.loadLanguages;var eM=[],tR=eM.forEach,nR=eM.slice;function rR(n){return tR.call(nR.call(arguments,1),function(e){if(e)for(var t in e)n[t]===void 0&&(n[t]=e[t])}),n}var y1=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,iR=function(e,t,r){var i=r||{};i.path=i.path||"/";var o=encodeURIComponent(t),s="".concat(e,"=").concat(o);if(i.maxAge>0){var a=i.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");s+="; Max-Age=".concat(Math.floor(a))}if(i.domain){if(!y1.test(i.domain))throw new TypeError("option domain is invalid");s+="; Domain=".concat(i.domain)}if(i.path){if(!y1.test(i.path))throw new TypeError("option path is invalid");s+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(s+="; HttpOnly"),i.secure&&(s+="; Secure"),i.sameSite){var l=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(l){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return s},_1={create:function(e,t,r,i){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+r*60*1e3)),i&&(o.domain=i),document.cookie=iR(e,encodeURIComponent(t),o)},read:function(e){for(var t="".concat(e,"="),r=document.cookie.split(";"),i=0;i-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=r.substring(1),o=i.split("&"),s=0;s0){var l=o[s].substring(0,a);l===e.lookupQuerystring&&(t=o[s].substring(a+1))}}}return t}},Ll=null,x1=function(){if(Ll!==null)return Ll;try{Ll=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Ll=!1}return Ll},aR={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&x1()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&x1()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},Rl=null,w1=function(){if(Rl!==null)return Rl;try{Rl=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{Rl=!1}return Rl},lR={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&w1()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&w1()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},cR={name:"navigator",lookup:function(e){var t=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?t:void 0}},uR={name:"htmlTag",lookup:function(e){var t,r=e.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(t=r.getAttribute("lang")),t}},fR={name:"path",lookup:function(e){var t;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof r[e.lookupFromPathIndex]!="string")return;t=r[e.lookupFromPathIndex].replace("/","")}else t=r[0].replace("/","")}return t}},dR={name:"subdomain",lookup:function(e){var t=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[t]}};function hR(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var tM=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};qr(this,n),this.type="languageDetector",this.detectors={},this.init(e,t)}return Zr(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=rR(r,this.options||{},hR()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(oR),this.addDetector(sR),this.addDetector(aR),this.addDetector(lR),this.addDetector(cR),this.addDetector(uR),this.addDetector(fR),this.addDetector(dR)}},{key:"addDetector",value:function(t){this.detectors[t.name]=t}},{key:"detect",value:function(t){var r=this;t||(t=this.options.order);var i=[];return t.forEach(function(o){if(r.detectors[o]){var s=r.detectors[o].lookup(r.options);s&&typeof s=="string"&&(s=[s]),s&&(i=i.concat(s))}}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(t,r){var i=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||r.forEach(function(o){i.detectors[o]&&i.detectors[o].cacheUserLanguage(t,i.options)}))}}]),n}();tM.type="languageDetector";const pR="Width",mR="Height",gR="Forearm",vR="Hips",yR="Thigh",_R="Redo",xR="Undo",wR="Edit",SR="Setting",bR="Feedback",MR="View",ER="Del",TR="File",CR="Generate",PR="Close",AR="Update",LR={Width:pR,Height:mR,"Generate Skeleton/Depth/Normal/Canny Map":"Generate Skeleton/Depth/Normal/Canny Map","Duplicate Skeleton":"Duplicate Skeleton","Delete Skeleton":"Delete Skeleton","Move Mode":"Move Mode","Show Edge Map":"Show Edge Map","Camera Near":"Camera Near","Camera Far":"Camera Far","Camera Focal Length":"Camera Focal Length","Downloading Hand Model":"Downloading Hand Model","Updates are available, please confirm!!":"Updates are available, please confirm!!","Select a scene file":"Select a scene file","Oops...":"Oops...","Something went wrong!":"Something went wrong!","If the problem persists, please click here to ask a question.":"If the problem persists, please click here to ask a question.","Save Scene":"Save Scene","Generate Scene URL":"Generate Scene URL","Load Scene":"Load Scene","Restore Last Scene":"Restore Last Scene","Set Background Image":"Set Background Image","Select an image":"Select an image","Body Parameters":"Body Parameters","Shoulder Width":"Shoulder Width","Shoulder To Hip":"Shoulder To Hip","Arm Length":"Arm Length",Forearm:gR,"Upper Arm":"Upper Arm","Hand Size":"Hand Size",Hips:vR,"Leg Length":"Leg Length",Thigh:yR,"Lower Leg":"Lower Leg","Nose To Neck":"Nose To Neck","Head Size":"Head Size","Show Preview":"Show Preview","Only Hand":"Only Hand","Foot Size":"Foot Size","Downloading Foot Model":"Downloading Foot Model","Please select a skeleton!!":"Please select a skeleton!!","Downloading Poses Library":"Downloading Poses Library","Set Random Pose":"Set Random Pose",Redo:_R,Undo:xR,"Detect From Image":"Detect From Image","Downloading MediaPipe Pose Model":"Downloading MediaPipe Pose Model",Edit:wR,Setting:SR,"Bone Thickness":"Bone Thickness",Feedback:bR,View:MR,"Fix View":"Fix View","Restore View":"Restore View","Free Mode":"Free Mode",Del:ER,File:TR,Generate:CR,Close:PR,Update:AR,"Lock View":"Lock View","Unlock View":"Unlock View","Copy Keypoint Data":"Copy Keypoint Data","Copied to Clipboard":"Copied to Clipboard","Reset Scene":"Reset Scene","Load Gesture":"Load Gesture","Save Gesture":"Save Gesture","Please select a hand!!":"Please select a hand!!","If you try to detect anime characters, you may get an error. Please try again with photos.":"If you try to detect anime characters, you may get an error. Please try again with photos.","Show Grid":"Show Grid"},RR="宽度",DR="高度",IR="前臂",kR="臀部宽度",OR="大腿",FR="重做",NR="撤销",$R="编辑",UR="设置",zR="反馈",BR="视图",VR="Del",HR="文件",GR="生成",WR="关闭",jR="更新",XR={Width:RR,Height:DR,"Generate Skeleton/Depth/Normal/Canny Map":"生成骨架/深度/法线/Canny图","Duplicate Skeleton":"复制骨架","Delete Skeleton":"删除骨架","Move Mode":"移动模式","Show Edge Map":"显示边缘图","Camera Near":"相机near","Camera Far":"相机far","Camera Focal Length":"相机焦距","Downloading Hand Model":"正在下载手部模型","Updates are available, please confirm!!":"有更新啦,请确认!!","Select a scene file":"选择一个场景文件","Oops...":"哎呀...","Something went wrong!":"出错了!","If the problem persists, please click here to ask a question.":"如果问题一直存在,请点击此处提问。","Save Scene":"保存场景","Load Scene":"加载场景","Restore Last Scene":"恢复上次场景","Set Background Image":"设置背景图片","Select an image":"选择一张图片","Body Parameters":"身体参数","Shoulder Width":"肩宽","Shoulder To Hip":"肩到臀","Arm Length":"手臂长度",Forearm:IR,"Upper Arm":"上臂","Hand Size":"手部尺寸",Hips:kR,"Leg Length":"腿部长度",Thigh:OR,"Lower Leg":"小腿","Nose To Neck":"鼻子到颈部","Head Size":"头部大小","Show Preview":"显示预览图","Only Hand":"仅显示手","Foot Size":"脚部尺寸","Downloading Foot Model":"正在下载脚部模型","Please select a skeleton!!":"请选择骨架!","Downloading Poses Library":"正在下载姿势库","Set Random Pose":"设置随机姿势",Redo:FR,Undo:NR,"Detect From Image":"从图片中检测","Downloading MediaPipe Pose Model":"正在下载 MediaPipe 姿势模型",Edit:$R,Setting:UR,"Bone Thickness":"骨骼厚度",Feedback:zR,View:BR,"Fix View":"固定视图","Restore View":"恢复视图","Free Mode":"自由模式",Del:VR,File:HR,Generate:GR,Close:WR,Update:jR,"Lock View":"锁定视图","Unlock View":"解除锁定视图","Copy Keypoint Data":"复制关键点数据","Copied to Clipboard":"已复制到剪贴板","Generate Scene URL":"生成场景URL","Reset Scene":"重置场景","Load Gesture":"加载手势","Save Gesture":"保存手势","Please select a hand!!":"请选择一只手!!","If you try to detect anime characters, you may get an error. Please try again with photos.":"如果您尝试检测动漫角色,可能会出现错误。请使用照片再试一次。","Show Grid":"显示网格"},KR="寬度",YR="高度",qR="前臂",ZR="臀部",QR="大腿",JR="重做",eD="撤銷",tD="編輯",nD="設定",rD="回饋",iD="檢視",oD="Del",sD="檔案",aD="生成",lD="關閉",cD="更新",uD={Width:KR,Height:YR,"Generate Skeleton/Depth/Normal/Canny Map":"產生骨架/深度/法線/Canny圖","Duplicate Skeleton":"複製骨架","Delete Skeleton":"刪除骨架","Move Mode":"移動模式","Show Edge Map":"顯示邊緣圖","Camera Near":"相機近端距離","Camera Far":"相機遠端距離","Camera Focal Length":"相機焦距","Downloading Hand Model":"下載手部模型中","Updates are available, please confirm!!":"有更新,請確認!!","Select a scene file":"選擇場景檔案","Oops...":"糟糕...","Something went wrong!":"出了些問題!","If the problem persists, please click here to ask a question.":"如果問題持續存在,請點擊此處發起提問。","Save Scene":"儲存場景","Load Scene":"載入場景","Restore Last Scene":"恢復上一個場景","Set Background Image":"設定背景圖片","Select an image":"選擇圖片","Body Parameters":"身體參數","Shoulder Width":"肩寬","Shoulder To Hip":"肩臀長","Arm Length":"手臂長",Forearm:qR,"Upper Arm":"上臂","Hand Size":"手部大小",Hips:ZR,"Leg Length":"腿長",Thigh:QR,"Lower Leg":"小腿","Nose To Neck":"鼻子到頸部的距離","Head Size":"頭部大小","Show Preview":"顯示預覽","Only Hand":"僅手部","Foot Size":"腳部大小","Downloading Foot Model":"下載腳部模型中","Please select a skeleton!!":"請選擇骨架!","Downloading Poses Library":"正在下載姿勢庫","Set Random Pose":"設置隨機姿勢",Redo:JR,Undo:eD,"Detect From Image":"從圖片中偵測","Downloading MediaPipe Pose Model":"下載 MediaPipe 姿勢模型中",Edit:tD,Setting:nD,"Bone Thickness":"骨骼厚度",Feedback:rD,View:iD,"Fix View":"固定檢視","Restore View":"還原檢視","Free Mode":"自由模式",Del:oD,File:sD,Generate:aD,Close:lD,Update:cD,"Lock View":"鎖定視圖","Unlock View":"解鎖視圖","Copy Keypoint Data":"複製關鍵點數據","Copied to Clipboard":"已複製到剪貼板","Generate Scene URL":"生成場景URL","Reset Scene":"重置場景","Load Gesture":"載入手勢","Save Gesture":"儲存手勢","Please select a hand!!":"請選擇一隻手!!","If you try to detect anime characters, you may get an error. Please try again with photos.":"如果您嘗試檢測動漫角色,可能會出現錯誤。請使用照片再試一次。","Show Grid":"顯示網格"},fD="寬度",dD="高度",hD="前臂",pD="臀部",mD="大腿",gD="重做",vD="撤銷",yD="編輯",_D="設定",xD="回饋",wD="檢視",SD="Del",bD="文件",MD="生成",ED="關閉",TD="更新",CD={Width:fD,Height:dD,"Generate Skeleton/Depth/Normal/Canny Map":"生成骨架/深度/法線/Canny圖","Duplicate Skeleton":"複製骨架","Delete Skeleton":"刪除骨架","Move Mode":"移動模式","Show Edge Map":"顯示邊緣圖","Camera Near":"相機near","Camera Far":"相機far","Camera Focal Length":"相機焦距","Downloading Hand Model":"正在下載手部模型","Updates are available, please confirm!!":"有更新啦,请确认!!","Select a scene file":"選擇場景檔案","Oops...":"哎呀...","Something went wrong!":"出現問題!","If the problem persists, please click here to ask a question.":"如果問題仍然存在,請點擊此處發問。","Save Scene":"儲存場景","Load Scene":"載入場景","Restore Last Scene":"恢復上次場景","Set Background Image":"設置背景圖片","Select an image":"選擇圖片","Body Parameters":"身體參數","Shoulder Width":"肩寬","Shoulder To Hip":"肩臀長度","Arm Length":"手臂長度",Forearm:hD,"Upper Arm":"上臂","Hand Size":"手部尺寸",Hips:pD,"Leg Length":"腿長",Thigh:mD,"Lower Leg":"小腿","Nose To Neck":"鼻子到脖子的距離","Head Size":"頭部尺寸","Show Preview":"顯示預覽","Only Hand":"只顯示手部","Foot Size":"腳部尺寸","Downloading Foot Model":"正在下載腳部模型","Please select a skeleton!!":"請選擇骨架!","Downloading Poses Library":"下載姿勢庫中","Set Random Pose":"設定隨機姿勢",Redo:gD,Undo:vD,"Detect From Image":"從圖片中偵測","Downloading MediaPipe Pose Model":"下載 MediaPipe 姿勢模型",Edit:yD,Setting:_D,"Bone Thickness":"骨骼厚度",Feedback:xD,View:wD,"Fix View":"固定檢視","Restore View":"還原檢視","Free Mode":"自由模式",Del:SD,File:bD,Generate:MD,Close:ED,Update:TD,"Lock View":"鎖定視圖","Unlock View":"解鎖視圖","Copy Keypoint Data":"複製關鍵點數據","Copied to Clipboard":"已複製到剪貼板","Generate Scene URL":"生成場景URL","Reset Scene":"重置場景","Load Gesture":"載入手勢","Save Gesture":"儲存手勢","Please select a hand!!":"請選擇一隻手!!","If you try to detect anime characters, you may get an error. Please try again with photos.":"如果您嘗試檢測動漫角色,可能會出現錯誤。請使用照片再試一次。","Show Grid":"顯示網格"},PD="幅",AD="高さ",LD="前腕",RD="ヒップ",DD="太もも",ID="やり直し",kD="元に戻す",OD="編集",FD="設定",ND="フィードバック",$D="ビュー",UD="Del",zD="ファイル",BD="生成する",VD="閉じる",HD="更新する",GD={Width:PD,Height:AD,"Generate Skeleton/Depth/Normal/Canny Map":"スケルトン/深度/法線/Cannyマップを生成","Duplicate Skeleton":"スケルトンの複製","Delete Skeleton":"スケルトンの削除","Move Mode":"移動モード","Show Edge Map":"エッジマップを表示","Camera Near":"カメラ近距離","Camera Far":"カメラ遠距離","Camera Focal Length":"カメラ焦点距離","Downloading Hand Model":"手のモデルをダウンロード中","Updates are available, please confirm!!":"アップデートが利用可能です。確認してください!","Select a scene file":"シーンファイルを選択","Oops...":"おっと...","Something went wrong!":"何かが間違っています!","If the problem persists, please click here to ask a question.":"問題が解決しない場合は、ここをクリックして質問してください。","Save Scene":"シーンを保存","Generate Scene URL":"シーンのURLを生成","Load Scene":"シーンを読み込む","Restore Last Scene":"前回のシーンを復元","Set Background Image":"背景画像を設定","Select an image":"画像を選択","Body Parameters":"身体パラメータ","Shoulder Width":"肩幅","Shoulder To Hip":"肩から腰までの距離","Arm Length":"腕の長さ",Forearm:LD,"Upper Arm":"上腕","Hand Size":"手の大きさ",Hips:RD,"Leg Length":"脚の長さ",Thigh:DD,"Lower Leg":"下腿","Nose To Neck":"鼻から首までの距離","Head Size":"頭の大きさ","Show Preview":"プレビューを表示","Only Hand":"手だけ","Foot Size":"足のサイズ","Downloading Foot Model":"足のモデルをダウンロード中","Please select a skeleton!!":"骨格を選択してください!","Downloading Poses Library":"ポーズライブラリをダウンロード中","Set Random Pose":"ランダムポーズを設定",Redo:ID,Undo:kD,"Detect From Image":"画像から検出","Downloading MediaPipe Pose Model":"MediaPipeポーズモデルをダウンロード中",Edit:OD,Setting:FD,"Bone Thickness":"ボーンの太さ",Feedback:ND,View:$D,"Fix View":"ビューを固定する","Restore View":"ビューを復元する","Free Mode":"フリーモード",Del:UD,File:zD,Generate:BD,Close:VD,Update:HD,"Lock View":"ビューをロックする","Unlock View":"ビューをアンロックする","Copy Keypoint Data":"キーポイントデータをコピーする","Copied to Clipboard":"クリップボードにコピーされました","Reset Scene":"シーンをリセットする","Load Gesture":"ジェスチャーを読み込む","Save Gesture":"ジェスチャーを保存する","Please select a hand!!":"手を選択してください!!","If you try to detect anime characters, you may get an error. Please try again with photos.":"アニメキャラクターを検出しようとするとエラーが発生する場合があります。写真で再度お試しください。","Show Grid":"グリッドを表示"},WD="Breite",jD="Höhe",XD="Unterarm",KD="Gesäß",YD="Oberschenkel",qD="Redo",ZD="Undo",QD="bearbeiten",JD="Einstellungen",eI="Problem melden",tI="Ansicht",nI="Entf",rI="Datei",iI="Generieren",oI="Schließen",sI="Aktualisieren",aI={Width:WD,Height:jD,"Generate Skeleton/Depth/Normal/Canny Map":"Knochenbau/Depth/Normale/Canny Bilder generieren","Duplicate Skeleton":"Knochenbau kopieren","Delete Skeleton":"Knochenbau löschen","Move Mode":"Verschiebungsmode","Show Edge Map":"Randbild zeigen","Camera Near":"Kamera näher schieben","Camera Far":"Kamera weiter ziehen","Camera Focal Length":"Brennweite","Downloading Hand Model":"Hand Modell herunterladen","Updates are available, please confirm!!":"Bestätigen Sie die Aktualisierung!","Select a scene file":"Wählen Sie eine Szene","Oops...":"Oops...","Something went wrong!":"Irgendwas hat schief gelaufen!","If the problem persists, please click here to ask a question.":"Bitte melden Sie hier, um Frage zu stellen.","Save Scene":"Szene speichern","Load Scene":"Szene laden","Restore Last Scene":"Szene wiederherstellen","Set Background Image":"Hintergrundbild laden","Select an image":"Wählen Sie ein Bild","Body Parameters":"Körper Parameter","Shoulder Width":"Schulterbreite","Shoulder To Hip":"Von Schulter zu Gesäß","Arm Length":"Armlänge",Forearm:XD,"Upper Arm":"Oberarm","Hand Size":"Handgröße",Hips:KD,"Leg Length":"Beinlänge",Thigh:YD,"Lower Leg":"Unterschenkel","Nose To Neck":"Von Nase zu Hals","Head Size":"Kopfgröße","Show Preview":"Überblick zeigen","Only Hand":"Nur Hände","Foot Size":"Fußgröße","Downloading Foot Model":"Fuß Modell herunterladen","Please select a skeleton!!":"Wählen Sie einen Knochenbau!","Downloading Poses Library":"Pose Bibliothek herunterladen","Set Random Pose":"zufällige Pose",Redo:qD,Undo:ZD,"Detect From Image":"Knochenbau von Bild erkennen","Downloading MediaPipe Pose Model":"MediaPipe Pose Modell herunterladen",Edit:QD,Setting:JD,"Bone Thickness":"Dicke des Knochens",Feedback:eI,View:tI,"Fix View":"Ansicht fixieren","Restore View":"Ansicht wiederherstellen","Free Mode":"Freier Modus",Del:nI,File:rI,Generate:iI,Close:oI,Update:sI,"Lock View":"Ansicht sperren","Unlock View":"Ansicht entsperren","Copy Keypoint Data":"Schlüsselpunktdaten kopieren","Copied to Clipboard":"In die Zwischenablage kopiert","Generate Scene URL":"Szene-URL generieren","Reset Scene":"Szene zurücksetzen","Load Gesture":"Geste laden","Save Gesture":"Geste speichern","Please select a hand!!":"Bitte wählen Sie eine Hand aus!!","If you try to detect anime characters, you may get an error. Please try again with photos.":"Bei dem Versuch, Anime-Charaktere zu erkennen, kann es zu einem Fehler kommen. Bitte versuchen Sie es erneut mit Fotos.","Show Grid":"Gitter anzeigen"},lI="ancho",cI="altura",uI="antebrazo",fI="caderas",dI="muslo",hI="rehacer",pI="deshacer",mI="editar",gI="ajustes",vI="realimentación",yI="Ver",_I="Remoto",xI="Archivo",wI="Generar",SI="Cerrar",bI="Actualizar",MI={Width:lI,Height:cI,"Generate Skeleton/Depth/Normal/Canny Map":"generar esqueleto/profundidad/normal/generar mapa astuto","Duplicate Skeleton":"copiar esqueleto","Delete Skeleton":"eliminar esqueleto","Move Mode":"modo de movimiento","Show Edge Map":"mostart mapa de borde","Camera Near":"cámera cerca","Camera Far":"cámera lejos","Camera Focal Length":"distancia focal de la cámara","Downloading Hand Model":"descargar el modelo de mano","Updates are available, please confirm!!":"confirmar la(s) actualización(es)","Select a scene file":"selecciona un archivo de escena","Oops...":"¡Uy!","Something went wrong!":"algo salío mal","If the problem persists, please click here to ask a question.":"si el problema persiste haga clic aquí oara hacer una pregunta.","Save Scene":"guardar escena","Load Scene":"cargar la escena","Restore Last Scene":"restaurar la última escena","Set Background Image":"establecer la imagen de fondo","Select an image":"selecciona una imagen","Body Parameters":"parámetros del cuepro","Shoulder Width":"ancho de los hombros","Shoulder To Hip":"de hombro a cadera","Arm Length":"longitud del brazo",Forearm:uI,"Upper Arm":"brazo ","Hand Size":"tamaño de la mano",Hips:fI,"Leg Length":"longitud de la pierna",Thigh:dI,"Lower Leg":"parte inferior de la pierna","Nose To Neck":"de la nariz al cuello","Head Size":"tamaño de la cabeza","Show Preview":"mostrar vista previa","Only Hand":"solo manos","Foot Size":"tamaño del pie","Downloading Foot Model":"descargando el modelo de pie","Please select a skeleton!!":"¡selecciona un esqueleto!","Downloading Poses Library":"descargando la biblioteca de poses","Set Random Pose":"pose aletoria",Redo:hI,Undo:pI,"Detect From Image":"detectar desde la imagen","Downloading MediaPipe Pose Model":"descargando el modelo de pose de MediaPipe",Edit:mI,Setting:gI,"Bone Thickness":"grosor del hueso",Feedback:vI,View:yI,"Fix View":"Fijar Vista","Restore View":"Restaurar Vista","Free Mode":"Modo libre",Del:_I,File:xI,Generate:wI,Close:SI,Update:bI,"Lock View":"Bloquear vista","Unlock View":"Desbloquear vista","Copy Keypoint Data":"Copiar datos del punto clave","Copied to Clipboard":"Copiado al portapapeles","Generate Scene URL":"Generar URL de escena","Reset Scene":"Restablecer escena","Load Gesture":"Cargar gesto","Save Gesture":"Guardar gesto","Please select a hand!!":"¡¡Por favor, seleccione una mano!!","If you try to detect anime characters, you may get an error. Please try again with photos.":"Si intenta detectar personajes de anime, es posible que obtenga un error. Por favor, inténtelo de nuevo con fotos.","Show Grid":"Mostrar cuadrícula"},S1={en:{common:LR},zh:{common:XR},"zh-TW":{common:uD},"zh-HK":{common:CD},ja:{common:GD},de:{common:aI},sp:{common:MI}},cp={en:"English",zh:"简体中文","zh-TW":"繁體中文(台灣)","zh-HK":"繁體中文(香港)",ja:"日本語",de:"Deutsch",sp:"español"},EI={order:["querystring","localStorage","navigator"],lookupQuerystring:"lng"};ge.use(tM).init({detection:EI,fallbackLng:"en",debug:!0,ns:["common"],defaultNS:"common",supportedLngs:Object.keys(S1),interpolation:{escapeValue:!1},resources:S1});function nM(){return ge.language==="zh-CN"||window.navigator.language==="zh-CN"||window.navigator.language?.includes("zh-CN")}console.log("0.1.18 "+pw(1681564824381).format("YYYY-MM-DD HH:mm:ss"));var sg={},b1=Fo;sg.createRoot=b1.createRoot,sg.hydrateRoot=b1.hydrateRoot;function rM(n,e){const t=document.createElement("a");t.setAttribute("href",n),t.setAttribute("download",e),t.click()}function M1(n,e){const t=new Blob([n],{type:"text/json"}),r=window.URL.createObjectURL(t);rM(r,e),URL.revokeObjectURL(r)}async function iM(n={}){let e;return Array.isArray(n)?e=n:e=[n],new Promise((t,r)=>{const i=document.createElement("input");i.type="file";const o=[...e.map(f=>f.mimeTypes||[]),...e.map(f=>f.extensions||[])].join();i.multiple=e[0].multiple||!1,i.accept=o||"",i.style.display="none",document.body.append(i);const s=()=>l?.(r),a=f=>{typeof l=="function"&&l(),t(f)},l=e[0].legacySetup&&e[0].legacySetup(a,s,i),c=()=>{window.removeEventListener("focus",c),i.remove()};i.addEventListener("click",()=>{window.addEventListener("focus",c)}),i.addEventListener("change",()=>{window.removeEventListener("focus",c),i.remove(),i.files?a(i.multiple?Array.from(i.files):i.files[0]):s()}),"showPicker"in HTMLInputElement.prototype?i.showPicker():i.click()})}async function oM(){try{const n=await iM({mimeTypes:["application/json"],legacySetup:(e,t)=>{const r=setTimeout(t,1e4);return i=>{clearTimeout(r),i&&(console.error("reject"),i("Failed to Open file"))}}});return await new Promise((e,t)=>{const r=new FileReader;r.onload=function(){e(r.result)},r.onerror=function(){t(r.error)},Array.isArray(n)==!1?r.readAsText(n):t("Don't select multiple files")})}catch(n){return console.log(n),null}}async function sM(){try{const n=await iM({mimeTypes:["image/*"],legacySetup:(e,t)=>{const r=setTimeout(t,1e4);return i=>{clearTimeout(r),console.log("reject"),i&&i("Open file timeout")}}});return await new Promise((e,t)=>{const r=new FileReader;r.onload=function(){e(r.result)},r.onerror=function(){t(r.error)},Array.isArray(n)==!1?r.readAsDataURL(n):t("Don't select multiple files")})}catch(n){return console.log(n),null}}async function E1(n){try{await navigator.clipboard.writeText(n)}catch{const t=document.createElement("input");t.type="text",t.style.display="none",t.value=n,t.ariaHidden="true",t.style.all="unset",t.style.position="fixed",t.style.top="0",t.style.clip="rect(0, 0, 0, 0)",document.body.append(t),t.select();const r=document.execCommand("copy");if(t.remove(),!r)throw new Error("copy command was unsuccessful")}}const TI="_app_1w6pk_1",CI="_threejsCanvas_1w6pk_9",PI="_gallery_1w6pk_15",AI="_background_1w6pk_35",LI={app:TI,threejsCanvas:CI,gallery:PI,background:AI};function tu(n){const e=n+"CollectionProvider",[t,r]=vi(e),[i,o]=t(e,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:v,children:m}=p,g=Dt.useRef(null),_=Dt.useRef(new Map).current;return Dt.createElement(i,{scope:v,itemMap:_,collectionRef:g},m)},a=n+"CollectionSlot",l=Dt.forwardRef((p,v)=>{const{scope:m,children:g}=p,_=o(a,m),y=Ot(v,_.collectionRef);return Dt.createElement(As,{ref:y},g)}),c=n+"CollectionItemSlot",f="data-radix-collection-item",u=Dt.forwardRef((p,v)=>{const{scope:m,children:g,..._}=p,y=Dt.useRef(null),x=Ot(v,y),S=o(c,m);return Dt.useEffect(()=>(S.itemMap.set(y,{ref:y,..._}),()=>void S.itemMap.delete(y))),Dt.createElement(As,{[f]:"",ref:x},g)});function d(p){const v=o(n+"CollectionConsumer",p);return Dt.useCallback(()=>{const g=v.collectionRef.current;if(!g)return[];const _=Array.from(g.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((S,T)=>_.indexOf(S.ref.current)-_.indexOf(T.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:l,ItemSlot:u},d,r]}const RI=b.createContext(void 0);function Jd(n){const e=b.useContext(RI);return n||e||"ltr"}function ks(n){return n.split("-")[0]}function nu(n){return n.split("-")[1]}function sl(n){return["top","bottom"].includes(ks(n))?"x":"y"}function D0(n){return n==="y"?"height":"width"}function T1(n,e,t){let{reference:r,floating:i}=n;const o=r.x+r.width/2-i.width/2,s=r.y+r.height/2-i.height/2,a=sl(e),l=D0(a),c=r[l]/2-i[l]/2,f=a==="x";let u;switch(ks(e)){case"top":u={x:o,y:r.y-i.height};break;case"bottom":u={x:o,y:r.y+r.height};break;case"right":u={x:r.x+r.width,y:s};break;case"left":u={x:r.x-i.width,y:s};break;default:u={x:r.x,y:r.y}}switch(nu(e)){case"start":u[a]-=c*(t&&f?-1:1);break;case"end":u[a]+=c*(t&&f?-1:1)}return u}const DI=async(n,e,t)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=t,a=await(s.isRTL==null?void 0:s.isRTL(e));let l=await s.getElementRects({reference:n,floating:e,strategy:i}),{x:c,y:f}=T1(l,r,a),u=r,d={},p=0;for(let v=0;v({name:"arrow",options:n,async fn(e){const{element:t,padding:r=0}=n??{},{x:i,y:o,placement:s,rects:a,platform:l}=e;if(t==null)return{};const c=aM(r),f={x:i,y:o},u=sl(s),d=nu(s),p=D0(u),v=await l.getDimensions(t),m=u==="y"?"top":"left",g=u==="y"?"bottom":"right",_=a.reference[p]+a.reference[u]-f[u]-a.floating[p],y=f[u]-a.reference[u],x=await(l.getOffsetParent==null?void 0:l.getOffsetParent(t));let S=x?u==="y"?x.clientHeight||0:x.clientWidth||0:0;S===0&&(S=a.floating[p]);const T=_/2-y/2,C=c[m],L=S-v[p]-c[g],E=S/2-v[p]/2+T,A=ag(C,E,L),I=(d==="start"?c[m]:c[g])>0&&E!==A&&a.reference[p]<=a.floating[p];return{[u]:f[u]-(I?EkI[e])}function OI(n,e,t){t===void 0&&(t=!1);const r=nu(n),i=sl(n),o=D0(i);let s=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=gd(s)),{main:s,cross:gd(s)}}const FI={start:"end",end:"start"};function P1(n){return n.replace(/start|end/g,e=>FI[e])}const lM=["top","right","bottom","left"];lM.reduce((n,e)=>n.concat(e,e+"-start",e+"-end"),[]);const NI=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t;const{placement:r,middlewareData:i,rects:o,initialPlacement:s,platform:a,elements:l}=e,{mainAxis:c=!0,crossAxis:f=!0,fallbackPlacements:u,fallbackStrategy:d="bestFit",flipAlignment:p=!0,...v}=n,m=ks(r),g=u||(m===s||!p?[gd(s)]:function(E){const A=gd(E);return[P1(E),A,P1(A)]}(s)),_=[s,...g],y=await Fc(e,v),x=[];let S=((t=i.flip)==null?void 0:t.overflows)||[];if(c&&x.push(y[m]),f){const{main:E,cross:A}=OI(r,o,await(a.isRTL==null?void 0:a.isRTL(l.floating)));x.push(y[E],y[A])}if(S=[...S,{placement:r,overflows:x}],!x.every(E=>E<=0)){var T,C;const E=((T=(C=i.flip)==null?void 0:C.index)!=null?T:0)+1,A=_[E];if(A)return{data:{index:E,overflows:S},reset:{placement:A}};let I="bottom";switch(d){case"bestFit":{var L;const q=(L=S.map(ee=>[ee,ee.overflows.filter(H=>H>0).reduce((H,R)=>H+R,0)]).sort((ee,H)=>ee[1]-H[1])[0])==null?void 0:L[0].placement;q&&(I=q);break}case"initialPlacement":I=s}if(r!==I)return{reset:{placement:I}}}return{}}}};function A1(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function L1(n){return lM.some(e=>n[e]>=0)}const $I=function(n){let{strategy:e="referenceHidden",...t}=n===void 0?{}:n;return{name:"hide",async fn(r){const{rects:i}=r;switch(e){case"referenceHidden":{const o=A1(await Fc(r,{...t,elementContext:"reference"}),i.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:L1(o)}}}case"escaped":{const o=A1(await Fc(r,{...t,altBoundary:!0}),i.floating);return{data:{escapedOffsets:o,escaped:L1(o)}}}default:return{}}}}},UI=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){const{x:t,y:r}=e,i=await async function(o,s){const{placement:a,platform:l,elements:c}=o,f=await(l.isRTL==null?void 0:l.isRTL(c.floating)),u=ks(a),d=nu(a),p=sl(a)==="x",v=["left","top"].includes(u)?-1:1,m=f&&p?-1:1,g=typeof s=="function"?s(o):s;let{mainAxis:_,crossAxis:y,alignmentAxis:x}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...g};return d&&typeof x=="number"&&(y=d==="end"?-1*x:x),p?{x:y*m,y:_*v}:{x:_*v,y:y*m}}(e,n);return{x:t+i.x,y:r+i.y,data:i}}}};function cM(n){return n==="x"?"y":"x"}const zI=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:g=>{let{x:_,y}=g;return{x:_,y}}},...l}=n,c={x:t,y:r},f=await Fc(e,l),u=sl(ks(i)),d=cM(u);let p=c[u],v=c[d];if(o){const g=u==="y"?"bottom":"right";p=ag(p+f[u==="y"?"top":"left"],p,p-f[g])}if(s){const g=d==="y"?"bottom":"right";v=ag(v+f[d==="y"?"top":"left"],v,v-f[g])}const m=a.fn({...e,[u]:p,[d]:v});return{...m,data:{x:m.x-t,y:m.y-r}}}}},BI=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:t,y:r,placement:i,rects:o,middlewareData:s}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=n,f={x:t,y:r},u=sl(i),d=cM(u);let p=f[u],v=f[d];const m=typeof a=="function"?a({...o,placement:i}):a,g=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const T=u==="y"?"height":"width",C=o.reference[u]-o.floating[T]+g.mainAxis,L=o.reference[u]+o.reference[T]-g.mainAxis;pL&&(p=L)}if(c){var _,y,x,S;const T=u==="y"?"width":"height",C=["top","left"].includes(ks(i)),L=o.reference[d]-o.floating[T]+(C&&(_=(y=s.offset)==null?void 0:y[d])!=null?_:0)+(C?0:g.crossAxis),E=o.reference[d]+o.reference[T]+(C?0:(x=(S=s.offset)==null?void 0:S[d])!=null?x:0)-(C?g.crossAxis:0);vE&&(v=E)}return{[u]:p,[d]:v}}}},VI=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){const{placement:t,rects:r,platform:i,elements:o}=e,{apply:s,...a}=n,l=await Fc(e,a),c=ks(t),f=nu(t);let u,d;c==="top"||c==="bottom"?(u=c,d=f===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(d=c,u=f==="end"?"top":"bottom");const p=ls(l.left,0),v=ls(l.right,0),m=ls(l.top,0),g=ls(l.bottom,0),_={availableHeight:r.floating.height-(["left","right"].includes(t)?2*(m!==0||g!==0?m+g:ls(l.top,l.bottom)):l[u]),availableWidth:r.floating.width-(["top","bottom"].includes(t)?2*(p!==0||v!==0?p+v:ls(l.left,l.right)):l[d])},y=await i.getDimensions(o.floating);s?.({...e,..._});const x=await i.getDimensions(o.floating);return y.width!==x.width||y.height!==x.height?{reset:{rects:!0}}:{}}}};function uM(n){return n&&n.document&&n.location&&n.alert&&n.setInterval}function Yi(n){if(n==null)return window;if(!uM(n)){const e=n.ownerDocument;return e&&e.defaultView||window}return n}function ru(n){return Yi(n).getComputedStyle(n)}function Bi(n){return uM(n)?"":n?(n.nodeName||"").toLowerCase():""}function fM(){const n=navigator.userAgentData;return n!=null&&n.brands?n.brands.map(e=>e.brand+"/"+e.version).join(" "):navigator.userAgent}function mi(n){return n instanceof Yi(n).HTMLElement}function zo(n){return n instanceof Yi(n).Element}function I0(n){return typeof ShadowRoot>"u"?!1:n instanceof Yi(n).ShadowRoot||n instanceof ShadowRoot}function eh(n){const{overflow:e,overflowX:t,overflowY:r}=ru(n);return/auto|scroll|overlay|hidden/.test(e+r+t)}function HI(n){return["table","td","th"].includes(Bi(n))}function R1(n){const e=/firefox/i.test(fM()),t=ru(n);return t.transform!=="none"||t.perspective!=="none"||t.contain==="paint"||["transform","perspective"].includes(t.willChange)||e&&t.willChange==="filter"||e&&!!t.filter&&t.filter!=="none"}function dM(){return!/^((?!chrome|android).)*safari/i.test(fM())}const D1=Math.min,dc=Math.max,vd=Math.round;function Vi(n,e,t){var r,i,o,s;e===void 0&&(e=!1),t===void 0&&(t=!1);const a=n.getBoundingClientRect();let l=1,c=1;e&&mi(n)&&(l=n.offsetWidth>0&&vd(a.width)/n.offsetWidth||1,c=n.offsetHeight>0&&vd(a.height)/n.offsetHeight||1);const f=zo(n)?Yi(n):window,u=!dM()&&t,d=(a.left+(u&&(r=(i=f.visualViewport)==null?void 0:i.offsetLeft)!=null?r:0))/l,p=(a.top+(u&&(o=(s=f.visualViewport)==null?void 0:s.offsetTop)!=null?o:0))/c,v=a.width/l,m=a.height/c;return{width:v,height:m,top:p,right:d+v,bottom:p+m,left:d,x:d,y:p}}function Ro(n){return(e=n,(e instanceof Yi(e).Node?n.ownerDocument:n.document)||window.document).documentElement;var e}function th(n){return zo(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function hM(n){return Vi(Ro(n)).left+th(n).scrollLeft}function GI(n,e,t){const r=mi(e),i=Ro(e),o=Vi(n,r&&function(l){const c=Vi(l);return vd(c.width)!==l.offsetWidth||vd(c.height)!==l.offsetHeight}(e),t==="fixed");let s={scrollLeft:0,scrollTop:0};const a={x:0,y:0};if(r||!r&&t!=="fixed")if((Bi(e)!=="body"||eh(i))&&(s=th(e)),mi(e)){const l=Vi(e,!0);a.x=l.x+e.clientLeft,a.y=l.y+e.clientTop}else i&&(a.x=hM(i));return{x:o.left+s.scrollLeft-a.x,y:o.top+s.scrollTop-a.y,width:o.width,height:o.height}}function pM(n){return Bi(n)==="html"?n:n.assignedSlot||n.parentNode||(I0(n)?n.host:null)||Ro(n)}function I1(n){return mi(n)&&getComputedStyle(n).position!=="fixed"?n.offsetParent:null}function lg(n){const e=Yi(n);let t=I1(n);for(;t&&HI(t)&&getComputedStyle(t).position==="static";)t=I1(t);return t&&(Bi(t)==="html"||Bi(t)==="body"&&getComputedStyle(t).position==="static"&&!R1(t))?e:t||function(r){let i=pM(r);for(I0(i)&&(i=i.host);mi(i)&&!["html","body"].includes(Bi(i));){if(R1(i))return i;i=i.parentNode}return null}(n)||e}function k1(n){if(mi(n))return{width:n.offsetWidth,height:n.offsetHeight};const e=Vi(n);return{width:e.width,height:e.height}}function mM(n){const e=pM(n);return["html","body","#document"].includes(Bi(e))?n.ownerDocument.body:mi(e)&&eh(e)?e:mM(e)}function yd(n,e){var t;e===void 0&&(e=[]);const r=mM(n),i=r===((t=n.ownerDocument)==null?void 0:t.body),o=Yi(r),s=i?[o].concat(o.visualViewport||[],eh(r)?r:[]):r,a=e.concat(s);return i?a:a.concat(yd(s))}function O1(n,e,t){return e==="viewport"?md(function(r,i){const o=Yi(r),s=Ro(r),a=o.visualViewport;let l=s.clientWidth,c=s.clientHeight,f=0,u=0;if(a){l=a.width,c=a.height;const d=dM();(d||!d&&i==="fixed")&&(f=a.offsetLeft,u=a.offsetTop)}return{width:l,height:c,x:f,y:u}}(n,t)):zo(e)?function(r,i){const o=Vi(r,!1,i==="fixed"),s=o.top+r.clientTop,a=o.left+r.clientLeft;return{top:s,left:a,x:a,y:s,right:a+r.clientWidth,bottom:s+r.clientHeight,width:r.clientWidth,height:r.clientHeight}}(e,t):md(function(r){var i;const o=Ro(r),s=th(r),a=(i=r.ownerDocument)==null?void 0:i.body,l=dc(o.scrollWidth,o.clientWidth,a?a.scrollWidth:0,a?a.clientWidth:0),c=dc(o.scrollHeight,o.clientHeight,a?a.scrollHeight:0,a?a.clientHeight:0);let f=-s.scrollLeft+hM(r);const u=-s.scrollTop;return ru(a||o).direction==="rtl"&&(f+=dc(o.clientWidth,a?a.clientWidth:0)-l),{width:l,height:c,x:f,y:u}}(Ro(n)))}function WI(n){const e=yd(n),t=["absolute","fixed"].includes(ru(n).position)&&mi(n)?lg(n):n;return zo(t)?e.filter(r=>zo(r)&&function(i,o){const s=o.getRootNode==null?void 0:o.getRootNode();if(i.contains(o))return!0;if(s&&I0(s)){let a=o;do{if(a&&i===a)return!0;a=a.parentNode||a.host}while(a)}return!1}(r,t)&&Bi(r)!=="body"):[]}const jI={getClippingRect:function(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const o=[...t==="clippingAncestors"?WI(e):[].concat(t),r],s=o[0],a=o.reduce((l,c)=>{const f=O1(e,c,i);return l.top=dc(f.top,l.top),l.right=D1(f.right,l.right),l.bottom=D1(f.bottom,l.bottom),l.left=dc(f.left,l.left),l},O1(e,s,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(n){let{rect:e,offsetParent:t,strategy:r}=n;const i=mi(t),o=Ro(t);if(t===o)return e;let s={scrollLeft:0,scrollTop:0};const a={x:0,y:0};if((i||!i&&r!=="fixed")&&((Bi(t)!=="body"||eh(o))&&(s=th(t)),mi(t))){const l=Vi(t,!0);a.x=l.x+t.clientLeft,a.y=l.y+t.clientTop}return{...e,x:e.x-s.scrollLeft+a.x,y:e.y-s.scrollTop+a.y}},isElement:zo,getDimensions:k1,getOffsetParent:lg,getDocumentElement:Ro,getElementRects:n=>{let{reference:e,floating:t,strategy:r}=n;return{reference:GI(e,lg(t),r),floating:{...k1(t),x:0,y:0}}},getClientRects:n=>Array.from(n.getClientRects()),isRTL:n=>ru(n).direction==="rtl"};function XI(n,e,t,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=!0,animationFrame:a=!1}=r,l=i&&!a,c=o&&!a,f=l||c?[...zo(n)?yd(n):[],...yd(e)]:[];f.forEach(v=>{l&&v.addEventListener("scroll",t,{passive:!0}),c&&v.addEventListener("resize",t)});let u,d=null;if(s){let v=!0;d=new ResizeObserver(()=>{v||t(),v=!1}),zo(n)&&!a&&d.observe(n),d.observe(e)}let p=a?Vi(n):null;return a&&function v(){const m=Vi(n);!p||m.x===p.x&&m.y===p.y&&m.width===p.width&&m.height===p.height||t(),p=m,u=requestAnimationFrame(v)}(),t(),()=>{var v;f.forEach(m=>{l&&m.removeEventListener("scroll",t),c&&m.removeEventListener("resize",t)}),(v=d)==null||v.disconnect(),d=null,a&&cancelAnimationFrame(u)}}const KI=(n,e,t)=>DI(n,e,{platform:jI,...t});var cg=typeof document<"u"?b.useLayoutEffect:b.useEffect;function ug(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,r,i;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!=e.length)return!1;for(r=t;r--!==0;)if(!ug(n[r],e[r]))return!1;return!0}if(i=Object.keys(n),t=i.length,t!==Object.keys(e).length)return!1;for(r=t;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[r]))return!1;for(r=t;r--!==0;){const o=i[r];if(!(o==="_owner"&&n.$$typeof)&&!ug(n[o],e[o]))return!1}return!0}return n!==n&&e!==e}function YI(n){const e=b.useRef(n);return cg(()=>{e.current=n}),e}function qI(n){let{middleware:e,placement:t="bottom",strategy:r="absolute",whileElementsMounted:i}=n===void 0?{}:n;const o=b.useRef(null),s=b.useRef(null),a=YI(i),l=b.useRef(null),[c,f]=b.useState({x:null,y:null,strategy:r,placement:t,middlewareData:{}}),[u,d]=b.useState(e);ug(u?.map(x=>{let{options:S}=x;return S}),e?.map(x=>{let{options:S}=x;return S}))||d(e);const p=b.useCallback(()=>{!o.current||!s.current||KI(o.current,s.current,{middleware:u,placement:t,strategy:r}).then(x=>{v.current&&Fo.flushSync(()=>{f(x)})})},[u,t,r]);cg(()=>{v.current&&p()},[p]);const v=b.useRef(!1);cg(()=>(v.current=!0,()=>{v.current=!1}),[]);const m=b.useCallback(()=>{if(typeof l.current=="function"&&(l.current(),l.current=null),o.current&&s.current)if(a.current){const x=a.current(o.current,s.current,p);l.current=x}else p()},[p,a]),g=b.useCallback(x=>{o.current=x,m()},[m]),_=b.useCallback(x=>{s.current=x,m()},[m]),y=b.useMemo(()=>({reference:o,floating:s}),[]);return b.useMemo(()=>({...c,update:p,refs:y,reference:g,floating:_}),[c,p,y,g,_])}const ZI=n=>{const{element:e,padding:t}=n;function r(i){return Object.prototype.hasOwnProperty.call(i,"current")}return{name:"arrow",options:n,fn(i){return r(e)?e.current!=null?C1({element:e.current,padding:t}).fn(i):{}:e?C1({element:e,padding:t}).fn(i):{}}}},QI=b.forwardRef((n,e)=>{const{children:t,width:r=10,height:i=5,...o}=n;return b.createElement(vt.svg,Se({},o,{ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),n.asChild?t:b.createElement("polygon",{points:"0,0 30,0 15,10"}))}),JI=QI;function ek(n){const[e,t]=b.useState(void 0);return ki(()=>{if(n){t({width:n.offsetWidth,height:n.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const l=o.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=n.offsetWidth,a=n.offsetHeight;t({width:s,height:a})});return r.observe(n,{box:"border-box"}),()=>r.unobserve(n)}else t(void 0)},[n]),e}const gM="Popper",[k0,nh]=vi(gM),[tk,vM]=k0(gM),nk=n=>{const{__scopePopper:e,children:t}=n,[r,i]=b.useState(null);return b.createElement(tk,{scope:e,anchor:r,onAnchorChange:i},t)},rk="PopperAnchor",ik=b.forwardRef((n,e)=>{const{__scopePopper:t,virtualRef:r,...i}=n,o=vM(rk,t),s=b.useRef(null),a=Ot(e,s);return b.useEffect(()=>{o.onAnchorChange(r?.current||s.current)}),r?null:b.createElement(vt.div,Se({},i,{ref:a}))}),_d="PopperContent",[ok,sk]=k0(_d),[ak,lk]=k0(_d,{hasParent:!1,positionUpdateFns:new Set}),ck=b.forwardRef((n,e)=>{var t,r,i,o,s,a,l,c;const{__scopePopper:f,side:u="bottom",sideOffset:d=0,align:p="center",alignOffset:v=0,arrowPadding:m=0,collisionBoundary:g=[],collisionPadding:_=0,sticky:y="partial",hideWhenDetached:x=!1,avoidCollisions:S=!0,onPlaced:T,...C}=n,L=vM(_d,f),[E,A]=b.useState(null),I=Ot(e,U=>A(U)),[q,ee]=b.useState(null),H=ek(q),R=(t=H?.width)!==null&&t!==void 0?t:0,N=(r=H?.height)!==null&&r!==void 0?r:0,Z=u+(p!=="center"?"-"+p:""),K=typeof _=="number"?_:{top:0,right:0,bottom:0,left:0,..._},B=Array.isArray(g)?g:[g],$=B.length>0,W={padding:K,boundary:B.filter(pk),altBoundary:$},{reference:ie,floating:j,strategy:se,x:ue,y:Q,placement:me,middlewareData:pe,update:we}=qI({strategy:"fixed",placement:Z,whileElementsMounted:XI,middleware:[mk(),UI({mainAxis:d+N,alignmentAxis:v}),S?zI({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?BI():void 0,...W}):void 0,q?ZI({element:q,padding:m}):void 0,S?NI({...W}):void 0,VI({...W,apply:({elements:U,availableWidth:D,availableHeight:ae})=>{U.floating.style.setProperty("--radix-popper-available-width",`${D}px`),U.floating.style.setProperty("--radix-popper-available-height",`${ae}px`)}}),gk({arrowWidth:R,arrowHeight:N}),x?$I({strategy:"referenceHidden"}):void 0].filter(hk)});ki(()=>{ie(L.anchor)},[ie,L.anchor]);const de=ue!==null&&Q!==null,[Pe,Ne]=yM(me),He=Hn(T);ki(()=>{de&&He?.()},[de,He]);const $e=(i=pe.arrow)===null||i===void 0?void 0:i.x,et=(o=pe.arrow)===null||o===void 0?void 0:o.y,nn=((s=pe.arrow)===null||s===void 0?void 0:s.centerOffset)!==0,[Wt,zt]=b.useState();ki(()=>{E&&zt(window.getComputedStyle(E).zIndex)},[E]);const{hasParent:yt,positionUpdateFns:ft}=lk(_d,f),jt=!yt;b.useLayoutEffect(()=>{if(!jt)return ft.add(we),()=>{ft.delete(we)}},[jt,ft,we]),ki(()=>{jt&&de&&Array.from(ft).reverse().forEach(U=>requestAnimationFrame(U))},[jt,de,ft]);const Kt={"data-side":Pe,"data-align":Ne,...C,ref:I,style:{...C.style,animation:de?void 0:"none",opacity:(a=pe.hide)!==null&&a!==void 0&&a.referenceHidden?0:void 0}};return b.createElement("div",{ref:j,"data-radix-popper-content-wrapper":"",style:{position:se,left:0,top:0,transform:de?`translate3d(${Math.round(ue)}px, ${Math.round(Q)}px, 0)`:"translate3d(0, -200%, 0)",minWidth:"max-content",zIndex:Wt,["--radix-popper-transform-origin"]:[(l=pe.transformOrigin)===null||l===void 0?void 0:l.x,(c=pe.transformOrigin)===null||c===void 0?void 0:c.y].join(" ")},dir:n.dir},b.createElement(ok,{scope:f,placedSide:Pe,onArrowChange:ee,arrowX:$e,arrowY:et,shouldHideArrow:nn},jt?b.createElement(ak,{scope:f,hasParent:!0,positionUpdateFns:ft},b.createElement(vt.div,Kt)):b.createElement(vt.div,Kt)))}),uk="PopperArrow",fk={top:"bottom",right:"left",bottom:"top",left:"right"},dk=b.forwardRef(function(e,t){const{__scopePopper:r,...i}=e,o=sk(uk,r),s=fk[o.placedSide];return b.createElement("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0}},b.createElement(JI,Se({},i,{ref:t,style:{...i.style,display:"block"}})))});function hk(n){return n!==void 0}function pk(n){return n!==null}const mk=()=>({name:"anchorCssProperties",fn(n){const{rects:e,elements:t}=n,{width:r,height:i}=e.reference;return t.floating.style.setProperty("--radix-popper-anchor-width",`${r}px`),t.floating.style.setProperty("--radix-popper-anchor-height",`${i}px`),{}}}),gk=n=>({name:"transformOrigin",options:n,fn(e){var t,r,i,o,s;const{placement:a,rects:l,middlewareData:c}=e,u=((t=c.arrow)===null||t===void 0?void 0:t.centerOffset)!==0,d=u?0:n.arrowWidth,p=u?0:n.arrowHeight,[v,m]=yM(a),g={start:"0%",center:"50%",end:"100%"}[m],_=((r=(i=c.arrow)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)+d/2,y=((o=(s=c.arrow)===null||s===void 0?void 0:s.y)!==null&&o!==void 0?o:0)+p/2;let x="",S="";return v==="bottom"?(x=u?g:`${_}px`,S=`${-p}px`):v==="top"?(x=u?g:`${_}px`,S=`${l.floating.height+p}px`):v==="right"?(x=`${-p}px`,S=u?g:`${y}px`):v==="left"&&(x=`${l.floating.width+p}px`,S=u?g:`${y}px`),{data:{x,y:S}}}});function yM(n){const[e,t="center"]=n.split("-");return[e,t]}const _M=nk,xM=ik,wM=ck,vk=dk,up="rovingFocusGroup.onEntryFocus",yk={bubbles:!1,cancelable:!0},O0="RovingFocusGroup",[fg,SM,_k]=tu(O0),[xk,rh]=vi(O0,[_k]),[wk,Sk]=xk(O0),bk=b.forwardRef((n,e)=>b.createElement(fg.Provider,{scope:n.__scopeRovingFocusGroup},b.createElement(fg.Slot,{scope:n.__scopeRovingFocusGroup},b.createElement(Mk,Se({},n,{ref:e}))))),Mk=b.forwardRef((n,e)=>{const{__scopeRovingFocusGroup:t,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,...f}=n,u=b.useRef(null),d=Ot(e,u),p=Jd(o),[v=null,m]=el({prop:s,defaultProp:a,onChange:l}),[g,_]=b.useState(!1),y=Hn(c),x=SM(t),S=b.useRef(!1),[T,C]=b.useState(0);return b.useEffect(()=>{const L=u.current;if(L)return L.addEventListener(up,y),()=>L.removeEventListener(up,y)},[y]),b.createElement(wk,{scope:t,orientation:r,dir:p,loop:i,currentTabStopId:v,onItemFocus:b.useCallback(L=>m(L),[m]),onItemShiftTab:b.useCallback(()=>_(!0),[]),onFocusableItemAdd:b.useCallback(()=>C(L=>L+1),[]),onFocusableItemRemove:b.useCallback(()=>C(L=>L-1),[])},b.createElement(vt.div,Se({tabIndex:g||T===0?-1:0,"data-orientation":r},f,{ref:d,style:{outline:"none",...n.style},onMouseDown:Ve(n.onMouseDown,()=>{S.current=!0}),onFocus:Ve(n.onFocus,L=>{const E=!S.current;if(L.target===L.currentTarget&&E&&!g){const A=new CustomEvent(up,yk);if(L.currentTarget.dispatchEvent(A),!A.defaultPrevented){const I=x().filter(N=>N.focusable),q=I.find(N=>N.active),ee=I.find(N=>N.id===v),R=[q,ee,...I].filter(Boolean).map(N=>N.ref.current);bM(R)}}S.current=!1}),onBlur:Ve(n.onBlur,()=>_(!1))})))}),Ek="RovingFocusGroupItem",Tk=b.forwardRef((n,e)=>{const{__scopeRovingFocusGroup:t,focusable:r=!0,active:i=!1,tabStopId:o,...s}=n,a=wo(),l=o||a,c=Sk(Ek,t),f=c.currentTabStopId===l,u=SM(t),{onFocusableItemAdd:d,onFocusableItemRemove:p}=c;return b.useEffect(()=>{if(r)return d(),()=>p()},[r,d,p]),b.createElement(fg.ItemSlot,{scope:t,id:l,focusable:r,active:i},b.createElement(vt.span,Se({tabIndex:f?0:-1,"data-orientation":c.orientation},s,{ref:e,onMouseDown:Ve(n.onMouseDown,v=>{r?c.onItemFocus(l):v.preventDefault()}),onFocus:Ve(n.onFocus,()=>c.onItemFocus(l)),onKeyDown:Ve(n.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){c.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const m=Ak(v,c.orientation,c.dir);if(m!==void 0){v.preventDefault();let _=u().filter(y=>y.focusable).map(y=>y.ref.current);if(m==="last")_.reverse();else if(m==="prev"||m==="next"){m==="prev"&&_.reverse();const y=_.indexOf(v.currentTarget);_=c.loop?Lk(_,y+1):_.slice(y+1)}setTimeout(()=>bM(_))}})})))}),Ck={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Pk(n,e){return e!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function Ak(n,e,t){const r=Pk(n.key,t);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Ck[r]}function bM(n){const e=document.activeElement;for(const t of n)if(t===e||(t.focus(),document.activeElement!==e))return}function Lk(n,e){return n.map((t,r)=>n[(e+r)%n.length])}const MM=bk,EM=Tk,Rk=["Enter"," "],Dk=["ArrowDown","PageUp","Home"],TM=["ArrowUp","PageDown","End"],Ik=[...Dk,...TM],ih="Menu",[dg,kk,Ok]=tu(ih),[Os,Fk]=vi(ih,[Ok,nh,rh]),F0=nh(),CM=rh(),[Nk,iu]=Os(ih),[$k,N0]=Os(ih),Uk=n=>{const{__scopeMenu:e,open:t=!1,children:r,dir:i,onOpenChange:o,modal:s=!0}=n,a=F0(e),[l,c]=b.useState(null),f=b.useRef(!1),u=Hn(o),d=Jd(i);return b.useEffect(()=>{const p=()=>{f.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>f.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),b.createElement(_M,a,b.createElement(Nk,{scope:e,open:t,onOpenChange:u,content:l,onContentChange:c},b.createElement($k,{scope:e,onClose:b.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:f,dir:d,modal:s},r)))},zk=b.forwardRef((n,e)=>{const{__scopeMenu:t,...r}=n,i=F0(t);return b.createElement(xM,Se({},i,r,{ref:e}))}),PM="MenuPortal",[Bk,Vk]=Os(PM,{forceMount:void 0}),Hk=n=>{const{__scopeMenu:e,forceMount:t,children:r,container:i}=n,o=iu(PM,e);return b.createElement(Bk,{scope:e,forceMount:t},b.createElement(yi,{present:t||o.open},b.createElement(Kd,{asChild:!0,container:i},r)))},Do="MenuContent",[Gk,AM]=Os(Do),Wk=b.forwardRef((n,e)=>{const t=Vk(Do,n.__scopeMenu),{forceMount:r=t.forceMount,...i}=n,o=iu(Do,n.__scopeMenu),s=N0(Do,n.__scopeMenu);return b.createElement(dg.Provider,{scope:n.__scopeMenu},b.createElement(yi,{present:r||o.open},b.createElement(dg.Slot,{scope:n.__scopeMenu},s.modal?b.createElement(jk,Se({},i,{ref:e})):b.createElement(Xk,Se({},i,{ref:e})))))}),jk=b.forwardRef((n,e)=>{const t=iu(Do,n.__scopeMenu),r=b.useRef(null),i=Ot(e,r);return b.useEffect(()=>{const o=r.current;if(o)return P0(o)},[]),b.createElement(LM,Se({},n,{ref:i,trapFocus:t.open,disableOutsidePointerEvents:t.open,disableOutsideScroll:!0,onFocusOutside:Ve(n.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>t.onOpenChange(!1)}))}),Xk=b.forwardRef((n,e)=>{const t=iu(Do,n.__scopeMenu);return b.createElement(LM,Se({},n,{ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>t.onOpenChange(!1)}))}),LM=b.forwardRef((n,e)=>{const{__scopeMenu:t,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:u,onInteractOutside:d,onDismiss:p,disableOutsideScroll:v,...m}=n,g=iu(Do,t),_=N0(Do,t),y=F0(t),x=CM(t),S=kk(t),[T,C]=b.useState(null),L=b.useRef(null),E=Ot(e,L,g.onContentChange),A=b.useRef(0),I=b.useRef(""),q=b.useRef(0),ee=b.useRef(null),H=b.useRef("right"),R=b.useRef(0),N=v?C0:b.Fragment,Z=v?{as:As,allowPinchZoom:!0}:void 0,K=$=>{var W,ie;const j=I.current+$,se=S().filter(de=>!de.disabled),ue=document.activeElement,Q=(W=se.find(de=>de.ref.current===ue))===null||W===void 0?void 0:W.textValue,me=se.map(de=>de.textValue),pe=uO(me,j,Q),we=(ie=se.find(de=>de.textValue===pe))===null||ie===void 0?void 0:ie.ref.current;(function de(Pe){I.current=Pe,window.clearTimeout(A.current),Pe!==""&&(A.current=window.setTimeout(()=>de(""),1e3))})(j),we&&setTimeout(()=>we.focus())};b.useEffect(()=>()=>window.clearTimeout(A.current),[]),T0();const B=b.useCallback($=>{var W,ie;return H.current===((W=ee.current)===null||W===void 0?void 0:W.side)&&dO($,(ie=ee.current)===null||ie===void 0?void 0:ie.area)},[]);return b.createElement(Gk,{scope:t,searchRef:I,onItemEnter:b.useCallback($=>{B($)&&$.preventDefault()},[B]),onItemLeave:b.useCallback($=>{var W;B($)||((W=L.current)===null||W===void 0||W.focus(),C(null))},[B]),onTriggerLeave:b.useCallback($=>{B($)&&$.preventDefault()},[B]),pointerGraceTimerRef:q,onPointerGraceIntentChange:b.useCallback($=>{ee.current=$},[])},b.createElement(N,Z,b.createElement(E0,{asChild:!0,trapped:i,onMountAutoFocus:Ve(o,$=>{var W;$.preventDefault(),(W=L.current)===null||W===void 0||W.focus()}),onUnmountAutoFocus:s},b.createElement(Xd,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:u,onInteractOutside:d,onDismiss:p},b.createElement(MM,Se({asChild:!0},x,{dir:_.dir,orientation:"vertical",loop:r,currentTabStopId:T,onCurrentTabStopIdChange:C,onEntryFocus:Ve(l,$=>{_.isUsingKeyboardRef.current||$.preventDefault()})}),b.createElement(wM,Se({role:"menu","aria-orientation":"vertical","data-state":aO(g.open),"data-radix-menu-content":"",dir:_.dir},y,m,{ref:E,style:{outline:"none",...m.style},onKeyDown:Ve(m.onKeyDown,$=>{const ie=$.target.closest("[data-radix-menu-content]")===$.currentTarget,j=$.ctrlKey||$.altKey||$.metaKey,se=$.key.length===1;ie&&($.key==="Tab"&&$.preventDefault(),!j&&se&&K($.key));const ue=L.current;if($.target!==ue||!Ik.includes($.key))return;$.preventDefault();const me=S().filter(pe=>!pe.disabled).map(pe=>pe.ref.current);TM.includes($.key)&&me.reverse(),lO(me)}),onBlur:Ve(n.onBlur,$=>{$.currentTarget.contains($.target)||(window.clearTimeout(A.current),I.current="")}),onPointerMove:Ve(n.onPointerMove,pg($=>{const W=$.target,ie=R.current!==$.clientX;if($.currentTarget.contains(W)&&ie){const j=$.clientX>R.current?"right":"left";H.current=j,R.current=$.clientX}}))})))))))}),Kk=b.forwardRef((n,e)=>{const{__scopeMenu:t,...r}=n;return b.createElement(vt.div,Se({role:"group"},r,{ref:e}))}),hg="MenuItem",F1="menu.itemSelect",$0=b.forwardRef((n,e)=>{const{disabled:t=!1,onSelect:r,...i}=n,o=b.useRef(null),s=N0(hg,n.__scopeMenu),a=AM(hg,n.__scopeMenu),l=Ot(e,o),c=b.useRef(!1),f=()=>{const u=o.current;if(!t&&u){const d=new CustomEvent(F1,{bubbles:!0,cancelable:!0});u.addEventListener(F1,p=>r?.(p),{once:!0}),M0(u,d),d.defaultPrevented?c.current=!1:s.onClose()}};return b.createElement(Yk,Se({},i,{ref:l,disabled:t,onClick:Ve(n.onClick,f),onPointerDown:u=>{var d;(d=n.onPointerDown)===null||d===void 0||d.call(n,u),c.current=!0},onPointerUp:Ve(n.onPointerUp,u=>{var d;c.current||(d=u.currentTarget)===null||d===void 0||d.click()}),onKeyDown:Ve(n.onKeyDown,u=>{const d=a.searchRef.current!=="";t||d&&u.key===" "||Rk.includes(u.key)&&(u.currentTarget.click(),u.preventDefault())})}))}),Yk=b.forwardRef((n,e)=>{const{__scopeMenu:t,disabled:r=!1,textValue:i,...o}=n,s=AM(hg,t),a=CM(t),l=b.useRef(null),c=Ot(e,l),[f,u]=b.useState(!1),[d,p]=b.useState("");return b.useEffect(()=>{const v=l.current;if(v){var m;p(((m=v.textContent)!==null&&m!==void 0?m:"").trim())}},[o.children]),b.createElement(dg.ItemSlot,{scope:t,disabled:r,textValue:i??d},b.createElement(EM,Se({asChild:!0},a,{focusable:!r}),b.createElement(vt.div,Se({role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0},o,{ref:c,onPointerMove:Ve(n.onPointerMove,pg(v=>{r?s.onItemLeave(v):(s.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus())})),onPointerLeave:Ve(n.onPointerLeave,pg(v=>s.onItemLeave(v))),onFocus:Ve(n.onFocus,()=>u(!0)),onBlur:Ve(n.onBlur,()=>u(!1))}))))}),qk=b.forwardRef((n,e)=>{const{checked:t=!1,onCheckedChange:r,...i}=n;return b.createElement(DM,{scope:n.__scopeMenu,checked:t},b.createElement($0,Se({role:"menuitemcheckbox","aria-checked":xd(t)?"mixed":t},i,{ref:e,"data-state":U0(t),onSelect:Ve(i.onSelect,()=>r?.(xd(t)?!0:!t),{checkForDefaultPrevented:!1})})))}),Zk="MenuRadioGroup",[Qk,Jk]=Os(Zk,{value:void 0,onValueChange:()=>{}}),eO=b.forwardRef((n,e)=>{const{value:t,onValueChange:r,...i}=n,o=Hn(r);return b.createElement(Qk,{scope:n.__scopeMenu,value:t,onValueChange:o},b.createElement(Kk,Se({},i,{ref:e})))}),tO="MenuRadioItem",nO=b.forwardRef((n,e)=>{const{value:t,...r}=n,i=Jk(tO,n.__scopeMenu),o=t===i.value;return b.createElement(DM,{scope:n.__scopeMenu,checked:o},b.createElement($0,Se({role:"menuitemradio","aria-checked":o},r,{ref:e,"data-state":U0(o),onSelect:Ve(r.onSelect,()=>{var s;return(s=i.onValueChange)===null||s===void 0?void 0:s.call(i,t)},{checkForDefaultPrevented:!1})})))}),RM="MenuItemIndicator",[DM,rO]=Os(RM,{checked:!1}),iO=b.forwardRef((n,e)=>{const{__scopeMenu:t,forceMount:r,...i}=n,o=rO(RM,t);return b.createElement(yi,{present:r||xd(o.checked)||o.checked===!0},b.createElement(vt.span,Se({},i,{ref:e,"data-state":U0(o.checked)})))}),oO=b.forwardRef((n,e)=>{const{__scopeMenu:t,...r}=n;return b.createElement(vt.div,Se({role:"separator","aria-orientation":"horizontal"},r,{ref:e}))}),sO="MenuSub";Os(sO);function aO(n){return n?"open":"closed"}function xd(n){return n==="indeterminate"}function U0(n){return xd(n)?"indeterminate":n?"checked":"unchecked"}function lO(n){const e=document.activeElement;for(const t of n)if(t===e||(t.focus(),document.activeElement!==e))return}function cO(n,e){return n.map((t,r)=>n[(e+r)%n.length])}function uO(n,e,t){const i=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,o=t?n.indexOf(t):-1;let s=cO(n,Math.max(o,0));i.length===1&&(s=s.filter(c=>c!==t));const l=s.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return l!==t?l:void 0}function fO(n,e){const{x:t,y:r}=n;let i=!1;for(let o=0,s=e.length-1;or!=f>r&&t<(c-a)*(r-l)/(f-l)+a&&(i=!i)}return i}function dO(n,e){if(!e)return!1;const t={x:n.clientX,y:n.clientY};return fO(t,e)}function pg(n){return e=>e.pointerType==="mouse"?n(e):void 0}const hO=Uk,pO=zk,mO=Hk,gO=Wk,vO=$0,yO=qk,_O=eO,xO=nO,wO=iO,SO=oO,z0="Menubar",[mg,bO,MO]=tu(z0),[IM,B7]=vi(z0,[MO,rh]),wi=Fk(),kM=rh(),[EO,B0]=IM(z0),TO=b.forwardRef((n,e)=>{const{__scopeMenubar:t,value:r,onValueChange:i,defaultValue:o,loop:s=!0,dir:a,...l}=n,c=Jd(a),f=kM(t),[u="",d]=el({prop:r,onChange:i,defaultProp:o}),[p,v]=b.useState(null);return b.createElement(EO,{scope:t,value:u,onMenuOpen:b.useCallback(m=>{d(m),v(m)},[d]),onMenuClose:b.useCallback(()=>d(""),[d]),onMenuToggle:b.useCallback(m=>{d(g=>Boolean(g)?"":m),v(m)},[d]),dir:c,loop:s},b.createElement(mg.Provider,{scope:t},b.createElement(mg.Slot,{scope:t},b.createElement(MM,Se({asChild:!0},f,{orientation:"horizontal",loop:s,dir:c,currentTabStopId:p,onCurrentTabStopIdChange:v}),b.createElement(vt.div,Se({role:"menubar"},l,{ref:e}))))))}),OM="MenubarMenu",[CO,FM]=IM(OM),PO=n=>{const{__scopeMenubar:e,value:t,...r}=n,i=wo(),o=t||i||"LEGACY_REACT_AUTO_VALUE",s=B0(OM,e),a=wi(e),l=b.useRef(null),c=b.useRef(!1),f=s.value===o;return b.useEffect(()=>{f||(c.current=!1)},[f]),b.createElement(CO,{scope:e,value:o,triggerId:wo(),triggerRef:l,contentId:wo(),wasKeyboardTriggerOpenRef:c},b.createElement(hO,Se({},a,{open:f,onOpenChange:u=>{u||s.onMenuClose()},modal:!1,dir:s.dir},r)))},N1="MenubarTrigger",AO=b.forwardRef((n,e)=>{const{__scopeMenubar:t,disabled:r=!1,...i}=n,o=kM(t),s=wi(t),a=B0(N1,t),l=FM(N1,t),c=b.useRef(null),f=Ot(e,c,l.triggerRef),[u,d]=b.useState(!1),p=a.value===l.value;return b.createElement(mg.ItemSlot,{scope:t,value:l.value,disabled:r},b.createElement(EM,Se({asChild:!0},o,{focusable:!r,tabStopId:l.value}),b.createElement(pO,Se({asChild:!0},s),b.createElement(vt.button,Se({type:"button",role:"menuitem",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":p,"aria-controls":p?l.contentId:void 0,"data-highlighted":u?"":void 0,"data-state":p?"open":"closed","data-disabled":r?"":void 0,disabled:r},i,{ref:f,onPointerDown:Ve(n.onPointerDown,v=>{!r&&v.button===0&&v.ctrlKey===!1&&(a.onMenuOpen(l.value),p||v.preventDefault())}),onPointerEnter:Ve(n.onPointerEnter,()=>{if(Boolean(a.value)&&!p){var m;a.onMenuOpen(l.value),(m=c.current)===null||m===void 0||m.focus()}}),onKeyDown:Ve(n.onKeyDown,v=>{r||(["Enter"," "].includes(v.key)&&a.onMenuToggle(l.value),v.key==="ArrowDown"&&a.onMenuOpen(l.value),["Enter"," ","ArrowDown"].includes(v.key)&&(l.wasKeyboardTriggerOpenRef.current=!0,v.preventDefault()))}),onFocus:Ve(n.onFocus,()=>d(!0)),onBlur:Ve(n.onBlur,()=>d(!1))})))))}),LO=n=>{const{__scopeMenubar:e,...t}=n,r=wi(e);return b.createElement(mO,Se({},r,t))},$1="MenubarContent",RO=b.forwardRef((n,e)=>{const{__scopeMenubar:t,align:r="start",...i}=n,o=wi(t),s=B0($1,t),a=FM($1,t),l=bO(t),c=b.useRef(!1);return b.createElement(gO,Se({id:a.contentId,"aria-labelledby":a.triggerId,"data-radix-menubar-content":""},o,i,{ref:e,align:r,onCloseAutoFocus:Ve(n.onCloseAutoFocus,f=>{if(!Boolean(s.value)&&!c.current){var d;(d=a.triggerRef.current)===null||d===void 0||d.focus()}c.current=!1,f.preventDefault()}),onFocusOutside:Ve(n.onFocusOutside,f=>{const u=f.target;l().some(p=>{var v;return(v=p.ref.current)===null||v===void 0?void 0:v.contains(u)})&&f.preventDefault()}),onInteractOutside:Ve(n.onInteractOutside,()=>{c.current=!0}),onEntryFocus:f=>{a.wasKeyboardTriggerOpenRef.current||f.preventDefault()},onKeyDown:Ve(n.onKeyDown,f=>{if(["ArrowRight","ArrowLeft"].includes(f.key)){const u=f.target,d=u.hasAttribute("data-radix-menubar-subtrigger"),p=u.closest("[data-radix-menubar-content]")!==f.currentTarget,m=(s.dir==="rtl"?"ArrowRight":"ArrowLeft")===f.key;if(!m&&d||p&&m)return;let y=l().filter(T=>!T.disabled).map(T=>T.value);m&&y.reverse();const x=y.indexOf(a.value);y=s.loop?$O(y,x+1):y.slice(x+1);const[S]=y;S&&s.onMenuOpen(S)}},{checkForDefaultPrevented:!1}),style:{...n.style,"--radix-menubar-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-menubar-content-available-width":"var(--radix-popper-available-width)","--radix-menubar-content-available-height":"var(--radix-popper-available-height)","--radix-menubar-trigger-width":"var(--radix-popper-anchor-width)","--radix-menubar-trigger-height":"var(--radix-popper-anchor-height)"}}))}),DO=b.forwardRef((n,e)=>{const{__scopeMenubar:t,...r}=n,i=wi(t);return b.createElement(vO,Se({},i,r,{ref:e}))}),IO=b.forwardRef((n,e)=>{const{__scopeMenubar:t,...r}=n,i=wi(t);return b.createElement(yO,Se({},i,r,{ref:e}))}),kO=b.forwardRef((n,e)=>{const{__scopeMenubar:t,...r}=n,i=wi(t);return b.createElement(_O,Se({},i,r,{ref:e}))}),OO=b.forwardRef((n,e)=>{const{__scopeMenubar:t,...r}=n,i=wi(t);return b.createElement(xO,Se({},i,r,{ref:e}))}),FO=b.forwardRef((n,e)=>{const{__scopeMenubar:t,...r}=n,i=wi(t);return b.createElement(wO,Se({},i,r,{ref:e}))}),NO=b.forwardRef((n,e)=>{const{__scopeMenubar:t,...r}=n,i=wi(t);return b.createElement(SO,Se({},i,r,{ref:e}))});function $O(n,e){return n.map((t,r)=>n[(e+r)%n.length])}const UO=TO,Qo=PO,Jo=AO,Ws=LO,js=RO,Zt=DO,Dl=IO,zO=kO,BO=OO,Xs=FO,fp=NO,VO="_MenubarRoot_1qs9g_5",HO="_MenubarTrigger_1qs9g_14",GO="_Blue_1qs9g_35",WO="_MenubarContent_1qs9g_40",jO="_MenubarSubContent_1qs9g_41",XO="_MenubarItem_1qs9g_53",KO="_MenubarSubTrigger_1qs9g_54",YO="_MenubarCheckboxItem_1qs9g_55",qO="_MenubarRadioItem_1qs9g_56",ZO="_inset_1qs9g_71",QO="_MenubarItemIndicator_1qs9g_104",JO="_MenubarSeparator_1qs9g_113",e5="_RightSlot_1qs9g_119",t5={MenubarRoot:VO,MenubarTrigger:HO,Blue:GO,MenubarContent:WO,MenubarSubContent:jO,MenubarItem:XO,MenubarSubTrigger:KO,MenubarCheckboxItem:YO,MenubarRadioItem:qO,inset:ZO,MenubarItemIndicator:QO,MenubarSeparator:JO,RightSlot:e5};function n5(n){return new Promise((e,t)=>{const r=document.createElement("img");r.src=n,r.addEventListener("load",()=>{e(r)}),r.addEventListener("abort",()=>{t("onabort")}),r.addEventListener("error",()=>{t("onerror")})})}(function(){var n;function e(h){var w=0;return function(){return w>>0)+"_",O=0;return w}),o("Symbol.iterator",function(h){if(h)return h;h=Symbol("Symbol.iterator");for(var w="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),M=0;M"u"?!0:(typeof z=="function"?z=new z("unhandledrejection",{cancelable:!0}):typeof X=="function"?z=new X("unhandledrejection",{cancelable:!0}):(z=i.document.createEvent("CustomEvent"),z.initCustomEvent("unhandledrejection",!1,!0,z)),z.promise=this,z.reason=this.j,re(z))},w.prototype.H=function(){if(this.h!=null){for(var z=0;zM&&(M=Math.max(0,O+M)),(P==null||P>O)&&(P=O),P=Number(P),0>P&&(P=Math.max(0,O+P)),M=Number(M||0);MM&&(M=Math.max(M+O,0));M"u"||M.execScript("var "+h[0]);for(var P;h.length&&(P=h.shift());)h.length||w===void 0?M[P]&&M[P]!==Object.prototype[P]?M=M[P]:M=M[P]={}:M[P]=w}function Z(h){var w;e:{if((w=R.navigator)&&(w=w.userAgent))break e;w=""}return w.indexOf(h)!=-1}var K=Array.prototype.map?function(h,w){return Array.prototype.map.call(h,w,void 0)}:function(h,w){for(var M=h.length,P=Array(M),O=typeof h=="string"?h.split(""):h,V=0;V>4),z!=64&&(w(V<<4&240|z>>2),X!=64&&w(z<<6&192|X))}}function j(){if(!$){$={};for(var h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),w=["+/=","+/","-_=","-_.","-_"],M=0;5>M;M++){var P=h.concat(w[M].split(""));B[M]=P;for(var O=0;O>2];z=w[(z&3)<<4|X>>4],X=w[(X&15)<<2|re>>6],re=w[re&63],M[V++]=he+z+X+re}switch(he=0,re=P,h.length-O){case 2:he=h[O+1],re=w[(he&15)<<2]||P;case 1:h=h[O],M[V]=w[h>>2]+w[(h&3)<<4|he>>4]+re+P}return M.join("")}for(w="";10240h;h=Math.abs(h);var M=h>>>0;h=Math.floor((h-M)/4294967296),w&&(M=a(zt(M,h)),w=M.next().value,h=M.next().value,M=w),$e=M>>>0,et=h>>>0}var Wt=typeof BigInt=="function";function zt(h,w){return w=~w,h?h=~h+1:w+=1,[h,w]}function yt(h,w){this.i=h>>>0,this.h=w>>>0}function ft(h){if(!h)return jt||(jt=new yt(0,0));if(!/^-?\d+$/.test(h))return null;if(16>h.length)nn(Number(h));else if(Wt)h=BigInt(h),$e=Number(h&BigInt(4294967295))>>>0,et=Number(h>>BigInt(32)&BigInt(4294967295));else{var w=+(h[0]==="-");et=$e=0;for(var M=h.length,P=w,O=(M-w)%6+w;O<=M;P=O,O+=6)P=Number(h.slice(P,O)),et*=1e6,$e=1e6*$e+P,4294967296<=$e&&(et+=$e/4294967296|0,$e%=4294967296);w&&(w=a(zt($e,et)),h=w.next().value,w=w.next().value,$e=h,et=w)}return new yt($e,et)}var jt;function Kt(h,w){return Error("Invalid wire type: "+h+" (at position "+w+")")}function U(){return Error("Failed to read varint, encoding is invalid.")}function D(h,w){return Error("Tried to read past the end of the data "+w+" > "+h)}function ae(){throw Error("Invalid UTF8")}function xe(h,w){return w=String.fromCharCode.apply(null,w),h==null?w:h+w}var _e=void 0,Ce,Ue=typeof TextDecoder<"u",G,te=typeof TextEncoder<"u",Le;function Ee(h){if(h!==Ne)throw Error("illegal external caller")}function Ie(h,w){if(Ee(w),this.V=h,h!=null&&h.length===0)throw Error("ByteString should be constructed with non-empty values")}function Oe(){return Le||(Le=new Ie(null,Ne))}function Fe(h){Ee(Ne);var w=h.V;return w=w==null||se&&w!=null&&w instanceof Uint8Array?w:typeof w=="string"?we(w):null,w==null?w:h.V=w}function st(h){if(typeof h=="string")return{buffer:we(h),C:!1};if(Array.isArray(h))return{buffer:new Uint8Array(h),C:!1};if(h.constructor===Uint8Array)return{buffer:h,C:!1};if(h.constructor===ArrayBuffer)return{buffer:new Uint8Array(h),C:!1};if(h.constructor===Ie)return{buffer:Fe(h)||Pe(),C:!0};if(h instanceof Uint8Array)return{buffer:new Uint8Array(h.buffer,h.byteOffset,h.byteLength),C:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function ct(h,w){this.i=null,this.m=!1,this.h=this.j=this.l=0,pt(this,h,w)}function pt(h,w,M){M=M===void 0?{}:M,h.S=M.S===void 0?!1:M.S,w&&(w=st(w),h.i=w.buffer,h.m=w.C,h.l=0,h.j=h.i.length,h.h=h.l)}ct.prototype.reset=function(){this.h=this.l};function Y(h,w){if(h.h=w,w>h.j)throw D(h.j,w)}function le(h){var w=h.i,M=h.h,P=w[M++],O=P&127;if(P&128&&(P=w[M++],O|=(P&127)<<7,P&128&&(P=w[M++],O|=(P&127)<<14,P&128&&(P=w[M++],O|=(P&127)<<21,P&128&&(P=w[M++],O|=P<<28,P&128&&w[M++]&128&&w[M++]&128&&w[M++]&128&&w[M++]&128&&w[M++]&128)))))throw U();return Y(h,M),O}function ve(h,w){if(0>w)throw Error("Tried to read a negative byte length: "+w);var M=h.h,P=M+w;if(P>h.j)throw D(w,h.j-M);return h.h=P,M}var Re=[];function ke(){this.h=[]}ke.prototype.length=function(){return this.h.length},ke.prototype.end=function(){var h=this.h;return this.h=[],h};function wt(h,w,M){for(;0>>7|M<<25)>>>0,M>>>=7;h.h.push(w)}function Mt(h,w){for(;127>>=7;h.h.push(w)}function sn(h,w){if(Re.length){var M=Re.pop();pt(M,h,w),h=M}else h=new ct(h,w);this.h=h,this.j=this.h.h,this.i=this.l=-1,this.setOptions(w)}sn.prototype.setOptions=function(h){h=h===void 0?{}:h,this.ca=h.ca===void 0?!1:h.ca},sn.prototype.reset=function(){this.h.reset(),this.j=this.h.h,this.i=this.l=-1};function ir(h){var w=h.h;if(w.h==w.j)return!1;h.j=h.h.h;var M=le(h.h)>>>0;if(w=M>>>3,M&=7,!(0<=M&&5>=M))throw Kt(M,h.j);if(1>w)throw Error("Invalid field number: "+w+" (at position "+h.j+")");return h.l=w,h.i=M,!0}function Et(h){switch(h.i){case 0:if(h.i!=0)Et(h);else e:{h=h.h;for(var w=h.h,M=w+10,P=h.i;w>>0,h=h.h,Y(h,h.h+w));break;case 5:h=h.h,Y(h,h.h+4);break;case 3:w=h.l;do{if(!ir(h))throw Error("Unmatched start-group tag: stream EOF");if(h.i==4){if(h.l!=w)throw Error("Unmatched end-group tag");break}Et(h)}while(1);break;default:throw Kt(h.i,h.j)}}var yn=[];function gr(){this.j=[],this.i=0,this.h=new ke}function qi(h,w){w.length!==0&&(h.j.push(w),h.i+=w.length)}function yh(h,w){if(w=w.R){qi(h,h.h.end());for(var M=0;M=h.i?h.B?h.B[w]:void 0:h.o[w+h.G]}function fn(h,w,M,P){it(h),Tt(h,w,M,P)}function Tt(h,w,M,P){h.j&&(h.j=void 0),w>=h.i||P?Pn(h)[w]=M:(h.o[w+h.G]=M,(h=h.B)&&w in h&&delete h[w])}function ot(h,w,M,P){var O=Yt(h,w);Array.isArray(O)||(O=rt);var V=oe(O);if(V&1||ce(O),P)V&2||k(O,2),M&1||Object.freeze(O);else{P=!(M&2);var z=V&2;M&1||!z?P&&V&16&&!z&&ne(O,16):(O=ce(Array.prototype.slice.call(O)),Tt(h,w,O))}return O}function qo(h,w){var M=Yt(h,w),P=M==null?M:typeof M=="number"||M==="NaN"||M==="Infinity"||M==="-Infinity"?Number(M):void 0;return P!=null&&P!==M&&Tt(h,w,P),P}function qt(h,w,M,P,O){h.h||(h.h={});var V=h.h[M],z=ot(h,M,3,O);if(!V){var X=z;V=[];var re=!!(oe(h.o)&16);z=!!(oe(X)&2);var he=X;!O&&z&&(X=Array.prototype.slice.call(X));for(var be=z,Xe=0;Xez&&typeof h[z]!="number"){var X=h[z++];M(w,X)}for(;z>>0,h=2*(z>>31)+1,V=z>>>23&255,z&=8388607,fn(w,M,V==255?z?NaN:1/0*h:V==0?h*Math.pow(2,-149)*z:h*Math.pow(2,V-150)*(z+Math.pow(2,23))),!0},function(h,w,M){if(w=qo(w,M),w!=null){Mt(h.h,8*M+5),h=h.h;var P=+w;P===0?0<1/P?$e=et=0:(et=0,$e=2147483648):isNaN(P)?(et=0,$e=2147483647):(P=(M=0>P?-2147483648:0)?-P:P,34028234663852886e22>>0):11754943508222875e-54>P?(P=Math.round(P/Math.pow(2,-149)),et=0,$e=(M|P)>>>0):(w=Math.floor(Math.log(P)/Math.LN2),P*=Math.pow(2,-w),P=Math.round(8388608*P),16777216<=P&&++w,et=0,$e=(M|w+127<<23|P&8388607)>>>0)),M=$e,h.h.push(M>>>0&255),h.h.push(M>>>8&255),h.h.push(M>>>16&255),h.h.push(M>>>24&255)}}),gE=vl(function(h,w,M){if(h.i!==0)return!1;var P=h.h,O=0,V=h=0,z=P.i,X=P.h;do{var re=z[X++];O|=(re&127)<V&&re&128);for(32>4),V=3;32>V&&re&128;V+=7)re=z[X++],h|=(re&127)<re)P=O>>>0,re=h>>>0,(h=re&2147483648)&&(P=~P+1>>>0,re=~re>>>0,P==0&&(re=re+1>>>0)),P=4294967296*re+(P>>>0);else throw U();return fn(w,M,h?-P:P),!0},function(h,w,M){w=Yt(w,M),w!=null&&(typeof w=="string"&&ft(w),w!=null&&(Mt(h.h,8*M),typeof w=="number"?(h=h.h,nn(w),wt(h,$e,et)):(M=ft(w),wt(h.h,M.i,M.h))))}),vE=vl(function(h,w,M){return h.i!==0?!1:(fn(w,M,le(h.h)),!0)},function(h,w,M){if(w=Yt(w,M),w!=null&&w!=null)if(Mt(h.h,8*M),h=h.h,M=w,0<=M)Mt(h,M);else{for(w=0;9>w;w++)h.h.push(M&127|128),M>>=7;h.h.push(1)}}),yv=vl(function(h,w,M){if(h.i!==2)return!1;var P=le(h.h)>>>0;h=h.h;var O=ve(h,P);if(h=h.i,Ue){var V=h,z;(z=Ce)||(z=Ce=new TextDecoder("utf-8",{fatal:!0})),h=O+P,V=O===0&&h===V.length?V:V.subarray(O,h);try{var X=z.decode(V)}catch(Xe){if(_e===void 0){try{z.decode(new Uint8Array([128]))}catch{}try{z.decode(new Uint8Array([97])),_e=!0}catch{_e=!1}}throw!_e&&(Ce=void 0),Xe}}else{X=O,P=X+P,O=[];for(var re=null,he,be;Xhe?O.push(he):224>he?X>=P?ae():(be=h[X++],194>he||(be&192)!==128?(X--,ae()):O.push((he&31)<<6|be&63)):240>he?X>=P-1?ae():(be=h[X++],(be&192)!==128||he===224&&160>be||he===237&&160<=be||((V=h[X++])&192)!==128?(X--,ae()):O.push((he&15)<<12|(be&63)<<6|V&63)):244>=he?X>=P-2?ae():(be=h[X++],(be&192)!==128||(he<<28)+(be-144)>>30||((V=h[X++])&192)!==128||((z=h[X++])&192)!==128?(X--,ae()):(he=(he&7)<<18|(be&63)<<12|(V&63)<<6|z&63,he-=65536,O.push((he>>10&1023)+55296,(he&1023)+56320))):ae(),8192<=O.length&&(re=xe(re,O),O.length=0);X=xe(re,O)}return fn(w,M,X),!0},function(h,w,M){if(w=Yt(w,M),w!=null){var P=!1;if(P=P===void 0?!1:P,te){if(P&&/(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])/.test(w))throw Error("Found an unpaired surrogate");w=(G||(G=new TextEncoder)).encode(w)}else{for(var O=0,V=new Uint8Array(3*w.length),z=0;zX)V[O++]=X;else{if(2048>X)V[O++]=X>>6|192;else{if(55296<=X&&57343>=X){if(56319>=X&&z=re){X=1024*(X-55296)+re-56320+65536,V[O++]=X>>18|240,V[O++]=X>>12&63|128,V[O++]=X>>6&63|128,V[O++]=X&63|128;continue}else z--}if(P)throw Error("Found an unpaired surrogate");X=65533}V[O++]=X>>12|224,V[O++]=X>>6&63|128}V[O++]=X&63|128}}w=O===V.length?V:V.subarray(0,O)}Mt(h.h,8*M+2),Mt(h.h,w.length),qi(h,h.h.end()),qi(h,w)}}),_v=vl(function(h,w,M,P,O){if(h.i!==2)return!1;w=Zi(w,M,P),M=h.h.j,P=le(h.h)>>>0;var V=h.h.h+P,z=V-M;if(0>=z&&(h.h.j=V,O(w,h,void 0,void 0,void 0),z=V-h.h.h),z)throw Error("Message parsing ended unexpectedly. Expected to read "+(P+" bytes, instead read "+(P-z)+" bytes, either the data ended unexpectedly or the message misreported its own length"));return h.h.h=V,h.h.j=M,!0},function(h,w,M,P,O){if(w=Dr(w,P,M),w!=null)for(P=0;P>>=7,z.i++;V.push(X),z.i++}});function Sh(h){return function(w,M){e:{if(yn.length){var P=yn.pop();P.setOptions(M),pt(P.h,w,M),w=P}else w=new sn(w,M);try{var O=wh(h),V=gv(new O.P,w,O);break e}finally{O=w.h,O.i=null,O.m=!1,O.l=0,O.j=0,O.h=0,O.S=!1,w.l=-1,w.i=-1,100>yn.length&&yn.push(w)}V=void 0}return V}}function bh(h){return function(){var w=new gr;vv(this,w,xh(h)),qi(w,w.h.end());for(var M=new Uint8Array(w.i),P=w.j,O=P.length,V=0,z=0;z{if(n in Xa)return console.log("local",n),Xa[n];const e=`${s5()}/${n}`;return console.log("load pose model",e),e}});Nf.setOptions({modelComplexity:1,smoothLandmarks:!0,enableSegmentation:!0,smoothSegmentation:!0,minDetectionConfidence:.5,minTrackingConfidence:.5});function a5(n){return new Promise(e=>{Nf.reset(),Nf.send({image:n}),Nf.onResults(t=>{console.log(t),e(t)})})}/** * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT */const V0="150",Ks={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Ys={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},l5=0,U1=1,c5=2,zM=1,u5=2,Zl=3,Bo=0,dr=1,$i=2,Io=0,ka=1,z1=2,B1=3,V1=4,f5=5,da=100,d5=101,h5=102,H1=103,G1=104,p5=200,m5=201,g5=202,v5=203,BM=204,VM=205,y5=206,_5=207,x5=208,w5=209,S5=210,b5=0,M5=1,E5=2,gg=3,T5=4,C5=5,P5=6,A5=7,oh=0,L5=1,R5=2,Hi=0,D5=1,I5=2,k5=3,O5=4,F5=5,HM=300,Ka=301,Ya=302,wd=303,vg=304,sh=306,Nc=1e3,cr=1001,yg=1002,bn=1003,W1=1004,dp=1005,br=1006,N5=1007,$c=1008,Ls=1009,$5=1010,U5=1011,GM=1012,z5=1013,xs=1014,vo=1015,Uc=1016,B5=1017,V5=1018,Oa=1020,H5=1021,Mr=1023,G5=1024,W5=1025,bs=1026,qa=1027,j5=1028,X5=1029,K5=1030,Y5=1031,q5=1033,hp=33776,pp=33777,mp=33778,gp=33779,j1=35840,X1=35841,K1=35842,Y1=35843,Z5=36196,q1=37492,Z1=37496,Q1=37808,J1=37809,e_=37810,t_=37811,n_=37812,r_=37813,i_=37814,o_=37815,s_=37816,a_=37817,l_=37818,c_=37819,u_=37820,f_=37821,vp=36492,Q5=36283,d_=36284,h_=36285,p_=36286,Sd=2300,bd=2301,yp=2302,m_=2400,g_=2401,v_=2402,J5=2500,Rs=3e3,_t=3001,e4=3200,t4=3201,ah=0,n4=1,ii="srgb",zc="srgb-linear",WM="display-p3",_p=7680,r4=519,y_=35044,__="300 es",_g=1035;class Fs{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const o=i.indexOf(t);o!==-1&&i.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let o=0,s=i.length;o>8&255]+Dn[n>>16&255]+Dn[n>>24&255]+"-"+Dn[e&255]+Dn[e>>8&255]+"-"+Dn[e>>16&15|64]+Dn[e>>24&255]+"-"+Dn[t&63|128]+Dn[t>>8&255]+"-"+Dn[t>>16&255]+Dn[t>>24&255]+Dn[r&255]+Dn[r>>8&255]+Dn[r>>16&255]+Dn[r>>24&255]).toLowerCase()}function Mn(n,e,t){return Math.max(e,Math.min(t,n))}function H0(n,e){return(n%e+e)%e}function i4(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function o4(n,e,t){return n!==e?(t-n)/(e-n):0}function pc(n,e,t){return(1-t)*n+t*e}function s4(n,e,t,r){return pc(n,e,1-Math.exp(-t*r))}function a4(n,e=1){return e-Math.abs(H0(n,e*2)-e)}function l4(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function c4(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function u4(n,e){return n+Math.floor(Math.random()*(e-n+1))}function f4(n,e){return n+Math.random()*(e-n)}function d4(n){return n*(.5-Math.random())}function h4(n){n!==void 0&&(x_=n);let e=x_+=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 p4(n){return n*hc}function m4(n){return n*Bc}function xg(n){return(n&n-1)===0&&n!==0}function jM(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function XM(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function g4(n,e,t,r,i){const o=Math.cos,s=Math.sin,a=o(t/2),l=s(t/2),c=o((e+r)/2),f=s((e+r)/2),u=o((e-r)/2),d=s((e-r)/2),p=o((r-e)/2),v=s((r-e)/2);switch(i){case"XYX":n.set(a*f,l*u,l*d,a*c);break;case"YZY":n.set(l*d,a*f,l*u,a*c);break;case"ZXZ":n.set(l*u,l*d,a*f,a*c);break;case"XZX":n.set(a*f,l*v,l*p,a*c);break;case"YXY":n.set(l*p,a*f,l*v,a*c);break;case"ZYZ":n.set(l*v,l*p,a*f,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Ql(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Kn(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const li={DEG2RAD:hc,RAD2DEG:Bc,generateUUID:Yo,clamp:Mn,euclideanModulo:H0,mapLinear:i4,inverseLerp:o4,lerp:pc,damp:s4,pingpong:a4,smoothstep:l4,smootherstep:c4,randInt:u4,randFloat:f4,randFloatSpread:d4,seededRandom:h4,degToRad:p4,radToDeg:m4,isPowerOfTwo:xg,ceilPowerOfTwo:jM,floorPowerOfTwo:XM,setQuaternionFromProperEuler:g4,normalize:Kn,denormalize:Ql};class We{constructor(e=0,t=0){We.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,r=this.y,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6],this.y=i[1]*t+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,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 r=Math.cos(t),i=Math.sin(t),o=this.x-e.x,s=this.y-e.y;return this.x=o*r-s*i+e.x,this.y=o*i+s*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class On{constructor(){On.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,r,i,o,s,a,l,c){const f=this.elements;return f[0]=e,f[1]=i,f[2]=a,f[3]=t,f[4]=o,f[5]=l,f[6]=r,f[7]=s,f[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.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 r=e.elements,i=t.elements,o=this.elements,s=r[0],a=r[3],l=r[6],c=r[1],f=r[4],u=r[7],d=r[2],p=r[5],v=r[8],m=i[0],g=i[3],_=i[6],y=i[1],x=i[4],S=i[7],T=i[2],C=i[5],L=i[8];return o[0]=s*m+a*y+l*T,o[3]=s*g+a*x+l*C,o[6]=s*_+a*S+l*L,o[1]=c*m+f*y+u*T,o[4]=c*g+f*x+u*C,o[7]=c*_+f*S+u*L,o[2]=d*m+p*y+v*T,o[5]=d*g+p*x+v*C,o[8]=d*_+p*S+v*L,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],r=e[1],i=e[2],o=e[3],s=e[4],a=e[5],l=e[6],c=e[7],f=e[8];return t*s*f-t*a*c-r*o*f+r*a*l+i*o*c-i*s*l}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],o=e[3],s=e[4],a=e[5],l=e[6],c=e[7],f=e[8],u=f*s-a*c,d=a*l-f*o,p=c*o-s*l,v=t*u+r*d+i*p;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/v;return e[0]=u*m,e[1]=(i*c-f*r)*m,e[2]=(a*r-i*s)*m,e[3]=d*m,e[4]=(f*t-i*l)*m,e[5]=(i*o-a*t)*m,e[6]=p*m,e[7]=(r*l-c*t)*m,e[8]=(s*t-r*o)*m,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,r,i,o,s,a){const l=Math.cos(o),c=Math.sin(o);return this.set(r*l,r*c,-r*(l*s+c*a)+s+e,-i*c,i*l,-i*(-c*s+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(xp.makeScale(e,t)),this}rotate(e){return this.premultiply(xp.makeRotation(-e)),this}translate(e,t){return this.premultiply(xp.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,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,r=e.elements;for(let i=0;i<9;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const xp=new On;function KM(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Vc(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}class $t{constructor(e=0,t=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=i}static slerpFlat(e,t,r,i,o,s,a){let l=r[i+0],c=r[i+1],f=r[i+2],u=r[i+3];const d=o[s+0],p=o[s+1],v=o[s+2],m=o[s+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=f,e[t+3]=u;return}if(a===1){e[t+0]=d,e[t+1]=p,e[t+2]=v,e[t+3]=m;return}if(u!==m||l!==d||c!==p||f!==v){let g=1-a;const _=l*d+c*p+f*v+u*m,y=_>=0?1:-1,x=1-_*_;if(x>Number.EPSILON){const T=Math.sqrt(x),C=Math.atan2(T,_*y);g=Math.sin(g*C)/T,a=Math.sin(a*C)/T}const S=a*y;if(l=l*g+d*S,c=c*g+p*S,f=f*g+v*S,u=u*g+m*S,g===1-a){const T=1/Math.sqrt(l*l+c*c+f*f+u*u);l*=T,c*=T,f*=T,u*=T}}e[t]=l,e[t+1]=c,e[t+2]=f,e[t+3]=u}static multiplyQuaternionsFlat(e,t,r,i,o,s){const a=r[i],l=r[i+1],c=r[i+2],f=r[i+3],u=o[s],d=o[s+1],p=o[s+2],v=o[s+3];return e[t]=a*v+f*u+l*p-c*d,e[t+1]=l*v+f*d+c*u-a*p,e[t+2]=c*v+f*p+a*d-l*u,e[t+3]=f*v-a*u-l*d-c*p,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,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const r=e._x,i=e._y,o=e._z,s=e._order,a=Math.cos,l=Math.sin,c=a(r/2),f=a(i/2),u=a(o/2),d=l(r/2),p=l(i/2),v=l(o/2);switch(s){case"XYZ":this._x=d*f*u+c*p*v,this._y=c*p*u-d*f*v,this._z=c*f*v+d*p*u,this._w=c*f*u-d*p*v;break;case"YXZ":this._x=d*f*u+c*p*v,this._y=c*p*u-d*f*v,this._z=c*f*v-d*p*u,this._w=c*f*u+d*p*v;break;case"ZXY":this._x=d*f*u-c*p*v,this._y=c*p*u+d*f*v,this._z=c*f*v+d*p*u,this._w=c*f*u-d*p*v;break;case"ZYX":this._x=d*f*u-c*p*v,this._y=c*p*u+d*f*v,this._z=c*f*v-d*p*u,this._w=c*f*u+d*p*v;break;case"YZX":this._x=d*f*u+c*p*v,this._y=c*p*u+d*f*v,this._z=c*f*v-d*p*u,this._w=c*f*u-d*p*v;break;case"XZY":this._x=d*f*u-c*p*v,this._y=c*p*u-d*f*v,this._z=c*f*v+d*p*u,this._w=c*f*u+d*p*v;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,r=t[0],i=t[4],o=t[8],s=t[1],a=t[5],l=t[9],c=t[2],f=t[6],u=t[10],d=r+a+u;if(d>0){const p=.5/Math.sqrt(d+1);this._w=.25/p,this._x=(f-l)*p,this._y=(o-c)*p,this._z=(s-i)*p}else if(r>a&&r>u){const p=2*Math.sqrt(1+r-a-u);this._w=(f-l)/p,this._x=.25*p,this._y=(i+s)/p,this._z=(o+c)/p}else if(a>u){const p=2*Math.sqrt(1+a-r-u);this._w=(o-c)/p,this._x=(i+s)/p,this._y=.25*p,this._z=(l+f)/p}else{const p=2*Math.sqrt(1+u-r-a);this._w=(s-i)/p,this._x=(o+c)/p,this._y=(l+f)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return rMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(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=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Mn(this.dot(e),-1,1)))}rotateTowards(e,t){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 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 r=e._x,i=e._y,o=e._z,s=e._w,a=t._x,l=t._y,c=t._z,f=t._w;return this._x=r*f+s*a+i*c-o*l,this._y=i*f+s*l+o*a-r*c,this._z=o*f+s*c+r*l-i*a,this._w=s*f-r*a-i*l-o*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const r=this._x,i=this._y,o=this._z,s=this._w;let a=s*e._w+r*e._x+i*e._y+o*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=s,this._x=r,this._y=i,this._z=o,this;const l=1-a*a;if(l<=Number.EPSILON){const p=1-t;return this._w=p*s+t*this._w,this._x=p*r+t*this._x,this._y=p*i+t*this._y,this._z=p*o+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),f=Math.atan2(c,a),u=Math.sin((1-t)*f)/c,d=Math.sin(t*f)/c;return this._w=s*u+this._w*d,this._x=r*u+this._x*d,this._y=i*u+this._y*d,this._z=o*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){const e=Math.random(),t=Math.sqrt(1-e),r=Math.sqrt(e),i=2*Math.PI*Math.random(),o=2*Math.PI*Math.random();return this.set(t*Math.cos(i),r*Math.sin(o),r*Math.cos(o),t*Math.sin(i))}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}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class F{constructor(e=0,t=0,r=0){F.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}set(e,t,r){return r===void 0&&(r=this.z),this.x=e,this.y=t,this.z=r,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(w_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(w_.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,r=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[3]*r+o[6]*i,this.y=o[1]*t+o[4]*r+o[7]*i,this.z=o[2]*t+o[5]*r+o[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,o=e.elements,s=1/(o[3]*t+o[7]*r+o[11]*i+o[15]);return this.x=(o[0]*t+o[4]*r+o[8]*i+o[12])*s,this.y=(o[1]*t+o[5]*r+o[9]*i+o[13])*s,this.z=(o[2]*t+o[6]*r+o[10]*i+o[14])*s,this}applyQuaternion(e){const t=this.x,r=this.y,i=this.z,o=e.x,s=e.y,a=e.z,l=e.w,c=l*t+s*i-a*r,f=l*r+a*t-o*i,u=l*i+o*r-s*t,d=-o*t-s*r-a*i;return this.x=c*l+d*-o+f*-a-u*-s,this.y=f*l+d*-s+u*-o-c*-a,this.z=u*l+d*-a+c*-s-f*-o,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,r=this.y,i=this.z,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*i,this.y=o[1]*t+o[5]*r+o[9]*i,this.z=o[2]*t+o[6]*r+o[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const r=e.x,i=e.y,o=e.z,s=t.x,a=t.y,l=t.z;return this.x=i*l-o*a,this.y=o*s-r*l,this.z=r*a-i*s,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return wp.copy(this).projectOnVector(e),this.sub(wp)}reflect(e){return this.sub(wp.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 r=this.dot(e)/t;return Math.acos(Mn(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){const i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,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(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,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}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,r=Math.sqrt(1-e**2);return this.x=r*Math.cos(t),this.y=r*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const wp=new F,w_=new $t;function Fa(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Sp(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const v4=new On().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),y4=new On().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]),yo=new F;function _4(n){return n.convertSRGBToLinear(),yo.set(n.r,n.g,n.b).applyMatrix3(y4),n.setRGB(yo.x,yo.y,yo.z)}function x4(n){return yo.set(n.r,n.g,n.b).applyMatrix3(v4),n.setRGB(yo.x,yo.y,yo.z).convertLinearToSRGB()}const w4={[zc]:n=>n,[ii]:n=>n.convertSRGBToLinear(),[WM]:_4},S4={[zc]:n=>n,[ii]:n=>n.convertLinearToSRGB(),[WM]:x4},$n={enabled:!1,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 zc},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 r=w4[e],i=S4[t];if(r===void 0||i===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return i(r(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}};let qs;class YM{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{qs===void 0&&(qs=Vc("canvas")),qs.width=e.width,qs.height=e.height;const r=qs.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=qs}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=Vc("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),o=i.data;for(let s=0;s0&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==HM)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Nc:e.x=e.x-Math.floor(e.x);break;case cr:e.x=e.x<0?0:1;break;case yg: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 Nc:e.y=e.y-Math.floor(e.y);break;case cr:e.y=e.y<0?0:1;break;case yg: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)}}Tn.DEFAULT_IMAGE=null;Tn.DEFAULT_MAPPING=HM;Tn.DEFAULT_ANISOTROPY=1;class dt{constructor(e=0,t=0,r=0,i=1){dt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=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,r=this.y,i=this.z,o=this.w,s=e.elements;return this.x=s[0]*t+s[4]*r+s[8]*i+s[12]*o,this.y=s[1]*t+s[5]*r+s[9]*i+s[13]*o,this.z=s[2]*t+s[6]*r+s[10]*i+s[14]*o,this.w=s[3]*t+s[7]*r+s[11]*i+s[15]*o,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,r,i,o;const l=e.elements,c=l[0],f=l[4],u=l[8],d=l[1],p=l[5],v=l[9],m=l[2],g=l[6],_=l[10];if(Math.abs(f-d)<.01&&Math.abs(u-m)<.01&&Math.abs(v-g)<.01){if(Math.abs(f+d)<.1&&Math.abs(u+m)<.1&&Math.abs(v+g)<.1&&Math.abs(c+p+_-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(c+1)/2,S=(p+1)/2,T=(_+1)/2,C=(f+d)/4,L=(u+m)/4,E=(v+g)/4;return x>S&&x>T?x<.01?(r=0,i=.707106781,o=.707106781):(r=Math.sqrt(x),i=C/r,o=L/r):S>T?S<.01?(r=.707106781,i=0,o=.707106781):(i=Math.sqrt(S),r=C/i,o=E/i):T<.01?(r=.707106781,i=.707106781,o=0):(o=Math.sqrt(T),r=L/o,i=E/o),this.set(r,i,o,t),this}let y=Math.sqrt((g-v)*(g-v)+(u-m)*(u-m)+(d-f)*(d-f));return Math.abs(y)<.001&&(y=1),this.x=(g-v)/y,this.y=(u-m)/y,this.z=(d-f)/y,this.w=Math.acos((c+p+_-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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,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 Vo extends Fs{constructor(e=1,t=1,r={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new dt(0,0,e,t),this.scissorTest=!1,this.viewport=new dt(0,0,e,t);const i={width:e,height:t,depth:1};this.texture=new Tn(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=r.generateMipmaps!==void 0?r.generateMipmaps:!1,this.texture.internalFormat=r.internalFormat!==void 0?r.internalFormat:null,this.texture.minFilter=r.minFilter!==void 0?r.minFilter:br,this.depthBuffer=r.depthBuffer!==void 0?r.depthBuffer:!0,this.stencilBuffer=r.stencilBuffer!==void 0?r.stencilBuffer:!1,this.depthTexture=r.depthTexture!==void 0?r.depthTexture:null,this.samples=r.samples!==void 0?r.samples:0}setSize(e,t,r=1){(this.width!==e||this.height!==t||this.depth!==r)&&(this.width=e,this.height=t,this.depth=r,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=r,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.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 qM(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 ZM extends Tn{constructor(e=null,t=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=bn,this.minFilter=bn,this.wrapR=cr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class M4 extends Tn{constructor(e=null,t=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=bn,this.minFilter=bn,this.wrapR=cr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class al{constructor(e=new F(1/0,1/0,1/0),t=new F(-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){let t=1/0,r=1/0,i=1/0,o=-1/0,s=-1/0,a=-1/0;for(let l=0,c=e.length;lo&&(o=f),u>s&&(s=u),d>a&&(a=d)}return this.min.set(t,r,i),this.max.set(o,s,a),this}setFromBufferAttribute(e){let t=1/0,r=1/0,i=1/0,o=-1/0,s=-1/0,a=-1/0;for(let l=0,c=e.count;lo&&(o=f),u>s&&(s=u),d>a&&(a=d)}return this.min.set(t,r,i),this.max.set(o,s,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,r=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,es),es.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Il),Uu.subVectors(this.max,Il),Zs.subVectors(e.a,Il),Qs.subVectors(e.b,Il),Js.subVectors(e.c,Il),to.subVectors(Qs,Zs),no.subVectors(Js,Qs),ts.subVectors(Zs,Js);let t=[0,-to.z,to.y,0,-no.z,no.y,0,-ts.z,ts.y,to.z,0,-to.x,no.z,0,-no.x,ts.z,0,-ts.x,-to.y,to.x,0,-no.y,no.x,0,-ts.y,ts.x,0];return!Ep(t,Zs,Qs,Js,Uu)||(t=[1,0,0,0,1,0,0,0,1],!Ep(t,Zs,Qs,Js,Uu))?!1:(zu.crossVectors(to,no),t=[zu.x,zu.y,zu.z],Ep(t,Zs,Qs,Js,Uu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,es).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(es).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:(Mi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Mi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Mi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Mi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Mi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Mi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Mi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Mi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Mi),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 Mi=[new F,new F,new F,new F,new F,new F,new F,new F],es=new F,Mp=new al,Zs=new F,Qs=new F,Js=new F,to=new F,no=new F,ts=new F,Il=new F,Uu=new F,zu=new F,ns=new F;function Ep(n,e,t,r,i){for(let o=0,s=n.length-3;o<=s;o+=3){ns.fromArray(n,o);const a=i.x*Math.abs(ns.x)+i.y*Math.abs(ns.y)+i.z*Math.abs(ns.z),l=e.dot(ns),c=t.dot(ns),f=r.dot(ns);if(Math.max(-Math.max(l,c,f),Math.min(l,c,f))>a)return!1}return!0}const E4=new al,kl=new F,Tp=new F;class ll{constructor(e=new F,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const r=this.center;t!==void 0?r.copy(t):E4.setFromPoints(e).getCenter(r);let i=0;for(let o=0,s=e.length;othis.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;kl.subVectors(e,this.center);const t=kl.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(kl,i/r),this.radius+=i}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):(Tp.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(kl.copy(e.center).add(Tp)),this.expandByPoint(kl.copy(e.center).sub(Tp))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ei=new F,Cp=new F,Bu=new F,ro=new F,Pp=new F,Vu=new F,Ap=new F;class lh{constructor(e=new F,t=new F(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,Ei)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ei.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ei.copy(this.origin).addScaledVector(this.direction,t),Ei.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){Cp.copy(e).add(t).multiplyScalar(.5),Bu.copy(t).sub(e).normalize(),ro.copy(this.origin).sub(Cp);const o=e.distanceTo(t)*.5,s=-this.direction.dot(Bu),a=ro.dot(this.direction),l=-ro.dot(Bu),c=ro.lengthSq(),f=Math.abs(1-s*s);let u,d,p,v;if(f>0)if(u=s*l-a,d=s*a-l,v=o*f,u>=0)if(d>=-v)if(d<=v){const m=1/f;u*=m,d*=m,p=u*(u+s*d+2*a)+d*(s*u+d+2*l)+c}else d=o,u=Math.max(0,-(s*d+a)),p=-u*u+d*(d+2*l)+c;else d=-o,u=Math.max(0,-(s*d+a)),p=-u*u+d*(d+2*l)+c;else d<=-v?(u=Math.max(0,-(-s*o+a)),d=u>0?-o:Math.min(Math.max(-o,-l),o),p=-u*u+d*(d+2*l)+c):d<=v?(u=0,d=Math.min(Math.max(-o,-l),o),p=d*(d+2*l)+c):(u=Math.max(0,-(s*o+a)),d=u>0?o:Math.min(Math.max(-o,-l),o),p=-u*u+d*(d+2*l)+c);else d=s>0?-o:o,u=Math.max(0,-(s*d+a)),p=-u*u+d*(d+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(Cp).addScaledVector(Bu,d),p}intersectSphere(e,t){Ei.subVectors(e.center,this.origin);const r=Ei.dot(this.direction),i=Ei.dot(Ei)-r*r,o=e.radius*e.radius;if(i>o)return null;const s=Math.sqrt(o-i),a=r-s,l=r+s;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 r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){const r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,i,o,s,a,l;const c=1/this.direction.x,f=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(r=(e.min.x-d.x)*c,i=(e.max.x-d.x)*c):(r=(e.max.x-d.x)*c,i=(e.min.x-d.x)*c),f>=0?(o=(e.min.y-d.y)*f,s=(e.max.y-d.y)*f):(o=(e.max.y-d.y)*f,s=(e.min.y-d.y)*f),r>s||o>i||((o>r||isNaN(r))&&(r=o),(s=0?(a=(e.min.z-d.z)*u,l=(e.max.z-d.z)*u):(a=(e.max.z-d.z)*u,l=(e.min.z-d.z)*u),r>l||a>i)||((a>r||r!==r)&&(r=a),(l=0?r:i,t)}intersectsBox(e){return this.intersectBox(e,Ei)!==null}intersectTriangle(e,t,r,i,o){Pp.subVectors(t,e),Vu.subVectors(r,e),Ap.crossVectors(Pp,Vu);let s=this.direction.dot(Ap),a;if(s>0){if(i)return null;a=1}else if(s<0)a=-1,s=-s;else return null;ro.subVectors(this.origin,e);const l=a*this.direction.dot(Vu.crossVectors(ro,Vu));if(l<0)return null;const c=a*this.direction.dot(Pp.cross(ro));if(c<0||l+c>s)return null;const f=-a*ro.dot(Ap);return f<0?null:this.at(f/s,o)}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 Be{constructor(){Be.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,r,i,o,s,a,l,c,f,u,d,p,v,m,g){const _=this.elements;return _[0]=e,_[4]=t,_[8]=r,_[12]=i,_[1]=o,_[5]=s,_[9]=a,_[13]=l,_[2]=c,_[6]=f,_[10]=u,_[14]=d,_[3]=p,_[7]=v,_[11]=m,_[15]=g,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 Be().fromArray(this.elements)}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){const t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[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,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,r=e.elements,i=1/ea.setFromMatrixColumn(e,0).length(),o=1/ea.setFromMatrixColumn(e,1).length(),s=1/ea.setFromMatrixColumn(e,2).length();return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=0,t[4]=r[4]*o,t[5]=r[5]*o,t[6]=r[6]*o,t[7]=0,t[8]=r[8]*s,t[9]=r[9]*s,t[10]=r[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,r=e.x,i=e.y,o=e.z,s=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),f=Math.cos(o),u=Math.sin(o);if(e.order==="XYZ"){const d=s*f,p=s*u,v=a*f,m=a*u;t[0]=l*f,t[4]=-l*u,t[8]=c,t[1]=p+v*c,t[5]=d-m*c,t[9]=-a*l,t[2]=m-d*c,t[6]=v+p*c,t[10]=s*l}else if(e.order==="YXZ"){const d=l*f,p=l*u,v=c*f,m=c*u;t[0]=d+m*a,t[4]=v*a-p,t[8]=s*c,t[1]=s*u,t[5]=s*f,t[9]=-a,t[2]=p*a-v,t[6]=m+d*a,t[10]=s*l}else if(e.order==="ZXY"){const d=l*f,p=l*u,v=c*f,m=c*u;t[0]=d-m*a,t[4]=-s*u,t[8]=v+p*a,t[1]=p+v*a,t[5]=s*f,t[9]=m-d*a,t[2]=-s*c,t[6]=a,t[10]=s*l}else if(e.order==="ZYX"){const d=s*f,p=s*u,v=a*f,m=a*u;t[0]=l*f,t[4]=v*c-p,t[8]=d*c+m,t[1]=l*u,t[5]=m*c+d,t[9]=p*c-v,t[2]=-c,t[6]=a*l,t[10]=s*l}else if(e.order==="YZX"){const d=s*l,p=s*c,v=a*l,m=a*c;t[0]=l*f,t[4]=m-d*u,t[8]=v*u+p,t[1]=u,t[5]=s*f,t[9]=-a*f,t[2]=-c*f,t[6]=p*u+v,t[10]=d-m*u}else if(e.order==="XZY"){const d=s*l,p=s*c,v=a*l,m=a*c;t[0]=l*f,t[4]=-u,t[8]=c*f,t[1]=d*u+m,t[5]=s*f,t[9]=p*u-v,t[2]=v*u-p,t[6]=a*f,t[10]=m*u+d}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(T4,e,C4)}lookAt(e,t,r){const i=this.elements;return sr.subVectors(e,t),sr.lengthSq()===0&&(sr.z=1),sr.normalize(),io.crossVectors(r,sr),io.lengthSq()===0&&(Math.abs(r.z)===1?sr.x+=1e-4:sr.z+=1e-4,sr.normalize(),io.crossVectors(r,sr)),io.normalize(),Hu.crossVectors(sr,io),i[0]=io.x,i[4]=Hu.x,i[8]=sr.x,i[1]=io.y,i[5]=Hu.y,i[9]=sr.y,i[2]=io.z,i[6]=Hu.z,i[10]=sr.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,o=this.elements,s=r[0],a=r[4],l=r[8],c=r[12],f=r[1],u=r[5],d=r[9],p=r[13],v=r[2],m=r[6],g=r[10],_=r[14],y=r[3],x=r[7],S=r[11],T=r[15],C=i[0],L=i[4],E=i[8],A=i[12],I=i[1],q=i[5],ee=i[9],H=i[13],R=i[2],N=i[6],Z=i[10],K=i[14],B=i[3],$=i[7],W=i[11],ie=i[15];return o[0]=s*C+a*I+l*R+c*B,o[4]=s*L+a*q+l*N+c*$,o[8]=s*E+a*ee+l*Z+c*W,o[12]=s*A+a*H+l*K+c*ie,o[1]=f*C+u*I+d*R+p*B,o[5]=f*L+u*q+d*N+p*$,o[9]=f*E+u*ee+d*Z+p*W,o[13]=f*A+u*H+d*K+p*ie,o[2]=v*C+m*I+g*R+_*B,o[6]=v*L+m*q+g*N+_*$,o[10]=v*E+m*ee+g*Z+_*W,o[14]=v*A+m*H+g*K+_*ie,o[3]=y*C+x*I+S*R+T*B,o[7]=y*L+x*q+S*N+T*$,o[11]=y*E+x*ee+S*Z+T*W,o[15]=y*A+x*H+S*K+T*ie,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],r=e[4],i=e[8],o=e[12],s=e[1],a=e[5],l=e[9],c=e[13],f=e[2],u=e[6],d=e[10],p=e[14],v=e[3],m=e[7],g=e[11],_=e[15];return v*(+o*l*u-i*c*u-o*a*d+r*c*d+i*a*p-r*l*p)+m*(+t*l*p-t*c*d+o*s*d-i*s*p+i*c*f-o*l*f)+g*(+t*c*u-t*a*p-o*s*u+r*s*p+o*a*f-r*c*f)+_*(-i*a*f-t*l*u+t*a*d+i*s*u-r*s*d+r*l*f)}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,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=r),this}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],o=e[3],s=e[4],a=e[5],l=e[6],c=e[7],f=e[8],u=e[9],d=e[10],p=e[11],v=e[12],m=e[13],g=e[14],_=e[15],y=u*g*c-m*d*c+m*l*p-a*g*p-u*l*_+a*d*_,x=v*d*c-f*g*c-v*l*p+s*g*p+f*l*_-s*d*_,S=f*m*c-v*u*c+v*a*p-s*m*p-f*a*_+s*u*_,T=v*u*l-f*m*l-v*a*d+s*m*d+f*a*g-s*u*g,C=t*y+r*x+i*S+o*T;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const L=1/C;return e[0]=y*L,e[1]=(m*d*o-u*g*o-m*i*p+r*g*p+u*i*_-r*d*_)*L,e[2]=(a*g*o-m*l*o+m*i*c-r*g*c-a*i*_+r*l*_)*L,e[3]=(u*l*o-a*d*o-u*i*c+r*d*c+a*i*p-r*l*p)*L,e[4]=x*L,e[5]=(f*g*o-v*d*o+v*i*p-t*g*p-f*i*_+t*d*_)*L,e[6]=(v*l*o-s*g*o-v*i*c+t*g*c+s*i*_-t*l*_)*L,e[7]=(s*d*o-f*l*o+f*i*c-t*d*c-s*i*p+t*l*p)*L,e[8]=S*L,e[9]=(v*u*o-f*m*o-v*r*p+t*m*p+f*r*_-t*u*_)*L,e[10]=(s*m*o-v*a*o+v*r*c-t*m*c-s*r*_+t*a*_)*L,e[11]=(f*a*o-s*u*o-f*r*c+t*u*c+s*r*p-t*a*p)*L,e[12]=T*L,e[13]=(f*m*i-v*u*i+v*r*d-t*m*d-f*r*g+t*u*g)*L,e[14]=(v*a*i-s*m*i-v*r*l+t*m*l+s*r*g-t*a*g)*L,e[15]=(s*u*i-f*a*i+f*r*l-t*u*l-s*r*d+t*a*d)*L,this}scale(e){const t=this.elements,r=e.x,i=e.y,o=e.z;return t[0]*=r,t[4]*=i,t[8]*=o,t[1]*=r,t[5]*=i,t[9]*=o,t[2]*=r,t[6]*=i,t[10]*=o,t[3]*=r,t[7]*=i,t[11]*=o,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,i))}makeTranslation(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const r=Math.cos(t),i=Math.sin(t),o=1-r,s=e.x,a=e.y,l=e.z,c=o*s,f=o*a;return this.set(c*s+r,c*a-i*l,c*l+i*a,0,c*a+i*l,f*a+r,f*l-i*s,0,c*l-i*a,f*l+i*s,o*l*l+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,i,o,s){return this.set(1,r,o,0,e,1,s,0,t,i,1,0,0,0,0,1),this}compose(e,t,r){const i=this.elements,o=t._x,s=t._y,a=t._z,l=t._w,c=o+o,f=s+s,u=a+a,d=o*c,p=o*f,v=o*u,m=s*f,g=s*u,_=a*u,y=l*c,x=l*f,S=l*u,T=r.x,C=r.y,L=r.z;return i[0]=(1-(m+_))*T,i[1]=(p+S)*T,i[2]=(v-x)*T,i[3]=0,i[4]=(p-S)*C,i[5]=(1-(d+_))*C,i[6]=(g+y)*C,i[7]=0,i[8]=(v+x)*L,i[9]=(g-y)*L,i[10]=(1-(d+m))*L,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,r){const i=this.elements;let o=ea.set(i[0],i[1],i[2]).length();const s=ea.set(i[4],i[5],i[6]).length(),a=ea.set(i[8],i[9],i[10]).length();this.determinant()<0&&(o=-o),e.x=i[12],e.y=i[13],e.z=i[14],Fr.copy(this);const c=1/o,f=1/s,u=1/a;return Fr.elements[0]*=c,Fr.elements[1]*=c,Fr.elements[2]*=c,Fr.elements[4]*=f,Fr.elements[5]*=f,Fr.elements[6]*=f,Fr.elements[8]*=u,Fr.elements[9]*=u,Fr.elements[10]*=u,t.setFromRotationMatrix(Fr),r.x=o,r.y=s,r.z=a,this}makePerspective(e,t,r,i,o,s){const a=this.elements,l=2*o/(t-e),c=2*o/(r-i),f=(t+e)/(t-e),u=(r+i)/(r-i),d=-(s+o)/(s-o),p=-2*s*o/(s-o);return a[0]=l,a[4]=0,a[8]=f,a[12]=0,a[1]=0,a[5]=c,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,r,i,o,s){const a=this.elements,l=1/(t-e),c=1/(r-i),f=1/(s-o),u=(t+e)*l,d=(r+i)*c,p=(s+o)*f;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=-2*f,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<16;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}const ea=new F,Fr=new Be,T4=new F(0,0,0),C4=new F(1,1,1),io=new F,Hu=new F,sr=new F,S_=new Be,b_=new $t;class er{constructor(e=0,t=0,r=0,i=er.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r,i=this._order){return this._x=e,this._y=t,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){const i=e.elements,o=i[0],s=i[4],a=i[8],l=i[1],c=i[5],f=i[9],u=i[2],d=i[6],p=i[10];switch(t){case"XYZ":this._y=Math.asin(Mn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-f,p),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Mn(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,o),this._z=0);break;case"ZXY":this._x=Math.asin(Mn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(l,o));break;case"ZYX":this._y=Math.asin(-Mn(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-s,c));break;case"YZX":this._z=Math.asin(Mn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-f,c),this._y=Math.atan2(-u,o)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-Mn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,o)):(this._x=Math.atan2(-f,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return S_.makeRotationFromQuaternion(e),this.setFromRotationMatrix(S_,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return b_.setFromEuler(this),this.setFromQuaternion(b_,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}}er.DEFAULT_ORDER="XYZ";class G0{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let r=0;r0&&(r=r.concat(s))}return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ol,e,A4),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ol,L4,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 r=0,i=t.length;r0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON()));function o(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=o(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 c=0,f=l.length;c0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),f.length>0&&(r.images=f),u.length>0&&(r.shapes=u),d.length>0&&(r.skeletons=d),p.length>0&&(r.animations=p),v.length>0&&(r.nodes=v)}return r.object=i,r;function s(a){const l=[];for(const c in a){const f=a[c];delete f.metadata,l.push(f)}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.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let r=0;r0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(e,t,r,i,o){Nr.subVectors(i,t),Ci.subVectors(r,t),Lp.subVectors(e,t);const s=Nr.dot(Nr),a=Nr.dot(Ci),l=Nr.dot(Lp),c=Ci.dot(Ci),f=Ci.dot(Lp),u=s*c-a*a;if(u===0)return o.set(-2,-1,-1);const d=1/u,p=(c*l-a*f)*d,v=(s*f-a*l)*d;return o.set(1-p-v,v,p)}static containsPoint(e,t,r,i){return this.getBarycoord(e,t,r,i,Pi),Pi.x>=0&&Pi.y>=0&&Pi.x+Pi.y<=1}static getUV(e,t,r,i,o,s,a,l){return this.getBarycoord(e,t,r,i,Pi),l.set(0,0),l.addScaledVector(o,Pi.x),l.addScaledVector(s,Pi.y),l.addScaledVector(a,Pi.z),l}static isFrontFacing(e,t,r,i){return Nr.subVectors(r,t),Ci.subVectors(e,t),Nr.cross(Ci).dot(i)<0}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,r,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Nr.subVectors(this.c,this.b),Ci.subVectors(this.a,this.b),Nr.cross(Ci).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ii.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ii.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,i,o){return Ii.getUV(e,this.a,this.b,this.c,t,r,i,o)}containsPoint(e){return Ii.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ii.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const r=this.a,i=this.b,o=this.c;let s,a;na.subVectors(i,r),ra.subVectors(o,r),Rp.subVectors(e,r);const l=na.dot(Rp),c=ra.dot(Rp);if(l<=0&&c<=0)return t.copy(r);Dp.subVectors(e,i);const f=na.dot(Dp),u=ra.dot(Dp);if(f>=0&&u<=f)return t.copy(i);const d=l*u-f*c;if(d<=0&&l>=0&&f<=0)return s=l/(l-f),t.copy(r).addScaledVector(na,s);Ip.subVectors(e,o);const p=na.dot(Ip),v=ra.dot(Ip);if(v>=0&&p<=v)return t.copy(o);const m=p*c-l*v;if(m<=0&&c>=0&&v<=0)return a=c/(c-v),t.copy(r).addScaledVector(ra,a);const g=f*v-p*u;if(g<=0&&u-f>=0&&p-v>=0)return A_.subVectors(o,i),a=(u-f)/(u-f+(p-v)),t.copy(i).addScaledVector(A_,a);const _=1/(g+m+d);return s=m*_,a=d*_,t.copy(r).addScaledVector(na,s).addScaledVector(ra,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let D4=0;class Kr extends Fs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:D4++}),this.uuid=Yo(),this.name="",this.type="Material",this.blending=ka,this.side=Bo,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=BM,this.blendDst=VM,this.blendEquation=da,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=gg,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=r4,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=_p,this.stencilZFail=_p,this.stencilZPass=_p,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 r=e[t];if(r===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}const i=this[t];if(i===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[t]=r}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const r={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==ka&&(r.blending=this.blending),this.side!==Bo&&(r.side=this.side),this.vertexColors&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,r.colorWrite=this.colorWrite,r.stencilWrite=this.stencilWrite,r.stencilWriteMask=this.stencilWriteMask,r.stencilFunc=this.stencilFunc,r.stencilRef=this.stencilRef,r.stencilFuncMask=this.stencilFuncMask,r.stencilFail=this.stencilFail,r.stencilZFail=this.stencilZFail,r.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(r.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(r.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=this.flatShading),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(o){const s=[];for(const a in o){const l=o[a];delete l.metadata,s.push(l)}return s}if(t){const o=i(e.textures),s=i(e.images);o.length>0&&(r.textures=o),s.length>0&&(r.images=s)}return r}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 r=null;if(t!==null){const i=t.length;r=new Array(i);for(let o=0;o!==i;++o)r[o]=t[o].clone()}return this.clippingPlanes=r,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 QM={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},$r={h:0,s:0,l:0},Wu={h:0,s:0,l:0};function kp(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 Ye{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&r===void 0?this.set(e):this.setRGB(e,t,r)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ii){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,$n.toWorkingColorSpace(this,t),this}setRGB(e,t,r,i=$n.workingColorSpace){return this.r=e,this.g=t,this.b=r,$n.toWorkingColorSpace(this,i),this}setHSL(e,t,r,i=$n.workingColorSpace){if(e=H0(e,1),t=Mn(t,0,1),r=Mn(r,0,1),t===0)this.r=this.g=this.b=r;else{const o=r<=.5?r*(1+t):r+t-r*t,s=2*r-o;this.r=kp(s,o,e+1/3),this.g=kp(s,o,e),this.b=kp(s,o,e-1/3)}return $n.toWorkingColorSpace(this,i),this}setStyle(e,t=ii){function r(o){o!==void 0&&parseFloat(o)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const s=i[1],a=i[2];switch(s){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(o[1],10))/255,this.g=Math.min(255,parseInt(o[2],10))/255,this.b=Math.min(255,parseInt(o[3],10))/255,$n.toWorkingColorSpace(this,t),r(o[4]),this;if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(o[1],10))/100,this.g=Math.min(100,parseInt(o[2],10))/100,this.b=Math.min(100,parseInt(o[3],10))/100,$n.toWorkingColorSpace(this,t),r(o[4]),this;break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){const l=parseFloat(o[1])/360,c=parseFloat(o[2])/100,f=parseFloat(o[3])/100;return r(o[4]),this.setHSL(l,c,f,t)}break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=i[1],s=o.length;if(s===3)return this.r=parseInt(o.charAt(0)+o.charAt(0),16)/255,this.g=parseInt(o.charAt(1)+o.charAt(1),16)/255,this.b=parseInt(o.charAt(2)+o.charAt(2),16)/255,$n.toWorkingColorSpace(this,t),this;if(s===6)return this.r=parseInt(o.charAt(0)+o.charAt(1),16)/255,this.g=parseInt(o.charAt(2)+o.charAt(3),16)/255,this.b=parseInt(o.charAt(4)+o.charAt(5),16)/255,$n.toWorkingColorSpace(this,t),this;console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=ii){const r=QM[e.toLowerCase()];return r!==void 0?this.setHex(r,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=Fa(e.r),this.g=Fa(e.g),this.b=Fa(e.b),this}copyLinearToSRGB(e){return this.r=Sp(e.r),this.g=Sp(e.g),this.b=Sp(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ii){return $n.fromWorkingColorSpace(In.copy(this),e),Mn(In.r*255,0,255)<<16^Mn(In.g*255,0,255)<<8^Mn(In.b*255,0,255)<<0}getHexString(e=ii){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=$n.workingColorSpace){$n.fromWorkingColorSpace(In.copy(this),t);const r=In.r,i=In.g,o=In.b,s=Math.max(r,i,o),a=Math.min(r,i,o);let l,c;const f=(a+s)/2;if(a===s)l=0,c=0;else{const u=s-a;switch(c=f<=.5?u/(s+a):u/(2-s-a),s){case r:l=(i-o)/u+(i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);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 r=this.attributes;for(const l in r){const c=r[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let o=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],f=[];for(let u=0,d=c.length;u0&&(i[l]=f,o=!0)}o&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));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 r=e.index;r!==null&&this.setIndex(r.clone(t));const i=e.attributes;for(const c in i){const f=i[c];this.setAttribute(c,f.clone(t))}const o=e.morphAttributes;for(const c in o){const f=[],u=o[c];for(let d=0,p=u.length;d0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,s=i.length;o(e.far-e.near)**2))||(L_.copy(o).invert(),ei.copy(e.ray).applyMatrix4(L_),r.boundingBox!==null&&ei.intersectsBox(r.boundingBox)===!1))return;let s;const a=r.index,l=r.attributes.position,c=r.attributes.uv,f=r.attributes.uv2,u=r.groups,d=r.drawRange;if(a!==null)if(Array.isArray(i))for(let p=0,v=u.length;pt.far?null:{distance:c,point:Qu.clone(),object:n}}function Ju(n,e,t,r,i,o,s,a,l){n.getVertexPosition(s,Nl),n.getVertexPosition(a,$l),n.getVertexPosition(l,Ul);const c=k4(n,e,t,r,Nl,$l,Ul,Np);if(c){i&&(Yu.fromBufferAttribute(i,s),qu.fromBufferAttribute(i,a),Zu.fromBufferAttribute(i,l),c.uv=Ii.getUV(Np,Nl,$l,Ul,Yu,qu,Zu,new We)),o&&(Yu.fromBufferAttribute(o,s),qu.fromBufferAttribute(o,a),Zu.fromBufferAttribute(o,l),c.uv2=Ii.getUV(Np,Nl,$l,Ul,Yu,qu,Zu,new We));const f={a:s,b:a,c:l,normal:new F,materialIndex:0};Ii.getNormal(Nl,$l,Ul,f.normal),c.face=f}return c}class Jt extends Ht{constructor(e=1,t=1,r=1,i=1,o=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:i,heightSegments:o,depthSegments:s};const a=this;i=Math.floor(i),o=Math.floor(o),s=Math.floor(s);const l=[],c=[],f=[],u=[];let d=0,p=0;v("z","y","x",-1,-1,r,t,e,s,o,0),v("z","y","x",1,-1,r,t,-e,s,o,1),v("x","z","y",1,1,e,r,t,i,s,2),v("x","z","y",1,-1,e,r,-t,i,s,3),v("x","y","z",1,-1,e,t,r,i,o,4),v("x","y","z",-1,-1,e,t,-r,i,o,5),this.setIndex(l),this.setAttribute("position",new Je(c,3)),this.setAttribute("normal",new Je(f,3)),this.setAttribute("uv",new Je(u,2));function v(m,g,_,y,x,S,T,C,L,E,A){const I=S/L,q=T/E,ee=S/2,H=T/2,R=C/2,N=L+1,Z=E+1;let K=0,B=0;const $=new F;for(let W=0;W0?1:-1,f.push($.x,$.y,$.z),u.push(j/L),u.push(1-W/E),K+=1}}for(let W=0;W0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}}class n2 extends bt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Be,this.projectionMatrix=new Be,this.projectionMatrixInverse=new Be}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),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 Bn extends n2{constructor(e=50,t=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=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=Bc*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(hc*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Bc*2*Math.atan(Math.tan(hc*.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,r,i,o,s){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=r,this.view.offsetY=i,this.view.width=o,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(hc*.5*this.fov)/this.zoom,r=2*t,i=this.aspect*r,o=-.5*i;const s=this.view;if(this.view!==null&&this.view.enabled){const l=s.fullWidth,c=s.fullHeight;o+=s.offsetX*i/l,t-=s.offsetY*r/c,i*=s.width/l,r*=s.height/c}const a=this.filmOffset;a!==0&&(o+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(o,o+i,t,t-r,e,this.far),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 oa=-90,sa=1;class $4 extends bt{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r;const i=new Bn(oa,sa,e,t);i.layers=this.layers,i.up.set(0,1,0),i.lookAt(1,0,0),this.add(i);const o=new Bn(oa,sa,e,t);o.layers=this.layers,o.up.set(0,1,0),o.lookAt(-1,0,0),this.add(o);const s=new Bn(oa,sa,e,t);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(0,1,0),this.add(s);const a=new Bn(oa,sa,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);const l=new Bn(oa,sa,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,1),this.add(l);const c=new Bn(oa,sa,e,t);c.layers=this.layers,c.up.set(0,1,0),c.lookAt(0,0,-1),this.add(c)}update(e,t){this.parent===null&&this.updateMatrixWorld();const r=this.renderTarget,[i,o,s,a,l,c]=this.children,f=e.getRenderTarget(),u=e.toneMapping,d=e.xr.enabled;e.toneMapping=Hi,e.xr.enabled=!1;const p=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0),e.render(t,i),e.setRenderTarget(r,1),e.render(t,o),e.setRenderTarget(r,2),e.render(t,s),e.setRenderTarget(r,3),e.render(t,a),e.setRenderTarget(r,4),e.render(t,l),r.texture.generateMipmaps=p,e.setRenderTarget(r,5),e.render(t,c),e.setRenderTarget(f),e.toneMapping=u,e.xr.enabled=d,r.texture.needsPMREMUpdate=!0}}class r2 extends Tn{constructor(e,t,r,i,o,s,a,l,c,f){e=e!==void 0?e:[],t=t!==void 0?t:Ka,super(e,t,r,i,o,s,a,l,c,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class U4 extends Vo{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new r2(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:br}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const r={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 ); } `},i=new Jt(5,5,5),o=new gi({name:"CubemapFromEquirect",uniforms:Za(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:dr,blending:Io});o.uniforms.tEquirect.value=t;const s=new Me(i,o),a=t.minFilter;return t.minFilter===$c&&(t.minFilter=br),new $4(1,10,this).update(e,s),t.minFilter=a,s.geometry.dispose(),s.material.dispose(),this}clear(e,t,r,i){const o=e.getRenderTarget();for(let s=0;s<6;s++)e.setRenderTarget(this,s),e.clear(t,r,i);e.setRenderTarget(o)}}const $p=new F,z4=new F,B4=new On;class cs{constructor(e=new F(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,r,i){return this.normal.set(e,t,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){const i=$p.subVectors(r,t).cross(z4.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const r=e.delta($p),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const o=-(e.start.dot(this.normal)+this.constant)/i;return o<0||o>1?null:t.copy(e.start).addScaledVector(r,o)}intersectsLine(e){const t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<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 r=t||B4.getNormalMatrix(e),i=this.coplanarPoint($p).applyMatrix4(e),o=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(o),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 aa=new ll,ef=new F;class Hc{constructor(e=new cs,t=new cs,r=new cs,i=new cs,o=new cs,s=new cs){this.planes=[e,t,r,i,o,s]}set(e,t,r,i,o,s){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(r),a[3].copy(i),a[4].copy(o),a[5].copy(s),this}copy(e){const t=this.planes;for(let r=0;r<6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e){const t=this.planes,r=e.elements,i=r[0],o=r[1],s=r[2],a=r[3],l=r[4],c=r[5],f=r[6],u=r[7],d=r[8],p=r[9],v=r[10],m=r[11],g=r[12],_=r[13],y=r[14],x=r[15];return t[0].setComponents(a-i,u-l,m-d,x-g).normalize(),t[1].setComponents(a+i,u+l,m+d,x+g).normalize(),t[2].setComponents(a+o,u+c,m+p,x+_).normalize(),t[3].setComponents(a-o,u-c,m-p,x-_).normalize(),t[4].setComponents(a-s,u-f,m-v,x-y).normalize(),t[5].setComponents(a+s,u+f,m+v,x+y).normalize(),this}intersectsObject(e){const t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),aa.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(aa)}intersectsSprite(e){return aa.center.set(0,0,0),aa.radius=.7071067811865476,aa.applyMatrix4(e.matrixWorld),this.intersectsSphere(aa)}intersectsSphere(e){const t=this.planes,r=e.center,i=-e.radius;for(let o=0;o<6;o++)if(t[o].distanceToPoint(r)0?e.max.x:e.min.x,ef.y=i.normal.y>0?e.max.y:e.min.y,ef.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(ef)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let r=0;r<6;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function i2(){let n=null,e=!1,t=null,r=null;function i(o,s){t(o,s),r=n.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(r=n.requestAnimationFrame(i),e=!0)},stop:function(){n.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(o){t=o},setContext:function(o){n=o}}}function V4(n,e){const t=e.isWebGL2,r=new WeakMap;function i(c,f){const u=c.array,d=c.usage,p=n.createBuffer();n.bindBuffer(f,p),n.bufferData(f,u,d),c.onUploadCallback();let v;if(u instanceof Float32Array)v=5126;else if(u instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)v=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else v=5123;else if(u instanceof Int16Array)v=5122;else if(u instanceof Uint32Array)v=5125;else if(u instanceof Int32Array)v=5124;else if(u instanceof Int8Array)v=5120;else if(u instanceof Uint8Array)v=5121;else if(u instanceof Uint8ClampedArray)v=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+u);return{buffer:p,type:v,bytesPerElement:u.BYTES_PER_ELEMENT,version:c.version}}function o(c,f,u){const d=f.array,p=f.updateRange;n.bindBuffer(u,c),p.count===-1?n.bufferSubData(u,0,d):(t?n.bufferSubData(u,p.offset*d.BYTES_PER_ELEMENT,d,p.offset,p.count):n.bufferSubData(u,p.offset*d.BYTES_PER_ELEMENT,d.subarray(p.offset,p.offset+p.count)),p.count=-1),f.onUploadCallback()}function s(c){return c.isInterleavedBufferAttribute&&(c=c.data),r.get(c)}function a(c){c.isInterleavedBufferAttribute&&(c=c.data);const f=r.get(c);f&&(n.deleteBuffer(f.buffer),r.delete(c))}function l(c,f){if(c.isGLBufferAttribute){const d=r.get(c);(!d||d.version 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 ); } float G_BlinnPhong_Implicit( ) { return 0.25; } float D_BlinnPhong( const in float shininess, const in float dotNH ) { return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); } vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { vec3 halfDir = normalize( lightDir + viewDir ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( specularColor, 1.0, dotVH ); float G = G_BlinnPhong_Implicit( ); float D = D_BlinnPhong( shininess, dotNH ); return F * ( G * D ); } #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`,Q4=`#ifdef USE_IRIDESCENCE const mat3 XYZ_TO_REC709 = mat3( 3.2404542, -0.9692660, 0.0556434, -1.5371385, 1.8760108, -0.2040259, -0.4985314, 0.0415560, 1.0572252 ); vec3 Fresnel0ToIor( vec3 fresnel0 ) { vec3 sqrtF0 = sqrt( fresnel0 ); return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); } vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); } float IorToFresnel0( float transmittedIor, float incidentIor ) { return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); } vec3 evalSensitivity( float OPD, vec3 shift ) { float phase = 2.0 * PI * OPD * 1.0e-9; vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); xyz /= 1.0685e-7; vec3 rgb = XYZ_TO_REC709 * xyz; return rgb; } vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { vec3 I; float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); float cosTheta2Sq = 1.0 - sinTheta2Sq; if ( cosTheta2Sq < 0.0 ) { return vec3( 1.0 ); } float cosTheta2 = sqrt( cosTheta2Sq ); float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); float R12 = F_Schlick( R0, 1.0, cosTheta1 ); float R21 = R12; float T121 = 1.0 - R12; float phi12 = 0.0; if ( iridescenceIOR < outsideIOR ) phi12 = PI; float phi21 = PI - phi12; vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); vec3 phi23 = vec3( 0.0 ); if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; vec3 phi = vec3( phi21 ) + phi23; vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); vec3 r123 = sqrt( R123 ); vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); vec3 C0 = R12 + Rs; I = C0; vec3 Cm = Rs - T121; for ( int m = 1; m <= 2; ++ m ) { Cm *= r123; vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); I += Cm * Sm; } return max( I, vec3( 0.0 ) ); } #endif`,J4=`#ifdef USE_BUMPMAP uniform sampler2D bumpMap; uniform float bumpScale; vec2 dHdxy_fwd() { vec2 dSTdx = dFdx( vUv ); vec2 dSTdy = dFdy( vUv ); float Hll = bumpScale * texture2D( bumpMap, vUv ).x; float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll; float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll; return vec2( dBx, dBy ); } vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { vec3 vSigmaX = dFdx( surf_pos.xyz ); vec3 vSigmaY = dFdy( surf_pos.xyz ); vec3 vN = surf_norm; vec3 R1 = cross( vSigmaY, vN ); vec3 R2 = cross( vN, vSigmaX ); float fDet = dot( vSigmaX, R1 ) * faceDirection; vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); return normalize( abs( fDet ) * surf_norm - vGrad ); } #endif`,eF=`#if NUM_CLIPPING_PLANES > 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`,tF=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,nF=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif`,rF=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif`,iF=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; #endif`,oF=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; #endif`,sF=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; #endif`,aF=`#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`,lF=`#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 ); }`,cF=`#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`,uF=`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`,fF=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`,dF=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias ); #endif`,hF=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vUv ); totalEmissiveRadiance *= emissiveColor.rgb; #endif`,pF=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`,mF="gl_FragColor = linearToOutputTexel( gl_FragColor );",gF=`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 ); }`,vF=`#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`,yF=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #else uniform sampler2D envMap; #endif #endif`,_F=`#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`,xF=`#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`,wF=`#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`,SF=`#ifdef USE_FOG vFogDepth = - mvPosition.z; #endif`,bF=`#ifdef USE_FOG varying float vFogDepth; #endif`,MF=`#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`,EF=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`,TF=`#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 }`,CF=`#ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vUv2 ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; reflectedLight.indirectDiffuse += lightMapIrradiance; #endif`,PF=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`,AF=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularStrength = specularStrength;`,LF=`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`,RF=`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`,DF=`#if defined( USE_ENVMAP ) vec3 getIBLIrradiance( const in vec3 normal ) { #if defined( 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 ) { #if defined( 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 } #endif`,IF=`ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`,kF=`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`,OF=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`,FF=`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`,NF=`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 SPECULAR float specularIntensityFactor = specularIntensity; vec3 specularColorFactor = specularColor; #ifdef USE_SPECULARINTENSITYMAP specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a; #endif #ifdef USE_SPECULARCOLORMAP specularColorFactor *= texture2D( specularColorMap, vUv ).rgb; #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, vUv ).x; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).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, vUv ).r; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum; #else material.iridescenceThickness = iridescenceThicknessMaximum; #endif #endif #ifdef USE_SHEEN material.sheenColor = sheenColor; #ifdef USE_SHEENCOLORMAP material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb; #endif material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); #ifdef USE_SHEENROUGHNESSMAP material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a; #endif #endif`,$F=`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 }; vec3 clearcoatSpecular = vec3( 0.0 ); vec3 sheenSpecular = vec3( 0.0 ); 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( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); #endif #ifdef USE_SHEEN sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness ); #endif #ifdef USE_IRIDESCENCE reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness ); #else reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness ); #endif 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 ); }`,UF=` 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`,zF=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vUv2 ); 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 ) radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness ); #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); #endif #endif`,BF=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); #endif`,VF=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,HF=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`,GF=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif #endif`,WF=`#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`,jF=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); #endif diffuseColor *= sampledDiffuseColor; #endif`,XF=`#ifdef USE_MAP uniform sampler2D map; #endif`,KF=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; #endif #ifdef USE_MAP diffuseColor *= texture2D( map, uv ); #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; #endif`,YF=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) uniform mat3 uvTransform; #endif #ifdef USE_MAP uniform sampler2D map; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; #endif`,qF=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vUv ); metalnessFactor *= texelMetalness.b; #endif`,ZF=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`,QF=`#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`,JF=`#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`,eN=`#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`,tN=`#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`,nN=`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 = normal * faceDirection; #endif #ifdef USE_TANGENT vec3 tangent = normalize( vTangent ); vec3 bitangent = normalize( vBitangent ); #ifdef DOUBLE_SIDED tangent = tangent * faceDirection; bitangent = bitangent * faceDirection; #endif #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP ) mat3 vTBN = mat3( tangent, bitangent, normal ); #endif #endif #endif vec3 geometryNormal = normal;`,rN=`#ifdef OBJECTSPACE_NORMALMAP normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; #endif #ifdef DOUBLE_SIDED normal = normal * faceDirection; #endif normal = normalize( normalMatrix * normal ); #elif defined( TANGENTSPACE_NORMALMAP ) vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; mapN.xy *= normalScale; #ifdef USE_TANGENT normal = normalize( vTBN * mapN ); #else normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection ); #endif #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); #endif`,iN=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,oN=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,sN=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif`,aN=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif #ifdef OBJECTSPACE_NORMALMAP uniform mat3 normalMatrix; #endif #if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) ) vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) { vec3 q0 = dFdx( eye_pos.xyz ); vec3 q1 = dFdy( eye_pos.xyz ); vec2 st0 = dFdx( vUv.st ); vec2 st1 = dFdy( vUv.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 : faceDirection * inversesqrt( det ); return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z ); } #endif`,lN=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = geometryNormal; #endif`,cN=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; #ifdef USE_TANGENT clearcoatNormal = normalize( vTBN * clearcoatMapN ); #else clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection ); #endif #endif`,uN=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform sampler2D clearcoatNormalMap; uniform vec2 clearcoatNormalScale; #endif`,fN=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; #endif`,dN=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha + 0.1; #endif gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,hN=`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 linearClipZ, const in float near, const in float far ) { return linearClipZ * ( 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 invClipZ, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * invClipZ - far ); }`,pN=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`,mN=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;`,gN=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`,vN=`#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`,yN=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vUv ); roughnessFactor *= texelRoughness.g; #endif`,_N=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`,xN=`#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`,wN=`#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`,SN=`#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`,bN=`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; }`,MN=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`,EN=`#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`,TN=`#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`,CN=`#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`,PN=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`,AN=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`,LN=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`,RN=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; vec3 LinearToneMapping( vec3 color ) { return 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; }`,DN=`#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, 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 ); vec4 transmission = 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, transmission.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission ); #endif`,IN=`#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, vec2 fullSize, 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; vec2 lodFudge = pow( 1.95, lod ) / fullSize; 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; vec2 fullSize = vec2( textureSize( sampler, 0 ) ); vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), fullSize, floor( lod ) ); vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), fullSize, 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 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { if ( isinf( attenuationDistance ) ) { return radiance; } else { vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); 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; 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 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance ); vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); } #endif`,kN=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) ) varying vec2 vUv; #endif`,ON=`#ifdef USE_UV #ifdef UVS_VERTEX_ONLY vec2 vUv; #else varying vec2 vUv; #endif uniform mat3 uvTransform; #endif`,FN=`#ifdef USE_UV vUv = ( uvTransform * vec3( uv, 1 ) ).xy; #endif`,NN=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) varying vec2 vUv2; #endif`,$N=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) attribute vec2 uv2; varying vec2 vUv2; uniform mat3 uv2Transform; #endif`,UN=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy; #endif`,zN=`#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 BN=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`,VN=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { vec4 texColor = texture2D( t2D, vUv ); #ifdef DECODE_VIDEO_TEXTURE texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,HN=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,GN=`#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 }`,WN=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,jN=`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 }`,XN=`#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; }`,KN=`#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 }`,YN=`#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; }`,qN=`#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 ); }`,ZN=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`,QN=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include }`,JN=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include #include #include #include #include #include void main() { vLineDistance = scale * lineDistance; #include #include #include #include #include #include #include #include }`,e6=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; varying float vLineDistance; #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 outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,t6=`#include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) #include #include #include #include #include #endif #include #include #include #include #include #include #include #include #include }`,n6=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #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, vUv2 ); 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 }`,r6=`#define LAMBERT varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,i6=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #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 }`,o6=`#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; }`,s6=`#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 }`,a6=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) 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( TANGENTSPACE_NORMALMAP ) vViewPosition = - mvPosition.xyz; #endif }`,l6=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) 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 }`,c6=`#define PHONG varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,u6=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; uniform float shininess; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #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 }`,f6=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; #endif #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif }`,d6=`#define STANDARD #ifdef PHYSICAL #define IOR #define SPECULAR #endif uniform vec3 diffuse; uniform vec3 emissive; uniform float roughness; uniform float metalness; uniform float opacity; #ifdef IOR uniform float ior; #endif #ifdef SPECULAR uniform float specularIntensity; uniform vec3 specularColor; #ifdef USE_SPECULARINTENSITYMAP uniform sampler2D specularIntensityMap; #endif #ifdef USE_SPECULARCOLORMAP uniform sampler2D specularColorMap; #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_SHEENCOLORMAP uniform sampler2D sheenColorMap; #endif #ifdef USE_SHEENROUGHNESSMAP uniform sampler2D sheenRoughnessMap; #endif #endif varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #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 }`,h6=`#define TOON varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include }`,p6=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #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 }`,m6=`uniform float size; uniform float scale; #include #include #include #include #include #include void main() { #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 }`,g6=`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 }`,v6=`#include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include }`,y6=`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 }`,_6=`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 }`,x6=`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 }`,nt={alphamap_fragment:H4,alphamap_pars_fragment:G4,alphatest_fragment:W4,alphatest_pars_fragment:j4,aomap_fragment:X4,aomap_pars_fragment:K4,begin_vertex:Y4,beginnormal_vertex:q4,bsdfs:Z4,iridescence_fragment:Q4,bumpmap_pars_fragment:J4,clipping_planes_fragment:eF,clipping_planes_pars_fragment:tF,clipping_planes_pars_vertex:nF,clipping_planes_vertex:rF,color_fragment:iF,color_pars_fragment:oF,color_pars_vertex:sF,color_vertex:aF,common:lF,cube_uv_reflection_fragment:cF,defaultnormal_vertex:uF,displacementmap_pars_vertex:fF,displacementmap_vertex:dF,emissivemap_fragment:hF,emissivemap_pars_fragment:pF,encodings_fragment:mF,encodings_pars_fragment:gF,envmap_fragment:vF,envmap_common_pars_fragment:yF,envmap_pars_fragment:_F,envmap_pars_vertex:xF,envmap_physical_pars_fragment:DF,envmap_vertex:wF,fog_vertex:SF,fog_pars_vertex:bF,fog_fragment:MF,fog_pars_fragment:EF,gradientmap_pars_fragment:TF,lightmap_fragment:CF,lightmap_pars_fragment:PF,lights_lambert_fragment:AF,lights_lambert_pars_fragment:LF,lights_pars_begin:RF,lights_toon_fragment:IF,lights_toon_pars_fragment:kF,lights_phong_fragment:OF,lights_phong_pars_fragment:FF,lights_physical_fragment:NF,lights_physical_pars_fragment:$F,lights_fragment_begin:UF,lights_fragment_maps:zF,lights_fragment_end:BF,logdepthbuf_fragment:VF,logdepthbuf_pars_fragment:HF,logdepthbuf_pars_vertex:GF,logdepthbuf_vertex:WF,map_fragment:jF,map_pars_fragment:XF,map_particle_fragment:KF,map_particle_pars_fragment:YF,metalnessmap_fragment:qF,metalnessmap_pars_fragment:ZF,morphcolor_vertex:QF,morphnormal_vertex:JF,morphtarget_pars_vertex:eN,morphtarget_vertex:tN,normal_fragment_begin:nN,normal_fragment_maps:rN,normal_pars_fragment:iN,normal_pars_vertex:oN,normal_vertex:sN,normalmap_pars_fragment:aN,clearcoat_normal_fragment_begin:lN,clearcoat_normal_fragment_maps:cN,clearcoat_pars_fragment:uN,iridescence_pars_fragment:fN,output_fragment:dN,packing:hN,premultiplied_alpha_fragment:pN,project_vertex:mN,dithering_fragment:gN,dithering_pars_fragment:vN,roughnessmap_fragment:yN,roughnessmap_pars_fragment:_N,shadowmap_pars_fragment:xN,shadowmap_pars_vertex:wN,shadowmap_vertex:SN,shadowmask_pars_fragment:bN,skinbase_vertex:MN,skinning_pars_vertex:EN,skinning_vertex:TN,skinnormal_vertex:CN,specularmap_fragment:PN,specularmap_pars_fragment:AN,tonemapping_fragment:LN,tonemapping_pars_fragment:RN,transmission_fragment:DN,transmission_pars_fragment:IN,uv_pars_fragment:kN,uv_pars_vertex:ON,uv_vertex:FN,uv2_pars_fragment:NN,uv2_pars_vertex:$N,uv2_vertex:UN,worldpos_vertex:zN,background_vert:BN,background_frag:VN,backgroundCube_vert:HN,backgroundCube_frag:GN,cube_vert:WN,cube_frag:jN,depth_vert:XN,depth_frag:KN,distanceRGBA_vert:YN,distanceRGBA_frag:qN,equirect_vert:ZN,equirect_frag:QN,linedashed_vert:JN,linedashed_frag:e6,meshbasic_vert:t6,meshbasic_frag:n6,meshlambert_vert:r6,meshlambert_frag:i6,meshmatcap_vert:o6,meshmatcap_frag:s6,meshnormal_vert:a6,meshnormal_frag:l6,meshphong_vert:c6,meshphong_frag:u6,meshphysical_vert:f6,meshphysical_frag:d6,meshtoon_vert:h6,meshtoon_frag:p6,points_vert:m6,points_frag:g6,shadow_vert:v6,shadow_frag:y6,sprite_vert:_6,sprite_frag:x6},Te={common:{diffuse:{value:new Ye(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new On},uv2Transform:{value:new On},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new We(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ye(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 Ye(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new On}},sprite:{diffuse:{value:new Ye(16777215)},opacity:{value:1},center:{value:new We(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new On}}},oi={basic:{uniforms:Un([Te.common,Te.specularmap,Te.envmap,Te.aomap,Te.lightmap,Te.fog]),vertexShader:nt.meshbasic_vert,fragmentShader:nt.meshbasic_frag},lambert:{uniforms:Un([Te.common,Te.specularmap,Te.envmap,Te.aomap,Te.lightmap,Te.emissivemap,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.fog,Te.lights,{emissive:{value:new Ye(0)}}]),vertexShader:nt.meshlambert_vert,fragmentShader:nt.meshlambert_frag},phong:{uniforms:Un([Te.common,Te.specularmap,Te.envmap,Te.aomap,Te.lightmap,Te.emissivemap,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.fog,Te.lights,{emissive:{value:new Ye(0)},specular:{value:new Ye(1118481)},shininess:{value:30}}]),vertexShader:nt.meshphong_vert,fragmentShader:nt.meshphong_frag},standard:{uniforms:Un([Te.common,Te.envmap,Te.aomap,Te.lightmap,Te.emissivemap,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.roughnessmap,Te.metalnessmap,Te.fog,Te.lights,{emissive:{value:new Ye(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:nt.meshphysical_vert,fragmentShader:nt.meshphysical_frag},toon:{uniforms:Un([Te.common,Te.aomap,Te.lightmap,Te.emissivemap,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.gradientmap,Te.fog,Te.lights,{emissive:{value:new Ye(0)}}]),vertexShader:nt.meshtoon_vert,fragmentShader:nt.meshtoon_frag},matcap:{uniforms:Un([Te.common,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.fog,{matcap:{value:null}}]),vertexShader:nt.meshmatcap_vert,fragmentShader:nt.meshmatcap_frag},points:{uniforms:Un([Te.points,Te.fog]),vertexShader:nt.points_vert,fragmentShader:nt.points_frag},dashed:{uniforms:Un([Te.common,Te.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:nt.linedashed_vert,fragmentShader:nt.linedashed_frag},depth:{uniforms:Un([Te.common,Te.displacementmap]),vertexShader:nt.depth_vert,fragmentShader:nt.depth_frag},normal:{uniforms:Un([Te.common,Te.bumpmap,Te.normalmap,Te.displacementmap,{opacity:{value:1}}]),vertexShader:nt.meshnormal_vert,fragmentShader:nt.meshnormal_frag},sprite:{uniforms:Un([Te.sprite,Te.fog]),vertexShader:nt.sprite_vert,fragmentShader:nt.sprite_frag},background:{uniforms:{uvTransform:{value:new On},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:nt.background_vert,fragmentShader:nt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:nt.backgroundCube_vert,fragmentShader:nt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:nt.cube_vert,fragmentShader:nt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:nt.equirect_vert,fragmentShader:nt.equirect_frag},distanceRGBA:{uniforms:Un([Te.common,Te.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:nt.distanceRGBA_vert,fragmentShader:nt.distanceRGBA_frag},shadow:{uniforms:Un([Te.lights,Te.fog,{color:{value:new Ye(0)},opacity:{value:1}}]),vertexShader:nt.shadow_vert,fragmentShader:nt.shadow_frag}};oi.physical={uniforms:Un([oi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new We(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new Ye(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new We},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Ye(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Ye(1,1,1)},specularColorMap:{value:null}}]),vertexShader:nt.meshphysical_vert,fragmentShader:nt.meshphysical_frag};const tf={r:0,b:0,g:0};function w6(n,e,t,r,i,o,s){const a=new Ye(0);let l=o===!0?0:1,c,f,u=null,d=0,p=null;function v(g,_){let y=!1,x=_.isScene===!0?_.background:null;x&&x.isTexture&&(x=(_.backgroundBlurriness>0?t:e).get(x));const S=n.xr,T=S.getSession&&S.getSession();T&&T.environmentBlendMode==="additive"&&(x=null),x===null?m(a,l):x&&x.isColor&&(m(x,1),y=!0),(n.autoClear||y)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),x&&(x.isCubeTexture||x.mapping===sh)?(f===void 0&&(f=new Me(new Jt(1,1,1),new gi({name:"BackgroundCubeMaterial",uniforms:Za(oi.backgroundCube.uniforms),vertexShader:oi.backgroundCube.vertexShader,fragmentShader:oi.backgroundCube.fragmentShader,side:dr,depthTest:!1,depthWrite:!1,fog:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(C,L,E){this.matrixWorld.copyPosition(E.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(f)),f.material.uniforms.envMap.value=x,f.material.uniforms.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=_.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,f.material.toneMapped=x.encoding!==_t,(u!==x||d!==x.version||p!==n.toneMapping)&&(f.material.needsUpdate=!0,u=x,d=x.version,p=n.toneMapping),f.layers.enableAll(),g.unshift(f,f.geometry,f.material,0,0,null)):x&&x.isTexture&&(c===void 0&&(c=new Me(new ch(2,2),new gi({name:"BackgroundMaterial",uniforms:Za(oi.background.uniforms),vertexShader:oi.background.vertexShader,fragmentShader:oi.background.fragmentShader,side:Bo,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=x,c.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,c.material.toneMapped=x.encoding!==_t,x.matrixAutoUpdate===!0&&x.updateMatrix(),c.material.uniforms.uvTransform.value.copy(x.matrix),(u!==x||d!==x.version||p!==n.toneMapping)&&(c.material.needsUpdate=!0,u=x,d=x.version,p=n.toneMapping),c.layers.enableAll(),g.unshift(c,c.geometry,c.material,0,0,null))}function m(g,_){g.getRGB(tf,e2(n)),r.buffers.color.setClear(tf.r,tf.g,tf.b,_,s)}return{getClearColor:function(){return a},setClearColor:function(g,_=1){a.set(g),l=_,m(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(g){l=g,m(a,l)},render:v}}function S6(n,e,t,r){const i=n.getParameter(34921),o=r.isWebGL2?null:e.get("OES_vertex_array_object"),s=r.isWebGL2||o!==null,a={},l=g(null);let c=l,f=!1;function u(R,N,Z,K,B){let $=!1;if(s){const W=m(K,Z,N);c!==W&&(c=W,p(c.object)),$=_(R,K,Z,B),$&&y(R,K,Z,B)}else{const W=N.wireframe===!0;(c.geometry!==K.id||c.program!==Z.id||c.wireframe!==W)&&(c.geometry=K.id,c.program=Z.id,c.wireframe=W,$=!0)}B!==null&&t.update(B,34963),($||f)&&(f=!1,E(R,N,Z,K),B!==null&&n.bindBuffer(34963,t.get(B).buffer))}function d(){return r.isWebGL2?n.createVertexArray():o.createVertexArrayOES()}function p(R){return r.isWebGL2?n.bindVertexArray(R):o.bindVertexArrayOES(R)}function v(R){return r.isWebGL2?n.deleteVertexArray(R):o.deleteVertexArrayOES(R)}function m(R,N,Z){const K=Z.wireframe===!0;let B=a[R.id];B===void 0&&(B={},a[R.id]=B);let $=B[N.id];$===void 0&&($={},B[N.id]=$);let W=$[K];return W===void 0&&(W=g(d()),$[K]=W),W}function g(R){const N=[],Z=[],K=[];for(let B=0;B=0){const ue=B[j];let Q=$[j];if(Q===void 0&&(j==="instanceMatrix"&&R.instanceMatrix&&(Q=R.instanceMatrix),j==="instanceColor"&&R.instanceColor&&(Q=R.instanceColor)),ue===void 0||ue.attribute!==Q||Q&&ue.data!==Q.data)return!0;W++}return c.attributesNum!==W||c.index!==K}function y(R,N,Z,K){const B={},$=N.attributes;let W=0;const ie=Z.getAttributes();for(const j in ie)if(ie[j].location>=0){let ue=$[j];ue===void 0&&(j==="instanceMatrix"&&R.instanceMatrix&&(ue=R.instanceMatrix),j==="instanceColor"&&R.instanceColor&&(ue=R.instanceColor));const Q={};Q.attribute=ue,ue&&ue.data&&(Q.data=ue.data),B[j]=Q,W++}c.attributes=B,c.attributesNum=W,c.index=K}function x(){const R=c.newAttributes;for(let N=0,Z=R.length;N=0){let se=B[ie];if(se===void 0&&(ie==="instanceMatrix"&&R.instanceMatrix&&(se=R.instanceMatrix),ie==="instanceColor"&&R.instanceColor&&(se=R.instanceColor)),se!==void 0){const ue=se.normalized,Q=se.itemSize,me=t.get(se);if(me===void 0)continue;const pe=me.buffer,we=me.type,de=me.bytesPerElement;if(se.isInterleavedBufferAttribute){const Pe=se.data,Ne=Pe.stride,He=se.offset;if(Pe.isInstancedInterleavedBuffer){for(let $e=0;$e0&&n.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";L="mediump"}return L==="mediump"&&n.getShaderPrecisionFormat(35633,36337).precision>0&&n.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const s=typeof WebGL2RenderingContext<"u"&&n instanceof WebGL2RenderingContext;let a=t.precision!==void 0?t.precision:"highp";const l=o(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=s||e.has("WEBGL_draw_buffers"),f=t.logarithmicDepthBuffer===!0,u=n.getParameter(34930),d=n.getParameter(35660),p=n.getParameter(3379),v=n.getParameter(34076),m=n.getParameter(34921),g=n.getParameter(36347),_=n.getParameter(36348),y=n.getParameter(36349),x=d>0,S=s||e.has("OES_texture_float"),T=x&&S,C=s?n.getParameter(36183):0;return{isWebGL2:s,drawBuffers:c,getMaxAnisotropy:i,getMaxPrecision:o,precision:a,logarithmicDepthBuffer:f,maxTextures:u,maxVertexTextures:d,maxTextureSize:p,maxCubemapSize:v,maxAttributes:m,maxVertexUniforms:g,maxVaryings:_,maxFragmentUniforms:y,vertexTextures:x,floatFragmentTextures:S,floatVertexTextures:T,maxSamples:C}}function E6(n){const e=this;let t=null,r=0,i=!1,o=!1;const s=new cs,a=new On,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){const p=u.length!==0||d||r!==0||i;return i=d,r=u.length,p},this.beginShadows=function(){o=!0,f(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(u,d){t=f(u,d,0)},this.setState=function(u,d,p){const v=u.clippingPlanes,m=u.clipIntersection,g=u.clipShadows,_=n.get(u);if(!i||v===null||v.length===0||o&&!g)o?f(null):c();else{const y=o?0:r,x=y*4;let S=_.clippingState||null;l.value=S,S=f(v,d,x,p);for(let T=0;T!==x;++T)S[T]=t[T];_.clippingState=S,this.numIntersection=m?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function f(u,d,p,v){const m=u!==null?u.length:0;let g=null;if(m!==0){if(g=l.value,v!==!0||g===null){const _=p+m*4,y=d.matrixWorldInverse;a.getNormalMatrix(y),(g===null||g.length<_)&&(g=new Float32Array(_));for(let x=0,S=p;x!==m;++x,S+=4)s.copy(u[x]).applyMatrix4(y,a),s.normal.toArray(g,S),g[S+3]=s.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=m,e.numIntersection=0,g}}function T6(n){let e=new WeakMap;function t(s,a){return a===wd?s.mapping=Ka:a===vg&&(s.mapping=Ya),s}function r(s){if(s&&s.isTexture&&s.isRenderTargetTexture===!1){const a=s.mapping;if(a===wd||a===vg)if(e.has(s)){const l=e.get(s).texture;return t(l,s.mapping)}else{const l=s.image;if(l&&l.height>0){const c=new U4(l.height/2);return c.fromEquirectangularTexture(n,s),e.set(s,c),s.addEventListener("dispose",i),t(c.texture,s.mapping)}else return null}}return s}function i(s){const a=s.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function o(){e=new WeakMap}return{get:r,dispose:o}}class uh extends n2{constructor(e=-1,t=1,r=1,i=-1,o=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=i,this.near=o,this.far=s,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,r,i,o,s){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=r,this.view.offsetY=i,this.view.width=o,this.view.height=s,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),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let o=r-e,s=r+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,f=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o+=c*this.view.offsetX,s=o+c*this.view.width,a-=f*this.view.offsetY,l=a-f*this.view.height}this.projectionMatrix.makeOrthographic(o,s,a,l,this.near,this.far),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 Ea=4,D_=[.125,.215,.35,.446,.526,.582],hs=20,Up=new uh,I_=new Ye;let zp=null;const us=(1+Math.sqrt(5))/2,la=1/us,k_=[new F(1,1,1),new F(-1,1,1),new F(1,1,-1),new F(-1,1,-1),new F(0,us,la),new F(0,us,-la),new F(la,0,us),new F(-la,0,us),new F(us,la,0),new F(-us,la,0)];class O_{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,r=.1,i=100){zp=this._renderer.getRenderTarget(),this._setSize(256);const o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(e,r,i,o),t>0&&this._blur(o,0,0,t),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=$_(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=N_(),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?x:0,x,x),f.setRenderTarget(i),m&&f.render(v,a),f.render(e,a)}v.geometry.dispose(),v.material.dispose(),f.toneMapping=d,f.autoClear=u,e.background=g}_textureToCubeUV(e,t){const r=this._renderer,i=e.mapping===Ka||e.mapping===Ya;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=$_()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=N_());const o=i?this._cubemapMaterial:this._equirectMaterial,s=new Me(this._lodPlanes[0],o),a=o.uniforms;a.envMap.value=e;const l=this._cubeSize;nf(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(s,Up)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let i=1;ihs&&console.warn(`sigmaRadians, ${o}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${hs}`);const _=[];let y=0;for(let L=0;Lx-Ea?i-x+Ea:0),C=4*(this._cubeSize-S);nf(t,T,C,3*S,2*S),l.setRenderTarget(t),l.render(u,Up)}}function C6(n){const e=[],t=[],r=[];let i=n;const o=n-Ea+1+D_.length;for(let s=0;sn-Ea?l=D_[s-n+Ea-1]:s===0&&(l=0),r.push(l);const c=1/(a-2),f=-c,u=1+c,d=[f,f,u,f,u,u,f,f,u,u,f,u],p=6,v=6,m=3,g=2,_=1,y=new Float32Array(m*v*p),x=new Float32Array(g*v*p),S=new Float32Array(_*v*p);for(let C=0;C2?0:-1,A=[L,E,0,L+2/3,E,0,L+2/3,E+1,0,L,E,0,L+2/3,E+1,0,L,E+1,0];y.set(A,m*v*C),x.set(d,g*v*C);const I=[C,C,C,C,C,C];S.set(I,_*v*C)}const T=new Ht;T.setAttribute("position",new di(y,m)),T.setAttribute("uv",new di(x,g)),T.setAttribute("faceIndex",new di(S,_)),e.push(T),i>Ea&&i--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function F_(n,e,t){const r=new Vo(n,e,t);return r.texture.mapping=sh,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function nf(n,e,t,r,i){n.viewport.set(e,t,r,i),n.scissor.set(e,t,r,i)}function P6(n,e,t){const r=new Float32Array(hs),i=new F(0,1,0);return new gi({name:"SphericalGaussianBlur",defines:{n:hs,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:j0(),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:Io,depthTest:!1,depthWrite:!1})}function N_(){return new gi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:j0(),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:Io,depthTest:!1,depthWrite:!1})}function $_(){return new gi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:j0(),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:Io,depthTest:!1,depthWrite:!1})}function j0(){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 A6(n){let e=new WeakMap,t=null;function r(a){if(a&&a.isTexture){const l=a.mapping,c=l===wd||l===vg,f=l===Ka||l===Ya;if(c||f)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let u=e.get(a);return t===null&&(t=new O_(n)),u=c?t.fromEquirectangular(a,u):t.fromCubemap(a,u),e.set(a,u),u.texture}else{if(e.has(a))return e.get(a).texture;{const u=a.image;if(c&&u&&u.height>0||f&&u&&i(u)){t===null&&(t=new O_(n));const d=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,d),a.addEventListener("dispose",o),d.texture}else return null}}}return a}function i(a){let l=0;const c=6;for(let f=0;fe.maxTextureSize&&(I=Math.ceil(A/e.maxTextureSize),A=e.maxTextureSize);const q=new Float32Array(A*I*4*v),ee=new ZM(q,A,I,v);ee.type=vo,ee.needsUpdate=!0;const H=E*4;for(let N=0;N0)return n;const i=e*t;let o=U_[i];if(o===void 0&&(o=new Float32Array(i),U_[i]=o),e!==0){r.toArray(o,0);for(let s=1,a=0;s!==e;++s)a+=t,n[s].toArray(o,a)}return o}function cn(n,e){if(n.length!==e.length)return!1;for(let t=0,r=n.length;t":" "} ${a}: ${t[s]}`)}return r.join(` `)}function L$(n){switch(n){case Rs:return["Linear","( value )"];case _t:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",n),["Linear","( value )"]}}function j_(n,e,t){const r=n.getShaderParameter(e,35713),i=n.getShaderInfoLog(e).trim();if(r&&i==="")return"";const o=/ERROR: 0:(\d+)/.exec(i);if(o){const s=parseInt(o[1]);return t.toUpperCase()+` `+i+` `+A$(n.getShaderSource(e),s)}else return i}function R$(n,e){const t=L$(e);return"vec4 "+n+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function D$(n,e){let t;switch(e){case D5:t="Linear";break;case I5:t="Reinhard";break;case k5:t="OptimizedCineon";break;case O5:t="ACESFilmic";break;case F5:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function I$(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.tangentSpaceNormalMap||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(Jl).join(` `)}function k$(n){const e=[];for(const t in n){const r=n[t];r!==!1&&e.push("#define "+t+" "+r)}return e.join(` `)}function O$(n,e){const t={},r=n.getProgramParameter(e,35721);for(let i=0;i/gm;function wg(n){return n.replace(F$,N$)}function N$(n,e){const t=nt[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return wg(t)}const $$=/#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 Y_(n){return n.replace($$,U$)}function U$(n,e,t,r){let i="";for(let o=parseInt(e);o0&&(g+=` `),_=[p,v].filter(Jl).join(` `),_.length>0&&(_+=` `)):(g=[q_(t),"#define SHADER_NAME "+t.shaderName,v,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"",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 "+f:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",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.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",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_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",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.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_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(Jl).join(` `),_=[p,q_(t),"#define SHADER_NAME "+t.shaderName,v,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 "+c:"",t.envMap?"#define "+f:"",t.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",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.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",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_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",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!==Hi?"#define TONE_MAPPING":"",t.toneMapping!==Hi?nt.tonemapping_pars_fragment:"",t.toneMapping!==Hi?D$("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",nt.encodings_pars_fragment,R$("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `].filter(Jl).join(` `)),s=wg(s),s=X_(s,t),s=K_(s,t),a=wg(a),a=X_(a,t),a=K_(a,t),s=Y_(s),a=Y_(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(y=`#version 300 es `,g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+g,_=["#define varying in",t.glslVersion===__?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===__?"":"#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(` `)+` `+_);const x=y+g+s,S=y+_+a,T=W_(i,35633,x),C=W_(i,35632,S);if(i.attachShader(m,T),i.attachShader(m,C),t.index0AttributeName!==void 0?i.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(m,0,"position"),i.linkProgram(m),n.debug.checkShaderErrors){const A=i.getProgramInfoLog(m).trim(),I=i.getShaderInfoLog(T).trim(),q=i.getShaderInfoLog(C).trim();let ee=!0,H=!0;if(i.getProgramParameter(m,35714)===!1){ee=!1;const R=j_(i,T,"vertex"),N=j_(i,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(m,35715)+` Program Info Log: `+A+` `+R+` `+N)}else A!==""?console.warn("THREE.WebGLProgram: Program Info Log:",A):(I===""||q==="")&&(H=!1);H&&(this.diagnostics={runnable:ee,programLog:A,vertexShader:{log:I,prefix:g},fragmentShader:{log:q,prefix:_}})}i.deleteShader(T),i.deleteShader(C);let L;this.getUniforms=function(){return L===void 0&&(L=new $f(i,m)),L};let E;return this.getAttributes=function(){return E===void 0&&(E=O$(i,m)),E},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(m),this.program=void 0},this.name=t.shaderName,this.id=P$++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=T,this.fragmentShader=C,this}let j$=0;class X${constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(t),o=this._getShaderStage(r),s=this._getShaderCacheForMaterial(e);return s.has(i)===!1&&(s.add(i),i.usedTimes++),s.has(o)===!1&&(s.add(o),o.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const r of t)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.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 r=t.get(e);return r===void 0&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){const t=this.shaderCache;let r=t.get(e);return r===void 0&&(r=new K$(e),t.set(e,r)),r}}class K${constructor(e){this.id=j$++,this.code=e,this.usedTimes=0}}function Y$(n,e,t,r,i,o,s){const a=new G0,l=new X$,c=[],f=i.isWebGL2,u=i.logarithmicDepthBuffer,d=i.vertexTextures;let p=i.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(E,A,I,q,ee){const H=q.fog,R=ee.geometry,N=E.isMeshStandardMaterial?q.environment:null,Z=(E.isMeshStandardMaterial?t:e).get(E.envMap||N),K=Z&&Z.mapping===sh?Z.image.height:null,B=v[E.type];E.precision!==null&&(p=i.getMaxPrecision(E.precision),p!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",p,"instead."));const $=R.morphAttributes.position||R.morphAttributes.normal||R.morphAttributes.color,W=$!==void 0?$.length:0;let ie=0;R.morphAttributes.position!==void 0&&(ie=1),R.morphAttributes.normal!==void 0&&(ie=2),R.morphAttributes.color!==void 0&&(ie=3);let j,se,ue,Q;if(B){const Ne=oi[B];j=Ne.vertexShader,se=Ne.fragmentShader}else j=E.vertexShader,se=E.fragmentShader,l.update(E),ue=l.getVertexShaderID(E),Q=l.getFragmentShaderID(E);const me=n.getRenderTarget(),pe=E.alphaTest>0,we=E.clearcoat>0,de=E.iridescence>0;return{isWebGL2:f,shaderID:B,shaderName:E.type,vertexShader:j,fragmentShader:se,defines:E.defines,customVertexShaderID:ue,customFragmentShaderID:Q,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:p,instancing:ee.isInstancedMesh===!0,instancingColor:ee.isInstancedMesh===!0&&ee.instanceColor!==null,supportsVertexTextures:d,outputEncoding:me===null?n.outputEncoding:me.isXRRenderTarget===!0?me.texture.encoding:Rs,map:!!E.map,matcap:!!E.matcap,envMap:!!Z,envMapMode:Z&&Z.mapping,envMapCubeUVHeight:K,lightMap:!!E.lightMap,aoMap:!!E.aoMap,emissiveMap:!!E.emissiveMap,bumpMap:!!E.bumpMap,normalMap:!!E.normalMap,objectSpaceNormalMap:E.normalMapType===n4,tangentSpaceNormalMap:E.normalMapType===ah,decodeVideoTexture:!!E.map&&E.map.isVideoTexture===!0&&E.map.encoding===_t,clearcoat:we,clearcoatMap:we&&!!E.clearcoatMap,clearcoatRoughnessMap:we&&!!E.clearcoatRoughnessMap,clearcoatNormalMap:we&&!!E.clearcoatNormalMap,iridescence:de,iridescenceMap:de&&!!E.iridescenceMap,iridescenceThicknessMap:de&&!!E.iridescenceThicknessMap,displacementMap:!!E.displacementMap,roughnessMap:!!E.roughnessMap,metalnessMap:!!E.metalnessMap,specularMap:!!E.specularMap,specularIntensityMap:!!E.specularIntensityMap,specularColorMap:!!E.specularColorMap,opaque:E.transparent===!1&&E.blending===ka,alphaMap:!!E.alphaMap,alphaTest:pe,gradientMap:!!E.gradientMap,sheen:E.sheen>0,sheenColorMap:!!E.sheenColorMap,sheenRoughnessMap:!!E.sheenRoughnessMap,transmission:E.transmission>0,transmissionMap:!!E.transmissionMap,thicknessMap:!!E.thicknessMap,combine:E.combine,vertexTangents:!!E.normalMap&&!!R.attributes.tangent,vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!R.attributes.color&&R.attributes.color.itemSize===4,vertexUvs:!!E.map||!!E.bumpMap||!!E.normalMap||!!E.specularMap||!!E.alphaMap||!!E.emissiveMap||!!E.roughnessMap||!!E.metalnessMap||!!E.clearcoatMap||!!E.clearcoatRoughnessMap||!!E.clearcoatNormalMap||!!E.iridescenceMap||!!E.iridescenceThicknessMap||!!E.displacementMap||!!E.transmissionMap||!!E.thicknessMap||!!E.specularIntensityMap||!!E.specularColorMap||!!E.sheenColorMap||!!E.sheenRoughnessMap,uvsVertexOnly:!(E.map||E.bumpMap||E.normalMap||E.specularMap||E.alphaMap||E.emissiveMap||E.roughnessMap||E.metalnessMap||E.clearcoatNormalMap||E.iridescenceMap||E.iridescenceThicknessMap||E.transmission>0||E.transmissionMap||E.thicknessMap||E.specularIntensityMap||E.specularColorMap||E.sheen>0||E.sheenColorMap||E.sheenRoughnessMap)&&!!E.displacementMap,fog:!!H,useFog:E.fog===!0,fogExp2:H&&H.isFogExp2,flatShading:!!E.flatShading,sizeAttenuation:E.sizeAttenuation,logarithmicDepthBuffer:u,skinning:ee.isSkinnedMesh===!0,morphTargets:R.morphAttributes.position!==void 0,morphNormals:R.morphAttributes.normal!==void 0,morphColors:R.morphAttributes.color!==void 0,morphTargetsCount:W,morphTextureStride:ie,numDirLights:A.directional.length,numPointLights:A.point.length,numSpotLights:A.spot.length,numSpotLightMaps:A.spotLightMap.length,numRectAreaLights:A.rectArea.length,numHemiLights:A.hemi.length,numDirLightShadows:A.directionalShadowMap.length,numPointLightShadows:A.pointShadowMap.length,numSpotLightShadows:A.spotShadowMap.length,numSpotLightShadowsWithMaps:A.numSpotLightShadowsWithMaps,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:E.dithering,shadowMapEnabled:n.shadowMap.enabled&&I.length>0,shadowMapType:n.shadowMap.type,toneMapping:E.toneMapped?n.toneMapping:Hi,useLegacyLights:n.useLegacyLights,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===$i,flipSided:E.side===dr,useDepthPacking:!!E.depthPacking,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionDerivatives:E.extensions&&E.extensions.derivatives,extensionFragDepth:E.extensions&&E.extensions.fragDepth,extensionDrawBuffers:E.extensions&&E.extensions.drawBuffers,extensionShaderTextureLOD:E.extensions&&E.extensions.shaderTextureLOD,rendererExtensionFragDepth:f||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:f||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:f||r.has("EXT_shader_texture_lod"),customProgramCacheKey:E.customProgramCacheKey()}}function g(E){const A=[];if(E.shaderID?A.push(E.shaderID):(A.push(E.customVertexShaderID),A.push(E.customFragmentShaderID)),E.defines!==void 0)for(const I in E.defines)A.push(I),A.push(E.defines[I]);return E.isRawShaderMaterial===!1&&(_(A,E),y(A,E),A.push(n.outputEncoding)),A.push(E.customProgramCacheKey),A.join()}function _(E,A){E.push(A.precision),E.push(A.outputEncoding),E.push(A.envMapMode),E.push(A.envMapCubeUVHeight),E.push(A.combine),E.push(A.vertexUvs),E.push(A.fogExp2),E.push(A.sizeAttenuation),E.push(A.morphTargetsCount),E.push(A.morphAttributeCount),E.push(A.numDirLights),E.push(A.numPointLights),E.push(A.numSpotLights),E.push(A.numSpotLightMaps),E.push(A.numHemiLights),E.push(A.numRectAreaLights),E.push(A.numDirLightShadows),E.push(A.numPointLightShadows),E.push(A.numSpotLightShadows),E.push(A.numSpotLightShadowsWithMaps),E.push(A.shadowMapType),E.push(A.toneMapping),E.push(A.numClippingPlanes),E.push(A.numClipIntersection),E.push(A.depthPacking)}function y(E,A){a.disableAll(),A.isWebGL2&&a.enable(0),A.supportsVertexTextures&&a.enable(1),A.instancing&&a.enable(2),A.instancingColor&&a.enable(3),A.map&&a.enable(4),A.matcap&&a.enable(5),A.envMap&&a.enable(6),A.lightMap&&a.enable(7),A.aoMap&&a.enable(8),A.emissiveMap&&a.enable(9),A.bumpMap&&a.enable(10),A.normalMap&&a.enable(11),A.objectSpaceNormalMap&&a.enable(12),A.tangentSpaceNormalMap&&a.enable(13),A.clearcoat&&a.enable(14),A.clearcoatMap&&a.enable(15),A.clearcoatRoughnessMap&&a.enable(16),A.clearcoatNormalMap&&a.enable(17),A.iridescence&&a.enable(18),A.iridescenceMap&&a.enable(19),A.iridescenceThicknessMap&&a.enable(20),A.displacementMap&&a.enable(21),A.specularMap&&a.enable(22),A.roughnessMap&&a.enable(23),A.metalnessMap&&a.enable(24),A.gradientMap&&a.enable(25),A.alphaMap&&a.enable(26),A.alphaTest&&a.enable(27),A.vertexColors&&a.enable(28),A.vertexAlphas&&a.enable(29),A.vertexUvs&&a.enable(30),A.vertexTangents&&a.enable(31),A.uvsVertexOnly&&a.enable(32),E.push(a.mask),a.disableAll(),A.fog&&a.enable(0),A.useFog&&a.enable(1),A.flatShading&&a.enable(2),A.logarithmicDepthBuffer&&a.enable(3),A.skinning&&a.enable(4),A.morphTargets&&a.enable(5),A.morphNormals&&a.enable(6),A.morphColors&&a.enable(7),A.premultipliedAlpha&&a.enable(8),A.shadowMapEnabled&&a.enable(9),A.useLegacyLights&&a.enable(10),A.doubleSided&&a.enable(11),A.flipSided&&a.enable(12),A.useDepthPacking&&a.enable(13),A.dithering&&a.enable(14),A.specularIntensityMap&&a.enable(15),A.specularColorMap&&a.enable(16),A.transmission&&a.enable(17),A.transmissionMap&&a.enable(18),A.thicknessMap&&a.enable(19),A.sheen&&a.enable(20),A.sheenColorMap&&a.enable(21),A.sheenRoughnessMap&&a.enable(22),A.decodeVideoTexture&&a.enable(23),A.opaque&&a.enable(24),E.push(a.mask)}function x(E){const A=v[E.type];let I;if(A){const q=oi[A];I=t2.clone(q.uniforms)}else I=E.uniforms;return I}function S(E,A){let I;for(let q=0,ee=c.length;q0?r.push(_):p.transparent===!0?i.push(_):t.push(_)}function l(u,d,p,v,m,g){const _=s(u,d,p,v,m,g);p.transmission>0?r.unshift(_):p.transparent===!0?i.unshift(_):t.unshift(_)}function c(u,d){t.length>1&&t.sort(u||Z$),r.length>1&&r.sort(d||Z_),i.length>1&&i.sort(d||Z_)}function f(){for(let u=e,d=n.length;u=o.length?(s=new Q_,o.push(s)):s=o[i],s}function t(){n=new WeakMap}return{get:e,dispose:t}}function J$(){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 F,color:new Ye};break;case"SpotLight":t={position:new F,direction:new F,color:new Ye,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Ye,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Ye,groundColor:new Ye};break;case"RectAreaLight":t={color:new Ye,position:new F,halfWidth:new F,halfHeight:new F};break}return n[e.id]=t,t}}}function e8(){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 We};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new We};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new We,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let t8=0;function n8(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function r8(n,e){const t=new J$,r=e8(),i={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 f=0;f<9;f++)i.probe.push(new F);const o=new F,s=new Be,a=new Be;function l(f,u){let d=0,p=0,v=0;for(let q=0;q<9;q++)i.probe[q].set(0,0,0);let m=0,g=0,_=0,y=0,x=0,S=0,T=0,C=0,L=0,E=0;f.sort(n8);const A=u===!0?Math.PI:1;for(let q=0,ee=f.length;q0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Te.LTC_FLOAT_1,i.rectAreaLTC2=Te.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=Te.LTC_HALF_1,i.rectAreaLTC2=Te.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=d,i.ambient[1]=p,i.ambient[2]=v;const I=i.hash;(I.directionalLength!==m||I.pointLength!==g||I.spotLength!==_||I.rectAreaLength!==y||I.hemiLength!==x||I.numDirectionalShadows!==S||I.numPointShadows!==T||I.numSpotShadows!==C||I.numSpotMaps!==L)&&(i.directional.length=m,i.spot.length=_,i.rectArea.length=y,i.point.length=g,i.hemi.length=x,i.directionalShadow.length=S,i.directionalShadowMap.length=S,i.pointShadow.length=T,i.pointShadowMap.length=T,i.spotShadow.length=C,i.spotShadowMap.length=C,i.directionalShadowMatrix.length=S,i.pointShadowMatrix.length=T,i.spotLightMatrix.length=C+L-E,i.spotLightMap.length=L,i.numSpotLightShadowsWithMaps=E,I.directionalLength=m,I.pointLength=g,I.spotLength=_,I.rectAreaLength=y,I.hemiLength=x,I.numDirectionalShadows=S,I.numPointShadows=T,I.numSpotShadows=C,I.numSpotMaps=L,i.version=t8++)}function c(f,u){let d=0,p=0,v=0,m=0,g=0;const _=u.matrixWorldInverse;for(let y=0,x=f.length;y=a.length?(l=new J_(n,e),a.push(l)):l=a[s],l}function i(){t=new WeakMap}return{get:r,dispose:i}}class Sg extends Kr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=e4,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 o8 extends Kr{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new F,this.nearDistance=1,this.farDistance=1e3,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.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const s8=`void main() { gl_Position = vec4( position, 1.0 ); }`,a8=`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 l8(n,e,t){let r=new Hc;const i=new We,o=new We,s=new dt,a=new Sg({depthPacking:t4}),l=new o8,c={},f=t.maxTextureSize,u={[Bo]:dr,[dr]:Bo,[$i]:$i},d=new gi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new We},radius:{value:4}},vertexShader:s8,fragmentShader:a8}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const v=new Ht;v.setAttribute("position",new di(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new Me(v,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=zM,this.render=function(S,T,C){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||S.length===0)return;const L=n.getRenderTarget(),E=n.getActiveCubeFace(),A=n.getActiveMipmapLevel(),I=n.state;I.setBlending(Io),I.buffers.color.setClear(1,1,1,1),I.buffers.depth.setTest(!0),I.setScissorTest(!1);for(let q=0,ee=S.length;qf||i.y>f)&&(i.x>f&&(o.x=Math.floor(f/N.x),i.x=o.x*N.x,R.mapSize.x=o.x),i.y>f&&(o.y=Math.floor(f/N.y),i.y=o.y*N.y,R.mapSize.y=o.y)),R.map===null){const K=this.type!==Zl?{minFilter:bn,magFilter:bn}:{};R.map=new Vo(i.x,i.y,K),R.map.texture.name=H.name+".shadowMap",R.camera.updateProjectionMatrix()}n.setRenderTarget(R.map),n.clear();const Z=R.getViewportCount();for(let K=0;K0||T.map&&T.alphaTest>0){const ee=I.uuid,H=T.uuid;let R=c[ee];R===void 0&&(R={},c[ee]=R);let N=R[H];N===void 0&&(N=I.clone(),R[H]=N),I=N}return I.visible=T.visible,I.wireframe=T.wireframe,A===Zl?I.side=T.shadowSide!==null?T.shadowSide:T.side:I.side=T.shadowSide!==null?T.shadowSide:u[T.side],I.alphaMap=T.alphaMap,I.alphaTest=T.alphaTest,I.map=T.map,I.clipShadows=T.clipShadows,I.clippingPlanes=T.clippingPlanes,I.clipIntersection=T.clipIntersection,I.displacementMap=T.displacementMap,I.displacementScale=T.displacementScale,I.displacementBias=T.displacementBias,I.wireframeLinewidth=T.wireframeLinewidth,I.linewidth=T.linewidth,C.isPointLight===!0&&I.isMeshDistanceMaterial===!0&&(I.referencePosition.setFromMatrixPosition(C.matrixWorld),I.nearDistance=L,I.farDistance=E),I}function x(S,T,C,L,E){if(S.visible===!1)return;if(S.layers.test(T.layers)&&(S.isMesh||S.isLine||S.isPoints)&&(S.castShadow||S.receiveShadow&&E===Zl)&&(!S.frustumCulled||r.intersectsObject(S))){S.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,S.matrixWorld);const q=e.update(S),ee=S.material;if(Array.isArray(ee)){const H=q.groups;for(let R=0,N=H.length;R=1):B.indexOf("OpenGL ES")!==-1&&(K=parseFloat(/^OpenGL ES (\d)/.exec(B)[1]),Z=K>=2);let $=null,W={};const ie=n.getParameter(3088),j=n.getParameter(2978),se=new dt().fromArray(ie),ue=new dt().fromArray(j);function Q(Y,le,ve){const Re=new Uint8Array(4),ke=n.createTexture();n.bindTexture(Y,ke),n.texParameteri(Y,10241,9728),n.texParameteri(Y,10240,9728);for(let wt=0;wt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),v=new WeakMap;let m;const g=new WeakMap;let _=!1;try{_=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(U,D){return _?new OffscreenCanvas(U,D):Vc("canvas")}function x(U,D,ae,xe){let _e=1;if((U.width>xe||U.height>xe)&&(_e=xe/Math.max(U.width,U.height)),_e<1||D===!0)if(typeof HTMLImageElement<"u"&&U instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&U instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&U instanceof ImageBitmap){const Ce=D?XM:Math.floor,Ue=Ce(_e*U.width),G=Ce(_e*U.height);m===void 0&&(m=y(Ue,G));const te=ae?y(Ue,G):m;return te.width=Ue,te.height=G,te.getContext("2d").drawImage(U,0,0,Ue,G),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+U.width+"x"+U.height+") to ("+Ue+"x"+G+")."),te}else return"data"in U&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+U.width+"x"+U.height+")."),U;return U}function S(U){return xg(U.width)&&xg(U.height)}function T(U){return a?!1:U.wrapS!==cr||U.wrapT!==cr||U.minFilter!==bn&&U.minFilter!==br}function C(U,D){return U.generateMipmaps&&D&&U.minFilter!==bn&&U.minFilter!==br}function L(U){n.generateMipmap(U)}function E(U,D,ae,xe,_e=!1){if(a===!1)return D;if(U!==null){if(n[U]!==void 0)return n[U];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+U+"'")}let Ce=D;return D===6403&&(ae===5126&&(Ce=33326),ae===5131&&(Ce=33325),ae===5121&&(Ce=33321)),D===33319&&(ae===5126&&(Ce=33328),ae===5131&&(Ce=33327),ae===5121&&(Ce=33323)),D===6408&&(ae===5126&&(Ce=34836),ae===5131&&(Ce=34842),ae===5121&&(Ce=xe===_t&&_e===!1?35907:32856),ae===32819&&(Ce=32854),ae===32820&&(Ce=32855)),(Ce===33325||Ce===33326||Ce===33327||Ce===33328||Ce===34842||Ce===34836)&&e.get("EXT_color_buffer_float"),Ce}function A(U,D,ae){return C(U,ae)===!0||U.isFramebufferTexture&&U.minFilter!==bn&&U.minFilter!==br?Math.log2(Math.max(D.width,D.height))+1:U.mipmaps!==void 0&&U.mipmaps.length>0?U.mipmaps.length:U.isCompressedTexture&&Array.isArray(U.image)?D.mipmaps.length:1}function I(U){return U===bn||U===W1||U===dp?9728:9729}function q(U){const D=U.target;D.removeEventListener("dispose",q),H(D),D.isVideoTexture&&v.delete(D)}function ee(U){const D=U.target;D.removeEventListener("dispose",ee),N(D)}function H(U){const D=r.get(U);if(D.__webglInit===void 0)return;const ae=U.source,xe=g.get(ae);if(xe){const _e=xe[D.__cacheKey];_e.usedTimes--,_e.usedTimes===0&&R(U),Object.keys(xe).length===0&&g.delete(ae)}r.remove(U)}function R(U){const D=r.get(U);n.deleteTexture(D.__webglTexture);const ae=U.source,xe=g.get(ae);delete xe[D.__cacheKey],s.memory.textures--}function N(U){const D=U.texture,ae=r.get(U),xe=r.get(D);if(xe.__webglTexture!==void 0&&(n.deleteTexture(xe.__webglTexture),s.memory.textures--),U.depthTexture&&U.depthTexture.dispose(),U.isWebGLCubeRenderTarget)for(let _e=0;_e<6;_e++)n.deleteFramebuffer(ae.__webglFramebuffer[_e]),ae.__webglDepthbuffer&&n.deleteRenderbuffer(ae.__webglDepthbuffer[_e]);else{if(n.deleteFramebuffer(ae.__webglFramebuffer),ae.__webglDepthbuffer&&n.deleteRenderbuffer(ae.__webglDepthbuffer),ae.__webglMultisampledFramebuffer&&n.deleteFramebuffer(ae.__webglMultisampledFramebuffer),ae.__webglColorRenderbuffer)for(let _e=0;_e=l&&console.warn("THREE.WebGLTextures: Trying to use "+U+" texture units while this GPU supports only "+l),Z+=1,U}function $(U){const D=[];return D.push(U.wrapS),D.push(U.wrapT),D.push(U.wrapR||0),D.push(U.magFilter),D.push(U.minFilter),D.push(U.anisotropy),D.push(U.internalFormat),D.push(U.format),D.push(U.type),D.push(U.generateMipmaps),D.push(U.premultiplyAlpha),D.push(U.flipY),D.push(U.unpackAlignment),D.push(U.encoding),D.join()}function W(U,D){const ae=r.get(U);if(U.isVideoTexture&&jt(U),U.isRenderTargetTexture===!1&&U.version>0&&ae.__version!==U.version){const xe=U.image;if(xe===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(xe.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{we(ae,U,D);return}}t.bindTexture(3553,ae.__webglTexture,33984+D)}function ie(U,D){const ae=r.get(U);if(U.version>0&&ae.__version!==U.version){we(ae,U,D);return}t.bindTexture(35866,ae.__webglTexture,33984+D)}function j(U,D){const ae=r.get(U);if(U.version>0&&ae.__version!==U.version){we(ae,U,D);return}t.bindTexture(32879,ae.__webglTexture,33984+D)}function se(U,D){const ae=r.get(U);if(U.version>0&&ae.__version!==U.version){de(ae,U,D);return}t.bindTexture(34067,ae.__webglTexture,33984+D)}const ue={[Nc]:10497,[cr]:33071,[yg]:33648},Q={[bn]:9728,[W1]:9984,[dp]:9986,[br]:9729,[N5]:9985,[$c]:9987};function me(U,D,ae){if(ae?(n.texParameteri(U,10242,ue[D.wrapS]),n.texParameteri(U,10243,ue[D.wrapT]),(U===32879||U===35866)&&n.texParameteri(U,32882,ue[D.wrapR]),n.texParameteri(U,10240,Q[D.magFilter]),n.texParameteri(U,10241,Q[D.minFilter])):(n.texParameteri(U,10242,33071),n.texParameteri(U,10243,33071),(U===32879||U===35866)&&n.texParameteri(U,32882,33071),(D.wrapS!==cr||D.wrapT!==cr)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(U,10240,I(D.magFilter)),n.texParameteri(U,10241,I(D.minFilter)),D.minFilter!==bn&&D.minFilter!==br&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const xe=e.get("EXT_texture_filter_anisotropic");if(D.magFilter===bn||D.minFilter!==dp&&D.minFilter!==$c||D.type===vo&&e.has("OES_texture_float_linear")===!1||a===!1&&D.type===Uc&&e.has("OES_texture_half_float_linear")===!1)return;(D.anisotropy>1||r.get(D).__currentAnisotropy)&&(n.texParameterf(U,xe.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(D.anisotropy,i.getMaxAnisotropy())),r.get(D).__currentAnisotropy=D.anisotropy)}}function pe(U,D){let ae=!1;U.__webglInit===void 0&&(U.__webglInit=!0,D.addEventListener("dispose",q));const xe=D.source;let _e=g.get(xe);_e===void 0&&(_e={},g.set(xe,_e));const Ce=$(D);if(Ce!==U.__cacheKey){_e[Ce]===void 0&&(_e[Ce]={texture:n.createTexture(),usedTimes:0},s.memory.textures++,ae=!0),_e[Ce].usedTimes++;const Ue=_e[U.__cacheKey];Ue!==void 0&&(_e[U.__cacheKey].usedTimes--,Ue.usedTimes===0&&R(D)),U.__cacheKey=Ce,U.__webglTexture=_e[Ce].texture}return ae}function we(U,D,ae){let xe=3553;(D.isDataArrayTexture||D.isCompressedArrayTexture)&&(xe=35866),D.isData3DTexture&&(xe=32879);const _e=pe(U,D),Ce=D.source;t.bindTexture(xe,U.__webglTexture,33984+ae);const Ue=r.get(Ce);if(Ce.version!==Ue.__version||_e===!0){t.activeTexture(33984+ae),n.pixelStorei(37440,D.flipY),n.pixelStorei(37441,D.premultiplyAlpha),n.pixelStorei(3317,D.unpackAlignment),n.pixelStorei(37443,0);const G=T(D)&&S(D.image)===!1;let te=x(D.image,G,!1,f);te=Kt(D,te);const Le=S(te)||a,Ee=o.convert(D.format,D.encoding);let Ie=o.convert(D.type),Oe=E(D.internalFormat,Ee,Ie,D.encoding,D.isVideoTexture);me(xe,D,Le);let Fe;const st=D.mipmaps,ct=a&&D.isVideoTexture!==!0,pt=Ue.__version===void 0||_e===!0,Y=A(D,te,Le);if(D.isDepthTexture)Oe=6402,a?D.type===vo?Oe=36012:D.type===xs?Oe=33190:D.type===Oa?Oe=35056:Oe=33189:D.type===vo&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),D.format===bs&&Oe===6402&&D.type!==GM&&D.type!==xs&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),D.type=xs,Ie=o.convert(D.type)),D.format===qa&&Oe===6402&&(Oe=34041,D.type!==Oa&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),D.type=Oa,Ie=o.convert(D.type))),pt&&(ct?t.texStorage2D(3553,1,Oe,te.width,te.height):t.texImage2D(3553,0,Oe,te.width,te.height,0,Ee,Ie,null));else if(D.isDataTexture)if(st.length>0&&Le){ct&&pt&&t.texStorage2D(3553,Y,Oe,st[0].width,st[0].height);for(let le=0,ve=st.length;le>=1,ve>>=1}}else if(st.length>0&&Le){ct&&pt&&t.texStorage2D(3553,Y,Oe,st[0].width,st[0].height);for(let le=0,ve=st.length;le0&&pt++,t.texStorage2D(34067,pt,Fe,te[0].width,te[0].height));for(let le=0;le<6;le++)if(G){st?t.texSubImage2D(34069+le,0,0,0,te[le].width,te[le].height,Ie,Oe,te[le].data):t.texImage2D(34069+le,0,Fe,te[le].width,te[le].height,0,Ie,Oe,te[le].data);for(let ve=0;ve=34069&&_e<=34074)&&n.framebufferTexture2D(36160,xe,_e,r.get(ae).__webglTexture,0),t.bindFramebuffer(36160,null)}function Ne(U,D,ae){if(n.bindRenderbuffer(36161,U),D.depthBuffer&&!D.stencilBuffer){let xe=33189;if(ae||ft(D)){const _e=D.depthTexture;_e&&_e.isDepthTexture&&(_e.type===vo?xe=36012:_e.type===xs&&(xe=33190));const Ce=yt(D);ft(D)?d.renderbufferStorageMultisampleEXT(36161,Ce,xe,D.width,D.height):n.renderbufferStorageMultisample(36161,Ce,xe,D.width,D.height)}else n.renderbufferStorage(36161,xe,D.width,D.height);n.framebufferRenderbuffer(36160,36096,36161,U)}else if(D.depthBuffer&&D.stencilBuffer){const xe=yt(D);ae&&ft(D)===!1?n.renderbufferStorageMultisample(36161,xe,35056,D.width,D.height):ft(D)?d.renderbufferStorageMultisampleEXT(36161,xe,35056,D.width,D.height):n.renderbufferStorage(36161,34041,D.width,D.height),n.framebufferRenderbuffer(36160,33306,36161,U)}else{const xe=D.isWebGLMultipleRenderTargets===!0?D.texture:[D.texture];for(let _e=0;_e0&&ft(U)===!1){const G=Ce?D:[D];ae.__webglMultisampledFramebuffer=n.createFramebuffer(),ae.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,ae.__webglMultisampledFramebuffer);for(let te=0;te0&&ft(U)===!1){const D=U.isWebGLMultipleRenderTargets?U.texture:[U.texture],ae=U.width,xe=U.height;let _e=16384;const Ce=[],Ue=U.stencilBuffer?33306:36096,G=r.get(U),te=U.isWebGLMultipleRenderTargets===!0;if(te)for(let Le=0;Le0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&D.__useRenderToTexture!==!1}function jt(U){const D=s.render.frame;v.get(U)!==D&&(v.set(U,D),U.update())}function Kt(U,D){const ae=U.encoding,xe=U.format,_e=U.type;return U.isCompressedTexture===!0||U.isVideoTexture===!0||U.format===_g||ae!==Rs&&(ae===_t?a===!1?e.has("EXT_sRGB")===!0&&xe===Mr?(U.format=_g,U.minFilter=br,U.generateMipmaps=!1):D=YM.sRGBToLinear(D):(xe!==Mr||_e!==Ls)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",ae)),D}this.allocateTextureUnit=B,this.resetTextureUnits=K,this.setTexture2D=W,this.setTexture2DArray=ie,this.setTexture3D=j,this.setTextureCube=se,this.rebindTextures=et,this.setupRenderTarget=nn,this.updateRenderTargetMipmap=Wt,this.updateMultisampleRenderTarget=zt,this.setupDepthRenderbuffer=$e,this.setupFrameBufferTexture=Pe,this.useMultisampledRTT=ft}function f8(n,e,t){const r=t.isWebGL2;function i(o,s=null){let a;if(o===Ls)return 5121;if(o===B5)return 32819;if(o===V5)return 32820;if(o===$5)return 5120;if(o===U5)return 5122;if(o===GM)return 5123;if(o===z5)return 5124;if(o===xs)return 5125;if(o===vo)return 5126;if(o===Uc)return r?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(o===H5)return 6406;if(o===Mr)return 6408;if(o===G5)return 6409;if(o===W5)return 6410;if(o===bs)return 6402;if(o===qa)return 34041;if(o===_g)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(o===j5)return 6403;if(o===X5)return 36244;if(o===K5)return 33319;if(o===Y5)return 33320;if(o===q5)return 36249;if(o===hp||o===pp||o===mp||o===gp)if(s===_t)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(o===hp)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(o===pp)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(o===mp)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(o===gp)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(o===hp)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(o===pp)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(o===mp)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(o===gp)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(o===j1||o===X1||o===K1||o===Y1)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(o===j1)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(o===X1)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(o===K1)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(o===Y1)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(o===Z5)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(o===q1||o===Z1)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(o===q1)return s===_t?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(o===Z1)return s===_t?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(o===Q1||o===J1||o===e_||o===t_||o===n_||o===r_||o===i_||o===o_||o===s_||o===a_||o===l_||o===c_||o===u_||o===f_)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(o===Q1)return s===_t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(o===J1)return s===_t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(o===e_)return s===_t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(o===t_)return s===_t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(o===n_)return s===_t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(o===r_)return s===_t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(o===i_)return s===_t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(o===o_)return s===_t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(o===s_)return s===_t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(o===a_)return s===_t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(o===l_)return s===_t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(o===c_)return s===_t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(o===u_)return s===_t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(o===f_)return s===_t?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(o===vp)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(o===vp)return s===_t?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(o===Q5||o===d_||o===h_||o===p_)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(o===vp)return a.COMPRESSED_RED_RGTC1_EXT;if(o===d_)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(o===h_)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(o===p_)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return o===Oa?r?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[o]!==void 0?n[o]:null}return{convert:i}}class d8 extends Bn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class _o extends bt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const h8={type:"move"};class Vp{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new _o,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 _o,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new F,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new F),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new _o,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new F,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new F),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 r of e.hand.values())this._getHandJoint(t,r)}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,r){let i=null,o=null,s=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){s=!0;for(const m of e.hand.values()){const g=t.getJointPose(m,r),_=this._getHandJoint(c,m);g!==null&&(_.matrix.fromArray(g.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.jointRadius=g.radius),_.visible=g!==null}const f=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],d=f.position.distanceTo(u.position),p=.02,v=.005;c.inputState.pinching&&d>p+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=p-v&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(o=t.getPose(e.gripSpace,r),o!==null&&(l.matrix.fromArray(o.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),o.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(o.linearVelocity)):l.hasLinearVelocity=!1,o.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(o.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,r),i===null&&o!==null&&(i=o),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(h8)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=o!==null),c!==null&&(c.visible=s!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const r=new _o;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}class p8 extends Tn{constructor(e,t,r,i,o,s,a,l,c,f){if(f=f!==void 0?f:bs,f!==bs&&f!==qa)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&f===bs&&(r=xs),r===void 0&&f===qa&&(r=Oa),super(null,i,o,s,a,l,f,r,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:bn,this.minFilter=l!==void 0?l:bn,this.flipY=!1,this.generateMipmaps=!1}}class m8 extends Fs{constructor(e,t){super();const r=this;let i=null,o=1,s=null,a="local-floor",l=1,c=null,f=null,u=null,d=null,p=null,v=null;const m=t.getContextAttributes();let g=null,_=null;const y=[],x=[],S=new Set,T=new Map,C=new Bn;C.layers.enable(1),C.viewport=new dt;const L=new Bn;L.layers.enable(2),L.viewport=new dt;const E=[C,L],A=new d8;A.layers.enable(1),A.layers.enable(2);let I=null,q=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(j){let se=y[j];return se===void 0&&(se=new Vp,y[j]=se),se.getTargetRaySpace()},this.getControllerGrip=function(j){let se=y[j];return se===void 0&&(se=new Vp,y[j]=se),se.getGripSpace()},this.getHand=function(j){let se=y[j];return se===void 0&&(se=new Vp,y[j]=se),se.getHandSpace()};function ee(j){const se=x.indexOf(j.inputSource);if(se===-1)return;const ue=y[se];ue!==void 0&&ue.dispatchEvent({type:j.type,data:j.inputSource})}function H(){i.removeEventListener("select",ee),i.removeEventListener("selectstart",ee),i.removeEventListener("selectend",ee),i.removeEventListener("squeeze",ee),i.removeEventListener("squeezestart",ee),i.removeEventListener("squeezeend",ee),i.removeEventListener("end",H),i.removeEventListener("inputsourceschange",R);for(let j=0;j=0&&(x[Q]=null,y[Q].disconnect(ue))}for(let se=0;se=x.length){x.push(ue),Q=pe;break}else if(x[pe]===null){x[pe]=ue,Q=pe;break}if(Q===-1)break}const me=y[Q];me&&me.connect(ue)}}const N=new F,Z=new F;function K(j,se,ue){N.setFromMatrixPosition(se.matrixWorld),Z.setFromMatrixPosition(ue.matrixWorld);const Q=N.distanceTo(Z),me=se.projectionMatrix.elements,pe=ue.projectionMatrix.elements,we=me[14]/(me[10]-1),de=me[14]/(me[10]+1),Pe=(me[9]+1)/me[5],Ne=(me[9]-1)/me[5],He=(me[8]-1)/me[0],$e=(pe[8]+1)/pe[0],et=we*He,nn=we*$e,Wt=Q/(-He+$e),zt=Wt*-He;se.matrixWorld.decompose(j.position,j.quaternion,j.scale),j.translateX(zt),j.translateZ(Wt),j.matrixWorld.compose(j.position,j.quaternion,j.scale),j.matrixWorldInverse.copy(j.matrixWorld).invert();const yt=we+Wt,ft=de+Wt,jt=et-zt,Kt=nn+(Q-zt),U=Pe*de/ft*yt,D=Ne*de/ft*yt;j.projectionMatrix.makePerspective(jt,Kt,U,D,yt,ft)}function B(j,se){se===null?j.matrixWorld.copy(j.matrix):j.matrixWorld.multiplyMatrices(se.matrixWorld,j.matrix),j.matrixWorldInverse.copy(j.matrixWorld).invert()}this.updateCamera=function(j){if(i===null)return;A.near=L.near=C.near=j.near,A.far=L.far=C.far=j.far,(I!==A.near||q!==A.far)&&(i.updateRenderState({depthNear:A.near,depthFar:A.far}),I=A.near,q=A.far);const se=j.parent,ue=A.cameras;B(A,se);for(let me=0;meme&&(T.set(Q,Q.lastChangedTime),r.dispatchEvent({type:"planechanged",data:Q}))}}v=null}const ie=new i2;ie.setAnimationLoop(W),this.setAnimationLoop=function(j){$=j},this.dispose=function(){}}}function g8(n,e){function t(m,g){g.color.getRGB(m.fogColor.value,e2(n)),g.isFog?(m.fogNear.value=g.near,m.fogFar.value=g.far):g.isFogExp2&&(m.fogDensity.value=g.density)}function r(m,g,_,y,x){g.isMeshBasicMaterial||g.isMeshLambertMaterial?i(m,g):g.isMeshToonMaterial?(i(m,g),f(m,g)):g.isMeshPhongMaterial?(i(m,g),c(m,g)):g.isMeshStandardMaterial?(i(m,g),u(m,g),g.isMeshPhysicalMaterial&&d(m,g,x)):g.isMeshMatcapMaterial?(i(m,g),p(m,g)):g.isMeshDepthMaterial?i(m,g):g.isMeshDistanceMaterial?(i(m,g),v(m,g)):g.isMeshNormalMaterial?i(m,g):g.isLineBasicMaterial?(o(m,g),g.isLineDashedMaterial&&s(m,g)):g.isPointsMaterial?a(m,g,_,y):g.isSpriteMaterial?l(m,g):g.isShadowMaterial?(m.color.value.copy(g.color),m.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function i(m,g){m.opacity.value=g.opacity,g.color&&m.diffuse.value.copy(g.color),g.emissive&&m.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(m.map.value=g.map),g.alphaMap&&(m.alphaMap.value=g.alphaMap),g.bumpMap&&(m.bumpMap.value=g.bumpMap,m.bumpScale.value=g.bumpScale,g.side===dr&&(m.bumpScale.value*=-1)),g.displacementMap&&(m.displacementMap.value=g.displacementMap,m.displacementScale.value=g.displacementScale,m.displacementBias.value=g.displacementBias),g.emissiveMap&&(m.emissiveMap.value=g.emissiveMap),g.normalMap&&(m.normalMap.value=g.normalMap,m.normalScale.value.copy(g.normalScale),g.side===dr&&m.normalScale.value.negate()),g.specularMap&&(m.specularMap.value=g.specularMap),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);const _=e.get(g).envMap;if(_&&(m.envMap.value=_,m.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=g.reflectivity,m.ior.value=g.ior,m.refractionRatio.value=g.refractionRatio),g.lightMap){m.lightMap.value=g.lightMap;const S=n.useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=g.lightMapIntensity*S}g.aoMap&&(m.aoMap.value=g.aoMap,m.aoMapIntensity.value=g.aoMapIntensity);let y;g.map?y=g.map:g.specularMap?y=g.specularMap:g.displacementMap?y=g.displacementMap:g.normalMap?y=g.normalMap:g.bumpMap?y=g.bumpMap:g.roughnessMap?y=g.roughnessMap:g.metalnessMap?y=g.metalnessMap:g.alphaMap?y=g.alphaMap:g.emissiveMap?y=g.emissiveMap:g.clearcoatMap?y=g.clearcoatMap:g.clearcoatNormalMap?y=g.clearcoatNormalMap:g.clearcoatRoughnessMap?y=g.clearcoatRoughnessMap:g.iridescenceMap?y=g.iridescenceMap:g.iridescenceThicknessMap?y=g.iridescenceThicknessMap:g.specularIntensityMap?y=g.specularIntensityMap:g.specularColorMap?y=g.specularColorMap:g.transmissionMap?y=g.transmissionMap:g.thicknessMap?y=g.thicknessMap:g.sheenColorMap?y=g.sheenColorMap:g.sheenRoughnessMap&&(y=g.sheenRoughnessMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),m.uvTransform.value.copy(y.matrix));let x;g.aoMap?x=g.aoMap:g.lightMap&&(x=g.lightMap),x!==void 0&&(x.isWebGLRenderTarget&&(x=x.texture),x.matrixAutoUpdate===!0&&x.updateMatrix(),m.uv2Transform.value.copy(x.matrix))}function o(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity}function s(m,g){m.dashSize.value=g.dashSize,m.totalSize.value=g.dashSize+g.gapSize,m.scale.value=g.scale}function a(m,g,_,y){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.size.value=g.size*_,m.scale.value=y*.5,g.map&&(m.map.value=g.map),g.alphaMap&&(m.alphaMap.value=g.alphaMap),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);let x;g.map?x=g.map:g.alphaMap&&(x=g.alphaMap),x!==void 0&&(x.matrixAutoUpdate===!0&&x.updateMatrix(),m.uvTransform.value.copy(x.matrix))}function l(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.rotation.value=g.rotation,g.map&&(m.map.value=g.map),g.alphaMap&&(m.alphaMap.value=g.alphaMap),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);let _;g.map?_=g.map:g.alphaMap&&(_=g.alphaMap),_!==void 0&&(_.matrixAutoUpdate===!0&&_.updateMatrix(),m.uvTransform.value.copy(_.matrix))}function c(m,g){m.specular.value.copy(g.specular),m.shininess.value=Math.max(g.shininess,1e-4)}function f(m,g){g.gradientMap&&(m.gradientMap.value=g.gradientMap)}function u(m,g){m.roughness.value=g.roughness,m.metalness.value=g.metalness,g.roughnessMap&&(m.roughnessMap.value=g.roughnessMap),g.metalnessMap&&(m.metalnessMap.value=g.metalnessMap),e.get(g).envMap&&(m.envMapIntensity.value=g.envMapIntensity)}function d(m,g,_){m.ior.value=g.ior,g.sheen>0&&(m.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),m.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(m.sheenColorMap.value=g.sheenColorMap),g.sheenRoughnessMap&&(m.sheenRoughnessMap.value=g.sheenRoughnessMap)),g.clearcoat>0&&(m.clearcoat.value=g.clearcoat,m.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(m.clearcoatMap.value=g.clearcoatMap),g.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap),g.clearcoatNormalMap&&(m.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),m.clearcoatNormalMap.value=g.clearcoatNormalMap,g.side===dr&&m.clearcoatNormalScale.value.negate())),g.iridescence>0&&(m.iridescence.value=g.iridescence,m.iridescenceIOR.value=g.iridescenceIOR,m.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(m.iridescenceMap.value=g.iridescenceMap),g.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=g.iridescenceThicknessMap)),g.transmission>0&&(m.transmission.value=g.transmission,m.transmissionSamplerMap.value=_.texture,m.transmissionSamplerSize.value.set(_.width,_.height),g.transmissionMap&&(m.transmissionMap.value=g.transmissionMap),m.thickness.value=g.thickness,g.thicknessMap&&(m.thicknessMap.value=g.thicknessMap),m.attenuationDistance.value=g.attenuationDistance,m.attenuationColor.value.copy(g.attenuationColor)),m.specularIntensity.value=g.specularIntensity,m.specularColor.value.copy(g.specularColor),g.specularIntensityMap&&(m.specularIntensityMap.value=g.specularIntensityMap),g.specularColorMap&&(m.specularColorMap.value=g.specularColorMap)}function p(m,g){g.matcap&&(m.matcap.value=g.matcap)}function v(m,g){m.referencePosition.value.copy(g.referencePosition),m.nearDistance.value=g.nearDistance,m.farDistance.value=g.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:r}}function v8(n,e,t,r){let i={},o={},s=[];const a=t.isWebGL2?n.getParameter(35375):0;function l(y,x){const S=x.program;r.uniformBlockBinding(y,S)}function c(y,x){let S=i[y.id];S===void 0&&(v(y),S=f(y),i[y.id]=S,y.addEventListener("dispose",g));const T=x.program;r.updateUBOMapping(y,T);const C=e.render.frame;o[y.id]!==C&&(d(y),o[y.id]=C)}function f(y){const x=u();y.__bindingPointIndex=x;const S=n.createBuffer(),T=y.__size,C=y.usage;return n.bindBuffer(35345,S),n.bufferData(35345,T,C),n.bindBuffer(35345,null),n.bindBufferBase(35345,x,S),S}function u(){for(let y=0;y0){C=S%T;const ee=T-C;C!==0&&ee-I.boundary<0&&(S+=T-C,A.__offset=S)}S+=I.storage}return C=S%T,C>0&&(S+=T-C),y.__size=S,y.__cache={},this}function m(y){const x={boundary:0,storage:0};return typeof y=="number"?(x.boundary=4,x.storage=4):y.isVector2?(x.boundary=8,x.storage=8):y.isVector3||y.isColor?(x.boundary=16,x.storage=12):y.isVector4?(x.boundary=16,x.storage=16):y.isMatrix3?(x.boundary=48,x.storage=48):y.isMatrix4?(x.boundary=64,x.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),x}function g(y){const x=y.target;x.removeEventListener("dispose",g);const S=s.indexOf(x.__bindingPointIndex);s.splice(S,1),n.deleteBuffer(i[x.id]),delete i[x.id],delete o[x.id]}function _(){for(const y in i)n.deleteBuffer(i[y]);s=[],i={},o={}}return{bind:l,update:c,dispose:_}}function y8(){const n=Vc("canvas");return n.style.display="block",n}function Gc(n={}){this.isWebGLRenderer=!0;const e=n.canvas!==void 0?n.canvas:y8(),t=n.context!==void 0?n.context:null,r=n.depth!==void 0?n.depth:!0,i=n.stencil!==void 0?n.stencil:!0,o=n.antialias!==void 0?n.antialias:!1,s=n.premultipliedAlpha!==void 0?n.premultipliedAlpha:!0,a=n.preserveDrawingBuffer!==void 0?n.preserveDrawingBuffer:!1,l=n.powerPreference!==void 0?n.powerPreference:"default",c=n.failIfMajorPerformanceCaveat!==void 0?n.failIfMajorPerformanceCaveat:!1;let f;t!==null?f=t.getContextAttributes().alpha:f=n.alpha!==void 0?n.alpha:!1;let u=null,d=null;const p=[],v=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=Rs,this.useLegacyLights=!0,this.toneMapping=Hi,this.toneMappingExposure=1;const m=this;let g=!1,_=0,y=0,x=null,S=-1,T=null;const C=new dt,L=new dt;let E=null,A=e.width,I=e.height,q=1,ee=null,H=null;const R=new dt(0,0,A,I),N=new dt(0,0,A,I);let Z=!1;const K=new Hc;let B=!1,$=!1,W=null;const ie=new Be,j=new F,se={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ue(){return x===null?q:1}let Q=t;function me(k,ne){for(let oe=0;oe0?d=v[v.length-1]:d=null,p.pop(),p.length>0?u=p[p.length-1]:u=null};function wt(k,ne,oe,J){if(k.visible===!1)return;if(k.layers.test(ne.layers)){if(k.isGroup)oe=k.renderOrder;else if(k.isLOD)k.autoUpdate===!0&&k.update(ne);else if(k.isLight)d.pushLight(k),k.castShadow&&d.pushShadow(k);else if(k.isSprite){if(!k.frustumCulled||K.intersectsSprite(k)){J&&j.setFromMatrixPosition(k.matrixWorld).applyMatrix4(ie);const je=zt.update(k),Ze=k.material;Ze.visible&&u.push(k,je,Ze,oe,j.z,null)}}else if((k.isMesh||k.isLine||k.isPoints)&&(k.isSkinnedMesh&&k.skeleton.frame!==Pe.render.frame&&(k.skeleton.update(),k.skeleton.frame=Pe.render.frame),!k.frustumCulled||K.intersectsObject(k))){J&&j.setFromMatrixPosition(k.matrixWorld).applyMatrix4(ie);const je=zt.update(k),Ze=k.material;if(Array.isArray(Ze)){const Qe=je.groups;for(let rt=0,at=Qe.length;rt0&&sn(ce,ne,oe),J&&de.viewport(C.copy(J)),ce.length>0&&ir(ce,ne,oe),Ge.length>0&&ir(Ge,ne,oe),je.length>0&&ir(je,ne,oe),de.buffers.depth.setTest(!0),de.buffers.depth.setMask(!0),de.buffers.color.setMask(!0),de.setPolygonOffset(!1)}function sn(k,ne,oe){const J=we.isWebGL2;W===null&&(W=new Vo(1024,1024,{generateMipmaps:!0,type:pe.has("EXT_color_buffer_half_float")?Uc:Ls,minFilter:$c,samples:J&&o===!0?4:0}));const ce=m.getRenderTarget();m.setRenderTarget(W),m.clear();const Ge=m.toneMapping;m.toneMapping=Hi,ir(k,ne,oe),m.toneMapping=Ge,He.updateMultisampleRenderTarget(W),He.updateRenderTargetMipmap(W),m.setRenderTarget(ce)}function ir(k,ne,oe){const J=ne.isScene===!0?ne.overrideMaterial:null;for(let ce=0,Ge=k.length;ce0&&He.useMultisampledRTT(k)===!1?ce=Ne.get(k).__webglMultisampledFramebuffer:ce=at,C.copy(k.viewport),L.copy(k.scissor),E=k.scissorTest}else C.copy(R).multiplyScalar(q).floor(),L.copy(N).multiplyScalar(q).floor(),E=Z;if(de.bindFramebuffer(36160,ce)&&we.drawBuffers&&J&&de.drawBuffers(k,ce),de.viewport(C),de.scissor(L),de.setScissorTest(E),Ge){const Qe=Ne.get(k.texture);Q.framebufferTexture2D(36160,36064,34069+ne,Qe.__webglTexture,oe)}else if(je){const Qe=Ne.get(k.texture),rt=ne||0;Q.framebufferTextureLayer(36160,36064,Qe.__webglTexture,oe||0,rt)}S=-1},this.readRenderTargetPixels=function(k,ne,oe,J,ce,Ge,je){if(!(k&&k.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ze=Ne.get(k).__webglFramebuffer;if(k.isWebGLCubeRenderTarget&&je!==void 0&&(Ze=Ze[je]),Ze){de.bindFramebuffer(36160,Ze);try{const Qe=k.texture,rt=Qe.format,at=Qe.type;if(rt!==Mr&&Ue.convert(rt)!==Q.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const it=at===Uc&&(pe.has("EXT_color_buffer_half_float")||we.isWebGL2&&pe.has("EXT_color_buffer_float"));if(at!==Ls&&Ue.convert(at)!==Q.getParameter(35738)&&!(at===vo&&(we.isWebGL2||pe.has("OES_texture_float")||pe.has("WEBGL_color_buffer_float")))&&!it){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ne>=0&&ne<=k.width-J&&oe>=0&&oe<=k.height-ce&&Q.readPixels(ne,oe,J,ce,Ue.convert(rt),Ue.convert(at),Ge)}finally{const Qe=x!==null?Ne.get(x).__webglFramebuffer:null;de.bindFramebuffer(36160,Qe)}}},this.copyFramebufferToTexture=function(k,ne,oe=0){const J=Math.pow(2,-oe),ce=Math.floor(ne.image.width*J),Ge=Math.floor(ne.image.height*J);He.setTexture2D(ne,0),Q.copyTexSubImage2D(3553,oe,0,0,k.x,k.y,ce,Ge),de.unbindTexture()},this.copyTextureToTexture=function(k,ne,oe,J=0){const ce=ne.image.width,Ge=ne.image.height,je=Ue.convert(oe.format),Ze=Ue.convert(oe.type);He.setTexture2D(oe,0),Q.pixelStorei(37440,oe.flipY),Q.pixelStorei(37441,oe.premultiplyAlpha),Q.pixelStorei(3317,oe.unpackAlignment),ne.isDataTexture?Q.texSubImage2D(3553,J,k.x,k.y,ce,Ge,je,Ze,ne.image.data):ne.isCompressedTexture?Q.compressedTexSubImage2D(3553,J,k.x,k.y,ne.mipmaps[0].width,ne.mipmaps[0].height,je,ne.mipmaps[0].data):Q.texSubImage2D(3553,J,k.x,k.y,je,Ze,ne.image),J===0&&oe.generateMipmaps&&Q.generateMipmap(3553),de.unbindTexture()},this.copyTextureToTexture3D=function(k,ne,oe,J,ce=0){if(m.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Ge=k.max.x-k.min.x+1,je=k.max.y-k.min.y+1,Ze=k.max.z-k.min.z+1,Qe=Ue.convert(J.format),rt=Ue.convert(J.type);let at;if(J.isData3DTexture)He.setTexture3D(J,0),at=32879;else if(J.isDataArrayTexture)He.setTexture2DArray(J,0),at=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Q.pixelStorei(37440,J.flipY),Q.pixelStorei(37441,J.premultiplyAlpha),Q.pixelStorei(3317,J.unpackAlignment);const it=Q.getParameter(3314),Ft=Q.getParameter(32878),Pn=Q.getParameter(3316),Yt=Q.getParameter(3315),fn=Q.getParameter(32877),Tt=oe.isCompressedTexture?oe.mipmaps[0]:oe.image;Q.pixelStorei(3314,Tt.width),Q.pixelStorei(32878,Tt.height),Q.pixelStorei(3316,k.min.x),Q.pixelStorei(3315,k.min.y),Q.pixelStorei(32877,k.min.z),oe.isDataTexture||oe.isData3DTexture?Q.texSubImage3D(at,ce,ne.x,ne.y,ne.z,Ge,je,Ze,Qe,rt,Tt.data):oe.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Q.compressedTexSubImage3D(at,ce,ne.x,ne.y,ne.z,Ge,je,Ze,Qe,Tt.data)):Q.texSubImage3D(at,ce,ne.x,ne.y,ne.z,Ge,je,Ze,Qe,rt,Tt),Q.pixelStorei(3314,it),Q.pixelStorei(32878,Ft),Q.pixelStorei(3316,Pn),Q.pixelStorei(3315,Yt),Q.pixelStorei(32877,fn),ce===0&&J.generateMipmaps&&Q.generateMipmap(at),de.unbindTexture()},this.initTexture=function(k){k.isCubeTexture?He.setTextureCube(k,0):k.isData3DTexture?He.setTexture3D(k,0):k.isDataArrayTexture||k.isCompressedArrayTexture?He.setTexture2DArray(k,0):He.setTexture2D(k,0),de.unbindTexture()},this.resetState=function(){_=0,y=0,x=null,de.reset(),G.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Object.defineProperties(Gc.prototype,{physicallyCorrectLights:{get:function(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights},set:function(n){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!n}}});class _8 extends Gc{}_8.prototype.isWebGL1Renderer=!0;class x8 extends bt{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}}const ex=new F,tx=new dt,nx=new dt,w8=new F,rx=new Be;class S8 extends Me{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Be,this.bindMatrixInverse=new Be}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new dt,t=this.geometry.attributes.skinWeight;for(let r=0,i=t.count;rl)continue;d.applyMatrix4(this.matrixWorld);const E=e.ray.origin.distanceTo(d);Ee.far||t.push({distance:E,point:u.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else{const _=Math.max(0,s.start),y=Math.min(g.count,s.start+s.count);for(let x=_,S=y-1;xl)continue;d.applyMatrix4(this.matrixWorld);const C=e.ray.origin.distanceTo(d);Ce.far||t.push({distance:C,point:u.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,s=i.length;o0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,s=i.length;oi.far)return;o.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:s})}}class E8{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/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 r,i=this.getPoint(0),o=0;t.push(0);for(let s=1;s<=e;s++)r=this.getPoint(s/e),o+=r.distanceTo(i),t.push(o),i=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const r=this.getLengths();let i=0;const o=r.length;let s;t?s=t:s=e*r[o-1];let a=0,l=o-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-s,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===s)return i/(o-1);const f=r[i],d=r[i+1]-f,p=(s-f)/d;return(i+p)/(o-1)}getTangent(e,t){let i=e-1e-4,o=e+1e-4;i<0&&(i=0),o>1&&(o=1);const s=this.getPoint(i),a=this.getPoint(o),l=t||(s.isVector2?new We:new F);return l.copy(a).sub(s).normalize(),l}getTangentAt(e,t){const r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){const r=new F,i=[],o=[],s=[],a=new F,l=new Be;for(let p=0;p<=e;p++){const v=p/e;i[p]=this.getTangentAt(v,new F)}o[0]=new F,s[0]=new F;let c=Number.MAX_VALUE;const f=Math.abs(i[0].x),u=Math.abs(i[0].y),d=Math.abs(i[0].z);f<=c&&(c=f,r.set(1,0,0)),u<=c&&(c=u,r.set(0,1,0)),d<=c&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),o[0].crossVectors(i[0],a),s[0].crossVectors(i[0],o[0]);for(let p=1;p<=e;p++){if(o[p]=o[p-1].clone(),s[p]=s[p-1].clone(),a.crossVectors(i[p-1],i[p]),a.length()>Number.EPSILON){a.normalize();const v=Math.acos(Mn(i[p-1].dot(i[p]),-1,1));o[p].applyMatrix4(l.makeRotationAxis(a,v))}s[p].crossVectors(i[p],o[p])}if(t===!0){let p=Math.acos(Mn(o[0].dot(o[e]),-1,1));p/=e,i[0].dot(a.crossVectors(o[0],o[e]))>0&&(p=-p);for(let v=1;v<=e;v++)o[v].applyMatrix4(l.makeRotationAxis(i[v],p*v)),s[v].crossVectors(i[v],o[v])}return{tangents:i,normals:o,binormals:s}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class pn extends Ht{constructor(e=1,t=1,r=1,i=32,o=1,s=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:i,heightSegments:o,openEnded:s,thetaStart:a,thetaLength:l};const c=this;i=Math.floor(i),o=Math.floor(o);const f=[],u=[],d=[],p=[];let v=0;const m=[],g=r/2;let _=0;y(),s===!1&&(e>0&&x(!0),t>0&&x(!1)),this.setIndex(f),this.setAttribute("position",new Je(u,3)),this.setAttribute("normal",new Je(d,3)),this.setAttribute("uv",new Je(p,2));function y(){const S=new F,T=new F;let C=0;const L=(t-e)/r;for(let E=0;E<=o;E++){const A=[],I=E/o,q=I*(t-e)+e;for(let ee=0;ee<=i;ee++){const H=ee/i,R=H*l+a,N=Math.sin(R),Z=Math.cos(R);T.x=q*N,T.y=-I*r+g,T.z=q*Z,u.push(T.x,T.y,T.z),S.set(N,L,Z).normalize(),d.push(S.x,S.y,S.z),p.push(H,1-I),A.push(v++)}m.push(A)}for(let E=0;E.9&&L<.1&&(x<.2&&(s[y+0]+=1),S<.2&&(s[y+2]+=1),T<.2&&(s[y+4]+=1))}}function d(y){o.push(y.x,y.y,y.z)}function p(y,x){const S=y*3;x.x=e[S+0],x.y=e[S+1],x.z=e[S+2]}function v(){const y=new F,x=new F,S=new F,T=new F,C=new We,L=new We,E=new We;for(let A=0,I=0;A0)&&p.push(x,S,C),(_!==r-1||l=o)){const a=t[1];e=o)break t}s=r,r=0;break n}break e}for(;r>>1;et;)--s;if(++s,o!==0||s!==i){o>=s&&(s=Math.max(s,1),o=s-1);const a=this.getValueSize();this.times=oo(r,o,s),this.values=oo(this.values,o*a,s*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 r=this.times,i=this.values,o=r.length;o===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let s=null;for(let a=0;a!==o;a++){const l=r[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(s!==null&&s>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,s),e=!1;break}s=l}if(i!==void 0&&c2(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=oo(this.times),t=oo(this.values),r=this.getValueSize(),i=this.getInterpolation()===yp,o=e.length-1;let s=1;for(let a=1;a0){e[s]=e[o];for(let a=o*r,l=s*r,c=0;c!==r;++c)t[l+c]=t[a+c];++s}return s!==e.length?(this.times=oo(e,0,s),this.values=oo(t,0,s*r)):(this.times=e,this.values=t),this}clone(){const e=oo(this.times,0),t=oo(this.values,0),r=this.constructor,i=new r(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Si.prototype.TimeBufferType=Float32Array;Si.prototype.ValueBufferType=Float32Array;Si.prototype.DefaultInterpolation=bd;class ul extends Si{}ul.prototype.ValueTypeName="bool";ul.prototype.ValueBufferType=Array;ul.prototype.DefaultInterpolation=Sd;ul.prototype.InterpolantFactoryMethodLinear=void 0;ul.prototype.InterpolantFactoryMethodSmooth=void 0;class f2 extends Si{}f2.prototype.ValueTypeName="color";class jc extends Si{}jc.prototype.ValueTypeName="number";class R8 extends dh{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e,t,r,i){const o=this.resultBuffer,s=this.sampleValues,a=this.valueSize,l=(r-t)/(i-t);let c=e*a;for(let f=c+a;c!==f;c+=4)$t.slerpFlat(o,0,s,c-a,s,c,l);return o}}class fl extends Si{InterpolantFactoryMethodLinear(e){return new R8(this.times,this.values,this.getValueSize(),e)}}fl.prototype.ValueTypeName="quaternion";fl.prototype.DefaultInterpolation=bd;fl.prototype.InterpolantFactoryMethodSmooth=void 0;class dl extends Si{}dl.prototype.ValueTypeName="string";dl.prototype.ValueBufferType=Array;dl.prototype.DefaultInterpolation=Sd;dl.prototype.InterpolantFactoryMethodLinear=void 0;dl.prototype.InterpolantFactoryMethodSmooth=void 0;class Xc extends Si{}Xc.prototype.ValueTypeName="vector";class D8{constructor(e,t=-1,r,i=J5){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=Yo(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],r=e.tracks,i=1/(e.fps||1);for(let s=0,a=r.length;s!==a;++s)t.push(k8(r[s]).scale(i));const o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o}static toJSON(e){const t=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let o=0,s=r.length;o!==s;++o)t.push(Si.toJSON(r[o]));return i}static CreateFromMorphTargetSequence(e,t,r,i){const o=t.length,s=[];for(let a=0;a1){const u=f[1];let d=i[u];d||(i[u]=d=[]),d.push(c)}}const s=[];for(const a in i)s.push(this.CreateFromMorphTargetSequence(a,i[a],t,r));return s}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(u,d,p,v,m){if(p.length!==0){const g=[],_=[];u2(p,g,_,v),g.length!==0&&m.push(new u(d,g,_))}},i=[],o=e.name||"default",s=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let u=0;u{t&&t(o),this.manager.itemEnd(e)},0),o;if(Ai[e]!==void 0){Ai[e].push({onLoad:t,onProgress:r,onError:i});return}Ai[e]=[],Ai[e].push({onLoad:t,onProgress:r,onError:i});const s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(s).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const f=Ai[e],u=c.body.getReader(),d=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),p=d?parseInt(d):0,v=p!==0;let m=0;const g=new ReadableStream({start(_){y();function y(){u.read().then(({done:x,value:S})=>{if(x)_.close();else{m+=S.byteLength;const T=new ProgressEvent("progress",{lengthComputable:v,loaded:m,total:p});for(let C=0,L=f.length;C{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(f=>new DOMParser().parseFromString(f,a));case"json":return c.json();default:if(a===void 0)return c.text();{const u=/charset="?([^;"\s]*)"?/i.exec(a),d=u&&u[1]?u[1].toLowerCase():void 0,p=new TextDecoder(d);return c.arrayBuffer().then(v=>p.decode(v))}}}).then(c=>{Ed.add(e,c);const f=Ai[e];delete Ai[e];for(let u=0,d=f.length;u{const f=Ai[e];if(f===void 0)throw this.manager.itemError(e),c;delete Ai[e];for(let u=0,d=f.length;u{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class $8 extends ou{constructor(e){super(e)}load(e,t,r,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,s=Ed.get(e);if(s!==void 0)return o.manager.itemStart(e),setTimeout(function(){t&&t(s),o.manager.itemEnd(e)},0),s;const a=Vc("img");function l(){f(),Ed.add(e,this),t&&t(this),o.manager.itemEnd(e)}function c(u){f(),i&&i(u),o.manager.itemError(e),o.manager.itemEnd(e)}function f(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),o.manager.itemStart(e),a.src=e,a}}class U8 extends ou{constructor(e){super(e)}load(e,t,r,i){const o=new Tn,s=new $8(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(e,function(a){o.image=a,o.needsUpdate=!0,t!==void 0&&t(o)},r,i),o}}class hh extends bt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ye(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}const Wp=new Be,px=new F,mx=new F;class Y0{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new We(512,512),this.map=null,this.mapPass=null,this.matrix=new Be,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Hc,this._frameExtents=new We(1,1),this._viewportCount=1,this._viewports=[new dt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,r=this.matrix;px.setFromMatrixPosition(e.matrixWorld),t.position.copy(px),mx.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(mx),t.updateMatrixWorld(),Wp.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Wp),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(Wp)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class z8 extends Y0{constructor(){super(new Bn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,r=Bc*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,o=e.distance||t.far;(r!==t.fov||i!==t.aspect||o!==t.far)&&(t.fov=r,t.aspect=i,t.far=o,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class B8 extends hh{constructor(e,t,r=0,i=Math.PI/3,o=0,s=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(bt.DEFAULT_UP),this.updateMatrix(),this.target=new bt,this.distance=r,this.angle=i,this.penumbra=o,this.decay=s,this.map=null,this.shadow=new z8}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const gx=new Be,zl=new F,jp=new F;class V8 extends Y0{constructor(){super(new Bn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new We(4,2),this._viewportCount=6,this._viewports=[new dt(2,1,1,1),new dt(0,1,1,1),new dt(3,1,1,1),new dt(1,1,1,1),new dt(3,0,1,1),new dt(1,0,1,1)],this._cubeDirections=[new F(1,0,0),new F(-1,0,0),new F(0,0,1),new F(0,0,-1),new F(0,1,0),new F(0,-1,0)],this._cubeUps=[new F(0,1,0),new F(0,1,0),new F(0,1,0),new F(0,1,0),new F(0,0,1),new F(0,0,-1)]}updateMatrices(e,t=0){const r=this.camera,i=this.matrix,o=e.distance||r.far;o!==r.far&&(r.far=o,r.updateProjectionMatrix()),zl.setFromMatrixPosition(e.matrixWorld),r.position.copy(zl),jp.copy(r.position),jp.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(jp),r.updateMatrixWorld(),i.makeTranslation(-zl.x,-zl.y,-zl.z),gx.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(gx)}}class vx extends hh{constructor(e,t,r=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=i,this.shadow=new V8}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class H8 extends Y0{constructor(){super(new uh(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class h2 extends hh{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(bt.DEFAULT_UP),this.updateMatrix(),this.target=new bt,this.shadow=new H8}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class p2 extends hh{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class G8{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let r=0,i=e.length;r"u"?Date:performance).now()}const q0="\\[\\]\\.:\\/",j8=new RegExp("["+q0+"]","g"),Z0="[^"+q0+"]",X8="[^"+q0.replace("\\.","")+"]",K8=/((?:WC+[\/:])*)/.source.replace("WC",Z0),Y8=/(WCOD+)?/.source.replace("WCOD",X8),q8=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Z0),Z8=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Z0),Q8=new RegExp("^"+K8+Y8+q8+Z8+"$"),J8=["material","materials","bones","map"];class eU{constructor(e,t,r){const i=r||gt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,t)}setValue(e,t){const r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,o=r.length;i!==o;++i)r[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}}class gt{constructor(e,t,r){this.path=t,this.parsedPath=r||gt.parseTrackName(t),this.node=gt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new gt.Composite(e,t,r):new gt(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(j8,"")}static parseTrackName(e){const t=Q8.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const o=r.nodeName.substring(i+1);J8.indexOf(o)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=o)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(t);if(r!==void 0)return r}if(e.children){const r=function(o){for(let s=0;s{r.name==e&&(t=r)}),t}function v2(n){const e=new F;return n.getWorldPosition(e),e}function rU(n,e){return n.worldToLocal(e.clone())}const wx=new $t,Sx=new F,Bl=new F,bx=new F,Vl=new F,Xp=new F,lf=new $t,iU=new F,Kp=new F,Mx=new F;new Be;class oU{iks;constructor(e=[]){this.iks=e,this._valid()}update(){const e=this.iks;for(let t=0,r=e.length;tl.index),r=Math,i=e.effector,o=e.target;Sx.setFromMatrixPosition(o.matrixWorld);const s=e.links,a=e.iteration!==void 0?e.iteration:1;for(let l=0;l1?g=1:g<-1&&(g=-1),g=r.acos(g),!(g<1e-5)){if(e.minAngle!==void 0&&ge.maxAngle&&(g=e.maxAngle),Kp.crossVectors(Vl,Bl),Kp.normalize(),wx.setFromAxisAngle(Kp,g),d.quaternion.multiply(wx),p!==void 0){let _=d.quaternion.w;_>1&&(_=1);const y=r.sqrt(1-_*_);d.quaternion.set(p.x*y,p.y*y,p.z*y,_)}v!==void 0&&d.rotation.setFromVector3(Mx.setFromEuler(d.rotation).max(v)),m!==void 0&&d.rotation.setFromVector3(Mx.setFromEuler(d.rotation).min(m)),d.updateMatrixWorld(!0),c=!0}}if(!c)break}return this}_valid(){const e=this.iks;for(let t=0,r=e.length;tr===n&&i===e);if(typeof t<"u"){const[r,i,o]=_2[t];return(r<<16)+(i<<8)+o}return null}function lU(n,e){if(!n||!e)return null;const t=Ho.indexOf(n),r=Ho.indexOf(e);return t===-1||r===-1?null:t>r?Ex(r,t):Ex(t,r)}const Pr=1,x2={Root:0,Hips:1,Spine:2,Spine1:3,Spine2:4,Chest:5,Neck:6,Head:7,Eye_R:8,Eye_L:9,Head_Null:10,Shoulder_L:11,Arm_L:12,ForeArm_L:13,Hand_L:14,HandPinky1_L:15,HandPinky2_L:16,HandPinky3_L:17,HandRing1_L:18,HandRing2_L:19,HandRing3_L:20,HandMiddle1_L:21,HandMiddle2_L:22,HandMiddle3_L:23,HandIndex1_L:24,HandIndex2_L:25,HandIndex3_L:26,HandThumb1_L:27,HandThumb2_L:28,HandThumb3_L:29,Elbow_L:30,ForeArmTwist_L:31,ArmTwist_L:32,Shoulder_R:33,Arm_R:34,ForeArm_R:35,Hand_R:36,HandPinky1_R:37,HandPinky2_R:38,HandPinky3_R:39,HandRing1_R:40,HandRing2_R:41,HandRing3_R:42,HandMiddle1_R:43,HandMiddle2_R:44,HandMiddle3_R:45,HandIndex1_R:46,HandIndex2_R:47,HandIndex3_R:48,HandThumb1_R:49,HandThumb2_R:50,HandThumb3_R:51,Elbow_R:52,ForeArmTwist_R:53,ArmTwist_R:54,UpLeg_L:55,Leg_L:56,Knee_L:57,Foot_L:58,FootPinky1_L:59,FootRing_L:60,FootMiddle_L:61,FootIndex_L:62,FootThumb_L:63,UpLegTwist_L:64,ThighFront_L:65,UpLeg_R:66,Leg_R:67,Knee_R:68,Foot_R:69,FootPinky1_R:70,FootRing_R:71,FootMiddle_R:72,FootIndex_R:73,FootThumb_R:74,UpLegTwist_R:75,ThighFront_R:76},cU={nose:0,left_eye_inner:1,left_eye:2,left_eye_outer:3,right_eye_inner:4,right_eye:5,right_eye_outer:6,left_ear:7,right_ear:8,mouth_left:9,mouth_right:10,left_shoulder:11,right_shoulder:12,left_elbow:13,right_elbow:14,left_wrist:15,right_wrist:16,left_pinky:17,right_pinky:18,left_index:19,right_index:20,left_thumb:21,right_thumb:22,left_hip:23,right_hip:24,left_knee:25,right_knee:26,left_ankle:27,right_ankle:28,left_heel:29,right_heel:30,left_foot_index:31,right_foot_index:32};/*! fflate - fast JavaScript compression/decompression Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE version 0.6.9 */var Tx=function(n){return URL.createObjectURL(new Blob([n],{type:"text/javascript"}))};try{URL.revokeObjectURL(Tx(""))}catch{Tx=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)}}var Er=Uint8Array,xo=Uint16Array,Eg=Uint32Array,w2=new Er([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]),S2=new Er([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]),uU=new Er([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),b2=function(n,e){for(var t=new xo(31),r=0;r<31;++r)t[r]=e+=1<>>1|(It&21845)<<1;so=(so&52428)>>>2|(so&13107)<<2,so=(so&61680)>>>4|(so&3855)<<4,Tg[It]=((so&65280)>>>8|(so&255)<<8)>>>1}var mc=function(n,e,t){for(var r=n.length,i=0,o=new xo(e);i>>l]=c}else for(a=new xo(r),i=0;i>>15-n[i]);return a},su=new Er(288);for(var It=0;It<144;++It)su[It]=8;for(var It=144;It<256;++It)su[It]=9;for(var It=256;It<280;++It)su[It]=7;for(var It=280;It<288;++It)su[It]=8;var T2=new Er(32);for(var It=0;It<32;++It)T2[It]=5;var pU=mc(su,9,1),mU=mc(T2,5,1),Yp=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},Ur=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},qp=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},gU=function(n){return(n/8|0)+(n&7&&1)},vU=function(n,e,t){(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length);var r=new(n instanceof xo?xo:n instanceof Eg?Eg:Er)(t-e);return r.set(n.subarray(e,t)),r},yU=function(n,e,t){var r=n.length;if(!r||t&&!t.l&&r<5)return e||new Er(0);var i=!e||t,o=!t||t.i;t||(t={}),e||(e=new Er(r*3));var s=function(me){var pe=e.length;if(me>pe){var we=new Er(Math.max(pe*2,me));we.set(e),e=we}},a=t.f||0,l=t.p||0,c=t.b||0,f=t.l,u=t.d,d=t.m,p=t.n,v=r*8;do{if(!f){t.f=a=Ur(n,l,1);var m=Ur(n,l+1,3);if(l+=3,m)if(m==1)f=pU,u=mU,d=9,p=5;else if(m==2){var x=Ur(n,l,31)+257,S=Ur(n,l+10,15)+4,T=x+Ur(n,l+5,31)+1;l+=14;for(var C=new Er(T),L=new Er(19),E=0;E>>4;if(g<16)C[E++]=g;else{var H=0,R=0;for(g==16?(R=3+Ur(n,l,3),l+=2,H=C[E-1]):g==17?(R=3+Ur(n,l,7),l+=3):g==18&&(R=11+Ur(n,l,127),l+=7);R--;)C[E++]=H}}var N=C.subarray(0,x),Z=C.subarray(x);d=Yp(N),p=Yp(Z),f=mc(N,d,1),u=mc(Z,p,1)}else throw"invalid block type";else{var g=gU(l)+4,_=n[g-4]|n[g-3]<<8,y=g+_;if(y>r){if(o)throw"unexpected EOF";break}i&&s(c+_),e.set(n.subarray(g,y),c),t.b=c+=_,t.p=l=y*8;continue}if(l>v){if(o)throw"unexpected EOF";break}}i&&s(c+131072);for(var K=(1<>>4;if(l+=H&15,l>v){if(o)throw"unexpected EOF";break}if(!H)throw"invalid length/literal";if(W<256)e[c++]=W;else if(W==256){$=l,f=null;break}else{var ie=W-254;if(W>264){var E=W-257,j=w2[E];ie=Ur(n,l,(1<>>4;if(!se)throw"invalid distance";l+=se&15;var Z=hU[ue];if(ue>3){var j=S2[ue];Z+=qp(n,l)&(1<v){if(o)throw"unexpected EOF";break}i&&s(c+131072);for(var Q=c+ie;c>>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 wU(n,e){return yU((xU(n),n.subarray(2,-4)),e)}var SU=typeof TextDecoder<"u"&&new TextDecoder,bU=0;try{SU.decode(_U,{stream:!0}),bU=1}catch{}function C2(n,e,t){const r=t.length-n-1;if(e>=t[r])return r-1;if(e<=t[n])return n;let i=n,o=r,s=Math.floor((i+o)/2);for(;e=t[s+1];)e=m&&(v[p][0]=v[d][0]/a[y+1][_],g=v[p][0]*a[_][y]);const x=_>=-1?1:-_,S=u-1<=y?m-1:t-u;for(let C=x;C<=S;++C)v[p][C]=(v[d][C]-v[d][C-1])/a[y+1][_+C],g+=v[p][C]*a[_+C][y];u<=y&&(v[p][m]=-v[d][m-1]/a[y+1][u],g+=v[p][m]*a[u][y]),s[m][u]=g;const T=d;d=p,p=T}}let f=t;for(let u=1;u<=r;++u){for(let d=0;d<=t;++d)s[u][d]*=f;f*=t-u}return s}function CU(n,e,t,r,i){const o=i0,l=typeof o.Content=="string"&&o.Content!=="";if(a||l){const c=this.parseImage(r[i]);t[o.RelativeFilename||o.Filename]=c}}}}for(const r in e){const i=e[r];t[i]!==void 0?e[r]=t[i]:e[r]=e[r].split("\\").pop()}return e}parseImage(e){const t=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();let o;switch(i){case"bmp":o="image/bmp";break;case"jpg":case"jpeg":o="image/jpeg";break;case"png":o="image/png";break;case"tif":o="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",r),o="image/tga";break;default:console.warn('FBXLoader: Image type "'+i+'" is not supported.');return}if(typeof t=="string")return"data:"+o+";base64,"+t;{const s=new Uint8Array(t);return window.URL.createObjectURL(new Blob([s],{type:o}))}}parseTextures(e){const t=new Map;if("Texture"in lt.Objects){const r=lt.Objects.Texture;for(const i in r){const o=this.parseTexture(r[i],e);t.set(parseInt(i),o)}}return t}parseTexture(e,t){const r=this.loadTexture(e,t);r.ID=e.id,r.name=e.attrName;const i=e.WrapModeU,o=e.WrapModeV,s=i!==void 0?i.value:0,a=o!==void 0?o.value:0;if(r.wrapS=s===0?Nc:cr,r.wrapT=a===0?Nc:cr,"Scaling"in e){const l=e.Scaling.value;r.repeat.x=l[0],r.repeat.y=l[1]}if("Translation"in e){const l=e.Translation.value;r.offset.x=l[0],r.offset.y=l[1]}return r}loadTexture(e,t){let r;const i=this.textureLoader.path,o=en.get(e.id).children;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(r=t[o[0].ID],(r.indexOf("blob:")===0||r.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let s;const a=e.FileName.slice(-3).toLowerCase();if(a==="tga"){const l=this.manager.getHandler(".tga");l===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),s=new Tn):(l.setPath(this.textureLoader.path),s=l.load(r))}else a==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),s=new Tn):s=this.textureLoader.load(r);return this.textureLoader.setPath(i),s}parseMaterials(e){const t=new Map;if("Material"in lt.Objects){const r=lt.Objects.Material;for(const i in r){const o=this.parseMaterial(r[i],e);o!==null&&t.set(parseInt(i),o)}}return t}parseMaterial(e,t){const r=e.id,i=e.attrName;let o=e.ShadingModel;if(typeof o=="object"&&(o=o.value),!en.has(r))return null;const s=this.parseParameters(e,t,r);let a;switch(o.toLowerCase()){case"phong":a=new Oo;break;case"lambert":a=new T8;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),a=new Oo;break}return a.setValues(s),a.name=i,a}parseParameters(e,t,r){const i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=new Ye().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(i.color=new Ye().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=new Ye().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(i.emissive=new Ye().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=new Ye().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(i.specular=new Ye().fromArray(e.SpecularColor.value));const o=this;return en.get(r).children.forEach(function(s){const a=s.relationship;switch(a){case"Bump":i.bumpMap=o.getTexture(t,s.ID);break;case"Maya|TEX_ao_map":i.aoMap=o.getTexture(t,s.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=o.getTexture(t,s.ID),i.map!==void 0&&(i.map.encoding=_t);break;case"DisplacementColor":i.displacementMap=o.getTexture(t,s.ID);break;case"EmissiveColor":i.emissiveMap=o.getTexture(t,s.ID),i.emissiveMap!==void 0&&(i.emissiveMap.encoding=_t);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=o.getTexture(t,s.ID);break;case"ReflectionColor":i.envMap=o.getTexture(t,s.ID),i.envMap!==void 0&&(i.envMap.mapping=wd,i.envMap.encoding=_t);break;case"SpecularColor":i.specularMap=o.getTexture(t,s.ID),i.specularMap!==void 0&&(i.specularMap.encoding=_t);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=o.getTexture(t,s.ID),i.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",a);break}}),i}getTexture(e,t){return"LayeredTexture"in lt.Objects&&t in lt.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=en.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in lt.Objects){const r=lt.Objects.Deformer;for(const i in r){const o=r[i],s=en.get(parseInt(i));if(o.attrType==="Skin"){const a=this.parseSkeleton(s,r);a.ID=i,s.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=s.parents[0].ID,e[i]=a}else if(o.attrType==="BlendShape"){const a={id:i};a.rawTargets=this.parseMorphTargets(s,r),a.id=i,s.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[i]=a}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const r=[];return e.children.forEach(function(i){const o=t[i.ID];if(o.attrType!=="Cluster")return;const s={ID:i.ID,indices:[],weights:[],transformLink:new Be().fromArray(o.TransformLink.a)};"Indexes"in o&&(s.indices=o.Indexes.a,s.weights=o.Weights.a),r.push(s)}),{rawBones:r,bones:[]}}parseMorphTargets(e,t){const r=[];for(let i=0;i1?s=a:a.length>0?s=a[0]:(s=new Oo({color:13421772}),a.push(s)),"color"in o.attributes&&a.forEach(function(l){l.vertexColors=!0}),o.FBX_Deformer?(i=new S8(o,s),i.normalizeSkinWeights()):i=new Me(o,s),i}createCurve(e,t){const r=e.children.reduce(function(o,s){return t.has(s.ID)&&(o=t.get(s.ID)),o},null),i=new ko({color:3342591,linewidth:1});return new ri(r,i)}getTransformData(e,t){const r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?r.eulerOrder=L2(t.RotationOrder.value):r.eulerOrder="ZYX","Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}setLookAtProperties(e,t){"LookAtProperty"in t&&en.get(e.ID).children.forEach(function(i){if(i.relationship==="LookAtProperty"){const o=lt.Objects.Model[i.ID];if("Lcl_Translation"in o){const s=o.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(s),qn.add(e.target)):e.lookAt(new F().fromArray(s))}}})}bindSkeleton(e,t,r){const i=this.parsePoseNodes();for(const o in e){const s=e[o];en.get(parseInt(s.ID)).parents.forEach(function(l){if(t.has(l.ID)){const c=l.ID;en.get(c).parents.forEach(function(u){r.has(u.ID)&&r.get(u.ID).bind(new X0(s.bones),i[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in lt.Objects){const t=lt.Objects.Pose;for(const r in t)if(t[r].attrType==="BindPose"&&t[r].NbPoseNodes>0){const i=t[r].PoseNode;Array.isArray(i)?i.forEach(function(o){e[o.Node]=new Be().fromArray(o.Matrix.a)}):e[i.Node]=new Be().fromArray(i.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in lt&&"AmbientColor"in lt.GlobalSettings){const e=lt.GlobalSettings.AmbientColor.value,t=e[0],r=e[1],i=e[2];if(t!==0||r!==0||i!==0){const o=new Ye(t,r,i);qn.add(new p2(o,1))}}}}class kU{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in lt.Objects){const r=lt.Objects.Geometry;for(const i in r){const o=en.get(parseInt(i)),s=this.parseGeometry(o,r[i],e);t.set(parseInt(i),s)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,r){const i=r.skeletons,o=[],s=e.parents.map(function(u){return lt.Objects.Model[u.ID]});if(s.length===0)return;const a=e.children.reduce(function(u,d){return i[d.ID]!==void 0&&(u=i[d.ID]),u},null);e.children.forEach(function(u){r.morphTargets[u.ID]!==void 0&&o.push(r.morphTargets[u.ID])});const l=s[0],c={};"RotationOrder"in l&&(c.eulerOrder=L2(l.RotationOrder.value)),"InheritType"in l&&(c.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(c.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(c.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(c.scale=l.GeometricScaling.value);const f=A2(c);return this.genGeometry(t,a,o,f)}genGeometry(e,t,r,i){const o=new Ht;e.attrName&&(o.name=e.attrName);const s=this.parseGeoNode(e,t),a=this.genBuffers(s),l=new Je(a.vertex,3);if(l.applyMatrix4(i),o.setAttribute("position",l),a.colors.length>0&&o.setAttribute("color",new Je(a.colors,3)),t&&(o.setAttribute("skinIndex",new W0(a.weightsIndices,4)),o.setAttribute("skinWeight",new Je(a.vertexWeights,4)),o.FBX_Deformer=t),a.normal.length>0){const c=new On().getNormalMatrix(i),f=new Je(a.normal,3);f.applyNormalMatrix(c),o.setAttribute("normal",f)}if(a.uvs.forEach(function(c,f){let u="uv"+(f+1).toString();f===0&&(u="uv"),o.setAttribute(u,new Je(a.uvs[f],2))}),s.material&&s.material.mappingType!=="AllSame"){let c=a.materialIndex[0],f=0;if(a.materialIndex.forEach(function(u,d){u!==c&&(o.addGroup(f,d-f,c),c=u,f=d)}),o.groups.length>0){const u=o.groups[o.groups.length-1],d=u.start+u.count;d!==a.materialIndex.length&&o.addGroup(d,a.materialIndex.length-d,c)}o.groups.length===0&&o.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(o,e,r,i),o}parseGeoNode(e,t){const r={};if(r.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],r.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];let i=0;for(;e.LayerElementUV[i];)e.LayerElementUV[i].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[i])),i++}return r.weightTable={},t!==null&&(r.skeleton=t,t.rawBones.forEach(function(i,o){i.indices.forEach(function(s,a){r.weightTable[s]===void 0&&(r.weightTable[s]=[]),r.weightTable[s].push({id:o,weight:i.weights[a]})})})),r}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let r=0,i=0,o=!1,s=[],a=[],l=[],c=[],f=[],u=[];const d=this;return e.vertexIndices.forEach(function(p,v){let m,g=!1;p<0&&(p=p^-1,g=!0);let _=[],y=[];if(s.push(p*3,p*3+1,p*3+2),e.color){const x=cf(v,r,p,e.color);l.push(x[0],x[1],x[2])}if(e.skeleton){if(e.weightTable[p]!==void 0&&e.weightTable[p].forEach(function(x){y.push(x.weight),_.push(x.id)}),y.length>4){o||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),o=!0);const x=[0,0,0,0],S=[0,0,0,0];y.forEach(function(T,C){let L=T,E=_[C];S.forEach(function(A,I,q){if(L>A){q[I]=L,L=A;const ee=x[I];x[I]=E,E=ee}})}),_=x,y=S}for(;y.length<4;)y.push(0),_.push(0);for(let x=0;x<4;++x)f.push(y[x]),u.push(_[x])}if(e.normal){const x=cf(v,r,p,e.normal);a.push(x[0],x[1],x[2])}e.material&&e.material.mappingType!=="AllSame"&&(m=cf(v,r,p,e.material)[0],m<0&&(d.negativeMaterialIndices=!0,m=0)),e.uv&&e.uv.forEach(function(x,S){const T=cf(v,r,p,x);c[S]===void 0&&(c[S]=[]),c[S].push(T[0]),c[S].push(T[1])}),i++,g&&(i>4&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),d.genFace(t,e,s,m,a,l,c,f,u,i),r++,i=0,s=[],a=[],l=[],c=[],f=[],u=[])}),t}genFace(e,t,r,i,o,s,a,l,c,f){for(let u=2;u1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const s=e.get(o[0].ID);r[i]={name:t[i].attrName,layer:s}}return r}addClip(e){let t=[];const r=this;return e.layer.forEach(function(i){t=t.concat(r.generateTracks(i))}),new D8(e.name,-1,t)}generateTracks(e){const t=[];let r=new F,i=new $t,o=new F;if(e.transform&&e.transform.decompose(r,i,o),r=r.toArray(),i=new er().setFromQuaternion(i,e.eulerOrder).toArray(),o=o.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.T.curves,r,"position");s!==void 0&&t.push(s)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const s=this.generateRotationTrack(e.modelName,e.R.curves,i,e.preRotation,e.postRotation,e.eulerOrder);s!==void 0&&t.push(s)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.S.curves,o,"scale");s!==void 0&&t.push(s)}if(e.DeformPercent!==void 0){const s=this.generateMorphTrack(e);s!==void 0&&t.push(s)}return t}generateVectorTrack(e,t,r,i){const o=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(o,t,r);return new Xc(e+"."+i,o,s)}generateRotationTrack(e,t,r,i,o,s){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(li.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(li.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(li.degToRad));const a=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(a,t,r);i!==void 0&&(i=i.map(li.degToRad),i.push(s),i=new er().fromArray(i),i=new $t().setFromEuler(i)),o!==void 0&&(o=o.map(li.degToRad),o.push(s),o=new er().fromArray(o),o=new $t().setFromEuler(o).invert());const c=new $t,f=new er,u=[];for(let d=0;d1){let r=1,i=t[0];for(let o=1;o=180){const s=o/180,a=i/s;let l=r+a;const c=e.times[t-1],u=(e.times[t]-c)/s;let d=c+u;const p=[],v=[];for(;d1&&(r=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:r,type:i}}parseNodeProperty(e,t,r){let i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),o=t[2].replace(/^"/,"").replace(/"$/,"").trim();i==="Content"&&o===","&&(o=r.replace(/"/g,"").replace(/,$/,"").trim());const s=this.getCurrentNode();if(s.name==="Properties70"){this.parseNodeSpecialProperty(e,i,o);return}if(i==="C"){const l=o.split(",").slice(1),c=parseInt(l[0]),f=parseInt(l[1]);let u=o.split(",").slice(3);u=u.map(function(d){return d.trim().replace(/^"/,"")}),i="connections",o=[c,f],VU(o,u),s[i]===void 0&&(s[i]=[])}i==="Node"&&(s.id=o),i in s&&Array.isArray(s[i])?s[i].push(o):i!=="a"?s[i]=o:s.a=o,this.setCurrentProp(s,i),i==="a"&&o.slice(-1)!==","&&(s.a=Qp(o))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Qp(t.a))}parseNodeSpecialProperty(e,t,r){const i=r.split('",').map(function(f){return f.trim().replace(/^\"/,"").replace(/\s/,"_")}),o=i[0],s=i[1],a=i[2],l=i[3];let c=i[4];switch(s){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":c=parseFloat(c);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":c=Qp(c);break}this.getPrevNode()[o]={type:s,type2:a,flag:l,value:c},this.setCurrentProp(this.getPrevNode(),o)}}class NU{parse(e){const t=new Cx(e);t.skip(23);const r=t.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);const i=new P2;for(;!this.endOfContent(t);){const o=this.parseNode(t,r);o!==null&&i.add(o.name,o)}return i}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const r={},i=t>=7500?e.getUint64():e.getUint32(),o=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const s=e.getUint8(),a=e.getString(s);if(i===0)return null;const l=[];for(let d=0;d0?l[0]:"",f=l.length>1?l[1]:"",u=l.length>2?l[2]:"";for(r.singleProperty=o===1&&e.getOffset()===i;i>e.getOffset();){const d=this.parseNode(e,t);d!==null&&this.parseSubNode(a,r,d)}return r.propertyList=l,typeof c=="number"&&(r.id=c),f!==""&&(r.attrName=f),u!==""&&(r.attrType=u),a!==""&&(r.name=a),r}parseSubNode(e,t,r){if(r.singleProperty===!0){const i=r.propertyList[0];Array.isArray(i)?(t[r.name]=r,r.a=i):t[r.name]=i}else if(e==="Connections"&&r.name==="C"){const i=[];r.propertyList.forEach(function(o,s){s!==0&&i.push(o)}),t.connections===void 0&&(t.connections=[]),t.connections.push(i)}else if(r.name==="Properties70")Object.keys(r).forEach(function(o){t[o]=r[o]});else if(e==="Properties70"&&r.name==="P"){let i=r.propertyList[0],o=r.propertyList[1];const s=r.propertyList[2],a=r.propertyList[3];let l;i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),o.indexOf("Lcl ")===0&&(o=o.replace("Lcl ","Lcl_")),o==="Color"||o==="ColorRGB"||o==="Vector"||o==="Vector3D"||o.indexOf("Lcl_")===0?l=[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:l=r.propertyList[4],t[i]={type:o,type2:s,flag:a,value:l}}else t[r.name]===void 0?typeof r.id=="number"?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:r.name==="PoseNode"?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):t[r.name][r.id]===void 0&&(t[r.name][r.id]=r)}parseProperty(e){const t=e.getString(1);let r;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return r=e.getUint32(),e.getArrayBuffer(r);case"S":return r=e.getUint32(),e.getString(r);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=e.getUint32(),o=e.getUint32(),s=e.getUint32();if(o===0)switch(t){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}const a=wU(new Uint8Array(e.getArrayBuffer(s))),l=new Cx(a.buffer);switch(t){case"b":case"c":return l.getBooleanArray(i);case"d":return l.getFloat64Array(i);case"f":return l.getFloat32Array(i);case"i":return l.getInt32Array(i);case"l":return l.getInt64Array(i)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Cx{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let r=0;r=0&&(r=new Uint8Array(this.dv.buffer,t,i)),this._textDecoder.decode(r)}}class P2{add(e,t){this[e]=t}}function $U(n){const e="Kaydara FBX Binary \0";return n.byteLength>=e.length&&e===R2(n,0,e.length)}function UU(n){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function r(i){const o=n[i-1];return n=n.slice(t+i),t++,o}for(let i=0;i0?o[o.length-1]:"",smooth:s!==void 0?s.smooth:this.smooth,groupStart:s!==void 0?s.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(l){const c={index:typeof l=="number"?l:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return c.clone=this.clone.bind(c),c}};return this.materials.push(a),a},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(i){const o=this.currentMaterial();if(o&&o.groupEnd===-1&&(o.groupEnd=this.geometry.vertices.length/3,o.groupCount=o.groupEnd-o.groupStart,o.inherited=!1),i&&this.materials.length>1)for(let s=this.materials.length-1;s>=0;s--)this.materials[s].groupCount<=0&&this.materials.splice(s,1);return i&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),o}},r&&r.name&&typeof r.clone=="function"){const i=r.clone(0);i.inherited=!0,this.object.materials.push(i)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const r=parseInt(e,10);return(r>=0?r-1:r+t/3)*3},parseNormalIndex:function(e,t){const r=parseInt(e,10);return(r>=0?r-1:r+t/3)*3},parseUVIndex:function(e,t){const r=parseInt(e,10);return(r>=0?r-1:r+t/2)*2},addVertex:function(e,t,r){const i=this.vertices,o=this.object.geometry.vertices;o.push(i[e+0],i[e+1],i[e+2]),o.push(i[t+0],i[t+1],i[t+2]),o.push(i[r+0],i[r+1],i[r+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,r){const i=this.normals,o=this.object.geometry.normals;o.push(i[e+0],i[e+1],i[e+2]),o.push(i[t+0],i[t+1],i[t+2]),o.push(i[r+0],i[r+1],i[r+2])},addFaceNormal:function(e,t,r){const i=this.vertices,o=this.object.geometry.normals;Rx.fromArray(i,e),Jp.fromArray(i,t),Dx.fromArray(i,r),xr.subVectors(Dx,Jp),Ix.subVectors(Rx,Jp),xr.cross(Ix),xr.normalize(),o.push(xr.x,xr.y,xr.z),o.push(xr.x,xr.y,xr.z),o.push(xr.x,xr.y,xr.z)},addColor:function(e,t,r){const i=this.colors,o=this.object.geometry.colors;i[e]!==void 0&&o.push(i[e+0],i[e+1],i[e+2]),i[t]!==void 0&&o.push(i[t+0],i[t+1],i[t+2]),i[r]!==void 0&&o.push(i[r+0],i[r+1],i[r+2])},addUV:function(e,t,r){const i=this.uvs,o=this.object.geometry.uvs;o.push(i[e+0],i[e+1]),o.push(i[t+0],i[t+1]),o.push(i[r+0],i[r+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,r,i,o,s,a,l,c){const f=this.vertices.length;let u=this.parseVertexIndex(e,f),d=this.parseVertexIndex(t,f),p=this.parseVertexIndex(r,f);if(this.addVertex(u,d,p),this.addColor(u,d,p),a!==void 0&&a!==""){const v=this.normals.length;u=this.parseNormalIndex(a,v),d=this.parseNormalIndex(l,v),p=this.parseNormalIndex(c,v),this.addNormal(u,d,p)}else this.addFaceNormal(u,d,p);if(i!==void 0&&i!==""){const v=this.uvs.length;u=this.parseUVIndex(i,v),d=this.parseUVIndex(o,v),p=this.parseUVIndex(s,v),this.addUV(u,d,p),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let r=0,i=e.length;r=7?(uf.setRGB(parseFloat(u[4]),parseFloat(u[5]),parseFloat(u[6])).convertSRGBToLinear(),t.colors.push(uf.r,uf.g,uf.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));break;case"vt":t.uvs.push(parseFloat(u[1]),parseFloat(u[2]));break}}else if(f==="f"){const d=c.slice(1).trim().split(Lx),p=[];for(let m=0,g=d.length;m0){const y=_.split("/");p.push(y)}}const v=p[0];for(let m=1,g=p.length-1;m1){const d=i[1].trim().toLowerCase();t.object.smooth=d!=="0"&&d!=="off"}else t.object.smooth=!0;const u=t.object.currentMaterial();u&&(u.smooth=t.object.smooth)}else{if(c==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+c+'"')}}t.finalize();const o=new _o;if(o.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0)===!0)for(let a=0,l=t.objects.length;a0&&m.setAttribute("normal",new Je(f.normals,3)),f.colors.length>0&&(v=!0,m.setAttribute("color",new Je(f.colors,3))),f.hasUVIndices===!0&&m.setAttribute("uv",new Je(f.uvs,2));const g=[];for(let y=0,x=u.length;y1){for(let y=0,x=u.length;y0){const a=new ec({size:1,sizeAttenuation:!1}),l=new Ht;l.setAttribute("position",new Je(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(l.setAttribute("color",new Je(t.colors,3)),a.vertexColors=!0);const c=new Gp(l,a);o.add(c)}return o}}const qU=new DU;async function D2(n,e){return new Promise((t,r)=>{qU.load(n,function(i){t(i)},function(i){console.log(i.loaded/i.total*100+"% loaded"),e?.(i.loaded/i.total*100)},function(i){console.log("An error happened"),r(i)})})}new YU;let Na=null,$a=null;const Td={meshName:"shoupolySurface1",bonePrefix:"shoujoint"},Cd={meshName:"FootObject",bonePrefix:"FootBone"},kx={left_hand:Td,right_hand:Td,left_foot:Cd,right_foot:Cd};function ZU(n){return!!(n.startsWith(Td.bonePrefix)||n.startsWith(Cd.bonePrefix))}async function QU(n,e){const t=await D2(n,e),r=Q0(t,Td.meshName);r.material=new Oo,r.skeleton.bones.forEach(o=>{const s=new Me(new Ns(.2),new Yr({color:16711680,depthTest:!1,opacity:1,transparent:!0}));s.name="red_point",o.add(s)});const i=new Me(new pn(1,1,.4,32),new Yr({color:0}));return i.name="hand_mask",i.visible=!1,i.rotateZ(Math.PI/2),r.skeleton.bones[0].add(i),Na=t,t}async function JU(n,e){const t=await D2(n,e);console.log(t);const r=Q0(t,Cd.meshName);r.material=new Oo,console.log(r.skeleton.bones),r.skeleton.bones.forEach(o=>{if(o.name!=="FootBone2")return;const s=new Me(new Ns(.1),new Yr({color:16711680,depthTest:!1,opacity:1,transparent:!0}));s.name="red_point",s.translateX(-.3),o.add(s)});const i=new Me(new pn(.35,.35,.2,32),new Yr({color:0}));return i.scale.setX(.7),i.name="foot_mask",i.visible=!1,r.skeleton.bones[0].add(i),$a=t,t}function ez(n){const e=Ho.indexOf(n);return e!==-1?aU(_2[e]):0}function tz(n,e,t){const r=lU(e,t),i=new Yr({color:r??0,opacity:.6,transparent:!0}),o=new Me(new Ns(Pr),i);return o.name=e+"_link_"+t,n.add(o),o}function Ox(n,e=Pr){const t=n.name+"_joint_sphere";n.getObjectByName(t)?.scale.setScalar(e)}function I2(n,e,t,r,i=Pr,o=!1){const s=new F(0,0,0),a=e.position,l=s.distanceTo(a),c=s.clone().add(a).multiplyScalar(.5),f=a.clone().sub(s),u=new F(1,0,0),d=u.clone().cross(f),p=u.clone().angleTo(f),v=o?tz(n,t,r):n.getObjectByName(t+"_link_"+r);v.scale.copy(new F(l/2,i/Pr,i/Pr)),v.position.copy(c),v.setRotationFromAxisAngle(d.normalize(),p),Ox(n,i),Ox(e,i)}function nz(n,e,t=Pr,r=!1){I2(n,e,n.name,e.name,t,r)}function k2(n,e,t){const r=new Me(new Ns(e),new Yr({color:t}));return r.name=n,r}function fs(n,e=0,t=0,r=0){const i=new _o;return i.name=n,i.translateX(e),i.translateY(t),i.translateZ(r),i}function hn(n,e=0,t=0,r=0,i=Pr){return fs(n,e,t,r).add(k2(n+"_joint_sphere",i,ez(n)))}let Pd=null;function ff(){return Pd?Qa(Pd):null}const ms=2.2,gs=.25;function Fx(n){if(!Na||!$a)throw new Error("Failed to create body");if(n==="right_hand"){const e=Qa(Na);return e.name="right_hand",e.translateX(-.4),e.translateY(3),e.rotateY(Math.PI),e.rotateZ(-Math.PI/2),e.scale.multiplyScalar(ms),e.traverse(t=>{hi(t.name)&&(t.name=t.name+"_R")}),e}else{const e=Qa(Na);return e.name="left_hand",e.scale.x=-1,e.translateX(.4),e.translateY(3),e.rotateY(Math.PI),e.rotateZ(Math.PI/2),e.scale.multiplyScalar(ms),e.traverse(t=>{hi(t.name)&&(t.name=t.name+"_L")}),e}}function Nx(n){if(!Na||!$a)throw new Error("Failed to create body");if(n==="right_foot"){const e=Qa($a);return e.name="right_foot",e.scale.setX(-1),e.scale.multiplyScalar(gs),e.traverse(t=>{hi(t.name)&&(t.name=t.name+"_R")}),e}else{const e=Qa($a);return e.name="left_foot",e.scale.multiplyScalar(gs),e.traverse(t=>{hi(t.name)&&(t.name=t.name+"_L")}),e}}function rz(){if(!Na||!$a)throw new Error("Failed to create body");const n=34,e=46,t=fs("torso",0,115,0).add(k2("center",Pr,8947848),fs("five",0,e/2,0).add(hn("neck").add(hn("nose",0,20,14).add(hn("right_eye",-3,3,-3).add(hn("right_ear",-4,-3,-8)),hn("left_eye",3,3,-3).add(hn("left_ear",4,-3,-8)))),fs("left_shoulder_inner").add(hn("right_shoulder",-n/2,0,0).add(hn("right_elbow",0,-25,0).add(hn("right_wrist",0,-25,0).add(Fx("right_hand"))))),fs("right_shoulder_inner").add(hn("left_shoulder",n/2,0,0).add(hn("left_elbow",0,-25,0).add(hn("left_wrist",0,-25,0).add(Fx("left_hand"))))),fs("right_hip_inner").add(hn("right_hip",-n/2+7,-e,0).add(hn("right_knee",0,-40,0).add(hn("right_ankle",0,-36,0).add(Nx("right_foot"))))),fs("left_hip_inner").add(hn("left_hip",n/2-7,-e,0).add(hn("left_knee",0,-40,0).add(hn("left_ankle",0,-36,0).add(Nx("left_foot")))))));new wn(t).Create(),Pd=t}function df(n,e,t){const r=new Me(new Jt(Pr*5,Pr*5,Pr*5),new Yr({color:35071,transparent:!0,opacity:.5})),i=v2(e);return r.position.copy(rU(n,i)),r.name=t,r}function iz(n){return n.name in kx?Q0(n,kx[n.name].meshName):null}function O2(n){return["right_shoulder_inner","left_shoulder_inner","right_hip_inner","left_hip_inner","five"].includes(n)}function oz(n){return!!(Ho.includes(n)||n==="right_hand"||n==="left_hand"||n==="right_foot"||n==="left_foot"||O2(n)||hi(n)||n.includes("_joint_sphere")||n.includes("_link_"))}function hi(n){return ZU(n)}const sz=["torso","nose","neck","right_shoulder","left_shoulder","right_elbow","left_elbow","right_hip","left_hip","right_knee","left_knee","right_shoulder_inner","left_shoulder_inner","right_hip_inner","left_hip_inner","left_wrist_target","right_wrist_target","left_ankle_target","right_ankle_target"];function hf(n,e=!1){return!!(e&&Ho.includes(n)||sz.includes(n)||hi(n))}function pf(n,e=!1){return e?["right_shoulder_inner","left_shoulder_inner","right_hip_inner","left_hip_inner","neck"].includes(n)==!1:!!n.endsWith("_target")}function $x(n){return!!n.endsWith("_target")}function mf(n){return["left_hand","right_hand"].includes(n)}function az(n){return["left_foot","right_foot"].includes(n)}function Ux(n){return["foot_mask","hand_mask"].includes(n)}function lz(n){return!!(n=="torso"||Ho.includes(n)||O2(n)||n.includes("_joint_sphere")||n.includes("_link_"))}function gf(n){return["left_hand","right_hand","left_foot","right_foot"].includes(n)}const cz=[...y2,"left_shoulder_inner","right_shoulder_inner","left_hip_inner","right_hip_inner","five","right_hand","left_hand","left_foot","right_foot","torso","left_wrist_target","right_wrist_target","left_ankle_target","right_ankle_target"];class wn{body;part={};constructor(e){this.body=e,this.body.traverse(t=>{cz.includes(t.name)&&(this.part[t.name]=t)}),this.part.left_shoulder_inner=this.getObjectByName("left_shoulder_inner"),this.part.right_shoulder_inner=this.getObjectByName("right_shoulder_inner"),this.part.left_hip_inner=this.getObjectByName("left_hip_inner"),this.part.right_hip_inner=this.getObjectByName("right_hip_inner"),this.part.five=this.getObjectByName("five"),this.part.right_hand=this.getObjectByName("right_hand"),this.part.left_hand=this.getObjectByName("left_hand"),this.part.right_foot=this.getObjectByName("right_foot"),this.part.left_foot=this.getObjectByName("left_foot"),this.part.torso=this.body}getObjectByName(e){const t=this.body.getObjectByName(e);if(!t)throw new Error(`Not found part: ${e}`);return t}getWorldPosition(e){const t=new F;return e.getWorldPosition(t),t}UpdateLink(e,t=this.BoneThickness,r=!1){["left_hip","right_hip","right_shoulder","left_shoulder"].includes(e)?I2(this.part[`${e}_inner`],this.part[e],"neck",e,t,r):e!=="neck"&&Ho.includes(e)&&nz(this.part[e].parent,this.part[e],t,r)}get HeadSize(){return this.getWorldPosition(this.part.right_ear).distanceTo(this.getWorldPosition(this.part.left_ear))}set HeadSize(e){const t=e/this.HeadSize,r=this.part.left_ear.position.length()*t,i=this.part.left_eye.position.length()*t;this.part.left_ear.position.normalize().multiplyScalar(r),this.part.right_ear.position.normalize().multiplyScalar(r),this.part.left_eye.position.normalize().multiplyScalar(i),this.part.right_eye.position.normalize().multiplyScalar(i),this.UpdateLink("left_eye"),this.UpdateLink("right_eye"),this.UpdateLink("left_ear"),this.UpdateLink("right_ear")}get NoseToNeck(){return this.part.nose.position.length()}set NoseToNeck(e){this.part.nose.position.normalize().multiplyScalar(e),this.UpdateLink("nose")}get ShoulderToHip(){return this.getDistanceOf(this.getWorldPosition(this.part.five),this.getMidpoint(this.getWorldPosition(this.part.left_hip),this.getWorldPosition(this.part.right_hip)))}set ShoulderToHip(e){const t=this.ShoulderToHip;this.part.five.position.normalize().multiplyScalar(e/2),this.part.left_hip.position.multiplyScalar(e/t),this.part.right_hip.position.multiplyScalar(e/t),this.UpdateLink("left_hip"),this.UpdateLink("right_hip")}get ShoulderWidth(){return this.part.left_shoulder.position.distanceTo(this.part.right_shoulder.position)}set ShoulderWidth(e){const t=this.part.right_shoulder;t.position.x=-e/2;const r=this.part.left_shoulder;r.position.x=e/2,this.UpdateLink("right_shoulder"),this.UpdateLink("left_shoulder")}get UpperArm(){return this.part.left_elbow.position.length()}set UpperArm(e){this.part.left_elbow.position.normalize().multiplyScalar(e),this.part.right_elbow.position.normalize().multiplyScalar(e),this.UpdateLink("left_elbow"),this.UpdateLink("right_elbow")}get Forearm(){return this.part.left_wrist.position.length()}set Forearm(e){this.part.left_wrist.position.normalize().multiplyScalar(e),this.part.right_wrist.position.normalize().multiplyScalar(e),this.UpdateLink("left_wrist"),this.UpdateLink("right_wrist")}get ArmLength(){return this.UpperArm+this.Forearm}set ArmLength(e){const t=this.ArmLength;this.UpperArm=e*this.UpperArm/t,this.Forearm=e*this.Forearm/t}get Thigh(){return this.part.left_knee.position.length()}set Thigh(e){this.part.left_knee.position.normalize().multiplyScalar(e),this.part.right_knee.position.normalize().multiplyScalar(e),this.UpdateLink("left_knee"),this.UpdateLink("right_knee")}get HandSize(){return Math.abs(this.part.left_hand.scale.x)/ms}set HandSize(e){const t=this.HandSize;this.part.left_hand.scale.divideScalar(t*ms).multiplyScalar(e*ms),this.part.right_hand.scale.divideScalar(t*ms).multiplyScalar(e*ms)}get Hips(){return this.getDistanceOf(this.getWorldPosition(this.part.left_hip),this.getWorldPosition(this.part.right_hip))}set Hips(e){const t=this.getWorldPosition(this.part.left_hip),r=this.getWorldPosition(this.part.right_hip),i=this.getMidpoint(t,r),o=t.sub(i).normalize().multiplyScalar(e/2).add(i),s=r.sub(i).normalize().multiplyScalar(e/2).add(i);this.setPositionFromWorld(this.part.left_hip,o),this.setPositionFromWorld(this.part.right_hip,s),this.UpdateLink("left_hip"),this.UpdateLink("right_hip")}get LowerLeg(){return this.part.left_ankle.position.length()}set LowerLeg(e){this.part.left_ankle.position.normalize().multiplyScalar(e),this.part.right_ankle.position.normalize().multiplyScalar(e),this.UpdateLink("left_ankle"),this.UpdateLink("right_ankle")}get LegLength(){return this.Thigh+this.LowerLeg}set LegLength(e){const t=this.LegLength;this.Thigh=e*this.Thigh/t,this.LowerLeg=e*this.LowerLeg/t}get FootSize(){return Math.abs(this.part.left_foot.scale.x)/gs}set FootSize(e){const t=this.FootSize;this.part.left_foot.scale.divideScalar(t*gs).multiplyScalar(e*gs),this.part.right_foot.scale.divideScalar(t*gs).multiplyScalar(e*gs)}getLocalPosition(e,t){return e.worldToLocal(t.clone())}setPositionFromWorld(e,t){return e.position.copy(this.getLocalPosition(e.parent,t))}getDirectionVectorByParentOf(e,t,r){const i=this.part[e].parent,o=this.getLocalPosition(i,t);return this.getLocalPosition(i,r).clone().sub(o).normalize()}rotateTo(e,t){const r=this.part[e],i=r.position.clone().normalize(),o=i.clone().cross(t),s=i.clone().angleTo(t);r.parent?.rotateOnAxis(o.normalize(),s)}rotateTo3(e,t,r){this.rotateTo(e,this.getDirectionVectorByParentOf(e,t,r))}setPositionByDistance(e,t,r){const i=this.getDistanceOf(t,r);this.part[e].position.normalize().multiplyScalar(i)}setDirectionVector(e,t){const r=this.part[e].position.length();this.part[e].position.copy(t).multiplyScalar(r),this.UpdateLink(e)}getDistanceOf(e,t){return e.distanceTo(t)}getMidpoint(e,t){return e.clone().add(t).multiplyScalar(.5)}ResetPose(){Pd?.traverse(e=>{if(e.name in this.part){const t=e.name;t=="torso"?this.part[t].position.setY(e.position.y):this.part[t].position.copy(e.position),this.part[t].rotation.copy(e.rotation),this.part[t].scale.copy(e.scale),this.UpdateLink(t)}})}SetBlazePose(e){this.ResetPose();const t=Object.fromEntries(Object.entries(cU).map(([i,o])=>[i,new F().fromArray(e[o]??[0,0,0])])),r=[["five",[this.getMidpoint(this.getMidpoint(t.left_hip,t.right_hip),this.getMidpoint(t.left_shoulder,t.right_shoulder)),this.getMidpoint(t.left_shoulder,t.right_shoulder)]],["left_shoulder",[this.getMidpoint(t.left_shoulder,t.right_shoulder),"left_shoulder"]],["left_elbow",["left_shoulder","left_elbow"]],["left_wrist",["left_elbow","left_wrist"]],["left_hip",[this.getMidpoint(t.left_shoulder,t.right_shoulder),"left_hip"]],["left_knee",["left_hip","left_knee"]],["left_ankle",["left_knee","left_ankle"]],["right_shoulder",[this.getMidpoint(t.left_shoulder,t.right_shoulder),"right_shoulder"]],["right_elbow",["right_shoulder","right_elbow"]],["right_wrist",["right_elbow","right_wrist"]],["right_hip",[this.getMidpoint(t.left_shoulder,t.right_shoulder),"right_hip"]],["right_knee",["right_hip","right_knee"]],["right_ankle",["right_knee","right_ankle"]],["nose",[this.getMidpoint(t.left_shoulder,t.right_shoulder),"nose"]],["left_eye",["nose","left_eye"]],["right_eye",["nose","right_eye"]],["left_ear",["left_eye","left_ear"]],["right_ear",["right_eye","right_ear"]]];for(const[i,[o,s]]of r)this.rotateTo3(i,o instanceof F?o:t[o],s instanceof F?s:t[s]),this.setPositionByDistance(i,o instanceof F?o:t[o],s instanceof F?s:t[s]),this.UpdateLink(i);this.Update()}SetPose(e){this.ResetPose();const t=Object.fromEntries(Object.entries(x2).map(([i,o])=>[i,new F().fromArray(e[o]??[0,0,0])]));this.part.torso.position.setY(this.getMidpoint(t.Hips,t.Chest).y),this.Hips=this.getDistanceOf(t.Hips,t.UpLeg_L)*2,this.Thigh=this.getDistanceOf(t.UpLeg_L,t.Leg_L),this.LowerLeg=this.getDistanceOf(t.Leg_L,t.Foot_L),this.UpperArm=this.getDistanceOf(t.Arm_L,t.ForeArm_L),this.Forearm=this.getDistanceOf(t.ForeArm_L,t.Hand_L),this.ShoulderWidth=2*(this.getDistanceOf(t.Shoulder_L,t.Arm_L)+this.getDistanceOf(t.Chest,t.Shoulder_L)/Math.SQRT2);const r=[["five",["Hips","Chest"]],["left_elbow",["Arm_L","ForeArm_L"]],["left_wrist",["ForeArm_L","Hand_L"]],["left_knee",["UpLeg_L","Leg_L"]],["left_ankle",["Leg_L","Foot_L"]],["right_elbow",["Arm_R","ForeArm_R"]],["right_wrist",["ForeArm_R","Hand_R"]],["right_knee",["UpLeg_R","Leg_R"]],["right_ankle",["Leg_R","Foot_R"]]];for(const[i,[o,s]]of r)this.rotateTo(i,this.getDirectionVectorByParentOf(i,t[o],t[s]));this.Update()}GetHandData(e){const t=this.part[e],r={child:{}};return t.traverse(i=>{if(i.name&&hi(i.name)){i.name in r.child&&console.log("Duplicate name",i.name,i);const o={};this.getDistanceOf(i.position,new F(0,0,0))!=0&&(o.position=i.position.toArray()),this.getDistanceOf(i.scale,new F(1,1,1))!=0&&(o.scale=i.scale.toArray()),(i.rotation.x!==0||i.rotation.y!==0||i.rotation.z!==0)&&(o.rotation=i.rotation.toArray()),o&&(r.child[i.name]=o)}}),r}RestoreHand(e,t){t.child=Object.fromEntries(Object.entries(t.child).map(([r,i])=>e=="left_hand"?[r.replace("_R","_L"),i]:e=="right_hand"?[r.replace("_L","_R"),i]:[r,i])),this.part[e]?.traverse(r=>{if(r.name&&r.name in t.child){const i=t.child[r.name];i.position&&r.position.fromArray(i.position),i.rotation&&r.rotation.fromArray(i.rotation),i.scale&&r.scale.fromArray(i.scale)}})}GetBodyData(){const e=this.part.torso,t={position:e.position.toArray(),rotation:e.rotation.toArray(),scale:e.scale.toArray(),child:{}};return e.traverse(r=>{if(r.name&&oz(r.name)){r.name in t.child&&console.log("Duplicate name",r.name,r);const i={};this.getDistanceOf(r.position,new F(0,0,0))!=0&&(i.position=r.position.toArray()),this.getDistanceOf(r.scale,new F(1,1,1))!=0&&(i.scale=r.scale.toArray()),(r.rotation.x!==0||r.rotation.y!==0||r.rotation.z!==0)&&(i.rotation=r.rotation.toArray()),i&&(t.child[r.name]=i)}}),t}RestoreBody(e){const t=this.part.torso;t?.traverse(r=>{if(r.name&&r.name in e.child){const i=e.child[r.name];i.position&&r.position.fromArray(i.position),i.rotation&&r.rotation.fromArray(i.rotation),i.scale&&r.scale.fromArray(i.scale)}}),e.position&&t.position.fromArray(e.position),e.rotation&&t.rotation.fromArray(e.rotation),e.scale&&t.scale.fromArray(e.scale)}UpdateBones(e=this.BoneThickness){this.part.torso.traverse(t=>{if(t.name in this.part){const r=t.name;this.UpdateLink(r,e)}})}CreateBones(e=this.BoneThickness){this.part.torso.traverse(t=>{if(t.name in this.part){const r=t.name;this.UpdateLink(r,e,!0)}})}Create(){this.CreateBones(),this.part.torso.add(df(this.part.torso,this.part.left_wrist,"left_wrist_target")),this.part.torso.add(df(this.part.torso,this.part.right_wrist,"right_wrist_target")),this.part.torso.add(df(this.part.torso,this.part.left_ankle,"left_ankle_target")),this.part.torso.add(df(this.part.torso,this.part.right_ankle,"right_ankle_target"))}Get18keyPointsData(){return Ho.map(e=>e in this.part?this.getWorldPosition(this.part[e]).toArray():[0,0,0])}get BoneThickness(){return Math.abs(this.part.neck.getObjectByName("neck_joint_sphere")?.scale.x??Pr)}set BoneThickness(e){this.UpdateBones(e)}GetIKSolver(){return new oU([{target:this.part.left_wrist_target,effector:this.part.left_wrist,links:[{index:this.part.left_elbow,enabled:!0},{index:this.part.left_shoulder,enabled:!0}],iteration:10,minAngle:0,maxAngle:1},{target:this.part.right_wrist_target,effector:this.part.right_wrist,links:[{index:this.part.right_elbow,enabled:!0},{index:this.part.right_shoulder,enabled:!0}],iteration:10,minAngle:0,maxAngle:1},{target:this.part.left_ankle_target,effector:this.part.left_ankle,links:[{index:this.part.left_knee,enabled:!0},{index:this.part.left_hip,enabled:!0}],iteration:10,minAngle:0,maxAngle:1},{target:this.part.right_ankle_target,effector:this.part.right_ankle,links:[{index:this.part.right_knee,enabled:!0},{index:this.part.right_hip,enabled:!0}],iteration:10,minAngle:0,maxAngle:1}])}ResetTargetPosition(e,t){const r=this.part.torso,i=this.part[e],o=this.part[t],s=v2(i);o.position.copy(this.getLocalPosition(r,s))}ResetAllTargetsPosition(){this.ResetTargetPosition("left_wrist","left_wrist_target"),this.ResetTargetPosition("right_wrist","right_wrist_target"),this.ResetTargetPosition("left_ankle","left_ankle_target"),this.ResetTargetPosition("right_ankle","right_ankle_target")}Update(){this.ResetAllTargetsPosition(),this.UpdateBones(),this.part.torso.updateMatrixWorld(!0)}}const uz="AlertDialog",[fz,V7]=vi(uz,[Rb]),au=Rb(),dz=n=>{const{__scopeAlertDialog:e,...t}=n,r=au(e);return b.createElement(Nb,Se({},r,t,{modal:!0}))},hz=n=>{const{__scopeAlertDialog:e,...t}=n,r=au(e);return b.createElement($b,Se({},r,t))},pz=b.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...r}=n,i=au(t);return b.createElement(Ub,Se({},i,r,{ref:e}))}),F2="AlertDialogContent",[mz,H7]=fz(F2),gz=b.forwardRef((n,e)=>{const{__scopeAlertDialog:t,children:r,...i}=n,o=au(t),s=b.useRef(null),a=Ot(e,s),l=b.useRef(null);return b.createElement(GP,{contentName:F2,titleName:vz,docsSlug:"alert-dialog"},b.createElement(mz,{scope:t,cancelRef:l},b.createElement(zb,Se({role:"alertdialog"},o,i,{ref:a,onOpenAutoFocus:Ve(i.onOpenAutoFocus,c=>{var f;c.preventDefault(),(f=l.current)===null||f===void 0||f.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault()}),b.createElement(gb,null,r),!1)))}),vz="AlertDialogTitle",yz=b.forwardRef((n,e)=>{const{__scopeAlertDialog:t,...r}=n,i=au(t);return b.createElement(Bb,Se({},i,r,{ref:e}))}),_z=dz,xz=hz,wz=pz,Sz=gz,bz=yz,Mz="_AlertDialogOverlay_4rriq_6",Ez="_overlayShow_4rriq_1",Tz="_AlertDialogContent_4rriq_14",Cz="_contentShow_4rriq_1",Pz="_AlertDialogTitle_4rriq_34",Az={AlertDialogOverlay:Mz,overlayShow:Ez,AlertDialogContent:Tz,contentShow:Cz,AlertDialogTitle:Pz,"lds-roller":"_lds-roller_4rriq_64"},{AlertDialogOverlay:Lz,AlertDialogContent:Rz,AlertDialogTitle:Dz,"lds-roller":Iz}=Az;function kz(){return qe("div",{className:Iz,children:[fe("div",{}),fe("div",{}),fe("div",{}),fe("div",{}),fe("div",{}),fe("div",{}),fe("div",{}),fe("div",{})]})}const J0=xi.create(({title:n})=>{const e=Oz();return fe(_z,{defaultOpen:!0,open:e.visible,children:qe(xz,{children:[fe(wz,{className:Lz}),fe(Sz,{className:Rz,children:qe(bz,{className:Dz,children:[fe(kz,{}),n]})})]})})});function Oz(){return ol(J0)}function Cg(n=0){const e=uL(t=>{xi.show(J0,t)},n);return{show:t=>{e(t)},hide:()=>{e.cancel(),Fz()}}}function Fz(){xi.hide(J0)}function fo(n){const e=n?.stack,t=`${ge.t("Something went wrong!")} ${e||n}`;xL({title:ge.t("Oops...")??"",description:t,children:fe("a",{href:"https://github.com/nonnonstop/sd-webui-3d-open-pose-editor/issues/new/choose",children:ge.t("If the problem persists, please click here to ask a question.")}),button:ge.t("Close")??""})}const N2=b.forwardRef((n,e)=>b.createElement(vt.span,Se({},n,{ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...n.style}}))),$2="ToastProvider",[ev,Nz,$z]=tu("Toast"),[U2,G7]=vi("Toast",[$z]),[Uz,ph]=U2($2),z2=n=>{const{__scopeToast:e,label:t="Notification",duration:r=5e3,swipeDirection:i="right",swipeThreshold:o=50,children:s}=n,[a,l]=b.useState(null),[c,f]=b.useState(0),u=b.useRef(!1),d=b.useRef(!1);return b.createElement(ev.Provider,{scope:e},b.createElement(Uz,{scope:e,label:t,duration:r,swipeDirection:i,swipeThreshold:o,toastCount:c,viewport:a,onViewportChange:l,onToastAdd:b.useCallback(()=>f(p=>p+1),[]),onToastRemove:b.useCallback(()=>f(p=>p-1),[]),isFocusedToastEscapeKeyDownRef:u,isClosePausedRef:d},s))};z2.propTypes={label(n){if(n.label&&typeof n.label=="string"&&!n.label.trim()){const e=`Invalid prop \`label\` supplied to \`${$2}\`. Expected non-empty \`string\`.`;return new Error(e)}return null}};const zz="ToastViewport",Bz=["F8"],Pg="toast.viewportPause",Ag="toast.viewportResume",Vz=b.forwardRef((n,e)=>{const{__scopeToast:t,hotkey:r=Bz,label:i="Notifications ({hotkey})",...o}=n,s=ph(zz,t),a=Nz(t),l=b.useRef(null),c=b.useRef(null),f=b.useRef(null),u=b.useRef(null),d=Ot(e,u,s.onViewportChange),p=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),v=s.toastCount>0;b.useEffect(()=>{const g=_=>{var y;r.every(S=>_[S]||_.code===S)&&((y=u.current)===null||y===void 0||y.focus())};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]),b.useEffect(()=>{const g=l.current,_=u.current;if(v&&g&&_){const y=()=>{if(!s.isClosePausedRef.current){const C=new CustomEvent(Pg);_.dispatchEvent(C),s.isClosePausedRef.current=!0}},x=()=>{if(s.isClosePausedRef.current){const C=new CustomEvent(Ag);_.dispatchEvent(C),s.isClosePausedRef.current=!1}},S=C=>{!g.contains(C.relatedTarget)&&x()},T=()=>{g.contains(document.activeElement)||x()};return g.addEventListener("focusin",y),g.addEventListener("focusout",S),g.addEventListener("pointermove",y),g.addEventListener("pointerleave",T),window.addEventListener("blur",y),window.addEventListener("focus",x),()=>{g.removeEventListener("focusin",y),g.removeEventListener("focusout",S),g.removeEventListener("pointermove",y),g.removeEventListener("pointerleave",T),window.removeEventListener("blur",y),window.removeEventListener("focus",x)}}},[v,s.isClosePausedRef]);const m=b.useCallback(({tabbingDirection:g})=>{const y=a().map(x=>{const S=x.ref.current,T=[S,...iB(S)];return g==="forwards"?T:T.reverse()});return(g==="forwards"?y.reverse():y).flat()},[a]);return b.useEffect(()=>{const g=u.current;if(g){const _=y=>{const x=y.altKey||y.ctrlKey||y.metaKey;if(y.key==="Tab"&&!x){const E=document.activeElement,A=y.shiftKey;if(y.target===g&&A){var T;(T=c.current)===null||T===void 0||T.focus();return}const ee=m({tabbingDirection:A?"backwards":"forwards"}),H=ee.findIndex(R=>R===E);if(em(ee.slice(H+1)))y.preventDefault();else{var C,L;A?(C=c.current)===null||C===void 0||C.focus():(L=f.current)===null||L===void 0||L.focus()}}};return g.addEventListener("keydown",_),()=>g.removeEventListener("keydown",_)}},[a,m]),b.createElement(NC,{ref:l,role:"region","aria-label":i.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:v?void 0:"none"}},v&&b.createElement(zx,{ref:c,onFocusFromOutsideViewport:()=>{const g=m({tabbingDirection:"forwards"});em(g)}}),b.createElement(ev.Slot,{scope:t},b.createElement(vt.ol,Se({tabIndex:-1},o,{ref:d}))),v&&b.createElement(zx,{ref:f,onFocusFromOutsideViewport:()=>{const g=m({tabbingDirection:"backwards"});em(g)}}))}),Hz="ToastFocusProxy",zx=b.forwardRef((n,e)=>{const{__scopeToast:t,onFocusFromOutsideViewport:r,...i}=n,o=ph(Hz,t);return b.createElement(N2,Se({"aria-hidden":!0,tabIndex:0},i,{ref:e,style:{position:"fixed"},onFocus:s=>{var a;const l=s.relatedTarget;!((a=o.viewport)!==null&&a!==void 0&&a.contains(l))&&r()}}))}),mh="Toast",Gz="toast.swipeStart",Wz="toast.swipeMove",jz="toast.swipeCancel",Xz="toast.swipeEnd",Kz=b.forwardRef((n,e)=>{const{forceMount:t,open:r,defaultOpen:i,onOpenChange:o,...s}=n,[a=!0,l]=el({prop:r,defaultProp:i,onChange:o});return b.createElement(yi,{present:t||a},b.createElement(B2,Se({open:a},s,{ref:e,onClose:()=>l(!1),onPause:Hn(n.onPause),onResume:Hn(n.onResume),onSwipeStart:Ve(n.onSwipeStart,c=>{c.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ve(n.onSwipeMove,c=>{const{x:f,y:u}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","move"),c.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${u}px`)}),onSwipeCancel:Ve(n.onSwipeCancel,c=>{c.currentTarget.setAttribute("data-swipe","cancel"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ve(n.onSwipeEnd,c=>{const{x:f,y:u}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","end"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${u}px`),l(!1)})})))}),[Yz,qz]=U2(mh,{onClose(){}}),B2=b.forwardRef((n,e)=>{const{__scopeToast:t,type:r="foreground",duration:i,open:o,onClose:s,onEscapeKeyDown:a,onPause:l,onResume:c,onSwipeStart:f,onSwipeMove:u,onSwipeCancel:d,onSwipeEnd:p,...v}=n,m=ph(mh,t),[g,_]=b.useState(null),y=Ot(e,R=>_(R)),x=b.useRef(null),S=b.useRef(null),T=i||m.duration,C=b.useRef(0),L=b.useRef(T),E=b.useRef(0),{onToastAdd:A,onToastRemove:I}=m,q=Hn(()=>{var R;g?.contains(document.activeElement)&&((R=m.viewport)===null||R===void 0||R.focus()),s()}),ee=b.useCallback(R=>{!R||R===1/0||(window.clearTimeout(E.current),C.current=new Date().getTime(),E.current=window.setTimeout(q,R))},[q]);b.useEffect(()=>{const R=m.viewport;if(R){const N=()=>{ee(L.current),c?.()},Z=()=>{const K=new Date().getTime()-C.current;L.current=L.current-K,window.clearTimeout(E.current),l?.()};return R.addEventListener(Pg,Z),R.addEventListener(Ag,N),()=>{R.removeEventListener(Pg,Z),R.removeEventListener(Ag,N)}}},[m.viewport,T,l,c,ee]),b.useEffect(()=>{o&&!m.isClosePausedRef.current&&ee(T)},[o,T,m.isClosePausedRef,ee]),b.useEffect(()=>(A(),()=>I()),[A,I]);const H=b.useMemo(()=>g?G2(g):null,[g]);return m.viewport?b.createElement(b.Fragment,null,H&&b.createElement(Zz,{__scopeToast:t,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0},H),b.createElement(Yz,{scope:t,onClose:q},Fo.createPortal(b.createElement(ev.ItemSlot,{scope:t},b.createElement(FC,{asChild:!0,onEscapeKeyDown:Ve(a,()=>{m.isFocusedToastEscapeKeyDownRef.current||q(),m.isFocusedToastEscapeKeyDownRef.current=!1})},b.createElement(vt.li,Se({role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":m.swipeDirection},v,{ref:y,style:{userSelect:"none",touchAction:"none",...n.style},onKeyDown:Ve(n.onKeyDown,R=>{R.key==="Escape"&&(a?.(R.nativeEvent),R.nativeEvent.defaultPrevented||(m.isFocusedToastEscapeKeyDownRef.current=!0,q()))}),onPointerDown:Ve(n.onPointerDown,R=>{R.button===0&&(x.current={x:R.clientX,y:R.clientY})}),onPointerMove:Ve(n.onPointerMove,R=>{if(!x.current)return;const N=R.clientX-x.current.x,Z=R.clientY-x.current.y,K=Boolean(S.current),B=["left","right"].includes(m.swipeDirection),$=["left","up"].includes(m.swipeDirection)?Math.min:Math.max,W=B?$(0,N):0,ie=B?0:$(0,Z),j=R.pointerType==="touch"?10:2,se={x:W,y:ie},ue={originalEvent:R,delta:se};K?(S.current=se,vf(Wz,u,ue,{discrete:!1})):Bx(se,m.swipeDirection,j)?(S.current=se,vf(Gz,f,ue,{discrete:!1}),R.target.setPointerCapture(R.pointerId)):(Math.abs(N)>j||Math.abs(Z)>j)&&(x.current=null)}),onPointerUp:Ve(n.onPointerUp,R=>{const N=S.current,Z=R.target;if(Z.hasPointerCapture(R.pointerId)&&Z.releasePointerCapture(R.pointerId),S.current=null,x.current=null,N){const K=R.currentTarget,B={originalEvent:R,delta:N};Bx(N,m.swipeDirection,m.swipeThreshold)?vf(Xz,p,B,{discrete:!0}):vf(jz,d,B,{discrete:!0}),K.addEventListener("click",$=>$.preventDefault(),{once:!0})}})})))),m.viewport))):null});B2.propTypes={type(n){if(n.type&&!["foreground","background"].includes(n.type)){const e=`Invalid prop \`type\` supplied to \`${mh}\`. Expected \`foreground | background\`.`;return new Error(e)}return null}};const Zz=n=>{const{__scopeToast:e,children:t,...r}=n,i=ph(mh,e),[o,s]=b.useState(!1),[a,l]=b.useState(!1);return nB(()=>s(!0)),b.useEffect(()=>{const c=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(c)},[]),a?null:b.createElement(Kd,{asChild:!0},b.createElement(N2,r,o&&b.createElement(b.Fragment,null,i.label," ",t)))},Qz=b.forwardRef((n,e)=>{const{__scopeToast:t,...r}=n;return b.createElement(vt.div,Se({},r,{ref:e}))}),Jz="ToastAction",V2=b.forwardRef((n,e)=>{const{altText:t,...r}=n;return t?b.createElement(H2,{altText:t,asChild:!0},b.createElement(tB,Se({},r,{ref:e}))):null});V2.propTypes={altText(n){return n.altText?null:new Error(`Missing prop \`altText\` expected on \`${Jz}\``)}};const eB="ToastClose",tB=b.forwardRef((n,e)=>{const{__scopeToast:t,...r}=n,i=qz(eB,t);return b.createElement(H2,{asChild:!0},b.createElement(vt.button,Se({type:"button"},r,{ref:e,onClick:Ve(n.onClick,i.onClose)})))}),H2=b.forwardRef((n,e)=>{const{__scopeToast:t,altText:r,...i}=n;return b.createElement(vt.div,Se({"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0},i,{ref:e}))});function G2(n){const e=[];return Array.from(n.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),rB(r)){const i=r.ariaHidden||r.hidden||r.style.display==="none",o=r.dataset.radixToastAnnounceExclude==="";if(!i)if(o){const s=r.dataset.radixToastAnnounceAlt;s&&e.push(s)}else e.push(...G2(r))}}),e}function vf(n,e,t,{discrete:r}){const i=t.originalEvent.currentTarget,o=new CustomEvent(n,{bubbles:!0,cancelable:!0,detail:t});e&&i.addEventListener(n,e,{once:!0}),r?M0(i,o):i.dispatchEvent(o)}const Bx=(n,e,t=0)=>{const r=Math.abs(n.x),i=Math.abs(n.y),o=r>i;return e==="left"||e==="right"?o&&r>t:!o&&i>t};function nB(n=()=>{}){const e=Hn(n);ki(()=>{let t=0,r=0;return t=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(t),window.cancelAnimationFrame(r)}},[e])}function rB(n){return n.nodeType===n.ELEMENT_NODE}function iB(n){const e=[],t=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)e.push(t.currentNode);return e}function em(n){const e=document.activeElement;return n.some(t=>t===e?!0:(t.focus(),document.activeElement!==e))}const oB=z2,sB=Vz,aB=Kz,lB=Qz,cB=V2,uB="_ToastViewport_1gbkr_7",fB="_ToastRoot_1gbkr_25",dB="_slideIn_1gbkr_1",hB="_hide_1gbkr_1",pB="_swipeOut_1gbkr_1",mB="_ToastTitle_1gbkr_81",gB="_ToastDescription_1gbkr_89",vB="_ToastAction_1gbkr_97",yB="_Button_1gbkr_101",_B="_small_1gbkr_109",xB="_large_1gbkr_115",wB="_violet_1gbkr_121",SB="_green_1gbkr_132",bB={ToastViewport:uB,ToastRoot:fB,slideIn:dB,hide:hB,swipeOut:pB,ToastTitle:mB,ToastDescription:gB,ToastAction:vB,Button:yB,small:_B,large:xB,violet:wB,green:SB},{ToastViewport:MB,ToastRoot:EB,ToastTitle:TB,ToastAction:CB,Button:PB,small:AB,green:LB}=bB,W2=xi.create(({title:n,button:e,duration:t=3e3})=>{const r=RB();return qe(oB,{swipeDirection:"right",duration:t,children:[qe(aB,{className:EB,defaultOpen:!0,open:r.visible,onOpenChange:i=>{i==!1&&r.hide()},children:[fe(lB,{className:TB,children:n}),e?fe(cB,{className:CB,asChild:!0,altText:"",children:fe("button",{className:Yn(PB,AB,LB),onClick:()=>{r.resolve("action"),r.hide()},children:e})}):void 0]}),fe(sB,{className:MB})]})});function RB(){return ol(W2)}async function Li(n){return await xi.show(W2,n)}const Uf=[];function DB(n,e){return n=Math.ceil(n),e=Math.floor(e),Math.floor(Math.random()*(e-n+1))+n}function Vx(){return Uf?Uf[DB(0,Uf.length-1)]:null}async function IB(n){const t=await(await fetch(n)).arrayBuffer();console.log(t.byteLength);const r=new Int32Array(t),i=Object.keys(x2).length;for(let o=0;o[l*100,-c*100,-f*100]);await this.editor.SetBlazePose(a);return}}catch(i){return r.hide(),fo(ge.t("If you try to detect anime characters, you may get an error. Please try again with photos.")+` `+i),console.error(i),null}}async CopyKeypointToClipboard(){const e=await this.editor.GetBodyToSetPose();if(!e){Li({title:ge.t("Please select a skeleton!!")});return}try{const t=new wn(e).Get18keyPointsData();await E1(JSON.stringify(t,null,4)),Li({title:ge.t("Copied to Clipboard")})}catch(t){return fo(t),console.error(t),null}}async SaveGesture(){if(!await this.editor.getSelectedHand()){Li({title:ge.t("Please select a hand!!")});return}try{this.editor.SaveGesture()}catch(t){return fo(t),console.error(t),null}}async LoadGesture(){if(!await this.editor.getSelectedHand()){Li({title:ge.t("Please select a hand!!")});return}const t=await oM();if(t)try{this.editor.RestoreGesture(t)}catch(r){return fo(r),console.error(r),null}}async GenerateSceneURL(){try{const e=encodeURIComponent(JSON.stringify(this.editor.GetSceneData())),r=`${location.href.replace(/#$/,"")}#${e}`;await E1(r),Li({title:ge.t("Copied to Clipboard")})}catch(e){fo(e),console.error(e)}}async SetRandomPose(){if(!await this.editor.GetBodyToSetPose()){Li({title:ge.t("Please select a skeleton!!")});return}const t=Cg(500);try{let r=Vx();if(r){await this.editor.SetPose(r);return}if(t.show({title:ge.t("Downloading Poses Library")}),await IB(Xa["src/poses/data.bin"]),t.hide(),r=Vx(),r){await this.editor.SetPose(r);return}}catch(r){t.hide(),fo(r),console.error(r);return}}async CopySkeleton(){if(!this.editor.getSelectedBody()){Li({title:ge.t("Please select a skeleton!!")});return}this.editor.CopySelectedBody()}async RemoveSkeleton(){if(!this.editor.getSelectedBody()){Li({title:ge.t("Please select a skeleton!!")});return}this.editor.RemoveBody()}FeedbackByQQ(){window.open("https://jq.qq.com/?_wv=1027&k=N6j4nigd")}FeedbackByGithub(){window.open("https://github.com/nonnonstop/sd-webui-3d-open-pose-editor/issues/new/choose")}}function Ad(n="YYYY_MM_DD_HH_mm_ss"){return pw(new Date).format(n)}const Hx=()=>({});function X2(){const[,n]=b.useState(Hx);return b.useCallback(()=>{n(Hx())},[])}const Gx={type:"change"},tm={type:"start"},Wx={type:"end"};class kB extends Fs{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new F,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Ks.ROTATE,MIDDLE:Ks.DOLLY,RIGHT:Ks.PAN},this.touches={ONE:Ys.ROTATE,TWO:Ys.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return a.phi},this.getAzimuthalAngle=function(){return a.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(G){G.addEventListener("keydown",Kt),this._domElementKeyEvents=G},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",Kt),this._domElementKeyEvents=null},this.saveState=function(){r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=function(){r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(Gx),r.update(),o=i.NONE},this.update=function(){const G=new F,te=new $t().setFromUnitVectors(e.up,new F(0,1,0)),Le=te.clone().invert(),Ee=new F,Ie=new $t,Oe=2*Math.PI;return function(){const st=r.object.position;G.copy(st).sub(r.target),G.applyQuaternion(te),a.setFromVector3(G),r.autoRotate&&o===i.NONE&&A(L()),r.enableDamping?(a.theta+=l.theta*r.dampingFactor,a.phi+=l.phi*r.dampingFactor):(a.theta+=l.theta,a.phi+=l.phi);let ct=r.minAzimuthAngle,pt=r.maxAzimuthAngle;return isFinite(ct)&&isFinite(pt)&&(ct<-Math.PI?ct+=Oe:ct>Math.PI&&(ct-=Oe),pt<-Math.PI?pt+=Oe:pt>Math.PI&&(pt-=Oe),ct<=pt?a.theta=Math.max(ct,Math.min(pt,a.theta)):a.theta=a.theta>(ct+pt)/2?Math.max(ct,a.theta):Math.min(pt,a.theta)),a.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,a.phi)),a.makeSafe(),a.radius*=c,a.radius=Math.max(r.minDistance,Math.min(r.maxDistance,a.radius)),r.enableDamping===!0?r.target.addScaledVector(f,r.dampingFactor):r.target.add(f),G.setFromSpherical(a),G.applyQuaternion(Le),st.copy(r.target).add(G),r.object.lookAt(r.target),r.enableDamping===!0?(l.theta*=1-r.dampingFactor,l.phi*=1-r.dampingFactor,f.multiplyScalar(1-r.dampingFactor)):(l.set(0,0,0),f.set(0,0,0)),c=1,u||Ee.distanceToSquared(r.object.position)>s||8*(1-Ie.dot(r.object.quaternion))>s?(r.dispatchEvent(Gx),Ee.copy(r.object.position),Ie.copy(r.object.quaternion),u=!1,!0):!1}}(),this.dispose=function(){r.domElement.removeEventListener("contextmenu",ae),r.domElement.removeEventListener("pointerdown",et),r.domElement.removeEventListener("pointercancel",zt),r.domElement.removeEventListener("wheel",jt),r.domElement.removeEventListener("pointermove",nn),r.domElement.removeEventListener("pointerup",Wt),r._domElementKeyEvents!==null&&(r._domElementKeyEvents.removeEventListener("keydown",Kt),r._domElementKeyEvents=null)};const r=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let o=i.NONE;const s=1e-6,a=new xx,l=new xx;let c=1;const f=new F;let u=!1;const d=new We,p=new We,v=new We,m=new We,g=new We,_=new We,y=new We,x=new We,S=new We,T=[],C={};function L(){return 2*Math.PI/60/60*r.autoRotateSpeed}function E(){return Math.pow(.95,r.zoomSpeed)}function A(G){l.theta-=G}function I(G){l.phi-=G}const q=function(){const G=new F;return function(Le,Ee){G.setFromMatrixColumn(Ee,0),G.multiplyScalar(-Le),f.add(G)}}(),ee=function(){const G=new F;return function(Le,Ee){r.screenSpacePanning===!0?G.setFromMatrixColumn(Ee,1):(G.setFromMatrixColumn(Ee,0),G.crossVectors(r.object.up,G)),G.multiplyScalar(Le),f.add(G)}}(),H=function(){const G=new F;return function(Le,Ee){const Ie=r.domElement;if(r.object.isPerspectiveCamera){const Oe=r.object.position;G.copy(Oe).sub(r.target);let Fe=G.length();Fe*=Math.tan(r.object.fov/2*Math.PI/180),q(2*Le*Fe/Ie.clientHeight,r.object.matrix),ee(2*Ee*Fe/Ie.clientHeight,r.object.matrix)}else r.object.isOrthographicCamera?(q(Le*(r.object.right-r.object.left)/r.object.zoom/Ie.clientWidth,r.object.matrix),ee(Ee*(r.object.top-r.object.bottom)/r.object.zoom/Ie.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}}();function R(G){r.object.isPerspectiveCamera?c/=G:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom*G)),r.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function N(G){r.object.isPerspectiveCamera?c*=G:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/G)),r.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function Z(G){d.set(G.clientX,G.clientY)}function K(G){y.set(G.clientX,G.clientY)}function B(G){m.set(G.clientX,G.clientY)}function $(G){p.set(G.clientX,G.clientY),v.subVectors(p,d).multiplyScalar(r.rotateSpeed);const te=r.domElement;A(2*Math.PI*v.x/te.clientHeight),I(2*Math.PI*v.y/te.clientHeight),d.copy(p),r.update()}function W(G){x.set(G.clientX,G.clientY),S.subVectors(x,y),S.y>0?R(E()):S.y<0&&N(E()),y.copy(x),r.update()}function ie(G){g.set(G.clientX,G.clientY),_.subVectors(g,m).multiplyScalar(r.panSpeed),H(_.x,_.y),m.copy(g),r.update()}function j(G){G.deltaY<0?N(E()):G.deltaY>0&&R(E()),r.update()}function se(G){let te=!1;switch(G.code){case r.keys.UP:G.ctrlKey||G.metaKey||G.shiftKey?I(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):H(0,r.keyPanSpeed),te=!0;break;case r.keys.BOTTOM:G.ctrlKey||G.metaKey||G.shiftKey?I(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):H(0,-r.keyPanSpeed),te=!0;break;case r.keys.LEFT:G.ctrlKey||G.metaKey||G.shiftKey?A(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):H(r.keyPanSpeed,0),te=!0;break;case r.keys.RIGHT:G.ctrlKey||G.metaKey||G.shiftKey?A(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):H(-r.keyPanSpeed,0),te=!0;break}te&&(G.preventDefault(),r.update())}function ue(){if(T.length===1)d.set(T[0].pageX,T[0].pageY);else{const G=.5*(T[0].pageX+T[1].pageX),te=.5*(T[0].pageY+T[1].pageY);d.set(G,te)}}function Q(){if(T.length===1)m.set(T[0].pageX,T[0].pageY);else{const G=.5*(T[0].pageX+T[1].pageX),te=.5*(T[0].pageY+T[1].pageY);m.set(G,te)}}function me(){const G=T[0].pageX-T[1].pageX,te=T[0].pageY-T[1].pageY,Le=Math.sqrt(G*G+te*te);y.set(0,Le)}function pe(){r.enableZoom&&me(),r.enablePan&&Q()}function we(){r.enableZoom&&me(),r.enableRotate&&ue()}function de(G){if(T.length==1)p.set(G.pageX,G.pageY);else{const Le=Ue(G),Ee=.5*(G.pageX+Le.x),Ie=.5*(G.pageY+Le.y);p.set(Ee,Ie)}v.subVectors(p,d).multiplyScalar(r.rotateSpeed);const te=r.domElement;A(2*Math.PI*v.x/te.clientHeight),I(2*Math.PI*v.y/te.clientHeight),d.copy(p)}function Pe(G){if(T.length===1)g.set(G.pageX,G.pageY);else{const te=Ue(G),Le=.5*(G.pageX+te.x),Ee=.5*(G.pageY+te.y);g.set(Le,Ee)}_.subVectors(g,m).multiplyScalar(r.panSpeed),H(_.x,_.y),m.copy(g)}function Ne(G){const te=Ue(G),Le=G.pageX-te.x,Ee=G.pageY-te.y,Ie=Math.sqrt(Le*Le+Ee*Ee);x.set(0,Ie),S.set(0,Math.pow(x.y/y.y,r.zoomSpeed)),R(S.y),y.copy(x)}function He(G){r.enableZoom&&Ne(G),r.enablePan&&Pe(G)}function $e(G){r.enableZoom&&Ne(G),r.enableRotate&&de(G)}function et(G){r.enabled!==!1&&(T.length===0&&(r.domElement.setPointerCapture(G.pointerId),r.domElement.addEventListener("pointermove",nn),r.domElement.addEventListener("pointerup",Wt)),xe(G),G.pointerType==="touch"?U(G):yt(G))}function nn(G){r.enabled!==!1&&(G.pointerType==="touch"?D(G):ft(G))}function Wt(G){_e(G),T.length===0&&(r.domElement.releasePointerCapture(G.pointerId),r.domElement.removeEventListener("pointermove",nn),r.domElement.removeEventListener("pointerup",Wt)),r.dispatchEvent(Wx),o=i.NONE}function zt(G){_e(G)}function yt(G){let te;switch(G.button){case 0:te=r.mouseButtons.LEFT;break;case 1:te=r.mouseButtons.MIDDLE;break;case 2:te=r.mouseButtons.RIGHT;break;default:te=-1}switch(te){case Ks.DOLLY:if(r.enableZoom===!1)return;K(G),o=i.DOLLY;break;case Ks.ROTATE:if(G.ctrlKey||G.metaKey||G.shiftKey){if(r.enablePan===!1)return;B(G),o=i.PAN}else{if(r.enableRotate===!1)return;Z(G),o=i.ROTATE}break;case Ks.PAN:if(G.ctrlKey||G.metaKey||G.shiftKey){if(r.enableRotate===!1)return;Z(G),o=i.ROTATE}else{if(r.enablePan===!1)return;B(G),o=i.PAN}break;default:o=i.NONE}o!==i.NONE&&r.dispatchEvent(tm)}function ft(G){switch(o){case i.ROTATE:if(r.enableRotate===!1)return;$(G);break;case i.DOLLY:if(r.enableZoom===!1)return;W(G);break;case i.PAN:if(r.enablePan===!1)return;ie(G);break}}function jt(G){r.enabled===!1||r.enableZoom===!1||o!==i.NONE||(G.preventDefault(),r.dispatchEvent(tm),j(G),r.dispatchEvent(Wx))}function Kt(G){r.enabled===!1||r.enablePan===!1||se(G)}function U(G){switch(Ce(G),T.length){case 1:switch(r.touches.ONE){case Ys.ROTATE:if(r.enableRotate===!1)return;ue(),o=i.TOUCH_ROTATE;break;case Ys.PAN:if(r.enablePan===!1)return;Q(),o=i.TOUCH_PAN;break;default:o=i.NONE}break;case 2:switch(r.touches.TWO){case Ys.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;pe(),o=i.TOUCH_DOLLY_PAN;break;case Ys.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;we(),o=i.TOUCH_DOLLY_ROTATE;break;default:o=i.NONE}break;default:o=i.NONE}o!==i.NONE&&r.dispatchEvent(tm)}function D(G){switch(Ce(G),o){case i.TOUCH_ROTATE:if(r.enableRotate===!1)return;de(G),r.update();break;case i.TOUCH_PAN:if(r.enablePan===!1)return;Pe(G),r.update();break;case i.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;He(G),r.update();break;case i.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;$e(G),r.update();break;default:o=i.NONE}}function ae(G){r.enabled!==!1&&G.preventDefault()}function xe(G){T.push(G)}function _e(G){delete C[G.pointerId];for(let te=0;te.9&&(s.visible=!1)),this.axis==="Y"&&(Nt.setFromEuler(yf.set(0,0,Math.PI/2)),s.quaternion.copy(r).multiply(Nt),Math.abs(St.copy(ds).applyQuaternion(r).dot(this.eye))>.9&&(s.visible=!1)),this.axis==="Z"&&(Nt.setFromEuler(yf.set(0,Math.PI/2,0)),s.quaternion.copy(r).multiply(Nt),Math.abs(St.copy(nc).applyQuaternion(r).dot(this.eye))>.9&&(s.visible=!1)),this.axis==="XYZE"&&(Nt.setFromEuler(yf.set(0,Math.PI/2,0)),St.copy(this.rotationAxis),s.quaternion.setFromRotationMatrix(Zx.lookAt(qx,St,ds)),s.quaternion.multiply(Nt),s.visible=this.dragging),this.axis==="E"&&(s.visible=!1)):s.name==="START"?(s.position.copy(this.worldPositionStart),s.visible=this.dragging):s.name==="END"?(s.position.copy(this.worldPosition),s.visible=this.dragging):s.name==="DELTA"?(s.position.copy(this.worldPositionStart),s.quaternion.copy(this.worldQuaternionStart),Zn.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Zn.applyQuaternion(this.worldQuaternionStart.clone().invert()),s.scale.copy(Zn),s.visible=this.dragging):(s.quaternion.copy(r),this.dragging?s.position.copy(this.worldPositionStart):s.position.copy(this.worldPosition),this.axis&&(s.visible=this.axis.search(s.name)!==-1));continue}s.quaternion.copy(r),this.mode==="translate"||this.mode==="scale"?(s.name==="X"&&Math.abs(St.copy(tc).applyQuaternion(r).dot(this.eye))>.99&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),s.name==="Y"&&Math.abs(St.copy(ds).applyQuaternion(r).dot(this.eye))>.99&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),s.name==="Z"&&Math.abs(St.copy(nc).applyQuaternion(r).dot(this.eye))>.99&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),s.name==="XY"&&Math.abs(St.copy(nc).applyQuaternion(r).dot(this.eye))<.2&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),s.name==="YZ"&&Math.abs(St.copy(tc).applyQuaternion(r).dot(this.eye))<.2&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),s.name==="XZ"&&Math.abs(St.copy(ds).applyQuaternion(r).dot(this.eye))<.2&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1)):this.mode==="rotate"&&(_f.copy(r),St.copy(this.eye).applyQuaternion(Nt.copy(r).invert()),s.name.search("E")!==-1&&s.quaternion.setFromRotationMatrix(Zx.lookAt(this.eye,qx,ds)),s.name==="X"&&(Nt.setFromAxisAngle(tc,Math.atan2(-St.y,St.z)),Nt.multiplyQuaternions(_f,Nt),s.quaternion.copy(Nt)),s.name==="Y"&&(Nt.setFromAxisAngle(ds,Math.atan2(St.x,St.z)),Nt.multiplyQuaternions(_f,Nt),s.quaternion.copy(Nt)),s.name==="Z"&&(Nt.setFromAxisAngle(nc,Math.atan2(St.y,St.x)),Nt.multiplyQuaternions(_f,Nt),s.quaternion.copy(Nt))),s.visible=s.visible&&(s.name.indexOf("X")===-1||this.showX),s.visible=s.visible&&(s.name.indexOf("Y")===-1||this.showY),s.visible=s.visible&&(s.name.indexOf("Z")===-1||this.showZ),s.visible=s.visible&&(s.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),s.material._color=s.material._color||s.material.color.clone(),s.material._opacity=s.material._opacity||s.material.opacity,s.material.color.copy(s.material._color),s.material.opacity=s.material._opacity,this.enabled&&this.axis&&(s.name===this.axis||this.axis.split("").some(function(l){return s.name===l}))&&(s.material.color.setHex(16776960),s.material.opacity=1)}super.updateMatrixWorld(e)}}class VB extends Me{constructor(){super(new ch(1e5,1e5,2,2),new Yr({visible:!1,wireframe:!0,side:$i,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),xf.copy(tc).applyQuaternion(t==="local"?this.worldQuaternion:zf),Hl.copy(ds).applyQuaternion(t==="local"?this.worldQuaternion:zf),Gl.copy(nc).applyQuaternion(t==="local"?this.worldQuaternion:zf),St.copy(Hl),this.mode){case"translate":case"scale":switch(this.axis){case"X":St.copy(this.eye).cross(xf),ti.copy(xf).cross(St);break;case"Y":St.copy(this.eye).cross(Hl),ti.copy(Hl).cross(St);break;case"Z":St.copy(this.eye).cross(Gl),ti.copy(Gl).cross(St);break;case"XY":ti.copy(Gl);break;case"YZ":ti.copy(xf);break;case"XZ":St.copy(Gl),ti.copy(Hl);break;case"XYZ":case"E":ti.set(0,0,0);break}break;case"rotate":default:ti.set(0,0,0)}ti.length()===0?this.quaternion.copy(this.cameraQuaternion):(Qx.lookAt(Zn.set(0,0,0),ti,St),this.quaternion.setFromRotationMatrix(Qx)),super.updateMatrixWorld(e)}}var gc=function(){var n=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(f){f.preventDefault(),r(++n%e.children.length)},!1);function t(f){return e.appendChild(f.dom),f}function r(f){for(var u=0;u=o+1e3&&(a.update(s*1e3/(f-o),100),o=f,s=0,c)){var u=performance.memory;c.update(u.usedJSHeapSize/1048576,u.jsHeapSizeLimit/1048576)}return f},update:function(){i=this.end()},domElement:e,setMode:r}};gc.Panel=function(n,e,t){var r=1/0,i=0,o=Math.round,s=o(window.devicePixelRatio||1),a=80*s,l=48*s,c=3*s,f=2*s,u=3*s,d=15*s,p=74*s,v=30*s,m=document.createElement("canvas");m.width=a,m.height=l,m.style.cssText="width:80px;height:48px";var g=m.getContext("2d");return g.font="bold "+9*s+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=t,g.fillRect(0,0,a,l),g.fillStyle=e,g.fillText(n,c,f),g.fillRect(u,d,p,v),g.fillStyle=t,g.globalAlpha=.9,g.fillRect(u,d,p,v),{dom:m,update:function(_,y){r=Math.min(r,_),i=Math.max(i,_),g.fillStyle=t,g.globalAlpha=1,g.fillRect(0,0,a,d),g.fillStyle=e,g.fillText(o(_)+" "+n+" ("+o(r)+"-"+o(i)+")",c,f),g.drawImage(m,u+s,d,p-s,v,u,d,p-s,v),g.fillRect(u+p-s,d,s,v),g.fillStyle=t,g.globalAlpha=.9,g.fillRect(u+p-s,d,s,o((1-_/y)*v))}}};const HB=gc,GB={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }`,fragmentShader:` uniform float opacity; uniform sampler2D tDiffuse; varying vec2 vUv; void main() { gl_FragColor = texture2D( tDiffuse, vUv ); gl_FragColor.a *= opacity; }`};class gh{constructor(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const WB=new uh(-1,1,1,-1,0,1),tv=new Ht;tv.setAttribute("position",new Je([-1,3,0,-1,-1,0,3,-1,0],3));tv.setAttribute("uv",new Je([0,2,0,0,2,0],2));class jB{constructor(e){this._mesh=new Me(tv,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,WB)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class Bf extends gh{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof gi?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=t2.clone(e.uniforms),this.material=new gi({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new jB(this.material)}render(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class Jx extends gh{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,r){const i=e.getContext(),o=e.state;o.buffers.color.setMask(!1),o.buffers.depth.setMask(!1),o.buffers.color.setLocked(!0),o.buffers.depth.setLocked(!0);let s,a;this.inverse?(s=0,a=1):(s=1,a=0),o.buffers.stencil.setTest(!0),o.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),o.buffers.stencil.setFunc(i.ALWAYS,s,4294967295),o.buffers.stencil.setClear(a),o.buffers.stencil.setLocked(!0),e.setRenderTarget(r),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),o.buffers.color.setLocked(!1),o.buffers.depth.setLocked(!1),o.buffers.stencil.setLocked(!1),o.buffers.stencil.setFunc(i.EQUAL,1,4294967295),o.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),o.buffers.stencil.setLocked(!0)}}class XB extends gh{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class ew{constructor(e,t){if(this.renderer=e,t===void 0){const r=e.getSize(new We);this._pixelRatio=e.getPixelRatio(),this._width=r.width,this._height=r.height,t=new Vo(this._width*this._pixelRatio,this._height*this._pixelRatio),t.texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new Bf(GB),this.clock=new W8}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t uniform sampler2D tDiffuse; varying vec2 vUv; void main() { vec4 texel = texture2D( tDiffuse, vUv ); float l = luminance( texel.rgb ); gl_FragColor = vec4( l, l, l, texel.w ); }`},qB={uniforms:{tDiffuse:{value:null},resolution:{value:new We}},vertexShader:` varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }`,fragmentShader:` uniform sampler2D tDiffuse; uniform vec2 resolution; varying vec2 vUv; void main() { vec2 texel = vec2( 1.0 / resolution.x, 1.0 / resolution.y ); // kernel definition (in glsl matrices are filled in column-major order) const mat3 Gx = mat3( -1, -2, -1, 0, 0, 0, 1, 2, 1 ); // x direction kernel const mat3 Gy = mat3( -1, 0, 1, -2, 0, 2, -1, 0, 1 ); // y direction kernel // fetch the 3x3 neighbourhood of a fragment // first column float tx0y0 = texture2D( tDiffuse, vUv + texel * vec2( -1, -1 ) ).r; float tx0y1 = texture2D( tDiffuse, vUv + texel * vec2( -1, 0 ) ).r; float tx0y2 = texture2D( tDiffuse, vUv + texel * vec2( -1, 1 ) ).r; // second column float tx1y0 = texture2D( tDiffuse, vUv + texel * vec2( 0, -1 ) ).r; float tx1y1 = texture2D( tDiffuse, vUv + texel * vec2( 0, 0 ) ).r; float tx1y2 = texture2D( tDiffuse, vUv + texel * vec2( 0, 1 ) ).r; // third column float tx2y0 = texture2D( tDiffuse, vUv + texel * vec2( 1, -1 ) ).r; float tx2y1 = texture2D( tDiffuse, vUv + texel * vec2( 1, 0 ) ).r; float tx2y2 = texture2D( tDiffuse, vUv + texel * vec2( 1, 1 ) ).r; // gradient value in x direction float valueGx = Gx[0][0] * tx0y0 + Gx[1][0] * tx1y0 + Gx[2][0] * tx2y0 + Gx[0][1] * tx0y1 + Gx[1][1] * tx1y1 + Gx[2][1] * tx2y1 + Gx[0][2] * tx0y2 + Gx[1][2] * tx1y2 + Gx[2][2] * tx2y2; // gradient value in y direction float valueGy = Gy[0][0] * tx0y0 + Gy[1][0] * tx1y0 + Gy[2][0] * tx2y0 + Gy[0][1] * tx0y1 + Gy[1][1] * tx1y1 + Gy[2][1] * tx2y1 + Gy[0][2] * tx0y2 + Gy[1][2] * tx1y2 + Gy[2][2] * tx2y2; // magnitute of the total gradient float G = sqrt( ( valueGx * valueGx ) + ( valueGy * valueGy ) ); gl_FragColor = vec4( vec3( G ), 1 ); }`},ZB=n=>{const e=b.useRef(n);return b.useLayoutEffect(()=>{e.current=n}),b.useMemo(()=>(...t)=>{const{current:r}=e;return r(...t)},[])};let Ld=!1;const nv=(n,e,t="*")=>{console.log("return",{target:e,origin:t,data:n}),e?.postMessage({cmd:"openpose-3d",...n},{targetOrigin:t})},QB=n=>{if(Ld)return;const{parent:e}=window;if(!e)throw new Error("Parent window has closed");nv(n,e)},JB=n=>{const{opener:e}=window;if(!e)throw new Error("Opener window has closed");nv(n,e)},e9=n=>{if(Ld)return;const{opener:e,parent:t}=window;if(!e&&!t)throw new Error("window has closed");t&&QB(n),e&&JB(n)};function t9(n){const e=b.useRef(),t=b.useRef(null);e.current="",t.current=null;const r=o=>nv(o,t.current,e.current),i=ZB(async({origin:o,source:s,data:a})=>{if(!a)return;const{method:l,payload:c,type:f}=a;if(f=="call"){if(console.log("method",l,c),c&&Array.isArray(c)===!1){console.error("payload is not array");return}if(t.current=s,e.current=o,l in n){const u=n[l];if(typeof u=="function"){Ld=!0;const d=u(...c??[]),p=d instanceof Promise?await d:d;try{r({method:l,type:"return",payload:p})}catch(v){console.log(v)}Ld=!1}}else l==="GetAPIs"&&r({method:l,type:"return",payload:Object.keys(n)})}});b.useEffect(()=>(window.addEventListener("message",i),()=>window.removeEventListener("message",i)),[i])}class Wl{eventHandlers=[];AddEventListener(e){this.eventHandlers.push(e)}RemoveEventListener(e){this.eventHandlers=this.eventHandlers.filter(t=>t!==e)}TriggerEvent(e){this.eventHandlers.forEach(t=>t(e))}}function tw(n){return{scale:n.scale.clone(),rotation:n.rotation.clone(),position:n.position.clone()}}class n9{scene;camera;canvas;renderer;orbitControls;constructor(e){this.scene=e.scene,this.camera=e.camera,this.canvas=e.canvas,this.orbitControls=e.orbitControls,e.renderer?this.renderer=e.renderer:this.renderer=new Gc({antialias:!0,canvas:e.canvas})}renderBySize(e,t,r){const i={aspect:this.camera.aspect};this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.renderer.setSize(e,t,!0),r(e,t),this.camera.aspect=i.aspect,this.camera.updateProjectionMatrix()}GetCameraData(){return{position:this.camera.position.toArray(),rotation:this.camera.rotation.toArray(),target:this.orbitControls.target.toArray(),near:this.camera.near,far:this.camera.far,zoom:this.camera.zoom}}RestoreCamera(e,t=!0){this.camera.position.fromArray(e.position),this.camera.rotation.fromArray(e.rotation),this.camera.near=e.near,this.camera.far=e.far,this.camera.zoom=e.zoom,this.camera.updateProjectionMatrix(),e.target&&this.orbitControls.target.fromArray(e.target),t&&this.orbitControls.update()}changeView(e){if(!e)return()=>{};const t=this.GetCameraData();return this.RestoreCamera(e,!1),()=>{this.RestoreCamera(t)}}render(e,t,r,i){const o=()=>{this.renderer.render(this.scene,this.camera)},s=this.changeView(r);this.renderBySize(e,t,i??o),s()}}class r9{renderer;outputRenderer;previewRenderer;scene;gridHelper;axesHelper;camera;orbitControls;transformControl;dlight;alight;raycaster=new m2;IsClick=!1;stats;composer;finalComposer;effectSobel;enableComposer=!1;enablePreview=!0;enableHelper=!0;paused=!1;parentElem;clearColor=11184810;constructor({canvas:e,previewCanvas:t,parentElem:r=document,statsElem:i}){this.parentElem=r,this.renderer=new Gc({canvas:e,antialias:!0}),this.outputRenderer=new Gc({antialias:!0}),this.outputRenderer.domElement.style.display="none",document.body.appendChild(this.outputRenderer.domElement),this.renderer.setClearColor(this.clearColor,0),this.scene=new x8,this.gridHelper=new tU(8e3,200),this.axesHelper=new nU(1e3),this.scene.add(this.gridHelper),this.scene.add(this.axesHelper);const o=window.innerWidth/window.innerHeight;this.camera=new Bn(60,o,.1,1e4),this.camera.position.set(0,100,200),this.camera.lookAt(0,100,0),this.camera.updateProjectionMatrix(),this.orbitControls=new kB(this.camera,this.renderer.domElement),this.orbitControls.target=new F(0,100,0),this.orbitControls.update(),this.transformControl=new OB(this.camera,this.renderer.domElement),this.transformControl.setMode("rotate"),this.transformControl.setSize(.4),this.transformControl.setSpace("local"),this.registerTranformControlEvent(),this.scene.add(this.transformControl),this.previewRenderer=new n9({scene:this.scene,camera:this.camera,orbitControls:this.orbitControls,canvas:t}),this.dlight=new h2(16777215,1),this.dlight.position.set(0,160,1e3),this.scene.add(this.dlight),this.alight=new p2(16777215,.5),this.scene.add(this.alight),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.handleResize=this.handleResize.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleKeyUp=this.handleKeyUp.bind(this),this.addEvent(),this.initEdgeComposer(),i&&(this.stats=HB(),i.appendChild(this.stats.dom)),this.animate=this.animate.bind(this),this.animate(),this.handleResize(),this.AutoSaveScene()}disponse(){this.pause(),this.removeEvent(),this.renderer.dispose(),this.outputRenderer.dispose(),console.log("BodyEditor disponse")}commandHistory=[];historyIndex=-1;pushCommand(e){console.log("pushCommand"),this.historyIndex!=this.commandHistory.length-1&&(this.commandHistory=this.commandHistory.slice(0,this.historyIndex+1)),this.commandHistory.push(e),this.historyIndex=this.commandHistory.length-1}CreateTransformCommand(e,t){const r=t,i=tw(e),o=new wn(this.getBodyByPart(e));return{execute:()=>{e.position.copy(i.position),e.rotation.copy(i.rotation),e.scale.copy(i.scale),o.Update()},undo:()=>{e.position.copy(r.position),e.rotation.copy(r.rotation),e.scale.copy(r.scale),o.Update()}}}CreateAllTransformCommand(e,t){const r=t,i=this.getBodyByPart(e),o=new wn(i),s=o.GetBodyData();return{execute:()=>{o.RestoreBody(s),o.Update()},undo:()=>{o.RestoreBody(r),o.Update()}}}CreateAddBodyCommand(e){return{execute:()=>{this.scene.add(e)},undo:()=>{e.removeFromParent(),this.DetachTransfromControl()}}}CreateRemoveBodyCommand(e){return{execute:()=>{e.removeFromParent(),this.DetachTransfromControl()},undo:()=>{this.scene.add(e)}}}Undo(){console.log("Undo",this.historyIndex),this.historyIndex>=0&&(this.commandHistory[this.historyIndex].undo(),this.historyIndex--)}Redo(){console.log("Redo",this.historyIndex),this.historyIndex{const r=this.getSelectedBody();r&&new wn(r).UpdateBones()}),this.transformControl.addEventListener("objectChange",()=>{}),this.transformControl.addEventListener("mouseDown",()=>{const r=this.getSelectedPart();if(r){e=tw(r);const i=this.getBodyByPart(r);t=new wn(i).GetBodyData()}this.orbitControls.enabled=!1}),this.transformControl.addEventListener("mouseUp",()=>{const r=this.getSelectedPart();r&&($x(r.name)?this.pushCommand(this.CreateAllTransformCommand(r,t)):this.pushCommand(this.CreateTransformCommand(r,e))),this.orbitControls.enabled=!0,this.saveSelectedBodyControlor?.Update()})}ikSolver;saveSelectedBodyControlor;updateSelectedBodyIKSolver(){const e=this.getSelectedBody()??void 0;e!==this.saveSelectedBodyControlor&&(this.saveSelectedBodyControlor=e?new wn(e):void 0,this.ikSolver=e?this.saveSelectedBodyControlor?.GetIKSolver():void 0),pf(this.getSelectedPart()?.name??"")?this.ikSolver?.update():this.saveSelectedBodyControlor?.ResetAllTargetsPosition()}render(e=this.Width,t=this.Height){this.updateSelectedBodyIKSolver(),this.renderer.setViewport(0,0,e,t),this.renderer.setScissor(0,0,e,t),this.renderer.setScissorTest(!0),this.renderer.render(this.scene,this.camera)}autoSize=!0;outputWidth=0;outputHeight=0;get OutputWidth(){return this.autoSize?this.Width:this.outputWidth===0?this.Height:this.outputWidth}set OutputWidth(e){this.autoSize=!1,this.outputWidth=e}get OutputHeight(){return this.autoSize?this.Height:this.outputHeight===0?this.Height:this.outputHeight}set OutputHeight(e){this.autoSize=!1,this.outputHeight=e}renderPreview(){const e=this.OutputWidth,t=this.OutputHeight,r=e/t,i=2,[o,s,a,l]=r>i?[this.Width-50-150*i,220,150*i,150*i*t/e]:[this.Width-50-150*e/t,220,150*e/t,150],c={viewport:new dt,scissor:new dt,scissorTest:this.renderer.getScissorTest(),aspect:this.camera.aspect};this.renderer.getViewport(c.viewport),this.renderer.getScissor(c.viewport),this.renderer.setViewport(o,s,a,l),this.renderer.setScissor(o,s,a,l),this.renderer.setScissorTest(!0),this.camera.aspect=a/l,this.camera.updateProjectionMatrix();const f=this.changeView();this.renderer.render(this.scene,this.camera),f(),this.renderer.setViewport(c.viewport),this.renderer.setScissor(c.scissor),this.renderer.setScissorTest(c.scissorTest),this.camera.aspect=c.aspect,this.camera.updateProjectionMatrix()}renderOutputBySize(e,t,r){const i={aspect:this.camera.aspect};this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.outputRenderer.setSize(e,t,!0),r(e,t),this.camera.aspect=i.aspect,this.camera.updateProjectionMatrix()}renderOutput(e=1,t){const r=this.OutputWidth*e,i=this.OutputHeight*e,o=()=>{this.outputRenderer.render(this.scene,this.camera)};this.renderOutputBySize(r,i,t??o)}getOutputPNG(){return this.outputRenderer.domElement.toDataURL("image/png")}animate(){this.paused||(requestAnimationFrame(this.animate),this.handleResize(),this.render(),this.outputPreview(),this.stats?.update())}outputPreview(){this.enablePreview&&this.CapturePreview(),this.PreviewEventManager.TriggerEvent(this.enablePreview)}pause(){this.paused=!0}resume(){this.paused=!1,this.animate()}getAncestors(e){const t=[];return e.traverseAncestors(r=>t.push(r)),t}getBodyByPart(e){return e?.name==="torso"?e:this.getAncestors(e).find(r=>r?.name==="torso")??null}SelectEventManager=new Wl;UnselectEventManager=new Wl;ContextMenuEventManager=new Wl;PreviewEventManager=new Wl;LockViewEventManager=new Wl;triggerSelectEvent(e){const t=new wn(e);this.SelectEventManager.TriggerEvent(t),this.UpdateBones()}triggerUnselectEvent(){this.UnselectEventManager.TriggerEvent(),this.UpdateBones()}addEvent(){this.renderer.domElement.addEventListener("mousedown",this.onMouseDown,!1),this.renderer.domElement.addEventListener("mousemove",this.onMouseMove,!1),this.renderer.domElement.addEventListener("mouseup",this.onMouseUp,!1),this.renderer.domElement.addEventListener("resize",this.handleResize),this.parentElem.addEventListener("keydown",this.handleKeyDown),this.parentElem.addEventListener("keyup",this.handleKeyUp)}removeEvent(){this.renderer.domElement.removeEventListener("mousedown",this.onMouseDown,!1),this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1),this.renderer.domElement.removeEventListener("mouseup",this.onMouseUp,!1),this.renderer.domElement.removeEventListener("resize",this.handleResize),this.parentElem.removeEventListener("keydown",this.handleKeyDown),this.parentElem.removeEventListener("keyup",this.handleKeyUp)}onMouseDown(e){e.preventDefault(),this.IsClick=!0}onMouseMove(e){e.movementX==0&&e.movementY==0||(this.IsClick=!1)}onMouseUp(e){const t=e.offsetX-this.renderer.domElement.offsetLeft,r=e.offsetY-this.renderer.domElement.offsetTop;this.raycaster.setFromCamera({x:t/this.renderer.domElement.clientWidth*2-1,y:-(r/this.renderer.domElement.clientHeight)*2+1},this.camera);const i=this.raycaster.intersectObjects(this.GetBodies(),!0),o=i.find(c=>c.object.name==="red_point"),s=o?o.object:i.length>0?i[0].object:null,a=s?s.name:"";let l=s;if(console.log(l?.name),this.IsClick){if(e.button===2||e.which===3){console.log("Right mouse button released"),this.ContextMenuEventManager.TriggerEvent({mouseX:t,mouseY:r});return}if(!l){this.DetachTransfromControl(),this.triggerUnselectEvent();return}if(this.MoveMode){if(hf(a,this.FreeMode)||(l=this.getAncestors(l).find(f=>hf(f.name,this.FreeMode))??null),l&&pf(l.name,this.FreeMode)===!1&&(l=this.getBodyByPart(l)),l){console.log(l.name),this.transformControl.setMode("translate"),this.transformControl.setSpace("world"),this.transformControl.attach(l);const f=this.getBodyByPart(l);f&&this.triggerSelectEvent(f)}}else if(hf(a)||(l=this.getAncestors(l).find(f=>hf(f.name))??null),l){console.log(l.name),pf(l.name)?(this.transformControl.setMode("translate"),this.transformControl.setSpace("world")):(this.transformControl.setMode("rotate"),this.transformControl.setSpace("local")),this.transformControl.attach(l);const f=this.getBodyByPart(l);f&&this.triggerSelectEvent(f)}}}traverseHandObjecct(e){this.GetBodies().forEach(t=>{t.traverse(r=>{mf(r?.name)&&e(r)})})}traverseBodies(e){this.GetBodies().forEach(t=>{t.traverse(r=>{e(r)})})}traverseBones(e){this.GetBodies().forEach(t=>{t.traverse(r=>{r instanceof Wc&&hi(r.name)&&e(r)})})}traverseExtremities(e){this.GetBodies().forEach(t=>{t.traverse(r=>{gf(r.name)&&e(r)})})}onlyShowSkeleton(){const e=[];return this.traverseBodies(t=>{lz(t.name)===!1&&t.visible==!0&&(t.visible=!1,e.push(t))}),()=>{e.forEach(t=>t.visible=!0)}}showMask(){const e=[];return this.scene.traverse(t=>{Ux(t.name)&&(console.log(t.name),t.visible=!0,e.push(t))}),()=>{e.forEach(t=>t.visible=!1)}}hideSkeleten(){const e=new Map;return this.GetBodies().forEach(t=>{t.traverse(r=>{gf(r?.name)?(e.set(r,r.parent),this.scene.attach(r)):r?.name==="red_point"&&(r.visible=!1)}),t.visible=!1}),e}GetBodies(){return this.scene.children.filter(e=>e?.name==="torso")}showSkeleten(e){for(const[t,r]of e.entries())r?.attach(t);e.clear(),this.GetBodies().forEach(t=>{t.traverse(r=>{r?.name==="red_point"&&(r.visible=!0)}),t.visible=!0})}changeComposer(e){const t=this.enableComposer;return this.enableComposer=e,()=>this.enableComposer=t}changeHandMaterialTraverse(e){const t=new Map;return this.scene.traverse(r=>{if(!gf(r.name))return;const i=iz(r);t.set(i,i.material),e=="depth"?i.material=new Sg:e=="normal"?i.material=new dx:e=="phone"&&(i.material=new Oo)}),()=>{for(const[r,i]of t.entries())r.material=i;t.clear()}}changeHandMaterial(e){return e=="depth"?this.scene.overrideMaterial=new Sg:e=="normal"?this.scene.overrideMaterial=new dx:e=="phone"&&(this.scene.overrideMaterial=new Oo),()=>{this.scene.overrideMaterial=null}}getCameraLookAtVector(){const e=new F(0,0,-1);return e.applyQuaternion(this.camera.quaternion),e}getZDistanceFromCamera(e){const t=this.getCameraLookAtVector().normalize();return e.clone().sub(this.camera.position).dot(t)}changeCamera(){let e=[];this.scene.traverse(c=>{this.OnlyHand?mf(c?.name)&&e.push(c):gf(c?.name)&&e.push(c)}),e=this.objectInView(e);const t=new F;this.camera.getWorldPosition(t);const i=e.map(c=>{const f=new F;return c.getWorldPosition(f),f}).map(c=>this.getZDistanceFromCamera(c)),o=Math.min(...i),s=Math.max(...i),a=this.camera.near,l=this.camera.far;return this.camera.near=Math.max(o-20,0),this.camera.far=Math.max(s+20,20),console.log("camera",this.camera.near,this.camera.far),this.camera.updateProjectionMatrix(),()=>{this.camera.near=a,this.camera.far=l,this.camera.updateProjectionMatrix()}}Capture(){const e=this.onlyShowSkeleton();this.renderOutput();const t=this.getOutputPNG();return e(),t}CapturePreview(){const e=window.devicePixelRatio*140/this.OutputHeight,t=this.OutputWidth*e,r=this.OutputHeight*e;this.previewRenderer.render(t,r,this.cameraDataOfView)}CaptureCanny(){return this.renderOutput(1,(e,t)=>{this.changeComposerResoultion(e,t);const r=this.changeHandMaterialTraverse("normal"),i=this.showMask();this.composer?.render(),i(),this.finalComposer?.render(),r()}),this.getOutputPNG()}CaptureNormal(){const e=this.changeHandMaterial("normal");return this.renderOutput(),e(),this.getOutputPNG()}CaptureDepth(){const e=this.changeHandMaterial("depth"),t=this.changeCamera();return this.renderOutput(),t(),e(),this.getOutputPNG()}changeTransformControl(){const e=this.getSelectedPart();return e?(this.DetachTransfromControl(),()=>{this.transformControl.attach(e)}):()=>{}}changeHelper(){const e={axesHelper:this.axesHelper.visible,gridHelper:this.gridHelper.visible};return this.axesHelper.visible=!1,this.gridHelper.visible=!1,()=>{this.axesHelper.visible=e.axesHelper,this.gridHelper.visible=e.gridHelper}}MakeImages(){this.renderer.setClearColor(0);const e=this.changeHelper(),t=this.changeTransformControl(),r=this.changeView(),i=this.Capture(),o=this.hideSkeleten(),s=this.CaptureDepth(),a=this.CaptureNormal(),l=this.CaptureCanny();this.showSkeleten(o),this.renderer.setClearColor(0,0),e(),t(),r();const c={pose:i,depth:s,normal:a,canny:l};return e9({method:"MakeImages",type:"event",payload:c}),c}CopySelectedBody(){const e=this.GetBodies(),t=this.getSelectedBody();if(!t&&e.length!==0)return;const r=e.length===0?ff():Qa(t);r&&(this.pushCommand(this.CreateAddBodyCommand(r)),e.length!==0&&(r.position.x+=10),this.scene.add(r),this.fixFootVisible(),this.transformControl.setMode("translate"),this.transformControl.setSpace("world"),this.transformControl.attach(r))}CopyBodyZ(){const e=ff();if(!e)return;const t=this.GetBodies().filter(r=>r.position.x===0).map(r=>Math.ceil(r.position.z/30));t.length>0&&e.translateZ((Math.min(...t)-1)*30),this.pushCommand(this.CreateAddBodyCommand(e)),this.scene.add(e),this.fixFootVisible()}CopyBodyX(){const e=ff();if(!e)return;const t=this.GetBodies().filter(r=>r.position.z===0).map(r=>Math.ceil(r.position.x/50));t.length>0&&e.translateX((Math.min(...t)-1)*50),this.pushCommand(this.CreateAddBodyCommand(e)),this.scene.add(e),this.fixFootVisible()}getSelectedBody(){let e=this.getSelectedPart()??null;return e=e?this.getBodyByPart(e):null,e}getSelectedPart(){return this.transformControl.object}getHandByPart(e){return mf(e?.name)?e:this.getAncestors(e).find(r=>mf(r?.name))??null}getSelectedHand(){let e=this.getSelectedPart()??null;return e=e?this.getHandByPart(e):null,e}RemoveBody(){const e=this.getSelectedBody();e&&(this.pushCommand(this.CreateRemoveBodyCommand(e)),console.log(e.name),e.removeFromParent(),this.DetachTransfromControl())}pointsInView(e){this.camera.updateMatrix(),this.camera.updateMatrixWorld();const t=new Hc().setFromProjectionMatrix(new Be().multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse));return e.filter(r=>t.containsPoint(r))}getBouningSphere(e){const t=new al().setFromObject(e,!0),r=new F;return t.getCenter(r),t.getBoundingSphere(new ll(r))}objectInView(e){this.camera.updateMatrix(),this.camera.updateMatrixWorld();const t=new Hc().setFromProjectionMatrix(new Be().multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse));return e.filter(r=>{const i=this.getBouningSphere(r);return t.intersectsSphere(i)})}isMoveMode=!1;get MoveMode(){return this.isMoveMode}set MoveMode(e){let t=e;this.isMoveMode=e;const r=this.getSelectedPart()?.name??"";if(e)if(pf(r,this.FreeMode))t=!0;else{const i=this.getSelectedBody();i&&this.transformControl.attach(i)}else $x(r)&&(t=!0);t?(this.transformControl.setMode("translate"),this.transformControl.setSpace("world")):(this.transformControl.setMode("rotate"),this.transformControl.setSpace("local"))}FreeMode=!0;get Width(){return this.renderer.domElement.clientWidth}get Height(){return this.renderer.domElement.clientHeight}onlyHand=!1;get OnlyHand(){return this.onlyHand}set OnlyHand(e){this.onlyHand=e,this.setFootVisible(!this.onlyHand)}get EnableHelper(){return this.enableHelper}set EnableHelper(e){this.enableHelper=e,this.gridHelper.visible=e,this.axesHelper.visible=e}setFootVisible(e){this.traverseExtremities(t=>{az(t.name)&&(t.visible=e)})}fixFootVisible(){this.setFootVisible(!this.OnlyHand)}handleResize(){const e=new We;if(this.renderer.getSize(e),e.width==this.Width&&e.height===this.Height)return;const t=this.renderer.domElement;t.clientWidth==0||t.clientHeight==0||(this.camera.aspect=t.clientWidth/t.clientHeight,this.camera.updateProjectionMatrix(),this.renderer.setSize(t.clientWidth,t.clientHeight,!1))}initEdgeComposer(){this.composer=new ew(this.outputRenderer);const e=new KB(this.scene,this.camera);this.composer.addPass(e),this.composer.renderToScreen=!1;const t=new Bf(new gi({uniforms:{baseTexture:{value:null},bloomTexture:{value:this.composer.renderTarget2.texture}},vertexShader:` varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }`,fragmentShader:` uniform sampler2D baseTexture; uniform sampler2D bloomTexture; varying vec2 vUv; void main() { vec4 bloomColor = texture2D(bloomTexture, vUv); float grayValue = dot(bloomColor.rgb, vec3(0.299, 0.587, 0.114)); vec4 baseColor = texture2D(baseTexture, vUv); vec4 masked = vec4(baseColor.rgb * step(0.001, grayValue), 1.0); gl_FragColor = step(0.5, masked) * vec4(1.0); // Binarization // gl_FragColor = bloomColor; } `,defines:{}}),"baseTexture");t.needsSwap=!0,this.finalComposer=new ew(this.outputRenderer),this.finalComposer.addPass(e);const r=new Bf(YB);this.finalComposer.addPass(r);const i=new Bf(qB);i.uniforms.resolution.value.x=this.Width*window.devicePixelRatio,i.uniforms.resolution.value.y=this.Height*window.devicePixelRatio,this.finalComposer.addPass(i),this.effectSobel=i,this.finalComposer.addPass(t)}changeComposerResoultion(e,t){this.composer?.setSize(e,t),this.finalComposer?.setSize(e,t),this.effectSobel&&(this.effectSobel.uniforms.resolution.value.x=e*window.devicePixelRatio,this.effectSobel.uniforms.resolution.value.y=t*window.devicePixelRatio)}get CameraNear(){return this.camera.near}set CameraNear(e){this.camera.near=e,this.camera.updateProjectionMatrix()}get CameraFar(){return this.camera.far}set CameraFar(e){this.camera.far=e,this.camera.updateProjectionMatrix()}get CameraFocalLength(){return this.camera.getFocalLength()}set CameraFocalLength(e){this.camera.setFocalLength(e)}GetCameraData(){return{position:this.camera.position.toArray(),rotation:this.camera.rotation.toArray(),target:this.orbitControls.target.toArray(),near:this.camera.near,far:this.camera.far,zoom:this.camera.zoom}}GetSceneData(){return{header:"Openpose Editor by Yu Zhu",version:"0.1.18",object:{bodies:this.GetBodies().map(r=>new wn(r).GetBodyData()),camera:this.GetCameraData()},setting:{}}}GetGesture(){const e=this.getSelectedHand(),t=this.getSelectedBody();return!e||!t?null:{header:"Openpose Editor by Yu Zhu",version:"0.1.18",object:{hand:new wn(t).GetHandData(e.name==="left_hand"?"left_hand":"right_hand")},setting:{}}}AutoSaveScene(){try{const e=localStorage.getItem("AutoSaveSceneData");e&&localStorage.setItem("LastSceneData",e),setInterval(()=>{localStorage.setItem("AutoSaveSceneData",JSON.stringify(this.GetSceneData()))},5e3)}catch(e){console.error(e)}}SaveScene(){try{M1(JSON.stringify(this.GetSceneData()),`scene_${Ad()}.json`)}catch(e){console.error(e)}}RestoreGesture(e){const t=JSON.parse(e),{version:r,object:{hand:i},setting:o}=t;if(!i)throw new Error("Invalid json");const s=this.getSelectedHand(),a=this.getSelectedBody();if(!s||!a)throw new Error("!hand || !body");new wn(a).RestoreHand(s.name=="left_hand"?"left_hand":"right_hand",i)}SaveGesture(){const e=this.GetGesture();if(!e)throw new Error("Failed to get gesture");M1(JSON.stringify(e),`gesture_${Ad()}.json`)}ClearScene(){this.GetBodies().forEach(e=>e.removeFromParent())}CreateBodiesFromData(e){return e.map(t=>{const r=ff();return new wn(r).RestoreBody(t),r})}RestoreCamera(e,t=!0){this.camera.position.fromArray(e.position),this.camera.rotation.fromArray(e.rotation),this.camera.near=e.near,this.camera.far=e.far,this.camera.zoom=e.zoom,this.camera.updateProjectionMatrix(),e.target&&this.orbitControls.target.fromArray(e.target),t&&this.orbitControls.update()}RestoreScene(e){try{if(!e)return;const t=JSON.parse(e),{version:r,object:{bodies:i,camera:o},setting:s}=t,a=this.CreateBodiesFromData(i);this.ClearScene(),a.length>0&&this.scene.add(...a);for(const l of a)new wn(l).ResetAllTargetsPosition();this.RestoreCamera(o)}catch(t){fo(t),console.error(t)}}ResetScene(){try{this.ClearScene(),this.CopySelectedBody();const e=this.getSelectedBody();e&&(this.scene.add(e),this.dlight.target=e)}catch(e){fo(e),console.error(e)}}RestoreLastSavedScene(){const e=localStorage.getItem("LastSceneData");e&&this.RestoreScene(e)}async LoadScene(){const e=await oM();e&&this.RestoreScene(e)}async GetBodyToSetPose(){const e=this.GetBodies();return e.length==1?e[0]:this.getSelectedBody()}async SetPose(e){const t=await this.GetBodyToSetPose();if(!t)return;const r=new wn(t),i=r.GetBodyData();r.SetPose(e),this.pushCommand(this.CreateAllTransformCommand(t,i))}async SetBlazePose(e){const t=await this.GetBodyToSetPose();if(!t)return;const r=new wn(t),i=r.GetBodyData();r.SetBlazePose(e),this.pushCommand(this.CreateAllTransformCommand(t,i))}DetachTransfromControl(){this.transformControl.detach(),this.triggerUnselectEvent()}cameraDataOfView;LockView(){this.cameraDataOfView=this.GetCameraData(),this.LockViewEventManager.TriggerEvent(!0)}UnlockView(){this.cameraDataOfView=void 0,this.LockViewEventManager.TriggerEvent(!1)}RestoreView(){this.cameraDataOfView&&this.RestoreCamera(this.cameraDataOfView)}changeView(){if(this.cameraDataOfView){const e=this.GetCameraData();return this.RestoreCamera(this.cameraDataOfView,!1),()=>{this.RestoreCamera(e)}}return()=>{}}getSelectedBone(){const e=this.getSelectedPart();return e&&hi(e.name)?e:null}UpdateBones(){const a=(c,f,u=16711680)=>{const d=c.children.find(p=>p instanceof Me&&!Ux(p.name));if(d){const p=d.material;p.color.set(u),p.opacity=f,p.needsUpdate=!0}},l=this.getSelectedBone();if(this.traverseBones(c=>{a(c,l?.2:1)}),l){let c=l;for(a(c,1,15658496),c.traverseAncestors(f=>{hi(f.name)&&a(f,1)});;){const f=c.children.filter(u=>u instanceof Wc);if(f.length!==1)break;a(f[0],1),c=f[0]}}}}async function i9(){const n=Cg(500);n.show({title:ge.t("Downloading Hand Model")}),await QU(Xa["models/hand.fbx"]),n.show({title:ge.t("Downloading Foot Model")}),await JU(Xa["models/foot.fbx"]),n.hide(),rz()}function o9(n,e,t){const[r,i]=b.useState();return b.useEffect(()=>{const o=n.current;if(!o)return;const s=e.current;if(!s)return;console.warn("create editor");let a=new r9({canvas:o,previewCanvas:s,parentElem:t?.current??document,statsElem:void 0});return i(a),(async()=>{if(a&&(await i9(),a?.ResetScene(),a?.RestoreScene&&location.hash)){const c=decodeURIComponent(location.hash.replace(/^#/,""));a?.RestoreScene(c),location.hash=""}})(),()=>{console.warn("disponse"),a?.disponse(),a=null}},[]),r}function s9(){const[n]=b.useState(()=>cp[ge.language]??"English"),[e]=b.useState(()=>Object.fromEntries(Object.entries(cp).map(([t,r])=>[r,t])));return{current:n,languagList:[...Object.values(cp)],changeLanguage:t=>{const r=e[t],i=new URL(window.location.href);i.searchParams.set("lng",r),window.location.assign(i)}}}const a9="_Root_ofrr6_5",l9="_ContextMenuContent_ofrr6_13",c9="_slideDownAndFade_ofrr6_1",u9="_ContextMenuItem_ofrr6_32",f9="_ContextMenuSeparator_ofrr6_52",d9="_IconButton_ofrr6_58",h9="_RightSlot_ofrr6_80",p9="_slideUpAndFade_ofrr6_1",m9="_slideRightAndFade_ofrr6_1",g9="_slideLeftAndFade_ofrr6_1",v9={Root:a9,ContextMenuContent:l9,slideDownAndFade:c9,ContextMenuItem:u9,ContextMenuSeparator:f9,IconButton:d9,RightSlot:h9,slideUpAndFade:p9,slideRightAndFade:m9,slideLeftAndFade:g9},{Root:y9,ContextMenuContent:_9,ContextMenuItem:lo,RightSlot:wf}=v9,x9=xi.create(({editor:n,mouseX:e,mouseY:t,onChangeBackground:r})=>{const i=b.useMemo(()=>new j2(n),[n]),o=ol();return fe("div",{className:y9,style:{display:o.visible?void 0:"none"},onClick:()=>{o.hide()},onContextMenu:s=>{s.preventDefault()},children:qe("div",{className:_9,style:{top:t,left:e},children:[qe("div",{className:lo,onClick:()=>{n.Undo()},children:[ge.t("Undo"),fe("div",{className:wf,children:"⌘ Z"})]}),qe("div",{className:lo,onClick:()=>{n.Redo()},children:[ge.t("Redo"),fe("div",{className:wf,children:"⇧ ⌘ Z"})]}),qe("div",{className:lo,onClick:()=>{i.CopySkeleton()},children:[ge.t("Duplicate Skeleton"),fe("div",{className:wf,children:"⇧ D"})]}),qe("div",{className:lo,onClick:()=>{i.RemoveSkeleton()},children:[ge.t("Delete Skeleton"),fe("div",{className:wf,children:ge.t("Del")})]}),fe("div",{className:lo,onClick:()=>{i.CopyKeypointToClipboard()},children:ge.t("Copy Keypoint Data")}),fe("div",{className:lo,onClick:()=>{i.SetRandomPose()},children:ge.t("Set Random Pose")}),fe("div",{className:lo,onClick:()=>i.DetectFromImage(r),children:ge.t("Detect From Image")}),nM()?fe("div",{className:lo,onClick:()=>{UM(!1),i.DetectFromImage(r)},children:ge.t("Detect From Image")+" [中国]"}):void 0]})})});async function w9(n){return await xi.show(x9,n)}const{MenubarRoot:S9,MenubarTrigger:is,MenubarContent:ua,MenubarItem:Qt,MenubarCheckboxItem:jl,MenubarRadioItem:b9,MenubarItemIndicator:fa,MenubarSeparator:im,RightSlot:Sf,Blue:M9,inset:zr}=t5,E9=({editor:n,onChangeBackground:e,onScreenShot:t,style:r})=>{const i=X2(),o=b.useMemo(()=>new j2(n),[n]),{current:s,changeLanguage:a,languagList:l}=s9();return b.useEffect(()=>{const c=f=>{w9({...f,editor:n,onChangeBackground:e})};return n?.ContextMenuEventManager.AddEventListener(c),()=>{n?.ContextMenuEventManager.RemoveEventListener(c)}},[n]),qe(UO,{className:S9,style:r,children:[qe(Qo,{children:[fe(Jo,{className:is,children:ge.t("File")}),fe(Ws,{children:qe(js,{className:ua,align:"start",sideOffset:5,alignOffset:-3,children:[fe(Zt,{className:Qt,onSelect:()=>n.ResetScene(),children:ge.t("Reset Scene")}),fe(Zt,{className:Qt,onSelect:()=>n.LoadScene(),children:ge.t("Load Scene")}),fe(Zt,{className:Qt,onSelect:()=>n.SaveScene(),children:ge.t("Save Scene")}),fe(Zt,{className:Qt,onSelect:()=>o.LoadGesture(),children:ge.t("Load Gesture")}),fe(Zt,{className:Qt,onSelect:()=>o.SaveGesture(),children:ge.t("Save Gesture")}),fe(Zt,{className:Qt,onSelect:()=>{o.GenerateSceneURL()},children:ge.t("Generate Scene URL")}),fe(fp,{className:im}),fe(Zt,{className:Qt,onSelect:()=>n.RestoreLastSavedScene(),children:ge.t("Restore Last Scene")}),fe(fp,{className:im}),fe(Zt,{className:Qt,onSelect:()=>o.DetectFromImage(e),children:ge.t("Detect From Image")}),nM()?fe(Zt,{className:Qt,onSelect:()=>{UM(!1),o.DetectFromImage(e)},children:ge.t("Detect From Image")+" [中国]"}):void 0,fe(Zt,{className:Qt,onSelect:()=>o.SetRandomPose(),children:ge.t("Set Random Pose")}),fe(Zt,{className:Qt,onSelect:async()=>{const c=await sM();c&&e(c)},children:ge.t("Set Background Image")}),qe(Zt,{className:Qt,children:["v","0.1.18"]})]})})]}),qe(Qo,{children:[fe(Jo,{className:is,children:ge.t("Edit")}),fe(Ws,{children:qe(js,{className:ua,align:"start",sideOffset:5,alignOffset:-3,children:[qe(Zt,{className:Qt,onSelect:()=>n.Undo(),children:[ge.t("Undo"),fe("div",{className:Sf,children:"⌘ Z"})]}),qe(Zt,{className:Qt,onSelect:()=>n.Redo(),children:[ge.t("Redo"),fe("div",{className:Sf,children:"⇧ ⌘ Z"})]}),fe(fp,{className:im}),qe(Zt,{className:Qt,onSelect:()=>n.CopySelectedBody(),children:[ge.t("Duplicate Skeleton"),fe("div",{className:Sf,children:"⇧ D"})]}),qe(Zt,{className:Qt,onSelect:()=>n.RemoveBody(),children:[ge.t("Delete Skeleton"),fe("div",{className:Sf,children:ge.t("Del")})]})]})})]}),qe(Qo,{children:[fe(Jo,{className:is,children:ge.t("View")}),fe(Ws,{children:qe(js,{className:ua,align:"start",sideOffset:5,alignOffset:-14,children:[fe(Zt,{className:Yn(Qt,zr),onSelect:()=>{n.LockView()},children:ge.t("Lock View")}),fe(Zt,{className:Yn(Qt,zr),onSelect:()=>{n.UnlockView()},children:ge.t("Unlock View")}),fe(Zt,{className:Yn(Qt,zr),onSelect:()=>{n.RestoreView()},children:ge.t("Restore View")})]})})]}),qe(Qo,{children:[fe(Jo,{className:is,children:ge.t("Setting")}),fe(Ws,{children:qe(js,{className:ua,align:"start",sideOffset:5,alignOffset:-14,children:[qe(Dl,{className:Yn(jl,zr),checked:n.MoveMode,onCheckedChange:()=>{n.MoveMode=!n.MoveMode,i()},children:[fe(Xs,{className:fa,children:fe(Cl,{})}),ge.t("Move Mode")]}),qe(Dl,{className:Yn(jl,zr),checked:n.FreeMode,onCheckedChange:()=>{n.FreeMode=!n.FreeMode,i()},children:[fe(Xs,{className:fa,children:fe(Cl,{})}),ge.t("Free Mode")]}),qe(Dl,{className:Yn(jl,zr),checked:n.OnlyHand,onCheckedChange:()=>{n.OnlyHand=!n.OnlyHand,i()},children:[fe(Xs,{className:fa,children:fe(Cl,{})}),ge.t("Only Hand")]}),qe(Dl,{className:Yn(jl,zr),checked:n.enablePreview,onCheckedChange:()=>{n.enablePreview=!n.enablePreview,i()},children:[fe(Xs,{className:fa,children:fe(Cl,{})}),ge.t("Show Preview")]}),qe(Dl,{className:Yn(jl,zr),checked:n.EnableHelper,onCheckedChange:()=>{n.EnableHelper=!n.EnableHelper,i()},children:[fe(Xs,{className:fa,children:fe(Cl,{})}),ge.t("Show Grid")]})]})})]}),qe(Qo,{children:[fe(Jo,{className:is,children:ge.t("Feedback")}),fe(Ws,{children:qe(js,{className:ua,align:"start",sideOffset:5,alignOffset:-14,children:[fe(Zt,{className:Yn(Qt,zr),onSelect:()=>{o.FeedbackByGithub()},children:"Github"}),fe(Zt,{className:Yn(Qt,zr),onSelect:()=>{o.FeedbackByQQ()},children:"QQ"})]})})]}),qe(Qo,{children:[fe(Jo,{className:is,children:"Language"}),fe(Ws,{children:fe(js,{className:ua,align:"start",sideOffset:5,alignOffset:-14,children:fe(zO,{value:s,onValueChange:c=>{a(c)},children:l.map(c=>qe(BO,{className:Yn(b9,zr),value:c,children:[fe(Xs,{className:fa,children:fe(qP,{})}),c]},c))})})})]}),fe(Qo,{children:fe(Jo,{className:Yn(is,M9),onClick:async()=>{const c=n.MakeImages(),f=Object.fromEntries(Object.entries(c).map(([u,d])=>[u,{src:d,title:u+"_"+Ad()}]));t(f)},children:ge.t("Generate")})})]})},K2="Popover",[Y2,W7]=vi(K2,[nh]),vh=nh(),[T9,hl]=Y2(K2),C9=n=>{const{__scopePopover:e,children:t,open:r,defaultOpen:i,onOpenChange:o,modal:s=!1}=n,a=vh(e),l=b.useRef(null),[c,f]=b.useState(!1),[u=!1,d]=el({prop:r,defaultProp:i,onChange:o});return b.createElement(_M,a,b.createElement(T9,{scope:e,contentId:wo(),triggerRef:l,open:u,onOpenChange:d,onOpenToggle:b.useCallback(()=>d(p=>!p),[d]),hasCustomAnchor:c,onCustomAnchorAdd:b.useCallback(()=>f(!0),[]),onCustomAnchorRemove:b.useCallback(()=>f(!1),[]),modal:s},t))},P9="PopoverTrigger",A9=b.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,i=hl(P9,t),o=vh(t),s=Ot(e,i.triggerRef),a=b.createElement(vt.button,Se({type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Q2(i.open)},r,{ref:s,onClick:Ve(n.onClick,i.onOpenToggle)}));return i.hasCustomAnchor?a:b.createElement(xM,Se({asChild:!0},o),a)}),q2="PopoverPortal",[L9,R9]=Y2(q2,{forceMount:void 0}),D9=n=>{const{__scopePopover:e,forceMount:t,children:r,container:i}=n,o=hl(q2,e);return b.createElement(L9,{scope:e,forceMount:t},b.createElement(yi,{present:t||o.open},b.createElement(Kd,{asChild:!0,container:i},r)))},Kc="PopoverContent",I9=b.forwardRef((n,e)=>{const t=R9(Kc,n.__scopePopover),{forceMount:r=t.forceMount,...i}=n,o=hl(Kc,n.__scopePopover);return b.createElement(yi,{present:r||o.open},o.modal?b.createElement(k9,Se({},i,{ref:e})):b.createElement(O9,Se({},i,{ref:e})))}),k9=b.forwardRef((n,e)=>{const t=hl(Kc,n.__scopePopover),r=b.useRef(null),i=Ot(e,r),o=b.useRef(!1);return b.useEffect(()=>{const s=r.current;if(s)return P0(s)},[]),b.createElement(C0,{as:As,allowPinchZoom:!0},b.createElement(Z2,Se({},n,{ref:i,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ve(n.onCloseAutoFocus,s=>{var a;s.preventDefault(),o.current||(a=t.triggerRef.current)===null||a===void 0||a.focus()}),onPointerDownOutside:Ve(n.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;o.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Ve(n.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})))}),O9=b.forwardRef((n,e)=>{const t=hl(Kc,n.__scopePopover),r=b.useRef(!1);return b.createElement(Z2,Se({},n,{ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o;if((o=n.onCloseAutoFocus)===null||o===void 0||o.call(n,i),!i.defaultPrevented){var s;r.current||(s=t.triggerRef.current)===null||s===void 0||s.focus(),i.preventDefault()}r.current=!1},onInteractOutside:i=>{var o,s;(o=n.onInteractOutside)===null||o===void 0||o.call(n,i),i.defaultPrevented||(r.current=!0);const a=i.target;((s=t.triggerRef.current)===null||s===void 0?void 0:s.contains(a))&&i.preventDefault()}}))}),Z2=b.forwardRef((n,e)=>{const{__scopePopover:t,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:f,...u}=n,d=hl(Kc,t),p=vh(t);return T0(),b.createElement(E0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o},b.createElement(Xd,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:f,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>d.onOpenChange(!1)},b.createElement(wM,Se({"data-state":Q2(d.open),role:"dialog",id:d.contentId},p,u,{ref:e,style:{...u.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}}))))}),F9=b.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,i=vh(t);return b.createElement(vk,Se({},i,r,{ref:e}))});function Q2(n){return n?"open":"closed"}const N9=C9,$9=A9,U9=D9,z9=I9,B9=F9,V9="_PopoverContent_1f240_5",H9="_slideDownAndFade_1f240_1",G9="_slideLeftAndFade_1f240_1",W9="_slideUpAndFade_1f240_1",j9="_slideRightAndFade_1f240_1",X9="_PopoverArrow_1f240_35",K9="_IconButton_1f240_39",Y9={PopoverContent:V9,slideDownAndFade:H9,slideLeftAndFade:G9,slideUpAndFade:W9,slideRightAndFade:j9,PopoverArrow:X9,IconButton:K9};function q9(n,[e,t]){return Math.min(t,Math.max(e,n))}function Z9(n){const e=b.useRef({value:n,previous:n});return b.useMemo(()=>(e.current.value!==n&&(e.current.previous=e.current.value,e.current.value=n),e.current.previous),[n])}const J2=["PageUp","PageDown"],eE=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],tE={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},lu="Slider",[nw,j7,Q9]=tu(lu),[nE,X7]=vi(lu,[Q9]),[J9,rv]=nE(lu),e7=b.forwardRef((n,e)=>{const{name:t,min:r=0,max:i=100,step:o=1,orientation:s="horizontal",disabled:a=!1,minStepsBetweenThumbs:l=0,defaultValue:c=[r],value:f,onValueChange:u=()=>{},onValueCommit:d=()=>{},inverted:p=!1,...v}=n,[m,g]=b.useState(null),_=Ot(e,R=>g(R)),y=b.useRef(new Set),x=b.useRef(0),S=s==="horizontal",T=m?Boolean(m.closest("form")):!0,C=S?n7:r7,[L=[],E]=el({prop:f,defaultProp:c,onChange:R=>{var N;(N=[...y.current][x.current])===null||N===void 0||N.focus(),u(R)}}),A=b.useRef(L);function I(R){const N=u7(L,R);H(R,N)}function q(R){H(R,x.current)}function ee(){const R=A.current[x.current];L[x.current]!==R&&d(L)}function H(R,N,{commit:Z}={commit:!1}){const K=h7(o),B=p7(Math.round((R-r)/o)*o+r,K),$=q9(B,[r,i]);E((W=[])=>{const ie=l7(W,$,N);if(d7(ie,l*o)){x.current=ie.indexOf($);const j=String(ie)!==String(W);return j&&Z&&d(ie),j?ie:W}else return W})}return b.createElement(J9,{scope:n.__scopeSlider,disabled:a,min:r,max:i,valueIndexToChangeRef:x,thumbs:y.current,values:L,orientation:s},b.createElement(nw.Provider,{scope:n.__scopeSlider},b.createElement(nw.Slot,{scope:n.__scopeSlider},b.createElement(C,Se({"aria-disabled":a,"data-disabled":a?"":void 0},v,{ref:_,onPointerDown:Ve(v.onPointerDown,()=>{a||(A.current=L)}),min:r,max:i,inverted:p,onSlideStart:a?void 0:I,onSlideMove:a?void 0:q,onSlideEnd:a?void 0:ee,onHomeKeyDown:()=>!a&&H(r,0,{commit:!0}),onEndKeyDown:()=>!a&&H(i,L.length-1,{commit:!0}),onStepKeyDown:({event:R,direction:N})=>{if(!a){const B=J2.includes(R.key)||R.shiftKey&&eE.includes(R.key)?10:1,$=x.current,W=L[$],ie=o*B*N;H(W+ie,$,{commit:!0})}}})))),T&&L.map((R,N)=>b.createElement(a7,{key:N,name:t?t+(L.length>1?"[]":""):void 0,value:R})))}),[rE,t7]=nE(lu,{startEdge:"left",endEdge:"right",size:"width",direction:1}),n7=b.forwardRef((n,e)=>{const{min:t,max:r,dir:i,inverted:o,onSlideStart:s,onSlideMove:a,onSlideEnd:l,onStepKeyDown:c,...f}=n,[u,d]=b.useState(null),p=Ot(e,x=>d(x)),v=b.useRef(),m=Jd(i),g=m==="ltr",_=g&&!o||!g&&o;function y(x){const S=v.current||u.getBoundingClientRect(),T=[0,S.width],L=oE(T,_?[t,r]:[r,t]);return v.current=S,L(x-S.left)}return b.createElement(rE,{scope:n.__scopeSlider,startEdge:_?"left":"right",endEdge:_?"right":"left",direction:_?1:-1,size:"width"},b.createElement(iE,Se({dir:m,"data-orientation":"horizontal"},f,{ref:p,style:{...f.style,["--radix-slider-thumb-transform"]:"translateX(-50%)"},onSlideStart:x=>{const S=y(x.clientX);s?.(S)},onSlideMove:x=>{const S=y(x.clientX);a?.(S)},onSlideEnd:()=>{v.current=void 0,l?.()},onStepKeyDown:x=>{const T=tE[_?"from-left":"from-right"].includes(x.key);c?.({event:x,direction:T?-1:1})}})))}),r7=b.forwardRef((n,e)=>{const{min:t,max:r,inverted:i,onSlideStart:o,onSlideMove:s,onSlideEnd:a,onStepKeyDown:l,...c}=n,f=b.useRef(null),u=Ot(e,f),d=b.useRef(),p=!i;function v(m){const g=d.current||f.current.getBoundingClientRect(),_=[0,g.height],x=oE(_,p?[r,t]:[t,r]);return d.current=g,x(m-g.top)}return b.createElement(rE,{scope:n.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1},b.createElement(iE,Se({"data-orientation":"vertical"},c,{ref:u,style:{...c.style,["--radix-slider-thumb-transform"]:"translateY(50%)"},onSlideStart:m=>{const g=v(m.clientY);o?.(g)},onSlideMove:m=>{const g=v(m.clientY);s?.(g)},onSlideEnd:()=>{d.current=void 0,a?.()},onStepKeyDown:m=>{const _=tE[p?"from-bottom":"from-top"].includes(m.key);l?.({event:m,direction:_?-1:1})}})))}),iE=b.forwardRef((n,e)=>{const{__scopeSlider:t,onSlideStart:r,onSlideMove:i,onSlideEnd:o,onHomeKeyDown:s,onEndKeyDown:a,onStepKeyDown:l,...c}=n,f=rv(lu,t);return b.createElement(vt.span,Se({},c,{ref:e,onKeyDown:Ve(n.onKeyDown,u=>{u.key==="Home"?(s(u),u.preventDefault()):u.key==="End"?(a(u),u.preventDefault()):J2.concat(eE).includes(u.key)&&(l(u),u.preventDefault())}),onPointerDown:Ve(n.onPointerDown,u=>{const d=u.target;d.setPointerCapture(u.pointerId),u.preventDefault(),f.thumbs.has(d)?d.focus():r(u)}),onPointerMove:Ve(n.onPointerMove,u=>{u.target.hasPointerCapture(u.pointerId)&&i(u)}),onPointerUp:Ve(n.onPointerUp,u=>{const d=u.target;d.hasPointerCapture(u.pointerId)&&(d.releasePointerCapture(u.pointerId),o(u))})}))}),i7="SliderTrack",o7=b.forwardRef((n,e)=>{const{__scopeSlider:t,...r}=n,i=rv(i7,t);return b.createElement(vt.span,Se({"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation},r,{ref:e}))}),rw="SliderRange",s7=b.forwardRef((n,e)=>{const{__scopeSlider:t,...r}=n,i=rv(rw,t),o=t7(rw,t),s=b.useRef(null),a=Ot(e,s),l=i.values.length,c=i.values.map(d=>c7(d,i.min,i.max)),f=l>1?Math.min(...c):0,u=100-Math.max(...c);return b.createElement(vt.span,Se({"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0},r,{ref:a,style:{...n.style,[o.startEdge]:f+"%",[o.endEdge]:u+"%"}}))}),a7=n=>{const{value:e,...t}=n,r=b.useRef(null),i=Z9(e);return b.useEffect(()=>{const o=r.current,s=window.HTMLInputElement.prototype,l=Object.getOwnPropertyDescriptor(s,"value").set;if(i!==e&&l){const c=new Event("input",{bubbles:!0});l.call(o,e),o.dispatchEvent(c)}},[i,e]),b.createElement("input",Se({style:{display:"none"}},t,{ref:r,defaultValue:e}))};function l7(n=[],e,t){const r=[...n];return r[t]=e,r.sort((i,o)=>i-o)}function c7(n,e,t){return 100/(t-e)*(n-e)}function u7(n,e){if(n.length===1)return 0;const t=n.map(i=>Math.abs(i-e)),r=Math.min(...t);return t.indexOf(r)}function f7(n){return n.slice(0,-1).map((e,t)=>n[t+1]-e)}function d7(n,e){if(e>0){const t=f7(n);return Math.min(...t)>=e}return!0}function oE(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(n[1]-n[0]);return e[0]+r*(t-n[0])}}function h7(n){return(String(n).split(".")[1]||"").length}function p7(n,e){const t=Math.pow(10,e);return Math.round(n*t)/t}const m7=e7,g7=o7,v7=s7,y7="_SliderRoot_1ofoi_4",_7="_SliderTrack_1ofoi_13",x7="_SliderRange_1ofoi_21",w7={SliderRoot:y7,SliderTrack:_7,SliderRange:x7},{SliderRoot:S7,SliderTrack:b7,SliderRange:M7}=w7,E7=({range:n,value:e,onValueChange:t,onValueCommit:r,style:i})=>fe("form",{style:{...i},children:fe(m7,{className:S7,value:[e],min:n[0],max:n[1],step:(n[1]-n[0])/150,onValueChange:([o])=>{t?.(o)},onValueCommit:([o])=>{r?.(o)},children:fe(g7,{className:b7,children:fe(v7,{className:M7})})})}),{PopoverContent:T7,IconButton:C7,PopoverArrow:P7,Input:A7}=Y9,iw=({type:n,name:e,range:t,getValue:r,onChange:i,onValueCommit:o,forceUpdate:s})=>{const a=r(),[l,c]=b.useState(()=>n=="int"?a.toString():r().toFixed(2));return b.useEffect(()=>{c(n=="int"?a.toString():r().toFixed(2))},[a]),qe("div",{style:{display:"flex",justifyContent:"flex-end"},children:[fe("div",{style:{minWidth:60,maxWidth:120,overflow:"hidden",color:"gray",fontSize:"70%",marginInlineEnd:10,textAlign:"end",textOverflow:"ellipsis"},children:e}),fe(E7,{range:t,value:r(),onValueChange:f=>{n=="int"?i?.(Math.round(f)):i?.(f),s()},onValueCommit:o,style:{width:150}},e),fe("input",{className:A7,style:{marginInlineStart:10,width:60,height:20,color:"gray",fontSize:"70%"},value:l,onChange:f=>{const u=f.target.value;c(u)},onBlur:()=>{try{let f=parseFloat(l);if(isNaN(f))throw"Is NaN";f=Math.max(Math.min(f,t[1]),t[0]),console.log(f),i?.(f)}catch{console.log("invalid input"),c(a.toString())}}})]})};function L7(n){const e={OutputWidth:{type:"int",range:[128,3e3],name:ge.t("Width")},OutputHeight:{type:"int",range:[128,3e3],name:ge.t("Height")},CameraNear:{range:[.1,2e3],name:ge.t("Camera Near")},CameraFar:{range:[.1,2e4],name:ge.t("Camera Far")},CameraFocalLength:{range:[.1,100],name:ge.t("Camera Focal Length")}};return Object.entries(e).map(([t,{type:r,range:i,name:o}])=>({type:r,name:o,range:i,getValue(){const s=n[t];return isNaN(s)?i[0]:s},onChange(s){n[t]=s}}))}function R7(n){const e={BoneThickness:{range:[.1,3],name:ge.t("Bone Thickness")},HeadSize:{range:[.1,100],name:ge.t("Head Size")},NoseToNeck:{range:[.1,100],name:ge.t("Nose To Neck")},ShoulderWidth:{range:[.1,100],name:ge.t("Shoulder Width")},ShoulderToHip:{range:[.1,100],name:ge.t("Shoulder To Hip")},ArmLength:{range:[.1,100],name:ge.t("Arm Length")},Forearm:{range:[.1,100],name:ge.t("Forearm")},UpperArm:{range:[.1,100],name:ge.t("Upper Arm")},HandSize:{range:[.1,10],name:ge.t("Hand Size")},Hips:{range:[.1,100],name:ge.t("Hips")},LegLength:{range:[.1,100],name:ge.t("Leg Length")},Thigh:{range:[.1,100],name:ge.t("Thigh")},LowerLeg:{range:[.1,100],name:ge.t("Lower Leg")},FootSize:{range:[.1,10],name:ge.t("Foot Size")}};function t(l,c,f,u,d){console.log(u,d);const p={execute:()=>{c[f]=d,c.Update()},undo:()=>{c[f]=u,c.Update()}};p.execute(),l.pushCommand(p)}let r=n.getSelectedBody(),i=r?new wn(r):null;const o=()=>{const l=n.getSelectedBody();return l!==r&&(r=l,i=l?new wn(l):null),i};let s=0,a=!1;return Object.entries(e).map(([l,{type:c,range:f,name:u}])=>({type:c,name:u,range:f,getValue:()=>{const d=l,p=o();return p?p[d]:-1},onChange(d){const p=l,v=o();v&&(a==!1&&(s=v[p]),a=!0,v[p]=d)},onValueCommit(d){const p=l,v=o();v&&(a=!1,t(n,v,p,s,d),v[p]=d)}}))}const D7=({editor:n,style:e})=>{const t=X2(),[r,i]=b.useState(!0),o=b.useMemo(()=>L7(n),[n]),s=b.useMemo(()=>R7(n),[n]),[a,l]=b.useState(!1);return b.useEffect(()=>{const c=()=>{l(!0)},f=()=>{l(!1)};return n.SelectEventManager.AddEventListener(c),n.UnselectEventManager.AddEventListener(f),()=>{n.SelectEventManager.RemoveEventListener(c),n.UnselectEventManager.RemoveEventListener(f)}},[n]),qe(N9,{open:r,children:[fe($9,{asChild:!0,children:fe("button",{className:C7,style:e,onClick:()=>i(c=>!c),children:fe(nA,{})})}),fe(U9,{children:qe(z9,{className:T7,sideOffset:5,children:[qe("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[o.map((c,f)=>fe(iw,{...c,forceUpdate:t},f)),a?qe(pT,{children:[fe("div",{style:{fontSize:15,marginTop:10,marginBottom:8},children:ge.t("Body Parameters")}),s.map((c,f)=>fe(iw,{...c,forceUpdate:t},f))]}):void 0]}),fe(B9,{className:P7})]})})]})},{app:I7,threejsCanvas:k7,gallery:O7,background:F7}=LI,N7=Dt.forwardRef(({isLock:n,enable:e,onChange:t,onRestore:r,onRun:i},o)=>qe("div",{style:{position:"relative",display:e?"flex":"none",justifyContent:"center",backgroundColor:"gray"},children:[fe("canvas",{ref:o,style:{objectFit:"contain",width:"unset",maxHeight:"100%",maxWidth:300}}),fe(sA,{style:{position:"absolute",top:-10,right:5,backgroundColor:"white",borderRadius:10,padding:5},onClick:()=>{i()}}),fe(n?QP:eA,{style:{position:"absolute",top:20,right:5,backgroundColor:"white",borderRadius:10,padding:5},onClick:()=>{t(!n)}}),fe(iA,{style:{position:"absolute",top:50,right:5,backgroundColor:n?"white":"gray",borderRadius:10,padding:5},onClick:()=>{n&&r()}})]}));function $7(){const n=b.useRef(null),e=b.useRef(null),t=b.useRef(null),r=o9(n,e,t),[i,o]=b.useState(()=>({pose:{title:"",src:""},depth:{title:"",src:""},normal:{title:"",src:""},canny:{title:"",src:""}})),s=b.useCallback(d=>{const p=t.current;p&&(p.style.backgroundImage=d?`url(${d})`:"none")},[]),a=b.useCallback(d=>{o(d)},[]),[l,c]=b.useState(!1),[f,u]=b.useState(!1);return b.useEffect(()=>{const d=v=>{c(v)},p=v=>{u(v)};return r?.PreviewEventManager.AddEventListener(d),r?.LockViewEventManager.AddEventListener(p),()=>{r?.PreviewEventManager.RemoveEventListener(d),r?.LockViewEventManager.RemoveEventListener(p)}},[r]),t9({GetAppVersion:()=>"0.1.18",MakeImages:()=>r?.MakeImages(),Pause:()=>r?.pause(),Resume:()=>r?.resume(),OutputWidth:d=>r&&typeof d=="number"?(r.OutputWidth=d,!0):!1,OutputHeight:d=>r&&typeof d=="number"?(r.OutputHeight=d,!0):!1,OnlyHand(d){return r&&typeof d=="boolean"?(r.OnlyHand=d,!0):!1},MoveMode(d){return r&&typeof d=="boolean"?(r.MoveMode=d,!0):!1},GetWidth:()=>r?.Width,GetHeight:()=>r?.Height,GetSceneData:()=>r?.GetSceneData(),LockView:()=>r?.LockView(),UnlockView:()=>r?.UnlockView(),RestoreView:()=>r?.RestoreView()}),qe("div",{ref:t,className:F7,children:[fe("canvas",{className:k7,tabIndex:-1,ref:n,onContextMenu:d=>{d.preventDefault()}}),qe("div",{className:O7,children:[fe(N7,{enable:l,ref:e,isLock:f,onChange:d=>{d?r?.LockView():r?.UnlockView()},onRestore:()=>{r?.RestoreView()},onRun:async()=>{if(!r)return;const d=r.MakeImages(),p=Object.fromEntries(Object.entries(d).map(([v,m])=>[v,{src:m,title:v+"_"+Ad()}]));a(p)}}),Object.entries(i).map(([d,{src:p,title:v}])=>fe("img",{...p?{src:p}:{},title:v,onClick:m=>{const g=m.target,_=g?.getAttribute("title")??"",y=g?.getAttribute("src")??"";rM(y,_)}},d))]}),fe("div",{className:I7,style:{pointerEvents:"none"},children:fe("div",{style:{pointerEvents:"initial",marginTop:10,display:"flex",justifyContent:"center"},children:r?fe(E9,{editor:r,onChangeBackground:s,onScreenShot:a}):void 0})}),r?fe(D7,{editor:r,style:{pointerEvents:"initial",position:"fixed",top:10,right:10}}):void 0]})}function U7(){sg.createRoot(document.getElementById("root")).render(fe(Dt.StrictMode,{children:fe(xi.Provider,{children:fe($7,{})})}))}U7();