var Lv=Object.defineProperty;var Bv=(d,l,s)=>l in d?Lv(d,l,{enumerable:!0,configurable:!0,writable:!0,value:s}):d[l]=s;var yt=(d,l,s)=>Bv(d,typeof l!="symbol"?l+"":l,s);import{r as Uv,g as Hv}from"./jszip-g7iHT04s.js";import{V as Es,a as $e,C as Gv,L as Ms,b as pi,F as du,T as bp,R as ws,c as rf,d as cf,M as Ss,e as Vv,f as qn,g as vt,S as mt,E as Fv,h as We,G as Ye,B as ff,P as Cs,O as di,i as Ef,j as df,k as pt,l as Tp,D as cu,m as Ap,n as P,o as Ts,p as xp,q as Ep,A as Xv,r as gi,s as vn,U as Yv,t as qv,u as Mf,v as Iv,w as hl,x as Mp,Q as Xn,y as hf,z as fu,N as mf,H as Kv,I as pf,J as wp,K as In,W as ra,X as Qv,Y as Zv,Z as kv,_ as Fc,$ as Jv,a0 as Cp,a1 as Pv,a2 as $v,a3 as Wv,a4 as gf,a5 as vi,a6 as e1,a7 as bs,a8 as As,a9 as wf,aa as t1,ab as hi,ac as yf,ad as n1,ae as ru,af as Np,ag as a1,ah as _p,ai as l1,aj as i1,ak as s1,al as vf,am as o1,an as be,ao as Vt,ap as ml,aq as u1,ar as r1,as as Xc,at as c1,au as f1,av as d1,aw as h1,ax as m1,ay as p1,az as g1,aA as y1,aB as Rp,aC as Yc,aD as v1,aE as S1}from"./three-CcaN5THO.js";(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const c of r)if(c.type==="childList")for(const f of c.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&o(f)}).observe(document,{childList:!0,subtree:!0});function s(r){const c={};return r.integrity&&(c.integrity=r.integrity),r.referrerPolicy&&(c.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?c.credentials="include":r.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(r){if(r.ep)return;r.ep=!0;const c=s(r);fetch(r.href,c)}})();var qc={exports:{}},ps={};/** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var k0;function b1(){if(k0)return ps;k0=1;var d=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function s(o,r,c){var f=null;if(c!==void 0&&(f=""+c),r.key!==void 0&&(f=""+r.key),"key"in r){c={};for(var h in r)h!=="key"&&(c[h]=r[h])}else c=r;return r=c.ref,{$$typeof:d,type:o,key:f,ref:r!==void 0?r:null,props:c}}return ps.Fragment=l,ps.jsx=s,ps.jsxs=s,ps}var J0;function T1(){return J0||(J0=1,qc.exports=b1()),qc.exports}var A=T1(),Ic={exports:{}},ye={};/** * @license React * react.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var P0;function A1(){if(P0)return ye;P0=1;var d=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),f=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),S=Symbol.for("react.view_transition"),T=Symbol.iterator;function C(N){return N===null||typeof N!="object"?null:(N=T&&N[T]||N["@@iterator"],typeof N=="function"?N:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M=Object.assign,R={};function L(N,I,ne){this.props=N,this.context=I,this.refs=R,this.updater=ne||w}L.prototype.isReactComponent={},L.prototype.setState=function(N,I){if(typeof N!="object"&&typeof N!="function"&&N!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,N,I,"setState")},L.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function O(){}O.prototype=L.prototype;function U(N,I,ne){this.props=N,this.context=I,this.refs=R,this.updater=ne||w}var Q=U.prototype=new O;Q.constructor=U,M(Q,L.prototype),Q.isPureReactComponent=!0;var F=Array.isArray;function V(){}var X={H:null,A:null,T:null,S:null},le=Object.prototype.hasOwnProperty;function de(N,I,ne){var ae=ne.ref;return{$$typeof:d,type:N,key:I,ref:ae!==void 0?ae:null,props:ne}}function ce(N,I){return de(N.type,I,N.props)}function he(N){return typeof N=="object"&&N!==null&&N.$$typeof===d}function Ke(N){var I={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(ne){return I[ne]})}var Qe=/\/+/g;function Oe(N,I){return typeof N=="object"&&N!==null&&N.key!=null?Ke(""+N.key):I.toString(36)}function Z(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(V,V):(N.status="pending",N.then(function(I){N.status==="pending"&&(N.status="fulfilled",N.value=I)},function(I){N.status==="pending"&&(N.status="rejected",N.reason=I)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function J(N,I,ne,ae,Se){var ve=typeof N;(ve==="undefined"||ve==="boolean")&&(N=null);var Te=!1;if(N===null)Te=!0;else switch(ve){case"bigint":case"string":case"number":Te=!0;break;case"object":switch(N.$$typeof){case d:case l:Te=!0;break;case v:return Te=N._init,J(Te(N._payload),I,ne,ae,Se)}}if(Te)return Se=Se(N),Te=ae===""?"."+Oe(N,0):ae,F(Se)?(ne="",Te!=null&&(ne=Te.replace(Qe,"$&/")+"/"),J(Se,I,ne,"",function(Ze){return Ze})):Se!=null&&(he(Se)&&(Se=ce(Se,ne+(Se.key==null||N&&N.key===Se.key?"":(""+Se.key).replace(Qe,"$&/")+"/")+Te)),I.push(Se)),1;Te=0;var W=ae===""?".":ae+":";if(F(N))for(var $=0;$>>1,ge=Z[ue];if(0>>1;uer(Le,ee))Nr(I,Le)?(Z[ue]=I,Z[N]=ee,ue=N):(Z[ue]=Le,Z[se]=ee,ue=se);else if(Nr(I,ee))Z[ue]=I,Z[N]=ee,ue=N;else break e}}return J}function r(Z,J){var ee=Z.sortIndex-J.sortIndex;return ee!==0?ee:Z.id-J.id}if(d.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;d.unstable_now=function(){return c.now()}}else{var f=Date,h=f.now();d.unstable_now=function(){return f.now()-h}}var g=[],y=[],v=1,m=null,S=3,T=!1,C=!1,w=!1,M=!1,R=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function U(Z){for(var J=s(y);J!==null;){if(J.callback===null)o(y);else if(J.startTime<=Z)o(y),J.sortIndex=J.expirationTime,l(g,J);else break;J=s(y)}}function Q(Z){if(w=!1,U(Z),!C)if(s(g)!==null)C=!0,F||(F=!0,he());else{var J=s(y);J!==null&&Oe(Q,J.startTime-Z)}}var F=!1,V=-1,X=5,le=-1;function de(){return M?!0:!(d.unstable_now()-leZ&&de());){var ue=m.callback;if(typeof ue=="function"){m.callback=null,S=m.priorityLevel;var ge=ue(m.expirationTime<=Z);if(Z=d.unstable_now(),typeof ge=="function"){m.callback=ge,U(Z),J=!0;break t}m===s(g)&&o(g),U(Z)}else o(g);m=s(g)}if(m!==null)J=!0;else{var He=s(y);He!==null&&Oe(Q,He.startTime-Z),J=!1}}break e}finally{m=null,S=ee,T=!1}J=void 0}}finally{J?he():F=!1}}}var he;if(typeof O=="function")he=function(){O(ce)};else if(typeof MessageChannel<"u"){var Ke=new MessageChannel,Qe=Ke.port2;Ke.port1.onmessage=ce,he=function(){Qe.postMessage(null)}}else he=function(){R(ce,0)};function Oe(Z,J){V=R(function(){Z(d.unstable_now())},J)}d.unstable_IdlePriority=5,d.unstable_ImmediatePriority=1,d.unstable_LowPriority=4,d.unstable_NormalPriority=3,d.unstable_Profiling=null,d.unstable_UserBlockingPriority=2,d.unstable_cancelCallback=function(Z){Z.callback=null},d.unstable_forceFrameRate=function(Z){0>Z||125ue?(Z.sortIndex=ee,l(y,Z),s(g)===null&&Z===s(y)&&(w?(L(V),V=-1):w=!0,Oe(Q,ee-ue))):(Z.sortIndex=ge,l(g,Z),C||T||(C=!0,F||(F=!0,he()))),Z},d.unstable_shouldYield=de,d.unstable_wrapCallback=function(Z){var J=S;return function(){var ee=S;S=J;try{return Z.apply(this,arguments)}finally{S=ee}}}})(Zc)),Zc}var ep;function E1(){return ep||(ep=1,Qc.exports=x1()),Qc.exports}var kc={exports:{}},Ot={};/** * @license React * react-dom.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var tp;function M1(){if(tp)return Ot;tp=1;var d=Cf();function l(v){var m="https://react.dev/errors/"+v;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(d)}catch(l){console.error(l)}}return d(),kc.exports=M1(),kc.exports}/** * @license React * react-dom-client.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ap;function C1(){if(ap)return gs;ap=1;var d=E1(),l=Cf(),s=w1();function o(e){var t="https://react.dev/errors/"+e;if(1we||(e.current=zt[we],zt[we]=null,we--)}function Be(e,t){we++,zt[we]=e.current,e.current=t}var sn=nt(null),Fa=nt(null),_n=nt(null),pl=nt(null);function gl(e,t){switch(Be(_n,t),Be(Fa,e),Be(sn,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?l0(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=l0(t),e=i0(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}lt(sn),Be(sn,e)}function ca(){lt(sn),lt(Fa),lt(_n)}function bi(e){var t=e.memoizedState;t!==null&&(ui._currentValue=t.memoizedState,Be(pl,e)),t=sn.current;var n=i0(t,e.type);t!==n&&(Be(Fa,e),Be(sn,n))}function yl(e){Fa.current===e&&(lt(sn),lt(Fa)),pl.current===e&&(lt(pl),ui._currentValue=Ze)}var vl,Rs;function qe(e){if(vl===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);vl=t&&t[1]||"",Rs=-1)":-1i||x[a]!==j[i]){var G=` `+x[a].replace(" at new "," at ");return e.displayName&&G.includes("")&&(G=G.replace("",e.displayName)),G}while(1<=a&&0<=i);break}}}finally{fa=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?qe(n):""}function E(e,t){switch(e.tag){case 26:case 27:case 5:return qe(e.type);case 16:return qe("Lazy");case 13:return e.child!==t&&t!==null?qe("Suspense Fallback"):qe("Suspense");case 19:return qe("SuspenseList");case 0:case 15:return Sl(e.type,!1);case 11:return Sl(e.type.render,!1);case 1:return Sl(e.type,!0);case 31:return qe("Activity");case 30:return qe("ViewTransition");default:return""}}function K(e){try{var t="",n=null;do t+=E(e,n),n=e,e=e.return;while(e);return t}catch(a){return` Error generating stack: `+a.message+` `+a.stack}}var oe=Object.prototype.hasOwnProperty,me=d.unstable_scheduleCallback,Mt=d.unstable_cancelCallback,St=d.unstable_shouldYield,Zt=d.unstable_requestPaint,bt=d.unstable_now,Rn=d.unstable_getCurrentPriorityLevel,Ds=d.unstable_ImmediatePriority,Os=d.unstable_UserBlockingPriority,bl=d.unstable_NormalPriority,Ti=d.unstable_LowPriority,Tl=d.unstable_IdlePriority,hu=d.log,Ip=d.unstable_setDisableYieldValue,Ai=null,kt=null;function da(e){if(typeof hu=="function"&&Ip(e),kt&&typeof kt.setStrictMode=="function")try{kt.setStrictMode(Ai,e)}catch{}}var Jt=Math.clz32?Math.clz32:Zp,Kp=Math.log,Qp=Math.LN2;function Zp(e){return e>>>=0,e===0?32:31-(Kp(e)/Qp|0)|0}var zs=256,js=262144,Ls=4194304;function Xa(e){var t=e&42;if(t!==0)return t;switch(e&-e){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Bs(e,t,n){var a=e.pendingLanes;if(a===0)return 0;var i=0,u=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var b=a&134217727;return b!==0?(a=b&~u,a!==0?i=Xa(a):(p&=b,p!==0?i=Xa(p):n||(n=b&~e,n!==0&&(i=Xa(n))))):(b=a&~u,b!==0?i=Xa(b):p!==0?i=Xa(p):n||(n=a&~e,n!==0&&(i=Xa(n)))),i===0?0:t!==0&&t!==i&&(t&u)===0&&(u=i&-i,n=t&-t,u>=n||u===32&&(n&4194048)!==0)?t:i}function xi(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Rf(e,t){(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0n;n++)t.push(e);return t}function Ei(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Jp(e,t,n,a,i,u){var p=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var b=e.entanglements,x=e.expirationTimes,j=e.hiddenUpdates;for(n=p&~n;0"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Eu=!1;if(Zn)try{var Ni={};Object.defineProperty(Ni,"passive",{get:function(){Eu=!0}}),window.addEventListener("test",Ni,Ni),window.removeEventListener("test",Ni,Ni)}catch{Eu=!1}var ha=null,Mu=null,Xs=null;function ed(){if(Xs)return Xs;var e,t=Mu,n=t.length,a,i="value"in ha?ha.value:ha.textContent,u=i.length;for(e=0;e=Di),sd=" ",od=!1;function ud(e,t){switch(e){case"keyup":return Og.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function rd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Rl=!1;function jg(e,t){switch(e){case"compositionend":return rd(t);case"keypress":return t.which!==32?null:(od=!0,sd);case"textInput":return e=t.data,e===sd&&od?null:e;default:return null}}function Lg(e,t){if(Rl)return e==="compositionend"||!Ru&&ud(e,t)?(e=ed(),Xs=Mu=ha=null,Rl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function yd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vd(e,t){var n=yd(e);e=0;for(var a;n;){if(n.nodeType===3){if(a=e+n.textContent.length,e<=t&&a>=t)return{node:n,offset:t-e};e=a}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=yd(n)}}function Sd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Sd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function bd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=zu(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=zu(e.document)}return t}function ju(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Yg=Zn&&"documentMode"in document&&11>=document.documentMode,Dl=null,Lu=null,Li=null,Bu=!1;function Td(e,t,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Bu||Dl==null||Dl!==zu(a)||(a=Dl,"selectionStart"in a&&ju(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Li&&ji(Li,a)||(Li=a,a=Zo(Lu,"onSelect"),0>=p,i-=p,On=1<<32-Jt(t)+i|n<pe?(ht=fe,fe=null):ht=fe.sibling;var ze=D(z,fe,B[pe],Y);if(ze===null){fe===null&&(fe=ht);break}e&&fe&&ze.alternate===null&&t(z,fe),_=u(ze,_,pe),De===null?te=ze:De.sibling=ze,De=ze,fe=ht}if(pe===B.length)return n(z,fe),Ee&&$n(z,pe),te;if(fe===null){for(;pepe?(ht=fe,fe=null):ht=fe.sibling;var Ha=D(z,fe,ze.value,Y);if(Ha===null){fe===null&&(fe=ht);break}e&&fe&&Ha.alternate===null&&t(z,fe),_=u(Ha,_,pe),De===null?te=Ha:De.sibling=Ha,De=Ha,fe=ht}if(ze.done)return n(z,fe),Ee&&$n(z,pe),te;if(fe===null){for(;!ze.done;pe++,ze=B.next())ze=q(z,ze.value,Y),ze!==null&&(_=u(ze,_,pe),De===null?te=ze:De.sibling=ze,De=ze);return Ee&&$n(z,pe),te}for(fe=a(fe);!ze.done;pe++,ze=B.next())ze=H(fe,z,pe,ze.value,Y),ze!==null&&(e&&(ht=ze.alternate,ht!==null&&fe.delete(ht.key===null?pe:ht.key)),_=u(ze,_,pe),De===null?te=ze:De.sibling=ze,De=ze);return e&&fe.forEach(function(jv){return t(z,jv)}),Ee&&$n(z,pe),te}function xe(z,_,B,Y){if(typeof B=="object"&&B!==null&&B.type===ce&&B.key===null&&B.props.ref===void 0&&(B=B.props.children),typeof B=="object"&&B!==null){switch(B.$$typeof){case le:e:{for(var te=B.key;_!==null;){if(_.key===te){if(te=B.type,te===ce){if(_.tag===7){n(z,_.sibling),Y=i(_,B.props.children),Sa(Y,B),Y.return=z,z=Y;break e}}else if(_.elementType===te||typeof te=="object"&&te!==null&&te.$$typeof===ge&&tl(te)===_.type){n(z,_.sibling),Y=i(_,B.props),Sa(Y,B),Y.return=z,z=Y;break e}n(z,_);break}else t(z,_);_=_.sibling}B.type===ce?(Y=Za(B.props.children,z.mode,Y,B.key),Sa(Y,B),Y.return=z,z=Y):(Y=$s(B.type,B.key,B.props,null,z.mode,Y),Sa(Y,B),Y.return=z,z=Y)}return p(z);case de:e:{for(te=B.key;_!==null;){if(_.key===te)if(_.tag===4&&_.stateNode.containerInfo===B.containerInfo&&_.stateNode.implementation===B.implementation){n(z,_.sibling),Y=i(_,B.children||[]),Y.return=z,z=Y;break e}else{n(z,_);break}else t(z,_);_=_.sibling}Y=Yu(B,z.mode,Y),Y.return=z,z=Y}return p(z);case ge:return B=tl(B),xe(z,_,B,Y)}if(Te(B))return k(z,_,B,Y);if(ae(B)){if(te=ae(B),typeof te!="function")throw Error(o(150));return B=te.call(B),ie(z,_,B,Y)}if(typeof B.then=="function")return xe(z,_,uo(B),Y);if(B.$$typeof===Oe)return xe(z,_,lo(z,B),Y);ro(z,B)}return typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint"?(B=""+B,_!==null&&_.tag===6?(n(z,_.sibling),Y=i(_,B),Y.return=z,z=Y):(n(z,_),Y=Xu(B,z.mode,Y),Y.return=z,z=Y),p(z)):n(z,_)}return function(z,_,B,Y){try{Fi=0;var te=xe(z,_,B,Y);return Vl=null,te}catch(fe){if(fe===Gl||fe===so)throw fe;var De=Xt(29,fe,null,z.mode);return De.lanes=Y,De.return=z,De}finally{}}}var al=Id(!0),Kd=Id(!1),ba=!1;function Wu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function er(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ta(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Aa(e,t,n){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(Ue&2)!==0){var i=a.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),a.pending=t,t=Ps(e),_d(e,null,n),t}return Js(e,a,t,n),Ps(e)}function Xi(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,zf(e,n)}}function tr(e,t){var n=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,n===a)){var i=null,u=null;if(n=n.firstBaseUpdate,n!==null){do{var p={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};u===null?i=u=p:u=u.next=p,n=n.next}while(n!==null);u===null?i=u=t:u=u.next=t}else i=u=t;n={baseState:a.baseState,firstBaseUpdate:i,lastBaseUpdate:u,shared:a.shared,callbacks:a.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var nr=!1;function Yi(){if(nr){var e=Hl;if(e!==null)throw e}}function qi(e,t,n,a){nr=!1;var i=e.updateQueue;ba=!1;var u=i.firstBaseUpdate,p=i.lastBaseUpdate,b=i.shared.pending;if(b!==null){i.shared.pending=null;var x=b,j=x.next;x.next=null,p===null?u=j:p.next=j,p=x;var G=e.alternate;G!==null&&(G=G.updateQueue,b=G.lastBaseUpdate,b!==p&&(b===null?G.firstBaseUpdate=j:b.next=j,G.lastBaseUpdate=x))}if(u!==null){var q=i.baseState;p=0,G=j=x=null,b=u;do{var D=b.lane&-536870913,H=D!==b.lane;if(H?(Re&D)===D:(a&D)===D){D!==0&&D===Wa&&(nr=!0),G!==null&&(G=G.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var k=e,ie=b;D=t;var xe=n;switch(ie.tag){case 1:if(k=ie.payload,typeof k=="function"){q=k.call(xe,q,D);break e}q=k;break e;case 3:k.flags=k.flags&-65537|128;case 0:if(k=ie.payload,D=typeof k=="function"?k.call(xe,q,D):k,D==null)break e;q=V({},q,D);break e;case 2:ba=!0}}D=b.callback,D!==null&&(e.flags|=64,H&&(e.flags|=8192),H=i.callbacks,H===null?i.callbacks=[D]:H.push(D))}else H={lane:D,tag:b.tag,payload:b.payload,callback:b.callback,next:null},G===null?(j=G=H,x=q):G=G.next=H,p|=D;if(b=b.next,b===null){if(b=i.shared.pending,b===null)break;H=b,b=H.next,H.next=null,i.lastBaseUpdate=H,i.shared.pending=null}}while(!0);G===null&&(x=q),i.baseState=x,i.firstBaseUpdate=j,i.lastBaseUpdate=G,u===null&&(i.shared.lanes=0),_a|=p,e.lanes=p,e.memoizedState=q}}function Qd(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Zd(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;eu?u:8;var p=W.T,b={};b.types=p!==null?p.types:null,W.T=b,Ar(e,!1,t,n);try{var x=i(),j=W.S;if(j!==null&&j(b,x),x!==null&&typeof x=="object"&&typeof x.then=="function"){var G=ey(x,a);Zi(e,t,G,an(e))}else Zi(e,t,a,an(e))}catch(q){Zi(e,t,{then:function(){},status:"rejected",reason:q},an())}finally{$.p=u,p!==null&&b.types!==null&&(p.types=b.types),W.T=p}}function sy(){}function br(e,t,n,a){if(e.tag!==5)throw Error(o(476));var i=wh(e).queue;Mh(e,i,t,Ze,n===null?sy:function(){return Ch(e),n(a)})}function wh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Ze,baseState:Ze,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:na,lastRenderedState:Ze},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:na,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ch(e){var t=wh(e);t.next===null&&(t=e.alternate.memoizedState),Zi(e,t.next.queue,{},an())}function Tr(){return Ct(ui)}function Nh(){return ut().memoizedState}function _h(){return ut().memoizedState}function oy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=an();e=Ta(n);var a=Aa(t,e,n);a!==null&&(Kt(a,t,n),Xi(a,t,n)),t={cache:ku()},e.payload=t;return}t=t.return}}function uy(e,t,n){var a=an();n={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},bo(e)?Dh(t,n):(n=Vu(e,t,n,a),n!==null&&(Kt(n,e,a),Oh(n,t,a)))}function Rh(e,t,n){var a=an();Zi(e,t,n,a)}function Zi(e,t,n,a){var i={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(bo(e))Dh(t,i);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var p=t.lastRenderedState,b=u(p,n);if(i.hasEagerState=!0,i.eagerState=b,$t(b,p))return Js(e,t,i,0),ke===null&&ks(),!1}catch{}finally{}if(n=Vu(e,t,i,a),n!==null)return Kt(n,e,a),Oh(n,t,a),!0}return!1}function Ar(e,t,n,a){if(a={lane:2,revertLane:dc(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},bo(e)){if(t)throw Error(o(479))}else t=Vu(e,n,a,2),t!==null&&Kt(t,e,2)}function bo(e){var t=e.alternate;return e===Ae||t!==null&&t===Ae}function Dh(e,t){Fl=ho=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Oh(e,t,n){if((n&4194048)!==0){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,zf(e,n)}}var To={readContext:Ct,use:go,useCallback:st,useContext:st,useEffect:st,useImperativeHandle:st,useLayoutEffect:st,useInsertionEffect:st,useMemo:st,useReducer:st,useRef:st,useState:st,useDebugValue:st,useDeferredValue:st,useTransition:st,useSyncExternalStore:st,useId:st,useHostTransitionStatus:st,useFormState:st,useActionState:st,useOptimistic:st,useMemoCache:st,useCacheRefresh:st,useEffectEvent:st},zh={readContext:Ct,use:go,useCallback:function(e,t){return Bt().memoizedState=[e,t===void 0?null:t],e},useContext:Ct,useEffect:gh,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,vo(4194308,4,bh.bind(null,t,e),n)},useLayoutEffect:function(e,t){return vo(4194308,4,e,t)},useInsertionEffect:function(e,t){vo(4,2,e,t)},useMemo:function(e,t){var n=Bt();t=t===void 0?null:t;var a=e();if(ll){da(!0);try{e()}finally{da(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=Bt();if(n!==void 0){var i=n(t);if(ll){da(!0);try{n(t)}finally{da(!1)}}}else i=t;return a.memoizedState=a.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},a.queue=e,e=e.dispatch=uy.bind(null,Ae,e),[a.memoizedState,e]},useRef:function(e){var t=Bt();return e={current:e},t.memoizedState=e},useState:function(e){e=pr(e);var t=e.queue,n=Rh.bind(null,Ae,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:vr,useDeferredValue:function(e,t){var n=Bt();return Sr(n,e,t)},useTransition:function(){var e=pr(!1);return e=Mh.bind(null,Ae,e.queue,!0,!1),Bt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=Ae,i=Bt();if(Ee){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),ke===null)throw Error(o(349));(Re&127)!==0||eh(a,t,n)}i.memoizedState=n;var u={value:n,getSnapshot:t};return i.queue=u,gh(nh.bind(null,a,u,e),[e]),a.flags|=2048,Yl(9,{destroy:void 0},th.bind(null,a,u,n,t),null),n},useId:function(){var e=Bt(),t=ke.identifierPrefix;if(Ee){var n=zn,a=On;n=(a&~(1<<32-Jt(a)-1)).toString(32)+n,t="_"+t+"R_"+n,n=mo++,0<\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof a.is=="string"?p.createElement("select",{is:a.is}):p.createElement("select"),a.multiple?u.multiple=!0:a.size&&(u.size=a.size);break;default:u=typeof a.is=="string"?p.createElement(i,{is:a.is}):p.createElement(i)}}u[wt]=t,u[Ft]=a;e:for(p=t.child;p!==null;){if(p.tag===5||p.tag===6)u.appendChild(p.stateNode);else if(p.tag!==4&&p.tag!==27&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===t)break e;for(;p.sibling===null;){if(p.return===null||p.return===t)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}t.stateNode=u;e:switch(Dt(u,i,a),i){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&la(t)}}return Pe(t),t.subtreeFlags&=-33554433,Lr(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&la(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(o(166));if(e=_n.current,Ul(t)){if(e=t.stateNode,n=t.memoizedProps,a=null,i=At,i!==null)switch(i.tag){case 27:case 5:a=i.memoizedProps}e[wt]=t,e=!!(e.nodeValue===n||a!==null&&a.suppressHydrationWarning===!0||n0(e.nodeValue,n)),e||ya(t,!0)}else e=os(e).createTextNode(a),e[wt]=t,t.stateNode=e}return Pe(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(a=Ul(t),n!==null){if(e===null){if(!a)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[wt]=t}else ka(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Pe(t),e=!1}else n=Ku(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Wt(t),t):(Wt(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Pe(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Ul(t),a!==null&&a.dehydrated!==null){if(e===null){if(!i)throw Error(o(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(o(317));i[wt]=t}else ka(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Pe(t),i=!1}else i=Ku(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(Wt(t),t):(Wt(t),null)}return Wt(t),(t.flags&128)!==0?(t.lanes=n,t):(n=a!==null,e=e!==null&&e.memoizedState!==null,n&&(a=t.child,i=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(i=a.alternate.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==i&&(a.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Co(t,t.updateQueue),Pe(t),null);case 4:return ca(),e===null&&gc(t.stateNode.containerInfo),t.flags|=67108864,Pe(t),null;case 10:return ea(t.type),Pe(t),null;case 19:if(sr(t),a=t.memoizedState,a===null)return Pe(t),null;if(i=(t.flags&128)!==0,u=a.rendering,u===null)if(i)Ji(a,!1);else{if(ot!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=fo(e),u!==null){for(t.flags|=128,Ji(a,!1),e=u.updateQueue,t.updateQueue=e,Co(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Rd(n,e),n=n.sibling;return Ii(t,_t.current&1|2),Ee&&$n(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&bt()>Go&&(t.flags|=128,i=!0,Ji(a,!1),t.lanes=4194304)}else{if(!i)if(e=fo(u),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Co(t,e),Ji(a,!0),a.tail===null&&a.tailMode!=="collapsed"&&a.tailMode!=="visible"&&!u.alternate&&!Ee)return Pe(t),null}else 2*bt()-a.renderingStartTime>Go&&n!==536870912&&(t.flags|=128,i=!0,Ji(a,!1),t.lanes=4194304);a.isBackwards?(u.sibling=t.child,t.child=u):(e=a.last,e!==null?e.sibling=u:t.child=u,a.last=u)}if(a.tail!==null){e=a.tail;e:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break e}n=n.sibling}n=!0}return a.rendering=e,a.tail=e.sibling,a.renderingStartTime=bt(),e.sibling=null,u=_t.current,u=i?u&1|2:u&1,a.tailMode==="visible"||a.tailMode==="collapsed"||!n||Ee?Ii(t,u):(n=u,Be(Nt,t),Be(_t,n),jt===null&&(jt=t)),Ee&&$n(t,a.treeForkCount),e}return Pe(t),null;case 22:case 23:return Wt(t),lr(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(n&536870912)!==0&&(t.flags&128)===0&&(Pe(t),t.subtreeFlags&6&&(t.flags|=8192)):Pe(t),n=t.updateQueue,n!==null&&Co(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==n&&(t.flags|=2048),e!==null&<(el),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ea(ct),Pe(t),null;case 25:return null;case 30:return t.flags|=33554432,Pe(t),null}throw Error(o(156,t.tag))}function py(e,t){switch(qu(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ea(ct),ca(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return yl(t),null;case 31:if(t.memoizedState!==null){if(Wt(t),t.alternate===null)throw Error(o(340));ka()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Wt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));ka()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return sr(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return ca(),null;case 10:return ea(t.type),null;case 22:case 23:return Wt(t),lr(),e!==null&<(el),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ea(ct),null;case 25:return null;default:return null}}function lm(e,t){switch(qu(t),t.tag){case 3:ea(ct),ca();break;case 26:case 27:case 5:yl(t);break;case 4:ca();break;case 31:t.memoizedState!==null&&Wt(t);break;case 13:Wt(t);break;case 19:sr(t);break;case 10:ea(t.type);break;case 22:case 23:Wt(t),lr(),e!==null&<(el);break;case 24:ea(ct)}}function Pi(e,t){try{var n=t.updateQueue,a=n!==null?n.lastEffect:null;if(a!==null){var i=a.next;n=i;do{if((n.tag&e)===e){a=void 0;var u=n.create,p=n.inst;a=u(),p.destroy=a}n=n.next}while(n!==i)}}catch(b){Fe(t,t.return,b)}}function wa(e,t,n){try{var a=t.updateQueue,i=a!==null?a.lastEffect:null;if(i!==null){var u=i.next;a=u;do{if((a.tag&e)===e){var p=a.inst,b=p.destroy;if(b!==void 0){p.destroy=void 0,i=t;var x=n,j=b;try{j()}catch(G){Fe(i,x,G)}}}a=a.next}while(a!==u)}}catch(G){Fe(t,t.return,G)}}function im(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Zd(t,n)}catch(a){Fe(e,e.return,a)}}}function sm(e,t,n){n.props=il(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(a){Fe(e,t,a)}}function jn(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:var i=e.stateNode,u=kn(e.memoizedProps,i);(i.ref===null||i.ref.name!==u)&&(i.ref=h0(u)),a=i.ref;break;case 7:if(e.stateNode===null){var p=new ln(e);m(e.child,!1,iv,p,void 0,void 0),e.stateNode=p}a=e.stateNode;break;default:a=e.stateNode}typeof n=="function"?e.refCleanup=n(a):n.current=a}}catch(b){Fe(e,t,b)}}function Rt(e,t){var n=e.ref,a=e.refCleanup;if(n!==null)if(typeof a=="function")try{a()}catch(i){Fe(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(i){Fe(e,t,i)}else n.current=null}function No(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n title"))),Dt(a,t,n),a[wt]=e,Tt(a),t=a;break e;case"link":if(u=R0("link","href",i).get(t+(n.href||""))){for(p=0;pxe&&(p=xe,xe=ie,ie=p);var z=vd(b,ie),_=vd(b,xe);if(z&&_&&(H.rangeCount!==1||H.anchorNode!==z.node||H.anchorOffset!==z.offset||H.focusNode!==_.node||H.focusOffset!==_.offset)){var B=q.createRange();B.setStart(z.node,z.offset),H.removeAllRanges(),ie>xe?(H.addRange(B),H.extend(_.node,_.offset)):(B.setEnd(_.node,_.offset),H.addRange(B))}}}}for(q=[],H=b;H=H.parentNode;)H.nodeType===1&&q.push({element:H,left:H.scrollLeft,top:H.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;bn?32:n,W.T=null,n=nc,nc=null;var u=En,p=Vn;if(it=0,rl=En=null,Vn=0,(Ue&6)!==0)throw Error(o(331));var b=Ue;if(Ue|=4,_m(u.current),wm(u,u.current,p,n),Ue=b,ls(0,!1),kt&&typeof kt.onPostCommitFiberRoot=="function")try{kt.onPostCommitFiberRoot(Ai,u)}catch{}return!0}finally{$.p=i,W.T=a,qm(e,t)}}function Im(e,t,n){t=rn(n,t),t=Mr(e.stateNode,t,2),e=Aa(e,t,2),e!==null&&(Ei(e,2),Fn(e))}function Fe(e,t,n){if(e.tag===3)Im(e,e,n);else for(;t!==null;){if(t.tag===3){Im(t,e,n);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Ra===null||!Ra.has(a))){e=rn(n,e),n=Fh(2),a=Aa(t,n,2),a!==null&&(Xh(n,a,t,e),Ei(a,2),Fn(a));break}}t=t.return}}function rc(e,t,n){var a=e.pingCache;if(a===null){a=e.pingCache=new Sy;var i=new Set;a.set(t,i)}else i=a.get(t),i===void 0&&(i=new Set,a.set(t,i));i.has(n)||(Wr=!0,i.add(n),e=Cy.bind(null,e,t,n),t.then(e,e))}function Cy(e,t,n){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ke===e&&(Re&n)===n&&((ot===4||ot===3&&(Re&62914560)===Re&&300>bt()-Ho)&&(Ue&2)===0?ei(e,0):Uo|=n,kl===Re&&(kl=0)),Fn(e)}function Km(e,t){t===0&&(t=Df()),e=Qa(e,t),e!==null&&(Ei(e,t),Fn(e))}function Ny(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Km(e,n)}function _y(e,t){var n=0;switch(e.tag){case 31:case 13:var a=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(o(314))}a!==null&&a.delete(t),Km(e,n)}function Ry(e,t){return me(e,t)}var ni=null,ai=null,cc=!1,Ko=!1,fc=!1,Oa=0;function Fn(e){e!==ai&&e.next===null&&(ai===null?ni=ai=e:ai=ai.next=e),Ko=!0,cc||(cc=!0,Oy())}function ls(e,t){if(!fc&&Ko){fc=!0;do for(var n=!1,a=ni;a!==null;){if(e!==0){var i=a.pendingLanes;if(i===0)var u=0;else{var p=a.suspendedLanes,b=a.pingedLanes;u=(1<<31-Jt(42|e)+1)-1,u&=i&~(p&~b),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(n=!0,Jm(a,u))}else u=Re,u=Bs(a,a===ke?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(u&3)===0||xi(a,u)||(n=!0,Jm(a,u));a=a.next}while(n);fc=!1}}function Dy(){Qm()}function Qm(){Ko=cc=!1;var e=0;Oa!==0&&Yy()&&(e=Oa);for(var t=bt(),n=null,a=ni;a!==null;){var i=a.next,u=Zm(a,t);u===0?(a.next=null,n===null?ni=i:n.next=i,i===null&&(ai=n)):(n=a,(e!==0||(u&3)!==0)&&(Ko=!0)),a=i}it!==0&&it!==5||ls(e),Oa!==0&&(Oa=0)}function Zm(e,t){for(var n=e.suspendedLanes,a=e.pingedLanes,i=e.expirationTimes,u=e.pendingLanes&-62914561;0b)break;var G=x.transferSize,q=x.initiatorType;G&&a0(q)&&(x=x.responseEnd,p+=G*(xPo){ie.length=k;break}B=new Promise(ky.bind(B)),ie.push(B)}}}if(0"u"?null:document;function w0(e,t,n){var a=ii;if(a&&typeof t=="string"&&t){var i=on(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof n=="string"&&(i+='[crossorigin="'+n+'"]'),M0.has(i)||(M0.add(i),e={rel:e,crossOrigin:n,href:t},a.querySelector(i)===null&&(t=a.createElement("link"),Dt(t,"link",e),Tt(t),a.head.appendChild(t)))}}function mv(e){sa.D(e),w0("dns-prefetch",e,null)}function pv(e,t){sa.C(e,t),w0("preconnect",e,t)}function gv(e,t,n){sa.L(e,t,n);var a=ii;if(a&&e&&t){var i='link[rel="preload"][as="'+on(t)+'"]';t==="image"&&n&&n.imageSrcSet?(i+='[imagesrcset="'+on(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(i+='[imagesizes="'+on(n.imageSizes)+'"]')):i+='[href="'+on(e)+'"]';var u=i;switch(t){case"style":u=si(e);break;case"script":u=oi(e)}if(!(pn.has(u)||(e=V({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),pn.set(u,e),a.querySelector(i)!==null||t==="style"&&a.querySelector(rs(u))||t==="script"&&a.querySelector(cs(u))))){var p=a.createElement("link");Dt(p,"link",e),t==="style"&&(p[Us]=!0,p.onload=p.onerror=function(){Gf(p)}),Tt(p),a.head.appendChild(p)}}}function yv(e,t){sa.m(e,t);var n=ii;if(n&&e){var a=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+on(a)+'"][href="'+on(e)+'"]',u=i;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=oi(e)}if(!pn.has(u)&&(e=V({rel:"modulepreload",href:e},t),pn.set(u,e),n.querySelector(i)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(cs(u)))return}a=n.createElement("link"),Dt(a,"link",e),Tt(a),n.head.appendChild(a)}}}function vv(e,t,n){sa.S(e,t,n);var a=ii;if(a&&e){var i=El(a).hoistableStyles,u=si(e);t=t||"default";var p=i.get(u);if(!p){var b={loading:0,preload:null};if(p=a.querySelector(rs(u)))b.loading=5;else{e=V({rel:"stylesheet",href:e,"data-precedence":t},n),(n=pn.get(u))&&Oc(e,n);var x=p=a.createElement("link");Tt(x),Dt(x,"link",e),x._p=new Promise(function(j,G){x.onload=j,x.onerror=G}),x.addEventListener("load",function(){b.loading|=1}),x.addEventListener("error",function(){b.loading|=2}),b.loading|=4,ko(p,t,a)}p={type:"stylesheet",instance:p,count:1,state:b},i.set(u,p)}}}function Sv(e,t){sa.X(e,t);var n=ii;if(n&&e){var a=El(n).hoistableScripts,i=oi(e),u=a.get(i);u||(u=n.querySelector(cs(i)),u||(e=V({src:e,async:!0},t),(t=pn.get(i))&&zc(e,t),u=n.createElement("script"),Tt(u),Dt(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(i,u))}}function bv(e,t){sa.M(e,t);var n=ii;if(n&&e){var a=El(n).hoistableScripts,i=oi(e),u=a.get(i);u||(u=n.querySelector(cs(i)),u||(e=V({src:e,async:!0,type:"module"},t),(t=pn.get(i))&&zc(e,t),u=n.createElement("script"),Tt(u),Dt(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(i,u))}}function C0(e,t,n,a){var i=(i=_n.current)?us(i):null;if(!i)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(n=si(n.href),t=El(i).hoistableStyles,a=t.get(n),a||(a={type:"style",instance:null,count:0,state:null},t.set(n,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=si(n.href);var u=El(i).hoistableStyles,p=u.get(e);if(p||(i=i.ownerDocument||i,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,p),(u=i.querySelector(rs(e)))?u._p||(p.instance=u,p.state.loading=5):(u=pn.get(e),u||(u={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},pn.set(e,u)),Tv(i,e,u,p.state))),t&&a===null)throw Error(o(528,""));return p}if(t&&a!==null)throw Error(o(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(n=oi(n),t=El(i).hoistableScripts,a=t.get(n),a||(a={type:"script",instance:null,count:0,state:null},t.set(n,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function si(e){return'href="'+on(e)+'"'}function rs(e){return'link[rel="stylesheet"]['+e+"]"}function N0(e){return V({},e,{"data-precedence":e.precedence,precedence:null})}function Tv(e,t,n,a){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[Us]!==!0){a.loading=1;return}}else t=e.createElement("link"),t[Us]=!0,t.onload=t.onerror=Gf.bind(null,t),Dt(t,"link",n),Tt(t),e.head.appendChild(t);a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2})}function oi(e){return'[src="'+on(e)+'"]'}function cs(e){return"script[async]"+e}function _0(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+on(n.href)+'"]');if(a)return t.instance=a,Tt(a),a;var i=V({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Tt(a),Dt(a,"style",i),ko(a,n.precedence,e),t.instance=a;case"stylesheet":i=si(n.href);var u=e.querySelector(rs(i));if(u)return t.state.loading|=4,t.instance=u,Tt(u),u;a=N0(n),(i=pn.get(i))&&Oc(a,i),u=(e.ownerDocument||e).createElement("link"),Tt(u);var p=u;return p._p=new Promise(function(b,x){p.onload=b,p.onerror=x}),Dt(u,"link",a),t.state.loading|=4,ko(u,n.precedence,e),t.instance=u;case"script":return u=oi(n.src),(i=e.querySelector(cs(u)))?(t.instance=i,Tt(i),i):(a=n,(i=pn.get(u))&&(a=V({},n),zc(a,i)),e=e.ownerDocument||e,i=e.createElement("script"),Tt(i),Dt(i,"link",a),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,ko(a,n.precedence,e));return t.instance}function ko(e,t,n){for(var a=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=a.length?a[a.length-1]:null,u=i,p=0;p title"):null)}function Av(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function D0(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function O0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function z0(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function j0(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=z0(t),e.suspenseyImages.push(t)),e=Mv.bind(e),t.decode().then(e,e))}function xv(e,t,n,a){if(n.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var i=si(a.href),u=t.querySelector(rs(i));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=fs.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=u,Tt(u);return}u=t.ownerDocument||t,a=N0(a),(i=pn.get(i))&&Oc(a,i),u=u.createElement("link"),Tt(u);var p=u;p._p=new Promise(function(b,x){p.onload=b,p.onerror=x}),Dt(u,"link",a),n.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=fs.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Po=0;function Ev(e,t){return e.stylesheets&&e.count===0&&Wo(e,e.stylesheets),0Po?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(i)}}:null}function L0(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)Wo(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function fs(){this.count--,L0(this)}function Mv(){this.imgCount--,L0(this)}var $o=null;function Wo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,$o=new Map,t.forEach(wv,e),$o=null,fs.call(e))}function wv(e,t){if(!(t.state.loading&4)){var n=$o.get(e);if(n)var a=n.get(null);else{n=new Map,$o.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(d)}catch(l){console.error(l)}}return d(),Kc.exports=C1(),Kc.exports}var _1=N1(),R1=Uv();const D1=Hv(R1);function Sf(d,l){const s=o=>(o%360+360)%360;return d==="single"?[{label:"front",yawDeg:s(l)}]:d==="dir4"?[{label:"s",yawDeg:s(l)},{label:"e",yawDeg:s(l+90)},{label:"n",yawDeg:s(l+180)},{label:"w",yawDeg:s(l+270)}]:d==="rpgmaker"?[{label:"s",yawDeg:s(l)},{label:"w",yawDeg:s(l+270)},{label:"e",yawDeg:s(l+90)},{label:"n",yawDeg:s(l+180)}]:d==="iso4"?[{label:"se",yawDeg:s(l+45)},{label:"ne",yawDeg:s(l+135)},{label:"nw",yawDeg:s(l+225)},{label:"sw",yawDeg:s(l+315)}]:d==="dir8"?[{label:"s",yawDeg:s(l)},{label:"se",yawDeg:s(l+45)},{label:"e",yawDeg:s(l+90)},{label:"ne",yawDeg:s(l+135)},{label:"n",yawDeg:s(l+180)},{label:"nw",yawDeg:s(l+225)},{label:"w",yawDeg:s(l+270)},{label:"sw",yawDeg:s(l+315)}]:Array.from({length:12},(o,r)=>({label:`ang_${String(r*30).padStart(3,"0")}`,yawDeg:s(l+r*30)}))}function Nf(d,l,s,o,r){if(r==="strip"){const c=s*o;return{columns:c,rows:1,width:c*d,height:l}}return{columns:o,rows:s,width:o*d,height:s*l}}function _f(d,l,s,o,r,c,f=0){const h=c==="strip"?d*r+l:l,g=(c==="strip"?0:d)+f;return{x:h*s,y:g*o,w:s,h:o}}function O1(d,l,s,o,r,c){const f=[],h=[];let g=1;for(const v of l){const m=v.animName.toLowerCase().replace(/[^a-z0-9_]+/g,"_")||"anim";for(let S=0;SMath.max(0,Math.min(255,Math.round(r)));return"#"+[o(d),o(l),o(s)].map(r=>r.toString(16).padStart(2,"0").toUpperCase()).join("")}function H1(d){const l=[],s=new Set,o=d.split(/\r?\n/);for(const r of o){const c=r.trim();if((!c||c.startsWith("#")&&!/^#[0-9A-Fa-f]{6}$/.test(c)&&!/^#[0-9A-Fa-f]{3}$/.test(c))&&(c.startsWith("GIMP")||c.startsWith("Name:")||c.startsWith("Columns:")))continue;const f=c.match(/#?[0-9A-Fa-f]{6}\b/g);if(f&&!/^\d+\s+\d+\s+\d+/.test(c)){for(const g of f){const y=ip(Si(g));s.has(y)||(s.add(y),l.push(y))}continue}const h=c.match(/^(\d{1,3})\s+(\d{1,3})\s+(\d{1,3})/);if(h){const g=Number(h[1]),y=Number(h[2]),v=Number(h[3]);if(g<=255&&y<=255&&v<=255){const m=ip([g,y,v]);s.has(m)||(s.add(m),l.push(m))}}}return l.slice(0,128)}function Dp(d,l){const s=Math.max(2,Math.min(64,l)),o=new Map;for(let f=0;f>3<<10|g>>3<<5|y>>3,m=o.get(v);m?(m.r+=h,m.g+=g,m.b+=y,m.count+=1):o.set(v,{r:h,g,b:y,count:1})}if(o.size===0)return[[20,20,24]];const r=[];for(const f of o.values())r.push({rgb:[Math.round(f.r/f.count),Math.round(f.g/f.count),Math.round(f.b/f.count)],count:f.count});if(r.length<=s)return r.map(f=>f.rgb);const c=[r];for(;c.lengthC&&(C=V.rgb[0]),V.rgb[1]M&&(M=V.rgb[1]),V.rgb[2]L&&(L=V.rgb[2]);const O=C-T,U=M-w,Q=L-R,F=Math.max(O,U,Q);F>h&&(h=F,f=m,g=U===F?1:O===F?0:2)}if(f===-1||h===0)break;const y=c.splice(f,1)[0];y.sort((m,S)=>m.rgb[g]-S.rgb[g]);const v=Math.max(1,Math.floor(y.length/2));c.push(y.slice(0,v),y.slice(v))}return c.map(f=>{let h=0,g=0,y=0,v=0;for(const m of f)h+=m.rgb[0]*m.count,g+=m.rgb[1]*m.count,y+=m.rgb[2]*m.count,v+=m.count;return[Math.round(h/v),Math.round(g/v),Math.round(y/v)]})}const Qt=360,Yn=210;function Jc(d,l,s){for(const o of l){const r=d.find(c=>c.toLowerCase().includes(o));if(r)return r}return d[0]??s}function G1(d){d.fillStyle="#161922",d.fillRect(0,0,Qt,Yn);const l=16;for(let s=0;sJc(l,["walk","run","hop","open"],"Walk"),[l]),M=re.useMemo(()=>Jc(l,["idle","pulse","spin"],w),[l,w]),R=re.useMemo(()=>Jc(l,["slash","attack","fire","pulse","open"],w),[l,w]),L=re.useMemo(()=>{if(!d)return null;const O={...s,resolution:Math.min(64,s.resolution),frameCount:Math.min(8,s.frameCount)},U=d.bakeAllDirections(w,O),Q=M===w?U:d.bakeAllDirections(M,O),F=R===w?U:d.bakeAllDirections(R,O);return{walk:U,idle:Q,action:F}},[d,w,M,R,s,o,r]);return re.useEffect(()=>{const O=document.createElement("canvas");O.width=Qt,O.height=Yn;const U=O.getContext("2d");U&&G1(U),S.current=O;const Q=document.createElement("canvas");T.current=Q},[]),re.useEffect(()=>{const O=Q=>{const F=Q.key.toLowerCase();["w","a","s","d","arrowup","arrowdown","arrowleft","arrowright"," "].includes(F)&&(C.current.keys.add(F),F===" "?C.current.actionTimer=.6:g(!1))},U=Q=>{C.current.keys.delete(Q.key.toLowerCase())};return window.addEventListener("keydown",O),window.addEventListener("keyup",U),()=>{window.removeEventListener("keydown",O),window.removeEventListener("keyup",U)}},[]),re.useEffect(()=>{if(!L)return;let O=0,U=performance.now();const Q=F=>{const V=Math.min(.05,(F-U)/1e3);U=F;const X=C.current;let le=0,de=0;if(h)X.patrolPhase+=V*1.1,le=Math.cos(X.patrolPhase)*.9,de=Math.sin(X.patrolPhase*2)*.45,X.mouseX=Qt*.5+Math.cos(X.patrolPhase*1.6)*88,X.mouseY=Yn*.48+Math.sin(X.patrolPhase*1.6)*44;else{const se=X.keys;(se.has("a")||se.has("arrowleft"))&&(le-=1),(se.has("d")||se.has("arrowright"))&&(le+=1),(se.has("w")||se.has("arrowup"))&&(de-=1),(se.has("s")||se.has("arrowdown"))&&(de+=1)}const ce=Math.abs(le)>.05||Math.abs(de)>.05;if(ce){const se=Math.hypot(le,de),Le=78;X.x=Math.max(26,Math.min(Qt-26,X.x+le/se*Le*V)),X.y=Math.max(44,Math.min(Yn-20,X.y+de/se*Le*V)),X.facingYaw=(Math.atan2(le,de)*180/Math.PI+360)%360}X.actionTimer>0&&(X.actionTimer=Math.max(0,X.actionTimer-V)),X.frameTime+=V*s.fps;const he=X.actionTimer>0?L.action:ce?L.walk:L.idle;let Ke=0,Qe=1/0;for(let se=0;sewindow.cancelAnimationFrame(O)},[L,c,h,y,s.fps]),A.jsxs("div",{className:"subtab-container",children:[A.jsxs("div",{className:"subtab-toolbar",children:[A.jsxs("div",{className:"topbar-group",children:[A.jsx("span",{className:"preview-tag",children:"PLAYABLE 2D ARENA · NORMAL-MAP TORCH"}),A.jsx("span",{className:"mono-stat",children:"WASD / Arrows: Move · Space: Action · Mouse: Move 2D Light"})]}),A.jsxs("div",{className:"topbar-group",children:[A.jsx("button",{className:`btn ${h?"btn-pro-cta":""}`,onClick:()=>g(O=>!O),children:h?"Auto Patrol: ON":"Auto Patrol: OFF"}),A.jsx("button",{className:`btn ${c?"btn-pro-cta":""}`,onClick:()=>f(O=>!O),children:c?"Normal Lighting: ON":"Normal Lighting: OFF"}),A.jsx("input",{type:"color","aria-label":"Torch color",value:y,onChange:O=>v(O.target.value),style:{width:28,height:26,border:0,padding:0,background:"transparent"}}),A.jsx("button",{className:"btn btn-primary",onClick:()=>{C.current.actionTimer=.6},children:"Trigger Action"})]})]}),A.jsx("div",{className:"arena-stage",children:A.jsx("canvas",{ref:m,width:Qt,height:Yn,className:"arena-canvas pixel-canvas",onPointerMove:O=>{const U=O.currentTarget.getBoundingClientRect(),Q=(O.clientX-U.left)/U.width*Qt,F=(O.clientY-U.top)/U.height*Yn;C.current.mouseX=Q,C.current.mouseY=F}})})]})}const F1="demo",ua=F1==="pro",X1="https://ko-fi.com/franvault",sp=64,Y1=80*1024*1024;function fl(d,l){d.push(l&255,l>>8&255)}function q1(d,l){const s=1<{for(c|=C<=8;)r.push(c&255),c>>=8,f-=8};let g=d+1,y=o+1,v=new Map;const m=()=>{v=new Map,g=d+1,y=o+1};h(s,g);let S=String(l[0]);for(let C=1;C1<0&&r.push(c&255),r}function I1(d,l,s,o){if(d.length===0)throw new Error("Cannot encode empty GIF frames.");const r=new Uint8ClampedArray(d.length*l*s*4);for(let m=0;m{const C=m<<16|S<<8|T,w=y.get(C);if(w!==void 0)return w;let M=0,R=1/0;for(let L=0;Lc.id===l);if(!o)return{...d,enginePreset:"custom"};const r={...d,...o.patch,enginePreset:l,exports:{...d.exports}};return r.resolution>64&&(r.resolution=64),r}function Q1(d){return JSON.stringify({format:"pixelbake-style-v2",settings:d},null,2)}function Z1(d,l,s){const o=JSON.parse(d);if(!o||typeof o!="object"||!o.settings||typeof o.settings!="object")throw new Error("Invalid .pixelbake.json preset file.");const r=o.settings,c={...l,...r,exports:{...l.exports,...r.exports??{},albedoSheet:!0}};return c.resolution>64&&(c.resolution=64),c.bakeAllClips=!1,c}/*! fflate - fast JavaScript compression/decompression Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE version 0.8.2 */var Sn=Uint8Array,mi=Uint16Array,k1=Int32Array,zp=new Sn([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]),jp=new Sn([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]),J1=new Sn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Lp=function(d,l){for(var s=new mi(31),o=0;o<31;++o)s[o]=l+=1<>1|(tt&21845)<<1;Ga=(Ga&52428)>>2|(Ga&13107)<<2,Ga=(Ga&61680)>>4|(Ga&3855)<<4,Tf[tt]=((Ga&65280)>>8|(Ga&255)<<8)>>1}var xs=(function(d,l,s){for(var o=d.length,r=0,c=new mi(l);r>g]=y}else for(h=new mi(o),r=0;r>15-d[r]);return h}),_s=new Sn(288);for(var tt=0;tt<144;++tt)_s[tt]=8;for(var tt=144;tt<256;++tt)_s[tt]=9;for(var tt=256;tt<280;++tt)_s[tt]=7;for(var tt=280;tt<288;++tt)_s[tt]=8;var Hp=new Sn(32);for(var tt=0;tt<32;++tt)Hp[tt]=5;var e2=xs(_s,9,1),t2=xs(Hp,5,1),Pc=function(d){for(var l=d[0],s=1;sl&&(l=d[s]);return l},wn=function(d,l,s){var o=l/8|0;return(d[o]|d[o+1]<<8)>>(l&7)&s},$c=function(d,l){var s=l/8|0;return(d[s]|d[s+1]<<8|d[s+2]<<16)>>(l&7)},n2=function(d){return(d+7)/8|0},a2=function(d,l,s){return(s==null||s>d.length)&&(s=d.length),new Sn(d.subarray(l,s))},l2=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Cn=function(d,l,s){var o=new Error(l||l2[d]);if(o.code=d,Error.captureStackTrace&&Error.captureStackTrace(o,Cn),!s)throw o;return o},i2=function(d,l,s,o){var r=d.length,c=0;if(!r||l.f&&!l.l)return s||new Sn(0);var f=!s,h=f||l.i!=2,g=l.i;f&&(s=new Sn(r*3));var y=function(W){var $=s.length;if(W>$){var Ze=new Sn(Math.max($*2,W));Ze.set(s),s=Ze}},v=l.f||0,m=l.p||0,S=l.b||0,T=l.l,C=l.d,w=l.m,M=l.n,R=r*8;do{if(!T){v=wn(d,m,1);var L=wn(d,m+1,3);if(m+=3,L)if(L==1)T=e2,C=t2,w=9,M=5;else if(L==2){var F=wn(d,m,31)+257,V=wn(d,m+10,15)+4,X=F+wn(d,m+5,31)+1;m+=14;for(var le=new Sn(X),de=new Sn(19),ce=0;ce>4;if(O<16)le[ce++]=O;else{var Z=0,J=0;for(O==16?(J=3+wn(d,m,3),m+=2,Z=le[ce-1]):O==17?(J=3+wn(d,m,7),m+=3):O==18&&(J=11+wn(d,m,127),m+=7);J--;)le[ce++]=Z}}var ee=le.subarray(0,F),ue=le.subarray(F);w=Pc(ee),M=Pc(ue),T=xs(ee,w,1),C=xs(ue,M,1)}else Cn(1);else{var O=n2(m)+4,U=d[O-4]|d[O-3]<<8,Q=O+U;if(Q>r){g&&Cn(0);break}h&&y(S+U),s.set(d.subarray(O,Q),S),l.b=S+=U,l.p=m=Q*8,l.f=v;continue}if(m>R){g&&Cn(0);break}}h&&y(S+131072);for(var ge=(1<>4;if(m+=Z&15,m>R){g&&Cn(0);break}if(Z||Cn(2),Le<256)s[S++]=Le;else if(Le==256){se=m,T=null;break}else{var N=Le-254;if(Le>264){var ce=Le-257,I=zp[ce];N=wn(d,m,(1<>4;ne||Cn(3),m+=ne&15;var ue=W1[ae];if(ae>3){var I=jp[ae];ue+=$c(d,m)&(1<R){g&&Cn(0);break}h&&y(S+131072);var Se=S+N;if(S>4>7||(d[0]<<8|d[1])%31)&&Cn(6,"invalid zlib data"),(d[1]>>5&1)==1&&Cn(6,"invalid zlib data: "+(d[1]&32?"need":"unexpected")+" dictionary"),(d[1]>>3&4)+2};function u2(d,l){return i2(d.subarray(o2(d),-4),{i:2},l,l)}var r2=typeof TextDecoder<"u"&&new TextDecoder,c2=0;try{r2.decode(s2,{stream:!0}),c2=1}catch{}function Gp(d,l,s){const o=s.length-d-1;if(l>=s[o])return o-1;if(l<=s[d])return d;let r=d,c=o,f=Math.floor((r+c)/2);for(;l=s[f+1];)l=w&&(C[T][0]=C[S][0]/h[L+1][R],M=C[T][0]*h[R][L]);const O=R>=-1?1:-R,U=m-1<=L?w-1:s-m;for(let F=O;F<=U;++F)C[T][F]=(C[S][F]-C[S][F-1])/h[L+1][R+F],M+=C[T][F]*h[R+F][L];m<=L&&(C[T][w]=-C[S][w-1]/h[L+1][m],M+=C[T][w]*h[m][L]),f[w][m]=M;const Q=S;S=T,T=Q}}let v=s;for(let m=1;m<=o;++m){for(let S=0;S<=s;++S)f[m][S]*=v;v*=s-m}return f}function m2(d,l,s,o,r){const c=rs.toArray()),l.startKnot=this.startKnot,l.endKnot=this.endKnot,l}fromJSON(l){return super.fromJSON(l),this.degree=l.degree,this.knots=[...l.knots],this.controlPoints=l.controlPoints.map(s=>new Es(s[0],s[1],s[2],s[3])),this.startKnot=l.startKnot,this.endKnot=l.endKnot,this}}let Me,rt,Gt;class op extends Ms{constructor(l){super(l)}load(l,s,o,r){const c=this,f=c.path===""?pi.extractUrlBase(l):c.path,h=new du(this.manager);h.setPath(c.path),h.setResponseType("arraybuffer"),h.setRequestHeader(c.requestHeader),h.setWithCredentials(c.withCredentials),h.load(l,function(g){try{s(c.parse(g,f))}catch(y){r?r(y):console.error(y),c.manager.itemError(l)}},o,r)}parse(l,s){if(E2(l))Me=new x2().parse(l);else{const r=Xp(l);if(!M2(r))throw new Error("THREE.FBXLoader: Unknown format.");if(rp(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+rp(r));Me=new A2().parse(r)}const o=new bp(this.manager).setPath(this.resourcePath||s).setCrossOrigin(this.crossOrigin);return new S2(o,this.manager).parse(Me)}}class S2{constructor(l,s){this.textureLoader=l,this.manager=s}parse(){rt=this.parseConnections();const l=this.parseImages(),s=this.parseTextures(l),o=this.parseMaterials(s),r=this.parseDeformers(),c=new b2().parse(r);return this.parseScene(r,c,o),Gt}parseConnections(){const l=new Map;return"Connections"in Me&&Me.Connections.connections.forEach(function(o){const r=o[0],c=o[1],f=o[2];l.has(r)||l.set(r,{parents:[],children:[]});const h={ID:c,relationship:f};l.get(r).parents.push(h),l.has(c)||l.set(c,{parents:[],children:[]});const g={ID:r,relationship:f};l.get(c).children.push(g)}),l}parseImages(){const l={},s={};if("Video"in Me.Objects){const o=Me.Objects.Video;for(const r in o){const c=o[r],f=parseInt(r);if(l[f]=c.RelativeFilename||c.Filename,"Content"in c){const h=c.Content instanceof ArrayBuffer&&c.Content.byteLength>0,g=typeof c.Content=="string"&&c.Content!=="";if(h||g){const y=this.parseImage(o[r]);s[c.RelativeFilename||c.Filename]=y}}}}for(const o in l){const r=l[o];s[r]!==void 0?l[o]=s[r]:l[o]=l[o].split("\\").pop()}return l}parseImage(l){const s=l.Content,o=l.RelativeFilename||l.Filename,r=o.slice(o.lastIndexOf(".")+1).toLowerCase();let c;switch(r){case"bmp":c="image/bmp";break;case"jpg":case"jpeg":c="image/jpeg";break;case"png":c="image/png";break;case"tif":c="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",o),c="image/tga";break;default:console.warn('FBXLoader: Image type "'+r+'" is not supported.');return}if(typeof s=="string")return"data:"+c+";base64,"+s;{const f=new Uint8Array(s);return window.URL.createObjectURL(new Blob([f],{type:c}))}}parseTextures(l){const s=new Map;if("Texture"in Me.Objects){const o=Me.Objects.Texture;for(const r in o){const c=this.parseTexture(o[r],l);s.set(parseInt(r),c)}}return s}parseTexture(l,s){const o=this.loadTexture(l,s);o.ID=l.id,o.name=l.attrName;const r=l.WrapModeU,c=l.WrapModeV,f=r!==void 0?r.value:0,h=c!==void 0?c.value:0;if(o.wrapS=f===0?ws:rf,o.wrapT=h===0?ws:rf,"Scaling"in l){const g=l.Scaling.value;o.repeat.x=g[0],o.repeat.y=g[1]}if("Translation"in l){const g=l.Translation.value;o.offset.x=g[0],o.offset.y=g[1]}return o}loadTexture(l,s){const o=new Set(["tga","tif","tiff","exr","dds","hdr","ktx2"]),r=l.FileName.split(".").pop().toLowerCase(),c=o.has(r)?this.manager.getHandler(`.${r}`):this.textureLoader;if(!c)return console.warn(`FBXLoader: ${r.toUpperCase()} loader not found, creating placeholder texture for`,l.RelativeFilename),new cf;const f=c.path;f||c.setPath(this.textureLoader.path);const h=rt.get(l.id).children;let g;h!==void 0&&h.length>0&&s[h[0].ID]!==void 0&&(g=s[h[0].ID],(g.indexOf("blob:")===0||g.indexOf("data:")===0)&&c.setPath(void 0));const y=c.load(g);return c.setPath(f),y}parseMaterials(l){const s=new Map;if("Material"in Me.Objects){const o=Me.Objects.Material;for(const r in o){const c=this.parseMaterial(o[r],l);c!==null&&s.set(parseInt(r),c)}}return s}parseMaterial(l,s){const o=l.id,r=l.attrName;let c=l.ShadingModel;if(typeof c=="object"&&(c=c.value),!rt.has(o))return null;const f=this.parseParameters(l,s,o);let h;switch(c.toLowerCase()){case"phong":h=new Ss;break;case"lambert":h=new Vv;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',c),h=new Ss;break}return h.setValues(f),h.name=r,h}parseParameters(l,s,o){const r={};l.BumpFactor&&(r.bumpScale=l.BumpFactor.value),l.Diffuse?r.color=qn.toWorkingColorSpace(new vt().fromArray(l.Diffuse.value),mt):l.DiffuseColor&&(l.DiffuseColor.type==="Color"||l.DiffuseColor.type==="ColorRGB")&&(r.color=qn.toWorkingColorSpace(new vt().fromArray(l.DiffuseColor.value),mt)),l.DisplacementFactor&&(r.displacementScale=l.DisplacementFactor.value),l.Emissive?r.emissive=qn.toWorkingColorSpace(new vt().fromArray(l.Emissive.value),mt):l.EmissiveColor&&(l.EmissiveColor.type==="Color"||l.EmissiveColor.type==="ColorRGB")&&(r.emissive=qn.toWorkingColorSpace(new vt().fromArray(l.EmissiveColor.value),mt)),l.EmissiveFactor&&(r.emissiveIntensity=parseFloat(l.EmissiveFactor.value)),r.opacity=1-(l.TransparencyFactor?parseFloat(l.TransparencyFactor.value):0),(r.opacity===1||r.opacity===0)&&(r.opacity=l.Opacity?parseFloat(l.Opacity.value):null,r.opacity===null&&(r.opacity=1-(l.TransparentColor?parseFloat(l.TransparentColor.value[0]):0))),r.opacity<1&&(r.transparent=!0),l.ReflectionFactor&&(r.reflectivity=l.ReflectionFactor.value),l.Shininess&&(r.shininess=l.Shininess.value),l.Specular?r.specular=qn.toWorkingColorSpace(new vt().fromArray(l.Specular.value),mt):l.SpecularColor&&l.SpecularColor.type==="Color"&&(r.specular=qn.toWorkingColorSpace(new vt().fromArray(l.SpecularColor.value),mt));const c=this;return rt.get(o).children.forEach(function(f){const h=f.relationship;switch(h){case"Bump":r.bumpMap=c.getTexture(s,f.ID);break;case"Maya|TEX_ao_map":r.aoMap=c.getTexture(s,f.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=c.getTexture(s,f.ID),r.map!==void 0&&(r.map.colorSpace=mt);break;case"DisplacementColor":r.displacementMap=c.getTexture(s,f.ID);break;case"EmissiveColor":r.emissiveMap=c.getTexture(s,f.ID),r.emissiveMap!==void 0&&(r.emissiveMap.colorSpace=mt);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=c.getTexture(s,f.ID);break;case"ReflectionColor":r.envMap=c.getTexture(s,f.ID),r.envMap!==void 0&&(r.envMap.mapping=Fv,r.envMap.colorSpace=mt);break;case"SpecularColor":r.specularMap=c.getTexture(s,f.ID),r.specularMap!==void 0&&(r.specularMap.colorSpace=mt);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=c.getTexture(s,f.ID),r.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.",h);break}}),r}getTexture(l,s){return"LayeredTexture"in Me.Objects&&s in Me.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),s=rt.get(s).children[0].ID),l.get(s)}parseDeformers(){const l={},s={};if("Deformer"in Me.Objects){const o=Me.Objects.Deformer;for(const r in o){const c=o[r],f=rt.get(parseInt(r));if(c.attrType==="Skin"){const h=this.parseSkeleton(f,o);h.ID=r,f.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),h.geometryID=f.parents[0].ID,l[r]=h}else if(c.attrType==="BlendShape"){const h={id:r};h.rawTargets=this.parseMorphTargets(f,o),h.id=r,f.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),s[r]=h}}}return{skeletons:l,morphTargets:s}}parseSkeleton(l,s){const o=[];return l.children.forEach(function(r){const c=s[r.ID];if(c.attrType!=="Cluster")return;const f={ID:r.ID,indices:[],weights:[],transformLink:new We().fromArray(c.TransformLink.a)};"Indexes"in c&&(f.indices=c.Indexes.a,f.weights=c.Weights.a),o.push(f)}),{rawBones:o,bones:[]}}parseMorphTargets(l,s){const o=[];for(let r=0;r1?f=h:h.length>0?f=h[0]:(f=new Ss({name:Ms.DEFAULT_MATERIAL_NAME,color:13421772}),h.push(f)),"color"in c.attributes&&h.forEach(function(g){g.vertexColors=!0}),c.groups.length>0){let g=!1;for(let y=0,v=c.groups.length;y=h.length)&&(m.materialIndex=h.length,g=!0)}if(g){const y=new Ss;h.push(y)}}return c.FBX_Deformer?(r=new Ap(c,f),r.normalizeSkinWeights()):r=new P(c,f),r}createCurve(l,s){const o=l.children.reduce(function(c,f){return s.has(f.ID)&&(c=s.get(f.ID)),c},null),r=new Ts({name:Ms.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new xp(o,r)}getTransformData(l,s){const o={};"InheritType"in s&&(o.inheritType=parseInt(s.InheritType.value)),"RotationOrder"in s?o.eulerOrder=Ns(s.RotationOrder.value):o.eulerOrder=Ns(0),"Lcl_Translation"in s&&(o.translation=s.Lcl_Translation.value),"PreRotation"in s&&(o.preRotation=s.PreRotation.value),"Lcl_Rotation"in s&&(o.rotation=s.Lcl_Rotation.value),"PostRotation"in s&&(o.postRotation=s.PostRotation.value),"Lcl_Scaling"in s&&(o.scale=s.Lcl_Scaling.value),"ScalingOffset"in s&&(o.scalingOffset=s.ScalingOffset.value),"ScalingPivot"in s&&(o.scalingPivot=s.ScalingPivot.value),"RotationOffset"in s&&(o.rotationOffset=s.RotationOffset.value),"RotationPivot"in s&&(o.rotationPivot=s.RotationPivot.value),l.userData.transformData=o}setLookAtProperties(l,s){"LookAtProperty"in s&&rt.get(l.ID).children.forEach(function(r){if(r.relationship==="LookAtProperty"){const c=Me.Objects.Model[r.ID];if("Lcl_Translation"in c){const f=c.Lcl_Translation.value;l.target!==void 0?(l.target.position.fromArray(f),Gt.add(l.target)):l.lookAt(new $e().fromArray(f))}}})}bindSkeleton(l,s,o){const r=this.parsePoseNodes();for(const c in l){const f=l[c];rt.get(parseInt(f.ID)).parents.forEach(function(g){if(s.has(g.ID)){const y=g.ID;rt.get(y).parents.forEach(function(m){o.has(m.ID)&&o.get(m.ID).bind(new Ep(f.bones),r[m.ID])})}})}}parsePoseNodes(){const l={};if("Pose"in Me.Objects){const s=Me.Objects.Pose;for(const o in s)if(s[o].attrType==="BindPose"&&s[o].NbPoseNodes>0){const r=s[o].PoseNode;Array.isArray(r)?r.forEach(function(c){l[c.Node]=new We().fromArray(c.Matrix.a)}):l[r.Node]=new We().fromArray(r.Matrix.a)}}return l}addGlobalSceneSettings(){if("GlobalSettings"in Me){if("AmbientColor"in Me.GlobalSettings){const l=Me.GlobalSettings.AmbientColor.value,s=l[0],o=l[1],r=l[2];if(s!==0||o!==0||r!==0){const c=new vt().setRGB(s,o,r,mt);Gt.add(new Xv(c,1))}}"UnitScaleFactor"in Me.GlobalSettings&&(Gt.userData.unitScaleFactor=Me.GlobalSettings.UnitScaleFactor.value)}}}class b2{constructor(){this.negativeMaterialIndices=!1}parse(l){const s=new Map;if("Geometry"in Me.Objects){const o=Me.Objects.Geometry;for(const r in o){const c=rt.get(parseInt(r)),f=this.parseGeometry(c,o[r],l);s.set(parseInt(r),f)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),s}parseGeometry(l,s,o){switch(s.attrType){case"Mesh":return this.parseMeshGeometry(l,s,o);case"NurbsCurve":return this.parseNurbsGeometry(s)}}parseMeshGeometry(l,s,o){const r=o.skeletons,c=[],f=l.parents.map(function(m){return Me.Objects.Model[m.ID]});if(f.length===0)return;const h=l.children.reduce(function(m,S){return r[S.ID]!==void 0&&(m=r[S.ID]),m},null);l.children.forEach(function(m){o.morphTargets[m.ID]!==void 0&&c.push(o.morphTargets[m.ID])});const g=f[0],y={};"RotationOrder"in g&&(y.eulerOrder=Ns(g.RotationOrder.value)),"InheritType"in g&&(y.inheritType=parseInt(g.InheritType.value)),"GeometricTranslation"in g&&(y.translation=g.GeometricTranslation.value),"GeometricRotation"in g&&(y.rotation=g.GeometricRotation.value),"GeometricScaling"in g&&(y.scale=g.GeometricScaling.value);const v=Fp(y);return this.genGeometry(s,h,c,v)}genGeometry(l,s,o,r){const c=new gi;l.attrName&&(c.name=l.attrName);const f=this.parseGeoNode(l,s),h=this.genBuffers(f),g=new vn(h.vertex,3);if(g.applyMatrix4(r),c.setAttribute("position",g),h.colors.length>0&&c.setAttribute("color",new vn(h.colors,3)),s&&(c.setAttribute("skinIndex",new Yv(h.weightsIndices,4)),c.setAttribute("skinWeight",new vn(h.vertexWeights,4)),c.FBX_Deformer=s),h.normal.length>0){const y=new qv().getNormalMatrix(r),v=new vn(h.normal,3);v.applyNormalMatrix(y),c.setAttribute("normal",v)}if(h.uvs.forEach(function(y,v){const m=v===0?"uv":`uv${v}`;c.setAttribute(m,new vn(h.uvs[v],2))}),f.material&&f.material.mappingType!=="AllSame"){let y=h.materialIndex[0],v=0;if(h.materialIndex.forEach(function(m,S){m!==y&&(c.addGroup(v,S-v,y),y=m,v=S)}),c.groups.length>0){const m=c.groups[c.groups.length-1],S=m.start+m.count;S!==h.materialIndex.length&&c.addGroup(S,h.materialIndex.length-S,y)}c.groups.length===0&&c.addGroup(0,h.materialIndex.length,h.materialIndex[0])}return this.addMorphTargets(c,l,o,r),c}parseGeoNode(l,s){const o={};if(o.vertexPositions=l.Vertices!==void 0?l.Vertices.a:[],o.vertexIndices=l.PolygonVertexIndex!==void 0?l.PolygonVertexIndex.a:[],l.LayerElementColor&&(o.color=this.parseVertexColors(l.LayerElementColor[0])),l.LayerElementMaterial&&(o.material=this.parseMaterialIndices(l.LayerElementMaterial[0])),l.LayerElementNormal&&(o.normal=this.parseNormals(l.LayerElementNormal[0])),l.LayerElementUV){o.uv=[];let r=0;for(;l.LayerElementUV[r];)l.LayerElementUV[r].UV&&o.uv.push(this.parseUVs(l.LayerElementUV[r])),r++}return o.weightTable={},s!==null&&(o.skeleton=s,s.rawBones.forEach(function(r,c){r.indices.forEach(function(f,h){o.weightTable[f]===void 0&&(o.weightTable[f]=[]),o.weightTable[f].push({id:c,weight:r.weights[h]})})})),o}genBuffers(l){const s={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let o=0,r=0,c=!1,f=[],h=[],g=[],y=[],v=[],m=[];const S=this;return l.vertexIndices.forEach(function(T,C){let w,M=!1;T<0&&(T=T^-1,M=!0);let R=[],L=[];if(f.push(T*3,T*3+1,T*3+2),l.color){const O=su(C,o,T,l.color);g.push(O[0],O[1],O[2])}if(l.skeleton){if(l.weightTable[T]!==void 0&&l.weightTable[T].forEach(function(O){L.push(O.weight),R.push(O.id)}),L.length>4){c||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),c=!0);const O=[0,0,0,0],U=[0,0,0,0];L.forEach(function(Q,F){let V=Q,X=R[F];U.forEach(function(le,de,ce){if(V>le){ce[de]=V,V=le;const he=O[de];O[de]=X,X=he}})}),R=O,L=U}for(;L.length<4;)L.push(0),R.push(0);for(let O=0;O<4;++O)v.push(L[O]),m.push(R[O])}if(l.normal){const O=su(C,o,T,l.normal);h.push(O[0],O[1],O[2])}l.material&&l.material.mappingType!=="AllSame"&&(w=su(C,o,T,l.material)[0],w<0&&(S.negativeMaterialIndices=!0,w=0)),l.uv&&l.uv.forEach(function(O,U){const Q=su(C,o,T,O);y[U]===void 0&&(y[U]=[]),y[U].push(Q[0]),y[U].push(Q[1])}),r++,M&&(S.genFace(s,l,f,w,h,g,y,v,m,r),o++,r=0,f=[],h=[],g=[],y=[],v=[],m=[])}),s}getNormalNewell(l){const s=new $e(0,0,0);for(let o=0;o.5?new $e(0,1,0):new $e(0,0,1)).cross(s).normalize(),c=s.clone().cross(r).normalize();return{normal:s,tangent:r,bitangent:c}}flattenVertex(l,s,o){return new Mf(l.dot(s),l.dot(o))}genFace(l,s,o,r,c,f,h,g,y,v){let m;if(v>3){const S=[],T=s.baseVertexPositions||s.vertexPositions;for(let R=0;R1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const f=l.get(c[0].ID);o[r]={name:s[r].attrName,layer:f}}return o}addClip(l){let s=[];const o=this;return l.layer.forEach(function(r){s=s.concat(o.generateTracks(r))}),new Mp(l.name,-1,s)}generateTracks(l){const s=[];let o=new $e,r=new $e;if(l.transform&&l.transform.decompose(o,new Xn,r),o=o.toArray(),r=r.toArray(),l.T!==void 0&&Object.keys(l.T.curves).length>0){const c=this.generateVectorTrack(l.modelName,l.T.curves,o,"position");c!==void 0&&s.push(c)}if(l.R!==void 0&&Object.keys(l.R.curves).length>0){const c=this.generateRotationTrack(l.modelName,l.R.curves,l.preRotation,l.postRotation,l.eulerOrder);c!==void 0&&s.push(c)}if(l.S!==void 0&&Object.keys(l.S.curves).length>0){const c=this.generateVectorTrack(l.modelName,l.S.curves,r,"scale");c!==void 0&&s.push(c)}if(l.DeformPercent!==void 0){const c=this.generateMorphTrack(l);c!==void 0&&s.push(c)}return s}generateVectorTrack(l,s,o,r){const c=this.getTimesForAllAxes(s),f=this.getKeyframeTrackValues(c,s,o);return new hf(l+"."+r,c,f)}generateRotationTrack(l,s,o,r,c){let f,h;if(s.x!==void 0&&s.y!==void 0&&s.z!==void 0){const S=this.interpolateRotations(s.x,s.y,s.z,c);f=S[0],h=S[1]}const g=Ns(0);o!==void 0&&(o=o.map(pt.degToRad),o.push(g),o=new hl().fromArray(o),o=new Xn().setFromEuler(o)),r!==void 0&&(r=r.map(pt.degToRad),r.push(g),r=new hl().fromArray(r),r=new Xn().setFromEuler(r).invert());const y=new Xn,v=new hl,m=[];if(!h||!f)return new fu(l+".quaternion",[0],[0]);for(let S=0;S2&&new Xn().fromArray(m,(S-3)/3*4).dot(y)<0&&y.set(-y.x,-y.y,-y.z,-y.w),y.toArray(m,S/3*4);return new fu(l+".quaternion",f,m)}generateMorphTrack(l){const s=l.DeformPercent.curves.morph,o=s.values.map(function(c){return c/100}),r=Gt.getObjectByName(l.modelName).morphTargetDictionary[l.morphName];return new mf(l.modelName+".morphTargetInfluences["+r+"]",s.times,o)}getTimesForAllAxes(l){let s=[];if(l.x!==void 0&&(s=s.concat(l.x.times)),l.y!==void 0&&(s=s.concat(l.y.times)),l.z!==void 0&&(s=s.concat(l.z.times)),s=s.sort(function(o,r){return o-r}),s.length>1){let o=1,r=s[0];for(let c=1;c=180||T[1]>=180||T[2]>=180){const w=Math.max(...T)/180,M=new hl(...y,r),R=new hl(...m,r),L=new Xn().setFromEuler(M),O=new Xn().setFromEuler(R);L.dot(O)&&O.set(-O.x,-O.y,-O.z,-O.w);const U=l.times[h-1],Q=l.times[h]-U,F=new Xn,V=new hl;for(let X=0;X<1;X+=1/w)F.copy(L.clone().slerp(O.clone(),X)),c.push(U+X*Q),V.setFromQuaternion(F,r),f.push(V.x),f.push(V.y),f.push(V.z)}else c.push(l.times[h]),f.push(pt.degToRad(l.values[h])),f.push(pt.degToRad(s.values[h])),f.push(pt.degToRad(o.values[h]))}return[c,f]}}class A2{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(l){this.nodeStack.push(l),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(l,s){this.currentProp=l,this.currentPropName=s}parse(l){this.currentIndent=0,this.allNodes=new Vp,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const s=this,o=l.split(/[\r\n]+/);return o.forEach(function(r,c){const f=r.match(/^[\s\t]*;/),h=r.match(/^[\s\t]*$/);if(f||h)return;const g=r.match("^\\t{"+s.currentIndent+"}(\\w+):(.*){",""),y=r.match("^\\t{"+s.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),v=r.match("^\\t{"+(s.currentIndent-1)+"}}");g?s.parseNodeBegin(r,g):y?s.parseNodeProperty(r,y,o[++c]):v?s.popStack():r.match(/^[^\s\t}]/)&&s.parseNodePropertyContinued(r)}),this.allNodes}parseNodeBegin(l,s){const o=s[1].trim().replace(/^"/,"").replace(/"$/,""),r=s[2].split(",").map(function(g){return g.trim().replace(/^"/,"").replace(/"$/,"")}),c={name:o},f=this.parseNodeAttr(r),h=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(o,c):o in h?(o==="PoseNode"?h.PoseNode.push(c):h[o].id!==void 0&&(h[o]={},h[o][h[o].id]=h[o]),f.id!==""&&(h[o][f.id]=c)):typeof f.id=="number"?(h[o]={},h[o][f.id]=c):o!=="Properties70"&&(o==="PoseNode"?h[o]=[c]:h[o]=c),typeof f.id=="number"&&(c.id=f.id),f.name!==""&&(c.attrName=f.name),f.type!==""&&(c.attrType=f.type),this.pushStack(c)}parseNodeAttr(l){let s=l[0];l[0]!==""&&(s=parseInt(l[0]),isNaN(s)&&(s=l[0]));let o="",r="";return l.length>1&&(o=l[1].replace(/^(\w+)::/,""),r=l[2]),{id:s,name:o,type:r}}parseNodeProperty(l,s,o){let r=s[1].replace(/^"/,"").replace(/"$/,"").trim(),c=s[2].replace(/^"/,"").replace(/"$/,"").trim();r==="Content"&&c===","&&(c=o.replace(/"/g,"").replace(/,$/,"").trim());const f=this.getCurrentNode();if(f.name==="Properties70"){this.parseNodeSpecialProperty(l,r,c);return}if(r==="C"){const g=c.split(",").slice(1),y=parseInt(g[0]),v=parseInt(g[1]);let m=c.split(",").slice(3);m=m.map(function(S){return S.trim().replace(/^"/,"")}),r="connections",c=[y,v],N2(c,m),f[r]===void 0&&(f[r]=[])}r==="Node"&&(f.id=c),r in f&&Array.isArray(f[r])?f[r].push(c):r!=="a"?f[r]=c:f.a=c,this.setCurrentProp(f,r),r==="a"&&c.slice(-1)!==","&&(f.a=ef(c))}parseNodePropertyContinued(l){const s=this.getCurrentNode();s.a+=l,l.slice(-1)!==","&&(s.a=ef(s.a))}parseNodeSpecialProperty(l,s,o){const r=o.split('",').map(function(v){return v.trim().replace(/^\"/,"").replace(/\s/,"_")}),c=r[0],f=r[1],h=r[2],g=r[3];let y=r[4];switch(f){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":y=parseFloat(y);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":y=ef(y);break}this.getPrevNode()[c]={type:f,type2:h,flag:g,value:y},this.setCurrentProp(this.getPrevNode(),c)}}class x2{parse(l){const s=new up(l);s.skip(23);const o=s.getUint32();if(o<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+o);const r=new Vp;for(;!this.endOfContent(s);){const c=this.parseNode(s,o);c!==null&&r.add(c.name,c)}return r}endOfContent(l){return l.size()%16===0?(l.getOffset()+160+16&-16)>=l.size():l.getOffset()+160+16>=l.size()}parseNode(l,s){const o={},r=s>=7500?l.getUint64():l.getUint32(),c=s>=7500?l.getUint64():l.getUint32();s>=7500?l.getUint64():l.getUint32();const f=l.getUint8(),h=l.getString(f);if(r===0)return null;const g=[];for(let S=0;S0?g[0]:"",v=g.length>1?g[1]:"",m=g.length>2?g[2]:"";for(o.singleProperty=c===1&&l.getOffset()===r;r>l.getOffset();){const S=this.parseNode(l,s);S!==null&&this.parseSubNode(h,o,S)}return o.propertyList=g,typeof y=="number"&&(o.id=y),v!==""&&(o.attrName=v),m!==""&&(o.attrType=m),h!==""&&(o.name=h),o}parseSubNode(l,s,o){if(o.singleProperty===!0){const r=o.propertyList[0];Array.isArray(r)?(s[o.name]=o,o.a=r):s[o.name]=r}else if(l==="Connections"&&o.name==="C"){const r=[];o.propertyList.forEach(function(c,f){f!==0&&r.push(c)}),s.connections===void 0&&(s.connections=[]),s.connections.push(r)}else if(o.name==="Properties70")Object.keys(o).forEach(function(c){s[c]=o[c]});else if(l==="Properties70"&&o.name==="P"){let r=o.propertyList[0],c=o.propertyList[1];const f=o.propertyList[2],h=o.propertyList[3];let g;r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),c.indexOf("Lcl ")===0&&(c=c.replace("Lcl ","Lcl_")),c==="Color"||c==="ColorRGB"||c==="Vector"||c==="Vector3D"||c.indexOf("Lcl_")===0?g=[o.propertyList[4],o.propertyList[5],o.propertyList[6]]:g=o.propertyList[4],s[r]={type:c,type2:f,flag:h,value:g}}else s[o.name]===void 0?typeof o.id=="number"?(s[o.name]={},s[o.name][o.id]=o):s[o.name]=o:o.name==="PoseNode"?(Array.isArray(s[o.name])||(s[o.name]=[s[o.name]]),s[o.name].push(o)):s[o.name][o.id]===void 0&&(s[o.name][o.id]=o)}parseProperty(l){const s=l.getString(1);let o;switch(s){case"C":return l.getBoolean();case"D":return l.getFloat64();case"F":return l.getFloat32();case"I":return l.getInt32();case"L":return l.getInt64();case"R":return o=l.getUint32(),l.getArrayBuffer(o);case"S":return o=l.getUint32(),l.getString(o);case"Y":return l.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const r=l.getUint32(),c=l.getUint32(),f=l.getUint32();if(c===0)switch(s){case"b":case"c":return l.getBooleanArray(r);case"d":return l.getFloat64Array(r);case"f":return l.getFloat32Array(r);case"i":return l.getInt32Array(r);case"l":return l.getInt64Array(r)}const h=u2(new Uint8Array(l.getArrayBuffer(f))),g=new up(h.buffer);switch(s){case"b":case"c":return g.getBooleanArray(r);case"d":return g.getFloat64Array(r);case"f":return g.getFloat32Array(r);case"i":return g.getInt32Array(r);case"l":return g.getInt64Array(r)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+s)}}}class up{constructor(l,s){this.dv=new DataView(l),this.offset=0,this.littleEndian=s!==void 0?s:!0,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(l){this.offset+=l}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(l){const s=[];for(let o=0;o=0&&(o=new Uint8Array(this.dv.buffer,s,r)),this._textDecoder.decode(o)}}class Vp{add(l,s){this[l]=s}}function E2(d){const l="Kaydara FBX Binary \0";return d.byteLength>=l.length&&l===Xp(d,0,l.length)}function M2(d){const l=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let s=0;function o(r){const c=d[r-1];return d=d.slice(s+r),s++,c}for(let r=0;r=2.0 are supported."));return}const y=new uS(c,{path:s||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});y.fileLoader.setRequestHeader(this.requestHeader);for(let v=0;v=0&&h[m]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+m+'".')}}y.setExtensions(f),y.setPlugins(h),y.parse(o,r)}parseAsync(l,s){const o=this;return new Promise(function(r,c){o.parse(l,s,r,c)})}}function R2(){let d={};return{get:function(l){return d[l]},add:function(l,s){d[l]=s},remove:function(l){delete d[l]},removeAll:function(){d={}}}}const _e={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class D2{constructor(l){this.parser=l,this.name=_e.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const l=this.parser,s=this.parser.json.nodes||[];for(let o=0,r=s.length;o=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return s.loadTextureImage(l,c.source,f)}}class I2{constructor(l){this.parser=l,this.name=_e.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(l){const s=this.name,o=this.parser,r=o.json,c=r.textures[l];if(!c.extensions||!c.extensions[s])return null;const f=c.extensions[s],h=r.images[f.source];let g=o.textureLoader;if(h.uri){const y=o.options.manager.getHandler(h.uri);y!==null&&(g=y)}return this.detectSupport().then(function(y){if(y)return o.loadTextureImage(l,f.source,g);if(r.extensionsRequired&&r.extensionsRequired.indexOf(s)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return o.loadTexture(l)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(l){const s=new Image;s.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",s.onload=s.onerror=function(){l(s.height===1)}})),this.isSupported}}class K2{constructor(l){this.parser=l,this.name=_e.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(l){const s=this.name,o=this.parser,r=o.json,c=r.textures[l];if(!c.extensions||!c.extensions[s])return null;const f=c.extensions[s],h=r.images[f.source];let g=o.textureLoader;if(h.uri){const y=o.options.manager.getHandler(h.uri);y!==null&&(g=y)}return this.detectSupport().then(function(y){if(y)return o.loadTextureImage(l,f.source,g);if(r.extensionsRequired&&r.extensionsRequired.indexOf(s)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return o.loadTexture(l)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(l){const s=new Image;s.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",s.onload=s.onerror=function(){l(s.height===1)}})),this.isSupported}}class Q2{constructor(l){this.name=_e.EXT_MESHOPT_COMPRESSION,this.parser=l}loadBufferView(l){const s=this.parser.json,o=s.bufferViews[l];if(o.extensions&&o.extensions[this.name]){const r=o.extensions[this.name],c=this.parser.getDependency("buffer",r.buffer),f=this.parser.options.meshoptDecoder;if(!f||!f.supported){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return c.then(function(h){const g=r.byteOffset||0,y=r.byteLength||0,v=r.count,m=r.byteStride,S=new Uint8Array(h,g,y);return f.decodeGltfBufferAsync?f.decodeGltfBufferAsync(v,m,S,r.mode,r.filter).then(function(T){return T.buffer}):f.ready.then(function(){const T=new ArrayBuffer(v*m);return f.decodeGltfBuffer(new Uint8Array(T),v,m,S,r.mode,r.filter),T})})}else return null}}class Z2{constructor(l){this.name=_e.EXT_MESH_GPU_INSTANCING,this.parser=l}createNodeMesh(l){const s=this.parser.json,o=s.nodes[l];if(!o.extensions||!o.extensions[this.name]||o.mesh===void 0)return null;const r=s.meshes[o.mesh];for(const y of r.primitives)if(y.mode!==yn.TRIANGLES&&y.mode!==yn.TRIANGLE_STRIP&&y.mode!==yn.TRIANGLE_FAN&&y.mode!==void 0)return null;const f=o.extensions[this.name].attributes,h=[],g={};for(const y in f)h.push(this.parser.getDependency("accessor",f[y]).then(v=>(g[y]=v,g[y])));return h.length<1?null:(h.push(this.parser.createNodeMesh(l)),Promise.all(h).then(y=>{const v=y.pop(),m=v.isGroup?v.children:[v],S=y[0].count,T=[];for(const C of m){const w=new We,M=new $e,R=new Xn,L=new $e(1,1,1),O=new Qv(C.geometry,C.material,S);for(let U=0;U0||d.search(/^data\:image\/jpeg/)===0?"image/jpeg":d.search(/\.webp($|\?)/i)>0||d.search(/^data\:image\/webp/)===0?"image/webp":d.search(/\.ktx2($|\?)/i)>0||d.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const oS=new We;class uS{constructor(l={},s={}){this.json=l,this.extensions={},this.plugins={},this.options=s,this.cache=new R2,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let o=!1,r=-1,c=!1,f=-1;if(typeof navigator<"u"){const h=navigator.userAgent;o=/^((?!chrome|android).)*safari/i.test(h)===!0;const g=h.match(/Version\/(\d+)/);r=o&&g?parseInt(g[1],10):-1,c=h.indexOf("Firefox")>-1,f=c?h.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||o&&r<17||c&&f<98?this.textureLoader=new bp(this.options.manager):this.textureLoader=new kv(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new du(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(l){this.extensions=l}setPlugins(l){this.plugins=l}parse(l,s){const o=this,r=this.json,c=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(f){return f._markDefs&&f._markDefs()}),Promise.all(this._invokeAll(function(f){return f.beforeRoot&&f.beforeRoot()})).then(function(){return Promise.all([o.getDependencies("scene"),o.getDependencies("animation"),o.getDependencies("camera")])}).then(function(f){const h={scene:f[0][r.scene||0],scenes:f[0],animations:f[1],cameras:f[2],asset:r.asset,parser:o,userData:{}};return dl(c,h,r),oa(h,r),Promise.all(o._invokeAll(function(g){return g.afterRoot&&g.afterRoot(h)})).then(function(){for(const g of h.scenes)g.updateMatrixWorld();l(h)})}).catch(s)}_markDefs(){const l=this.json.nodes||[],s=this.json.skins||[],o=this.json.meshes||[];for(let r=0,c=s.length;r{const g=this.associations.get(f);g!=null&&this.associations.set(h,g);for(const[y,v]of f.children.entries())c(v,h.children[y])};return c(o,r),r.name+="_instance_"+l.uses[s]++,r}_invokeOne(l){const s=Object.values(this.plugins);s.push(this);for(let o=0;o=2&&M.setY(le,F[V*g+1]),g>=3&&M.setZ(le,F[V*g+2]),g>=4&&M.setW(le,F[V*g+3]),g>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}M.normalized=C}return M})}loadTexture(l){const s=this.json,o=this.options,c=s.textures[l].source,f=s.images[c];let h=this.textureLoader;if(f.uri){const g=o.manager.getHandler(f.uri);g!==null&&(h=g)}return this.loadTextureImage(l,c,h)}loadTextureImage(l,s,o){const r=this,c=this.json,f=c.textures[l],h=c.images[s],g=(h.uri||h.bufferView)+":"+f.sampler;if(this.textureCache[g])return this.textureCache[g];const y=this.loadImageSource(s,o).then(function(v){v.flipY=!1,v.name=f.name||h.name||"",v.name===""&&typeof h.uri=="string"&&h.uri.startsWith("data:image/")===!1&&(v.name=h.uri);const S=(c.samplers||{})[f.sampler]||{};return v.magFilter=hp[S.magFilter]||gf,v.minFilter=hp[S.minFilter]||Cp,v.wrapS=mp[S.wrapS]||ws,v.wrapT=mp[S.wrapT]||ws,v.generateMipmaps=!v.isCompressedTexture&&v.minFilter!==vi&&v.minFilter!==gf,r.associations.set(v,{textures:l}),v}).catch(function(){return null});return this.textureCache[g]=y,y}loadImageSource(l,s){const o=this,r=this.json,c=this.options;if(this.sourceCache[l]!==void 0)return this.sourceCache[l].then(m=>m.clone());const f=r.images[l],h=self.URL||self.webkitURL;let g=f.uri||"",y=!1;if(f.bufferView!==void 0)g=o.getDependency("bufferView",f.bufferView).then(function(m){y=!0;const S=new Blob([m],{type:f.mimeType});return g=h.createObjectURL(S),g});else if(f.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+l+" is missing URI and bufferView");const v=Promise.resolve(g).then(function(m){return new Promise(function(S,T){let C=S;s.isImageBitmapLoader===!0&&(C=function(w){const M=new cf(w);M.needsUpdate=!0,S(M)}),s.load(pi.resolveURL(m,c.path),C,void 0,T)})}).then(function(m){return y===!0&&h.revokeObjectURL(g),oa(m,f),m.userData.mimeType=f.mimeType||sS(f.uri),m}).catch(function(m){throw console.error("THREE.GLTFLoader: Couldn't load texture",g),m});return this.sourceCache[l]=v,v}assignTexture(l,s,o,r){const c=this;return this.getDependency("texture",o.index).then(function(f){if(!f)return null;if(o.texCoord!==void 0&&o.texCoord>0&&(f=f.clone(),f.channel=o.texCoord),c.extensions[_e.KHR_TEXTURE_TRANSFORM]){const h=o.extensions!==void 0?o.extensions[_e.KHR_TEXTURE_TRANSFORM]:void 0;if(h){const g=c.associations.get(f);f=c.extensions[_e.KHR_TEXTURE_TRANSFORM].extendTexture(f,h),c.associations.set(f,g)}}return r!==void 0&&(f.colorSpace=r),l[s]=f,f})}assignFinalMaterial(l){const s=l.geometry;let o=l.material;const r=s.attributes.tangent===void 0,c=s.attributes.color!==void 0,f=s.attributes.normal===void 0;if(l.isPoints){const h="PointsMaterial:"+o.uuid;let g=this.cache.get(h);g||(g=new bs,As.prototype.copy.call(g,o),g.color.copy(o.color),g.map=o.map,g.sizeAttenuation=!1,this.cache.add(h,g)),o=g}else if(l.isLine){const h="LineBasicMaterial:"+o.uuid;let g=this.cache.get(h);g||(g=new Ts,As.prototype.copy.call(g,o),g.color.copy(o.color),g.map=o.map,this.cache.add(h,g)),o=g}if(r||c||f){let h="ClonedMaterial:"+o.uuid+":";r&&(h+="derivative-tangents:"),c&&(h+="vertex-colors:"),f&&(h+="flat-shading:");let g=this.cache.get(h);g||(g=o.clone(),c&&(g.vertexColors=!0),f&&(g.flatShading=!0),r&&(g.normalScale&&(g.normalScale.y*=-1),g.clearcoatNormalScale&&(g.clearcoatNormalScale.y*=-1)),this.cache.add(h,g),this.associations.set(g,this.associations.get(o))),o=g}l.material=o}getMaterialType(){return wf}loadMaterial(l){const s=this,o=this.json,r=this.extensions,c=o.materials[l];let f;const h={},g=c.extensions||{},y=[];if(g[_e.KHR_MATERIALS_UNLIT]){const m=r[_e.KHR_MATERIALS_UNLIT];f=m.getMaterialType(),y.push(m.extendParams(h,c,s))}else{const m=c.pbrMetallicRoughness||{};if(h.color=new vt(1,1,1),h.opacity=1,Array.isArray(m.baseColorFactor)){const S=m.baseColorFactor;h.color.setRGB(S[0],S[1],S[2],ra),h.opacity=S[3]}m.baseColorTexture!==void 0&&y.push(s.assignTexture(h,"map",m.baseColorTexture,mt)),h.metalness=m.metallicFactor!==void 0?m.metallicFactor:1,h.roughness=m.roughnessFactor!==void 0?m.roughnessFactor:1,m.metallicRoughnessTexture!==void 0&&(y.push(s.assignTexture(h,"metalnessMap",m.metallicRoughnessTexture)),y.push(s.assignTexture(h,"roughnessMap",m.metallicRoughnessTexture))),f=this._invokeOne(function(S){return S.getMaterialType&&S.getMaterialType(l)}),y.push(Promise.all(this._invokeAll(function(S){return S.extendMaterialParams&&S.extendMaterialParams(l,h)})))}c.doubleSided===!0&&(h.side=t1);const v=c.alphaMode||nf.OPAQUE;if(v===nf.BLEND?(h.transparent=!0,h.depthWrite=!1):(h.transparent=!1,v===nf.MASK&&(h.alphaTest=c.alphaCutoff!==void 0?c.alphaCutoff:.5)),c.normalTexture!==void 0&&f!==hi&&(y.push(s.assignTexture(h,"normalMap",c.normalTexture)),h.normalScale=new Mf(1,1),c.normalTexture.scale!==void 0)){const m=c.normalTexture.scale;h.normalScale.set(m,m)}if(c.occlusionTexture!==void 0&&f!==hi&&(y.push(s.assignTexture(h,"aoMap",c.occlusionTexture)),c.occlusionTexture.strength!==void 0&&(h.aoMapIntensity=c.occlusionTexture.strength)),c.emissiveFactor!==void 0&&f!==hi){const m=c.emissiveFactor;h.emissive=new vt().setRGB(m[0],m[1],m[2],ra)}return c.emissiveTexture!==void 0&&f!==hi&&y.push(s.assignTexture(h,"emissiveMap",c.emissiveTexture,mt)),Promise.all(y).then(function(){const m=new f(h);return c.name&&(m.name=c.name),oa(m,c),s.associations.set(m,{materials:l}),c.extensions&&dl(r,m,c),m})}createUniqueName(l){const s=Cs.sanitizeNodeName(l||"");return s in this.nodeNamesUsed?s+"_"+ ++this.nodeNamesUsed[s]:(this.nodeNamesUsed[s]=0,s)}loadGeometries(l){const s=this,o=this.extensions,r=this.primitiveCache;function c(h){return o[_e.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(h,s).then(function(g){return pp(g,h,s)})}const f=[];for(let h=0,g=l.length;h0&&lS(R,c),R.name=s.createUniqueName(c.name||"mesh_"+l),oa(R,c),M.extensions&&dl(r,R,M),s.assignFinalMaterial(R),m.push(R)}for(let T=0,C=m.length;T1?v=new Ye:y.length===1?v=y[0]:v=new di,v!==y[0])for(let m=0,S=y.length;m{const m=new Map;for(const[S,T]of r.associations)(S instanceof As||S instanceof cf)&&m.set(S,T);return v.traverse(S=>{const T=r.associations.get(S);T!=null&&m.set(S,T)}),m};return r.associations=y(c),c})}_createAnimationTracks(l,s,o,r,c){const f=[],h=l.name?l.name:l.uuid,g=[];Va[c.path]===Va.weights?l.traverse(function(S){S.morphTargetInfluences&&g.push(S.name?S.name:S.uuid)}):g.push(h);let y;switch(Va[c.path]){case Va.weights:y=mf;break;case Va.rotation:y=fu;break;case Va.translation:case Va.scale:y=hf;break;default:switch(o.itemSize){case 1:y=mf;break;case 2:case 3:default:y=hf;break}break}const v=r.interpolation!==void 0?tS[r.interpolation]:_p,m=this._getArrayFromAccessor(o);for(let S=0,T=g.length;S0?c[c.length-1]:"",smooth:f!==void 0?f.smooth:this.smooth,groupStart:f!==void 0?f.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(g){const y={index:typeof g=="number"?g:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return y.clone=this.clone.bind(y),y}};return this.materials.push(h),h},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(r){const c=this.currentMaterial();if(c&&c.groupEnd===-1&&(c.groupEnd=this.geometry.vertices.length/3,c.groupCount=c.groupEnd-c.groupStart,c.inherited=!1),r&&this.materials.length>1)for(let f=this.materials.length-1;f>=0;f--)this.materials[f].groupCount<=0&&this.materials.splice(f,1);return r&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),c}},o&&o.name&&typeof o.clone=="function"){const r=o.clone(0);r.inherited=!0,this.object.materials.push(r)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(l,s){const o=parseInt(l,10);return(o>=0?o-1:o+s/3)*3},parseNormalIndex:function(l,s){const o=parseInt(l,10);return(o>=0?o-1:o+s/3)*3},parseUVIndex:function(l,s){const o=parseInt(l,10);return(o>=0?o-1:o+s/2)*2},addVertex:function(l,s,o){const r=this.vertices,c=this.object.geometry.vertices;c.push(r[l+0],r[l+1],r[l+2]),c.push(r[s+0],r[s+1],r[s+2]),c.push(r[o+0],r[o+1],r[o+2])},addVertexPoint:function(l){const s=this.vertices;this.object.geometry.vertices.push(s[l+0],s[l+1],s[l+2])},addVertexLine:function(l){const s=this.vertices;this.object.geometry.vertices.push(s[l+0],s[l+1],s[l+2])},addNormal:function(l,s,o){const r=this.normals,c=this.object.geometry.normals;c.push(r[l+0],r[l+1],r[l+2]),c.push(r[s+0],r[s+1],r[s+2]),c.push(r[o+0],r[o+1],r[o+2])},addFaceNormal:function(l,s,o){const r=this.vertices,c=this.object.geometry.normals;yp.fromArray(r,l),lf.fromArray(r,s),vp.fromArray(r,o),gn.subVectors(vp,lf),Sp.subVectors(yp,lf),gn.cross(Sp),gn.normalize(),c.push(gn.x,gn.y,gn.z),c.push(gn.x,gn.y,gn.z),c.push(gn.x,gn.y,gn.z)},addColor:function(l,s,o){const r=this.colors,c=this.object.geometry.colors;r[l]!==void 0&&c.push(r[l+0],r[l+1],r[l+2]),r[s]!==void 0&&c.push(r[s+0],r[s+1],r[s+2]),r[o]!==void 0&&c.push(r[o+0],r[o+1],r[o+2])},addUV:function(l,s,o){const r=this.uvs,c=this.object.geometry.uvs;c.push(r[l+0],r[l+1]),c.push(r[s+0],r[s+1]),c.push(r[o+0],r[o+1])},addDefaultUV:function(){const l=this.object.geometry.uvs;l.push(0,0),l.push(0,0),l.push(0,0)},addUVLine:function(l){const s=this.uvs;this.object.geometry.uvs.push(s[l+0],s[l+1])},addFace:function(l,s,o,r,c,f,h,g,y){const v=this.vertices.length;let m=this.parseVertexIndex(l,v),S=this.parseVertexIndex(s,v),T=this.parseVertexIndex(o,v);if(this.addVertex(m,S,T),this.addColor(m,S,T),h!==void 0&&h!==""){const C=this.normals.length;m=this.parseNormalIndex(h,C),S=this.parseNormalIndex(g,C),T=this.parseNormalIndex(y,C),this.addNormal(m,S,T)}else this.addFaceNormal(m,S,T);if(r!==void 0&&r!==""){const C=this.uvs.length;m=this.parseUVIndex(r,C),S=this.parseUVIndex(c,C),T=this.parseUVIndex(f,C),this.addUV(m,S,T),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(l){this.object.geometry.type="Points";const s=this.vertices.length;for(let o=0,r=l.length;o=7?(ou.setRGB(parseFloat(m[4]),parseFloat(m[5]),parseFloat(m[6]),mt),s.colors.push(ou.r,ou.g,ou.b)):s.colors.push(void 0,void 0,void 0);break;case"vn":s.normals.push(parseFloat(m[1]),parseFloat(m[2]),parseFloat(m[3]));break;case"vt":s.uvs.push(parseFloat(m[1]),parseFloat(m[2]));break}}else if(v==="f"){const S=y.slice(1).trim().split(gp),T=[];for(let w=0,M=S.length;w0){const L=R.split("/");T.push(L)}}const C=T[0];for(let w=1,M=T.length-1;w1){const S=r[1].trim().toLowerCase();s.object.smooth=S!=="0"&&S!=="off"}else s.object.smooth=!0;const m=s.object.currentMaterial();m&&(m.smooth=s.object.smooth)}else{if(y==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+y+'"')}}s.finalize();const c=new Ye;if(c.materialLibraries=[].concat(s.materialLibraries),!(s.objects.length===1&&s.objects[0].geometry.vertices.length===0)===!0)for(let h=0,g=s.objects.length;h0&&w.setAttribute("normal",new vn(v.normals,3)),v.colors.length>0&&(C=!0,w.setAttribute("color",new vn(v.colors,3))),v.hasUVIndices===!0&&w.setAttribute("uv",new vn(v.uvs,2));const M=[];for(let L=0,O=m.length;L1){for(let L=0,O=m.length;L0){const h=new bs({size:1,sizeAttenuation:!1}),g=new gi;g.setAttribute("position",new vn(s.vertices,3)),s.colors.length>0&&s.colors[0]!==void 0&&(g.setAttribute("color",new vn(s.colors,3)),h.vertexColors=!0);const y=new ru(g,h);c.add(y)}return c}}const gS=[[0,2],[3,1]],yS=[[0,8,2,10],[12,4,14,6],[3,11,1,9],[15,7,13,5]],vS=[[0,32,8,40,2,34,10,42],[48,16,56,24,50,18,58,26],[12,44,4,36,14,46,6,38],[60,28,52,20,62,30,54,22],[3,35,11,43,1,33,9,41],[51,19,59,27,49,17,57,25],[15,47,7,39,13,45,5,37],[63,31,55,23,61,29,53,21]];function SS(d,l,s){return s==="bayer2"?(gS[l&1][d&1]+.5)/4-.5:s==="bayer4"?(yS[l&3][d&3]+.5)/16-.5:s==="bayer8"?(vS[l&7][d&7]+.5)/64-.5:0}function Nn(d){return d<0?0:d>255?255:d|0}function bS(d,l,s){const o=d/255,r=l/255,c=s/255,f=Math.max(o,r,c),h=Math.min(o,r,c),g=(f+h)/2;if(f===h)return[0,0,g];const y=f-h,v=g>.5?y/(2-f-h):y/(f+h);let m=0;return f===o?m=(r-c)/y+(r{let g=h;return g<0&&(g+=1),g>1&&(g-=1),g<1/6?c+(r-c)*6*g:g<1/2?r:g<2/3?c+(r-c)*(2/3-g)*6:c};return[Nn(f(o+1/3)*255),Nn(f(o)*255),Nn(f(o-1/3)*255)]}function sf(d,l,s,o){let r=o[0],c=1/0;for(let f=0;f0)return s.map(Si);if(l==="full")return o>0&&o<64?Dp(d,o):null;const r=bf.find(c=>c.id===l);return!r||r.colors.length===0?null:r.colors.map(Si)}function xS(d,l,s,o=.42,r=1){let c=l,f=-1,h=-1;for(let L=0;L=128&&(Of&&(f=O),L>h&&(h=L));if(f=128)continue;const Q=(O-y)/v,F=(L-S)/m;Q*Q+F*F<=1&&(g[U]=12,g[U+1]=14,g[U+2]=24,g[U+3]=T)}return g}function ES(d,l,s,o){const r=new Uint8ClampedArray(d.length),c=o.brightness??0,f=o.contrast??1,h=o.saturation??1,g=o.shadowHueShift??0,y=Math.abs(c)>.001||Math.abs(f-1)>.001||Math.abs(h-1)>.001||Math.abs(g)>.5;for(let T=0;T.5&&L>.04){const F=(.48-O)/.48;U=R+g*F,Q=Math.min(1,Q+.08*F)}[C,w,M]=TS(U,Q,O)}r[T]=C,r[T+1]=w,r[T+2]=M,r[T+3]=255}const v=new Uint8ClampedArray(d.length),m=AS(r,o.paletteId,o.customPaletteHexes,o.autoColorCount??64),S=o.ditherMode==="none"?0:o.ditherStrength*(m?Math.min(64,Math.max(20,220/Math.sqrt(m.length))):28);for(let T=0;T0?SS(C,T,o.ditherMode)*S:0,R=Nn(r[w]+M),L=Nn(r[w+1]+M),O=Nn(r[w+2]+M);if(m){const U=sf(R,L,O,m);v[w]=U[0],v[w+1]=U[1],v[w+2]=U[2]}else v[w]=R,v[w+1]=L,v[w+2]=O;v[w+3]=255}if(o.creaseOutline&&o.normalRgba&&o.normalRgba.length===d.length){const T=o.normalRgba,w=.88-Math.max(.05,Math.min(1,o.creaseStrength??.45))*.55,M=new Uint8Array(l*s);for(let R=0;R=128&&T[V+3]>=128){const de=T[V]/255*2-1,ce=T[V+1]/255*2-1,he=T[V+2]/255*2-1;U*de+Q*ce+F*he=128&&T[X+3]>=128){const de=T[X]/255*2-1,ce=T[X+1]/255*2-1,he=T[X+2]/255*2-1;U*de+Q*ce+F*he=l||ce>=s)continue;const he=(ce*l+de)*4;if(R[he+3]>=128){Q=he;break}}if(Q===-1)continue;let V;o.outlineMode==="tinted"?(V=[Math.round(R[Q]*.36),Math.round(R[Q+1]*.36),Math.round(R[Q+2]*.36)],m&&(V=sf(V[0],V[1],V[2],m))):o.outlineMode==="custom"?V=T:V=C,v[U]=V[0],v[U+1]=V[1],v[U+2]=V[2],v[U+3]=255}}}return o.groundShadow?xS(v,l,s,o.groundShadowOpacity??.42,o.groundShadowScale??1):v}function MS(d,l){const s=new Uint8ClampedArray(d.length);for(let o=0;o{const zt=new Ye;zt.position.set(Ze,.58,0);const we=new P(new Vt(.13,.11,.32,6),o);we.position.y=-.14,zt.add(we);const nt=new P(new be(.2,.14,.24),r);nt.position.set(0,-.28,.02),zt.add(nt);const lt=new P(new be(.21,.28,.24),s);lt.position.y=-.44,zt.add(lt);const Be=new P(new be(.22,.14,.34),o);return Be.position.set(0,-.54,.06),zt.add(Be),l.add(zt),zt},Te=ve(.19),W=ve(-.19),$=(Ze,zt)=>{const we=zt*Math.PI*2;if(l.position.y=0,l.rotation.set(0,0,0),M.rotation.set(0,0,0),he.rotation.set(0,0,0),se.rotation.set(0,0,0),Te.rotation.set(0,0,0),W.rotation.set(0,0,0),le.rotation.set(.2,0,0),F.rotation.set(0,0,0),Ze==="Walk"){const nt=Math.sin(we)*.68;Te.rotation.x=nt,W.rotation.x=-nt,he.rotation.x=-nt*.65,se.rotation.x=nt*.45,l.position.y=Math.abs(Math.sin(we))*.09,l.rotation.z=Math.cos(we)*.05,M.rotation.y=Math.sin(we)*.07,le.rotation.x=.36+Math.sin(we*2)*.16,F.rotation.x=-.12+Math.sin(we*2)*.12}else if(Ze==="Slash"){const nt=Math.sin(we);he.rotation.x=-.95+nt*1.25,he.rotation.z=-.22-Math.cos(we)*.4,l.rotation.y=nt*.5,se.rotation.x=-.4,Te.rotation.x=-.28,W.rotation.x=.28,le.rotation.x=.35+Math.abs(nt)*.22}else l.position.y=Math.sin(we)*.04,he.rotation.x=Math.sin(we)*.08,se.rotation.x=-Math.sin(we)*.06,le.rotation.x=.18+Math.sin(we)*.07};return $("Walk",0),{id:"knight",name:"Paladin Knight",root:d,animations:["Walk","Slash","Idle"],update:$}}function CS(){const d=new Ye,l=new Ye;l.position.y=.74,d.add(l);const s=et(7047265,.48,.25),o=et(8955004,.42,.3),r=et(4344409,.38,.58),c=et(2435636,.5,.5),f=et(16752412,.2,.1,16746496),h=et(16436245,.4,.25),g=new P(new be(.68,.24,.48),r);l.add(g);const y=new Ye;y.position.y=.44,l.add(y);const v=new P(new be(.96,.68,.78),s);y.add(v);const m=new P(new be(.72,.16,.62),o);m.position.y=.4,y.add(m);const S=new P(new be(.66,.3,.12),c);S.position.set(0,.08,.38),y.add(S);const T=new P(new be(.56,.2,.08),f);T.position.set(0,.08,.42),y.add(T);const C=new P(new be(.7,.52,.28),r);C.position.set(0,.06,-.46),y.add(C);const w=new P(new Vt(.1,.14,.2,8),f);w.rotation.x=Math.PI/2,w.position.set(-.2,-.08,-.62),y.add(w);const M=w.clone();M.position.x=.2,y.add(M);const R=new P(new Vt(.03,.04,.48,6),h);R.position.set(.36,.56,-.18),y.add(R);const L=new P(new be(.3,.28,.38),h);L.position.set(.38,.54,.08),y.add(L);const O=new Ye;O.position.set(-.68,.12,0),y.add(O);const U=new P(new be(.34,.38,.46),h);O.add(U);const Q=new P(new be(.24,.24,.52),r);Q.position.set(0,0,.35),O.add(Q);const F=new P(new Vt(.09,.11,.92,8),c);F.rotation.x=Math.PI/2,F.position.set(0,0,.56),O.add(F);const V=new P(new ml(.24,0),f);V.position.set(0,0,1.06),V.scale.setScalar(.001),O.add(V);const X=new Ye;X.position.set(.68,.06,0),y.add(X);const le=new P(new be(.3,.3,.36),o);X.add(le);const de=new P(new be(.24,.48,.28),r);de.position.y=-.32,X.add(de);const ce=new P(new be(.28,.16,.34),h);ce.position.set(0,-.58,.06),X.add(ce);const he=Z=>{const J=new Ye;J.position.set(Z,-.05,0);const ee=new P(new be(.28,.38,.32),s);ee.position.y=-.18,J.add(ee);const ue=new P(new Vt(.14,.14,.32,8),h);ue.rotation.z=Math.PI/2,ue.position.y=-.36,J.add(ue);const ge=new P(new be(.24,.32,.28),r);ge.position.y=-.52,J.add(ge);const He=new P(new be(.36,.16,.5),c);return He.position.set(0,-.66,.09),J.add(He),l.add(J),J},Ke=he(.36),Qe=he(-.36),Oe=(Z,J)=>{const ee=J*Math.PI*2;if(l.position.y=.74,y.rotation.set(0,0,0),Ke.rotation.set(0,0,0),Qe.rotation.set(0,0,0),O.position.z=0,X.rotation.set(0,0,0),V.scale.setScalar(.001),Z==="Walk"){const ue=Math.sin(ee)*.55;Ke.rotation.x=ue,Qe.rotation.x=-ue,l.position.y=.74+Math.abs(Math.sin(ee))*.09,y.rotation.y=Math.sin(ee)*.14,X.rotation.x=-ue*.5}else if(Z==="Fire"){const ue=Math.max(0,Math.sin(ee));O.position.z=-ue*.2,y.rotation.x=-ue*.12;const ge=J<.25?1-J*3.5:.001;V.scale.setScalar(Math.max(.001,ge)),V.rotation.z=ee*2}else l.position.y=.74+Math.sin(ee)*.035,y.rotation.y=Math.sin(ee)*.08};return Oe("Walk",0),{id:"mech",name:"Heavy Mech",root:d,animations:["Walk","Fire","Idle"],update:Oe}}function NS(){const d=new Ye,l=new Ye;d.add(l);const s=et(2282478,.22,.18),o=et(947344,.28,.22),r=et(16096779,.25,.6),c=et(16317180,.15,0,16777215),f=et(988970,.1,0),h=et(16707722,.1,0,16436245),g=new P(new u1(.66,0),s);g.position.y=.68,l.add(g);const y=new P(new Vt(.58,.72,.34,8),o);y.position.y=.22,l.add(y);const v=new P(new Vt(.64,.64,.1,8),r);v.position.y=.42,l.add(v);const m=new P(new ml(.24,0),r);m.position.y=1.42,l.add(m);const S=new P(new ml(.28,0),h);S.position.y=.7,l.add(S);const T=new P(new be(.16,.22,.12),c);T.position.set(.22,.76,.56),l.add(T);const C=new P(new be(.08,.12,.04),f);C.position.set(.22,.76,.62),l.add(C);const w=new P(new be(.16,.22,.12),c);w.position.set(-.22,.76,.56),l.add(w);const M=new P(new be(.08,.12,.04),f);M.position.set(-.22,.76,.62),l.add(M);const R=new P(new ml(.22,0),s);R.position.set(.88,.9,0),d.add(R);const L=new P(new ml(.22,0),s);L.position.set(-.88,.9,0),d.add(L);const O=(U,Q)=>{const F=Q*Math.PI*2;if(l.position.set(0,0,0),l.scale.set(1,1,1),R.position.y=.9+Math.sin(F)*.14,L.position.y=.9+Math.cos(F)*.14,R.rotation.y=F,L.rotation.y=-F,m.rotation.y=F,S.rotation.y=-F,U==="Hop"){const V=Math.max(0,Math.sin(F));l.position.y=V*.48;const X=1-Math.sin(F*2)*.15;l.scale.set(1/Math.sqrt(X),X,1/Math.sqrt(X))}else if(U==="Pulse"){const V=1+Math.sin(F)*.16;l.scale.set(V,1/Math.sqrt(V),V),R.position.x=.88+Math.sin(F)*.18,L.position.x=-.88-Math.sin(F)*.18}else{const V=1+Math.sin(F)*.06;l.scale.set(V,2-V,V)}};return O("Hop",0),{id:"slime",name:"Crystal Slime",root:d,animations:["Hop","Pulse","Idle"],update:O}}function _S(){const d=new Ye,l=new Ye;d.add(l);const s=et(10118196,.68,.05),o=et(16096779,.28,.65),r=et(3818326,.42,.55),c=et(8141549,.6,.1,5972406),f=et(3462041,.15,.1,1096065),h=new P(new be(1.16,.56,.8),s);h.position.y=.28,l.add(h);const g=new P(new be(1.02,.12,.68),c);g.position.y=.54,l.add(g);for(const M of[-.42,.42]){const R=new P(new be(.14,.6,.84),r);R.position.set(M,.29,0),l.add(R)}const y=new P(new be(.26,.3,.12),o);y.position.set(0,.46,.42),l.add(y);const v=new Ye;v.position.set(0,.56,-.4),l.add(v);const m=new P(new Vt(.4,.4,1.18,10,1,!1,0,Math.PI),s);m.rotation.z=Math.PI/2,m.rotation.y=Math.PI/2,m.position.set(0,.02,.4),v.add(m);for(const M of[-.42,.42]){const R=new P(new Vt(.42,.42,.16,10,1,!1,0,Math.PI),o);R.rotation.z=Math.PI/2,R.rotation.y=Math.PI/2,R.position.set(M,.02,.4),v.add(R)}const S=new Ye;S.position.set(0,.65,0),l.add(S);const T=new P(new ml(.26,0),f);S.add(T);const C=new P(new r1(.36,.04,6,12),o);C.rotation.x=Math.PI/2,S.add(C);const w=(M,R)=>{const L=R*Math.PI*2;if(l.position.set(0,0,0),l.rotation.set(0,0,0),v.rotation.set(0,0,0),S.position.y=.55,S.scale.setScalar(.001),M==="Open"){const O=(1-Math.cos(L))*.5;v.rotation.x=-O*1.15,l.position.y=Math.sin(L)*.05,S.scale.setScalar(.3+O*.85),S.position.y=.55+O*.68,S.rotation.y=L*2}else M==="Spin"?(l.rotation.y=L,l.position.y=Math.abs(Math.sin(L*2))*.15):(l.position.y=Math.sin(L)*.04,v.rotation.x=-.18+Math.sin(L)*.08,S.scale.setScalar(.55),S.position.y=.7+Math.sin(L)*.05,S.rotation.y=L)};return w("Open",0),{id:"chest",name:"Loot Chest",root:d,animations:["Open","Spin","Idle"],update:w}}function RS(d){return d==="mech"?CS():d==="slime"?NS():d==="chest"?_S():wS()}function of(d){const l=new Uint8Array(d*4);for(let o=0;o{if(s.isMesh){const o=s;this.originalMaterials.set(o,o.material)}})}applyShadingMode(l){if(this.currentShading===l)return;this.currentShading=l;for(const o of this.generatedMaterials)o.dispose();this.generatedMaterials=[];const s=o=>{if(l==="smooth")return o;const r=o,c=r.color?r.color.clone():new vt(13751771),f=r.map??null,h=r.emissive?r.emissive.clone():new vt(0),g=r.emissiveIntensity??0;if(l==="flat"){const m=new hi({color:c,map:f,side:o.side});return this.generatedMaterials.push(m),m}const y=l==="toon2"?2:l==="toon4"?4:3,v=new v1({color:c,map:f,emissive:h,emissiveIntensity:g,gradientMap:this.toonGradients[y],side:o.side});return this.generatedMaterials.push(v),v};this.modelPivot.traverse(o=>{if(!o.isMesh)return;const r=o,c=this.originalMaterials.get(r);c&&(Array.isArray(c)?r.material=c.map(s):r.material=s(c))})}loadSample(l){this.clearCurrentModel();const s=RS(l);return this.sampleInstance=s,this.modelPivot.add(s.root),this.normalizePivotContent(s.root),this.cacheOriginals(s.root),{name:s.name,isCustom:!1,animations:s.animations}}async loadFile(l){const s=l.name.toLowerCase().split(".").at(-1)??"",o=await l.arrayBuffer();if(this.clearCurrentModel(),s==="obj"){const r=new TextDecoder().decode(o),f=new pS().parse(r);return this.customRoot=f,this.modelPivot.add(f),this.normalizePivotContent(f),this.cacheOriginals(f),this.clips=[],{name:l.name,isCustom:!0,animations:["Turntable"]}}if(s==="fbx"){const c=new op().parse(o,"");return this.customRoot=c,this.modelPivot.add(c),this.normalizePivotContent(c),this.cacheOriginals(c),this.clips=c.animations??[],this.clips.length>0&&(this.mixer=new Yc(c)),{name:l.name,isCustom:!0,animations:this.clips.length>0?this.clips.map((f,h)=>f.name||`Clip ${h+1}`):["Turntable"]}}if(s==="glb"||s==="gltf"||s==="vrm"){const c=await new fp().parseAsync(o,""),f=c.scene;return this.customRoot=f,this.modelPivot.add(f),this.normalizePivotContent(f),this.cacheOriginals(f),this.clips=c.animations??[],this.clips.length>0&&(this.mixer=new Yc(f)),{name:l.name,isCustom:!0,animations:this.clips.length>0?this.clips.map((h,g)=>h.name||`Clip ${g+1}`):["Turntable"]}}throw new Error("Unsupported 3D format. Use .glb, .gltf, .vrm, .fbx, or .obj.")}async appendAnimationFile(l){if(!this.customRoot)throw new Error("Load a custom 3D model (.fbx/.glb) first before stacking animation clips.");const s=l.name.toLowerCase().split(".").at(-1)??"",o=await l.arrayBuffer();let r=[];if(s==="fbx")r=new op().parse(o,"").animations??[];else if(s==="glb"||s==="gltf"||s==="vrm")r=(await new fp().parseAsync(o,"")).animations??[];else throw new Error("Animation import supports .fbx, .glb, or .gltf.");if(r.length===0)throw new Error(`No animation clips found inside ${l.name}.`);const c=l.name.replace(/\.[^.]+$/,"");for(let f=0;ff.name||`Clip ${h+1}`)}normalizePivotContent(l){l.updateMatrixWorld(!0);const s=new vf().setFromObject(l),o=new $e;s.getSize(o);const c=1.9/Math.max(o.x,o.y,o.z,.001);l.scale.multiplyScalar(c),l.updateMatrixWorld(!0);const f=new vf().setFromObject(l),h=new $e;f.getCenter(h),l.position.sub(h)}setAnimationFrame(l,s){const o=(s%1+1)%1;if(this.sampleInstance){this.sampleInstance.update(l,o);return}if(this.mixer&&this.clips.length>0){const r=this.clips.findIndex((h,g)=>(h.name||`Clip ${g+1}`)===l),c=this.clips[r>=0?r:0];this.activeClipDuration=Math.max(.05,c.duration||1),this.mixer.stopAllAction(),this.mixer.clipAction(c).play(),this.mixer.setTime(o*this.activeClipDuration)}else this.customRoot&&(this.customRoot.rotation.y=l==="Turntable"?o*Math.PI*2:0)}buildCamera(l,s,o){const c=pt.degToRad(l),f=pt.degToRad(Math.max(-80,Math.min(80,s))),h=Math.cos(f),g=new $e(4.2*Math.sin(c)*h,4.2*Math.sin(f),4.2*Math.cos(c)*h);let y;const v=1.35/Math.max(.4,o.zoom);return o.projection==="persp"?y=new Ef(34/Math.max(.4,o.zoom),1,.1,30):y=new Np(-v,v,v,-v,.1,30),y.position.copy(g),y.lookAt(0,0,0),y.updateMatrixWorld(!0),y}positionLights(l){const s=pt.degToRad(l.lightAzimuthDeg),o=pt.degToRad(l.lightElevationDeg),r=6;this.keyLight.position.set(r*Math.sin(s)*Math.cos(o),r*Math.sin(o),r*Math.cos(s)*Math.cos(o)),l.rimLight&&l.rimIntensity>0?(this.rimLight.intensity=l.rimIntensity*2.1,this.rimLight.color.set(l.rimColor||"#7dd3fc"),this.rimLight.position.set(-this.keyLight.position.x,Math.max(1.5,this.keyLight.position.y*.6),-this.keyLight.position.z)):this.rimLight.intensity=0}readTarget(l,s){const o=new Uint8Array(s*s*4);this.renderer.readRenderTargetPixels(l,0,0,s,s,o);const r=new Uint8ClampedArray(s*s*4),c=s*4;for(let f=0;fl.dispose()),this.normalOverrideMat.dispose(),this.depthOverrideMat.dispose(),this.renderer.dispose()}}function OS({engine:d,animName:l,modelName:s,settings:o,activeSample:r,isCustomModel:c}){const[f,h]=re.useState("albedo"),[g,y]=re.useState(!0),[v,m]=re.useState(2),S=re.useRef(null),T=re.useMemo(()=>d?d.bakeAllDirections(l,o):null,[d,l,o,r,c]);if(re.useEffect(()=>{const U=S.current;if(!U||!T)return;U.width=T.sheetWidth,U.height=T.sheetHeight;const Q=U.getContext("2d");if(!Q)return;const F=Q.createImageData(T.sheetWidth,T.sheetHeight);F.data.set(f==="normal"?T.normalSheet:T.albedoSheet),Q.putImageData(F,0,0)},[T,f]),!T)return null;const C=T.sheetWidth*v,w=T.sheetHeight*v,M=o.layout==="strip"?T.dirs.length*T.framesPerDir:T.framesPerDir,R=o.layout==="strip"?1:T.dirs.length,L=T.frameWidth*v,O=T.frameHeight*v;return A.jsxs("div",{className:"subtab-container",children:[A.jsxs("div",{className:"subtab-toolbar",children:[A.jsxs("div",{className:"topbar-group",children:[A.jsxs("span",{className:"preview-tag",children:["SHEET INSPECTOR · ",s," (",l,")"]}),A.jsxs("span",{className:"mono-stat",children:[T.sheetWidth,"×",T.sheetHeight,"px · ",T.dirs.length," dirs × ",T.framesPerDir,"f ="," ",T.allFrames.length," frames"]})]}),A.jsxs("div",{className:"topbar-group",children:[A.jsxs("div",{className:"segmented",children:[A.jsx("button",{className:f==="albedo"?"active":"",onClick:()=>h("albedo"),children:"Albedo Sheet"}),A.jsx("button",{className:f==="normal"?"active":"",onClick:()=>h("normal"),children:"Normal Map"})]}),A.jsx("div",{className:"segmented",children:[1,2,3].map(U=>A.jsxs("button",{className:v===U?"active":"",onClick:()=>m(U),children:[U,"×"]},U))}),A.jsx("button",{className:`btn ${g?"btn-pro-cta":""}`,onClick:()=>y(U=>!U),children:"Cell Grid"})]})]}),A.jsx("div",{className:"sheet-scroll-stage bg-checker",children:A.jsxs("div",{className:"sheet-canvas-wrap",style:{width:C,height:w},children:[A.jsx("canvas",{ref:S,className:"pixel-canvas",style:{width:C,height:w}}),g?A.jsx("div",{className:"sheet-grid-overlay",children:Array.from({length:R},(U,Q)=>Array.from({length:M},(F,V)=>{var X;return A.jsx("div",{className:"sheet-cell-box",style:{left:V*L,top:Q*O,width:L,height:O},children:V===0&&o.layout==="grid"?A.jsx("span",{className:"cell-label",children:(X=T.dirs[Q])==null?void 0:X.label.toUpperCase()}):null},`${Q}-${V}`)}))}):null]})})]})}const zS=[{id:"knight",label:"Knight"},{id:"mech",label:"Mech"},{id:"slime",label:"Slime"},{id:"chest",label:"Chest"}],jS=[32,48,64,96,128,256],LS=[{id:"single",label:"1-Dir"},{id:"dir4",label:"4-Dir"},{id:"dir8",label:"8-Dir"},{id:"iso4",label:"Iso"},{id:"rpgmaker",label:"RPGM"},{id:"turntable12",label:"12×"}],BS={enginePreset:"godot8",resolution:64,paletteId:"endesga32",customPaletteHexes:[],autoColorCount:24,ditherMode:"bayer4",ditherStrength:.3,outlineMode:"tinted",outlineColor:"#141418",outlineThickness:1,creaseOutline:!0,creaseStrength:.45,brightness:0,contrast:1.05,saturation:1.08,shadowHueShift:-18,shadingMode:"toon3",lightAzimuthDeg:38,lightElevationDeg:52,rimLight:!0,rimIntensity:.7,rimColor:"#7dd3fc",groundShadow:!0,groundShadowOpacity:.42,groundShadowScale:1,projection:"ortho",directionMode:"dir8",pitchDeg:22,yawOffsetDeg:25,zoom:1.05,yOffset:0,onionSkin:!1,frameCount:8,fps:10,layout:"grid",bakeAllClips:!1,exports:{albedoSheet:!0,normalSheet:ua,animatedGif:ua,godotTres:ua,unityAsepriteJson:ua,phaserJson:!1,framesZip:!1}};function uf(d,l,s){const o=document.createElement("canvas");o.width=l,o.height=s;const r=o.getContext("2d"),c=r.createImageData(l,s);return c.data.set(d),r.putImageData(c,0,0),new Promise((f,h)=>{o.toBlob(g=>g?f(g):h(new Error("PNG encoding failed.")),"image/png")})}function vs(d,l,s,o){if(!d||l.length===0)return;d.width!==s&&(d.width=s),d.height!==o&&(d.height=o);const r=d.getContext("2d");if(!r)return;const c=r.createImageData(s,o);c.data.set(l),r.putImageData(c,0,0)}function uu(d,l){const s=URL.createObjectURL(d),o=document.createElement("a");o.href=s,o.download=l,o.click(),window.setTimeout(()=>URL.revokeObjectURL(s),1200)}function US(){var Sl;const[d,l]=re.useState(BS),[s,o]=re.useState("studio"),[r,c]=re.useState("knight"),[f,h]=re.useState("Paladin Knight"),[g,y]=re.useState(!1),[v,m]=re.useState(["Walk","Slash","Idle"]),[S,T]=re.useState("Walk"),[C,w]=re.useState(!0),[M,R]=re.useState(0),[L,O]=re.useState(0),[U,Q]=re.useState("pixel"),[F,V]=re.useState("checker"),[X,le]=re.useState(4),[de,ce]=re.useState(!1),[he,Ke]=re.useState(!1),[Qe,Oe]=re.useState(""),[Z,J]=re.useState(!1),[ee,ue]=re.useState(null),[ge,He]=re.useState(null),se=re.useRef(null),Le=re.useRef(null),N=re.useRef(null),I=re.useRef(null),ne=re.useRef([]),ae=re.useRef(null),Se=re.useRef(null),ve=re.useRef(null),Te=re.useRef(null),W=re.useRef(null),$=re.useMemo(()=>Sf(d.directionMode,d.yawOffsetDeg),[d.directionMode,d.yawOffsetDeg]),Ze=re.useMemo(()=>Nf(d.resolution,d.resolution,$.length,d.frameCount,d.layout),[d.resolution,$.length,d.frameCount,d.layout]),zt=re.useMemo(()=>{var E;return d.paletteId==="custom"?d.customPaletteHexes:((E=bf.find(K=>K.id===d.paletteId))==null?void 0:E.colors)??[]},[d.paletteId,d.customPaletteHexes]),we=re.useCallback(E=>{Oe(E)},[]);re.useEffect(()=>{if(!Qe)return;const E=window.setTimeout(()=>Oe(""),3200);return()=>window.clearTimeout(E)},[Qe]),re.useEffect(()=>{try{const E=new DS,K=E.loadSample("knight");return se.current=E,h(K.name),m(K.animations),T(K.animations[0]??"Walk"),()=>{E.dispose(),se.current=null}}catch(E){He(E instanceof Error?E.message:"WebGL initialization failed.")}},[]),re.useEffect(()=>{if(!C||s!=="studio")return;const E=Math.max(40,Math.round(1e3/d.fps)),K=window.setInterval(()=>{R(oe=>(oe+1)%d.frameCount)},E);return()=>window.clearInterval(K)},[C,s,d.fps,d.frameCount]),re.useEffect(()=>{L>=$.length&&O(0)},[$.length,L]),re.useEffect(()=>{M>=d.frameCount&&R(0)},[d.frameCount,M]),re.useEffect(()=>{if(s!=="studio")return;const E=se.current;if(!E)return;const K=M/Math.max(1,d.frameCount),oe=$[L]??$[0],me=E.renderSingle(S,K,oe.yawDeg,d,U==="split",U==="depth"),Mt=U==="normal"?me.normal:U==="depth"?me.depth:me.albedo;if(vs(Le.current,Mt,me.width,me.height),d.onionSkin&&U==="pixel"){const St=(M-1+d.frameCount)%d.frameCount,Zt=E.renderSingle(S,St/Math.max(1,d.frameCount),oe.yawDeg,d,!1,!1);vs(N.current,Zt.albedo,Zt.width,Zt.height)}U==="split"&&me.reference3d.length>0&&vs(I.current,me.reference3d,256,256);for(let St=0;St<$.length;St++){const Zt=ne.current[St];if(Zt)if(St===L)vs(Zt,me.albedo,me.width,me.height);else{const bt=E.renderSingle(S,K,$[St].yawDeg,d,!1,!1);vs(Zt,bt.albedo,bt.width,bt.height)}}},[s,S,r,g,M,L,$,d,U]);const nt=E=>{const K=se.current;if(!K)return;const oe=K.loadSample(E);c(E),y(!1),h(oe.name),m(oe.animations),T(oe.animations[0]??"Walk"),R(0)},lt=async E=>{if(E.size===0){we("Selected 3D file is empty.");return}if(E.size>Y1){we("File exceeds 80 MB limit.");return}const K=se.current;if(K)try{const oe=await K.loadFile(E);y(!0),h(oe.name),m(oe.animations),T(oe.animations[0]??"Turntable"),R(0),we(`Loaded ${E.name}`)}catch(oe){we(oe instanceof Error?oe.message:"Could not parse 3D model.")}},Be=async E=>{const K=se.current;if(K)try{const oe=await K.appendAnimationFile(E);m(oe),T(oe[oe.length-1]??S),we(`Added animation from ${E.name}`)}catch(oe){we(oe instanceof Error?oe.message:"Could not load animation clip.")}},sn=async E=>{const K=await E.text(),oe=H1(K);if(oe.length<2){we("No valid colors found (.hex or .gpl).");return}l(me=>({...me,enginePreset:"custom",paletteId:"custom",customPaletteHexes:oe})),we(`Imported ${oe.length} colors`)},Fa=()=>{const E=Q1(d);uu(new Blob([E],{type:"application/json"}),`pixelbake_${d.enginePreset}.pixelbake.json`),we("Saved style preset (.pixelbake.json)")},_n=async E=>{try{const K=await E.text(),oe=Z1(K,d,ua);l(oe),we(`Loaded preset ${E.name}`)}catch(K){we(K instanceof Error?K.message:"Invalid preset file.")}},pl=E=>{var oe;E.preventDefault(),Ke(!1);const K=(oe=E.dataTransfer.files)==null?void 0:oe[0];K&<(K)},gl=E=>{W.current={x:E.clientX,y:E.clientY,yaw:d.yawOffsetDeg,pitch:d.pitchDeg},E.currentTarget.setPointerCapture(E.pointerId)},ca=E=>{const K=W.current;if(!K)return;const oe=E.clientX-K.x,me=E.clientY-K.y;l(Mt=>({...Mt,enginePreset:"custom",yawOffsetDeg:((K.yaw-oe*.6)%360+360)%360,pitchDeg:Math.max(-60,Math.min(75,Math.round(K.pitch+me*.45)))}))},bi=()=>{W.current=null},yl=E=>{if(E>sp){ue(`HD resolutions (${E}×${E}px) are included in PixelBake 3D Pro.`);return}l(K=>({...K,enginePreset:"custom",resolution:E}))},vl=E=>{if(E!=="albedoSheet"){ue("Normal Maps, Animated GIFs, Godot 4 .tres, Unity/Aseprite JSON, Batch All-Clips & ZIP frames are included in PixelBake 3D Pro.");return}},Rs=async()=>{const E=se.current;if(!(!E||Z)){J(!0);try{const K=f.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")||"sprite",oe=S.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")||"anim";ua&&d.bakeAllClips&&v.length>1;const me=E.bakeAllDirections(S,d),Mt=`${K}_${oe}`,St=`${Mt}_albedo.png`,Zt=await uf(me.albedoSheet,me.sheetWidth,me.sheetHeight);if(!ua){uu(Zt,St),we(`Exported ${St} (${me.sheetWidth}×${me.sheetHeight}px)`);return}if(!(d.exports.normalSheet||d.exports.animatedGif||d.exports.godotTres||d.exports.unityAsepriteJson||d.exports.phaserJson||d.exports.framesZip)){uu(Zt,St),we(`Exported ${St} (${me.sheetWidth}×${me.sheetHeight}px)`);return}const Rn=new D1;if(Rn.file(St,Zt),d.exports.normalSheet&&Rn.file(`${Mt}_normal.png`,await uf(me.normalSheet,me.sheetWidth,me.sheetHeight)),d.exports.animatedGif&&Rn.file(`${Mt}_preview.gif`,I1(me.primaryDirFrames,me.frameWidth,me.frameHeight,Math.round(1e3/d.fps))),d.exports.godotTres&&Rn.file(`${Mt}.tres`,z1(St,S,me.dirs,me.framesPerDir,me.frameWidth,me.frameHeight,d.fps,d.layout)),d.exports.unityAsepriteJson&&Rn.file(`${Mt}_aseprite_unity.json`,L1(St,S,me.dirs,me.framesPerDir,me.frameWidth,me.frameHeight,d.fps,d.layout)),d.exports.phaserJson&&Rn.file(`${Mt}_phaser.json`,B1(St,S,me.dirs,me.framesPerDir,me.frameWidth,me.frameHeight,d.layout)),d.exports.framesZip){const Os=Rn.folder("frames");let bl=0;for(let Ti=0;Ti=d.resolution*2?"linear-gradient(to right, rgba(255,255,255,0.09) 1px, transparent 1px), linear-gradient(to bottom, rgba(255,255,255,0.09) 1px, transparent 1px)":void 0;return A.jsxs("div",{className:"studio-shell",onDragOver:E=>{E.preventDefault(),Ke(!0)},onDragLeave:E=>{E.currentTarget===E.target&&Ke(!1)},onDrop:pl,children:[A.jsxs("header",{className:"topbar",children:[A.jsxs("div",{className:"topbar-group",children:[A.jsxs("div",{className:"brand",children:[A.jsxs("svg",{width:18,height:18,viewBox:"0 0 32 32",shapeRendering:"crispEdges","aria-hidden":"true",children:[A.jsx("rect",{width:"32",height:"32",rx:"6",fill:"#14161a"}),A.jsx("rect",{x:"10",y:"6",width:"12",height:"4",fill:"#fbbf24"}),A.jsx("rect",{x:"6",y:"10",width:"20",height:"4",fill:"#f59e0b"}),A.jsx("rect",{x:"6",y:"14",width:"10",height:"12",fill:"#d97706"}),A.jsx("rect",{x:"16",y:"14",width:"10",height:"12",fill:"#92400e"}),A.jsx("rect",{x:"10",y:"10",width:"4",height:"4",fill:"#fef3c7"})]}),A.jsx("span",{children:"PIXELBAKE 3D"}),A.jsx("span",{className:"brand-badge ",children:"DEMO"})]}),A.jsx("div",{className:"segmented",role:"tablist","aria-label":"Workspace Tabs",children:[["studio","Studio"],["sheet","Sheet"],["arena","2D Arena"]].map(([E,K])=>A.jsx("button",{role:"tab","aria-selected":s===E,className:s===E?"active":"",onClick:()=>o(E),children:K},E))}),A.jsx("div",{className:"segmented",role:"group","aria-label":"Sample 3D Models",children:zS.map(E=>A.jsx("button",{className:!g&&r===E.id?"active":"",onClick:()=>nt(E.id),children:E.label},E.id))}),A.jsx("button",{className:"btn",onClick:()=>{var E;return(E=ae.current)==null?void 0:E.click()},title:"Load .glb .gltf .vrm .fbx .obj",children:"+ Model"}),A.jsx("input",{ref:ae,type:"file",accept:".glb,.gltf,.vrm,.fbx,.obj",hidden:!0,onChange:E=>{var oe;const K=(oe=E.target.files)==null?void 0:oe[0];K&<(K),E.target.value=""}}),g?A.jsxs(A.Fragment,{children:[A.jsx("button",{className:"btn",onClick:()=>{var E;return(E=Se.current)==null?void 0:E.click()},title:"Stack Mixamo .fbx or .glb animation clip",children:"+ Anim"}),A.jsx("input",{ref:Se,type:"file",accept:".fbx,.glb,.gltf",hidden:!0,onChange:E=>{var oe;const K=(oe=E.target.files)==null?void 0:oe[0];K&&Be(K),E.target.value=""}})]}):null]}),A.jsxs("div",{className:"topbar-group",children:[A.jsx("select",{className:"select-compact","aria-label":"Animation clip",value:S,onChange:E=>T(E.target.value),children:v.map(E=>A.jsx("option",{value:E,children:E},E))}),A.jsx("button",{className:"btn",onClick:()=>w(E=>!E),"aria-label":C?"Pause":"Play",children:C?"❚❚":"▶"}),A.jsx("input",{className:"timeline-scrubber",type:"range","aria-label":"Timeline frame",min:0,max:d.frameCount-1,value:M,onChange:E=>{w(!1),R(Number(E.target.value))}}),A.jsxs("span",{className:"frame-counter",children:[String(M+1).padStart(2,"0"),"/",String(d.frameCount).padStart(2,"0")]}),A.jsx("button",{className:"btn btn-pro-cta",onClick:()=>ue("Unlock HD 256px, Normal Maps, Multi-Clip Master Bake, Godot 4 .tres, Unity/Aseprite JSON & Standalone Offline Pro App."),children:"Get Pro ($9)"}),A.jsx("button",{className:"btn btn-primary",onClick:()=>void Rs(),disabled:Z,children:Z?"Baking…":"Export PNG"})]})]}),A.jsxs("div",{className:"workspace-body",children:[A.jsxs("aside",{className:"inspector",children:[A.jsxs("section",{className:"panel-section",children:[A.jsxs("div",{className:"section-header",children:[A.jsx("span",{children:"Engine & Style Presets"}),A.jsxs("div",{className:"preset-actions",children:[A.jsx("button",{className:"mini-reset",onClick:Fa,children:"Save"}),A.jsx("span",{style:{color:"var(--border-strong)"},children:"·"}),A.jsx("button",{className:"mini-reset",onClick:()=>{var E;return(E=Te.current)==null?void 0:E.click()},children:"Load"}),A.jsx("input",{ref:Te,type:"file",accept:".json,.pixelbake.json",hidden:!0,onChange:E=>{var oe;const K=(oe=E.target.files)==null?void 0:oe[0];K&&_n(K),E.target.value=""}})]})]}),A.jsxs("select",{className:"select-compact","aria-label":"Engine preset",value:d.enginePreset,onChange:E=>l(K=>K1(K,E.target.value)),children:[Op.map(E=>A.jsx("option",{value:E.id,children:E.name},E.id)),A.jsx("option",{value:"custom",children:"Custom Settings"})]})]}),A.jsxs("section",{className:"panel-section",children:[A.jsxs("div",{className:"section-header",children:[A.jsx("span",{children:"01 · Camera & Directions"}),A.jsx("button",{className:"mini-reset",onClick:()=>l(E=>({...E,enginePreset:"custom",projection:"ortho",pitchDeg:22,yawOffsetDeg:25,zoom:1.05,yOffset:0})),children:"Reset"})]}),A.jsx("div",{className:"pill-grid cols-6",children:LS.map(E=>A.jsx("button",{className:`pill-btn ${d.directionMode===E.id?"active":""}`,onClick:()=>l(K=>({...K,enginePreset:"custom",directionMode:E.id})),children:E.label},E.id))}),A.jsxs("div",{className:"pill-grid cols-2",children:[A.jsx("button",{className:`pill-btn ${d.projection==="ortho"?"active":""}`,onClick:()=>l(E=>({...E,enginePreset:"custom",projection:"ortho"})),children:"Orthographic"}),A.jsx("button",{className:`pill-btn ${d.projection==="persp"?"active":""}`,onClick:()=>l(E=>({...E,enginePreset:"custom",projection:"persp"})),children:"Perspective"})]}),A.jsxs("div",{className:"field-row",children:[A.jsxs("div",{className:"field-label-row",children:[A.jsx("span",{children:"Pitch / Elevation"}),A.jsxs("span",{className:"val",children:[d.pitchDeg,"°"]})]}),A.jsx("input",{type:"range",min:-45,max:75,value:d.pitchDeg,onChange:E=>l(K=>({...K,enginePreset:"custom",pitchDeg:Number(E.target.value)}))})]}),A.jsxs("div",{className:"field-row",children:[A.jsxs("div",{className:"field-label-row",children:[A.jsx("span",{children:"Yaw Offset"}),A.jsxs("span",{className:"val",children:[Math.round(d.yawOffsetDeg),"°"]})]}),A.jsx("input",{type:"range",min:0,max:359,value:Math.round(d.yawOffsetDeg),onChange:E=>l(K=>({...K,enginePreset:"custom",yawOffsetDeg:Number(E.target.value)}))})]}),A.jsxs("div",{className:"field-row",children:[A.jsxs("div",{className:"field-label-row",children:[A.jsx("span",{children:"Zoom · Y-Anchor"}),A.jsxs("span",{className:"val",children:[d.zoom.toFixed(2),"× · ",d.yOffset.toFixed(2)]})]}),A.jsxs("div",{className:"pill-grid cols-2",children:[A.jsx("input",{type:"range","aria-label":"Zoom",min:.6,max:2.2,step:.05,value:d.zoom,onChange:E=>l(K=>({...K,enginePreset:"custom",zoom:Number(E.target.value)}))}),A.jsx("input",{type:"range","aria-label":"Vertical Y offset",min:-.4,max:.4,step:.02,value:d.yOffset,onChange:E=>l(K=>({...K,enginePreset:"custom",yOffset:Number(E.target.value)}))})]})]})]}),A.jsxs("section",{className:"panel-section",children:[A.jsxs("div",{className:"section-header",children:[A.jsx("span",{children:"02 · Pixel, Creases & Palette"}),A.jsx("button",{className:"mini-reset",onClick:()=>{var E;return(E=ve.current)==null?void 0:E.click()},children:".hex/.gpl"}),A.jsx("input",{ref:ve,type:"file",accept:".hex,.gpl,.txt",hidden:!0,onChange:E=>{var oe;const K=(oe=E.target.files)==null?void 0:oe[0];K&&sn(K),E.target.value=""}})]}),A.jsx("div",{className:"pill-grid",children:jS.map(E=>{const K=E>sp;return A.jsxs("button",{className:`pill-btn ${d.resolution===E?"active":""}`,onClick:()=>yl(E),children:[E,"px",K?A.jsx("span",{className:"pro-tag",children:"PRO"}):null]},E)})}),A.jsxs("select",{className:"select-compact","aria-label":"Color palette",value:d.paletteId,onChange:E=>l(K=>({...K,enginePreset:"custom",paletteId:E.target.value})),children:[bf.map(E=>A.jsx("option",{value:E.id,children:E.name},E.id)),d.customPaletteHexes.length>0?A.jsxs("option",{value:"custom",children:["Custom (",d.customPaletteHexes.length," colors)"]}):null]}),zt.length>0?A.jsx("div",{className:"palette-swatches","aria-label":"Active palette colors",children:zt.slice(0,32).map(E=>A.jsx("span",{className:"swatch",style:{background:E},title:E},E))}):null,A.jsxs("div",{className:"field-row",children:[A.jsxs("div",{className:"field-label-row",children:[A.jsx("span",{children:"Ordered Dither"}),A.jsxs("span",{className:"val",children:[Math.round(d.ditherStrength*100),"%"]})]}),A.jsx("div",{className:"pill-grid cols-4",children:[["none","Off"],["bayer2","2×2"],["bayer4","4×4"],["bayer8","8×8"]].map(([E,K])=>A.jsx("button",{className:`pill-btn ${d.ditherMode===E?"active":""}`,onClick:()=>l(oe=>({...oe,enginePreset:"custom",ditherMode:E})),children:K},E))}),d.ditherMode!=="none"?A.jsx("input",{type:"range",min:.05,max:1,step:.05,value:d.ditherStrength,onChange:E=>l(K=>({...K,enginePreset:"custom",ditherStrength:Number(E.target.value)}))}):null]}),A.jsxs("div",{className:"field-row",children:[A.jsxs("div",{className:"field-label-row",children:[A.jsx("span",{children:"Silhouette Outline"}),A.jsx("span",{className:"val",children:d.outlineMode==="none"?"Off":`${d.outlineThickness}px`})]}),A.jsx("div",{className:"pill-grid cols-4",children:[["none","None"],["black","Black"],["tinted","Tinted"],["custom","Color"]].map(([E,K])=>A.jsx("button",{className:`pill-btn ${d.outlineMode===E?"active":""}`,onClick:()=>l(oe=>({...oe,enginePreset:"custom",outlineMode:E})),children:K},E))}),d.outlineMode!=="none"?A.jsxs("div",{className:"pill-grid",children:[A.jsx("button",{className:`pill-btn ${d.outlineThickness===1?"active":""}`,onClick:()=>l(E=>({...E,outlineThickness:1})),children:"1px Crisp"}),A.jsx("button",{className:`pill-btn ${d.outlineThickness===2?"active":""}`,onClick:()=>l(E=>({...E,outlineThickness:2})),children:"2px Bold"}),d.outlineMode==="custom"?A.jsx("input",{type:"color","aria-label":"Outline color",value:d.outlineColor,onChange:E=>l(K=>({...K,outlineColor:E.target.value})),style:{width:"100%",height:24,padding:0,border:0,background:"transparent"}}):null]}):null]}),A.jsxs("div",{className:"export-checks",children:[A.jsxs("label",{className:"check-row",children:[A.jsxs("span",{className:"check-row-left",children:[A.jsx("input",{type:"checkbox",checked:d.creaseOutline,onChange:()=>l(E=>({...E,creaseOutline:!E.creaseOutline}))}),A.jsx("span",{children:"Internal Crease Lines"})]}),A.jsxs("span",{className:"val",style:{fontFamily:"var(--font-mono)",fontSize:10},children:[Math.round(d.creaseStrength*100),"%"]})]}),d.creaseOutline?A.jsx("input",{type:"range","aria-label":"Crease sensitivity",min:.15,max:.9,step:.05,value:d.creaseStrength,onChange:E=>l(K=>({...K,creaseStrength:Number(E.target.value)}))}):null,A.jsx("label",{className:"check-row",children:A.jsxs("span",{className:"check-row-left",children:[A.jsx("input",{type:"checkbox",checked:d.groundShadow,onChange:()=>l(E=>({...E,groundShadow:!E.groundShadow}))}),A.jsx("span",{children:"Ground Contact Shadow"})]})})]})]}),A.jsxs("section",{className:"panel-section",children:[A.jsx("div",{className:"section-header",children:A.jsx("span",{children:"03 · Lighting & Color Grading"})}),A.jsx("div",{className:"pill-grid cols-5",children:[["toon2","2-Step"],["toon3","3-Step"],["toon4","4-Step"],["smooth","Smooth"],["flat","Flat"]].map(([E,K])=>A.jsx("button",{className:`pill-btn ${d.shadingMode===E?"active":""}`,onClick:()=>l(oe=>({...oe,shadingMode:E})),children:K},E))}),A.jsxs("div",{className:"field-row",children:[A.jsxs("div",{className:"field-label-row",children:[A.jsx("span",{children:"Light Angle · Height"}),A.jsxs("span",{className:"val",children:[d.lightAzimuthDeg,"° · ",d.lightElevationDeg,"°"]})]}),A.jsxs("div",{className:"pill-grid cols-2",children:[A.jsx("input",{type:"range","aria-label":"Light azimuth",min:-180,max:180,value:d.lightAzimuthDeg,onChange:E=>l(K=>({...K,lightAzimuthDeg:Number(E.target.value)}))}),A.jsx("input",{type:"range","aria-label":"Light elevation",min:10,max:85,value:d.lightElevationDeg,onChange:E=>l(K=>({...K,lightElevationDeg:Number(E.target.value)}))})]})]}),A.jsxs("label",{className:"check-row",children:[A.jsxs("span",{className:"check-row-left",children:[A.jsx("input",{type:"checkbox",checked:d.rimLight,onChange:()=>l(E=>({...E,rimLight:!E.rimLight}))}),A.jsx("span",{children:"Rim Backlight"})]}),A.jsx("input",{type:"color","aria-label":"Rim light color",value:d.rimColor,onChange:E=>l(K=>({...K,rimColor:E.target.value})),style:{width:24,height:18,border:0,padding:0,background:"transparent"}})]}),A.jsxs("div",{className:"field-row",children:[A.jsxs("div",{className:"field-label-row",children:[A.jsx("span",{children:"Shadow Hue Shift"}),A.jsxs("span",{className:"val",children:[d.shadowHueShift>0?`+${d.shadowHueShift}`:d.shadowHueShift,"°"]})]}),A.jsx("input",{type:"range",min:-45,max:45,value:d.shadowHueShift,onChange:E=>l(K=>({...K,shadowHueShift:Number(E.target.value)}))})]}),A.jsxs("div",{className:"field-row",children:[A.jsxs("div",{className:"field-label-row",children:[A.jsx("span",{children:"Contrast · Saturation"}),A.jsxs("span",{className:"val",children:[d.contrast.toFixed(2)," · ",d.saturation.toFixed(2)]})]}),A.jsxs("div",{className:"pill-grid cols-2",children:[A.jsx("input",{type:"range","aria-label":"Contrast",min:.6,max:1.6,step:.05,value:d.contrast,onChange:E=>l(K=>({...K,contrast:Number(E.target.value)}))}),A.jsx("input",{type:"range","aria-label":"Saturation",min:0,max:1.8,step:.05,value:d.saturation,onChange:E=>l(K=>({...K,saturation:Number(E.target.value)}))})]})]})]}),A.jsxs("section",{className:"panel-section",children:[A.jsxs("div",{className:"section-header",children:[A.jsx("span",{children:"04 · Export & Batch"}),A.jsxs("span",{className:"val",style:{fontFamily:"var(--font-mono)",color:"var(--text)"},children:[Ze.width,"×",Ze.height]})]}),A.jsxs("div",{className:"field-row",children:[A.jsxs("div",{className:"field-label-row",children:[A.jsx("span",{children:"Frames / Dir"}),A.jsx("span",{className:"val",children:d.frameCount})]}),A.jsx("div",{className:"pill-grid cols-6",children:[3,4,6,8,12,16].map(E=>A.jsx("button",{className:`pill-btn ${d.frameCount===E?"active":""}`,onClick:()=>l(K=>({...K,enginePreset:"custom",frameCount:E})),children:E},E))})]}),A.jsxs("div",{className:"field-row",children:[A.jsxs("div",{className:"field-label-row",children:[A.jsx("span",{children:"FPS & Layout"}),A.jsxs("span",{className:"val",children:[d.fps," FPS"]})]}),A.jsxs("div",{className:"pill-grid",children:[A.jsx("select",{className:"select-compact","aria-label":"Playback FPS",value:d.fps,onChange:E=>l(K=>({...K,fps:Number(E.target.value)})),children:[6,8,10,12,16].map(E=>A.jsxs("option",{value:E,children:[E," FPS"]},E))}),A.jsx("button",{className:`pill-btn ${d.layout==="grid"?"active":""}`,onClick:()=>l(E=>({...E,layout:"grid"})),children:"Grid"}),A.jsx("button",{className:`pill-btn ${d.layout==="strip"?"active":""}`,onClick:()=>l(E=>({...E,layout:"strip"})),children:"Strip"})]})]}),A.jsxs("div",{className:"export-checks",children:[A.jsxs("label",{className:"check-row",onClick:E=>{E.preventDefault(),ue("Multi-Clip Master Baking (all animations in one sheet) is included in PixelBake 3D Pro.")},children:[A.jsxs("span",{className:"check-row-left",children:[A.jsx("input",{type:"checkbox",checked:d.bakeAllClips,onChange:()=>{}}),A.jsxs("span",{children:["Bake All Clips (",v.length,")"]})]}),A.jsx("span",{className:"pro-tag",children:"PRO"})]}),[["albedoSheet","Albedo Sprite Sheet (.png)",!1],["normalSheet","Normal Map Sheet (.png)",!0],["animatedGif","Animated Loop (.gif)",!0],["godotTres","Godot 4 SpriteFrames (.tres)",!0],["unityAsepriteJson","Aseprite / Unity Atlas (.json)",!0],["phaserJson","Phaser / Pixi Atlas (.json)",!0],["framesZip","Individual Frames Folder",!0]].map(([E,K,oe])=>A.jsxs("label",{className:"check-row",onClick:me=>{oe&&!ua&&(me.preventDefault(),vl(E))},children:[A.jsxs("span",{className:"check-row-left",children:[A.jsx("input",{type:"checkbox",checked:d.exports[E],disabled:E==="albedoSheet",onChange:()=>vl(E)}),A.jsx("span",{children:K})]}),oe&&!ua?A.jsx("span",{className:"pro-tag",children:"PRO"}):null]},E))]})]})]}),A.jsx("main",{className:"stage-column",children:s==="sheet"?A.jsx(OS,{engine:se.current,animName:S,modelName:f,settings:d,activeSample:r,isCustomModel:g}):s==="arena"?A.jsx(V1,{engine:se.current,animations:v,settings:d,activeSample:r,isCustomModel:g}):A.jsxs(A.Fragment,{children:[A.jsxs("div",{className:"viewport-subbar",children:[A.jsxs("div",{className:"topbar-group",children:[A.jsx("div",{className:"segmented",role:"group","aria-label":"View mode",children:[["pixel","Pixel"],["split","Split 3D"],["normal","Normal"],["depth","Depth"]].map(([E,K])=>A.jsx("button",{className:U===E?"active":"",onClick:()=>Q(E),children:K},E))}),A.jsx("button",{className:`btn ${d.onionSkin?"btn-pro-cta":""}`,onClick:()=>l(E=>({...E,onionSkin:!E.onionSkin})),children:"Onion Skin"}),A.jsx("button",{className:`btn ${de?"btn-pro-cta":""}`,onClick:()=>ce(E=>!E),children:"# Grid"})]}),A.jsxs("div",{className:"topbar-group",children:[A.jsxs("select",{className:"select-compact","aria-label":"Stage background",value:F,onChange:E=>V(E.target.value),children:[A.jsx("option",{value:"checker",children:"BG: Checker"}),A.jsx("option",{value:"dark",children:"BG: Dark"}),A.jsx("option",{value:"light",children:"BG: Light"}),A.jsx("option",{value:"chroma",children:"BG: Green"})]}),A.jsx("div",{className:"segmented",role:"group","aria-label":"Preview zoom",children:[2,4,6].map(E=>A.jsxs("button",{className:X===E?"active":"",onClick:()=>le(E),children:[E,"×"]},E))})]})]}),A.jsxs("div",{className:`viewport-wrap bg-${F}`,onPointerDown:gl,onPointerMove:ca,onPointerUp:bi,onWheel:E=>{E.preventDefault(),l(K=>({...K,zoom:Math.max(.6,Math.min(2.2,Number((K.zoom-E.deltaY*.001).toFixed(2))))}))},children:[A.jsxs("div",{className:"hud-pill",children:[A.jsx("span",{className:"dot"}),A.jsxs("span",{children:[f," · ",d.resolution,"×",d.resolution,"px · ",$.length,"d×",d.frameCount,"f →"," ",Ze.width,"×",Ze.height,"px"]})]}),A.jsx("div",{className:"hud-hint",children:"Drag to orbit · Wheel to zoom · Drop .glb/.vrm/.fbx/.obj"}),ge?A.jsxs("div",{className:"status-toast",style:{borderColor:"var(--danger)"},children:["WebGL Error: ",ge]}):U==="split"?A.jsxs("div",{className:"split-stage",children:[A.jsxs("div",{className:"preview-frame",children:[A.jsx("span",{className:"preview-tag",children:"3D SOURCE"}),A.jsx("div",{className:"canvas-box",style:{width:qe,height:qe},children:A.jsx("canvas",{ref:I,className:"smooth-canvas",style:{width:qe,height:qe}})})]}),A.jsxs("div",{className:"preview-frame",children:[A.jsxs("span",{className:"preview-tag",children:["PIXEL OUTPUT (",d.resolution,"px)"]}),A.jsxs("div",{className:"canvas-box",style:{width:qe,height:qe},children:[A.jsx("canvas",{ref:Le,className:"pixel-canvas",style:{width:qe,height:qe}}),fa?A.jsx("div",{className:"pixel-grid-overlay",style:{backgroundImage:fa,backgroundSize:`${qe/d.resolution}px ${qe/d.resolution}px`}}):null]})]})]}):A.jsxs("div",{className:"preview-frame",children:[A.jsx("span",{className:"preview-tag",children:U==="normal"?`NORMAL MAP (${d.resolution}×${d.resolution}px)`:U==="depth"?`DEPTH BUFFER (${d.resolution}×${d.resolution}px)`:`${((Sl=$[L])==null?void 0:Sl.label.toUpperCase())??"FRONT"} · ${d.resolution}×${d.resolution}px`}),A.jsxs("div",{className:"canvas-box",style:{width:qe,height:qe},children:[d.onionSkin&&U==="pixel"?A.jsx("canvas",{ref:N,className:"pixel-canvas onion-canvas",style:{width:qe,height:qe}}):null,A.jsx("canvas",{ref:Le,className:"pixel-canvas",style:{width:qe,height:qe}}),fa?A.jsx("div",{className:"pixel-grid-overlay",style:{backgroundImage:fa,backgroundSize:`${qe/d.resolution}px ${qe/d.resolution}px`}}):null]})]}),he?A.jsx("div",{className:"drop-overlay",children:"Drop .GLB, .GLTF, .VRM, .FBX, or .OBJ to bake"}):null,Qe?A.jsx("div",{className:"status-toast",role:"status",children:Qe}):null]}),A.jsxs("section",{className:"dir-strip","aria-label":"Live direction strip",children:[A.jsxs("span",{className:"dir-strip-label",children:[$.length," DIRS"]}),$.map((E,K)=>A.jsxs("button",{className:`dir-card ${L===K?"active":""}`,onClick:()=>O(K),title:`Focus ${E.label.toUpperCase()} (${Math.round(E.yawDeg)}°)`,children:[A.jsx("canvas",{ref:oe=>{ne.current[K]=oe}}),A.jsx("span",{children:E.label})]},`${E.label}-${K}`))]})]})})]}),ee?A.jsx("div",{className:"modal-backdrop",onClick:()=>ue(null),children:A.jsxs("div",{className:"modal-card",onClick:E=>E.stopPropagation(),children:[A.jsxs("h2",{children:[A.jsx("span",{children:"PixelBake 3D Pro v2.0"}),A.jsx("span",{className:"brand-badge",children:"$9 ONE-TIME"})]}),A.jsx("p",{children:ee}),A.jsxs("ul",{className:"modal-list",children:[A.jsxs("li",{children:["HD Sprite Baking up to ",A.jsx("strong",{children:"96px, 128px, and 256px"})]}),A.jsxs("li",{children:[A.jsx("strong",{children:"Multi-Clip Master Bake"})," (pack Idle + Walk + Attack in 1 sheet)"]}),A.jsxs("li",{children:[A.jsx("strong",{children:"Normal Map"})," sheets pixel-aligned for 2D lighting"]}),A.jsxs("li",{children:["One-click ",A.jsx("strong",{children:"Godot 4 (.tres)"}),", ",A.jsx("strong",{children:"Unity / Aseprite (.json)"})," & ",A.jsx("strong",{children:"Phaser"})," atlases"]}),A.jsxs("li",{children:[A.jsx("strong",{children:"Single-File Offline App"})," (double-click HTML — zero install, Windows/Mac/Linux)"]})]}),A.jsxs("div",{className:"modal-actions",children:[A.jsx("button",{className:"btn",onClick:()=>ue(null),children:"Keep using Web Demo"}),A.jsx("a",{className:"btn btn-primary",href:X1,target:"_blank",rel:"noreferrer",children:"Get Pro ($9) ↗"})]})]})}):null]})}_1.createRoot(document.getElementById("root")).render(A.jsx(re.StrictMode,{children:A.jsx(US,{})}));