index-D3rZVjEB.js 1015 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. var iI=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ise=iI((Ar,Or)=>{function oI(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in e)){const l=Object.getOwnPropertyDescriptor(a,i);l&&Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>a[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))a(i);new MutationObserver(i=>{for(const l of i)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&a(u)}).observe(document,{childList:!0,subtree:!0});function n(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function a(i){if(i.ep)return;i.ep=!0;const l=n(i);fetch(i.href,l)}})();var Af=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ml(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $g={exports:{}},Qc={};var HN;function lI(){if(HN)return Qc;HN=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,i,l){var u=null;if(l!==void 0&&(u=""+l),i.key!==void 0&&(u=""+i.key),"key"in i){l={};for(var d in i)d!=="key"&&(l[d]=i[d])}else l=i;return i=l.ref,{$$typeof:e,type:a,key:u,ref:i!==void 0?i:null,props:l}}return Qc.Fragment=t,Qc.jsx=n,Qc.jsxs=n,Qc}var UN;function cI(){return UN||(UN=1,$g.exports=lI()),$g.exports}var o=cI(),Gg={exports:{}},pt={};var qN;function uI(){if(qN)return pt;qN=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),b=Symbol.iterator;function w(B){return B===null||typeof B!="object"?null:(B=b&&B[b]||B["@@iterator"],typeof B=="function"?B:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,j={};function N(B,G,X){this.props=B,this.context=G,this.refs=j,this.updater=X||C}N.prototype.isReactComponent={},N.prototype.setState=function(B,G){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,G,"setState")},N.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function _(){}_.prototype=N.prototype;function T(B,G,X){this.props=B,this.context=G,this.refs=j,this.updater=X||C}var A=T.prototype=new _;A.constructor=T,S(A,N.prototype),A.isPureReactComponent=!0;var D=Array.isArray;function L(){}var k={H:null,A:null,T:null,S:null},P=Object.prototype.hasOwnProperty;function U(B,G,X){var oe=X.ref;return{$$typeof:e,type:B,key:G,ref:oe!==void 0?oe:null,props:X}}function J(B,G){return U(B.type,G,B.props)}function $(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function W(B){var G={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(X){return G[X]})}var pe=/\/+/g;function Se(B,G){return typeof B=="object"&&B!==null&&B.key!=null?W(""+B.key):G.toString(36)}function Ce(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(L,L):(B.status="pending",B.then(function(G){B.status==="pending"&&(B.status="fulfilled",B.value=G)},function(G){B.status==="pending"&&(B.status="rejected",B.reason=G)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function I(B,G,X,oe,xe){var Q=typeof B;(Q==="undefined"||Q==="boolean")&&(B=null);var te=!1;if(B===null)te=!0;else switch(Q){case"bigint":case"string":case"number":te=!0;break;case"object":switch(B.$$typeof){case e:case t:te=!0;break;case v:return te=B._init,I(te(B._payload),G,X,oe,xe)}}if(te)return xe=xe(B),te=oe===""?"."+Se(B,0):oe,D(xe)?(X="",te!=null&&(X=te.replace(pe,"$&/")+"/"),I(xe,G,X,"",function(je){return je})):xe!=null&&($(xe)&&(xe=J(xe,X+(xe.key==null||B&&B.key===xe.key?"":(""+xe.key).replace(pe,"$&/")+"/")+te)),G.push(xe)),1;te=0;var he=oe===""?".":oe+":";if(D(B))for(var _e=0;_e<B.length;_e++)oe=B[_e],Q=he+Se(oe,_e),te+=I(oe,G,X,Q,xe);else if(_e=w(B),typeof _e=="function")for(B=_e.call(B),_e=0;!(oe=B.next()).done;)oe=oe.value,Q=he+Se(oe,_e++),te+=I(oe,G,X,Q,xe);else if(Q==="object"){if(typeof B.then=="function")return I(Ce(B),G,X,oe,xe);throw G=String(B),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return te}function q(B,G,X){if(B==null)return B;var oe=[],xe=0;return I(B,oe,"","",function(Q){return G.call(X,Q,xe++)}),oe}function H(B){if(B._status===-1){var G=B._result;G=G(),G.then(function(X){(B._status===0||B._status===-1)&&(B._status=1,B._result=X)},function(X){(B._status===0||B._status===-1)&&(B._status=2,B._result=X)}),B._status===-1&&(B._status=0,B._result=G)}if(B._status===1)return B._result.default;throw B._result}var be=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},Ne={map:q,forEach:function(B,G,X){q(B,function(){G.apply(this,arguments)},X)},count:function(B){var G=0;return q(B,function(){G++}),G},toArray:function(B){return q(B,function(G){return G})||[]},only:function(B){if(!$(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return pt.Activity=m,pt.Children=Ne,pt.Component=N,pt.Fragment=n,pt.Profiler=i,pt.PureComponent=T,pt.StrictMode=a,pt.Suspense=h,pt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=k,pt.__COMPILER_RUNTIME={__proto__:null,c:function(B){return k.H.useMemoCache(B)}},pt.cache=function(B){return function(){return B.apply(null,arguments)}},pt.cacheSignal=function(){return null},pt.cloneElement=function(B,G,X){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var oe=S({},B.props),xe=B.key;if(G!=null)for(Q in G.key!==void 0&&(xe=""+G.key),G)!P.call(G,Q)||Q==="key"||Q==="__self"||Q==="__source"||Q==="ref"&&G.ref===void 0||(oe[Q]=G[Q]);var Q=arguments.length-2;if(Q===1)oe.children=X;else if(1<Q){for(var te=Array(Q),he=0;he<Q;he++)te[he]=arguments[he+2];oe.children=te}return U(B.type,xe,oe)},pt.createContext=function(B){return B={$$typeof:u,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:l,_context:B},B},pt.createElement=function(B,G,X){var oe,xe={},Q=null;if(G!=null)for(oe in G.key!==void 0&&(Q=""+G.key),G)P.call(G,oe)&&oe!=="key"&&oe!=="__self"&&oe!=="__source"&&(xe[oe]=G[oe]);var te=arguments.length-2;if(te===1)xe.children=X;else if(1<te){for(var he=Array(te),_e=0;_e<te;_e++)he[_e]=arguments[_e+2];xe.children=he}if(B&&B.defaultProps)for(oe in te=B.defaultProps,te)xe[oe]===void 0&&(xe[oe]=te[oe]);return U(B,Q,xe)},pt.createRef=function(){return{current:null}},pt.forwardRef=function(B){return{$$typeof:d,render:B}},pt.isValidElement=$,pt.lazy=function(B){return{$$typeof:v,_payload:{_status:-1,_result:B},_init:H}},pt.memo=function(B,G){return{$$typeof:p,type:B,compare:G===void 0?null:G}},pt.startTransition=function(B){var G=k.T,X={};k.T=X;try{var oe=B(),xe=k.S;xe!==null&&xe(X,oe),typeof oe=="object"&&oe!==null&&typeof oe.then=="function"&&oe.then(L,be)}catch(Q){be(Q)}finally{G!==null&&X.types!==null&&(G.types=X.types),k.T=G}},pt.unstable_useCacheRefresh=function(){return k.H.useCacheRefresh()},pt.use=function(B){return k.H.use(B)},pt.useActionState=function(B,G,X){return k.H.useActionState(B,G,X)},pt.useCallback=function(B,G){return k.H.useCallback(B,G)},pt.useContext=function(B){return k.H.useContext(B)},pt.useDebugValue=function(){},pt.useDeferredValue=function(B,G){return k.H.useDeferredValue(B,G)},pt.useEffect=function(B,G){return k.H.useEffect(B,G)},pt.useEffectEvent=function(B){return k.H.useEffectEvent(B)},pt.useId=function(){return k.H.useId()},pt.useImperativeHandle=function(B,G,X){return k.H.useImperativeHandle(B,G,X)},pt.useInsertionEffect=function(B,G){return k.H.useInsertionEffect(B,G)},pt.useLayoutEffect=function(B,G){return k.H.useLayoutEffect(B,G)},pt.useMemo=function(B,G){return k.H.useMemo(B,G)},pt.useOptimistic=function(B,G){return k.H.useOptimistic(B,G)},pt.useReducer=function(B,G,X){return k.H.useReducer(B,G,X)},pt.useRef=function(B){return k.H.useRef(B)},pt.useState=function(B){return k.H.useState(B)},pt.useSyncExternalStore=function(B,G,X){return k.H.useSyncExternalStore(B,G,X)},pt.useTransition=function(){return k.H.useTransition()},pt.version="19.2.3",pt}var VN;function io(){return VN||(VN=1,Gg.exports=uI()),Gg.exports}var g=io();const R=Ml(g),K0=oI({__proto__:null,default:R},[g]);var Kg={exports:{}},Zc={},Yg={exports:{}},Wg={};var $N;function dI(){return $N||($N=1,(function(e){function t(I,q){var H=I.length;I.push(q);e:for(;0<H;){var be=H-1>>>1,Ne=I[be];if(0<i(Ne,q))I[be]=q,I[H]=Ne,H=be;else break e}}function n(I){return I.length===0?null:I[0]}function a(I){if(I.length===0)return null;var q=I[0],H=I.pop();if(H!==q){I[0]=H;e:for(var be=0,Ne=I.length,B=Ne>>>1;be<B;){var G=2*(be+1)-1,X=I[G],oe=G+1,xe=I[oe];if(0>i(X,H))oe<Ne&&0>i(xe,X)?(I[be]=xe,I[oe]=H,be=oe):(I[be]=X,I[G]=H,be=G);else if(oe<Ne&&0>i(xe,H))I[be]=xe,I[oe]=H,be=oe;else break e}}return q}function i(I,q){var H=I.sortIndex-q.sortIndex;return H!==0?H:I.id-q.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var h=[],p=[],v=1,m=null,b=3,w=!1,C=!1,S=!1,j=!1,N=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function A(I){for(var q=n(p);q!==null;){if(q.callback===null)a(p);else if(q.startTime<=I)a(p),q.sortIndex=q.expirationTime,t(h,q);else break;q=n(p)}}function D(I){if(S=!1,A(I),!C)if(n(h)!==null)C=!0,L||(L=!0,W());else{var q=n(p);q!==null&&Ce(D,q.startTime-I)}}var L=!1,k=-1,P=5,U=-1;function J(){return j?!0:!(e.unstable_now()-U<P)}function $(){if(j=!1,L){var I=e.unstable_now();U=I;var q=!0;try{e:{C=!1,S&&(S=!1,_(k),k=-1),w=!0;var H=b;try{t:{for(A(I),m=n(h);m!==null&&!(m.expirationTime>I&&J());){var be=m.callback;if(typeof be=="function"){m.callback=null,b=m.priorityLevel;var Ne=be(m.expirationTime<=I);if(I=e.unstable_now(),typeof Ne=="function"){m.callback=Ne,A(I),q=!0;break t}m===n(h)&&a(h),A(I)}else a(h);m=n(h)}if(m!==null)q=!0;else{var B=n(p);B!==null&&Ce(D,B.startTime-I),q=!1}}break e}finally{m=null,b=H,w=!1}q=void 0}}finally{q?W():L=!1}}}var W;if(typeof T=="function")W=function(){T($)};else if(typeof MessageChannel<"u"){var pe=new MessageChannel,Se=pe.port2;pe.port1.onmessage=$,W=function(){Se.postMessage(null)}}else W=function(){N($,0)};function Ce(I,q){k=N(function(){I(e.unstable_now())},q)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(I){I.callback=null},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(I){switch(b){case 1:case 2:case 3:var q=3;break;default:q=b}var H=b;b=q;try{return I()}finally{b=H}},e.unstable_requestPaint=function(){j=!0},e.unstable_runWithPriority=function(I,q){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var H=b;b=I;try{return q()}finally{b=H}},e.unstable_scheduleCallback=function(I,q,H){var be=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?be+H:be):H=be,I){case 1:var Ne=-1;break;case 2:Ne=250;break;case 5:Ne=1073741823;break;case 4:Ne=1e4;break;default:Ne=5e3}return Ne=H+Ne,I={id:v++,callback:q,priorityLevel:I,startTime:H,expirationTime:Ne,sortIndex:-1},H>be?(I.sortIndex=H,t(p,I),n(h)===null&&I===n(p)&&(S?(_(k),k=-1):S=!0,Ce(D,H-be))):(I.sortIndex=Ne,t(h,I),C||w||(C=!0,L||(L=!0,W()))),I},e.unstable_shouldYield=J,e.unstable_wrapCallback=function(I){var q=b;return function(){var H=b;b=q;try{return I.apply(this,arguments)}finally{b=H}}}})(Wg)),Wg}var GN;function fI(){return GN||(GN=1,Yg.exports=dI()),Yg.exports}var Xg={exports:{}},Gn={};var KN;function hI(){if(KN)return Gn;KN=1;var e=io();function t(h){var p="https://react.dev/errors/"+h;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)p+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+h+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function l(h,p,v){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:m==null?null:""+m,children:h,containerInfo:p,implementation:v}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(h,p){if(h==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Gn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Gn.createPortal=function(h,p){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return l(h,p,null,v)},Gn.flushSync=function(h){var p=u.T,v=a.p;try{if(u.T=null,a.p=2,h)return h()}finally{u.T=p,a.p=v,a.d.f()}},Gn.preconnect=function(h,p){typeof h=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,a.d.C(h,p))},Gn.prefetchDNS=function(h){typeof h=="string"&&a.d.D(h)},Gn.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var v=p.as,m=d(v,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,w=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;v==="style"?a.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:m,integrity:b,fetchPriority:w}):v==="script"&&a.d.X(h,{crossOrigin:m,integrity:b,fetchPriority:w,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Gn.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var v=d(p.as,p.crossOrigin);a.d.M(h,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&a.d.M(h)},Gn.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var v=p.as,m=d(v,p.crossOrigin);a.d.L(h,v,{crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Gn.preloadModule=function(h,p){if(typeof h=="string")if(p){var v=d(p.as,p.crossOrigin);a.d.m(h,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else a.d.m(h)},Gn.requestFormReset=function(h){a.d.r(h)},Gn.unstable_batchedUpdates=function(h,p){return h(p)},Gn.useFormState=function(h,p,v){return u.H.useFormState(h,p,v)},Gn.useFormStatus=function(){return u.H.useHostTransitionStatus()},Gn.version="19.2.3",Gn}var YN;function _O(){if(YN)return Xg.exports;YN=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Xg.exports=hI(),Xg.exports}var WN;function pI(){if(WN)return Zc;WN=1;var e=fI(),t=io(),n=_O();function a(r){var s="https://react.dev/errors/"+r;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)s+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+r+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function l(r){var s=r,c=r;if(r.alternate)for(;s.return;)s=s.return;else{r=s;do s=r,(s.flags&4098)!==0&&(c=s.return),r=s.return;while(r)}return s.tag===3?c:null}function u(r){if(r.tag===13){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function d(r){if(r.tag===31){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function h(r){if(l(r)!==r)throw Error(a(188))}function p(r){var s=r.alternate;if(!s){if(s=l(r),s===null)throw Error(a(188));return s!==r?null:r}for(var c=r,f=s;;){var x=c.return;if(x===null)break;var y=x.alternate;if(y===null){if(f=x.return,f!==null){c=f;continue}break}if(x.child===y.child){for(y=x.child;y;){if(y===c)return h(x),r;if(y===f)return h(x),s;y=y.sibling}throw Error(a(188))}if(c.return!==f.return)c=x,f=y;else{for(var E=!1,M=x.child;M;){if(M===c){E=!0,c=x,f=y;break}if(M===f){E=!0,f=x,c=y;break}M=M.sibling}if(!E){for(M=y.child;M;){if(M===c){E=!0,c=y,f=x;break}if(M===f){E=!0,f=y,c=x;break}M=M.sibling}if(!E)throw Error(a(189))}}if(c.alternate!==f)throw Error(a(190))}if(c.tag!==3)throw Error(a(188));return c.stateNode.current===c?r:s}function v(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r;for(r=r.child;r!==null;){if(s=v(r),s!==null)return s;r=r.sibling}return null}var m=Object.assign,b=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),T=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),J=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function W(r){return r===null||typeof r!="object"?null:(r=$&&r[$]||r["@@iterator"],typeof r=="function"?r:null)}var pe=Symbol.for("react.client.reference");function Se(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===pe?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case S:return"Fragment";case N:return"Profiler";case j:return"StrictMode";case D:return"Suspense";case L:return"SuspenseList";case U:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case C:return"Portal";case T:return r.displayName||"Context";case _:return(r._context.displayName||"Context")+".Consumer";case A:var s=r.render;return r=r.displayName,r||(r=s.displayName||s.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case k:return s=r.displayName||null,s!==null?s:Se(r.type)||"Memo";case P:s=r._payload,r=r._init;try{return Se(r(s))}catch{}}return null}var Ce=Array.isArray,I=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H={pending:!1,data:null,method:null,action:null},be=[],Ne=-1;function B(r){return{current:r}}function G(r){0>Ne||(r.current=be[Ne],be[Ne]=null,Ne--)}function X(r,s){Ne++,be[Ne]=r.current,r.current=s}var oe=B(null),xe=B(null),Q=B(null),te=B(null);function he(r,s){switch(X(Q,s),X(xe,r),X(oe,null),s.nodeType){case 9:case 11:r=(r=s.documentElement)&&(r=r.namespaceURI)?uN(r):0;break;default:if(r=s.tagName,s=s.namespaceURI)s=uN(s),r=dN(s,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}G(oe),X(oe,r)}function _e(){G(oe),G(xe),G(Q)}function je(r){r.memoizedState!==null&&X(te,r);var s=oe.current,c=dN(s,r.type);s!==c&&(X(xe,r),X(oe,c))}function Me(r){xe.current===r&&(G(oe),G(xe)),te.current===r&&(G(te),Kc._currentValue=H)}var ce,He;function Le(r){if(ce===void 0)try{throw Error()}catch(c){var s=c.stack.trim().match(/\n( *(at )?)/);ce=s&&s[1]||"",He=-1<c.stack.indexOf(`
  2. at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
  3. `+ce+r+He}var Ue=!1;function wt(r,s){if(!r||Ue)return"";Ue=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(s){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(le){var ie=le}Reflect.construct(r,[],ye)}else{try{ye.call()}catch(le){ie=le}r.call(ye.prototype)}}else{try{throw Error()}catch(le){ie=le}(ye=r())&&typeof ye.catch=="function"&&ye.catch(function(){})}}catch(le){if(le&&ie&&typeof le.stack=="string")return[le.stack,ie.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=f.DetermineComponentFrameRoot(),E=y[0],M=y[1];if(E&&M){var F=E.split(`
  4. `),ae=M.split(`
  5. `);for(x=f=0;f<F.length&&!F[f].includes("DetermineComponentFrameRoot");)f++;for(;x<ae.length&&!ae[x].includes("DetermineComponentFrameRoot");)x++;if(f===F.length||x===ae.length)for(f=F.length-1,x=ae.length-1;1<=f&&0<=x&&F[f]!==ae[x];)x--;for(;1<=f&&0<=x;f--,x--)if(F[f]!==ae[x]){if(f!==1||x!==1)do if(f--,x--,0>x||F[f]!==ae[x]){var ge=`
  6. `+F[f].replace(" at new "," at ");return r.displayName&&ge.includes("<anonymous>")&&(ge=ge.replace("<anonymous>",r.displayName)),ge}while(1<=f&&0<=x);break}}}finally{Ue=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?Le(c):""}function $e(r,s){switch(r.tag){case 26:case 27:case 5:return Le(r.type);case 16:return Le("Lazy");case 13:return r.child!==s&&s!==null?Le("Suspense Fallback"):Le("Suspense");case 19:return Le("SuspenseList");case 0:case 15:return wt(r.type,!1);case 11:return wt(r.type.render,!1);case 1:return wt(r.type,!0);case 31:return Le("Activity");default:return""}}function Ot(r){try{var s="",c=null;do s+=$e(r,c),c=r,r=r.return;while(r);return s}catch(f){return`
  7. Error generating stack: `+f.message+`
  8. `+f.stack}}var St=Object.prototype.hasOwnProperty,Et=e.unstable_scheduleCallback,jt=e.unstable_cancelCallback,ot=e.unstable_shouldYield,at=e.unstable_requestPaint,vt=e.unstable_now,Kt=e.unstable_getCurrentPriorityLevel,Yt=e.unstable_ImmediatePriority,Wt=e.unstable_UserBlockingPriority,ne=e.unstable_NormalPriority,Re=e.unstable_LowPriority,st=e.unstable_IdlePriority,et=e.log,xt=e.unstable_setDisableYieldValue,mt=null,gt=null;function qt(r){if(typeof et=="function"&&xt(r),gt&&typeof gt.setStrictMode=="function")try{gt.setStrictMode(mt,r)}catch{}}var ue=Math.clz32?Math.clz32:Xe,Te=Math.log,De=Math.LN2;function Xe(r){return r>>>=0,r===0?32:31-(Te(r)/De|0)|0}var Oe=256,Qe=262144,dt=4194304;function ht(r){var s=r&42;if(s!==0)return s;switch(r&-r){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 r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function z(r,s,c){var f=r.pendingLanes;if(f===0)return 0;var x=0,y=r.suspendedLanes,E=r.pingedLanes;r=r.warmLanes;var M=f&134217727;return M!==0?(f=M&~y,f!==0?x=ht(f):(E&=M,E!==0?x=ht(E):c||(c=M&~r,c!==0&&(x=ht(c))))):(M=f&~y,M!==0?x=ht(M):E!==0?x=ht(E):c||(c=f&~r,c!==0&&(x=ht(c)))),x===0?0:s!==0&&s!==x&&(s&y)===0&&(y=x&-x,c=s&-s,y>=c||y===32&&(c&4194048)!==0)?s:x}function O(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function de(r,s){switch(r){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function me(){var r=dt;return dt<<=1,(dt&62914560)===0&&(dt=4194304),r}function Ge(r){for(var s=[],c=0;31>c;c++)s.push(r);return s}function Ie(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function tt(r,s,c,f,x,y){var E=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var M=r.entanglements,F=r.expirationTimes,ae=r.hiddenUpdates;for(c=E&~c;0<c;){var ge=31-ue(c),ye=1<<ge;M[ge]=0,F[ge]=-1;var ie=ae[ge];if(ie!==null)for(ae[ge]=null,ge=0;ge<ie.length;ge++){var le=ie[ge];le!==null&&(le.lane&=-536870913)}c&=~ye}f!==0&&It(r,f,0),y!==0&&x===0&&r.tag!==0&&(r.suspendedLanes|=y&~(E&~s))}function It(r,s,c){r.pendingLanes|=s,r.suspendedLanes&=~s;var f=31-ue(s);r.entangledLanes|=s,r.entanglements[f]=r.entanglements[f]|1073741824|c&261930}function Y(r,s){var c=r.entangledLanes|=s;for(r=r.entanglements;c;){var f=31-ue(c),x=1<<f;x&s|r[f]&s&&(r[f]|=s),c&=~x}}function we(r,s){var c=s&-s;return c=(c&42)!==0?1:Pe(c),(c&(r.suspendedLanes|s))!==0?0:c}function Pe(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function ke(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function ze(){var r=q.p;return r!==0?r:(r=window.event,r===void 0?32:PN(r.type))}function ct(r,s){var c=q.p;try{return q.p=r,s()}finally{q.p=c}}var Nt=Math.random().toString(36).slice(2),Tt="__reactFiber$"+Nt,it="__reactProps$"+Nt,zt="__reactContainer$"+Nt,Zn="__reactEvents$"+Nt,Na="__reactListeners$"+Nt,Ti="__reactHandles$"+Nt,Ds="__reactResources$"+Nt,Ka="__reactMarker$"+Nt;function Jl(r){delete r[Tt],delete r[it],delete r[Zn],delete r[Na],delete r[Ti]}function Ya(r){var s=r[Tt];if(s)return s;for(var c=r.parentNode;c;){if(s=c[zt]||c[Tt]){if(c=s.alternate,s.child!==null||c!==null&&c.child!==null)for(r=xN(r);r!==null;){if(c=r[Tt])return c;r=xN(r)}return s}r=c,c=r.parentNode}return null}function Ps(r){if(r=r[Tt]||r[zt]){var s=r.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return r}return null}function ks(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r.stateNode;throw Error(a(33))}function Wa(r){var s=r[Ds];return s||(s=r[Ds]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function xn(r){r[Ka]=!0}var ec=new Set,tc={};function Xa(r,s){ar(r,s),ar(r+"Capture",s)}function ar(r,s){for(tc[r]=s,r=0;r<s.length;r++)ec.add(s[r])}var hd=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),pd={},md={};function gd(r){return St.call(md,r)?!0:St.call(pd,r)?!1:hd.test(r)?md[r]=!0:(pd[r]=!0,!1)}function Ls(r,s,c){if(gd(s))if(c===null)r.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":r.removeAttribute(s);return;case"boolean":var f=s.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){r.removeAttribute(s);return}}r.setAttribute(s,""+c)}}function Bs(r,s,c){if(c===null)r.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(s);return}r.setAttribute(s,""+c)}}function sr(r,s,c,f){if(f===null)r.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(c);return}r.setAttributeNS(s,c,""+f)}}function tn(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function vd(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function nc(r,s,c){var f=Object.getOwnPropertyDescriptor(r.constructor.prototype,s);if(!r.hasOwnProperty(s)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var x=f.get,y=f.set;return Object.defineProperty(r,s,{configurable:!0,get:function(){return x.call(this)},set:function(E){c=""+E,y.call(this,E)}}),Object.defineProperty(r,s,{enumerable:f.enumerable}),{getValue:function(){return c},setValue:function(E){c=""+E},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function ir(r){if(!r._valueTracker){var s=vd(r)?"checked":"value";r._valueTracker=nc(r,s,""+r[s])}}function Qa(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var c=s.getValue(),f="";return r&&(f=vd(r)?r.checked?"true":"false":r.value),r=f,r!==c?(s.setValue(r),!0):!1}function $n(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var xd=/[\n"\\]/g;function Jn(r){return r.replace(xd,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function rc(r,s,c,f,x,y,E,M){r.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?r.type=E:r.removeAttribute("type"),s!=null?E==="number"?(s===0&&r.value===""||r.value!=s)&&(r.value=""+tn(s)):r.value!==""+tn(s)&&(r.value=""+tn(s)):E!=="submit"&&E!=="reset"||r.removeAttribute("value"),s!=null?ac(r,E,tn(s)):c!=null?ac(r,E,tn(c)):f!=null&&r.removeAttribute("value"),x==null&&y!=null&&(r.defaultChecked=!!y),x!=null&&(r.checked=x&&typeof x!="function"&&typeof x!="symbol"),M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?r.name=""+tn(M):r.removeAttribute("name")}function yd(r,s,c,f,x,y,E,M){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(r.type=y),s!=null||c!=null){if(!(y!=="submit"&&y!=="reset"||s!=null)){ir(r);return}c=c!=null?""+tn(c):"",s=s!=null?""+tn(s):c,M||s===r.value||(r.value=s),r.defaultValue=s}f=f??x,f=typeof f!="function"&&typeof f!="symbol"&&!!f,r.checked=M?r.checked:!!f,r.defaultChecked=!!f,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(r.name=E),ir(r)}function ac(r,s,c){s==="number"&&$n(r.ownerDocument)===r||r.defaultValue===""+c||(r.defaultValue=""+c)}function Is(r,s,c,f){if(r=r.options,s){s={};for(var x=0;x<c.length;x++)s["$"+c[x]]=!0;for(c=0;c<r.length;c++)x=s.hasOwnProperty("$"+r[c].value),r[c].selected!==x&&(r[c].selected=x),x&&f&&(r[c].defaultSelected=!0)}else{for(c=""+tn(c),s=null,x=0;x<r.length;x++){if(r[x].value===c){r[x].selected=!0,f&&(r[x].defaultSelected=!0);return}s!==null||r[x].disabled||(s=r[x])}s!==null&&(s.selected=!0)}}function Ri(r,s,c){if(s!=null&&(s=""+tn(s),s!==r.value&&(r.value=s),c==null)){r.defaultValue!==s&&(r.defaultValue=s);return}r.defaultValue=c!=null?""+tn(c):""}function sc(r,s,c,f){if(s==null){if(f!=null){if(c!=null)throw Error(a(92));if(Ce(f)){if(1<f.length)throw Error(a(93));f=f[0]}c=f}c==null&&(c=""),s=c}c=tn(s),r.defaultValue=c,f=r.textContent,f===c&&f!==""&&f!==null&&(r.value=f),ir(r)}function _a(r,s){if(s){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=s;return}}r.textContent=s}var ic=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function bd(r,s,c){var f=s.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?f?r.setProperty(s,""):s==="float"?r.cssFloat="":r[s]="":f?r.setProperty(s,c):typeof c!="number"||c===0||ic.has(s)?s==="float"?r.cssFloat=c:r[s]=(""+c).trim():r[s]=c+"px"}function oc(r,s,c){if(s!=null&&typeof s!="object")throw Error(a(62));if(r=r.style,c!=null){for(var f in c)!c.hasOwnProperty(f)||s!=null&&s.hasOwnProperty(f)||(f.indexOf("--")===0?r.setProperty(f,""):f==="float"?r.cssFloat="":r[f]="");for(var x in s)f=s[x],s.hasOwnProperty(x)&&c[x]!==f&&bd(r,x,f)}else for(var y in s)s.hasOwnProperty(y)&&bd(r,y,s[y])}function ee(r){if(r.indexOf("-")===-1)return!1;switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ee=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),_t=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Mt(r){return _t.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function kt(){}var _n=null;function fn(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var an=null,ta=null;function lc(r){var s=Ps(r);if(s&&(r=s.stateNode)){var c=r[it]||null;e:switch(r=s.stateNode,s.type){case"input":if(rc(r,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),s=c.name,c.type==="radio"&&s!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Jn(""+s)+'"][type="radio"]'),s=0;s<c.length;s++){var f=c[s];if(f!==r&&f.form===r.form){var x=f[it]||null;if(!x)throw Error(a(90));rc(f,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(s=0;s<c.length;s++)f=c[s],f.form===r.form&&Qa(f)}break e;case"textarea":Ri(r,c.value,c.defaultValue);break e;case"select":s=c.value,s!=null&&Is(r,!!c.multiple,s,!1)}}}var cc=!1;function u1(r,s,c){if(cc)return r(s,c);cc=!0;try{var f=r(s);return f}finally{if(cc=!1,(an!==null||ta!==null)&&(lf(),an&&(s=an,r=ta,ta=an=null,lc(s),r)))for(s=0;s<r.length;s++)lc(r[s])}}function uc(r,s){var c=r.stateNode;if(c===null)return null;var f=c[it]||null;if(f===null)return null;c=f[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(r=r.type,f=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!f;break e;default:r=!1}if(r)return null;if(c&&typeof c!="function")throw Error(a(231,s,typeof c));return c}var Za=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$p=!1;if(Za)try{var dc={};Object.defineProperty(dc,"passive",{get:function(){$p=!0}}),window.addEventListener("test",dc,dc),window.removeEventListener("test",dc,dc)}catch{$p=!1}var zs=null,Gp=null,wd=null;function d1(){if(wd)return wd;var r,s=Gp,c=s.length,f,x="value"in zs?zs.value:zs.textContent,y=x.length;for(r=0;r<c&&s[r]===x[r];r++);var E=c-r;for(f=1;f<=E&&s[c-f]===x[y-f];f++);return wd=x.slice(r,1<f?1-f:void 0)}function Sd(r){var s=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&s===13&&(r=13)):r=s,r===10&&(r=13),32<=r||r===13?r:0}function Cd(){return!0}function f1(){return!1}function or(r){function s(c,f,x,y,E){this._reactName=c,this._targetInst=x,this.type=f,this.nativeEvent=y,this.target=E,this.currentTarget=null;for(var M in r)r.hasOwnProperty(M)&&(c=r[M],this[M]=c?c(y):y[M]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?Cd:f1,this.isPropagationStopped=f1,this}return m(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Cd)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Cd)},persist:function(){},isPersistent:Cd}),s}var Ai={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},jd=or(Ai),fc=m({},Ai,{view:0,detail:0}),a4=or(fc),Kp,Yp,hc,Nd=m({},fc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xp,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==hc&&(hc&&r.type==="mousemove"?(Kp=r.screenX-hc.screenX,Yp=r.screenY-hc.screenY):Yp=Kp=0,hc=r),Kp)},movementY:function(r){return"movementY"in r?r.movementY:Yp}}),h1=or(Nd),s4=m({},Nd,{dataTransfer:0}),i4=or(s4),o4=m({},fc,{relatedTarget:0}),Wp=or(o4),l4=m({},Ai,{animationName:0,elapsedTime:0,pseudoElement:0}),c4=or(l4),u4=m({},Ai,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),d4=or(u4),f4=m({},Ai,{data:0}),p1=or(f4),h4={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},p4={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},m4={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function g4(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=m4[r])?!!s[r]:!1}function Xp(){return g4}var v4=m({},fc,{key:function(r){if(r.key){var s=h4[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=Sd(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?p4[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xp,charCode:function(r){return r.type==="keypress"?Sd(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Sd(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),x4=or(v4),y4=m({},Nd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),m1=or(y4),b4=m({},fc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xp}),w4=or(b4),S4=m({},Ai,{propertyName:0,elapsedTime:0,pseudoElement:0}),C4=or(S4),j4=m({},Nd,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),N4=or(j4),_4=m({},Ai,{newState:0,oldState:0}),E4=or(_4),T4=[9,13,27,32],Qp=Za&&"CompositionEvent"in window,pc=null;Za&&"documentMode"in document&&(pc=document.documentMode);var R4=Za&&"TextEvent"in window&&!pc,g1=Za&&(!Qp||pc&&8<pc&&11>=pc),v1=" ",x1=!1;function y1(r,s){switch(r){case"keyup":return T4.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function b1(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var go=!1;function A4(r,s){switch(r){case"compositionend":return b1(s);case"keypress":return s.which!==32?null:(x1=!0,v1);case"textInput":return r=s.data,r===v1&&x1?null:r;default:return null}}function O4(r,s){if(go)return r==="compositionend"||!Qp&&y1(r,s)?(r=d1(),wd=Gp=zs=null,go=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return g1&&s.locale!=="ko"?null:s.data;default:return null}}var M4={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function w1(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!M4[r.type]:s==="textarea"}function S1(r,s,c,f){an?ta?ta.push(f):ta=[f]:an=f,s=mf(s,"onChange"),0<s.length&&(c=new jd("onChange","change",null,c,f),r.push({event:c,listeners:s}))}var mc=null,gc=null;function D4(r){aN(r,0)}function _d(r){var s=ks(r);if(Qa(s))return r}function C1(r,s){if(r==="change")return s}var j1=!1;if(Za){var Zp;if(Za){var Jp="oninput"in document;if(!Jp){var N1=document.createElement("div");N1.setAttribute("oninput","return;"),Jp=typeof N1.oninput=="function"}Zp=Jp}else Zp=!1;j1=Zp&&(!document.documentMode||9<document.documentMode)}function _1(){mc&&(mc.detachEvent("onpropertychange",E1),gc=mc=null)}function E1(r){if(r.propertyName==="value"&&_d(gc)){var s=[];S1(s,gc,r,fn(r)),u1(D4,s)}}function P4(r,s,c){r==="focusin"?(_1(),mc=s,gc=c,mc.attachEvent("onpropertychange",E1)):r==="focusout"&&_1()}function k4(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return _d(gc)}function L4(r,s){if(r==="click")return _d(s)}function B4(r,s){if(r==="input"||r==="change")return _d(s)}function I4(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var br=typeof Object.is=="function"?Object.is:I4;function vc(r,s){if(br(r,s))return!0;if(typeof r!="object"||r===null||typeof s!="object"||s===null)return!1;var c=Object.keys(r),f=Object.keys(s);if(c.length!==f.length)return!1;for(f=0;f<c.length;f++){var x=c[f];if(!St.call(s,x)||!br(r[x],s[x]))return!1}return!0}function T1(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function R1(r,s){var c=T1(r);r=0;for(var f;c;){if(c.nodeType===3){if(f=r+c.textContent.length,r<=s&&f>=s)return{node:c,offset:s-r};r=f}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=T1(c)}}function A1(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?A1(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function O1(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=$n(r.document);s instanceof r.HTMLIFrameElement;){try{var c=typeof s.contentWindow.location.href=="string"}catch{c=!1}if(c)r=s.contentWindow;else break;s=$n(r.document)}return s}function em(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}var z4=Za&&"documentMode"in document&&11>=document.documentMode,vo=null,tm=null,xc=null,nm=!1;function M1(r,s,c){var f=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;nm||vo==null||vo!==$n(f)||(f=vo,"selectionStart"in f&&em(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),xc&&vc(xc,f)||(xc=f,f=mf(tm,"onSelect"),0<f.length&&(s=new jd("onSelect","select",null,s,c),r.push({event:s,listeners:f}),s.target=vo)))}function Oi(r,s){var c={};return c[r.toLowerCase()]=s.toLowerCase(),c["Webkit"+r]="webkit"+s,c["Moz"+r]="moz"+s,c}var xo={animationend:Oi("Animation","AnimationEnd"),animationiteration:Oi("Animation","AnimationIteration"),animationstart:Oi("Animation","AnimationStart"),transitionrun:Oi("Transition","TransitionRun"),transitionstart:Oi("Transition","TransitionStart"),transitioncancel:Oi("Transition","TransitionCancel"),transitionend:Oi("Transition","TransitionEnd")},rm={},D1={};Za&&(D1=document.createElement("div").style,"AnimationEvent"in window||(delete xo.animationend.animation,delete xo.animationiteration.animation,delete xo.animationstart.animation),"TransitionEvent"in window||delete xo.transitionend.transition);function Mi(r){if(rm[r])return rm[r];if(!xo[r])return r;var s=xo[r],c;for(c in s)if(s.hasOwnProperty(c)&&c in D1)return rm[r]=s[c];return r}var P1=Mi("animationend"),k1=Mi("animationiteration"),L1=Mi("animationstart"),F4=Mi("transitionrun"),H4=Mi("transitionstart"),U4=Mi("transitioncancel"),B1=Mi("transitionend"),I1=new Map,am="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");am.push("scrollEnd");function na(r,s){I1.set(r,s),Xa(s,[r])}var Ed=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},Br=[],yo=0,sm=0;function Td(){for(var r=yo,s=sm=yo=0;s<r;){var c=Br[s];Br[s++]=null;var f=Br[s];Br[s++]=null;var x=Br[s];Br[s++]=null;var y=Br[s];if(Br[s++]=null,f!==null&&x!==null){var E=f.pending;E===null?x.next=x:(x.next=E.next,E.next=x),f.pending=x}y!==0&&z1(c,x,y)}}function Rd(r,s,c,f){Br[yo++]=r,Br[yo++]=s,Br[yo++]=c,Br[yo++]=f,sm|=f,r.lanes|=f,r=r.alternate,r!==null&&(r.lanes|=f)}function im(r,s,c,f){return Rd(r,s,c,f),Ad(r)}function Di(r,s){return Rd(r,null,null,s),Ad(r)}function z1(r,s,c){r.lanes|=c;var f=r.alternate;f!==null&&(f.lanes|=c);for(var x=!1,y=r.return;y!==null;)y.childLanes|=c,f=y.alternate,f!==null&&(f.childLanes|=c),y.tag===22&&(r=y.stateNode,r===null||r._visibility&1||(x=!0)),r=y,y=y.return;return r.tag===3?(y=r.stateNode,x&&s!==null&&(x=31-ue(c),r=y.hiddenUpdates,f=r[x],f===null?r[x]=[s]:f.push(s),s.lane=c|536870912),y):null}function Ad(r){if(50<Fc)throw Fc=0,mg=null,Error(a(185));for(var s=r.return;s!==null;)r=s,s=r.return;return r.tag===3?r.stateNode:null}var bo={};function q4(r,s,c,f){this.tag=r,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wr(r,s,c,f){return new q4(r,s,c,f)}function om(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Ja(r,s){var c=r.alternate;return c===null?(c=wr(r.tag,s,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=s,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&65011712,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,s=r.dependencies,c.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c.refCleanup=r.refCleanup,c}function F1(r,s){r.flags&=65011714;var c=r.alternate;return c===null?(r.childLanes=0,r.lanes=s,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=c.childLanes,r.lanes=c.lanes,r.child=c.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=c.memoizedProps,r.memoizedState=c.memoizedState,r.updateQueue=c.updateQueue,r.type=c.type,s=c.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),r}function Od(r,s,c,f,x,y){var E=0;if(f=r,typeof r=="function")om(r)&&(E=1);else if(typeof r=="string")E=YB(r,c,oe.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case U:return r=wr(31,c,s,x),r.elementType=U,r.lanes=y,r;case S:return Pi(c.children,x,y,s);case j:E=8,x|=24;break;case N:return r=wr(12,c,s,x|2),r.elementType=N,r.lanes=y,r;case D:return r=wr(13,c,s,x),r.elementType=D,r.lanes=y,r;case L:return r=wr(19,c,s,x),r.elementType=L,r.lanes=y,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case T:E=10;break e;case _:E=9;break e;case A:E=11;break e;case k:E=14;break e;case P:E=16,f=null;break e}E=29,c=Error(a(130,r===null?"null":typeof r,"")),f=null}return s=wr(E,c,s,x),s.elementType=r,s.type=f,s.lanes=y,s}function Pi(r,s,c,f){return r=wr(7,r,f,s),r.lanes=c,r}function lm(r,s,c){return r=wr(6,r,null,s),r.lanes=c,r}function H1(r){var s=wr(18,null,null,0);return s.stateNode=r,s}function cm(r,s,c){return s=wr(4,r.children!==null?r.children:[],r.key,s),s.lanes=c,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}var U1=new WeakMap;function Ir(r,s){if(typeof r=="object"&&r!==null){var c=U1.get(r);return c!==void 0?c:(s={value:r,source:s,stack:Ot(s)},U1.set(r,s),s)}return{value:r,source:s,stack:Ot(s)}}var wo=[],So=0,Md=null,yc=0,zr=[],Fr=0,Fs=null,Ea=1,Ta="";function es(r,s){wo[So++]=yc,wo[So++]=Md,Md=r,yc=s}function q1(r,s,c){zr[Fr++]=Ea,zr[Fr++]=Ta,zr[Fr++]=Fs,Fs=r;var f=Ea;r=Ta;var x=32-ue(f)-1;f&=~(1<<x),c+=1;var y=32-ue(s)+x;if(30<y){var E=x-x%5;y=(f&(1<<E)-1).toString(32),f>>=E,x-=E,Ea=1<<32-ue(s)+x|c<<x|f,Ta=y+r}else Ea=1<<y|c<<x|f,Ta=r}function um(r){r.return!==null&&(es(r,1),q1(r,1,0))}function dm(r){for(;r===Md;)Md=wo[--So],wo[So]=null,yc=wo[--So],wo[So]=null;for(;r===Fs;)Fs=zr[--Fr],zr[Fr]=null,Ta=zr[--Fr],zr[Fr]=null,Ea=zr[--Fr],zr[Fr]=null}function V1(r,s){zr[Fr++]=Ea,zr[Fr++]=Ta,zr[Fr++]=Fs,Ea=s.id,Ta=s.overflow,Fs=r}var Ln=null,sn=null,Ft=!1,Hs=null,Hr=!1,fm=Error(a(519));function Us(r){var s=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw bc(Ir(s,r)),fm}function $1(r){var s=r.stateNode,c=r.type,f=r.memoizedProps;switch(s[Tt]=r,s[it]=f,c){case"dialog":Pt("cancel",s),Pt("close",s);break;case"iframe":case"object":case"embed":Pt("load",s);break;case"video":case"audio":for(c=0;c<Uc.length;c++)Pt(Uc[c],s);break;case"source":Pt("error",s);break;case"img":case"image":case"link":Pt("error",s),Pt("load",s);break;case"details":Pt("toggle",s);break;case"input":Pt("invalid",s),yd(s,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":Pt("invalid",s);break;case"textarea":Pt("invalid",s),sc(s,f.value,f.defaultValue,f.children)}c=f.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||s.textContent===""+c||f.suppressHydrationWarning===!0||lN(s.textContent,c)?(f.popover!=null&&(Pt("beforetoggle",s),Pt("toggle",s)),f.onScroll!=null&&Pt("scroll",s),f.onScrollEnd!=null&&Pt("scrollend",s),f.onClick!=null&&(s.onclick=kt),s=!0):s=!1,s||Us(r,!0)}function G1(r){for(Ln=r.return;Ln;)switch(Ln.tag){case 5:case 31:case 13:Hr=!1;return;case 27:case 3:Hr=!0;return;default:Ln=Ln.return}}function Co(r){if(r!==Ln)return!1;if(!Ft)return G1(r),Ft=!0,!1;var s=r.tag,c;if((c=s!==3&&s!==27)&&((c=s===5)&&(c=r.type,c=!(c!=="form"&&c!=="button")||Ag(r.type,r.memoizedProps)),c=!c),c&&sn&&Us(r),G1(r),s===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));sn=vN(r)}else if(s===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));sn=vN(r)}else s===27?(s=sn,ni(r.type)?(r=kg,kg=null,sn=r):sn=s):sn=Ln?qr(r.stateNode.nextSibling):null;return!0}function ki(){sn=Ln=null,Ft=!1}function hm(){var r=Hs;return r!==null&&(dr===null?dr=r:dr.push.apply(dr,r),Hs=null),r}function bc(r){Hs===null?Hs=[r]:Hs.push(r)}var pm=B(null),Li=null,ts=null;function qs(r,s,c){X(pm,s._currentValue),s._currentValue=c}function ns(r){r._currentValue=pm.current,G(pm)}function mm(r,s,c){for(;r!==null;){var f=r.alternate;if((r.childLanes&s)!==s?(r.childLanes|=s,f!==null&&(f.childLanes|=s)):f!==null&&(f.childLanes&s)!==s&&(f.childLanes|=s),r===c)break;r=r.return}}function gm(r,s,c,f){var x=r.child;for(x!==null&&(x.return=r);x!==null;){var y=x.dependencies;if(y!==null){var E=x.child;y=y.firstContext;e:for(;y!==null;){var M=y;y=x;for(var F=0;F<s.length;F++)if(M.context===s[F]){y.lanes|=c,M=y.alternate,M!==null&&(M.lanes|=c),mm(y.return,c,r),f||(E=null);break e}y=M.next}}else if(x.tag===18){if(E=x.return,E===null)throw Error(a(341));E.lanes|=c,y=E.alternate,y!==null&&(y.lanes|=c),mm(E,c,r),E=null}else E=x.child;if(E!==null)E.return=x;else for(E=x;E!==null;){if(E===r){E=null;break}if(x=E.sibling,x!==null){x.return=E.return,E=x;break}E=E.return}x=E}}function jo(r,s,c,f){r=null;for(var x=s,y=!1;x!==null;){if(!y){if((x.flags&524288)!==0)y=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var E=x.alternate;if(E===null)throw Error(a(387));if(E=E.memoizedProps,E!==null){var M=x.type;br(x.pendingProps.value,E.value)||(r!==null?r.push(M):r=[M])}}else if(x===te.current){if(E=x.alternate,E===null)throw Error(a(387));E.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(r!==null?r.push(Kc):r=[Kc])}x=x.return}r!==null&&gm(s,r,c,f),s.flags|=262144}function Dd(r){for(r=r.firstContext;r!==null;){if(!br(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Bi(r){Li=r,ts=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Bn(r){return K1(Li,r)}function Pd(r,s){return Li===null&&Bi(r),K1(r,s)}function K1(r,s){var c=s._currentValue;if(s={context:s,memoizedValue:c,next:null},ts===null){if(r===null)throw Error(a(308));ts=s,r.dependencies={lanes:0,firstContext:s},r.flags|=524288}else ts=ts.next=s;return c}var V4=typeof AbortController<"u"?AbortController:function(){var r=[],s=this.signal={aborted:!1,addEventListener:function(c,f){r.push(f)}};this.abort=function(){s.aborted=!0,r.forEach(function(c){return c()})}},$4=e.unstable_scheduleCallback,G4=e.unstable_NormalPriority,wn={$$typeof:T,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function vm(){return{controller:new V4,data:new Map,refCount:0}}function wc(r){r.refCount--,r.refCount===0&&$4(G4,function(){r.controller.abort()})}var Sc=null,xm=0,No=0,_o=null;function K4(r,s){if(Sc===null){var c=Sc=[];xm=0,No=wg(),_o={status:"pending",value:void 0,then:function(f){c.push(f)}}}return xm++,s.then(Y1,Y1),s}function Y1(){if(--xm===0&&Sc!==null){_o!==null&&(_o.status="fulfilled");var r=Sc;Sc=null,No=0,_o=null;for(var s=0;s<r.length;s++)(0,r[s])()}}function Y4(r,s){var c=[],f={status:"pending",value:null,reason:null,then:function(x){c.push(x)}};return r.then(function(){f.status="fulfilled",f.value=s;for(var x=0;x<c.length;x++)(0,c[x])(s)},function(x){for(f.status="rejected",f.reason=x,x=0;x<c.length;x++)(0,c[x])(void 0)}),f}var W1=I.S;I.S=function(r,s){Mj=vt(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&K4(r,s),W1!==null&&W1(r,s)};var Ii=B(null);function ym(){var r=Ii.current;return r!==null?r:nn.pooledCache}function kd(r,s){s===null?X(Ii,Ii.current):X(Ii,s.pool)}function X1(){var r=ym();return r===null?null:{parent:wn._currentValue,pool:r}}var Eo=Error(a(460)),bm=Error(a(474)),Ld=Error(a(542)),Bd={then:function(){}};function Q1(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Z1(r,s,c){switch(c=r[c],c===void 0?r.push(s):c!==s&&(s.then(kt,kt),s=c),s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,eC(r),r;default:if(typeof s.status=="string")s.then(kt,kt);else{if(r=nn,r!==null&&100<r.shellSuspendCounter)throw Error(a(482));r=s,r.status="pending",r.then(function(f){if(s.status==="pending"){var x=s;x.status="fulfilled",x.value=f}},function(f){if(s.status==="pending"){var x=s;x.status="rejected",x.reason=f}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,eC(r),r}throw Fi=s,Eo}}function zi(r){try{var s=r._init;return s(r._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Fi=c,Eo):c}}var Fi=null;function J1(){if(Fi===null)throw Error(a(459));var r=Fi;return Fi=null,r}function eC(r){if(r===Eo||r===Ld)throw Error(a(483))}var To=null,Cc=0;function Id(r){var s=Cc;return Cc+=1,To===null&&(To=[]),Z1(To,r,s)}function jc(r,s){s=s.props.ref,r.ref=s!==void 0?s:null}function zd(r,s){throw s.$$typeof===b?Error(a(525)):(r=Object.prototype.toString.call(s),Error(a(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r)))}function tC(r){function s(Z,V){if(r){var re=Z.deletions;re===null?(Z.deletions=[V],Z.flags|=16):re.push(V)}}function c(Z,V){if(!r)return null;for(;V!==null;)s(Z,V),V=V.sibling;return null}function f(Z){for(var V=new Map;Z!==null;)Z.key!==null?V.set(Z.key,Z):V.set(Z.index,Z),Z=Z.sibling;return V}function x(Z,V){return Z=Ja(Z,V),Z.index=0,Z.sibling=null,Z}function y(Z,V,re){return Z.index=re,r?(re=Z.alternate,re!==null?(re=re.index,re<V?(Z.flags|=67108866,V):re):(Z.flags|=67108866,V)):(Z.flags|=1048576,V)}function E(Z){return r&&Z.alternate===null&&(Z.flags|=67108866),Z}function M(Z,V,re,ve){return V===null||V.tag!==6?(V=lm(re,Z.mode,ve),V.return=Z,V):(V=x(V,re),V.return=Z,V)}function F(Z,V,re,ve){var Ze=re.type;return Ze===S?ge(Z,V,re.props.children,ve,re.key):V!==null&&(V.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===P&&zi(Ze)===V.type)?(V=x(V,re.props),jc(V,re),V.return=Z,V):(V=Od(re.type,re.key,re.props,null,Z.mode,ve),jc(V,re),V.return=Z,V)}function ae(Z,V,re,ve){return V===null||V.tag!==4||V.stateNode.containerInfo!==re.containerInfo||V.stateNode.implementation!==re.implementation?(V=cm(re,Z.mode,ve),V.return=Z,V):(V=x(V,re.children||[]),V.return=Z,V)}function ge(Z,V,re,ve,Ze){return V===null||V.tag!==7?(V=Pi(re,Z.mode,ve,Ze),V.return=Z,V):(V=x(V,re),V.return=Z,V)}function ye(Z,V,re){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=lm(""+V,Z.mode,re),V.return=Z,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case w:return re=Od(V.type,V.key,V.props,null,Z.mode,re),jc(re,V),re.return=Z,re;case C:return V=cm(V,Z.mode,re),V.return=Z,V;case P:return V=zi(V),ye(Z,V,re)}if(Ce(V)||W(V))return V=Pi(V,Z.mode,re,null),V.return=Z,V;if(typeof V.then=="function")return ye(Z,Id(V),re);if(V.$$typeof===T)return ye(Z,Pd(Z,V),re);zd(Z,V)}return null}function ie(Z,V,re,ve){var Ze=V!==null?V.key:null;if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return Ze!==null?null:M(Z,V,""+re,ve);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case w:return re.key===Ze?F(Z,V,re,ve):null;case C:return re.key===Ze?ae(Z,V,re,ve):null;case P:return re=zi(re),ie(Z,V,re,ve)}if(Ce(re)||W(re))return Ze!==null?null:ge(Z,V,re,ve,null);if(typeof re.then=="function")return ie(Z,V,Id(re),ve);if(re.$$typeof===T)return ie(Z,V,Pd(Z,re),ve);zd(Z,re)}return null}function le(Z,V,re,ve,Ze){if(typeof ve=="string"&&ve!==""||typeof ve=="number"||typeof ve=="bigint")return Z=Z.get(re)||null,M(V,Z,""+ve,Ze);if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case w:return Z=Z.get(ve.key===null?re:ve.key)||null,F(V,Z,ve,Ze);case C:return Z=Z.get(ve.key===null?re:ve.key)||null,ae(V,Z,ve,Ze);case P:return ve=zi(ve),le(Z,V,re,ve,Ze)}if(Ce(ve)||W(ve))return Z=Z.get(re)||null,ge(V,Z,ve,Ze,null);if(typeof ve.then=="function")return le(Z,V,re,Id(ve),Ze);if(ve.$$typeof===T)return le(Z,V,re,Pd(V,ve),Ze);zd(V,ve)}return null}function Fe(Z,V,re,ve){for(var Ze=null,Vt=null,Ye=V,Ct=V=0,Bt=null;Ye!==null&&Ct<re.length;Ct++){Ye.index>Ct?(Bt=Ye,Ye=null):Bt=Ye.sibling;var $t=ie(Z,Ye,re[Ct],ve);if($t===null){Ye===null&&(Ye=Bt);break}r&&Ye&&$t.alternate===null&&s(Z,Ye),V=y($t,V,Ct),Vt===null?Ze=$t:Vt.sibling=$t,Vt=$t,Ye=Bt}if(Ct===re.length)return c(Z,Ye),Ft&&es(Z,Ct),Ze;if(Ye===null){for(;Ct<re.length;Ct++)Ye=ye(Z,re[Ct],ve),Ye!==null&&(V=y(Ye,V,Ct),Vt===null?Ze=Ye:Vt.sibling=Ye,Vt=Ye);return Ft&&es(Z,Ct),Ze}for(Ye=f(Ye);Ct<re.length;Ct++)Bt=le(Ye,Z,Ct,re[Ct],ve),Bt!==null&&(r&&Bt.alternate!==null&&Ye.delete(Bt.key===null?Ct:Bt.key),V=y(Bt,V,Ct),Vt===null?Ze=Bt:Vt.sibling=Bt,Vt=Bt);return r&&Ye.forEach(function(oi){return s(Z,oi)}),Ft&&es(Z,Ct),Ze}function rt(Z,V,re,ve){if(re==null)throw Error(a(151));for(var Ze=null,Vt=null,Ye=V,Ct=V=0,Bt=null,$t=re.next();Ye!==null&&!$t.done;Ct++,$t=re.next()){Ye.index>Ct?(Bt=Ye,Ye=null):Bt=Ye.sibling;var oi=ie(Z,Ye,$t.value,ve);if(oi===null){Ye===null&&(Ye=Bt);break}r&&Ye&&oi.alternate===null&&s(Z,Ye),V=y(oi,V,Ct),Vt===null?Ze=oi:Vt.sibling=oi,Vt=oi,Ye=Bt}if($t.done)return c(Z,Ye),Ft&&es(Z,Ct),Ze;if(Ye===null){for(;!$t.done;Ct++,$t=re.next())$t=ye(Z,$t.value,ve),$t!==null&&(V=y($t,V,Ct),Vt===null?Ze=$t:Vt.sibling=$t,Vt=$t);return Ft&&es(Z,Ct),Ze}for(Ye=f(Ye);!$t.done;Ct++,$t=re.next())$t=le(Ye,Z,Ct,$t.value,ve),$t!==null&&(r&&$t.alternate!==null&&Ye.delete($t.key===null?Ct:$t.key),V=y($t,V,Ct),Vt===null?Ze=$t:Vt.sibling=$t,Vt=$t);return r&&Ye.forEach(function(sI){return s(Z,sI)}),Ft&&es(Z,Ct),Ze}function en(Z,V,re,ve){if(typeof re=="object"&&re!==null&&re.type===S&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case w:e:{for(var Ze=re.key;V!==null;){if(V.key===Ze){if(Ze=re.type,Ze===S){if(V.tag===7){c(Z,V.sibling),ve=x(V,re.props.children),ve.return=Z,Z=ve;break e}}else if(V.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===P&&zi(Ze)===V.type){c(Z,V.sibling),ve=x(V,re.props),jc(ve,re),ve.return=Z,Z=ve;break e}c(Z,V);break}else s(Z,V);V=V.sibling}re.type===S?(ve=Pi(re.props.children,Z.mode,ve,re.key),ve.return=Z,Z=ve):(ve=Od(re.type,re.key,re.props,null,Z.mode,ve),jc(ve,re),ve.return=Z,Z=ve)}return E(Z);case C:e:{for(Ze=re.key;V!==null;){if(V.key===Ze)if(V.tag===4&&V.stateNode.containerInfo===re.containerInfo&&V.stateNode.implementation===re.implementation){c(Z,V.sibling),ve=x(V,re.children||[]),ve.return=Z,Z=ve;break e}else{c(Z,V);break}else s(Z,V);V=V.sibling}ve=cm(re,Z.mode,ve),ve.return=Z,Z=ve}return E(Z);case P:return re=zi(re),en(Z,V,re,ve)}if(Ce(re))return Fe(Z,V,re,ve);if(W(re)){if(Ze=W(re),typeof Ze!="function")throw Error(a(150));return re=Ze.call(re),rt(Z,V,re,ve)}if(typeof re.then=="function")return en(Z,V,Id(re),ve);if(re.$$typeof===T)return en(Z,V,Pd(Z,re),ve);zd(Z,re)}return typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint"?(re=""+re,V!==null&&V.tag===6?(c(Z,V.sibling),ve=x(V,re),ve.return=Z,Z=ve):(c(Z,V),ve=lm(re,Z.mode,ve),ve.return=Z,Z=ve),E(Z)):c(Z,V)}return function(Z,V,re,ve){try{Cc=0;var Ze=en(Z,V,re,ve);return To=null,Ze}catch(Ye){if(Ye===Eo||Ye===Ld)throw Ye;var Vt=wr(29,Ye,null,Z.mode);return Vt.lanes=ve,Vt.return=Z,Vt}}}var Hi=tC(!0),nC=tC(!1),Vs=!1;function wm(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Sm(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function $s(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Gs(r,s,c){var f=r.updateQueue;if(f===null)return null;if(f=f.shared,(Gt&2)!==0){var x=f.pending;return x===null?s.next=s:(s.next=x.next,x.next=s),f.pending=s,s=Ad(r),z1(r,null,c),s}return Rd(r,f,s,c),Ad(r)}function Nc(r,s,c){if(s=s.updateQueue,s!==null&&(s=s.shared,(c&4194048)!==0)){var f=s.lanes;f&=r.pendingLanes,c|=f,s.lanes=c,Y(r,c)}}function Cm(r,s){var c=r.updateQueue,f=r.alternate;if(f!==null&&(f=f.updateQueue,c===f)){var x=null,y=null;if(c=c.firstBaseUpdate,c!==null){do{var E={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};y===null?x=y=E:y=y.next=E,c=c.next}while(c!==null);y===null?x=y=s:y=y.next=s}else x=y=s;c={baseState:f.baseState,firstBaseUpdate:x,lastBaseUpdate:y,shared:f.shared,callbacks:f.callbacks},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=s:r.next=s,c.lastBaseUpdate=s}var jm=!1;function _c(){if(jm){var r=_o;if(r!==null)throw r}}function Ec(r,s,c,f){jm=!1;var x=r.updateQueue;Vs=!1;var y=x.firstBaseUpdate,E=x.lastBaseUpdate,M=x.shared.pending;if(M!==null){x.shared.pending=null;var F=M,ae=F.next;F.next=null,E===null?y=ae:E.next=ae,E=F;var ge=r.alternate;ge!==null&&(ge=ge.updateQueue,M=ge.lastBaseUpdate,M!==E&&(M===null?ge.firstBaseUpdate=ae:M.next=ae,ge.lastBaseUpdate=F))}if(y!==null){var ye=x.baseState;E=0,ge=ae=F=null,M=y;do{var ie=M.lane&-536870913,le=ie!==M.lane;if(le?(Lt&ie)===ie:(f&ie)===ie){ie!==0&&ie===No&&(jm=!0),ge!==null&&(ge=ge.next={lane:0,tag:M.tag,payload:M.payload,callback:null,next:null});e:{var Fe=r,rt=M;ie=s;var en=c;switch(rt.tag){case 1:if(Fe=rt.payload,typeof Fe=="function"){ye=Fe.call(en,ye,ie);break e}ye=Fe;break e;case 3:Fe.flags=Fe.flags&-65537|128;case 0:if(Fe=rt.payload,ie=typeof Fe=="function"?Fe.call(en,ye,ie):Fe,ie==null)break e;ye=m({},ye,ie);break e;case 2:Vs=!0}}ie=M.callback,ie!==null&&(r.flags|=64,le&&(r.flags|=8192),le=x.callbacks,le===null?x.callbacks=[ie]:le.push(ie))}else le={lane:ie,tag:M.tag,payload:M.payload,callback:M.callback,next:null},ge===null?(ae=ge=le,F=ye):ge=ge.next=le,E|=ie;if(M=M.next,M===null){if(M=x.shared.pending,M===null)break;le=M,M=le.next,le.next=null,x.lastBaseUpdate=le,x.shared.pending=null}}while(!0);ge===null&&(F=ye),x.baseState=F,x.firstBaseUpdate=ae,x.lastBaseUpdate=ge,y===null&&(x.shared.lanes=0),Qs|=E,r.lanes=E,r.memoizedState=ye}}function rC(r,s){if(typeof r!="function")throw Error(a(191,r));r.call(s)}function aC(r,s){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)rC(c[r],s)}var Ro=B(null),Fd=B(0);function sC(r,s){r=ds,X(Fd,r),X(Ro,s),ds=r|s.baseLanes}function Nm(){X(Fd,ds),X(Ro,Ro.current)}function _m(){ds=Fd.current,G(Ro),G(Fd)}var Sr=B(null),Ur=null;function Ks(r){var s=r.alternate;X(yn,yn.current&1),X(Sr,r),Ur===null&&(s===null||Ro.current!==null||s.memoizedState!==null)&&(Ur=r)}function Em(r){X(yn,yn.current),X(Sr,r),Ur===null&&(Ur=r)}function iC(r){r.tag===22?(X(yn,yn.current),X(Sr,r),Ur===null&&(Ur=r)):Ys()}function Ys(){X(yn,yn.current),X(Sr,Sr.current)}function Cr(r){G(Sr),Ur===r&&(Ur=null),G(yn)}var yn=B(0);function Hd(r){for(var s=r;s!==null;){if(s.tag===13){var c=s.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Dg(c)||Pg(c)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var rs=0,yt=null,Zt=null,Sn=null,Ud=!1,Ao=!1,Ui=!1,qd=0,Tc=0,Oo=null,W4=0;function mn(){throw Error(a(321))}function Tm(r,s){if(s===null)return!1;for(var c=0;c<s.length&&c<r.length;c++)if(!br(r[c],s[c]))return!1;return!0}function Rm(r,s,c,f,x,y){return rs=y,yt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,I.H=r===null||r.memoizedState===null?qC:Vm,Ui=!1,y=c(f,x),Ui=!1,Ao&&(y=lC(s,c,f,x)),oC(r),y}function oC(r){I.H=Oc;var s=Zt!==null&&Zt.next!==null;if(rs=0,Sn=Zt=yt=null,Ud=!1,Tc=0,Oo=null,s)throw Error(a(300));r===null||Cn||(r=r.dependencies,r!==null&&Dd(r)&&(Cn=!0))}function lC(r,s,c,f){yt=r;var x=0;do{if(Ao&&(Oo=null),Tc=0,Ao=!1,25<=x)throw Error(a(301));if(x+=1,Sn=Zt=null,r.updateQueue!=null){var y=r.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}I.H=VC,y=s(c,f)}while(Ao);return y}function X4(){var r=I.H,s=r.useState()[0];return s=typeof s.then=="function"?Rc(s):s,r=r.useState()[0],(Zt!==null?Zt.memoizedState:null)!==r&&(yt.flags|=1024),s}function Am(){var r=qd!==0;return qd=0,r}function Om(r,s,c){s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~c}function Mm(r){if(Ud){for(r=r.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Ud=!1}rs=0,Sn=Zt=yt=null,Ao=!1,Tc=qd=0,Oo=null}function er(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Sn===null?yt.memoizedState=Sn=r:Sn=Sn.next=r,Sn}function bn(){if(Zt===null){var r=yt.alternate;r=r!==null?r.memoizedState:null}else r=Zt.next;var s=Sn===null?yt.memoizedState:Sn.next;if(s!==null)Sn=s,Zt=r;else{if(r===null)throw yt.alternate===null?Error(a(467)):Error(a(310));Zt=r,r={memoizedState:Zt.memoizedState,baseState:Zt.baseState,baseQueue:Zt.baseQueue,queue:Zt.queue,next:null},Sn===null?yt.memoizedState=Sn=r:Sn=Sn.next=r}return Sn}function Vd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Rc(r){var s=Tc;return Tc+=1,Oo===null&&(Oo=[]),r=Z1(Oo,r,s),s=yt,(Sn===null?s.memoizedState:Sn.next)===null&&(s=s.alternate,I.H=s===null||s.memoizedState===null?qC:Vm),r}function $d(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return Rc(r);if(r.$$typeof===T)return Bn(r)}throw Error(a(438,String(r)))}function Dm(r){var s=null,c=yt.updateQueue;if(c!==null&&(s=c.memoCache),s==null){var f=yt.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(s={data:f.data.map(function(x){return x.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),c===null&&(c=Vd(),yt.updateQueue=c),c.memoCache=s,c=s.data[s.index],c===void 0)for(c=s.data[s.index]=Array(r),f=0;f<r;f++)c[f]=J;return s.index++,c}function as(r,s){return typeof s=="function"?s(r):s}function Gd(r){var s=bn();return Pm(s,Zt,r)}function Pm(r,s,c){var f=r.queue;if(f===null)throw Error(a(311));f.lastRenderedReducer=c;var x=r.baseQueue,y=f.pending;if(y!==null){if(x!==null){var E=x.next;x.next=y.next,y.next=E}s.baseQueue=x=y,f.pending=null}if(y=r.baseState,x===null)r.memoizedState=y;else{s=x.next;var M=E=null,F=null,ae=s,ge=!1;do{var ye=ae.lane&-536870913;if(ye!==ae.lane?(Lt&ye)===ye:(rs&ye)===ye){var ie=ae.revertLane;if(ie===0)F!==null&&(F=F.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),ye===No&&(ge=!0);else if((rs&ie)===ie){ae=ae.next,ie===No&&(ge=!0);continue}else ye={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},F===null?(M=F=ye,E=y):F=F.next=ye,yt.lanes|=ie,Qs|=ie;ye=ae.action,Ui&&c(y,ye),y=ae.hasEagerState?ae.eagerState:c(y,ye)}else ie={lane:ye,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},F===null?(M=F=ie,E=y):F=F.next=ie,yt.lanes|=ye,Qs|=ye;ae=ae.next}while(ae!==null&&ae!==s);if(F===null?E=y:F.next=M,!br(y,r.memoizedState)&&(Cn=!0,ge&&(c=_o,c!==null)))throw c;r.memoizedState=y,r.baseState=E,r.baseQueue=F,f.lastRenderedState=y}return x===null&&(f.lanes=0),[r.memoizedState,f.dispatch]}function km(r){var s=bn(),c=s.queue;if(c===null)throw Error(a(311));c.lastRenderedReducer=r;var f=c.dispatch,x=c.pending,y=s.memoizedState;if(x!==null){c.pending=null;var E=x=x.next;do y=r(y,E.action),E=E.next;while(E!==x);br(y,s.memoizedState)||(Cn=!0),s.memoizedState=y,s.baseQueue===null&&(s.baseState=y),c.lastRenderedState=y}return[y,f]}function cC(r,s,c){var f=yt,x=bn(),y=Ft;if(y){if(c===void 0)throw Error(a(407));c=c()}else c=s();var E=!br((Zt||x).memoizedState,c);if(E&&(x.memoizedState=c,Cn=!0),x=x.queue,Im(fC.bind(null,f,x,r),[r]),x.getSnapshot!==s||E||Sn!==null&&Sn.memoizedState.tag&1){if(f.flags|=2048,Mo(9,{destroy:void 0},dC.bind(null,f,x,c,s),null),nn===null)throw Error(a(349));y||(rs&127)!==0||uC(f,s,c)}return c}function uC(r,s,c){r.flags|=16384,r={getSnapshot:s,value:c},s=yt.updateQueue,s===null?(s=Vd(),yt.updateQueue=s,s.stores=[r]):(c=s.stores,c===null?s.stores=[r]:c.push(r))}function dC(r,s,c,f){s.value=c,s.getSnapshot=f,hC(s)&&pC(r)}function fC(r,s,c){return c(function(){hC(s)&&pC(r)})}function hC(r){var s=r.getSnapshot;r=r.value;try{var c=s();return!br(r,c)}catch{return!0}}function pC(r){var s=Di(r,2);s!==null&&fr(s,r,2)}function Lm(r){var s=er();if(typeof r=="function"){var c=r;if(r=c(),Ui){qt(!0);try{c()}finally{qt(!1)}}}return s.memoizedState=s.baseState=r,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:r},s}function mC(r,s,c,f){return r.baseState=c,Pm(r,Zt,typeof f=="function"?f:as)}function Q4(r,s,c,f,x){if(Wd(r))throw Error(a(485));if(r=s.action,r!==null){var y={payload:x,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(E){y.listeners.push(E)}};I.T!==null?c(!0):y.isTransition=!1,f(y),c=s.pending,c===null?(y.next=s.pending=y,gC(s,y)):(y.next=c.next,s.pending=c.next=y)}}function gC(r,s){var c=s.action,f=s.payload,x=r.state;if(s.isTransition){var y=I.T,E={};I.T=E;try{var M=c(x,f),F=I.S;F!==null&&F(E,M),vC(r,s,M)}catch(ae){Bm(r,s,ae)}finally{y!==null&&E.types!==null&&(y.types=E.types),I.T=y}}else try{y=c(x,f),vC(r,s,y)}catch(ae){Bm(r,s,ae)}}function vC(r,s,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(f){xC(r,s,f)},function(f){return Bm(r,s,f)}):xC(r,s,c)}function xC(r,s,c){s.status="fulfilled",s.value=c,yC(s),r.state=c,s=r.pending,s!==null&&(c=s.next,c===s?r.pending=null:(c=c.next,s.next=c,gC(r,c)))}function Bm(r,s,c){var f=r.pending;if(r.pending=null,f!==null){f=f.next;do s.status="rejected",s.reason=c,yC(s),s=s.next;while(s!==f)}r.action=null}function yC(r){r=r.listeners;for(var s=0;s<r.length;s++)(0,r[s])()}function bC(r,s){return s}function wC(r,s){if(Ft){var c=nn.formState;if(c!==null){e:{var f=yt;if(Ft){if(sn){t:{for(var x=sn,y=Hr;x.nodeType!==8;){if(!y){x=null;break t}if(x=qr(x.nextSibling),x===null){x=null;break t}}y=x.data,x=y==="F!"||y==="F"?x:null}if(x){sn=qr(x.nextSibling),f=x.data==="F!";break e}}Us(f)}f=!1}f&&(s=c[0])}}return c=er(),c.memoizedState=c.baseState=s,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bC,lastRenderedState:s},c.queue=f,c=FC.bind(null,yt,f),f.dispatch=c,f=Lm(!1),y=qm.bind(null,yt,!1,f.queue),f=er(),x={state:s,dispatch:null,action:r,pending:null},f.queue=x,c=Q4.bind(null,yt,x,y,c),x.dispatch=c,f.memoizedState=r,[s,c,!1]}function SC(r){var s=bn();return CC(s,Zt,r)}function CC(r,s,c){if(s=Pm(r,s,bC)[0],r=Gd(as)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var f=Rc(s)}catch(E){throw E===Eo?Ld:E}else f=s;s=bn();var x=s.queue,y=x.dispatch;return c!==s.memoizedState&&(yt.flags|=2048,Mo(9,{destroy:void 0},Z4.bind(null,x,c),null)),[f,y,r]}function Z4(r,s){r.action=s}function jC(r){var s=bn(),c=Zt;if(c!==null)return CC(s,c,r);bn(),s=s.memoizedState,c=bn();var f=c.queue.dispatch;return c.memoizedState=r,[s,f,!1]}function Mo(r,s,c,f){return r={tag:r,create:c,deps:f,inst:s,next:null},s=yt.updateQueue,s===null&&(s=Vd(),yt.updateQueue=s),c=s.lastEffect,c===null?s.lastEffect=r.next=r:(f=c.next,c.next=r,r.next=f,s.lastEffect=r),r}function NC(){return bn().memoizedState}function Kd(r,s,c,f){var x=er();yt.flags|=r,x.memoizedState=Mo(1|s,{destroy:void 0},c,f===void 0?null:f)}function Yd(r,s,c,f){var x=bn();f=f===void 0?null:f;var y=x.memoizedState.inst;Zt!==null&&f!==null&&Tm(f,Zt.memoizedState.deps)?x.memoizedState=Mo(s,y,c,f):(yt.flags|=r,x.memoizedState=Mo(1|s,y,c,f))}function _C(r,s){Kd(8390656,8,r,s)}function Im(r,s){Yd(2048,8,r,s)}function J4(r){yt.flags|=4;var s=yt.updateQueue;if(s===null)s=Vd(),yt.updateQueue=s,s.events=[r];else{var c=s.events;c===null?s.events=[r]:c.push(r)}}function EC(r){var s=bn().memoizedState;return J4({ref:s,nextImpl:r}),function(){if((Gt&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}function TC(r,s){return Yd(4,2,r,s)}function RC(r,s){return Yd(4,4,r,s)}function AC(r,s){if(typeof s=="function"){r=r();var c=s(r);return function(){typeof c=="function"?c():s(null)}}if(s!=null)return r=r(),s.current=r,function(){s.current=null}}function OC(r,s,c){c=c!=null?c.concat([r]):null,Yd(4,4,AC.bind(null,s,r),c)}function zm(){}function MC(r,s){var c=bn();s=s===void 0?null:s;var f=c.memoizedState;return s!==null&&Tm(s,f[1])?f[0]:(c.memoizedState=[r,s],r)}function DC(r,s){var c=bn();s=s===void 0?null:s;var f=c.memoizedState;if(s!==null&&Tm(s,f[1]))return f[0];if(f=r(),Ui){qt(!0);try{r()}finally{qt(!1)}}return c.memoizedState=[f,s],f}function Fm(r,s,c){return c===void 0||(rs&1073741824)!==0&&(Lt&261930)===0?r.memoizedState=s:(r.memoizedState=c,r=Pj(),yt.lanes|=r,Qs|=r,c)}function PC(r,s,c,f){return br(c,s)?c:Ro.current!==null?(r=Fm(r,c,f),br(r,s)||(Cn=!0),r):(rs&42)===0||(rs&1073741824)!==0&&(Lt&261930)===0?(Cn=!0,r.memoizedState=c):(r=Pj(),yt.lanes|=r,Qs|=r,s)}function kC(r,s,c,f,x){var y=q.p;q.p=y!==0&&8>y?y:8;var E=I.T,M={};I.T=M,qm(r,!1,s,c);try{var F=x(),ae=I.S;if(ae!==null&&ae(M,F),F!==null&&typeof F=="object"&&typeof F.then=="function"){var ge=Y4(F,f);Ac(r,s,ge,_r(r))}else Ac(r,s,f,_r(r))}catch(ye){Ac(r,s,{then:function(){},status:"rejected",reason:ye},_r())}finally{q.p=y,E!==null&&M.types!==null&&(E.types=M.types),I.T=E}}function eB(){}function Hm(r,s,c,f){if(r.tag!==5)throw Error(a(476));var x=LC(r).queue;kC(r,x,s,H,c===null?eB:function(){return BC(r),c(f)})}function LC(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:H,baseState:H,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:H},next:null};var c={};return s.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:as,lastRenderedState:c},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function BC(r){var s=LC(r);s.next===null&&(s=r.alternate.memoizedState),Ac(r,s.next.queue,{},_r())}function Um(){return Bn(Kc)}function IC(){return bn().memoizedState}function zC(){return bn().memoizedState}function tB(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var c=_r();r=$s(c);var f=Gs(s,r,c);f!==null&&(fr(f,s,c),Nc(f,s,c)),s={cache:vm()},r.payload=s;return}s=s.return}}function nB(r,s,c){var f=_r();c={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Wd(r)?HC(s,c):(c=im(r,s,c,f),c!==null&&(fr(c,r,f),UC(c,s,f)))}function FC(r,s,c){var f=_r();Ac(r,s,c,f)}function Ac(r,s,c,f){var x={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Wd(r))HC(s,x);else{var y=r.alternate;if(r.lanes===0&&(y===null||y.lanes===0)&&(y=s.lastRenderedReducer,y!==null))try{var E=s.lastRenderedState,M=y(E,c);if(x.hasEagerState=!0,x.eagerState=M,br(M,E))return Rd(r,s,x,0),nn===null&&Td(),!1}catch{}if(c=im(r,s,x,f),c!==null)return fr(c,r,f),UC(c,s,f),!0}return!1}function qm(r,s,c,f){if(f={lane:2,revertLane:wg(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Wd(r)){if(s)throw Error(a(479))}else s=im(r,c,f,2),s!==null&&fr(s,r,2)}function Wd(r){var s=r.alternate;return r===yt||s!==null&&s===yt}function HC(r,s){Ao=Ud=!0;var c=r.pending;c===null?s.next=s:(s.next=c.next,c.next=s),r.pending=s}function UC(r,s,c){if((c&4194048)!==0){var f=s.lanes;f&=r.pendingLanes,c|=f,s.lanes=c,Y(r,c)}}var Oc={readContext:Bn,use:$d,useCallback:mn,useContext:mn,useEffect:mn,useImperativeHandle:mn,useLayoutEffect:mn,useInsertionEffect:mn,useMemo:mn,useReducer:mn,useRef:mn,useState:mn,useDebugValue:mn,useDeferredValue:mn,useTransition:mn,useSyncExternalStore:mn,useId:mn,useHostTransitionStatus:mn,useFormState:mn,useActionState:mn,useOptimistic:mn,useMemoCache:mn,useCacheRefresh:mn};Oc.useEffectEvent=mn;var qC={readContext:Bn,use:$d,useCallback:function(r,s){return er().memoizedState=[r,s===void 0?null:s],r},useContext:Bn,useEffect:_C,useImperativeHandle:function(r,s,c){c=c!=null?c.concat([r]):null,Kd(4194308,4,AC.bind(null,s,r),c)},useLayoutEffect:function(r,s){return Kd(4194308,4,r,s)},useInsertionEffect:function(r,s){Kd(4,2,r,s)},useMemo:function(r,s){var c=er();s=s===void 0?null:s;var f=r();if(Ui){qt(!0);try{r()}finally{qt(!1)}}return c.memoizedState=[f,s],f},useReducer:function(r,s,c){var f=er();if(c!==void 0){var x=c(s);if(Ui){qt(!0);try{c(s)}finally{qt(!1)}}}else x=s;return f.memoizedState=f.baseState=x,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:x},f.queue=r,r=r.dispatch=nB.bind(null,yt,r),[f.memoizedState,r]},useRef:function(r){var s=er();return r={current:r},s.memoizedState=r},useState:function(r){r=Lm(r);var s=r.queue,c=FC.bind(null,yt,s);return s.dispatch=c,[r.memoizedState,c]},useDebugValue:zm,useDeferredValue:function(r,s){var c=er();return Fm(c,r,s)},useTransition:function(){var r=Lm(!1);return r=kC.bind(null,yt,r.queue,!0,!1),er().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,c){var f=yt,x=er();if(Ft){if(c===void 0)throw Error(a(407));c=c()}else{if(c=s(),nn===null)throw Error(a(349));(Lt&127)!==0||uC(f,s,c)}x.memoizedState=c;var y={value:c,getSnapshot:s};return x.queue=y,_C(fC.bind(null,f,y,r),[r]),f.flags|=2048,Mo(9,{destroy:void 0},dC.bind(null,f,y,c,s),null),c},useId:function(){var r=er(),s=nn.identifierPrefix;if(Ft){var c=Ta,f=Ea;c=(f&~(1<<32-ue(f)-1)).toString(32)+c,s="_"+s+"R_"+c,c=qd++,0<c&&(s+="H"+c.toString(32)),s+="_"}else c=W4++,s="_"+s+"r_"+c.toString(32)+"_";return r.memoizedState=s},useHostTransitionStatus:Um,useFormState:wC,useActionState:wC,useOptimistic:function(r){var s=er();s.memoizedState=s.baseState=r;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=c,s=qm.bind(null,yt,!0,c),c.dispatch=s,[r,s]},useMemoCache:Dm,useCacheRefresh:function(){return er().memoizedState=tB.bind(null,yt)},useEffectEvent:function(r){var s=er(),c={impl:r};return s.memoizedState=c,function(){if((Gt&2)!==0)throw Error(a(440));return c.impl.apply(void 0,arguments)}}},Vm={readContext:Bn,use:$d,useCallback:MC,useContext:Bn,useEffect:Im,useImperativeHandle:OC,useInsertionEffect:TC,useLayoutEffect:RC,useMemo:DC,useReducer:Gd,useRef:NC,useState:function(){return Gd(as)},useDebugValue:zm,useDeferredValue:function(r,s){var c=bn();return PC(c,Zt.memoizedState,r,s)},useTransition:function(){var r=Gd(as)[0],s=bn().memoizedState;return[typeof r=="boolean"?r:Rc(r),s]},useSyncExternalStore:cC,useId:IC,useHostTransitionStatus:Um,useFormState:SC,useActionState:SC,useOptimistic:function(r,s){var c=bn();return mC(c,Zt,r,s)},useMemoCache:Dm,useCacheRefresh:zC};Vm.useEffectEvent=EC;var VC={readContext:Bn,use:$d,useCallback:MC,useContext:Bn,useEffect:Im,useImperativeHandle:OC,useInsertionEffect:TC,useLayoutEffect:RC,useMemo:DC,useReducer:km,useRef:NC,useState:function(){return km(as)},useDebugValue:zm,useDeferredValue:function(r,s){var c=bn();return Zt===null?Fm(c,r,s):PC(c,Zt.memoizedState,r,s)},useTransition:function(){var r=km(as)[0],s=bn().memoizedState;return[typeof r=="boolean"?r:Rc(r),s]},useSyncExternalStore:cC,useId:IC,useHostTransitionStatus:Um,useFormState:jC,useActionState:jC,useOptimistic:function(r,s){var c=bn();return Zt!==null?mC(c,Zt,r,s):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:Dm,useCacheRefresh:zC};VC.useEffectEvent=EC;function $m(r,s,c,f){s=r.memoizedState,c=c(f,s),c=c==null?s:m({},s,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var Gm={enqueueSetState:function(r,s,c){r=r._reactInternals;var f=_r(),x=$s(f);x.payload=s,c!=null&&(x.callback=c),s=Gs(r,x,f),s!==null&&(fr(s,r,f),Nc(s,r,f))},enqueueReplaceState:function(r,s,c){r=r._reactInternals;var f=_r(),x=$s(f);x.tag=1,x.payload=s,c!=null&&(x.callback=c),s=Gs(r,x,f),s!==null&&(fr(s,r,f),Nc(s,r,f))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var c=_r(),f=$s(c);f.tag=2,s!=null&&(f.callback=s),s=Gs(r,f,c),s!==null&&(fr(s,r,c),Nc(s,r,c))}};function $C(r,s,c,f,x,y,E){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(f,y,E):s.prototype&&s.prototype.isPureReactComponent?!vc(c,f)||!vc(x,y):!0}function GC(r,s,c,f){r=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(c,f),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(c,f),s.state!==r&&Gm.enqueueReplaceState(s,s.state,null)}function qi(r,s){var c=s;if("ref"in s){c={};for(var f in s)f!=="ref"&&(c[f]=s[f])}if(r=r.defaultProps){c===s&&(c=m({},c));for(var x in r)c[x]===void 0&&(c[x]=r[x])}return c}function KC(r){Ed(r)}function YC(r){console.error(r)}function WC(r){Ed(r)}function Xd(r,s){try{var c=r.onUncaughtError;c(s.value,{componentStack:s.stack})}catch(f){setTimeout(function(){throw f})}}function XC(r,s,c){try{var f=r.onCaughtError;f(c.value,{componentStack:c.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Km(r,s,c){return c=$s(c),c.tag=3,c.payload={element:null},c.callback=function(){Xd(r,s)},c}function QC(r){return r=$s(r),r.tag=3,r}function ZC(r,s,c,f){var x=c.type.getDerivedStateFromError;if(typeof x=="function"){var y=f.value;r.payload=function(){return x(y)},r.callback=function(){XC(s,c,f)}}var E=c.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(r.callback=function(){XC(s,c,f),typeof x!="function"&&(Zs===null?Zs=new Set([this]):Zs.add(this));var M=f.stack;this.componentDidCatch(f.value,{componentStack:M!==null?M:""})})}function rB(r,s,c,f,x){if(c.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(s=c.alternate,s!==null&&jo(s,c,x,!0),c=Sr.current,c!==null){switch(c.tag){case 31:case 13:return Ur===null?cf():c.alternate===null&&gn===0&&(gn=3),c.flags&=-257,c.flags|=65536,c.lanes=x,f===Bd?c.flags|=16384:(s=c.updateQueue,s===null?c.updateQueue=new Set([f]):s.add(f),xg(r,f,x)),!1;case 22:return c.flags|=65536,f===Bd?c.flags|=16384:(s=c.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([f])},c.updateQueue=s):(c=s.retryQueue,c===null?s.retryQueue=new Set([f]):c.add(f)),xg(r,f,x)),!1}throw Error(a(435,c.tag))}return xg(r,f,x),cf(),!1}if(Ft)return s=Sr.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=x,f!==fm&&(r=Error(a(422),{cause:f}),bc(Ir(r,c)))):(f!==fm&&(s=Error(a(423),{cause:f}),bc(Ir(s,c))),r=r.current.alternate,r.flags|=65536,x&=-x,r.lanes|=x,f=Ir(f,c),x=Km(r.stateNode,f,x),Cm(r,x),gn!==4&&(gn=2)),!1;var y=Error(a(520),{cause:f});if(y=Ir(y,c),zc===null?zc=[y]:zc.push(y),gn!==4&&(gn=2),s===null)return!0;f=Ir(f,c),c=s;do{switch(c.tag){case 3:return c.flags|=65536,r=x&-x,c.lanes|=r,r=Km(c.stateNode,f,r),Cm(c,r),!1;case 1:if(s=c.type,y=c.stateNode,(c.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Zs===null||!Zs.has(y))))return c.flags|=65536,x&=-x,c.lanes|=x,x=QC(x),ZC(x,r,c,f),Cm(c,x),!1}c=c.return}while(c!==null);return!1}var Ym=Error(a(461)),Cn=!1;function In(r,s,c,f){s.child=r===null?nC(s,null,c,f):Hi(s,r.child,c,f)}function JC(r,s,c,f,x){c=c.render;var y=s.ref;if("ref"in f){var E={};for(var M in f)M!=="ref"&&(E[M]=f[M])}else E=f;return Bi(s),f=Rm(r,s,c,E,y,x),M=Am(),r!==null&&!Cn?(Om(r,s,x),ss(r,s,x)):(Ft&&M&&um(s),s.flags|=1,In(r,s,f,x),s.child)}function ej(r,s,c,f,x){if(r===null){var y=c.type;return typeof y=="function"&&!om(y)&&y.defaultProps===void 0&&c.compare===null?(s.tag=15,s.type=y,tj(r,s,y,f,x)):(r=Od(c.type,null,f,s,s.mode,x),r.ref=s.ref,r.return=s,s.child=r)}if(y=r.child,!ng(r,x)){var E=y.memoizedProps;if(c=c.compare,c=c!==null?c:vc,c(E,f)&&r.ref===s.ref)return ss(r,s,x)}return s.flags|=1,r=Ja(y,f),r.ref=s.ref,r.return=s,s.child=r}function tj(r,s,c,f,x){if(r!==null){var y=r.memoizedProps;if(vc(y,f)&&r.ref===s.ref)if(Cn=!1,s.pendingProps=f=y,ng(r,x))(r.flags&131072)!==0&&(Cn=!0);else return s.lanes=r.lanes,ss(r,s,x)}return Wm(r,s,c,f,x)}function nj(r,s,c,f){var x=f.children,y=r!==null?r.memoizedState:null;if(r===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((s.flags&128)!==0){if(y=y!==null?y.baseLanes|c:c,r!==null){for(f=s.child=r.child,x=0;f!==null;)x=x|f.lanes|f.childLanes,f=f.sibling;f=x&~y}else f=0,s.child=null;return rj(r,s,y,c,f)}if((c&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},r!==null&&kd(s,y!==null?y.cachePool:null),y!==null?sC(s,y):Nm(),iC(s);else return f=s.lanes=536870912,rj(r,s,y!==null?y.baseLanes|c:c,c,f)}else y!==null?(kd(s,y.cachePool),sC(s,y),Ys(),s.memoizedState=null):(r!==null&&kd(s,null),Nm(),Ys());return In(r,s,x,c),s.child}function Mc(r,s){return r!==null&&r.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function rj(r,s,c,f,x){var y=ym();return y=y===null?null:{parent:wn._currentValue,pool:y},s.memoizedState={baseLanes:c,cachePool:y},r!==null&&kd(s,null),Nm(),iC(s),r!==null&&jo(r,s,f,!0),s.childLanes=x,null}function Qd(r,s){return s=Jd({mode:s.mode,children:s.children},r.mode),s.ref=r.ref,r.child=s,s.return=r,s}function aj(r,s,c){return Hi(s,r.child,null,c),r=Qd(s,s.pendingProps),r.flags|=2,Cr(s),s.memoizedState=null,r}function aB(r,s,c){var f=s.pendingProps,x=(s.flags&128)!==0;if(s.flags&=-129,r===null){if(Ft){if(f.mode==="hidden")return r=Qd(s,f),s.lanes=536870912,Mc(null,r);if(Em(s),(r=sn)?(r=gN(r,Hr),r=r!==null&&r.data==="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:Fs!==null?{id:Ea,overflow:Ta}:null,retryLane:536870912,hydrationErrors:null},c=H1(r),c.return=s,s.child=c,Ln=s,sn=null)):r=null,r===null)throw Us(s);return s.lanes=536870912,null}return Qd(s,f)}var y=r.memoizedState;if(y!==null){var E=y.dehydrated;if(Em(s),x)if(s.flags&256)s.flags&=-257,s=aj(r,s,c);else if(s.memoizedState!==null)s.child=r.child,s.flags|=128,s=null;else throw Error(a(558));else if(Cn||jo(r,s,c,!1),x=(c&r.childLanes)!==0,Cn||x){if(f=nn,f!==null&&(E=we(f,c),E!==0&&E!==y.retryLane))throw y.retryLane=E,Di(r,E),fr(f,r,E),Ym;cf(),s=aj(r,s,c)}else r=y.treeContext,sn=qr(E.nextSibling),Ln=s,Ft=!0,Hs=null,Hr=!1,r!==null&&V1(s,r),s=Qd(s,f),s.flags|=4096;return s}return r=Ja(r.child,{mode:f.mode,children:f.children}),r.ref=s.ref,s.child=r,r.return=s,r}function Zd(r,s){var c=s.ref;if(c===null)r!==null&&r.ref!==null&&(s.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(a(284));(r===null||r.ref!==c)&&(s.flags|=4194816)}}function Wm(r,s,c,f,x){return Bi(s),c=Rm(r,s,c,f,void 0,x),f=Am(),r!==null&&!Cn?(Om(r,s,x),ss(r,s,x)):(Ft&&f&&um(s),s.flags|=1,In(r,s,c,x),s.child)}function sj(r,s,c,f,x,y){return Bi(s),s.updateQueue=null,c=lC(s,f,c,x),oC(r),f=Am(),r!==null&&!Cn?(Om(r,s,y),ss(r,s,y)):(Ft&&f&&um(s),s.flags|=1,In(r,s,c,y),s.child)}function ij(r,s,c,f,x){if(Bi(s),s.stateNode===null){var y=bo,E=c.contextType;typeof E=="object"&&E!==null&&(y=Bn(E)),y=new c(f,y),s.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Gm,s.stateNode=y,y._reactInternals=s,y=s.stateNode,y.props=f,y.state=s.memoizedState,y.refs={},wm(s),E=c.contextType,y.context=typeof E=="object"&&E!==null?Bn(E):bo,y.state=s.memoizedState,E=c.getDerivedStateFromProps,typeof E=="function"&&($m(s,c,E,f),y.state=s.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(E=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),E!==y.state&&Gm.enqueueReplaceState(y,y.state,null),Ec(s,f,y,x),_c(),y.state=s.memoizedState),typeof y.componentDidMount=="function"&&(s.flags|=4194308),f=!0}else if(r===null){y=s.stateNode;var M=s.memoizedProps,F=qi(c,M);y.props=F;var ae=y.context,ge=c.contextType;E=bo,typeof ge=="object"&&ge!==null&&(E=Bn(ge));var ye=c.getDerivedStateFromProps;ge=typeof ye=="function"||typeof y.getSnapshotBeforeUpdate=="function",M=s.pendingProps!==M,ge||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(M||ae!==E)&&GC(s,y,f,E),Vs=!1;var ie=s.memoizedState;y.state=ie,Ec(s,f,y,x),_c(),ae=s.memoizedState,M||ie!==ae||Vs?(typeof ye=="function"&&($m(s,c,ye,f),ae=s.memoizedState),(F=Vs||$C(s,c,F,f,ie,ae,E))?(ge||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(s.flags|=4194308)):(typeof y.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=f,s.memoizedState=ae),y.props=f,y.state=ae,y.context=E,f=F):(typeof y.componentDidMount=="function"&&(s.flags|=4194308),f=!1)}else{y=s.stateNode,Sm(r,s),E=s.memoizedProps,ge=qi(c,E),y.props=ge,ye=s.pendingProps,ie=y.context,ae=c.contextType,F=bo,typeof ae=="object"&&ae!==null&&(F=Bn(ae)),M=c.getDerivedStateFromProps,(ae=typeof M=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(E!==ye||ie!==F)&&GC(s,y,f,F),Vs=!1,ie=s.memoizedState,y.state=ie,Ec(s,f,y,x),_c();var le=s.memoizedState;E!==ye||ie!==le||Vs||r!==null&&r.dependencies!==null&&Dd(r.dependencies)?(typeof M=="function"&&($m(s,c,M,f),le=s.memoizedState),(ge=Vs||$C(s,c,ge,f,ie,le,F)||r!==null&&r.dependencies!==null&&Dd(r.dependencies))?(ae||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(f,le,F),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(f,le,F)),typeof y.componentDidUpdate=="function"&&(s.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof y.componentDidUpdate!="function"||E===r.memoizedProps&&ie===r.memoizedState||(s.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&ie===r.memoizedState||(s.flags|=1024),s.memoizedProps=f,s.memoizedState=le),y.props=f,y.state=le,y.context=F,f=ge):(typeof y.componentDidUpdate!="function"||E===r.memoizedProps&&ie===r.memoizedState||(s.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&ie===r.memoizedState||(s.flags|=1024),f=!1)}return y=f,Zd(r,s),f=(s.flags&128)!==0,y||f?(y=s.stateNode,c=f&&typeof c.getDerivedStateFromError!="function"?null:y.render(),s.flags|=1,r!==null&&f?(s.child=Hi(s,r.child,null,x),s.child=Hi(s,null,c,x)):In(r,s,c,x),s.memoizedState=y.state,r=s.child):r=ss(r,s,x),r}function oj(r,s,c,f){return ki(),s.flags|=256,In(r,s,c,f),s.child}var Xm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qm(r){return{baseLanes:r,cachePool:X1()}}function Zm(r,s,c){return r=r!==null?r.childLanes&~c:0,s&&(r|=Nr),r}function lj(r,s,c){var f=s.pendingProps,x=!1,y=(s.flags&128)!==0,E;if((E=y)||(E=r!==null&&r.memoizedState===null?!1:(yn.current&2)!==0),E&&(x=!0,s.flags&=-129),E=(s.flags&32)!==0,s.flags&=-33,r===null){if(Ft){if(x?Ks(s):Ys(),(r=sn)?(r=gN(r,Hr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:Fs!==null?{id:Ea,overflow:Ta}:null,retryLane:536870912,hydrationErrors:null},c=H1(r),c.return=s,s.child=c,Ln=s,sn=null)):r=null,r===null)throw Us(s);return Pg(r)?s.lanes=32:s.lanes=536870912,null}var M=f.children;return f=f.fallback,x?(Ys(),x=s.mode,M=Jd({mode:"hidden",children:M},x),f=Pi(f,x,c,null),M.return=s,f.return=s,M.sibling=f,s.child=M,f=s.child,f.memoizedState=Qm(c),f.childLanes=Zm(r,E,c),s.memoizedState=Xm,Mc(null,f)):(Ks(s),Jm(s,M))}var F=r.memoizedState;if(F!==null&&(M=F.dehydrated,M!==null)){if(y)s.flags&256?(Ks(s),s.flags&=-257,s=eg(r,s,c)):s.memoizedState!==null?(Ys(),s.child=r.child,s.flags|=128,s=null):(Ys(),M=f.fallback,x=s.mode,f=Jd({mode:"visible",children:f.children},x),M=Pi(M,x,c,null),M.flags|=2,f.return=s,M.return=s,f.sibling=M,s.child=f,Hi(s,r.child,null,c),f=s.child,f.memoizedState=Qm(c),f.childLanes=Zm(r,E,c),s.memoizedState=Xm,s=Mc(null,f));else if(Ks(s),Pg(M)){if(E=M.nextSibling&&M.nextSibling.dataset,E)var ae=E.dgst;E=ae,f=Error(a(419)),f.stack="",f.digest=E,bc({value:f,source:null,stack:null}),s=eg(r,s,c)}else if(Cn||jo(r,s,c,!1),E=(c&r.childLanes)!==0,Cn||E){if(E=nn,E!==null&&(f=we(E,c),f!==0&&f!==F.retryLane))throw F.retryLane=f,Di(r,f),fr(E,r,f),Ym;Dg(M)||cf(),s=eg(r,s,c)}else Dg(M)?(s.flags|=192,s.child=r.child,s=null):(r=F.treeContext,sn=qr(M.nextSibling),Ln=s,Ft=!0,Hs=null,Hr=!1,r!==null&&V1(s,r),s=Jm(s,f.children),s.flags|=4096);return s}return x?(Ys(),M=f.fallback,x=s.mode,F=r.child,ae=F.sibling,f=Ja(F,{mode:"hidden",children:f.children}),f.subtreeFlags=F.subtreeFlags&65011712,ae!==null?M=Ja(ae,M):(M=Pi(M,x,c,null),M.flags|=2),M.return=s,f.return=s,f.sibling=M,s.child=f,Mc(null,f),f=s.child,M=r.child.memoizedState,M===null?M=Qm(c):(x=M.cachePool,x!==null?(F=wn._currentValue,x=x.parent!==F?{parent:F,pool:F}:x):x=X1(),M={baseLanes:M.baseLanes|c,cachePool:x}),f.memoizedState=M,f.childLanes=Zm(r,E,c),s.memoizedState=Xm,Mc(r.child,f)):(Ks(s),c=r.child,r=c.sibling,c=Ja(c,{mode:"visible",children:f.children}),c.return=s,c.sibling=null,r!==null&&(E=s.deletions,E===null?(s.deletions=[r],s.flags|=16):E.push(r)),s.child=c,s.memoizedState=null,c)}function Jm(r,s){return s=Jd({mode:"visible",children:s},r.mode),s.return=r,r.child=s}function Jd(r,s){return r=wr(22,r,null,s),r.lanes=0,r}function eg(r,s,c){return Hi(s,r.child,null,c),r=Jm(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function cj(r,s,c){r.lanes|=s;var f=r.alternate;f!==null&&(f.lanes|=s),mm(r.return,s,c)}function tg(r,s,c,f,x,y){var E=r.memoizedState;E===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:f,tail:c,tailMode:x,treeForkCount:y}:(E.isBackwards=s,E.rendering=null,E.renderingStartTime=0,E.last=f,E.tail=c,E.tailMode=x,E.treeForkCount=y)}function uj(r,s,c){var f=s.pendingProps,x=f.revealOrder,y=f.tail;f=f.children;var E=yn.current,M=(E&2)!==0;if(M?(E=E&1|2,s.flags|=128):E&=1,X(yn,E),In(r,s,f,c),f=Ft?yc:0,!M&&r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&cj(r,c,s);else if(r.tag===19)cj(r,c,s);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(x){case"forwards":for(c=s.child,x=null;c!==null;)r=c.alternate,r!==null&&Hd(r)===null&&(x=c),c=c.sibling;c=x,c===null?(x=s.child,s.child=null):(x=c.sibling,c.sibling=null),tg(s,!1,x,c,y,f);break;case"backwards":case"unstable_legacy-backwards":for(c=null,x=s.child,s.child=null;x!==null;){if(r=x.alternate,r!==null&&Hd(r)===null){s.child=x;break}r=x.sibling,x.sibling=c,c=x,x=r}tg(s,!0,c,null,y,f);break;case"together":tg(s,!1,null,null,void 0,f);break;default:s.memoizedState=null}return s.child}function ss(r,s,c){if(r!==null&&(s.dependencies=r.dependencies),Qs|=s.lanes,(c&s.childLanes)===0)if(r!==null){if(jo(r,s,c,!1),(c&s.childLanes)===0)return null}else return null;if(r!==null&&s.child!==r.child)throw Error(a(153));if(s.child!==null){for(r=s.child,c=Ja(r,r.pendingProps),s.child=c,c.return=s;r.sibling!==null;)r=r.sibling,c=c.sibling=Ja(r,r.pendingProps),c.return=s;c.sibling=null}return s.child}function ng(r,s){return(r.lanes&s)!==0?!0:(r=r.dependencies,!!(r!==null&&Dd(r)))}function sB(r,s,c){switch(s.tag){case 3:he(s,s.stateNode.containerInfo),qs(s,wn,r.memoizedState.cache),ki();break;case 27:case 5:je(s);break;case 4:he(s,s.stateNode.containerInfo);break;case 10:qs(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Em(s),null;break;case 13:var f=s.memoizedState;if(f!==null)return f.dehydrated!==null?(Ks(s),s.flags|=128,null):(c&s.child.childLanes)!==0?lj(r,s,c):(Ks(s),r=ss(r,s,c),r!==null?r.sibling:null);Ks(s);break;case 19:var x=(r.flags&128)!==0;if(f=(c&s.childLanes)!==0,f||(jo(r,s,c,!1),f=(c&s.childLanes)!==0),x){if(f)return uj(r,s,c);s.flags|=128}if(x=s.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),X(yn,yn.current),f)break;return null;case 22:return s.lanes=0,nj(r,s,c,s.pendingProps);case 24:qs(s,wn,r.memoizedState.cache)}return ss(r,s,c)}function dj(r,s,c){if(r!==null)if(r.memoizedProps!==s.pendingProps)Cn=!0;else{if(!ng(r,c)&&(s.flags&128)===0)return Cn=!1,sB(r,s,c);Cn=(r.flags&131072)!==0}else Cn=!1,Ft&&(s.flags&1048576)!==0&&q1(s,yc,s.index);switch(s.lanes=0,s.tag){case 16:e:{var f=s.pendingProps;if(r=zi(s.elementType),s.type=r,typeof r=="function")om(r)?(f=qi(r,f),s.tag=1,s=ij(null,s,r,f,c)):(s.tag=0,s=Wm(null,s,r,f,c));else{if(r!=null){var x=r.$$typeof;if(x===A){s.tag=11,s=JC(null,s,r,f,c);break e}else if(x===k){s.tag=14,s=ej(null,s,r,f,c);break e}}throw s=Se(r)||r,Error(a(306,s,""))}}return s;case 0:return Wm(r,s,s.type,s.pendingProps,c);case 1:return f=s.type,x=qi(f,s.pendingProps),ij(r,s,f,x,c);case 3:e:{if(he(s,s.stateNode.containerInfo),r===null)throw Error(a(387));f=s.pendingProps;var y=s.memoizedState;x=y.element,Sm(r,s),Ec(s,f,null,c);var E=s.memoizedState;if(f=E.cache,qs(s,wn,f),f!==y.cache&&gm(s,[wn],c,!0),_c(),f=E.element,y.isDehydrated)if(y={element:f,isDehydrated:!1,cache:E.cache},s.updateQueue.baseState=y,s.memoizedState=y,s.flags&256){s=oj(r,s,f,c);break e}else if(f!==x){x=Ir(Error(a(424)),s),bc(x),s=oj(r,s,f,c);break e}else for(r=s.stateNode.containerInfo,r.nodeType===9?r=r.body:r=r.nodeName==="HTML"?r.ownerDocument.body:r,sn=qr(r.firstChild),Ln=s,Ft=!0,Hs=null,Hr=!0,c=nC(s,null,f,c),s.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(ki(),f===x){s=ss(r,s,c);break e}In(r,s,f,c)}s=s.child}return s;case 26:return Zd(r,s),r===null?(c=SN(s.type,null,s.pendingProps,null))?s.memoizedState=c:Ft||(c=s.type,r=s.pendingProps,f=gf(Q.current).createElement(c),f[Tt]=s,f[it]=r,zn(f,c,r),xn(f),s.stateNode=f):s.memoizedState=SN(s.type,r.memoizedProps,s.pendingProps,r.memoizedState),null;case 27:return je(s),r===null&&Ft&&(f=s.stateNode=yN(s.type,s.pendingProps,Q.current),Ln=s,Hr=!0,x=sn,ni(s.type)?(kg=x,sn=qr(f.firstChild)):sn=x),In(r,s,s.pendingProps.children,c),Zd(r,s),r===null&&(s.flags|=4194304),s.child;case 5:return r===null&&Ft&&((x=f=sn)&&(f=kB(f,s.type,s.pendingProps,Hr),f!==null?(s.stateNode=f,Ln=s,sn=qr(f.firstChild),Hr=!1,x=!0):x=!1),x||Us(s)),je(s),x=s.type,y=s.pendingProps,E=r!==null?r.memoizedProps:null,f=y.children,Ag(x,y)?f=null:E!==null&&Ag(x,E)&&(s.flags|=32),s.memoizedState!==null&&(x=Rm(r,s,X4,null,null,c),Kc._currentValue=x),Zd(r,s),In(r,s,f,c),s.child;case 6:return r===null&&Ft&&((r=c=sn)&&(c=LB(c,s.pendingProps,Hr),c!==null?(s.stateNode=c,Ln=s,sn=null,r=!0):r=!1),r||Us(s)),null;case 13:return lj(r,s,c);case 4:return he(s,s.stateNode.containerInfo),f=s.pendingProps,r===null?s.child=Hi(s,null,f,c):In(r,s,f,c),s.child;case 11:return JC(r,s,s.type,s.pendingProps,c);case 7:return In(r,s,s.pendingProps,c),s.child;case 8:return In(r,s,s.pendingProps.children,c),s.child;case 12:return In(r,s,s.pendingProps.children,c),s.child;case 10:return f=s.pendingProps,qs(s,s.type,f.value),In(r,s,f.children,c),s.child;case 9:return x=s.type._context,f=s.pendingProps.children,Bi(s),x=Bn(x),f=f(x),s.flags|=1,In(r,s,f,c),s.child;case 14:return ej(r,s,s.type,s.pendingProps,c);case 15:return tj(r,s,s.type,s.pendingProps,c);case 19:return uj(r,s,c);case 31:return aB(r,s,c);case 22:return nj(r,s,c,s.pendingProps);case 24:return Bi(s),f=Bn(wn),r===null?(x=ym(),x===null&&(x=nn,y=vm(),x.pooledCache=y,y.refCount++,y!==null&&(x.pooledCacheLanes|=c),x=y),s.memoizedState={parent:f,cache:x},wm(s),qs(s,wn,x)):((r.lanes&c)!==0&&(Sm(r,s),Ec(s,null,null,c),_c()),x=r.memoizedState,y=s.memoizedState,x.parent!==f?(x={parent:f,cache:f},s.memoizedState=x,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=x),qs(s,wn,f)):(f=y.cache,qs(s,wn,f),f!==x.cache&&gm(s,[wn],c,!0))),In(r,s,s.pendingProps.children,c),s.child;case 29:throw s.pendingProps}throw Error(a(156,s.tag))}function is(r){r.flags|=4}function rg(r,s,c,f,x){if((s=(r.mode&32)!==0)&&(s=!1),s){if(r.flags|=16777216,(x&335544128)===x)if(r.stateNode.complete)r.flags|=8192;else if(Ij())r.flags|=8192;else throw Fi=Bd,bm}else r.flags&=-16777217}function fj(r,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!EN(s))if(Ij())r.flags|=8192;else throw Fi=Bd,bm}function ef(r,s){s!==null&&(r.flags|=4),r.flags&16384&&(s=r.tag!==22?me():536870912,r.lanes|=s,Lo|=s)}function Dc(r,s){if(!Ft)switch(r.tailMode){case"hidden":s=r.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:f.sibling=null}}function on(r){var s=r.alternate!==null&&r.alternate.child===r.child,c=0,f=0;if(s)for(var x=r.child;x!==null;)c|=x.lanes|x.childLanes,f|=x.subtreeFlags&65011712,f|=x.flags&65011712,x.return=r,x=x.sibling;else for(x=r.child;x!==null;)c|=x.lanes|x.childLanes,f|=x.subtreeFlags,f|=x.flags,x.return=r,x=x.sibling;return r.subtreeFlags|=f,r.childLanes=c,s}function iB(r,s,c){var f=s.pendingProps;switch(dm(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return on(s),null;case 1:return on(s),null;case 3:return c=s.stateNode,f=null,r!==null&&(f=r.memoizedState.cache),s.memoizedState.cache!==f&&(s.flags|=2048),ns(wn),_e(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(Co(s)?is(s):r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,hm())),on(s),null;case 26:var x=s.type,y=s.memoizedState;return r===null?(is(s),y!==null?(on(s),fj(s,y)):(on(s),rg(s,x,null,f,c))):y?y!==r.memoizedState?(is(s),on(s),fj(s,y)):(on(s),s.flags&=-16777217):(r=r.memoizedProps,r!==f&&is(s),on(s),rg(s,x,r,f,c)),null;case 27:if(Me(s),c=Q.current,x=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==f&&is(s);else{if(!f){if(s.stateNode===null)throw Error(a(166));return on(s),null}r=oe.current,Co(s)?$1(s):(r=yN(x,f,c),s.stateNode=r,is(s))}return on(s),null;case 5:if(Me(s),x=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==f&&is(s);else{if(!f){if(s.stateNode===null)throw Error(a(166));return on(s),null}if(y=oe.current,Co(s))$1(s);else{var E=gf(Q.current);switch(y){case 1:y=E.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:y=E.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":y=E.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":y=E.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":y=E.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof f.is=="string"?E.createElement("select",{is:f.is}):E.createElement("select"),f.multiple?y.multiple=!0:f.size&&(y.size=f.size);break;default:y=typeof f.is=="string"?E.createElement(x,{is:f.is}):E.createElement(x)}}y[Tt]=s,y[it]=f;e:for(E=s.child;E!==null;){if(E.tag===5||E.tag===6)y.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===s)break e;for(;E.sibling===null;){if(E.return===null||E.return===s)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}s.stateNode=y;e:switch(zn(y,x,f),x){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&is(s)}}return on(s),rg(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,c),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==f&&is(s);else{if(typeof f!="string"&&s.stateNode===null)throw Error(a(166));if(r=Q.current,Co(s)){if(r=s.stateNode,c=s.memoizedProps,f=null,x=Ln,x!==null)switch(x.tag){case 27:case 5:f=x.memoizedProps}r[Tt]=s,r=!!(r.nodeValue===c||f!==null&&f.suppressHydrationWarning===!0||lN(r.nodeValue,c)),r||Us(s,!0)}else r=gf(r).createTextNode(f),r[Tt]=s,s.stateNode=r}return on(s),null;case 31:if(c=s.memoizedState,r===null||r.memoizedState!==null){if(f=Co(s),c!==null){if(r===null){if(!f)throw Error(a(318));if(r=s.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(557));r[Tt]=s}else ki(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;on(s),r=!1}else c=hm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return s.flags&256?(Cr(s),s):(Cr(s),null);if((s.flags&128)!==0)throw Error(a(558))}return on(s),null;case 13:if(f=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(x=Co(s),f!==null&&f.dehydrated!==null){if(r===null){if(!x)throw Error(a(318));if(x=s.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(a(317));x[Tt]=s}else ki(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;on(s),x=!1}else x=hm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=x),x=!0;if(!x)return s.flags&256?(Cr(s),s):(Cr(s),null)}return Cr(s),(s.flags&128)!==0?(s.lanes=c,s):(c=f!==null,r=r!==null&&r.memoizedState!==null,c&&(f=s.child,x=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(x=f.alternate.memoizedState.cachePool.pool),y=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(y=f.memoizedState.cachePool.pool),y!==x&&(f.flags|=2048)),c!==r&&c&&(s.child.flags|=8192),ef(s,s.updateQueue),on(s),null);case 4:return _e(),r===null&&Ng(s.stateNode.containerInfo),on(s),null;case 10:return ns(s.type),on(s),null;case 19:if(G(yn),f=s.memoizedState,f===null)return on(s),null;if(x=(s.flags&128)!==0,y=f.rendering,y===null)if(x)Dc(f,!1);else{if(gn!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(y=Hd(r),y!==null){for(s.flags|=128,Dc(f,!1),r=y.updateQueue,s.updateQueue=r,ef(s,r),s.subtreeFlags=0,r=c,c=s.child;c!==null;)F1(c,r),c=c.sibling;return X(yn,yn.current&1|2),Ft&&es(s,f.treeForkCount),s.child}r=r.sibling}f.tail!==null&&vt()>sf&&(s.flags|=128,x=!0,Dc(f,!1),s.lanes=4194304)}else{if(!x)if(r=Hd(y),r!==null){if(s.flags|=128,x=!0,r=r.updateQueue,s.updateQueue=r,ef(s,r),Dc(f,!0),f.tail===null&&f.tailMode==="hidden"&&!y.alternate&&!Ft)return on(s),null}else 2*vt()-f.renderingStartTime>sf&&c!==536870912&&(s.flags|=128,x=!0,Dc(f,!1),s.lanes=4194304);f.isBackwards?(y.sibling=s.child,s.child=y):(r=f.last,r!==null?r.sibling=y:s.child=y,f.last=y)}return f.tail!==null?(r=f.tail,f.rendering=r,f.tail=r.sibling,f.renderingStartTime=vt(),r.sibling=null,c=yn.current,X(yn,x?c&1|2:c&1),Ft&&es(s,f.treeForkCount),r):(on(s),null);case 22:case 23:return Cr(s),_m(),f=s.memoizedState!==null,r!==null?r.memoizedState!==null!==f&&(s.flags|=8192):f&&(s.flags|=8192),f?(c&536870912)!==0&&(s.flags&128)===0&&(on(s),s.subtreeFlags&6&&(s.flags|=8192)):on(s),c=s.updateQueue,c!==null&&ef(s,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),f=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(f=s.memoizedState.cachePool.pool),f!==c&&(s.flags|=2048),r!==null&&G(Ii),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),ns(wn),on(s),null;case 25:return null;case 30:return null}throw Error(a(156,s.tag))}function oB(r,s){switch(dm(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return ns(wn),_e(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return Me(s),null;case 31:if(s.memoizedState!==null){if(Cr(s),s.alternate===null)throw Error(a(340));ki()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 13:if(Cr(s),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(a(340));ki()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return G(yn),null;case 4:return _e(),null;case 10:return ns(s.type),null;case 22:case 23:return Cr(s),_m(),r!==null&&G(Ii),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return ns(wn),null;case 25:return null;default:return null}}function hj(r,s){switch(dm(s),s.tag){case 3:ns(wn),_e();break;case 26:case 27:case 5:Me(s);break;case 4:_e();break;case 31:s.memoizedState!==null&&Cr(s);break;case 13:Cr(s);break;case 19:G(yn);break;case 10:ns(s.type);break;case 22:case 23:Cr(s),_m(),r!==null&&G(Ii);break;case 24:ns(wn)}}function Pc(r,s){try{var c=s.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var x=f.next;c=x;do{if((c.tag&r)===r){f=void 0;var y=c.create,E=c.inst;f=y(),E.destroy=f}c=c.next}while(c!==x)}}catch(M){Qt(s,s.return,M)}}function Ws(r,s,c){try{var f=s.updateQueue,x=f!==null?f.lastEffect:null;if(x!==null){var y=x.next;f=y;do{if((f.tag&r)===r){var E=f.inst,M=E.destroy;if(M!==void 0){E.destroy=void 0,x=s;var F=c,ae=M;try{ae()}catch(ge){Qt(x,F,ge)}}}f=f.next}while(f!==y)}}catch(ge){Qt(s,s.return,ge)}}function pj(r){var s=r.updateQueue;if(s!==null){var c=r.stateNode;try{aC(s,c)}catch(f){Qt(r,r.return,f)}}}function mj(r,s,c){c.props=qi(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(f){Qt(r,s,f)}}function kc(r,s){try{var c=r.ref;if(c!==null){switch(r.tag){case 26:case 27:case 5:var f=r.stateNode;break;case 30:f=r.stateNode;break;default:f=r.stateNode}typeof c=="function"?r.refCleanup=c(f):c.current=f}}catch(x){Qt(r,s,x)}}function Ra(r,s){var c=r.ref,f=r.refCleanup;if(c!==null)if(typeof f=="function")try{f()}catch(x){Qt(r,s,x)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(x){Qt(r,s,x)}else c.current=null}function gj(r){var s=r.type,c=r.memoizedProps,f=r.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":c.autoFocus&&f.focus();break e;case"img":c.src?f.src=c.src:c.srcSet&&(f.srcset=c.srcSet)}}catch(x){Qt(r,r.return,x)}}function ag(r,s,c){try{var f=r.stateNode;RB(f,r.type,c,s),f[it]=s}catch(x){Qt(r,r.return,x)}}function vj(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&ni(r.type)||r.tag===4}function sg(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||vj(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&ni(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function ig(r,s,c){var f=r.tag;if(f===5||f===6)r=r.stateNode,s?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(r,s):(s=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,s.appendChild(r),c=c._reactRootContainer,c!=null||s.onclick!==null||(s.onclick=kt));else if(f!==4&&(f===27&&ni(r.type)&&(c=r.stateNode,s=null),r=r.child,r!==null))for(ig(r,s,c),r=r.sibling;r!==null;)ig(r,s,c),r=r.sibling}function tf(r,s,c){var f=r.tag;if(f===5||f===6)r=r.stateNode,s?c.insertBefore(r,s):c.appendChild(r);else if(f!==4&&(f===27&&ni(r.type)&&(c=r.stateNode),r=r.child,r!==null))for(tf(r,s,c),r=r.sibling;r!==null;)tf(r,s,c),r=r.sibling}function xj(r){var s=r.stateNode,c=r.memoizedProps;try{for(var f=r.type,x=s.attributes;x.length;)s.removeAttributeNode(x[0]);zn(s,f,c),s[Tt]=r,s[it]=c}catch(y){Qt(r,r.return,y)}}var os=!1,jn=!1,og=!1,yj=typeof WeakSet=="function"?WeakSet:Set,Dn=null;function lB(r,s){if(r=r.containerInfo,Tg=Cf,r=O1(r),em(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var f=c.getSelection&&c.getSelection();if(f&&f.rangeCount!==0){c=f.anchorNode;var x=f.anchorOffset,y=f.focusNode;f=f.focusOffset;try{c.nodeType,y.nodeType}catch{c=null;break e}var E=0,M=-1,F=-1,ae=0,ge=0,ye=r,ie=null;t:for(;;){for(var le;ye!==c||x!==0&&ye.nodeType!==3||(M=E+x),ye!==y||f!==0&&ye.nodeType!==3||(F=E+f),ye.nodeType===3&&(E+=ye.nodeValue.length),(le=ye.firstChild)!==null;)ie=ye,ye=le;for(;;){if(ye===r)break t;if(ie===c&&++ae===x&&(M=E),ie===y&&++ge===f&&(F=E),(le=ye.nextSibling)!==null)break;ye=ie,ie=ye.parentNode}ye=le}c=M===-1||F===-1?null:{start:M,end:F}}else c=null}c=c||{start:0,end:0}}else c=null;for(Rg={focusedElem:r,selectionRange:c},Cf=!1,Dn=s;Dn!==null;)if(s=Dn,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,Dn=r;else for(;Dn!==null;){switch(s=Dn,y=s.alternate,r=s.flags,s.tag){case 0:if((r&4)!==0&&(r=s.updateQueue,r=r!==null?r.events:null,r!==null))for(c=0;c<r.length;c++)x=r[c],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&y!==null){r=void 0,c=s,x=y.memoizedProps,y=y.memoizedState,f=c.stateNode;try{var Fe=qi(c.type,x);r=f.getSnapshotBeforeUpdate(Fe,y),f.__reactInternalSnapshotBeforeUpdate=r}catch(rt){Qt(c,c.return,rt)}}break;case 3:if((r&1024)!==0){if(r=s.stateNode.containerInfo,c=r.nodeType,c===9)Mg(r);else if(c===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Mg(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(a(163))}if(r=s.sibling,r!==null){r.return=s.return,Dn=r;break}Dn=s.return}}function bj(r,s,c){var f=c.flags;switch(c.tag){case 0:case 11:case 15:cs(r,c),f&4&&Pc(5,c);break;case 1:if(cs(r,c),f&4)if(r=c.stateNode,s===null)try{r.componentDidMount()}catch(E){Qt(c,c.return,E)}else{var x=qi(c.type,s.memoizedProps);s=s.memoizedState;try{r.componentDidUpdate(x,s,r.__reactInternalSnapshotBeforeUpdate)}catch(E){Qt(c,c.return,E)}}f&64&&pj(c),f&512&&kc(c,c.return);break;case 3:if(cs(r,c),f&64&&(r=c.updateQueue,r!==null)){if(s=null,c.child!==null)switch(c.child.tag){case 27:case 5:s=c.child.stateNode;break;case 1:s=c.child.stateNode}try{aC(r,s)}catch(E){Qt(c,c.return,E)}}break;case 27:s===null&&f&4&&xj(c);case 26:case 5:cs(r,c),s===null&&f&4&&gj(c),f&512&&kc(c,c.return);break;case 12:cs(r,c);break;case 31:cs(r,c),f&4&&Cj(r,c);break;case 13:cs(r,c),f&4&&jj(r,c),f&64&&(r=c.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(c=vB.bind(null,c),BB(r,c))));break;case 22:if(f=c.memoizedState!==null||os,!f){s=s!==null&&s.memoizedState!==null||jn,x=os;var y=jn;os=f,(jn=s)&&!y?us(r,c,(c.subtreeFlags&8772)!==0):cs(r,c),os=x,jn=y}break;case 30:break;default:cs(r,c)}}function wj(r){var s=r.alternate;s!==null&&(r.alternate=null,wj(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&Jl(s)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var cn=null,lr=!1;function ls(r,s,c){for(c=c.child;c!==null;)Sj(r,s,c),c=c.sibling}function Sj(r,s,c){if(gt&&typeof gt.onCommitFiberUnmount=="function")try{gt.onCommitFiberUnmount(mt,c)}catch{}switch(c.tag){case 26:jn||Ra(c,s),ls(r,s,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:jn||Ra(c,s);var f=cn,x=lr;ni(c.type)&&(cn=c.stateNode,lr=!1),ls(r,s,c),Vc(c.stateNode),cn=f,lr=x;break;case 5:jn||Ra(c,s);case 6:if(f=cn,x=lr,cn=null,ls(r,s,c),cn=f,lr=x,cn!==null)if(lr)try{(cn.nodeType===9?cn.body:cn.nodeName==="HTML"?cn.ownerDocument.body:cn).removeChild(c.stateNode)}catch(y){Qt(c,s,y)}else try{cn.removeChild(c.stateNode)}catch(y){Qt(c,s,y)}break;case 18:cn!==null&&(lr?(r=cn,pN(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,c.stateNode),Vo(r)):pN(cn,c.stateNode));break;case 4:f=cn,x=lr,cn=c.stateNode.containerInfo,lr=!0,ls(r,s,c),cn=f,lr=x;break;case 0:case 11:case 14:case 15:Ws(2,c,s),jn||Ws(4,c,s),ls(r,s,c);break;case 1:jn||(Ra(c,s),f=c.stateNode,typeof f.componentWillUnmount=="function"&&mj(c,s,f)),ls(r,s,c);break;case 21:ls(r,s,c);break;case 22:jn=(f=jn)||c.memoizedState!==null,ls(r,s,c),jn=f;break;default:ls(r,s,c)}}function Cj(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{Vo(r)}catch(c){Qt(s,s.return,c)}}}function jj(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{Vo(r)}catch(c){Qt(s,s.return,c)}}function cB(r){switch(r.tag){case 31:case 13:case 19:var s=r.stateNode;return s===null&&(s=r.stateNode=new yj),s;case 22:return r=r.stateNode,s=r._retryCache,s===null&&(s=r._retryCache=new yj),s;default:throw Error(a(435,r.tag))}}function nf(r,s){var c=cB(r);s.forEach(function(f){if(!c.has(f)){c.add(f);var x=xB.bind(null,r,f);f.then(x,x)}})}function cr(r,s){var c=s.deletions;if(c!==null)for(var f=0;f<c.length;f++){var x=c[f],y=r,E=s,M=E;e:for(;M!==null;){switch(M.tag){case 27:if(ni(M.type)){cn=M.stateNode,lr=!1;break e}break;case 5:cn=M.stateNode,lr=!1;break e;case 3:case 4:cn=M.stateNode.containerInfo,lr=!0;break e}M=M.return}if(cn===null)throw Error(a(160));Sj(y,E,x),cn=null,lr=!1,y=x.alternate,y!==null&&(y.return=null),x.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Nj(s,r),s=s.sibling}var ra=null;function Nj(r,s){var c=r.alternate,f=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:cr(s,r),ur(r),f&4&&(Ws(3,r,r.return),Pc(3,r),Ws(5,r,r.return));break;case 1:cr(s,r),ur(r),f&512&&(jn||c===null||Ra(c,c.return)),f&64&&os&&(r=r.updateQueue,r!==null&&(f=r.callbacks,f!==null&&(c=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=c===null?f:c.concat(f))));break;case 26:var x=ra;if(cr(s,r),ur(r),f&512&&(jn||c===null||Ra(c,c.return)),f&4){var y=c!==null?c.memoizedState:null;if(f=r.memoizedState,c===null)if(f===null)if(r.stateNode===null){e:{f=r.type,c=r.memoizedProps,x=x.ownerDocument||x;t:switch(f){case"title":y=x.getElementsByTagName("title")[0],(!y||y[Ka]||y[Tt]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=x.createElement(f),x.head.insertBefore(y,x.querySelector("head > title"))),zn(y,f,c),y[Tt]=r,xn(y),f=y;break e;case"link":var E=NN("link","href",x).get(f+(c.href||""));if(E){for(var M=0;M<E.length;M++)if(y=E[M],y.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&y.getAttribute("rel")===(c.rel==null?null:c.rel)&&y.getAttribute("title")===(c.title==null?null:c.title)&&y.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){E.splice(M,1);break t}}y=x.createElement(f),zn(y,f,c),x.head.appendChild(y);break;case"meta":if(E=NN("meta","content",x).get(f+(c.content||""))){for(M=0;M<E.length;M++)if(y=E[M],y.getAttribute("content")===(c.content==null?null:""+c.content)&&y.getAttribute("name")===(c.name==null?null:c.name)&&y.getAttribute("property")===(c.property==null?null:c.property)&&y.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&y.getAttribute("charset")===(c.charSet==null?null:c.charSet)){E.splice(M,1);break t}}y=x.createElement(f),zn(y,f,c),x.head.appendChild(y);break;default:throw Error(a(468,f))}y[Tt]=r,xn(y),f=y}r.stateNode=f}else _N(x,r.type,r.stateNode);else r.stateNode=jN(x,f,r.memoizedProps);else y!==f?(y===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):y.count--,f===null?_N(x,r.type,r.stateNode):jN(x,f,r.memoizedProps)):f===null&&r.stateNode!==null&&ag(r,r.memoizedProps,c.memoizedProps)}break;case 27:cr(s,r),ur(r),f&512&&(jn||c===null||Ra(c,c.return)),c!==null&&f&4&&ag(r,r.memoizedProps,c.memoizedProps);break;case 5:if(cr(s,r),ur(r),f&512&&(jn||c===null||Ra(c,c.return)),r.flags&32){x=r.stateNode;try{_a(x,"")}catch(Fe){Qt(r,r.return,Fe)}}f&4&&r.stateNode!=null&&(x=r.memoizedProps,ag(r,x,c!==null?c.memoizedProps:x)),f&1024&&(og=!0);break;case 6:if(cr(s,r),ur(r),f&4){if(r.stateNode===null)throw Error(a(162));f=r.memoizedProps,c=r.stateNode;try{c.nodeValue=f}catch(Fe){Qt(r,r.return,Fe)}}break;case 3:if(yf=null,x=ra,ra=vf(s.containerInfo),cr(s,r),ra=x,ur(r),f&4&&c!==null&&c.memoizedState.isDehydrated)try{Vo(s.containerInfo)}catch(Fe){Qt(r,r.return,Fe)}og&&(og=!1,_j(r));break;case 4:f=ra,ra=vf(r.stateNode.containerInfo),cr(s,r),ur(r),ra=f;break;case 12:cr(s,r),ur(r);break;case 31:cr(s,r),ur(r),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,nf(r,f)));break;case 13:cr(s,r),ur(r),r.child.flags&8192&&r.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(af=vt()),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,nf(r,f)));break;case 22:x=r.memoizedState!==null;var F=c!==null&&c.memoizedState!==null,ae=os,ge=jn;if(os=ae||x,jn=ge||F,cr(s,r),jn=ge,os=ae,ur(r),f&8192)e:for(s=r.stateNode,s._visibility=x?s._visibility&-2:s._visibility|1,x&&(c===null||F||os||jn||Vi(r)),c=null,s=r;;){if(s.tag===5||s.tag===26){if(c===null){F=c=s;try{if(y=F.stateNode,x)E=y.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{M=F.stateNode;var ye=F.memoizedProps.style,ie=ye!=null&&ye.hasOwnProperty("display")?ye.display:null;M.style.display=ie==null||typeof ie=="boolean"?"":(""+ie).trim()}}catch(Fe){Qt(F,F.return,Fe)}}}else if(s.tag===6){if(c===null){F=s;try{F.stateNode.nodeValue=x?"":F.memoizedProps}catch(Fe){Qt(F,F.return,Fe)}}}else if(s.tag===18){if(c===null){F=s;try{var le=F.stateNode;x?mN(le,!0):mN(F.stateNode,!1)}catch(Fe){Qt(F,F.return,Fe)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===r)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;c===s&&(c=null),s=s.return}c===s&&(c=null),s.sibling.return=s.return,s=s.sibling}f&4&&(f=r.updateQueue,f!==null&&(c=f.retryQueue,c!==null&&(f.retryQueue=null,nf(r,c))));break;case 19:cr(s,r),ur(r),f&4&&(f=r.updateQueue,f!==null&&(r.updateQueue=null,nf(r,f)));break;case 30:break;case 21:break;default:cr(s,r),ur(r)}}function ur(r){var s=r.flags;if(s&2){try{for(var c,f=r.return;f!==null;){if(vj(f)){c=f;break}f=f.return}if(c==null)throw Error(a(160));switch(c.tag){case 27:var x=c.stateNode,y=sg(r);tf(r,y,x);break;case 5:var E=c.stateNode;c.flags&32&&(_a(E,""),c.flags&=-33);var M=sg(r);tf(r,M,E);break;case 3:case 4:var F=c.stateNode.containerInfo,ae=sg(r);ig(r,ae,F);break;default:throw Error(a(161))}}catch(ge){Qt(r,r.return,ge)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function _j(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var s=r;_j(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),r=r.sibling}}function cs(r,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)bj(r,s.alternate,s),s=s.sibling}function Vi(r){for(r=r.child;r!==null;){var s=r;switch(s.tag){case 0:case 11:case 14:case 15:Ws(4,s,s.return),Vi(s);break;case 1:Ra(s,s.return);var c=s.stateNode;typeof c.componentWillUnmount=="function"&&mj(s,s.return,c),Vi(s);break;case 27:Vc(s.stateNode);case 26:case 5:Ra(s,s.return),Vi(s);break;case 22:s.memoizedState===null&&Vi(s);break;case 30:Vi(s);break;default:Vi(s)}r=r.sibling}}function us(r,s,c){for(c=c&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var f=s.alternate,x=r,y=s,E=y.flags;switch(y.tag){case 0:case 11:case 15:us(x,y,c),Pc(4,y);break;case 1:if(us(x,y,c),f=y,x=f.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(ae){Qt(f,f.return,ae)}if(f=y,x=f.updateQueue,x!==null){var M=f.stateNode;try{var F=x.shared.hiddenCallbacks;if(F!==null)for(x.shared.hiddenCallbacks=null,x=0;x<F.length;x++)rC(F[x],M)}catch(ae){Qt(f,f.return,ae)}}c&&E&64&&pj(y),kc(y,y.return);break;case 27:xj(y);case 26:case 5:us(x,y,c),c&&f===null&&E&4&&gj(y),kc(y,y.return);break;case 12:us(x,y,c);break;case 31:us(x,y,c),c&&E&4&&Cj(x,y);break;case 13:us(x,y,c),c&&E&4&&jj(x,y);break;case 22:y.memoizedState===null&&us(x,y,c),kc(y,y.return);break;case 30:break;default:us(x,y,c)}s=s.sibling}}function lg(r,s){var c=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),r=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(r=s.memoizedState.cachePool.pool),r!==c&&(r!=null&&r.refCount++,c!=null&&wc(c))}function cg(r,s){r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&wc(r))}function aa(r,s,c,f){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Ej(r,s,c,f),s=s.sibling}function Ej(r,s,c,f){var x=s.flags;switch(s.tag){case 0:case 11:case 15:aa(r,s,c,f),x&2048&&Pc(9,s);break;case 1:aa(r,s,c,f);break;case 3:aa(r,s,c,f),x&2048&&(r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&wc(r)));break;case 12:if(x&2048){aa(r,s,c,f),r=s.stateNode;try{var y=s.memoizedProps,E=y.id,M=y.onPostCommit;typeof M=="function"&&M(E,s.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(F){Qt(s,s.return,F)}}else aa(r,s,c,f);break;case 31:aa(r,s,c,f);break;case 13:aa(r,s,c,f);break;case 23:break;case 22:y=s.stateNode,E=s.alternate,s.memoizedState!==null?y._visibility&2?aa(r,s,c,f):Lc(r,s):y._visibility&2?aa(r,s,c,f):(y._visibility|=2,Do(r,s,c,f,(s.subtreeFlags&10256)!==0||!1)),x&2048&&lg(E,s);break;case 24:aa(r,s,c,f),x&2048&&cg(s.alternate,s);break;default:aa(r,s,c,f)}}function Do(r,s,c,f,x){for(x=x&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var y=r,E=s,M=c,F=f,ae=E.flags;switch(E.tag){case 0:case 11:case 15:Do(y,E,M,F,x),Pc(8,E);break;case 23:break;case 22:var ge=E.stateNode;E.memoizedState!==null?ge._visibility&2?Do(y,E,M,F,x):Lc(y,E):(ge._visibility|=2,Do(y,E,M,F,x)),x&&ae&2048&&lg(E.alternate,E);break;case 24:Do(y,E,M,F,x),x&&ae&2048&&cg(E.alternate,E);break;default:Do(y,E,M,F,x)}s=s.sibling}}function Lc(r,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var c=r,f=s,x=f.flags;switch(f.tag){case 22:Lc(c,f),x&2048&&lg(f.alternate,f);break;case 24:Lc(c,f),x&2048&&cg(f.alternate,f);break;default:Lc(c,f)}s=s.sibling}}var Bc=8192;function Po(r,s,c){if(r.subtreeFlags&Bc)for(r=r.child;r!==null;)Tj(r,s,c),r=r.sibling}function Tj(r,s,c){switch(r.tag){case 26:Po(r,s,c),r.flags&Bc&&r.memoizedState!==null&&WB(c,ra,r.memoizedState,r.memoizedProps);break;case 5:Po(r,s,c);break;case 3:case 4:var f=ra;ra=vf(r.stateNode.containerInfo),Po(r,s,c),ra=f;break;case 22:r.memoizedState===null&&(f=r.alternate,f!==null&&f.memoizedState!==null?(f=Bc,Bc=16777216,Po(r,s,c),Bc=f):Po(r,s,c));break;default:Po(r,s,c)}}function Rj(r){var s=r.alternate;if(s!==null&&(r=s.child,r!==null)){s.child=null;do s=r.sibling,r.sibling=null,r=s;while(r!==null)}}function Ic(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var c=0;c<s.length;c++){var f=s[c];Dn=f,Oj(f,r)}Rj(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Aj(r),r=r.sibling}function Aj(r){switch(r.tag){case 0:case 11:case 15:Ic(r),r.flags&2048&&Ws(9,r,r.return);break;case 3:Ic(r);break;case 12:Ic(r);break;case 22:var s=r.stateNode;r.memoizedState!==null&&s._visibility&2&&(r.return===null||r.return.tag!==13)?(s._visibility&=-3,rf(r)):Ic(r);break;default:Ic(r)}}function rf(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var c=0;c<s.length;c++){var f=s[c];Dn=f,Oj(f,r)}Rj(r)}for(r=r.child;r!==null;){switch(s=r,s.tag){case 0:case 11:case 15:Ws(8,s,s.return),rf(s);break;case 22:c=s.stateNode,c._visibility&2&&(c._visibility&=-3,rf(s));break;default:rf(s)}r=r.sibling}}function Oj(r,s){for(;Dn!==null;){var c=Dn;switch(c.tag){case 0:case 11:case 15:Ws(8,c,s);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var f=c.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:wc(c.memoizedState.cache)}if(f=c.child,f!==null)f.return=c,Dn=f;else e:for(c=r;Dn!==null;){f=Dn;var x=f.sibling,y=f.return;if(wj(f),f===c){Dn=null;break e}if(x!==null){x.return=y,Dn=x;break e}Dn=y}}}var uB={getCacheForType:function(r){var s=Bn(wn),c=s.data.get(r);return c===void 0&&(c=r(),s.data.set(r,c)),c},cacheSignal:function(){return Bn(wn).controller.signal}},dB=typeof WeakMap=="function"?WeakMap:Map,Gt=0,nn=null,Dt=null,Lt=0,Xt=0,jr=null,Xs=!1,ko=!1,ug=!1,ds=0,gn=0,Qs=0,$i=0,dg=0,Nr=0,Lo=0,zc=null,dr=null,fg=!1,af=0,Mj=0,sf=1/0,of=null,Zs=null,En=0,Js=null,Bo=null,fs=0,hg=0,pg=null,Dj=null,Fc=0,mg=null;function _r(){return(Gt&2)!==0&&Lt!==0?Lt&-Lt:I.T!==null?wg():ze()}function Pj(){if(Nr===0)if((Lt&536870912)===0||Ft){var r=Qe;Qe<<=1,(Qe&3932160)===0&&(Qe=262144),Nr=r}else Nr=536870912;return r=Sr.current,r!==null&&(r.flags|=32),Nr}function fr(r,s,c){(r===nn&&(Xt===2||Xt===9)||r.cancelPendingCommit!==null)&&(Io(r,0),ei(r,Lt,Nr,!1)),Ie(r,c),((Gt&2)===0||r!==nn)&&(r===nn&&((Gt&2)===0&&($i|=c),gn===4&&ei(r,Lt,Nr,!1)),Aa(r))}function kj(r,s,c){if((Gt&6)!==0)throw Error(a(327));var f=!c&&(s&127)===0&&(s&r.expiredLanes)===0||O(r,s),x=f?pB(r,s):vg(r,s,!0),y=f;do{if(x===0){ko&&!f&&ei(r,s,0,!1);break}else{if(c=r.current.alternate,y&&!fB(c)){x=vg(r,s,!1),y=!1;continue}if(x===2){if(y=s,r.errorRecoveryDisabledLanes&y)var E=0;else E=r.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){s=E;e:{var M=r;x=zc;var F=M.current.memoizedState.isDehydrated;if(F&&(Io(M,E).flags|=256),E=vg(M,E,!1),E!==2){if(ug&&!F){M.errorRecoveryDisabledLanes|=y,$i|=y,x=4;break e}y=dr,dr=x,y!==null&&(dr===null?dr=y:dr.push.apply(dr,y))}x=E}if(y=!1,x!==2)continue}}if(x===1){Io(r,0),ei(r,s,0,!0);break}e:{switch(f=r,y=x,y){case 0:case 1:throw Error(a(345));case 4:if((s&4194048)!==s)break;case 6:ei(f,s,Nr,!Xs);break e;case 2:dr=null;break;case 3:case 5:break;default:throw Error(a(329))}if((s&62914560)===s&&(x=af+300-vt(),10<x)){if(ei(f,s,Nr,!Xs),z(f,0,!0)!==0)break e;fs=s,f.timeoutHandle=fN(Lj.bind(null,f,c,dr,of,fg,s,Nr,$i,Lo,Xs,y,"Throttled",-0,0),x);break e}Lj(f,c,dr,of,fg,s,Nr,$i,Lo,Xs,y,null,-0,0)}}break}while(!0);Aa(r)}function Lj(r,s,c,f,x,y,E,M,F,ae,ge,ye,ie,le){if(r.timeoutHandle=-1,ye=s.subtreeFlags,ye&8192||(ye&16785408)===16785408){ye={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:kt},Tj(s,y,ye);var Fe=(y&62914560)===y?af-vt():(y&4194048)===y?Mj-vt():0;if(Fe=XB(ye,Fe),Fe!==null){fs=y,r.cancelPendingCommit=Fe(Vj.bind(null,r,s,y,c,f,x,E,M,F,ge,ye,null,ie,le)),ei(r,y,E,!ae);return}}Vj(r,s,y,c,f,x,E,M,F)}function fB(r){for(var s=r;;){var c=s.tag;if((c===0||c===11||c===15)&&s.flags&16384&&(c=s.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var f=0;f<c.length;f++){var x=c[f],y=x.getSnapshot;x=x.value;try{if(!br(y(),x))return!1}catch{return!1}}if(c=s.child,s.subtreeFlags&16384&&c!==null)c.return=s,s=c;else{if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ei(r,s,c,f){s&=~dg,s&=~$i,r.suspendedLanes|=s,r.pingedLanes&=~s,f&&(r.warmLanes|=s),f=r.expirationTimes;for(var x=s;0<x;){var y=31-ue(x),E=1<<y;f[y]=-1,x&=~E}c!==0&&It(r,c,s)}function lf(){return(Gt&6)===0?(Hc(0),!1):!0}function gg(){if(Dt!==null){if(Xt===0)var r=Dt.return;else r=Dt,ts=Li=null,Mm(r),To=null,Cc=0,r=Dt;for(;r!==null;)hj(r.alternate,r),r=r.return;Dt=null}}function Io(r,s){var c=r.timeoutHandle;c!==-1&&(r.timeoutHandle=-1,MB(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),fs=0,gg(),nn=r,Dt=c=Ja(r.current,null),Lt=s,Xt=0,jr=null,Xs=!1,ko=O(r,s),ug=!1,Lo=Nr=dg=$i=Qs=gn=0,dr=zc=null,fg=!1,(s&8)!==0&&(s|=s&32);var f=r.entangledLanes;if(f!==0)for(r=r.entanglements,f&=s;0<f;){var x=31-ue(f),y=1<<x;s|=r[x],f&=~y}return ds=s,Td(),c}function Bj(r,s){yt=null,I.H=Oc,s===Eo||s===Ld?(s=J1(),Xt=3):s===bm?(s=J1(),Xt=4):Xt=s===Ym?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,jr=s,Dt===null&&(gn=1,Xd(r,Ir(s,r.current)))}function Ij(){var r=Sr.current;return r===null?!0:(Lt&4194048)===Lt?Ur===null:(Lt&62914560)===Lt||(Lt&536870912)!==0?r===Ur:!1}function zj(){var r=I.H;return I.H=Oc,r===null?Oc:r}function Fj(){var r=I.A;return I.A=uB,r}function cf(){gn=4,Xs||(Lt&4194048)!==Lt&&Sr.current!==null||(ko=!0),(Qs&134217727)===0&&($i&134217727)===0||nn===null||ei(nn,Lt,Nr,!1)}function vg(r,s,c){var f=Gt;Gt|=2;var x=zj(),y=Fj();(nn!==r||Lt!==s)&&(of=null,Io(r,s)),s=!1;var E=gn;e:do try{if(Xt!==0&&Dt!==null){var M=Dt,F=jr;switch(Xt){case 8:gg(),E=6;break e;case 3:case 2:case 9:case 6:Sr.current===null&&(s=!0);var ae=Xt;if(Xt=0,jr=null,zo(r,M,F,ae),c&&ko){E=0;break e}break;default:ae=Xt,Xt=0,jr=null,zo(r,M,F,ae)}}hB(),E=gn;break}catch(ge){Bj(r,ge)}while(!0);return s&&r.shellSuspendCounter++,ts=Li=null,Gt=f,I.H=x,I.A=y,Dt===null&&(nn=null,Lt=0,Td()),E}function hB(){for(;Dt!==null;)Hj(Dt)}function pB(r,s){var c=Gt;Gt|=2;var f=zj(),x=Fj();nn!==r||Lt!==s?(of=null,sf=vt()+500,Io(r,s)):ko=O(r,s);e:do try{if(Xt!==0&&Dt!==null){s=Dt;var y=jr;t:switch(Xt){case 1:Xt=0,jr=null,zo(r,s,y,1);break;case 2:case 9:if(Q1(y)){Xt=0,jr=null,Uj(s);break}s=function(){Xt!==2&&Xt!==9||nn!==r||(Xt=7),Aa(r)},y.then(s,s);break e;case 3:Xt=7;break e;case 4:Xt=5;break e;case 7:Q1(y)?(Xt=0,jr=null,Uj(s)):(Xt=0,jr=null,zo(r,s,y,7));break;case 5:var E=null;switch(Dt.tag){case 26:E=Dt.memoizedState;case 5:case 27:var M=Dt;if(E?EN(E):M.stateNode.complete){Xt=0,jr=null;var F=M.sibling;if(F!==null)Dt=F;else{var ae=M.return;ae!==null?(Dt=ae,uf(ae)):Dt=null}break t}}Xt=0,jr=null,zo(r,s,y,5);break;case 6:Xt=0,jr=null,zo(r,s,y,6);break;case 8:gg(),gn=6;break e;default:throw Error(a(462))}}mB();break}catch(ge){Bj(r,ge)}while(!0);return ts=Li=null,I.H=f,I.A=x,Gt=c,Dt!==null?0:(nn=null,Lt=0,Td(),gn)}function mB(){for(;Dt!==null&&!ot();)Hj(Dt)}function Hj(r){var s=dj(r.alternate,r,ds);r.memoizedProps=r.pendingProps,s===null?uf(r):Dt=s}function Uj(r){var s=r,c=s.alternate;switch(s.tag){case 15:case 0:s=sj(c,s,s.pendingProps,s.type,void 0,Lt);break;case 11:s=sj(c,s,s.pendingProps,s.type.render,s.ref,Lt);break;case 5:Mm(s);default:hj(c,s),s=Dt=F1(s,ds),s=dj(c,s,ds)}r.memoizedProps=r.pendingProps,s===null?uf(r):Dt=s}function zo(r,s,c,f){ts=Li=null,Mm(s),To=null,Cc=0;var x=s.return;try{if(rB(r,x,s,c,Lt)){gn=1,Xd(r,Ir(c,r.current)),Dt=null;return}}catch(y){if(x!==null)throw Dt=x,y;gn=1,Xd(r,Ir(c,r.current)),Dt=null;return}s.flags&32768?(Ft||f===1?r=!0:ko||(Lt&536870912)!==0?r=!1:(Xs=r=!0,(f===2||f===9||f===3||f===6)&&(f=Sr.current,f!==null&&f.tag===13&&(f.flags|=16384))),qj(s,r)):uf(s)}function uf(r){var s=r;do{if((s.flags&32768)!==0){qj(s,Xs);return}r=s.return;var c=iB(s.alternate,s,ds);if(c!==null){Dt=c;return}if(s=s.sibling,s!==null){Dt=s;return}Dt=s=r}while(s!==null);gn===0&&(gn=5)}function qj(r,s){do{var c=oB(r.alternate,r);if(c!==null){c.flags&=32767,Dt=c;return}if(c=r.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!s&&(r=r.sibling,r!==null)){Dt=r;return}Dt=r=c}while(r!==null);gn=6,Dt=null}function Vj(r,s,c,f,x,y,E,M,F){r.cancelPendingCommit=null;do df();while(En!==0);if((Gt&6)!==0)throw Error(a(327));if(s!==null){if(s===r.current)throw Error(a(177));if(y=s.lanes|s.childLanes,y|=sm,tt(r,c,y,E,M,F),r===nn&&(Dt=nn=null,Lt=0),Bo=s,Js=r,fs=c,hg=y,pg=x,Dj=f,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,yB(ne,function(){return Wj(),null})):(r.callbackNode=null,r.callbackPriority=0),f=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||f){f=I.T,I.T=null,x=q.p,q.p=2,E=Gt,Gt|=4;try{lB(r,s,c)}finally{Gt=E,q.p=x,I.T=f}}En=1,$j(),Gj(),Kj()}}function $j(){if(En===1){En=0;var r=Js,s=Bo,c=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||c){c=I.T,I.T=null;var f=q.p;q.p=2;var x=Gt;Gt|=4;try{Nj(s,r);var y=Rg,E=O1(r.containerInfo),M=y.focusedElem,F=y.selectionRange;if(E!==M&&M&&M.ownerDocument&&A1(M.ownerDocument.documentElement,M)){if(F!==null&&em(M)){var ae=F.start,ge=F.end;if(ge===void 0&&(ge=ae),"selectionStart"in M)M.selectionStart=ae,M.selectionEnd=Math.min(ge,M.value.length);else{var ye=M.ownerDocument||document,ie=ye&&ye.defaultView||window;if(ie.getSelection){var le=ie.getSelection(),Fe=M.textContent.length,rt=Math.min(F.start,Fe),en=F.end===void 0?rt:Math.min(F.end,Fe);!le.extend&&rt>en&&(E=en,en=rt,rt=E);var Z=R1(M,rt),V=R1(M,en);if(Z&&V&&(le.rangeCount!==1||le.anchorNode!==Z.node||le.anchorOffset!==Z.offset||le.focusNode!==V.node||le.focusOffset!==V.offset)){var re=ye.createRange();re.setStart(Z.node,Z.offset),le.removeAllRanges(),rt>en?(le.addRange(re),le.extend(V.node,V.offset)):(re.setEnd(V.node,V.offset),le.addRange(re))}}}}for(ye=[],le=M;le=le.parentNode;)le.nodeType===1&&ye.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof M.focus=="function"&&M.focus(),M=0;M<ye.length;M++){var ve=ye[M];ve.element.scrollLeft=ve.left,ve.element.scrollTop=ve.top}}Cf=!!Tg,Rg=Tg=null}finally{Gt=x,q.p=f,I.T=c}}r.current=s,En=2}}function Gj(){if(En===2){En=0;var r=Js,s=Bo,c=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||c){c=I.T,I.T=null;var f=q.p;q.p=2;var x=Gt;Gt|=4;try{bj(r,s.alternate,s)}finally{Gt=x,q.p=f,I.T=c}}En=3}}function Kj(){if(En===4||En===3){En=0,at();var r=Js,s=Bo,c=fs,f=Dj;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?En=5:(En=0,Bo=Js=null,Yj(r,r.pendingLanes));var x=r.pendingLanes;if(x===0&&(Zs=null),ke(c),s=s.stateNode,gt&&typeof gt.onCommitFiberRoot=="function")try{gt.onCommitFiberRoot(mt,s,void 0,(s.current.flags&128)===128)}catch{}if(f!==null){s=I.T,x=q.p,q.p=2,I.T=null;try{for(var y=r.onRecoverableError,E=0;E<f.length;E++){var M=f[E];y(M.value,{componentStack:M.stack})}}finally{I.T=s,q.p=x}}(fs&3)!==0&&df(),Aa(r),x=r.pendingLanes,(c&261930)!==0&&(x&42)!==0?r===mg?Fc++:(Fc=0,mg=r):Fc=0,Hc(0)}}function Yj(r,s){(r.pooledCacheLanes&=s)===0&&(s=r.pooledCache,s!=null&&(r.pooledCache=null,wc(s)))}function df(){return $j(),Gj(),Kj(),Wj()}function Wj(){if(En!==5)return!1;var r=Js,s=hg;hg=0;var c=ke(fs),f=I.T,x=q.p;try{q.p=32>c?32:c,I.T=null,c=pg,pg=null;var y=Js,E=fs;if(En=0,Bo=Js=null,fs=0,(Gt&6)!==0)throw Error(a(331));var M=Gt;if(Gt|=4,Aj(y.current),Ej(y,y.current,E,c),Gt=M,Hc(0,!1),gt&&typeof gt.onPostCommitFiberRoot=="function")try{gt.onPostCommitFiberRoot(mt,y)}catch{}return!0}finally{q.p=x,I.T=f,Yj(r,s)}}function Xj(r,s,c){s=Ir(c,s),s=Km(r.stateNode,s,2),r=Gs(r,s,2),r!==null&&(Ie(r,2),Aa(r))}function Qt(r,s,c){if(r.tag===3)Xj(r,r,c);else for(;s!==null;){if(s.tag===3){Xj(s,r,c);break}else if(s.tag===1){var f=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Zs===null||!Zs.has(f))){r=Ir(c,r),c=QC(2),f=Gs(s,c,2),f!==null&&(ZC(c,f,s,r),Ie(f,2),Aa(f));break}}s=s.return}}function xg(r,s,c){var f=r.pingCache;if(f===null){f=r.pingCache=new dB;var x=new Set;f.set(s,x)}else x=f.get(s),x===void 0&&(x=new Set,f.set(s,x));x.has(c)||(ug=!0,x.add(c),r=gB.bind(null,r,s,c),s.then(r,r))}function gB(r,s,c){var f=r.pingCache;f!==null&&f.delete(s),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,nn===r&&(Lt&c)===c&&(gn===4||gn===3&&(Lt&62914560)===Lt&&300>vt()-af?(Gt&2)===0&&Io(r,0):dg|=c,Lo===Lt&&(Lo=0)),Aa(r)}function Qj(r,s){s===0&&(s=me()),r=Di(r,s),r!==null&&(Ie(r,s),Aa(r))}function vB(r){var s=r.memoizedState,c=0;s!==null&&(c=s.retryLane),Qj(r,c)}function xB(r,s){var c=0;switch(r.tag){case 31:case 13:var f=r.stateNode,x=r.memoizedState;x!==null&&(c=x.retryLane);break;case 19:f=r.stateNode;break;case 22:f=r.stateNode._retryCache;break;default:throw Error(a(314))}f!==null&&f.delete(s),Qj(r,c)}function yB(r,s){return Et(r,s)}var ff=null,Fo=null,yg=!1,hf=!1,bg=!1,ti=0;function Aa(r){r!==Fo&&r.next===null&&(Fo===null?ff=Fo=r:Fo=Fo.next=r),hf=!0,yg||(yg=!0,wB())}function Hc(r,s){if(!bg&&hf){bg=!0;do for(var c=!1,f=ff;f!==null;){if(r!==0){var x=f.pendingLanes;if(x===0)var y=0;else{var E=f.suspendedLanes,M=f.pingedLanes;y=(1<<31-ue(42|r)+1)-1,y&=x&~(E&~M),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(c=!0,tN(f,y))}else y=Lt,y=z(f,f===nn?y:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(y&3)===0||O(f,y)||(c=!0,tN(f,y));f=f.next}while(c);bg=!1}}function bB(){Zj()}function Zj(){hf=yg=!1;var r=0;ti!==0&&OB()&&(r=ti);for(var s=vt(),c=null,f=ff;f!==null;){var x=f.next,y=Jj(f,s);y===0?(f.next=null,c===null?ff=x:c.next=x,x===null&&(Fo=c)):(c=f,(r!==0||(y&3)!==0)&&(hf=!0)),f=x}En!==0&&En!==5||Hc(r),ti!==0&&(ti=0)}function Jj(r,s){for(var c=r.suspendedLanes,f=r.pingedLanes,x=r.expirationTimes,y=r.pendingLanes&-62914561;0<y;){var E=31-ue(y),M=1<<E,F=x[E];F===-1?((M&c)===0||(M&f)!==0)&&(x[E]=de(M,s)):F<=s&&(r.expiredLanes|=M),y&=~M}if(s=nn,c=Lt,c=z(r,r===s?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),f=r.callbackNode,c===0||r===s&&(Xt===2||Xt===9)||r.cancelPendingCommit!==null)return f!==null&&f!==null&&jt(f),r.callbackNode=null,r.callbackPriority=0;if((c&3)===0||O(r,c)){if(s=c&-c,s===r.callbackPriority)return s;switch(f!==null&&jt(f),ke(c)){case 2:case 8:c=Wt;break;case 32:c=ne;break;case 268435456:c=st;break;default:c=ne}return f=eN.bind(null,r),c=Et(c,f),r.callbackPriority=s,r.callbackNode=c,s}return f!==null&&f!==null&&jt(f),r.callbackPriority=2,r.callbackNode=null,2}function eN(r,s){if(En!==0&&En!==5)return r.callbackNode=null,r.callbackPriority=0,null;var c=r.callbackNode;if(df()&&r.callbackNode!==c)return null;var f=Lt;return f=z(r,r===nn?f:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),f===0?null:(kj(r,f,s),Jj(r,vt()),r.callbackNode!=null&&r.callbackNode===c?eN.bind(null,r):null)}function tN(r,s){if(df())return null;kj(r,s,!0)}function wB(){DB(function(){(Gt&6)!==0?Et(Yt,bB):Zj()})}function wg(){if(ti===0){var r=No;r===0&&(r=Oe,Oe<<=1,(Oe&261888)===0&&(Oe=256)),ti=r}return ti}function nN(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Mt(""+r)}function rN(r,s){var c=s.ownerDocument.createElement("input");return c.name=s.name,c.value=s.value,r.id&&c.setAttribute("form",r.id),s.parentNode.insertBefore(c,s),r=new FormData(r),c.parentNode.removeChild(c),r}function SB(r,s,c,f,x){if(s==="submit"&&c&&c.stateNode===x){var y=nN((x[it]||null).action),E=f.submitter;E&&(s=(s=E[it]||null)?nN(s.formAction):E.getAttribute("formAction"),s!==null&&(y=s,E=null));var M=new jd("action","action",null,f,x);r.push({event:M,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(ti!==0){var F=E?rN(x,E):new FormData(x);Hm(c,{pending:!0,data:F,method:x.method,action:y},null,F)}}else typeof y=="function"&&(M.preventDefault(),F=E?rN(x,E):new FormData(x),Hm(c,{pending:!0,data:F,method:x.method,action:y},y,F))},currentTarget:x}]})}}for(var Sg=0;Sg<am.length;Sg++){var Cg=am[Sg],CB=Cg.toLowerCase(),jB=Cg[0].toUpperCase()+Cg.slice(1);na(CB,"on"+jB)}na(P1,"onAnimationEnd"),na(k1,"onAnimationIteration"),na(L1,"onAnimationStart"),na("dblclick","onDoubleClick"),na("focusin","onFocus"),na("focusout","onBlur"),na(F4,"onTransitionRun"),na(H4,"onTransitionStart"),na(U4,"onTransitionCancel"),na(B1,"onTransitionEnd"),ar("onMouseEnter",["mouseout","mouseover"]),ar("onMouseLeave",["mouseout","mouseover"]),ar("onPointerEnter",["pointerout","pointerover"]),ar("onPointerLeave",["pointerout","pointerover"]),Xa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Xa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Xa("onBeforeInput",["compositionend","keypress","textInput","paste"]),Xa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Xa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Xa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Uc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),NB=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Uc));function aN(r,s){s=(s&4)!==0;for(var c=0;c<r.length;c++){var f=r[c],x=f.event;f=f.listeners;e:{var y=void 0;if(s)for(var E=f.length-1;0<=E;E--){var M=f[E],F=M.instance,ae=M.currentTarget;if(M=M.listener,F!==y&&x.isPropagationStopped())break e;y=M,x.currentTarget=ae;try{y(x)}catch(ge){Ed(ge)}x.currentTarget=null,y=F}else for(E=0;E<f.length;E++){if(M=f[E],F=M.instance,ae=M.currentTarget,M=M.listener,F!==y&&x.isPropagationStopped())break e;y=M,x.currentTarget=ae;try{y(x)}catch(ge){Ed(ge)}x.currentTarget=null,y=F}}}}function Pt(r,s){var c=s[Zn];c===void 0&&(c=s[Zn]=new Set);var f=r+"__bubble";c.has(f)||(sN(s,r,2,!1),c.add(f))}function jg(r,s,c){var f=0;s&&(f|=4),sN(c,r,f,s)}var pf="_reactListening"+Math.random().toString(36).slice(2);function Ng(r){if(!r[pf]){r[pf]=!0,ec.forEach(function(c){c!=="selectionchange"&&(NB.has(c)||jg(c,!1,r),jg(c,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[pf]||(s[pf]=!0,jg("selectionchange",!1,s))}}function sN(r,s,c,f){switch(PN(s)){case 2:var x=JB;break;case 8:x=eI;break;default:x=Fg}c=x.bind(null,s,c,r),x=void 0,!$p||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(x=!0),f?x!==void 0?r.addEventListener(s,c,{capture:!0,passive:x}):r.addEventListener(s,c,!0):x!==void 0?r.addEventListener(s,c,{passive:x}):r.addEventListener(s,c,!1)}function _g(r,s,c,f,x){var y=f;if((s&1)===0&&(s&2)===0&&f!==null)e:for(;;){if(f===null)return;var E=f.tag;if(E===3||E===4){var M=f.stateNode.containerInfo;if(M===x)break;if(E===4)for(E=f.return;E!==null;){var F=E.tag;if((F===3||F===4)&&E.stateNode.containerInfo===x)return;E=E.return}for(;M!==null;){if(E=Ya(M),E===null)return;if(F=E.tag,F===5||F===6||F===26||F===27){f=y=E;continue e}M=M.parentNode}}f=f.return}u1(function(){var ae=y,ge=fn(c),ye=[];e:{var ie=I1.get(r);if(ie!==void 0){var le=jd,Fe=r;switch(r){case"keypress":if(Sd(c)===0)break e;case"keydown":case"keyup":le=x4;break;case"focusin":Fe="focus",le=Wp;break;case"focusout":Fe="blur",le=Wp;break;case"beforeblur":case"afterblur":le=Wp;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=h1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=i4;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=w4;break;case P1:case k1:case L1:le=c4;break;case B1:le=C4;break;case"scroll":case"scrollend":le=a4;break;case"wheel":le=N4;break;case"copy":case"cut":case"paste":le=d4;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=m1;break;case"toggle":case"beforetoggle":le=E4}var rt=(s&4)!==0,en=!rt&&(r==="scroll"||r==="scrollend"),Z=rt?ie!==null?ie+"Capture":null:ie;rt=[];for(var V=ae,re;V!==null;){var ve=V;if(re=ve.stateNode,ve=ve.tag,ve!==5&&ve!==26&&ve!==27||re===null||Z===null||(ve=uc(V,Z),ve!=null&&rt.push(qc(V,ve,re))),en)break;V=V.return}0<rt.length&&(ie=new le(ie,Fe,null,c,ge),ye.push({event:ie,listeners:rt}))}}if((s&7)===0){e:{if(ie=r==="mouseover"||r==="pointerover",le=r==="mouseout"||r==="pointerout",ie&&c!==_n&&(Fe=c.relatedTarget||c.fromElement)&&(Ya(Fe)||Fe[zt]))break e;if((le||ie)&&(ie=ge.window===ge?ge:(ie=ge.ownerDocument)?ie.defaultView||ie.parentWindow:window,le?(Fe=c.relatedTarget||c.toElement,le=ae,Fe=Fe?Ya(Fe):null,Fe!==null&&(en=l(Fe),rt=Fe.tag,Fe!==en||rt!==5&&rt!==27&&rt!==6)&&(Fe=null)):(le=null,Fe=ae),le!==Fe)){if(rt=h1,ve="onMouseLeave",Z="onMouseEnter",V="mouse",(r==="pointerout"||r==="pointerover")&&(rt=m1,ve="onPointerLeave",Z="onPointerEnter",V="pointer"),en=le==null?ie:ks(le),re=Fe==null?ie:ks(Fe),ie=new rt(ve,V+"leave",le,c,ge),ie.target=en,ie.relatedTarget=re,ve=null,Ya(ge)===ae&&(rt=new rt(Z,V+"enter",Fe,c,ge),rt.target=re,rt.relatedTarget=en,ve=rt),en=ve,le&&Fe)t:{for(rt=_B,Z=le,V=Fe,re=0,ve=Z;ve;ve=rt(ve))re++;ve=0;for(var Ze=V;Ze;Ze=rt(Ze))ve++;for(;0<re-ve;)Z=rt(Z),re--;for(;0<ve-re;)V=rt(V),ve--;for(;re--;){if(Z===V||V!==null&&Z===V.alternate){rt=Z;break t}Z=rt(Z),V=rt(V)}rt=null}else rt=null;le!==null&&iN(ye,ie,le,rt,!1),Fe!==null&&en!==null&&iN(ye,en,Fe,rt,!0)}}e:{if(ie=ae?ks(ae):window,le=ie.nodeName&&ie.nodeName.toLowerCase(),le==="select"||le==="input"&&ie.type==="file")var Vt=C1;else if(w1(ie))if(j1)Vt=B4;else{Vt=k4;var Ye=P4}else le=ie.nodeName,!le||le.toLowerCase()!=="input"||ie.type!=="checkbox"&&ie.type!=="radio"?ae&&ee(ae.elementType)&&(Vt=C1):Vt=L4;if(Vt&&(Vt=Vt(r,ae))){S1(ye,Vt,c,ge);break e}Ye&&Ye(r,ie,ae),r==="focusout"&&ae&&ie.type==="number"&&ae.memoizedProps.value!=null&&ac(ie,"number",ie.value)}switch(Ye=ae?ks(ae):window,r){case"focusin":(w1(Ye)||Ye.contentEditable==="true")&&(vo=Ye,tm=ae,xc=null);break;case"focusout":xc=tm=vo=null;break;case"mousedown":nm=!0;break;case"contextmenu":case"mouseup":case"dragend":nm=!1,M1(ye,c,ge);break;case"selectionchange":if(z4)break;case"keydown":case"keyup":M1(ye,c,ge)}var Ct;if(Qp)e:{switch(r){case"compositionstart":var Bt="onCompositionStart";break e;case"compositionend":Bt="onCompositionEnd";break e;case"compositionupdate":Bt="onCompositionUpdate";break e}Bt=void 0}else go?y1(r,c)&&(Bt="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(Bt="onCompositionStart");Bt&&(g1&&c.locale!=="ko"&&(go||Bt!=="onCompositionStart"?Bt==="onCompositionEnd"&&go&&(Ct=d1()):(zs=ge,Gp="value"in zs?zs.value:zs.textContent,go=!0)),Ye=mf(ae,Bt),0<Ye.length&&(Bt=new p1(Bt,r,null,c,ge),ye.push({event:Bt,listeners:Ye}),Ct?Bt.data=Ct:(Ct=b1(c),Ct!==null&&(Bt.data=Ct)))),(Ct=R4?A4(r,c):O4(r,c))&&(Bt=mf(ae,"onBeforeInput"),0<Bt.length&&(Ye=new p1("onBeforeInput","beforeinput",null,c,ge),ye.push({event:Ye,listeners:Bt}),Ye.data=Ct)),SB(ye,r,ae,c,ge)}aN(ye,s)})}function qc(r,s,c){return{instance:r,listener:s,currentTarget:c}}function mf(r,s){for(var c=s+"Capture",f=[];r!==null;){var x=r,y=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||y===null||(x=uc(r,c),x!=null&&f.unshift(qc(r,x,y)),x=uc(r,s),x!=null&&f.push(qc(r,x,y))),r.tag===3)return f;r=r.return}return[]}function _B(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function iN(r,s,c,f,x){for(var y=s._reactName,E=[];c!==null&&c!==f;){var M=c,F=M.alternate,ae=M.stateNode;if(M=M.tag,F!==null&&F===f)break;M!==5&&M!==26&&M!==27||ae===null||(F=ae,x?(ae=uc(c,y),ae!=null&&E.unshift(qc(c,ae,F))):x||(ae=uc(c,y),ae!=null&&E.push(qc(c,ae,F)))),c=c.return}E.length!==0&&r.push({event:s,listeners:E})}var EB=/\r\n?/g,TB=/\u0000|\uFFFD/g;function oN(r){return(typeof r=="string"?r:""+r).replace(EB,`
  9. `).replace(TB,"")}function lN(r,s){return s=oN(s),oN(r)===s}function Jt(r,s,c,f,x,y){switch(c){case"children":typeof f=="string"?s==="body"||s==="textarea"&&f===""||_a(r,f):(typeof f=="number"||typeof f=="bigint")&&s!=="body"&&_a(r,""+f);break;case"className":Bs(r,"class",f);break;case"tabIndex":Bs(r,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":Bs(r,c,f);break;case"style":oc(r,f,y);break;case"data":if(s!=="object"){Bs(r,"data",f);break}case"src":case"href":if(f===""&&(s!=="a"||c!=="href")){r.removeAttribute(c);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){r.removeAttribute(c);break}f=Mt(""+f),r.setAttribute(c,f);break;case"action":case"formAction":if(typeof f=="function"){r.setAttribute(c,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof y=="function"&&(c==="formAction"?(s!=="input"&&Jt(r,s,"name",x.name,x,null),Jt(r,s,"formEncType",x.formEncType,x,null),Jt(r,s,"formMethod",x.formMethod,x,null),Jt(r,s,"formTarget",x.formTarget,x,null)):(Jt(r,s,"encType",x.encType,x,null),Jt(r,s,"method",x.method,x,null),Jt(r,s,"target",x.target,x,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){r.removeAttribute(c);break}f=Mt(""+f),r.setAttribute(c,f);break;case"onClick":f!=null&&(r.onclick=kt);break;case"onScroll":f!=null&&Pt("scroll",r);break;case"onScrollEnd":f!=null&&Pt("scrollend",r);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(a(61));if(c=f.__html,c!=null){if(x.children!=null)throw Error(a(60));r.innerHTML=c}}break;case"multiple":r.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":r.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){r.removeAttribute("xlink:href");break}c=Mt(""+f),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?r.setAttribute(c,""+f):r.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?r.setAttribute(c,""):r.removeAttribute(c);break;case"capture":case"download":f===!0?r.setAttribute(c,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?r.setAttribute(c,f):r.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?r.setAttribute(c,f):r.removeAttribute(c);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?r.removeAttribute(c):r.setAttribute(c,f);break;case"popover":Pt("beforetoggle",r),Pt("toggle",r),Ls(r,"popover",f);break;case"xlinkActuate":sr(r,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":sr(r,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":sr(r,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":sr(r,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":sr(r,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":sr(r,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":sr(r,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":sr(r,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":sr(r,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":Ls(r,"is",f);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=Ee.get(c)||c,Ls(r,c,f))}}function Eg(r,s,c,f,x,y){switch(c){case"style":oc(r,f,y);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(a(61));if(c=f.__html,c!=null){if(x.children!=null)throw Error(a(60));r.innerHTML=c}}break;case"children":typeof f=="string"?_a(r,f):(typeof f=="number"||typeof f=="bigint")&&_a(r,""+f);break;case"onScroll":f!=null&&Pt("scroll",r);break;case"onScrollEnd":f!=null&&Pt("scrollend",r);break;case"onClick":f!=null&&(r.onclick=kt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!tc.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(x=c.endsWith("Capture"),s=c.slice(2,x?c.length-7:void 0),y=r[it]||null,y=y!=null?y[c]:null,typeof y=="function"&&r.removeEventListener(s,y,x),typeof f=="function")){typeof y!="function"&&y!==null&&(c in r?r[c]=null:r.hasAttribute(c)&&r.removeAttribute(c)),r.addEventListener(s,f,x);break e}c in r?r[c]=f:f===!0?r.setAttribute(c,""):Ls(r,c,f)}}}function zn(r,s,c){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Pt("error",r),Pt("load",r);var f=!1,x=!1,y;for(y in c)if(c.hasOwnProperty(y)){var E=c[y];if(E!=null)switch(y){case"src":f=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:Jt(r,s,y,E,c,null)}}x&&Jt(r,s,"srcSet",c.srcSet,c,null),f&&Jt(r,s,"src",c.src,c,null);return;case"input":Pt("invalid",r);var M=y=E=x=null,F=null,ae=null;for(f in c)if(c.hasOwnProperty(f)){var ge=c[f];if(ge!=null)switch(f){case"name":x=ge;break;case"type":E=ge;break;case"checked":F=ge;break;case"defaultChecked":ae=ge;break;case"value":y=ge;break;case"defaultValue":M=ge;break;case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(a(137,s));break;default:Jt(r,s,f,ge,c,null)}}yd(r,y,M,F,ae,E,x,!1);return;case"select":Pt("invalid",r),f=E=y=null;for(x in c)if(c.hasOwnProperty(x)&&(M=c[x],M!=null))switch(x){case"value":y=M;break;case"defaultValue":E=M;break;case"multiple":f=M;default:Jt(r,s,x,M,c,null)}s=y,c=E,r.multiple=!!f,s!=null?Is(r,!!f,s,!1):c!=null&&Is(r,!!f,c,!0);return;case"textarea":Pt("invalid",r),y=x=f=null;for(E in c)if(c.hasOwnProperty(E)&&(M=c[E],M!=null))switch(E){case"value":f=M;break;case"defaultValue":x=M;break;case"children":y=M;break;case"dangerouslySetInnerHTML":if(M!=null)throw Error(a(91));break;default:Jt(r,s,E,M,c,null)}sc(r,f,x,y);return;case"option":for(F in c)c.hasOwnProperty(F)&&(f=c[F],f!=null)&&(F==="selected"?r.selected=f&&typeof f!="function"&&typeof f!="symbol":Jt(r,s,F,f,c,null));return;case"dialog":Pt("beforetoggle",r),Pt("toggle",r),Pt("cancel",r),Pt("close",r);break;case"iframe":case"object":Pt("load",r);break;case"video":case"audio":for(f=0;f<Uc.length;f++)Pt(Uc[f],r);break;case"image":Pt("error",r),Pt("load",r);break;case"details":Pt("toggle",r);break;case"embed":case"source":case"link":Pt("error",r),Pt("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in c)if(c.hasOwnProperty(ae)&&(f=c[ae],f!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:Jt(r,s,ae,f,c,null)}return;default:if(ee(s)){for(ge in c)c.hasOwnProperty(ge)&&(f=c[ge],f!==void 0&&Eg(r,s,ge,f,c,void 0));return}}for(M in c)c.hasOwnProperty(M)&&(f=c[M],f!=null&&Jt(r,s,M,f,c,null))}function RB(r,s,c,f){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,y=null,E=null,M=null,F=null,ae=null,ge=null;for(le in c){var ye=c[le];if(c.hasOwnProperty(le)&&ye!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":F=ye;default:f.hasOwnProperty(le)||Jt(r,s,le,null,f,ye)}}for(var ie in f){var le=f[ie];if(ye=c[ie],f.hasOwnProperty(ie)&&(le!=null||ye!=null))switch(ie){case"type":y=le;break;case"name":x=le;break;case"checked":ae=le;break;case"defaultChecked":ge=le;break;case"value":E=le;break;case"defaultValue":M=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(a(137,s));break;default:le!==ye&&Jt(r,s,ie,le,f,ye)}}rc(r,E,M,F,ae,ge,y,x);return;case"select":le=E=M=ie=null;for(y in c)if(F=c[y],c.hasOwnProperty(y)&&F!=null)switch(y){case"value":break;case"multiple":le=F;default:f.hasOwnProperty(y)||Jt(r,s,y,null,f,F)}for(x in f)if(y=f[x],F=c[x],f.hasOwnProperty(x)&&(y!=null||F!=null))switch(x){case"value":ie=y;break;case"defaultValue":M=y;break;case"multiple":E=y;default:y!==F&&Jt(r,s,x,y,f,F)}s=M,c=E,f=le,ie!=null?Is(r,!!c,ie,!1):!!f!=!!c&&(s!=null?Is(r,!!c,s,!0):Is(r,!!c,c?[]:"",!1));return;case"textarea":le=ie=null;for(M in c)if(x=c[M],c.hasOwnProperty(M)&&x!=null&&!f.hasOwnProperty(M))switch(M){case"value":break;case"children":break;default:Jt(r,s,M,null,f,x)}for(E in f)if(x=f[E],y=c[E],f.hasOwnProperty(E)&&(x!=null||y!=null))switch(E){case"value":ie=x;break;case"defaultValue":le=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(a(91));break;default:x!==y&&Jt(r,s,E,x,f,y)}Ri(r,ie,le);return;case"option":for(var Fe in c)ie=c[Fe],c.hasOwnProperty(Fe)&&ie!=null&&!f.hasOwnProperty(Fe)&&(Fe==="selected"?r.selected=!1:Jt(r,s,Fe,null,f,ie));for(F in f)ie=f[F],le=c[F],f.hasOwnProperty(F)&&ie!==le&&(ie!=null||le!=null)&&(F==="selected"?r.selected=ie&&typeof ie!="function"&&typeof ie!="symbol":Jt(r,s,F,ie,f,le));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var rt in c)ie=c[rt],c.hasOwnProperty(rt)&&ie!=null&&!f.hasOwnProperty(rt)&&Jt(r,s,rt,null,f,ie);for(ae in f)if(ie=f[ae],le=c[ae],f.hasOwnProperty(ae)&&ie!==le&&(ie!=null||le!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(a(137,s));break;default:Jt(r,s,ae,ie,f,le)}return;default:if(ee(s)){for(var en in c)ie=c[en],c.hasOwnProperty(en)&&ie!==void 0&&!f.hasOwnProperty(en)&&Eg(r,s,en,void 0,f,ie);for(ge in f)ie=f[ge],le=c[ge],!f.hasOwnProperty(ge)||ie===le||ie===void 0&&le===void 0||Eg(r,s,ge,ie,f,le);return}}for(var Z in c)ie=c[Z],c.hasOwnProperty(Z)&&ie!=null&&!f.hasOwnProperty(Z)&&Jt(r,s,Z,null,f,ie);for(ye in f)ie=f[ye],le=c[ye],!f.hasOwnProperty(ye)||ie===le||ie==null&&le==null||Jt(r,s,ye,ie,f,le)}function cN(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function AB(){if(typeof performance.getEntriesByType=="function"){for(var r=0,s=0,c=performance.getEntriesByType("resource"),f=0;f<c.length;f++){var x=c[f],y=x.transferSize,E=x.initiatorType,M=x.duration;if(y&&M&&cN(E)){for(E=0,M=x.responseEnd,f+=1;f<c.length;f++){var F=c[f],ae=F.startTime;if(ae>M)break;var ge=F.transferSize,ye=F.initiatorType;ge&&cN(ye)&&(F=F.responseEnd,E+=ge*(F<M?1:(M-ae)/(F-ae)))}if(--f,s+=8*(y+E)/(x.duration/1e3),r++,10<r)break}}if(0<r)return s/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var Tg=null,Rg=null;function gf(r){return r.nodeType===9?r:r.ownerDocument}function uN(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function dN(r,s){if(r===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&s==="foreignObject"?0:r}function Ag(r,s){return r==="textarea"||r==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Og=null;function OB(){var r=window.event;return r&&r.type==="popstate"?r===Og?!1:(Og=r,!0):(Og=null,!1)}var fN=typeof setTimeout=="function"?setTimeout:void 0,MB=typeof clearTimeout=="function"?clearTimeout:void 0,hN=typeof Promise=="function"?Promise:void 0,DB=typeof queueMicrotask=="function"?queueMicrotask:typeof hN<"u"?function(r){return hN.resolve(null).then(r).catch(PB)}:fN;function PB(r){setTimeout(function(){throw r})}function ni(r){return r==="head"}function pN(r,s){var c=s,f=0;do{var x=c.nextSibling;if(r.removeChild(c),x&&x.nodeType===8)if(c=x.data,c==="/$"||c==="/&"){if(f===0){r.removeChild(x),Vo(s);return}f--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")f++;else if(c==="html")Vc(r.ownerDocument.documentElement);else if(c==="head"){c=r.ownerDocument.head,Vc(c);for(var y=c.firstChild;y;){var E=y.nextSibling,M=y.nodeName;y[Ka]||M==="SCRIPT"||M==="STYLE"||M==="LINK"&&y.rel.toLowerCase()==="stylesheet"||c.removeChild(y),y=E}}else c==="body"&&Vc(r.ownerDocument.body);c=x}while(c);Vo(s)}function mN(r,s){var c=r;r=0;do{var f=c.nextSibling;if(c.nodeType===1?s?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(s?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),f&&f.nodeType===8)if(c=f.data,c==="/$"){if(r===0)break;r--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||r++;c=f}while(c)}function Mg(r){var s=r.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var c=s;switch(s=s.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Mg(c),Jl(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}r.removeChild(c)}}function kB(r,s,c,f){for(;r.nodeType===1;){var x=c;if(r.nodeName.toLowerCase()!==s.toLowerCase()){if(!f&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(f){if(!r[Ka])switch(s){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(y=r.getAttribute("rel"),y==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(y!==x.rel||r.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||r.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||r.getAttribute("title")!==(x.title==null?null:x.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(y=r.getAttribute("src"),(y!==(x.src==null?null:x.src)||r.getAttribute("type")!==(x.type==null?null:x.type)||r.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&y&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(s==="input"&&r.type==="hidden"){var y=x.name==null?null:""+x.name;if(x.type==="hidden"&&r.getAttribute("name")===y)return r}else return r;if(r=qr(r.nextSibling),r===null)break}return null}function LB(r,s,c){if(s==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!c||(r=qr(r.nextSibling),r===null))return null;return r}function gN(r,s){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!s||(r=qr(r.nextSibling),r===null))return null;return r}function Dg(r){return r.data==="$?"||r.data==="$~"}function Pg(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function BB(r,s){var c=r.ownerDocument;if(r.data==="$~")r._reactRetry=s;else if(r.data!=="$?"||c.readyState!=="loading")s();else{var f=function(){s(),c.removeEventListener("DOMContentLoaded",f)};c.addEventListener("DOMContentLoaded",f),r._reactRetry=f}}function qr(r){for(;r!=null;r=r.nextSibling){var s=r.nodeType;if(s===1||s===3)break;if(s===8){if(s=r.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return r}var kg=null;function vN(r){r=r.nextSibling;for(var s=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"||c==="/&"){if(s===0)return qr(r.nextSibling);s--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||s++}r=r.nextSibling}return null}function xN(r){r=r.previousSibling;for(var s=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(s===0)return r;s--}else c!=="/$"&&c!=="/&"||s++}r=r.previousSibling}return null}function yN(r,s,c){switch(s=gf(c),r){case"html":if(r=s.documentElement,!r)throw Error(a(452));return r;case"head":if(r=s.head,!r)throw Error(a(453));return r;case"body":if(r=s.body,!r)throw Error(a(454));return r;default:throw Error(a(451))}}function Vc(r){for(var s=r.attributes;s.length;)r.removeAttributeNode(s[0]);Jl(r)}var Vr=new Map,bN=new Set;function vf(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var hs=q.d;q.d={f:IB,r:zB,D:FB,C:HB,L:UB,m:qB,X:$B,S:VB,M:GB};function IB(){var r=hs.f(),s=lf();return r||s}function zB(r){var s=Ps(r);s!==null&&s.tag===5&&s.type==="form"?BC(s):hs.r(r)}var Ho=typeof document>"u"?null:document;function wN(r,s,c){var f=Ho;if(f&&typeof s=="string"&&s){var x=Jn(s);x='link[rel="'+r+'"][href="'+x+'"]',typeof c=="string"&&(x+='[crossorigin="'+c+'"]'),bN.has(x)||(bN.add(x),r={rel:r,crossOrigin:c,href:s},f.querySelector(x)===null&&(s=f.createElement("link"),zn(s,"link",r),xn(s),f.head.appendChild(s)))}}function FB(r){hs.D(r),wN("dns-prefetch",r,null)}function HB(r,s){hs.C(r,s),wN("preconnect",r,s)}function UB(r,s,c){hs.L(r,s,c);var f=Ho;if(f&&r&&s){var x='link[rel="preload"][as="'+Jn(s)+'"]';s==="image"&&c&&c.imageSrcSet?(x+='[imagesrcset="'+Jn(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(x+='[imagesizes="'+Jn(c.imageSizes)+'"]')):x+='[href="'+Jn(r)+'"]';var y=x;switch(s){case"style":y=Uo(r);break;case"script":y=qo(r)}Vr.has(y)||(r=m({rel:"preload",href:s==="image"&&c&&c.imageSrcSet?void 0:r,as:s},c),Vr.set(y,r),f.querySelector(x)!==null||s==="style"&&f.querySelector($c(y))||s==="script"&&f.querySelector(Gc(y))||(s=f.createElement("link"),zn(s,"link",r),xn(s),f.head.appendChild(s)))}}function qB(r,s){hs.m(r,s);var c=Ho;if(c&&r){var f=s&&typeof s.as=="string"?s.as:"script",x='link[rel="modulepreload"][as="'+Jn(f)+'"][href="'+Jn(r)+'"]',y=x;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=qo(r)}if(!Vr.has(y)&&(r=m({rel:"modulepreload",href:r},s),Vr.set(y,r),c.querySelector(x)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Gc(y)))return}f=c.createElement("link"),zn(f,"link",r),xn(f),c.head.appendChild(f)}}}function VB(r,s,c){hs.S(r,s,c);var f=Ho;if(f&&r){var x=Wa(f).hoistableStyles,y=Uo(r);s=s||"default";var E=x.get(y);if(!E){var M={loading:0,preload:null};if(E=f.querySelector($c(y)))M.loading=5;else{r=m({rel:"stylesheet",href:r,"data-precedence":s},c),(c=Vr.get(y))&&Lg(r,c);var F=E=f.createElement("link");xn(F),zn(F,"link",r),F._p=new Promise(function(ae,ge){F.onload=ae,F.onerror=ge}),F.addEventListener("load",function(){M.loading|=1}),F.addEventListener("error",function(){M.loading|=2}),M.loading|=4,xf(E,s,f)}E={type:"stylesheet",instance:E,count:1,state:M},x.set(y,E)}}}function $B(r,s){hs.X(r,s);var c=Ho;if(c&&r){var f=Wa(c).hoistableScripts,x=qo(r),y=f.get(x);y||(y=c.querySelector(Gc(x)),y||(r=m({src:r,async:!0},s),(s=Vr.get(x))&&Bg(r,s),y=c.createElement("script"),xn(y),zn(y,"link",r),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},f.set(x,y))}}function GB(r,s){hs.M(r,s);var c=Ho;if(c&&r){var f=Wa(c).hoistableScripts,x=qo(r),y=f.get(x);y||(y=c.querySelector(Gc(x)),y||(r=m({src:r,async:!0,type:"module"},s),(s=Vr.get(x))&&Bg(r,s),y=c.createElement("script"),xn(y),zn(y,"link",r),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},f.set(x,y))}}function SN(r,s,c,f){var x=(x=Q.current)?vf(x):null;if(!x)throw Error(a(446));switch(r){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(s=Uo(c.href),c=Wa(x).hoistableStyles,f=c.get(s),f||(f={type:"style",instance:null,count:0,state:null},c.set(s,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){r=Uo(c.href);var y=Wa(x).hoistableStyles,E=y.get(r);if(E||(x=x.ownerDocument||x,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(r,E),(y=x.querySelector($c(r)))&&!y._p&&(E.instance=y,E.state.loading=5),Vr.has(r)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Vr.set(r,c),y||KB(x,r,c,E.state))),s&&f===null)throw Error(a(528,""));return E}if(s&&f!==null)throw Error(a(529,""));return null;case"script":return s=c.async,c=c.src,typeof c=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=qo(c),c=Wa(x).hoistableScripts,f=c.get(s),f||(f={type:"script",instance:null,count:0,state:null},c.set(s,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,r))}}function Uo(r){return'href="'+Jn(r)+'"'}function $c(r){return'link[rel="stylesheet"]['+r+"]"}function CN(r){return m({},r,{"data-precedence":r.precedence,precedence:null})}function KB(r,s,c,f){r.querySelector('link[rel="preload"][as="style"]['+s+"]")?f.loading=1:(s=r.createElement("link"),f.preload=s,s.addEventListener("load",function(){return f.loading|=1}),s.addEventListener("error",function(){return f.loading|=2}),zn(s,"link",c),xn(s),r.head.appendChild(s))}function qo(r){return'[src="'+Jn(r)+'"]'}function Gc(r){return"script[async]"+r}function jN(r,s,c){if(s.count++,s.instance===null)switch(s.type){case"style":var f=r.querySelector('style[data-href~="'+Jn(c.href)+'"]');if(f)return s.instance=f,xn(f),f;var x=m({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return f=(r.ownerDocument||r).createElement("style"),xn(f),zn(f,"style",x),xf(f,c.precedence,r),s.instance=f;case"stylesheet":x=Uo(c.href);var y=r.querySelector($c(x));if(y)return s.state.loading|=4,s.instance=y,xn(y),y;f=CN(c),(x=Vr.get(x))&&Lg(f,x),y=(r.ownerDocument||r).createElement("link"),xn(y);var E=y;return E._p=new Promise(function(M,F){E.onload=M,E.onerror=F}),zn(y,"link",f),s.state.loading|=4,xf(y,c.precedence,r),s.instance=y;case"script":return y=qo(c.src),(x=r.querySelector(Gc(y)))?(s.instance=x,xn(x),x):(f=c,(x=Vr.get(y))&&(f=m({},c),Bg(f,x)),r=r.ownerDocument||r,x=r.createElement("script"),xn(x),zn(x,"link",f),r.head.appendChild(x),s.instance=x);case"void":return null;default:throw Error(a(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(f=s.instance,s.state.loading|=4,xf(f,c.precedence,r));return s.instance}function xf(r,s,c){for(var f=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=f.length?f[f.length-1]:null,y=x,E=0;E<f.length;E++){var M=f[E];if(M.dataset.precedence===s)y=M;else if(y!==x)break}y?y.parentNode.insertBefore(r,y.nextSibling):(s=c.nodeType===9?c.head:c,s.insertBefore(r,s.firstChild))}function Lg(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.title==null&&(r.title=s.title)}function Bg(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.integrity==null&&(r.integrity=s.integrity)}var yf=null;function NN(r,s,c){if(yf===null){var f=new Map,x=yf=new Map;x.set(c,f)}else x=yf,f=x.get(c),f||(f=new Map,x.set(c,f));if(f.has(r))return f;for(f.set(r,null),c=c.getElementsByTagName(r),x=0;x<c.length;x++){var y=c[x];if(!(y[Ka]||y[Tt]||r==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var E=y.getAttribute(s)||"";E=r+E;var M=f.get(E);M?M.push(y):f.set(E,[y])}}return f}function _N(r,s,c){r=r.ownerDocument||r,r.head.insertBefore(c,s==="title"?r.querySelector("head > title"):null)}function YB(r,s,c){if(c===1||s.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(r=s.disabled,typeof s.precedence=="string"&&r==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function EN(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function WB(r,s,c,f){if(c.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var x=Uo(f.href),y=s.querySelector($c(x));if(y){s=y._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=bf.bind(r),s.then(r,r)),c.state.loading|=4,c.instance=y,xn(y);return}y=s.ownerDocument||s,f=CN(f),(x=Vr.get(x))&&Lg(f,x),y=y.createElement("link"),xn(y);var E=y;E._p=new Promise(function(M,F){E.onload=M,E.onerror=F}),zn(y,"link",f),c.instance=y}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(c,s),(s=c.state.preload)&&(c.state.loading&3)===0&&(r.count++,c=bf.bind(r),s.addEventListener("load",c),s.addEventListener("error",c))}}var Ig=0;function XB(r,s){return r.stylesheets&&r.count===0&&Sf(r,r.stylesheets),0<r.count||0<r.imgCount?function(c){var f=setTimeout(function(){if(r.stylesheets&&Sf(r,r.stylesheets),r.unsuspend){var y=r.unsuspend;r.unsuspend=null,y()}},6e4+s);0<r.imgBytes&&Ig===0&&(Ig=62500*AB());var x=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Sf(r,r.stylesheets),r.unsuspend)){var y=r.unsuspend;r.unsuspend=null,y()}},(r.imgBytes>Ig?50:800)+s);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(f),clearTimeout(x)}}:null}function bf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Sf(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var wf=null;function Sf(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,wf=new Map,s.forEach(QB,r),wf=null,bf.call(r))}function QB(r,s){if(!(s.state.loading&4)){var c=wf.get(r);if(c)var f=c.get(null);else{c=new Map,wf.set(r,c);for(var x=r.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<x.length;y++){var E=x[y];(E.nodeName==="LINK"||E.getAttribute("media")!=="not all")&&(c.set(E.dataset.precedence,E),f=E)}f&&c.set(null,f)}x=s.instance,E=x.getAttribute("data-precedence"),y=c.get(E)||f,y===f&&c.set(null,x),c.set(E,x),this.count++,f=bf.bind(this),x.addEventListener("load",f),x.addEventListener("error",f),y?y.parentNode.insertBefore(x,y.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(x,r.firstChild)),s.state.loading|=4}}var Kc={$$typeof:T,Provider:null,Consumer:null,_currentValue:H,_currentValue2:H,_threadCount:0};function ZB(r,s,c,f,x,y,E,M,F){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ge(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ge(0),this.hiddenUpdates=Ge(null),this.identifierPrefix=f,this.onUncaughtError=x,this.onCaughtError=y,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=F,this.incompleteTransitions=new Map}function TN(r,s,c,f,x,y,E,M,F,ae,ge,ye){return r=new ZB(r,s,c,E,F,ae,ge,ye,M),s=1,y===!0&&(s|=24),y=wr(3,null,null,s),r.current=y,y.stateNode=r,s=vm(),s.refCount++,r.pooledCache=s,s.refCount++,y.memoizedState={element:f,isDehydrated:c,cache:s},wm(y),r}function RN(r){return r?(r=bo,r):bo}function AN(r,s,c,f,x,y){x=RN(x),f.context===null?f.context=x:f.pendingContext=x,f=$s(s),f.payload={element:c},y=y===void 0?null:y,y!==null&&(f.callback=y),c=Gs(r,f,s),c!==null&&(fr(c,r,s),Nc(c,r,s))}function ON(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<s?c:s}}function zg(r,s){ON(r,s),(r=r.alternate)&&ON(r,s)}function MN(r){if(r.tag===13||r.tag===31){var s=Di(r,67108864);s!==null&&fr(s,r,67108864),zg(r,67108864)}}function DN(r){if(r.tag===13||r.tag===31){var s=_r();s=Pe(s);var c=Di(r,s);c!==null&&fr(c,r,s),zg(r,s)}}var Cf=!0;function JB(r,s,c,f){var x=I.T;I.T=null;var y=q.p;try{q.p=2,Fg(r,s,c,f)}finally{q.p=y,I.T=x}}function eI(r,s,c,f){var x=I.T;I.T=null;var y=q.p;try{q.p=8,Fg(r,s,c,f)}finally{q.p=y,I.T=x}}function Fg(r,s,c,f){if(Cf){var x=Hg(f);if(x===null)_g(r,s,f,jf,c),kN(r,f);else if(nI(x,r,s,c,f))f.stopPropagation();else if(kN(r,f),s&4&&-1<tI.indexOf(r)){for(;x!==null;){var y=Ps(x);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var E=ht(y.pendingLanes);if(E!==0){var M=y;for(M.pendingLanes|=2,M.entangledLanes|=2;E;){var F=1<<31-ue(E);M.entanglements[1]|=F,E&=~F}Aa(y),(Gt&6)===0&&(sf=vt()+500,Hc(0))}}break;case 31:case 13:M=Di(y,2),M!==null&&fr(M,y,2),lf(),zg(y,2)}if(y=Hg(f),y===null&&_g(r,s,f,jf,c),y===x)break;x=y}x!==null&&f.stopPropagation()}else _g(r,s,f,null,c)}}function Hg(r){return r=fn(r),Ug(r)}var jf=null;function Ug(r){if(jf=null,r=Ya(r),r!==null){var s=l(r);if(s===null)r=null;else{var c=s.tag;if(c===13){if(r=u(s),r!==null)return r;r=null}else if(c===31){if(r=d(s),r!==null)return r;r=null}else if(c===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;r=null}else s!==r&&(r=null)}}return jf=r,null}function PN(r){switch(r){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Kt()){case Yt:return 2;case Wt:return 8;case ne:case Re:return 32;case st:return 268435456;default:return 32}default:return 32}}var qg=!1,ri=null,ai=null,si=null,Yc=new Map,Wc=new Map,ii=[],tI="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function kN(r,s){switch(r){case"focusin":case"focusout":ri=null;break;case"dragenter":case"dragleave":ai=null;break;case"mouseover":case"mouseout":si=null;break;case"pointerover":case"pointerout":Yc.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Wc.delete(s.pointerId)}}function Xc(r,s,c,f,x,y){return r===null||r.nativeEvent!==y?(r={blockedOn:s,domEventName:c,eventSystemFlags:f,nativeEvent:y,targetContainers:[x]},s!==null&&(s=Ps(s),s!==null&&MN(s)),r):(r.eventSystemFlags|=f,s=r.targetContainers,x!==null&&s.indexOf(x)===-1&&s.push(x),r)}function nI(r,s,c,f,x){switch(s){case"focusin":return ri=Xc(ri,r,s,c,f,x),!0;case"dragenter":return ai=Xc(ai,r,s,c,f,x),!0;case"mouseover":return si=Xc(si,r,s,c,f,x),!0;case"pointerover":var y=x.pointerId;return Yc.set(y,Xc(Yc.get(y)||null,r,s,c,f,x)),!0;case"gotpointercapture":return y=x.pointerId,Wc.set(y,Xc(Wc.get(y)||null,r,s,c,f,x)),!0}return!1}function LN(r){var s=Ya(r.target);if(s!==null){var c=l(s);if(c!==null){if(s=c.tag,s===13){if(s=u(c),s!==null){r.blockedOn=s,ct(r.priority,function(){DN(c)});return}}else if(s===31){if(s=d(c),s!==null){r.blockedOn=s,ct(r.priority,function(){DN(c)});return}}else if(s===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Nf(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var c=Hg(r.nativeEvent);if(c===null){c=r.nativeEvent;var f=new c.constructor(c.type,c);_n=f,c.target.dispatchEvent(f),_n=null}else return s=Ps(c),s!==null&&MN(s),r.blockedOn=c,!1;s.shift()}return!0}function BN(r,s,c){Nf(r)&&c.delete(s)}function rI(){qg=!1,ri!==null&&Nf(ri)&&(ri=null),ai!==null&&Nf(ai)&&(ai=null),si!==null&&Nf(si)&&(si=null),Yc.forEach(BN),Wc.forEach(BN)}function _f(r,s){r.blockedOn===s&&(r.blockedOn=null,qg||(qg=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,rI)))}var Ef=null;function IN(r){Ef!==r&&(Ef=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Ef===r&&(Ef=null);for(var s=0;s<r.length;s+=3){var c=r[s],f=r[s+1],x=r[s+2];if(typeof f!="function"){if(Ug(f||c)===null)continue;break}var y=Ps(c);y!==null&&(r.splice(s,3),s-=3,Hm(y,{pending:!0,data:x,method:c.method,action:f},f,x))}}))}function Vo(r){function s(F){return _f(F,r)}ri!==null&&_f(ri,r),ai!==null&&_f(ai,r),si!==null&&_f(si,r),Yc.forEach(s),Wc.forEach(s);for(var c=0;c<ii.length;c++){var f=ii[c];f.blockedOn===r&&(f.blockedOn=null)}for(;0<ii.length&&(c=ii[0],c.blockedOn===null);)LN(c),c.blockedOn===null&&ii.shift();if(c=(r.ownerDocument||r).$$reactFormReplay,c!=null)for(f=0;f<c.length;f+=3){var x=c[f],y=c[f+1],E=x[it]||null;if(typeof y=="function")E||IN(c);else if(E){var M=null;if(y&&y.hasAttribute("formAction")){if(x=y,E=y[it]||null)M=E.formAction;else if(Ug(x)!==null)continue}else M=E.action;typeof M=="function"?c[f+1]=M:(c.splice(f,3),f-=3),IN(c)}}}function zN(){function r(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(E){return x=E})},focusReset:"manual",scroll:"manual"})}function s(){x!==null&&(x(),x=null),f||setTimeout(c,20)}function c(){if(!f&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,x=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(c,100),function(){f=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),x!==null&&(x(),x=null)}}}function Vg(r){this._internalRoot=r}Tf.prototype.render=Vg.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(a(409));var c=s.current,f=_r();AN(c,f,r,s,null,null)},Tf.prototype.unmount=Vg.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;AN(r.current,2,null,r,null,null),lf(),s[zt]=null}};function Tf(r){this._internalRoot=r}Tf.prototype.unstable_scheduleHydration=function(r){if(r){var s=ze();r={blockedOn:null,target:r,priority:s};for(var c=0;c<ii.length&&s!==0&&s<ii[c].priority;c++);ii.splice(c,0,r),c===0&&LN(r)}};var FN=t.version;if(FN!=="19.2.3")throw Error(a(527,FN,"19.2.3"));q.findDOMNode=function(r){var s=r._reactInternals;if(s===void 0)throw typeof r.render=="function"?Error(a(188)):(r=Object.keys(r).join(","),Error(a(268,r)));return r=p(s),r=r!==null?v(r):null,r=r===null?null:r.stateNode,r};var aI={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Rf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Rf.isDisabled&&Rf.supportsFiber)try{mt=Rf.inject(aI),gt=Rf}catch{}}return Zc.createRoot=function(r,s){if(!i(r))throw Error(a(299));var c=!1,f="",x=KC,y=YC,E=WC;return s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(f=s.identifierPrefix),s.onUncaughtError!==void 0&&(x=s.onUncaughtError),s.onCaughtError!==void 0&&(y=s.onCaughtError),s.onRecoverableError!==void 0&&(E=s.onRecoverableError)),s=TN(r,1,!1,null,null,c,f,null,x,y,E,zN),r[zt]=s.current,Ng(r),new Vg(s)},Zc.hydrateRoot=function(r,s,c){if(!i(r))throw Error(a(299));var f=!1,x="",y=KC,E=YC,M=WC,F=null;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(x=c.identifierPrefix),c.onUncaughtError!==void 0&&(y=c.onUncaughtError),c.onCaughtError!==void 0&&(E=c.onCaughtError),c.onRecoverableError!==void 0&&(M=c.onRecoverableError),c.formState!==void 0&&(F=c.formState)),s=TN(r,1,!0,s,c??null,f,x,F,y,E,M,zN),s.context=RN(null),c=s.current,f=_r(),f=Pe(f),x=$s(f),x.callback=null,Gs(c,x,f),c=f,s.current.lanes=c,Ie(s,c),Aa(s),r[zt]=s.current,Ng(r),new Tf(s)},Zc.version="19.2.3",Zc}var XN;function mI(){if(XN)return Kg.exports;XN=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Kg.exports=pI(),Kg.exports}var gI=mI();var QN="popstate";function vI(e={}){function t(a,i){let{pathname:l,search:u,hash:d}=a.location;return Ib("",{pathname:l,search:u,hash:d},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(a,i){return typeof i=="string"?i:Eu(i)}return yI(t,n,null,e)}function pn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Qr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function xI(){return Math.random().toString(36).substring(2,10)}function ZN(e,t){return{usr:e.state,key:e.key,idx:t}}function Ib(e,t,n=null,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Dl(t):t,state:n,key:t&&t.key||a||xI()}}function Eu({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Dl(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function yI(e,t,n,a={}){let{window:i=document.defaultView,v5Compat:l=!1}=a,u=i.history,d="POP",h=null,p=v();p==null&&(p=0,u.replaceState({...u.state,idx:p},""));function v(){return(u.state||{idx:null}).idx}function m(){d="POP";let j=v(),N=j==null?null:j-p;p=j,h&&h({action:d,location:S.location,delta:N})}function b(j,N){d="PUSH";let _=Ib(S.location,j,N);p=v()+1;let T=ZN(_,p),A=S.createHref(_);try{u.pushState(T,"",A)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;i.location.assign(A)}l&&h&&h({action:d,location:S.location,delta:1})}function w(j,N){d="REPLACE";let _=Ib(S.location,j,N);p=v();let T=ZN(_,p),A=S.createHref(_);u.replaceState(T,"",A),l&&h&&h({action:d,location:S.location,delta:0})}function C(j){return bI(j)}let S={get action(){return d},get location(){return e(i,u)},listen(j){if(h)throw new Error("A history only accepts one active listener");return i.addEventListener(QN,m),h=j,()=>{i.removeEventListener(QN,m),h=null}},createHref(j){return t(i,j)},createURL:C,encodeLocation(j){let N=C(j);return{pathname:N.pathname,search:N.search,hash:N.hash}},push:b,replace:w,go(j){return u.go(j)}};return S}function bI(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),pn(n,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:Eu(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=n+a),new URL(a,n)}function EO(e,t,n="/"){return wI(e,t,n,!1)}function wI(e,t,n,a){let i=typeof t=="string"?Dl(t):t,l=Ss(i.pathname||"/",n);if(l==null)return null;let u=TO(e);SI(u);let d=null;for(let h=0;d==null&&h<u.length;++h){let p=DI(l);d=OI(u[h],p,a)}return d}function TO(e,t=[],n=[],a="",i=!1){let l=(u,d,h=i,p)=>{let v={relativePath:p===void 0?u.path||"":p,caseSensitive:u.caseSensitive===!0,childrenIndex:d,route:u};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(a)&&h)return;pn(v.relativePath.startsWith(a),`Absolute route path "${v.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(a.length)}let m=bs([a,v.relativePath]),b=n.concat(v);u.children&&u.children.length>0&&(pn(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),TO(u.children,t,b,m,h)),!(u.path==null&&!u.index)&&t.push({path:m,score:RI(m,u.index),routesMeta:b})};return e.forEach((u,d)=>{if(u.path===""||!u.path?.includes("?"))l(u,d);else for(let h of RO(u.path))l(u,d,!0,h)}),t}function RO(e){let t=e.split("/");if(t.length===0)return[];let[n,...a]=t,i=n.endsWith("?"),l=n.replace(/\?$/,"");if(a.length===0)return i?[l,""]:[l];let u=RO(a.join("/")),d=[];return d.push(...u.map(h=>h===""?l:[l,h].join("/"))),i&&d.push(...u),d.map(h=>e.startsWith("/")&&h===""?"/":h)}function SI(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:AI(t.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var CI=/^:[\w-]+$/,jI=3,NI=2,_I=1,EI=10,TI=-2,JN=e=>e==="*";function RI(e,t){let n=e.split("/"),a=n.length;return n.some(JN)&&(a+=TI),t&&(a+=NI),n.filter(i=>!JN(i)).reduce((i,l)=>i+(CI.test(l)?jI:l===""?_I:EI),a)}function AI(e,t){return e.length===t.length&&e.slice(0,-1).every((a,i)=>a===t[i])?e[e.length-1]-t[t.length-1]:0}function OI(e,t,n=!1){let{routesMeta:a}=e,i={},l="/",u=[];for(let d=0;d<a.length;++d){let h=a[d],p=d===a.length-1,v=l==="/"?t:t.slice(l.length)||"/",m=uh({path:h.relativePath,caseSensitive:h.caseSensitive,end:p},v),b=h.route;if(!m&&p&&n&&!a[a.length-1].route.index&&(m=uh({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},v)),!m)return null;Object.assign(i,m.params),u.push({params:i,pathname:bs([l,m.pathname]),pathnameBase:BI(bs([l,m.pathnameBase])),route:b}),m.pathnameBase!=="/"&&(l=bs([l,m.pathnameBase]))}return u}function uh(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=MI(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let l=i[0],u=l.replace(/(.)\/+$/,"$1"),d=i.slice(1);return{params:a.reduce((p,{paramName:v,isOptional:m},b)=>{if(v==="*"){let C=d[b]||"";u=l.slice(0,l.length-C.length).replace(/(.)\/+$/,"$1")}const w=d[b];return m&&!w?p[v]=void 0:p[v]=(w||"").replace(/%2F/g,"/"),p},{}),pathname:l,pathnameBase:u,pattern:e}}function MI(e,t=!1,n=!0){Qr(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,h)=>(a.push({paramName:d,isOptional:h!=null}),h?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),a]}function DI(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Qr(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ss(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,a=e.charAt(n);return a&&a!=="/"?null:e.slice(n)||"/"}var AO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,PI=e=>AO.test(e);function kI(e,t="/"){let{pathname:n,search:a="",hash:i=""}=typeof e=="string"?Dl(e):e,l;if(n)if(PI(n))l=n;else{if(n.includes("//")){let u=n;n=n.replace(/\/\/+/g,"/"),Qr(!1,`Pathnames cannot have embedded double slashes - normalizing ${u} -> ${n}`)}n.startsWith("/")?l=e_(n.substring(1),"/"):l=e_(n,t)}else l=t;return{pathname:l,search:II(a),hash:zI(i)}}function e_(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Qg(e,t,n,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function LI(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function OO(e){let t=LI(e);return t.map((n,a)=>a===t.length-1?n.pathname:n.pathnameBase)}function MO(e,t,n,a=!1){let i;typeof e=="string"?i=Dl(e):(i={...e},pn(!i.pathname||!i.pathname.includes("?"),Qg("?","pathname","search",i)),pn(!i.pathname||!i.pathname.includes("#"),Qg("#","pathname","hash",i)),pn(!i.search||!i.search.includes("#"),Qg("#","search","hash",i)));let l=e===""||i.pathname==="",u=l?"/":i.pathname,d;if(u==null)d=n;else{let m=t.length-1;if(!a&&u.startsWith("..")){let b=u.split("/");for(;b[0]==="..";)b.shift(),m-=1;i.pathname=b.join("/")}d=m>=0?t[m]:"/"}let h=kI(i,d),p=u&&u!=="/"&&u.endsWith("/"),v=(l||u===".")&&n.endsWith("/");return!h.pathname.endsWith("/")&&(p||v)&&(h.pathname+="/"),h}var bs=e=>e.join("/").replace(/\/\/+/g,"/"),BI=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),II=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,zI=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,FI=class{constructor(e,t,n,a=!1){this.status=e,this.statusText=t||"",this.internal=a,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function HI(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function UI(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var DO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function PO(e,t){let n=e;if(typeof n!="string"||!AO.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=n,i=!1;if(DO)try{let l=new URL(window.location.href),u=n.startsWith("//")?new URL(l.protocol+n):new URL(n),d=Ss(u.pathname,t);u.origin===l.origin&&d!=null?n=d+u.search+u.hash:i=!0}catch{Qr(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var kO=["POST","PUT","PATCH","DELETE"];new Set(kO);var qI=["GET",...kO];new Set(qI);var Pl=g.createContext(null);Pl.displayName="DataRouter";var Fh=g.createContext(null);Fh.displayName="DataRouterState";var VI=g.createContext(!1),LO=g.createContext({isTransitioning:!1});LO.displayName="ViewTransition";var $I=g.createContext(new Map);$I.displayName="Fetchers";var GI=g.createContext(null);GI.displayName="Await";var ea=g.createContext(null);ea.displayName="Navigation";var Ku=g.createContext(null);Ku.displayName="Location";var Va=g.createContext({outlet:null,matches:[],isDataRoute:!1});Va.displayName="Route";var Y0=g.createContext(null);Y0.displayName="RouteError";var BO="REACT_ROUTER_ERROR",KI="REDIRECT",YI="ROUTE_ERROR_RESPONSE";function WI(e){if(e.startsWith(`${BO}:${KI}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function XI(e){if(e.startsWith(`${BO}:${YI}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new FI(t.status,t.statusText,t.data)}catch{}}function QI(e,{relative:t}={}){pn(Yu(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=g.useContext(ea),{hash:i,pathname:l,search:u}=Wu(e,{relative:t}),d=l;return n!=="/"&&(d=l==="/"?n:bs([n,l])),a.createHref({pathname:d,search:u,hash:i})}function Yu(){return g.useContext(Ku)!=null}function Es(){return pn(Yu(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(Ku).location}var IO="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function zO(e){g.useContext(ea).static||g.useLayoutEffect(e)}function kl(){let{isDataRoute:e}=g.useContext(Va);return e?d6():ZI()}function ZI(){pn(Yu(),"useNavigate() may be used only in the context of a <Router> component.");let e=g.useContext(Pl),{basename:t,navigator:n}=g.useContext(ea),{matches:a}=g.useContext(Va),{pathname:i}=Es(),l=JSON.stringify(OO(a)),u=g.useRef(!1);return zO(()=>{u.current=!0}),g.useCallback((h,p={})=>{if(Qr(u.current,IO),!u.current)return;if(typeof h=="number"){n.go(h);return}let v=MO(h,JSON.parse(l),i,p.relative==="path");e==null&&t!=="/"&&(v.pathname=v.pathname==="/"?t:bs([t,v.pathname])),(p.replace?n.replace:n.push)(v,p.state,p)},[t,n,l,i,e])}var FO=g.createContext(null);function HO(){return g.useContext(FO)}function JI(e){let t=g.useContext(Va).outlet;return g.useMemo(()=>t&&g.createElement(FO.Provider,{value:e},t),[t,e])}function Wu(e,{relative:t}={}){let{matches:n}=g.useContext(Va),{pathname:a}=Es(),i=JSON.stringify(OO(n));return g.useMemo(()=>MO(e,JSON.parse(i),a,t==="path"),[e,i,a,t])}function e6(e,t){return UO(e,t)}function UO(e,t,n,a,i){pn(Yu(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:l}=g.useContext(ea),{matches:u}=g.useContext(Va),d=u[u.length-1],h=d?d.params:{},p=d?d.pathname:"/",v=d?d.pathnameBase:"/",m=d&&d.route;{let _=m&&m.path||"";VO(p,!m||_.endsWith("*")||_.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${_}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
  10. Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}/*`}">.`)}let b=Es(),w;if(t){let _=typeof t=="string"?Dl(t):t;pn(v==="/"||_.pathname?.startsWith(v),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${v}" but pathname "${_.pathname}" was given in the \`location\` prop.`),w=_}else w=b;let C=w.pathname||"/",S=C;if(v!=="/"){let _=v.replace(/^\//,"").split("/");S="/"+C.replace(/^\//,"").split("/").slice(_.length).join("/")}let j=EO(e,{pathname:S});Qr(m||j!=null,`No routes matched location "${w.pathname}${w.search}${w.hash}" `),Qr(j==null||j[j.length-1].route.element!==void 0||j[j.length-1].route.Component!==void 0||j[j.length-1].route.lazy!==void 0,`Matched leaf route at location "${w.pathname}${w.search}${w.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let N=s6(j&&j.map(_=>Object.assign({},_,{params:Object.assign({},h,_.params),pathname:bs([v,l.encodeLocation?l.encodeLocation(_.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?v:bs([v,l.encodeLocation?l.encodeLocation(_.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathnameBase])})),u,n,a,i);return t&&N?g.createElement(Ku.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...w},navigationType:"POP"}},N):N}function t6(){let e=u6(),t=HI(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:a},l={padding:"2px 4px",backgroundColor:a},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=g.createElement(g.Fragment,null,g.createElement("p",null,"💿 Hey developer 👋"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:l},"ErrorBoundary")," or"," ",g.createElement("code",{style:l},"errorElement")," prop on your route.")),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),n?g.createElement("pre",{style:i},n):null,u)}var n6=g.createElement(t6,null),qO=class extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=XI(e.digest);n&&(e=n)}let t=e!==void 0?g.createElement(Va.Provider,{value:this.props.routeContext},g.createElement(Y0.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?g.createElement(r6,{error:e},t):t}};qO.contextType=VI;var Zg=new WeakMap;function r6({children:e,error:t}){let{basename:n}=g.useContext(ea);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=WI(t.digest);if(a){let i=Zg.get(t);if(i)throw i;let l=PO(a.location,n);if(DO&&!Zg.get(t))if(l.isExternal||a.reloadDocument)window.location.href=l.absoluteURL||l.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:a.replace}));throw Zg.set(t,u),u}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function a6({routeContext:e,match:t,children:n}){let a=g.useContext(Pl);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(Va.Provider,{value:e},n)}function s6(e,t=[],n=null,a=null,i=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let l=e,u=n?.errors;if(u!=null){let v=l.findIndex(m=>m.route.id&&u?.[m.route.id]!==void 0);pn(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),l=l.slice(0,Math.min(l.length,v+1))}let d=!1,h=-1;if(n)for(let v=0;v<l.length;v++){let m=l[v];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(h=v),m.route.id){let{loaderData:b,errors:w}=n,C=m.route.loader&&!b.hasOwnProperty(m.route.id)&&(!w||w[m.route.id]===void 0);if(m.route.lazy||C){d=!0,h>=0?l=l.slice(0,h+1):l=[l[0]];break}}}let p=n&&a?(v,m)=>{a(v,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:UI(n.matches),errorInfo:m})}:void 0;return l.reduceRight((v,m,b)=>{let w,C=!1,S=null,j=null;n&&(w=u&&m.route.id?u[m.route.id]:void 0,S=m.route.errorElement||n6,d&&(h<0&&b===0?(VO("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,j=null):h===b&&(C=!0,j=m.route.hydrateFallbackElement||null)));let N=t.concat(l.slice(0,b+1)),_=()=>{let T;return w?T=S:C?T=j:m.route.Component?T=g.createElement(m.route.Component,null):m.route.element?T=m.route.element:T=v,g.createElement(a6,{match:m,routeContext:{outlet:v,matches:N,isDataRoute:n!=null},children:T})};return n&&(m.route.ErrorBoundary||m.route.errorElement||b===0)?g.createElement(qO,{location:n.location,revalidation:n.revalidation,component:S,error:w,children:_(),routeContext:{outlet:null,matches:N,isDataRoute:!0},onError:p}):_()},null)}function W0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function i6(e){let t=g.useContext(Pl);return pn(t,W0(e)),t}function o6(e){let t=g.useContext(Fh);return pn(t,W0(e)),t}function l6(e){let t=g.useContext(Va);return pn(t,W0(e)),t}function X0(e){let t=l6(e),n=t.matches[t.matches.length-1];return pn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function c6(){return X0("useRouteId")}function u6(){let e=g.useContext(Y0),t=o6("useRouteError"),n=X0("useRouteError");return e!==void 0?e:t.errors?.[n]}function d6(){let{router:e}=i6("useNavigate"),t=X0("useNavigate"),n=g.useRef(!1);return zO(()=>{n.current=!0}),g.useCallback(async(i,l={})=>{Qr(n.current,IO),n.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:t,...l}))},[e,t])}var t_={};function VO(e,t,n){!t&&!t_[e]&&(t_[e]=!0,Qr(!1,n))}g.memo(f6);function f6({routes:e,future:t,state:n,onError:a}){return UO(e,void 0,n,a,t)}function h6(e){return JI(e.context)}function Ma(e){pn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function p6({basename:e="/",children:t=null,location:n,navigationType:a="POP",navigator:i,static:l=!1,unstable_useTransitions:u}){pn(!Yu(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),h=g.useMemo(()=>({basename:d,navigator:i,static:l,unstable_useTransitions:u,future:{}}),[d,i,l,u]);typeof n=="string"&&(n=Dl(n));let{pathname:p="/",search:v="",hash:m="",state:b=null,key:w="default"}=n,C=g.useMemo(()=>{let S=Ss(p,d);return S==null?null:{location:{pathname:S,search:v,hash:m,state:b,key:w},navigationType:a}},[d,p,v,m,b,w,a]);return Qr(C!=null,`<Router basename="${d}"> is not able to match the URL "${p}${v}${m}" because it does not start with the basename, so the <Router> won't render anything.`),C==null?null:g.createElement(ea.Provider,{value:h},g.createElement(Ku.Provider,{children:t,value:C}))}function m6({children:e,location:t}){return e6(zb(e),t)}function zb(e,t=[]){let n=[];return g.Children.forEach(e,(a,i)=>{if(!g.isValidElement(a))return;let l=[...t,i];if(a.type===g.Fragment){n.push.apply(n,zb(a.props.children,l));return}pn(a.type===Ma,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),pn(!a.props.index||!a.props.children,"An index route cannot have child routes.");let u={id:a.props.id||l.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(u.children=zb(a.props.children,l)),n.push(u)}),n}var Qf="get",Zf="application/x-www-form-urlencoded";function Hh(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function g6(e){return Hh(e)&&e.tagName.toLowerCase()==="button"}function v6(e){return Hh(e)&&e.tagName.toLowerCase()==="form"}function x6(e){return Hh(e)&&e.tagName.toLowerCase()==="input"}function y6(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function b6(e,t){return e.button===0&&(!t||t==="_self")&&!y6(e)}function Fb(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let a=e[n];return t.concat(Array.isArray(a)?a.map(i=>[n,i]):[[n,a]])},[]))}function w6(e,t){let n=Fb(e);return t&&t.forEach((a,i)=>{n.has(i)||t.getAll(i).forEach(l=>{n.append(i,l)})}),n}var Of=null;function S6(){if(Of===null)try{new FormData(document.createElement("form"),0),Of=!1}catch{Of=!0}return Of}var C6=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Jg(e){return e!=null&&!C6.has(e)?(Qr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Zf}"`),null):e}function j6(e,t){let n,a,i,l,u;if(v6(e)){let d=e.getAttribute("action");a=d?Ss(d,t):null,n=e.getAttribute("method")||Qf,i=Jg(e.getAttribute("enctype"))||Zf,l=new FormData(e)}else if(g6(e)||x6(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=e.getAttribute("formaction")||d.getAttribute("action");if(a=h?Ss(h,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||Qf,i=Jg(e.getAttribute("formenctype"))||Jg(d.getAttribute("enctype"))||Zf,l=new FormData(d,e),!S6()){let{name:p,type:v,value:m}=e;if(v==="image"){let b=p?`${p}.`:"";l.append(`${b}x`,"0"),l.append(`${b}y`,"0")}else p&&l.append(p,m)}}else{if(Hh(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Qf,a=null,i=Zf,u=e}return l&&i==="text/plain"&&(u=l,l=void 0),{action:a,method:n.toLowerCase(),encType:i,formData:l,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Q0(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function N6(e,t,n,a){let i=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${a}`:i.pathname=`${i.pathname}.${a}`:i.pathname==="/"?i.pathname=`_root.${a}`:t&&Ss(i.pathname,t)==="/"?i.pathname=`${t.replace(/\/$/,"")}/_root.${a}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${a}`,i}async function _6(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function E6(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function T6(e,t,n){let a=await Promise.all(e.map(async i=>{let l=t.routes[i.route.id];if(l){let u=await _6(l,n);return u.links?u.links():[]}return[]}));return M6(a.flat(1).filter(E6).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function n_(e,t,n,a,i,l){let u=(h,p)=>n[p]?h.route.id!==n[p].route.id:!0,d=(h,p)=>n[p].pathname!==h.pathname||n[p].route.path?.endsWith("*")&&n[p].params["*"]!==h.params["*"];return l==="assets"?t.filter((h,p)=>u(h,p)||d(h,p)):l==="data"?t.filter((h,p)=>{let v=a.routes[h.route.id];if(!v||!v.hasLoader)return!1;if(u(h,p)||d(h,p))return!0;if(h.route.shouldRevalidate){let m=h.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function R6(e,t,{includeHydrateFallback:n}={}){return A6(e.map(a=>{let i=t.routes[a.route.id];if(!i)return[];let l=[i.module];return i.clientActionModule&&(l=l.concat(i.clientActionModule)),i.clientLoaderModule&&(l=l.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(l=l.concat(i.hydrateFallbackModule)),i.imports&&(l=l.concat(i.imports)),l}).flat(1))}function A6(e){return[...new Set(e)]}function O6(e){let t={},n=Object.keys(e).sort();for(let a of n)t[a]=e[a];return t}function M6(e,t){let n=new Set;return new Set(t),e.reduce((a,i)=>{let l=JSON.stringify(O6(i));return n.has(l)||(n.add(l),a.push({key:l,link:i})),a},[])}function $O(){let e=g.useContext(Pl);return Q0(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function D6(){let e=g.useContext(Fh);return Q0(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Z0=g.createContext(void 0);Z0.displayName="FrameworkContext";function GO(){let e=g.useContext(Z0);return Q0(e,"You must render this element inside a <HydratedRouter> element"),e}function P6(e,t){let n=g.useContext(Z0),[a,i]=g.useState(!1),[l,u]=g.useState(!1),{onFocus:d,onBlur:h,onMouseEnter:p,onMouseLeave:v,onTouchStart:m}=t,b=g.useRef(null);g.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let S=N=>{N.forEach(_=>{u(_.isIntersecting)})},j=new IntersectionObserver(S,{threshold:.5});return b.current&&j.observe(b.current),()=>{j.disconnect()}}},[e]),g.useEffect(()=>{if(a){let S=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(S)}}},[a]);let w=()=>{i(!0)},C=()=>{i(!1),u(!1)};return n?e!=="intent"?[l,b,{}]:[l,b,{onFocus:Jc(d,w),onBlur:Jc(h,C),onMouseEnter:Jc(p,w),onMouseLeave:Jc(v,C),onTouchStart:Jc(m,w)}]:[!1,b,{}]}function Jc(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function k6({page:e,...t}){let{router:n}=$O(),a=g.useMemo(()=>EO(n.routes,e,n.basename),[n.routes,e,n.basename]);return a?g.createElement(B6,{page:e,matches:a,...t}):null}function L6(e){let{manifest:t,routeModules:n}=GO(),[a,i]=g.useState([]);return g.useEffect(()=>{let l=!1;return T6(e,t,n).then(u=>{l||i(u)}),()=>{l=!0}},[e,t,n]),a}function B6({page:e,matches:t,...n}){let a=Es(),{future:i,manifest:l,routeModules:u}=GO(),{basename:d}=$O(),{loaderData:h,matches:p}=D6(),v=g.useMemo(()=>n_(e,t,p,l,a,"data"),[e,t,p,l,a]),m=g.useMemo(()=>n_(e,t,p,l,a,"assets"),[e,t,p,l,a]),b=g.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let S=new Set,j=!1;if(t.forEach(_=>{let T=l.routes[_.route.id];!T||!T.hasLoader||(!v.some(A=>A.route.id===_.route.id)&&_.route.id in h&&u[_.route.id]?.shouldRevalidate||T.hasClientLoader?j=!0:S.add(_.route.id))}),S.size===0)return[];let N=N6(e,d,i.unstable_trailingSlashAwareDataRequests,"data");return j&&S.size>0&&N.searchParams.set("_routes",t.filter(_=>S.has(_.route.id)).map(_=>_.route.id).join(",")),[N.pathname+N.search]},[d,i.unstable_trailingSlashAwareDataRequests,h,a,l,v,t,e,u]),w=g.useMemo(()=>R6(m,l),[m,l]),C=L6(m);return g.createElement(g.Fragment,null,b.map(S=>g.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...n})),w.map(S=>g.createElement("link",{key:S,rel:"modulepreload",href:S,...n})),C.map(({key:S,link:j})=>g.createElement("link",{key:S,nonce:n.nonce,...j})))}function I6(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var z6=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{z6&&(window.__reactRouterVersion="7.12.0")}catch{}function F6({basename:e,children:t,unstable_useTransitions:n,window:a}){let i=g.useRef();i.current==null&&(i.current=vI({window:a,v5Compat:!0}));let l=i.current,[u,d]=g.useState({action:l.action,location:l.location}),h=g.useCallback(p=>{n===!1?d(p):g.startTransition(()=>d(p))},[n]);return g.useLayoutEffect(()=>l.listen(h),[l,h]),g.createElement(p6,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:l,unstable_useTransitions:n})}var KO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,pi=g.forwardRef(function({onClick:t,discover:n="render",prefetch:a="none",relative:i,reloadDocument:l,replace:u,state:d,target:h,to:p,preventScrollReset:v,viewTransition:m,unstable_defaultShouldRevalidate:b,...w},C){let{basename:S,unstable_useTransitions:j}=g.useContext(ea),N=typeof p=="string"&&KO.test(p),_=PO(p,S);p=_.to;let T=QI(p,{relative:i}),[A,D,L]=P6(a,w),k=V6(p,{replace:u,state:d,target:h,preventScrollReset:v,relative:i,viewTransition:m,unstable_defaultShouldRevalidate:b,unstable_useTransitions:j});function P(J){t&&t(J),J.defaultPrevented||k(J)}let U=g.createElement("a",{...w,...L,href:_.absoluteURL||T,onClick:_.isExternal||l?t:P,ref:I6(C,D),target:h,"data-discover":!N&&n==="render"?"true":void 0});return A&&!N?g.createElement(g.Fragment,null,U,g.createElement(k6,{page:T})):U});pi.displayName="Link";var H6=g.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:a="",end:i=!1,style:l,to:u,viewTransition:d,children:h,...p},v){let m=Wu(u,{relative:p.relative}),b=Es(),w=g.useContext(Fh),{navigator:C,basename:S}=g.useContext(ea),j=w!=null&&X6(m)&&d===!0,N=C.encodeLocation?C.encodeLocation(m).pathname:m.pathname,_=b.pathname,T=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;n||(_=_.toLowerCase(),T=T?T.toLowerCase():null,N=N.toLowerCase()),T&&S&&(T=Ss(T,S)||T);const A=N!=="/"&&N.endsWith("/")?N.length-1:N.length;let D=_===N||!i&&_.startsWith(N)&&_.charAt(A)==="/",L=T!=null&&(T===N||!i&&T.startsWith(N)&&T.charAt(N.length)==="/"),k={isActive:D,isPending:L,isTransitioning:j},P=D?t:void 0,U;typeof a=="function"?U=a(k):U=[a,D?"active":null,L?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let J=typeof l=="function"?l(k):l;return g.createElement(pi,{...p,"aria-current":P,className:U,ref:v,style:J,to:u,viewTransition:d},typeof h=="function"?h(k):h)});H6.displayName="NavLink";var U6=g.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:i,state:l,method:u=Qf,action:d,onSubmit:h,relative:p,preventScrollReset:v,viewTransition:m,unstable_defaultShouldRevalidate:b,...w},C)=>{let{unstable_useTransitions:S}=g.useContext(ea),j=Y6(),N=W6(d,{relative:p}),_=u.toLowerCase()==="get"?"get":"post",T=typeof d=="string"&&KO.test(d),A=D=>{if(h&&h(D),D.defaultPrevented)return;D.preventDefault();let L=D.nativeEvent.submitter,k=L?.getAttribute("formmethod")||u,P=()=>j(L||D.currentTarget,{fetcherKey:t,method:k,navigate:n,replace:i,state:l,relative:p,preventScrollReset:v,viewTransition:m,unstable_defaultShouldRevalidate:b});S&&n!==!1?g.startTransition(()=>P()):P()};return g.createElement("form",{ref:C,method:_,action:N,onSubmit:a?h:A,...w,"data-discover":!T&&e==="render"?"true":void 0})});U6.displayName="Form";function q6(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function YO(e){let t=g.useContext(Pl);return pn(t,q6(e)),t}function V6(e,{target:t,replace:n,state:a,preventScrollReset:i,relative:l,viewTransition:u,unstable_defaultShouldRevalidate:d,unstable_useTransitions:h}={}){let p=kl(),v=Es(),m=Wu(e,{relative:l});return g.useCallback(b=>{if(b6(b,t)){b.preventDefault();let w=n!==void 0?n:Eu(v)===Eu(m),C=()=>p(e,{replace:w,state:a,preventScrollReset:i,relative:l,viewTransition:u,unstable_defaultShouldRevalidate:d});h?g.startTransition(()=>C()):C()}},[v,p,m,n,a,t,e,i,l,u,d,h])}function $6(e){Qr(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=g.useRef(Fb(e)),n=g.useRef(!1),a=Es(),i=g.useMemo(()=>w6(a.search,n.current?null:t.current),[a.search]),l=kl(),u=g.useCallback((d,h)=>{const p=Fb(typeof d=="function"?d(new URLSearchParams(i)):d);n.current=!0,l("?"+p,h)},[l,i]);return[i,u]}var G6=0,K6=()=>`__${String(++G6)}__`;function Y6(){let{router:e}=YO("useSubmit"),{basename:t}=g.useContext(ea),n=c6(),a=e.fetch,i=e.navigate;return g.useCallback(async(l,u={})=>{let{action:d,method:h,encType:p,formData:v,body:m}=j6(l,t);if(u.navigate===!1){let b=u.fetcherKey||K6();await a(b,n,u.action||d,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:m,formMethod:u.method||h,formEncType:u.encType||p,flushSync:u.flushSync})}else await i(u.action||d,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:m,formMethod:u.method||h,formEncType:u.encType||p,replace:u.replace,state:u.state,fromRouteId:n,flushSync:u.flushSync,viewTransition:u.viewTransition})},[a,i,t,n])}function W6(e,{relative:t}={}){let{basename:n}=g.useContext(ea),a=g.useContext(Va);pn(a,"useFormAction must be used inside a RouteContext");let[i]=a.matches.slice(-1),l={...Wu(e||".",{relative:t})},u=Es();if(e==null){l.search=u.search;let d=new URLSearchParams(l.search),h=d.getAll("index");if(h.some(v=>v==="")){d.delete("index"),h.filter(m=>m).forEach(m=>d.append("index",m));let v=d.toString();l.search=v?`?${v}`:""}}return(!e||e===".")&&i.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(l.pathname=l.pathname==="/"?n:bs([n,l.pathname])),Eu(l)}function X6(e,{relative:t}={}){let n=g.useContext(LO);pn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=YO("useViewTransitionState"),i=Wu(e,{relative:t});if(!n.isTransitioning)return!1;let l=Ss(n.currentLocation.pathname,a)||n.currentLocation.pathname,u=Ss(n.nextLocation.pathname,a)||n.nextLocation.pathname;return uh(i.pathname,u)!=null||uh(i.pathname,l)!=null}var ka=_O();const WO=Ml(ka);var Uh=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Q6={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Z6=class{#e=Q6;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},Hb=new Z6;function J6(e){setTimeout(e,0)}var qh=typeof window>"u"||"Deno"in globalThis;function ca(){}function ez(e,t){return typeof e=="function"?e(t):e}function tz(e){return typeof e=="number"&&e>=0&&e!==1/0}function nz(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ub(e,t){return typeof e=="function"?e(t):e}function rz(e,t){return typeof e=="function"?e(t):e}function r_(e,t){const{type:n="all",exact:a,fetchStatus:i,predicate:l,queryKey:u,stale:d}=e;if(u){if(a){if(t.queryHash!==J0(u,t.options))return!1}else if(!Ru(t.queryKey,u))return!1}if(n!=="all"){const h=t.isActive();if(n==="active"&&!h||n==="inactive"&&h)return!1}return!(typeof d=="boolean"&&t.isStale()!==d||i&&i!==t.state.fetchStatus||l&&!l(t))}function a_(e,t){const{exact:n,status:a,predicate:i,mutationKey:l}=e;if(l){if(!t.options.mutationKey)return!1;if(n){if(Tu(t.options.mutationKey)!==Tu(l))return!1}else if(!Ru(t.options.mutationKey,l))return!1}return!(a&&t.state.status!==a||i&&!i(t))}function J0(e,t){return(t?.queryKeyHashFn||Tu)(e)}function Tu(e){return JSON.stringify(e,(t,n)=>qb(n)?Object.keys(n).sort().reduce((a,i)=>(a[i]=n[i],a),{}):n)}function Ru(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Ru(e[n],t[n])):!1}var az=Object.prototype.hasOwnProperty;function XO(e,t){if(e===t)return e;const n=s_(e)&&s_(t);if(!n&&!(qb(e)&&qb(t)))return t;const i=(n?e:Object.keys(e)).length,l=n?t:Object.keys(t),u=l.length,d=n?new Array(u):{};let h=0;for(let p=0;p<u;p++){const v=n?p:l[p],m=e[v],b=t[v];if(m===b){d[v]=m,(n?p<i:az.call(e,v))&&h++;continue}if(m===null||b===null||typeof m!="object"||typeof b!="object"){d[v]=b;continue}const w=XO(m,b);d[v]=w,w===m&&h++}return i===u&&h===i?e:d}function s_(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function qb(e){if(!i_(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!i_(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function i_(e){return Object.prototype.toString.call(e)==="[object Object]"}function sz(e){return new Promise(t=>{Hb.setTimeout(t,e)})}function iz(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?XO(e,t):t}function oz(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function lz(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var ew=Symbol();function QO(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ew?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function cz(e,t,n){let a=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),a||(a=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),e}var uz=class extends Uh{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!qh&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},ZO=new uz;function dz(){let e,t;const n=new Promise((i,l)=>{e=i,t=l});n.status="pending",n.catch(()=>{});function a(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{a({status:"fulfilled",value:i}),e(i)},n.reject=i=>{a({status:"rejected",reason:i}),t(i)},n}var fz=J6;function hz(){let e=[],t=0,n=d=>{d()},a=d=>{d()},i=fz;const l=d=>{t?e.push(d):i(()=>{n(d)})},u=()=>{const d=e;e=[],d.length&&i(()=>{a(()=>{d.forEach(h=>{n(h)})})})};return{batch:d=>{let h;t++;try{h=d()}finally{t--,t||u()}return h},batchCalls:d=>(...h)=>{l(()=>{d(...h)})},schedule:l,setNotifyFunction:d=>{n=d},setBatchNotifyFunction:d=>{a=d},setScheduler:d=>{i=d}}}var tr=hz(),pz=class extends Uh{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!qh&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},dh=new pz;function mz(e){return Math.min(1e3*2**e,3e4)}function JO(e){return(e??"online")==="online"?dh.isOnline():!0}var Vb=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function eM(e){let t=!1,n=0,a;const i=dz(),l=()=>i.status!=="pending",u=S=>{if(!l()){const j=new Vb(S);b(j),e.onCancel?.(j)}},d=()=>{t=!0},h=()=>{t=!1},p=()=>ZO.isFocused()&&(e.networkMode==="always"||dh.isOnline())&&e.canRun(),v=()=>JO(e.networkMode)&&e.canRun(),m=S=>{l()||(a?.(),i.resolve(S))},b=S=>{l()||(a?.(),i.reject(S))},w=()=>new Promise(S=>{a=j=>{(l()||p())&&S(j)},e.onPause?.()}).then(()=>{a=void 0,l()||e.onContinue?.()}),C=()=>{if(l())return;let S;const j=n===0?e.initialPromise:void 0;try{S=j??e.fn()}catch(N){S=Promise.reject(N)}Promise.resolve(S).then(m).catch(N=>{if(l())return;const _=e.retry??(qh?0:3),T=e.retryDelay??mz,A=typeof T=="function"?T(n,N):T,D=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,N);if(t||!D){b(N);return}n++,e.onFail?.(n,N),sz(A).then(()=>p()?void 0:w()).then(()=>{t?b(N):C()})})};return{promise:i,status:()=>i.status,cancel:u,continue:()=>(a?.(),i),cancelRetry:d,continueRetry:h,canStart:v,start:()=>(v()?C():w().then(C),i)}}var tM=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),tz(this.gcTime)&&(this.#e=Hb.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(qh?1/0:300*1e3))}clearGcTimeout(){this.#e&&(Hb.clearTimeout(this.#e),this.#e=void 0)}},gz=class extends tM{#e;#t;#n;#a;#r;#i;#o;constructor(e){super(),this.#o=!1,this.#i=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#a=e.client,this.#n=this.#a.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=l_(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#i,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=l_(this.options);t.data!==void 0&&(this.setState(o_(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=iz(this.state.data,e,this.options);return this.#s({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#s({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(ca).catch(ca):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>rz(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ew||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Ub(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!nz(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#o?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const d=this.observers.find(h=>h.options.queryFn);d&&this.setOptions(d.options)}const n=new AbortController,a=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{const d=QO(this.options,t),p=(()=>{const v={client:this.#a,queryKey:this.queryKey,meta:this.meta};return a(v),v})();return this.#o=!1,this.options.persister?this.options.persister(d,p,this):d(p)},u=(()=>{const d={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#a,state:this.state,fetchFn:i};return a(d),d})();this.options.behavior?.onFetch(u,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==u.fetchOptions?.meta)&&this.#s({type:"fetch",meta:u.fetchOptions?.meta}),this.#r=eM({initialPromise:t?.initialPromise,fn:u.fetchFn,onCancel:d=>{d instanceof Vb&&d.revert&&this.setState({...this.#t,fetchStatus:"idle"}),n.abort()},onFail:(d,h)=>{this.#s({type:"failed",failureCount:d,error:h})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0});try{const d=await this.#r.start();if(d===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(d),this.#n.config.onSuccess?.(d,this),this.#n.config.onSettled?.(d,this.state.error,this),d}catch(d){if(d instanceof Vb){if(d.silent)return this.#r.promise;if(d.revert){if(this.state.data===void 0)throw d;return this.state.data}}throw this.#s({type:"error",error:d}),this.#n.config.onError?.(d,this),this.#n.config.onSettled?.(this.state.data,d,this),d}finally{this.scheduleGc()}}#s(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...vz(n.data,this.options),fetchMeta:e.meta??null};case"success":const a={...n,...o_(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?a:void 0,a;case"error":const i=e.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),tr.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function vz(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:JO(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function o_(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function l_(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,a=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}function c_(e){return{onFetch:(t,n)=>{const a=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,l=t.state.data?.pages||[],u=t.state.data?.pageParams||[];let d={pages:[],pageParams:[]},h=0;const p=async()=>{let v=!1;const m=C=>{cz(C,()=>t.signal,()=>v=!0)},b=QO(t.options,t.fetchOptions),w=async(C,S,j)=>{if(v)return Promise.reject();if(S==null&&C.pages.length)return Promise.resolve(C);const _=(()=>{const L={client:t.client,queryKey:t.queryKey,pageParam:S,direction:j?"backward":"forward",meta:t.options.meta};return m(L),L})(),T=await b(_),{maxPages:A}=t.options,D=j?lz:oz;return{pages:D(C.pages,T,A),pageParams:D(C.pageParams,S,A)}};if(i&&l.length){const C=i==="backward",S=C?xz:u_,j={pages:l,pageParams:u},N=S(a,j);d=await w(j,N,C)}else{const C=e??l.length;do{const S=h===0?u[0]??a.initialPageParam:u_(a,d);if(h>0&&S==null)break;d=await w(d,S),h++}while(h<C)}return d};t.options.persister?t.fetchFn=()=>t.options.persister?.(p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=p}}}function u_(e,{pages:t,pageParams:n}){const a=t.length-1;return t.length>0?e.getNextPageParam(t[a],t,n[a],n):void 0}function xz(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var yz=class extends tM{#e;#t;#n;#a;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||bz(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#a?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#r({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#a=eM({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(l,u)=>{this.#r({type:"failed",failureCount:l,error:u})},onPause:()=>{this.#r({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const a=this.state.status==="pending",i=!this.#a.canStart();try{if(a)t();else{this.#r({type:"pending",variables:e,isPaused:i}),await this.#n.config.onMutate?.(e,this,n);const u=await this.options.onMutate?.(e,n);u!==this.state.context&&this.#r({type:"pending",context:u,variables:e,isPaused:i})}const l=await this.#a.start();return await this.#n.config.onSuccess?.(l,e,this.state.context,this,n),await this.options.onSuccess?.(l,e,this.state.context,n),await this.#n.config.onSettled?.(l,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(l,null,e,this.state.context,n),this.#r({type:"success",data:l}),l}catch(l){try{await this.#n.config.onError?.(l,e,this.state.context,this,n)}catch(u){Promise.reject(u)}try{await this.options.onError?.(l,e,this.state.context,n)}catch(u){Promise.reject(u)}try{await this.#n.config.onSettled?.(void 0,l,this.state.variables,this.state.context,this,n)}catch(u){Promise.reject(u)}try{await this.options.onSettled?.(void 0,l,e,this.state.context,n)}catch(u){Promise.reject(u)}throw this.#r({type:"error",error:l}),l}finally{this.#n.runNext(this)}}#r(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),tr.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function bz(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var wz=class extends Uh{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const a=new yz({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(a),a}add(e){this.#e.add(e);const t=Mf(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Mf(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const a=n.indexOf(e);a!==-1&&n.splice(a,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Mf(e);if(typeof t=="string"){const a=this.#t.get(t)?.find(i=>i.state.status==="pending");return!a||a===e}else return!0}runNext(e){const t=Mf(e);return typeof t=="string"?this.#t.get(t)?.find(a=>a!==e&&a.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){tr.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>a_(t,n))}findAll(e={}){return this.getAll().filter(t=>a_(e,t))}notify(e){tr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return tr.batch(()=>Promise.all(e.map(t=>t.continue().catch(ca))))}};function Mf(e){return e.options.scope?.id}var Sz=class extends Uh{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const a=t.queryKey,i=t.queryHash??J0(a,t);let l=this.get(i);return l||(l=new gz({client:e,queryKey:a,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(a)}),this.add(l)),l}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){tr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>r_(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>r_(e,n)):t}notify(e){tr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){tr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){tr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Cz=class{#e;#t;#n;#a;#r;#i;#o;#s;constructor(e={}){this.#e=e.queryCache||new Sz,this.#t=e.mutationCache||new wz,this.#n=e.defaultOptions||{},this.#a=new Map,this.#r=new Map,this.#i=0}mount(){this.#i++,this.#i===1&&(this.#o=ZO.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=dh.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#i--,this.#i===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),a=n.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ub(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const a=n.data;return[t,a]})}setQueryData(e,t,n){const a=this.defaultQueryOptions({queryKey:e}),l=this.#e.get(a.queryHash)?.state.data,u=ez(t,l);if(u!==void 0)return this.#e.build(this,a).setData(u,{...n,manual:!0})}setQueriesData(e,t,n){return tr.batch(()=>this.#e.findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;tr.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return tr.batch(()=>(n.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},a=tr.batch(()=>this.#e.findAll(e).map(i=>i.cancel(n)));return Promise.all(a).then(ca).catch(ca)}invalidateQueries(e,t={}){return tr.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},a=tr.batch(()=>this.#e.findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let l=i.fetch(void 0,n);return n.throwOnError||(l=l.catch(ca)),i.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(a).then(ca)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(Ub(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ca).catch(ca)}fetchInfiniteQuery(e){return e.behavior=c_(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ca).catch(ca)}ensureInfiniteQueryData(e){return e.behavior=c_(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return dh.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#a.set(Tu(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#a.values()],n={};return t.forEach(a=>{Ru(e,a.queryKey)&&Object.assign(n,a.defaultOptions)}),n}setMutationDefaults(e,t){this.#r.set(Tu(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(a=>{Ru(e,a.mutationKey)&&Object.assign(n,a.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=J0(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ew&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},jz=g.createContext(void 0),Nz=({client:e,children:t})=>(g.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),o.jsx(jz.Provider,{value:e,children:t}));function _z(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const Ez=e=>{switch(e){case"success":return Az;case"info":return Mz;case"warning":return Oz;case"error":return Dz;default:return null}},Tz=Array(12).fill(0),Rz=({visible:e,className:t})=>R.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},R.createElement("div",{className:"sonner-spinner"},Tz.map((n,a)=>R.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),Az=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Oz=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Mz=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Dz=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},R.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Pz=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},R.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),R.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),kz=()=>{const[e,t]=R.useState(document.hidden);return R.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let $b=1;class Lz{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:a,...i}=t,l=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:$b++,u=this.toasts.find(h=>h.id===l),d=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),u?this.toasts=this.toasts.map(h=>h.id===l?(this.publish({...h,...t,id:l,title:a}),{...h,...t,id:l,dismissible:d,title:a}):h):this.addToast({title:a,...i,dismissible:d,id:l}),l},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(a=>a({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let a;n.loading!==void 0&&(a=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const i=Promise.resolve(t instanceof Function?t():t);let l=a!==void 0,u;const d=i.then(async p=>{if(u=["resolve",p],R.isValidElement(p))l=!1,this.create({id:a,type:"default",message:p});else if(Iz(p)&&!p.ok){l=!1;const m=typeof n.error=="function"?await n.error(`HTTP error! status: ${p.status}`):n.error,b=typeof n.description=="function"?await n.description(`HTTP error! status: ${p.status}`):n.description,C=typeof m=="object"&&!R.isValidElement(m)?m:{message:m};this.create({id:a,type:"error",description:b,...C})}else if(p instanceof Error){l=!1;const m=typeof n.error=="function"?await n.error(p):n.error,b=typeof n.description=="function"?await n.description(p):n.description,C=typeof m=="object"&&!R.isValidElement(m)?m:{message:m};this.create({id:a,type:"error",description:b,...C})}else if(n.success!==void 0){l=!1;const m=typeof n.success=="function"?await n.success(p):n.success,b=typeof n.description=="function"?await n.description(p):n.description,C=typeof m=="object"&&!R.isValidElement(m)?m:{message:m};this.create({id:a,type:"success",description:b,...C})}}).catch(async p=>{if(u=["reject",p],n.error!==void 0){l=!1;const v=typeof n.error=="function"?await n.error(p):n.error,m=typeof n.description=="function"?await n.description(p):n.description,w=typeof v=="object"&&!R.isValidElement(v)?v:{message:v};this.create({id:a,type:"error",description:m,...w})}}).finally(()=>{l&&(this.dismiss(a),a=void 0),n.finally==null||n.finally.call(n)}),h=()=>new Promise((p,v)=>d.then(()=>u[0]==="reject"?v(u[1]):p(u[1])).catch(v));return typeof a!="string"&&typeof a!="number"?{unwrap:h}:Object.assign(a,{unwrap:h})},this.custom=(t,n)=>{const a=n?.id||$b++;return this.create({jsx:t(a),id:a,...n}),a},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const pr=new Lz,Bz=(e,t)=>{const n=t?.id||$b++;return pr.addToast({title:e,...t,id:n}),n},Iz=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",zz=Bz,Fz=()=>pr.toasts,Hz=()=>pr.getActiveToasts(),K=Object.assign(zz,{success:pr.success,info:pr.info,warning:pr.warning,error:pr.error,custom:pr.custom,message:pr.message,promise:pr.promise,dismiss:pr.dismiss,loading:pr.loading},{getHistory:Fz,getToasts:Hz});_z("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Df(e){return e.label!==void 0}const Uz=3,qz="24px",Vz="16px",d_=4e3,$z=356,Gz=14,Kz=45,Yz=200;function Oa(...e){return e.filter(Boolean).join(" ")}function Wz(e){const[t,n]=e.split("-"),a=[];return t&&a.push(t),n&&a.push(n),a}const Xz=e=>{var t,n,a,i,l,u,d,h,p;const{invert:v,toast:m,unstyled:b,interacting:w,setHeights:C,visibleToasts:S,heights:j,index:N,toasts:_,expanded:T,removeToast:A,defaultRichColors:D,closeButton:L,style:k,cancelButtonStyle:P,actionButtonStyle:U,className:J="",descriptionClassName:$="",duration:W,position:pe,gap:Se,expandByDefault:Ce,classNames:I,icons:q,closeButtonAriaLabel:H="Close toast"}=e,[be,Ne]=R.useState(null),[B,G]=R.useState(null),[X,oe]=R.useState(!1),[xe,Q]=R.useState(!1),[te,he]=R.useState(!1),[_e,je]=R.useState(!1),[Me,ce]=R.useState(!1),[He,Le]=R.useState(0),[Ue,wt]=R.useState(0),$e=R.useRef(m.duration||W||d_),Ot=R.useRef(null),St=R.useRef(null),Et=N===0,jt=N+1<=S,ot=m.type,at=m.dismissible!==!1,vt=m.className||"",Kt=m.descriptionClassName||"",Yt=R.useMemo(()=>j.findIndex(z=>z.toastId===m.id)||0,[j,m.id]),Wt=R.useMemo(()=>{var z;return(z=m.closeButton)!=null?z:L},[m.closeButton,L]),ne=R.useMemo(()=>m.duration||W||d_,[m.duration,W]),Re=R.useRef(0),st=R.useRef(0),et=R.useRef(0),xt=R.useRef(null),[mt,gt]=pe.split("-"),qt=R.useMemo(()=>j.reduce((z,O,de)=>de>=Yt?z:z+O.height,0),[j,Yt]),ue=kz(),Te=m.invert||v,De=ot==="loading";st.current=R.useMemo(()=>Yt*Se+qt,[Yt,qt]),R.useEffect(()=>{$e.current=ne},[ne]),R.useEffect(()=>{oe(!0)},[]),R.useEffect(()=>{const z=St.current;if(z){const O=z.getBoundingClientRect().height;return wt(O),C(de=>[{toastId:m.id,height:O,position:m.position},...de]),()=>C(de=>de.filter(me=>me.toastId!==m.id))}},[C,m.id]),R.useLayoutEffect(()=>{if(!X)return;const z=St.current,O=z.style.height;z.style.height="auto";const de=z.getBoundingClientRect().height;z.style.height=O,wt(de),C(me=>me.find(Ie=>Ie.toastId===m.id)?me.map(Ie=>Ie.toastId===m.id?{...Ie,height:de}:Ie):[{toastId:m.id,height:de,position:m.position},...me])},[X,m.title,m.description,C,m.id,m.jsx,m.action,m.cancel]);const Xe=R.useCallback(()=>{Q(!0),Le(st.current),C(z=>z.filter(O=>O.toastId!==m.id)),setTimeout(()=>{A(m)},Yz)},[m,A,C,st]);R.useEffect(()=>{if(m.promise&&ot==="loading"||m.duration===1/0||m.type==="loading")return;let z;return T||w||ue?(()=>{if(et.current<Re.current){const me=new Date().getTime()-Re.current;$e.current=$e.current-me}et.current=new Date().getTime()})():$e.current!==1/0&&(Re.current=new Date().getTime(),z=setTimeout(()=>{m.onAutoClose==null||m.onAutoClose.call(m,m),Xe()},$e.current)),()=>clearTimeout(z)},[T,w,m,ot,ue,Xe]),R.useEffect(()=>{m.delete&&(Xe(),m.onDismiss==null||m.onDismiss.call(m,m))},[Xe,m.delete]);function Oe(){var z;if(q?.loading){var O;return R.createElement("div",{className:Oa(I?.loader,m==null||(O=m.classNames)==null?void 0:O.loader,"sonner-loader"),"data-visible":ot==="loading"},q.loading)}return R.createElement(Rz,{className:Oa(I?.loader,m==null||(z=m.classNames)==null?void 0:z.loader),visible:ot==="loading"})}const Qe=m.icon||q?.[ot]||Ez(ot);var dt,ht;return R.createElement("li",{tabIndex:0,ref:St,className:Oa(J,vt,I?.toast,m==null||(t=m.classNames)==null?void 0:t.toast,I?.default,I?.[ot],m==null||(n=m.classNames)==null?void 0:n[ot]),"data-sonner-toast":"","data-rich-colors":(dt=m.richColors)!=null?dt:D,"data-styled":!(m.jsx||m.unstyled||b),"data-mounted":X,"data-promise":!!m.promise,"data-swiped":Me,"data-removed":xe,"data-visible":jt,"data-y-position":mt,"data-x-position":gt,"data-index":N,"data-front":Et,"data-swiping":te,"data-dismissible":at,"data-type":ot,"data-invert":Te,"data-swipe-out":_e,"data-swipe-direction":B,"data-expanded":!!(T||Ce&&X),"data-testid":m.testId,style:{"--index":N,"--toasts-before":N,"--z-index":_.length-N,"--offset":`${xe?He:st.current}px`,"--initial-height":Ce?"auto":`${Ue}px`,...k,...m.style},onDragEnd:()=>{he(!1),Ne(null),xt.current=null},onPointerDown:z=>{z.button!==2&&(De||!at||(Ot.current=new Date,Le(st.current),z.target.setPointerCapture(z.pointerId),z.target.tagName!=="BUTTON"&&(he(!0),xt.current={x:z.clientX,y:z.clientY})))},onPointerUp:()=>{var z,O,de;if(_e||!at)return;xt.current=null;const me=Number(((z=St.current)==null?void 0:z.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ge=Number(((O=St.current)==null?void 0:O.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ie=new Date().getTime()-((de=Ot.current)==null?void 0:de.getTime()),tt=be==="x"?me:Ge,It=Math.abs(tt)/Ie;if(Math.abs(tt)>=Kz||It>.11){Le(st.current),m.onDismiss==null||m.onDismiss.call(m,m),G(be==="x"?me>0?"right":"left":Ge>0?"down":"up"),Xe(),je(!0);return}else{var Y,we;(Y=St.current)==null||Y.style.setProperty("--swipe-amount-x","0px"),(we=St.current)==null||we.style.setProperty("--swipe-amount-y","0px")}ce(!1),he(!1),Ne(null)},onPointerMove:z=>{var O,de,me;if(!xt.current||!at||((O=window.getSelection())==null?void 0:O.toString().length)>0)return;const Ie=z.clientY-xt.current.y,tt=z.clientX-xt.current.x;var It;const Y=(It=e.swipeDirections)!=null?It:Wz(pe);!be&&(Math.abs(tt)>1||Math.abs(Ie)>1)&&Ne(Math.abs(tt)>Math.abs(Ie)?"x":"y");let we={x:0,y:0};const Pe=ke=>1/(1.5+Math.abs(ke)/20);if(be==="y"){if(Y.includes("top")||Y.includes("bottom"))if(Y.includes("top")&&Ie<0||Y.includes("bottom")&&Ie>0)we.y=Ie;else{const ke=Ie*Pe(Ie);we.y=Math.abs(ke)<Math.abs(Ie)?ke:Ie}}else if(be==="x"&&(Y.includes("left")||Y.includes("right")))if(Y.includes("left")&&tt<0||Y.includes("right")&&tt>0)we.x=tt;else{const ke=tt*Pe(tt);we.x=Math.abs(ke)<Math.abs(tt)?ke:tt}(Math.abs(we.x)>0||Math.abs(we.y)>0)&&ce(!0),(de=St.current)==null||de.style.setProperty("--swipe-amount-x",`${we.x}px`),(me=St.current)==null||me.style.setProperty("--swipe-amount-y",`${we.y}px`)}},Wt&&!m.jsx&&ot!=="loading"?R.createElement("button",{"aria-label":H,"data-disabled":De,"data-close-button":!0,onClick:De||!at?()=>{}:()=>{Xe(),m.onDismiss==null||m.onDismiss.call(m,m)},className:Oa(I?.closeButton,m==null||(a=m.classNames)==null?void 0:a.closeButton)},(ht=q?.close)!=null?ht:Pz):null,(ot||m.icon||m.promise)&&m.icon!==null&&(q?.[ot]!==null||m.icon)?R.createElement("div",{"data-icon":"",className:Oa(I?.icon,m==null||(i=m.classNames)==null?void 0:i.icon)},m.promise||m.type==="loading"&&!m.icon?m.icon||Oe():null,m.type!=="loading"?Qe:null):null,R.createElement("div",{"data-content":"",className:Oa(I?.content,m==null||(l=m.classNames)==null?void 0:l.content)},R.createElement("div",{"data-title":"",className:Oa(I?.title,m==null||(u=m.classNames)==null?void 0:u.title)},m.jsx?m.jsx:typeof m.title=="function"?m.title():m.title),m.description?R.createElement("div",{"data-description":"",className:Oa($,Kt,I?.description,m==null||(d=m.classNames)==null?void 0:d.description)},typeof m.description=="function"?m.description():m.description):null),R.isValidElement(m.cancel)?m.cancel:m.cancel&&Df(m.cancel)?R.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||P,onClick:z=>{Df(m.cancel)&&at&&(m.cancel.onClick==null||m.cancel.onClick.call(m.cancel,z),Xe())},className:Oa(I?.cancelButton,m==null||(h=m.classNames)==null?void 0:h.cancelButton)},m.cancel.label):null,R.isValidElement(m.action)?m.action:m.action&&Df(m.action)?R.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||U,onClick:z=>{Df(m.action)&&(m.action.onClick==null||m.action.onClick.call(m.action,z),!z.defaultPrevented&&Xe())},className:Oa(I?.actionButton,m==null||(p=m.classNames)==null?void 0:p.actionButton)},m.action.label):null)};function f_(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function Qz(e,t){const n={};return[e,t].forEach((a,i)=>{const l=i===1,u=l?"--mobile-offset":"--offset",d=l?Vz:qz;function h(p){["top","right","bottom","left"].forEach(v=>{n[`${u}-${v}`]=typeof p=="number"?`${p}px`:p})}typeof a=="number"||typeof a=="string"?h(a):typeof a=="object"?["top","right","bottom","left"].forEach(p=>{a[p]===void 0?n[`${u}-${p}`]=d:n[`${u}-${p}`]=typeof a[p]=="number"?`${a[p]}px`:a[p]}):h(d)}),n}const Zz=R.forwardRef(function(t,n){const{id:a,invert:i,position:l="bottom-right",hotkey:u=["altKey","KeyT"],expand:d,closeButton:h,className:p,offset:v,mobileOffset:m,theme:b="light",richColors:w,duration:C,style:S,visibleToasts:j=Uz,toastOptions:N,dir:_=f_(),gap:T=Gz,icons:A,containerAriaLabel:D="Notifications"}=t,[L,k]=R.useState([]),P=R.useMemo(()=>a?L.filter(X=>X.toasterId===a):L.filter(X=>!X.toasterId),[L,a]),U=R.useMemo(()=>Array.from(new Set([l].concat(P.filter(X=>X.position).map(X=>X.position)))),[P,l]),[J,$]=R.useState([]),[W,pe]=R.useState(!1),[Se,Ce]=R.useState(!1),[I,q]=R.useState(b!=="system"?b:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=R.useRef(null),be=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),Ne=R.useRef(null),B=R.useRef(!1),G=R.useCallback(X=>{k(oe=>{var xe;return(xe=oe.find(Q=>Q.id===X.id))!=null&&xe.delete||pr.dismiss(X.id),oe.filter(({id:Q})=>Q!==X.id)})},[]);return R.useEffect(()=>pr.subscribe(X=>{if(X.dismiss){requestAnimationFrame(()=>{k(oe=>oe.map(xe=>xe.id===X.id?{...xe,delete:!0}:xe))});return}setTimeout(()=>{WO.flushSync(()=>{k(oe=>{const xe=oe.findIndex(Q=>Q.id===X.id);return xe!==-1?[...oe.slice(0,xe),{...oe[xe],...X},...oe.slice(xe+1)]:[X,...oe]})})})}),[L]),R.useEffect(()=>{if(b!=="system"){q(b);return}if(b==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?q("dark"):q("light")),typeof window>"u")return;const X=window.matchMedia("(prefers-color-scheme: dark)");try{X.addEventListener("change",({matches:oe})=>{q(oe?"dark":"light")})}catch{X.addListener(({matches:xe})=>{try{q(xe?"dark":"light")}catch(Q){console.error(Q)}})}},[b]),R.useEffect(()=>{L.length<=1&&pe(!1)},[L]),R.useEffect(()=>{const X=oe=>{var xe;if(u.every(he=>oe[he]||oe.code===he)){var te;pe(!0),(te=H.current)==null||te.focus()}oe.code==="Escape"&&(document.activeElement===H.current||(xe=H.current)!=null&&xe.contains(document.activeElement))&&pe(!1)};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[u]),R.useEffect(()=>{if(H.current)return()=>{Ne.current&&(Ne.current.focus({preventScroll:!0}),Ne.current=null,B.current=!1)}},[H.current]),R.createElement("section",{ref:n,"aria-label":`${D} ${be}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},U.map((X,oe)=>{var xe;const[Q,te]=X.split("-");return P.length?R.createElement("ol",{key:X,dir:_==="auto"?f_():_,tabIndex:-1,ref:H,className:p,"data-sonner-toaster":!0,"data-sonner-theme":I,"data-y-position":Q,"data-x-position":te,style:{"--front-toast-height":`${((xe=J[0])==null?void 0:xe.height)||0}px`,"--width":`${$z}px`,"--gap":`${T}px`,...S,...Qz(v,m)},onBlur:he=>{B.current&&!he.currentTarget.contains(he.relatedTarget)&&(B.current=!1,Ne.current&&(Ne.current.focus({preventScroll:!0}),Ne.current=null))},onFocus:he=>{he.target instanceof HTMLElement&&he.target.dataset.dismissible==="false"||B.current||(B.current=!0,Ne.current=he.relatedTarget)},onMouseEnter:()=>pe(!0),onMouseMove:()=>pe(!0),onMouseLeave:()=>{Se||pe(!1)},onDragEnd:()=>pe(!1),onPointerDown:he=>{he.target instanceof HTMLElement&&he.target.dataset.dismissible==="false"||Ce(!0)},onPointerUp:()=>Ce(!1)},P.filter(he=>!he.position&&oe===0||he.position===X).map((he,_e)=>{var je,Me;return R.createElement(Xz,{key:he.id,icons:A,index:_e,toast:he,defaultRichColors:w,duration:(je=N?.duration)!=null?je:C,className:N?.className,descriptionClassName:N?.descriptionClassName,invert:i,visibleToasts:j,closeButton:(Me=N?.closeButton)!=null?Me:h,interacting:Se,position:X,style:N?.style,unstyled:N?.unstyled,classNames:N?.classNames,cancelButtonStyle:N?.cancelButtonStyle,actionButtonStyle:N?.actionButtonStyle,closeButtonAriaLabel:N?.closeButtonAriaLabel,removeToast:G,toasts:P.filter(ce=>ce.position==he.position),heights:J.filter(ce=>ce.position==he.position),setHeights:$,expandByDefault:d,gap:T,expanded:W,swipeDirections:t.swipeDirections})})):null}))});function h_(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function oo(...e){return t=>{let n=!1;const a=e.map(i=>{const l=h_(i,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let i=0;i<a.length;i++){const l=a[i];typeof l=="function"?l():h_(e[i],null)}}}}function At(...e){return g.useCallback(oo(...e),e)}var Jz=Symbol.for("react.lazy"),fh=K0[" use ".trim().toString()];function eF(e){return typeof e=="object"&&e!==null&&"then"in e}function nM(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Jz&&"_payload"in e&&eF(e._payload)}function Vh(e){const t=nF(e),n=g.forwardRef((a,i)=>{let{children:l,...u}=a;nM(l)&&typeof fh=="function"&&(l=fh(l._payload));const d=g.Children.toArray(l),h=d.find(aF);if(h){const p=h.props.children,v=d.map(m=>m===h?g.Children.count(p)>1?g.Children.only(null):g.isValidElement(p)?p.props.children:null:m);return o.jsx(t,{...u,ref:i,children:g.isValidElement(p)?g.cloneElement(p,void 0,v):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}var tF=Vh("Slot");function nF(e){const t=g.forwardRef((n,a)=>{let{children:i,...l}=n;if(nM(i)&&typeof fh=="function"&&(i=fh(i._payload)),g.isValidElement(i)){const u=iF(i),d=sF(l,i.props);return i.type!==g.Fragment&&(d.ref=a?oo(a,u):u),g.cloneElement(i,d)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var rF=Symbol("radix.slottable");function aF(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===rF}function sF(e,t){const n={...t};for(const a in t){const i=e[a],l=t[a];/^on[A-Z]/.test(a)?i&&l?n[a]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(n[a]=i):a==="style"?n[a]={...i,...l}:a==="className"&&(n[a]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function iF(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function rM(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=rM(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function aM(){for(var e,t,n=0,a="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=rM(e))&&(a&&(a+=" "),a+=t);return a}const p_=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,m_=aM,Xu=(e,t)=>n=>{var a;if(t?.variants==null)return m_(e,n?.class,n?.className);const{variants:i,defaultVariants:l}=t,u=Object.keys(i).map(p=>{const v=n?.[p],m=l?.[p];if(v===null)return null;const b=p_(v)||p_(m);return i[p][b]}),d=n&&Object.entries(n).reduce((p,v)=>{let[m,b]=v;return b===void 0||(p[m]=b),p},{}),h=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((p,v)=>{let{class:m,className:b,...w}=v;return Object.entries(w).every(C=>{let[S,j]=C;return Array.isArray(j)?j.includes({...l,...d}[S]):{...l,...d}[S]===j})?[...p,m,b]:p},[]);return m_(e,u,h,n?.class,n?.className)},oF=(e,t)=>{const n=new Array(e.length+t.length);for(let a=0;a<e.length;a++)n[a]=e[a];for(let a=0;a<t.length;a++)n[e.length+a]=t[a];return n},lF=(e,t)=>({classGroupId:e,validator:t}),sM=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),hh="-",g_=[],cF="arbitrary..",uF=e=>{const t=fF(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return dF(u);const d=u.split(hh),h=d[0]===""&&d.length>1?1:0;return iM(d,h,t)},getConflictingClassGroupIds:(u,d)=>{if(d){const h=a[u],p=n[u];return h?p?oF(p,h):h:p||g_}return n[u]||g_}}},iM=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],l=n.nextPart.get(i);if(l){const p=iM(e,t+1,l);if(p)return p}const u=n.validators;if(u===null)return;const d=t===0?e.join(hh):e.slice(t).join(hh),h=u.length;for(let p=0;p<h;p++){const v=u[p];if(v.validator(d))return v.classGroupId}},dF=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),a=t.slice(0,n);return a?cF+a:void 0})(),fF=e=>{const{theme:t,classGroups:n}=e;return hF(n,t)},hF=(e,t)=>{const n=sM();for(const a in e){const i=e[a];tw(i,n,a,t)}return n},tw=(e,t,n,a)=>{const i=e.length;for(let l=0;l<i;l++){const u=e[l];pF(u,t,n,a)}},pF=(e,t,n,a)=>{if(typeof e=="string"){mF(e,t,n);return}if(typeof e=="function"){gF(e,t,n,a);return}vF(e,t,n,a)},mF=(e,t,n)=>{const a=e===""?t:oM(t,e);a.classGroupId=n},gF=(e,t,n,a)=>{if(xF(e)){tw(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(lF(n,e))},vF=(e,t,n,a)=>{const i=Object.entries(e),l=i.length;for(let u=0;u<l;u++){const[d,h]=i[u];tw(h,oM(t,d),n,a)}},oM=(e,t)=>{let n=e;const a=t.split(hh),i=a.length;for(let l=0;l<i;l++){const u=a[l];let d=n.nextPart.get(u);d||(d=sM(),n.nextPart.set(u,d)),n=d}return n},xF=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,yF=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),a=Object.create(null);const i=(l,u)=>{n[l]=u,t++,t>e&&(t=0,a=n,n=Object.create(null))};return{get(l){let u=n[l];if(u!==void 0)return u;if((u=a[l])!==void 0)return i(l,u),u},set(l,u){l in n?n[l]=u:i(l,u)}}},Gb="!",v_=":",bF=[],x_=(e,t,n,a,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:i}),wF=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=i=>{const l=[];let u=0,d=0,h=0,p;const v=i.length;for(let S=0;S<v;S++){const j=i[S];if(u===0&&d===0){if(j===v_){l.push(i.slice(h,S)),h=S+1;continue}if(j==="/"){p=S;continue}}j==="["?u++:j==="]"?u--:j==="("?d++:j===")"&&d--}const m=l.length===0?i:i.slice(h);let b=m,w=!1;m.endsWith(Gb)?(b=m.slice(0,-1),w=!0):m.startsWith(Gb)&&(b=m.slice(1),w=!0);const C=p&&p>h?p-h:void 0;return x_(l,w,b,C)};if(t){const i=t+v_,l=a;a=u=>u.startsWith(i)?l(u.slice(i.length)):x_(bF,!1,u,void 0,!0)}if(n){const i=a;a=l=>n({className:l,parseClassName:i})}return a},SF=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,a)=>{t.set(n,1e6+a)}),n=>{const a=[];let i=[];for(let l=0;l<n.length;l++){const u=n[l],d=u[0]==="[",h=t.has(u);d||h?(i.length>0&&(i.sort(),a.push(...i),i=[]),a.push(u)):i.push(u)}return i.length>0&&(i.sort(),a.push(...i)),a}},CF=e=>({cache:yF(e.cacheSize),parseClassName:wF(e),sortModifiers:SF(e),...uF(e)}),jF=/\s+/,NF=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:i,sortModifiers:l}=t,u=[],d=e.trim().split(jF);let h="";for(let p=d.length-1;p>=0;p-=1){const v=d[p],{isExternal:m,modifiers:b,hasImportantModifier:w,baseClassName:C,maybePostfixModifierPosition:S}=n(v);if(m){h=v+(h.length>0?" "+h:h);continue}let j=!!S,N=a(j?C.substring(0,S):C);if(!N){if(!j){h=v+(h.length>0?" "+h:h);continue}if(N=a(C),!N){h=v+(h.length>0?" "+h:h);continue}j=!1}const _=b.length===0?"":b.length===1?b[0]:l(b).join(":"),T=w?_+Gb:_,A=T+N;if(u.indexOf(A)>-1)continue;u.push(A);const D=i(N,j);for(let L=0;L<D.length;++L){const k=D[L];u.push(T+k)}h=v+(h.length>0?" "+h:h)}return h},_F=(...e)=>{let t=0,n,a,i="";for(;t<e.length;)(n=e[t++])&&(a=lM(n))&&(i&&(i+=" "),i+=a);return i},lM=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=lM(e[a]))&&(n&&(n+=" "),n+=t);return n},EF=(e,...t)=>{let n,a,i,l;const u=h=>{const p=t.reduce((v,m)=>m(v),e());return n=CF(p),a=n.cache.get,i=n.cache.set,l=d,d(h)},d=h=>{const p=a(h);if(p)return p;const v=NF(h,n);return i(h,v),v};return l=u,(...h)=>l(_F(...h))},TF=[],Tn=e=>{const t=n=>n[e]||TF;return t.isThemeGetter=!0,t},cM=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,uM=/^\((?:(\w[\w-]*):)?(.+)\)$/i,RF=/^\d+\/\d+$/,AF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,OF=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,MF=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,DF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,PF=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$o=e=>RF.test(e),Rt=e=>!!e&&!Number.isNaN(Number(e)),li=e=>!!e&&Number.isInteger(Number(e)),ev=e=>e.endsWith("%")&&Rt(e.slice(0,-1)),ps=e=>AF.test(e),kF=()=>!0,LF=e=>OF.test(e)&&!MF.test(e),dM=()=>!1,BF=e=>DF.test(e),IF=e=>PF.test(e),zF=e=>!qe(e)&&!Ve(e),FF=e=>Ll(e,pM,dM),qe=e=>cM.test(e),Gi=e=>Ll(e,mM,LF),tv=e=>Ll(e,$F,Rt),y_=e=>Ll(e,fM,dM),HF=e=>Ll(e,hM,IF),Pf=e=>Ll(e,gM,BF),Ve=e=>uM.test(e),eu=e=>Bl(e,mM),UF=e=>Bl(e,GF),b_=e=>Bl(e,fM),qF=e=>Bl(e,pM),VF=e=>Bl(e,hM),kf=e=>Bl(e,gM,!0),Ll=(e,t,n)=>{const a=cM.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},Bl=(e,t,n=!1)=>{const a=uM.exec(e);return a?a[1]?t(a[1]):n:!1},fM=e=>e==="position"||e==="percentage",hM=e=>e==="image"||e==="url",pM=e=>e==="length"||e==="size"||e==="bg-size",mM=e=>e==="length",$F=e=>e==="number",GF=e=>e==="family-name",gM=e=>e==="shadow",KF=()=>{const e=Tn("color"),t=Tn("font"),n=Tn("text"),a=Tn("font-weight"),i=Tn("tracking"),l=Tn("leading"),u=Tn("breakpoint"),d=Tn("container"),h=Tn("spacing"),p=Tn("radius"),v=Tn("shadow"),m=Tn("inset-shadow"),b=Tn("text-shadow"),w=Tn("drop-shadow"),C=Tn("blur"),S=Tn("perspective"),j=Tn("aspect"),N=Tn("ease"),_=Tn("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...A(),Ve,qe],L=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],P=()=>[Ve,qe,h],U=()=>[$o,"full","auto",...P()],J=()=>[li,"none","subgrid",Ve,qe],$=()=>["auto",{span:["full",li,Ve,qe]},li,Ve,qe],W=()=>[li,"auto",Ve,qe],pe=()=>["auto","min","max","fr",Ve,qe],Se=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Ce=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...P()],q=()=>[$o,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],H=()=>[e,Ve,qe],be=()=>[...A(),b_,y_,{position:[Ve,qe]}],Ne=()=>["no-repeat",{repeat:["","x","y","space","round"]}],B=()=>["auto","cover","contain",qF,FF,{size:[Ve,qe]}],G=()=>[ev,eu,Gi],X=()=>["","none","full",p,Ve,qe],oe=()=>["",Rt,eu,Gi],xe=()=>["solid","dashed","dotted","double"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>[Rt,ev,b_,y_],he=()=>["","none",C,Ve,qe],_e=()=>["none",Rt,Ve,qe],je=()=>["none",Rt,Ve,qe],Me=()=>[Rt,Ve,qe],ce=()=>[$o,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ps],breakpoint:[ps],color:[kF],container:[ps],"drop-shadow":[ps],ease:["in","out","in-out"],font:[zF],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ps],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ps],shadow:[ps],spacing:["px",Rt],text:[ps],"text-shadow":[ps],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",$o,qe,Ve,j]}],container:["container"],columns:[{columns:[Rt,qe,Ve,d]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:D()}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:U()}],"inset-x":[{"inset-x":U()}],"inset-y":[{"inset-y":U()}],start:[{start:U()}],end:[{end:U()}],top:[{top:U()}],right:[{right:U()}],bottom:[{bottom:U()}],left:[{left:U()}],visibility:["visible","invisible","collapse"],z:[{z:[li,"auto",Ve,qe]}],basis:[{basis:[$o,"full","auto",d,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Rt,$o,"auto","initial","none",qe]}],grow:[{grow:["",Rt,Ve,qe]}],shrink:[{shrink:["",Rt,Ve,qe]}],order:[{order:[li,"first","last","none",Ve,qe]}],"grid-cols":[{"grid-cols":J()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":W()}],"col-end":[{"col-end":W()}],"grid-rows":[{"grid-rows":J()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":W()}],"row-end":[{"row-end":W()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":pe()}],"auto-rows":[{"auto-rows":pe()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...Se(),"normal"]}],"justify-items":[{"justify-items":[...Ce(),"normal"]}],"justify-self":[{"justify-self":["auto",...Ce()]}],"align-content":[{content:["normal",...Se()]}],"align-items":[{items:[...Ce(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Ce(),{baseline:["","last"]}]}],"place-content":[{"place-content":Se()}],"place-items":[{"place-items":[...Ce(),"baseline"]}],"place-self":[{"place-self":["auto",...Ce()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],w:[{w:[d,"screen",...q()]}],"min-w":[{"min-w":[d,"screen","none",...q()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh",...q()]}],"font-size":[{text:["base",n,eu,Gi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,Ve,tv]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ev,qe]}],"font-family":[{font:[UF,qe,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,Ve,qe]}],"line-clamp":[{"line-clamp":[Rt,"none",Ve,tv]}],leading:[{leading:[l,...P()]}],"list-image":[{"list-image":["none",Ve,qe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ve,qe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:H()}],"text-color":[{text:H()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...xe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Rt,"from-font","auto",Ve,Gi]}],"text-decoration-color":[{decoration:H()}],"underline-offset":[{"underline-offset":[Rt,"auto",Ve,qe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ve,qe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ve,qe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:be()}],"bg-repeat":[{bg:Ne()}],"bg-size":[{bg:B()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},li,Ve,qe],radial:["",Ve,qe],conic:[li,Ve,qe]},VF,HF]}],"bg-color":[{bg:H()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:H()}],"gradient-via":[{via:H()}],"gradient-to":[{to:H()}],rounded:[{rounded:X()}],"rounded-s":[{"rounded-s":X()}],"rounded-e":[{"rounded-e":X()}],"rounded-t":[{"rounded-t":X()}],"rounded-r":[{"rounded-r":X()}],"rounded-b":[{"rounded-b":X()}],"rounded-l":[{"rounded-l":X()}],"rounded-ss":[{"rounded-ss":X()}],"rounded-se":[{"rounded-se":X()}],"rounded-ee":[{"rounded-ee":X()}],"rounded-es":[{"rounded-es":X()}],"rounded-tl":[{"rounded-tl":X()}],"rounded-tr":[{"rounded-tr":X()}],"rounded-br":[{"rounded-br":X()}],"rounded-bl":[{"rounded-bl":X()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...xe(),"hidden","none"]}],"divide-style":[{divide:[...xe(),"hidden","none"]}],"border-color":[{border:H()}],"border-color-x":[{"border-x":H()}],"border-color-y":[{"border-y":H()}],"border-color-s":[{"border-s":H()}],"border-color-e":[{"border-e":H()}],"border-color-t":[{"border-t":H()}],"border-color-r":[{"border-r":H()}],"border-color-b":[{"border-b":H()}],"border-color-l":[{"border-l":H()}],"divide-color":[{divide:H()}],"outline-style":[{outline:[...xe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Rt,Ve,qe]}],"outline-w":[{outline:["",Rt,eu,Gi]}],"outline-color":[{outline:H()}],shadow:[{shadow:["","none",v,kf,Pf]}],"shadow-color":[{shadow:H()}],"inset-shadow":[{"inset-shadow":["none",m,kf,Pf]}],"inset-shadow-color":[{"inset-shadow":H()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:H()}],"ring-offset-w":[{"ring-offset":[Rt,Gi]}],"ring-offset-color":[{"ring-offset":H()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":H()}],"text-shadow":[{"text-shadow":["none",b,kf,Pf]}],"text-shadow-color":[{"text-shadow":H()}],opacity:[{opacity:[Rt,Ve,qe]}],"mix-blend":[{"mix-blend":[...Q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Rt]}],"mask-image-linear-from-pos":[{"mask-linear-from":te()}],"mask-image-linear-to-pos":[{"mask-linear-to":te()}],"mask-image-linear-from-color":[{"mask-linear-from":H()}],"mask-image-linear-to-color":[{"mask-linear-to":H()}],"mask-image-t-from-pos":[{"mask-t-from":te()}],"mask-image-t-to-pos":[{"mask-t-to":te()}],"mask-image-t-from-color":[{"mask-t-from":H()}],"mask-image-t-to-color":[{"mask-t-to":H()}],"mask-image-r-from-pos":[{"mask-r-from":te()}],"mask-image-r-to-pos":[{"mask-r-to":te()}],"mask-image-r-from-color":[{"mask-r-from":H()}],"mask-image-r-to-color":[{"mask-r-to":H()}],"mask-image-b-from-pos":[{"mask-b-from":te()}],"mask-image-b-to-pos":[{"mask-b-to":te()}],"mask-image-b-from-color":[{"mask-b-from":H()}],"mask-image-b-to-color":[{"mask-b-to":H()}],"mask-image-l-from-pos":[{"mask-l-from":te()}],"mask-image-l-to-pos":[{"mask-l-to":te()}],"mask-image-l-from-color":[{"mask-l-from":H()}],"mask-image-l-to-color":[{"mask-l-to":H()}],"mask-image-x-from-pos":[{"mask-x-from":te()}],"mask-image-x-to-pos":[{"mask-x-to":te()}],"mask-image-x-from-color":[{"mask-x-from":H()}],"mask-image-x-to-color":[{"mask-x-to":H()}],"mask-image-y-from-pos":[{"mask-y-from":te()}],"mask-image-y-to-pos":[{"mask-y-to":te()}],"mask-image-y-from-color":[{"mask-y-from":H()}],"mask-image-y-to-color":[{"mask-y-to":H()}],"mask-image-radial":[{"mask-radial":[Ve,qe]}],"mask-image-radial-from-pos":[{"mask-radial-from":te()}],"mask-image-radial-to-pos":[{"mask-radial-to":te()}],"mask-image-radial-from-color":[{"mask-radial-from":H()}],"mask-image-radial-to-color":[{"mask-radial-to":H()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[Rt]}],"mask-image-conic-from-pos":[{"mask-conic-from":te()}],"mask-image-conic-to-pos":[{"mask-conic-to":te()}],"mask-image-conic-from-color":[{"mask-conic-from":H()}],"mask-image-conic-to-color":[{"mask-conic-to":H()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:be()}],"mask-repeat":[{mask:Ne()}],"mask-size":[{mask:B()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ve,qe]}],filter:[{filter:["","none",Ve,qe]}],blur:[{blur:he()}],brightness:[{brightness:[Rt,Ve,qe]}],contrast:[{contrast:[Rt,Ve,qe]}],"drop-shadow":[{"drop-shadow":["","none",w,kf,Pf]}],"drop-shadow-color":[{"drop-shadow":H()}],grayscale:[{grayscale:["",Rt,Ve,qe]}],"hue-rotate":[{"hue-rotate":[Rt,Ve,qe]}],invert:[{invert:["",Rt,Ve,qe]}],saturate:[{saturate:[Rt,Ve,qe]}],sepia:[{sepia:["",Rt,Ve,qe]}],"backdrop-filter":[{"backdrop-filter":["","none",Ve,qe]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[Rt,Ve,qe]}],"backdrop-contrast":[{"backdrop-contrast":[Rt,Ve,qe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Rt,Ve,qe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Rt,Ve,qe]}],"backdrop-invert":[{"backdrop-invert":["",Rt,Ve,qe]}],"backdrop-opacity":[{"backdrop-opacity":[Rt,Ve,qe]}],"backdrop-saturate":[{"backdrop-saturate":[Rt,Ve,qe]}],"backdrop-sepia":[{"backdrop-sepia":["",Rt,Ve,qe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ve,qe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Rt,"initial",Ve,qe]}],ease:[{ease:["linear","initial",N,Ve,qe]}],delay:[{delay:[Rt,Ve,qe]}],animate:[{animate:["none",_,Ve,qe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,Ve,qe]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:_e()}],"rotate-x":[{"rotate-x":_e()}],"rotate-y":[{"rotate-y":_e()}],"rotate-z":[{"rotate-z":_e()}],scale:[{scale:je()}],"scale-x":[{"scale-x":je()}],"scale-y":[{"scale-y":je()}],"scale-z":[{"scale-z":je()}],"scale-3d":["scale-3d"],skew:[{skew:Me()}],"skew-x":[{"skew-x":Me()}],"skew-y":[{"skew-y":Me()}],transform:[{transform:[Ve,qe,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ce()}],"translate-x":[{"translate-x":ce()}],"translate-y":[{"translate-y":ce()}],"translate-z":[{"translate-z":ce()}],"translate-none":["translate-none"],accent:[{accent:H()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:H()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ve,qe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ve,qe]}],fill:[{fill:["none",...H()]}],"stroke-w":[{stroke:[Rt,eu,Gi,tv]}],stroke:[{stroke:["none",...H()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},YF=EF(KF);function lt(...e){return YF(aM(e))}function w_(e){return e.toLowerCase().replace(/[\s_-]+/g," ")}function Au(e,t){return w_(e).includes(w_(t))}const WF=Xu("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-card text-foreground border border-border shadow-sm hover:bg-accent",primary:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-accent hover:text-accent-foreground hover:scale-105 hover:shadow-md transition-all duration-150",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 px-3",lg:"h-11 px-8",icon:"h-10 w-10","icon-sm":"h-8 w-8"}},defaultVariants:{variant:"default",size:"default"}}),se=g.forwardRef(({className:e,variant:t,size:n,asChild:a=!1,...i},l)=>{const u=a?tF:"button";return o.jsx(u,{className:lt(WF({variant:t,size:n,className:e})),ref:l,...i})});se.displayName="Button";function XF(e,t=[]){let n=[];function a(l,u){const d=g.createContext(u);d.displayName=l+"Context";const h=n.length;n=[...n,u];const p=m=>{const{scope:b,children:w,...C}=m,S=b?.[e]?.[h]||d,j=g.useMemo(()=>C,Object.values(C));return o.jsx(S.Provider,{value:j,children:w})};p.displayName=l+"Provider";function v(m,b){const w=b?.[e]?.[h]||d,C=g.useContext(w);if(C)return C;if(u!==void 0)return u;throw new Error(`\`${m}\` must be used within \`${l}\``)}return[p,v]}const i=()=>{const l=n.map(u=>g.createContext(u));return function(d){const h=d?.[e]||l;return g.useMemo(()=>({[`__scope${e}`]:{...d,[e]:h}}),[d,h])}};return i.scopeName=e,[a,QF(i,...t)]}function QF(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(l){const u=a.reduce((d,{useScope:h,scopeName:p})=>{const m=h(l)[`__scope${p}`];return{...d,...m}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var ZF=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],vM=ZF.reduce((e,t)=>{const n=Vh(`Primitive.${t}`),a=g.forwardRef((i,l)=>{const{asChild:u,...d}=i,h=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(h,{...d,ref:l})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),nw="Progress",rw=100,[JF]=XF(nw),[e8,t8]=JF(nw),xM=g.forwardRef((e,t)=>{const{__scopeProgress:n,value:a=null,max:i,getValueLabel:l=n8,...u}=e;(i||i===0)&&!S_(i)&&console.error(r8(`${i}`,"Progress"));const d=S_(i)?i:rw;a!==null&&!C_(a,d)&&console.error(a8(`${a}`,"Progress"));const h=C_(a,d)?a:null,p=ph(h)?l(h,d):void 0;return o.jsx(e8,{scope:n,value:h,max:d,children:o.jsx(vM.div,{"aria-valuemax":d,"aria-valuemin":0,"aria-valuenow":ph(h)?h:void 0,"aria-valuetext":p,role:"progressbar","data-state":wM(h,d),"data-value":h??void 0,"data-max":d,...u,ref:t})})});xM.displayName=nw;var yM="ProgressIndicator",bM=g.forwardRef((e,t)=>{const{__scopeProgress:n,...a}=e,i=t8(yM,n);return o.jsx(vM.div,{"data-state":wM(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...a,ref:t})});bM.displayName=yM;function n8(e,t){return`${Math.round(e/t*100)}%`}function wM(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function ph(e){return typeof e=="number"}function S_(e){return ph(e)&&!isNaN(e)&&e>0}function C_(e,t){return ph(e)&&!isNaN(e)&&e<=t&&e>=0}function r8(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${rw}\`.`}function a8(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
  11. - a positive number
  12. - less than the value passed to \`max\` (or ${rw} if no \`max\` prop is set)
  13. - \`null\` or \`undefined\` if the progress is indeterminate.
  14. Defaulting to \`null\`.`}var SM=xM,s8=bM;const Yi=g.forwardRef(({className:e,value:t,...n},a)=>o.jsx(SM,{ref:a,className:lt("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...n,children:o.jsx(s8,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Yi.displayName=SM.displayName;const bt=g.forwardRef(({className:e,type:t,...n},a)=>o.jsx("input",{type:t,className:lt("flex h-10 w-full rounded-full border border-input bg-background px-4 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:a,...n}));bt.displayName="Input";function Je(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}function i8(e,t){const n=g.createContext(t),a=l=>{const{children:u,...d}=l,h=g.useMemo(()=>d,Object.values(d));return o.jsx(n.Provider,{value:h,children:u})};a.displayName=e+"Provider";function i(l){const u=g.useContext(n);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[a,i]}function Lr(e,t=[]){let n=[];function a(l,u){const d=g.createContext(u),h=n.length;n=[...n,u];const p=m=>{const{scope:b,children:w,...C}=m,S=b?.[e]?.[h]||d,j=g.useMemo(()=>C,Object.values(C));return o.jsx(S.Provider,{value:j,children:w})};p.displayName=l+"Provider";function v(m,b){const w=b?.[e]?.[h]||d,C=g.useContext(w);if(C)return C;if(u!==void 0)return u;throw new Error(`\`${m}\` must be used within \`${l}\``)}return[p,v]}const i=()=>{const l=n.map(u=>g.createContext(u));return function(d){const h=d?.[e]||l;return g.useMemo(()=>({[`__scope${e}`]:{...d,[e]:h}}),[d,h])}};return i.scopeName=e,[a,o8(i,...t)]}function o8(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(l){const u=a.reduce((d,{useScope:h,scopeName:p})=>{const m=h(l)[`__scope${p}`];return{...d,...m}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var Vn=globalThis?.document?g.useLayoutEffect:()=>{},l8=K0[" useId ".trim().toString()]||(()=>{}),c8=0;function ma(e){const[t,n]=g.useState(l8());return Vn(()=>{n(a=>a??String(c8++))},[e]),t?`radix-${t}`:""}var u8=K0[" useInsertionEffect ".trim().toString()]||Vn;function Zr({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[i,l,u]=d8({defaultProp:t,onChange:n}),d=e!==void 0,h=d?e:i;{const v=g.useRef(e!==void 0);g.useEffect(()=>{const m=v.current;m!==d&&console.warn(`${a} is changing from ${m?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),v.current=d},[d,a])}const p=g.useCallback(v=>{if(d){const m=f8(v)?v(e):v;m!==e&&u.current?.(m)}else l(v)},[d,e,l,u]);return[h,p]}function d8({defaultProp:e,onChange:t}){const[n,a]=g.useState(e),i=g.useRef(n),l=g.useRef(t);return u8(()=>{l.current=t},[t]),g.useEffect(()=>{i.current!==n&&(l.current?.(n),i.current=n)},[n,i]),[n,a,l]}function f8(e){return typeof e=="function"}function h8(e){const t=p8(e),n=g.forwardRef((a,i)=>{const{children:l,...u}=a,d=g.Children.toArray(l),h=d.find(g8);if(h){const p=h.props.children,v=d.map(m=>m===h?g.Children.count(p)>1?g.Children.only(null):g.isValidElement(p)?p.props.children:null:m);return o.jsx(t,{...u,ref:i,children:g.isValidElement(p)?g.cloneElement(p,void 0,v):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function p8(e){const t=g.forwardRef((n,a)=>{const{children:i,...l}=n;if(g.isValidElement(i)){const u=x8(i),d=v8(l,i.props);return i.type!==g.Fragment&&(d.ref=a?oo(a,u):u),g.cloneElement(i,d)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var m8=Symbol("radix.slottable");function g8(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===m8}function v8(e,t){const n={...t};for(const a in t){const i=e[a],l=t[a];/^on[A-Z]/.test(a)?i&&l?n[a]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(n[a]=i):a==="style"?n[a]={...i,...l}:a==="className"&&(n[a]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function x8(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var y8=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ut=y8.reduce((e,t)=>{const n=h8(`Primitive.${t}`),a=g.forwardRef((i,l)=>{const{asChild:u,...d}=i,h=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(h,{...d,ref:l})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function b8(e,t){e&&ka.flushSync(()=>e.dispatchEvent(t))}function gi(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>t.current?.(...n),[])}function w8(e,t=globalThis?.document){const n=gi(e);g.useEffect(()=>{const a=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[n,t])}var S8="DismissableLayer",Kb="dismissableLayer.update",C8="dismissableLayer.pointerDownOutside",j8="dismissableLayer.focusOutside",j_,CM=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Qu=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:l,onInteractOutside:u,onDismiss:d,...h}=e,p=g.useContext(CM),[v,m]=g.useState(null),b=v?.ownerDocument??globalThis?.document,[,w]=g.useState({}),C=At(t,k=>m(k)),S=Array.from(p.layers),[j]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),N=S.indexOf(j),_=v?S.indexOf(v):-1,T=p.layersWithOutsidePointerEventsDisabled.size>0,A=_>=N,D=E8(k=>{const P=k.target,U=[...p.branches].some(J=>J.contains(P));!A||U||(i?.(k),u?.(k),k.defaultPrevented||d?.())},b),L=T8(k=>{const P=k.target;[...p.branches].some(J=>J.contains(P))||(l?.(k),u?.(k),k.defaultPrevented||d?.())},b);return w8(k=>{_===p.layers.size-1&&(a?.(k),!k.defaultPrevented&&d&&(k.preventDefault(),d()))},b),g.useEffect(()=>{if(v)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(j_=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(v)),p.layers.add(v),N_(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(b.body.style.pointerEvents=j_)}},[v,b,n,p]),g.useEffect(()=>()=>{v&&(p.layers.delete(v),p.layersWithOutsidePointerEventsDisabled.delete(v),N_())},[v,p]),g.useEffect(()=>{const k=()=>w({});return document.addEventListener(Kb,k),()=>document.removeEventListener(Kb,k)},[]),o.jsx(ut.div,{...h,ref:C,style:{pointerEvents:T?A?"auto":"none":void 0,...e.style},onFocusCapture:Je(e.onFocusCapture,L.onFocusCapture),onBlurCapture:Je(e.onBlurCapture,L.onBlurCapture),onPointerDownCapture:Je(e.onPointerDownCapture,D.onPointerDownCapture)})});Qu.displayName=S8;var N8="DismissableLayerBranch",_8=g.forwardRef((e,t)=>{const n=g.useContext(CM),a=g.useRef(null),i=At(t,a);return g.useEffect(()=>{const l=a.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),o.jsx(ut.div,{...e,ref:i})});_8.displayName=N8;function E8(e,t=globalThis?.document){const n=gi(e),a=g.useRef(!1),i=g.useRef(()=>{});return g.useEffect(()=>{const l=d=>{if(d.target&&!a.current){let h=function(){jM(C8,n,p,{discrete:!0})};const p={originalEvent:d};d.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=h,t.addEventListener("click",i.current,{once:!0})):h()}else t.removeEventListener("click",i.current);a.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",l),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>a.current=!0}}function T8(e,t=globalThis?.document){const n=gi(e),a=g.useRef(!1);return g.useEffect(()=>{const i=l=>{l.target&&!a.current&&jM(j8,n,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function N_(){const e=new CustomEvent(Kb);document.dispatchEvent(e)}function jM(e,t,n,{discrete:a}){const i=n.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),a?b8(i,l):i.dispatchEvent(l)}var nv="focusScope.autoFocusOnMount",rv="focusScope.autoFocusOnUnmount",__={bubbles:!1,cancelable:!0},R8="FocusScope",$h=g.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:i,onUnmountAutoFocus:l,...u}=e,[d,h]=g.useState(null),p=gi(i),v=gi(l),m=g.useRef(null),b=At(t,S=>h(S)),w=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(a){let S=function(T){if(w.paused||!d)return;const A=T.target;d.contains(A)?m.current=A:ci(m.current,{select:!0})},j=function(T){if(w.paused||!d)return;const A=T.relatedTarget;A!==null&&(d.contains(A)||ci(m.current,{select:!0}))},N=function(T){if(document.activeElement===document.body)for(const D of T)D.removedNodes.length>0&&ci(d)};document.addEventListener("focusin",S),document.addEventListener("focusout",j);const _=new MutationObserver(N);return d&&_.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",j),_.disconnect()}}},[a,d,w.paused]),g.useEffect(()=>{if(d){T_.add(w);const S=document.activeElement;if(!d.contains(S)){const N=new CustomEvent(nv,__);d.addEventListener(nv,p),d.dispatchEvent(N),N.defaultPrevented||(A8(k8(NM(d)),{select:!0}),document.activeElement===S&&ci(d))}return()=>{d.removeEventListener(nv,p),setTimeout(()=>{const N=new CustomEvent(rv,__);d.addEventListener(rv,v),d.dispatchEvent(N),N.defaultPrevented||ci(S??document.body,{select:!0}),d.removeEventListener(rv,v),T_.remove(w)},0)}}},[d,p,v,w]);const C=g.useCallback(S=>{if(!n&&!a||w.paused)return;const j=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,N=document.activeElement;if(j&&N){const _=S.currentTarget,[T,A]=O8(_);T&&A?!S.shiftKey&&N===A?(S.preventDefault(),n&&ci(T,{select:!0})):S.shiftKey&&N===T&&(S.preventDefault(),n&&ci(A,{select:!0})):N===_&&S.preventDefault()}},[n,a,w.paused]);return o.jsx(ut.div,{tabIndex:-1,...u,ref:b,onKeyDown:C})});$h.displayName=R8;function A8(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(ci(a,{select:t}),document.activeElement!==n)return}function O8(e){const t=NM(e),n=E_(t,e),a=E_(t.reverse(),e);return[n,a]}function NM(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const i=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||i?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function E_(e,t){for(const n of e)if(!M8(n,{upTo:t}))return n}function M8(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function D8(e){return e instanceof HTMLInputElement&&"select"in e}function ci(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&D8(e)&&t&&e.select()}}var T_=P8();function P8(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=R_(e,t),e.unshift(t)},remove(t){e=R_(e,t),e[0]?.resume()}}}function R_(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function k8(e){return e.filter(t=>t.tagName!=="A")}var L8="Portal",Gh=g.forwardRef((e,t)=>{const{container:n,...a}=e,[i,l]=g.useState(!1);Vn(()=>l(!0),[]);const u=n||i&&globalThis?.document?.body;return u?WO.createPortal(o.jsx(ut.div,{...a,ref:t}),u):null});Gh.displayName=L8;function B8(e,t){return g.useReducer((n,a)=>t[n][a]??n,e)}var Ts=e=>{const{present:t,children:n}=e,a=I8(t),i=typeof n=="function"?n({present:a.isPresent}):g.Children.only(n),l=At(a.ref,z8(i));return typeof n=="function"||a.isPresent?g.cloneElement(i,{ref:l}):null};Ts.displayName="Presence";function I8(e){const[t,n]=g.useState(),a=g.useRef(null),i=g.useRef(e),l=g.useRef("none"),u=e?"mounted":"unmounted",[d,h]=B8(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const p=Lf(a.current);l.current=d==="mounted"?p:"none"},[d]),Vn(()=>{const p=a.current,v=i.current;if(v!==e){const b=l.current,w=Lf(p);e?h("MOUNT"):w==="none"||p?.display==="none"?h("UNMOUNT"):h(v&&b!==w?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,h]),Vn(()=>{if(t){let p;const v=t.ownerDocument.defaultView??window,m=w=>{const S=Lf(a.current).includes(CSS.escape(w.animationName));if(w.target===t&&S&&(h("ANIMATION_END"),!i.current)){const j=t.style.animationFillMode;t.style.animationFillMode="forwards",p=v.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=j)})}},b=w=>{w.target===t&&(l.current=Lf(a.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{v.clearTimeout(p),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:g.useCallback(p=>{a.current=p?getComputedStyle(p):null,n(p)},[])}}function Lf(e){return e?.animationName||"none"}function z8(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var av=0;function aw(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??A_()),document.body.insertAdjacentElement("beforeend",e[1]??A_()),av++,()=>{av===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),av--}},[])}function A_(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Pa=function(){return Pa=Object.assign||function(t){for(var n,a=1,i=arguments.length;a<i;a++){n=arguments[a];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},Pa.apply(this,arguments)};function _M(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,a=Object.getOwnPropertySymbols(e);i<a.length;i++)t.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(n[a[i]]=e[a[i]]);return n}function F8(e,t,n){if(n||arguments.length===2)for(var a=0,i=t.length,l;a<i;a++)(l||!(a in t))&&(l||(l=Array.prototype.slice.call(t,0,a)),l[a]=t[a]);return e.concat(l||Array.prototype.slice.call(t))}var Jf="right-scroll-bar-position",eh="width-before-scroll-bar",H8="with-scroll-bars-hidden",U8="--removed-body-scroll-bar-size";function sv(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function q8(e,t){var n=g.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(a){var i=n.value;i!==a&&(n.value=a,n.callback(a,i))}}}})[0];return n.callback=t,n.facade}var V8=typeof window<"u"?g.useLayoutEffect:g.useEffect,O_=new WeakMap;function $8(e,t){var n=q8(null,function(a){return e.forEach(function(i){return sv(i,a)})});return V8(function(){var a=O_.get(n);if(a){var i=new Set(a),l=new Set(e),u=n.current;i.forEach(function(d){l.has(d)||sv(d,null)}),l.forEach(function(d){i.has(d)||sv(d,u)})}O_.set(n,e)},[e]),n}function G8(e){return e}function K8(e,t){t===void 0&&(t=G8);var n=[],a=!1,i={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(l){var u=t(l,a);return n.push(u),function(){n=n.filter(function(d){return d!==u})}},assignSyncMedium:function(l){for(a=!0;n.length;){var u=n;n=[],u.forEach(l)}n={push:function(d){return l(d)},filter:function(){return n}}},assignMedium:function(l){a=!0;var u=[];if(n.length){var d=n;n=[],d.forEach(l),u=n}var h=function(){var v=u;u=[],v.forEach(l)},p=function(){return Promise.resolve().then(h)};p(),n={push:function(v){u.push(v),p()},filter:function(v){return u=u.filter(v),n}}}};return i}function Y8(e){e===void 0&&(e={});var t=K8(null);return t.options=Pa({async:!0,ssr:!1},e),t}var EM=function(e){var t=e.sideCar,n=_M(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return g.createElement(a,Pa({},n))};EM.isSideCarExport=!0;function W8(e,t){return e.useMedium(t),EM}var TM=Y8(),iv=function(){},Kh=g.forwardRef(function(e,t){var n=g.useRef(null),a=g.useState({onScrollCapture:iv,onWheelCapture:iv,onTouchMoveCapture:iv}),i=a[0],l=a[1],u=e.forwardProps,d=e.children,h=e.className,p=e.removeScrollBar,v=e.enabled,m=e.shards,b=e.sideCar,w=e.noRelative,C=e.noIsolation,S=e.inert,j=e.allowPinchZoom,N=e.as,_=N===void 0?"div":N,T=e.gapMode,A=_M(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),D=b,L=$8([n,t]),k=Pa(Pa({},A),i);return g.createElement(g.Fragment,null,v&&g.createElement(D,{sideCar:TM,removeScrollBar:p,shards:m,noRelative:w,noIsolation:C,inert:S,setCallbacks:l,allowPinchZoom:!!j,lockRef:n,gapMode:T}),u?g.cloneElement(g.Children.only(d),Pa(Pa({},k),{ref:L})):g.createElement(_,Pa({},k,{className:h,ref:L}),d))});Kh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Kh.classNames={fullWidth:eh,zeroRight:Jf};var X8=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Q8(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=X8();return t&&e.setAttribute("nonce",t),e}function Z8(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function J8(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var eH=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Q8())&&(Z8(t,n),J8(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},tH=function(){var e=eH();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},RM=function(){var e=tH(),t=function(n){var a=n.styles,i=n.dynamic;return e(a,i),null};return t},nH={left:0,top:0,right:0,gap:0},ov=function(e){return parseInt(e||"",10)||0},rH=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[ov(n),ov(a),ov(i)]},aH=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return nH;var t=rH(e),n=document.documentElement.clientWidth,a=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,a-n+t[2]-t[0])}},sH=RM(),Sl="data-scroll-locked",iH=function(e,t,n,a){var i=e.left,l=e.top,u=e.right,d=e.gap;return n===void 0&&(n="margin"),`
  15. .`.concat(H8,` {
  16. overflow: hidden `).concat(a,`;
  17. padding-right: `).concat(d,"px ").concat(a,`;
  18. }
  19. body[`).concat(Sl,`] {
  20. overflow: hidden `).concat(a,`;
  21. overscroll-behavior: contain;
  22. `).concat([t&&"position: relative ".concat(a,";"),n==="margin"&&`
  23. padding-left: `.concat(i,`px;
  24. padding-top: `).concat(l,`px;
  25. padding-right: `).concat(u,`px;
  26. margin-left:0;
  27. margin-top:0;
  28. margin-right: `).concat(d,"px ").concat(a,`;
  29. `),n==="padding"&&"padding-right: ".concat(d,"px ").concat(a,";")].filter(Boolean).join(""),`
  30. }
  31. .`).concat(Jf,` {
  32. right: `).concat(d,"px ").concat(a,`;
  33. }
  34. .`).concat(eh,` {
  35. margin-right: `).concat(d,"px ").concat(a,`;
  36. }
  37. .`).concat(Jf," .").concat(Jf,` {
  38. right: 0 `).concat(a,`;
  39. }
  40. .`).concat(eh," .").concat(eh,` {
  41. margin-right: 0 `).concat(a,`;
  42. }
  43. body[`).concat(Sl,`] {
  44. `).concat(U8,": ").concat(d,`px;
  45. }
  46. `)},M_=function(){var e=parseInt(document.body.getAttribute(Sl)||"0",10);return isFinite(e)?e:0},oH=function(){g.useEffect(function(){return document.body.setAttribute(Sl,(M_()+1).toString()),function(){var e=M_()-1;e<=0?document.body.removeAttribute(Sl):document.body.setAttribute(Sl,e.toString())}},[])},lH=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,i=a===void 0?"margin":a;oH();var l=g.useMemo(function(){return aH(i)},[i]);return g.createElement(sH,{styles:iH(l,!t,i,n?"":"!important")})},Yb=!1;if(typeof window<"u")try{var Bf=Object.defineProperty({},"passive",{get:function(){return Yb=!0,!0}});window.addEventListener("test",Bf,Bf),window.removeEventListener("test",Bf,Bf)}catch{Yb=!1}var Go=Yb?{passive:!1}:!1,cH=function(e){return e.tagName==="TEXTAREA"},AM=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!cH(e)&&n[t]==="visible")},uH=function(e){return AM(e,"overflowY")},dH=function(e){return AM(e,"overflowX")},D_=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var i=OM(e,a);if(i){var l=MM(e,a),u=l[1],d=l[2];if(u>d)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},fH=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},hH=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},OM=function(e,t){return e==="v"?uH(t):dH(t)},MM=function(e,t){return e==="v"?fH(t):hH(t)},pH=function(e,t){return e==="h"&&t==="rtl"?-1:1},mH=function(e,t,n,a,i){var l=pH(e,window.getComputedStyle(t).direction),u=l*a,d=n.target,h=t.contains(d),p=!1,v=u>0,m=0,b=0;do{if(!d)break;var w=MM(e,d),C=w[0],S=w[1],j=w[2],N=S-j-l*C;(C||N)&&OM(e,d)&&(m+=N,b+=C);var _=d.parentNode;d=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!h&&d!==document.body||h&&(t.contains(d)||t===d));return(v&&Math.abs(m)<1||!v&&Math.abs(b)<1)&&(p=!0),p},If=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},P_=function(e){return[e.deltaX,e.deltaY]},k_=function(e){return e&&"current"in e?e.current:e},gH=function(e,t){return e[0]===t[0]&&e[1]===t[1]},vH=function(e){return`
  47. .block-interactivity-`.concat(e,` {pointer-events: none;}
  48. .allow-interactivity-`).concat(e,` {pointer-events: all;}
  49. `)},xH=0,Ko=[];function yH(e){var t=g.useRef([]),n=g.useRef([0,0]),a=g.useRef(),i=g.useState(xH++)[0],l=g.useState(RM)[0],u=g.useRef(e);g.useEffect(function(){u.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var S=F8([e.lockRef.current],(e.shards||[]).map(k_),!0).filter(Boolean);return S.forEach(function(j){return j.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(j){return j.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var d=g.useCallback(function(S,j){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!u.current.allowPinchZoom;var N=If(S),_=n.current,T="deltaX"in S?S.deltaX:_[0]-N[0],A="deltaY"in S?S.deltaY:_[1]-N[1],D,L=S.target,k=Math.abs(T)>Math.abs(A)?"h":"v";if("touches"in S&&k==="h"&&L.type==="range")return!1;var P=window.getSelection(),U=P&&P.anchorNode,J=U?U===L||U.contains(L):!1;if(J)return!1;var $=D_(k,L);if(!$)return!0;if($?D=k:(D=k==="v"?"h":"v",$=D_(k,L)),!$)return!1;if(!a.current&&"changedTouches"in S&&(T||A)&&(a.current=D),!D)return!0;var W=a.current||D;return mH(W,j,S,W==="h"?T:A)},[]),h=g.useCallback(function(S){var j=S;if(!(!Ko.length||Ko[Ko.length-1]!==l)){var N="deltaY"in j?P_(j):If(j),_=t.current.filter(function(D){return D.name===j.type&&(D.target===j.target||j.target===D.shadowParent)&&gH(D.delta,N)})[0];if(_&&_.should){j.cancelable&&j.preventDefault();return}if(!_){var T=(u.current.shards||[]).map(k_).filter(Boolean).filter(function(D){return D.contains(j.target)}),A=T.length>0?d(j,T[0]):!u.current.noIsolation;A&&j.cancelable&&j.preventDefault()}}},[]),p=g.useCallback(function(S,j,N,_){var T={name:S,delta:j,target:N,should:_,shadowParent:bH(N)};t.current.push(T),setTimeout(function(){t.current=t.current.filter(function(A){return A!==T})},1)},[]),v=g.useCallback(function(S){n.current=If(S),a.current=void 0},[]),m=g.useCallback(function(S){p(S.type,P_(S),S.target,d(S,e.lockRef.current))},[]),b=g.useCallback(function(S){p(S.type,If(S),S.target,d(S,e.lockRef.current))},[]);g.useEffect(function(){return Ko.push(l),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:b}),document.addEventListener("wheel",h,Go),document.addEventListener("touchmove",h,Go),document.addEventListener("touchstart",v,Go),function(){Ko=Ko.filter(function(S){return S!==l}),document.removeEventListener("wheel",h,Go),document.removeEventListener("touchmove",h,Go),document.removeEventListener("touchstart",v,Go)}},[]);var w=e.removeScrollBar,C=e.inert;return g.createElement(g.Fragment,null,C?g.createElement(l,{styles:vH(i)}):null,w?g.createElement(lH,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function bH(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const wH=W8(TM,yH);var Yh=g.forwardRef(function(e,t){return g.createElement(Kh,Pa({},e,{ref:t,sideCar:wH}))});Yh.classNames=Kh.classNames;var SH=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Yo=new WeakMap,zf=new WeakMap,Ff={},lv=0,DM=function(e){return e&&(e.host||DM(e.parentNode))},CH=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=DM(n);return a&&e.contains(a)?a:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},jH=function(e,t,n,a){var i=CH(t,Array.isArray(e)?e:[e]);Ff[n]||(Ff[n]=new WeakMap);var l=Ff[n],u=[],d=new Set,h=new Set(i),p=function(m){!m||d.has(m)||(d.add(m),p(m.parentNode))};i.forEach(p);var v=function(m){!m||h.has(m)||Array.prototype.forEach.call(m.children,function(b){if(d.has(b))v(b);else try{var w=b.getAttribute(a),C=w!==null&&w!=="false",S=(Yo.get(b)||0)+1,j=(l.get(b)||0)+1;Yo.set(b,S),l.set(b,j),u.push(b),S===1&&C&&zf.set(b,!0),j===1&&b.setAttribute(n,"true"),C||b.setAttribute(a,"true")}catch(N){console.error("aria-hidden: cannot operate on ",b,N)}})};return v(t),d.clear(),lv++,function(){u.forEach(function(m){var b=Yo.get(m)-1,w=l.get(m)-1;Yo.set(m,b),l.set(m,w),b||(zf.has(m)||m.removeAttribute(a),zf.delete(m)),w||m.removeAttribute(n)}),lv--,lv||(Yo=new WeakMap,Yo=new WeakMap,zf=new WeakMap,Ff={})}},sw=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),i=SH(e);return i?(a.push.apply(a,Array.from(i.querySelectorAll("[aria-live], script"))),jH(a,i,n,"aria-hidden")):function(){return null}};function NH(e){const t=_H(e),n=g.forwardRef((a,i)=>{const{children:l,...u}=a,d=g.Children.toArray(l),h=d.find(TH);if(h){const p=h.props.children,v=d.map(m=>m===h?g.Children.count(p)>1?g.Children.only(null):g.isValidElement(p)?p.props.children:null:m);return o.jsx(t,{...u,ref:i,children:g.isValidElement(p)?g.cloneElement(p,void 0,v):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function _H(e){const t=g.forwardRef((n,a)=>{const{children:i,...l}=n;if(g.isValidElement(i)){const u=AH(i),d=RH(l,i.props);return i.type!==g.Fragment&&(d.ref=a?oo(a,u):u),g.cloneElement(i,d)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var EH=Symbol("radix.slottable");function TH(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===EH}function RH(e,t){const n={...t};for(const a in t){const i=e[a],l=t[a];/^on[A-Z]/.test(a)?i&&l?n[a]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(n[a]=i):a==="style"?n[a]={...i,...l}:a==="className"&&(n[a]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function AH(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Wh="Dialog",[PM]=Lr(Wh),[OH,wa]=PM(Wh),kM=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:i,onOpenChange:l,modal:u=!0}=e,d=g.useRef(null),h=g.useRef(null),[p,v]=Zr({prop:a,defaultProp:i??!1,onChange:l,caller:Wh});return o.jsx(OH,{scope:t,triggerRef:d,contentRef:h,contentId:ma(),titleId:ma(),descriptionId:ma(),open:p,onOpenChange:v,onOpenToggle:g.useCallback(()=>v(m=>!m),[v]),modal:u,children:n})};kM.displayName=Wh;var LM="DialogTrigger",BM=g.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,i=wa(LM,n),l=At(t,i.triggerRef);return o.jsx(ut.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":lw(i.open),...a,ref:l,onClick:Je(e.onClick,i.onOpenToggle)})});BM.displayName=LM;var iw="DialogPortal",[MH,IM]=PM(iw,{forceMount:void 0}),zM=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:i}=e,l=wa(iw,t);return o.jsx(MH,{scope:t,forceMount:n,children:g.Children.map(a,u=>o.jsx(Ts,{present:n||l.open,children:o.jsx(Gh,{asChild:!0,container:i,children:u})}))})};zM.displayName=iw;var mh="DialogOverlay",FM=g.forwardRef((e,t)=>{const n=IM(mh,e.__scopeDialog),{forceMount:a=n.forceMount,...i}=e,l=wa(mh,e.__scopeDialog);return l.modal?o.jsx(Ts,{present:a||l.open,children:o.jsx(PH,{...i,ref:t})}):null});FM.displayName=mh;var DH=NH("DialogOverlay.RemoveScroll"),PH=g.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,i=wa(mh,n);return o.jsx(Yh,{as:DH,allowPinchZoom:!0,shards:[i.contentRef],children:o.jsx(ut.div,{"data-state":lw(i.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),eo="DialogContent",HM=g.forwardRef((e,t)=>{const n=IM(eo,e.__scopeDialog),{forceMount:a=n.forceMount,...i}=e,l=wa(eo,e.__scopeDialog);return o.jsx(Ts,{present:a||l.open,children:l.modal?o.jsx(kH,{...i,ref:t}):o.jsx(LH,{...i,ref:t})})});HM.displayName=eo;var kH=g.forwardRef((e,t)=>{const n=wa(eo,e.__scopeDialog),a=g.useRef(null),i=At(t,n.contentRef,a);return g.useEffect(()=>{const l=a.current;if(l)return sw(l)},[]),o.jsx(UM,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Je(e.onCloseAutoFocus,l=>{l.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Je(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&l.preventDefault()}),onFocusOutside:Je(e.onFocusOutside,l=>l.preventDefault())})}),LH=g.forwardRef((e,t)=>{const n=wa(eo,e.__scopeDialog),a=g.useRef(!1),i=g.useRef(!1);return o.jsx(UM,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{e.onCloseAutoFocus?.(l),l.defaultPrevented||(a.current||n.triggerRef.current?.focus(),l.preventDefault()),a.current=!1,i.current=!1},onInteractOutside:l=>{e.onInteractOutside?.(l),l.defaultPrevented||(a.current=!0,l.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const u=l.target;n.triggerRef.current?.contains(u)&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&i.current&&l.preventDefault()}})}),UM=g.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:l,...u}=e,d=wa(eo,n),h=g.useRef(null),p=At(t,h);return aw(),o.jsxs(o.Fragment,{children:[o.jsx($h,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:i,onUnmountAutoFocus:l,children:o.jsx(Qu,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":lw(d.open),...u,ref:p,onDismiss:()=>d.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(BH,{titleId:d.titleId}),o.jsx(zH,{contentRef:h,descriptionId:d.descriptionId})]})]})}),ow="DialogTitle",qM=g.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,i=wa(ow,n);return o.jsx(ut.h2,{id:i.titleId,...a,ref:t})});qM.displayName=ow;var VM="DialogDescription",$M=g.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,i=wa(VM,n);return o.jsx(ut.p,{id:i.descriptionId,...a,ref:t})});$M.displayName=VM;var GM="DialogClose",KM=g.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,i=wa(GM,n);return o.jsx(ut.button,{type:"button",...a,ref:t,onClick:Je(e.onClick,()=>i.onOpenChange(!1))})});KM.displayName=GM;function lw(e){return e?"open":"closed"}var YM="DialogTitleWarning",[Fse,WM]=i8(YM,{contentName:eo,titleName:ow,docsSlug:"dialog"}),BH=({titleId:e})=>{const t=WM(YM),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
  50. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
  51. For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},IH="DialogDescriptionWarning",zH=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${WM(IH).contentName}}.`;return g.useEffect(()=>{const i=e.current?.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},XM=kM,FH=BM,QM=zM,Xh=FM,Qh=HM,Zh=qM,Jh=$M,ZM=KM;const HH=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),UH=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase()),L_=e=>{const t=UH(e);return t.charAt(0).toUpperCase()+t.slice(1)},JM=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim(),qH=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var VH={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const $H=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:i="",children:l,iconNode:u,...d},h)=>g.createElement("svg",{ref:h,...VH,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:JM("lucide",i),...!l&&!qH(d)&&{"aria-hidden":"true"},...d},[...u.map(([p,v])=>g.createElement(p,v)),...Array.isArray(l)?l:[l]]));const Rs=(e,t)=>{const n=g.forwardRef(({className:a,...i},l)=>g.createElement($H,{ref:l,iconNode:t,className:JM(`lucide-${HH(L_(e))}`,`lucide-${e}`,a),...i}));return n.displayName=L_(e),n};const GH=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],eD=Rs("check",GH);const KH=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],cw=Rs("chevron-down",KH);const YH=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],WH=Rs("chevron-up",YH);const XH=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],QH=Rs("circle",XH);const ZH=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],JH=Rs("layers",ZH);const eU=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],tU=Rs("pencil",eU);const nU=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],rU=Rs("plus",nU);const aU=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],tD=Rs("trash-2",aU);const sU=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],nD=Rs("x",sU),ga=XM,tu=FH,iU=QM,rD=g.forwardRef(({className:e,...t},n)=>o.jsx(Xh,{ref:n,className:lt("fixed inset-0 z-[100] bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));rD.displayName=Xh.displayName;const Wr=g.forwardRef(({className:e,children:t,...n},a)=>o.jsxs(iU,{children:[o.jsx(rD,{}),o.jsxs(Qh,{ref:a,className:lt("fixed left-[50%] top-[50%] z-[100] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,o.jsxs(ZM,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[o.jsx(nD,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Wr.displayName=Qh.displayName;const Mr=({className:e,...t})=>o.jsx("div",{className:lt("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Mr.displayName="DialogHeader";const va=({className:e,...t})=>o.jsx("div",{className:lt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});va.displayName="DialogFooter";const Dr=g.forwardRef(({className:e,...t},n)=>o.jsx(Zh,{ref:n,className:lt("text-lg font-semibold leading-none tracking-tight",e),...t}));Dr.displayName=Zh.displayName;const vi=g.forwardRef(({className:e,...t},n)=>o.jsx(Jh,{ref:n,className:lt("text-sm text-muted-foreground",e),...t}));vi.displayName=Jh.displayName;class oU{_baseUrl="";_listeners=new Set;get baseUrl(){return this._baseUrl}setBaseUrl(t){const n=t.replace(/\/$/,"");n!==this._baseUrl&&(this._baseUrl=n,this._listeners.forEach(a=>a(this._baseUrl)))}onBaseUrlChange(t){return this._listeners.add(t),()=>this._listeners.delete(t)}buildUrl(t){const n=t.startsWith("/")?t:`/${t}`;return`${this._baseUrl}${n}`}async request(t,n={}){const{method:a="GET",body:i,headers:l={},signal:u}=n,d=this.buildUrl(t),h={method:a,headers:{"Content-Type":"application/json",...l},signal:u};i!==void 0&&(h.body=JSON.stringify(i));const p=await fetch(d,h);if(!p.ok){const m=await p.text();throw new Error(`HTTP ${p.status}: ${m}`)}const v=await p.text();return v?JSON.parse(v):{}}async get(t,n){return this.request(t,{method:"GET",signal:n})}async post(t,n,a){return this.request(t,{method:"POST",body:n,signal:a})}async patch(t,n,a){return this.request(t,{method:"PATCH",body:n,signal:a})}async delete(t,n,a){return this.request(t,{method:"DELETE",body:n,signal:a})}getWebSocketUrl(t){const n=t.startsWith("/")?t:`/${t}`;if(this._baseUrl){const a=new URL(this._baseUrl);return`${a.protocol==="https:"?"wss:":"ws:"}//${a.host}${n}`}else{const a=window.location.protocol==="https:"?"wss:":"ws:",i=window.location.hostname,l=window.location.port,u=l?`:${l}`:"";return`${a}//${i}${u}${n}`}}getAssetUrl(t){const n=t.startsWith("/")?t:`/${t}`;return`${this._baseUrl}${n}`}async uploadFile(t,n,a="file",i){const l=this.buildUrl(t),u=new FormData;u.append(a,n),i&&Object.entries(i).forEach(([p,v])=>{u.append(p,v)});const d=await fetch(l,{method:"POST",body:u});if(!d.ok){const p=await d.text();throw new Error(`HTTP ${d.status}: ${p}`)}const h=await d.text();return h?JSON.parse(h):{}}}const fe=new oU;function lU(){try{const e="duneweaver_tables",t="duneweaver_active_table",n=localStorage.getItem(e),a=localStorage.getItem(t);if(!n||!a)return;const u=(JSON.parse(n).tables||[]).find(v=>v.id===a);if(!u?.url)return;const h=(v=>{try{return new URL(v).origin}catch{return v}})(u.url),p=window.location.origin;h!==p&&fe.setBaseUrl(u.url)}catch{}}lU();const B_=e=>{let t;const n=new Set,a=(p,v)=>{const m=typeof p=="function"?p(t):p;if(!Object.is(m,t)){const b=t;t=v??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(w=>w(t,b))}},i=()=>t,d={setState:a,getState:i,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=t=e(a,i,d);return d},cU=(e=>e?B_(e):B_),uU=e=>e;function dU(e,t=uU){const n=R.useSyncExternalStore(e.subscribe,R.useCallback(()=>t(e.getState()),[e,t]),R.useCallback(()=>t(e.getInitialState()),[e,t]));return R.useDebugValue(n),n}const fU=e=>{const t=cU(e),n=a=>dU(t,a);return Object.assign(n,t),n},aD=(e=>fU),un=aD()(()=>({isBackendConnected:!1,connectionAttempts:0,status:null}));let ua=null,th=null;function uw(){if(ua){if(ua.readyState===WebSocket.CONNECTING)return;ua.readyState===WebSocket.OPEN&&ua.close(),ua=null}const e=new WebSocket(fe.getWebSocketUrl("/ws/status"));ua=e,e.onopen=()=>{un.setState({isBackendConnected:!0,connectionAttempts:0}),window.dispatchEvent(new CustomEvent("backend-connected"))},e.onmessage=t=>{try{const n=JSON.parse(t.data);n.type==="status_update"&&n.data&&un.setState({status:n.data})}catch{}},e.onclose=()=>{ua=null,un.setState(t=>({isBackendConnected:!1,connectionAttempts:t.connectionAttempts+1})),th=setTimeout(uw,3e3)},e.onerror=()=>{un.setState({isBackendConnected:!1})}}fe.onBaseUrlChange(()=>{un.setState({status:null,isBackendConnected:!1}),th&&(clearTimeout(th),th=null),ua&&(ua.readyState===WebSocket.OPEN&&ua.close(),ua=null),uw()});uw();let nh=null;un.subscribe(e=>{const t=e.status;if(!t)return;const n=!!t.current_file||!!t.is_running||!!t.is_paused||(t.pause_time_remaining??0)>0;nh!==null&&n&&!nh&&window.dispatchEvent(new CustomEvent("playback-started")),nh=n});fe.onBaseUrlChange(()=>{nh=null});function hU(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>a=>{t.forEach(i=>i(a))},t)}const ep=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Il(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function dw(e){return"nodeType"in e}function vr(e){var t,n;return e?Il(e)?e:dw(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function fw(e){const{Document:t}=vr(e);return e instanceof t}function Zu(e){return Il(e)?!1:e instanceof vr(e).HTMLElement}function sD(e){return e instanceof vr(e).SVGElement}function zl(e){return e?Il(e)?e.document:dw(e)?fw(e)?e:Zu(e)||sD(e)?e.ownerDocument:document:document:document}const Fa=ep?g.useLayoutEffect:g.useEffect;function hw(e){const t=g.useRef(e);return Fa(()=>{t.current=e}),g.useCallback(function(){for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return t.current==null?void 0:t.current(...a)},[])}function pU(){const e=g.useRef(null),t=g.useCallback((a,i)=>{e.current=setInterval(a,i)},[]),n=g.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ou(e,t){t===void 0&&(t=[e]);const n=g.useRef(e);return Fa(()=>{n.current!==e&&(n.current=e)},t),n}function Ju(e,t){const n=g.useRef();return g.useMemo(()=>{const a=e(n.current);return n.current=a,a},[...t])}function gh(e){const t=hw(e),n=g.useRef(null),a=g.useCallback(i=>{i!==n.current&&t?.(i,n.current),n.current=i},[]);return[n,a]}function Wb(e){const t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}let cv={};function ed(e,t){return g.useMemo(()=>{if(t)return t;const n=cv[e]==null?0:cv[e]+1;return cv[e]=n,e+"-"+n},[e,t])}function iD(e){return function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];return a.reduce((l,u)=>{const d=Object.entries(u);for(const[h,p]of d){const v=l[h];v!=null&&(l[h]=v+e*p)}return l},{...t})}}const Cl=iD(1),Mu=iD(-1);function mU(e){return"clientX"in e&&"clientY"in e}function pw(e){if(!e)return!1;const{KeyboardEvent:t}=vr(e.target);return t&&e instanceof t}function gU(e){if(!e)return!1;const{TouchEvent:t}=vr(e.target);return t&&e instanceof t}function Xb(e){if(gU(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return mU(e)?{x:e.clientX,y:e.clientY}:null}const Du=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Du.Translate.toString(e),Du.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:a}=e;return t+" "+n+"ms "+a}}}),I_="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function vU(e){return e.matches(I_)?e:e.querySelector(I_)}const xU={display:"none"};function yU(e){let{id:t,value:n}=e;return R.createElement("div",{id:t,style:xU},n)}function bU(e){let{id:t,announcement:n,ariaLiveType:a="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return R.createElement("div",{id:t,style:i,role:"status","aria-live":a,"aria-atomic":!0},n)}function wU(){const[e,t]=g.useState("");return{announce:g.useCallback(a=>{a!=null&&t(a)},[]),announcement:e}}const oD=g.createContext(null);function SU(e){const t=g.useContext(oD);g.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function CU(){const[e]=g.useState(()=>new Set),t=g.useCallback(a=>(e.add(a),()=>e.delete(a)),[e]);return[g.useCallback(a=>{let{type:i,event:l}=a;e.forEach(u=>{var d;return(d=u[i])==null?void 0:d.call(u,l)})},[e]),t]}const jU={draggable:`
  52. To pick up a draggable item, press the space bar.
  53. While dragging, use the arrow keys to move the item.
  54. Press space again to drop the item in its new position, or press escape to cancel.
  55. `},NU={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function _U(e){let{announcements:t=NU,container:n,hiddenTextDescribedById:a,screenReaderInstructions:i=jU}=e;const{announce:l,announcement:u}=wU(),d=ed("DndLiveRegion"),[h,p]=g.useState(!1);if(g.useEffect(()=>{p(!0)},[]),SU(g.useMemo(()=>({onDragStart(m){let{active:b}=m;l(t.onDragStart({active:b}))},onDragMove(m){let{active:b,over:w}=m;t.onDragMove&&l(t.onDragMove({active:b,over:w}))},onDragOver(m){let{active:b,over:w}=m;l(t.onDragOver({active:b,over:w}))},onDragEnd(m){let{active:b,over:w}=m;l(t.onDragEnd({active:b,over:w}))},onDragCancel(m){let{active:b,over:w}=m;l(t.onDragCancel({active:b,over:w}))}}),[l,t])),!h)return null;const v=R.createElement(R.Fragment,null,R.createElement(yU,{id:a,value:i.draggable}),R.createElement(bU,{id:d,announcement:u}));return n?ka.createPortal(v,n):v}var Mn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Mn||(Mn={}));function vh(){}function z_(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function EU(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(a=>a!=null),[...t])}const xa=Object.freeze({x:0,y:0});function lD(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function cD(e,t){let{data:{value:n}}=e,{data:{value:a}}=t;return n-a}function TU(e,t){let{data:{value:n}}=e,{data:{value:a}}=t;return a-n}function F_(e){let{left:t,top:n,height:a,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+a},{x:t+i,y:n+a}]}function uD(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function H_(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const RU=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const i=H_(t,t.left,t.top),l=[];for(const u of a){const{id:d}=u,h=n.get(d);if(h){const p=lD(H_(h),i);l.push({id:d,data:{droppableContainer:u,value:p}})}}return l.sort(cD)},AU=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const i=F_(t),l=[];for(const u of a){const{id:d}=u,h=n.get(d);if(h){const p=F_(h),v=i.reduce((b,w,C)=>b+lD(p[C],w),0),m=Number((v/4).toFixed(4));l.push({id:d,data:{droppableContainer:u,value:m}})}}return l.sort(cD)};function OU(e,t){const n=Math.max(t.top,e.top),a=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),l=Math.min(t.top+t.height,e.top+e.height),u=i-a,d=l-n;if(a<i&&n<l){const h=t.width*t.height,p=e.width*e.height,v=u*d,m=v/(h+p-v);return Number(m.toFixed(4))}return 0}const MU=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const i=[];for(const l of a){const{id:u}=l,d=n.get(u);if(d){const h=OU(d,t);h>0&&i.push({id:u,data:{droppableContainer:l,value:h}})}}return i.sort(TU)};function DU(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function dD(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:xa}function PU(e){return function(n){for(var a=arguments.length,i=new Array(a>1?a-1:0),l=1;l<a;l++)i[l-1]=arguments[l];return i.reduce((u,d)=>({...u,top:u.top+e*d.y,bottom:u.bottom+e*d.y,left:u.left+e*d.x,right:u.right+e*d.x}),{...n})}}const kU=PU(1);function LU(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function BU(e,t,n){const a=LU(t);if(!a)return e;const{scaleX:i,scaleY:l,x:u,y:d}=a,h=e.left-u-(1-i)*parseFloat(n),p=e.top-d-(1-l)*parseFloat(n.slice(n.indexOf(" ")+1)),v=i?e.width/i:e.width,m=l?e.height/l:e.height;return{width:v,height:m,top:p,right:h+v,bottom:p+m,left:h}}const IU={ignoreTransform:!1};function Fl(e,t){t===void 0&&(t=IU);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:p,transformOrigin:v}=vr(e).getComputedStyle(e);p&&(n=BU(n,p,v))}const{top:a,left:i,width:l,height:u,bottom:d,right:h}=n;return{top:a,left:i,width:l,height:u,bottom:d,right:h}}function U_(e){return Fl(e,{ignoreTransform:!0})}function zU(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function FU(e,t){return t===void 0&&(t=vr(e).getComputedStyle(e)),t.position==="fixed"}function HU(e,t){t===void 0&&(t=vr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const l=t[i];return typeof l=="string"?n.test(l):!1})}function tp(e,t){const n=[];function a(i){if(t!=null&&n.length>=t||!i)return n;if(fw(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Zu(i)||sD(i)||n.includes(i))return n;const l=vr(e).getComputedStyle(i);return i!==e&&HU(i,l)&&n.push(i),FU(i,l)?n:a(i.parentNode)}return e?a(e):n}function fD(e){const[t]=tp(e,1);return t??null}function uv(e){return!ep||!e?null:Il(e)?e:dw(e)?fw(e)||e===zl(e).scrollingElement?window:Zu(e)?e:null:null}function hD(e){return Il(e)?e.scrollX:e.scrollLeft}function pD(e){return Il(e)?e.scrollY:e.scrollTop}function Qb(e){return{x:hD(e),y:pD(e)}}var kn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(kn||(kn={}));function mD(e){return!ep||!e?!1:e===document.scrollingElement}function gD(e){const t={x:0,y:0},n=mD(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,l=e.scrollLeft<=t.x,u=e.scrollTop>=a.y,d=e.scrollLeft>=a.x;return{isTop:i,isLeft:l,isBottom:u,isRight:d,maxScroll:a,minScroll:t}}const UU={x:.2,y:.2};function qU(e,t,n,a,i){let{top:l,left:u,right:d,bottom:h}=n;a===void 0&&(a=10),i===void 0&&(i=UU);const{isTop:p,isBottom:v,isLeft:m,isRight:b}=gD(e),w={x:0,y:0},C={x:0,y:0},S={height:t.height*i.y,width:t.width*i.x};return!p&&l<=t.top+S.height?(w.y=kn.Backward,C.y=a*Math.abs((t.top+S.height-l)/S.height)):!v&&h>=t.bottom-S.height&&(w.y=kn.Forward,C.y=a*Math.abs((t.bottom-S.height-h)/S.height)),!b&&d>=t.right-S.width?(w.x=kn.Forward,C.x=a*Math.abs((t.right-S.width-d)/S.width)):!m&&u<=t.left+S.width&&(w.x=kn.Backward,C.x=a*Math.abs((t.left+S.width-u)/S.width)),{direction:w,speed:C}}function VU(e){if(e===document.scrollingElement){const{innerWidth:l,innerHeight:u}=window;return{top:0,left:0,right:l,bottom:u,width:l,height:u}}const{top:t,left:n,right:a,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:a,bottom:i,width:e.clientWidth,height:e.clientHeight}}function vD(e){return e.reduce((t,n)=>Cl(t,Qb(n)),xa)}function $U(e){return e.reduce((t,n)=>t+hD(n),0)}function GU(e){return e.reduce((t,n)=>t+pD(n),0)}function KU(e,t){if(t===void 0&&(t=Fl),!e)return;const{top:n,left:a,bottom:i,right:l}=t(e);fD(e)&&(i<=0||l<=0||n>=window.innerHeight||a>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const YU=[["x",["left","right"],$U],["y",["top","bottom"],GU]];class mw{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const a=tp(n),i=vD(a);this.rect={...t},this.width=t.width,this.height=t.height;for(const[l,u,d]of YU)for(const h of u)Object.defineProperty(this,h,{get:()=>{const p=d(a),v=i[l]-p;return this.rect[h]+v},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class vu{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var a;return(a=this.target)==null?void 0:a.removeEventListener(...n)})},this.target=t}add(t,n,a){var i;(i=this.target)==null||i.addEventListener(t,n,a),this.listeners.push([t,n,a])}}function WU(e){const{EventTarget:t}=vr(e);return e instanceof t?e:zl(e)}function dv(e,t){const n=Math.abs(e.x),a=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+a**2)>t:"x"in t&&"y"in t?n>t.x&&a>t.y:"x"in t?n>t.x:"y"in t?a>t.y:!1}var Kr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Kr||(Kr={}));function q_(e){e.preventDefault()}function XU(e){e.stopPropagation()}var Ht;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ht||(Ht={}));const xD={start:[Ht.Space,Ht.Enter],cancel:[Ht.Esc],end:[Ht.Space,Ht.Enter,Ht.Tab]},QU=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ht.Right:return{...n,x:n.x+25};case Ht.Left:return{...n,x:n.x-25};case Ht.Down:return{...n,y:n.y+25};case Ht.Up:return{...n,y:n.y-25}}};class gw{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new vu(zl(n)),this.windowListeners=new vu(vr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Kr.Resize,this.handleCancel),this.windowListeners.add(Kr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Kr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,a=t.node.current;a&&KU(a),n(xa)}handleKeyDown(t){if(pw(t)){const{active:n,context:a,options:i}=this.props,{keyboardCodes:l=xD,coordinateGetter:u=QU,scrollBehavior:d="smooth"}=i,{code:h}=t;if(l.end.includes(h)){this.handleEnd(t);return}if(l.cancel.includes(h)){this.handleCancel(t);return}const{collisionRect:p}=a.current,v=p?{x:p.left,y:p.top}:xa;this.referenceCoordinates||(this.referenceCoordinates=v);const m=u(t,{active:n,context:a.current,currentCoordinates:v});if(m){const b=Mu(m,v),w={x:0,y:0},{scrollableAncestors:C}=a.current;for(const S of C){const j=t.code,{isTop:N,isRight:_,isLeft:T,isBottom:A,maxScroll:D,minScroll:L}=gD(S),k=VU(S),P={x:Math.min(j===Ht.Right?k.right-k.width/2:k.right,Math.max(j===Ht.Right?k.left:k.left+k.width/2,m.x)),y:Math.min(j===Ht.Down?k.bottom-k.height/2:k.bottom,Math.max(j===Ht.Down?k.top:k.top+k.height/2,m.y))},U=j===Ht.Right&&!_||j===Ht.Left&&!T,J=j===Ht.Down&&!A||j===Ht.Up&&!N;if(U&&P.x!==m.x){const $=S.scrollLeft+b.x,W=j===Ht.Right&&$<=D.x||j===Ht.Left&&$>=L.x;if(W&&!b.y){S.scrollTo({left:$,behavior:d});return}W?w.x=S.scrollLeft-$:w.x=j===Ht.Right?S.scrollLeft-D.x:S.scrollLeft-L.x,w.x&&S.scrollBy({left:-w.x,behavior:d});break}else if(J&&P.y!==m.y){const $=S.scrollTop+b.y,W=j===Ht.Down&&$<=D.y||j===Ht.Up&&$>=L.y;if(W&&!b.x){S.scrollTo({top:$,behavior:d});return}W?w.y=S.scrollTop-$:w.y=j===Ht.Down?S.scrollTop-D.y:S.scrollTop-L.y,w.y&&S.scrollBy({top:-w.y,behavior:d});break}}this.handleMove(t,Cl(Mu(m,this.referenceCoordinates),w))}}}handleMove(t,n){const{onMove:a}=this.props;t.preventDefault(),a(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}gw.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:a=xD,onActivation:i}=t,{active:l}=n;const{code:u}=e.nativeEvent;if(a.start.includes(u)){const d=l.activatorNode.current;return d&&e.target!==d?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function V_(e){return!!(e&&"distance"in e)}function $_(e){return!!(e&&"delay"in e)}class vw{constructor(t,n,a){var i;a===void 0&&(a=WU(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:l}=t,{target:u}=l;this.props=t,this.events=n,this.document=zl(u),this.documentListeners=new vu(this.document),this.listeners=new vu(a),this.windowListeners=new vu(vr(u)),this.initialCoordinates=(i=Xb(l))!=null?i:xa,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:a}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Kr.Resize,this.handleCancel),this.windowListeners.add(Kr.DragStart,q_),this.windowListeners.add(Kr.VisibilityChange,this.handleCancel),this.windowListeners.add(Kr.ContextMenu,q_),this.documentListeners.add(Kr.Keydown,this.handleKeydown),n){if(a!=null&&a({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if($_(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(V_(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:a,onPending:i}=this.props;i(a,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Kr.Click,XU,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Kr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:a,initialCoordinates:i,props:l}=this,{onMove:u,options:{activationConstraint:d}}=l;if(!i)return;const h=(n=Xb(t))!=null?n:xa,p=Mu(i,h);if(!a&&d){if(V_(d)){if(d.tolerance!=null&&dv(p,d.tolerance))return this.handleCancel();if(dv(p,d.distance))return this.handleStart()}if($_(d)&&dv(p,d.tolerance))return this.handleCancel();this.handlePending(d,p);return}t.cancelable&&t.preventDefault(),u(h)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Ht.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ZU={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class xw extends vw{constructor(t){const{event:n}=t,a=zl(n.target);super(t,ZU,a)}}xw.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return!n.isPrimary||n.button!==0?!1:(a?.({event:n}),!0)}}];const JU={move:{name:"mousemove"},end:{name:"mouseup"}};var Zb;(function(e){e[e.RightClick=2]="RightClick"})(Zb||(Zb={}));class eq extends vw{constructor(t){super(t,JU,zl(t.event.target))}}eq.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return n.button===Zb.RightClick?!1:(a?.({event:n}),!0)}}];const fv={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class tq extends vw{constructor(t){super(t,fv)}static setup(){return window.addEventListener(fv.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(fv.move.name,t)};function t(){}}}tq.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;const{touches:i}=n;return i.length>1?!1:(a?.({event:n}),!0)}}];var xu;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(xu||(xu={}));var xh;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(xh||(xh={}));function nq(e){let{acceleration:t,activator:n=xu.Pointer,canScroll:a,draggingRect:i,enabled:l,interval:u=5,order:d=xh.TreeOrder,pointerCoordinates:h,scrollableAncestors:p,scrollableAncestorRects:v,delta:m,threshold:b}=e;const w=aq({delta:m,disabled:!l}),[C,S]=pU(),j=g.useRef({x:0,y:0}),N=g.useRef({x:0,y:0}),_=g.useMemo(()=>{switch(n){case xu.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case xu.DraggableRect:return i}},[n,i,h]),T=g.useRef(null),A=g.useCallback(()=>{const L=T.current;if(!L)return;const k=j.current.x*N.current.x,P=j.current.y*N.current.y;L.scrollBy(k,P)},[]),D=g.useMemo(()=>d===xh.TreeOrder?[...p].reverse():p,[d,p]);g.useEffect(()=>{if(!l||!p.length||!_){S();return}for(const L of D){if(a?.(L)===!1)continue;const k=p.indexOf(L),P=v[k];if(!P)continue;const{direction:U,speed:J}=qU(L,P,_,t,b);for(const $ of["x","y"])w[$][U[$]]||(J[$]=0,U[$]=0);if(J.x>0||J.y>0){S(),T.current=L,C(A,u),j.current=J,N.current=U;return}}j.current={x:0,y:0},N.current={x:0,y:0},S()},[t,A,a,S,l,u,JSON.stringify(_),JSON.stringify(w),C,p,D,v,JSON.stringify(b)])}const rq={x:{[kn.Backward]:!1,[kn.Forward]:!1},y:{[kn.Backward]:!1,[kn.Forward]:!1}};function aq(e){let{delta:t,disabled:n}=e;const a=Wb(t);return Ju(i=>{if(n||!a||!i)return rq;const l={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return{x:{[kn.Backward]:i.x[kn.Backward]||l.x===-1,[kn.Forward]:i.x[kn.Forward]||l.x===1},y:{[kn.Backward]:i.y[kn.Backward]||l.y===-1,[kn.Forward]:i.y[kn.Forward]||l.y===1}}},[n,t,a])}function sq(e,t){const n=t!=null?e.get(t):void 0,a=n?n.node.current:null;return Ju(i=>{var l;return t==null?null:(l=a??i)!=null?l:null},[a,t])}function iq(e,t){return g.useMemo(()=>e.reduce((n,a)=>{const{sensor:i}=a,l=i.activators.map(u=>({eventName:u.eventName,handler:t(u.handler,a)}));return[...n,...l]},[]),[e,t])}var Pu;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Pu||(Pu={}));var Jb;(function(e){e.Optimized="optimized"})(Jb||(Jb={}));const G_=new Map;function oq(e,t){let{dragging:n,dependencies:a,config:i}=t;const[l,u]=g.useState(null),{frequency:d,measure:h,strategy:p}=i,v=g.useRef(e),m=j(),b=Ou(m),w=g.useCallback(function(N){N===void 0&&(N=[]),!b.current&&u(_=>_===null?N:_.concat(N.filter(T=>!_.includes(T))))},[b]),C=g.useRef(null),S=Ju(N=>{if(m&&!n)return G_;if(!N||N===G_||v.current!==e||l!=null){const _=new Map;for(let T of e){if(!T)continue;if(l&&l.length>0&&!l.includes(T.id)&&T.rect.current){_.set(T.id,T.rect.current);continue}const A=T.node.current,D=A?new mw(h(A),A):null;T.rect.current=D,D&&_.set(T.id,D)}return _}return N},[e,l,n,m,h]);return g.useEffect(()=>{v.current=e},[e]),g.useEffect(()=>{m||w()},[n,m]),g.useEffect(()=>{l&&l.length>0&&u(null)},[JSON.stringify(l)]),g.useEffect(()=>{m||typeof d!="number"||C.current!==null||(C.current=setTimeout(()=>{w(),C.current=null},d))},[d,m,w,...a]),{droppableRects:S,measureDroppableContainers:w,measuringScheduled:l!=null};function j(){switch(p){case Pu.Always:return!1;case Pu.BeforeDragging:return n;default:return!n}}}function yD(e,t){return Ju(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function lq(e,t){return yD(e,t)}function cq(e){let{callback:t,disabled:n}=e;const a=hw(t),i=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:l}=window;return new l(a)},[a,n]);return g.useEffect(()=>()=>i?.disconnect(),[i]),i}function np(e){let{callback:t,disabled:n}=e;const a=hw(t),i=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:l}=window;return new l(a)},[n]);return g.useEffect(()=>()=>i?.disconnect(),[i]),i}function uq(e){return new mw(Fl(e),e)}function K_(e,t,n){t===void 0&&(t=uq);const[a,i]=g.useState(null);function l(){i(h=>{if(!e)return null;if(e.isConnected===!1){var p;return(p=h??n)!=null?p:null}const v=t(e);return JSON.stringify(h)===JSON.stringify(v)?h:v})}const u=cq({callback(h){if(e)for(const p of h){const{type:v,target:m}=p;if(v==="childList"&&m instanceof HTMLElement&&m.contains(e)){l();break}}}}),d=np({callback:l});return Fa(()=>{l(),e?(d?.observe(e),u?.observe(document.body,{childList:!0,subtree:!0})):(d?.disconnect(),u?.disconnect())},[e]),a}function dq(e){const t=yD(e);return dD(e,t)}const Y_=[];function fq(e){const t=g.useRef(e),n=Ju(a=>e?a&&a!==Y_&&e&&t.current&&e.parentNode===t.current.parentNode?a:tp(e):Y_,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function hq(e){const[t,n]=g.useState(null),a=g.useRef(e),i=g.useCallback(l=>{const u=uv(l.target);u&&n(d=>d?(d.set(u,Qb(u)),new Map(d)):null)},[]);return g.useEffect(()=>{const l=a.current;if(e!==l){u(l);const d=e.map(h=>{const p=uv(h);return p?(p.addEventListener("scroll",i,{passive:!0}),[p,Qb(p)]):null}).filter(h=>h!=null);n(d.length?new Map(d):null),a.current=e}return()=>{u(e),u(l)};function u(d){d.forEach(h=>{const p=uv(h);p?.removeEventListener("scroll",i)})}},[i,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((l,u)=>Cl(l,u),xa):vD(e):xa,[e,t])}function W_(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const a=e!==xa;a&&!n.current&&(n.current=e),!a&&n.current&&(n.current=null)},[e]),n.current?Mu(e,n.current):xa}function pq(e){g.useEffect(()=>{if(!ep)return;const t=e.map(n=>{let{sensor:a}=n;return a.setup==null?void 0:a.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function mq(e,t){return g.useMemo(()=>e.reduce((n,a)=>{let{eventName:i,handler:l}=a;return n[i]=u=>{l(u,t)},n},{}),[e,t])}function bD(e){return g.useMemo(()=>e?zU(e):null,[e])}const X_=[];function gq(e,t){t===void 0&&(t=Fl);const[n]=e,a=bD(n?vr(n):null),[i,l]=g.useState(X_);function u(){l(()=>e.length?e.map(h=>mD(h)?a:new mw(t(h),h)):X_)}const d=np({callback:u});return Fa(()=>{d?.disconnect(),u(),e.forEach(h=>d?.observe(h))},[e]),i}function vq(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Zu(t)?t:e}function xq(e){let{measure:t}=e;const[n,a]=g.useState(null),i=g.useCallback(p=>{for(const{target:v}of p)if(Zu(v)){a(m=>{const b=t(v);return m?{...m,width:b.width,height:b.height}:b});break}},[t]),l=np({callback:i}),u=g.useCallback(p=>{const v=vq(p);l?.disconnect(),v&&l?.observe(v),a(v?t(v):null)},[t,l]),[d,h]=gh(u);return g.useMemo(()=>({nodeRef:d,rect:n,setRef:h}),[n,d,h])}const yq=[{sensor:xw,options:{}},{sensor:gw,options:{}}],bq={current:{}},rh={draggable:{measure:U_},droppable:{measure:U_,strategy:Pu.WhileDragging,frequency:Jb.Optimized},dragOverlay:{measure:Fl}};class yu extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,a;return(n=(a=this.get(t))==null?void 0:a.node.current)!=null?n:void 0}}const wq={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new yu,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:vh},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:rh,measureDroppableContainers:vh,windowRect:null,measuringScheduled:!1},Sq={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:vh,draggableNodes:new Map,over:null,measureDroppableContainers:vh},rp=g.createContext(Sq),wD=g.createContext(wq);function Cq(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new yu}}}function jq(e,t){switch(t.type){case Mn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Mn.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Mn.DragEnd:case Mn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Mn.RegisterDroppable:{const{element:n}=t,{id:a}=n,i=new yu(e.droppable.containers);return i.set(a,n),{...e,droppable:{...e.droppable,containers:i}}}case Mn.SetDroppableDisabled:{const{id:n,key:a,disabled:i}=t,l=e.droppable.containers.get(n);if(!l||a!==l.key)return e;const u=new yu(e.droppable.containers);return u.set(n,{...l,disabled:i}),{...e,droppable:{...e.droppable,containers:u}}}case Mn.UnregisterDroppable:{const{id:n,key:a}=t,i=e.droppable.containers.get(n);if(!i||a!==i.key)return e;const l=new yu(e.droppable.containers);return l.delete(n),{...e,droppable:{...e.droppable,containers:l}}}default:return e}}function Nq(e){let{disabled:t}=e;const{active:n,activatorEvent:a,draggableNodes:i}=g.useContext(rp),l=Wb(a),u=Wb(n?.id);return g.useEffect(()=>{if(!t&&!a&&l&&u!=null){if(!pw(l)||document.activeElement===l.target)return;const d=i.get(u);if(!d)return;const{activatorNode:h,node:p}=d;if(!h.current&&!p.current)return;requestAnimationFrame(()=>{for(const v of[h.current,p.current]){if(!v)continue;const m=vU(v);if(m){m.focus();break}}})}},[a,t,i,u,l]),null}function _q(e,t){let{transform:n,...a}=t;return e!=null&&e.length?e.reduce((i,l)=>l({transform:i,...a}),n):n}function Eq(e){return g.useMemo(()=>({draggable:{...rh.draggable,...e?.draggable},droppable:{...rh.droppable,...e?.droppable},dragOverlay:{...rh.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Tq(e){let{activeNode:t,measure:n,initialRect:a,config:i=!0}=e;const l=g.useRef(!1),{x:u,y:d}=typeof i=="boolean"?{x:i,y:i}:i;Fa(()=>{if(!u&&!d||!t){l.current=!1;return}if(l.current||!a)return;const p=t?.node.current;if(!p||p.isConnected===!1)return;const v=n(p),m=dD(v,a);if(u||(m.x=0),d||(m.y=0),l.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){const b=fD(p);b&&b.scrollBy({top:m.y,left:m.x})}},[t,u,d,a,n])}const SD=g.createContext({...xa,scaleX:1,scaleY:1});var di;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(di||(di={}));const Rq=g.memo(function(t){var n,a,i,l;let{id:u,accessibility:d,autoScroll:h=!0,children:p,sensors:v=yq,collisionDetection:m=MU,measuring:b,modifiers:w,...C}=t;const S=g.useReducer(jq,void 0,Cq),[j,N]=S,[_,T]=CU(),[A,D]=g.useState(di.Uninitialized),L=A===di.Initialized,{draggable:{active:k,nodes:P,translate:U},droppable:{containers:J}}=j,$=k!=null?P.get(k):null,W=g.useRef({initial:null,translated:null}),pe=g.useMemo(()=>{var dt;return k!=null?{id:k,data:(dt=$?.data)!=null?dt:bq,rect:W}:null},[k,$]),Se=g.useRef(null),[Ce,I]=g.useState(null),[q,H]=g.useState(null),be=Ou(C,Object.values(C)),Ne=ed("DndDescribedBy",u),B=g.useMemo(()=>J.getEnabled(),[J]),G=Eq(b),{droppableRects:X,measureDroppableContainers:oe,measuringScheduled:xe}=oq(B,{dragging:L,dependencies:[U.x,U.y],config:G.droppable}),Q=sq(P,k),te=g.useMemo(()=>q?Xb(q):null,[q]),he=Qe(),_e=lq(Q,G.draggable.measure);Tq({activeNode:k!=null?P.get(k):null,config:he.layoutShiftCompensation,initialRect:_e,measure:G.draggable.measure});const je=K_(Q,G.draggable.measure,_e),Me=K_(Q?Q.parentElement:null),ce=g.useRef({activatorEvent:null,active:null,activeNode:Q,collisionRect:null,collisions:null,droppableRects:X,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:J,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),He=J.getNodeFor((n=ce.current.over)==null?void 0:n.id),Le=xq({measure:G.dragOverlay.measure}),Ue=(a=Le.nodeRef.current)!=null?a:Q,wt=L?(i=Le.rect)!=null?i:je:null,$e=!!(Le.nodeRef.current&&Le.rect),Ot=dq($e?null:je),St=bD(Ue?vr(Ue):null),Et=fq(L?He??Q:null),jt=gq(Et),ot=_q(w,{transform:{x:U.x-Ot.x,y:U.y-Ot.y,scaleX:1,scaleY:1},activatorEvent:q,active:pe,activeNodeRect:je,containerNodeRect:Me,draggingNodeRect:wt,over:ce.current.over,overlayNodeRect:Le.rect,scrollableAncestors:Et,scrollableAncestorRects:jt,windowRect:St}),at=te?Cl(te,U):null,vt=hq(Et),Kt=W_(vt),Yt=W_(vt,[je]),Wt=Cl(ot,Kt),ne=wt?kU(wt,ot):null,Re=pe&&ne?m({active:pe,collisionRect:ne,droppableRects:X,droppableContainers:B,pointerCoordinates:at}):null,st=uD(Re,"id"),[et,xt]=g.useState(null),mt=$e?ot:Cl(ot,Yt),gt=DU(mt,(l=et?.rect)!=null?l:null,je),qt=g.useRef(null),ue=g.useCallback((dt,ht)=>{let{sensor:z,options:O}=ht;if(Se.current==null)return;const de=P.get(Se.current);if(!de)return;const me=dt.nativeEvent,Ge=new z({active:Se.current,activeNode:de,event:me,options:O,context:ce,onAbort(tt){if(!P.get(tt))return;const{onDragAbort:Y}=be.current,we={id:tt};Y?.(we),_({type:"onDragAbort",event:we})},onPending(tt,It,Y,we){if(!P.get(tt))return;const{onDragPending:ke}=be.current,ze={id:tt,constraint:It,initialCoordinates:Y,offset:we};ke?.(ze),_({type:"onDragPending",event:ze})},onStart(tt){const It=Se.current;if(It==null)return;const Y=P.get(It);if(!Y)return;const{onDragStart:we}=be.current,Pe={activatorEvent:me,active:{id:It,data:Y.data,rect:W}};ka.unstable_batchedUpdates(()=>{we?.(Pe),D(di.Initializing),N({type:Mn.DragStart,initialCoordinates:tt,active:It}),_({type:"onDragStart",event:Pe}),I(qt.current),H(me)})},onMove(tt){N({type:Mn.DragMove,coordinates:tt})},onEnd:Ie(Mn.DragEnd),onCancel:Ie(Mn.DragCancel)});qt.current=Ge;function Ie(tt){return async function(){const{active:Y,collisions:we,over:Pe,scrollAdjustedTranslate:ke}=ce.current;let ze=null;if(Y&&ke){const{cancelDrop:ct}=be.current;ze={activatorEvent:me,active:Y,collisions:we,delta:ke,over:Pe},tt===Mn.DragEnd&&typeof ct=="function"&&await Promise.resolve(ct(ze))&&(tt=Mn.DragCancel)}Se.current=null,ka.unstable_batchedUpdates(()=>{N({type:tt}),D(di.Uninitialized),xt(null),I(null),H(null),qt.current=null;const ct=tt===Mn.DragEnd?"onDragEnd":"onDragCancel";if(ze){const Nt=be.current[ct];Nt?.(ze),_({type:ct,event:ze})}})}}},[P]),Te=g.useCallback((dt,ht)=>(z,O)=>{const de=z.nativeEvent,me=P.get(O);if(Se.current!==null||!me||de.dndKit||de.defaultPrevented)return;const Ge={active:me};dt(z,ht.options,Ge)===!0&&(de.dndKit={capturedBy:ht.sensor},Se.current=O,ue(z,ht))},[P,ue]),De=iq(v,Te);pq(v),Fa(()=>{je&&A===di.Initializing&&D(di.Initialized)},[je,A]),g.useEffect(()=>{const{onDragMove:dt}=be.current,{active:ht,activatorEvent:z,collisions:O,over:de}=ce.current;if(!ht||!z)return;const me={active:ht,activatorEvent:z,collisions:O,delta:{x:Wt.x,y:Wt.y},over:de};ka.unstable_batchedUpdates(()=>{dt?.(me),_({type:"onDragMove",event:me})})},[Wt.x,Wt.y]),g.useEffect(()=>{const{active:dt,activatorEvent:ht,collisions:z,droppableContainers:O,scrollAdjustedTranslate:de}=ce.current;if(!dt||Se.current==null||!ht||!de)return;const{onDragOver:me}=be.current,Ge=O.get(st),Ie=Ge&&Ge.rect.current?{id:Ge.id,rect:Ge.rect.current,data:Ge.data,disabled:Ge.disabled}:null,tt={active:dt,activatorEvent:ht,collisions:z,delta:{x:de.x,y:de.y},over:Ie};ka.unstable_batchedUpdates(()=>{xt(Ie),me?.(tt),_({type:"onDragOver",event:tt})})},[st]),Fa(()=>{ce.current={activatorEvent:q,active:pe,activeNode:Q,collisionRect:ne,collisions:Re,droppableRects:X,draggableNodes:P,draggingNode:Ue,draggingNodeRect:wt,droppableContainers:J,over:et,scrollableAncestors:Et,scrollAdjustedTranslate:Wt},W.current={initial:wt,translated:ne}},[pe,Q,Re,ne,P,Ue,wt,X,J,et,Et,Wt]),nq({...he,delta:U,draggingRect:ne,pointerCoordinates:at,scrollableAncestors:Et,scrollableAncestorRects:jt});const Xe=g.useMemo(()=>({active:pe,activeNode:Q,activeNodeRect:je,activatorEvent:q,collisions:Re,containerNodeRect:Me,dragOverlay:Le,draggableNodes:P,droppableContainers:J,droppableRects:X,over:et,measureDroppableContainers:oe,scrollableAncestors:Et,scrollableAncestorRects:jt,measuringConfiguration:G,measuringScheduled:xe,windowRect:St}),[pe,Q,je,q,Re,Me,Le,P,J,X,et,oe,Et,jt,G,xe,St]),Oe=g.useMemo(()=>({activatorEvent:q,activators:De,active:pe,activeNodeRect:je,ariaDescribedById:{draggable:Ne},dispatch:N,draggableNodes:P,over:et,measureDroppableContainers:oe}),[q,De,pe,je,N,Ne,P,et,oe]);return R.createElement(oD.Provider,{value:T},R.createElement(rp.Provider,{value:Oe},R.createElement(wD.Provider,{value:Xe},R.createElement(SD.Provider,{value:gt},p)),R.createElement(Nq,{disabled:d?.restoreFocus===!1})),R.createElement(_U,{...d,hiddenTextDescribedById:Ne}));function Qe(){const dt=Ce?.autoScrollEnabled===!1,ht=typeof h=="object"?h.enabled===!1:h===!1,z=L&&!dt&&!ht;return typeof h=="object"?{...h,enabled:z}:{enabled:z}}}),Aq=g.createContext(null),Q_="button",Oq="Draggable";function Mq(e){let{id:t,data:n,disabled:a=!1,attributes:i}=e;const l=ed(Oq),{activators:u,activatorEvent:d,active:h,activeNodeRect:p,ariaDescribedById:v,draggableNodes:m,over:b}=g.useContext(rp),{role:w=Q_,roleDescription:C="draggable",tabIndex:S=0}=i??{},j=h?.id===t,N=g.useContext(j?SD:Aq),[_,T]=gh(),[A,D]=gh(),L=mq(u,t),k=Ou(n);Fa(()=>(m.set(t,{id:t,key:l,node:_,activatorNode:A,data:k}),()=>{const U=m.get(t);U&&U.key===l&&m.delete(t)}),[m,t]);const P=g.useMemo(()=>({role:w,tabIndex:S,"aria-disabled":a,"aria-pressed":j&&w===Q_?!0:void 0,"aria-roledescription":C,"aria-describedby":v.draggable}),[a,w,S,j,C,v.draggable]);return{active:h,activatorEvent:d,activeNodeRect:p,attributes:P,isDragging:j,listeners:a?void 0:L,node:_,over:b,setNodeRef:T,setActivatorNodeRef:D,transform:N}}function Dq(){return g.useContext(wD)}const Pq="Droppable",kq={timeout:25};function Lq(e){let{data:t,disabled:n=!1,id:a,resizeObserverConfig:i}=e;const l=ed(Pq),{active:u,dispatch:d,over:h,measureDroppableContainers:p}=g.useContext(rp),v=g.useRef({disabled:n}),m=g.useRef(!1),b=g.useRef(null),w=g.useRef(null),{disabled:C,updateMeasurementsFor:S,timeout:j}={...kq,...i},N=Ou(S??a),_=g.useCallback(()=>{if(!m.current){m.current=!0;return}w.current!=null&&clearTimeout(w.current),w.current=setTimeout(()=>{p(Array.isArray(N.current)?N.current:[N.current]),w.current=null},j)},[j]),T=np({callback:_,disabled:C||!u}),A=g.useCallback((P,U)=>{T&&(U&&(T.unobserve(U),m.current=!1),P&&T.observe(P))},[T]),[D,L]=gh(A),k=Ou(t);return g.useEffect(()=>{!T||!D.current||(T.disconnect(),m.current=!1,T.observe(D.current))},[D,T]),g.useEffect(()=>(d({type:Mn.RegisterDroppable,element:{id:a,key:l,disabled:n,node:D,rect:b,data:k}}),()=>d({type:Mn.UnregisterDroppable,key:l,id:a})),[a]),g.useEffect(()=>{n!==v.current.disabled&&(d({type:Mn.SetDroppableDisabled,id:a,key:l,disabled:n}),v.current.disabled=n)},[a,l,n,d]),{active:u,rect:b,isOver:h?.id===a,node:D,over:h,setNodeRef:L}}function CD(e,t,n){const a=e.slice();return a.splice(n<0?a.length+n:n,0,a.splice(t,1)[0]),a}function Bq(e,t){return e.reduce((n,a,i)=>{const l=t.get(a);return l&&(n[i]=l),n},Array(e.length))}function Hf(e){return e!==null&&e>=0}function Iq(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function zq(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const jD=e=>{let{rects:t,activeIndex:n,overIndex:a,index:i}=e;const l=CD(t,a,n),u=t[i],d=l[i];return!d||!u?null:{x:d.left-u.left,y:d.top-u.top,scaleX:d.width/u.width,scaleY:d.height/u.height}},Uf={scaleX:1,scaleY:1},Fq=e=>{var t;let{activeIndex:n,activeNodeRect:a,index:i,rects:l,overIndex:u}=e;const d=(t=l[n])!=null?t:a;if(!d)return null;if(i===n){const p=l[u];return p?{x:0,y:n<u?p.top+p.height-(d.top+d.height):p.top-d.top,...Uf}:null}const h=Hq(l,i,n);return i>n&&i<=u?{x:0,y:-d.height-h,...Uf}:i<n&&i>=u?{x:0,y:d.height+h,...Uf}:{x:0,y:0,...Uf}};function Hq(e,t,n){const a=e[t],i=e[t-1],l=e[t+1];return a?n<t?i?a.top-(i.top+i.height):l?l.top-(a.top+a.height):0:l?l.top-(a.top+a.height):i?a.top-(i.top+i.height):0:0}const ND="Sortable",_D=R.createContext({activeIndex:-1,containerId:ND,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:jD,disabled:{draggable:!1,droppable:!1}});function Uq(e){let{children:t,id:n,items:a,strategy:i=jD,disabled:l=!1}=e;const{active:u,dragOverlay:d,droppableRects:h,over:p,measureDroppableContainers:v}=Dq(),m=ed(ND,n),b=d.rect!==null,w=g.useMemo(()=>a.map(L=>typeof L=="object"&&"id"in L?L.id:L),[a]),C=u!=null,S=u?w.indexOf(u.id):-1,j=p?w.indexOf(p.id):-1,N=g.useRef(w),_=!Iq(w,N.current),T=j!==-1&&S===-1||_,A=zq(l);Fa(()=>{_&&C&&v(w)},[_,w,C,v]),g.useEffect(()=>{N.current=w},[w]);const D=g.useMemo(()=>({activeIndex:S,containerId:m,disabled:A,disableTransforms:T,items:w,overIndex:j,useDragOverlay:b,sortedRects:Bq(w,h),strategy:i}),[S,m,A.draggable,A.droppable,T,w,j,h,b,i]);return R.createElement(_D.Provider,{value:D},t)}const qq=e=>{let{id:t,items:n,activeIndex:a,overIndex:i}=e;return CD(n,a,i).indexOf(t)},Vq=e=>{let{containerId:t,isSorting:n,wasDragging:a,index:i,items:l,newIndex:u,previousItems:d,previousContainerId:h,transition:p}=e;return!p||!a||d!==l&&i===u?!1:n?!0:u!==i&&t===h},$q={duration:200,easing:"ease"},ED="transform",Gq=Du.Transition.toString({property:ED,duration:0,easing:"linear"}),Kq={roleDescription:"sortable"};function Yq(e){let{disabled:t,index:n,node:a,rect:i}=e;const[l,u]=g.useState(null),d=g.useRef(n);return Fa(()=>{if(!t&&n!==d.current&&a.current){const h=i.current;if(h){const p=Fl(a.current,{ignoreTransform:!0}),v={x:h.left-p.left,y:h.top-p.top,scaleX:h.width/p.width,scaleY:h.height/p.height};(v.x||v.y)&&u(v)}}n!==d.current&&(d.current=n)},[t,n,a,i]),g.useEffect(()=>{l&&u(null)},[l]),l}function Wq(e){let{animateLayoutChanges:t=Vq,attributes:n,disabled:a,data:i,getNewIndex:l=qq,id:u,strategy:d,resizeObserverConfig:h,transition:p=$q}=e;const{items:v,containerId:m,activeIndex:b,disabled:w,disableTransforms:C,sortedRects:S,overIndex:j,useDragOverlay:N,strategy:_}=g.useContext(_D),T=Xq(a,w),A=v.indexOf(u),D=g.useMemo(()=>({sortable:{containerId:m,index:A,items:v},...i}),[m,i,A,v]),L=g.useMemo(()=>v.slice(v.indexOf(u)),[v,u]),{rect:k,node:P,isOver:U,setNodeRef:J}=Lq({id:u,data:D,disabled:T.droppable,resizeObserverConfig:{updateMeasurementsFor:L,...h}}),{active:$,activatorEvent:W,activeNodeRect:pe,attributes:Se,setNodeRef:Ce,listeners:I,isDragging:q,over:H,setActivatorNodeRef:be,transform:Ne}=Mq({id:u,data:D,attributes:{...Kq,...n},disabled:T.draggable}),B=hU(J,Ce),G=!!$,X=G&&!C&&Hf(b)&&Hf(j),oe=!N&&q,xe=oe&&X?Ne:null,te=X?xe??(d??_)({rects:S,activeNodeRect:pe,activeIndex:b,overIndex:j,index:A}):null,he=Hf(b)&&Hf(j)?l({id:u,items:v,activeIndex:b,overIndex:j}):A,_e=$?.id,je=g.useRef({activeId:_e,items:v,newIndex:he,containerId:m}),Me=v!==je.current.items,ce=t({active:$,containerId:m,isDragging:q,isSorting:G,id:u,index:A,items:v,newIndex:je.current.newIndex,previousItems:je.current.items,previousContainerId:je.current.containerId,transition:p,wasDragging:je.current.activeId!=null}),He=Yq({disabled:!ce,index:A,node:P,rect:k});return g.useEffect(()=>{G&&je.current.newIndex!==he&&(je.current.newIndex=he),m!==je.current.containerId&&(je.current.containerId=m),v!==je.current.items&&(je.current.items=v)},[G,he,m,v]),g.useEffect(()=>{if(_e===je.current.activeId)return;if(_e!=null&&je.current.activeId==null){je.current.activeId=_e;return}const Ue=setTimeout(()=>{je.current.activeId=_e},50);return()=>clearTimeout(Ue)},[_e]),{active:$,activeIndex:b,attributes:Se,data:D,rect:k,index:A,newIndex:he,items:v,isOver:U,isSorting:G,isDragging:q,listeners:I,node:P,overIndex:j,over:H,setNodeRef:B,setActivatorNodeRef:be,setDroppableNodeRef:J,setDraggableNodeRef:Ce,transform:He??te,transition:Le()};function Le(){if(He||Me&&je.current.newIndex===A)return Gq;if(!(oe&&!pw(W)||!p)&&(G||ce))return Du.Transition.toString({...p,property:ED})}}function Xq(e,t){var n,a;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(a=e?.droppable)!=null?a:t.droppable}}function yh(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const Qq=[Ht.Down,Ht.Right,Ht.Up,Ht.Left],Zq=(e,t)=>{let{context:{active:n,collisionRect:a,droppableRects:i,droppableContainers:l,over:u,scrollableAncestors:d}}=t;if(Qq.includes(e.code)){if(e.preventDefault(),!n||!a)return;const h=[];l.getEnabled().forEach(m=>{if(!m||m!=null&&m.disabled)return;const b=i.get(m.id);if(b)switch(e.code){case Ht.Down:a.top<b.top&&h.push(m);break;case Ht.Up:a.top>b.top&&h.push(m);break;case Ht.Left:a.left>b.left&&h.push(m);break;case Ht.Right:a.left<b.left&&h.push(m);break}});const p=AU({collisionRect:a,droppableRects:i,droppableContainers:h});let v=uD(p,"id");if(v===u?.id&&p.length>1&&(v=p[1].id),v!=null){const m=l.get(n.id),b=l.get(v),w=b?i.get(b.id):null,C=b?.node.current;if(C&&w&&m&&b){const j=tp(C).some((L,k)=>d[k]!==L),N=TD(m,b),_=Jq(m,b),T=j||!N?{x:0,y:0}:{x:_?a.width-w.width:0,y:_?a.height-w.height:0},A={x:w.left,y:w.top};return T.x&&T.y?A:Mu(A,T)}}}};function TD(e,t){return!yh(e)||!yh(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Jq(e,t){return!yh(e)||!yh(t)||!TD(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function ms(e){if(!e||e<0)return"--:--";const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${n.toString().padStart(2,"0")}`}function el(e){return e?e.split("/").pop()?.replace(".thr","")||e:"Unknown"}function eV({id:e,file:t,index:n,previewUrl:a,isFirst:i,isLast:l,onMoveToTop:u,onMoveToBottom:d,requestPreview:h}){const{attributes:p,listeners:v,setNodeRef:m,transform:b,transition:w,isDragging:C}=Wq({id:e}),S=g.useRef(null),j=g.useRef(!1);g.useEffect(()=>{if(!S.current||a||j.current)return;const _=new IntersectionObserver(T=>{T.forEach(A=>{A.isIntersecting&&!j.current&&(j.current=!0,h(t),_.disconnect())})},{rootMargin:"50px"});return _.observe(S.current),()=>_.disconnect()},[t,a,h]);const N={transform:Du.Transform.toString(b),transition:w,opacity:C?.5:1,zIndex:C?1e3:"auto"};return o.jsxs("div",{ref:m,style:N,className:`group flex items-center gap-2 p-2 rounded-lg transition-colors hover:bg-muted/50 ${C?"shadow-lg bg-background":""}`,children:[o.jsx("div",{...p,...v,className:"w-6 flex items-center justify-center shrink-0 cursor-grab active:cursor-grabbing touch-none",children:o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-sm",children:"drag_indicator"})}),o.jsx("div",{ref:S,className:"w-28 h-28 rounded-full overflow-hidden bg-muted border shrink-0",children:a?o.jsx("img",{src:a,alt:"",loading:"lazy",className:"w-full h-full object-cover pattern-preview"}):o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-4xl",children:"image"})})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm truncate",children:el(t)}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["#",n+1]})]}),o.jsxs("div",{className:"flex flex-col gap-1 opacity-100 md:opacity-0 md:group-hover:opacity-100 transition-opacity shrink-0",children:[o.jsx("button",{onClick:u,disabled:i,className:"p-1 rounded hover:bg-muted disabled:opacity-30 disabled:cursor-not-allowed",title:"Move to top",children:o.jsx("span",{className:"material-icons-outlined text-sm",children:"vertical_align_top"})}),o.jsx("button",{onClick:d,disabled:l,className:"p-1 rounded hover:bg-muted disabled:opacity-30 disabled:cursor-not-allowed",title:"Move to bottom",children:o.jsx("span",{className:"material-icons-outlined text-sm",children:"vertical_align_bottom"})})]})]})}function tV({isLogsOpen:e=!1,logsDrawerHeight:t=256,isVisible:n,openExpanded:a=!1,onClose:i}){const l=un(ue=>ue.status),[u,d]=g.useState(null),[h,p]=g.useState(!1),v=g.useRef(null),m=g.useRef(null),b=ue=>{v.current=ue.touches[0].clientY},w=ue=>{if(v.current===null)return;const De=ue.changedTouches[0].clientY-v.current;De>50?h?p(!1):i():De<-50&&C&&p(!0),v.current=null};g.useEffect(()=>{if(n)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[n]),g.useEffect(()=>{const ue=m.current;if(!ue)return;const Te=De=>{De.target.closest("[data-scrollable]")||De.preventDefault()};return ue.addEventListener("touchmove",Te,{passive:!1}),()=>{ue.removeEventListener("touchmove",Te)}},[]),g.useEffect(()=>{a&&n&&p(!0)},[a,n]),g.useEffect(()=>{const ue=()=>{p(!0)};return window.addEventListener("playback-started",ue),()=>window.removeEventListener("playback-started",ue)},[]);const C=l?.is_running||l?.is_paused||(l?.pause_time_remaining??0)>0,S=g.useRef(null);g.useEffect(()=>(S.current&&(clearTimeout(S.current),S.current=null),!C&&h&&(S.current=setTimeout(()=>{p(!1)},500)),()=>{S.current&&clearTimeout(S.current)}),[C,h]);const[j,N]=g.useState([]),_=g.useRef(null),T=g.useRef(null),A=g.useRef(-1),D=g.useRef(null),L=g.useRef(null),k=g.useRef(null),P=g.useRef(0),U=g.useRef(0),J=g.useRef(0),[$,W]=g.useState(null),pe=g.useRef("");g.useEffect(()=>{if(!n)return;const ue=l?.current_file,Te=l?.playlist?.next_file,De=[ue,Te].filter(Boolean),Xe=De.join("|");Xe!==pe.current&&(pe.current=Xe,De.length>0?fe.post("/preview_thr_batch",{file_names:De}).then(Oe=>{ue&&Oe[ue]?.image_data?d(Oe[ue].image_data):d(null),Te&&Oe[Te]?.image_data?W(Oe[Te].image_data):W(null)}).catch(()=>{d(null),W(null)}):(d(null),W(null)))},[n,l?.current_file,l?.playlist?.next_file]);const Se=g.useCallback((ue,Te,De)=>{const Xe=De/2,Oe=De/2,Qe=De/2*.9*Te,dt=Xe+Qe*Math.cos(ue),ht=Oe+Qe*Math.sin(ue);return{x:dt,y:ht}},[]),Ce=g.useCallback(()=>{const ue=document.documentElement.classList.contains("dark");return{isDark:ue,bgOuter:ue?"#1a1a1a":"#f5f5f5",bgInner:ue?"#262626":"#ffffff",borderColor:ue?"rgba(255, 255, 255, 0.2)":"rgba(128, 128, 128, 0.3)",lineColor:ue?"#e5e5e5":"#333333",markerBorder:ue?"#333333":"#ffffff"}},[]),I=g.useCallback((ue,Te)=>{const De=Ce();T.current||(T.current=document.createElement("canvas"));const Xe=T.current;Xe.width=ue,Xe.height=ue;const Oe=Xe.getContext("2d");if(Oe){if(Oe.fillStyle=De.bgOuter,Oe.fillRect(0,0,ue,ue),Oe.beginPath(),Oe.arc(ue/2,ue/2,ue/2*.95,0,Math.PI*2),Oe.fillStyle=De.bgInner,Oe.fill(),Oe.strokeStyle=De.borderColor,Oe.lineWidth=1,Oe.stroke(),Oe.strokeStyle=De.lineColor,Oe.lineWidth=1.5,Oe.lineCap="round",Oe.lineJoin="round",Te.length>0){const Qe=Se(Te[0][0],Te[0][1],ue);Oe.beginPath(),Oe.moveTo(Qe.x,Qe.y),Oe.stroke()}A.current=0,L.current=De.isDark}},[Ce,Se]),q=g.useCallback((ue,Te,De,Xe=!1)=>{const Qe=ue.canvas.width,dt=Ce(),ht=Math.max(0,De-16),z=Math.floor(ht);(Xe||!T.current||L.current!==dt.isDark||z<A.current)&&I(Qe,Te);const de=T.current;if(!de)return;const me=de.getContext("2d");if(me){if(Te.length>0&&z>A.current){me.strokeStyle=dt.lineColor,me.lineWidth=1.5,me.lineCap="round",me.lineJoin="round",me.beginPath();const Ge=Se(Te[A.current][0],Te[A.current][1],Qe);me.moveTo(Ge.x,Ge.y);for(let Ie=A.current+1;Ie<=z&&Ie<Te.length;Ie++){const tt=Se(Te[Ie][0],Te[Ie][1],Qe);me.lineTo(tt.x,tt.y)}me.stroke(),A.current=z}if(ue.drawImage(de,0,0),Te.length>0&&z<Te.length-1){const Ge=ht-z,Ie=Te[z],tt=Te[Math.min(z+1,Te.length-1)],It=Ie[0]+(tt[0]-Ie[0])*Ge,Y=Ie[1]+(tt[1]-Ie[1])*Ge,we=Se(It,Y,Qe);ue.beginPath(),ue.arc(we.x,we.y,8,0,Math.PI*2),ue.fillStyle="#0b80ee",ue.fill(),ue.strokeStyle=dt.markerBorder,ue.lineWidth=2,ue.stroke()}else if(Te.length>0&&z<Te.length){const Ge=Se(Te[z][0],Te[z][1],Qe);ue.beginPath(),ue.arc(Ge.x,Ge.y,8,0,Math.PI*2),ue.fillStyle="#0b80ee",ue.fill(),ue.strokeStyle=dt.markerBorder,ue.lineWidth=2,ue.stroke()}}},[Ce,I,Se]);g.useEffect(()=>{const ue=l?.current_file;!ue||!(ue!==D.current||j.length===0)||(D.current=ue,A.current=-1,fe.post("/get_theta_rho_coordinates",{file_name:ue}).then(De=>{De.coordinates&&Array.isArray(De.coordinates)&&N(De.coordinates)}).catch(De=>{console.error("Failed to fetch coordinates:",De),N([])}))},[l?.current_file,j.length]);const H=g.useCallback(ue=>ue.length===0?0:(l?.progress?.percentage||0)/100*ue.length,[l?.progress?.percentage]);g.useEffect(()=>{const ue=l?.progress?.percentage||0;ue!==P.current&&(P.current=ue,U.current=performance.now())},[l?.progress?.percentage]),g.useEffect(()=>{if(!h||j.length===0)return;const ue=l?.is_paused||!1,Te=4.2,De=()=>{if(!_.current)return;const Oe=_.current.getContext("2d");if(!Oe)return;const Qe=H(j),ht=(performance.now()-U.current)/1e3;let z;ue?z=Qe:(z=P.current/100*j.length+ht*Te,z=Math.min(z,Qe+2)),J.current=z,q(Oe,j,z),k.current=requestAnimationFrame(De)},Xe=setTimeout(()=>{if(!_.current)return;const Oe=_.current.getContext("2d");Oe&&(A.current=-1,T.current=null,J.current=H(j),U.current=performance.now(),q(Oe,j,J.current,!0),k.current=requestAnimationFrame(De))},50);return()=>{clearTimeout(Xe),k.current&&cancelAnimationFrame(k.current)}},[h,j,l?.is_paused,q,H]);const be=async()=>{try{const ue=l?.is_paused?"/resume_execution":"/pause_execution";await fe.post(ue),K.success(l?.is_paused?"Resumed":"Paused")}catch(ue){let Te="Failed to toggle pause";if(ue instanceof Error)try{const De=ue.message.match(/\{.*\}/);if(De){const Xe=JSON.parse(De[0]);Xe.detail&&(Te=Xe.detail)}}catch{}K.error(Te)}},Ne=async()=>{try{await fe.post("/stop_execution"),K.success("Stopped")}catch{try{await fe.post("/force_stop"),K.success("Force stopped")}catch{K.error("Failed to stop")}}},B=async()=>{try{await fe.post("/skip_pattern"),K.success("Skipping to next pattern")}catch{K.error("Failed to skip")}},[G,X]=g.useState(""),[oe,xe]=g.useState(!1),[Q,te]=g.useState({}),he=g.useRef(null),_e=g.useRef(null),je=ue=>{he.current=ue.touches[0].clientY},Me=ue=>{if(he.current===null)return;if(ue.changedTouches[0].clientY-he.current>80){const Xe=_e.current?.querySelector("[data-scrollable]");(!Xe||Xe.scrollTop<=0)&&xe(!1)}he.current=null},[ce,He]=g.useState(null),Le=g.useRef(null);g.useEffect(()=>{if(ce&&l?.playlist?.files){Le.current&&clearTimeout(Le.current);const ue=l.playlist.files.join(","),Te=ce.join(",");ue===Te?He(null):Le.current=setTimeout(()=>{He(null)},2e3)}return()=>{Le.current&&clearTimeout(Le.current)}},[l?.playlist?.files,ce]);const Ue=ce||l?.playlist?.files||[],wt=EU(z_(xw,{activationConstraint:{distance:8}}),z_(gw,{coordinateGetter:Zq})),$e=async()=>{const ue=parseInt(G);if(isNaN(ue)||ue<10||ue>6e3){K.error("Speed must be between 10 and 6000 mm/s");return}try{await fe.post("/set_speed",{speed:ue}),X(""),K.success(`Speed set to ${ue} mm/s`)}catch{K.error("Failed to set speed")}},Ot=g.useRef(new Set),St=g.useRef(new Set),Et=g.useRef(null),jt=g.useCallback(ue=>{Q[ue]||Ot.current.has(ue)||St.current.has(ue)||(St.current.add(ue),Et.current&&clearTimeout(Et.current),Et.current=setTimeout(async()=>{const Te=Array.from(St.current);if(St.current.clear(),Te.length!==0){Te.forEach(De=>Ot.current.add(De));try{const De=await fe.post("/preview_thr_batch",{file_names:Te}),Xe={};for(const[Oe,Qe]of Object.entries(De))Qe.image_data&&(Xe[Oe]=Qe.image_data);Object.keys(Xe).length>0&&te(Oe=>({...Oe,...Xe}))}catch(De){console.error("Failed to fetch queue previews:",De)}}},100))},[Q]),ot=(ue,Te,De)=>{const Xe=[...ue],[Oe]=Xe.splice(Te,1);return Xe.splice(De,0,Oe),Xe},at=async ue=>{const{active:Te,over:De}=ue;if(!De||Te.id===De.id||!l?.playlist?.files)return;const Xe=parseInt(Te.id.toString().replace("queue-item-","")),Oe=parseInt(De.id.toString().replace("queue-item-",""));if(isNaN(Xe)||isNaN(Oe))return;const Qe=l.playlist.current_index;if(Xe<Qe){K.error("Can't move completed pattern");return}if(Oe<Qe){K.error("Can't move to completed position");return}const dt=ce||l.playlist.files,ht=ot(dt,Xe,Oe);He(ht);try{await fe.post("/reorder_playlist",{from_index:Xe,to_index:Oe})}catch{He(null),K.error("Failed to reorder")}},vt=async(ue,Te)=>{if(ue===Te||!l?.playlist?.files)return;const De=ce||l.playlist.files,Xe=ot(De,ue,Te);He(Xe);try{await fe.post("/reorder_playlist",{from_index:ue,to_index:Te})}catch{He(null),K.error("Failed to reorder")}};if(!n)return null;const Kt=el(l?.current_file??null),Yt=l?.progress?.percentage||0,Wt=l?.progress?.remaining_time||0,ne=l?.progress?.elapsed_time||0,Re=l?.progress?.last_completed_time?.actual_time_seconds,st=Re?Math.max(0,Re-ne):Wt,et=!!Re,xt=(l?.pause_time_remaining??0)>0,mt=l?.pause_time_remaining??0,gt=l?.original_pause_time??0,qt=gt>0?(gt-mt)/gt*100:0;return o.jsxs(o.Fragment,{children:[h&&o.jsx("div",{className:"fixed inset-0 bg-black/30 z-30",onClick:()=>p(!1)}),o.jsx("div",{ref:m,className:"fixed left-0 right-0 z-40 bg-background border-t shadow-lg transition-all duration-300",style:{bottom:e?`calc(${t}px + 4rem + env(safe-area-inset-bottom, 0px))`:"calc(4rem + env(safe-area-inset-bottom, 0px))"},"data-now-playing-bar":h?"expanded":"collapsed",onTouchStart:b,onTouchEnd:w,children:o.jsxs("div",{className:"h-full max-w-5xl mx-auto relative",children:[o.jsx("div",{className:"md:hidden flex justify-center pt-2 pb-1",children:o.jsx("div",{className:"w-10 h-1 bg-muted-foreground/30 rounded-full"})}),o.jsxs("div",{className:`absolute right-3 sm:right-4 flex items-center gap-1 z-10 ${h?"top-3 mt-safe":"top-3"}`,children:[C&&l?.playlist&&o.jsx(se,{variant:"ghost",size:"icon",className:"md:hidden h-8 w-8",onClick:()=>xe(!0),title:"View queue",children:o.jsx("span",{className:"material-icons-outlined text-lg",children:"queue_music"})}),C&&o.jsx(se,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>p(!h),title:h?"Collapse":"Expand",children:o.jsx("span",{className:"material-icons-outlined text-lg",children:h?"expand_more":"expand_less"})}),o.jsx(se,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:i,title:"Close",children:o.jsx("span",{className:"material-icons-outlined text-lg",children:"close"})})]}),o.jsxs("div",{className:"h-full flex flex-col",children:[!h&&o.jsxs("div",{className:"flex-1 flex flex-col",children:[o.jsxs("div",{className:"flex-1 flex items-center gap-6 px-6 py-4",children:[o.jsx("div",{className:"w-48 h-48 rounded-full overflow-hidden bg-muted shrink-0 border-2 cursor-pointer hover:border-primary transition-colors",onClick:()=>C&&p(!0),title:C?"Click to expand":void 0,children:u&&C?o.jsx("img",{src:u,alt:Kt,className:"w-full h-full object-cover pattern-preview"}):o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-4xl",children:C?"image":"hourglass_empty"})})}),C&&l?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center gap-2 py-2",children:[o.jsx("div",{className:"flex items-center gap-3 pr-12 md:pr-16",children:o.jsx("div",{className:"flex-1 min-w-0",children:xt?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-sm md:text-base font-semibold text-muted-foreground",children:"Waiting for next pattern..."}),l.playlist?.next_file&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Up next: ",el(l.playlist.next_file)]})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-sm md:text-base font-semibold truncate",children:Kt}),l.playlist&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Pattern ",l.playlist.current_index+1," of ",l.playlist.total_files]})]})})}),xt?o.jsxs("div",{className:"hidden md:flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-lg",children:"hourglass_top"}),o.jsx(Yi,{value:qt,className:"h-2 flex-1"}),o.jsx("span",{className:"text-sm text-muted-foreground font-mono",children:ms(mt)})]}):o.jsxs("div",{className:"hidden md:flex items-center gap-3",children:[o.jsx("span",{className:"text-sm text-muted-foreground w-12 font-mono",children:ms(ne)}),o.jsx(Yi,{value:Yt,className:"h-2 flex-1"}),o.jsxs("span",{className:`text-sm text-muted-foreground text-right font-mono flex items-center justify-end gap-1.5 shrink-0 ${et?"w-24":"w-14"}`,title:et?"ETA based on last completed run":"Estimated time remaining",children:[et&&o.jsx("span",{className:"material-icons-outlined text-sm",children:"history"}),"-",ms(st)]})]}),o.jsxs("div",{className:"flex items-center justify-center gap-3",children:[o.jsx(se,{variant:"secondary",size:"icon",className:"h-10 w-10 rounded-full",onClick:Ne,title:"Stop",children:o.jsx("span",{className:"material-icons",children:"stop"})}),o.jsx(se,{variant:"default",size:"icon",className:"h-12 w-12 rounded-full",onClick:be,children:o.jsx("span",{className:"material-icons text-xl",children:l.is_paused?"play_arrow":"pause"})}),l.playlist&&o.jsx(se,{variant:"secondary",size:"icon",className:"h-10 w-10 rounded-full",onClick:B,title:"Skip to next",children:o.jsx("span",{className:"material-icons",children:"skip_next"})})]}),o.jsxs("div",{className:"flex items-center justify-center gap-2",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Speed:"}),o.jsx(bt,{type:"number",placeholder:String(l.speed),value:G,onChange:ue=>X(ue.target.value),onKeyDown:ue=>ue.key==="Enter"&&$e(),className:"h-7 w-20 text-sm px-2"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"mm/s"})]})]}),l.playlist?.next_file&&o.jsxs("div",{className:"hidden md:flex shrink-0 flex-col items-center gap-1 mr-16 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>xe(!0),title:"View queue",children:[o.jsxs("p",{className:"text-xs text-muted-foreground font-medium flex items-center gap-1",children:["Up Next",o.jsx("span",{className:"material-icons-outlined text-xs",children:"queue_music"})]}),o.jsx("div",{className:"w-24 h-24 rounded-full overflow-hidden bg-muted border-2",children:$?o.jsx("img",{src:$,alt:"Next pattern",className:"w-full h-full object-cover pattern-preview"}):o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-2xl",children:"image"})})}),o.jsx("p",{className:"text-xs text-muted-foreground text-center max-w-24 truncate",children:el(l.playlist.next_file)})]})]}):o.jsx("div",{className:"flex-1 flex items-center",children:o.jsx("p",{className:"text-lg text-muted-foreground",children:"Not playing"})})]}),C&&l&&(xt?o.jsxs("div",{className:"flex md:hidden items-center gap-3 px-6 pb-16",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-lg",children:"hourglass_top"}),o.jsx(Yi,{value:qt,className:"h-2 flex-1"}),o.jsx("span",{className:"text-sm text-muted-foreground font-mono",children:ms(mt)})]}):o.jsxs("div",{className:"flex md:hidden items-center gap-3 px-6 pb-16",children:[o.jsx("span",{className:"text-sm text-muted-foreground w-12 font-mono",children:ms(ne)}),o.jsx(Yi,{value:Yt,className:"h-2 flex-1"}),o.jsxs("span",{className:`text-sm text-muted-foreground text-right font-mono flex items-center justify-end gap-1.5 shrink-0 ${et?"w-24":"w-14"}`,children:[et&&o.jsx("span",{className:"material-icons-outlined text-sm",children:"history"}),"-",ms(st)]})]}))]}),h&&C&&o.jsx("div",{className:"flex-1 flex flex-col md:items-center md:justify-center px-4 py-4 md:py-8 pt-safe overflow-hidden",children:o.jsxs("div",{className:"w-full max-w-5xl mx-auto flex flex-col md:flex-row md:items-center gap-3 md:gap-6",children:[o.jsx("div",{className:"flex-1 flex items-center justify-center cursor-pointer",onClick:()=>p(!1),title:"Click to collapse",children:o.jsx("canvas",{ref:_,width:600,height:600,className:"rounded-full border-2 hover:border-primary transition-colors w-[40vh] h-[40vh] max-w-[300px] max-h-[300px] md:w-[42vh] md:h-[42vh] md:max-w-[500px] md:max-h-[500px]"})}),o.jsxs("div",{className:"md:w-80 shrink-0 flex flex-col justify-start md:justify-center gap-2 md:gap-4",children:[o.jsxs("div",{className:"flex items-center justify-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 md:w-12 md:h-12 rounded-full overflow-hidden bg-muted border shrink-0",children:u?o.jsx("img",{src:u,alt:Kt,className:"w-full h-full object-cover pattern-preview"}):o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-sm",children:"image"})})}),o.jsx("div",{className:"text-left min-w-0",children:xt?o.jsxs(o.Fragment,{children:[o.jsx("h2",{className:"text-lg md:text-xl font-semibold text-muted-foreground",children:"Waiting for next pattern..."}),l?.playlist?.next_file&&o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Up next: ",el(l.playlist.next_file)]})]}):o.jsxs(o.Fragment,{children:[o.jsx("h2",{className:"text-lg md:text-xl font-semibold truncate",children:Kt}),l?.playlist&&o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Pattern ",l.playlist.current_index+1," of ",l.playlist.total_files]})]})})]}),xt?o.jsxs("div",{className:"space-y-1 md:space-y-2",children:[o.jsx(Yi,{value:qt,className:"h-1.5 md:h-2"}),o.jsxs("div",{className:"flex justify-center items-center gap-2 text-xs md:text-sm text-muted-foreground font-mono",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"hourglass_top"}),o.jsxs("span",{children:[ms(mt)," remaining"]})]})]}):o.jsxs("div",{className:"space-y-1 md:space-y-2",children:[o.jsx(Yi,{value:Yt,className:"h-1.5 md:h-2"}),o.jsxs("div",{className:"flex justify-between text-xs md:text-sm text-muted-foreground font-mono",children:[o.jsx("span",{className:"w-16",children:ms(ne)}),o.jsxs("span",{children:[Yt.toFixed(0),"%"]}),o.jsxs("span",{className:"w-16 flex items-center justify-end gap-1",children:[et&&o.jsx("span",{className:"material-icons-outlined text-xs",children:"history"}),"-",ms(st)]})]})]}),o.jsxs("div",{className:"flex items-center justify-center gap-2 md:gap-3",children:[o.jsx(se,{variant:"secondary",size:"icon",className:"h-10 w-10 md:h-12 md:w-12 rounded-full",onClick:Ne,title:"Stop",children:o.jsx("span",{className:"material-icons text-lg md:text-2xl",children:"stop"})}),o.jsx(se,{variant:"default",size:"icon",className:"h-12 w-12 md:h-14 md:w-14 rounded-full",onClick:be,children:o.jsx("span",{className:"material-icons text-xl md:text-2xl",children:l?.is_paused?"play_arrow":"pause"})}),l?.playlist&&o.jsx(se,{variant:"secondary",size:"icon",className:"h-10 w-10 md:h-12 md:w-12 rounded-full",onClick:B,title:"Skip to next",children:o.jsx("span",{className:"material-icons text-lg md:text-2xl",children:"skip_next"})})]}),o.jsxs("div",{className:"flex items-center justify-center gap-2",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Speed:"}),o.jsx(bt,{type:"number",placeholder:String(l?.speed||1e3),value:G,onChange:ue=>X(ue.target.value),onKeyDown:ue=>ue.key==="Enter"&&$e(),className:"h-8 w-24 text-sm px-2"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"mm/s"})]}),l?.playlist?.next_file&&o.jsxs("div",{className:"flex items-center gap-3 bg-muted/50 rounded-lg p-2 md:p-3 cursor-pointer hover:bg-muted/70 transition-colors",onClick:()=>xe(!0),title:"View queue",children:[o.jsx("div",{className:"w-10 h-10 md:w-12 md:h-12 rounded-full overflow-hidden bg-muted border shrink-0",children:$?o.jsx("img",{src:$,alt:"Next pattern",className:"w-full h-full object-cover pattern-preview"}):o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-sm",children:"image"})})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Up Next"}),o.jsx("p",{className:"text-sm font-medium truncate",children:el(l.playlist.next_file)})]}),o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-lg",children:"queue_music"})]})]})]})})]})]})}),o.jsx(ga,{open:oe,onOpenChange:xe,children:o.jsxs(Wr,{ref:_e,className:"max-w-md max-h-[80vh] flex flex-col",onTouchStart:je,onTouchEnd:Me,children:[o.jsx("div",{className:"md:hidden flex justify-center -mt-2 mb-2",children:o.jsx("div",{className:"w-10 h-1 bg-muted-foreground/30 rounded-full"})}),o.jsxs(Mr,{children:[o.jsxs(Dr,{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined",children:"queue_music"}),"Queue",l?.playlist?.name&&o.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["— ",l.playlist.name]})]}),o.jsx(vi,{className:"sr-only",children:"List of patterns in the current playlist queue. Swipe down to dismiss."})]}),o.jsx("div",{className:"flex-1 overflow-y-auto -mx-6 px-6 py-2","data-scrollable":!0,children:l?.playlist&&Ue.length>0?(()=>{const ue=l.playlist.current_index,Te=Ue.map((Oe,Qe)=>({file:Oe,index:Qe})).filter(({index:Oe})=>Oe>ue);if(Te.length===0)return o.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No upcoming patterns"});const De=Te[0].index,Xe=Te[Te.length-1].index;return o.jsx(Rq,{sensors:wt,collisionDetection:RU,onDragEnd:at,children:o.jsx(Uq,{items:Te.map(({index:Oe})=>`queue-item-${Oe}`),strategy:Fq,children:o.jsx("div",{className:"space-y-1",children:Te.map(({file:Oe,index:Qe})=>o.jsx(eV,{id:`queue-item-${Qe}`,file:Oe,index:Qe,previewUrl:Q[Oe]||null,isFirst:Qe===De,isLast:Qe===Xe,onMoveToTop:()=>vt(Qe,De),requestPreview:jt,onMoveToBottom:()=>vt(Qe,Xe)},`queue-item-${Qe}`))})})})})():o.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No queue"})}),l?.playlist&&o.jsxs("div",{className:"pt-3 border-t text-xs text-muted-foreground flex justify-between",children:[o.jsxs("span",{children:["Mode: ",l.playlist.mode]}),o.jsxs("span",{children:[l.playlist.current_index+1," of ",l.playlist.total_files]})]})]})})]})}const nV=["top","right","bottom","left"],xi=Math.min,Rr=Math.max,bh=Math.round,qf=Math.floor,Ba=e=>({x:e,y:e}),rV={left:"right",right:"left",bottom:"top",top:"bottom"},aV={start:"end",end:"start"};function e0(e,t,n){return Rr(e,xi(t,n))}function Cs(e,t){return typeof e=="function"?e(t):e}function js(e){return e.split("-")[0]}function Hl(e){return e.split("-")[1]}function yw(e){return e==="x"?"y":"x"}function bw(e){return e==="y"?"height":"width"}const sV=new Set(["top","bottom"]);function La(e){return sV.has(js(e))?"y":"x"}function ww(e){return yw(La(e))}function iV(e,t,n){n===void 0&&(n=!1);const a=Hl(e),i=ww(e),l=bw(i);let u=i==="x"?a===(n?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(u=wh(u)),[u,wh(u)]}function oV(e){const t=wh(e);return[t0(e),t,t0(t)]}function t0(e){return e.replace(/start|end/g,t=>aV[t])}const Z_=["left","right"],J_=["right","left"],lV=["top","bottom"],cV=["bottom","top"];function uV(e,t,n){switch(e){case"top":case"bottom":return n?t?J_:Z_:t?Z_:J_;case"left":case"right":return t?lV:cV;default:return[]}}function dV(e,t,n,a){const i=Hl(e);let l=uV(js(e),n==="start",a);return i&&(l=l.map(u=>u+"-"+i),t&&(l=l.concat(l.map(t0)))),l}function wh(e){return e.replace(/left|right|bottom|top/g,t=>rV[t])}function fV(e){return{top:0,right:0,bottom:0,left:0,...e}}function RD(e){return typeof e!="number"?fV(e):{top:e,right:e,bottom:e,left:e}}function Sh(e){const{x:t,y:n,width:a,height:i}=e;return{width:a,height:i,top:n,left:t,right:t+a,bottom:n+i,x:t,y:n}}function eE(e,t,n){let{reference:a,floating:i}=e;const l=La(t),u=ww(t),d=bw(u),h=js(t),p=l==="y",v=a.x+a.width/2-i.width/2,m=a.y+a.height/2-i.height/2,b=a[d]/2-i[d]/2;let w;switch(h){case"top":w={x:v,y:a.y-i.height};break;case"bottom":w={x:v,y:a.y+a.height};break;case"right":w={x:a.x+a.width,y:m};break;case"left":w={x:a.x-i.width,y:m};break;default:w={x:a.x,y:a.y}}switch(Hl(t)){case"start":w[u]-=b*(n&&p?-1:1);break;case"end":w[u]+=b*(n&&p?-1:1);break}return w}const hV=async(e,t,n)=>{const{placement:a="bottom",strategy:i="absolute",middleware:l=[],platform:u}=n,d=l.filter(Boolean),h=await(u.isRTL==null?void 0:u.isRTL(t));let p=await u.getElementRects({reference:e,floating:t,strategy:i}),{x:v,y:m}=eE(p,a,h),b=a,w={},C=0;for(let S=0;S<d.length;S++){const{name:j,fn:N}=d[S],{x:_,y:T,data:A,reset:D}=await N({x:v,y:m,initialPlacement:a,placement:b,strategy:i,middlewareData:w,rects:p,platform:u,elements:{reference:e,floating:t}});v=_??v,m=T??m,w={...w,[j]:{...w[j],...A}},D&&C<=50&&(C++,typeof D=="object"&&(D.placement&&(b=D.placement),D.rects&&(p=D.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:i}):D.rects),{x:v,y:m}=eE(p,b,h)),S=-1)}return{x:v,y:m,placement:b,strategy:i,middlewareData:w}};async function ku(e,t){var n;t===void 0&&(t={});const{x:a,y:i,platform:l,rects:u,elements:d,strategy:h}=e,{boundary:p="clippingAncestors",rootBoundary:v="viewport",elementContext:m="floating",altBoundary:b=!1,padding:w=0}=Cs(t,e),C=RD(w),j=d[b?m==="floating"?"reference":"floating":m],N=Sh(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(j)))==null||n?j:j.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(d.floating)),boundary:p,rootBoundary:v,strategy:h})),_=m==="floating"?{x:a,y:i,width:u.floating.width,height:u.floating.height}:u.reference,T=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),A=await(l.isElement==null?void 0:l.isElement(T))?await(l.getScale==null?void 0:l.getScale(T))||{x:1,y:1}:{x:1,y:1},D=Sh(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:_,offsetParent:T,strategy:h}):_);return{top:(N.top-D.top+C.top)/A.y,bottom:(D.bottom-N.bottom+C.bottom)/A.y,left:(N.left-D.left+C.left)/A.x,right:(D.right-N.right+C.right)/A.x}}const pV=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:a,placement:i,rects:l,platform:u,elements:d,middlewareData:h}=t,{element:p,padding:v=0}=Cs(e,t)||{};if(p==null)return{};const m=RD(v),b={x:n,y:a},w=ww(i),C=bw(w),S=await u.getDimensions(p),j=w==="y",N=j?"top":"left",_=j?"bottom":"right",T=j?"clientHeight":"clientWidth",A=l.reference[C]+l.reference[w]-b[w]-l.floating[C],D=b[w]-l.reference[w],L=await(u.getOffsetParent==null?void 0:u.getOffsetParent(p));let k=L?L[T]:0;(!k||!await(u.isElement==null?void 0:u.isElement(L)))&&(k=d.floating[T]||l.floating[C]);const P=A/2-D/2,U=k/2-S[C]/2-1,J=xi(m[N],U),$=xi(m[_],U),W=J,pe=k-S[C]-$,Se=k/2-S[C]/2+P,Ce=e0(W,Se,pe),I=!h.arrow&&Hl(i)!=null&&Se!==Ce&&l.reference[C]/2-(Se<W?J:$)-S[C]/2<0,q=I?Se<W?Se-W:Se-pe:0;return{[w]:b[w]+q,data:{[w]:Ce,centerOffset:Se-Ce-q,...I&&{alignmentOffset:q}},reset:I}}}),mV=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,a;const{placement:i,middlewareData:l,rects:u,initialPlacement:d,platform:h,elements:p}=t,{mainAxis:v=!0,crossAxis:m=!0,fallbackPlacements:b,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:S=!0,...j}=Cs(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const N=js(i),_=La(d),T=js(d)===d,A=await(h.isRTL==null?void 0:h.isRTL(p.floating)),D=b||(T||!S?[wh(d)]:oV(d)),L=C!=="none";!b&&L&&D.push(...dV(d,S,C,A));const k=[d,...D],P=await ku(t,j),U=[];let J=((a=l.flip)==null?void 0:a.overflows)||[];if(v&&U.push(P[N]),m){const Se=iV(i,u,A);U.push(P[Se[0]],P[Se[1]])}if(J=[...J,{placement:i,overflows:U}],!U.every(Se=>Se<=0)){var $,W;const Se=((($=l.flip)==null?void 0:$.index)||0)+1,Ce=k[Se];if(Ce&&(!(m==="alignment"?_!==La(Ce):!1)||J.every(H=>La(H.placement)===_?H.overflows[0]>0:!0)))return{data:{index:Se,overflows:J},reset:{placement:Ce}};let I=(W=J.filter(q=>q.overflows[0]<=0).sort((q,H)=>q.overflows[1]-H.overflows[1])[0])==null?void 0:W.placement;if(!I)switch(w){case"bestFit":{var pe;const q=(pe=J.filter(H=>{if(L){const be=La(H.placement);return be===_||be==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(be=>be>0).reduce((be,Ne)=>be+Ne,0)]).sort((H,be)=>H[1]-be[1])[0])==null?void 0:pe[0];q&&(I=q);break}case"initialPlacement":I=d;break}if(i!==I)return{reset:{placement:I}}}return{}}}};function tE(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function nE(e){return nV.some(t=>e[t]>=0)}const gV=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:a="referenceHidden",...i}=Cs(e,t);switch(a){case"referenceHidden":{const l=await ku(t,{...i,elementContext:"reference"}),u=tE(l,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:nE(u)}}}case"escaped":{const l=await ku(t,{...i,altBoundary:!0}),u=tE(l,n.floating);return{data:{escapedOffsets:u,escaped:nE(u)}}}default:return{}}}}},AD=new Set(["left","top"]);async function vV(e,t){const{placement:n,platform:a,elements:i}=e,l=await(a.isRTL==null?void 0:a.isRTL(i.floating)),u=js(n),d=Hl(n),h=La(n)==="y",p=AD.has(u)?-1:1,v=l&&h?-1:1,m=Cs(t,e);let{mainAxis:b,crossAxis:w,alignmentAxis:C}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return d&&typeof C=="number"&&(w=d==="end"?C*-1:C),h?{x:w*v,y:b*p}:{x:b*p,y:w*v}}const xV=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,a;const{x:i,y:l,placement:u,middlewareData:d}=t,h=await vV(t,e);return u===((n=d.offset)==null?void 0:n.placement)&&(a=d.arrow)!=null&&a.alignmentOffset?{}:{x:i+h.x,y:l+h.y,data:{...h,placement:u}}}}},yV=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:a,placement:i}=t,{mainAxis:l=!0,crossAxis:u=!1,limiter:d={fn:j=>{let{x:N,y:_}=j;return{x:N,y:_}}},...h}=Cs(e,t),p={x:n,y:a},v=await ku(t,h),m=La(js(i)),b=yw(m);let w=p[b],C=p[m];if(l){const j=b==="y"?"top":"left",N=b==="y"?"bottom":"right",_=w+v[j],T=w-v[N];w=e0(_,w,T)}if(u){const j=m==="y"?"top":"left",N=m==="y"?"bottom":"right",_=C+v[j],T=C-v[N];C=e0(_,C,T)}const S=d.fn({...t,[b]:w,[m]:C});return{...S,data:{x:S.x-n,y:S.y-a,enabled:{[b]:l,[m]:u}}}}}},bV=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:a,placement:i,rects:l,middlewareData:u}=t,{offset:d=0,mainAxis:h=!0,crossAxis:p=!0}=Cs(e,t),v={x:n,y:a},m=La(i),b=yw(m);let w=v[b],C=v[m];const S=Cs(d,t),j=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(h){const T=b==="y"?"height":"width",A=l.reference[b]-l.floating[T]+j.mainAxis,D=l.reference[b]+l.reference[T]-j.mainAxis;w<A?w=A:w>D&&(w=D)}if(p){var N,_;const T=b==="y"?"width":"height",A=AD.has(js(i)),D=l.reference[m]-l.floating[T]+(A&&((N=u.offset)==null?void 0:N[m])||0)+(A?0:j.crossAxis),L=l.reference[m]+l.reference[T]+(A?0:((_=u.offset)==null?void 0:_[m])||0)-(A?j.crossAxis:0);C<D?C=D:C>L&&(C=L)}return{[b]:w,[m]:C}}}},wV=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,a;const{placement:i,rects:l,platform:u,elements:d}=t,{apply:h=()=>{},...p}=Cs(e,t),v=await ku(t,p),m=js(i),b=Hl(i),w=La(i)==="y",{width:C,height:S}=l.floating;let j,N;m==="top"||m==="bottom"?(j=m,N=b===(await(u.isRTL==null?void 0:u.isRTL(d.floating))?"start":"end")?"left":"right"):(N=m,j=b==="end"?"top":"bottom");const _=S-v.top-v.bottom,T=C-v.left-v.right,A=xi(S-v[j],_),D=xi(C-v[N],T),L=!t.middlewareData.shift;let k=A,P=D;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=T),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(k=_),L&&!b){const J=Rr(v.left,0),$=Rr(v.right,0),W=Rr(v.top,0),pe=Rr(v.bottom,0);w?P=C-2*(J!==0||$!==0?J+$:Rr(v.left,v.right)):k=S-2*(W!==0||pe!==0?W+pe:Rr(v.top,v.bottom))}await h({...t,availableWidth:P,availableHeight:k});const U=await u.getDimensions(d.floating);return C!==U.width||S!==U.height?{reset:{rects:!0}}:{}}}};function ap(){return typeof window<"u"}function Ul(e){return OD(e)?(e.nodeName||"").toLowerCase():"#document"}function Pr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function $a(e){var t;return(t=(OD(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function OD(e){return ap()?e instanceof Node||e instanceof Pr(e).Node:!1}function ya(e){return ap()?e instanceof Element||e instanceof Pr(e).Element:!1}function Ha(e){return ap()?e instanceof HTMLElement||e instanceof Pr(e).HTMLElement:!1}function rE(e){return!ap()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Pr(e).ShadowRoot}const SV=new Set(["inline","contents"]);function td(e){const{overflow:t,overflowX:n,overflowY:a,display:i}=ba(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+n)&&!SV.has(i)}const CV=new Set(["table","td","th"]);function jV(e){return CV.has(Ul(e))}const NV=[":popover-open",":modal"];function sp(e){return NV.some(t=>{try{return e.matches(t)}catch{return!1}})}const _V=["transform","translate","scale","rotate","perspective"],EV=["transform","translate","scale","rotate","perspective","filter"],TV=["paint","layout","strict","content"];function Sw(e){const t=Cw(),n=ya(e)?ba(e):e;return _V.some(a=>n[a]?n[a]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||EV.some(a=>(n.willChange||"").includes(a))||TV.some(a=>(n.contain||"").includes(a))}function RV(e){let t=yi(e);for(;Ha(t)&&!El(t);){if(Sw(t))return t;if(sp(t))return null;t=yi(t)}return null}function Cw(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const AV=new Set(["html","body","#document"]);function El(e){return AV.has(Ul(e))}function ba(e){return Pr(e).getComputedStyle(e)}function ip(e){return ya(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function yi(e){if(Ul(e)==="html")return e;const t=e.assignedSlot||e.parentNode||rE(e)&&e.host||$a(e);return rE(t)?t.host:t}function MD(e){const t=yi(e);return El(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ha(t)&&td(t)?t:MD(t)}function Lu(e,t,n){var a;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=MD(e),l=i===((a=e.ownerDocument)==null?void 0:a.body),u=Pr(i);if(l){const d=n0(u);return t.concat(u,u.visualViewport||[],td(i)?i:[],d&&n?Lu(d):[])}return t.concat(i,Lu(i,[],n))}function n0(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function DD(e){const t=ba(e);let n=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const i=Ha(e),l=i?e.offsetWidth:n,u=i?e.offsetHeight:a,d=bh(n)!==l||bh(a)!==u;return d&&(n=l,a=u),{width:n,height:a,$:d}}function jw(e){return ya(e)?e:e.contextElement}function jl(e){const t=jw(e);if(!Ha(t))return Ba(1);const n=t.getBoundingClientRect(),{width:a,height:i,$:l}=DD(t);let u=(l?bh(n.width):n.width)/a,d=(l?bh(n.height):n.height)/i;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const OV=Ba(0);function PD(e){const t=Pr(e);return!Cw()||!t.visualViewport?OV:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function MV(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Pr(e)?!1:t}function to(e,t,n,a){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),l=jw(e);let u=Ba(1);t&&(a?ya(a)&&(u=jl(a)):u=jl(e));const d=MV(l,n,a)?PD(l):Ba(0);let h=(i.left+d.x)/u.x,p=(i.top+d.y)/u.y,v=i.width/u.x,m=i.height/u.y;if(l){const b=Pr(l),w=a&&ya(a)?Pr(a):a;let C=b,S=n0(C);for(;S&&a&&w!==C;){const j=jl(S),N=S.getBoundingClientRect(),_=ba(S),T=N.left+(S.clientLeft+parseFloat(_.paddingLeft))*j.x,A=N.top+(S.clientTop+parseFloat(_.paddingTop))*j.y;h*=j.x,p*=j.y,v*=j.x,m*=j.y,h+=T,p+=A,C=Pr(S),S=n0(C)}}return Sh({width:v,height:m,x:h,y:p})}function op(e,t){const n=ip(e).scrollLeft;return t?t.left+n:to($a(e)).left+n}function kD(e,t){const n=e.getBoundingClientRect(),a=n.left+t.scrollLeft-op(e,n),i=n.top+t.scrollTop;return{x:a,y:i}}function DV(e){let{elements:t,rect:n,offsetParent:a,strategy:i}=e;const l=i==="fixed",u=$a(a),d=t?sp(t.floating):!1;if(a===u||d&&l)return n;let h={scrollLeft:0,scrollTop:0},p=Ba(1);const v=Ba(0),m=Ha(a);if((m||!m&&!l)&&((Ul(a)!=="body"||td(u))&&(h=ip(a)),Ha(a))){const w=to(a);p=jl(a),v.x=w.x+a.clientLeft,v.y=w.y+a.clientTop}const b=u&&!m&&!l?kD(u,h):Ba(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-h.scrollLeft*p.x+v.x+b.x,y:n.y*p.y-h.scrollTop*p.y+v.y+b.y}}function PV(e){return Array.from(e.getClientRects())}function kV(e){const t=$a(e),n=ip(e),a=e.ownerDocument.body,i=Rr(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),l=Rr(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let u=-n.scrollLeft+op(e);const d=-n.scrollTop;return ba(a).direction==="rtl"&&(u+=Rr(t.clientWidth,a.clientWidth)-i),{width:i,height:l,x:u,y:d}}const aE=25;function LV(e,t){const n=Pr(e),a=$a(e),i=n.visualViewport;let l=a.clientWidth,u=a.clientHeight,d=0,h=0;if(i){l=i.width,u=i.height;const v=Cw();(!v||v&&t==="fixed")&&(d=i.offsetLeft,h=i.offsetTop)}const p=op(a);if(p<=0){const v=a.ownerDocument,m=v.body,b=getComputedStyle(m),w=v.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,C=Math.abs(a.clientWidth-m.clientWidth-w);C<=aE&&(l-=C)}else p<=aE&&(l+=p);return{width:l,height:u,x:d,y:h}}const BV=new Set(["absolute","fixed"]);function IV(e,t){const n=to(e,!0,t==="fixed"),a=n.top+e.clientTop,i=n.left+e.clientLeft,l=Ha(e)?jl(e):Ba(1),u=e.clientWidth*l.x,d=e.clientHeight*l.y,h=i*l.x,p=a*l.y;return{width:u,height:d,x:h,y:p}}function sE(e,t,n){let a;if(t==="viewport")a=LV(e,n);else if(t==="document")a=kV($a(e));else if(ya(t))a=IV(t,n);else{const i=PD(e);a={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Sh(a)}function LD(e,t){const n=yi(e);return n===t||!ya(n)||El(n)?!1:ba(n).position==="fixed"||LD(n,t)}function zV(e,t){const n=t.get(e);if(n)return n;let a=Lu(e,[],!1).filter(d=>ya(d)&&Ul(d)!=="body"),i=null;const l=ba(e).position==="fixed";let u=l?yi(e):e;for(;ya(u)&&!El(u);){const d=ba(u),h=Sw(u);!h&&d.position==="fixed"&&(i=null),(l?!h&&!i:!h&&d.position==="static"&&!!i&&BV.has(i.position)||td(u)&&!h&&LD(e,u))?a=a.filter(v=>v!==u):i=d,u=yi(u)}return t.set(e,a),a}function FV(e){let{element:t,boundary:n,rootBoundary:a,strategy:i}=e;const u=[...n==="clippingAncestors"?sp(t)?[]:zV(t,this._c):[].concat(n),a],d=u[0],h=u.reduce((p,v)=>{const m=sE(t,v,i);return p.top=Rr(m.top,p.top),p.right=xi(m.right,p.right),p.bottom=xi(m.bottom,p.bottom),p.left=Rr(m.left,p.left),p},sE(t,d,i));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function HV(e){const{width:t,height:n}=DD(e);return{width:t,height:n}}function UV(e,t,n){const a=Ha(t),i=$a(t),l=n==="fixed",u=to(e,!0,l,t);let d={scrollLeft:0,scrollTop:0};const h=Ba(0);function p(){h.x=op(i)}if(a||!a&&!l)if((Ul(t)!=="body"||td(i))&&(d=ip(t)),a){const w=to(t,!0,l,t);h.x=w.x+t.clientLeft,h.y=w.y+t.clientTop}else i&&p();l&&!a&&i&&p();const v=i&&!a&&!l?kD(i,d):Ba(0),m=u.left+d.scrollLeft-h.x-v.x,b=u.top+d.scrollTop-h.y-v.y;return{x:m,y:b,width:u.width,height:u.height}}function hv(e){return ba(e).position==="static"}function iE(e,t){if(!Ha(e)||ba(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return $a(e)===n&&(n=n.ownerDocument.body),n}function BD(e,t){const n=Pr(e);if(sp(e))return n;if(!Ha(e)){let i=yi(e);for(;i&&!El(i);){if(ya(i)&&!hv(i))return i;i=yi(i)}return n}let a=iE(e,t);for(;a&&jV(a)&&hv(a);)a=iE(a,t);return a&&El(a)&&hv(a)&&!Sw(a)?n:a||RV(e)||n}const qV=async function(e){const t=this.getOffsetParent||BD,n=this.getDimensions,a=await n(e.floating);return{reference:UV(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function VV(e){return ba(e).direction==="rtl"}const $V={convertOffsetParentRelativeRectToViewportRelativeRect:DV,getDocumentElement:$a,getClippingRect:FV,getOffsetParent:BD,getElementRects:qV,getClientRects:PV,getDimensions:HV,getScale:jl,isElement:ya,isRTL:VV};function ID(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function GV(e,t){let n=null,a;const i=$a(e);function l(){var d;clearTimeout(a),(d=n)==null||d.disconnect(),n=null}function u(d,h){d===void 0&&(d=!1),h===void 0&&(h=1),l();const p=e.getBoundingClientRect(),{left:v,top:m,width:b,height:w}=p;if(d||t(),!b||!w)return;const C=qf(m),S=qf(i.clientWidth-(v+b)),j=qf(i.clientHeight-(m+w)),N=qf(v),T={rootMargin:-C+"px "+-S+"px "+-j+"px "+-N+"px",threshold:Rr(0,xi(1,h))||1};let A=!0;function D(L){const k=L[0].intersectionRatio;if(k!==h){if(!A)return u();k?u(!1,k):a=setTimeout(()=>{u(!1,1e-7)},1e3)}k===1&&!ID(p,e.getBoundingClientRect())&&u(),A=!1}try{n=new IntersectionObserver(D,{...T,root:i.ownerDocument})}catch{n=new IntersectionObserver(D,T)}n.observe(e)}return u(!0),l}function KV(e,t,n,a){a===void 0&&(a={});const{ancestorScroll:i=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:h=!1}=a,p=jw(e),v=i||l?[...p?Lu(p):[],...Lu(t)]:[];v.forEach(N=>{i&&N.addEventListener("scroll",n,{passive:!0}),l&&N.addEventListener("resize",n)});const m=p&&d?GV(p,n):null;let b=-1,w=null;u&&(w=new ResizeObserver(N=>{let[_]=N;_&&_.target===p&&w&&(w.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var T;(T=w)==null||T.observe(t)})),n()}),p&&!h&&w.observe(p),w.observe(t));let C,S=h?to(e):null;h&&j();function j(){const N=to(e);S&&!ID(S,N)&&n(),S=N,C=requestAnimationFrame(j)}return n(),()=>{var N;v.forEach(_=>{i&&_.removeEventListener("scroll",n),l&&_.removeEventListener("resize",n)}),m?.(),(N=w)==null||N.disconnect(),w=null,h&&cancelAnimationFrame(C)}}const YV=xV,WV=yV,XV=mV,QV=wV,ZV=gV,oE=pV,JV=bV,e9=(e,t,n)=>{const a=new Map,i={platform:$V,...n},l={...i.platform,_c:a};return hV(e,t,{...i,platform:l})};var t9=typeof document<"u",n9=function(){},ah=t9?g.useLayoutEffect:n9;function Ch(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,a,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(a=n;a--!==0;)if(!Ch(e[a],t[a]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(a=n;a--!==0;)if(!{}.hasOwnProperty.call(t,i[a]))return!1;for(a=n;a--!==0;){const l=i[a];if(!(l==="_owner"&&e.$$typeof)&&!Ch(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function zD(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function lE(e,t){const n=zD(e);return Math.round(t*n)/n}function pv(e){const t=g.useRef(e);return ah(()=>{t.current=e}),t}function r9(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:a=[],platform:i,elements:{reference:l,floating:u}={},transform:d=!0,whileElementsMounted:h,open:p}=e,[v,m]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[b,w]=g.useState(a);Ch(b,a)||w(a);const[C,S]=g.useState(null),[j,N]=g.useState(null),_=g.useCallback(H=>{H!==L.current&&(L.current=H,S(H))},[]),T=g.useCallback(H=>{H!==k.current&&(k.current=H,N(H))},[]),A=l||C,D=u||j,L=g.useRef(null),k=g.useRef(null),P=g.useRef(v),U=h!=null,J=pv(h),$=pv(i),W=pv(p),pe=g.useCallback(()=>{if(!L.current||!k.current)return;const H={placement:t,strategy:n,middleware:b};$.current&&(H.platform=$.current),e9(L.current,k.current,H).then(be=>{const Ne={...be,isPositioned:W.current!==!1};Se.current&&!Ch(P.current,Ne)&&(P.current=Ne,ka.flushSync(()=>{m(Ne)}))})},[b,t,n,$,W]);ah(()=>{p===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,m(H=>({...H,isPositioned:!1})))},[p]);const Se=g.useRef(!1);ah(()=>(Se.current=!0,()=>{Se.current=!1}),[]),ah(()=>{if(A&&(L.current=A),D&&(k.current=D),A&&D){if(J.current)return J.current(A,D,pe);pe()}},[A,D,pe,J,U]);const Ce=g.useMemo(()=>({reference:L,floating:k,setReference:_,setFloating:T}),[_,T]),I=g.useMemo(()=>({reference:A,floating:D}),[A,D]),q=g.useMemo(()=>{const H={position:n,left:0,top:0};if(!I.floating)return H;const be=lE(I.floating,v.x),Ne=lE(I.floating,v.y);return d?{...H,transform:"translate("+be+"px, "+Ne+"px)",...zD(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:be,top:Ne}},[n,d,I.floating,v.x,v.y]);return g.useMemo(()=>({...v,update:pe,refs:Ce,elements:I,floatingStyles:q}),[v,pe,Ce,I,q])}const a9=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:a,padding:i}=typeof e=="function"?e(n):e;return a&&t(a)?a.current!=null?oE({element:a.current,padding:i}).fn(n):{}:a?oE({element:a,padding:i}).fn(n):{}}}},s9=(e,t)=>({...YV(e),options:[e,t]}),i9=(e,t)=>({...WV(e),options:[e,t]}),o9=(e,t)=>({...JV(e),options:[e,t]}),l9=(e,t)=>({...XV(e),options:[e,t]}),c9=(e,t)=>({...QV(e),options:[e,t]}),u9=(e,t)=>({...ZV(e),options:[e,t]}),d9=(e,t)=>({...a9(e),options:[e,t]});var f9="Arrow",FD=g.forwardRef((e,t)=>{const{children:n,width:a=10,height:i=5,...l}=e;return o.jsx(ut.svg,{...l,ref:t,width:a,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});FD.displayName=f9;var h9=FD;function lp(e){const[t,n]=g.useState(void 0);return Vn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const a=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const l=i[0];let u,d;if("borderBoxSize"in l){const h=l.borderBoxSize,p=Array.isArray(h)?h[0]:h;u=p.inlineSize,d=p.blockSize}else u=e.offsetWidth,d=e.offsetHeight;n({width:u,height:d})});return a.observe(e,{box:"border-box"}),()=>a.unobserve(e)}else n(void 0)},[e]),t}var Nw="Popper",[HD,ql]=Lr(Nw),[p9,UD]=HD(Nw),qD=e=>{const{__scopePopper:t,children:n}=e,[a,i]=g.useState(null);return o.jsx(p9,{scope:t,anchor:a,onAnchorChange:i,children:n})};qD.displayName=Nw;var VD="PopperAnchor",$D=g.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:a,...i}=e,l=UD(VD,n),u=g.useRef(null),d=At(t,u),h=g.useRef(null);return g.useEffect(()=>{const p=h.current;h.current=a?.current||u.current,p!==h.current&&l.onAnchorChange(h.current)}),a?null:o.jsx(ut.div,{...i,ref:d})});$D.displayName=VD;var _w="PopperContent",[m9,g9]=HD(_w),GD=g.forwardRef((e,t)=>{const{__scopePopper:n,side:a="bottom",sideOffset:i=0,align:l="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:h=!0,collisionBoundary:p=[],collisionPadding:v=0,sticky:m="partial",hideWhenDetached:b=!1,updatePositionStrategy:w="optimized",onPlaced:C,...S}=e,j=UD(_w,n),[N,_]=g.useState(null),T=At(t,te=>_(te)),[A,D]=g.useState(null),L=lp(A),k=L?.width??0,P=L?.height??0,U=a+(l!=="center"?"-"+l:""),J=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},$=Array.isArray(p)?p:[p],W=$.length>0,pe={padding:J,boundary:$.filter(x9),altBoundary:W},{refs:Se,floatingStyles:Ce,placement:I,isPositioned:q,middlewareData:H}=r9({strategy:"fixed",placement:U,whileElementsMounted:(...te)=>KV(...te,{animationFrame:w==="always"}),elements:{reference:j.anchor},middleware:[s9({mainAxis:i+P,alignmentAxis:u}),h&&i9({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?o9():void 0,...pe}),h&&l9({...pe}),c9({...pe,apply:({elements:te,rects:he,availableWidth:_e,availableHeight:je})=>{const{width:Me,height:ce}=he.reference,He=te.floating.style;He.setProperty("--radix-popper-available-width",`${_e}px`),He.setProperty("--radix-popper-available-height",`${je}px`),He.setProperty("--radix-popper-anchor-width",`${Me}px`),He.setProperty("--radix-popper-anchor-height",`${ce}px`)}}),A&&d9({element:A,padding:d}),y9({arrowWidth:k,arrowHeight:P}),b&&u9({strategy:"referenceHidden",...pe})]}),[be,Ne]=WD(I),B=gi(C);Vn(()=>{q&&B?.()},[q,B]);const G=H.arrow?.x,X=H.arrow?.y,oe=H.arrow?.centerOffset!==0,[xe,Q]=g.useState();return Vn(()=>{N&&Q(window.getComputedStyle(N).zIndex)},[N]),o.jsx("div",{ref:Se.setFloating,"data-radix-popper-content-wrapper":"",style:{...Ce,transform:q?Ce.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:xe,"--radix-popper-transform-origin":[H.transformOrigin?.x,H.transformOrigin?.y].join(" "),...H.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(m9,{scope:n,placedSide:be,onArrowChange:D,arrowX:G,arrowY:X,shouldHideArrow:oe,children:o.jsx(ut.div,{"data-side":be,"data-align":Ne,...S,ref:T,style:{...S.style,animation:q?void 0:"none"}})})})});GD.displayName=_w;var KD="PopperArrow",v9={top:"bottom",right:"left",bottom:"top",left:"right"},YD=g.forwardRef(function(t,n){const{__scopePopper:a,...i}=t,l=g9(KD,a),u=v9[l.placedSide];return o.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:o.jsx(h9,{...i,ref:n,style:{...i.style,display:"block"}})})});YD.displayName=KD;function x9(e){return e!==null}var y9=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:a,middlewareData:i}=t,u=i.arrow?.centerOffset!==0,d=u?0:e.arrowWidth,h=u?0:e.arrowHeight,[p,v]=WD(n),m={start:"0%",center:"50%",end:"100%"}[v],b=(i.arrow?.x??0)+d/2,w=(i.arrow?.y??0)+h/2;let C="",S="";return p==="bottom"?(C=u?m:`${b}px`,S=`${-h}px`):p==="top"?(C=u?m:`${b}px`,S=`${a.floating.height+h}px`):p==="right"?(C=`${-h}px`,S=u?m:`${w}px`):p==="left"&&(C=`${a.floating.width+h}px`,S=u?m:`${w}px`),{data:{x:C,y:S}}}});function WD(e){const[t,n="center"]=e.split("-");return[t,n]}var Ew=qD,cp=$D,Tw=GD,Rw=YD;function b9(e){const t=w9(e),n=g.forwardRef((a,i)=>{const{children:l,...u}=a,d=g.Children.toArray(l),h=d.find(C9);if(h){const p=h.props.children,v=d.map(m=>m===h?g.Children.count(p)>1?g.Children.only(null):g.isValidElement(p)?p.props.children:null:m);return o.jsx(t,{...u,ref:i,children:g.isValidElement(p)?g.cloneElement(p,void 0,v):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function w9(e){const t=g.forwardRef((n,a)=>{const{children:i,...l}=n;if(g.isValidElement(i)){const u=N9(i),d=j9(l,i.props);return i.type!==g.Fragment&&(d.ref=a?oo(a,u):u),g.cloneElement(i,d)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var S9=Symbol("radix.slottable");function C9(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===S9}function j9(e,t){const n={...t};for(const a in t){const i=e[a],l=t[a];/^on[A-Z]/.test(a)?i&&l?n[a]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(n[a]=i):a==="style"?n[a]={...i,...l}:a==="className"&&(n[a]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function N9(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var up="Popover",[XD]=Lr(up,[ql]),nd=ql(),[_9,Ci]=XD(up),QD=e=>{const{__scopePopover:t,children:n,open:a,defaultOpen:i,onOpenChange:l,modal:u=!1}=e,d=nd(t),h=g.useRef(null),[p,v]=g.useState(!1),[m,b]=Zr({prop:a,defaultProp:i??!1,onChange:l,caller:up});return o.jsx(Ew,{...d,children:o.jsx(_9,{scope:t,contentId:ma(),triggerRef:h,open:m,onOpenChange:b,onOpenToggle:g.useCallback(()=>b(w=>!w),[b]),hasCustomAnchor:p,onCustomAnchorAdd:g.useCallback(()=>v(!0),[]),onCustomAnchorRemove:g.useCallback(()=>v(!1),[]),modal:u,children:n})})};QD.displayName=up;var ZD="PopoverAnchor",E9=g.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,i=Ci(ZD,n),l=nd(n),{onCustomAnchorAdd:u,onCustomAnchorRemove:d}=i;return g.useEffect(()=>(u(),()=>d()),[u,d]),o.jsx(cp,{...l,...a,ref:t})});E9.displayName=ZD;var JD="PopoverTrigger",eP=g.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,i=Ci(JD,n),l=nd(n),u=At(t,i.triggerRef),d=o.jsx(ut.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":sP(i.open),...a,ref:u,onClick:Je(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?d:o.jsx(cp,{asChild:!0,...l,children:d})});eP.displayName=JD;var Aw="PopoverPortal",[T9,R9]=XD(Aw,{forceMount:void 0}),tP=e=>{const{__scopePopover:t,forceMount:n,children:a,container:i}=e,l=Ci(Aw,t);return o.jsx(T9,{scope:t,forceMount:n,children:o.jsx(Ts,{present:n||l.open,children:o.jsx(Gh,{asChild:!0,container:i,children:a})})})};tP.displayName=Aw;var Tl="PopoverContent",nP=g.forwardRef((e,t)=>{const n=R9(Tl,e.__scopePopover),{forceMount:a=n.forceMount,...i}=e,l=Ci(Tl,e.__scopePopover);return o.jsx(Ts,{present:a||l.open,children:l.modal?o.jsx(O9,{...i,ref:t}):o.jsx(M9,{...i,ref:t})})});nP.displayName=Tl;var A9=b9("PopoverContent.RemoveScroll"),O9=g.forwardRef((e,t)=>{const n=Ci(Tl,e.__scopePopover),a=g.useRef(null),i=At(t,a),l=g.useRef(!1);return g.useEffect(()=>{const u=a.current;if(u)return sw(u)},[]),o.jsx(Yh,{as:A9,allowPinchZoom:!0,children:o.jsx(rP,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Je(e.onCloseAutoFocus,u=>{u.preventDefault(),l.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Je(e.onPointerDownOutside,u=>{const d=u.detail.originalEvent,h=d.button===0&&d.ctrlKey===!0,p=d.button===2||h;l.current=p},{checkForDefaultPrevented:!1}),onFocusOutside:Je(e.onFocusOutside,u=>u.preventDefault(),{checkForDefaultPrevented:!1})})})}),M9=g.forwardRef((e,t)=>{const n=Ci(Tl,e.__scopePopover),a=g.useRef(!1),i=g.useRef(!1);return o.jsx(rP,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{e.onCloseAutoFocus?.(l),l.defaultPrevented||(a.current||n.triggerRef.current?.focus(),l.preventDefault()),a.current=!1,i.current=!1},onInteractOutside:l=>{e.onInteractOutside?.(l),l.defaultPrevented||(a.current=!0,l.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const u=l.target;n.triggerRef.current?.contains(u)&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&i.current&&l.preventDefault()}})}),rP=g.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:p,onInteractOutside:v,...m}=e,b=Ci(Tl,n),w=nd(n);return aw(),o.jsx($h,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:i,onUnmountAutoFocus:l,children:o.jsx(Qu,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:v,onEscapeKeyDown:d,onPointerDownOutside:h,onFocusOutside:p,onDismiss:()=>b.onOpenChange(!1),children:o.jsx(Tw,{"data-state":sP(b.open),role:"dialog",id:b.contentId,...w,...m,ref:t,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),aP="PopoverClose",D9=g.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,i=Ci(aP,n);return o.jsx(ut.button,{type:"button",...a,ref:t,onClick:Je(e.onClick,()=>i.onOpenChange(!1))})});D9.displayName=aP;var P9="PopoverArrow",k9=g.forwardRef((e,t)=>{const{__scopePopover:n,...a}=e,i=nd(n);return o.jsx(Rw,{...i,...a,ref:t})});k9.displayName=P9;function sP(e){return e?"open":"closed"}var L9=QD,B9=eP,I9=tP,iP=nP;const Bu=L9,Iu=B9,Rl=g.forwardRef(({className:e,align:t="center",sideOffset:n=4,...a},i)=>o.jsx(I9,{children:o.jsx(iP,{ref:i,align:t,sideOffset:n,className:lt("z-[100] w-72 rounded-2xl border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",e),...a})}));Rl.displayName=iP.displayName;var z9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],F9=z9.reduce((e,t)=>{const n=Vh(`Primitive.${t}`),a=g.forwardRef((i,l)=>{const{asChild:u,...d}=i,h=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(h,{...d,ref:l})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),H9="Separator",cE="horizontal",U9=["horizontal","vertical"],oP=g.forwardRef((e,t)=>{const{decorative:n,orientation:a=cE,...i}=e,l=q9(a)?a:cE,d=n?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return o.jsx(F9.div,{"data-orientation":l,...d,...i,ref:t})});oP.displayName=H9;function q9(e){return U9.includes(e)}var lP=oP;const Xn=g.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...a},i)=>o.jsx(lP,{ref:i,decorative:n,orientation:t,className:lt("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...a}));Xn.displayName=lP.displayName;const V9="dune_weaver_previews",$9=1,Ns="previews",G9=200,uE=G9*1024*1024;let ha=null;const Xi=new Map,K9=100;async function dp(){return ha||new Promise((e,t)=>{const n=indexedDB.open(V9,$9);n.onerror=()=>{console.error("Failed to open preview cache database"),t(n.error)},n.onsuccess=()=>{ha=n.result,console.debug("Preview cache database opened successfully"),e(ha)},n.onupgradeneeded=a=>{const l=a.target.result.createObjectStore(Ns,{keyPath:"pattern"});l.createIndex("lastAccessed","lastAccessed",{unique:!1}),l.createIndex("size","size",{unique:!1}),console.debug("Preview cache database schema created")}})}function cP(e,t){if(Xi.size>=K9){const n=Xi.keys().next().value;n&&Xi.delete(n)}Xi.set(e,t)}async function Ow(e,t){try{if(!t||!t.image_data){console.warn(`Invalid preview data for ${e}, skipping cache save`);return}ha||await dp(),cP(e,t);const n=Math.ceil(t.image_data.length*3/4);await W9(n);const a={pattern:e,data:t,size:n,lastAccessed:Date.now(),created:Date.now()},l=ha.transaction([Ns],"readwrite").objectStore(Ns);return new Promise((u,d)=>{const h=l.put(a);h.onsuccess=()=>{console.debug(`Preview cached for ${e} (${(n/1024).toFixed(1)}KB)`),u()},h.onerror=()=>d(h.error)})}catch(n){console.warn(`Error saving preview to cache: ${n}`)}}async function Y9(){try{if(!ha)return 0;const t=ha.transaction([Ns],"readonly").objectStore(Ns);return new Promise((n,a)=>{const i=t.getAll();i.onsuccess=()=>{const l=i.result.reduce((u,d)=>u+(d.size||0),0);n(l)},i.onerror=()=>a(i.error)})}catch(e){return console.warn(`Error getting cache size: ${e}`),0}}async function W9(e){try{const t=await Y9();if(t+e<=uE)return;console.debug(`Cache size would exceed limit (${((t+e)/1024/1024).toFixed(1)}MB), cleaning up...`);const a=ha.transaction([Ns],"readwrite").objectStore(Ns),i=a.index("lastAccessed"),l=await new Promise((h,p)=>{const v=i.getAll();v.onsuccess=()=>h(v.result),v.onerror=()=>p(v.error)});l.sort((h,p)=>h.lastAccessed-p.lastAccessed);let u=0;const d=e+uE*.1;for(const h of l){if(u>=d)break;await new Promise((p,v)=>{const m=a.delete(h.pattern);m.onsuccess=()=>{u+=h.size,Xi.delete(h.pattern),console.debug(`Evicted cached preview for ${h.pattern} (${(h.size/1024).toFixed(1)}KB)`),p()},m.onerror=()=>v(m.error)})}console.debug(`Freed ${(u/1024/1024).toFixed(1)}MB from preview cache`)}catch(t){console.warn(`Error managing cache size: ${t}`)}}async function bu(e){const t=new Map,n=[];for(const a of e)Xi.has(a)?t.set(a,Xi.get(a)):n.push(a);if(n.length>0&&ha)try{const i=ha.transaction([Ns],"readwrite").objectStore(Ns);await Promise.all(n.map(l=>new Promise(u=>{const d=i.get(l);d.onsuccess=()=>{const h=d.result;h&&(h.lastAccessed=Date.now(),i.put(h),t.set(l,h.data),cP(l,h.data)),u()},d.onerror=()=>u()})))}catch(a){console.warn(`Error batch getting from cache: ${a}`)}return t}async function uP(e){try{await dp();const n=await fe.get("/list_theta_rho_files_with_metadata"),a=n.map(d=>d.path),i=await bu(a),l=a.filter(d=>!i.has(d));if(l.length===0)return e({completed:n.length,total:n.length,done:!0}),{success:!0,cached:0};e({completed:0,total:l.length,done:!1});const u=Math.ceil(l.length/10);for(let d=0;d<u;d++){const h=d*10,p=Math.min(h+10,l.length),v=l.slice(h,p);try{const m=await fe.post("/preview_thr_batch",{file_names:v});for(const[b,w]of Object.entries(m))w&&!w.error&&await Ow(b,w)}catch{}e({completed:p,total:l.length,done:!1}),d+1<u&&await new Promise(m=>setTimeout(m,100))}return e({completed:l.length,total:l.length,done:!0}),{success:!0,cached:l.length}}catch(n){return console.error("Error caching previews:",n),{success:!1,cached:0}}}const dP=g.createContext(null),nu="duneweaver_tables",ru="duneweaver_active_table";function dE(e){try{return new URL(e).origin}catch{return e}}function X9({children:e}){const[t,n]=g.useState([]),[a,i]=g.useState(null),[l,u]=g.useState(!1),[d,h]=g.useState(null),p=g.useRef(!1),v=g.useRef(null);g.useEffect(()=>{if(!p.current){p.current=!0;try{const N=localStorage.getItem(nu),_=localStorage.getItem(ru);if(N){const T=JSON.parse(N);if(n(T.tables||[]),_&&T.tables){const A=T.tables.find(D=>D.id===_);A&&(v.current=_,i(A),dE(A.url)!==window.location.origin&&fe.setBaseUrl(A.url))}}b()}catch(N){console.error("Failed to load saved tables:",N),b()}}},[]),g.useEffect(()=>{if(p.current)try{const N={tables:t,activeTableId:a?.id||null};localStorage.setItem(nu,JSON.stringify(N)),a?localStorage.setItem(ru,a.id):localStorage.removeItem(ru)}catch(N){console.error("Failed to save tables:",N)}},[t,a]);const m=g.useCallback(N=>{try{const T={tables:JSON.parse(localStorage.getItem(nu)||"{}").tables||t,activeTableId:N.id};localStorage.setItem(nu,JSON.stringify(T)),localStorage.setItem(ru,N.id)}catch(_){console.error("Failed to save table selection:",_)}dE(N.url)===window.location.origin?fe.setBaseUrl(""):fe.setBaseUrl(N.url),window.location.reload()},[t]),b=g.useCallback(async()=>{u(!0);try{const[N,_,T]=await Promise.all([fetch("/api/table-info"),fetch("/api/settings").catch(()=>null),fetch("/api/known-tables").catch(()=>null)]);if(!N.ok)throw new Error("Failed to fetch table info");const A=await N.json(),D=_?.ok?await _.json():null,k=(T?.ok?await T.json():null)?.tables||[],P={id:A.id,name:A.name,url:window.location.origin,version:A.version,isOnline:!0,isCurrent:!0,customLogo:D?.app?.custom_logo||void 0};if(n(()=>{const U=[P];return k.forEach(J=>{J.id!==P.id&&U.push({id:J.id,name:J.name,url:J.url,host:J.host,port:J.port,version:J.version,isOnline:!1,isCurrent:!1})}),U}),!a&&!v.current){i(P);try{const U={tables:[P],activeTableId:P.id};localStorage.setItem(nu,JSON.stringify(U)),localStorage.setItem(ru,P.id)}catch(U){console.error("Failed to save initial table selection:",U)}}else a?.isCurrent&&i(U=>U?{...U,name:P.name}:null);v.current=null,h(new Date),setTimeout(()=>{n(U=>(U.filter($=>!$.isCurrent).forEach(async $=>{try{const[W,pe]=await Promise.all([fetch(`${$.url}/api/table-info`,{signal:AbortSignal.timeout(3e3)}),fetch(`${$.url}/api/settings`,{signal:AbortSignal.timeout(3e3)}).catch(()=>null)]),Se=W.ok,I=(pe?.ok?await pe.json():null)?.app?.custom_logo||void 0;n(q=>q.map(H=>H.id===$.id?{...H,isOnline:Se,customLogo:I}:H))}catch{n(W=>W.map(pe=>pe.id===$.id?{...pe,isOnline:!1}:pe))}}),U))},100)}catch(N){console.error("Table refresh failed:",N)}finally{u(!1)}},[a]),w=g.useCallback(async(N,_)=>{try{const T=N.replace(/\/$/,"");if(t.find(U=>U.url===T))return null;const[A,D]=await Promise.all([fetch(`${T}/api/table-info`),fetch(`${T}/api/settings`).catch(()=>null)]);if(!A.ok)throw new Error("Failed to fetch table info");const L=await A.json(),k=D?.ok?await D.json():null,P={id:L.id,name:_||L.name,url:T,version:L.version,isOnline:!0,isCurrent:!1,customLogo:k?.app?.custom_logo||void 0};try{const U=new URL(T).hostname;await fetch("/api/known-tables",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:P.id,name:P.name,url:P.url,host:U,version:P.version})})}catch(U){console.error("Failed to persist table to backend:",U)}return n(U=>[...U,P]),P}catch(T){return console.error("Failed to add table:",T),null}},[t]),C=g.useCallback(async N=>{try{await fetch(`/api/known-tables/${N}`,{method:"DELETE"})}catch(_){console.error("Failed to remove table from backend:",_)}if(n(_=>_.filter(T=>T.id!==N)),a?.id===N){const _=t.filter(T=>T.id!==N);_.length>0?m(_[0]):(i(null),fe.setBaseUrl(""))}},[a,t,m]),S=g.useCallback(async(N,_)=>{const T=t.find(A=>A.id===N);if(T)try{const A=T.isCurrent?"":T.url;if((await fetch(`${A}/api/table-info`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:_})})).ok){if(!T.isCurrent)try{await fetch(`/api/known-tables/${N}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:_})})}catch(L){console.error("Failed to update known table name:",L)}n(L=>L.map(k=>k.id===N?{...k,name:_}:k)),a?.id===N&&i(L=>L?{...L,name:_}:null)}}catch(A){console.error("Failed to update table name:",A)}},[t,a]),j=g.useCallback(async N=>{try{const _=N.isCurrent?"":N.url,[T,A]=await Promise.all([fetch(`${_}/api/table-info`,{signal:AbortSignal.timeout(3e3)}),fetch(`${_}/api/settings`,{signal:AbortSignal.timeout(3e3)}).catch(()=>null)]),D=T.ok,k=(A?.ok?await A.json():null)?.app?.custom_logo||void 0;return n(P=>P.map(U=>U.id===N.id?{...U,isOnline:D,customLogo:k}:U)),D}catch{return n(_=>_.map(T=>T.id===N.id?{...T,isOnline:!1}:T)),!1}},[]);return o.jsx(dP.Provider,{value:{tables:t,activeTable:a,isDiscovering:l,lastDiscovery:d,setActiveTable:m,discoverTables:b,addTable:w,removeTable:C,updateTableName:S,refreshTableStatus:j},children:e})}function fP(){const e=g.useContext(dP);if(!e)throw new Error("useTable must be used within a TableProvider");return e}const Q9=Xu("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Al({className:e,variant:t,...n}){return o.jsx("div",{className:lt(Q9({variant:t}),e),...n})}function Z9({children:e}){const{tables:t,activeTable:n,setActiveTable:a,addTable:i,removeTable:l,updateTableName:u}=fP(),[d,h]=g.useState(!1),[p,v]=g.useState(!1),[m,b]=g.useState(!1),[w,C]=g.useState(""),[S,j]=g.useState(""),[N,_]=g.useState(null),[T,A]=g.useState(""),[D,L]=g.useState(!1),k=W=>{W.id!==n?.id&&(a(W),K.success(`Switched to ${W.name}`)),h(!1)},P=async()=>{if(!w.trim()){K.error("Please enter a URL");return}L(!0);try{let W=w.trim();!W.startsWith("http://")&&!W.startsWith("https://")&&(W=`http://${W}`);const pe=await i(W,S.trim()||void 0);pe?(K.success(`Added ${pe.name}`),v(!1),C(""),j("")):K.error("Failed to add table. Check the URL and try again.")}finally{L(!1)}},U=async()=>{!N||!T.trim()||(await u(N.id,T.trim()),K.success("Table renamed"),b(!1),_(null),A(""))},J=W=>{if(W.isCurrent){K.error("Can't remove the current table");return}l(W.id),K.success(`Removed ${W.name}`)},$=W=>{_(W),A(W.name),b(!0)};return o.jsxs(o.Fragment,{children:[o.jsxs(Bu,{open:d,onOpenChange:h,children:[o.jsx(Iu,{asChild:!0,children:e||o.jsxs(se,{variant:"ghost",size:"sm",className:"gap-2 h-9 px-2",children:[o.jsx(JH,{className:"h-4 w-4"}),o.jsx("span",{className:"hidden sm:inline max-w-[120px] truncate",children:n?.appName||n?.name||"Select Table"})]})}),o.jsx(Rl,{className:"w-72 p-2",align:"start",sideOffset:12,alignOffset:-56,children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"px-2 py-1",children:o.jsx("span",{className:"text-sm font-medium",children:"Sand Tables"})}),o.jsx("div",{className:"space-y-1",children:t.map(W=>o.jsxs("div",{className:`flex items-center gap-2 px-2 py-2 rounded-md cursor-pointer hover:bg-accent group ${n?.id===W.id?"bg-accent":""}`,onClick:()=>k(W),children:[o.jsxs("div",{className:"relative flex-shrink-0",children:[o.jsx("img",{src:W.customLogo?`${W.isCurrent?"":W.url}/static/custom/${W.customLogo}`:`${W.isCurrent?"":W.url}/static/android-chrome-192x192.png`,alt:W.name,className:"w-8 h-8 rounded-full object-cover",onError:pe=>{pe.target.src="/static/android-chrome-192x192.png"}}),o.jsx("span",{className:`absolute -bottom-0.5 -right-0.5 w-3 h-3 rounded-full border-2 border-popover ${W.isOnline?"bg-green-500":"bg-red-500"}`})]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-sm truncate",children:W.name}),W.isCurrent&&o.jsx(Al,{variant:"secondary",className:"text-[10px] px-1 py-0",children:"This"})]}),o.jsx("span",{className:"text-xs text-muted-foreground truncate block",children:W.host||new URL(W.url).hostname})]}),o.jsxs("div",{className:"flex md:opacity-0 md:group-hover:opacity-100 items-center gap-1 transition-opacity",children:[o.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:pe=>{pe.stopPropagation(),$(W)},title:"Rename",children:o.jsx(tU,{className:"h-3.5 w-3.5"})}),!W.isCurrent&&o.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-destructive hover:text-destructive",onClick:pe=>{pe.stopPropagation(),J(W)},title:"Remove",children:o.jsx(tD,{className:"h-3.5 w-3.5"})})]}),n?.id===W.id&&o.jsx(eD,{className:"h-4 w-4 text-primary flex-shrink-0"})]},W.id))}),o.jsxs(se,{variant:"secondary",size:"sm",className:"w-full gap-2",onClick:()=>v(!0),children:[o.jsx(rU,{className:"h-3.5 w-3.5"}),"Add Table Manually"]})]})})]}),o.jsx(ga,{open:p,onOpenChange:v,children:o.jsxs(Wr,{children:[o.jsx(Mr,{children:o.jsx(Dr,{children:"Add Table Manually"})}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Table URL"}),o.jsx(bt,{placeholder:"192.168.1.100:8080 or http://...",value:w,onChange:W=>C(W.target.value),onKeyDown:W=>W.key==="Enter"&&P()}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter the IP address and port of the table's backend"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Name (optional)"}),o.jsx(bt,{placeholder:"Living Room Table",value:S,onChange:W=>j(W.target.value),onKeyDown:W=>W.key==="Enter"&&P()})]})]}),o.jsxs(va,{className:"gap-2 sm:gap-0",children:[o.jsx(se,{variant:"secondary",onClick:()=>v(!1),children:"Cancel"}),o.jsx(se,{onClick:P,disabled:D,children:D?"Adding...":"Add Table"})]})]})}),o.jsx(ga,{open:m,onOpenChange:b,children:o.jsxs(Wr,{children:[o.jsx(Mr,{children:o.jsx(Dr,{children:"Rename Table"})}),o.jsx("div",{className:"py-4",children:o.jsx(bt,{placeholder:"Table name",value:T,onChange:W=>A(W.target.value),onKeyDown:W=>W.key==="Enter"&&U(),autoFocus:!0})}),o.jsxs(va,{className:"gap-2 sm:gap-0",children:[o.jsx(se,{variant:"secondary",onClick:()=>b(!1),children:"Cancel"}),o.jsx(se,{onClick:U,children:"Save"})]})]})})]})}const hP=g.createContext({});function Mw(e){const t=g.useRef(null);return t.current===null&&(t.current=e()),t.current}const pP=typeof window<"u",mP=pP?g.useLayoutEffect:g.useEffect,Dw=g.createContext(null);function Pw(e,t){e.indexOf(t)===-1&&e.push(t)}function kw(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const Ua=(e,t,n)=>n>t?t:n<e?e:n;let Lw=()=>{};const _s={},gP=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function vP(e){return typeof e=="object"&&e!==null}const xP=e=>/^0[^.\s]+$/u.test(e);function Bw(e){let t;return()=>(t===void 0&&(t=e()),t)}const Xr=e=>e,J9=(e,t)=>n=>t(e(n)),rd=(...e)=>e.reduce(J9),zu=(e,t,n)=>{const a=t-e;return a===0?1:(n-e)/a};class Iw{constructor(){this.subscriptions=[]}add(t){return Pw(this.subscriptions,t),()=>kw(this.subscriptions,t)}notify(t,n,a){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,a);else for(let l=0;l<i;l++){const u=this.subscriptions[l];u&&u(t,n,a)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const ws=e=>e*1e3,Yr=e=>e/1e3;function yP(e,t){return t?e*(1e3/t):0}const bP=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,e$=1e-7,t$=12;function n$(e,t,n,a,i){let l,u,d=0;do u=t+(n-t)/2,l=bP(u,a,i)-e,l>0?n=u:t=u;while(Math.abs(l)>e$&&++d<t$);return u}function ad(e,t,n,a){if(e===t&&n===a)return Xr;const i=l=>n$(l,0,1,e,n);return l=>l===0||l===1?l:bP(i(l),t,a)}const wP=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,SP=e=>t=>1-e(1-t),CP=ad(.33,1.53,.69,.99),zw=SP(CP),jP=wP(zw),NP=e=>(e*=2)<1?.5*zw(e):.5*(2-Math.pow(2,-10*(e-1))),Fw=e=>1-Math.sin(Math.acos(e)),_P=SP(Fw),EP=wP(Fw),r$=ad(.42,0,1,1),a$=ad(0,0,.58,1),TP=ad(.42,0,.58,1),s$=e=>Array.isArray(e)&&typeof e[0]!="number",RP=e=>Array.isArray(e)&&typeof e[0]=="number",i$={linear:Xr,easeIn:r$,easeInOut:TP,easeOut:a$,circIn:Fw,circInOut:EP,circOut:_P,backIn:zw,backInOut:jP,backOut:CP,anticipate:NP},o$=e=>typeof e=="string",fE=e=>{if(RP(e)){Lw(e.length===4);const[t,n,a,i]=e;return ad(t,n,a,i)}else if(o$(e))return i$[e];return e},Vf=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function l$(e,t){let n=new Set,a=new Set,i=!1,l=!1;const u=new WeakSet;let d={delta:0,timestamp:0,isProcessing:!1};function h(v){u.has(v)&&(p.schedule(v),e()),v(d)}const p={schedule:(v,m=!1,b=!1)=>{const C=b&&i?n:a;return m&&u.add(v),C.has(v)||C.add(v),v},cancel:v=>{a.delete(v),u.delete(v)},process:v=>{if(d=v,i){l=!0;return}i=!0,[n,a]=[a,n],n.forEach(h),n.clear(),i=!1,l&&(l=!1,p.process(v))}};return p}const c$=40;function AP(e,t){let n=!1,a=!0;const i={delta:0,timestamp:0,isProcessing:!1},l=()=>n=!0,u=Vf.reduce((T,A)=>(T[A]=l$(l),T),{}),{setup:d,read:h,resolveKeyframes:p,preUpdate:v,update:m,preRender:b,render:w,postRender:C}=u,S=()=>{const T=_s.useManualTiming?i.timestamp:performance.now();n=!1,_s.useManualTiming||(i.delta=a?1e3/60:Math.max(Math.min(T-i.timestamp,c$),1)),i.timestamp=T,i.isProcessing=!0,d.process(i),h.process(i),p.process(i),v.process(i),m.process(i),b.process(i),w.process(i),C.process(i),i.isProcessing=!1,n&&t&&(a=!1,e(S))},j=()=>{n=!0,a=!0,i.isProcessing||e(S)};return{schedule:Vf.reduce((T,A)=>{const D=u[A];return T[A]=(L,k=!1,P=!1)=>(n||j(),D.schedule(L,k,P)),T},{}),cancel:T=>{for(let A=0;A<Vf.length;A++)u[Vf[A]].cancel(T)},state:i,steps:u}}const{schedule:rn,cancel:qa,state:Fn,steps:mv}=AP(typeof requestAnimationFrame<"u"?requestAnimationFrame:Xr,!0);let sh;function u$(){sh=void 0}const nr={now:()=>(sh===void 0&&nr.set(Fn.isProcessing||_s.useManualTiming?Fn.timestamp:performance.now()),sh),set:e=>{sh=e,queueMicrotask(u$)}},OP=e=>t=>typeof t=="string"&&t.startsWith(e),MP=OP("--"),d$=OP("var(--"),Hw=e=>d$(e)?f$.test(e.split("/*")[0].trim()):!1,f$=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function hE(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const Vl={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Fu={...Vl,transform:e=>Ua(0,1,e)},$f={...Vl,default:1},wu=e=>Math.round(e*1e5)/1e5,Uw=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function h$(e){return e==null}const p$=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,qw=(e,t)=>n=>!!(typeof n=="string"&&p$.test(n)&&n.startsWith(e)||t&&!h$(n)&&Object.prototype.hasOwnProperty.call(n,t)),DP=(e,t,n)=>a=>{if(typeof a!="string")return a;const[i,l,u,d]=a.match(Uw);return{[e]:parseFloat(i),[t]:parseFloat(l),[n]:parseFloat(u),alpha:d!==void 0?parseFloat(d):1}},m$=e=>Ua(0,255,e),gv={...Vl,transform:e=>Math.round(m$(e))},Qi={test:qw("rgb","red"),parse:DP("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:a=1})=>"rgba("+gv.transform(e)+", "+gv.transform(t)+", "+gv.transform(n)+", "+wu(Fu.transform(a))+")"};function g$(e){let t="",n="",a="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),a=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),a=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,a+=a,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(a,16),alpha:i?parseInt(i,16)/255:1}}const r0={test:qw("#"),parse:g$,transform:Qi.transform},sd=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ui=sd("deg"),Ia=sd("%"),Be=sd("px"),v$=sd("vh"),x$=sd("vw"),pE={...Ia,parse:e=>Ia.parse(e)/100,transform:e=>Ia.transform(e*100)},xl={test:qw("hsl","hue"),parse:DP("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:a=1})=>"hsla("+Math.round(e)+", "+Ia.transform(wu(t))+", "+Ia.transform(wu(n))+", "+wu(Fu.transform(a))+")"},Nn={test:e=>Qi.test(e)||r0.test(e)||xl.test(e),parse:e=>Qi.test(e)?Qi.parse(e):xl.test(e)?xl.parse(e):r0.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Qi.transform(e):xl.transform(e),getAnimatableNone:e=>{const t=Nn.parse(e);return t.alpha=0,Nn.transform(t)}},y$=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function b$(e){return isNaN(e)&&typeof e=="string"&&(e.match(Uw)?.length||0)+(e.match(y$)?.length||0)>0}const PP="number",kP="color",w$="var",S$="var(",mE="${}",C$=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Hu(e){const t=e.toString(),n=[],a={color:[],number:[],var:[]},i=[];let l=0;const d=t.replace(C$,h=>(Nn.test(h)?(a.color.push(l),i.push(kP),n.push(Nn.parse(h))):h.startsWith(S$)?(a.var.push(l),i.push(w$),n.push(h)):(a.number.push(l),i.push(PP),n.push(parseFloat(h))),++l,mE)).split(mE);return{values:n,split:d,indexes:a,types:i}}function LP(e){return Hu(e).values}function BP(e){const{split:t,types:n}=Hu(e),a=t.length;return i=>{let l="";for(let u=0;u<a;u++)if(l+=t[u],i[u]!==void 0){const d=n[u];d===PP?l+=wu(i[u]):d===kP?l+=Nn.transform(i[u]):l+=i[u]}return l}}const j$=e=>typeof e=="number"?0:Nn.test(e)?Nn.getAnimatableNone(e):e;function N$(e){const t=LP(e);return BP(e)(t.map(j$))}const bi={test:b$,parse:LP,createTransformer:BP,getAnimatableNone:N$};function vv(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function _$({hue:e,saturation:t,lightness:n,alpha:a}){e/=360,t/=100,n/=100;let i=0,l=0,u=0;if(!t)i=l=u=n;else{const d=n<.5?n*(1+t):n+t-n*t,h=2*n-d;i=vv(h,d,e+1/3),l=vv(h,d,e),u=vv(h,d,e-1/3)}return{red:Math.round(i*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:a}}function jh(e,t){return n=>n>0?t:e}const hn=(e,t,n)=>e+(t-e)*n,xv=(e,t,n)=>{const a=e*e,i=n*(t*t-a)+a;return i<0?0:Math.sqrt(i)},E$=[r0,Qi,xl],T$=e=>E$.find(t=>t.test(e));function gE(e){const t=T$(e);if(!t)return!1;let n=t.parse(e);return t===xl&&(n=_$(n)),n}const vE=(e,t)=>{const n=gE(e),a=gE(t);if(!n||!a)return jh(e,t);const i={...n};return l=>(i.red=xv(n.red,a.red,l),i.green=xv(n.green,a.green,l),i.blue=xv(n.blue,a.blue,l),i.alpha=hn(n.alpha,a.alpha,l),Qi.transform(i))},a0=new Set(["none","hidden"]);function R$(e,t){return a0.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function A$(e,t){return n=>hn(e,t,n)}function Vw(e){return typeof e=="number"?A$:typeof e=="string"?Hw(e)?jh:Nn.test(e)?vE:D$:Array.isArray(e)?IP:typeof e=="object"?Nn.test(e)?vE:O$:jh}function IP(e,t){const n=[...e],a=n.length,i=e.map((l,u)=>Vw(l)(l,t[u]));return l=>{for(let u=0;u<a;u++)n[u]=i[u](l);return n}}function O$(e,t){const n={...e,...t},a={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(a[i]=Vw(e[i])(e[i],t[i]));return i=>{for(const l in a)n[l]=a[l](i);return n}}function M$(e,t){const n=[],a={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const l=t.types[i],u=e.indexes[l][a[l]],d=e.values[u]??0;n[i]=d,a[l]++}return n}const D$=(e,t)=>{const n=bi.createTransformer(t),a=Hu(e),i=Hu(t);return a.indexes.var.length===i.indexes.var.length&&a.indexes.color.length===i.indexes.color.length&&a.indexes.number.length>=i.indexes.number.length?a0.has(e)&&!i.values.length||a0.has(t)&&!a.values.length?R$(e,t):rd(IP(M$(a,i),i.values),n):jh(e,t)};function zP(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?hn(e,t,n):Vw(e)(e,t)}const P$=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>rn.update(t,n),stop:()=>qa(t),now:()=>Fn.isProcessing?Fn.timestamp:nr.now()}},FP=(e,t,n=10)=>{let a="";const i=Math.max(Math.round(t/n),2);for(let l=0;l<i;l++)a+=Math.round(e(l/(i-1))*1e4)/1e4+", ";return`linear(${a.substring(0,a.length-2)})`},Nh=2e4;function $w(e){let t=0;const n=50;let a=e.next(t);for(;!a.done&&t<Nh;)t+=n,a=e.next(t);return t>=Nh?1/0:t}function k$(e,t=100,n){const a=n({...e,keyframes:[0,t]}),i=Math.min($w(a),Nh);return{type:"keyframes",ease:l=>a.next(i*l).value/t,duration:Yr(i)}}const L$=5;function HP(e,t,n){const a=Math.max(t-L$,0);return yP(n-e(a),t-a)}const vn={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},yv=.001;function B$({duration:e=vn.duration,bounce:t=vn.bounce,velocity:n=vn.velocity,mass:a=vn.mass}){let i,l,u=1-t;u=Ua(vn.minDamping,vn.maxDamping,u),e=Ua(vn.minDuration,vn.maxDuration,Yr(e)),u<1?(i=p=>{const v=p*u,m=v*e,b=v-n,w=s0(p,u),C=Math.exp(-m);return yv-b/w*C},l=p=>{const m=p*u*e,b=m*n+n,w=Math.pow(u,2)*Math.pow(p,2)*e,C=Math.exp(-m),S=s0(Math.pow(p,2),u);return(-i(p)+yv>0?-1:1)*((b-w)*C)/S}):(i=p=>{const v=Math.exp(-p*e),m=(p-n)*e+1;return-yv+v*m},l=p=>{const v=Math.exp(-p*e),m=(n-p)*(e*e);return v*m});const d=5/e,h=z$(i,l,d);if(e=ws(e),isNaN(h))return{stiffness:vn.stiffness,damping:vn.damping,duration:e};{const p=Math.pow(h,2)*a;return{stiffness:p,damping:u*2*Math.sqrt(a*p),duration:e}}}const I$=12;function z$(e,t,n){let a=n;for(let i=1;i<I$;i++)a=a-e(a)/t(a);return a}function s0(e,t){return e*Math.sqrt(1-t*t)}const F$=["duration","bounce"],H$=["stiffness","damping","mass"];function xE(e,t){return t.some(n=>e[n]!==void 0)}function U$(e){let t={velocity:vn.velocity,stiffness:vn.stiffness,damping:vn.damping,mass:vn.mass,isResolvedFromDuration:!1,...e};if(!xE(e,H$)&&xE(e,F$))if(e.visualDuration){const n=e.visualDuration,a=2*Math.PI/(n*1.2),i=a*a,l=2*Ua(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:vn.mass,stiffness:i,damping:l}}else{const n=B$(e);t={...t,...n,mass:vn.mass},t.isResolvedFromDuration=!0}return t}function _h(e=vn.visualDuration,t=vn.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:a,restDelta:i}=n;const l=n.keyframes[0],u=n.keyframes[n.keyframes.length-1],d={done:!1,value:l},{stiffness:h,damping:p,mass:v,duration:m,velocity:b,isResolvedFromDuration:w}=U$({...n,velocity:-Yr(n.velocity||0)}),C=b||0,S=p/(2*Math.sqrt(h*v)),j=u-l,N=Yr(Math.sqrt(h/v)),_=Math.abs(j)<5;a||(a=_?vn.restSpeed.granular:vn.restSpeed.default),i||(i=_?vn.restDelta.granular:vn.restDelta.default);let T;if(S<1){const D=s0(N,S);T=L=>{const k=Math.exp(-S*N*L);return u-k*((C+S*N*j)/D*Math.sin(D*L)+j*Math.cos(D*L))}}else if(S===1)T=D=>u-Math.exp(-N*D)*(j+(C+N*j)*D);else{const D=N*Math.sqrt(S*S-1);T=L=>{const k=Math.exp(-S*N*L),P=Math.min(D*L,300);return u-k*((C+S*N*j)*Math.sinh(P)+D*j*Math.cosh(P))/D}}const A={calculatedDuration:w&&m||null,next:D=>{const L=T(D);if(w)d.done=D>=m;else{let k=D===0?C:0;S<1&&(k=D===0?ws(C):HP(T,D,L));const P=Math.abs(k)<=a,U=Math.abs(u-L)<=i;d.done=P&&U}return d.value=d.done?u:L,d},toString:()=>{const D=Math.min($w(A),Nh),L=FP(k=>A.next(D*k).value,D,30);return D+"ms "+L},toTransition:()=>{}};return A}_h.applyToOptions=e=>{const t=k$(e,100,_h);return e.ease=t.ease,e.duration=ws(t.duration),e.type="keyframes",e};function i0({keyframes:e,velocity:t=0,power:n=.8,timeConstant:a=325,bounceDamping:i=10,bounceStiffness:l=500,modifyTarget:u,min:d,max:h,restDelta:p=.5,restSpeed:v}){const m=e[0],b={done:!1,value:m},w=P=>d!==void 0&&P<d||h!==void 0&&P>h,C=P=>d===void 0?h:h===void 0||Math.abs(d-P)<Math.abs(h-P)?d:h;let S=n*t;const j=m+S,N=u===void 0?j:u(j);N!==j&&(S=N-m);const _=P=>-S*Math.exp(-P/a),T=P=>N+_(P),A=P=>{const U=_(P),J=T(P);b.done=Math.abs(U)<=p,b.value=b.done?N:J};let D,L;const k=P=>{w(b.value)&&(D=P,L=_h({keyframes:[b.value,C(b.value)],velocity:HP(T,P,b.value),damping:i,stiffness:l,restDelta:p,restSpeed:v}))};return k(0),{calculatedDuration:null,next:P=>{let U=!1;return!L&&D===void 0&&(U=!0,A(P),k(P)),D!==void 0&&P>=D?L.next(P-D):(!U&&A(P),b)}}}function q$(e,t,n){const a=[],i=n||_s.mix||zP,l=e.length-1;for(let u=0;u<l;u++){let d=i(e[u],e[u+1]);if(t){const h=Array.isArray(t)?t[u]||Xr:t;d=rd(h,d)}a.push(d)}return a}function UP(e,t,{clamp:n=!0,ease:a,mixer:i}={}){const l=e.length;if(Lw(l===t.length),l===1)return()=>t[0];if(l===2&&t[0]===t[1])return()=>t[1];const u=e[0]===e[1];e[0]>e[l-1]&&(e=[...e].reverse(),t=[...t].reverse());const d=q$(t,a,i),h=d.length,p=v=>{if(u&&v<e[0])return t[0];let m=0;if(h>1)for(;m<e.length-2&&!(v<e[m+1]);m++);const b=zu(e[m],e[m+1],v);return d[m](b)};return n?v=>p(Ua(e[0],e[l-1],v)):p}function V$(e,t){const n=e[e.length-1];for(let a=1;a<=t;a++){const i=zu(0,t,a);e.push(hn(n,1,i))}}function $$(e){const t=[0];return V$(t,e.length-1),t}function G$(e,t){return e.map(n=>n*t)}function K$(e,t){return e.map(()=>t||TP).splice(0,e.length-1)}function Su({duration:e=300,keyframes:t,times:n,ease:a="easeInOut"}){const i=s$(a)?a.map(fE):fE(a),l={done:!1,value:t[0]},u=G$(n&&n.length===t.length?n:$$(t),e),d=UP(u,t,{ease:Array.isArray(i)?i:K$(t,i)});return{calculatedDuration:e,next:h=>(l.value=d(h),l.done=h>=e,l)}}const Y$=e=>e!==null;function Gw(e,{repeat:t,repeatType:n="loop"},a,i=1){const l=e.filter(Y$),d=i<0||t&&n!=="loop"&&t%2===1?0:l.length-1;return!d||a===void 0?l[d]:a}const W$={decay:i0,inertia:i0,tween:Su,keyframes:Su,spring:_h};function qP(e){typeof e.type=="string"&&(e.type=W$[e.type])}class Kw{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const X$=e=>e/100;class Yw extends Kw{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==nr.now()&&this.tick(nr.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;qP(t);const{type:n=Su,repeat:a=0,repeatDelay:i=0,repeatType:l,velocity:u=0}=t;let{keyframes:d}=t;const h=n||Su;h!==Su&&typeof d[0]!="number"&&(this.mixKeyframes=rd(X$,zP(d[0],d[1])),d=[0,100]);const p=h({...t,keyframes:d});l==="mirror"&&(this.mirroredGenerator=h({...t,keyframes:[...d].reverse(),velocity:-u})),p.calculatedDuration===null&&(p.calculatedDuration=$w(p));const{calculatedDuration:v}=p;this.calculatedDuration=v,this.resolvedDuration=v+i,this.totalDuration=this.resolvedDuration*(a+1)-i,this.generator=p}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:a,totalDuration:i,mixKeyframes:l,mirroredGenerator:u,resolvedDuration:d,calculatedDuration:h}=this;if(this.startTime===null)return a.next(0);const{delay:p=0,keyframes:v,repeat:m,repeatType:b,repeatDelay:w,type:C,onUpdate:S,finalKeyframe:j}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const N=this.currentTime-p*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?N<0:N>i;this.currentTime=Math.max(N,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let T=this.currentTime,A=a;if(m){const P=Math.min(this.currentTime,i)/d;let U=Math.floor(P),J=P%1;!J&&P>=1&&(J=1),J===1&&U--,U=Math.min(U,m+1),U%2&&(b==="reverse"?(J=1-J,w&&(J-=w/d)):b==="mirror"&&(A=u)),T=Ua(0,1,J)*d}const D=_?{done:!1,value:v[0]}:A.next(T);l&&(D.value=l(D.value));let{done:L}=D;!_&&h!==null&&(L=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&L);return k&&C!==i0&&(D.value=Gw(v,this.options,j,this.speed)),S&&S(D.value),k&&this.finish(),D}then(t,n){return this.finished.then(t,n)}get duration(){return Yr(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Yr(t)}get time(){return Yr(this.currentTime)}set time(t){t=ws(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(nr.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Yr(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=P$,startTime:n}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),this.options.onPlay?.();const a=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=a):this.holdTime!==null?this.startTime=a-this.holdTime:this.startTime||(this.startTime=n??a),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(nr.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function Q$(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Zi=e=>e*180/Math.PI,o0=e=>{const t=Zi(Math.atan2(e[1],e[0]));return l0(t)},Z$={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:o0,rotateZ:o0,skewX:e=>Zi(Math.atan(e[1])),skewY:e=>Zi(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},l0=e=>(e=e%360,e<0&&(e+=360),e),yE=o0,bE=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),wE=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),J$={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:bE,scaleY:wE,scale:e=>(bE(e)+wE(e))/2,rotateX:e=>l0(Zi(Math.atan2(e[6],e[5]))),rotateY:e=>l0(Zi(Math.atan2(-e[2],e[0]))),rotateZ:yE,rotate:yE,skewX:e=>Zi(Math.atan(e[4])),skewY:e=>Zi(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function c0(e){return e.includes("scale")?1:0}function u0(e,t){if(!e||e==="none")return c0(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let a,i;if(n)a=J$,i=n;else{const d=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);a=Z$,i=d}if(!i)return c0(t);const l=a[t],u=i[1].split(",").map(t7);return typeof l=="function"?l(u):u[l]}const e7=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return u0(n,t)};function t7(e){return parseFloat(e.trim())}const $l=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Gl=new Set($l),SE=e=>e===Vl||e===Be,n7=new Set(["x","y","z"]),r7=$l.filter(e=>!n7.has(e));function a7(e){const t=[];return r7.forEach(n=>{const a=e.getValue(n);a!==void 0&&(t.push([n,a.get()]),a.set(n.startsWith("scale")?1:0))}),t}const mi={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>u0(t,"x"),y:(e,{transform:t})=>u0(t,"y")};mi.translateX=mi.x;mi.translateY=mi.y;const Ji=new Set;let d0=!1,f0=!1,h0=!1;function VP(){if(f0){const e=Array.from(Ji).filter(a=>a.needsMeasurement),t=new Set(e.map(a=>a.element)),n=new Map;t.forEach(a=>{const i=a7(a);i.length&&(n.set(a,i),a.render())}),e.forEach(a=>a.measureInitialState()),t.forEach(a=>{a.render();const i=n.get(a);i&&i.forEach(([l,u])=>{a.getValue(l)?.set(u)})}),e.forEach(a=>a.measureEndState()),e.forEach(a=>{a.suspendedScrollY!==void 0&&window.scrollTo(0,a.suspendedScrollY)})}f0=!1,d0=!1,Ji.forEach(e=>e.complete(h0)),Ji.clear()}function $P(){Ji.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(f0=!0)})}function s7(){h0=!0,$P(),VP(),h0=!1}class Ww{constructor(t,n,a,i,l,u=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=a,this.motionValue=i,this.element=l,this.isAsync=u}scheduleResolve(){this.state="scheduled",this.isAsync?(Ji.add(this),d0||(d0=!0,rn.read($P),rn.resolveKeyframes(VP))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:a,motionValue:i}=this;if(t[0]===null){const l=i?.get(),u=t[t.length-1];if(l!==void 0)t[0]=l;else if(a&&n){const d=a.readValue(n,u);d!=null&&(t[0]=d)}t[0]===void 0&&(t[0]=u),i&&l===void 0&&i.set(t[0])}Q$(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ji.delete(this)}cancel(){this.state==="scheduled"&&(Ji.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const i7=e=>e.startsWith("--");function o7(e,t,n){i7(t)?e.style.setProperty(t,n):e.style[t]=n}const l7=Bw(()=>window.ScrollTimeline!==void 0),c7={};function u7(e,t){const n=Bw(e);return()=>c7[t]??n()}const GP=u7(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),lu=([e,t,n,a])=>`cubic-bezier(${e}, ${t}, ${n}, ${a})`,CE={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:lu([0,.65,.55,1]),circOut:lu([.55,0,1,.45]),backIn:lu([.31,.01,.66,-.59]),backOut:lu([.33,1.53,.69,.99])};function KP(e,t){if(e)return typeof e=="function"?GP()?FP(e,t):"ease-out":RP(e)?lu(e):Array.isArray(e)?e.map(n=>KP(n,t)||CE.easeOut):CE[e]}function d7(e,t,n,{delay:a=0,duration:i=300,repeat:l=0,repeatType:u="loop",ease:d="easeOut",times:h}={},p=void 0){const v={[t]:n};h&&(v.offset=h);const m=KP(d,i);Array.isArray(m)&&(v.easing=m);const b={delay:a,duration:i,easing:Array.isArray(m)?"linear":m,fill:"both",iterations:l+1,direction:u==="reverse"?"alternate":"normal"};return p&&(b.pseudoElement=p),e.animate(v,b)}function YP(e){return typeof e=="function"&&"applyToOptions"in e}function f7({type:e,...t}){return YP(e)&&GP()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class h7 extends Kw{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:a,keyframes:i,pseudoElement:l,allowFlatten:u=!1,finalKeyframe:d,onComplete:h}=t;this.isPseudoElement=!!l,this.allowFlatten=u,this.options=t,Lw(typeof t.type!="string");const p=f7(t);this.animation=d7(n,a,i,p,l),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!l){const v=Gw(i,this.options,d,this.speed);this.updateMotionValue?this.updateMotionValue(v):o7(n,a,v),this.animation.cancel()}h?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return Yr(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Yr(t)}get time(){return Yr(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=ws(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&l7()?(this.animation.timeline=t,Xr):n(this)}}const WP={anticipate:NP,backInOut:jP,circInOut:EP};function p7(e){return e in WP}function m7(e){typeof e.ease=="string"&&p7(e.ease)&&(e.ease=WP[e.ease])}const bv=10;class g7 extends h7{constructor(t){m7(t),qP(t),super(t),t.startTime!==void 0&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:a,onComplete:i,element:l,...u}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const d=new Yw({...u,autoplay:!1}),h=Math.max(bv,nr.now()-this.startTime),p=Ua(0,bv,h-bv);n.setWithVelocity(d.sample(Math.max(0,h-p)).value,d.sample(h).value,p),d.stop()}}const jE=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(bi.test(e)||e==="0")&&!e.startsWith("url("));function v7(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function x7(e,t,n,a){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const l=e[e.length-1],u=jE(i,t),d=jE(l,t);return!u||!d?!1:v7(e)||(n==="spring"||YP(n))&&a}function p0(e){e.duration=0,e.type="keyframes"}const y7=new Set(["opacity","clipPath","filter","transform"]),b7=Bw(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function w7(e){const{motionValue:t,name:n,repeatDelay:a,repeatType:i,damping:l,type:u}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:p}=t.owner.getProps();return b7()&&n&&y7.has(n)&&(n!=="transform"||!p)&&!h&&!a&&i!=="mirror"&&l!==0&&u!=="inertia"}const S7=40;class C7 extends Kw{constructor({autoplay:t=!0,delay:n=0,type:a="keyframes",repeat:i=0,repeatDelay:l=0,repeatType:u="loop",keyframes:d,name:h,motionValue:p,element:v,...m}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=nr.now();const b={autoplay:t,delay:n,type:a,repeat:i,repeatDelay:l,repeatType:u,name:h,motionValue:p,element:v,...m},w=v?.KeyframeResolver||Ww;this.keyframeResolver=new w(d,(C,S,j)=>this.onKeyframesResolved(C,S,b,!j),h,p,v),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,n,a,i){this.keyframeResolver=void 0;const{name:l,type:u,velocity:d,delay:h,isHandoff:p,onUpdate:v}=a;this.resolvedAt=nr.now(),x7(t,l,u,d)||((_s.instantAnimations||!h)&&v?.(Gw(t,a,n)),t[0]=t[t.length-1],p0(a),a.repeat=0);const b={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>S7?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...a,keyframes:t},w=!p&&w7(b),C=b.motionValue?.owner?.current,S=w?new g7({...b,element:C}):new Yw(b);S.finished.then(()=>{this.notifyFinished()}).catch(Xr),this.pendingTimeline&&(this.stopTimeline=S.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=S}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),s7()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function XP(e,t,n,a=0,i=1){const l=Array.from(e).sort((p,v)=>p.sortNodePosition(v)).indexOf(t),u=e.size,d=(u-1)*a;return typeof n=="function"?n(l,u):i===1?l*a:d-l*a}const j7=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function N7(e){const t=j7.exec(e);if(!t)return[,];const[,n,a,i]=t;return[`--${n??a}`,i]}function QP(e,t,n=1){const[a,i]=N7(e);if(!a)return;const l=window.getComputedStyle(t).getPropertyValue(a);if(l){const u=l.trim();return gP(u)?parseFloat(u):u}return Hw(i)?QP(i,t,n+1):i}const _7={type:"spring",stiffness:500,damping:25,restSpeed:10},E7=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),T7={type:"keyframes",duration:.8},R7={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},A7=(e,{keyframes:t})=>t.length>2?T7:Gl.has(e)?e.startsWith("scale")?E7(t[1]):_7:R7,O7=e=>e!==null;function M7(e,{repeat:t,repeatType:n="loop"},a){const i=e.filter(O7),l=t&&n!=="loop"&&t%2===1?0:i.length-1;return i[l]}function Xw(e,t){return e?.[t]??e?.default??e}function D7({when:e,delay:t,delayChildren:n,staggerChildren:a,staggerDirection:i,repeat:l,repeatType:u,repeatDelay:d,from:h,elapsed:p,...v}){return!!Object.keys(v).length}const Qw=(e,t,n,a={},i,l)=>u=>{const d=Xw(a,e)||{},h=d.delay||a.delay||0;let{elapsed:p=0}=a;p=p-ws(h);const v={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...d,delay:-p,onUpdate:b=>{t.set(b),d.onUpdate&&d.onUpdate(b)},onComplete:()=>{u(),d.onComplete&&d.onComplete()},name:e,motionValue:t,element:l?void 0:i};D7(d)||Object.assign(v,A7(e,v)),v.duration&&(v.duration=ws(v.duration)),v.repeatDelay&&(v.repeatDelay=ws(v.repeatDelay)),v.from!==void 0&&(v.keyframes[0]=v.from);let m=!1;if((v.type===!1||v.duration===0&&!v.repeatDelay)&&(p0(v),v.delay===0&&(m=!0)),(_s.instantAnimations||_s.skipAnimations)&&(m=!0,p0(v),v.delay=0),v.allowFlatten=!d.type&&!d.ease,m&&!l&&t.get()!==void 0){const b=M7(v.keyframes,d);if(b!==void 0){rn.update(()=>{v.onUpdate(b),v.onComplete()});return}}return d.isSync?new Yw(v):new C7(v)};function NE(e){const t=[{},{}];return e?.values.forEach((n,a)=>{t[0][a]=n.get(),t[1][a]=n.getVelocity()}),t}function Zw(e,t,n,a){if(typeof t=="function"){const[i,l]=NE(a);t=t(n!==void 0?n:e.custom,i,l)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,l]=NE(a);t=t(n!==void 0?n:e.custom,i,l)}return t}function Nl(e,t,n){const a=e.getProps();return Zw(a,t,n!==void 0?n:a.custom,e)}const ZP=new Set(["width","height","top","left","right","bottom",...$l]),_E=30,P7=e=>!isNaN(parseFloat(e)),Cu={current:void 0};class k7{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=a=>{const i=nr.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(a),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const l of this.dependents)l.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=nr.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=P7(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Iw);const a=this.events[t].add(n);return t==="change"?()=>{a(),rn.read(()=>{this.events.change.getSize()||this.stop()})}:a}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,a){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-a}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return Cu.current&&Cu.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=nr.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>_E)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,_E);return yP(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function no(e,t){return new k7(e,t)}const m0=e=>Array.isArray(e);function L7(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,no(n))}function B7(e){return m0(e)?e[e.length-1]||0:e}function I7(e,t){const n=Nl(e,t);let{transitionEnd:a={},transition:i={},...l}=n||{};l={...l,...a};for(const u in l){const d=B7(l[u]);L7(e,u,d)}}const Qn=e=>!!(e&&e.getVelocity);function z7(e){return!!(Qn(e)&&e.add)}function g0(e,t){const n=e.getValue("willChange");if(z7(n))return n.add(t);if(!n&&_s.WillChange){const a=new _s.WillChange("auto");e.addValue("willChange",a),a.add(t)}}function Jw(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const F7="framerAppearId",JP="data-"+Jw(F7);function ek(e){return e.props[JP]}function H7({protectedKeys:e,needsAnimating:t},n){const a=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,a}function tk(e,t,{delay:n=0,transitionOverride:a,type:i}={}){let{transition:l=e.getDefaultTransition(),transitionEnd:u,...d}=t;a&&(l=a);const h=[],p=i&&e.animationState&&e.animationState.getState()[i];for(const v in d){const m=e.getValue(v,e.latestValues[v]??null),b=d[v];if(b===void 0||p&&H7(p,v))continue;const w={delay:n,...Xw(l||{},v)},C=m.get();if(C!==void 0&&!m.isAnimating&&!Array.isArray(b)&&b===C&&!w.velocity)continue;let S=!1;if(window.MotionHandoffAnimation){const N=ek(e);if(N){const _=window.MotionHandoffAnimation(N,v,rn);_!==null&&(w.startTime=_,S=!0)}}g0(e,v),m.start(Qw(v,m,b,e.shouldReduceMotion&&ZP.has(v)?{type:!1}:w,e,S));const j=m.animation;j&&h.push(j)}return u&&Promise.all(h).then(()=>{rn.update(()=>{u&&I7(e,u)})}),h}function v0(e,t,n={}){const a=Nl(e,t,n.type==="exit"?e.presenceContext?.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=a||{};n.transitionOverride&&(i=n.transitionOverride);const l=a?()=>Promise.all(tk(e,a,n)):()=>Promise.resolve(),u=e.variantChildren&&e.variantChildren.size?(h=0)=>{const{delayChildren:p=0,staggerChildren:v,staggerDirection:m}=i;return U7(e,t,h,p,v,m,n)}:()=>Promise.resolve(),{when:d}=i;if(d){const[h,p]=d==="beforeChildren"?[l,u]:[u,l];return h().then(()=>p())}else return Promise.all([l(),u(n.delay)])}function U7(e,t,n=0,a=0,i=0,l=1,u){const d=[];for(const h of e.variantChildren)h.notify("AnimationStart",t),d.push(v0(h,t,{...u,delay:n+(typeof a=="function"?0:a)+XP(e.variantChildren,h,a,i,l)}).then(()=>h.notify("AnimationComplete",t)));return Promise.all(d)}function q7(e,t,n={}){e.notify("AnimationStart",t);let a;if(Array.isArray(t)){const i=t.map(l=>v0(e,l,n));a=Promise.all(i)}else if(typeof t=="string")a=v0(e,t,n);else{const i=typeof t=="function"?Nl(e,t,n.custom):t;a=Promise.all(tk(e,i,n))}return a.then(()=>{e.notify("AnimationComplete",t)})}const V7={test:e=>e==="auto",parse:e=>e},nk=e=>t=>t.test(e),rk=[Vl,Be,Ia,ui,x$,v$,V7],EE=e=>rk.find(nk(e));function $7(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||xP(e):!0}const G7=new Set(["brightness","contrast","saturate","opacity"]);function K7(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[a]=n.match(Uw)||[];if(!a)return e;const i=n.replace(a,"");let l=G7.has(t)?1:0;return a!==n&&(l*=100),t+"("+l+i+")"}const Y7=/\b([a-z-]*)\(.*?\)/gu,x0={...bi,getAnimatableNone:e=>{const t=e.match(Y7);return t?t.map(K7).join(" "):e}},TE={...Vl,transform:Math.round},W7={rotate:ui,rotateX:ui,rotateY:ui,rotateZ:ui,scale:$f,scaleX:$f,scaleY:$f,scaleZ:$f,skew:ui,skewX:ui,skewY:ui,distance:Be,translateX:Be,translateY:Be,translateZ:Be,x:Be,y:Be,z:Be,perspective:Be,transformPerspective:Be,opacity:Fu,originX:pE,originY:pE,originZ:Be},eS={borderWidth:Be,borderTopWidth:Be,borderRightWidth:Be,borderBottomWidth:Be,borderLeftWidth:Be,borderRadius:Be,radius:Be,borderTopLeftRadius:Be,borderTopRightRadius:Be,borderBottomRightRadius:Be,borderBottomLeftRadius:Be,width:Be,maxWidth:Be,height:Be,maxHeight:Be,top:Be,right:Be,bottom:Be,left:Be,inset:Be,insetBlock:Be,insetBlockStart:Be,insetBlockEnd:Be,insetInline:Be,insetInlineStart:Be,insetInlineEnd:Be,padding:Be,paddingTop:Be,paddingRight:Be,paddingBottom:Be,paddingLeft:Be,paddingBlock:Be,paddingBlockStart:Be,paddingBlockEnd:Be,paddingInline:Be,paddingInlineStart:Be,paddingInlineEnd:Be,margin:Be,marginTop:Be,marginRight:Be,marginBottom:Be,marginLeft:Be,marginBlock:Be,marginBlockStart:Be,marginBlockEnd:Be,marginInline:Be,marginInlineStart:Be,marginInlineEnd:Be,backgroundPositionX:Be,backgroundPositionY:Be,...W7,zIndex:TE,fillOpacity:Fu,strokeOpacity:Fu,numOctaves:TE},X7={...eS,color:Nn,backgroundColor:Nn,outlineColor:Nn,fill:Nn,stroke:Nn,borderColor:Nn,borderTopColor:Nn,borderRightColor:Nn,borderBottomColor:Nn,borderLeftColor:Nn,filter:x0,WebkitFilter:x0},ak=e=>X7[e];function sk(e,t){let n=ak(e);return n!==x0&&(n=bi),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Q7=new Set(["auto","none","0"]);function Z7(e,t,n){let a=0,i;for(;a<e.length&&!i;){const l=e[a];typeof l=="string"&&!Q7.has(l)&&Hu(l).values.length&&(i=e[a]),a++}if(i&&n)for(const l of t)e[l]=sk(n,i)}class J7 extends Ww{constructor(t,n,a,i,l){super(t,n,a,i,l,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:a}=this;if(!n||!n.current)return;super.readKeyframes();for(let v=0;v<t.length;v++){let m=t[v];if(typeof m=="string"&&(m=m.trim(),Hw(m))){const b=QP(m,n.current);b!==void 0&&(t[v]=b),v===t.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!ZP.has(a)||t.length!==2)return;const[i,l]=t,u=EE(i),d=EE(l),h=hE(i),p=hE(l);if(h!==p&&mi[a]){this.needsMeasurement=!0;return}if(u!==d)if(SE(u)&&SE(d))for(let v=0;v<t.length;v++){const m=t[v];typeof m=="string"&&(t[v]=parseFloat(m))}else mi[a]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,a=[];for(let i=0;i<t.length;i++)(t[i]===null||$7(t[i]))&&a.push(i);a.length&&Z7(t,a,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:a}=this;if(!t||!t.current)return;a==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=mi[a](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&t.getValue(a,i).jump(i,!1)}measureEndState(){const{element:t,name:n,unresolvedKeyframes:a}=this;if(!t||!t.current)return;const i=t.getValue(n);i&&i.jump(this.measuredOrigin,!1);const l=a.length-1,u=a[l];a[l]=mi[n](t.measureViewportBox(),window.getComputedStyle(t.current)),u!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=u),this.removedTransforms?.length&&this.removedTransforms.forEach(([d,h])=>{t.getValue(d).set(h)}),this.resolveNoneKeyframes()}}function eG(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let a=document;const i=n?.[e]??a.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}const ik=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function tG(e){return vP(e)&&"offsetHeight"in e}const{schedule:tS}=AP(queueMicrotask,!1),oa={x:!1,y:!1};function ok(){return oa.x||oa.y}function nG(e){return e==="x"||e==="y"?oa[e]?null:(oa[e]=!0,()=>{oa[e]=!1}):oa.x||oa.y?null:(oa.x=oa.y=!0,()=>{oa.x=oa.y=!1})}function lk(e,t){const n=eG(e),a=new AbortController,i={passive:!0,...t,signal:a.signal};return[n,i,()=>a.abort()]}function RE(e){return!(e.pointerType==="touch"||ok())}function rG(e,t,n={}){const[a,i,l]=lk(e,n),u=d=>{if(!RE(d))return;const{target:h}=d,p=t(h,d);if(typeof p!="function"||!h)return;const v=m=>{RE(m)&&(p(m),h.removeEventListener("pointerleave",v))};h.addEventListener("pointerleave",v,i)};return a.forEach(d=>{d.addEventListener("pointerenter",u,i)}),l}const ck=(e,t)=>t?e===t?!0:ck(e,t.parentElement):!1,nS=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,aG=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function uk(e){return aG.has(e.tagName)||e.isContentEditable===!0}const ih=new WeakSet;function AE(e){return t=>{t.key==="Enter"&&e(t)}}function wv(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const sG=(e,t)=>{const n=e.currentTarget;if(!n)return;const a=AE(()=>{if(ih.has(n))return;wv(n,"down");const i=AE(()=>{wv(n,"up")}),l=()=>wv(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",l,t)});n.addEventListener("keydown",a,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",a),t)};function OE(e){return nS(e)&&!ok()}function iG(e,t,n={}){const[a,i,l]=lk(e,n),u=d=>{const h=d.currentTarget;if(!OE(d))return;ih.add(h);const p=t(h,d),v=(w,C)=>{window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",b),ih.has(h)&&ih.delete(h),OE(w)&&typeof p=="function"&&p(w,{success:C})},m=w=>{v(w,h===window||h===document||n.useGlobalTarget||ck(h,w.target))},b=w=>{v(w,!1)};window.addEventListener("pointerup",m,i),window.addEventListener("pointercancel",b,i)};return a.forEach(d=>{(n.useGlobalTarget?window:d).addEventListener("pointerdown",u,i),tG(d)&&(d.addEventListener("focus",p=>sG(p,i)),!uk(d)&&!d.hasAttribute("tabindex")&&(d.tabIndex=0))}),l}function dk(e){return vP(e)&&"ownerSVGElement"in e}function oG(e){return dk(e)&&e.tagName==="svg"}function lG(...e){const t=!Array.isArray(e[0]),n=t?0:-1,a=e[0+n],i=e[1+n],l=e[2+n],u=e[3+n],d=UP(i,l,u);return t?d(a):d}const cG=[...rk,Nn,bi],uG=e=>cG.find(nk(e)),ME=()=>({translate:0,scale:1,origin:0,originPoint:0}),yl=()=>({x:ME(),y:ME()}),DE=()=>({min:0,max:0}),Rn=()=>({x:DE(),y:DE()}),y0={current:null},fk={current:!1},dG=typeof window<"u";function fG(){if(fk.current=!0,!!dG)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>y0.current=e.matches;e.addEventListener("change",t),t()}else y0.current=!1}const hG=new WeakMap;function fp(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Uu(e){return typeof e=="string"||Array.isArray(e)}const rS=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],aS=["initial",...rS];function hp(e){return fp(e.animate)||aS.some(t=>Uu(e[t]))}function hk(e){return!!(hp(e)||e.variants)}function pG(e,t,n){for(const a in t){const i=t[a],l=n[a];if(Qn(i))e.addValue(a,i);else if(Qn(l))e.addValue(a,no(i,{owner:e}));else if(l!==i)if(e.hasValue(a)){const u=e.getValue(a);u.liveStyle===!0?u.jump(i):u.hasAnimated||u.set(i)}else{const u=e.getStaticValue(a);e.addValue(a,no(u!==void 0?u:i,{owner:e}))}}for(const a in n)t[a]===void 0&&e.removeValue(a);return t}const PE=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Eh={};function pk(e){Eh=e}function mG(){return Eh}class gG{scrapeMotionValuesFromProps(t,n,a){return{}}constructor({parent:t,props:n,presenceContext:a,reducedMotionConfig:i,blockInitialAnimation:l,visualState:u},d={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Ww,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const b=nr.now();this.renderScheduledAt<b&&(this.renderScheduledAt=b,rn.render(this.render,!1,!0))};const{latestValues:h,renderState:p}=u;this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=p,this.parent=t,this.props=n,this.presenceContext=a,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=d,this.blockInitialAnimation=!!l,this.isControllingVariants=hp(n),this.isVariantNode=hk(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:v,...m}=this.scrapeMotionValuesFromProps(n,{},this);for(const b in m){const w=m[b];h[b]!==void 0&&Qn(w)&&w.set(h[b])}}mount(t){this.current=t,hG.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,a)=>this.bindToMotionValue(a,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(fk.current||fG(),this.shouldReduceMotion=y0.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),qa(this.notifyUpdate),qa(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const a=Gl.has(t);a&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",u=>{this.latestValues[t]=u,this.props.onUpdate&&rn.preRender(this.notifyUpdate),a&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let l;typeof window<"u"&&window.MotionCheckAppearSync&&(l=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),l&&l(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Eh){const n=Eh[t];if(!n)continue;const{isEnabled:a,Feature:i}=n;if(!this.features[t]&&i&&a(this.props)&&(this.features[t]=new i(this)),this.features[t]){const l=this.features[t];l.isMounted?l.update():(l.mount(),l.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Rn()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let a=0;a<PE.length;a++){const i=PE[a];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const l="on"+i,u=t[l];u&&(this.propEventSubscriptions[i]=this.on(i,u))}this.prevMotionValues=pG(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const a=this.values.get(t);n!==a&&(a&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let a=this.values.get(t);return a===void 0&&n!==void 0&&(a=no(n===null?void 0:n,{owner:this}),this.addValue(t,a)),a}readValue(t,n){let a=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return a!=null&&(typeof a=="string"&&(gP(a)||xP(a))?a=parseFloat(a):!uG(a)&&bi.test(n)&&(a=sk(t,n)),this.setBaseTarget(t,Qn(a)?a.get():a)),Qn(a)?a.get():a}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){const{initial:n}=this.props;let a;if(typeof n=="string"||typeof n=="object"){const l=Zw(this.props,n,this.presenceContext?.custom);l&&(a=l[t])}if(n&&a!==void 0)return a;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!Qn(i)?i:this.initialValues[t]!==void 0&&a===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new Iw),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){tS.render(this.render)}}class mk extends gG{constructor(){super(...arguments),this.KeyframeResolver=J7}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const a=t.style;return a?a[n]:void 0}removeValueFromRenderState(t,{vars:n,style:a}){delete n[t],delete a[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Qn(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class ji{constructor(t){this.isMounted=!1,this.node=t}update(){}}function gk({top:e,left:t,right:n,bottom:a}){return{x:{min:t,max:n},y:{min:e,max:a}}}function vG({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function xG(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),a=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:a.y,right:a.x}}function Sv(e){return e===void 0||e===1}function b0({scale:e,scaleX:t,scaleY:n}){return!Sv(e)||!Sv(t)||!Sv(n)}function Wi(e){return b0(e)||vk(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function vk(e){return kE(e.x)||kE(e.y)}function kE(e){return e&&e!=="0%"}function Th(e,t,n){const a=e-n,i=t*a;return n+i}function LE(e,t,n,a,i){return i!==void 0&&(e=Th(e,i,a)),Th(e,n,a)+t}function w0(e,t=0,n=1,a,i){e.min=LE(e.min,t,n,a,i),e.max=LE(e.max,t,n,a,i)}function xk(e,{x:t,y:n}){w0(e.x,t.translate,t.scale,t.originPoint),w0(e.y,n.translate,n.scale,n.originPoint)}const BE=.999999999999,IE=1.0000000000001;function yG(e,t,n,a=!1){const i=n.length;if(!i)return;t.x=t.y=1;let l,u;for(let d=0;d<i;d++){l=n[d],u=l.projectionDelta;const{visualElement:h}=l.options;h&&h.props.style&&h.props.style.display==="contents"||(a&&l.options.layoutScroll&&l.scroll&&l!==l.root&&wl(e,{x:-l.scroll.offset.x,y:-l.scroll.offset.y}),u&&(t.x*=u.x.scale,t.y*=u.y.scale,xk(e,u)),a&&Wi(l.latestValues)&&wl(e,l.latestValues))}t.x<IE&&t.x>BE&&(t.x=1),t.y<IE&&t.y>BE&&(t.y=1)}function bl(e,t){e.min=e.min+t,e.max=e.max+t}function zE(e,t,n,a,i=.5){const l=hn(e.min,e.max,i);w0(e,t,n,l,a)}function wl(e,t){zE(e.x,t.x,t.scaleX,t.scale,t.originX),zE(e.y,t.y,t.scaleY,t.scale,t.originY)}function yk(e,t){return gk(xG(e.getBoundingClientRect(),t))}function bG(e,t,n){const a=yk(e,n),{scroll:i}=t;return i&&(bl(a.x,i.offset.x),bl(a.y,i.offset.y)),a}const wG={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},SG=$l.length;function CG(e,t,n){let a="",i=!0;for(let l=0;l<SG;l++){const u=$l[l],d=e[u];if(d===void 0)continue;let h=!0;if(typeof d=="number"?h=d===(u.startsWith("scale")?1:0):h=parseFloat(d)===0,!h||n){const p=ik(d,eS[u]);if(!h){i=!1;const v=wG[u]||u;a+=`${v}(${p}) `}n&&(t[u]=p)}}return a=a.trim(),n?a=n(t,i?"":a):i&&(a="none"),a}function sS(e,t,n){const{style:a,vars:i,transformOrigin:l}=e;let u=!1,d=!1;for(const h in t){const p=t[h];if(Gl.has(h)){u=!0;continue}else if(MP(h)){i[h]=p;continue}else{const v=ik(p,eS[h]);h.startsWith("origin")?(d=!0,l[h]=v):a[h]=v}}if(t.transform||(u||n?a.transform=CG(t,e.transform,n):a.transform&&(a.transform="none")),d){const{originX:h="50%",originY:p="50%",originZ:v=0}=l;a.transformOrigin=`${h} ${p} ${v}`}}function bk(e,{style:t,vars:n},a,i){const l=e.style;let u;for(u in t)l[u]=t[u];i?.applyProjectionStyles(l,a);for(u in n)l.setProperty(u,n[u])}function FE(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const au={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Be.test(e))e=parseFloat(e);else return e;const n=FE(e,t.target.x),a=FE(e,t.target.y);return`${n}% ${a}%`}},jG={correct:(e,{treeScale:t,projectionDelta:n})=>{const a=e,i=bi.parse(e);if(i.length>5)return a;const l=bi.createTransformer(e),u=typeof i[0]!="number"?1:0,d=n.x.scale*t.x,h=n.y.scale*t.y;i[0+u]/=d,i[1+u]/=h;const p=hn(d,h,.5);return typeof i[2+u]=="number"&&(i[2+u]/=p),typeof i[3+u]=="number"&&(i[3+u]/=p),l(i)}},S0={borderRadius:{...au,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:au,borderTopRightRadius:au,borderBottomLeftRadius:au,borderBottomRightRadius:au,boxShadow:jG};function wk(e,{layout:t,layoutId:n}){return Gl.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!S0[e]||e==="opacity")}function iS(e,t,n){const a=e.style,i=t?.style,l={};if(!a)return l;for(const u in a)(Qn(a[u])||i&&Qn(i[u])||wk(u,e)||n?.getValue(u)?.liveStyle!==void 0)&&(l[u]=a[u]);return l}function NG(e){return window.getComputedStyle(e)}class _G extends mk{constructor(){super(...arguments),this.type="html",this.renderInstance=bk}readValueFromInstance(t,n){if(Gl.has(n))return this.projection?.isProjecting?c0(n):e7(t,n);{const a=NG(t),i=(MP(n)?a.getPropertyValue(n):a[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return yk(t,n)}build(t,n,a){sS(t,n,a.transformTemplate)}scrapeMotionValuesFromProps(t,n,a){return iS(t,n,a)}}const EG={offset:"stroke-dashoffset",array:"stroke-dasharray"},TG={offset:"strokeDashoffset",array:"strokeDasharray"};function RG(e,t,n=1,a=0,i=!0){e.pathLength=1;const l=i?EG:TG;e[l.offset]=Be.transform(-a);const u=Be.transform(t),d=Be.transform(n);e[l.array]=`${u} ${d}`}const AG=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Sk(e,{attrX:t,attrY:n,attrScale:a,pathLength:i,pathSpacing:l=1,pathOffset:u=0,...d},h,p,v){if(sS(e,d,p),h){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:m,style:b}=e;m.transform&&(b.transform=m.transform,delete m.transform),(b.transform||m.transformOrigin)&&(b.transformOrigin=m.transformOrigin??"50% 50%",delete m.transformOrigin),b.transform&&(b.transformBox=v?.transformBox??"fill-box",delete m.transformBox);for(const w of AG)m[w]!==void 0&&(b[w]=m[w],delete m[w]);t!==void 0&&(m.x=t),n!==void 0&&(m.y=n),a!==void 0&&(m.scale=a),i!==void 0&&RG(m,i,l,u,!1)}const Ck=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),jk=e=>typeof e=="string"&&e.toLowerCase()==="svg";function OG(e,t,n,a){bk(e,t,void 0,a);for(const i in t.attrs)e.setAttribute(Ck.has(i)?i:Jw(i),t.attrs[i])}function Nk(e,t,n){const a=iS(e,t,n);for(const i in e)if(Qn(e[i])||Qn(t[i])){const l=$l.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;a[l]=e[i]}return a}class MG extends mk{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Rn}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Gl.has(n)){const a=ak(n);return a&&a.default||0}return n=Ck.has(n)?n:Jw(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,a){return Nk(t,n,a)}build(t,n,a){Sk(t,n,this.isSVGTag,a.transformTemplate,a.style)}renderInstance(t,n,a,i){OG(t,n,a,i)}mount(t){this.isSVGTag=jk(t.tagName),super.mount(t)}}const DG=aS.length;function _k(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?_k(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<DG;n++){const a=aS[n],i=e.props[a];(Uu(i)||i===!1)&&(t[a]=i)}return t}function Ek(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let a=0;a<n;a++)if(t[a]!==e[a])return!1;return!0}const PG=[...rS].reverse(),kG=rS.length;function LG(e){return t=>Promise.all(t.map(({animation:n,options:a})=>q7(e,n,a)))}function BG(e){let t=LG(e),n=HE(),a=!0;const i=h=>(p,v)=>{const m=Nl(e,v,h==="exit"?e.presenceContext?.custom:void 0);if(m){const{transition:b,transitionEnd:w,...C}=m;p={...p,...C,...w}}return p};function l(h){t=h(e)}function u(h){const{props:p}=e,v=_k(e.parent)||{},m=[],b=new Set;let w={},C=1/0;for(let j=0;j<kG;j++){const N=PG[j],_=n[N],T=p[N]!==void 0?p[N]:v[N],A=Uu(T),D=N===h?_.isActive:null;D===!1&&(C=j);let L=T===v[N]&&T!==p[N]&&A;if(L&&a&&e.manuallyAnimateOnMount&&(L=!1),_.protectedKeys={...w},!_.isActive&&D===null||!T&&!_.prevProp||fp(T)||typeof T=="boolean")continue;const k=IG(_.prevProp,T);let P=k||N===h&&_.isActive&&!L&&A||j>C&&A,U=!1;const J=Array.isArray(T)?T:[T];let $=J.reduce(i(N),{});D===!1&&($={});const{prevResolvedValues:W={}}=_,pe={...W,...$},Se=q=>{P=!0,b.has(q)&&(U=!0,b.delete(q)),_.needsAnimating[q]=!0;const H=e.getValue(q);H&&(H.liveStyle=!1)};for(const q in pe){const H=$[q],be=W[q];if(w.hasOwnProperty(q))continue;let Ne=!1;m0(H)&&m0(be)?Ne=!Ek(H,be):Ne=H!==be,Ne?H!=null?Se(q):b.add(q):H!==void 0&&b.has(q)?Se(q):_.protectedKeys[q]=!0}_.prevProp=T,_.prevResolvedValues=$,_.isActive&&(w={...w,...$}),a&&e.blockInitialAnimation&&(P=!1);const Ce=L&&k;P&&(!Ce||U)&&m.push(...J.map(q=>{const H={type:N};if(typeof q=="string"&&a&&!Ce&&e.manuallyAnimateOnMount&&e.parent){const{parent:be}=e,Ne=Nl(be,q);if(be.enteringChildren&&Ne){const{delayChildren:B}=Ne.transition||{};H.delay=XP(be.enteringChildren,e,B)}}return{animation:q,options:H}}))}if(b.size){const j={};if(typeof p.initial!="boolean"){const N=Nl(e,Array.isArray(p.initial)?p.initial[0]:p.initial);N&&N.transition&&(j.transition=N.transition)}b.forEach(N=>{const _=e.getBaseTarget(N),T=e.getValue(N);T&&(T.liveStyle=!0),j[N]=_??null}),m.push({animation:j})}let S=!!m.length;return a&&(p.initial===!1||p.initial===p.animate)&&!e.manuallyAnimateOnMount&&(S=!1),a=!1,S?t(m):Promise.resolve()}function d(h,p){if(n[h].isActive===p)return Promise.resolve();e.variantChildren?.forEach(m=>m.animationState?.setActive(h,p)),n[h].isActive=p;const v=u(h);for(const m in n)n[m].protectedKeys={};return v}return{animateChanges:u,setActive:d,setAnimateFunction:l,getState:()=>n,reset:()=>{n=HE()}}}function IG(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Ek(t,e):!1}function Ki(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function HE(){return{animate:Ki(!0),whileInView:Ki(),whileHover:Ki(),whileTap:Ki(),whileDrag:Ki(),whileFocus:Ki(),exit:Ki()}}function UE(e,t){e.min=t.min,e.max=t.max}function sa(e,t){UE(e.x,t.x),UE(e.y,t.y)}function qE(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const Tk=1e-4,zG=1-Tk,FG=1+Tk,Rk=.01,HG=0-Rk,UG=0+Rk;function rr(e){return e.max-e.min}function qG(e,t,n){return Math.abs(e-t)<=n}function VE(e,t,n,a=.5){e.origin=a,e.originPoint=hn(t.min,t.max,e.origin),e.scale=rr(n)/rr(t),e.translate=hn(n.min,n.max,e.origin)-e.originPoint,(e.scale>=zG&&e.scale<=FG||isNaN(e.scale))&&(e.scale=1),(e.translate>=HG&&e.translate<=UG||isNaN(e.translate))&&(e.translate=0)}function ju(e,t,n,a){VE(e.x,t.x,n.x,a?a.originX:void 0),VE(e.y,t.y,n.y,a?a.originY:void 0)}function $E(e,t,n){e.min=n.min+t.min,e.max=e.min+rr(t)}function VG(e,t,n){$E(e.x,t.x,n.x),$E(e.y,t.y,n.y)}function GE(e,t,n){e.min=t.min-n.min,e.max=e.min+rr(t)}function Rh(e,t,n){GE(e.x,t.x,n.x),GE(e.y,t.y,n.y)}function KE(e,t,n,a,i){return e-=t,e=Th(e,1/n,a),i!==void 0&&(e=Th(e,1/i,a)),e}function $G(e,t=0,n=1,a=.5,i,l=e,u=e){if(Ia.test(t)&&(t=parseFloat(t),t=hn(u.min,u.max,t/100)-u.min),typeof t!="number")return;let d=hn(l.min,l.max,a);e===l&&(d-=t),e.min=KE(e.min,t,n,d,i),e.max=KE(e.max,t,n,d,i)}function YE(e,t,[n,a,i],l,u){$G(e,t[n],t[a],t[i],t.scale,l,u)}const GG=["x","scaleX","originX"],KG=["y","scaleY","originY"];function WE(e,t,n,a){YE(e.x,t,GG,n?n.x:void 0,a?a.x:void 0),YE(e.y,t,KG,n?n.y:void 0,a?a.y:void 0)}function XE(e){return e.translate===0&&e.scale===1}function Ak(e){return XE(e.x)&&XE(e.y)}function QE(e,t){return e.min===t.min&&e.max===t.max}function YG(e,t){return QE(e.x,t.x)&&QE(e.y,t.y)}function ZE(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Ok(e,t){return ZE(e.x,t.x)&&ZE(e.y,t.y)}function JE(e){return rr(e.x)/rr(e.y)}function eT(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Gr(e){return[e("x"),e("y")]}function WG(e,t,n){let a="";const i=e.x.translate/t.x,l=e.y.translate/t.y,u=n?.z||0;if((i||l||u)&&(a=`translate3d(${i}px, ${l}px, ${u}px) `),(t.x!==1||t.y!==1)&&(a+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:p,rotate:v,rotateX:m,rotateY:b,skewX:w,skewY:C}=n;p&&(a=`perspective(${p}px) ${a}`),v&&(a+=`rotate(${v}deg) `),m&&(a+=`rotateX(${m}deg) `),b&&(a+=`rotateY(${b}deg) `),w&&(a+=`skewX(${w}deg) `),C&&(a+=`skewY(${C}deg) `)}const d=e.x.scale*t.x,h=e.y.scale*t.y;return(d!==1||h!==1)&&(a+=`scale(${d}, ${h})`),a||"none"}const Mk=["TopLeft","TopRight","BottomLeft","BottomRight"],XG=Mk.length,tT=e=>typeof e=="string"?parseFloat(e):e,nT=e=>typeof e=="number"||Be.test(e);function QG(e,t,n,a,i,l){i?(e.opacity=hn(0,n.opacity??1,ZG(a)),e.opacityExit=hn(t.opacity??1,0,JG(a))):l&&(e.opacity=hn(t.opacity??1,n.opacity??1,a));for(let u=0;u<XG;u++){const d=`border${Mk[u]}Radius`;let h=rT(t,d),p=rT(n,d);if(h===void 0&&p===void 0)continue;h||(h=0),p||(p=0),h===0||p===0||nT(h)===nT(p)?(e[d]=Math.max(hn(tT(h),tT(p),a),0),(Ia.test(p)||Ia.test(h))&&(e[d]+="%")):e[d]=p}(t.rotate||n.rotate)&&(e.rotate=hn(t.rotate||0,n.rotate||0,a))}function rT(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const ZG=Dk(0,.5,_P),JG=Dk(.5,.95,Xr);function Dk(e,t,n){return a=>a<e?0:a>t?1:n(zu(e,t,a))}function eK(e,t,n){const a=Qn(e)?e:no(e);return a.start(Qw("",a,t,n)),a.animation}function qu(e,t,n,a={passive:!0}){return e.addEventListener(t,n,a),()=>e.removeEventListener(t,n)}const tK=(e,t)=>e.depth-t.depth;class nK{constructor(){this.children=[],this.isDirty=!1}add(t){Pw(this.children,t),this.isDirty=!0}remove(t){kw(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(tK),this.isDirty=!1,this.children.forEach(t)}}function rK(e,t){const n=nr.now(),a=({timestamp:i})=>{const l=i-n;l>=t&&(qa(a),e(l-t))};return rn.setup(a,!0),()=>qa(a)}function oh(e){return Qn(e)?e.get():e}class aK{constructor(){this.members=[]}add(t){Pw(this.members,t),t.scheduleRender()}remove(t){if(kw(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let a;for(let i=n;i>=0;i--){const l=this.members[i];if(l.isPresent!==!1){a=l;break}}return a?(this.promote(a),!0):!1}promote(t,n){const a=this.lead;if(t!==a&&(this.prevLead=a,this.lead=t,t.show(),a)){a.instance&&a.scheduleRender(),t.scheduleRender(),t.resumeFrom=a,n&&(t.resumeFrom.preserveOpacity=!0),a.snapshot&&(t.snapshot=a.snapshot,t.snapshot.latestValues=a.animationValues||a.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&a.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:a}=t;n.onExitComplete&&n.onExitComplete(),a&&a.options.onExitComplete&&a.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const lh={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Cv=["","X","Y","Z"],sK=1e3;let iK=0;function jv(e,t,n,a){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),a&&(a[e]=0))}function Pk(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=ek(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:l}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",rn,!(i||l))}const{parent:a}=e;a&&!a.hasCheckedOptimisedAppear&&Pk(a)}function kk({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:a,resetTransform:i}){return class{constructor(u={},d=t?.()){this.id=iK++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(cK),this.nodes.forEach(hK),this.nodes.forEach(pK),this.nodes.forEach(uK)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=d?d.root||d:this,this.path=d?[...d.path,d]:[],this.parent=d,this.depth=d?d.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new nK)}addEventListener(u,d){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Iw),this.eventHandlers.get(u).add(d)}notifyListeners(u,...d){const h=this.eventHandlers.get(u);h&&h.notify(...d)}hasListeners(u){return this.eventHandlers.has(u)}mount(u){if(this.instance)return;this.isSVG=dk(u)&&!oG(u),this.instance=u;const{layoutId:d,layout:h,visualElement:p}=this.options;if(p&&!p.current&&p.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(h||d)&&(this.isLayoutDirty=!0),e){let v,m=0;const b=()=>this.root.updateBlockedByResize=!1;rn.read(()=>{m=window.innerWidth}),e(u,()=>{const w=window.innerWidth;w!==m&&(m=w,this.root.updateBlockedByResize=!0,v&&v(),v=rK(b,250),lh.hasAnimatedSinceResize&&(lh.hasAnimatedSinceResize=!1,this.nodes.forEach(iT)))})}d&&this.root.registerSharedNode(d,this),this.options.animate!==!1&&p&&(d||h)&&this.addEventListener("didUpdate",({delta:v,hasLayoutChanged:m,hasRelativeLayoutChanged:b,layout:w})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const C=this.options.transition||p.getDefaultTransition()||yK,{onLayoutAnimationStart:S,onLayoutAnimationComplete:j}=p.getProps(),N=!this.targetLayout||!Ok(this.targetLayout,w),_=!m&&b;if(this.options.layoutRoot||this.resumeFrom||_||m&&(N||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const T={...Xw(C,"layout"),onPlay:S,onComplete:j};(p.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T),this.setAnimationOrigin(v,_)}else m||iT(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=w})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),qa(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(mK),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Pk(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let v=0;v<this.path.length;v++){const m=this.path[v];m.shouldResetTransform=!0,m.updateScroll("snapshot"),m.options.layoutRoot&&m.willUpdate(!1)}const{layoutId:d,layout:h}=this.options;if(d===void 0&&!h)return;const p=this.getTransformTemplate();this.prevTransformTemplateValue=p?p(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(aT);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(sT);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(fK),this.nodes.forEach(oK),this.nodes.forEach(lK)):this.nodes.forEach(sT),this.clearAllSnapshots();const d=nr.now();Fn.delta=Ua(0,1e3/60,d-Fn.timestamp),Fn.timestamp=d,Fn.isProcessing=!0,mv.update.process(Fn),mv.preRender.process(Fn),mv.render.process(Fn),Fn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,tS.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(dK),this.sharedNodes.forEach(gK)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,rn.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){rn.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!rr(this.snapshot.measuredBox.x)&&!rr(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let h=0;h<this.path.length;h++)this.path[h].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Rn(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:d}=this.options;d&&d.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let d=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(d=!1),d&&this.instance){const h=a(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:h,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!i)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,d=this.projectionDelta&&!Ak(this.projectionDelta),h=this.getTransformTemplate(),p=h?h(this.latestValues,""):void 0,v=p!==this.prevTransformTemplateValue;u&&this.instance&&(d||Wi(this.latestValues)||v)&&(i(this.instance,p),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const d=this.measurePageBox();let h=this.removeElementScroll(d);return u&&(h=this.removeTransform(h)),bK(h),{animationId:this.root.animationId,measuredBox:d,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:u}=this.options;if(!u)return Rn();const d=u.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(wK))){const{scroll:p}=this.root;p&&(bl(d.x,p.offset.x),bl(d.y,p.offset.y))}return d}removeElementScroll(u){const d=Rn();if(sa(d,u),this.scroll?.wasRoot)return d;for(let h=0;h<this.path.length;h++){const p=this.path[h],{scroll:v,options:m}=p;p!==this.root&&v&&m.layoutScroll&&(v.wasRoot&&sa(d,u),bl(d.x,v.offset.x),bl(d.y,v.offset.y))}return d}applyTransform(u,d=!1){const h=Rn();sa(h,u);for(let p=0;p<this.path.length;p++){const v=this.path[p];!d&&v.options.layoutScroll&&v.scroll&&v!==v.root&&wl(h,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),Wi(v.latestValues)&&wl(h,v.latestValues)}return Wi(this.latestValues)&&wl(h,this.latestValues),h}removeTransform(u){const d=Rn();sa(d,u);for(let h=0;h<this.path.length;h++){const p=this.path[h];if(!p.instance||!Wi(p.latestValues))continue;b0(p.latestValues)&&p.updateSnapshot();const v=Rn(),m=p.measurePageBox();sa(v,m),WE(d,p.latestValues,p.snapshot?p.snapshot.layoutBox:void 0,v)}return Wi(this.latestValues)&&WE(d,this.latestValues),d}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Fn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){const d=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=d.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=d.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=d.isSharedProjectionDirty);const h=!!this.resumingFrom||this!==d;if(!(u||h&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:v,layoutId:m}=this.options;if(!this.layout||!(v||m))return;this.resolvedRelativeTargetAt=Fn.timestamp;const b=this.getClosestProjectingParent();b&&this.linkedParentVersion!==b.layoutVersion&&!b.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(b&&b.layout?this.createRelativeTarget(b,this.layout.layoutBox,b.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Rn(),this.targetWithTransforms=Rn()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),VG(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):sa(this.target,this.layout.layoutBox),xk(this.target,this.targetDelta)):sa(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,b&&!!b.resumingFrom==!!this.resumingFrom&&!b.options.layoutScroll&&b.target&&this.animationProgress!==1?this.createRelativeTarget(b,this.target,b.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||b0(this.parent.latestValues)||vk(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(u,d,h){this.relativeParent=u,this.linkedParentVersion=u.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Rn(),this.relativeTargetOrigin=Rn(),Rh(this.relativeTargetOrigin,d,h),sa(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const u=this.getLead(),d=!!this.resumingFrom||this!==u;let h=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(h=!1),d&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(h=!1),this.resolvedRelativeTargetAt===Fn.timestamp&&(h=!1),h)return;const{layout:p,layoutId:v}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(p||v))return;sa(this.layoutCorrected,this.layout.layoutBox);const m=this.treeScale.x,b=this.treeScale.y;yG(this.layoutCorrected,this.treeScale,this.path,d),u.layout&&!u.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(u.target=u.layout.layoutBox,u.targetWithTransforms=Rn());const{target:w}=u;if(!w){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(qE(this.prevProjectionDelta.x,this.projectionDelta.x),qE(this.prevProjectionDelta.y,this.projectionDelta.y)),ju(this.projectionDelta,this.layoutCorrected,w,this.latestValues),(this.treeScale.x!==m||this.treeScale.y!==b||!eT(this.projectionDelta.x,this.prevProjectionDelta.x)||!eT(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",w))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){if(this.options.visualElement?.scheduleRender(),u){const d=this.getStack();d&&d.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=yl(),this.projectionDelta=yl(),this.projectionDeltaWithTransform=yl()}setAnimationOrigin(u,d=!1){const h=this.snapshot,p=h?h.latestValues:{},v={...this.latestValues},m=yl();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!d;const b=Rn(),w=h?h.source:void 0,C=this.layout?this.layout.source:void 0,S=w!==C,j=this.getStack(),N=!j||j.members.length<=1,_=!!(S&&!N&&this.options.crossfade===!0&&!this.path.some(xK));this.animationProgress=0;let T;this.mixTargetDelta=A=>{const D=A/1e3;oT(m.x,u.x,D),oT(m.y,u.y,D),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Rh(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox),vK(this.relativeTarget,this.relativeTargetOrigin,b,D),T&&YG(this.relativeTarget,T)&&(this.isProjectionDirty=!1),T||(T=Rn()),sa(T,this.relativeTarget)),S&&(this.animationValues=v,QG(v,p,this.latestValues,D,_,N)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=D},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(qa(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=rn.update(()=>{lh.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=no(0)),this.currentAnimation=eK(this.motionValue,[0,1e3],{...u,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),u.onUpdate&&u.onUpdate(d)},onStop:()=>{},onComplete:()=>{u.onComplete&&u.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(sK),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:d,target:h,layout:p,latestValues:v}=u;if(!(!d||!h||!p)){if(this!==u&&this.layout&&p&&Lk(this.options.animationType,this.layout.layoutBox,p.layoutBox)){h=this.target||Rn();const m=rr(this.layout.layoutBox.x);h.x.min=u.target.x.min,h.x.max=h.x.min+m;const b=rr(this.layout.layoutBox.y);h.y.min=u.target.y.min,h.y.max=h.y.min+b}sa(d,h),wl(d,v),ju(this.projectionDeltaWithTransform,this.layoutCorrected,d,v)}}registerSharedNode(u,d){this.sharedNodes.has(u)||this.sharedNodes.set(u,new aK),this.sharedNodes.get(u).add(d);const p=d.options.initialPromotionConfig;d.promote({transition:p?p.transition:void 0,preserveFollowOpacity:p&&p.shouldPreserveFollowOpacity?p.shouldPreserveFollowOpacity(d):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){const{layoutId:u}=this.options;return u?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:u}=this.options;return u?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:d,preserveFollowOpacity:h}={}){const p=this.getStack();p&&p.promote(this,h),u&&(this.projectionDelta=void 0,this.needsReset=!0),d&&this.setOptions({transition:d})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let d=!1;const{latestValues:h}=u;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(d=!0),!d)return;const p={};h.z&&jv("z",u,p,this.animationValues);for(let v=0;v<Cv.length;v++)jv(`rotate${Cv[v]}`,u,p,this.animationValues),jv(`skew${Cv[v]}`,u,p,this.animationValues);u.render();for(const v in p)u.setStaticValue(v,p[v]),this.animationValues&&(this.animationValues[v]=p[v]);u.scheduleRender()}applyProjectionStyles(u,d){if(!this.instance||this.isSVG)return;if(!this.isVisible){u.visibility="hidden";return}const h=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,u.visibility="",u.opacity="",u.pointerEvents=oh(d?.pointerEvents)||"",u.transform=h?h(this.latestValues,""):"none";return}const p=this.getLead();if(!this.projectionDelta||!this.layout||!p.target){this.options.layoutId&&(u.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,u.pointerEvents=oh(d?.pointerEvents)||""),this.hasProjected&&!Wi(this.latestValues)&&(u.transform=h?h({},""):"none",this.hasProjected=!1);return}u.visibility="";const v=p.animationValues||p.latestValues;this.applyTransformsToTarget();let m=WG(this.projectionDeltaWithTransform,this.treeScale,v);h&&(m=h(v,m)),u.transform=m;const{x:b,y:w}=this.projectionDelta;u.transformOrigin=`${b.origin*100}% ${w.origin*100}% 0`,p.animationValues?u.opacity=p===this?v.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:v.opacityExit:u.opacity=p===this?v.opacity!==void 0?v.opacity:"":v.opacityExit!==void 0?v.opacityExit:0;for(const C in S0){if(v[C]===void 0)continue;const{correct:S,applyTo:j,isCSSVariable:N}=S0[C],_=m==="none"?v[C]:S(v[C],p);if(j){const T=j.length;for(let A=0;A<T;A++)u[j[A]]=_}else N?this.options.visualElement.renderState.vars[C]=_:u[C]=_}this.options.layoutId&&(u.pointerEvents=p===this?oh(d?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>u.currentAnimation?.stop()),this.root.nodes.forEach(aT),this.root.sharedNodes.clear()}}}function oK(e){e.updateLayout()}function lK(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:a}=e.layout,{animationType:i}=e.options,l=t.source!==e.layout.source;i==="size"?Gr(v=>{const m=l?t.measuredBox[v]:t.layoutBox[v],b=rr(m);m.min=n[v].min,m.max=m.min+b}):Lk(i,t.layoutBox,n)&&Gr(v=>{const m=l?t.measuredBox[v]:t.layoutBox[v],b=rr(n[v]);m.max=m.min+b,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[v].max=e.relativeTarget[v].min+b)});const u=yl();ju(u,n,t.layoutBox);const d=yl();l?ju(d,e.applyTransform(a,!0),t.measuredBox):ju(d,n,t.layoutBox);const h=!Ak(u);let p=!1;if(!e.resumeFrom){const v=e.getClosestProjectingParent();if(v&&!v.resumeFrom){const{snapshot:m,layout:b}=v;if(m&&b){const w=Rn();Rh(w,t.layoutBox,m.layoutBox);const C=Rn();Rh(C,n,b.layoutBox),Ok(w,C)||(p=!0),v.options.layoutRoot&&(e.relativeTarget=C,e.relativeTargetOrigin=w,e.relativeParent=v)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:d,layoutDelta:u,hasLayoutChanged:h,hasRelativeLayoutChanged:p})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function cK(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function uK(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function dK(e){e.clearSnapshot()}function aT(e){e.clearMeasurements()}function sT(e){e.isLayoutDirty=!1}function fK(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function iT(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function hK(e){e.resolveTargetDelta()}function pK(e){e.calcProjection()}function mK(e){e.resetSkewAndRotation()}function gK(e){e.removeLeadSnapshot()}function oT(e,t,n){e.translate=hn(t.translate,0,n),e.scale=hn(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function lT(e,t,n,a){e.min=hn(t.min,n.min,a),e.max=hn(t.max,n.max,a)}function vK(e,t,n,a){lT(e.x,t.x,n.x,a),lT(e.y,t.y,n.y,a)}function xK(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const yK={duration:.45,ease:[.4,0,.1,1]},cT=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),uT=cT("applewebkit/")&&!cT("chrome/")?Math.round:Xr;function dT(e){e.min=uT(e.min),e.max=uT(e.max)}function bK(e){dT(e.x),dT(e.y)}function Lk(e,t,n){return e==="position"||e==="preserve-aspect"&&!qG(JE(t),JE(n),.2)}function wK(e){return e!==e.root&&e.scroll?.wasRoot}const SK=kk({attachResizeListener:(e,t)=>qu(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Nv={current:void 0},Bk=kk({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Nv.current){const e=new SK({});e.mount(window),e.setOptions({layoutScroll:!0}),Nv.current=e}return Nv.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),pp=g.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function CK(e=!0){const t=g.useContext(Dw);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:a,register:i}=t,l=g.useId();g.useEffect(()=>{if(e)return i(l)},[e]);const u=g.useCallback(()=>e&&a&&a(l),[l,a,e]);return!n&&a?[!1,u]:[!0]}const Ik=g.createContext({strict:!1}),fT={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let hT=!1;function jK(){if(hT)return;const e={};for(const t in fT)e[t]={isEnabled:n=>fT[t].some(a=>!!n[a])};pk(e),hT=!0}function zk(){return jK(),mG()}function NK(e){const t=zk();for(const n in e)t[n]={...t[n],...e[n]};pk(t)}const _K=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Ah(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||_K.has(e)}let Fk=e=>!Ah(e);function EK(e){typeof e=="function"&&(Fk=t=>t.startsWith("on")?!Ah(t):e(t))}try{EK(require("@emotion/is-prop-valid").default)}catch{}function TK(e,t,n){const a={};for(const i in e)i==="values"&&typeof e.values=="object"||(Fk(i)||n===!0&&Ah(i)||!t&&!Ah(i)||e.draggable&&i.startsWith("onDrag"))&&(a[i]=e[i]);return a}const mp=g.createContext({});function RK(e,t){if(hp(e)){const{initial:n,animate:a}=e;return{initial:n===!1||Uu(n)?n:void 0,animate:Uu(a)?a:void 0}}return e.inherit!==!1?t:{}}function AK(e){const{initial:t,animate:n}=RK(e,g.useContext(mp));return g.useMemo(()=>({initial:t,animate:n}),[pT(t),pT(n)])}function pT(e){return Array.isArray(e)?e.join(" "):e}const oS=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Hk(e,t,n){for(const a in t)!Qn(t[a])&&!wk(a,n)&&(e[a]=t[a])}function OK({transformTemplate:e},t){return g.useMemo(()=>{const n=oS();return sS(n,t,e),Object.assign({},n.vars,n.style)},[t])}function MK(e,t){const n=e.style||{},a={};return Hk(a,n,e),Object.assign(a,OK(e,t)),a}function DK(e,t){const n={},a=MK(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=a,n}const Uk=()=>({...oS(),attrs:{}});function PK(e,t,n,a){const i=g.useMemo(()=>{const l=Uk();return Sk(l,t,jk(a),e.transformTemplate,e.style),{...l.attrs,style:{...l.style}}},[t]);if(e.style){const l={};Hk(l,e.style,e),i.style={...l,...i.style}}return i}const kK=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function lS(e){return typeof e!="string"||e.includes("-")?!1:!!(kK.indexOf(e)>-1||/[A-Z]/u.test(e))}function LK(e,t,n,{latestValues:a},i,l=!1,u){const h=(u??lS(e)?PK:DK)(t,a,i,e),p=TK(t,typeof e=="string",l),v=e!==g.Fragment?{...p,...h,ref:n}:{},{children:m}=t,b=g.useMemo(()=>Qn(m)?m.get():m,[m]);return g.createElement(e,{...v,children:b})}function BK({scrapeMotionValuesFromProps:e,createRenderState:t},n,a,i){return{latestValues:IK(n,a,i,e),renderState:t()}}function IK(e,t,n,a){const i={},l=a(e,{});for(const b in l)i[b]=oh(l[b]);let{initial:u,animate:d}=e;const h=hp(e),p=hk(e);t&&p&&!h&&e.inherit!==!1&&(u===void 0&&(u=t.initial),d===void 0&&(d=t.animate));let v=n?n.initial===!1:!1;v=v||u===!1;const m=v?d:u;if(m&&typeof m!="boolean"&&!fp(m)){const b=Array.isArray(m)?m:[m];for(let w=0;w<b.length;w++){const C=Zw(e,b[w]);if(C){const{transitionEnd:S,transition:j,...N}=C;for(const _ in N){let T=N[_];if(Array.isArray(T)){const A=v?T.length-1:0;T=T[A]}T!==null&&(i[_]=T)}for(const _ in S)i[_]=S[_]}}}return i}const qk=e=>(t,n)=>{const a=g.useContext(mp),i=g.useContext(Dw),l=()=>BK(e,t,a,i);return n?l():Mw(l)},zK=qk({scrapeMotionValuesFromProps:iS,createRenderState:oS}),FK=qk({scrapeMotionValuesFromProps:Nk,createRenderState:Uk}),HK=Symbol.for("motionComponentSymbol");function UK(e,t,n){const a=g.useRef(n);g.useInsertionEffect(()=>{a.current=n});const i=g.useRef(null);return g.useCallback(l=>{l&&e.onMount?.(l),t&&(l?t.mount(l):t.unmount());const u=a.current;if(typeof u=="function")if(l){const d=u(l);typeof d=="function"&&(i.current=d)}else i.current?(i.current(),i.current=null):u(l);else u&&(u.current=l)},[t])}const Vk=g.createContext({});function cu(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function qK(e,t,n,a,i,l){const{visualElement:u}=g.useContext(mp),d=g.useContext(Ik),h=g.useContext(Dw),p=g.useContext(pp).reducedMotion,v=g.useRef(null);a=a||d.renderer,!v.current&&a&&(v.current=a(e,{visualState:t,parent:u,props:n,presenceContext:h,blockInitialAnimation:h?h.initial===!1:!1,reducedMotionConfig:p,isSVG:l}));const m=v.current,b=g.useContext(Vk);m&&!m.projection&&i&&(m.type==="html"||m.type==="svg")&&VK(v.current,n,i,b);const w=g.useRef(!1);g.useInsertionEffect(()=>{m&&w.current&&m.update(n,h)});const C=n[JP],S=g.useRef(!!C&&!window.MotionHandoffIsComplete?.(C)&&window.MotionHasOptimisedAnimation?.(C));return mP(()=>{m&&(w.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),S.current&&m.animationState&&m.animationState.animateChanges())}),g.useEffect(()=>{m&&(!S.current&&m.animationState&&m.animationState.animateChanges(),S.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(C)}),S.current=!1),m.enteringChildren=void 0)}),m}function VK(e,t,n,a){const{layoutId:i,layout:l,drag:u,dragConstraints:d,layoutScroll:h,layoutRoot:p,layoutCrossfade:v}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:$k(e.parent)),e.projection.setOptions({layoutId:i,layout:l,alwaysMeasureLayout:!!u||d&&cu(d),visualElement:e,animationType:typeof l=="string"?l:"both",initialPromotionConfig:a,crossfade:v,layoutScroll:h,layoutRoot:p})}function $k(e){if(e)return e.options.allowProjection!==!1?e.projection:$k(e.parent)}function _v(e,{forwardMotionProps:t=!1,type:n}={},a,i){a&&NK(a);const l=n?n==="svg":lS(e),u=l?FK:zK;function d(p,v){let m;const b={...g.useContext(pp),...p,layoutId:$K(p)},{isStatic:w}=b,C=AK(p),S=u(p,w);if(!w&&pP){GK();const j=KK(b);m=j.MeasureLayout,C.visualElement=qK(e,S,b,i,j.ProjectionNode,l)}return o.jsxs(mp.Provider,{value:C,children:[m&&C.visualElement?o.jsx(m,{visualElement:C.visualElement,...b}):null,LK(e,p,UK(S,C.visualElement,v),S,w,t,l)]})}d.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const h=g.forwardRef(d);return h[HK]=e,h}function $K({layoutId:e}){const t=g.useContext(hP).id;return t&&e!==void 0?t+"-"+e:e}function GK(e,t){g.useContext(Ik).strict}function KK(e){const t=zk(),{drag:n,layout:a}=t;if(!n&&!a)return{};const i={...n,...a};return{MeasureLayout:n?.isEnabled(e)||a?.isEnabled(e)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function YK(e,t){if(typeof Proxy>"u")return _v;const n=new Map,a=(l,u)=>_v(l,u,e,t),i=(l,u)=>a(l,u);return new Proxy(i,{get:(l,u)=>u==="create"?a:(n.has(u)||n.set(u,_v(u,void 0,e,t)),n.get(u))})}const WK=(e,t)=>t.isSVG??lS(e)?new MG(t):new _G(t,{allowProjection:e!==g.Fragment});class XK extends ji{constructor(t){super(t),t.animationState||(t.animationState=BG(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();fp(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let QK=0;class ZK extends ji{constructor(){super(...arguments),this.id=QK++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:a}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===a)return;const i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const JK={animation:{Feature:XK},exit:{Feature:ZK}};function id(e){return{point:{x:e.pageX,y:e.pageY}}}const eY=e=>t=>nS(t)&&e(t,id(t));function Nu(e,t,n,a){return qu(e,t,eY(n),a)}const Gk=({current:e})=>e?e.ownerDocument.defaultView:null,mT=(e,t)=>Math.abs(e-t);function tY(e,t){const n=mT(e.x,t.x),a=mT(e.y,t.y);return Math.sqrt(n**2+a**2)}const gT=new Set(["auto","scroll"]);class Kk{constructor(t,n,{transformPagePoint:a,contextWindow:i=window,dragSnapToOrigin:l=!1,distanceThreshold:u=3,element:d}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=w=>{this.handleScroll(w.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=Tv(this.lastMoveEventInfo,this.history),C=this.startEvent!==null,S=tY(w.offset,{x:0,y:0})>=this.distanceThreshold;if(!C&&!S)return;const{point:j}=w,{timestamp:N}=Fn;this.history.push({...j,timestamp:N});const{onStart:_,onMove:T}=this.handlers;C||(_&&_(this.lastMoveEvent,w),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,w)},this.handlePointerMove=(w,C)=>{this.lastMoveEvent=w,this.lastMoveEventInfo=Ev(C,this.transformPagePoint),rn.update(this.updatePoint,!0)},this.handlePointerUp=(w,C)=>{this.end();const{onEnd:S,onSessionEnd:j,resumeAnimation:N}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const _=Tv(w.type==="pointercancel"?this.lastMoveEventInfo:Ev(C,this.transformPagePoint),this.history);this.startEvent&&S&&S(w,_),j&&j(w,_)},!nS(t))return;this.dragSnapToOrigin=l,this.handlers=n,this.transformPagePoint=a,this.distanceThreshold=u,this.contextWindow=i||window;const h=id(t),p=Ev(h,this.transformPagePoint),{point:v}=p,{timestamp:m}=Fn;this.history=[{...v,timestamp:m}];const{onSessionStart:b}=n;b&&b(t,Tv(p,this.history)),this.removeListeners=rd(Nu(this.contextWindow,"pointermove",this.handlePointerMove),Nu(this.contextWindow,"pointerup",this.handlePointerUp),Nu(this.contextWindow,"pointercancel",this.handlePointerUp)),d&&this.startScrollTracking(d)}startScrollTracking(t){let n=t.parentElement;for(;n;){const a=getComputedStyle(n);(gT.has(a.overflowX)||gT.has(a.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const n=this.scrollPositions.get(t);if(!n)return;const a=t===window,i=a?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},l={x:i.x-n.x,y:i.y-n.y};l.x===0&&l.y===0||(a?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=l.x,this.lastMoveEventInfo.point.y+=l.y):this.history.length>0&&(this.history[0].x-=l.x,this.history[0].y-=l.y),this.scrollPositions.set(t,i),rn.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),qa(this.updatePoint)}}function Ev(e,t){return t?{point:t(e.point)}:e}function vT(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Tv({point:e},t){return{point:e,delta:vT(e,Yk(t)),offset:vT(e,nY(t)),velocity:rY(t,.1)}}function nY(e){return e[0]}function Yk(e){return e[e.length-1]}function rY(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,a=null;const i=Yk(e);for(;n>=0&&(a=e[n],!(i.timestamp-a.timestamp>ws(t)));)n--;if(!a)return{x:0,y:0};const l=Yr(i.timestamp-a.timestamp);if(l===0)return{x:0,y:0};const u={x:(i.x-a.x)/l,y:(i.y-a.y)/l};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}function aY(e,{min:t,max:n},a){return t!==void 0&&e<t?e=a?hn(t,e,a.min):Math.max(e,t):n!==void 0&&e>n&&(e=a?hn(n,e,a.max):Math.min(e,n)),e}function xT(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function sY(e,{top:t,left:n,bottom:a,right:i}){return{x:xT(e.x,n,i),y:xT(e.y,t,a)}}function yT(e,t){let n=t.min-e.min,a=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,a]=[a,n]),{min:n,max:a}}function iY(e,t){return{x:yT(e.x,t.x),y:yT(e.y,t.y)}}function oY(e,t){let n=.5;const a=rr(e),i=rr(t);return i>a?n=zu(t.min,t.max-a,e.min):a>i&&(n=zu(e.min,e.max-i,t.min)),Ua(0,1,n)}function lY(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const C0=.35;function cY(e=C0){return e===!1?e=0:e===!0&&(e=C0),{x:bT(e,"left","right"),y:bT(e,"top","bottom")}}function bT(e,t,n){return{min:wT(e,t),max:wT(e,n)}}function wT(e,t){return typeof e=="number"?e:e[t]||0}const uY=new WeakMap;class dY{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Rn(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:n=!1,distanceThreshold:a}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const l=m=>{n?(this.stopAnimation(),this.snapToCursor(id(m).point)):this.pauseAnimation()},u=(m,b)=>{this.stopAnimation();const{drag:w,dragPropagation:C,onDragStart:S}=this.getProps();if(w&&!C&&(this.openDragLock&&this.openDragLock(),this.openDragLock=nG(w),!this.openDragLock))return;this.latestPointerEvent=m,this.latestPanInfo=b,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Gr(N=>{let _=this.getAxisMotionValue(N).get()||0;if(Ia.test(_)){const{projection:T}=this.visualElement;if(T&&T.layout){const A=T.layout.layoutBox[N];A&&(_=rr(A)*(parseFloat(_)/100))}}this.originPoint[N]=_}),S&&rn.postRender(()=>S(m,b)),g0(this.visualElement,"transform");const{animationState:j}=this.visualElement;j&&j.setActive("whileDrag",!0)},d=(m,b)=>{this.latestPointerEvent=m,this.latestPanInfo=b;const{dragPropagation:w,dragDirectionLock:C,onDirectionLock:S,onDrag:j}=this.getProps();if(!w&&!this.openDragLock)return;const{offset:N}=b;if(C&&this.currentDirection===null){this.currentDirection=fY(N),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",b.point,N),this.updateAxis("y",b.point,N),this.visualElement.render(),j&&j(m,b)},h=(m,b)=>{this.latestPointerEvent=m,this.latestPanInfo=b,this.stop(m,b),this.latestPointerEvent=null,this.latestPanInfo=null},p=()=>Gr(m=>this.getAnimationState(m)==="paused"&&this.getAxisMotionValue(m).animation?.play()),{dragSnapToOrigin:v}=this.getProps();this.panSession=new Kk(t,{onSessionStart:l,onStart:u,onMove:d,onSessionEnd:h,resumeAnimation:p},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:v,distanceThreshold:a,contextWindow:Gk(this.visualElement),element:this.visualElement.current})}stop(t,n){const a=t||this.latestPointerEvent,i=n||this.latestPanInfo,l=this.isDragging;if(this.cancel(),!l||!i||!a)return;const{velocity:u}=i;this.startAnimation(u);const{onDragEnd:d}=this.getProps();d&&rn.postRender(()=>d(a,i))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:a}=this.getProps();!a&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,a){const{drag:i}=this.getProps();if(!a||!Gf(t,i,this.currentDirection))return;const l=this.getAxisMotionValue(t);let u=this.originPoint[t]+a[t];this.constraints&&this.constraints[t]&&(u=aY(u,this.constraints[t],this.elastic[t])),l.set(u)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),a=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;t&&cu(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&a?this.constraints=sY(a.layoutBox,t):this.constraints=!1,this.elastic=cY(n),i!==this.constraints&&a&&this.constraints&&!this.hasMutatedConstraints&&Gr(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=lY(a.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!cu(t))return!1;const a=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const l=bG(a,i.root,this.visualElement.getTransformPagePoint());let u=iY(i.layout.layoutBox,l);if(n){const d=n(vG(u));this.hasMutatedConstraints=!!d,d&&(u=gk(d))}return u}startAnimation(t){const{drag:n,dragMomentum:a,dragElastic:i,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:d}=this.getProps(),h=this.constraints||{},p=Gr(v=>{if(!Gf(v,n,this.currentDirection))return;let m=h&&h[v]||{};u&&(m={min:0,max:0});const b=i?200:1e6,w=i?40:1e7,C={type:"inertia",velocity:a?t[v]:0,bounceStiffness:b,bounceDamping:w,timeConstant:750,restDelta:1,restSpeed:10,...l,...m};return this.startAxisValueAnimation(v,C)});return Promise.all(p).then(d)}startAxisValueAnimation(t,n){const a=this.getAxisMotionValue(t);return g0(this.visualElement,t),a.start(Qw(t,a,0,n,this.visualElement,!1))}stopAnimation(){Gr(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Gr(t=>this.getAxisMotionValue(t).animation?.pause())}getAnimationState(t){return this.getAxisMotionValue(t).animation?.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,a=this.visualElement.getProps(),i=a[n];return i||this.visualElement.getValue(t,(a.initial?a.initial[t]:void 0)||0)}snapToCursor(t){Gr(n=>{const{drag:a}=this.getProps();if(!Gf(n,a,this.currentDirection))return;const{projection:i}=this.visualElement,l=this.getAxisMotionValue(n);if(i&&i.layout){const{min:u,max:d}=i.layout.layoutBox[n],h=l.get()||0;l.set(t[n]-hn(u,d,.5)+h)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:a}=this.visualElement;if(!cu(n)||!a||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Gr(u=>{const d=this.getAxisMotionValue(u);if(d&&this.constraints!==!1){const h=d.get();i[u]=oY({min:h,max:h},this.constraints[u])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",a.root&&a.root.updateScroll(),a.updateLayout(),this.resolveConstraints(),Gr(u=>{if(!Gf(u,t,null))return;const d=this.getAxisMotionValue(u),{min:h,max:p}=this.constraints[u];d.set(hn(h,p,i[u]))})}addListeners(){if(!this.visualElement.current)return;uY.set(this.visualElement,this);const t=this.visualElement.current,n=Nu(t,"pointerdown",h=>{const{drag:p,dragListener:v=!0}=this.getProps();p&&v&&!uk(h.target)&&this.start(h)}),a=()=>{const{dragConstraints:h}=this.getProps();cu(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,l=i.addEventListener("measure",a);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),rn.read(a);const u=qu(window,"resize",()=>this.scalePositionWithinConstraints()),d=i.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:p})=>{this.isDragging&&p&&(Gr(v=>{const m=this.getAxisMotionValue(v);m&&(this.originPoint[v]+=h[v].translate,m.set(m.get()+h[v].translate))}),this.visualElement.render())}));return()=>{u(),n(),l(),d&&d()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:a=!1,dragPropagation:i=!1,dragConstraints:l=!1,dragElastic:u=C0,dragMomentum:d=!0}=t;return{...t,drag:n,dragDirectionLock:a,dragPropagation:i,dragConstraints:l,dragElastic:u,dragMomentum:d}}}function Gf(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function fY(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class hY extends ji{constructor(t){super(t),this.removeGroupControls=Xr,this.removeListeners=Xr,this.controls=new dY(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Xr}update(){const{dragControls:t}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners()}}const ST=e=>(t,n)=>{e&&rn.postRender(()=>e(t,n))};class pY extends ji{constructor(){super(...arguments),this.removePointerDownListener=Xr}onPointerDown(t){this.session=new Kk(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Gk(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:a,onPanEnd:i}=this.node.getProps();return{onSessionStart:ST(t),onStart:ST(n),onMove:a,onEnd:(l,u)=>{delete this.session,i&&rn.postRender(()=>i(l,u))}}}mount(){this.removePointerDownListener=Nu(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Rv=!1;class mY extends g.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:a,layoutId:i}=this.props,{projection:l}=t;l&&(n.group&&n.group.add(l),a&&a.register&&i&&a.register(l),Rv&&l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,onExitComplete:()=>this.safeToRemove()})),lh.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:a,drag:i,isPresent:l}=this.props,{projection:u}=a;return u&&(u.isPresent=l,Rv=!0,i||t.layoutDependency!==n||n===void 0||t.isPresent!==l?u.willUpdate():this.safeToRemove(),t.isPresent!==l&&(l?u.promote():u.relegate()||rn.postRender(()=>{const d=u.getStack();(!d||!d.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),tS.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:a}=this.props,{projection:i}=t;Rv=!0,i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),a&&a.deregister&&a.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function Wk(e){const[t,n]=CK(),a=g.useContext(hP);return o.jsx(mY,{...e,layoutGroup:a,switchLayoutGroup:g.useContext(Vk),isPresent:t,safeToRemove:n})}const gY={pan:{Feature:pY},drag:{Feature:hY,ProjectionNode:Bk,MeasureLayout:Wk}};function CT(e,t,n){const{props:a}=e;e.animationState&&a.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,l=a[i];l&&rn.postRender(()=>l(t,id(t)))}class vY extends ji{mount(){const{current:t}=this.node;t&&(this.unmount=rG(t,(n,a)=>(CT(this.node,a,"Start"),i=>CT(this.node,i,"End"))))}unmount(){}}class xY extends ji{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=rd(qu(this.node.current,"focus",()=>this.onFocus()),qu(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function jT(e,t,n){const{props:a}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&a.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),l=a[i];l&&rn.postRender(()=>l(t,id(t)))}class yY extends ji{mount(){const{current:t}=this.node;t&&(this.unmount=iG(t,(n,a)=>(jT(this.node,a,"Start"),(i,{success:l})=>jT(this.node,i,l?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const j0=new WeakMap,Av=new WeakMap,bY=e=>{const t=j0.get(e.target);t&&t(e)},wY=e=>{e.forEach(bY)};function SY({root:e,...t}){const n=e||document;Av.has(n)||Av.set(n,{});const a=Av.get(n),i=JSON.stringify(t);return a[i]||(a[i]=new IntersectionObserver(wY,{root:e,...t})),a[i]}function CY(e,t,n){const a=SY(t);return j0.set(e,n),a.observe(e),()=>{j0.delete(e),a.unobserve(e)}}const jY={some:0,all:1};class NY extends ji{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:a,amount:i="some",once:l}=t,u={root:n?n.current:void 0,rootMargin:a,threshold:typeof i=="number"?i:jY[i]},d=h=>{const{isIntersecting:p}=h;if(this.isInView===p||(this.isInView=p,l&&!p&&this.hasEnteredView))return;p&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",p);const{onViewportEnter:v,onViewportLeave:m}=this.node.getProps(),b=p?v:m;b&&b(h)};return CY(this.node.current,u,d)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(_Y(t,n))&&this.startObserver()}unmount(){}}function _Y({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const EY={inView:{Feature:NY},tap:{Feature:yY},focus:{Feature:xY},hover:{Feature:vY}},TY={layout:{ProjectionNode:Bk,MeasureLayout:Wk}},RY={...JK,...EY,...gY,...TY},AY=YK(RY,WK);function Xk(e){const t=Mw(()=>no(e)),{isStatic:n}=g.useContext(pp);if(n){const[,a]=g.useState(e);g.useEffect(()=>t.on("change",a),[])}return t}function Qk(e,t){const n=Xk(t()),a=()=>n.set(t());return a(),mP(()=>{const i=()=>rn.preRender(a,!1,!0),l=e.map(u=>u.on("change",i));return()=>{l.forEach(u=>u()),qa(a)}}),n}function OY(e){Cu.current=[],e();const t=Qk(Cu.current,e);return Cu.current=void 0,t}function MY(e,t,n,a){if(typeof e=="function")return OY(e);const l=typeof t=="function"?t:lG(t,n,a);return Array.isArray(e)?NT(e,l):NT([e],([u])=>l(u))}function NT(e,t){const n=Mw(()=>[]);return Qk(e,()=>{n.length=0;const a=e.length;for(let i=0;i<a;i++)n[i]=e[i].get();return t(n)})}function DY(e){const t=g.useRef(0),{isStatic:n}=g.useContext(pp);g.useEffect(()=>{if(n)return;const a=({timestamp:i,delta:l})=>{t.current||(t.current=i),e(i-t.current,l)};return rn.update(a,!0),()=>qa(a)},[e])}const PY=({text:e,disabled:t=!1,speed:n=2,className:a="",color:i="#b5b5b5",shineColor:l="#ffffff",spread:u=120,yoyo:d=!1,pauseOnHover:h=!1,direction:p="left",delay:v=0})=>{const[m,b]=g.useState(!1),w=Xk(0),C=g.useRef(0),S=g.useRef(null),j=g.useRef(p==="left"?1:-1),N=n*1e3,_=v*1e3;DY(k=>{if(t||m){S.current=null;return}if(S.current===null){S.current=k;return}const P=k-S.current;if(S.current=k,C.current+=P,d){const U=N+_,J=U*2,$=C.current%J;if($<N){const W=$/N*100;w.set(j.current===1?W:100-W)}else if($<U)w.set(j.current===1?100:0);else if($<U+N){const pe=100-($-U)/N*100;w.set(j.current===1?pe:100-pe)}else w.set(j.current===1?0:100)}else{const U=N+_,J=C.current%U;if(J<N){const $=J/N*100;w.set(j.current===1?$:100-$)}else w.set(j.current===1?100:0)}}),g.useEffect(()=>{j.current=p==="left"?1:-1,C.current=0,w.set(0)},[p]);const T=MY(w,k=>`${150-k*2}% center`),A=g.useCallback(()=>{h&&b(!0)},[h]),D=g.useCallback(()=>{h&&b(!1)},[h]),L={backgroundImage:`linear-gradient(${u}deg, ${i} 0%, ${i} 35%, ${l} 50%, ${i} 65%, ${i} 100%)`,backgroundSize:"200% auto",WebkitBackgroundClip:"text",backgroundClip:"text",WebkitTextFillColor:"transparent"};return o.jsx(AY.span,{className:`inline-block ${a}`,style:{...L,backgroundPosition:T},onMouseEnter:A,onMouseLeave:D,children:e})};let $r=null;const Ov=aD()((e,t)=>({cacheProgress:null,isConnected:!1,connect:()=>{if($r){if($r.readyState===WebSocket.CONNECTING||$r.readyState===WebSocket.OPEN)return;$r=null}const n=new WebSocket(fe.getWebSocketUrl("/ws/cache-progress"));$r=n,n.onopen=()=>{if($r!==n){n.close();return}e({isConnected:!0})},n.onmessage=a=>{try{const i=JSON.parse(a.data);if(i.type==="cache_progress"){const l=i.data;l.is_running?e({cacheProgress:l}):l.stage==="complete"?(e({cacheProgress:{...l}}),setTimeout(()=>t().disconnect(),500)):(e({cacheProgress:null}),t().disconnect())}}catch{}},n.onclose=()=>{$r===n&&($r=null),e({isConnected:!1})},n.onerror=()=>{}},disconnect:()=>{$r&&($r.readyState===WebSocket.OPEN&&$r.close(),$r=null),e({isConnected:!1})}})),Mv=[{path:"/",label:"Browse",icon:"grid_view",title:"Browse Patterns"},{path:"/playlists",label:"Playlists",icon:"playlist_play",title:"Playlists"},{path:"/table-control",label:"Control",icon:"tune",title:"Table Control"},{path:"/led",label:"LED",icon:"lightbulb",title:"LED Control"},{path:"/settings",label:"Settings",icon:"settings",title:"Settings"}],_T="Dune Weaver",kY=["captive.apple.com","connectivitycheck.gstatic.com","connectivitycheck.android.com","clients3.google.com","nmcheck.gnome.org","network-test.debian.org","msftconnecttest.com","www.msftconnecttest.com"],Dv=kY.some(e=>window.location.hostname===e||window.location.hostname.endsWith("."+e));function LY(){const e=Es(),t=kl();g.useEffect(()=>{window.scrollTo(0,0)},[e.pathname]),g.useEffect(()=>{Dv&&e.pathname!=="/wifi-setup"&&e.pathname!=="/captive"&&!sessionStorage.getItem("captive-dismissed")&&t("/captive",{replace:!0})},[e.pathname,t]);const{activeTable:n,tables:a}=fP(),i=a.length>1,[l,u]=g.useState(()=>{if(Dv)return!1;if(typeof window<"u"){const ee=localStorage.getItem("theme");return ee?ee==="dark":window.matchMedia("(prefers-color-scheme: dark)").matches}return!1}),[d,h]=g.useState(_T),[p,v]=g.useState(null),b=a.find(ee=>ee.id===n?.id)?.name||n?.name,w=i&&b?b:d,C=un(ee=>ee.isBackendConnected),S=un(ee=>ee.connectionAttempts),j=un(ee=>ee.status?.connection_status??!1),N=un(ee=>ee.status?.is_homing??!1),_=un(ee=>ee.status?.sensor_homing_failed??!1),T=un(ee=>ee.status?.firmware_version??null),A=un(ee=>ee.status?.table_type??null),D=un(ee=>ee.status?.current_file??null),L=un(ee=>ee.status?.is_running??!1),k=un(ee=>ee.status?.is_paused??!1),P=un(ee=>ee.status?.pause_time_remaining??0),[U,J]=g.useState(!1),[$,W]=g.useState(!1),[pe,Se]=g.useState(0),[Ce,I]=g.useState(!1),q=g.useRef(!1),[H,be]=g.useState(!1),[Ne,B]=g.useState(!1),[G,X]=g.useState("off"),[oe,xe]=g.useState(!1),[Q,te]=g.useState(()=>sessionStorage.getItem("security-unlocked")==="true"),[he,_e]=g.useState(!1),[je,Me]=g.useState(""),[ce,He]=g.useState(!1),Le=A==="dune_weaver_mini"?"v3.8.3":"v3.9.5",Ue=g.useMemo(()=>T?T!==Le:!1,[T,Le]),wt=()=>{fe.get("/api/settings").then(ee=>{ee.app?.name?h(ee.app.name):h(_T),v(ee.app?.custom_logo||null);const Ee=ee.security?.mode;X(Ee||"off"),xe(ee.security?.has_password||!1)}).catch(()=>{})};g.useEffect(()=>{wt();const ee=()=>{wt()},Ee=()=>{wt()};return window.addEventListener("branding-updated",ee),window.addEventListener("security-updated",Ee),()=>{window.removeEventListener("branding-updated",ee),window.removeEventListener("security-updated",Ee)}},[n?.id]),g.useEffect(()=>{fe.get("/api/version").then(ee=>{ee.update_available&&B(!0)}).catch(()=>{})},[n?.id]),g.useEffect(()=>{if(!$||Ce)return;if(pe<=0){W(!1),I(!1);return}const ee=setTimeout(()=>{Se(Ee=>Ee-1)},1e3);return()=>clearTimeout(ee)},[$,pe,Ce]);const[$e,Ot]=g.useState(!1),[St,Et]=g.useState(!1),[jt,ot]=g.useState(!1),[at,vt]=g.useState(256),[Kt,Yt]=g.useState(!1),Wt=g.useRef(!1),ne=g.useRef(0),Re=g.useRef(0),[st,et]=g.useState(""),xt=ee=>{ee.preventDefault(),Wt.current=!0,Yt(!0),ne.current="touches"in ee?ee.touches[0].clientY:ee.clientY,Re.current=at,document.body.style.cursor="ns-resize",document.body.style.userSelect="none"};g.useEffect(()=>{const ee=_t=>{if(!Wt.current)return;const Mt="touches"in _t?_t.touches[0].clientY:_t.clientY,kt=ne.current-Mt,_n=Math.min(Math.max(Re.current+kt,150),window.innerHeight-150);vt(_n)},Ee=()=>{Wt.current&&(Wt.current=!1,Yt(!1),document.body.style.cursor="",document.body.style.userSelect="")};return window.addEventListener("mousemove",ee),window.addEventListener("mouseup",Ee),window.addEventListener("touchmove",ee),window.addEventListener("touchend",Ee),()=>{window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",Ee),window.removeEventListener("touchmove",ee),window.removeEventListener("touchend",Ee)}},[]),g.useEffect(()=>{const ee=N;!q.current&&ee&&J(!1),q.current&&!ee&&(_||(W(!0),Se(5),J(!1))),q.current=ee},[N,_]);const[mt,gt]=g.useState(!1),[qt,ue]=g.useState(!1),Te=D,[De,Xe]=g.useState(()=>{if(typeof window<"u"){const ee=localStorage.getItem("nowPlayingButtonPos");if(ee==="left"||ee==="center"||ee==="right")return ee}return"center"}),[Oe,Qe]=g.useState(!1),[dt,ht]=g.useState({x:0,y:0}),z=g.useRef(null),O=g.useRef(null),de=g.useRef(!1),me=!!Te,Ge=g.useRef(null),Ie=!!Te||L||k||P>0;g.useEffect(()=>{Ge.current!==null&&!Ie&&Ge.current&&gt(!1),Ge.current=Ie},[Ie]),g.useEffect(()=>{const ee=()=>{gt(!0),ue(!0),ot(!1),setTimeout(()=>ue(!1),500)};return window.addEventListener("playback-started",ee),()=>window.removeEventListener("playback-started",ee)},[]);const[tt,It]=g.useState([]),[Y,we]=g.useState("ALL"),[Pe,ke]=g.useState(0),[ze,ct]=g.useState(!1),[Nt,Tt]=g.useState(!1),it=g.useRef(null),zt=g.useRef(null),Zn=g.useRef(0);g.useEffect(()=>{if(!jt){it.current&&it.current.readyState===WebSocket.OPEN&&it.current.close(),it.current=null;return}let ee=!0;(async()=>{try{const kt=await fe.get("/api/logs?limit=200"),_n=(kt.logs||[]).filter(fn=>fn&&fn.message&&fn.message.trim()!=="");It(_n.reverse()),ke(kt.total||0),ct(kt.has_more||!1),Zn.current=_n.length,setTimeout(()=>{zt.current&&(zt.current.scrollTop=zt.current.scrollHeight)},100)}catch{}})();let _t=null;const Mt=()=>{if(it.current){if(it.current.readyState===WebSocket.CONNECTING)return;it.current.readyState===WebSocket.OPEN&&it.current.close(),it.current=null}const kt=new WebSocket(fe.getWebSocketUrl("/ws/logs"));it.current=kt,kt.onopen=()=>{if(!ee){kt.close();return}console.log("Logs WebSocket connected")},kt.onmessage=_n=>{try{const fn=JSON.parse(_n.data);if(fn.type==="heartbeat")return;const an=fn.type==="log_entry"?fn.data:fn;if(!an||!an.message||an.message.trim()==="")return;It(ta=>[...ta,an]),setTimeout(()=>{if(zt.current){const{scrollTop:ta,scrollHeight:lc,clientHeight:cc}=zt.current;lc-ta-cc<100&&(zt.current.scrollTop=lc)}},10)}catch{}},kt.onclose=()=>{ee&&(console.log("Logs WebSocket closed, reconnecting..."),_t=setTimeout(()=>{ee&&it.current===kt&&Mt()},3e3))},kt.onerror=_n=>{console.error("Logs WebSocket error:",_n)}};return Mt(),()=>{ee=!1,_t&&clearTimeout(_t),it.current&&(it.current.readyState===WebSocket.OPEN&&it.current.close(),it.current=null)}},[jt,n?.id]);const Na=g.useCallback(async()=>{if(!(Nt||!ze)){Tt(!0);try{const ee=Zn.current,Ee=await fe.get(`/api/logs?limit=100&offset=${ee}`),_t=(Ee.logs||[]).filter(Mt=>Mt&&Mt.message&&Mt.message.trim()!=="");_t.length>0?(It(Mt=>[..._t.reverse(),...Mt]),Zn.current+=_t.length,ct(Ee.has_more||!1),ke(Ee.total||0),setTimeout(()=>{if(zt.current){const Mt=_t.length*24;zt.current.scrollTop=Mt}},10)):ct(!1)}catch{}finally{Tt(!1)}}},[Nt,ze]);g.useEffect(()=>{const ee=zt.current;if(!ee||!jt)return;const Ee=()=>{ee.scrollTop<50&&ze&&!Nt&&Na()};return ee.addEventListener("scroll",Ee),()=>ee.removeEventListener("scroll",Ee)},[jt,ze,Nt,Na]);const Ti=()=>{ot(ee=>!ee)},Ds=g.useMemo(()=>{let ee=Y==="ALL"?tt:tt.filter(Ee=>Ee.level===Y);if(st){const Ee=st.toLowerCase();ee=ee.filter(_t=>_t.message?.toLowerCase().includes(Ee)||_t.logger?.toLowerCase().includes(Ee))}return ee},[tt,Y,st]),Ka=ee=>{if(!ee)return"--:--:--";try{const Ee=new Date(ee);return isNaN(Ee.getTime())?"--:--:--":Ee.toLocaleTimeString()}catch{return"--:--:--"}},Jl=()=>{const ee=Ds.map(Ee=>`${Ka(Ee.timestamp)} [${Ee.level}] ${Ee.message}`).join(`
  56. `);Ya(ee)},Ya=ee=>{if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(ee).then(()=>{K.success("Logs copied to clipboard")}).catch(()=>{K.error("Failed to copy logs")});else{const Ee=document.createElement("textarea");Ee.value=ee,Ee.style.position="fixed",Ee.style.left="-9999px",document.body.appendChild(Ee),Ee.select();try{document.execCommand("copy"),K.success("Logs copied to clipboard")}catch{K.error("Failed to copy logs")}document.body.removeChild(Ee)}},Ps=()=>{const ee=Ds.map(kt=>`${kt.timestamp} [${kt.level}] [${kt.logger}] ${kt.message}`).join(`
  57. `),Ee=new Blob([ee],{type:"text/plain"}),_t=URL.createObjectURL(Ee),Mt=document.createElement("a");Mt.href=_t,Mt.download=`dune-weaver-logs-${new Date().toISOString().split("T")[0]}.txt`,Mt.click(),URL.revokeObjectURL(_t)},ks=async()=>{if(confirm("Are you sure you want to restart Dune Weaver?"))try{await fe.post("/api/system/restart"),K.success("Dune Weaver is restarting...")}catch{K.error("Failed to restart Dune Weaver")}},Wa=async()=>{if(confirm("Are you sure you want to shutdown the system?"))try{await fe.post("/api/system/shutdown"),K.success("System is shutting down...")}catch{K.error("Failed to shutdown system")}},xn=async ee=>{be(!0);try{const Ee=await fe.post("/recover_sensor_homing",{switch_to_crash_homing:ee});Ee.success?K.success(Ee.message||"Homing completed successfully"):Ee.sensor_homing_failed?K.error(Ee.message||"Sensor homing failed again"):K.error(Ee.message||"Recovery failed")}catch{K.error("Failed to recover from sensor homing failure")}finally{be(!1)}},ec=async ee=>{ee.preventDefault(),He(!1);try{(await fe.post("/api/security/verify",{password:je})).valid?(sessionStorage.setItem("security-unlocked","true"),te(!0),Me(""),he&&(_e(!1),t("/settings"))):He(!0)}catch{He(!0)}},tc=()=>{sessionStorage.removeItem("security-unlocked"),te(!1),t("/")},Xa=G==="lockdown"&&oe&&!Q,ar=G==="play_only"&&oe&&!Q,hd=G!=="off"&&oe&&Q,pd=["/settings","/table-control","/setup","/wifi-setup"];g.useEffect(()=>{ar&&pd.includes(e.pathname)&&t("/")},[ar,e.pathname,t]);const md=["/settings","/table-control"],gd=g.useMemo(()=>ar?Mv.filter(ee=>!md.includes(ee.path)):Mv,[ar]);g.useEffect(()=>{const ee=Mv.find(Ee=>Ee.path===e.pathname);ee?document.title=`${ee.title} | ${w}`:document.title=w},[e.pathname,w]),g.useEffect(()=>{l?(document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark")):(document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light"))},[l]);const[Ls,Bs]=g.useState([]),sr=g.useRef(null),tn=Ov(ee=>ee.cacheProgress);g.useEffect(()=>(C&&Ov.getState().connect(),()=>Ov.getState().disconnect()),[C]);const[vd,nc]=g.useState(!1),[ir,Qa]=g.useState(null),$n=g.useRef(null);g.useEffect(()=>{if(!(!C||N||$)){$n.current&&$n.current.readyState===WebSocket.OPEN&&$n.current.close(),$n.current=null;return}if($&&!N)return;const Ee=(_t,Mt,kt)=>{Bs(_n=>{const fn={timestamp:kt||new Date().toISOString(),level:_t,message:Mt};return[..._n,fn].slice(-100)}),setTimeout(()=>{sr.current&&(sr.current.scrollTop=sr.current.scrollHeight)},10)};if(N&&C){Bs([]),Ee("INFO","Homing started...");let _t=!0;if($n.current){if($n.current.readyState===WebSocket.CONNECTING)return;$n.current.readyState===WebSocket.OPEN&&$n.current.close(),$n.current=null}const Mt=new WebSocket(fe.getWebSocketUrl("/ws/logs"));return $n.current=Mt,Mt.onopen=()=>{_t||Mt.close()},Mt.onmessage=kt=>{try{const _n=JSON.parse(kt.data);if(_n.type==="heartbeat")return;const fn=_n.type==="log_entry"?_n.data:_n;if(!fn||!fn.message||fn.message.trim()==="")return;const an=fn.message.toLowerCase();(an.includes("homing")||an.includes("home")||an.includes("$h")||an.includes("idle")||an.includes("unlock")||an.includes("alarm")||an.includes("grbl")||an.includes("connect")||an.includes("serial")||an.includes("device")||an.includes("position")||an.includes("zeroing")||an.includes("movement")||fn.logger?.includes("connection"))&&Ee(fn.level,fn.message,fn.timestamp)}catch{}},()=>{_t=!1,Mt.readyState===WebSocket.OPEN&&Mt.close(),$n.current=null}}if(!C){Bs([]),Ee("INFO",`Attempting to connect to backend at ${window.location.host}...`);const _t=setInterval(()=>{Ee("INFO","Retrying connection to WebSocket /ws/status..."),fe.get("/api/settings").then(()=>{Ee("INFO","HTTP endpoint responding, waiting for WebSocket...")}).catch(()=>{})},3e3);return()=>clearInterval(_t)}},[C,N,$]);const xd=g.useRef(tn);g.useEffect(()=>{const ee=xd.current;xd.current=tn,ee?.is_running&&tn?.stage==="complete"&&(localStorage.getItem("cacheAllPromptShown")||setTimeout(()=>{Qa(null),nc(!0)},500))},[tn]);const Jn=tn?.total_files?Math.round(tn.processed_files/tn.total_files*100):0,rc=()=>{if(!tn)return"";switch(tn.stage){case"starting":return"Initializing...";case"metadata":return"Processing pattern metadata";case"images":return"Generating pattern previews";default:return"Processing..."}},yd=async()=>{Qa({inProgress:!0,completed:0,total:0,done:!1});const ee=await uP(Ee=>{Qa({inProgress:!Ee.done,...Ee})});ee.success?ee.cached===0?K.success("All patterns are already cached!"):K.success(`Cached ${ee.cached} pattern previews`):(Qa(null),K.error("Failed to cache previews"))},ac=()=>{localStorage.setItem("cacheAllPromptShown","true"),nc(!1),Qa(null)},Is=()=>{localStorage.setItem("cacheAllPromptShown","true"),nc(!1),Qa(null)},Ri=g.useCallback(()=>{const Ee=z.current?.offsetWidth||140;return{left:16+Ee/2,center:window.innerWidth/2,right:window.innerWidth-16-Ee/2}},[]),sc=g.useCallback((ee,Ee)=>{if(!z.current)return;const _t=z.current.getBoundingClientRect(),Mt=_t.left+_t.width/2;O.current={x:ee,y:Ee,buttonX:Mt},de.current=!1,Qe(!0),ht({x:0,y:0})},[]),_a=g.useCallback(ee=>{if(!O.current||!Oe)return;const Ee=ee-O.current.x;Math.abs(Ee)>8&&(de.current=!0),ht({x:Ee,y:0})},[Oe]),ic=g.useCallback(()=>{if(!O.current||!z.current){Qe(!1),ht({x:0,y:0});return}const ee=O.current.buttonX+dt.x,Ee=Ri(),_t={left:Math.abs(ee-Ee.left),center:Math.abs(ee-Ee.center),right:Math.abs(ee-Ee.right)};let Mt="center",kt=_t.center;_t.left<kt&&(Mt="left",kt=_t.left),_t.right<kt&&(Mt="right"),Xe(Mt),localStorage.setItem("nowPlayingButtonPos",Mt),Qe(!1),ht({x:0,y:0}),O.current=null},[dt.x,Ri]);g.useEffect(()=>{if(!Oe)return;const ee=_t=>{_t.preventDefault(),_a(_t.clientX)},Ee=()=>{ic()};return window.addEventListener("mousemove",ee),window.addEventListener("mouseup",Ee),()=>{window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",Ee)}},[Oe,_a,ic]);const bd=g.useCallback(()=>{const ee={bottom:"calc(4.5rem + env(safe-area-inset-bottom, 0px))"};if(Oe&&O.current){const _t=Ri()[De];return{...ee,left:_t,transform:`translateX(calc(-50% + ${dt.x}px))`,transition:"none",cursor:"grabbing"}}switch(De){case"left":return{...ee,left:"1rem",transform:"translateX(0)"};case"right":return{...ee,right:"1rem",left:"auto",transform:"translateX(0)"};default:return{...ee,left:"50%",transform:"translateX(-50%)"}}},[Oe,dt.x,De,Ri]),oc=ir?.total?Math.round(ir.completed/ir.total*100):0;return o.jsxs("div",{className:"min-h-dvh bg-background flex flex-col",children:[Xa&&o.jsx("div",{className:"fixed inset-0 z-[60] bg-background flex items-center justify-center p-4",children:o.jsxs("div",{className:"w-full max-w-sm space-y-6 text-center",children:[o.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 mb-2",children:o.jsx("span",{className:"material-icons-outlined text-4xl text-primary",children:"lock"})}),o.jsx("h2",{className:"text-2xl font-bold",children:w}),o.jsx("p",{className:"text-muted-foreground",children:"This table is locked. Enter the password to continue."}),o.jsxs("form",{onSubmit:ec,className:"space-y-3",children:[o.jsx(bt,{type:"password",placeholder:"Password",value:je,onChange:ee=>{Me(ee.target.value),He(!1)},autoFocus:!0}),ce&&o.jsx("p",{className:"text-sm text-destructive",children:"Incorrect password"}),o.jsx(se,{type:"submit",className:"w-full",children:"Unlock"})]})]})}),he&&o.jsx("div",{className:"fixed inset-0 z-[60] bg-black/50 backdrop-blur-sm flex items-center justify-center p-4",children:o.jsx("div",{className:"bg-background rounded-lg shadow-xl w-full max-w-sm",children:o.jsxs("div",{className:"p-6 space-y-4",children:[o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-primary/10 mb-2",children:o.jsx("span",{className:"material-icons-outlined text-2xl text-primary",children:"lock"})}),o.jsx("h3",{className:"text-lg font-semibold",children:"Settings Locked"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter the password to access settings."})]}),o.jsxs("form",{onSubmit:ec,className:"space-y-3",children:[o.jsx(bt,{type:"password",placeholder:"Password",value:je,onChange:ee=>{Me(ee.target.value),He(!1)},autoFocus:!0}),ce&&o.jsx("p",{className:"text-sm text-destructive",children:"Incorrect password"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(se,{type:"button",variant:"ghost",className:"flex-1",onClick:()=>{_e(!1),Me(""),He(!1)},children:"Cancel"}),o.jsx(se,{type:"submit",className:"flex-1",children:"Unlock"})]})]})]})})}),_&&o.jsx("div",{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm flex items-center justify-center p-4",children:o.jsx("div",{className:"bg-background rounded-lg shadow-xl w-full max-w-md border border-destructive/30",children:o.jsx("div",{className:"p-6",children:o.jsxs("div",{className:"text-center space-y-4",children:[o.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-destructive/10 mb-2",children:o.jsx("span",{className:"material-icons-outlined text-4xl text-destructive",children:"error_outline"})}),o.jsx("h2",{className:"text-xl font-semibold",children:"Sensor Homing Failed"}),o.jsx("p",{className:"text-muted-foreground text-sm",children:"The sensor homing process could not complete. The limit sensors may not be positioned correctly or may be malfunctioning."}),o.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/20 p-3 rounded-lg text-sm text-left",children:[o.jsx("p",{className:"text-amber-600 dark:text-amber-400 font-medium mb-2",children:"Troubleshooting steps:"}),o.jsxs("ul",{className:"text-amber-600 dark:text-amber-400 space-y-1 list-disc list-inside",children:[o.jsx("li",{children:"Check that the limit sensors are properly connected"}),o.jsx("li",{children:"Verify the sensor positions are correct"}),o.jsx("li",{children:"Ensure nothing is blocking the sensor path"}),o.jsx("li",{children:"Check for loose wiring connections"})]})]}),o.jsx("p",{className:"text-muted-foreground text-sm",children:"Connection will not be established until this is resolved."}),H?o.jsxs("div",{className:"flex items-center justify-center gap-2 py-4",children:[o.jsx("span",{className:"material-icons-outlined text-primary animate-spin",children:"sync"}),o.jsx("span",{className:"text-muted-foreground",children:"Attempting recovery..."})]}):o.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[o.jsxs(se,{onClick:()=>xn(!1),className:"w-full gap-2",children:[o.jsx("span",{className:"material-icons text-base",children:"refresh"}),"Retry Sensor Homing"]}),o.jsxs(se,{variant:"secondary",onClick:()=>xn(!0),className:"w-full gap-2",children:[o.jsx("span",{className:"material-icons text-base",children:"sync_alt"}),"Switch to Crash Homing"]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Crash homing moves the arm to a physical stop without using sensors."})]})]})})})}),tn?.is_running&&o.jsx("div",{className:"fixed inset-0 z-50 bg-background/95 backdrop-blur-sm flex flex-col items-center justify-center p-4",children:o.jsxs("div",{className:"w-full max-w-md space-y-6",children:[o.jsxs("div",{className:"text-center space-y-4",children:[o.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 mb-2",children:o.jsx("span",{className:"material-icons-outlined text-4xl text-primary animate-pulse",children:"cached"})}),o.jsx("h2",{className:"text-2xl font-bold",children:"Initializing Pattern Cache"}),o.jsx("p",{className:"text-muted-foreground",children:"Preparing your pattern previews..."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"w-full bg-muted rounded-full h-2 overflow-hidden",children:o.jsx("div",{className:"bg-primary h-2 rounded-full transition-all duration-300",style:{width:`${Jn}%`}})}),o.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[o.jsxs("span",{children:[tn.processed_files," of ",tn.total_files," patterns"]}),o.jsxs("span",{children:[Jn,"%"]})]})]}),o.jsxs("div",{className:"text-center space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:rc()}),tn.current_file&&o.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-full",children:tn.current_file})]}),o.jsx("p",{className:"text-center text-xs text-muted-foreground",children:"This only happens once after updates or when new patterns are added"})]})}),vd&&o.jsx("div",{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm flex items-center justify-center p-4",children:o.jsx("div",{className:"bg-background rounded-lg shadow-xl w-full max-w-md",children:o.jsx("div",{className:"p-6",children:o.jsxs("div",{className:"text-center space-y-4",children:[o.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-primary/10 mb-2",children:o.jsx("span",{className:"material-icons-outlined text-2xl text-primary",children:"download_for_offline"})}),o.jsx("h2",{className:"text-xl font-semibold",children:"Cache All Pattern Previews?"}),o.jsx("p",{className:"text-muted-foreground text-sm",children:"Would you like to cache all pattern previews for faster browsing? This will download and store preview images in your browser for instant loading."}),o.jsx("div",{className:"bg-amber-500/10 border border-amber-500/20 p-3 rounded-lg text-sm",children:o.jsxs("p",{className:"text-amber-600 dark:text-amber-400",children:[o.jsx("strong",{children:"Note:"})," This cache is browser-specific. You'll need to repeat this for each browser you use."]})}),!ir&&o.jsxs("div",{className:"flex gap-3 justify-center",children:[o.jsx(se,{variant:"ghost",onClick:ac,children:"Skip for now"}),o.jsxs(se,{variant:"secondary",onClick:yd,className:"gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-lg",children:"cached"}),"Cache All"]})]}),ir&&!ir.done&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"w-full bg-muted rounded-full h-2 overflow-hidden",children:o.jsx("div",{className:"bg-primary h-2 rounded-full transition-all duration-300",style:{width:`${oc}%`}})}),o.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[o.jsxs("span",{children:[ir.completed," of ",ir.total," previews"]}),o.jsxs("span",{children:[oc,"%"]})]})]}),ir?.done&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("p",{className:"text-green-600 dark:text-green-400 flex items-center justify-center gap-2",children:[o.jsx("span",{className:"material-icons text-base",children:"check_circle"}),"All ",ir.total," previews cached successfully!"]}),o.jsx(se,{onClick:Is,className:"w-full",children:"Done"})]})]})})})}),!Dv&&!_&&(!C||N&&!U||$)&&o.jsx("div",{className:"fixed inset-0 z-50 bg-background/95 backdrop-blur-sm flex flex-col items-center justify-center p-4",children:o.jsxs("div",{className:"w-full max-w-2xl space-y-6",children:[o.jsxs("div",{className:"text-center space-y-4",children:[o.jsx("div",{className:`inline-flex items-center justify-center w-16 h-16 rounded-full mb-2 ${$?"bg-green-500/10":N?"bg-primary/10":"bg-amber-500/10"}`,children:o.jsx("span",{className:`material-icons-outlined text-4xl ${$?"text-green-500":N?"text-primary animate-spin":"text-amber-500 animate-pulse"}`,children:$?"check_circle":"sync"})}),o.jsx("h2",{className:"text-2xl font-bold",children:$?"Homing Complete":N?"Homing in Progress":"Connecting to Backend"}),o.jsx("p",{className:"text-muted-foreground",children:$?"Table is ready to use":N?"Moving to home position... This may take up to 90 seconds.":S===0?"Establishing connection...":`Reconnecting... (attempt ${S})`}),o.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[o.jsx("span",{className:`w-2 h-2 rounded-full ${$?"bg-green-500":N?"bg-primary animate-pulse":"bg-amber-500 animate-pulse"}`}),o.jsx("span",{children:$?Ce?"Viewing logs":`Closing in ${pe}s...`:N?"Do not interrupt the homing process":`Waiting for server at ${window.location.host}`})]})]}),o.jsxs("div",{className:"bg-muted/50 rounded-lg border overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"terminal"}),o.jsx("span",{className:"text-sm font-medium",children:N||$?"Homing Log":"Connection Log"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("button",{onClick:()=>{const ee=Ls.map(Ee=>`[${new Date(Ee.timestamp).toLocaleTimeString()}] [${Ee.level}] ${Ee.message}`).join(`
  58. `);Ya(ee)},className:"text-xs text-muted-foreground hover:text-foreground flex items-center gap-1 transition-colors",title:"Copy logs to clipboard",children:[o.jsx("span",{className:"material-icons text-sm",children:"content_copy"}),"Copy"]}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[Ls.length," entries"]})]})]}),o.jsx("div",{ref:sr,className:"h-48 overflow-auto p-3 font-mono text-xs space-y-0.5",children:Ls.map((ee,Ee)=>o.jsxs("div",{className:"py-0.5 flex gap-2",children:[o.jsx("span",{className:"text-muted-foreground shrink-0",children:Ka(ee.timestamp)}),o.jsxs("span",{className:`shrink-0 font-semibold ${ee.level==="ERROR"?"text-red-500":ee.level==="WARNING"?"text-amber-500":ee.level==="DEBUG"?"text-muted-foreground":"text-foreground"}`,children:["[",ee.level,"]"]}),o.jsx("span",{className:"break-all",children:ee.message})]},Ee))})]}),$&&o.jsx("div",{className:"flex justify-center gap-3",children:Ce?o.jsxs(se,{onClick:()=>{W(!1),I(!1)},className:"gap-2",children:[o.jsx("span",{className:"material-icons text-base",children:"close"}),"Close Logs"]}):o.jsxs(o.Fragment,{children:[o.jsxs(se,{variant:"secondary",onClick:()=>I(!0),className:"gap-2",children:[o.jsx("span",{className:"material-icons text-base",children:"visibility"}),"Keep Open"]}),o.jsxs(se,{onClick:()=>{W(!1),I(!1)},className:"gap-2",children:[o.jsx("span",{className:"material-icons text-base",children:"close"}),"Dismiss"]})]})}),N&&!$&&o.jsx("div",{className:"flex justify-center",children:o.jsxs(se,{variant:"ghost",onClick:()=>J(!0),className:"gap-2 text-muted-foreground",children:[o.jsx("span",{className:"material-icons text-base",children:"visibility_off"}),"Dismiss"]})}),!$&&o.jsx("p",{className:"text-center text-xs text-muted-foreground",children:N?"Homing will continue in the background":"Make sure the backend server is running on port 8080"})]})}),o.jsxs("header",{className:"fixed top-0 left-0 right-0 z-40 pt-safe",children:[e.pathname==="/"&&o.jsx("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-md supports-[backdrop-filter]:bg-background/50",style:{height:"calc(5rem + env(safe-area-inset-top, 0px))"}}),o.jsx("div",{className:"relative w-full max-w-5xl mx-auto px-3 sm:px-4 pt-3 pointer-events-none",children:o.jsx("div",{className:"rounded-full bg-card shadow-lg border border-border pointer-events-auto",children:o.jsxs("div",{className:"flex h-12 items-center justify-between px-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(pi,{to:"/",children:o.jsx("img",{src:p?fe.getAssetUrl(`/static/custom/${p}`):fe.getAssetUrl("/static/android-chrome-192x192.png"),alt:w,className:"w-8 h-8 rounded-full object-cover"})}),o.jsx(Z9,{children:o.jsxs("button",{className:"flex items-center gap-1.5 hover:opacity-80 transition-opacity group",children:[o.jsx(PY,{text:w,className:"font-semibold text-lg",speed:4,color:l?"#a8a8a8":"#555555",shineColor:l?"#ffffff":"#999999",spread:75}),o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-sm group-hover:text-foreground transition-colors",children:"expand_more"}),o.jsx("span",{className:`w-2 h-2 rounded-full ${C?j?"bg-green-500 animate-pulse":"bg-red-500":"bg-gray-400"}`,title:C?j?"Table connected":"Table disconnected":"Backend not connected"})]})})]}),Ue&&o.jsxs("div",{className:"flex items-center gap-1.5 min-w-0 mx-2 text-amber-500",children:[o.jsx("span",{className:"material-icons-outlined text-base shrink-0",children:"warning"}),o.jsxs("span",{className:"text-xs truncate",children:["FluidNC ",T," — change to ",Le]})]}),o.jsxs("div",{className:"hidden md:flex items-center gap-0 ml-2",children:[hd&&o.jsx(se,{variant:"ghost",size:"icon",className:"rounded-full",onClick:tc,title:"Lock",children:o.jsx("span",{className:"material-icons-outlined",children:"lock_open"})}),Ne&&o.jsx(pi,{to:"/settings?section=version",title:"Software update available",children:o.jsxs("span",{className:"relative flex items-center justify-center w-8 h-8 rounded-full hover:bg-accent transition-colors",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"download"}),o.jsx("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-blue-500 animate-pulse"})]})}),o.jsxs(Bu,{open:St,onOpenChange:Et,children:[o.jsx(Iu,{asChild:!0,children:o.jsx(se,{variant:"ghost",size:"icon",className:"rounded-full","aria-label":"Open menu",children:o.jsx("span",{className:"material-icons-outlined",children:"menu"})})}),o.jsx(Rl,{align:"end",className:"w-56 p-2",children:o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsxs("button",{onClick:()=>u(!l),className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:l?"light_mode":"dark_mode"}),l?"Light Mode":"Dark Mode"]}),o.jsxs("button",{onClick:Ti,className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"article"}),"View Logs"]}),o.jsxs("button",{onClick:()=>{t("/wifi-setup"),Et(!1)},className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"wifi"}),"WiFi Setup"]}),o.jsx(Xn,{className:"my-1"}),o.jsxs("button",{onClick:ks,className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors text-amber-500",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"restart_alt"}),"Restart"]}),o.jsxs("button",{onClick:Wa,className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors text-red-500",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"power_settings_new"}),"Shutdown"]})]})})]})]}),o.jsxs("div",{className:"flex md:hidden items-center gap-0 ml-2",children:[hd&&o.jsx(se,{variant:"ghost",size:"icon",className:"rounded-full",onClick:tc,title:"Lock",children:o.jsx("span",{className:"material-icons-outlined",children:"lock_open"})}),Ne&&o.jsx(pi,{to:"/settings?section=version",title:"Software update available",children:o.jsxs("span",{className:"relative flex items-center justify-center w-8 h-8 rounded-full hover:bg-accent transition-colors",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"download"}),o.jsx("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-blue-500 animate-pulse"})]})}),o.jsxs(Bu,{open:$e,onOpenChange:Ot,children:[o.jsx(Iu,{asChild:!0,children:o.jsx(se,{variant:"ghost",size:"icon",className:"rounded-full","aria-label":"Open menu",children:o.jsx("span",{className:"material-icons-outlined",children:$e?"close":"menu"})})}),o.jsx(Rl,{align:"end",className:"w-56 p-2",children:o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsxs("button",{onClick:()=>{u(!l),Ot(!1)},className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:l?"light_mode":"dark_mode"}),l?"Light Mode":"Dark Mode"]}),o.jsxs("button",{onClick:()=>{Ti(),Ot(!1)},className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"article"}),"View Logs"]}),o.jsxs("button",{onClick:()=>{t("/wifi-setup"),Ot(!1)},className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"wifi"}),"WiFi Setup"]}),o.jsx(Xn,{className:"my-1"}),o.jsxs("button",{onClick:()=>{ks(),Ot(!1)},className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors text-amber-500",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"restart_alt"}),"Restart"]}),o.jsxs("button",{onClick:()=>{Wa(),Ot(!1)},className:"flex items-center gap-3 w-full px-3 py-2 text-sm rounded-md hover:bg-accent transition-colors text-red-500",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"power_settings_new"}),"Shutdown"]})]})})]})]})]})})})]}),o.jsx("main",{className:"container mx-auto px-4 transition-all duration-300",style:{paddingTop:"calc(4.5rem + env(safe-area-inset-top, 0px))",paddingBottom:jt?mt?`calc(${at+256+64}px + env(safe-area-inset-bottom, 0px))`:`calc(${at+64}px + env(safe-area-inset-bottom, 0px))`:mt?"calc(20rem + env(safe-area-inset-bottom, 0px))":"calc(8rem + env(safe-area-inset-bottom, 0px))"},children:o.jsx(h6,{context:{isPlayOnlyActive:ar}})}),o.jsx(tV,{isLogsOpen:jt,logsDrawerHeight:at,isVisible:mt,openExpanded:qt,onClose:()=>gt(!1)}),o.jsx("div",{className:`fixed left-0 right-0 z-30 bg-background border-t border-border ${Kt?"":"transition-[height] duration-300"}`,style:{height:jt?at:0,bottom:"calc(4rem + env(safe-area-inset-bottom, 0px))"},children:jt&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"absolute top-0 left-0 right-0 h-2 cursor-ns-resize flex items-center justify-center group hover:bg-primary/10 -translate-y-1/2 z-10",onMouseDown:xt,onTouchStart:xt,children:o.jsx("div",{className:"w-12 h-1 rounded-full bg-border group-hover:bg-primary transition-colors"})}),o.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-muted/50 gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 flex-wrap min-w-0",children:[o.jsx("span",{className:"text-sm font-medium whitespace-nowrap",children:"Application Logs"}),o.jsxs("select",{value:Y,onChange:ee=>we(ee.target.value),className:"text-xs bg-background border rounded px-2 py-1",children:[o.jsx("option",{value:"ALL",children:"All Levels"}),o.jsx("option",{value:"DEBUG",children:"Debug"}),o.jsx("option",{value:"INFO",children:"Info"}),o.jsx("option",{value:"WARNING",children:"Warning"}),o.jsx("option",{value:"ERROR",children:"Error"})]}),o.jsx("input",{type:"text",value:st,onChange:ee=>et(ee.target.value),placeholder:"Search logs...",className:"text-xs bg-background border rounded px-2 py-1 w-28 sm:w-40"}),st&&o.jsx(se,{variant:"ghost",size:"icon-sm",onClick:()=>et(""),className:"rounded-full",title:"Clear search",children:o.jsx("span",{className:"material-icons-outlined text-sm",children:"close"})}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[Ds.length,Pe>0?` of ${Pe}`:""," entries",ze&&o.jsx("span",{className:"text-primary ml-1",children:"↑ scroll for more"})]})]}),o.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[o.jsx(se,{variant:"ghost",size:"icon-sm",onClick:Jl,className:"rounded-full",title:"Copy logs",children:o.jsx("span",{className:"material-icons-outlined text-base",children:"content_copy"})}),o.jsx(se,{variant:"ghost",size:"icon-sm",onClick:Ps,className:"rounded-full",title:"Download logs",children:o.jsx("span",{className:"material-icons-outlined text-base",children:"download"})}),o.jsx(se,{variant:"ghost",size:"icon-sm",onClick:()=>ot(!1),className:"rounded-full",title:"Close",children:o.jsx("span",{className:"material-icons-outlined text-base",children:"close"})})]})]}),o.jsxs("div",{ref:zt,className:"h-[calc(100%-40px)] overflow-auto overscroll-contain p-3 font-mono text-xs space-y-0.5",children:[Nt&&o.jsxs("div",{className:"flex items-center justify-center gap-2 py-2 text-muted-foreground",children:[o.jsx("span",{className:"material-icons-outlined text-sm animate-spin",children:"sync"}),o.jsx("span",{children:"Loading older logs..."})]}),ze&&!Nt&&o.jsx("div",{className:"text-center py-2 text-muted-foreground text-xs",children:"↑ Scroll up to load older logs"}),Ds.length>0?Ds.map((ee,Ee)=>o.jsxs("div",{className:"py-0.5 flex gap-2",children:[o.jsx("span",{className:"text-muted-foreground shrink-0",children:Ka(ee.timestamp)}),o.jsxs("span",{className:`shrink-0 font-semibold ${ee.level==="ERROR"?"text-red-500":ee.level==="WARNING"?"text-amber-500":ee.level==="DEBUG"?"text-muted-foreground":"text-foreground"}`,children:["[",ee.level||"LOG","]"]}),o.jsx("span",{className:"break-all",children:ee.message||""})]},Ee)):o.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No logs available"})]})]})}),!mt&&o.jsxs("button",{ref:z,onClick:()=>{de.current||gt(!0),de.current=!1},onMouseDown:ee=>{ee.preventDefault(),sc(ee.clientX,ee.clientY)},onTouchStart:ee=>{const Ee=ee.touches[0];sc(Ee.clientX,Ee.clientY)},onTouchMove:ee=>{const Ee=ee.touches[0];_a(Ee.clientX)},onTouchEnd:()=>{ic()},className:`fixed z-40 flex items-center gap-2 px-4 py-2 rounded-full bg-card border border-border shadow-lg select-none touch-none ${Oe?"cursor-grabbing scale-105 shadow-xl":"cursor-grab transition-all duration-300 hover:shadow-xl hover:scale-105 active:scale-95"}`,style:bd(),"aria-label":me?"Now Playing":"Not Playing",children:[o.jsx("span",{className:`material-icons-outlined text-xl ${me?"text-primary":"text-muted-foreground"}`,children:me?"play_circle":"stop_circle"}),o.jsx("span",{className:"text-sm font-medium",children:me?"Now Playing":"Not Playing"})]}),o.jsx("nav",{className:"fixed bottom-0 left-0 right-0 z-40 border-t border-border bg-card pb-safe",children:o.jsxs("div",{className:"max-w-5xl mx-auto grid h-16",style:{gridTemplateColumns:`repeat(${gd.length+(ar?1:0)}, minmax(0, 1fr))`},children:[gd.map(ee=>{const Ee=e.pathname===ee.path;return o.jsxs(pi,{to:ee.path,className:`relative flex flex-col items-center justify-center gap-1 transition-all duration-200 ${Ee?"text-primary":"text-muted-foreground hover:text-foreground active:scale-95"}`,children:[Ee&&o.jsx("span",{className:"absolute -top-0.5 w-8 h-1 rounded-full bg-primary"}),o.jsx("span",{className:`text-xl ${Ee?"material-icons":"material-icons-outlined"}`,children:ee.icon}),o.jsx("span",{className:"text-xs font-medium",children:ee.label})]},ee.path)}),ar&&o.jsxs("button",{onClick:()=>{_e(!0),Me(""),He(!1)},className:"relative flex flex-col items-center justify-center gap-1 transition-all duration-200 text-muted-foreground hover:text-foreground active:scale-95",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"lock"}),o.jsx("span",{className:"text-xs font-medium",children:"Settings"})]})]})})]})}function cS(e){const t=g.useRef(e);g.useEffect(()=>{t.current=e},[e]),g.useEffect(()=>{const n=()=>{t.current()};return window.addEventListener("backend-connected",n),()=>{window.removeEventListener("backend-connected",n)}},[])}var BY=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],IY=BY.reduce((e,t)=>{const n=Vh(`Primitive.${t}`),a=g.forwardRef((i,l)=>{const{asChild:u,...d}=i,h=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(h,{...d,ref:l})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),zY="Label",Zk=g.forwardRef((e,t)=>o.jsx(IY.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Zk.displayName=zY;var Jk=Zk;const FY=Xu("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ke=g.forwardRef(({className:e,...t},n)=>o.jsx(Jk,{ref:n,className:lt(FY(),e),...t}));Ke.displayName=Jk.displayName;function Oh(e,[t,n]){return Math.min(n,Math.max(t,e))}var HY=g.createContext(void 0);function od(e){const t=g.useContext(HY);return e||t||"ltr"}function gp(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function ET(e){const t=UY(e),n=g.forwardRef((a,i)=>{const{children:l,...u}=a,d=g.Children.toArray(l),h=d.find(VY);if(h){const p=h.props.children,v=d.map(m=>m===h?g.Children.count(p)>1?g.Children.only(null):g.isValidElement(p)?p.props.children:null:m);return o.jsx(t,{...u,ref:i,children:g.isValidElement(p)?g.cloneElement(p,void 0,v):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function UY(e){const t=g.forwardRef((n,a)=>{const{children:i,...l}=n;if(g.isValidElement(i)){const u=GY(i),d=$Y(l,i.props);return i.type!==g.Fragment&&(d.ref=a?oo(a,u):u),g.cloneElement(i,d)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var qY=Symbol("radix.slottable");function VY(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===qY}function $Y(e,t){const n={...t};for(const a in t){const i=e[a],l=t[a];/^on[A-Z]/.test(a)?i&&l?n[a]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(n[a]=i):a==="style"?n[a]={...i,...l}:a==="className"&&(n[a]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function GY(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function vp(e){const t=e+"CollectionProvider",[n,a]=Lr(t),[i,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),u=S=>{const{scope:j,children:N}=S,_=R.useRef(null),T=R.useRef(new Map).current;return o.jsx(i,{scope:j,itemMap:T,collectionRef:_,children:N})};u.displayName=t;const d=e+"CollectionSlot",h=ET(d),p=R.forwardRef((S,j)=>{const{scope:N,children:_}=S,T=l(d,N),A=At(j,T.collectionRef);return o.jsx(h,{ref:A,children:_})});p.displayName=d;const v=e+"CollectionItemSlot",m="data-radix-collection-item",b=ET(v),w=R.forwardRef((S,j)=>{const{scope:N,children:_,...T}=S,A=R.useRef(null),D=At(j,A),L=l(v,N);return R.useEffect(()=>(L.itemMap.set(A,{ref:A,...T}),()=>{L.itemMap.delete(A)})),o.jsx(b,{[m]:"",ref:D,children:_})});w.displayName=v;function C(S){const j=l(e+"CollectionConsumer",S);return R.useCallback(()=>{const _=j.collectionRef.current;if(!_)return[];const T=Array.from(_.querySelectorAll(`[${m}]`));return Array.from(j.itemMap.values()).sort((L,k)=>T.indexOf(L.ref.current)-T.indexOf(k.ref.current))},[j.collectionRef,j.itemMap])}return[{Provider:u,Slot:p,ItemSlot:w},C,a]}var e3=["PageUp","PageDown"],t3=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],n3={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Kl="Slider",[N0,KY,YY]=vp(Kl),[r3]=Lr(Kl,[YY]),[WY,xp]=r3(Kl),a3=g.forwardRef((e,t)=>{const{name:n,min:a=0,max:i=100,step:l=1,orientation:u="horizontal",disabled:d=!1,minStepsBetweenThumbs:h=0,defaultValue:p=[a],value:v,onValueChange:m=()=>{},onValueCommit:b=()=>{},inverted:w=!1,form:C,...S}=e,j=g.useRef(new Set),N=g.useRef(0),T=u==="horizontal"?XY:QY,[A=[],D]=Zr({prop:v,defaultProp:p,onChange:$=>{[...j.current][N.current]?.focus(),m($)}}),L=g.useRef(A);function k($){const W=nW(A,$);J($,W)}function P($){J($,N.current)}function U(){const $=L.current[N.current];A[N.current]!==$&&b(A)}function J($,W,{commit:pe}={commit:!1}){const Se=iW(l),Ce=oW(Math.round(($-a)/l)*l+a,Se),I=Oh(Ce,[a,i]);D((q=[])=>{const H=eW(q,I,W);if(sW(H,h*l)){N.current=H.indexOf(I);const be=String(H)!==String(q);return be&&pe&&b(H),be?H:q}else return q})}return o.jsx(WY,{scope:e.__scopeSlider,name:n,disabled:d,min:a,max:i,valueIndexToChangeRef:N,thumbs:j.current,values:A,orientation:u,form:C,children:o.jsx(N0.Provider,{scope:e.__scopeSlider,children:o.jsx(N0.Slot,{scope:e.__scopeSlider,children:o.jsx(T,{"aria-disabled":d,"data-disabled":d?"":void 0,...S,ref:t,onPointerDown:Je(S.onPointerDown,()=>{d||(L.current=A)}),min:a,max:i,inverted:w,onSlideStart:d?void 0:k,onSlideMove:d?void 0:P,onSlideEnd:d?void 0:U,onHomeKeyDown:()=>!d&&J(a,0,{commit:!0}),onEndKeyDown:()=>!d&&J(i,A.length-1,{commit:!0}),onStepKeyDown:({event:$,direction:W})=>{if(!d){const Ce=e3.includes($.key)||$.shiftKey&&t3.includes($.key)?10:1,I=N.current,q=A[I],H=l*Ce*W;J(q+H,I,{commit:!0})}}})})})})});a3.displayName=Kl;var[s3,i3]=r3(Kl,{startEdge:"left",endEdge:"right",size:"width",direction:1}),XY=g.forwardRef((e,t)=>{const{min:n,max:a,dir:i,inverted:l,onSlideStart:u,onSlideMove:d,onSlideEnd:h,onStepKeyDown:p,...v}=e,[m,b]=g.useState(null),w=At(t,T=>b(T)),C=g.useRef(void 0),S=od(i),j=S==="ltr",N=j&&!l||!j&&l;function _(T){const A=C.current||m.getBoundingClientRect(),D=[0,A.width],k=uS(D,N?[n,a]:[a,n]);return C.current=A,k(T-A.left)}return o.jsx(s3,{scope:e.__scopeSlider,startEdge:N?"left":"right",endEdge:N?"right":"left",direction:N?1:-1,size:"width",children:o.jsx(o3,{dir:S,"data-orientation":"horizontal",...v,ref:w,style:{...v.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:T=>{const A=_(T.clientX);u?.(A)},onSlideMove:T=>{const A=_(T.clientX);d?.(A)},onSlideEnd:()=>{C.current=void 0,h?.()},onStepKeyDown:T=>{const D=n3[N?"from-left":"from-right"].includes(T.key);p?.({event:T,direction:D?-1:1})}})})}),QY=g.forwardRef((e,t)=>{const{min:n,max:a,inverted:i,onSlideStart:l,onSlideMove:u,onSlideEnd:d,onStepKeyDown:h,...p}=e,v=g.useRef(null),m=At(t,v),b=g.useRef(void 0),w=!i;function C(S){const j=b.current||v.current.getBoundingClientRect(),N=[0,j.height],T=uS(N,w?[a,n]:[n,a]);return b.current=j,T(S-j.top)}return o.jsx(s3,{scope:e.__scopeSlider,startEdge:w?"bottom":"top",endEdge:w?"top":"bottom",size:"height",direction:w?1:-1,children:o.jsx(o3,{"data-orientation":"vertical",...p,ref:m,style:{...p.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:S=>{const j=C(S.clientY);l?.(j)},onSlideMove:S=>{const j=C(S.clientY);u?.(j)},onSlideEnd:()=>{b.current=void 0,d?.()},onStepKeyDown:S=>{const N=n3[w?"from-bottom":"from-top"].includes(S.key);h?.({event:S,direction:N?-1:1})}})})}),o3=g.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:a,onSlideMove:i,onSlideEnd:l,onHomeKeyDown:u,onEndKeyDown:d,onStepKeyDown:h,...p}=e,v=xp(Kl,n);return o.jsx(ut.span,{...p,ref:t,onKeyDown:Je(e.onKeyDown,m=>{m.key==="Home"?(u(m),m.preventDefault()):m.key==="End"?(d(m),m.preventDefault()):e3.concat(t3).includes(m.key)&&(h(m),m.preventDefault())}),onPointerDown:Je(e.onPointerDown,m=>{const b=m.target;b.setPointerCapture(m.pointerId),m.preventDefault(),v.thumbs.has(b)?b.focus():a(m)}),onPointerMove:Je(e.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&i(m)}),onPointerUp:Je(e.onPointerUp,m=>{const b=m.target;b.hasPointerCapture(m.pointerId)&&(b.releasePointerCapture(m.pointerId),l(m))})})}),l3="SliderTrack",c3=g.forwardRef((e,t)=>{const{__scopeSlider:n,...a}=e,i=xp(l3,n);return o.jsx(ut.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...a,ref:t})});c3.displayName=l3;var _0="SliderRange",u3=g.forwardRef((e,t)=>{const{__scopeSlider:n,...a}=e,i=xp(_0,n),l=i3(_0,n),u=g.useRef(null),d=At(t,u),h=i.values.length,p=i.values.map(b=>h3(b,i.min,i.max)),v=h>1?Math.min(...p):0,m=100-Math.max(...p);return o.jsx(ut.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...a,ref:d,style:{...e.style,[l.startEdge]:v+"%",[l.endEdge]:m+"%"}})});u3.displayName=_0;var E0="SliderThumb",d3=g.forwardRef((e,t)=>{const n=KY(e.__scopeSlider),[a,i]=g.useState(null),l=At(t,d=>i(d)),u=g.useMemo(()=>a?n().findIndex(d=>d.ref.current===a):-1,[n,a]);return o.jsx(ZY,{...e,ref:l,index:u})}),ZY=g.forwardRef((e,t)=>{const{__scopeSlider:n,index:a,name:i,...l}=e,u=xp(E0,n),d=i3(E0,n),[h,p]=g.useState(null),v=At(t,_=>p(_)),m=h?u.form||!!h.closest("form"):!0,b=lp(h),w=u.values[a],C=w===void 0?0:h3(w,u.min,u.max),S=tW(a,u.values.length),j=b?.[d.size],N=j?rW(j,C,d.direction):0;return g.useEffect(()=>{if(h)return u.thumbs.add(h),()=>{u.thumbs.delete(h)}},[h,u.thumbs]),o.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[d.startEdge]:`calc(${C}% + ${N}px)`},children:[o.jsx(N0.ItemSlot,{scope:e.__scopeSlider,children:o.jsx(ut.span,{role:"slider","aria-label":e["aria-label"]||S,"aria-valuemin":u.min,"aria-valuenow":w,"aria-valuemax":u.max,"aria-orientation":u.orientation,"data-orientation":u.orientation,"data-disabled":u.disabled?"":void 0,tabIndex:u.disabled?void 0:0,...l,ref:v,style:w===void 0?{display:"none"}:e.style,onFocus:Je(e.onFocus,()=>{u.valueIndexToChangeRef.current=a})})}),m&&o.jsx(f3,{name:i??(u.name?u.name+(u.values.length>1?"[]":""):void 0),form:u.form,value:w},a)]})});d3.displayName=E0;var JY="RadioBubbleInput",f3=g.forwardRef(({__scopeSlider:e,value:t,...n},a)=>{const i=g.useRef(null),l=At(i,a),u=gp(t);return g.useEffect(()=>{const d=i.current;if(!d)return;const h=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(h,"value").set;if(u!==t&&v){const m=new Event("input",{bubbles:!0});v.call(d,t),d.dispatchEvent(m)}},[u,t]),o.jsx(ut.input,{style:{display:"none"},...n,ref:l,defaultValue:t})});f3.displayName=JY;function eW(e=[],t,n){const a=[...e];return a[n]=t,a.sort((i,l)=>i-l)}function h3(e,t,n){const l=100/(n-t)*(e-t);return Oh(l,[0,100])}function tW(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function nW(e,t){if(e.length===1)return 0;const n=e.map(i=>Math.abs(i-t)),a=Math.min(...n);return n.indexOf(a)}function rW(e,t,n){const a=e/2,l=uS([0,50],[0,a]);return(a-l(t)*n)*n}function aW(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function sW(e,t){if(t>0){const n=aW(e);return Math.min(...n)>=t}return!0}function uS(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const a=(t[1]-t[0])/(e[1]-e[0]);return t[0]+a*(n-e[0])}}function iW(e){return(String(e).split(".")[1]||"").length}function oW(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var p3=a3,lW=c3,cW=u3,uW=d3;const _l=g.forwardRef(({className:e,...t},n)=>o.jsxs(p3,{ref:n,className:lt("relative flex w-full touch-none select-none items-center",e),...t,children:[o.jsx(lW,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:o.jsx(cW,{className:"absolute h-full bg-primary"})}),o.jsx(uW,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));_l.displayName=p3.displayName;function dW(e){const t=fW(e),n=g.forwardRef((a,i)=>{const{children:l,...u}=a,d=g.Children.toArray(l),h=d.find(pW);if(h){const p=h.props.children,v=d.map(m=>m===h?g.Children.count(p)>1?g.Children.only(null):g.isValidElement(p)?p.props.children:null:m);return o.jsx(t,{...u,ref:i,children:g.isValidElement(p)?g.cloneElement(p,void 0,v):null})}return o.jsx(t,{...u,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function fW(e){const t=g.forwardRef((n,a)=>{const{children:i,...l}=n;if(g.isValidElement(i)){const u=gW(i),d=mW(l,i.props);return i.type!==g.Fragment&&(d.ref=a?oo(a,u):u),g.cloneElement(i,d)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var hW=Symbol("radix.slottable");function pW(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hW}function mW(e,t){const n={...t};for(const a in t){const i=e[a],l=t[a];/^on[A-Z]/.test(a)?i&&l?n[a]=(...d)=>{const h=l(...d);return i(...d),h}:i&&(n[a]=i):a==="style"?n[a]={...i,...l}:a==="className"&&(n[a]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function gW(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var m3=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),vW="VisuallyHidden",g3=g.forwardRef((e,t)=>o.jsx(ut.span,{...e,ref:t,style:{...m3,...e.style}}));g3.displayName=vW;var xW=g3,yW=[" ","Enter","ArrowUp","ArrowDown"],bW=[" ","Enter"],ro="Select",[yp,bp,wW]=vp(ro),[Yl]=Lr(ro,[wW,ql]),wp=ql(),[SW,Ni]=Yl(ro),[CW,jW]=Yl(ro),v3=e=>{const{__scopeSelect:t,children:n,open:a,defaultOpen:i,onOpenChange:l,value:u,defaultValue:d,onValueChange:h,dir:p,name:v,autoComplete:m,disabled:b,required:w,form:C}=e,S=wp(t),[j,N]=g.useState(null),[_,T]=g.useState(null),[A,D]=g.useState(!1),L=od(p),[k,P]=Zr({prop:a,defaultProp:i??!1,onChange:l,caller:ro}),[U,J]=Zr({prop:u,defaultProp:d,onChange:h,caller:ro}),$=g.useRef(null),W=j?C||!!j.closest("form"):!0,[pe,Se]=g.useState(new Set),Ce=Array.from(pe).map(I=>I.props.value).join(";");return o.jsx(Ew,{...S,children:o.jsxs(SW,{required:w,scope:t,trigger:j,onTriggerChange:N,valueNode:_,onValueNodeChange:T,valueNodeHasChildren:A,onValueNodeHasChildrenChange:D,contentId:ma(),value:U,onValueChange:J,open:k,onOpenChange:P,dir:L,triggerPointerDownPosRef:$,disabled:b,children:[o.jsx(yp.Provider,{scope:t,children:o.jsx(CW,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(I=>{Se(q=>new Set(q).add(I))},[]),onNativeOptionRemove:g.useCallback(I=>{Se(q=>{const H=new Set(q);return H.delete(I),H})},[]),children:n})}),W?o.jsxs(U3,{"aria-hidden":!0,required:w,tabIndex:-1,name:v,autoComplete:m,value:U,onChange:I=>J(I.target.value),disabled:b,form:C,children:[U===void 0?o.jsx("option",{value:""}):null,Array.from(pe)]},Ce):null]})})};v3.displayName=ro;var x3="SelectTrigger",y3=g.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:a=!1,...i}=e,l=wp(n),u=Ni(x3,n),d=u.disabled||a,h=At(t,u.onTriggerChange),p=bp(n),v=g.useRef("touch"),[m,b,w]=V3(S=>{const j=p().filter(T=>!T.disabled),N=j.find(T=>T.value===u.value),_=$3(j,S,N);_!==void 0&&u.onValueChange(_.value)}),C=S=>{d||(u.onOpenChange(!0),w()),S&&(u.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return o.jsx(cp,{asChild:!0,...l,children:o.jsx(ut.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":q3(u.value)?"":void 0,...i,ref:h,onClick:Je(i.onClick,S=>{S.currentTarget.focus(),v.current!=="mouse"&&C(S)}),onPointerDown:Je(i.onPointerDown,S=>{v.current=S.pointerType;const j=S.target;j.hasPointerCapture(S.pointerId)&&j.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(C(S),S.preventDefault())}),onKeyDown:Je(i.onKeyDown,S=>{const j=m.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&b(S.key),!(j&&S.key===" ")&&yW.includes(S.key)&&(C(),S.preventDefault())})})})});y3.displayName=x3;var b3="SelectValue",w3=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:i,children:l,placeholder:u="",...d}=e,h=Ni(b3,n),{onValueNodeHasChildrenChange:p}=h,v=l!==void 0,m=At(t,h.onValueNodeChange);return Vn(()=>{p(v)},[p,v]),o.jsx(ut.span,{...d,ref:m,style:{pointerEvents:"none"},children:q3(h.value)?o.jsx(o.Fragment,{children:u}):l})});w3.displayName=b3;var NW="SelectIcon",S3=g.forwardRef((e,t)=>{const{__scopeSelect:n,children:a,...i}=e;return o.jsx(ut.span,{"aria-hidden":!0,...i,ref:t,children:a||"▼"})});S3.displayName=NW;var _W="SelectPortal",C3=e=>o.jsx(Gh,{asChild:!0,...e});C3.displayName=_W;var ao="SelectContent",j3=g.forwardRef((e,t)=>{const n=Ni(ao,e.__scopeSelect),[a,i]=g.useState();if(Vn(()=>{i(new DocumentFragment)},[]),!n.open){const l=a;return l?ka.createPortal(o.jsx(N3,{scope:e.__scopeSelect,children:o.jsx(yp.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),l):null}return o.jsx(_3,{...e,ref:t})});j3.displayName=ao;var la=10,[N3,_i]=Yl(ao),EW="SelectContentImpl",TW=dW("SelectContent.RemoveScroll"),_3=g.forwardRef((e,t)=>{const{__scopeSelect:n,position:a="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:l,onPointerDownOutside:u,side:d,sideOffset:h,align:p,alignOffset:v,arrowPadding:m,collisionBoundary:b,collisionPadding:w,sticky:C,hideWhenDetached:S,avoidCollisions:j,...N}=e,_=Ni(ao,n),[T,A]=g.useState(null),[D,L]=g.useState(null),k=At(t,te=>A(te)),[P,U]=g.useState(null),[J,$]=g.useState(null),W=bp(n),[pe,Se]=g.useState(!1),Ce=g.useRef(!1);g.useEffect(()=>{if(T)return sw(T)},[T]),aw();const I=g.useCallback(te=>{const[he,..._e]=W().map(ce=>ce.ref.current),[je]=_e.slice(-1),Me=document.activeElement;for(const ce of te)if(ce===Me||(ce?.scrollIntoView({block:"nearest"}),ce===he&&D&&(D.scrollTop=0),ce===je&&D&&(D.scrollTop=D.scrollHeight),ce?.focus(),document.activeElement!==Me))return},[W,D]),q=g.useCallback(()=>I([P,T]),[I,P,T]);g.useEffect(()=>{pe&&q()},[pe,q]);const{onOpenChange:H,triggerPointerDownPosRef:be}=_;g.useEffect(()=>{if(T){let te={x:0,y:0};const he=je=>{te={x:Math.abs(Math.round(je.pageX)-(be.current?.x??0)),y:Math.abs(Math.round(je.pageY)-(be.current?.y??0))}},_e=je=>{te.x<=10&&te.y<=10?je.preventDefault():T.contains(je.target)||H(!1),document.removeEventListener("pointermove",he),be.current=null};return be.current!==null&&(document.addEventListener("pointermove",he),document.addEventListener("pointerup",_e,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",he),document.removeEventListener("pointerup",_e,{capture:!0})}}},[T,H,be]),g.useEffect(()=>{const te=()=>H(!1);return window.addEventListener("blur",te),window.addEventListener("resize",te),()=>{window.removeEventListener("blur",te),window.removeEventListener("resize",te)}},[H]);const[Ne,B]=V3(te=>{const he=W().filter(Me=>!Me.disabled),_e=he.find(Me=>Me.ref.current===document.activeElement),je=$3(he,te,_e);je&&setTimeout(()=>je.ref.current.focus())}),G=g.useCallback((te,he,_e)=>{const je=!Ce.current&&!_e;(_.value!==void 0&&_.value===he||je)&&(U(te),je&&(Ce.current=!0))},[_.value]),X=g.useCallback(()=>T?.focus(),[T]),oe=g.useCallback((te,he,_e)=>{const je=!Ce.current&&!_e;(_.value!==void 0&&_.value===he||je)&&$(te)},[_.value]),xe=a==="popper"?T0:E3,Q=xe===T0?{side:d,sideOffset:h,align:p,alignOffset:v,arrowPadding:m,collisionBoundary:b,collisionPadding:w,sticky:C,hideWhenDetached:S,avoidCollisions:j}:{};return o.jsx(N3,{scope:n,content:T,viewport:D,onViewportChange:L,itemRefCallback:G,selectedItem:P,onItemLeave:X,itemTextRefCallback:oe,focusSelectedItem:q,selectedItemText:J,position:a,isPositioned:pe,searchRef:Ne,children:o.jsx(Yh,{as:TW,allowPinchZoom:!0,children:o.jsx($h,{asChild:!0,trapped:_.open,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:Je(i,te=>{_.trigger?.focus({preventScroll:!0}),te.preventDefault()}),children:o.jsx(Qu,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:te=>te.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:o.jsx(xe,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:te=>te.preventDefault(),...N,...Q,onPlaced:()=>Se(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...N.style},onKeyDown:Je(N.onKeyDown,te=>{const he=te.ctrlKey||te.altKey||te.metaKey;if(te.key==="Tab"&&te.preventDefault(),!he&&te.key.length===1&&B(te.key),["ArrowUp","ArrowDown","Home","End"].includes(te.key)){let je=W().filter(Me=>!Me.disabled).map(Me=>Me.ref.current);if(["ArrowUp","End"].includes(te.key)&&(je=je.slice().reverse()),["ArrowUp","ArrowDown"].includes(te.key)){const Me=te.target,ce=je.indexOf(Me);je=je.slice(ce+1)}setTimeout(()=>I(je)),te.preventDefault()}})})})})})})});_3.displayName=EW;var RW="SelectItemAlignedPosition",E3=g.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:a,...i}=e,l=Ni(ao,n),u=_i(ao,n),[d,h]=g.useState(null),[p,v]=g.useState(null),m=At(t,k=>v(k)),b=bp(n),w=g.useRef(!1),C=g.useRef(!0),{viewport:S,selectedItem:j,selectedItemText:N,focusSelectedItem:_}=u,T=g.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&p&&S&&j&&N){const k=l.trigger.getBoundingClientRect(),P=p.getBoundingClientRect(),U=l.valueNode.getBoundingClientRect(),J=N.getBoundingClientRect();if(l.dir!=="rtl"){const Me=J.left-P.left,ce=U.left-Me,He=k.left-ce,Le=k.width+He,Ue=Math.max(Le,P.width),wt=window.innerWidth-la,$e=Oh(ce,[la,Math.max(la,wt-Ue)]);d.style.minWidth=Le+"px",d.style.left=$e+"px"}else{const Me=P.right-J.right,ce=window.innerWidth-U.right-Me,He=window.innerWidth-k.right-ce,Le=k.width+He,Ue=Math.max(Le,P.width),wt=window.innerWidth-la,$e=Oh(ce,[la,Math.max(la,wt-Ue)]);d.style.minWidth=Le+"px",d.style.right=$e+"px"}const $=b(),W=window.innerHeight-la*2,pe=S.scrollHeight,Se=window.getComputedStyle(p),Ce=parseInt(Se.borderTopWidth,10),I=parseInt(Se.paddingTop,10),q=parseInt(Se.borderBottomWidth,10),H=parseInt(Se.paddingBottom,10),be=Ce+I+pe+H+q,Ne=Math.min(j.offsetHeight*5,be),B=window.getComputedStyle(S),G=parseInt(B.paddingTop,10),X=parseInt(B.paddingBottom,10),oe=k.top+k.height/2-la,xe=W-oe,Q=j.offsetHeight/2,te=j.offsetTop+Q,he=Ce+I+te,_e=be-he;if(he<=oe){const Me=$.length>0&&j===$[$.length-1].ref.current;d.style.bottom="0px";const ce=p.clientHeight-S.offsetTop-S.offsetHeight,He=Math.max(xe,Q+(Me?X:0)+ce+q),Le=he+He;d.style.height=Le+"px"}else{const Me=$.length>0&&j===$[0].ref.current;d.style.top="0px";const He=Math.max(oe,Ce+S.offsetTop+(Me?G:0)+Q)+_e;d.style.height=He+"px",S.scrollTop=he-oe+S.offsetTop}d.style.margin=`${la}px 0`,d.style.minHeight=Ne+"px",d.style.maxHeight=W+"px",a?.(),requestAnimationFrame(()=>w.current=!0)}},[b,l.trigger,l.valueNode,d,p,S,j,N,l.dir,a]);Vn(()=>T(),[T]);const[A,D]=g.useState();Vn(()=>{p&&D(window.getComputedStyle(p).zIndex)},[p]);const L=g.useCallback(k=>{k&&C.current===!0&&(T(),_?.(),C.current=!1)},[T,_]);return o.jsx(OW,{scope:n,contentWrapper:d,shouldExpandOnScrollRef:w,onScrollButtonChange:L,children:o.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:A},children:o.jsx(ut.div,{...i,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});E3.displayName=RW;var AW="SelectPopperPosition",T0=g.forwardRef((e,t)=>{const{__scopeSelect:n,align:a="start",collisionPadding:i=la,...l}=e,u=wp(n);return o.jsx(Tw,{...u,...l,ref:t,align:a,collisionPadding:i,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});T0.displayName=AW;var[OW,dS]=Yl(ao,{}),R0="SelectViewport",T3=g.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:a,...i}=e,l=_i(R0,n),u=dS(R0,n),d=At(t,l.onViewportChange),h=g.useRef(0);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),o.jsx(yp.Slot,{scope:n,children:o.jsx(ut.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Je(i.onScroll,p=>{const v=p.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:b}=u;if(b?.current&&m){const w=Math.abs(h.current-v.scrollTop);if(w>0){const C=window.innerHeight-la*2,S=parseFloat(m.style.minHeight),j=parseFloat(m.style.height),N=Math.max(S,j);if(N<C){const _=N+w,T=Math.min(C,_),A=_-T;m.style.height=T+"px",m.style.bottom==="0px"&&(v.scrollTop=A>0?A:0,m.style.justifyContent="flex-end")}}}h.current=v.scrollTop})})})]})});T3.displayName=R0;var R3="SelectGroup",[MW,DW]=Yl(R3),A3=g.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,i=ma();return o.jsx(MW,{scope:n,id:i,children:o.jsx(ut.div,{role:"group","aria-labelledby":i,...a,ref:t})})});A3.displayName=R3;var O3="SelectLabel",M3=g.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,i=DW(O3,n);return o.jsx(ut.div,{id:i.id,...a,ref:t})});M3.displayName=O3;var Mh="SelectItem",[PW,D3]=Yl(Mh),P3=g.forwardRef((e,t)=>{const{__scopeSelect:n,value:a,disabled:i=!1,textValue:l,...u}=e,d=Ni(Mh,n),h=_i(Mh,n),p=d.value===a,[v,m]=g.useState(l??""),[b,w]=g.useState(!1),C=At(t,_=>h.itemRefCallback?.(_,a,i)),S=ma(),j=g.useRef("touch"),N=()=>{i||(d.onValueChange(a),d.onOpenChange(!1))};if(a==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return o.jsx(PW,{scope:n,value:a,disabled:i,textId:S,isSelected:p,onItemTextChange:g.useCallback(_=>{m(T=>T||(_?.textContent??"").trim())},[]),children:o.jsx(yp.ItemSlot,{scope:n,value:a,disabled:i,textValue:v,children:o.jsx(ut.div,{role:"option","aria-labelledby":S,"data-highlighted":b?"":void 0,"aria-selected":p&&b,"data-state":p?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...u,ref:C,onFocus:Je(u.onFocus,()=>w(!0)),onBlur:Je(u.onBlur,()=>w(!1)),onClick:Je(u.onClick,()=>{j.current!=="mouse"&&N()}),onPointerUp:Je(u.onPointerUp,()=>{j.current==="mouse"&&N()}),onPointerDown:Je(u.onPointerDown,_=>{j.current=_.pointerType}),onPointerMove:Je(u.onPointerMove,_=>{j.current=_.pointerType,i?h.onItemLeave?.():j.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Je(u.onPointerLeave,_=>{_.currentTarget===document.activeElement&&h.onItemLeave?.()}),onKeyDown:Je(u.onKeyDown,_=>{h.searchRef?.current!==""&&_.key===" "||(bW.includes(_.key)&&N(),_.key===" "&&_.preventDefault())})})})})});P3.displayName=Mh;var uu="SelectItemText",k3=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:i,...l}=e,u=Ni(uu,n),d=_i(uu,n),h=D3(uu,n),p=jW(uu,n),[v,m]=g.useState(null),b=At(t,N=>m(N),h.onItemTextChange,N=>d.itemTextRefCallback?.(N,h.value,h.disabled)),w=v?.textContent,C=g.useMemo(()=>o.jsx("option",{value:h.value,disabled:h.disabled,children:w},h.value),[h.disabled,h.value,w]),{onNativeOptionAdd:S,onNativeOptionRemove:j}=p;return Vn(()=>(S(C),()=>j(C)),[S,j,C]),o.jsxs(o.Fragment,{children:[o.jsx(ut.span,{id:h.textId,...l,ref:b}),h.isSelected&&u.valueNode&&!u.valueNodeHasChildren?ka.createPortal(l.children,u.valueNode):null]})});k3.displayName=uu;var L3="SelectItemIndicator",B3=g.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return D3(L3,n).isSelected?o.jsx(ut.span,{"aria-hidden":!0,...a,ref:t}):null});B3.displayName=L3;var A0="SelectScrollUpButton",I3=g.forwardRef((e,t)=>{const n=_i(A0,e.__scopeSelect),a=dS(A0,e.__scopeSelect),[i,l]=g.useState(!1),u=At(t,a.onScrollButtonChange);return Vn(()=>{if(n.viewport&&n.isPositioned){let d=function(){const p=h.scrollTop>0;l(p)};const h=n.viewport;return d(),h.addEventListener("scroll",d),()=>h.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),i?o.jsx(F3,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=n;d&&h&&(d.scrollTop=d.scrollTop-h.offsetHeight)}}):null});I3.displayName=A0;var O0="SelectScrollDownButton",z3=g.forwardRef((e,t)=>{const n=_i(O0,e.__scopeSelect),a=dS(O0,e.__scopeSelect),[i,l]=g.useState(!1),u=At(t,a.onScrollButtonChange);return Vn(()=>{if(n.viewport&&n.isPositioned){let d=function(){const p=h.scrollHeight-h.clientHeight,v=Math.ceil(h.scrollTop)<p;l(v)};const h=n.viewport;return d(),h.addEventListener("scroll",d),()=>h.removeEventListener("scroll",d)}},[n.viewport,n.isPositioned]),i?o.jsx(F3,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:h}=n;d&&h&&(d.scrollTop=d.scrollTop+h.offsetHeight)}}):null});z3.displayName=O0;var F3=g.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:a,...i}=e,l=_i("SelectScrollButton",n),u=g.useRef(null),d=bp(n),h=g.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return g.useEffect(()=>()=>h(),[h]),Vn(()=>{d().find(v=>v.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[d]),o.jsx(ut.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Je(i.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(a,50))}),onPointerMove:Je(i.onPointerMove,()=>{l.onItemLeave?.(),u.current===null&&(u.current=window.setInterval(a,50))}),onPointerLeave:Je(i.onPointerLeave,()=>{h()})})}),kW="SelectSeparator",H3=g.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return o.jsx(ut.div,{"aria-hidden":!0,...a,ref:t})});H3.displayName=kW;var M0="SelectArrow",LW=g.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,i=wp(n),l=Ni(M0,n),u=_i(M0,n);return l.open&&u.position==="popper"?o.jsx(Rw,{...i,...a,ref:t}):null});LW.displayName=M0;var BW="SelectBubbleInput",U3=g.forwardRef(({__scopeSelect:e,value:t,...n},a)=>{const i=g.useRef(null),l=At(a,i),u=gp(t);return g.useEffect(()=>{const d=i.current;if(!d)return;const h=window.HTMLSelectElement.prototype,v=Object.getOwnPropertyDescriptor(h,"value").set;if(u!==t&&v){const m=new Event("change",{bubbles:!0});v.call(d,t),d.dispatchEvent(m)}},[u,t]),o.jsx(ut.select,{...n,style:{...m3,...n.style},ref:l,defaultValue:t})});U3.displayName=BW;function q3(e){return e===""||e===void 0}function V3(e){const t=gi(e),n=g.useRef(""),a=g.useRef(0),i=g.useCallback(u=>{const d=n.current+u;t(d),(function h(p){n.current=p,window.clearTimeout(a.current),p!==""&&(a.current=window.setTimeout(()=>h(""),1e3))})(d)},[t]),l=g.useCallback(()=>{n.current="",window.clearTimeout(a.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(a.current),[]),[n,i,l]}function $3(e,t,n){const i=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,l=n?e.indexOf(n):-1;let u=IW(e,Math.max(l,0));i.length===1&&(u=u.filter(p=>p!==n));const h=u.find(p=>p.textValue.toLowerCase().startsWith(i.toLowerCase()));return h!==n?h:void 0}function IW(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var zW=v3,G3=y3,FW=w3,HW=S3,UW=C3,K3=j3,qW=T3,VW=A3,Y3=M3,W3=P3,$W=k3,GW=B3,X3=I3,Q3=z3,Z3=H3;const Pn=zW,TT=VW,Hn=FW,An=g.forwardRef(({className:e,children:t,...n},a)=>o.jsxs(G3,{ref:a,className:lt("flex h-10 w-full items-center justify-between rounded-full border border-input bg-background px-4 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,o.jsx(HW,{asChild:!0,children:o.jsx(cw,{className:"h-4 w-4 opacity-50"})})]}));An.displayName=G3.displayName;const J3=g.forwardRef(({className:e,...t},n)=>o.jsx(X3,{ref:n,className:lt("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(WH,{className:"h-4 w-4"})}));J3.displayName=X3.displayName;const e5=g.forwardRef(({className:e,...t},n)=>o.jsx(Q3,{ref:n,className:lt("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(cw,{className:"h-4 w-4"})}));e5.displayName=Q3.displayName;const On=g.forwardRef(({className:e,children:t,position:n="popper",...a},i)=>o.jsx(UW,{children:o.jsxs(K3,{ref:i,className:lt("relative z-[9999] max-h-[min(var(--radix-select-content-available-height,256px),256px)] min-w-[8rem] overflow-hidden rounded-2xl border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...a,children:[o.jsx(J3,{}),o.jsx(qW,{className:lt("p-1 max-h-[inherit] overflow-y-auto",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),o.jsx(e5,{})]})}));On.displayName=K3.displayName;const D0=g.forwardRef(({className:e,...t},n)=>o.jsx(Y3,{ref:n,className:lt("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));D0.displayName=Y3.displayName;const nt=g.forwardRef(({className:e,children:t,...n},a)=>o.jsxs(W3,{ref:a,className:lt("relative flex w-full cursor-default select-none items-center rounded-xl py-1.5 pl-8 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(GW,{children:o.jsx(eD,{className:"h-4 w-4"})})}),o.jsx($W,{children:t})]}));nt.displayName=W3.displayName;const KW=g.forwardRef(({className:e,...t},n)=>o.jsx(Z3,{ref:n,className:lt("-mx-1 my-1 h-px bg-muted",e),...t}));KW.displayName=Z3.displayName;const YW=XM,WW=QM,t5=g.forwardRef(({className:e,...t},n)=>o.jsx(Xh,{className:lt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));t5.displayName=Xh.displayName;const XW=Xu("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-full border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-md"}},defaultVariants:{side:"right"}}),n5=g.forwardRef(({side:e="right",className:t,children:n,...a},i)=>o.jsxs(WW,{children:[o.jsx(t5,{}),o.jsxs(Qh,{ref:i,className:lt(XW({side:e}),t),...a,children:[n,o.jsxs(ZM,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[o.jsx(nD,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));n5.displayName=Qh.displayName;const r5=({className:e,...t})=>o.jsx("div",{className:lt("flex flex-col space-y-2 text-center sm:text-left",e),...t});r5.displayName="SheetHeader";const a5=g.forwardRef(({className:e,...t},n)=>o.jsx(Zh,{ref:n,className:lt("text-lg font-semibold text-foreground",e),...t}));a5.displayName=Zh.displayName;const QW=g.forwardRef(({className:e,...t},n)=>o.jsx(Jh,{ref:n,className:lt("text-sm text-muted-foreground",e),...t}));QW.displayName=Jh.displayName;const P0=[{value:"adaptive",label:"Adaptive",description:"Automatically picks the best clear direction based on where the ball is"},{value:"clear_from_in",label:"From Center",description:"Spirals outward from the center to erase the current pattern"},{value:"clear_from_out",label:"From Perimeter",description:"Spirals inward from the edge to erase the current pattern"},{value:"clear_sideway",label:"Sideways",description:"Sweeps side-to-side across the sand to erase the current pattern"},{value:"none",label:"None",description:"Start drawing immediately without clearing the sand first"}],s5=g.createContext(null);function ZW(){const{isPlayOnlyActive:e}=HO()||{},[t,n]=g.useState([]),[a,i]=g.useState({}),[l,u]=g.useState(!0),[d,h]=g.useState(""),[p,v]=g.useState("all"),[m,b]=g.useState("name"),[w,C]=g.useState(!0),[S,j]=g.useState(null),[N,_]=g.useState(!1),[T,A]=g.useState(()=>localStorage.getItem("preExecution")||"adaptive"),[D,L]=g.useState(!1),[k,P]=g.useState(!1),[U,J]=g.useState([]),[$,W]=g.useState(!1),[pe,Se]=g.useState(!1),[Ce,I]=g.useState(1),[q,H]=g.useState(0),[be,Ne]=g.useState(null),[B,G]=g.useState({}),X=g.useRef(null),oe=g.useRef(null),xe=g.useRef(0),Q=g.useRef(new Set),te=g.useRef(null),he=g.useRef(null),[_e,je]=g.useState(!1),[Me,ce]=g.useState(0),[He,Le]=g.useState(!1),[Ue,wt]=g.useState(new Set),$e=g.useRef(null),[Ot,St]=g.useState(!1),Et=g.useRef(null),jt=Y=>{Et.current={x:Y.touches[0].clientX,y:Y.touches[0].clientY}},ot=Y=>{if(!Et.current)return;const we=Y.changedTouches[0].clientX-Et.current.x,Pe=Y.changedTouches[0].clientY-Et.current.y;(we>80&&we>Math.abs(Pe)||Pe>80&&Pe>Math.abs(we))&&_(!1),Et.current=null};g.useEffect(()=>{const Y=()=>{_(!1)};return window.addEventListener("playback-started",Y),()=>window.removeEventListener("playback-started",Y)},[]),g.useEffect(()=>{localStorage.setItem("preExecution",T)},[T]),g.useEffect(()=>(dp().then(()=>{Kt()}).catch(()=>{Kt()}),at(),()=>{te.current&&clearTimeout(te.current),he.current&&he.current.abort(),Q.current.clear()}),[]),cS(()=>{Kt(),at()});const at=async()=>{try{const Y=await fe.get("/get_playlist?name=Favorites");wt(new Set(Y.files||[]))}catch{}},vt=async(Y,we)=>{we.stopPropagation();const Pe=Ue.has(Y),ke=new Set(Ue);try{if(Pe)ke.delete(Y),await fe.post("/modify_playlist",{playlist_name:"Favorites",files:Array.from(ke)}),wt(ke),K.success("Removed from favorites");else{ke.add(Y);try{await fe.get("/get_playlist?name=Favorites"),await fe.post("/add_to_playlist",{playlist_name:"Favorites",pattern:Y})}catch{await fe.post("/create_playlist",{playlist_name:"Favorites",files:[Y]})}wt(ke),K.success("Added to favorites")}}catch{K.error("Failed to update favorites")}},Kt=async()=>{u(!0);try{const[Y,we]=await Promise.all([fe.get("/list_theta_rho_files_with_metadata"),fe.get("/api/pattern_history_all")]);if(n(Y),G(we),Y.length>0){const Pe=[...Y].sort((it,zt)=>it.name.localeCompare(zt.name)),ke=Y.map(it=>it.path),ze=Pe.slice(0,30).map(it=>it.path),ct=await bu(ze);if(ct.size>0){const it={};ct.forEach((zt,Zn)=>{it[Zn]=zt}),i(it)}const Nt=ze.filter(it=>!ct.has(it));Nt.length>0&&Yt(Nt);const Tt=await bu(ke);Le(Tt.size===ke.length)}}catch(Y){console.error("Error fetching patterns:",Y),K.error("Failed to load patterns")}finally{u(!1)}},Yt=async Y=>{he.current=new AbortController;const Pe=he.current.signal;try{const ke=await bu(Y);if(ke.size>0){const ct={};ke.forEach((Nt,Tt)=>{ct[Tt]=Nt}),i(Nt=>({...Nt,...ct}))}const ze=Y.filter(ct=>!ke.has(ct));if(ze.length>0)for(let ct=0;ct<ze.length&&!Pe.aborted;ct+=10){const Nt=ze.slice(ct,ct+10);try{const Tt=await fe.post("/preview_thr_batch",{file_names:Nt},Pe);for(const[it,zt]of Object.entries(Tt))zt&&!zt.error&&Ow(it,zt);i(it=>({...it,...Tt}))}catch(Tt){if(Tt instanceof Error&&Tt.name==="AbortError")break}ct+10<ze.length&&await new Promise(Tt=>setTimeout(Tt,100))}}catch(ke){if(ke instanceof Error&&ke.name==="AbortError")return;console.error("Error fetching previews:",ke)}},Wt=async Y=>{W(!0);try{const we=await fe.post("/get_theta_rho_coordinates",{file_name:Y});J(we.coordinates||[])}catch(we){console.error("Error fetching coordinates:",we),K.error("Failed to load pattern coordinates")}finally{W(!1)}},ne=g.useMemo(()=>{const Y=new Set(t.map(we=>we.category));return["all",...Array.from(Y).sort()]},[t]),Re=g.useMemo(()=>{let Y=t;return p!=="all"&&(Y=Y.filter(we=>we.category===p)),d&&(Y=Y.filter(we=>Au(we.name,d)||Au(we.category,d))),Y=[...Y].sort((we,Pe)=>{let ke=0;switch(m){case"name":ke=we.name.localeCompare(Pe.name);break;case"date":ke=we.date_modified-Pe.date_modified;break;case"size":ke=we.coordinates_count-Pe.coordinates_count;break;case"favorites":{const ze=Ue.has(we.path)?1:0;ke=(Ue.has(Pe.path)?1:0)-ze,ke===0&&(ke=we.name.localeCompare(Pe.name));break}case"plays":{const ze=we.path.split("/").pop()||"",ct=Pe.path.split("/").pop()||"",Nt=B[ze]?.play_count??0,Tt=B[ct]?.play_count??0;ke=Nt-Tt,ke===0&&(ke=we.name.localeCompare(Pe.name));break}case"last_played":{const ze=we.path.split("/").pop()||"",ct=Pe.path.split("/").pop()||"",Nt=B[ze]?.last_played||"",Tt=B[ct]?.last_played||"";ke=Nt.localeCompare(Tt),ke===0&&(ke=we.name.localeCompare(Pe.name));break}default:return 0}return w?ke:-ke}),Y},[t,p,d,m,w,Ue,B]),st=g.useCallback(Y=>{a[Y]||Q.current.has(Y)||(Q.current.add(Y),te.current&&clearTimeout(te.current),te.current=setTimeout(()=>{const we=Array.from(Q.current);we.length>0&&(Q.current.clear(),Yt(we))},50))},[a]),et=g.useCallback((Y,we,Pe)=>{const ke=Pe/2,ze=Pe/2,ct=Pe/2*.9*we,Nt=ke+ct*Math.cos(Y),Tt=ze+ct*Math.sin(Y);return{x:Nt,y:Tt}},[]),xt=g.useRef(null),mt=g.useRef(-1),gt=g.useRef(null),qt=g.useCallback(()=>{const Y=document.documentElement.classList.contains("dark");return{isDark:Y,bgOuter:Y?"#1a1a1a":"#f5f5f5",bgInner:Y?"#262626":"#ffffff",borderColor:Y?"rgba(255, 255, 255, 0.2)":"rgba(128, 128, 128, 0.3)",lineColor:Y?"#e5e5e5":"#333333",markerBorder:Y?"#333333":"#ffffff"}},[]),ue=g.useCallback((Y,we)=>{const Pe=qt();xt.current||(xt.current=document.createElement("canvas"));const ke=xt.current;ke.width=Y,ke.height=Y;const ze=ke.getContext("2d");if(ze){if(ze.fillStyle=Pe.bgOuter,ze.fillRect(0,0,Y,Y),ze.beginPath(),ze.arc(Y/2,Y/2,Y/2*.95,0,Math.PI*2),ze.fillStyle=Pe.bgInner,ze.fill(),ze.strokeStyle=Pe.borderColor,ze.lineWidth=1,ze.stroke(),ze.strokeStyle=Pe.lineColor,ze.lineWidth=1,ze.lineCap="round",ze.lineJoin="round",we.length>0){const ct=et(we[0][0],we[0][1],Y);ze.beginPath(),ze.moveTo(ct.x,ct.y),ze.stroke()}mt.current=0,gt.current=Pe.isDark}},[qt,et]),Te=g.useCallback((Y,we,Pe,ke=!1)=>{const ct=Y.canvas.width,Nt=qt();(ke||!xt.current||gt.current!==Nt.isDark||Pe<mt.current)&&ue(ct,we);const it=xt.current;if(!it)return;const zt=it.getContext("2d");if(zt){if(we.length>0&&Pe>mt.current){zt.strokeStyle=Nt.lineColor,zt.lineWidth=1,zt.lineCap="round",zt.lineJoin="round",zt.beginPath();const Zn=et(we[mt.current][0],we[mt.current][1],ct);zt.moveTo(Zn.x,Zn.y);for(let Na=mt.current+1;Na<=Pe&&Na<we.length;Na++){const Ti=et(we[Na][0],we[Na][1],ct);zt.lineTo(Ti.x,Ti.y)}zt.stroke(),mt.current=Pe}if(Y.drawImage(it,0,0),Pe<we.length&&we.length>0){const Zn=et(we[Pe][0],we[Pe][1],ct);Y.beginPath(),Y.arc(Zn.x,Zn.y,5,0,Math.PI*2),Y.fillStyle="#0b80ee",Y.fill(),Y.strokeStyle=Nt.markerBorder,Y.lineWidth=1,Y.stroke()}}},[qt,ue,et]);g.useEffect(()=>{if(!pe||U.length===0||!X.current)return;const Y=X.current.getContext("2d");if(!Y)return;let we=performance.now();const Pe=100*Ce,ke=ze=>{const ct=(ze-we)/1e3;we=ze;const Nt=Math.floor(ct*Pe);xe.current=Math.min(xe.current+Math.max(1,Nt),U.length-1),Te(Y,U,xe.current),H(xe.current/(U.length-1)*100),xe.current<U.length-1?oe.current=requestAnimationFrame(ke):Se(!1)};return oe.current=requestAnimationFrame(ke),()=>{oe.current&&cancelAnimationFrame(oe.current)}},[pe,U,Ce,Te]),g.useEffect(()=>{if(U.length>0&&X.current){const Y=X.current.getContext("2d");Y&&(xe.current=0,H(0),Te(Y,U,0,!0))}},[U,Te]);const De=async Y=>{j(Y),_(!0),A("adaptive"),Ne(null);try{const we=await fe.get(`/api/pattern_history/${encodeURIComponent(Y.path)}`);Ne(we)}catch{}},Xe=async()=>{S&&(_(!1),P(!0),Se(!1),H(0),xe.current=0,await Wt(S.path),Se(!0))},Oe=()=>{P(!1),Se(!1),oe.current&&cancelAnimationFrame(oe.current),J([])},Qe=()=>{pe?Se(!1):(xe.current>=U.length-1&&(xe.current=0,H(0)),Se(!0))},dt=()=>{if(Se(!1),xe.current=0,H(0),X.current&&U.length>0){const Y=X.current.getContext("2d");Y&&Te(Y,U,0,!0)}},ht=Y=>{const we=Y[0];if(H(we),xe.current=Math.floor(we/100*(U.length-1)),X.current&&U.length>0){const Pe=X.current.getContext("2d");Pe&&Te(Pe,U,xe.current)}},z=async()=>{if(S){L(!0);try{await fe.post("/run_theta_rho",{file_name:S.path,pre_execution:T}),K.success(`Running ${S.name}`),_(!1),window.dispatchEvent(new CustomEvent("playback-started"))}catch(Y){const we=Y instanceof Error?Y.message:"Failed to run pattern";we.includes("409")||we.includes("already running")?K.error("Another pattern is already running"):K.error(we)}finally{L(!1)}}},O=async()=>{if(S){if(!S.path.startsWith("custom_patterns/")){K.error("Only custom patterns can be deleted");return}if(confirm(`Delete "${S.name}"? This cannot be undone.`))try{await fe.post("/delete_theta_rho_file",{file_name:S.path}),K.success(`Deleted ${S.name}`),_(!1),j(null),Kt()}catch{K.error("Failed to delete pattern")}}},de=async Y=>{if(S)try{await fe.post("/add_to_queue",{pattern:S.path,position:Y}),K.success(Y==="next"?"Playing next":"Added to queue")}catch(we){const Pe=we instanceof Error?we.message:"Failed to add to queue";Pe.includes("400")||Pe.includes("No playlist")?K.error("No playlist is currently running"):K.error(Pe)}},me=Y=>a[Y]?.image_data||null,Ge=Y=>Y?`(${Y.x.toFixed(1)}, ${Y.y.toFixed(1)})`:"(-, -)",Ie=S?.path.startsWith("custom_patterns/"),tt=async()=>{if(_e)return;je(!0),ce(0);const Y=await uP(we=>{const Pe=we.total>0?Math.round(we.completed/we.total*100):0;ce(Pe)});Y.success?(Le(!0),Y.cached===0?K.success("All patterns are already cached!"):K.success("All pattern previews have been cached!")):K.error("Failed to cache previews"),je(!1),ce(0)},It=async Y=>{const we=Y.target.files;if(!we||we.length===0)return;const Pe=Array.from(we).filter(ze=>!ze.name.endsWith(".thr"));if(Pe.length>0){K.error(`Invalid file${Pe.length>1?"s":""}: ${Pe.map(ze=>ze.name).join(", ")}. Only .thr files are accepted.`);return}St(!0);let ke=0;for(const ze of Array.from(we))try{await fe.uploadFile("/upload_theta_rho",ze),ke++}catch(ct){console.error(`Upload error for ${ze.name}:`,ct),K.error(`Failed to upload "${ze.name}"`)}ke>0&&(K.success(ke===1?`Pattern "${we[0].name}" uploaded successfully`:`${ke} pattern${ke>1?"s":""} uploaded successfully`),await Kt()),St(!1),$e.current&&($e.current.value="")};return l?o.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:o.jsx("span",{className:"material-icons-outlined animate-spin text-4xl text-muted-foreground",children:"sync"})}):o.jsxs("div",{className:"flex flex-col w-full max-w-5xl mx-auto gap-3 sm:gap-6 py-3 sm:py-6 px-0 sm:px-4",children:[!e&&o.jsx("input",{ref:$e,type:"file",accept:".thr",multiple:!0,onChange:It,className:"hidden"}),o.jsxs("div",{className:"flex items-start justify-between gap-4 pl-1",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Browse Patterns"}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.length," patterns available"]})]}),!e&&o.jsxs(se,{variant:"ghost",onClick:()=>$e.current?.click(),disabled:Ot,className:"gap-2 shrink-0 h-9 w-9 sm:h-11 sm:w-auto rounded-full px-0 sm:px-4 justify-center bg-card border border-border shadow-sm hover:bg-accent",children:[Ot?o.jsx("span",{className:"material-icons-outlined animate-spin text-lg",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-lg",children:"add"}),o.jsx("span",{className:"hidden sm:inline",children:"Add Pattern"})]})]}),o.jsx("div",{className:"sticky z-30 py-3 -mx-0 sm:-mx-4 px-0 sm:px-4 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",style:{top:"calc(4.5rem + env(safe-area-inset-top, 0px))"},children:o.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[o.jsxs("div",{className:"relative flex-1 min-w-0",children:[o.jsx("span",{className:"material-icons-outlined absolute left-3 sm:left-4 top-1/2 -translate-y-1/2 text-muted-foreground text-lg sm:text-xl",children:"search"}),o.jsx(bt,{value:d,onChange:Y=>h(Y.target.value),placeholder:"Search...",className:"pl-9 sm:pl-11 pr-10 h-9 sm:h-11 rounded-full bg-card border-border shadow-sm text-xs sm:text-sm focus:ring-2 focus:ring-ring"}),d&&o.jsx(se,{variant:"ghost",size:"icon",onClick:()=>h(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground h-7 w-7 rounded-full",children:o.jsx("span",{className:"material-icons-outlined text-lg",children:"close"})})]}),o.jsxs(Pn,{value:p,onValueChange:v,children:[o.jsxs(An,{className:"h-9 w-9 sm:h-11 sm:w-auto rounded-full bg-card border-border shadow-sm text-xs sm:text-sm shrink-0 [&>svg]:hidden sm:[&>svg]:block px-0 sm:px-3 justify-center sm:justify-between [&>span:last-of-type]:hidden sm:[&>span:last-of-type]:inline gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-lg shrink-0 sm:hidden",children:"folder"}),o.jsx(Hn,{placeholder:"All"})]}),o.jsx(On,{children:ne.map(Y=>o.jsx(nt,{value:Y,children:Y==="all"?"All":Y==="root"?"Default":Y},Y))})]}),o.jsxs(Pn,{value:m,onValueChange:Y=>{const we=Y;b(we),C(we!=="plays"&&we!=="last_played")},children:[o.jsxs(An,{className:"h-9 w-9 sm:h-11 sm:w-auto rounded-full bg-card border-border shadow-sm text-xs sm:text-sm shrink-0 [&>svg]:hidden sm:[&>svg]:block px-0 sm:px-3 justify-center sm:justify-between [&>span:last-of-type]:hidden sm:[&>span:last-of-type]:inline gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-lg shrink-0 sm:hidden",children:"sort"}),o.jsx(Hn,{placeholder:"Sort"})]}),o.jsxs(On,{children:[o.jsx(nt,{value:"favorites",children:"Favorites"}),o.jsx(nt,{value:"name",children:"Name"}),o.jsx(nt,{value:"date",children:"Modified"}),o.jsx(nt,{value:"size",children:"Size"}),o.jsx(nt,{value:"plays",children:"Most Played"}),o.jsx(nt,{value:"last_played",children:"Last Played"})]})]}),o.jsx(se,{variant:"outline",size:"icon",onClick:()=>C(!w),className:"shrink-0 h-9 w-9 sm:h-11 sm:w-11 rounded-full bg-card shadow-sm",title:w?"Ascending":"Descending",children:o.jsx("span",{className:"material-icons-outlined text-lg sm:text-xl",children:w?"arrow_upward":"arrow_downward"})}),!He&&o.jsx(se,{variant:"outline",onClick:tt,className:`shrink-0 rounded-full bg-card shadow-sm gap-2 ${_e?"h-9 sm:h-11 w-auto px-3 sm:px-4":"h-9 w-9 sm:h-11 sm:w-auto px-0 sm:px-4 justify-center sm:justify-start"}`,title:"Cache All Previews",children:_e?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"material-icons-outlined animate-spin text-lg",children:"sync"}),o.jsxs("span",{className:"text-sm",children:[Me,"%"]})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"material-icons-outlined text-lg",children:"cached"}),o.jsx("span",{className:"hidden sm:inline text-sm",children:"Cache"})]})})]})}),(d||p!=="all")&&o.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",Re.length," of ",t.length," patterns"]}),Re.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[40vh] gap-4 text-center",children:[o.jsx("div",{className:"p-4 rounded-full bg-muted",children:o.jsx("span",{className:"material-icons-outlined text-5xl text-muted-foreground",children:"search_off"})}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("h2",{className:"text-xl font-semibold",children:"No patterns found"}),o.jsx("p",{className:"text-muted-foreground",children:"Try adjusting your search or filters"})]}),(d||p!=="all")&&o.jsx(se,{variant:"secondary",onClick:()=>{h(""),v("all")},children:"Clear Filters"})]}):o.jsx(s5.Provider,{value:{requestPreview:st,previews:a},children:o.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 gap-2 sm:gap-4",children:Re.map(Y=>o.jsx(JW,{pattern:Y,isSelected:S?.path===Y.path,isFavorite:Ue.has(Y.path),playTime:B[Y.path.split("/").pop()||""]?.actual_time_formatted||null,playCount:B[Y.path.split("/").pop()||""]?.play_count??0,onToggleFavorite:vt,onClick:()=>De(Y)},Y.path))})}),o.jsx("div",{className:"h-48"}),o.jsx(YW,{open:N,onOpenChange:_,children:o.jsxs(n5,{className:"flex flex-col p-0 overflow-hidden pt-safe",onTouchStart:jt,onTouchEnd:ot,children:[o.jsx(r5,{className:"px-6 py-4 shrink-0",children:o.jsxs(a5,{className:"flex items-center gap-2 pr-8",children:[S&&o.jsx("span",{role:"button",tabIndex:0,className:`shrink-0 transition-colors cursor-pointer flex items-center ${Ue.has(S.path)?"text-red-500 hover:text-red-600":"text-muted-foreground hover:text-red-500"}`,onClick:Y=>vt(S.path,Y),onKeyDown:Y=>{(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),vt(S.path,Y))},title:Ue.has(S.path)?"Remove from favorites":"Add to favorites",children:o.jsx("span",{className:"material-icons",style:{fontSize:"20px"},children:Ue.has(S.path)?"favorite":"favorite_border"})}),o.jsx("span",{className:"truncate",children:S?.name||"Pattern Details"})]})}),S&&o.jsxs("div",{className:"p-6 overflow-y-auto flex-1",children:[o.jsxs("div",{className:"mb-6",children:[o.jsxs("div",{className:"aspect-square w-full max-w-[280px] mx-auto overflow-hidden rounded-full border bg-muted relative group cursor-pointer",onClick:Xe,children:[me(S.path)?o.jsx("img",{src:me(S.path),alt:S.name,className:"w-full h-full object-cover pattern-preview"}):o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:o.jsx("span",{className:"material-icons-outlined text-4xl text-muted-foreground",children:"image"})}),o.jsx("div",{className:"absolute bottom-2 right-2 bg-background/90 backdrop-blur-sm rounded-full w-10 h-10 flex items-center justify-center shadow-md border group-hover:scale-110 transition-transform",children:o.jsx("span",{className:"material-icons text-xl",children:"play_arrow"})}),o.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-200 bg-black/20 rounded-full"})]}),o.jsx("p",{className:"text-xs text-muted-foreground text-center mt-2",children:"Tap to preview animation"})]}),o.jsxs("div",{className:"mb-4 flex justify-between text-sm",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-base",children:"flag"}),o.jsx("span",{className:"text-muted-foreground",children:"First:"}),o.jsx("span",{className:"font-semibold",children:Ge(a[S.path]?.first_coordinate)})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-base",children:"check"}),o.jsx("span",{className:"text-muted-foreground",children:"Last:"}),o.jsx("span",{className:"font-semibold",children:Ge(a[S.path]?.last_coordinate)})]})]}),(()=>{const Y=S.path.split("/").pop()||"",we=B[Y]?.play_count??0;return o.jsx(o.Fragment,{children:(be?.actual_time_formatted||we>0)&&o.jsxs("div",{className:"mb-4 flex justify-between text-sm",children:[be?.actual_time_formatted&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-base",children:"schedule"}),o.jsx("span",{className:"text-muted-foreground",children:"Last run:"}),o.jsx("span",{className:"font-semibold",children:be.actual_time_formatted})]}),we>0&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-base",children:"play_circle"}),o.jsx("span",{className:"text-muted-foreground",children:"Plays:"}),o.jsx("span",{className:"font-semibold",children:we})]})]})})})(),o.jsxs("div",{className:"mb-6",children:[o.jsx(Ke,{className:"text-sm font-semibold mb-3 block",children:"Clear"}),o.jsx("div",{className:"grid grid-cols-2 gap-2",children:P0.map(Y=>o.jsxs("label",{className:`relative flex cursor-pointer items-center justify-center rounded-lg border p-2.5 text-center text-sm font-medium transition-all hover:border-primary ${T===Y.value?"border-primary bg-primary text-primary-foreground ring-2 ring-primary ring-offset-2 ring-offset-background":"border-border text-muted-foreground hover:text-foreground"}`,children:[Y.label,o.jsx("input",{type:"radio",name:"preExecutionAction",value:Y.value,checked:T===Y.value,onChange:()=>A(Y.value),className:"sr-only"})]},Y.value))}),o.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:P0.find(Y=>Y.value===T)?.description})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(se,{onClick:z,disabled:D,className:"flex-1 gap-2",size:"lg",children:[D?o.jsx("span",{className:"material-icons-outlined animate-spin text-lg",children:"sync"}):o.jsx("span",{className:"material-icons text-lg",children:"play_arrow"}),"Play"]}),Ie&&o.jsx(se,{variant:"outline",onClick:O,className:"text-destructive hover:bg-destructive/10 hover:border-destructive px-3",size:"lg",children:o.jsx("span",{className:"material-icons text-lg",children:"delete"})})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(se,{variant:"outline",size:"sm",className:"flex-1 gap-1.5",onClick:()=>de("next"),children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"playlist_play"}),"Play Next"]}),o.jsxs(se,{variant:"outline",size:"sm",className:"flex-1 gap-1.5",onClick:()=>de("end"),children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"playlist_add"}),"Add to Queue"]})]})]})]})]})}),k&&o.jsx("div",{className:"fixed inset-0 bg-black/80 z-[60] flex items-center justify-center p-4",onClick:Oe,children:o.jsxs("div",{className:"bg-background rounded-lg shadow-xl max-w-4xl w-full max-h-[95vh] flex flex-col overflow-hidden",onClick:Y=>Y.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between p-6 border-b shrink-0",children:[o.jsx("h3",{className:"text-xl font-semibold",children:S?.name||"Animated Preview"}),o.jsx(se,{variant:"ghost",size:"icon",onClick:Oe,className:"rounded-full",children:o.jsx("span",{className:"material-icons text-2xl",children:"close"})})]}),o.jsx("div",{className:"p-6 overflow-y-auto flex-1 flex justify-center items-center",children:$?o.jsx("div",{className:"w-full max-w-[400px] aspect-square flex items-center justify-center rounded-full bg-muted",children:o.jsx("span",{className:"material-icons-outlined animate-spin text-4xl text-muted-foreground",children:"sync"})}):o.jsxs("div",{className:"relative w-full max-w-[400px] aspect-square",children:[o.jsx("canvas",{ref:X,width:400,height:400,className:"rounded-full w-full h-full"}),o.jsx("div",{className:"absolute inset-0 flex items-center justify-center cursor-pointer rounded-full opacity-0 hover:opacity-100 transition-opacity bg-black/10",onClick:Qe,children:o.jsx("div",{className:"bg-background rounded-full w-16 h-16 flex items-center justify-center shadow-lg",children:o.jsx("span",{className:"material-icons text-3xl",children:pe?"pause":"play_arrow"})})})]})}),o.jsxs("div",{className:"p-6 space-y-4 shrink-0 border-t",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex justify-between mb-2",children:[o.jsx(Ke,{className:"text-sm font-medium",children:"Speed"}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[Ce,"x"]})]}),o.jsx(_l,{value:[Ce],onValueChange:Y=>I(Y[0]),min:.1,max:5,step:.1,className:"py-2"})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex justify-between mb-2",children:[o.jsx(Ke,{className:"text-sm font-medium",children:"Progress"}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[q.toFixed(0),"%"]})]}),o.jsx(_l,{value:[q],onValueChange:ht,min:0,max:100,step:.1,className:"py-2"})]}),o.jsxs("div",{className:"flex items-center justify-center gap-4",children:[o.jsxs(se,{onClick:Qe,className:"gap-2",children:[o.jsx("span",{className:"material-icons",children:pe?"pause":"play_arrow"}),pe?"Pause":"Play"]}),o.jsxs(se,{variant:"secondary",onClick:dt,className:"gap-2",children:[o.jsx("span",{className:"material-icons",children:"replay"}),"Reset"]})]})]})]})})]})}function JW({pattern:e,isSelected:t,isFavorite:n,playTime:a,playCount:i,onToggleFavorite:l,onClick:u}){const[d,h]=g.useState(!1),[p,v]=g.useState(!1),m=g.useRef(null),b=g.useContext(s5);g.useEffect(()=>{if(!b||!m.current)return;const C=new IntersectionObserver(S=>{S.forEach(j=>{j.isIntersecting&&(b.requestPreview(e.path),C.disconnect())})},{rootMargin:"100px"});return C.observe(m.current),()=>C.disconnect()},[e.path,b]);const w=b?.previews[e.path]?.image_data||null;return o.jsxs("button",{ref:m,onClick:u,className:`group flex flex-col items-center gap-2 p-2.5 rounded-xl bg-card border border-border transition-all duration-200 ease-out hover:-translate-y-1 hover:shadow-md active:scale-95 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 ${t?"ring-2 ring-primary ring-offset-2 ring-offset-background":""}`,children:[o.jsx("div",{className:"relative w-full aspect-square",children:o.jsx("div",{className:"w-full h-full rounded-full overflow-hidden border border-border bg-muted",children:w&&!p?o.jsxs(o.Fragment,{children:[!d&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsx("span",{className:"material-icons-outlined animate-spin text-xl text-muted-foreground",children:"sync"})}),o.jsx("img",{src:w,alt:e.name,className:`w-full h-full object-cover pattern-preview transition-opacity ${d?"opacity-100":"opacity-0"}`,loading:"lazy",onLoad:()=>h(!0),onError:()=>v(!0)})]}):o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:o.jsx("span",{className:"material-icons-outlined text-2xl text-muted-foreground",children:p?"broken_image":"image"})})})}),(i>0||a)&&o.jsxs("div",{className:"flex items-center w-full px-0.5 -mb-1 justify-between",children:[i>0&&o.jsxs("span",{className:"flex items-center gap-0.5 text-xs text-muted-foreground",title:`Played ${i} time${i!==1?"s":""}`,children:[o.jsx("span",{className:"material-icons-outlined",style:{fontSize:"13px"},children:"play_circle"}),i,"x"]}),a&&o.jsxs("span",{className:"flex items-center gap-0.5 text-xs text-muted-foreground ml-auto",title:`Last run: ${a}`,children:[o.jsx("span",{className:"material-icons-outlined",style:{fontSize:"13px"},children:"schedule"}),(()=>{const C=a.match(/^(?:(\d+):)?(\d+):(\d+)$/);if(C){const j=C[1]?parseInt(C[1]):0,N=parseInt(C[2]),_=parseInt(C[3]),T=j*60+N+(_>=30?1:0);return T>0?`${T}m`:"<1m"}const S=a.match(/(\d+)h\s*(\d+)m|(\d+)\s*min|(\d+)m\s*(\d+)s|(\d+)\s*sec/);if(S){if(S[1]&&S[2])return`${parseInt(S[1])*60+parseInt(S[2])}m`;if(S[3])return`${S[3]}m`;if(S[4]&&S[5]){const j=parseInt(S[4]);return j>0?`${j}m`:"<1m"}else if(S[6])return"<1m"}return a})()]})]}),o.jsxs("div",{className:"flex items-center justify-between w-full gap-1 px-0.5",children:[o.jsx("span",{className:"text-xs font-bold text-foreground truncate",title:e.name,children:e.name}),o.jsx("span",{role:"button",tabIndex:0,className:`shrink-0 transition-colors cursor-pointer ${n?"text-red-500 hover:text-red-600":"text-muted-foreground hover:text-red-500"}`,onClick:C=>{C.stopPropagation(),l(e.path,C)},onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),C.stopPropagation(),l(e.path,C))},title:n?"Remove from favorites":"Add to favorites",children:o.jsx("span",{className:"material-icons",style:{fontSize:"16px"},children:n?"favorite":"favorite_border"})})]})]})}function eX(){const{isPlayOnlyActive:e}=HO()||{},[t,n]=g.useState([]),[a,i]=g.useState(()=>localStorage.getItem("playlist-selected")),[l,u]=g.useState([]),[d,h]=g.useState(!0),[p,v]=g.useState([]),[m,b]=g.useState({}),[w,C]=g.useState({}),[S,j]=g.useState(!1),[N,_]=g.useState(new Set),[T,A]=g.useState(""),[D,L]=g.useState("all"),[k,P]=g.useState("name"),[U,J]=g.useState(!0),[$,W]=g.useState(new Set),[pe,Se]=g.useState(!1),[Ce,I]=g.useState(!1),[q,H]=g.useState(""),[be,Ne]=g.useState(null),[B,G]=g.useState(!1),X=g.useRef(null),oe=z=>{X.current={x:z.touches[0].clientX,y:z.touches[0].clientY}},xe=z=>{if(!X.current||!B)return;const O=z.changedTouches[0].clientX-X.current.x,de=z.changedTouches[0].clientY-X.current.y;O>80&&O>Math.abs(de)&&G(!1),X.current=null},[Q,te]=g.useState(()=>{const z=localStorage.getItem("playlist-runMode");return z==="single"||z==="indefinite"?z:"single"}),[he,_e]=g.useState(()=>localStorage.getItem("playlist-shuffle")==="true"),[je,Me]=g.useState(()=>{const z=localStorage.getItem("playlist-pauseTime");return z?Number(z):5}),[ce,He]=g.useState(()=>{const z=localStorage.getItem("playlist-pauseUnit");return z==="sec"||z==="min"||z==="hr"?z:"min"}),[Le,Ue]=g.useState(()=>localStorage.getItem("preExecution")||"adaptive");g.useEffect(()=>{localStorage.setItem("playlist-runMode",Q)},[Q]),g.useEffect(()=>{localStorage.setItem("playlist-shuffle",String(he))},[he]),g.useEffect(()=>{localStorage.setItem("playlist-pauseTime",String(je))},[je]),g.useEffect(()=>{localStorage.setItem("playlist-pauseUnit",ce)},[ce]),g.useEffect(()=>{localStorage.setItem("preExecution",Le)},[Le]),g.useEffect(()=>{a?localStorage.setItem("playlist-selected",a):localStorage.removeItem("playlist-selected")},[a]);const wt=g.useRef(!1);g.useEffect(()=>{d||a&&(t.includes(a)?wt.current||(wt.current=!0,vt(a)):i(null))},[d,t,a]),g.useEffect(()=>{const z=()=>{j(!1),Se(!1),I(!1)};return window.addEventListener("playback-started",z),()=>window.removeEventListener("playback-started",z)},[]);const[$e,Ot]=g.useState(!1),St=()=>{switch(ce){case"hr":return je*3600;case"min":return je*60;default:return je}},Et=g.useRef(new Set),jt=g.useRef(null),ot=g.useRef(null);g.useEffect(()=>(dp().catch(()=>{}),at(),Kt(),Yt(),()=>{jt.current&&clearTimeout(jt.current),ot.current&&ot.current.abort(),Et.current.clear()}),[]),cS(()=>{at(),Kt(),Yt()});const at=async()=>{h(!0);try{const z=await fe.get("/list_all_playlists");n(Array.isArray(z)?z:[])}catch(z){console.error("Error fetching playlists:",z),K.error("Failed to load playlists")}finally{h(!1)}},vt=async z=>{try{const O=await fe.get(`/get_playlist?name=${encodeURIComponent(z)}`);u(O.files||[])}catch(O){console.error("Error fetching playlist:",O),K.error("Failed to load playlist"),u([])}},Kt=async()=>{try{const[z,O]=await Promise.all([fe.get("/list_theta_rho_files_with_metadata"),fe.get("/api/pattern_history_all")]);v(z),b(O)}catch(z){console.error("Error fetching patterns:",z)}},Yt=async()=>{try{const z=await fe.get("/get_playlist?name=Favorites");W(new Set(z.files||[]))}catch{}},Wt=async z=>{const O=await bu(z);if(O.size>0){const me={};O.forEach((Ge,Ie)=>{me[Ie]=Ge}),C(Ge=>({...Ge,...me}))}const de=z.filter(me=>!O.has(me));de.length>0&&ne(de)},ne=async z=>{ot.current=new AbortController;const de=ot.current.signal;for(let me=0;me<z.length&&!de.aborted;me+=10){const Ge=z.slice(me,me+10);try{const Ie=await fe.post("/preview_thr_batch",{file_names:Ge},de),tt={};for(const[It,Y]of Object.entries(Ie))tt[It]=Y,Y&&!Y.error&&Ow(It,Y);C(It=>({...It,...tt}))}catch(Ie){if(Ie instanceof Error&&Ie.name==="AbortError")break;console.error("Error fetching previews batch:",Ie)}me+10<z.length&&await new Promise(Ie=>setTimeout(Ie,100))}},Re=g.useCallback(z=>{w[z]||Et.current.has(z)||(Et.current.add(z),jt.current&&clearTimeout(jt.current),jt.current=setTimeout(()=>{const O=Array.from(Et.current);Et.current.clear(),O.length>0&&Wt(O)},100))},[w]),st=z=>{i(z),vt(z),G(!0)},et=()=>{G(!1)},xt=async()=>{if(!q.trim()){K.error("Please enter a playlist name");return}const z=q.trim();try{await fe.post("/create_playlist",{playlist_name:z,files:[]}),K.success("Playlist created"),Se(!1),H(""),await at(),st(z)}catch(O){console.error("Create playlist error:",O),K.error(O instanceof Error?O.message:"Failed to create playlist")}},mt=async()=>{if(!(!be||!q.trim()))try{await fe.post("/rename_playlist",{old_name:be,new_name:q.trim()}),K.success("Playlist renamed"),I(!1),H(""),Ne(null),at(),a===be&&i(q.trim())}catch{K.error("Failed to rename playlist")}},gt=async z=>{if(confirm(`Delete playlist "${z}"?`))try{await fe.delete("/delete_playlist",{playlist_name:z}),K.success("Playlist deleted"),at(),a===z&&(i(null),u([]))}catch{K.error("Failed to delete playlist")}},qt=async z=>{if(!a)return;const O=l.filter(de=>de!==z);try{await fe.post("/modify_playlist",{playlist_name:a,files:O}),u(O),K.success("Pattern removed")}catch{K.error("Failed to remove pattern")}},ue=()=>{_(new Set(l)),A(""),j(!0)},Te=async()=>{if(!a)return;const z=Array.from(N);try{await fe.post("/modify_playlist",{playlist_name:a,files:z}),u(z),j(!1),K.success("Playlist updated")}catch{K.error("Failed to update playlist")}},De=z=>{_(O=>{const de=new Set(O);return de.has(z)?de.delete(z):de.add(z),de})},Xe=async()=>{if(!(!a||l.length===0)){Ot(!0);try{await fe.post("/run_playlist",{playlist_name:a,run_mode:Q==="indefinite"?"indefinite":"single",pause_time:St(),clear_pattern:Le,shuffle:he}),K.success(`Started playlist: ${a}`),window.dispatchEvent(new CustomEvent("playback-started"))}catch(z){K.error(z instanceof Error?z.message:"Failed to run playlist")}finally{Ot(!1)}}},Oe=g.useMemo(()=>{const z=new Set(p.map(O=>O.category));return["all",...Array.from(z).sort()]},[p]),Qe=g.useMemo(()=>{let z=p;return T&&(z=z.filter(O=>Au(O.name,T))),D!=="all"&&(z=z.filter(O=>O.category===D)),z=[...z].sort((O,de)=>{let me=0;switch(k){case"name":me=O.name.localeCompare(de.name);break;case"date":me=O.date_modified-de.date_modified;break;case"size":me=O.coordinates_count-de.coordinates_count;break;case"favorites":{const Ge=$.has(O.path)?1:0;me=($.has(de.path)?1:0)-Ge,me===0&&(me=O.name.localeCompare(de.name));break}case"plays":{const Ge=O.path.split("/").pop()||"",Ie=de.path.split("/").pop()||"",tt=m[Ge]?.play_count??0,It=m[Ie]?.play_count??0;me=tt-It,me===0&&(me=O.name.localeCompare(de.name));break}case"last_played":{const Ge=O.path.split("/").pop()||"",Ie=de.path.split("/").pop()||"",tt=m[Ge]?.last_played||"",It=m[Ie]?.last_played||"";me=tt.localeCompare(It),me===0&&(me=O.name.localeCompare(de.name));break}}return U?me:-me}),z},[p,T,D,k,U,$,m]),dt=z=>p.find(de=>de.path===z)?.name||z.split("/").pop()?.replace(".thr","")||z,ht=z=>w[z]?.image_data||null;return o.jsxs("div",{className:"flex flex-col w-full max-w-5xl mx-auto gap-4 sm:gap-6 py-3 sm:py-6 px-0 sm:px-4 overflow-hidden",style:{height:"calc(100dvh - 14rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))"},children:[o.jsxs("div",{className:"space-y-0.5 sm:space-y-1 shrink-0 pl-1",children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Playlists"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Create and manage pattern playlists"})]}),o.jsx(Xn,{className:"shrink-0"}),o.jsxs("div",{className:"flex flex-col lg:flex-row gap-4 flex-1 min-h-0 relative overflow-hidden",children:[o.jsxs("aside",{className:`w-full lg:w-64 shrink-0 bg-card border rounded-lg flex flex-col h-full overflow-hidden transition-transform duration-300 ease-in-out ${B?"-translate-x-full lg:translate-x-0 absolute lg:relative inset-0 lg:inset-auto":"translate-x-0"}`,children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-2.5 border-b shrink-0",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold",children:"My Playlists"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.length," playlist",t.length!==1?"s":""]})]}),!e&&o.jsx(se,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{H(""),Se(!0)},children:o.jsx("span",{className:"material-icons-outlined text-xl",children:"add"})})]}),o.jsx("nav",{className:"flex-1 overflow-y-auto p-2 space-y-1 min-h-0",children:d?o.jsx("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:o.jsx("span",{className:"text-sm",children:"Loading..."})}):t.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-3xl",children:"playlist_add"}),o.jsx("span",{className:"text-sm",children:"No playlists yet"})]}):t.map(z=>o.jsxs("div",{className:`group flex items-center justify-between rounded-lg px-3 py-2 cursor-pointer transition-colors ${a===z?"bg-accent text-accent-foreground":"hover:bg-muted text-muted-foreground"}`,onClick:()=>st(z),children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx("span",{className:"material-icons-outlined text-lg",children:"playlist_play"}),o.jsx("span",{className:"truncate text-sm font-medium",children:z})]}),!e&&o.jsxs("div",{className:"flex items-center gap-1 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[o.jsx(se,{variant:"ghost",size:"icon-sm",className:"h-7 w-7",onClick:O=>{O.stopPropagation(),Ne(z),H(z),I(!0)},children:o.jsx("span",{className:"material-icons-outlined text-base",children:"edit"})}),o.jsx(se,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 text-destructive hover:text-destructive hover:bg-destructive/20",onClick:O=>{O.stopPropagation(),gt(z)},children:o.jsx(tD,{className:"h-4 w-4"})})]})]},z))})]}),o.jsxs("main",{className:`flex-1 bg-card border rounded-lg flex flex-col overflow-hidden min-h-0 relative transition-transform duration-300 ease-in-out ${B?"translate-x-0":"translate-x-full lg:translate-x-0 absolute lg:relative inset-0 lg:inset-auto"}`,onTouchStart:oe,onTouchEnd:xe,children:[o.jsxs("header",{className:"flex items-center justify-between px-3 py-2.5 border-b shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx(se,{variant:"ghost",size:"icon",className:"h-8 w-8 lg:hidden shrink-0",onClick:et,children:o.jsx("span",{className:"material-icons-outlined",children:"arrow_back"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"text-lg font-semibold truncate",children:a||"Select a Playlist"}),a&&l.length>0&&o.jsxs("p",{className:"text-sm text-muted-foreground",children:[l.length," pattern",l.length!==1?"s":""]})]})]}),!e&&o.jsxs(se,{onClick:ue,disabled:!a,size:"sm",className:"gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"add"}),o.jsx("span",{className:"hidden sm:inline",children:"Add Patterns"})]})]}),o.jsx("div",{className:`flex-1 overflow-y-auto p-4 min-h-0 ${a?"pb-28 sm:pb-24":""}`,children:a?l.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground gap-3",children:[o.jsx("div",{className:"p-4 rounded-full bg-muted",children:o.jsx("span",{className:"material-icons-outlined text-5xl",children:"library_music"})}),o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"font-medium",children:"Empty playlist"}),o.jsx("p",{className:"text-sm",children:"Add patterns to get started"})]}),!e&&o.jsxs(se,{variant:"secondary",className:"mt-2 gap-2",onClick:ue,children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"add"}),"Add Patterns"]})]}):o.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 gap-3 sm:gap-4",children:l.map((z,O)=>o.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2 group",children:[o.jsxs("div",{className:"relative w-full aspect-square",children:[o.jsx("div",{className:"w-full h-full rounded-full overflow-hidden border bg-muted hover:ring-2 hover:ring-primary hover:ring-offset-2 hover:ring-offset-background transition-all cursor-pointer",children:o.jsx(RT,{path:z,previewUrl:ht(z),requestPreview:Re,alt:dt(z)})}),!e&&o.jsx("button",{className:"absolute -top-0.5 -right-0.5 sm:-top-1 sm:-right-1 w-5 h-5 rounded-full bg-destructive hover:bg-destructive/90 text-destructive-foreground flex items-center justify-center opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity shadow-sm z-10",onClick:()=>qt(z),title:"Remove from playlist",children:o.jsx("span",{className:"material-icons",style:{fontSize:"12px"},children:"close"})})]}),o.jsx("p",{className:"text-[10px] sm:text-xs truncate font-medium w-full text-center",children:dt(z)})]},`${z}-${O}`))}):o.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground gap-3",children:[o.jsx("div",{className:"p-4 rounded-full bg-muted",children:o.jsx("span",{className:"material-icons-outlined text-5xl",children:"touch_app"})}),o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"font-medium",children:"No playlist selected"}),o.jsx("p",{className:"text-sm",children:"Select a playlist from the sidebar to view its patterns"})]})]})}),a&&o.jsxs("div",{className:"absolute bottom-0 left-0 right-0 pointer-events-none z-20",children:[o.jsx("div",{className:"h-20 bg-gradient-to-t"}),o.jsxs("div",{className:"absolute bottom-4 left-0 right-0 flex items-center justify-center gap-3 px-4 pointer-events-auto",children:[o.jsxs("div",{className:"flex items-center h-12 sm:h-14 bg-card rounded-full shadow-xl border px-1.5 sm:px-2",children:[o.jsxs("div",{className:"flex items-center px-1 sm:px-2 border-r border-border gap-0.5 sm:gap-1",children:[o.jsx("button",{onClick:()=>_e(!he),className:`w-9 h-9 sm:w-10 sm:h-10 rounded-full flex items-center justify-center transition ${he?"text-primary bg-primary/10":"text-muted-foreground hover:bg-muted"}`,title:"Shuffle",children:o.jsx("span",{className:"material-icons-outlined text-lg sm:text-xl",children:"shuffle"})}),o.jsx("button",{onClick:()=>te(Q==="indefinite"?"single":"indefinite"),className:`w-9 h-9 sm:w-10 sm:h-10 rounded-full flex items-center justify-center transition ${Q==="indefinite"?"text-primary bg-primary/10":"text-muted-foreground hover:bg-muted"}`,title:Q==="indefinite"?"Loop mode":"Play once mode",children:o.jsx("span",{className:"material-icons-outlined text-lg sm:text-xl",children:"repeat"})})]}),o.jsxs("div",{className:"flex items-center px-2 sm:px-3 gap-2 sm:gap-3 border-r border-border",children:[o.jsx("span",{className:"text-[10px] sm:text-xs font-semibold text-muted-foreground tracking-wider hidden sm:block",children:"Pause"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(se,{variant:"secondary",size:"icon",className:"w-7 h-7 sm:w-8 sm:h-8",onClick:()=>{Me(Math.max(0,je-(ce==="hr"?.5:1)))},children:o.jsx("span",{className:"material-icons-outlined text-sm",children:"remove"})}),o.jsxs("button",{onClick:()=>{const z=["sec","min","hr"],O=z.indexOf(ce);He(z[(O+1)%z.length])},className:"relative flex items-center justify-center min-w-14 sm:min-w-16 px-1 text-xs sm:text-sm font-bold hover:text-primary transition",title:"Click to change unit",children:[je,ce==="sec"?"s":ce==="min"?"m":"h",o.jsx("span",{className:"material-icons-outlined text-xs opacity-50 scale-75 ml-0.5",children:"swap_vert"})]}),o.jsx(se,{variant:"secondary",size:"icon",className:"w-7 h-7 sm:w-8 sm:h-8",onClick:()=>{Me(je+(ce==="hr"?.5:1))},children:o.jsx("span",{className:"material-icons-outlined text-sm",children:"add"})})]})]}),o.jsx("div",{className:"flex items-center px-1 sm:px-2",children:o.jsxs(Pn,{value:Le,onValueChange:z=>Ue(z),children:[o.jsx(An,{className:`w-9 h-9 sm:w-10 sm:h-10 rounded-full border-0 p-0 shadow-none focus:ring-0 justify-center [&>svg]:hidden transition ${Le!=="none"?"!bg-primary/10":"!bg-transparent hover:!bg-muted"}`,children:o.jsx("span",{className:`material-icons-outlined text-lg sm:text-xl ${Le!=="none"?"text-primary":"text-muted-foreground"}`,children:"cleaning_services"})}),o.jsx(On,{children:P0.map(z=>o.jsx(nt,{value:z.value,children:o.jsxs("div",{children:[o.jsx("div",{children:z.label}),o.jsx("div",{className:"text-xs text-muted-foreground font-normal",children:z.description})]})},z.value))})]})})]}),o.jsx("button",{onClick:Xe,disabled:$e||l.length===0,className:"w-10 h-10 sm:w-12 sm:h-12 rounded-full bg-primary hover:bg-primary/90 disabled:bg-muted disabled:text-muted-foreground text-primary-foreground shadow-lg shadow-primary/30 hover:shadow-primary/50 hover:scale-105 disabled:shadow-none disabled:hover:scale-100 transition-all duration-200 flex items-center justify-center",title:"Run Playlist",children:$e?o.jsx("span",{className:"material-icons-outlined text-xl sm:text-2xl animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons text-xl sm:text-2xl ml-0.5",children:"play_arrow"})})]})]})]})]}),o.jsx(ga,{open:pe,onOpenChange:Se,children:o.jsxs(Wr,{className:"sm:max-w-md",children:[o.jsx(Mr,{children:o.jsxs(Dr,{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-primary",children:"playlist_add"}),"Create New Playlist"]})}),o.jsx("div",{className:"space-y-4 py-4",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ke,{htmlFor:"playlistName",children:"Playlist Name"}),o.jsx(bt,{id:"playlistName",value:q,onChange:z=>H(z.target.value),placeholder:"e.g., Favorites, Morning Patterns...",onKeyDown:z=>z.key==="Enter"&&xt(),autoFocus:!0})]})}),o.jsxs(va,{className:"gap-2 sm:gap-0",children:[o.jsx(se,{variant:"secondary",onClick:()=>Se(!1),children:"Cancel"}),o.jsxs(se,{onClick:xt,className:"gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"add"}),"Create Playlist"]})]})]})}),o.jsx(ga,{open:Ce,onOpenChange:I,children:o.jsxs(Wr,{className:"sm:max-w-md",children:[o.jsx(Mr,{children:o.jsxs(Dr,{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-primary",children:"edit"}),"Rename Playlist"]})}),o.jsx("div",{className:"space-y-4 py-4",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ke,{htmlFor:"renamePlaylist",children:"New Name"}),o.jsx(bt,{id:"renamePlaylist",value:q,onChange:z=>H(z.target.value),placeholder:"Enter new name",onKeyDown:z=>z.key==="Enter"&&mt(),autoFocus:!0})]})}),o.jsxs(va,{className:"gap-2 sm:gap-0",children:[o.jsx(se,{variant:"secondary",onClick:()=>I(!1),children:"Cancel"}),o.jsxs(se,{onClick:mt,className:"gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"save"}),"Save Name"]})]})]})}),o.jsx(ga,{open:S,onOpenChange:j,children:o.jsxs(Wr,{className:"max-w-4xl max-h-[90vh] flex flex-col",children:[o.jsx(Mr,{children:o.jsxs(Dr,{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-primary",children:"playlist_add"}),"Add Patterns to ",a]})}),o.jsxs("div",{className:"space-y-3 py-2",children:[o.jsxs("div",{className:"relative",children:[o.jsx("span",{className:"material-icons-outlined absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-lg",children:"search"}),o.jsx(bt,{value:T,onChange:z=>A(z.target.value),placeholder:"Search patterns...",className:"pl-10 pr-10 h-10"}),T&&o.jsx("button",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",onClick:()=>A(""),children:o.jsx("span",{className:"material-icons-outlined text-lg",children:"close"})})]}),o.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[o.jsxs(Pn,{value:D,onValueChange:L,children:[o.jsxs(An,{className:"h-9 w-9 sm:w-auto rounded-full bg-card border-border shadow-sm text-sm px-0 sm:px-3 justify-center sm:justify-between [&>svg]:hidden sm:[&>svg]:block [&>span:last-of-type]:hidden sm:[&>span:last-of-type]:inline gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-lg shrink-0",children:"folder"}),o.jsx(Hn,{})]}),o.jsx(On,{children:Oe.map(z=>o.jsx(nt,{value:z,children:z==="all"?"All Folders":z},z))})]}),o.jsxs(Pn,{value:k,onValueChange:z=>P(z),children:[o.jsxs(An,{className:"h-9 w-9 sm:w-auto rounded-full bg-card border-border shadow-sm text-sm px-0 sm:px-3 justify-center sm:justify-between [&>svg]:hidden sm:[&>svg]:block [&>span:last-of-type]:hidden sm:[&>span:last-of-type]:inline gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-lg shrink-0",children:"sort"}),o.jsx(Hn,{})]}),o.jsxs(On,{children:[o.jsx(nt,{value:"favorites",children:"Favorites"}),o.jsx(nt,{value:"name",children:"Name"}),o.jsx(nt,{value:"date",children:"Modified"}),o.jsx(nt,{value:"size",children:"Size"}),o.jsx(nt,{value:"plays",children:"Most Played"}),o.jsx(nt,{value:"last_played",children:"Last Played"})]})]}),o.jsx(se,{variant:"outline",size:"icon",className:"h-9 w-9 rounded-full bg-card shadow-sm",onClick:()=>J(!U),title:U?"Ascending":"Descending",children:o.jsx("span",{className:"material-icons-outlined text-lg",children:U?"arrow_upward":"arrow_downward"})}),o.jsx("div",{className:"flex-1"}),o.jsxs(se,{variant:"outline",size:"sm",className:"h-9 rounded-full bg-card shadow-sm text-sm gap-1.5",onClick:()=>{const z=Qe.map(de=>de.path),O=z.every(de=>N.has(de));_(de=>{const me=new Set(de);return O?z.forEach(Ge=>me.delete(Ge)):z.forEach(Ge=>me.add(Ge)),me})},children:[o.jsx("span",{className:"material-icons-outlined text-base",children:Qe.length>0&&Qe.every(z=>N.has(z.path))?"deselect":"select_all"}),o.jsx("span",{className:"hidden sm:inline",children:Qe.length>0&&Qe.every(z=>N.has(z.path))?"Deselect All":"Select All"})]}),o.jsxs("div",{className:"flex items-center gap-1 sm:gap-2 text-sm bg-card rounded-full px-2 sm:px-3 py-2 shadow-sm border",children:[o.jsx("span",{className:"material-icons-outlined text-base text-primary",children:"check_circle"}),o.jsx("span",{className:"font-medium",children:N.size}),o.jsx("span",{className:"hidden sm:inline text-muted-foreground",children:"selected"})]})]})]}),o.jsx("div",{className:"flex-1 overflow-y-auto border rounded-lg p-4 min-h-[300px] bg-muted/20",children:Qe.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground gap-3",children:[o.jsx("div",{className:"p-4 rounded-full bg-muted",children:o.jsx("span",{className:"material-icons-outlined text-5xl",children:"search_off"})}),o.jsx("span",{className:"text-sm",children:"No patterns found"})]}):o.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 gap-4",children:Qe.map(z=>{const O=N.has(z.path);return o.jsxs("div",{className:"flex flex-col items-center gap-2 cursor-pointer",onClick:()=>De(z.path),children:[o.jsxs("div",{className:`relative w-full aspect-square rounded-full overflow-hidden border-2 bg-muted transition-all ${O?"border-primary ring-2 ring-primary/20":"border-transparent hover:border-muted-foreground/30"}`,children:[o.jsx(RT,{path:z.path,previewUrl:ht(z.path),requestPreview:Re,alt:z.name}),O&&o.jsx("div",{className:"absolute -top-1 -right-1 w-5 h-5 rounded-full bg-primary flex items-center justify-center shadow-md",children:o.jsx("span",{className:"material-icons text-primary-foreground",style:{fontSize:"14px"},children:"check"})})]}),o.jsx("p",{className:`text-xs truncate font-medium w-full text-center ${O?"text-primary":""}`,children:z.name})]},z.path)})})}),o.jsxs(va,{className:"gap-2 sm:gap-0",children:[o.jsx(se,{variant:"secondary",onClick:()=>j(!1),children:"Cancel"}),o.jsxs(se,{onClick:Te,className:"gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"save"}),"Save Selection"]})]})]})})]})}function RT({path:e,previewUrl:t,requestPreview:n,alt:a,className:i=""}){const l=g.useRef(null),u=g.useRef(!1);return g.useEffect(()=>{if(!l.current||t||u.current)return;const d=new IntersectionObserver(h=>{h.forEach(p=>{p.isIntersecting&&!u.current&&(u.current=!0,n(e),d.disconnect())})},{rootMargin:"100px"});return d.observe(l.current),()=>d.disconnect()},[e,t,n]),o.jsx("div",{ref:l,className:`w-full h-full flex items-center justify-center ${i}`,children:t?o.jsx("img",{src:t,alt:a,loading:"lazy",className:"w-full h-full object-cover pattern-preview"}):o.jsx("span",{className:"material-icons-outlined text-muted-foreground text-sm sm:text-base",children:"image"})})}const Un=g.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:lt("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Un.displayName="Card";const da=g.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:lt("flex flex-col space-y-1.5 p-6",e),...t}));da.displayName="CardHeader";const fa=g.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:lt("text-2xl font-semibold leading-none tracking-tight",e),...t}));fa.displayName="CardTitle";const hi=g.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:lt("text-sm text-muted-foreground",e),...t}));hi.displayName="CardDescription";const qn=g.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:lt("p-6 pt-0",e),...t}));qn.displayName="CardContent";const tX=g.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:lt("flex items-center p-6 pt-0",e),...t}));tX.displayName="CardFooter";const nX=Xu("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-muted/50 text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),mr=g.forwardRef(({className:e,variant:t,...n},a)=>o.jsx("div",{ref:a,role:"alert",className:lt(nX({variant:t}),e),...n}));mr.displayName="Alert";const rX=g.forwardRef(({className:e,...t},n)=>o.jsx("h5",{ref:n,className:lt("mb-1 font-medium leading-none tracking-tight",e),...t}));rX.displayName="AlertTitle";const gr=g.forwardRef(({className:e,...t},n)=>o.jsx("div",{ref:n,className:lt("text-sm [&_p]:leading-relaxed",e),...t}));gr.displayName="AlertDescription";var aX=Symbol("radix.slottable");function sX(e){const t=({children:n})=>o.jsx(o.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=aX,t}var[Sp]=Lr("Tooltip",[ql]),Cp=ql(),i5="TooltipProvider",iX=700,k0="tooltip.open",[oX,fS]=Sp(i5),o5=e=>{const{__scopeTooltip:t,delayDuration:n=iX,skipDelayDuration:a=300,disableHoverableContent:i=!1,children:l}=e,u=g.useRef(!0),d=g.useRef(!1),h=g.useRef(0);return g.useEffect(()=>{const p=h.current;return()=>window.clearTimeout(p)},[]),o.jsx(oX,{scope:t,isOpenDelayedRef:u,delayDuration:n,onOpen:g.useCallback(()=>{window.clearTimeout(h.current),u.current=!1},[]),onClose:g.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>u.current=!0,a)},[a]),isPointerInTransitRef:d,onPointerInTransitChange:g.useCallback(p=>{d.current=p},[]),disableHoverableContent:i,children:l})};o5.displayName=i5;var Vu="Tooltip",[lX,jp]=Sp(Vu),l5=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:i,onOpenChange:l,disableHoverableContent:u,delayDuration:d}=e,h=fS(Vu,e.__scopeTooltip),p=Cp(t),[v,m]=g.useState(null),b=ma(),w=g.useRef(0),C=u??h.disableHoverableContent,S=d??h.delayDuration,j=g.useRef(!1),[N,_]=Zr({prop:a,defaultProp:i??!1,onChange:k=>{k?(h.onOpen(),document.dispatchEvent(new CustomEvent(k0))):h.onClose(),l?.(k)},caller:Vu}),T=g.useMemo(()=>N?j.current?"delayed-open":"instant-open":"closed",[N]),A=g.useCallback(()=>{window.clearTimeout(w.current),w.current=0,j.current=!1,_(!0)},[_]),D=g.useCallback(()=>{window.clearTimeout(w.current),w.current=0,_(!1)},[_]),L=g.useCallback(()=>{window.clearTimeout(w.current),w.current=window.setTimeout(()=>{j.current=!0,_(!0),w.current=0},S)},[S,_]);return g.useEffect(()=>()=>{w.current&&(window.clearTimeout(w.current),w.current=0)},[]),o.jsx(Ew,{...p,children:o.jsx(lX,{scope:t,contentId:b,open:N,stateAttribute:T,trigger:v,onTriggerChange:m,onTriggerEnter:g.useCallback(()=>{h.isOpenDelayedRef.current?L():A()},[h.isOpenDelayedRef,L,A]),onTriggerLeave:g.useCallback(()=>{C?D():(window.clearTimeout(w.current),w.current=0)},[D,C]),onOpen:A,onClose:D,disableHoverableContent:C,children:n})})};l5.displayName=Vu;var L0="TooltipTrigger",c5=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,i=jp(L0,n),l=fS(L0,n),u=Cp(n),d=g.useRef(null),h=At(t,d,i.onTriggerChange),p=g.useRef(!1),v=g.useRef(!1),m=g.useCallback(()=>p.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),o.jsx(cp,{asChild:!0,...u,children:o.jsx(ut.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...a,ref:h,onPointerMove:Je(e.onPointerMove,b=>{b.pointerType!=="touch"&&!v.current&&!l.isPointerInTransitRef.current&&(i.onTriggerEnter(),v.current=!0)}),onPointerLeave:Je(e.onPointerLeave,()=>{i.onTriggerLeave(),v.current=!1}),onPointerDown:Je(e.onPointerDown,()=>{i.open&&i.onClose(),p.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:Je(e.onFocus,()=>{p.current||i.onOpen()}),onBlur:Je(e.onBlur,i.onClose),onClick:Je(e.onClick,i.onClose)})})});c5.displayName=L0;var cX="TooltipPortal",[Use,uX]=Sp(cX,{forceMount:void 0}),Ol="TooltipContent",u5=g.forwardRef((e,t)=>{const n=uX(Ol,e.__scopeTooltip),{forceMount:a=n.forceMount,side:i="top",...l}=e,u=jp(Ol,e.__scopeTooltip);return o.jsx(Ts,{present:a||u.open,children:u.disableHoverableContent?o.jsx(d5,{side:i,...l,ref:t}):o.jsx(dX,{side:i,...l,ref:t})})}),dX=g.forwardRef((e,t)=>{const n=jp(Ol,e.__scopeTooltip),a=fS(Ol,e.__scopeTooltip),i=g.useRef(null),l=At(t,i),[u,d]=g.useState(null),{trigger:h,onClose:p}=n,v=i.current,{onPointerInTransitChange:m}=a,b=g.useCallback(()=>{d(null),m(!1)},[m]),w=g.useCallback((C,S)=>{const j=C.currentTarget,N={x:C.clientX,y:C.clientY},_=gX(N,j.getBoundingClientRect()),T=vX(N,_),A=xX(S.getBoundingClientRect()),D=bX([...T,...A]);d(D),m(!0)},[m]);return g.useEffect(()=>()=>b(),[b]),g.useEffect(()=>{if(h&&v){const C=j=>w(j,v),S=j=>w(j,h);return h.addEventListener("pointerleave",C),v.addEventListener("pointerleave",S),()=>{h.removeEventListener("pointerleave",C),v.removeEventListener("pointerleave",S)}}},[h,v,w,b]),g.useEffect(()=>{if(u){const C=S=>{const j=S.target,N={x:S.clientX,y:S.clientY},_=h?.contains(j)||v?.contains(j),T=!yX(N,u);_?b():T&&(b(),p())};return document.addEventListener("pointermove",C),()=>document.removeEventListener("pointermove",C)}},[h,v,u,p,b]),o.jsx(d5,{...e,ref:l})}),[fX,hX]=Sp(Vu,{isInside:!1}),pX=sX("TooltipContent"),d5=g.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":i,onEscapeKeyDown:l,onPointerDownOutside:u,...d}=e,h=jp(Ol,n),p=Cp(n),{onClose:v}=h;return g.useEffect(()=>(document.addEventListener(k0,v),()=>document.removeEventListener(k0,v)),[v]),g.useEffect(()=>{if(h.trigger){const m=b=>{b.target?.contains(h.trigger)&&v()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[h.trigger,v]),o.jsx(Qu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:m=>m.preventDefault(),onDismiss:v,children:o.jsxs(Tw,{"data-state":h.stateAttribute,...p,...d,ref:t,style:{...d.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(pX,{children:a}),o.jsx(fX,{scope:n,isInside:!0,children:o.jsx(xW,{id:h.contentId,role:"tooltip",children:i||a})})]})})});u5.displayName=Ol;var f5="TooltipArrow",mX=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,i=Cp(n);return hX(f5,n).isInside?null:o.jsx(Rw,{...i,...a,ref:t})});mX.displayName=f5;function gX(e,t){const n=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(n,a,i,l)){case l:return"left";case i:return"right";case n:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function vX(e,t,n=5){const a=[];switch(t){case"top":a.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":a.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":a.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":a.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return a}function xX(e){const{top:t,right:n,bottom:a,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:a},{x:i,y:a}]}function yX(e,t){const{x:n,y:a}=e;let i=!1;for(let l=0,u=t.length-1;l<t.length;u=l++){const d=t[l],h=t[u],p=d.x,v=d.y,m=h.x,b=h.y;v>a!=b>a&&n<(m-p)*(a-v)/(b-v)+p&&(i=!i)}return i}function bX(e){const t=e.slice();return t.sort((n,a)=>n.x<a.x?-1:n.x>a.x?1:n.y<a.y?-1:n.y>a.y?1:0),wX(t)}function wX(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a<e.length;a++){const i=e[a];for(;t.length>=2;){const l=t[t.length-1],u=t[t.length-2];if((l.x-u.x)*(i.y-u.y)>=(l.y-u.y)*(i.x-u.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let a=e.length-1;a>=0;a--){const i=e[a];for(;n.length>=2;){const l=n[n.length-1],u=n[n.length-2];if((l.x-u.x)*(i.y-u.y)>=(l.y-u.y)*(i.x-u.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var SX=o5,CX=l5,jX=c5,h5=u5;const NX=SX,gs=CX,vs=jX,Da=g.forwardRef(({className:e,sideOffset:t=4,...n},a)=>o.jsx(h5,{ref:a,sideOffset:t,className:lt("z-[100] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...n}));Da.displayName=h5.displayName;function _X(){const[e,t]=g.useState(""),[n,a]=g.useState(null),[i,l]=g.useState(0),[u,d]=g.useState(null),h=un(Q=>Q.status?.speed??null),p=un(Q=>(Q.status?.is_running||Q.status?.is_paused)??!1);g.useEffect(()=>{h!==null&&a(h)},[h]);const[v,m]=g.useState([]),[b,w]=g.useState(""),[C,S]=g.useState(!1),[j,N]=g.useState(""),[_,T]=g.useState([]),[A,D]=g.useState(!1),L=g.useRef(null),k=g.useRef(null),P=async(Q,te,he)=>{d(Q);try{const _e=await fe.post(te,he);if(_e.success!==!1)return{success:!0,data:_e};throw new Error(_e.detail||"Action failed")}catch(_e){throw console.error(`Error with ${Q}:`,_e),_e}finally{d(null)}},U=Q=>p?(K.error(`Cannot ${Q} while a pattern is running. Stop the pattern first.`,{action:{label:"Stop",onClick:()=>$()}}),!0):!1,J=async()=>{try{await P("home","/send_home"),K.success("Moving to home position...")}catch{K.error("Failed to move to home position")}},$=async()=>{try{await P("stop","/stop_execution"),K.success("Execution stopped")}catch{try{await P("stop","/force_stop"),K.success("Force stopped")}catch{K.error("Failed to stop execution")}}},W=async()=>{try{await P("reset","/soft_reset"),K.success("Reset sent. Please home the table.")}catch{K.error("Failed to send reset command")}},pe=async()=>{if(!U("move to center"))try{await P("center","/move_to_center"),K.success("Moving to center...")}catch{K.error("Failed to move to center")}},Se=async()=>{if(!U("move to perimeter"))try{await P("perimeter","/move_to_perimeter"),K.success("Moving to perimeter...")}catch{K.error("Failed to move to perimeter")}},Ce=async()=>{const Q=parseFloat(e);if(isNaN(Q)||Q<=0){K.error("Please enter a valid speed value");return}try{await P("speed","/set_speed",{speed:Q}),a(Q),K.success(`Speed set to ${Q} mm/s`),t("")}catch{K.error("Failed to set speed")}},I=async(Q,te)=>{try{await P(Q,"/run_theta_rho",{file_name:Q,pre_execution:"none"}),K.success(`Running ${te}...`)}catch(he){he instanceof Error&&he.message.includes("409")?K.error("Another pattern is already running"):K.error(`Failed to run ${te}`)}},q=async Q=>{if(!U("align"))try{const te=Q*(Math.PI/180),he=i+te;await P("rotate","/send_coordinate",{theta:he,rho:1}),l(he),K.info(`Rotated ${Q}°`)}catch{K.error("Failed to rotate")}},H=async()=>{try{const Q=await fe.get("/list_serial_ports");m(Array.isArray(Q)?Q:[])}catch{K.error("Failed to fetch serial ports")}},be=async()=>{try{const Q=await fe.get("/list_serial_ports"),te=Array.isArray(Q)?Q:[],he=await fe.get("/serial_status");he.connected&&he.port&&(te.includes(he.port)?w(he.port):console.warn(`Port ${he.port} from status not in available ports, ignoring`))}catch{}},Ne=async(Q=!1)=>{if(!b){Q||K.error("Please select a serial port");return}D(!0);try{await fe.post("/api/debug-serial/open",{port:b}),S(!0),G("resp",`Connected to ${b}`),Q||K.success(`Connected to ${b}`)}catch(te){const he=te instanceof Error?te.message:"Unknown error";G("error",`Failed to connect: ${he}`),Q||K.error("Failed to connect to serial port")}finally{D(!1)}},B=async()=>{D(!0);try{await fe.post("/api/debug-serial/close",{port:b}),S(!1),G("resp","Disconnected"),K.success("Disconnected from serial port")}catch{K.error("Failed to disconnect")}finally{D(!1)}},G=(Q,te)=>{const he=new Date().toLocaleTimeString();T(_e=>[..._e.slice(-200),{type:Q,text:te,time:he}]),setTimeout(()=>{L.current&&(L.current.scrollTop=L.current.scrollHeight)},10)},X=async()=>{if(!j.trim()||!C||A)return;const Q=j.trim();N(""),D(!0),G("cmd",Q);try{const te=await fe.post("/api/debug-serial/send",{port:b,command:Q});te.responses?te.responses.length>0?te.responses.forEach(he=>G("resp",he)):G("resp","(no response)"):te.detail&&G("error",te.detail||"Command failed")}catch(te){G("error",`Error: ${te}`)}finally{D(!1),setTimeout(()=>k.current?.focus(),0)}},oe=async()=>{if(!(!C||A)){D(!0),G("cmd","[Soft Reset]");try{const Q=await fe.post("/api/debug-serial/send",{port:b,command:""});Q.responses&&Q.responses.length>0?Q.responses.forEach(te=>G("resp",te)):G("resp","Reset sent"),K.success("Reset command sent")}catch(Q){G("error",`Reset failed: ${Q}`),K.error("Failed to send reset")}finally{D(!1)}}},xe=Q=>{Q.key==="Enter"&&!Q.shiftKey&&(Q.preventDefault(),A||X())};return g.useEffect(()=>{H(),be()},[]),o.jsx(NX,{children:o.jsxs("div",{className:"flex flex-col w-full max-w-5xl mx-auto gap-6 py-3 sm:py-6 px-0 sm:px-4",children:[o.jsxs("div",{className:"space-y-0.5 sm:space-y-1 pl-1",children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Table Control"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Manual controls for your sand table"})]}),o.jsx(Xn,{}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[o.jsxs(Un,{className:"transition-all duration-200 hover:shadow-md hover:border-primary/20",children:[o.jsxs(da,{className:"pb-3",children:[o.jsx(fa,{className:"text-lg",children:"Primary Actions"}),o.jsx(hi,{children:"Calibrate or stop the table"})]}),o.jsx(qn,{children:o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs(gs,{children:[o.jsx(vs,{asChild:!0,children:o.jsxs(se,{onClick:J,disabled:u==="home",variant:"primary",className:"h-16 gap-1 flex-col items-center justify-center",children:[u==="home"?o.jsx("span",{className:"material-icons-outlined animate-spin text-2xl",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-2xl",children:"home"}),o.jsx("span",{className:"text-xs",children:"Home"})]})}),o.jsx(Da,{children:"Return to home position"})]}),o.jsxs(gs,{children:[o.jsx(vs,{asChild:!0,children:o.jsxs(se,{onClick:$,disabled:u==="stop",variant:"destructive",className:"h-16 gap-1 flex-col items-center justify-center",children:[u==="stop"?o.jsx("span",{className:"material-icons-outlined animate-spin text-2xl",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-2xl",children:"stop_circle"}),o.jsx("span",{className:"text-xs",children:"Stop"})]})}),o.jsx(Da,{children:"Gracefully stop"})]}),o.jsxs(ga,{children:[o.jsxs(gs,{children:[o.jsx(vs,{asChild:!0,children:o.jsx(tu,{asChild:!0,children:o.jsxs(se,{disabled:u==="reset",variant:"secondary",className:"h-16 gap-1 flex-col items-center justify-center",children:[u==="reset"?o.jsx("span",{className:"material-icons-outlined animate-spin text-2xl",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-2xl",children:"restart_alt"}),o.jsx("span",{className:"text-xs",children:"Reset"})]})})}),o.jsx(Da,{children:"Send soft reset to controller"})]}),o.jsxs(Wr,{className:"sm:max-w-md",children:[o.jsxs(Mr,{children:[o.jsx(Dr,{children:"Reset Controller?"}),o.jsx(vi,{children:"This will send a soft reset to the controller."})]}),o.jsxs(mr,{className:"flex items-center border-amber-500/50",children:[o.jsx("span",{className:"material-icons-outlined text-amber-500 text-base mr-2 shrink-0",children:"warning"}),o.jsx(gr,{className:"text-amber-600 dark:text-amber-400",children:"Homing is required after resetting. The table will lose its position reference."})]}),o.jsxs(va,{className:"gap-2 sm:gap-0",children:[o.jsx(tu,{asChild:!0,children:o.jsx(se,{variant:"outline",children:"Cancel"})}),o.jsx(tu,{asChild:!0,children:o.jsx(se,{variant:"destructive",onClick:W,children:"Reset Controller"})})]})]})]})]})})]}),o.jsxs(Un,{className:"transition-all duration-200 hover:shadow-md hover:border-primary/20",children:[o.jsx(da,{className:"pb-3",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(fa,{className:"text-lg",children:"Speed"}),o.jsx(hi,{children:"Ball movement speed"})]}),o.jsx(Al,{variant:"secondary",className:"font-mono",children:n!==null?`${n} mm/s`:"-- mm/s"})]})}),o.jsx(qn,{children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx(bt,{type:"number",value:e,onChange:Q=>t(Q.target.value),placeholder:"mm/s",min:"1",step:"1",className:"flex-1",onKeyDown:Q=>Q.key==="Enter"&&Ce()}),o.jsxs(se,{onClick:Ce,disabled:u==="speed"||!e,className:"gap-2",children:[u==="speed"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"check"}),"Set"]})]})})]}),o.jsxs(Un,{className:"transition-all duration-200 hover:shadow-md hover:border-primary/20",children:[o.jsxs(da,{className:"pb-3",children:[o.jsx(fa,{className:"text-lg",children:"Position"}),o.jsx(hi,{children:"Move ball to a specific location"})]}),o.jsx(qn,{children:o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs(gs,{children:[o.jsx(vs,{asChild:!0,children:o.jsxs(se,{onClick:pe,disabled:u==="center",variant:"secondary",className:"h-16 gap-1 flex-col items-center justify-center",children:[u==="center"?o.jsx("span",{className:"material-icons-outlined animate-spin text-2xl",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-2xl",children:"center_focus_strong"}),o.jsx("span",{className:"text-xs",children:"Center"})]})}),o.jsx(Da,{children:"Move ball to center"})]}),o.jsxs(gs,{children:[o.jsx(vs,{asChild:!0,children:o.jsxs(se,{onClick:Se,disabled:u==="perimeter",variant:"secondary",className:"h-16 gap-1 flex-col items-center justify-center",children:[u==="perimeter"?o.jsx("span",{className:"material-icons-outlined animate-spin text-2xl",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-2xl",children:"trip_origin"}),o.jsx("span",{className:"text-xs",children:"Perimeter"})]})}),o.jsx(Da,{children:"Move ball to edge"})]}),o.jsxs(ga,{children:[o.jsxs(gs,{children:[o.jsx(vs,{asChild:!0,children:o.jsx(tu,{asChild:!0,children:o.jsxs(se,{variant:"secondary",className:"h-16 gap-1 flex-col items-center justify-center",children:[o.jsx("span",{className:"material-icons-outlined text-2xl",children:"screen_rotation"}),o.jsx("span",{className:"text-xs",children:"Align"})]})})}),o.jsx(Da,{children:"Align pattern orientation"})]}),o.jsxs(Wr,{className:"sm:max-w-md",children:[o.jsxs(Mr,{children:[o.jsx(Dr,{children:"Pattern Orientation Alignment"}),o.jsx(vi,{children:"Follow these steps to align your patterns with their previews"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsx("ol",{className:"space-y-3 text-sm",children:['Home the table then select move to perimeter. Look at your pattern preview and decide where the "bottom" should be.',"Manually move the radial arm or use the rotation buttons below to point 90° to the right of where you want the pattern bottom.",'Click the "Home" button to establish this as the reference position.',"All patterns will now be oriented according to their previews!"].map((Q,te)=>o.jsxs("li",{className:"flex gap-3",children:[o.jsx(Al,{variant:"secondary",className:"h-6 w-6 shrink-0 items-center justify-center rounded-full p-0",children:te+1}),o.jsx("span",{className:"text-muted-foreground",children:Q})]},te))}),o.jsx(Xn,{}),o.jsxs(mr,{className:"flex items-start border-amber-500/50",children:[o.jsx("span",{className:"material-icons-outlined text-amber-500 text-base mr-2 shrink-0",children:"warning"}),o.jsx(gr,{className:"text-amber-600 dark:text-amber-400",children:"Only perform this when you want to change the orientation reference."})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-sm font-medium text-center",children:"Fine Adjustment"}),o.jsxs("div",{className:"flex justify-center gap-2",children:[o.jsxs(se,{variant:"secondary",onClick:()=>q(-10),disabled:u==="rotate",children:[o.jsx("span",{className:"material-icons text-lg mr-1",children:"rotate_left"}),"CCW 10°"]}),o.jsxs(se,{variant:"secondary",onClick:()=>q(10),disabled:u==="rotate",children:["CW 10°",o.jsx("span",{className:"material-icons text-lg ml-1",children:"rotate_right"})]})]}),o.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Each click rotates 10 degrees"})]})]}),o.jsx(va,{children:o.jsx(tu,{asChild:!0,children:o.jsx(se,{children:"Got it"})})})]})]})]})})]}),o.jsxs(Un,{className:"transition-all duration-200 hover:shadow-md hover:border-primary/20",children:[o.jsxs(da,{className:"pb-3",children:[o.jsx(fa,{className:"text-lg",children:"Clear Sand"}),o.jsx(hi,{children:"Erase current pattern from the table"})]}),o.jsx(qn,{children:o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs(gs,{children:[o.jsx(vs,{asChild:!0,children:o.jsxs(se,{onClick:()=>I("clear_from_in.thr","clear from center"),disabled:u==="clear_from_in.thr",variant:"secondary",className:"h-16 gap-1 flex-col items-center justify-center",children:[u==="clear_from_in.thr"?o.jsx("span",{className:"material-icons-outlined animate-spin text-2xl",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-2xl",children:"center_focus_strong"}),o.jsx("span",{className:"text-xs",children:"Clear Center"})]})}),o.jsx(Da,{children:"Spiral outward from center"})]}),o.jsxs(gs,{children:[o.jsx(vs,{asChild:!0,children:o.jsxs(se,{onClick:()=>I("clear_from_out.thr","clear from perimeter"),disabled:u==="clear_from_out.thr",variant:"secondary",className:"h-16 gap-1 flex-col items-center justify-center",children:[u==="clear_from_out.thr"?o.jsx("span",{className:"material-icons-outlined animate-spin text-2xl",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-2xl",children:"all_out"}),o.jsx("span",{className:"text-xs",children:"Clear Edge"})]})}),o.jsx(Da,{children:"Spiral inward from edge"})]}),o.jsxs(gs,{children:[o.jsx(vs,{asChild:!0,children:o.jsxs(se,{onClick:()=>I("clear_sideway.thr","clear sideways"),disabled:u==="clear_sideway.thr",variant:"secondary",className:"h-16 gap-1 flex-col items-center justify-center",children:[u==="clear_sideway.thr"?o.jsx("span",{className:"material-icons-outlined animate-spin text-2xl",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-2xl",children:"swap_horiz"}),o.jsx("span",{className:"text-xs",children:"Clear Sideways"})]})}),o.jsx(Da,{children:"Clear with side-to-side motion"})]})]})})]})]}),o.jsxs(Un,{className:"transition-all duration-200 hover:shadow-md hover:border-primary/20",children:[o.jsxs(da,{className:"pb-3 space-y-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{className:"min-w-0 space-y-2",children:[o.jsxs(fa,{className:"text-lg flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-xl",children:"terminal"}),"Serial Terminal"]}),o.jsx(hi,{className:"hidden sm:block",children:"Send raw commands to the table controller"}),o.jsxs(mr,{className:"flex items-center border-amber-500/50 py-2",children:[o.jsx("span",{className:"material-icons-outlined text-amber-500 text-base mr-2 shrink-0",children:"warning"}),o.jsx(gr,{className:"text-xs text-amber-600 dark:text-amber-400",children:"Do not use while a pattern is running. This will interfere with the main connection."})]})]}),o.jsx("div",{className:"hidden sm:flex items-center gap-1",children:_.length>0&&o.jsx(se,{variant:"ghost",size:"icon",onClick:()=>T([]),title:"Clear history",children:o.jsx("span",{className:"material-icons-outlined",children:"delete_sweep"})})})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsxs(Pn,{value:b,onValueChange:w,onOpenChange:Q=>Q&&H(),disabled:C||A,children:[o.jsx(An,{className:"h-9 flex-1 min-w-[180px] max-w-[280px]",children:o.jsx(Hn,{placeholder:"Select port..."})}),o.jsx(On,{children:v.map(Q=>o.jsx(nt,{value:Q,children:Q},Q))})]}),C?o.jsxs(o.Fragment,{children:[o.jsxs(se,{size:"sm",variant:"destructive",onClick:B,disabled:A,title:"Disconnect",children:[o.jsx("span",{className:"material-icons-outlined sm:mr-1",children:"power_off"}),o.jsx("span",{className:"hidden sm:inline",children:"Disconnect"})]}),o.jsxs(se,{size:"sm",variant:"secondary",onClick:oe,disabled:A,title:"Send soft reset to controller",children:[o.jsx("span",{className:"material-icons-outlined sm:mr-1",children:"restart_alt"}),o.jsx("span",{className:"hidden sm:inline",children:"Reset"})]})]}):o.jsxs(se,{size:"sm",onClick:()=>Ne(),disabled:!b||A,title:"Connect",children:[A?o.jsx("span",{className:"material-icons-outlined animate-spin sm:mr-1",children:"sync"}):o.jsx("span",{className:"material-icons-outlined sm:mr-1",children:"power"}),o.jsx("span",{className:"hidden sm:inline",children:"Connect"})]}),_.length>0&&o.jsx(se,{variant:"ghost",size:"icon",className:"sm:hidden",onClick:()=>T([]),title:"Clear history",children:o.jsx("span",{className:"material-icons-outlined",children:"delete"})})]})]}),o.jsxs(qn,{children:[o.jsx("div",{ref:L,className:"bg-black/90 rounded-md p-3 h-48 overflow-y-auto font-mono text-sm mb-3",children:_.length>0?_.map((Q,te)=>o.jsxs("div",{className:`${Q.type==="cmd"?"text-cyan-400":Q.type==="error"?"text-red-400":"text-green-400"}`,children:[o.jsx("span",{className:"text-gray-500 text-xs mr-2",children:Q.time}),Q.type==="cmd"?"> ":"",Q.text]},te)):o.jsx("div",{className:"text-gray-500 italic",children:C?"Ready. Enter a command below (e.g., $, $$, ?, $H)":"Connect to a serial port to send commands"})}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(bt,{ref:k,value:j,onChange:Q=>N(Q.target.value),onKeyDown:xe,disabled:!C,readOnly:A,placeholder:C?"Enter command (e.g., $, $$, ?, $H)":"Connect to send commands",className:"font-mono text-base h-11"}),o.jsx(se,{onClick:X,disabled:!C||!j.trim()||A,className:"h-11 px-6",children:A?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"send"})})]})]})]})]})})}var Np="Switch",[EX]=Lr(Np),[TX,RX]=EX(Np),p5=g.forwardRef((e,t)=>{const{__scopeSwitch:n,name:a,checked:i,defaultChecked:l,required:u,disabled:d,value:h="on",onCheckedChange:p,form:v,...m}=e,[b,w]=g.useState(null),C=At(t,T=>w(T)),S=g.useRef(!1),j=b?v||!!b.closest("form"):!0,[N,_]=Zr({prop:i,defaultProp:l??!1,onChange:p,caller:Np});return o.jsxs(TX,{scope:n,checked:N,disabled:d,children:[o.jsx(ut.button,{type:"button",role:"switch","aria-checked":N,"aria-required":u,"data-state":x5(N),"data-disabled":d?"":void 0,disabled:d,value:h,...m,ref:C,onClick:Je(e.onClick,T=>{_(A=>!A),j&&(S.current=T.isPropagationStopped(),S.current||T.stopPropagation())})}),j&&o.jsx(v5,{control:b,bubbles:!S.current,name:a,value:h,checked:N,required:u,disabled:d,form:v,style:{transform:"translateX(-100%)"}})]})});p5.displayName=Np;var m5="SwitchThumb",g5=g.forwardRef((e,t)=>{const{__scopeSwitch:n,...a}=e,i=RX(m5,n);return o.jsx(ut.span,{"data-state":x5(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t})});g5.displayName=m5;var AX="SwitchBubbleInput",v5=g.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:a=!0,...i},l)=>{const u=g.useRef(null),d=At(u,l),h=gp(n),p=lp(t);return g.useEffect(()=>{const v=u.current;if(!v)return;const m=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(m,"checked").set;if(h!==n&&w){const C=new Event("click",{bubbles:a});w.call(v,n),v.dispatchEvent(C)}},[h,n,a]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:d,style:{...i.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});v5.displayName=AX;function x5(e){return e?"checked":"unchecked"}var y5=p5,OX=g5;const Tr=g.forwardRef(({className:e,...t},n)=>o.jsx(y5,{className:lt("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-secondary",e),...t,ref:n,children:o.jsx(OX,{className:lt("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Tr.displayName=y5.displayName;var hr={},Wo={},Pv,AT;function b5(){if(AT)return Pv;AT=1;var e=typeof Af=="object"&&Af&&Af.Object===Object&&Af;return Pv=e,Pv}var kv,OT;function Ga(){if(OT)return kv;OT=1;var e=b5(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return kv=n,kv}var Lv,MT;function ld(){if(MT)return Lv;MT=1;var e=Ga(),t=e.Symbol;return Lv=t,Lv}var Bv,DT;function MX(){if(DT)return Bv;DT=1;var e=ld(),t=Object.prototype,n=t.hasOwnProperty,a=t.toString,i=e?e.toStringTag:void 0;function l(u){var d=n.call(u,i),h=u[i];try{u[i]=void 0;var p=!0}catch{}var v=a.call(u);return p&&(d?u[i]=h:delete u[i]),v}return Bv=l,Bv}var Iv,PT;function DX(){if(PT)return Iv;PT=1;var e=Object.prototype,t=e.toString;function n(a){return t.call(a)}return Iv=n,Iv}var zv,kT;function lo(){if(kT)return zv;kT=1;var e=ld(),t=MX(),n=DX(),a="[object Null]",i="[object Undefined]",l=e?e.toStringTag:void 0;function u(d){return d==null?d===void 0?i:a:l&&l in Object(d)?t(d):n(d)}return zv=u,zv}var Fv,LT;function Sa(){if(LT)return Fv;LT=1;var e=Array.isArray;return Fv=e,Fv}var Hv,BT;function As(){if(BT)return Hv;BT=1;function e(t){return t!=null&&typeof t=="object"}return Hv=e,Hv}var Uv,IT;function PX(){if(IT)return Uv;IT=1;var e=lo(),t=Sa(),n=As(),a="[object String]";function i(l){return typeof l=="string"||!t(l)&&n(l)&&e(l)==a}return Uv=i,Uv}var qv,zT;function kX(){if(zT)return qv;zT=1;function e(t){return function(n,a,i){for(var l=-1,u=Object(n),d=i(n),h=d.length;h--;){var p=d[t?h:++l];if(a(u[p],p,u)===!1)break}return n}}return qv=e,qv}var Vv,FT;function LX(){if(FT)return Vv;FT=1;var e=kX(),t=e();return Vv=t,Vv}var $v,HT;function BX(){if(HT)return $v;HT=1;function e(t,n){for(var a=-1,i=Array(t);++a<t;)i[a]=n(a);return i}return $v=e,$v}var Gv,UT;function IX(){if(UT)return Gv;UT=1;var e=lo(),t=As(),n="[object Arguments]";function a(i){return t(i)&&e(i)==n}return Gv=a,Gv}var Kv,qT;function w5(){if(qT)return Kv;qT=1;var e=IX(),t=As(),n=Object.prototype,a=n.hasOwnProperty,i=n.propertyIsEnumerable,l=e((function(){return arguments})())?e:function(u){return t(u)&&a.call(u,"callee")&&!i.call(u,"callee")};return Kv=l,Kv}var du={exports:{}},Yv,VT;function zX(){if(VT)return Yv;VT=1;function e(){return!1}return Yv=e,Yv}du.exports;var $T;function hS(){return $T||($T=1,(function(e,t){var n=Ga(),a=zX(),i=t&&!t.nodeType&&t,l=i&&!0&&e&&!e.nodeType&&e,u=l&&l.exports===i,d=u?n.Buffer:void 0,h=d?d.isBuffer:void 0,p=h||a;e.exports=p})(du,du.exports)),du.exports}var Wv,GT;function S5(){if(GT)return Wv;GT=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(a,i){var l=typeof a;return i=i??e,!!i&&(l=="number"||l!="symbol"&&t.test(a))&&a>-1&&a%1==0&&a<i}return Wv=n,Wv}var Xv,KT;function pS(){if(KT)return Xv;KT=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return Xv=t,Xv}var Qv,YT;function FX(){if(YT)return Qv;YT=1;var e=lo(),t=pS(),n=As(),a="[object Arguments]",i="[object Array]",l="[object Boolean]",u="[object Date]",d="[object Error]",h="[object Function]",p="[object Map]",v="[object Number]",m="[object Object]",b="[object RegExp]",w="[object Set]",C="[object String]",S="[object WeakMap]",j="[object ArrayBuffer]",N="[object DataView]",_="[object Float32Array]",T="[object Float64Array]",A="[object Int8Array]",D="[object Int16Array]",L="[object Int32Array]",k="[object Uint8Array]",P="[object Uint8ClampedArray]",U="[object Uint16Array]",J="[object Uint32Array]",$={};$[_]=$[T]=$[A]=$[D]=$[L]=$[k]=$[P]=$[U]=$[J]=!0,$[a]=$[i]=$[j]=$[l]=$[N]=$[u]=$[d]=$[h]=$[p]=$[v]=$[m]=$[b]=$[w]=$[C]=$[S]=!1;function W(pe){return n(pe)&&t(pe.length)&&!!$[e(pe)]}return Qv=W,Qv}var Zv,WT;function mS(){if(WT)return Zv;WT=1;function e(t){return function(n){return t(n)}}return Zv=e,Zv}var fu={exports:{}};fu.exports;var XT;function gS(){return XT||(XT=1,(function(e,t){var n=b5(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,l=i&&i.exports===a,u=l&&n.process,d=(function(){try{var h=i&&i.require&&i.require("util").types;return h||u&&u.binding&&u.binding("util")}catch{}})();e.exports=d})(fu,fu.exports)),fu.exports}var Jv,QT;function C5(){if(QT)return Jv;QT=1;var e=FX(),t=mS(),n=gS(),a=n&&n.isTypedArray,i=a?t(a):e;return Jv=i,Jv}var ex,ZT;function j5(){if(ZT)return ex;ZT=1;var e=BX(),t=w5(),n=Sa(),a=hS(),i=S5(),l=C5(),u=Object.prototype,d=u.hasOwnProperty;function h(p,v){var m=n(p),b=!m&&t(p),w=!m&&!b&&a(p),C=!m&&!b&&!w&&l(p),S=m||b||w||C,j=S?e(p.length,String):[],N=j.length;for(var _ in p)(v||d.call(p,_))&&!(S&&(_=="length"||w&&(_=="offset"||_=="parent")||C&&(_=="buffer"||_=="byteLength"||_=="byteOffset")||i(_,N)))&&j.push(_);return j}return ex=h,ex}var tx,JT;function vS(){if(JT)return tx;JT=1;var e=Object.prototype;function t(n){var a=n&&n.constructor,i=typeof a=="function"&&a.prototype||e;return n===i}return tx=t,tx}var nx,eR;function N5(){if(eR)return nx;eR=1;function e(t,n){return function(a){return t(n(a))}}return nx=e,nx}var rx,tR;function HX(){if(tR)return rx;tR=1;var e=N5(),t=e(Object.keys,Object);return rx=t,rx}var ax,nR;function UX(){if(nR)return ax;nR=1;var e=vS(),t=HX(),n=Object.prototype,a=n.hasOwnProperty;function i(l){if(!e(l))return t(l);var u=[];for(var d in Object(l))a.call(l,d)&&d!="constructor"&&u.push(d);return u}return ax=i,ax}var sx,rR;function Wl(){if(rR)return sx;rR=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return sx=e,sx}var ix,aR;function _5(){if(aR)return ix;aR=1;var e=lo(),t=Wl(),n="[object AsyncFunction]",a="[object Function]",i="[object GeneratorFunction]",l="[object Proxy]";function u(d){if(!t(d))return!1;var h=e(d);return h==a||h==i||h==n||h==l}return ix=u,ix}var ox,sR;function _p(){if(sR)return ox;sR=1;var e=_5(),t=pS();function n(a){return a!=null&&t(a.length)&&!e(a)}return ox=n,ox}var lx,iR;function cd(){if(iR)return lx;iR=1;var e=j5(),t=UX(),n=_p();function a(i){return n(i)?e(i):t(i)}return lx=a,lx}var cx,oR;function E5(){if(oR)return cx;oR=1;var e=LX(),t=cd();function n(a,i){return a&&e(a,i,t)}return cx=n,cx}var ux,lR;function T5(){if(lR)return ux;lR=1;function e(t){return t}return ux=e,ux}var dx,cR;function qX(){if(cR)return dx;cR=1;var e=T5();function t(n){return typeof n=="function"?n:e}return dx=t,dx}var fx,uR;function xS(){if(uR)return fx;uR=1;var e=E5(),t=qX();function n(a,i){return a&&e(a,t(i))}return fx=n,fx}var hx,dR;function yS(){if(dR)return hx;dR=1;var e=N5(),t=e(Object.getPrototypeOf,Object);return hx=t,hx}var px,fR;function VX(){if(fR)return px;fR=1;var e=lo(),t=yS(),n=As(),a="[object Object]",i=Function.prototype,l=Object.prototype,u=i.toString,d=l.hasOwnProperty,h=u.call(Object);function p(v){if(!n(v)||e(v)!=a)return!1;var m=t(v);if(m===null)return!0;var b=d.call(m,"constructor")&&m.constructor;return typeof b=="function"&&b instanceof b&&u.call(b)==h}return px=p,px}var mx,hR;function R5(){if(hR)return mx;hR=1;function e(t,n){for(var a=-1,i=t==null?0:t.length,l=Array(i);++a<i;)l[a]=n(t[a],a,t);return l}return mx=e,mx}var gx,pR;function $X(){if(pR)return gx;pR=1;function e(){this.__data__=[],this.size=0}return gx=e,gx}var vx,mR;function bS(){if(mR)return vx;mR=1;function e(t,n){return t===n||t!==t&&n!==n}return vx=e,vx}var xx,gR;function Ep(){if(gR)return xx;gR=1;var e=bS();function t(n,a){for(var i=n.length;i--;)if(e(n[i][0],a))return i;return-1}return xx=t,xx}var yx,vR;function GX(){if(vR)return yx;vR=1;var e=Ep(),t=Array.prototype,n=t.splice;function a(i){var l=this.__data__,u=e(l,i);if(u<0)return!1;var d=l.length-1;return u==d?l.pop():n.call(l,u,1),--this.size,!0}return yx=a,yx}var bx,xR;function KX(){if(xR)return bx;xR=1;var e=Ep();function t(n){var a=this.__data__,i=e(a,n);return i<0?void 0:a[i][1]}return bx=t,bx}var wx,yR;function YX(){if(yR)return wx;yR=1;var e=Ep();function t(n){return e(this.__data__,n)>-1}return wx=t,wx}var Sx,bR;function WX(){if(bR)return Sx;bR=1;var e=Ep();function t(n,a){var i=this.__data__,l=e(i,n);return l<0?(++this.size,i.push([n,a])):i[l][1]=a,this}return Sx=t,Sx}var Cx,wR;function Tp(){if(wR)return Cx;wR=1;var e=$X(),t=GX(),n=KX(),a=YX(),i=WX();function l(u){var d=-1,h=u==null?0:u.length;for(this.clear();++d<h;){var p=u[d];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=a,l.prototype.set=i,Cx=l,Cx}var jx,SR;function XX(){if(SR)return jx;SR=1;var e=Tp();function t(){this.__data__=new e,this.size=0}return jx=t,jx}var Nx,CR;function QX(){if(CR)return Nx;CR=1;function e(t){var n=this.__data__,a=n.delete(t);return this.size=n.size,a}return Nx=e,Nx}var _x,jR;function ZX(){if(jR)return _x;jR=1;function e(t){return this.__data__.get(t)}return _x=e,_x}var Ex,NR;function JX(){if(NR)return Ex;NR=1;function e(t){return this.__data__.has(t)}return Ex=e,Ex}var Tx,_R;function eQ(){if(_R)return Tx;_R=1;var e=Ga(),t=e["__core-js_shared__"];return Tx=t,Tx}var Rx,ER;function tQ(){if(ER)return Rx;ER=1;var e=eQ(),t=(function(){var a=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})();function n(a){return!!t&&t in a}return Rx=n,Rx}var Ax,TR;function A5(){if(TR)return Ax;TR=1;var e=Function.prototype,t=e.toString;function n(a){if(a!=null){try{return t.call(a)}catch{}try{return a+""}catch{}}return""}return Ax=n,Ax}var Ox,RR;function nQ(){if(RR)return Ox;RR=1;var e=_5(),t=tQ(),n=Wl(),a=A5(),i=/[\\^$.*+?()[\]{}|]/g,l=/^\[object .+?Constructor\]$/,u=Function.prototype,d=Object.prototype,h=u.toString,p=d.hasOwnProperty,v=RegExp("^"+h.call(p).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(b){if(!n(b)||t(b))return!1;var w=e(b)?v:l;return w.test(a(b))}return Ox=m,Ox}var Mx,AR;function rQ(){if(AR)return Mx;AR=1;function e(t,n){return t?.[n]}return Mx=e,Mx}var Dx,OR;function co(){if(OR)return Dx;OR=1;var e=nQ(),t=rQ();function n(a,i){var l=t(a,i);return e(l)?l:void 0}return Dx=n,Dx}var Px,MR;function wS(){if(MR)return Px;MR=1;var e=co(),t=Ga(),n=e(t,"Map");return Px=n,Px}var kx,DR;function Rp(){if(DR)return kx;DR=1;var e=co(),t=e(Object,"create");return kx=t,kx}var Lx,PR;function aQ(){if(PR)return Lx;PR=1;var e=Rp();function t(){this.__data__=e?e(null):{},this.size=0}return Lx=t,Lx}var Bx,kR;function sQ(){if(kR)return Bx;kR=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Bx=e,Bx}var Ix,LR;function iQ(){if(LR)return Ix;LR=1;var e=Rp(),t="__lodash_hash_undefined__",n=Object.prototype,a=n.hasOwnProperty;function i(l){var u=this.__data__;if(e){var d=u[l];return d===t?void 0:d}return a.call(u,l)?u[l]:void 0}return Ix=i,Ix}var zx,BR;function oQ(){if(BR)return zx;BR=1;var e=Rp(),t=Object.prototype,n=t.hasOwnProperty;function a(i){var l=this.__data__;return e?l[i]!==void 0:n.call(l,i)}return zx=a,zx}var Fx,IR;function lQ(){if(IR)return Fx;IR=1;var e=Rp(),t="__lodash_hash_undefined__";function n(a,i){var l=this.__data__;return this.size+=this.has(a)?0:1,l[a]=e&&i===void 0?t:i,this}return Fx=n,Fx}var Hx,zR;function cQ(){if(zR)return Hx;zR=1;var e=aQ(),t=sQ(),n=iQ(),a=oQ(),i=lQ();function l(u){var d=-1,h=u==null?0:u.length;for(this.clear();++d<h;){var p=u[d];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=a,l.prototype.set=i,Hx=l,Hx}var Ux,FR;function uQ(){if(FR)return Ux;FR=1;var e=cQ(),t=Tp(),n=wS();function a(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Ux=a,Ux}var qx,HR;function dQ(){if(HR)return qx;HR=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return qx=e,qx}var Vx,UR;function Ap(){if(UR)return Vx;UR=1;var e=dQ();function t(n,a){var i=n.__data__;return e(a)?i[typeof a=="string"?"string":"hash"]:i.map}return Vx=t,Vx}var $x,qR;function fQ(){if(qR)return $x;qR=1;var e=Ap();function t(n){var a=e(this,n).delete(n);return this.size-=a?1:0,a}return $x=t,$x}var Gx,VR;function hQ(){if(VR)return Gx;VR=1;var e=Ap();function t(n){return e(this,n).get(n)}return Gx=t,Gx}var Kx,$R;function pQ(){if($R)return Kx;$R=1;var e=Ap();function t(n){return e(this,n).has(n)}return Kx=t,Kx}var Yx,GR;function mQ(){if(GR)return Yx;GR=1;var e=Ap();function t(n,a){var i=e(this,n),l=i.size;return i.set(n,a),this.size+=i.size==l?0:1,this}return Yx=t,Yx}var Wx,KR;function SS(){if(KR)return Wx;KR=1;var e=uQ(),t=fQ(),n=hQ(),a=pQ(),i=mQ();function l(u){var d=-1,h=u==null?0:u.length;for(this.clear();++d<h;){var p=u[d];this.set(p[0],p[1])}}return l.prototype.clear=e,l.prototype.delete=t,l.prototype.get=n,l.prototype.has=a,l.prototype.set=i,Wx=l,Wx}var Xx,YR;function gQ(){if(YR)return Xx;YR=1;var e=Tp(),t=wS(),n=SS(),a=200;function i(l,u){var d=this.__data__;if(d instanceof e){var h=d.__data__;if(!t||h.length<a-1)return h.push([l,u]),this.size=++d.size,this;d=this.__data__=new n(h)}return d.set(l,u),this.size=d.size,this}return Xx=i,Xx}var Qx,WR;function CS(){if(WR)return Qx;WR=1;var e=Tp(),t=XX(),n=QX(),a=ZX(),i=JX(),l=gQ();function u(d){var h=this.__data__=new e(d);this.size=h.size}return u.prototype.clear=t,u.prototype.delete=n,u.prototype.get=a,u.prototype.has=i,u.prototype.set=l,Qx=u,Qx}var Zx,XR;function vQ(){if(XR)return Zx;XR=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return Zx=t,Zx}var Jx,QR;function xQ(){if(QR)return Jx;QR=1;function e(t){return this.__data__.has(t)}return Jx=e,Jx}var ey,ZR;function yQ(){if(ZR)return ey;ZR=1;var e=SS(),t=vQ(),n=xQ();function a(i){var l=-1,u=i==null?0:i.length;for(this.__data__=new e;++l<u;)this.add(i[l])}return a.prototype.add=a.prototype.push=t,a.prototype.has=n,ey=a,ey}var ty,JR;function bQ(){if(JR)return ty;JR=1;function e(t,n){for(var a=-1,i=t==null?0:t.length;++a<i;)if(n(t[a],a,t))return!0;return!1}return ty=e,ty}var ny,eA;function wQ(){if(eA)return ny;eA=1;function e(t,n){return t.has(n)}return ny=e,ny}var ry,tA;function O5(){if(tA)return ry;tA=1;var e=yQ(),t=bQ(),n=wQ(),a=1,i=2;function l(u,d,h,p,v,m){var b=h&a,w=u.length,C=d.length;if(w!=C&&!(b&&C>w))return!1;var S=m.get(u),j=m.get(d);if(S&&j)return S==d&&j==u;var N=-1,_=!0,T=h&i?new e:void 0;for(m.set(u,d),m.set(d,u);++N<w;){var A=u[N],D=d[N];if(p)var L=b?p(D,A,N,d,u,m):p(A,D,N,u,d,m);if(L!==void 0){if(L)continue;_=!1;break}if(T){if(!t(d,function(k,P){if(!n(T,P)&&(A===k||v(A,k,h,p,m)))return T.push(P)})){_=!1;break}}else if(!(A===D||v(A,D,h,p,m))){_=!1;break}}return m.delete(u),m.delete(d),_}return ry=l,ry}var ay,nA;function M5(){if(nA)return ay;nA=1;var e=Ga(),t=e.Uint8Array;return ay=t,ay}var sy,rA;function SQ(){if(rA)return sy;rA=1;function e(t){var n=-1,a=Array(t.size);return t.forEach(function(i,l){a[++n]=[l,i]}),a}return sy=e,sy}var iy,aA;function CQ(){if(aA)return iy;aA=1;function e(t){var n=-1,a=Array(t.size);return t.forEach(function(i){a[++n]=i}),a}return iy=e,iy}var oy,sA;function jQ(){if(sA)return oy;sA=1;var e=ld(),t=M5(),n=bS(),a=O5(),i=SQ(),l=CQ(),u=1,d=2,h="[object Boolean]",p="[object Date]",v="[object Error]",m="[object Map]",b="[object Number]",w="[object RegExp]",C="[object Set]",S="[object String]",j="[object Symbol]",N="[object ArrayBuffer]",_="[object DataView]",T=e?e.prototype:void 0,A=T?T.valueOf:void 0;function D(L,k,P,U,J,$,W){switch(P){case _:if(L.byteLength!=k.byteLength||L.byteOffset!=k.byteOffset)return!1;L=L.buffer,k=k.buffer;case N:return!(L.byteLength!=k.byteLength||!$(new t(L),new t(k)));case h:case p:case b:return n(+L,+k);case v:return L.name==k.name&&L.message==k.message;case w:case S:return L==k+"";case m:var pe=i;case C:var Se=U&u;if(pe||(pe=l),L.size!=k.size&&!Se)return!1;var Ce=W.get(L);if(Ce)return Ce==k;U|=d,W.set(L,k);var I=a(pe(L),pe(k),U,J,$,W);return W.delete(L),I;case j:if(A)return A.call(L)==A.call(k)}return!1}return oy=D,oy}var ly,iA;function D5(){if(iA)return ly;iA=1;function e(t,n){for(var a=-1,i=n.length,l=t.length;++a<i;)t[l+a]=n[a];return t}return ly=e,ly}var cy,oA;function P5(){if(oA)return cy;oA=1;var e=D5(),t=Sa();function n(a,i,l){var u=i(a);return t(a)?u:e(u,l(a))}return cy=n,cy}var uy,lA;function NQ(){if(lA)return uy;lA=1;function e(t,n){for(var a=-1,i=t==null?0:t.length,l=0,u=[];++a<i;){var d=t[a];n(d,a,t)&&(u[l++]=d)}return u}return uy=e,uy}var dy,cA;function k5(){if(cA)return dy;cA=1;function e(){return[]}return dy=e,dy}var fy,uA;function jS(){if(uA)return fy;uA=1;var e=NQ(),t=k5(),n=Object.prototype,a=n.propertyIsEnumerable,i=Object.getOwnPropertySymbols,l=i?function(u){return u==null?[]:(u=Object(u),e(i(u),function(d){return a.call(u,d)}))}:t;return fy=l,fy}var hy,dA;function L5(){if(dA)return hy;dA=1;var e=P5(),t=jS(),n=cd();function a(i){return e(i,n,t)}return hy=a,hy}var py,fA;function _Q(){if(fA)return py;fA=1;var e=L5(),t=1,n=Object.prototype,a=n.hasOwnProperty;function i(l,u,d,h,p,v){var m=d&t,b=e(l),w=b.length,C=e(u),S=C.length;if(w!=S&&!m)return!1;for(var j=w;j--;){var N=b[j];if(!(m?N in u:a.call(u,N)))return!1}var _=v.get(l),T=v.get(u);if(_&&T)return _==u&&T==l;var A=!0;v.set(l,u),v.set(u,l);for(var D=m;++j<w;){N=b[j];var L=l[N],k=u[N];if(h)var P=m?h(k,L,N,u,l,v):h(L,k,N,l,u,v);if(!(P===void 0?L===k||p(L,k,d,h,v):P)){A=!1;break}D||(D=N=="constructor")}if(A&&!D){var U=l.constructor,J=u.constructor;U!=J&&"constructor"in l&&"constructor"in u&&!(typeof U=="function"&&U instanceof U&&typeof J=="function"&&J instanceof J)&&(A=!1)}return v.delete(l),v.delete(u),A}return py=i,py}var my,hA;function EQ(){if(hA)return my;hA=1;var e=co(),t=Ga(),n=e(t,"DataView");return my=n,my}var gy,pA;function TQ(){if(pA)return gy;pA=1;var e=co(),t=Ga(),n=e(t,"Promise");return gy=n,gy}var vy,mA;function RQ(){if(mA)return vy;mA=1;var e=co(),t=Ga(),n=e(t,"Set");return vy=n,vy}var xy,gA;function AQ(){if(gA)return xy;gA=1;var e=co(),t=Ga(),n=e(t,"WeakMap");return xy=n,xy}var yy,vA;function Op(){if(vA)return yy;vA=1;var e=EQ(),t=wS(),n=TQ(),a=RQ(),i=AQ(),l=lo(),u=A5(),d="[object Map]",h="[object Object]",p="[object Promise]",v="[object Set]",m="[object WeakMap]",b="[object DataView]",w=u(e),C=u(t),S=u(n),j=u(a),N=u(i),_=l;return(e&&_(new e(new ArrayBuffer(1)))!=b||t&&_(new t)!=d||n&&_(n.resolve())!=p||a&&_(new a)!=v||i&&_(new i)!=m)&&(_=function(T){var A=l(T),D=A==h?T.constructor:void 0,L=D?u(D):"";if(L)switch(L){case w:return b;case C:return d;case S:return p;case j:return v;case N:return m}return A}),yy=_,yy}var by,xA;function OQ(){if(xA)return by;xA=1;var e=CS(),t=O5(),n=jQ(),a=_Q(),i=Op(),l=Sa(),u=hS(),d=C5(),h=1,p="[object Arguments]",v="[object Array]",m="[object Object]",b=Object.prototype,w=b.hasOwnProperty;function C(S,j,N,_,T,A){var D=l(S),L=l(j),k=D?v:i(S),P=L?v:i(j);k=k==p?m:k,P=P==p?m:P;var U=k==m,J=P==m,$=k==P;if($&&u(S)){if(!u(j))return!1;D=!0,U=!1}if($&&!U)return A||(A=new e),D||d(S)?t(S,j,N,_,T,A):n(S,j,k,N,_,T,A);if(!(N&h)){var W=U&&w.call(S,"__wrapped__"),pe=J&&w.call(j,"__wrapped__");if(W||pe){var Se=W?S.value():S,Ce=pe?j.value():j;return A||(A=new e),T(Se,Ce,N,_,A)}}return $?(A||(A=new e),a(S,j,N,_,T,A)):!1}return by=C,by}var wy,yA;function B5(){if(yA)return wy;yA=1;var e=OQ(),t=As();function n(a,i,l,u,d){return a===i?!0:a==null||i==null||!t(a)&&!t(i)?a!==a&&i!==i:e(a,i,l,u,n,d)}return wy=n,wy}var Sy,bA;function MQ(){if(bA)return Sy;bA=1;var e=CS(),t=B5(),n=1,a=2;function i(l,u,d,h){var p=d.length,v=p,m=!h;if(l==null)return!v;for(l=Object(l);p--;){var b=d[p];if(m&&b[2]?b[1]!==l[b[0]]:!(b[0]in l))return!1}for(;++p<v;){b=d[p];var w=b[0],C=l[w],S=b[1];if(m&&b[2]){if(C===void 0&&!(w in l))return!1}else{var j=new e;if(h)var N=h(C,S,w,l,u,j);if(!(N===void 0?t(S,C,n|a,h,j):N))return!1}}return!0}return Sy=i,Sy}var Cy,wA;function I5(){if(wA)return Cy;wA=1;var e=Wl();function t(n){return n===n&&!e(n)}return Cy=t,Cy}var jy,SA;function DQ(){if(SA)return jy;SA=1;var e=I5(),t=cd();function n(a){for(var i=t(a),l=i.length;l--;){var u=i[l],d=a[u];i[l]=[u,d,e(d)]}return i}return jy=n,jy}var Ny,CA;function z5(){if(CA)return Ny;CA=1;function e(t,n){return function(a){return a==null?!1:a[t]===n&&(n!==void 0||t in Object(a))}}return Ny=e,Ny}var _y,jA;function PQ(){if(jA)return _y;jA=1;var e=MQ(),t=DQ(),n=z5();function a(i){var l=t(i);return l.length==1&&l[0][2]?n(l[0][0],l[0][1]):function(u){return u===i||e(u,i,l)}}return _y=a,_y}var Ey,NA;function NS(){if(NA)return Ey;NA=1;var e=lo(),t=As(),n="[object Symbol]";function a(i){return typeof i=="symbol"||t(i)&&e(i)==n}return Ey=a,Ey}var Ty,_A;function _S(){if(_A)return Ty;_A=1;var e=Sa(),t=NS(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function i(l,u){if(e(l))return!1;var d=typeof l;return d=="number"||d=="symbol"||d=="boolean"||l==null||t(l)?!0:a.test(l)||!n.test(l)||u!=null&&l in Object(u)}return Ty=i,Ty}var Ry,EA;function kQ(){if(EA)return Ry;EA=1;var e=SS(),t="Expected a function";function n(a,i){if(typeof a!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var l=function(){var u=arguments,d=i?i.apply(this,u):u[0],h=l.cache;if(h.has(d))return h.get(d);var p=a.apply(this,u);return l.cache=h.set(d,p)||h,p};return l.cache=new(n.Cache||e),l}return n.Cache=e,Ry=n,Ry}var Ay,TA;function LQ(){if(TA)return Ay;TA=1;var e=kQ(),t=500;function n(a){var i=e(a,function(u){return l.size===t&&l.clear(),u}),l=i.cache;return i}return Ay=n,Ay}var Oy,RA;function BQ(){if(RA)return Oy;RA=1;var e=LQ(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,a=e(function(i){var l=[];return i.charCodeAt(0)===46&&l.push(""),i.replace(t,function(u,d,h,p){l.push(h?p.replace(n,"$1"):d||u)}),l});return Oy=a,Oy}var My,AA;function IQ(){if(AA)return My;AA=1;var e=ld(),t=R5(),n=Sa(),a=NS(),i=e?e.prototype:void 0,l=i?i.toString:void 0;function u(d){if(typeof d=="string")return d;if(n(d))return t(d,u)+"";if(a(d))return l?l.call(d):"";var h=d+"";return h=="0"&&1/d==-1/0?"-0":h}return My=u,My}var Dy,OA;function zQ(){if(OA)return Dy;OA=1;var e=IQ();function t(n){return n==null?"":e(n)}return Dy=t,Dy}var Py,MA;function F5(){if(MA)return Py;MA=1;var e=Sa(),t=_S(),n=BQ(),a=zQ();function i(l,u){return e(l)?l:t(l,u)?[l]:n(a(l))}return Py=i,Py}var ky,DA;function Mp(){if(DA)return ky;DA=1;var e=NS();function t(n){if(typeof n=="string"||e(n))return n;var a=n+"";return a=="0"&&1/n==-1/0?"-0":a}return ky=t,ky}var Ly,PA;function H5(){if(PA)return Ly;PA=1;var e=F5(),t=Mp();function n(a,i){i=e(i,a);for(var l=0,u=i.length;a!=null&&l<u;)a=a[t(i[l++])];return l&&l==u?a:void 0}return Ly=n,Ly}var By,kA;function FQ(){if(kA)return By;kA=1;var e=H5();function t(n,a,i){var l=n==null?void 0:e(n,a);return l===void 0?i:l}return By=t,By}var Iy,LA;function HQ(){if(LA)return Iy;LA=1;function e(t,n){return t!=null&&n in Object(t)}return Iy=e,Iy}var zy,BA;function UQ(){if(BA)return zy;BA=1;var e=F5(),t=w5(),n=Sa(),a=S5(),i=pS(),l=Mp();function u(d,h,p){h=e(h,d);for(var v=-1,m=h.length,b=!1;++v<m;){var w=l(h[v]);if(!(b=d!=null&&p(d,w)))break;d=d[w]}return b||++v!=m?b:(m=d==null?0:d.length,!!m&&i(m)&&a(w,m)&&(n(d)||t(d)))}return zy=u,zy}var Fy,IA;function qQ(){if(IA)return Fy;IA=1;var e=HQ(),t=UQ();function n(a,i){return a!=null&&t(a,i,e)}return Fy=n,Fy}var Hy,zA;function VQ(){if(zA)return Hy;zA=1;var e=B5(),t=FQ(),n=qQ(),a=_S(),i=I5(),l=z5(),u=Mp(),d=1,h=2;function p(v,m){return a(v)&&i(m)?l(u(v),m):function(b){var w=t(b,v);return w===void 0&&w===m?n(b,v):e(m,w,d|h)}}return Hy=p,Hy}var Uy,FA;function $Q(){if(FA)return Uy;FA=1;function e(t){return function(n){return n?.[t]}}return Uy=e,Uy}var qy,HA;function GQ(){if(HA)return qy;HA=1;var e=H5();function t(n){return function(a){return e(a,n)}}return qy=t,qy}var Vy,UA;function KQ(){if(UA)return Vy;UA=1;var e=$Q(),t=GQ(),n=_S(),a=Mp();function i(l){return n(l)?e(a(l)):t(l)}return Vy=i,Vy}var $y,qA;function YQ(){if(qA)return $y;qA=1;var e=PQ(),t=VQ(),n=T5(),a=Sa(),i=KQ();function l(u){return typeof u=="function"?u:u==null?n:typeof u=="object"?a(u)?t(u[0],u[1]):e(u):i(u)}return $y=l,$y}var Gy,VA;function WQ(){if(VA)return Gy;VA=1;var e=_p();function t(n,a){return function(i,l){if(i==null)return i;if(!e(i))return n(i,l);for(var u=i.length,d=a?u:-1,h=Object(i);(a?d--:++d<u)&&l(h[d],d,h)!==!1;);return i}}return Gy=t,Gy}var Ky,$A;function XQ(){if($A)return Ky;$A=1;var e=E5(),t=WQ(),n=t(e);return Ky=n,Ky}var Yy,GA;function QQ(){if(GA)return Yy;GA=1;var e=XQ(),t=_p();function n(a,i){var l=-1,u=t(a)?Array(a.length):[];return e(a,function(d,h,p){u[++l]=i(d,h,p)}),u}return Yy=n,Yy}var Wy,KA;function ZQ(){if(KA)return Wy;KA=1;var e=R5(),t=YQ(),n=QQ(),a=Sa();function i(l,u){var d=a(l)?e:n;return d(l,t(u,3))}return Wy=i,Wy}var YA;function JQ(){if(YA)return Wo;YA=1,Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.flattenNames=void 0;var e=PX(),t=h(e),n=xS(),a=h(n),i=VX(),l=h(i),u=ZQ(),d=h(u);function h(v){return v&&v.__esModule?v:{default:v}}var p=Wo.flattenNames=function v(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],b=[];return(0,d.default)(m,function(w){Array.isArray(w)?v(w).map(function(C){return b.push(C)}):(0,l.default)(w)?(0,a.default)(w,function(C,S){C===!0&&b.push(S),b.push(S+"-"+C)}):(0,t.default)(w)&&b.push(w)}),b};return Wo.default=p,Wo}var Xo={},Xy,WA;function eZ(){if(WA)return Xy;WA=1;function e(t,n){for(var a=-1,i=t==null?0:t.length;++a<i&&n(t[a],a,t)!==!1;);return t}return Xy=e,Xy}var Qy,XA;function tZ(){if(XA)return Qy;XA=1;var e=co(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return Qy=t,Qy}var Zy,QA;function U5(){if(QA)return Zy;QA=1;var e=tZ();function t(n,a,i){a=="__proto__"&&e?e(n,a,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[a]=i}return Zy=t,Zy}var Jy,ZA;function q5(){if(ZA)return Jy;ZA=1;var e=U5(),t=bS(),n=Object.prototype,a=n.hasOwnProperty;function i(l,u,d){var h=l[u];(!(a.call(l,u)&&t(h,d))||d===void 0&&!(u in l))&&e(l,u,d)}return Jy=i,Jy}var eb,JA;function Dp(){if(JA)return eb;JA=1;var e=q5(),t=U5();function n(a,i,l,u){var d=!l;l||(l={});for(var h=-1,p=i.length;++h<p;){var v=i[h],m=u?u(l[v],a[v],v,l,a):void 0;m===void 0&&(m=a[v]),d?t(l,v,m):e(l,v,m)}return l}return eb=n,eb}var tb,e2;function nZ(){if(e2)return tb;e2=1;var e=Dp(),t=cd();function n(a,i){return a&&e(i,t(i),a)}return tb=n,tb}var nb,t2;function rZ(){if(t2)return nb;t2=1;function e(t){var n=[];if(t!=null)for(var a in Object(t))n.push(a);return n}return nb=e,nb}var rb,n2;function aZ(){if(n2)return rb;n2=1;var e=Wl(),t=vS(),n=rZ(),a=Object.prototype,i=a.hasOwnProperty;function l(u){if(!e(u))return n(u);var d=t(u),h=[];for(var p in u)p=="constructor"&&(d||!i.call(u,p))||h.push(p);return h}return rb=l,rb}var ab,r2;function ES(){if(r2)return ab;r2=1;var e=j5(),t=aZ(),n=_p();function a(i){return n(i)?e(i,!0):t(i)}return ab=a,ab}var sb,a2;function sZ(){if(a2)return sb;a2=1;var e=Dp(),t=ES();function n(a,i){return a&&e(i,t(i),a)}return sb=n,sb}var hu={exports:{}};hu.exports;var s2;function iZ(){return s2||(s2=1,(function(e,t){var n=Ga(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,l=i&&i.exports===a,u=l?n.Buffer:void 0,d=u?u.allocUnsafe:void 0;function h(p,v){if(v)return p.slice();var m=p.length,b=d?d(m):new p.constructor(m);return p.copy(b),b}e.exports=h})(hu,hu.exports)),hu.exports}var ib,i2;function oZ(){if(i2)return ib;i2=1;function e(t,n){var a=-1,i=t.length;for(n||(n=Array(i));++a<i;)n[a]=t[a];return n}return ib=e,ib}var ob,o2;function lZ(){if(o2)return ob;o2=1;var e=Dp(),t=jS();function n(a,i){return e(a,t(a),i)}return ob=n,ob}var lb,l2;function V5(){if(l2)return lb;l2=1;var e=D5(),t=yS(),n=jS(),a=k5(),i=Object.getOwnPropertySymbols,l=i?function(u){for(var d=[];u;)e(d,n(u)),u=t(u);return d}:a;return lb=l,lb}var cb,c2;function cZ(){if(c2)return cb;c2=1;var e=Dp(),t=V5();function n(a,i){return e(a,t(a),i)}return cb=n,cb}var ub,u2;function uZ(){if(u2)return ub;u2=1;var e=P5(),t=V5(),n=ES();function a(i){return e(i,n,t)}return ub=a,ub}var db,d2;function dZ(){if(d2)return db;d2=1;var e=Object.prototype,t=e.hasOwnProperty;function n(a){var i=a.length,l=new a.constructor(i);return i&&typeof a[0]=="string"&&t.call(a,"index")&&(l.index=a.index,l.input=a.input),l}return db=n,db}var fb,f2;function TS(){if(f2)return fb;f2=1;var e=M5();function t(n){var a=new n.constructor(n.byteLength);return new e(a).set(new e(n)),a}return fb=t,fb}var hb,h2;function fZ(){if(h2)return hb;h2=1;var e=TS();function t(n,a){var i=a?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.byteLength)}return hb=t,hb}var pb,p2;function hZ(){if(p2)return pb;p2=1;var e=/\w*$/;function t(n){var a=new n.constructor(n.source,e.exec(n));return a.lastIndex=n.lastIndex,a}return pb=t,pb}var mb,m2;function pZ(){if(m2)return mb;m2=1;var e=ld(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function a(i){return n?Object(n.call(i)):{}}return mb=a,mb}var gb,g2;function mZ(){if(g2)return gb;g2=1;var e=TS();function t(n,a){var i=a?e(n.buffer):n.buffer;return new n.constructor(i,n.byteOffset,n.length)}return gb=t,gb}var vb,v2;function gZ(){if(v2)return vb;v2=1;var e=TS(),t=fZ(),n=hZ(),a=pZ(),i=mZ(),l="[object Boolean]",u="[object Date]",d="[object Map]",h="[object Number]",p="[object RegExp]",v="[object Set]",m="[object String]",b="[object Symbol]",w="[object ArrayBuffer]",C="[object DataView]",S="[object Float32Array]",j="[object Float64Array]",N="[object Int8Array]",_="[object Int16Array]",T="[object Int32Array]",A="[object Uint8Array]",D="[object Uint8ClampedArray]",L="[object Uint16Array]",k="[object Uint32Array]";function P(U,J,$){var W=U.constructor;switch(J){case w:return e(U);case l:case u:return new W(+U);case C:return t(U,$);case S:case j:case N:case _:case T:case A:case D:case L:case k:return i(U,$);case d:return new W;case h:case m:return new W(U);case p:return n(U);case v:return new W;case b:return a(U)}}return vb=P,vb}var xb,x2;function vZ(){if(x2)return xb;x2=1;var e=Wl(),t=Object.create,n=(function(){function a(){}return function(i){if(!e(i))return{};if(t)return t(i);a.prototype=i;var l=new a;return a.prototype=void 0,l}})();return xb=n,xb}var yb,y2;function xZ(){if(y2)return yb;y2=1;var e=vZ(),t=yS(),n=vS();function a(i){return typeof i.constructor=="function"&&!n(i)?e(t(i)):{}}return yb=a,yb}var bb,b2;function yZ(){if(b2)return bb;b2=1;var e=Op(),t=As(),n="[object Map]";function a(i){return t(i)&&e(i)==n}return bb=a,bb}var wb,w2;function bZ(){if(w2)return wb;w2=1;var e=yZ(),t=mS(),n=gS(),a=n&&n.isMap,i=a?t(a):e;return wb=i,wb}var Sb,S2;function wZ(){if(S2)return Sb;S2=1;var e=Op(),t=As(),n="[object Set]";function a(i){return t(i)&&e(i)==n}return Sb=a,Sb}var Cb,C2;function SZ(){if(C2)return Cb;C2=1;var e=wZ(),t=mS(),n=gS(),a=n&&n.isSet,i=a?t(a):e;return Cb=i,Cb}var jb,j2;function CZ(){if(j2)return jb;j2=1;var e=CS(),t=eZ(),n=q5(),a=nZ(),i=sZ(),l=iZ(),u=oZ(),d=lZ(),h=cZ(),p=L5(),v=uZ(),m=Op(),b=dZ(),w=gZ(),C=xZ(),S=Sa(),j=hS(),N=bZ(),_=Wl(),T=SZ(),A=cd(),D=ES(),L=1,k=2,P=4,U="[object Arguments]",J="[object Array]",$="[object Boolean]",W="[object Date]",pe="[object Error]",Se="[object Function]",Ce="[object GeneratorFunction]",I="[object Map]",q="[object Number]",H="[object Object]",be="[object RegExp]",Ne="[object Set]",B="[object String]",G="[object Symbol]",X="[object WeakMap]",oe="[object ArrayBuffer]",xe="[object DataView]",Q="[object Float32Array]",te="[object Float64Array]",he="[object Int8Array]",_e="[object Int16Array]",je="[object Int32Array]",Me="[object Uint8Array]",ce="[object Uint8ClampedArray]",He="[object Uint16Array]",Le="[object Uint32Array]",Ue={};Ue[U]=Ue[J]=Ue[oe]=Ue[xe]=Ue[$]=Ue[W]=Ue[Q]=Ue[te]=Ue[he]=Ue[_e]=Ue[je]=Ue[I]=Ue[q]=Ue[H]=Ue[be]=Ue[Ne]=Ue[B]=Ue[G]=Ue[Me]=Ue[ce]=Ue[He]=Ue[Le]=!0,Ue[pe]=Ue[Se]=Ue[X]=!1;function wt($e,Ot,St,Et,jt,ot){var at,vt=Ot&L,Kt=Ot&k,Yt=Ot&P;if(St&&(at=jt?St($e,Et,jt,ot):St($e)),at!==void 0)return at;if(!_($e))return $e;var Wt=S($e);if(Wt){if(at=b($e),!vt)return u($e,at)}else{var ne=m($e),Re=ne==Se||ne==Ce;if(j($e))return l($e,vt);if(ne==H||ne==U||Re&&!jt){if(at=Kt||Re?{}:C($e),!vt)return Kt?h($e,i(at,$e)):d($e,a(at,$e))}else{if(!Ue[ne])return jt?$e:{};at=w($e,ne,vt)}}ot||(ot=new e);var st=ot.get($e);if(st)return st;ot.set($e,at),T($e)?$e.forEach(function(mt){at.add(wt(mt,Ot,St,mt,$e,ot))}):N($e)&&$e.forEach(function(mt,gt){at.set(gt,wt(mt,Ot,St,gt,$e,ot))});var et=Yt?Kt?v:p:Kt?D:A,xt=Wt?void 0:et($e);return t(xt||$e,function(mt,gt){xt&&(gt=mt,mt=$e[gt]),n(at,gt,wt(mt,Ot,St,gt,$e,ot))}),at}return jb=wt,jb}var Nb,N2;function jZ(){if(N2)return Nb;N2=1;var e=CZ(),t=1,n=4;function a(i){return e(i,t|n)}return Nb=a,Nb}var _2;function NZ(){if(_2)return Xo;_2=1,Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.mergeClasses=void 0;var e=xS(),t=l(e),n=jZ(),a=l(n),i=Object.assign||function(d){for(var h=1;h<arguments.length;h++){var p=arguments[h];for(var v in p)Object.prototype.hasOwnProperty.call(p,v)&&(d[v]=p[v])}return d};function l(d){return d&&d.__esModule?d:{default:d}}var u=Xo.mergeClasses=function(h){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],v=h.default&&(0,a.default)(h.default)||{};return p.map(function(m){var b=h[m];return b&&(0,t.default)(b,function(w,C){v[C]||(v[C]={}),v[C]=i({},v[C],b[C])}),m}),v};return Xo.default=u,Xo}var Qo={},E2;function _Z(){if(E2)return Qo;E2=1,Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.autoprefix=void 0;var e=xS(),t=a(e),n=Object.assign||function(u){for(var d=1;d<arguments.length;d++){var h=arguments[d];for(var p in h)Object.prototype.hasOwnProperty.call(h,p)&&(u[p]=h[p])}return u};function a(u){return u&&u.__esModule?u:{default:u}}var i={borderRadius:function(d){return{msBorderRadius:d,MozBorderRadius:d,OBorderRadius:d,WebkitBorderRadius:d,borderRadius:d}},boxShadow:function(d){return{msBoxShadow:d,MozBoxShadow:d,OBoxShadow:d,WebkitBoxShadow:d,boxShadow:d}},userSelect:function(d){return{WebkitTouchCallout:d,KhtmlUserSelect:d,MozUserSelect:d,msUserSelect:d,WebkitUserSelect:d,userSelect:d}},flex:function(d){return{WebkitBoxFlex:d,MozBoxFlex:d,WebkitFlex:d,msFlex:d,flex:d}},flexBasis:function(d){return{WebkitFlexBasis:d,flexBasis:d}},justifyContent:function(d){return{WebkitJustifyContent:d,justifyContent:d}},transition:function(d){return{msTransition:d,MozTransition:d,OTransition:d,WebkitTransition:d,transition:d}},transform:function(d){return{msTransform:d,MozTransform:d,OTransform:d,WebkitTransform:d,transform:d}},absolute:function(d){var h=d&&d.split(" ");return{position:"absolute",top:h&&h[0],right:h&&h[1],bottom:h&&h[2],left:h&&h[3]}},extend:function(d,h){var p=h[d];return p||{extend:d}}},l=Qo.autoprefix=function(d){var h={};return(0,t.default)(d,function(p,v){var m={};(0,t.default)(p,function(b,w){var C=i[w];C?m=n({},m,C(b)):m[w]=b}),h[v]=m}),h};return Qo.default=l,Qo}var Zo={},T2;function EZ(){if(T2)return Zo;T2=1,Object.defineProperty(Zo,"__esModule",{value:!0}),Zo.hover=void 0;var e=Object.assign||function(h){for(var p=1;p<arguments.length;p++){var v=arguments[p];for(var m in v)Object.prototype.hasOwnProperty.call(v,m)&&(h[m]=v[m])}return h},t=io(),n=a(t);function a(h){return h&&h.__esModule?h:{default:h}}function i(h,p){if(!(h instanceof p))throw new TypeError("Cannot call a class as a function")}function l(h,p){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:h}function u(h,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);h.prototype=Object.create(p&&p.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(h,p):h.__proto__=p)}var d=Zo.hover=function(p){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return(function(m){u(b,m);function b(){var w,C,S,j;i(this,b);for(var N=arguments.length,_=Array(N),T=0;T<N;T++)_[T]=arguments[T];return j=(C=(S=l(this,(w=b.__proto__||Object.getPrototypeOf(b)).call.apply(w,[this].concat(_))),S),S.state={hover:!1},S.handleMouseOver=function(){return S.setState({hover:!0})},S.handleMouseOut=function(){return S.setState({hover:!1})},S.render=function(){return n.default.createElement(v,{onMouseOver:S.handleMouseOver,onMouseOut:S.handleMouseOut},n.default.createElement(p,e({},S.props,S.state)))},C),l(S,j)}return b})(n.default.Component)};return Zo.default=d,Zo}var Jo={},R2;function TZ(){if(R2)return Jo;R2=1,Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.active=void 0;var e=Object.assign||function(h){for(var p=1;p<arguments.length;p++){var v=arguments[p];for(var m in v)Object.prototype.hasOwnProperty.call(v,m)&&(h[m]=v[m])}return h},t=io(),n=a(t);function a(h){return h&&h.__esModule?h:{default:h}}function i(h,p){if(!(h instanceof p))throw new TypeError("Cannot call a class as a function")}function l(h,p){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p&&(typeof p=="object"||typeof p=="function")?p:h}function u(h,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof p);h.prototype=Object.create(p&&p.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),p&&(Object.setPrototypeOf?Object.setPrototypeOf(h,p):h.__proto__=p)}var d=Jo.active=function(p){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return(function(m){u(b,m);function b(){var w,C,S,j;i(this,b);for(var N=arguments.length,_=Array(N),T=0;T<N;T++)_[T]=arguments[T];return j=(C=(S=l(this,(w=b.__proto__||Object.getPrototypeOf(b)).call.apply(w,[this].concat(_))),S),S.state={active:!1},S.handleMouseDown=function(){return S.setState({active:!0})},S.handleMouseUp=function(){return S.setState({active:!1})},S.render=function(){return n.default.createElement(v,{onMouseDown:S.handleMouseDown,onMouseUp:S.handleMouseUp},n.default.createElement(p,e({},S.props,S.state)))},C),l(S,j)}return b})(n.default.Component)};return Jo.default=d,Jo}var Kf={},A2;function RZ(){if(A2)return Kf;A2=1,Object.defineProperty(Kf,"__esModule",{value:!0});var e=function(n,a){var i={},l=function(d){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i[d]=h};return n===0&&l("first-child"),n===a-1&&l("last-child"),(n===0||n%2===0)&&l("even"),Math.abs(n%2)===1&&l("odd"),l("nth-child",n),i};return Kf.default=e,Kf}var O2;function AZ(){if(O2)return hr;O2=1,Object.defineProperty(hr,"__esModule",{value:!0}),hr.ReactCSS=hr.loop=hr.handleActive=hr.handleHover=hr.hover=void 0;var e=JQ(),t=b(e),n=NZ(),a=b(n),i=_Z(),l=b(i),u=EZ(),d=b(u),h=TZ(),p=b(h),v=RZ(),m=b(v);function b(C){return C&&C.__esModule?C:{default:C}}hr.hover=d.default,hr.handleHover=d.default,hr.handleActive=p.default,hr.loop=m.default;var w=hr.ReactCSS=function(S){for(var j=arguments.length,N=Array(j>1?j-1:0),_=1;_<j;_++)N[_-1]=arguments[_];var T=(0,t.default)(N),A=(0,a.default)(S,T);return(0,l.default)(A)};return hr.default=w,hr}var RS=AZ();const ft=Ml(RS);var OZ=function(t,n,a,i,l){var u=l.clientWidth,d=l.clientHeight,h=typeof t.pageX=="number"?t.pageX:t.touches[0].pageX,p=typeof t.pageY=="number"?t.pageY:t.touches[0].pageY,v=h-(l.getBoundingClientRect().left+window.pageXOffset),m=p-(l.getBoundingClientRect().top+window.pageYOffset);if(a==="vertical"){var b=void 0;if(m<0?b=0:m>d?b=1:b=Math.round(m*100/d)/100,n.a!==b)return{h:n.h,s:n.s,l:n.l,a:b,source:"rgb"}}else{var w=void 0;if(v<0?w=0:v>u?w=1:w=Math.round(v*100/u)/100,i!==w)return{h:n.h,s:n.s,l:n.l,a:w,source:"rgb"}}return null},_b={},MZ=function(t,n,a,i){if(typeof document>"u"&&!i)return null;var l=i?new i:document.createElement("canvas");l.width=a*2,l.height=a*2;var u=l.getContext("2d");return u?(u.fillStyle=t,u.fillRect(0,0,l.width,l.height),u.fillStyle=n,u.fillRect(0,0,a,a),u.translate(a,a),u.fillRect(0,0,a,a),l.toDataURL()):null},DZ=function(t,n,a,i){var l=t+"-"+n+"-"+a+(i?"-server":"");if(_b[l])return _b[l];var u=MZ(t,n,a,i);return _b[l]=u,u},M2=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Xl=function(t){var n=t.white,a=t.grey,i=t.size,l=t.renderers,u=t.borderRadius,d=t.boxShadow,h=t.children,p=ft({default:{grid:{borderRadius:u,boxShadow:d,absolute:"0px 0px 0px 0px",background:"url("+DZ(n,a,i,l.canvas)+") center left"}}});return g.isValidElement(h)?R.cloneElement(h,M2({},h.props,{style:M2({},h.props.style,p.grid)})):R.createElement("div",{style:p.grid})};Xl.defaultProps={size:8,white:"transparent",grey:"rgba(0,0,0,.08)",renderers:{}};var PZ=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},kZ=(function(){function e(t,n){for(var a=0;a<n.length;a++){var i=n[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}})();function LZ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D2(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function BZ(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var AS=(function(e){BZ(t,e);function t(){var n,a,i,l;LZ(this,t);for(var u=arguments.length,d=Array(u),h=0;h<u;h++)d[h]=arguments[h];return l=(a=(i=D2(this,(n=t.__proto__||Object.getPrototypeOf(t)).call.apply(n,[this].concat(d))),i),i.handleChange=function(p){var v=OZ(p,i.props.hsl,i.props.direction,i.props.a,i.container);v&&typeof i.props.onChange=="function"&&i.props.onChange(v,p)},i.handleMouseDown=function(p){i.handleChange(p),window.addEventListener("mousemove",i.handleChange),window.addEventListener("mouseup",i.handleMouseUp)},i.handleMouseUp=function(){i.unbindEventListeners()},i.unbindEventListeners=function(){window.removeEventListener("mousemove",i.handleChange),window.removeEventListener("mouseup",i.handleMouseUp)},a),D2(i,l)}return kZ(t,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"render",value:function(){var a=this,i=this.props.rgb,l=ft({default:{alpha:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius},checkboard:{absolute:"0px 0px 0px 0px",overflow:"hidden",borderRadius:this.props.radius},gradient:{absolute:"0px 0px 0px 0px",background:"linear-gradient(to right, rgba("+i.r+","+i.g+","+i.b+`, 0) 0%,
  59. rgba(`+i.r+","+i.g+","+i.b+", 1) 100%)",boxShadow:this.props.shadow,borderRadius:this.props.radius},container:{position:"relative",height:"100%",margin:"0 3px"},pointer:{position:"absolute",left:i.a*100+"%"},slider:{width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",marginTop:"1px",transform:"translateX(-2px)"}},vertical:{gradient:{background:"linear-gradient(to bottom, rgba("+i.r+","+i.g+","+i.b+`, 0) 0%,
  60. rgba(`+i.r+","+i.g+","+i.b+", 1) 100%)"},pointer:{left:0,top:i.a*100+"%"}},overwrite:PZ({},this.props.style)},{vertical:this.props.direction==="vertical",overwrite:!0});return R.createElement("div",{style:l.alpha},R.createElement("div",{style:l.checkboard},R.createElement(Xl,{renderers:this.props.renderers})),R.createElement("div",{style:l.gradient}),R.createElement("div",{style:l.container,ref:function(d){return a.container=d},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},R.createElement("div",{style:l.pointer},this.props.pointer?R.createElement(this.props.pointer,this.props):R.createElement("div",{style:l.slider}))))}}]),t})(g.PureComponent||g.Component),IZ=(function(){function e(t,n){for(var a=0;a<n.length;a++){var i=n[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}})();function zZ(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function FZ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function HZ(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function UZ(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var qZ=1,$5=38,VZ=40,$Z=[$5,VZ],GZ=function(t){return $Z.indexOf(t)>-1},KZ=function(t){return Number(String(t).replace(/%/g,""))},YZ=1,Ut=(function(e){UZ(t,e);function t(n){FZ(this,t);var a=HZ(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.handleBlur=function(){a.state.blurValue&&a.setState({value:a.state.blurValue,blurValue:null})},a.handleChange=function(i){a.setUpdatedValue(i.target.value,i)},a.handleKeyDown=function(i){var l=KZ(i.target.value);if(!isNaN(l)&&GZ(i.keyCode)){var u=a.getArrowOffset(),d=i.keyCode===$5?l+u:l-u;a.setUpdatedValue(d,i)}},a.handleDrag=function(i){if(a.props.dragLabel){var l=Math.round(a.props.value+i.movementX);l>=0&&l<=a.props.dragMax&&a.props.onChange&&a.props.onChange(a.getValueObjectWithLabel(l),i)}},a.handleMouseDown=function(i){a.props.dragLabel&&(i.preventDefault(),a.handleDrag(i),window.addEventListener("mousemove",a.handleDrag),window.addEventListener("mouseup",a.handleMouseUp))},a.handleMouseUp=function(){a.unbindEventListeners()},a.unbindEventListeners=function(){window.removeEventListener("mousemove",a.handleDrag),window.removeEventListener("mouseup",a.handleMouseUp)},a.state={value:String(n.value).toUpperCase(),blurValue:String(n.value).toUpperCase()},a.inputId="rc-editable-input-"+YZ++,a}return IZ(t,[{key:"componentDidUpdate",value:function(a,i){this.props.value!==this.state.value&&(a.value!==this.props.value||i.value!==this.state.value)&&(this.input===document.activeElement?this.setState({blurValue:String(this.props.value).toUpperCase()}):this.setState({value:String(this.props.value).toUpperCase(),blurValue:!this.state.blurValue&&String(this.props.value).toUpperCase()}))}},{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"getValueObjectWithLabel",value:function(a){return zZ({},this.props.label,a)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||qZ}},{key:"setUpdatedValue",value:function(a,i){var l=this.props.label?this.getValueObjectWithLabel(a):a;this.props.onChange&&this.props.onChange(l,i),this.setState({value:a})}},{key:"render",value:function(){var a=this,i=ft({default:{wrap:{position:"relative"}},"user-override":{wrap:this.props.style&&this.props.style.wrap?this.props.style.wrap:{},input:this.props.style&&this.props.style.input?this.props.style.input:{},label:this.props.style&&this.props.style.label?this.props.style.label:{}},"dragLabel-true":{label:{cursor:"ew-resize"}}},{"user-override":!0},this.props);return R.createElement("div",{style:i.wrap},R.createElement("input",{id:this.inputId,style:i.input,ref:function(u){return a.input=u},value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,onBlur:this.handleBlur,placeholder:this.props.placeholder,spellCheck:"false"}),this.props.label&&!this.props.hideLabel?R.createElement("label",{htmlFor:this.inputId,style:i.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),t})(g.PureComponent||g.Component),WZ=function(t,n,a,i){var l=i.clientWidth,u=i.clientHeight,d=typeof t.pageX=="number"?t.pageX:t.touches[0].pageX,h=typeof t.pageY=="number"?t.pageY:t.touches[0].pageY,p=d-(i.getBoundingClientRect().left+window.pageXOffset),v=h-(i.getBoundingClientRect().top+window.pageYOffset);if(n==="vertical"){var m=void 0;if(v<0)m=359;else if(v>u)m=0;else{var b=-(v*100/u)+100;m=360*b/100}if(a.h!==m)return{h:m,s:a.s,l:a.l,a:a.a,source:"hsl"}}else{var w=void 0;if(p<0)w=0;else if(p>l)w=359;else{var C=p*100/l;w=360*C/100}if(a.h!==w)return{h:w,s:a.s,l:a.l,a:a.a,source:"hsl"}}return null},XZ=(function(){function e(t,n){for(var a=0;a<n.length;a++){var i=n[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}})();function QZ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P2(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function ZZ(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var Ql=(function(e){ZZ(t,e);function t(){var n,a,i,l;QZ(this,t);for(var u=arguments.length,d=Array(u),h=0;h<u;h++)d[h]=arguments[h];return l=(a=(i=P2(this,(n=t.__proto__||Object.getPrototypeOf(t)).call.apply(n,[this].concat(d))),i),i.handleChange=function(p){var v=WZ(p,i.props.direction,i.props.hsl,i.container);v&&typeof i.props.onChange=="function"&&i.props.onChange(v,p)},i.handleMouseDown=function(p){i.handleChange(p),window.addEventListener("mousemove",i.handleChange),window.addEventListener("mouseup",i.handleMouseUp)},i.handleMouseUp=function(){i.unbindEventListeners()},a),P2(i,l)}return XZ(t,[{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"unbindEventListeners",value:function(){window.removeEventListener("mousemove",this.handleChange),window.removeEventListener("mouseup",this.handleMouseUp)}},{key:"render",value:function(){var a=this,i=this.props.direction,l=i===void 0?"horizontal":i,u=ft({default:{hue:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius,boxShadow:this.props.shadow},container:{padding:"0 2px",position:"relative",height:"100%",borderRadius:this.props.radius},pointer:{position:"absolute",left:this.props.hsl.h*100/360+"%"},slider:{marginTop:"1px",width:"4px",borderRadius:"1px",height:"8px",boxShadow:"0 0 2px rgba(0, 0, 0, .6)",background:"#fff",transform:"translateX(-2px)"}},vertical:{pointer:{left:"0px",top:-(this.props.hsl.h*100/360)+100+"%"}}},{vertical:l==="vertical"});return R.createElement("div",{style:u.hue},R.createElement("div",{className:"hue-"+l,style:u.container,ref:function(h){return a.container=h},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},R.createElement("style",null,`
  61. .hue-horizontal {
  62. background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0
  63. 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
  64. background: -webkit-linear-gradient(to right, #f00 0%, #ff0
  65. 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
  66. }
  67. .hue-vertical {
  68. background: linear-gradient(to top, #f00 0%, #ff0 17%, #0f0 33%,
  69. #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
  70. background: -webkit-linear-gradient(to top, #f00 0%, #ff0 17%,
  71. #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
  72. }
  73. `),R.createElement("div",{style:u.pointer},this.props.pointer?R.createElement(this.props.pointer,this.props):R.createElement("div",{style:u.slider}))))}}]),t})(g.PureComponent||g.Component),Eb={exports:{}},Tb,k2;function JZ(){if(k2)return Tb;k2=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Tb=e,Tb}var Rb,L2;function eJ(){if(L2)return Rb;L2=1;var e=JZ();function t(){}function n(){}return n.resetWarningCache=t,Rb=function(){function a(u,d,h,p,v,m){if(m!==e){var b=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw b.name="Invariant Violation",b}}a.isRequired=a;function i(){return a}var l={array:a,bigint:a,bool:a,func:a,number:a,object:a,string:a,symbol:a,any:a,arrayOf:i,element:a,elementType:a,instanceOf:i,node:a,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return l.PropTypes=l,l},Rb}var B2;function tJ(){return B2||(B2=1,Eb.exports=eJ()()),Eb.exports}var nJ=tJ();const Ae=Ml(nJ);function rJ(){this.__data__=[],this.size=0}function ud(e,t){return e===t||e!==e&&t!==t}function Pp(e,t){for(var n=e.length;n--;)if(ud(e[n][0],t))return n;return-1}var aJ=Array.prototype,sJ=aJ.splice;function iJ(e){var t=this.__data__,n=Pp(t,e);if(n<0)return!1;var a=t.length-1;return n==a?t.pop():sJ.call(t,n,1),--this.size,!0}function oJ(e){var t=this.__data__,n=Pp(t,e);return n<0?void 0:t[n][1]}function lJ(e){return Pp(this.__data__,e)>-1}function cJ(e,t){var n=this.__data__,a=Pp(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this}function Os(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var a=e[t];this.set(a[0],a[1])}}Os.prototype.clear=rJ;Os.prototype.delete=iJ;Os.prototype.get=oJ;Os.prototype.has=lJ;Os.prototype.set=cJ;function uJ(){this.__data__=new Os,this.size=0}function dJ(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function fJ(e){return this.__data__.get(e)}function hJ(e){return this.__data__.has(e)}var G5=typeof global=="object"&&global&&global.Object===Object&&global,pJ=typeof self=="object"&&self&&self.Object===Object&&self,Ca=G5||pJ||Function("return this")(),wi=Ca.Symbol,K5=Object.prototype,mJ=K5.hasOwnProperty,gJ=K5.toString,su=wi?wi.toStringTag:void 0;function vJ(e){var t=mJ.call(e,su),n=e[su];try{e[su]=void 0;var a=!0}catch{}var i=gJ.call(e);return a&&(t?e[su]=n:delete e[su]),i}var xJ=Object.prototype,yJ=xJ.toString;function bJ(e){return yJ.call(e)}var wJ="[object Null]",SJ="[object Undefined]",I2=wi?wi.toStringTag:void 0;function uo(e){return e==null?e===void 0?SJ:wJ:I2&&I2 in Object(e)?vJ(e):bJ(e)}function Jr(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var CJ="[object AsyncFunction]",jJ="[object Function]",NJ="[object GeneratorFunction]",_J="[object Proxy]";function OS(e){if(!Jr(e))return!1;var t=uo(e);return t==jJ||t==NJ||t==CJ||t==_J}var Ab=Ca["__core-js_shared__"],z2=(function(){var e=/[^.]+$/.exec(Ab&&Ab.keys&&Ab.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function EJ(e){return!!z2&&z2 in e}var TJ=Function.prototype,RJ=TJ.toString;function fo(e){if(e!=null){try{return RJ.call(e)}catch{}try{return e+""}catch{}}return""}var AJ=/[\\^$.*+?()[\]{}|]/g,OJ=/^\[object .+?Constructor\]$/,MJ=Function.prototype,DJ=Object.prototype,PJ=MJ.toString,kJ=DJ.hasOwnProperty,LJ=RegExp("^"+PJ.call(kJ).replace(AJ,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function BJ(e){if(!Jr(e)||EJ(e))return!1;var t=OS(e)?LJ:OJ;return t.test(fo(e))}function IJ(e,t){return e?.[t]}function ho(e,t){var n=IJ(e,t);return BJ(n)?n:void 0}var $u=ho(Ca,"Map"),Gu=ho(Object,"create");function zJ(){this.__data__=Gu?Gu(null):{},this.size=0}function FJ(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var HJ="__lodash_hash_undefined__",UJ=Object.prototype,qJ=UJ.hasOwnProperty;function VJ(e){var t=this.__data__;if(Gu){var n=t[e];return n===HJ?void 0:n}return qJ.call(t,e)?t[e]:void 0}var $J=Object.prototype,GJ=$J.hasOwnProperty;function KJ(e){var t=this.__data__;return Gu?t[e]!==void 0:GJ.call(t,e)}var YJ="__lodash_hash_undefined__";function WJ(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Gu&&t===void 0?YJ:t,this}function so(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var a=e[t];this.set(a[0],a[1])}}so.prototype.clear=zJ;so.prototype.delete=FJ;so.prototype.get=VJ;so.prototype.has=KJ;so.prototype.set=WJ;function XJ(){this.size=0,this.__data__={hash:new so,map:new($u||Os),string:new so}}function QJ(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function kp(e,t){var n=e.__data__;return QJ(t)?n[typeof t=="string"?"string":"hash"]:n.map}function ZJ(e){var t=kp(this,e).delete(e);return this.size-=t?1:0,t}function JJ(e){return kp(this,e).get(e)}function eee(e){return kp(this,e).has(e)}function tee(e,t){var n=kp(this,e),a=n.size;return n.set(e,t),this.size+=n.size==a?0:1,this}function Ms(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var a=e[t];this.set(a[0],a[1])}}Ms.prototype.clear=XJ;Ms.prototype.delete=ZJ;Ms.prototype.get=JJ;Ms.prototype.has=eee;Ms.prototype.set=tee;var nee=200;function ree(e,t){var n=this.__data__;if(n instanceof Os){var a=n.__data__;if(!$u||a.length<nee-1)return a.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ms(a)}return n.set(e,t),this.size=n.size,this}function za(e){var t=this.__data__=new Os(e);this.size=t.size}za.prototype.clear=uJ;za.prototype.delete=dJ;za.prototype.get=fJ;za.prototype.has=hJ;za.prototype.set=ree;var Dh=(function(){try{var e=ho(Object,"defineProperty");return e({},"",{}),e}catch{}})();function MS(e,t,n){t=="__proto__"&&Dh?Dh(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function B0(e,t,n){(n!==void 0&&!ud(e[t],n)||n===void 0&&!(t in e))&&MS(e,t,n)}function aee(e){return function(t,n,a){for(var i=-1,l=Object(t),u=a(t),d=u.length;d--;){var h=u[++i];if(n(l[h],h,l)===!1)break}return t}}var Y5=aee(),W5=typeof Ar=="object"&&Ar&&!Ar.nodeType&&Ar,F2=W5&&typeof Or=="object"&&Or&&!Or.nodeType&&Or,see=F2&&F2.exports===W5,H2=see?Ca.Buffer:void 0;H2&&H2.allocUnsafe;function iee(e,t){return e.slice()}var Ph=Ca.Uint8Array;function oee(e){var t=new e.constructor(e.byteLength);return new Ph(t).set(new Ph(e)),t}function lee(e,t){var n=oee(e.buffer);return new e.constructor(n,e.byteOffset,e.length)}function cee(e,t){var n=-1,a=e.length;for(t||(t=Array(a));++n<a;)t[n]=e[n];return t}var U2=Object.create,uee=(function(){function e(){}return function(t){if(!Jr(t))return{};if(U2)return U2(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}})();function X5(e,t){return function(n){return e(t(n))}}var Q5=X5(Object.getPrototypeOf,Object),dee=Object.prototype;function DS(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||dee;return e===n}function fee(e){return typeof e.constructor=="function"&&!DS(e)?uee(Q5(e)):{}}function Si(e){return e!=null&&typeof e=="object"}var hee="[object Arguments]";function q2(e){return Si(e)&&uo(e)==hee}var Z5=Object.prototype,pee=Z5.hasOwnProperty,mee=Z5.propertyIsEnumerable,kh=q2((function(){return arguments})())?q2:function(e){return Si(e)&&pee.call(e,"callee")&&!mee.call(e,"callee")},kr=Array.isArray,gee=9007199254740991;function PS(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=gee}function Zl(e){return e!=null&&PS(e.length)&&!OS(e)}function vee(e){return Si(e)&&Zl(e)}function xee(){return!1}var J5=typeof Ar=="object"&&Ar&&!Ar.nodeType&&Ar,V2=J5&&typeof Or=="object"&&Or&&!Or.nodeType&&Or,yee=V2&&V2.exports===J5,$2=yee?Ca.Buffer:void 0,bee=$2?$2.isBuffer:void 0,Lh=bee||xee,wee="[object Object]",See=Function.prototype,Cee=Object.prototype,eL=See.toString,jee=Cee.hasOwnProperty,Nee=eL.call(Object);function _ee(e){if(!Si(e)||uo(e)!=wee)return!1;var t=Q5(e);if(t===null)return!0;var n=jee.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&eL.call(n)==Nee}var Eee="[object Arguments]",Tee="[object Array]",Ree="[object Boolean]",Aee="[object Date]",Oee="[object Error]",Mee="[object Function]",Dee="[object Map]",Pee="[object Number]",kee="[object Object]",Lee="[object RegExp]",Bee="[object Set]",Iee="[object String]",zee="[object WeakMap]",Fee="[object ArrayBuffer]",Hee="[object DataView]",Uee="[object Float32Array]",qee="[object Float64Array]",Vee="[object Int8Array]",$ee="[object Int16Array]",Gee="[object Int32Array]",Kee="[object Uint8Array]",Yee="[object Uint8ClampedArray]",Wee="[object Uint16Array]",Xee="[object Uint32Array]",ln={};ln[Uee]=ln[qee]=ln[Vee]=ln[$ee]=ln[Gee]=ln[Kee]=ln[Yee]=ln[Wee]=ln[Xee]=!0;ln[Eee]=ln[Tee]=ln[Fee]=ln[Ree]=ln[Hee]=ln[Aee]=ln[Oee]=ln[Mee]=ln[Dee]=ln[Pee]=ln[kee]=ln[Lee]=ln[Bee]=ln[Iee]=ln[zee]=!1;function Qee(e){return Si(e)&&PS(e.length)&&!!ln[uo(e)]}function Zee(e){return function(t){return e(t)}}var tL=typeof Ar=="object"&&Ar&&!Ar.nodeType&&Ar,_u=tL&&typeof Or=="object"&&Or&&!Or.nodeType&&Or,Jee=_u&&_u.exports===tL,Ob=Jee&&G5.process,G2=(function(){try{var e=_u&&_u.require&&_u.require("util").types;return e||Ob&&Ob.binding&&Ob.binding("util")}catch{}})(),K2=G2&&G2.isTypedArray,kS=K2?Zee(K2):Qee;function I0(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var ete=Object.prototype,tte=ete.hasOwnProperty;function nte(e,t,n){var a=e[t];(!(tte.call(e,t)&&ud(a,n))||n===void 0&&!(t in e))&&MS(e,t,n)}function rte(e,t,n,a){var i=!n;n||(n={});for(var l=-1,u=t.length;++l<u;){var d=t[l],h=void 0;h===void 0&&(h=e[d]),i?MS(n,d,h):nte(n,d,h)}return n}function ate(e,t){for(var n=-1,a=Array(e);++n<e;)a[n]=t(n);return a}var ste=9007199254740991,ite=/^(?:0|[1-9]\d*)$/;function LS(e,t){var n=typeof e;return t=t??ste,!!t&&(n=="number"||n!="symbol"&&ite.test(e))&&e>-1&&e%1==0&&e<t}var ote=Object.prototype,lte=ote.hasOwnProperty;function nL(e,t){var n=kr(e),a=!n&&kh(e),i=!n&&!a&&Lh(e),l=!n&&!a&&!i&&kS(e),u=n||a||i||l,d=u?ate(e.length,String):[],h=d.length;for(var p in e)(t||lte.call(e,p))&&!(u&&(p=="length"||i&&(p=="offset"||p=="parent")||l&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||LS(p,h)))&&d.push(p);return d}function cte(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var ute=Object.prototype,dte=ute.hasOwnProperty;function fte(e){if(!Jr(e))return cte(e);var t=DS(e),n=[];for(var a in e)a=="constructor"&&(t||!dte.call(e,a))||n.push(a);return n}function rL(e){return Zl(e)?nL(e,!0):fte(e)}function hte(e){return rte(e,rL(e))}function pte(e,t,n,a,i,l,u){var d=I0(e,n),h=I0(t,n),p=u.get(h);if(p){B0(e,n,p);return}var v=l?l(d,h,n+"",e,t,u):void 0,m=v===void 0;if(m){var b=kr(h),w=!b&&Lh(h),C=!b&&!w&&kS(h);v=h,b||w||C?kr(d)?v=d:vee(d)?v=cee(d):w?(m=!1,v=iee(h)):C?(m=!1,v=lee(h)):v=[]:_ee(h)||kh(h)?(v=d,kh(d)?v=hte(d):(!Jr(d)||OS(d))&&(v=fee(h))):m=!1}m&&(u.set(h,v),i(v,h,a,l,u),u.delete(h)),B0(e,n,v)}function aL(e,t,n,a,i){e!==t&&Y5(t,function(l,u){if(i||(i=new za),Jr(l))pte(e,t,u,n,aL,a,i);else{var d=a?a(I0(e,u),l,u+"",e,t,i):void 0;d===void 0&&(d=l),B0(e,u,d)}},rL)}function Lp(e){return e}function mte(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var Y2=Math.max;function gte(e,t,n){return t=Y2(t===void 0?e.length-1:t,0),function(){for(var a=arguments,i=-1,l=Y2(a.length-t,0),u=Array(l);++i<l;)u[i]=a[t+i];i=-1;for(var d=Array(t+1);++i<t;)d[i]=a[i];return d[t]=n(u),mte(e,this,d)}}function vte(e){return function(){return e}}var xte=Dh?function(e,t){return Dh(e,"toString",{configurable:!0,enumerable:!1,value:vte(t),writable:!0})}:Lp,yte=800,bte=16,wte=Date.now;function Ste(e){var t=0,n=0;return function(){var a=wte(),i=bte-(a-n);if(n=a,i>0){if(++t>=yte)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Cte=Ste(xte);function jte(e,t){return Cte(gte(e,t,Lp),e+"")}function Nte(e,t,n){if(!Jr(n))return!1;var a=typeof t;return(a=="number"?Zl(n)&&LS(t,n.length):a=="string"&&t in n)?ud(n[t],e):!1}function _te(e){return jte(function(t,n){var a=-1,i=n.length,l=i>1?n[i-1]:void 0,u=i>2?n[2]:void 0;for(l=e.length>3&&typeof l=="function"?(i--,l):void 0,u&&Nte(n[0],n[1],u)&&(l=i<3?void 0:l,i=1),t=Object(t);++a<i;){var d=n[a];d&&e(t,d,a,l)}return t})}var xr=_te(function(e,t,n){aL(e,t,n)}),dd=function(t){var n=t.zDepth,a=t.radius,i=t.background,l=t.children,u=t.styles,d=u===void 0?{}:u,h=ft(xr({default:{wrap:{position:"relative",display:"inline-block"},content:{position:"relative"},bg:{absolute:"0px 0px 0px 0px",boxShadow:"0 "+n+"px "+n*4+"px rgba(0,0,0,.24)",borderRadius:a,background:i}},"zDepth-0":{bg:{boxShadow:"none"}},"zDepth-1":{bg:{boxShadow:"0 2px 10px rgba(0,0,0,.12), 0 2px 5px rgba(0,0,0,.16)"}},"zDepth-2":{bg:{boxShadow:"0 6px 20px rgba(0,0,0,.19), 0 8px 17px rgba(0,0,0,.2)"}},"zDepth-3":{bg:{boxShadow:"0 17px 50px rgba(0,0,0,.19), 0 12px 15px rgba(0,0,0,.24)"}},"zDepth-4":{bg:{boxShadow:"0 25px 55px rgba(0,0,0,.21), 0 16px 28px rgba(0,0,0,.22)"}},"zDepth-5":{bg:{boxShadow:"0 40px 77px rgba(0,0,0,.22), 0 27px 24px rgba(0,0,0,.2)"}},square:{bg:{borderRadius:"0"}},circle:{bg:{borderRadius:"50%"}}},d),{"zDepth-1":n===1});return R.createElement("div",{style:h.wrap},R.createElement("div",{style:h.bg}),R.createElement("div",{style:h.content},l))};dd.propTypes={background:Ae.string,zDepth:Ae.oneOf([0,1,2,3,4,5]),radius:Ae.number,styles:Ae.object};dd.defaultProps={background:"#fff",zDepth:1,radius:2,styles:{}};var Mb=function(){return Ca.Date.now()},Ete=/\s/;function Tte(e){for(var t=e.length;t--&&Ete.test(e.charAt(t)););return t}var Rte=/^\s+/;function Ate(e){return e&&e.slice(0,Tte(e)+1).replace(Rte,"")}var Ote="[object Symbol]";function Bp(e){return typeof e=="symbol"||Si(e)&&uo(e)==Ote}var W2=NaN,Mte=/^[-+]0x[0-9a-f]+$/i,Dte=/^0b[01]+$/i,Pte=/^0o[0-7]+$/i,kte=parseInt;function X2(e){if(typeof e=="number")return e;if(Bp(e))return W2;if(Jr(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Jr(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Ate(e);var n=Dte.test(e);return n||Pte.test(e)?kte(e.slice(2),n?2:8):Mte.test(e)?W2:+e}var Lte="Expected a function",Bte=Math.max,Ite=Math.min;function sL(e,t,n){var a,i,l,u,d,h,p=0,v=!1,m=!1,b=!0;if(typeof e!="function")throw new TypeError(Lte);t=X2(t)||0,Jr(n)&&(v=!!n.leading,m="maxWait"in n,l=m?Bte(X2(n.maxWait)||0,t):l,b="trailing"in n?!!n.trailing:b);function w(L){var k=a,P=i;return a=i=void 0,p=L,u=e.apply(P,k),u}function C(L){return p=L,d=setTimeout(N,t),v?w(L):u}function S(L){var k=L-h,P=L-p,U=t-k;return m?Ite(U,l-P):U}function j(L){var k=L-h,P=L-p;return h===void 0||k>=t||k<0||m&&P>=l}function N(){var L=Mb();if(j(L))return _(L);d=setTimeout(N,S(L))}function _(L){return d=void 0,b&&a?w(L):(a=i=void 0,u)}function T(){d!==void 0&&clearTimeout(d),p=0,a=h=i=d=void 0}function A(){return d===void 0?u:_(Mb())}function D(){var L=Mb(),k=j(L);if(a=arguments,i=this,h=L,k){if(d===void 0)return C(h);if(m)return clearTimeout(d),d=setTimeout(N,t),w(h)}return d===void 0&&(d=setTimeout(N,t)),u}return D.cancel=T,D.flush=A,D}var zte="Expected a function";function Fte(e,t,n){var a=!0,i=!0;if(typeof e!="function")throw new TypeError(zte);return Jr(n)&&(a="leading"in n?!!n.leading:a,i="trailing"in n?!!n.trailing:i),sL(e,t,{leading:a,maxWait:t,trailing:i})}var Hte=function(t,n,a){var i=a.getBoundingClientRect(),l=i.width,u=i.height,d=typeof t.pageX=="number"?t.pageX:t.touches[0].pageX,h=typeof t.pageY=="number"?t.pageY:t.touches[0].pageY,p=d-(a.getBoundingClientRect().left+window.pageXOffset),v=h-(a.getBoundingClientRect().top+window.pageYOffset);p<0?p=0:p>l&&(p=l),v<0?v=0:v>u&&(v=u);var m=p/l,b=1-v/u;return{h:n.h,s:m,v:b,a:n.a,source:"hsv"}},Ute=(function(){function e(t,n){for(var a=0;a<n.length;a++){var i=n[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}})();function qte(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vte(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function $te(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var Ip=(function(e){$te(t,e);function t(n){qte(this,t);var a=Vte(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,n));return a.handleChange=function(i){typeof a.props.onChange=="function"&&a.throttle(a.props.onChange,Hte(i,a.props.hsl,a.container),i)},a.handleMouseDown=function(i){a.handleChange(i);var l=a.getContainerRenderWindow();l.addEventListener("mousemove",a.handleChange),l.addEventListener("mouseup",a.handleMouseUp)},a.handleMouseUp=function(){a.unbindEventListeners()},a.throttle=Fte(function(i,l,u){i(l,u)},50),a}return Ute(t,[{key:"componentWillUnmount",value:function(){this.throttle.cancel(),this.unbindEventListeners()}},{key:"getContainerRenderWindow",value:function(){for(var a=this.container,i=window;!i.document.contains(a)&&i.parent!==i;)i=i.parent;return i}},{key:"unbindEventListeners",value:function(){var a=this.getContainerRenderWindow();a.removeEventListener("mousemove",this.handleChange),a.removeEventListener("mouseup",this.handleMouseUp)}},{key:"render",value:function(){var a=this,i=this.props.style||{},l=i.color,u=i.white,d=i.black,h=i.pointer,p=i.circle,v=ft({default:{color:{absolute:"0px 0px 0px 0px",background:"hsl("+this.props.hsl.h+",100%, 50%)",borderRadius:this.props.radius},white:{absolute:"0px 0px 0px 0px",borderRadius:this.props.radius},black:{absolute:"0px 0px 0px 0px",boxShadow:this.props.shadow,borderRadius:this.props.radius},pointer:{position:"absolute",top:-(this.props.hsv.v*100)+100+"%",left:this.props.hsv.s*100+"%",cursor:"default"},circle:{width:"4px",height:"4px",boxShadow:`0 0 0 1.5px #fff, inset 0 0 1px 1px rgba(0,0,0,.3),
  74. 0 0 1px 2px rgba(0,0,0,.4)`,borderRadius:"50%",cursor:"hand",transform:"translate(-2px, -2px)"}},custom:{color:l,white:u,black:d,pointer:h,circle:p}},{custom:!!this.props.style});return R.createElement("div",{style:v.color,ref:function(b){return a.container=b},onMouseDown:this.handleMouseDown,onTouchMove:this.handleChange,onTouchStart:this.handleChange},R.createElement("style",null,`
  75. .saturation-white {
  76. background: -webkit-linear-gradient(to right, #fff, rgba(255,255,255,0));
  77. background: linear-gradient(to right, #fff, rgba(255,255,255,0));
  78. }
  79. .saturation-black {
  80. background: -webkit-linear-gradient(to top, #000, rgba(0,0,0,0));
  81. background: linear-gradient(to top, #000, rgba(0,0,0,0));
  82. }
  83. `),R.createElement("div",{style:v.white,className:"saturation-white"},R.createElement("div",{style:v.black,className:"saturation-black"}),R.createElement("div",{style:v.pointer},this.props.pointer?R.createElement(this.props.pointer,this.props):R.createElement("div",{style:v.circle}))))}}]),t})(g.PureComponent||g.Component);function Gte(e,t){for(var n=-1,a=e==null?0:e.length;++n<a&&t(e[n],n,e)!==!1;);return e}var Kte=X5(Object.keys,Object),Yte=Object.prototype,Wte=Yte.hasOwnProperty;function Xte(e){if(!DS(e))return Kte(e);var t=[];for(var n in Object(e))Wte.call(e,n)&&n!="constructor"&&t.push(n);return t}function BS(e){return Zl(e)?nL(e):Xte(e)}function Qte(e,t){return e&&Y5(e,t,BS)}function Zte(e,t){return function(n,a){if(n==null)return n;if(!Zl(n))return e(n,a);for(var i=n.length,l=-1,u=Object(n);++l<i&&a(u[l],l,u)!==!1;);return n}}var iL=Zte(Qte);function Jte(e){return typeof e=="function"?e:Lp}function ene(e,t){var n=kr(e)?Gte:iL;return n(e,Jte(t))}function Bh(e){"@babel/helpers - typeof";return Bh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bh(e)}var tne=/^\s+/,nne=/\s+$/;function We(e,t){if(e=e||"",t=t||{},e instanceof We)return e;if(!(this instanceof We))return new We(e,t);var n=rne(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}We.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),n,a,i,l,u,d;return n=t.r/255,a=t.g/255,i=t.b/255,n<=.03928?l=n/12.92:l=Math.pow((n+.055)/1.055,2.4),a<=.03928?u=a/12.92:u=Math.pow((a+.055)/1.055,2.4),i<=.03928?d=i/12.92:d=Math.pow((i+.055)/1.055,2.4),.2126*l+.7152*u+.0722*d},setAlpha:function(t){return this._a=oL(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=Z2(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=Z2(this._r,this._g,this._b),n=Math.round(t.h*360),a=Math.round(t.s*100),i=Math.round(t.v*100);return this._a==1?"hsv("+n+", "+a+"%, "+i+"%)":"hsva("+n+", "+a+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var t=Q2(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=Q2(this._r,this._g,this._b),n=Math.round(t.h*360),a=Math.round(t.s*100),i=Math.round(t.l*100);return this._a==1?"hsl("+n+", "+a+"%, "+i+"%)":"hsla("+n+", "+a+"%, "+i+"%, "+this._roundA+")"},toHex:function(t){return J2(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return one(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(dn(this._r,255)*100)+"%",g:Math.round(dn(this._g,255)*100)+"%",b:Math.round(dn(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(dn(this._r,255)*100)+"%, "+Math.round(dn(this._g,255)*100)+"%, "+Math.round(dn(this._b,255)*100)+"%)":"rgba("+Math.round(dn(this._r,255)*100)+"%, "+Math.round(dn(this._g,255)*100)+"%, "+Math.round(dn(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:yne[J2(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var n="#"+eO(this._r,this._g,this._b,this._a),a=n,i=this._gradientType?"GradientType = 1, ":"";if(t){var l=We(t);a="#"+eO(l._r,l._g,l._b,l._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+n+",endColorstr="+a+")"},toString:function(t){var n=!!t;t=t||this._format;var a=!1,i=this._a<1&&this._a>=0,l=!n&&i&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return l?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(a=this.toRgbString()),t==="prgb"&&(a=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(a=this.toHexString()),t==="hex3"&&(a=this.toHexString(!0)),t==="hex4"&&(a=this.toHex8String(!0)),t==="hex8"&&(a=this.toHex8String()),t==="name"&&(a=this.toName()),t==="hsl"&&(a=this.toHslString()),t==="hsv"&&(a=this.toHsvString()),a||this.toHexString())},clone:function(){return We(this.toString())},_applyModification:function(t,n){var a=t.apply(null,[this].concat([].slice.call(n)));return this._r=a._r,this._g=a._g,this._b=a._b,this.setAlpha(a._a),this},lighten:function(){return this._applyModification(dne,arguments)},brighten:function(){return this._applyModification(fne,arguments)},darken:function(){return this._applyModification(hne,arguments)},desaturate:function(){return this._applyModification(lne,arguments)},saturate:function(){return this._applyModification(cne,arguments)},greyscale:function(){return this._applyModification(une,arguments)},spin:function(){return this._applyModification(pne,arguments)},_applyCombination:function(t,n){return t.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(vne,arguments)},complement:function(){return this._applyCombination(mne,arguments)},monochromatic:function(){return this._applyCombination(xne,arguments)},splitcomplement:function(){return this._applyCombination(gne,arguments)},triad:function(){return this._applyCombination(tO,[3])},tetrad:function(){return this._applyCombination(tO,[4])}};We.fromRatio=function(e,t){if(Bh(e)=="object"){var n={};for(var a in e)e.hasOwnProperty(a)&&(a==="a"?n[a]=e[a]:n[a]=pu(e[a]));e=n}return We(e,t)};function rne(e){var t={r:0,g:0,b:0},n=1,a=null,i=null,l=null,u=!1,d=!1;return typeof e=="string"&&(e=Cne(e)),Bh(e)=="object"&&(xs(e.r)&&xs(e.g)&&xs(e.b)?(t=ane(e.r,e.g,e.b),u=!0,d=String(e.r).substr(-1)==="%"?"prgb":"rgb"):xs(e.h)&&xs(e.s)&&xs(e.v)?(a=pu(e.s),i=pu(e.v),t=ine(e.h,a,i),u=!0,d="hsv"):xs(e.h)&&xs(e.s)&&xs(e.l)&&(a=pu(e.s),l=pu(e.l),t=sne(e.h,a,l),u=!0,d="hsl"),e.hasOwnProperty("a")&&(n=e.a)),n=oL(n),{ok:u,format:e.format||d,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}function ane(e,t,n){return{r:dn(e,255)*255,g:dn(t,255)*255,b:dn(n,255)*255}}function Q2(e,t,n){e=dn(e,255),t=dn(t,255),n=dn(n,255);var a=Math.max(e,t,n),i=Math.min(e,t,n),l,u,d=(a+i)/2;if(a==i)l=u=0;else{var h=a-i;switch(u=d>.5?h/(2-a-i):h/(a+i),a){case e:l=(t-n)/h+(t<n?6:0);break;case t:l=(n-e)/h+2;break;case n:l=(e-t)/h+4;break}l/=6}return{h:l,s:u,l:d}}function sne(e,t,n){var a,i,l;e=dn(e,360),t=dn(t,100),n=dn(n,100);function u(p,v,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?p+(v-p)*6*m:m<1/2?v:m<2/3?p+(v-p)*(2/3-m)*6:p}if(t===0)a=i=l=n;else{var d=n<.5?n*(1+t):n+t-n*t,h=2*n-d;a=u(h,d,e+1/3),i=u(h,d,e),l=u(h,d,e-1/3)}return{r:a*255,g:i*255,b:l*255}}function Z2(e,t,n){e=dn(e,255),t=dn(t,255),n=dn(n,255);var a=Math.max(e,t,n),i=Math.min(e,t,n),l,u,d=a,h=a-i;if(u=a===0?0:h/a,a==i)l=0;else{switch(a){case e:l=(t-n)/h+(t<n?6:0);break;case t:l=(n-e)/h+2;break;case n:l=(e-t)/h+4;break}l/=6}return{h:l,s:u,v:d}}function ine(e,t,n){e=dn(e,360)*6,t=dn(t,100),n=dn(n,100);var a=Math.floor(e),i=e-a,l=n*(1-t),u=n*(1-i*t),d=n*(1-(1-i)*t),h=a%6,p=[n,u,l,l,d,n][h],v=[d,n,n,u,l,l][h],m=[l,l,d,n,n,u][h];return{r:p*255,g:v*255,b:m*255}}function J2(e,t,n,a){var i=[pa(Math.round(e).toString(16)),pa(Math.round(t).toString(16)),pa(Math.round(n).toString(16))];return a&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function one(e,t,n,a,i){var l=[pa(Math.round(e).toString(16)),pa(Math.round(t).toString(16)),pa(Math.round(n).toString(16)),pa(lL(a))];return i&&l[0].charAt(0)==l[0].charAt(1)&&l[1].charAt(0)==l[1].charAt(1)&&l[2].charAt(0)==l[2].charAt(1)&&l[3].charAt(0)==l[3].charAt(1)?l[0].charAt(0)+l[1].charAt(0)+l[2].charAt(0)+l[3].charAt(0):l.join("")}function eO(e,t,n,a){var i=[pa(lL(a)),pa(Math.round(e).toString(16)),pa(Math.round(t).toString(16)),pa(Math.round(n).toString(16))];return i.join("")}We.equals=function(e,t){return!e||!t?!1:We(e).toRgbString()==We(t).toRgbString()};We.random=function(){return We.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function lne(e,t){t=t===0?0:t||10;var n=We(e).toHsl();return n.s-=t/100,n.s=zp(n.s),We(n)}function cne(e,t){t=t===0?0:t||10;var n=We(e).toHsl();return n.s+=t/100,n.s=zp(n.s),We(n)}function une(e){return We(e).desaturate(100)}function dne(e,t){t=t===0?0:t||10;var n=We(e).toHsl();return n.l+=t/100,n.l=zp(n.l),We(n)}function fne(e,t){t=t===0?0:t||10;var n=We(e).toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),We(n)}function hne(e,t){t=t===0?0:t||10;var n=We(e).toHsl();return n.l-=t/100,n.l=zp(n.l),We(n)}function pne(e,t){var n=We(e).toHsl(),a=(n.h+t)%360;return n.h=a<0?360+a:a,We(n)}function mne(e){var t=We(e).toHsl();return t.h=(t.h+180)%360,We(t)}function tO(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var n=We(e).toHsl(),a=[We(e)],i=360/t,l=1;l<t;l++)a.push(We({h:(n.h+l*i)%360,s:n.s,l:n.l}));return a}function gne(e){var t=We(e).toHsl(),n=t.h;return[We(e),We({h:(n+72)%360,s:t.s,l:t.l}),We({h:(n+216)%360,s:t.s,l:t.l})]}function vne(e,t,n){t=t||6,n=n||30;var a=We(e).toHsl(),i=360/n,l=[We(e)];for(a.h=(a.h-(i*t>>1)+720)%360;--t;)a.h=(a.h+i)%360,l.push(We(a));return l}function xne(e,t){t=t||6;for(var n=We(e).toHsv(),a=n.h,i=n.s,l=n.v,u=[],d=1/t;t--;)u.push(We({h:a,s:i,v:l})),l=(l+d)%1;return u}We.mix=function(e,t,n){n=n===0?0:n||50;var a=We(e).toRgb(),i=We(t).toRgb(),l=n/100,u={r:(i.r-a.r)*l+a.r,g:(i.g-a.g)*l+a.g,b:(i.b-a.b)*l+a.b,a:(i.a-a.a)*l+a.a};return We(u)};We.readability=function(e,t){var n=We(e),a=We(t);return(Math.max(n.getLuminance(),a.getLuminance())+.05)/(Math.min(n.getLuminance(),a.getLuminance())+.05)};We.isReadable=function(e,t,n){var a=We.readability(e,t),i,l;switch(l=!1,i=jne(n),i.level+i.size){case"AAsmall":case"AAAlarge":l=a>=4.5;break;case"AAlarge":l=a>=3;break;case"AAAsmall":l=a>=7;break}return l};We.mostReadable=function(e,t,n){var a=null,i=0,l,u,d,h;n=n||{},u=n.includeFallbackColors,d=n.level,h=n.size;for(var p=0;p<t.length;p++)l=We.readability(e,t[p]),l>i&&(i=l,a=We(t[p]));return We.isReadable(e,a,{level:d,size:h})||!u?a:(n.includeFallbackColors=!1,We.mostReadable(e,["#fff","#000"],n))};var z0=We.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},yne=We.hexNames=bne(z0);function bne(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function oL(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function dn(e,t){wne(e)&&(e="100%");var n=Sne(e);return e=Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function zp(e){return Math.min(1,Math.max(0,e))}function Er(e){return parseInt(e,16)}function wne(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function Sne(e){return typeof e=="string"&&e.indexOf("%")!=-1}function pa(e){return e.length==1?"0"+e:""+e}function pu(e){return e<=1&&(e=e*100+"%"),e}function lL(e){return Math.round(parseFloat(e)*255).toString(16)}function nO(e){return Er(e)/255}var ia=(function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",n="(?:"+t+")|(?:"+e+")",a="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",i="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+a),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+a),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+a),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function xs(e){return!!ia.CSS_UNIT.exec(e)}function Cne(e){e=e.replace(tne,"").replace(nne,"").toLowerCase();var t=!1;if(z0[e])e=z0[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=ia.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=ia.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=ia.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=ia.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=ia.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=ia.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=ia.hex8.exec(e))?{r:Er(n[1]),g:Er(n[2]),b:Er(n[3]),a:nO(n[4]),format:t?"name":"hex8"}:(n=ia.hex6.exec(e))?{r:Er(n[1]),g:Er(n[2]),b:Er(n[3]),format:t?"name":"hex"}:(n=ia.hex4.exec(e))?{r:Er(n[1]+""+n[1]),g:Er(n[2]+""+n[2]),b:Er(n[3]+""+n[3]),a:nO(n[4]+""+n[4]),format:t?"name":"hex8"}:(n=ia.hex3.exec(e))?{r:Er(n[1]+""+n[1]),g:Er(n[2]+""+n[2]),b:Er(n[3]+""+n[3]),format:t?"name":"hex"}:!1}function jne(e){var t,n;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),n=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),n!=="small"&&n!=="large"&&(n="small"),{level:t,size:n}}var rO=function(t){var n=["r","g","b","a","h","s","l","v"],a=0,i=0;return ene(n,function(l){if(t[l]&&(a+=1,isNaN(t[l])||(i+=1),l==="s"||l==="l")){var u=/^\d+%$/;u.test(t[l])&&(i+=1)}}),a===i?t:!1},mu=function(t,n){var a=t.hex?We(t.hex):We(t),i=a.toHsl(),l=a.toHsv(),u=a.toRgb(),d=a.toHex();i.s===0&&(i.h=n||0,l.h=n||0);var h=d==="000000"&&u.a===0;return{hsl:i,hex:h?"transparent":"#"+d,rgb:u,hsv:l,oldHue:t.h||n||i.h,source:t.source}},Ei=function(t){if(t==="transparent")return!0;var n=String(t).charAt(0)==="#"?1:0;return t.length!==4+n&&t.length<7+n&&We(t).isValid()},IS=function(t){if(!t)return"#fff";var n=mu(t);if(n.hex==="transparent")return"rgba(0,0,0,0.4)";var a=(n.rgb.r*299+n.rgb.g*587+n.rgb.b*114)/1e3;return a>=128?"#000":"#fff"},Db=function(t,n){var a=t.replace("°","");return We(n+" ("+a+")")._ok},iu=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Nne=(function(){function e(t,n){for(var a=0;a<n.length;a++){var i=n[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}})();function _ne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ene(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function Tne(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var yr=function(t){var n=(function(a){Tne(i,a);function i(l){_ne(this,i);var u=Ene(this,(i.__proto__||Object.getPrototypeOf(i)).call(this));return u.handleChange=function(d,h){var p=rO(d);if(p){var v=mu(d,d.h||u.state.oldHue);u.setState(v),u.props.onChangeComplete&&u.debounce(u.props.onChangeComplete,v,h),u.props.onChange&&u.props.onChange(v,h)}},u.handleSwatchHover=function(d,h){var p=rO(d);if(p){var v=mu(d,d.h||u.state.oldHue);u.props.onSwatchHover&&u.props.onSwatchHover(v,h)}},u.state=iu({},mu(l.color,0)),u.debounce=sL(function(d,h,p){d(h,p)},100),u}return Nne(i,[{key:"render",value:function(){var u={};return this.props.onSwatchHover&&(u.onSwatchHover=this.handleSwatchHover),R.createElement(t,iu({},this.props,this.state,{onChange:this.handleChange},u))}}],[{key:"getDerivedStateFromProps",value:function(u,d){return iu({},mu(u.color,d.oldHue))}}]),i})(g.PureComponent||g.Component);return n.propTypes=iu({},t.propTypes),n.defaultProps=iu({},t.defaultProps,{color:{h:250,s:.5,l:.2,a:1}}),n},Rne=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Ane=(function(){function e(t,n){for(var a=0;a<n.length;a++){var i=n[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}})();function One(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function aO(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function Mne(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var Dne=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"span";return(function(a){Mne(i,a);function i(){var l,u,d,h;One(this,i);for(var p=arguments.length,v=Array(p),m=0;m<p;m++)v[m]=arguments[m];return h=(u=(d=aO(this,(l=i.__proto__||Object.getPrototypeOf(i)).call.apply(l,[this].concat(v))),d),d.state={focus:!1},d.handleFocus=function(){return d.setState({focus:!0})},d.handleBlur=function(){return d.setState({focus:!1})},u),aO(d,h)}return Ane(i,[{key:"render",value:function(){return R.createElement(n,{onFocus:this.handleFocus,onBlur:this.handleBlur},R.createElement(t,Rne({},this.props,this.state)))}}]),i})(R.Component)},sO=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Pne=13,kne=function(t){var n=t.color,a=t.style,i=t.onClick,l=i===void 0?function(){}:i,u=t.onHover,d=t.title,h=d===void 0?n:d,p=t.children,v=t.focus,m=t.focusStyle,b=m===void 0?{}:m,w=n==="transparent",C=ft({default:{swatch:sO({background:n,height:"100%",width:"100%",cursor:"pointer",position:"relative",outline:"none"},a,v?b:{})}}),S=function(A){return l(n,A)},j=function(A){return A.keyCode===Pne&&l(n,A)},N=function(A){return u(n,A)},_={};return u&&(_.onMouseOver=N),R.createElement("div",sO({style:C.swatch,onClick:S,title:h,tabIndex:0,onKeyDown:j},_),p,w&&R.createElement(Xl,{borderRadius:C.swatch.borderRadius,boxShadow:"inset 0 0 0 1px rgba(0,0,0,0.1)"}))};const po=Dne(kne);var Lne=function(t){var n=t.direction,a=ft({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:n==="vertical"});return R.createElement("div",{style:a.picker})},Bne=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},cL=function(t){var n=t.rgb,a=t.hsl,i=t.width,l=t.height,u=t.onChange,d=t.direction,h=t.style,p=t.renderers,v=t.pointer,m=t.className,b=m===void 0?"":m,w=ft({default:{picker:{position:"relative",width:i,height:l},alpha:{radius:"2px",style:h}}});return R.createElement("div",{style:w.picker,className:"alpha-picker "+b},R.createElement(AS,Bne({},w.alpha,{rgb:n,hsl:a,pointer:v,renderers:p,onChange:u,direction:d})))};cL.defaultProps={width:"316px",height:"16px",direction:"horizontal",pointer:Lne};yr(cL);function uL(e,t){for(var n=-1,a=e==null?0:e.length,i=Array(a);++n<a;)i[n]=t(e[n],n,e);return i}var Ine="__lodash_hash_undefined__";function zne(e){return this.__data__.set(e,Ine),this}function Fne(e){return this.__data__.has(e)}function Ih(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Ms;++t<n;)this.add(e[t])}Ih.prototype.add=Ih.prototype.push=zne;Ih.prototype.has=Fne;function Hne(e,t){for(var n=-1,a=e==null?0:e.length;++n<a;)if(t(e[n],n,e))return!0;return!1}function Une(e,t){return e.has(t)}var qne=1,Vne=2;function dL(e,t,n,a,i,l){var u=n&qne,d=e.length,h=t.length;if(d!=h&&!(u&&h>d))return!1;var p=l.get(e),v=l.get(t);if(p&&v)return p==t&&v==e;var m=-1,b=!0,w=n&Vne?new Ih:void 0;for(l.set(e,t),l.set(t,e);++m<d;){var C=e[m],S=t[m];if(a)var j=u?a(S,C,m,t,e,l):a(C,S,m,e,t,l);if(j!==void 0){if(j)continue;b=!1;break}if(w){if(!Hne(t,function(N,_){if(!Une(w,_)&&(C===N||i(C,N,n,a,l)))return w.push(_)})){b=!1;break}}else if(!(C===S||i(C,S,n,a,l))){b=!1;break}}return l.delete(e),l.delete(t),b}function $ne(e){var t=-1,n=Array(e.size);return e.forEach(function(a,i){n[++t]=[i,a]}),n}function Gne(e){var t=-1,n=Array(e.size);return e.forEach(function(a){n[++t]=a}),n}var Kne=1,Yne=2,Wne="[object Boolean]",Xne="[object Date]",Qne="[object Error]",Zne="[object Map]",Jne="[object Number]",ere="[object RegExp]",tre="[object Set]",nre="[object String]",rre="[object Symbol]",are="[object ArrayBuffer]",sre="[object DataView]",iO=wi?wi.prototype:void 0,Pb=iO?iO.valueOf:void 0;function ire(e,t,n,a,i,l,u){switch(n){case sre:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case are:return!(e.byteLength!=t.byteLength||!l(new Ph(e),new Ph(t)));case Wne:case Xne:case Jne:return ud(+e,+t);case Qne:return e.name==t.name&&e.message==t.message;case ere:case nre:return e==t+"";case Zne:var d=$ne;case tre:var h=a&Kne;if(d||(d=Gne),e.size!=t.size&&!h)return!1;var p=u.get(e);if(p)return p==t;a|=Yne,u.set(e,t);var v=dL(d(e),d(t),a,i,l,u);return u.delete(e),v;case rre:if(Pb)return Pb.call(e)==Pb.call(t)}return!1}function ore(e,t){for(var n=-1,a=t.length,i=e.length;++n<a;)e[i+n]=t[n];return e}function lre(e,t,n){var a=t(e);return kr(e)?a:ore(a,n(e))}function cre(e,t){for(var n=-1,a=e==null?0:e.length,i=0,l=[];++n<a;){var u=e[n];t(u,n,e)&&(l[i++]=u)}return l}function ure(){return[]}var dre=Object.prototype,fre=dre.propertyIsEnumerable,oO=Object.getOwnPropertySymbols,hre=oO?function(e){return e==null?[]:(e=Object(e),cre(oO(e),function(t){return fre.call(e,t)}))}:ure;function lO(e){return lre(e,BS,hre)}var pre=1,mre=Object.prototype,gre=mre.hasOwnProperty;function vre(e,t,n,a,i,l){var u=n&pre,d=lO(e),h=d.length,p=lO(t),v=p.length;if(h!=v&&!u)return!1;for(var m=h;m--;){var b=d[m];if(!(u?b in t:gre.call(t,b)))return!1}var w=l.get(e),C=l.get(t);if(w&&C)return w==t&&C==e;var S=!0;l.set(e,t),l.set(t,e);for(var j=u;++m<h;){b=d[m];var N=e[b],_=t[b];if(a)var T=u?a(_,N,b,t,e,l):a(N,_,b,e,t,l);if(!(T===void 0?N===_||i(N,_,n,a,l):T)){S=!1;break}j||(j=b=="constructor")}if(S&&!j){var A=e.constructor,D=t.constructor;A!=D&&"constructor"in e&&"constructor"in t&&!(typeof A=="function"&&A instanceof A&&typeof D=="function"&&D instanceof D)&&(S=!1)}return l.delete(e),l.delete(t),S}var F0=ho(Ca,"DataView"),H0=ho(Ca,"Promise"),U0=ho(Ca,"Set"),q0=ho(Ca,"WeakMap"),cO="[object Map]",xre="[object Object]",uO="[object Promise]",dO="[object Set]",fO="[object WeakMap]",hO="[object DataView]",yre=fo(F0),bre=fo($u),wre=fo(H0),Sre=fo(U0),Cre=fo(q0),fi=uo;(F0&&fi(new F0(new ArrayBuffer(1)))!=hO||$u&&fi(new $u)!=cO||H0&&fi(H0.resolve())!=uO||U0&&fi(new U0)!=dO||q0&&fi(new q0)!=fO)&&(fi=function(e){var t=uo(e),n=t==xre?e.constructor:void 0,a=n?fo(n):"";if(a)switch(a){case yre:return hO;case bre:return cO;case wre:return uO;case Sre:return dO;case Cre:return fO}return t});var jre=1,pO="[object Arguments]",mO="[object Array]",Yf="[object Object]",Nre=Object.prototype,gO=Nre.hasOwnProperty;function _re(e,t,n,a,i,l){var u=kr(e),d=kr(t),h=u?mO:fi(e),p=d?mO:fi(t);h=h==pO?Yf:h,p=p==pO?Yf:p;var v=h==Yf,m=p==Yf,b=h==p;if(b&&Lh(e)){if(!Lh(t))return!1;u=!0,v=!1}if(b&&!v)return l||(l=new za),u||kS(e)?dL(e,t,n,a,i,l):ire(e,t,h,n,a,i,l);if(!(n&jre)){var w=v&&gO.call(e,"__wrapped__"),C=m&&gO.call(t,"__wrapped__");if(w||C){var S=w?e.value():e,j=C?t.value():t;return l||(l=new za),i(S,j,n,a,l)}}return b?(l||(l=new za),vre(e,t,n,a,i,l)):!1}function zS(e,t,n,a,i){return e===t?!0:e==null||t==null||!Si(e)&&!Si(t)?e!==e&&t!==t:_re(e,t,n,a,zS,i)}var Ere=1,Tre=2;function Rre(e,t,n,a){var i=n.length,l=i;if(e==null)return!l;for(e=Object(e);i--;){var u=n[i];if(u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++i<l;){u=n[i];var d=u[0],h=e[d],p=u[1];if(u[2]){if(h===void 0&&!(d in e))return!1}else{var v=new za,m;if(!(m===void 0?zS(p,h,Ere|Tre,a,v):m))return!1}}return!0}function fL(e){return e===e&&!Jr(e)}function Are(e){for(var t=BS(e),n=t.length;n--;){var a=t[n],i=e[a];t[n]=[a,i,fL(i)]}return t}function hL(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function Ore(e){var t=Are(e);return t.length==1&&t[0][2]?hL(t[0][0],t[0][1]):function(n){return n===e||Rre(n,e,t)}}var Mre=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Dre=/^\w*$/;function FS(e,t){if(kr(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Bp(e)?!0:Dre.test(e)||!Mre.test(e)||t!=null&&e in Object(t)}var Pre="Expected a function";function HS(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Pre);var n=function(){var a=arguments,i=t?t.apply(this,a):a[0],l=n.cache;if(l.has(i))return l.get(i);var u=e.apply(this,a);return n.cache=l.set(i,u)||l,u};return n.cache=new(HS.Cache||Ms),n}HS.Cache=Ms;var kre=500;function Lre(e){var t=HS(e,function(a){return n.size===kre&&n.clear(),a}),n=t.cache;return t}var Bre=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ire=/\\(\\)?/g,zre=Lre(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Bre,function(n,a,i,l){t.push(i?l.replace(Ire,"$1"):a||n)}),t}),vO=wi?wi.prototype:void 0,xO=vO?vO.toString:void 0;function pL(e){if(typeof e=="string")return e;if(kr(e))return uL(e,pL)+"";if(Bp(e))return xO?xO.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Fre(e){return e==null?"":pL(e)}function mL(e,t){return kr(e)?e:FS(e,t)?[e]:zre(Fre(e))}function Fp(e){if(typeof e=="string"||Bp(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function gL(e,t){t=mL(t,e);for(var n=0,a=t.length;e!=null&&n<a;)e=e[Fp(t[n++])];return n&&n==a?e:void 0}function Hre(e,t,n){var a=e==null?void 0:gL(e,t);return a===void 0?n:a}function Ure(e,t){return e!=null&&t in Object(e)}function qre(e,t,n){t=mL(t,e);for(var a=-1,i=t.length,l=!1;++a<i;){var u=Fp(t[a]);if(!(l=e!=null&&n(e,u)))break;e=e[u]}return l||++a!=i?l:(i=e==null?0:e.length,!!i&&PS(i)&&LS(u,i)&&(kr(e)||kh(e)))}function Vre(e,t){return e!=null&&qre(e,t,Ure)}var $re=1,Gre=2;function Kre(e,t){return FS(e)&&fL(t)?hL(Fp(e),t):function(n){var a=Hre(n,e);return a===void 0&&a===t?Vre(n,e):zS(t,a,$re|Gre)}}function Yre(e){return function(t){return t?.[e]}}function Wre(e){return function(t){return gL(t,e)}}function Xre(e){return FS(e)?Yre(Fp(e)):Wre(e)}function Qre(e){return typeof e=="function"?e:e==null?Lp:typeof e=="object"?kr(e)?Kre(e[0],e[1]):Ore(e):Xre(e)}function Zre(e,t){var n=-1,a=Zl(e)?Array(e.length):[];return iL(e,function(i,l,u){a[++n]=t(i,l,u)}),a}function mo(e,t){var n=kr(e)?uL:Zre;return n(e,Qre(t))}var Jre=function(t){var n=t.colors,a=t.onClick,i=t.onSwatchHover,l=ft({default:{swatches:{marginRight:"-10px"},swatch:{width:"22px",height:"22px",float:"left",marginRight:"10px",marginBottom:"10px",borderRadius:"4px"},clear:{clear:"both"}}});return R.createElement("div",{style:l.swatches},mo(n,function(u){return R.createElement(po,{key:u,color:u,style:l.swatch,onClick:a,onHover:i,focusStyle:{boxShadow:"0 0 4px "+u}})}),R.createElement("div",{style:l.clear}))},US=function(t){var n=t.onChange,a=t.onSwatchHover,i=t.hex,l=t.colors,u=t.width,d=t.triangle,h=t.styles,p=h===void 0?{}:h,v=t.className,m=v===void 0?"":v,b=i==="transparent",w=function(j,N){Ei(j)&&n({hex:j,source:"hex"},N)},C=ft(xr({default:{card:{width:u,background:"#fff",boxShadow:"0 1px rgba(0,0,0,.1)",borderRadius:"6px",position:"relative"},head:{height:"110px",background:i,borderRadius:"6px 6px 0 0",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"},body:{padding:"10px"},label:{fontSize:"18px",color:IS(i),position:"relative"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 10px 10px 10px",borderColor:"transparent transparent "+i+" transparent",position:"absolute",top:"-10px",left:"50%",marginLeft:"-10px"},input:{width:"100%",fontSize:"12px",color:"#666",border:"0px",outline:"none",height:"22px",boxShadow:"inset 0 0 0 1px #ddd",borderRadius:"4px",padding:"0 7px",boxSizing:"border-box"}},"hide-triangle":{triangle:{display:"none"}}},p),{"hide-triangle":d==="hide"});return R.createElement("div",{style:C.card,className:"block-picker "+m},R.createElement("div",{style:C.triangle}),R.createElement("div",{style:C.head},b&&R.createElement(Xl,{borderRadius:"6px 6px 0 0"}),R.createElement("div",{style:C.label},i)),R.createElement("div",{style:C.body},R.createElement(Jre,{colors:l,onClick:w,onSwatchHover:a}),R.createElement(Ut,{style:{input:C.input},value:i,onChange:w})))};US.propTypes={width:Ae.oneOfType([Ae.string,Ae.number]),colors:Ae.arrayOf(Ae.string),triangle:Ae.oneOf(["top","hide"]),styles:Ae.object};US.defaultProps={width:170,colors:["#D9E3F0","#F47373","#697689","#37D67A","#2CCCE4","#555555","#dce775","#ff8a65","#ba68c8"],triangle:"top",styles:{}};yr(US);var tl={100:"#ffcdd2",300:"#e57373",500:"#f44336",700:"#d32f2f",900:"#b71c1c"},nl={100:"#f8bbd0",300:"#f06292",500:"#e91e63",700:"#c2185b",900:"#880e4f"},rl={100:"#e1bee7",300:"#ba68c8",500:"#9c27b0",700:"#7b1fa2",900:"#4a148c"},al={100:"#d1c4e9",300:"#9575cd",500:"#673ab7",700:"#512da8",900:"#311b92"},sl={100:"#c5cae9",300:"#7986cb",500:"#3f51b5",700:"#303f9f",900:"#1a237e"},il={100:"#bbdefb",300:"#64b5f6",500:"#2196f3",700:"#1976d2",900:"#0d47a1"},ol={100:"#b3e5fc",300:"#4fc3f7",500:"#03a9f4",700:"#0288d1",900:"#01579b"},ll={100:"#b2ebf2",300:"#4dd0e1",500:"#00bcd4",700:"#0097a7",900:"#006064"},cl={100:"#b2dfdb",300:"#4db6ac",500:"#009688",700:"#00796b",900:"#004d40"},gu={100:"#c8e6c9",300:"#81c784",500:"#4caf50",700:"#388e3c"},ul={100:"#dcedc8",300:"#aed581",500:"#8bc34a",700:"#689f38",900:"#33691e"},dl={100:"#f0f4c3",300:"#dce775",500:"#cddc39",700:"#afb42b",900:"#827717"},fl={100:"#fff9c4",300:"#fff176",500:"#ffeb3b",700:"#fbc02d",900:"#f57f17"},hl={100:"#ffecb3",300:"#ffd54f",500:"#ffc107",700:"#ffa000",900:"#ff6f00"},pl={100:"#ffe0b2",300:"#ffb74d",500:"#ff9800",700:"#f57c00",900:"#e65100"},ml={100:"#ffccbc",300:"#ff8a65",500:"#ff5722",700:"#e64a19",900:"#bf360c"},gl={100:"#d7ccc8",300:"#a1887f",500:"#795548",700:"#5d4037",900:"#3e2723"},vl={100:"#cfd8dc",300:"#90a4ae",500:"#607d8b",700:"#455a64",900:"#263238"},vL=function(t){var n=t.color,a=t.onClick,i=t.onSwatchHover,l=t.hover,u=t.active,d=t.circleSize,h=t.circleSpacing,p=ft({default:{swatch:{width:d,height:d,marginRight:h,marginBottom:h,transform:"scale(1)",transition:"100ms transform ease"},Swatch:{borderRadius:"50%",background:"transparent",boxShadow:"inset 0 0 0 "+(d/2+1)+"px "+n,transition:"100ms box-shadow ease"}},hover:{swatch:{transform:"scale(1.2)"}},active:{Swatch:{boxShadow:"inset 0 0 0 3px "+n}}},{hover:l,active:u});return R.createElement("div",{style:p.swatch},R.createElement(po,{style:p.Swatch,color:n,onClick:a,onHover:i,focusStyle:{boxShadow:p.Swatch.boxShadow+", 0 0 5px "+n}}))};vL.defaultProps={circleSize:28,circleSpacing:14};const eae=RS.handleHover(vL);var qS=function(t){var n=t.width,a=t.onChange,i=t.onSwatchHover,l=t.colors,u=t.hex,d=t.circleSize,h=t.styles,p=h===void 0?{}:h,v=t.circleSpacing,m=t.className,b=m===void 0?"":m,w=ft(xr({default:{card:{width:n,display:"flex",flexWrap:"wrap",marginRight:-v,marginBottom:-v}}},p)),C=function(j,N){return a({hex:j,source:"hex"},N)};return R.createElement("div",{style:w.card,className:"circle-picker "+b},mo(l,function(S){return R.createElement(eae,{key:S,color:S,onClick:C,onSwatchHover:i,active:u===S.toLowerCase(),circleSize:d,circleSpacing:v})}))};qS.propTypes={width:Ae.oneOfType([Ae.string,Ae.number]),circleSize:Ae.number,circleSpacing:Ae.number,styles:Ae.object};qS.defaultProps={width:252,circleSize:28,circleSpacing:14,colors:[tl[500],nl[500],rl[500],al[500],sl[500],il[500],ol[500],ll[500],cl[500],gu[500],ul[500],dl[500],fl[500],hl[500],pl[500],ml[500],gl[500],vl[500]],styles:{}};yr(qS);function yO(e){return e===void 0}var Wf={},bO;function tae(){if(bO)return Wf;bO=1,Object.defineProperty(Wf,"__esModule",{value:!0});var e=Object.assign||function(u){for(var d=1;d<arguments.length;d++){var h=arguments[d];for(var p in h)Object.prototype.hasOwnProperty.call(h,p)&&(u[p]=h[p])}return u},t=io(),n=a(t);function a(u){return u&&u.__esModule?u:{default:u}}function i(u,d){var h={};for(var p in u)d.indexOf(p)>=0||Object.prototype.hasOwnProperty.call(u,p)&&(h[p]=u[p]);return h}var l=24;return Wf.default=function(u){var d=u.fill,h=d===void 0?"currentColor":d,p=u.width,v=p===void 0?l:p,m=u.height,b=m===void 0?l:m,w=u.style,C=w===void 0?{}:w,S=i(u,["fill","width","height","style"]);return n.default.createElement("svg",e({viewBox:"0 0 "+l+" "+l,style:e({fill:h,width:v,height:b},C)},S),n.default.createElement("path",{d:"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}))},Wf}var nae=tae();const rae=Ml(nae);var aae=(function(){function e(t,n){for(var a=0;a<n.length;a++){var i=n[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}})();function sae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function iae(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function oae(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var xL=(function(e){oae(t,e);function t(n){sae(this,t);var a=iae(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.toggleViews=function(){a.state.view==="hex"?a.setState({view:"rgb"}):a.state.view==="rgb"?a.setState({view:"hsl"}):a.state.view==="hsl"&&(a.props.hsl.a===1?a.setState({view:"hex"}):a.setState({view:"rgb"}))},a.handleChange=function(i,l){i.hex?Ei(i.hex)&&a.props.onChange({hex:i.hex,source:"hex"},l):i.r||i.g||i.b?a.props.onChange({r:i.r||a.props.rgb.r,g:i.g||a.props.rgb.g,b:i.b||a.props.rgb.b,source:"rgb"},l):i.a?(i.a<0?i.a=0:i.a>1&&(i.a=1),a.props.onChange({h:a.props.hsl.h,s:a.props.hsl.s,l:a.props.hsl.l,a:Math.round(i.a*100)/100,source:"rgb"},l)):(i.h||i.s||i.l)&&(typeof i.s=="string"&&i.s.includes("%")&&(i.s=i.s.replace("%","")),typeof i.l=="string"&&i.l.includes("%")&&(i.l=i.l.replace("%","")),i.s==1?i.s=.01:i.l==1&&(i.l=.01),a.props.onChange({h:i.h||a.props.hsl.h,s:Number(yO(i.s)?a.props.hsl.s:i.s),l:Number(yO(i.l)?a.props.hsl.l:i.l),source:"hsl"},l))},a.showHighlight=function(i){i.currentTarget.style.background="#eee"},a.hideHighlight=function(i){i.currentTarget.style.background="transparent"},n.hsl.a!==1&&n.view==="hex"?a.state={view:"rgb"}:a.state={view:n.view},a}return aae(t,[{key:"render",value:function(){var a=this,i=ft({default:{wrap:{paddingTop:"16px",display:"flex"},fields:{flex:"1",display:"flex",marginLeft:"-6px"},field:{paddingLeft:"6px",width:"100%"},alpha:{paddingLeft:"6px",width:"100%"},toggle:{width:"32px",textAlign:"right",position:"relative"},icon:{marginRight:"-4px",marginTop:"12px",cursor:"pointer",position:"relative"},iconHighlight:{position:"absolute",width:"24px",height:"28px",background:"#eee",borderRadius:"4px",top:"10px",left:"12px",display:"none"},input:{fontSize:"11px",color:"#333",width:"100%",borderRadius:"2px",border:"none",boxShadow:"inset 0 0 0 1px #dadada",height:"21px",textAlign:"center"},label:{textTransform:"uppercase",fontSize:"11px",lineHeight:"11px",color:"#969696",textAlign:"center",display:"block",marginTop:"12px"},svg:{fill:"#333",width:"24px",height:"24px",border:"1px transparent solid",borderRadius:"5px"}},disableAlpha:{alpha:{display:"none"}}},this.props,this.state),l=void 0;return this.state.view==="hex"?l=R.createElement("div",{style:i.fields,className:"flexbox-fix"},R.createElement("div",{style:i.field},R.createElement(Ut,{style:{input:i.input,label:i.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?l=R.createElement("div",{style:i.fields,className:"flexbox-fix"},R.createElement("div",{style:i.field},R.createElement(Ut,{style:{input:i.input,label:i.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),R.createElement("div",{style:i.field},R.createElement(Ut,{style:{input:i.input,label:i.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),R.createElement("div",{style:i.field},R.createElement(Ut,{style:{input:i.input,label:i.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),R.createElement("div",{style:i.alpha},R.createElement(Ut,{style:{input:i.input,label:i.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(l=R.createElement("div",{style:i.fields,className:"flexbox-fix"},R.createElement("div",{style:i.field},R.createElement(Ut,{style:{input:i.input,label:i.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),R.createElement("div",{style:i.field},R.createElement(Ut,{style:{input:i.input,label:i.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),R.createElement("div",{style:i.field},R.createElement(Ut,{style:{input:i.input,label:i.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),R.createElement("div",{style:i.alpha},R.createElement(Ut,{style:{input:i.input,label:i.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),R.createElement("div",{style:i.wrap,className:"flexbox-fix"},l,R.createElement("div",{style:i.toggle},R.createElement("div",{style:i.icon,onClick:this.toggleViews,ref:function(d){return a.icon=d}},R.createElement(rae,{style:i.svg,onMouseOver:this.showHighlight,onMouseEnter:this.showHighlight,onMouseOut:this.hideHighlight}))))}}],[{key:"getDerivedStateFromProps",value:function(a,i){return a.hsl.a!==1&&i.view==="hex"?{view:"rgb"}:null}}]),t})(R.Component);xL.defaultProps={view:"hex"};var wO=function(){var t=ft({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",transform:"translate(-6px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return R.createElement("div",{style:t.picker})},lae=function(){var t=ft({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return R.createElement("div",{style:t.picker})},VS=function(t){var n=t.width,a=t.onChange,i=t.disableAlpha,l=t.rgb,u=t.hsl,d=t.hsv,h=t.hex,p=t.renderers,v=t.styles,m=v===void 0?{}:v,b=t.className,w=b===void 0?"":b,C=t.defaultView,S=ft(xr({default:{picker:{width:n,background:"#fff",borderRadius:"2px",boxShadow:"0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",boxSizing:"initial",fontFamily:"Menlo"},saturation:{width:"100%",paddingBottom:"55%",position:"relative",borderRadius:"2px 2px 0 0",overflow:"hidden"},Saturation:{radius:"2px 2px 0 0"},body:{padding:"16px 16px 12px"},controls:{display:"flex"},color:{width:"32px"},swatch:{marginTop:"6px",width:"16px",height:"16px",borderRadius:"8px",position:"relative",overflow:"hidden"},active:{absolute:"0px 0px 0px 0px",borderRadius:"8px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",background:"rgba("+l.r+", "+l.g+", "+l.b+", "+l.a+")",zIndex:"2"},toggles:{flex:"1"},hue:{height:"10px",position:"relative",marginBottom:"8px"},Hue:{radius:"2px"},alpha:{height:"10px",position:"relative"},Alpha:{radius:"2px"}},disableAlpha:{color:{width:"22px"},alpha:{display:"none"},hue:{marginBottom:"0px"},swatch:{width:"10px",height:"10px",marginTop:"0px"}}},m),{disableAlpha:i});return R.createElement("div",{style:S.picker,className:"chrome-picker "+w},R.createElement("div",{style:S.saturation},R.createElement(Ip,{style:S.Saturation,hsl:u,hsv:d,pointer:lae,onChange:a})),R.createElement("div",{style:S.body},R.createElement("div",{style:S.controls,className:"flexbox-fix"},R.createElement("div",{style:S.color},R.createElement("div",{style:S.swatch},R.createElement("div",{style:S.active}),R.createElement(Xl,{renderers:p}))),R.createElement("div",{style:S.toggles},R.createElement("div",{style:S.hue},R.createElement(Ql,{style:S.Hue,hsl:u,pointer:wO,onChange:a})),R.createElement("div",{style:S.alpha},R.createElement(AS,{style:S.Alpha,rgb:l,hsl:u,pointer:wO,renderers:p,onChange:a})))),R.createElement(xL,{rgb:l,hsl:u,hex:h,view:C,onChange:a,disableAlpha:i})))};VS.propTypes={width:Ae.oneOfType([Ae.string,Ae.number]),disableAlpha:Ae.bool,styles:Ae.object,defaultView:Ae.oneOf(["hex","rgb","hsl"])};VS.defaultProps={width:225,disableAlpha:!1,styles:{}};yr(VS);var cae=function(t){var n=t.color,a=t.onClick,i=a===void 0?function(){}:a,l=t.onSwatchHover,u=t.active,d=ft({default:{color:{background:n,width:"15px",height:"15px",float:"left",marginRight:"5px",marginBottom:"5px",position:"relative",cursor:"pointer"},dot:{absolute:"5px 5px 5px 5px",background:IS(n),borderRadius:"50%",opacity:"0"}},active:{dot:{opacity:"1"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},dot:{background:"#000"}},transparent:{dot:{background:"#000"}}},{active:u,"color-#FFFFFF":n==="#FFFFFF",transparent:n==="transparent"});return R.createElement(po,{style:d.color,color:n,onClick:i,onHover:l,focusStyle:{boxShadow:"0 0 4px "+n}},R.createElement("div",{style:d.dot}))},uae=function(t){var n=t.hex,a=t.rgb,i=t.onChange,l=ft({default:{fields:{display:"flex",paddingBottom:"6px",paddingRight:"5px",position:"relative"},active:{position:"absolute",top:"6px",left:"5px",height:"9px",width:"9px",background:n},HEXwrap:{flex:"6",position:"relative"},HEXinput:{width:"80%",padding:"0px",paddingLeft:"20%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},HEXlabel:{display:"none"},RGBwrap:{flex:"3",position:"relative"},RGBinput:{width:"70%",padding:"0px",paddingLeft:"30%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},RGBlabel:{position:"absolute",top:"3px",left:"0px",lineHeight:"16px",textTransform:"uppercase",fontSize:"12px",color:"#999"}}}),u=function(h,p){h.r||h.g||h.b?i({r:h.r||a.r,g:h.g||a.g,b:h.b||a.b,source:"rgb"},p):i({hex:h.hex,source:"hex"},p)};return R.createElement("div",{style:l.fields,className:"flexbox-fix"},R.createElement("div",{style:l.active}),R.createElement(Ut,{style:{wrap:l.HEXwrap,input:l.HEXinput,label:l.HEXlabel},label:"hex",value:n,onChange:u}),R.createElement(Ut,{style:{wrap:l.RGBwrap,input:l.RGBinput,label:l.RGBlabel},label:"r",value:a.r,onChange:u}),R.createElement(Ut,{style:{wrap:l.RGBwrap,input:l.RGBinput,label:l.RGBlabel},label:"g",value:a.g,onChange:u}),R.createElement(Ut,{style:{wrap:l.RGBwrap,input:l.RGBinput,label:l.RGBlabel},label:"b",value:a.b,onChange:u}))},$S=function(t){var n=t.onChange,a=t.onSwatchHover,i=t.colors,l=t.hex,u=t.rgb,d=t.styles,h=d===void 0?{}:d,p=t.className,v=p===void 0?"":p,m=ft(xr({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},h)),b=function(C,S){C.hex?Ei(C.hex)&&n({hex:C.hex,source:"hex"},S):n(C,S)};return R.createElement(dd,{style:m.Compact,styles:h},R.createElement("div",{style:m.compact,className:"compact-picker "+v},R.createElement("div",null,mo(i,function(w){return R.createElement(cae,{key:w,color:w,active:w.toLowerCase()===l,onClick:b,onSwatchHover:a})}),R.createElement("div",{style:m.clear})),R.createElement(uae,{hex:l,rgb:u,onChange:b})))};$S.propTypes={colors:Ae.arrayOf(Ae.string),styles:Ae.object};$S.defaultProps={colors:["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"],styles:{}};yr($S);var dae=function(t){var n=t.hover,a=t.color,i=t.onClick,l=t.onSwatchHover,u={position:"relative",zIndex:"2",outline:"2px solid #fff",boxShadow:"0 0 5px 2px rgba(0,0,0,0.25)"},d=ft({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:u}},{hover:n});return R.createElement("div",{style:d.swatch},R.createElement(po,{color:a,onClick:i,onHover:l,focusStyle:u}))};const fae=RS.handleHover(dae);var GS=function(t){var n=t.width,a=t.colors,i=t.onChange,l=t.onSwatchHover,u=t.triangle,d=t.styles,h=d===void 0?{}:d,p=t.className,v=p===void 0?"":p,m=ft(xr({default:{card:{width:n,background:"#fff",border:"1px solid rgba(0,0,0,0.2)",boxShadow:"0 3px 12px rgba(0,0,0,0.15)",borderRadius:"4px",position:"relative",padding:"5px",display:"flex",flexWrap:"wrap"},triangle:{position:"absolute",border:"7px solid transparent",borderBottomColor:"#fff"},triangleShadow:{position:"absolute",border:"8px solid transparent",borderBottomColor:"rgba(0,0,0,0.15)"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-14px",left:"10px"},triangleShadow:{top:"-16px",left:"9px"}},"top-right-triangle":{triangle:{top:"-14px",right:"10px"},triangleShadow:{top:"-16px",right:"9px"}},"bottom-left-triangle":{triangle:{top:"35px",left:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",left:"9px",transform:"rotate(180deg)"}},"bottom-right-triangle":{triangle:{top:"35px",right:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",right:"9px",transform:"rotate(180deg)"}}},h),{"hide-triangle":u==="hide","top-left-triangle":u==="top-left","top-right-triangle":u==="top-right","bottom-left-triangle":u==="bottom-left","bottom-right-triangle":u==="bottom-right"}),b=function(C,S){return i({hex:C,source:"hex"},S)};return R.createElement("div",{style:m.card,className:"github-picker "+v},R.createElement("div",{style:m.triangleShadow}),R.createElement("div",{style:m.triangle}),mo(a,function(w){return R.createElement(fae,{color:w,key:w,onClick:b,onSwatchHover:l})}))};GS.propTypes={width:Ae.oneOfType([Ae.string,Ae.number]),colors:Ae.arrayOf(Ae.string),triangle:Ae.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:Ae.object};GS.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};yr(GS);var hae=function(t){var n=t.direction,a=ft({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:n==="vertical"});return R.createElement("div",{style:a.picker})},pae=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},KS=function(t){var n=t.width,a=t.height,i=t.onChange,l=t.hsl,u=t.direction,d=t.pointer,h=t.styles,p=h===void 0?{}:h,v=t.className,m=v===void 0?"":v,b=ft(xr({default:{picker:{position:"relative",width:n,height:a},hue:{radius:"2px"}}},p)),w=function(S){return i({a:1,h:S.h,l:.5,s:1})};return R.createElement("div",{style:b.picker,className:"hue-picker "+m},R.createElement(Ql,pae({},b.hue,{hsl:l,pointer:d,onChange:w,direction:u})))};KS.propTypes={styles:Ae.object};KS.defaultProps={width:"316px",height:"16px",direction:"horizontal",pointer:hae,styles:{}};yr(KS);var mae=function(t){var n=t.onChange,a=t.hex,i=t.rgb,l=t.styles,u=l===void 0?{}:l,d=t.className,h=d===void 0?"":d,p=ft(xr({default:{material:{width:"98px",height:"98px",padding:"16px",fontFamily:"Roboto"},HEXwrap:{position:"relative"},HEXinput:{width:"100%",marginTop:"12px",fontSize:"15px",color:"#333",padding:"0px",border:"0px",borderBottom:"2px solid "+a,outline:"none",height:"30px"},HEXlabel:{position:"absolute",top:"0px",left:"0px",fontSize:"11px",color:"#999999",textTransform:"capitalize"},Hex:{style:{}},RGBwrap:{position:"relative"},RGBinput:{width:"100%",marginTop:"12px",fontSize:"15px",color:"#333",padding:"0px",border:"0px",borderBottom:"1px solid #eee",outline:"none",height:"30px"},RGBlabel:{position:"absolute",top:"0px",left:"0px",fontSize:"11px",color:"#999999",textTransform:"capitalize"},split:{display:"flex",marginRight:"-10px",paddingTop:"11px"},third:{flex:"1",paddingRight:"10px"}}},u)),v=function(b,w){b.hex?Ei(b.hex)&&n({hex:b.hex,source:"hex"},w):(b.r||b.g||b.b)&&n({r:b.r||i.r,g:b.g||i.g,b:b.b||i.b,source:"rgb"},w)};return R.createElement(dd,{styles:u},R.createElement("div",{style:p.material,className:"material-picker "+h},R.createElement(Ut,{style:{wrap:p.HEXwrap,input:p.HEXinput,label:p.HEXlabel},label:"hex",value:a,onChange:v}),R.createElement("div",{style:p.split,className:"flexbox-fix"},R.createElement("div",{style:p.third},R.createElement(Ut,{style:{wrap:p.RGBwrap,input:p.RGBinput,label:p.RGBlabel},label:"r",value:i.r,onChange:v})),R.createElement("div",{style:p.third},R.createElement(Ut,{style:{wrap:p.RGBwrap,input:p.RGBinput,label:p.RGBlabel},label:"g",value:i.g,onChange:v})),R.createElement("div",{style:p.third},R.createElement(Ut,{style:{wrap:p.RGBwrap,input:p.RGBinput,label:p.RGBlabel},label:"b",value:i.b,onChange:v})))))};yr(mae);var gae=function(t){var n=t.onChange,a=t.rgb,i=t.hsv,l=t.hex,u=ft({default:{fields:{paddingTop:"5px",paddingBottom:"9px",width:"80px",position:"relative"},divider:{height:"5px"},RGBwrap:{position:"relative"},RGBinput:{marginLeft:"40%",width:"40%",height:"18px",border:"1px solid #888888",boxShadow:"inset 0 1px 1px rgba(0,0,0,.1), 0 1px 0 0 #ECECEC",marginBottom:"5px",fontSize:"13px",paddingLeft:"3px",marginRight:"10px"},RGBlabel:{left:"0px",top:"0px",width:"34px",textTransform:"uppercase",fontSize:"13px",height:"18px",lineHeight:"22px",position:"absolute"},HEXwrap:{position:"relative"},HEXinput:{marginLeft:"20%",width:"80%",height:"18px",border:"1px solid #888888",boxShadow:"inset 0 1px 1px rgba(0,0,0,.1), 0 1px 0 0 #ECECEC",marginBottom:"6px",fontSize:"13px",paddingLeft:"3px"},HEXlabel:{position:"absolute",top:"0px",left:"0px",width:"14px",textTransform:"uppercase",fontSize:"13px",height:"18px",lineHeight:"22px"},fieldSymbols:{position:"absolute",top:"5px",right:"-7px",fontSize:"13px"},symbol:{height:"20px",lineHeight:"22px",paddingBottom:"7px"}}}),d=function(p,v){p["#"]?Ei(p["#"])&&n({hex:p["#"],source:"hex"},v):p.r||p.g||p.b?n({r:p.r||a.r,g:p.g||a.g,b:p.b||a.b,source:"rgb"},v):(p.h||p.s||p.v)&&n({h:p.h||i.h,s:p.s||i.s,v:p.v||i.v,source:"hsv"},v)};return R.createElement("div",{style:u.fields},R.createElement(Ut,{style:{wrap:u.RGBwrap,input:u.RGBinput,label:u.RGBlabel},label:"h",value:Math.round(i.h),onChange:d}),R.createElement(Ut,{style:{wrap:u.RGBwrap,input:u.RGBinput,label:u.RGBlabel},label:"s",value:Math.round(i.s*100),onChange:d}),R.createElement(Ut,{style:{wrap:u.RGBwrap,input:u.RGBinput,label:u.RGBlabel},label:"v",value:Math.round(i.v*100),onChange:d}),R.createElement("div",{style:u.divider}),R.createElement(Ut,{style:{wrap:u.RGBwrap,input:u.RGBinput,label:u.RGBlabel},label:"r",value:a.r,onChange:d}),R.createElement(Ut,{style:{wrap:u.RGBwrap,input:u.RGBinput,label:u.RGBlabel},label:"g",value:a.g,onChange:d}),R.createElement(Ut,{style:{wrap:u.RGBwrap,input:u.RGBinput,label:u.RGBlabel},label:"b",value:a.b,onChange:d}),R.createElement("div",{style:u.divider}),R.createElement(Ut,{style:{wrap:u.HEXwrap,input:u.HEXinput,label:u.HEXlabel},label:"#",value:l.replace("#",""),onChange:d}),R.createElement("div",{style:u.fieldSymbols},R.createElement("div",{style:u.symbol},"°"),R.createElement("div",{style:u.symbol},"%"),R.createElement("div",{style:u.symbol},"%")))},vae=function(t){var n=t.hsl,a=ft({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}},"black-outline":{picker:{boxShadow:"inset 0 0 0 1px #000"}}},{"black-outline":n.l>.5});return R.createElement("div",{style:a.picker})},xae=function(){var t=ft({default:{triangle:{width:0,height:0,borderStyle:"solid",borderWidth:"4px 0 4px 6px",borderColor:"transparent transparent transparent #fff",position:"absolute",top:"1px",left:"1px"},triangleBorder:{width:0,height:0,borderStyle:"solid",borderWidth:"5px 0 5px 8px",borderColor:"transparent transparent transparent #555"},left:{Extend:"triangleBorder",transform:"translate(-13px, -4px)"},leftInside:{Extend:"triangle",transform:"translate(-8px, -5px)"},right:{Extend:"triangleBorder",transform:"translate(20px, -14px) rotate(180deg)"},rightInside:{Extend:"triangle",transform:"translate(-8px, -5px)"}}});return R.createElement("div",{style:t.pointer},R.createElement("div",{style:t.left},R.createElement("div",{style:t.leftInside})),R.createElement("div",{style:t.right},R.createElement("div",{style:t.rightInside})))},SO=function(t){var n=t.onClick,a=t.label,i=t.children,l=t.active,u=ft({default:{button:{backgroundImage:"linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",border:"1px solid #878787",borderRadius:"2px",height:"20px",boxShadow:"0 1px 0 0 #EAEAEA",fontSize:"14px",color:"#000",lineHeight:"20px",textAlign:"center",marginBottom:"10px",cursor:"pointer"}},active:{button:{boxShadow:"0 0 0 1px #878787"}}},{active:l});return R.createElement("div",{style:u.button,onClick:n},a||i)},yae=function(t){var n=t.rgb,a=t.currentColor,i=ft({default:{swatches:{border:"1px solid #B3B3B3",borderBottom:"1px solid #F0F0F0",marginBottom:"2px",marginTop:"1px"},new:{height:"34px",background:"rgb("+n.r+","+n.g+", "+n.b+")",boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"},current:{height:"34px",background:a,boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"},label:{fontSize:"14px",color:"#000",textAlign:"center"}}});return R.createElement("div",null,R.createElement("div",{style:i.label},"new"),R.createElement("div",{style:i.swatches},R.createElement("div",{style:i.new}),R.createElement("div",{style:i.current})),R.createElement("div",{style:i.label},"current"))},bae=(function(){function e(t,n){for(var a=0;a<n.length;a++){var i=n[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}})();function wae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Sae(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function Cae(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var YS=(function(e){Cae(t,e);function t(n){wae(this,t);var a=Sae(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return a.state={currentColor:n.hex},a}return bae(t,[{key:"render",value:function(){var a=this.props,i=a.styles,l=i===void 0?{}:i,u=a.className,d=u===void 0?"":u,h=ft(xr({default:{picker:{background:"#DCDCDC",borderRadius:"4px",boxShadow:"0 0 0 1px rgba(0,0,0,.25), 0 8px 16px rgba(0,0,0,.15)",boxSizing:"initial",width:"513px"},head:{backgroundImage:"linear-gradient(-180deg, #F0F0F0 0%, #D4D4D4 100%)",borderBottom:"1px solid #B1B1B1",boxShadow:"inset 0 1px 0 0 rgba(255,255,255,.2), inset 0 -1px 0 0 rgba(0,0,0,.02)",height:"23px",lineHeight:"24px",borderRadius:"4px 4px 0 0",fontSize:"13px",color:"#4D4D4D",textAlign:"center"},body:{padding:"15px 15px 0",display:"flex"},saturation:{width:"256px",height:"256px",position:"relative",border:"2px solid #B3B3B3",borderBottom:"2px solid #F0F0F0",overflow:"hidden"},hue:{position:"relative",height:"256px",width:"19px",marginLeft:"10px",border:"2px solid #B3B3B3",borderBottom:"2px solid #F0F0F0"},controls:{width:"180px",marginLeft:"10px"},top:{display:"flex"},previews:{width:"60px"},actions:{flex:"1",marginLeft:"20px"}}},l));return R.createElement("div",{style:h.picker,className:"photoshop-picker "+d},R.createElement("div",{style:h.head},this.props.header),R.createElement("div",{style:h.body,className:"flexbox-fix"},R.createElement("div",{style:h.saturation},R.createElement(Ip,{hsl:this.props.hsl,hsv:this.props.hsv,pointer:vae,onChange:this.props.onChange})),R.createElement("div",{style:h.hue},R.createElement(Ql,{direction:"vertical",hsl:this.props.hsl,pointer:xae,onChange:this.props.onChange})),R.createElement("div",{style:h.controls},R.createElement("div",{style:h.top,className:"flexbox-fix"},R.createElement("div",{style:h.previews},R.createElement(yae,{rgb:this.props.rgb,currentColor:this.state.currentColor})),R.createElement("div",{style:h.actions},R.createElement(SO,{label:"OK",onClick:this.props.onAccept,active:!0}),R.createElement(SO,{label:"Cancel",onClick:this.props.onCancel}),R.createElement(gae,{onChange:this.props.onChange,rgb:this.props.rgb,hsv:this.props.hsv,hex:this.props.hex}))))))}}]),t})(R.Component);YS.propTypes={header:Ae.string,styles:Ae.object};YS.defaultProps={header:"Color Picker",styles:{}};yr(YS);var jae=function(t){var n=t.onChange,a=t.rgb,i=t.hsl,l=t.hex,u=t.disableAlpha,d=ft({default:{fields:{display:"flex",paddingTop:"4px"},single:{flex:"1",paddingLeft:"6px"},alpha:{flex:"1",paddingLeft:"6px"},double:{flex:"2"},input:{width:"80%",padding:"4px 10% 3px",border:"none",boxShadow:"inset 0 0 0 1px #ccc",fontSize:"11px"},label:{display:"block",textAlign:"center",fontSize:"11px",color:"#222",paddingTop:"3px",paddingBottom:"4px",textTransform:"capitalize"}},disableAlpha:{alpha:{display:"none"}}},{disableAlpha:u}),h=function(v,m){v.hex?Ei(v.hex)&&n({hex:v.hex,source:"hex"},m):v.r||v.g||v.b?n({r:v.r||a.r,g:v.g||a.g,b:v.b||a.b,a:a.a,source:"rgb"},m):v.a&&(v.a<0?v.a=0:v.a>100&&(v.a=100),v.a/=100,n({h:i.h,s:i.s,l:i.l,a:v.a,source:"rgb"},m))};return R.createElement("div",{style:d.fields,className:"flexbox-fix"},R.createElement("div",{style:d.double},R.createElement(Ut,{style:{input:d.input,label:d.label},label:"hex",value:l.replace("#",""),onChange:h})),R.createElement("div",{style:d.single},R.createElement(Ut,{style:{input:d.input,label:d.label},label:"r",value:a.r,onChange:h,dragLabel:"true",dragMax:"255"})),R.createElement("div",{style:d.single},R.createElement(Ut,{style:{input:d.input,label:d.label},label:"g",value:a.g,onChange:h,dragLabel:"true",dragMax:"255"})),R.createElement("div",{style:d.single},R.createElement(Ut,{style:{input:d.input,label:d.label},label:"b",value:a.b,onChange:h,dragLabel:"true",dragMax:"255"})),R.createElement("div",{style:d.alpha},R.createElement(Ut,{style:{input:d.input,label:d.label},label:"a",value:Math.round(a.a*100),onChange:h,dragLabel:"true",dragMax:"100"})))},Nae=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},yL=function(t){var n=t.colors,a=t.onClick,i=a===void 0?function(){}:a,l=t.onSwatchHover,u=ft({default:{colors:{margin:"0 -10px",padding:"10px 0 0 10px",borderTop:"1px solid #eee",display:"flex",flexWrap:"wrap",position:"relative"},swatchWrap:{width:"16px",height:"16px",margin:"0 10px 10px 0"},swatch:{borderRadius:"3px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.15)"}},"no-presets":{colors:{display:"none"}}},{"no-presets":!n||!n.length}),d=function(p,v){i({hex:p,source:"hex"},v)};return R.createElement("div",{style:u.colors,className:"flexbox-fix"},n.map(function(h){var p=typeof h=="string"?{color:h}:h,v=""+p.color+(p.title||"");return R.createElement("div",{key:v,style:u.swatchWrap},R.createElement(po,Nae({},p,{style:u.swatch,onClick:d,onHover:l,focusStyle:{boxShadow:"inset 0 0 0 1px rgba(0,0,0,.15), 0 0 4px "+p.color}})))}))};yL.propTypes={colors:Ae.arrayOf(Ae.oneOfType([Ae.string,Ae.shape({color:Ae.string,title:Ae.string})])).isRequired};var _ae=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},WS=function(t){var n=t.width,a=t.rgb,i=t.hex,l=t.hsv,u=t.hsl,d=t.onChange,h=t.onSwatchHover,p=t.disableAlpha,v=t.presetColors,m=t.renderers,b=t.styles,w=b===void 0?{}:b,C=t.className,S=C===void 0?"":C,j=ft(xr({default:_ae({picker:{width:n,padding:"10px 10px 0",boxSizing:"initial",background:"#fff",borderRadius:"4px",boxShadow:"0 0 0 1px rgba(0,0,0,.15), 0 8px 16px rgba(0,0,0,.15)"},saturation:{width:"100%",paddingBottom:"75%",position:"relative",overflow:"hidden"},Saturation:{radius:"3px",shadow:"inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"},controls:{display:"flex"},sliders:{padding:"4px 0",flex:"1"},color:{width:"24px",height:"24px",position:"relative",marginTop:"4px",marginLeft:"4px",borderRadius:"3px"},activeColor:{absolute:"0px 0px 0px 0px",borderRadius:"2px",background:"rgba("+a.r+","+a.g+","+a.b+","+a.a+")",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"},hue:{position:"relative",height:"10px",overflow:"hidden"},Hue:{radius:"2px",shadow:"inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"},alpha:{position:"relative",height:"10px",marginTop:"4px",overflow:"hidden"},Alpha:{radius:"2px",shadow:"inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"}},w),disableAlpha:{color:{height:"10px"},hue:{height:"10px"},alpha:{display:"none"}}},w),{disableAlpha:p});return R.createElement("div",{style:j.picker,className:"sketch-picker "+S},R.createElement("div",{style:j.saturation},R.createElement(Ip,{style:j.Saturation,hsl:u,hsv:l,onChange:d})),R.createElement("div",{style:j.controls,className:"flexbox-fix"},R.createElement("div",{style:j.sliders},R.createElement("div",{style:j.hue},R.createElement(Ql,{style:j.Hue,hsl:u,onChange:d})),R.createElement("div",{style:j.alpha},R.createElement(AS,{style:j.Alpha,rgb:a,hsl:u,renderers:m,onChange:d}))),R.createElement("div",{style:j.color},R.createElement(Xl,null),R.createElement("div",{style:j.activeColor}))),R.createElement(jae,{rgb:a,hsl:u,hex:i,onChange:d,disableAlpha:p}),R.createElement(yL,{colors:v,onClick:d,onSwatchHover:h}))};WS.propTypes={disableAlpha:Ae.bool,width:Ae.oneOfType([Ae.string,Ae.number]),styles:Ae.object};WS.defaultProps={disableAlpha:!1,width:200,styles:{},presetColors:["#D0021B","#F5A623","#F8E71C","#8B572A","#7ED321","#417505","#BD10E0","#9013FE","#4A90E2","#50E3C2","#B8E986","#000000","#4A4A4A","#9B9B9B","#FFFFFF"]};const Eae=yr(WS);var ou=function(t){var n=t.hsl,a=t.offset,i=t.onClick,l=i===void 0?function(){}:i,u=t.active,d=t.first,h=t.last,p=ft({default:{swatch:{height:"12px",background:"hsl("+n.h+", 50%, "+a*100+"%)",cursor:"pointer"}},first:{swatch:{borderRadius:"2px 0 0 2px"}},last:{swatch:{borderRadius:"0 2px 2px 0"}},active:{swatch:{transform:"scaleY(1.8)",borderRadius:"3.6px/2px"}}},{active:u,first:d,last:h}),v=function(b){return l({h:n.h,s:.5,l:a,source:"hsl"},b)};return R.createElement("div",{style:p.swatch,onClick:v})},Tae=function(t){var n=t.onClick,a=t.hsl,i=ft({default:{swatches:{marginTop:"20px"},swatch:{boxSizing:"border-box",width:"20%",paddingRight:"1px",float:"left"},clear:{clear:"both"}}}),l=.1;return R.createElement("div",{style:i.swatches},R.createElement("div",{style:i.swatch},R.createElement(ou,{hsl:a,offset:".80",active:Math.abs(a.l-.8)<l&&Math.abs(a.s-.5)<l,onClick:n,first:!0})),R.createElement("div",{style:i.swatch},R.createElement(ou,{hsl:a,offset:".65",active:Math.abs(a.l-.65)<l&&Math.abs(a.s-.5)<l,onClick:n})),R.createElement("div",{style:i.swatch},R.createElement(ou,{hsl:a,offset:".50",active:Math.abs(a.l-.5)<l&&Math.abs(a.s-.5)<l,onClick:n})),R.createElement("div",{style:i.swatch},R.createElement(ou,{hsl:a,offset:".35",active:Math.abs(a.l-.35)<l&&Math.abs(a.s-.5)<l,onClick:n})),R.createElement("div",{style:i.swatch},R.createElement(ou,{hsl:a,offset:".20",active:Math.abs(a.l-.2)<l&&Math.abs(a.s-.5)<l,onClick:n,last:!0})),R.createElement("div",{style:i.clear}))},Rae=function(){var t=ft({default:{picker:{width:"14px",height:"14px",borderRadius:"6px",transform:"translate(-7px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return R.createElement("div",{style:t.picker})},XS=function(t){var n=t.hsl,a=t.onChange,i=t.pointer,l=t.styles,u=l===void 0?{}:l,d=t.className,h=d===void 0?"":d,p=ft(xr({default:{hue:{height:"12px",position:"relative"},Hue:{radius:"2px"}}},u));return R.createElement("div",{style:p.wrap||{},className:"slider-picker "+h},R.createElement("div",{style:p.hue},R.createElement(Ql,{style:p.Hue,hsl:n,pointer:i,onChange:a})),R.createElement("div",{style:p.swatches},R.createElement(Tae,{hsl:n,onClick:a})))};XS.propTypes={styles:Ae.object};XS.defaultProps={pointer:Rae,styles:{}};yr(XS);var Xf={},CO;function Aae(){if(CO)return Xf;CO=1,Object.defineProperty(Xf,"__esModule",{value:!0});var e=Object.assign||function(u){for(var d=1;d<arguments.length;d++){var h=arguments[d];for(var p in h)Object.prototype.hasOwnProperty.call(h,p)&&(u[p]=h[p])}return u},t=io(),n=a(t);function a(u){return u&&u.__esModule?u:{default:u}}function i(u,d){var h={};for(var p in u)d.indexOf(p)>=0||Object.prototype.hasOwnProperty.call(u,p)&&(h[p]=u[p]);return h}var l=24;return Xf.default=function(u){var d=u.fill,h=d===void 0?"currentColor":d,p=u.width,v=p===void 0?l:p,m=u.height,b=m===void 0?l:m,w=u.style,C=w===void 0?{}:w,S=i(u,["fill","width","height","style"]);return n.default.createElement("svg",e({viewBox:"0 0 "+l+" "+l,style:e({fill:h,width:v,height:b},C)},S),n.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},Xf}var Oae=Aae();const Mae=Ml(Oae);var Dae=function(t){var n=t.color,a=t.onClick,i=a===void 0?function(){}:a,l=t.onSwatchHover,u=t.first,d=t.last,h=t.active,p=ft({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:n,marginBottom:"1px"},check:{color:IS(n),marginLeft:"8px",display:"none"}},first:{color:{overflow:"hidden",borderRadius:"2px 2px 0 0"}},last:{color:{overflow:"hidden",borderRadius:"0 0 2px 2px"}},active:{check:{display:"block"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},check:{color:"#333"}},transparent:{check:{color:"#333"}}},{first:u,last:d,active:h,"color-#FFFFFF":n==="#FFFFFF",transparent:n==="transparent"});return R.createElement(po,{color:n,style:p.color,onClick:i,onHover:l,focusStyle:{boxShadow:"0 0 4px "+n}},R.createElement("div",{style:p.check},R.createElement(Mae,null)))},Pae=function(t){var n=t.onClick,a=t.onSwatchHover,i=t.group,l=t.active,u=ft({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return R.createElement("div",{style:u.group},mo(i,function(d,h){return R.createElement(Dae,{key:d,color:d,active:d.toLowerCase()===l,first:h===0,last:h===i.length-1,onClick:n,onSwatchHover:a})}))},QS=function(t){var n=t.width,a=t.height,i=t.onChange,l=t.onSwatchHover,u=t.colors,d=t.hex,h=t.styles,p=h===void 0?{}:h,v=t.className,m=v===void 0?"":v,b=ft(xr({default:{picker:{width:n,height:a},overflow:{height:a,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},p)),w=function(S,j){return i({hex:S,source:"hex"},j)};return R.createElement("div",{style:b.picker,className:"swatches-picker "+m},R.createElement(dd,null,R.createElement("div",{style:b.overflow},R.createElement("div",{style:b.body},mo(u,function(C){return R.createElement(Pae,{key:C.toString(),group:C,active:d,onClick:w,onSwatchHover:l})}),R.createElement("div",{style:b.clear})))))};QS.propTypes={width:Ae.oneOfType([Ae.string,Ae.number]),height:Ae.oneOfType([Ae.string,Ae.number]),colors:Ae.arrayOf(Ae.arrayOf(Ae.string)),styles:Ae.object};QS.defaultProps={width:320,height:240,colors:[[tl[900],tl[700],tl[500],tl[300],tl[100]],[nl[900],nl[700],nl[500],nl[300],nl[100]],[rl[900],rl[700],rl[500],rl[300],rl[100]],[al[900],al[700],al[500],al[300],al[100]],[sl[900],sl[700],sl[500],sl[300],sl[100]],[il[900],il[700],il[500],il[300],il[100]],[ol[900],ol[700],ol[500],ol[300],ol[100]],[ll[900],ll[700],ll[500],ll[300],ll[100]],[cl[900],cl[700],cl[500],cl[300],cl[100]],["#194D33",gu[700],gu[500],gu[300],gu[100]],[ul[900],ul[700],ul[500],ul[300],ul[100]],[dl[900],dl[700],dl[500],dl[300],dl[100]],[fl[900],fl[700],fl[500],fl[300],fl[100]],[hl[900],hl[700],hl[500],hl[300],hl[100]],[pl[900],pl[700],pl[500],pl[300],pl[100]],[ml[900],ml[700],ml[500],ml[300],ml[100]],[gl[900],gl[700],gl[500],gl[300],gl[100]],[vl[900],vl[700],vl[500],vl[300],vl[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};yr(QS);var ZS=function(t){var n=t.onChange,a=t.onSwatchHover,i=t.hex,l=t.colors,u=t.width,d=t.triangle,h=t.styles,p=h===void 0?{}:h,v=t.className,m=v===void 0?"":v,b=ft(xr({default:{card:{width:u,background:"#fff",border:"0 solid rgba(0,0,0,0.25)",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",borderRadius:"4px",position:"relative"},body:{padding:"15px 9px 9px 15px"},label:{fontSize:"18px",color:"#fff"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent #fff transparent",position:"absolute"},triangleShadow:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent rgba(0,0,0,.1) transparent",position:"absolute"},hash:{background:"#F0F0F0",height:"30px",width:"30px",borderRadius:"4px 0 0 4px",float:"left",color:"#98A1A4",display:"flex",alignItems:"center",justifyContent:"center"},input:{width:"100px",fontSize:"14px",color:"#666",border:"0px",outline:"none",height:"28px",boxShadow:"inset 0 0 0 1px #F0F0F0",boxSizing:"content-box",borderRadius:"0 4px 4px 0",float:"left",paddingLeft:"8px"},swatch:{width:"30px",height:"30px",float:"left",borderRadius:"4px",margin:"0 6px 6px 0"},clear:{clear:"both"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-10px",left:"12px"},triangleShadow:{top:"-11px",left:"12px"}},"top-right-triangle":{triangle:{top:"-10px",right:"12px"},triangleShadow:{top:"-11px",right:"12px"}}},p),{"hide-triangle":d==="hide","top-left-triangle":d==="top-left","top-right-triangle":d==="top-right"}),w=function(S,j){Ei(S)&&n({hex:S,source:"hex"},j)};return R.createElement("div",{style:b.card,className:"twitter-picker "+m},R.createElement("div",{style:b.triangleShadow}),R.createElement("div",{style:b.triangle}),R.createElement("div",{style:b.body},mo(l,function(C,S){return R.createElement(po,{key:S,color:C,hex:C,style:b.swatch,onClick:w,onHover:a,focusStyle:{boxShadow:"0 0 4px "+C}})}),R.createElement("div",{style:b.hash},"#"),R.createElement(Ut,{label:null,style:{input:b.input},value:i.replace("#",""),onChange:w}),R.createElement("div",{style:b.clear})))};ZS.propTypes={width:Ae.oneOfType([Ae.string,Ae.number]),triangle:Ae.oneOf(["hide","top-left","top-right"]),colors:Ae.arrayOf(Ae.string),styles:Ae.object};ZS.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};yr(ZS);var JS=function(t){var n=ft({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",border:"2px #fff solid",transform:"translate(-12px, -13px)",background:"hsl("+Math.round(t.hsl.h)+", "+Math.round(t.hsl.s*100)+"%, "+Math.round(t.hsl.l*100)+"%)"}}});return R.createElement("div",{style:n.picker})};JS.propTypes={hsl:Ae.shape({h:Ae.number,s:Ae.number,l:Ae.number,a:Ae.number})};JS.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var e1=function(t){var n=ft({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",transform:"translate(-10px, -7px)",background:"hsl("+Math.round(t.hsl.h)+", 100%, 50%)",border:"2px white solid"}}});return R.createElement("div",{style:n.picker})};e1.propTypes={hsl:Ae.shape({h:Ae.number,s:Ae.number,l:Ae.number,a:Ae.number})};e1.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var kae=function(t){var n=t.onChange,a=t.rgb,i=t.hsl,l=t.hex,u=t.hsv,d=function(w,C){if(w.hex)Ei(w.hex)&&n({hex:w.hex,source:"hex"},C);else if(w.rgb){var S=w.rgb.split(",");Db(w.rgb,"rgb")&&n({r:S[0],g:S[1],b:S[2],a:1,source:"rgb"},C)}else if(w.hsv){var j=w.hsv.split(",");Db(w.hsv,"hsv")&&(j[2]=j[2].replace("%",""),j[1]=j[1].replace("%",""),j[0]=j[0].replace("°",""),j[1]==1?j[1]=.01:j[2]==1&&(j[2]=.01),n({h:Number(j[0]),s:Number(j[1]),v:Number(j[2]),source:"hsv"},C))}else if(w.hsl){var N=w.hsl.split(",");Db(w.hsl,"hsl")&&(N[2]=N[2].replace("%",""),N[1]=N[1].replace("%",""),N[0]=N[0].replace("°",""),m[1]==1?m[1]=.01:m[2]==1&&(m[2]=.01),n({h:Number(N[0]),s:Number(N[1]),v:Number(N[2]),source:"hsl"},C))}},h=ft({default:{wrap:{display:"flex",height:"100px",marginTop:"4px"},fields:{width:"100%"},column:{paddingTop:"10px",display:"flex",justifyContent:"space-between"},double:{padding:"0px 4.4px",boxSizing:"border-box"},input:{width:"100%",height:"38px",boxSizing:"border-box",padding:"4px 10% 3px",textAlign:"center",border:"1px solid #dadce0",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",fontFamily:"Roboto,Arial,sans-serif"},input2:{height:"38px",width:"100%",border:"1px solid #dadce0",boxSizing:"border-box",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",paddingLeft:"10px",fontFamily:"Roboto,Arial,sans-serif"},label:{textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"35px",top:"-6px",left:"0",right:"0",marginLeft:"auto",marginRight:"auto",fontFamily:"Roboto,Arial,sans-serif"},label2:{left:"10px",textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"32px",top:"-6px",fontFamily:"Roboto,Arial,sans-serif"},single:{flexGrow:"1",margin:"0px 4.4px"}}}),p=a.r+", "+a.g+", "+a.b,v=Math.round(i.h)+"°, "+Math.round(i.s*100)+"%, "+Math.round(i.l*100)+"%",m=Math.round(u.h)+"°, "+Math.round(u.s*100)+"%, "+Math.round(u.v*100)+"%";return R.createElement("div",{style:h.wrap,className:"flexbox-fix"},R.createElement("div",{style:h.fields},R.createElement("div",{style:h.double},R.createElement(Ut,{style:{input:h.input,label:h.label},label:"hex",value:l,onChange:d})),R.createElement("div",{style:h.column},R.createElement("div",{style:h.single},R.createElement(Ut,{style:{input:h.input2,label:h.label2},label:"rgb",value:p,onChange:d})),R.createElement("div",{style:h.single},R.createElement(Ut,{style:{input:h.input2,label:h.label2},label:"hsv",value:m,onChange:d})),R.createElement("div",{style:h.single},R.createElement(Ut,{style:{input:h.input2,label:h.label2},label:"hsl",value:v,onChange:d})))))},t1=function(t){var n=t.width,a=t.onChange,i=t.rgb,l=t.hsl,u=t.hsv,d=t.hex,h=t.header,p=t.styles,v=p===void 0?{}:p,m=t.className,b=m===void 0?"":m,w=ft(xr({default:{picker:{width:n,background:"#fff",border:"1px solid #dfe1e5",boxSizing:"initial",display:"flex",flexWrap:"wrap",borderRadius:"8px 8px 0px 0px"},head:{height:"57px",width:"100%",paddingTop:"16px",paddingBottom:"16px",paddingLeft:"16px",fontSize:"20px",boxSizing:"border-box",fontFamily:"Roboto-Regular,HelveticaNeue,Arial,sans-serif"},saturation:{width:"70%",padding:"0px",position:"relative",overflow:"hidden"},swatch:{width:"30%",height:"228px",padding:"0px",background:"rgba("+i.r+", "+i.g+", "+i.b+", 1)",position:"relative",overflow:"hidden"},body:{margin:"auto",width:"95%"},controls:{display:"flex",boxSizing:"border-box",height:"52px",paddingTop:"22px"},color:{width:"32px"},hue:{height:"8px",position:"relative",margin:"0px 16px 0px 16px",width:"100%"},Hue:{radius:"2px"}}},v));return R.createElement("div",{style:w.picker,className:"google-picker "+b},R.createElement("div",{style:w.head},h),R.createElement("div",{style:w.swatch}),R.createElement("div",{style:w.saturation},R.createElement(Ip,{hsl:l,hsv:u,pointer:JS,onChange:a})),R.createElement("div",{style:w.body},R.createElement("div",{style:w.controls,className:"flexbox-fix"},R.createElement("div",{style:w.hue},R.createElement(Ql,{style:w.Hue,hsl:l,radius:"4px",pointer:e1,onChange:a}))),R.createElement(kae,{rgb:i,hsl:l,hex:d,hsv:u,onChange:a})))};t1.propTypes={width:Ae.oneOfType([Ae.string,Ae.number]),styles:Ae.object,header:Ae.string};t1.defaultProps={width:652,styles:{},header:"Color picker"};yr(t1);const Lae=["#ff0000","#ff8000","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff","#ffffff","#2a9d8f","#e9c46a","#dc143c","#000000"];function kb({value:e,onChange:t,className:n,presets:a=Lae}){const[i,l]=g.useState(!1),u=d=>{t(d.hex)};return o.jsxs(Bu,{open:i,onOpenChange:l,children:[o.jsx(Iu,{asChild:!0,children:o.jsx(se,{variant:"secondary",className:lt("w-12 h-12 rounded-full p-1 border-2",n),style:{backgroundColor:e},children:o.jsx("span",{className:"sr-only",children:"Pick a color"})})}),o.jsx(Rl,{className:"w-auto p-0",align:"start",children:o.jsx(Eae,{color:e,onChange:u,presetColors:a,disableAlpha:!0})})]})}function Bae(){const[e,t]=g.useState(null),[n,a]=g.useState(!0),[i,l]=g.useState(null),[u,d]=g.useState([]),[h,p]=g.useState([]),[v,m]=g.useState(35),[b,w]=g.useState(128),[C,S]=g.useState("128"),[j,N]=g.useState(128),[_,T]=g.useState("128"),[A,D]=g.useState(""),[L,k]=g.useState(""),[P,U]=g.useState("#ff0000"),[J,$]=g.useState("#000000"),[W,pe]=g.useState("#0000ff"),Se=g.useRef(null),[Ce,I]=g.useState("automated"),[q,H]=g.useState(null),[be,Ne]=g.useState(null),[B,G]=g.useState(!1),[X,oe]=g.useState(30),[xe,Q]=g.useState("30");g.useEffect(()=>{(async()=>{try{const[Re,st]=await Promise.all([fe.get("/get_led_config"),fe.get("/api/settings")]);t({provider:Re.provider||"none",wled_ip:Re.wled_ip,num_leds:Re.dw_led_num_leds,gpio_pin:Re.dw_led_gpio_pin}),st.led?.control_mode&&I(st.led.control_mode)}catch(Re){console.error("Error fetching LED config:",Re)}finally{a(!1)}})()},[]),g.useEffect(()=>{e?.provider==="dw_leds"&&(te(),he(),_e(),je())},[e]);const te=async()=>{try{const ne=await fe.get("/api/dw_leds/status");l(ne),ne.connected&&(m(ne.brightness||35),w(ne.speed||128),S(String(ne.speed||128)),N(ne.intensity||128),T(String(ne.intensity||128)),D(String(ne.current_effect||0)),k(String(ne.current_palette||0)),ne.colors&&(U(ne.colors[0]||"#ff0000"),$(ne.colors[1]||"#000000"),pe(ne.colors[2]||"#0000ff")))}catch(ne){console.error("Error fetching DW LEDs status:",ne)}},he=async()=>{try{const[ne,Re]=await Promise.all([fe.get("/api/dw_leds/effects"),fe.get("/api/dw_leds/palettes")]);if(ne.effects){const st=[...ne.effects].sort((et,xt)=>et[1].localeCompare(xt[1]));d(st)}if(Re.palettes){const st=[...Re.palettes].sort((et,xt)=>et[1].localeCompare(xt[1]));p(st)}}catch(ne){console.error("Error fetching effects/palettes:",ne)}},_e=async()=>{try{const ne=await fe.get("/api/dw_leds/get_effect_settings");H(ne.idle_effect||null),Ne(ne.playing_effect||null)}catch(ne){console.error("Error fetching effect settings:",ne)}},je=async()=>{try{const ne=await fe.get("/api/dw_leds/idle_timeout");G(ne.enabled||!1),oe(ne.minutes||30),Q(String(ne.minutes||30))}catch(ne){console.error("Error fetching idle timeout:",ne)}},Me=async ne=>{I(ne);try{await fe.patch("/api/settings",{led:{control_mode:ne}}),K.success(ne==="manual"?"Manual / HA mode":"DW Automated mode")}catch{K.error("Failed to update control mode")}},ce=async()=>{try{const ne=await fe.post("/api/dw_leds/power",{state:2});ne.connected?(K.success(`Power ${ne.power_on?"ON":"OFF"}`),await te()):K.error(ne.error||"Failed to toggle power")}catch{K.error("Failed to toggle power")}},He=g.useCallback(async ne=>{m(ne[0])},[]),Le=async ne=>{try{(await fe.post("/api/dw_leds/brightness",{value:ne[0]})).connected&&K.success(`Brightness: ${ne[0]}%`)}catch{K.error("Failed to set brightness")}},Ue=g.useCallback(ne=>{w(ne[0]),S(String(ne[0]))},[]),wt=async ne=>{try{await fe.post("/api/dw_leds/speed",{speed:ne[0]}),K.success(`Speed: ${ne[0]}`)}catch{K.error("Failed to set speed")}},$e=g.useCallback(ne=>{N(ne[0]),T(String(ne[0]))},[]),Ot=async ne=>{try{await fe.post("/api/dw_leds/intensity",{intensity:ne[0]}),K.success(`Intensity: ${ne[0]}`)}catch{K.error("Failed to set intensity")}},St=async ne=>{D(ne);try{const Re=await fe.post("/api/dw_leds/effect",{effect_id:parseInt(ne)});if(Re.connected&&(K.success("Effect changed"),Re.power_on!==void 0)){const st=Re.power_on;l(et=>et?{...et,power_on:st}:null)}}catch{K.error("Failed to set effect")}},Et=async ne=>{k(ne);try{(await fe.post("/api/dw_leds/palette",{palette_id:parseInt(ne)})).connected&&K.success("Palette changed")}catch{K.error("Failed to set palette")}},jt=(ne,Re)=>{ne===1?U(Re):ne===2?$(Re):pe(Re),Se.current&&clearTimeout(Se.current),Se.current=setTimeout(async()=>{try{const st=xt=>{const mt=parseInt(xt.slice(1,3),16),gt=parseInt(xt.slice(3,5),16),qt=parseInt(xt.slice(5,7),16);return[mt,gt,qt]},et={};et[`color${ne}`]=st(Re),await fe.post("/api/dw_leds/colors",et)}catch(st){console.error("Failed to set color:",st)}},300)},ot=async ne=>{try{const Re={type:ne,effect_id:parseInt(A)||0,palette_id:parseInt(L)||0,speed:b,intensity:j,color1:P,color2:J,color3:W};await fe.post("/api/dw_leds/save_effect_settings",Re),K.success(`${ne.charAt(0).toUpperCase()+ne.slice(1)} effect saved`),await _e()}catch{K.error(`Failed to save ${ne} effect`)}},at=async ne=>{try{await fe.post("/api/dw_leds/clear_effect_settings",{type:ne}),K.success(`${ne.charAt(0).toUpperCase()+ne.slice(1)} effect cleared`),await _e()}catch{K.error(`Failed to clear ${ne} effect`)}},vt=async(ne,Re)=>{const st=ne!==void 0?ne:B,et=Re!==void 0?Re:X;try{await fe.post("/api/dw_leds/idle_timeout",{enabled:st,minutes:et}),K.success(`Idle timeout ${st?"enabled":"disabled"}`)}catch{K.error("Failed to save idle timeout")}},Kt=async ne=>{G(ne),await vt(ne,X)},Yt=ne=>{if(!ne)return"Not configured";const Re=u.find(et=>et[0]===ne.effect_id)?.[1]||ne.effect_id,st=h.find(et=>et[0]===ne.palette_id)?.[1]||ne.palette_id;return`${Re} | ${st} | Speed: ${ne.speed} | Intensity: ${ne.intensity}`};if(n)return o.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:o.jsx("span",{className:"material-icons-outlined animate-spin text-4xl text-muted-foreground",children:"sync"})});if(!e||e.provider==="none")return o.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh] gap-6 text-center px-4",children:[o.jsx("div",{className:"p-4 rounded-full bg-muted",children:o.jsx("span",{className:"material-icons-outlined text-5xl text-muted-foreground",children:"lightbulb"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h1",{className:"text-xl sm:text-2xl font-bold",children:"LED Controller Not Configured"}),o.jsx("p",{className:"text-sm sm:text-base text-muted-foreground max-w-md",children:"Configure your LED controller (WLED or DW LEDs) in the Settings page to control your lights."})]}),o.jsx(se,{asChild:!0,className:"gap-2",children:o.jsxs(pi,{to:"/settings?section=led",children:[o.jsx("span",{className:"material-icons-outlined",children:"settings"}),"Go to Settings"]})})]});const Wt=o.jsxs(Un,{children:[o.jsxs(da,{className:"pb-3",children:[o.jsxs(fa,{className:"text-lg flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"tune"}),"LED Control Mode"]}),o.jsx(hi,{children:"Choose how Dune Weaver manages LED effects during playback and idle states"})]}),o.jsx(qn,{children:o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[o.jsxs("button",{onClick:()=>Me("manual"),className:`p-4 rounded-lg border-2 text-left transition-all ${Ce==="manual"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/30"}`,children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"front_hand"}),o.jsx("span",{className:"font-medium text-sm",children:"Manual / Home Assistant"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Effects persist until changed. Still Sands turns off only."})]}),o.jsxs("button",{onClick:()=>Me("automated"),className:`p-4 rounded-lg border-2 text-left transition-all ${Ce==="automated"?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/30"}`,children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"smart_toy"}),o.jsx("span",{className:"font-medium text-sm",children:"DW Automated"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Auto-switch effects on play/idle. Still Sands turns off and on."})]})]})})]});return e.provider==="wled"&&e.wled_ip?o.jsxs("div",{className:"flex flex-col w-full max-w-5xl mx-auto gap-4 py-3 sm:py-6 px-0 sm:px-4",children:[Wt,o.jsx("div",{style:{height:"calc(100vh - 380px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))"},children:o.jsx("iframe",{src:`http://${e.wled_ip}`,className:"w-full h-full rounded-lg border border-border",title:"WLED Control"})})]}):o.jsxs("div",{className:"flex flex-col w-full max-w-5xl mx-auto gap-6 py-3 sm:py-6 px-0 sm:px-4",children:[o.jsxs("div",{className:"space-y-0.5 sm:space-y-1 pl-1",children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"LED Control"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"DW LEDs - GPIO controlled LED strip"})]}),o.jsx(Xn,{}),Wt,o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[o.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[o.jsx(Un,{children:o.jsx(qn,{className:"pt-6",children:o.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-6",children:[o.jsxs("div",{className:"flex flex-col items-center gap-3",children:[o.jsx("button",{onClick:ce,className:`w-24 h-24 rounded-full flex items-center justify-center transition-all shadow-lg ${i?.power_on?"bg-green-500 hover:bg-green-600 shadow-green-500/30":"bg-muted hover:bg-muted/80"}`,children:o.jsx("span",{className:`material-icons text-4xl ${i?.power_on?"text-white":"text-muted-foreground"}`,children:"power_settings_new"})}),o.jsx("span",{className:`text-sm font-medium ${i?.power_on?"text-green-600":"text-muted-foreground"}`,children:i?.power_on?"ON":"OFF"})]}),o.jsxs("div",{className:"flex-1 w-full space-y-4",children:[o.jsxs("div",{className:`flex items-center gap-2 text-sm ${i?.connected?"text-green-600":"text-destructive"}`,children:[o.jsx("span",{className:"material-icons-outlined text-base",children:i?.connected?"check_circle":"error"}),i?.connected?`${i.num_leds} LEDs on GPIO ${i.gpio_pin}`:"Not connected"]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsxs(Ke,{children:[o.jsx("span",{className:"material-icons-outlined text-sm mr-2 align-[-6px] text-muted-foreground",children:"brightness_6"}),"Brightness"]}),o.jsxs("span",{className:"text-sm font-medium",children:[v,"%"]})]}),o.jsx(_l,{value:[v],onValueChange:He,onValueCommit:Le,max:100,step:1})]})]})]})})}),o.jsxs(Un,{children:[o.jsx(da,{className:"pb-3",children:o.jsxs(fa,{className:"text-lg flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"auto_awesome"}),"Effects & Palettes"]})}),o.jsxs(qn,{className:"space-y-6",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ke,{children:"Effect"}),o.jsxs(Pn,{value:A,onValueChange:St,children:[o.jsx(An,{children:o.jsx(Hn,{placeholder:"Select effect..."})}),o.jsx(On,{children:u.map(([ne,Re])=>o.jsx(nt,{value:String(ne),children:Re},ne))})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ke,{children:"Palette"}),o.jsxs(Pn,{value:L,onValueChange:Et,children:[o.jsx(An,{children:o.jsx(Hn,{placeholder:"Select palette..."})}),o.jsx(On,{children:h.map(([ne,Re])=>o.jsx(nt,{value:String(ne),children:Re},ne))})]})]})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsxs(Ke,{children:[o.jsx("span",{className:"material-icons-outlined text-sm mr-2 align-[-6px] text-muted-foreground",children:"speed"}),"Speed"]}),o.jsx(bt,{type:"text",inputMode:"numeric",value:C,onChange:ne=>{const Re=ne.target.value.replace(/[^0-9]/g,"");S(Re)},onBlur:()=>{const ne=Math.min(255,Math.max(0,parseInt(C)||0));w(ne),S(String(ne)),wt([ne])},onKeyDown:ne=>{if(ne.key==="Enter"){const Re=Math.min(255,Math.max(0,parseInt(C)||0));w(Re),S(String(Re)),wt([Re])}},className:"w-16 h-7 text-center text-sm font-medium px-2"})]}),o.jsx(_l,{value:[b],onValueChange:Ue,onValueCommit:wt,max:255,step:1})]}),o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsxs(Ke,{children:[o.jsx("span",{className:"material-icons-outlined text-sm mr-2 align-[-6px] text-muted-foreground",children:"tungsten"}),"Intensity"]}),o.jsx(bt,{type:"text",inputMode:"numeric",value:_,onChange:ne=>{const Re=ne.target.value.replace(/[^0-9]/g,"");T(Re)},onBlur:()=>{const ne=Math.min(255,Math.max(0,parseInt(_)||0));N(ne),T(String(ne)),Ot([ne])},onKeyDown:ne=>{if(ne.key==="Enter"){const Re=Math.min(255,Math.max(0,parseInt(_)||0));N(Re),T(String(Re)),Ot([Re])}},className:"w-16 h-7 text-center text-sm font-medium px-2"})]}),o.jsx(_l,{value:[j],onValueChange:$e,onValueCommit:Ot,max:255,step:1})]})]})]})]})]}),o.jsxs("div",{className:"flex flex-col gap-6",children:[o.jsxs(Un,{className:"flex-1 flex flex-col",children:[o.jsx(da,{className:"pb-3",children:o.jsxs(fa,{className:"text-lg flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"palette"}),"Colors"]})}),o.jsx(qn,{className:"flex-1 flex items-center justify-center",children:o.jsxs("div",{className:"flex justify-around w-full",children:[o.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o.jsx(kb,{value:P,onChange:ne=>jt(1,ne)}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"Primary"})]}),o.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o.jsx(kb,{value:J,onChange:ne=>jt(2,ne)}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"Secondary"})]}),o.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o.jsx(kb,{value:W,onChange:ne=>jt(3,ne)}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"Accent"})]})]})})]}),Ce==="automated"&&o.jsxs(Un,{className:"flex-1 flex flex-col",children:[o.jsx(da,{className:"pb-3",children:o.jsxs(fa,{className:"text-lg flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"schedule"}),"Auto Turn Off"]})}),o.jsxs(qn,{className:"flex-1 flex flex-col justify-center space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Enable timeout"}),o.jsx(Tr,{checked:B,onCheckedChange:Kt})]}),B&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(bt,{type:"text",inputMode:"numeric",value:xe,onChange:ne=>{const Re=ne.target.value.replace(/[^0-9]/g,"");Q(Re)},onBlur:()=>{const ne=Math.min(1440,Math.max(1,parseInt(xe)||30));oe(ne),Q(String(ne))},onKeyDown:ne=>{if(ne.key==="Enter"){const Re=Math.min(1440,Math.max(1,parseInt(xe)||30));oe(Re),Q(String(Re)),vt(B,Re)}},className:"w-20"}),o.jsx("span",{className:"text-sm text-muted-foreground flex-1",children:"minutes"}),o.jsx(se,{size:"sm",onClick:()=>vt(),children:"Save"})]})]})]})]})]}),Ce==="automated"&&o.jsxs(Un,{children:[o.jsxs(da,{className:"pb-3",children:[o.jsxs(fa,{className:"text-lg flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"smart_toy"}),"Effect Automation"]}),o.jsx(hi,{children:"Save current settings to automatically apply when table state changes"})]}),o.jsx(qn,{children:o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons text-green-600",children:"play_circle"}),o.jsx("span",{className:"font-medium",children:"While Playing"})]})}),o.jsx("div",{className:"text-xs text-muted-foreground p-2 bg-muted/50 rounded border min-h-[40px]",children:Yt(be)}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(se,{size:"sm",onClick:()=>ot("playing"),className:"flex-1 gap-1",children:[o.jsx("span",{className:"material-icons text-sm",children:"save"}),"Save Current"]}),o.jsx(se,{size:"sm",variant:"secondary",onClick:()=>at("playing"),children:"Clear"})]})]}),o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons text-blue-600",children:"bedtime"}),o.jsx("span",{className:"font-medium",children:"When Idle"})]})}),o.jsx("div",{className:"text-xs text-muted-foreground p-2 bg-muted/50 rounded border min-h-[40px]",children:Yt(q)}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(se,{size:"sm",onClick:()=>ot("idle"),className:"flex-1 gap-1",children:[o.jsx("span",{className:"material-icons text-sm",children:"save"}),"Save Current"]}),o.jsx(se,{size:"sm",variant:"secondary",onClick:()=>at("idle"),children:"Clear"})]})]})]})})]})]})}var Hp="Collapsible",[Iae,bL]=Lr(Hp),[zae,n1]=Iae(Hp),wL=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:a,defaultOpen:i,disabled:l,onOpenChange:u,...d}=e,[h,p]=Zr({prop:a,defaultProp:i??!1,onChange:u,caller:Hp});return o.jsx(zae,{scope:n,disabled:l,contentId:ma(),open:h,onOpenToggle:g.useCallback(()=>p(v=>!v),[p]),children:o.jsx(ut.div,{"data-state":a1(h),"data-disabled":l?"":void 0,...d,ref:t})})});wL.displayName=Hp;var SL="CollapsibleTrigger",CL=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,...a}=e,i=n1(SL,n);return o.jsx(ut.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":a1(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...a,ref:t,onClick:Je(e.onClick,i.onOpenToggle)})});CL.displayName=SL;var r1="CollapsibleContent",jL=g.forwardRef((e,t)=>{const{forceMount:n,...a}=e,i=n1(r1,e.__scopeCollapsible);return o.jsx(Ts,{present:n||i.open,children:({present:l})=>o.jsx(Fae,{...a,ref:t,present:l})})});jL.displayName=r1;var Fae=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:a,children:i,...l}=e,u=n1(r1,n),[d,h]=g.useState(a),p=g.useRef(null),v=At(t,p),m=g.useRef(0),b=m.current,w=g.useRef(0),C=w.current,S=u.open||d,j=g.useRef(S),N=g.useRef(void 0);return g.useEffect(()=>{const _=requestAnimationFrame(()=>j.current=!1);return()=>cancelAnimationFrame(_)},[]),Vn(()=>{const _=p.current;if(_){N.current=N.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";const T=_.getBoundingClientRect();m.current=T.height,w.current=T.width,j.current||(_.style.transitionDuration=N.current.transitionDuration,_.style.animationName=N.current.animationName),h(a)}},[u.open,a]),o.jsx(ut.div,{"data-state":a1(u.open),"data-disabled":u.disabled?"":void 0,id:u.contentId,hidden:!S,...l,ref:v,style:{"--radix-collapsible-content-height":b?`${b}px`:void 0,"--radix-collapsible-content-width":C?`${C}px`:void 0,...e.style},children:S&&i})});function a1(e){return e?"open":"closed"}var Hae=wL,Uae=CL,qae=jL,ja="Accordion",Vae=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[s1,$ae,Gae]=vp(ja),[Up]=Lr(ja,[Gae,bL]),i1=bL(),NL=R.forwardRef((e,t)=>{const{type:n,...a}=e,i=a,l=a;return o.jsx(s1.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?o.jsx(Xae,{...l,ref:t}):o.jsx(Wae,{...i,ref:t})})});NL.displayName=ja;var[_L,Kae]=Up(ja),[EL,Yae]=Up(ja,{collapsible:!1}),Wae=R.forwardRef((e,t)=>{const{value:n,defaultValue:a,onValueChange:i=()=>{},collapsible:l=!1,...u}=e,[d,h]=Zr({prop:n,defaultProp:a??"",onChange:i,caller:ja});return o.jsx(_L,{scope:e.__scopeAccordion,value:R.useMemo(()=>d?[d]:[],[d]),onItemOpen:h,onItemClose:R.useCallback(()=>l&&h(""),[l,h]),children:o.jsx(EL,{scope:e.__scopeAccordion,collapsible:l,children:o.jsx(TL,{...u,ref:t})})})}),Xae=R.forwardRef((e,t)=>{const{value:n,defaultValue:a,onValueChange:i=()=>{},...l}=e,[u,d]=Zr({prop:n,defaultProp:a??[],onChange:i,caller:ja}),h=R.useCallback(v=>d((m=[])=>[...m,v]),[d]),p=R.useCallback(v=>d((m=[])=>m.filter(b=>b!==v)),[d]);return o.jsx(_L,{scope:e.__scopeAccordion,value:u,onItemOpen:h,onItemClose:p,children:o.jsx(EL,{scope:e.__scopeAccordion,collapsible:!0,children:o.jsx(TL,{...l,ref:t})})})}),[Qae,qp]=Up(ja),TL=R.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:a,dir:i,orientation:l="vertical",...u}=e,d=R.useRef(null),h=At(d,t),p=$ae(n),m=od(i)==="ltr",b=Je(e.onKeyDown,w=>{if(!Vae.includes(w.key))return;const C=w.target,S=p().filter(P=>!P.ref.current?.disabled),j=S.findIndex(P=>P.ref.current===C),N=S.length;if(j===-1)return;w.preventDefault();let _=j;const T=0,A=N-1,D=()=>{_=j+1,_>A&&(_=T)},L=()=>{_=j-1,_<T&&(_=A)};switch(w.key){case"Home":_=T;break;case"End":_=A;break;case"ArrowRight":l==="horizontal"&&(m?D():L());break;case"ArrowDown":l==="vertical"&&D();break;case"ArrowLeft":l==="horizontal"&&(m?L():D());break;case"ArrowUp":l==="vertical"&&L();break}const k=_%N;S[k].ref.current?.focus()});return o.jsx(Qae,{scope:n,disabled:a,direction:i,orientation:l,children:o.jsx(s1.Slot,{scope:n,children:o.jsx(ut.div,{...u,"data-orientation":l,ref:h,onKeyDown:a?void 0:b})})})}),zh="AccordionItem",[Zae,o1]=Up(zh),RL=R.forwardRef((e,t)=>{const{__scopeAccordion:n,value:a,...i}=e,l=qp(zh,n),u=Kae(zh,n),d=i1(n),h=ma(),p=a&&u.value.includes(a)||!1,v=l.disabled||e.disabled;return o.jsx(Zae,{scope:n,open:p,disabled:v,triggerId:h,children:o.jsx(Hae,{"data-orientation":l.orientation,"data-state":kL(p),...d,...i,ref:t,disabled:v,open:p,onOpenChange:m=>{m?u.onItemOpen(a):u.onItemClose(a)}})})});RL.displayName=zh;var AL="AccordionHeader",OL=R.forwardRef((e,t)=>{const{__scopeAccordion:n,...a}=e,i=qp(ja,n),l=o1(AL,n);return o.jsx(ut.h3,{"data-orientation":i.orientation,"data-state":kL(l.open),"data-disabled":l.disabled?"":void 0,...a,ref:t})});OL.displayName=AL;var V0="AccordionTrigger",ML=R.forwardRef((e,t)=>{const{__scopeAccordion:n,...a}=e,i=qp(ja,n),l=o1(V0,n),u=Yae(V0,n),d=i1(n);return o.jsx(s1.ItemSlot,{scope:n,children:o.jsx(Uae,{"aria-disabled":l.open&&!u.collapsible||void 0,"data-orientation":i.orientation,id:l.triggerId,...d,...a,ref:t})})});ML.displayName=V0;var DL="AccordionContent",PL=R.forwardRef((e,t)=>{const{__scopeAccordion:n,...a}=e,i=qp(ja,n),l=o1(DL,n),u=i1(n);return o.jsx(qae,{role:"region","aria-labelledby":l.triggerId,"data-orientation":i.orientation,...u,...a,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});PL.displayName=DL;function kL(e){return e?"open":"closed"}var Jae=NL,ese=RL,tse=OL,LL=ML,BL=PL;const l1=Jae,Kn=g.forwardRef(({className:e,...t},n)=>o.jsx(ese,{ref:n,className:lt("border-b",e),...t}));Kn.displayName="AccordionItem";const Yn=g.forwardRef(({className:e,children:t,...n},a)=>o.jsx(tse,{className:"flex",children:o.jsxs(LL,{ref:a,className:lt("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,o.jsx(cw,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Yn.displayName=LL.displayName;const Wn=g.forwardRef(({className:e,children:t,...n},a)=>o.jsx(BL,{ref:a,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:o.jsx("div",{className:lt("pb-4 pt-0 px-2",e),children:t})}));Wn.displayName=BL.displayName;var Lb="rovingFocusGroup.onEntryFocus",nse={bubbles:!1,cancelable:!0},fd="RovingFocusGroup",[$0,IL,rse]=vp(fd),[ase,zL]=Lr(fd,[rse]),[sse,ise]=ase(fd),FL=g.forwardRef((e,t)=>o.jsx($0.Provider,{scope:e.__scopeRovingFocusGroup,children:o.jsx($0.Slot,{scope:e.__scopeRovingFocusGroup,children:o.jsx(ose,{...e,ref:t})})}));FL.displayName=fd;var ose=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:a,loop:i=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:h,onEntryFocus:p,preventScrollOnEntryFocus:v=!1,...m}=e,b=g.useRef(null),w=At(t,b),C=od(l),[S,j]=Zr({prop:u,defaultProp:d??null,onChange:h,caller:fd}),[N,_]=g.useState(!1),T=gi(p),A=IL(n),D=g.useRef(!1),[L,k]=g.useState(0);return g.useEffect(()=>{const P=b.current;if(P)return P.addEventListener(Lb,T),()=>P.removeEventListener(Lb,T)},[T]),o.jsx(sse,{scope:n,orientation:a,dir:C,loop:i,currentTabStopId:S,onItemFocus:g.useCallback(P=>j(P),[j]),onItemShiftTab:g.useCallback(()=>_(!0),[]),onFocusableItemAdd:g.useCallback(()=>k(P=>P+1),[]),onFocusableItemRemove:g.useCallback(()=>k(P=>P-1),[]),children:o.jsx(ut.div,{tabIndex:N||L===0?-1:0,"data-orientation":a,...m,ref:w,style:{outline:"none",...e.style},onMouseDown:Je(e.onMouseDown,()=>{D.current=!0}),onFocus:Je(e.onFocus,P=>{const U=!D.current;if(P.target===P.currentTarget&&U&&!N){const J=new CustomEvent(Lb,nse);if(P.currentTarget.dispatchEvent(J),!J.defaultPrevented){const $=A().filter(I=>I.focusable),W=$.find(I=>I.active),pe=$.find(I=>I.id===S),Ce=[W,pe,...$].filter(Boolean).map(I=>I.ref.current);qL(Ce,v)}}D.current=!1}),onBlur:Je(e.onBlur,()=>_(!1))})})}),HL="RovingFocusGroupItem",UL=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:a=!0,active:i=!1,tabStopId:l,children:u,...d}=e,h=ma(),p=l||h,v=ise(HL,n),m=v.currentTabStopId===p,b=IL(n),{onFocusableItemAdd:w,onFocusableItemRemove:C,currentTabStopId:S}=v;return g.useEffect(()=>{if(a)return w(),()=>C()},[a,w,C]),o.jsx($0.ItemSlot,{scope:n,id:p,focusable:a,active:i,children:o.jsx(ut.span,{tabIndex:m?0:-1,"data-orientation":v.orientation,...d,ref:t,onMouseDown:Je(e.onMouseDown,j=>{a?v.onItemFocus(p):j.preventDefault()}),onFocus:Je(e.onFocus,()=>v.onItemFocus(p)),onKeyDown:Je(e.onKeyDown,j=>{if(j.key==="Tab"&&j.shiftKey){v.onItemShiftTab();return}if(j.target!==j.currentTarget)return;const N=use(j,v.orientation,v.dir);if(N!==void 0){if(j.metaKey||j.ctrlKey||j.altKey||j.shiftKey)return;j.preventDefault();let T=b().filter(A=>A.focusable).map(A=>A.ref.current);if(N==="last")T.reverse();else if(N==="prev"||N==="next"){N==="prev"&&T.reverse();const A=T.indexOf(j.currentTarget);T=v.loop?dse(T,A+1):T.slice(A+1)}setTimeout(()=>qL(T))}}),children:typeof u=="function"?u({isCurrentTabStop:m,hasTabStop:S!=null}):u})})});UL.displayName=HL;var lse={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function cse(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function use(e,t,n){const a=cse(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(a))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(a)))return lse[a]}function qL(e,t=!1){const n=document.activeElement;for(const a of e)if(a===n||(a.focus({preventScroll:t}),document.activeElement!==n))return}function dse(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var fse=FL,hse=UL,c1="Radio",[pse,VL]=Lr(c1),[mse,gse]=pse(c1),$L=g.forwardRef((e,t)=>{const{__scopeRadio:n,name:a,checked:i=!1,required:l,disabled:u,value:d="on",onCheck:h,form:p,...v}=e,[m,b]=g.useState(null),w=At(t,j=>b(j)),C=g.useRef(!1),S=m?p||!!m.closest("form"):!0;return o.jsxs(mse,{scope:n,checked:i,disabled:u,children:[o.jsx(ut.button,{type:"button",role:"radio","aria-checked":i,"data-state":WL(i),"data-disabled":u?"":void 0,disabled:u,value:d,...v,ref:w,onClick:Je(e.onClick,j=>{i||h?.(),S&&(C.current=j.isPropagationStopped(),C.current||j.stopPropagation())})}),S&&o.jsx(YL,{control:m,bubbles:!C.current,name:a,value:d,checked:i,required:l,disabled:u,form:p,style:{transform:"translateX(-100%)"}})]})});$L.displayName=c1;var GL="RadioIndicator",KL=g.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:a,...i}=e,l=gse(GL,n);return o.jsx(Ts,{present:a||l.checked,children:o.jsx(ut.span,{"data-state":WL(l.checked),"data-disabled":l.disabled?"":void 0,...i,ref:t})})});KL.displayName=GL;var vse="RadioBubbleInput",YL=g.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:a=!0,...i},l)=>{const u=g.useRef(null),d=At(u,l),h=gp(n),p=lp(t);return g.useEffect(()=>{const v=u.current;if(!v)return;const m=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(m,"checked").set;if(h!==n&&w){const C=new Event("click",{bubbles:a});w.call(v,n),v.dispatchEvent(C)}},[h,n,a]),o.jsx(ut.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:d,style:{...i.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});YL.displayName=vse;function WL(e){return e?"checked":"unchecked"}var xse=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Vp="RadioGroup",[yse]=Lr(Vp,[zL,VL]),XL=zL(),QL=VL(),[bse,wse]=yse(Vp),ZL=g.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:a,defaultValue:i,value:l,required:u=!1,disabled:d=!1,orientation:h,dir:p,loop:v=!0,onValueChange:m,...b}=e,w=XL(n),C=od(p),[S,j]=Zr({prop:l,defaultProp:i??null,onChange:m,caller:Vp});return o.jsx(bse,{scope:n,name:a,required:u,disabled:d,value:S,onValueChange:j,children:o.jsx(fse,{asChild:!0,...w,orientation:h,dir:C,loop:v,children:o.jsx(ut.div,{role:"radiogroup","aria-required":u,"aria-orientation":h,"data-disabled":d?"":void 0,dir:C,...b,ref:t})})})});ZL.displayName=Vp;var JL="RadioGroupItem",e4=g.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:a,...i}=e,l=wse(JL,n),u=l.disabled||a,d=XL(n),h=QL(n),p=g.useRef(null),v=At(t,p),m=l.value===i.value,b=g.useRef(!1);return g.useEffect(()=>{const w=S=>{xse.includes(S.key)&&(b.current=!0)},C=()=>b.current=!1;return document.addEventListener("keydown",w),document.addEventListener("keyup",C),()=>{document.removeEventListener("keydown",w),document.removeEventListener("keyup",C)}},[]),o.jsx(hse,{asChild:!0,...d,focusable:!u,active:m,children:o.jsx($L,{disabled:u,required:l.required,checked:m,...h,...i,name:l.name,ref:v,onCheck:()=>l.onValueChange(i.value),onKeyDown:Je(w=>{w.key==="Enter"&&w.preventDefault()}),onFocus:Je(i.onFocus,()=>{b.current&&p.current?.click()})})})});e4.displayName=JL;var Sse="RadioGroupIndicator",t4=g.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...a}=e,i=QL(n);return o.jsx(KL,{...i,...a,ref:t})});t4.displayName=Sse;var n4=ZL,r4=e4,Cse=t4;const ch=g.forwardRef(({className:e,...t},n)=>o.jsx(n4,{className:lt("grid gap-2",e),...t,ref:n}));ch.displayName=n4.displayName;const ys=g.forwardRef(({className:e,...t},n)=>o.jsx(r4,{ref:n,className:lt("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:o.jsx(Cse,{className:"flex items-center justify-center",children:o.jsx(QH,{className:"h-2.5 w-2.5 fill-current text-current"})})}));ys.displayName=r4.displayName;function Bb({value:e,onValueChange:t,options:n,placeholder:a="Select...",searchPlaceholder:i="Search...",emptyMessage:l="No results found",className:u,disabled:d}){const[h,p]=g.useState(!1),[v,m]=g.useState(""),b=n.find(S=>S.value===e),w=g.useMemo(()=>v?n.filter(S=>Au(S.label,v)||Au(S.value,v)):n,[n,v]),C=S=>{t(S),p(!1),m("")};return o.jsxs(Bu,{open:h,onOpenChange:p,children:[o.jsx(Iu,{asChild:!0,children:o.jsxs(se,{variant:"secondary",role:"combobox","aria-expanded":h,disabled:d,className:lt("w-full justify-between font-normal",!e&&"text-muted-foreground",u),children:[o.jsx("span",{className:"truncate",children:b?.label||a}),o.jsx("span",{className:"material-icons text-base ml-2 shrink-0 opacity-50",children:"unfold_more"})]})}),o.jsx(Rl,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:o.jsxs("div",{className:"flex flex-col",children:[o.jsx("div",{className:"p-2 border-b",children:o.jsx(bt,{placeholder:i,value:v,onChange:S=>m(S.target.value),className:"h-8",autoFocus:!0})}),o.jsx("div",{className:"max-h-[200px] overflow-y-auto",children:w.length===0?o.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:l}):w.map(S=>o.jsxs("button",{type:"button",className:lt("w-full px-3 py-2 text-left text-sm hover:bg-accent hover:text-accent-foreground flex items-center gap-2",e===S.value&&"bg-accent"),onClick:()=>C(S.value),children:[o.jsx("span",{className:lt("material-icons text-base",e===S.value?"opacity-100":"opacity-0"),children:"check"}),o.jsx("span",{className:"truncate",children:S.label})]},S.value))})]})})]})}const jO=["Shifting the sands...","Aligning the stars...","Polishing the steel ball...","Recalculating the spirals...","Tuning the motors...","Almost there..."];function jse({open:e,onOpenChange:t,currentVersion:n,latestVersion:a}){const[i,l]=g.useState("confirming"),[u,d]=g.useState(""),[h,p]=g.useState(0),v=g.useRef(null),m=g.useRef(!1),b=un(S=>S.isBackendConnected);g.useEffect(()=>{e||(v.current&&clearInterval(v.current),l("confirming"),d(""),p(0),m.current=!1)},[e]),g.useEffect(()=>{i==="updating"&&(b?m.current&&l("complete"):m.current=!0)},[i,b]),g.useEffect(()=>{if(i!=="complete")return;const S=setTimeout(()=>window.location.reload(),2e3);return()=>clearTimeout(S)},[i]),g.useEffect(()=>{if(i==="updating")return v.current=setInterval(()=>{p(S=>(S+1)%jO.length)},4e3),()=>{v.current&&clearInterval(v.current)}},[i]);const w=async()=>{l("updating"),p(0),m.current=!1;try{const S=await fe.request("/api/update",{method:"POST"});S.success||(l("error"),d(S.message||"Update failed"))}catch(S){l("error"),d(S instanceof Error?S.message:"Failed to start update")}},C=i==="updating"||i==="complete";return o.jsx(ga,{open:e,onOpenChange:C?void 0:t,children:o.jsxs(Wr,{onPointerDownOutside:C?S=>S.preventDefault():void 0,onEscapeKeyDown:C?S=>S.preventDefault():void 0,className:C?"[&>button:last-child]:hidden":"",children:[i==="confirming"&&o.jsxs(o.Fragment,{children:[o.jsxs(Mr,{children:[o.jsx(Dr,{children:"Update Software"}),o.jsxs(vi,{children:["Update from v",n," to v",a]})]}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"The system will download the latest version and restart automatically. This usually takes 1-2 minutes."}),o.jsxs(va,{children:[o.jsx(se,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),o.jsx(se,{onClick:w,children:"Update Now"})]})]}),i==="updating"&&o.jsxs("div",{className:"flex flex-col items-center py-8 gap-6",children:[o.jsxs("div",{className:"relative w-16 h-16",children:[o.jsx("div",{className:"absolute inset-0 rounded-full border-4 border-muted"}),o.jsx("div",{className:"absolute inset-0 rounded-full border-4 border-t-primary animate-spin"}),o.jsx("div",{className:"absolute inset-[6px] rounded-full border-4 border-muted"}),o.jsx("div",{className:"absolute inset-[6px] rounded-full border-4 border-t-primary/60",style:{animation:"spin 1.5s linear infinite reverse"}})]}),o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx("p",{className:"text-lg font-medium animate-pulse",children:jO[h]}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["This usually takes 1-2 minutes.",o.jsx("br",{}),"The page will reload automatically."]})]})]}),i==="complete"&&o.jsxs("div",{className:"flex flex-col items-center py-8 gap-4",children:[o.jsx("div",{className:"w-16 h-16 flex items-center justify-center rounded-full bg-green-100 dark:bg-green-900/30",children:o.jsx("span",{className:"material-icons text-green-600 dark:text-green-400 text-4xl",children:"check_circle"})}),o.jsxs("div",{className:"text-center space-y-1",children:[o.jsx("p",{className:"text-lg font-medium",children:"Update complete!"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Reloading..."})]})]}),i==="error"&&o.jsxs(o.Fragment,{children:[o.jsxs(Mr,{children:[o.jsx(Dr,{children:"Update Failed"}),o.jsx(vi,{children:"Something went wrong while starting the update."})]}),o.jsx("div",{className:"rounded-lg bg-destructive/10 p-3",children:o.jsx("p",{className:"text-sm text-destructive",children:u})}),o.jsxs(va,{children:[o.jsx(se,{variant:"outline",onClick:()=>t(!1),children:"Close"}),o.jsx(se,{onClick:w,children:"Retry"})]})]})]})})}function Nse(){const[e,t]=$6(),n=kl(),a=e.get("section"),[i,l]=g.useState([]),[u,d]=g.useState(""),[h,p]=g.useState(!1),[v,m]=g.useState("Disconnected"),[b,w]=g.useState({}),[C,S]=g.useState({provider:"none",gpio_pin:18}),[j,N]=g.useState("60"),[_,T]=g.useState({enabled:!1}),[A,D]=g.useState(null),[L,k]=g.useState(()=>a?[a]:["connection"]),[P,U]=g.useState(new Set),[J,$]=g.useState({enabled:!1,playlist:"",run_mode:"loop",pause_time:5,clear_pattern:"adaptive",shuffle:!1}),[W,pe]=g.useState("min"),[Se,Ce]=g.useState(5),[I,q]=g.useState("5"),[H,be]=g.useState([]),Ne=O=>O>=3600&&O%3600===0?{value:O/3600,unit:"hr"}:O>=60&&O%60===0?{value:O/60,unit:"min"}:{value:O,unit:"sec"},B=(O,de)=>{switch(de){case"hr":return O*3600;case"min":return O*60;default:return O}},[G,X]=g.useState({enabled:!1,finish_pattern:!1,control_wled:!1,timezone:"",time_slots:[]}),[oe,xe]=g.useState([]),[Q,te]=g.useState("off"),[he,_e]=g.useState(""),[je,Me]=g.useState(""),[ce,He]=g.useState(!1),[Le,Ue]=g.useState(null),[wt,$e]=g.useState(!1),Ot=O=>{const de=document.getElementById(`section-${O}`);if(de){const Ge=de.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:Ge-80,behavior:"smooth"})}};g.useEffect(()=>{a&&setTimeout(()=>{Ot(a),t({},{replace:!0})},100)},[a,t]);const St=async O=>{if(!P.has(O))switch(U(de=>new Set(de).add(O)),O){case"connection":await at(),P.has("_settings")||(U(de=>new Set(de).add("_settings")),await vt());break;case"application":case"mqtt":case"autoplay":case"stillsands":case"machine":case"homing":case"clearing":case"security":P.has("_settings")||(U(de=>new Set(de).add("_settings")),await vt()),(O==="autoplay"||O==="clearing")&&!P.has("_playlists")&&(U(de=>new Set(de).add("_playlists")),await Yt()),O==="clearing"&&!P.has("_patterns")&&(U(de=>new Set(de).add("_patterns")),await Et());break;case"led":await Kt();break;case"version":await jt();break}},Et=async()=>{try{const O=await fe.get("/list_theta_rho_files");xe(Array.isArray(O)?O:[])}catch(O){console.error("Error fetching pattern files:",O)}},jt=async()=>{try{const O=await fe.get("/api/version");Ue(O)}catch(O){console.error("Failed to fetch version info:",O)}},ot=O=>{const de=O.find(me=>!L.includes(me));k(O),O.forEach(me=>{P.has(me)||St(me)}),de&&setTimeout(()=>{Ot(de)},100)};g.useEffect(()=>{L.forEach(O=>{St(O)})},[]);const at=async()=>{try{const de=await fe.get("/list_serial_ports")||[];l(de);const me=await fe.get("/serial_status");p(me.connected||!1),m(me.connected?"Connected":"Disconnected"),me.port&&de.includes(me.port)?d(me.port):me.port&&!de.includes(me.port)&&(console.warn(`Port ${me.port} from status not in available ports, ignoring`),d(""))}catch(O){console.error("Error fetching ports:",O)}};g.useEffect(()=>{at()},[]),cS(()=>{at()});const vt=async()=>{try{const O=await fe.get("/api/settings");if(w({app_name:O.app?.name,custom_logo:O.app?.custom_logo,preferred_port:O.connection?.preferred_port,table_type_override:O.machine?.table_type_override,detected_table_type:O.machine?.detected_table_type,effective_table_type:O.machine?.effective_table_type,gear_ratio:O.machine?.gear_ratio,gear_ratio_override:O.machine?.gear_ratio_override??null,x_steps_per_mm:O.machine?.x_steps_per_mm,y_steps_per_mm:O.machine?.y_steps_per_mm,available_table_types:O.machine?.available_table_types,homing_mode:O.homing?.mode,angular_offset:O.homing?.angular_offset_degrees,home_on_connect:O.homing?.home_on_connect,auto_home_enabled:O.homing?.auto_home_enabled,auto_home_after_patterns:O.homing?.auto_home_after_patterns,hard_reset_theta:O.homing?.hard_reset_theta,clear_pattern_speed:O.patterns?.clear_pattern_speed,custom_clear_from_in:O.patterns?.custom_clear_from_in,custom_clear_from_out:O.patterns?.custom_clear_from_out}),O.auto_play){const de=O.auto_play.pause_time??300,{value:me,unit:Ge}=Ne(de);Ce(me),q(String(me)),pe(Ge),$({enabled:O.auto_play.enabled||!1,playlist:O.auto_play.playlist||"",run_mode:O.auto_play.run_mode||"loop",pause_time:de,clear_pattern:O.auto_play.clear_pattern||"adaptive",shuffle:O.auto_play.shuffle||!1})}O.scheduled_pause&&X({enabled:O.scheduled_pause.enabled||!1,finish_pattern:O.scheduled_pause.finish_pattern||!1,control_wled:O.scheduled_pause.control_wled||!1,timezone:O.scheduled_pause.timezone||"",time_slots:O.scheduled_pause.time_slots||[]}),O.security&&(te(O.security.mode||"off"),He(O.security.has_password||!1)),O.mqtt&&T({enabled:O.mqtt.enabled||!1,broker:O.mqtt.broker,port:O.mqtt.port,username:O.mqtt.username,device_name:O.mqtt.device_name,device_id:O.mqtt.device_id,client_id:O.mqtt.client_id,discovery_prefix:O.mqtt.discovery_prefix})}catch(O){console.error("Error fetching settings:",O)}},Kt=async()=>{try{const O=await fe.get("/get_led_config");S({provider:O.provider||"none",wled_ip:O.wled_ip,num_leds:O.dw_led_num_leds,gpio_pin:O.dw_led_gpio_pin,pixel_order:O.dw_led_pixel_order}),N(String(O.dw_led_num_leds||60))}catch(O){console.error("Error fetching LED config:",O)}},Yt=async()=>{try{const O=await fe.get("/list_all_playlists");be(Array.isArray(O)?O:[])}catch(O){console.error("Error fetching playlists:",O)}},Wt=async()=>{if(!u){K.error("Please select a port");return}D("connect");try{const O=await fe.post("/connect",{port:u});if(O.success)p(!0),m(`Connected to ${u}`),K.success("Connected successfully");else throw new Error(O.message||"Connection failed")}catch{K.error("Failed to connect")}finally{D(null)}},ne=async()=>{D("disconnect");try{(await fe.post("/disconnect")).success&&(p(!1),m("Disconnected"),K.success("Disconnected"))}catch{K.error("Failed to disconnect")}finally{D(null)}},Re=async()=>{D("preferredPort");try{const O=b.preferred_port||"__auto__";await fe.patch("/api/settings",{connection:{preferred_port:O}}),!b.preferred_port||b.preferred_port==="__auto__"?K.success("Auto-connect: Auto (first available port)"):b.preferred_port==="__none__"?K.success("Auto-connect: Disabled"):K.success(`Auto-connect: ${b.preferred_port}`)}catch{K.error("Failed to save auto-connect setting")}finally{D(null)}},st=async()=>{D("appName");try{await fe.patch("/api/settings",{app:{name:b.app_name}}),K.success("App name saved. Refresh to see changes.")}catch{K.error("Failed to save app name")}finally{D(null)}},et=O=>{const de=Date.now(),me=document.getElementById("favicon-ico"),Ge=document.getElementById("apple-touch-icon");O?(me&&(me.href=fe.getAssetUrl(`/static/custom/favicon.ico?v=${de}`)),Ge&&(Ge.href=fe.getAssetUrl(`/static/custom/${O}?v=${de}`))):(me&&(me.href=fe.getAssetUrl(`/static/favicon.ico?v=${de}`)),Ge&&(Ge.href=fe.getAssetUrl(`/static/apple-touch-icon.png?v=${de}`))),window.dispatchEvent(new CustomEvent("branding-updated"))},xt=async O=>{const de=O.target.files?.[0];if(de){D("logo");try{const me=await fe.uploadFile("/api/upload-logo",de,"file");w({...b,custom_logo:me.filename}),et(me.filename),K.success("Logo uploaded!")}catch(me){K.error(me instanceof Error?me.message:"Failed to upload logo")}finally{D(null),O.target.value=""}}},mt=async()=>{if(confirm("Remove custom logo and revert to default?")){D("logo");try{await fe.delete("/api/custom-logo"),w({...b,custom_logo:void 0}),et(null),K.success("Logo removed!")}catch{K.error("Failed to remove logo")}finally{D(null)}}},gt=async()=>{D("led");try{await fe.post("/set_led_config",{provider:C.provider,ip_address:C.wled_ip,num_leds:C.num_leds,gpio_pin:C.gpio_pin,pixel_order:C.pixel_order}),K.success("LED configuration saved")}catch(O){K.error(O instanceof Error?O.message:"Failed to save LED config")}finally{D(null)}},qt=async()=>{D("mqtt");try{await fe.patch("/api/settings",{mqtt:{enabled:_.enabled,broker:_.broker,port:_.port,username:_.username,password:_.password,device_name:_.device_name,device_id:_.device_id,client_id:_.client_id,discovery_prefix:_.discovery_prefix}}),K.success("MQTT configuration saved. Restart required.")}catch{K.error("Failed to save MQTT config")}finally{D(null)}},ue=async()=>{if(!_.broker){K.error("Please enter a broker address");return}D("mqttTest");try{const O=await fe.post("/api/mqtt-test",{broker:_.broker,port:_.port||1883,username:_.username||"",password:_.password||""});O.success?K.success("MQTT connection successful!"):K.error(O.error||"Connection failed")}catch{K.error("Failed to test MQTT connection")}finally{D(null)}},Te=async()=>{D("machine");try{await fe.patch("/api/settings",{machine:{table_type_override:b.table_type_override||"",gear_ratio_override:b.gear_ratio_override??0}}),K.success("Machine settings saved")}catch{K.error("Failed to save machine settings")}finally{D(null)}},De=async()=>{D("homing");try{await fe.patch("/api/settings",{homing:{mode:b.homing_mode,angular_offset_degrees:b.angular_offset,home_on_connect:b.home_on_connect,auto_home_enabled:b.auto_home_enabled,auto_home_after_patterns:b.auto_home_after_patterns,hard_reset_theta:b.hard_reset_theta}}),K.success("Homing configuration saved")}catch{K.error("Failed to save homing configuration")}finally{D(null)}},Xe=async()=>{D("clearing");try{await fe.patch("/api/settings",{patterns:{clear_pattern_speed:b.clear_pattern_speed??0,custom_clear_from_in:b.custom_clear_from_in||null,custom_clear_from_out:b.custom_clear_from_out||null}}),K.success("Clearing settings saved")}catch{K.error("Failed to save clearing settings")}finally{D(null)}},Oe=async()=>{D("autoplay");try{const O=B(Se,W);await fe.patch("/api/settings",{auto_play:{...J,pause_time:O}}),K.success("Auto-play settings saved")}catch{K.error("Failed to save auto-play settings")}finally{D(null)}},Qe=async()=>{D("stillsands");try{await fe.patch("/api/settings",{scheduled_pause:G}),K.success("Still Sands settings saved")}catch{K.error("Failed to save Still Sands settings")}finally{D(null)}},dt=()=>{X({...G,time_slots:[...G.time_slots,{start_time:"22:00",end_time:"06:00",days:"daily",custom_days:[]}]})},ht=O=>{X({...G,time_slots:G.time_slots.filter((de,me)=>me!==O)})},z=(O,de)=>{const me=[...G.time_slots];me[O]={...me[O],...de},X({...G,time_slots:me})};return o.jsxs("div",{className:"flex flex-col w-full max-w-5xl mx-auto gap-6 py-3 sm:py-6 px-0 sm:px-4",children:[o.jsxs("div",{className:"space-y-0.5 sm:space-y-1 pl-1",children:[o.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Settings"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure your sand table"})]}),o.jsx(Xn,{}),o.jsxs(l1,{type:"multiple",value:L,onValueChange:ot,className:"space-y-3",children:[o.jsxs(Kn,{value:"connection",id:"section-connection",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Yn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"usb"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Device Connection"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Serial port configuration"})]})]})}),o.jsxs(Wn,{className:"pt-4 pb-6 space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:`w-10 h-10 flex items-center justify-center rounded-lg ${h?"bg-green-100 dark:bg-green-900":"bg-muted"}`,children:o.jsx("span",{className:`material-icons ${h?"text-green-600":"text-muted-foreground"}`,children:h?"usb":"usb_off"})}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:"Status"}),o.jsx("p",{className:`text-sm ${h?"text-green-600":"text-destructive"}`,children:v})]})]}),h&&o.jsx(se,{variant:"destructive",size:"sm",onClick:ne,disabled:A==="disconnect",children:"Disconnect"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{children:"Available Serial Ports"}),o.jsxs("div",{className:"flex gap-3",children:[o.jsxs(Pn,{value:u,onValueChange:d,children:[o.jsx(An,{className:"flex-1",children:o.jsx(Hn,{placeholder:"Select a port..."})}),o.jsx(On,{children:i.length===0?o.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"No serial ports found"}):i.map(O=>o.jsx(nt,{value:O,children:O},O))})]}),o.jsxs(se,{onClick:Wt,disabled:A==="connect"||!u||h,className:"gap-2",children:[A==="connect"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"cable"}),"Connect"]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Select a port and click 'Connect' to establish a connection."})]}),o.jsx(Xn,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{children:"Auto-Connect"}),o.jsxs("div",{className:"flex gap-3",children:[o.jsxs(Pn,{value:b.preferred_port||"__auto__",onValueChange:O=>w({...b,preferred_port:O==="__auto__"?void 0:O}),children:[o.jsx(An,{className:"flex-1",children:o.jsx(Hn,{placeholder:"Select auto-connect option..."})}),o.jsxs(On,{children:[o.jsx(nt,{value:"__auto__",children:"Auto (pick first available)"}),o.jsx(nt,{value:"__none__",children:"Disabled (no auto-connect)"}),i.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:"Available Ports"}),i.map(O=>o.jsx(nt,{value:O,children:O},O))]})]})]}),o.jsxs(se,{onClick:Re,disabled:A==="preferredPort",className:"gap-2",children:[A==="preferredPort"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save"]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose how the system connects on startup: Auto picks the first available port, Disabled requires manual connection, or select a specific port."})]}),o.jsx("div",{className:"p-4 rounded-lg border space-y-3",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsxs("p",{className:"font-medium flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"power"}),"Home on Connect"]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Automatically home when connecting on startup. Disable to connect without homing and home manually later."})]}),o.jsx(Tr,{checked:b.home_on_connect!==!1,onCheckedChange:async O=>{w({...b,home_on_connect:O});try{await fe.patch("/api/settings",{homing:{home_on_connect:O}}),K.success(O?"Home on connect enabled":"Home on connect disabled")}catch{K.error("Failed to save setting")}}})]})})]})]}),o.jsxs(Kn,{value:"machine",id:"section-machine",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Yn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"precision_manufacturing"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Machine Settings"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Table type and hardware configuration"})]})]})}),o.jsxs(Wn,{className:"pt-4 pb-6 space-y-6",children:[o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[o.jsxs("div",{className:"p-3 rounded-lg bg-muted/50",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Detected Type"}),o.jsx("p",{className:"font-medium text-sm",children:b.detected_table_type||"Unknown"})]}),o.jsxs("div",{className:"p-3 rounded-lg bg-muted/50",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Gear Ratio"}),o.jsx("p",{className:"font-medium text-sm",children:b.gear_ratio??"—"})]}),o.jsxs("div",{className:"p-3 rounded-lg bg-muted/50",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"X Steps/mm"}),o.jsx("p",{className:"font-medium text-sm",children:b.x_steps_per_mm??"—"})]}),o.jsxs("div",{className:"p-3 rounded-lg bg-muted/50",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Y Steps/mm"}),o.jsx("p",{className:"font-medium text-sm",children:b.y_steps_per_mm??"—"})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{children:"Table Type Override"}),o.jsxs("div",{className:"flex gap-3",children:[o.jsxs(Pn,{value:b.table_type_override||"auto",onValueChange:O=>w({...b,table_type_override:O==="auto"?void 0:O}),children:[o.jsx(An,{className:"flex-1",children:o.jsx(Hn,{placeholder:"Auto-detect (use detected type)"})}),o.jsxs(On,{children:[o.jsx(nt,{value:"auto",children:"Auto-detect (use detected type)"}),b.available_table_types?.map(O=>o.jsx(nt,{value:O.value,children:O.label},O.value))]})]}),o.jsxs(se,{onClick:Te,disabled:A==="machine",className:"gap-2",children:[A==="machine"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save"]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Override the automatically detected table type. This affects gear ratio calculations and homing behavior."})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{children:"Gear Ratio Override"}),o.jsxs("div",{className:"flex gap-3",children:[o.jsx(bt,{type:"number",step:.25,min:0,placeholder:"Auto-detect",value:b.gear_ratio_override??"",onChange:O=>w({...b,gear_ratio_override:O.target.value?parseFloat(O.target.value):null}),className:"flex-1"}),o.jsxs(se,{onClick:Te,disabled:A==="machine",className:"gap-2",children:[A==="machine"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save"]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Override the gear ratio used for angular/radial coupling compensation. Leave empty to auto-detect from table type (6.25 for mini, 10 for standard)."})]}),o.jsxs(mr,{className:"flex items-start",children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"info"}),o.jsx(gr,{children:"Table type is normally detected automatically from GRBL settings. Use override if auto-detection is incorrect for your hardware."})]}),o.jsxs(pi,{to:"/setup",className:"flex items-center justify-between w-full p-3 rounded-lg border hover:bg-muted/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"build"}),o.jsxs("div",{className:"text-left",children:[o.jsx("p",{className:"font-medium text-sm",children:"Hardware Setup & Calibration"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Calibrate motor directions and edit FluidNC settings"})]})]}),o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"arrow_forward"})]})]})]}),o.jsxs(Kn,{value:"homing",id:"section-homing",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Yn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"home"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Homing Configuration"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Homing mode and auto-home settings"})]})]})}),o.jsxs(Wn,{className:"pt-4 pb-6 space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{children:"Homing Mode"}),o.jsxs(ch,{value:String(b.homing_mode||0),onValueChange:O=>w({...b,homing_mode:parseInt(O)}),className:"space-y-3",children:[o.jsxs("div",{className:"flex items-start gap-3 p-3 border rounded-lg cursor-pointer hover:bg-muted/50",children:[o.jsx(ys,{value:"0",id:"homing-crash",className:"mt-0.5"}),o.jsxs("div",{className:"flex-1",children:[o.jsx(Ke,{htmlFor:"homing-crash",className:"font-medium cursor-pointer",children:"Crash Homing"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Y axis moves until physical stop, then theta and rho set to 0"})]})]}),o.jsxs("div",{className:"flex items-start gap-3 p-3 border rounded-lg cursor-pointer hover:bg-muted/50",children:[o.jsx(ys,{value:"1",id:"homing-sensor",className:"mt-0.5"}),o.jsxs("div",{className:"flex-1",children:[o.jsx(Ke,{htmlFor:"homing-sensor",className:"font-medium cursor-pointer",children:"Sensor Homing"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Homes both X and Y axes using sensors"})]})]})]})]}),b.homing_mode===1&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{htmlFor:"angular-offset",children:"Sensor Offset (degrees)"}),o.jsx(bt,{id:"angular-offset",type:"number",min:"0",max:"360",step:"0.1",value:b.angular_offset??"",onChange:O=>w({...b,angular_offset:O.target.value===""?void 0:parseFloat(O.target.value)}),placeholder:"0.0"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Set the angle (in degrees) where your radial arm should be offset. Choose a value so the radial arm points East."})]}),o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsxs("p",{className:"font-medium flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"autorenew"}),"Auto-Home During Playlists"]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Perform homing after a set number of patterns to maintain accuracy"})]}),o.jsx(Tr,{checked:b.auto_home_enabled||!1,onCheckedChange:O=>w({...b,auto_home_enabled:O})})]}),b.auto_home_enabled&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{htmlFor:"auto-home-patterns",children:"Home after every X patterns"}),o.jsx(bt,{id:"auto-home-patterns",type:"number",min:"1",max:"100",value:b.auto_home_after_patterns||5,onChange:O=>w({...b,auto_home_after_patterns:parseInt(O.target.value)||5})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Homing occurs after each main pattern completes (clear patterns don't count)."})]})]}),o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsxs("p",{className:"font-medium flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base",children:"restart_alt"}),"Reset Machine on Theta Normalization"]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Also reset the machine controller when normalizing theta"})]}),o.jsx(Tr,{checked:b.hard_reset_theta||!1,onCheckedChange:O=>w({...b,hard_reset_theta:O})})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"When disabled (default), theta normalization only adjusts the angle mathematically. When enabled, also resets the machine controller to clear position counters."})]}),o.jsxs(se,{onClick:De,disabled:A==="homing",className:"gap-2",children:[A==="homing"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save Homing Configuration"]})]})]}),o.jsxs(Kn,{value:"application",id:"section-application",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Yn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"tune"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Application Settings"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Customize app name and branding"})]})]})}),o.jsxs(Wn,{className:"pt-4 pb-6 space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{children:"Custom Logo"}),o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4 p-4 rounded-lg border",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("div",{className:"w-16 h-16 rounded-full overflow-hidden border bg-background flex items-center justify-center shrink-0",children:b.custom_logo?o.jsx("img",{src:fe.getAssetUrl(`/static/custom/${b.custom_logo}`),alt:"Custom Logo",className:"w-full h-full object-cover"}):o.jsx("img",{src:fe.getAssetUrl("/static/android-chrome-192x192.png"),alt:"Default Logo",className:"w-full h-full object-cover"})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:"font-medium",children:b.custom_logo?"Custom logo active":"Using default logo"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"PNG, JPG, GIF, WebP or SVG (max 5MB)"})]})]}),o.jsxs("div",{className:"flex gap-2 sm:ml-auto",children:[o.jsxs(se,{variant:"secondary",size:"sm",className:"gap-2",disabled:A==="logo",onClick:()=>document.getElementById("logo-upload")?.click(),children:[A==="logo"?o.jsx("span",{className:"material-icons-outlined animate-spin text-base",children:"sync"}):o.jsx("span",{className:"material-icons-outlined text-base",children:"upload"}),"Upload"]}),b.custom_logo&&o.jsx(se,{variant:"secondary",size:"sm",className:"gap-2 text-destructive hover:text-destructive",disabled:A==="logo",onClick:mt,children:o.jsx("span",{className:"material-icons-outlined text-base",children:"delete"})})]}),o.jsx("input",{id:"logo-upload",type:"file",accept:".png,.jpg,.jpeg,.gif,.webp,.svg",className:"hidden",onChange:xt})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"A favicon will be automatically generated from your logo."})]}),o.jsx(Xn,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{htmlFor:"appName",children:"Application Name"}),o.jsxs("div",{className:"flex gap-3",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(bt,{id:"appName",value:b.app_name||"",onChange:O=>w({...b,app_name:O.target.value}),placeholder:"e.g., Dune Weaver"}),o.jsx(se,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7 p-0",onClick:()=>w({...b,app_name:"Dune Weaver"}),children:o.jsx("span",{className:"material-icons text-base",children:"restart_alt"})})]}),o.jsxs(se,{onClick:st,disabled:A==="appName",className:"gap-2",children:[A==="appName"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save"]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"This name appears in the browser tab and header."})]})]})]}),o.jsxs(Kn,{value:"clearing",id:"section-clearing",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Yn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"cleaning_services"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Pattern Clearing"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Customize clearing speed and patterns"})]})]})}),o.jsxs(Wn,{className:"pt-4 pb-6 space-y-6",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Customize the clearing behavior used when transitioning between patterns."}),o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsx("h4",{className:"font-medium",children:"Clearing Speed"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Set a custom speed for clearing patterns. Leave empty to use the default pattern speed."}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{htmlFor:"clear-speed",children:"Speed (steps per minute)"}),o.jsx(bt,{id:"clear-speed",type:"number",min:"50",max:"2000",step:"50",value:b.clear_pattern_speed||"",onChange:O=>w({...b,clear_pattern_speed:O.target.value?parseInt(O.target.value):void 0}),placeholder:"Default (use pattern speed)"})]})]}),o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsx("h4",{className:"font-medium",children:"Custom Clear Patterns"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose specific patterns to use when clearing. Leave empty for default behavior."}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{htmlFor:"clear-from-in",children:"Clear From Center Pattern"}),o.jsx(Bb,{value:b.custom_clear_from_in||"__default__",onValueChange:O=>w({...b,custom_clear_from_in:O==="__default__"?void 0:O}),options:[{value:"__default__",label:"Default (built-in)"},...oe.map(O=>({value:O,label:O}))],placeholder:"Default (built-in)",searchPlaceholder:"Search patterns...",emptyMessage:"No patterns found"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Pattern used when clearing from center outward."})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{htmlFor:"clear-from-out",children:"Clear From Perimeter Pattern"}),o.jsx(Bb,{value:b.custom_clear_from_out||"__default__",onValueChange:O=>w({...b,custom_clear_from_out:O==="__default__"?void 0:O}),options:[{value:"__default__",label:"Default (built-in)"},...oe.map(O=>({value:O,label:O}))],placeholder:"Default (built-in)",searchPlaceholder:"Search patterns...",emptyMessage:"No patterns found"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Pattern used when clearing from perimeter inward."})]})]})]}),o.jsxs(se,{onClick:Xe,disabled:A==="clearing",className:"gap-2",children:[A==="clearing"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save Clearing Settings"]})]})]}),o.jsxs(Kn,{value:"led",id:"section-led",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Yn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"lightbulb"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"LED Controller"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"WLED or local GPIO LED control"})]})]})}),o.jsxs(Wn,{className:"pt-4 pb-6 space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{children:"LED Provider"}),o.jsxs(ch,{value:C.provider,onValueChange:O=>S({...C,provider:O}),className:"flex gap-4",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(ys,{value:"none",id:"led-none"}),o.jsx(Ke,{htmlFor:"led-none",className:"font-normal",children:"None"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(ys,{value:"wled",id:"led-wled"}),o.jsx(Ke,{htmlFor:"led-wled",className:"font-normal",children:"WLED"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(ys,{value:"dw_leds",id:"led-dw"}),o.jsx(Ke,{htmlFor:"led-dw",className:"font-normal",children:"DW LEDs (GPIO)"})]})]})]}),C.provider==="wled"&&o.jsxs("div",{className:"space-y-3 p-4 rounded-lg border",children:[o.jsx(Ke,{htmlFor:"wledIp",children:"WLED IP Address"}),o.jsx(bt,{id:"wledIp",value:C.wled_ip||"",onChange:O=>S({...C,wled_ip:O.target.value}),placeholder:"e.g., 192.168.1.100"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter the IP address of your WLED controller"})]}),C.provider==="dw_leds"&&o.jsxs("div",{className:"space-y-3 p-4 rounded-lg border",children:[o.jsxs(mr,{className:"flex items-start",children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"info"}),o.jsx(gr,{children:"Supports WS2812, WS2812B, SK6812 and other WS281x LED strips"})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{htmlFor:"numLeds",children:"Number of LEDs"}),o.jsx(bt,{id:"numLeds",type:"text",inputMode:"numeric",value:j,onChange:O=>{const de=O.target.value.replace(/[^0-9]/g,"");N(de)},onBlur:()=>{const O=Math.min(1e3,Math.max(1,parseInt(j)||60));S({...C,num_leds:O}),N(String(O))},onKeyDown:O=>{if(O.key==="Enter"){const de=Math.min(1e3,Math.max(1,parseInt(j)||60));S({...C,num_leds:de}),N(String(de))}}})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{htmlFor:"gpioPin",children:"GPIO Pin"}),o.jsxs(Pn,{value:String(C.gpio_pin||18),onValueChange:O=>S({...C,gpio_pin:parseInt(O)}),children:[o.jsx(An,{children:o.jsx(Hn,{})}),o.jsxs(On,{children:[o.jsx(nt,{value:"12",children:"GPIO 12 (PWM0)"}),o.jsx(nt,{value:"13",children:"GPIO 13 (PWM1)"}),o.jsx(nt,{value:"18",children:"GPIO 18 (PWM0)"}),o.jsx(nt,{value:"19",children:"GPIO 19 (PWM1)"})]})]})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{htmlFor:"pixelOrder",children:"Pixel Color Order"}),o.jsxs(Pn,{value:C.pixel_order||"RGB",onValueChange:O=>S({...C,pixel_order:O}),children:[o.jsx(An,{children:o.jsx(Hn,{})}),o.jsxs(On,{children:[o.jsxs(TT,{children:[o.jsx(D0,{children:"RGB Strips (3-channel)"}),o.jsx(nt,{value:"RGB",children:"RGB - WS2815/WS2811"}),o.jsx(nt,{value:"GRB",children:"GRB - WS2812/WS2812B"}),o.jsx(nt,{value:"BGR",children:"BGR - Some WS2811 variants"}),o.jsx(nt,{value:"RBG",children:"RBG - Rare variant"}),o.jsx(nt,{value:"GBR",children:"GBR - Rare variant"}),o.jsx(nt,{value:"BRG",children:"BRG - Rare variant"})]}),o.jsxs(TT,{children:[o.jsx(D0,{children:"RGBW Strips (4-channel)"}),o.jsx(nt,{value:"GRBW",children:"GRBW - SK6812 RGBW"}),o.jsx(nt,{value:"RGBW",children:"RGBW - SK6812 variant"})]})]})]})]})]}),o.jsxs(se,{onClick:gt,disabled:A==="led",className:"gap-2",children:[A==="led"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save LED Configuration"]})]})]}),o.jsxs(Kn,{value:"mqtt",id:"section-mqtt",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Yn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"home"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Home Assistant Integration"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"MQTT configuration for smart home control"})]})]})}),o.jsxs(Wn,{className:"pt-4 pb-6 space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:"Enable MQTT"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect to Home Assistant via MQTT"})]}),o.jsx(Tr,{checked:_.enabled,onCheckedChange:O=>T({..._,enabled:O})})]}),_.enabled&&o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsxs(Ke,{htmlFor:"mqttBroker",children:["Broker Address ",o.jsx("span",{className:"text-destructive",children:"*"})]}),o.jsx(bt,{id:"mqttBroker",value:_.broker||"",onChange:O=>T({..._,broker:O.target.value}),placeholder:"e.g., 192.168.1.100"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{htmlFor:"mqttPort",children:"Port"}),o.jsx(bt,{id:"mqttPort",type:"number",value:_.port||1883,onChange:O=>T({..._,port:parseInt(O.target.value)}),placeholder:"1883"})]})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{htmlFor:"mqttUser",children:"Username"}),o.jsx(bt,{id:"mqttUser",value:_.username||"",onChange:O=>T({..._,username:O.target.value}),placeholder:"Optional"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{htmlFor:"mqttPass",children:"Password"}),o.jsx(bt,{id:"mqttPass",type:"password",value:_.password||"",onChange:O=>T({..._,password:O.target.value}),placeholder:"Optional"})]})]}),o.jsx(Xn,{}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{htmlFor:"mqttDeviceName",children:"Device Name"}),o.jsx(bt,{id:"mqttDeviceName",value:_.device_name||"Dune Weaver",onChange:O=>T({..._,device_name:O.target.value})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{htmlFor:"mqttDeviceId",children:"Device ID"}),o.jsx(bt,{id:"mqttDeviceId",value:_.device_id||"dune_weaver",onChange:O=>T({..._,device_id:O.target.value})})]}),o.jsxs("div",{className:"space-y-3 md:col-span-2",children:[o.jsx(Ke,{htmlFor:"mqttClientId",children:"Client ID (optional)"}),o.jsx(bt,{id:"mqttClientId",value:_.client_id||"",onChange:O=>T({..._,client_id:O.target.value}),placeholder:"Auto (unique ID based on Device ID)"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:_.client_id?.trim()?"Using custom Client ID override. Must be unique per table on the broker.":"Leave empty to auto-generate a unique broker client ID from the Device ID."})]})]}),o.jsxs(mr,{className:"flex items-start",children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"info"}),o.jsx(gr,{children:"MQTT configuration changes require a restart to take effect."})]})]}),o.jsxs("div",{className:"flex flex-wrap gap-3",children:[o.jsxs(se,{onClick:qt,disabled:A==="mqtt",className:"gap-2",children:[A==="mqtt"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save MQTT Configuration"]}),_.enabled&&_.broker&&o.jsxs(se,{variant:"secondary",onClick:ue,disabled:A==="mqttTest",className:"gap-2",children:[A==="mqttTest"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"wifi_tethering"}),"Test Connection"]})]})]})]}),o.jsxs(Kn,{value:"autoplay",id:"section-autoplay",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Yn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"play_circle"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Auto-play on Boot"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Start a playlist automatically on startup"})]})]})}),o.jsxs(Wn,{className:"pt-4 pb-6 space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:"Enable Auto-play"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Automatically start playing when the system boots"})]}),o.jsx(Tr,{checked:J.enabled,onCheckedChange:O=>$({...J,enabled:O})})]}),J.enabled&&o.jsxs("div",{className:"space-y-3 p-4 rounded-lg border",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{children:"Startup Playlist"}),o.jsxs(Pn,{value:J.playlist||void 0,onValueChange:O=>$({...J,playlist:O}),children:[o.jsx(An,{children:o.jsx(Hn,{placeholder:"Select a playlist..."})}),o.jsx(On,{children:H.length===0?o.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"No playlists found"}):H.map(O=>o.jsx(nt,{value:O,children:O},O))})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose which playlist to play when the system starts."})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{children:"Run Mode"}),o.jsxs(Pn,{value:J.run_mode,onValueChange:O=>$({...J,run_mode:O}),children:[o.jsx(An,{children:o.jsx(Hn,{})}),o.jsxs(On,{children:[o.jsx(nt,{value:"single",children:"Single (play once)"}),o.jsx(nt,{value:"loop",children:"Loop (repeat forever)"})]})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{children:"Pause Between Patterns"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(bt,{type:"text",inputMode:"numeric",value:I,onChange:O=>{const de=O.target.value.replace(/[^0-9]/g,"");q(de)},onBlur:()=>{const O=Math.max(0,parseInt(I)||0);Ce(O),q(String(O))},onKeyDown:O=>{if(O.key==="Enter"){const de=Math.max(0,parseInt(I)||0);Ce(de),q(String(de))}},className:"w-20"}),o.jsxs(Pn,{value:W,onValueChange:O=>pe(O),children:[o.jsx(An,{className:"w-20",children:o.jsx(Hn,{})}),o.jsxs(On,{children:[o.jsx(nt,{value:"sec",children:"sec"}),o.jsx(nt,{value:"min",children:"min"}),o.jsx(nt,{value:"hr",children:"hr"})]})]})]})]})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{children:"Clear Pattern"}),o.jsxs(Pn,{value:J.clear_pattern,onValueChange:O=>$({...J,clear_pattern:O}),children:[o.jsx(An,{children:o.jsx(Hn,{})}),o.jsxs(On,{children:[o.jsx(nt,{value:"none",children:"None"}),o.jsx(nt,{value:"adaptive",children:"Adaptive"}),o.jsx(nt,{value:"clear_from_in",children:"Clear From Center"}),o.jsx(nt,{value:"clear_from_out",children:"Clear From Perimeter"}),o.jsx(nt,{value:"clear_sideway",children:"Clear Sideways"}),o.jsx(nt,{value:"random",children:"Random"})]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Pattern to run before each main pattern."})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"Shuffle Playlist"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Randomize pattern order"})]}),o.jsx(Tr,{checked:J.shuffle,onCheckedChange:O=>$({...J,shuffle:O})})]})]})]}),o.jsxs(se,{onClick:Oe,disabled:A==="autoplay",className:"gap-2",children:[A==="autoplay"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save Auto-play Settings"]})]})]}),o.jsxs(Kn,{value:"stillsands",id:"section-stillsands",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Yn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"bedtime"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Still Sands"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Schedule quiet periods for your table"})]})]})}),o.jsxs(Wn,{className:"pt-4 pb-6 space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:"Enable Still Sands"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Pause the table during specified time periods"})]}),o.jsx(Tr,{checked:G.enabled,onCheckedChange:O=>X({...G,enabled:O})})]}),G.enabled&&o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base text-muted-foreground",children:"hourglass_bottom"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"Finish Current Pattern"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Let the current pattern complete before entering still mode"})]})]}),o.jsx(Tr,{checked:G.finish_pattern,onCheckedChange:O=>X({...G,finish_pattern:O})})]}),o.jsx(Xn,{}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base text-muted-foreground",children:"lightbulb"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"Control LED Lights"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Turn off LED lights during still periods"})]})]}),o.jsx(Tr,{checked:G.control_wled,onCheckedChange:O=>X({...G,control_wled:O})})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 pt-3 border-t",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"schedule"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"Timezone"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Select a timezone for scheduling"})]})]}),o.jsx(Bb,{value:G.timezone||"",onValueChange:O=>X({...G,timezone:O}),placeholder:"System Default",searchPlaceholder:"Search timezones...",className:"w-full sm:w-[200px]",options:[{value:"",label:"System Default"},{value:"Etc/GMT+12",label:"UTC-12"},{value:"Etc/GMT+11",label:"UTC-11"},{value:"Etc/GMT+10",label:"UTC-10"},{value:"Etc/GMT+9",label:"UTC-9"},{value:"Etc/GMT+8",label:"UTC-8"},{value:"Etc/GMT+7",label:"UTC-7"},{value:"Etc/GMT+6",label:"UTC-6"},{value:"Etc/GMT+5",label:"UTC-5"},{value:"Etc/GMT+4",label:"UTC-4"},{value:"Etc/GMT+3",label:"UTC-3"},{value:"Etc/GMT+2",label:"UTC-2"},{value:"Etc/GMT+1",label:"UTC-1"},{value:"UTC",label:"UTC"},{value:"Etc/GMT-1",label:"UTC+1"},{value:"Etc/GMT-2",label:"UTC+2"},{value:"Etc/GMT-3",label:"UTC+3"},{value:"Etc/GMT-4",label:"UTC+4"},{value:"Etc/GMT-5",label:"UTC+5"},{value:"Etc/GMT-6",label:"UTC+6"},{value:"Etc/GMT-7",label:"UTC+7"},{value:"Etc/GMT-8",label:"UTC+8"},{value:"Etc/GMT-9",label:"UTC+9"},{value:"Etc/GMT-10",label:"UTC+10"},{value:"Etc/GMT-11",label:"UTC+11"},{value:"Etc/GMT-12",label:"UTC+12"},{value:"America/New_York",label:"America/New_York (Eastern)"},{value:"America/Chicago",label:"America/Chicago (Central)"},{value:"America/Denver",label:"America/Denver (Mountain)"},{value:"America/Los_Angeles",label:"America/Los_Angeles (Pacific)"},{value:"Europe/London",label:"Europe/London"},{value:"Europe/Paris",label:"Europe/Paris"},{value:"Europe/Berlin",label:"Europe/Berlin"},{value:"Asia/Tokyo",label:"Asia/Tokyo"},{value:"Asia/Shanghai",label:"Asia/Shanghai"},{value:"Asia/Singapore",label:"Asia/Singapore"},{value:"Australia/Sydney",label:"Australia/Sydney"}]})]})]}),o.jsxs("div",{className:"p-4 rounded-lg border space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h4",{className:"font-medium",children:"Still Periods"}),o.jsxs(se,{onClick:dt,size:"sm",variant:"secondary",className:"gap-1",children:[o.jsx("span",{className:"material-icons text-base",children:"add"}),"Add Period"]})]}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Define time periods when the sands should rest."}),G.time_slots.length===0?o.jsxs("div",{className:"text-center py-6 text-muted-foreground",children:[o.jsx("span",{className:"material-icons text-3xl mb-2",children:"schedule"}),o.jsx("p",{className:"text-sm",children:"No still periods configured"}),o.jsx("p",{className:"text-xs",children:'Click "Add Period" to create one'})]}):o.jsx("div",{className:"space-y-3",children:G.time_slots.map((O,de)=>o.jsxs("div",{className:"p-3 border rounded-lg bg-muted/50 space-y-3 overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between -mr-1",children:[o.jsxs("span",{className:"text-sm font-medium",children:["Period ",de+1]}),o.jsx(se,{variant:"ghost",size:"icon",onClick:()=>ht(de),className:"h-7 w-7 text-destructive hover:text-destructive",children:o.jsx("span",{className:"material-icons text-lg",children:"delete"})})]}),o.jsxs("div",{className:"grid grid-cols-[1fr_1fr] gap-2",children:[o.jsxs("div",{className:"space-y-1.5 min-w-0 overflow-hidden",children:[o.jsx(Ke,{className:"text-xs",children:"Start Time"}),o.jsx(bt,{type:"time",value:O.start_time,onChange:me=>z(de,{start_time:me.target.value}),className:"text-xs w-full"})]}),o.jsxs("div",{className:"space-y-1.5 min-w-0 overflow-hidden",children:[o.jsx(Ke,{className:"text-xs",children:"End Time"}),o.jsx(bt,{type:"time",value:O.end_time,onChange:me=>z(de,{end_time:me.target.value}),className:"text-xs w-full"})]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Ke,{className:"text-xs",children:"Days"}),o.jsxs(Pn,{value:O.days,onValueChange:me=>z(de,{days:me,...me!=="custom"?{custom_days:[]}:{}}),children:[o.jsx(An,{children:o.jsx(Hn,{})}),o.jsxs(On,{children:[o.jsx(nt,{value:"daily",children:"Daily"}),o.jsx(nt,{value:"weekdays",children:"Weekdays"}),o.jsx(nt,{value:"weekends",children:"Weekends"}),o.jsx(nt,{value:"custom",children:"Custom"})]})]})]}),O.days==="custom"&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(Ke,{className:"text-xs",children:"Select Days"}),o.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{key:"monday",label:"Mon"},{key:"tuesday",label:"Tue"},{key:"wednesday",label:"Wed"},{key:"thursday",label:"Thu"},{key:"friday",label:"Fri"},{key:"saturday",label:"Sat"},{key:"sunday",label:"Sun"}].map(me=>{const Ge=O.custom_days?.includes(me.key);return o.jsx("button",{type:"button",onClick:()=>{const Ie=O.custom_days||[],tt=Ge?Ie.filter(It=>It!==me.key):[...Ie,me.key];z(de,{custom_days:tt})},className:`px-2.5 py-1 text-xs rounded-full border transition-colors ${Ge?"bg-primary text-primary-foreground border-primary":"bg-background text-muted-foreground border-input hover:bg-accent"}`,children:me.label},me.key)})})]})]},de))})]}),o.jsxs(mr,{className:"flex items-start",children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"info"}),o.jsx(gr,{children:"Times are based on the timezone selected above (or system default). Still periods that span midnight (e.g., 22:00 to 06:00) are supported. Patterns resume automatically when still periods end."})]})]}),o.jsxs(se,{onClick:Qe,disabled:A==="stillsands",className:"gap-2",children:[A==="stillsands"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save Still Sands Settings"]})]})]}),o.jsxs(Kn,{value:"security",id:"section-security",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Yn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"lock"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Security"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"App lock and access control"})]})]})}),o.jsxs(Wn,{className:"pt-4 pb-6 space-y-4",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Restrict access to the app to prevent unauthorized changes. Useful for shared spaces or when the table is accessible to children."}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{className:"text-sm font-medium",children:"Security Mode"}),o.jsxs(ch,{value:Q,onValueChange:O=>{const de=O;de==="off"&&Q!=="off"&&!confirm("Turn off security? This will remove the password and unlock the app.")||(te(de),_e(""),Me(""))},className:"space-y-2",children:[o.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border",children:[o.jsx(ys,{value:"off",id:"security-off",className:"mt-0.5"}),o.jsxs("div",{children:[o.jsx(Ke,{htmlFor:"security-off",className:"font-medium cursor-pointer",children:"Off"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"No restrictions. Anyone can use the app."})]})]}),o.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border",children:[o.jsx(ys,{value:"play_only",id:"security-play-only",className:"mt-0.5"}),o.jsxs("div",{children:[o.jsx(Ke,{htmlFor:"security-play-only",className:"font-medium cursor-pointer",children:"Play Only"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Anyone can browse and play patterns. Settings require a password."})]})]}),o.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border",children:[o.jsx(ys,{value:"lockdown",id:"security-lockdown",className:"mt-0.5"}),o.jsxs("div",{children:[o.jsx(Ke,{htmlFor:"security-lockdown",className:"font-medium cursor-pointer",children:"Full Lockdown"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Password required to access the entire app."})]})]})]})]}),Q!=="off"&&o.jsxs("div",{className:"space-y-3 pt-2",children:[o.jsx(Xn,{}),ce&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"A password is currently set. Enter a new password below to change it, or leave blank to keep the existing one."}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ke,{htmlFor:"security-password",children:ce?"New Password":"Password"}),o.jsx(bt,{id:"security-password",type:"password",placeholder:ce?"Leave blank to keep current":"Enter password",value:he,onChange:O=>_e(O.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ke,{htmlFor:"security-password-confirm",children:"Confirm Password"}),o.jsx(bt,{id:"security-password-confirm",type:"password",placeholder:"Confirm password",value:je,onChange:O=>Me(O.target.value)})]}),he&&je&&he!==je&&o.jsx("p",{className:"text-sm text-destructive",children:"Passwords do not match"})]}),o.jsxs(se,{onClick:async()=>{if(Q!=="off"){if(he&&he!==je){K.error("Passwords do not match");return}if(!ce&&!he){K.error("Please set a password");return}}D("security");try{const O={security:{mode:Q}};he&&(O.security.password=he),await fe.patch("/api/settings",O),K.success("Security settings saved"),_e(""),Me(""),He(Q!=="off"),window.dispatchEvent(new CustomEvent("security-updated"))}catch{K.error("Failed to save security settings")}finally{D(null)}},disabled:A==="security"||Q!=="off"&&he!==""&&he!==je||Q!=="off"&&!ce&&!he,className:"w-full gap-2",children:[A==="security"?o.jsx("span",{className:"material-icons-outlined animate-spin",children:"sync"}):o.jsx("span",{className:"material-icons-outlined",children:"save"}),"Save Security Settings"]})]})]}),o.jsxs(Kn,{value:"wifi",id:"section-wifi",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Yn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"wifi"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"WiFi"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Network connection settings"})]})]})}),o.jsxs(Wn,{className:"pt-4 pb-6 space-y-3",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage WiFi connections, scan for networks, and configure hotspot mode."}),o.jsxs(se,{variant:"outline",className:"w-full gap-2",onClick:()=>n("/wifi-setup"),children:[o.jsx("span",{className:"material-icons-outlined",children:"settings"}),"Open WiFi Setup"]})]})]}),o.jsxs(Kn,{value:"version",id:"section-version",className:"border rounded-lg px-4 overflow-visible bg-card",children:[o.jsx(Yn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"info"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Software Version"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Updates and system information"})]})]})}),o.jsxs(Wn,{className:"pt-4 pb-6 space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg bg-muted/50",children:[o.jsx("div",{className:"w-10 h-10 flex items-center justify-center bg-background rounded-lg",children:o.jsx("span",{className:"material-icons text-muted-foreground",children:"terminal"})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:"font-medium",children:"Current Version"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:Le?.current?`v${Le.current}`:"Loading..."})]})]}),o.jsxs("div",{className:"flex items-center gap-4 p-4 rounded-lg bg-muted/50",children:[o.jsx("div",{className:"w-10 h-10 flex items-center justify-center bg-background rounded-lg",children:o.jsx("span",{className:"material-icons text-muted-foreground",children:"system_update"})}),o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:"font-medium",children:"Latest Version"}),o.jsxs("p",{className:`text-sm ${Le?.update_available?"text-green-600 dark:text-green-400 font-medium":"text-muted-foreground"}`,children:[Le?.latest?o.jsxs("a",{href:`https://github.com/tuanchris/dune-weaver/releases/tag/v${Le.latest}`,target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:opacity-80 transition-opacity",children:["v",Le.latest]}):"Checking...",Le?.update_available&&" (Update available!)"]})]})]}),Le?.update_available&&o.jsxs(se,{onClick:()=>$e(!0),className:"w-full",children:[o.jsx("span",{className:"material-icons text-base mr-2",children:"system_update"}),"Update Now"]}),o.jsx(jse,{open:wt,onOpenChange:$e,currentVersion:Le?.current||"",latestVersion:Le?.latest||""})]})]})]})]})}function NO({signal:e}){const t=e>=75?"signal_wifi_4_bar":e>=50?"network_wifi_3_bar":e>=25?"network_wifi_2_bar":"network_wifi_1_bar",n=e>=50?"text-green-500":e>=25?"text-yellow-500":"text-red-500";return o.jsx("span",{className:`material-icons text-lg ${n}`,children:t})}function _se(){const[e,t]=g.useState(null),[n,a]=g.useState([]),[i,l]=g.useState([]),[u,d]=g.useState(null),[h,p]=g.useState(""),[v,m]=g.useState(!1),[b,w]=g.useState(!1),[C,S]=g.useState(!1),[j,N]=g.useState(!1),[_,T]=g.useState(!1),[A,D]=g.useState(""),[L,k]=g.useState(null),[P,U]=g.useState(""),[J,$]=g.useState(""),[W,pe]=g.useState(!1),[Se,Ce]=g.useState(!1),I=g.useCallback(async()=>{try{const ce=await fe.get("/api/wifi/status");t(ce)}catch{}},[]),q=g.useCallback(async()=>{try{const ce=await fe.get("/api/wifi/saved");l(ce)}catch{}},[]),H=g.useCallback(async()=>{try{const ce=await fe.get("/api/wifi/hotspot/password");U(ce.password),$(ce.password)}catch{}},[]),be=g.useCallback(async()=>{w(!0);try{const ce=await fe.get("/api/wifi/networks");a(ce)}catch{K.error("Failed to scan networks")}finally{w(!1)}},[]);g.useEffect(()=>{I(),be(),q(),H()},[I,be,q,H]);const Ne=_||u&&u.security!=="Open"&&!u.saved,B=async()=>{const ce=_?A.trim():u?.ssid;if(ce){S(!0);try{const He=await fe.post("/api/wifi/connect",{ssid:ce,password:Ne?h:""});He.success&&(K.success(He.message),_e(),I(),q(),be())}catch(He){const Le=He instanceof Error?He.message:"Connection failed";K.error(Le)}finally{S(!1)}}},G=async()=>{const ce=A.trim();if(ce){N(!0);try{const He=await fe.post("/api/wifi/save",{ssid:ce,password:h||""});He.success&&(K.success(He.message),_e(),q())}catch(He){const Le=He instanceof Error?He.message:"Failed to save network";K.error(Le)}finally{N(!1)}}},X=async()=>{if(!L)return;const ce=L;k(null);try{await fe.post("/api/wifi/forget",{ssid:ce}),K.success(`Forgot '${ce}'`),q(),be()}catch{K.error("Failed to forget network")}},oe=L===e?.ssid,xe=i.filter(ce=>ce.ssid!==L).length,Q=oe&&xe===0,te=async()=>{Ce(!0);try{const ce=await fe.post("/api/wifi/hotspot/password",{password:J});ce.success&&(U(J),K.success(ce.message))}catch(ce){const He=ce instanceof Error?ce.message:"Failed to update password";K.error(He)}finally{Ce(!1)}},he=ce=>{d(ce),p(""),m(!1)},_e=()=>{!C&&!j&&(d(null),p(""),m(!1),T(!1),D(""))},je=()=>{T(!0),D(""),p(""),m(!1),d({ssid:"",signal:0,security:"Manual",saved:!1,active:!1})},Me=e?.mode==="hotspot";return o.jsxs("div",{className:"container max-w-lg mx-auto px-3 py-4 space-y-3",children:[Me&&o.jsxs(mr,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/30 dark:border-blue-800",children:[o.jsx("span",{className:"material-icons text-blue-500 mr-2",children:"wifi_tethering"}),o.jsxs(gr,{children:[o.jsx("strong",{children:"Welcome to Dune Weaver!"}),o.jsx("br",{}),"Connect to your home WiFi network below to get started."]})]}),o.jsx(Un,{children:o.jsxs(qn,{className:"pt-4 pb-3 px-4",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("span",{className:"material-icons-outlined text-base text-muted-foreground",children:"info"}),o.jsx("span",{className:"font-semibold text-sm",children:"WiFi Status"})]}),e?o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-y-1 text-sm",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-1",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"Mode"}),o.jsx(Al,{variant:Me?"secondary":"default",className:"text-xs px-1.5 py-0",children:e.mode==="hotspot"?"Hotspot":e.mode==="client"?"Connected":e.mode})]}),e.ssid&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"Network"}),o.jsx("span",{className:"font-medium text-xs",children:e.ssid})]}),e.ip&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"IP"}),o.jsx("span",{className:"font-mono text-xs",children:e.ip})]})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"Host"}),o.jsxs("span",{className:"font-mono text-xs",children:[e.hostname,".local"]})]})]}):o.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading status..."}),!Me&&o.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"WiFi management requires a Raspberry Pi."})]})}),i.length>0&&o.jsx(Un,{children:o.jsxs(qn,{className:"pt-4 pb-2 px-4",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("span",{className:"material-icons-outlined text-base text-muted-foreground",children:"bookmark"}),o.jsx("span",{className:"font-semibold text-sm",children:"Saved Networks"})]}),o.jsx("div",{className:"space-y-0.5",children:i.map(ce=>o.jsxs("div",{className:"flex items-center justify-between px-2.5 py-2 rounded-lg hover:bg-muted/50",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx("span",{className:"material-icons text-muted-foreground text-lg",children:"wifi"}),o.jsx("span",{className:"font-medium text-sm",children:ce.ssid})]}),o.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>k(ce.ssid),children:o.jsx("span",{className:"material-icons text-sm text-destructive",children:"delete"})})]},ce.name))})]})}),o.jsx(Un,{children:o.jsxs(qn,{className:"pt-4 pb-3 px-4",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("span",{className:"material-icons-outlined text-base text-muted-foreground",children:"wifi_tethering"}),o.jsx("span",{className:"font-semibold text-sm",children:"Hotspot Password"}),!P&&o.jsx(Al,{variant:"secondary",className:"text-xs px-1.5 py-0",children:"Open"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Set a password for the Dune Weaver hotspot. Leave empty for an open network."}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(bt,{type:W?"text":"password",value:J,onChange:ce=>$(ce.target.value),placeholder:"No password (open)",className:"pr-8 h-8 text-sm",onKeyDown:ce=>{ce.key==="Enter"&&J!==P&&te()}}),o.jsx("button",{type:"button",onClick:()=>pe(!W),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:o.jsx("span",{className:"material-icons text-sm",children:W?"visibility_off":"visibility"})})]}),o.jsx(se,{size:"sm",className:"h-8",onClick:te,disabled:Se||J===P||J.length>0&&J.length<8,children:Se?o.jsx("span",{className:"material-icons text-sm animate-spin",children:"refresh"}):"Save"})]}),J&&J.length<8&&J.length>0&&o.jsx("p",{className:"text-xs text-destructive mt-1",children:"Password must be at least 8 characters"})]})}),Me&&o.jsxs(o.Fragment,{children:[o.jsx(Xn,{}),o.jsxs("div",{className:"text-center text-sm text-muted-foreground space-y-1",children:[o.jsx("p",{children:"After connecting, access Dune Weaver at:"}),o.jsxs("code",{className:"text-xs bg-muted px-2 py-1 rounded",children:["http://",e?.hostname||"duneweaver",".local"]})]})]}),o.jsx(Un,{children:o.jsxs(qn,{className:"pt-4 pb-3 px-4",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("span",{className:"material-icons-outlined text-base text-muted-foreground",children:"settings_power"}),o.jsx("span",{className:"font-semibold text-sm",children:"System"})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(se,{variant:"outline",size:"sm",className:"flex-1 h-8",onClick:async()=>{if(confirm("Restart Dune Weaver?"))try{await fe.post("/api/system/restart"),K.success("Restarting...")}catch{K.error("Failed to restart")}},children:[o.jsx("span",{className:"material-icons-outlined text-sm mr-1.5",children:"restart_alt"}),"Restart"]}),o.jsxs(se,{variant:"outline",size:"sm",className:"flex-1 h-8 text-destructive hover:text-destructive",onClick:async()=>{if(confirm("Shutdown the system?"))try{await fe.post("/api/system/shutdown"),K.success("Shutting down...")}catch{K.error("Failed to shutdown")}},children:[o.jsx("span",{className:"material-icons-outlined text-sm mr-1.5",children:"power_settings_new"}),"Shutdown"]})]})]})}),o.jsx(Un,{children:o.jsxs(qn,{className:"pt-4 pb-2 px-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"material-icons-outlined text-base text-muted-foreground",children:"wifi_find"}),o.jsx("span",{className:"font-semibold text-sm",children:"Networks"}),o.jsx("span",{className:"text-xs text-muted-foreground",children:n.length>0?`(${n.length})`:""})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:je,title:"Add network manually",children:o.jsx("span",{className:"material-icons text-base",children:"add"})}),o.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:be,disabled:b,children:o.jsx("span",{className:`material-icons text-base ${b?"animate-spin":""}`,children:"refresh"})})]})]}),o.jsxs("div",{className:"space-y-0.5",children:[n.length===0&&b&&o.jsx("p",{className:"text-sm text-muted-foreground text-center py-3",children:"Scanning for networks..."}),n.length===0&&!b&&o.jsx("p",{className:"text-sm text-muted-foreground text-center py-3",children:"No networks found. Try scanning again."}),n.map(ce=>o.jsxs("button",{onClick:()=>he(ce),className:`w-full flex items-center gap-2.5 px-2.5 py-2 rounded-lg text-left transition-colors hover:bg-muted/50
  84. ${ce.active?"bg-green-50 dark:bg-green-950/20":""}`,children:[o.jsx(NO,{signal:ce.signal}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-medium text-sm truncate",children:ce.ssid}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[ce.security,ce.saved&&" · Saved",ce.active&&" · Connected"]})]}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[ce.signal,"%"]}),ce.security!=="Open"&&o.jsx("span",{className:"material-icons text-sm text-muted-foreground",children:"lock"})]},ce.ssid))]})]})}),o.jsx(ga,{open:L!==null,onOpenChange:ce=>{ce||k(null)},children:o.jsxs(Wr,{className:"sm:max-w-md",children:[o.jsxs(Mr,{children:[o.jsxs(Dr,{children:["Forget '",L,"'?"]}),o.jsx(vi,{children:Q?o.jsxs(o.Fragment,{children:["This is your only saved network. Forgetting it will start the"," ",o.jsx("strong",{children:"Dune Weaver"})," hotspot. Connect to the Dune Weaver WiFi to access this page again."]}):oe?o.jsx(o.Fragment,{children:"You are currently connected to this network. The system will try the next saved network, or start the hotspot if none are in range."}):"The saved credentials for this network will be removed."})]}),o.jsxs(va,{className:"flex-row gap-2 sm:justify-end",children:[o.jsx(se,{variant:"outline",onClick:()=>k(null),children:"Cancel"}),o.jsx(se,{variant:"destructive",onClick:X,children:"Forget"})]})]})}),o.jsx(ga,{open:u!==null,onOpenChange:ce=>{ce||_e()},children:o.jsxs(Wr,{className:"sm:max-w-md",children:[o.jsxs(Mr,{children:[o.jsx(Dr,{className:"flex items-center gap-2",children:_?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"material-icons text-lg text-muted-foreground",children:"add_circle_outline"}),"Add Network"]}):o.jsxs(o.Fragment,{children:[u&&o.jsx(NO,{signal:u.signal}),u?.ssid]})}),o.jsx(vi,{children:_?"Enter the network name and password":o.jsxs(o.Fragment,{children:[u?.security!=="Open"?"Secured network":"Open network",u?.saved&&" · Saved"]})})]}),o.jsxs("div",{className:"space-y-4",children:[_&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ke,{htmlFor:"wifi-ssid",children:"Network Name (SSID)"}),o.jsx(bt,{id:"wifi-ssid",type:"text",value:A,onChange:ce=>D(ce.target.value),placeholder:"Enter network name",autoFocus:!0})]}),Ne&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(Ke,{htmlFor:"wifi-password",children:"Password"}),o.jsxs("div",{className:"relative",children:[o.jsx(bt,{id:"wifi-password",type:v?"text":"password",value:h,onChange:ce=>p(ce.target.value),placeholder:"Enter WiFi password",autoFocus:!_,onKeyDown:ce=>{ce.key==="Enter"&&h&&B()}}),o.jsx("button",{type:"button",onClick:()=>m(!v),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:o.jsx("span",{className:"material-icons text-sm",children:v?"visibility_off":"visibility"})})]})]}),_?o.jsxs("div",{className:"flex gap-2",children:[o.jsx(se,{variant:"outline",className:"flex-1",onClick:G,disabled:j||C||!A.trim()||!!Ne&&!h,children:j?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"material-icons text-sm animate-spin mr-2",children:"refresh"}),"Saving..."]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"material-icons text-sm mr-2",children:"bookmark_add"}),"Save"]})}),o.jsx(se,{className:"flex-1",onClick:B,disabled:C||j||!A.trim()||!!Ne&&!h,children:C?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"material-icons text-sm animate-spin mr-2",children:"refresh"}),"Connecting..."]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"material-icons text-sm mr-2",children:"wifi"}),"Connect"]})})]}):o.jsx(se,{className:"w-full",onClick:B,disabled:C||!!Ne&&!h,children:C?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"material-icons text-sm animate-spin mr-2",children:"refresh"}),"Connecting..."]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"material-icons text-sm mr-2",children:"wifi"}),"Connect"]})})]})]})})]})}function Ese(){const e=kl(),[t,n]=g.useState(!1),a=()=>{const l=window.open("http://10.42.0.1","_blank");(!l||l.closed)&&n(!0)};return o.jsx("div",{className:"flex flex-col items-center justify-center min-h-[60vh] px-4",children:o.jsxs("div",{className:"w-full max-w-sm text-center space-y-6",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-semibold",children:"Welcome to Dune Weaver"}),o.jsx("p",{className:"text-muted-foreground mt-2",children:"What would you like to do?"})]}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("button",{onClick:()=>e("/wifi-setup"),className:"w-full rounded-lg bg-primary px-6 py-3 font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:"Connect to WiFi"}),o.jsx("button",{onClick:a,className:"w-full rounded-lg border border-border bg-muted px-6 py-3 font-medium hover:bg-accent transition-colors",children:"Control Table"})]}),t&&o.jsxs("div",{className:"rounded-lg bg-muted p-3 text-sm text-muted-foreground",children:["Open your browser and go to:",o.jsx("br",{}),o.jsx("code",{className:"mt-1 inline-block rounded bg-background px-2 py-0.5 text-foreground select-all",children:"http://10.42.0.1"})]})]})})}const G0=[{key:"precheck",label:"Pre-check"},{key:"home",label:"Home"},{key:"test-y",label:"Test Y"},{key:"test-x",label:"Test X"},{key:"fix",label:"Fix"},{key:"sanity-y",label:"Verify Y"},{key:"sanity-x",label:"Verify X"},{key:"complete",label:"Done"}];function Tse(e){return G0.findIndex(t=>t.key===e)}function Rse(){const e=un(m=>m.status?.connection_status??!1),t=un(m=>m.status?.is_running??!1),[n,a]=g.useState({step:"precheck",yCorrect:null,xCorrect:null,sending:!1,fixing:!1}),i=g.useCallback(async(m,b=!0)=>{b&&a(w=>({...w,sending:!0}));try{(await fe.post("/api/fluidnc/command",{command:m})).success||K.error("Command failed")}catch(w){K.error(`Error: ${w instanceof Error?w.message:"Unknown error"}`)}finally{b&&a(w=>({...w,sending:!1}))}},[]),l=g.useCallback(async m=>{a(b=>({...b,fixing:!0}));try{await fe.patch("/api/fluidnc/config",{axes:{[m]:{direction_inverted:!0}}}),K.success(`${m.toUpperCase()} direction toggled and saved`)}catch(b){K.error(`Fix failed: ${b instanceof Error?b.message:"Unknown"}`)}finally{a(b=>({...b,fixing:!1}))}},[]),u=g.useCallback(async()=>{a(m=>({...m,fixing:!0}));try{await fe.post("/api/fluidnc/command",{command:"$Bye",timeout:2}),K.success("Restart command sent. Reconnect when ready.")}catch{K.info("Restart command sent. The controller will reboot.")}finally{a(m=>({...m,fixing:!1}))}},[]),d=g.useCallback(async(m=3e4)=>{const b=Date.now();for(;Date.now()-b<m;){await new Promise(w=>setTimeout(w,1e3));try{if((await fe.post("/api/fluidnc/command",{command:"?",timeout:2})).responses?.some(C=>C.includes("Idle")))return!0}catch{}}return!1},[]),h=()=>a({step:"precheck",yCorrect:null,xCorrect:null,sending:!1,fixing:!1}),p=Tse(n.step),v=e&&!t;return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-2",children:G0.map((m,b)=>o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{type:"button",title:m.label,onClick:()=>a(w=>({...w,step:m.key})),className:`flex items-center justify-center w-7 h-7 rounded-full text-xs font-medium shrink-0 cursor-pointer transition-opacity hover:opacity-80 ${b<p?"bg-primary text-primary-foreground":b===p?"bg-primary text-primary-foreground ring-2 ring-primary/30":"bg-muted text-muted-foreground"}`,children:b<p?o.jsx("span",{className:"material-icons-outlined text-sm",children:"check"}):b+1}),b<G0.length-1&&o.jsx("div",{className:`w-4 h-0.5 ${b<p?"bg-primary":"bg-muted"}`})]},m.key))}),n.step==="precheck"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"font-semibold",children:"Pre-check"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Verify the table is connected and no pattern is running before calibrating motor directions."}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:`material-icons-outlined text-base ${e?"text-green-500":"text-red-500"}`,children:e?"check_circle":"cancel"}),o.jsx("span",{className:"text-sm",children:"Controller connected"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:`material-icons-outlined text-base ${t?"text-red-500":"text-green-500"}`,children:t?"cancel":"check_circle"}),o.jsx("span",{className:"text-sm",children:"No pattern running"})]})]}),o.jsx(se,{onClick:()=>a(m=>({...m,step:"home"})),disabled:!v,children:"Begin Calibration"})]}),n.step==="home"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"font-semibold",children:"Home Table"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Home the table to establish a known position before testing motor directions. The ball will move to the home position."}),o.jsxs("div",{className:"flex gap-3",children:[o.jsxs(se,{onClick:async()=>{a(m=>({...m,sending:!0}));try{await fe.post("/send_home"),K.success("Homing complete"),a(m=>({...m,sending:!1,step:"test-y"}))}catch(m){K.error(`Homing failed: ${m instanceof Error?m.message:"Unknown error"}`),a(b=>({...b,sending:!1}))}},disabled:n.sending,children:[n.sending?o.jsx("span",{className:"material-icons-outlined animate-spin mr-2 text-base",children:"sync"}):o.jsx("span",{className:"material-icons-outlined mr-2 text-base",children:"home"}),n.sending?"Homing...":"Home Table"]}),o.jsx(se,{variant:"outline",onClick:()=>a(m=>({...m,step:"test-y"})),disabled:n.sending,children:"Skip"})]})]}),n.step==="test-y"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"font-semibold",children:"Test Y Axis (Radial)"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["This sends a small radial movement. Watch the ball and answer whether it moved ",o.jsx("strong",{children:"outward"})," (toward the perimeter)."]}),o.jsxs(se,{onClick:()=>i("$J=G91 G21 Y5 F100.0"),disabled:n.sending,children:[n.sending?o.jsx("span",{className:"material-icons-outlined animate-spin mr-2 text-base",children:"sync"}):o.jsx("span",{className:"material-icons-outlined mr-2 text-base",children:"play_arrow"}),"Send Test Command"]}),o.jsxs("div",{className:"flex gap-3 pt-2",children:[o.jsxs(se,{variant:"outline",onClick:()=>a(m=>({...m,yCorrect:!0,step:"test-x"})),disabled:n.sending,children:[o.jsx("span",{className:"material-icons-outlined mr-1 text-base text-green-500",children:"thumb_up"}),"Yes, moved outward"]}),o.jsxs(se,{variant:"outline",onClick:()=>a(m=>({...m,yCorrect:!1,step:"test-x"})),disabled:n.sending,children:[o.jsx("span",{className:"material-icons-outlined mr-1 text-base text-red-500",children:"thumb_down"}),"No, moved inward"]})]})]}),n.step==="test-x"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"font-semibold",children:"Test X Axis (Angular)"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["This sends a small angular movement. Watch the ball and answer whether it moved ",o.jsx("strong",{children:"clockwise"})," when viewed from above."]}),o.jsxs(se,{onClick:()=>i("$J=G91 G21 X5 F100.0"),disabled:n.sending,children:[n.sending?o.jsx("span",{className:"material-icons-outlined animate-spin mr-2 text-base",children:"sync"}):o.jsx("span",{className:"material-icons-outlined mr-2 text-base",children:"play_arrow"}),"Send Test Command"]}),o.jsxs("div",{className:"flex gap-3 pt-2",children:[o.jsxs(se,{variant:"outline",onClick:()=>{a(m=>({...m,xCorrect:!0,step:m.yCorrect===!1?"fix":"sanity-y"}))},disabled:n.sending,children:[o.jsx("span",{className:"material-icons-outlined mr-1 text-base text-green-500",children:"thumb_up"}),"Yes, moved clockwise"]}),o.jsxs(se,{variant:"outline",onClick:()=>a(m=>({...m,xCorrect:!1,step:"fix"})),disabled:n.sending,children:[o.jsx("span",{className:"material-icons-outlined mr-1 text-base text-red-500",children:"thumb_down"}),"No, moved counter-clockwise"]})]})]}),n.step==="fix"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"font-semibold",children:"Fix Motor Directions"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["The following axes need their direction inverted. Click to auto-fix by toggling the ",o.jsx("code",{children:":low"})," flag on the direction pin."]}),o.jsxs("div",{className:"space-y-3",children:[n.yCorrect===!1&&o.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-medium text-sm",children:"Y Axis (Radial)"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Direction is inverted"})]}),o.jsx(se,{size:"sm",onClick:()=>l("y"),disabled:n.fixing,children:n.fixing?"Fixing...":"Fix Automatically"})]}),n.xCorrect===!1&&o.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-medium text-sm",children:"X Axis (Angular)"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Direction is inverted"})]}),o.jsx(se,{size:"sm",onClick:()=>l("x"),disabled:n.fixing,children:n.fixing?"Fixing...":"Fix Automatically"})]})]}),o.jsxs(mr,{children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"warning"}),o.jsx(gr,{children:"Direction pin changes require a controller restart to take effect. After fixing, restart the controller below, then re-run the wizard to verify."})]}),o.jsxs("div",{className:"flex gap-3",children:[o.jsxs(se,{variant:"outline",onClick:u,disabled:n.fixing,children:[o.jsx("span",{className:"material-icons-outlined mr-2 text-base",children:"restart_alt"}),"Restart Controller"]}),o.jsx(se,{onClick:()=>a(m=>({...m,step:"sanity-y"})),children:"Continue to Verification"})]})]}),n.step==="sanity-y"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"font-semibold",children:"Verify Y Axis (Larger Movement)"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["This moves the ball to center first, then sends a longer radial movement. The ball should move clearly from ",o.jsx("strong",{children:"center toward the perimeter"}),"."]}),o.jsxs(se,{onClick:async()=>{a(m=>({...m,sending:!0}));try{await fe.post("/move_to_center"),await d(6e4),await i("$J=G91 G21 Y20 F100.0",!1),await d()}finally{a(m=>({...m,sending:!1}))}},disabled:n.sending,children:[n.sending?o.jsx("span",{className:"material-icons-outlined animate-spin mr-2 text-base",children:"sync"}):o.jsx("span",{className:"material-icons-outlined mr-2 text-base",children:"play_arrow"}),n.sending?"Moving...":"Send Verification Command"]}),o.jsxs("div",{className:"flex flex-wrap gap-3 pt-2",children:[o.jsxs(se,{onClick:()=>a(m=>({...m,step:"sanity-x"})),disabled:n.sending,children:[o.jsx("span",{className:"material-icons-outlined mr-1 text-base text-green-500",children:"check"}),"Looks Correct"]}),o.jsxs(se,{variant:"outline",onClick:()=>a(m=>({...m,step:"dip-check"})),disabled:n.sending,children:[o.jsx("span",{className:"material-icons-outlined mr-1 text-base text-amber-500",children:"warning"}),"Only Moved Halfway"]}),o.jsx(se,{variant:"outline",onClick:h,disabled:n.sending,children:"Start Over"})]})]}),n.step==="sanity-x"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"font-semibold",children:"Verify X Axis (Larger Movement)"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["This sends a larger angular movement. The ball should make roughly a ",o.jsx("strong",{children:"full clockwise rotation"}),". It will also spiral inward slightly — this is normal due to the mechanical coupling between the angular and radial axes."]}),o.jsxs(se,{onClick:async()=>{a(m=>({...m,sending:!0}));try{await i("$J=G91 G21 X50 F100.0",!1),await d()}finally{a(m=>({...m,sending:!1}))}},disabled:n.sending,children:[n.sending?o.jsx("span",{className:"material-icons-outlined animate-spin mr-2 text-base",children:"sync"}):o.jsx("span",{className:"material-icons-outlined mr-2 text-base",children:"play_arrow"}),n.sending?"Moving...":"Send Verification Command"]}),o.jsxs("div",{className:"flex flex-wrap gap-3 pt-2",children:[o.jsxs(se,{onClick:()=>a(m=>({...m,step:"complete"})),disabled:n.sending,children:[o.jsx("span",{className:"material-icons-outlined mr-1 text-base text-green-500",children:"check"}),"Looks Correct"]}),o.jsxs(se,{variant:"outline",onClick:()=>a(m=>({...m,step:"dip-check"})),disabled:n.sending,children:[o.jsx("span",{className:"material-icons-outlined mr-1 text-base text-amber-500",children:"warning"}),"Only Half a Revolution"]}),o.jsx(se,{variant:"outline",onClick:h,disabled:n.sending,children:"Start Over"})]})]}),n.step==="dip-check"&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"font-semibold",children:"Check DIP Switches"}),o.jsxs(mr,{variant:"destructive",children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"power_off"}),o.jsxs(gr,{children:[o.jsx("strong",{children:"Turn off the table completely"})," before touching any hardware. Disconnect power before checking DIP switches."]})]}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["If the ball only moved ",o.jsx("strong",{children:"half the expected distance"}),", the stepper driver microstepping DIP switches are likely misconfigured."]}),o.jsxs("div",{className:"rounded-lg border p-4 space-y-3 bg-muted/30",children:[o.jsx("p",{className:"text-sm font-medium",children:"How to fix:"}),o.jsxs("ol",{className:"text-sm text-muted-foreground list-decimal list-inside space-y-2",children:[o.jsx("li",{children:"Power off the table completely"}),o.jsx("li",{children:"Locate the DIP switches underneath each stepper driver"}),o.jsxs("li",{children:["Set ",o.jsx("strong",{children:"all DIP switches to OFF"})," (this selects full-step or the driver's default microstepping)"]}),o.jsx("li",{children:"Power the table back on and re-run the calibration wizard"})]})]}),o.jsx("div",{className:"flex gap-3",children:o.jsx(se,{variant:"outline",onClick:h,children:"Restart Wizard"})})]}),n.step==="complete"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-2 text-green-600",children:[o.jsx("span",{className:"material-icons-outlined text-2xl",children:"check_circle"}),o.jsx("h3",{className:"font-semibold text-lg",children:"Calibration Complete"})]}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Both axes are moving in the correct directions. Your table is ready to use."}),o.jsx(se,{variant:"outline",onClick:h,children:"Run Again"})]})]})}const Ase=[{key:"steps_per_mm",label:"Steps per mm",unit:"steps"},{key:"max_rate_mm_per_min",label:"Max Rate",unit:"mm/min"},{key:"acceleration_mm_per_sec2",label:"Acceleration",unit:"mm/s²"}],Ose=[{key:"homing_cycle",label:"Homing Cycle",unit:"-1 = disabled"},{key:"homing_mpos_mm",label:"Homing MPos",unit:"mm"},{key:"homing_feed_mm_per_min",label:"Homing Feed Rate",unit:"mm/min"},{key:"homing_seek_mm_per_min",label:"Homing Seek Rate",unit:"mm/min"},{key:"homing_settle_ms",label:"Homing Settle Time",unit:"ms"},{key:"homing_seek_scaler",label:"Homing Seek Scaler",unit:""},{key:"homing_feed_scaler",label:"Homing Feed Scaler",unit:""},{key:"pulloff_mm",label:"Pulloff Distance",unit:"mm"}],Mse=[{key:"homing_positive_direction",label:"Positive Direction"}];function Dse(){const e=un(w=>w.status?.connection_status??!1),[t,n]=g.useState(null),[a,i]=g.useState(null),[l,u]=g.useState(!1),[d,h]=g.useState(!1),p=g.useCallback(async()=>{u(!0);try{const w=await fe.get("/api/fluidnc/config");w.success&&(n(w.settings),i(structuredClone(w.settings)),K.success("Configuration loaded from controller"))}catch(w){K.error(`Failed to read config: ${w instanceof Error?w.message:"Unknown"}`)}finally{u(!1)}},[]),v=g.useCallback(async()=>{if(!(!t||!a)){h(!0);try{const w={};for(const S of["x","y"]){const j={},N=t.axes[S],_=a.axes[S];for(const T of Object.keys(N))T!=="direction_pin"&&N[T]!==_[T]&&N[T]!==null&&(j[T]=N[T]);Object.keys(j).length>0&&(w.axes||(w.axes={}),w.axes[S]=j)}if(t.start.must_home!==a.start.must_home&&t.start.must_home!==null&&(w.start={must_home:t.start.must_home}),!w.axes&&!w.start){K.info("No changes to save"),h(!1);return}const C=await fe.patch("/api/fluidnc/config",w);C.success&&(i(structuredClone(t)),C.restart_required?K.warning("Settings saved. Direction pin changes require a controller restart."):C.saved?K.success(`Saved ${C.changes_applied.length} setting(s) to controller`):K.warning("Settings applied but flash save may have failed"))}catch(w){K.error(`Save failed: ${w instanceof Error?w.message:"Unknown"}`)}finally{h(!1)}}},[t,a]),m=(w,C,S)=>{n(j=>j&&{...j,axes:{...j.axes,[w]:{...j.axes[w],[C]:S}}})},b=t&&a?JSON.stringify(t)!==JSON.stringify(a):!1;return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs(se,{onClick:p,disabled:l||!e,children:[l?o.jsx("span",{className:"material-icons-outlined animate-spin mr-2 text-base",children:"sync"}):o.jsx("span",{className:"material-icons-outlined mr-2 text-base",children:"download"}),l?"Reading...":"Read from Controller"]}),t&&o.jsxs(se,{onClick:v,disabled:d||!b,children:[d?o.jsx("span",{className:"material-icons-outlined animate-spin mr-2 text-base",children:"sync"}):o.jsx("span",{className:"material-icons-outlined mr-2 text-base",children:"save"}),d?"Saving...":"Save to Controller"]}),b&&o.jsx(Al,{variant:"secondary",children:"Unsaved changes"})]}),!e&&o.jsxs(mr,{children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"link_off"}),o.jsx(gr,{children:"Connect to a controller first to read or modify FluidNC settings."})]}),t&&o.jsx(l1,{type:"multiple",defaultValue:["axis-x","axis-y"],children:["x","y"].map(w=>o.jsxs(Kn,{value:`axis-${w}`,className:"border rounded-lg px-4 mt-2 bg-card",children:[o.jsx(Yn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:w==="x"?"rotate_right":"swap_vert"}),o.jsxs("div",{className:"text-left",children:[o.jsxs("div",{className:"font-semibold",children:[w.toUpperCase()," Axis — ",w==="x"?"Angular":"Radial"]}),o.jsxs("div",{className:"text-sm text-muted-foreground font-normal",children:["Movement, direction, and homing for the ",w==="x"?"angular":"radial"," motor"]})]})]})}),o.jsxs(Wn,{className:"pt-4 pb-6 space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Movement"}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:Ase.map(C=>o.jsxs("div",{className:"space-y-1",children:[o.jsx(Ke,{className:"text-xs text-muted-foreground",children:C.label}),o.jsx(bt,{type:"number",step:"any",value:t.axes[w][C.key]??"",onChange:S=>m(w,C.key,S.target.value?parseFloat(S.target.value):null),placeholder:C.unit})]},C.key))})]}),o.jsx(Xn,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Direction"}),o.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border",children:[o.jsx("div",{children:t.axes[w].direction_pin!==null?o.jsxs("p",{className:"text-xs text-muted-foreground font-mono",children:["Pin: ",t.axes[w].direction_pin]}):o.jsx("p",{className:"text-xs text-muted-foreground",children:"Not available (may not be a stepstick driver)"})}),t.axes[w].direction_inverted!==null&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ke,{className:"text-sm",children:"Inverted"}),o.jsx(Tr,{checked:t.axes[w].direction_inverted??!1,onCheckedChange:C=>m(w,"direction_inverted",C)})]})]})]}),o.jsx(Xn,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(Ke,{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Homing"}),o.jsx("div",{className:"space-y-3",children:Mse.map(C=>o.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg border",children:[o.jsx(Ke,{className:"text-sm",children:C.label}),o.jsx(Tr,{checked:t.axes[w][C.key]??!1,onCheckedChange:S=>m(w,C.key,S)})]},C.key))}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:Ose.map(C=>o.jsxs("div",{className:"space-y-1",children:[o.jsx(Ke,{className:"text-xs text-muted-foreground",children:C.label}),o.jsx(bt,{type:"number",step:"any",value:t.axes[w][C.key]??"",onChange:S=>m(w,C.key,S.target.value?parseFloat(S.target.value):null),placeholder:C.unit})]},C.key))})]})]})]},w))})]})}function Pse(){const e=kl();return o.jsxs("div",{className:"max-w-4xl mx-auto space-y-6 p-4 pb-32",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(se,{variant:"ghost",size:"icon",onClick:()=>e("/settings"),children:o.jsx("span",{className:"material-icons-outlined",children:"arrow_back"})}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-bold",children:"Hardware Setup"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Calibrate motors and configure FluidNC settings"})]})]}),o.jsxs(mr,{children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"info"}),o.jsxs(gr,{children:["This page is for ",o.jsx("strong",{children:"FluidNC-based boards with bipolar stepper motors"})," (DLC32, MKS boards). Not applicable to unipolar/28BYJ-48 setups."]})]}),o.jsxs(l1,{type:"multiple",defaultValue:["calibration","config"],children:[o.jsxs(Kn,{value:"calibration",className:"border rounded-lg px-4 bg-card",children:[o.jsx(Yn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"tune"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"Calibration Wizard"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Verify and fix motor directions step by step"})]})]})}),o.jsx(Wn,{className:"pt-4 pb-6",children:o.jsx(Rse,{})})]}),o.jsxs(Kn,{value:"config",className:"border rounded-lg px-4 mt-2 bg-card",children:[o.jsx(Yn,{className:"hover:no-underline",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"material-icons-outlined text-muted-foreground",children:"settings"}),o.jsxs("div",{className:"text-left",children:[o.jsx("div",{className:"font-semibold",children:"FluidNC Configuration"}),o.jsx("div",{className:"text-sm text-muted-foreground font-normal",children:"Read and edit curated controller settings"})]})]})}),o.jsxs(Wn,{className:"pt-4 pb-6",forceMount:!0,children:[o.jsxs(mr,{className:"mb-4",children:[o.jsx("span",{className:"material-icons-outlined text-base mr-2 shrink-0",children:"warning"}),o.jsx(gr,{children:"These are low-level FluidNC firmware settings. Only modify them if you understand what each parameter does — incorrect values can cause erratic movement or prevent the table from working."})]}),o.jsx(Dse,{})]})]})]})]})}const kse=({...e})=>{const[t,n]=g.useState("light");return g.useEffect(()=>{const a=document.documentElement.classList.contains("dark");n(a?"dark":"light");const i=new MutationObserver(l=>{l.forEach(u=>{if(u.attributeName==="class"){const d=document.documentElement.classList.contains("dark");n(d?"dark":"light")}})});return i.observe(document.documentElement,{attributes:!0}),()=>i.disconnect()},[]),o.jsx(Zz,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})};function Lse(){return o.jsxs(X9,{children:[o.jsx(m6,{children:o.jsxs(Ma,{path:"/",element:o.jsx(LY,{}),children:[o.jsx(Ma,{index:!0,element:o.jsx(ZW,{})}),o.jsx(Ma,{path:"playlists",element:o.jsx(eX,{})}),o.jsx(Ma,{path:"table-control",element:o.jsx(_X,{})}),o.jsx(Ma,{path:"led",element:o.jsx(Bae,{})}),o.jsx(Ma,{path:"settings",element:o.jsx(Nse,{})}),o.jsx(Ma,{path:"wifi-setup",element:o.jsx(_se,{})}),o.jsx(Ma,{path:"captive",element:o.jsx(Ese,{})}),o.jsx(Ma,{path:"setup",element:o.jsx(Pse,{})})]})}),o.jsx(kse,{position:"top-center",richColors:!0,closeButton:!0})]})}const Bse=new Cz({defaultOptions:{queries:{staleTime:1e3*60,retry:1}}});gI.createRoot(document.getElementById("root")).render(o.jsx(g.StrictMode,{children:o.jsx(F6,{children:o.jsx(Nz,{client:Bse,children:o.jsx(Lse,{})})})}))});export default Ise();